@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
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-BQ_8x0bT.js";import{t as a}from"./messages-B5O4OIEo.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-ovkvM8KQ.js";import{i as d}from"./vendor-swr-BIWyz7Rc.js";import{$a as f,$i as p,Ar as m,Ba as h,Bn as g,Bo as _,Ca as v,Ct as y,Ec as b,Fc as x,Fn as S,Gn as C,H as w,Ha as T,Hn as E,Ic as D,In as O,Ja as k,Jn as A,Ka as j,Ln as M,Lr as N,Mi as P,Mn as F,Mr as I,Na as L,Nn as R,Nr as z,Oo as B,Or as ee,Pa as V,Pc as te,Pn as ne,Po as H,Pr as U,Qa as re,Qo as ie,Ra as W,Rn as G,Rs as ae,Sa as K,So as q,St as J,Ta as oe,Ti as se,Tt as ce,Ua as le,Un as ue,Va as de,Wn as fe,Ya as pe,_t as me,aa as he,ai as ge,ba as _e,bc as ve,ci as ye,cs as be,d as xe,di as Se,ea as Ce,fa as Y,fo as we,ga as Te,gc as Ee,gt as De,hc as Oe,ht as ke,ia as Ae,ii as je,jc as Me,jn as Ne,jr as Pe,js as Fe,kr as Ie,ks as Le,li as Re,ls as ze,mo as Be,ms as X,n as Ve,na as He,oa as Ue,oi as We,pt as Ge,qn as Ke,qs as qe,ra as Je,ri as Ye,sa as Xe,si as Ze,t as Qe,ta as $e,u as et,ui as tt,uo as nt,va as rt,vc as it,wa as at,wc as ot,xa as st,ya as ct,yt as lt,zn as ut,zs as dt}from"./index-DdqSO9R2.js";import{t as ft}from"./markdown-editor-AssmZFx4.js";import{n as pt,t as mt}from"./settings-form-section-Dg6LBbcr.js";import{n as ht,t as gt}from"./settings-page-layout-BX4T-OLF.js";import{n as _t}from"./agent-avatar-dicebear-CK3s5cJo.js";import{n as vt,r as yt,t as bt}from"./channel-recipient-api-DdPTtEs8.js";import{n as xt,r as St,t as Ct}from"./utils-D7b_vZnv.js";import{a as wt,i as Tt,n as Et,o as Dt,t as Ot}from"./typed-models-lib-Cx6XV5A2.js";import{a as kt,o as At,r as jt,s as Mt}from"./capability-presets-api-Cx93GLdw.js";import{t as Nt}from"./directory-picker-path-field-D835EHJd.js";var Z=n(),Q=r();function Pt(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)(Je,{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 g=o?f.purgeDisk:f.removeFromConfig,_;t[2]===g?_=t[3]:(_=(0,Q.jsx)(Ue,{className:`text-base font-semibold text-fg`,children:g}),t[2]=g,t[3]=_);let v=o?f.confirmDeletePurge:f.confirmDelete,y;t[4]===v?y=t[5]:(y=(0,Q.jsx)(He,{className:`mt-2 whitespace-pre-wrap text-sm leading-relaxed text-fg-muted`,children:v}),t[4]=v,t[5]=y);let b;t[6]!==f.purgeConfirmHint||t[7]!==f.purgeConfirmLabel||t[8]!==f.purgeConfirmPlaceholder||t[9]!==c||t[10]!==o||t[11]!==s||t[12]!==l?(b=o&&s?(0,Q.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[(0,Q.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-fg`,htmlFor:`agent-delete-confirm`,children:f.purgeConfirmLabel}),(0,Q.jsx)(`input`,{id:`agent-delete-confirm`,type:`text`,autoComplete:`off`,spellCheck:!1,className:i(`w-full rounded-md border border-edge bg-surface-panel px-3 py-1.5 font-mono text-xs text-fg`,`placeholder:text-fg-subtle`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:border-edge`),placeholder:f.purgeConfirmPlaceholder.replace(`{{agentId}}`,s.id),value:c,onChange:e=>l(e.target.value)}),(0,Q.jsx)(`p`,{className:`pt-0.5 text-xs text-fg-muted`,children:f.purgeConfirmHint.replace(`{{agentId}}`,s.id)})]}):null,t[6]=f.purgeConfirmHint,t[7]=f.purgeConfirmLabel,t[8]=f.purgeConfirmPlaceholder,t[9]=c,t[10]=o,t[11]=s,t[12]=l,t[13]=b):b=t[13];let x;t[14]!==f.createModalCancel||t[15]!==a||t[16]!==d?(x=(0,Q.jsx)(h,{type:`button`,variant:`ghost`,disabled:a,onClick:d,children:f.createModalCancel}),t[14]=f.createModalCancel,t[15]=a,t[16]=d,t[17]=x):x=t[17];let S=o?`border-red-200 text-red-700 hover:bg-red-50 dark:border-red-900/60 dark:text-red-300 dark:hover:bg-red-950/40`:void 0,C;t[18]!==a||t[19]!==c||t[20]!==o||t[21]!==s?(C=a||!s||o&&c.trim().toLowerCase()!==s.id.toLowerCase(),t[18]=a,t[19]=c,t[20]=o,t[21]=s,t[22]=C):C=t[22];let w=o?f.purgeDisk:f.removeFromConfig,T;t[23]!==u||t[24]!==C||t[25]!==w||t[26]!==S?(T=(0,Q.jsx)(h,{type:`button`,variant:`secondary`,className:S,disabled:C,onClick:u,children:w}),t[23]=u,t[24]=C,t[25]=w,t[26]=S,t[27]=T):T=t[27];let E;t[28]!==T||t[29]!==x?(E=(0,Q.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-end gap-2 border-t border-edge-subtle/60 pt-3`,children:[x,T]}),t[28]=T,t[29]=x,t[30]=E):E=t[30];let D;t[31]!==E||t[32]!==_||t[33]!==y||t[34]!==b?(D=(0,Q.jsxs)(Ae,{children:[p,(0,Q.jsxs)($e,{className:m,onOpenAutoFocus:Ft,children:[_,y,b,E]})]}),t[31]=E,t[32]=_,t[33]=y,t[34]=b,t[35]=D):D=t[35];let O;return t[36]!==r||t[37]!==n||t[38]!==D?(O=(0,Q.jsx)(he,{open:n,onOpenChange:r,children:D}),t[36]=r,t[37]=n,t[38]=D,t[39]=O):O=t[39],O}function Ft(e){return e.preventDefault()}var It=[{id:`overview`,labelKey:`navOverview`,icon:Le},{id:`behavior`,labelKey:`navBehavior`,icon:we},{id:`tools`,labelKey:`navTools`,icon:le},{id:`skills`,labelKey:`navSkills`,icon:de},{id:`memory`,labelKey:`navMemory`,icon:Ee},{id:`connections`,labelKey:`navConnections`,icon:Oe},{id:`config`,labelKey:`navConfig`,icon:Be},{id:`dangerZone`,labelKey:`navDangerZone`,icon:re}];function Lt(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`,V.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=It.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 Rt(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:m,children:g}=e,_=p===void 0?!0:p,v;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Q.jsx)(Je,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim`,_e)}),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`,ct,`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)(Ue,{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)(He,{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(L,`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)(T,{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)(Ce,{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 O;t[16]!==a||t[17]!==l||t[18]!==c?(O=(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)(Lt,{a,panel:c,onPanelChange:l})}),t[16]=a,t[17]=l,t[18]=c,t[19]=O):O=t[19];let k;t[20]===g?k=t[21]:(k=(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]=k);let A;t[22]!==a.footerSaveNotApplicable||t[23]!==a.personaSaved||t[24]!==a.save||t[25]!==m||t[26]!==d||t[27]!==f||t[28]!==u||t[29]!==_?(A=_?(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-1 border-t border-edge-subtle px-4 py-3 dark:border-edge sm:flex-row sm:items-center sm:justify-end sm:gap-3`,children:[f?(0,Q.jsxs)(`p`,{className:`order-2 text-center text-xs font-medium text-green-600 sm:order-1 sm:mr-auto sm:text-left dark:text-green-400`,children:[`✓ `,a.personaSaved]}):d?(0,Q.jsx)(`p`,{className:`order-2 text-center text-xs text-fg-muted sm:order-1 sm:mr-auto sm:text-left`,children:a.footerSaveNotApplicable}):null,(0,Q.jsx)(h,{type:`button`,className:`order-1 w-full sm:order-2 sm:w-auto`,disabled:m||d,onClick:()=>void u(),children:a.save})]}):null,t[22]=a.footerSaveNotApplicable,t[23]=a.personaSaved,t[24]=a.save,t[25]=m,t[26]=d,t[27]=f,t[28]=u,t[29]=_,t[30]=A):A=t[30];let j;t[31]!==k||t[32]!==A?(j=(0,Q.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[k,A]}),t[31]=k,t[32]=A,t[33]=j):j=t[33];let M;t[34]!==O||t[35]!==j?(M=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col sm:flex-row sm:overflow-hidden`,children:[O,j]}),t[34]=O,t[35]=j,t[36]=M):M=t[36];let N;t[37]!==M||t[38]!==D?(N=(0,Q.jsxs)(Ae,{children:[v,(0,Q.jsx)($e,{className:y,onOpenAutoFocus:zt,children:(0,Q.jsxs)(ke,{layer:`modal`,children:[D,M]})})]}),t[37]=M,t[38]=D,t[39]=N):N=t[39];let P;return t[40]!==r||t[41]!==n||t[42]!==N?(P=(0,Q.jsx)(he,{open:n,onOpenChange:r,children:N}),t[40]=r,t[41]=n,t[42]=N,t[43]=P):P=t[43],P}function zt(e){return e.preventDefault()}var $=e(t(),1),Bt=e=>u(e);function Vt(e){return!e||e.total<=0?null:Math.round(e.helpful/e.total*100)}function Ht(e){let t=Vt(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 Ut({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,g]=(0,$.useState)({}),[_,v]=(0,$.useState)({searchStrategy:`fanout`,writeStrategy:`local-first`,allowExternalWrites:!1,allowedProviderIds:[],autoWriteKinds:[]}),{data:y}=d(l(`/api/memory/providers`),Bt),{data:b,mutate:x}=d(l(`/api/memory/records?status=active&limit=80`),Bt),{data:S,mutate:C}=d(l(`/api/memory/records?status=candidate&limit=80`),Bt),{data:w}=d(l(`/api/memory/signals?limit=50`),Bt),{data:T,mutate:E}=d(l(`/api/memory/traces?limit=80`),Bt),{data:D}=d(l(`/api/memory/feedback-summary?limit=1000`),Bt),{data:O,mutate:k}=d(l(`/api/memory/config${t?`?agentId=${encodeURIComponent(t)}`:``}`),Bt),{data:A,isLoading:j}=d(s?l(`/api/memory/search`):null,e=>u(e,{method:`POST`,body:JSON.stringify({query:s,maxResults:20})})),M=A?.results.map(e=>({...e.record,score:e.score}))??b?.records??[],N=y?.providers.length??0,P=b?.records.length??0,F=S?.records.length??0,I=w?.signals.length??0,L=T?.traces.length??0,R=D?.summaries??[],z=(0,$.useMemo)(()=>new Map(R.map(e=>[e.recordId,e])),[R]),B=R.reduce((e,t)=>e+t.total,0),ee=R.reduce((e,t)=>e+t.helpful,0),V=B>0?Math.round(ee/B*100):null,te=(0,$.useMemo)(()=>[{label:n.providers,value:N},{label:n.records,value:P},{label:n.inbox,value:F},{label:n.signals,value:I},{label:n.traceEvents,value:L},{label:n.recallQuality,value:V==null?`—`:`${V}%`}],[F,V,N,P,I,n.inbox,n.providers,n.recallQuality,n.records,n.signals,n.traceEvents,L]);(0,$.useEffect)(()=>{let e=O?.memory.providerRouting;e&&v({searchStrategy:e.searchStrategy??`fanout`,writeStrategy:e.writeStrategy??`local-first`,allowExternalWrites:e.allowExternalWrites??!1,allowedProviderIds:e.allowedProviderIds??[],autoWriteKinds:e.autoWriteKinds??[]})},[O]);async function ne(){if(O){p(n.saving);try{await u(l(`/api/memory/config`),{method:`PATCH`,body:JSON.stringify({agentId:O.agentId,memory:{...O.memory,providerRouting:_}})}),await k(),p(n.saved)}catch(e){p(e instanceof Error?e.message:n.saveFailed)}}}async function H(e){g(t=>({...t,[e]:n.testing}));try{let t=(await u(l(`/api/memory/providers/${encodeURIComponent(e)}/test`),{method:`POST`})).checks.find(e=>!e.ok);g(r=>({...r,[e]:t?`${t.name}: ${t.message??n.checkFailed}`:n.testPassed})),E()}catch(t){g(r=>({...r,[e]:t instanceof Error?t.message:n.testFailed}))}}async function U(e,t){await u(l(`/api/memory/records/${encodeURIComponent(e)}`),{method:`PATCH`,body:JSON.stringify({status:t})}),await Promise.all([C(),x()])}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`:`flex w-full flex-1 flex-col gap-5 px-3 py-6 sm:px-5 xl:px-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:te.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)(Te,{className:`mt-1 min-h-10 w-full rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg`,value:_.searchStrategy,onChange:e=>v(t=>({...t,searchStrategy:e.target.value})),children:[`fanout`,`local-first`,`external-first`,`local-only`,`external-only`].map(e=>(0,Q.jsx)(rt,{value:e,children:e},e))})]}),(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n.writeStrategy,(0,Q.jsx)(Te,{className:`mt-1 min-h-10 w-full rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg`,value:_.writeStrategy,onChange:e=>v(t=>({...t,writeStrategy:e.target.value})),children:[`local-first`,`write-through`,`external-first`,`local-only`,`external-only`].map(e=>(0,Q.jsx)(rt,{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:_.allowExternalWrites,onChange:e=>v(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:(y?.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:_.allowedProviderIds?.includes(e.id)??!1,onChange:t=>v(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)(h,{type:`button`,variant:`primary`,onClick:ne,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:F})]}),(0,Q.jsxs)(`div`,{className:`divide-y divide-edge`,children:[(S?.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)(h,{type:`button`,variant:`primary`,onClick:()=>U(e.id,`active`),children:n.approve}),(0,Q.jsx)(h,{type:`button`,variant:`secondary`,onClick:()=>U(e.id,`rejected`),children:n.reject}),(0,Q.jsx)(h,{type:`button`,variant:`secondary`,onClick:()=>U(e.id,`needs_review`),children:n.needsReview})]})]},e.id)),F===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)(h,{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}${j?`…`:``}`:n.recentRecords}),(0,Q.jsxs)(`div`,{className:`divide-y divide-edge`,children:[M.map(e=>{let t=z.get(e.id),r=Vt(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 ${Ht(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)}),M.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:(y?.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)(h,{type:`button`,variant:`secondary`,onClick:()=>H(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:[R.slice(0,8).map(e=>{let t=(b?.records??[]).find(t=>t.id===e.recordId),r=Vt(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 ${Ht(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)}),R.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:(w?.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:(T?.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 Wt(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 Gt(e){let t=(0,Z.c)(38),{a:n,defaultModel:r,defaultWorkspace:i,agentModel:a,agentWorkspace:o,onEditModelStrategy:s,onEditWorkspace:c}=e,l=n.inheritance,u;t[0]===a?u=t[1]:(u=a.trim(),t[0]=a,t[1]=u);let d=!u,f;t[2]!==o||t[3]!==i?(f=!o.trim()||i.trim().length>0&&o.trim()===i.trim(),t[2]=o,t[3]=i,t[4]=f):f=t[4];let p=f,m=d?r||l.unset:a,h=p?i||l.unset:o,g;t[5]!==l.subtitle||t[6]!==l.title?(g=(0,Q.jsx)(pt,{icon:ze,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)(Wt,{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)(Wt,{label:l.workspaceLabel,mode:b,value:h,inheritedFrom:x,inheritLabel:l.badgeInherit,overrideLabel:l.badgeOverride,onClick:c}),t[24]=h,t[25]=l.badgeInherit,t[26]=l.badgeOverride,t[27]=l.workspaceLabel,t[28]=c,t[29]=b,t[30]=x,t[31]=S):S=t[31];let C;t[32]!==y||t[33]!==S?(C=(0,Q.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[y,S]}),t[32]=y,t[33]=S,t[34]=C):C=t[34];let w;return t[35]!==g||t[36]!==C?(w=(0,Q.jsxs)(mt,{children:[g,C]}),t[35]=g,t[36]=C,t[37]=w):w=t[37],w}function Kt(e,t){for(let n of t){let t=e[n];if(t)return t}return`default`}function qt(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 Jt(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)(qt,{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 Yt(e,t){return e&&e.length>0?e.join(`, `):t}function Xt(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=()=>G(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(Qt),i=Object.entries(u?.tools?.builtin??{}).sort(Zt),a=u?.skills,o=u?.memory,d=u?.boundaries,f;t[27]!==n.effectiveHint||t[28]!==n.effectiveTitle?(f=(0,Q.jsx)(pt,{icon:be,title:n.effectiveTitle,subtitle:n.effectiveHint}),t[27]=n.effectiveHint,t[28]=n.effectiveTitle,t[29]=f):f=t[29],m=(0,Q.jsxs)(mt,{children:[f,l?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.effectiveLoading}):c?(0,Q.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:c instanceof Error?c.message:n.effectiveError}):u?(0,Q.jsx)(`div`,{children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n.effectivePresetChain}),(0,Q.jsx)(`div`,{className:`rounded-lg border border-edge-subtle bg-surface-panel px-3 py-2 text-sm text-fg`,children:p.length?p.join(` -> `):n.effectiveNoPresets})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n.effectiveModelsTitle}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(Jt,{name:`defaultRole`,value:u.models?.defaultRole??`—`,source:Kt(e,[`models.defaultRole`])}),r.map(t=>{let[n,r]=t;return(0,Q.jsx)(Jt,{name:n,value:r.model,monoValue:!0,source:Kt(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)(Jt,{name:n,value:r.mode,source:Kt(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)(Jt,{name:`mode`,value:a?.mode??`all`,source:Kt(e,[`skills.mode`,`skills`])}),a?.mode===`allowlist`?(0,Q.jsx)(Jt,{name:`allow`,value:Yt(a.allow,`—`),source:Kt(e,[`skills.allow`,`skills`])}):null,a?.mode===`denylist`?(0,Q.jsx)(Jt,{name:`deny`,value:Yt(a.deny,`—`),source:Kt(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)(Jt,{name:`mode`,value:o?.mode??`off`,source:Kt(e,[`memory.mode`,`memory`])}),(0,Q.jsx)(Jt,{name:`sources`,value:Yt(o?.sources,`—`),source:Kt(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)(Jt,{name:`requiresConfirmation`,value:Yt(d?.requiresConfirmation,`—`),source:Kt(e,[`boundaries.requiresConfirmation`,`boundaries`])}),(0,Q.jsx)(Jt,{name:`forbidden`,value:Yt(d?.forbidden,`—`),source:Kt(e,[`boundaries.forbidden`,`boundaries`])}),(0,Q.jsx)(Jt,{name:`escalation`,value:Yt(d?.escalation,`—`),source:Kt(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 Zt(e,t){let[n]=e,[r]=t;return n.localeCompare(r)}function Qt(e,t){let[n]=e,[r]=t;return n.localeCompare(r)}function $t(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 en(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 tn(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)(en,{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)(en,{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)(en,{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)(nn,{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)(rn,{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)(sn,{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 nn(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)($t,{children:(0,Q.jsx)(Gt,{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 rn(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(on)),t[0]=a,t[1]=u);let d=u,p;t[2]!==n.capabilityPresetsGlobalDefault||t[3]!==n.capabilityPresetsGlobalDefaultHint||t[4]!==l||t[5]!==d?(p=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]=p):p=t[6];let m=p,g,_,v,y,x;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]!==m.description||t[21]!==m.id||t[22]!==m.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(an).filter(e=>e!==l&&!o.includes(e)),p=u[0]??``;_=$t,g=mt;let S;t[34]===c?S=t[35]:(S=()=>c(``),t[34]=c,t[35]=S);let C;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Q.jsx)(dt,{className:`size-3.5`,"aria-hidden":!0}),t[36]=C):C=t[36];let w;t[37]!==n.capabilityPresetsManage||t[38]!==i||t[39]!==S?(w=(0,Q.jsxs)(h,{type:`button`,variant:`secondary`,className:`text-xs`,disabled:i,onClick:S,children:[C,n.capabilityPresetsManage]}),t[37]=n.capabilityPresetsManage,t[38]=i,t[39]=S,t[40]=w):w=t[40],t[41]!==n.capabilityPresetsHint||t[42]!==n.capabilityPresetsTitle||t[43]!==w?(v=(0,Q.jsx)(pt,{icon:we,title:n.capabilityPresetsTitle,subtitle:n.capabilityPresetsHint,trailing:w}),t[41]=n.capabilityPresetsHint,t[42]=n.capabilityPresetsTitle,t[43]=w,t[44]=v):v=t[44];let T;t[45]!==m.id||t[46]!==c?(T=()=>c(m.id),t[45]=m.id,t[46]=c,t[47]=T):T=t[47];let E=m.name||n.capabilityPresetsGlobalDefault,D;t[48]===E?D=t[49]:(D=(0,Q.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:E}),t[48]=E,t[49]=D);let O;t[50]===n.capabilityPresetsGlobalDefault?O=t[51]:(O=(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]=O);let k;t[52]!==D||t[53]!==O?(k=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[D,O]}),t[52]=D,t[53]=O,t[54]=k):k=t[54];let A;t[55]===m.id?A=t[56]:(A=(0,Q.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-[11px] text-fg-muted`,children:m.id}),t[55]=m.id,t[56]=A);let j=m.description||n.capabilityPresetsGlobalDefaultHint,M;t[57]===j?M=t[58]:(M=(0,Q.jsx)(`div`,{className:`mt-1 line-clamp-2 text-xs text-fg-muted`,children:j}),t[57]=j,t[58]=M);let N;t[59]!==T||t[60]!==k||t[61]!==A||t[62]!==M?(N=(0,Q.jsx)(`div`,{className:`flex flex-col gap-2 rounded-lg border border-accent/25 bg-accent-soft/20 px-3 py-2 sm:flex-row sm:items-center sm:justify-between`,children:(0,Q.jsxs)(`button`,{type:`button`,className:`min-w-0 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:T,children:[k,A,M]})}),t[59]=T,t[60]=k,t[61]=A,t[62]=M,t[63]=N):N=t[63],y=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[N,o.length>0?o.map((e,t)=>{let r=d.get(e);return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg border border-edge-subtle bg-surface-panel px-3 py-2 sm:flex-row sm:items-center sm:justify-between`,children:[(0,Q.jsxs)(`button`,{type:`button`,className:`min-w-0 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>c(e),children:[(0,Q.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:r?.name??e}),(0,Q.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-[11px] text-fg-muted`,children:e}),r?.description?(0,Q.jsx)(`div`,{className:`mt-1 line-clamp-2 text-xs text-fg-muted`,children:r.description}):null]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-1.5`,children:[(0,Q.jsx)(h,{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)(ot,{className:`size-3.5`,"aria-hidden":!0})}),(0,Q.jsx)(h,{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)(b,{className:`size-3.5`,"aria-hidden":!0})}),(0,Q.jsx)(h,{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)(f,{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})]}),x=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)(Te,{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:p,children:u.map(e=>(0,Q.jsx)(rt,{value:e,children:d.get(e)?.name??e},e))}),(0,Q.jsxs)(h,{type:`button`,variant:`secondary`,disabled:i||!p,onClick:e=>{let t=e.currentTarget.parentElement?.querySelector(`select`)?.value||p;t&&s([...o,t])},children:[(0,Q.jsx)(H,{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]=m.description,t[21]=m.id,t[22]=m.name,t[23]=c,t[24]=s,t[25]=d,t[26]=r.extends,t[27]=g,t[28]=_,t[29]=v,t[30]=y,t[31]=x}else g=t[27],_=t[28],v=t[29],y=t[30],x=t[31];let S;t[64]!==g||t[65]!==v||t[66]!==y||t[67]!==x?(S=(0,Q.jsxs)(g,{children:[v,y,x]}),t[64]=g,t[65]=v,t[66]=y,t[67]=x,t[68]=S):S=t[68];let C;return t[69]!==_||t[70]!==S?(C=(0,Q.jsx)(_,{children:S}),t[69]=_,t[70]=S,t[71]=C):C=t[71],C}function an(e){return e.id}function on(e){return[e.id,e]}function sn(e){let t=(0,Z.c)(3),{a:n,selected:r}=e,i;return t[0]!==n||t[1]!==r?(i=(0,Q.jsx)($t,{children:(0,Q.jsx)(Xt,{a:n,selected:r})}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function cn(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)($t,{children:r.id===`main`?(0,Q.jsx)(mt,{children:(0,Q.jsx)(pt,{icon:re,title:n.dangerZoneTitle,subtitle:n.dangerZoneMainUnavailable})}):(0,Q.jsxs)(mt,{className:`border border-red-200/70 bg-red-50/60 dark:border-red-900/50 dark:bg-red-950/25`,children:[(0,Q.jsx)(pt,{icon:re,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)(h,{type:`button`,variant:`secondary`,disabled:i,onClick:()=>void a(!1),children:[(0,Q.jsx)(f,{className:`mr-1 size-4`,"aria-hidden":!0}),n.removeFromConfig]}),(0,Q.jsx)(h,{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 ln=i(W,`w-full text-xs sm:w-auto sm:min-w-[11rem] sm:max-w-[17rem] sm:shrink-0`);function un(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:g,newBindSessionIdx:_,setNewBindSessionIdx:v,newBindCustomPeer:y,setNewBindCustomPeer:b,onRefreshSessions:x,lastActiveLabels:S,selectRecipient:C}=e,w=!u&&(d||l.length>0),T;t[0]!==n.channelsHint||t[1]!==n.channelsTitle?(T=(0,Q.jsx)(pt,{className:`shrink-0`,icon:ze,title:n.channelsTitle,subtitle:n.channelsHint}),t[0]=n.channelsHint,t[1]=n.channelsTitle,t[2]=T):T=t[2];let E;t[3]!==n.channelsLoading||t[4]!==n.channelsNone||t[5]!==n.removeBinding||t[6]!==o||t[7]!==a||t[8]!==r||t[9]!==s?(E=a?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.channelsLoading}):o.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.channelsNone}):(0,Q.jsx)(`ul`,{className:`flex flex-col gap-2 text-sm`,children:o.map(e=>(0,Q.jsxs)(`li`,{className:`flex flex-wrap items-center justify-between gap-2 rounded-lg border border-edge bg-surface-panel px-3 py-2`,children:[(0,Q.jsx)(`span`,{className:`font-mono text-xs`,children:St(e.match)}),(0,Q.jsx)(h,{type:`button`,variant:`secondary`,disabled:r,onClick:()=>void s(e),children:n.removeBinding})]},`${e.match.channel}-${St(e.match)}`))}),t[3]=n.channelsLoading,t[4]=n.channelsNone,t[5]=n.removeBinding,t[6]=o,t[7]=a,t[8]=r,t[9]=s,t[10]=E):E=t[10];let D;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]!==b||t[20]!==v||t[21]!==d?(D=u?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.channelsLoadingChannels}):d?(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:n.channelLabel}),(0,Q.jsx)(`input`,{className:Ct(),value:f,onChange:e=>p(e.target.value),placeholder:`telegram`,autoComplete:`off`}),(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.channelsManualChannelHint})]}):(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:n.channelLabel}),(0,Q.jsx)(Te,{className:i(Ct(),`py-2`),value:f,onChange:e=>{p(e.target.value),v(null),b(``)},children:l.map(e=>(0,Q.jsxs)(rt,{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]=b,t[20]=v,t[21]=d,t[22]=D):D=t[22];let O;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]!==S||t[36]!==f||t[37]!==y||t[38]!==_||t[39]!==x||t[40]!==C||t[41]!==g||t[42]!==b||t[43]!==v||t[44]!==w?(O=w&&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)(h,{type:`button`,variant:`ghost`,className:`h-7 gap-1 px-2 text-xs`,disabled:r||g||!f.trim(),title:n.channelsRefreshSessionsHint,onClick:()=>x(),children:[(0,Q.jsx)(B,{className:i(`size-3.5`,g&&`animate-spin`),strokeWidth:1.75}),n.channelsRefreshSessions]})]}),g&&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)(Te,{className:i(Ct(),`py-2`),value:_==null?``:String(_),disabled:r||!f.trim()||!!y.trim(),onChange:e=>{let t=e.target.value;v(t===``?null:Number(t))},children:[(0,Q.jsx)(rt,{value:``,children:n.channelsPeerAny}),m.map((e,t)=>(0,Q.jsx)(rt,{value:String(t),children:bt(e,S)},`${e.channel}-${e.chatId}`))]})]}),m.length===0&&f.trim()&&!g?(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.channelsNoSessionsHint}):null,(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:n.peerIdLabel}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-stretch sm:gap-2`,children:[(0,Q.jsx)(`input`,{type:`text`,className:i(Ct(),`min-w-0 w-full sm:flex-1`),value:y,onChange:e=>{b(e.target.value),e.target.value.trim()&&v(null)},placeholder:n.channelsCustomPeerPlaceholder,autoComplete:`off`}),(0,Q.jsxs)(Te,{className:ln,value:y,onChange:e=>{let t=e.target.value;b(t||``),v(null)},children:[(0,Q.jsx)(rt,{value:``,children:C}),m.map(e=>(0,Q.jsx)(rt,{value:e.chatId,children:bt(e,S)},`${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]=S,t[36]=f,t[37]=y,t[38]=_,t[39]=x,t[40]=C,t[41]=g,t[42]=b,t[43]=v,t[44]=w,t[45]=O):O=t[45];let k;t[46]!==r||t[47]!==u||t[48]!==f?(k=r||!f.trim()||u,t[46]=r,t[47]=u,t[48]=f,t[49]=k):k=t[49];let A;t[50]!==n.addBinding||t[51]!==k?(A=(0,Q.jsx)(`div`,{children:(0,Q.jsx)(h,{type:`submit`,disabled:k,children:n.addBinding})}),t[50]=n.addBinding,t[51]=k,t[52]=A):A=t[52];let j;t[53]!==c||t[54]!==D||t[55]!==O||t[56]!==A?(j=(0,Q.jsxs)(`form`,{className:`mt-4 flex flex-col gap-3`,onSubmit:c,children:[D,O,A]}),t[53]=c,t[54]=D,t[55]=O,t[56]=A,t[57]=j):j=t[57];let M;return t[58]!==T||t[59]!==E||t[60]!==j?(M=(0,Q.jsxs)(mt,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto`,children:[T,E,j]}),t[58]=T,t[59]=E,t[60]=j,t[61]=M):M=t[61],M}function dn(e){let t=(0,Z.c)(32),{a:n,filesLoading:r,files:a,activeFile:o,setActiveFile:c,filesViewMode:l,setFilesViewMode:u,fileDraft:d,setFileDraft:f,fileSaving:p,profileFileLoading:m,profileEditorNonce:g,onTryInChat:_}=e,v=s(fn),y;t[0]!==n.missing||t[1]!==a?.files?(y=a?.files.map(e=>({id:e.name,label:e.missing?`${e.name} (${n.missing})`:e.name,title:e.name}))??[],t[0]=n.missing,t[1]=a?.files,t[2]=y):y=t[2];let b=y,x;t[3]===n.filesHint?x=t[4]:(x=(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.filesHint}),t[3]=n.filesHint,t[4]=x);let S;t[5]!==n.filesAutoSaveHint||t[6]!==n.filesEmpty||t[7]!==n.filesLoading||t[8]!==n.filesMarkdownEdit||t[9]!==n.filesMarkdownPreview||t[10]!==n.filesNavAria||t[11]!==n.filesSavingStatus||t[12]!==n.pickFile||t[13]!==n.tryInChat||t[14]!==o||t[15]!==d||t[16]!==p||t[17]!==b||t[18]!==a||t[19]!==r||t[20]!==l||t[21]!==v||t[22]!==_||t[23]!==g||t[24]!==m||t[25]!==c||t[26]!==f||t[27]!==u?(S=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)(w,{items:b,activeTab:o??``,onChange:c,ariaLabel:n.filesNavAria,tabIdPrefix:`agent-files-tab`,panelIdPrefix:`agent-files-panel`,className:`shrink-0 flex-wrap`,buttonClassName:`font-mono text-xs whitespace-nowrap`}),(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`,V.press,l===`edit`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`),onClick:()=>u(`edit`),children:[(0,Q.jsx)(nt,{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`,V.press,l===`preview`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`),onClick:()=>u(`preview`),children:[(0,Q.jsx)(ae,{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}),_?(0,Q.jsxs)(h,{type:`button`,variant:`secondary`,className:`ml-auto text-xs`,onClick:_,children:[(0,Q.jsx)(ie,{className:`mr-1 size-3.5`,"aria-hidden":!0}),n.tryInChat]}):null]})]}),l===`edit`?(0,Q.jsx)(`div`,{className:i(Ct(),`flex min-h-0 flex-1 flex-col overflow-hidden p-0`,m&&`pointer-events-none opacity-60`),children:(0,Q.jsx)(ft,{initialContent:d,onChange:f,isDark:v,className:`min-h-0 flex-1`},`${o??`file`}-${g}`)}):(0,Q.jsx)(`div`,{className:i(Ct(),`min-h-0 flex-1 overflow-y-auto text-sm`,m&&`pointer-events-none opacity-60`),children:(0,Q.jsx)(N,{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[5]=n.filesAutoSaveHint,t[6]=n.filesEmpty,t[7]=n.filesLoading,t[8]=n.filesMarkdownEdit,t[9]=n.filesMarkdownPreview,t[10]=n.filesNavAria,t[11]=n.filesSavingStatus,t[12]=n.pickFile,t[13]=n.tryInChat,t[14]=o,t[15]=d,t[16]=p,t[17]=b,t[18]=a,t[19]=r,t[20]=l,t[21]=v,t[22]=_,t[23]=g,t[24]=m,t[25]=c,t[26]=f,t[27]=u,t[28]=S):S=t[28];let C;return t[29]!==x||t[30]!==S?(C=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-hidden`,children:[x,S]}),t[29]=x,t[30]=S,t[31]=C):C=t[31],C}function fn(e){return e.resolved===`dark`}function pn(e){let t=(0,Z.c)(66),{a:n,chat:r,selected:i,busy:a,modelRows:o,setModelRows:s,onSaveModels:c,onClearModelsEntry:l,hideInlineSave:u}=e,d;t[0]!==n.modelsTabHint||t[1]!==n.modelsTabTitle?(d=(0,Q.jsx)(pt,{className:`shrink-0`,icon:X,title:n.modelsTabTitle,subtitle:n.modelsTabHint}),t[0]=n.modelsTabHint,t[1]=n.modelsTabTitle,t[2]=d):d=t[2];let f;t[3]===n.modelsPresetLabel?f=t[4]:(f=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.modelsPresetLabel}),t[3]=n.modelsPresetLabel,t[4]=f);let p;t[5]===i.typedModels.preset?p=t[6]:(p=Et(i.typedModels.preset),t[5]=i.typedModels.preset,t[6]=p);let m;t[7]!==f||t[8]!==p?(m=(0,Q.jsxs)(`div`,{children:[f,` `,p]}),t[7]=f,t[8]=p,t[9]=m):m=t[9];let g;t[10]===n.modelsEffectiveLabel?g=t[11]:(g=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.modelsEffectiveLabel}),t[10]=n.modelsEffectiveLabel,t[11]=g);let _;t[12]===i.typedModels.effective?_=t[13]:(_=Et(i.typedModels.effective),t[12]=i.typedModels.effective,t[13]=_);let v;t[14]!==g||t[15]!==_?(v=(0,Q.jsxs)(`div`,{children:[g,` `,_]}),t[14]=g,t[15]=_,t[16]=v):v=t[16];let y;t[17]!==m||t[18]!==v?(y=(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,v]}),t[17]=m,t[18]=v,t[19]=y):y=t[19];let b;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?(b={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]=b):b=t[39];let x;t[40]!==a||t[41]!==r||t[42]!==o||t[43]!==i.typedModels.defaultRole||t[44]!==s||t[45]!==b?(x=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Q.jsx)(Mt,{rows:o,onChange:s,disabled:a,defaultRole:i.typedModels.defaultRole,chat:r,labels:b})}),t[40]=a,t[41]=r,t[42]=o,t[43]=i.typedModels.defaultRole,t[44]=s,t[45]=b,t[46]=x):x=t[46];let S;t[47]!==n.modelsSave||t[48]!==a||t[49]!==u||t[50]!==c?(S=u?null:(0,Q.jsx)(h,{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]=S):S=t[51];let C;t[52]===l?C=t[53]:(C=()=>void l(),t[52]=l,t[53]=C);let w;t[54]!==n.modelsResetInherit||t[55]!==a||t[56]!==C?(w=(0,Q.jsx)(h,{type:`button`,variant:`secondary`,disabled:a,onClick:C,children:n.modelsResetInherit}),t[54]=n.modelsResetInherit,t[55]=a,t[56]=C,t[57]=w):w=t[57];let T;t[58]!==S||t[59]!==w?(T=(0,Q.jsxs)(`div`,{className:`mt-4 flex shrink-0 flex-wrap gap-2`,children:[S,w]}),t[58]=S,t[59]=w,t[60]=T):T=t[60];let E;return t[61]!==d||t[62]!==T||t[63]!==y||t[64]!==x?(E=(0,Q.jsxs)(mt,{className:`flex min-h-0 flex-1 flex-col`,children:[d,y,x,T]}),t[61]=d,t[62]=T,t[63]=y,t[64]=x,t[65]=E):E=t[65],E}function mn(e,t){switch(e){case`adventurer`:return t.avatarStyleAdventurer;case`bottts`:return t.avatarStyleRobot;case`lorelei`:return t.avatarStyleLorelei;case`thumbs`:return t.avatarStyleThumbs;case`fun-emoji`:return t.avatarStyleFunEmoji;default:return e}}function hn(e){let{agentId:t,value:n,onChange:r,a,id:o}=e,s=(0,$.useRef)(null),[c,l]=(0,$.useState)(!1),[u,d]=(0,$.useState)(null),[f,p]=(0,$.useState)(!1),m=(0,$.useMemo)(()=>{let e=tt(n.trim());return e&&Re(e.styleId)?e.styleId:We[0]??`adventurer`},[n]),g=(0,$.useCallback)(async(e,n)=>{try{await ne(t)}catch{}r(ye(e,n)),p(!1)},[t,r]),_=(0,$.useCallback)(async e=>{let n=e.target.files?.[0];if(e.target.value=``,n){d(null),l(!0);try{await A(t,n),Se(t),r(Ze)}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]),y=(e,t)=>{let r=tt(n.trim());return!!(r&&r.styleId===e&&r.seed===t)};return(0,Q.jsxs)(`div`,{...o?{id:o}:{},className:`flex flex-col gap-3 sm:col-span-2`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:a.avatarPickerTitle}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`input`,{ref:s,type:`file`,accept:`image/png,image/jpeg,image/webp,.png,.jpg,.jpeg,.webp`,className:`hidden`,onChange:e=>void _(e)}),(0,Q.jsxs)(h,{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)(pe,{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:We.map(e=>(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void g(e,ge[0]??t),className:i(`rounded-full border px-3 py-1.5 text-xs font-medium transition-colors`,V.press,m===e?`border-fg bg-fg text-surface-base`:`border-edge-subtle bg-surface-panel text-fg hover:border-edge`),children:mn(e,a)},e))}),(0,Q.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-panel/50 p-3`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[ge.map(e=>(0,Q.jsx)(`button`,{type:`button`,title:e,onClick:()=>void g(m,e),className:i(`flex size-12 shrink-0 items-center justify-center rounded-full border-2 transition-colors`,V.press,y(m,e)?`border-accent ring-2 ring-accent/30`:`border-transparent hover:border-edge`),children:(0,Q.jsx)(`img`,{src:_t(m,e,96),alt:``,width:44,height:44,className:`size-11 rounded-full object-cover`,draggable:!1})},e)),(0,Q.jsxs)(at,{open:f,onOpenChange:p,children:[(0,Q.jsx)(oe,{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`,V.press),children:a.avatarMore})}),(0,Q.jsx)(v,{children:(0,Q.jsxs)(K,{className:`z-[80] max-h-72 w-[min(22rem,calc(100vw-2rem))] overflow-y-auto rounded-xl border border-edge-subtle bg-surface-panel p-3 shadow-lg`,sideOffset:6,align:`end`,children:[(0,Q.jsx)(`p`,{className:`mb-2 text-xs font-medium text-fg-muted`,children:mn(m,a)}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:je.map(e=>(0,Q.jsx)(`button`,{type:`button`,title:e,onClick:()=>void g(m,e),className:i(`flex size-11 shrink-0 items-center justify-center rounded-full border-2 transition-colors`,V.press,y(m,e)?`border-accent ring-2 ring-accent/30`:`border-transparent hover:border-edge`),children:(0,Q.jsx)(`img`,{src:_t(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)(Ye,{agentId:t,avatar:n,size:40}),n.trim()&&!tt(n.trim())&&n.trim()!==`xopc:custom`?(0,Q.jsx)(`span`,{className:`truncate font-mono text-[10px] text-fg-muted`,title:n,children:n}):null]})]})]})}function gn(e){let t=(0,Z.c)(207),{a:n,chat:r,selected:a,busy:c,editName:l,setEditName:u,editDescription:d,setEditDescription:f,editWorkspace:p,setEditWorkspace:m,editModel:g,setEditModel:v,onSetDefault:y,onSetTuiDefault:b,isTuiDefault:x,isTuiDefaultInherited:S,onSaveAgentEdits:C,hideInlineSave:w,profileMarkdownLoading:E,profileDraft:D,updateIdentity:O,handleSoulTemplateChange:k,handleSoulContentChange:A,setAvatarDialogOpen:M,toggleSoulPreviewMode:P,onTryInChat:F}=e,I=o(yn),R=s(vn),z;t[0]===D?.identity?z=t[1]:(z=D?.identity??{name:``,description:``,language:``,creature:``,emoji:``,avatar:``},t[0]=D?.identity,t[1]=z);let B=z,ee=D?.soulTemplate??`professional`,te=D?.soulCustomContent??``,ne=D?.soulEditorNonce??0,H=D?.soulPreviewMode??!1,U=D?.avatarDialogOpen??!1,re;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(re=Ct(),t[2]=re):re=t[2];let W=re,G;t[3]===I?G=t[4]:(G=(e,t)=>I===`zh`?t:e,t[3]=I,t[4]=G);let K=G;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 q;t[7]!==B.avatar||t[8]!==a.id?(q=(0,Q.jsx)(Ye,{agentId:a.id,avatar:B.avatar,size:36,className:`size-9 rounded-lg`}),t[7]=B.avatar,t[8]=a.id,t[9]=q):q=t[9];let J;t[10]===M?J=t[11]:(J=()=>M(!0),t[10]=M,t[11]=J);let oe;t[12]!==n.avatarOpenSettingsAria||t[13]!==J?(oe={onClick:J,ariaLabel:n.avatarOpenSettingsAria,id:`agent-avatar-settings`},t[12]=n.avatarOpenSettingsAria,t[13]=J,t[14]=oe):oe=t[14];let se;t[15]!==n.globalDefaultBadge||t[16]!==n.tuiDefaultBadge||t[17]!==n.tuiDefaultInheritedBadge||t[18]!==x||t[19]!==S||t[20]!==a.isDefault?(se=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]=se):se=t[21];let ce;t[22]!==n.setDefault||t[23]!==n.setTuiDefault||t[24]!==c||t[25]!==x||t[26]!==y||t[27]!==b||t[28]!==a.isDefault?(ce=!a.isDefault||!x?(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[a.isDefault?null:(0,Q.jsx)(h,{type:`button`,variant:`secondary`,className:`text-xs`,disabled:c,onClick:()=>void y(),children:n.setDefault}),x?null:(0,Q.jsx)(h,{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]=ce):ce=t[29];let le;t[30]!==n.personaSectionIdentity||t[31]!==n.personaSectionIdentityHint||t[32]!==q||t[33]!==oe||t[34]!==se||t[35]!==ce?(le=(0,Q.jsx)(pt,{icon:we,title:n.personaSectionIdentity,subtitle:n.personaSectionIdentityHint,iconLeading:q,iconInteractive:oe,titleAccessory:se,trailing:ce}),t[30]=n.personaSectionIdentity,t[31]=n.personaSectionIdentityHint,t[32]=q,t[33]=oe,t[34]=se,t[35]=ce,t[36]=le):le=t[36];let ue;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,Q.jsx)(Je,{className:i(`fixed inset-0 bg-scrim backdrop-blur-[2px]`,_e)}),t[37]=ue):ue=t[37];let de;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(de=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`,ct),t[38]=de):de=t[38];let fe;t[39]===n.avatarPickerTitle?fe=t[40]:(fe=(0,Q.jsx)(Ue,{className:`text-base font-semibold text-fg`,children:n.avatarPickerTitle}),t[39]=n.avatarPickerTitle,t[40]=fe);let pe;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(pe=i(L,`shrink-0 p-1.5 hover:bg-surface-base`),t[41]=pe):pe=t[41];let ge;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,Q.jsx)(T,{className:`size-4`,"aria-hidden":!0}),t[42]=ge):ge=t[42];let ve;t[43]===n.closeDialogAria?ve=t[44]:(ve=(0,Q.jsx)(Ce,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:pe,"aria-label":n.closeDialogAria,children:ge})}),t[43]=n.closeDialogAria,t[44]=ve);let ye;t[45]!==fe||t[46]!==ve?(ye=(0,Q.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-2`,children:[fe,ve]}),t[45]=fe,t[46]=ve,t[47]=ye):ye=t[47];let be;t[48]===n.avatarRowHint?be=t[49]:(be=(0,Q.jsx)(He,{className:`sr-only`,children:n.avatarRowHint}),t[48]=n.avatarRowHint,t[49]=be);let xe;t[50]===O?xe=t[51]:(xe=e=>O({avatar:e}),t[50]=O,t[51]=xe);let Se;t[52]!==n||t[53]!==B.avatar||t[54]!==a.id||t[55]!==xe?(Se=(0,Q.jsx)(hn,{agentId:a.id,value:B.avatar,onChange:xe,a:n}),t[52]=n,t[53]=B.avatar,t[54]=a.id,t[55]=xe,t[56]=Se):Se=t[56];let Y;t[57]!==ye||t[58]!==be||t[59]!==Se?(Y=(0,Q.jsxs)(Ae,{children:[ue,(0,Q.jsxs)($e,{className:de,onOpenAutoFocus:_n,children:[ye,be,Se]})]}),t[57]=ye,t[58]=be,t[59]=Se,t[60]=Y):Y=t[60];let Ee;t[61]!==U||t[62]!==M||t[63]!==Y?(Ee=(0,Q.jsx)(he,{open:U,onOpenChange:M,children:Y}),t[61]=U,t[62]=M,t[63]=Y,t[64]=Ee):Ee=t[64];let De;t[65]===n.displayName?De=t[66]:(De=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.displayName}),t[65]=n.displayName,t[66]=De);let Oe;t[67]!==u||t[68]!==O?(Oe=e=>{u(e.target.value),O({name:e.target.value})},t[67]=u,t[68]=O,t[69]=Oe):Oe=t[69];let ke;t[70]!==n.personaNamePlaceholder||t[71]!==l||t[72]!==Oe?(ke=(0,Q.jsx)(`input`,{className:W,value:l,onChange:Oe,placeholder:n.personaNamePlaceholder,autoComplete:`off`}),t[70]=n.personaNamePlaceholder,t[71]=l,t[72]=Oe,t[73]=ke):ke=t[73];let je;t[74]!==De||t[75]!==ke?(je=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[De,ke]}),t[74]=De,t[75]=ke,t[76]=je):je=t[76];let Me;t[77]===n.personaEmoji?Me=t[78]:(Me=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.personaEmoji}),t[77]=n.personaEmoji,t[78]=Me);let Ne;t[79]===O?Ne=t[80]:(Ne=e=>O({emoji:e.target.value}),t[79]=O,t[80]=Ne);let Pe;t[81]!==n.personaEmojiPlaceholder||t[82]!==B.emoji||t[83]!==Ne?(Pe=(0,Q.jsx)(`input`,{className:W,value:B.emoji,onChange:Ne,placeholder:n.personaEmojiPlaceholder,autoComplete:`off`}),t[81]=n.personaEmojiPlaceholder,t[82]=B.emoji,t[83]=Ne,t[84]=Pe):Pe=t[84];let Fe;t[85]!==Me||t[86]!==Pe?(Fe=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[Me,Pe]}),t[85]=Me,t[86]=Pe,t[87]=Fe):Fe=t[87];let Ie;t[88]===n.agentDescription?Ie=t[89]:(Ie=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.agentDescription}),t[88]=n.agentDescription,t[89]=Ie);let Le;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(Le=i(W,`min-h-16 resize-y text-sm leading-relaxed`),t[90]=Le):Le=t[90];let Re;t[91]!==f||t[92]!==O?(Re=e=>{f(e.target.value),O({description:e.target.value})},t[91]=f,t[92]=O,t[93]=Re):Re=t[93];let ze;t[94]!==n.agentDescriptionPlaceholder||t[95]!==d||t[96]!==Re?(ze=(0,Q.jsx)(`textarea`,{className:Le,value:d,onChange:Re,placeholder:n.agentDescriptionPlaceholder,maxLength:4e3,rows:3,spellCheck:!0}),t[94]=n.agentDescriptionPlaceholder,t[95]=d,t[96]=Re,t[97]=ze):ze=t[97];let Be;t[98]!==Ie||t[99]!==ze?(Be=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[Ie,ze]}),t[98]=Ie,t[99]=ze,t[100]=Be):Be=t[100];let X;t[101]===n.personaCreature?X=t[102]:(X=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.personaCreature}),t[101]=n.personaCreature,t[102]=X);let Ve;t[103]===B.creature?Ve=t[104]:(Ve=me.some(e=>e.value===B.creature)?B.creature:`__custom__`,t[103]=B.creature,t[104]=Ve);let We;t[105]===O?We=t[106]:(We=e=>{if(e.target.value===`__custom__`){O({creature:``});return}O({creature:e.target.value})},t[105]=O,t[106]=We);let Ke;t[107]===K?Ke=t[108]:(Ke=me.map(e=>(0,Q.jsx)(rt,{value:e.value,children:K(e.labelEn,e.labelZh)},e.value)),t[107]=K,t[108]=Ke);let Xe;t[109]===K?Xe=t[110]:(Xe=K(`Custom…`,`自定义…`),t[109]=K,t[110]=Xe);let Ze;t[111]===Xe?Ze=t[112]:(Ze=(0,Q.jsx)(rt,{value:`__custom__`,children:Xe}),t[111]=Xe,t[112]=Ze);let Qe;t[113]!==Ve||t[114]!==We||t[115]!==Ke||t[116]!==Ze?(Qe=(0,Q.jsxs)(Te,{className:W,value:Ve,onChange:We,children:[Ke,Ze]}),t[113]=Ve,t[114]=We,t[115]=Ke,t[116]=Ze,t[117]=Qe):Qe=t[117];let et;t[118]!==n.personaCreaturePlaceholder||t[119]!==B.creature||t[120]!==O?(et=me.some(e=>e.value===B.creature)?null:(0,Q.jsx)(`input`,{className:i(W,`mt-1 text-xs`),value:B.creature,onChange:e=>O({creature:e.target.value}),placeholder:n.personaCreaturePlaceholder,autoComplete:`off`}),t[118]=n.personaCreaturePlaceholder,t[119]=B.creature,t[120]=O,t[121]=et):et=t[121];let tt;t[122]!==X||t[123]!==Qe||t[124]!==et?(tt=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm`,children:[X,Qe,et]}),t[122]=X,t[123]=Qe,t[124]=et,t[125]=tt):tt=t[125];let nt;t[126]!==je||t[127]!==Fe||t[128]!==Be||t[129]!==tt?(nt=(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[je,Fe,Be,tt]}),t[126]=je,t[127]=Fe,t[128]=Be,t[129]=tt,t[130]=nt):nt=t[130];let it;t[131]!==Ee||t[132]!==nt||t[133]!==le?(it=(0,Q.jsxs)(mt,{children:[le,Ee,nt]}),t[131]=Ee,t[132]=nt,t[133]=le,t[134]=it):it=t[134];let at;t[135]!==n.editAgent||t[136]!==n.editAgentHint?(at=(0,Q.jsx)(pt,{icon:qe,title:n.editAgent,subtitle:n.editAgentHint}),t[135]=n.editAgent,t[136]=n.editAgentHint,t[137]=at):at=t[137];let ot;t[138]===n.modelPrimary?ot=t[139]:(ot=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.modelPrimary}),t[138]=n.modelPrimary,t[139]=ot);let st;t[140]===v?st=t[141]:(st=e=>v(e),t[140]=v,t[141]=st);let ut;t[142]!==c||t[143]!==r.modelNoMatches||t[144]!==r.modelPlaceholder||t[145]!==r.modelSearchPlaceholder||t[146]!==g||t[147]!==st?(ut=(0,Q.jsx)(Ge,{className:`min-w-0 flex-1`,value:g,disabled:c,placeholder:r.modelPlaceholder,searchPlaceholder:r.modelSearchPlaceholder,noMatches:r.modelNoMatches,onChange:st}),t[142]=c,t[143]=r.modelNoMatches,t[144]=r.modelPlaceholder,t[145]=r.modelSearchPlaceholder,t[146]=g,t[147]=st,t[148]=ut):ut=t[148];let dt;t[149]!==n.modelClear||t[150]!==c||t[151]!==g||t[152]!==v?(dt=g.trim()?(0,Q.jsx)(h,{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]=dt):dt=t[153];let ht;t[154]!==ut||t[155]!==dt?(ht=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-stretch gap-2`,children:[ut,dt]}),t[154]=ut,t[155]=dt,t[156]=ht):ht=t[156];let gt;t[157]!==ot||t[158]!==ht?(gt=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[ot,ht]}),t[157]=ot,t[158]=ht,t[159]=gt):gt=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(W,`font-mono text-xs`),t[162]=bt):bt=t[162];let xt;t[163]!==c||t[164]!==r.workingDirectory||t[165]!==p||t[166]!==m?(xt=(0,Q.jsx)(Nt,{value:p,onChange:m,disabled:c,wd:vt,placeholder:yt,inputClassName:bt}),t[163]=c,t[164]=r.workingDirectory,t[165]=p,t[166]=m,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 wt;t[171]!==gt||t[172]!==St?(wt=(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[gt,St]}),t[171]=gt,t[172]=St,t[173]=wt):wt=t[173];let Tt;t[174]!==n.save||t[175]!==n.tryInChat||t[176]!==c||t[177]!==w||t[178]!==C||t[179]!==F?(Tt=w?null:(0,Q.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(h,{type:`button`,disabled:c,onClick:()=>void C(),children:n.save}),F?(0,Q.jsxs)(h,{type:`button`,variant:`secondary`,disabled:c,onClick:F,children:[(0,Q.jsx)(ie,{className:`mr-1.5 size-4`,"aria-hidden":!0}),n.tryInChat]}):null]}),t[174]=n.save,t[175]=n.tryInChat,t[176]=c,t[177]=w,t[178]=C,t[179]=F,t[180]=Tt):Tt=t[180];let Et;t[181]!==at||t[182]!==wt||t[183]!==Tt?(Et=(0,Q.jsxs)(mt,{children:[at,wt,Tt]}),t[181]=at,t[182]=wt,t[183]=Tt,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]!==A||t[193]!==k||t[194]!==R||t[195]!==K||t[196]!==E||t[197]!==te||t[198]!==ne||t[199]!==H||t[200]!==ee||t[201]!==P?(Dt=E?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.loading}):(0,Q.jsxs)(mt,{children:[(0,Q.jsx)(pt,{icon:j,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:lt.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`,V.pressCard,ee===e.id?`border-accent bg-accent-soft/40 shadow-sm`:`border-edge hover:border-accent/40 hover:bg-surface-hover`),onClick:()=>k(e.id),children:[(0,Q.jsx)(`span`,{className:`text-xl`,children:e.emoji}),(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:K(e.labelEn,e.labelZh)})]},e.id))})]}),ee===`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(L,`inline-flex size-9 shrink-0 items-center justify-center rounded-md p-0 hover:bg-surface-hover`),title:H?n.personaSoulEdit:n.personaSoulPreview,"aria-label":H?n.personaSoulEdit:n.personaSoulPreview,onClick:P,children:H?(0,Q.jsx)(_,{className:`size-4`,"aria-hidden":!0}):(0,Q.jsx)(ae,{className:`size-4`,"aria-hidden":!0})})]}),(0,Q.jsx)(`div`,{className:i(W,`flex min-h-64 flex-col overflow-hidden p-0`),children:H?(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:(0,Q.jsx)(N,{content:te})}):(0,Q.jsx)(ft,{initialContent:te,onChange:A,isDark:R,className:`min-h-0 flex-1`},`soul-${ne}`)})]}):null]}),t[185]=n.loading,t[186]=n.personaSectionSoul,t[187]=n.personaSectionSoulHint,t[188]=n.personaSoulCustomEdit,t[189]=n.personaSoulEdit,t[190]=n.personaSoulPreview,t[191]=n.personaSoulTemplate,t[192]=A,t[193]=k,t[194]=R,t[195]=K,t[196]=E,t[197]=te,t[198]=ne,t[199]=H,t[200]=ee,t[201]=P,t[202]=Dt):Dt=t[202];let Ot;return t[203]!==it||t[204]!==Et||t[205]!==Dt?(Ot=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[it,Et,Dt]}),t[203]=it,t[204]=Et,t[205]=Dt,t[206]=Ot):Ot=t[206],Ot}function _n(e){return e.preventDefault()}function vn(e){return e.resolved===`dark`}function yn(e){return e.language}function bn(e){let t=(0,Z.c)(13),{label:n,value:r,badge:i,mono:a}=e,o;t[0]===n?o=t[1]:(o=(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:n}),t[0]=n,t[1]=o);let s;t[2]===i?s=t[3]:(s=(0,Q.jsx)(`span`,{className:`shrink-0 rounded-full bg-surface-hover px-2 py-0.5 text-xs font-medium text-fg-muted`,children:i}),t[2]=i,t[3]=s);let c;t[4]!==o||t[5]!==s?(c=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[o,s]}),t[4]=o,t[5]=s,t[6]=c):c=t[6];let l=a?`mt-2 truncate font-mono text-xs text-fg`:`mt-2 truncate text-sm font-medium text-fg`,u;t[7]!==l||t[8]!==r?(u=(0,Q.jsx)(`p`,{className:l,children:r}),t[7]=l,t[8]=r,t[9]=u):u=t[9];let d;return t[10]!==c||t[11]!==u?(d=(0,Q.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-panel px-4 py-3`,children:[c,u]}),t[10]=c,t[11]=u,t[12]=d):d=t[12],d}function xn(e){let t=(0,Z.c)(12),{icon:n,label:r,value:i}=e,a;t[0]===n?a=t[1]:(a=(0,Q.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-hover text-fg-muted`,children:(0,Q.jsx)(n,{className:`size-4`,strokeWidth:1.8,"aria-hidden":!0})}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:r}),t[2]=r,t[3]=o);let s;t[4]===i?s=t[5]:(s=(0,Q.jsx)(`p`,{className:`mt-1 truncate text-sm font-medium text-fg`,children:i}),t[4]=i,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;return t[9]!==a||t[10]!==c?(l=(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl border border-edge-subtle bg-surface-panel px-4 py-3`,children:[a,c]}),t[9]=a,t[10]=c,t[11]=l):l=t[11],l}function Sn(e){let t=(0,Z.c)(121),{a:n,selected:r,defaultModel:i,defaultWorkspace:a,isTuiDefault:o,isTuiDefaultInherited:s,busy:c,onSetDefault:l,onSetTuiDefault:u,onTryInChat:d}=e,f;t[0]!==n||t[1]!==r?(f=F(r,n),t[0]=n,t[1]=r,t[2]=f):f=t[2];let p=f,m;t[3]!==n||t[4]!==r?(m=Ne(r,n)||n.listNoDescription,t[3]=n,t[4]=r,t[5]=m):m=t[5];let g=m,_;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)(Ye,{agentId:r.id,avatar:r.avatar,size:56,className:`size-full`})}),t[14]=r.avatar,t[15]=r.id,t[16]=T):T=t[16];let E;t[17]===p?E=t[18]:(E=(0,Q.jsx)(`h2`,{className:`truncate text-lg font-semibold text-fg`,children:p}),t[17]=p,t[18]=E);let D;t[19]!==n.globalDefaultBadge||t[20]!==r.isDefault?(D=r.isDefault?(0,Q.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-xs font-medium text-accent`,children:n.globalDefaultBadge}):null,t[19]=n.globalDefaultBadge,t[20]=r.isDefault,t[21]=D):D=t[21];let O;t[22]!==n.tuiDefaultBadge||t[23]!==n.tuiDefaultInheritedBadge||t[24]!==o||t[25]!==s?(O=o?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs font-medium text-fg`,children:s?n.tuiDefaultInheritedBadge:n.tuiDefaultBadge}):null,t[22]=n.tuiDefaultBadge,t[23]=n.tuiDefaultInheritedBadge,t[24]=o,t[25]=s,t[26]=O):O=t[26];let k;t[27]!==E||t[28]!==D||t[29]!==O?(k=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[E,D,O]}),t[27]=E,t[28]=D,t[29]=O,t[30]=k):k=t[30];let A;t[31]===r.id?A=t[32]:(A=(0,Q.jsx)(`p`,{className:`mt-1 truncate font-mono text-xs text-fg-muted`,children:r.id}),t[31]=r.id,t[32]=A);let 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)(h,{type:`button`,disabled:c,onClick:d,children:[(0,Q.jsx)(ie,{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)(h,{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 I;t[48]!==n.setTuiDefault||t[49]!==c||t[50]!==o||t[51]!==u?(I=o?null:(0,Q.jsx)(h,{type:`button`,variant:`secondary`,disabled:c,onClick:u,children:n.setTuiDefault}),t[48]=n.setTuiDefault,t[49]=c,t[50]=o,t[51]=u,t[52]=I):I=t[52];let L;t[53]!==N||t[54]!==P||t[55]!==I?(L=(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[N,P,I]}),t[53]=N,t[54]=P,t[55]=I,t[56]=L):L=t[56];let R;t[57]!==M||t[58]!==L?(R=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between`,children:[M,L]}),t[57]=M,t[58]=L,t[59]=R):R=t[59];let z;t[60]===g?z=t[61]:(z=(0,Q.jsx)(`p`,{className:`w-full text-sm leading-6 text-fg-muted`,children:g}),t[60]=g,t[61]=z);let B;t[62]!==R||t[63]!==z?(B=(0,Q.jsx)(mt,{children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[R,z]})}),t[62]=R,t[63]=z,t[64]=B):B=t[64];let ee;t[65]!==n.overviewRuntimeHint||t[66]!==n.overviewRuntimeTitle?(ee=(0,Q.jsx)(pt,{icon:we,title:n.overviewRuntimeTitle,subtitle:n.overviewRuntimeHint}),t[65]=n.overviewRuntimeHint,t[66]=n.overviewRuntimeTitle,t[67]=ee):ee=t[67];let V;t[68]!==n.modelPrimary||t[69]!==x||t[70]!==v?(V=(0,Q.jsx)(bn,{label:n.modelPrimary,value:v,badge:x,mono:!0}),t[68]=n.modelPrimary,t[69]=x,t[70]=v,t[71]=V):V=t[71];let te;t[72]!==n.workspacePath||t[73]!==S||t[74]!==b?(te=(0,Q.jsx)(bn,{label:n.workspacePath,value:b,badge:S,mono:!0}),t[72]=n.workspacePath,t[73]=S,t[74]=b,t[75]=te):te=t[75];let ne;t[76]!==V||t[77]!==te?(ne=(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[V,te]}),t[76]=V,t[77]=te,t[78]=ne):ne=t[78];let H;t[79]!==ee||t[80]!==ne?(H=(0,Q.jsxs)(mt,{children:[ee,ne]}),t[79]=ee,t[80]=ne,t[81]=H):H=t[81];let U;t[82]!==n.overviewCapabilitiesHint||t[83]!==n.overviewCapabilitiesTitle?(U=(0,Q.jsx)(pt,{icon:it,title:n.overviewCapabilitiesTitle,subtitle:n.overviewCapabilitiesHint}),t[82]=n.overviewCapabilitiesHint,t[83]=n.overviewCapabilitiesTitle,t[84]=U):U=t[84];let re;t[85]!==n.listToolsAllEnabled||t[86]!==n.listToolsDisabledCount||t[87]!==C?(re=C>0?n.listToolsDisabledCount.replace(`{{count}}`,String(C)):n.listToolsAllEnabled,t[85]=n.listToolsAllEnabled,t[86]=n.listToolsDisabledCount,t[87]=C,t[88]=re):re=t[88];let W;t[89]!==n.listToolsLabel||t[90]!==re?(W=(0,Q.jsx)(xn,{icon:le,label:n.listToolsLabel,value:re}),t[89]=n.listToolsLabel,t[90]=re,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 ae;t[96]!==n.listSkillsLabel||t[97]!==G?(ae=(0,Q.jsx)(xn,{icon:we,label:n.listSkillsLabel,value:G}),t[96]=n.listSkillsLabel,t[97]=G,t[98]=ae):ae=t[98];let K;t[99]!==n.memoryTitle||t[100]!==n.overviewMemoryManaged?(K=(0,Q.jsx)(xn,{icon:Ee,label:n.memoryTitle,value:n.overviewMemoryManaged}),t[99]=n.memoryTitle,t[100]=n.overviewMemoryManaged,t[101]=K):K=t[101];let q;t[102]!==n.connectionsTitle||t[103]!==n.overviewConnectionsManaged?(q=(0,Q.jsx)(xn,{icon:Oe,label:n.connectionsTitle,value:n.overviewConnectionsManaged}),t[102]=n.connectionsTitle,t[103]=n.overviewConnectionsManaged,t[104]=q):q=t[104];let J;t[105]!==n.listWorkspaceLabel||t[106]!==b?(J=(0,Q.jsx)(xn,{icon:Fe,label:n.listWorkspaceLabel,value:b}),t[105]=n.listWorkspaceLabel,t[106]=b,t[107]=J):J=t[107];let oe;t[108]!==W||t[109]!==ae||t[110]!==K||t[111]!==q||t[112]!==J?(oe=(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[W,ae,K,q,J]}),t[108]=W,t[109]=ae,t[110]=K,t[111]=q,t[112]=J,t[113]=oe):oe=t[113];let se;t[114]!==U||t[115]!==oe?(se=(0,Q.jsxs)(mt,{children:[U,oe]}),t[114]=U,t[115]=oe,t[116]=se):se=t[116];let ce;return t[117]!==B||t[118]!==H||t[119]!==se?(ce=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-5 overflow-y-auto`,children:[B,H,se]}),t[117]=B,t[118]=H,t[119]=se,t[120]=ce):ce=t[120],ce}function Cn(e){let t=(0,Z.c)(66),{a:n,selected:r,busy:a,skillsCatalogLoading:o,catalogForPick:s,skillsInherit:c,setSkillsInherit:l,skillsPick:u,setSkillsPick:d,onSaveSkills:f,hideInlineSave:p}=e,m;t[0]===r.skills.effectiveAllowlist?m=t[1]:(m=function(e){let t=r.skills.effectiveAllowlist;return t===void 0?!0:t.length===0?!1:t.includes(e)},t[0]=r.skills.effectiveAllowlist,t[1]=m);let g=m,_;t[2]!==s||t[3]!==r.skills.effectiveAllowlist?(_=function(){let e=r.skills.effectiveAllowlist;return e===void 0?new Set(s.map(wn)):new Set(e)},t[2]=s,t[3]=r.skills.effectiveAllowlist,t[4]=_):_=t[4];let v=_,y;t[5]!==n.skillsHint||t[6]!==n.skillsTitle?(y=(0,Q.jsx)(pt,{className:`shrink-0`,icon:ve,title:n.skillsTitle,subtitle:n.skillsHint}),t[5]=n.skillsHint,t[6]=n.skillsTitle,t[7]=y):y=t[7];let b;t[8]===l?b=t[9]:(b=()=>l(!0),t[8]=l,t[9]=b);let x;t[10]!==n.skillsInherit||t[11]!==a||t[12]!==b?(x=(0,Q.jsx)(h,{type:`button`,variant:`secondary`,disabled:a,onClick:b,children:n.skillsInherit}),t[10]=n.skillsInherit,t[11]=a,t[12]=b,t[13]=x):x=t[13];let S;t[14]!==v||t[15]!==l||t[16]!==d?(S=()=>{l(!1),d(v())},t[14]=v,t[15]=l,t[16]=d,t[17]=S):S=t[17];let C;t[18]!==n.skillsCustomize||t[19]!==a||t[20]!==S?(C=(0,Q.jsx)(h,{type:`button`,variant:`secondary`,disabled:a,onClick:S,children:n.skillsCustomize}),t[18]=n.skillsCustomize,t[19]=a,t[20]=S,t[21]=C):C=t[21];let w;t[22]!==x||t[23]!==C?(w=(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[x,C]}),t[22]=x,t[23]=C,t[24]=w):w=t[24];let T;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(T=Y(`skills`),t[25]=T):T=t[25];let E;t[26]===n.skillsLibraryLink?E=t[27]:(E=(0,Q.jsx)(Me,{to:T,className:`shrink-0 text-xs font-medium text-accent-fg hover:underline`,children:n.skillsLibraryLink}),t[26]=n.skillsLibraryLink,t[27]=E);let D;t[28]!==w||t[29]!==E?(D=(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-3`,children:[w,E]}),t[28]=w,t[29]=E,t[30]=D):D=t[30];let O;t[31]===r.skills.preset?O=t[32]:(O=r.skills.preset.length?r.skills.preset.join(`, `):`—`,t[31]=r.skills.preset,t[32]=O);let k;t[33]!==n.skillsPresetLabel||t[34]!==O?(k=(0,Q.jsxs)(`p`,{className:`mt-2 shrink-0 text-xs text-fg-muted`,children:[n.skillsPresetLabel,` `,O]}),t[33]=n.skillsPresetLabel,t[34]=O,t[35]=k):k=t[35];let A;t[36]!==n.skillsInherit||t[37]!==r.skills.effectiveAllowlist||t[38]!==c?(A=r.skills.effectiveAllowlist?.length?r.skills.effectiveAllowlist.join(`, `):c?n.skillsInherit:`—`,t[36]=n.skillsInherit,t[37]=r.skills.effectiveAllowlist,t[38]=c,t[39]=A):A=t[39];let j;t[40]!==n.skillsEffectiveLabel||t[41]!==A?(j=(0,Q.jsxs)(`p`,{className:`shrink-0 text-xs text-fg-muted`,children:[n.skillsEffectiveLabel,` `,A]}),t[40]=n.skillsEffectiveLabel,t[41]=A,t[42]=j):j=t[42];let M;t[43]!==n.skillsCatalogLoading||t[44]!==n.skillsEmptyCatalog||t[45]!==n.skillsNoDescription||t[46]!==a||t[47]!==s||t[48]!==g||t[49]!==d||t[50]!==o||t[51]!==c||t[52]!==u?(M=o?(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.skillsCatalogLoading}):s.length===0?(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.skillsEmptyCatalog}):(0,Q.jsx)(`div`,{className:i(`mt-3 min-h-0 flex-1 overflow-y-auto overscroll-contain pr-0.5`,c&&`opacity-50`),children:(0,Q.jsx)(`ul`,{className:`flex flex-col gap-2.5 text-sm`,children:s.map(e=>{let t=e.name||e.directoryId,r=c?g(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]=g,t[49]=d,t[50]=o,t[51]=c,t[52]=u,t[53]=M):M=t[53];let N;t[54]!==n.skillsSave||t[55]!==a||t[56]!==p||t[57]!==f?(N=p?null:(0,Q.jsx)(`div`,{className:`mt-4 shrink-0`,children:(0,Q.jsx)(h,{type:`button`,disabled:a,onClick:()=>void f(),children:n.skillsSave})}),t[54]=n.skillsSave,t[55]=a,t[56]=p,t[57]=f,t[58]=N):N=t[58];let P;return t[59]!==D||t[60]!==k||t[61]!==j||t[62]!==M||t[63]!==N||t[64]!==y?(P=(0,Q.jsxs)(mt,{className:`flex min-h-0 flex-1 flex-col`,children:[y,D,k,j,M,N]}),t[59]=D,t[60]=k,t[61]=j,t[62]=M,t[63]=N,t[64]=y,t[65]=P):P=t[65],P}function wn(e){return e.name||e.directoryId}var Tn=[`write_file`,`edit_file`,`shell`],En=[`shell`,`image_generate`,`extensions`],Dn=[`send_message`,`send_media`];function On(e){let t=(0,Z.c)(88),{mode:n,builtinToolIds:r,loading:a,disableSet:o,onDisableSetChange:s,defaultsDisableSet:c,unknownDisabledIds:l,getToolDescription:u,getGroupTitle:d,labels:f,quickActionsDisabled:p}=e,m;t[0]===l?m=t[1]:(m=l===void 0?[]:l,t[0]=l,t[1]=m);let g=m,_=p===void 0?!1:p,v;t[2]===r?v=t[3]:(v=new Set(r),t[2]=r,t[3]=v);let y=v,b;t[4]===c?b=t[5]:(b=c??new Set,t[4]=c,t[5]=b);let x=b,S;t[6]!==x||t[7]!==o||t[8]!==n||t[9]!==s?(S=(e,t)=>{if(n===`agentEntry`&&t&&x.has(e))return;let r=new Set(o);t?r.delete(e):r.add(e),s(r)},t[6]=x,t[7]=o,t[8]=n,t[9]=s,t[10]=S):S=t[10];let C=S,w;t[11]!==y||t[12]!==s?(w=e=>{let t=new Set;for(let n of e)y.has(n)&&t.add(n);s(t)},t[11]=y,t[12]=s,t[13]=w):w=t[13];let T=w,E;t[14]===s?E=t[15]:(E=()=>{s(new Set)},t[14]=s,t[15]=E);let D=E,O;t[16]!==r||t[17]!==s||t[18]!==g?(O=()=>{s(new Set([...r,...g]))},t[16]=r,t[17]=s,t[18]=g,t[19]=O):O=t[19];let k=O,A;t[20]===r?A=t[21]:(A=At(r),t[20]=r,t[21]=A);let j=A,M;if(t[22]!==y||t[23]!==j||t[24]!==n||t[25]!==g){if(M=[],n===`defaults`&&g.length>0){let e;t[27]===g?e=t[28]:(e=g.toSorted(An),t[27]=g,t[28]=e);let n;t[29]===e?n=t[30]:(n={key:`unknown`,ids:e},t[29]=e,t[30]=n),M.push(n)}for(let e of kt){let t=e.toolIds.filter(e=>y.has(e));t.length>0&&M.push({key:e.key,ids:[...t]})}if(j.length>0){let e;t[31]===j?e=t[32]:(e={key:`misc`,ids:j},t[31]=j,t[32]=e),M.push(e)}t[22]=y,t[23]=j,t[24]=n,t[25]=g,t[26]=M}else M=t[26];let N=M,P=N.some(kn),F=_||a,I;t[33]===f.quickActionsLabel?I=t[34]:(I=(0,Q.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:f.quickActionsLabel}),t[33]=f.quickActionsLabel,t[34]=I);let L=F||r.length===0&&g.length===0,R;t[35]!==D||t[36]!==f.quickEnableAll||t[37]!==L?(R=(0,Q.jsx)(h,{type:`button`,variant:`secondary`,className:Dt,disabled:L,onClick:D,children:f.quickEnableAll}),t[35]=D,t[36]=f.quickEnableAll,t[37]=L,t[38]=R):R=t[38];let z=F||r.length===0&&g.length===0,B;t[39]!==k||t[40]!==f.quickDisableAll||t[41]!==z?(B=(0,Q.jsx)(h,{type:`button`,variant:`secondary`,className:Dt,disabled:z,onClick:k,children:f.quickDisableAll}),t[39]=k,t[40]=f.quickDisableAll,t[41]=z,t[42]=B):B=t[42];let ee=F||r.length===0,V;t[43]===T?V=t[44]:(V=()=>T(Tn),t[43]=T,t[44]=V);let te;t[45]!==f.quickReadOnlyWorkspace||t[46]!==ee||t[47]!==V?(te=(0,Q.jsx)(h,{type:`button`,variant:`secondary`,className:Dt,disabled:ee,onClick:V,children:f.quickReadOnlyWorkspace}),t[45]=f.quickReadOnlyWorkspace,t[46]=ee,t[47]=V,t[48]=te):te=t[48];let ne=F||r.length===0,H;t[49]===T?H=t[50]:(H=()=>T(En),t[49]=T,t[50]=H);let U;t[51]!==f.quickHighRiskOff||t[52]!==ne||t[53]!==H?(U=(0,Q.jsx)(h,{type:`button`,variant:`secondary`,className:Dt,disabled:ne,onClick:H,children:f.quickHighRiskOff}),t[51]=f.quickHighRiskOff,t[52]=ne,t[53]=H,t[54]=U):U=t[54];let re=F||r.length===0,ie;t[55]===T?ie=t[56]:(ie=()=>T(Dn),t[55]=T,t[56]=ie);let W;t[57]!==f.quickNoOutbound||t[58]!==re||t[59]!==ie?(W=(0,Q.jsx)(h,{type:`button`,variant:`secondary`,className:Dt,disabled:re,onClick:ie,children:f.quickNoOutbound}),t[57]=f.quickNoOutbound,t[58]=re,t[59]=ie,t[60]=W):W=t[60];let G;t[61]!==R||t[62]!==B||t[63]!==te||t[64]!==U||t[65]!==W?(G=(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[R,B,te,U,W]}),t[61]=R,t[62]=B,t[63]=te,t[64]=U,t[65]=W,t[66]=G):G=t[66];let ae;t[67]!==I||t[68]!==G?(ae=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[I,G]}),t[67]=I,t[68]=G,t[69]=ae):ae=t[69];let K;t[70]!==x||t[71]!==o||t[72]!==d||t[73]!==u||t[74]!==N||t[75]!==P||t[76]!==f.emptyBuiltin||t[77]!==f.loadingBuiltin||t[78]!==f.lockedByDefaults||t[79]!==f.notInBuiltin||t[80]!==a||t[81]!==n||t[82]!==F||t[83]!==C?(K=a?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:f.loadingBuiltin}):P?(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:N.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`&&x.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||F,onChange:()=>C(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]=x,t[71]=o,t[72]=d,t[73]=u,t[74]=N,t[75]=P,t[76]=f.emptyBuiltin,t[77]=f.loadingBuiltin,t[78]=f.lockedByDefaults,t[79]=f.notInBuiltin,t[80]=a,t[81]=n,t[82]=F,t[83]=C,t[84]=K):K=t[84];let q;return t[85]!==ae||t[86]!==K?(q=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[ae,K]}),t[85]=ae,t[86]=K,t[87]=q):q=t[87],q}function kn(e){return e.ids.length>0}function An(e,t){return e.localeCompare(t)}function jn(e){let t=(0,Z.c)(51),{a:n,data:r,selected:i,busy:s,toolEntryDisable:c,setToolEntryDisable:l,onSaveTools:u,onClearToolsEntry:d,hideInlineSave:f}=e,p=o(Nn),m;t[0]===p?m=t[1]:(m=a(p),t[0]=p,t[1]=m);let g=m.agentSettings.advanced,_;t[2]===i.tools.presetDenied?_=t[3]:(_=new Set(i.tools.presetDenied.flatMap(Mn)),t[2]=i.tools.presetDenied,t[3]=_);let v=_,y;t[4]===l?y=t[5]:(y=e=>{l(e)},t[4]=l,t[5]=y);let b=y,x=n.toolsDisableGroups,S;t[6]===x?S=t[7]:(S=e=>x[e],t[6]=x,t[7]=S);let C=S,w;t[8]===n.toolDescriptions?w=t[9]:(w=e=>e in n.toolDescriptions?n.toolDescriptions[e]:``,t[8]=n.toolDescriptions,t[9]=w);let T=w,E;t[10]!==n.toolsHint||t[11]!==n.toolsTitle?(E=(0,Q.jsx)(pt,{className:`shrink-0`,icon:le,title:n.toolsTitle,subtitle:n.toolsHint}),t[10]=n.toolsHint,t[11]=n.toolsTitle,t[12]=E):E=t[12];let D;t[13]!==n.toolsLockedByPreset||t[14]!==g.toolsDisableEmptyBuiltin||t[15]!==g.toolsDisableLoadingBuiltin||t[16]!==g.toolsDisableNotInBuiltin||t[17]!==g.toolsDisableQuickActionsLabel||t[18]!==g.toolsDisableQuickDisableAll||t[19]!==g.toolsDisableQuickEnableAll||t[20]!==g.toolsDisableQuickHighRiskOff||t[21]!==g.toolsDisableQuickNoOutbound||t[22]!==g.toolsDisableQuickReadOnlyWorkspace?(D={loadingBuiltin:g.toolsDisableLoadingBuiltin,emptyBuiltin:g.toolsDisableEmptyBuiltin,quickActionsLabel:g.toolsDisableQuickActionsLabel,quickEnableAll:g.toolsDisableQuickEnableAll,quickDisableAll:g.toolsDisableQuickDisableAll,quickReadOnlyWorkspace:g.toolsDisableQuickReadOnlyWorkspace,quickHighRiskOff:g.toolsDisableQuickHighRiskOff,quickNoOutbound:g.toolsDisableQuickNoOutbound,notInBuiltin:g.toolsDisableNotInBuiltin,lockedByDefaults:n.toolsLockedByPreset},t[13]=n.toolsLockedByPreset,t[14]=g.toolsDisableEmptyBuiltin,t[15]=g.toolsDisableLoadingBuiltin,t[16]=g.toolsDisableNotInBuiltin,t[17]=g.toolsDisableQuickActionsLabel,t[18]=g.toolsDisableQuickDisableAll,t[19]=g.toolsDisableQuickEnableAll,t[20]=g.toolsDisableQuickHighRiskOff,t[21]=g.toolsDisableQuickNoOutbound,t[22]=g.toolsDisableQuickReadOnlyWorkspace,t[23]=D):D=t[23];let O;t[24]!==s||t[25]!==r.builtinToolIds||t[26]!==C||t[27]!==T||t[28]!==b||t[29]!==v||t[30]!==D||t[31]!==c?(O=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Q.jsx)(On,{mode:`agentEntry`,builtinToolIds:r.builtinToolIds,loading:!1,disableSet:c,onDisableSetChange:b,defaultsDisableSet:v,getToolDescription:T,getGroupTitle:C,quickActionsDisabled:s,labels:D})}),t[24]=s,t[25]=r.builtinToolIds,t[26]=C,t[27]=T,t[28]=b,t[29]=v,t[30]=D,t[31]=c,t[32]=O):O=t[32];let k;t[33]!==n.toolsSave||t[34]!==s||t[35]!==f||t[36]!==u?(k=f?null:(0,Q.jsx)(h,{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]=k):k=t[37];let A;t[38]===d?A=t[39]:(A=()=>void d(),t[38]=d,t[39]=A);let j;t[40]!==n.toolsClearEntry||t[41]!==s||t[42]!==A?(j=(0,Q.jsx)(h,{type:`button`,variant:`secondary`,disabled:s,onClick:A,children:n.toolsClearEntry}),t[40]=n.toolsClearEntry,t[41]=s,t[42]=A,t[43]=j):j=t[43];let M;t[44]!==j||t[45]!==k?(M=(0,Q.jsxs)(`div`,{className:`mt-4 flex shrink-0 flex-wrap gap-2`,children:[k,j]}),t[44]=j,t[45]=k,t[46]=M):M=t[46];let N;return t[47]!==M||t[48]!==E||t[49]!==O?(N=(0,Q.jsxs)(mt,{className:`flex min-h-0 flex-1 flex-col`,children:[E,O,M]}),t[47]=M,t[48]=E,t[49]=O,t[50]=N):N=t[50],N}function Mn(e){let t=String(e).trim();return t?[t]:[]}function Nn(e){return e.language}function Pn(e){let t=(0,Z.c)(128),{a:n,chat:r,cCron:i,selected:a,panel:o,data:s,busy:c,editName:l,setEditName:u,editDescription:d,setEditDescription:f,editWorkspace:p,setEditWorkspace:m,editModel:h,setEditModel:g,defaultModel:_,defaultWorkspace:v,onSetDefault:y,onSetTuiDefault:b,isTuiDefault:x,isTuiDefaultInherited:S,onSaveAgentEdits:C,onDelete:w,capabilityPresets:T,defaultPresetId:E,onUpdateAgentExtends:D,onOpenCapabilityPreset:O,overviewProfile:k,filesLoading:A,files:j,activeFile:M,setActiveFile:N,filesViewMode:P,setFilesViewMode:F,fileDraft:I,setFileDraft:L,fileSaving:R,profileFileLoading:z,profileEditorNonce:B,toolEntryDisable:ee,setToolEntryDisable:V,onSaveTools:te,onClearToolsEntry:ne,modelRows:H,setModelRows:U,onSaveModels:re,onClearModelsEntry:ie,skillsCatalogLoading:W,catalogForPick:G,skillsInherit:ae,setSkillsInherit:K,skillsPick:q,setSkillsPick:J,onSaveSkills:oe,bindingsLoading:se,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:xe,onAddBinding:Se,onTryInChat:Ce}=e;if(!a){let e;return t[0]===n.selectAgentHint?e=t[1]:(e=(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.selectAgentHint}),t[0]=n.selectAgentHint,t[1]=e),e}if(o===`overview`){let e;return t[2]!==n||t[3]!==c||t[4]!==_||t[5]!==v||t[6]!==x||t[7]!==S||t[8]!==y||t[9]!==b||t[10]!==Ce||t[11]!==a?(e=(0,Q.jsx)(Sn,{a:n,selected:a,defaultModel:_,defaultWorkspace:v,isTuiDefault:x,isTuiDefaultInherited:S,busy:c,onSetDefault:y,onSetTuiDefault:b,onTryInChat:Ce}),t[2]=n,t[3]=c,t[4]=_,t[5]=v,t[6]=x,t[7]=S,t[8]=y,t[9]=b,t[10]=Ce,t[11]=a,t[12]=e):e=t[12],e}if(o===`behavior`){let e;t[13]!==n||t[14]!==c||t[15]!==r||t[16]!==d||t[17]!==h||t[18]!==l||t[19]!==p||t[20]!==x||t[21]!==S||t[22]!==C||t[23]!==y||t[24]!==b||t[25]!==Ce||t[26]!==k.draft||t[27]!==k.handleSoulContentChange||t[28]!==k.handleSoulTemplateChange||t[29]!==k.profileMarkdownLoading||t[30]!==k.setAvatarDialogOpen||t[31]!==k.toggleSoulPreviewMode||t[32]!==k.updateIdentity||t[33]!==a||t[34]!==f||t[35]!==g||t[36]!==u||t[37]!==m?(e=(0,Q.jsx)(gn,{a:n,chat:r,selected:a,busy:c,editName:l,setEditName:u,editDescription:d,setEditDescription:f,editWorkspace:p,setEditWorkspace:m,editModel:h,setEditModel:g,onSetDefault:y,onSetTuiDefault:b,isTuiDefault:x,isTuiDefaultInherited:S,onSaveAgentEdits:C,hideInlineSave:!0,profileMarkdownLoading:k.profileMarkdownLoading,profileDraft:k.draft,updateIdentity:k.updateIdentity,handleSoulTemplateChange:k.handleSoulTemplateChange,handleSoulContentChange:k.handleSoulContentChange,setAvatarDialogOpen:k.setAvatarDialogOpen,toggleSoulPreviewMode:k.toggleSoulPreviewMode,onTryInChat:Ce}),t[13]=n,t[14]=c,t[15]=r,t[16]=d,t[17]=h,t[18]=l,t[19]=p,t[20]=x,t[21]=S,t[22]=C,t[23]=y,t[24]=b,t[25]=Ce,t[26]=k.draft,t[27]=k.handleSoulContentChange,t[28]=k.handleSoulTemplateChange,t[29]=k.profileMarkdownLoading,t[30]=k.setAvatarDialogOpen,t[31]=k.toggleSoulPreviewMode,t[32]=k.updateIdentity,t[33]=a,t[34]=f,t[35]=g,t[36]=u,t[37]=m,t[38]=e):e=t[38];let i;t[39]!==n||t[40]!==c||t[41]!==r||t[42]!==H||t[43]!==ie||t[44]!==re||t[45]!==a||t[46]!==U?(i=(0,Q.jsx)(`section`,{className:`min-h-[34rem]`,children:(0,Q.jsx)(pn,{a:n,chat:r,selected:a,busy:c,modelRows:H,setModelRows:U,onSaveModels:re,onClearModelsEntry:ie})}),t[39]=n,t[40]=c,t[41]=r,t[42]=H,t[43]=ie,t[44]=re,t[45]=a,t[46]=U,t[47]=i):i=t[47];let o;t[48]!==n||t[49]!==M||t[50]!==I||t[51]!==R||t[52]!==j||t[53]!==A||t[54]!==P||t[55]!==Ce||t[56]!==B||t[57]!==z||t[58]!==N||t[59]!==L||t[60]!==F?(o=(0,Q.jsx)(`section`,{className:`min-h-[34rem]`,children:(0,Q.jsx)(dn,{a:n,filesLoading:A,files:j,activeFile:M,setActiveFile:N,filesViewMode:P,setFilesViewMode:F,fileDraft:I,setFileDraft:L,fileSaving:R,profileFileLoading:z,profileEditorNonce:B,onTryInChat:Ce})}),t[48]=n,t[49]=M,t[50]=I,t[51]=R,t[52]=j,t[53]=A,t[54]=P,t[55]=Ce,t[56]=B,t[57]=z,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]!==ne||t[70]!==te||t[71]!==a||t[72]!==V||t[73]!==ee?(e=(0,Q.jsx)(jn,{a:n,data:s,selected:a,busy:c,toolEntryDisable:ee,setToolEntryDisable:V,onSaveTools:te,onClearToolsEntry:ne}),t[66]=n,t[67]=c,t[68]=s,t[69]=ne,t[70]=te,t[71]=a,t[72]=V,t[73]=ee,t[74]=e):e=t[74],e}if(o===`skills`){let e;return t[75]!==n||t[76]!==c||t[77]!==G||t[78]!==oe||t[79]!==a||t[80]!==K||t[81]!==J||t[82]!==W||t[83]!==ae||t[84]!==q?(e=(0,Q.jsx)(Cn,{a:n,selected:a,busy:c,skillsCatalogLoading:W,catalogForPick:G,skillsInherit:ae,setSkillsInherit:K,skillsPick:q,setSkillsPick:J,onSaveSkills:oe}),t[75]=n,t[76]=c,t[77]=G,t[78]=oe,t[79]=a,t[80]=K,t[81]=J,t[82]=W,t[83]=ae,t[84]=q,t[85]=e):e=t[85],e}if(o===`memory`){let e;return t[86]===a.id?e=t[87]:(e=(0,Q.jsx)(Ut,{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]!==se||t[95]!==c||t[96]!==i.lastActiveLabels||t[97]!==i.selectRecipient||t[98]!==fe||t[99]!==ve||t[100]!==ge||t[101]!==Se||t[102]!==xe||t[103]!==be||t[104]!==pe||t[105]!==ye||t[106]!==_e||t[107]!==de?(e=(0,Q.jsx)(un,{a:n,busy:c,bindingsLoading:se,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:xe,onAddBinding:Se}),t[88]=n,t[89]=ce,t[90]=le,t[91]=ue,t[92]=me,t[93]=he,t[94]=se,t[95]=c,t[96]=i.lastActiveLabels,t[97]=i.selectRecipient,t[98]=fe,t[99]=ve,t[100]=ge,t[101]=Se,t[102]=xe,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)(tn,{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)(cn,{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 Y;return t[126]===n.selectAgentHint?Y=t[127]:(Y=(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.selectAgentHint}),t[126]=n.selectAgentHint,t[127]=Y),Y}function Fn(e,t,n){let r=t.trim().toLowerCase();return r?e.filter(e=>{let t=F(e,n).toLowerCase(),i=e.id.toLowerCase(),a=e.workspace.toLowerCase(),o=Ne(e,n).toLowerCase();return t.includes(r)||i.includes(r)||a.includes(r)||o.includes(r)}):e}function In(e,t){return e.replace(`{{count}}`,String(t))}function Ln(e,t){let n=e.tools.effectiveDisable.length,r=e.skills.effectiveAllowlist?.length??0,i=n>0?In(t.listToolsDisabledCount,n):t.listToolsAllEnabled,a=r>0?In(t.listSkillsCount,r):t.listInheritedValue;return`${t.listToolsLabel} ${i} · ${t.listSkillsLabel} ${a}`}function Rn(e,t){let n=e.tools.effectiveDisable.length,r=e.skills.effectiveAllowlist?.length??0,i=n>0?In(t.listToolsDisabledCount,n):t.listToolsAllEnabled,a=r>0?In(t.listSkillsCount,r):t.listInheritedValue;return[`${t.listToolsLabel} ${i}`,`${t.listSkillsLabel} ${a}`]}function zn(e){let t=(0,Z.c)(11),{text:n,children:r,className:a}=e,o;t[0]!==r||t[1]!==a||t[2]!==n?(o=(0,Q.jsx)(z,{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`,st),t[4]=s):s=t[4];let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(ee,{className:`fill-surface-panel`}),t[5]=c):c=t[5];let l;t[6]===n?l=t[7]:(l=(0,Q.jsx)(m,{children:(0,Q.jsxs)(Ie,{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)(Pe,{delayDuration:300,skipDelayDuration:100,children:(0,Q.jsxs)(I,{children:[o,l]})}),t[8]=o,t[9]=l,t[10]=u):u=t[10],u}function Bn(e){let t=(0,Z.c)(34),{a:n,agents:r,defaultAgentId:a,tuiDefaultAgentId:o,tuiDefaultInherited:s,searchQuery:c,onOpenAgent:l,onChatWithAgent:u,busy:d}=e,f,p,m,g,_;if(t[0]!==n||t[1]!==r||t[2]!==d||t[3]!==a||t[4]!==u||t[5]!==l||t[6]!==c||t[7]!==o||t[8]!==s){_=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Fn(r,c,n),v=r.length>0&&e.length===0&&c.trim().length>0;if(r.length===0){let e;t[14]===n.listNoAgentsYet?e=t[15]:(e=(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.listNoAgentsYet}),t[14]=n.listNoAgentsYet,t[15]=e),_=e;break bb0}m=`flex flex-col gap-4`,t[16]!==n||t[17]!==v?(g=v?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.listEmpty}):null,t[16]=n,t[17]=v,t[18]=g):g=t[18],f=`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`;let y;t[19]!==n||t[20]!==d||t[21]!==a||t[22]!==u||t[23]!==l||t[24]!==o||t[25]!==s?(y=e=>{let t=F(e,n),r=e.id,c=Ne(e,n),f=Ln(e,n),p=Rn(e,n),m=e.id===a||e.isDefault,g=e.id===o,_=g&&s,v=g&&!s;return(0,Q.jsx)(`li`,{className:`h-full min-h-0`,children:(0,Q.jsxs)(`article`,{role:`button`,tabIndex:d?-1:0,"aria-disabled":d,"aria-label":`${t} ${r}`,onClick:()=>{d||l(e.id)},onKeyDown:t=>{d||t.key!==`Enter`&&t.key!==` `||(t.preventDefault(),l(e.id))},className:i(`flex min-h-[15.5rem] cursor-pointer flex-col rounded-xl border border-edge-subtle bg-surface-panel p-4 shadow-surface`,`transition-[border-color,transform,box-shadow] duration-150 ease-out`,`hover:border-edge-strong`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-base`,`aria-disabled:pointer-events-none aria-disabled:cursor-not-allowed aria-disabled:opacity-60`,V.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)(Ye,{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,v?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs font-medium text-fg`,children:n.tuiDefaultBadge}):null,_?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs font-medium text-fg`,children:n.tuiDefaultInheritedBadge}):null,!m&&!g?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs font-medium text-fg-muted`,children:n.listCustomBadge}):null]})]}),(0,Q.jsxs)(`div`,{className:`mt-5 min-h-[6.25rem] text-left`,children:[(0,Q.jsx)(`div`,{className:`rounded-lg border border-edge-subtle bg-surface-base px-3 py-3`,children:(0,Q.jsx)(`p`,{className:i(`line-clamp-2 text-sm leading-5`,c?`text-fg`:`text-fg-muted`),title:c||void 0,children:c||n.listNoDescription})}),(0,Q.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-1.5`,title:f,children:p.map(Vn)})]}),(0,Q.jsx)(`div`,{className:`mt-auto pt-4`,children:(0,Q.jsxs)(h,{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)(ie,{className:`size-4 shrink-0`,strokeWidth:2,"aria-hidden":!0}),n.listChatWithAgent]})})]})},e.id)},t[19]=n,t[20]=d,t[21]=a,t[22]=u,t[23]=l,t[24]=o,t[25]=s,t[26]=y):y=t[26],p=e.map(y)}t[0]=n,t[1]=r,t[2]=d,t[3]=a,t[4]=u,t[5]=l,t[6]=c,t[7]=o,t[8]=s,t[9]=f,t[10]=p,t[11]=m,t[12]=g,t[13]=_}else f=t[9],p=t[10],m=t[11],g=t[12],_=t[13];if(_!==Symbol.for(`react.early_return_sentinel`))return _;let v;t[27]!==f||t[28]!==p?(v=(0,Q.jsx)(`ul`,{className:f,children:p}),t[27]=f,t[28]=p,t[29]=v):v=t[29];let y;return t[30]!==m||t[31]!==g||t[32]!==v?(y=(0,Q.jsxs)(`div`,{className:m,children:[g,v]}),t[30]=m,t[31]=g,t[32]=v,t[33]=y):y=t[33],y}function Vn(e){return(0,Q.jsx)(zn,{text:e,className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function Hn(e){let t=(0,Z.c)(130),{open:n,onOpenChange:r,a,chat:o,busy:s,modalError:c,profileLanguageLabel:l,createDisplayName:u,setCreateDisplayName:d,createAgentId:f,setCreateAgentId:p,createDescription:m,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)(Je,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim`,_e)}),t[0]=D):D=t[0];let O;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(O=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`,ct,`overflow-y-auto rounded-xl border border-edge bg-surface-panel p-4 shadow-popover dark:border-edge`),t[1]=O):O=t[1];let A;t[2]===a.addAgent?A=t[3]:(A=(0,Q.jsx)(Ue,{className:`text-base font-semibold text-fg`,children:a.addAgent}),t[2]=a.addAgent,t[3]=A);let j;t[4]===a.addAgentHint?j=t[5]:(j=(0,Q.jsx)(He,{className:`mt-0.5 text-xs text-fg-muted`,children:a.addAgentHint}),t[4]=a.addAgentHint,t[5]=j);let M;t[6]!==A||t[7]!==j?(M=(0,Q.jsxs)(`div`,{className:`min-w-0 pr-2`,children:[A,j]}),t[6]=A,t[7]=j,t[8]=M):M=t[8];let N;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(N=i(L,`shrink-0 p-1.5 hover:bg-surface-base`),t[9]=N):N=t[9];let P;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Q.jsx)(T,{className:`size-4`,"aria-hidden":!0}),t[10]=P):P=t[10];let I;t[11]===a.closeDialogAria?I=t[12]:(I=(0,Q.jsx)(Ce,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:N,"aria-label":a.closeDialogAria,children:P})}),t[11]=a.closeDialogAria,t[12]=I);let R;t[13]!==M||t[14]!==I?(R=(0,Q.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-2`,children:[M,I]}),t[13]=M,t[14]=I,t[15]=R):R=t[15];let z;t[16]!==a||t[17]!==C||t[18]!==w||t[19]!==E?(z=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)(Te,{className:i(Ct(),`bg-surface-panel`),value:w??``,onChange:e=>E(e.target.value||null),children:[(0,Q.jsx)(rt,{value:``,children:a.copyFromExistingAgentNone}),C.map(e=>(0,Q.jsxs)(rt,{value:e.id,children:[F(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]=z):z=t[20];let B;t[21]===c?B=t[22]:(B=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]=B);let ee;t[23]!==a.newAgentLabel||t[24]!==l?(ee=(0,Q.jsxs)(`span`,{className:`text-fg-muted`,children:[a.newAgentLabel,` (`,l,`)`]}),t[23]=a.newAgentLabel,t[24]=l,t[25]=ee):ee=t[25];let V;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(V=Ct(),t[26]=V):V=t[26];let te;t[27]===d?te=t[28]:(te=e=>d(e.target.value),t[27]=d,t[28]=te);let ne;t[29]===S?ne=t[30]:(ne=()=>S(),t[29]=S,t[30]=ne);let H;t[31]!==u||t[32]!==te||t[33]!==ne?(H=(0,Q.jsx)(`input`,{className:V,value:u,onChange:te,onBlur:ne,required:!0,autoComplete:`off`}),t[31]=u,t[32]=te,t[33]=ne,t[34]=H):H=t[34];let U;t[35]!==ee||t[36]!==H?(U=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[ee,H]}),t[35]=ee,t[36]=H,t[37]=U):U=t[37];let re;t[38]===a.newAgentIdOptional?re=t[39]:(re=(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:a.newAgentIdOptional}),t[38]=a.newAgentIdOptional,t[39]=re);let ie;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(ie=i(Ct(),`font-mono text-xs`),t[40]=ie):ie=t[40];let W;t[41]===p?W=t[42]:(W=e=>p(e.target.value),t[41]=p,t[42]=W);let G;t[43]===S?G=t[44]:(G=()=>S(),t[43]=S,t[44]=G);let ae;t[45]!==a.newAgentIdPlaceholder||t[46]!==a.newAgentIdRules||t[47]!==f||t[48]!==W||t[49]!==G?(ae=(0,Q.jsx)(`input`,{className:ie,value:f,onChange:W,onBlur:G,placeholder:a.newAgentIdPlaceholder,autoComplete:`off`,spellCheck:!1,maxLength:64,pattern:`[A-Za-z0-9][A-Za-z0-9_-]{0,63}`,title:a.newAgentIdRules}),t[45]=a.newAgentIdPlaceholder,t[46]=a.newAgentIdRules,t[47]=f,t[48]=W,t[49]=G,t[50]=ae):ae=t[50];let K;t[51]===a.newAgentIdRules?K=t[52]:(K=(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:a.newAgentIdRules}),t[51]=a.newAgentIdRules,t[52]=K);let q;t[53]!==re||t[54]!==ae||t[55]!==K?(q=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[re,ae,K]}),t[53]=re,t[54]=ae,t[55]=K,t[56]=q):q=t[56];let J;t[57]!==a.agentDescription||t[58]!==l?(J=(0,Q.jsxs)(`span`,{className:`text-fg-muted`,children:[a.agentDescription,` (`,l,`)`]}),t[57]=a.agentDescription,t[58]=l,t[59]=J):J=t[59];let oe;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(oe=i(Ct(),`min-h-18 resize-y font-sans text-sm leading-relaxed`),t[60]=oe):oe=t[60];let se;t[61]===g?se=t[62]:(se=e=>g(e.target.value),t[61]=g,t[62]=se);let ce;t[63]!==a.agentDescriptionPlaceholder||t[64]!==m||t[65]!==se?(ce=(0,Q.jsx)(`textarea`,{className:oe,value:m,onChange:se,placeholder:a.agentDescriptionPlaceholder,maxLength:4e3,rows:3,spellCheck:!0}),t[63]=a.agentDescriptionPlaceholder,t[64]=m,t[65]=se,t[66]=ce):ce=t[66];let le;t[67]!==J||t[68]!==ce?(le=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[J,ce]}),t[67]=J,t[68]=ce,t[69]=le):le=t[69];let ue;t[70]===a.newWorkspace?ue=t[71]:(ue=(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:a.newWorkspace}),t[70]=a.newWorkspace,t[71]=ue);let de;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(de=i(Ct(),`font-mono text-xs`),t[72]=de):de=t[72];let fe;t[73]===v?fe=t[74]:(fe=e=>v(e.target.value),t[73]=v,t[74]=fe);let pe;t[75]!==_||t[76]!==fe?(pe=(0,Q.jsx)(`input`,{className:de,value:_,onChange:fe,required:!0,autoComplete:`off`}),t[75]=_,t[76]=fe,t[77]=pe):pe=t[77];let me;t[78]!==ue||t[79]!==pe?(me=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[ue,pe]}),t[78]=ue,t[79]=pe,t[80]=me):me=t[80];let ge;t[81]===a.newModelOptional?ge=t[82]:(ge=(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:a.newModelOptional}),t[81]=a.newModelOptional,t[82]=ge);let ve;t[83]===b?ve=t[84]:(ve=e=>b(e),t[83]=b,t[84]=ve);let ye;t[85]!==s||t[86]!==o.modelNoMatches||t[87]!==o.modelPlaceholder||t[88]!==o.modelSearchPlaceholder||t[89]!==y||t[90]!==ve?(ye=(0,Q.jsx)(Ge,{className:`min-w-0 flex-1`,value:y,disabled:s,placeholder:o.modelPlaceholder,searchPlaceholder:o.modelSearchPlaceholder,noMatches:o.modelNoMatches,onChange:ve}),t[85]=s,t[86]=o.modelNoMatches,t[87]=o.modelPlaceholder,t[88]=o.modelSearchPlaceholder,t[89]=y,t[90]=ve,t[91]=ye):ye=t[91];let be;t[92]!==a.modelClear||t[93]!==s||t[94]!==y||t[95]!==b?(be=y.trim()?(0,Q.jsx)(h,{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]=be):be=t[96];let xe;t[97]!==ye||t[98]!==be?(xe=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-stretch gap-2`,children:[ye,be]}),t[97]=ye,t[98]=be,t[99]=xe):xe=t[99];let Se;t[100]!==ge||t[101]!==xe?(Se=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1 text-sm`,children:[ge,xe]}),t[100]=ge,t[101]=xe,t[102]=Se):Se=t[102];let Y;t[103]!==a.createModalCancel||t[104]!==s?(Y=(0,Q.jsx)(Ce,{asChild:!0,children:(0,Q.jsx)(h,{type:`button`,variant:`secondary`,disabled:s,children:a.createModalCancel})}),t[103]=a.createModalCancel,t[104]=s,t[105]=Y):Y=t[105];let we;t[106]===Symbol.for(`react.memo_cache_sentinel`)?(we=(0,Q.jsx)(k,{className:`mr-1 size-4`,"aria-hidden":!0}),t[106]=we):we=t[106];let Ee;t[107]!==a.create||t[108]!==s?(Ee=(0,Q.jsxs)(h,{type:`submit`,disabled:s,children:[we,a.create]}),t[107]=a.create,t[108]=s,t[109]=Ee):Ee=t[109];let De;t[110]!==Y||t[111]!==Ee?(De=(0,Q.jsxs)(`div`,{className:`mt-1 flex justify-end gap-2 border-t border-edge-subtle pt-3 dark:border-edge`,children:[Y,Ee]}),t[110]=Y,t[111]=Ee,t[112]=De):De=t[112];let Oe;t[113]!==x||t[114]!==B||t[115]!==U||t[116]!==q||t[117]!==le||t[118]!==me||t[119]!==Se||t[120]!==De||t[121]!==z?(Oe=(0,Q.jsxs)(`form`,{className:`grid gap-3`,onSubmit:x,children:[z,B,U,q,le,me,Se,De]}),t[113]=x,t[114]=B,t[115]=U,t[116]=q,t[117]=le,t[118]=me,t[119]=Se,t[120]=De,t[121]=z,t[122]=Oe):Oe=t[122];let je;t[123]!==Oe||t[124]!==R?(je=(0,Q.jsxs)(Ae,{children:[D,(0,Q.jsx)($e,{className:O,onOpenAutoFocus:Un,children:(0,Q.jsxs)(ke,{layer:`modal`,children:[R,Oe]})})]}),t[123]=Oe,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)(he,{open:n,onOpenChange:r,children:je}),t[126]=r,t[127]=n,t[128]=je,t[129]=Me):Me=t[129],Me}function Un(e){return e.preventDefault()}var Wn=`~/.xopc/workspace`;function Gn(e){let t=e.trim();return t?`${Wn}/${et(t)}`:``}function Kn(e){let t=(0,Z.c)(18),{a:n,busy:r,listSearchQuery:i,onListSearchQueryChange:a,onAddAgent:o}=e,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(q,{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)(H,{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)(h,{type:`button`,variant:`primary`,className:`shrink-0 gap-2`,"aria-label":n.addAgentAria,disabled:r,onClick:u,children:[d,n.addAgent]}),t[10]=n.addAgent,t[11]=n.addAgentAria,t[12]=r,t[13]=u,t[14]=f):f=t[14];let p;return t[15]!==l||t[16]!==f?(p=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center justify-end gap-2`,children:[l,f]}),t[15]=l,t[16]=f,t[17]=p):p=t[17],p}function qn(e){return{...e,soulEditorNonce:0,soulPreviewMode:!1,avatarDialogOpen:!1}}function Jn(e){let{agentId:t,enabled:n,saveRef:r}=e,i=p(async()=>{if(!t)return null;let[e,n]=await Promise.all([O(t,`IDENTITY.md`).catch(()=>``),O(t,`SOUL.md`).catch(()=>``)]),r=y(e);return{identity:r,soulTemplate:J(n),soulCustomContent:n,identityBaseline:JSON.stringify(r),soulBaseline:n}},[t],{enabled:n&&!!t,initial:null,errorData:null}),a=i.data,o=i.loading,s=(0,$.useRef)(!1),[c,l]=(0,$.useState)(null),u=t??``,d=(0,$.useRef)(u);d.current!==u&&(d.current=u,s.current=!1,l(null));let f=c??(a?qn(a):null),m=(0,$.useMemo)(()=>f?JSON.stringify(f.identity)!==f.identityBaseline||f.soulCustomContent!==f.soulBaseline:!1,[f]),h=(0,$.useRef)(t);h.current=t;let g=(0,$.useCallback)(e=>{s.current=!0,l(t=>{let n=t??(a?qn(a):null);return n?e(n):null})},[a]),_=(0,$.useCallback)(e=>{g(t=>({...t,identity:{...t.identity,...e}}))},[g]),v=(0,$.useCallback)(e=>{g(t=>{if(e===`custom`)return{...t,soulTemplate:`custom`};let n=lt.find(t=>t.id===e);return n?.content?{...t,soulTemplate:e,soulCustomContent:n.content,soulEditorNonce:t.soulEditorNonce+1}:{...t,soulTemplate:e}})},[g]),b=(0,$.useCallback)(e=>{g(t=>({...t,soulCustomContent:e,soulTemplate:`custom`}))},[g]),x=(0,$.useCallback)(e=>{g(t=>({...t,avatarDialogOpen:e}))},[g]),S=(0,$.useCallback)(()=>{g(e=>({...e,soulPreviewMode:!e.soulPreviewMode}))},[g]),w=(0,$.useCallback)(async()=>{let e=h.current;!e||!f||(await Promise.all([C(e,`IDENTITY.md`,ce(f.identity)),C(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=w,()=>{r.current=null}},[w,r]),{profileMarkdownLoading:o,draft:f,dirty:m,updateIdentity:_,handleSoulTemplateChange:v,handleSoulContentChange:b,setAvatarDialogOpen:x,toggleSoulPreviewMode:S}}var Yn={draft:``,editorNonce:0,loadedKey:``};function Xn(e,t){switch(t.type){case`load`:return{draft:t.content,editorNonce:e.editorNonce+1,loadedKey:t.key};case`setDraft`:return{...e,draft:t.value};case`clear`:return{draft:``,editorNonce:e.editorNonce,loadedKey:``};case`resetViewMode`:return e}}function Zn(e){let{panel:t,selectedId:n,hasToken:r,dataAgentsLength:i,saveErrorMessage:a,setError:o}=e,s=p(()=>n?M(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),[m,h]=(0,$.useReducer)(Xn,Yn),[g,_]=(0,$.useState)(!1),[v,y]=(0,$.useState)(`edit`),b=(0,$.useRef)(n);(0,$.useEffect)(()=>{n!==b.current&&(b.current=n,f(null))},[n]),(0,$.useEffect)(()=>{if(c&&c.files.length>0&&!d){let e=c.files.find(e=>e.name===`AGENTS.md`);f(e?e.name:c.files[0].name)}},[c,d]);let x=m.draft,S=m.editorNonce,w=(0,$.useRef)(x);w.current=x;let T=(0,$.useRef)(n);T.current=n;let E=(0,$.useRef)(d);E.current=d;let D=(0,$.useRef)(null),k=(0,$.useRef)(``),A=(0,$.useRef)(``),j=(0,$.useRef)(``),N=(0,$.useRef)(()=>{}),P=p(()=>d&&n?O(n,d).catch(()=>``):Promise.resolve(``),[d,n,r],{enabled:!!(d&&n&&r),initial:``,errorData:``}),F=P.loading,I=U(async()=>{let e=T.current,t=E.current;if(!e||!t||`${e}:${t}`!==k.current)return;let n=w.current;if(n!==A.current){_(!0),o(null);try{await C(e,t,n),A.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{_(!1)}}},800);N.current=I.flush,(0,$.useEffect)(()=>()=>{N.current()},[]);let L=(0,$.useRef)(t);L.current!==t&&(L.current===`behavior`&&N.current(),L.current=t);let R=d&&n?`${n}:${d}`:``;(0,$.useEffect)(()=>{R!==j.current&&(N.current(),j.current=R)},[R]),(0,$.useEffect)(()=>{if(!R){h({type:`clear`});return}F||(k.current=R,A.current=P.data,h({type:`load`,key:R,content:P.data}))},[R,F,P.data]);let z=(0,$.useRef)({activeFile:d,selectedId:n});return(z.current.activeFile!==d||z.current.selectedId!==n)&&(z.current={activeFile:d,selectedId:n},y(`edit`)),{files:c,setFiles:l,filesLoading:u,activeFile:d,setActiveFile:(0,$.useCallback)(e=>{N.current(),f(e)},[]),fileDraft:x,setFileDraft:(0,$.useCallback)(e=>{h({type:`setDraft`,value:typeof e==`function`?e(w.current):e}),I()},[I]),fileSaving:g,filesViewMode:v,setFilesViewMode:y,profileFileLoading:F,profileEditorNonce:S,overviewSaveProfileMarkdownRef:D,saveProfileMarkdownDebounced:I}}function Qn(e){let{panel:t,hasToken:n,bindingsFromConfig:r,gatewayCfgLoading:i,selected:a,saveErrorMessage:o,setBusy:s,setError:c}=e,l=(0,$.useRef)(!1),[u,d]=(0,$.useState)(null),f=(0,$.useRef)(r);t===`connections`&&n&&!l.current&&f.current!==r&&(f.current=r,d(r));let m=u??r,h=t===`connections`&&n,g=p(()=>vt(),[t,n],{enabled:h,initial:[],errorData:[]}),_=g.data,v=g.loading,y=(0,$.useMemo)(()=>v||_.length===0?``:_[0]?.name??``,[_,v]),[b,x]=(0,$.useState)(``),S=(0,$.useRef)(y);t===`connections`&&!v&&y&&S.current!==y&&(!b||!_.some(e=>e.name===b))&&(S.current=y,x(y)),S.current=y;let C=b.trim(),w=h&&C.length>0,T=p(()=>yt(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?m.filter(e=>e.agentId.toLowerCase()===a.id.toLowerCase()):[],[m,a?.id]),F=(0,$.useCallback)(()=>{let e=b.trim();e&&yt(e).then(e=>{O(e),A(t=>t!=null&&t<e.length?t:null)}).catch(()=>{O([]),A(null)})},[b,O]),I=!v&&_.length===0,L=t===`connections`&&n&&i,R=(0,$.useCallback)(async e=>{s(!0),c(null);try{let t=m.filter(t=>t!==e);await ue(t),l.current=!0,d(t)}catch(e){c(e instanceof Error?e.message:o)}finally{s(!1)}},[m,o,s,c]);return{agentBindings:P,allBindings:m,bindChannelStatuses:_,bindChannelsLoading:v,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=xt(b,j,k,E),n=[...m,{agentId:a.id,priority:100,enabled:!0,match:t}];s(!0),c(null);try{await ue(n),l.current=!0,d(n),A(null),M(``)}catch(e){c(e instanceof Error?e.message:o)}finally{s(!1)}},[m,E,b,j,k,o,a,s,c]),onRemoveBinding:R,refreshBindSessions:F,useManualChannel:I}}function $n(e,t){let n=(0,Z.c)(16),[r,i]=(0,$.useState)(0),a,o;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>{let e=e=>{let t=e.detail;t&&typeof t==`object`&&`section`in t&&t.section===`skills`&&i(nr)};return window.addEventListener(`config-reload`,e),()=>window.removeEventListener(`config-reload`,e)},o=[],n[0]=a,n[1]=o):(a=n[0],o=n[1]),(0,$.useEffect)(a,o);let s;n[2]!==r||n[3]!==e||n[4]!==t?(s=[e,t,r],n[2]=r,n[3]=e,n[4]=t,n[5]=s):s=n[5];let c=e&&t,l;n[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=[],n[6]=l):l=n[6];let u;n[7]===Symbol.for(`react.memo_cache_sentinel`)?(u=[],n[7]=u):u=n[7];let d;n[8]===c?d=n[9]:(d={enabled:c,initial:l,errorData:u},n[8]=c,n[9]=d);let{data:f,loading:m}=p(tr,s,d),h;n[10]===f?h=n[11]:(h=f.filter(er),n[10]=f,n[11]=h);let g=h,_;return n[12]!==g||n[13]!==f||n[14]!==m?(_={catalogForPick:g,skillCatalog:f,skillsCatalogLoading:m},n[12]=g,n[13]=f,n[14]=m,n[15]=_):_=n[15],_}function er(e){return e.enabled!==!1}function tr(){return g()}function nr(e){return e+1}function rr(e){return $n(e.panel===`skills`,e.hasToken)}function ir(e){return new Set(e.tools.entryDisable)}function ar(e){return e.skills.entry===void 0?{inherit:!0,pick:new Set(e.skills.effectiveAllowlist??[])}:{inherit:!1,pick:new Set(e.skills.entry??[])}}function or(e){let{panel:t,selected:n}=e,r=`${t}:${n?.id??``}`,i=(0,$.useRef)(r),[a,o]=(0,$.useState)(()=>new Set),[s,c]=(0,$.useState)(()=>new Set),[l,u]=(0,$.useState)(!0),[d,f]=(0,$.useState)(()=>[]);if(i.current!==r){if(i.current=r,n&&t===`tools`&&o(ir(n)),n&&t===`skills`){let e=ar(n);u(e.inherit),c(e.pick)}n&&t===`behavior`&&f(Tt(n.typedModels.effective))}return{toolEntryDisable:a,setToolEntryDisable:o,skillsPick:s,setSkillsPick:c,skillsInherit:l,setSkillsInherit:u,modelRows:d,setModelRows:f}}function sr(e,t){let n=e.typedModels.defaultRole;return{defaultRole:n,roles:{[n]:{model:t}}}}function cr(e){let t=Tt(e.typedModels.preset);return t.some(t=>t.id===e.typedModels.defaultRole)?t:Tt(e.typedModels.effective)}function lr(e){return Object.fromEntries(Array.from(e).map(e=>e.trim()).filter(Boolean).toSorted((e,t)=>e.localeCompare(t)).map(e=>[e,{mode:`deny`}]))}function ur(){let e=o(e=>e.language),t=a(e),n=t.agentsSettings,[r,i]=(0,$.useState)(!1),[s,l]=(0,$.useState)(null),[u,f]=(0,$.useState)(!1),[p,m]=(0,$.useState)(``),h=t.cron,g=t.chat,_=!!c(e=>e.token),[v,y]=D(),b=te(),{agentId:C}=x(),w=Xe(e=>e.setPageHeader),T=Xe(e=>e.clearPageHeader),{data:O,error:k,isLoading:A,mutate:j}=d(_?`settings-gateway-agents`:null,ut,{revalidateOnFocus:!1}),{data:M,mutate:N}=d(_?`settings-capability-presets`:null,jt,{revalidateOnFocus:!1}),I=P(_),{data:L}=I,z=(0,$.useMemo)(()=>E(L?.payload?.config??{}),[L]),B=O??null,ee=(0,$.useMemo)(()=>B?B.agents.find(e=>e.id===B.defaultId)??B.agents[0]??null:null,[B]),V=!!(_&&A),[ne,H]=(0,$.useState)(null),U=k instanceof Error?k.message:k?n.loadError:null,re=ne??U,[ie,W]=(0,$.useState)(null),[G,ae]=(0,$.useState)(`overview`),[K,q]=(0,$.useState)(``),[J,oe]=(0,$.useState)(``),[ce,le]=(0,$.useState)(``),[ue,de]=(0,$.useState)(``),[pe,me]=(0,$.useState)(``),[he,ge]=(0,$.useState)(null),[_e,ve]=(0,$.useState)(!1),ye=(0,$.useRef)(``),[be,Se]=(0,$.useState)(null),[Ce,Y]=(0,$.useState)(!1),[we,Te]=(0,$.useState)(``),[Ee,Oe]=(0,$.useState)(``),[ke,Ae]=(0,$.useState)(``),[je,Me]=(0,$.useState)(``),[Ne,Pe]=(0,$.useState)(``),[Fe,Ie]=(0,$.useState)(``),Le=(0,$.useRef)(null),[Re,ze]=(0,$.useState)(!1),Be=(0,$.useRef)({data:null,routeAgentId:void 0});B&&(B!==Be.current.data||C!==Be.current.routeAgentId)&&(Be.current={data:B,routeAgentId:C},C&&B.agents.some(e=>e.id===C)?W(C):W(e=>e&&B.agents.some(t=>t.id===e)?e:B.defaultId)),(0,$.useEffect)(()=>{!B||!C||B.agents.some(e=>e.id===C)||b(Qe,{replace:!0})},[B,C,b]),(0,$.useEffect)(()=>{C&&ae(`overview`)},[C]),(0,$.useEffect)(()=>{v.get(`panel`)===`defaults`&&b(C?Ve(C):Qe,{replace:!0,state:{[De]:C?Ve(C):Qe}})},[v,C,b]),(0,$.useEffect)(()=>{if(v.get(`focus`)!==`avatar`||!C||(ae(`overview`),V||!B?.agents.some(e=>e.id===C)))return;let e=window.setTimeout(()=>{document.getElementById(`agent-avatar-settings`)?.scrollIntoView({behavior:`smooth`,block:`center`}),y(e=>{let t=new URLSearchParams(e);return t.delete(`focus`),t},{replace:!0})},220);return()=>window.clearTimeout(e)},[v,C,V,B,y]);let X=(0,$.useMemo)(()=>B?.agents.find(e=>e.id===ie)??null,[B,ie]),He=(0,$.useMemo)(()=>{let e=L?.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():``},[L]),Ue=(0,$.useMemo)(()=>!B||He&&B.agents.some(e=>e.id===He)?He:B.defaultId||B.agents[0]?.id||He,[B,He]),We=!!(B&&He&&!B.agents.some(e=>e.id===He));(0,$.useEffect)(()=>{Oe(We?``:He)},[He,We]);let Ge=(0,$.useRef)(null),qe=X?X.id:null;X&&Ge.current!==qe?(Ge.current=qe,Ae(X.workspace),Me(X.model?.primary??``),Pe(F(X,a(e).agentsSettings)),Ie(X.description??``)):!X&&Ge.current!==null&&(Ge.current=null,Ae(``),Me(``),Pe(``),Ie(``));let Je=Jn({agentId:X?.id??null,enabled:G===`behavior`&&!!X,saveRef:Le}),Ye=Zn({panel:G,selectedId:ie,hasToken:_,dataAgentsLength:B?.agents.length,saveErrorMessage:n.saveError,setError:H}),Ze=or({panel:G,selected:X}),$e=Qn({panel:G,hasToken:_,bindingsFromConfig:z,gatewayCfgLoading:L===void 0,selected:X,saveErrorMessage:n.saveError,setBusy:Y,setError:H}),et=rr({panel:G,hasToken:_}),tt=(0,$.useCallback)(()=>{let e=Gn(J.trim()||K);de(t=>t===``||t===ye.current?(ye.current=e,e):t)},[J,K]),nt=(0,$.useCallback)(()=>{ye.current=``,q(``),oe(``),le(``),de(``),me(``),ge(null),Se(null),ve(!0)},[]),rt=(0,$.useCallback)(e=>{let t=new Set(B?.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,B]),it=(0,$.useCallback)(e=>{if(Se(e),!e)return;let t=B?.agents.find(t=>t.id===e);if(!t)return;let r=t.name?.trim()??t.id,i=n.duplicateName.replace(`{{name}}`,r),a=rt(t.id),o=t.description??``;ye.current=``,q(i),oe(a),le(o),de(t.workspace),me(t.model?.primary??``),ge(null)},[n.duplicateName,B,rt]),at=(0,$.useCallback)(e=>{it(e),ve(!0)},[it]),ot=(0,$.useMemo)(()=>(0,Q.jsx)(Kn,{a:n,busy:Ce,listSearchQuery:we,onListSearchQueryChange:Te,onAddAgent:()=>nt()}),[n,Ce,we,nt]);(0,$.useLayoutEffect)(()=>_?(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:ot}),()=>T()):(T(),()=>T()),[n.title,ot,T,_,w]);async function st(t){t.preventDefault();let r=K.trim();if(!r)return;let i=xe(J,r);if(i.ok===!1){ge(i.error);return}let a=ue.trim()||Gn(J.trim()||r);if(a){Y(!0),ge(null);try{let t=[`# IDENTITY.md - Who Am I?`,``,`- **Name:** ${r}`,`- **Description:** ${ce.trim()}`,`- **Language:** ${e}`,`- **Creature:** assistant`,`- **Emoji:**`,`- **Avatar:**`,``].join(`
|
|
2
|
+
`),{createdAgentId:n,...i}=await R({workspace:a,...J.trim()?{id:J.trim()}:{},...pe.trim()?{models:{defaultRole:`deep`,roles:{deep:{model:pe.trim()}}}}:{},profileFiles:{"IDENTITY.md":t},...be?{cloneFrom:be}:{}});j(i,{revalidate:!1}),q(``),oe(``),le(``),de(``),me(``),ge(null),ve(!1),W(n),b(Ve(n))}catch(e){ge(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}}async function ct(){if(X){Y(!0),H(null);try{j(await Ke(X.id,{workspace:ke.trim()||void 0,...je.trim()?{models:sr(X,je.trim())}:{}}),{revalidate:!1})}catch(e){H(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}}async function lt(e){Y(!0),H(null);try{j(await Ke(e.id,{setDefault:!0}),{revalidate:!1}),W(e.id)}catch(e){H(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}async function dt(){let e=Ee.trim().toLowerCase();if(e&&!B?.agents.some(t=>t.id===e)){H(n.tuiDefaultAgentInvalid);return}Y(!0),H(null);try{await fe(e||null),await I.mutate()}catch(e){H(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}async function ft(e){Y(!0),H(null);try{await fe(e.id),Oe(e.id),await I.mutate()}catch(e){H(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}async function pt(){Y(!0),H(null);try{await fe(null),Oe(``),await I.mutate()}catch(e){H(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}async function mt(e,t){Y(!0),H(null);try{let n=await S(e.id,t);j(n,{revalidate:!1}),W(n.defaultId),ae(`overview`),C===e.id&&b(Qe,{replace:!0}),i(!1),l(null),m(``)}catch(e){H(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}function ht(e,t){e.id!==`main`&&(l(e),f(t),m(``),i(!0))}async function gt(){if(X){Y(!0),H(null);try{j(await Ke(X.id,{tools:{builtin:lr(Ze.toolEntryDisable)}}),{revalidate:!1})}catch(e){H(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}}async function _t(){if(X){Y(!0),H(null);try{j(await Ke(X.id,{tools:null}),{revalidate:!1}),Ze.setToolEntryDisable(new Set)}catch(e){H(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}}async function vt(){if(!X)return;let e=wt(Ze.modelRows,{invalidId:n.typedModelsInvalidId,duplicateId:n.typedModelsDuplicateId,invalidModel:n.typedModelsInvalidModel});if(e){H(e);return}Y(!0),H(null);try{j(await Ke(X.id,{models:{roles:Ot(Ze.modelRows)?.roles??{}}}),{revalidate:!1})}catch(e){H(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}async function yt(){if(!X)return;let e=cr(X),t=Ot(e);if(!t?.roles?.[X.typedModels.defaultRole]){H(n.typedModelsInvalidModel);return}Y(!0),H(null);try{j(await Ke(X.id,{models:{defaultRole:X.typedModels.defaultRole,roles:t.roles}}),{revalidate:!1}),Ze.setModelRows(e)}catch(e){H(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}async function bt(){if(X){Y(!0),H(null);try{j(await Ke(X.id,{skills:Ze.skillsInherit?null:[...Ze.skillsPick].toSorted((e,t)=>e.localeCompare(t))}),{revalidate:!1})}catch(e){H(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}}async function xt(e){if(X){Y(!0),H(null);try{j(await Ke(X.id,{extends:e}),{revalidate:!1}),N()}catch(e){H(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}}let St=G!==`behavior`,Ct=(()=>{if(!X||G!==`behavior`)return!1;let e=X.workspace,t=X.model?.primary??``;return ke.trim()!==e||je.trim()!==t})(),Tt=(()=>{if(St||!X)return!1;switch(G){case`behavior`:return Ct||Je.dirty;default:return!0}})(),Et=St||!Tt;function Dt(){ze(!0),setTimeout(()=>ze(!1),2e3)}async function kt(){switch(G){case`behavior`:await Promise.all([ct(),Le.current?.()??Promise.resolve()]),Dt();break;default:break}}function At(e){e||b(Qe)}let Mt=X?Ne.trim()||F(X,n):C??``,Nt=X?.id??C??``,Z=(0,$.useCallback)(async()=>{if(X){await kt(),Ye.saveProfileMarkdownDebounced.flush();try{globalThis.localStorage?.setItem(se,X.id)}catch{}b(`/chat/new`,{state:{agentId:X.id,fromAgentEditor:!0}})}},[X,kt,Ye.saveProfileMarkdownDebounced,b]),Pt={a:n,chat:g,cCron:h,selected:X,panel:G,data:B,busy:Ce,editName:Ne,setEditName:Pe,editDescription:Fe,setEditDescription:Ie,editWorkspace:ke,setEditWorkspace:Ae,editModel:je,setEditModel:Me,defaultModel:ee?.model?.primary??``,defaultWorkspace:ee?.workspace??``,onSetDefault:()=>{X&<(X)},onSetTuiDefault:()=>{X&&ft(X)},isTuiDefault:!!(X&&X.id===Ue),isTuiDefaultInherited:!!(X&&X.id===Ue&&(!He||We)),onSaveAgentEdits:()=>void ct(),onDelete:e=>{X&&ht(X,e)},onTryInChat:()=>void Z(),capabilityPresets:M?.presets??[],defaultPresetId:M?.defaultPresetId,onUpdateAgentExtends:e=>void xt(e),onOpenCapabilityPreset:e=>{b(e?`/settings/capability-presets?preset=${encodeURIComponent(e)}`:`/settings/capability-presets`)},overviewSaveProfileMarkdownRef:Le,overviewProfile:Je,filesLoading:Ye.filesLoading,files:Ye.files,activeFile:Ye.activeFile,setActiveFile:Ye.setActiveFile,filesViewMode:Ye.filesViewMode,setFilesViewMode:Ye.setFilesViewMode,fileDraft:Ye.fileDraft,setFileDraft:Ye.setFileDraft,fileSaving:Ye.fileSaving,profileFileLoading:Ye.profileFileLoading,profileEditorNonce:Ye.profileEditorNonce,toolEntryDisable:Ze.toolEntryDisable,setToolEntryDisable:Ze.setToolEntryDisable,onSaveTools:()=>void gt(),onClearToolsEntry:()=>void _t(),modelRows:Ze.modelRows,setModelRows:Ze.setModelRows,onSaveModels:()=>void vt(),onClearModelsEntry:()=>void yt(),skillsCatalogLoading:et.skillsCatalogLoading,catalogForPick:et.catalogForPick,skillsInherit:Ze.skillsInherit,setSkillsInherit:Ze.setSkillsInherit,skillsPick:Ze.skillsPick,setSkillsPick:Ze.setSkillsPick,onSaveSkills:()=>void bt(),bindingsLoading:$e.bindingsLoading,agentBindings:$e.agentBindings,bindChannelStatuses:$e.bindChannelStatuses,bindChannelsLoading:$e.bindChannelsLoading,useManualChannel:$e.useManualChannel,newBindChannel:$e.newBindChannel,setNewBindChannel:$e.setNewBindChannel,bindSessionChats:$e.bindSessionChats,bindSessionsLoading:$e.bindSessionsLoading,newBindSessionIdx:$e.newBindSessionIdx,setNewBindSessionIdx:$e.setNewBindSessionIdx,newBindCustomPeer:$e.newBindCustomPeer,setNewBindCustomPeer:$e.setNewBindCustomPeer,refreshBindSessions:$e.refreshBindSessions,onRemoveBinding:e=>void $e.onRemoveBinding(e),onAddBinding:$e.onAddBinding};return{hasToken:_,a:n,chat:g,language:e,data:B,savedTuiDefaultAgentId:He,effectiveTuiDefaultAgentId:Ue,tuiDefaultAgentDraft:Ee,setTuiDefaultAgentDraft:Oe,tuiDefaultAgentUnavailable:We,onSaveTuiDefaultAgent:dt,onSetTuiDefaultAgent:ft,onClearTuiDefaultAgent:pt,onSetDefaultAgent:lt,loading:V,displayError:re,navigate:b,routeAgentId:C,busy:Ce,listSearchQuery:we,openAddAgentModal:nt,openDuplicateAgentModal:at,duplicateSourceId:be,onSelectDuplicateSource:it,panel:G,setPanel:ae,modalTitle:Mt,modalSubtitle:Nt,footerSaveDisabled:Et,savedFlash:Re,handleModalFooterSave:kt,onAgentModalOpenChange:At,addAgentModalOpen:_e,setAddAgentModalOpen:ve,createWorkspaceSuggestedRef:ye,createModalError:he,setCreateModalError:ge,createDisplayName:K,setCreateDisplayName:q,createAgentId:J,setCreateAgentId:oe,createDescription:ce,setCreateDescription:le,createWorkspace:ue,setCreateWorkspace:de,createModel:pe,setCreateModel:me,onCreate:st,currentLanguageLabel:e===`zh`?`中文`:`English`,applyCreateWorkspaceSuggestion:tt,deleteDialogOpen:r,setDeleteDialogOpen:i,deletePurge:u,deleteTarget:s,setDeleteTarget:l,deleteConfirmText:p,setDeleteConfirmText:m,performDelete:mt,editorPanelProps:Pt}}function dr(){let e=ur();return e.hasToken?(0,Q.jsxs)(gt,{gap:`gap-6`,padding:`px-3 py-8 sm:px-5 xl:px-6`,children:[e.displayError?(0,Q.jsx)(`div`,{className:`rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-800 dark:border-red-900/50 dark:bg-red-950/40 dark:text-red-200`,children:e.displayError}):null,e.loading?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e.a.loading}):e.data?(0,Q.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,Q.jsx)(Bn,{a:e.a,agents:e.data.agents,defaultAgentId:e.data.defaultId,tuiDefaultAgentId:e.effectiveTuiDefaultAgentId,tuiDefaultInherited:!e.savedTuiDefaultAgentId||e.tuiDefaultAgentUnavailable,searchQuery:e.listSearchQuery,onOpenAgent:t=>e.navigate(Ve(t)),onChatWithAgent:t=>{let n=t.trim().toLowerCase();try{globalThis.localStorage?.setItem(se,n)}catch{}e.navigate(`/chat/new`,{state:{agentId:n}})},busy:e.busy})}):null,e.routeAgentId&&e.hasToken?(0,Q.jsx)(Rt,{open:!!e.routeAgentId,onOpenChange:e.onAgentModalOpenChange,a:e.a,title:e.modalTitle,subtitle:e.modalSubtitle,panel:e.panel,onPanelChange:e.setPanel,onFooterSave:()=>void e.handleModalFooterSave(),footerSaveDisabled:e.footerSaveDisabled,footerSavedFlash:e.savedFlash,showFooter:e.panel===`behavior`,busy:e.busy,children:e.loading||!e.data?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e.a.loading}):(0,Q.jsx)(Pn,{...e.editorPanelProps})}):null,(0,Q.jsx)(Hn,{open:e.addAgentModalOpen,onOpenChange:t=>{e.setAddAgentModalOpen(t),t||(e.createWorkspaceSuggestedRef.current=``,e.setCreateDisplayName(``),e.setCreateAgentId(``),e.setCreateDescription(``),e.setCreateWorkspace(``),e.setCreateModel(``),e.setCreateModalError(null),e.onSelectDuplicateSource(null))},a:e.a,chat:e.chat,busy:e.busy,modalError:e.createModalError,profileLanguageLabel:e.currentLanguageLabel,createDisplayName:e.createDisplayName,setCreateDisplayName:e.setCreateDisplayName,createAgentId:e.createAgentId,setCreateAgentId:e.setCreateAgentId,createDescription:e.createDescription,setCreateDescription:e.setCreateDescription,createWorkspace:e.createWorkspace,setCreateWorkspace:e.setCreateWorkspace,createModel:e.createModel,setCreateModel:e.setCreateModel,onCreate:e.onCreate,onSuggestWorkspace:()=>e.applyCreateWorkspaceSuggestion(),agents:e.data?.agents??[],duplicateSourceId:e.duplicateSourceId,onSelectDuplicateSource:e.onSelectDuplicateSource}),(0,Q.jsx)(Pt,{open:e.deleteDialogOpen,onOpenChange:t=>{e.setDeleteDialogOpen(t),t||(e.setDeleteTarget(null),e.setDeleteConfirmText(``))},busy:e.busy,deletePurge:e.deletePurge,deleteTarget:e.deleteTarget,deleteConfirmText:e.deleteConfirmText,onDeleteConfirmTextChange:e.setDeleteConfirmText,onConfirm:()=>{e.deleteTarget&&e.performDelete(e.deleteTarget,e.deletePurge)},onCancel:()=>e.setDeleteDialogOpen(!1),a:e.a})]}):(0,Q.jsxs)(gt,{gap:`gap-3`,padding:`px-3 py-8 sm:px-5 xl:px-6`,children:[(0,Q.jsx)(ht,{title:e.a.title}),(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e.a.needToken})]})}export{dr as AgentsSettingsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-BQ_8x0bT.js";import{t as a}from"./messages-C6Kc4Jhf.js";import{n as o}from"./locale-store-Ba72bFmP.js";import{i as s,n as c}from"./fetch-Cs4ck8zA.js";import{i as l}from"./vendor-swr-BIWyz7Rc.js";import{Gi as u,Ji as d,Ki as f,Oa as p,Os as m,Sa as h,Ui as g,Wi as _,Xi as v,_s as y,ca as b,ct as x,jo as S,qi as C,sa as w,va as T}from"./index-BU1pvxmS.js";import{r as E,t as D}from"./settings-form-section-CIxIEYxU.js";import{n as O,t as k}from"./settings-page-layout--6qT7ZJa.js";var A=n(),j=e(t(),1),M=r();function N(e,t){return e==null?t:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function P(e,t){return e===`PENDING_UPDATE`?t.pendingUpdate??t.generic:e===`UNINSTALLER_NOT_FOUND`?t.uninstallerNotFound??t.generic:e===`NOT_PACKAGED`?t.notPackaged??t.generic:t.generic}function F(e,t){if(e.platform===`darwin`)return t.uninstallDescDarwin;if(e.platform===`win32`)return t.uninstallDescWin;if(e.platform===`linux`){if(e.linuxPackageKind===`appimage`)return t.uninstallDescLinuxAppImage;if(e.linuxPackageKind===`deb`){let n=e.linuxDebPackageName??`xopc`;return t.uninstallDescLinuxDeb.replace(/\{\{package\}\}/g,n)}return t.uninstallDescLinuxUnknown}return t.uninstallDescLinuxUnknown}var I={info:null,loadError:null,actionError:null,copiedField:null,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``,uninstallDialogOpen:!1,removeUserDataOnUninstall:!1,busy:!1};function L({api:e,messages:t,embedded:n=!0}){let[r,a]=(0,j.useReducer)(x,I),{info:o,loadError:s,actionError:c,copiedField:l,clearDialogOpen:v,clearConfirmChecked:E,clearConfirmText:O,uninstallDialogOpen:k,removeUserDataOnUninstall:A,busy:L}=r,R=(0,j.useCallback)(async()=>{if(e?.getUninstallInfo){a({type:`patch`,patch:{loadError:null}});try{a({type:`patch`,patch:{info:await e.getUninstallInfo()}})}catch(e){a({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}}},[e]);(0,j.useEffect)(()=>{R()},[R]);let z=async(e,n)=>{if(await T(e)){a({type:`patch`,patch:{actionError:null,copiedField:n}}),window.setTimeout(()=>a({type:`patch`,patch:{copiedField:null}}),2e3);return}a({type:`patch`,patch:{actionError:t.copyFailed}})},B=async e=>{let t=window.electronAPI?.shell;if(!t)return;let n=await t.openPath(e);n.error&&a({type:`patch`,patch:{actionError:n.error}})},V=async()=>{if(e?.clearUserData){a({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.clearUserData();n.ok||a({type:`patch`,patch:{actionError:P(n.error,t.errors)}})}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{a({type:`patch`,patch:{busy:!1,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})}}},H=async()=>{if(e?.uninstallApp){a({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.uninstallApp({removeUserData:A});n.ok||a({type:`patch`,patch:{actionError:P(n.error,t.errors)}})}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{a({type:`patch`,patch:{busy:!1,uninstallDialogOpen:!1}})}}};if(s)return(0,M.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:s});if(!o)return(0,M.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.loading});let U=!o.packaged,W=L||o.pendingUpdate||U,G=!U&&o.uninstallMode!==`unsupported`,K=F(o,t),q=E&&O.trim()===t.clearDataConfirmPhrase;return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(D,{children:[n?(0,M.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,M.jsx)(S,{className:`size-4 text-accent`,strokeWidth:1.75}),t.title]}):null,c?(0,M.jsx)(`p`,{className:`mb-3 text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:c}):null,U?(0,M.jsxs)(`div`,{className:`mb-4 rounded-xl border border-edge-subtle bg-surface-panel/60 px-3 py-2.5`,children:[(0,M.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.devOnlyTitle}),(0,M.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.devOnlyBody})]}):null,o.pendingUpdate?(0,M.jsx)(`p`,{className:`mb-3 rounded-xl border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-800 dark:text-amber-200`,children:t.pendingUpdateBlocked}):null,o.hasSeparateCliData&&o.cliDataPath?(0,M.jsxs)(`div`,{className:`mb-4 rounded-xl border border-amber-500/30 bg-amber-500/10 px-3 py-2.5`,children:[(0,M.jsx)(`p`,{className:`text-xs text-amber-800 dark:text-amber-200`,children:t.cliDataWarning}),(0,M.jsxs)(`button`,{type:`button`,className:i(`mt-2 inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover`,h.press),onClick:()=>void B(o.cliDataPath),children:[(0,M.jsx)(y,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t.openCliData]})]}):null,(0,M.jsxs)(`dl`,{className:`space-y-3 text-sm`,children:[(0,M.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-panel/60 p-3`,children:[(0,M.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.appPath}),(0,M.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,M.jsx)(`code`,{className:`break-all text-xs text-fg`,children:o.appPath}),(0,M.jsxs)(`button`,{type:`button`,className:i(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,h.press),onClick:()=>void z(o.appPath,`app`),children:[(0,M.jsx)(m,{className:`size-3`,"aria-hidden":!0}),l===`app`?t.copied:t.copyPath]})]})]}),(0,M.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-panel/60 p-3`,children:[(0,M.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.dataPath}),(0,M.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,M.jsx)(`code`,{className:`break-all text-xs text-fg`,children:o.userDataPath}),(0,M.jsxs)(`button`,{type:`button`,className:i(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,h.press),onClick:()=>void z(o.userDataPath,`data`),children:[(0,M.jsx)(m,{className:`size-3`,"aria-hidden":!0}),l===`data`?t.copied:t.copyPath]})]}),(0,M.jsxs)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:[t.dataSize,`: `,N(o.userDataSizeBytes,t.dataSizeUnknown)]})]})]}),(0,M.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl border border-edge-subtle bg-surface-panel/60 p-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.clearData}),(0,M.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:t.clearDataDesc})]}),(0,M.jsx)(`button`,{type:`button`,disabled:W,className:i(`inline-flex shrink-0 items-center justify-center rounded-lg border border-danger/40 bg-danger px-3 py-1.5 text-sm font-medium text-white hover:bg-danger/90 disabled:opacity-50`,h.press),onClick:()=>{a({type:`patch`,patch:{clearConfirmChecked:!1,clearConfirmText:``,clearDialogOpen:!0}})},children:t.clearData})]}),G?(0,M.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl border border-edge-subtle bg-surface-panel/60 p-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.uninstall}),(0,M.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:K})]}),(0,M.jsx)(`button`,{type:`button`,disabled:W,className:i(`inline-flex shrink-0 items-center justify-center rounded-lg border border-edge bg-surface-base px-3 py-1.5 text-sm font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,h.press),onClick:()=>{a({type:`patch`,patch:{removeUserDataOnUninstall:!1,uninstallDialogOpen:!0}})},children:t.uninstall})]}):null]})]}),(0,M.jsx)(C,{open:v,onOpenChange:e=>{e||a({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:(0,M.jsxs)(f,{children:[(0,M.jsx)(u,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,b)}),(0,M.jsxs)(g,{className:i(`fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,w,`rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,M.jsx)(d,{className:`text-base font-semibold text-fg`,children:t.clearDataConfirmTitle}),(0,M.jsx)(_,{className:`mt-2 text-sm text-fg-muted`,children:t.clearDataConfirmDesc}),(0,M.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,M.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:E,onChange:e=>a({type:`patch`,patch:{clearConfirmChecked:e.target.checked}})}),(0,M.jsx)(`span`,{children:t.clearDataConfirmCheckbox})]}),(0,M.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,M.jsx)(`label`,{className:`block text-sm font-medium text-fg`,htmlFor:`clear-data-confirm`,children:t.clearDataConfirmLabel}),(0,M.jsx)(`input`,{id:`clear-data-confirm`,type:`text`,autoComplete:`off`,spellCheck:!1,className:i(`w-full rounded-md border border-edge bg-surface-panel px-3 py-1.5 font-mono text-xs text-fg`,`placeholder:text-fg-subtle`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:border-edge`),placeholder:t.clearDataConfirmPhrase,value:O,onChange:e=>a({type:`patch`,patch:{clearConfirmText:e.target.value}})}),(0,M.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.clearDataConfirmHint})]}),(0,M.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,M.jsx)(p,{type:`button`,variant:`secondary`,disabled:L,onClick:()=>{a({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:t.cancel}),(0,M.jsx)(p,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:L||!q,onClick:()=>void V(),children:t.confirmClear})]})]})]})}),G?(0,M.jsx)(C,{open:k,onOpenChange:e=>{e||a({type:`patch`,patch:{uninstallDialogOpen:!1}})},children:(0,M.jsxs)(f,{children:[(0,M.jsx)(u,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,b)}),(0,M.jsxs)(g,{className:i(`fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,w,`rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,M.jsx)(d,{className:`text-base font-semibold text-fg`,children:t.uninstallConfirmTitle}),(0,M.jsx)(_,{className:`mt-2 text-sm text-fg-muted`,children:K}),(0,M.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,M.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:A,onChange:e=>a({type:`patch`,patch:{removeUserDataOnUninstall:e.target.checked}})}),(0,M.jsx)(`span`,{children:t.removeUserDataCheckbox})]}),A?(0,M.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.clearDataConfirmDesc}):null,(0,M.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,M.jsx)(p,{type:`button`,variant:`secondary`,disabled:L,onClick:()=>a({type:`patch`,patch:{uninstallDialogOpen:!1}}),children:t.cancel}),(0,M.jsx)(p,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:L,onClick:()=>void H(),children:t.confirmUninstall})]})]})]})}):null]})}async function R(){return(await c(s(`/api/migrations/status`))).payload}async function z(){await c(s(`/api/migrations/apply`),{method:`POST`,body:`{}`})}function B({messages:e}){let{data:t,error:n,isLoading:r,mutate:i}=l(`settings-migration-status`,R,{refreshInterval:0,revalidateOnFocus:!1}),[a,o]=(0,j.useState)(!1),[s,c]=(0,j.useState)(null);async function u(){o(!0),c(null);try{await z(),await i(),window.dispatchEvent(new CustomEvent(`config-reload`))}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}}if(r)return(0,M.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-4`,children:[(0,M.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,M.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.checking})]});if(n)return(0,M.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-4`,children:[(0,M.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,M.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.checkFailed})]});let d=t?.items??[],f=d.filter(e=>e.status===`conflict`||e.status===`error`),m=d.filter(e=>e.safety===`auto`&&e.status===`planned`),h=f.length>0||d.some(e=>e.safety!==`auto`);return(0,M.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-4`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,M.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:d.length===0?e.upToDate:h?e.manualAttention:e.safeRepairs.replace(`{{count}}`,String(m.length))})]}),m.length>0&&!h?(0,M.jsx)(p,{type:`button`,variant:`primary`,className:`px-3 py-1.5 text-xs`,onClick:()=>void u(),disabled:a,children:a?e.applying:e.apply}):null]}),d.length>0?(0,M.jsx)(`div`,{className:`mt-3 space-y-2`,children:d.map(e=>(0,M.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-base px-3 py-2`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,M.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.title}),(0,M.jsx)(`span`,{className:`rounded-full border border-edge px-2 py-0.5 text-[11px] uppercase tracking-wide text-fg-muted`,children:e.status})]}),(0,M.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.message})]},e.id))}):null,s?(0,M.jsx)(`p`,{className:`mt-3 text-sm text-red-500`,children:s}):null]})}function V(){let e=(0,A.c)(28),t=o(H),n;e[0]===t?n=e[1]:(n=a(t),e[0]=t,e[1]=n);let r=n.systemSettings,i=r.appManagement,s=typeof window<`u`?window.electronAPI?.system:void 0;if(!v()||!s){let t;e[2]===i.title?t=e[3]:(t=(0,M.jsx)(O,{title:i.title}),e[2]=i.title,e[3]=t);let n;e[4]===i.migrations?n=e[5]:(n=(0,M.jsx)(B,{messages:i.migrations}),e[4]=i.migrations,e[5]=n);let a;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(a=E(),e[6]=a):a=e[6];let o;e[7]===r.desktopOnlyTitle?o=e[8]:(o=(0,M.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.desktopOnlyTitle}),e[7]=r.desktopOnlyTitle,e[8]=o);let s;e[9]===r.desktopOnlyBody?s=e[10]:(s=(0,M.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r.desktopOnlyBody}),e[9]=r.desktopOnlyBody,e[10]=s);let c;e[11]!==o||e[12]!==s?(c=(0,M.jsxs)(`div`,{className:a,children:[o,s]}),e[11]=o,e[12]=s,e[13]=c):c=e[13];let l;return e[14]!==t||e[15]!==n||e[16]!==c?(l=(0,M.jsxs)(k,{gap:`gap-3`,children:[t,n,c]}),e[14]=t,e[15]=n,e[16]=c,e[17]=l):l=e[17],l}let c;e[18]===i.title?c=e[19]:(c=(0,M.jsx)(O,{title:i.title}),e[18]=i.title,e[19]=c);let l;e[20]===i.migrations?l=e[21]:(l=(0,M.jsx)(B,{messages:i.migrations}),e[20]=i.migrations,e[21]=l);let u;e[22]===i?u=e[23]:(u=(0,M.jsx)(L,{api:s,messages:i,embedded:!1}),e[22]=i,e[23]=u);let d;return e[24]!==c||e[25]!==l||e[26]!==u?(d=(0,M.jsxs)(k,{gap:`gap-6`,children:[c,l,u]}),e[24]=c,e[25]=l,e[26]=u,e[27]=d):d=e[27],d}function H(e){return e.language}export{V as AppManagementSettingsPanel};
|
|
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-B5O4OIEo.js";import{n as o}from"./locale-store-Ba72bFmP.js";import{i as s,n as c}from"./fetch-ovkvM8KQ.js";import{i as l}from"./vendor-swr-BIWyz7Rc.js";import{Aa as u,Ba as d,Gs as f,Ms as p,Pa as m,Wo as h,aa as g,ba as _,ca as v,ia as y,na as b,oa as x,ra as S,ta as C,ut as w,ya as T}from"./index-DdqSO9R2.js";import{r as E,t as D}from"./settings-form-section-Dg6LBbcr.js";import{n as O,t as k}from"./settings-page-layout-BX4T-OLF.js";var A=n(),j=e(t(),1),M=r();function N(e,t){return e==null?t:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function P(e,t){return e===`PENDING_UPDATE`?t.pendingUpdate??t.generic:e===`UNINSTALLER_NOT_FOUND`?t.uninstallerNotFound??t.generic:e===`NOT_PACKAGED`?t.notPackaged??t.generic:t.generic}function F(e,t){if(e.platform===`darwin`)return t.uninstallDescDarwin;if(e.platform===`win32`)return t.uninstallDescWin;if(e.platform===`linux`){if(e.linuxPackageKind===`appimage`)return t.uninstallDescLinuxAppImage;if(e.linuxPackageKind===`deb`){let n=e.linuxDebPackageName??`xopc`;return t.uninstallDescLinuxDeb.replace(/\{\{package\}\}/g,n)}return t.uninstallDescLinuxUnknown}return t.uninstallDescLinuxUnknown}var I={info:null,loadError:null,actionError:null,copiedField:null,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``,uninstallDialogOpen:!1,removeUserDataOnUninstall:!1,busy:!1};function L({api:e,messages:t,embedded:n=!0}){let[r,a]=(0,j.useReducer)(w,I),{info:o,loadError:s,actionError:c,copiedField:l,clearDialogOpen:v,clearConfirmChecked:E,clearConfirmText:O,uninstallDialogOpen:k,removeUserDataOnUninstall:A,busy:L}=r,R=(0,j.useCallback)(async()=>{if(e?.getUninstallInfo){a({type:`patch`,patch:{loadError:null}});try{a({type:`patch`,patch:{info:await e.getUninstallInfo()}})}catch(e){a({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}}},[e]);(0,j.useEffect)(()=>{R()},[R]);let z=async(e,n)=>{if(await u(e)){a({type:`patch`,patch:{actionError:null,copiedField:n}}),window.setTimeout(()=>a({type:`patch`,patch:{copiedField:null}}),2e3);return}a({type:`patch`,patch:{actionError:t.copyFailed}})},B=async e=>{let t=window.electronAPI?.shell;if(!t)return;let n=await t.openPath(e);n.error&&a({type:`patch`,patch:{actionError:n.error}})},V=async()=>{if(e?.clearUserData){a({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.clearUserData();n.ok||a({type:`patch`,patch:{actionError:P(n.error,t.errors)}})}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{a({type:`patch`,patch:{busy:!1,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})}}},H=async()=>{if(e?.uninstallApp){a({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.uninstallApp({removeUserData:A});n.ok||a({type:`patch`,patch:{actionError:P(n.error,t.errors)}})}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{a({type:`patch`,patch:{busy:!1,uninstallDialogOpen:!1}})}}};if(s)return(0,M.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:s});if(!o)return(0,M.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.loading});let U=!o.packaged,W=L||o.pendingUpdate||U,G=!U&&o.uninstallMode!==`unsupported`,K=F(o,t),q=E&&O.trim()===t.clearDataConfirmPhrase;return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(D,{children:[n?(0,M.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,M.jsx)(h,{className:`size-4 text-accent`,strokeWidth:1.75}),t.title]}):null,c?(0,M.jsx)(`p`,{className:`mb-3 text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:c}):null,U?(0,M.jsxs)(`div`,{className:`mb-4 rounded-xl border border-edge-subtle bg-surface-panel/60 px-3 py-2.5`,children:[(0,M.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.devOnlyTitle}),(0,M.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.devOnlyBody})]}):null,o.pendingUpdate?(0,M.jsx)(`p`,{className:`mb-3 rounded-xl border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-800 dark:text-amber-200`,children:t.pendingUpdateBlocked}):null,o.hasSeparateCliData&&o.cliDataPath?(0,M.jsxs)(`div`,{className:`mb-4 rounded-xl border border-amber-500/30 bg-amber-500/10 px-3 py-2.5`,children:[(0,M.jsx)(`p`,{className:`text-xs text-amber-800 dark:text-amber-200`,children:t.cliDataWarning}),(0,M.jsxs)(`button`,{type:`button`,className:i(`mt-2 inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover`,m.press),onClick:()=>void B(o.cliDataPath),children:[(0,M.jsx)(p,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t.openCliData]})]}):null,(0,M.jsxs)(`dl`,{className:`space-y-3 text-sm`,children:[(0,M.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-panel/60 p-3`,children:[(0,M.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.appPath}),(0,M.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,M.jsx)(`code`,{className:`break-all text-xs text-fg`,children:o.appPath}),(0,M.jsxs)(`button`,{type:`button`,className:i(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,m.press),onClick:()=>void z(o.appPath,`app`),children:[(0,M.jsx)(f,{className:`size-3`,"aria-hidden":!0}),l===`app`?t.copied:t.copyPath]})]})]}),(0,M.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-panel/60 p-3`,children:[(0,M.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.dataPath}),(0,M.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,M.jsx)(`code`,{className:`break-all text-xs text-fg`,children:o.userDataPath}),(0,M.jsxs)(`button`,{type:`button`,className:i(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,m.press),onClick:()=>void z(o.userDataPath,`data`),children:[(0,M.jsx)(f,{className:`size-3`,"aria-hidden":!0}),l===`data`?t.copied:t.copyPath]})]}),(0,M.jsxs)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:[t.dataSize,`: `,N(o.userDataSizeBytes,t.dataSizeUnknown)]})]})]}),(0,M.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl border border-edge-subtle bg-surface-panel/60 p-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.clearData}),(0,M.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:t.clearDataDesc})]}),(0,M.jsx)(`button`,{type:`button`,disabled:W,className:i(`inline-flex shrink-0 items-center justify-center rounded-lg border border-danger/40 bg-danger px-3 py-1.5 text-sm font-medium text-white hover:bg-danger/90 disabled:opacity-50`,m.press),onClick:()=>{a({type:`patch`,patch:{clearConfirmChecked:!1,clearConfirmText:``,clearDialogOpen:!0}})},children:t.clearData})]}),G?(0,M.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl border border-edge-subtle bg-surface-panel/60 p-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.uninstall}),(0,M.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:K})]}),(0,M.jsx)(`button`,{type:`button`,disabled:W,className:i(`inline-flex shrink-0 items-center justify-center rounded-lg border border-edge bg-surface-base px-3 py-1.5 text-sm font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,m.press),onClick:()=>{a({type:`patch`,patch:{removeUserDataOnUninstall:!1,uninstallDialogOpen:!0}})},children:t.uninstall})]}):null]})]}),(0,M.jsx)(g,{open:v,onOpenChange:e=>{e||a({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:(0,M.jsxs)(y,{children:[(0,M.jsx)(S,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,_)}),(0,M.jsxs)(C,{className:i(`fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,T,`rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,M.jsx)(x,{className:`text-base font-semibold text-fg`,children:t.clearDataConfirmTitle}),(0,M.jsx)(b,{className:`mt-2 text-sm text-fg-muted`,children:t.clearDataConfirmDesc}),(0,M.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,M.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:E,onChange:e=>a({type:`patch`,patch:{clearConfirmChecked:e.target.checked}})}),(0,M.jsx)(`span`,{children:t.clearDataConfirmCheckbox})]}),(0,M.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,M.jsx)(`label`,{className:`block text-sm font-medium text-fg`,htmlFor:`clear-data-confirm`,children:t.clearDataConfirmLabel}),(0,M.jsx)(`input`,{id:`clear-data-confirm`,type:`text`,autoComplete:`off`,spellCheck:!1,className:i(`w-full rounded-md border border-edge bg-surface-panel px-3 py-1.5 font-mono text-xs text-fg`,`placeholder:text-fg-subtle`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:border-edge`),placeholder:t.clearDataConfirmPhrase,value:O,onChange:e=>a({type:`patch`,patch:{clearConfirmText:e.target.value}})}),(0,M.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.clearDataConfirmHint})]}),(0,M.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,M.jsx)(d,{type:`button`,variant:`secondary`,disabled:L,onClick:()=>{a({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:t.cancel}),(0,M.jsx)(d,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:L||!q,onClick:()=>void V(),children:t.confirmClear})]})]})]})}),G?(0,M.jsx)(g,{open:k,onOpenChange:e=>{e||a({type:`patch`,patch:{uninstallDialogOpen:!1}})},children:(0,M.jsxs)(y,{children:[(0,M.jsx)(S,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,_)}),(0,M.jsxs)(C,{className:i(`fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,T,`rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,M.jsx)(x,{className:`text-base font-semibold text-fg`,children:t.uninstallConfirmTitle}),(0,M.jsx)(b,{className:`mt-2 text-sm text-fg-muted`,children:K}),(0,M.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,M.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:A,onChange:e=>a({type:`patch`,patch:{removeUserDataOnUninstall:e.target.checked}})}),(0,M.jsx)(`span`,{children:t.removeUserDataCheckbox})]}),A?(0,M.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.clearDataConfirmDesc}):null,(0,M.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,M.jsx)(d,{type:`button`,variant:`secondary`,disabled:L,onClick:()=>a({type:`patch`,patch:{uninstallDialogOpen:!1}}),children:t.cancel}),(0,M.jsx)(d,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:L,onClick:()=>void H(),children:t.confirmUninstall})]})]})]})}):null]})}async function R(){return(await c(s(`/api/migrations/status`))).payload}async function z(){await c(s(`/api/migrations/apply`),{method:`POST`,body:`{}`})}function B({messages:e}){let{data:t,error:n,isLoading:r,mutate:i}=l(`settings-migration-status`,R,{refreshInterval:0,revalidateOnFocus:!1}),[a,o]=(0,j.useState)(!1),[s,c]=(0,j.useState)(null);async function u(){o(!0),c(null);try{await z(),await i(),window.dispatchEvent(new CustomEvent(`config-reload`))}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}}if(r)return(0,M.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-4`,children:[(0,M.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,M.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.checking})]});if(n)return(0,M.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-4`,children:[(0,M.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,M.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.checkFailed})]});let f=t?.items??[],p=f.filter(e=>e.status===`conflict`||e.status===`error`),m=f.filter(e=>e.safety===`auto`&&e.status===`planned`),h=p.length>0||f.some(e=>e.safety!==`auto`);return(0,M.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-4`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,M.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:f.length===0?e.upToDate:h?e.manualAttention:e.safeRepairs.replace(`{{count}}`,String(m.length))})]}),m.length>0&&!h?(0,M.jsx)(d,{type:`button`,variant:`primary`,className:`px-3 py-1.5 text-xs`,onClick:()=>void u(),disabled:a,children:a?e.applying:e.apply}):null]}),f.length>0?(0,M.jsx)(`div`,{className:`mt-3 space-y-2`,children:f.map(e=>(0,M.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-base px-3 py-2`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,M.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.title}),(0,M.jsx)(`span`,{className:`rounded-full border border-edge px-2 py-0.5 text-[11px] uppercase tracking-wide text-fg-muted`,children:e.status})]}),(0,M.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.message})]},e.id))}):null,s?(0,M.jsx)(`p`,{className:`mt-3 text-sm text-red-500`,children:s}):null]})}function V(){let e=(0,A.c)(28),t=o(H),n;e[0]===t?n=e[1]:(n=a(t),e[0]=t,e[1]=n);let r=n.systemSettings,i=r.appManagement,s=typeof window<`u`?window.electronAPI?.system:void 0;if(!v()||!s){let t;e[2]===i.title?t=e[3]:(t=(0,M.jsx)(O,{title:i.title}),e[2]=i.title,e[3]=t);let n;e[4]===i.migrations?n=e[5]:(n=(0,M.jsx)(B,{messages:i.migrations}),e[4]=i.migrations,e[5]=n);let a;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(a=E(),e[6]=a):a=e[6];let o;e[7]===r.desktopOnlyTitle?o=e[8]:(o=(0,M.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.desktopOnlyTitle}),e[7]=r.desktopOnlyTitle,e[8]=o);let s;e[9]===r.desktopOnlyBody?s=e[10]:(s=(0,M.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r.desktopOnlyBody}),e[9]=r.desktopOnlyBody,e[10]=s);let c;e[11]!==o||e[12]!==s?(c=(0,M.jsxs)(`div`,{className:a,children:[o,s]}),e[11]=o,e[12]=s,e[13]=c):c=e[13];let l;return e[14]!==t||e[15]!==n||e[16]!==c?(l=(0,M.jsxs)(k,{gap:`gap-3`,children:[t,n,c]}),e[14]=t,e[15]=n,e[16]=c,e[17]=l):l=e[17],l}let c;e[18]===i.title?c=e[19]:(c=(0,M.jsx)(O,{title:i.title}),e[18]=i.title,e[19]=c);let l;e[20]===i.migrations?l=e[21]:(l=(0,M.jsx)(B,{messages:i.migrations}),e[20]=i.migrations,e[21]=l);let u;e[22]===i?u=e[23]:(u=(0,M.jsx)(L,{api:s,messages:i,embedded:!1}),e[22]=i,e[23]=u);let d;return e[24]!==c||e[25]!==l||e[26]!==u?(d=(0,M.jsxs)(k,{gap:`gap-6`,children:[c,l,u]}),e[24]=c,e[25]=l,e[26]=u,e[27]=d):d=e[27],d}function H(e){return e.language}export{V as AppManagementSettingsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-BQ_8x0bT.js";import{t as r}from"./messages-
|
|
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-B5O4OIEo.js";import{n as i}from"./locale-store-Ba72bFmP.js";import{i as a}from"./theme-store-Bt6vAkSB.js";import{Pa as o,W as s,ma as c}from"./index-DdqSO9R2.js";import{t as l}from"./settings-advanced-gate-DrNNoSqE.js";import{n as u,t as d}from"./settings-page-layout-BX4T-OLF.js";var f=e(),p=t();function m(){return n(`rounded-xl border border-edge-subtle bg-surface-base px-4 py-1 sm:px-5`)}var h={default:{light:{canvas:`#ffffff`,panel:`#fafafa`,accent:`#3a6bff`,fg:`#111111`,muted:`#ececec`},dark:{canvas:`#0a0a0a`,panel:`#121212`,accent:`#3a6bff`,fg:`#f5f5f5`,muted:`#222222`}},emerald:{light:{canvas:`#f0fdf4`,panel:`#ffffff`,accent:`#059669`,fg:`#052e16`,muted:`#86efac`},dark:{canvas:`#000000`,panel:`#0a0a0a`,accent:`#10b981`,fg:`#d1fae5`,muted:`#134e2a`}},mono:{light:{canvas:`#ffffff`,panel:`#f5f5f5`,accent:`#111111`,fg:`#111111`,muted:`#e5e7eb`},dark:{canvas:`#101010`,panel:`#1a1a1a`,accent:`#737373`,fg:`#fafafa`,muted:`#333333`}},clay:{light:{canvas:`#fffaf0`,panel:`#ffffff`,accent:`#1a3a3a`,fg:`#0a0a0a`,muted:`#e5e5e5`},dark:{canvas:`#0a1a1a`,panel:`#1a2a2a`,accent:`#ffb084`,fg:`#fffaf0`,muted:`#2a3a3a`}}};function g(e){let t=(0,f.c)(24),{canvas:n,panel:r,accent:i,fg:a,muted:o}=e,s;t[0]===n?s=t[1]:(s={backgroundColor:n},t[0]=n,t[1]=s);let c;t[2]!==o||t[3]!==r?(c={backgroundColor:r,borderColor:o},t[2]=o,t[3]=r,t[4]=c):c=t[4];let l;t[5]===i?l=t[6]:(l=(0,p.jsx)(`div`,{className:`size-1 shrink-0 rounded-full`,style:{backgroundColor:i}}),t[5]=i,t[6]=l);let u;t[7]===a?u=t[8]:(u=(0,p.jsx)(`div`,{className:`h-1 min-w-0 flex-1 rounded-full`,style:{backgroundColor:a,opacity:.85}}),t[7]=a,t[8]=u);let d;t[9]!==l||t[10]!==u?(d=(0,p.jsxs)(`div`,{className:`flex items-center gap-1`,children:[l,u]}),t[9]=l,t[10]=u,t[11]=d):d=t[11];let m;t[12]===o?m=t[13]:(m=(0,p.jsx)(`div`,{className:`h-1 w-2/3 max-w-[70%] rounded-full`,style:{backgroundColor:o}}),t[12]=o,t[13]=m);let h;t[14]===o?h=t[15]:(h=(0,p.jsx)(`div`,{className:`size-1/2 max-w-[55%] rounded-full`,style:{backgroundColor:o}}),t[14]=o,t[15]=h);let g;t[16]!==c||t[17]!==d||t[18]!==m||t[19]!==h?(g=(0,p.jsxs)(`div`,{className:`flex flex-col gap-0.5 rounded-sm border p-1`,style:c,children:[d,m,h]}),t[16]=c,t[17]=d,t[18]=m,t[19]=h,t[20]=g):g=t[20];let _;return t[21]!==s||t[22]!==g?(_=(0,p.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col justify-center gap-1 p-1.5`,style:s,children:g}),t[21]=s,t[22]=g,t[23]=_):_=t[23],_}function _(e){let t=(0,f.c)(8),{scheme:n}=e,{light:r,dark:i}=h[n],a;t[0]===r?a=t[1]:(a=(0,p.jsx)(g,{...r}),t[0]=r,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,p.jsx)(`div`,{className:`w-px shrink-0 bg-black/12 dark:bg-white/12`,"aria-hidden":!0}),t[2]=o):o=t[2];let s;t[3]===i?s=t[4]:(s=(0,p.jsx)(g,{...i}),t[3]=i,t[4]=s);let c;return t[5]!==a||t[6]!==s?(c=(0,p.jsxs)(`div`,{className:`flex h-11 w-full overflow-hidden rounded-md border border-edge-subtle`,children:[a,o,s]}),t[5]=a,t[6]=s,t[7]=c):c=t[7],c}var v=[{value:`default`,labelKey:`colorSchemeDefault`},{value:`emerald`,labelKey:`colorSchemeLightGreen`},{value:`mono`,labelKey:`colorSchemeModernMono`},{value:`clay`,labelKey:`colorSchemeClay`}];function y(){let e=(0,f.c)(18),t=i(S),s;e[0]===t?s=e[1]:(s=r(t),e[0]=t,e[1]=s);let c=s.appearanceSettings,l=a(x),u=a(b),d;e[2]===c.colorSchemeTitle?d=e[3]:(d=(0,p.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:c.colorSchemeTitle}),e[2]=c.colorSchemeTitle,e[3]=d);let m;e[4]===c.colorSchemeDescription?m=e[5]:(m=(0,p.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:c.colorSchemeDescription}),e[4]=c.colorSchemeDescription,e[5]=m);let h;e[6]!==d||e[7]!==m?(h=(0,p.jsxs)(`div`,{className:`min-w-0`,children:[d,m]}),e[6]=d,e[7]=m,e[8]=h):h=e[8];let g;e[9]!==c||e[10]!==l||e[11]!==u?(g=v.map(e=>{let{value:t,labelKey:r}=e,i=l===t;return(0,p.jsxs)(`button`,{type:`button`,"aria-pressed":i,onClick:()=>u(t),className:n(`flex flex-col gap-2 rounded-xl border-2 p-2.5 text-left transition-[border-color,box-shadow,transform] duration-150`,o.pressCard,i?`border-accent shadow-[0_0_0_1px_var(--color-accent)]`:`border-edge-subtle hover:border-edge`),children:[(0,p.jsx)(_,{scheme:t}),(0,p.jsx)(`span`,{className:n(`text-xs font-medium leading-none`,i?`text-accent-fg`:`text-fg-muted`),children:c[r]})]},t)}),e[9]=c,e[10]=l,e[11]=u,e[12]=g):g=e[12];let y;e[13]===g?y=e[14]:(y=(0,p.jsx)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,children:g}),e[13]=g,e[14]=y);let C;return e[15]!==h||e[16]!==y?(C=(0,p.jsxs)(`div`,{className:`flex flex-col gap-2 border-b border-edge-subtle py-3.5 last:border-b-0 sm:py-4`,children:[h,y]}),e[15]=h,e[16]=y,e[17]=C):C=e[17],C}function b(e){return e.setColorScheme}function x(e){return e.colorScheme}function S(e){return e.language}function C(){let e=(0,f.c)(27),t=i(E),n;e[0]===t?n=e[1]:(n=r(t),e[0]=t,e[1]=n);let a=n.appearanceSettings,o=s(T),c=s(w),l;e[2]===a.developerGroupTitle?l=e[3]:(l=(0,p.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:a.developerGroupTitle}),e[2]=a.developerGroupTitle,e[3]=l);let u;e[4]===a.developerGroupDescription?u=e[5]:(u=(0,p.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:a.developerGroupDescription}),e[4]=a.developerGroupDescription,e[5]=u);let d;e[6]!==l||e[7]!==u?(d=(0,p.jsxs)(`div`,{className:`min-w-0`,children:[l,u]}),e[6]=l,e[7]=u,e[8]=d):d=e[8];let m;e[9]===a.showRawToolDataTitle?m=e[10]:(m=(0,p.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:a.showRawToolDataTitle}),e[9]=a.showRawToolDataTitle,e[10]=m);let h;e[11]===a.showRawToolDataDescription?h=e[12]:(h=(0,p.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.showRawToolDataDescription}),e[11]=a.showRawToolDataDescription,e[12]=h);let g;e[13]!==m||e[14]!==h?(g=(0,p.jsxs)(`div`,{className:`min-w-0`,children:[m,h]}),e[13]=m,e[14]=h,e[15]=g):g=e[15];let _;e[16]===c?_=e[17]:(_=e=>c(e.target.checked),e[16]=c,e[17]=_);let v;e[18]!==o||e[19]!==_?(v=(0,p.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:o,onChange:_}),e[18]=o,e[19]=_,e[20]=v):v=e[20];let y;e[21]!==g||e[22]!==v?(y=(0,p.jsxs)(`label`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[g,v]}),e[21]=g,e[22]=v,e[23]=y):y=e[23];let b;return e[24]!==d||e[25]!==y?(b=(0,p.jsxs)(`div`,{className:`flex flex-col gap-2 py-3.5 sm:py-4`,children:[d,y]}),e[24]=d,e[25]=y,e[26]=b):b=e[26],b}function w(e){return e.setShowRawToolData}function T(e){return e.showRawToolData}function E(e){return e.language}function D(){let e=(0,f.c)(29),t=i(O),n;e[0]===t?n=e[1]:(n=r(t),e[0]=t,e[1]=n);let a=n.appearanceSettings,o;e[2]!==a.pageTitle||e[3]!==a.subtitle?(o=(0,p.jsx)(u,{title:a.pageTitle,subtitle:a.subtitle}),e[2]=a.pageTitle,e[3]=a.subtitle,e[4]=o):o=e[4];let s;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=m(),e[5]=s):s=e[5];let h;e[6]===a.languageTitle?h=e[7]:(h=(0,p.jsx)(`h2`,{id:`pref-language-heading`,className:`sr-only`,children:a.languageTitle}),e[6]=a.languageTitle,e[7]=h);let g;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,p.jsx)(c,{variant:`page`,sections:[`language`]}),e[8]=g):g=e[8];let _;e[9]===h?_=e[10]:(_=(0,p.jsxs)(`section`,{className:s,"aria-labelledby":`pref-language-heading`,children:[h,g]}),e[9]=h,e[10]=_);let v;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(v=m(),e[11]=v):v=e[11];let b;e[12]===a.themeTitle?b=e[13]:(b=(0,p.jsx)(`h2`,{id:`pref-appearance-heading`,className:`sr-only`,children:a.themeTitle}),e[12]=a.themeTitle,e[13]=b);let x,S;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,p.jsx)(c,{variant:`page`,sections:[`theme`,`font`]}),S=(0,p.jsx)(y,{}),e[14]=x,e[15]=S):(x=e[14],S=e[15]);let w;e[16]===b?w=e[17]:(w=(0,p.jsxs)(`section`,{className:v,"aria-labelledby":`pref-appearance-heading`,children:[b,x,S]}),e[16]=b,e[17]=w);let T;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(T=m(),e[18]=T):T=e[18];let E;e[19]===a.developerGroupTitle?E=e[20]:(E=(0,p.jsx)(`h2`,{id:`pref-developer-heading`,className:`sr-only`,children:a.developerGroupTitle}),e[19]=a.developerGroupTitle,e[20]=E);let D;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,p.jsx)(C,{}),e[21]=D):D=e[21];let k;e[22]===E?k=e[23]:(k=(0,p.jsx)(l,{children:(0,p.jsxs)(`section`,{className:T,"aria-labelledby":`pref-developer-heading`,children:[E,D]})}),e[22]=E,e[23]=k);let A;return e[24]!==o||e[25]!==w||e[26]!==k||e[27]!==_?(A=(0,p.jsxs)(d,{gap:`gap-6`,children:[o,_,w,k]}),e[24]=o,e[25]=w,e[26]=k,e[27]=_,e[28]=A):A=e[28],A}function O(e){return e.language}export{D as AppearanceSettingsPanel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-BQ_8x0bT.js";import{t as a}from"./messages-B5O4OIEo.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-ovkvM8KQ.js";import{a as d,i as f}from"./vendor-swr-BIWyz7Rc.js";import{$a as p,An as m,Ba as h,Fi as g,H as _,Ha as v,Ic as y,Ii as b,Li as x,Lr as S,Pi as C,Po as w,Ri as T,So as E,Tc as D,Wo as O,aa as k,ia as A,jc as j,lc as M,mc as N,na as P,ns as F,oa as I,ra as L,sa as R,ta as z,ut as B,vo as V,zs as H}from"./index-DdqSO9R2.js";var U=e(t(),1),W=n();function G(e){return e===`builtin`||e===`user`?e:`marketplace`}async function K(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 K(t));let n=await t.json();if(!n.ok||!n.payload?.id)throw Error(n.error??`Invalid response`);return n.payload}async function q(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 K(t));let n=await t.json();if(!n.ok||!n.payload?.extensionId)throw Error(n.error??`Invalid response`);return n.payload}async function J(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 K(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error?.message??`Invalid response`);return n.payload}async function Y(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 K(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error??`Invalid response`);return n.payload}var X=r();function Z(e,t){let n=e.find(e=>e.id===t);return n?n.source===`bundled`?`bundled`:`user`:`absent`}var te={q:``,debounced:``,detailPkg:null,rowBusy:null,actionError:null,restartHint:null};function ne({className:e}){let t=a(o(e=>e.language)).appsPage,n=s(e=>!!e.token),r=g(),{mutate:u}=d(),[h,_]=(0,U.useReducer)(B,te),{q:v,debounced:y,detailPkg:b,rowBusy:x,actionError:S,restartHint:C}=h,w=n?`marketplace-${y}`:null;(0,U.useEffect)(()=>{let e=window.setTimeout(()=>_({type:`patch`,patch:{debounced:v.trim()}}),300);return()=>window.clearTimeout(e)},[v]);let{data:T,isLoading:D,error:k}=f(w,async()=>l(y.length>0?c(`/api/marketplace?q=${encodeURIComponent(y)}`):c(`/api/marketplace`)),{revalidateOnFocus:!1}),A=(0,U.useCallback)(()=>{u(`gateway-extensions-list`),m()},[u]),j=(0,U.useCallback)(async(e,n)=>{_({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let r=await q({name:e,overwrite:n});A(),r.requiresGatewayRestart&&_({type:`patch`,patch:{restartHint:t.marketplaceRestartHint}})}catch(e){throw _({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.marketplaceInstallFailed}}),e}finally{_({type:`patch`,patch:{rowBusy:null}})}},[t.marketplaceInstallFailed,t.marketplaceRestartHint,A]),N=(0,U.useCallback)(async e=>{_({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let n=await Y(e);A(),n.requiresGatewayRestart&&_({type:`patch`,patch:{restartHint:t.marketplaceRestartHint}})}catch(e){throw _({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.marketplaceUninstallFailed}}),e}finally{_({type:`patch`,patch:{rowBusy:null}})}},[t.marketplaceRestartHint,t.marketplaceUninstallFailed,A]),P=T?.extensions??[];return(0,X.jsxs)(`div`,{className:i(`flex flex-col gap-4`,e),children:[(0,X.jsxs)(`div`,{className:`relative`,children:[(0,X.jsx)(E,{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,X.jsx)(`input`,{type:`search`,value:v,onChange:e=>_({type:`patch`,patch:{q:e.target.value}}),placeholder:t.marketplaceSearchPlaceholder,className:`ui-input h-10 w-full rounded-lg border border-edge bg-surface-base pl-9 pr-3 text-sm text-fg placeholder:text-fg-muted`})]}),k?(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:k instanceof Error?k.message:t.marketplaceLoadFailed}):null,S?(0,X.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:S}):null,C?(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:C}):null,D&&!T?(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:`…`}):(0,X.jsx)(`ul`,{className:`flex flex-col gap-3`,children:P.length===0?(0,X.jsx)(`li`,{className:`text-sm text-fg-muted`,children:t.marketplaceEmpty}):P.map(e=>{let n=Z(r,e.id),a=x===e.id;return(0,X.jsx)(`li`,{className:`list-none`,children:(0,X.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-label":`${e.name}, ${t.marketplaceDetailTitle}`,onClick:()=>_({type:`patch`,patch:{detailPkg:e.id}}),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),_({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,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`h3`,{className:`font-semibold text-fg`,children:e.name}),e.verified?(0,X.jsx)(M,{className:`size-4 shrink-0 text-emerald-600 dark:text-emerald-400`,strokeWidth:1.75,"aria-label":`Verified`}):null,e.version?(0,X.jsx)(`span`,{className:`text-xs text-fg-muted`,children:e.version}):null]}),e.description?(0,X.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm text-fg-muted`,children:e.description}):null,(0,X.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:(e.categories??[]).map(e=>(0,X.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,X.jsxs)(`p`,{className:`mt-2 flex items-center gap-1.5 text-xs text-fg-muted`,children:[(0,X.jsx)(O,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),(0,X.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:e.npmPackage})]})]}),(0,X.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,X.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,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`text-[11px] font-medium text-fg-muted`,children:t.marketplaceInstalled}),(0,X.jsxs)(`button`,{type:`button`,disabled:a,onClick:()=>{window.confirm(t.marketplaceUninstallConfirm)&&N(e.id).catch(()=>{})},className:i(`inline-flex items-center justify-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-xs font-medium text-fg`,`transition-colors active:scale-[0.98] active:bg-surface-hover/80`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`disabled:pointer-events-none disabled:opacity-50`),children:[a?(0,X.jsx)(F,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,X.jsx)(p,{className:`size-3.5`,strokeWidth:2,"aria-hidden":!0}),t.marketplaceUninstall]})]}):(0,X.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,X.jsx)(F,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):null,t.marketplaceInstall]})})]})},e.id)})}),b?(0,X.jsx)(re,{packageName:b,copy:t,extensions:r,onClose:()=>_({type:`patch`,patch:{detailPkg:null}}),onInstall:j,onUninstall:N}):null]})}function re(e){let t=(0,W.c)(61),{packageName:n,copy:r,extensions:a,onClose:o,onInstall:c,onUninstall:l}=e,[u,d]=(0,U.useState)(!1),m=s(se)?`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:_,error:y,isLoading:b}=f(m,h,g),x;t[3]!==a||t[4]!==n?(x=Z(a,n),t[3]=a,t[4]=n,t[5]=x):x=t[5];let C=x,w=C===`user`,T;t[6]!==r.marketplaceNoReadme||t[7]!==_?(T=_?.readme?.trim()||(_?.description?.trim()?`### ${_.name}\n\n${_.description}`:`*${r.marketplaceNoReadme}*`),t[6]=r.marketplaceNoReadme,t[7]=_,t[8]=T):T=t[8];let E=T,O;t[9]===o?O=t[10]:(O=e=>!e&&o(),t[9]=o,t[10]=O);let M;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,X.jsx)(L,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[11]=M):M=t[11];let N;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,X.jsx)(D,{className:`size-5`}),t[12]=N):N=t[12];let P;t[13]!==r.detailBack||t[14]!==o?(P=(0,X.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:N}),t[13]=r.detailBack,t[14]=o,t[15]=P):P=t[15];let R;t[16]===r.marketplaceDetailTitle?R=t[17]:(R=(0,X.jsx)(I,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:r.marketplaceDetailTitle}),t[16]=r.marketplaceDetailTitle,t[17]=R);let B;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,X.jsx)(v,{className:`size-5`}),t[18]=B):B=t[18];let V;t[19]!==r.detailClose||t[20]!==o?(V=(0,X.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 H;t[22]!==V||t[23]!==P||t[24]!==R?(H=(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[P,R,V]}),t[22]=V,t[23]=P,t[24]=R,t[25]=H):H=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]!==_||t[32]!==y||t[33]!==b||t[34]!==E?(G=b&&!_?(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:`…`}):y?(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r.marketplaceDetailLoadFailed}):_?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:_.name}),(0,X.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:(0,X.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:_.id})}),(0,X.jsxs)(`dl`,{className:`mt-3 grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceAuthor}),(0,X.jsx)(`dd`,{children:_.author.username})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceVersion}),(0,X.jsx)(`dd`,{children:_.latestVersion.version})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceDownloads}),(0,X.jsx)(`dd`,{children:_.downloads})]})]}),_.readme?.trim()?(0,X.jsx)(`h4`,{className:`mb-2 mt-6 text-sm font-semibold text-fg`,children:r.marketplaceDetailReadmeHeading}):null,(0,X.jsx)(`div`,{className:`markdown-content min-w-0 break-words text-sm`,children:(0,X.jsx)(S,{content:E})})]}):null,t[26]=r.marketplaceAuthor,t[27]=r.marketplaceDetailLoadFailed,t[28]=r.marketplaceDetailReadmeHeading,t[29]=r.marketplaceDownloads,t[30]=r.marketplaceVersion,t[31]=_,t[32]=y,t[33]=b,t[34]=E,t[35]=G):G=t[35];let K;t[36]===G?K=t[37]:(K=(0,X.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]!==_||t[47]!==C||t[48]!==o||t[49]!==c||t[50]!==l||t[51]!==n||t[52]!==w?(q=_?(0,X.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-2 border-t border-edge-subtle px-5 py-4`,children:C===`bundled`?(0,X.jsxs)(`div`,{className:`flex w-full flex-col items-stretch gap-2`,children:[(0,X.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:r.marketplaceBuiltinManageHint}),(0,X.jsx)(j,{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,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`button`,{type:`button`,disabled:u,onClick:()=>{w&&!window.confirm(r.marketplaceReinstallConfirm)||(d(!0),c(n,w).catch(ae).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,X.jsx)(F,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,w?r.marketplaceReinstall:r.marketplaceInstall]}),w?(0,X.jsxs)(`button`,{type:`button`,disabled:u,onClick:()=>{window.confirm(r.marketplaceUninstallConfirm)&&(d(!0),l(n).then(()=>o()).catch(ie).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,X.jsx)(p,{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]=_,t[47]=C,t[48]=o,t[49]=c,t[50]=l,t[51]=n,t[52]=w,t[53]=q):q=t[53];let J;t[54]!==H||t[55]!==K||t[56]!==q?(J=(0,X.jsxs)(A,{children:[M,(0,X.jsxs)(z,{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:oe,children:[H,K,q]})]}),t[54]=H,t[55]=K,t[56]=q,t[57]=J):J=t[57];let Y;return t[58]!==J||t[59]!==O?(Y=(0,X.jsx)(k,{defaultOpen:!0,onOpenChange:O,children:J}),t[58]=J,t[59]=O,t[60]=Y):Y=t[60],Y}function ie(){}function ae(){}function oe(e){return e.preventDefault()}function se(e){return!!e.token}function ce(){let e=o(e=>e.language),t=a(e),n=R(e=>e.setPageHeader),r=R(e=>e.clearPageHeader),i=g(),s=b(),[c,l]=y(),u=G(c.get(`tab`)),d=c.get(`q`)??``,[f,p]=(0,U.useState)(u),[m,h]=(0,U.useState)(d),[v,x]=(0,U.useState)(null),S=c.toString(),C=(0,U.useRef)(S);if(C.current!==S){C.current=S;let e=G(c.get(`tab`)),t=c.get(`q`)??``;p(t=>t===e?t:e),h(e=>e===t?e:t)}(0,U.useEffect)(()=>{l(e=>{let t=new URLSearchParams(e),n=m.trim();return n?t.set(`q`,n):t.delete(`q`),f===`marketplace`?t.delete(`tab`):t.set(`tab`,f),t.toString()===e.toString()?e:t},{replace:!0})},[f,m,l]);let w=(0,U.useMemo)(()=>i.filter(e=>e.source===`bundled`),[i]),T=(0,U.useMemo)(()=>i.filter(e=>e.source!==`bundled`),[i]),D=f===`builtin`?w:T,O=(0,U.useMemo)(()=>{let t=m.trim().toLowerCase(),n=D;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)},[D,m,e]);if((0,U.useEffect)(()=>{x(e=>{if(!e)return e;let t=i.find(t=>t.id===e.id);return t?Q(e)===Q(t)&&e.active===t.active?e:t:null})},[i]),(0,U.useLayoutEffect)(()=>(n({startExtra:null,main:(0,X.jsx)(`div`,{className:`min-w-0`,children:(0,X.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.appsPage.title})}),end:null}),()=>r()),[r,t.appsPage.title,n]),s&&f!==`marketplace`)return(0,X.jsx)(me,{});let k=f!==`marketplace`&&D.length>0;return(0,X.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:[(0,X.jsxs)(`div`,{className:`w-full px-3 py-8 sm:px-5 xl:px-6`,children:[(0,X.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,X.jsx)(_,{items:[{id:`marketplace`,label:t.appsPage.tabMarketplace},{id:`builtin`,label:t.appsPage.tabBuiltin,count:w.length},{id:`user`,label:t.appsPage.tabUser,count:T.length}],activeTab:f,onChange:p,ariaLabel:t.appsPage.appsNavAria,tabIdPrefix:`apps-tab`,panelIdPrefix:`apps-panel`,className:`flex-wrap`}),k?(0,X.jsxs)(`div`,{className:`relative w-full min-w-0 sm:max-w-xs`,children:[(0,X.jsx)(E,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,"aria-hidden":!0}),(0,X.jsx)(`input`,{type:`search`,value:m,onChange:e=>h(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]}),f===`marketplace`?(0,X.jsx)(ne,{}):f===`builtin`&&w.length===0?(0,X.jsx)(ge,{message:t.appsPage.emptyBuiltin}):f===`user`&&T.length===0?(0,X.jsx)(ge,{message:t.appsPage.emptyUser}):O.length===0?(0,X.jsx)(`p`,{className:`rounded-xl border border-dashed border-edge-subtle bg-surface-hover/30 px-3 py-8 sm:px-5 xl:px-6 text-center text-sm text-fg-muted dark:bg-surface-hover/15`,children:t.appsPage.noSearchResults}):(0,X.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:O.map(e=>(0,X.jsx)(fe,{extension:e,copy:t.appsPage,showSourceBadge:f===`user`,onOpen:()=>x(e)},e.id))})]}),v?(0,X.jsx)(pe,{extension:v,copy:t.appsPage,onClose:()=>x(null)},v.id):null]})}function Q(e){return e.activationEligible??e.active}function le(e,t){return e.source===`bundled`?t.providerBundled:e.source===`global`?t.providerGlobal:e.source===`workspace`?t.providerWorkspace:t.providerOther}function ue(e,t){return e.source===`global`?t.badgeSourceGlobal:e.source===`workspace`?t.badgeSourceWorkspace:t.badgeSourceOther}function de(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 fe(e){let t=(0,W.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,X.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,X.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,X.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,X.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,X.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,X.jsx)(N,{className:`size-3`,strokeWidth:2.5,"aria-hidden":!0}),r.statusEnabled]}):(0,X.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,X.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,X.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,X.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,X.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,X.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,X.jsx)(`span`,{title:le(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:ue(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,X.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,X.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,X.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,X.jsx)(`button`,{type:`button`,onClick:o,className:u,children:D}),t[42]=o,t[43]=D,t[44]=O):O=t[44],O}function pe({extension:e,copy:t,onClose:n}){let{mutate:r}=d(),[a,o]=(0,U.useState)(!1),[s,c]=(0,U.useState)(null),[l,u]=(0,U.useState)(!1),f=e.activationEligible===!0,p=(0,U.useCallback)(async()=>{if(e.source===`bundled`){c(null),u(!1),o(!0);try{let{requiresGatewayRestart:t}=await J({extensionId:e.id,enabled:!f});await r(`gateway-extensions-list`),m(),u(t)}catch(e){c(e instanceof Error?e.message:t.builtinToggleFailed)}finally{o(!1)}}},[f,t.builtinToggleFailed,e.id,e.source,r]),g=e.ui?.contributions?.pages??[],_=e.ui?.contributions?.settingsPanels??[],y=e.ui?.contributions?.chatWidgets??[],b=e.ui?.contributions?.sidebarPanels??[],S=g.find(e=>e.showInNav)??g[0],w=_[0],E=S?C(e.id,S):null,O=w?`/settings/ext/${e.id}/${w.id}`:e.hasConfigSchema||x(e)?`/settings/ext/${e.id}`:null;return(0,X.jsx)(k,{defaultOpen:!0,onOpenChange:e=>!e&&n(),children:(0,X.jsxs)(A,{children:[(0,X.jsx)(L,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),(0,X.jsxs)(z,{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,X.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[(0,X.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,X.jsx)(D,{className:`size-5`})}),(0,X.jsx)(I,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:t.detailTitle}),(0,X.jsxs)(P,{className:`sr-only`,children:[e.name,` (`,e.id,`)`]}),(0,X.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,X.jsx)(v,{className:`size-5`})})]}),(0,X.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4`,children:[(0,X.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,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:e.name}),(0,X.jsxs)(`p`,{className:`mt-0.5 text-sm text-fg-muted`,children:[t.detailProviderPrefix,` `,le(e,t)]}),e.version?(0,X.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[`v`,e.version]}):null]})]}),(0,X.jsx)(`p`,{className:`mt-5 text-sm leading-relaxed text-fg`,children:e.description?.trim()||t.detailNoDescription}),e.hasUi?null:(0,X.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:t.backendOnlyHint}),(0,X.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:de(e,t)}),e.source===`bundled`?(0,X.jsxs)(X.Fragment,{children:[(0,X.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,X.jsxs)(`div`,{className:`mt-3 rounded-lg border border-edge-subtle bg-surface-hover/40 p-3 dark:bg-surface-hover/20`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,X.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:t.builtinRuntimeToggle}),(0,X.jsx)(h,{type:`button`,variant:`secondary`,disabled:a,onClick:()=>void p(),className:`shrink-0 py-1.5 text-xs`,children:a?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(F,{className:`mr-1.5 size-3.5 shrink-0 animate-spin`,"aria-hidden":!0}),t.builtinToggleBusy]}):f?t.builtinToggleDisable:t.builtinToggleEnable})]}),s?(0,X.jsx)(`p`,{className:`mt-2 text-xs text-rose-600 dark:text-rose-400`,children:s}):null,l?(0,X.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.builtinToggleRestartHint}):null]})]}):(0,X.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&&(g.length>0||_.length>0||y.length>0)?(0,X.jsxs)(`section`,{className:`mt-8`,children:[(0,X.jsx)(`h4`,{className:`mb-3 text-sm font-semibold text-fg`,children:t.detailSectionFeatures}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,X.jsx)($,{template:t.badgePages,count:g.length,hidden:g.length===0}),(0,X.jsx)($,{template:t.badgeSettings,count:_.length,hidden:_.length===0}),(0,X.jsx)($,{template:t.badgeWidgets,count:y.length,hidden:y.length===0}),(0,X.jsx)($,{template:t.badgeSidebar,count:b.length,hidden:b.length===0})]})]}):null,T(e)&&(E||O)?(0,X.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-2 border-t border-edge-subtle pt-4`,children:[E?(0,X.jsxs)(j,{to:E,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,X.jsx)(H,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.open]}):null,O?(0,X.jsxs)(j,{to:O,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,X.jsx)(V,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.openSettings]}):null]}):null,(0,X.jsx)(`p`,{className:`mt-6 text-[11px] leading-relaxed text-fg-muted`,children:t.restartNote})]})]})]})})}function $(e){let t=(0,W.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,X.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 me(){let e=(0,W.c)(5),t,n,r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsx)(`div`,{className:`mb-6 h-8 w-40 max-w-full animate-pulse rounded-md bg-surface-hover`}),n=(0,X.jsx)(`div`,{className:`mb-2 h-4 w-full max-w-md animate-pulse rounded bg-surface-hover`}),r=(0,X.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,X.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:(0,X.jsxs)(`div`,{className:`w-full px-3 py-8 sm:px-5 xl:px-6`,children:[t,n,r,(0,X.jsx)(`div`,{className:`mt-6 grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:i.map(he)})]})}),e[4]=a):a=e[4],a}function he(e){return(0,X.jsx)(`div`,{className:`h-36 animate-pulse rounded-xl border border-edge bg-surface-base`},e)}function ge(e){let t=(0,W.c)(2),{message:n}=e,r;return t[0]===n?r=t[1]:(r=(0,X.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,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n})}),t[0]=n,t[1]=r),r}export{ce as AppsPage};
|
package/dist/gateway/static/root/assets/{archive-plugin-CX4_KWut.js → archive-plugin-DAtNW3Ia.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./messages-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./messages-B5O4OIEo.js";import{t as a}from"./jszip.min-DT31yWkU.js";import{t as o}from"./preview-open-alternatives-C29O19s7.js";var s=n(),c=e(a(),1),l=e(t(),1),u=r();function d(e){let t=(0,s.c)(17),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=[],t[0]=n):n=t[0];let[r,a]=(0,l.useState)(n),[d,m]=(0,l.useState)(null),h,g;if(t[1]===e.binaryBuffer?(h=t[2],g=t[3]):(h=()=>{if(!e.binaryBuffer)return;let t=!1;return c.default.loadAsync(e.binaryBuffer).then(e=>{t||a(Object.values(e.files).slice(0,500).map(p))}).catch(e=>{t||m(e instanceof Error?e.message:String(e))}),()=>{t=!0}},g=[e.binaryBuffer],t[1]=e.binaryBuffer,t[2]=h,t[3]=g),(0,l.useEffect)(h,g),d){let n;t[4]===e.language?n=t[5]:(n=i(e.language),t[4]=e.language,t[5]=n);let r=n,a;t[6]!==r.chat.attachmentPreviewDownloadFull||t[7]!==r.chat.attachmentPreviewOpenElsewhereHint||t[8]!==e.actions.onDownload?(a=(0,u.jsx)(o,{message:r.chat.attachmentPreviewOpenElsewhereHint,downloadLabel:r.chat.attachmentPreviewDownloadFull,onDownload:e.actions.onDownload}),t[6]=r.chat.attachmentPreviewDownloadFull,t[7]=r.chat.attachmentPreviewOpenElsewhereHint,t[8]=e.actions.onDownload,t[9]=a):a=t[9];let s;t[10]===d?s=t[11]:(s=(0,u.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:d}),t[10]=d,t[11]=s);let c;return t[12]!==a||t[13]!==s?(c=(0,u.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-auto p-4`,children:[a,s]}),t[12]=a,t[13]=s,t[14]=c):c=t[14],c}let _;return t[15]===r?_=t[16]:(_=(0,u.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-4`,children:(0,u.jsx)(`div`,{className:`overflow-hidden rounded-lg border border-edge bg-surface-panel`,children:r.length===0?(0,u.jsx)(`p`,{className:`p-4 text-sm text-fg-muted`,children:`Loading archive...`}):(0,u.jsx)(`table`,{className:`w-full text-left text-xs`,children:(0,u.jsx)(`tbody`,{children:r.map(f)})})})}),t[15]=r,t[16]=_),_}function f(e){return(0,u.jsxs)(`tr`,{className:`border-b border-edge-subtle last:border-b-0 dark:border-edge`,children:[(0,u.jsx)(`td`,{className:`max-w-0 truncate px-3 py-2 font-mono text-fg`,title:e.name,children:e.dir?`${e.name}/`:e.name}),(0,u.jsx)(`td`,{className:`w-24 px-3 py-2 text-right text-fg-muted`,children:e.dir?``:m(e.size)})]},e.name)}function p(e){return{name:e.name,dir:e.dir,size:e.dir?0:e._data?.uncompressedSize??0}}function m(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}export{d as ArchivePreviewPluginView};
|
package/dist/gateway/static/root/assets/{attachment-load-jf-PIIUU.js → attachment-load-Dm-RY54y.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/attachment-process-heavy-RnGYy9bC.js","assets/rolldown-runtime-aKtaBQYM.js","assets/preload-helper-zJ_50EbN.js","assets/excel-worksheet-utils-EyvwNT4X.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{t as e}from"./preload-helper-zJ_50EbN.js";import{
|
|
2
|
+
import{t as e}from"./preload-helper-zJ_50EbN.js";import{Oi as t}from"./index-DdqSO9R2.js";async function n(n,r){let i,a=r||`unnamed`,o=`application/octet-stream`,s=0;if(typeof n==`string`){let e=await fetch(n);if(!e.ok)throw Error(`Failed to fetch file`);if(i=await e.arrayBuffer(),s=i.byteLength,o=e.headers.get(`content-type`)||o,!r){let e=n.split(`/`);a=e[e.length-1]||`document`}}else if(n instanceof File)i=await n.arrayBuffer(),s=n.size,o=n.type||o,a=r||n.name;else if(n instanceof Blob)i=await n.arrayBuffer(),s=n.size,o=n.type||o;else if(n instanceof ArrayBuffer)i=n,s=n.byteLength;else throw Error(`Invalid source type`);let c=new Uint8Array(i),l=``,u=32768;for(let e=0;e<c.length;e+=u){let t=c.slice(e,e+u);l+=String.fromCharCode(...t)}let d=btoa(l),f=`${a}_${Date.now()}_${Math.random()}`;if(o===`application/pdf`||a.toLowerCase().endsWith(`.pdf`)){let{processPdf:t}=await e(async()=>{let{processPdf:e}=await import(`./attachment-process-heavy-RnGYy9bC.js`);return{processPdf:e}},__vite__mapDeps([0,1,2,3])),{extractedText:n,preview:r}=await t(i,a);return{id:f,type:`document`,name:a,mimeType:`application/pdf`,size:s,content:d,extractedText:n,preview:r}}if(o===`application/vnd.openxmlformats-officedocument.wordprocessingml.document`||a.toLowerCase().endsWith(`.docx`)){let{processDocx:t}=await e(async()=>{let{processDocx:e}=await import(`./attachment-process-heavy-RnGYy9bC.js`);return{processDocx:e}},__vite__mapDeps([0,1,2,3])),{extractedText:n}=await t(i,a);return{id:f,type:`document`,name:a,mimeType:`application/vnd.openxmlformats-officedocument.wordprocessingml.document`,size:s,content:d,extractedText:n}}if(o===`application/vnd.openxmlformats-officedocument.presentationml.presentation`||a.toLowerCase().endsWith(`.pptx`)){let{processPptx:t}=await e(async()=>{let{processPptx:e}=await import(`./attachment-process-heavy-RnGYy9bC.js`);return{processPptx:e}},__vite__mapDeps([0,1,2,3])),{extractedText:n}=await t(i,a);return{id:f,type:`document`,name:a,mimeType:`application/vnd.openxmlformats-officedocument.presentationml.presentation`,size:s,content:d,extractedText:n}}if([`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,`application/vnd.ms-excel`].includes(o)||a.toLowerCase().endsWith(`.xlsx`)||a.toLowerCase().endsWith(`.xls`)){let{processExcel:t}=await e(async()=>{let{processExcel:e}=await import(`./attachment-process-heavy-RnGYy9bC.js`);return{processExcel:e}},__vite__mapDeps([0,1,2,3])),{extractedText:n}=await t(i,a);return{id:f,type:`document`,name:a,mimeType:o&&o.startsWith(`application/vnd`)?o:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,size:s,content:d,extractedText:n}}if(o?.startsWith(`image/`))return{id:f,type:`image`,name:a,mimeType:o,size:s,content:d,preview:d};if(o?.startsWith(`audio/`))return{id:f,type:`voice`,name:a,mimeType:o,size:s,content:d};if(t(a,o??``)){let e=new TextDecoder().decode(i);return{id:f,type:`document`,name:a,mimeType:o?.startsWith(`text/`)?o:`text/plain`,size:s,content:d,extractedText:e}}throw Error(`Unsupported file type: ${o}`)}export{n as loadAttachment};
|