@jingyi0605/codingns 0.3.6 → 0.5.0
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 +3 -0
- package/bin/codingns.mjs +913 -1
- package/dist/public/assets/AdaptiveButlerPage-B153lk5H.css +1 -0
- package/dist/public/assets/AdaptiveButlerPage-R-XZw7pd.js +3 -0
- package/dist/public/assets/App-DUAg5urj.css +1 -0
- package/dist/public/assets/App-DkvE5EyM.js +30 -0
- package/dist/public/assets/BootstrapPage-Vu5oEJ8z.js +1 -0
- package/dist/public/assets/ConversationPage-Cjpg6g0J.js +2 -0
- package/dist/public/assets/DesktopDetachPreviewPage-BgeEqbc5.js +1 -0
- package/dist/public/assets/DesktopWindowPage-1WelvxdH.js +2 -0
- package/dist/public/assets/FileContextPanel-D_ghXJuW.js +1 -0
- package/dist/public/assets/GitSidebar-D9f9Jxwr.js +6 -0
- package/dist/public/assets/MobileCreateSessionSheet-DLq5qPkx.js +1 -0
- package/dist/public/assets/MobileSheet-DLg-gX1t.js +1 -0
- package/dist/public/assets/MobileTopHeaderFrame-DArgZI7L.js +1 -0
- package/dist/public/assets/MobileWorkspaceSwitcherHeader-0ywJKfBQ.js +1 -0
- package/dist/public/assets/ServerSettingsModal-izoYMx9U.js +1 -0
- package/dist/public/assets/SessionIndexPage-C5aG8FIv.js +1 -0
- package/dist/public/assets/SettingsPage-HJIC-P-4.js +1 -0
- package/dist/public/assets/TerminalManagerPanel-DpyUTo9k.js +1 -0
- package/dist/public/assets/{TerminalPage-D00S4KM6.js → TerminalPage-CtKXIU0h.js} +19 -19
- package/dist/public/assets/TerminalRuntimeFallbackModal-CRhOQOsT.js +1 -0
- package/dist/public/assets/ToolFilesPage-DcYPsS-e.js +1 -0
- package/dist/public/assets/ToolGitPage-CsPl89ty.js +1 -0
- package/dist/public/assets/ToolProcessesPage-D0dvR8xK.js +1 -0
- package/dist/public/assets/ToolsHomePage-4fP-KRiv.js +1 -0
- package/dist/public/assets/WorkbenchLandingPage-kvlfyxRo.js +1 -0
- package/dist/public/assets/WorkbenchLayout-ByFw4eeu.js +3 -0
- package/dist/public/assets/WorkbenchModal-Ctob14VR.js +1 -0
- package/dist/public/assets/WorkbenchShellRoute-BUITtdAg.css +1 -0
- package/dist/public/assets/WorkbenchShellRoute-Kw7JEZI3.js +1 -0
- package/dist/public/assets/WorkspaceDebugDetailPage-Com5kEXJ.js +1 -0
- package/dist/public/assets/WorkspaceDetailPage-D0Lrx4Uz.js +1 -0
- package/dist/public/assets/WorkspaceHomePage-wR8d3aP9.js +1 -0
- package/dist/public/assets/butler-records-events-DgWCG364.js +1 -0
- package/dist/public/assets/default-session-permission-mode-CcGwR4Kk.js +1 -0
- package/dist/public/assets/event-DvH9tcej.js +1 -0
- package/dist/public/assets/file-tree-icon-UFVoVzhM.js +31 -0
- package/dist/public/assets/index-Byp9hJ0c.js +42 -0
- package/dist/public/assets/index-_52jxu4a.css +1 -0
- package/dist/public/assets/preferences-service-KIYeE2gk.js +1 -0
- package/dist/public/assets/session-runtime-machine-0KNSSPp5.js +17 -0
- package/dist/public/assets/styles-BWPBZvze.css +1 -0
- package/dist/public/assets/styles-CSUx5LGe.js +1 -0
- package/dist/public/assets/terminal-runtime-meta-AWXJpN4r.js +1 -0
- package/dist/public/assets/useRegisteredDebugTemplates-DBDRdptr.js +1 -0
- package/dist/public/assets/window-BWqRixxq.js +1 -0
- package/dist/public/index.html +2 -2
- package/dist/server/middlewares/auth-guard.d.ts +4 -0
- package/dist/server/middlewares/auth-guard.js +42 -4
- package/dist/server/middlewares/auth-guard.js.map +1 -1
- package/dist/server/modules/assistant-capability/assistant-capability-controller.d.ts +234 -0
- package/dist/server/modules/assistant-capability/assistant-capability-controller.js +365 -0
- package/dist/server/modules/assistant-capability/assistant-capability-controller.js.map +1 -1
- package/dist/server/modules/assistant-capability/assistant-capability-service.d.ts +262 -2
- package/dist/server/modules/assistant-capability/assistant-capability-service.js +737 -3
- package/dist/server/modules/assistant-capability/assistant-capability-service.js.map +1 -1
- package/dist/server/modules/auth/auth-controller.d.ts +11 -1
- package/dist/server/modules/auth/auth-controller.js +61 -2
- package/dist/server/modules/auth/auth-controller.js.map +1 -1
- package/dist/server/modules/auth/auth-device-display-name.d.ts +10 -0
- package/dist/server/modules/auth/auth-device-display-name.js +190 -0
- package/dist/server/modules/auth/auth-device-display-name.js.map +1 -0
- package/dist/server/modules/auth/auth-service.d.ts +80 -5
- package/dist/server/modules/auth/auth-service.js +333 -23
- package/dist/server/modules/auth/auth-service.js.map +1 -1
- package/dist/server/modules/butler/assistant-automation-service.d.ts +112 -0
- package/dist/server/modules/butler/assistant-automation-service.js +832 -0
- package/dist/server/modules/butler/assistant-automation-service.js.map +1 -0
- package/dist/server/modules/butler/assistant-automation-trigger.d.ts +94 -0
- package/dist/server/modules/butler/assistant-automation-trigger.js +400 -0
- package/dist/server/modules/butler/assistant-automation-trigger.js.map +1 -0
- package/dist/server/modules/butler/assistant-sandbox-cleanup-scheduler.d.ts +32 -0
- package/dist/server/modules/butler/assistant-sandbox-cleanup-scheduler.js +93 -0
- package/dist/server/modules/butler/assistant-sandbox-cleanup-scheduler.js.map +1 -0
- package/dist/server/modules/butler/assistant-sandbox-service.d.ts +69 -0
- package/dist/server/modules/butler/assistant-sandbox-service.js +399 -0
- package/dist/server/modules/butler/assistant-sandbox-service.js.map +1 -0
- package/dist/server/modules/butler/butler-action-context-service.d.ts +4 -1
- package/dist/server/modules/butler/butler-action-context-service.js +8 -2
- package/dist/server/modules/butler/butler-action-context-service.js.map +1 -1
- package/dist/server/modules/butler/butler-auth-service.js +7 -2
- package/dist/server/modules/butler/butler-auth-service.js.map +1 -1
- package/dist/server/modules/butler/butler-control-session-service.d.ts +11 -1
- package/dist/server/modules/butler/butler-control-session-service.js +173 -40
- package/dist/server/modules/butler/butler-control-session-service.js.map +1 -1
- package/dist/server/modules/butler/butler-control-timer-scheduler.d.ts +32 -0
- package/dist/server/modules/butler/butler-control-timer-scheduler.js +93 -0
- package/dist/server/modules/butler/butler-control-timer-scheduler.js.map +1 -0
- package/dist/server/modules/butler/butler-control-timer-service.d.ts +42 -0
- package/dist/server/modules/butler/butler-control-timer-service.js +132 -0
- package/dist/server/modules/butler/butler-control-timer-service.js.map +1 -0
- package/dist/server/modules/butler/butler-controller.d.ts +42 -2
- package/dist/server/modules/butler/butler-controller.js +79 -12
- package/dist/server/modules/butler/butler-controller.js.map +1 -1
- package/dist/server/modules/butler/butler-follow-up-evaluation-instruction-adapter.d.ts +2 -1
- package/dist/server/modules/butler/butler-follow-up-evaluation-instruction-adapter.js +27 -25
- package/dist/server/modules/butler/butler-follow-up-evaluation-instruction-adapter.js.map +1 -1
- package/dist/server/modules/butler/butler-follow-up-service.d.ts +41 -5
- package/dist/server/modules/butler/butler-follow-up-service.js +568 -371
- package/dist/server/modules/butler/butler-follow-up-service.js.map +1 -1
- package/dist/server/modules/butler/butler-inbox-analysis-service.d.ts +4 -1
- package/dist/server/modules/butler/butler-inbox-analysis-service.js +18 -4
- package/dist/server/modules/butler/butler-inbox-analysis-service.js.map +1 -1
- package/dist/server/modules/butler/butler-inbox-service.js +1 -0
- package/dist/server/modules/butler/butler-inbox-service.js.map +1 -1
- package/dist/server/modules/butler/butler-profile-service.js +2 -5
- package/dist/server/modules/butler/butler-profile-service.js.map +1 -1
- package/dist/server/modules/butler/butler-project-service.d.ts +3 -1
- package/dist/server/modules/butler/butler-project-service.js +7 -1
- package/dist/server/modules/butler/butler-project-service.js.map +1 -1
- package/dist/server/modules/butler/butler-session-service.d.ts +5 -1
- package/dist/server/modules/butler/butler-session-service.js +26 -1
- package/dist/server/modules/butler/butler-session-service.js.map +1 -1
- package/dist/server/modules/butler/butler-session-summary-service.js +2 -1
- package/dist/server/modules/butler/butler-session-summary-service.js.map +1 -1
- package/dist/server/modules/butler/butler-workspace-context.d.ts +4 -1
- package/dist/server/modules/butler/butler-workspace-context.js +204 -58
- package/dist/server/modules/butler/butler-workspace-context.js.map +1 -1
- package/dist/server/modules/butler/patrol-execution-service.js +2 -1
- package/dist/server/modules/butler/patrol-execution-service.js.map +1 -1
- package/dist/server/modules/butler/provider-adapter-registry.d.ts +3 -0
- package/dist/server/modules/butler/provider-adapter-registry.js +18 -1
- package/dist/server/modules/butler/provider-adapter-registry.js.map +1 -1
- package/dist/server/modules/butler/verification-run-service.d.ts +9 -2
- package/dist/server/modules/butler/verification-run-service.js +188 -34
- package/dist/server/modules/butler/verification-run-service.js.map +1 -1
- package/dist/server/modules/debug-target/debug-target-controller.js +1 -1
- package/dist/server/modules/debug-target/debug-target-controller.js.map +1 -1
- package/dist/server/modules/debug-target/debug-target-service.d.ts +7 -2
- package/dist/server/modules/debug-target/debug-target-service.js +563 -100
- package/dist/server/modules/debug-target/debug-target-service.js.map +1 -1
- package/dist/server/modules/git/git-command-helper-client.d.ts +1 -0
- package/dist/server/modules/git/git-command-helper-client.js +19 -26
- package/dist/server/modules/git/git-command-helper-client.js.map +1 -1
- package/dist/server/modules/git/git-command-runner.js +19 -1
- package/dist/server/modules/git/git-command-runner.js.map +1 -1
- package/dist/server/modules/preferences/profile-service.d.ts +3 -1
- package/dist/server/modules/preferences/profile-service.js +74 -3
- package/dist/server/modules/preferences/profile-service.js.map +1 -1
- package/dist/server/modules/provider/provider-controller.d.ts +1 -1
- package/dist/server/modules/provider/provider-controller.js.map +1 -1
- package/dist/server/modules/provider/provider-discovery-helper-client.d.ts +5 -3
- package/dist/server/modules/provider/provider-discovery-helper-client.js +129 -43
- package/dist/server/modules/provider/provider-discovery-helper-client.js.map +1 -1
- package/dist/server/modules/provider/provider-discovery-helper-process.js +44 -0
- package/dist/server/modules/provider/provider-discovery-helper-process.js.map +1 -1
- package/dist/server/modules/provider/provider-discovery-runtime.js +83 -3
- package/dist/server/modules/provider/provider-discovery-runtime.js.map +1 -1
- package/dist/server/modules/relay-tunnel/crypto/relay-tunnel-identity-service.d.ts +10 -0
- package/dist/server/modules/relay-tunnel/crypto/relay-tunnel-identity-service.js +48 -0
- package/dist/server/modules/relay-tunnel/crypto/relay-tunnel-identity-service.js.map +1 -0
- package/dist/server/modules/relay-tunnel/crypto/relay-tunnel-packets.d.ts +48 -0
- package/dist/server/modules/relay-tunnel/crypto/relay-tunnel-packets.js +11 -0
- package/dist/server/modules/relay-tunnel/crypto/relay-tunnel-packets.js.map +1 -0
- package/dist/server/modules/relay-tunnel/crypto/relay-tunnel-protocol.d.ts +74 -0
- package/dist/server/modules/relay-tunnel/crypto/relay-tunnel-protocol.js +302 -0
- package/dist/server/modules/relay-tunnel/crypto/relay-tunnel-protocol.js.map +1 -0
- package/dist/server/modules/relay-tunnel/relay-tunnel-controller.d.ts +33 -0
- package/dist/server/modules/relay-tunnel/relay-tunnel-controller.js +57 -0
- package/dist/server/modules/relay-tunnel/relay-tunnel-controller.js.map +1 -0
- package/dist/server/modules/relay-tunnel/relay-tunnel-edge-proof.d.ts +9 -0
- package/dist/server/modules/relay-tunnel/relay-tunnel-edge-proof.js +25 -0
- package/dist/server/modules/relay-tunnel/relay-tunnel-edge-proof.js.map +1 -0
- package/dist/server/modules/relay-tunnel/relay-tunnel-gateway-service.d.ts +18 -0
- package/dist/server/modules/relay-tunnel/relay-tunnel-gateway-service.js +230 -0
- package/dist/server/modules/relay-tunnel/relay-tunnel-gateway-service.js.map +1 -0
- package/dist/server/modules/relay-tunnel/relay-tunnel-runtime-adapter.d.ts +41 -0
- package/dist/server/modules/relay-tunnel/relay-tunnel-runtime-adapter.js +443 -0
- package/dist/server/modules/relay-tunnel/relay-tunnel-runtime-adapter.js.map +1 -0
- package/dist/server/modules/relay-tunnel/relay-tunnel-service.d.ts +111 -0
- package/dist/server/modules/relay-tunnel/relay-tunnel-service.js +771 -0
- package/dist/server/modules/relay-tunnel/relay-tunnel-service.js.map +1 -0
- package/dist/server/modules/sessions/claude-runtime-helper-client.js +23 -1
- package/dist/server/modules/sessions/claude-runtime-helper-client.js.map +1 -1
- package/dist/server/modules/sessions/codex-app-server-helper-client.d.ts +2 -1
- package/dist/server/modules/sessions/codex-app-server-helper-client.js +78 -0
- package/dist/server/modules/sessions/codex-app-server-helper-client.js.map +1 -1
- package/dist/server/modules/sessions/codex-app-server-helper-process.js +84 -2
- package/dist/server/modules/sessions/codex-app-server-helper-process.js.map +1 -1
- package/dist/server/modules/sessions/provider-session-delete-cli.d.ts +15 -0
- package/dist/server/modules/sessions/provider-session-delete-cli.js +148 -0
- package/dist/server/modules/sessions/provider-session-delete-cli.js.map +1 -0
- package/dist/server/modules/sessions/session-controller.d.ts +4 -1
- package/dist/server/modules/sessions/session-controller.js +4 -0
- package/dist/server/modules/sessions/session-controller.js.map +1 -1
- package/dist/server/modules/sessions/session-history-service.d.ts +24 -1
- package/dist/server/modules/sessions/session-history-service.js +401 -42
- package/dist/server/modules/sessions/session-history-service.js.map +1 -1
- package/dist/server/modules/sessions/session-live-runtime-router-service.d.ts +25 -0
- package/dist/server/modules/sessions/session-live-runtime-router-service.js +42 -0
- package/dist/server/modules/sessions/session-live-runtime-router-service.js.map +1 -0
- package/dist/server/modules/sessions/session-live-runtime-service.d.ts +6 -0
- package/dist/server/modules/sessions/session-live-runtime-service.js +130 -28
- package/dist/server/modules/sessions/session-live-runtime-service.js.map +1 -1
- package/dist/server/modules/sessions/session-message-attachment-service.d.ts +1 -0
- package/dist/server/modules/sessions/session-message-attachment-service.js +22 -0
- package/dist/server/modules/sessions/session-message-attachment-service.js.map +1 -1
- package/dist/server/modules/sessions/session-message-origin-utils.d.ts +12 -0
- package/dist/server/modules/sessions/session-message-origin-utils.js +45 -0
- package/dist/server/modules/sessions/session-message-origin-utils.js.map +1 -0
- package/dist/server/modules/sessions/session-permission-request-service.d.ts +1 -0
- package/dist/server/modules/sessions/session-permission-request-service.js +367 -5
- package/dist/server/modules/sessions/session-permission-request-service.js.map +1 -1
- package/dist/server/modules/sessions/session-provider-error-mapper.js +32 -0
- package/dist/server/modules/sessions/session-provider-error-mapper.js.map +1 -1
- package/dist/server/modules/sessions/session-provider-usage-guard-service.d.ts +37 -0
- package/dist/server/modules/sessions/session-provider-usage-guard-service.js +179 -0
- package/dist/server/modules/sessions/session-provider-usage-guard-service.js.map +1 -0
- package/dist/server/modules/sessions/session-provider-usage-limit.d.ts +17 -0
- package/dist/server/modules/sessions/session-provider-usage-limit.js +465 -0
- package/dist/server/modules/sessions/session-provider-usage-limit.js.map +1 -0
- package/dist/server/modules/skills/assistant-runtime-skill-catalog.d.ts +8 -0
- package/dist/server/modules/skills/assistant-runtime-skill-catalog.js +26 -0
- package/dist/server/modules/skills/assistant-runtime-skill-catalog.js.map +1 -0
- package/dist/server/modules/skills/assistant-runtime-skill-cleanup.d.ts +9 -0
- package/dist/server/modules/skills/assistant-runtime-skill-cleanup.js +55 -0
- package/dist/server/modules/skills/assistant-runtime-skill-cleanup.js.map +1 -0
- package/dist/server/modules/skills/builtin-skill-service.js +1 -6
- package/dist/server/modules/skills/builtin-skill-service.js.map +1 -1
- package/dist/server/modules/skills/builtin-skills/codingns-assistant/SKILL.md +19 -12
- package/dist/server/modules/skills/builtin-skills/codingns-assistant/references/cli-workflow.md +9 -3
- package/dist/server/modules/skills/skill-controller.d.ts +2 -2
- package/dist/server/modules/skills/skill-controller.js +9 -1
- package/dist/server/modules/skills/skill-controller.js.map +1 -1
- package/dist/server/modules/skills/skill-manager-service.d.ts +26 -1
- package/dist/server/modules/skills/skill-manager-service.js +346 -90
- package/dist/server/modules/skills/skill-manager-service.js.map +1 -1
- package/dist/server/modules/skills/skill-name-policy.d.ts +2 -0
- package/dist/server/modules/skills/skill-name-policy.js +10 -0
- package/dist/server/modules/skills/skill-name-policy.js.map +1 -0
- package/dist/server/modules/tailscale/tailscale-service.d.ts +2 -0
- package/dist/server/modules/tailscale/tailscale-service.js +21 -8
- package/dist/server/modules/tailscale/tailscale-service.js.map +1 -1
- package/dist/server/modules/tasks/task-helper-client.d.ts +5 -2
- package/dist/server/modules/tasks/task-helper-client.js +118 -38
- package/dist/server/modules/tasks/task-helper-client.js.map +1 -1
- package/dist/server/modules/tasks/task-helper-process.js +94 -3
- package/dist/server/modules/tasks/task-helper-process.js.map +1 -1
- package/dist/server/modules/tasks/task-types.d.ts +6 -0
- package/dist/server/modules/tasks/task-types.js +7 -1
- package/dist/server/modules/tasks/task-types.js.map +1 -1
- package/dist/server/modules/terminal/command-template-service.d.ts +9 -0
- package/dist/server/modules/terminal/command-template-service.js +87 -5
- package/dist/server/modules/terminal/command-template-service.js.map +1 -1
- package/dist/server/modules/terminal/template-reverse-proxy-service.js +71 -3
- package/dist/server/modules/terminal/template-reverse-proxy-service.js.map +1 -1
- package/dist/server/modules/terminal/terminal-controller.d.ts +3 -0
- package/dist/server/modules/terminal/terminal-controller.js +41 -0
- package/dist/server/modules/terminal/terminal-controller.js.map +1 -1
- package/dist/server/modules/workbench/workbench-service.d.ts +3 -0
- package/dist/server/modules/workbench/workbench-service.js +4 -3
- package/dist/server/modules/workbench/workbench-service.js.map +1 -1
- package/dist/server/modules/workbench/workspace-file-watcher.d.ts +14 -6
- package/dist/server/modules/workbench/workspace-file-watcher.js +267 -57
- package/dist/server/modules/workbench/workspace-file-watcher.js.map +1 -1
- package/dist/server/modules/workbench/workspace-panel-snapshot-service.d.ts +2 -0
- package/dist/server/modules/workbench/workspace-panel-snapshot-service.js +32 -3
- package/dist/server/modules/workbench/workspace-panel-snapshot-service.js.map +1 -1
- package/dist/server/modules/worktree/worktree-manager.d.ts +9 -1
- package/dist/server/modules/worktree/worktree-manager.js +9 -1
- package/dist/server/modules/worktree/worktree-manager.js.map +1 -1
- package/dist/server/routes/assistant.js +49 -0
- package/dist/server/routes/assistant.js.map +1 -1
- package/dist/server/routes/auth.js +4 -0
- package/dist/server/routes/auth.js.map +1 -1
- package/dist/server/routes/butler.js +5 -0
- package/dist/server/routes/butler.js.map +1 -1
- package/dist/server/routes/sessions.js +1 -0
- package/dist/server/routes/sessions.js.map +1 -1
- package/dist/server/routes/system.d.ts +2 -1
- package/dist/server/routes/system.js +13 -1
- package/dist/server/routes/system.js.map +1 -1
- package/dist/server/server/create-server.d.ts +18 -0
- package/dist/server/server/create-server.js +113 -20
- package/dist/server/server/create-server.js.map +1 -1
- package/dist/server/shared/utils/tokens.d.ts +3 -1
- package/dist/server/shared/utils/tokens.js +9 -2
- package/dist/server/shared/utils/tokens.js.map +1 -1
- package/dist/server/storage/repositories/assistant-automation-run-repository.d.ts +12 -0
- package/dist/server/storage/repositories/assistant-automation-run-repository.js +139 -0
- package/dist/server/storage/repositories/assistant-automation-run-repository.js.map +1 -0
- package/dist/server/storage/repositories/assistant-automation-task-repository.d.ts +17 -0
- package/dist/server/storage/repositories/assistant-automation-task-repository.js +179 -0
- package/dist/server/storage/repositories/assistant-automation-task-repository.js.map +1 -0
- package/dist/server/storage/repositories/assistant-sandbox-workspace-repository.d.ts +18 -0
- package/dist/server/storage/repositories/assistant-sandbox-workspace-repository.js +191 -0
- package/dist/server/storage/repositories/assistant-sandbox-workspace-repository.js.map +1 -0
- package/dist/server/storage/repositories/auth-device-repository.d.ts +22 -0
- package/dist/server/storage/repositories/auth-device-repository.js +97 -0
- package/dist/server/storage/repositories/auth-device-repository.js.map +1 -0
- package/dist/server/storage/repositories/auth-device-session-repository.d.ts +17 -0
- package/dist/server/storage/repositories/auth-device-session-repository.js +82 -0
- package/dist/server/storage/repositories/auth-device-session-repository.js.map +1 -0
- package/dist/server/storage/repositories/auth-login-event-repository.d.ts +9 -0
- package/dist/server/storage/repositories/auth-login-event-repository.js +53 -0
- package/dist/server/storage/repositories/auth-login-event-repository.js.map +1 -0
- package/dist/server/storage/repositories/auth-token-repository.d.ts +4 -0
- package/dist/server/storage/repositories/auth-token-repository.js +58 -5
- package/dist/server/storage/repositories/auth-token-repository.js.map +1 -1
- package/dist/server/storage/repositories/butler-control-session-repository.js +27 -3
- package/dist/server/storage/repositories/butler-control-session-repository.js.map +1 -1
- package/dist/server/storage/repositories/butler-control-timer-repository.d.ts +15 -0
- package/dist/server/storage/repositories/butler-control-timer-repository.js +157 -0
- package/dist/server/storage/repositories/butler-control-timer-repository.js.map +1 -0
- package/dist/server/storage/repositories/butler-follow-up-task-repository.js +21 -3
- package/dist/server/storage/repositories/butler-follow-up-task-repository.js.map +1 -1
- package/dist/server/storage/repositories/instance-relay-tunnel-identity-repository.d.ts +8 -0
- package/dist/server/storage/repositories/instance-relay-tunnel-identity-repository.js +52 -0
- package/dist/server/storage/repositories/instance-relay-tunnel-identity-repository.js.map +1 -0
- package/dist/server/storage/repositories/instance-relay-tunnel-repository.d.ts +10 -0
- package/dist/server/storage/repositories/instance-relay-tunnel-repository.js +153 -0
- package/dist/server/storage/repositories/instance-relay-tunnel-repository.js.map +1 -0
- package/dist/server/storage/repositories/instance-tailscale-repository.js +6 -3
- package/dist/server/storage/repositories/instance-tailscale-repository.js.map +1 -1
- package/dist/server/storage/repositories/managed-skill-repository.d.ts +2 -1
- package/dist/server/storage/repositories/managed-skill-repository.js +14 -4
- package/dist/server/storage/repositories/managed-skill-repository.js.map +1 -1
- package/dist/server/storage/repositories/session-message-attachment-repository.d.ts +2 -0
- package/dist/server/storage/repositories/session-message-attachment-repository.js +24 -0
- package/dist/server/storage/repositories/session-message-attachment-repository.js.map +1 -1
- package/dist/server/storage/repositories/user-preference-profile-repository.js +6 -3
- package/dist/server/storage/repositories/user-preference-profile-repository.js.map +1 -1
- package/dist/server/storage/sqlite/client.js +534 -2
- package/dist/server/storage/sqlite/client.js.map +1 -1
- package/dist/server/storage/sqlite/schema.sql +228 -4
- package/dist/server/types/domain.d.ts +170 -2
- package/dist/server/ws/workbench-ws-hub.d.ts +14 -8
- package/dist/server/ws/workbench-ws-hub.js +369 -209
- package/dist/server/ws/workbench-ws-hub.js.map +1 -1
- package/dist/server/ws/ws-auth-guard.js +1 -4
- package/dist/server/ws/ws-auth-guard.js.map +1 -1
- package/dist/server/ws/ws-server.d.ts +1 -1
- package/dist/server/ws/ws-server.js.map +1 -1
- package/node_modules/@codingns/session-sync-core/dist/codex-resume-history.d.ts +1 -0
- package/node_modules/@codingns/session-sync-core/dist/codex-resume-history.js +80 -0
- package/node_modules/@codingns/session-sync-core/dist/codex-resume-history.js.map +1 -0
- package/node_modules/@codingns/session-sync-core/dist/providers/claude-code.d.ts +5 -1
- package/node_modules/@codingns/session-sync-core/dist/providers/claude-code.js +122 -4
- package/node_modules/@codingns/session-sync-core/dist/providers/claude-code.js.map +1 -1
- package/node_modules/@codingns/session-sync-core/dist/providers/codex.d.ts +17 -1
- package/node_modules/@codingns/session-sync-core/dist/providers/codex.js +437 -51
- package/node_modules/@codingns/session-sync-core/dist/providers/codex.js.map +1 -1
- package/node_modules/@codingns/session-sync-core/dist/providers/gemini.d.ts +7 -1
- package/node_modules/@codingns/session-sync-core/dist/providers/gemini.js +240 -27
- package/node_modules/@codingns/session-sync-core/dist/providers/gemini.js.map +1 -1
- package/node_modules/@codingns/session-sync-core/dist/providers/kimi.d.ts +5 -1
- package/node_modules/@codingns/session-sync-core/dist/providers/kimi.js +108 -2
- package/node_modules/@codingns/session-sync-core/dist/providers/kimi.js.map +1 -1
- package/node_modules/@codingns/session-sync-core/dist/providers/opencode.d.ts +3 -0
- package/node_modules/@codingns/session-sync-core/dist/providers/opencode.js +101 -8
- package/node_modules/@codingns/session-sync-core/dist/providers/opencode.js.map +1 -1
- package/node_modules/@codingns/session-sync-core/dist/providers/utils.d.ts +1 -0
- package/node_modules/@codingns/session-sync-core/dist/providers/utils.js +4 -1
- package/node_modules/@codingns/session-sync-core/dist/providers/utils.js.map +1 -1
- package/node_modules/@codingns/session-sync-core/dist/runtime/claude-runtime.js +44 -0
- package/node_modules/@codingns/session-sync-core/dist/runtime/claude-runtime.js.map +1 -1
- package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.d.ts +5 -1
- package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.js +153 -60
- package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.js.map +1 -1
- package/node_modules/@codingns/session-sync-core/dist/runtime/types.d.ts +1 -0
- package/node_modules/@codingns/session-sync-core/dist/services.d.ts +1 -0
- package/node_modules/@codingns/session-sync-core/dist/services.js +24 -8
- package/node_modules/@codingns/session-sync-core/dist/services.js.map +1 -1
- package/node_modules/@codingns/session-sync-core/dist/types.d.ts +6 -0
- package/package.json +1 -1
- package/scripts/postinstall.mjs +0 -33
- package/dist/public/assets/index-BlOinYqR.js +0 -122
- package/dist/public/assets/index-Dg_7g6lA.css +0 -1
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TerminalPage-D00S4KM6.js","assets/TerminalPage-6GBZ9nXN.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
var qM=Object.defineProperty;var $M=(e,t,r)=>t in e?qM(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Ze=(e,t,r)=>$M(e,typeof t!="symbol"?t+"":t,r);function RT(e,t){for(var r=0;r<t.length;r++){const s=t[r];if(typeof s!="string"&&!Array.isArray(s)){for(const i in s)if(i!=="default"&&!(i in e)){const l=Object.getOwnPropertyDescriptor(s,i);l&&Object.defineProperty(e,i,l.get?l:{enumerable:!0,get:()=>s[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const l of i)if(l.type==="childList")for(const c of l.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&s(c)}).observe(document,{childList:!0,subtree:!0});function r(i){const l={};return i.integrity&&(l.integrity=i.integrity),i.referrerPolicy&&(l.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?l.credentials="include":i.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function s(i){if(i.ep)return;i.ep=!0;const l=r(i);fetch(i.href,l)}})();function yu(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var rf={exports:{}},wc={},sf={exports:{}},Dn={};/**
|
|
3
|
-
* @license React
|
|
4
|
-
* react.production.min.js
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
7
|
-
*
|
|
8
|
-
* This source code is licensed under the MIT license found in the
|
|
9
|
-
* LICENSE file in the root directory of this source tree.
|
|
10
|
-
*/var Nk;function VM(){if(Nk)return Dn;Nk=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),c=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),g=Symbol.iterator;function w(W){return W===null||typeof W!="object"?null:(W=g&&W[g]||W["@@iterator"],typeof W=="function"?W:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},y=Object.assign,S={};function T(W,J,R){this.props=W,this.context=J,this.refs=S,this.updater=R||k}T.prototype.isReactComponent={},T.prototype.setState=function(W,J){if(typeof W!="object"&&typeof W!="function"&&W!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,W,J,"setState")},T.prototype.forceUpdate=function(W){this.updater.enqueueForceUpdate(this,W,"forceUpdate")};function j(){}j.prototype=T.prototype;function N(W,J,R){this.props=W,this.context=J,this.refs=S,this.updater=R||k}var D=N.prototype=new j;D.constructor=N,y(D,T.prototype),D.isPureReactComponent=!0;var H=Array.isArray,B=Object.prototype.hasOwnProperty,I={current:null},A={key:!0,ref:!0,__self:!0,__source:!0};function L(W,J,R){var ve,pe={},Y=null,Se=null;if(J!=null)for(ve in J.ref!==void 0&&(Se=J.ref),J.key!==void 0&&(Y=""+J.key),J)B.call(J,ve)&&!A.hasOwnProperty(ve)&&(pe[ve]=J[ve]);var Le=arguments.length-2;if(Le===1)pe.children=R;else if(1<Le){for(var re=Array(Le),Ce=0;Ce<Le;Ce++)re[Ce]=arguments[Ce+2];pe.children=re}if(W&&W.defaultProps)for(ve in Le=W.defaultProps,Le)pe[ve]===void 0&&(pe[ve]=Le[ve]);return{$$typeof:e,type:W,key:Y,ref:Se,props:pe,_owner:I.current}}function _(W,J){return{$$typeof:e,type:W.type,key:J,ref:W.ref,props:W.props,_owner:W._owner}}function F(W){return typeof W=="object"&&W!==null&&W.$$typeof===e}function te(W){var J={"=":"=0",":":"=2"};return"$"+W.replace(/[=:]/g,function(R){return J[R]})}var E=/\/+/g;function se(W,J){return typeof W=="object"&&W!==null&&W.key!=null?te(""+W.key):J.toString(36)}function X(W,J,R,ve,pe){var Y=typeof W;(Y==="undefined"||Y==="boolean")&&(W=null);var Se=!1;if(W===null)Se=!0;else switch(Y){case"string":case"number":Se=!0;break;case"object":switch(W.$$typeof){case e:case t:Se=!0}}if(Se)return Se=W,pe=pe(Se),W=ve===""?"."+se(Se,0):ve,H(pe)?(R="",W!=null&&(R=W.replace(E,"$&/")+"/"),X(pe,J,R,"",function(Ce){return Ce})):pe!=null&&(F(pe)&&(pe=_(pe,R+(!pe.key||Se&&Se.key===pe.key?"":(""+pe.key).replace(E,"$&/")+"/")+W)),J.push(pe)),1;if(Se=0,ve=ve===""?".":ve+":",H(W))for(var Le=0;Le<W.length;Le++){Y=W[Le];var re=ve+se(Y,Le);Se+=X(Y,J,R,re,pe)}else if(re=w(W),typeof re=="function")for(W=re.call(W),Le=0;!(Y=W.next()).done;)Y=Y.value,re=ve+se(Y,Le++),Se+=X(Y,J,R,re,pe);else if(Y==="object")throw J=String(W),Error("Objects are not valid as a React child (found: "+(J==="[object Object]"?"object with keys {"+Object.keys(W).join(", ")+"}":J)+"). If you meant to render a collection of children, use an array instead.");return Se}function K(W,J,R){if(W==null)return W;var ve=[],pe=0;return X(W,ve,"","",function(Y){return J.call(R,Y,pe++)}),ve}function G(W){if(W._status===-1){var J=W._result;J=J(),J.then(function(R){(W._status===0||W._status===-1)&&(W._status=1,W._result=R)},function(R){(W._status===0||W._status===-1)&&(W._status=2,W._result=R)}),W._status===-1&&(W._status=0,W._result=J)}if(W._status===1)return W._result.default;throw W._result}var q={current:null},U={transition:null},Q={ReactCurrentDispatcher:q,ReactCurrentBatchConfig:U,ReactCurrentOwner:I};function P(){throw Error("act(...) is not supported in production builds of React.")}return Dn.Children={map:K,forEach:function(W,J,R){K(W,function(){J.apply(this,arguments)},R)},count:function(W){var J=0;return K(W,function(){J++}),J},toArray:function(W){return K(W,function(J){return J})||[]},only:function(W){if(!F(W))throw Error("React.Children.only expected to receive a single React element child.");return W}},Dn.Component=T,Dn.Fragment=r,Dn.Profiler=i,Dn.PureComponent=N,Dn.StrictMode=s,Dn.Suspense=m,Dn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Q,Dn.act=P,Dn.cloneElement=function(W,J,R){if(W==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+W+".");var ve=y({},W.props),pe=W.key,Y=W.ref,Se=W._owner;if(J!=null){if(J.ref!==void 0&&(Y=J.ref,Se=I.current),J.key!==void 0&&(pe=""+J.key),W.type&&W.type.defaultProps)var Le=W.type.defaultProps;for(re in J)B.call(J,re)&&!A.hasOwnProperty(re)&&(ve[re]=J[re]===void 0&&Le!==void 0?Le[re]:J[re])}var re=arguments.length-2;if(re===1)ve.children=R;else if(1<re){Le=Array(re);for(var Ce=0;Ce<re;Ce++)Le[Ce]=arguments[Ce+2];ve.children=Le}return{$$typeof:e,type:W.type,key:pe,ref:Y,props:ve,_owner:Se}},Dn.createContext=function(W){return W={$$typeof:c,_currentValue:W,_currentValue2:W,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},W.Provider={$$typeof:l,_context:W},W.Consumer=W},Dn.createElement=L,Dn.createFactory=function(W){var J=L.bind(null,W);return J.type=W,J},Dn.createRef=function(){return{current:null}},Dn.forwardRef=function(W){return{$$typeof:d,render:W}},Dn.isValidElement=F,Dn.lazy=function(W){return{$$typeof:v,_payload:{_status:-1,_result:W},_init:G}},Dn.memo=function(W,J){return{$$typeof:f,type:W,compare:J===void 0?null:J}},Dn.startTransition=function(W){var J=U.transition;U.transition={};try{W()}finally{U.transition=J}},Dn.unstable_act=P,Dn.useCallback=function(W,J){return q.current.useCallback(W,J)},Dn.useContext=function(W){return q.current.useContext(W)},Dn.useDebugValue=function(){},Dn.useDeferredValue=function(W){return q.current.useDeferredValue(W)},Dn.useEffect=function(W,J){return q.current.useEffect(W,J)},Dn.useId=function(){return q.current.useId()},Dn.useImperativeHandle=function(W,J,R){return q.current.useImperativeHandle(W,J,R)},Dn.useInsertionEffect=function(W,J){return q.current.useInsertionEffect(W,J)},Dn.useLayoutEffect=function(W,J){return q.current.useLayoutEffect(W,J)},Dn.useMemo=function(W,J){return q.current.useMemo(W,J)},Dn.useReducer=function(W,J,R){return q.current.useReducer(W,J,R)},Dn.useRef=function(W){return q.current.useRef(W)},Dn.useState=function(W){return q.current.useState(W)},Dn.useSyncExternalStore=function(W,J,R){return q.current.useSyncExternalStore(W,J,R)},Dn.useTransition=function(){return q.current.useTransition()},Dn.version="18.3.1",Dn}var Pk;function Bb(){return Pk||(Pk=1,sf.exports=VM()),sf.exports}/**
|
|
11
|
-
* @license React
|
|
12
|
-
* react-jsx-runtime.production.min.js
|
|
13
|
-
*
|
|
14
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
15
|
-
*
|
|
16
|
-
* This source code is licensed under the MIT license found in the
|
|
17
|
-
* LICENSE file in the root directory of this source tree.
|
|
18
|
-
*/var Dk;function GM(){if(Dk)return wc;Dk=1;var e=Bb(),t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function c(d,m,f){var v,g={},w=null,k=null;f!==void 0&&(w=""+f),m.key!==void 0&&(w=""+m.key),m.ref!==void 0&&(k=m.ref);for(v in m)s.call(m,v)&&!l.hasOwnProperty(v)&&(g[v]=m[v]);if(d&&d.defaultProps)for(v in m=d.defaultProps,m)g[v]===void 0&&(g[v]=m[v]);return{$$typeof:t,type:d,key:w,ref:k,props:g,_owner:i.current}}return wc.Fragment=r,wc.jsx=c,wc.jsxs=c,wc}var Rk;function KM(){return Rk||(Rk=1,rf.exports=GM()),rf.exports}var n=KM(),Dd={},af={exports:{}},Ps={},of={exports:{}},lf={};/**
|
|
19
|
-
* @license React
|
|
20
|
-
* scheduler.production.min.js
|
|
21
|
-
*
|
|
22
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
23
|
-
*
|
|
24
|
-
* This source code is licensed under the MIT license found in the
|
|
25
|
-
* LICENSE file in the root directory of this source tree.
|
|
26
|
-
*/var Ak;function YM(){return Ak||(Ak=1,(function(e){function t(U,Q){var P=U.length;U.push(Q);e:for(;0<P;){var W=P-1>>>1,J=U[W];if(0<i(J,Q))U[W]=Q,U[P]=J,P=W;else break e}}function r(U){return U.length===0?null:U[0]}function s(U){if(U.length===0)return null;var Q=U[0],P=U.pop();if(P!==Q){U[0]=P;e:for(var W=0,J=U.length,R=J>>>1;W<R;){var ve=2*(W+1)-1,pe=U[ve],Y=ve+1,Se=U[Y];if(0>i(pe,P))Y<J&&0>i(Se,pe)?(U[W]=Se,U[Y]=P,W=Y):(U[W]=pe,U[ve]=P,W=ve);else if(Y<J&&0>i(Se,P))U[W]=Se,U[Y]=P,W=Y;else break e}}return Q}function i(U,Q){var P=U.sortIndex-Q.sortIndex;return P!==0?P:U.id-Q.id}if(typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var c=Date,d=c.now();e.unstable_now=function(){return c.now()-d}}var m=[],f=[],v=1,g=null,w=3,k=!1,y=!1,S=!1,T=typeof setTimeout=="function"?setTimeout:null,j=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function D(U){for(var Q=r(f);Q!==null;){if(Q.callback===null)s(f);else if(Q.startTime<=U)s(f),Q.sortIndex=Q.expirationTime,t(m,Q);else break;Q=r(f)}}function H(U){if(S=!1,D(U),!y)if(r(m)!==null)y=!0,G(B);else{var Q=r(f);Q!==null&&q(H,Q.startTime-U)}}function B(U,Q){y=!1,S&&(S=!1,j(L),L=-1),k=!0;var P=w;try{for(D(Q),g=r(m);g!==null&&(!(g.expirationTime>Q)||U&&!te());){var W=g.callback;if(typeof W=="function"){g.callback=null,w=g.priorityLevel;var J=W(g.expirationTime<=Q);Q=e.unstable_now(),typeof J=="function"?g.callback=J:g===r(m)&&s(m),D(Q)}else s(m);g=r(m)}if(g!==null)var R=!0;else{var ve=r(f);ve!==null&&q(H,ve.startTime-Q),R=!1}return R}finally{g=null,w=P,k=!1}}var I=!1,A=null,L=-1,_=5,F=-1;function te(){return!(e.unstable_now()-F<_)}function E(){if(A!==null){var U=e.unstable_now();F=U;var Q=!0;try{Q=A(!0,U)}finally{Q?se():(I=!1,A=null)}}else I=!1}var se;if(typeof N=="function")se=function(){N(E)};else if(typeof MessageChannel<"u"){var X=new MessageChannel,K=X.port2;X.port1.onmessage=E,se=function(){K.postMessage(null)}}else se=function(){T(E,0)};function G(U){A=U,I||(I=!0,se())}function q(U,Q){L=T(function(){U(e.unstable_now())},Q)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(U){U.callback=null},e.unstable_continueExecution=function(){y||k||(y=!0,G(B))},e.unstable_forceFrameRate=function(U){0>U||125<U?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):_=0<U?Math.floor(1e3/U):5},e.unstable_getCurrentPriorityLevel=function(){return w},e.unstable_getFirstCallbackNode=function(){return r(m)},e.unstable_next=function(U){switch(w){case 1:case 2:case 3:var Q=3;break;default:Q=w}var P=w;w=Q;try{return U()}finally{w=P}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(U,Q){switch(U){case 1:case 2:case 3:case 4:case 5:break;default:U=3}var P=w;w=U;try{return Q()}finally{w=P}},e.unstable_scheduleCallback=function(U,Q,P){var W=e.unstable_now();switch(typeof P=="object"&&P!==null?(P=P.delay,P=typeof P=="number"&&0<P?W+P:W):P=W,U){case 1:var J=-1;break;case 2:J=250;break;case 5:J=1073741823;break;case 4:J=1e4;break;default:J=5e3}return J=P+J,U={id:v++,callback:Q,priorityLevel:U,startTime:P,expirationTime:J,sortIndex:-1},P>W?(U.sortIndex=P,t(f,U),r(m)===null&&U===r(f)&&(S?(j(L),L=-1):S=!0,q(H,P-W))):(U.sortIndex=J,t(m,U),y||k||(y=!0,G(B))),U},e.unstable_shouldYield=te,e.unstable_wrapCallback=function(U){var Q=w;return function(){var P=w;w=Q;try{return U.apply(this,arguments)}finally{w=P}}}})(lf)),lf}var Mk;function XM(){return Mk||(Mk=1,of.exports=YM()),of.exports}/**
|
|
27
|
-
* @license React
|
|
28
|
-
* react-dom.production.min.js
|
|
29
|
-
*
|
|
30
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
31
|
-
*
|
|
32
|
-
* This source code is licensed under the MIT license found in the
|
|
33
|
-
* LICENSE file in the root directory of this source tree.
|
|
34
|
-
*/var Ik;function QM(){if(Ik)return Ps;Ik=1;var e=Bb(),t=XM();function r(a){for(var u="https://reactjs.org/docs/error-decoder.html?invariant="+a,h=1;h<arguments.length;h++)u+="&args[]="+encodeURIComponent(arguments[h]);return"Minified React error #"+a+"; visit "+u+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var s=new Set,i={};function l(a,u){c(a,u),c(a+"Capture",u)}function c(a,u){for(i[a]=u,a=0;a<u.length;a++)s.add(u[a])}var d=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),m=Object.prototype.hasOwnProperty,f=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,v={},g={};function w(a){return m.call(g,a)?!0:m.call(v,a)?!1:f.test(a)?g[a]=!0:(v[a]=!0,!1)}function k(a,u,h,b){if(h!==null&&h.type===0)return!1;switch(typeof u){case"function":case"symbol":return!0;case"boolean":return b?!1:h!==null?!h.acceptsBooleans:(a=a.toLowerCase().slice(0,5),a!=="data-"&&a!=="aria-");default:return!1}}function y(a,u,h,b){if(u===null||typeof u>"u"||k(a,u,h,b))return!0;if(b)return!1;if(h!==null)switch(h.type){case 3:return!u;case 4:return u===!1;case 5:return isNaN(u);case 6:return isNaN(u)||1>u}return!1}function S(a,u,h,b,x,C,M){this.acceptsBooleans=u===2||u===3||u===4,this.attributeName=b,this.attributeNamespace=x,this.mustUseProperty=h,this.propertyName=a,this.type=u,this.sanitizeURL=C,this.removeEmptyString=M}var T={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(a){T[a]=new S(a,0,!1,a,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(a){var u=a[0];T[u]=new S(u,1,!1,a[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(a){T[a]=new S(a,2,!1,a.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(a){T[a]=new S(a,2,!1,a,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(a){T[a]=new S(a,3,!1,a.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(a){T[a]=new S(a,3,!0,a,null,!1,!1)}),["capture","download"].forEach(function(a){T[a]=new S(a,4,!1,a,null,!1,!1)}),["cols","rows","size","span"].forEach(function(a){T[a]=new S(a,6,!1,a,null,!1,!1)}),["rowSpan","start"].forEach(function(a){T[a]=new S(a,5,!1,a.toLowerCase(),null,!1,!1)});var j=/[\-:]([a-z])/g;function N(a){return a[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(a){var u=a.replace(j,N);T[u]=new S(u,1,!1,a,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(a){var u=a.replace(j,N);T[u]=new S(u,1,!1,a,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(a){var u=a.replace(j,N);T[u]=new S(u,1,!1,a,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(a){T[a]=new S(a,1,!1,a.toLowerCase(),null,!1,!1)}),T.xlinkHref=new S("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(a){T[a]=new S(a,1,!1,a.toLowerCase(),null,!0,!0)});function D(a,u,h,b){var x=T.hasOwnProperty(u)?T[u]:null;(x!==null?x.type!==0:b||!(2<u.length)||u[0]!=="o"&&u[0]!=="O"||u[1]!=="n"&&u[1]!=="N")&&(y(u,h,x,b)&&(h=null),b||x===null?w(u)&&(h===null?a.removeAttribute(u):a.setAttribute(u,""+h)):x.mustUseProperty?a[x.propertyName]=h===null?x.type===3?!1:"":h:(u=x.attributeName,b=x.attributeNamespace,h===null?a.removeAttribute(u):(x=x.type,h=x===3||x===4&&h===!0?"":""+h,b?a.setAttributeNS(b,u,h):a.setAttribute(u,h))))}var H=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,B=Symbol.for("react.element"),I=Symbol.for("react.portal"),A=Symbol.for("react.fragment"),L=Symbol.for("react.strict_mode"),_=Symbol.for("react.profiler"),F=Symbol.for("react.provider"),te=Symbol.for("react.context"),E=Symbol.for("react.forward_ref"),se=Symbol.for("react.suspense"),X=Symbol.for("react.suspense_list"),K=Symbol.for("react.memo"),G=Symbol.for("react.lazy"),q=Symbol.for("react.offscreen"),U=Symbol.iterator;function Q(a){return a===null||typeof a!="object"?null:(a=U&&a[U]||a["@@iterator"],typeof a=="function"?a:null)}var P=Object.assign,W;function J(a){if(W===void 0)try{throw Error()}catch(h){var u=h.stack.trim().match(/\n( *(at )?)/);W=u&&u[1]||""}return`
|
|
35
|
-
`+W+a}var R=!1;function ve(a,u){if(!a||R)return"";R=!0;var h=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(u)if(u=function(){throw Error()},Object.defineProperty(u.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(u,[])}catch(Me){var b=Me}Reflect.construct(a,[],u)}else{try{u.call()}catch(Me){b=Me}a.call(u.prototype)}else{try{throw Error()}catch(Me){b=Me}a()}}catch(Me){if(Me&&b&&typeof Me.stack=="string"){for(var x=Me.stack.split(`
|
|
36
|
-
`),C=b.stack.split(`
|
|
37
|
-
`),M=x.length-1,ee=C.length-1;1<=M&&0<=ee&&x[M]!==C[ee];)ee--;for(;1<=M&&0<=ee;M--,ee--)if(x[M]!==C[ee]){if(M!==1||ee!==1)do if(M--,ee--,0>ee||x[M]!==C[ee]){var le=`
|
|
38
|
-
`+x[M].replace(" at new "," at ");return a.displayName&&le.includes("<anonymous>")&&(le=le.replace("<anonymous>",a.displayName)),le}while(1<=M&&0<=ee);break}}}finally{R=!1,Error.prepareStackTrace=h}return(a=a?a.displayName||a.name:"")?J(a):""}function pe(a){switch(a.tag){case 5:return J(a.type);case 16:return J("Lazy");case 13:return J("Suspense");case 19:return J("SuspenseList");case 0:case 2:case 15:return a=ve(a.type,!1),a;case 11:return a=ve(a.type.render,!1),a;case 1:return a=ve(a.type,!0),a;default:return""}}function Y(a){if(a==null)return null;if(typeof a=="function")return a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case A:return"Fragment";case I:return"Portal";case _:return"Profiler";case L:return"StrictMode";case se:return"Suspense";case X:return"SuspenseList"}if(typeof a=="object")switch(a.$$typeof){case te:return(a.displayName||"Context")+".Consumer";case F:return(a._context.displayName||"Context")+".Provider";case E:var u=a.render;return a=a.displayName,a||(a=u.displayName||u.name||"",a=a!==""?"ForwardRef("+a+")":"ForwardRef"),a;case K:return u=a.displayName||null,u!==null?u:Y(a.type)||"Memo";case G:u=a._payload,a=a._init;try{return Y(a(u))}catch{}}return null}function Se(a){var u=a.type;switch(a.tag){case 24:return"Cache";case 9:return(u.displayName||"Context")+".Consumer";case 10:return(u._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return a=u.render,a=a.displayName||a.name||"",u.displayName||(a!==""?"ForwardRef("+a+")":"ForwardRef");case 7:return"Fragment";case 5:return u;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Y(u);case 8:return u===L?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof u=="function")return u.displayName||u.name||null;if(typeof u=="string")return u}return null}function Le(a){switch(typeof a){case"boolean":case"number":case"string":case"undefined":return a;case"object":return a;default:return""}}function re(a){var u=a.type;return(a=a.nodeName)&&a.toLowerCase()==="input"&&(u==="checkbox"||u==="radio")}function Ce(a){var u=re(a)?"checked":"value",h=Object.getOwnPropertyDescriptor(a.constructor.prototype,u),b=""+a[u];if(!a.hasOwnProperty(u)&&typeof h<"u"&&typeof h.get=="function"&&typeof h.set=="function"){var x=h.get,C=h.set;return Object.defineProperty(a,u,{configurable:!0,get:function(){return x.call(this)},set:function(M){b=""+M,C.call(this,M)}}),Object.defineProperty(a,u,{enumerable:h.enumerable}),{getValue:function(){return b},setValue:function(M){b=""+M},stopTracking:function(){a._valueTracker=null,delete a[u]}}}}function Xe(a){a._valueTracker||(a._valueTracker=Ce(a))}function Ue(a){if(!a)return!1;var u=a._valueTracker;if(!u)return!0;var h=u.getValue(),b="";return a&&(b=re(a)?a.checked?"true":"false":a.value),a=b,a!==h?(u.setValue(a),!0):!1}function ct(a){if(a=a||(typeof document<"u"?document:void 0),typeof a>"u")return null;try{return a.activeElement||a.body}catch{return a.body}}function Nt(a,u){var h=u.checked;return P({},u,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:h??a._wrapperState.initialChecked})}function Ke(a,u){var h=u.defaultValue==null?"":u.defaultValue,b=u.checked!=null?u.checked:u.defaultChecked;h=Le(u.value!=null?u.value:h),a._wrapperState={initialChecked:b,initialValue:h,controlled:u.type==="checkbox"||u.type==="radio"?u.checked!=null:u.value!=null}}function ut(a,u){u=u.checked,u!=null&&D(a,"checked",u,!1)}function vt(a,u){ut(a,u);var h=Le(u.value),b=u.type;if(h!=null)b==="number"?(h===0&&a.value===""||a.value!=h)&&(a.value=""+h):a.value!==""+h&&(a.value=""+h);else if(b==="submit"||b==="reset"){a.removeAttribute("value");return}u.hasOwnProperty("value")?_e(a,u.type,h):u.hasOwnProperty("defaultValue")&&_e(a,u.type,Le(u.defaultValue)),u.checked==null&&u.defaultChecked!=null&&(a.defaultChecked=!!u.defaultChecked)}function Te(a,u,h){if(u.hasOwnProperty("value")||u.hasOwnProperty("defaultValue")){var b=u.type;if(!(b!=="submit"&&b!=="reset"||u.value!==void 0&&u.value!==null))return;u=""+a._wrapperState.initialValue,h||u===a.value||(a.value=u),a.defaultValue=u}h=a.name,h!==""&&(a.name=""),a.defaultChecked=!!a._wrapperState.initialChecked,h!==""&&(a.name=h)}function _e(a,u,h){(u!=="number"||ct(a.ownerDocument)!==a)&&(h==null?a.defaultValue=""+a._wrapperState.initialValue:a.defaultValue!==""+h&&(a.defaultValue=""+h))}var we=Array.isArray;function qe(a,u,h,b){if(a=a.options,u){u={};for(var x=0;x<h.length;x++)u["$"+h[x]]=!0;for(h=0;h<a.length;h++)x=u.hasOwnProperty("$"+a[h].value),a[h].selected!==x&&(a[h].selected=x),x&&b&&(a[h].defaultSelected=!0)}else{for(h=""+Le(h),u=null,x=0;x<a.length;x++){if(a[x].value===h){a[x].selected=!0,b&&(a[x].defaultSelected=!0);return}u!==null||a[x].disabled||(u=a[x])}u!==null&&(u.selected=!0)}}function ke(a,u){if(u.dangerouslySetInnerHTML!=null)throw Error(r(91));return P({},u,{value:void 0,defaultValue:void 0,children:""+a._wrapperState.initialValue})}function Ee(a,u){var h=u.value;if(h==null){if(h=u.children,u=u.defaultValue,h!=null){if(u!=null)throw Error(r(92));if(we(h)){if(1<h.length)throw Error(r(93));h=h[0]}u=h}u==null&&(u=""),h=u}a._wrapperState={initialValue:Le(h)}}function $e(a,u){var h=Le(u.value),b=Le(u.defaultValue);h!=null&&(h=""+h,h!==a.value&&(a.value=h),u.defaultValue==null&&a.defaultValue!==h&&(a.defaultValue=h)),b!=null&&(a.defaultValue=""+b)}function wt(a){var u=a.textContent;u===a._wrapperState.initialValue&&u!==""&&u!==null&&(a.value=u)}function me(a){switch(a){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Pe(a,u){return a==null||a==="http://www.w3.org/1999/xhtml"?me(u):a==="http://www.w3.org/2000/svg"&&u==="foreignObject"?"http://www.w3.org/1999/xhtml":a}var Ge,dt=(function(a){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(u,h,b,x){MSApp.execUnsafeLocalFunction(function(){return a(u,h,b,x)})}:a})(function(a,u){if(a.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in a)a.innerHTML=u;else{for(Ge=Ge||document.createElement("div"),Ge.innerHTML="<svg>"+u.valueOf().toString()+"</svg>",u=Ge.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;u.firstChild;)a.appendChild(u.firstChild)}});function Ye(a,u){if(u){var h=a.firstChild;if(h&&h===a.lastChild&&h.nodeType===3){h.nodeValue=u;return}}a.textContent=u}var Dt={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},ae=["Webkit","ms","Moz","O"];Object.keys(Dt).forEach(function(a){ae.forEach(function(u){u=u+a.charAt(0).toUpperCase()+a.substring(1),Dt[u]=Dt[a]})});function We(a,u,h){return u==null||typeof u=="boolean"||u===""?"":h||typeof u!="number"||u===0||Dt.hasOwnProperty(a)&&Dt[a]?(""+u).trim():u+"px"}function jt(a,u){a=a.style;for(var h in u)if(u.hasOwnProperty(h)){var b=h.indexOf("--")===0,x=We(h,u[h],b);h==="float"&&(h="cssFloat"),b?a.setProperty(h,x):a[h]=x}}var Rt=P({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function cn(a,u){if(u){if(Rt[a]&&(u.children!=null||u.dangerouslySetInnerHTML!=null))throw Error(r(137,a));if(u.dangerouslySetInnerHTML!=null){if(u.children!=null)throw Error(r(60));if(typeof u.dangerouslySetInnerHTML!="object"||!("__html"in u.dangerouslySetInnerHTML))throw Error(r(61))}if(u.style!=null&&typeof u.style!="object")throw Error(r(62))}}function Vt(a,u){if(a.indexOf("-")===-1)return typeof u.is=="string";switch(a){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Gt=null;function pn(a){return a=a.target||a.srcElement||window,a.correspondingUseElement&&(a=a.correspondingUseElement),a.nodeType===3?a.parentNode:a}var ie=null,Be=null,Mt=null;function Tt(a){if(a=sc(a)){if(typeof ie!="function")throw Error(r(280));var u=a.stateNode;u&&(u=qu(u),ie(a.stateNode,a.type,u))}}function xn(a){Be?Mt?Mt.push(a):Mt=[a]:Be=a}function dn(){if(Be){var a=Be,u=Mt;if(Mt=Be=null,Tt(a),u)for(a=0;a<u.length;a++)Tt(u[a])}}function Nn(a,u){return a(u)}function Sn(){}var Et=!1;function In(a,u,h){if(Et)return a(u,h);Et=!0;try{return Nn(a,u,h)}finally{Et=!1,(Be!==null||Mt!==null)&&(Sn(),dn())}}function wn(a,u){var h=a.stateNode;if(h===null)return null;var b=qu(h);if(b===null)return null;h=b[u];e:switch(u){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(b=!b.disabled)||(a=a.type,b=!(a==="button"||a==="input"||a==="select"||a==="textarea")),a=!b;break e;default:a=!1}if(a)return null;if(h&&typeof h!="function")throw Error(r(231,u,typeof h));return h}var Z=!1;if(d)try{var ce={};Object.defineProperty(ce,"passive",{get:function(){Z=!0}}),window.addEventListener("test",ce,ce),window.removeEventListener("test",ce,ce)}catch{Z=!1}function ge(a,u,h,b,x,C,M,ee,le){var Me=Array.prototype.slice.call(arguments,3);try{u.apply(h,Me)}catch(et){this.onError(et)}}var Ie=!1,He=null,Je=!1,ft=null,gt={onError:function(a){Ie=!0,He=a}};function nt(a,u,h,b,x,C,M,ee,le){Ie=!1,He=null,ge.apply(gt,arguments)}function yt(a,u,h,b,x,C,M,ee,le){if(nt.apply(this,arguments),Ie){if(Ie){var Me=He;Ie=!1,He=null}else throw Error(r(198));Je||(Je=!0,ft=Me)}}function rt(a){var u=a,h=a;if(a.alternate)for(;u.return;)u=u.return;else{a=u;do u=a,(u.flags&4098)!==0&&(h=u.return),a=u.return;while(a)}return u.tag===3?h:null}function oe(a){if(a.tag===13){var u=a.memoizedState;if(u===null&&(a=a.alternate,a!==null&&(u=a.memoizedState)),u!==null)return u.dehydrated}return null}function Ne(a){if(rt(a)!==a)throw Error(r(188))}function Lt(a){var u=a.alternate;if(!u){if(u=rt(a),u===null)throw Error(r(188));return u!==a?null:a}for(var h=a,b=u;;){var x=h.return;if(x===null)break;var C=x.alternate;if(C===null){if(b=x.return,b!==null){h=b;continue}break}if(x.child===C.child){for(C=x.child;C;){if(C===h)return Ne(x),a;if(C===b)return Ne(x),u;C=C.sibling}throw Error(r(188))}if(h.return!==b.return)h=x,b=C;else{for(var M=!1,ee=x.child;ee;){if(ee===h){M=!0,h=x,b=C;break}if(ee===b){M=!0,b=x,h=C;break}ee=ee.sibling}if(!M){for(ee=C.child;ee;){if(ee===h){M=!0,h=C,b=x;break}if(ee===b){M=!0,b=C,h=x;break}ee=ee.sibling}if(!M)throw Error(r(189))}}if(h.alternate!==b)throw Error(r(190))}if(h.tag!==3)throw Error(r(188));return h.stateNode.current===h?a:u}function Wt(a){return a=Lt(a),a!==null?Kt(a):null}function Kt(a){if(a.tag===5||a.tag===6)return a;for(a=a.child;a!==null;){var u=Kt(a);if(u!==null)return u;a=a.sibling}return null}var un=t.unstable_scheduleCallback,En=t.unstable_cancelCallback,Hn=t.unstable_shouldYield,jn=t.unstable_requestPaint,Qt=t.unstable_now,ir=t.unstable_getCurrentPriorityLevel,De=t.unstable_ImmediatePriority,ze=t.unstable_UserBlockingPriority,$t=t.unstable_NormalPriority,an=t.unstable_LowPriority,kt=t.unstable_IdlePriority,Zt=null,Pn=null;function Sr(a){if(Pn&&typeof Pn.onCommitFiberRoot=="function")try{Pn.onCommitFiberRoot(Zt,a,void 0,(a.current.flags&128)===128)}catch{}}var Jt=Math.clz32?Math.clz32:ar,Un=Math.log,gr=Math.LN2;function ar(a){return a>>>=0,a===0?32:31-(Un(a)/gr|0)|0}var qn=64,br=4194304;function zn(a){switch(a&-a){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return a&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return a}}function Cr(a,u){var h=a.pendingLanes;if(h===0)return 0;var b=0,x=a.suspendedLanes,C=a.pingedLanes,M=h&268435455;if(M!==0){var ee=M&~x;ee!==0?b=zn(ee):(C&=M,C!==0&&(b=zn(C)))}else M=h&~x,M!==0?b=zn(M):C!==0&&(b=zn(C));if(b===0)return 0;if(u!==0&&u!==b&&(u&x)===0&&(x=b&-b,C=u&-u,x>=C||x===16&&(C&4194240)!==0))return u;if((b&4)!==0&&(b|=h&16),u=a.entangledLanes,u!==0)for(a=a.entanglements,u&=b;0<u;)h=31-Jt(u),x=1<<h,b|=a[h],u&=~x;return b}function Yr(a,u){switch(a){case 1:case 2:case 4:return u+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return u+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ls(a,u){for(var h=a.suspendedLanes,b=a.pingedLanes,x=a.expirationTimes,C=a.pendingLanes;0<C;){var M=31-Jt(C),ee=1<<M,le=x[M];le===-1?((ee&h)===0||(ee&b)!==0)&&(x[M]=Yr(ee,u)):le<=u&&(a.expiredLanes|=ee),C&=~ee}}function ts(a){return a=a.pendingLanes&-1073741825,a!==0?a:a&1073741824?1073741824:0}function Hr(){var a=qn;return qn<<=1,(qn&4194240)===0&&(qn=64),a}function cs(a){for(var u=[],h=0;31>h;h++)u.push(a);return u}function Ir(a,u,h){a.pendingLanes|=u,u!==536870912&&(a.suspendedLanes=0,a.pingedLanes=0),a=a.eventTimes,u=31-Jt(u),a[u]=h}function vr(a,u){var h=a.pendingLanes&~u;a.pendingLanes=u,a.suspendedLanes=0,a.pingedLanes=0,a.expiredLanes&=u,a.mutableReadLanes&=u,a.entangledLanes&=u,u=a.entanglements;var b=a.eventTimes;for(a=a.expirationTimes;0<h;){var x=31-Jt(h),C=1<<x;u[x]=0,b[x]=-1,a[x]=-1,h&=~C}}function wr(a,u){var h=a.entangledLanes|=u;for(a=a.entanglements;h;){var b=31-Jt(h),x=1<<b;x&u|a[b]&u&&(a[b]|=u),h&=~x}}var Yt=0;function bn(a){return a&=-a,1<a?4<a?(a&268435455)!==0?16:536870912:4:1}var yn,Tn,or,ue,Ve,St=!1,It=[],vn=null,fn=null,ln=null,jr=new Map,Gn=new Map,zr=[],us="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function zt(a,u){switch(a){case"focusin":case"focusout":vn=null;break;case"dragenter":case"dragleave":fn=null;break;case"mouseover":case"mouseout":ln=null;break;case"pointerover":case"pointerout":jr.delete(u.pointerId);break;case"gotpointercapture":case"lostpointercapture":Gn.delete(u.pointerId)}}function V(a,u,h,b,x,C){return a===null||a.nativeEvent!==C?(a={blockedOn:u,domEventName:h,eventSystemFlags:b,nativeEvent:C,targetContainers:[x]},u!==null&&(u=sc(u),u!==null&&Tn(u)),a):(a.eventSystemFlags|=b,u=a.targetContainers,x!==null&&u.indexOf(x)===-1&&u.push(x),a)}function fe(a,u,h,b,x){switch(u){case"focusin":return vn=V(vn,a,u,h,b,x),!0;case"dragenter":return fn=V(fn,a,u,h,b,x),!0;case"mouseover":return ln=V(ln,a,u,h,b,x),!0;case"pointerover":var C=x.pointerId;return jr.set(C,V(jr.get(C)||null,a,u,h,b,x)),!0;case"gotpointercapture":return C=x.pointerId,Gn.set(C,V(Gn.get(C)||null,a,u,h,b,x)),!0}return!1}function xe(a){var u=ao(a.target);if(u!==null){var h=rt(u);if(h!==null){if(u=h.tag,u===13){if(u=oe(h),u!==null){a.blockedOn=u,Ve(a.priority,function(){or(h)});return}}else if(u===3&&h.stateNode.current.memoizedState.isDehydrated){a.blockedOn=h.tag===3?h.stateNode.containerInfo:null;return}}}a.blockedOn=null}function at(a){if(a.blockedOn!==null)return!1;for(var u=a.targetContainers;0<u.length;){var h=lr(a.domEventName,a.eventSystemFlags,u[0],a.nativeEvent);if(h===null){h=a.nativeEvent;var b=new h.constructor(h.type,h);Gt=b,h.target.dispatchEvent(b),Gt=null}else return u=sc(h),u!==null&&Tn(u),a.blockedOn=h,!1;u.shift()}return!0}function ht(a,u,h){at(a)&&h.delete(u)}function ot(){St=!1,vn!==null&&at(vn)&&(vn=null),fn!==null&&at(fn)&&(fn=null),ln!==null&&at(ln)&&(ln=null),jr.forEach(ht),Gn.forEach(ht)}function tn(a,u){a.blockedOn===u&&(a.blockedOn=null,St||(St=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,ot)))}function Ln(a){function u(x){return tn(x,a)}if(0<It.length){tn(It[0],a);for(var h=1;h<It.length;h++){var b=It[h];b.blockedOn===a&&(b.blockedOn=null)}}for(vn!==null&&tn(vn,a),fn!==null&&tn(fn,a),ln!==null&&tn(ln,a),jr.forEach(u),Gn.forEach(u),h=0;h<zr.length;h++)b=zr[h],b.blockedOn===a&&(b.blockedOn=null);for(;0<zr.length&&(h=zr[0],h.blockedOn===null);)xe(h),h.blockedOn===null&&zr.shift()}var Jn=H.ReactCurrentBatchConfig,Nr=!0;function Ks(a,u,h,b){var x=Yt,C=Jn.transition;Jn.transition=null;try{Yt=1,Lr(a,u,h,b)}finally{Yt=x,Jn.transition=C}}function Er(a,u,h,b){var x=Yt,C=Jn.transition;Jn.transition=null;try{Yt=4,Lr(a,u,h,b)}finally{Yt=x,Jn.transition=C}}function Lr(a,u,h,b){if(Nr){var x=lr(a,u,h,b);if(x===null)Gm(a,u,b,xs,h),zt(a,b);else if(fe(x,a,u,h,b))b.stopPropagation();else if(zt(a,b),u&4&&-1<us.indexOf(a)){for(;x!==null;){var C=sc(x);if(C!==null&&yn(C),C=lr(a,u,h,b),C===null&&Gm(a,u,b,xs,h),C===x)break;x=C}x!==null&&b.stopPropagation()}else Gm(a,u,b,null,h)}}var xs=null;function lr(a,u,h,b){if(xs=null,a=pn(b),a=ao(a),a!==null)if(u=rt(a),u===null)a=null;else if(h=u.tag,h===13){if(a=oe(u),a!==null)return a;a=null}else if(h===3){if(u.stateNode.current.memoizedState.isDehydrated)return u.tag===3?u.stateNode.containerInfo:null;a=null}else u!==a&&(a=null);return xs=a,null}function Di(a){switch(a){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(ir()){case De:return 1;case ze:return 4;case $t:case an:return 16;case kt:return 536870912;default:return 16}default:return 16}}var ds=null,Xi=null,Xr=null;function Qr(){if(Xr)return Xr;var a,u=Xi,h=u.length,b,x="value"in ds?ds.value:ds.textContent,C=x.length;for(a=0;a<h&&u[a]===x[a];a++);var M=h-a;for(b=1;b<=M&&u[h-b]===x[C-b];b++);return Xr=x.slice(a,1<b?1-b:void 0)}function hi(a){var u=a.keyCode;return"charCode"in a?(a=a.charCode,a===0&&u===13&&(a=13)):a=u,a===10&&(a=13),32<=a||a===13?a:0}function mi(){return!0}function Ri(){return!1}function qr(a){function u(h,b,x,C,M){this._reactName=h,this._targetInst=x,this.type=b,this.nativeEvent=C,this.target=M,this.currentTarget=null;for(var ee in a)a.hasOwnProperty(ee)&&(h=a[ee],this[ee]=h?h(C):C[ee]);return this.isDefaultPrevented=(C.defaultPrevented!=null?C.defaultPrevented:C.returnValue===!1)?mi:Ri,this.isPropagationStopped=Ri,this}return P(u.prototype,{preventDefault:function(){this.defaultPrevented=!0;var h=this.nativeEvent;h&&(h.preventDefault?h.preventDefault():typeof h.returnValue!="unknown"&&(h.returnValue=!1),this.isDefaultPrevented=mi)},stopPropagation:function(){var h=this.nativeEvent;h&&(h.stopPropagation?h.stopPropagation():typeof h.cancelBubble!="unknown"&&(h.cancelBubble=!0),this.isPropagationStopped=mi)},persist:function(){},isPersistent:mi}),u}var $={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(a){return a.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},be=qr($),lt=P({},$,{view:0,detail:0}),Pt=qr(lt),en,ns,Ai,Qi=P({},lt,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:xa,button:0,buttons:0,relatedTarget:function(a){return a.relatedTarget===void 0?a.fromElement===a.srcElement?a.toElement:a.fromElement:a.relatedTarget},movementX:function(a){return"movementX"in a?a.movementX:(a!==Ai&&(Ai&&a.type==="mousemove"?(en=a.screenX-Ai.screenX,ns=a.screenY-Ai.screenY):ns=en=0,Ai=a),en)},movementY:function(a){return"movementY"in a?a.movementY:ns}}),wa=qr(Qi),ya=P({},Qi,{dataTransfer:0}),no=qr(ya),$o=P({},lt,{relatedTarget:0}),pi=qr($o),ka=P({},$,{animationName:0,elapsedTime:0,pseudoElement:0}),Yl=qr(ka),Vo=P({},$,{clipboardData:function(a){return"clipboardData"in a?a.clipboardData:window.clipboardData}}),Xl=qr(Vo),Ql=P({},$,{data:0}),ro=qr(Ql),Ji={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Go={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Ko={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Yo(a){var u=this.nativeEvent;return u.getModifierState?u.getModifierState(a):(a=Ko[a])?!!u[a]:!1}function xa(){return Yo}var Xo=P({},lt,{key:function(a){if(a.key){var u=Ji[a.key]||a.key;if(u!=="Unidentified")return u}return a.type==="keypress"?(a=hi(a),a===13?"Enter":String.fromCharCode(a)):a.type==="keydown"||a.type==="keyup"?Go[a.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:xa,charCode:function(a){return a.type==="keypress"?hi(a):0},keyCode:function(a){return a.type==="keydown"||a.type==="keyup"?a.keyCode:0},which:function(a){return a.type==="keypress"?hi(a):a.type==="keydown"||a.type==="keyup"?a.keyCode:0}}),so=qr(Xo),Qo=P({},Qi,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ys=qr(Qo),io=P({},lt,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:xa}),z=qr(io),de=P({},$,{propertyName:0,elapsedTime:0,pseudoElement:0}),Ae=qr(de),it=P({},Qi,{deltaX:function(a){return"deltaX"in a?a.deltaX:"wheelDeltaX"in a?-a.wheelDeltaX:0},deltaY:function(a){return"deltaY"in a?a.deltaY:"wheelDeltaY"in a?-a.wheelDeltaY:"wheelDelta"in a?-a.wheelDelta:0},deltaZ:0,deltaMode:0}),mt=qr(it),gn=[9,13,27,32],Ot=d&&"CompositionEvent"in window,Bn=null;d&&"documentMode"in document&&(Bn=document.documentMode);var Pr=d&&"TextEvent"in window&&!Bn,O=d&&(!Ot||Bn&&8<Bn&&11>=Bn),ne=" ",Re=!1;function tt(a,u){switch(a){case"keyup":return gn.indexOf(u.keyCode)!==-1;case"keydown":return u.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function pt(a){return a=a.detail,typeof a=="object"&&"data"in a?a.data:null}var Ct=!1;function Ut(a,u){switch(a){case"compositionend":return pt(u);case"keypress":return u.which!==32?null:(Re=!0,ne);case"textInput":return a=u.data,a===ne&&Re?null:a;default:return null}}function Ht(a,u){if(Ct)return a==="compositionend"||!Ot&&tt(a,u)?(a=Qr(),Xr=Xi=ds=null,Ct=!1,a):null;switch(a){case"paste":return null;case"keypress":if(!(u.ctrlKey||u.altKey||u.metaKey)||u.ctrlKey&&u.altKey){if(u.char&&1<u.char.length)return u.char;if(u.which)return String.fromCharCode(u.which)}return null;case"compositionend":return O&&u.locale!=="ko"?null:u.data;default:return null}}var mn={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function on(a){var u=a&&a.nodeName&&a.nodeName.toLowerCase();return u==="input"?!!mn[a.type]:u==="textarea"}function Zn(a,u,h,b){xn(b),u=Uu(u,"onChange"),0<u.length&&(h=new be("onChange","change",null,h,b),a.push({event:h,listeners:u}))}var rs=null,Dr=null;function ss(a){zw(a,0)}function is(a){var u=nl(a);if(Ue(u))return a}function Zi(a,u){if(a==="change")return u}var Tw=!1;if(d){var Om;if(d){var Bm="oninput"in document;if(!Bm){var Nw=document.createElement("div");Nw.setAttribute("oninput","return;"),Bm=typeof Nw.oninput=="function"}Om=Bm}else Om=!1;Tw=Om&&(!document.documentMode||9<document.documentMode)}function Pw(){rs&&(rs.detachEvent("onpropertychange",Dw),Dr=rs=null)}function Dw(a){if(a.propertyName==="value"&&is(Dr)){var u=[];Zn(u,Dr,a,pn(a)),In(ss,u)}}function VA(a,u,h){a==="focusin"?(Pw(),rs=u,Dr=h,rs.attachEvent("onpropertychange",Dw)):a==="focusout"&&Pw()}function GA(a){if(a==="selectionchange"||a==="keyup"||a==="keydown")return is(Dr)}function KA(a,u){if(a==="click")return is(u)}function YA(a,u){if(a==="input"||a==="change")return is(u)}function XA(a,u){return a===u&&(a!==0||1/a===1/u)||a!==a&&u!==u}var fi=typeof Object.is=="function"?Object.is:XA;function Jl(a,u){if(fi(a,u))return!0;if(typeof a!="object"||a===null||typeof u!="object"||u===null)return!1;var h=Object.keys(a),b=Object.keys(u);if(h.length!==b.length)return!1;for(b=0;b<h.length;b++){var x=h[b];if(!m.call(u,x)||!fi(a[x],u[x]))return!1}return!0}function Rw(a){for(;a&&a.firstChild;)a=a.firstChild;return a}function Aw(a,u){var h=Rw(a);a=0;for(var b;h;){if(h.nodeType===3){if(b=a+h.textContent.length,a<=u&&b>=u)return{node:h,offset:u-a};a=b}e:{for(;h;){if(h.nextSibling){h=h.nextSibling;break e}h=h.parentNode}h=void 0}h=Rw(h)}}function Mw(a,u){return a&&u?a===u?!0:a&&a.nodeType===3?!1:u&&u.nodeType===3?Mw(a,u.parentNode):"contains"in a?a.contains(u):a.compareDocumentPosition?!!(a.compareDocumentPosition(u)&16):!1:!1}function Iw(){for(var a=window,u=ct();u instanceof a.HTMLIFrameElement;){try{var h=typeof u.contentWindow.location.href=="string"}catch{h=!1}if(h)a=u.contentWindow;else break;u=ct(a.document)}return u}function Wm(a){var u=a&&a.nodeName&&a.nodeName.toLowerCase();return u&&(u==="input"&&(a.type==="text"||a.type==="search"||a.type==="tel"||a.type==="url"||a.type==="password")||u==="textarea"||a.contentEditable==="true")}function QA(a){var u=Iw(),h=a.focusedElem,b=a.selectionRange;if(u!==h&&h&&h.ownerDocument&&Mw(h.ownerDocument.documentElement,h)){if(b!==null&&Wm(h)){if(u=b.start,a=b.end,a===void 0&&(a=u),"selectionStart"in h)h.selectionStart=u,h.selectionEnd=Math.min(a,h.value.length);else if(a=(u=h.ownerDocument||document)&&u.defaultView||window,a.getSelection){a=a.getSelection();var x=h.textContent.length,C=Math.min(b.start,x);b=b.end===void 0?C:Math.min(b.end,x),!a.extend&&C>b&&(x=b,b=C,C=x),x=Aw(h,C);var M=Aw(h,b);x&&M&&(a.rangeCount!==1||a.anchorNode!==x.node||a.anchorOffset!==x.offset||a.focusNode!==M.node||a.focusOffset!==M.offset)&&(u=u.createRange(),u.setStart(x.node,x.offset),a.removeAllRanges(),C>b?(a.addRange(u),a.extend(M.node,M.offset)):(u.setEnd(M.node,M.offset),a.addRange(u)))}}for(u=[],a=h;a=a.parentNode;)a.nodeType===1&&u.push({element:a,left:a.scrollLeft,top:a.scrollTop});for(typeof h.focus=="function"&&h.focus(),h=0;h<u.length;h++)a=u[h],a.element.scrollLeft=a.left,a.element.scrollTop=a.top}}var JA=d&&"documentMode"in document&&11>=document.documentMode,Jo=null,Um=null,Zl=null,Hm=!1;function Ew(a,u,h){var b=h.window===h?h.document:h.nodeType===9?h:h.ownerDocument;Hm||Jo==null||Jo!==ct(b)||(b=Jo,"selectionStart"in b&&Wm(b)?b={start:b.selectionStart,end:b.selectionEnd}:(b=(b.ownerDocument&&b.ownerDocument.defaultView||window).getSelection(),b={anchorNode:b.anchorNode,anchorOffset:b.anchorOffset,focusNode:b.focusNode,focusOffset:b.focusOffset}),Zl&&Jl(Zl,b)||(Zl=b,b=Uu(Um,"onSelect"),0<b.length&&(u=new be("onSelect","select",null,u,h),a.push({event:u,listeners:b}),u.target=Jo)))}function Ou(a,u){var h={};return h[a.toLowerCase()]=u.toLowerCase(),h["Webkit"+a]="webkit"+u,h["Moz"+a]="moz"+u,h}var Zo={animationend:Ou("Animation","AnimationEnd"),animationiteration:Ou("Animation","AnimationIteration"),animationstart:Ou("Animation","AnimationStart"),transitionend:Ou("Transition","TransitionEnd")},zm={},Lw={};d&&(Lw=document.createElement("div").style,"AnimationEvent"in window||(delete Zo.animationend.animation,delete Zo.animationiteration.animation,delete Zo.animationstart.animation),"TransitionEvent"in window||delete Zo.transitionend.transition);function Bu(a){if(zm[a])return zm[a];if(!Zo[a])return a;var u=Zo[a],h;for(h in u)if(u.hasOwnProperty(h)&&h in Lw)return zm[a]=u[h];return a}var Fw=Bu("animationend"),_w=Bu("animationiteration"),Ow=Bu("animationstart"),Bw=Bu("transitionend"),Ww=new Map,Uw="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Sa(a,u){Ww.set(a,u),l(u,[a])}for(var qm=0;qm<Uw.length;qm++){var $m=Uw[qm],ZA=$m.toLowerCase(),eM=$m[0].toUpperCase()+$m.slice(1);Sa(ZA,"on"+eM)}Sa(Fw,"onAnimationEnd"),Sa(_w,"onAnimationIteration"),Sa(Ow,"onAnimationStart"),Sa("dblclick","onDoubleClick"),Sa("focusin","onFocus"),Sa("focusout","onBlur"),Sa(Bw,"onTransitionEnd"),c("onMouseEnter",["mouseout","mouseover"]),c("onMouseLeave",["mouseout","mouseover"]),c("onPointerEnter",["pointerout","pointerover"]),c("onPointerLeave",["pointerout","pointerover"]),l("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),l("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),l("onBeforeInput",["compositionend","keypress","textInput","paste"]),l("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ec="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),tM=new Set("cancel close invalid load scroll toggle".split(" ").concat(ec));function Hw(a,u,h){var b=a.type||"unknown-event";a.currentTarget=h,yt(b,u,void 0,a),a.currentTarget=null}function zw(a,u){u=(u&4)!==0;for(var h=0;h<a.length;h++){var b=a[h],x=b.event;b=b.listeners;e:{var C=void 0;if(u)for(var M=b.length-1;0<=M;M--){var ee=b[M],le=ee.instance,Me=ee.currentTarget;if(ee=ee.listener,le!==C&&x.isPropagationStopped())break e;Hw(x,ee,Me),C=le}else for(M=0;M<b.length;M++){if(ee=b[M],le=ee.instance,Me=ee.currentTarget,ee=ee.listener,le!==C&&x.isPropagationStopped())break e;Hw(x,ee,Me),C=le}}}if(Je)throw a=ft,Je=!1,ft=null,a}function cr(a,u){var h=u[Zm];h===void 0&&(h=u[Zm]=new Set);var b=a+"__bubble";h.has(b)||(qw(u,a,2,!1),h.add(b))}function Vm(a,u,h){var b=0;u&&(b|=4),qw(h,a,b,u)}var Wu="_reactListening"+Math.random().toString(36).slice(2);function tc(a){if(!a[Wu]){a[Wu]=!0,s.forEach(function(h){h!=="selectionchange"&&(tM.has(h)||Vm(h,!1,a),Vm(h,!0,a))});var u=a.nodeType===9?a:a.ownerDocument;u===null||u[Wu]||(u[Wu]=!0,Vm("selectionchange",!1,u))}}function qw(a,u,h,b){switch(Di(u)){case 1:var x=Ks;break;case 4:x=Er;break;default:x=Lr}h=x.bind(null,u,h,a),x=void 0,!Z||u!=="touchstart"&&u!=="touchmove"&&u!=="wheel"||(x=!0),b?x!==void 0?a.addEventListener(u,h,{capture:!0,passive:x}):a.addEventListener(u,h,!0):x!==void 0?a.addEventListener(u,h,{passive:x}):a.addEventListener(u,h,!1)}function Gm(a,u,h,b,x){var C=b;if((u&1)===0&&(u&2)===0&&b!==null)e:for(;;){if(b===null)return;var M=b.tag;if(M===3||M===4){var ee=b.stateNode.containerInfo;if(ee===x||ee.nodeType===8&&ee.parentNode===x)break;if(M===4)for(M=b.return;M!==null;){var le=M.tag;if((le===3||le===4)&&(le=M.stateNode.containerInfo,le===x||le.nodeType===8&&le.parentNode===x))return;M=M.return}for(;ee!==null;){if(M=ao(ee),M===null)return;if(le=M.tag,le===5||le===6){b=C=M;continue e}ee=ee.parentNode}}b=b.return}In(function(){var Me=C,et=pn(h),st=[];e:{var Qe=Ww.get(a);if(Qe!==void 0){var At=be,Bt=a;switch(a){case"keypress":if(hi(h)===0)break e;case"keydown":case"keyup":At=so;break;case"focusin":Bt="focus",At=pi;break;case"focusout":Bt="blur",At=pi;break;case"beforeblur":case"afterblur":At=pi;break;case"click":if(h.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":At=wa;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":At=no;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":At=z;break;case Fw:case _w:case Ow:At=Yl;break;case Bw:At=Ae;break;case"scroll":At=Pt;break;case"wheel":At=mt;break;case"copy":case"cut":case"paste":At=Xl;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":At=Ys}var qt=(u&4)!==0,Rr=!qt&&a==="scroll",ye=qt?Qe!==null?Qe+"Capture":null:Qe;qt=[];for(var he=Me,je;he!==null;){je=he;var xt=je.stateNode;if(je.tag===5&&xt!==null&&(je=xt,ye!==null&&(xt=wn(he,ye),xt!=null&&qt.push(nc(he,xt,je)))),Rr)break;he=he.return}0<qt.length&&(Qe=new At(Qe,Bt,null,h,et),st.push({event:Qe,listeners:qt}))}}if((u&7)===0){e:{if(Qe=a==="mouseover"||a==="pointerover",At=a==="mouseout"||a==="pointerout",Qe&&h!==Gt&&(Bt=h.relatedTarget||h.fromElement)&&(ao(Bt)||Bt[ea]))break e;if((At||Qe)&&(Qe=et.window===et?et:(Qe=et.ownerDocument)?Qe.defaultView||Qe.parentWindow:window,At?(Bt=h.relatedTarget||h.toElement,At=Me,Bt=Bt?ao(Bt):null,Bt!==null&&(Rr=rt(Bt),Bt!==Rr||Bt.tag!==5&&Bt.tag!==6)&&(Bt=null)):(At=null,Bt=Me),At!==Bt)){if(qt=wa,xt="onMouseLeave",ye="onMouseEnter",he="mouse",(a==="pointerout"||a==="pointerover")&&(qt=Ys,xt="onPointerLeave",ye="onPointerEnter",he="pointer"),Rr=At==null?Qe:nl(At),je=Bt==null?Qe:nl(Bt),Qe=new qt(xt,he+"leave",At,h,et),Qe.target=Rr,Qe.relatedTarget=je,xt=null,ao(et)===Me&&(qt=new qt(ye,he+"enter",Bt,h,et),qt.target=je,qt.relatedTarget=Rr,xt=qt),Rr=xt,At&&Bt)t:{for(qt=At,ye=Bt,he=0,je=qt;je;je=el(je))he++;for(je=0,xt=ye;xt;xt=el(xt))je++;for(;0<he-je;)qt=el(qt),he--;for(;0<je-he;)ye=el(ye),je--;for(;he--;){if(qt===ye||ye!==null&&qt===ye.alternate)break t;qt=el(qt),ye=el(ye)}qt=null}else qt=null;At!==null&&$w(st,Qe,At,qt,!1),Bt!==null&&Rr!==null&&$w(st,Rr,Bt,qt,!0)}}e:{if(Qe=Me?nl(Me):window,At=Qe.nodeName&&Qe.nodeName.toLowerCase(),At==="select"||At==="input"&&Qe.type==="file")var Xt=Zi;else if(on(Qe))if(Tw)Xt=YA;else{Xt=GA;var nn=VA}else(At=Qe.nodeName)&&At.toLowerCase()==="input"&&(Qe.type==="checkbox"||Qe.type==="radio")&&(Xt=KA);if(Xt&&(Xt=Xt(a,Me))){Zn(st,Xt,h,et);break e}nn&&nn(a,Qe,Me),a==="focusout"&&(nn=Qe._wrapperState)&&nn.controlled&&Qe.type==="number"&&_e(Qe,"number",Qe.value)}switch(nn=Me?nl(Me):window,a){case"focusin":(on(nn)||nn.contentEditable==="true")&&(Jo=nn,Um=Me,Zl=null);break;case"focusout":Zl=Um=Jo=null;break;case"mousedown":Hm=!0;break;case"contextmenu":case"mouseup":case"dragend":Hm=!1,Ew(st,h,et);break;case"selectionchange":if(JA)break;case"keydown":case"keyup":Ew(st,h,et)}var rn;if(Ot)e:{switch(a){case"compositionstart":var hn="onCompositionStart";break e;case"compositionend":hn="onCompositionEnd";break e;case"compositionupdate":hn="onCompositionUpdate";break e}hn=void 0}else Ct?tt(a,h)&&(hn="onCompositionEnd"):a==="keydown"&&h.keyCode===229&&(hn="onCompositionStart");hn&&(O&&h.locale!=="ko"&&(Ct||hn!=="onCompositionStart"?hn==="onCompositionEnd"&&Ct&&(rn=Qr()):(ds=et,Xi="value"in ds?ds.value:ds.textContent,Ct=!0)),nn=Uu(Me,hn),0<nn.length&&(hn=new ro(hn,a,null,h,et),st.push({event:hn,listeners:nn}),rn?hn.data=rn:(rn=pt(h),rn!==null&&(hn.data=rn)))),(rn=Pr?Ut(a,h):Ht(a,h))&&(Me=Uu(Me,"onBeforeInput"),0<Me.length&&(et=new ro("onBeforeInput","beforeinput",null,h,et),st.push({event:et,listeners:Me}),et.data=rn))}zw(st,u)})}function nc(a,u,h){return{instance:a,listener:u,currentTarget:h}}function Uu(a,u){for(var h=u+"Capture",b=[];a!==null;){var x=a,C=x.stateNode;x.tag===5&&C!==null&&(x=C,C=wn(a,h),C!=null&&b.unshift(nc(a,C,x)),C=wn(a,u),C!=null&&b.push(nc(a,C,x))),a=a.return}return b}function el(a){if(a===null)return null;do a=a.return;while(a&&a.tag!==5);return a||null}function $w(a,u,h,b,x){for(var C=u._reactName,M=[];h!==null&&h!==b;){var ee=h,le=ee.alternate,Me=ee.stateNode;if(le!==null&&le===b)break;ee.tag===5&&Me!==null&&(ee=Me,x?(le=wn(h,C),le!=null&&M.unshift(nc(h,le,ee))):x||(le=wn(h,C),le!=null&&M.push(nc(h,le,ee)))),h=h.return}M.length!==0&&a.push({event:u,listeners:M})}var nM=/\r\n?/g,rM=/\u0000|\uFFFD/g;function Vw(a){return(typeof a=="string"?a:""+a).replace(nM,`
|
|
39
|
-
`).replace(rM,"")}function Hu(a,u,h){if(u=Vw(u),Vw(a)!==u&&h)throw Error(r(425))}function zu(){}var Km=null,Ym=null;function Xm(a,u){return a==="textarea"||a==="noscript"||typeof u.children=="string"||typeof u.children=="number"||typeof u.dangerouslySetInnerHTML=="object"&&u.dangerouslySetInnerHTML!==null&&u.dangerouslySetInnerHTML.__html!=null}var Qm=typeof setTimeout=="function"?setTimeout:void 0,sM=typeof clearTimeout=="function"?clearTimeout:void 0,Gw=typeof Promise=="function"?Promise:void 0,iM=typeof queueMicrotask=="function"?queueMicrotask:typeof Gw<"u"?function(a){return Gw.resolve(null).then(a).catch(aM)}:Qm;function aM(a){setTimeout(function(){throw a})}function Jm(a,u){var h=u,b=0;do{var x=h.nextSibling;if(a.removeChild(h),x&&x.nodeType===8)if(h=x.data,h==="/$"){if(b===0){a.removeChild(x),Ln(u);return}b--}else h!=="$"&&h!=="$?"&&h!=="$!"||b++;h=x}while(h);Ln(u)}function Ca(a){for(;a!=null;a=a.nextSibling){var u=a.nodeType;if(u===1||u===3)break;if(u===8){if(u=a.data,u==="$"||u==="$!"||u==="$?")break;if(u==="/$")return null}}return a}function Kw(a){a=a.previousSibling;for(var u=0;a;){if(a.nodeType===8){var h=a.data;if(h==="$"||h==="$!"||h==="$?"){if(u===0)return a;u--}else h==="/$"&&u++}a=a.previousSibling}return null}var tl=Math.random().toString(36).slice(2),Mi="__reactFiber$"+tl,rc="__reactProps$"+tl,ea="__reactContainer$"+tl,Zm="__reactEvents$"+tl,oM="__reactListeners$"+tl,lM="__reactHandles$"+tl;function ao(a){var u=a[Mi];if(u)return u;for(var h=a.parentNode;h;){if(u=h[ea]||h[Mi]){if(h=u.alternate,u.child!==null||h!==null&&h.child!==null)for(a=Kw(a);a!==null;){if(h=a[Mi])return h;a=Kw(a)}return u}a=h,h=a.parentNode}return null}function sc(a){return a=a[Mi]||a[ea],!a||a.tag!==5&&a.tag!==6&&a.tag!==13&&a.tag!==3?null:a}function nl(a){if(a.tag===5||a.tag===6)return a.stateNode;throw Error(r(33))}function qu(a){return a[rc]||null}var ep=[],rl=-1;function ja(a){return{current:a}}function ur(a){0>rl||(a.current=ep[rl],ep[rl]=null,rl--)}function er(a,u){rl++,ep[rl]=a.current,a.current=u}var Ta={},hs=ja(Ta),Ss=ja(!1),oo=Ta;function sl(a,u){var h=a.type.contextTypes;if(!h)return Ta;var b=a.stateNode;if(b&&b.__reactInternalMemoizedUnmaskedChildContext===u)return b.__reactInternalMemoizedMaskedChildContext;var x={},C;for(C in h)x[C]=u[C];return b&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=u,a.__reactInternalMemoizedMaskedChildContext=x),x}function Cs(a){return a=a.childContextTypes,a!=null}function $u(){ur(Ss),ur(hs)}function Yw(a,u,h){if(hs.current!==Ta)throw Error(r(168));er(hs,u),er(Ss,h)}function Xw(a,u,h){var b=a.stateNode;if(u=u.childContextTypes,typeof b.getChildContext!="function")return h;b=b.getChildContext();for(var x in b)if(!(x in u))throw Error(r(108,Se(a)||"Unknown",x));return P({},h,b)}function Vu(a){return a=(a=a.stateNode)&&a.__reactInternalMemoizedMergedChildContext||Ta,oo=hs.current,er(hs,a),er(Ss,Ss.current),!0}function Qw(a,u,h){var b=a.stateNode;if(!b)throw Error(r(169));h?(a=Xw(a,u,oo),b.__reactInternalMemoizedMergedChildContext=a,ur(Ss),ur(hs),er(hs,a)):ur(Ss),er(Ss,h)}var ta=null,Gu=!1,tp=!1;function Jw(a){ta===null?ta=[a]:ta.push(a)}function cM(a){Gu=!0,Jw(a)}function Na(){if(!tp&&ta!==null){tp=!0;var a=0,u=Yt;try{var h=ta;for(Yt=1;a<h.length;a++){var b=h[a];do b=b(!0);while(b!==null)}ta=null,Gu=!1}catch(x){throw ta!==null&&(ta=ta.slice(a+1)),un(De,Na),x}finally{Yt=u,tp=!1}}return null}var il=[],al=0,Ku=null,Yu=0,Xs=[],Qs=0,lo=null,na=1,ra="";function co(a,u){il[al++]=Yu,il[al++]=Ku,Ku=a,Yu=u}function Zw(a,u,h){Xs[Qs++]=na,Xs[Qs++]=ra,Xs[Qs++]=lo,lo=a;var b=na;a=ra;var x=32-Jt(b)-1;b&=~(1<<x),h+=1;var C=32-Jt(u)+x;if(30<C){var M=x-x%5;C=(b&(1<<M)-1).toString(32),b>>=M,x-=M,na=1<<32-Jt(u)+x|h<<x|b,ra=C+a}else na=1<<C|h<<x|b,ra=a}function np(a){a.return!==null&&(co(a,1),Zw(a,1,0))}function rp(a){for(;a===Ku;)Ku=il[--al],il[al]=null,Yu=il[--al],il[al]=null;for(;a===lo;)lo=Xs[--Qs],Xs[Qs]=null,ra=Xs[--Qs],Xs[Qs]=null,na=Xs[--Qs],Xs[Qs]=null}var Ws=null,Us=null,hr=!1,gi=null;function ey(a,u){var h=ti(5,null,null,0);h.elementType="DELETED",h.stateNode=u,h.return=a,u=a.deletions,u===null?(a.deletions=[h],a.flags|=16):u.push(h)}function ty(a,u){switch(a.tag){case 5:var h=a.type;return u=u.nodeType!==1||h.toLowerCase()!==u.nodeName.toLowerCase()?null:u,u!==null?(a.stateNode=u,Ws=a,Us=Ca(u.firstChild),!0):!1;case 6:return u=a.pendingProps===""||u.nodeType!==3?null:u,u!==null?(a.stateNode=u,Ws=a,Us=null,!0):!1;case 13:return u=u.nodeType!==8?null:u,u!==null?(h=lo!==null?{id:na,overflow:ra}:null,a.memoizedState={dehydrated:u,treeContext:h,retryLane:1073741824},h=ti(18,null,null,0),h.stateNode=u,h.return=a,a.child=h,Ws=a,Us=null,!0):!1;default:return!1}}function sp(a){return(a.mode&1)!==0&&(a.flags&128)===0}function ip(a){if(hr){var u=Us;if(u){var h=u;if(!ty(a,u)){if(sp(a))throw Error(r(418));u=Ca(h.nextSibling);var b=Ws;u&&ty(a,u)?ey(b,h):(a.flags=a.flags&-4097|2,hr=!1,Ws=a)}}else{if(sp(a))throw Error(r(418));a.flags=a.flags&-4097|2,hr=!1,Ws=a}}}function ny(a){for(a=a.return;a!==null&&a.tag!==5&&a.tag!==3&&a.tag!==13;)a=a.return;Ws=a}function Xu(a){if(a!==Ws)return!1;if(!hr)return ny(a),hr=!0,!1;var u;if((u=a.tag!==3)&&!(u=a.tag!==5)&&(u=a.type,u=u!=="head"&&u!=="body"&&!Xm(a.type,a.memoizedProps)),u&&(u=Us)){if(sp(a))throw ry(),Error(r(418));for(;u;)ey(a,u),u=Ca(u.nextSibling)}if(ny(a),a.tag===13){if(a=a.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(r(317));e:{for(a=a.nextSibling,u=0;a;){if(a.nodeType===8){var h=a.data;if(h==="/$"){if(u===0){Us=Ca(a.nextSibling);break e}u--}else h!=="$"&&h!=="$!"&&h!=="$?"||u++}a=a.nextSibling}Us=null}}else Us=Ws?Ca(a.stateNode.nextSibling):null;return!0}function ry(){for(var a=Us;a;)a=Ca(a.nextSibling)}function ol(){Us=Ws=null,hr=!1}function ap(a){gi===null?gi=[a]:gi.push(a)}var uM=H.ReactCurrentBatchConfig;function ic(a,u,h){if(a=h.ref,a!==null&&typeof a!="function"&&typeof a!="object"){if(h._owner){if(h=h._owner,h){if(h.tag!==1)throw Error(r(309));var b=h.stateNode}if(!b)throw Error(r(147,a));var x=b,C=""+a;return u!==null&&u.ref!==null&&typeof u.ref=="function"&&u.ref._stringRef===C?u.ref:(u=function(M){var ee=x.refs;M===null?delete ee[C]:ee[C]=M},u._stringRef=C,u)}if(typeof a!="string")throw Error(r(284));if(!h._owner)throw Error(r(290,a))}return a}function Qu(a,u){throw a=Object.prototype.toString.call(u),Error(r(31,a==="[object Object]"?"object with keys {"+Object.keys(u).join(", ")+"}":a))}function sy(a){var u=a._init;return u(a._payload)}function iy(a){function u(ye,he){if(a){var je=ye.deletions;je===null?(ye.deletions=[he],ye.flags|=16):je.push(he)}}function h(ye,he){if(!a)return null;for(;he!==null;)u(ye,he),he=he.sibling;return null}function b(ye,he){for(ye=new Map;he!==null;)he.key!==null?ye.set(he.key,he):ye.set(he.index,he),he=he.sibling;return ye}function x(ye,he){return ye=La(ye,he),ye.index=0,ye.sibling=null,ye}function C(ye,he,je){return ye.index=je,a?(je=ye.alternate,je!==null?(je=je.index,je<he?(ye.flags|=2,he):je):(ye.flags|=2,he)):(ye.flags|=1048576,he)}function M(ye){return a&&ye.alternate===null&&(ye.flags|=2),ye}function ee(ye,he,je,xt){return he===null||he.tag!==6?(he=Qp(je,ye.mode,xt),he.return=ye,he):(he=x(he,je),he.return=ye,he)}function le(ye,he,je,xt){var Xt=je.type;return Xt===A?et(ye,he,je.props.children,xt,je.key):he!==null&&(he.elementType===Xt||typeof Xt=="object"&&Xt!==null&&Xt.$$typeof===G&&sy(Xt)===he.type)?(xt=x(he,je.props),xt.ref=ic(ye,he,je),xt.return=ye,xt):(xt=kd(je.type,je.key,je.props,null,ye.mode,xt),xt.ref=ic(ye,he,je),xt.return=ye,xt)}function Me(ye,he,je,xt){return he===null||he.tag!==4||he.stateNode.containerInfo!==je.containerInfo||he.stateNode.implementation!==je.implementation?(he=Jp(je,ye.mode,xt),he.return=ye,he):(he=x(he,je.children||[]),he.return=ye,he)}function et(ye,he,je,xt,Xt){return he===null||he.tag!==7?(he=vo(je,ye.mode,xt,Xt),he.return=ye,he):(he=x(he,je),he.return=ye,he)}function st(ye,he,je){if(typeof he=="string"&&he!==""||typeof he=="number")return he=Qp(""+he,ye.mode,je),he.return=ye,he;if(typeof he=="object"&&he!==null){switch(he.$$typeof){case B:return je=kd(he.type,he.key,he.props,null,ye.mode,je),je.ref=ic(ye,null,he),je.return=ye,je;case I:return he=Jp(he,ye.mode,je),he.return=ye,he;case G:var xt=he._init;return st(ye,xt(he._payload),je)}if(we(he)||Q(he))return he=vo(he,ye.mode,je,null),he.return=ye,he;Qu(ye,he)}return null}function Qe(ye,he,je,xt){var Xt=he!==null?he.key:null;if(typeof je=="string"&&je!==""||typeof je=="number")return Xt!==null?null:ee(ye,he,""+je,xt);if(typeof je=="object"&&je!==null){switch(je.$$typeof){case B:return je.key===Xt?le(ye,he,je,xt):null;case I:return je.key===Xt?Me(ye,he,je,xt):null;case G:return Xt=je._init,Qe(ye,he,Xt(je._payload),xt)}if(we(je)||Q(je))return Xt!==null?null:et(ye,he,je,xt,null);Qu(ye,je)}return null}function At(ye,he,je,xt,Xt){if(typeof xt=="string"&&xt!==""||typeof xt=="number")return ye=ye.get(je)||null,ee(he,ye,""+xt,Xt);if(typeof xt=="object"&&xt!==null){switch(xt.$$typeof){case B:return ye=ye.get(xt.key===null?je:xt.key)||null,le(he,ye,xt,Xt);case I:return ye=ye.get(xt.key===null?je:xt.key)||null,Me(he,ye,xt,Xt);case G:var nn=xt._init;return At(ye,he,je,nn(xt._payload),Xt)}if(we(xt)||Q(xt))return ye=ye.get(je)||null,et(he,ye,xt,Xt,null);Qu(he,xt)}return null}function Bt(ye,he,je,xt){for(var Xt=null,nn=null,rn=he,hn=he=0,es=null;rn!==null&&hn<je.length;hn++){rn.index>hn?(es=rn,rn=null):es=rn.sibling;var Wn=Qe(ye,rn,je[hn],xt);if(Wn===null){rn===null&&(rn=es);break}a&&rn&&Wn.alternate===null&&u(ye,rn),he=C(Wn,he,hn),nn===null?Xt=Wn:nn.sibling=Wn,nn=Wn,rn=es}if(hn===je.length)return h(ye,rn),hr&&co(ye,hn),Xt;if(rn===null){for(;hn<je.length;hn++)rn=st(ye,je[hn],xt),rn!==null&&(he=C(rn,he,hn),nn===null?Xt=rn:nn.sibling=rn,nn=rn);return hr&&co(ye,hn),Xt}for(rn=b(ye,rn);hn<je.length;hn++)es=At(rn,ye,hn,je[hn],xt),es!==null&&(a&&es.alternate!==null&&rn.delete(es.key===null?hn:es.key),he=C(es,he,hn),nn===null?Xt=es:nn.sibling=es,nn=es);return a&&rn.forEach(function(Fa){return u(ye,Fa)}),hr&&co(ye,hn),Xt}function qt(ye,he,je,xt){var Xt=Q(je);if(typeof Xt!="function")throw Error(r(150));if(je=Xt.call(je),je==null)throw Error(r(151));for(var nn=Xt=null,rn=he,hn=he=0,es=null,Wn=je.next();rn!==null&&!Wn.done;hn++,Wn=je.next()){rn.index>hn?(es=rn,rn=null):es=rn.sibling;var Fa=Qe(ye,rn,Wn.value,xt);if(Fa===null){rn===null&&(rn=es);break}a&&rn&&Fa.alternate===null&&u(ye,rn),he=C(Fa,he,hn),nn===null?Xt=Fa:nn.sibling=Fa,nn=Fa,rn=es}if(Wn.done)return h(ye,rn),hr&&co(ye,hn),Xt;if(rn===null){for(;!Wn.done;hn++,Wn=je.next())Wn=st(ye,Wn.value,xt),Wn!==null&&(he=C(Wn,he,hn),nn===null?Xt=Wn:nn.sibling=Wn,nn=Wn);return hr&&co(ye,hn),Xt}for(rn=b(ye,rn);!Wn.done;hn++,Wn=je.next())Wn=At(rn,ye,hn,Wn.value,xt),Wn!==null&&(a&&Wn.alternate!==null&&rn.delete(Wn.key===null?hn:Wn.key),he=C(Wn,he,hn),nn===null?Xt=Wn:nn.sibling=Wn,nn=Wn);return a&&rn.forEach(function(zM){return u(ye,zM)}),hr&&co(ye,hn),Xt}function Rr(ye,he,je,xt){if(typeof je=="object"&&je!==null&&je.type===A&&je.key===null&&(je=je.props.children),typeof je=="object"&&je!==null){switch(je.$$typeof){case B:e:{for(var Xt=je.key,nn=he;nn!==null;){if(nn.key===Xt){if(Xt=je.type,Xt===A){if(nn.tag===7){h(ye,nn.sibling),he=x(nn,je.props.children),he.return=ye,ye=he;break e}}else if(nn.elementType===Xt||typeof Xt=="object"&&Xt!==null&&Xt.$$typeof===G&&sy(Xt)===nn.type){h(ye,nn.sibling),he=x(nn,je.props),he.ref=ic(ye,nn,je),he.return=ye,ye=he;break e}h(ye,nn);break}else u(ye,nn);nn=nn.sibling}je.type===A?(he=vo(je.props.children,ye.mode,xt,je.key),he.return=ye,ye=he):(xt=kd(je.type,je.key,je.props,null,ye.mode,xt),xt.ref=ic(ye,he,je),xt.return=ye,ye=xt)}return M(ye);case I:e:{for(nn=je.key;he!==null;){if(he.key===nn)if(he.tag===4&&he.stateNode.containerInfo===je.containerInfo&&he.stateNode.implementation===je.implementation){h(ye,he.sibling),he=x(he,je.children||[]),he.return=ye,ye=he;break e}else{h(ye,he);break}else u(ye,he);he=he.sibling}he=Jp(je,ye.mode,xt),he.return=ye,ye=he}return M(ye);case G:return nn=je._init,Rr(ye,he,nn(je._payload),xt)}if(we(je))return Bt(ye,he,je,xt);if(Q(je))return qt(ye,he,je,xt);Qu(ye,je)}return typeof je=="string"&&je!==""||typeof je=="number"?(je=""+je,he!==null&&he.tag===6?(h(ye,he.sibling),he=x(he,je),he.return=ye,ye=he):(h(ye,he),he=Qp(je,ye.mode,xt),he.return=ye,ye=he),M(ye)):h(ye,he)}return Rr}var ll=iy(!0),ay=iy(!1),Ju=ja(null),Zu=null,cl=null,op=null;function lp(){op=cl=Zu=null}function cp(a){var u=Ju.current;ur(Ju),a._currentValue=u}function up(a,u,h){for(;a!==null;){var b=a.alternate;if((a.childLanes&u)!==u?(a.childLanes|=u,b!==null&&(b.childLanes|=u)):b!==null&&(b.childLanes&u)!==u&&(b.childLanes|=u),a===h)break;a=a.return}}function ul(a,u){Zu=a,op=cl=null,a=a.dependencies,a!==null&&a.firstContext!==null&&((a.lanes&u)!==0&&(js=!0),a.firstContext=null)}function Js(a){var u=a._currentValue;if(op!==a)if(a={context:a,memoizedValue:u,next:null},cl===null){if(Zu===null)throw Error(r(308));cl=a,Zu.dependencies={lanes:0,firstContext:a}}else cl=cl.next=a;return u}var uo=null;function dp(a){uo===null?uo=[a]:uo.push(a)}function oy(a,u,h,b){var x=u.interleaved;return x===null?(h.next=h,dp(u)):(h.next=x.next,x.next=h),u.interleaved=h,sa(a,b)}function sa(a,u){a.lanes|=u;var h=a.alternate;for(h!==null&&(h.lanes|=u),h=a,a=a.return;a!==null;)a.childLanes|=u,h=a.alternate,h!==null&&(h.childLanes|=u),h=a,a=a.return;return h.tag===3?h.stateNode:null}var Pa=!1;function hp(a){a.updateQueue={baseState:a.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function ly(a,u){a=a.updateQueue,u.updateQueue===a&&(u.updateQueue={baseState:a.baseState,firstBaseUpdate:a.firstBaseUpdate,lastBaseUpdate:a.lastBaseUpdate,shared:a.shared,effects:a.effects})}function ia(a,u){return{eventTime:a,lane:u,tag:0,payload:null,callback:null,next:null}}function Da(a,u,h){var b=a.updateQueue;if(b===null)return null;if(b=b.shared,(On&2)!==0){var x=b.pending;return x===null?u.next=u:(u.next=x.next,x.next=u),b.pending=u,sa(a,h)}return x=b.interleaved,x===null?(u.next=u,dp(b)):(u.next=x.next,x.next=u),b.interleaved=u,sa(a,h)}function ed(a,u,h){if(u=u.updateQueue,u!==null&&(u=u.shared,(h&4194240)!==0)){var b=u.lanes;b&=a.pendingLanes,h|=b,u.lanes=h,wr(a,h)}}function cy(a,u){var h=a.updateQueue,b=a.alternate;if(b!==null&&(b=b.updateQueue,h===b)){var x=null,C=null;if(h=h.firstBaseUpdate,h!==null){do{var M={eventTime:h.eventTime,lane:h.lane,tag:h.tag,payload:h.payload,callback:h.callback,next:null};C===null?x=C=M:C=C.next=M,h=h.next}while(h!==null);C===null?x=C=u:C=C.next=u}else x=C=u;h={baseState:b.baseState,firstBaseUpdate:x,lastBaseUpdate:C,shared:b.shared,effects:b.effects},a.updateQueue=h;return}a=h.lastBaseUpdate,a===null?h.firstBaseUpdate=u:a.next=u,h.lastBaseUpdate=u}function td(a,u,h,b){var x=a.updateQueue;Pa=!1;var C=x.firstBaseUpdate,M=x.lastBaseUpdate,ee=x.shared.pending;if(ee!==null){x.shared.pending=null;var le=ee,Me=le.next;le.next=null,M===null?C=Me:M.next=Me,M=le;var et=a.alternate;et!==null&&(et=et.updateQueue,ee=et.lastBaseUpdate,ee!==M&&(ee===null?et.firstBaseUpdate=Me:ee.next=Me,et.lastBaseUpdate=le))}if(C!==null){var st=x.baseState;M=0,et=Me=le=null,ee=C;do{var Qe=ee.lane,At=ee.eventTime;if((b&Qe)===Qe){et!==null&&(et=et.next={eventTime:At,lane:0,tag:ee.tag,payload:ee.payload,callback:ee.callback,next:null});e:{var Bt=a,qt=ee;switch(Qe=u,At=h,qt.tag){case 1:if(Bt=qt.payload,typeof Bt=="function"){st=Bt.call(At,st,Qe);break e}st=Bt;break e;case 3:Bt.flags=Bt.flags&-65537|128;case 0:if(Bt=qt.payload,Qe=typeof Bt=="function"?Bt.call(At,st,Qe):Bt,Qe==null)break e;st=P({},st,Qe);break e;case 2:Pa=!0}}ee.callback!==null&&ee.lane!==0&&(a.flags|=64,Qe=x.effects,Qe===null?x.effects=[ee]:Qe.push(ee))}else At={eventTime:At,lane:Qe,tag:ee.tag,payload:ee.payload,callback:ee.callback,next:null},et===null?(Me=et=At,le=st):et=et.next=At,M|=Qe;if(ee=ee.next,ee===null){if(ee=x.shared.pending,ee===null)break;Qe=ee,ee=Qe.next,Qe.next=null,x.lastBaseUpdate=Qe,x.shared.pending=null}}while(!0);if(et===null&&(le=st),x.baseState=le,x.firstBaseUpdate=Me,x.lastBaseUpdate=et,u=x.shared.interleaved,u!==null){x=u;do M|=x.lane,x=x.next;while(x!==u)}else C===null&&(x.shared.lanes=0);po|=M,a.lanes=M,a.memoizedState=st}}function uy(a,u,h){if(a=u.effects,u.effects=null,a!==null)for(u=0;u<a.length;u++){var b=a[u],x=b.callback;if(x!==null){if(b.callback=null,b=h,typeof x!="function")throw Error(r(191,x));x.call(b)}}}var ac={},Ii=ja(ac),oc=ja(ac),lc=ja(ac);function ho(a){if(a===ac)throw Error(r(174));return a}function mp(a,u){switch(er(lc,u),er(oc,a),er(Ii,ac),a=u.nodeType,a){case 9:case 11:u=(u=u.documentElement)?u.namespaceURI:Pe(null,"");break;default:a=a===8?u.parentNode:u,u=a.namespaceURI||null,a=a.tagName,u=Pe(u,a)}ur(Ii),er(Ii,u)}function dl(){ur(Ii),ur(oc),ur(lc)}function dy(a){ho(lc.current);var u=ho(Ii.current),h=Pe(u,a.type);u!==h&&(er(oc,a),er(Ii,h))}function pp(a){oc.current===a&&(ur(Ii),ur(oc))}var yr=ja(0);function nd(a){for(var u=a;u!==null;){if(u.tag===13){var h=u.memoizedState;if(h!==null&&(h=h.dehydrated,h===null||h.data==="$?"||h.data==="$!"))return u}else if(u.tag===19&&u.memoizedProps.revealOrder!==void 0){if((u.flags&128)!==0)return u}else if(u.child!==null){u.child.return=u,u=u.child;continue}if(u===a)break;for(;u.sibling===null;){if(u.return===null||u.return===a)return null;u=u.return}u.sibling.return=u.return,u=u.sibling}return null}var fp=[];function gp(){for(var a=0;a<fp.length;a++)fp[a]._workInProgressVersionPrimary=null;fp.length=0}var rd=H.ReactCurrentDispatcher,bp=H.ReactCurrentBatchConfig,mo=0,kr=null,$r=null,Jr=null,sd=!1,cc=!1,uc=0,dM=0;function ms(){throw Error(r(321))}function vp(a,u){if(u===null)return!1;for(var h=0;h<u.length&&h<a.length;h++)if(!fi(a[h],u[h]))return!1;return!0}function wp(a,u,h,b,x,C){if(mo=C,kr=u,u.memoizedState=null,u.updateQueue=null,u.lanes=0,rd.current=a===null||a.memoizedState===null?fM:gM,a=h(b,x),cc){C=0;do{if(cc=!1,uc=0,25<=C)throw Error(r(301));C+=1,Jr=$r=null,u.updateQueue=null,rd.current=bM,a=h(b,x)}while(cc)}if(rd.current=od,u=$r!==null&&$r.next!==null,mo=0,Jr=$r=kr=null,sd=!1,u)throw Error(r(300));return a}function yp(){var a=uc!==0;return uc=0,a}function Ei(){var a={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Jr===null?kr.memoizedState=Jr=a:Jr=Jr.next=a,Jr}function Zs(){if($r===null){var a=kr.alternate;a=a!==null?a.memoizedState:null}else a=$r.next;var u=Jr===null?kr.memoizedState:Jr.next;if(u!==null)Jr=u,$r=a;else{if(a===null)throw Error(r(310));$r=a,a={memoizedState:$r.memoizedState,baseState:$r.baseState,baseQueue:$r.baseQueue,queue:$r.queue,next:null},Jr===null?kr.memoizedState=Jr=a:Jr=Jr.next=a}return Jr}function dc(a,u){return typeof u=="function"?u(a):u}function kp(a){var u=Zs(),h=u.queue;if(h===null)throw Error(r(311));h.lastRenderedReducer=a;var b=$r,x=b.baseQueue,C=h.pending;if(C!==null){if(x!==null){var M=x.next;x.next=C.next,C.next=M}b.baseQueue=x=C,h.pending=null}if(x!==null){C=x.next,b=b.baseState;var ee=M=null,le=null,Me=C;do{var et=Me.lane;if((mo&et)===et)le!==null&&(le=le.next={lane:0,action:Me.action,hasEagerState:Me.hasEagerState,eagerState:Me.eagerState,next:null}),b=Me.hasEagerState?Me.eagerState:a(b,Me.action);else{var st={lane:et,action:Me.action,hasEagerState:Me.hasEagerState,eagerState:Me.eagerState,next:null};le===null?(ee=le=st,M=b):le=le.next=st,kr.lanes|=et,po|=et}Me=Me.next}while(Me!==null&&Me!==C);le===null?M=b:le.next=ee,fi(b,u.memoizedState)||(js=!0),u.memoizedState=b,u.baseState=M,u.baseQueue=le,h.lastRenderedState=b}if(a=h.interleaved,a!==null){x=a;do C=x.lane,kr.lanes|=C,po|=C,x=x.next;while(x!==a)}else x===null&&(h.lanes=0);return[u.memoizedState,h.dispatch]}function xp(a){var u=Zs(),h=u.queue;if(h===null)throw Error(r(311));h.lastRenderedReducer=a;var b=h.dispatch,x=h.pending,C=u.memoizedState;if(x!==null){h.pending=null;var M=x=x.next;do C=a(C,M.action),M=M.next;while(M!==x);fi(C,u.memoizedState)||(js=!0),u.memoizedState=C,u.baseQueue===null&&(u.baseState=C),h.lastRenderedState=C}return[C,b]}function hy(){}function my(a,u){var h=kr,b=Zs(),x=u(),C=!fi(b.memoizedState,x);if(C&&(b.memoizedState=x,js=!0),b=b.queue,Sp(gy.bind(null,h,b,a),[a]),b.getSnapshot!==u||C||Jr!==null&&Jr.memoizedState.tag&1){if(h.flags|=2048,hc(9,fy.bind(null,h,b,x,u),void 0,null),Zr===null)throw Error(r(349));(mo&30)!==0||py(h,u,x)}return x}function py(a,u,h){a.flags|=16384,a={getSnapshot:u,value:h},u=kr.updateQueue,u===null?(u={lastEffect:null,stores:null},kr.updateQueue=u,u.stores=[a]):(h=u.stores,h===null?u.stores=[a]:h.push(a))}function fy(a,u,h,b){u.value=h,u.getSnapshot=b,by(u)&&vy(a)}function gy(a,u,h){return h(function(){by(u)&&vy(a)})}function by(a){var u=a.getSnapshot;a=a.value;try{var h=u();return!fi(a,h)}catch{return!0}}function vy(a){var u=sa(a,1);u!==null&&yi(u,a,1,-1)}function wy(a){var u=Ei();return typeof a=="function"&&(a=a()),u.memoizedState=u.baseState=a,a={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:dc,lastRenderedState:a},u.queue=a,a=a.dispatch=pM.bind(null,kr,a),[u.memoizedState,a]}function hc(a,u,h,b){return a={tag:a,create:u,destroy:h,deps:b,next:null},u=kr.updateQueue,u===null?(u={lastEffect:null,stores:null},kr.updateQueue=u,u.lastEffect=a.next=a):(h=u.lastEffect,h===null?u.lastEffect=a.next=a:(b=h.next,h.next=a,a.next=b,u.lastEffect=a)),a}function yy(){return Zs().memoizedState}function id(a,u,h,b){var x=Ei();kr.flags|=a,x.memoizedState=hc(1|u,h,void 0,b===void 0?null:b)}function ad(a,u,h,b){var x=Zs();b=b===void 0?null:b;var C=void 0;if($r!==null){var M=$r.memoizedState;if(C=M.destroy,b!==null&&vp(b,M.deps)){x.memoizedState=hc(u,h,C,b);return}}kr.flags|=a,x.memoizedState=hc(1|u,h,C,b)}function ky(a,u){return id(8390656,8,a,u)}function Sp(a,u){return ad(2048,8,a,u)}function xy(a,u){return ad(4,2,a,u)}function Sy(a,u){return ad(4,4,a,u)}function Cy(a,u){if(typeof u=="function")return a=a(),u(a),function(){u(null)};if(u!=null)return a=a(),u.current=a,function(){u.current=null}}function jy(a,u,h){return h=h!=null?h.concat([a]):null,ad(4,4,Cy.bind(null,u,a),h)}function Cp(){}function Ty(a,u){var h=Zs();u=u===void 0?null:u;var b=h.memoizedState;return b!==null&&u!==null&&vp(u,b[1])?b[0]:(h.memoizedState=[a,u],a)}function Ny(a,u){var h=Zs();u=u===void 0?null:u;var b=h.memoizedState;return b!==null&&u!==null&&vp(u,b[1])?b[0]:(a=a(),h.memoizedState=[a,u],a)}function Py(a,u,h){return(mo&21)===0?(a.baseState&&(a.baseState=!1,js=!0),a.memoizedState=h):(fi(h,u)||(h=Hr(),kr.lanes|=h,po|=h,a.baseState=!0),u)}function hM(a,u){var h=Yt;Yt=h!==0&&4>h?h:4,a(!0);var b=bp.transition;bp.transition={};try{a(!1),u()}finally{Yt=h,bp.transition=b}}function Dy(){return Zs().memoizedState}function mM(a,u,h){var b=Ia(a);if(h={lane:b,action:h,hasEagerState:!1,eagerState:null,next:null},Ry(a))Ay(u,h);else if(h=oy(a,u,h,b),h!==null){var x=ws();yi(h,a,b,x),My(h,u,b)}}function pM(a,u,h){var b=Ia(a),x={lane:b,action:h,hasEagerState:!1,eagerState:null,next:null};if(Ry(a))Ay(u,x);else{var C=a.alternate;if(a.lanes===0&&(C===null||C.lanes===0)&&(C=u.lastRenderedReducer,C!==null))try{var M=u.lastRenderedState,ee=C(M,h);if(x.hasEagerState=!0,x.eagerState=ee,fi(ee,M)){var le=u.interleaved;le===null?(x.next=x,dp(u)):(x.next=le.next,le.next=x),u.interleaved=x;return}}catch{}finally{}h=oy(a,u,x,b),h!==null&&(x=ws(),yi(h,a,b,x),My(h,u,b))}}function Ry(a){var u=a.alternate;return a===kr||u!==null&&u===kr}function Ay(a,u){cc=sd=!0;var h=a.pending;h===null?u.next=u:(u.next=h.next,h.next=u),a.pending=u}function My(a,u,h){if((h&4194240)!==0){var b=u.lanes;b&=a.pendingLanes,h|=b,u.lanes=h,wr(a,h)}}var od={readContext:Js,useCallback:ms,useContext:ms,useEffect:ms,useImperativeHandle:ms,useInsertionEffect:ms,useLayoutEffect:ms,useMemo:ms,useReducer:ms,useRef:ms,useState:ms,useDebugValue:ms,useDeferredValue:ms,useTransition:ms,useMutableSource:ms,useSyncExternalStore:ms,useId:ms,unstable_isNewReconciler:!1},fM={readContext:Js,useCallback:function(a,u){return Ei().memoizedState=[a,u===void 0?null:u],a},useContext:Js,useEffect:ky,useImperativeHandle:function(a,u,h){return h=h!=null?h.concat([a]):null,id(4194308,4,Cy.bind(null,u,a),h)},useLayoutEffect:function(a,u){return id(4194308,4,a,u)},useInsertionEffect:function(a,u){return id(4,2,a,u)},useMemo:function(a,u){var h=Ei();return u=u===void 0?null:u,a=a(),h.memoizedState=[a,u],a},useReducer:function(a,u,h){var b=Ei();return u=h!==void 0?h(u):u,b.memoizedState=b.baseState=u,a={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:a,lastRenderedState:u},b.queue=a,a=a.dispatch=mM.bind(null,kr,a),[b.memoizedState,a]},useRef:function(a){var u=Ei();return a={current:a},u.memoizedState=a},useState:wy,useDebugValue:Cp,useDeferredValue:function(a){return Ei().memoizedState=a},useTransition:function(){var a=wy(!1),u=a[0];return a=hM.bind(null,a[1]),Ei().memoizedState=a,[u,a]},useMutableSource:function(){},useSyncExternalStore:function(a,u,h){var b=kr,x=Ei();if(hr){if(h===void 0)throw Error(r(407));h=h()}else{if(h=u(),Zr===null)throw Error(r(349));(mo&30)!==0||py(b,u,h)}x.memoizedState=h;var C={value:h,getSnapshot:u};return x.queue=C,ky(gy.bind(null,b,C,a),[a]),b.flags|=2048,hc(9,fy.bind(null,b,C,h,u),void 0,null),h},useId:function(){var a=Ei(),u=Zr.identifierPrefix;if(hr){var h=ra,b=na;h=(b&~(1<<32-Jt(b)-1)).toString(32)+h,u=":"+u+"R"+h,h=uc++,0<h&&(u+="H"+h.toString(32)),u+=":"}else h=dM++,u=":"+u+"r"+h.toString(32)+":";return a.memoizedState=u},unstable_isNewReconciler:!1},gM={readContext:Js,useCallback:Ty,useContext:Js,useEffect:Sp,useImperativeHandle:jy,useInsertionEffect:xy,useLayoutEffect:Sy,useMemo:Ny,useReducer:kp,useRef:yy,useState:function(){return kp(dc)},useDebugValue:Cp,useDeferredValue:function(a){var u=Zs();return Py(u,$r.memoizedState,a)},useTransition:function(){var a=kp(dc)[0],u=Zs().memoizedState;return[a,u]},useMutableSource:hy,useSyncExternalStore:my,useId:Dy,unstable_isNewReconciler:!1},bM={readContext:Js,useCallback:Ty,useContext:Js,useEffect:Sp,useImperativeHandle:jy,useInsertionEffect:xy,useLayoutEffect:Sy,useMemo:Ny,useReducer:xp,useRef:yy,useState:function(){return xp(dc)},useDebugValue:Cp,useDeferredValue:function(a){var u=Zs();return $r===null?u.memoizedState=a:Py(u,$r.memoizedState,a)},useTransition:function(){var a=xp(dc)[0],u=Zs().memoizedState;return[a,u]},useMutableSource:hy,useSyncExternalStore:my,useId:Dy,unstable_isNewReconciler:!1};function bi(a,u){if(a&&a.defaultProps){u=P({},u),a=a.defaultProps;for(var h in a)u[h]===void 0&&(u[h]=a[h]);return u}return u}function jp(a,u,h,b){u=a.memoizedState,h=h(b,u),h=h==null?u:P({},u,h),a.memoizedState=h,a.lanes===0&&(a.updateQueue.baseState=h)}var ld={isMounted:function(a){return(a=a._reactInternals)?rt(a)===a:!1},enqueueSetState:function(a,u,h){a=a._reactInternals;var b=ws(),x=Ia(a),C=ia(b,x);C.payload=u,h!=null&&(C.callback=h),u=Da(a,C,x),u!==null&&(yi(u,a,x,b),ed(u,a,x))},enqueueReplaceState:function(a,u,h){a=a._reactInternals;var b=ws(),x=Ia(a),C=ia(b,x);C.tag=1,C.payload=u,h!=null&&(C.callback=h),u=Da(a,C,x),u!==null&&(yi(u,a,x,b),ed(u,a,x))},enqueueForceUpdate:function(a,u){a=a._reactInternals;var h=ws(),b=Ia(a),x=ia(h,b);x.tag=2,u!=null&&(x.callback=u),u=Da(a,x,b),u!==null&&(yi(u,a,b,h),ed(u,a,b))}};function Iy(a,u,h,b,x,C,M){return a=a.stateNode,typeof a.shouldComponentUpdate=="function"?a.shouldComponentUpdate(b,C,M):u.prototype&&u.prototype.isPureReactComponent?!Jl(h,b)||!Jl(x,C):!0}function Ey(a,u,h){var b=!1,x=Ta,C=u.contextType;return typeof C=="object"&&C!==null?C=Js(C):(x=Cs(u)?oo:hs.current,b=u.contextTypes,C=(b=b!=null)?sl(a,x):Ta),u=new u(h,C),a.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,u.updater=ld,a.stateNode=u,u._reactInternals=a,b&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=x,a.__reactInternalMemoizedMaskedChildContext=C),u}function Ly(a,u,h,b){a=u.state,typeof u.componentWillReceiveProps=="function"&&u.componentWillReceiveProps(h,b),typeof u.UNSAFE_componentWillReceiveProps=="function"&&u.UNSAFE_componentWillReceiveProps(h,b),u.state!==a&&ld.enqueueReplaceState(u,u.state,null)}function Tp(a,u,h,b){var x=a.stateNode;x.props=h,x.state=a.memoizedState,x.refs={},hp(a);var C=u.contextType;typeof C=="object"&&C!==null?x.context=Js(C):(C=Cs(u)?oo:hs.current,x.context=sl(a,C)),x.state=a.memoizedState,C=u.getDerivedStateFromProps,typeof C=="function"&&(jp(a,u,C,h),x.state=a.memoizedState),typeof u.getDerivedStateFromProps=="function"||typeof x.getSnapshotBeforeUpdate=="function"||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(u=x.state,typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount(),u!==x.state&&ld.enqueueReplaceState(x,x.state,null),td(a,h,x,b),x.state=a.memoizedState),typeof x.componentDidMount=="function"&&(a.flags|=4194308)}function hl(a,u){try{var h="",b=u;do h+=pe(b),b=b.return;while(b);var x=h}catch(C){x=`
|
|
40
|
-
Error generating stack: `+C.message+`
|
|
41
|
-
`+C.stack}return{value:a,source:u,stack:x,digest:null}}function Np(a,u,h){return{value:a,source:null,stack:h??null,digest:u??null}}function Pp(a,u){try{console.error(u.value)}catch(h){setTimeout(function(){throw h})}}var vM=typeof WeakMap=="function"?WeakMap:Map;function Fy(a,u,h){h=ia(-1,h),h.tag=3,h.payload={element:null};var b=u.value;return h.callback=function(){fd||(fd=!0,zp=b),Pp(a,u)},h}function _y(a,u,h){h=ia(-1,h),h.tag=3;var b=a.type.getDerivedStateFromError;if(typeof b=="function"){var x=u.value;h.payload=function(){return b(x)},h.callback=function(){Pp(a,u)}}var C=a.stateNode;return C!==null&&typeof C.componentDidCatch=="function"&&(h.callback=function(){Pp(a,u),typeof b!="function"&&(Aa===null?Aa=new Set([this]):Aa.add(this));var M=u.stack;this.componentDidCatch(u.value,{componentStack:M!==null?M:""})}),h}function Oy(a,u,h){var b=a.pingCache;if(b===null){b=a.pingCache=new vM;var x=new Set;b.set(u,x)}else x=b.get(u),x===void 0&&(x=new Set,b.set(u,x));x.has(h)||(x.add(h),a=MM.bind(null,a,u,h),u.then(a,a))}function By(a){do{var u;if((u=a.tag===13)&&(u=a.memoizedState,u=u!==null?u.dehydrated!==null:!0),u)return a;a=a.return}while(a!==null);return null}function Wy(a,u,h,b,x){return(a.mode&1)===0?(a===u?a.flags|=65536:(a.flags|=128,h.flags|=131072,h.flags&=-52805,h.tag===1&&(h.alternate===null?h.tag=17:(u=ia(-1,1),u.tag=2,Da(h,u,1))),h.lanes|=1),a):(a.flags|=65536,a.lanes=x,a)}var wM=H.ReactCurrentOwner,js=!1;function vs(a,u,h,b){u.child=a===null?ay(u,null,h,b):ll(u,a.child,h,b)}function Uy(a,u,h,b,x){h=h.render;var C=u.ref;return ul(u,x),b=wp(a,u,h,b,C,x),h=yp(),a!==null&&!js?(u.updateQueue=a.updateQueue,u.flags&=-2053,a.lanes&=~x,aa(a,u,x)):(hr&&h&&np(u),u.flags|=1,vs(a,u,b,x),u.child)}function Hy(a,u,h,b,x){if(a===null){var C=h.type;return typeof C=="function"&&!Xp(C)&&C.defaultProps===void 0&&h.compare===null&&h.defaultProps===void 0?(u.tag=15,u.type=C,zy(a,u,C,b,x)):(a=kd(h.type,null,b,u,u.mode,x),a.ref=u.ref,a.return=u,u.child=a)}if(C=a.child,(a.lanes&x)===0){var M=C.memoizedProps;if(h=h.compare,h=h!==null?h:Jl,h(M,b)&&a.ref===u.ref)return aa(a,u,x)}return u.flags|=1,a=La(C,b),a.ref=u.ref,a.return=u,u.child=a}function zy(a,u,h,b,x){if(a!==null){var C=a.memoizedProps;if(Jl(C,b)&&a.ref===u.ref)if(js=!1,u.pendingProps=b=C,(a.lanes&x)!==0)(a.flags&131072)!==0&&(js=!0);else return u.lanes=a.lanes,aa(a,u,x)}return Dp(a,u,h,b,x)}function qy(a,u,h){var b=u.pendingProps,x=b.children,C=a!==null?a.memoizedState:null;if(b.mode==="hidden")if((u.mode&1)===0)u.memoizedState={baseLanes:0,cachePool:null,transitions:null},er(pl,Hs),Hs|=h;else{if((h&1073741824)===0)return a=C!==null?C.baseLanes|h:h,u.lanes=u.childLanes=1073741824,u.memoizedState={baseLanes:a,cachePool:null,transitions:null},u.updateQueue=null,er(pl,Hs),Hs|=a,null;u.memoizedState={baseLanes:0,cachePool:null,transitions:null},b=C!==null?C.baseLanes:h,er(pl,Hs),Hs|=b}else C!==null?(b=C.baseLanes|h,u.memoizedState=null):b=h,er(pl,Hs),Hs|=b;return vs(a,u,x,h),u.child}function $y(a,u){var h=u.ref;(a===null&&h!==null||a!==null&&a.ref!==h)&&(u.flags|=512,u.flags|=2097152)}function Dp(a,u,h,b,x){var C=Cs(h)?oo:hs.current;return C=sl(u,C),ul(u,x),h=wp(a,u,h,b,C,x),b=yp(),a!==null&&!js?(u.updateQueue=a.updateQueue,u.flags&=-2053,a.lanes&=~x,aa(a,u,x)):(hr&&b&&np(u),u.flags|=1,vs(a,u,h,x),u.child)}function Vy(a,u,h,b,x){if(Cs(h)){var C=!0;Vu(u)}else C=!1;if(ul(u,x),u.stateNode===null)ud(a,u),Ey(u,h,b),Tp(u,h,b,x),b=!0;else if(a===null){var M=u.stateNode,ee=u.memoizedProps;M.props=ee;var le=M.context,Me=h.contextType;typeof Me=="object"&&Me!==null?Me=Js(Me):(Me=Cs(h)?oo:hs.current,Me=sl(u,Me));var et=h.getDerivedStateFromProps,st=typeof et=="function"||typeof M.getSnapshotBeforeUpdate=="function";st||typeof M.UNSAFE_componentWillReceiveProps!="function"&&typeof M.componentWillReceiveProps!="function"||(ee!==b||le!==Me)&&Ly(u,M,b,Me),Pa=!1;var Qe=u.memoizedState;M.state=Qe,td(u,b,M,x),le=u.memoizedState,ee!==b||Qe!==le||Ss.current||Pa?(typeof et=="function"&&(jp(u,h,et,b),le=u.memoizedState),(ee=Pa||Iy(u,h,ee,b,Qe,le,Me))?(st||typeof M.UNSAFE_componentWillMount!="function"&&typeof M.componentWillMount!="function"||(typeof M.componentWillMount=="function"&&M.componentWillMount(),typeof M.UNSAFE_componentWillMount=="function"&&M.UNSAFE_componentWillMount()),typeof M.componentDidMount=="function"&&(u.flags|=4194308)):(typeof M.componentDidMount=="function"&&(u.flags|=4194308),u.memoizedProps=b,u.memoizedState=le),M.props=b,M.state=le,M.context=Me,b=ee):(typeof M.componentDidMount=="function"&&(u.flags|=4194308),b=!1)}else{M=u.stateNode,ly(a,u),ee=u.memoizedProps,Me=u.type===u.elementType?ee:bi(u.type,ee),M.props=Me,st=u.pendingProps,Qe=M.context,le=h.contextType,typeof le=="object"&&le!==null?le=Js(le):(le=Cs(h)?oo:hs.current,le=sl(u,le));var At=h.getDerivedStateFromProps;(et=typeof At=="function"||typeof M.getSnapshotBeforeUpdate=="function")||typeof M.UNSAFE_componentWillReceiveProps!="function"&&typeof M.componentWillReceiveProps!="function"||(ee!==st||Qe!==le)&&Ly(u,M,b,le),Pa=!1,Qe=u.memoizedState,M.state=Qe,td(u,b,M,x);var Bt=u.memoizedState;ee!==st||Qe!==Bt||Ss.current||Pa?(typeof At=="function"&&(jp(u,h,At,b),Bt=u.memoizedState),(Me=Pa||Iy(u,h,Me,b,Qe,Bt,le)||!1)?(et||typeof M.UNSAFE_componentWillUpdate!="function"&&typeof M.componentWillUpdate!="function"||(typeof M.componentWillUpdate=="function"&&M.componentWillUpdate(b,Bt,le),typeof M.UNSAFE_componentWillUpdate=="function"&&M.UNSAFE_componentWillUpdate(b,Bt,le)),typeof M.componentDidUpdate=="function"&&(u.flags|=4),typeof M.getSnapshotBeforeUpdate=="function"&&(u.flags|=1024)):(typeof M.componentDidUpdate!="function"||ee===a.memoizedProps&&Qe===a.memoizedState||(u.flags|=4),typeof M.getSnapshotBeforeUpdate!="function"||ee===a.memoizedProps&&Qe===a.memoizedState||(u.flags|=1024),u.memoizedProps=b,u.memoizedState=Bt),M.props=b,M.state=Bt,M.context=le,b=Me):(typeof M.componentDidUpdate!="function"||ee===a.memoizedProps&&Qe===a.memoizedState||(u.flags|=4),typeof M.getSnapshotBeforeUpdate!="function"||ee===a.memoizedProps&&Qe===a.memoizedState||(u.flags|=1024),b=!1)}return Rp(a,u,h,b,C,x)}function Rp(a,u,h,b,x,C){$y(a,u);var M=(u.flags&128)!==0;if(!b&&!M)return x&&Qw(u,h,!1),aa(a,u,C);b=u.stateNode,wM.current=u;var ee=M&&typeof h.getDerivedStateFromError!="function"?null:b.render();return u.flags|=1,a!==null&&M?(u.child=ll(u,a.child,null,C),u.child=ll(u,null,ee,C)):vs(a,u,ee,C),u.memoizedState=b.state,x&&Qw(u,h,!0),u.child}function Gy(a){var u=a.stateNode;u.pendingContext?Yw(a,u.pendingContext,u.pendingContext!==u.context):u.context&&Yw(a,u.context,!1),mp(a,u.containerInfo)}function Ky(a,u,h,b,x){return ol(),ap(x),u.flags|=256,vs(a,u,h,b),u.child}var Ap={dehydrated:null,treeContext:null,retryLane:0};function Mp(a){return{baseLanes:a,cachePool:null,transitions:null}}function Yy(a,u,h){var b=u.pendingProps,x=yr.current,C=!1,M=(u.flags&128)!==0,ee;if((ee=M)||(ee=a!==null&&a.memoizedState===null?!1:(x&2)!==0),ee?(C=!0,u.flags&=-129):(a===null||a.memoizedState!==null)&&(x|=1),er(yr,x&1),a===null)return ip(u),a=u.memoizedState,a!==null&&(a=a.dehydrated,a!==null)?((u.mode&1)===0?u.lanes=1:a.data==="$!"?u.lanes=8:u.lanes=1073741824,null):(M=b.children,a=b.fallback,C?(b=u.mode,C=u.child,M={mode:"hidden",children:M},(b&1)===0&&C!==null?(C.childLanes=0,C.pendingProps=M):C=xd(M,b,0,null),a=vo(a,b,h,null),C.return=u,a.return=u,C.sibling=a,u.child=C,u.child.memoizedState=Mp(h),u.memoizedState=Ap,a):Ip(u,M));if(x=a.memoizedState,x!==null&&(ee=x.dehydrated,ee!==null))return yM(a,u,M,b,ee,x,h);if(C){C=b.fallback,M=u.mode,x=a.child,ee=x.sibling;var le={mode:"hidden",children:b.children};return(M&1)===0&&u.child!==x?(b=u.child,b.childLanes=0,b.pendingProps=le,u.deletions=null):(b=La(x,le),b.subtreeFlags=x.subtreeFlags&14680064),ee!==null?C=La(ee,C):(C=vo(C,M,h,null),C.flags|=2),C.return=u,b.return=u,b.sibling=C,u.child=b,b=C,C=u.child,M=a.child.memoizedState,M=M===null?Mp(h):{baseLanes:M.baseLanes|h,cachePool:null,transitions:M.transitions},C.memoizedState=M,C.childLanes=a.childLanes&~h,u.memoizedState=Ap,b}return C=a.child,a=C.sibling,b=La(C,{mode:"visible",children:b.children}),(u.mode&1)===0&&(b.lanes=h),b.return=u,b.sibling=null,a!==null&&(h=u.deletions,h===null?(u.deletions=[a],u.flags|=16):h.push(a)),u.child=b,u.memoizedState=null,b}function Ip(a,u){return u=xd({mode:"visible",children:u},a.mode,0,null),u.return=a,a.child=u}function cd(a,u,h,b){return b!==null&&ap(b),ll(u,a.child,null,h),a=Ip(u,u.pendingProps.children),a.flags|=2,u.memoizedState=null,a}function yM(a,u,h,b,x,C,M){if(h)return u.flags&256?(u.flags&=-257,b=Np(Error(r(422))),cd(a,u,M,b)):u.memoizedState!==null?(u.child=a.child,u.flags|=128,null):(C=b.fallback,x=u.mode,b=xd({mode:"visible",children:b.children},x,0,null),C=vo(C,x,M,null),C.flags|=2,b.return=u,C.return=u,b.sibling=C,u.child=b,(u.mode&1)!==0&&ll(u,a.child,null,M),u.child.memoizedState=Mp(M),u.memoizedState=Ap,C);if((u.mode&1)===0)return cd(a,u,M,null);if(x.data==="$!"){if(b=x.nextSibling&&x.nextSibling.dataset,b)var ee=b.dgst;return b=ee,C=Error(r(419)),b=Np(C,b,void 0),cd(a,u,M,b)}if(ee=(M&a.childLanes)!==0,js||ee){if(b=Zr,b!==null){switch(M&-M){case 4:x=2;break;case 16:x=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:x=32;break;case 536870912:x=268435456;break;default:x=0}x=(x&(b.suspendedLanes|M))!==0?0:x,x!==0&&x!==C.retryLane&&(C.retryLane=x,sa(a,x),yi(b,a,x,-1))}return Yp(),b=Np(Error(r(421))),cd(a,u,M,b)}return x.data==="$?"?(u.flags|=128,u.child=a.child,u=IM.bind(null,a),x._reactRetry=u,null):(a=C.treeContext,Us=Ca(x.nextSibling),Ws=u,hr=!0,gi=null,a!==null&&(Xs[Qs++]=na,Xs[Qs++]=ra,Xs[Qs++]=lo,na=a.id,ra=a.overflow,lo=u),u=Ip(u,b.children),u.flags|=4096,u)}function Xy(a,u,h){a.lanes|=u;var b=a.alternate;b!==null&&(b.lanes|=u),up(a.return,u,h)}function Ep(a,u,h,b,x){var C=a.memoizedState;C===null?a.memoizedState={isBackwards:u,rendering:null,renderingStartTime:0,last:b,tail:h,tailMode:x}:(C.isBackwards=u,C.rendering=null,C.renderingStartTime=0,C.last=b,C.tail=h,C.tailMode=x)}function Qy(a,u,h){var b=u.pendingProps,x=b.revealOrder,C=b.tail;if(vs(a,u,b.children,h),b=yr.current,(b&2)!==0)b=b&1|2,u.flags|=128;else{if(a!==null&&(a.flags&128)!==0)e:for(a=u.child;a!==null;){if(a.tag===13)a.memoizedState!==null&&Xy(a,h,u);else if(a.tag===19)Xy(a,h,u);else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===u)break e;for(;a.sibling===null;){if(a.return===null||a.return===u)break e;a=a.return}a.sibling.return=a.return,a=a.sibling}b&=1}if(er(yr,b),(u.mode&1)===0)u.memoizedState=null;else switch(x){case"forwards":for(h=u.child,x=null;h!==null;)a=h.alternate,a!==null&&nd(a)===null&&(x=h),h=h.sibling;h=x,h===null?(x=u.child,u.child=null):(x=h.sibling,h.sibling=null),Ep(u,!1,x,h,C);break;case"backwards":for(h=null,x=u.child,u.child=null;x!==null;){if(a=x.alternate,a!==null&&nd(a)===null){u.child=x;break}a=x.sibling,x.sibling=h,h=x,x=a}Ep(u,!0,h,null,C);break;case"together":Ep(u,!1,null,null,void 0);break;default:u.memoizedState=null}return u.child}function ud(a,u){(u.mode&1)===0&&a!==null&&(a.alternate=null,u.alternate=null,u.flags|=2)}function aa(a,u,h){if(a!==null&&(u.dependencies=a.dependencies),po|=u.lanes,(h&u.childLanes)===0)return null;if(a!==null&&u.child!==a.child)throw Error(r(153));if(u.child!==null){for(a=u.child,h=La(a,a.pendingProps),u.child=h,h.return=u;a.sibling!==null;)a=a.sibling,h=h.sibling=La(a,a.pendingProps),h.return=u;h.sibling=null}return u.child}function kM(a,u,h){switch(u.tag){case 3:Gy(u),ol();break;case 5:dy(u);break;case 1:Cs(u.type)&&Vu(u);break;case 4:mp(u,u.stateNode.containerInfo);break;case 10:var b=u.type._context,x=u.memoizedProps.value;er(Ju,b._currentValue),b._currentValue=x;break;case 13:if(b=u.memoizedState,b!==null)return b.dehydrated!==null?(er(yr,yr.current&1),u.flags|=128,null):(h&u.child.childLanes)!==0?Yy(a,u,h):(er(yr,yr.current&1),a=aa(a,u,h),a!==null?a.sibling:null);er(yr,yr.current&1);break;case 19:if(b=(h&u.childLanes)!==0,(a.flags&128)!==0){if(b)return Qy(a,u,h);u.flags|=128}if(x=u.memoizedState,x!==null&&(x.rendering=null,x.tail=null,x.lastEffect=null),er(yr,yr.current),b)break;return null;case 22:case 23:return u.lanes=0,qy(a,u,h)}return aa(a,u,h)}var Jy,Lp,Zy,ek;Jy=function(a,u){for(var h=u.child;h!==null;){if(h.tag===5||h.tag===6)a.appendChild(h.stateNode);else if(h.tag!==4&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===u)break;for(;h.sibling===null;){if(h.return===null||h.return===u)return;h=h.return}h.sibling.return=h.return,h=h.sibling}},Lp=function(){},Zy=function(a,u,h,b){var x=a.memoizedProps;if(x!==b){a=u.stateNode,ho(Ii.current);var C=null;switch(h){case"input":x=Nt(a,x),b=Nt(a,b),C=[];break;case"select":x=P({},x,{value:void 0}),b=P({},b,{value:void 0}),C=[];break;case"textarea":x=ke(a,x),b=ke(a,b),C=[];break;default:typeof x.onClick!="function"&&typeof b.onClick=="function"&&(a.onclick=zu)}cn(h,b);var M;h=null;for(Me in x)if(!b.hasOwnProperty(Me)&&x.hasOwnProperty(Me)&&x[Me]!=null)if(Me==="style"){var ee=x[Me];for(M in ee)ee.hasOwnProperty(M)&&(h||(h={}),h[M]="")}else Me!=="dangerouslySetInnerHTML"&&Me!=="children"&&Me!=="suppressContentEditableWarning"&&Me!=="suppressHydrationWarning"&&Me!=="autoFocus"&&(i.hasOwnProperty(Me)?C||(C=[]):(C=C||[]).push(Me,null));for(Me in b){var le=b[Me];if(ee=x!=null?x[Me]:void 0,b.hasOwnProperty(Me)&&le!==ee&&(le!=null||ee!=null))if(Me==="style")if(ee){for(M in ee)!ee.hasOwnProperty(M)||le&&le.hasOwnProperty(M)||(h||(h={}),h[M]="");for(M in le)le.hasOwnProperty(M)&&ee[M]!==le[M]&&(h||(h={}),h[M]=le[M])}else h||(C||(C=[]),C.push(Me,h)),h=le;else Me==="dangerouslySetInnerHTML"?(le=le?le.__html:void 0,ee=ee?ee.__html:void 0,le!=null&&ee!==le&&(C=C||[]).push(Me,le)):Me==="children"?typeof le!="string"&&typeof le!="number"||(C=C||[]).push(Me,""+le):Me!=="suppressContentEditableWarning"&&Me!=="suppressHydrationWarning"&&(i.hasOwnProperty(Me)?(le!=null&&Me==="onScroll"&&cr("scroll",a),C||ee===le||(C=[])):(C=C||[]).push(Me,le))}h&&(C=C||[]).push("style",h);var Me=C;(u.updateQueue=Me)&&(u.flags|=4)}},ek=function(a,u,h,b){h!==b&&(u.flags|=4)};function mc(a,u){if(!hr)switch(a.tailMode){case"hidden":u=a.tail;for(var h=null;u!==null;)u.alternate!==null&&(h=u),u=u.sibling;h===null?a.tail=null:h.sibling=null;break;case"collapsed":h=a.tail;for(var b=null;h!==null;)h.alternate!==null&&(b=h),h=h.sibling;b===null?u||a.tail===null?a.tail=null:a.tail.sibling=null:b.sibling=null}}function ps(a){var u=a.alternate!==null&&a.alternate.child===a.child,h=0,b=0;if(u)for(var x=a.child;x!==null;)h|=x.lanes|x.childLanes,b|=x.subtreeFlags&14680064,b|=x.flags&14680064,x.return=a,x=x.sibling;else for(x=a.child;x!==null;)h|=x.lanes|x.childLanes,b|=x.subtreeFlags,b|=x.flags,x.return=a,x=x.sibling;return a.subtreeFlags|=b,a.childLanes=h,u}function xM(a,u,h){var b=u.pendingProps;switch(rp(u),u.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ps(u),null;case 1:return Cs(u.type)&&$u(),ps(u),null;case 3:return b=u.stateNode,dl(),ur(Ss),ur(hs),gp(),b.pendingContext&&(b.context=b.pendingContext,b.pendingContext=null),(a===null||a.child===null)&&(Xu(u)?u.flags|=4:a===null||a.memoizedState.isDehydrated&&(u.flags&256)===0||(u.flags|=1024,gi!==null&&(Vp(gi),gi=null))),Lp(a,u),ps(u),null;case 5:pp(u);var x=ho(lc.current);if(h=u.type,a!==null&&u.stateNode!=null)Zy(a,u,h,b,x),a.ref!==u.ref&&(u.flags|=512,u.flags|=2097152);else{if(!b){if(u.stateNode===null)throw Error(r(166));return ps(u),null}if(a=ho(Ii.current),Xu(u)){b=u.stateNode,h=u.type;var C=u.memoizedProps;switch(b[Mi]=u,b[rc]=C,a=(u.mode&1)!==0,h){case"dialog":cr("cancel",b),cr("close",b);break;case"iframe":case"object":case"embed":cr("load",b);break;case"video":case"audio":for(x=0;x<ec.length;x++)cr(ec[x],b);break;case"source":cr("error",b);break;case"img":case"image":case"link":cr("error",b),cr("load",b);break;case"details":cr("toggle",b);break;case"input":Ke(b,C),cr("invalid",b);break;case"select":b._wrapperState={wasMultiple:!!C.multiple},cr("invalid",b);break;case"textarea":Ee(b,C),cr("invalid",b)}cn(h,C),x=null;for(var M in C)if(C.hasOwnProperty(M)){var ee=C[M];M==="children"?typeof ee=="string"?b.textContent!==ee&&(C.suppressHydrationWarning!==!0&&Hu(b.textContent,ee,a),x=["children",ee]):typeof ee=="number"&&b.textContent!==""+ee&&(C.suppressHydrationWarning!==!0&&Hu(b.textContent,ee,a),x=["children",""+ee]):i.hasOwnProperty(M)&&ee!=null&&M==="onScroll"&&cr("scroll",b)}switch(h){case"input":Xe(b),Te(b,C,!0);break;case"textarea":Xe(b),wt(b);break;case"select":case"option":break;default:typeof C.onClick=="function"&&(b.onclick=zu)}b=x,u.updateQueue=b,b!==null&&(u.flags|=4)}else{M=x.nodeType===9?x:x.ownerDocument,a==="http://www.w3.org/1999/xhtml"&&(a=me(h)),a==="http://www.w3.org/1999/xhtml"?h==="script"?(a=M.createElement("div"),a.innerHTML="<script><\/script>",a=a.removeChild(a.firstChild)):typeof b.is=="string"?a=M.createElement(h,{is:b.is}):(a=M.createElement(h),h==="select"&&(M=a,b.multiple?M.multiple=!0:b.size&&(M.size=b.size))):a=M.createElementNS(a,h),a[Mi]=u,a[rc]=b,Jy(a,u,!1,!1),u.stateNode=a;e:{switch(M=Vt(h,b),h){case"dialog":cr("cancel",a),cr("close",a),x=b;break;case"iframe":case"object":case"embed":cr("load",a),x=b;break;case"video":case"audio":for(x=0;x<ec.length;x++)cr(ec[x],a);x=b;break;case"source":cr("error",a),x=b;break;case"img":case"image":case"link":cr("error",a),cr("load",a),x=b;break;case"details":cr("toggle",a),x=b;break;case"input":Ke(a,b),x=Nt(a,b),cr("invalid",a);break;case"option":x=b;break;case"select":a._wrapperState={wasMultiple:!!b.multiple},x=P({},b,{value:void 0}),cr("invalid",a);break;case"textarea":Ee(a,b),x=ke(a,b),cr("invalid",a);break;default:x=b}cn(h,x),ee=x;for(C in ee)if(ee.hasOwnProperty(C)){var le=ee[C];C==="style"?jt(a,le):C==="dangerouslySetInnerHTML"?(le=le?le.__html:void 0,le!=null&&dt(a,le)):C==="children"?typeof le=="string"?(h!=="textarea"||le!=="")&&Ye(a,le):typeof le=="number"&&Ye(a,""+le):C!=="suppressContentEditableWarning"&&C!=="suppressHydrationWarning"&&C!=="autoFocus"&&(i.hasOwnProperty(C)?le!=null&&C==="onScroll"&&cr("scroll",a):le!=null&&D(a,C,le,M))}switch(h){case"input":Xe(a),Te(a,b,!1);break;case"textarea":Xe(a),wt(a);break;case"option":b.value!=null&&a.setAttribute("value",""+Le(b.value));break;case"select":a.multiple=!!b.multiple,C=b.value,C!=null?qe(a,!!b.multiple,C,!1):b.defaultValue!=null&&qe(a,!!b.multiple,b.defaultValue,!0);break;default:typeof x.onClick=="function"&&(a.onclick=zu)}switch(h){case"button":case"input":case"select":case"textarea":b=!!b.autoFocus;break e;case"img":b=!0;break e;default:b=!1}}b&&(u.flags|=4)}u.ref!==null&&(u.flags|=512,u.flags|=2097152)}return ps(u),null;case 6:if(a&&u.stateNode!=null)ek(a,u,a.memoizedProps,b);else{if(typeof b!="string"&&u.stateNode===null)throw Error(r(166));if(h=ho(lc.current),ho(Ii.current),Xu(u)){if(b=u.stateNode,h=u.memoizedProps,b[Mi]=u,(C=b.nodeValue!==h)&&(a=Ws,a!==null))switch(a.tag){case 3:Hu(b.nodeValue,h,(a.mode&1)!==0);break;case 5:a.memoizedProps.suppressHydrationWarning!==!0&&Hu(b.nodeValue,h,(a.mode&1)!==0)}C&&(u.flags|=4)}else b=(h.nodeType===9?h:h.ownerDocument).createTextNode(b),b[Mi]=u,u.stateNode=b}return ps(u),null;case 13:if(ur(yr),b=u.memoizedState,a===null||a.memoizedState!==null&&a.memoizedState.dehydrated!==null){if(hr&&Us!==null&&(u.mode&1)!==0&&(u.flags&128)===0)ry(),ol(),u.flags|=98560,C=!1;else if(C=Xu(u),b!==null&&b.dehydrated!==null){if(a===null){if(!C)throw Error(r(318));if(C=u.memoizedState,C=C!==null?C.dehydrated:null,!C)throw Error(r(317));C[Mi]=u}else ol(),(u.flags&128)===0&&(u.memoizedState=null),u.flags|=4;ps(u),C=!1}else gi!==null&&(Vp(gi),gi=null),C=!0;if(!C)return u.flags&65536?u:null}return(u.flags&128)!==0?(u.lanes=h,u):(b=b!==null,b!==(a!==null&&a.memoizedState!==null)&&b&&(u.child.flags|=8192,(u.mode&1)!==0&&(a===null||(yr.current&1)!==0?Vr===0&&(Vr=3):Yp())),u.updateQueue!==null&&(u.flags|=4),ps(u),null);case 4:return dl(),Lp(a,u),a===null&&tc(u.stateNode.containerInfo),ps(u),null;case 10:return cp(u.type._context),ps(u),null;case 17:return Cs(u.type)&&$u(),ps(u),null;case 19:if(ur(yr),C=u.memoizedState,C===null)return ps(u),null;if(b=(u.flags&128)!==0,M=C.rendering,M===null)if(b)mc(C,!1);else{if(Vr!==0||a!==null&&(a.flags&128)!==0)for(a=u.child;a!==null;){if(M=nd(a),M!==null){for(u.flags|=128,mc(C,!1),b=M.updateQueue,b!==null&&(u.updateQueue=b,u.flags|=4),u.subtreeFlags=0,b=h,h=u.child;h!==null;)C=h,a=b,C.flags&=14680066,M=C.alternate,M===null?(C.childLanes=0,C.lanes=a,C.child=null,C.subtreeFlags=0,C.memoizedProps=null,C.memoizedState=null,C.updateQueue=null,C.dependencies=null,C.stateNode=null):(C.childLanes=M.childLanes,C.lanes=M.lanes,C.child=M.child,C.subtreeFlags=0,C.deletions=null,C.memoizedProps=M.memoizedProps,C.memoizedState=M.memoizedState,C.updateQueue=M.updateQueue,C.type=M.type,a=M.dependencies,C.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),h=h.sibling;return er(yr,yr.current&1|2),u.child}a=a.sibling}C.tail!==null&&Qt()>fl&&(u.flags|=128,b=!0,mc(C,!1),u.lanes=4194304)}else{if(!b)if(a=nd(M),a!==null){if(u.flags|=128,b=!0,h=a.updateQueue,h!==null&&(u.updateQueue=h,u.flags|=4),mc(C,!0),C.tail===null&&C.tailMode==="hidden"&&!M.alternate&&!hr)return ps(u),null}else 2*Qt()-C.renderingStartTime>fl&&h!==1073741824&&(u.flags|=128,b=!0,mc(C,!1),u.lanes=4194304);C.isBackwards?(M.sibling=u.child,u.child=M):(h=C.last,h!==null?h.sibling=M:u.child=M,C.last=M)}return C.tail!==null?(u=C.tail,C.rendering=u,C.tail=u.sibling,C.renderingStartTime=Qt(),u.sibling=null,h=yr.current,er(yr,b?h&1|2:h&1),u):(ps(u),null);case 22:case 23:return Kp(),b=u.memoizedState!==null,a!==null&&a.memoizedState!==null!==b&&(u.flags|=8192),b&&(u.mode&1)!==0?(Hs&1073741824)!==0&&(ps(u),u.subtreeFlags&6&&(u.flags|=8192)):ps(u),null;case 24:return null;case 25:return null}throw Error(r(156,u.tag))}function SM(a,u){switch(rp(u),u.tag){case 1:return Cs(u.type)&&$u(),a=u.flags,a&65536?(u.flags=a&-65537|128,u):null;case 3:return dl(),ur(Ss),ur(hs),gp(),a=u.flags,(a&65536)!==0&&(a&128)===0?(u.flags=a&-65537|128,u):null;case 5:return pp(u),null;case 13:if(ur(yr),a=u.memoizedState,a!==null&&a.dehydrated!==null){if(u.alternate===null)throw Error(r(340));ol()}return a=u.flags,a&65536?(u.flags=a&-65537|128,u):null;case 19:return ur(yr),null;case 4:return dl(),null;case 10:return cp(u.type._context),null;case 22:case 23:return Kp(),null;case 24:return null;default:return null}}var dd=!1,fs=!1,CM=typeof WeakSet=="function"?WeakSet:Set,_t=null;function ml(a,u){var h=a.ref;if(h!==null)if(typeof h=="function")try{h(null)}catch(b){Tr(a,u,b)}else h.current=null}function Fp(a,u,h){try{h()}catch(b){Tr(a,u,b)}}var tk=!1;function jM(a,u){if(Km=Nr,a=Iw(),Wm(a)){if("selectionStart"in a)var h={start:a.selectionStart,end:a.selectionEnd};else e:{h=(h=a.ownerDocument)&&h.defaultView||window;var b=h.getSelection&&h.getSelection();if(b&&b.rangeCount!==0){h=b.anchorNode;var x=b.anchorOffset,C=b.focusNode;b=b.focusOffset;try{h.nodeType,C.nodeType}catch{h=null;break e}var M=0,ee=-1,le=-1,Me=0,et=0,st=a,Qe=null;t:for(;;){for(var At;st!==h||x!==0&&st.nodeType!==3||(ee=M+x),st!==C||b!==0&&st.nodeType!==3||(le=M+b),st.nodeType===3&&(M+=st.nodeValue.length),(At=st.firstChild)!==null;)Qe=st,st=At;for(;;){if(st===a)break t;if(Qe===h&&++Me===x&&(ee=M),Qe===C&&++et===b&&(le=M),(At=st.nextSibling)!==null)break;st=Qe,Qe=st.parentNode}st=At}h=ee===-1||le===-1?null:{start:ee,end:le}}else h=null}h=h||{start:0,end:0}}else h=null;for(Ym={focusedElem:a,selectionRange:h},Nr=!1,_t=u;_t!==null;)if(u=_t,a=u.child,(u.subtreeFlags&1028)!==0&&a!==null)a.return=u,_t=a;else for(;_t!==null;){u=_t;try{var Bt=u.alternate;if((u.flags&1024)!==0)switch(u.tag){case 0:case 11:case 15:break;case 1:if(Bt!==null){var qt=Bt.memoizedProps,Rr=Bt.memoizedState,ye=u.stateNode,he=ye.getSnapshotBeforeUpdate(u.elementType===u.type?qt:bi(u.type,qt),Rr);ye.__reactInternalSnapshotBeforeUpdate=he}break;case 3:var je=u.stateNode.containerInfo;je.nodeType===1?je.textContent="":je.nodeType===9&&je.documentElement&&je.removeChild(je.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(xt){Tr(u,u.return,xt)}if(a=u.sibling,a!==null){a.return=u.return,_t=a;break}_t=u.return}return Bt=tk,tk=!1,Bt}function pc(a,u,h){var b=u.updateQueue;if(b=b!==null?b.lastEffect:null,b!==null){var x=b=b.next;do{if((x.tag&a)===a){var C=x.destroy;x.destroy=void 0,C!==void 0&&Fp(u,h,C)}x=x.next}while(x!==b)}}function hd(a,u){if(u=u.updateQueue,u=u!==null?u.lastEffect:null,u!==null){var h=u=u.next;do{if((h.tag&a)===a){var b=h.create;h.destroy=b()}h=h.next}while(h!==u)}}function _p(a){var u=a.ref;if(u!==null){var h=a.stateNode;switch(a.tag){case 5:a=h;break;default:a=h}typeof u=="function"?u(a):u.current=a}}function nk(a){var u=a.alternate;u!==null&&(a.alternate=null,nk(u)),a.child=null,a.deletions=null,a.sibling=null,a.tag===5&&(u=a.stateNode,u!==null&&(delete u[Mi],delete u[rc],delete u[Zm],delete u[oM],delete u[lM])),a.stateNode=null,a.return=null,a.dependencies=null,a.memoizedProps=null,a.memoizedState=null,a.pendingProps=null,a.stateNode=null,a.updateQueue=null}function rk(a){return a.tag===5||a.tag===3||a.tag===4}function sk(a){e:for(;;){for(;a.sibling===null;){if(a.return===null||rk(a.return))return null;a=a.return}for(a.sibling.return=a.return,a=a.sibling;a.tag!==5&&a.tag!==6&&a.tag!==18;){if(a.flags&2||a.child===null||a.tag===4)continue e;a.child.return=a,a=a.child}if(!(a.flags&2))return a.stateNode}}function Op(a,u,h){var b=a.tag;if(b===5||b===6)a=a.stateNode,u?h.nodeType===8?h.parentNode.insertBefore(a,u):h.insertBefore(a,u):(h.nodeType===8?(u=h.parentNode,u.insertBefore(a,h)):(u=h,u.appendChild(a)),h=h._reactRootContainer,h!=null||u.onclick!==null||(u.onclick=zu));else if(b!==4&&(a=a.child,a!==null))for(Op(a,u,h),a=a.sibling;a!==null;)Op(a,u,h),a=a.sibling}function Bp(a,u,h){var b=a.tag;if(b===5||b===6)a=a.stateNode,u?h.insertBefore(a,u):h.appendChild(a);else if(b!==4&&(a=a.child,a!==null))for(Bp(a,u,h),a=a.sibling;a!==null;)Bp(a,u,h),a=a.sibling}var as=null,vi=!1;function Ra(a,u,h){for(h=h.child;h!==null;)ik(a,u,h),h=h.sibling}function ik(a,u,h){if(Pn&&typeof Pn.onCommitFiberUnmount=="function")try{Pn.onCommitFiberUnmount(Zt,h)}catch{}switch(h.tag){case 5:fs||ml(h,u);case 6:var b=as,x=vi;as=null,Ra(a,u,h),as=b,vi=x,as!==null&&(vi?(a=as,h=h.stateNode,a.nodeType===8?a.parentNode.removeChild(h):a.removeChild(h)):as.removeChild(h.stateNode));break;case 18:as!==null&&(vi?(a=as,h=h.stateNode,a.nodeType===8?Jm(a.parentNode,h):a.nodeType===1&&Jm(a,h),Ln(a)):Jm(as,h.stateNode));break;case 4:b=as,x=vi,as=h.stateNode.containerInfo,vi=!0,Ra(a,u,h),as=b,vi=x;break;case 0:case 11:case 14:case 15:if(!fs&&(b=h.updateQueue,b!==null&&(b=b.lastEffect,b!==null))){x=b=b.next;do{var C=x,M=C.destroy;C=C.tag,M!==void 0&&((C&2)!==0||(C&4)!==0)&&Fp(h,u,M),x=x.next}while(x!==b)}Ra(a,u,h);break;case 1:if(!fs&&(ml(h,u),b=h.stateNode,typeof b.componentWillUnmount=="function"))try{b.props=h.memoizedProps,b.state=h.memoizedState,b.componentWillUnmount()}catch(ee){Tr(h,u,ee)}Ra(a,u,h);break;case 21:Ra(a,u,h);break;case 22:h.mode&1?(fs=(b=fs)||h.memoizedState!==null,Ra(a,u,h),fs=b):Ra(a,u,h);break;default:Ra(a,u,h)}}function ak(a){var u=a.updateQueue;if(u!==null){a.updateQueue=null;var h=a.stateNode;h===null&&(h=a.stateNode=new CM),u.forEach(function(b){var x=EM.bind(null,a,b);h.has(b)||(h.add(b),b.then(x,x))})}}function wi(a,u){var h=u.deletions;if(h!==null)for(var b=0;b<h.length;b++){var x=h[b];try{var C=a,M=u,ee=M;e:for(;ee!==null;){switch(ee.tag){case 5:as=ee.stateNode,vi=!1;break e;case 3:as=ee.stateNode.containerInfo,vi=!0;break e;case 4:as=ee.stateNode.containerInfo,vi=!0;break e}ee=ee.return}if(as===null)throw Error(r(160));ik(C,M,x),as=null,vi=!1;var le=x.alternate;le!==null&&(le.return=null),x.return=null}catch(Me){Tr(x,u,Me)}}if(u.subtreeFlags&12854)for(u=u.child;u!==null;)ok(u,a),u=u.sibling}function ok(a,u){var h=a.alternate,b=a.flags;switch(a.tag){case 0:case 11:case 14:case 15:if(wi(u,a),Li(a),b&4){try{pc(3,a,a.return),hd(3,a)}catch(qt){Tr(a,a.return,qt)}try{pc(5,a,a.return)}catch(qt){Tr(a,a.return,qt)}}break;case 1:wi(u,a),Li(a),b&512&&h!==null&&ml(h,h.return);break;case 5:if(wi(u,a),Li(a),b&512&&h!==null&&ml(h,h.return),a.flags&32){var x=a.stateNode;try{Ye(x,"")}catch(qt){Tr(a,a.return,qt)}}if(b&4&&(x=a.stateNode,x!=null)){var C=a.memoizedProps,M=h!==null?h.memoizedProps:C,ee=a.type,le=a.updateQueue;if(a.updateQueue=null,le!==null)try{ee==="input"&&C.type==="radio"&&C.name!=null&&ut(x,C),Vt(ee,M);var Me=Vt(ee,C);for(M=0;M<le.length;M+=2){var et=le[M],st=le[M+1];et==="style"?jt(x,st):et==="dangerouslySetInnerHTML"?dt(x,st):et==="children"?Ye(x,st):D(x,et,st,Me)}switch(ee){case"input":vt(x,C);break;case"textarea":$e(x,C);break;case"select":var Qe=x._wrapperState.wasMultiple;x._wrapperState.wasMultiple=!!C.multiple;var At=C.value;At!=null?qe(x,!!C.multiple,At,!1):Qe!==!!C.multiple&&(C.defaultValue!=null?qe(x,!!C.multiple,C.defaultValue,!0):qe(x,!!C.multiple,C.multiple?[]:"",!1))}x[rc]=C}catch(qt){Tr(a,a.return,qt)}}break;case 6:if(wi(u,a),Li(a),b&4){if(a.stateNode===null)throw Error(r(162));x=a.stateNode,C=a.memoizedProps;try{x.nodeValue=C}catch(qt){Tr(a,a.return,qt)}}break;case 3:if(wi(u,a),Li(a),b&4&&h!==null&&h.memoizedState.isDehydrated)try{Ln(u.containerInfo)}catch(qt){Tr(a,a.return,qt)}break;case 4:wi(u,a),Li(a);break;case 13:wi(u,a),Li(a),x=a.child,x.flags&8192&&(C=x.memoizedState!==null,x.stateNode.isHidden=C,!C||x.alternate!==null&&x.alternate.memoizedState!==null||(Hp=Qt())),b&4&&ak(a);break;case 22:if(et=h!==null&&h.memoizedState!==null,a.mode&1?(fs=(Me=fs)||et,wi(u,a),fs=Me):wi(u,a),Li(a),b&8192){if(Me=a.memoizedState!==null,(a.stateNode.isHidden=Me)&&!et&&(a.mode&1)!==0)for(_t=a,et=a.child;et!==null;){for(st=_t=et;_t!==null;){switch(Qe=_t,At=Qe.child,Qe.tag){case 0:case 11:case 14:case 15:pc(4,Qe,Qe.return);break;case 1:ml(Qe,Qe.return);var Bt=Qe.stateNode;if(typeof Bt.componentWillUnmount=="function"){b=Qe,h=Qe.return;try{u=b,Bt.props=u.memoizedProps,Bt.state=u.memoizedState,Bt.componentWillUnmount()}catch(qt){Tr(b,h,qt)}}break;case 5:ml(Qe,Qe.return);break;case 22:if(Qe.memoizedState!==null){uk(st);continue}}At!==null?(At.return=Qe,_t=At):uk(st)}et=et.sibling}e:for(et=null,st=a;;){if(st.tag===5){if(et===null){et=st;try{x=st.stateNode,Me?(C=x.style,typeof C.setProperty=="function"?C.setProperty("display","none","important"):C.display="none"):(ee=st.stateNode,le=st.memoizedProps.style,M=le!=null&&le.hasOwnProperty("display")?le.display:null,ee.style.display=We("display",M))}catch(qt){Tr(a,a.return,qt)}}}else if(st.tag===6){if(et===null)try{st.stateNode.nodeValue=Me?"":st.memoizedProps}catch(qt){Tr(a,a.return,qt)}}else if((st.tag!==22&&st.tag!==23||st.memoizedState===null||st===a)&&st.child!==null){st.child.return=st,st=st.child;continue}if(st===a)break e;for(;st.sibling===null;){if(st.return===null||st.return===a)break e;et===st&&(et=null),st=st.return}et===st&&(et=null),st.sibling.return=st.return,st=st.sibling}}break;case 19:wi(u,a),Li(a),b&4&&ak(a);break;case 21:break;default:wi(u,a),Li(a)}}function Li(a){var u=a.flags;if(u&2){try{e:{for(var h=a.return;h!==null;){if(rk(h)){var b=h;break e}h=h.return}throw Error(r(160))}switch(b.tag){case 5:var x=b.stateNode;b.flags&32&&(Ye(x,""),b.flags&=-33);var C=sk(a);Bp(a,C,x);break;case 3:case 4:var M=b.stateNode.containerInfo,ee=sk(a);Op(a,ee,M);break;default:throw Error(r(161))}}catch(le){Tr(a,a.return,le)}a.flags&=-3}u&4096&&(a.flags&=-4097)}function TM(a,u,h){_t=a,lk(a)}function lk(a,u,h){for(var b=(a.mode&1)!==0;_t!==null;){var x=_t,C=x.child;if(x.tag===22&&b){var M=x.memoizedState!==null||dd;if(!M){var ee=x.alternate,le=ee!==null&&ee.memoizedState!==null||fs;ee=dd;var Me=fs;if(dd=M,(fs=le)&&!Me)for(_t=x;_t!==null;)M=_t,le=M.child,M.tag===22&&M.memoizedState!==null?dk(x):le!==null?(le.return=M,_t=le):dk(x);for(;C!==null;)_t=C,lk(C),C=C.sibling;_t=x,dd=ee,fs=Me}ck(a)}else(x.subtreeFlags&8772)!==0&&C!==null?(C.return=x,_t=C):ck(a)}}function ck(a){for(;_t!==null;){var u=_t;if((u.flags&8772)!==0){var h=u.alternate;try{if((u.flags&8772)!==0)switch(u.tag){case 0:case 11:case 15:fs||hd(5,u);break;case 1:var b=u.stateNode;if(u.flags&4&&!fs)if(h===null)b.componentDidMount();else{var x=u.elementType===u.type?h.memoizedProps:bi(u.type,h.memoizedProps);b.componentDidUpdate(x,h.memoizedState,b.__reactInternalSnapshotBeforeUpdate)}var C=u.updateQueue;C!==null&&uy(u,C,b);break;case 3:var M=u.updateQueue;if(M!==null){if(h=null,u.child!==null)switch(u.child.tag){case 5:h=u.child.stateNode;break;case 1:h=u.child.stateNode}uy(u,M,h)}break;case 5:var ee=u.stateNode;if(h===null&&u.flags&4){h=ee;var le=u.memoizedProps;switch(u.type){case"button":case"input":case"select":case"textarea":le.autoFocus&&h.focus();break;case"img":le.src&&(h.src=le.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(u.memoizedState===null){var Me=u.alternate;if(Me!==null){var et=Me.memoizedState;if(et!==null){var st=et.dehydrated;st!==null&&Ln(st)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}fs||u.flags&512&&_p(u)}catch(Qe){Tr(u,u.return,Qe)}}if(u===a){_t=null;break}if(h=u.sibling,h!==null){h.return=u.return,_t=h;break}_t=u.return}}function uk(a){for(;_t!==null;){var u=_t;if(u===a){_t=null;break}var h=u.sibling;if(h!==null){h.return=u.return,_t=h;break}_t=u.return}}function dk(a){for(;_t!==null;){var u=_t;try{switch(u.tag){case 0:case 11:case 15:var h=u.return;try{hd(4,u)}catch(le){Tr(u,h,le)}break;case 1:var b=u.stateNode;if(typeof b.componentDidMount=="function"){var x=u.return;try{b.componentDidMount()}catch(le){Tr(u,x,le)}}var C=u.return;try{_p(u)}catch(le){Tr(u,C,le)}break;case 5:var M=u.return;try{_p(u)}catch(le){Tr(u,M,le)}}}catch(le){Tr(u,u.return,le)}if(u===a){_t=null;break}var ee=u.sibling;if(ee!==null){ee.return=u.return,_t=ee;break}_t=u.return}}var NM=Math.ceil,md=H.ReactCurrentDispatcher,Wp=H.ReactCurrentOwner,ei=H.ReactCurrentBatchConfig,On=0,Zr=null,Fr=null,os=0,Hs=0,pl=ja(0),Vr=0,fc=null,po=0,pd=0,Up=0,gc=null,Ts=null,Hp=0,fl=1/0,oa=null,fd=!1,zp=null,Aa=null,gd=!1,Ma=null,bd=0,bc=0,qp=null,vd=-1,wd=0;function ws(){return(On&6)!==0?Qt():vd!==-1?vd:vd=Qt()}function Ia(a){return(a.mode&1)===0?1:(On&2)!==0&&os!==0?os&-os:uM.transition!==null?(wd===0&&(wd=Hr()),wd):(a=Yt,a!==0||(a=window.event,a=a===void 0?16:Di(a.type)),a)}function yi(a,u,h,b){if(50<bc)throw bc=0,qp=null,Error(r(185));Ir(a,h,b),((On&2)===0||a!==Zr)&&(a===Zr&&((On&2)===0&&(pd|=h),Vr===4&&Ea(a,os)),Ns(a,b),h===1&&On===0&&(u.mode&1)===0&&(fl=Qt()+500,Gu&&Na()))}function Ns(a,u){var h=a.callbackNode;ls(a,u);var b=Cr(a,a===Zr?os:0);if(b===0)h!==null&&En(h),a.callbackNode=null,a.callbackPriority=0;else if(u=b&-b,a.callbackPriority!==u){if(h!=null&&En(h),u===1)a.tag===0?cM(mk.bind(null,a)):Jw(mk.bind(null,a)),iM(function(){(On&6)===0&&Na()}),h=null;else{switch(bn(b)){case 1:h=De;break;case 4:h=ze;break;case 16:h=$t;break;case 536870912:h=kt;break;default:h=$t}h=kk(h,hk.bind(null,a))}a.callbackPriority=u,a.callbackNode=h}}function hk(a,u){if(vd=-1,wd=0,(On&6)!==0)throw Error(r(327));var h=a.callbackNode;if(gl()&&a.callbackNode!==h)return null;var b=Cr(a,a===Zr?os:0);if(b===0)return null;if((b&30)!==0||(b&a.expiredLanes)!==0||u)u=yd(a,b);else{u=b;var x=On;On|=2;var C=fk();(Zr!==a||os!==u)&&(oa=null,fl=Qt()+500,go(a,u));do try{RM();break}catch(ee){pk(a,ee)}while(!0);lp(),md.current=C,On=x,Fr!==null?u=0:(Zr=null,os=0,u=Vr)}if(u!==0){if(u===2&&(x=ts(a),x!==0&&(b=x,u=$p(a,x))),u===1)throw h=fc,go(a,0),Ea(a,b),Ns(a,Qt()),h;if(u===6)Ea(a,b);else{if(x=a.current.alternate,(b&30)===0&&!PM(x)&&(u=yd(a,b),u===2&&(C=ts(a),C!==0&&(b=C,u=$p(a,C))),u===1))throw h=fc,go(a,0),Ea(a,b),Ns(a,Qt()),h;switch(a.finishedWork=x,a.finishedLanes=b,u){case 0:case 1:throw Error(r(345));case 2:bo(a,Ts,oa);break;case 3:if(Ea(a,b),(b&130023424)===b&&(u=Hp+500-Qt(),10<u)){if(Cr(a,0)!==0)break;if(x=a.suspendedLanes,(x&b)!==b){ws(),a.pingedLanes|=a.suspendedLanes&x;break}a.timeoutHandle=Qm(bo.bind(null,a,Ts,oa),u);break}bo(a,Ts,oa);break;case 4:if(Ea(a,b),(b&4194240)===b)break;for(u=a.eventTimes,x=-1;0<b;){var M=31-Jt(b);C=1<<M,M=u[M],M>x&&(x=M),b&=~C}if(b=x,b=Qt()-b,b=(120>b?120:480>b?480:1080>b?1080:1920>b?1920:3e3>b?3e3:4320>b?4320:1960*NM(b/1960))-b,10<b){a.timeoutHandle=Qm(bo.bind(null,a,Ts,oa),b);break}bo(a,Ts,oa);break;case 5:bo(a,Ts,oa);break;default:throw Error(r(329))}}}return Ns(a,Qt()),a.callbackNode===h?hk.bind(null,a):null}function $p(a,u){var h=gc;return a.current.memoizedState.isDehydrated&&(go(a,u).flags|=256),a=yd(a,u),a!==2&&(u=Ts,Ts=h,u!==null&&Vp(u)),a}function Vp(a){Ts===null?Ts=a:Ts.push.apply(Ts,a)}function PM(a){for(var u=a;;){if(u.flags&16384){var h=u.updateQueue;if(h!==null&&(h=h.stores,h!==null))for(var b=0;b<h.length;b++){var x=h[b],C=x.getSnapshot;x=x.value;try{if(!fi(C(),x))return!1}catch{return!1}}}if(h=u.child,u.subtreeFlags&16384&&h!==null)h.return=u,u=h;else{if(u===a)break;for(;u.sibling===null;){if(u.return===null||u.return===a)return!0;u=u.return}u.sibling.return=u.return,u=u.sibling}}return!0}function Ea(a,u){for(u&=~Up,u&=~pd,a.suspendedLanes|=u,a.pingedLanes&=~u,a=a.expirationTimes;0<u;){var h=31-Jt(u),b=1<<h;a[h]=-1,u&=~b}}function mk(a){if((On&6)!==0)throw Error(r(327));gl();var u=Cr(a,0);if((u&1)===0)return Ns(a,Qt()),null;var h=yd(a,u);if(a.tag!==0&&h===2){var b=ts(a);b!==0&&(u=b,h=$p(a,b))}if(h===1)throw h=fc,go(a,0),Ea(a,u),Ns(a,Qt()),h;if(h===6)throw Error(r(345));return a.finishedWork=a.current.alternate,a.finishedLanes=u,bo(a,Ts,oa),Ns(a,Qt()),null}function Gp(a,u){var h=On;On|=1;try{return a(u)}finally{On=h,On===0&&(fl=Qt()+500,Gu&&Na())}}function fo(a){Ma!==null&&Ma.tag===0&&(On&6)===0&&gl();var u=On;On|=1;var h=ei.transition,b=Yt;try{if(ei.transition=null,Yt=1,a)return a()}finally{Yt=b,ei.transition=h,On=u,(On&6)===0&&Na()}}function Kp(){Hs=pl.current,ur(pl)}function go(a,u){a.finishedWork=null,a.finishedLanes=0;var h=a.timeoutHandle;if(h!==-1&&(a.timeoutHandle=-1,sM(h)),Fr!==null)for(h=Fr.return;h!==null;){var b=h;switch(rp(b),b.tag){case 1:b=b.type.childContextTypes,b!=null&&$u();break;case 3:dl(),ur(Ss),ur(hs),gp();break;case 5:pp(b);break;case 4:dl();break;case 13:ur(yr);break;case 19:ur(yr);break;case 10:cp(b.type._context);break;case 22:case 23:Kp()}h=h.return}if(Zr=a,Fr=a=La(a.current,null),os=Hs=u,Vr=0,fc=null,Up=pd=po=0,Ts=gc=null,uo!==null){for(u=0;u<uo.length;u++)if(h=uo[u],b=h.interleaved,b!==null){h.interleaved=null;var x=b.next,C=h.pending;if(C!==null){var M=C.next;C.next=x,b.next=M}h.pending=b}uo=null}return a}function pk(a,u){do{var h=Fr;try{if(lp(),rd.current=od,sd){for(var b=kr.memoizedState;b!==null;){var x=b.queue;x!==null&&(x.pending=null),b=b.next}sd=!1}if(mo=0,Jr=$r=kr=null,cc=!1,uc=0,Wp.current=null,h===null||h.return===null){Vr=1,fc=u,Fr=null;break}e:{var C=a,M=h.return,ee=h,le=u;if(u=os,ee.flags|=32768,le!==null&&typeof le=="object"&&typeof le.then=="function"){var Me=le,et=ee,st=et.tag;if((et.mode&1)===0&&(st===0||st===11||st===15)){var Qe=et.alternate;Qe?(et.updateQueue=Qe.updateQueue,et.memoizedState=Qe.memoizedState,et.lanes=Qe.lanes):(et.updateQueue=null,et.memoizedState=null)}var At=By(M);if(At!==null){At.flags&=-257,Wy(At,M,ee,C,u),At.mode&1&&Oy(C,Me,u),u=At,le=Me;var Bt=u.updateQueue;if(Bt===null){var qt=new Set;qt.add(le),u.updateQueue=qt}else Bt.add(le);break e}else{if((u&1)===0){Oy(C,Me,u),Yp();break e}le=Error(r(426))}}else if(hr&&ee.mode&1){var Rr=By(M);if(Rr!==null){(Rr.flags&65536)===0&&(Rr.flags|=256),Wy(Rr,M,ee,C,u),ap(hl(le,ee));break e}}C=le=hl(le,ee),Vr!==4&&(Vr=2),gc===null?gc=[C]:gc.push(C),C=M;do{switch(C.tag){case 3:C.flags|=65536,u&=-u,C.lanes|=u;var ye=Fy(C,le,u);cy(C,ye);break e;case 1:ee=le;var he=C.type,je=C.stateNode;if((C.flags&128)===0&&(typeof he.getDerivedStateFromError=="function"||je!==null&&typeof je.componentDidCatch=="function"&&(Aa===null||!Aa.has(je)))){C.flags|=65536,u&=-u,C.lanes|=u;var xt=_y(C,ee,u);cy(C,xt);break e}}C=C.return}while(C!==null)}bk(h)}catch(Xt){u=Xt,Fr===h&&h!==null&&(Fr=h=h.return);continue}break}while(!0)}function fk(){var a=md.current;return md.current=od,a===null?od:a}function Yp(){(Vr===0||Vr===3||Vr===2)&&(Vr=4),Zr===null||(po&268435455)===0&&(pd&268435455)===0||Ea(Zr,os)}function yd(a,u){var h=On;On|=2;var b=fk();(Zr!==a||os!==u)&&(oa=null,go(a,u));do try{DM();break}catch(x){pk(a,x)}while(!0);if(lp(),On=h,md.current=b,Fr!==null)throw Error(r(261));return Zr=null,os=0,Vr}function DM(){for(;Fr!==null;)gk(Fr)}function RM(){for(;Fr!==null&&!Hn();)gk(Fr)}function gk(a){var u=yk(a.alternate,a,Hs);a.memoizedProps=a.pendingProps,u===null?bk(a):Fr=u,Wp.current=null}function bk(a){var u=a;do{var h=u.alternate;if(a=u.return,(u.flags&32768)===0){if(h=xM(h,u,Hs),h!==null){Fr=h;return}}else{if(h=SM(h,u),h!==null){h.flags&=32767,Fr=h;return}if(a!==null)a.flags|=32768,a.subtreeFlags=0,a.deletions=null;else{Vr=6,Fr=null;return}}if(u=u.sibling,u!==null){Fr=u;return}Fr=u=a}while(u!==null);Vr===0&&(Vr=5)}function bo(a,u,h){var b=Yt,x=ei.transition;try{ei.transition=null,Yt=1,AM(a,u,h,b)}finally{ei.transition=x,Yt=b}return null}function AM(a,u,h,b){do gl();while(Ma!==null);if((On&6)!==0)throw Error(r(327));h=a.finishedWork;var x=a.finishedLanes;if(h===null)return null;if(a.finishedWork=null,a.finishedLanes=0,h===a.current)throw Error(r(177));a.callbackNode=null,a.callbackPriority=0;var C=h.lanes|h.childLanes;if(vr(a,C),a===Zr&&(Fr=Zr=null,os=0),(h.subtreeFlags&2064)===0&&(h.flags&2064)===0||gd||(gd=!0,kk($t,function(){return gl(),null})),C=(h.flags&15990)!==0,(h.subtreeFlags&15990)!==0||C){C=ei.transition,ei.transition=null;var M=Yt;Yt=1;var ee=On;On|=4,Wp.current=null,jM(a,h),ok(h,a),QA(Ym),Nr=!!Km,Ym=Km=null,a.current=h,TM(h),jn(),On=ee,Yt=M,ei.transition=C}else a.current=h;if(gd&&(gd=!1,Ma=a,bd=x),C=a.pendingLanes,C===0&&(Aa=null),Sr(h.stateNode),Ns(a,Qt()),u!==null)for(b=a.onRecoverableError,h=0;h<u.length;h++)x=u[h],b(x.value,{componentStack:x.stack,digest:x.digest});if(fd)throw fd=!1,a=zp,zp=null,a;return(bd&1)!==0&&a.tag!==0&&gl(),C=a.pendingLanes,(C&1)!==0?a===qp?bc++:(bc=0,qp=a):bc=0,Na(),null}function gl(){if(Ma!==null){var a=bn(bd),u=ei.transition,h=Yt;try{if(ei.transition=null,Yt=16>a?16:a,Ma===null)var b=!1;else{if(a=Ma,Ma=null,bd=0,(On&6)!==0)throw Error(r(331));var x=On;for(On|=4,_t=a.current;_t!==null;){var C=_t,M=C.child;if((_t.flags&16)!==0){var ee=C.deletions;if(ee!==null){for(var le=0;le<ee.length;le++){var Me=ee[le];for(_t=Me;_t!==null;){var et=_t;switch(et.tag){case 0:case 11:case 15:pc(8,et,C)}var st=et.child;if(st!==null)st.return=et,_t=st;else for(;_t!==null;){et=_t;var Qe=et.sibling,At=et.return;if(nk(et),et===Me){_t=null;break}if(Qe!==null){Qe.return=At,_t=Qe;break}_t=At}}}var Bt=C.alternate;if(Bt!==null){var qt=Bt.child;if(qt!==null){Bt.child=null;do{var Rr=qt.sibling;qt.sibling=null,qt=Rr}while(qt!==null)}}_t=C}}if((C.subtreeFlags&2064)!==0&&M!==null)M.return=C,_t=M;else e:for(;_t!==null;){if(C=_t,(C.flags&2048)!==0)switch(C.tag){case 0:case 11:case 15:pc(9,C,C.return)}var ye=C.sibling;if(ye!==null){ye.return=C.return,_t=ye;break e}_t=C.return}}var he=a.current;for(_t=he;_t!==null;){M=_t;var je=M.child;if((M.subtreeFlags&2064)!==0&&je!==null)je.return=M,_t=je;else e:for(M=he;_t!==null;){if(ee=_t,(ee.flags&2048)!==0)try{switch(ee.tag){case 0:case 11:case 15:hd(9,ee)}}catch(Xt){Tr(ee,ee.return,Xt)}if(ee===M){_t=null;break e}var xt=ee.sibling;if(xt!==null){xt.return=ee.return,_t=xt;break e}_t=ee.return}}if(On=x,Na(),Pn&&typeof Pn.onPostCommitFiberRoot=="function")try{Pn.onPostCommitFiberRoot(Zt,a)}catch{}b=!0}return b}finally{Yt=h,ei.transition=u}}return!1}function vk(a,u,h){u=hl(h,u),u=Fy(a,u,1),a=Da(a,u,1),u=ws(),a!==null&&(Ir(a,1,u),Ns(a,u))}function Tr(a,u,h){if(a.tag===3)vk(a,a,h);else for(;u!==null;){if(u.tag===3){vk(u,a,h);break}else if(u.tag===1){var b=u.stateNode;if(typeof u.type.getDerivedStateFromError=="function"||typeof b.componentDidCatch=="function"&&(Aa===null||!Aa.has(b))){a=hl(h,a),a=_y(u,a,1),u=Da(u,a,1),a=ws(),u!==null&&(Ir(u,1,a),Ns(u,a));break}}u=u.return}}function MM(a,u,h){var b=a.pingCache;b!==null&&b.delete(u),u=ws(),a.pingedLanes|=a.suspendedLanes&h,Zr===a&&(os&h)===h&&(Vr===4||Vr===3&&(os&130023424)===os&&500>Qt()-Hp?go(a,0):Up|=h),Ns(a,u)}function wk(a,u){u===0&&((a.mode&1)===0?u=1:(u=br,br<<=1,(br&130023424)===0&&(br=4194304)));var h=ws();a=sa(a,u),a!==null&&(Ir(a,u,h),Ns(a,h))}function IM(a){var u=a.memoizedState,h=0;u!==null&&(h=u.retryLane),wk(a,h)}function EM(a,u){var h=0;switch(a.tag){case 13:var b=a.stateNode,x=a.memoizedState;x!==null&&(h=x.retryLane);break;case 19:b=a.stateNode;break;default:throw Error(r(314))}b!==null&&b.delete(u),wk(a,h)}var yk;yk=function(a,u,h){if(a!==null)if(a.memoizedProps!==u.pendingProps||Ss.current)js=!0;else{if((a.lanes&h)===0&&(u.flags&128)===0)return js=!1,kM(a,u,h);js=(a.flags&131072)!==0}else js=!1,hr&&(u.flags&1048576)!==0&&Zw(u,Yu,u.index);switch(u.lanes=0,u.tag){case 2:var b=u.type;ud(a,u),a=u.pendingProps;var x=sl(u,hs.current);ul(u,h),x=wp(null,u,b,a,x,h);var C=yp();return u.flags|=1,typeof x=="object"&&x!==null&&typeof x.render=="function"&&x.$$typeof===void 0?(u.tag=1,u.memoizedState=null,u.updateQueue=null,Cs(b)?(C=!0,Vu(u)):C=!1,u.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,hp(u),x.updater=ld,u.stateNode=x,x._reactInternals=u,Tp(u,b,a,h),u=Rp(null,u,b,!0,C,h)):(u.tag=0,hr&&C&&np(u),vs(null,u,x,h),u=u.child),u;case 16:b=u.elementType;e:{switch(ud(a,u),a=u.pendingProps,x=b._init,b=x(b._payload),u.type=b,x=u.tag=FM(b),a=bi(b,a),x){case 0:u=Dp(null,u,b,a,h);break e;case 1:u=Vy(null,u,b,a,h);break e;case 11:u=Uy(null,u,b,a,h);break e;case 14:u=Hy(null,u,b,bi(b.type,a),h);break e}throw Error(r(306,b,""))}return u;case 0:return b=u.type,x=u.pendingProps,x=u.elementType===b?x:bi(b,x),Dp(a,u,b,x,h);case 1:return b=u.type,x=u.pendingProps,x=u.elementType===b?x:bi(b,x),Vy(a,u,b,x,h);case 3:e:{if(Gy(u),a===null)throw Error(r(387));b=u.pendingProps,C=u.memoizedState,x=C.element,ly(a,u),td(u,b,null,h);var M=u.memoizedState;if(b=M.element,C.isDehydrated)if(C={element:b,isDehydrated:!1,cache:M.cache,pendingSuspenseBoundaries:M.pendingSuspenseBoundaries,transitions:M.transitions},u.updateQueue.baseState=C,u.memoizedState=C,u.flags&256){x=hl(Error(r(423)),u),u=Ky(a,u,b,h,x);break e}else if(b!==x){x=hl(Error(r(424)),u),u=Ky(a,u,b,h,x);break e}else for(Us=Ca(u.stateNode.containerInfo.firstChild),Ws=u,hr=!0,gi=null,h=ay(u,null,b,h),u.child=h;h;)h.flags=h.flags&-3|4096,h=h.sibling;else{if(ol(),b===x){u=aa(a,u,h);break e}vs(a,u,b,h)}u=u.child}return u;case 5:return dy(u),a===null&&ip(u),b=u.type,x=u.pendingProps,C=a!==null?a.memoizedProps:null,M=x.children,Xm(b,x)?M=null:C!==null&&Xm(b,C)&&(u.flags|=32),$y(a,u),vs(a,u,M,h),u.child;case 6:return a===null&&ip(u),null;case 13:return Yy(a,u,h);case 4:return mp(u,u.stateNode.containerInfo),b=u.pendingProps,a===null?u.child=ll(u,null,b,h):vs(a,u,b,h),u.child;case 11:return b=u.type,x=u.pendingProps,x=u.elementType===b?x:bi(b,x),Uy(a,u,b,x,h);case 7:return vs(a,u,u.pendingProps,h),u.child;case 8:return vs(a,u,u.pendingProps.children,h),u.child;case 12:return vs(a,u,u.pendingProps.children,h),u.child;case 10:e:{if(b=u.type._context,x=u.pendingProps,C=u.memoizedProps,M=x.value,er(Ju,b._currentValue),b._currentValue=M,C!==null)if(fi(C.value,M)){if(C.children===x.children&&!Ss.current){u=aa(a,u,h);break e}}else for(C=u.child,C!==null&&(C.return=u);C!==null;){var ee=C.dependencies;if(ee!==null){M=C.child;for(var le=ee.firstContext;le!==null;){if(le.context===b){if(C.tag===1){le=ia(-1,h&-h),le.tag=2;var Me=C.updateQueue;if(Me!==null){Me=Me.shared;var et=Me.pending;et===null?le.next=le:(le.next=et.next,et.next=le),Me.pending=le}}C.lanes|=h,le=C.alternate,le!==null&&(le.lanes|=h),up(C.return,h,u),ee.lanes|=h;break}le=le.next}}else if(C.tag===10)M=C.type===u.type?null:C.child;else if(C.tag===18){if(M=C.return,M===null)throw Error(r(341));M.lanes|=h,ee=M.alternate,ee!==null&&(ee.lanes|=h),up(M,h,u),M=C.sibling}else M=C.child;if(M!==null)M.return=C;else for(M=C;M!==null;){if(M===u){M=null;break}if(C=M.sibling,C!==null){C.return=M.return,M=C;break}M=M.return}C=M}vs(a,u,x.children,h),u=u.child}return u;case 9:return x=u.type,b=u.pendingProps.children,ul(u,h),x=Js(x),b=b(x),u.flags|=1,vs(a,u,b,h),u.child;case 14:return b=u.type,x=bi(b,u.pendingProps),x=bi(b.type,x),Hy(a,u,b,x,h);case 15:return zy(a,u,u.type,u.pendingProps,h);case 17:return b=u.type,x=u.pendingProps,x=u.elementType===b?x:bi(b,x),ud(a,u),u.tag=1,Cs(b)?(a=!0,Vu(u)):a=!1,ul(u,h),Ey(u,b,x),Tp(u,b,x,h),Rp(null,u,b,!0,a,h);case 19:return Qy(a,u,h);case 22:return qy(a,u,h)}throw Error(r(156,u.tag))};function kk(a,u){return un(a,u)}function LM(a,u,h,b){this.tag=a,this.key=h,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=u,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=b,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ti(a,u,h,b){return new LM(a,u,h,b)}function Xp(a){return a=a.prototype,!(!a||!a.isReactComponent)}function FM(a){if(typeof a=="function")return Xp(a)?1:0;if(a!=null){if(a=a.$$typeof,a===E)return 11;if(a===K)return 14}return 2}function La(a,u){var h=a.alternate;return h===null?(h=ti(a.tag,u,a.key,a.mode),h.elementType=a.elementType,h.type=a.type,h.stateNode=a.stateNode,h.alternate=a,a.alternate=h):(h.pendingProps=u,h.type=a.type,h.flags=0,h.subtreeFlags=0,h.deletions=null),h.flags=a.flags&14680064,h.childLanes=a.childLanes,h.lanes=a.lanes,h.child=a.child,h.memoizedProps=a.memoizedProps,h.memoizedState=a.memoizedState,h.updateQueue=a.updateQueue,u=a.dependencies,h.dependencies=u===null?null:{lanes:u.lanes,firstContext:u.firstContext},h.sibling=a.sibling,h.index=a.index,h.ref=a.ref,h}function kd(a,u,h,b,x,C){var M=2;if(b=a,typeof a=="function")Xp(a)&&(M=1);else if(typeof a=="string")M=5;else e:switch(a){case A:return vo(h.children,x,C,u);case L:M=8,x|=8;break;case _:return a=ti(12,h,u,x|2),a.elementType=_,a.lanes=C,a;case se:return a=ti(13,h,u,x),a.elementType=se,a.lanes=C,a;case X:return a=ti(19,h,u,x),a.elementType=X,a.lanes=C,a;case q:return xd(h,x,C,u);default:if(typeof a=="object"&&a!==null)switch(a.$$typeof){case F:M=10;break e;case te:M=9;break e;case E:M=11;break e;case K:M=14;break e;case G:M=16,b=null;break e}throw Error(r(130,a==null?a:typeof a,""))}return u=ti(M,h,u,x),u.elementType=a,u.type=b,u.lanes=C,u}function vo(a,u,h,b){return a=ti(7,a,b,u),a.lanes=h,a}function xd(a,u,h,b){return a=ti(22,a,b,u),a.elementType=q,a.lanes=h,a.stateNode={isHidden:!1},a}function Qp(a,u,h){return a=ti(6,a,null,u),a.lanes=h,a}function Jp(a,u,h){return u=ti(4,a.children!==null?a.children:[],a.key,u),u.lanes=h,u.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation},u}function _M(a,u,h,b,x){this.tag=u,this.containerInfo=a,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=cs(0),this.expirationTimes=cs(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=cs(0),this.identifierPrefix=b,this.onRecoverableError=x,this.mutableSourceEagerHydrationData=null}function Zp(a,u,h,b,x,C,M,ee,le){return a=new _M(a,u,h,ee,le),u===1?(u=1,C===!0&&(u|=8)):u=0,C=ti(3,null,null,u),a.current=C,C.stateNode=a,C.memoizedState={element:b,isDehydrated:h,cache:null,transitions:null,pendingSuspenseBoundaries:null},hp(C),a}function OM(a,u,h){var b=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:I,key:b==null?null:""+b,children:a,containerInfo:u,implementation:h}}function xk(a){if(!a)return Ta;a=a._reactInternals;e:{if(rt(a)!==a||a.tag!==1)throw Error(r(170));var u=a;do{switch(u.tag){case 3:u=u.stateNode.context;break e;case 1:if(Cs(u.type)){u=u.stateNode.__reactInternalMemoizedMergedChildContext;break e}}u=u.return}while(u!==null);throw Error(r(171))}if(a.tag===1){var h=a.type;if(Cs(h))return Xw(a,h,u)}return u}function Sk(a,u,h,b,x,C,M,ee,le){return a=Zp(h,b,!0,a,x,C,M,ee,le),a.context=xk(null),h=a.current,b=ws(),x=Ia(h),C=ia(b,x),C.callback=u??null,Da(h,C,x),a.current.lanes=x,Ir(a,x,b),Ns(a,b),a}function Sd(a,u,h,b){var x=u.current,C=ws(),M=Ia(x);return h=xk(h),u.context===null?u.context=h:u.pendingContext=h,u=ia(C,M),u.payload={element:a},b=b===void 0?null:b,b!==null&&(u.callback=b),a=Da(x,u,M),a!==null&&(yi(a,x,M,C),ed(a,x,M)),M}function Cd(a){if(a=a.current,!a.child)return null;switch(a.child.tag){case 5:return a.child.stateNode;default:return a.child.stateNode}}function Ck(a,u){if(a=a.memoizedState,a!==null&&a.dehydrated!==null){var h=a.retryLane;a.retryLane=h!==0&&h<u?h:u}}function ef(a,u){Ck(a,u),(a=a.alternate)&&Ck(a,u)}function BM(){return null}var jk=typeof reportError=="function"?reportError:function(a){console.error(a)};function tf(a){this._internalRoot=a}jd.prototype.render=tf.prototype.render=function(a){var u=this._internalRoot;if(u===null)throw Error(r(409));Sd(a,u,null,null)},jd.prototype.unmount=tf.prototype.unmount=function(){var a=this._internalRoot;if(a!==null){this._internalRoot=null;var u=a.containerInfo;fo(function(){Sd(null,a,null,null)}),u[ea]=null}};function jd(a){this._internalRoot=a}jd.prototype.unstable_scheduleHydration=function(a){if(a){var u=ue();a={blockedOn:null,target:a,priority:u};for(var h=0;h<zr.length&&u!==0&&u<zr[h].priority;h++);zr.splice(h,0,a),h===0&&xe(a)}};function nf(a){return!(!a||a.nodeType!==1&&a.nodeType!==9&&a.nodeType!==11)}function Td(a){return!(!a||a.nodeType!==1&&a.nodeType!==9&&a.nodeType!==11&&(a.nodeType!==8||a.nodeValue!==" react-mount-point-unstable "))}function Tk(){}function WM(a,u,h,b,x){if(x){if(typeof b=="function"){var C=b;b=function(){var Me=Cd(M);C.call(Me)}}var M=Sk(u,b,a,0,null,!1,!1,"",Tk);return a._reactRootContainer=M,a[ea]=M.current,tc(a.nodeType===8?a.parentNode:a),fo(),M}for(;x=a.lastChild;)a.removeChild(x);if(typeof b=="function"){var ee=b;b=function(){var Me=Cd(le);ee.call(Me)}}var le=Zp(a,0,!1,null,null,!1,!1,"",Tk);return a._reactRootContainer=le,a[ea]=le.current,tc(a.nodeType===8?a.parentNode:a),fo(function(){Sd(u,le,h,b)}),le}function Nd(a,u,h,b,x){var C=h._reactRootContainer;if(C){var M=C;if(typeof x=="function"){var ee=x;x=function(){var le=Cd(M);ee.call(le)}}Sd(u,M,a,x)}else M=WM(h,u,a,x,b);return Cd(M)}yn=function(a){switch(a.tag){case 3:var u=a.stateNode;if(u.current.memoizedState.isDehydrated){var h=zn(u.pendingLanes);h!==0&&(wr(u,h|1),Ns(u,Qt()),(On&6)===0&&(fl=Qt()+500,Na()))}break;case 13:fo(function(){var b=sa(a,1);if(b!==null){var x=ws();yi(b,a,1,x)}}),ef(a,1)}},Tn=function(a){if(a.tag===13){var u=sa(a,134217728);if(u!==null){var h=ws();yi(u,a,134217728,h)}ef(a,134217728)}},or=function(a){if(a.tag===13){var u=Ia(a),h=sa(a,u);if(h!==null){var b=ws();yi(h,a,u,b)}ef(a,u)}},ue=function(){return Yt},Ve=function(a,u){var h=Yt;try{return Yt=a,u()}finally{Yt=h}},ie=function(a,u,h){switch(u){case"input":if(vt(a,h),u=h.name,h.type==="radio"&&u!=null){for(h=a;h.parentNode;)h=h.parentNode;for(h=h.querySelectorAll("input[name="+JSON.stringify(""+u)+'][type="radio"]'),u=0;u<h.length;u++){var b=h[u];if(b!==a&&b.form===a.form){var x=qu(b);if(!x)throw Error(r(90));Ue(b),vt(b,x)}}}break;case"textarea":$e(a,h);break;case"select":u=h.value,u!=null&&qe(a,!!h.multiple,u,!1)}},Nn=Gp,Sn=fo;var UM={usingClientEntryPoint:!1,Events:[sc,nl,qu,xn,dn,Gp]},vc={findFiberByHostInstance:ao,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},HM={bundleType:vc.bundleType,version:vc.version,rendererPackageName:vc.rendererPackageName,rendererConfig:vc.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:H.ReactCurrentDispatcher,findHostInstanceByFiber:function(a){return a=Wt(a),a===null?null:a.stateNode},findFiberByHostInstance:vc.findFiberByHostInstance||BM,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Pd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Pd.isDisabled&&Pd.supportsFiber)try{Zt=Pd.inject(HM),Pn=Pd}catch{}}return Ps.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=UM,Ps.createPortal=function(a,u){var h=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!nf(u))throw Error(r(200));return OM(a,u,null,h)},Ps.createRoot=function(a,u){if(!nf(a))throw Error(r(299));var h=!1,b="",x=jk;return u!=null&&(u.unstable_strictMode===!0&&(h=!0),u.identifierPrefix!==void 0&&(b=u.identifierPrefix),u.onRecoverableError!==void 0&&(x=u.onRecoverableError)),u=Zp(a,1,!1,null,null,h,!1,b,x),a[ea]=u.current,tc(a.nodeType===8?a.parentNode:a),new tf(u)},Ps.findDOMNode=function(a){if(a==null)return null;if(a.nodeType===1)return a;var u=a._reactInternals;if(u===void 0)throw typeof a.render=="function"?Error(r(188)):(a=Object.keys(a).join(","),Error(r(268,a)));return a=Wt(u),a=a===null?null:a.stateNode,a},Ps.flushSync=function(a){return fo(a)},Ps.hydrate=function(a,u,h){if(!Td(u))throw Error(r(200));return Nd(null,a,u,!0,h)},Ps.hydrateRoot=function(a,u,h){if(!nf(a))throw Error(r(405));var b=h!=null&&h.hydratedSources||null,x=!1,C="",M=jk;if(h!=null&&(h.unstable_strictMode===!0&&(x=!0),h.identifierPrefix!==void 0&&(C=h.identifierPrefix),h.onRecoverableError!==void 0&&(M=h.onRecoverableError)),u=Sk(u,null,a,1,h??null,x,!1,C,M),a[ea]=u.current,tc(a),b)for(a=0;a<b.length;a++)h=b[a],x=h._getVersion,x=x(h._source),u.mutableSourceEagerHydrationData==null?u.mutableSourceEagerHydrationData=[h,x]:u.mutableSourceEagerHydrationData.push(h,x);return new jd(u)},Ps.render=function(a,u,h){if(!Td(u))throw Error(r(200));return Nd(null,a,u,!1,h)},Ps.unmountComponentAtNode=function(a){if(!Td(a))throw Error(r(40));return a._reactRootContainer?(fo(function(){Nd(null,null,a,!1,function(){a._reactRootContainer=null,a[ea]=null})}),!0):!1},Ps.unstable_batchedUpdates=Gp,Ps.unstable_renderSubtreeIntoContainer=function(a,u,h,b){if(!Td(h))throw Error(r(200));if(a==null||a._reactInternals===void 0)throw Error(r(38));return Nd(a,u,h,!1,b)},Ps.version="18.3.1-next-f1338f8080-20240426",Ps}var Ek;function AT(){if(Ek)return af.exports;Ek=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),af.exports=QM(),af.exports}var Lk;function JM(){if(Lk)return Dd;Lk=1;var e=AT();return Dd.createRoot=e.createRoot,Dd.hydrateRoot=e.hydrateRoot,Dd}var ZM=JM();const eI=yu(ZM);var p=Bb();const tI=yu(p),nI=RT({__proto__:null,default:tI},[p]),Wb="default-host";function MT(e,t){return t?e.hosts.find(r=>r.id===t)??null:null}function Ja(e){return MT(e,e.activeHostId)??e.hosts[0]??null}function Ub(e){var t;return((t=Ja(e))==null?void 0:t.baseUrl)??null}function rI(e){return e==="http:"||e==="https:"}function Pi(e){const t=e.trim();if(!t)throw new Error("EMPTY_SERVER_URL");const r=/^[a-zA-Z][a-zA-Z\d+.-]*:\/\//.test(t)?t:`http://${t}`,s=new URL(r);if(!rI(s.protocol))throw new Error("INVALID_SERVER_PROTOCOL");s.hash="",s.search="";const i=s.pathname.replace(/\/+$/,"");return`${s.origin}${i==="/"?"":i}`}const Ci="codingns.auth.remembered-login";function ku(){return typeof window<"u"&&typeof window.localStorage<"u"}function sI(e){return e.isNativeMobile?!0:e.isDesktop?e.ui.osFamily==="windows"||e.ui.osFamily==="macos":!1}function IT(e){const t={credentials:null,legacyServerBaseUrl:null};if(!ku())return t;const r=window.localStorage.getItem(Ci);if(!r)return t;try{const s=JSON.parse(r);if(Hb(s))return{credentials:e?s[e]??null:null,legacyServerBaseUrl:null};const i=_T(s);if(!i||!e)return{credentials:null,legacyServerBaseUrl:(i==null?void 0:i.serverBaseUrl)??null};const l={hostId:e,username:i.username,password:i.password,savedAt:Date.now()},c={[e]:l};return window.localStorage.setItem(Ci,JSON.stringify(c)),{credentials:l,legacyServerBaseUrl:i.serverBaseUrl}}catch{return window.localStorage.removeItem(Ci),t}}function iI(e){return IT(e).credentials}function ET(e){if(!ku())return;const t=FT(),r={hostId:e.hostId,username:e.username.trim(),password:e.password,savedAt:Date.now()};!r.hostId||!r.username||!r.password||window.localStorage.setItem(Ci,JSON.stringify({...t,[r.hostId]:r}))}function aI(e){if(!ku())return;const t=window.localStorage.getItem(Ci);if(t)try{const r=JSON.parse(t);if(Hb(r))return;const s=_T(r);if(!s){window.localStorage.removeItem(Ci);return}window.localStorage.setItem(Ci,JSON.stringify({...s,serverBaseUrl:Pi(e)}))}catch{window.localStorage.removeItem(Ci)}}function LT(e){if(!ku()||!e)return;const t=FT();if(!t[e])return;const r={...t};if(delete r[e],Object.keys(r).length===0){window.localStorage.removeItem(Ci);return}window.localStorage.setItem(Ci,JSON.stringify(r))}function FT(){if(!ku())return{};const e=window.localStorage.getItem(Ci);if(!e)return{};try{const t=JSON.parse(e);return Hb(t)?t:{}}catch{return{}}}function Hb(e){return typeof e!="object"||e===null||Array.isArray(e)?!1:Object.values(e).every(t=>oI(t))}function oI(e){if(typeof e!="object"||e===null)return!1;const t=e;return typeof t.hostId=="string"&&typeof t.username=="string"&&typeof t.password=="string"&&typeof t.savedAt=="number"&&t.username.trim().length>0&&t.password.length>0}function _T(e){if(typeof e!="object"||e===null)return null;const t=e;if(typeof t.username!="string"||typeof t.password!="string"||typeof t.serverBaseUrl!="string")return null;const r=t.username.trim(),s=t.password,i=Pi(t.serverBaseUrl);return!r||!s?null:{username:r,password:s,serverBaseUrl:i}}function OT(e={}){return{x:e.x??null,y:e.y??null,width:e.width??1200,height:e.height??780,minWidth:e.minWidth??720,minHeight:e.minHeight??480}}function lI(e){return{windowId:e.windowId,kind:e.kind,workspaceId:e.workspaceId??null,sessionId:e.sessionId??null,mode:e.mode??"docked",bounds:OT(e.bounds),focusOwner:e.focusOwner??null}}function Dl(e){return{...e,bounds:{...e.bounds}}}function cI(e){return{descriptors:Object.fromEntries(Object.entries(e.descriptors).map(([r,s])=>[r,Dl(s)])),openWindowIds:[...e.openWindowIds],lastActiveWindowId:e.lastActiveWindowId}}function Fk(){return{descriptors:{},openWindowIds:[],lastActiveWindowId:null}}function uI(e,t){return{...e,...t,windowId:e.windowId,bounds:OT({...e.bounds,...t.bounds})}}class dI{constructor(){Ze(this,"state",Fk());Ze(this,"listeners",new Set);Ze(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));Ze(this,"getState",()=>cI(this.state))}registerDescriptor(t){const r=Dl(t),s=this.state.openWindowIds.includes(r.windowId);return this.state={...this.state,descriptors:{...this.state.descriptors,[r.windowId]:r},lastActiveWindowId:s?r.windowId:this.state.lastActiveWindowId},this.emit(),Dl(r)}updateDescriptor(t,r){const s=this.state.descriptors[t];if(!s)return null;const i=uI(s,r);return this.state={...this.state,descriptors:{...this.state.descriptors,[t]:i}},this.emit(),Dl(i)}getDescriptor(t){const r=this.state.descriptors[t];return r?Dl(r):null}getWindows(){return Object.values(this.state.descriptors).map(t=>({descriptor:Dl(t),isOpen:this.state.openWindowIds.includes(t.windowId)}))}markWindowOpen(t){if(!this.state.descriptors[t])return!1;const r=this.state.openWindowIds.filter(s=>s!==t);return this.state={...this.state,openWindowIds:[...r,t],lastActiveWindowId:t},this.emit(),!0}markWindowClosed(t){if(!this.state.openWindowIds.includes(t))return!1;const r=this.state.openWindowIds.filter(s=>s!==t);return this.state={...this.state,openWindowIds:r,lastActiveWindowId:this.state.lastActiveWindowId===t?r.at(-1)??null:this.state.lastActiveWindowId},this.emit(),!0}isWindowOpen(t){return this.state.openWindowIds.includes(t)}removeWindow(t){if(!this.state.descriptors[t])return!1;const r={...this.state.descriptors};delete r[t];const s=this.state.openWindowIds.filter(i=>i!==t);return this.state={descriptors:r,openWindowIds:s,lastActiveWindowId:this.state.lastActiveWindowId===t?s.at(-1)??null:this.state.lastActiveWindowId},this.emit(),!0}clear(){const t=this.state.openWindowIds.length>0||this.state.lastActiveWindowId!==null||Object.keys(this.state.descriptors).length>0;this.state=Fk(),t&&this.emit()}emit(){for(const t of this.listeners)t()}}function hI(){return new dI}const mI=hI();function pI(){return mI}const fI=pI();function BT(){return typeof window<"u"&&typeof window.__TAURI_INTERNALS__<"u"}function WT(){var l,c;if(typeof navigator>"u")return"unknown";const e=navigator.userAgent.toLowerCase(),t=navigator.userAgentData,r=((l=t==null?void 0:t.platform)==null?void 0:l.toLowerCase())??((c=navigator.platform)==null?void 0:c.toLowerCase())??"",s=`${r} ${e}`,i=r.includes("mac")&&navigator.maxTouchPoints>1;return s.includes("android")?"android":s.includes("iphone")||s.includes("ipad")||s.includes("ipod")||i?"ios":s.includes("mac")?"macos":s.includes("win")?"windows":s.includes("linux")?"linux":"unknown"}function gI(e){var t;return typeof e=="number"&&Number.isFinite(e)&&e>0?e:typeof window<"u"&&Number.isFinite(window.innerWidth)&&window.innerWidth>0?window.innerWidth:typeof document<"u"&&Number.isFinite((t=document.documentElement)==null?void 0:t.clientWidth)&&document.documentElement.clientWidth>0?document.documentElement.clientWidth:1280}function bI(e){const t=gI(e);return t<768?"compact":t<1024?"medium":"expanded"}function vI(e){const t=WT();return e==="desktop"?{osFamily:t,windowControlsStyle:t==="macos"?"traffic-lights":t==="windows"?"windows":"none",prefersDesktopChrome:!0,prefersOverlayTitlebar:t==="macos",prefersSystemFontStack:!0}:{osFamily:t,windowControlsStyle:"none",prefersDesktopChrome:!1,prefersOverlayTitlebar:!1,prefersSystemFontStack:!0}}function Cn(e){return{ok:!1,errorCode:"PLATFORM_NOT_SUPPORTED",detail:e}}async function _r(e,t){return zc(e,t)}async function zc(e,t){if(!BT())return Cn("当前运行环境不支持桌面壳能力。");try{return{ok:!0,value:await window.__TAURI_INTERNALS__.invoke(e,t)}}catch(r){return{ok:!1,errorCode:"SHELL_BRIDGE_ERROR",detail:r instanceof Error?r.message:"桌面壳调用失败。"}}}function wI(e){switch(e){case"selection":return 10;case"action":return[12];case"gesture":return[10,18,10];case"success":return[16,30,20];case"warning":return[20,36,18];case"error":return[24,40,24,40,20];default:return 10}}function UT(){return typeof navigator<"u"&&typeof navigator.vibrate=="function"}async function HT(e){if(UT())try{navigator.vibrate(wI(e))}catch{return}}async function zb(e,t){if(typeof window>"u"||typeof Notification>"u")return Cn("当前环境不支持系统通知。");try{if(Notification.permission==="default"&&await Notification.requestPermission()!=="granted"||Notification.permission!=="granted")return Cn("系统通知权限未授予。");const r=new Notification(e,{body:t});return r.onerror=()=>{},{ok:!0}}catch(r){return{ok:!1,errorCode:"NOTIFICATION_FAILED",detail:r instanceof Error?r.message:"系统通知发送失败。"}}}class yI{constructor(){Ze(this,"supported",!1)}openExternal(t){return typeof window>"u"?Promise.resolve(Cn("当前环境无法打开外部链接。")):(window.open(t,"_blank","noopener,noreferrer"),Promise.resolve({ok:!0}))}showNotification(t,r){return zb(t,r)}writeClipboardText(){return Promise.resolve(Cn("当前不是桌面端运行环境。"))}setWindowState(){return Promise.resolve(Cn("当前不是桌面端运行环境。"))}readDesktopConfig(){return Promise.resolve(Cn("当前不是桌面端运行环境。"))}writeDesktopConfig(){return Promise.resolve(Cn("当前不是桌面端运行环境。"))}getRuntimeInfo(){return Promise.resolve(Cn("当前不是桌面端运行环境。"))}checkForUpdate(){return Promise.resolve(Cn("当前不是桌面端运行环境。"))}installUpdate(){return Promise.resolve({ok:!1,errorCode:"PLATFORM_NOT_SUPPORTED",detail:"当前不是桌面端运行环境。"})}getAndroidRuntimeInfo(){return Promise.resolve(Cn("当前不是 Android 原生运行环境。"))}installAndroidUpdate(){return Promise.resolve({ok:!1,status:"failed",detail:"当前不是 Android 原生运行环境。"})}rollbackToPreviousVersion(){return Promise.resolve(Cn("当前不是桌面端运行环境。"))}pickDirectory(){return Promise.resolve(Cn("当前不是桌面端运行环境。"))}createWindow(){return Promise.resolve(Cn("当前不是桌面端运行环境。"))}closeWindow(){return Promise.resolve(Cn("当前不是桌面端运行环境。"))}focusWindow(){return Promise.resolve(Cn("当前不是桌面端运行环境。"))}listWindows(){return Promise.resolve(Cn("当前不是桌面端运行环境。"))}isWindowOpen(){return Promise.resolve(Cn("当前不是桌面端运行环境。"))}getWindowDescriptor(){return Promise.resolve(Cn("当前不是桌面端运行环境。"))}syncWindowDescriptor(){return Promise.resolve(Cn("当前不是桌面端运行环境。"))}updateWindowBounds(){return Promise.resolve(Cn("当前不是桌面端运行环境。"))}}class kI{constructor(){Ze(this,"supported",UT())}trigger(t){return HT(t)}}class xI{constructor(){Ze(this,"supported",!0)}openExternal(t){return _r("open_external",{url:t})}async showNotification(t,r){const s=await zb(t,r);return s.ok?s:_r("show_notification",{title:t,body:r})}writeClipboardText(t){return _r("copy_text",{text:t})}setWindowState(t){return _r("set_window_state",{state:t})}readDesktopConfig(){return _r("read_desktop_config")}writeDesktopConfig(t){return _r("write_desktop_config",{patch:t})}getRuntimeInfo(){return _r("get_runtime_info")}checkForUpdate(t){return _r("check_for_update",{channel:t})}async installUpdate(t){const r=await _r("install_update",{channel:t});return r.ok?r.value??{ok:!0}:{ok:!1,errorCode:r.errorCode,detail:r.detail}}getAndroidRuntimeInfo(){return Promise.resolve(Cn("当前不是 Android 原生运行环境。"))}installAndroidUpdate(){return Promise.resolve({ok:!1,status:"failed",detail:"当前不是 Android 原生运行环境。"})}rollbackToPreviousVersion(){return _r("rollback_to_previous_version")}pickDirectory(){return _r("pick_directory")}createWindow(t){return _r("create_window",{descriptor:t})}closeWindow(t){return _r("close_window",{windowId:t})}focusWindow(t){return _r("focus_window",{windowId:t})}listWindows(){return _r("list_windows")}isWindowOpen(t){return _r("is_window_open",{windowId:t})}getWindowDescriptor(t){return typeof t=="string"?_r("get_window_descriptor",{windowId:t}):_r("get_window_descriptor")}syncWindowDescriptor(t){return _r("sync_window_descriptor",{descriptor:t})}updateWindowBounds(t,r){return _r("update_window_bounds",{windowId:t,bounds:r})}}class SI{constructor(){Ze(this,"supported",!0)}async trigger(t){(await zc("perform_haptic_feedback",{kind:t})).ok||await HT(t)}}class CI{constructor(t){Ze(this,"supported",!0);this.platform=t}openExternal(t){return typeof window>"u"?Promise.resolve(Cn("当前环境无法打开外部链接。")):(window.open(t,"_blank","noopener,noreferrer"),Promise.resolve({ok:!0}))}showNotification(t,r){return zb(t,r)}writeClipboardText(t){return zc("copy_text",{text:t})}setWindowState(){return Promise.resolve(Cn("当前平台不支持窗口控制。"))}readDesktopConfig(){return Promise.resolve(Cn("当前不是桌面端运行环境。"))}writeDesktopConfig(){return Promise.resolve(Cn("当前不是桌面端运行环境。"))}getRuntimeInfo(){return Promise.resolve(Cn("当前不是桌面端运行环境。"))}checkForUpdate(){return Promise.resolve(Cn("当前不是桌面端运行环境。"))}installUpdate(){return Promise.resolve({ok:!1,errorCode:"PLATFORM_NOT_SUPPORTED",detail:"当前不是桌面端运行环境。"})}getAndroidRuntimeInfo(){return this.platform!=="android"?Promise.resolve(Cn("当前不是 Android 原生运行环境。")):zc("get_android_runtime_info")}async installAndroidUpdate(t){if(this.platform!=="android")return{ok:!1,status:"failed",detail:"当前不是 Android 原生运行环境。"};const r=await zc("install_android_update",{manifest:t});return r.ok?r.value??{ok:!1,status:"failed",detail:"Android 更新结果为空。"}:{ok:!1,status:"failed",detail:r.detail}}rollbackToPreviousVersion(){return Promise.resolve(Cn("当前不是桌面端运行环境。"))}pickDirectory(){return Promise.resolve(Cn("当前不是桌面端运行环境。"))}createWindow(){return Promise.resolve(Cn("当前不是桌面端运行环境。"))}closeWindow(){return Promise.resolve(Cn("当前不是桌面端运行环境。"))}focusWindow(){return Promise.resolve(Cn("当前不是桌面端运行环境。"))}listWindows(){return Promise.resolve(Cn("当前不是桌面端运行环境。"))}isWindowOpen(){return Promise.resolve(Cn("当前不是桌面端运行环境。"))}getWindowDescriptor(){return Promise.resolve(Cn("当前不是桌面端运行环境。"))}syncWindowDescriptor(){return Promise.resolve(Cn("当前不是桌面端运行环境。"))}updateWindowBounds(){return Promise.resolve(Cn("当前不是桌面端运行环境。"))}}function zT(){if(!BT())return"web";const e=WT();return e==="ios"?"ios":e==="android"?"android":"desktop"}function Gs(e={}){const t=zT(),r=bI(e.viewportWidth),s=t==="ios"||t==="android";return{platform:t,isDesktop:t==="desktop",isWeb:t==="web",isMobile:r!=="expanded",isNativeMobile:s,viewportClass:r,ui:vI(t),bridge:t==="desktop"?new xI:s?new CI(t):new yI,windows:fI,haptics:s?new SI:new kI}}const Wg="codingns.client.runtime-config";function qb(e){return e==="desktop"||e==="ios"||e==="android"}function Ug(e){return e==="en"||e==="en-US"?"en-US":"zh-CN"}function jI(){return typeof navigator>"u"?"zh-CN":Ug(navigator.language)}function _k(e){return e==="acceptEdits"||e==="bypassPermissions"?e:"default"}function qT(){return typeof window<"u"&&typeof window.localStorage<"u"}function TI(){if(!qT())return null;const e=window.localStorage.getItem(Wg);if(!e)return null;try{return JSON.parse(e)}catch{return window.localStorage.removeItem(Wg),null}}function $T(e){qT()&&window.localStorage.setItem(Wg,JSON.stringify(e))}function NI(){var e;return typeof window>"u"||!((e=window.location)!=null&&e.origin)?null:window.location.origin}function PI(e){if(!e)return null;try{return Pi(e)}catch{return null}}function VT(e){if(e==="web"){const t=PI(NI());if(t)return t}return Pi("http://127.0.0.1:3002")}function GT(){return new Date().toISOString()}function Ha(e){return typeof e=="string"&&e.trim()?e.trim():null}function Ok(e,t){return Ha(e)??t}function KT(e){try{const t=new URL(e).hostname.toLowerCase();return t==="localhost"||t==="127.0.0.1"||t==="::1"||t==="[::1]"?"local":/^10\./.test(t)||/^192\.168\./.test(t)||/^172\.(1[6-9]|2\d|3[0-1])\./.test(t)?"lan":"remote"}catch{return"custom"}}function YT(e){try{const t=new URL(e),r=t.pathname==="/"?"":t.pathname.replace(/\/+$/,"");return`${t.host}${r}`}catch{return e}}function Lh(e,t,r={}){const s=Pi(e);return{id:Ha(r.id)??Wb,name:Ha(r.name)??YT(s),baseUrl:s,kind:r.kind??KT(s),createdAt:Ok(r.createdAt,t),updatedAt:Ok(r.updatedAt,t),lastConnectedAt:Ha(r.lastConnectedAt)??null,lastUserId:Ha(r.lastUserId)??null,lastUsername:Ha(r.lastUsername)??null}}function DI(e){return typeof e=="object"&&e!==null}function RI(e,t){if(!Array.isArray(e))return[];const r=new Set,s=[];for(let i=0;i<e.length;i+=1){const l=e[i];if(!DI(l))continue;const c=Ha(l.baseUrl);if(c)try{const d=i===0?Wb:`host-${i+1}`,m=Lh(c,t,{...l,id:Ha(l.id)??d});if(r.has(m.id))continue;r.add(m.id),s.push(m)}catch{continue}}return s}function AI(e){return typeof e=="object"&&e!==null}function MI(e,t,r){const s=Pi(t),i=Ja(e);return i?e.hosts.map(l=>l.id===i.id?Lh(s,r,{...l,name:YT(s),kind:KT(s),createdAt:l.createdAt,updatedAt:r}):l):[Lh(s,r)]}function $b(e){const t=GT();return{platform:e,activeHostId:Wb,hosts:[Lh(VT(e),t)],releaseChannel:"stable",autoReconnect:!0,autoCheckUpdate:e==="desktop",language:jI(),defaultPermissionMode:"default"}}function Fh(e,t){var m;if(!t||!AI(t))return e;const r=t.platform??e.platform,s=$b(r),i=GT();if(!qb(r))return{platform:r,activeHostId:s.activeHostId,hosts:s.hosts,releaseChannel:t.releaseChannel??e.releaseChannel,autoReconnect:t.autoReconnect??e.autoReconnect,autoCheckUpdate:t.autoCheckUpdate??e.autoCheckUpdate,language:Ug(t.language??e.language),defaultPermissionMode:_k(t.defaultPermissionMode??e.defaultPermissionMode)};let l=t.hosts!==void 0?RI(t.hosts,i):e.hosts;t.hostBaseUrl&&(l=MI(e,t.hostBaseUrl,i)),l.length===0&&(l=s.hosts);const c=t.activeHostId??e.activeHostId,d=l.some(f=>f.id===c)?c:((m=l[0])==null?void 0:m.id)??null;return{platform:r,activeHostId:d,hosts:l,releaseChannel:t.releaseChannel??e.releaseChannel,autoReconnect:t.autoReconnect??e.autoReconnect,autoCheckUpdate:t.autoCheckUpdate??e.autoCheckUpdate,language:Ug(t.language??e.language),defaultPermissionMode:_k(t.defaultPermissionMode??e.defaultPermissionMode)}}function XT(e,t){return Fh($b(t),e)}async function II(){const e=Gs(),t=$b(e.platform),r=TI();let s=null;if(e.isDesktop){const l=await e.bridge.readDesktopConfig();l.ok&&l.value&&(s=l.value)}const i=Fh(Fh(t,r),s);return $T(i),i}async function EI(e,t){var l;const r=Fh(e,t);$T(r);const s=(l=Ja(r))==null?void 0:l.baseUrl;s&&aI(s);const i=Gs();return i.isDesktop&&await i.bridge.writeDesktopConfig(r),r}function LI(){return XT(null,zT())}class FI{constructor(){Ze(this,"state",LI());Ze(this,"listeners",new Set);Ze(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));Ze(this,"getState",()=>this.state)}hydrate(t){this.state=XT(t,this.state.platform),this.emit()}async initialize(){const t=await II();return this.hydrate(t),t}async update(t){const r=await EI(this.state,t);return this.hydrate(r),r}emit(){for(const t of this.listeners)t()}}const Rn=new FI;function Ya(e){return p.useSyncExternalStore(Rn.subscribe,()=>e(Rn.getState()))}class Kr extends Error{constructor(r,s){super(s.detail);Ze(this,"status");Ze(this,"errorCode");Ze(this,"field");Ze(this,"data");this.name="ApiError",this.status=r,this.errorCode=s.error_code,this.field=s.field,this.data=s.data}}function _I(e){return e.endsWith("/")?e:`${e}/`}function OI(e){return e.replace(/^\/+/,"")}function Vb(){const e=Rn.getState();return Ub(e)??VT(e.platform)}function Gb(e,t=Vb()){return new URL(OI(e),_I(t)).toString()}function QT(e,t=Vb()){const r=new URL(Gb(e,t));return r.protocol=r.protocol==="https:"?"wss:":"ws:",r.toString()}class BI{async request(t,r={}){const s=await this.performRequest(t,r);if(s.status===204||s.status===205)return;const i=await s.text();if(i)return JSON.parse(i)}async requestBlob(t,r={}){return(await this.performRequest(t,r)).blob()}async performRequest(t,r){var d;const s=new Headers(r.headers),i=r.body!==void 0&&r.body!==null,l=Gb(t,r.baseUrl??Vb());if(i&&!s.has("Content-Type")&&s.set("Content-Type","application/json"),!r.skipAuth){const m=(d=nr.getState().session)==null?void 0:d.accessToken;if(!m)throw nr.clear(),new Kr(401,{detail:"当前没有可用的登录态",error_code:"UNAUTHORIZED"});s.set("Authorization",`Bearer ${m}`)}let c;try{c=await fetch(l,{...r,headers:s})}catch(m){const f=m instanceof Error?m.message:"未知网络错误";throw new Kr(0,{detail:`请求 ${l} 失败:${f}`,error_code:"NETWORK_ERROR"})}if(!c.ok){const m=await WI(c);if(JT(c.status,m.error_code)&&!r.skipAuth&&!r.retryAfterRefresh){const f=await nr.refresh();if(f.status==="refreshed")return this.performRequest(t,{...r,retryAfterRefresh:!0});throw f.status==="invalid"?new Kr(401,{detail:"登录态已经失效,请重新登录",error_code:"UNAUTHORIZED"}):new Kr(0,{detail:"登录态暂时无法恢复,请稍后重试",error_code:"AUTH_REFRESH_UNAVAILABLE"})}throw!r.skipAuth&&HI(c.status,m.error_code)&&(sessionStorage.setItem(Hg,String(Date.now())),nr.clear()),new Kr(c.status,m)}return c}}const Oe=new BI;async function WI(e){const t=await e.text();if(!t)return Bk(e.status);try{const r=JSON.parse(t);if(typeof r.detail=="string"&&typeof r.error_code=="string")return{detail:r.detail,error_code:r.error_code,field:typeof r.field=="string"?r.field:void 0,data:UI(r.data)?r.data:void 0,timestamp:typeof r.timestamp=="string"?r.timestamp:void 0}}catch{}return Bk(e.status,t)}function Bk(e,t){return{detail:(t==null?void 0:t.trim())||`请求失败(HTTP ${e})`,error_code:e===401?"UNAUTHORIZED":"HTTP_ERROR"}}function UI(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function JT(e,t){return e!==401?!1:t==="UNAUTHORIZED"||t==="TOKEN_EXPIRED"||t==="TOKEN_INVALID"}function HI(e,t){return e===403&&t==="BOOTSTRAP_REQUIRED"?!0:JT(e,t)}const Hg="codingns.auth_expired_at";function zI(){const e=sessionStorage.getItem(Hg);return e?(sessionStorage.removeItem(Hg),Date.now()-Number(e)<5e3):!1}function qI(e){return Oe.request("/api/public/bootstrap-status",{baseUrl:e,skipAuth:!0})}function $I(e,t){return Oe.request("/api/public/setup",{method:"POST",body:JSON.stringify(e),baseUrl:t,skipAuth:!0})}function Wk(e,t){return Oe.request("/api/auth/login",{method:"POST",body:JSON.stringify(e),baseUrl:t,skipAuth:!0})}function VI(e,t){return Oe.request("/api/auth/refresh",{method:"POST",body:JSON.stringify(e),baseUrl:t,skipAuth:!0})}const Rd="codingns.auth.session";class GI{constructor(){Ze(this,"state",{status:"anonymous",session:null});Ze(this,"listeners",new Set);Ze(this,"sessionMap",{});Ze(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));Ze(this,"getState",()=>this.state);this.syncCurrentHostSession(),Rn.subscribe(()=>{this.syncCurrentHostSession()})}async login(t,r){const s=this.getCurrentHost();if(!s){const l=await Wk(t,r);return this.updateState({status:"authenticated",session:l}),l}const i=await this.loginForHost(s,t,r);return this.updateState({status:"authenticated",session:i}),i}async loginForHost(t,r,s){var l;const i=await Wk(r,s??t.baseUrl);return this.persistSession(t,i),((l=this.getCurrentHost())==null?void 0:l.id)===t.id&&this.updateState({status:"authenticated",session:i}),i}async bootstrap(t,r,s){await $I({username:t,password:r},s)}hydrate(t){if(!t){this.clear();return}this.setSession(t)}async refresh(){const t=this.state.session,r=t==null?void 0:t.refreshToken,s=this.getCurrentHost();if(!r)return this.clear(),{status:"invalid",session:null};this.state={...this.state,status:"refreshing"},this.emit();try{const i=await VI({refreshToken:r},s==null?void 0:s.baseUrl);return this.setSession(i,s),{status:"refreshed",session:i}}catch(i){return ZI(i)?(this.clear(),{status:"invalid",session:null}):(this.state={status:t?"authenticated":"anonymous",session:t},this.emit(),{status:"deferred",session:t,error:i})}}clear(){const t=this.getCurrentHost();if(!t){this.sessionMap={},this.persistSessionMap(),this.updateState({status:"anonymous",session:null});return}if(this.sessionMap[t.id]){const r={...this.sessionMap};delete r[t.id],this.sessionMap=r,this.persistSessionMap()}this.updateState({status:"anonymous",session:null})}clearHostSession(t){var s;if(!t||!this.sessionMap[t])return;const r={...this.sessionMap};delete r[t],this.sessionMap=r,this.persistSessionMap(),((s=this.getCurrentHost())==null?void 0:s.id)===t&&this.updateState({status:"anonymous",session:null})}setSession(t,r=this.getCurrentHost()){r&&(this.persistSession(r,t),this.updateState({status:"authenticated",session:t}))}persistSession(t,r){this.sessionMap={...this.sessionMap,[t.id]:{hostId:t.id,session:r,savedAt:Date.now()}},this.persistSessionMap(),Rn.update({hosts:Rn.getState().hosts.map(s=>s.id===t.id?{...s,lastConnectedAt:new Date().toISOString(),lastUserId:r.user.userId,lastUsername:r.user.username,updatedAt:new Date().toISOString()}:s)}).catch(()=>{})}syncCurrentHostSession(){var l;const t=this.getCurrentHost(),{sessionMap:r,migrated:s}=this.readSessionMapFromStorage(t);this.sessionMap=r,s&&this.persistSessionMap();const i=t?((l=r[t.id])==null?void 0:l.session)??null:null;this.updateState({status:i?"authenticated":"anonymous",session:i})}getCurrentHost(){return Ja(Rn.getState())}readSessionMapFromStorage(t){if(typeof window>"u"||typeof window.localStorage>"u")return{sessionMap:{},migrated:!1};const r=window.localStorage.getItem(Rd);if(!r)return{sessionMap:{},migrated:!1};try{const s=JSON.parse(r);if(YI(s))return{sessionMap:s,migrated:!1};const i=QI(s,t);if(i)return{sessionMap:i,migrated:!0}}catch{}return window.localStorage.removeItem(Rd),{sessionMap:{},migrated:!1}}persistSessionMap(){if(!(typeof window>"u"||typeof window.localStorage>"u")){if(Object.keys(this.sessionMap).length===0){window.localStorage.removeItem(Rd);return}window.localStorage.setItem(Rd,JSON.stringify(this.sessionMap))}}updateState(t){this.state.status===t.status&&this.state.session===t.session||(this.state=t,this.emit())}emit(){for(const t of this.listeners)t()}}const nr=new GI;function xu(e){return p.useSyncExternalStore(nr.subscribe,()=>e(nr.getState()))}function KI(e){if(typeof e!="object"||e===null)return!1;const t=e;return typeof t.hostId=="string"&&typeof t.savedAt=="number"&&Kb(t.session)}function YI(e){return typeof e!="object"||e===null||Array.isArray(e)?!1:Object.values(e).every(t=>KI(t))}function XI(e){return typeof e!="object"||e===null?!1:"session"in e&&Kb(e.session)}function Kb(e){if(typeof e!="object"||e===null)return!1;const t=e;return typeof t.accessToken=="string"&&typeof t.refreshToken=="string"&&typeof t.expiresIn=="number"&&typeof t.user=="object"&&t.user!==null}function QI(e,t){const r=(t==null?void 0:t.id)??null;if(!r)return null;if(XI(e)){const s=JI(e.serverBaseUrl,t)??r;return{[s]:{hostId:s,session:e.session,savedAt:Date.now()}}}return Kb(e)?{[r]:{hostId:r,session:e,savedAt:Date.now()}}:null}function JI(e,t){if(!e)return(t==null?void 0:t.id)??null;const s=Rn.getState().hosts.find(i=>i.baseUrl===e);return(s==null?void 0:s.id)??(t==null?void 0:t.id)??null}function ZI(e){return e instanceof Kr?e.status===401?!0:e.status===403&&e.errorCode==="BOOTSTRAP_REQUIRED":!1}const ZT="/api/preferences/profile";async function eE(){return Oe.request(ZT)}async function eN(e){return Oe.request(ZT,{method:"PUT",body:JSON.stringify(e)})}const hm=["claude-code","codex","opencode","gemini","kimi"],tN="codingns.account.preferences.shadow",tE="codingns.client.runtime-config",nE="codingns-theme",rE="composer-selected-model:",sE="composer-reasoning-level:";function Su(){return typeof window<"u"&&typeof window.localStorage<"u"}function Yb(e){return e==="en-US"||e==="en"?"en-US":e==="zh-CN"?"zh-CN":null}function iE(){return typeof navigator>"u"?"zh-CN":Yb(navigator.language)??"zh-CN"}function nN(e){return e==="light"||e==="dark"||e==="sky-blue"||e==="eye-green"?e:null}function aE(){return typeof window>"u"||typeof window.matchMedia!="function"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function oE(e){return typeof e=="boolean"?e:null}function rN(e){return e==="acceptEdits"||e==="bypassPermissions"||e==="default"?e:null}function sN(e){return e==="low"||e==="medium"||e==="high"||e==="xhigh"?e:null}function iN(){return{"claude-code":{defaultModel:null,defaultReasoningLevel:null},codex:{defaultModel:null,defaultReasoningLevel:null},opencode:{defaultModel:null,defaultReasoningLevel:null},gemini:{defaultModel:null,defaultReasoningLevel:null},kimi:{defaultModel:null,defaultReasoningLevel:null}}}function aN(){return{initialized:!0,profile:{language:iE(),theme:aE(),autoTheme:!1,defaultPermissionMode:"default"},providers:iN(),updatedAt:null,source:"default"}}function lE(){const e=Rn.getState(),t={language:e.language,defaultPermissionMode:e.defaultPermissionMode};if(!Su())return t;const r=window.localStorage.getItem(tE);if(!r)return t;try{const s=JSON.parse(r);return{language:Yb(s.language)??t.language,defaultPermissionMode:rN(s.defaultPermissionMode)??t.defaultPermissionMode}}catch{return t}}function cE(){return Su()?nN(window.localStorage.getItem(nE)):null}function uE(){var t;if(!Su())return;const e={};for(const r of hm){const s=((t=window.localStorage.getItem(`${rE}${r}`))==null?void 0:t.trim())||null,i=sN(window.localStorage.getItem(`${sE}${r}`));s===null&&i===null||(e[r]={defaultModel:s,defaultReasoningLevel:i})}return Object.keys(e).length>0?e:void 0}function oN(){const e=lE(),t=cE(),r=uE(),s={};return e.language&&(s.language=e.language),t&&(s.theme=t),e.defaultPermissionMode&&(s.defaultPermissionMode=e.defaultPermissionMode),r&&(s.providers=r),lN(s)?s:null}function lN(e){return e?e.language!==void 0||e.theme!==void 0||e.autoTheme!==void 0||e.defaultPermissionMode!==void 0||e.providers!==void 0&&Object.keys(e.providers).length>0:!1}function _h(e){var s;const t=aN(),r=iN();for(const i of hm){const l=(s=e==null?void 0:e.providers)==null?void 0:s[i];r[i]={defaultModel:typeof(l==null?void 0:l.defaultModel)=="string"&&l.defaultModel.trim()||null,defaultReasoningLevel:sN(l==null?void 0:l.defaultReasoningLevel)??null}}return{language:Yb(e==null?void 0:e.language)??t.profile.language,theme:nN(e==null?void 0:e.theme)??t.profile.theme,autoTheme:oE(e==null?void 0:e.autoTheme)??t.profile.autoTheme,defaultPermissionMode:rN(e==null?void 0:e.defaultPermissionMode)??t.profile.defaultPermissionMode,providers:r,updatedAt:typeof(e==null?void 0:e.updatedAt)=="string"?e.updatedAt:null}}function dE(){var t,r,s,i;if(!Su())return null;const e=window.localStorage.getItem(tN);if(!e)return null;try{const l=JSON.parse(e),c=_h({language:(t=l.profile)==null?void 0:t.language,theme:(r=l.profile)==null?void 0:r.theme,autoTheme:(s=l.profile)==null?void 0:s.autoTheme,defaultPermissionMode:(i=l.profile)==null?void 0:i.defaultPermissionMode,providers:l.providers,updatedAt:l.updatedAt});return{profile:{language:c.language,theme:c.theme,autoTheme:c.autoTheme,defaultPermissionMode:c.defaultPermissionMode},providers:c.providers,updatedAt:c.updatedAt}}catch{return null}}function Oh(e){if(!Su())return;const t={profile:e.profile,providers:e.providers,updatedAt:e.updatedAt};window.localStorage.setItem(tN,JSON.stringify(t))}function bl(){const e=aN(),t=oN(),r=t?cN(e,t,"default"):e,s=dE();return s?{initialized:!0,profile:s.profile,providers:s.providers,updatedAt:s.updatedAt,source:"shadow"}:r}function zg(e,t){return{initialized:!0,profile:{language:e.language,theme:e.theme,autoTheme:e.autoTheme,defaultPermissionMode:e.defaultPermissionMode},providers:e.providers,updatedAt:e.updatedAt,source:t}}function cN(e,t,r){const s={...e.providers};if(t.providers)for(const i of hm){const l=t.providers[i];l&&(s[i]={defaultModel:l.defaultModel!==void 0?l.defaultModel??null:e.providers[i].defaultModel,defaultReasoningLevel:l.defaultReasoningLevel!==void 0?l.defaultReasoningLevel??null:e.providers[i].defaultReasoningLevel})}return{initialized:!0,profile:{language:t.language??e.profile.language,theme:t.theme??e.profile.theme,autoTheme:t.autoTheme??e.profile.autoTheme,defaultPermissionMode:t.defaultPermissionMode??e.profile.defaultPermissionMode},providers:s,updatedAt:e.updatedAt,source:r}}async function hE(){const e=_h(await eE());if(e.updatedAt===null){const r=oN();if(lN(r)){const s=_h(await eN(r)),i=zg(s,"remote");return Oh(i),i}}const t=zg(e,"remote");return Oh(t),t}class mE{constructor(){Ze(this,"state",bl());Ze(this,"listeners",new Set);Ze(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));Ze(this,"getState",()=>this.state);Rn.subscribe(()=>{nr.getState().session||this.state.source==="remote"||this.hydrate(bl())})}hydrate(t){this.state=t,this.emit()}resetToLocalFallback(){this.hydrate(bl())}async initialize(){if(!nr.getState().session){const t=bl();return this.hydrate(t),t}return this.refreshForAuthenticatedUser()}async refreshForAuthenticatedUser(){if(!nr.getState().session){const t=bl();return this.hydrate(t),t}try{const t=await hE();return this.hydrate(t),t}catch{const t=bl();return this.hydrate(t),t}}async updateProfile(t){const r=this.state,s=cN(r,t,r.source);if(this.hydrate(s),!nr.getState().session)return Oh(s),s;try{const i=_h(await eN(t)),l=zg(i,"remote");return Oh(l),this.hydrate(l),l}catch(i){throw this.hydrate(r),i}}async updateProviderPreference(t,r){return this.updateProfile({providers:{[t]:r}})}emit(){for(const t of this.listeners)t()}}const Ti=new mE;function qg(e){return p.useSyncExternalStore(Ti.subscribe,()=>e(Ti.getState()))}function cf(e){return hm.includes(e)}function pE(){return Ti.initialize()}function nu(e){return Ti.updateProfile(e)}function ma(e){return qg(t=>e({profile:{...t.profile,providers:t.providers,updatedAt:t.updatedAt},isFetching:!1,error:null}))}async function fE(){const e=Gs();return await Rn.initialize(),await pE(),{platform:e.platform}}var Vn=AT();const gE=yu(Vn),bE=RT({__proto__:null,default:gE},[Vn]);/**
|
|
42
|
-
* @remix-run/router v1.23.2
|
|
43
|
-
*
|
|
44
|
-
* Copyright (c) Remix Software Inc.
|
|
45
|
-
*
|
|
46
|
-
* This source code is licensed under the MIT license found in the
|
|
47
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
48
|
-
*
|
|
49
|
-
* @license MIT
|
|
50
|
-
*/function pr(){return pr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},pr.apply(this,arguments)}var Br;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(Br||(Br={}));const Uk="popstate";function vE(e){e===void 0&&(e={});function t(s,i){let{pathname:l,search:c,hash:d}=s.location;return ru("",{pathname:l,search:c,hash:d},i.state&&i.state.usr||null,i.state&&i.state.key||"default")}function r(s,i){return typeof i=="string"?i:Cu(i)}return yE(t,r,null,e)}function Mn(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Lo(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function wE(){return Math.random().toString(36).substr(2,8)}function Hk(e,t){return{usr:e.state,key:e.key,idx:t}}function ru(e,t,r,s){return r===void 0&&(r=null),pr({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Za(t):t,{state:r,key:t&&t.key||s||wE()})}function Cu(e){let{pathname:t="/",search:r="",hash:s=""}=e;return r&&r!=="?"&&(t+=r.charAt(0)==="?"?r:"?"+r),s&&s!=="#"&&(t+=s.charAt(0)==="#"?s:"#"+s),t}function Za(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substr(r),e=e.substr(0,r));let s=e.indexOf("?");s>=0&&(t.search=e.substr(s),e=e.substr(0,s)),e&&(t.pathname=e)}return t}function yE(e,t,r,s){s===void 0&&(s={});let{window:i=document.defaultView,v5Compat:l=!1}=s,c=i.history,d=Br.Pop,m=null,f=v();f==null&&(f=0,c.replaceState(pr({},c.state,{idx:f}),""));function v(){return(c.state||{idx:null}).idx}function g(){d=Br.Pop;let T=v(),j=T==null?null:T-f;f=T,m&&m({action:d,location:S.location,delta:j})}function w(T,j){d=Br.Push;let N=ru(S.location,T,j);f=v()+1;let D=Hk(N,f),H=S.createHref(N);try{c.pushState(D,"",H)}catch(B){if(B instanceof DOMException&&B.name==="DataCloneError")throw B;i.location.assign(H)}l&&m&&m({action:d,location:S.location,delta:1})}function k(T,j){d=Br.Replace;let N=ru(S.location,T,j);f=v();let D=Hk(N,f),H=S.createHref(N);c.replaceState(D,"",H),l&&m&&m({action:d,location:S.location,delta:0})}function y(T){let j=i.location.origin!=="null"?i.location.origin:i.location.href,N=typeof T=="string"?T:Cu(T);return N=N.replace(/ $/,"%20"),Mn(j,"No window.location.(origin|href) available to create URL for href: "+N),new URL(N,j)}let S={get action(){return d},get location(){return e(i,c)},listen(T){if(m)throw new Error("A history only accepts one active listener");return i.addEventListener(Uk,g),m=T,()=>{i.removeEventListener(Uk,g),m=null}},createHref(T){return t(i,T)},createURL:y,encodeLocation(T){let j=y(T);return{pathname:j.pathname,search:j.search,hash:j.hash}},push:w,replace:k,go(T){return c.go(T)}};return S}var $n;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})($n||($n={}));const kE=new Set(["lazy","caseSensitive","path","id","index","children"]);function xE(e){return e.index===!0}function Bh(e,t,r,s){return r===void 0&&(r=[]),s===void 0&&(s={}),e.map((i,l)=>{let c=[...r,String(l)],d=typeof i.id=="string"?i.id:c.join("-");if(Mn(i.index!==!0||!i.children,"Cannot specify children on an index route"),Mn(!s[d],'Found a route id collision on id "'+d+`". Route id's must be globally unique within Data Router usages`),xE(i)){let m=pr({},i,t(i),{id:d});return s[d]=m,m}else{let m=pr({},i,t(i),{id:d,children:void 0});return s[d]=m,i.children&&(m.children=Bh(i.children,t,c,s)),m}})}function jo(e,t,r){return r===void 0&&(r="/"),bh(e,t,r,!1)}function bh(e,t,r,s){let i=typeof t=="string"?Za(t):t,l=ju(i.pathname||"/",r);if(l==null)return null;let c=uN(e);CE(c);let d=null;for(let m=0;d==null&&m<c.length;++m){let f=LE(l);d=IE(c[m],f,s)}return d}function SE(e,t){let{route:r,pathname:s,params:i}=e;return{id:r.id,pathname:s,params:i,data:t[r.id],handle:r.handle}}function uN(e,t,r,s){t===void 0&&(t=[]),r===void 0&&(r=[]),s===void 0&&(s="");let i=(l,c,d)=>{let m={relativePath:d===void 0?l.path||"":d,caseSensitive:l.caseSensitive===!0,childrenIndex:c,route:l};m.relativePath.startsWith("/")&&(Mn(m.relativePath.startsWith(s),'Absolute route path "'+m.relativePath+'" nested under path '+('"'+s+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),m.relativePath=m.relativePath.slice(s.length));let f=Xa([s,m.relativePath]),v=r.concat(m);l.children&&l.children.length>0&&(Mn(l.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+f+'".')),uN(l.children,t,v,f)),!(l.path==null&&!l.index)&&t.push({path:f,score:AE(f,l.index),routesMeta:v})};return e.forEach((l,c)=>{var d;if(l.path===""||!((d=l.path)!=null&&d.includes("?")))i(l,c);else for(let m of dN(l.path))i(l,c,m)}),t}function dN(e){let t=e.split("/");if(t.length===0)return[];let[r,...s]=t,i=r.endsWith("?"),l=r.replace(/\?$/,"");if(s.length===0)return i?[l,""]:[l];let c=dN(s.join("/")),d=[];return d.push(...c.map(m=>m===""?l:[l,m].join("/"))),i&&d.push(...c),d.map(m=>e.startsWith("/")&&m===""?"/":m)}function CE(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:ME(t.routesMeta.map(s=>s.childrenIndex),r.routesMeta.map(s=>s.childrenIndex)))}const jE=/^:[\w-]+$/,TE=3,NE=2,PE=1,DE=10,RE=-2,zk=e=>e==="*";function AE(e,t){let r=e.split("/"),s=r.length;return r.some(zk)&&(s+=RE),t&&(s+=NE),r.filter(i=>!zk(i)).reduce((i,l)=>i+(jE.test(l)?TE:l===""?PE:DE),s)}function ME(e,t){return e.length===t.length&&e.slice(0,-1).every((s,i)=>s===t[i])?e[e.length-1]-t[t.length-1]:0}function IE(e,t,r){r===void 0&&(r=!1);let{routesMeta:s}=e,i={},l="/",c=[];for(let d=0;d<s.length;++d){let m=s[d],f=d===s.length-1,v=l==="/"?t:t.slice(l.length)||"/",g=Wr({path:m.relativePath,caseSensitive:m.caseSensitive,end:f},v),w=m.route;if(!g&&f&&r&&!s[s.length-1].route.index&&(g=Wr({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},v)),!g)return null;Object.assign(i,g.params),c.push({params:i,pathname:Xa([l,g.pathname]),pathnameBase:BE(Xa([l,g.pathnameBase])),route:w}),g.pathnameBase!=="/"&&(l=Xa([l,g.pathnameBase]))}return c}function Wr(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,s]=EE(e.path,e.caseSensitive,e.end),i=t.match(r);if(!i)return null;let l=i[0],c=l.replace(/(.)\/+$/,"$1"),d=i.slice(1);return{params:s.reduce((f,v,g)=>{let{paramName:w,isOptional:k}=v;if(w==="*"){let S=d[g]||"";c=l.slice(0,l.length-S.length).replace(/(.)\/+$/,"$1")}const y=d[g];return k&&!y?f[w]=void 0:f[w]=(y||"").replace(/%2F/g,"/"),f},{}),pathname:l,pathnameBase:c,pattern:e}}function EE(e,t,r){t===void 0&&(t=!1),r===void 0&&(r=!0),Lo(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let s=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(c,d,m)=>(s.push({paramName:d,isOptional:m!=null}),m?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(s.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),s]}function LE(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Lo(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function ju(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,s=e.charAt(r);return s&&s!=="/"?null:e.slice(r)||"/"}const FE=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,_E=e=>FE.test(e);function OE(e,t){t===void 0&&(t="/");let{pathname:r,search:s="",hash:i=""}=typeof e=="string"?Za(e):e,l;if(r)if(_E(r))l=r;else{if(r.includes("//")){let c=r;r=r.replace(/\/\/+/g,"/"),Lo(!1,"Pathnames cannot have embedded double slashes - normalizing "+(c+" -> "+r))}r.startsWith("/")?l=qk(r.substring(1),"/"):l=qk(r,t)}else l=t;return{pathname:l,search:WE(s),hash:UE(i)}}function qk(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(i=>{i===".."?r.length>1&&r.pop():i!=="."&&r.push(i)}),r.length>1?r.join("/"):"/"}function uf(e,t,r,s){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(s)+"]. Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function hN(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function Xb(e,t){let r=hN(e);return t?r.map((s,i)=>i===r.length-1?s.pathname:s.pathnameBase):r.map(s=>s.pathnameBase)}function Qb(e,t,r,s){s===void 0&&(s=!1);let i;typeof e=="string"?i=Za(e):(i=pr({},e),Mn(!i.pathname||!i.pathname.includes("?"),uf("?","pathname","search",i)),Mn(!i.pathname||!i.pathname.includes("#"),uf("#","pathname","hash",i)),Mn(!i.search||!i.search.includes("#"),uf("#","search","hash",i)));let l=e===""||i.pathname==="",c=l?"/":i.pathname,d;if(c==null)d=r;else{let g=t.length-1;if(!s&&c.startsWith("..")){let w=c.split("/");for(;w[0]==="..";)w.shift(),g-=1;i.pathname=w.join("/")}d=g>=0?t[g]:"/"}let m=OE(i,d),f=c&&c!=="/"&&c.endsWith("/"),v=(l||c===".")&&r.endsWith("/");return!m.pathname.endsWith("/")&&(f||v)&&(m.pathname+="/"),m}const Xa=e=>e.join("/").replace(/\/\/+/g,"/"),BE=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),WE=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,UE=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;class Wh{constructor(t,r,s,i){i===void 0&&(i=!1),this.status=t,this.statusText=r||"",this.internal=i,s instanceof Error?(this.data=s.toString(),this.error=s):this.data=s}}function su(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const mN=["post","put","patch","delete"],HE=new Set(mN),zE=["get",...mN],qE=new Set(zE),$E=new Set([301,302,303,307,308]),VE=new Set([307,308]),df={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},GE={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},yc={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},Jb=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,KE=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),pN="remix-router-transitions";function YE(e){const t=e.window?e.window:typeof window<"u"?window:void 0,r=typeof t<"u"&&typeof t.document<"u"&&typeof t.document.createElement<"u",s=!r;Mn(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let i;if(e.mapRouteProperties)i=e.mapRouteProperties;else if(e.detectErrorBoundary){let Z=e.detectErrorBoundary;i=ce=>({hasErrorBoundary:Z(ce)})}else i=KE;let l={},c=Bh(e.routes,i,void 0,l),d,m=e.basename||"/",f=e.dataStrategy||ZE,v=e.patchRoutesOnNavigation,g=pr({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1,v7_skipActionErrorRevalidation:!1},e.future),w=null,k=new Set,y=null,S=null,T=null,j=e.hydrationData!=null,N=jo(c,e.history.location,m),D=!1,H=null;if(N==null&&!v){let Z=Is(404,{pathname:e.history.location.pathname}),{matches:ce,route:ge}=tx(c);N=ce,H={[ge.id]:Z}}N&&!e.hydrationData&&Sn(N,c,e.history.location.pathname).active&&(N=null);let B;if(N)if(N.some(Z=>Z.route.lazy))B=!1;else if(!N.some(Z=>Z.route.loader))B=!0;else if(g.v7_partialHydration){let Z=e.hydrationData?e.hydrationData.loaderData:null,ce=e.hydrationData?e.hydrationData.errors:null;if(ce){let ge=N.findIndex(Ie=>ce[Ie.route.id]!==void 0);B=N.slice(0,ge+1).every(Ie=>!Vg(Ie.route,Z,ce))}else B=N.every(ge=>!Vg(ge.route,Z,ce))}else B=e.hydrationData!=null;else if(B=!1,N=[],g.v7_partialHydration){let Z=Sn(null,c,e.history.location.pathname);Z.active&&Z.matches&&(D=!0,N=Z.matches)}let I,A={historyAction:e.history.action,location:e.history.location,matches:N,initialized:B,navigation:df,restoreScrollPosition:e.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||H,fetchers:new Map,blockers:new Map},L=Br.Pop,_=!1,F,te=!1,E=new Map,se=null,X=!1,K=!1,G=[],q=new Set,U=new Map,Q=0,P=-1,W=new Map,J=new Set,R=new Map,ve=new Map,pe=new Set,Y=new Map,Se=new Map,Le;function re(){if(w=e.history.listen(Z=>{let{action:ce,location:ge,delta:Ie}=Z;if(Le){Le(),Le=void 0;return}Lo(Se.size===0||Ie!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let He=ie({currentLocation:A.location,nextLocation:ge,historyAction:ce});if(He&&Ie!=null){let Je=new Promise(ft=>{Le=ft});e.history.go(Ie*-1),pn(He,{state:"blocked",location:ge,proceed(){pn(He,{state:"proceeding",proceed:void 0,reset:void 0,location:ge}),Je.then(()=>e.history.go(Ie))},reset(){let ft=new Map(A.blockers);ft.set(He,yc),Ue({blockers:ft})}});return}return ut(ce,ge)}),r){m1(t,E);let Z=()=>p1(t,E);t.addEventListener("pagehide",Z),se=()=>t.removeEventListener("pagehide",Z)}return A.initialized||ut(Br.Pop,A.location,{initialHydration:!0}),I}function Ce(){w&&w(),se&&se(),k.clear(),F&&F.abort(),A.fetchers.forEach((Z,ce)=>Dt(ce)),A.blockers.forEach((Z,ce)=>Gt(ce))}function Xe(Z){return k.add(Z),()=>k.delete(Z)}function Ue(Z,ce){ce===void 0&&(ce={}),A=pr({},A,Z);let ge=[],Ie=[];g.v7_fetcherPersist&&A.fetchers.forEach((He,Je)=>{He.state==="idle"&&(pe.has(Je)?Ie.push(Je):ge.push(Je))}),pe.forEach(He=>{!A.fetchers.has(He)&&!U.has(He)&&Ie.push(He)}),[...k].forEach(He=>He(A,{deletedFetchers:Ie,viewTransitionOpts:ce.viewTransitionOpts,flushSync:ce.flushSync===!0})),g.v7_fetcherPersist?(ge.forEach(He=>A.fetchers.delete(He)),Ie.forEach(He=>Dt(He))):Ie.forEach(He=>pe.delete(He))}function ct(Z,ce,ge){var Ie,He;let{flushSync:Je}=ge===void 0?{}:ge,ft=A.actionData!=null&&A.navigation.formMethod!=null&&xi(A.navigation.formMethod)&&A.navigation.state==="loading"&&((Ie=Z.state)==null?void 0:Ie._isRedirect)!==!0,gt;ce.actionData?Object.keys(ce.actionData).length>0?gt=ce.actionData:gt=null:ft?gt=A.actionData:gt=null;let nt=ce.loaderData?Zk(A.loaderData,ce.loaderData,ce.matches||[],ce.errors):A.loaderData,yt=A.blockers;yt.size>0&&(yt=new Map(yt),yt.forEach((Ne,Lt)=>yt.set(Lt,yc)));let rt=_===!0||A.navigation.formMethod!=null&&xi(A.navigation.formMethod)&&((He=Z.state)==null?void 0:He._isRedirect)!==!0;d&&(c=d,d=void 0),X||L===Br.Pop||(L===Br.Push?e.history.push(Z,Z.state):L===Br.Replace&&e.history.replace(Z,Z.state));let oe;if(L===Br.Pop){let Ne=E.get(A.location.pathname);Ne&&Ne.has(Z.pathname)?oe={currentLocation:A.location,nextLocation:Z}:E.has(Z.pathname)&&(oe={currentLocation:Z,nextLocation:A.location})}else if(te){let Ne=E.get(A.location.pathname);Ne?Ne.add(Z.pathname):(Ne=new Set([Z.pathname]),E.set(A.location.pathname,Ne)),oe={currentLocation:A.location,nextLocation:Z}}Ue(pr({},ce,{actionData:gt,loaderData:nt,historyAction:L,location:Z,initialized:!0,navigation:df,revalidation:"idle",restoreScrollPosition:Nn(Z,ce.matches||A.matches),preventScrollReset:rt,blockers:yt}),{viewTransitionOpts:oe,flushSync:Je===!0}),L=Br.Pop,_=!1,te=!1,X=!1,K=!1,G=[]}async function Nt(Z,ce){if(typeof Z=="number"){e.history.go(Z);return}let ge=$g(A.location,A.matches,m,g.v7_prependBasename,Z,g.v7_relativeSplatPath,ce==null?void 0:ce.fromRouteId,ce==null?void 0:ce.relative),{path:Ie,submission:He,error:Je}=$k(g.v7_normalizeFormMethod,!1,ge,ce),ft=A.location,gt=ru(A.location,Ie,ce&&ce.state);gt=pr({},gt,e.history.encodeLocation(gt));let nt=ce&&ce.replace!=null?ce.replace:void 0,yt=Br.Push;nt===!0?yt=Br.Replace:nt===!1||He!=null&&xi(He.formMethod)&&He.formAction===A.location.pathname+A.location.search&&(yt=Br.Replace);let rt=ce&&"preventScrollReset"in ce?ce.preventScrollReset===!0:void 0,oe=(ce&&ce.flushSync)===!0,Ne=ie({currentLocation:ft,nextLocation:gt,historyAction:yt});if(Ne){pn(Ne,{state:"blocked",location:gt,proceed(){pn(Ne,{state:"proceeding",proceed:void 0,reset:void 0,location:gt}),Nt(Z,ce)},reset(){let Lt=new Map(A.blockers);Lt.set(Ne,yc),Ue({blockers:Lt})}});return}return await ut(yt,gt,{submission:He,pendingError:Je,preventScrollReset:rt,replace:ce&&ce.replace,enableViewTransition:ce&&ce.viewTransition,flushSync:oe})}function Ke(){if(Pe(),Ue({revalidation:"loading"}),A.navigation.state!=="submitting"){if(A.navigation.state==="idle"){ut(A.historyAction,A.location,{startUninterruptedRevalidation:!0});return}ut(L||A.historyAction,A.navigation.location,{overrideNavigation:A.navigation,enableViewTransition:te===!0})}}async function ut(Z,ce,ge){F&&F.abort(),F=null,L=Z,X=(ge&&ge.startUninterruptedRevalidation)===!0,dn(A.location,A.matches),_=(ge&&ge.preventScrollReset)===!0,te=(ge&&ge.enableViewTransition)===!0;let Ie=d||c,He=ge&&ge.overrideNavigation,Je=ge!=null&&ge.initialHydration&&A.matches&&A.matches.length>0&&!D?A.matches:jo(Ie,ce,m),ft=(ge&&ge.flushSync)===!0;if(Je&&A.initialized&&!K&&i1(A.location,ce)&&!(ge&&ge.submission&&xi(ge.submission.formMethod))){ct(ce,{matches:Je},{flushSync:ft});return}let gt=Sn(Je,Ie,ce.pathname);if(gt.active&>.matches&&(Je=gt.matches),!Je){let{error:Wt,notFoundMatches:Kt,route:un}=Be(ce.pathname);ct(ce,{matches:Kt,loaderData:{},errors:{[un.id]:Wt}},{flushSync:ft});return}F=new AbortController;let nt=vl(e.history,ce,F.signal,ge&&ge.submission),yt;if(ge&&ge.pendingError)yt=[To(Je).route.id,{type:$n.error,error:ge.pendingError}];else if(ge&&ge.submission&&xi(ge.submission.formMethod)){let Wt=await vt(nt,ce,ge.submission,Je,gt.active,{replace:ge.replace,flushSync:ft});if(Wt.shortCircuited)return;if(Wt.pendingActionResult){let[Kt,un]=Wt.pendingActionResult;if(qs(un)&&su(un.error)&&un.error.status===404){F=null,ct(ce,{matches:Wt.matches,loaderData:{},errors:{[Kt]:un.error}});return}}Je=Wt.matches||Je,yt=Wt.pendingActionResult,He=hf(ce,ge.submission),ft=!1,gt.active=!1,nt=vl(e.history,nt.url,nt.signal)}let{shortCircuited:rt,matches:oe,loaderData:Ne,errors:Lt}=await Te(nt,ce,Je,gt.active,He,ge&&ge.submission,ge&&ge.fetcherSubmission,ge&&ge.replace,ge&&ge.initialHydration===!0,ft,yt);rt||(F=null,ct(ce,pr({matches:oe||Je},ex(yt),{loaderData:Ne,errors:Lt})))}async function vt(Z,ce,ge,Ie,He,Je){Je===void 0&&(Je={}),Pe();let ft=d1(ce,ge);if(Ue({navigation:ft},{flushSync:Je.flushSync===!0}),He){let yt=await Et(Ie,ce.pathname,Z.signal);if(yt.type==="aborted")return{shortCircuited:!0};if(yt.type==="error"){let rt=To(yt.partialMatches).route.id;return{matches:yt.partialMatches,pendingActionResult:[rt,{type:$n.error,error:yt.error}]}}else if(yt.matches)Ie=yt.matches;else{let{notFoundMatches:rt,error:oe,route:Ne}=Be(ce.pathname);return{matches:rt,pendingActionResult:[Ne.id,{type:$n.error,error:oe}]}}}let gt,nt=Ec(Ie,ce);if(!nt.route.action&&!nt.route.lazy)gt={type:$n.error,error:Is(405,{method:Z.method,pathname:ce.pathname,routeId:nt.route.id})};else if(gt=(await wt("action",A,Z,[nt],Ie,null))[nt.route.id],Z.signal.aborted)return{shortCircuited:!0};if(Do(gt)){let yt;return Je&&Je.replace!=null?yt=Je.replace:yt=Xk(gt.response.headers.get("Location"),new URL(Z.url),m,e.history)===A.location.pathname+A.location.search,await $e(Z,gt,!0,{submission:ge,replace:yt}),{shortCircuited:!0}}if(qa(gt))throw Is(400,{type:"defer-action"});if(qs(gt)){let yt=To(Ie,nt.route.id);return(Je&&Je.replace)!==!0&&(L=Br.Push),{matches:Ie,pendingActionResult:[yt.route.id,gt]}}return{matches:Ie,pendingActionResult:[nt.route.id,gt]}}async function Te(Z,ce,ge,Ie,He,Je,ft,gt,nt,yt,rt){let oe=He||hf(ce,Je),Ne=Je||ft||rx(oe),Lt=!X&&(!g.v7_partialHydration||!nt);if(Ie){if(Lt){let Zt=_e(rt);Ue(pr({navigation:oe},Zt!==void 0?{actionData:Zt}:{}),{flushSync:yt})}let kt=await Et(ge,ce.pathname,Z.signal);if(kt.type==="aborted")return{shortCircuited:!0};if(kt.type==="error"){let Zt=To(kt.partialMatches).route.id;return{matches:kt.partialMatches,loaderData:{},errors:{[Zt]:kt.error}}}else if(kt.matches)ge=kt.matches;else{let{error:Zt,notFoundMatches:Pn,route:Sr}=Be(ce.pathname);return{matches:Pn,loaderData:{},errors:{[Sr.id]:Zt}}}}let Wt=d||c,[Kt,un]=Gk(e.history,A,ge,Ne,ce,g.v7_partialHydration&&nt===!0,g.v7_skipActionErrorRevalidation,K,G,q,pe,R,J,Wt,m,rt);if(Mt(kt=>!(ge&&ge.some(Zt=>Zt.route.id===kt))||Kt&&Kt.some(Zt=>Zt.route.id===kt)),P=++Q,Kt.length===0&&un.length===0){let kt=Rt();return ct(ce,pr({matches:ge,loaderData:{},errors:rt&&qs(rt[1])?{[rt[0]]:rt[1].error}:null},ex(rt),kt?{fetchers:new Map(A.fetchers)}:{}),{flushSync:yt}),{shortCircuited:!0}}if(Lt){let kt={};if(!Ie){kt.navigation=oe;let Zt=_e(rt);Zt!==void 0&&(kt.actionData=Zt)}un.length>0&&(kt.fetchers=we(un)),Ue(kt,{flushSync:yt})}un.forEach(kt=>{We(kt.key),kt.controller&&U.set(kt.key,kt.controller)});let En=()=>un.forEach(kt=>We(kt.key));F&&F.signal.addEventListener("abort",En);let{loaderResults:Hn,fetcherResults:jn}=await me(A,ge,Kt,un,Z);if(Z.signal.aborted)return{shortCircuited:!0};F&&F.signal.removeEventListener("abort",En),un.forEach(kt=>U.delete(kt.key));let Qt=Ad(Hn);if(Qt)return await $e(Z,Qt.result,!0,{replace:gt}),{shortCircuited:!0};if(Qt=Ad(jn),Qt)return J.add(Qt.key),await $e(Z,Qt.result,!0,{replace:gt}),{shortCircuited:!0};let{loaderData:ir,errors:De}=Jk(A,ge,Hn,rt,un,jn,Y);Y.forEach((kt,Zt)=>{kt.subscribe(Pn=>{(Pn||kt.done)&&Y.delete(Zt)})}),g.v7_partialHydration&&nt&&A.errors&&(De=pr({},A.errors,De));let ze=Rt(),$t=cn(P),an=ze||$t||un.length>0;return pr({matches:ge,loaderData:ir,errors:De},an?{fetchers:new Map(A.fetchers)}:{})}function _e(Z){if(Z&&!qs(Z[1]))return{[Z[0]]:Z[1].data};if(A.actionData)return Object.keys(A.actionData).length===0?null:A.actionData}function we(Z){return Z.forEach(ce=>{let ge=A.fetchers.get(ce.key),Ie=kc(void 0,ge?ge.data:void 0);A.fetchers.set(ce.key,Ie)}),new Map(A.fetchers)}function qe(Z,ce,ge,Ie){if(s)throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");We(Z);let He=(Ie&&Ie.flushSync)===!0,Je=d||c,ft=$g(A.location,A.matches,m,g.v7_prependBasename,ge,g.v7_relativeSplatPath,ce,Ie==null?void 0:Ie.relative),gt=jo(Je,ft,m),nt=Sn(gt,Je,ft);if(nt.active&&nt.matches&&(gt=nt.matches),!gt){dt(Z,ce,Is(404,{pathname:ft}),{flushSync:He});return}let{path:yt,submission:rt,error:oe}=$k(g.v7_normalizeFormMethod,!0,ft,Ie);if(oe){dt(Z,ce,oe,{flushSync:He});return}let Ne=Ec(gt,yt),Lt=(Ie&&Ie.preventScrollReset)===!0;if(rt&&xi(rt.formMethod)){ke(Z,ce,yt,Ne,gt,nt.active,He,Lt,rt);return}R.set(Z,{routeId:ce,path:yt}),Ee(Z,ce,yt,Ne,gt,nt.active,He,Lt,rt)}async function ke(Z,ce,ge,Ie,He,Je,ft,gt,nt){Pe(),R.delete(Z);function yt(Jt){if(!Jt.route.action&&!Jt.route.lazy){let Un=Is(405,{method:nt.formMethod,pathname:ge,routeId:ce});return dt(Z,ce,Un,{flushSync:ft}),!0}return!1}if(!Je&&yt(Ie))return;let rt=A.fetchers.get(Z);Ge(Z,h1(nt,rt),{flushSync:ft});let oe=new AbortController,Ne=vl(e.history,ge,oe.signal,nt);if(Je){let Jt=await Et(He,new URL(Ne.url).pathname,Ne.signal,Z);if(Jt.type==="aborted")return;if(Jt.type==="error"){dt(Z,ce,Jt.error,{flushSync:ft});return}else if(Jt.matches){if(He=Jt.matches,Ie=Ec(He,ge),yt(Ie))return}else{dt(Z,ce,Is(404,{pathname:ge}),{flushSync:ft});return}}U.set(Z,oe);let Lt=Q,Kt=(await wt("action",A,Ne,[Ie],He,Z))[Ie.route.id];if(Ne.signal.aborted){U.get(Z)===oe&&U.delete(Z);return}if(g.v7_fetcherPersist&&pe.has(Z)){if(Do(Kt)||qs(Kt)){Ge(Z,Ua(void 0));return}}else{if(Do(Kt))if(U.delete(Z),P>Lt){Ge(Z,Ua(void 0));return}else return J.add(Z),Ge(Z,kc(nt)),$e(Ne,Kt,!1,{fetcherSubmission:nt,preventScrollReset:gt});if(qs(Kt)){dt(Z,ce,Kt.error);return}}if(qa(Kt))throw Is(400,{type:"defer-action"});let un=A.navigation.location||A.location,En=vl(e.history,un,oe.signal),Hn=d||c,jn=A.navigation.state!=="idle"?jo(Hn,A.navigation.location,m):A.matches;Mn(jn,"Didn't find any matches after fetcher action");let Qt=++Q;W.set(Z,Qt);let ir=kc(nt,Kt.data);A.fetchers.set(Z,ir);let[De,ze]=Gk(e.history,A,jn,nt,un,!1,g.v7_skipActionErrorRevalidation,K,G,q,pe,R,J,Hn,m,[Ie.route.id,Kt]);ze.filter(Jt=>Jt.key!==Z).forEach(Jt=>{let Un=Jt.key,gr=A.fetchers.get(Un),ar=kc(void 0,gr?gr.data:void 0);A.fetchers.set(Un,ar),We(Un),Jt.controller&&U.set(Un,Jt.controller)}),Ue({fetchers:new Map(A.fetchers)});let $t=()=>ze.forEach(Jt=>We(Jt.key));oe.signal.addEventListener("abort",$t);let{loaderResults:an,fetcherResults:kt}=await me(A,jn,De,ze,En);if(oe.signal.aborted)return;oe.signal.removeEventListener("abort",$t),W.delete(Z),U.delete(Z),ze.forEach(Jt=>U.delete(Jt.key));let Zt=Ad(an);if(Zt)return $e(En,Zt.result,!1,{preventScrollReset:gt});if(Zt=Ad(kt),Zt)return J.add(Zt.key),$e(En,Zt.result,!1,{preventScrollReset:gt});let{loaderData:Pn,errors:Sr}=Jk(A,jn,an,void 0,ze,kt,Y);if(A.fetchers.has(Z)){let Jt=Ua(Kt.data);A.fetchers.set(Z,Jt)}cn(Qt),A.navigation.state==="loading"&&Qt>P?(Mn(L,"Expected pending action"),F&&F.abort(),ct(A.navigation.location,{matches:jn,loaderData:Pn,errors:Sr,fetchers:new Map(A.fetchers)})):(Ue({errors:Sr,loaderData:Zk(A.loaderData,Pn,jn,Sr),fetchers:new Map(A.fetchers)}),K=!1)}async function Ee(Z,ce,ge,Ie,He,Je,ft,gt,nt){let yt=A.fetchers.get(Z);Ge(Z,kc(nt,yt?yt.data:void 0),{flushSync:ft});let rt=new AbortController,oe=vl(e.history,ge,rt.signal);if(Je){let Kt=await Et(He,new URL(oe.url).pathname,oe.signal,Z);if(Kt.type==="aborted")return;if(Kt.type==="error"){dt(Z,ce,Kt.error,{flushSync:ft});return}else if(Kt.matches)He=Kt.matches,Ie=Ec(He,ge);else{dt(Z,ce,Is(404,{pathname:ge}),{flushSync:ft});return}}U.set(Z,rt);let Ne=Q,Wt=(await wt("loader",A,oe,[Ie],He,Z))[Ie.route.id];if(qa(Wt)&&(Wt=await Zb(Wt,oe.signal,!0)||Wt),U.get(Z)===rt&&U.delete(Z),!oe.signal.aborted){if(pe.has(Z)){Ge(Z,Ua(void 0));return}if(Do(Wt))if(P>Ne){Ge(Z,Ua(void 0));return}else{J.add(Z),await $e(oe,Wt,!1,{preventScrollReset:gt});return}if(qs(Wt)){dt(Z,ce,Wt.error);return}Mn(!qa(Wt),"Unhandled fetcher deferred data"),Ge(Z,Ua(Wt.data))}}async function $e(Z,ce,ge,Ie){let{submission:He,fetcherSubmission:Je,preventScrollReset:ft,replace:gt}=Ie===void 0?{}:Ie;ce.response.headers.has("X-Remix-Revalidate")&&(K=!0);let nt=ce.response.headers.get("Location");Mn(nt,"Expected a Location header on the redirect Response"),nt=Xk(nt,new URL(Z.url),m,e.history);let yt=ru(A.location,nt,{_isRedirect:!0});if(r){let Kt=!1;if(ce.response.headers.has("X-Remix-Reload-Document"))Kt=!0;else if(Jb.test(nt)){const un=e.history.createURL(nt);Kt=un.origin!==t.location.origin||ju(un.pathname,m)==null}if(Kt){gt?t.location.replace(nt):t.location.assign(nt);return}}F=null;let rt=gt===!0||ce.response.headers.has("X-Remix-Replace")?Br.Replace:Br.Push,{formMethod:oe,formAction:Ne,formEncType:Lt}=A.navigation;!He&&!Je&&oe&&Ne&&Lt&&(He=rx(A.navigation));let Wt=He||Je;if(VE.has(ce.response.status)&&Wt&&xi(Wt.formMethod))await ut(rt,yt,{submission:pr({},Wt,{formAction:nt}),preventScrollReset:ft||_,enableViewTransition:ge?te:void 0});else{let Kt=hf(yt,He);await ut(rt,yt,{overrideNavigation:Kt,fetcherSubmission:Je,preventScrollReset:ft||_,enableViewTransition:ge?te:void 0})}}async function wt(Z,ce,ge,Ie,He,Je){let ft,gt={};try{ft=await e1(f,Z,ce,ge,Ie,He,Je,l,i)}catch(nt){return Ie.forEach(yt=>{gt[yt.route.id]={type:$n.error,error:nt}}),gt}for(let[nt,yt]of Object.entries(ft))if(a1(yt)){let rt=yt.result;gt[nt]={type:$n.redirect,response:r1(rt,ge,nt,He,m,g.v7_relativeSplatPath)}}else gt[nt]=await n1(yt);return gt}async function me(Z,ce,ge,Ie,He){let Je=Z.matches,ft=wt("loader",Z,He,ge,ce,null),gt=Promise.all(Ie.map(async rt=>{if(rt.matches&&rt.match&&rt.controller){let Ne=(await wt("loader",Z,vl(e.history,rt.path,rt.controller.signal),[rt.match],rt.matches,rt.key))[rt.match.route.id];return{[rt.key]:Ne}}else return Promise.resolve({[rt.key]:{type:$n.error,error:Is(404,{pathname:rt.path})}})})),nt=await ft,yt=(await gt).reduce((rt,oe)=>Object.assign(rt,oe),{});return await Promise.all([c1(ce,nt,He.signal,Je,Z.loaderData),u1(ce,yt,Ie)]),{loaderResults:nt,fetcherResults:yt}}function Pe(){K=!0,G.push(...Mt()),R.forEach((Z,ce)=>{U.has(ce)&&q.add(ce),We(ce)})}function Ge(Z,ce,ge){ge===void 0&&(ge={}),A.fetchers.set(Z,ce),Ue({fetchers:new Map(A.fetchers)},{flushSync:(ge&&ge.flushSync)===!0})}function dt(Z,ce,ge,Ie){Ie===void 0&&(Ie={});let He=To(A.matches,ce);Dt(Z),Ue({errors:{[He.route.id]:ge},fetchers:new Map(A.fetchers)},{flushSync:(Ie&&Ie.flushSync)===!0})}function Ye(Z){return ve.set(Z,(ve.get(Z)||0)+1),pe.has(Z)&&pe.delete(Z),A.fetchers.get(Z)||GE}function Dt(Z){let ce=A.fetchers.get(Z);U.has(Z)&&!(ce&&ce.state==="loading"&&W.has(Z))&&We(Z),R.delete(Z),W.delete(Z),J.delete(Z),g.v7_fetcherPersist&&pe.delete(Z),q.delete(Z),A.fetchers.delete(Z)}function ae(Z){let ce=(ve.get(Z)||0)-1;ce<=0?(ve.delete(Z),pe.add(Z),g.v7_fetcherPersist||Dt(Z)):ve.set(Z,ce),Ue({fetchers:new Map(A.fetchers)})}function We(Z){let ce=U.get(Z);ce&&(ce.abort(),U.delete(Z))}function jt(Z){for(let ce of Z){let ge=Ye(ce),Ie=Ua(ge.data);A.fetchers.set(ce,Ie)}}function Rt(){let Z=[],ce=!1;for(let ge of J){let Ie=A.fetchers.get(ge);Mn(Ie,"Expected fetcher: "+ge),Ie.state==="loading"&&(J.delete(ge),Z.push(ge),ce=!0)}return jt(Z),ce}function cn(Z){let ce=[];for(let[ge,Ie]of W)if(Ie<Z){let He=A.fetchers.get(ge);Mn(He,"Expected fetcher: "+ge),He.state==="loading"&&(We(ge),W.delete(ge),ce.push(ge))}return jt(ce),ce.length>0}function Vt(Z,ce){let ge=A.blockers.get(Z)||yc;return Se.get(Z)!==ce&&Se.set(Z,ce),ge}function Gt(Z){A.blockers.delete(Z),Se.delete(Z)}function pn(Z,ce){let ge=A.blockers.get(Z)||yc;Mn(ge.state==="unblocked"&&ce.state==="blocked"||ge.state==="blocked"&&ce.state==="blocked"||ge.state==="blocked"&&ce.state==="proceeding"||ge.state==="blocked"&&ce.state==="unblocked"||ge.state==="proceeding"&&ce.state==="unblocked","Invalid blocker state transition: "+ge.state+" -> "+ce.state);let Ie=new Map(A.blockers);Ie.set(Z,ce),Ue({blockers:Ie})}function ie(Z){let{currentLocation:ce,nextLocation:ge,historyAction:Ie}=Z;if(Se.size===0)return;Se.size>1&&Lo(!1,"A router only supports one blocker at a time");let He=Array.from(Se.entries()),[Je,ft]=He[He.length-1],gt=A.blockers.get(Je);if(!(gt&>.state==="proceeding")&&ft({currentLocation:ce,nextLocation:ge,historyAction:Ie}))return Je}function Be(Z){let ce=Is(404,{pathname:Z}),ge=d||c,{matches:Ie,route:He}=tx(ge);return Mt(),{notFoundMatches:Ie,route:He,error:ce}}function Mt(Z){let ce=[];return Y.forEach((ge,Ie)=>{(!Z||Z(Ie))&&(ge.cancel(),ce.push(Ie),Y.delete(Ie))}),ce}function Tt(Z,ce,ge){if(y=Z,T=ce,S=ge||null,!j&&A.navigation===df){j=!0;let Ie=Nn(A.location,A.matches);Ie!=null&&Ue({restoreScrollPosition:Ie})}return()=>{y=null,T=null,S=null}}function xn(Z,ce){return S&&S(Z,ce.map(Ie=>SE(Ie,A.loaderData)))||Z.key}function dn(Z,ce){if(y&&T){let ge=xn(Z,ce);y[ge]=T()}}function Nn(Z,ce){if(y){let ge=xn(Z,ce),Ie=y[ge];if(typeof Ie=="number")return Ie}return null}function Sn(Z,ce,ge){if(v)if(Z){if(Object.keys(Z[0].params).length>0)return{active:!0,matches:bh(ce,ge,m,!0)}}else return{active:!0,matches:bh(ce,ge,m,!0)||[]};return{active:!1,matches:null}}async function Et(Z,ce,ge,Ie){if(!v)return{type:"success",matches:Z};let He=Z;for(;;){let Je=d==null,ft=d||c,gt=l;try{await v({signal:ge,path:ce,matches:He,fetcherKey:Ie,patch:(rt,oe)=>{ge.aborted||Yk(rt,oe,ft,gt,i)}})}catch(rt){return{type:"error",error:rt,partialMatches:He}}finally{Je&&!ge.aborted&&(c=[...c])}if(ge.aborted)return{type:"aborted"};let nt=jo(ft,ce,m);if(nt)return{type:"success",matches:nt};let yt=bh(ft,ce,m,!0);if(!yt||He.length===yt.length&&He.every((rt,oe)=>rt.route.id===yt[oe].route.id))return{type:"success",matches:null};He=yt}}function In(Z){l={},d=Bh(Z,i,void 0,l)}function wn(Z,ce){let ge=d==null;Yk(Z,ce,d||c,l,i),ge&&(c=[...c],Ue({}))}return I={get basename(){return m},get future(){return g},get state(){return A},get routes(){return c},get window(){return t},initialize:re,subscribe:Xe,enableScrollRestoration:Tt,navigate:Nt,fetch:qe,revalidate:Ke,createHref:Z=>e.history.createHref(Z),encodeLocation:Z=>e.history.encodeLocation(Z),getFetcher:Ye,deleteFetcher:ae,dispose:Ce,getBlocker:Vt,deleteBlocker:Gt,patchRoutes:wn,_internalFetchControllers:U,_internalActiveDeferreds:Y,_internalSetRoutes:In},I}function XE(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function $g(e,t,r,s,i,l,c,d){let m,f;if(c){m=[];for(let g of t)if(m.push(g),g.route.id===c){f=g;break}}else m=t,f=t[t.length-1];let v=Qb(i||".",Xb(m,l),ju(e.pathname,r)||e.pathname,d==="path");if(i==null&&(v.search=e.search,v.hash=e.hash),(i==null||i===""||i===".")&&f){let g=ev(v.search);if(f.route.index&&!g)v.search=v.search?v.search.replace(/^\?/,"?index&"):"?index";else if(!f.route.index&&g){let w=new URLSearchParams(v.search),k=w.getAll("index");w.delete("index"),k.filter(S=>S).forEach(S=>w.append("index",S));let y=w.toString();v.search=y?"?"+y:""}}return s&&r!=="/"&&(v.pathname=v.pathname==="/"?r:Xa([r,v.pathname])),Cu(v)}function $k(e,t,r,s){if(!s||!XE(s))return{path:r};if(s.formMethod&&!l1(s.formMethod))return{path:r,error:Is(405,{method:s.formMethod})};let i=()=>({path:r,error:Is(400,{type:"invalid-body"})}),l=s.formMethod||"get",c=e?l.toUpperCase():l.toLowerCase(),d=bN(r);if(s.body!==void 0){if(s.formEncType==="text/plain"){if(!xi(c))return i();let w=typeof s.body=="string"?s.body:s.body instanceof FormData||s.body instanceof URLSearchParams?Array.from(s.body.entries()).reduce((k,y)=>{let[S,T]=y;return""+k+S+"="+T+`
|
|
51
|
-
`},""):String(s.body);return{path:r,submission:{formMethod:c,formAction:d,formEncType:s.formEncType,formData:void 0,json:void 0,text:w}}}else if(s.formEncType==="application/json"){if(!xi(c))return i();try{let w=typeof s.body=="string"?JSON.parse(s.body):s.body;return{path:r,submission:{formMethod:c,formAction:d,formEncType:s.formEncType,formData:void 0,json:w,text:void 0}}}catch{return i()}}}Mn(typeof FormData=="function","FormData is not available in this environment");let m,f;if(s.formData)m=Gg(s.formData),f=s.formData;else if(s.body instanceof FormData)m=Gg(s.body),f=s.body;else if(s.body instanceof URLSearchParams)m=s.body,f=Qk(m);else if(s.body==null)m=new URLSearchParams,f=new FormData;else try{m=new URLSearchParams(s.body),f=Qk(m)}catch{return i()}let v={formMethod:c,formAction:d,formEncType:s&&s.formEncType||"application/x-www-form-urlencoded",formData:f,json:void 0,text:void 0};if(xi(v.formMethod))return{path:r,submission:v};let g=Za(r);return t&&g.search&&ev(g.search)&&m.append("index",""),g.search="?"+m,{path:Cu(g),submission:v}}function Vk(e,t,r){r===void 0&&(r=!1);let s=e.findIndex(i=>i.route.id===t);return s>=0?e.slice(0,r?s+1:s):e}function Gk(e,t,r,s,i,l,c,d,m,f,v,g,w,k,y,S){let T=S?qs(S[1])?S[1].error:S[1].data:void 0,j=e.createURL(t.location),N=e.createURL(i),D=r;l&&t.errors?D=Vk(r,Object.keys(t.errors)[0],!0):S&&qs(S[1])&&(D=Vk(r,S[0]));let H=S?S[1].statusCode:void 0,B=c&&H&&H>=400,I=D.filter((L,_)=>{let{route:F}=L;if(F.lazy)return!0;if(F.loader==null)return!1;if(l)return Vg(F,t.loaderData,t.errors);if(QE(t.loaderData,t.matches[_],L)||m.some(se=>se===L.route.id))return!0;let te=t.matches[_],E=L;return Kk(L,pr({currentUrl:j,currentParams:te.params,nextUrl:N,nextParams:E.params},s,{actionResult:T,actionStatus:H,defaultShouldRevalidate:B?!1:d||j.pathname+j.search===N.pathname+N.search||j.search!==N.search||fN(te,E)}))}),A=[];return g.forEach((L,_)=>{if(l||!r.some(X=>X.route.id===L.routeId)||v.has(_))return;let F=jo(k,L.path,y);if(!F){A.push({key:_,routeId:L.routeId,path:L.path,matches:null,match:null,controller:null});return}let te=t.fetchers.get(_),E=Ec(F,L.path),se=!1;w.has(_)?se=!1:f.has(_)?(f.delete(_),se=!0):te&&te.state!=="idle"&&te.data===void 0?se=d:se=Kk(E,pr({currentUrl:j,currentParams:t.matches[t.matches.length-1].params,nextUrl:N,nextParams:r[r.length-1].params},s,{actionResult:T,actionStatus:H,defaultShouldRevalidate:B?!1:d})),se&&A.push({key:_,routeId:L.routeId,path:L.path,matches:F,match:E,controller:new AbortController})}),[I,A]}function Vg(e,t,r){if(e.lazy)return!0;if(!e.loader)return!1;let s=t!=null&&t[e.id]!==void 0,i=r!=null&&r[e.id]!==void 0;return!s&&i?!1:typeof e.loader=="function"&&e.loader.hydrate===!0?!0:!s&&!i}function QE(e,t,r){let s=!t||r.route.id!==t.route.id,i=e[r.route.id]===void 0;return s||i}function fN(e,t){let r=e.route.path;return e.pathname!==t.pathname||r!=null&&r.endsWith("*")&&e.params["*"]!==t.params["*"]}function Kk(e,t){if(e.route.shouldRevalidate){let r=e.route.shouldRevalidate(t);if(typeof r=="boolean")return r}return t.defaultShouldRevalidate}function Yk(e,t,r,s,i){var l;let c;if(e){let f=s[e];Mn(f,"No route found to patch children into: routeId = "+e),f.children||(f.children=[]),c=f.children}else c=r;let d=t.filter(f=>!c.some(v=>gN(f,v))),m=Bh(d,i,[e||"_","patch",String(((l=c)==null?void 0:l.length)||"0")],s);c.push(...m)}function gN(e,t){return"id"in e&&"id"in t&&e.id===t.id?!0:e.index===t.index&&e.path===t.path&&e.caseSensitive===t.caseSensitive?(!e.children||e.children.length===0)&&(!t.children||t.children.length===0)?!0:e.children.every((r,s)=>{var i;return(i=t.children)==null?void 0:i.some(l=>gN(r,l))}):!1}async function JE(e,t,r){if(!e.lazy)return;let s=await e.lazy();if(!e.lazy)return;let i=r[e.id];Mn(i,"No route found in manifest");let l={};for(let c in s){let m=i[c]!==void 0&&c!=="hasErrorBoundary";Lo(!m,'Route "'+i.id+'" has a static property "'+c+'" defined but its lazy function is also returning a value for this property. '+('The lazy route property "'+c+'" will be ignored.')),!m&&!kE.has(c)&&(l[c]=s[c])}Object.assign(i,l),Object.assign(i,pr({},t(i),{lazy:void 0}))}async function ZE(e){let{matches:t}=e,r=t.filter(i=>i.shouldLoad);return(await Promise.all(r.map(i=>i.resolve()))).reduce((i,l,c)=>Object.assign(i,{[r[c].route.id]:l}),{})}async function e1(e,t,r,s,i,l,c,d,m,f){let v=l.map(k=>k.route.lazy?JE(k.route,m,d):void 0),g=l.map((k,y)=>{let S=v[y],T=i.some(N=>N.route.id===k.route.id);return pr({},k,{shouldLoad:T,resolve:async N=>(N&&s.method==="GET"&&(k.route.lazy||k.route.loader)&&(T=!0),T?t1(t,s,k,S,N,f):Promise.resolve({type:$n.data,result:void 0}))})}),w=await e({matches:g,request:s,params:l[0].params,fetcherKey:c,context:f});try{await Promise.all(v)}catch{}return w}async function t1(e,t,r,s,i,l){let c,d,m=f=>{let v,g=new Promise((y,S)=>v=S);d=()=>v(),t.signal.addEventListener("abort",d);let w=y=>typeof f!="function"?Promise.reject(new Error("You cannot call the handler for a route which defines a boolean "+('"'+e+'" [routeId: '+r.route.id+"]"))):f({request:t,params:r.params,context:l},...y!==void 0?[y]:[]),k=(async()=>{try{return{type:"data",result:await(i?i(S=>w(S)):w())}}catch(y){return{type:"error",result:y}}})();return Promise.race([k,g])};try{let f=r.route[e];if(s)if(f){let v,[g]=await Promise.all([m(f).catch(w=>{v=w}),s]);if(v!==void 0)throw v;c=g}else if(await s,f=r.route[e],f)c=await m(f);else if(e==="action"){let v=new URL(t.url),g=v.pathname+v.search;throw Is(405,{method:t.method,pathname:g,routeId:r.route.id})}else return{type:$n.data,result:void 0};else if(f)c=await m(f);else{let v=new URL(t.url),g=v.pathname+v.search;throw Is(404,{pathname:g})}Mn(c.result!==void 0,"You defined "+(e==="action"?"an action":"a loader")+" for route "+('"'+r.route.id+"\" but didn't return anything from your `"+e+"` ")+"function. Please return a value or `null`.")}catch(f){return{type:$n.error,result:f}}finally{d&&t.signal.removeEventListener("abort",d)}return c}async function n1(e){let{result:t,type:r}=e;if(vN(t)){let g;try{let w=t.headers.get("Content-Type");w&&/\bapplication\/json\b/.test(w)?t.body==null?g=null:g=await t.json():g=await t.text()}catch(w){return{type:$n.error,error:w}}return r===$n.error?{type:$n.error,error:new Wh(t.status,t.statusText,g),statusCode:t.status,headers:t.headers}:{type:$n.data,data:g,statusCode:t.status,headers:t.headers}}if(r===$n.error){if(nx(t)){var s,i;if(t.data instanceof Error){var l,c;return{type:$n.error,error:t.data,statusCode:(l=t.init)==null?void 0:l.status,headers:(c=t.init)!=null&&c.headers?new Headers(t.init.headers):void 0}}return{type:$n.error,error:new Wh(((s=t.init)==null?void 0:s.status)||500,void 0,t.data),statusCode:su(t)?t.status:void 0,headers:(i=t.init)!=null&&i.headers?new Headers(t.init.headers):void 0}}return{type:$n.error,error:t,statusCode:su(t)?t.status:void 0}}if(o1(t)){var d,m;return{type:$n.deferred,deferredData:t,statusCode:(d=t.init)==null?void 0:d.status,headers:((m=t.init)==null?void 0:m.headers)&&new Headers(t.init.headers)}}if(nx(t)){var f,v;return{type:$n.data,data:t.data,statusCode:(f=t.init)==null?void 0:f.status,headers:(v=t.init)!=null&&v.headers?new Headers(t.init.headers):void 0}}return{type:$n.data,data:t}}function r1(e,t,r,s,i,l){let c=e.headers.get("Location");if(Mn(c,"Redirects returned/thrown from loaders/actions must have a Location header"),!Jb.test(c)){let d=s.slice(0,s.findIndex(m=>m.route.id===r)+1);c=$g(new URL(t.url),d,i,!0,c,l),e.headers.set("Location",c)}return e}function Xk(e,t,r,s){let i=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];if(Jb.test(e)){let l=e,c=l.startsWith("//")?new URL(t.protocol+l):new URL(l);if(i.includes(c.protocol))throw new Error("Invalid redirect location");let d=ju(c.pathname,r)!=null;if(c.origin===t.origin&&d)return c.pathname+c.search+c.hash}try{let l=s.createURL(e);if(i.includes(l.protocol))throw new Error("Invalid redirect location")}catch{}return e}function vl(e,t,r,s){let i=e.createURL(bN(t)).toString(),l={signal:r};if(s&&xi(s.formMethod)){let{formMethod:c,formEncType:d}=s;l.method=c.toUpperCase(),d==="application/json"?(l.headers=new Headers({"Content-Type":d}),l.body=JSON.stringify(s.json)):d==="text/plain"?l.body=s.text:d==="application/x-www-form-urlencoded"&&s.formData?l.body=Gg(s.formData):l.body=s.formData}return new Request(i,l)}function Gg(e){let t=new URLSearchParams;for(let[r,s]of e.entries())t.append(r,typeof s=="string"?s:s.name);return t}function Qk(e){let t=new FormData;for(let[r,s]of e.entries())t.append(r,s);return t}function s1(e,t,r,s,i){let l={},c=null,d,m=!1,f={},v=r&&qs(r[1])?r[1].error:void 0;return e.forEach(g=>{if(!(g.route.id in t))return;let w=g.route.id,k=t[w];if(Mn(!Do(k),"Cannot handle redirect results in processLoaderData"),qs(k)){let y=k.error;v!==void 0&&(y=v,v=void 0),c=c||{};{let S=To(e,w);c[S.route.id]==null&&(c[S.route.id]=y)}l[w]=void 0,m||(m=!0,d=su(k.error)?k.error.status:500),k.headers&&(f[w]=k.headers)}else qa(k)?(s.set(w,k.deferredData),l[w]=k.deferredData.data,k.statusCode!=null&&k.statusCode!==200&&!m&&(d=k.statusCode),k.headers&&(f[w]=k.headers)):(l[w]=k.data,k.statusCode&&k.statusCode!==200&&!m&&(d=k.statusCode),k.headers&&(f[w]=k.headers))}),v!==void 0&&r&&(c={[r[0]]:v},l[r[0]]=void 0),{loaderData:l,errors:c,statusCode:d||200,loaderHeaders:f}}function Jk(e,t,r,s,i,l,c){let{loaderData:d,errors:m}=s1(t,r,s,c);return i.forEach(f=>{let{key:v,match:g,controller:w}=f,k=l[v];if(Mn(k,"Did not find corresponding fetcher result"),!(w&&w.signal.aborted))if(qs(k)){let y=To(e.matches,g==null?void 0:g.route.id);m&&m[y.route.id]||(m=pr({},m,{[y.route.id]:k.error})),e.fetchers.delete(v)}else if(Do(k))Mn(!1,"Unhandled fetcher revalidation redirect");else if(qa(k))Mn(!1,"Unhandled fetcher deferred data");else{let y=Ua(k.data);e.fetchers.set(v,y)}}),{loaderData:d,errors:m}}function Zk(e,t,r,s){let i=pr({},t);for(let l of r){let c=l.route.id;if(t.hasOwnProperty(c)?t[c]!==void 0&&(i[c]=t[c]):e[c]!==void 0&&l.route.loader&&(i[c]=e[c]),s&&s.hasOwnProperty(c))break}return i}function ex(e){return e?qs(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function To(e,t){return(t?e.slice(0,e.findIndex(s=>s.route.id===t)+1):[...e]).reverse().find(s=>s.route.hasErrorBoundary===!0)||e[0]}function tx(e){let t=e.length===1?e[0]:e.find(r=>r.index||!r.path||r.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function Is(e,t){let{pathname:r,routeId:s,method:i,type:l,message:c}=t===void 0?{}:t,d="Unknown Server Error",m="Unknown @remix-run/router error";return e===400?(d="Bad Request",i&&r&&s?m="You made a "+i+' request to "'+r+'" but '+('did not provide a `loader` for route "'+s+'", ')+"so there is no way to handle the request.":l==="defer-action"?m="defer() is not supported in actions":l==="invalid-body"&&(m="Unable to encode submission body")):e===403?(d="Forbidden",m='Route "'+s+'" does not match URL "'+r+'"'):e===404?(d="Not Found",m='No route matches URL "'+r+'"'):e===405&&(d="Method Not Allowed",i&&r&&s?m="You made a "+i.toUpperCase()+' request to "'+r+'" but '+('did not provide an `action` for route "'+s+'", ')+"so there is no way to handle the request.":i&&(m='Invalid request method "'+i.toUpperCase()+'"')),new Wh(e||500,d,new Error(m),!0)}function Ad(e){let t=Object.entries(e);for(let r=t.length-1;r>=0;r--){let[s,i]=t[r];if(Do(i))return{key:s,result:i}}}function bN(e){let t=typeof e=="string"?Za(e):e;return Cu(pr({},t,{hash:""}))}function i1(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===""?t.hash!=="":e.hash===t.hash?!0:t.hash!==""}function a1(e){return vN(e.result)&&$E.has(e.result.status)}function qa(e){return e.type===$n.deferred}function qs(e){return e.type===$n.error}function Do(e){return(e&&e.type)===$n.redirect}function nx(e){return typeof e=="object"&&e!=null&&"type"in e&&"data"in e&&"init"in e&&e.type==="DataWithResponseInit"}function o1(e){let t=e;return t&&typeof t=="object"&&typeof t.data=="object"&&typeof t.subscribe=="function"&&typeof t.cancel=="function"&&typeof t.resolveData=="function"}function vN(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function l1(e){return qE.has(e.toLowerCase())}function xi(e){return HE.has(e.toLowerCase())}async function c1(e,t,r,s,i){let l=Object.entries(t);for(let c=0;c<l.length;c++){let[d,m]=l[c],f=e.find(w=>(w==null?void 0:w.route.id)===d);if(!f)continue;let v=s.find(w=>w.route.id===f.route.id),g=v!=null&&!fN(v,f)&&(i&&i[f.route.id])!==void 0;qa(m)&&g&&await Zb(m,r,!1).then(w=>{w&&(t[d]=w)})}}async function u1(e,t,r){for(let s=0;s<r.length;s++){let{key:i,routeId:l,controller:c}=r[s],d=t[i];e.find(f=>(f==null?void 0:f.route.id)===l)&&qa(d)&&(Mn(c,"Expected an AbortController for revalidating fetcher deferred result"),await Zb(d,c.signal,!0).then(f=>{f&&(t[i]=f)}))}}async function Zb(e,t,r){if(r===void 0&&(r=!1),!await e.deferredData.resolveData(t)){if(r)try{return{type:$n.data,data:e.deferredData.unwrappedData}}catch(i){return{type:$n.error,error:i}}return{type:$n.data,data:e.deferredData.data}}}function ev(e){return new URLSearchParams(e).getAll("index").some(t=>t==="")}function Ec(e,t){let r=typeof t=="string"?Za(t).search:t.search;if(e[e.length-1].route.index&&ev(r||""))return e[e.length-1];let s=hN(e);return s[s.length-1]}function rx(e){let{formMethod:t,formAction:r,formEncType:s,text:i,formData:l,json:c}=e;if(!(!t||!r||!s)){if(i!=null)return{formMethod:t,formAction:r,formEncType:s,formData:void 0,json:void 0,text:i};if(l!=null)return{formMethod:t,formAction:r,formEncType:s,formData:l,json:void 0,text:void 0};if(c!==void 0)return{formMethod:t,formAction:r,formEncType:s,formData:void 0,json:c,text:void 0}}}function hf(e,t){return t?{state:"loading",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}:{state:"loading",location:e,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function d1(e,t){return{state:"submitting",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}}function kc(e,t){return e?{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function h1(e,t){return{state:"submitting",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}function Ua(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function m1(e,t){try{let r=e.sessionStorage.getItem(pN);if(r){let s=JSON.parse(r);for(let[i,l]of Object.entries(s||{}))l&&Array.isArray(l)&&t.set(i,new Set(l||[]))}}catch{}}function p1(e,t){if(t.size>0){let r={};for(let[s,i]of t)r[s]=[...i];try{e.sessionStorage.setItem(pN,JSON.stringify(r))}catch(s){Lo(!1,"Failed to save applied view transitions in sessionStorage ("+s+").")}}}/**
|
|
52
|
-
* React Router v6.30.3
|
|
53
|
-
*
|
|
54
|
-
* Copyright (c) Remix Software Inc.
|
|
55
|
-
*
|
|
56
|
-
* This source code is licensed under the MIT license found in the
|
|
57
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
58
|
-
*
|
|
59
|
-
* @license MIT
|
|
60
|
-
*/function Uh(){return Uh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},Uh.apply(this,arguments)}const mm=p.createContext(null),wN=p.createContext(null),Tu=p.createContext(null),tv=p.createContext(null),fa=p.createContext({outlet:null,matches:[],isDataRoute:!1}),yN=p.createContext(null);function Nu(){return p.useContext(tv)!=null}function ui(){return Nu()||Mn(!1),p.useContext(tv).location}function kN(e){p.useContext(Tu).static||p.useLayoutEffect(e)}function fr(){let{isDataRoute:e}=p.useContext(fa);return e?P1():f1()}function f1(){Nu()||Mn(!1);let e=p.useContext(mm),{basename:t,future:r,navigator:s}=p.useContext(Tu),{matches:i}=p.useContext(fa),{pathname:l}=ui(),c=JSON.stringify(Xb(i,r.v7_relativeSplatPath)),d=p.useRef(!1);return kN(()=>{d.current=!0}),p.useCallback(function(f,v){if(v===void 0&&(v={}),!d.current)return;if(typeof f=="number"){s.go(f);return}let g=Qb(f,JSON.parse(c),l,v.relative==="path");e==null&&t!=="/"&&(g.pathname=g.pathname==="/"?t:Xa([t,g.pathname])),(v.replace?s.replace:s.push)(g,v.state,v)},[t,s,c,l,e])}const g1=p.createContext(null);function b1(e){let t=p.useContext(fa).outlet;return t&&p.createElement(g1.Provider,{value:e},t)}function Ho(){let{matches:e}=p.useContext(fa),t=e[e.length-1];return t?t.params:{}}function v1(e,t,r,s){Nu()||Mn(!1);let{navigator:i}=p.useContext(Tu),{matches:l}=p.useContext(fa),c=l[l.length-1],d=c?c.params:{};c&&c.pathname;let m=c?c.pathnameBase:"/";c&&c.route;let f=ui(),v;v=f;let g=v.pathname||"/",w=g;if(m!=="/"){let S=m.replace(/^\//,"").split("/");w="/"+g.replace(/^\//,"").split("/").slice(S.length).join("/")}let k=jo(e,{pathname:w});return S1(k&&k.map(S=>Object.assign({},S,{params:Object.assign({},d,S.params),pathname:Xa([m,i.encodeLocation?i.encodeLocation(S.pathname).pathname:S.pathname]),pathnameBase:S.pathnameBase==="/"?m:Xa([m,i.encodeLocation?i.encodeLocation(S.pathnameBase).pathname:S.pathnameBase])})),l,r,s)}function w1(){let e=N1(),t=su(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return p.createElement(p.Fragment,null,p.createElement("h2",null,"Unexpected Application Error!"),p.createElement("h3",{style:{fontStyle:"italic"}},t),r?p.createElement("pre",{style:i},r):null,null)}const y1=p.createElement(w1,null);class k1 extends p.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,r){return r.location!==t.location||r.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:r.error,location:r.location,revalidation:t.revalidation||r.revalidation}}componentDidCatch(t,r){console.error("React Router caught the following error during render",t,r)}render(){return this.state.error!==void 0?p.createElement(fa.Provider,{value:this.props.routeContext},p.createElement(yN.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function x1(e){let{routeContext:t,match:r,children:s}=e,i=p.useContext(mm);return i&&i.static&&i.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=r.route.id),p.createElement(fa.Provider,{value:t},s)}function S1(e,t,r,s){var i;if(t===void 0&&(t=[]),r===void 0&&(r=null),s===void 0&&(s=null),e==null){var l;if(!r)return null;if(r.errors)e=r.matches;else if((l=s)!=null&&l.v7_partialHydration&&t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let c=e,d=(i=r)==null?void 0:i.errors;if(d!=null){let v=c.findIndex(g=>g.route.id&&(d==null?void 0:d[g.route.id])!==void 0);v>=0||Mn(!1),c=c.slice(0,Math.min(c.length,v+1))}let m=!1,f=-1;if(r&&s&&s.v7_partialHydration)for(let v=0;v<c.length;v++){let g=c[v];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(f=v),g.route.id){let{loaderData:w,errors:k}=r,y=g.route.loader&&w[g.route.id]===void 0&&(!k||k[g.route.id]===void 0);if(g.route.lazy||y){m=!0,f>=0?c=c.slice(0,f+1):c=[c[0]];break}}}return c.reduceRight((v,g,w)=>{let k,y=!1,S=null,T=null;r&&(k=d&&g.route.id?d[g.route.id]:void 0,S=g.route.errorElement||y1,m&&(f<0&&w===0?(D1("route-fallback"),y=!0,T=null):f===w&&(y=!0,T=g.route.hydrateFallbackElement||null)));let j=t.concat(c.slice(0,w+1)),N=()=>{let D;return k?D=S:y?D=T:g.route.Component?D=p.createElement(g.route.Component,null):g.route.element?D=g.route.element:D=v,p.createElement(x1,{match:g,routeContext:{outlet:v,matches:j,isDataRoute:r!=null},children:D})};return r&&(g.route.ErrorBoundary||g.route.errorElement||w===0)?p.createElement(k1,{location:r.location,revalidation:r.revalidation,component:S,error:k,children:N(),routeContext:{outlet:null,matches:j,isDataRoute:!0}}):N()},null)}var xN=(function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e})(xN||{}),SN=(function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e})(SN||{});function C1(e){let t=p.useContext(mm);return t||Mn(!1),t}function j1(e){let t=p.useContext(wN);return t||Mn(!1),t}function T1(e){let t=p.useContext(fa);return t||Mn(!1),t}function CN(e){let t=T1(),r=t.matches[t.matches.length-1];return r.route.id||Mn(!1),r.route.id}function N1(){var e;let t=p.useContext(yN),r=j1(),s=CN();return t!==void 0?t:(e=r.errors)==null?void 0:e[s]}function P1(){let{router:e}=C1(xN.UseNavigateStable),t=CN(SN.UseNavigateStable),r=p.useRef(!1);return kN(()=>{r.current=!0}),p.useCallback(function(i,l){l===void 0&&(l={}),r.current&&(typeof i=="number"?e.navigate(i):e.navigate(i,Uh({fromRouteId:t},l)))},[e,t])}const sx={};function D1(e,t,r){sx[e]||(sx[e]=!0)}function R1(e,t){e==null||e.v7_startTransition,(e==null?void 0:e.v7_relativeSplatPath)===void 0&&(!t||t.v7_relativeSplatPath),t&&(t.v7_fetcherPersist,t.v7_normalizeFormMethod,t.v7_partialHydration,t.v7_skipActionErrorRevalidation)}function eo(e){let{to:t,replace:r,state:s,relative:i}=e;Nu()||Mn(!1);let{future:l,static:c}=p.useContext(Tu),{matches:d}=p.useContext(fa),{pathname:m}=ui(),f=fr(),v=Qb(t,Xb(d,l.v7_relativeSplatPath),m,i==="path"),g=JSON.stringify(v);return p.useEffect(()=>f(JSON.parse(g),{replace:r,state:s,relative:i}),[f,g,i,r,s]),null}function Kg(e){return b1(e.context)}function A1(e){let{basename:t="/",children:r=null,location:s,navigationType:i=Br.Pop,navigator:l,static:c=!1,future:d}=e;Nu()&&Mn(!1);let m=t.replace(/^\/*/,"/"),f=p.useMemo(()=>({basename:m,navigator:l,static:c,future:Uh({v7_relativeSplatPath:!1},d)}),[m,d,l,c]);typeof s=="string"&&(s=Za(s));let{pathname:v="/",search:g="",hash:w="",state:k=null,key:y="default"}=s,S=p.useMemo(()=>{let T=ju(v,m);return T==null?null:{location:{pathname:T,search:g,hash:w,state:k,key:y},navigationType:i}},[m,v,g,w,k,y,i]);return S==null?null:p.createElement(Tu.Provider,{value:f},p.createElement(tv.Provider,{children:r,value:S}))}new Promise(()=>{});function M1(e){let t={hasErrorBoundary:e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&Object.assign(t,{element:p.createElement(e.Component),Component:void 0}),e.HydrateFallback&&Object.assign(t,{hydrateFallbackElement:p.createElement(e.HydrateFallback),HydrateFallback:void 0}),e.ErrorBoundary&&Object.assign(t,{errorElement:p.createElement(e.ErrorBoundary),ErrorBoundary:void 0}),t}/**
|
|
61
|
-
* React Router DOM v6.30.3
|
|
62
|
-
*
|
|
63
|
-
* Copyright (c) Remix Software Inc.
|
|
64
|
-
*
|
|
65
|
-
* This source code is licensed under the MIT license found in the
|
|
66
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
67
|
-
*
|
|
68
|
-
* @license MIT
|
|
69
|
-
*/function Hh(){return Hh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},Hh.apply(this,arguments)}function Yg(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let s=e[r];return t.concat(Array.isArray(s)?s.map(i=>[r,i]):[[r,s]])},[]))}function I1(e,t){let r=Yg(e);return t&&t.forEach((s,i)=>{r.has(i)||t.getAll(i).forEach(l=>{r.append(i,l)})}),r}const E1="6";try{window.__reactRouterVersion=E1}catch{}function L1(e,t){return YE({basename:void 0,future:Hh({},void 0,{v7_prependBasename:!0}),history:vE({window:void 0}),hydrationData:F1(),routes:e,mapRouteProperties:M1,dataStrategy:void 0,patchRoutesOnNavigation:void 0,window:void 0}).initialize()}function F1(){var e;let t=(e=window)==null?void 0:e.__staticRouterHydrationData;return t&&t.errors&&(t=Hh({},t,{errors:_1(t.errors)})),t}function _1(e){if(!e)return null;let t=Object.entries(e),r={};for(let[s,i]of t)if(i&&i.__type==="RouteErrorResponse")r[s]=new Wh(i.status,i.statusText,i.data,i.internal===!0);else if(i&&i.__type==="Error"){if(i.__subType){let l=window[i.__subType];if(typeof l=="function")try{let c=new l(i.message);c.stack="",r[s]=c}catch{}}if(r[s]==null){let l=new Error(i.message);l.stack="",r[s]=l}}else r[s]=i;return r}const O1=p.createContext({isTransitioning:!1}),B1=p.createContext(new Map),W1="startTransition",ix=nI[W1],U1="flushSync",ax=bE[U1];function H1(e){ix?ix(e):e()}function xc(e){ax?ax(e):e()}class z1{constructor(){this.status="pending",this.promise=new Promise((t,r)=>{this.resolve=s=>{this.status==="pending"&&(this.status="resolved",t(s))},this.reject=s=>{this.status==="pending"&&(this.status="rejected",r(s))}})}}function q1(e){let{fallbackElement:t,router:r,future:s}=e,[i,l]=p.useState(r.state),[c,d]=p.useState(),[m,f]=p.useState({isTransitioning:!1}),[v,g]=p.useState(),[w,k]=p.useState(),[y,S]=p.useState(),T=p.useRef(new Map),{v7_startTransition:j}=s||{},N=p.useCallback(L=>{j?H1(L):L()},[j]),D=p.useCallback((L,_)=>{let{deletedFetchers:F,flushSync:te,viewTransitionOpts:E}=_;L.fetchers.forEach((X,K)=>{X.data!==void 0&&T.current.set(K,X.data)}),F.forEach(X=>T.current.delete(X));let se=r.window==null||r.window.document==null||typeof r.window.document.startViewTransition!="function";if(!E||se){te?xc(()=>l(L)):N(()=>l(L));return}if(te){xc(()=>{w&&(v&&v.resolve(),w.skipTransition()),f({isTransitioning:!0,flushSync:!0,currentLocation:E.currentLocation,nextLocation:E.nextLocation})});let X=r.window.document.startViewTransition(()=>{xc(()=>l(L))});X.finished.finally(()=>{xc(()=>{g(void 0),k(void 0),d(void 0),f({isTransitioning:!1})})}),xc(()=>k(X));return}w?(v&&v.resolve(),w.skipTransition(),S({state:L,currentLocation:E.currentLocation,nextLocation:E.nextLocation})):(d(L),f({isTransitioning:!0,flushSync:!1,currentLocation:E.currentLocation,nextLocation:E.nextLocation}))},[r.window,w,v,T,N]);p.useLayoutEffect(()=>r.subscribe(D),[r,D]),p.useEffect(()=>{m.isTransitioning&&!m.flushSync&&g(new z1)},[m]),p.useEffect(()=>{if(v&&c&&r.window){let L=c,_=v.promise,F=r.window.document.startViewTransition(async()=>{N(()=>l(L)),await _});F.finished.finally(()=>{g(void 0),k(void 0),d(void 0),f({isTransitioning:!1})}),k(F)}},[N,c,v,r.window]),p.useEffect(()=>{v&&c&&i.location.key===c.location.key&&v.resolve()},[v,w,i.location,c]),p.useEffect(()=>{!m.isTransitioning&&y&&(d(y.state),f({isTransitioning:!0,flushSync:!1,currentLocation:y.currentLocation,nextLocation:y.nextLocation}),S(void 0))},[m.isTransitioning,y]),p.useEffect(()=>{},[]);let H=p.useMemo(()=>({createHref:r.createHref,encodeLocation:r.encodeLocation,go:L=>r.navigate(L),push:(L,_,F)=>r.navigate(L,{state:_,preventScrollReset:F==null?void 0:F.preventScrollReset}),replace:(L,_,F)=>r.navigate(L,{replace:!0,state:_,preventScrollReset:F==null?void 0:F.preventScrollReset})}),[r]),B=r.basename||"/",I=p.useMemo(()=>({router:r,navigator:H,static:!1,basename:B}),[r,H,B]),A=p.useMemo(()=>({v7_relativeSplatPath:r.future.v7_relativeSplatPath}),[r.future.v7_relativeSplatPath]);return p.useEffect(()=>R1(s,r.future),[s,r.future]),p.createElement(p.Fragment,null,p.createElement(mm.Provider,{value:I},p.createElement(wN.Provider,{value:i},p.createElement(B1.Provider,{value:T.current},p.createElement(O1.Provider,{value:m},p.createElement(A1,{basename:B,location:i.location,navigationType:i.historyAction,navigator:H,future:A},i.initialized||r.future.v7_partialHydration?p.createElement($1,{routes:r.routes,future:r.future,state:i}):t))))),null)}const $1=p.memo(V1);function V1(e){let{routes:t,future:r,state:s}=e;return v1(t,void 0,s,r)}var ox;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(ox||(ox={}));var lx;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(lx||(lx={}));function G1(e){let t=p.useRef(Yg(e)),r=p.useRef(!1),s=ui(),i=p.useMemo(()=>I1(s.search,r.current?null:t.current),[s.search]),l=fr(),c=p.useCallback((d,m)=>{const f=Yg(typeof d=="function"?d(i):d);r.current=!0,l("?"+f,m)},[l,i]);return[i,c]}const K1="modulepreload",Y1=function(e){return"/"+e},cx={},_l=function(t,r,s){let i=Promise.resolve();if(r&&r.length>0){let c=function(f){return Promise.all(f.map(v=>Promise.resolve(v).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),m=(d==null?void 0:d.nonce)||(d==null?void 0:d.getAttribute("nonce"));i=c(r.map(f=>{if(f=Y1(f),f in cx)return;cx[f]=!0;const v=f.endsWith(".css"),g=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${g}`))return;const w=document.createElement("link");if(w.rel=v?"stylesheet":K1,v||(w.as="script"),w.crossOrigin="",w.href=f,m&&w.setAttribute("nonce",m),document.head.appendChild(w),v)return new Promise((k,y)=>{w.addEventListener("load",k),w.addEventListener("error",()=>y(new Error(`Unable to preload CSS for ${f}`)))})}))}function l(c){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=c,window.dispatchEvent(d),!d.defaultPrevented)throw c}return i.then(c=>{for(const d of c||[])d.status==="rejected"&&l(d.reason);return t().catch(l)})},X1="desktop://window-lifecycle",jN=p.createContext(null),Q1=["--desktop-macos-traffic-light-center-y","--desktop-macos-traffic-light-leading-inset","--desktop-macos-traffic-light-safe-zone-width","--desktop-macos-titlebar-height","--desktop-macos-traffic-light-button-diameter"];function J1(e){if(typeof document>"u")return;const{documentElement:t,body:r}=document;t.dataset.runtimePlatform=e.platform,t.dataset.osFamily=e.ui.osFamily,t.dataset.windowControls=e.ui.windowControlsStyle,t.dataset.viewportClass=e.viewportClass,t.dataset.overlayTitlebar=String(e.ui.prefersOverlayTitlebar),r&&(r.dataset.runtimePlatform=e.platform,r.dataset.osFamily=e.ui.osFamily,r.dataset.windowControls=e.ui.windowControlsStyle,r.dataset.viewportClass=e.viewportClass,r.dataset.overlayTitlebar=String(e.ui.prefersOverlayTitlebar))}function Xg(){var e;if(!(typeof document>"u"))for(const t of Q1)document.documentElement.style.removeProperty(t),(e=document.body)==null||e.style.removeProperty(t)}function Z1(e){if(typeof document>"u")return;if(!e){Xg();return}const t=[document.documentElement,document.body].filter(s=>!!s),r=[["--desktop-macos-traffic-light-center-y",`${e.trafficLightCenterY}px`],["--desktop-macos-traffic-light-leading-inset",`${e.trafficLightLeadingInset}px`],["--desktop-macos-traffic-light-safe-zone-width",`${e.trafficLightSafeZoneWidth}px`],["--desktop-macos-titlebar-height",`${e.titlebarHeight}px`],["--desktop-macos-traffic-light-button-diameter",`${e.trafficLightButtonDiameter}px`]];for(const s of t)for(const[i,l]of r)s.style.setProperty(i,l)}function eL(){if(!(typeof window>"u"))return window.innerWidth}function tL({children:e}){const[t,r]=p.useState(()=>eL()),s=p.useMemo(()=>Gs({viewportWidth:t}),[t]);return p.useEffect(()=>{if(typeof window>"u")return;function i(){r(window.innerWidth)}return i(),window.addEventListener("resize",i),()=>{window.removeEventListener("resize",i)}},[]),p.useEffect(()=>{J1(s)},[s]),p.useEffect(()=>()=>{Xg()},[]),p.useEffect(()=>{let i=!1,l=null;return!s.isDesktop||!s.bridge.supported?()=>{i=!0}:(_l(()=>Promise.resolve().then(()=>EF),void 0).then(async({listen:c})=>{const d=await c(X1,m=>{const f=m.payload,v=f==null?void 0:f.descriptor;v!=null&&v.windowId&&(s.windows.registerDescriptor(v),f.isOpen?s.windows.markWindowOpen(v.windowId):s.windows.markWindowClosed(v.windowId))});if(i){d();return}l=d}).catch(()=>{}),()=>{i=!0,l==null||l()})},[s]),p.useEffect(()=>{let i=!1,l=null;async function c(){var m,f;const d=await s.bridge.getRuntimeInfo();i||Z1(d.ok?(f=(m=d.value)==null?void 0:m.windowChrome)==null?void 0:f.macosTitlebar:null)}return!s.isDesktop||s.ui.osFamily!=="macos"||!s.ui.prefersOverlayTitlebar?(Xg(),()=>{i=!0}):(c(),_l(()=>Promise.resolve().then(()=>WF),void 0).then(async({getCurrentWindow:d})=>{const m=await d().onScaleChanged(()=>{c()});if(i){m();return}l=m}).catch(()=>{}),()=>{i=!0,l==null||l()})},[s]),n.jsx(jN.Provider,{value:s,children:e})}function sr(){return p.useContext(jN)??Gs()}const nL={common:{appName:"CodingNS",loading:"Loading...",retry:"Retry",back:"Back",save:"Save",logout:"Log out",unknown:"Unknown session",close:"Close",cancel:"Cancel",language:"Language"},auth:{loginTitle:"Resume your coding session",loginSubtitle:"INITIALIZING DEVELOPMENT ENVIRONMENT...",serverPreset:"Server Preset",serverCustomOption:"Use custom server",serverAddress:"Server Address",serverPlaceholder:"For example: http://127.0.0.1:3002",serverHint:"Login, realtime messages, and terminals all connect through this host. Point the client at the Host API endpoint such as http://127.0.0.1:3002; frontend dev ports like 4174 or 5173 are not meant for packaged clients and only work for temporary debugging when proxying and CORS are configured correctly.",serverInvalid:"Invalid server address. Check it and try again.",serverCurrent:"Current Server",bootstrapTitle:"Complete the first-time bootstrap",bootstrapSubtitle:"This Host does not have an admin account yet. Create the minimal login entry first.",username:"Username",password:"Password",rememberPassword:"Remember Password",confirmPassword:"Confirm Password",submitLogin:"Enter Workspace",submitBootstrap:"Create Admin Account",bootstrapSuccess:"Bootstrap completed. You can log in now.",bootstrapMismatch:"The two passwords do not match.",authUnavailable:"Host is unreachable right now. Check the server and try again.",logoutSuccess:"The current login state has been cleared.",demoBanner:"Demo environment — all account data is public and cleared on logout",demoSessionExpired:"Demo session expired. Please log in again.",captcha:"Captcha",captchaPlaceholder:"Enter the characters in the image",captchaHint:"After three failed attempts, complete the captcha before trying again.",captchaImageAlt:"Login captcha image",serverSettings:"Server Settings",serverSettingsTitle:"Server Configuration",saveServerSettings:"Save Settings"},settings:{title:"Settings",appearance:"Appearance",appearanceSectionSummary:"Language, theme, and interface colors",language:"Language",languageDescription:"Choose the display language used by the interface.",theme:"Theme",themeDescription:"Choose the color theme that fits the way you work.",autoTheme:"Follow system theme automatically",autoThemeDescription:"When enabled, switch between day and night mode based on the system or browser color scheme.",fileManager:"File Manager",workspaceSessionSortMode:"Workspace session sort order",workspaceSessionSortModeDescription:"Controls the default sort order for session lists across the workspace. This setting only applies to the current device.",sessionSortModeCreatedAt:"By session created time",sessionSortModeUpdatedAt:"By session updated time",sessionSortModeTitle:"By session name",showSystemFiles:"Show system files",showSystemFilesDescription:"Display common macOS and Windows system files in the file manager, such as .DS_Store and Thumbs.db. This setting only applies to the current device.",serverConnection:"Server Connection",serverConnectionSectionSummary:"Server address and reconnection behavior",remoteAccess:"Remote Access",remoteAccessSectionSummary:"Check status and manage Tailscale remote access.",modelManagement:"Model Management",modelManagementSectionSummary:"Read cc-switch presets and quickly switch models for Codex, Claude Code, Gemini, and OpenCode.",modelManagementNavValue:"Quick switch",modelManagementTitle:"Quick Model Switching",modelManagementDescription:"This page does not add or edit presets. It only exposes the presets already managed by cc-switch so you can switch quickly.",modelManagementRefresh:"Refresh Models",modelManagementRefreshSuccess:"Model presets refreshed.",modelManagementLoadFailed:"Failed to load model presets.",modelManagementScannedAt:"Last Scanned",modelManagementScannedAtUnknown:"Not scanned yet",modelManagementCurrentProfile:"Current Profile",modelManagementCurrentModel:"Current Model",modelManagementCurrentPreset:"Current Preset",modelManagementModelUnknown:"Unknown",modelManagementPresetMissing:"Not set",modelManagementCurrentTag:"Current",modelManagementOpenSwitcher:"Switch Profile",modelManagementModalTitle:"Provider Profile Switching",modelManagementModalDescription:"Review the existing cc-switch profiles by app and switch the active one here.",modelManagementTabsLabel:"Model app tabs",modelManagementSwitchAction:"Switch",modelManagementSwitchSuccess:"{app} switched to {preset}.",modelManagementOptionsEmpty:"No switchable presets were found.",modelManagementStatusReady:"Ready",modelManagementStatusUnconfigured:"Unconfigured",modelManagementStatusUnavailable:"cc-switch-cli missing",modelManagementStatusError:"Read failed",skills:"Skills",skillsSectionSummary:"Read and sync the local skills owned by each CLI. No marketplace and no remote catalog in this phase.",skillsNavValue:"Local sync",skillManagerTitle:"Local Skill Management",skillManagerDescription:"Read the local skill folders used by Codex, Claude Code, Gemini, and OpenCode, then import unmanaged entries or sync them again.",skillSummaryManagedSkills:"Managed skills",skillSummaryManagedEntries:"Managed folders",skillSummaryUnmanagedEntries:"Unmanaged folders",skillSummaryConflictedEntries:"Conflicts",skillSummaryDiagnostics:"Diagnostics",skillManageAction:"Configure Skills",skillConfigModalTitle:"Skill Configuration",skillConfigModalDescription:"Review managed, unmanaged, conflicted, and diagnostic results here, then import or sync as needed.",skillRefresh:"Refresh Overview",skillRefreshSuccess:"Skill overview refreshed.",skillScannedAt:"Last Scanned",skillManagedListTitle:"Managed Skills",skillManagedEmpty:"There are no managed skills yet.",skillUnmanagedListTitle:"Unmanaged Skills",skillUnmanagedEmpty:"No unmanaged skills were found.",skillConflictedListTitle:"Conflicts",skillConflictedEmpty:"No conflicted entries were found.",skillDiagnosticsTitle:"Diagnostics",skillDiagnosticsEmpty:"No extra diagnostics right now.",skillDirectoryName:"Directory Name",skillSsotPath:"SSOT Path",skillSourceCli:"Source CLI",skillDirectoryPath:"Directory Path",skillImportAction:"Import & Manage",skillImportSuccess:"{name} was imported and is now managed from {target}.",skillSyncAction:"Sync Again",skillSyncSuccess:"{name} was synced again.",skillSyncTargetMissing:"This skill is not bound to any target CLI yet, so it cannot be synced again.",skillLoadFailed:"Failed to load the skill overview.",skillTargetCodex:"Codex",skillTargetClaudeCode:"Claude Code",skillTargetGemini:"Gemini",skillTargetOpenCode:"OpenCode",skillBindingPending:"Pending",skillBindingSynced:"Synced",skillBindingFailed:"Failed",skillBindingConflicted:"Conflicted",securityPrivacy:"Security & Privacy",securityPrivacySectionSummary:"Session permissions, risk boundaries, and default approval policy",softwareUpdate:"Software Update",softwareUpdateSectionSummary:"Server and client versions",serverAddress:"Server Address",serverDescription:"Login, API requests, and realtime connections all use this Host entry, while the frontend UI is bundled inside the client itself.",tailscaleBrand:"Tailscale",tailscaleSectionTitle:"Tailscale Access",tailscaleSectionDescription:"Let this Host stay reachable across your devices with Tailscale.",tailscaleCurrentState:"Current State",tailscaleSwitchLabel:"Enabled",tailscaleStatusIndicator:"Status",tailscaleServerAddress:"Server Address",tailscaleAccountName:"Account",tailscaleIpAddress:"IP Address",tailscaleConfigure:"Configure",tailscaleConfigModalTitle:"Configure Tailscale",tailscaleConfigModalDescription:"Edit connectivity settings",tailscaleControlServer:"Control Server",tailscaleControlServerDescription:"Leave empty to use the default control server.",tailscaleControlServerPlaceholder:"Leave empty to use the default control server",tailscaleHostname:"Hostname",tailscaleHostnameDescription:"Optional.",tailscaleHostnamePlaceholder:"For example: codingns-host",tailscaleReachableBaseUrl:"Reachable Base URL",tailscaleTailnetFqdn:"Tailnet FQDN",tailscaleTailnetIpv4:"Tailnet IPv4",tailscaleTailnetIpv6:"Tailnet IPv6",tailscaleDetailAddresses:"Detailed Addresses",tailscaleRefresh:"Refresh",tailscaleInstallAction:"Install Tailscale",tailscaleInstallOpenFailed:"Failed to open the Tailscale install page.",tailscaleEnable:"Enable Tailscale",tailscaleDisable:"Disable Tailscale",tailscaleLogin:"Bind Account",tailscaleLogout:"Unbind Account",tailscaleUnavailable:"Unavailable",tailscaleLoadFailed:"Failed to load Tailscale status.",tailscalePhaseDisabled:"Disabled",tailscalePhaseBlockedUninitialized:"Blocked until bootstrap finishes",tailscalePhaseStarting:"Starting",tailscalePhaseNeedsLogin:"Waiting for login",tailscalePhaseRunning:"Running",tailscalePhaseStopping:"Stopping",tailscalePhaseError:"Error",tailscaleOverviewDisabled:"Remote access is not enabled yet.",tailscaleOverviewBlockedUninitialized:"Finish bootstrap before enabling remote access.",tailscaleOverviewStarting:"Connecting to Tailscale. Please wait.",tailscaleOverviewNeedsLogin:"Tailscale is enabled, but account binding is still required.",tailscaleOverviewRunning:"This instance is reachable through Tailscale now.",tailscaleOverviewStopping:"Remote access is being turned off.",tailscaleOverviewError:"Remote access hit an error. Refresh or reconfigure it first.",releaseChannel:"Release Channel",releaseChannelDescription:"Stable or beta",releaseStable:"Stable",releaseBeta:"Beta",autoReconnect:"Auto Reconnect",autoReconnectDescription:"Retry HTTP and WebSocket links automatically when Host is briefly unavailable.",autoCheckUpdate:"Auto Check Client Updates",autoCheckUpdateDescription:"Clients only",defaultPermissionMode:"Default Session Permissions",defaultPermissionModeDescription:"Controls the default tool permissions for new and resumed sessions. Full access disables approval prompts and should only be used for trusted projects and environments.",permissionModeDefault:"Follow CLI defaults",permissionModeAcceptEdits:"Allow workspace edits without asking",permissionModeBypassPermissions:"Full access without asking",enabled:"Enabled",disabled:"Disabled",serverUpdate:"Server Update",serverUpdateDescription:"",clientUpdate:"Client Update",clientUpdateDescription:"",serverCurrentVersion:"Server Current Version",serverTargetVersion:"Server Target Version",serverPackageName:"npm Package",serverUpdateCommand:"Upgrade Command",serverCheckNow:"Check Server",serverOpenPage:"Open npm",serverLatestUnknown:"Unavailable",serverUpdateReady:"New version found",serverUpToDate:"Up to date",serverCheckFailed:"Check failed",serverOpenPageFailed:"Failed to open page",releaseCurrentVersion:"Current Version",releaseTargetVersion:"Target Version",releaseTargetTag:"Target Tag",releasePublishedAt:"Published At",releaseUnknownVersion:"Unknown",releaseNotes:"What's New",releaseNotesEmpty:"No details",releaseCheckNow:"Check Client",releaseInstallNow:"Install",releaseOpenPage:"Open Release",releaseRollback:"Rollback",releaseUpdateBadge:"Update",releaseUpdateReady:"New version found",releaseUpToDate:"Up to date",releaseCheckFailed:"Check failed",releaseInstallerMissing:"A new version is available, but this release does not include a supported installer yet.",releaseSignatureMissing:"A new version is available, but this release does not provide checksum information yet.",releaseInstallStarted:"Install started",releaseInstallFailed:"Install failed",releasePageOpenFailed:"Failed to open page",androidInstallerStarted:"Handed off to the Android installer. You can still cancel there.",androidInstallPermissionRequired:"Allow installs from this source before retrying.",androidInstallCancelled:"Install was cancelled or not completed. You can try again.",androidInstallSucceeded:"The new version has been detected as installed.",releaseRollbackStarted:"Rollback started",releaseRollbackFailed:"Rollback failed",clientUpdateUnsupported:"Install updates are not supported here",logout:"Log out"},home:{title:"Continue from a session, not from a backend table",subtitle:"Pick a workspace and session here first. The real work starts in the next step.",terminalsEntry:"Open Terminal",workspaceSection:"Workspaces",sessionSection:"Recent Sessions",emptyWorkspaces:"No workspace has been imported yet. Import one on the Host side first, and the entry will appear here.",emptySessions:"There is no session to continue in the current workspace yet.",noActivity:"No activity yet"},terminal:{title:"Terminal",heroTitle:"Keep the real PTY on Host, keep the control surface in the workspace",heroSubtitle:"This page does not fake output and does not mix terminal with process management. It only consumes the real terminal stream managed by Host.",workspaceSection:"Workspace & Terminal",workspaceField:"Current Workspace",shellField:"Shell for New Terminal",runtimeField:"Runtime",runtimeAutoOption:"Auto",runtimeAutoShortLabel:"auto",runtimeAutoDescription:"Use the Host default policy for this terminal runtime.",runtimePersistentLabel:"Persistent Session",runtimePersistentShortLabel:"persist",runtimeTmuxDescription:"Use a persistent external session, ideal for development terminals that should stay alive.",runtimeWindowsPersistentDescription:"Use a Windows persistent session backed by ConPTY so the shell can survive Host restarts.",runtimeEmbeddedDescription:"Managed directly by the current Host and useful as the lightweight fallback.",runtimeConptyPowerShellLabel:"PowerShell Persistent",runtimeConptyCmdLabel:"CMD Persistent",runtimeConptyGitBashLabel:"Git Bash Persistent",runtimeMissingDialogTitle:"tmux is not installed on this system",runtimeMissingDialogDescription:"The tmux runtime cannot create a persistent terminal right now. Install tmux first, or temporarily switch to embedded-pty to continue.",runtimeMissingInstallDescription:"Installing tmux is recommended if you want terminals to survive Host restarts.",runtimeMissingInstallMacArm:"macOS (Apple Silicon / Homebrew): arch -arm64 brew install tmux",runtimeMissingInstallMacIntel:"macOS (Intel Mac / Homebrew): brew install tmux",runtimeMissingInstallDebian:"Ubuntu / Debian: sudo apt install tmux",runtimeMissingInstallFedora:"Fedora: sudo dnf install tmux",runtimeMissingFallbackDescription:"If you switch to embedded-pty now, the terminal can still start, but it will not stay as an external persistent session.",runtimeMissingKeepAction:"Not now",runtimeMissingFallbackAction:"Switch to embedded-pty",runtimeMissingFallbackPending:"Switching...",shellUnavailable:"Unavailable",workspaceLoadFailed:"The workspace or terminal list is not available right now.",terminalSection:"Terminal Instances",templateSection:"Command Templates",stageEmptyTitle:"No terminal selected yet",stageEmptySubtitle:"Create a terminal first, or run a command template.",emptyTerminals:"There is no terminal instance in the current workspace yet.",emptyTemplates:"There is no command template in the current workspace yet.",createButton:"Create Terminal",creating:"Creating terminal...",creationPendingDescription:"Host is starting the real PTY. This pane will take over as soon as the stream is ready.",defaultTerminalName:"Workspace Terminal",created:"The terminal has been created and connected to Host.",createFailed:"Failed to create terminal.",closeButton:"Close Terminal",closing:"Closing terminal...",closed:"The terminal close request has been submitted.",closeCompleted:"Terminal closed.",closePendingDescription:"The close request has been sent to Host. The page stays responsive and keeps syncing the final result in the background.",closeSyncDelayed:"Host is still finishing the close in the background. The list will keep syncing on the next refresh.",closeFailed:"Failed to close terminal.",inputLabel:"Send command to current terminal",inputPlaceholder:"For example: npm test",sendButton:"Send to Terminal",inputFailed:"Failed to send terminal input.",outputEmpty:"The terminal is connected, but there is no output yet.",outputTruncated:"Some output exceeded the cache window while disconnected. Only the retained part has been restored.",connectedHint:"Current output is coming from the real PTY stream on Host.",moreActions:"Terminal Actions",duplicateAction:"Duplicate Tab",duplicateSuccess:"A new terminal tab has been created with the same setup.",duplicateFailed:"Failed to duplicate the terminal tab.",disconnectAction:"Disconnect",disconnected:"Terminal connection has been disconnected.",reconnectAction:"Reconnect",reconnectRequested:"Reconnect request sent.",deleteAction:"Delete",deleting:"Deleting terminal...",deleted:"Terminal record deleted.",deletePendingDescription:"The delete request has been sent to Host. The page stays responsive and keeps syncing the list in the background.",deleteSyncDelayed:"Host is still finishing the delete in the background. The list will keep syncing on the next refresh.",deleteFailed:"Failed to delete the terminal record.",closePendingBadge:"Closing",deletePendingBadge:"Deleting",pinAction:"Pin",unpinAction:"Unpin",zoomLabel:"Terminal Zoom",zoomInAction:"Zoom in terminal display",zoomOutAction:"Zoom out terminal display",zoomResetAction:"Reset terminal zoom",toolbarToggleAction:"Open terminal toolbar",mobileSwipeHint:"Swipe left or right to switch terminals",mobileSwipePosition:"{current} / {total}",mobileDrawerAction:"Open quick terminal list",mobileDrawerTitle:"Quick Terminals",mobileDrawerDescription:"Swipe right to reveal the list, then tap to jump to another terminal.",mobilePinnedSectionTitle:"Pinned Terminals",mobileDrawerEmptyTitle:"No terminals yet",mobileDrawerEmptyDescription:"Create one first and the quick switcher will appear here.",mobileCreateSheetTitle:"Create Terminal",mobileCreateShellLabel:"Terminal Type",mobileCreateShellDescription:"Pick the shell for this terminal instead of squeezing desktop dropdowns onto mobile.",mobileCreateRuntimeLabel:"Session Type",mobileCreateRuntimeDescription:"Choose whether this terminal should stay persistent or only live in the current runtime.",mobileCreateLoadingShells:"Loading available terminal types for this system...",mobileCreateConfirm:"Create this terminal",createDialogTitle:"Create Terminal",createDialogShellDescription:"Choose the shell for this terminal before creation. On Windows we should not silently fall back to CMD anymore.",createDialogRuntimeDescription:"Choose whether this terminal should stay persistent or only live in the current runtime.",createDialogConfirm:"Create Terminal",mobileRuntimePersistentTitle:"Persistent Session",mobileRuntimePersistentDescription:"Best for development terminals that should stay alive and reconnect as a recoverable session.",mobileRuntimeSessionTitle:"runtime (current session)",mobileRuntimeSessionDescription:"Managed directly by the current Host. Lighter, but not an external persistent session.",mobileWorkspaceSwitcherPlaceholder:"Choose Workspace",mobileEmptyTitle:"No terminal content yet",mobileEmptyDescription:"Create a terminal first, or swipe right to open the quick list and switch to an existing one.",layoutLabel:"Layout",layoutSingleAction:"Single pane",layoutVerticalAction:"Split left and right",layoutHorizontalAction:"Split top and bottom",saveLogAction:"Save Log",saveLogSuccess:"The terminal log has been saved.",saveLogFailed:"Failed to save the terminal log.",logEmpty:"There is no terminal log to save yet.",bindToPaneAction:"Bind to current pane",bindToPrimaryPaneAction:"Bind to main pane",bindToSecondaryPaneAction:"Bind to side pane",panePrimary:"Main Pane",paneSecondary:"Side Pane",splitEmptySubtitle:"Pick a tab or create a terminal first, then bind it to this pane.",statusBadge:{creating:"starting",running:"running",closed:"closed",error:"error"},recoveryComplete:"Recovered to the terminal from before refresh. Key cached output has been restored.",recoveryTruncated:"Recovered to the previous terminal, but some disconnected output exceeded the cache window.",recoveryIdleClosed:"The previous terminal was auto-closed by Host after being idle too long. You are seeing the output kept before close.",reconnect:"Reconnect",liveConnected:"Live stream connected",templateName:"Template Name",templateCommand:"Main Command",templateArgs:"Arguments (space separated)",templateCreateButton:"Save Template",templateCreated:"The command template has been saved.",templateCreateFailed:"Failed to save the command template.",templateRunSent:"The command template has been sent to the current terminal.",templateRunCreatedTerminal:"The command template started in a new terminal.",templateRunFailed:"Failed to run the command template.",connection:{connected:"Connected",reconnecting:"Reconnecting",reconnect_failed:"Reconnect failed",closed:"Closed"}},conversation:{titleFallback:"Continue Conversation",historyLoading:"Loading message history from Host...",historyLoadingOlder:"Loading older messages...",historyLoadFailed:"Message history is not available right now. Try again later.",timelineEmpty:"There are no messages in this session yet. Your first message will go straight into the Host chain.",turnAbortedUser:"The previous turn was stopped by you.",turnAbortedUnexpected:"The previous turn was interrupted unexpectedly and did not finish cleanly.",turnAbortedGeneric:"The previous turn was interrupted before it finished cleanly.",scrollToBottomAction:"Jump to bottom",rawRefLabel:"Source",copyAction:"Copy",copyContentSuccess:"Content copied.",copyContentFailed:"Failed to copy the content.",selectionTodoAction:"Todo",selectionActionButton:"Action",selectionActionSubmit:"Open action child session",selectionActionPromptLabel:"What should it do",selectionActionPromptPlaceholder:"For example: explain this, turn it into notes, or send it to a specific API",selectionActionIncludeContext:"Include current context",selectionActionContextUnavailable:"This selection spans multiple messages, so context inheritance is disabled for safety.",selectionActionDefaultPrompt:"Please process this content.",selectionActionQuotedLabel:"Selected text",selectionActionFailed:"Failed to create the action child session.",actionSessionBadge:"Action",actionInheritedSelectionSummary:'Collapsed the selected text from "{parentTitle}" by default.',forkFromHereAction:"Fork from here",forkingAction:"Forking...",forkMessageSucceeded:"Created a new branch from this message.",forkMessageFailed:"Failed to fork from this message.",forkDraftLabel:"Fork Quote",forkDraftEmpty:"This message does not contain text to quote.",forkDraftClear:"Cancel this fork quote",forkTargetProviderLabel:"Target CLI",forkTargetModelLabel:"Target Model",forkTargetSummary:"Source CLI: {sourceProvider} · Target CLI: {targetProvider}",forkInlineModelLoading:"Loading model options...",forkInlineNativeHint:"Stay on the same CLI and use native fork.",forkInlineCrossHint:"Switched to another CLI. The child session will be reconstructed from text history.",forkSwitchConfirmTitle:"Switch to another CLI?",forkSwitchConfirmDescription:"Using the same CLI keeps the native fork experience. Switching CLI changes this into a cross-provider fork.",forkSwitchConfirmKeepTitle:"Will keep",forkSwitchConfirmKeepBody:"User messages and assistant text before the fork point.",forkSwitchConfirmConvertTitle:"Will convert",forkSwitchConfirmConvertBody:"Reusable text history will be rebuilt into the new CLI session.",forkSwitchConfirmDropTitle:"Will lose",forkSwitchConfirmDropBody:"Tool calls, permission prompts, attachments, and running state.",forkSwitchConfirmAction:"Confirm switch",forkSwitchKeepNative:"Keep native",forkProviderNativeUnsupported:"This provider does not support native fork yet",forkProviderReconstructedUnsupported:"This provider cannot be used as a cross-provider fork target yet",loadMore:"Load More",composerPlaceholder:"State the next step clearly. Let the rest continue inside this session.",sendButton:"Send Message",queueTitle:"Queued Messages",queueDescription:"After the current run finishes, these messages will be processed automatically in order.",queueOrderPrefix:"Queue Position",queueStatusQueued:"Queued",queueStatusFailed:"Dispatch Failed",queueDelete:"Delete",queueDeleting:"Deleting",queueImageOnly:"Image attachments only",sendGuidanceButton:"Add Guidance",queueGuidanceButton:"Queue Guidance",queueSteer:"Steer",queueSteering:"Steering",resendButton:"Resend",quickPhraseTrigger:"Quick Phrases",quickPhraseModalTitle:"Quick Phrases",quickPhraseModalDescription:"Keep the prompts you reuse often in one place and drop them straight into the current composer.",quickPhraseCreateLabel:"New Phrase",quickPhraseOpenCreateAction:"Add Phrase",quickPhraseCreateModalTitle:"Create Quick Phrase",quickPhraseCreateModalDescription:"Save a reusable prompt on its own so it is ready across devices whenever you need it.",quickPhraseCreatePlaceholder:"Write a phrase you want to reuse later.",quickPhraseCreateAction:"Add Phrase",quickPhraseListLabel:"Quick phrase list",quickPhraseEmpty:"There are no quick phrases yet. Add the first one you actually reuse.",quickPhraseOrderLabel:"Item {index}",quickPhraseMoveUp:"Move phrase up",quickPhraseMoveDown:"Move phrase down",quickPhraseDelete:"Delete phrase",quickPhraseSaveFailed:"Failed to save quick phrases. Try again later.",sendingState:"Sending",sentState:"Synced",failedState:"Send failed",contextUsageTitle:"Context Usage",contextUsageUnavailable:"Context usage is not available yet",contextUsageEstimated:"Window is estimated",contextUsageCachedTokens:"{count} cached",contextUsageSourceProviderLog:"window from provider log",contextUsageSourceProviderRuntime:"window from provider runtime",contextUsageSourceProviderConfig:"window from provider config",contextUsageSourceModelMap:"window from model map",headerWorkspace:"Workspace",headerProvider:"Provider",headerCapability:"Capability Summary",connectionConnected:"Connected",connectionReconnecting:"Reconnecting",connectionReconnectFailed:"Reconnect failed",connectionClosed:"Connection closed",runtimeErrorTitle:"Session run failed",permissionRequestSectionTitle:"Pending approvals",permissionRequestSectionDescription:"Provider-side approvals are unified here so you do not need to learn three different dialogs.",permissionRequestToastTitle:"Approval needed",permissionRequestReplyFailed:"Failed to reply to the approval request.",permissionRequestSubmitting:"Submitting...",permissionRequestReasonLabel:"Reason",permissionRequestCommandLabel:"Command",permissionRequestToolLabel:"Tool",permissionRequestCwdLabel:"Working directory",permissionRequestPathsLabel:"Related paths",permissionRequestPermissionsLabel:"Requested permissions",permissionRequestReadLabel:"Read",permissionRequestWriteLabel:"Write",permissionRequestNetworkLabel:"Network",permissionRequestQuestionsLabel:"Questions",permissionRequestDetailLabel:"Details",permissionRequestEmpty:"None",permissionRequestUnknown:"Unknown",permissionRequestKindCommand:"Command",permissionRequestKindFileChange:"File Change",permissionRequestKindPermissions:"Permissions",permissionRequestKindUserInput:"User Input",permissionRequestKindToolCall:"Tool Call",reconnectExplain:"The realtime link is broken. The system is replaying missing messages.",reconnectFailedExplain:"Automatic recovery failed. Retry manually, or reopen the session later.",capabilityDenied:"This action is not supported in the current session.",capabilitySendDisabled:"The current provider does not support sending new messages.",capabilityAttachmentDisabled:"This session does not support attachment input yet.",capabilityInterruptDisabled:"This session does not support interruption.",sidebarTitle:"Current Session Context",sidebarSubtitle:"This sidebar only keeps the minimum capability summary. It does not turn the page into an admin console.",reconnectButton:"Restore Realtime Sync",headerResumedAt:"Last Resumed",headerLastSyncAt:"Last Synced",historyPages:"History Pages",syncStatusIdle:"Sync Idle",syncStatusSyncing:"Syncing",syncStatusError:"Sync Error",capabilityResume:"Resumable",capabilitySend:"Send Enabled",capabilityInterrupt:"Interrupt Enabled",capabilityTools:"Tool Calls",attachmentsLabel:"Attachments",filePanelTitle:"File Manager",filePanelSubtitle:"File capabilities here only serve the current session. This is not a heavy IDE shell.",filePanelNoWorkspace:"There is no selected workspace yet. Browsing or attaching files is unavailable.",filePanelRefresh:"Refresh",filePanelCopyPath:"Copy Path",filePanelCopyAbsolutePath:"Copy Absolute Path",filePanelCopyRelativePath:"Copy Relative Path",filePanelCopyAbsolutePathSuccess:"Absolute path copied.",filePanelCopyRelativePathSuccess:"Relative path copied.",filePanelCopyPathFailed:"Failed to copy the path.",filePanelCopy:"Copy",filePanelCut:"Cut",filePanelPaste:"Paste",filePanelCopySelectionSuccess:"{count} item(s) copied. Paste them into a target folder.",filePanelCutSelectionSuccess:"{count} item(s) cut. Paste them into a target folder.",filePanelPasteSuccess:"{count} item(s) pasted.",filePanelPasteFailed:"Paste failed. Check the target folder and name conflicts.",filePanelSelectionCount:"{count} item(s) selected",filePanelClipboardCopyReady:"{count} item(s) ready to copy",filePanelClipboardCutReady:"{count} item(s) ready to move",filePanelOpenFile:"Open File",filePanelExpandDirectory:"Expand Folder",filePanelCollapseDirectory:"Collapse Folder",filePanelActionsMenu:"File Actions",filePanelSearchPlaceholder:"Enter a file name or path fragment",filePanelSearchButton:"Search",filePanelShowSearch:"Open Search",filePanelHideSearch:"Hide Search",filePanelSearchEmpty:"No matching files found.",filePanelSearchResults:"Search Results",filePanelSearchFailed:"File search failed. Try again later.",filePanelBrowse:"Workspace Files",filePanelCollapseCurrent:"Collapse Current",filePanelCollapseAll:"Collapse All",filePanelBackDirectory:"Go to Parent",filePanelEmptyDirectory:"There are no files to show in this directory.",filePanelRecentTitle:"Recently Opened",filePanelEmptyRecent:"There is no recently opened file yet.",filePanelContextTitle:"Attached Files",filePanelEmptyContexts:"No file is attached to the current session yet.",filePanelEditorTitle:"Preview & Editor",filePanelEditorPlaceholder:"This is a lightweight text editor, not a full IDE.",filePanelSelectHint:"Pick a file first from browse, search, or recent items.",filePanelUnsupported:"This file cannot be edited directly in the sidebar right now.",filePanelAttach:"Attach to Session",filePanelAttached:"Attached",filePanelDetach:"Detach",filePanelSave:"Save",filePanelSaving:"Saving...",filePanelLoadFailed:"Failed to load the file panel.",filePanelOpenFailed:"Failed to open the file.",filePanelSaveSuccess:"File saved.",filePanelSaveFailed:"Failed to save the file.",fileViewerHint:"Opened in {language} mode. Preview and save after editing are supported.",fileViewerModeLabel:"File View Mode",fileViewerPreview:"Preview",fileViewerCode:"Code",fileViewerEdit:"Edit",fileViewerPlainText:"Plain Text",fileViewerImage:"Image",fileViewerPdf:"PDF",fileViewerRefreshPreview:"Refresh",fileViewerRefreshFailed:"Failed to refresh the file preview.",fileViewerOpenExternal:"Open Externally",fileViewerOpenExternalFailed:"Failed to open the file externally.",fileViewerZoomIn:"Zoom In",fileViewerZoomOut:"Zoom Out",fileViewerFit:"Fit",fileViewerActualSize:"Actual Size",fileViewerFitWidth:"Fit Width",fileViewerPreviousPage:"Previous Page",fileViewerNextPage:"Next Page",fileViewerPageIndicator:"Page {page}",fileViewerSizeLabel:"Viewer Size",fileViewerSizeDefault:"Default",fileViewerSizeWide:"Wide",fileViewerSizeFull:"Full",fileViewerImageUnavailable:"The image preview is unavailable right now. Try refreshing or opening it externally.",fileViewerPdfUnavailable:"The PDF preview is unavailable right now. Try refreshing or opening it externally.",fileViewerEnterFullscreen:"Full Screen",fileViewerExitFullscreen:"Exit",fileViewerOpenInBrowser:"Open in Browser",fileViewerOpenInBrowserFailed:"Failed to open the browser preview.",fileViewerHtmlPreviewLoading:"Loading the HTML preview...",fileViewerHtmlPreviewUnavailable:"The HTML preview is unavailable right now. Switch to code view instead.",fileViewerHtmlPreviewFailed:"Failed to create the HTML preview link.",filePanelAttachSuccess:"The file has been attached to the current session.",filePanelAttachFailed:"Failed to attach the file.",filePanelDetachSuccess:"The file has been detached from the current session.",filePanelDetachFailed:"Failed to detach the file.",filePanelNewFile:"New File",filePanelNewDirectory:"New Directory",filePanelUpload:"Upload File",filePanelDownload:"Download File",filePanelUploadSuccess:"{name} uploaded.",filePanelUploadFailed:"Failed to upload the file.",filePanelDownloadSuccess:"Started downloading {name}.",filePanelDownloadFailed:"Failed to download the file.",filePanelDelete:"Delete",filePanelDeleting:"Deleting...",filePanelDeleteSuccess:"Deleted {name}.",filePanelDeleteConfirmTitle:"Confirm Deletion",filePanelDeleteConfirmDescription:"The selected item will be removed from this workspace immediately and cannot be undone.",filePanelDeleteSelectionConfirm:"Delete the selected {count} items?",filePanelDeleteSelectionSuccess:"Deleted {count} items.",filePanelRenameMove:"Rename / Move",filePanelMutateFailed:"File operation failed. Check the path and current state.",filePanelCreateFilePrompt:"Enter the relative path of the file to create",filePanelCreateDirectoryPrompt:"Enter the relative path of the directory to create",filePanelFilterChanges:"Changes Only",filePanelShowAll:"Show All",filePanelNoChanges:"No changed files.",filePanelBinaryPreview:"Binary files cannot be previewed.",filePanelDeleteFileConfirm:"Delete this file? {path}",filePanelDeleteDirectoryConfirm:"Delete this folder? {path}",filePanelRenameMovePrompt:"Enter the new relative path",unavailableAction:"Unavailable",roleUser:"User",roleAssistant:"Assistant",roleTool:"Tool",roleSystem:"System"},git:{title:"Git Context",subtitle:"This is the session-side support area. It only handles Git facts inside the current workspace.",loading:"Loading Git context for the current workspace...",refresh:"Refresh",panelLoadFailed:"Git context is not available right now.",ahead:"Ahead",behind:"Behind",dirty:"Dirty",clean:"Clean",changeCount:"{count} changed files in the current workspace",noChanges:"There are no pending changes right now.",changesTitle:"Current Changes",rulesFirstHint:"Rules come first. Drafts must not bypass validation.",stage:"Stage",unstage:"Unstage",preview:"Preview",stageFailed:"Stage operation failed.",diffTitle:"Diff Preview",diffLoadFailed:"Diff content is not available right now.",binaryDiff:"This file is a binary change. The sidebar does not render its content directly.",stagedDiff:"Staged diff",worktreeDiff:"Working tree diff",emptyDiff:"There is no text diff to display right now.",diffTruncated:"The diff is too long and has been truncated for safety.",commitTitle:"Commit Draft",defaultRuleName:"Default Commit Rule",language:"Language",maxLength:"Max Length",bodyRequired:"Body Required",bodyOptional:"Body Optional",issueRequired:"Issue Required",issueOptional:"Issue Optional",commitSubject:"Commit Subject",commitSubjectPlaceholder:"Enter the commit message here",commitBody:"Commit Body",commitBodyPlaceholder:"Explain the change clearly. Do not write empty words.",commitFooter:"Commit Footer",commitFooterPlaceholder:"For example: Refs: #123",generateDraft:"AI Draft",validate:"Validate Draft",commit:"Commit",draftFailed:"Failed to generate the commit draft.",validateFailed:"Commit rule validation failed.",commitFailed:"Commit failed.",commitSuccess:"The commit has been written to the current repository.",validationPassed:"Rule validation passed. You can continue to commit.",validationFailed:"Rule validation failed. Fix the issues below first.",branchTitle:"Branch",branchPlaceholder:"Enter the branch name to switch to or create",switchBranch:"Switch",createBranch:"Create",branchFailed:"Branch operation failed.",historyTitle:"Recent History",historyHint:"Only keep the latest few entries here. This is not a graphical history tree.",noHistory:"There is no commit history to show right now.",viewAllVersions:"View All Versions",viewAllVersionsDescription:"Loaded commit history for the current repository. Total entries: {count}.",viewCommitChanges:"View Changed Files and DIFF",copyCommitMessage:"Copy Commit Message",copyCommitMessageSuccess:"The commit message has been copied.",copyCommitVersion:"Copy Git Version",copyCommitVersionSuccess:"The Git version has been copied.",commitDetailTitle:"Commit Detail",commitDetailDescription:"Showing the full change for commit {hash}.",commitDetailLoading:"Loading commit detail...",commitDetailEmpty:"There is no commit detail to show right now.",commitDetailLoadFailed:"The commit detail is not available right now.",commitVersionLabel:"Git Version",commitHashLabel:"Commit Hash",commitAuthorLabel:"Author",commitTimeLabel:"Commit Time",commitMessageLabel:"Commit Message",changedFilesTitle:"Changed Files",commitDiffLabel:"Commit DIFF",renamedFromLabel:"Renamed from {path}",explainCommitTitle:"Explain Commit Change",explainCommitDescription:"Choose a CLI provider first, then start a new session to analyze this commit.",explainCommitAction:"Explain Change",startExplainCommit:"Start Explaining",explainCommitStarted:"The explanation session has been created.",explainCommitFailed:"Failed to explain the commit change.",remoteTitle:"Remote Sync",remoteReady:"A remote is configured for the current repository.",remoteMissing:"The current repository has no remote configured yet.",fetch:"Fetch",pull:"Pull",push:"Push",pushNow:"Push Now",publish:"Publish",remoteFailed:"Remote sync failed.",remoteAuthAction:"Remote Auth",remoteAuthTitle:"Configure Remote Authentication",remoteAuthDescription:"Enter the username, password, or token to use for authenticated remote operations in this page session.",remoteAuthDescriptionGithub:"The current remote points to GitHub. For GitHub HTTPS Git operations, use a Personal Access Token (PAT) instead of your GitHub login password.",remoteAuthStatusLabel:"Authentication",remoteAuthConfigured:"Configured",remoteAuthNotConfigured:"Not Configured",remoteAuthGithubPatLabel:"Personal Access Token (PAT)",remoteAuthGithubPatPlaceholder:"Enter GitHub PAT",remoteAuthGithubUsernamePlaceholder:"Enter GitHub username",remoteAuthGithubPatHint:"GitHub does not support account passwords for Git HTTPS authentication. In basic mode, enter GitHub username + PAT. In token mode, you can paste the PAT directly.",remoteAuthRemember:"Remember On Host",remoteAuthSessionHint:"By default this only applies to the current page session. If you enable “Remember On Host”, the credential will be stored on the Host after a successful remote sync and reused later.",remoteAuthRememberHint:"When remember is enabled, this credential will be written to the Host after the remote sync succeeds.",remoteAuthSave:"Save Auth",remoteAuthSaved:"Remote authentication saved. Retry the remote sync now.",remoteAuthCleared:"Remote authentication for this page session has been cleared.",selectRemoteTitle:"Select Remote to Push",selectRemoteDesc:"Select remote repositories to push to. Multiple selection supported.",noRemotes:"No remote repositories are configured.",pushSelected:"Push ({count})",pushing:"Pushing…",pushAllSuccess:"Successfully pushed to {count} remote(s).",errors:{unauthorized:"The current login is no longer valid. Log in again and retry.",workspaceNotFound:"The workspace bound to the current session does not exist. Check whether it is still available.",invalidWorkspace:"The current workspace config is invalid. The Git sidebar must not operate outside the repo root.",notGitRepository:"The current workspace is not a Git repository. The Git sidebar will not fake a state.",repoNotFound:"No usable Git repository root was found for the current workspace.",pathOutOfWorkspace:"The Git target is outside the current workspace repository boundary. The operation was blocked.",invalidTarget:"The Git target path is invalid. Refresh the sidebar and try again.",notStaged:"The target file is not staged yet. Check the current change state first.",emptyStagedChanges:"The staging area is empty. Stage the changes before committing.",branchConflict:"The current branch has conflicts or is not a fast-forward update. Sync and resolve differences first.",branchNotFound:"The target branch does not exist. Check the branch name first.",remoteNotFound:"The current repository does not have a usable origin remote yet.",remoteAuthFailed:"Remote repository authentication failed. Check the current credentials first.",pushFailed:"Push failed. Check remote state and local commits first.",pullFailed:"Pull failed. Check the remote branch state first.",remoteFailed:"Remote sync failed. Check Git output and network state.",commitValidationFailed:"The commit draft has not passed validation yet. Fix validation issues first.",commandTimeout:"The Git operation timed out. Check repository state and network conditions."}},theme:{light:"浅色",dark:"深色",skyBlue:"赛博",eyeGreen:"护眼",switchLabel:"Theme"},locale:{zhCN:"Simplified Chinese",enUS:"English"}},rL={common:{appName:"CodingNS",loading:"正在准备会话工作区…",retry:"重新尝试",back:"返回",save:"保存",close:"关闭",cancel:"取消",logout:"退出登录",unknown:"未命名会话"},auth:{loginTitle:"继续你的编码会话",loginSubtitle:"INITIALIZING DEVELOPMENT ENVIRONMENT...",serverPreset:"服务器列表",serverCustomOption:"使用自定义服务器",serverAddress:"服务器地址",serverPlaceholder:"例如:http://127.0.0.1:3002",serverHint:"登录、实时消息和终端都会连接到这里。客户端应填写 Host API 地址,例如 http://127.0.0.1:3002;4174、5173 这类前端开发端口不是给正式客户端直接连接的,只有代理和跨域都配好时才适合临时调试。",serverInvalid:"服务器地址无效,请检查后再试。",serverCurrent:"当前服务器",bootstrapTitle:"先完成首次初始化",bootstrapSubtitle:"这个 Host 还没有管理员账号,先创建一个最小登录入口。",username:"用户名",password:"密码",rememberPassword:"保存密码",confirmPassword:"确认密码",submitLogin:"进入工作台",submitBootstrap:"创建管理员账号",bootstrapSuccess:"初始化完成,现在可以登录了。",bootstrapMismatch:"两次输入的密码不一致。",authUnavailable:"暂时连不上 Host,请确认服务可访问。",logoutSuccess:"当前登录态已经清空。",demoBanner:"演示环境 — 所有账号数据公开可见,注销后自动清除",demoSessionExpired:"演示会话已过期,请重新登录",captcha:"图形验证码",captchaPlaceholder:"输入图中的字符",captchaHint:"连续输错三次后,需要先完成图形验证码才能继续登录。",captchaImageAlt:"登录图形验证码",serverSettings:"服务器设置",serverSettingsTitle:"服务器配置",saveServerSettings:"保存设置"},settings:{title:"设置",appearance:"外观",appearanceSectionSummary:"语言、主题与界面配色",language:"语言",languageDescription:"选择界面显示语言,切换后立即应用到当前页面。",theme:"主题",themeDescription:"选择适合你的界面配色方案",autoTheme:"自动跟随系统主题",autoThemeDescription:"开启后根据系统或浏览器的深浅色偏好自动切换日间和夜间模式。",fileManager:"文件管理",workspaceSessionSortMode:"工作区的会话显示排序方式",workspaceSessionSortModeDescription:"控制工作区里各处会话列表的默认排序,只影响当前设备。",sessionSortModeCreatedAt:"按照会话创建时间",sessionSortModeUpdatedAt:"按照会话更新时间",sessionSortModeTitle:"按照会话名称",showSystemFiles:"显示系统文件",showSystemFilesDescription:"在文件管理里显示 macOS 和 Windows 常见的系统文件,例如 .DS_Store、Thumbs.db。这个开关只影响当前设备。",serverConnection:"服务器连接",serverConnectionSectionSummary:"服务器地址与连接恢复策略",remoteAccess:"远程访问",remoteAccessSectionSummary:"查看状态并管理 Tailscale 远程访问。",modelManagement:"模型管理",modelManagementSectionSummary:"快速切换模型配置文件",modelManagementNavValue:"快速切换",modelManagementTitle:"模型快速切换",modelManagementDescription:"这里不新增也不编辑预设,只把 cc-switch 已有预设图形化展示出来,方便你一键切换。",modelManagementRefresh:"刷新模型",modelManagementRefreshSuccess:"模型预设列表已刷新。",modelManagementLoadFailed:"模型预设加载失败。",modelManagementScannedAt:"最近扫描",modelManagementScannedAtUnknown:"暂未扫描",modelManagementCurrentProfile:"当前配置文件",modelManagementCurrentModel:"当前模型",modelManagementCurrentPreset:"当前预设",modelManagementModelUnknown:"未识别",modelManagementPresetMissing:"未设置",modelManagementCurrentTag:"当前",modelManagementOpenSwitcher:"切换配置",modelManagementModalTitle:"供应商配置切换",modelManagementModalDescription:"这里按应用查看 cc-switch 已有配置文件,并切换当前启用项。",modelManagementTabsLabel:"模型应用标签",modelManagementSwitchAction:"切换",modelManagementSwitchSuccess:"{app} 已切换到 {preset}。",modelManagementOptionsEmpty:"当前没有可切换的预设。",modelManagementStatusReady:"可切换",modelManagementStatusUnconfigured:"未配置",modelManagementStatusUnavailable:"未安装 cc-switch-cli",modelManagementStatusError:"读取失败",skills:"Skills",skillsSectionSummary:"读取并同步各个 CLI 自己的本地 skill,不做市场,不接远端仓库。",skillsNavValue:"本地同步",skillManagerTitle:"本地 Skill 管理",skillManagerDescription:"统一读取 Codex、Claude Code、Gemini、OpenCode 的 skill 目录,支持导入未纳管项并重新同步。",skillSummaryManagedSkills:"受管 skill",skillSummaryManagedEntries:"已纳管目录",skillSummaryUnmanagedEntries:"未纳管目录",skillSummaryConflictedEntries:"冲突目录",skillSummaryDiagnostics:"诊断",skillManageAction:"SKILL配置",skillConfigModalTitle:"SKILL配置",skillConfigModalDescription:"这里统一查看受管、未纳管、冲突和诊断结果,并执行导入或重新同步。",skillRefresh:"刷新概况",skillRefreshSuccess:"Skill 概况已刷新。",skillScannedAt:"最近扫描",skillManagedListTitle:"已纳管 Skill",skillManagedEmpty:"当前还没有纳管中的 skill。",skillUnmanagedListTitle:"未纳管 Skill",skillUnmanagedEmpty:"当前没有发现未纳管的 skill。",skillConflictedListTitle:"冲突项",skillConflictedEmpty:"当前没有发现冲突项。",skillDiagnosticsTitle:"诊断",skillDiagnosticsEmpty:"当前没有额外诊断信息。",skillDirectoryName:"目录名",skillSsotPath:"统一存储目录",skillSourceCli:"来源 CLI",skillDirectoryPath:"目录路径",skillImportAction:"导入并纳管",skillImportSuccess:"已导入 {name},并纳管到 {target}。",skillSyncAction:"重新同步",skillSyncSuccess:"已重新同步 {name}。",skillSyncTargetMissing:"这个 skill 还没有绑定任何目标 CLI,暂时无法重新同步。",skillLoadFailed:"Skill 概况加载失败。",skillTargetCodex:"Codex",skillTargetClaudeCode:"Claude Code",skillTargetGemini:"Gemini",skillTargetOpenCode:"OpenCode",skillBindingPending:"待同步",skillBindingSynced:"已同步",skillBindingFailed:"同步失败",skillBindingConflicted:"内容冲突",securityPrivacy:"安全与隐私",securityPrivacySectionSummary:"会话权限、风险边界与默认授权策略",softwareUpdate:"软件更新",softwareUpdateSectionSummary:"服务端和客户端版本",serverAddress:"服务器地址",serverDescription:"客户端的登录、接口请求和实时连接都通过这个 Host 入口工作;前端界面资源由应用自身携带。",tailscaleBrand:"Tailscale",tailscaleSectionTitle:"Tailscale 接入",tailscaleSectionDescription:"让这台 Host 通过 Tailscale 在你的设备间可访问。",tailscaleCurrentState:"当前状态",tailscaleSwitchLabel:"启用开关",tailscaleStatusIndicator:"状态指示器",tailscaleServerAddress:"服务器地址",tailscaleAccountName:"账号名",tailscaleIpAddress:"IP 地址",tailscaleConfigure:"配置",tailscaleConfigModalTitle:"配置 Tailscale",tailscaleConfigModalDescription:"修改接入参数",tailscaleControlServer:"Control Server",tailscaleControlServerDescription:"留空时使用默认 control server。",tailscaleControlServerPlaceholder:"留空表示使用默认 control server",tailscaleHostname:"设备名称",tailscaleHostnameDescription:"可选。",tailscaleHostnamePlaceholder:"例如:codingns-host",tailscaleReachableBaseUrl:"外部访问地址",tailscaleTailnetFqdn:"Tailnet FQDN",tailscaleTailnetIpv4:"Tailnet IPv4",tailscaleTailnetIpv6:"Tailnet IPv6",tailscaleDetailAddresses:"详细地址",tailscaleRefresh:"刷新状态",tailscaleInstallAction:"安装 Tailscale",tailscaleInstallOpenFailed:"打开 Tailscale 安装页面失败。",tailscaleEnable:"启用 Tailscale",tailscaleDisable:"停用 Tailscale",tailscaleLogin:"开始绑定",tailscaleLogout:"解绑账号",tailscaleUnavailable:"暂不可用",tailscaleLoadFailed:"Tailscale 状态读取失败。",tailscalePhaseDisabled:"未启用",tailscalePhaseBlockedUninitialized:"实例未初始化,已阻断暴露",tailscalePhaseStarting:"正在启动",tailscalePhaseNeedsLogin:"等待绑定账号",tailscalePhaseRunning:"运行中",tailscalePhaseStopping:"正在停止",tailscalePhaseError:"状态异常",tailscaleOverviewDisabled:"当前还没有启用远程访问。",tailscaleOverviewBlockedUninitialized:"先完成初始化,再启用远程访问。",tailscaleOverviewStarting:"正在接入 Tailscale,请稍等。",tailscaleOverviewNeedsLogin:"启用完成后,还需要绑定账号。",tailscaleOverviewRunning:"当前实例已经可以通过 Tailscale 访问。",tailscaleOverviewStopping:"正在关闭远程访问。",tailscaleOverviewError:"远程访问状态异常,请先刷新或重新配置。",releaseChannel:"发布通道",releaseChannelDescription:"稳定版或测试版",releaseStable:"稳定版",releaseBeta:"测试版",autoReconnect:"自动重连",autoReconnectDescription:"当 Host 短暂不可达时,自动尝试恢复 HTTP 和 WebSocket 链路。",autoCheckUpdate:"自动检查客户端更新",autoCheckUpdateDescription:"仅客户端",defaultPermissionMode:"默认会话权限",defaultPermissionModeDescription:"控制新建和继续会话时默认使用的工具权限。完整权限会关闭询问,只适合你已经信任当前项目和运行环境时使用。",permissionModeDefault:"跟随 CLI 默认策略",permissionModeAcceptEdits:"允许编辑工作区,不询问",permissionModeBypassPermissions:"完整权限,不询问",enabled:"已启用",disabled:"已关闭",serverUpdate:"服务端更新",serverUpdateDescription:"",clientUpdate:"客户端更新",clientUpdateDescription:"",serverCurrentVersion:"服务端当前版本",serverTargetVersion:"服务端目标版本",serverPackageName:"npm 包名",serverUpdateCommand:"升级命令",serverCheckNow:"检查服务端",serverOpenPage:"打开 npm",serverLatestUnknown:"暂未获取",serverUpdateReady:"发现新版本",serverUpToDate:"已是最新版本",serverCheckFailed:"检查失败",serverOpenPageFailed:"打开页面失败",releaseCurrentVersion:"当前版本",releaseTargetVersion:"目标版本",releaseTargetTag:"目标 Tag",releasePublishedAt:"发布时间",releaseUnknownVersion:"未知",releaseNotes:"更新内容",releaseNotesEmpty:"暂无更新内容",releaseCheckNow:"检查客户端",releaseInstallNow:"安装更新",releaseOpenPage:"打开发布页",releaseRollback:"回退版本",releaseUpdateBadge:"新版本",releaseUpdateReady:"发现新版本",releaseUpToDate:"已是最新版本",releaseCheckFailed:"检查失败",releaseInstallerMissing:"有新版本,暂无安装包",releaseSignatureMissing:"有新版本,缺少校验信息",releaseInstallStarted:"安装已开始",releaseInstallFailed:"安装失败",releasePageOpenFailed:"打开页面失败",androidInstallerStarted:"已交给系统安装器,安装完成前你仍可以取消",androidInstallPermissionRequired:"请先允许当前应用安装未知来源应用",androidInstallCancelled:"安装已取消或未完成,可重新触发安装",androidInstallSucceeded:"已检测到新版本完成安装",releaseRollbackStarted:"已开始回退",releaseRollbackFailed:"回退失败",clientUpdateUnsupported:"当前不支持安装更新",logout:"退出登录"},home:{title:"从一条会话继续,而不是从后台表格开始",subtitle:"这里先挑一个工作区和会话,真正的工作区在下一步。",terminalsEntry:"进入终端页",workspaceSection:"工作区",sessionSection:"最近会话",emptyWorkspaces:"还没有导入工作区。先在 Host 侧导入后,这里会出现入口。",emptySessions:"当前工作区还没有可继续的会话。",noActivity:"暂时还没有活动"},terminal:{title:"终端",heroTitle:"把真实 PTY 留在 Host,把操作入口留在工作台",heroSubtitle:"这里不伪造输出,不把终端和进程搅在一起,只消费 Host 统一托管的真实终端流。",workspaceSection:"工作区与终端",workspaceField:"当前工作区",shellField:"新终端使用的 Shell",runtimeField:"Runtime",runtimeAutoOption:"自动选择",runtimeAutoShortLabel:"auto",runtimeAutoDescription:"按 Host 默认策略选择当前终端 runtime。",runtimePersistentLabel:"持久会话",runtimePersistentShortLabel:"持久",runtimeTmuxDescription:"持久化外部会话,适合需要后台常驻的开发终端。",runtimeWindowsPersistentDescription:"使用基于 ConPTY 的 Windows 持久化会话,让终端在 Host 重启后仍可继续保留。",runtimeEmbeddedDescription:"由当前 Host 直接托管,适合作为轻量回退方案。",runtimeConptyPowerShellLabel:"PowerShell 持久会话",runtimeConptyCmdLabel:"CMD 持久会话",runtimeConptyGitBashLabel:"Git Bash 持久会话",runtimeMissingDialogTitle:"当前系统没有安装 tmux",runtimeMissingDialogDescription:"tmux runtime 无法继续创建持久化终端。你可以先安装 tmux,或者临时切换到 embedded-pty 继续。",runtimeMissingInstallDescription:"建议优先安装 tmux,这样终端才能在 Host 重启后继续保留。",runtimeMissingInstallMacArm:"macOS(Apple Silicon / Homebrew):arch -arm64 brew install tmux",runtimeMissingInstallMacIntel:"macOS(Intel Mac / Homebrew):brew install tmux",runtimeMissingInstallDebian:"Ubuntu / Debian:sudo apt install tmux",runtimeMissingInstallFedora:"Fedora:sudo dnf install tmux",runtimeMissingFallbackDescription:"如果现在先切到 embedded-pty,本次终端可以继续创建,但它不会作为外部持久会话保留。",runtimeMissingKeepAction:"先不切换",runtimeMissingFallbackAction:"切换到 embedded-pty 并继续",runtimeMissingFallbackPending:"正在切换…",shellUnavailable:"当前不可用",workspaceLoadFailed:"工作区或终端列表暂时没有拉回来。",terminalSection:"终端实例",templateSection:"命令模板",stageEmptyTitle:"还没有选中终端",stageEmptySubtitle:"先创建一个终端,或者运行一个命令模板。",emptyTerminals:"当前工作区还没有终端实例。",emptyTemplates:"当前工作区还没有命令模板。",createButton:"新建终端",creating:"正在创建终端…",creationPendingDescription:"Host 正在启动真实 PTY,连上以后这个窗口会立刻接管显示。",defaultTerminalName:"工作终端",created:"终端已经创建并接入 Host。",createFailed:"终端创建失败。",closeButton:"关闭终端",closing:"正在关闭终端…",closed:"终端关闭请求已经提交。",closeCompleted:"终端已关闭。",closePendingDescription:"关闭请求已经发给 Host,前台不会阻塞,系统会继续同步最终结果。",closeSyncDelayed:"Host 还在后台处理关闭,列表会在后续刷新时继续同步。",closeFailed:"终端关闭失败。",inputLabel:"向当前终端发送命令",inputPlaceholder:"例如:pnpm test",sendButton:"发送到终端",inputFailed:"终端输入发送失败。",outputEmpty:"终端已经连上,但暂时还没有输出。",outputTruncated:"断线期间有一段输出超出缓存窗口,当前只补回了仍保留的部分。",connectedHint:"当前输出来自 Host 真实 PTY 流。",moreActions:"终端操作",duplicateAction:"复制标签",duplicateSuccess:"已按当前终端配置新建一个标签。",duplicateFailed:"复制终端标签失败。",disconnectAction:"断开",disconnected:"终端连接已断开。",reconnectAction:"重连",reconnectRequested:"终端重连请求已发出。",deleteAction:"删除",deleting:"正在删除终端…",deleted:"终端记录已删除。",deletePendingDescription:"删除请求已经发给 Host,前台不会阻塞,系统会在后台继续同步列表。",deleteSyncDelayed:"Host 还在后台处理删除,列表会在后续刷新时继续同步。",deleteFailed:"终端记录删除失败。",closePendingBadge:"关闭中",deletePendingBadge:"删除中",pinAction:"固定",unpinAction:"取消固定",zoomLabel:"终端缩放",zoomInAction:"放大终端显示",zoomOutAction:"缩小终端显示",zoomResetAction:"恢复默认缩放",toolbarToggleAction:"展开终端工具栏",mobileSwipeHint:"左右滑动切换终端",mobileSwipePosition:"{current} / {total}",mobileDrawerAction:"打开快捷终端列表",mobileDrawerTitle:"快捷终端",mobileDrawerDescription:"右滑呼出列表,点一下就切到别的终端。",mobilePinnedSectionTitle:"已固定终端",mobileDrawerEmptyTitle:"当前还没有终端",mobileDrawerEmptyDescription:"先新建一个终端,这里才会出现可切换的列表。",mobileCreateSheetTitle:"新建终端",mobileCreateShellLabel:"终端类型",mobileCreateShellDescription:"先选这次要开的 Shell,别把桌面端那套下拉框搬到手机上。",mobileCreateRuntimeLabel:"会话方式",mobileCreateRuntimeDescription:"再决定它是持久保留,还是只作为当前 runtime 会话。",mobileCreateLoadingShells:"正在读取当前系统可用的终端类型…",mobileCreateConfirm:"创建这个终端",createDialogTitle:"新建终端",createDialogShellDescription:"先选这次要开的 Shell,再创建终端。Windows 下不再偷偷按默认值直接起。",createDialogRuntimeDescription:"再决定它是持久保留,还是只作为当前 runtime 会话。",createDialogConfirm:"创建终端",mobileRuntimePersistentTitle:"持久会话",mobileRuntimePersistentDescription:"适合需要一直挂着的开发终端,创建后会作为可恢复会话保留。",mobileRuntimeSessionTitle:"runtime(当前会话)",mobileRuntimeSessionDescription:"直接由当前 Host 托管,创建更轻,但不会保留成外部持久会话。",mobileWorkspaceSwitcherPlaceholder:"选择项目",mobileEmptyTitle:"这里还没有终端内容",mobileEmptyDescription:"先新建一个终端,或者右滑呼出快捷列表,切到当前工作区已有的终端。",layoutLabel:"分栏布局",layoutSingleAction:"单栏显示",layoutVerticalAction:"左右分栏",layoutHorizontalAction:"上下分栏",saveLogAction:"保存日志",saveLogSuccess:"终端日志已保存。",saveLogFailed:"终端日志保存失败。",logEmpty:"当前终端还没有可保存的日志内容。",bindToPaneAction:"绑定到当前分栏",bindToPrimaryPaneAction:"绑定到主分栏",bindToSecondaryPaneAction:"绑定到副分栏",panePrimary:"主分栏",paneSecondary:"副分栏",splitEmptySubtitle:"先点一个标签,或者新建一个终端,把它绑定到当前分栏。",statusBadge:{creating:"启动中",running:"运行中",closed:"已关闭",error:"异常"},recoveryComplete:"已回到刷新前的终端,缓存内的关键输出已经补回。",recoveryTruncated:"已恢复到上一个终端,但断线期间的部分输出已经超出缓存窗口。",recoveryIdleClosed:"上一个终端已因空闲超时被 Host 自动关闭,你现在看到的是关闭前保留的输出。",reconnect:"手动重连",liveConnected:"实时流已接入",templateName:"模板名称",templateCommand:"主命令",templateArgs:"参数(空格分隔)",templateCreateButton:"保存模板",templateCreated:"命令模板已经保存。",templateCreateFailed:"命令模板保存失败。",templateRunSent:"命令模板已经发送到当前终端。",templateRunCreatedTerminal:"命令模板已在新终端中启动。",templateRunFailed:"命令模板执行失败。",connection:{connected:"已连接",reconnecting:"正在重连",reconnect_failed:"重连失败",closed:"已关闭"}},conversation:{titleFallback:"继续对话",historyLoading:"正在从 Host 拉取消息历史…",historyLoadingOlder:"正在加载更早的消息…",historyLoadFailed:"历史消息暂时没有拉回来,可以稍后再试。",timelineEmpty:"这条会话还没有消息。你发出的第一句话会直接进入 Host 链路。",turnAbortedUser:"上一轮已由你手动停止。",turnAbortedUnexpected:"上一轮意外中断,没有正常结束。",turnAbortedGeneric:"上一轮已中断,没有正常结束。",scrollToBottomAction:"回到底部",rawRefLabel:"来源",copyAction:"复制",copyContentSuccess:"内容已复制。",copyContentFailed:"内容复制失败。",selectionTodoAction:"代办",selectionActionButton:"操作",selectionActionSubmit:"新开操作子会话",selectionActionPromptLabel:"你想让它做什么",selectionActionPromptPlaceholder:"比如:解释这段话、整理成笔记,或调用指定接口处理它",selectionActionIncludeContext:"包含当前上下文",selectionActionContextUnavailable:"当前选区跨了多条消息,没法安全继承上下文,只能按无上下文新建子会话。",selectionActionDefaultPrompt:"请处理这段内容。",selectionActionQuotedLabel:"选中文本",selectionActionFailed:"创建操作子会话失败。",actionSessionBadge:"操作",actionInheritedSelectionSummary:"已默认折叠来自“{parentTitle}”的一段选中文本。",forkFromHereAction:"从这里分叉",forkingAction:"正在分叉…",forkMessageSucceeded:"已从这条消息创建新分支。",forkMessageFailed:"从这条消息分叉失败。",forkDraftLabel:"分叉引用",forkDraftEmpty:"这条消息没有可引用的文本内容。",forkDraftClear:"取消这次分叉引用",forkTargetProviderLabel:"目标 CLI",forkTargetModelLabel:"目标模型",forkTargetSummary:"源 CLI:{sourceProvider} · 目标 CLI:{targetProvider}",forkInlineModelLoading:"正在读取模型列表…",forkInlineNativeHint:"保持同一 CLI,继续走原生分叉。",forkInlineCrossHint:"已切到不同 CLI,将按文本历史重建新会话。",forkSwitchConfirmTitle:"切换到其他 CLI?",forkSwitchConfirmDescription:"同一 CLI 会尽量保留原生分叉体验;切到其他 CLI 会改成跨供应商分叉。",forkSwitchConfirmKeepTitle:"会保留",forkSwitchConfirmKeepBody:"分叉点之前的用户消息和助手文本。",forkSwitchConfirmConvertTitle:"会转换",forkSwitchConfirmConvertBody:"可继承文本会重建到新的 CLI 会话里。",forkSwitchConfirmDropTitle:"会丢失",forkSwitchConfirmDropBody:"工具调用、权限交互、附件和运行中状态。",forkSwitchConfirmAction:"确认切换",forkSwitchKeepNative:"保持原生",forkProviderNativeUnsupported:"当前 provider 还不支持原生 fork",forkProviderReconstructedUnsupported:"当前 provider 还不能作为跨 provider 分叉目标",loadMore:"加载更多消息",composerPlaceholder:"把下一步交代清楚,剩下的交给这条会话继续跑。",sendButton:"发送消息",queueTitle:"待发队列",queueDescription:"当前这轮结束后,队列里的消息会按顺序自动继续处理。",queueOrderPrefix:"队列序号",queueStatusQueued:"等待中",queueStatusFailed:"发送失败",queueDelete:"删除",queueDeleting:"删除中",queueImageOnly:"仅图片附件",sendGuidanceButton:"追加引导",queueGuidanceButton:"加入队列",queueSteer:"引导",queueSteering:"引导中",resendButton:"重试发送",quickPhraseTrigger:"快捷短语",quickPhraseModalTitle:"快捷短语",quickPhraseModalDescription:"这里集中管理你常用的会话指令,点一下就能直接填回当前输入框。",quickPhraseCreateLabel:"新增短语",quickPhraseOpenCreateAction:"新增短语",quickPhraseCreateModalTitle:"新增快捷短语",quickPhraseCreateModalDescription:"把常用指令单独存起来,后面在任何设备上都能直接复用。",quickPhraseCreatePlaceholder:"输入一条常用短语,保存后下次可以直接复用。",quickPhraseCreateAction:"添加短语",quickPhraseListLabel:"快捷短语列表",quickPhraseEmpty:"还没有可用的快捷短语,先加一条最常用的。",quickPhraseOrderLabel:"第 {index} 条",quickPhraseMoveUp:"上移短语",quickPhraseMoveDown:"下移短语",quickPhraseDelete:"删除短语",quickPhraseSaveFailed:"快捷短语保存失败,请稍后再试。",sendingState:"发送中",sentState:"已同步",failedState:"发送失败",contextUsageTitle:"当前上下文占用",contextUsageUnavailable:"当前上下文占用暂时不可用",contextUsageEstimated:"上限为估算值",contextUsageCachedTokens:"缓存命中 {count}",contextUsageSourceProviderLog:"上限来自 provider 运行日志",contextUsageSourceProviderRuntime:"上限来自 provider runtime",contextUsageSourceProviderConfig:"上限来自 provider 配置",contextUsageSourceModelMap:"上限来自模型映射",headerWorkspace:"工作区",headerProvider:"Provider",headerCapability:"能力摘要",connectionConnected:"已连接",connectionReconnecting:"正在重连",connectionReconnectFailed:"重连失败",connectionClosed:"连接已关闭",runtimeErrorTitle:"会话运行失败",reconnectExplain:"实时链路断开了,系统正在补回缺失消息。",reconnectFailedExplain:"自动恢复没有成功。你可以手动重试,或者稍后重新进入会话。",capabilityDenied:"当前会话不支持这个动作",capabilitySendDisabled:"当前 provider 不支持发送新消息",capabilityAttachmentDisabled:"当前会话还不支持附件输入",capabilityInterruptDisabled:"当前会话不支持中断运行",sidebarTitle:"当前会话上下文",sidebarSubtitle:"这里只保留最小能力摘要,不把页面做成后台控制台。",reconnectButton:"手动恢复实时同步",headerResumedAt:"最近续接",headerLastSyncAt:"最近同步",historyPages:"历史分页",syncStatusIdle:"同步空闲",syncStatusSyncing:"同步中",syncStatusError:"同步异常",capabilityResume:"可续接",capabilitySend:"可发送",capabilityInterrupt:"可中断",capabilityTools:"工具调用",attachmentsLabel:"附件",filePanelTitle:"文件管理",filePanelSubtitle:"这里的文件能力只服务当前会话,不把页面拉成重型 IDE。",filePanelNoWorkspace:"当前还没有选中项目,暂时不能浏览或挂载文件。",filePanelRefresh:"刷新",filePanelCopyPath:"复制路径",filePanelCopyAbsolutePath:"复制绝对路径",filePanelCopyRelativePath:"复制相对路径",filePanelCopyAbsolutePathSuccess:"绝对路径已复制。",filePanelCopyRelativePathSuccess:"相对路径已复制。",filePanelCopyPathFailed:"路径复制失败。",filePanelCopy:"复制",filePanelCut:"剪切",filePanelPaste:"粘贴",filePanelCopySelectionSuccess:"已复制 {count} 项,可到目标目录粘贴。",filePanelCutSelectionSuccess:"已剪切 {count} 项,可到目标目录粘贴。",filePanelPasteSuccess:"已粘贴 {count} 项。",filePanelPasteFailed:"粘贴失败,请检查目标目录和重名冲突。",filePanelSelectionCount:"已选 {count} 项",filePanelClipboardCopyReady:"剪贴板中有 {count} 个待复制项目",filePanelClipboardCutReady:"剪贴板中有 {count} 个待移动项目",filePanelOpenFile:"打开文件",filePanelExpandDirectory:"展开文件夹",filePanelCollapseDirectory:"折叠文件夹",filePanelActionsMenu:"文件操作",filePanelSearchPlaceholder:"输入文件名或路径片段",filePanelSearchButton:"搜索",filePanelShowSearch:"打开搜索",filePanelHideSearch:"收起搜索",filePanelSearchEmpty:"没有找到匹配的文件。",filePanelSearchResults:"搜索结果",filePanelSearchFailed:"文件搜索失败,请稍后再试。",filePanelBrowse:"工作区文件",filePanelCollapseCurrent:"折叠当前选中",filePanelCollapseAll:"全部折叠",filePanelBackDirectory:"返回上级",filePanelEmptyDirectory:"这个目录里暂时没有可显示的文件。",filePanelRecentTitle:"最近打开",filePanelEmptyRecent:"最近还没有打开记录。",filePanelContextTitle:"已挂载文件",filePanelEmptyContexts:"当前会话还没有挂载文件管理。",filePanelEditorTitle:"预览与编辑",filePanelEditorPlaceholder:"这里只做轻量文本编辑,不在这里做完整 IDE。",filePanelSelectHint:"先从目录、搜索或最近打开里选一个文件。",filePanelUnsupported:"这个文件当前不能在侧栏里直接编辑。",filePanelAttach:"挂到会话",filePanelAttached:"已挂载",filePanelDetach:"解绑",filePanelSave:"保存",filePanelSaving:"保存中",filePanelLoadFailed:"文件管理面板加载失败。",filePanelOpenFailed:"文件打开失败。",filePanelSaveSuccess:"文件已经保存。",filePanelSaveFailed:"文件保存失败。",fileViewerHint:"当前以 {language} 模式打开,支持预览与编辑保存。",fileViewerModeLabel:"文件查看模式",fileViewerPreview:"预览",fileViewerCode:"代码",fileViewerEdit:"编辑",fileViewerPlainText:"纯文本",fileViewerImage:"图片",fileViewerPdf:"PDF",fileViewerRefreshPreview:"刷新",fileViewerRefreshFailed:"文件预览刷新失败。",fileViewerOpenExternal:"外部打开",fileViewerOpenExternalFailed:"外部打开失败。",fileViewerZoomIn:"放大",fileViewerZoomOut:"缩小",fileViewerFit:"适配",fileViewerActualSize:"原始大小",fileViewerFitWidth:"适宽",fileViewerPreviousPage:"上一页",fileViewerNextPage:"下一页",fileViewerPageIndicator:"第 {page} 页",fileViewerSizeLabel:"查看器尺寸",fileViewerSizeDefault:"默认",fileViewerSizeWide:"加宽",fileViewerSizeFull:"铺满",fileViewerImageUnavailable:"当前无法显示图片预览,请尝试刷新或外部打开。",fileViewerPdfUnavailable:"当前无法显示 PDF 预览,请尝试刷新或外部打开。",fileViewerEnterFullscreen:"全屏",fileViewerExitFullscreen:"退出",fileViewerOpenInBrowser:"在浏览器中打开",fileViewerOpenInBrowserFailed:"打开浏览器预览失败。",fileViewerHtmlPreviewLoading:"正在加载 HTML 预览...",fileViewerHtmlPreviewUnavailable:"当前无法显示 HTML 预览,请先切到代码模式查看。",fileViewerHtmlPreviewFailed:"HTML 预览链接生成失败。",filePanelAttachSuccess:"文件已经挂到当前会话。",filePanelAttachFailed:"文件挂载失败。",filePanelDetachSuccess:"文件已经从当前会话解绑。",filePanelDetachFailed:"文件解绑失败。",filePanelNewFile:"新建文件",filePanelNewDirectory:"新建目录",filePanelUpload:"上传文件",filePanelDownload:"下载文件",filePanelUploadSuccess:"已上传 {name}。",filePanelUploadFailed:"文件上传失败。",filePanelDownloadSuccess:"已开始下载 {name}。",filePanelDownloadFailed:"文件下载失败。",filePanelDelete:"删除",filePanelDeleting:"删除中...",filePanelDeleteSuccess:"已删除 {name}。",filePanelDeleteConfirmTitle:"确认删除",filePanelDeleteConfirmDescription:"删除后会立即从当前项目移除,这一步不能撤销。",filePanelDeleteSelectionConfirm:"确认删除选中的 {count} 项吗?",filePanelDeleteSelectionSuccess:"已删除 {count} 项。",filePanelRenameMove:"重命名/移动",filePanelMutateFailed:"文件操作失败,请检查路径和当前状态。",filePanelCreateFilePrompt:"输入要创建的相对文件路径",filePanelCreateDirectoryPrompt:"输入要创建的相对目录路径",filePanelFilterChanges:"仅显示变更",filePanelShowAll:"显示全部",filePanelNoChanges:"当前没有变更文件。",filePanelBinaryPreview:"二进制文件不支持预览。",filePanelDeleteFileConfirm:"确认删除这个文件吗?{path}",filePanelDeleteDirectoryConfirm:"确认删除这个文件夹吗?{path}",filePanelRenameMovePrompt:"输入新的相对路径",unavailableAction:"当前不可用",roleUser:"你",roleAssistant:"助手",roleTool:"工具",roleSystem:"系统"},git:{title:"Git 上下文",subtitle:"这里是会话侧边的辅助区,只处理当前工作区里的 Git 事实。",loading:"正在读取当前工作区的 Git 上下文。",refresh:"刷新",panelLoadFailed:"Git 上下文暂时没有加载出来。",ahead:"领先",behind:"落后",dirty:"有改动",clean:"已干净",changeCount:"当前有 {count} 个变更文件",noChanges:"当前没有待处理改动。",changesTitle:"当前变更",rulesFirstHint:"规则先于生成,草稿不能绕过校验。",stage:"暂存",unstage:"取消暂存",preview:"预览",stageFailed:"暂存操作失败。",diffTitle:"差异预览",diffLoadFailed:"差异内容暂时没有拉回来。",binaryDiff:"这个文件是二进制改动,侧栏不直接展示内容。",stagedDiff:"暂存区 diff",worktreeDiff:"工作区 diff",emptyDiff:"当前没有可展示的文本差异。",diffTruncated:"差异内容过长,已经做了截断保护。",commitTitle:"提交草稿",defaultRuleName:"默认提交规则",language:"语言",maxLength:"长度",bodyRequired:"正文必填",bodyOptional:"正文可选",issueRequired:"Issue 必填",issueOptional:"Issue 可选",commitSubject:"提交标题",commitSubjectPlaceholder:"在这里输入提交信息",commitBody:"提交正文",commitBodyPlaceholder:"把这次改动说清楚,别写空话。",commitFooter:"提交脚注",commitFooterPlaceholder:"例如:Refs: #123",generateDraft:"AI 起草",validate:"校验草稿",commit:"执行提交",draftFailed:"提交草稿生成失败。",validateFailed:"提交规则校验失败。",commitFailed:"提交失败。",commitSuccess:"提交已经写入当前仓库。",validationPassed:"规则校验通过,可以继续提交。",validationFailed:"规则校验没有通过,先把下面的问题修掉。",branchTitle:"分支",branchPlaceholder:"输入要切换或创建的分支名",switchBranch:"切换",createBranch:"新建",branchFailed:"分支操作失败。",historyTitle:"最近历史",historyHint:"只放最近几条,不做图形历史树。",noHistory:"当前没有可展示的提交历史。",viewAllVersions:"查看所有版本",viewAllVersionsDescription:"这里展示当前仓库已加载的版本历史,共 {count} 条。",viewCommitChanges:"查看更改文件与 DIFF",copyCommitMessage:"复制提交信息",copyCommitMessageSuccess:"提交信息已复制。",copyCommitVersion:"复制 Git 版本号",copyCommitVersionSuccess:"Git 版本号已复制。",commitDetailTitle:"版本详情",commitDetailDescription:"当前查看提交 {hash} 的完整改动。",commitDetailLoading:"正在读取提交详情…",commitDetailEmpty:"当前没有可展示的提交详情。",commitDetailLoadFailed:"提交详情暂时没有拉回来。",commitVersionLabel:"Git 版本号",commitHashLabel:"提交 Hash",commitAuthorLabel:"作者",commitTimeLabel:"提交时间",commitMessageLabel:"提交信息",changedFilesTitle:"变更文件",commitDiffLabel:"提交 DIFF",renamedFromLabel:"从 {path} 重命名",explainCommitTitle:"解释版本更改",explainCommitDescription:"先选择一个 CLI 供应商,再新建会话分析这个提交。",explainCommitAction:"解释更改",startExplainCommit:"开始解释",explainCommitStarted:"解释会话已经创建。",explainCommitFailed:"解释更改失败。",remoteTitle:"远程同步",remoteReady:"当前仓库已配置远程。",remoteMissing:"当前仓库还没有远程。",fetch:"Fetch",pull:"Pull",push:"Push",pushNow:"立即推送",publish:"Publish",remoteFailed:"远程同步失败。",remoteAuthAction:"远程认证",remoteAuthTitle:"设置远程仓库认证",remoteAuthDescription:"需要认证的远程仓库,在这里填写本次页面会话使用的用户名、密码或 token。",remoteAuthDescriptionGithub:"检测到当前远程仓库来自 GitHub。GitHub 的 HTTPS Git 操作请使用 Personal Access Token (PAT),不要填写 GitHub 登录密码。",remoteAuthStatusLabel:"认证状态",remoteAuthConfigured:"已配置",remoteAuthNotConfigured:"未配置",remoteAuthGithubPatLabel:"Personal Access Token (PAT)",remoteAuthGithubPatPlaceholder:"输入 GitHub PAT",remoteAuthGithubUsernamePlaceholder:"输入 GitHub 用户名",remoteAuthGithubPatHint:"GitHub 不支持用账号密码做 Git HTTPS 认证。basic 模式请填写 GitHub 用户名 + PAT;token 模式可以直接填写 PAT。",remoteAuthRemember:"记住账号密码到 Host",remoteAuthSessionHint:"默认只在当前页面会话里生效;勾选“记住账号密码到 Host”后,远程同步成功时会写到 Host,后续自动复用。",remoteAuthRememberHint:"勾选记住后,本次远程同步成功时会把认证写到 Host。",remoteAuthSave:"保存认证",remoteAuthSaved:"远程仓库认证已保存,请重新执行同步。",remoteAuthCleared:"已清除当前页面会话里的远程认证设置。",selectRemoteTitle:"选择推送仓库",selectRemoteDesc:"勾选要推送到的远程仓库,支持多选。",noRemotes:"当前仓库没有配置任何远程仓库。",pushSelected:"推送 ({count})",pushing:"推送中…",pushAllSuccess:"已成功推送到 {count} 个远程仓库。",errors:{unauthorized:"当前登录态已经失效,请重新登录后再试。",workspaceNotFound:"当前会话绑定的工作区不存在,先确认工作区是否还可用。",invalidWorkspace:"当前工作区配置无效,Git 侧栏不能脱离仓库根目录执行。",notGitRepository:"当前工作区不是 Git 仓库,Git 侧栏不会伪造状态。",repoNotFound:"当前工作区找不到可用的 Git 仓库根目录。",pathOutOfWorkspace:"Git 目标超出了当前工作区仓库边界,操作已被拦截。",invalidTarget:"Git 目标路径无效,请先刷新侧栏后重试。",notStaged:"目标文件还不在暂存区里,先确认当前变更状态。",emptyStagedChanges:"暂存区为空,先把要提交的改动放进暂存区。",branchConflict:"当前分支存在冲突或不是快进更新,先同步并处理差异。",branchNotFound:"目标分支不存在,先确认分支名是否正确。",remoteNotFound:"当前仓库还没有可用的 origin 远程,先配置远程再同步。",remoteAuthFailed:"远程仓库认证失败,请先确认当前仓库凭据可用。",pushFailed:"推送失败,请先检查远程状态和本地提交。",pullFailed:"拉取失败,请先确认远程分支状态。",remoteFailed:"远程同步失败,请检查 Git 输出和网络状态。",commitValidationFailed:"提交草稿还没通过规则校验,先把校验问题修掉。",commandTimeout:"Git 操作超时了,先确认仓库状态和网络环境。"}}},sL=[{id:"zh-CN",labelKey:"locale.zhCN"},{id:"en-US",labelKey:"locale.enUS"}];function nv({variant:e="default",className:t}){const r=ma(i=>i.profile.language);function s(i){i!==r&&nu({language:i}).catch(()=>{})}return n.jsxs("label",{className:`language-switcher language-switcher-${e}${t?` ${t}`:""}`,children:[n.jsx("span",{className:"language-switcher-label",children:o("common.language")}),n.jsx("div",{className:"language-switcher-options",role:"group","aria-label":o("common.language"),children:sL.map(i=>n.jsx("button",{type:"button",className:`language-switcher-option${r===i.id?" active":""}`,"aria-pressed":r===i.id,onClick:()=>s(i.id),children:o(i.labelKey)},i.id))})]})}const iL={common:{close:"关闭",cancel:"取消",logout:"退出登录",language:"语言"},locale:{zhCN:"简体中文",enUS:"English"},settings:{title:"设置",appearance:"外观",language:"语言",languageDescription:"选择界面显示语言,切换后立即应用到当前页面。",theme:"主题",themeDescription:"选择适合你的界面配色方案",connection:"连接与更新",serverAddress:"服务地址",serverDescription:"桌面端和 H5 都通过这个 Host 入口工作。",releaseChannel:"发布通道",releaseChannelDescription:"稳定版或测试版",releaseStable:"Stable",releaseBeta:"Beta",autoReconnect:"自动重连",autoReconnectDescription:"当 Host 短暂不可达时,自动尝试恢复 HTTP 和 WebSocket 链路。",autoCheckUpdate:"自动检查客户端更新",autoCheckUpdateDescription:"仅客户端",notificationSettings:"通知",notificationSettingsDescription:"单独控制会话相关的系统通知提醒。",notifyOnPermissionRequest:"会话等待审批时通知",notifyOnPermissionRequestDescription:"后台会话出现新的权限申请时推送通知。",notifyOnSessionCompleted:"会话完成时通知",notifyOnSessionCompletedDescription:"后台会话变为已完成时推送通知。",notifyOnSessionFailed:"会话异常时通知",notifyOnSessionFailedDescription:"后台会话运行失败时推送通知。",enabled:"已启用",disabled:"已关闭",serverUpdate:"服务端更新",serverUpdateDescription:"",clientUpdate:"客户端更新",clientUpdateDescription:"",serverCurrentVersion:"服务端当前版本",serverTargetVersion:"服务端目标版本",serverPackageName:"npm 包名",serverUpdateCommand:"升级命令",serverCheckNow:"检查服务端",serverInstallNow:"安装更新",serverOpenPage:"打开 npm",serverLatestUnknown:"暂未获取",serverUpdateReady:"发现新版本",serverUpToDate:"已是最新版本",serverCheckFailed:"检查失败",serverInstallQueued:"已加入更新队列",serverInstalling:"正在安装更新",serverInstallSucceeded:"更新已完成",serverInstallFailed:"安装失败",serverInstallCancelled:"安装已取消",serverInstallTimeout:"安装超时",serverRestartRequired:"新版本已安装,重启 Host 后生效",serverOpenPageFailed:"打开页面失败",runtimePlatform:"当前运行平台",runtimePlatformDescription:"用来确认现在是 Web/H5、Desktop、iOS 还是 Android 运行环境。",platformDesktop:"Desktop",platformWeb:"Web",platformIos:"iOS",platformAndroid:"Android",releaseDesktopOnly:"当前是 Web/H5 运行环境,不支持桌面更新。",releaseCurrentVersion:"当前版本",releaseTargetVersion:"目标版本",releaseUnknownVersion:"未知",releaseNotes:"更新内容",releaseNotesEmpty:"暂无更新内容",releaseCheckNow:"检查客户端",releaseInstallNow:"安装更新",releaseOpenPage:"打开发布页",releaseManualOnly:"当前版本只能手动安装",releaseUpdateBadge:"新版本",releaseUpdateReady:"发现新版本",releaseUpToDate:"已是最新版本",releaseCheckFailed:"检查失败",releaseInstallStarted:"安装已开始",releaseInstallFailed:"安装失败",releasePageOpenFailed:"打开发布页失败",androidInstallerStarted:"已交给系统安装器,安装完成前你仍可以取消",androidInstallPermissionRequired:"请先允许当前应用安装未知来源应用",androidInstallCancelled:"安装已取消或未完成,可重新触发安装",androidInstallSucceeded:"已检测到新版本完成安装",clientUpdateUnsupported:"当前不支持安装更新",account:"账号",logout:"退出登录",logoutDescription:"退出当前账号并返回登录页面",advancedSettings:"高级设置",parallelTaskDebug:"并行任务调试",parallelTaskDebugDescription:"打开后才会启用运行时采样,用来实时看后台任务、调度器和主线程压力指标。",parallelTaskDebugAction:"打开调试面板",parallelTaskDebugModalTitle:"并行任务调试",parallelTaskDebugModalDescription:"这个窗口打开时才会继续采集任务活动和 event loop 指标,关掉后立即停止。",parallelTaskDebugClose:"关闭并行任务调试",parallelTaskDebugLoading:"正在建立观测会话并拉取快照…",parallelTaskDebugLoadFailed:"加载并行任务调试信息失败",parallelTaskDebugEmpty:"当前没有可展示的执行记录。",parallelTaskDebugStatusActive:"采集中",parallelTaskDebugStatusError:"采集异常",parallelTaskDebugObservedAt:"最后更新",parallelTaskDebugSessionExpireAt:"会话到期时间",parallelTaskDebugSessionTtl:"会话 TTL",parallelTaskDebugCollectorState:"采集器状态",parallelTaskDebugCollectorEnabled:"已启用",parallelTaskDebugCollectorDisabled:"未启用",parallelTaskDebugAutoRefresh:"每秒自动刷新",parallelTaskDebugCountersTitle:"总指标",parallelTaskDebugTaskMetricsTitle:"后台任务指标",parallelTaskDebugSchedulerTitle:"调度器指标",parallelTaskDebugEventLoopTitle:"Event Loop",parallelTaskDebugRecentActivitiesTitle:"最近执行记录",parallelTaskDebugWaitAvg:"平均等待",parallelTaskDebugRunAvg:"平均执行",parallelTaskDebugRunMax:"最长执行",parallelTaskDebugStartedCount:"启动次数",parallelTaskDebugFinishedCount:"完成次数",parallelTaskDebugFailedCount:"失败次数",parallelTaskDebugCacheHitCount:"缓存命中",parallelTaskDebugIdle:"空转",parallelTaskDebugBusy:"已命中任务",parallelTaskDebugTickTotal:"tick 总数",parallelTaskDebugIdleTickTotal:"空转 tick",parallelTaskDebugTaskCountTotal:"命中任务",parallelTaskDebugSchedulerErrorTotal:"异常次数",parallelTaskDebugLastDuration:"上次耗时",parallelTaskDebugNextDelay:"下次延迟",parallelTaskDebugEventLoopResolution:"采样粒度",parallelTaskDebugEventLoopMean:"平均延迟",parallelTaskDebugEventLoopP95:"P95 延迟",parallelTaskDebugEventLoopP99:"P99 延迟",parallelTaskDebugEventLoopMax:"最大延迟",parallelTaskDebugTaskKey:"任务 Key",parallelTaskDebugStatus:"状态",parallelTaskDebugAttempt:"尝试",parallelTaskDebugWaitMs:"等待",parallelTaskDebugRunMs:"执行",parallelTaskDebugSource:"来源",parallelTaskDebugError:"错误",parallelTaskDebugMetricEnqueue:"入队",parallelTaskDebugMetricDedupe:"去重",parallelTaskDebugMetricStarted:"已启动",parallelTaskDebugMetricFinished:"已完成",parallelTaskDebugMetricFailed:"失败",parallelTaskDebugMetricCancelled:"已取消",parallelTaskDebugMetricTimeout:"超时",parallelTaskDebugMetricCacheHit:"缓存命中",parallelTaskDebugLaneRequestMainThread:"请求主线程",parallelTaskDebugLaneHostBackground:"Host 后台",parallelTaskDebugLaneHelperProcess:"Helper 进程",parallelTaskDebugLaneExternalProcess:"外部进程",parallelTaskDebugEventEnqueued:"入队",parallelTaskDebugEventDeduped:"去重复用",parallelTaskDebugEventStarted:"开始",parallelTaskDebugEventFinished:"完成",parallelTaskDebugEventFailed:"失败",parallelTaskDebugEventCancelled:"取消",parallelTaskDebugEventTimeout:"超时",parallelTaskDebugEventCacheHit:"命中缓存",parallelTaskDebugTaskStatusQueued:"排队中",parallelTaskDebugTaskStatusRunning:"运行中",parallelTaskDebugTaskStatusSucceeded:"已成功",parallelTaskDebugTaskStatusFailed:"已失败",parallelTaskDebugTaskStatusCancelled:"已取消",parallelTaskDebugTaskStatusTimeout:"已超时"},shell:{title:"工作台",subtitle:"管理代码项目里的 AI 会话",mobileWorkspacesEntry:"工作区",mobileTerminalsEntry:"终端",mobileSessionsEntry:"对话",mobileToolsEntry:"工具",mobileSettingsEntry:"设置",mobileNavigationAction:"打开工作台菜单",mobileSearchAction:"打开搜索",mobileAuxiliaryAction:"打开工具面板",mobileRevealNavigationAction:"显示主导航",mobileHideNavigationAction:"收起主导航",mobileConversationPreviewTitle:"快速预览",mobileConversationCurrentWorkspaceSection:"当前工作区",mobileConversationCollapsePreviewAction:"收起预览",mobileConversationRestorePreviewAction:"恢复会话预览",iosMoreAction:"更多操作",androidMoreAction:"更多操作",conversationEntry:"对话",terminalsEntry:"终端",butlerEntry:"助手",globalNotificationsAction:"通知",globalNotificationsUnreadAria:"未读通知 {count}",globalNotificationsPanelTitle:"通知中心",globalNotificationsPanelDescription:"这里集中看需要你拍板、代办分析结果、跟进状态和验证失败的提醒。",globalNotificationsEmpty:"当前没有新的全局通知。",globalNotificationsShowArchived:"显示已归档通知",globalNotificationsArchiveAction:"归档",globalNotificationsRemoveArchiveAction:"移除归档",globalNotificationsArchiveFailed:"通知归档更新失败",globalNotificationKindWaitingUser:"等待你决定",globalNotificationKindTodoAnalyzed:"代办分析完成",globalNotificationKindTodoAnalyzeFailed:"代办分析失败",globalNotificationKindFollowUpFailed:"跟进失败",globalNotificationKindFollowUpCompleted:"跟进完成",globalNotificationKindVerificationFailed:"验证失败",globalNotificationTodoAnalyzedTitle:"代办分析完成:{title}",globalNotificationTodoAnalyzeFailedTitle:"代办分析失败:{title}",globalNotificationFollowUpWaitingTitle:"需要你决定:{title}",globalNotificationFollowUpFailedTitle:"跟进失败:{title}",globalNotificationFollowUpCompletedTitle:"跟进完成:{title}",globalNotificationVerificationFailedTitle:"验证失败:{title}",globalNotificationVerificationFailedFallback:"最近一次验证没有通过,请尽快查看。",searchEntry:"搜索",butlerInitTitle:"初始化助手",butlerInitDescription:"先设置助手的称呼、provider 和工作方式。助手工作目录和第一版 AGENTS.md 会由系统自动创建。",butlerInitPreviewTitle:"当前预览",butlerInitPreviewDescription:"这不是花架子,下面这些选择会直接决定首版规则的语气和汇报方式。",butlerInitBasicsTitle:"基础设置",butlerInitBasicsDescription:"先把名字、provider 和规则载体定下来,别让初始化阶段长成配置地狱。",butlerInitPersonaTitle:"表达方式",butlerInitPersonaDescription:"语气、语言和总结风格决定它怎么说,不决定它会不会胡来。",butlerInitPreferenceTitle:"默认偏好",butlerInitPreferenceDescription:"这里控制它默认先盯什么风险、先汇报什么结果。",butlerInitRuleLabel:"规则载体",butlerInitTipAutoWorkspace:"系统会自动创建助手目录和首版 AGENTS.md,你现在只需要定默认偏好。",butlerInitTipProviderSwitch:"Provider 后续还能切,不用在第一次初始化时把自己困死。",butlerInitTipReportPriority:"汇报优先级会影响它先告诉你风险、阻塞,还是验证结果。",butlerDisplayNameLabel:"助手称呼",butlerDisplayNamePlaceholder:"例如:阿尔文、小助手",butlerDisplayNameHint:"这是助手的自称,系统会写入 AGENTS.md 首版规则。",butlerProviderLabel:"Provider",butlerWorkspacePathLabel:"助手工作目录",butlerWorkspacePathPlaceholder:"例如:/Users/you/WorkFile/butler-home",butlerAgentsModeLabel:"AGENTS 模式",butlerAgentsModeInline:"内联",butlerAgentsModeFile:"文件",butlerAgentsModeInlineDescription:"内联:系统按你的初始化选项生成规则,后续由系统管理为主。",butlerAgentsModeFileDescription:"文件:系统会在助手独立工作目录下写入 AGENTS.md,后续可以直接改这个文件。",butlerAgentsFilePathLabel:"AGENTS.md 文件路径",butlerAgentsFilePathPlaceholder:"例如:/Users/you/WorkFile/butler-home/AGENTS.md",butlerAgentsContentLabel:"AGENTS 规则内容",butlerAgentsContentPlaceholder:"输入助手的工作规则和解答风格",butlerAgentsContentHint:"这里维护助手的正式规则正文,保存后会直接回写 Butler 专用 AGENTS.md 或内联规则。",butlerPersonaToneLabel:"语气",butlerPersonaLanguageLabel:"使用语言",butlerPersonaSummaryStyleLabel:"总结风格",butlerFocusRiskPreferenceLabel:"风险倾向",butlerFocusReportPriorityLabel:"汇报优先级(逗号分隔)",butlerFocusReportPriorityPlaceholder:"例如:risk,blocker,verification",butlerToneDirect:"直接明确",butlerToneSteady:"稳健克制",butlerToneFriendly:"友好耐心",butlerLanguageZhCn:"中文优先",butlerLanguageEnUs:"英文优先",butlerLanguageBilingual:"中英双语",butlerSummaryBrief:"简明扫一眼",butlerSummaryStructured:"分段清晰",butlerSummaryThorough:"详细展开",butlerRiskConservative:"保守稳妥",butlerRiskBalanced:"推进/风险平衡",butlerRiskProactive:"主动预警",butlerReportPriorityPresetLabel:"汇报优先级",butlerReportRiskFirst:"风险优先",butlerReportBlockerFirst:"阻塞优先",butlerReportVerificationFirst:"验证优先",butlerReportProgressFirst:"进展优先",butlerSummaryDebounceLabel:"会话摘要防抖",butlerSummaryDebounceOption1Minute:"1 分钟",butlerSummaryDebounceOption3Minutes:"3 分钟",butlerSummaryDebounceOption5Minutes:"5 分钟(默认)",butlerSummaryDebounceOption10Minutes:"10 分钟",butlerSummaryDebounceOption15Minutes:"15 分钟",butlerSummaryDebounceOption30Minutes:"30 分钟",butlerSettingsTitle:"助手设置",butlerSettingsSaveAction:"保存设置",butlerSettingsSaving:"保存中...",butlerSettingsSaved:"助手设置已保存",butlerSettingsSaveFailed:"保存助手设置失败",butlerInitSubmitting:"初始化中...",butlerInitSubmit:"完成初始化",butlerInitSuccess:"助手初始化成功",butlerInitFailed:"助手初始化失败",butlerInitNameRequired:"请先输入助手称呼",butlerInitWorkspaceRequired:"请先填写助手工作目录",butlerInitAgentsFileRequired:"文件模式下请填写 AGENTS.md 路径",butlerWorkbenchTitle:"助手工作台",butlerWorkbenchSubtitle:"在这里与助手对话,并查看聚合上下文和动作事件。",butlerWorkspaceHint:"助手工作目录:{workspacePath}",butlerDisplayNameActiveHint:"当前助手称呼:{displayName}",butlerNewSessionAction:"新建会话",butlerNewSessionStarted:"已为助手新建会话",butlerNewSessionFailed:"新建助手会话失败",butlerRefreshAction:"刷新",butlerHistoryAction:"历史消息",butlerHistoryTitle:"助手历史消息",butlerHistoryDescription:"这里保留所有 Butler 会话,代办分析和普通聊天都会持久化保存。",butlerHistoryEmpty:"还没有助手历史会话。",butlerHistoryOpenAction:"打开这条会话",butlerCurrentSessionBadge:"当前会话",butlerControlSessionKindChat:"普通聊天",butlerControlSessionKindTodoAnalysis:"代办分析",butlerLoadingTitle:"助手页面加载中",butlerLoadingDescription:"正在整理当前助手的会话、摘要和控制状态,请稍候。",butlerSidebarInfoTab:"信息",butlerSidebarAutomationTab:"自动化",butlerSidebarSettingsTab:"设置",butlerSidebarTabsLabel:"助手信息栏标签",butlerSidebarLoadFailed:"助手信息栏读取失败",butlerInfoContextTitle:"当前上下文",butlerInfoContextDescription:"这里先告诉你助手这一轮正在看什么,不把无关信息一股脑塞进来。",butlerInfoCurrentScopeLabel:"当前范围",butlerInfoCurrentScopeProject:"项目:{projectName}",butlerInfoCurrentScopeGlobal:"全局总览",butlerInfoManagedProjectsLabel:"已跟踪项目",butlerInfoManagedProjectsValue:"活跃 {activeCount} / 全部 {totalCount}",butlerInfoCurrentContextProjectHint:"当前已经切到 {projectName},助手后续补查会优先围绕这个项目展开。",butlerInfoCurrentContextGlobalHint:"当前还是全局视角,只有你点进项目或追问细节时,助手才继续补查更深的信息。",butlerInfoProjectSelectedAction:"当前已选中",butlerInfoProjectViewAction:"查看这个项目",butlerInfoProjectBlockedBadge:"有阻塞",butlerInfoProjectRiskBadge:"风险:{riskLevel}",butlerInfoProjectRiskShortBadge:"风险 {riskLevel}",butlerInfoProjectLastActivityBadge:"最近活跃:{updatedAt}",butlerInfoLatestSessionAction:"打开最近会话",butlerInfoProgressTitle:"当前进展",butlerInfoAttentionTitle:"需要留意",butlerInfoNextStepTitle:"建议下一步",butlerInfoFollowUpRecordsTitle:"会话跟进",butlerInfoFollowUpRecordsDescription:"这里只显示最近 5 条会话跟进状态,完整历史通过按钮展开查看。",butlerInfoFollowUpRecordsEmpty:"还没有会话跟进记录。",butlerInfoFollowUpUntitled:"未命名会话",butlerInfoFollowUpFallback:"最近更新时间:{updatedAt}",butlerFollowUpHistoryAction:"查看历史",butlerFollowUpHistoryTitle:"会话跟进历史",butlerFollowUpHistoryDescription:"这里查看完整的会话跟进状态历史,并可继续下钻轮次详情。",butlerInfoVerificationRecordsTitle:"会话验证",butlerInfoVerificationRecordsDescription:"这里看全局的功能验证记录。",butlerInfoVerificationRecordsEmpty:"还没有会话验证记录。",butlerInfoVerificationFallback:"当前状态:{status}",butlerInfoTodoRecordsTitle:"代办进度",butlerInfoTodoRecordsDescription:"这里看当前汇总出来的代办推进情况。",butlerInfoTodoRecordsEmpty:"还没有代办进度记录。",butlerInfoShowCompletedAction:"显示已完成记录",butlerInfoTodoItemTitle:"代办 {index}",butlerInfoTodoPending:"待处理",butlerInfoTodoInProgress:"进行中",butlerInfoTodoClosed:"已关闭",butlerTodoLifecyclePending:"待分析",butlerTodoLifecycleAnalyzing:"分析中",butlerTodoLifecycleAnalyzed:"已生成提示词",butlerTodoLifecycleSessionCreated:"已创建会话",butlerTodoLifecycleFollowUpActive:"助手处理中",butlerTodoLifecycleCompleted:"已完成",butlerTodoLifecycleFailed:"处理失败",butlerTodoLifecycleEmpty:"这条代办还没有生成分析摘要。",butlerTodoPromptPreviewAction:"查看开发提示词",butlerTodoAnalyzeAction:"分析仓库",butlerTodoReanalyzeAction:"重新分析",butlerTodoAnalyzeRunning:"分析中...",butlerTodoAnalyzeQueued:"已加入后台分析队列",butlerTodoAnalyzeSucceeded:"已生成开发提示词",butlerTodoAnalyzeFailed:"代办仓库分析失败",butlerTodoAnalyzeFirstAction:"先分析代办",butlerTodoWaitForPromptAction:"等待分析完成",butlerTodoStartSessionAction:"创建会话",butlerTodoStartSessionRunning:"创建中...",butlerTodoCopyPromptAction:"复制提示词",butlerTodoOpenSessionAction:"打开会话",butlerTodoCopyPromptSucceeded:"开发提示词已复制",butlerTodoStartSessionSucceeded:"已为代办创建开发会话",butlerTodoStartSessionFailed:"代办会话创建失败",butlerAutomationTasksTitle:"自动化任务",butlerAutomationTasksDescription:"这里只看自动化任务本身:有哪些任务、现在什么状态、下一次什么时候运行。",butlerAutomationTasksEmpty:"当前还没有自动化任务。",butlerAutomationRunsTitle:"最近运行记录",butlerAutomationRunsDescription:"这里只看自动化任务最近执行了什么,以及每次运行的结果。",butlerAutomationRunsEmpty:"最近还没有自动化运行记录。",butlerAutomationStatusActive:"进行中",butlerAutomationStatusWaitingUser:"等你决定",butlerAutomationStatusCompleted:"已完成",butlerAutomationStatusFailed:"失败",butlerAutomationStatusCancelled:"已取消",butlerAutomationTaskTypeLabel:"任务类型",butlerAutomationTaskTypeManual:"手动计划任务",butlerAutomationTaskTypeInterval:"定时计划任务",butlerAutomationTaskTypeCron:"Cron 计划任务",butlerAutomationTaskTypeFollowUp:"条件跟进任务",butlerAutomationTaskEnabled:"已启用",butlerAutomationTaskDisabled:"已停用",butlerAutomationTaskLastRunLabel:"最近运行",butlerAutomationTaskNextRunLabel:"下一次运行",butlerAutomationRunSourceLabel:"来源",butlerAutomationRunSourcePatrol:"计划任务运行",butlerAutomationRunSourceFollowUp:"条件跟进运行",butlerAutomationRunSummaryLabel:"运行结果",butlerAutomationRunProcessedAtLabel:"运行时间",butlerAutomationRunEmptySummary:"本次运行没有返回摘要。",butlerAutomationPatrolRunTitle:"巡视任务运行",butlerAutomationObjectiveLabel:"当前目标",butlerAutomationLatestAssessmentLabel:"最近判断",butlerAutomationWaitingReasonLabel:"等你决定什么",butlerAutomationNextCheckLabel:"下一次查看",butlerAutomationFinishedAtLabel:"结束时间",butlerAutomationViewRoundsAction:"查看每轮详情",butlerAutomationRoundDetailsTitle:"跟进轮次详情",butlerAutomationRoundDetailsDescription:"查看这个跟进任务每一轮的判断和动作。",butlerAutomationRoundLoading:"正在读取跟进轮次详情...",butlerAutomationRoundLoadFailed:"读取跟进轮次详情失败",butlerAutomationRoundEmpty:"当前还没有可展示的跟进轮次详情。",butlerAutomationRoundLabel:"第 {round} 轮",butlerAutomationRoundProcessedAtLabel:"处理时间",butlerAutomationRoundStatusLabel:"任务状态",butlerAutomationRoundObservedStateLabel:"会话运行状态",butlerAutomationRoundSummaryLabel:"这一轮判断",butlerAutomationRoundWaitingReasonLabel:"等待原因",butlerAutomationRoundPromptLabel:"代理发送内容",butlerAutomationRoundKindStarted:"开始跟进",butlerAutomationRoundKindContinue:"已直接续接",butlerAutomationRoundKindQueued:"已进入消息队列",butlerAutomationRoundKindWaitingUser:"等待用户处理",butlerAutomationRoundKindCompleted:"确认完成",butlerAutomationRoundKindFailed:"跟进失败",butlerAutomationRoundKindCancelled:"手动终止",butlerAutomationRoundKindLimitReached:"达到轮数上限",butlerInboxAction:"收件箱",butlerInboxModalTitle:"收件箱",butlerInboxModalDescription:"在这里记录项目代办,并按项目维护当前推进情况。",butlerInboxLoading:"正在读取收件箱...",butlerInboxLoadFailed:"收件箱读取失败",butlerInboxProjectsEmpty:"还没有可绑定的项目,请先在管家里管理项目。",butlerInboxEmpty:"还没有收件箱记录。",butlerInboxCreateTitle:"新增代办",butlerInboxEditingTitle:"编辑代办",butlerInboxFormDescription:"每条代办都必须绑定到一个项目,后续助手才能围绕它继续跟进。",butlerInboxListTitle:"当前代办",butlerInboxListDescription:"这里会列出你管理的项目代办,方便统一收口处理。",butlerInboxShowClosedAction:"显示已关闭",butlerInboxQuickStatusLabel:"快速设置进度",butlerInboxProjectLabel:"绑定项目",butlerInboxTypeLabel:"类型",butlerInboxTitleLabel:"标题",butlerInboxTitlePlaceholder:"例如:登录页验证码收尾",butlerInboxContentLabel:"内容",butlerInboxContentPlaceholder:"写清楚当前问题、目标或你希望助手后续继续推进的点。",butlerInboxStatusLabel:"进度",butlerInboxTypeTask:"任务",butlerInboxTypeBug:"缺陷",butlerInboxTypeFeature:"新功能",butlerInboxTypeChange:"修改",butlerInboxStatusPending:"待处理",butlerInboxStatusInProgress:"进行中",butlerInboxStatusClosed:"已关闭",butlerInboxCreateAction:"新增代办",butlerInboxUpdateAction:"保存修改",butlerInboxCancelEditAction:"取消编辑",butlerInboxEditAction:"编辑",butlerInboxDeleteAction:"删除",butlerInboxCreated:"代办已新增",butlerInboxUpdated:"代办已更新",butlerInboxDeleted:"代办已删除",butlerInboxSaveFailed:"代办保存失败",butlerInboxDeleteFailed:"代办删除失败",butlerProviderSwitched:"Provider 已切换",butlerProviderSwitchedDescription:"已切换到 {provider},当前视图已重置并重新加载。",butlerProviderSwitchFailed:"Provider 切换失败",butlerAttachmentUnsupported:"助手对话暂不支持附件",butlerOverviewTitle:"整体情况",butlerOverviewDescription:"这里会先帮你整理当前最值得关注的内容。",butlerMetricProjectCount:"项目",butlerMetricBlockedCount:"阻塞",butlerMetricHighRiskCount:"高风险",butlerTopRisksTitle:"优先风险",butlerNextActionsTitle:"建议动作",butlerOverviewEmpty:"暂无",butlerOverviewLoading:"正在读取助手聚合摘要...",butlerEventsTitle:"最近操作",butlerEventsDescription:"助手最近帮你做过什么,这里会记下来。",butlerEventsEmpty:"暂无动作事件",butlerLoadFailed:"助手工作台加载失败",butlerContextStrategyTitle:"按需上下文",butlerContextStrategyDescription:"默认只给助手全局摘要,只有你点到某个项目时,才再向后端补拉该项目的会话、记忆、巡视和验证摘要。",butlerConversationTitle:"与助手对话",butlerConversationDescription:"这个对话窗口只属于 {displayName}。需要细节时,{displayName} 会先用聚合摘要回答,再按需直达后端补查具体项目、会话、巡视或验证信息。",butlerComposerPlaceholder:"直接对 {displayName} 说你现在想搞清楚什么",butlerProjectsTitle:"项目",butlerProjectsDescription:"选一个项目,助手就会继续帮你查它的进展和记录。",butlerProjectsEmpty:"暂无可下钻的项目",butlerProjectWorkspaceLabel:"所属工作区:{workspaceId}",butlerProjectSummaryEmpty:"暂无可用摘要",butlerProjectOpenDetailAction:"查看详情",butlerProjectSyncAction:"同步到时间线",butlerProjectSyncSucceeded:"已把项目 {projectName} 同步到助手时间线",butlerProjectActionRequiresSession:"先和助手说一句话,然后再让它继续处理项目。",butlerProjectContextTitle:"当前项目",butlerProjectContextDescription:"这里会显示这个项目的会话、记录和结果。",butlerProjectContextEmpty:"先从上面的项目列表或动作事件里选一个项目。",butlerProjectContextLoading:"正在读取项目关联信息...",butlerProjectContextMeta:"项目状态:{status} · 风险级别:{riskLevel}",butlerProjectActionSucceeded:"助手动作已执行",butlerProjectActionFailed:"助手动作失败",butlerProjectActionPending:"处理中...",butlerProjectSessionsTitle:"项目会话",butlerProjectMemoriesTitle:"项目记忆",butlerProjectPatrolsTitle:"巡视记录",butlerProjectVerificationsTitle:"验证记录",butlerProjectOpenConversationAction:"打开真实会话",butlerProjectResumeAction:"续接会话",butlerProjectResumeSucceeded:"已续接会话:{sessionTitle}",butlerProjectStartPatrolAction:"发起巡视",butlerProjectPatrolSucceeded:"已为 {projectName} 发起巡视",butlerProjectStartVerificationAction:"发起验证",butlerProjectVerificationSucceeded:"已为 {projectName} 发起验证",butlerProjectMemoryMeta:"类型:{memoryType} · 状态:{status}",butlerProjectSessionMeta:"角色:{role} · 状态:{status}",butlerProjectPatrolMeta:"状态:{status} · 风险:{riskLevel}",butlerProjectVerificationMeta:"类型:{verificationType} · 状态:{status}",butlerProjectRunSummaryEmpty:"暂无摘要",butlerProjectFocusAction:"定位这条记录",butlerProjectUpdatedAtLabel:"更新时间:{updatedAt}",butlerFocusedBadge:"当前定位",searchModalTitle:"搜索",searchModalDescription:"支持搜会话标题,或在当前工作区里搜代码文件。",searchModeLabel:"搜索模式",searchModeSessions:"会话",searchModeCode:"代码",searchKeywordLabel:"关键词",searchWorkspaceLabel:"工作区",searchSessionPlaceholder:"输入会话名称、工作区或 provider",searchCodePlaceholder:"输入文件名或路径片段",searchSessionHint:"输入关键词后,这里会立即列出匹配的会话。",searchCodeHint:"选一个工作区,然后搜文件名或路径。",searchSessionEmpty:"没找到匹配的会话。",searchCodeEmpty:"没找到匹配的文件。",searchCodeFailed:"代码搜索失败,请稍后重试。",searchSubmit:"开始搜索",filesEntry:"文件",gitEntry:"GIT",terminalManagerEntry:"进程管理",workspaceSectionTitle:"工作区",goBack:"后退",goForward:"前进",workspaceCount:"项目",sessionCount:"会话",manageWorkspaceAction:"管理项目",manageWorkspaceTitle:"管理项目",manageWorkspaceDescription:"默认只列出当前已加载的项目,展开后可以查看路径、Git 摘要、代码类型组成,也可以从当前工作台列表里移除。",manageWorkspaceImportAction:"导入项目",manageWorkspaceCloneAction:"Clone项目",manageWorkspaceEmpty:"当前没有可管理的项目。",manageWorkspaceLoading:"正在读取项目详情...",manageWorkspaceLoadFailed:"项目详情加载失败",manageWorkspacePathLabel:"路径",manageWorkspaceGitCommitCount:"Git 提交版本数",manageWorkspaceGitInfoLabel:"Git 仓库信息",manageWorkspaceRepoRoot:"仓库根目录",manageWorkspaceCurrentBranch:"当前分支",manageWorkspaceRemoteLabel:"远程",manageWorkspaceNoRemote:"未配置远程",manageWorkspaceNotGit:"当前项目不是 Git 仓库。",manageWorkspaceCodeCompositionLabel:"代码类型组成",manageWorkspaceCodeCompositionFiles:"文件",manageWorkspaceCodeCompositionOther:"其他",manageWorkspaceNoCodeComposition:"暂时没有识别到可统计的代码文件。",manageWorkspaceCodeTruncated:"文件过多,只统计了前 {count} 个可识别文件。",manageWorkspaceColorLabel:"背景颜色",manageWorkspaceColorSelectSwatch:"使用颜色 {color}",manageWorkspaceColorClearAction:"清除颜色",manageWorkspaceColorUnset:"未设置,当前使用默认颜色",manageWorkspaceColorSaveFailed:"工作区颜色保存失败",manageWorkspaceRemoveAction:"移除项目",manageWorkspaceRemoving:"移除中...",manageWorkspaceRemoveSuccess:"项目已从当前工作台移除",manageWorkspaceRemoveFailed:"移除项目失败",manageWorkspaceRemoveConfirmTitle:"确认移除项目",manageWorkspaceRemoveConfirmDescription:"这只会把项目从当前工作台列表移除,不会删除任何磁盘数据或历史记录。后续重新加载同一路径时,旧记录会直接恢复显示。",manageWorkspaceRemoveConfirmTarget:"确定移除「{name}」吗?",manageWorkspaceRemoveConfirmAction:"确认移除",importWorkspaceTitle:"添加项目",importWorkspaceHint:"导入本地代码目录",importExpand:"展开",importCollapse:"收起",importPathLabel:"项目路径",importPathPlaceholder:"输入项目文件夹路径",importNameLabel:"项目名称",importNamePlaceholder:"可选",importSubmit:"添加项目",importSubmitting:"添加中...",importChooseFolder:"选择文件夹",importPickFolderFailed:"打开文件夹选择器失败",importDesktopDropHint:"支持把本地项目文件夹直接拖到这个区域",importHint:"输入本地代码目录后就能开始工作",importServerDirectoryHint:"浏览并选择运行服务器上的项目目录",importBrowserTitle:"选择服务器目录",importBrowserDescription:"这里浏览的是项目运行所在服务器上的目录,不是当前设备的本地目录。",importBrowserCurrentPath:"当前目录",importBrowserRoots:"根目录",importBrowserOpenParent:"返回上一级",importBrowserOpenPath:"打开路径",importBrowserCreateDirectory:"新建文件夹",importBrowserCreateDirectoryTitle:"新建文件夹",importBrowserCreateDirectoryDescription:"只在当前服务器目录下新建一层子文件夹,不接受带路径的输入。",importBrowserCreateDirectoryLabel:"文件夹名称",importBrowserCreateDirectoryPlaceholder:"输入新文件夹名称",importBrowserCreateDirectorySuccess:"文件夹已创建",importBrowserCreateDirectoryFailed:"新建文件夹失败",importBrowserCreateDirectorySubmit:"确认新建",importBrowserCreatingDirectory:"新建中...",importBrowserEmpty:"当前目录下没有可选的子目录",importBrowserBrowseFailed:"加载服务器目录失败",importBrowserSubmit:"导入当前目录",importPathRequired:"请输入项目路径",importSuccess:"项目已添加",importFailed:"添加失败",cloneWorkspaceTitle:"Clone项目",cloneWorkspaceHint:"从 Git 仓库拉取代码到服务端目录,完成后直接加入项目列表。",cloneSubmit:"Clone项目",cloneSubmitting:"Clone 中...",cloneRepositoryLabel:"Git 仓库地址",cloneRepositoryPlaceholder:"例如:https://github.com/org/repo.git",cloneParentPathLabel:"目标父目录",cloneParentPathPlaceholder:"选择后端服务上已存在的目录",cloneDirectoryNameLabel:"新项目目录名",cloneDirectoryNamePlaceholder:"留空时默认使用仓库名",clonePickDirectory:"选择目录",cloneAuthModeLabel:"认证方式",cloneAuthModeNone:"无认证",cloneAuthModeBasic:"用户名 + 密码",cloneAuthModeToken:"Token",cloneUsernameLabel:"用户名",cloneUsernamePlaceholder:"输入 Git 用户名",clonePasswordLabel:"密码",clonePasswordPlaceholder:"输入 Git 密码",cloneTokenLabel:"Token",cloneTokenPlaceholder:"输入 access token",cloneTokenUsernamePlaceholder:"可选,留空时默认使用 git",cloneRepoRequired:"请输入 Git 仓库地址",clonePathRequired:"请选择目标父目录",cloneSuccess:"项目已成功 Clone",cloneFailed:"Clone 失败",cloneHint:"目标父目录必须已经存在,Clone 时会在这个目录下新建仓库文件夹。",cloneBrowserTitle:"选择 Clone 目标父目录",cloneBrowserDescription:"这里选的是服务端已存在的父目录,Clone 时会在其下新建一个项目文件夹。",cloneBrowserSubmit:"使用当前目录",refreshNavigation:"刷新",desktopChromeLabel:"桌面工作台",windowMinimize:"最小化窗口",windowMaximize:"最大化或还原窗口",windowClose:"关闭窗口",contextOpenSession:"打开会话",navigationLoadFailed:"加载失败,请重试",emptyNavigationTitle:"还没有项目",emptyNavigationBody:"添加本地代码目录开始工作",emptyWorkspaceSessions:"暂无会话",favoriteSectionTitle:"收藏会话",favoriteSectionEmpty:"收藏后的会话会固定放在这里,方便你快速回到常用链路。",worktreeSectionTitle:"子工作树",worktreeSectionExpand:"展开子工作树",worktreeSectionCollapse:"收起子工作树",worktreeMergePanelLabel:"工作树合并",worktreeMergePanelTitle:"合回直接父工作区",worktreeMergeExpandDetails:"展开详情",worktreeMergeCollapseDetails:"收起详情",worktreeMergePreviewAction:"预检",worktreeMergePreviewRefresh:"预检",worktreeMergePreviewIdle:"尚未预检",worktreeMergePreviewLoading:"预检中...",worktreeMergeReady:"可以合并",worktreeMergeBlocked:"当前不能合并",worktreeMergeApplying:"合并中...",worktreeMergeApplyAction:"合并",worktreeMergeApplySuccess:"子工作树已经合回直接父工作区",worktreeMergeApplyFailed:"合并子工作树失败",worktreeMergePreviewFailed:"读取工作树合并预检失败",worktreeMergeAlreadyMerged:"已合回直接父工作区",worktreeMergeMergedHint:"代码已经合回直接父工作区,下一步可以继续做清理。",worktreeMergeMergedDirtyHint:"提交历史已经同步到父工作区,但当前子工作树还有未处理事项,暂时不能清理。",worktreeMergeChecklistTitle:"合并检查清单",worktreeMergeChecklistSourceState:"工作树状态正常",worktreeMergeChecklistSourceStateBlocked:"当前子工作树状态异常,系统暂时没有把它当作活跃工作树",worktreeMergeChecklistSourceClean:"子工作区已清理",worktreeMergeChecklistSourceCleanBlocked:"当前子工作树存在未提交改动,请先提交",worktreeMergeChecklistTargetClean:"父工作区可接收合并",worktreeMergeChecklistTargetCleanBlocked:"直接父工作区存在未提交改动,不能接收合并",worktreeMergeChecklistChildren:"没有活跃子工作树",worktreeMergeChecklistChildrenBlocked:"当前子工作树下面还有活跃子节点,必须先从叶子节点开始回收",worktreeMergeChecklistCommits:"存在待合并提交",worktreeMergeChecklistCommitsBlocked:"当前子工作树没有领先父工作区的提交",worktreeMergeChecklistConflicts:"合并不会产生冲突",worktreeMergeChecklistConflictsBlocked:"检测到合并冲突,先处理冲突后再继续",worktreeMergeChecklistResultPending:"等待预检结果",worktreeMergeChecklistResultReady:"可以执行合并",worktreeMergeChecklistResultReadyDetail:"所有条件已满足,可以开始合并",worktreeMergeChecklistResultBlocked:"暂时不能执行合并",worktreeMergeChecklistResultBlockedDetail:"上面的阻塞项解决后,才可以继续",worktreeMergeChecklistResultMerged:"已完成合并,可继续清理",worktreeMergeCompactPending:"待预检",worktreeMergeCompactChecking:"预检中",worktreeMergeCompactReady:"可合并",worktreeMergeCompactBlocked:"受阻",worktreeMergeCompactMerged:"已合并",worktreeMergeCompactMerging:"合并中",worktreeMergeCompactCleaning:"清理中",worktreeMergeCompactInactive:"状态异常",worktreeMergeCompactDirty:"未提交",worktreeMergeCompactTargetDirty:"父区脏",worktreeMergeCompactConflict:"有冲突",worktreeMergeCompactChildren:"有子树",worktreeMergeCompactNoCommits:"无提交",worktreeCleanupAction:"清理",worktreeCleanupRunning:"清理中...",worktreeCleanupSuccess:"工作树已经清理完成",worktreeCleanupFailed:"清理工作树失败",worktreeCleanupModalTitle:"确认清理工作树",worktreeCleanupModalDescription:"默认只清理工作树目录和系统记录。只有分支已经合并进父分支后,才允许额外删除分支。",worktreeCleanupConfirm:"确认清理 {name} 吗?默认会保留 git 分支。",worktreeCleanupDeleteBranchLabel:"同时删除分支 {branch}",worktreeCleanupDeleteBranchHint:"只有分支已经合并进父分支后,才允许删除分支。",worktreeCleanupDeleteBranchAction:"清理并删除分支",worktreeCleanupDeleteBranchSuccess:"工作树和分支 {branch} 已清理完成",worktreeCleanupDeleteBranchPartialFailed:"工作树已清理,但分支 {branch} 删除失败",worktreeMergeCurrentBranch:"当前分支:{branch}",worktreeMergeParentBranch:"父分支:{branch}",worktreeMergeTargetWorkspace:"目标父工作区:{name}",worktreeMergeAheadBehindPending:"提交差异:待预检",worktreeMergeAheadBehind:"提交差异:领先 {ahead} / 落后 {behind}",worktreeMergeBaseCommit:"merge base:{commit}",worktreeMergeConflictLabel:"冲突文件",favoriteAction:"收藏会话",unfavoriteAction:"取消收藏",favoriteAdded:"会话已加入收藏",favoriteRemoved:"会话已取消收藏",favoriteToggleFailed:"收藏状态更新失败",sessionMoreAction:"更多操作",sessionStateInferred:"推断",renameAction:"重命名",renameSuccess:"会话名称已更新",renameFailed:"会话重命名失败",renameModalTitle:"重命名会话",renameModalDescription:"改成你自己能一眼认出来的名字,只改标题,不改消息内容。",renameInputLabel:"会话名称",renameInputPlaceholder:"输入新的会话名称",renamingSession:"保存中...",archiveFolderLabel:"归档会话",archiveFolderAction:"打开归档文件夹",archiveAction:"归档会话",archiveCurrentSessionAction:"归档当前会话",archiveAdded:"会话已归档",archiveConfirmTitle:"确认归档会话",archiveConfirmDescription:"归档后,这条会话会从当前工作区主列表里隐藏,你仍然可以在归档区恢复它。",unarchiveAction:"取消归档",archiveRestored:"会话已恢复到主列表",archiveModalTitle:"归档会话",archiveModalDescription:"这里列出当前项目暂时隐藏的会话,需要时可以恢复到主列表。",archiveEmpty:"这个项目还没有归档会话。",archiveViewAction:"查看归档会话",subagentBadge:"子代理",sessionForkSession:"会话分叉",sessionForkMessage:"消息分叉",sessionForkReconstructed:"重建分叉",subagentExpand:"展开子代理列表",subagentCollapse:"收起子代理列表",subagentExpandMore:"展开更多子会话",favoriteExpandMore:"显示更多收藏",sessionExpandMore:"显示更多会话",archiveExpandMore:"查看更多归档会话",worktreeCollapse:"收起工作树",worktreeExpand:"展开工作树",workspaceCollapse:"收起项目",workspaceExpand:"展开项目",reorderWorkspace:"拖拽调整项目顺序",switchWorkspace:"切换到此项目",workspaceReorderFailed:"项目排序保存失败",workspaceCollapseStateSaveFailed:"项目折叠状态保存失败",workspaceHomeSwitcherLabel:"切换工作区",workspaceHomeSwitcherTitle:"工作区",hostWorkspaceSwitcherTitle:"HOST 与工作区",hostSwitcherAriaLabel:"切换 HOST",hostSwitcherTitle:"HOST 切换",hostSwitcherCurrentBadge:"当前",hostSwitcherNodeBadge:"HOST",hostSwitcherAddAction:"新增 HOST",hostSwitcherNameLabel:"HOST 名称",hostSwitcherNamePlaceholder:"例如:办公室 Host",hostSwitcherUrlLabel:"HOST 地址",hostSwitcherUrlPlaceholder:"例如:http://192.168.1.20:3002",hostSwitcherSaveAction:"保存 HOST",hostSwitcherSwitching:"切换中",hostSwitcherWorkspaceCount:"{count} 个工作区",hostSwitcherWorkspaceCountWithUser:"{username} · {count} 个工作区",hostSwitchFailed:"切换 HOST 失败",hostSwitchUnreachable:"{name} 当前不可达",hostSwitchMissing:"目标 HOST 不存在",hostDeleteAction:"删除 HOST",hostDeleteAriaLabel:"删除 HOST {name}",hostDeleteBusy:"删除中",hostDeleteConfirm:"确定删除 HOST “{name}”吗?已保存的登录信息也会一起清理。",hostDeleteSuccess:"已删除 HOST:{name}",hostDeleteFailed:"删除 HOST 失败:{name}",hostAddIncompleteCredentials:"用户名和密码要么都填写,要么都留空",hostAddInvalidUrl:"HOST 地址无效",hostAddDuplicate:"这个 HOST 已经存在",hostAddFailed:"新增 HOST 失败",hostAddSuccess:"已新增 HOST:{name}",mobileWorktreeBadge:"工作树",workspaceHomeStatusSectionTitle:"当前工作区",workspaceHomeViewAllAction:"查看全部会话",workspaceHomeMetricActive:"活动",workspaceHomeMetricUnread:"通知",workspaceHomeMetricTerminal:"终端",workspaceHomeMetricChanges:"变更",workspaceHomeActiveSessionsSectionTitle:"活动会话",workspaceHomeQuickLaunchStatusLabel:"快捷启动进程",workspaceHomeQuickLaunchRunning:"运行中",workspaceHomeQuickLaunchStopped:"未运行",workspaceHomeWaitingInputLabel:"等待输入",workspaceHomeButlerLabel:"助手",mobileButlerEntry:"助手",mobileConversationToolCloseAction:"返回对话",mobileConversationToolTabsLabel:"文件、Git 与进程标签",mobileConversationToolProcessesTab:"进程",mobileButlerEmptyTitle:"助手还没准备好",mobileButlerEmptyBody:"当前还没有完成助手初始化,先在桌面端做完首轮初始化,再回到手机端看跟进和自动化。",butlerProjectSyncEmptyState:"直接给助手一句明确目标,它就会在这里继续推进当前工作。",mobileButlerSummaryTitle:"当前工作区摘要",mobileButlerSummaryProjects:"项目",mobileButlerSummaryFollowUps:"进行中任务",mobileButlerSummaryWaitingUser:"待你处理",mobileButlerSummaryInbox:"未完成代办",mobileButlerAssistantWorkspaceLabel:"助手工作目录",mobileButlerAssistantToneLabel:"沟通风格",mobileButlerAssistantLanguageLabel:"工作语言",mobileButlerAssistantUpdatedAtLabel:"最近更新",workspaceOverviewTitle:"把项目入口放到看得见的地方",workspaceOverviewBody:"先选项目,再决定是继续已有会话,还是开一条新的工作链路。",workspaceListBody:"这里保留当前工作台里的全部项目,并把高频操作直接放到首页。",workspaceDetailTitle:"项目详情",workspaceDetailSummaryTitle:"项目概览",workspaceDetailSummaryBody:"先看当前项目路径、Git 摘要和代码规模,再决定下一步去哪做事。",workspaceDetailMissingTitle:"没找到这个项目",workspaceDetailMissingBody:"这个项目可能已经被移除,或者当前快照还没加载到它。",workspaceDetailDebugTitle:"服务状态",manageWorkspaceDebugDescription:"查看当前项目里的服务识别结果、最近一次启动情况和支持说明。",workspaceDetailDebugAnalyzeFailed:"读取服务状态失败",workspaceDetailDebugFrameworkLabel:"识别类型",workspaceDetailDebugConfidenceLabel:"识别把握",workspaceDetailDebugCompatibilityLabel:"可用程度",workspaceDetailDebugInjectionLabel:"推荐处理方式",workspaceDetailDebugRuntimeStatusLabel:"当前状态",workspaceDetailDebugFailureStageLabel:"卡住位置",workspaceDetailDebugServiceDiscoveryLabel:"服务地址处理",workspaceDetailDebugHmrLabel:"热更新处理",workspaceDetailDebugCallbackLabel:"回调处理",workspaceDetailDebugAiFallbackLabel:"人工处理策略",workspaceDetailDebugFrameworkNoteLabel:"说明",workspaceDetailDebugReasonsLabel:"当前说明",workspaceDetailDebugFilesLabel:"参考文件",workspaceDetailDebugFailureStageEmpty:"暂无",workspaceDetailDebugRuntimeEmpty:"当前还没有运行记录。",workspaceDetailDebugFrameworkNoteEmpty:"当前没有额外兼容说明。",workspaceDetailDebugEmptyReasons:"暂无",workspaceDetailDebugEmptyFiles:"暂无",workspaceDetailDebugConfidenceHigh:"高",workspaceDetailDebugConfidenceMedium:"中",workspaceDetailDebugConfidenceLow:"低",workspaceDetailDebugCompatibilitySupported:"可以直接使用",workspaceDetailDebugCompatibilityConditional:"需要补充处理",workspaceDetailDebugCompatibilityUnsupported:"暂不建议直接使用",workspaceDetailDebugCompatibilityUnknown:"未知",workspaceDetailDebugInjectionCli:"启动参数",workspaceDetailDebugInjectionEnv:"环境变量",workspaceDetailDebugInjectionOverride:"调整启动命令",workspaceDetailDebugInjectionAiFallback:"需要人工辅助",workspaceDetailDebugInjectionNone:"暂不自动处理",workspaceDetailDebugRuntimePreparing:"准备中",workspaceDetailDebugRuntimeRunning:"运行中",workspaceDetailDebugRuntimeFailed:"启动失败",workspaceDetailDebugRuntimeStopped:"已停止",workspaceDetailDebugRuntimeNotStarted:"未启动",workspaceDetailDebugRequirementRequired:"需要补充",workspaceDetailDebugRequirementNotRequired:"不需要补充",workspaceDetailDebugAiPolicyNever:"不建议自动处理",workspaceDetailDebugAiPolicyConditional:"视情况处理",workspaceDetailDebugAiPolicyAllowed:"可以处理",workspaceDetailDebugRuntimeServicesTitle:"最近一次启动",workspaceDetailDebugRuntimeHistoryTitle:"最近几次启动记录",workspaceDetailDebugRuntimeHistoryTimeLabel:"启动时间",workspaceDetailDebugRuntimeHistoryServiceLabel:"涉及服务",workspaceDetailDebugRuntimeHistoryResultLabel:"结果",workspaceDetailDebugRuntimeHistoryTitleWithIndex:"启动记录 #{id}",workspaceDetailDebugRuntimeHistoryFailedSummary:"这次启动里,{services} 没有正常启动。",workspaceDetailDebugRuntimeHistoryGenericSummary:"这里保留最近几次启动结果,方便回看问题是否重复出现。",workspaceDetailDebugRuntimeHistoryNoServices:"暂无",workspaceDetailDebugRuntimeHistoryResultRunning:"仍在运行",workspaceDetailDebugRuntimeHistoryResultFailed:"启动失败",workspaceDetailDebugRuntimeHistoryResultStopped:"已结束",workspaceDetailDebugRuntimeHistoryResultPreparing:"准备中",workspaceDetailDebugRuntimeServicePortLabel:"分配端口",workspaceDetailDebugRuntimeServiceBindingLabel:"端口状态",workspaceDetailDebugRuntimeServiceProcessLabel:"服务进程",workspaceDetailDebugRuntimeServiceFailureLabel:"问题位置",workspaceDetailDebugRuntimeServiceAiLabel:"人工处理记录",workspaceDetailDebugDetectedServicesTitle:"识别到的服务",workspaceDetailDebugServicePathLabel:"所在位置",workspaceDetailDebugServiceFrameworkLabel:"识别结果",workspaceDetailDebugServiceCommandLabel:"启动方式",workspaceDetailDebugServiceRequirementsLabel:"需要补充处理",workspaceDetailDebugServiceActionLabel:"建议动作",workspaceDetailDebugOpenPageAction:"服务调试",workspaceDetailDebugPageTitle:"服务调试",workspaceDetailDebugPageDescription:"这里集中查看当前项目里的服务、最近一次启动情况和支持说明。",workspaceDetailDebugPageHeroEyebrow:"项目服务概览",workspaceDetailDebugOverallStatusLabel:"整体状态",workspaceDetailDebugOverallSummaryLabel:"整体说明",workspaceDetailDebugOverallStatusSupported:"可以直接启动",workspaceDetailDebugOverallStatusConditional:"部分服务还要补充设置",workspaceDetailDebugOverallStatusBlocked:"当前不建议整体直接启动",workspaceDetailDebugOverallSummaryEmpty:"暂时还没拿到可用的服务检查结果。",workspaceDetailDebugOverallSummaryMixed:"当前识别到 {webCount} 个网页服务,以及 {desktopCount} 个桌面壳服务。桌面壳服务会单独展示,不参与网页服务的自动处理。",workspaceDetailDebugOverallSummaryDesktopOnly:"当前识别到 {count} 个桌面壳服务,还没有明确识别出网页服务。",workspaceDetailDebugOverallSummaryWebOnly:"当前识别到 {count} 个可以参与网页调试的服务。",workspaceDetailDebugSummaryServiceCountLabel:"服务总数",workspaceDetailDebugSummaryWebCountLabel:"网页服务",workspaceDetailDebugSummaryDesktopShellCountLabel:"桌面壳服务",workspaceDetailDebugSummaryWebServicesChip:"{count} 个网页服务",workspaceDetailDebugSummaryDesktopShellChip:"{count} 个桌面壳",workspaceDetailDebugSummaryUnsupportedChip:"{count} 个阻断项",workspaceDetailDebugAutoInjectionEligible:"当前网页服务已经满足自动处理条件",workspaceDetailDebugAutoInjectionBlocked:"当前还不建议把整个项目当成可自动处理目标",workspaceDetailDebugDesktopShellSummaryHint:"桌面壳服务单独识别,不参与网页服务协调",workspaceDetailDebugCompatibilityBreakdown:"可直接使用 {supported} / 需要补充 {conditional} / 暂不建议 {unsupported}",workspaceDetailDebugLastAnalyzedAtLabel:"最近检查时间",workspaceDetailDebugTargetSourceRepo:"检查范围:仓库根目录",workspaceDetailDebugTargetSourceWorktree:"检查范围:当前工作树",workspaceDetailDebugRequirementsNone:"目前没有额外要求",workspaceDetailDebugServiceSectionDescription:"把项目拆成单个服务来看,方便确认哪些可以直接启动,哪些还要补充设置。",workspaceDetailDebugRuntimeSectionDescription:"这里只显示最近一次启动结果,方便快速确认是哪一个服务没有正常跑起来。",workspaceDetailDebugMatrixSectionDescription:"这里展示不同类型服务的默认支持情况,帮助你判断下一步怎么处理。",workspaceDetailDebugMatrixTitle:"支持说明",workspaceDetailDebugMatrixOpenAction:"查看支持矩阵",workspaceDetailDebugMatrixModalDescription:"把不同服务类型的默认支持情况放到一张矩阵里,别再靠长列表硬扫。",workspaceDetailDebugMatrixFrameworkHeader:"框架",workspaceDetailDebugMatrixCompatibilityHeader:"支持",workspaceDetailDebugMatrixInjectionHeader:"方式",workspaceDetailDebugMatrixDiscoveryHeader:"发现",workspaceDetailDebugMatrixHmrHeader:"HMR",workspaceDetailDebugMatrixCallbackHeader:"回调",workspaceDetailDebugMatrixAiHeader:"人工",workspaceDetailDebugMatrixNotesHeader:"说明",workspaceDetailDebugMatrixCompatibilitySupportedShort:"可直接",workspaceDetailDebugMatrixCompatibilityConditionalShort:"先补充",workspaceDetailDebugMatrixCompatibilityUnsupportedShort:"不建议",workspaceDetailDebugMatrixCompatibilityUnknownShort:"未知",workspaceDetailDebugMatrixInjectionCliShort:"参数",workspaceDetailDebugMatrixInjectionEnvShort:"环境",workspaceDetailDebugMatrixInjectionOverrideShort:"改命令",workspaceDetailDebugMatrixInjectionAiFallbackShort:"人工",workspaceDetailDebugMatrixInjectionNoneShort:"无",workspaceDetailDebugMatrixRequirementRequiredShort:"需处理",workspaceDetailDebugMatrixRequirementNotRequiredShort:"无需",workspaceDetailDebugMatrixAiNeverShort:"不处理",workspaceDetailDebugMatrixAiConditionalShort:"视情况",workspaceDetailDebugMatrixAiAllowedShort:"可处理",workspaceDetailDebugMatrixLegendSummary:"表格里的图标含义是:勾表示默认可过,警示表示启动前还要补设置,叉表示当前不建议自动处理。下面把短表头补成人话,省得你猜。",workspaceDetailDebugMatrixDiscoveryNote:"服务地址、代理、rewrites 这一类处理。",workspaceDetailDebugMatrixHmrNote:"热更新、前端开发长连这类处理。",workspaceDetailDebugMatrixCallbackNote:"登录回调、OAuth、Webhook 这类回调入口。",workspaceDetailDebugMatrixAiNote:"遇到边界情况时,是否允许转人工辅助。",workspaceDetailDebugFailureStageServiceDiscovery:"还缺少服务地址相关处理",workspaceDetailDebugFailureStageHmr:"还缺少热更新相关处理",workspaceDetailDebugFailureStageCallback:"还缺少回调处理",workspaceDetailDebugFailureStageAiFallbackRequired:"需要转人工处理",workspaceDetailDebugFailureStageAdapterSelection:"还没找到合适的启动方式",workspaceDetailDebugFailureStageLaunchRequirements:"启动前还有条件没有满足",workspaceDetailDebugFailureStageCommandExecution:"启动命令没有正常执行",workspaceDetailDebugFailureStageProcessExit:"服务启动后很快退出了",workspaceDetailDebugFailureStageProcessRuntimeError:"服务运行时出现错误",workspaceDetailDebugFailureStageStaleRuntimeBinding:"这次启动记录已经失效",workspaceDetailDebugFailureStageUnknown:"未知阶段({code})",workspaceDetailDebugBindingAllocated:"已分配",workspaceDetailDebugBindingListening:"可访问",workspaceDetailDebugBindingFailed:"未就绪",workspaceDetailDebugBindingReleased:"已释放",workspaceDetailDebugBindingUnknown:"未知",workspaceDetailDebugProcessCreating:"启动中",workspaceDetailDebugProcessRunning:"运行中",workspaceDetailDebugProcessClosed:"已结束",workspaceDetailDebugProcessError:"异常",workspaceDetailDebugProcessUnknown:"未知",workspaceDetailDebugPortEmpty:"暂无",workspaceDetailDebugRoleFrontend:"网页服务",workspaceDetailDebugRoleBackend:"后端服务",workspaceDetailDebugRoleWorker:"后台任务",workspaceDetailDebugRoleMock:"模拟服务",workspaceDetailDebugRoleDesktopShell:"桌面壳服务",workspaceDetailDebugRoleCustom:"自定义",workspaceDetailDebugServiceOverviewSupported:"这个服务已经识别清楚,按推荐方式处理后通常可以直接启动。",workspaceDetailDebugServiceOverviewConditional:"这个服务已经识别出来,但启动前还需要补充一些设置或配套处理。",workspaceDetailDebugServiceOverviewUnsupported:"这个服务目前不建议直接自动处理,建议先手动确认启动方式。",workspaceDetailDebugServiceOverviewUnknown:"这个服务还没有识别清楚,先保留结果,后续再补充判断。",workspaceDetailDebugServiceOverviewDesktopShell:"这是桌面壳服务,会单独展示,不参与网页服务的自动端口处理。",workspaceDetailDebugServiceActionSupported:"可直接启动",workspaceDetailDebugServiceActionConditional:"先补配置",workspaceDetailDebugServiceActionUnsupported:"建议手动处理",workspaceDetailDebugServiceActionUnknown:"先确认服务类型",workspaceDetailDebugServiceActionDesktopShell:"按桌面壳方式单独处理",workspaceDetailDebugAiEditEmpty:"无",workspaceDetailDebugAiEditPending:"待处理",workspaceDetailDebugAiEditApplied:"已应用",workspaceDetailDebugAiEditRolledBack:"已回滚",workspaceDetailDebugAiEditRejected:"已拒绝",workspaceSessionListBody:"项目里的会话、收藏和归档操作都收在这里,不再让你先去翻侧栏。",recentSessionsSectionTitle:"最近会话",recentSessionsSectionBody:"先回到最近在做的事情,别让手机端还要你猜入口。",currentWorkspaceSectionTitle:"当前项目会话",currentWorkspaceSectionBody:"当前项目下的会话都集中在这里,方便继续刚才的上下文。",sessionIndexTitle:"会话入口单独成页",sessionIndexBody:"最近、收藏、当前项目三块分开看,手机上找会话别再靠侧栏折叠。",toolsMoreAction:"更多",toolsSwipeHint:"左右滑动切换文件管理和 Git 管理",toolsSwipePosition:"{current} / {total}",toolFilesBody:"查看项目文件、变更文件和代码上下文,不再靠桌面右栏概念。",toolGitBody:"把当前项目的 Git 状态、提交和分支操作收进一个明确入口。",toolTerminalsBody:"进入终端主页面,处理输入密集和滚动密集的操作。",toolProcessesBody:"查看当前项目的终端模板、运行状态和进程入口。",toolsWorkspaceRequiredBody:"先选一个项目,再打开对应的工具页。",createSession:"新建会话",createSessionModalTitle:"选择新会话类型",createSessionModalDescription:"先选会话类型,再启动真正的会话进程。",createSessionWorkspaceLabel:"选择工作区",createSessionProviderLabel:"选择供应商",createSessionTarget:"当前项目",createWorktreeSectionTitle:"子工作区",createWorktreeSectionDescription:"先从当前项目分出子工作区,再决定用哪个供应商开新会话。",createWorktreeAction:"新增子工作区",createWorktreeCollapseAction:"收起子工作区表单",createWorktreeBranchLabel:"分支名",createWorktreeBranchPlaceholder:"例如:feat/login-codex",createWorktreeBranchRequired:"请先输入子工作区分支名",createWorktreeBranchInvalid:"分支名只能包含英文、数字、-、_、/,并且不能以 / 开头、结尾或连续出现 /",createWorktreeDisplayNameLabel:"显示名称(可选)",createWorktreeDisplayNamePlaceholder:"默认沿用分支名",createWorktreeBaseRefLabel:"从哪个分支/提交创建(可选)",createWorktreeBaseRefPlaceholder:"默认沿用当前分支",createWorktreeBaseRefHint:"可选当前仓库的本地分支 {localCount} 个、远端分支 {remoteCount} 个、标签 {tagCount} 个;也可以手填 commit hash。",createWorktreeBaseRefLoading:"正在读取当前仓库的分支和标签...",createWorktreeBaseRefLoadFailed:"分支和标签列表读取失败,仍然可以手动输入分支、标签或 commit hash。",createWorktreeBaseRefLocalGroup:"本地分支",createWorktreeBaseRefRemoteGroup:"远端分支",createWorktreeBaseRefTagGroup:"标签",createWorktreeBaseRefCurrentBadge:"当前分支",createWorktreeBaseRefRecommendedBadge:"推荐",createWorktreeBaseRefEmpty:"没有找到匹配项。你也可以直接输入想使用的分支、标签或 commit hash。",createWorktreeBaseRefToggle:"展开可选分支和标签",createWorktreeHelpAction:"填写说明",createWorktreeHelpTitle:"这三个内容怎么填",createWorktreeHelpBranchTitle:"分支名",createWorktreeHelpBranchBody:"这是新子工作区自己的名字,后面在列表里也会用它区分。一般填类似 feat/login 这种短名字就够了。",createWorktreeHelpDisplayNameTitle:"显示名称",createWorktreeHelpDisplayNameBody:"如果你想让列表里更好认,可以填一个更直白的名字。不填也没关系,系统会直接用分支名。",createWorktreeHelpBaseRefTitle:"从哪个分支/提交创建",createWorktreeHelpBaseRefBody:"这决定新子工作区从哪里开始。大多数时候保持默认就行;只有你想从别的分支、标签,或者某次提交继续时再改。",createWorktreeSubmit:"创建子工作区",createWorktreeSubmitting:"创建中...",createWorktreeSucceeded:"子工作区已创建:{name}",createWorktreeFailed:"创建子工作区失败",providerClaudeCode:"Claude Code",providerCodexDescription:"创建 Codex 会话,适合继续当前默认工作流。",providerClaudeDescription:"创建 Claude Code 会话,适合切换另一条会话链路。",providerOpenCodeDescription:"创建 OpenCode 会话,适合通过 OpenCode server 延续当前上下文。",providerGeminiDescription:"创建 Gemini 会话,适合接入 Gemini CLI 的原生工作流。",providerKimiDescription:"创建 Kimi 会话,适合接入 Kimi CLI 的原生工作流。",providerOptionHint:"选择后会立即创建会话",providerChecking:"检查中...",startClaude:"Claude",startCodex:"Codex",startingSession:"创建中...",startClaudeSuccess:"Claude 会话已创建",startCodexSuccess:"Codex 会话已创建",startSessionFailed:"创建失败",auxiliaryTitle:"信息",auxiliarySubtitle:"文件与 Git 状态",expandAuxiliary:"展开",collapseAuxiliary:"收起",auxiliaryEmptyTitle:"选择一个会话",auxiliaryEmptyBody:"会话文件和 Git 信息将显示在这里",batchSelectSessions:"批量选择会话",batchSelectionMode:"批量选择",selectAllSessions:"全选",clearSelectedSessions:"清空选择",batchArchiveAction:"归档已选",batchArchiving:"归档中...",batchArchiveSuccess:"已归档选中的会话",batchArchivePartialFailed:"部分会话归档失败,请重试",batchArchiveFailed:"批量归档失败",hideSessionSidebar:"隐藏会话列表",showSessionSidebar:"显示会话列表",hideInfoSidebar:"隐藏信息栏",showInfoSidebar:"显示信息栏",centerTabsLabel:"中间区域标签",infoTabsLabel:"信息栏标签",leftResizerLabel:"调整左侧宽度",rightResizerLabel:"调整右侧宽度",filesPanelEmpty:"先导入或选中一个项目,文件管理才能显示。",gitPanelEmpty:"先导入或选中一个工作区,Git 信息才能显示。",infoPanelDeferred:"左侧会话列表优先加载,右侧附属面板稍后再挂载。"},workbench:{emptyEyebrow:"开始",emptyTitle:"先选一个会话",emptyBody:"从左侧继续之前的内容,或新建一个会话。",emptyResumeTitle:"继续",emptyResumeBody:"回到上次停下的地方。",emptyNewTitle:"新建",emptyNewBody:"把新问题放进新会话。",emptyCompanionTitle:"查看辅助信息",emptyCompanionBody:"需要文件、Git 或终端时,再看右侧。",emptyTip:"准备好后,从左侧选一个会话开始。"},conversation:{resendButton:"重发",historyLoading:"加载中...",historyLoadingOlder:"加载更早的消息...",historyLoadFailed:"加载失败",inheritedContextLoading:"正在整理从父会话继承的上下文...",inheritedContextMessageLabel:"继承自某条消息之前的上下文",inheritedContextSessionLabel:"继承自主会话的上下文",inheritedContextSummary:"已默认折叠从“{parentTitle}”继承的 {count} 条消息。",actionInheritedSelectionSummary:"已默认折叠来自“{parentTitle}”的一段选中文本。",inheritedContextExpand:"展开完整上文",inheritedContextCollapse:"收起继承上文",inheritedContextParentFallback:"父会话",timelineEmpty:"开始对话",composerPlaceholder:"把下一步交代清楚,剩下的交给这条会话继续跑。",sendButton:"发送消息",attachFiles:"附加文件",attachmentSourceSheetTitle:"添加附件",attachmentSourceSheetDescription:"可以从文件中选择一个或多个文件,也可以直接拍照。",attachmentTakePhoto:"拍照",attachmentTakePhotoHint:"直接打开相机添加一张照片",attachmentChooseFromLibrary:"从文件中选择",attachmentChooseFromLibraryHint:"通过系统文件选择器添加一个或多个文件",pasteImagesHint:"支持直接粘贴文件",attachmentImageOnly:"当前只支持图片附件",attachmentReadFailed:"附件读取失败,请重试",attachmentPreviewAlt:"已选图片预览",attachmentPreviewOpen:"打开附件",attachmentPreviewClose:"关闭预览",attachmentPreviewLoading:"附件加载中",attachmentPreviewUnavailable:"附件暂时不可用",attachmentDownload:"下载附件",attachmentDropHint:"拖拽文件到这里即可添加",imageAttachmentLabel:"图片附件",fileAttachmentLabel:"文件附件",imagePreviewTitle:"图片预览",imagePreviewHint:"点击遮罩或按 Esc 可以关闭预览",removeAttachment:"移除附件",selectionTodoAction:"代办",selectionActionButton:"操作",selectionActionSubmit:"新开操作子会话",selectionActionPromptLabel:"你想让它做什么",selectionActionPromptPlaceholder:"比如:解释这段话、整理成笔记,或调用指定接口处理它",selectionActionIncludeContext:"包含当前上下文",selectionActionContextUnavailable:"当前选区跨了多条消息,没法安全继承上下文,只能按无上下文新建子会话。",selectionActionDefaultPrompt:"请处理这段内容。",selectionActionQuotedLabel:"选中文本",selectionActionFailed:"创建操作子会话失败。",actionSessionBadge:"操作",modelSelectorLabel:"选择模型",modelUseCliDefault:"默认",modelUseCodexConfig:"跟随当前 Codex 配置",modelUseOpenCodeConfig:"跟随当前 OpenCode 配置",reasoningSelectorLabel:"选择推理强度",reasoningLow:"低",reasoningMedium:"中",reasoningHigh:"高",reasoningMaximum:"极高",slashMenu:"命令",slashMenuTitle:"快捷命令",slashCommandPlan:"先让对方给出执行路线",slashCommandReview:"直接进入代码审查模式",slashCommandExplain:"要求用更清楚的方式解释",toolInputLabel:"输入",toolResultLabel:"结果",toolResultEmpty:"暂无输出",toolPreviewCommand:"命令",toolPreviewTerminal:"终端",toolStatusRunning:"运行中",toolStatusFailed:"已失败",toolStatusCompleted:"已完成",runtimeThinkingPlaceholder:"{provider} 正在思考...",applyPatchEditedLabel:"已编辑",applyPatchAddedLabel:"已新增",applyPatchDeletedLabel:"已删除",applyPatchDialogTitle:"Patch 变更预览",applyPatchDialogDescription:"这里按文件显示 apply_patch 将要执行的变更。",applyPatchOpenDiff:"查看 diff",applyPatchAddedStat:"新增",applyPatchRemovedStat:"减少",applyPatchEmpty:"这个 patch 暂时没有可展示的文件变更。",titleFallback:"继续对话",draftTitleCodex:"New Codex session",draftTitleClaude:"New Claude Code session",draftTitleOpenCode:"New OpenCode session",draftTitleGemini:"New Gemini session",draftTitleKimi:"New Kimi session",headerWorkspace:"工作区",headerWorkspaceUnknown:"未知工作区",headerProvider:"Provider",headerConnection:"连接",headerRuntime:"运行态",providerCodex:"Codex",branchTreeAction:"分支树",branchTreeTitle:"分支树",branchTreeDescription:"这里只看当前会话所在的父子链,不把整个工作区会话列表混进来。",branchTreeUpstreamLabel:"上游链路",branchTreeCurrentLabel:"当前会话",branchTreeChildrenLabel:"下游分支",branchTreeCurrentBadge:"当前",branchTreeArchivedBadge:"已归档",branchTreeEmpty:"这条会话当前还没有下游分支。",branchTreeMapTitle:"分支关系图",branchTreeMapDescription:"这里会把当前会话所在主干和所有关联分支一起展开。",branchTreePreviewTitle:"会话预览",branchTreePreviewDescription:"点一下节点就会浮出最近几条消息,再决定要不要切过去。",branchTreePreviewLoading:"正在读取这条会话的最近消息...",branchTreePreviewFailed:"会话预览读取失败。",branchTreePreviewEmpty:"这条会话最近没有可预览的消息。",branchTreeResizeHandle:"调整分支树宽度",branchTreeZoomInAction:"放大分支图",branchTreeZoomOutAction:"缩小分支图",branchTreeZoomResetAction:"重置分支图缩放",branchTreeSwitchAction:"切换到这个会话",branchTreeCurrentAction:"已在当前会话",branchTreeToolMessageFallback:"工具消息",branchTreeMessageEmpty:"这条消息当前没有可展示的正文。",moreSessionActions:"更多会话操作",moreSessionActionsTitle:"更多会话操作",moreSessionActionsDescription:"分支树和助手入口统一收在这里,避免移动端标题栏被按钮挤满。",branchTreeTab:"分支树",aiAssistantTab:"助手",aiAssistantTabDescription:"这里保留当前会话的助手入口,需要继续跟进或发起验证时直接点下面这个按钮。",providerClaude:"Claude",providerOpenCode:"OpenCode",providerGemini:"Gemini",providerKimi:"Kimi",capabilitySend:"可发送",queueTitle:"待发队列",queueDescription:"当前运行结束后,会按顺序自动继续处理下面的消息。",queueOrderPrefix:"等待顺序",queueStatusQueued:"等待中",queueStatusFailed:"续跑失败",queueDelete:"删除",queueDeleting:"删除中",permissionRequestSectionTitle:"待处理审批",permissionRequestSectionDescription:"这里把供应商原生的权限申请统一收口,不再让你面对三套不同的确认框。",permissionRequestToastTitle:"需要审批",backgroundPermissionToastDescription:"{title} · {requestTitle}",backgroundCompletionToastTitle:"会话已完成",backgroundCompletionToastDescription:"{title}",backgroundFailureToastTitle:"会话异常",backgroundFailureToastDescription:"{title} · {detail}",permissionRequestReplyFailed:"回复权限申请失败。",permissionRequestSubmitting:"提交中...",permissionRequestReasonLabel:"原因",permissionRequestCommandLabel:"命令",permissionRequestToolLabel:"工具",permissionRequestCwdLabel:"工作目录",permissionRequestPathsLabel:"相关路径",permissionRequestPermissionsLabel:"申请权限",permissionRequestReadLabel:"读取",permissionRequestWriteLabel:"写入",permissionRequestNetworkLabel:"网络",permissionRequestQuestionsLabel:"补充问题",permissionRequestDetailLabel:"详情",permissionRequestEmpty:"无",permissionRequestUnknown:"未知",permissionRequestKindCommand:"命令",permissionRequestKindFileChange:"文件改动",permissionRequestKindPermissions:"权限扩展",permissionRequestKindUserInput:"补充输入",permissionRequestKindToolCall:"工具调用",queueImageOnly:"只包含图片附件",sendGuidanceButton:"追加指导",queueGuidanceButton:"加入队列",capabilityDenied:"受限",capabilitySendDisabled:"发送受限",connectionConnected:"实时已连接",connectionReconnecting:"正在重连",connectionReconnectFailed:"重连失败",connectionClosed:"连接已关闭",runtimeIdle:"空闲",runtimeStarting:"启动中",runtimeRunning:"运行中",runtimeReconnecting:"恢复中",runtimeStale:"运行待确认",runtimeUnknown:"状态待确认",runtimeCompleted:"已完成",runtimeInterrupted:"已中断",runtimeFailed:"失败",rulesMessageTitle:"规则信息",rulesMessageHint:"这是一段会话启动规则,默认折叠显示,需要时再展开查看。",rulesMessageExpand:"展开规则",rulesMessageCollapse:"收起规则",systemPromptTitle:"系统提示",systemPromptHint:"这是 Kimi 会话开头的系统提示词,默认折叠显示,需要时再展开查看。",systemPromptExpand:"展开提示词",systemPromptCollapse:"收起提示词",taskProgressButton:"任务进度({count})",taskProgressModalTitle:"任务进度",taskProgressModalDescription:"当前会话已记录 {count} 条任务,这里直接看最新进度。",taskProgressExplanationTitle:"本轮更新说明",taskProgressSummaryTotal:"总数",taskProgressStatusPending:"待处理",taskProgressStatusInProgress:"进行中",taskProgressStatusCompleted:"已完成",taskProgressStatusFailed:"已失败",taskProgressStatusCancelled:"已取消",taskCardPlanTitle:"计划更新",taskCardTodoTitle:"任务更新",taskCardPlanUpdated:"最新计划",taskCardTodoUpdated:"最新任务列表",taskCardRawExpand:"展开原始调用",taskCardRawCollapse:"收起原始调用",taskCardSummaryTotal:"共 {count} 项",taskCardSummaryInProgress:"进行中 {count}",taskCardSummaryPending:"待处理 {count}",taskCardSummaryCompleted:"已完成 {count}",taskCardSummaryFailed:"已失败 {count}",butlerActionButton:"助手",butlerActionModalTitle:"助手动作",butlerActionModalDescription:"让助手继续跟进当前开发会话,或发起一次开发验证。",butlerActionLoading:"正在连接助手记录...",butlerActionLoadFailed:"读取助手动作信息失败",butlerActionProjectLabel:"当前项目",butlerActionSessionLabel:"当前会话",butlerFollowUpAction:"跟进当前会话",butlerFollowUpActionDescription:"让助手持续盯住这条开发会话,并在结束或阻塞后继续推动。",butlerFollowUpObjectiveLabel:"跟进目标",butlerFollowUpObjectivePlaceholder:"例如:帮我把这个会话的功能真正做完,若 spec 还有未完成项就继续补齐。",butlerFollowUpCompletionCriteriaLabel:"结束条件",butlerFollowUpCompletionCriteriaPlaceholder:"例如:只有当当前功能按既定需求完成,且不再存在必须继续推进的未完成项时,才停止自动跟进。",butlerFollowUpRoundLimitLabel:"最多自动跟进轮数",butlerFollowUpRoundLimitHint:"达到上限后,助手会停止自动续接,避免无限扩展会话。",butlerCurrentFollowUpLabel:"当前跟进任务",butlerCurrentFollowUpProgress:"已自动推进 {current} / {max} 轮",butlerStopFollowUpAction:"停止当前跟进",butlerFollowUpObjectiveRequired:"请先写清楚这次希望助手持续推动的目标",butlerVerificationAction:"发起开发验证",butlerVerificationActionDescription:"让助手从用户视角对当前会话对应功能发起一次验证。",butlerFollowUpStarted:"已交给助手继续跟进",butlerFollowUpStartedDescription:"助手会继续跟进 {projectName} 的当前开发会话。",butlerFollowUpFailed:"助手跟进启动失败",butlerFollowUpStopped:"已停止当前助手跟进",butlerFollowUpStoppedDescription:"当前会话的自动跟进已经停止,不会继续自动续接。",butlerFollowUpStopFailed:"停止助手跟进失败",butlerVerificationStarted:"已发起开发验证",butlerVerificationStartedDescription:"助手会对 {projectName} 发起一次开发验证。",butlerVerificationFailed:"开发验证启动失败",butlerAnalysisTitle:"助手分析过程",butlerAnalysisLoadFailed:"读取助手分析失败",butlerAnalysisObjectiveLabel:"当前目标",butlerAnalysisStatusLabel:"当前判断",butlerAnalysisSummaryLabel:"最近分析",butlerAnalysisWaitingReasonLabel:"等待原因",butlerAnalysisEmpty:"当前还没有可展示的助手分析记录。",butlerProxyMessageBadge:"代理发送",butlerOriginDetailTitle:"对应的助手跟进",butlerOriginDetailLoading:"正在读取对应的助手跟进记录...",butlerOriginDetailLoadFailed:"读取对应的助手跟进记录失败",butlerOriginDetailObjectiveLabel:"跟进目标",butlerOriginDetailStatusLabel:"当前状态",butlerOriginDetailSummaryLabel:"最近分析",butlerOriginDetailWaitingReasonLabel:"等待原因",thinkingLabel:"思考中",filePanelWorkspaceTab:"工作区",filePanelSessionTab:"本次会话",filePanelSessionViewLabel:"本次会话视图",filePanelSessionTreeView:"树状",filePanelSessionListView:"列表",filePanelSessionLoading:"正在整理本次会话修改的文件...",filePanelSessionEmpty:"这条会话还没识别到可暂存的修改文件。",filePanelSessionNoSession:"当前只选中了项目,还没选中会话,无法查看“本次会话”文件。",filePanelSessionStageAll:"全部暂存",filePanelSessionStageSuccess:"已把本次会话的修改加入暂存区。",filePanelSessionLoadFailed:"本次会话修改文件加载失败。",filePanelSessionSummary:"已识别文件",filePanelSessionUnstagedSummary:"未暂存",filePanelSessionDeleted:"已删除",filePanelOpenExternalWindow:"在新窗口打开",filePanelOpenExternalFailed:"打开文件外部窗口失败。"},desktopWindow:{invalidWindowId:"缺少窗口 ID,无法加载外部窗口。",loadDescriptorFailed:"读取窗口描述失败。",unsupportedKind:"暂不支持渲染 {kind} 窗口。"},git:{recentVersionsTitle:"最近版本",stagedChangesTitle:"暂存的更改",expandRecentVersions:"展开最近版本",collapseRecentVersions:"折叠最近版本",stagedLabel:"暂存区",workingTreeLabel:"工作区",changeTreeHint:"按目录层级展示当前变更",discard:"放弃改动",discardFailed:"放弃改动失败",operationMenu:"操作菜单",currentBranch:"当前分支",resizePanels:"调整文件区和最近版本高度",switchBranchTo:"切换到",undoLastCommit:"撤销上次提交",undoLastCommitFailed:"撤销上次提交失败",undoLastCommitSuccess:"已撤销上次提交",historyKindLocal:"本地",historyKindRemote:"远程",historyKindShared:"已同步",pushNow:"推送",commitNow:"提交",refreshNow:"刷新",openExternalWindow:"在新窗口打开 Git",openExternalFailed:"打开 Git 外部窗口失败。",stageAll:"暂存全部",unstageAll:"取消暂存全部",discardAll:"放弃全部改动",selectedFiles:"已选文件",clearSelection:"清空选中",selectFile:"选中文件",discardConfirm:"确认放弃这些改动吗?{path}",historyItemMenu:"版本操作",copyCommitHash:"复制 Commit Hash",copyCommitHashSuccess:"Commit Hash 已复制。",copyCommitSubject:"复制提交标题",copyCommitSubjectSuccess:"提交标题已复制。"},terminalManager:{workspaceField:"当前工作区",refresh:"刷新列表",loadFailed:"终端管理面板加载失败",shellLoadFailed:"终端 Shell 列表加载失败",emptyWorkspaceBody:"还没有可用工作区。",noCurrentWorkspaceBody:"先选中一条会话,进程管理才能绑定对应的工作区。",emptyTerminalBody:"当前工作区还没有终端实例。",emptyTemplateBody:"还没有快捷启动项,可以先保存一条命令或脚本。",shellField:"新终端 Shell",shellUnavailable:"当前不可用",cwdField:"启动目录",cwdLabel:"目录",cwdPlaceholder:"留空时默认使用工作区根目录",modeField:"启动方式",commandMode:"命令",scriptMode:"脚本",quickLaunchTitle:"快捷启动",quickLaunchDescription:"先保存启动方式,需要时一键拉起到新终端。",desktopPanelDescription:"默认只看启动决策所需的信息,路径和命令行收进详情层。",openExternalWindow:"在新窗口打开",openExternalFailed:"打开进程管理外部窗口失败。",runningCountLabel:"运行中",portWatchCountLabel:"已监控端口",terminalCountLabel:"终端数",templateSectionTitle:"启动项",templateSectionDescription:"右侧优先显示启动项的端口状态,看清楚是否已被占用。",openCreateModalAction:"添加快捷启动项",createModalTitle:"添加快捷启动项",createModalDescription:"在这里保存命令或脚本,可以附带端口,后面就能一键启动并判断是否在跑。",editAction:"编辑启动项",editModalTitle:"编辑快捷启动项",editModalDescription:"直接修改这条快捷启动的名称、命令、目录和端口配置。",saveTemplateChangesAction:"保存修改",templateUpdating:"保存修改中...",templateUpdateSuccess:"快捷启动项已更新。",templateUpdateFailed:"快捷启动项更新失败",removeAction:"移除启动项",templateRemoving:"移除中...",removeConfirmTitle:"确认移除启动项",removeConfirmAction:"确认移除",removeConfirmTarget:"确认移除“{name}”吗?移除后将不再出现在快捷启动列表中。",removeRunningConfirmTarget:"“{name}”对应的进程还在跑。现在移除的是启动项配置,不会自动结束已经运行的进程。确认继续吗?",templateDeleteSuccess:"快捷启动项已移除。",templateDeleteFailed:"快捷启动项移除失败",terminalSectionTitle:"终端实例",terminalSectionDescription:"这里显示当前工作区由 CodingNS 托管的终端。",closeAction:"关闭终端",closing:"关闭中...",closeSuccess:"终端关闭请求已提交。",closeFailed:"终端关闭失败",createTerminalAction:"新建空终端",creatingTerminal:"创建中...",createTerminalSuccess:"新终端已创建。",createTerminalFailed:"新终端创建失败",defaultTerminalName:"工作终端",templateNameField:"名称",templateNamePlaceholder:"留空时会自动生成",commandField:"启动命令",commandPlaceholder:"例如:npm",scriptPathField:"脚本路径",scriptPathPlaceholder:"例如:scripts/dev.ps1 或 scripts/dev.sh",argsField:"参数",argsPlaceholder:"例如:run dev 或 --watch",portField:"监听端口",portLabel:"端口",portPlaceholder:"例如:3000",proxyField:"反向代理",proxyToggleLabel:"开启反向代理",proxyEnabled:"代理已启用",proxyEnabledDescription:"开启后会生成随机 URL 码,可通过 /proxy/地址访问当前开发服务。",proxyDisabledDescription:"未开启反向代理",proxyPortRequired:"开启反向代理时,必须同时配置端口",openProxyUrlAction:"在浏览器打开代理地址",openProxyUrlFailed:"打开代理地址失败",invalidPort:"端口必须是 1 到 65535 的整数",saveLaunchAction:"保存为快速启动",templateSaving:"保存中...",templateSaveSuccess:"快捷启动项已保存。",templateSaveFailed:"快捷启动项保存失败",runTemplateAction:"启动到新终端",runningTemplate:"启动中...",templateRunSuccess:"快捷启动已发送到新终端。",templateRunFailed:"快捷启动执行失败",showDetailsAction:"显示详细信息",hideDetailsAction:"隐藏详细信息",detailsSectionTitle:"启动项详情",commandPreviewLabel:"启动命令",processIdLabel:"监听进程 PID",processGroupIdLabel:"进程组 PGID",processCommandLabel:"监听命令行",parentProcessIdLabel:"父进程 PID",parentProcessCommandLabel:"父进程命令行",terminationScopeLabel:"结束范围",terminationScopeProcess:"仅监听进程",terminationScopeProcessGroup:"整个进程组",stopProcessAction:"结束进程",stoppingProcess:"结束中...",stopProcessSuccess:"监听进程或所属进程组已结束。",stopProcessFailed:"结束监听进程或进程组失败",defaultCommandName:"新启动命令",defaultScriptName:"新启动脚本",lastActiveAt:"最近活跃",updatedAt:"最后更新",processCommandFallback:"这个进程没有暴露命令行",portUnset:"未配置端口",portUnsetDescription:"没有端口时,只能启动,不能自动判断服务是否在跑。",portOccupied:"进程已启动",portAvailable:"端口暂未被占用",portAvailableDescription:"这个启动项对应的端口目前还没有监听进程。",statusRunning:"运行中",statusStopped:"未运行",exitCode:"Exit Code",runningValue:"运行中"},theme:{light:"浅色",dark:"深色",skyBlue:"赛博",eyeGreen:"护眼",switchLabel:"主题"}},aL={common:{close:"Close",cancel:"Cancel",logout:"Log out",language:"Language"},locale:{zhCN:"Simplified Chinese",enUS:"English"},settings:{title:"Settings",appearance:"Appearance",language:"Language",languageDescription:"Choose the display language used by the interface. The page updates immediately.",theme:"Theme",themeDescription:"Choose the color theme that fits the way you work.",connection:"Connection & Updates",serverAddress:"Server Address",serverDescription:"Desktop and H5 both work through this host entry.",releaseChannel:"Release Channel",releaseChannelDescription:"Stable or beta",releaseStable:"Stable",releaseBeta:"Beta",autoReconnect:"Auto Reconnect",autoReconnectDescription:"Retry HTTP and WebSocket links automatically when Host is briefly unavailable.",autoCheckUpdate:"Auto Check Client Updates",autoCheckUpdateDescription:"Clients only",notificationSettings:"Notifications",notificationSettingsDescription:"Control each session-related system notification independently.",notifyOnPermissionRequest:"Notify on permission requests",notifyOnPermissionRequestDescription:"Notify when a background session needs a new permission approval.",notifyOnSessionCompleted:"Notify when sessions complete",notifyOnSessionCompletedDescription:"Notify when a background session finishes.",notifyOnSessionFailed:"Notify when sessions fail",notifyOnSessionFailedDescription:"Notify when a background session fails.",enabled:"Enabled",disabled:"Disabled",serverUpdate:"Server Update",serverUpdateDescription:"",clientUpdate:"Client Update",clientUpdateDescription:"",serverCurrentVersion:"Server Current Version",serverTargetVersion:"Server Target Version",serverPackageName:"npm Package",serverUpdateCommand:"Upgrade Command",serverCheckNow:"Check Server",serverInstallNow:"Install",serverOpenPage:"Open npm",serverLatestUnknown:"Unavailable",serverUpdateReady:"New version found",serverUpToDate:"Up to date",serverCheckFailed:"Check failed",serverInstallQueued:"Queued",serverInstalling:"Installing update",serverInstallSucceeded:"Update completed",serverInstallFailed:"Install failed",serverInstallCancelled:"Install cancelled",serverInstallTimeout:"Install timed out",serverRestartRequired:"New version installed. Restart Host to apply it.",serverOpenPageFailed:"Failed to open page",runtimePlatform:"Runtime Platform",runtimePlatformDescription:"Shows whether the app is running in Web/H5, Desktop, iOS, or Android.",platformDesktop:"Desktop",platformWeb:"Web",platformIos:"iOS",platformAndroid:"Android",releaseDesktopOnly:"Desktop updates are not available in the current Web/H5 runtime.",releaseCurrentVersion:"Current Version",releaseTargetVersion:"Target Version",releaseUnknownVersion:"Unknown",releaseNotes:"What's New",releaseNotesEmpty:"No details",releaseCheckNow:"Check Client",releaseInstallNow:"Install",releaseOpenPage:"Open Release",releaseManualOnly:"This version requires manual installation",releaseUpdateBadge:"Update",releaseUpdateReady:"New version found",releaseUpToDate:"Up to date",releaseCheckFailed:"Check failed",releaseInstallStarted:"Install started",releaseInstallFailed:"Install failed",releasePageOpenFailed:"Failed to open release page",androidInstallerStarted:"Handed off to the Android installer. You can still cancel there.",androidInstallPermissionRequired:"Allow installs from this source before retrying.",androidInstallCancelled:"Install was cancelled or not completed. You can try again.",androidInstallSucceeded:"The new version has been detected as installed.",clientUpdateUnsupported:"Install updates are not supported here",account:"Account",logout:"Log out",logoutDescription:"Sign out of the current account and return to the login page.",advancedSettings:"Advanced Settings",parallelTaskDebug:"Parallel Task Debug",parallelTaskDebugDescription:"Runtime sampling stays off until you open this panel. Use it to inspect background tasks, schedulers, and main-thread pressure in real time.",parallelTaskDebugAction:"Open Debug Panel",parallelTaskDebugModalTitle:"Parallel Task Debug",parallelTaskDebugModalDescription:"Task activity and event loop sampling only stay active while this window is open. Closing it stops collection immediately.",parallelTaskDebugClose:"Close parallel task debug",parallelTaskDebugLoading:"Opening observability session and loading runtime snapshot...",parallelTaskDebugLoadFailed:"Failed to load parallel task debug information",parallelTaskDebugEmpty:"No execution records are available right now.",parallelTaskDebugStatusActive:"Collecting",parallelTaskDebugStatusError:"Collection Error",parallelTaskDebugObservedAt:"Last Updated",parallelTaskDebugSessionExpireAt:"Session Expires At",parallelTaskDebugSessionTtl:"Session TTL",parallelTaskDebugCollectorState:"Collector State",parallelTaskDebugCollectorEnabled:"Enabled",parallelTaskDebugCollectorDisabled:"Disabled",parallelTaskDebugAutoRefresh:"Auto refresh every second",parallelTaskDebugCountersTitle:"Overall Counters",parallelTaskDebugTaskMetricsTitle:"Background Task Metrics",parallelTaskDebugSchedulerTitle:"Scheduler Metrics",parallelTaskDebugEventLoopTitle:"Event Loop",parallelTaskDebugRecentActivitiesTitle:"Recent Execution Records",parallelTaskDebugWaitAvg:"Average Wait",parallelTaskDebugRunAvg:"Average Run",parallelTaskDebugRunMax:"Longest Run",parallelTaskDebugStartedCount:"Started",parallelTaskDebugFinishedCount:"Finished",parallelTaskDebugFailedCount:"Failed",parallelTaskDebugCacheHitCount:"Cache Hits",parallelTaskDebugIdle:"Idle",parallelTaskDebugBusy:"Busy",parallelTaskDebugTickTotal:"Tick Total",parallelTaskDebugIdleTickTotal:"Idle Ticks",parallelTaskDebugTaskCountTotal:"Task Hits",parallelTaskDebugSchedulerErrorTotal:"Errors",parallelTaskDebugLastDuration:"Last Duration",parallelTaskDebugNextDelay:"Next Delay",parallelTaskDebugEventLoopResolution:"Resolution",parallelTaskDebugEventLoopMean:"Mean Delay",parallelTaskDebugEventLoopP95:"P95 Delay",parallelTaskDebugEventLoopP99:"P99 Delay",parallelTaskDebugEventLoopMax:"Max Delay",parallelTaskDebugTaskKey:"Task Key",parallelTaskDebugStatus:"Status",parallelTaskDebugAttempt:"Attempt",parallelTaskDebugWaitMs:"Wait",parallelTaskDebugRunMs:"Run",parallelTaskDebugSource:"Source",parallelTaskDebugError:"Error",parallelTaskDebugMetricEnqueue:"Enqueue",parallelTaskDebugMetricDedupe:"Dedupe",parallelTaskDebugMetricStarted:"Started",parallelTaskDebugMetricFinished:"Finished",parallelTaskDebugMetricFailed:"Failed",parallelTaskDebugMetricCancelled:"Cancelled",parallelTaskDebugMetricTimeout:"Timeout",parallelTaskDebugMetricCacheHit:"Cache Hit",parallelTaskDebugLaneRequestMainThread:"Request Main Thread",parallelTaskDebugLaneHostBackground:"Host Background",parallelTaskDebugLaneHelperProcess:"Helper Process",parallelTaskDebugLaneExternalProcess:"External Process",parallelTaskDebugEventEnqueued:"Enqueued",parallelTaskDebugEventDeduped:"Deduped",parallelTaskDebugEventStarted:"Started",parallelTaskDebugEventFinished:"Finished",parallelTaskDebugEventFailed:"Failed",parallelTaskDebugEventCancelled:"Cancelled",parallelTaskDebugEventTimeout:"Timeout",parallelTaskDebugEventCacheHit:"Cache Hit",parallelTaskDebugTaskStatusQueued:"Queued",parallelTaskDebugTaskStatusRunning:"Running",parallelTaskDebugTaskStatusSucceeded:"Succeeded",parallelTaskDebugTaskStatusFailed:"Failed",parallelTaskDebugTaskStatusCancelled:"Cancelled",parallelTaskDebugTaskStatusTimeout:"Timeout"},shell:{title:"Workbench",subtitle:"Manage AI sessions inside code projects",mobileWorkspacesEntry:"Workspaces",mobileTerminalsEntry:"Terminal",mobileSessionsEntry:"Conversation",mobileToolsEntry:"Tools",mobileSettingsEntry:"Settings",mobileNavigationAction:"Open workbench menu",mobileSearchAction:"Open search",mobileAuxiliaryAction:"Open tools panel",mobileRevealNavigationAction:"Show primary navigation",mobileHideNavigationAction:"Hide primary navigation",mobileConversationPreviewTitle:"Quick Preview",mobileConversationCurrentWorkspaceSection:"Current Workspace",mobileConversationCollapsePreviewAction:"Hide Preview",mobileConversationRestorePreviewAction:"Restore Session Preview",iosMoreAction:"More actions",androidMoreAction:"More actions",conversationEntry:"Conversation",terminalsEntry:"Terminal",butlerEntry:"Assistant",globalNotificationsAction:"Notifications",globalNotificationsUnreadAria:"{count} unread notifications",globalNotificationsPanelTitle:"Notification Center",globalNotificationsPanelDescription:"Review items waiting for your decision, todo analysis results, follow-up updates, and failed verifications.",globalNotificationsEmpty:"There are no new global notifications right now.",globalNotificationsShowArchived:"Show archived notifications",globalNotificationsArchiveAction:"Archive",globalNotificationsRemoveArchiveAction:"Remove Archive",globalNotificationsArchiveFailed:"Failed to update notification archive state",globalNotificationKindWaitingUser:"Waiting for You",globalNotificationKindTodoAnalyzed:"Todo Analyzed",globalNotificationKindTodoAnalyzeFailed:"Todo Analysis Failed",globalNotificationKindFollowUpFailed:"Follow-up Failed",globalNotificationKindFollowUpCompleted:"Follow-up Completed",globalNotificationKindVerificationFailed:"Verification Failed",globalNotificationTodoAnalyzedTitle:"Todo analysis completed: {title}",globalNotificationTodoAnalyzeFailedTitle:"Todo analysis failed: {title}",globalNotificationFollowUpWaitingTitle:"Needs your decision: {title}",globalNotificationFollowUpFailedTitle:"Follow-up failed: {title}",globalNotificationFollowUpCompletedTitle:"Follow-up completed: {title}",globalNotificationVerificationFailedTitle:"Verification failed: {title}",globalNotificationVerificationFailedFallback:"The latest verification did not pass. Please review it soon.",searchEntry:"Search",butlerInitTitle:"Initialize Assistant",butlerInitDescription:"Set the Butler name, provider, and work style first. The dedicated workspace and first AGENTS.md will be created automatically.",butlerInitPreviewTitle:"Live Preview",butlerInitPreviewDescription:"These choices directly shape the first rule set, so show the result instead of dumping a plain form.",butlerInitBasicsTitle:"Basics",butlerInitBasicsDescription:"Lock in the name, provider, and rule storage first so initialization does not become config soup.",butlerInitPersonaTitle:"Expression Style",butlerInitPersonaDescription:"Tone, language, and summary style decide how Butler speaks, not whether it gets to be sloppy.",butlerInitPreferenceTitle:"Default Priorities",butlerInitPreferenceDescription:"This decides which risks Butler watches first and what it surfaces first in reports.",butlerInitRuleLabel:"Rule Format",butlerInitTipAutoWorkspace:"The system creates the Butler workspace and first AGENTS.md automatically, so you only set the defaults here.",butlerInitTipProviderSwitch:"You can switch provider later, so do not overthink the first initialization pass.",butlerInitTipReportPriority:"Report priority changes whether Butler leads with risk, blockers, or verification results.",butlerDisplayNameLabel:"Butler Name",butlerDisplayNamePlaceholder:"Example: Arvin, Butler",butlerDisplayNameHint:"This is the Butler's self-name. The system writes it into the first generated AGENTS.md.",butlerProviderLabel:"Provider",butlerWorkspacePathLabel:"Butler Workspace Path",butlerWorkspacePathPlaceholder:"Example: /Users/you/WorkFile/butler-home",butlerAgentsModeLabel:"AGENTS Mode",butlerAgentsModeInline:"Inline",butlerAgentsModeFile:"File",butlerAgentsModeInlineDescription:"Inline: the system generates rules from your initialization choices and manages them for you.",butlerAgentsModeFileDescription:"File: the system writes AGENTS.md into the Butler workspace so you can edit the file directly later.",butlerAgentsFilePathLabel:"AGENTS.md File Path",butlerAgentsFilePathPlaceholder:"Example: /Users/you/WorkFile/butler-home/AGENTS.md",butlerAgentsContentLabel:"AGENTS Instructions",butlerAgentsContentPlaceholder:"Describe the Butler's work rules and response style",butlerAgentsContentHint:"Maintain Butler's formal rules here. Saving will write back to the dedicated AGENTS.md or inline instructions.",butlerPersonaToneLabel:"Tone",butlerPersonaLanguageLabel:"Language",butlerPersonaSummaryStyleLabel:"Summary Style",butlerFocusRiskPreferenceLabel:"Risk Preference",butlerFocusReportPriorityLabel:"Report Priorities (comma-separated)",butlerFocusReportPriorityPlaceholder:"Example: risk,blocker,verification",butlerToneDirect:"Direct and Clear",butlerToneSteady:"Steady and Controlled",butlerToneFriendly:"Friendly and Patient",butlerLanguageZhCn:"Chinese First",butlerLanguageEnUs:"English First",butlerLanguageBilingual:"Bilingual",butlerSummaryBrief:"Brief",butlerSummaryStructured:"Structured",butlerSummaryThorough:"Thorough",butlerRiskConservative:"Conservative",butlerRiskBalanced:"Balanced",butlerRiskProactive:"Proactive",butlerReportPriorityPresetLabel:"Report Priority",butlerReportRiskFirst:"Risk First",butlerReportBlockerFirst:"Blockers First",butlerReportVerificationFirst:"Verification First",butlerReportProgressFirst:"Progress First",butlerSummaryDebounceLabel:"Session Summary Debounce",butlerSummaryDebounceOption1Minute:"1 minute",butlerSummaryDebounceOption3Minutes:"3 minutes",butlerSummaryDebounceOption5Minutes:"5 minutes (default)",butlerSummaryDebounceOption10Minutes:"10 minutes",butlerSummaryDebounceOption15Minutes:"15 minutes",butlerSummaryDebounceOption30Minutes:"30 minutes",butlerSettingsTitle:"Butler Settings",butlerSettingsSaveAction:"Save Settings",butlerSettingsSaving:"Saving...",butlerSettingsSaved:"Butler settings saved",butlerSettingsSaveFailed:"Failed to save Butler settings",butlerInitSubmitting:"Initializing...",butlerInitSubmit:"Initialize Butler",butlerInitSuccess:"Assistant initialized",butlerInitFailed:"Failed to initialize Assistant",butlerInitNameRequired:"Assistant name is required",butlerInitWorkspaceRequired:"Assistant workspace path is required",butlerInitAgentsFileRequired:"AGENTS.md path is required in file mode",butlerWorkbenchTitle:"Assistant Workbench",butlerWorkbenchSubtitle:"Chat with Butler here and review aggregated context with action events.",butlerWorkspaceHint:"Butler workspace: {workspacePath}",butlerDisplayNameActiveHint:"Current Butler name: {displayName}",butlerNewSessionAction:"New Session",butlerNewSessionStarted:"Started a fresh Butler session",butlerNewSessionFailed:"Failed to start a fresh Butler session",butlerRefreshAction:"Refresh",butlerHistoryAction:"History",butlerHistoryTitle:"Assistant History",butlerHistoryDescription:"All assistant sessions are kept here, including todo analysis runs and regular chats.",butlerHistoryEmpty:"There is no assistant history yet.",butlerHistoryOpenAction:"Open Session",butlerCurrentSessionBadge:"Current",butlerControlSessionKindChat:"Chat",butlerControlSessionKindTodoAnalysis:"Todo Analysis",butlerLoadingTitle:"Loading Butler",butlerLoadingDescription:"Pulling the current assistant session, summaries, and control state. Please wait a moment.",butlerSidebarInfoTab:"Info",butlerSidebarAutomationTab:"Automation",butlerSidebarSettingsTab:"Settings",butlerSidebarTabsLabel:"Butler sidebar tabs",butlerSidebarLoadFailed:"Failed to load Butler sidebar",butlerInfoContextTitle:"Current Context",butlerInfoContextDescription:"Show only what the Butler is using in this round, without flooding the panel with unrelated details.",butlerInfoCurrentScopeLabel:"Current Scope",butlerInfoCurrentScopeProject:"Project: {projectName}",butlerInfoCurrentScopeGlobal:"Global Overview",butlerInfoManagedProjectsLabel:"Tracked Projects",butlerInfoManagedProjectsValue:"Active {activeCount} / Total {totalCount}",butlerInfoCurrentContextProjectHint:"{projectName} is selected, so follow-up lookups will stay centered on this project first.",butlerInfoCurrentContextGlobalHint:"The Butler is still in global view. It only drills down when you pick a project or ask for details.",butlerInfoProjectSelectedAction:"Currently Selected",butlerInfoProjectViewAction:"View Project",butlerInfoProjectBlockedBadge:"Blocked",butlerInfoProjectRiskBadge:"Risk: {riskLevel}",butlerInfoProjectRiskShortBadge:"Risk {riskLevel}",butlerInfoProjectLastActivityBadge:"Active: {updatedAt}",butlerInfoLatestSessionAction:"Open Latest Session",butlerInfoProgressTitle:"Current Progress",butlerInfoAttentionTitle:"Watch For",butlerInfoNextStepTitle:"Next Step",butlerInfoFollowUpRecordsTitle:"Follow-up Records",butlerInfoFollowUpRecordsDescription:"Only the latest 5 follow-up states are shown here; open the full history for more.",butlerInfoFollowUpRecordsEmpty:"No follow-up records yet.",butlerInfoFollowUpUntitled:"Untitled Session",butlerInfoFollowUpFallback:"Last updated: {updatedAt}",butlerFollowUpHistoryAction:"View History",butlerFollowUpHistoryTitle:"Follow-up History",butlerFollowUpHistoryDescription:"Review the complete follow-up status history and continue drilling into round details.",butlerInfoVerificationRecordsTitle:"Verification Records",butlerInfoVerificationRecordsDescription:"A global view of feature verification records.",butlerInfoVerificationRecordsEmpty:"No verification records yet.",butlerInfoVerificationFallback:"Current status: {status}",butlerInfoTodoRecordsTitle:"Todo Progress",butlerInfoTodoRecordsDescription:"A global view of current todo progress.",butlerInfoTodoRecordsEmpty:"No todo progress records yet.",butlerInfoShowCompletedAction:"Show completed",butlerInfoTodoItemTitle:"Todo {index}",butlerInfoTodoPending:"Pending",butlerInfoTodoInProgress:"In Progress",butlerInfoTodoClosed:"Closed",butlerTodoLifecyclePending:"Pending analysis",butlerTodoLifecycleAnalyzing:"Analyzing",butlerTodoLifecycleAnalyzed:"Prompt ready",butlerTodoLifecycleSessionCreated:"Session created",butlerTodoLifecycleFollowUpActive:"Assistant working",butlerTodoLifecycleCompleted:"Completed",butlerTodoLifecycleFailed:"Failed",butlerTodoLifecycleEmpty:"No analysis summary has been generated for this todo yet.",butlerTodoPromptPreviewAction:"View prompt",butlerTodoAnalyzeAction:"Analyze repo",butlerTodoReanalyzeAction:"Analyze again",butlerTodoAnalyzeRunning:"Analyzing...",butlerTodoAnalyzeQueued:"Queued for background analysis",butlerTodoAnalyzeSucceeded:"Development prompt generated",butlerTodoAnalyzeFailed:"Failed to analyze the todo repository context",butlerTodoAnalyzeFirstAction:"Analyze first",butlerTodoWaitForPromptAction:"Waiting for prompt",butlerTodoStartSessionAction:"Create session",butlerTodoStartSessionRunning:"Creating...",butlerTodoCopyPromptAction:"Copy prompt",butlerTodoOpenSessionAction:"Open session",butlerTodoCopyPromptSucceeded:"Prompt copied",butlerTodoStartSessionSucceeded:"Created a development session for the todo",butlerTodoStartSessionFailed:"Failed to create a development session for the todo",butlerAutomationTasksTitle:"Automation Tasks",butlerAutomationTasksDescription:"Only automation tasks live here: what exists, what state it is in, and when it runs next.",butlerAutomationTasksEmpty:"No automation tasks yet.",butlerAutomationRunsTitle:"Recent Automation Runs",butlerAutomationRunsDescription:"This view only shows recent automation executions and their outcomes.",butlerAutomationRunsEmpty:"No automation run records yet.",butlerAutomationStatusActive:"Running",butlerAutomationStatusWaitingUser:"Waiting for You",butlerAutomationStatusCompleted:"Completed",butlerAutomationStatusFailed:"Failed",butlerAutomationStatusCancelled:"Cancelled",butlerAutomationTaskTypeLabel:"Task type",butlerAutomationTaskTypeManual:"Manual plan task",butlerAutomationTaskTypeInterval:"Scheduled plan task",butlerAutomationTaskTypeCron:"Cron plan task",butlerAutomationTaskTypeFollowUp:"Conditional follow-up task",butlerAutomationTaskEnabled:"Enabled",butlerAutomationTaskDisabled:"Disabled",butlerAutomationTaskLastRunLabel:"Last run",butlerAutomationTaskNextRunLabel:"Next run",butlerAutomationRunSourceLabel:"Source",butlerAutomationRunSourcePatrol:"Plan task run",butlerAutomationRunSourceFollowUp:"Conditional follow-up run",butlerAutomationRunSummaryLabel:"Outcome",butlerAutomationRunProcessedAtLabel:"Processed at",butlerAutomationRunEmptySummary:"No summary was returned for this run.",butlerAutomationPatrolRunTitle:"Patrol Task Run",butlerAutomationViewRoundsAction:"View Round Details",butlerAutomationRoundDetailsTitle:"Follow-up Round Details",butlerAutomationRoundDetailsDescription:"Review each Butler follow-up round for this task.",butlerAutomationRoundLoading:"Loading follow-up round details...",butlerAutomationRoundLoadFailed:"Failed to load follow-up round details",butlerAutomationRoundEmpty:"There are no follow-up round details yet.",butlerAutomationRoundLabel:"Round {round}",butlerAutomationRoundProcessedAtLabel:"Processed at",butlerAutomationRoundStatusLabel:"Task status",butlerAutomationRoundObservedStateLabel:"Session runtime state",butlerAutomationRoundSummaryLabel:"Round decision",butlerAutomationRoundWaitingReasonLabel:"Waiting reason",butlerAutomationRoundPromptLabel:"Proxy-sent content",butlerAutomationRoundKindStarted:"Follow-up started",butlerAutomationRoundKindContinue:"Resumed immediately",butlerAutomationRoundKindQueued:"Queued for send",butlerAutomationRoundKindWaitingUser:"Waiting for user",butlerAutomationRoundKindCompleted:"Marked completed",butlerAutomationRoundKindFailed:"Follow-up failed",butlerAutomationRoundKindCancelled:"Stopped manually",butlerAutomationRoundKindLimitReached:"Round limit reached",butlerInboxAction:"Inbox",butlerInboxModalTitle:"Inbox",butlerInboxModalDescription:"Track project todos here and keep their current progress tied to real projects.",butlerInboxLoading:"Loading inbox...",butlerInboxLoadFailed:"Failed to load inbox",butlerInboxProjectsEmpty:"No managed project is available to bind yet.",butlerInboxEmpty:"No inbox records yet.",butlerInboxCreateTitle:"Add Todo",butlerInboxEditingTitle:"Edit Todo",butlerInboxFormDescription:"Every todo must be bound to a project so the assistant can keep following it later.",butlerInboxListTitle:"Current Todos",butlerInboxListDescription:"This list shows todos across your managed projects so you can handle them in one place.",butlerInboxShowClosedAction:"Show closed",butlerInboxQuickStatusLabel:"Quick status update",butlerInboxProjectLabel:"Project",butlerInboxTypeLabel:"Type",butlerInboxTitleLabel:"Title",butlerInboxTitlePlaceholder:"For example: Finish login captcha flow",butlerInboxContentLabel:"Details",butlerInboxContentPlaceholder:"Describe the current issue, target, or what you want the assistant to keep pushing forward.",butlerInboxStatusLabel:"Progress",butlerInboxTypeTask:"Task",butlerInboxTypeBug:"Bug",butlerInboxTypeFeature:"Feature",butlerInboxTypeChange:"Change",butlerInboxStatusPending:"Pending",butlerInboxStatusInProgress:"In Progress",butlerInboxStatusClosed:"Closed",butlerInboxCreateAction:"Add Todo",butlerInboxUpdateAction:"Save Changes",butlerInboxCancelEditAction:"Cancel Edit",butlerInboxEditAction:"Edit",butlerInboxDeleteAction:"Delete",butlerInboxCreated:"Todo created",butlerInboxUpdated:"Todo updated",butlerInboxDeleted:"Todo deleted",butlerInboxSaveFailed:"Failed to save todo",butlerInboxDeleteFailed:"Failed to delete todo",butlerProviderSwitched:"Provider switched",butlerProviderSwitchedDescription:"Switched to {provider}. The current view was reset and reloaded.",butlerProviderSwitchFailed:"Failed to switch provider",butlerAttachmentUnsupported:"Attachments are not supported in Butler chat yet",butlerOverviewTitle:"Overview",butlerOverviewDescription:"This area pulls together the most important things to pay attention to right now.",butlerMetricProjectCount:"Projects",butlerMetricBlockedCount:"Blocked",butlerMetricHighRiskCount:"High Risk",butlerTopRisksTitle:"Top Risks",butlerNextActionsTitle:"Next Actions",butlerOverviewEmpty:"No data",butlerOverviewLoading:"Loading Butler context summary...",butlerEventsTitle:"Recent Actions",butlerEventsDescription:"Anything Butler just helped you do is listed here.",butlerEventsEmpty:"No action events yet",butlerLoadFailed:"Failed to load Butler workbench",butlerContextStrategyTitle:"Context On Demand",butlerContextStrategyDescription:"Butler only receives the global summary by default. Project sessions, memories, patrols, and verifications are fetched from the backend only after you drill into a specific project.",butlerConversationTitle:"Talk to Assistant",butlerConversationDescription:"This conversation belongs to {displayName} only. When details are needed, {displayName} answers from the aggregated summary first, then pulls the relevant project, session, patrol, or verification data from the backend on demand.",butlerComposerPlaceholder:"Tell {displayName} what you want to inspect or decide next",butlerProjectsTitle:"Projects",butlerProjectsDescription:"Pick a project here and Butler will continue with its latest progress and records.",butlerProjectsEmpty:"No projects available for drilldown",butlerProjectWorkspaceLabel:"Workspace: {workspaceId}",butlerProjectSummaryEmpty:"No summary available yet",butlerProjectOpenDetailAction:"Open Details",butlerProjectSyncAction:"Sync to Timeline",butlerProjectSyncSucceeded:"Project {projectName} was synced into Butler's timeline",butlerProjectActionRequiresSession:"Send Butler a message first, then ask it to continue working on a project.",butlerProjectContextTitle:"Current Project",butlerProjectContextDescription:"This area shows the sessions, records, and results tied to the project you selected.",butlerProjectContextEmpty:"Pick a project from the list or action events first.",butlerProjectContextLoading:"Loading project-related context...",butlerProjectContextMeta:"Project status: {status} · Risk level: {riskLevel}",butlerProjectActionSucceeded:"Butler action completed",butlerProjectActionFailed:"Butler action failed",butlerProjectActionPending:"Processing...",butlerProjectSessionsTitle:"Project Sessions",butlerProjectMemoriesTitle:"Project Memories",butlerProjectPatrolsTitle:"Patrol Runs",butlerProjectVerificationsTitle:"Verification Runs",butlerProjectOpenConversationAction:"Open Real Session",butlerProjectResumeAction:"Resume Session",butlerProjectResumeSucceeded:"Session resumed: {sessionTitle}",butlerProjectStartPatrolAction:"Start Patrol",butlerProjectPatrolSucceeded:"Started a patrol for {projectName}",butlerProjectStartVerificationAction:"Start Verification",butlerProjectVerificationSucceeded:"Started a verification for {projectName}",butlerProjectMemoryMeta:"Type: {memoryType} · Status: {status}",butlerProjectSessionMeta:"Role: {role} · Status: {status}",butlerProjectPatrolMeta:"Status: {status} · Risk: {riskLevel}",butlerProjectVerificationMeta:"Type: {verificationType} · Status: {status}",butlerProjectRunSummaryEmpty:"No summary yet",butlerProjectFocusAction:"Focus This Record",butlerProjectUpdatedAtLabel:"Updated: {updatedAt}",butlerFocusedBadge:"Focused",searchModalTitle:"Search",searchModalDescription:"Search sessions by title, or search code files inside the selected workspace.",searchModeLabel:"Search mode",searchModeSessions:"Sessions",searchModeCode:"Code",searchKeywordLabel:"Keyword",searchWorkspaceLabel:"Workspace",searchSessionPlaceholder:"Search by session title, workspace, or provider",searchCodePlaceholder:"Search by file name or path fragment",searchSessionHint:"Type a keyword to instantly filter matching sessions.",searchCodeHint:"Pick a workspace, then search by file name or path.",searchSessionEmpty:"No matching sessions found.",searchCodeEmpty:"No matching files found.",searchCodeFailed:"Code search failed. Please try again later.",searchSubmit:"Search",filesEntry:"Files",gitEntry:"GIT",terminalManagerEntry:"Process Manager",workspaceSectionTitle:"Workspaces",goBack:"Back",goForward:"Forward",workspaceCount:"Projects",sessionCount:"Sessions",manageWorkspaceAction:"Manage Projects",manageWorkspaceTitle:"Manage Projects",manageWorkspaceDescription:"The list starts with the currently loaded projects. Expand one to inspect its path, Git summary, and code composition, or remove it from the current workbench list.",manageWorkspaceImportAction:"Import Project",manageWorkspaceCloneAction:"Clone Project",manageWorkspaceEmpty:"There are no projects to manage right now.",manageWorkspaceLoading:"Loading project details...",manageWorkspaceLoadFailed:"Failed to load project details.",manageWorkspacePathLabel:"Path",manageWorkspaceGitCommitCount:"Git Commit Count",manageWorkspaceGitInfoLabel:"Git Repository Info",manageWorkspaceRepoRoot:"Repository Root",manageWorkspaceCurrentBranch:"Current Branch",manageWorkspaceRemoteLabel:"Remote",manageWorkspaceNoRemote:"No remote configured",manageWorkspaceNotGit:"This project is not a Git repository.",manageWorkspaceCodeCompositionLabel:"Code Composition",manageWorkspaceCodeCompositionFiles:"files",manageWorkspaceCodeCompositionOther:"Other",manageWorkspaceNoCodeComposition:"No recognizable code files were found for composition stats.",manageWorkspaceCodeTruncated:"The project is large, so only the first {count} recognizable files were counted.",manageWorkspaceColorLabel:"Background Color",manageWorkspaceColorSelectSwatch:"Use color {color}",manageWorkspaceColorClearAction:"Clear Color",manageWorkspaceColorUnset:"Not set. The default worktree color is in use.",manageWorkspaceColorSaveFailed:"Failed to save the workspace color.",manageWorkspaceRemoveAction:"Remove Project",manageWorkspaceRemoving:"Removing...",manageWorkspaceRemoveSuccess:"Project removed from the current workbench list",manageWorkspaceRemoveFailed:"Failed to remove the project",manageWorkspaceRemoveConfirmTitle:"Confirm Project Removal",manageWorkspaceRemoveConfirmDescription:"This only removes the project from the current workbench list. It does not delete any files on disk or historical records. If you load the same path again later, the old records will appear again.",manageWorkspaceRemoveConfirmTarget:'Remove "{name}" from the current workbench?',manageWorkspaceRemoveConfirmAction:"Remove Project",importWorkspaceTitle:"Add Project",importWorkspaceHint:"Import a local code directory",importExpand:"Expand",importCollapse:"Collapse",importPathLabel:"Project Path",importPathPlaceholder:"Enter the project folder path",importNameLabel:"Project Name",importNamePlaceholder:"Optional",importSubmit:"Add Project",importSubmitting:"Adding...",importChooseFolder:"Choose Folder",importPickFolderFailed:"Failed to open the folder picker",importDesktopDropHint:"You can drag a local project folder directly into this area",importHint:"Enter a local code directory and start working",importServerDirectoryHint:"Browse and select the project directory on the server",importBrowserTitle:"Select Server Directory",importBrowserDescription:"You are browsing directories on the server, not on the current device.",importBrowserCurrentPath:"Current Path",importBrowserRoots:"Root Directories",importBrowserOpenParent:"Go Up",importBrowserOpenPath:"Open Path",importBrowserCreateDirectory:"New Folder",importBrowserCreateDirectoryTitle:"New Folder",importBrowserCreateDirectoryDescription:"Create a single child folder in the current server path. Path separators are not accepted.",importBrowserCreateDirectoryLabel:"Folder Name",importBrowserCreateDirectoryPlaceholder:"Enter the new folder name",importBrowserCreateDirectorySuccess:"Folder created",importBrowserCreateDirectoryFailed:"Failed to create folder",importBrowserCreateDirectorySubmit:"Create Folder",importBrowserCreatingDirectory:"Creating...",importBrowserEmpty:"No subdirectory is available in the current path",importBrowserBrowseFailed:"Failed to load server directories",importBrowserSubmit:"Import Current Directory",importPathRequired:"Enter the project path",importSuccess:"Project added",importFailed:"Failed to add project",cloneWorkspaceTitle:"Clone Project",cloneWorkspaceHint:"Clone a Git repository into a server directory and add it to the project list.",cloneSubmit:"Clone Project",cloneSubmitting:"Cloning...",cloneRepositoryLabel:"Git Repository URL",cloneRepositoryPlaceholder:"For example: https://github.com/org/repo.git",cloneParentPathLabel:"Target Parent Directory",cloneParentPathPlaceholder:"Choose an existing directory on the backend server",cloneDirectoryNameLabel:"New Project Directory Name",cloneDirectoryNamePlaceholder:"Defaults to the repository name when left empty",clonePickDirectory:"Choose Directory",cloneAuthModeLabel:"Authentication",cloneAuthModeNone:"No Authentication",cloneAuthModeBasic:"Username + Password",cloneAuthModeToken:"Token",cloneUsernameLabel:"Username",cloneUsernamePlaceholder:"Enter Git username",clonePasswordLabel:"Password",clonePasswordPlaceholder:"Enter Git password",cloneTokenLabel:"Token",cloneTokenPlaceholder:"Enter access token",cloneTokenUsernamePlaceholder:"Optional, defaults to git when left empty",cloneRepoRequired:"Enter the Git repository URL",clonePathRequired:"Select the target parent directory",cloneSuccess:"Project cloned successfully",cloneFailed:"Clone failed",cloneHint:"The target parent directory must already exist. Clone creates a new repository folder under it.",cloneBrowserTitle:"Select Clone Parent Directory",cloneBrowserDescription:"Choose an existing server-side parent directory. Clone will create a new project folder under it.",cloneBrowserSubmit:"Use Current Directory",refreshNavigation:"Refresh",desktopChromeLabel:"Desktop Workbench",windowMinimize:"Minimize Window",windowMaximize:"Maximize or Restore Window",windowClose:"Close Window",contextOpenSession:"Open Session",navigationLoadFailed:"Load failed. Retry.",emptyNavigationTitle:"No project yet",emptyNavigationBody:"Add a local code directory to start working",emptyWorkspaceSessions:"No sessions",favoriteSectionTitle:"Pinned Sessions",favoriteSectionEmpty:"Pinned sessions stay here for quick access.",worktreeSectionTitle:"Child Worktrees",worktreeSectionExpand:"Expand Child Worktrees",worktreeSectionCollapse:"Collapse Child Worktrees",worktreeMergePanelLabel:"Worktree Merge",worktreeMergePanelTitle:"Merge Into Direct Parent",worktreeMergePreviewAction:"Preview",worktreeMergePreviewRefresh:"Preview",worktreeMergePreviewIdle:"Preview not loaded",worktreeMergePreviewLoading:"Checking...",worktreeMergeReady:"Ready to merge",worktreeMergeBlocked:"Merge blocked",worktreeMergeApplying:"Merging...",worktreeMergeApplyAction:"Merge",worktreeMergeApplySuccess:"The worktree has been merged into its direct parent",worktreeMergeApplyFailed:"Failed to merge worktree",worktreeMergePreviewFailed:"Failed to load merge preview",worktreeMergeAlreadyMerged:"Already merged into parent",worktreeMergeMergedHint:"The code is already back in the parent. Cleanup can be done next.",worktreeMergeMergedDirtyHint:"Committed history is already in the parent, but this worktree still has pending work and cannot be cleaned up yet.",worktreeMergeChecklistTitle:"Merge Checklist",worktreeMergeChecklistSourceState:"Worktree state is valid",worktreeMergeChecklistSourceStateBlocked:"The worktree state is inconsistent. The system is not treating it as an active worktree yet.",worktreeMergeChecklistSourceClean:"Source worktree is clean",worktreeMergeChecklistSourceCleanBlocked:"The source worktree still has uncommitted changes. Commit them first.",worktreeMergeChecklistTargetClean:"Parent workspace is clean",worktreeMergeChecklistTargetCleanBlocked:"The direct parent workspace has uncommitted changes and cannot receive the merge.",worktreeMergeChecklistChildren:"No active child worktrees",worktreeMergeChecklistChildrenBlocked:"There are still active child worktrees under this node. Clean leaf nodes first.",worktreeMergeChecklistCommits:"There are commits to merge",worktreeMergeChecklistCommitsBlocked:"This worktree has no commits ahead of the parent workspace.",worktreeMergeChecklistConflicts:"No merge conflicts detected",worktreeMergeChecklistConflictsBlocked:"Merge conflicts were detected. Resolve them before continuing.",worktreeMergeChecklistResultPending:"Waiting for preview",worktreeMergeChecklistResultReady:"Merge can proceed",worktreeMergeChecklistResultReadyDetail:"All checks passed. You can start the merge now.",worktreeMergeChecklistResultBlocked:"Merge cannot proceed yet",worktreeMergeChecklistResultBlockedDetail:"Resolve the blockers above before continuing.",worktreeMergeChecklistResultMerged:"Merged. Cleanup can continue",worktreeMergeCompactPending:"Pending",worktreeMergeCompactChecking:"Checking",worktreeMergeCompactReady:"Ready",worktreeMergeCompactBlocked:"Blocked",worktreeMergeCompactMerged:"Merged",worktreeMergeCompactMerging:"Merging",worktreeMergeCompactCleaning:"Cleaning",worktreeMergeCompactInactive:"State Error",worktreeMergeCompactDirty:"Dirty",worktreeMergeCompactTargetDirty:"Parent Dirty",worktreeMergeCompactConflict:"Conflict",worktreeMergeCompactChildren:"Has Children",worktreeMergeCompactNoCommits:"No Commits",worktreeCleanupAction:"Cleanup",worktreeCleanupRunning:"Cleaning...",worktreeCleanupSuccess:"The worktree has been cleaned up",worktreeCleanupFailed:"Failed to clean up worktree",worktreeCleanupModalTitle:"Confirm Worktree Cleanup",worktreeCleanupModalDescription:"Cleanup removes the worktree directory and app metadata by default. Deleting the branch is only available after it has been merged into the parent branch.",worktreeCleanupConfirm:"Clean up {name}? The git branch will be kept by default.",worktreeCleanupDeleteBranchLabel:"Also delete branch {branch}",worktreeCleanupDeleteBranchHint:"Branch deletion is only available after the branch has been merged into the parent branch.",worktreeCleanupDeleteBranchAction:"Cleanup and Delete Branch",worktreeCleanupDeleteBranchSuccess:"The worktree and branch {branch} have been cleaned up",worktreeCleanupDeleteBranchPartialFailed:"The worktree was cleaned up, but branch {branch} could not be deleted",worktreeMergeCurrentBranch:"Current branch: {branch}",worktreeMergeParentBranch:"Parent branch: {branch}",worktreeMergeTargetWorkspace:"Target parent: {name}",worktreeMergeAheadBehind:"Commit delta: ahead {ahead} / behind {behind}",worktreeMergeBaseCommit:"merge base: {commit}",worktreeMergeConflictLabel:"Conflicting files",favoriteAction:"Pin Session",unfavoriteAction:"Unpin",favoriteAdded:"Session pinned",favoriteRemoved:"Session unpinned",favoriteToggleFailed:"Failed to update pinned state",sessionMoreAction:"More Actions",sessionStateInferred:"Inferred",renameAction:"Rename",renameSuccess:"Session name updated",renameFailed:"Failed to rename session",renameModalTitle:"Rename Session",renameModalDescription:"Use a name you can recognize at a glance. This changes only the title, not the content.",renameInputLabel:"Session Name",renameInputPlaceholder:"Enter a new session name",renamingSession:"Saving...",archiveFolderLabel:"Archived Sessions",archiveFolderAction:"Open Archive Folder",archiveAction:"Archive Session",archiveCurrentSessionAction:"Archive Current Session",archiveAdded:"Session archived",archiveConfirmTitle:"Archive This Session",archiveConfirmDescription:"After archiving, this session will be hidden from the main list for the current workspace, and you can still restore it from archive.",unarchiveAction:"Restore from Archive",archiveRestored:"Session restored to the main list",archiveModalTitle:"Archived Sessions",archiveModalDescription:"This list shows sessions temporarily hidden in the current project. Restore them when needed.",archiveEmpty:"There are no archived sessions in this project yet.",archiveViewAction:"View Archived Sessions",subagentBadge:"Sub-agent",sessionForkSession:"Session Fork",sessionForkMessage:"Message Fork",sessionForkReconstructed:"Reconstructed Fork",subagentExpand:"Expand Sub-agent List",subagentCollapse:"Collapse Sub-agent List",subagentExpandMore:"Show More Sub-agents",favoriteExpandMore:"Show More Pinned",sessionExpandMore:"Show More Sessions",archiveExpandMore:"Show More Archived Sessions",worktreeCollapse:"Collapse Worktree",worktreeExpand:"Expand Worktree",workspaceCollapse:"Collapse Project",workspaceExpand:"Expand Project",reorderWorkspace:"Drag to Reorder Projects",switchWorkspace:"Switch to Project",workspaceReorderFailed:"Failed to save project order.",workspaceCollapseStateSaveFailed:"Failed to save project collapse state.",workspaceHomeSwitcherLabel:"Switch Workspace",workspaceHomeSwitcherTitle:"Workspace",hostWorkspaceSwitcherTitle:"Hosts and Workspaces",hostSwitcherAriaLabel:"Switch Host",hostSwitcherTitle:"Hosts",hostSwitcherCurrentBadge:"Current",hostSwitcherNodeBadge:"HOST",hostSwitcherAddAction:"Add Host",hostSwitcherNameLabel:"Host Name",hostSwitcherNamePlaceholder:"For example: Office Host",hostSwitcherUrlLabel:"Host URL",hostSwitcherUrlPlaceholder:"For example: http://192.168.1.20:3002",hostSwitcherSaveAction:"Save Host",hostSwitcherSwitching:"Switching",hostSwitcherWorkspaceCount:"{count} workspaces",hostSwitcherWorkspaceCountWithUser:"{username} · {count} workspaces",hostSwitchFailed:"Failed to switch host.",hostSwitchUnreachable:"{name} is unreachable right now.",hostSwitchMissing:"The target host no longer exists.",hostDeleteAction:"Delete Host",hostDeleteAriaLabel:"Delete host {name}",hostDeleteBusy:"Removing",hostDeleteConfirm:'Delete host "{name}"? Saved sign-in info will also be cleared.',hostDeleteSuccess:"Removed host: {name}",hostDeleteFailed:"Failed to remove host: {name}",hostAddIncompleteCredentials:"Fill in both the username and password, or leave both blank.",hostAddInvalidUrl:"The host URL is invalid.",hostAddDuplicate:"This host already exists.",hostAddFailed:"Failed to add the host.",hostAddSuccess:"Added host: {name}",mobileWorktreeBadge:"Worktree",workspaceHomeStatusSectionTitle:"Current Workspace",workspaceHomeViewAllAction:"View All Sessions",workspaceHomeMetricActive:"Active",workspaceHomeMetricUnread:"Notifications",workspaceHomeMetricTerminal:"Terminals",workspaceHomeMetricChanges:"Changes",workspaceHomeActiveSessionsSectionTitle:"Active Sessions",workspaceHomeQuickLaunchStatusLabel:"Quick Launch Process",workspaceHomeQuickLaunchRunning:"Running",workspaceHomeQuickLaunchStopped:"Stopped",workspaceHomeWaitingInputLabel:"Waiting Input",workspaceHomeButlerLabel:"Assistant",mobileButlerEntry:"Assistant",mobileConversationToolCloseAction:"Back to Conversation",mobileConversationToolTabsLabel:"Files, Git, and Processes Tabs",mobileConversationToolProcessesTab:"Processes",mobileButlerEmptyTitle:"Assistant is not ready yet",mobileButlerEmptyBody:"The first assistant setup has not been completed yet. Finish the initial setup on desktop, then come back on mobile to review follow-ups and automations.",butlerProjectSyncEmptyState:"Give the assistant a concrete goal and it will continue the work here.",mobileButlerSummaryTitle:"Workspace Summary",mobileButlerSummaryProjects:"Projects",mobileButlerSummaryFollowUps:"Active Tasks",mobileButlerSummaryWaitingUser:"Waiting on You",mobileButlerSummaryInbox:"Open Todos",mobileButlerAssistantWorkspaceLabel:"Butler Workspace",mobileButlerAssistantToneLabel:"Tone",mobileButlerAssistantLanguageLabel:"Language",mobileButlerAssistantUpdatedAtLabel:"Updated",workspaceOverviewTitle:"Put project entry points where you can actually see them",workspaceOverviewBody:"Choose a project first, then decide whether to continue or start a new session.",workspaceListBody:"Keep every loaded project here and surface the frequent actions on the page.",workspaceDetailTitle:"Project Details",workspaceDetailSummaryTitle:"Project Overview",workspaceDetailSummaryBody:"See the path, Git summary, and code footprint first, then jump into the right tool.",workspaceDetailMissingTitle:"Project not found",workspaceDetailMissingBody:"This project may have been removed, or the current snapshot has not loaded it yet.",workspaceDetailDebugTitle:"Service Status",manageWorkspaceDebugDescription:"Review detected services, recent start status, and support guidance for the current project.",workspaceDetailDebugAnalyzeFailed:"Failed to load service status",workspaceDetailDebugFrameworkLabel:"Detected Type",workspaceDetailDebugConfidenceLabel:"Confidence",workspaceDetailDebugCompatibilityLabel:"Readiness",workspaceDetailDebugInjectionLabel:"Recommended Handling",workspaceDetailDebugRuntimeStatusLabel:"Current Status",workspaceDetailDebugFailureStageLabel:"Blocked At",workspaceDetailDebugServiceDiscoveryLabel:"Service Address Handling",workspaceDetailDebugHmrLabel:"Hot Reload Handling",workspaceDetailDebugCallbackLabel:"Callback Handling",workspaceDetailDebugAiFallbackLabel:"Manual Handling Policy",workspaceDetailDebugFrameworkNoteLabel:"Notes",workspaceDetailDebugReasonsLabel:"Summary",workspaceDetailDebugFilesLabel:"Reference Files",workspaceDetailDebugFailureStageEmpty:"None",workspaceDetailDebugRuntimeEmpty:"No runtime record yet.",workspaceDetailDebugFrameworkNoteEmpty:"No extra compatibility note.",workspaceDetailDebugEmptyReasons:"None",workspaceDetailDebugEmptyFiles:"None",workspaceDetailDebugConfidenceHigh:"High",workspaceDetailDebugConfidenceMedium:"Medium",workspaceDetailDebugConfidenceLow:"Low",workspaceDetailDebugCompatibilitySupported:"Ready to Use",workspaceDetailDebugCompatibilityConditional:"Needs More Setup",workspaceDetailDebugCompatibilityUnsupported:"Not Recommended Yet",workspaceDetailDebugCompatibilityUnknown:"Unknown",workspaceDetailDebugInjectionCli:"Startup Args",workspaceDetailDebugInjectionEnv:"Environment",workspaceDetailDebugInjectionOverride:"Adjust Command",workspaceDetailDebugInjectionAiFallback:"Needs Manual Help",workspaceDetailDebugInjectionNone:"Do Not Auto Handle Yet",workspaceDetailDebugRuntimePreparing:"Preparing",workspaceDetailDebugRuntimeRunning:"Running",workspaceDetailDebugRuntimeFailed:"Start Failed",workspaceDetailDebugRuntimeStopped:"Stopped",workspaceDetailDebugRuntimeNotStarted:"Not Started",workspaceDetailDebugRequirementRequired:"Needs Extra Setup",workspaceDetailDebugRequirementNotRequired:"No Extra Setup",workspaceDetailDebugAiPolicyNever:"Do Not Auto Handle",workspaceDetailDebugAiPolicyConditional:"Case by Case",workspaceDetailDebugAiPolicyAllowed:"Allowed",workspaceDetailDebugRuntimeServicesTitle:"Most Recent Start",workspaceDetailDebugRuntimeHistoryTitle:"Recent Starts",workspaceDetailDebugRuntimeHistoryTimeLabel:"Started At",workspaceDetailDebugRuntimeHistoryServiceLabel:"Services",workspaceDetailDebugRuntimeHistoryResultLabel:"Result",workspaceDetailDebugRuntimeHistoryTitleWithIndex:"Run #{id}",workspaceDetailDebugRuntimeHistoryFailedSummary:"{services} did not start correctly in this run.",workspaceDetailDebugRuntimeHistoryGenericSummary:"Recent start records are kept here so repeated failures are easier to spot.",workspaceDetailDebugRuntimeHistoryNoServices:"None",workspaceDetailDebugRuntimeHistoryResultRunning:"Still Running",workspaceDetailDebugRuntimeHistoryResultFailed:"Start Failed",workspaceDetailDebugRuntimeHistoryResultStopped:"Stopped",workspaceDetailDebugRuntimeHistoryResultPreparing:"Preparing",workspaceDetailDebugRuntimeServicePortLabel:"Assigned Port",workspaceDetailDebugRuntimeServiceBindingLabel:"Port State",workspaceDetailDebugRuntimeServiceProcessLabel:"Process",workspaceDetailDebugRuntimeServiceFailureLabel:"Issue Stage",workspaceDetailDebugRuntimeServiceAiLabel:"Manual Handling Record",workspaceDetailDebugDetectedServicesTitle:"Detected Services",workspaceDetailDebugServicePathLabel:"Location",workspaceDetailDebugServiceFrameworkLabel:"Detected As",workspaceDetailDebugServiceCommandLabel:"Start Command",workspaceDetailDebugServiceRequirementsLabel:"Extra Setup Needed",workspaceDetailDebugServiceActionLabel:"Recommended Action",workspaceDetailDebugOpenPageAction:"Service Debug",workspaceDetailDebugPageTitle:"Service Debug",workspaceDetailDebugPageDescription:"See detected services, recent start results, and support guidance for this workspace.",workspaceDetailDebugPageHeroEyebrow:"Service Overview",workspaceDetailDebugOverallStatusLabel:"Overall Status",workspaceDetailDebugOverallSummaryLabel:"Summary",workspaceDetailDebugOverallStatusSupported:"Ready to Start",workspaceDetailDebugOverallStatusConditional:"Some Services Need More Setup",workspaceDetailDebugOverallStatusBlocked:"Do Not Start Everything Yet",workspaceDetailDebugOverallSummaryEmpty:"No usable service check result is available yet.",workspaceDetailDebugOverallSummaryMixed:"Detected {webCount} web services and {desktopCount} desktop-shell services. Desktop shells are shown separately and excluded from web auto handling.",workspaceDetailDebugOverallSummaryDesktopOnly:"Detected {count} desktop-shell services and no clear web service yet.",workspaceDetailDebugOverallSummaryWebOnly:"Detected {count} web services that can join the web debug flow.",workspaceDetailDebugSummaryServiceCountLabel:"Total Services",workspaceDetailDebugSummaryWebCountLabel:"Web Services",workspaceDetailDebugSummaryDesktopShellCountLabel:"Desktop Shells",workspaceDetailDebugSummaryWebServicesChip:"{count} web services",workspaceDetailDebugSummaryDesktopShellChip:"{count} desktop shells",workspaceDetailDebugSummaryUnsupportedChip:"{count} blocking items",workspaceDetailDebugAutoInjectionEligible:"Current web services are ready for automatic handling",workspaceDetailDebugAutoInjectionBlocked:"Do not treat this whole project as auto-ready yet",workspaceDetailDebugDesktopShellSummaryHint:"Desktop shell services are shown separately from web service handling",workspaceDetailDebugCompatibilityBreakdown:"Ready {supported} / Needs setup {conditional} / Not recommended {unsupported}",workspaceDetailDebugLastAnalyzedAtLabel:"Last Check",workspaceDetailDebugTargetSourceRepo:"Scope: Repository Root",workspaceDetailDebugTargetSourceWorktree:"Scope: Current Worktree",workspaceDetailDebugRequirementsNone:"No extra setup required",workspaceDetailDebugServiceSectionDescription:"View the project one service at a time so you can tell what is ready and what still needs setup.",workspaceDetailDebugRuntimeSectionDescription:"This only shows the most recent start result so you can quickly see which service failed to come up.",workspaceDetailDebugMatrixSectionDescription:"This section explains the default support level for each detected service type.",workspaceDetailDebugMatrixTitle:"Support Guidance",workspaceDetailDebugMatrixOpenAction:"Open Support Matrix",workspaceDetailDebugMatrixModalDescription:"Use a real matrix table so people can scan support rules without reading a wall of cards.",workspaceDetailDebugMatrixFrameworkHeader:"Framework",workspaceDetailDebugMatrixCompatibilityHeader:"Support",workspaceDetailDebugMatrixInjectionHeader:"Mode",workspaceDetailDebugMatrixDiscoveryHeader:"Discovery",workspaceDetailDebugMatrixHmrHeader:"HMR",workspaceDetailDebugMatrixCallbackHeader:"Callback",workspaceDetailDebugMatrixAiHeader:"Manual",workspaceDetailDebugMatrixNotesHeader:"Notes",workspaceDetailDebugMatrixCompatibilitySupportedShort:"Ready",workspaceDetailDebugMatrixCompatibilityConditionalShort:"Needs Setup",workspaceDetailDebugMatrixCompatibilityUnsupportedShort:"Avoid",workspaceDetailDebugMatrixCompatibilityUnknownShort:"Unknown",workspaceDetailDebugMatrixInjectionCliShort:"CLI",workspaceDetailDebugMatrixInjectionEnvShort:"ENV",workspaceDetailDebugMatrixInjectionOverrideShort:"CMD",workspaceDetailDebugMatrixInjectionAiFallbackShort:"Manual",workspaceDetailDebugMatrixInjectionNoneShort:"None",workspaceDetailDebugMatrixRequirementRequiredShort:"Needs Work",workspaceDetailDebugMatrixRequirementNotRequiredShort:"Not Needed",workspaceDetailDebugMatrixAiNeverShort:"Do Not Use",workspaceDetailDebugMatrixAiConditionalShort:"Conditional",workspaceDetailDebugMatrixAiAllowedShort:"Allowed",workspaceDetailDebugMatrixLegendSummary:"Icon meanings: check means the default path is clear, warning means you still need setup, and cross means this path is not recommended for automatic handling yet.",workspaceDetailDebugMatrixDiscoveryNote:"Service address handling such as proxy, rewrites, and discovery.",workspaceDetailDebugMatrixHmrNote:"Hot reload and other long-lived frontend dev connections.",workspaceDetailDebugMatrixCallbackNote:"Callback-style entries such as OAuth, login callback, or webhook.",workspaceDetailDebugMatrixAiNote:"Whether edge cases are allowed to fall back to manual help.",workspaceDetailDebugFailureStageServiceDiscovery:"Still needs service address handling",workspaceDetailDebugFailureStageHmr:"Still needs hot reload handling",workspaceDetailDebugFailureStageCallback:"Still needs callback handling",workspaceDetailDebugFailureStageAiFallbackRequired:"Needs manual review",workspaceDetailDebugFailureStageAdapterSelection:"No suitable start method was found",workspaceDetailDebugFailureStageLaunchRequirements:"Some launch requirements are still missing",workspaceDetailDebugFailureStageCommandExecution:"The start command did not run correctly",workspaceDetailDebugFailureStageProcessExit:"The service exited right after start",workspaceDetailDebugFailureStageProcessRuntimeError:"The service hit a runtime error",workspaceDetailDebugFailureStageStaleRuntimeBinding:"This start record is no longer valid",workspaceDetailDebugFailureStageUnknown:"Unknown stage ({code})",workspaceDetailDebugBindingAllocated:"Assigned",workspaceDetailDebugBindingListening:"Reachable",workspaceDetailDebugBindingFailed:"Not Ready",workspaceDetailDebugBindingReleased:"Released",workspaceDetailDebugBindingUnknown:"Unknown",workspaceDetailDebugProcessCreating:"Starting",workspaceDetailDebugProcessRunning:"Running",workspaceDetailDebugProcessClosed:"Stopped",workspaceDetailDebugProcessError:"Error",workspaceDetailDebugProcessUnknown:"Unknown",workspaceDetailDebugPortEmpty:"None",workspaceDetailDebugRoleFrontend:"Web Service",workspaceDetailDebugRoleBackend:"Backend Service",workspaceDetailDebugRoleWorker:"Background Worker",workspaceDetailDebugRoleMock:"Mock Service",workspaceDetailDebugRoleDesktopShell:"Desktop Shell",workspaceDetailDebugRoleCustom:"Custom",workspaceDetailDebugServiceOverviewSupported:"This service is clearly identified and is usually ready to start once you follow the recommended handling.",workspaceDetailDebugServiceOverviewConditional:"This service is identified, but still needs a few extra setup steps before it can start cleanly.",workspaceDetailDebugServiceOverviewUnsupported:"This service is not recommended for direct automatic handling yet. Confirm the start flow manually first.",workspaceDetailDebugServiceOverviewUnknown:"This service has not been identified clearly yet. The current result is kept for later review.",workspaceDetailDebugServiceOverviewDesktopShell:"This is a desktop shell service. It is shown separately and does not participate in automatic web-port handling.",workspaceDetailDebugServiceActionSupported:"Start Directly",workspaceDetailDebugServiceActionConditional:"Complete Setup First",workspaceDetailDebugServiceActionUnsupported:"Handle Manually",workspaceDetailDebugServiceActionUnknown:"Confirm Service Type First",workspaceDetailDebugServiceActionDesktopShell:"Handle as Desktop Shell",workspaceDetailDebugAiEditEmpty:"None",workspaceDetailDebugAiEditPending:"Pending",workspaceDetailDebugAiEditApplied:"Applied",workspaceDetailDebugAiEditRolledBack:"Rolled Back",workspaceDetailDebugAiEditRejected:"Rejected",workspaceSessionListBody:"Project sessions, favorites, and archive actions live here instead of hiding in a sidebar.",recentSessionsSectionTitle:"Recent Sessions",recentSessionsSectionBody:"Jump back into the work you touched most recently.",currentWorkspaceSectionTitle:"Current Project Sessions",currentWorkspaceSectionBody:"Keep the sessions for the current project together so the context stays obvious.",sessionIndexTitle:"Sessions deserve their own page",sessionIndexBody:"Recent, favorites, and current-project sessions are split into clear sections for mobile.",toolsMoreAction:"More",toolsSwipeHint:"Swipe left or right to switch between files and Git",toolsSwipePosition:"{current} / {total}",toolFilesBody:"Browse project files, changed files, and code context without relying on a desktop sidebar.",toolGitBody:"Open a clear Git entry for status, commits, and branches in the current project.",toolTerminalsBody:"Open the full terminal page for input-heavy and scroll-heavy tasks.",toolProcessesBody:"Review terminal templates, runtime status, and process entry points for the current project.",toolsWorkspaceRequiredBody:"Pick a project before opening this tool page.",createSession:"New Session",createSessionModalTitle:"Choose Session Type",createSessionModalDescription:"Pick the session type first, then start the actual session process.",createSessionWorkspaceLabel:"Choose Workspace",createSessionProviderLabel:"Choose Provider",createSessionTarget:"Current Project",createWorktreeSectionTitle:"Child Workspace",createWorktreeSectionDescription:"Create a child workspace from the current project first, then choose the provider for the new session.",createWorktreeAction:"Add Child Workspace",createWorktreeCollapseAction:"Hide Child Workspace Form",createWorktreeBranchLabel:"Branch Name",createWorktreeBranchPlaceholder:"For example: feat/login-codex",createWorktreeBranchRequired:"Enter the child workspace branch name first.",createWorktreeBranchInvalid:"Branch names may only contain letters, numbers, -, _, and /. They cannot start or end with / or contain //.",createWorktreeDisplayNameLabel:"Display Name (Optional)",createWorktreeDisplayNamePlaceholder:"Defaults to the branch name",createWorktreeBaseRefLabel:"Create From Branch/Commit (Optional)",createWorktreeBaseRefPlaceholder:"Defaults to the current branch",createWorktreeBaseRefHint:"You can choose from {localCount} local branches, {remoteCount} remote branches, and {tagCount} tags, or enter a commit hash manually.",createWorktreeBaseRefLoading:"Loading branches and tags from the current repository...",createWorktreeBaseRefLoadFailed:"Failed to load branches and tags. You can still enter a branch, tag, or commit hash manually.",createWorktreeBaseRefLocalGroup:"Local Branches",createWorktreeBaseRefRemoteGroup:"Remote Branches",createWorktreeBaseRefTagGroup:"Tags",createWorktreeBaseRefCurrentBadge:"Current",createWorktreeBaseRefRecommendedBadge:"Recommended",createWorktreeBaseRefEmpty:"No matches found. You can still enter a branch, tag, or commit hash manually.",createWorktreeBaseRefToggle:"Show available branches and tags",createWorktreeHelpAction:"How to Fill This",createWorktreeHelpTitle:"What These Fields Mean",createWorktreeHelpBranchTitle:"Branch Name",createWorktreeHelpBranchBody:"This is the name of the new child workspace. It is also what you will see in the list later. A short name like feat/login is usually enough.",createWorktreeHelpDisplayNameTitle:"Display Name",createWorktreeHelpDisplayNameBody:"Use this if you want a clearer name in the list. If you leave it empty, the branch name will be used automatically.",createWorktreeHelpBaseRefTitle:"Create From Branch/Commit",createWorktreeHelpBaseRefBody:"This decides where the new child workspace starts from. Most of the time, you can keep the default. Only change it if you want to start from another branch, tag, or specific commit.",createWorktreeSubmit:"Create Child Workspace",createWorktreeSubmitting:"Creating...",createWorktreeSucceeded:"Child workspace created: {name}",createWorktreeFailed:"Failed to create child workspace",providerClaudeCode:"Claude Code",providerCodexDescription:"Create a Codex session for the current default workflow.",providerClaudeDescription:"Create a Claude Code session when you want to switch to another conversation chain.",providerOpenCodeDescription:"Create an OpenCode session to continue context via the OpenCode service.",providerGeminiDescription:"Create a Gemini session for the native Gemini CLI workflow.",providerKimiDescription:"Create a Kimi session for the native Kimi CLI workflow.",providerOptionHint:"A session is created immediately after selection",providerChecking:"Checking...",startClaude:"Claude",startCodex:"Codex",startingSession:"Creating...",startClaudeSuccess:"Claude session created",startCodexSuccess:"Codex session created",startSessionFailed:"Failed to create session",auxiliaryTitle:"Info",auxiliarySubtitle:"Files and Git status",expandAuxiliary:"Expand",collapseAuxiliary:"Collapse",auxiliaryEmptyTitle:"Select a session",auxiliaryEmptyBody:"Session files and Git info will appear here",batchSelectSessions:"Select Sessions in Bulk",batchSelectionMode:"Batch Selection",selectAllSessions:"Select All",clearSelectedSessions:"Clear Selection",batchArchiveAction:"Archive Selected",batchArchiving:"Archiving...",batchArchiveSuccess:"Selected sessions archived",batchArchivePartialFailed:"Some sessions failed to archive. Retry.",batchArchiveFailed:"Batch archive failed",hideSessionSidebar:"Hide Session List",showSessionSidebar:"Show Session List",hideInfoSidebar:"Hide Info Sidebar",showInfoSidebar:"Show Info Sidebar",centerTabsLabel:"Center Area Tabs",infoTabsLabel:"Info Sidebar Tabs",leftResizerLabel:"Resize Left Sidebar",rightResizerLabel:"Resize Right Sidebar",filesPanelEmpty:"Import or select a workspace first to use file management.",gitPanelEmpty:"Import or select a workspace first to view Git info.",infoPanelDeferred:"The left session list loads first. The right auxiliary panel mounts slightly later."},workbench:{emptyEyebrow:"Start",emptyTitle:"Choose a session first",emptyBody:"Continue from the left, or create a new session.",emptyResumeTitle:"Continue",emptyResumeBody:"Go back to where you stopped.",emptyNewTitle:"New session",emptyNewBody:"Put a new question into a clean session.",emptyCompanionTitle:"Side details",emptyCompanionBody:"Open files, Git, or terminal on the right when needed.",emptyTip:"When you are ready, pick a session from the left."},conversation:{resendButton:"Resend",historyLoading:"Loading...",historyLoadingOlder:"Loading older messages...",historyLoadFailed:"Load failed",inheritedContextLoading:"Preparing inherited context from the parent session...",inheritedContextMessageLabel:"Inherited context before the forked message",inheritedContextSessionLabel:"Inherited context from the parent session",inheritedContextSummary:'Collapsed {count} inherited messages from "{parentTitle}" by default.',actionInheritedSelectionSummary:'Collapsed the selected text from "{parentTitle}" by default.',inheritedContextExpand:"Show inherited context",inheritedContextCollapse:"Hide inherited context",inheritedContextParentFallback:"Parent session",timelineEmpty:"Start Conversation",composerPlaceholder:"State the next step clearly. Let the session continue from there.",sendButton:"Send Message",attachFiles:"Attach File",attachmentSourceSheetTitle:"Add Files",attachmentSourceSheetDescription:"Choose one or more files from the system picker, or capture a photo.",attachmentTakePhoto:"Take Photo",attachmentTakePhotoHint:"Open the camera and attach a new photo",attachmentChooseFromLibrary:"Choose Files",attachmentChooseFromLibraryHint:"Open the system file picker and add one or more files",pasteImagesHint:"Supports pasting files directly",attachmentImageOnly:"Only image attachments are supported right now",attachmentReadFailed:"Failed to read attachment. Retry.",attachmentPreviewAlt:"Selected image preview",attachmentPreviewOpen:"Open attachment",attachmentPreviewClose:"Close preview",attachmentPreviewLoading:"Loading attachment...",attachmentPreviewUnavailable:"Attachment unavailable",attachmentDownload:"Download attachment",attachmentDropHint:"Drop files here to attach them",imageAttachmentLabel:"Image Attachment",fileAttachmentLabel:"File Attachment",imagePreviewTitle:"Image Preview",imagePreviewHint:"Click the backdrop or press Esc to close the preview",removeAttachment:"Remove Attachment",selectionTodoAction:"Todo",selectionActionButton:"Action",selectionActionSubmit:"Open action child session",selectionActionPromptLabel:"What should it do",selectionActionPromptPlaceholder:"For example: explain this, turn it into notes, or send it to a specific API",selectionActionIncludeContext:"Include current context",selectionActionContextUnavailable:"This selection spans multiple messages, so context inheritance is disabled for safety.",selectionActionDefaultPrompt:"Please process this content.",selectionActionQuotedLabel:"Selected text",selectionActionFailed:"Failed to create the action child session.",actionSessionBadge:"Action",modelSelectorLabel:"Model",modelUseCliDefault:"Default",modelUseCodexConfig:"Follow current Codex config",modelUseOpenCodeConfig:"Follow current OpenCode config",reasoningSelectorLabel:"Reasoning Effort",reasoningLow:"Low",reasoningMedium:"Medium",reasoningHigh:"High",reasoningMaximum:"Maximum",slashMenu:"Commands",slashMenuTitle:"Quick Commands",slashCommandPlan:"Ask for an execution plan first",slashCommandReview:"Switch directly to code review mode",slashCommandExplain:"Ask for a clearer explanation",toolInputLabel:"Input",toolResultLabel:"Result",toolResultEmpty:"No output yet",toolPreviewCommand:"Command",toolPreviewTerminal:"Terminal",toolStatusRunning:"Running",toolStatusFailed:"Failed",toolStatusCompleted:"Completed",runtimeThinkingPlaceholder:"{provider} is thinking...",applyPatchEditedLabel:"Edited",applyPatchAddedLabel:"Added",applyPatchDeletedLabel:"Deleted",applyPatchDialogTitle:"Patch Change Preview",applyPatchDialogDescription:"This shows the file-level changes that apply_patch is about to perform.",applyPatchOpenDiff:"View Diff",applyPatchAddedStat:"Added",applyPatchRemovedStat:"Removed",applyPatchEmpty:"This patch does not contain any file change that can be displayed right now.",titleFallback:"Continue Conversation",draftTitleCodex:"New Codex session",draftTitleClaude:"New Claude Code session",draftTitleOpenCode:"New OpenCode session",draftTitleGemini:"New Gemini session",draftTitleKimi:"New Kimi session",headerWorkspace:"Workspace",headerWorkspaceUnknown:"Unknown Workspace",headerProvider:"Provider",headerConnection:"Connection",headerRuntime:"Runtime",providerCodex:"Codex",branchTreeAction:"Branch Tree",branchTreeTitle:"Branch Tree",branchTreeDescription:"This panel only shows the parent-child chain around the current session.",branchTreeUpstreamLabel:"Upstream Chain",branchTreeCurrentLabel:"Current Session",branchTreeChildrenLabel:"Child Branches",branchTreeCurrentBadge:"Current",branchTreeArchivedBadge:"Archived",branchTreeEmpty:"This session does not have any child branches yet.",branchTreeMapTitle:"Branch Map",branchTreeMapDescription:"This view expands the full branch family around the current session.",branchTreePreviewTitle:"Session Preview",branchTreePreviewDescription:"Click a node to float its latest messages before switching.",branchTreePreviewLoading:"Loading recent messages for this session...",branchTreePreviewFailed:"Failed to load the session preview.",branchTreePreviewEmpty:"There are no recent messages to preview for this session.",branchTreeResizeHandle:"Resize branch tree width",branchTreeZoomInAction:"Zoom in branch map",branchTreeZoomOutAction:"Zoom out branch map",branchTreeZoomResetAction:"Reset branch map zoom",branchTreeSwitchAction:"Switch to This Session",branchTreeCurrentAction:"Already Current",branchTreeToolMessageFallback:"tool message",branchTreeMessageEmpty:"This message does not have visible text.",moreSessionActions:"More session actions",moreSessionActionsTitle:"More Session Actions",moreSessionActionsDescription:"Branch navigation and assistant actions live here so the mobile header stays clean.",branchTreeTab:"Branch Tree",aiAssistantTab:"Assistant",aiAssistantTabDescription:"Use the assistant entry here when you want to continue follow-up or start verification for this session.",providerClaude:"Claude",providerOpenCode:"OpenCode",providerGemini:"Gemini",providerKimi:"Kimi",capabilitySend:"Send Enabled",queueTitle:"Queued Messages",queueDescription:"After the current run finishes, these messages will be processed automatically in order.",queueOrderPrefix:"Queue Position",queueStatusQueued:"Queued",queueStatusFailed:"Dispatch Failed",queueDelete:"Delete",queueDeleting:"Deleting",permissionRequestSectionTitle:"Pending approvals",permissionRequestSectionDescription:"Provider-side approvals are unified here so you do not need to learn three different dialogs.",permissionRequestToastTitle:"Approval needed",backgroundPermissionToastDescription:"{title} · {requestTitle}",backgroundCompletionToastTitle:"Session completed",backgroundCompletionToastDescription:"{title}",backgroundFailureToastTitle:"Session failed",backgroundFailureToastDescription:"{title} · {detail}",permissionRequestReplyFailed:"Failed to reply to the approval request.",permissionRequestSubmitting:"Submitting...",permissionRequestReasonLabel:"Reason",permissionRequestCommandLabel:"Command",permissionRequestToolLabel:"Tool",permissionRequestCwdLabel:"Working directory",permissionRequestPathsLabel:"Related paths",permissionRequestPermissionsLabel:"Requested permissions",permissionRequestReadLabel:"Read",permissionRequestWriteLabel:"Write",permissionRequestNetworkLabel:"Network",permissionRequestQuestionsLabel:"Questions",permissionRequestDetailLabel:"Details",permissionRequestEmpty:"None",permissionRequestUnknown:"Unknown",permissionRequestKindCommand:"Command",permissionRequestKindFileChange:"File Change",permissionRequestKindPermissions:"Permissions",permissionRequestKindUserInput:"User Input",permissionRequestKindToolCall:"Tool Call",queueImageOnly:"Image attachments only",sendGuidanceButton:"Add Guidance",queueGuidanceButton:"Queue Guidance",capabilityDenied:"Restricted",capabilitySendDisabled:"Sending disabled",connectionConnected:"Realtime connected",connectionReconnecting:"Reconnecting",connectionReconnectFailed:"Reconnect failed",connectionClosed:"Connection closed",runtimeIdle:"Idle",runtimeStarting:"Starting",runtimeRunning:"Running",runtimeReconnecting:"Recovering",runtimeStale:"Awaiting confirmation",runtimeUnknown:"Status pending",runtimeCompleted:"Completed",runtimeInterrupted:"Interrupted",runtimeFailed:"Failed",rulesMessageTitle:"Rules",rulesMessageHint:"This is the startup rule block for the session. It is collapsed by default and can be expanded when needed.",rulesMessageExpand:"Expand Rules",rulesMessageCollapse:"Collapse Rules",systemPromptTitle:"System Prompt",systemPromptHint:"This is the Kimi startup system prompt for the session. It is collapsed by default and can be expanded when needed.",systemPromptExpand:"Expand Prompt",systemPromptCollapse:"Collapse Prompt",taskProgressButton:"Task Progress ({count})",taskProgressModalTitle:"Task Progress",taskProgressModalDescription:"This session has recorded {count} tasks. Check the latest progress here.",taskProgressExplanationTitle:"Latest Update Note",taskProgressSummaryTotal:"Total",taskProgressStatusPending:"Pending",taskProgressStatusInProgress:"In Progress",taskProgressStatusCompleted:"Completed",taskProgressStatusFailed:"Failed",taskProgressStatusCancelled:"Cancelled",taskCardPlanTitle:"Plan Update",taskCardTodoTitle:"Task Update",taskCardPlanUpdated:"Latest Plan",taskCardTodoUpdated:"Latest Task List",taskCardRawExpand:"Show Raw Call",taskCardRawCollapse:"Hide Raw Call",taskCardSummaryTotal:"{count} total",taskCardSummaryInProgress:"{count} in progress",taskCardSummaryPending:"{count} pending",taskCardSummaryCompleted:"{count} completed",taskCardSummaryFailed:"{count} failed",butlerActionButton:"Assistant",butlerActionModalTitle:"Butler Actions",butlerActionModalDescription:"Ask Butler to continue this development session or start a development verification run.",butlerActionLoading:"Loading Butler action context...",butlerActionLoadFailed:"Failed to load Butler action context",butlerActionProjectLabel:"Project",butlerActionSessionLabel:"Session",butlerFollowUpAction:"Follow Up This Session",butlerFollowUpActionDescription:"Let Butler keep watching this session and continue pushing it after each stop or blocker.",butlerFollowUpObjectiveLabel:"Follow-up Goal",butlerFollowUpObjectivePlaceholder:"Example: finish this feature for me; if the spec still has unfinished work, keep going.",butlerFollowUpCompletionCriteriaLabel:"Finish Conditions",butlerFollowUpCompletionCriteriaPlaceholder:"Example: only stop once the current feature is finished against the agreed requirements.",butlerFollowUpRoundLimitLabel:"Max Auto Follow-up Rounds",butlerFollowUpRoundLimitHint:"Once the limit is reached, Butler stops auto-resuming so the session does not expand forever.",butlerCurrentFollowUpLabel:"Current Follow-up",butlerCurrentFollowUpProgress:"Auto-continued {current} / {max} rounds",butlerStopFollowUpAction:"Stop Current Follow-up",butlerFollowUpObjectiveRequired:"Please describe the goal you want Butler to keep pushing",butlerVerificationAction:"Start Development Verification",butlerVerificationActionDescription:"Let Butler start a user-facing verification run for the feature behind this session.",butlerFollowUpStarted:"Butler follow-up started",butlerFollowUpStartedDescription:"Butler will continue following the current development session for {projectName}.",butlerFollowUpFailed:"Failed to start Butler follow-up",butlerFollowUpStopped:"Current Butler follow-up stopped",butlerFollowUpStoppedDescription:"Automatic follow-up for the current session has been stopped and will not auto-resume.",butlerFollowUpStopFailed:"Failed to stop Butler follow-up",butlerVerificationStarted:"Development verification started",butlerVerificationStartedDescription:"Butler will start a development verification run for {projectName}.",butlerVerificationFailed:"Failed to start development verification",butlerAnalysisTitle:"Butler Analysis",butlerAnalysisLoadFailed:"Failed to load Butler analysis",butlerAnalysisObjectiveLabel:"Objective",butlerAnalysisStatusLabel:"Decision",butlerAnalysisSummaryLabel:"Latest analysis",butlerAnalysisWaitingReasonLabel:"Waiting reason",butlerAnalysisEmpty:"There is no Butler analysis record yet.",butlerProxyMessageBadge:"Sent by Butler",butlerOriginDetailTitle:"Related Butler Follow-up",butlerOriginDetailLoading:"Loading the related Butler follow-up...",butlerOriginDetailLoadFailed:"Failed to load the related Butler follow-up",butlerOriginDetailObjectiveLabel:"Objective",butlerOriginDetailStatusLabel:"Status",butlerOriginDetailSummaryLabel:"Latest analysis",butlerOriginDetailWaitingReasonLabel:"Waiting reason",thinkingLabel:"Thinking",filePanelWorkspaceTab:"Workspace",filePanelSessionTab:"Session",filePanelSessionViewLabel:"Session File View",filePanelSessionTreeView:"Tree",filePanelSessionListView:"List",filePanelSessionLoading:"Collecting files changed in this session...",filePanelSessionEmpty:"No cacheable changed files have been detected in this session yet.",filePanelSessionNoSession:"Only the workspace is selected right now. Pick a session before viewing session-scoped files.",filePanelSessionStageAll:"Stage All",filePanelSessionStageSuccess:"Changes from this session have been added to the staging area.",filePanelSessionLoadFailed:"Failed to load changed files for this session.",filePanelSessionSummary:"Detected Files",filePanelSessionUnstagedSummary:"Unstaged",filePanelSessionDeleted:"Deleted",filePanelOpenExternalWindow:"Open in New Window",filePanelOpenExternalFailed:"Failed to open the file window externally."},desktopWindow:{invalidWindowId:"The external window is missing a window id.",loadDescriptorFailed:"Failed to load the window descriptor.",unsupportedKind:"Rendering the {kind} window is not supported yet."},git:{recentVersionsTitle:"Recent Versions",stagedChangesTitle:"Staged Changes",expandRecentVersions:"Expand Recent Versions",collapseRecentVersions:"Collapse Recent Versions",stagedLabel:"Staged",workingTreeLabel:"Working Tree",changeTreeHint:"Show current changes by directory hierarchy",discard:"Discard Changes",discardFailed:"Failed to discard changes",operationMenu:"Actions",currentBranch:"Current Branch",resizePanels:"Resize file and recent-version panels",switchBranchTo:"Switch To",undoLastCommit:"Undo Last Commit",undoLastCommitFailed:"Failed to undo last commit",undoLastCommitSuccess:"Last commit undone",historyKindLocal:"Local",historyKindRemote:"Remote",historyKindShared:"Synced",pushNow:"Push",commitNow:"Commit",refreshNow:"Refresh",openExternalWindow:"Open Git in New Window",openExternalFailed:"Failed to open the Git window externally.",stageAll:"Stage All",unstageAll:"Unstage All",discardAll:"Discard All Changes",selectedFiles:"Selected Files",clearSelection:"Clear Selection",selectFile:"Select File",discardConfirm:"Discard these changes? {path}",historyItemMenu:"Commit Actions",copyCommitHash:"Copy Commit Hash",copyCommitHashSuccess:"Commit hash copied.",copyCommitSubject:"Copy Commit Title",copyCommitSubjectSuccess:"Commit title copied."},terminalManager:{workspaceField:"Current Workspace",refresh:"Refresh List",loadFailed:"Failed to load the terminal management panel",shellLoadFailed:"Failed to load the terminal shell list",emptyWorkspaceBody:"There is no available workspace yet.",noCurrentWorkspaceBody:"Select a session first so process management can bind to its workspace.",emptyTerminalBody:"There is no terminal instance in the current workspace yet.",emptyTemplateBody:"There is no quick launch item yet. Save a command or script first.",shellField:"Shell for New Terminal",shellUnavailable:"Unavailable",cwdField:"Startup Directory",cwdLabel:"Directory",cwdPlaceholder:"Defaults to the workspace root when left empty",modeField:"Launch Mode",commandMode:"Command",scriptMode:"Script",quickLaunchTitle:"Quick Launch",quickLaunchDescription:"Save a launch preset here so you can start it in a new terminal with one click later.",desktopPanelDescription:"Keep the default view focused on launch decisions, while paths and command lines stay inside the details layer.",openExternalWindow:"Open in New Window",openExternalFailed:"Failed to open the process management window externally.",runningCountLabel:"Running",portWatchCountLabel:"Watched Ports",terminalCountLabel:"Terminals",templateSectionTitle:"Launch Items",templateSectionDescription:"The right side prioritizes the port status of launch items so you can see whether a service is already in use.",openCreateModalAction:"Add Quick Launch Item",createModalTitle:"Add Quick Launch Item",createModalDescription:"Save a command or script here. You can attach a port and then start it with one click while checking whether it is already running.",editAction:"Edit Launch Item",editModalTitle:"Edit Quick Launch Item",editModalDescription:"Update the name, command, directory, and port for this quick launch item.",saveTemplateChangesAction:"Save Changes",templateUpdating:"Saving changes...",templateUpdateSuccess:"Quick launch item updated.",templateUpdateFailed:"Failed to update quick launch item",removeAction:"Remove Launch Item",templateRemoving:"Removing...",removeConfirmTitle:"Remove Quick Launch Item",removeConfirmAction:"Remove Item",removeConfirmTarget:'Remove "{name}"? It will disappear from the quick launch list after removal.',removeRunningConfirmTarget:'"{name}" is still running. Removing it only deletes the launch item configuration and will not stop the active process. Continue?',templateDeleteSuccess:"Quick launch item removed.",templateDeleteFailed:"Failed to remove quick launch item",terminalSectionTitle:"Terminal Instances",terminalSectionDescription:"This area shows terminals currently managed by CodingNS for the workspace.",closeAction:"Close Terminal",closing:"Closing...",closeSuccess:"Terminal close request submitted.",closeFailed:"Failed to close terminal",createTerminalAction:"New Empty Terminal",creatingTerminal:"Creating...",createTerminalSuccess:"New terminal created.",createTerminalFailed:"Failed to create a new terminal",defaultTerminalName:"Workspace Terminal",templateNameField:"Name",templateNamePlaceholder:"Generated automatically when left empty",commandField:"Launch Command",commandPlaceholder:"For example: npm",scriptPathField:"Script Path",scriptPathPlaceholder:"For example: scripts/dev.ps1 or scripts/dev.sh",argsField:"Arguments",argsPlaceholder:"For example: run dev or --watch",portField:"Listening Port",portLabel:"Port",portPlaceholder:"For example: 3000",proxyField:"Reverse Proxy",proxyToggleLabel:"Enable Reverse Proxy",proxyEnabled:"Proxy Enabled",proxyEnabledDescription:"When enabled, the system generates a random URL code and exposes your dev service under /proxy/.",proxyDisabledDescription:"Reverse proxy is disabled",proxyPortRequired:"A listening port is required when reverse proxy is enabled",openProxyUrlAction:"Open Proxy URL",openProxyUrlFailed:"Failed to open proxy URL",invalidPort:"Port must be an integer between 1 and 65535",saveLaunchAction:"Save as Quick Launch",templateSaving:"Saving...",templateSaveSuccess:"Quick launch item saved.",templateSaveFailed:"Failed to save quick launch item",runTemplateAction:"Run in New Terminal",runningTemplate:"Starting...",templateRunSuccess:"Quick launch item sent to a new terminal.",templateRunFailed:"Failed to run quick launch item",showDetailsAction:"Show details",hideDetailsAction:"Hide details",detailsSectionTitle:"Launch item details",commandPreviewLabel:"Launch Command",processIdLabel:"Listener PID",processGroupIdLabel:"Process Group PGID",processCommandLabel:"Listener Command Line",parentProcessIdLabel:"Parent PID",parentProcessCommandLabel:"Parent Command Line",terminationScopeLabel:"Stop Scope",terminationScopeProcess:"Listener only",terminationScopeProcessGroup:"Whole process group",stopProcessAction:"Stop Process",stoppingProcess:"Stopping...",stopProcessSuccess:"The listening process or its process group has been stopped.",stopProcessFailed:"Failed to stop the listening process or process group",defaultCommandName:"New Launch Command",defaultScriptName:"New Launch Script",lastActiveAt:"Last Active",updatedAt:"Updated At",processCommandFallback:"This process did not expose its command line",portUnset:"Port Not Configured",portUnsetDescription:"Without a port, the item can only be started. The system cannot determine automatically whether the service is running.",portOccupied:"Process Started",portAvailable:"Port Available",portAvailableDescription:"There is currently no listening process on the port used by this launch item.",statusRunning:"Running",statusStopped:"Stopped",exitCode:"Exit Code",runningValue:"Running"},theme:{light:"浅色",dark:"深色",skyBlue:"赛博",eyeGreen:"护眼",switchLabel:"Theme"}},TN={"zh-CN":rL,"en-US":nL},oL={butlerInitTitle:"设置助手",butlerInitDescription:"先完成几个基本设置。",butlerInitPreviewTitle:"当前效果",butlerInitPreviewDescription:"",butlerInitBasicsTitle:"基本信息",butlerInitBasicsDescription:"",butlerInitPersonaTitle:"说话方式",butlerInitPersonaDescription:"",butlerInitPreferenceTitle:"默认偏好",butlerInitPreferenceDescription:"",butlerInitRuleLabel:"规则方式",butlerInitPreviewRuleLabel:"管理方式",butlerInitTipAutoWorkspace:"",butlerInitTipProviderSwitch:"",butlerInitTipReportPriority:"",butlerDisplayNameLabel:"助手称呼",butlerDisplayNamePlaceholder:"例如:小助手",butlerDisplayNameHint:"这个名字会显示在助手页面里。",butlerProviderLabel:"助手引擎",butlerAgentsModeLabel:"规则方式",butlerAgentsModeInline:"自动管理",butlerAgentsModeFile:"手动编辑",butlerAgentsModeInlineDescription:"规则由系统自动管理。",butlerAgentsModeFileDescription:"会生成一份可编辑的规则文件。",butlerPersonaToneLabel:"语气",butlerPersonaLanguageLabel:"使用语言",butlerPersonaSummaryStyleLabel:"回答风格",butlerFocusRiskPreferenceLabel:"处理方式",butlerFocusReportPriorityLabel:"优先提醒",butlerToneDirect:"直接",butlerToneSteady:"稳重",butlerToneFriendly:"亲切",butlerLanguageZhCn:"中文",butlerLanguageEnUs:"英文",butlerLanguageBilingual:"中英双语",butlerSummaryBrief:"简洁",butlerSummaryStructured:"清晰",butlerSummaryThorough:"详细",butlerRiskConservative:"保守稳妥",butlerRiskBalanced:"平衡",butlerRiskProactive:"主动提醒",butlerReportPriorityPresetLabel:"优先提醒",butlerSummaryDebounceLabel:"摘要节奏",butlerSettingsTitle:"助手设置",butlerSettingsSaveAction:"保存设置",butlerSettingsSaving:"保存中...",butlerSettingsSaved:"助手设置已保存",butlerSettingsSaveFailed:"保存助手设置失败",butlerInitSubmitting:"保存中...",butlerInitSubmit:"完成设置",butlerInitSuccess:"助手已设置完成",butlerInitFailed:"助手设置失败",butlerInitNameRequired:"请先填写助手名称"},lL={butlerInitTitle:"Set Up Butler",butlerInitDescription:"Finish a few basic settings first.",butlerInitPreviewTitle:"Preview",butlerInitPreviewDescription:"",butlerInitBasicsTitle:"Basic Info",butlerInitBasicsDescription:"",butlerInitPersonaTitle:"Voice",butlerInitPersonaDescription:"",butlerInitPreferenceTitle:"Default Preferences",butlerInitPreferenceDescription:"",butlerInitRuleLabel:"Rule Style",butlerInitPreviewRuleLabel:"Mode",butlerInitTipAutoWorkspace:"",butlerInitTipProviderSwitch:"",butlerInitTipReportPriority:"",butlerDisplayNameLabel:"Butler Name",butlerDisplayNamePlaceholder:"Example: Butler",butlerDisplayNameHint:"This name appears on the Butler page.",butlerProviderLabel:"Engine",butlerAgentsModeLabel:"Rule Style",butlerAgentsModeInline:"Auto",butlerAgentsModeFile:"Editable File",butlerAgentsModeInlineDescription:"Rules are managed automatically.",butlerAgentsModeFileDescription:"An editable rule file will be created.",butlerPersonaToneLabel:"Tone",butlerPersonaLanguageLabel:"Language",butlerPersonaSummaryStyleLabel:"Reply Style",butlerFocusRiskPreferenceLabel:"Work Style",butlerFocusReportPriorityLabel:"Priority",butlerToneDirect:"Direct",butlerToneSteady:"Steady",butlerToneFriendly:"Friendly",butlerLanguageZhCn:"Chinese",butlerLanguageEnUs:"English",butlerLanguageBilingual:"Bilingual",butlerSummaryBrief:"Brief",butlerSummaryStructured:"Clear",butlerSummaryThorough:"Detailed",butlerRiskConservative:"Conservative",butlerRiskBalanced:"Balanced",butlerRiskProactive:"Proactive",butlerReportPriorityPresetLabel:"Priority",butlerSummaryDebounceLabel:"Summary Cadence",butlerSettingsTitle:"Butler Settings",butlerSettingsSaveAction:"Save Settings",butlerSettingsSaving:"Saving...",butlerSettingsSaved:"Butler settings saved",butlerSettingsSaveFailed:"Failed to save Butler settings",butlerInitSubmitting:"Saving...",butlerInitSubmit:"Finish Setup",butlerInitSuccess:"Butler is ready",butlerInitFailed:"Failed to save Butler settings",butlerInitNameRequired:"Please enter a Butler name"};function ux(e,t){const r=e.shell;return{...e,shell:{...r&&typeof r=="object"?r:{},...t}}}const NN={"zh-CN":ux(iL,oL),"en-US":ux(aL,lL)};function zh(e,t){const r=e.split(".");let s=t;for(const i of r){if(!s||typeof s=="string")return e;const l=s[i];if(l==null)return e;s=l}return typeof s=="string"?s:e}function cL(){return Ti.getState().profile.language??"zh-CN"}function o(e,t){const s=cL()==="en-US"?["en-US","zh-CN"]:["zh-CN"];for(const i of s){const l=zh(e,NN[i]);if(l!==e)return mf(l,t);const c=zh(e,TN[i]);if(c!==e)return mf(c,t)}return mf(e,t)}function mf(e,t){return t?e.replace(/\{([^}]+)\}/g,(r,s)=>{const i=t[s];return i==null?r:String(i)}):e}function uL({children:e,language:t}){return p.useEffect(()=>{document.documentElement.setAttribute("lang",t)},[t]),e}function dL(){const e=ma(t=>t.profile.language);return t=>{const r=e==="en-US"?["en-US","zh-CN"]:["zh-CN"];for(const s of r){const i=zh(t,NN[s]);if(i!==t)return i;const l=zh(t,TN[s]);if(l!==t)return l}return t}}const PN=[{id:"light",labelKey:"theme.light",color:"#f6f4ef"},{id:"dark",labelKey:"theme.dark",color:"#1b1b1b"},{id:"sky-blue",labelKey:"theme.skyBlue",color:"#00f0ff"},{id:"eye-green",labelKey:"theme.eyeGreen",color:"#16a34a"}];function DN(e){return o(e.labelKey)}function hL(){return typeof window>"u"||typeof window.matchMedia!="function"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function RN(e,t){return t?hL():e}function mL(){const{theme:e,autoTheme:t}=Ti.getState().profile;return RN(e,t)}function pL(e){nu({theme:e,autoTheme:!1}).catch(()=>{})}function fL(e){nu({autoTheme:e}).catch(()=>{})}function AN(e){typeof window>"u"||document.documentElement.setAttribute("data-theme",e)}function MN(){const e=ma(s=>s.profile.theme),t=ma(s=>s.profile.autoTheme);return{theme:RN(e,t),selectedTheme:e,autoTheme:t,setTheme:pL,setAutoTheme:fL}}function gL(){AN(mL())}function bL({children:e}){const t=ma(s=>s.profile.theme),r=ma(s=>s.profile.autoTheme);return p.useEffect(()=>{gL()},[t,r]),p.useEffect(()=>{if(!r||typeof window>"u"||typeof window.matchMedia!="function")return;const s=window.matchMedia("(prefers-color-scheme: dark)"),i=()=>{AN(s.matches?"dark":"light")};return i(),typeof s.addEventListener=="function"?(s.addEventListener("change",i),()=>s.removeEventListener("change",i)):(s.addListener(i),()=>s.removeListener(i))},[r]),n.jsx(n.Fragment,{children:e})}const vL={showToast:()=>"",dismissToast:()=>{}},IN=p.createContext(vL);function wL(){return`toast-${Math.random().toString(36).slice(2,10)}`}function yL({toast:e,onDismiss:t}){const{id:r,title:s,description:i,tone:l,durationMs:c,action:d}=e;return p.useEffect(()=>{if(c===null)return;const m=window.setTimeout(()=>{t(r)},c);return()=>{window.clearTimeout(m)}},[c,r,t,s,i,l]),n.jsxs("article",{className:"toast-card","data-tone":l,role:l==="error"?"alert":"status",children:[n.jsxs("div",{className:"toast-body",children:[n.jsx("strong",{className:"toast-title",children:s}),i?n.jsx("p",{className:"toast-description",children:i}):null]}),n.jsxs("div",{className:"toast-actions",children:[d?n.jsx("button",{className:"toast-action",type:"button",onClick:()=>{d.onClick(),t(r)},children:d.label}):null,n.jsx("button",{className:"toast-dismiss",type:"button","aria-label":"关闭通知",onClick:()=>t(r),children:"×"})]})]})}function kL({children:e}){const[t,r]=p.useState([]),s=p.useCallback(c=>{r(d=>d.filter(m=>m.id!==c))},[]),i=p.useCallback(c=>{const d=c.id??wL(),m={id:d,title:c.title,description:c.description,tone:c.tone??"info",durationMs:c.durationMs===void 0?4200:c.durationMs,action:c.action};return r(f=>{const v=f.findIndex(w=>w.id===d);if(v===-1)return[...f,m];const g=[...f];return g[v]=m,g}),d},[]),l=p.useMemo(()=>({showToast:i,dismissToast:s}),[s,i]);return n.jsxs(IN.Provider,{value:l,children:[e,n.jsx("div",{className:"toast-viewport","aria-live":"polite","aria-atomic":"false",children:t.map(c=>n.jsx(yL,{toast:c,onDismiss:s},c.id))})]})}function Qn(){return p.useContext(IN)}const vh="0.3.6",EN=p.createContext(vh);function xL({children:e}){const t=sr(),[r,s]=p.useState(vh);return p.useEffect(()=>{let i=!1;return t.isDesktop?(t.bridge.getRuntimeInfo().then(l=>{var d,m;if(i)return;const c=l.ok?(m=(d=l.value)==null?void 0:d.version)==null?void 0:m.trim():"";s(c||vh)}),()=>{i=!0}):(s(vh),()=>{i=!0})},[t]),n.jsx(EN.Provider,{value:r,children:e})}function LN(){return p.useContext(EN)}const dx={latestState:null,lastNotifiedVersion:null};class SL{constructor(){Ze(this,"state",dx);Ze(this,"listeners",new Set);Ze(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));Ze(this,"getState",()=>this.state)}recordState(t){this.state={latestState:t,lastNotifiedVersion:t.hasUpdate?this.state.lastNotifiedVersion:null},this.emit()}markVersionNotified(t){this.state.lastNotifiedVersion!==t&&(this.state={...this.state,lastNotifiedVersion:t},this.emit())}reset(){this.state=dx,this.emit()}emit(){for(const t of this.listeners)t()}}const iu=new SL;function FN(e){return p.useSyncExternalStore(iu.subscribe,()=>e(iu.getState()))}function CL(){return iu.getState()}function jL(e){iu.recordState(e)}function TL(e){iu.markVersionNotified(e)}async function NL(){const e=Gs(),t=Rn.getState(),r=await e.bridge.checkForUpdate(t.releaseChannel);if(!r.ok||!r.value)throw new Error(r.detail??"更新检查失败。");return r.value}async function _N(e={}){const t=e.notify??"never",r=await NL();return jL(r),await DL(r,t),r}async function PL(){const e=Gs(),t=Rn.getState();return e.bridge.installUpdate(t.releaseChannel)}async function DL(e,t){var l,c,d;if(!e.hasUpdate||t==="never")return;const r=((c=(l=e.manifest)==null?void 0:l.version)==null?void 0:c.trim())||e.currentVersion.trim();if(!r)return;const s=CL().lastNotifiedVersion;if(t==="always"||s!==r)try{(await Gs().bridge.showNotification(o("settings.releaseUpdateReady"),((d=e.manifest)==null?void 0:d.version)??e.currentVersion)).ok&&TL(r)}catch{}}const RL=3600*1e3;function AL(){const e=Ya(s=>s.platform),t=Ya(s=>s.autoCheckUpdate),r=Ya(s=>s.releaseChannel);return p.useEffect(()=>{if(e!=="desktop"||!t)return;async function s(){try{await _N({notify:"if-new"})}catch{}}s();const i=window.setInterval(()=>{s()},RL);return()=>{window.clearInterval(i)}},[t,e,r]),null}class ML{constructor(){Ze(this,"state",{epoch:0,activeHostId:Rn.getState().activeHostId});Ze(this,"listeners",new Set);Ze(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));Ze(this,"getState",()=>this.state);Rn.subscribe(()=>{const t=Rn.getState().activeHostId;t!==this.state.activeHostId&&(this.state={epoch:this.state.epoch+1,activeHostId:t},this.emit())})}emit(){for(const t of this.listeners)t()}}const hx=new ML;function IL(){return p.useSyncExternalStore(hx.subscribe,()=>{const e=hx.getState();return`${e.activeHostId??"anonymous"}:${e.epoch}`})}const ON="codingns.server.base-url.history",BN=6,WN="__custom__";function UN(){return typeof window<"u"&&typeof window.localStorage<"u"}function EL(){return typeof window>"u"||!window.location.origin?null:window.location.origin}function HN(e){if(!e)return null;try{return Pi(e)}catch{return null}}function LL(){if(!UN())return[];const e=window.localStorage.getItem(ON);if(!e)return[];try{const t=JSON.parse(e);return Array.isArray(t)?t.map(r=>typeof r=="string"?HN(r):null).filter(r=>!!r):[]}catch{return[]}}function FL(e){const t=new Set,r=[];for(const s of e)!s||t.has(s)||(t.add(s),r.push(s));return r}function _L(e,t){const r=LL();return FL([e,...t,...r,HN(EL())]).slice(0,BN)}function OL(e){UN()&&window.localStorage.setItem(ON,JSON.stringify(e.slice(0,BN)))}class BL{constructor(){Ze(this,"state",this.createState(Rn.getState()));Ze(this,"listeners",new Set);Ze(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));Ze(this,"getState",()=>this.state);Rn.subscribe(()=>{const t=this.createState(Rn.getState());t.baseUrl===this.state.baseUrl&&t.options.length===this.state.options.length&&t.options.every((r,s)=>r===this.state.options[s])||(this.state=t,this.emit())})}setBaseUrl(t){const r=Rn.getState(),s=Ja(r);if(!s)return!1;const i=Pi(t),l=i!==s.baseUrl,c=r.hosts.map(d=>d.id===s.id?{...d,baseUrl:i,name:new URL(i).host,updatedAt:new Date().toISOString()}:d);return this.state=this.createState({...r,hosts:c}),this.emit(),Rn.update({hosts:c}),l}reset(){this.state=this.createState(Rn.getState()),this.emit()}createState(t){const r=Ja(t),s=(r==null?void 0:r.baseUrl)??"",i=_L(s,t.hosts.map(l=>l.baseUrl));return OL(i),{baseUrl:s,options:i}}emit(){for(const t of this.listeners)t()}}const qh=new BL;function $h(e){return p.useSyncExternalStore(qh.subscribe,()=>e(qh.getState()))}function WL(e,t){return t.includes(e)?e:WN}function UL(){return WN}const zN={login(e,t){return nr.login(e,t)},bootstrap(e,t,r){return nr.bootstrap(e,t,r)},refresh(){return nr.refresh()},logout(){nr.clear()}};function HL(){const e=fr(),t=$h(S=>S.baseUrl),[r,s]=p.useState("admin"),[i,l]=p.useState(""),[c,d]=p.useState(""),[m,f]=p.useState(null),[v,g]=p.useState("error"),[w,k]=p.useState(!1);async function y(S){if(S.preventDefault(),i!==c){g("error"),f(o("auth.bootstrapMismatch"));return}k(!0),f(null);try{await zN.bootstrap(r,i),g("success"),f(o("auth.bootstrapSuccess")),window.setTimeout(()=>e("/login",{replace:!0}),500)}catch(T){g("error"),T instanceof Kr?f(T.message):f(o("auth.authUnavailable"))}finally{k(!1)}}return n.jsx("main",{className:"page-center app-shell",children:n.jsxs("section",{className:"auth-card surface-card",children:[n.jsx("h1",{children:o("auth.bootstrapTitle")}),n.jsx("p",{className:"status-text",children:o("auth.bootstrapSubtitle")}),n.jsxs("div",{className:"field-group",children:[n.jsx("span",{children:o("auth.serverCurrent")}),n.jsx("span",{className:"auth-server-value",children:t})]}),n.jsxs("form",{className:"auth-form",onSubmit:y,children:[n.jsxs("label",{className:"field-group",children:[n.jsx("span",{children:o("auth.username")}),n.jsx("input",{value:r,onChange:S=>s(S.target.value)})]}),n.jsxs("label",{className:"field-group",children:[n.jsx("span",{children:o("auth.password")}),n.jsx("input",{type:"password",value:i,onChange:S=>l(S.target.value)})]}),n.jsxs("label",{className:"field-group",children:[n.jsx("span",{children:o("auth.confirmPassword")}),n.jsx("input",{type:"password",value:c,onChange:S=>d(S.target.value)})]}),m?n.jsx("p",{className:"status-text","data-tone":v,children:m}):null,n.jsx("button",{className:"primary-button",type:"submit",disabled:w,children:o(w?"common.loading":"auth.submitBootstrap")})]})]})})}async function qN(e){try{return{...await qI(e),reachable:!0}}catch{return{initialized:!1,reachable:!1}}}function zL({isOpen:e,onClose:t,onSave:r,theme:s="dark"}){const i=$h(N=>N.baseUrl),l=$h(N=>N.options),c=UL(),[d,m]=p.useState(i),[f,v]=p.useState(null),g=p.useMemo(()=>{try{return Pi(d)}catch{return null}},[d]),w=WL(g??d,l),k="server-settings-preset",y="server-settings-address";if(p.useEffect(()=>{e&&(m(i),v(null))},[e,i]),!e)return null;function S(){if(!g){v(o("auth.serverInvalid"));return}qh.setBaseUrl(g),r==null||r(g),t()}function T(N){N.target===N.currentTarget&&t()}function j(){g&&m(g)}return n.jsx("div",{className:"server-settings-modal-backdrop","data-theme":s,onClick:T,role:"dialog","aria-modal":"true","aria-labelledby":"server-settings-title",children:n.jsxs("div",{className:"server-settings-modal",children:[n.jsxs("div",{className:"server-settings-modal-header",children:[n.jsx("div",{className:"cyber-header-line"}),n.jsxs("h2",{id:"server-settings-title",className:"cyber-title",children:[n.jsx("span",{className:"cyber-title-icon",children:"◈"}),o("auth.serverSettingsTitle")]}),n.jsx("div",{className:"cyber-header-line"}),n.jsx("button",{className:"server-settings-close",onClick:t,"aria-label":o("common.close"),children:"×"})]}),n.jsxs("div",{className:"server-settings-modal-content",children:[n.jsxs("label",{className:"field-group cyber-field",htmlFor:k,children:[n.jsx("span",{className:"cyber-label",children:o("auth.serverPreset")}),n.jsxs("div",{className:"cyber-select-wrapper",children:[n.jsxs("select",{id:k,"aria-label":o("auth.serverPreset"),className:"cyber-select",value:w,onChange:N=>{const D=N.target.value;D!==c&&(m(D),v(null))},children:[l.map(N=>n.jsx("option",{value:N,children:N},N)),n.jsx("option",{value:c,children:o("auth.serverCustomOption")})]}),n.jsx("span",{className:"cyber-select-arrow",children:"▼"})]})]}),n.jsxs("label",{className:"field-group cyber-field",htmlFor:y,children:[n.jsx("span",{className:"cyber-label",children:o("auth.serverAddress")}),n.jsxs("div",{className:"cyber-input-wrapper",children:[n.jsx("input",{id:y,"aria-label":o("auth.serverAddress"),className:"cyber-input",value:d,placeholder:o("auth.serverPlaceholder"),onBlur:j,onChange:N=>{m(N.target.value),v(null)}}),n.jsx("div",{className:"cyber-input-glow"})]})]}),n.jsxs("p",{className:"cyber-hint",children:[n.jsx("span",{className:"cyber-hint-icon",children:"ℹ"}),o("auth.serverHint")]}),f?n.jsxs("p",{className:"cyber-status","data-tone":"error",children:[n.jsx("span",{className:"cyber-status-icon",children:"⚠"}),f]}):null]}),n.jsxs("div",{className:"server-settings-modal-footer",children:[n.jsx("button",{className:"cyber-button cyber-button-secondary",onClick:t,children:o("common.cancel")}),n.jsxs("button",{className:"cyber-button cyber-button-primary",onClick:S,children:[n.jsx("span",{className:"cyber-button-glow"}),n.jsx("span",{className:"cyber-button-text",children:o("auth.saveServerSettings")})]})]})]})})}const mx="width=device-width, initial-scale=1.0, viewport-fit=cover",qL="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover";function $L(){const e=p.useRef(null);return p.useEffect(()=>{const t=e.current;if(!t)return;const r=t.getContext("2d");if(!r)return;let s;const i=()=>{c(),d()};let l=[];const c=()=>{t.width=window.innerWidth,t.height=window.innerHeight},d=()=>{l=[];const f=Math.min(50,Math.floor(t.width*t.height/25e3));for(let v=0;v<f;v++)l.push({x:Math.random()*t.width,y:Math.random()*t.height,vx:(Math.random()-.5)*.5,vy:(Math.random()-.5)*.5,size:Math.random()*2+1,opacity:Math.random()*.5+.2})},m=()=>{r.clearRect(0,0,t.width,t.height),l.forEach((f,v)=>{f.x+=f.vx,f.y+=f.vy,f.x<0&&(f.x=t.width),f.x>t.width&&(f.x=0),f.y<0&&(f.y=t.height),f.y>t.height&&(f.y=0),r.beginPath(),r.arc(f.x,f.y,f.size,0,Math.PI*2),r.fillStyle=`rgba(10, 132, 255, ${f.opacity})`,r.fill(),l.slice(v+1).forEach(g=>{const w=f.x-g.x,k=f.y-g.y,y=Math.sqrt(w*w+k*k);y<150&&(r.beginPath(),r.moveTo(f.x,f.y),r.lineTo(g.x,g.y),r.strokeStyle=`rgba(10, 132, 255, ${.1*(1-y/150)})`,r.stroke())})}),s=requestAnimationFrame(m)};return c(),d(),m(),window.addEventListener("resize",i),()=>{window.removeEventListener("resize",i),cancelAnimationFrame(s)}},[]),n.jsx("canvas",{ref:e,className:"particle-canvas"})}function VL({text:e}){return n.jsx("span",{className:"glitch-text","data-text":e,children:e})}function GL({text:e}){const[t,r]=p.useState(""),[s,i]=p.useState(!0);return p.useEffect(()=>{let l=0,c=null;const d=setInterval(()=>{l<=e.length?(r(e.slice(0,l)),l++):(clearInterval(d),c=window.setTimeout(()=>i(!1),1e3))},50);return()=>{clearInterval(d),c!==null&&window.clearTimeout(c)}},[e]),n.jsxs("span",{className:"typewriter-text",children:[t,s&&n.jsx("span",{className:"typewriter-cursor",children:"_"})]})}function KL(e){const t=e==null?void 0:e.captcha;if(typeof t!="object"||t===null)return null;const r=t.captchaId,s=t.imageDataUrl;return typeof r!="string"||typeof s!="string"?null:{captchaId:r,imageDataUrl:s}}function YL(){const e=fr(),t=dL(),[r]=G1(),s=sr(),i=LN(),l=Ya(Ce=>Ce.activeHostId),c=qb(s.platform),d=p.useMemo(()=>sI(s),[s]),m=p.useMemo(()=>d?IT(l):{credentials:null,legacyServerBaseUrl:null},[l,d]),f=m.credentials,v=m.legacyServerBaseUrl,[g,w]=p.useState(()=>(f==null?void 0:f.username)??"admin"),[k,y]=p.useState(()=>(f==null?void 0:f.password)??""),[S,T]=p.useState(null),[j,N]=p.useState(""),[D,H]=p.useState(()=>!!f),B=$h(Ce=>Ce.baseUrl),[I,A]=p.useState(B),[L,_]=p.useState(null),[F,te]=p.useState(!1),[E,se]=p.useState(!1),[X,K]=p.useState(null),[G,q]=p.useState(!1),U=xu(Ce=>Ce.session),Q=p.useMemo(()=>r.get("returnTo")??"/",[r]),{theme:P}=MN(),W=p.useRef(!1),J=s.isNativeMobile,R=p.useMemo(()=>P==="light"?"light":"dark",[P]);p.useEffect(()=>{w((f==null?void 0:f.username)??"admin"),y((f==null?void 0:f.password)??""),T(null),N(""),H(!!f)},[f]),p.useEffect(()=>{if(typeof document>"u")return;const Ce=document.querySelector('meta[name="viewport"]');if(!(Ce instanceof HTMLMetaElement))return;const Xe=Ce.getAttribute("content")??mx;return J?Ce.setAttribute("content",qL):Ce.setAttribute("content",mx),()=>{Ce.setAttribute("content",Xe)}},[J]),p.useEffect(()=>{W.current||(W.current=!0,!(!d||!v||v===B)&&(qh.setBaseUrl(v),A(v)))},[B,d,v]),p.useEffect(()=>{if(U){e(Q,{replace:!0});return}if(!I)return;let Ce=!1;return qN(I).then(Xe=>{Ce||(Xe.demoMode&&(q(!0),zI()&&_(t("auth.demoSessionExpired"))),Xe.reachable&&!Xe.initialized&&e("/bootstrap",{replace:!0}))}).catch(()=>{Ce||_(t("auth.authUnavailable"))}),()=>{Ce=!0}},[U,e,I,Q,t]);async function ve(Ce){Ce.preventDefault(),te(!0),_(null),A(B),d&&!D&&l&<(l);try{const Xe=S?{username:g,password:k,captchaId:S.captchaId,captchaCode:j}:{username:g,password:k};await zN.login(Xe,B),T(null),N(""),await Ti.refreshForAuthenticatedUser(),d&&D&&l&&ET({hostId:l,username:g,password:k}),e(Q,{replace:!0})}catch(Xe){if(Xe instanceof Kr){if(Xe.errorCode==="BOOTSTRAP_REQUIRED"){e("/bootstrap",{replace:!0});return}const Ue=KL(Xe.data);Ue?(T(Ue),N("")):Xe.errorCode==="INVALID_CREDENTIALS"&&(T(null),N("")),_(Xe.message)}else _(t("auth.authUnavailable"))}finally{te(!1)}}function pe(Ce){w(Ce),S&&(T(null),N(""))}function Y(Ce){A(Ce),_(null)}const Se="login-username",Le="login-password",re="login-captcha";return n.jsxs("main",{className:"cyber-login-page","data-theme":R,"data-native-mobile":J?"true":"false",children:[n.jsxs("div",{className:"cyber-bg",children:[n.jsx("div",{className:"cyber-grid"}),n.jsx("div",{className:"cyber-glow cyber-glow-1"}),n.jsx("div",{className:"cyber-glow cyber-glow-2"}),n.jsx($L,{})]}),n.jsx("div",{className:"scanlines"}),n.jsxs("div",{className:"cyber-login-container",children:[n.jsx("div",{className:"cyber-login-toolbar",children:n.jsx(nv,{variant:"compact"})}),n.jsxs("div",{className:"cyber-login-content",children:[n.jsxs("div",{className:"cyber-brand",children:[n.jsx("div",{className:"cyber-logo",children:n.jsx("img",{src:"/logo.png",alt:"CodingNS",className:"cyber-logo-svg"})}),n.jsx("h1",{className:"cyber-brand-title",children:n.jsx(VL,{text:"CodingNS"})}),n.jsx("p",{className:"cyber-brand-subtitle",children:n.jsx(GL,{text:t("auth.loginSubtitle")})})]}),n.jsxs("div",{className:"cyber-card",children:[n.jsx("div",{className:"cyber-corner corner-tl"}),n.jsx("div",{className:"cyber-corner corner-tr"}),n.jsx("div",{className:"cyber-corner corner-bl"}),n.jsx("div",{className:"cyber-corner corner-br"}),n.jsxs("div",{className:"cyber-card-header",children:[n.jsx("div",{className:"cyber-line"}),n.jsx("span",{className:"cyber-card-label",children:t("auth.loginTitle").toUpperCase()}),n.jsx("div",{className:"cyber-line"})]}),G?n.jsxs("div",{className:"cyber-demo-banner",children:[n.jsx("span",{className:"cyber-demo-icon",children:"⚠"}),n.jsx("span",{children:t("auth.demoBanner")})]}):null,n.jsxs("form",{className:"cyber-form",onSubmit:ve,children:[n.jsxs("div",{className:`cyber-field ${X==="username"?"focused":""}`,children:[n.jsx("div",{className:"cyber-field-border",children:n.jsx("div",{className:"cyber-field-border-glow"})}),n.jsxs("label",{className:"cyber-field-label",htmlFor:Se,children:[n.jsx("span",{className:"cyber-field-icon",children:"❯"}),t("auth.username")]}),n.jsx("input",{id:Se,"aria-label":t("auth.username"),className:"cyber-input",value:g,onChange:Ce=>pe(Ce.target.value),onFocus:()=>K("username"),onBlur:()=>K(null),autoComplete:"username"})]}),n.jsxs("div",{className:`cyber-field ${X==="password"?"focused":""}`,children:[n.jsx("div",{className:"cyber-field-border",children:n.jsx("div",{className:"cyber-field-border-glow"})}),n.jsxs("label",{className:"cyber-field-label",htmlFor:Le,children:[n.jsx("span",{className:"cyber-field-icon",children:"⚷"}),t("auth.password")]}),n.jsx("input",{id:Le,"aria-label":t("auth.password"),className:"cyber-input",type:"password",value:k,onChange:Ce=>y(Ce.target.value),onFocus:()=>K("password"),onBlur:()=>K(null),autoComplete:"current-password"})]}),S?n.jsxs("div",{className:"cyber-captcha-panel",children:[n.jsx("img",{alt:t("auth.captchaImageAlt"),className:"cyber-captcha-image",draggable:!1,src:S.imageDataUrl}),n.jsx("p",{className:"cyber-captcha-hint",children:t("auth.captchaHint")}),n.jsxs("div",{className:`cyber-field ${X==="captcha"?"focused":""}`,children:[n.jsx("div",{className:"cyber-field-border",children:n.jsx("div",{className:"cyber-field-border-glow"})}),n.jsxs("label",{className:"cyber-field-label",htmlFor:re,children:[n.jsx("span",{className:"cyber-field-icon",children:"#"}),t("auth.captcha")]}),n.jsx("input",{id:re,"aria-label":t("auth.captcha"),className:"cyber-input",placeholder:t("auth.captchaPlaceholder"),value:j,onChange:Ce=>N(Ce.target.value),onFocus:()=>K("captcha"),onBlur:()=>K(null),autoComplete:"one-time-code"})]})]}):null,d?n.jsxs("label",{className:"cyber-remember-toggle",children:[n.jsx("input",{"aria-label":t("auth.rememberPassword"),type:"checkbox",checked:D,onChange:Ce=>H(Ce.target.checked)}),n.jsx("span",{children:t("auth.rememberPassword")})]}):null,L?n.jsxs("div",{className:"cyber-status","data-tone":"error",children:[n.jsx("span",{className:"cyber-status-icon",children:"⚠"}),n.jsx("span",{children:L})]}):null,n.jsxs("button",{className:`cyber-submit ${F?"loading":""}`,type:"submit",disabled:F,children:[n.jsx("span",{className:"cyber-submit-glow"}),n.jsx("span",{className:"cyber-submit-border"}),n.jsx("span",{className:"cyber-submit-text",children:F?n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"cyber-spinner"}),t("common.loading")]}):n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"cyber-submit-icon",children:"➤"}),t("auth.submitLogin")]})})]})]}),c?n.jsxs("div",{className:"cyber-footer",children:[n.jsxs("div",{className:"cyber-divider",children:[n.jsx("span",{className:"cyber-divider-line"}),n.jsx("span",{className:"cyber-divider-text",children:"//"}),n.jsx("span",{className:"cyber-divider-line"})]}),n.jsxs("button",{className:"cyber-server-btn",onClick:()=>se(!0),type:"button",children:[n.jsx("span",{className:"cyber-server-icon",children:"⚙"}),n.jsx("span",{className:"cyber-server-text",children:t("auth.serverSettings")}),n.jsx("span",{className:"cyber-server-current",children:B})]})]}):null]})]}),n.jsxs("div",{className:"cyber-version",children:[n.jsxs("span",{className:"cyber-version-text",children:["v",i]}),n.jsx("span",{className:"cyber-version-divider",children:"|"}),n.jsx("span",{className:"cyber-version-text",children:"SYSTEM READY"})]})]}),c?n.jsx(zL,{isOpen:E,onClose:()=>se(!1),onSave:Y,theme:R}):null]})}function di(){return sr().haptics}function $N(e,t){const r=new Map(e.map(l=>[t.getId(l),l])),s=new Map,i=[];for(const l of e){const c=XL(l,r,t);if(!c){i.push(l);continue}const d=s.get(c)??[];s.set(c,[...d,l])}return[...i].sort(t.compare).map(l=>KN(l,0,s,t,new Set))}function Gi(e){return Array.isArray(e==null?void 0:e.children)?e.children:[]}function VN(e){return e.flatMap(t=>[t.item,...VN(Gi(t))])}function li(e){return e.flatMap(t=>[t,...li(Gi(t))])}function pm(e,t){return e.some(r=>t(r.item)||pm(Gi(r),t))}function GN(e,t,r){return e?r(e.item)===t?!0:Gi(e).some(s=>GN(s,t,r)):!1}function ha(e,t,r){for(const s of e){const i=r(s.item);if(i===t)return[];const l=ha(Gi(s),t,r);if(GN(s,t,r)&&l.length>=0)return[i,...l]}return[]}function KN(e,t,r,s,i){const l=s.getId(e),c=new Set(i);c.add(l);const d=[...r.get(l)??[]].filter(m=>!c.has(s.getId(m))).sort(s.compare).map(m=>KN(m,t+1,r,s,c));return{item:e,depth:t,children:d}}function XL(e,t,r){const s=px(r.getParentId(e));if(!s)return null;const i=t.get(s);if(!i)return null;const l=new Set([r.getId(e)]);let c=i;for(;c;){const d=r.getId(c);if(l.has(d))return null;l.add(d);const m=px(r.getParentId(c));if(!m||(c=t.get(m),!c))return s}return s}function px(e){const t=e==null?void 0:e.trim();return t||null}function As(){return"/workspaces"}function Fs(e){return`/workspaces/${encodeURIComponent(e)}`}function QL(e){return`${Fs(e)}/debug`}function Ni(e){return`${Fs(e)}/sessions`}function Yn(e,t){return`${Ni(e)}/${encodeURIComponent(t)}`}function YN(e,t){const r=`${Fs(e)}/tools`;if(!t)return r;const s=new URLSearchParams({tab:t});return`${r}?${s.toString()}`}function XN(e){return`${Fs(e)}/tools/files`}function QN(e){return`${Fs(e)}/tools/git`}function rv(e){return`${Fs(e)}/tools/processes`}function Ro(e){return`${Fs(e)}/terminals`}function $i(e,t){const r=`${Fs(e)}/butler`;if(!t)return r;const s=new URLSearchParams({tab:t});return`${r}?${s.toString()}`}function JN(e){return e.flatMap(t=>[...t.sessions.map(r=>({session:r,workspace:t.workspace})),...eP(t.childWorktrees??[])]).sort((t,r)=>(r.session.lastMessageAt??r.session.updatedAt).localeCompare(t.session.lastMessageAt??t.session.updatedAt))}function Vh(e){return $N(e,{getId:t=>t.session.sessionId,getParentId:t=>{var r;return((r=t.session.parentSessionId)==null?void 0:r.trim())||null},compare:ZL})}function ZN(e,t){const r=JL(),s=new URLSearchParams({provider:t});return`${Yn(e,r)}?${s.toString()}`}function JL(){const e=globalThis.crypto;return e&&typeof e.randomUUID=="function"?`draft-${e.randomUUID()}`:`draft-${Date.now()}-${Math.random().toString(16).slice(2)}`}function ZL(e,t){return(t.session.lastMessageAt??t.session.updatedAt).localeCompare(e.session.lastMessageAt??e.session.updatedAt)}function eP(e){return e.flatMap(t=>[...t.sessions.map(r=>({session:r,workspace:t.workspace})),...eP(t.children)])}const eF="mobile.tools.last-primary-tool";function tP(){if(typeof window>"u")return"files";try{return window.localStorage.getItem(eF)==="git"?"git":"files"}catch{return"files"}}function sv(e){var s;const t=[{pattern:"/workspaces/:workspaceId/tools/processes",routeKind:"processes"},{pattern:"/workspaces/:workspaceId/tools/files",routeKind:"files"},{pattern:"/workspaces/:workspaceId/tools/git",routeKind:"git"},{pattern:"/workspaces/:workspaceId/tools",routeKind:"home"}];for(const i of t){const l=Wr(i.pattern,e),c=((s=l==null?void 0:l.params.workspaceId)==null?void 0:s.trim())??null;if(c)return{workspaceId:c,routeKind:i.routeKind,legacy:!1}}const r=[{pattern:"/tools/processes",routeKind:"processes"},{pattern:"/tools/files",routeKind:"files"},{pattern:"/tools/git",routeKind:"git"},{pattern:"/tools",routeKind:"home"}];for(const i of r)if(Wr(i.pattern,e))return{workspaceId:null,routeKind:i.routeKind,legacy:!0};return null}function tF(e,t){const r=sv(e);if((r==null?void 0:r.routeKind)==="git")return"git";if((r==null?void 0:r.routeKind)==="files")return"files";const s=new URLSearchParams(t).get("tab");return s==="git"?"git":s==="files"?"files":tP()}function iv(e,t){const r=sv(e);return(r==null?void 0:r.routeKind)==="processes"&&r.workspaceId?Ro(r.workspaceId):r!=null&&r.workspaceId?YN(r.workspaceId,tF(e,t)):r!=null&&r.legacy?tP()==="git"?"/tools?tab=git":"/tools?tab=files":null}function av({activeEntry:e,presentation:t,pathname:r,search:s,moreButtonLabel:i}){if(t==="conversation-focus"||e!=="butler")return null;const l=sv(r);return l?l.routeKind==="processes"?{title:o("shell.terminalManagerEntry"),showBackButton:!0,showMoreButton:!1,moreButtonLabel:i}:(l.routeKind==="home"||l.routeKind==="files"||l.routeKind==="git",null):null}const nP=p.createContext({composerPortalTarget:null});function ov({composerPortalTarget:e,children:t}){return n.jsx(nP.Provider,{value:{composerPortalTarget:e},children:t})}function lv(){return p.useContext(nP)}function cv(e,t,r){const[s,i]=p.useState(void 0);return p.useEffect(()=>{const l=e.current,c=t.current;if(!r||!l||!c){i(void 0),l&&l.style.removeProperty("--mobile-conversation-tabbar-height");return}const d=l,m=c;function f(){if(!e.current||!m.isConnected)return;const g=`${Math.round(m.getBoundingClientRect().height)}px`;d.style.setProperty("--mobile-conversation-tabbar-height",g),i(g)}f();const v=typeof ResizeObserver<"u"?new ResizeObserver(f):null;return v==null||v.observe(m),window.addEventListener("resize",f),()=>{v==null||v.disconnect(),window.removeEventListener("resize",f),d.style.removeProperty("--mobile-conversation-tabbar-height")}},[r,e,t]),s}const nF=3e3,Md=10,fx=84,gx=.36;function uv({enabled:e,rootRef:t,suspended:r=!1,resetKey:s}){const i=p.useRef(null),l=p.useRef(null),c=p.useRef("visible"),d=p.useRef(1),[m,f]=p.useState("visible"),[v,g]=p.useState(1);p.useEffect(()=>{c.current=m},[m]),p.useEffect(()=>{d.current=v},[v]);function w(){wo(i),i.current=window.setTimeout(()=>{k()},nF)}function k(){f("hidden"),g(0)}function y(){f("visible"),g(1),w()}p.useEffect(()=>{if(wo(i),!e){wo(i),f("visible"),g(1);return}if(r){f("hidden"),g(0);return}return y(),()=>{wo(i)}},[e,s,r]),p.useEffect(()=>()=>{wo(i)},[]),p.useEffect(()=>{if(!e||r){l.current=null;return}const T=t.current;if(!T)return;function j(L){if(L.touches.length!==1){l.current=null;return}const _=L.touches[0],F=wx(L.target);if(!_||!F){l.current=null;return}l.current={surface:F,startX:_.clientX,startY:_.clientY,pointerType:"touch",initialState:c.current==="visible"?"visible":"hidden",touchId:_.identifier,dragging:!1,latestProgress:d.current},c.current==="visible"&&wo(i)}function N(L){const _=l.current;if(!_||_.pointerType!=="touch")return;const F=pf(L.touches,_.touchId);if(!F)return;const te=F.clientX-_.startX,E=F.clientY-_.startY;if(_.surface==="conversation"){if(Math.abs(E)<=Md||Math.abs(E)<=Math.abs(te))return;l.current=null,_.initialState==="visible"&&k();return}const se=_.initialState==="hidden"?-E:E;se<=Md&&!_.dragging||(kx(L),_.dragging=!0,_.latestProgress=bx(_.initialState,se),f("dragging"),g(_.latestProgress))}function D(L){const _=l.current;if(!(!_||_.pointerType!=="touch"||!pf(L.changedTouches,_.touchId))){if(l.current=null,!_.dragging){_.initialState==="visible"&&w();return}vx(_.initialState,_.latestProgress,y,f,g)}}function H(L){const _=l.current;if(!(!_||_.pointerType!=="touch"||!pf(L.changedTouches,_.touchId))){if(l.current=null,!_.dragging){_.initialState==="visible"&&w();return}if(_.initialState==="visible"){y();return}f("hidden"),g(0)}}function B(L){if(L.pointerType!=="touch")return;const _=wx(L.target);if(!_){l.current=null;return}if(l.current={surface:_,startX:L.clientX,startY:L.clientY,pointerType:"pointer",initialState:c.current==="visible"?"visible":"hidden",pointerId:L.pointerId,captureTarget:L.target instanceof Element?L.target:null,dragging:!1,latestProgress:d.current},L.target instanceof Element)try{L.target.setPointerCapture(L.pointerId)}catch{}c.current==="visible"&&wo(i)}function I(L){const _=l.current;if(!_||_.pointerType!=="pointer")return;const F=L.clientX-_.startX,te=L.clientY-_.startY;if(_.surface==="conversation"){if(Math.abs(te)<=Md||Math.abs(te)<=Math.abs(F))return;l.current=null,_.initialState==="visible"&&k();return}const E=_.initialState==="hidden"?-te:te;E<=Md&&!_.dragging||(kx(L),_.dragging=!0,_.latestProgress=bx(_.initialState,E),f("dragging"),g(_.latestProgress))}function A(L){const _=l.current;if(!(!_||_.pointerType!=="pointer"||_.pointerId!==L.pointerId)){if(l.current=null,rF(_),!_.dragging){_.initialState==="visible"&&w();return}vx(_.initialState,_.latestProgress,y,f,g)}}return T.addEventListener("touchstart",j,{passive:!0}),T.addEventListener("pointerdown",B,{passive:!0}),window.addEventListener("touchmove",N,{passive:!1}),window.addEventListener("touchend",D),window.addEventListener("touchcancel",H),window.addEventListener("pointermove",I,{passive:!1}),window.addEventListener("pointerup",A),window.addEventListener("pointercancel",A),()=>{T.removeEventListener("touchstart",j),T.removeEventListener("pointerdown",B),window.removeEventListener("touchmove",N),window.removeEventListener("touchend",D),window.removeEventListener("touchcancel",H),window.removeEventListener("pointermove",I),window.removeEventListener("pointerup",A),window.removeEventListener("pointercancel",A)}},[e,t,r]);const S=e&&!r?v:e?0:1;return{state:r&&e?"hidden":m,progress:S,isOpen:S>.01}}function wo(e){e.current!==null&&(window.clearTimeout(e.current),e.current=null)}function bx(e,t){return yx(e==="hidden"?t/fx:1-t/fx,0,1)}function vx(e,t,r,s,i){if(e==="hidden"){if(t>=gx){r();return}s("hidden"),i(0);return}if(t<=1-gx){s("hidden"),i(0);return}r()}function rF(e){if(!(e.pointerType!=="pointer"||typeof e.pointerId!="number"||!(e.captureTarget instanceof Element)))try{e.captureTarget.hasPointerCapture(e.pointerId)&&e.captureTarget.releasePointerCapture(e.pointerId)}catch{}}function pf(e,t){if(typeof t!="number")return e[0]??null;for(let r=0;r<e.length;r+=1){const s=e[r];if((s==null?void 0:s.identifier)===t)return s}return null}function wx(e){return e instanceof Element?e.closest(".composer-panel")?"composer":e.closest(".message-list, .message-timeline, .mobile-conversation-main, .conversation-page-shell, .mobile-butler-main-stage, .mobile-butler-chat-body, .mobile-butler-page-shell")?"conversation":null:null}function yx(e,t,r){return Math.min(Math.max(e,t),r)}function kx(e){e.cancelable&&e.preventDefault()}function Pu({viewportClass:e,activeEntry:t,hasNavigationPanel:r,hasAuxiliaryPanel:s,preferCompactLayout:i=!1}){return i||e==="compact"?"compact":e==="expanded"&&r&&s?"expanded":t==="butler"&&s?"medium-auxiliary":r?"medium-navigation":s?"medium-auxiliary":"compact"}function fm(e){return!e.isNativeMobile||e.viewportClass==="expanded"||typeof window>"u"?!1:window.innerHeight>window.innerWidth}function rP(e){return e==="medium-navigation"||e==="expanded"}function sP(e){return e==="medium-auxiliary"||e==="expanded"}function dv({viewportClass:e,activeEntry:t,hasNavigationPanel:r,hasAuxiliaryPanel:s,preferCompactLayout:i=!1,children:l,navigationPanel:c,auxiliaryPanel:d}){const m=Pu({viewportClass:e,activeEntry:t,hasNavigationPanel:r,hasAuxiliaryPanel:s,preferCompactLayout:i}),f=rP(m)&&c,v=sP(m)&&d;return n.jsxs("div",{className:"mobile-adaptive-pane-layout","data-pane-layout":m,children:[f?n.jsx("aside",{className:"workbench-nav surface-card mobile-adaptive-pane-panel mobile-adaptive-pane-panel-navigation",children:c}):null,n.jsx("div",{className:"mobile-adaptive-pane-main",children:l}),v?n.jsx("aside",{className:"workbench-auxiliary surface-card mobile-adaptive-pane-panel mobile-adaptive-pane-panel-auxiliary",children:d}):null]})}function sF({activeEntry:e,presentation:t="default",children:r,navigationPanel:s,auxiliaryPanel:i,onNavigateWorkspaces:l,onNavigateTerminals:c,onNavigateSessions:d,onNavigateButler:m,onNavigateToolProcesses:f,onNavigateSettings:v}){const g=sr(),w=di(),k=ui(),y=fr(),S=p.useRef(null),T=p.useRef(null),[j,N]=p.useState(null),D=t==="conversation-focus",H=fm({isNativeMobile:g.isNativeMobile,viewportClass:g.viewportClass}),B=uv({enabled:D,rootRef:S,resetKey:`${k.pathname}${k.search}`}),I=Pu({viewportClass:g.viewportClass,activeEntry:e,hasNavigationPanel:!!s,hasAuxiliaryPanel:!!i,preferCompactLayout:H}),A=av({activeEntry:e,presentation:t,pathname:k.pathname,search:k.search,moreButtonLabel:o("shell.androidMoreAction")}),L=[{key:"workspaces",label:o("shell.mobileWorkspacesEntry"),icon:n.jsx(oF,{}),onClick:l},{key:"sessions",label:o("shell.mobileSessionsEntry"),icon:n.jsx(lF,{}),onClick:d},{key:"terminals",label:o("shell.mobileButlerEntry"),icon:n.jsx(uF,{}),onClick:m},{key:"butler",label:o("shell.mobileTerminalsEntry"),icon:n.jsx(cF,{}),onClick:c},{key:"settings",label:o("shell.mobileSettingsEntry"),icon:n.jsx(dF,{}),onClick:v}],_=D?{"--mobile-conversation-tabbar-progress":B.progress.toFixed(4)}:void 0;cv(S,T,D);function F(){const E=iv(k.pathname,k.search);if(!E){c();return}y(E,{replace:!0})}const te=n.jsx("nav",{ref:T,className:"android-workbench-bottom-nav","aria-label":o("shell.title"),children:L.map(E=>n.jsxs("button",{type:"button",className:"android-workbench-bottom-nav-item","data-active":E.key===e,"aria-current":E.key===e?"page":void 0,onClick:()=>{E.key!==e&&w.trigger("selection"),E.onClick()},children:[n.jsx("span",{className:"android-workbench-bottom-nav-icon","aria-hidden":"true",children:E.icon}),n.jsx("span",{className:"android-workbench-bottom-nav-label",children:E.label})]},E.key))});return n.jsx(ov,{composerPortalTarget:D?j:null,children:n.jsxs("div",{ref:S,className:"android-workbench-shell","data-active-entry":e,"data-mobile-presentation":t,"data-pane-layout":I,"data-tabbar-open":D?B.isOpen:!0,"data-conversation-tabbar-state":D?B.state:"default",style:_,children:[A?n.jsxs("header",{className:"android-workbench-topbar","data-header-kind":"tools",children:[n.jsxs("div",{className:"android-workbench-topbar-leading",children:[A.showBackButton?n.jsx("button",{type:"button",className:"android-workbench-icon-button","aria-label":o("common.back"),onClick:F,children:n.jsx(iF,{})}):null,n.jsx("div",{className:"android-workbench-topbar-copy",children:n.jsx("h1",{children:A.title})})]}),n.jsx("div",{className:"android-workbench-topbar-actions",children:A.showMoreButton?n.jsx("button",{type:"button",className:"android-workbench-icon-button","aria-label":A.moreButtonLabel,onClick:f,children:n.jsx(aF,{})}):null})]}):null,n.jsx("div",{className:"android-workbench-content",children:n.jsx(dv,{viewportClass:g.viewportClass,activeEntry:e,hasNavigationPanel:!!s,hasAuxiliaryPanel:!!i,preferCompactLayout:H,navigationPanel:s,auxiliaryPanel:i,children:r})}),D?n.jsxs("div",{className:"mobile-conversation-bottom-layer",children:[n.jsx("div",{ref:N,className:"mobile-conversation-bottom-layer-composer-slot"}),n.jsx("div",{className:"mobile-conversation-bottom-layer-tabbar-shell",children:te})]}):te]})})}function iF(){return n.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("path",{d:"m15 18-6-6 6-6"}),n.jsx("path",{d:"M21 12H9"})]})}function aF(){return n.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:[n.jsx("circle",{cx:"12",cy:"5",r:"1.8"}),n.jsx("circle",{cx:"12",cy:"12",r:"1.8"}),n.jsx("circle",{cx:"12",cy:"19",r:"1.8"})]})}function oF(){return n.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z"}),n.jsx("path",{d:"M8 13h8"})]})}function lF(){return n.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:n.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H8l-5 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}function cF(){return n.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2.5"}),n.jsx("path",{d:"m7.5 9 3 3-3 3"}),n.jsx("path",{d:"M12.5 15H17"})]})}function uF(){return n.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("rect",{x:"5",y:"7",width:"14",height:"10",rx:"3"}),n.jsx("path",{d:"M9 7V5a3 3 0 0 1 6 0v2"}),n.jsx("circle",{cx:"10",cy:"12",r:"1",fill:"currentColor",stroke:"none"}),n.jsx("circle",{cx:"14",cy:"12",r:"1",fill:"currentColor",stroke:"none"}),n.jsx("path",{d:"M10 15c.6.5 1.2.8 2 .8s1.4-.3 2-.8"})]})}function dF(){return n.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[n.jsx("circle",{cx:"12",cy:"12",r:"3"}),n.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09a1.65 1.65 0 0 0-1-1.51 1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06A1.65 1.65 0 0 0 4.6 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09a1.65 1.65 0 0 0 1.51-1 1.65 1.65 0 0 0-.33-1.82L4.21 7.1a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06A1.65 1.65 0 0 0 8.92 4a1.65 1.65 0 0 0 1-1.51V2.4a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9c0 .66.39 1.25 1 1.51h.09a2 2 0 0 1 0 4h-.09c-.61.26-1 .85-1 1.49z"})]})}const hF=120,Lc={viewportHeight:null,keyboardInset:0,keyboardOpen:!1};function Qg(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function mF(e){if(!(e instanceof HTMLElement))return!1;if(e.isContentEditable||e.closest("[contenteditable='true']"))return!0;if(e instanceof HTMLTextAreaElement)return!e.readOnly&&!e.disabled;if(e instanceof HTMLInputElement){if(e.readOnly||e.disabled)return!1;const t=(e.type||"text").toLowerCase();return!["button","checkbox","color","file","hidden","image","radio","range","reset","submit"].includes(t)}return!1}function pF(){var t;if(typeof window>"u")return 0;const e=[window.innerHeight,typeof document<"u"?(t=document.documentElement)==null?void 0:t.clientHeight:0].filter(Qg);return e.length>0?Math.max(...e):0}function xx(){if(typeof window>"u")return Lc;const e=window.visualViewport,t=pF(),r=(e==null?void 0:e.height)??t,s=Qg(r)?Math.round(r):null,i=Qg(e==null?void 0:e.offsetTop)?(e==null?void 0:e.offsetTop)??0:0,l=s===null?0:Math.max(0,Math.round(t-s-i));return{viewportHeight:s,keyboardInset:l,keyboardOpen:mF(typeof document<"u"?document.activeElement:null)&&l>=hF}}function ff(e,t){if(typeof document>"u")return;[document.documentElement,document.body].filter(s=>s instanceof HTMLElement).forEach(s=>{if(!e){delete s.dataset.mobileKeyboardOpen,delete s.dataset.mobileViewportBound,s.style.removeProperty("--mobile-shell-viewport-height"),s.style.removeProperty("--mobile-shell-keyboard-inset");return}s.dataset.mobileKeyboardOpen=String(t.keyboardOpen),s.dataset.mobileViewportBound="true",t.viewportHeight===null?s.style.removeProperty("--mobile-shell-viewport-height"):s.style.setProperty("--mobile-shell-viewport-height",`${t.viewportHeight}px`),s.style.setProperty("--mobile-shell-keyboard-inset",`${t.keyboardInset}px`)})}function fF(e){const[t,r]=p.useState(()=>e?xx():Lc),s=p.useRef(null);return p.useEffect(()=>{if(!e){r(Lc),ff(!1,Lc);return}function i(){r(xx())}function l(){s.current!==null&&window.clearTimeout(s.current),s.current=window.setTimeout(()=>{s.current=null,i()},0)}i();const c=window.visualViewport;return window.addEventListener("resize",i),window.addEventListener("orientationchange",i),c==null||c.addEventListener("resize",i),c==null||c.addEventListener("scroll",i),document.addEventListener("focusin",i),document.addEventListener("focusout",l),()=>{s.current!==null&&(window.clearTimeout(s.current),s.current=null),window.removeEventListener("resize",i),window.removeEventListener("orientationchange",i),c==null||c.removeEventListener("resize",i),c==null||c.removeEventListener("scroll",i),document.removeEventListener("focusin",i),document.removeEventListener("focusout",l),ff(!1,Lc)}},[e]),p.useEffect(()=>{ff(e,t)},[e,t]),t}function gF({activeEntry:e,presentation:t="default",children:r,navigationPanel:s,auxiliaryPanel:i,onNavigateWorkspaces:l,onNavigateTerminals:c,onNavigateSessions:d,onNavigateButler:m,onNavigateToolProcesses:f,onNavigateSettings:v}){const g=sr(),w=di(),k=ui(),y=fr(),S=p.useRef(null),T=p.useRef(null),[j,N]=p.useState(null),D=t==="conversation-focus",H=fm({isNativeMobile:g.isNativeMobile,viewportClass:g.viewportClass}),B=uv({enabled:D,rootRef:S,resetKey:`${k.pathname}${k.search}`}),I=Pu({viewportClass:g.viewportClass,activeEntry:e,hasNavigationPanel:!!s,hasAuxiliaryPanel:!!i,preferCompactLayout:H}),A=av({activeEntry:e,presentation:t,pathname:k.pathname,search:k.search,moreButtonLabel:o("shell.iosMoreAction")}),L=[{key:"workspaces",label:o("shell.mobileWorkspacesEntry"),icon:n.jsx(wF,{}),onClick:l},{key:"sessions",label:o("shell.mobileSessionsEntry"),icon:n.jsx(yF,{}),onClick:d},{key:"terminals",label:o("shell.mobileButlerEntry"),icon:n.jsx(xF,{}),onClick:m},{key:"butler",label:o("shell.mobileTerminalsEntry"),icon:n.jsx(kF,{}),onClick:c},{key:"settings",label:o("shell.mobileSettingsEntry"),icon:n.jsx(SF,{}),onClick:v}],_=D?{"--mobile-conversation-tabbar-progress":B.progress.toFixed(4)}:void 0;cv(S,T,D);function F(){const E=iv(k.pathname,k.search);if(!E){c();return}y(E,{replace:!0})}const te=n.jsx("nav",{ref:T,className:"ios-workbench-tabbar","aria-label":o("shell.title"),children:L.map(E=>n.jsxs("button",{type:"button",className:"ios-workbench-tabbar-item","data-active":E.key===e,"aria-current":E.key===e?"page":void 0,onClick:()=>{E.key!==e&&w.trigger("selection"),E.onClick()},children:[n.jsx("span",{className:"ios-workbench-tabbar-icon","aria-hidden":"true",children:E.icon}),n.jsx("span",{className:"ios-workbench-tabbar-label",children:E.label})]},E.key))});return n.jsx(ov,{composerPortalTarget:D?j:null,children:n.jsxs("div",{ref:S,className:"ios-workbench-shell","data-active-entry":e,"data-mobile-presentation":t,"data-pane-layout":I,"data-tabbar-open":D?B.isOpen:!0,"data-conversation-tabbar-state":D?B.state:"default",style:_,children:[A?n.jsxs("header",{className:"ios-workbench-nav","data-header-kind":"tools",children:[n.jsx("div",{className:"ios-workbench-nav-leading",children:A.showBackButton?n.jsxs("button",{type:"button",className:"ios-workbench-back-button","aria-label":o("common.back"),onClick:F,children:[n.jsx(bF,{}),n.jsx("span",{children:o("common.back")})]}):null}),n.jsx("div",{className:"ios-workbench-nav-copy",children:n.jsx("h1",{children:A.title})}),n.jsx("div",{className:"ios-workbench-nav-actions",children:A.showMoreButton?n.jsx("button",{type:"button",className:"ios-workbench-icon-button","aria-label":A.moreButtonLabel,onClick:f,children:n.jsx(vF,{})}):null})]}):null,n.jsx("div",{className:"ios-workbench-content",children:n.jsx(dv,{viewportClass:g.viewportClass,activeEntry:e,hasNavigationPanel:!!s,hasAuxiliaryPanel:!!i,preferCompactLayout:H,navigationPanel:s,auxiliaryPanel:i,children:r})}),D?n.jsxs("div",{className:"mobile-conversation-bottom-layer",children:[n.jsx("div",{ref:N,className:"mobile-conversation-bottom-layer-composer-slot"}),n.jsx("div",{className:"mobile-conversation-bottom-layer-tabbar-shell",children:te})]}):te]})})}function bF(){return n.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",children:n.jsx("path",{d:"m15 18-6-6 6-6"})})}function vF(){return n.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:[n.jsx("circle",{cx:"12",cy:"5",r:"1.8"}),n.jsx("circle",{cx:"12",cy:"12",r:"1.8"}),n.jsx("circle",{cx:"12",cy:"19",r:"1.8"})]})}function wF(){return n.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",children:[n.jsx("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z"}),n.jsx("path",{d:"M8 13h8"})]})}function yF(){return n.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",children:n.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H8l-5 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}function kF(){return n.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",children:[n.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2.5"}),n.jsx("path",{d:"m7.5 9 3 3-3 3"}),n.jsx("path",{d:"M12.5 15H17"})]})}function xF(){return n.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",children:[n.jsx("rect",{x:"5",y:"7",width:"14",height:"10",rx:"3"}),n.jsx("path",{d:"M9 7V5a3 3 0 0 1 6 0v2"}),n.jsx("circle",{cx:"10",cy:"12",r:".95",fill:"currentColor",stroke:"none"}),n.jsx("circle",{cx:"14",cy:"12",r:".95",fill:"currentColor",stroke:"none"}),n.jsx("path",{d:"M10 15c.6.5 1.2.8 2 .8s1.4-.3 2-.8"})]})}function SF(){return n.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",children:[n.jsx("circle",{cx:"12",cy:"12",r:"3"}),n.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09a1.65 1.65 0 0 0-1-1.51 1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06A1.65 1.65 0 0 0 4.6 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09a1.65 1.65 0 0 0 1.51-1 1.65 1.65 0 0 0-.33-1.82L4.21 7.1a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06A1.65 1.65 0 0 0 8.92 4a1.65 1.65 0 0 0 1-1.51V2.4a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9c0 .66.39 1.25 1 1.51h.09a2 2 0 0 1 0 4h-.09c-.61.26-1 .85-1 1.49z"})]})}function CF(e){const t=sr();return t.platform==="ios"?n.jsx(gF,{...e}):t.platform==="android"?n.jsx(sF,{...e}):n.jsx(jF,{...e})}function jF({activeEntry:e,presentation:t="default",children:r,navigationPanel:s,auxiliaryPanel:i,onNavigateWorkspaces:l,onNavigateTerminals:c,onNavigateSessions:d,onNavigateButler:m,onNavigateToolProcesses:f,onNavigateSettings:v}){const g=sr(),w=di(),k=ui(),y=fr(),S=p.useRef(null),T=p.useRef(null),[j,N]=p.useState(null),D=fF(g.platform==="web"),H=g.platform==="web"&&D.keyboardOpen,B=t==="conversation-focus",I=fm({isNativeMobile:g.isNativeMobile,viewportClass:g.viewportClass}),A=uv({enabled:B,rootRef:S,suspended:H,resetKey:`${k.pathname}${k.search}`}),L=Pu({viewportClass:g.viewportClass,activeEntry:e,hasNavigationPanel:!!s,hasAuxiliaryPanel:!!i,preferCompactLayout:I}),_=av({activeEntry:e,presentation:t,pathname:k.pathname,search:k.search,moreButtonLabel:o("shell.iosMoreAction")}),F=[{key:"workspaces",label:o("shell.mobileWorkspacesEntry"),icon:n.jsx(PF,{}),onClick:l},{key:"sessions",label:o("shell.mobileSessionsEntry"),icon:n.jsx(DF,{}),onClick:d},{key:"terminals",label:o("shell.mobileButlerEntry"),icon:n.jsx(AF,{}),onClick:m},{key:"butler",label:o("shell.mobileTerminalsEntry"),icon:n.jsx(RF,{}),onClick:c},{key:"settings",label:o("shell.mobileSettingsEntry"),icon:n.jsx(MF,{}),onClick:v}],te=B?{"--mobile-conversation-tabbar-progress":A.progress.toFixed(4)}:void 0;cv(S,T,B);function E(){const X=iv(k.pathname,k.search);if(!X){c();return}y(X,{replace:!0})}const se=n.jsx("nav",{ref:T,className:"mobile-workbench-tabbar","aria-label":o("shell.title"),hidden:H,children:F.map(X=>n.jsxs("button",{type:"button",className:"mobile-workbench-tabbar-item","data-active":X.key===e,"aria-current":X.key===e?"page":void 0,onClick:()=>{X.key!==e&&w.trigger("selection"),X.onClick()},children:[n.jsx("span",{className:"mobile-workbench-tabbar-icon","aria-hidden":"true",children:X.icon}),n.jsx("span",{className:"mobile-workbench-tabbar-label",children:X.label})]},X.key))});return n.jsx(ov,{composerPortalTarget:B?j:null,children:n.jsxs("div",{ref:S,className:"mobile-workbench-shell","data-active-entry":e,"data-mobile-presentation":t,"data-mobile-runtime":g.platform,"data-mobile-keyboard-open":H,"data-pane-layout":L,"data-tabbar-open":H?!1:B?A.isOpen:!0,"data-conversation-tabbar-state":B?A.state:"default",style:te,children:[_?n.jsxs("header",{className:"mobile-workbench-header","data-header-kind":"tools",children:[n.jsxs("div",{className:"mobile-workbench-header-leading",children:[_.showBackButton?n.jsx("button",{type:"button",className:"mobile-workbench-header-button","aria-label":o("common.back"),onClick:E,children:n.jsx(TF,{})}):null,n.jsx("div",{className:"mobile-workbench-header-copy",children:n.jsx("h1",{children:_.title})})]}),n.jsx("div",{className:"mobile-workbench-header-actions",children:_.showMoreButton?n.jsx("button",{type:"button",className:"mobile-workbench-header-button mobile-tools-more-button","aria-label":_.moreButtonLabel,onClick:f,children:n.jsx(NF,{})}):null})]}):null,n.jsx("div",{className:"mobile-workbench-content",children:n.jsx(dv,{viewportClass:g.viewportClass,activeEntry:e,hasNavigationPanel:!!s,hasAuxiliaryPanel:!!i,preferCompactLayout:I,navigationPanel:s,auxiliaryPanel:i,children:r})}),B?n.jsxs("div",{className:"mobile-conversation-bottom-layer",children:[n.jsx("div",{ref:N,className:"mobile-conversation-bottom-layer-composer-slot"}),n.jsx("div",{className:"mobile-conversation-bottom-layer-tabbar-shell",children:se})]}):se]})})}function TF(){return n.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:[n.jsx("path",{d:"m15 18-6-6 6-6"}),n.jsx("path",{d:"M21 12H9"})]})}function NF(){return n.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:[n.jsx("circle",{cx:"12",cy:"5",r:"1.8"}),n.jsx("circle",{cx:"12",cy:"12",r:"1.8"}),n.jsx("circle",{cx:"12",cy:"19",r:"1.8"})]})}function PF(){return n.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:[n.jsx("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z"}),n.jsx("path",{d:"M8 13h8"})]})}function DF(){return n.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:n.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H8l-5 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}function RF(){return n.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:[n.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2.5"}),n.jsx("path",{d:"m7.5 9 3 3-3 3"}),n.jsx("path",{d:"M12.5 15H17"})]})}function AF(){return n.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:[n.jsx("rect",{x:"5",y:"7",width:"14",height:"10",rx:"3"}),n.jsx("path",{d:"M9 7V5a3 3 0 0 1 6 0v2"}),n.jsx("circle",{cx:"10",cy:"12",r:"1",fill:"currentColor",stroke:"none"}),n.jsx("circle",{cx:"14",cy:"12",r:"1",fill:"currentColor",stroke:"none"}),n.jsx("path",{d:"M10 15c.6.5 1.2.8 2 .8s1.4-.3 2-.8"})]})}function MF(){return n.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[n.jsx("circle",{cx:"12",cy:"12",r:"3"}),n.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09a1.65 1.65 0 0 0-1-1.51 1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06A1.65 1.65 0 0 0 4.6 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09a1.65 1.65 0 0 0 1.51-1 1.65 1.65 0 0 0-.33-1.82L4.21 7.1a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06A1.65 1.65 0 0 0 8.92 4a1.65 1.65 0 0 0 1-1.51V2.4a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9c0 .66.39 1.25 1 1.51h.09a2 2 0 0 1 0 4h-.09c-.61.26-1 .85-1 1.49z"})]})}class iP{constructor(t){Ze(this,"maxAttempts");Ze(this,"baseDelayMs");Ze(this,"reconnectAttempts",0);Ze(this,"reconnectTimer",null);Ze(this,"disposed",!1);this.options=t,this.maxAttempts=t.maxAttempts??4,this.baseDelayMs=t.baseDelayMs??300}start(){this.options.onReconnect(!1)}markConnected(){this.reconnectAttempts=0,this.options.onStateChange("connected")}markTransientFailure(){this.disposed||this.reconnectAttempts>0||this.options.onStateChange("reconnecting")}markDisconnected(){if(this.disposed)return;if(!Rn.getState().autoReconnect){this.options.onStateChange("reconnect_failed");return}if(this.reconnectAttempts+=1,this.reconnectAttempts>this.maxAttempts){this.options.onStateChange("reconnect_failed");return}this.options.onStateChange("reconnecting");const t=this.baseDelayMs*this.reconnectAttempts;this.reconnectTimer=window.setTimeout(()=>{this.options.onReconnect(!0)},t)}reconnectNow(){this.reconnectAttempts=0,this.reconnectTimer!==null&&(window.clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.options.onReconnect(!0)}close(){this.disposed=!0,this.reconnectTimer!==null&&(window.clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.options.onStateChange("closed")}}class aP{constructor(t){Ze(this,"socket",null);Ze(this,"disposed",!1);Ze(this,"authRecoveryInFlight",!1);Ze(this,"pendingRefresh",!1);Ze(this,"fileTreeSubscription",null);Ze(this,"gitWorkspaceId",null);Ze(this,"terminalManagerWorkspaceId",null);Ze(this,"workspaceManagementWorkspaceId",null);Ze(this,"pendingFileTreeRefresh",null);Ze(this,"pendingGitRefreshWorkspaceId",null);Ze(this,"pendingTerminalManagerRefreshWorkspaceId",null);Ze(this,"pendingWorkspaceManagementRefreshWorkspaceId",null);Ze(this,"fileTreeListeners",new Set);Ze(this,"gitListeners",new Set);Ze(this,"terminalManagerListeners",new Set);Ze(this,"workspaceManagementListeners",new Set);Ze(this,"connectionManager");this.options=t,this.connectionManager=new iP({onReconnect:r=>{this.connect(r)},onStateChange:t.onConnectionChange})}start(){this.connectionManager.start()}requestRefresh(){const t=this.socket;if(!Sx(t)){this.pendingRefresh=!0;return}t.send(JSON.stringify({type:"workbench.refresh"})),this.pendingRefresh=!1}subscribeFileTree(t,r){this.fileTreeSubscription={workspaceId:t,paths:Cx(r)},this.sendWhenReady({type:"fileTree.subscribe",workspaceId:t,paths:this.fileTreeSubscription.paths})}requestFileTreeRefresh(t,r){const s=Cx(r),i={type:"fileTree.refresh",workspaceId:t,paths:s};this.sendWhenReady(i)?this.pendingFileTreeRefresh=null:this.pendingFileTreeRefresh={workspaceId:t,paths:s}}subscribeGit(t){this.gitWorkspaceId=t,this.sendWhenReady({type:"git.subscribe",workspaceId:t})}requestGitRefresh(t){this.sendWhenReady({type:"git.refresh",workspaceId:t})?this.pendingGitRefreshWorkspaceId=null:this.pendingGitRefreshWorkspaceId=t}subscribeTerminalManager(t){this.terminalManagerWorkspaceId=t,this.sendWhenReady({type:"terminalManager.subscribe",workspaceId:t})}requestTerminalManagerRefresh(t){this.sendWhenReady({type:"terminalManager.refresh",workspaceId:t})?this.pendingTerminalManagerRefreshWorkspaceId=null:this.pendingTerminalManagerRefreshWorkspaceId=t}subscribeWorkspaceManagement(t){this.workspaceManagementWorkspaceId=t,this.sendWhenReady({type:"workspaceManagement.subscribe",workspaceId:t})}requestWorkspaceManagementRefresh(t){this.sendWhenReady({type:"workspaceManagement.refresh",workspaceId:t})?this.pendingWorkspaceManagementRefreshWorkspaceId=null:this.pendingWorkspaceManagementRefreshWorkspaceId=t}addFileTreeSnapshotListener(t){return this.fileTreeListeners.add(t),()=>{this.fileTreeListeners.delete(t)}}addGitSnapshotListener(t){return this.gitListeners.add(t),()=>{this.gitListeners.delete(t)}}addTerminalManagerSnapshotListener(t){return this.terminalManagerListeners.add(t),()=>{this.terminalManagerListeners.delete(t)}}addWorkspaceManagementSnapshotListener(t){return this.workspaceManagementListeners.add(t),()=>{this.workspaceManagementListeners.delete(t)}}close(){var t;this.disposed=!0,this.connectionManager.close(),(t=this.socket)==null||t.close(),this.socket=null}connect(t){var l;if(this.disposed)return;t&&this.socket&&(this.socket.close(),this.socket=null);const r=(l=nr.getState().session)==null?void 0:l.accessToken;if(!r){this.options.onUnauthorized();return}const s=`${QT("/ws")}?access_token=${encodeURIComponent(r)}`,i=new WebSocket(s);this.socket=i,i.addEventListener("open",()=>{i.send(JSON.stringify({type:"workbench.subscribe"})),this.pendingRefresh&&this.requestRefresh(),this.fileTreeSubscription&&i.send(JSON.stringify({type:"fileTree.subscribe",workspaceId:this.fileTreeSubscription.workspaceId,paths:this.fileTreeSubscription.paths})),this.pendingFileTreeRefresh&&this.requestFileTreeRefresh(this.pendingFileTreeRefresh.workspaceId,this.pendingFileTreeRefresh.paths),this.gitWorkspaceId&&i.send(JSON.stringify({type:"git.subscribe",workspaceId:this.gitWorkspaceId})),this.pendingGitRefreshWorkspaceId&&this.requestGitRefresh(this.pendingGitRefreshWorkspaceId),this.terminalManagerWorkspaceId&&i.send(JSON.stringify({type:"terminalManager.subscribe",workspaceId:this.terminalManagerWorkspaceId})),this.pendingTerminalManagerRefreshWorkspaceId&&this.requestTerminalManagerRefresh(this.pendingTerminalManagerRefreshWorkspaceId),this.workspaceManagementWorkspaceId&&i.send(JSON.stringify({type:"workspaceManagement.subscribe",workspaceId:this.workspaceManagementWorkspaceId})),this.pendingWorkspaceManagementRefreshWorkspaceId&&this.requestWorkspaceManagementRefresh(this.pendingWorkspaceManagementRefreshWorkspaceId)}),i.addEventListener("message",c=>{var m,f,v,g,w,k,y,S;const d=JSON.parse(c.data);if(d.type==="system.connected"){this.connectionManager.markConnected();return}if(d.type==="session.error"){d.error_code==="UNAUTHORIZED"&&this.handleUnauthorized();return}if(d.type==="fileTree.snapshot"){(f=(m=this.options).onFileTreeSnapshot)==null||f.call(m,d.snapshot),this.fileTreeListeners.forEach(T=>T(d.snapshot));return}if(d.type==="git.snapshot"){(g=(v=this.options).onGitSnapshot)==null||g.call(v,d.snapshot),this.gitListeners.forEach(T=>T(d.snapshot));return}if(d.type==="terminalManager.snapshot"){(k=(w=this.options).onTerminalManagerSnapshot)==null||k.call(w,d.snapshot),this.terminalManagerListeners.forEach(T=>T(d.snapshot));return}if(d.type==="workspaceManagement.snapshot"){(S=(y=this.options).onWorkspaceManagementSnapshot)==null||S.call(y,d.snapshot),this.workspaceManagementListeners.forEach(T=>T(d.snapshot));return}d.type==="workbench.snapshot"&&IF(d.snapshot)&&this.options.onSnapshot(d.snapshot)}),i.addEventListener("close",()=>{this.disposed||this.socket!==i||this.connectionManager.markDisconnected()}),i.addEventListener("error",()=>{this.disposed||this.socket!==i||this.connectionManager.markTransientFailure()})}handleUnauthorized(){if(this.authRecoveryInFlight||this.disposed)return;this.authRecoveryInFlight=!0;const t=this.socket;this.socket=null,t==null||t.close(),nr.refresh().then(r=>{if(this.authRecoveryInFlight=!1,!this.disposed){if(r.status==="refreshed"){this.connectionManager.reconnectNow();return}if(r.status==="deferred"){this.connectionManager.markDisconnected();return}this.options.onUnauthorized()}})}sendWhenReady(t){const r=this.socket;return Sx(r)?(r.send(JSON.stringify(t)),!0):!1}}function Sx(e){const t=typeof WebSocket.OPEN=="number"?WebSocket.OPEN:1;return e!==null&&e.readyState===t}function IF(e){return typeof e!="object"||e===null?!1:Array.isArray(e.items)}function Cx(e){const t=new Set;for(const r of e??[""])t.add(r.trim().replace(/\\/g,"/").replace(/^\/+|\/+$/g,""));return[...t]}function Gr(e,t,r,s){if(typeof t=="function"?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?s:r==="a"?s.call(e):s?s.value:t.get(e)}function za(e,t,r,s,i){if(typeof t=="function"?e!==t||!0:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,r),r}var yo,ni,wl,Id,wh;const Os="__TAURI_TO_IPC_KEY__";function oP(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}class lP{constructor(t){yo.set(this,void 0),ni.set(this,0),wl.set(this,[]),Id.set(this,void 0),za(this,yo,t||(()=>{})),this.id=oP(r=>{const s=r.index;if("end"in r){s==Gr(this,ni,"f")?this.cleanupCallback():za(this,Id,s);return}const i=r.message;if(s==Gr(this,ni,"f")){for(Gr(this,yo,"f").call(this,i),za(this,ni,Gr(this,ni,"f")+1);Gr(this,ni,"f")in Gr(this,wl,"f");){const l=Gr(this,wl,"f")[Gr(this,ni,"f")];Gr(this,yo,"f").call(this,l),delete Gr(this,wl,"f")[Gr(this,ni,"f")],za(this,ni,Gr(this,ni,"f")+1)}Gr(this,ni,"f")===Gr(this,Id,"f")&&this.cleanupCallback()}else Gr(this,wl,"f")[s]=i})}cleanupCallback(){window.__TAURI_INTERNALS__.unregisterCallback(this.id)}set onmessage(t){za(this,yo,t)}get onmessage(){return Gr(this,yo,"f")}[(yo=new WeakMap,ni=new WeakMap,wl=new WeakMap,Id=new WeakMap,Os)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[Os]()}}async function Fe(e,t={},r){return window.__TAURI_INTERNALS__.invoke(e,t,r)}class cP{get rid(){return Gr(this,wh,"f")}constructor(t){wh.set(this,void 0),za(this,wh,t)}async close(){return Fe("plugin:resources|close",{rid:this.rid})}}wh=new WeakMap;class hv{constructor(...t){this.type="Logical",t.length===1?"Logical"in t[0]?(this.width=t[0].Logical.width,this.height=t[0].Logical.height):(this.width=t[0].width,this.height=t[0].height):(this.width=t[0],this.height=t[1])}toPhysical(t){return new Qa(this.width*t,this.height*t)}[Os](){return{width:this.width,height:this.height}}toJSON(){return this[Os]()}}class Qa{constructor(...t){this.type="Physical",t.length===1?"Physical"in t[0]?(this.width=t[0].Physical.width,this.height=t[0].Physical.height):(this.width=t[0].width,this.height=t[0].height):(this.width=t[0],this.height=t[1])}toLogical(t){return new hv(this.width/t,this.height/t)}[Os](){return{width:this.width,height:this.height}}toJSON(){return this[Os]()}}class yl{constructor(t){this.size=t}toLogical(t){return this.size instanceof hv?this.size:this.size.toLogical(t)}toPhysical(t){return this.size instanceof Qa?this.size:this.size.toPhysical(t)}[Os](){return{[`${this.size.type}`]:{width:this.size.width,height:this.size.height}}}toJSON(){return this[Os]()}}class mv{constructor(...t){this.type="Logical",t.length===1?"Logical"in t[0]?(this.x=t[0].Logical.x,this.y=t[0].Logical.y):(this.x=t[0].x,this.y=t[0].y):(this.x=t[0],this.y=t[1])}toPhysical(t){return new ii(this.x*t,this.y*t)}[Os](){return{x:this.x,y:this.y}}toJSON(){return this[Os]()}}class ii{constructor(...t){this.type="Physical",t.length===1?"Physical"in t[0]?(this.x=t[0].Physical.x,this.y=t[0].Physical.y):(this.x=t[0].x,this.y=t[0].y):(this.x=t[0],this.y=t[1])}toLogical(t){return new mv(this.x/t,this.y/t)}[Os](){return{x:this.x,y:this.y}}toJSON(){return this[Os]()}}class $a{constructor(t){this.position=t}toLogical(t){return this.position instanceof mv?this.position:this.position.toLogical(t)}toPhysical(t){return this.position instanceof ii?this.position:this.position.toPhysical(t)}[Os](){return{[`${this.position.type}`]:{x:this.position.x,y:this.position.y}}}toJSON(){return this[Os]()}}var Ms;(function(e){e.WINDOW_RESIZED="tauri://resize",e.WINDOW_MOVED="tauri://move",e.WINDOW_CLOSE_REQUESTED="tauri://close-requested",e.WINDOW_DESTROYED="tauri://destroyed",e.WINDOW_FOCUS="tauri://focus",e.WINDOW_BLUR="tauri://blur",e.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",e.WINDOW_THEME_CHANGED="tauri://theme-changed",e.WINDOW_CREATED="tauri://window-created",e.WEBVIEW_CREATED="tauri://webview-created",e.DRAG_ENTER="tauri://drag-enter",e.DRAG_OVER="tauri://drag-over",e.DRAG_DROP="tauri://drag-drop",e.DRAG_LEAVE="tauri://drag-leave"})(Ms||(Ms={}));async function uP(e,t){window.__TAURI_EVENT_PLUGIN_INTERNALS__.unregisterListener(e,t),await Fe("plugin:event|unlisten",{event:e,eventId:t})}async function pv(e,t,r){var s;const i=typeof(r==null?void 0:r.target)=="string"?{kind:"AnyLabel",label:r.target}:(s=r==null?void 0:r.target)!==null&&s!==void 0?s:{kind:"Any"};return Fe("plugin:event|listen",{event:e,target:i,handler:oP(t)}).then(l=>async()=>uP(e,l))}async function dP(e,t,r){return pv(e,s=>{uP(e,s.id),t(s)},r)}async function hP(e,t){await Fe("plugin:event|emit",{event:e,payload:t})}async function mP(e,t,r){await Fe("plugin:event|emit_to",{target:typeof e=="string"?{kind:"AnyLabel",label:e}:e,event:t,payload:r})}const EF=Object.freeze(Object.defineProperty({__proto__:null,get TauriEvent(){return Ms},emit:hP,emitTo:mP,listen:pv,once:dP},Symbol.toStringTag,{value:"Module"}));class qc extends cP{constructor(t){super(t)}static async new(t,r,s){return Fe("plugin:image|new",{rgba:zi(t),width:r,height:s}).then(i=>new qc(i))}static async fromBytes(t){return Fe("plugin:image|from_bytes",{bytes:zi(t)}).then(r=>new qc(r))}static async fromPath(t){return Fe("plugin:image|from_path",{path:t}).then(r=>new qc(r))}async rgba(){return Fe("plugin:image|rgba",{rid:this.rid}).then(t=>new Uint8Array(t))}async size(){return Fe("plugin:image|size",{rid:this.rid})}}function zi(e){return e==null?null:typeof e=="string"?e:e instanceof qc?e.rid:e}var Gh;(function(e){e[e.Critical=1]="Critical",e[e.Informational=2]="Informational"})(Gh||(Gh={}));class pP{constructor(t){this._preventDefault=!1,this.event=t.event,this.id=t.id}preventDefault(){this._preventDefault=!0}isPreventDefault(){return this._preventDefault}}var Jg;(function(e){e.None="none",e.Normal="normal",e.Indeterminate="indeterminate",e.Paused="paused",e.Error="error"})(Jg||(Jg={}));function gm(){return new fv(window.__TAURI_INTERNALS__.metadata.currentWindow.label,{skip:!0})}async function yh(){return Fe("plugin:window|get_all_windows").then(e=>e.map(t=>new fv(t,{skip:!0})))}const gf=["tauri://created","tauri://error"];class fv{constructor(t,r={}){var s;this.label=t,this.listeners=Object.create(null),r!=null&&r.skip||Fe("plugin:window|create",{options:{...r,parent:typeof r.parent=="string"?r.parent:(s=r.parent)===null||s===void 0?void 0:s.label,label:t}}).then(async()=>this.emit("tauri://created")).catch(async i=>this.emit("tauri://error",i))}static async getByLabel(t){var r;return(r=(await yh()).find(s=>s.label===t))!==null&&r!==void 0?r:null}static getCurrent(){return gm()}static async getAll(){return yh()}static async getFocusedWindow(){for(const t of await yh())if(await t.isFocused())return t;return null}async listen(t,r){return this._handleTauriEvent(t,r)?()=>{const s=this.listeners[t];s.splice(s.indexOf(r),1)}:pv(t,r,{target:{kind:"Window",label:this.label}})}async once(t,r){return this._handleTauriEvent(t,r)?()=>{const s=this.listeners[t];s.splice(s.indexOf(r),1)}:dP(t,r,{target:{kind:"Window",label:this.label}})}async emit(t,r){if(gf.includes(t)){for(const s of this.listeners[t]||[])s({event:t,id:-1,payload:r});return}return hP(t,r)}async emitTo(t,r,s){if(gf.includes(r)){for(const i of this.listeners[r]||[])i({event:r,id:-1,payload:s});return}return mP(t,r,s)}_handleTauriEvent(t,r){return gf.includes(t)?(t in this.listeners?this.listeners[t].push(r):this.listeners[t]=[r],!0):!1}async scaleFactor(){return Fe("plugin:window|scale_factor",{label:this.label})}async innerPosition(){return Fe("plugin:window|inner_position",{label:this.label}).then(t=>new ii(t))}async outerPosition(){return Fe("plugin:window|outer_position",{label:this.label}).then(t=>new ii(t))}async innerSize(){return Fe("plugin:window|inner_size",{label:this.label}).then(t=>new Qa(t))}async outerSize(){return Fe("plugin:window|outer_size",{label:this.label}).then(t=>new Qa(t))}async isFullscreen(){return Fe("plugin:window|is_fullscreen",{label:this.label})}async isMinimized(){return Fe("plugin:window|is_minimized",{label:this.label})}async isMaximized(){return Fe("plugin:window|is_maximized",{label:this.label})}async isFocused(){return Fe("plugin:window|is_focused",{label:this.label})}async isDecorated(){return Fe("plugin:window|is_decorated",{label:this.label})}async isResizable(){return Fe("plugin:window|is_resizable",{label:this.label})}async isMaximizable(){return Fe("plugin:window|is_maximizable",{label:this.label})}async isMinimizable(){return Fe("plugin:window|is_minimizable",{label:this.label})}async isClosable(){return Fe("plugin:window|is_closable",{label:this.label})}async isVisible(){return Fe("plugin:window|is_visible",{label:this.label})}async title(){return Fe("plugin:window|title",{label:this.label})}async theme(){return Fe("plugin:window|theme",{label:this.label})}async isAlwaysOnTop(){return Fe("plugin:window|is_always_on_top",{label:this.label})}async center(){return Fe("plugin:window|center",{label:this.label})}async requestUserAttention(t){let r=null;return t&&(t===Gh.Critical?r={type:"Critical"}:r={type:"Informational"}),Fe("plugin:window|request_user_attention",{label:this.label,value:r})}async setResizable(t){return Fe("plugin:window|set_resizable",{label:this.label,value:t})}async setEnabled(t){return Fe("plugin:window|set_enabled",{label:this.label,value:t})}async isEnabled(){return Fe("plugin:window|is_enabled",{label:this.label})}async setMaximizable(t){return Fe("plugin:window|set_maximizable",{label:this.label,value:t})}async setMinimizable(t){return Fe("plugin:window|set_minimizable",{label:this.label,value:t})}async setClosable(t){return Fe("plugin:window|set_closable",{label:this.label,value:t})}async setTitle(t){return Fe("plugin:window|set_title",{label:this.label,value:t})}async maximize(){return Fe("plugin:window|maximize",{label:this.label})}async unmaximize(){return Fe("plugin:window|unmaximize",{label:this.label})}async toggleMaximize(){return Fe("plugin:window|toggle_maximize",{label:this.label})}async minimize(){return Fe("plugin:window|minimize",{label:this.label})}async unminimize(){return Fe("plugin:window|unminimize",{label:this.label})}async show(){return Fe("plugin:window|show",{label:this.label})}async hide(){return Fe("plugin:window|hide",{label:this.label})}async close(){return Fe("plugin:window|close",{label:this.label})}async destroy(){return Fe("plugin:window|destroy",{label:this.label})}async setDecorations(t){return Fe("plugin:window|set_decorations",{label:this.label,value:t})}async setShadow(t){return Fe("plugin:window|set_shadow",{label:this.label,value:t})}async setEffects(t){return Fe("plugin:window|set_effects",{label:this.label,value:t})}async clearEffects(){return Fe("plugin:window|set_effects",{label:this.label,value:null})}async setAlwaysOnTop(t){return Fe("plugin:window|set_always_on_top",{label:this.label,value:t})}async setAlwaysOnBottom(t){return Fe("plugin:window|set_always_on_bottom",{label:this.label,value:t})}async setContentProtected(t){return Fe("plugin:window|set_content_protected",{label:this.label,value:t})}async setSize(t){return Fe("plugin:window|set_size",{label:this.label,value:t instanceof yl?t:new yl(t)})}async setMinSize(t){return Fe("plugin:window|set_min_size",{label:this.label,value:t instanceof yl?t:t?new yl(t):null})}async setMaxSize(t){return Fe("plugin:window|set_max_size",{label:this.label,value:t instanceof yl?t:t?new yl(t):null})}async setSizeConstraints(t){function r(s){return s?{Logical:s}:null}return Fe("plugin:window|set_size_constraints",{label:this.label,value:{minWidth:r(t==null?void 0:t.minWidth),minHeight:r(t==null?void 0:t.minHeight),maxWidth:r(t==null?void 0:t.maxWidth),maxHeight:r(t==null?void 0:t.maxHeight)}})}async setPosition(t){return Fe("plugin:window|set_position",{label:this.label,value:t instanceof $a?t:new $a(t)})}async setFullscreen(t){return Fe("plugin:window|set_fullscreen",{label:this.label,value:t})}async setSimpleFullscreen(t){return Fe("plugin:window|set_simple_fullscreen",{label:this.label,value:t})}async setFocus(){return Fe("plugin:window|set_focus",{label:this.label})}async setFocusable(t){return Fe("plugin:window|set_focusable",{label:this.label,value:t})}async setIcon(t){return Fe("plugin:window|set_icon",{label:this.label,value:zi(t)})}async setSkipTaskbar(t){return Fe("plugin:window|set_skip_taskbar",{label:this.label,value:t})}async setCursorGrab(t){return Fe("plugin:window|set_cursor_grab",{label:this.label,value:t})}async setCursorVisible(t){return Fe("plugin:window|set_cursor_visible",{label:this.label,value:t})}async setCursorIcon(t){return Fe("plugin:window|set_cursor_icon",{label:this.label,value:t})}async setBackgroundColor(t){return Fe("plugin:window|set_background_color",{color:t})}async setCursorPosition(t){return Fe("plugin:window|set_cursor_position",{label:this.label,value:t instanceof $a?t:new $a(t)})}async setIgnoreCursorEvents(t){return Fe("plugin:window|set_ignore_cursor_events",{label:this.label,value:t})}async startDragging(){return Fe("plugin:window|start_dragging",{label:this.label})}async startResizeDragging(t){return Fe("plugin:window|start_resize_dragging",{label:this.label,value:t})}async setBadgeCount(t){return Fe("plugin:window|set_badge_count",{label:this.label,value:t})}async setBadgeLabel(t){return Fe("plugin:window|set_badge_label",{label:this.label,value:t})}async setOverlayIcon(t){return Fe("plugin:window|set_overlay_icon",{label:this.label,value:t?zi(t):void 0})}async setProgressBar(t){return Fe("plugin:window|set_progress_bar",{label:this.label,value:t})}async setVisibleOnAllWorkspaces(t){return Fe("plugin:window|set_visible_on_all_workspaces",{label:this.label,value:t})}async setTitleBarStyle(t){return Fe("plugin:window|set_title_bar_style",{label:this.label,value:t})}async setTheme(t){return Fe("plugin:window|set_theme",{label:this.label,value:t})}async onResized(t){return this.listen(Ms.WINDOW_RESIZED,r=>{r.payload=new Qa(r.payload),t(r)})}async onMoved(t){return this.listen(Ms.WINDOW_MOVED,r=>{r.payload=new ii(r.payload),t(r)})}async onCloseRequested(t){return this.listen(Ms.WINDOW_CLOSE_REQUESTED,async r=>{const s=new pP(r);await t(s),s.isPreventDefault()||await this.destroy()})}async onDragDropEvent(t){const r=await this.listen(Ms.DRAG_ENTER,c=>{t({...c,payload:{type:"enter",paths:c.payload.paths,position:new ii(c.payload.position)}})}),s=await this.listen(Ms.DRAG_OVER,c=>{t({...c,payload:{type:"over",position:new ii(c.payload.position)}})}),i=await this.listen(Ms.DRAG_DROP,c=>{t({...c,payload:{type:"drop",paths:c.payload.paths,position:new ii(c.payload.position)}})}),l=await this.listen(Ms.DRAG_LEAVE,c=>{t({...c,payload:{type:"leave"}})});return()=>{r(),i(),s(),l()}}async onFocusChanged(t){const r=await this.listen(Ms.WINDOW_FOCUS,i=>{t({...i,payload:!0})}),s=await this.listen(Ms.WINDOW_BLUR,i=>{t({...i,payload:!1})});return()=>{r(),s()}}async onScaleChanged(t){return this.listen(Ms.WINDOW_SCALE_FACTOR_CHANGED,t)}async onThemeChanged(t){return this.listen(Ms.WINDOW_THEME_CHANGED,t)}}var jx;(function(e){e.Disabled="disabled",e.Throttle="throttle",e.Suspend="suspend"})(jx||(jx={}));var Tx;(function(e){e.Default="default",e.FluentOverlay="fluentOverlay"})(Tx||(Tx={}));var Zg;(function(e){e.AppearanceBased="appearanceBased",e.Light="light",e.Dark="dark",e.MediumLight="mediumLight",e.UltraDark="ultraDark",e.Titlebar="titlebar",e.Selection="selection",e.Menu="menu",e.Popover="popover",e.Sidebar="sidebar",e.HeaderView="headerView",e.Sheet="sheet",e.WindowBackground="windowBackground",e.HudWindow="hudWindow",e.FullScreenUI="fullScreenUI",e.Tooltip="tooltip",e.ContentBackground="contentBackground",e.UnderWindowBackground="underWindowBackground",e.UnderPageBackground="underPageBackground",e.Mica="mica",e.Blur="blur",e.Acrylic="acrylic",e.Tabbed="tabbed",e.TabbedDark="tabbedDark",e.TabbedLight="tabbedLight"})(Zg||(Zg={}));var eb;(function(e){e.FollowsWindowActiveState="followsWindowActiveState",e.Active="active",e.Inactive="inactive"})(eb||(eb={}));function bm(e){return e===null?null:{name:e.name,scaleFactor:e.scaleFactor,position:new ii(e.position),size:new Qa(e.size),workArea:{position:new ii(e.workArea.position),size:new Qa(e.workArea.size)}}}async function LF(){return Fe("plugin:window|current_monitor").then(bm)}async function FF(){return Fe("plugin:window|primary_monitor").then(bm)}async function _F(e,t){return Fe("plugin:window|monitor_from_point",{x:e,y:t}).then(bm)}async function OF(){return Fe("plugin:window|available_monitors").then(e=>e.map(bm))}async function BF(){return Fe("plugin:window|cursor_position").then(e=>new ii(e))}const WF=Object.freeze(Object.defineProperty({__proto__:null,CloseRequestedEvent:pP,get Effect(){return Zg},get EffectState(){return eb},LogicalPosition:mv,LogicalSize:hv,PhysicalPosition:ii,PhysicalSize:Qa,get ProgressBarStatus(){return Jg},get UserAttentionType(){return Gh},Window:fv,availableMonitors:OF,currentMonitor:LF,cursorPosition:BF,getAllWindows:yh,getCurrentWindow:gm,monitorFromPoint:_F,primaryMonitor:FF},Symbol.toStringTag,{value:"Module"})),UF=["button","a","input","textarea","select","summary","[role='button']","[role='link']","[role='tab']","[role='menuitem']","[contenteditable='true']","[data-window-drag='ignore']"].join(", ");function gv(e){return e instanceof HTMLElement?!e.closest(UF):!0}async function bv(){typeof window>"u"||typeof window.__TAURI_INTERNALS__>"u"||await gm().startDragging()}const Kh=.78,HF=1;function zF(){return typeof window<"u"&&typeof window.__TAURI_INTERNALS__<"u"}function fP(e,t,r,s){const i=Math.hypot(r-e,s-t),l=Math.min(1,i/120);return Kh+(HF-Kh)*l}function Va(e){return Math.round(Number.isFinite(e)?e:0)}function qF(e){if(!zF())return null;const t=Va(e.x),r=Va(e.y);let s=!1,i=Promise.resolve();const l=(d,m)=>(i=i.then(async()=>{await window.__TAURI_INTERNALS__.invoke(d,m)}).catch(()=>{}),i),c=async()=>{s||(s=!0,await l("close_detach_preview"))};return l("show_detach_preview",{title:e.title,x:t,y:r,scale:Kh}),{updatePosition(d,m){if(s)return;const f=Va(d),v=Va(m);l("update_detach_preview_position",{x:f,y:v,scale:fP(t,r,f,v)})},complete(){return c()},cancel(){return c()}}}function $F(e){if(typeof document>"u")return null;const t=Va(e.x),r=Va(e.y),s=document.createElement("div");s.className="desktop-window-detach-animation",s.setAttribute("aria-hidden","true"),s.dataset.state="preview",s.style.left=`${t}px`,s.style.top=`${r}px`,s.style.setProperty("--detach-preview-scale",Kh.toFixed(3));const i=document.createElement("div");i.className="desktop-window-detach-animation-bar";const l=document.createElement("strong");l.className="desktop-window-detach-animation-title",l.textContent=e.title;const c=document.createElement("div");c.className="desktop-window-detach-animation-body",i.append(l),s.append(i,c),document.body.append(s);let d=!1;const m=()=>{d||(d=!0,s.remove())};return{updatePosition(f,v){if(d)return;const g=Va(f),w=Va(v),k=fP(t,r,g,w);s.style.left=`${g}px`,s.style.top=`${w}px`,s.style.setProperty("--detach-preview-scale",k.toFixed(3))},async complete(){m()},async cancel(){m()}}}function Nx(e){return qF(e)??$F(e)}const VF={files:{kind:"files",label:"文件",defaultFocusOwner:"file-context-panel"},git:{kind:"git",label:"Git",defaultFocusOwner:"git-sidebar"},processes:{kind:"processes",label:"进程管理",defaultFocusOwner:"terminal-manager-panel"}};function GF(e){return{...e,bounds:{...e.bounds}}}function KF(e,t,r){t&&(e.windows.registerDescriptor(t),r?e.windows.markWindowOpen(t.windowId):e.windows.markWindowClosed(t.windowId))}function YF(e){return VF[e]}function XF(e,t){return`${e}-${t}`}async function vv(e,t,r){const s=r.workspaceId.trim(),i=YF(t);if(!e.isDesktop||!e.bridge.supported)return{ok:!1,errorCode:"PLATFORM_NOT_SUPPORTED",detail:"当前运行环境不支持桌面外部窗口。"};if(!s)return{ok:!1,errorCode:"WINDOW_WORKSPACE_REQUIRED",detail:`${i.label}外部窗口必须绑定工作区。`};const l=XF(t,s),c=e.windows.getDescriptor(l),d=c?GF(c):null,m=e.windows.isWindowOpen(l),f=lI({windowId:l,kind:t,workspaceId:s,sessionId:r.sessionId??(d==null?void 0:d.sessionId)??null,mode:"external",bounds:d==null?void 0:d.bounds,focusOwner:r.focusOwner??i.defaultFocusOwner});e.windows.registerDescriptor(f);const v=await e.bridge.createWindow(f);return v.ok?(e.windows.markWindowOpen(l),{ok:!0,value:f}):(d?KF(e,d,m):e.windows.removeWindow(l),{ok:!1,errorCode:v.errorCode,detail:v.detail})}function QF(e,t){return vv(e,"files",t)}function JF(e,t){return vv(e,"git",t)}function ZF(e,t){return vv(e,"processes",t)}var kh,xh;function gP(e){var t;if("items"in e)e.items=(t=e.items)===null||t===void 0?void 0:t.map(r=>"rid"in r?r:gP(r));else if("action"in e&&e.action){const r=new lP;return r.onmessage=e.action,delete e.action,{...e,handler:r}}return e}async function Ul(e,t){const r=new lP;if(t&&typeof t=="object"&&("action"in t&&t.action&&(r.onmessage=t.action,delete t.action),"item"in t&&t.item&&typeof t.item=="object"&&"About"in t.item&&t.item.About&&typeof t.item.About=="object"&&"icon"in t.item.About&&t.item.About.icon&&(t.item.About.icon=zi(t.item.About.icon)),"icon"in t&&t.icon&&(t.icon=zi(t.icon)),"items"in t&&t.items)){let s=function(i){var l;return"rid"in i?[i.rid,i.kind]:("item"in i&&typeof i.item=="object"&&(!((l=i.item.About)===null||l===void 0)&&l.icon)&&(i.item.About.icon=zi(i.item.About.icon)),"icon"in i&&i.icon&&(i.icon=zi(i.icon)),"items"in i&&i.items&&(i.items=i.items.map(s)),gP(i))};t.items=t.items.map(s)}return Fe("plugin:menu|new",{kind:e,options:t,handler:r})}class Hl extends cP{get id(){return Gr(this,kh,"f")}get kind(){return Gr(this,xh,"f")}constructor(t,r,s){super(t),kh.set(this,void 0),xh.set(this,void 0),za(this,kh,r),za(this,xh,s)}}kh=new WeakMap,xh=new WeakMap;class wv extends Hl{constructor(t,r){super(t,r,"MenuItem")}static async new(t){return Ul("MenuItem",t).then(([r,s])=>new wv(r,s))}async text(){return Fe("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(t){return Fe("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:t})}async isEnabled(){return Fe("plugin:menu|is_enabled",{rid:this.rid,kind:this.kind})}async setEnabled(t){return Fe("plugin:menu|set_enabled",{rid:this.rid,kind:this.kind,enabled:t})}async setAccelerator(t){return Fe("plugin:menu|set_accelerator",{rid:this.rid,kind:this.kind,accelerator:t})}}class yv extends Hl{constructor(t,r){super(t,r,"Check")}static async new(t){return Ul("Check",t).then(([r,s])=>new yv(r,s))}async text(){return Fe("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(t){return Fe("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:t})}async isEnabled(){return Fe("plugin:menu|is_enabled",{rid:this.rid,kind:this.kind})}async setEnabled(t){return Fe("plugin:menu|set_enabled",{rid:this.rid,kind:this.kind,enabled:t})}async setAccelerator(t){return Fe("plugin:menu|set_accelerator",{rid:this.rid,kind:this.kind,accelerator:t})}async isChecked(){return Fe("plugin:menu|is_checked",{rid:this.rid})}async setChecked(t){return Fe("plugin:menu|set_checked",{rid:this.rid,checked:t})}}var Px;(function(e){e.Add="Add",e.Advanced="Advanced",e.Bluetooth="Bluetooth",e.Bookmarks="Bookmarks",e.Caution="Caution",e.ColorPanel="ColorPanel",e.ColumnView="ColumnView",e.Computer="Computer",e.EnterFullScreen="EnterFullScreen",e.Everyone="Everyone",e.ExitFullScreen="ExitFullScreen",e.FlowView="FlowView",e.Folder="Folder",e.FolderBurnable="FolderBurnable",e.FolderSmart="FolderSmart",e.FollowLinkFreestanding="FollowLinkFreestanding",e.FontPanel="FontPanel",e.GoLeft="GoLeft",e.GoRight="GoRight",e.Home="Home",e.IChatTheater="IChatTheater",e.IconView="IconView",e.Info="Info",e.InvalidDataFreestanding="InvalidDataFreestanding",e.LeftFacingTriangle="LeftFacingTriangle",e.ListView="ListView",e.LockLocked="LockLocked",e.LockUnlocked="LockUnlocked",e.MenuMixedState="MenuMixedState",e.MenuOnState="MenuOnState",e.MobileMe="MobileMe",e.MultipleDocuments="MultipleDocuments",e.Network="Network",e.Path="Path",e.PreferencesGeneral="PreferencesGeneral",e.QuickLook="QuickLook",e.RefreshFreestanding="RefreshFreestanding",e.Refresh="Refresh",e.Remove="Remove",e.RevealFreestanding="RevealFreestanding",e.RightFacingTriangle="RightFacingTriangle",e.Share="Share",e.Slideshow="Slideshow",e.SmartBadge="SmartBadge",e.StatusAvailable="StatusAvailable",e.StatusNone="StatusNone",e.StatusPartiallyAvailable="StatusPartiallyAvailable",e.StatusUnavailable="StatusUnavailable",e.StopProgressFreestanding="StopProgressFreestanding",e.StopProgress="StopProgress",e.TrashEmpty="TrashEmpty",e.TrashFull="TrashFull",e.User="User",e.UserAccounts="UserAccounts",e.UserGroup="UserGroup",e.UserGuest="UserGuest"})(Px||(Px={}));class kv extends Hl{constructor(t,r){super(t,r,"Icon")}static async new(t){return Ul("Icon",t).then(([r,s])=>new kv(r,s))}async text(){return Fe("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(t){return Fe("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:t})}async isEnabled(){return Fe("plugin:menu|is_enabled",{rid:this.rid,kind:this.kind})}async setEnabled(t){return Fe("plugin:menu|set_enabled",{rid:this.rid,kind:this.kind,enabled:t})}async setAccelerator(t){return Fe("plugin:menu|set_accelerator",{rid:this.rid,kind:this.kind,accelerator:t})}async setIcon(t){return Fe("plugin:menu|set_icon",{rid:this.rid,kind:this.kind,icon:zi(t)})}}class xv extends Hl{constructor(t,r){super(t,r,"Predefined")}static async new(t){return Ul("Predefined",t).then(([r,s])=>new xv(r,s))}async text(){return Fe("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(t){return Fe("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:t})}}function Ml([e,t,r]){switch(r){case"Submenu":return new Sv(e,t);case"Predefined":return new xv(e,t);case"Check":return new yv(e,t);case"Icon":return new kv(e,t);case"MenuItem":default:return new wv(e,t)}}class Sv extends Hl{constructor(t,r){super(t,r,"Submenu")}static async new(t){return Ul("Submenu",t).then(([r,s])=>new Sv(r,s))}async text(){return Fe("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(t){return Fe("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:t})}async isEnabled(){return Fe("plugin:menu|is_enabled",{rid:this.rid,kind:this.kind})}async setEnabled(t){return Fe("plugin:menu|set_enabled",{rid:this.rid,kind:this.kind,enabled:t})}async append(t){return Fe("plugin:menu|append",{rid:this.rid,kind:this.kind,items:(Array.isArray(t)?t:[t]).map(r=>"rid"in r?[r.rid,r.kind]:r)})}async prepend(t){return Fe("plugin:menu|prepend",{rid:this.rid,kind:this.kind,items:(Array.isArray(t)?t:[t]).map(r=>"rid"in r?[r.rid,r.kind]:r)})}async insert(t,r){return Fe("plugin:menu|insert",{rid:this.rid,kind:this.kind,items:(Array.isArray(t)?t:[t]).map(s=>"rid"in s?[s.rid,s.kind]:s),position:r})}async remove(t){return Fe("plugin:menu|remove",{rid:this.rid,kind:this.kind,item:[t.rid,t.kind]})}async removeAt(t){return Fe("plugin:menu|remove_at",{rid:this.rid,kind:this.kind,position:t}).then(Ml)}async items(){return Fe("plugin:menu|items",{rid:this.rid,kind:this.kind}).then(t=>t.map(Ml))}async get(t){return Fe("plugin:menu|get",{rid:this.rid,kind:this.kind,id:t}).then(r=>r?Ml(r):null)}async popup(t,r){var s;return Fe("plugin:menu|popup",{rid:this.rid,kind:this.kind,window:(s=r==null?void 0:r.label)!==null&&s!==void 0?s:null,at:t instanceof $a?t:t?new $a(t):null})}async setAsWindowsMenuForNSApp(){return Fe("plugin:menu|set_as_windows_menu_for_nsapp",{rid:this.rid})}async setAsHelpMenuForNSApp(){return Fe("plugin:menu|set_as_help_menu_for_nsapp",{rid:this.rid})}async setIcon(t){return Fe("plugin:menu|set_icon",{rid:this.rid,kind:this.kind,icon:zi(t)})}}class Al extends Hl{constructor(t,r){super(t,r,"Menu")}static async new(t){return Ul("Menu",t).then(([r,s])=>new Al(r,s))}static async default(){return Fe("plugin:menu|create_default").then(([t,r])=>new Al(t,r))}async append(t){return Fe("plugin:menu|append",{rid:this.rid,kind:this.kind,items:(Array.isArray(t)?t:[t]).map(r=>"rid"in r?[r.rid,r.kind]:r)})}async prepend(t){return Fe("plugin:menu|prepend",{rid:this.rid,kind:this.kind,items:(Array.isArray(t)?t:[t]).map(r=>"rid"in r?[r.rid,r.kind]:r)})}async insert(t,r){return Fe("plugin:menu|insert",{rid:this.rid,kind:this.kind,items:(Array.isArray(t)?t:[t]).map(s=>"rid"in s?[s.rid,s.kind]:s),position:r})}async remove(t){return Fe("plugin:menu|remove",{rid:this.rid,kind:this.kind,item:[t.rid,t.kind]})}async removeAt(t){return Fe("plugin:menu|remove_at",{rid:this.rid,kind:this.kind,position:t}).then(Ml)}async items(){return Fe("plugin:menu|items",{rid:this.rid,kind:this.kind}).then(t=>t.map(Ml))}async get(t){return Fe("plugin:menu|get",{rid:this.rid,kind:this.kind,id:t}).then(r=>r?Ml(r):null)}async popup(t,r){var s;return Fe("plugin:menu|popup",{rid:this.rid,kind:this.kind,window:(s=r==null?void 0:r.label)!==null&&s!==void 0?s:null,at:t instanceof $a?t:t?new $a(t):null})}async setAsAppMenu(){return Fe("plugin:menu|set_as_app_menu",{rid:this.rid}).then(t=>t?new Al(t[0],t[1]):null)}async setAsWindowMenu(t){var r;return Fe("plugin:menu|set_as_window_menu",{rid:this.rid,window:(r=t==null?void 0:t.label)!==null&&r!==void 0?r:null}).then(s=>s?new Al(s[0],s[1]):null)}}async function Cv(e){if(e.length===0)return;await(await Al.new({items:e.map(r=>({id:r.id,text:r.label,enabled:!r.disabled,accelerator:r.accelerator,action:()=>{r.onSelect()}}))})).popup(void 0,gm())}const Sh="codingns.workspace.session-display-sort-mode",Ch="codingns.file-panel.show-system-files",jv="codingns.notification.preferences",kl={notifyOnPermissionRequest:!0,notifyOnSessionCompleted:!0,notifyOnSessionFailed:!0};function Ol(){return typeof window<"u"&&typeof window.localStorage<"u"}function e_(e){return e==="createdAt"||e==="updatedAt"||e==="title"}function Dx(){if(!Ol())return"createdAt";const e=window.localStorage.getItem(Sh);return e_(e)?e:"createdAt"}function Rx(){return Ol()?window.localStorage.getItem(Ch)==="1":!1}function bf(e){return typeof e=="boolean"}function Ax(){if(!Ol())return kl;const e=window.localStorage.getItem(jv);if(!e)return kl;try{const t=JSON.parse(e);return{notifyOnPermissionRequest:bf(t.notifyOnPermissionRequest)?t.notifyOnPermissionRequest:kl.notifyOnPermissionRequest,notifyOnSessionCompleted:bf(t.notifyOnSessionCompleted)?t.notifyOnSessionCompleted:kl.notifyOnSessionCompleted,notifyOnSessionFailed:bf(t.notifyOnSessionFailed)?t.notifyOnSessionFailed:kl.notifyOnSessionFailed}}catch{return kl}}function Mx(e,t){return e.notifyOnPermissionRequest===t.notifyOnPermissionRequest&&e.notifyOnSessionCompleted===t.notifyOnSessionCompleted&&e.notifyOnSessionFailed===t.notifyOnSessionFailed}function t_(e){Ol()&&window.localStorage.setItem(jv,JSON.stringify(e))}class n_{constructor(){Ze(this,"state",{sessionDisplaySortMode:Dx(),showSystemFiles:Rx(),notificationPreferences:Ax()});Ze(this,"listeners",new Set);Ze(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));Ze(this,"getState",()=>this.state);Ze(this,"handleStorage",t=>{if(t.key!==null&&t.key!==Sh&&t.key!==Ch&&t.key!==jv)return;const r=Dx(),s=Rx(),i=Ax(),l=this.state.sessionDisplaySortMode===r,c=this.state.showSystemFiles===s,d=Mx(this.state.notificationPreferences,i);l&&c&&d||(this.state={sessionDisplaySortMode:r,showSystemFiles:s,notificationPreferences:i},this.emit())});typeof window<"u"&&window.addEventListener("storage",this.handleStorage)}setSessionDisplaySortMode(t){Ol()&&(t==="createdAt"?window.localStorage.removeItem(Sh):window.localStorage.setItem(Sh,t)),this.state.sessionDisplaySortMode!==t&&(this.state={...this.state,sessionDisplaySortMode:t},this.emit())}setShowSystemFiles(t){Ol()&&(t?window.localStorage.setItem(Ch,"1"):window.localStorage.removeItem(Ch)),this.state.showSystemFiles!==t&&(this.state={...this.state,showSystemFiles:t},this.emit())}setNotificationPreferences(t){const r={...this.state.notificationPreferences,...t};Mx(this.state.notificationPreferences,r)||(t_(r),this.state={...this.state,notificationPreferences:r},this.emit())}emit(){for(const t of this.listeners)t()}}const No=new n_;function ci(e){return p.useSyncExternalStore(No.subscribe,()=>e(No.getState()))}const Fc=new Map;function bP(){return typeof window<"u"&&typeof window.sessionStorage<"u"}function Ix(e,t){return!Number.isFinite(e)||Date.now()-e>t}function Ur(e,t){const r=Fc.get(e);if(r&&!Ix(r.savedAt,t))return r.value;if(!bP())return null;const s=window.sessionStorage.getItem(e);if(!s)return null;try{const i=JSON.parse(s);return!i||Ix(i.savedAt,t)?(window.sessionStorage.removeItem(e),Fc.delete(e),null):(Fc.set(e,i),i.value)}catch{return window.sessionStorage.removeItem(e),Fc.delete(e),null}}function _s(e,t){const r={savedAt:Date.now(),value:t};if(Fc.set(e,r),!!bP())try{window.sessionStorage.setItem(e,JSON.stringify(r))}catch{}}const r_="codingns.debug.perf";function s_(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(r_)==="1"}catch{return!1}}function Ft(e,t){if(!s_()||typeof performance>"u")return;const r=Math.round(performance.now());if(t&&Object.keys(t).length>0){console.info(`[perf-ui] ${e} ${r}ms`,t);return}console.info(`[perf-ui] ${e} ${r}ms`)}function i_(){return Oe.request("/api/workspaces")}async function vP(){try{return await Oe.request("/api/workbench")}catch(e){if(!(e instanceof Kr)||e.status!==404)throw e;const t=await i_();return{items:await Promise.all(t.items.map(async s=>({workspace:s,sessions:(await m_(s.id)).items})))}}}function a_(e){return Oe.request("/api/workspaces/import",{method:"POST",body:JSON.stringify(e)})}function o_(e){return Oe.request("/api/workspaces/clone",{method:"POST",body:JSON.stringify(e)})}function wP(e){return Oe.request(`/api/workspaces/${encodeURIComponent(e)}`,{method:"DELETE"})}function l_(e){return Oe.request("/api/debug-targets/analyze",{method:"POST",body:JSON.stringify(e)})}function c_(e,t=5){const r=new URLSearchParams;return r.set("limit",String(t)),Oe.request(`/api/debug-targets/${encodeURIComponent(e)}/runtimes?${r.toString()}`)}function u_(){return Oe.request("/api/framework-compatibility-matrix")}function d_(e){return Oe.request("/api/workspaces/reorder",{method:"PUT",body:JSON.stringify(e)})}function yP(e,t){return Oe.request(`/api/workspaces/${encodeURIComponent(e)}/navigation-state`,{method:"PUT",body:JSON.stringify(t)})}function kP(e){const t=new URLSearchParams;return e!=null&&e.trim()&&t.set("path",e.trim()),Oe.request(`/api/workspaces/browse${t.size>0?`?${t.toString()}`:""}`)}function h_(e){return Oe.request("/api/workspaces/directories",{method:"POST",body:JSON.stringify(e)})}function m_(e){return Oe.request(`/api/sessions?workspaceId=${encodeURIComponent(e)}`)}function Tv(e){return Oe.request(`/api/sessions/${encodeURIComponent(e)}`)}function p_(e){return Oe.request(`/api/sessions/${encodeURIComponent(e)}/changed-files`)}function f_(e){return Oe.request(`/api/sessions/${encodeURIComponent(e)}/seen`,{method:"POST"})}function xP(e,t){return Oe.request(`/api/sessions/${encodeURIComponent(e)}/title`,{method:"PATCH",body:JSON.stringify({title:t})})}function SP(e,t){return Oe.request(`/api/sessions/${encodeURIComponent(e)}/archive`,{method:"PATCH",body:JSON.stringify({archived:t})})}function g_(e,t){return Oe.request(`/api/sessions/${encodeURIComponent(e)}/favorite`,{method:"PATCH",body:JSON.stringify({favorite:t})})}function b_(e){return Oe.request("/api/worktrees",{method:"POST",body:JSON.stringify(e)})}function v_(e){return Oe.request(`/api/worktrees/${encodeURIComponent(e)}/merge-preview`,{method:"POST"})}function w_(e){return Oe.request(`/api/worktrees/${encodeURIComponent(e)}/merge-into-parent`,{method:"POST"})}function y_(e,t){return Oe.request(`/api/worktrees/${encodeURIComponent(e)}/cleanup`,{method:"POST",body:JSON.stringify(t??{})})}function k_(e){return Oe.request(`/api/sessions/${encodeURIComponent(e)}/capabilities`)}function CP(e){return Oe.request(`/api/sessions/${encodeURIComponent(e)}/permission-requests`)}function x_(){return Oe.request("/api/preferences/quick-phrases")}function S_(e){return Oe.request("/api/preferences/quick-phrases",{method:"PUT",body:JSON.stringify({items:e})})}function zl(e,t){const r=new URLSearchParams;return t!=null&&t.trim()&&r.set("workspaceId",t.trim()),Oe.request(`/api/providers/${encodeURIComponent(e)}/capabilities${r.size>0?`?${r.toString()}`:""}`)}async function Nv(e,t){const r=await Promise.allSettled(e.map(async i=>[i,await zl(i,t)])),s=[];for(const i of r){if(i.status!=="fulfilled")continue;const[l,c]=i.value;s.push([l,c])}return Object.fromEntries(s)}function Pv(e,t,r,s="forward"){const i=new URLSearchParams;return i.set("limit",String(r)),i.set("direction",s),Oe.request(`/api/sessions/${encodeURIComponent(e)}/messages?${i.toString()}`)}function C_(e,t){return Oe.requestBlob(`/api/sessions/${encodeURIComponent(e)}/attachments/${encodeURIComponent(t)}/content`)}function j_(e,t){return Oe.request(`/api/sessions/${encodeURIComponent(e)}/messages`,{method:"POST",body:JSON.stringify(t)})}function jP(e,t){return Oe.request(`/api/sessions/${encodeURIComponent(e)}/forks`,{method:"POST",body:JSON.stringify(t)})}function Dv(e){return Oe.request("/api/sessions/start-live",{method:"POST",body:JSON.stringify(e)})}function Rv(e,t){return Oe.request(`/api/sessions/${encodeURIComponent(e)}/messages/live`,{method:"POST",body:JSON.stringify(t)})}function T_(e){return Oe.request(`/api/sessions/${encodeURIComponent(e)}/queue`)}function N_(e,t){return Oe.request(`/api/sessions/${encodeURIComponent(e)}/queue`,{method:"POST",body:JSON.stringify(t)})}function P_(e,t){return Oe.request(`/api/sessions/${encodeURIComponent(e)}/queue/${encodeURIComponent(t)}`,{method:"DELETE"})}function D_(e,t){return Oe.request(`/api/sessions/${encodeURIComponent(e)}/queue/${encodeURIComponent(t)}/steer`,{method:"POST"})}function tb(e){return Oe.request(`/api/sessions/${encodeURIComponent(e)}/runtime`)}function TP(e){return Oe.request(`/api/sessions/${encodeURIComponent(e)}/interrupt`,{method:"POST"})}function R_(e,t,r){return Oe.request(`/api/sessions/${encodeURIComponent(e)}/permission-requests/${encodeURIComponent(t)}/reply`,{method:"POST",body:JSON.stringify(r)})}function NP(e){return Oe.request(`/api/git/status?workspaceId=${encodeURIComponent(e)}`)}function PP(e,t,r){const s=new URLSearchParams({workspaceId:e,path:t,staged:String(r)});return Oe.request(`/api/git/diff?${s.toString()}`)}function DP(e,t){return Oe.request("/api/git/stage",{method:"POST",body:JSON.stringify({workspaceId:e,targets:t})})}function A_(e,t){return Oe.request("/api/git/unstage",{method:"POST",body:JSON.stringify({workspaceId:e,targets:t})})}function M_(e,t){return Oe.request("/api/git/discard",{method:"POST",body:JSON.stringify({workspaceId:e,targets:t})})}function I_(e,t){return Oe.request("/api/git/commit/draft",{method:"POST",body:JSON.stringify({workspaceId:e,mode:t})})}function E_(e,t){return Oe.request("/api/git/commit",{method:"POST",body:JSON.stringify({workspaceId:e,draft:t})})}function L_(e){return Oe.request("/api/git/commit/undo",{method:"POST",body:JSON.stringify({workspaceId:e})})}function Ex(e,t=5,r=null){const s=new URLSearchParams({workspaceId:e,limit:String(t)});return r&&s.set("cursor",r),Oe.request(`/api/git/history?${s.toString()}`)}function F_(e,t){const r=new URLSearchParams({workspaceId:e,commitHash:t});return Oe.request(`/api/git/commit-detail?${r.toString()}`)}function RP(e){return Oe.request(`/api/git/branches?workspaceId=${encodeURIComponent(e)}`)}function __(e){return Oe.request(`/api/git/tags?workspaceId=${encodeURIComponent(e)}`)}function O_(e,t,r){return Oe.request("/api/git/branches/switch",{method:"POST",body:JSON.stringify({workspaceId:e,branchName:t,create:r})})}function Lx(e,t,r,s,i){return Oe.request("/api/git/remote/sync",{method:"POST",body:JSON.stringify({workspaceId:e,action:t,...r?{remote:r}:{},...s?{auth:s}:{},...i?{remember:i}:{}})})}function Fx(e){return Oe.request(`/api/git/remotes?workspaceId=${encodeURIComponent(e)}`)}const B_="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAF+0lEQVRYha2XbXBUZxXHf+e5u4SkCZjg0NIWnQLJLgRF5UWnL75MP9gMjqPT2eyC0qlMiYxOUAR206LOyhiSTVscp52O0xamWgu7WTp0qLUz6kht6Qed1L7M5GUTsAoDTRSIJJos2b33+GFfWMJuNqmcT/c595z/+d3nOc+9zxXKWE9Li7tm0fjyqmT6H0t/Fp8sFz9XM+UCauouH8Rx+ifmWWdP7Q0sLRbT98g3lySC/mcSQd+GGwrQt2vzx1G2ZEa6KJ3S1mJxlpOKIDyEmEM3FGCk5vw5YCw3FmFbb9hXfV2gcm/26vINBfhS+LU0qgcKXB9xT1hbr6kdDhtgcYaDxHSNwVBg92Ao0DMY8n97zgAAZnK8U2AoX1D0++rzWfkC44k6wAVghP7C3EQo8Iiijyq61oEDiV2bPjojwKk234pEsPnh/lDgzpyv/olXrwi6qyDsjsQy2ZQXmJdefPWWvp0v3uZ/CLQ9NxZINpxJj84IYDvmOUT2G/T1DD0CUB/pflnhd1eT5Mcnwl90Adi23JzPl9TbAEN7fF9AeapQW5AOicftGQFEOJ+9tEDbB9v8x99r21wLYBlnJ5AGUKhfklz8QEbY3J71nVnZceziUPAbtzvGxAB3wdPH6yPRx6cXvw4gbbm/B5zIO5SvVKjdMxAMrKvviPcpHMyLqvyoN+ybh7AUwIi+M9TaVOGI/SJwc4Fsf6rS2SqgxQBkukPDYTM40RdCZB/Z5gKmEGmzjStq2alBoDqbvF2hEWgF9oEuAvlugdx/Deaz9ZEjvcWKFwXIWaLNv14cDqmwugDvFRVOi8qOrOMdhT6BzQhvoNxzjbjItxo6o8+VqjEjAMBQa1OFXbXwh4KGuLqmDleXToHzwG1FpLs9kah/uvf98IPz08nkSuZbp+vDL4zNCJAHaQt82lH9JfCJ2cQrTFjq8hiZGrfVtQGcDQhrFNYAywELuFw15SwRgN6dvrrahcnkreGXJ0pCtDZVOFULwsCerEBJExhVGAY8FH/Z2cBvPJHY1ySx13cbaXMaqACSwCVRLqlhVNBRVTOm4lxCOSdqPkB0FdA2m5kosGGEHpC3UP2z6uRJb9fx8SwsJEL+nwBNwEKgWqBSoXaORQqtH+VNhDdErJMNnYf/ViqwbBNO3lRbVZFSS9yyIG1jucRuVuGnM6TZZL4d/wS9KEgawIH/gF5EzAWBvzecto9KPG7PqgkBTu0NLHVs7VBlcxnwS8ALgtyp6Kco3S9/OF850lQWYCD41RpMZUiUH5BZmgkRDqmyVaCqeJYeS1dqwJq4UoG56S5w7hb4PMp6YH426LJR1+qSAOrzWYPLZCvIPuAWAIHXxGGXY3geWAV6DOTrJRR+r5q8P9dskNtJ1etBVl4R19FPdh4eLQowEPR5RKxfgebOeGMqGvLMX/V0YrK/W+B+4ATCYZRnEJ5E+Q5gFM4AFwQ+I8hbLks2Ltt/ZKTUg163Rwfamrcj5q/54spvLZes9nZ2/yIx0b8jW/wCLmeLOLoCAEdeAjmYnaWPGXga9Jiia1O28+bAbt8dswJQEFF5IrO2chGVBzxdsY0r2qNnBx5uvkuELkAFedDTHj+nIl4AIzJsjL2XTAOisB+XtqryKLBcLHNyKLSpsSyAgKrKJoRtbksaPV3R5yFz7BaHOOBGOdAQib6SRV4L4KQZqe+I/wvYmZWqE1ue8nbFggjbgDoH/VOxY3vZXdDT0uKuqR37I+jdIH9JV9r3NIbjU717fLe4jPkASDVEYhW5730i2PwqIvdlZkK3eCPdv06E/GuAbmCBJxJbUnIGill13b8fyxRnRG070BiOTwG4MeuyszBSeNiw3KZFYDTzdPLzU7u3LPZEYu+qTq5Tlev+K2YESAQD94rKjqzgl72Pxd/P3VNLsgAyXJizoj161kG3Z4d1aZP6HIC36/i4tyt6dE4AasQNDIhxNnoisXevvZndJcLw9DxvpLsb5XGE9yzD2ZlqzPpVPN0SIf854FaUZz1dsW0fVqdsD5Q05Qhgg7z+oTX+Xyv2pzNX+x+eTlGviPgh3AAAAABJRU5ErkJggg==",AP="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAbGSURBVHgBzZo/bBtVHMd/ZzuJA0gYCYlsOFO7xRFDy1R3olucqd0SJtiSjiCknBckpjZjBxRn7BR3owOqs5Wp7tZKoDgSQysh4UqUOCG2eZ/3/Oznv/fObqJ+pfPZd+/ufn++vz/vnQN5FwjbGZFGQSRYUb+yIu2c2tSxIOOMqpktqKpzz9X3ioSLNZkRgUwLhA4aW9KWvPqVl6mgldmVGZSJr0BX8Pb2gIVnRUltxbiKxFOgeLJzAYL3I5BQdhaL/sN9EJ5k1dADw+1LQU1tN328kYgaIMWzDSX4s0sUHmSVwZ5JeFqIGjhZgeKpokyzdKGUGQuyWOtA03YCxlNIC98K5X3AhLgYrYB2ndLeE5l0IFvXklK4mpRsxvyuvmqrrSX71aZUjlsyM4LkpuzM7w8dHhqoAxbO+9Fm63pSwhspLTSo1dt6n830bl1SStx9fK6/Z9LmWL3B1hZ/BHUl1+pgYI9S4Eh0EEVjJ5/SwiPI7m9Nuf+02SfUZi4pO+o8ynDcKmlRqRkPlZ43xQ+q8IXpVfdIsu88vJd2ZOSD/OcJKRXmtMW//PlMyi9a0jjvH5NZCDStEDydCjSlfvm9pa/hd24poc+zf/zH8PUjsCT57wOp/FjpqtQ9pakjR+KJo60Fbdnl3dMubSw4vrc2J/msSXLlF4ZCg+M4zzjGEzM39888aAWVFpYlZN+fRnfEE1iMh8JtVygsDWWefTOvhYMiCLX+8L8h4QHnVx+cas/klgLZvpb0eDrp9d/trjr609P6brbhgesPDXXA5kpS7t0ywYwVi4fERD8noJ1WfIDzBDYeRRw8GscL1gP5iCv0g7FsqAIX4UH9pHeegEb44uG5EuKsT3iuPbg9J08252VPxQ3CoowFGYlgRhEMEY2eFzp3CbbEQ3j28BnXjwI0CSvnXQu6lMJrnOd67qOV6fAf2HuuLPn2l4kbRgGT9yf2OU825o11lXDw+bgenb8LV5JdjwE8s/rAxMPXj0xMkGbxBkpWX8epCRp5WvuERNAHl9qADQ+j8xz0QuGDOz3rIizXW8/wHa7bzISSKAveNCQGGoVElPU3coaTcDQKhmoL3QxEkLMna2FplzKAOCFLGf6b4x+nJQbauURnHjsWWJQg8+1nsChCsZGh2LuUwTvb11J94zfVeVtPGOOej4CuNNlJI2xa9BUeQQaD3FKG83iAdItHClcSQ4rzLJvRohGsRCowqoexyCxKbNiUqVPrnf5MhBL0VKRTv6IWZCJnZJR4bujm7eprY+GD2/M6g/hZyypgKENGspThHha2fqxdjZ4sUg8iRz16aYLXBrN5SLPLa5tBMrGCT3T7wD0GgYcM1XwU0IWsXZ80wPY7WMpVguM2g0ABvMDmZhkXZox4w3dswvQV44FFSIe4vqT46rrbzSAEru1pXF6j1L2vTND6Us10p15Zr5Ywq2OTQRwUO0UMyiCM27PYDDKYLomRoy2VNq+n9HGfbGbvyzM9FWgd+4zMfWY4iaV1v6+assHCZNOl7XcKnUC0bUQ9osrq3qnTevgUTtZYUz4ecGEDDwtjaTYER8jsx0YAO5Gxc2EfyyP83lqq27b4Fc6gqhRolEXSe1FDrRBUZioslrYpkD3WthzHSyg0WNCIkVFeoNWw3S7UsQsAHqiobvQTgrgSNbL80gizdmU4EyEswsNzPMQxV3hqiO1oR3kDoyD87tOm57QStKusUNiUcigRXSlZQRchZW2qpc0Sdg5AbQDuw3XboDIQcwGAUm7uh3LWEPvPx88zRiNgWd5OaBr3o+oBrmeaCJhdDeZ7BB83kbETdjZ3bmzryii6eaDCR8c0PzUk/wOdTX7SFU//bEmg5EYoUiOCvv5H5NXbnuDffpHUGYoxLJN892uvarsgXXIPa/14SJTU+pBepXOWVf5W88yFI58VOWqBW9DAYNM3KQMRE0x4gO2JYmLZrtD1ItLTC3ooK2rKasdvzAIVwNp2PfTqpwmdWZY+CswMKzDeYZp579acNgDjodSLv+IK31JvcT4o218jlhYbM78LcJcUR8EG8xSWrynLL7sHZl7cnQQUoYKvLJn0eVwnHTenCVgxSSbwWNwF4cmm+owsbpeLxLqEC+WhoyPHhosl4Y3hewN4Pyw8mNzfhiehxFgzvRgg/IfhuLPRDXr4ljfwe5f/nkxz/m6HDWMR4zWrPBHPFx+zQ7/BX/d5zRrvRfeFU0pbfVcJHvpeMcVfDfAGby8TG/LO0BFc0vftiwtfzPBnD02rvFnZnrrwVUR3wvEFt5heARddZVDE/uXGjRdt4bru4UWODcfT5WmFdvE/Jeqz44iuBr4AAAAASUVORK5CYII=",W_="/assets/gemini-D4G1NbrE.png",U_="/assets/kimi-BWNNSh7e.png",H_="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAADimHc4AAABzUlEQVR4AeycQQrCQBAEF1+g6J/0o5LPCXmCnnNx0E2nNqGEPciw024VffV0PZ/fHo7BqflBCSgAxd+aAhQAE4DjbYACYAJwvA1QAEwAjrcBCgAIDBRpA2AZClAATACOtwEKgAnA8TZAATABOD7egNc8tz2ftJ+4gPQD9r5fAbDBDQXALx00XgGwGAUoACYAx9sABcAE4HgboACYABxvAxSwJHC7XFryLNP4bzYg7KBar4CKUHiugDDgar0CKkLhuQLCgKv1CqgIhecKCAOu1iugIhSeKyAMuFqvgIpQeK6AMOBq/XAC7o9H6z5fdlRAtp4PJ2BrAHSeAmADClAATACOtwEKgAnA8TZAATABON4GKAAmAMev2AD4JTuNVwAsTgEKgAnA8TZAATABON4GKAAmAMfbAAXABOB4G9ApoPe6AnoJdt5XQCfA3uvDCXhOU0ueXmBr3x9OwNoPHH2fAmBDClAATACOtwEKgAnA8TZAAX8QONAVGwDLVIACYAJwfLwByf/+2WJ32k9cQPoBe9+vANigAhQAE4DjbYACYAJw/A8NgH/pQeMVAItVgAJgAnC8DVAATACOtwEKgAnA8TZAATABON4GFALS4w8AAAD//x7wkLQAAAAGSURBVAMAKj5LkLSa6SQAAAAASUVORK5CYII=",z_=new Set(["low","medium","high","xhigh"]),q_=["claude-code","codex","opencode","gemini","kimi"],$c=["codex","claude-code","opencode","gemini","kimi"],MP={"claude-code":{displayNameKey:"conversation.providerClaude",fullDisplayNameKey:"shell.providerClaudeCode",draftTitleKey:"conversation.draftTitleClaude",defaultModelLabelKey:"conversation.modelUseCliDefault",icon:B_,defaultRunInputMode:"streaming_guidance",reasoningLevelPersists:!1,defaultReasoningLevel:void 0,supportsSlashMenuByDefault:!0,foldRulesMessagesByDefault:!1},codex:{displayNameKey:"conversation.providerCodex",draftTitleKey:"conversation.draftTitleCodex",defaultModelLabelKey:"conversation.modelUseCliDefault",icon:AP,defaultRunInputMode:"none",reasoningLevelPersists:!0,defaultReasoningLevel:null,supportsSlashMenuByDefault:!1,foldRulesMessagesByDefault:!0},opencode:{displayNameKey:"conversation.providerOpenCode",draftTitleKey:"conversation.draftTitleOpenCode",defaultModelLabelKey:"conversation.modelUseCliDefault",icon:H_,defaultRunInputMode:"none",reasoningLevelPersists:!1,defaultReasoningLevel:void 0,supportsSlashMenuByDefault:!1,foldRulesMessagesByDefault:!1},gemini:{displayNameKey:"conversation.providerGemini",draftTitleKey:"conversation.draftTitleGemini",defaultModelLabelKey:"conversation.modelUseCliDefault",icon:W_,defaultRunInputMode:"none",reasoningLevelPersists:!1,defaultReasoningLevel:null,supportsInterrupt:!0,supportsAttachments:!1,supportsPermissionPrompt:!1,supportsSlashMenuByDefault:!1,foldRulesMessagesByDefault:!1},kimi:{displayNameKey:"conversation.providerKimi",draftTitleKey:"conversation.draftTitleKimi",defaultModelLabelKey:"conversation.modelUseCliDefault",icon:U_,defaultRunInputMode:"none",reasoningLevelPersists:!1,defaultReasoningLevel:null,supportsInterrupt:!0,supportsAttachments:!1,supportsPermissionPrompt:!1,supportsSlashMenuByDefault:!1,foldRulesMessagesByDefault:!0}},$_=Array.from(new Set(Object.values(MP).map(e=>e.icon)));let _x=!1;function V_(e){return q_.includes(e)}function ga(e){return!e||!V_(e)?null:MP[e]}function G_(e){return[{id:"provider-default",name:o(e),usesProviderDefault:!0}]}function K_(e){const t=ga(e);return G_((t==null?void 0:t.defaultModelLabelKey)??"conversation.modelUseCliDefault")}function IP(e){return!!(e&&ga(e))}function Y_(e){const t=ga(e);return o((t==null?void 0:t.draftTitleKey)??"conversation.draftTitleCodex")}function Vs(e,t="compact"){const r=ga(e);return r?t==="full"&&r.fullDisplayNameKey?o(r.fullDisplayNameKey):o(r.displayNameKey):(e==null?void 0:e.trim())||o("conversation.providerCodex")}function EP(e){const t=ga(e);return(t==null?void 0:t.icon)??AP}function LP(){_x||typeof window>"u"||(_x=!0,$_.forEach(e=>{const t=new window.Image;t.decoding="async",t.src=e,typeof t.decode=="function"&&t.decode().catch(()=>{})}))}function Ga(e){const t=ga(e);return{provider:e,canStartSession:!0,canResumeSession:!0,canSendMessage:!0,inRunInputMode:(t==null?void 0:t.defaultRunInputMode)??"none",supportsSubagents:!1,supportsInterrupt:(t==null?void 0:t.supportsInterrupt)??!1,supportsStructuredToolCalls:!0,supportsTokenUsage:!0,supportsAttachments:(t==null?void 0:t.supportsAttachments)??!0,supportsPermissionPrompt:(t==null?void 0:t.supportsPermissionPrompt)??!0,supportsCheckpoint:!1,modelOptions:K_(e),defaultReasoningLevel:t==null?void 0:t.defaultReasoningLevel,limitations:[]}}function X_(e){return(e==null?void 0:e.provider)??"claude-code"}function Q_(e){var r;if((e==null?void 0:e.supportsSlashMenu)!==void 0)return e.supportsSlashMenu;const t=(e==null?void 0:e.provider)??null;return((r=ga(t))==null?void 0:r.supportsSlashMenuByDefault)??!1}function J_(e){var t;return(e==null?void 0:e.supportsReasoningSelector)!==void 0?e.supportsReasoningSelector:!!((t=e==null?void 0:e.modelOptions)!=null&&t.some(r=>{var s;return((s=r.supportedReasoningEfforts)==null?void 0:s.some(i=>z_.has(i)))??!1}))}function Z_(e,t){if((e==null?void 0:e.supportsQueueWhileRunning)!==void 0)return e.supportsQueueWhileRunning;const r=(e==null?void 0:e.inRunInputMode)??"none";return r==="queued_guidance"||r==="none"||r==="streaming_guidance"&&t===!1}function FP(e){return(e==null?void 0:e.supportsRunSteering)!==void 0?e.supportsRunSteering:(e==null?void 0:e.inRunInputMode)==="streaming_guidance"}function eO(e){const t=ga(e);return(t==null?void 0:t.reasoningLevelPersists)??!1}function tO(e,t){var s;return((s=ga(t??null))==null?void 0:s.foldRulesMessagesByDefault)??!1}typeof window<"u"&&LP();function nO(e,t,r,s){return Oe.request("/api/files/content",{method:"PUT",body:JSON.stringify({workspaceId:e,path:t,content:r,expectedVersion:s??void 0})})}function vf(e){return Oe.request("/api/files/ops",{method:"POST",body:JSON.stringify(e)})}function rO(e){return Oe.request("/api/files/upload",{method:"POST",body:JSON.stringify(e)})}function sO(e,t){const r=new URLSearchParams({workspaceId:e,path:t});return Oe.request(`/api/files/download?${r.toString()}`)}function _c(e,t,r=1,s=20){const i=new URLSearchParams({workspaceId:e,keyword:t,page:String(r),pageSize:String(s)});return Oe.request(`/api/files/search?${i.toString()}`)}function wf(e,t){const r=new URLSearchParams({workspaceId:e,path:t});return Oe.request(`/api/files/preview?${r.toString()}`)}function Du(e){var t,r;return e.runningState==="failed"||!!((t=e.lastErrorCode)!=null&&t.trim())||!!((r=e.lastErrorDetail)!=null&&r.trim())}function Av(e,t,r){return`${e} is-${_P(t,r)}`}function _P(e,t){t==null||t.isActive;const r=iO(e);return t!=null&&t.hasSubagents?r==="error"?"error":r==="unread"?"subagent-unread":r==="running"||r==="running_inferred"?"subagent-running":"subagent":r==="running_inferred"?"running-inferred":r.replace("_","-")}function au(e){return e.runningState==="stale"?o("conversation.runtimeStale"):e.runningState==="unknown"?o("conversation.runtimeUnknown"):null}function OP(e,t){return t.runningState==="stale"?`${e} is-stale`:t.runningState==="unknown"?`${e} is-unknown`:null}function iO(e){return Du(e)?"error":e.runningState==="stale"?"stale":e.runningState==="unknown"?"unknown":e.activityState==="running"?aO(e)?"running_inferred":"running":e.activityState==="completed_unread"?"unread":"idle"}function aO(e){return e.activityResolutionSource==="inferred_log"||e.activitySource==="inferred"}function oO(e){return Ru(e)!==null}function ba(e){return e.isSubagent===!0&&!oO(e)}function Ru(e){return e.forkMethod==="reconstructed_message_fork"||e.forkMethod==="reconstructed_session_fork"?"reconstructed":e.forkMethod==="native_message_fork"||e.forkSourceType==="message"?"message":e.forkMethod==="native_session_fork"||e.forkSourceType==="session"?"session":null}function Mv(e){const t=Ru(e);return t==="reconstructed"?o("shell.sessionForkReconstructed"):t==="message"?o("shell.sessionForkMessage"):t==="session"?o("shell.sessionForkSession"):null}function Iv(e){return e.sessionKind==="annotation"?"annotation":null}function BP(e){return Iv(e)==="annotation"?o("conversation.actionSessionBadge"):null}const Ox=48;function lO(e){return typeof e=="string"?e.replace(/\s+/g," ").trim():""}function Ki(e,t){const r=lO(e)||t,s=r.length>Ox?r.slice(0,Ox).trimEnd():r;return{fullTitle:r,displayTitle:s}}function Ed(e,t){return(t??"").localeCompare(e??"")}function Bx(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:"base"})}function Ld(e){return(e==null?void 0:e.trim())??""}function Ev(e,t,r){if(r==="updatedAt"){const c=Ed(e.updatedAt,t.updatedAt);if(c!==0)return c}if(r==="title"){const c=Bx(Ld(e.title),Ld(t.title));if(c!==0)return c}else{const c=Ed(e.createdAt,t.createdAt);if(c!==0)return c}const s=Ed(e.updatedAt,t.updatedAt);if(s!==0)return s;const i=Ed(e.createdAt,t.createdAt);if(i!==0)return i;const l=Bx(Ld(e.title),Ld(t.title));return l!==0?l:e.sessionId.localeCompare(t.sessionId)}function Au(e,t){return[...e].sort((r,s)=>Ev(r,s,t))}function Lv(e,t){return Array.isArray(e)?e.map(r=>({...r,sessions:Au(r.sessions,t),children:Lv(r.children,t)})):[]}const yf=5,kf=["#2563eb","#0891b2","#16a34a","#d97706","#dc2626","#64748b"];function WP(e){const t=Math.round(e.ratio*1e3)/10;return`${t.toFixed(t%1===0?0:1)}%`}function UP(e,t){const r=e.reduce((d,m)=>d+m.count,0);if(r<=0)return[];const i=e.slice(0,yf).map((d,m)=>({...d,key:d.type,ratio:d.count/r,color:kf[m]??kf[0]})),l=e.slice(yf);if(l.length===0)return i;const c=l.reduce((d,m)=>d+m.count,0);return i.push({key:"other",type:t,count:c,ratio:c/r,color:kf[yf]}),i}function cO(e){if(e.length===0)return"conic-gradient(color-mix(in srgb, var(--border-primary) 78%, transparent) 0% 100%)";let t=0;return`conic-gradient(${e.map((s,i)=>{const l=t,c=i===e.length-1?1:Math.min(1,t+s.ratio);return t=c,`${s.color} ${Wx(l)} ${Wx(c)}`}).join(", ")})`}function HP(e){return{"--workbench-manage-chart-background":cO(e)}}function Wx(e){const t=Math.round(e*1e3)/10;return`${t.toFixed(t%1===0?0:1)}%`}const uO=8,dO=12,hO=160,Ux=96;function zP(e,t,r,s={}){const i=s.gapPx??uO,l=s.viewportMarginPx??dO,c=s.defaultWidthPx??hO,d=s.estimatedHeightPx??Ux,m=s.minHeightPx??Ux,f=Math.max(0,r.width),v=Math.max(0,r.height),g=Math.max(0,v-l*2),w=Math.max(0,f-l*2),k=Fd(Math.max(t.width||c,c),0,w),y=Math.max(t.height||d,d),S=Math.max(0,f-e.x-l),T=Math.max(0,e.x-l),j=S<k&&T>S,N=Math.max(0,v-e.y-i-l),D=Math.max(0,e.y-i-l),H=N<y&&D>N,I=Fd(Math.max(H?D:N,m),0,g),A=Math.min(y,I),L=j?e.x-k:e.x,_=Math.max(l,f-l-k),F=H?e.y-i-A:e.y+i,te=Math.max(l,v-l-A),E=Fd(L,l,_),se=Fd(F,l,te),X=j||E<e.x?"right":"left";return{top:se,left:E,width:k,maxHeight:Math.max(0,I),transformOrigin:`${H?"bottom":"top"} ${X}`}}function Fd(e,t,r){return!Number.isFinite(e)||r<t?t:Math.min(Math.max(e,t),r)}const qP="workbench.navigation.snapshot",$P=1800*1e3,mO="workbench.navigation.snapshot.host.";function VP(e){return`${mO}${e}`}function GP(e=$P,t=Rn.getState().activeHostId){if(t){const r=Ur(VP(t),e);if(r)return r}return Ur(qP,e)}function _d(e,t=Rn.getState().activeHostId){_s(qP,e),t&&_s(VP(t),e)}function ou(e,t="createdAt"){return!e||!Array.isArray(e.items)?[]:e.items.map(r=>({workspace:r.workspace,sessions:Au(r.sessions,t),childWorktrees:pO(r.childWorktrees,t)}))}function pO(e,t){return Lv(e,t)}function Mu(e){return{workspaceId:e.id,tone:"root",backgroundColor:e.backgroundColor??null,displayName:e.name,workspaceName:e.name,branchName:null,depth:0,rootWorkspaceId:e.id,rootDisplayName:e.name,parentWorkspaceId:null,parentDisplayName:null}}function vm(e){const t=new Map;for(const r of e)t.set(r.workspace.id,Mu(r.workspace)),KP(t,r.childWorktrees??[],r.workspace,r.workspace);return Object.fromEntries(t)}function ai(e){if(e!=null&&e.backgroundColor)return{"--workspace-tone-color":e.backgroundColor}}function KP(e,t,r,s,i=s.name){var l;for(const c of t){const d=((l=c.meta.displayName)==null?void 0:l.trim())||c.workspace.name;e.set(c.workspace.id,{workspaceId:c.workspace.id,tone:"worktree",backgroundColor:c.workspace.backgroundColor??null,displayName:d,workspaceName:c.workspace.name,branchName:c.meta.branchName||null,depth:c.meta.depth,rootWorkspaceId:r.id,rootDisplayName:r.name,parentWorkspaceId:c.meta.parentWorkspaceId||s.id,parentDisplayName:i}),KP(e,c.children,r,c.workspace,d)}}function wm(){return Oe.request("/api/butler/profile")}function fO(e){return Oe.request("/api/butler/profile/init",{method:"POST",body:JSON.stringify(e)})}function Hx(e){return Oe.request("/api/butler/profile",{method:"PATCH",body:JSON.stringify(e)})}function gO(){return Oe.request("/api/butler/control-session")}function nb(){return Oe.request("/api/butler/control-sessions")}function bO(e){return Oe.request(`/api/butler/control-sessions/${encodeURIComponent(e)}`)}function vO(){return Oe.request("/api/butler/control-session/reset",{method:"POST"})}function wO(e={}){return Oe.request("/api/butler/control-session/start",{method:"POST",body:JSON.stringify(e)})}function yO(e){return Oe.request("/api/butler/control-session/messages",{method:"POST",body:JSON.stringify(e)})}function kO(){return Oe.request("/api/butler/control-session/events")}function ym(){return Oe.request("/api/butler/overview")}function xO(e={}){var i;const t=new URLSearchParams;(i=e.workspaceId)!=null&&i.trim()&&t.set("workspaceId",e.workspaceId.trim()),e.status&&t.set("status",e.status),e.riskLevel&&t.set("riskLevel",e.riskLevel);const r=t.toString(),s=r?`/api/butler/projects?${r}`:"/api/butler/projects";return Oe.request(s)}function YP(e,t={}){const r=new URLSearchParams;t.enabled!==null&&t.enabled!==void 0&&r.set("enabled",String(t.enabled)),t.executionMode&&r.set("executionMode",t.executionMode);const s=r.toString(),i=s?`/api/butler/projects/${encodeURIComponent(e)}/patrol-plans?${s}`:`/api/butler/projects/${encodeURIComponent(e)}/patrol-plans`;return Oe.request(i)}function Iu(e={}){var i,l;const t=new URLSearchParams;(i=e.workspaceId)!=null&&i.trim()&&t.set("workspaceId",e.workspaceId.trim()),(l=e.projectId)!=null&&l.trim()&&t.set("projectId",e.projectId.trim()),e.status&&t.set("status",e.status),e.itemType&&t.set("itemType",e.itemType);const r=t.toString(),s=r?`/api/butler/inbox?${r}`:"/api/butler/inbox";return Oe.request(s)}function SO(e){return Oe.request("/api/butler/inbox",{method:"POST",body:JSON.stringify(e)})}function km(e={}){var i,l;const t=new URLSearchParams;e.status&&t.set("status",e.status),(i=e.projectId)!=null&&i.trim()&&t.set("projectId",e.projectId.trim()),(l=e.sessionId)!=null&&l.trim()&&t.set("sessionId",e.sessionId.trim());const r=t.toString(),s=r?`/api/butler/follow-up-tasks?${r}`:"/api/butler/follow-up-tasks";return Oe.request(s)}function CO(e){return Oe.request("/api/butler/follow-up-tasks",{method:"POST",body:JSON.stringify(e)})}function XP(e){return Oe.request(`/api/butler/follow-up-tasks/${encodeURIComponent(e)}`)}function jO(e){return Oe.request(`/api/butler/follow-up-tasks/${encodeURIComponent(e)}/cancel`,{method:"POST"})}function zx(e,t){return Oe.request(`/api/butler/inbox/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify({projectId:t.projectId,itemType:t.itemType,title:t.title,content:t.content,priority:t.priority,status:t.status})})}function TO(e){return Oe.request(`/api/butler/inbox/${encodeURIComponent(e)}/analyze`,{method:"POST",body:JSON.stringify({})})}function NO(e){return Oe.request(`/api/butler/inbox/${encodeURIComponent(e)}/start-session`,{method:"POST",body:JSON.stringify({})})}function PO(e){return Oe.request(`/api/butler/inbox/${encodeURIComponent(e)}`,{method:"DELETE"})}function DO(){return Oe.request("/api/butler/notifications/archives")}function RO(e,t){return Oe.request(`/api/butler/notifications/archives/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify({archived:t})})}function AO(e){const t=new URLSearchParams;return t.set("sessionId",e),Oe.request(`/api/butler/session-target?${t.toString()}`)}function MO(e){const t=new URLSearchParams;return t.set("sessionId",e),Oe.request(`/api/butler/session-action-context?${t.toString()}`)}function IO(e){return Oe.request("/api/butler/actions/start-verification",{method:"POST",body:JSON.stringify(e)})}const Fv=new Map;function QP(){Fv.clear()}function _v({disabled:e=!1,workspaceId:t=null,pendingProvider:r=null,selectedProvider:s=null,providers:i=$c,className:l,disabledReasons:c,statusHintByProvider:d,onSelect:m}){const f=di(),v=!!t,[g,w]=p.useState(()=>qx(i,t)),k=i.map(y=>({provider:y}));return p.useEffect(()=>{LP()},[]),p.useEffect(()=>{if(!t){w({});return}const y=qx(i,t);w(y);const S=i.filter(j=>!y[j]);if(S.length===0)return;let T=!1;return Nv(S,t).then(j=>{LO(t,j),T||w(N=>({...N,...j}))}),()=>{T=!0}},[i,t]),n.jsx("div",{className:`session-provider-grid${l?` ${l}`:""}`,children:k.map(y=>{const S=Vs(y.provider,"full"),T=r===y.provider,j=s===y.provider,N=!!g[y.provider],D=EO(g[y.provider]??null),H=(c==null?void 0:c[y.provider])??D,B=T?o("shell.startingSession"):H||((d==null?void 0:d[y.provider])??(v&&!N&&!T?o("shell.providerChecking"):null));return n.jsxs("button",{type:"button",className:"session-provider-card","data-provider":y.provider,"data-pending":T?"true":"false","data-selected":j?"true":"false","aria-label":S,disabled:e||!!H,onClick:()=>{f.trigger("action"),m(y.provider)},children:[n.jsx("span",{className:"session-provider-card-icon","aria-hidden":"true",children:n.jsx("img",{src:EP(y.provider),alt:"",loading:"eager",decoding:"async"})}),n.jsxs("span",{className:"session-provider-card-copy",children:[n.jsx("strong",{children:S}),B?n.jsx("span",{className:"session-provider-card-status",children:B}):null]})]},y.provider)})})}function EO(e){return!e||e.canStartSession!==!1?null:e.limitations[0]??o("conversation.capabilityDenied")}function qx(e,t){const r=(t==null?void 0:t.trim())??"";if(!r)return{};const s=[];for(const i of e){const l=Fv.get(JP(r,i));l&&s.push([i,l])}return Object.fromEntries(s)}function LO(e,t){const r=e.trim();if(r)for(const[s,i]of Object.entries(t))i&&Fv.set(JP(r,s),i)}function JP(e,t){return`${e}::${t}`}class Yh extends Error{constructor(t,r){super(r),this.code=t,this.name="HostSwitchError"}}class FO{constructor(){Ze(this,"inFlight",null)}async switchHost(t){this.inFlight&&await this.inFlight;const r=this.performSwitch(t).finally(()=>{this.inFlight===r&&(this.inFlight=null)});this.inFlight=r,await r}async performSwitch(t){const r=Rn.getState();if(r.activeHostId===t)return;const s=MT(r,t);if(!s)throw new Yh("HOST_NOT_FOUND",`找不到 HOST:${t}`);if(!(await qN(s.baseUrl)).reachable)throw new Yh("HOST_UNREACHABLE",`目标 HOST 不可达:${s.baseUrl}`);const l=iI(s.id);if(l)try{await nr.loginForHost(s,{username:l.username,password:l.password})}catch{}const c=Rn.getState(),d=new Date().toISOString();await Rn.update({hosts:c.hosts.map(m=>m.id===t?{...m,lastConnectedAt:d,updatedAt:d}:m),activeHostId:t})}}const ZP=new FO;function eD({collapsed:e=!1}){const[t,r]=p.useState(!1),[s,i]=p.useState(!1),[l,c]=p.useState(""),[d,m]=p.useState(""),[f,v]=p.useState(""),[g,w]=p.useState(""),[k,y]=p.useState(null),[S,T]=p.useState(null),[j,N]=p.useState(null),D=p.useRef(null),H=p.useRef(null),B=Ya(G=>G),I=xu(G=>G.session),{showToast:A}=Qn(),L=Ja(B),_=p.useMemo(()=>_O(B.hosts,B.activeHostId),[B.activeHostId,B.hosts]),F=p.useCallback(()=>{if(typeof window>"u")return;const G=D.current;if(!G)return;const q=G.getBoundingClientRect(),U=window.innerWidth,Q=window.innerHeight,P=16,W=8,R=Math.min(320,Math.max(240,U-P*2)),ve=Math.min(e?Math.max(P,q.right+W):Math.max(P,q.left),Math.max(P,U-R-P)),pe=s?440:240,Y=e?q.top:q.bottom+W,Se=Math.min(Math.max(P,Y),Math.max(P,Q-pe-P));N({position:"fixed",top:Se,left:ve,width:R,maxWidth:U-P*2})},[e,s]);p.useEffect(()=>{if(!t){N(null);return}function G(U){var Q,P;U.target instanceof Node&&!((Q=D.current)!=null&&Q.contains(U.target))&&!((P=H.current)!=null&&P.contains(U.target))&&(r(!1),i(!1))}function q(U){U.key==="Escape"&&(r(!1),i(!1))}return window.addEventListener("pointerdown",G),window.addEventListener("keydown",q),window.addEventListener("resize",F),window.addEventListener("scroll",F,!0),F(),()=>{window.removeEventListener("pointerdown",G),window.removeEventListener("keydown",q),window.removeEventListener("resize",F),window.removeEventListener("scroll",F,!0)}},[t,F]);async function te(G){if(k||S||G.id===B.activeHostId){r(!1);return}y(G.id);try{await ZP.switchHost(G.id),r(!1),i(!1)}catch(q){A({title:UO(q,G.name),tone:"error"})}finally{y(null)}}async function E(G){if(!(G.id===B.activeHostId||k||S)&&!(typeof window<"u"&&!window.confirm(o("shell.hostDeleteConfirm",{name:G.name})))){T(G.id);try{await Rn.update({hosts:B.hosts.filter(q=>q.id!==G.id)}),LT(G.id),nr.clearHostSession(G.id),A({title:o("shell.hostDeleteSuccess",{name:G.name})})}catch{A({title:o("shell.hostDeleteFailed",{name:G.name}),tone:"error"})}finally{T(null)}}}async function se(){const G=f.trim();if((G.length>0||g.length>0)&&(!G||!g)){A({title:o("shell.hostAddIncompleteCredentials"),tone:"error"});return}let U;try{U=Pi(d)}catch{A({title:o("shell.hostAddInvalidUrl"),tone:"error"});return}if(B.hosts.some(W=>W.baseUrl===U)){A({title:o("shell.hostAddDuplicate"),tone:"error"});return}const Q=new Date().toISOString(),P={id:WO(),name:l.trim()||OO(U),baseUrl:U,kind:BO(U),createdAt:Q,updatedAt:Q,lastConnectedAt:null,lastUserId:null,lastUsername:null};try{await Rn.update({hosts:[...B.hosts,P]}),G&&g&&ET({hostId:P.id,username:G,password:g}),X(),i(!1),A({title:o("shell.hostAddSuccess",{name:P.name})})}catch{A({title:o("shell.hostAddFailed"),tone:"error"})}}function X(){c(""),m(""),v(""),w("")}if(!L)return null;const K=I!=null&&I.user.username?`${L.baseUrl} · ${I.user.username}`:L.baseUrl;return n.jsxs("div",{ref:D,className:"workbench-host-switcher-anchor","data-collapsed":e,children:[n.jsx("button",{type:"button",className:e?"workbench-nav-toolbar-button workbench-collapsed-button":"workbench-nav-toolbar-button","aria-label":o("shell.hostSwitcherAriaLabel"),title:K,"aria-expanded":t,onClick:()=>{r(G=>!G),i(!1)},children:n.jsx(HO,{})}),t&&j&&typeof document<"u"?Vn.createPortal(n.jsxs("div",{ref:H,className:"workbench-host-switcher-menu",style:j,role:"menu","aria-label":o("shell.hostSwitcherTitle"),children:[n.jsx("div",{className:"workbench-host-switcher-menu-header",children:n.jsx("strong",{children:o("shell.hostSwitcherTitle")})}),n.jsx("div",{className:"workbench-host-switcher-list",children:_.map(G=>{const q=G.id===B.activeHostId,U=q?(I==null?void 0:I.user.username)??G.lastUsername??G.baseUrl:G.lastUsername??G.baseUrl;return n.jsxs("div",{className:"workbench-host-switcher-item","data-active":q,children:[n.jsxs("button",{type:"button",className:"workbench-host-switcher-item-main",disabled:k!==null||S!==null,onClick:()=>{te(G)},children:[n.jsxs("span",{className:"workbench-host-switcher-item-copy",children:[n.jsxs("span",{className:"workbench-host-switcher-item-title",children:[G.name,q?n.jsx("span",{className:"workbench-host-switcher-item-badge",children:o("shell.hostSwitcherCurrentBadge")}):null]}),n.jsx("span",{className:"workbench-host-switcher-item-meta",children:U})]}),n.jsx("span",{className:"workbench-host-switcher-item-trailing",children:k===G.id?o("shell.hostSwitcherSwitching"):q?n.jsx(qO,{}):n.jsx(zO,{})})]}),q?null:n.jsx("button",{type:"button",className:"workbench-host-switcher-item-action","aria-label":o("shell.hostDeleteAriaLabel",{name:G.name}),title:o("shell.hostDeleteAction"),disabled:k!==null||S!==null,onClick:()=>{E(G)},children:S===G.id?o("shell.hostDeleteBusy"):n.jsx(VO,{})})]},G.id)})}),s?n.jsxs("div",{className:"workbench-host-switcher-form",children:[n.jsxs("label",{className:"workbench-host-switcher-field",children:[n.jsx("span",{children:o("shell.hostSwitcherNameLabel")}),n.jsx("input",{value:l,onChange:G=>c(G.target.value),placeholder:o("shell.hostSwitcherNamePlaceholder")})]}),n.jsxs("label",{className:"workbench-host-switcher-field",children:[n.jsx("span",{children:o("shell.hostSwitcherUrlLabel")}),n.jsx("input",{value:d,onChange:G=>m(G.target.value),placeholder:o("shell.hostSwitcherUrlPlaceholder")})]}),n.jsxs("label",{className:"workbench-host-switcher-field",children:[n.jsx("span",{children:o("auth.username")}),n.jsx("input",{value:f,onChange:G=>v(G.target.value),autoComplete:"username"})]}),n.jsxs("label",{className:"workbench-host-switcher-field",children:[n.jsx("span",{children:o("auth.password")}),n.jsx("input",{type:"password",value:g,onChange:G=>w(G.target.value),autoComplete:"current-password"})]}),n.jsxs("div",{className:"workbench-host-switcher-form-actions",children:[n.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{i(!1),X()},children:o("common.cancel")}),n.jsx("button",{type:"button",className:"primary-button",onClick:()=>{se()},children:o("shell.hostSwitcherSaveAction")})]})]}):n.jsxs("button",{type:"button",className:"workbench-host-switcher-add",onClick:()=>{i(!0)},children:[n.jsx($O,{}),o("shell.hostSwitcherAddAction")]})]}),document.body):null]})}function _O(e,t){return[...e].sort((r,s)=>{if(r.id===t)return-1;if(s.id===t)return 1;const i=r.lastConnectedAt??r.updatedAt??r.createdAt;return(s.lastConnectedAt??s.updatedAt??s.createdAt).localeCompare(i)})}function OO(e){try{const t=new URL(e),r=t.pathname==="/"?"":t.pathname.replace(/\/+$/,"");return`${t.host}${r}`}catch{return e}}function BO(e){try{const t=new URL(e).hostname.toLowerCase();return t==="localhost"||t==="127.0.0.1"||t==="::1"||t==="[::1]"?"local":/^10\./.test(t)||/^192\.168\./.test(t)||/^172\.(1[6-9]|2\d|3[0-1])\./.test(t)?"lan":"remote"}catch{return"custom"}}function WO(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?`host-${crypto.randomUUID()}`:`host-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function UO(e,t){return e instanceof Yh?e.code==="HOST_UNREACHABLE"?o("shell.hostSwitchUnreachable",{name:t}):o("shell.hostSwitchMissing"):o("shell.hostSwitchFailed")}function HO(){return n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[n.jsx("rect",{x:"4",y:"4.5",width:"16",height:"6.5",rx:"2.2",stroke:"currentColor",strokeWidth:"1.8"}),n.jsx("rect",{x:"4",y:"13",width:"16",height:"6.5",rx:"2.2",stroke:"currentColor",strokeWidth:"1.8"}),n.jsx("path",{d:"M11 7.75h5.5",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"}),n.jsx("path",{d:"M11 16.25h5.5",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"}),n.jsx("circle",{cx:"7.5",cy:"7.75",r:"1",fill:"currentColor",stroke:"none"}),n.jsx("circle",{cx:"7.5",cy:"16.25",r:"1",fill:"currentColor",stroke:"none"})]})}function zO(){return n.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:n.jsx("path",{d:"M6 3.5L10.5 8 6 12.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function qO(){return n.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:n.jsx("path",{d:"M3.5 8.5L6.5 11.5L12.5 5.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.8"})})}function $O(){return n.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:n.jsx("path",{d:"M8 3.5v9M3.5 8h9",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function VO(){return n.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:n.jsx("path",{d:"M3.5 4.5h9M6.5 2.75h3M5 4.5v7.25a1 1 0 0 0 1 1h4a1 1 0 0 0 1-1V4.5M6.75 6.5v4M9.25 6.5v4",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.35"})})}function GO(){return n.jsx("svg",{viewBox:"0 0 16 16",width:"16",height:"16","aria-hidden":"true",children:n.jsx("path",{d:"M4.2 4.2l7.6 7.6M11.8 4.2l-7.6 7.6",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"})})}function zo({className:e,"aria-label":t,...r}){return n.jsx("button",{type:"button",className:e?`workbench-modal-close ${e}`:"workbench-modal-close","aria-label":t??o("common.close"),...r,children:n.jsx(GO,{})})}function Fn({open:e,title:t,description:r,className:s,headerActions:i,showCloseButton:l=!0,onClose:c,children:d}){return p.useEffect(()=>{if(!e)return;function m(f){f.key==="Escape"&&c()}return window.addEventListener("keydown",m),()=>{window.removeEventListener("keydown",m)}},[c,e]),!e||typeof document>"u"?null:Vn.createPortal(n.jsxs("div",{className:"workbench-modal-layer",children:[n.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":o("common.close"),onClick:c}),n.jsxs("section",{className:`workbench-modal-card surface-card${s?` ${s}`:""}`,role:"dialog","aria-modal":"true","aria-label":t,children:[n.jsxs("div",{className:"workbench-modal-header",children:[n.jsxs("div",{className:"workbench-modal-title-wrap",children:[n.jsx("h2",{children:t}),n.jsx("p",{children:r})]}),i||l?n.jsxs("div",{className:"workbench-modal-header-actions",children:[i,l?n.jsx(zo,{onClick:c}):null]}):null]}),n.jsx("div",{className:"workbench-modal-body",children:d})]})]}),document.body)}const Od={repositoryUrl:"",parentPath:"",directoryName:"",name:"",authMode:"none",username:"",password:"",token:""};function tD({open:e,onClose:t,onCloned:r}){const{showToast:s}=Qn(),[i,l]=p.useState(!1),[c,d]=p.useState(Od),[m,f]=p.useState(!1),[v,g]=p.useState(!1),[w,k]=p.useState(null),[y,S]=p.useState(""),[T,j]=p.useState(""),[N,D]=p.useState(null),[H,B]=p.useState([]),[I,A]=p.useState([]),L=i||v;p.useEffect(()=>{!e&&!i&&(d(Od),f(!1),k(null))},[i,e]);const _=p.useCallback(async G=>{g(!0),k(null);try{const q=await kP(G);S(q.currentPath),j(q.currentPath),D(q.parentPath),B(q.roots),A(q.items),d(U=>({...U,parentPath:q.currentPath}))}catch(q){S(""),D(null),A([]),k(q instanceof Error?q.message:o("shell.importBrowserBrowseFailed"))}finally{g(!1)}},[]);function F(){i||(f(!1),k(null),d(Od),t())}function te(){f(!0),_(c.parentPath||void 0)}function E(){i||(f(!1),k(null))}async function se(G){G.preventDefault(),await _(T)}function X(){d(G=>({...G,parentPath:y})),f(!1),k(null)}async function K(G){G.preventDefault();const q=c.repositoryUrl.trim(),U=c.parentPath.trim();if(!q){s({title:o("shell.cloneRepoRequired"),tone:"error"});return}if(!U){s({title:o("shell.clonePathRequired"),tone:"error"});return}l(!0);try{const Q=await o_({repositoryUrl:q,parentPath:U,directoryName:c.directoryName.trim()||void 0,name:c.name.trim()||void 0,auth:c.authMode==="none"?{mode:"none"}:c.authMode==="basic"?{mode:"basic",username:c.username.trim(),password:c.password}:{mode:"token",username:c.username.trim()||void 0,token:c.token}});await(r==null?void 0:r(Q)),d(Od),f(!1),s({title:o("shell.cloneSuccess"),description:Q.path,tone:"success"}),t()}catch(Q){s({title:Q instanceof Error?Q.message:o("shell.cloneFailed"),tone:"error"})}finally{l(!1)}}return n.jsxs(n.Fragment,{children:[n.jsx(Fn,{open:e,title:o("shell.cloneWorkspaceTitle"),description:o("shell.cloneWorkspaceHint"),onClose:F,children:n.jsxs("form",{className:"workbench-clone-form",onSubmit:G=>void K(G),children:[n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("shell.cloneRepositoryLabel")}),n.jsx("input",{type:"text",value:c.repositoryUrl,placeholder:o("shell.cloneRepositoryPlaceholder"),onChange:G=>d(q=>({...q,repositoryUrl:G.target.value}))})]}),n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("shell.cloneParentPathLabel")}),n.jsxs("div",{className:"workbench-modal-inline-field",children:[n.jsx("input",{type:"text",value:c.parentPath,placeholder:o("shell.cloneParentPathPlaceholder"),onChange:G=>d(q=>({...q,parentPath:G.target.value}))}),n.jsx("button",{type:"button",className:"secondary-button",disabled:i,onClick:te,children:o("shell.clonePickDirectory")})]})]}),n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("shell.cloneDirectoryNameLabel")}),n.jsx("input",{type:"text",value:c.directoryName,placeholder:o("shell.cloneDirectoryNamePlaceholder"),onChange:G=>d(q=>({...q,directoryName:G.target.value}))})]}),n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("shell.importNameLabel")}),n.jsx("input",{type:"text",value:c.name,placeholder:o("shell.importNamePlaceholder"),onChange:G=>d(q=>({...q,name:G.target.value}))})]}),n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("shell.cloneAuthModeLabel")}),n.jsxs("select",{value:c.authMode,onChange:G=>d(q=>({...q,authMode:G.target.value})),children:[n.jsx("option",{value:"none",children:o("shell.cloneAuthModeNone")}),n.jsx("option",{value:"basic",children:o("shell.cloneAuthModeBasic")}),n.jsx("option",{value:"token",children:o("shell.cloneAuthModeToken")})]})]}),c.authMode==="basic"?n.jsxs(n.Fragment,{children:[n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("shell.cloneUsernameLabel")}),n.jsx("input",{type:"text",value:c.username,placeholder:o("shell.cloneUsernamePlaceholder"),autoComplete:"username",onChange:G=>d(q=>({...q,username:G.target.value}))})]}),n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("shell.clonePasswordLabel")}),n.jsx("input",{type:"password",value:c.password,placeholder:o("shell.clonePasswordPlaceholder"),autoComplete:"current-password",onChange:G=>d(q=>({...q,password:G.target.value}))})]})]}):null,c.authMode==="token"?n.jsxs(n.Fragment,{children:[n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("shell.cloneUsernameLabel")}),n.jsx("input",{type:"text",value:c.username,placeholder:o("shell.cloneTokenUsernamePlaceholder"),onChange:G=>d(q=>({...q,username:G.target.value}))})]}),n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("shell.cloneTokenLabel")}),n.jsx("input",{type:"password",value:c.token,placeholder:o("shell.cloneTokenPlaceholder"),onChange:G=>d(q=>({...q,token:G.target.value}))})]})]}):null,n.jsx("p",{className:"workbench-import-hint",children:o("shell.cloneHint")}),n.jsxs("div",{className:"workbench-modal-actions",children:[n.jsx("button",{type:"button",className:"secondary-button",disabled:i,onClick:F,children:o("common.cancel")}),n.jsx("button",{type:"submit",className:"primary-button",disabled:i,children:o(i?"shell.cloneSubmitting":"shell.cloneSubmit")})]})]})}),n.jsxs(Fn,{open:e&&m,title:o("shell.cloneBrowserTitle"),description:o("shell.cloneBrowserDescription"),onClose:E,children:[n.jsxs("form",{className:"workbench-directory-browser-form",onSubmit:se,children:[n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("shell.importBrowserCurrentPath")}),n.jsx("input",{type:"text",value:T,placeholder:o("shell.importPathPlaceholder"),onChange:G=>j(G.target.value)})]}),n.jsxs("div",{className:"workbench-directory-browser-toolbar",children:[n.jsx("button",{type:"button",className:"secondary-button",disabled:L||!N,onClick:()=>{N&&_(N)},children:o("shell.importBrowserOpenParent")}),n.jsx("button",{type:"submit",className:"secondary-button",disabled:L,children:o("shell.importBrowserOpenPath")})]})]}),n.jsxs("section",{className:"workbench-directory-browser-panel",children:[n.jsxs("div",{className:"workbench-directory-browser-section",children:[n.jsx("span",{className:"workbench-directory-browser-section-title",children:o("shell.importBrowserRoots")}),n.jsx("div",{className:"workbench-directory-browser-root-list",children:H.map(G=>n.jsx("button",{type:"button",className:"workbench-directory-browser-chip",disabled:L,onClick:()=>{_(G.path)},children:G.name},G.path))})]}),n.jsx("div",{className:"workbench-directory-browser-current-path",children:y}),w?n.jsx("p",{className:"workbench-directory-browser-status status-text","data-tone":"error",children:w}):null,v?n.jsx("p",{className:"workbench-directory-browser-status status-text",children:o("common.loading")}):I.length>0?n.jsx("div",{className:"workbench-directory-browser-list",children:I.map(G=>n.jsxs("button",{type:"button",className:"workbench-directory-browser-item",disabled:L,onClick:()=>{_(G.path)},children:[n.jsx("span",{className:"workbench-directory-browser-item-name",children:G.name}),n.jsx("span",{className:"workbench-directory-browser-item-path",children:G.path})]},G.path))}):n.jsx("p",{className:"workbench-directory-browser-status status-text",children:o("shell.importBrowserEmpty")})]}),n.jsxs("div",{className:"workbench-modal-actions",children:[n.jsx("button",{type:"button",className:"secondary-button",disabled:i,onClick:E,children:o("common.cancel")}),n.jsx("button",{type:"button",className:"primary-button",disabled:L||!y,onClick:X,children:o("shell.cloneBrowserSubmit")})]})]})]})}const Fo="butler:inbox-updated";function xf(){typeof window>"u"||window.dispatchEvent(new Event(Fo))}const $x={projectId:"",itemType:"task",title:"",content:"",status:"pending"};function nD({active:e,preferredWorkspaceId:t,preferredSessionId:r,creationRequestId:s=0,initialDraft:i=null,compactComposer:l=!1,composerOpen:c=!0,onComposerOpenChange:d}){const{showToast:m}=Qn(),[f,v]=p.useState(!1),[g,w]=p.useState(!1),[k,y]=p.useState([]),[S,T]=p.useState([]),[j,N]=p.useState(null),[D,H]=p.useState(null),[B,I]=p.useState($x),[A,L]=p.useState(!1),_=p.useMemo(()=>Gx(k,t,D),[D,t,k]),F=p.useMemo(()=>A?S:S.filter(q=>q.status!=="closed"),[S,A]);p.useEffect(()=>{e&&te()},[e,r]),p.useEffect(()=>{!e||j||I(q=>{const U=Yx({projects:_,currentProjectId:q.projectId,preferredProjectId:D,preferredWorkspaceId:t});return U===q.projectId?q:{...q,projectId:U}})},[e,j,D,t,_]),p.useEffect(()=>{!e||s<=0||(E(void 0,t,i,D),d==null||d(!0))},[e,s,i,d,D,t]);async function te(){v(!0);try{const[q,U,Q]=await Promise.all([xO(),Iu(),r?AO(r).catch(()=>null):Promise.resolve(null)]),P=(Q==null?void 0:Q.target.project.id)??null;H(P),y(q.items),T(U.items),j||E(q.items,t,s>0?i:null,P)}catch(q){m({title:o("shell.butlerInboxLoadFailed"),description:q instanceof Error?q.message:void 0,tone:"error"})}finally{v(!1)}}function E(q=k,U=t,Q=i,P=D){var J,R;const W=Gx(q,U,P);N(null),I({...$x,projectId:Yx({projects:W,preferredProjectId:P,preferredWorkspaceId:U}),title:((J=Q==null?void 0:Q.title)==null?void 0:J.trim())??"",content:((R=Q==null?void 0:Q.content)==null?void 0:R.trim())??""})}function se(q){N(q.id),I({projectId:q.projectId,itemType:q.itemType,title:q.title,content:q.content,status:q.status}),l&&(d==null||d(!0))}async function X(q){q.preventDefault(),w(!0);try{j?(await zx(j,{projectId:B.projectId,itemType:B.itemType,title:B.title,content:B.content,status:B.status,priority:"medium"}),m({title:o("shell.butlerInboxUpdated"),tone:"success"})):(await SO({projectId:B.projectId,itemType:B.itemType,title:B.title,content:B.content,status:B.status,priority:"medium"}),m({title:o("shell.butlerInboxCreated"),tone:"success"})),xf(),await te(),E(),l&&(d==null||d(!1))}catch(U){m({title:o("shell.butlerInboxSaveFailed"),description:U instanceof Error?U.message:void 0,tone:"error"})}finally{w(!1)}}async function K(q){w(!0);try{await PO(q),m({title:o("shell.butlerInboxDeleted"),tone:"success"}),xf(),await te(),j===q&&E()}catch(U){m({title:o("shell.butlerInboxDeleteFailed"),description:U instanceof Error?U.message:void 0,tone:"error"})}finally{w(!1)}}async function G(q,U){if(q.status!==U){w(!0);try{await zx(q.id,{status:U}),m({title:o("shell.butlerInboxUpdated"),tone:"success"}),xf(),await te(),j===q.id&&I(Q=>({...Q,status:U}))}catch(Q){m({title:o("shell.butlerInboxSaveFailed"),description:Q instanceof Error?Q.message:void 0,tone:"error"})}finally{w(!1)}}}return n.jsxs("div",{className:"workspace-inbox-modal",children:[l?null:n.jsx("section",{className:"workspace-inbox-panel",children:n.jsx(Vx,{selectableProjects:_,formState:B,saving:g,editingItemId:j,useMobilePicker:!1,onProjectChange:q=>{I(U=>({...U,projectId:q}))},onItemTypeChange:q=>{I(U=>({...U,itemType:q}))},onStatusChange:q=>{I(U=>({...U,status:q}))},onTitleChange:q=>{I(U=>({...U,title:q}))},onContentChange:q=>{I(U=>({...U,content:q}))},onCancel:()=>E(),onSubmit:X})}),n.jsxs("section",{className:"workspace-inbox-panel",children:[n.jsxs("header",{className:"workspace-inbox-panel-header",children:[n.jsxs("div",{children:[n.jsx("h3",{children:o("shell.butlerInboxListTitle")}),n.jsx("p",{children:o("shell.butlerInboxListDescription")})]}),n.jsxs("label",{className:"workspace-inbox-closed-toggle",children:[n.jsx("input",{type:"checkbox",checked:A,onChange:q=>L(q.target.checked)}),n.jsx("span",{children:o("shell.butlerInboxShowClosedAction")})]})]}),f?n.jsx("p",{className:"workspace-inbox-status",children:o("shell.butlerInboxLoading")}):null,!f&&F.length===0?n.jsx("p",{className:"workspace-inbox-status",children:o("shell.butlerInboxEmpty")}):null,!f&&F.length>0?n.jsx("div",{className:"workspace-inbox-list",children:F.map(q=>n.jsxs("article",{className:"workspace-inbox-item",children:[n.jsxs("div",{className:"workspace-inbox-item-header",children:[n.jsxs("div",{children:[n.jsx("strong",{children:q.title}),n.jsx("p",{children:q.projectName})]}),n.jsxs("div",{className:"workspace-inbox-item-badges",children:[n.jsx("span",{className:"workspace-inbox-badge",children:Xx(q.status)}),n.jsx("span",{className:"workspace-inbox-badge",children:JO(q.itemType)})]})]}),n.jsx("p",{className:"workspace-inbox-item-content",children:q.content}),n.jsxs("div",{className:"workspace-inbox-item-footer",children:[n.jsx("span",{children:ZO(q.updatedAt)}),n.jsxs("div",{className:"workspace-inbox-item-actions",children:[n.jsx("div",{className:"workspace-inbox-status-quick-actions",role:"group","aria-label":o("shell.butlerInboxQuickStatusLabel"),children:["pending","in_progress","closed"].map(U=>{const Q=q.status===U;return n.jsx("button",{type:"button",className:"secondary-button","data-active":Q,disabled:g,onClick:()=>{G(q,U)},children:Xx(U)},`${q.id}:${U}`)})}),n.jsx("button",{type:"button",className:"secondary-button",disabled:g,onClick:()=>se(q),children:o("shell.butlerInboxEditAction")}),n.jsx("button",{type:"button",className:"secondary-button workbench-danger-button",disabled:g,onClick:()=>{K(q.id)},children:o("shell.butlerInboxDeleteAction")})]})]})]},q.id))}):null]}),l?n.jsx(Fn,{open:e&&c,title:o(j?"shell.butlerInboxEditingTitle":"shell.butlerInboxCreateTitle"),description:o("shell.butlerInboxFormDescription"),className:"workspace-inbox-modal-card workspace-inbox-composer-modal-card",onClose:()=>{d==null||d(!1),E()},children:n.jsx("div",{className:"workspace-inbox-composer-modal-body",children:n.jsx(Vx,{selectableProjects:_,formState:B,saving:g,editingItemId:j,useMobilePicker:!0,onProjectChange:q=>{I(U=>({...U,projectId:q}))},onItemTypeChange:q=>{I(U=>({...U,itemType:q}))},onStatusChange:q=>{I(U=>({...U,status:q}))},onTitleChange:q=>{I(U=>({...U,title:q}))},onContentChange:q=>{I(U=>({...U,content:q}))},onCancel:()=>{d==null||d(!1),E()},onSubmit:X})})}):null]})}function Vx(e){const t=e.selectableProjects.map(i=>({value:i.id,label:i.name})),r=[{value:"task",label:o("shell.butlerInboxTypeTask")},{value:"bug",label:o("shell.butlerInboxTypeBug")},{value:"feature",label:o("shell.butlerInboxTypeFeature")},{value:"change",label:o("shell.butlerInboxTypeChange")}],s=[{value:"pending",label:o("shell.butlerInboxStatusPending")},{value:"in_progress",label:o("shell.butlerInboxStatusInProgress")},{value:"closed",label:o("shell.butlerInboxStatusClosed")}];return n.jsxs(n.Fragment,{children:[n.jsxs("header",{className:"workspace-inbox-panel-header",children:[n.jsx("h3",{children:e.editingItemId?o("shell.butlerInboxEditingTitle"):o("shell.butlerInboxCreateTitle")}),n.jsx("p",{children:o("shell.butlerInboxFormDescription")})]}),e.selectableProjects.length===0?n.jsx("p",{className:"workspace-inbox-status",children:o("shell.butlerInboxProjectsEmpty")}):n.jsxs("form",{className:"workspace-inbox-form",onSubmit:e.onSubmit,children:[n.jsx("div",{className:"workspace-inbox-form-grid",children:e.useMobilePicker?n.jsxs(n.Fragment,{children:[n.jsx(Sf,{label:o("shell.butlerInboxProjectLabel"),value:e.formState.projectId,options:t,disabled:e.saving,onChange:e.onProjectChange}),n.jsx(Sf,{label:o("shell.butlerInboxTypeLabel"),value:e.formState.itemType,options:r,disabled:e.saving,onChange:e.onItemTypeChange}),n.jsx(Sf,{label:o("shell.butlerInboxStatusLabel"),value:e.formState.status,options:s,disabled:e.saving,onChange:e.onStatusChange})]}):n.jsxs(n.Fragment,{children:[n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("shell.butlerInboxProjectLabel")}),n.jsx("select",{value:e.formState.projectId,disabled:e.saving,onChange:i=>e.onProjectChange(i.target.value),children:e.selectableProjects.map(i=>n.jsx("option",{value:i.id,children:i.name},i.id))})]}),n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("shell.butlerInboxTypeLabel")}),n.jsxs("select",{value:e.formState.itemType,disabled:e.saving,onChange:i=>e.onItemTypeChange(i.target.value),children:[n.jsx("option",{value:"task",children:o("shell.butlerInboxTypeTask")}),n.jsx("option",{value:"bug",children:o("shell.butlerInboxTypeBug")}),n.jsx("option",{value:"feature",children:o("shell.butlerInboxTypeFeature")}),n.jsx("option",{value:"change",children:o("shell.butlerInboxTypeChange")})]})]}),n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("shell.butlerInboxStatusLabel")}),n.jsxs("select",{value:e.formState.status,disabled:e.saving,onChange:i=>e.onStatusChange(i.target.value),children:[n.jsx("option",{value:"pending",children:o("shell.butlerInboxStatusPending")}),n.jsx("option",{value:"in_progress",children:o("shell.butlerInboxStatusInProgress")}),n.jsx("option",{value:"closed",children:o("shell.butlerInboxStatusClosed")})]})]})]})}),n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("shell.butlerInboxTitleLabel")}),n.jsx("input",{value:e.formState.title,placeholder:o("shell.butlerInboxTitlePlaceholder"),disabled:e.saving,onChange:i=>e.onTitleChange(i.target.value)})]}),n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("shell.butlerInboxContentLabel")}),n.jsx("textarea",{rows:4,value:e.formState.content,placeholder:o("shell.butlerInboxContentPlaceholder"),disabled:e.saving,onChange:i=>e.onContentChange(i.target.value)})]}),n.jsxs("div",{className:"workbench-modal-actions",children:[n.jsx("button",{type:"button",className:"secondary-button",disabled:e.saving,onClick:e.onCancel,children:e.editingItemId?o("shell.butlerInboxCancelEditAction"):o("common.cancel")}),n.jsx("button",{type:"submit",className:"primary-button",disabled:e.saving||!e.formState.projectId,children:e.editingItemId?o("shell.butlerInboxUpdateAction"):o("shell.butlerInboxCreateAction")})]})]})]})}function Sf({label:e,value:t,options:r,disabled:s,onChange:i}){const[l,c]=p.useState(!1),d=r.find(m=>m.value===t)??r[0]??null;return p.useEffect(()=>{if(!l)return;function m(f){f.key==="Escape"&&c(!1)}return window.addEventListener("keydown",m),()=>{window.removeEventListener("keydown",m)}},[l]),n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"workbench-modal-field workspace-inbox-mobile-picker",children:[n.jsx("span",{children:e}),n.jsxs("button",{type:"button",className:"workspace-inbox-mobile-picker-trigger","aria-label":e,"aria-haspopup":"dialog","aria-expanded":l,disabled:s||r.length===0,onClick:()=>c(!0),children:[n.jsx("span",{className:"workspace-inbox-mobile-picker-trigger-value",children:(d==null?void 0:d.label)??""}),n.jsx("span",{className:"workspace-inbox-mobile-picker-trigger-icon",children:n.jsx(XO,{expanded:l})})]})]}),n.jsx(KO,{open:l,title:e,options:r,selectedValue:t,onClose:()=>c(!1),onSelect:m=>{i(m),c(!1)}})]})}function KO({open:e,title:t,options:r,selectedValue:s,onClose:i,onSelect:l}){return!e||typeof document>"u"?null:Vn.createPortal(n.jsx("div",{className:"ios-action-sheet-overlay workspace-inbox-picker-sheet-overlay",role:"presentation",onClick:i,children:n.jsxs("div",{className:"mobile-workspace-home-sheet workspace-inbox-picker-sheet",role:"dialog","aria-modal":"true","aria-label":t,onClick:c=>c.stopPropagation(),children:[n.jsxs("div",{className:"mobile-workspace-home-sheet-card workspace-inbox-picker-sheet-card",children:[n.jsx("div",{className:"mobile-workspace-home-sheet-header workspace-inbox-picker-sheet-header",children:n.jsx("strong",{children:t})}),n.jsx("div",{className:"mobile-workspace-home-group workspace-inbox-picker-sheet-options",role:"listbox","aria-label":t,children:r.map(c=>{const d=c.value===s;return n.jsxs("button",{type:"button",className:"mobile-workspace-home-row workspace-inbox-picker-option",role:"option","aria-selected":d,onClick:()=>l(c.value),children:[n.jsxs("span",{className:"workspace-inbox-picker-option-copy",children:[n.jsx("strong",{children:c.label}),c.description?n.jsx("span",{children:c.description}):null]}),n.jsx("span",{className:"workspace-inbox-picker-option-indicator","aria-hidden":"true",children:d?n.jsx(QO,{}):null})]},c.value)})})]}),n.jsx("button",{type:"button",className:"ios-action-sheet-cancel",onClick:i,children:o("common.cancel")})]})}),document.body)}function rb({open:e,preferredWorkspaceId:t,preferredSessionId:r,creationRequestId:s=0,initialDraft:i=null,onClose:l,compactComposer:c=!1}){const[d,m]=p.useState(0),[f,v]=p.useState(!c);return p.useEffect(()=>{e||v(!c)},[c,e]),n.jsx(Fn,{open:e,title:o("shell.butlerInboxModalTitle"),description:o("shell.butlerInboxModalDescription"),className:"workspace-inbox-modal-card",showCloseButton:!c,headerActions:c?n.jsx("button",{type:"button",className:"workspace-inbox-modal-create-button","aria-label":o("shell.butlerInboxCreateAction"),title:o("shell.butlerInboxCreateAction"),onClick:()=>{m(g=>g+1),v(!0)},children:n.jsx(YO,{})}):void 0,onClose:l,children:n.jsx(nD,{active:e,preferredWorkspaceId:t,preferredSessionId:r,creationRequestId:Math.max(s,d),initialDraft:i,compactComposer:c,composerOpen:f,onComposerOpenChange:v})})}function Gx(e,t,r){return[...e].filter(s=>s.lifecycleStatus!=="archived").sort((s,i)=>{const l=Kx(s,t,r),c=Kx(i,t,r);return l!==c?c-l:s.name.localeCompare(i.name,"zh-Hans-CN")})}function Kx(e,t,r){return r&&e.id===r?2:t&&e.workspaceId===t?1:0}function Yx({projects:e,currentProjectId:t,preferredProjectId:r,preferredWorkspaceId:s}){var l;if(t&&e.some(c=>c.id===t))return t;if(r&&e.some(c=>c.id===r))return r;const i=s?e.find(c=>c.workspaceId===s):null;return(i==null?void 0:i.id)||((l=e[0])==null?void 0:l.id)||""}function YO(){return n.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:[n.jsx("path",{d:"M12 5v14"}),n.jsx("path",{d:"M5 12h14"})]})}function XO({expanded:e}){return n.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true","data-expanded":e?"true":void 0,children:n.jsx("path",{d:"M3.5 6 8 10l4.5-4",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function QO(){return n.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:n.jsx("path",{d:"M3.5 8.4 6.6 11.5 12.5 5.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.8"})})}function JO(e){switch(e){case"bug":return o("shell.butlerInboxTypeBug");case"feature":return o("shell.butlerInboxTypeFeature");case"change":return o("shell.butlerInboxTypeChange");case"task":default:return o("shell.butlerInboxTypeTask")}}function Xx(e){switch(e){case"in_progress":return o("shell.butlerInboxStatusInProgress");case"closed":return o("shell.butlerInboxStatusClosed");case"pending":default:return o("shell.butlerInboxStatusPending")}}function ZO(e){return new Date(e).toLocaleString()}function rD({open:e,onClose:t,onImported:r}){const{showToast:s}=Qn(),[i,l]=p.useState(!1),[c,d]=p.useState(!1),[m,f]=p.useState(!1),[v,g]=p.useState(null),[w,k]=p.useState(""),[y,S]=p.useState(""),[T,j]=p.useState(null),[N,D]=p.useState([]),[H,B]=p.useState([]),[I,A]=p.useState(!1),[L,_]=p.useState(""),F=i||c||m,te=p.useCallback(async U=>{l(!0),g(null);try{const Q=await kP(U);k(Q.currentPath),S(Q.currentPath),j(Q.parentPath),D(Q.roots),B(Q.items)}catch(Q){k(""),j(null),B([]),g(Q instanceof Error?Q.message:o("shell.importBrowserBrowseFailed"))}finally{l(!1)}},[]);p.useEffect(()=>{if(!e){A(!1),_(""),g(null);return}te(w||void 0)},[te,e]);function E(){F||(A(!1),_(""),t())}async function se(U){U.preventDefault(),await te(y)}function X(){!w||F||(_(""),A(!0))}function K(){c||(A(!1),_(""))}async function G(U){U==null||U.preventDefault();const Q=L.trim();if(!(!w||!Q||F)){d(!0),g(null);try{const P=await h_({parentPath:w,directoryName:Q});s({title:o("shell.importBrowserCreateDirectorySuccess"),description:P.path,tone:"success"}),A(!1),_(""),await te(P.path)}catch(P){const W=P instanceof Error?P.message:o("shell.importBrowserCreateDirectoryFailed");g(W),s({title:W,tone:"error"})}finally{d(!1)}}}async function q(){const U=w.trim();if(!(!U||F)){f(!0),g(null);try{const Q=await a_({path:U});s({title:o("shell.importSuccess"),description:Q.path,tone:"success"}),t(),Promise.resolve().then(()=>r==null?void 0:r(Q)).catch(P=>{s({title:P instanceof Error?P.message:o("shell.navigationLoadFailed"),tone:"error"})})}catch(Q){s({title:Q instanceof Error?Q.message:o("shell.importFailed"),tone:"error"})}finally{f(!1)}}}return n.jsxs(n.Fragment,{children:[n.jsxs(Fn,{open:e,title:o("shell.importBrowserTitle"),description:o("shell.importBrowserDescription"),onClose:E,children:[n.jsxs("form",{className:"workbench-directory-browser-form",onSubmit:se,children:[n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("shell.importBrowserCurrentPath")}),n.jsx("input",{type:"text",value:y,placeholder:o("shell.importPathPlaceholder"),onChange:U=>S(U.target.value)})]}),n.jsxs("div",{className:"workbench-directory-browser-toolbar",children:[n.jsx("button",{type:"button",className:"secondary-button",disabled:F||!T,onClick:()=>{T&&te(T)},children:o("shell.importBrowserOpenParent")}),n.jsx("button",{type:"submit",className:"secondary-button",disabled:F,children:o("shell.importBrowserOpenPath")}),n.jsx("button",{type:"button",className:"secondary-button",disabled:F||!w,onClick:X,children:o("shell.importBrowserCreateDirectory")})]})]}),n.jsxs("section",{className:"workbench-directory-browser-panel",children:[n.jsxs("div",{className:"workbench-directory-browser-section",children:[n.jsx("span",{className:"workbench-directory-browser-section-title",children:o("shell.importBrowserRoots")}),n.jsx("div",{className:"workbench-directory-browser-root-list",children:N.map(U=>n.jsx("button",{type:"button",className:"workbench-directory-browser-chip",disabled:F,onClick:()=>{te(U.path)},children:U.name},U.path))})]}),n.jsx("div",{className:"workbench-directory-browser-current-path",children:w}),v?n.jsx("p",{className:"workbench-directory-browser-status status-text","data-tone":"error",children:v}):null,i?n.jsx("p",{className:"workbench-directory-browser-status status-text",children:o("common.loading")}):H.length>0?n.jsx("div",{className:"workbench-directory-browser-list",children:H.map(U=>n.jsxs("button",{type:"button",className:"workbench-directory-browser-item",disabled:F,onClick:()=>{te(U.path)},children:[n.jsx("span",{className:"workbench-directory-browser-item-name",children:U.name}),n.jsx("span",{className:"workbench-directory-browser-item-path",children:U.path})]},U.path))}):n.jsx("p",{className:"workbench-directory-browser-status status-text",children:o("shell.importBrowserEmpty")})]}),n.jsxs("div",{className:"workbench-modal-actions",children:[n.jsx("button",{type:"button",className:"secondary-button",disabled:F,onClick:E,children:o("common.cancel")}),n.jsx("button",{type:"button",className:"primary-button",disabled:F||!w,onClick:()=>{q()},children:o(m?"shell.importSubmitting":"shell.importBrowserSubmit")})]})]}),n.jsx(Fn,{open:e&&I,title:o("shell.importBrowserCreateDirectoryTitle"),description:o("shell.importBrowserCreateDirectoryDescription"),onClose:K,children:n.jsxs("form",{className:"workbench-rename-form",onSubmit:U=>void G(U),children:[n.jsx("div",{className:"workbench-directory-browser-current-path",children:w}),n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("shell.importBrowserCreateDirectoryLabel")}),n.jsx("input",{type:"text",value:L,placeholder:o("shell.importBrowserCreateDirectoryPlaceholder"),autoFocus:!0,onChange:U=>_(U.target.value)})]}),n.jsxs("div",{className:"workbench-modal-actions",children:[n.jsx("button",{type:"button",className:"secondary-button",disabled:c,onClick:K,children:o("common.cancel")}),n.jsx("button",{type:"submit",className:"primary-button",disabled:c||!L.trim(),children:o(c?"shell.importBrowserCreatingDirectory":"shell.importBrowserCreateDirectorySubmit")})]})]})})]})}function e2({onOpenSoftwareUpdate:e}){var s;const t=Ya(i=>i.platform),r=FN(i=>i.latestState);return t!=="desktop"||!(r!=null&&r.hasUpdate)?null:n.jsx("button",{className:"workbench-nav-update-badge",type:"button",title:((s=r.manifest)==null?void 0:s.version)??o("settings.releaseUpdateReady"),onClick:e,children:n.jsx("span",{className:"workbench-nav-update-badge-label",children:o("settings.releaseUpdateBadge")})})}const Qx="workbench.left.width",Jx="workbench.right.width",Zx="workbench.left.collapsed",eS="workbench.right.collapsed",Cf="workbench.last.session.path",jf="workbench.workspace.selected.id",tS="workbench.notifications.seen_at",t2=280,n2=320,Bd=208,nS=520,rS=560,r2=200,Tf=20,Sc=40,Wd=5,s2=3e4,i2=12,sS=60*1e3,a2=4e3,iS=220,aS=18,o2=6,l2="workbench:focus-composer",c2=new Set(["starting","running","reconnecting","stale","unknown"]),u2=["#34C759","#22C55E","#14B8A6","#06B6D4","#0EA5E9","#3B82F6","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899","#F43F5E","#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#10B981"],d2=["--workbench-titlebar-live-content-shift-y","--workbench-nav-toolbar-live-shift-y","--workbench-info-tabs-live-shift-y","--workbench-auxiliary-toolbar-button-live-shift-y","--workbench-conversation-header-main-live-shift-y","--workbench-conversation-header-actions-live-shift-y","--workbench-terminal-tabbar-live-shift-y","--workbench-collapsed-controls-live-shift-y","--workbench-collapsed-left-controls-live-shift-y","--workbench-collapsed-right-controls-live-shift-y"],dr={navToolbar:{selector:".workbench-nav-toolbar",variableName:"--workbench-nav-toolbar-live-shift-y"},infoTabs:{selector:".workbench-info-tabs",variableName:"--workbench-info-tabs-live-shift-y"},auxiliaryToolbarButton:{selector:".workbench-auxiliary-header > .workbench-nav-toolbar-button",variableName:"--workbench-auxiliary-toolbar-button-live-shift-y"},conversationHeaderMain:{selector:".conversation-header-main",variableName:"--workbench-conversation-header-main-live-shift-y"},conversationHeaderActions:{selector:".conversation-header-actions",variableName:"--workbench-conversation-header-actions-live-shift-y"},terminalTabbarMain:{selector:".terminal-tabbar-main",variableName:"--workbench-terminal-tabbar-live-shift-y"},collapsedLeftControls:{selector:'.workbench-collapsed-controls.left[data-visible="true"] .workbench-nav-toolbar-button',variableName:"--workbench-collapsed-left-controls-live-shift-y"},collapsedRightControls:{selector:'.workbench-collapsed-controls.right[data-visible="true"] .workbench-nav-toolbar-button',variableName:"--workbench-collapsed-right-controls-live-shift-y"}};function sD(e,t){const r=e.getPropertyValue(t).trim();if(!r)return null;const s=Number.parseFloat(r);return Number.isFinite(s)?s:null}function h2(e){return Math.round(e*100)/100}function m2(e,t){const r=t.getBoundingClientRect();if(r.width<=0||r.height<=0)return null;const s=window.getComputedStyle(t);return s.display==="none"||s.visibility==="hidden"?null:r.top-e.top+r.height/2}function _a(e,t){const r=e.getBoundingClientRect(),i=Array.from(e.querySelectorAll(t)).map(l=>m2(r,l)).filter(l=>l!==null);return i.length===0?null:i.reduce((l,c)=>l+c,0)/i.length}function Fi(e,t,r){const s=e.style.getPropertyValue(t).trim();if(r===null||!Number.isFinite(r)){s&&e.style.removeProperty(t);return}const i=`${h2(r)}px`;s!==i&&e.style.setProperty(t,i)}function _i(e,t,r,s){return s===null?null:(sD(e,t)??0)+(r-s)}function oS(e){if(e)for(const t of d2)e.style.removeProperty(t)}function p2(e){return c2.has(e.runningState??"idle")||e.activityState==="running"}function f2(e){var i,l;const t=((i=e.lastErrorCode)==null?void 0:i.trim())??"",r=((l=e.lastErrorDetail)==null?void 0:l.trim())??"",s=[t,r].filter(c=>c.length>0).join(" · ");return s?s.length<=iS?s:`${s.slice(0,iS-3)}...`:null}function g2(e,t,r){var l,c,d,m,f,v,g,w,k,y,S,T;const s=new Map(e.projects.map(j=>[j.id,j.workspaceId])),i=[];for(const j of r){const N=j.title.trim()||j.projectName;if(j.assistantState.lifecycleStage==="analyzed"&&!((l=j.assistantState.linkedSessionId)!=null&&l.trim())&&j.assistantState.lastAnalyzedAt){i.push({id:`todo-analysis-completed:${j.id}:${j.assistantState.lastAnalyzedAt}`,kind:"todo_analyzed",title:o("shell.globalNotificationTodoAnalyzedTitle",{title:N}),body:((c=j.assistantState.analysisSummary)==null?void 0:c.trim())||((d=j.assistantState.generatedPrompt)==null?void 0:d.trim())||j.content,routePath:$i(j.workspaceId),workspaceId:j.workspaceId,createdAt:j.assistantState.lastAnalyzedAt});continue}j.assistantState.lifecycleStage==="failed"&&i.push({id:`todo-analysis-failed:${j.id}:${j.updatedAt}`,kind:"todo_analyze_failed",title:o("shell.globalNotificationTodoAnalyzeFailedTitle",{title:N}),body:((m=j.assistantState.lastError)==null?void 0:m.trim())||j.content,routePath:$i(j.workspaceId),workspaceId:j.workspaceId,createdAt:j.updatedAt})}for(const j of t){const N=((f=j.sessionTitle)==null?void 0:f.trim())||j.projectName,D=j.updatedAt||j.lastAutomationAt||j.createdAt;if(j.status==="waiting_user"){i.push({id:`follow-up-waiting:${j.id}`,kind:"follow_up_waiting_user",title:o("shell.globalNotificationFollowUpWaitingTitle",{title:N}),body:((v=j.waitingReason)==null?void 0:v.trim())||((g=j.lastAutomationSummary)==null?void 0:g.trim())||j.objective,routePath:Yn(j.workspaceId,j.sessionId),workspaceId:j.workspaceId,createdAt:D});continue}if(j.status==="completed"){i.push({id:`follow-up-completed:${j.id}`,kind:"follow_up_completed",title:o("shell.globalNotificationFollowUpCompletedTitle",{title:N}),body:((w=j.lastAutomationSummary)==null?void 0:w.trim())||j.objective,routePath:Yn(j.workspaceId,j.sessionId),workspaceId:j.workspaceId,createdAt:D});continue}j.status==="failed"&&i.push({id:`follow-up-failed:${j.id}`,kind:"follow_up_failed",title:o("shell.globalNotificationFollowUpFailedTitle",{title:N}),body:((k=j.lastAutomationSummary)==null?void 0:k.trim())||((y=j.waitingReason)==null?void 0:y.trim())||j.objective,routePath:Yn(j.workspaceId,j.sessionId),workspaceId:j.workspaceId,createdAt:D})}for(const j of e.verifications){if(j.status!=="failed")continue;const N=j.projectId?s.get(j.projectId)??null:null,D=((S=j.targetRef)==null?void 0:S.trim())||j.verificationType;i.push({id:`verification-failed:${j.id}`,kind:"verification_failed",title:o("shell.globalNotificationVerificationFailedTitle",{title:D}),body:((T=j.summary)==null?void 0:T.trim())||o("shell.globalNotificationVerificationFailedFallback"),routePath:N?$i(N):null,workspaceId:N,createdAt:j.finishedAt||j.startedAt||j.createdAt})}return i.sort((j,N)=>{const D=lS(j.kind)-lS(N.kind);return D!==0?D:Ka(N.createdAt)-Ka(j.createdAt)}).slice(0,i2)}function lS(e){switch(e){case"follow_up_waiting_user":return 0;case"todo_analyze_failed":return 1;case"follow_up_failed":return 2;case"verification_failed":return 3;case"todo_analyzed":return 4;case"follow_up_completed":return 5;default:return 9}}function b2(e){switch(e){case"follow_up_waiting_user":return o("shell.globalNotificationKindWaitingUser");case"todo_analyzed":return o("shell.globalNotificationKindTodoAnalyzed");case"todo_analyze_failed":return o("shell.globalNotificationKindTodoAnalyzeFailed");case"follow_up_completed":return o("shell.globalNotificationKindFollowUpCompleted");case"follow_up_failed":return o("shell.globalNotificationKindFollowUpFailed");case"verification_failed":return o("shell.globalNotificationKindVerificationFailed");default:return o("shell.globalNotificationsPanelTitle")}}function Ka(e){if(!e)return 0;const t=new Date(e).getTime();return Number.isNaN(t)?0:t}function v2(e){return/^(?:[A-Za-z0-9_-]+)(?:\/[A-Za-z0-9_-]+)*$/.test(e)}function w2(e){return/^(?:[A-Za-z0-9_-]+(?:\/[A-Za-z0-9_-]+)*\/?)?$/.test(e)}function y2(e,t){const r=new Set,s=(e==null?void 0:e.currentBranch)??"",i=((e==null?void 0:e.local)??[]).slice().sort((d,m)=>Number(m.current)-Number(d.current)||d.name.localeCompare(m.name)).map(d=>({value:d.name,current:d.current,recommended:d.name===s})).filter(d=>!d.value||r.has(d.value)?!1:(r.add(d.value),!0)),l=((e==null?void 0:e.remote)??[]).map(d=>({value:d.name})).filter(d=>!d.value||r.has(d.value)?!1:(r.add(d.value),!0)),c=t.map(d=>({value:d.name})).filter(d=>!d.value||r.has(d.value)?!1:(r.add(d.value),!0));return{localBranches:i,remoteBranches:l,tags:c}}function k2(e){return e.getBoundingClientRect()}function x2(e,t){return t?Ka(e.createdAt)>Ka(t):!0}function S2(e){const t=new Date(e);return Number.isNaN(t.getTime())?e:new Intl.DateTimeFormat(void 0,{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(t)}function cS(e,t){var c,d;const r=["/workspaces/:workspaceId","/workspaces/:workspaceId/sessions","/workspaces/:workspaceId/sessions/:sessionId","/workspaces/:workspaceId/tools","/workspaces/:workspaceId/tools/files","/workspaces/:workspaceId/tools/git","/workspaces/:workspaceId/tools/processes","/workspaces/:workspaceId/terminals","/workspaces/:workspaceId/butler"];for(const m of r){const f=Wr(m,e),v=(c=f==null?void 0:f.params.workspaceId)==null?void 0:c.trim();if(v)return v}const s=Vc(e),i=(s==null?void 0:s.sessionId)??null;return!i||!MD(i)?null:((d=new URLSearchParams(t).get("workspaceId"))==null?void 0:d.trim())||null}function C2(e){return e.startsWith("/sessions")||e.startsWith("/terminals")||e.startsWith("/tools")}function j2(e){return e==="mobile"?As():"/landing"}function Vc(e){var l,c,d;const t=Wr("/workspaces/:workspaceId/sessions/:sessionId",e),r=(l=t==null?void 0:t.params.sessionId)==null?void 0:l.trim();if(r)return{sessionId:r,workspaceId:((c=t==null?void 0:t.params.workspaceId)==null?void 0:c.trim())??null};const s=Wr("/sessions/:sessionId",e),i=(d=s==null?void 0:s.params.sessionId)==null?void 0:d.trim();return i?{sessionId:i,workspaceId:null}:null}function T2(e){return!!(Wr("/sessions",e)||Wr("/workspaces/:workspaceId/sessions",e))}function uS(e){return!!Vc(e)}function N2(e){return!!(Wr("/tools",e)||Wr("/tools/files",e)||Wr("/tools/git",e)||Wr("/tools/processes",e)||Wr("/workspaces/:workspaceId/tools",e)||Wr("/workspaces/:workspaceId/tools/files",e)||Wr("/workspaces/:workspaceId/tools/git",e)||Wr("/workspaces/:workspaceId/tools/processes",e))}function dS(e){return!!(Wr("/terminals",e)||Wr("/workspaces/:workspaceId/terminals",e))}function Nf(e){return!!Wr("/workspaces/:workspaceId/butler",e)}function P2(e){return e.trim().replace(/\\/g,"/").replace(/^(?:\.\/)+/,"").replace(/^\/+/,"")}const D2=p.lazy(async()=>({default:(await _l(()=>Promise.resolve().then(()=>D8),void 0)).FileContextPanel})),R2=p.lazy(async()=>({default:(await _l(()=>Promise.resolve().then(()=>q8),void 0)).GitSidebar})),A2=p.lazy(async()=>({default:(await _l(()=>Promise.resolve().then(()=>ZG),void 0)).TerminalManagerPanel}));function M2(e){return!!((e==null?void 0:e.item)??(e==null?void 0:e.session))}function Si(e){return Gi(e)}function I2(e){return e&&"item"in e?e.item:(e==null?void 0:e.session)??null}function Oc(e){return Array.isArray(e==null?void 0:e.visibleSessionTree)?e.visibleSessionTree.filter(M2):[]}async function iD(e,t){const r=await zl(t,e);if(r.canStartSession===!1)throw new Error(r.limitations[0]??o("conversation.capabilityDenied"))}const aD=p.createContext(null);function sb(e){return ba(e)}function Vi(e){return e.isArchived===!0}function xm(e){var t;return((t=e.parentSessionId)==null?void 0:t.trim())||null}function Ov(e,t){return $N(e,{getId:r=>r.sessionId,getParentId:xm,compare:(r,s)=>Ev(r,s,t)})}function oD(e){return e.filter(t=>{if(Vi(t))return!1;const r=xm(t);if(!r)return!0;const s=e.find(i=>i.sessionId===r);return!s||!Vi(s)})}function E2(e){return e.flatMap(t=>{const r=I2(t);return r?[r,...VN(Si(t))]:[]})}function L2(e,t,r){const s=new Set(li(Si(e)).sort((i,l)=>Ev(i.item,l.item,r)).slice(0,t).map(i=>i.item.sessionId));return{...e,children:lD(Si(e),s)}}function lD(e,t){return e.flatMap(r=>{const s=lD(Si(r),t);return!t.has(r.item.sessionId)&&s.length===0?[]:[{...r,children:s}]})}function Ud(e,t,r,s=-1){if(e<=0)return 0;const i=s>=0?Math.max(t,s+1):t;return Math.min(e,Math.max(r??0,i))}function hS(e,t){const r=Object.keys(e),s=Object.keys(t);return r.length!==s.length?!1:r.every(i=>e[i]===t[i])}function F2(e){const t=e.lastMessageAt??e.updatedAt;return t?new Date(t).toLocaleDateString():""}function _2(e){return Du(e)||e.syncStatus==="error"}function O2(e){var s,i;if(!_2(e))return null;const t=((s=e.lastErrorCode)==null?void 0:s.trim())??"",r=((i=e.lastErrorDetail)==null?void 0:i.replace(/\s+/g," ").trim())??"";return t&&r&&!r.includes(t)?`${t} · ${r}`:r||t||(e.syncStatus==="error"&&!Du(e)?o("conversation.syncStatusError"):o("conversation.runtimeErrorTitle"))}function B2(e,t=110){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1)).trimEnd()}…`}function Sm(e,t="compact"){return Vs(e,t)}const W2={position:"relative",zIndex:0},U2={zIndex:1};function cD(e,t,r,s){const i=[],l=(s==null?void 0:s.trim())||t.name;r&&i.push(l);const c=F2(e);return c&&i.push(c),i.join(" · ")||l}function mS(e,t){return Av("session-state-indicator",e,t)}function H2(e,t){return _P(e,t)}function pS(e,t){try{const r=window.localStorage.getItem(e),s=r?Number(r):Number.NaN;return Number.isFinite(s)?s:t}catch{return t}}function fS(e,t){try{const r=window.localStorage.getItem(e);return r===null?t:r==="true"}catch{return t}}function gS(e){var t;try{const r=(t=window.localStorage.getItem(e))==null?void 0:t.trim();return r||null}catch{return null}}function ko(e,t){try{window.localStorage.setItem(e,t)}catch{}}function z2(e){try{window.localStorage.removeItem(e)}catch{}}function Hd(e,t,r){return Math.max(t,Math.min(r,e))}function q2(e){return e instanceof HTMLElement?e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement||!!e.closest("[contenteditable='true']"):!1}function $2(){typeof window>"u"||window.dispatchEvent(new CustomEvent(l2))}function uD(e,t){const r=t==null?void 0:t.trim();if(!r)return null;for(const s of e){if(s.workspace.id===r)return s;const i=uD(s.children,r);if(i)return i}return null}function V2(e,t){const r=t==null?void 0:t.trim();if(!r)return null;for(const s of e){const i=uD(s.childWorktrees,r);if(i)return i}return null}function bS(e){return!e||!Array.isArray(e.items)?[]:e.items.filter(t=>{var r;return t.collapsed===!0&&((r=t.workspace)==null?void 0:r.id)}).map(t=>t.workspace.id)}function Pf(e,t){const r=new Set(t);return{items:e.map(s=>({workspace:s.workspace,sessions:s.sessions,childWorktrees:s.childWorktrees,collapsed:r.has(s.workspace.id)}))}}function dD(e,t,r){return e.map(s=>{const i=oD(s.sessions);return{workspace:s.workspace,meta:s.meta,visibleSessions:i,archivedSessions:s.sessions.filter(l=>Vi(l)&&!xm(l)),visibleSessionTree:Ov(i,r).filter(l=>!t.has(l.item.sessionId)&&!pm(Si(l),c=>t.has(c.sessionId))),children:dD(s.children,t,r)}})}function ib(e){return e.flatMap(t=>[t.workspace.id,...ib(t.children)])}function Bc(e){return e.flatMap(t=>[...t.visibleSessionTree,...Bc(t.children)])}function G2(e,t){if(!t)return null;for(const r of e){if(r.workspace.id===t)return{workspace:r.workspace,visibleSessionTree:Oc(r)};const s=mD(r.childWorktrees,t);if(s)return s}return null}function hD(e,t){for(const r of e){const s=li(r.visibleSessionTree).find(l=>l.item.sessionId===t);if(s)return s;const i=hD(r.children,t);if(i)return i}return null}function mD(e,t){for(const r of e){if(r.workspace.id===t)return{workspace:r.workspace,visibleSessionTree:r.visibleSessionTree};const s=mD(r.children,t);if(s)return s}return null}function K2(e,t){if(!t)return null;for(const r of e){if(r.workspace.id===t)return{workspace:r.workspace,archivedSessions:r.archivedSessions};const s=pD(r.childWorktrees,t);if(s)return s}return null}function vS(e,t){if(!t)return null;for(const r of e){if(r.workspace.id===t)return r.workspace;const s=fD(r.childWorktrees,t);if(s)return s}return null}function pD(e,t){for(const r of e){if(r.workspace.id===t)return{workspace:r.workspace,archivedSessions:r.archivedSessions};const s=pD(r.children,t);if(s)return s}return null}function fD(e,t){for(const r of e){if(r.workspace.id===t)return r.workspace;const s=fD(r.children,t);if(s)return s}return null}function gD(e,t){for(const r of e){if(r.workspace.id===t)return[r.workspace.id];const s=gD(r.children,t);if(s.length>0)return[r.workspace.id,...s]}return[]}function wS(e){return e.flatMap(t=>[t.workspace.id,...bD(t.childWorktrees)])}function bD(e){return e.flatMap(t=>[t.workspace.id,...bD(t.children)])}function Y2(e,t=[]){if(e.tone!=="worktree")return e.rootDisplayName;if(t.length>0)return t.join(" / ");const r=[e.rootDisplayName];return e.parentDisplayName&&e.parentDisplayName!==e.rootDisplayName&&r.push(e.parentDisplayName),r.join(" / ")}function X2(e,t,r,s){if(t===r)return e;const i=e.findIndex(f=>f.workspace.id===t),l=e.findIndex(f=>f.workspace.id===r);if(i<0||l<0)return e;const c=[...e],[d]=c.splice(i,1);if(!d)return e;const m=c.findIndex(f=>f.workspace.id===r);return m<0?e:(c.splice(s==="before"?m:m+1,0,d),c.every((f,v)=>{var g;return f.workspace.id===((g=e[v])==null?void 0:g.workspace.id)})?e:c)}function Q2(e,t){if(!Array.isArray(e.items)||t.size===0)return e;let r=!1;const s=e.items.map(i=>{let l=!1;const c=i.sessions.map(m=>{const f=t.get(m.sessionId);return f===void 0||Vi(m)===f?m:(r=!0,l=!0,{...m,isArchived:f})}),d=wD(i.childWorktrees??[],t,m=>{m&&(r=!0,l=!0)});return l?{...i,sessions:c,childWorktrees:d}:i});return r?{...e,items:s}:e}function J2(e,t){if(!(!Array.isArray(t.items)||e.size===0))for(const r of t.items){for(const s of r.sessions){const i=e.get(s.sessionId);i!==void 0&&Vi(s)===i&&e.delete(s.sessionId)}yD(e,r.childWorktrees??[])}}function Z2(e,t,r){let s=!1;const i=e.map(l=>{if(l.workspace.id!==t.workspaceId){const{nodes:m,changed:f}=kD(l.childWorktrees,t,r);return f?(s=!0,{...l,childWorktrees:m}):l}const c=l.sessions.findIndex(m=>m.sessionId===t.sessionId),d=c>=0?l.sessions.map((m,f)=>f===c?t:m):[t,...l.sessions];return s=!0,{...l,sessions:Au(d,r)}});return s?i:e}function eB(e,t,r){let s=!1;const i=e.map(l=>{let c=!1;const d=l.sessions.map(f=>f.sessionId!==t?f:(s=!0,c=!0,{...f,lastSeenAt:f.lastSeenAt&&f.lastSeenAt>r?f.lastSeenAt:r,activityState:f.activityState==="completed_unread"?"idle":f.activityState})),m=Cm(l.childWorktrees,f=>f.sessionId!==t?f:(s=!0,c=!0,{...f,lastSeenAt:f.lastSeenAt&&f.lastSeenAt>r?f.lastSeenAt:r,activityState:f.activityState==="completed_unread"?"idle":f.activityState}));return c?{...l,sessions:d,childWorktrees:m}:l});return s?i:e}function yS(e,t,r){let s=!1;const i=e.map(l=>{let c=!1;const d=l.sessions.map(f=>f.sessionId!==t||f.isArchived===r?f:(s=!0,c=!0,{...f,isArchived:r})),m=Cm(l.childWorktrees,f=>f.sessionId!==t||f.isArchived===r?f:(s=!0,c=!0,{...f,isArchived:r}));return c?{...l,sessions:d,childWorktrees:m}:l});return s?i:e}function kS(e,t,r){let s=!1;const i=e.map(l=>{let c=!1;const d=l.sessions.map(f=>f.sessionId!==t||f.isFavorite===!0===r?f:(s=!0,c=!0,{...f,isFavorite:r})),m=Cm(l.childWorktrees,f=>f.sessionId!==t||f.isFavorite===!0===r?f:(s=!0,c=!0,{...f,isFavorite:r}));return c?{...l,sessions:d,childWorktrees:m}:l});return s?i:e}function tB(e,t){return e.includes(t)?e.filter(r=>r!==t):[...e,t]}function nB(e){return e?e.slice(0,8):"--"}function xS(e,t,r){return r?e.includes(t)?e:[...e,t]:e.includes(t)?e.filter(s=>s!==t):e}function vD(e,t){const r=e.filter(s=>t.has(s));return r.length===e.length?e:r}function wD(e,t,r){return e.map(s=>{let i=!1;const l=s.sessions.map(d=>{const m=t.get(d.sessionId);return m===void 0||Vi(d)===m?d:(i=!0,{...d,isArchived:m})}),c=wD(s.children,t,d=>{d&&(i=!0)});return r(i),i?{...s,sessions:l,children:c}:s})}function yD(e,t){for(const r of t){for(const s of r.sessions){const i=e.get(s.sessionId);i!==void 0&&Vi(s)===i&&e.delete(s.sessionId)}yD(e,r.children)}}function kD(e,t,r){let s=!1;const i=e.map(l=>{if(l.workspace.id===t.workspaceId){const d=l.sessions.findIndex(f=>f.sessionId===t.sessionId),m=d>=0?l.sessions.map((f,v)=>v===d?t:f):[t,...l.sessions];return s=!0,{...l,sessions:Au(m,r)}}const c=kD(l.children,t,r);return c.changed?(s=!0,{...l,children:c.nodes}):l});return{nodes:s?i:[...e],changed:s}}function rB(e,t){return e.map(r=>({...r,sessions:Au(r.sessions,t),childWorktrees:Lv(r.childWorktrees,t)}))}function Cm(e,t){let r=!1;const s=e.map(i=>{let l=!1;const c=i.sessions.map(m=>{const f=t(m);return f!==m&&(l=!0,r=!0),f}),d=Cm(i.children,t);return d!==i.children&&(l=!0,r=!0),l?{...i,sessions:c,children:d}:i});return r?s:[...e]}function ab(e){return`workspace-management.summary.${e}`}function xD(e){return`git-sidebar.snapshot.${e}`}function SD(e,t){const r=e.repoRoot??null;return{workspaceId:e.id,name:e.name,path:e.path,git:{isRepository:!!r,repoRoot:r,currentBranch:null,commitCount:null,remotes:[],error:null},codeComposition:{scannedFileCount:0,truncated:!1,items:[],error:null}}}function CD(e,t){const r=e.git.repoRoot??t.repoRoot??null;return{...e,workspaceId:t.id,name:t.name,path:t.path,git:{...e.git,isRepository:e.git.isRepository||!!r,repoRoot:r}}}function jD(e,t){var i,l,c;const r=((i=t.status)==null?void 0:i.snapshot.repoRoot)??e.git.repoRoot,s=((l=t.status)==null?void 0:l.snapshot.branch)??((c=t.branches)==null?void 0:c.currentBranch)??e.git.currentBranch??null;return{...e,git:{...e.git,isRepository:e.git.isRepository||!!r,repoRoot:r,currentBranch:s,error:null}}}function TD({count:e,className:t="workbench-skeleton-lines"}){return n.jsx("div",{className:t,"aria-hidden":"true",children:Array.from({length:e},(r,s)=>n.jsx("span",{className:"skeleton-line"},s))})}function sB(){return n.jsx("div",{className:"workbench-nav-loading","aria-hidden":"true",children:Array.from({length:3},(e,t)=>n.jsxs("section",{className:"workbench-skeleton-card",children:[n.jsxs("div",{className:"workbench-skeleton-heading",children:[n.jsx("span",{className:"skeleton-line short"}),n.jsx("span",{className:"skeleton-line tiny"})]}),n.jsx("div",{className:"workbench-skeleton-list",children:Array.from({length:3},(r,s)=>n.jsxs("div",{className:"workbench-skeleton-session",children:[n.jsx("span",{className:"workbench-skeleton-dot"}),n.jsx(TD,{count:2,className:"workbench-skeleton-lines compact"})]},s))})]},t))})}function zd(){return n.jsx("section",{className:"workbench-info-skeleton","aria-hidden":"true",children:Array.from({length:4},(e,t)=>n.jsxs("article",{className:"workbench-info-skeleton-card",children:[n.jsx("span",{className:"skeleton-line short"}),n.jsx(TD,{count:3})]},t))})}function iB({side:e,collapsed:t}){const r=e==="left"?8.5:15.5,s=e==="left"?t?"12 9 15 12 12 15":"15 9 12 12 15 15":t?"12 9 9 12 12 15":"9 9 12 12 9 15";return n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),n.jsx("line",{x1:r,y1:"4",x2:r,y2:"20"}),n.jsx("polyline",{points:s})]})}function SS({ariaLabel:e,side:t,collapsed:r,className:s="panel-icon-button",onClick:i}){return n.jsx("button",{className:s,type:"button","aria-label":e,title:e,onClick:i,children:n.jsx(iB,{side:t,collapsed:r})})}function Wc({expanded:e}){return n.jsx("svg",{className:e?"workbench-chevron":"workbench-chevron collapsed",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:n.jsx("polyline",{points:"6 9 12 15 18 9"})})}function aB(){return n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),n.jsx("polyline",{points:"7 10 12 15 17 10"}),n.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]})}function oB(){return n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[n.jsx("rect",{x:"4",y:"5",width:"16",height:"14",rx:"2"}),n.jsx("line",{x1:"8",y1:"10",x2:"16",y2:"10"}),n.jsx("line",{x1:"8",y1:"14",x2:"12",y2:"14"}),n.jsx("circle",{cx:"17.5",cy:"15.5",r:"2.5"})]})}function lB(){return n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[n.jsx("path",{d:"M7.5 10.2a4.5 4.5 0 1 1 9 0v3.1c0 .8.3 1.6.9 2.2l.8.8H5.8l.8-.8c.6-.6.9-1.4.9-2.2z",strokeLinecap:"round",strokeLinejoin:"round"}),n.jsx("path",{d:"M10 18.5a2 2 0 0 0 4 0",strokeLinecap:"round"})]})}function ND(e){return n.jsx("div",{className:"workbench-notification-anchor",children:n.jsxs("button",{type:"button",className:e.collapsed?"workbench-nav-toolbar-button workbench-collapsed-button":"workbench-nav-toolbar-button","aria-label":o("shell.globalNotificationsAction"),title:o("shell.globalNotificationsAction"),"aria-expanded":e.open,onClick:e.onToggle,children:[n.jsx(lB,{}),e.unreadCount>0?n.jsx("span",{className:"workbench-notification-badge","aria-label":o("shell.globalNotificationsUnreadAria",{count:String(e.unreadCount)}),children:e.unreadCount>99?"99+":e.unreadCount}):null]})})}function cB(e){const[t,r]=p.useState("notifications");p.useEffect(()=>{e.open&&r("notifications")},[e.open]);const s=p.useMemo(()=>e.notifications.filter(i=>e.showArchivedNotifications||!e.archivedNotificationIds.has(i.id)),[e.archivedNotificationIds,e.notifications,e.showArchivedNotifications]);return n.jsxs(Fn,{open:e.open,title:o("shell.globalNotificationsPanelTitle"),description:o("shell.globalNotificationsPanelDescription"),className:"workbench-notification-modal-card workspace-inbox-modal-card",showCloseButton:!1,onClose:e.onClose,children:[n.jsxs("div",{className:"workbench-notification-tabs",role:"tablist","aria-label":o("shell.globalNotificationsPanelTitle"),children:[n.jsx("button",{type:"button",className:t==="notifications"?"workbench-notification-tab active":"workbench-notification-tab",role:"tab","aria-selected":t==="notifications",onClick:()=>r("notifications"),children:o("shell.globalNotificationsAction")}),n.jsx("button",{type:"button",className:t==="inbox"?"workbench-notification-tab active":"workbench-notification-tab",role:"tab","aria-selected":t==="inbox",onClick:()=>r("inbox"),children:o("shell.butlerInboxAction")})]}),n.jsx("div",{className:"workbench-notification-content","data-tab":t,children:t==="notifications"?n.jsxs("div",{className:"workbench-notification-pane",role:"tabpanel","aria-label":o("shell.globalNotificationsAction"),children:[n.jsx("div",{className:"workbench-notification-toolbar",children:n.jsxs("label",{className:"workbench-notification-filter",children:[n.jsx("input",{type:"checkbox",checked:e.showArchivedNotifications,onChange:i=>e.onToggleShowArchivedNotifications(i.target.checked)}),n.jsx("span",{children:o("shell.globalNotificationsShowArchived")})]})}),s.length>0?n.jsx("div",{className:"workbench-notification-list",children:s.map(i=>{const l=e.archivedNotificationIds.has(i.id);return n.jsxs("article",{className:"workbench-notification-item","data-archived":l,children:[n.jsxs("button",{type:"button",className:"workbench-notification-item-content",onClick:()=>{e.onSelectNotification(i)},children:[n.jsx("span",{className:"workbench-notification-item-kind",children:b2(i.kind)}),n.jsx("strong",{children:i.title}),n.jsx("p",{children:i.body})]}),n.jsxs("div",{className:"workbench-notification-item-side",children:[n.jsx("time",{children:S2(i.createdAt)}),n.jsx("button",{type:"button",className:"secondary-button workbench-notification-item-action-button",onClick:()=>{if(l){e.onUnarchiveNotification(i.id);return}e.onArchiveNotification(i.id)},children:o(l?"shell.globalNotificationsRemoveArchiveAction":"shell.globalNotificationsArchiveAction")})]})]},i.id)})}):n.jsx("p",{className:"workbench-notification-empty",children:o("shell.globalNotificationsEmpty")})]}):n.jsx("div",{className:"workbench-notification-pane",role:"tabpanel","aria-label":o("shell.butlerInboxAction"),children:n.jsx(nD,{active:e.open&&t==="inbox",preferredWorkspaceId:e.preferredWorkspaceId,preferredSessionId:e.preferredSessionId})})}),n.jsx("div",{className:"workbench-modal-actions workbench-notification-footer-actions",children:n.jsx("button",{type:"button",className:"secondary-button",onClick:e.onClose,children:o("common.close")})})]})}function uB(){return n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),n.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}function dB(){return n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("circle",{cx:"11",cy:"11",r:"7"}),n.jsx("line",{x1:"20",y1:"20",x2:"16.65",y2:"16.65"})]})}function hB(){return n.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:n.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H8l-5 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}function mB(){return n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:[n.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),n.jsx("path",{d:"M7 9l3 3-3 3"}),n.jsx("path",{d:"M13 15h4"})]})}function pB(){return n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:[n.jsx("rect",{x:"4",y:"5",width:"16",height:"14",rx:"3"}),n.jsx("circle",{cx:"9",cy:"11",r:"1"}),n.jsx("circle",{cx:"15",cy:"11",r:"1"}),n.jsx("path",{d:"M8 15h8"}),n.jsx("path",{d:"M12 5V3"})]})}function PD(){return n.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:n.jsx("polyline",{points:"15 18 9 12 15 6"})})}function DD(){return n.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:n.jsx("polyline",{points:"9 18 15 12 9 6"})})}function RD(){return n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),n.jsx("line",{x1:"9",y1:"4",x2:"9",y2:"20"}),n.jsx("polyline",{points:"14 9 11 12 14 15"})]})}function fB(){return n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[n.jsx("circle",{cx:"18",cy:"6",r:"3"}),n.jsx("circle",{cx:"6",cy:"6",r:"3"}),n.jsx("circle",{cx:"18",cy:"18",r:"3"}),n.jsx("path",{d:"M6 9v6a3 3 0 0 0 3 3h3"}),n.jsx("line",{x1:"18",y1:"9",x2:"18",y2:"15"})]})}function gB(){return n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[n.jsx("circle",{cx:"12",cy:"12",r:"3"}),n.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09a1.65 1.65 0 0 0-1-1.51 1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06A1.65 1.65 0 0 0 4.6 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09a1.65 1.65 0 0 0 1.51-1 1.65 1.65 0 0 0-.33-1.82L4.21 7.1a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06A1.65 1.65 0 0 0 8.92 4a1.65 1.65 0 0 0 1-1.51V2.4a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9c0 .66.39 1.25 1 1.51h.09a2 2 0 0 1 0 4h-.09c-.61.26-1 .85-1 1.49z"})]})}function bB(){return n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[n.jsx("rect",{x:"4",y:"5",width:"6",height:"6",rx:"1.5"}),n.jsx("rect",{x:"14",y:"5",width:"6",height:"6",rx:"1.5"}),n.jsx("rect",{x:"4",y:"13",width:"6",height:"6",rx:"1.5"}),n.jsx("path",{d:"M14 16l2 2 4-4"})]})}function vB(){return n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[n.jsx("rect",{x:"4",y:"6",width:"10",height:"12",rx:"2"}),n.jsx("path",{d:"M10 12h8"}),n.jsx("path",{d:"M15 8l4 4-4 4"})]})}function wB({selected:e}){return e?n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"4"}),n.jsx("path",{d:"M8 12.5l2.8 2.8L16.5 9.5"})]}):n.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:n.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"4"})})}function AD({active:e,className:t}){return e?n.jsx("svg",{className:t,width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",stroke:"currentColor",strokeWidth:"1.5",children:n.jsx("polygon",{points:"12 3 15 9 22 10 17 15 18 22 12 18 6 22 7 15 2 10 9 9"})}):n.jsx("svg",{className:t,width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:n.jsx("polygon",{points:"12 3 15 9 22 10 17 15 18 22 12 18 6 22 7 15 2 10 9 9"})})}function yB(){return n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[n.jsx("path",{d:"M3 7h18"}),n.jsx("path",{d:"M5 7l1 12h12l1-12"}),n.jsx("path",{d:"M9 11h6"}),n.jsx("path",{d:"M8 4h8l1 3H7l1-3z"})]})}function kB(){return n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[n.jsx("path",{d:"M12 20h9"}),n.jsx("path",{d:"M16.5 3.5a2.12 2.12 0 1 1 3 3L7 19l-4 1 1-4 12.5-12.5z"})]})}function xB(){return n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[n.jsx("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z"}),n.jsx("path",{d:"M9 13h6"})]})}function SB(){return n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:[n.jsx("circle",{cx:"12",cy:"12",r:"9"}),n.jsx("path",{d:"M9.7 9.4a2.5 2.5 0 1 1 4.1 2c-.8.7-1.8 1.2-1.8 2.6",strokeLinecap:"round"}),n.jsx("circle",{cx:"12",cy:"17.2",r:"1",fill:"currentColor",stroke:"none"})]})}function CB({open:e,mode:t,keyword:r,codeWorkspaceId:s,codeResults:i,codeLoading:l,codeError:c,workspaceOptions:d,sessionResults:m,onClose:f,onModeChange:v,onKeywordChange:g,onCodeWorkspaceChange:w,onCodeSearch:k,onOpenSession:y}){const S=r.trim().length>0&&s.trim().length>0;return n.jsx(Fn,{open:e,title:o("shell.searchModalTitle"),description:o("shell.searchModalDescription"),onClose:f,children:n.jsxs("div",{className:"workbench-search-modal",children:[n.jsxs("div",{className:"workbench-search-mode-switch",role:"tablist","aria-label":o("shell.searchModeLabel"),children:[n.jsx("button",{type:"button",className:t==="sessions"?"workbench-search-mode-button active":"workbench-search-mode-button",role:"tab","aria-selected":t==="sessions",onClick:()=>v("sessions"),children:o("shell.searchModeSessions")}),n.jsx("button",{type:"button",className:t==="code"?"workbench-search-mode-button active":"workbench-search-mode-button",role:"tab","aria-selected":t==="code",onClick:()=>v("code"),children:o("shell.searchModeCode")})]}),t==="sessions"?n.jsxs(n.Fragment,{children:[n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("shell.searchKeywordLabel")}),n.jsx("input",{type:"text",value:r,placeholder:o("shell.searchSessionPlaceholder"),autoFocus:!0,onChange:T=>g(T.target.value)})]}),n.jsx("div",{className:"workbench-search-results",children:r.trim().length===0?n.jsx("p",{className:"workbench-search-empty",children:o("shell.searchSessionHint")}):m.length>0?m.map(T=>{const j=Ki(T.session.title,o("common.unknown"));return n.jsxs("button",{type:"button",className:"workbench-search-result-item",onClick:()=>y(T.session.sessionId),children:[n.jsx("span",{className:"workbench-search-result-title",title:j.fullTitle,children:j.displayTitle}),n.jsxs("span",{className:"workbench-search-result-meta",children:[T.workspace.name," · ",Sm(T.session.provider,"full")]})]},T.session.sessionId)}):n.jsx("p",{className:"workbench-search-empty",children:o("shell.searchSessionEmpty")})})]}):n.jsxs(n.Fragment,{children:[n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("shell.searchWorkspaceLabel")}),n.jsx("select",{value:s,onChange:T=>w(T.target.value),children:d.map(T=>n.jsx("option",{value:T.id,children:T.name},T.id))})]}),n.jsxs("form",{className:"workbench-search-code-form",onSubmit:T=>{T.preventDefault(),k()},children:[n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("shell.searchKeywordLabel")}),n.jsx("input",{type:"text",value:r,placeholder:o("shell.searchCodePlaceholder"),autoFocus:!0,onChange:T=>g(T.target.value)})]}),n.jsx("button",{type:"submit",className:"primary-button",disabled:!S||l,children:o(l?"common.loading":"shell.searchSubmit")})]}),n.jsxs("div",{className:"workbench-search-results",children:[c?n.jsx("p",{className:"status-text","data-tone":"error",children:c}):null,!c&&r.trim().length===0?n.jsx("p",{className:"workbench-search-empty",children:o("shell.searchCodeHint")}):null,!c&&r.trim().length>0&&!l&&i.length===0?n.jsx("p",{className:"workbench-search-empty",children:o("shell.searchCodeEmpty")}):null,i.map(T=>n.jsxs("div",{className:"workbench-search-result-item static",children:[n.jsx("span",{className:"workbench-search-result-title",children:T.name}),n.jsx("span",{className:"workbench-search-result-meta",children:T.path})]},`${T.path}-${T.kind}`))]})]})]})})}function jB({menuKey:e,session:t,workspace:r,workspaceContext:s,isActive:i,isFavorite:l,menuOpen:c,menuAnchorPoint:d,showWorkspaceName:m,depth:f=0,showActions:v=!0,hasSubagents:g=!1,subagentListExpanded:w=!1,selectionMode:k=!1,selected:y=!1,onToggleSelect:S,onToggleSubagents:T,onOpen:j,onRename:N,onOpenContextMenu:D,onToggleFavorite:H,onArchive:B,onCloseMenu:I}){var W;const A=sr(),L=sb(t)?((W=t.subagentLabel)==null?void 0:W.trim())||o("shell.subagentBadge"):null,_=Ki(t.title,o("common.unknown")),F=O2(t),te=F?B2(F):null,E=au(t),se=E?OP("session-activity-badge",t):null,X=Ru(t),K=Mv(t),G=p.useRef(null),[q,U]=p.useState(null);p.useLayoutEffect(()=>{if(A.isDesktop||!c||!d||typeof window>"u"){U(null);return}const J=()=>{var ve,pe;const R=zP(d,{width:((ve=G.current)==null?void 0:ve.offsetWidth)??0,height:((pe=G.current)==null?void 0:pe.offsetHeight)??0},{width:window.innerWidth,height:window.innerHeight},{estimatedHeightPx:168});U({position:"fixed",top:`${Math.round(R.top)}px`,left:`${Math.round(R.left)}px`,width:`${Math.round(R.width)}px`,maxWidth:"calc(100vw - 24px)",maxHeight:`${Math.round(R.maxHeight)}px`,transformOrigin:R.transformOrigin})};return J(),window.addEventListener("resize",J),window.addEventListener("scroll",J,!0),()=>{window.removeEventListener("resize",J),window.removeEventListener("scroll",J,!0)}},[d,c,A.isDesktop]);async function Q(){await Cv([{id:`rename:${t.sessionId}`,label:o("shell.renameAction"),onSelect:N},{id:`favorite:${t.sessionId}`,label:o(l?"shell.unfavoriteAction":"shell.favoriteAction"),onSelect:H},{id:`archive:${t.sessionId}`,label:o("shell.archiveAction"),onSelect:B}])}const P=!A.isDesktop&&c&&typeof document<"u"?Vn.createPortal(n.jsxs("div",{ref:G,className:"workbench-session-menu","data-menu-key":e,role:"menu","aria-label":o("shell.sessionMoreAction"),onClick:J=>J.stopPropagation(),style:q??{position:"fixed",top:0,left:0,visibility:"hidden"},children:[n.jsxs("button",{type:"button",className:"workbench-session-menu-item",onClick:()=>{N(),I()},children:[n.jsx(kB,{}),n.jsx("span",{children:o("shell.renameAction")})]}),n.jsxs("button",{type:"button",className:"workbench-session-menu-item",onClick:()=>{H(),I()},children:[n.jsx(AD,{active:l}),n.jsx("span",{children:o(l?"shell.unfavoriteAction":"shell.favoriteAction")})]}),n.jsxs("button",{type:"button",className:"workbench-session-menu-item",onClick:()=>{B(),I()},children:[n.jsx(yB,{}),n.jsx("span",{children:o("shell.archiveAction")})]})]}),document.body):null;return n.jsxs("article",{className:"workbench-session-card","data-active":i,"data-depth":f,"data-subagent":sb(t),"data-workspace-tone":s.tone,"data-worktree-depth":s.depth,"data-has-subagents":g,"data-selecting":k,"data-selected":y,style:ai(s),onContextMenu:J=>{if(!(k||!v||!D)){if(J.preventDefault(),J.stopPropagation(),A.isDesktop){Q();return}D({x:J.clientX,y:J.clientY})}},children:[n.jsxs("div",{className:"workbench-session-main",children:[k?n.jsx("span",{className:"workbench-session-selection-indicator","data-selected":y,"aria-hidden":"true",children:n.jsx(wB,{selected:y})}):g?n.jsxs("button",{type:"button",className:"workbench-session-subagent-toggle",style:U2,"data-indicator-variant":H2(t,{hasSubagents:!0,isActive:i}),"aria-label":o(w?"shell.subagentCollapse":"shell.subagentExpand"),title:o(w?"shell.subagentCollapse":"shell.subagentExpand"),"aria-expanded":w,onClick:J=>{J.stopPropagation(),T==null||T()},children:[n.jsx("span",{className:mS(t,{hasSubagents:!0,isActive:i}),"data-activity-source":t.activitySource,"aria-hidden":"true"}),n.jsx("span",{className:"workbench-session-subagent-toggle-icon","aria-hidden":"true",children:n.jsx(Wc,{expanded:w})})]}):n.jsx("span",{className:mS(t,{isActive:i}),"data-activity-source":t.activitySource,"aria-hidden":"true"}),n.jsx("button",{type:"button",className:"workbench-session-link",style:g?W2:void 0,"data-active":i,"aria-pressed":k?y:void 0,onClick:k?S:j,onKeyDown:J=>{if(k||!v||!D||J.key!=="ContextMenu"&&!(J.shiftKey&&J.key==="F10"))return;if(J.preventDefault(),J.stopPropagation(),A.isDesktop){Q();return}const R=J.currentTarget.getBoundingClientRect();D({x:R.right,y:R.bottom})},children:n.jsxs("div",{className:"workbench-session-link-copy",children:[n.jsxs("div",{className:"session-title-row",children:[n.jsx("span",{className:"session-title",title:_.fullTitle,children:_.displayTitle}),L?n.jsx("span",{className:"session-subagent-badge",children:L}):null,K&&X?n.jsx("span",{className:`session-fork-badge ${X}`,children:K}):null]}),n.jsxs("div",{className:"session-meta-row",children:[n.jsx("span",{className:"session-meta",children:cD(t,r,m,s.displayName)}),E&&se?n.jsx("span",{className:se,children:E}):null,n.jsx("span",{className:`session-provider-badge ${t.provider}`,children:Sm(t.provider)})]}),te?n.jsx("div",{className:"session-error-row",title:F??void 0,children:n.jsx("span",{className:"session-error-text",children:te})}):null]})})]}),P]})}function CS({workspaceGroups:e,workspaceVisualContextMap:t,sessionDisplaySortMode:r,favoriteSessions:s,favoriteSessionIds:i,activeWorkspaceId:l,isConversationActive:c,isTerminalActive:d,isButlerActive:m,isSearchOpen:f,navigationLoading:v,navigationError:g,activeSessionId:w,onRefreshNavigation:k,onSessionUpdated:y,onNavigateConversation:S,onNavigateTerminals:T,onNavigateButler:j,onOpenSearch:N,onOpenSettings:D,onSelectWorkspace:H,onToggleWorkspaceCollapse:B,onStartWorkspaceReorder:I,onPreviewWorkspaceReorder:A,onCommitWorkspaceReorder:L,allowWorkspaceReorder:_,subscribeGitSnapshot:F,requestGitRefresh:te,subscribeWorkspaceManagementSnapshot:E,requestWorkspaceManagementRefresh:se,onToggleFavoriteSession:X,onArchiveSession:K,onUnarchiveSession:G,workspaceManagementStateById:q,setWorkspaceManagementStateById:U,unreadNotificationCount:Q,notificationPanelOpen:P,onToggleNotificationPanel:W,onClose:J,onToggleCollapse:R}){const ve=fr(),pe=sr(),{showToast:Y}=Qn(),Se=p.useCallback(z=>{!pe.isDesktop||pe.ui.osFamily!=="macos"||z.button!==0||gv(z.target)&&bv()},[pe.isDesktop,pe.ui.osFamily]),[Le,re]=p.useState(!1),[Ce,Xe]=p.useState(!1),[Ue,ct]=p.useState(!1),[Nt,Ke]=p.useState([]),[ut,vt]=p.useState(null),[Te,_e]=p.useState(null),[we,qe]=p.useState(null),[ke,Ee]=p.useState(null),[$e,wt]=p.useState(null),[me,Pe]=p.useState(null),[Ge,dt]=p.useState(!1),[Ye,Dt]=p.useState(!1),[ae,We]=p.useState(""),[jt,Rt]=p.useState(""),[cn,Vt]=p.useState(""),[Gt,pn]=p.useState({localBranches:[],remoteBranches:[],tags:[]}),[ie,Be]=p.useState(!1),[Mt,Tt]=p.useState(-1),[xn,dn]=p.useState(!1),[Nn,Sn]=p.useState(!1),[Et,In]=p.useState(null),[wn,Z]=p.useState(null),[ce,ge]=p.useState(null),[Ie,He]=p.useState(null),[Je,ft]=p.useState(null),[gt,nt]=p.useState(null),[yt,rt]=p.useState(Tf),[oe,Ne]=p.useState({}),[Lt,Wt]=p.useState({}),[Kt,un]=p.useState([]),[En,Hn]=p.useState({expandedWorkspaceIds:[],collapsedWorkspaceIds:[]}),[jn,Qt]=p.useState(null),[ir,De]=p.useState(""),[ze,$t]=p.useState(null),[an,kt]=p.useState(null),[Zt,Pn]=p.useState([]),[Sr,Jt]=p.useState(!1),[Un,gr]=p.useState({}),[ar,qn]=p.useState(null),br=p.useRef(null),zn=p.useRef(null),Cr=p.useRef(null),Yr=p.useRef(new Map),ls=p.useRef(null),ts=p.useRef(null),Hr=p.useRef(null),cs=p.useMemo(()=>new Set(En.expandedWorkspaceIds),[En.expandedWorkspaceIds]),Ir=p.useMemo(()=>new Set(En.collapsedWorkspaceIds),[En.collapsedWorkspaceIds]),vr=ar!==null,wr=_&&pe.isDesktop&&pe.ui.osFamily==="macos",Yt=p.useCallback(()=>{ft(null),nt(null)},[]),bn=p.useCallback((z,de)=>{ft(z),nt(de)},[]),yn=vS(e,$e)??((me==null?void 0:me.id)===$e?me:null),Tn=cn.trim().toLowerCase(),or=p.useMemo(()=>[{key:"localBranches",label:o("shell.createWorktreeBaseRefLocalGroup"),items:Gt.localBranches},{key:"remoteBranches",label:o("shell.createWorktreeBaseRefRemoteGroup"),items:Gt.remoteBranches},{key:"tags",label:o("shell.createWorktreeBaseRefTagGroup"),items:Gt.tags}].map(de=>({...de,items:de.items.filter(Ae=>Tn?Ae.value.toLowerCase().includes(Tn):!0)})).filter(de=>de.items.length>0),[Tn,Gt]),ue=p.useMemo(()=>or.flatMap(z=>z.items),[or]),Ve=yn?`create-worktree-base-ref-listbox-${yn.id}`:"create-worktree-base-ref-listbox",St=K2(e,Ie),It=St?Ys(St.workspace):null,vn=p.useMemo(()=>G2(e,an),[an,e]),fn=p.useMemo(()=>vn?E2(vn.visibleSessionTree):[],[vn]),ln=p.useMemo(()=>fn.map(z=>z.sessionId),[fn]),jr=p.useMemo(()=>new Set(ln),[ln]),Gn=p.useMemo(()=>new Set(Zt),[Zt]),zr=ln.length>0&&Zt.length===ln.length;p.useEffect(()=>{U(z=>{const de=wS(e),Ae=new Set(de),it={};Object.entries(z).forEach(([Ot,Bn])=>{Ae.has(Ot)&&(it[Ot]=Bn)}),de.forEach(Ot=>{const Bn=vS(e,Ot);if(!Bn)return;const Pr=Ur(ab(Ot),sS),O=Ur(xD(Ot),sS),ne=it[Ot];let Re=CD((ne==null?void 0:ne.detail)??Pr??SD(Bn),Bn);(O!=null&&O.status||O!=null&&O.branches)&&(Re=jD(Re,{status:O.status??null,branches:O.branches??null})),it[Ot]={detail:Re,loading:!1,error:null}});const mt=Object.keys(z),gn=Object.keys(it);return mt.length===gn.length&&gn.every(Ot=>z[Ot]===it[Ot])?z:it})},[e]);const us=p.useCallback(async z=>{await k(),await pe.bridge.showNotification(o("shell.importSuccess"),z.path)},[k,pe.bridge]),zt=p.useCallback(async z=>{await k(),await pe.bridge.showNotification(o("shell.cloneSuccess"),z.path)},[k,pe.bridge]);function V(z){if(Nt.includes(z)){Ke(Ae=>Ae.filter(it=>it!==z));return}Ke(Ae=>[...Ae,z]),F(z),te(z),E(z),se(z)}async function fe(z,de){if(Un[z])return;const Ae=(de==null?void 0:de.trim().toUpperCase())??null;gr(it=>({...it,[z]:!0}));try{await yP(z,{backgroundColor:Ae}),await k()}catch(it){Y({title:it instanceof Error?it.message:o("shell.manageWorkspaceColorSaveFailed"),tone:"error"})}finally{gr(it=>({...it,[z]:!1}))}}async function xe(){if(!(!ut||Te)){_e(ut.id);try{await wP(ut.id),Ke(z=>z.filter(de=>de!==ut.id)),U(z=>{const de={...z};return delete de[ut.id],de}),vt(null),await k(),Y({title:o("shell.manageWorkspaceRemoveSuccess"),tone:"success"})}catch(z){Y({title:z instanceof Error?z.message:o("shell.manageWorkspaceRemoveFailed"),tone:"error"})}finally{_e(null)}}}p.useEffect(()=>{if(!Je)return;function z(de){const Ae=de.target;Ae instanceof HTMLElement&&Ae.closest(".workbench-session-menu")||Yt()}return window.addEventListener("pointerdown",z),()=>{window.removeEventListener("pointerdown",z)}},[Yt,Je]),p.useEffect(()=>{if(!an){Zt.length>0&&Pn([]);return}if(!vn){kt(null),Pn([]);return}Pn(z=>vD(z,jr))},[vn,jr,an,Zt.length]),p.useEffect(()=>{an&&ln.length===0&&(kt(null),Pn([]))},[ln.length,an]),p.useEffect(()=>{const z=new Set(wS(e)),de=new Set(e.flatMap(Ae=>ib(Ae.childWorktrees)));Ke(Ae=>Ae.filter(it=>z.has(it))),Hn(Ae=>({expandedWorkspaceIds:Ae.expandedWorkspaceIds.filter(it=>de.has(it)),collapsedWorkspaceIds:Ae.collapsedWorkspaceIds.filter(it=>de.has(it))})),vt(Ae=>Ae&&z.has(Ae.id)?Ae:null),gr(Ae=>Object.fromEntries(Object.entries(Ae).filter(([it,mt])=>mt&&z.has(it))))},[e]),p.useEffect(()=>{const z=s.findIndex(de=>de.session.sessionId===w);rt(de=>{const Ae=Ud(s.length,Tf,de,z);return Ae===de?de:Ae})},[w,s]),p.useEffect(()=>{Ne(z=>{const de={};for(const Ae of e){const it=Oc(Ae),mt=it.findIndex(gn=>gn.item.sessionId===w||ha([gn],w??"",Ot=>Ot.sessionId).length>0);de[Ae.workspace.id]=Ud(it.length,Sc,z[Ae.workspace.id],mt);for(const gn of Bc(Ae.childWorktrees)){gn.item.sessionId===w||ha([gn],w??"",O=>O.sessionId).length>0;const Ot=gn.item.workspaceId;if(de[Ot]!==void 0)continue;const Bn=Bc(Ae.childWorktrees).filter(O=>O.item.workspaceId===Ot&&O.depth===0),Pr=Bn.findIndex(O=>O.item.sessionId===w||ha([O],w??"",ne=>ne.sessionId).length>0);de[Ot]=Ud(Bn.length,Sc,z[Ot],Pr)}}return hS(z,de)?z:de})},[w,e]),p.useEffect(()=>{Wt(z=>{const de={};for(const Ae of e)for(const it of[...Oc(Ae),...Bc(Ae.childWorktrees)])for(const mt of li(Si(it))){const gn=Si(mt);if(gn.length===0)continue;const Ot=li(gn),Bn=Ot.findIndex(Pr=>Pr.item.sessionId===w);de[mt.item.sessionId]=Ud(Ot.length,Wd,z[mt.item.sessionId],Bn)}return hS(z,de)?z:de})},[w,e]),p.useEffect(()=>{if(!w)return;const z=e.flatMap(de=>[...ha(Oc(de),w,Ae=>Ae.sessionId),...Bc(de.childWorktrees).flatMap(Ae=>ha([Ae],w,it=>it.sessionId))]);z.length!==0&&un(de=>{const Ae=new Set(de);let it=!1;for(const mt of z)Ae.has(mt)||(Ae.add(mt),it=!0);return it?Array.from(Ae):de})},[w,e]),p.useEffect(()=>{if(!l)return;const z=[];for(const de of e){const Ae=gD(de.childWorktrees,l);Ae.length!==0&&z.push(...Ae)}z.length>0&&Hn(de=>{const Ae=new Set(de.expandedWorkspaceIds);let it=!1;for(const mt of z)Ae.has(mt)||(Ae.add(mt),it=!0);return it?{expandedWorkspaceIds:Array.from(Ae),collapsedWorkspaceIds:de.collapsedWorkspaceIds}:de})},[l,e]),p.useEffect(()=>{if(!$e){Pe(null),dt(!1),Dt(!1),We(""),Rt(""),Vt(""),Be(!1),Tt(-1),dn(!1),pn({localBranches:[],remoteBranches:[],tags:[]}),Sn(!1),In(null);return}dt(!1),We(""),Rt(""),Vt(""),Be(!1),Tt(-1),dn(!1),pn({localBranches:[],remoteBranches:[],tags:[]}),Sn(!1),In(null)},[$e]),p.useEffect(()=>{const z=yn;if(!Ge||!z)return;let de=!1;const Ae=z.id;return Sn(!0),In(null),Promise.all([RP(Ae),__(Ae)]).then(([it,mt])=>{de||pn(y2(it,mt))}).catch(()=>{de||(pn({localBranches:[],remoteBranches:[],tags:[]}),In(o("shell.createWorktreeBaseRefLoadFailed")))}).finally(()=>{de||Sn(!1)}),()=>{de=!0}},[yn==null?void 0:yn.id,Ge]),p.useLayoutEffect(()=>{if(!ie||!br.current){Z(null),ge(null);return}const z=()=>{const Ae=br.current;if(!Ae)return;const it=k2(Ae);Z({top:it.bottom+8,left:it.left,width:it.width})};z();const de=Ae=>{var mt,gn;const it=Ae.target;it instanceof Node&&((mt=br.current)!=null&&mt.contains(it)||(gn=zn.current)!=null&&gn.contains(it)||(Be(!1),Tt(-1)))};return window.addEventListener("resize",z),window.addEventListener("scroll",z,!0),window.addEventListener("pointerdown",de),()=>{window.removeEventListener("resize",z),window.removeEventListener("scroll",z,!0),window.removeEventListener("pointerdown",de)}},[ue.length,ie]),p.useLayoutEffect(()=>{if(!ie||!zn.current){ge(null);return}const z=zn.current,de=()=>{const it=Math.ceil(z.getBoundingClientRect().height);ge(mt=>mt===it?mt:it)};if(de(),typeof ResizeObserver>"u")return;const Ae=new ResizeObserver(()=>{de()});return Ae.observe(z),()=>{Ae.disconnect()}},[ie,or,Nn,Et]);function at(){re(!0)}function ht(){Xe(!0)}function ot(){dt(!1),We(""),Rt(""),Vt(""),Be(!1),Tt(-1),dn(!1)}function tn(z,de){const Ae=z.getBoundingClientRect();return de<=Ae.top+Ae.height/2?"before":"after"}function Ln(){Cr.current!==null&&(cancelAnimationFrame(Cr.current),Cr.current=null),qn(null)}function Jn(z){const de=(z==null?void 0:z.commit)??!1,Ae=(z==null?void 0:z.preserveClickSuppression)??!1,it=ls.current,mt=ts.current;ls.current=null,ts.current=null,mt==null||mt(),it!=null&&it.dragging&&(Ln(),de&&L(),!Ae&&Hr.current===it.workspaceId&&(Hr.current=null))}function Nr(z){if(Hr.current===z){Hr.current=null;return}B(z)}function Ks(z,de){if(de){Yr.current.set(z,de);return}Yr.current.delete(z)}function Er(z,de){for(const[Ae,it]of Yr.current){const mt=it.getBoundingClientRect();if(z>=mt.left&&z<=mt.right&&de>=mt.top&&de<=mt.bottom)return{workspaceId:Ae,element:it}}return null}function Lr(z,de){var Bn;if(!wr||z.button!==0)return;Jn();const Ae=z.currentTarget,it={pointerId:z.pointerId,workspaceId:de,startX:z.clientX,startY:z.clientY,pointerTarget:Ae,dragging:!1};ls.current=it,(Bn=Ae.setPointerCapture)==null||Bn.call(Ae,z.pointerId);const mt=Pr=>{xs(Pr)},gn=Pr=>{lr(Pr.pointerId,{commit:!0,preserveClickSuppression:!0})},Ot=Pr=>{lr(Pr.pointerId,{commit:!1,preserveClickSuppression:!1})};ts.current=()=>{Ae.removeEventListener("pointermove",mt),Ae.removeEventListener("pointerup",gn),Ae.removeEventListener("pointercancel",Ot),window.removeEventListener("pointermove",mt),window.removeEventListener("pointerup",gn),window.removeEventListener("pointercancel",Ot)},Ae.addEventListener("pointermove",mt),Ae.addEventListener("pointerup",gn),Ae.addEventListener("pointercancel",Ot),window.addEventListener("pointermove",mt,{passive:!1}),window.addEventListener("pointerup",gn),window.addEventListener("pointercancel",Ot)}function xs(z){const de=ls.current;if(!de||de.pointerId!==z.pointerId)return;if(!de.dragging){if(Math.hypot(z.clientX-de.startX,z.clientY-de.startY)<o2)return;de.dragging=!0,Hr.current=de.workspaceId,I(),qn(de.workspaceId)}z.preventDefault();const Ae=Er(z.clientX,z.clientY);!Ae||Ae.workspaceId===de.workspaceId||A(de.workspaceId,Ae.workspaceId,tn(Ae.element,z.clientY))}function lr(z,de){var it,mt;const Ae=ls.current;!Ae||Ae.pointerId!==z||((mt=(it=Ae.pointerTarget).releasePointerCapture)==null||mt.call(it,z),Jn(de))}function Di(z){xs(z)}function ds(z){lr(z.pointerId,{commit:!0,preserveClickSuppression:!0})}function Xi(z){lr(z.pointerId,{commit:!1,preserveClickSuppression:!1})}function Xr(z,de){z.dataTransfer.effectAllowed="move",z.dataTransfer.setData("text/plain",de),I(),Cr.current!==null&&cancelAnimationFrame(Cr.current),Cr.current=requestAnimationFrame(()=>{Cr.current=null,qn(de)})}function Qr(z,de){const Ae=ar||z.dataTransfer.getData("text/plain");!Ae||Ae===de||(z.preventDefault(),z.dataTransfer.dropEffect="move",A(Ae,de,tn(z.currentTarget,z.clientY)))}function hi(z){z.preventDefault()}function mi(){Ln(),L()}p.useEffect(()=>()=>{Jn()},[]);function Ri(z){return Lt[z]??Wd}function qr(z){return Kt.includes(z)}function $(z){return oe[z]??Sc}function be(){rt(z=>Math.min(s.length,z+Tf))}function lt(z,de){Ne(Ae=>({...Ae,[z]:Math.min(de,(Ae[z]??Sc)+Sc)}))}function Pt(z){Wt(de=>({...de,[z]:(de[z]??Wd)+Wd}))}function en(z){un(de=>de.includes(z)?de.filter(Ae=>Ae!==z):[...de,z])}function ns(z,de){return Ir.has(z)?!1:de||cs.has(z)}function Ai(z,de){const Ae=!ns(z,de);Hn(it=>{const mt=it.expandedWorkspaceIds.filter(Ot=>Ot!==z),gn=it.collapsedWorkspaceIds.filter(Ot=>Ot!==z);return Ae?{expandedWorkspaceIds:[...mt,z],collapsedWorkspaceIds:gn}:{expandedWorkspaceIds:mt,collapsedWorkspaceIds:[...gn,z]}})}function Qi(z){for(const de of e){const Ae=li(Ov(de.visibleSessions,r)).find(it=>it.item.sessionId===z)??hD(de.childWorktrees,z);if(Ae)return Si(Ae)}return[]}function wa(z,de){const Ae=Ys(z);return n.jsxs("button",{type:"button",className:"workbench-archive-folder","data-workspace-tone":Ae.tone,style:ai(Ae),onClick:()=>He(z.id),children:[n.jsxs("span",{className:"workbench-archive-folder-main",children:[n.jsx(xB,{}),n.jsx("span",{children:o("shell.archiveFolderLabel")})]}),n.jsx("span",{className:"workbench-section-counter",children:de.length})]})}function ya(){return n.jsxs("div",{className:"workbench-workspace-batch-toolbar",children:[n.jsx("span",{className:"workbench-workspace-batch-label",children:o("shell.batchSelectionMode")}),n.jsxs("span",{className:"workbench-workspace-batch-counter",children:[Zt.length,"/",ln.length]}),n.jsx("button",{type:"button",className:"workbench-workspace-batch-action",onClick:Xl,children:o(zr?"shell.clearSelectedSessions":"shell.selectAllSessions")}),n.jsx("button",{type:"button",className:"workbench-workspace-batch-action primary",disabled:Zt.length===0||Sr,onClick:()=>{Ko()},children:o(Sr?"shell.batchArchiving":"shell.batchArchiveAction")}),n.jsx("button",{type:"button",className:"workbench-workspace-batch-action",onClick:Yl,children:o("common.cancel")})]})}function no(z,de="workbench-workspace-actions"){return n.jsxs("div",{className:de,children:[n.jsx("button",{type:"button",className:"workbench-workspace-icon-button","aria-label":o("shell.switchWorkspace"),title:o("shell.switchWorkspace"),"aria-pressed":l===z,onClick:()=>{H(z),J==null||J()},children:n.jsx(vB,{})}),n.jsx("button",{type:"button",className:"workbench-workspace-icon-button","aria-label":o("shell.batchSelectSessions"),title:o("shell.batchSelectSessions"),onClick:()=>ka(z),children:n.jsx(bB,{})}),n.jsx("button",{type:"button",className:"workbench-workspace-icon-button workbench-workspace-create","aria-label":o("shell.createSession"),title:o("shell.createSession"),onClick:()=>wt(z),children:n.jsx(uB,{})})]})}function $o(z){const de=z.visibleSessionTree,it=new Set(ib(z.children)).has(l??""),mt=z.workspace.id===l||it,gn=vr||!ns(z.workspace.id,mt),Ot=Ys(z.workspace);return n.jsxs("section",{className:"workbench-workspace-group","data-worktree-node":"true","data-batch-active":an===z.workspace.id,"data-worktree-depth":z.meta.depth,"data-workspace-tone":"worktree",style:ai(Ot),children:[n.jsxs("div",{className:"workbench-workspace-header minimal",children:[n.jsxs("button",{type:"button",className:"workbench-workspace-toggle","aria-label":o(gn?"shell.worktreeExpand":"shell.worktreeCollapse"),onClick:()=>Ai(z.workspace.id,mt),children:[n.jsx("span",{className:"workbench-workspace-toggle-icon","aria-hidden":"true",children:n.jsx(Wc,{expanded:!gn})}),n.jsxs("span",{children:[n.jsx("strong",{children:z.meta.displayName||z.workspace.name}),n.jsx("span",{className:"session-meta",children:z.meta.branchName})]})]}),an===z.workspace.id?ya():no(z.workspace.id)]}),gn?null:n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"workbench-session-list","data-workspace-tone":Ot.tone,style:ai(Ot),children:[de.length===0?n.jsx("p",{className:"workbench-session-empty",children:o("shell.emptyWorkspaceSessions")}):de.slice(0,$(z.workspace.id)).map(Bn=>pi({node:Bn,workspace:z.workspace,workspaceContext:Ot,menuKeyPrefix:`worktree:${z.workspace.id}`,showWorkspaceName:!1,selectionMode:an===z.workspace.id,favoriteEnabled:!0})),de.length>$(z.workspace.id)?n.jsx("button",{type:"button",className:"workbench-subsession-expand ghost-button",onClick:()=>lt(z.workspace.id,de.length),children:o("shell.sessionExpandMore")}):null]}),z.children.length>0?n.jsx("div",{className:"workbench-session-list workbench-worktree-child-list",children:z.children.map(Bn=>$o(Bn))}):null,wa(z.workspace,z.archivedSessions)]})]},z.workspace.id)}function pi(z){const{node:de,workspace:Ae,workspaceContext:it,menuKeyPrefix:mt,showWorkspaceName:gn,selectionMode:Ot,favoriteEnabled:Bn,ancestorExpanded:Pr=!1,allowToggle:O=de.depth===0,ancestorHasNextSiblings:ne=[],hasNextSibling:Re=!1,isFirstSibling:tt=!1}=z,pt=de.item,Ct=Si(de),Ut=Pr||qr(pt.sessionId),Ht=Ut&&O,mn=Ht?L2(de,Ri(pt.sessionId),r):de,on=Ut?Si(mn):[],Zn=li(Ct).length,rs=li(on).length,Dr=Ht&&rs<Zn,ss=de.depth>0?[...ne,Re]:[...ne];return n.jsxs("div",{className:"workbench-session-tree-node",children:[n.jsxs("div",{className:"workbench-session-tree-row",style:{"--workbench-session-tree-depth":de.depth},children:[de.depth>0?n.jsxs("div",{className:"workbench-session-tree-guides","aria-hidden":"true",children:[ne.map((is,Zi)=>is?n.jsx("span",{className:"workbench-session-tree-guide-column",style:{"--workbench-session-tree-level":Zi+1}},`${pt.sessionId}:ancestor:${Zi}`):null),n.jsx("span",{className:"workbench-session-tree-guide-branch","data-continue":Re,"data-first":tt,style:{"--workbench-session-tree-level":de.depth},children:n.jsx("span",{className:"workbench-session-tree-guide-branch-horizontal"})})]}):null,n.jsx(jB,{menuKey:`${mt}:${pt.sessionId}`,session:pt,workspace:Ae,workspaceContext:it,isActive:pt.sessionId===w,isFavorite:Bn&&i.has(pt.sessionId),menuOpen:Je===`${mt}:${pt.sessionId}`,showWorkspaceName:gn,depth:de.depth,showActions:Bn,hasSubagents:O&&Ct.length>0,subagentListExpanded:Ut,selectionMode:Ot,selected:Gn.has(pt.sessionId),onToggleSelect:()=>Vo(pt.sessionId),onToggleSubagents:()=>en(pt.sessionId),onOpen:()=>{ve(Yn(Ae.id,pt.sessionId)),J==null||J()},onRename:()=>xa(pt,Ae),menuAnchorPoint:Je===`${mt}:${pt.sessionId}`?gt:null,onOpenContextMenu:is=>bn(`${mt}:${pt.sessionId}`,is),onToggleFavorite:()=>Ji(pt.sessionId),onArchive:()=>Go(pt.sessionId),onCloseMenu:Yt})]}),Ct.length>0&&Ut?n.jsxs("div",{className:"workbench-subsession-list",children:[on.map((is,Zi)=>pi({node:is,workspace:Ae,workspaceContext:it,menuKeyPrefix:mt,showWorkspaceName:gn,selectionMode:Ot,favoriteEnabled:Bn,ancestorExpanded:!0,allowToggle:!1,ancestorHasNextSiblings:ss,hasNextSibling:Zi<on.length-1,isFirstSibling:Zi===0})),Dr?n.jsx("button",{type:"button",className:"workbench-subsession-expand ghost-button",onClick:()=>Pt(pt.sessionId),children:o("shell.subagentExpandMore")}):null]}):null]},pt.sessionId)}function ka(z){Yt(),kt(z),Pn([])}function Yl(){kt(null),Pn([])}function Vo(z){Pn(de=>tB(de,z))}function Xl(){Pn(z=>z.length===ln.length?[]:ln)}async function Ql(z,de){qe(z),Ee(de);try{await iD(z,de),wt(null),ve(ZN(z,de)),J==null||J()}catch(Ae){Y({title:Ae instanceof Error?Ae.message:o("shell.startSessionFailed"),tone:"error"})}finally{qe(null),Ee(null)}}async function ro(z){if(z.preventDefault(),!yn||Ye)return;const de=ae.trim(),Ae=jt.trim(),it=cn.trim();if(!de){Y({title:o("shell.createWorktreeBranchRequired"),tone:"error"});return}if(!v2(de)){Y({title:o("shell.createWorktreeBranchInvalid"),tone:"error"});return}Dt(!0);try{const mt=await b_({sourceWorkspaceId:yn.id,branchName:de,displayName:Ae||void 0,baseRef:it||void 0});Pe(mt.workspace),H(mt.workspace.id),await k(),wt(mt.workspace.id),ot(),Y({title:o("shell.createWorktreeSucceeded",{name:mt.meta.displayName||mt.workspace.name}),tone:"success"})}catch(mt){Y({title:mt instanceof Error?mt.message:o("shell.createWorktreeFailed"),tone:"error"})}finally{Dt(!1)}}async function Ji(z){const de=i.has(z);Yt();try{await X(z),Y({title:o(de?"shell.favoriteRemoved":"shell.favoriteAdded"),tone:"success"})}catch(Ae){Y({title:Ae instanceof Error?Ae.message:o("shell.favoriteToggleFailed"),tone:"error"})}}async function Go(z){Yt();try{await K(z),Y({title:o("shell.archiveAdded"),tone:"success"})}catch(de){Y({title:de instanceof Error?de.message:o("shell.navigationLoadFailed"),tone:"error"})}}async function Ko(){if(!(Zt.length===0||Sr)){Yt(),Jt(!0);try{const z=[...Zt],de=await Promise.allSettled(z.map(async mt=>({sessionId:mt,session:await SP(mt,!0)}))),Ae=[];let it=0;for(const mt of de){if(mt.status==="fulfilled"){Ae.push(mt.value.sessionId),y(mt.value.session);continue}it+=1}Ae.length>0&&(await k(),Pn(mt=>mt.filter(gn=>!Ae.includes(gn)))),it>0?Y({title:Ae.length>0?o("shell.batchArchivePartialFailed"):o("shell.batchArchiveFailed"),tone:"error"}):Y({title:o("shell.batchArchiveSuccess"),tone:"success"})}catch(z){Y({title:z instanceof Error?z.message:o("shell.batchArchiveFailed"),tone:"error"})}finally{Jt(!1)}}}async function Yo(z){Yt();try{await G(z),Y({title:o("shell.archiveRestored"),tone:"success"})}catch(de){Y({title:de instanceof Error?de.message:o("shell.navigationLoadFailed"),tone:"error"})}}function xa(z,de){Yt(),Qt({session:z,workspace:de}),De(z.title)}async function Xo(z){if(z.preventDefault(),!jn)return;const de=ir.trim();if(de){$t(jn.session.sessionId);try{const Ae=await xP(jn.session.sessionId,de);y(Ae),Qt(null),De(""),Y({title:o("shell.renameSuccess"),tone:"success"})}catch(Ae){Y({title:Ae instanceof Error?Ae.message:o("shell.renameFailed"),tone:"error"})}finally{$t(null)}}}const so=s.slice(0,yt),Qo=so.length<s.length;function Ys(z){return t[z.id]??Mu(z)}function io(z,de,Ae,it,mt=[]){var Ut;const gn=Nt.includes(z.id),Ot=q[z.id]??{detail:null,loading:!1,error:null},Bn=Te===z.id,Pr=Un[z.id]===!0,O=(Ut=Ot.detail)!=null&&Ut.git.remotes.length?Ot.detail.git.remotes.map(Ht=>`${Ht.name}: ${Ht.url}`).join(" · "):o("shell.manageWorkspaceNoRemote"),ne=Ot.detail?UP(Ot.detail.codeComposition.items,o("shell.manageWorkspaceCodeCompositionOther")):[],Re=ne.length>0?HP(ne):void 0,tt=Ys(z),pt=Y2(tt,mt),Ct=[...mt,tt.displayName];return n.jsxs("article",{className:"workbench-manage-item","data-workspace-tone":tt.tone,"data-worktree-node":it,style:ai(tt),children:[n.jsxs("button",{type:"button",className:"workbench-manage-item-toggle","aria-expanded":gn,onClick:()=>V(z.id),children:[n.jsxs("span",{className:"workbench-manage-item-heading",children:[n.jsx(Wc,{expanded:gn}),n.jsxs("span",{className:"workbench-manage-item-heading-copy",children:[n.jsx("strong",{children:tt.displayName}),n.jsx("span",{className:"workbench-manage-item-tree-path",children:pt})]})]}),n.jsx("span",{className:"workbench-section-counter",children:de})]}),gn?n.jsxs("div",{className:"workbench-manage-item-body",children:[n.jsxs("div",{className:"workbench-manage-detail-block",children:[n.jsx("span",{className:"workbench-manage-detail-label",children:o("shell.manageWorkspacePathLabel")}),n.jsx("p",{className:"workbench-manage-detail-value",children:z.path})]}),it?n.jsxs("div",{className:"workbench-manage-detail-block",children:[n.jsxs("div",{className:"workbench-manage-detail-header",children:[n.jsx("span",{className:"workbench-manage-detail-label",children:o("shell.manageWorkspaceColorLabel")}),n.jsxs("div",{className:"workbench-manage-color-actions",children:[n.jsx("div",{className:"workbench-manage-color-palette","aria-label":o("shell.manageWorkspaceColorLabel"),children:u2.map(Ht=>n.jsx("button",{type:"button",className:"workbench-manage-color-swatch","aria-label":o("shell.manageWorkspaceColorSelectSwatch",{color:Ht}),"aria-pressed":z.backgroundColor===Ht,disabled:Pr,"data-selected":z.backgroundColor===Ht,style:{backgroundColor:Ht},onClick:()=>{fe(z.id,Ht)}},Ht))}),n.jsx("button",{type:"button",className:"ghost-button",disabled:Pr||!z.backgroundColor,onClick:()=>{fe(z.id,null)},children:o("shell.manageWorkspaceColorClearAction")})]})]}),n.jsx("p",{className:"workbench-manage-hint",children:z.backgroundColor??o("shell.manageWorkspaceColorUnset")})]}):null,Ot.loading&&Ot.detail===null?n.jsx("p",{className:"workbench-manage-status status-text",children:o("shell.manageWorkspaceLoading")}):null,Ot.error?n.jsx("p",{className:"workbench-manage-status status-text","data-tone":"error",children:Ot.error}):null,Ot.detail?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"workbench-manage-detail-block",children:n.jsxs("div",{className:"workbench-manage-detail-header",children:[n.jsx("span",{className:"workbench-manage-detail-label",children:o("shell.manageWorkspaceGitCommitCount")}),n.jsx("strong",{className:"workbench-manage-detail-accent",children:Ot.detail.git.commitCount??"--"})]})}),n.jsxs("div",{className:"workbench-manage-detail-block",children:[n.jsx("span",{className:"workbench-manage-detail-label",children:o("shell.manageWorkspaceGitInfoLabel")}),Ot.detail.git.isRepository?n.jsxs("div",{className:"workbench-manage-kv-list",children:[n.jsxs("div",{className:"workbench-manage-kv-item",children:[n.jsx("span",{children:o("shell.manageWorkspaceRepoRoot")}),n.jsx("span",{children:Ot.detail.git.repoRoot??"--"})]}),n.jsxs("div",{className:"workbench-manage-kv-item",children:[n.jsx("span",{children:o("shell.manageWorkspaceCurrentBranch")}),n.jsx("span",{children:Ot.detail.git.currentBranch??"--"})]}),n.jsxs("div",{className:"workbench-manage-kv-item",children:[n.jsx("span",{children:o("shell.manageWorkspaceRemoteLabel")}),n.jsx("span",{children:O})]})]}):n.jsx("p",{className:"workbench-section-empty",children:Ot.detail.git.error??o("shell.manageWorkspaceNotGit")})]}),n.jsxs("div",{className:"workbench-manage-detail-block",children:[n.jsx("span",{className:"workbench-manage-detail-label",children:o("shell.manageWorkspaceCodeCompositionLabel")}),ne.length>0?n.jsxs("div",{className:"workbench-manage-type-chart",children:[n.jsxs("div",{className:"workbench-manage-type-chart-ring",style:Re,"aria-hidden":"true",children:[n.jsx("strong",{className:"workbench-manage-type-chart-total",children:Ot.detail.codeComposition.scannedFileCount}),n.jsx("span",{className:"workbench-manage-type-chart-caption",children:o("shell.manageWorkspaceCodeCompositionFiles")})]}),n.jsx("div",{className:"workbench-manage-type-list",children:ne.map(Ht=>n.jsxs("div",{className:"workbench-manage-type-item",children:[n.jsxs("span",{className:"workbench-manage-type-meta",children:[n.jsx("span",{className:"workbench-manage-type-swatch",style:{backgroundColor:Ht.color},"aria-hidden":"true"}),n.jsx("span",{className:"workbench-manage-type-name",children:Ht.type})]}),n.jsxs("span",{children:[Ht.count," · ",WP(Ht)]})]},Ht.key))})]}):n.jsx("p",{className:"workbench-section-empty",children:Ot.detail.codeComposition.error??o("shell.manageWorkspaceNoCodeComposition")}),Ot.detail.codeComposition.truncated?n.jsx("p",{className:"workbench-manage-hint",children:o("shell.manageWorkspaceCodeTruncated",{count:Ot.detail.codeComposition.scannedFileCount})}):null]})]}):null,n.jsxs("div",{className:"workbench-modal-actions",children:[n.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{ct(!1),ve(QL(z.id))},children:o("shell.workspaceDetailDebugOpenPageAction")}),n.jsx("button",{type:"button",className:"secondary-button workbench-danger-button",disabled:!!Te,onClick:()=>vt(z),children:o(Bn?"shell.manageWorkspaceRemoving":"shell.manageWorkspaceRemoveAction")})]})]}):null,Ae.length>0?n.jsx("div",{className:"workbench-manage-children",children:Ae.map(Ht=>io(Ht.workspace,Ht.visibleSessions.length+Ht.archivedSessions.length,Ht.children,!0,Ct))}):null]},z.id)}return n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"workbench-nav-header","data-window-drag-handle":"workbench-nav-header",onMouseDownCapture:Se,children:n.jsxs("div",{className:"workbench-nav-toolbar",children:[R?n.jsx("button",{type:"button",className:"workbench-nav-toolbar-button","aria-label":o("shell.hideSessionSidebar"),title:o("shell.hideSessionSidebar"),onClick:R,children:n.jsx(RD,{})}):null,n.jsx(eD,{}),n.jsx(ND,{unreadCount:Q,open:P,onToggle:W}),n.jsx("button",{type:"button",className:"workbench-nav-toolbar-button","aria-label":o("shell.goBack"),title:o("shell.goBack"),onClick:()=>ve(-1),children:n.jsx(PD,{})}),n.jsx("button",{type:"button",className:"workbench-nav-toolbar-button","aria-label":o("shell.goForward"),title:o("shell.goForward"),onClick:()=>ve(1),children:n.jsx(DD,{})})]})}),n.jsxs("div",{className:"workbench-nav-body",children:[n.jsxs("div",{className:"workbench-nav-segment",role:"tablist","aria-label":o("shell.centerTabsLabel"),children:[n.jsxs("button",{type:"button",className:c?"workbench-nav-segment-button active":"workbench-nav-segment-button",role:"tab","aria-selected":c,onClick:S,children:[n.jsx(hB,{}),o("shell.conversationEntry")]}),n.jsxs("button",{type:"button",className:d?"workbench-nav-segment-button active":"workbench-nav-segment-button",role:"tab","aria-selected":d,onClick:T,children:[n.jsx(mB,{}),o("shell.terminalsEntry")]}),n.jsxs("button",{type:"button",className:m?"workbench-nav-segment-button active":"workbench-nav-segment-button",role:"tab","aria-selected":m,onClick:j,children:[n.jsx(pB,{}),o("shell.butlerEntry")]}),n.jsxs("button",{type:"button",className:"workbench-nav-segment-button","data-open":f,"aria-haspopup":"dialog","aria-expanded":f,onClick:N,children:[n.jsx(dB,{}),n.jsx("span",{children:o("shell.searchEntry")})]})]}),g?n.jsx("div",{className:"workbench-status-row",children:n.jsx("p",{className:"status-text","data-tone":"error",children:g})}):null,s.length>0?n.jsxs("section",{className:"workbench-section-block workbench-favorite-section",children:[n.jsxs("div",{className:"workbench-section-heading",children:[n.jsxs("div",{className:"workbench-section-heading-main",children:[n.jsx(AD,{active:!0,className:"workbench-favorite-heading-icon"}),n.jsx("span",{children:o("shell.favoriteSectionTitle")})]}),n.jsx("span",{className:"workbench-section-counter",children:s.length})]}),n.jsxs("div",{className:"workbench-session-list",children:[so.map(z=>{const de=Qi(z.session.sessionId);return n.jsx("div",{children:pi({node:{item:z.session,depth:0,children:de},workspace:z.workspace,workspaceContext:Ys(z.workspace),menuKeyPrefix:"favorite",showWorkspaceName:!0,selectionMode:!1,favoriteEnabled:!0})},z.session.sessionId)}),Qo?n.jsx("button",{type:"button",className:"workbench-subsession-expand ghost-button",onClick:be,children:o("shell.favoriteExpandMore")}):null]})]}):null,v&&e.length===0?n.jsx(sB,{}):null,!v&&!g&&e.length===0?n.jsx("div",{className:"workbench-empty-state minimal",children:n.jsx("p",{children:o("shell.emptyNavigationBody")})}):null,n.jsxs("section",{className:"workbench-section-block workbench-workspace-section",children:[n.jsxs("div",{className:"workbench-section-heading",children:[n.jsx("div",{className:"workbench-section-heading-main",children:n.jsx("span",{children:o("shell.workspaceSectionTitle")})}),n.jsxs("div",{className:"workbench-section-actions",children:[n.jsx("button",{type:"button",className:"workbench-workspace-icon-button","aria-label":o("shell.manageWorkspaceAction"),title:o("shell.manageWorkspaceAction"),onClick:()=>ct(!0),children:n.jsx(oB,{})}),n.jsx("button",{type:"button",className:"workbench-workspace-icon-button","aria-label":o("shell.importWorkspaceTitle"),title:o("shell.importWorkspaceTitle"),onClick:at,children:n.jsx(aB,{})}),n.jsx("button",{type:"button",className:"workbench-workspace-icon-button","aria-label":o("shell.cloneWorkspaceTitle"),title:o("shell.cloneWorkspaceTitle"),onClick:ht,children:n.jsx(fB,{})})]})]}),e.map(z=>{const de=Oc(z),Ae=ar===z.workspace.id,it=z.isCollapsed||vr;return n.jsxs("section",{className:"workbench-workspace-group",ref:mt=>Ks(z.workspace.id,mt),"data-workspace-group-id":z.workspace.id,"data-batch-active":an===z.workspace.id,"data-dragging":Ae,onDragOver:mt=>Qr(mt,z.workspace.id),onDrop:hi,children:[n.jsxs("div",{className:"workbench-workspace-header minimal",children:[n.jsxs("button",{type:"button",className:"workbench-workspace-toggle","aria-label":o(it?"shell.workspaceExpand":"shell.workspaceCollapse"),draggable:_&&!wr,onClick:()=>Nr(z.workspace.id),onPointerDown:wr?mt=>Lr(mt,z.workspace.id):void 0,onPointerMove:wr?Di:void 0,onPointerUp:wr?ds:void 0,onPointerCancel:wr?Xi:void 0,onDragStart:_&&!wr?mt=>Xr(mt,z.workspace.id):void 0,onDragEnd:_&&!wr?mi:void 0,"data-reorder-enabled":_?"true":void 0,children:[n.jsx("span",{className:"workbench-workspace-toggle-icon","aria-hidden":"true",children:n.jsx(Wc,{expanded:!it})}),n.jsx("strong",{children:z.workspace.name})]}),an===z.workspace.id?ya():no(z.workspace.id)]}),it?null:n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"workbench-session-list",children:[de.length===0?n.jsx("p",{className:"workbench-session-empty",children:o("shell.emptyWorkspaceSessions")}):de.slice(0,$(z.workspace.id)).map(mt=>pi({node:mt,workspace:z.workspace,workspaceContext:Ys(z.workspace),menuKeyPrefix:`workspace:${z.workspace.id}`,showWorkspaceName:!1,selectionMode:an===z.workspace.id,favoriteEnabled:!0})),de.length>$(z.workspace.id)?n.jsx("button",{type:"button",className:"workbench-subsession-expand ghost-button",onClick:()=>lt(z.workspace.id,de.length),children:o("shell.sessionExpandMore")}):null]}),z.childWorktrees.length>0?n.jsx("div",{className:"workbench-session-list workbench-worktree-child-list",children:z.childWorktrees.map(mt=>$o(mt))}):null,wa(z.workspace,z.archivedSessions)]})]},z.workspace.id)})]})]}),n.jsx("div",{className:"workbench-nav-footer minimal",children:n.jsxs("div",{className:"workbench-nav-footer-actions",children:[n.jsxs("button",{className:"settings-entry-button workbench-nav-settings-button",type:"button",onClick:D,title:o("settings.title"),children:[n.jsx(gB,{}),n.jsx("span",{className:"settings-entry-label",children:o("settings.title")})]}),n.jsx(e2,{onOpenSoftwareUpdate:()=>ve("/settings/software-update")})]})}),n.jsx(Fn,{open:Ue,title:o("shell.manageWorkspaceTitle"),className:"workbench-manage-workspaces-modal",description:o("shell.manageWorkspaceDescription"),headerActions:n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",className:"secondary-button workbench-manage-modal-action",onClick:at,children:o("shell.manageWorkspaceImportAction")}),n.jsx("button",{type:"button",className:"secondary-button workbench-manage-modal-action",onClick:ht,children:o("shell.manageWorkspaceCloneAction")})]}),onClose:()=>{Te||ct(!1)},children:e.length>0?n.jsx("div",{className:"workbench-manage-list",children:e.map(z=>io(z.workspace,z.visibleSessions.length+z.archivedSessions.length,z.childWorktrees,!1))}):n.jsx("p",{className:"workbench-section-empty",children:o("shell.manageWorkspaceEmpty")})}),n.jsxs(Fn,{open:ut!==null,title:o("shell.manageWorkspaceRemoveConfirmTitle"),description:o("shell.manageWorkspaceRemoveConfirmDescription"),onClose:()=>{Te||vt(null)},children:[n.jsx("p",{className:"workbench-section-empty",children:ut?o("shell.manageWorkspaceRemoveConfirmTarget",{name:ut.name}):""}),n.jsxs("div",{className:"workbench-modal-actions",children:[n.jsx("button",{type:"button",className:"secondary-button",disabled:!!Te,onClick:()=>vt(null),children:o("common.cancel")}),n.jsx("button",{type:"button",className:"secondary-button workbench-danger-button",disabled:!!Te,onClick:()=>{xe()},children:o(Te?"shell.manageWorkspaceRemoving":"shell.manageWorkspaceRemoveConfirmAction")})]})]}),n.jsx(tD,{open:Ce,onClose:()=>Xe(!1),onCloned:zt}),n.jsx(rD,{open:Le,onClose:()=>re(!1),onImported:us}),n.jsx(Fn,{open:yn!==null,title:o("shell.createSessionModalTitle"),className:"workbench-create-session-modal",description:yn?`${o("shell.createSessionTarget")} · ${yn.name}`:o("shell.createSessionModalDescription"),headerActions:n.jsx("button",{type:"button",className:"secondary-button create-session-worktree-trigger",disabled:Ye||!!we,onClick:()=>dt(!0),children:o("shell.createWorktreeAction")}),onClose:()=>wt(null),children:n.jsxs("section",{className:"create-session-modal-section",children:[n.jsxs("div",{className:"create-session-modal-section-header",children:[n.jsx("strong",{children:o("shell.createSessionProviderLabel")}),n.jsx("span",{children:o("shell.providerOptionHint")})]}),n.jsx(_v,{disabled:!!we||Ye,workspaceId:(yn==null?void 0:yn.id)??null,pendingProvider:we===(yn==null?void 0:yn.id)?ke??null:null,onSelect:z=>{yn&&Ql(yn.id,z)}})]})}),n.jsx(Fn,{open:yn!==null&&Ge,title:o("shell.createWorktreeAction"),className:"workbench-create-worktree-modal",headerActions:n.jsx("button",{type:"button",className:xn?"workbench-modal-help-button active":"workbench-modal-help-button","aria-label":o("shell.createWorktreeHelpAction"),title:o("shell.createWorktreeHelpAction"),"aria-pressed":xn,onClick:()=>dn(z=>!z),children:n.jsx(SB,{})}),description:yn?`${o("shell.createWorktreeSectionDescription")} ${o("shell.createSessionTarget")} · ${yn.name}`:o("shell.createWorktreeSectionDescription"),onClose:ot,children:n.jsxs("form",{className:"create-session-worktree-form",onSubmit:ro,children:[xn?n.jsxs("section",{className:"create-session-worktree-help-card","aria-label":o("shell.createWorktreeHelpTitle"),children:[n.jsx("strong",{children:o("shell.createWorktreeHelpTitle")}),n.jsxs("div",{className:"create-session-worktree-help-grid",children:[n.jsxs("article",{children:[n.jsx("h3",{children:o("shell.createWorktreeHelpBranchTitle")}),n.jsx("p",{children:o("shell.createWorktreeHelpBranchBody")})]}),n.jsxs("article",{children:[n.jsx("h3",{children:o("shell.createWorktreeHelpDisplayNameTitle")}),n.jsx("p",{children:o("shell.createWorktreeHelpDisplayNameBody")})]}),n.jsxs("article",{children:[n.jsx("h3",{children:o("shell.createWorktreeHelpBaseRefTitle")}),n.jsx("p",{children:o("shell.createWorktreeHelpBaseRefBody")})]})]})]}):null,n.jsxs("label",{className:"create-session-worktree-field",children:[n.jsx("span",{children:o("shell.createWorktreeBranchLabel")}),n.jsx("input",{className:"settings-text-input",value:ae,placeholder:o("shell.createWorktreeBranchPlaceholder"),onChange:z=>{const de=z.target.value;w2(de)&&We(de)}})]}),n.jsxs("label",{className:"create-session-worktree-field",children:[n.jsx("span",{children:o("shell.createWorktreeDisplayNameLabel")}),n.jsx("input",{className:"settings-text-input",value:jt,placeholder:o("shell.createWorktreeDisplayNamePlaceholder"),onChange:z=>Rt(z.target.value)})]}),n.jsxs("label",{className:"create-session-worktree-field",children:[n.jsx("span",{children:o("shell.createWorktreeBaseRefLabel")}),n.jsx("div",{className:"create-session-worktree-combobox",ref:br,onBlurCapture:z=>{var Ae,it;const de=z.relatedTarget;de instanceof Node&&((Ae=br.current)!=null&&Ae.contains(de)||(it=zn.current)!=null&&it.contains(de))||(Be(!1),Tt(-1))},children:n.jsxs("div",{className:"create-session-worktree-combobox-input-wrap",children:[n.jsx("input",{className:"settings-text-input create-session-worktree-combobox-input",role:"combobox","aria-autocomplete":"list","aria-expanded":ie,"aria-controls":Ve,value:cn,placeholder:o("shell.createWorktreeBaseRefPlaceholder"),onFocus:()=>{Be(!0),Tt(ue.length>0?0:-1)},onChange:z=>{Vt(z.target.value),Be(!0),Tt(ue.length>0?0:-1)},onKeyDown:z=>{if(z.key==="ArrowDown"){if(z.preventDefault(),!ie){Be(!0);return}ue.length>0&&Tt(de=>de>=ue.length-1?0:de+1);return}if(z.key==="ArrowUp"){if(z.preventDefault(),!ie){Be(!0);return}ue.length>0&&Tt(de=>de<=0?ue.length-1:de-1);return}if(z.key==="Enter"&&ie&&Mt>=0){z.preventDefault();const de=ue[Mt];de&&(Vt(de.value),Be(!1),Tt(-1));return}z.key==="Escape"&&Be(!1)}}),n.jsx("button",{type:"button",className:"create-session-worktree-combobox-toggle","aria-label":o("shell.createWorktreeBaseRefToggle"),"aria-expanded":ie,onClick:()=>{Be(z=>!z),Tt(!ie&&ue.length>0?0:-1)},children:n.jsx(Wc,{expanded:ie})})]})}),n.jsx("span",{className:"create-session-worktree-field-hint",children:Nn?o("shell.createWorktreeBaseRefLoading"):Et||o("shell.createWorktreeBaseRefHint",{localCount:Gt.localBranches.length,remoteCount:Gt.remoteBranches.length,tagCount:Gt.tags.length})})]}),ie&&wn&&typeof document<"u"?Vn.createPortal(n.jsxs("div",{className:"create-session-worktree-combobox-floating-layer",children:[n.jsx("div",{className:"create-session-worktree-combobox-floating-backdrop",style:{"--create-worktree-combobox-top":`${wn.top}px`,"--create-worktree-combobox-left":`${wn.left}px`,"--create-worktree-combobox-width":`${wn.width}px`,"--create-worktree-combobox-height":`${ce??0}px`}}),n.jsx("div",{ref:zn,className:"create-session-worktree-combobox-popover floating",style:{"--create-worktree-combobox-top":`${wn.top}px`,"--create-worktree-combobox-left":`${wn.left}px`,"--create-worktree-combobox-width":`${wn.width}px`},children:Nn?n.jsx("p",{className:"create-session-worktree-combobox-empty",children:o("shell.createWorktreeBaseRefLoading")}):Et?n.jsx("p",{className:"create-session-worktree-combobox-empty",children:Et}):or.length>0?n.jsx("div",{id:Ve,className:"create-session-worktree-combobox-list",role:"listbox",children:or.map(z=>n.jsxs("section",{className:"create-session-worktree-combobox-group","aria-label":z.label,children:[n.jsx("header",{className:"create-session-worktree-combobox-group-title",children:z.label}),n.jsx("div",{className:"create-session-worktree-combobox-group-options",children:z.items.map(de=>{const Ae=ue.findIndex(gn=>gn.value===de.value),it=cn===de.value,mt=Mt===Ae;return n.jsxs("button",{type:"button",role:"option",className:"create-session-worktree-combobox-option","aria-selected":it,"data-highlighted":mt,onMouseDown:gn=>gn.preventDefault(),onMouseEnter:()=>Tt(Ae),onClick:()=>{Vt(de.value),Be(!1),Tt(-1)},children:[n.jsx("span",{className:"create-session-worktree-combobox-option-label",children:de.value}),n.jsxs("span",{className:"create-session-worktree-combobox-option-badges",children:[de.current?n.jsx("span",{className:"create-session-worktree-combobox-badge",children:o("shell.createWorktreeBaseRefCurrentBadge")}):null,de.recommended?n.jsx("span",{className:"create-session-worktree-combobox-badge recommended",children:o("shell.createWorktreeBaseRefRecommendedBadge")}):null]})]},`${z.key}:${de.value}`)})})]},z.key))}):n.jsx("p",{className:"create-session-worktree-combobox-empty",children:o("shell.createWorktreeBaseRefEmpty")})})]}),document.body):null,n.jsxs("div",{className:"workbench-modal-actions",children:[n.jsx("button",{type:"button",className:"secondary-button",disabled:Ye,onClick:ot,children:o("common.cancel")}),n.jsx("button",{type:"submit",className:"primary-button",disabled:Ye,children:o(Ye?"shell.createWorktreeSubmitting":"shell.createWorktreeSubmit")})]})]})}),n.jsx(Fn,{open:St!==null,title:o("shell.archiveModalTitle"),description:St?`${St.workspace.name} · ${o("shell.archiveModalDescription")}`:o("shell.archiveModalDescription"),onClose:()=>He(null),children:St&&St.archivedSessions.length>0?n.jsx("div",{className:"workbench-archive-list","data-workspace-tone":(It==null?void 0:It.tone)??"root",style:ai(It),children:St.archivedSessions.map(z=>{const de=Ki(z.title,o("common.unknown"));return n.jsxs("article",{className:"workbench-archive-item","data-workspace-tone":(It==null?void 0:It.tone)??"root",style:ai(It),children:[n.jsxs("div",{className:"workbench-archive-item-main",children:[n.jsx("strong",{title:de.fullTitle,children:de.displayTitle}),n.jsxs("p",{children:[cD(z,St.workspace,!1)," ·"," ",Sm(z.provider)]})]}),n.jsx("button",{type:"button",className:"secondary-button",onClick:()=>Yo(z.sessionId),children:o("shell.unarchiveAction")})]},z.sessionId)})}):n.jsx("p",{className:"workbench-section-empty",children:o("shell.archiveEmpty")})}),n.jsx(Fn,{open:jn!==null,title:o("shell.renameModalTitle"),description:o("shell.renameModalDescription"),onClose:()=>{ze||(Qt(null),De(""))},children:n.jsxs("form",{className:"workbench-rename-form",onSubmit:Xo,children:[n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("shell.renameInputLabel")}),n.jsx("input",{type:"text",value:ir,placeholder:o("shell.renameInputPlaceholder"),maxLength:120,autoFocus:!0,onChange:z=>De(z.target.value)})]}),n.jsxs("div",{className:"workbench-modal-actions",children:[n.jsx("button",{type:"button",className:"secondary-button",disabled:!!ze,onClick:()=>{Qt(null),De("")},children:o("common.cancel")}),n.jsx("button",{type:"submit",className:"primary-button",disabled:!ir.trim()||ze===(jn==null?void 0:jn.session.sessionId),children:ze===(jn==null?void 0:jn.session.sessionId)?o("shell.renamingSession"):o("common.save")})]})]})})]})}function jS({panelReady:e,activeTab:t,fileRevealRequest:r,onTabChange:s,onToggleCollapse:i,currentSessionId:l,activeWorkspaceId:c,navigationGroups:d,workspaceContext:m,worktreeMeta:f,worktreeMergeState:v,onRefreshWorktreeMergePreview:g,onApplyWorktreeMerge:w,onCleanupWorktree:k}){var se;const y=c??((se=d[0])==null?void 0:se.workspace.id)??null,S=sr(),{showToast:T}=Qn(),j=p.useRef(null),N=p.useRef(null),D=S.isDesktop&&S.bridge.supported,H=D&&!!c,B=D&&!!y,I=D&&!!y,A=typeof globalThis<"u"&&"PointerEvent"in globalThis,L=p.useCallback(async(X,K,G)=>{if(X==="files"){const U=await QF(S,{workspaceId:K,sessionId:G,focusOwner:"file-context-panel"});U.ok||T({title:U.detail??o("conversation.filePanelOpenExternalFailed"),tone:"error"});return}if(X==="git"){const U=await JF(S,{workspaceId:K,focusOwner:"git-sidebar"});U.ok||T({title:U.detail??o("git.openExternalFailed"),tone:"error"});return}const q=await ZF(S,{workspaceId:K,focusOwner:"terminal-manager-panel"});q.ok||T({title:q.detail??o("terminalManager.openExternalFailed"),tone:"error"})},[S,T]),_=p.useCallback((X,K)=>{if(X.button!==0||!D)return;const G=K==="files"?c:K==="git"||K==="terminals"?y:null;if(!G)return;const q=K==="files"?l:null;j.current={tab:K,startX:X.clientX,startY:X.clientY,workspaceId:G,sessionId:q,detached:!1,preview:null};const U=J=>{var Y;const R=j.current;if(!R)return;const ve=Math.abs(J.clientX-R.startX),pe=Math.abs(J.clientY-R.startY);!R.detached&&Math.max(ve,pe)<aS||(R.detached||(R.detached=!0,N.current=R.tab,R.preview=Nx({title:R.tab==="files"?o("shell.filesEntry"):R.tab==="git"?o("shell.gitEntry"):o("shell.terminalManagerEntry"),x:J.clientX,y:J.clientY})),(Y=R.preview)==null||Y.updatePosition(J.clientX,J.clientY))},Q=J=>{var ve;const R=(ve=j.current)==null?void 0:ve.preview;J&&(R==null||R.cancel()),window.removeEventListener("mousemove",U),window.removeEventListener("mouseup",P),window.removeEventListener("blur",W),j.current=null},P=async()=>{var R;const J=j.current;Q(!1),J!=null&&J.detached&&(await((R=J.preview)==null?void 0:R.complete()),await L(J.tab,J.workspaceId,J.sessionId))},W=()=>{Q(!0)};window.addEventListener("mousemove",U),window.addEventListener("mouseup",P),window.addEventListener("blur",W)},[c,D,l,y,L]),F=p.useCallback((X,K)=>{if(X.button!==0||!D)return;const G=K==="files"?c:K==="git"||K==="terminals"?y:null;if(!G)return;const q=X.currentTarget,U=X.pointerId;q.setPointerCapture(U);const Q=K==="files"?l:null;j.current={tab:K,startX:X.clientX,startY:X.clientY,workspaceId:G,sessionId:Q,detached:!1,preview:null};const P=pe=>{var re;if(pe.pointerId!==U)return;const Y=j.current;if(!Y)return;const Se=Math.abs(pe.clientX-Y.startX),Le=Math.abs(pe.clientY-Y.startY);!Y.detached&&Math.max(Se,Le)<aS||(Y.detached||(Y.detached=!0,N.current=Y.tab,Y.preview=Nx({title:Y.tab==="files"?o("shell.filesEntry"):Y.tab==="git"?o("shell.gitEntry"):o("shell.terminalManagerEntry"),x:pe.clientX,y:pe.clientY})),(re=Y.preview)==null||re.updatePosition(pe.clientX,pe.clientY))},W=pe=>{var Se;const Y=(Se=j.current)==null?void 0:Se.preview;pe&&(Y==null||Y.cancel()),q.removeEventListener("pointermove",P),q.removeEventListener("pointerup",J),q.removeEventListener("pointercancel",R),q.removeEventListener("lostpointercapture",R),window.removeEventListener("blur",ve),j.current=null,q.hasPointerCapture(U)&&q.releasePointerCapture(U)},J=async pe=>{var Se;if(pe.pointerId!==U)return;const Y=j.current;W(!1),Y!=null&&Y.detached&&(await((Se=Y.preview)==null?void 0:Se.complete()),await L(Y.tab,Y.workspaceId,Y.sessionId))},R=pe=>{pe.pointerId===U&&W(!0)},ve=()=>{W(!0)};q.addEventListener("pointermove",P),q.addEventListener("pointerup",J),q.addEventListener("pointercancel",R),q.addEventListener("lostpointercapture",R),window.addEventListener("blur",ve)},[c,D,l,y,L]),te=p.useCallback(X=>{if(N.current===X){N.current=null;return}s(X)},[s]),E=p.useCallback(X=>{!S.isDesktop||S.ui.osFamily!=="macos"||X.button!==0||gv(X.target)&&bv()},[S.isDesktop,S.ui.osFamily]);return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"workbench-auxiliary-header","data-workspace-tone":(m==null?void 0:m.tone)??"root",style:ai(m),"data-window-drag-handle":"workbench-auxiliary-header",onMouseDownCapture:E,children:[i?n.jsx("button",{type:"button",className:"workbench-nav-toolbar-button","aria-label":o("shell.hideInfoSidebar"),title:o("shell.hideInfoSidebar"),onClick:i,children:n.jsx(RD,{})}):null,n.jsxs("div",{className:"workbench-info-tabs",role:"tablist","aria-label":o("shell.infoTabsLabel"),children:[n.jsx("button",{className:t==="files"?"workbench-info-tab active":"workbench-info-tab",type:"button",role:"tab","aria-selected":t==="files",title:H?"拖拽标签到独立窗口":void 0,onPointerDown:X=>F(X,"files"),onMouseDown:A?void 0:X=>_(X,"files"),onClick:()=>te("files"),children:o("shell.filesEntry")}),n.jsx("button",{className:t==="git"?"workbench-info-tab active":"workbench-info-tab",type:"button",role:"tab","aria-selected":t==="git",title:B?"拖拽标签到独立窗口":void 0,onPointerDown:X=>F(X,"git"),onMouseDown:A?void 0:X=>_(X,"git"),onClick:()=>te("git"),children:o("shell.gitEntry")}),n.jsx("button",{className:t==="terminals"?"workbench-info-tab active":"workbench-info-tab",type:"button",role:"tab","aria-selected":t==="terminals",title:I?"拖拽标签到独立窗口":void 0,onPointerDown:X=>F(X,"terminals"),onMouseDown:A?void 0:X=>_(X,"terminals"),onClick:()=>te("terminals"),children:o("shell.terminalManagerEntry")})]})]}),n.jsxs("div",{className:"workbench-auxiliary-body",children:[e?null:n.jsx(zd,{}),e&&t==="git"&&f?n.jsx(TB,{meta:f,state:v,onRefresh:()=>g(f.workspaceId,!0),onApply:()=>w(f.workspaceId),onCleanup:()=>k(f)}):null,e&&t==="files"?c?n.jsx(p.Suspense,{fallback:n.jsx(zd,{}),children:n.jsx(D2,{sessionId:l,workspaceId:c,externalRevealRequest:r})}):n.jsx("section",{className:"workbench-empty-state minimal",children:n.jsx("p",{children:o("shell.filesPanelEmpty")})}):null,e&&t==="git"?y?n.jsx(p.Suspense,{fallback:n.jsx(zd,{}),children:n.jsx(R2,{workspaceId:y})}):n.jsx("section",{className:"workbench-empty-state minimal",children:n.jsx("p",{children:o("shell.gitPanelEmpty")})}):null,e&&t==="terminals"?n.jsx(p.Suspense,{fallback:n.jsx(zd,{}),children:n.jsx(A2,{currentWorkspaceId:c,navigationGroups:d})}):null]})]})}function TB({meta:e,state:t,onRefresh:r,onApply:s,onCleanup:i}){const[l,c]=p.useState(!1),d=(t==null?void 0:t.preview)??null,m=(t==null?void 0:t.loading)??!1,f=(t==null?void 0:t.applying)??!1,v=(t==null?void 0:t.cleaning)??!1,g=d!==null,w=(d==null?void 0:d.alreadyMerged)===!0,k=new Set((d==null?void 0:d.blockers.map(E=>E.code))??[]),y=k.size>0||!!(t!=null&&t.error),S=w&&!y,T=(d==null?void 0:d.canMerge)===!0&&!m&&!f&&!v&&!S,j=S&&!m&&!f&&!v&&!k.has("SOURCE_DIRTY")&&!k.has("HAS_ACTIVE_CHILDREN"),N=m||f||v?"loading":y?"blocked":S?"merged":d!=null&&d.canMerge?"ready":g?"blocked":"idle",D=(d==null?void 0:d.targetWorkspace.name)??o("common.unknown"),H=(d==null?void 0:d.sourceBranchName)??e.branchName,B=(d==null?void 0:d.targetBranchName)??e.baseRef??o("common.unknown"),I=PB({t:o,hasPreview:g,showMergedState:S,isMerged:w,canMerge:(d==null?void 0:d.canMerge)===!0,ahead:(d==null?void 0:d.ahead)??0,blockerCodeSet:k}),A=m?o("shell.worktreeMergePreviewLoading"):f?o("shell.worktreeMergeApplying"):v?o("shell.worktreeCleanupRunning"):S?o("shell.worktreeMergeAlreadyMerged"):d!=null&&d.canMerge?o("shell.worktreeMergeReady"):o(g?"shell.worktreeMergeBlocked":"shell.worktreeMergePreviewIdle"),L=[o("shell.worktreeMergeCurrentBranch",{branch:H}),o("shell.worktreeMergeParentBranch",{branch:B}),o("shell.worktreeMergeTargetWorkspace",{name:D}),d?o("shell.worktreeMergeAheadBehind",{ahead:d.ahead,behind:d.behind}):o("shell.worktreeMergeAheadBehindPending"),d!=null&&d.mergeBaseCommit?o("shell.worktreeMergeBaseCommit",{commit:nB(d.mergeBaseCommit)}):null].filter(E=>!!E),_=`worktree-merge-panel-details-${e.workspaceId}`,F=o(l?"shell.worktreeMergeCollapseDetails":"shell.worktreeMergeExpandDetails"),te=NB({t:o,loading:m,applying:f,cleaning:v,hasPreview:g,canMerge:(d==null?void 0:d.canMerge)===!0,showMergedState:S,blockerCodeSet:k});return p.useEffect(()=>{c(!1)},[e.workspaceId]),n.jsxs("section",{className:"worktree-merge-panel","data-state":N,children:[n.jsxs("button",{type:"button",className:"worktree-merge-panel-summary","aria-label":F,"aria-expanded":l,"aria-controls":_,onClick:()=>{c(E=>!E)},children:[n.jsx("span",{className:"worktree-merge-panel-summary-label",children:o("shell.worktreeMergePanelLabel")}),n.jsx("span",{className:"worktree-merge-panel-summary-main",children:n.jsx("span",{className:"worktree-merge-panel-summary-tags",children:te.map(E=>n.jsx("span",{className:"worktree-merge-panel-summary-tag","data-state":N,children:E},E))})}),n.jsx("span",{className:"worktree-merge-panel-summary-toggle",children:F})]}),l?n.jsxs("div",{id:_,className:"worktree-merge-panel-details",children:[n.jsx("div",{className:"worktree-merge-panel-detail-head",children:n.jsx("span",{className:"worktree-merge-panel-status","data-state":N,children:A})}),n.jsx("div",{className:"worktree-merge-panel-meta",children:L.map(E=>n.jsx("span",{children:E},E))}),g?n.jsx("div",{className:"worktree-merge-panel-checklist","aria-label":o("shell.worktreeMergeChecklistTitle"),children:I.map(E=>n.jsxs("div",{className:"worktree-merge-panel-checklist-item","data-state":E.state,children:[n.jsx("span",{className:"worktree-merge-panel-checklist-marker","aria-hidden":"true",children:E.state==="done"?"✓":E.state==="blocked"?"!":"·"}),n.jsxs("span",{className:"worktree-merge-panel-checklist-copy",children:[n.jsx("strong",{children:E.label}),E.detail?n.jsx("span",{children:E.detail}):null]})]},E.key))}):null,t!=null&&t.error?n.jsx("p",{className:"worktree-merge-panel-error status-text","data-tone":"error",children:t.error}):null,d!=null&&d.conflictPaths.length?n.jsxs("div",{className:"worktree-merge-panel-conflicts",children:[n.jsx("span",{className:"worktree-merge-panel-conflicts-label",children:o("shell.worktreeMergeConflictLabel")}),n.jsx("div",{className:"worktree-merge-panel-conflict-list",children:d.conflictPaths.map(E=>n.jsx("code",{children:E},E))})]}):null,n.jsxs("div",{className:"worktree-merge-panel-actions",children:[n.jsx("button",{type:"button",className:"secondary-button",disabled:m||f||v,onClick:r,children:o(g?"shell.worktreeMergePreviewRefresh":"shell.worktreeMergePreviewAction")}),n.jsx("button",{type:"button",className:"primary-button",disabled:!T,onClick:s,children:o(f?"shell.worktreeMergeApplying":"shell.worktreeMergeApplyAction")}),n.jsx("button",{type:"button",className:"secondary-button worktree-merge-panel-cleanup-button",disabled:!j,onClick:i,children:o(v?"shell.worktreeCleanupRunning":"shell.worktreeCleanupAction")})]})]}):null]})}function NB(e){const{t,loading:r,applying:s,cleaning:i,hasPreview:l,canMerge:c,showMergedState:d,blockerCodeSet:m}=e;if(r)return[t("shell.worktreeMergeCompactChecking")];if(s)return[t("shell.worktreeMergeCompactMerging")];if(i)return[t("shell.worktreeMergeCompactCleaning")];const f=[];return m.has("SOURCE_NOT_ACTIVE")&&f.push(t("shell.worktreeMergeCompactInactive")),m.has("SOURCE_DIRTY")&&f.push(t("shell.worktreeMergeCompactDirty")),m.has("TARGET_DIRTY")&&f.push(t("shell.worktreeMergeCompactTargetDirty")),m.has("HAS_CONFLICTS")&&f.push(t("shell.worktreeMergeCompactConflict")),m.has("HAS_ACTIVE_CHILDREN")&&f.push(t("shell.worktreeMergeCompactChildren")),f.length>0?f:c?[t("shell.worktreeMergeCompactReady")]:d?[t("shell.worktreeMergeCompactMerged")]:l?m.has("NO_COMMITS_TO_MERGE")?[t("shell.worktreeMergeCompactNoCommits")]:[t("shell.worktreeMergeCompactBlocked")]:[t("shell.worktreeMergeCompactPending")]}function PB(e){const{t,hasPreview:r,showMergedState:s,isMerged:i,canMerge:l,ahead:c,blockerCodeSet:d}=e,m=d.has("SOURCE_NOT_ACTIVE"),f=d.has("SOURCE_DIRTY"),v=d.has("TARGET_DIRTY"),g=d.has("HAS_ACTIVE_CHILDREN"),w=d.has("HAS_CONFLICTS"),k=r&&!i&&(d.has("NO_COMMITS_TO_MERGE")||c<=0),y=s?{key:"merge-result",label:t("shell.worktreeMergeChecklistResultMerged"),detail:t("shell.worktreeMergeMergedHint"),state:"done"}:l?{key:"merge-result",label:t("shell.worktreeMergeChecklistResultReady"),detail:t("shell.worktreeMergeChecklistResultReadyDetail"),state:"done"}:r?{key:"merge-result",label:t("shell.worktreeMergeChecklistResultBlocked"),detail:t("shell.worktreeMergeChecklistResultBlockedDetail"),state:"blocked"}:{key:"merge-result",label:t("shell.worktreeMergeChecklistResultPending"),detail:null,state:"pending"};return[{key:"source-state",label:t("shell.worktreeMergeChecklistSourceState"),detail:r&&m?t("shell.worktreeMergeChecklistSourceStateBlocked"):null,state:r?m?"blocked":"done":"pending"},{key:"clean-source",label:t("shell.worktreeMergeChecklistSourceClean"),detail:r&&f?t("shell.worktreeMergeChecklistSourceCleanBlocked"):null,state:r?f?"blocked":"done":"pending"},{key:"clean-target",label:t("shell.worktreeMergeChecklistTargetClean"),detail:r&&v?t("shell.worktreeMergeChecklistTargetCleanBlocked"):null,state:r?v?"blocked":"done":"pending"},{key:"children",label:t("shell.worktreeMergeChecklistChildren"),detail:r&&g?t("shell.worktreeMergeChecklistChildrenBlocked"):null,state:r?g?"blocked":"done":"pending"},{key:"commits",label:t("shell.worktreeMergeChecklistCommits"),detail:k?t(i?"shell.worktreeMergeMergedDirtyHint":"shell.worktreeMergeChecklistCommitsBlocked"):null,state:k?i?"done":"blocked":r?"done":"pending"},{key:"conflicts",label:t("shell.worktreeMergeChecklistConflicts"),detail:w?t("shell.worktreeMergeChecklistConflictsBlocked"):null,state:w?"blocked":r?"done":"pending"},y]}function DB({shellMode:e="desktop"}){var xa,Xo,so,Qo,Ys,io,z,de,Ae,it,mt,gn,Ot,Bn,Pr;const t=ui(),r=fr(),s=sr(),{showToast:i}=Qn(),l=ci(O=>O.sessionDisplaySortMode),c=ci(O=>O.notificationPreferences.notifyOnPermissionRequest),d=ci(O=>O.notificationPreferences.notifyOnSessionCompleted),m=ci(O=>O.notificationPreferences.notifyOnSessionFailed),f=p.useRef(GP($P)),v=p.useRef(0),g=p.useRef((((Xo=(xa=f.current)==null?void 0:xa.items)==null?void 0:Xo.length)??0)>0),w=p.useRef(new Map),k=p.useRef(!1),y=p.useRef(null),S=p.useRef(0),T=p.useRef(null),j=p.useRef(null),N=p.useRef(new Set),D=p.useRef(new Set),H=p.useRef(new Set),B=p.useRef(new Set),I=p.useRef(null),A=p.useRef(null),L=p.useRef(null),_=p.useRef(null),F=p.useRef(null),te=p.useRef(null),E=p.useRef(null),se=p.useRef(null),X=p.useRef(0),K=p.useRef(0),G=p.useRef(i),q=p.useRef(s.bridge),U=p.useRef(null),Q=p.useRef(!1),P=p.useRef(new Map),W=p.useRef(!1),J=p.useRef(new Map),R=p.useRef([]),ve=p.useRef(l),pe=p.useRef(null),[Y,Se]=p.useState(()=>ou(f.current,l)),Le=p.useRef(Y),[re,Ce]=p.useState(()=>{var O,ne;return(((ne=(O=f.current)==null?void 0:O.items)==null?void 0:ne.length)??0)===0}),[Xe,Ue]=p.useState(null),[ct,Nt]=p.useState(()=>Hd(pS(Qx,t2),Bd,nS)),[Ke,ut]=p.useState(()=>Hd(pS(Jx,n2),Bd,rS)),[vt,Te]=p.useState(()=>fS(Zx,!1)),[_e,we]=p.useState(()=>fS(eS,!1)),[qe,ke]=p.useState(()=>bS(f.current)),[Ee,$e]=p.useState(()=>gS(jf)),[wt,me]=p.useState(!1),[Pe,Ge]=p.useState("files"),[dt,Ye]=p.useState(!1),[Dt,ae]=p.useState(!1),[We,jt]=p.useState(null),[Rt,cn]=p.useState({}),[Vt,Gt]=p.useState(!1),[pn,ie]=p.useState("sessions"),[Be,Mt]=p.useState(""),[Tt,xn]=p.useState(""),[dn,Nn]=p.useState(!1),[Sn,Et]=p.useState(null),[In,wn]=p.useState([]),[Z,ce]=p.useState(null),[ge,Ie]=p.useState({}),[He,Je]=p.useState({}),[ft,gt]=p.useState(null),[nt,yt]=p.useState(!1),[rt,oe]=p.useState([]),[Ne,Lt]=p.useState(()=>new Set),[Wt,Kt]=p.useState(!1),[un,En]=p.useState(!1),[Hn,jn]=p.useState(()=>gS(tS));p.useEffect(()=>{G.current=i},[i]),p.useEffect(()=>{ve.current=l,Se(O=>rB(O,l))},[l]),p.useEffect(()=>{Le.current=Y},[Y]),p.useEffect(()=>{q.current=s.bridge},[s.bridge]);const Qt=p.useCallback(async()=>{const O=X.current+1;X.current=O;try{const ne=await wm();if(O!==X.current)return;if(!ne.initialized){oe([]),Lt(new Set);return}const[Re,tt,pt,Ct]=await Promise.all([ym(),km(),Iu(),DO()]);if(O!==X.current)return;oe(g2(Re.overview,tt.items,pt.items)),Lt(new Set(Ct.items.map(Ut=>Ut.notificationId)))}catch{if(O!==X.current)return;oe([]),Lt(new Set)}},[]),ir=p.useCallback(O=>{const ne=O.map(Re=>Re.createdAt).sort((Re,tt)=>Ka(tt)-Ka(Re))[0]??null;ne&&jn(Re=>Re&&Ka(Re)>=Ka(ne)?Re:ne)},[]);p.useEffect(()=>{Hn&&ko(tS,Hn)},[Hn]),p.useEffect(()=>{Qt();const O=window.setInterval(()=>{Qt()},s2);return()=>{window.clearInterval(O)}},[Qt]),p.useEffect(()=>{Ft("workbench.layout_mounted",{path:t.pathname,search:t.search})},[t.pathname,t.search]),p.useEffect(()=>{var O,ne;Ft("workbench.cached_snapshot_loaded",{cached:!!f.current,workspaceCount:((O=f.current)==null?void 0:O.items.length)??0,sessionCount:((ne=f.current)==null?void 0:ne.items.reduce((Re,tt)=>Re+tt.sessions.length,0))??0})},[]);function De(O){var tt;if(!O||!Array.isArray(O.items))return;J2(w.current,O);const ne=Q2(O,w.current);Ft("workbench.apply_snapshot",{workspaceCount:ne.items.length,sessionCount:ne.items.reduce((pt,Ct)=>pt+Ct.sessions.length,0),currentSessionId:((tt=Vc(t.pathname))==null?void 0:tt.sessionId)??null});const Re=ou(ne,ve.current);f.current=ne,_d(ne),Le.current=Re,Se(Re),ke(bS(ne)),Ue(null)}const ze=p.useCallback(async()=>{const O=v.current+1;v.current=O,Ce(ne=>ne||!g.current),Ft("workbench.refresh_navigation.start",{requestId:O,hasNavigationData:g.current});try{const ne=await vP();if(O!==v.current){Ft("workbench.refresh_navigation.stale",{requestId:O});return}De(ne)}catch(ne){if(O!==v.current)return;Ue(ne instanceof Error?ne.message:o("shell.navigationLoadFailed")),G.current({title:ne instanceof Error?ne.message:o("shell.navigationLoadFailed"),tone:"error"})}finally{Ft("workbench.refresh_navigation.end",{requestId:O,success:O===v.current}),O===v.current&&Ce(!1)}},[]),$t=p.useCallback(O=>{Se(ne=>{const Re=Z2(ne,O,ve.current);return Le.current=Re,Re})},[]),an=p.useCallback(()=>{var O;(O=j.current)==null||O.requestRefresh()},[]),kt=p.useCallback((O,ne)=>{r(Yn(O,ne))},[r]),Zt=p.useCallback((O,ne)=>{var Re;I.current={workspaceId:O,paths:ne},(Re=j.current)==null||Re.subscribeFileTree(O,ne)},[]),Pn=p.useCallback((O,ne)=>{var Re;A.current={workspaceId:O,paths:ne},(Re=j.current)==null||Re.requestFileTreeRefresh(O,ne)},[]),Sr=p.useCallback(O=>(N.current.add(O),()=>{N.current.delete(O)}),[]),Jt=p.useCallback(O=>{var ne;L.current=O,(ne=j.current)==null||ne.subscribeGit(O)},[]),Un=p.useCallback(O=>{var ne;_.current=O,(ne=j.current)==null||ne.requestGitRefresh(O)},[]),gr=p.useCallback(O=>(D.current.add(O),()=>{D.current.delete(O)}),[]),ar=p.useCallback(O=>{var ne;F.current=O,(ne=j.current)==null||ne.subscribeWorkspaceManagement(O)},[]),qn=p.useCallback(O=>{var ne;te.current=O,Ie(Re=>{var tt;return{...Re,[O]:{detail:((tt=Re[O])==null?void 0:tt.detail)??null,loading:!0,error:null}}}),(ne=j.current)==null||ne.requestWorkspaceManagementRefresh(O)},[]),br=p.useCallback(O=>(H.current.add(O),()=>{H.current.delete(O)}),[]),zn=p.useCallback(async(O,ne=!1)=>{const Re=O.trim();if(!Re)return;let tt=!0;if(Je(pt=>{const Ct=pt[Re];return!ne&&(Ct!=null&&Ct.loading)?(tt=!1,pt):{...pt,[Re]:{preview:(Ct==null?void 0:Ct.preview)??null,loading:!0,applying:(Ct==null?void 0:Ct.applying)??!1,cleaning:(Ct==null?void 0:Ct.cleaning)??!1,error:null}}}),!!tt)try{const pt=await v_(Re);Je(Ct=>{var Ut,Ht;return{...Ct,[Re]:{preview:pt,loading:!1,applying:((Ut=Ct[Re])==null?void 0:Ut.applying)??!1,cleaning:((Ht=Ct[Re])==null?void 0:Ht.cleaning)??!1,error:null}}})}catch(pt){Je(Ct=>{var Ut,Ht,mn;return{...Ct,[Re]:{preview:((Ut=Ct[Re])==null?void 0:Ut.preview)??null,loading:!1,applying:((Ht=Ct[Re])==null?void 0:Ht.applying)??!1,cleaning:((mn=Ct[Re])==null?void 0:mn.cleaning)??!1,error:pt instanceof Error?pt.message:o("shell.worktreeMergePreviewFailed")}}})}},[]),Cr=p.useCallback(async O=>{const ne=O.trim();if(ne){Je(Re=>{var tt,pt;return{...Re,[ne]:{preview:((tt=Re[ne])==null?void 0:tt.preview)??null,loading:!1,applying:!0,cleaning:((pt=Re[ne])==null?void 0:pt.cleaning)??!1,error:null}}});try{const Re=await w_(ne);Je(tt=>{var pt;return{...tt,[ne]:{preview:Re.preview,loading:!1,applying:!1,cleaning:((pt=tt[ne])==null?void 0:pt.cleaning)??!1,error:null}}}),an(),ze(),zn(ne,!0),Un(Re.preview.targetWorkspace.id),G.current({title:Re.applied?o("shell.worktreeMergeApplySuccess"):o("shell.worktreeMergeAlreadyMerged"),tone:"success"})}catch(Re){Je(tt=>{var pt,Ct;return{...tt,[ne]:{preview:((pt=tt[ne])==null?void 0:pt.preview)??null,loading:!1,applying:!1,cleaning:((Ct=tt[ne])==null?void 0:Ct.cleaning)??!1,error:Re instanceof Error?Re.message:o("shell.worktreeMergeApplyFailed")}}}),G.current({title:Re instanceof Error?Re.message:o("shell.worktreeMergeApplyFailed"),tone:"error"})}}},[zn,ze,Un,an]),Yr=p.useCallback(async O=>{var tt,pt;const ne=O.workspaceId,Re=nt&&((pt=(tt=He[ne])==null?void 0:tt.preview)==null?void 0:pt.alreadyMerged)===!0;Je(Ct=>{var Ut;return{...Ct,[ne]:{preview:((Ut=Ct[ne])==null?void 0:Ut.preview)??null,loading:!1,applying:!1,cleaning:!0,error:null}}});try{const Ct=await y_(ne,{deleteBranch:Re});if(Je(Ut=>{var Ht;return{...Ut,[ne]:{preview:((Ht=Ut[ne])==null?void 0:Ht.preview)??null,loading:!1,applying:!1,cleaning:!1,error:null}}}),yt(!1),gt(Ut=>(Ut==null?void 0:Ut.workspaceId)===ne?null:Ut),an(),await ze(),r(Fs(O.parentWorkspaceId),{replace:!0}),Ct.branchDeleted){G.current({title:o("shell.worktreeCleanupDeleteBranchSuccess",{branch:Ct.deletedBranchName||O.branchName}),tone:"success"});return}if(Ct.branchDeleteRequested){G.current({title:o("shell.worktreeCleanupDeleteBranchPartialFailed",{branch:O.branchName}),description:Ct.branchDeleteError||void 0,tone:"warning"});return}G.current({title:o("shell.worktreeCleanupSuccess"),tone:"success"})}catch(Ct){Je(Ut=>{var Ht;return{...Ut,[ne]:{preview:((Ht=Ut[ne])==null?void 0:Ht.preview)??null,loading:!1,applying:!1,cleaning:!1,error:Ct instanceof Error?Ct.message:o("shell.worktreeCleanupFailed")}}}),G.current({title:Ct instanceof Error?Ct.message:o("shell.worktreeCleanupFailed"),tone:"error"})}},[nt,r,ze,an,He]),ls=p.useCallback(O=>{yt(!1),gt(O)},[]),ts=p.useCallback(O=>{var ne;E.current=O,(ne=j.current)==null||ne.subscribeTerminalManager(O)},[]),Hr=p.useCallback(O=>{var ne;se.current=O,(ne=j.current)==null||ne.requestTerminalManagerRefresh(O)},[]),cs=p.useCallback(O=>(B.current.add(O),()=>{B.current.delete(O)}),[]),Ir=p.useCallback((O,ne)=>{Se(Re=>eB(Re,O,ne??new Date().toISOString()))},[]),vr=p.useCallback(async(O,ne)=>{w.current.set(O,ne),Se(Re=>yS(Re,O,ne));try{const Re=await SP(O,ne),tt=Vi(Re);tt===ne?w.current.set(O,tt):w.current.delete(O),$t(Re),an(),ze()}catch(Re){throw w.current.delete(O),Se(tt=>yS(tt,O,!ne)),Re}},[ze,an,$t]),wr=p.useCallback((O,ne)=>{Ft("workbench.set_session_workspace",{sessionId:O,workspaceId:ne}),cn(Re=>{if(!ne){if(!(O in Re))return Re;const tt={...Re};return delete tt[O],tt}return Re[O]===ne?Re:{...Re,[O]:ne}})},[]);p.useEffect(()=>{g.current=Y.length>0},[Y]),p.useEffect(()=>{Ft("workbench.navigation_state",{navigationLoading:re,workspaceCount:Y.length,sessionCount:Y.reduce((O,ne)=>O+ne.sessions.length,0)})},[Y,re]),p.useEffect(()=>{T.current!==null&&window.clearTimeout(T.current),T.current=window.setTimeout(()=>{var on;T.current=null,!(k.current||g.current)&&(Ft("workbench.refresh_navigation.ws_fallback_triggered"),(on=j.current)==null||on.requestRefresh())},1200);const O=new aP({onConnectionChange:on=>{on==="connected"&&QP(),on==="reconnect_failed"&&!g.current&&(Ue(o("shell.navigationLoadFailed")),G.current({id:"workbench-navigation-connection",title:o("shell.navigationLoadFailed"),tone:"warning",durationMs:3600}))},onSnapshot:on=>{k.current=!0,Ft("workbench.ws_snapshot_received",{workspaceCount:on.items.length,sessionCount:on.items.reduce((Zn,rs)=>Zn+rs.sessions.length,0)}),T.current!==null&&(window.clearTimeout(T.current),T.current=null),De(on),Ce(!1)},onFileTreeSnapshot:on=>{N.current.forEach(Zn=>Zn(on))},onGitSnapshot:on=>{_s(xD(on.workspaceId),{status:on.status,history:on.history,historyTotalCount:on.historyTotalCount,historyNextCursor:on.historyNextCursor,branches:on.branches}),Ie(Zn=>{var is;const rs=((is=Y.find(Zi=>Zi.workspace.id===on.workspaceId))==null?void 0:is.workspace)??null;if(!rs)return Zn;const Dr=Zn[on.workspaceId],ss=jD(CD((Dr==null?void 0:Dr.detail)??SD(rs),rs),on);return _s(ab(on.workspaceId),ss),{...Zn,[on.workspaceId]:{detail:ss,loading:!1,error:null}}}),D.current.forEach(Zn=>Zn(on))},onWorkspaceManagementSnapshot:on=>{_s(ab(on.workspaceId),on),Ie(Zn=>({...Zn,[on.workspaceId]:{detail:on,loading:!1,error:null}})),H.current.forEach(Zn=>Zn(on))},onTerminalManagerSnapshot:on=>{B.current.forEach(Zn=>Zn(on))},onUnauthorized:()=>{nr.clear(),r("/login",{replace:!0})}});j.current=O;const ne=I.current,Re=A.current,tt=L.current,pt=_.current,Ct=F.current,Ut=te.current,Ht=E.current,mn=se.current;return ne&&O.subscribeFileTree(ne.workspaceId,ne.paths),tt&&O.subscribeGit(tt),Ct&&O.subscribeWorkspaceManagement(Ct),Ht&&O.subscribeTerminalManager(Ht),Re&&O.requestFileTreeRefresh(Re.workspaceId,Re.paths),pt&&O.requestGitRefresh(pt),Ut&&O.requestWorkspaceManagementRefresh(Ut),mn&&O.requestTerminalManagerRefresh(mn),O.start(),()=>{T.current!==null&&(window.clearTimeout(T.current),T.current=null),j.current===O&&(j.current=null),O.close()}},[r]),p.useEffect(()=>{ko(Qx,String(ct))},[ct]),p.useEffect(()=>{ko(Jx,String(Ke))},[Ke]),p.useEffect(()=>{ko(Zx,String(vt))},[vt]),p.useEffect(()=>{ko(eS,String(_e))},[_e]),p.useEffect(()=>{if(!Ee){z2(jf);return}ko(jf,Ee)},[Ee]),p.useEffect(()=>{if(wt||_e)return;const O=window.setTimeout(()=>{me(!0)},r2);return()=>{window.clearTimeout(O)}},[wt,_e]);const Yt=Vc(t.pathname),bn=(Yt==null?void 0:Yt.sessionId)??null,yn=bn?MD(bn):!1,Tn=p.useMemo(()=>JN(Y),[Y]),or=p.useMemo(()=>new Set(qe),[qe]),ue=p.useMemo(()=>Tn.filter(O=>O.session.isFavorite===!0).map(O=>O.session.sessionId),[Tn]),Ve=p.useMemo(()=>new Set(ue),[ue]),St=p.useCallback(O=>{const ne=Pf(O,qe);f.current=ne,_d(ne),Le.current=O,Se(O)},[qe]),It=p.useCallback(O=>{const ne=!or.has(O),Re=xS(qe,O,ne),tt=Pf(Y,Re);f.current=tt,_d(tt),ke(Re),yP(O,{collapsed:ne}).catch(pt=>{const Ct=xS(Re,O,!ne),Ut=Pf(Y,Ct);f.current=Ut,_d(Ut),ke(Ct),G.current({title:pt instanceof Error?pt.message:o("shell.workspaceCollapseStateSaveFailed"),tone:"error"})})},[or,qe,Y]),vn=p.useCallback(()=>{pe.current={originalGroups:Le.current}},[]),fn=p.useCallback((O,ne,Re)=>{const tt=Le.current,pt=X2(tt,O,ne,Re);pt!==tt&&St(pt)},[St]),ln=p.useCallback(()=>{const O=pe.current;pe.current=null;const ne=Le.current;O&&(O.originalGroups.length===ne.length&&O.originalGroups.every((Re,tt)=>{var pt;return Re.workspace.id===((pt=ne[tt])==null?void 0:pt.workspace.id)})||d_({workspaceIds:ne.map(Re=>Re.workspace.id)}).catch(Re=>{St(O.originalGroups),G.current({title:Re instanceof Error?Re.message:o("shell.workspaceReorderFailed"),tone:"error"})}))},[St]);p.useEffect(()=>{const O=new Map;if(Tn.forEach(({session:ne})=>{O.set(ne.sessionId,{activityState:ne.activityState,completedAt:ne.completedAt??null,runningState:ne.runningState??null})}),!Q.current){Q.current=!0,P.current=O;return}Tn.forEach(({session:ne})=>{var Ut;if(ne.sessionId===bn)return;const Re=P.current.get(ne.sessionId);if(!Re)return;const tt=Re.activityState!=="completed_unread"&&ne.activityState==="completed_unread",pt=((Ut=ne.title)==null?void 0:Ut.trim())||o("common.unknown");if(d&&tt){const Ht=o("conversation.backgroundCompletionToastDescription",{title:pt});G.current({id:`workbench-session-completed-${ne.sessionId}-${ne.completedAt??"unknown"}`,title:o("conversation.backgroundCompletionToastTitle"),description:Ht,tone:"success",durationMs:8e3,action:{label:o("shell.contextOpenSession"),onClick:()=>kt(ne.workspaceId,ne.sessionId)}}),q.current.showNotification(o("conversation.backgroundCompletionToastTitle"),Ht)}const Ct=Re.runningState!=="failed"&&(ne.runningState??null)==="failed";if(m&&Ct){const Ht=f2(ne)??o("conversation.runtimeFailed"),mn=o("conversation.backgroundFailureToastDescription",{title:pt,detail:Ht});G.current({id:`workbench-session-failed-${ne.sessionId}-${ne.updatedAt}`,title:o("conversation.backgroundFailureToastTitle"),description:mn,tone:"error",durationMs:8e3,action:{label:o("shell.contextOpenSession"),onClick:()=>kt(ne.workspaceId,ne.sessionId)}}),q.current.showNotification(o("conversation.backgroundFailureToastTitle"),mn)}}),P.current=O},[bn,Tn,d,m,kt]),p.useEffect(()=>{R.current=Tn.map(O=>O.session).filter(O=>O.sessionId!==bn&&p2(O)).map(O=>{var ne;return{sessionId:O.sessionId,workspaceId:O.workspaceId,title:((ne=O.title)==null?void 0:ne.trim())||o("common.unknown")}})},[bn,Tn]),p.useEffect(()=>{let O=!1,ne=null;const Re=()=>{ne=window.setTimeout(()=>{tt().finally(()=>{O||Re()})},a2)},tt=async()=>{var Ht;const pt=R.current;if(pt.length===0){W.current||(W.current=!0);return}(Ht=j.current)==null||Ht.requestRefresh();const Ct=new Set(pt.map(mn=>mn.sessionId)),Ut=await Promise.all(pt.map(async mn=>{try{const on=await CP(mn.sessionId);return{session:mn,items:on.items}}catch{return{session:mn,items:null}}}));if(!O){for(const mn of Ut){if(!mn.items)continue;const on=mn.items.filter(Dr=>Dr.status==="pending"),Zn=new Set(on.map(Dr=>Dr.id)),rs=J.current.get(mn.session.sessionId)??new Set;W.current&&on.forEach(Dr=>{if(rs.has(Dr.id)||!c)return;const ss=o("conversation.backgroundPermissionToastDescription",{title:mn.session.title,requestTitle:Dr.title});G.current({id:`workbench-permission-request-${Dr.id}`,title:o("conversation.permissionRequestToastTitle"),description:ss,tone:"warning",durationMs:8e3,action:{label:o("shell.contextOpenSession"),onClick:()=>kt(mn.session.workspaceId,mn.session.sessionId)}}),q.current.showNotification(o("conversation.permissionRequestToastTitle"),ss)}),J.current.set(mn.session.sessionId,Zn)}for(const[mn,on]of J.current.entries())!Ct.has(mn)&&on.size===0&&J.current.delete(mn);W.current=!0}};return tt().finally(()=>{O||Re()}),()=>{O=!0,ne!==null&&window.clearTimeout(ne)}},[c,kt]),p.useEffect(()=>{if(re&&Y.length===0)return;const O=new Set(Y.map(ne=>ne.workspace.id));ke(ne=>vD(ne,O)),$e(ne=>ne&&O.has(ne)?ne:null)},[Y,re]);const jr=Tn.find(O=>O.session.sessionId===bn)??null,Gn=(jr==null?void 0:jr.workspace.id)??(bn?Rt[bn]??null:null),zr=cS(t.pathname,t.search),us=Gn??zr??Ee??null,zt=us??((so=Y[0])==null?void 0:so.workspace.id)??null,V=p.useMemo(()=>rt.filter(O=>!Ne.has(O.id)),[Ne,rt]),fe=p.useMemo(()=>V.filter(O=>x2(O,Hn)).length,[V,Hn]);p.useEffect(()=>{Wt&&ir(V)},[V,ir,Wt]);const xe=p.useCallback(O=>{Kt(!1),O.routePath&&r(O.routePath)},[r]),at=p.useCallback(async(O,ne)=>{const Re=K.current+1;K.current=Re;try{const tt=await RO(O,ne);if(Re!==K.current)return;Lt(pt=>{const Ct=new Set(pt);return tt.item?Ct.add(tt.item.notificationId):Ct.delete(O),Ct})}catch(tt){if(Re!==K.current)return;G.current({title:o("shell.globalNotificationsArchiveFailed"),description:tt instanceof Error?tt.message:void 0,tone:"error"})}},[]);p.useEffect(()=>{Gn&&$e(O=>O===Gn?O:Gn)},[Gn]),p.useEffect(()=>{Ft("workbench.current_workspace_resolved",{currentSessionId:bn,sessionWorkspaceId:Gn,routeWorkspaceId:zr,currentWorkspaceId:zt,source:Gn?jr?"navigation":"sessionWorkspaceMap":zr?"route":Ee?"workspaceSelection":"navigationFallback"})},[jr,bn,zt,zr,Ee,Gn]),p.useEffect(()=>{Ft("workbench.info_panel_state",{infoPanelReady:wt,rightCollapsed:_e,currentWorkspaceId:zt,sessionWorkspaceId:Gn,currentSessionId:bn})},[bn,zt,wt,_e,Gn]);const ht=dS(t.pathname)?"terminals":Nf(t.pathname)?"butler":"conversation",ot=e==="mobile",tn=j2(e),Ln=p.useMemo(()=>Y.map(O=>{const ne=oD(O.sessions);return{workspace:O.workspace,visibleSessions:ne,archivedSessions:O.sessions.filter(Re=>Vi(Re)&&!xm(Re)),visibleSessionTree:Ov(ne,l).filter(Re=>!Ve.has(Re.item.sessionId)&&!pm(Si(Re),tt=>Ve.has(tt.sessionId))),childWorktrees:dD(O.childWorktrees,Ve,l),isCollapsed:or.has(O.workspace.id)}}),[or,Ve,Y,l]),Jn=p.useMemo(()=>vm(Y),[Y]),Nr=p.useMemo(()=>V2(Y,zt),[zt,Y]),Ks=p.useMemo(()=>zt?(Nr==null?void 0:Nr.workspace)??Y.map(O=>O.workspace).find(O=>O.id===zt)??null:null,[zt,Nr,Y]),Er=(Nr==null?void 0:Nr.meta)??null,Lr=(zt?Jn[zt]??null:null)??(Ks?Mu(Ks):null),xs=Er?He[Er.workspaceId]??null:null,lr=p.useMemo(()=>Tn.filter(O=>Ve.has(O.session.sessionId)&&!Vi(O.session)&&!sb(O.session)),[Ve,Tn]),Di=t.pathname.startsWith("/settings")?"settings":Nf(t.pathname)?"terminals":dS(t.pathname)?"butler":N2(t.pathname)?t.pathname.endsWith("/tools/processes")||t.pathname==="/tools/processes"?"butler":"sessions":T2(t.pathname)||uS(t.pathname)?"sessions":"workspaces",ds=ot&&(Di==="sessions"&&uS(t.pathname)||Nf(t.pathname)),Xi=fm({isNativeMobile:s.isNativeMobile,viewportClass:s.viewportClass}),Xr=Pu({viewportClass:s.viewportClass,activeEntry:Di,hasNavigationPanel:ot,hasAuxiliaryPanel:ot,preferCompactLayout:Xi}),Qr=ot&&rP(Xr),hi=ot&&sP(Xr),mi=p.useMemo(()=>Y.map(O=>O.workspace),[Y]),Ri=p.useMemo(()=>{const O=Be.trim().toLowerCase();return O?Tn.filter(ne=>{const Re=(ne.session.title||"").toLowerCase(),tt=ne.workspace.name.toLowerCase(),pt=Sm(ne.session.provider,"full").toLowerCase();return Re.includes(O)||tt.includes(O)||pt.includes(O)}):[]},[Tn,Be]);p.useEffect(()=>{var ne;const O=zt??((ne=Y[0])==null?void 0:ne.workspace.id)??"";O&&xn(Re=>Re&&Y.some(pt=>pt.workspace.id===Re)?Re:O)},[zt,Y]),p.useEffect(()=>{bn&&!yn&&ko(Cf,`${t.pathname}${t.search}`)},[bn,yn,t.pathname,t.search]),p.useEffect(()=>{if(bn&&yn){y.current=`${t.pathname}${t.search}`;return}bn&&!yn&&(y.current=null)},[bn,yn,t.pathname,t.search]),p.useEffect(()=>{ot||(Ye(!1),ae(!1))},[ot]),p.useEffect(()=>{!ot||re||!C2(t.pathname)||us||(Ye(!1),ae(!1),r(tn,{replace:!0}))},[us,ot,t.pathname,r,re,tn]);function qr(){if(ot){Ye(!0);return}Te(!1)}function $(){if(Pt(),ot){ae(!0);return}we(!1)}function be(){if(ot){Ye(O=>!O);return}Te(O=>!O)}function lt(){if(Pt(),ot){ae(O=>!O);return}we(O=>!O)}function Pt(){me(!0)}function en(O){$e(O),Pt(),bn&&Gn!==O&&r(tn)}const ns=p.useCallback(async O=>{var tt;const ne=((tt=Tn.find(pt=>pt.session.sessionId===O))==null?void 0:tt.session)??null,Re=(ne==null?void 0:ne.isFavorite)!==!0;Se(pt=>kS(pt,O,Re));try{const pt=await g_(O,Re);$t(pt),an()}catch(pt){throw Se(Ct=>kS(Ct,O,!Re)),pt}},[Tn,an,$t]),Ai=p.useCallback((O,ne)=>{iD(O,ne).then(()=>{r(ZN(O,ne))}).catch(Re=>{i({title:Re instanceof Error?Re.message:o("shell.startSessionFailed"),tone:"error"})})},[r,i]),Qi=p.useCallback(O=>{var tt;const ne=((tt=O.workspaceId)==null?void 0:tt.trim())||zt,Re=P2(O.filePath);return!ne||!Re?!1:(Pt(),Ge("files"),ot?(Ye(!1),ae(!0)):we(!1),ce({requestId:S.current+1,workspaceId:ne,filePath:Re,openViewer:O.openViewer===!0}),S.current+=1,!0)},[zt,ot]),wa=p.useCallback(async(O,ne)=>{const Re=await xP(O,ne.trim());return $t(Re),Re},[$t]);function ya(O){Gt(!0)}function no(){Gt(!1),ie("sessions"),Mt(""),Et(null),wn([]),Nn(!1)}async function $o(){const O=Be.trim();if(!O||!Tt.trim()){wn([]),Et(null);return}Nn(!0),Et(null);try{const ne=await _c(Tt,O);wn(ne.items)}catch(ne){wn([]),Et(ne instanceof Error?ne.message:o("shell.searchCodeFailed"))}finally{Nn(!1)}}function pi(O,ne){const Re=O==="left"?ct:Ke;function tt(Ct){const Ut=Ct.clientX-ne;if(O==="left"){Nt(Hd(Re+Ut,Bd,nS));return}ut(Hd(Re-Ut,Bd,rS))}function pt(){document.removeEventListener("mousemove",tt),document.removeEventListener("mouseup",pt)}document.addEventListener("mousemove",tt),document.addEventListener("mouseup",pt)}function ka(){if(Vo())return;if(Tn.length===0){r(tn);return}const O=Yn(Tn[0].workspace.id,Tn[0].session.sessionId);r(O)}function Yl(){if(!Vo(zt)){if(zt){r(Ni(zt));return}r(tn)}}function Vo(O){if(bn)return O&&Gn&&Gn!==O?!1:(r(`${t.pathname}${t.search}`),!0);if(y.current){if(O){const[Re,tt=""]=y.current.split("?"),pt=cS(Re??y.current,tt?`?${tt}`:"");if(pt&&pt!==O)return!1}return r(y.current),!0}const ne=typeof window>"u"?null:window.localStorage.getItem(Cf);if(ne){const Re=ne.split("?")[0]??ne,tt=Vc(Re);if(tt){const pt=tt.sessionId,Ct=Tn.find(mn=>mn.session.sessionId===pt)??null,Ut=tt.workspaceId??(Ct==null?void 0:Ct.workspace.id)??null;if(Ct!==null&&(!O||Ut===O))return r(ne),!0}window.localStorage.removeItem(Cf)}return!1}p.useEffect(()=>{if(typeof window>"u")return;function O(ne){if(!(ne.metaKey||ne.ctrlKey)){ne.key==="Escape"&&(Ye(!1),ae(!1));return}if(q2(ne.target))return;const tt=ne.key.toLowerCase();if(!ne.shiftKey&&tt==="b"){ne.preventDefault(),be();return}if(ne.shiftKey&&tt==="i"){ne.preventDefault(),lt();return}if(!ne.shiftKey&&tt===","){ne.preventDefault(),r("/settings");return}if(!ne.shiftKey&&tt==="1"){ne.preventDefault(),ka();return}if(!ne.shiftKey&&tt==="2"){ne.preventDefault(),r(zt?Ro(zt):As());return}if(!ne.shiftKey&&tt==="k"){ne.preventDefault(),$2();return}ne.shiftKey&&tt==="r"&&(ne.preventDefault(),ze())}return window.addEventListener("keydown",O),()=>{window.removeEventListener("keydown",O)}},[r,ze,ot,ka]);const Xl=p.useMemo(()=>({shellMode:e,navigationGroups:Y,navigationLoading:re,navigationError:Xe,currentWorkspaceId:zt,currentSessionId:bn,favoriteSessionIds:ue,favoriteSessions:lr,globalNotifications:rt,archivedNotificationIds:Array.from(Ne),showArchivedNotifications:un,unreadNotificationCount:fe,refreshNavigation:ze,requestNavigationRefresh:an,openNotificationPanel:()=>{Kt(!0)},closeNotificationPanel:()=>{Kt(!1)},setShowArchivedNotifications:En,archiveNotification:O=>{at(O,!0)},unarchiveNotification:O=>{at(O,!1)},setAuxiliaryPanel:jt,subscribeFileTree:Zt,requestFileTreeRefresh:Pn,addFileTreeSnapshotListener:Sr,subscribeGitSnapshot:Jt,requestGitRefresh:Un,addGitSnapshotListener:gr,subscribeWorkspaceManagementSnapshot:ar,requestWorkspaceManagementRefresh:qn,addWorkspaceManagementSnapshotListener:br,workspaceManagementStateById:ge,subscribeTerminalManagerSnapshot:ts,requestTerminalManagerRefresh:Hr,addTerminalManagerSnapshotListener:cs,selectWorkspace:en,toggleFavoriteSession:ns,archiveSession:O=>vr(O,!0),unarchiveSession:O=>vr(O,!1),renameSession:wa,startDraftSession:Ai,markNavigationSessionSeen:Ir,upsertNavigationSession:$t,setSessionWorkspace:wr,revealWorkspaceFile:Qi}),[Sr,gr,br,cs,vr,bn,zt,rt,ue,lr,en,Ne,Ir,Xe,Y,re,fe,Pn,Un,qn,ze,an,En,jt,Hr,wa,un,ge,e,Ai,wr,Zt,Jt,ar,ts,at,ns,$t,Qi]),Ql={"--workbench-left-width":`${ct}px`,"--workbench-left-current-width":vt?"0px":`${ct}px`,"--workbench-right-width":`${Ke}px`,"--workbench-right-current-width":_e?"0px":`${Ke}px`},ro=ht==="butler"?We:n.jsx(jS,{panelReady:wt,activeTab:Pe,fileRevealRequest:Z,onTabChange:O=>{Pt(),Ge(O)},currentSessionId:yn?null:bn,activeWorkspaceId:zt,navigationGroups:Y,workspaceContext:Lr,worktreeMeta:Er,worktreeMergeState:xs,onRefreshWorktreeMergePreview:zn,onApplyWorktreeMerge:Cr,onCleanupWorktree:Yr}),Ji=ro!==null,Go=s.isDesktop&&s.ui.osFamily==="macos"&&s.ui.prefersOverlayTitlebar;p.useLayoutEffect(()=>{const O=U.current;if(!O||!Go||typeof window>"u"){oS(O);return}let ne=null,Re=null;const tt=new Set([O]),pt=()=>{const Ut=window.getComputedStyle(O),Ht=sD(Ut,"--desktop-macos-traffic-light-center-y");if(Ht===null){oS(O);return}const mn={navToolbar:_a(O,dr.navToolbar.selector),infoTabs:_a(O,dr.infoTabs.selector),auxiliaryToolbarButton:_a(O,dr.auxiliaryToolbarButton.selector),conversationHeaderMain:_a(O,dr.conversationHeaderMain.selector),conversationHeaderActions:_a(O,dr.conversationHeaderActions.selector),terminalTabbarMain:_a(O,dr.terminalTabbarMain.selector),collapsedLeftControls:_a(O,dr.collapsedLeftControls.selector),collapsedRightControls:_a(O,dr.collapsedRightControls.selector)},on=[mn.infoTabs,mn.conversationHeaderMain,mn.conversationHeaderActions,mn.terminalTabbarMain].filter(ss=>ss!==null),Zn=[mn.collapsedLeftControls,mn.collapsedRightControls].filter(ss=>ss!==null),rs=Zn.length>0?_i(Ut,"--workbench-collapsed-controls-live-shift-y",Ht,Zn.reduce((ss,is)=>ss+is,0)/Zn.length):null,Dr=on.length>0?_i(Ut,"--workbench-titlebar-live-content-shift-y",Ht,on.reduce((ss,is)=>ss+is,0)/on.length):null;Fi(O,"--workbench-titlebar-live-content-shift-y",Dr),Fi(O,"--workbench-collapsed-controls-live-shift-y",rs),Fi(O,dr.navToolbar.variableName,_i(Ut,dr.navToolbar.variableName,Ht,mn.navToolbar)),Fi(O,dr.infoTabs.variableName,_i(Ut,dr.infoTabs.variableName,Ht,mn.infoTabs)),Fi(O,dr.auxiliaryToolbarButton.variableName,_i(Ut,dr.auxiliaryToolbarButton.variableName,Ht,mn.auxiliaryToolbarButton)),Fi(O,dr.conversationHeaderMain.variableName,_i(Ut,dr.conversationHeaderMain.variableName,Ht,mn.conversationHeaderMain)),Fi(O,dr.conversationHeaderActions.variableName,_i(Ut,dr.conversationHeaderActions.variableName,Ht,mn.conversationHeaderActions)),Fi(O,dr.terminalTabbarMain.variableName,_i(Ut,dr.terminalTabbarMain.variableName,Ht,mn.terminalTabbarMain)),Fi(O,dr.collapsedLeftControls.variableName,_i(Ut,dr.collapsedLeftControls.variableName,Ht,mn.collapsedLeftControls)),Fi(O,dr.collapsedRightControls.variableName,_i(Ut,dr.collapsedRightControls.variableName,Ht,mn.collapsedRightControls))},Ct=()=>{ne!==null&&window.cancelAnimationFrame(ne),ne=window.requestAnimationFrame(()=>{ne=null,pt()})};if(Ct(),typeof ResizeObserver<"u"){Re=new ResizeObserver(()=>{Ct()});for(const Ut of Object.values(dr))for(const Ht of O.querySelectorAll(Ut.selector))tt.add(Ht);for(const Ut of tt)Re.observe(Ut)}return window.addEventListener("resize",Ct),()=>{ne!==null&&window.cancelAnimationFrame(ne),window.removeEventListener("resize",Ct),Re==null||Re.disconnect()}},[ht,wt,vt,t.pathname,t.search,_e,Ji,Go]);const Ko=ot?n.jsx(CS,{workspaceGroups:Ln,workspaceVisualContextMap:Jn,sessionDisplaySortMode:l,favoriteSessions:lr,favoriteSessionIds:Ve,activeWorkspaceId:zt,isConversationActive:ht==="conversation",isTerminalActive:ht==="terminals",isButlerActive:ht==="butler",isSearchOpen:Vt,navigationLoading:re,navigationError:Xe,activeSessionId:bn,onRefreshNavigation:ze,onSessionUpdated:$t,onNavigateConversation:ka,onNavigateTerminals:()=>{Ye(!1),r(zt?Ro(zt):As())},onNavigateButler:()=>{Ye(!1),r(zt?$i(zt):As())},onOpenSearch:()=>{Ye(!1),ya()},onOpenSettings:()=>{Ye(!1),r("/settings")},onSelectWorkspace:en,onToggleWorkspaceCollapse:It,onStartWorkspaceReorder:vn,onPreviewWorkspaceReorder:fn,onCommitWorkspaceReorder:ln,allowWorkspaceReorder:!1,subscribeGitSnapshot:Jt,requestGitRefresh:Un,subscribeWorkspaceManagementSnapshot:ar,requestWorkspaceManagementRefresh:qn,onToggleFavoriteSession:ns,onArchiveSession:O=>vr(O,!0),onUnarchiveSession:O=>vr(O,!1),workspaceManagementStateById:ge,setWorkspaceManagementStateById:Ie,unreadNotificationCount:fe,notificationPanelOpen:Wt,onToggleNotificationPanel:()=>{Kt(O=>!O)},onClose:()=>Ye(!1)}):null,Yo=ot&&Ji?ro:null;return n.jsxs(aD.Provider,{value:Xl,children:[ot?n.jsx(n.Fragment,{children:n.jsx(CF,{activeEntry:Di,presentation:ds?"conversation-focus":"default",navigationPanel:Ko,auxiliaryPanel:Yo,onOpenNavigation:()=>{ae(!1),Ye(!0)},onOpenSearch:()=>{Ye(!1),ae(!1),ya()},onOpenAuxiliary:()=>{Ji&&(Pt(),Ye(!1),ae(!0))},onNavigateWorkspaces:()=>{Ye(!1),ae(!1),r(As())},onNavigateTerminals:()=>{Ye(!1),ae(!1),r(zt?Ro(zt):As())},onNavigateButler:()=>{Ye(!1),ae(!1),r(zt?$i(zt):As())},onNavigateSessions:()=>{Ye(!1),ae(!1),Yl()},onNavigateToolFiles:()=>{Ye(!1),ae(!1),r(zt?XN(zt):As())},onNavigateToolGit:()=>{Ye(!1),ae(!1),r(zt?QN(zt):As())},onNavigateToolProcesses:()=>{Ye(!1),ae(!1),r(zt?rv(zt):As())},onNavigateSettings:()=>{Ye(!1),ae(!1),r("/settings")},children:n.jsx(Kg,{})})}):n.jsx("div",{className:"workbench-shell",ref:U,style:Ql,"data-nav-loading":re,"data-left-collapsed":vt,"data-right-collapsed":_e,"data-info-ready":wt,"data-runtime-platform":s.platform,"data-os-family":s.ui.osFamily,"data-overlay-titlebar":s.ui.prefersOverlayTitlebar,children:n.jsxs("div",{className:"workbench-body-shell",children:[n.jsx("aside",{className:"workbench-nav surface-card","data-collapsed":vt,children:n.jsx(CS,{workspaceGroups:Ln,workspaceVisualContextMap:Jn,sessionDisplaySortMode:l,favoriteSessions:lr,favoriteSessionIds:Ve,activeWorkspaceId:zt,isConversationActive:ht==="conversation",isTerminalActive:ht==="terminals",isButlerActive:ht==="butler",isSearchOpen:Vt,navigationLoading:re,navigationError:Xe,activeSessionId:bn,onRefreshNavigation:ze,onSessionUpdated:$t,onNavigateConversation:ka,onNavigateTerminals:()=>r(zt?Ro(zt):As()),onNavigateButler:()=>r(zt?$i(zt):As()),onOpenSearch:()=>ya(),onOpenSettings:()=>r("/settings"),onSelectWorkspace:en,onToggleWorkspaceCollapse:It,onStartWorkspaceReorder:vn,onPreviewWorkspaceReorder:fn,onCommitWorkspaceReorder:ln,allowWorkspaceReorder:!0,subscribeGitSnapshot:Jt,requestGitRefresh:Un,subscribeWorkspaceManagementSnapshot:ar,requestWorkspaceManagementRefresh:qn,onToggleFavoriteSession:ns,onArchiveSession:O=>vr(O,!0),onUnarchiveSession:O=>vr(O,!1),workspaceManagementStateById:ge,setWorkspaceManagementStateById:Ie,unreadNotificationCount:fe,notificationPanelOpen:Wt,onToggleNotificationPanel:()=>{Kt(O=>!O)},onToggleCollapse:()=>Te(!0)})}),n.jsx("div",{className:"workbench-side-resizer","data-side":"left","data-collapsed":vt,role:"separator","aria-label":o("shell.leftResizerLabel"),onMouseDown:vt?void 0:O=>pi("left",O.clientX)}),n.jsxs("div",{className:"workbench-main-shell",children:[n.jsxs("div",{className:"workbench-collapsed-rail","aria-hidden":!vt&&!_e,children:[n.jsxs("div",{className:"workbench-collapsed-controls left","data-visible":vt,children:[n.jsx(SS,{className:"workbench-nav-toolbar-button workbench-collapsed-button",ariaLabel:o("shell.showSessionSidebar"),side:"left",collapsed:!0,onClick:qr}),n.jsx(eD,{collapsed:!0}),n.jsx(ND,{unreadCount:fe,open:Wt,onToggle:()=>{Kt(O=>!O)},collapsed:!0}),n.jsx("button",{type:"button",className:"workbench-nav-toolbar-button workbench-collapsed-button","aria-label":o("shell.goBack"),title:o("shell.goBack"),onClick:()=>r(-1),children:n.jsx(PD,{})}),n.jsx("button",{type:"button",className:"workbench-nav-toolbar-button workbench-collapsed-button","aria-label":o("shell.goForward"),title:o("shell.goForward"),onClick:()=>r(1),children:n.jsx(DD,{})})]}),Ji?n.jsx("div",{className:"workbench-collapsed-controls right","data-visible":_e,children:n.jsx(SS,{className:"workbench-nav-toolbar-button workbench-collapsed-button",ariaLabel:o("shell.showInfoSidebar"),side:"right",collapsed:!0,onClick:$})}):null]}),n.jsx(Kg,{})]}),Ji?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"workbench-side-resizer","data-side":"right","data-collapsed":_e,role:"separator","aria-label":o("shell.rightResizerLabel"),onMouseDown:_e?void 0:O=>pi("right",O.clientX)}),n.jsx("aside",{className:"workbench-auxiliary surface-card","data-workspace-tone":(Lr==null?void 0:Lr.tone)??"root","data-worktree-depth":(Lr==null?void 0:Lr.depth)??0,"data-collapsed":_e,"data-custom-panel":ht==="butler",style:ai(Lr),children:ht==="butler"?n.jsx("div",{className:"workbench-auxiliary-custom-panel",children:We}):n.jsx(jS,{panelReady:wt,activeTab:Pe,fileRevealRequest:Z,onTabChange:O=>{Pt(),Ge(O)},onToggleCollapse:()=>we(!0),currentSessionId:yn?null:bn,activeWorkspaceId:zt,navigationGroups:Y,workspaceContext:Lr,worktreeMeta:Er,worktreeMergeState:xs,onRefreshWorktreeMergePreview:zn,onApplyWorktreeMerge:Cr,onCleanupWorktree:ls})})]}):null]})}),n.jsx(cB,{open:Wt,notifications:rt,archivedNotificationIds:Ne,showArchivedNotifications:un,onClose:()=>Kt(!1),onToggleShowArchivedNotifications:En,onArchiveNotification:O=>{at(O,!0)},onUnarchiveNotification:O=>{at(O,!1)},onSelectNotification:xe,preferredWorkspaceId:zt,preferredSessionId:yn?null:bn}),n.jsx(CB,{open:Vt,mode:pn,keyword:Be,codeWorkspaceId:Tt,codeResults:In,codeLoading:dn,codeError:Sn,workspaceOptions:mi,sessionResults:Ri,onClose:no,onModeChange:O=>{ie(O),Et(null),wn([])},onKeywordChange:O=>{Mt(O),pn==="code"&&!O.trim()&&(wn([]),Et(null))},onCodeWorkspaceChange:O=>xn(O),onCodeSearch:()=>{$o()},onOpenSession:O=>{no();const ne=Tn.find(Re=>Re.session.sessionId===O)??null;r(ne?Yn(ne.workspace.id,O):As())}}),n.jsxs(Fn,{open:ft!==null,title:o("shell.worktreeCleanupModalTitle"),description:o("shell.worktreeCleanupModalDescription"),onClose:()=>{var O;ft&&((O=He[ft.workspaceId])!=null&&O.cleaning)||(yt(!1),gt(null))},children:[n.jsx("p",{className:"workbench-section-empty",children:ft?o("shell.worktreeCleanupConfirm",{name:ft.displayName||ft.branchName}):""}),ft?n.jsxs("div",{className:"worktree-cleanup-modal-options",children:[n.jsxs("label",{className:"conversation-selection-checkbox worktree-cleanup-modal-option",children:[n.jsx("input",{type:"checkbox",checked:nt,disabled:!!((Qo=He[ft.workspaceId])!=null&&Qo.cleaning)||((io=(Ys=He[ft.workspaceId])==null?void 0:Ys.preview)==null?void 0:io.alreadyMerged)!==!0,onChange:O=>yt(O.target.checked)}),n.jsx("span",{children:o("shell.worktreeCleanupDeleteBranchLabel",{branch:ft.branchName})})]}),((de=(z=He[ft.workspaceId])==null?void 0:z.preview)==null?void 0:de.alreadyMerged)!==!0?n.jsx("p",{className:"conversation-selection-hint worktree-cleanup-modal-hint",children:o("shell.worktreeCleanupDeleteBranchHint")}):null]}):null,n.jsxs("div",{className:"workbench-modal-actions",children:[n.jsx("button",{type:"button",className:"secondary-button",disabled:!!(ft&&((Ae=He[ft.workspaceId])!=null&&Ae.cleaning)),onClick:()=>{yt(!1),gt(null)},children:o("common.cancel")}),n.jsx("button",{type:"button",className:nt&&ft&&((mt=(it=He[ft.workspaceId])==null?void 0:it.preview)==null?void 0:mt.alreadyMerged)===!0?"secondary-button workbench-danger-button":"primary-button",disabled:!ft||!!(ft&&((gn=He[ft.workspaceId])!=null&&gn.cleaning)),onClick:()=>{ft&&Yr(ft)},children:ft&&((Ot=He[ft.workspaceId])!=null&&Ot.cleaning)?o("shell.worktreeCleanupRunning"):nt&&ft&&((Pr=(Bn=He[ft.workspaceId])==null?void 0:Bn.preview)==null?void 0:Pr.alreadyMerged)===!0?o("shell.worktreeCleanupDeleteBranchAction"):o("shell.worktreeCleanupAction")})]})]}),ot?n.jsxs(n.Fragment,{children:[Qr?null:n.jsx(TS,{isOpen:dt,side:"left",onClose:()=>Ye(!1),children:Ko}),hi?null:n.jsx(TS,{isOpen:Dt,side:"right",onClose:()=>ae(!1),children:Yo})]}):null]})}function TS({isOpen:e,side:t,onClose:r,children:s,className:i,overlayClassName:l}){if(!e)return null;const c=n.jsxs(n.Fragment,{children:[n.jsx("div",{className:["mobile-nav-overlay","open",l].filter(Boolean).join(" "),onClick:r,role:"button",tabIndex:0,"aria-label":o("common.back"),onKeyDown:d=>{d.key==="Escape"&&r()}}),n.jsx("div",{className:["mobile-nav-drawer",t,"open",i].filter(Boolean).join(" "),children:s})]});return typeof document>"u"?c:Vn.createPortal(c,document.body)}function Mr(){return p.useContext(aD)??{navigationGroups:[],navigationLoading:!1,navigationError:null,shellMode:"desktop",currentWorkspaceId:null,currentSessionId:null,favoriteSessionIds:[],favoriteSessions:[],globalNotifications:[],archivedNotificationIds:[],showArchivedNotifications:!1,unreadNotificationCount:0,refreshNavigation:async()=>{},requestNavigationRefresh:()=>{},openNotificationPanel:()=>{},closeNotificationPanel:()=>{},setShowArchivedNotifications:()=>{},archiveNotification:()=>{},unarchiveNotification:()=>{},setAuxiliaryPanel:()=>{},subscribeFileTree:()=>{},requestFileTreeRefresh:()=>{},addFileTreeSnapshotListener:()=>()=>{},subscribeGitSnapshot:()=>{},requestGitRefresh:()=>{},addGitSnapshotListener:()=>()=>{},subscribeWorkspaceManagementSnapshot:()=>{},requestWorkspaceManagementRefresh:()=>{},addWorkspaceManagementSnapshotListener:()=>()=>{},workspaceManagementStateById:{},subscribeTerminalManagerSnapshot:()=>{},requestTerminalManagerRefresh:()=>{},addTerminalManagerSnapshotListener:()=>()=>{},selectWorkspace:()=>{},toggleFavoriteSession:async()=>{},archiveSession:async()=>{},unarchiveSession:async()=>{},renameSession:async()=>{throw new Error("workbench shell unavailable")},startDraftSession:()=>{},setSessionWorkspace:()=>{},upsertNavigationSession:()=>{},markNavigationSessionSeen:()=>{},revealWorkspaceFile:()=>!1}}function MD(e){return e.startsWith("draft-")}function Df(e,t){if(!e)return{allowed:!1,hidden:!1,reason:o("conversation.capabilityDenied")};switch(t){case"send_message":return e.canSendMessage===!1?{allowed:!1,hidden:!1,reason:o("conversation.capabilitySendDisabled")}:{allowed:!0,hidden:!1,reason:null};case"attachments":return e.supportsAttachments?{allowed:!0,hidden:!1,reason:null}:{allowed:!1,hidden:!1,reason:o("conversation.capabilityAttachmentDisabled")};case"interrupt":return e.supportsInterrupt?{allowed:!0,hidden:!1,reason:null}:{allowed:!1,hidden:!1,reason:o("conversation.capabilityInterruptDisabled")};default:return{allowed:!1,hidden:!1,reason:o("conversation.capabilityDenied")}}}const RB=new Set(["updateplan"]),ID=new Set(["todowrite"]),ob=new Set(["todoread"]),ED=new Set(["taskcreate","taskupdate","taskget","tasklist","taskdelete","taskremove"]);function AB(e,t){const r=IB(e,t);return r||EB(e,t)}function LD(e){return e.reduce((t,r)=>(t[r.status]+=1,t),{pending:0,in_progress:0,completed:0,failed:0,cancelled:0})}function MB(e,t,r){if(!e)return null;if(lb(e.name)){const c=Il(e);if(!c||!Tm(c.value))return null;const d=FD(c.value,r);return!d||d.items.length===0?null:{provider:t,source:"plan",explanation:d.explanation,items:d.items,updatedAt:r}}const s=jm(e.name);if(!ID.has(s)&&!ob.has(s)&&!ED.has(s))return null;const i=Il(e,(ob.has(s),"prefer-output"));if(!i)return null;if(s==="taskdelete"||s==="taskremove"){const c=_D(i.value);return c.length>0?{provider:t,source:"todo",explanation:null,items:c.map((d,m)=>({id:d,title:`Task ${m+1}`,status:"cancelled",detail:d,updatedAt:r})),updatedAt:r}:null}const l=Uc(i.value,r);return l.length===0?null:{provider:t,source:lb(e.name)?"plan":"todo",explanation:null,items:l,updatedAt:r}}function IB(e,t){let r=null;for(const s of e){const i=s.toolCall;if(!i||jm(i.name)===""||!lb(i.name))continue;const l=Il(i);if(!l||typeof l.value!="object"||l.value===null)continue;const c=FD(l.value,s.timestamp);!c||c.items.length===0||(r={provider:t,source:"plan",explanation:c.explanation,items:c.items,updatedAt:s.timestamp})}return r}function EB(e,t){const r=new Map;let s=null;for(const l of e){const c=l.toolCall;if(!c)continue;const d=jm(c.name);if(ID.has(d)){const v=Il(c),g=v?Uc(v.value,l.timestamp):[];g.length>0&&(Rf(r,g),s=l.timestamp);continue}if(ob.has(d)){const v=Il(c,"prefer-output"),g=v?Uc(v.value,l.timestamp):[];g.length>0&&(Rf(r,g),s=l.timestamp);continue}if(!ED.has(d))continue;const m=Il(c,"prefer-output");if(!m)continue;if(d==="tasklist"||d==="taskget"){const v=Uc(m.value,l.timestamp);v.length>0&&(Rf(r,v),s=l.timestamp);continue}if(d==="taskdelete"||d==="taskremove"){const v=_D(m.value);if(v.length>0){for(const g of v)r.delete(g);s=l.timestamp}continue}const f=Uc(m.value,l.timestamp);if(f.length!==0){for(const v of f)FB(r,v);s=l.timestamp}}const i=Array.from(r.values()).sort((l,c)=>l.updatedAt.localeCompare(c.updatedAt)).map(l=>({...l}));return i.length===0||!s?null:{provider:t,source:"todo",explanation:null,items:i,updatedAt:s}}function lb(e){return RB.has(jm(e))}function FD(e,t){const r=Array.isArray(e.plan)?e.plan:null;if(!r||r.length===0)return null;const s=r.map((i,l)=>OD(i,{fallbackIdPrefix:"plan",fallbackTitle:`Step ${l+1}`,fallbackStatus:"pending",updatedAt:t})).filter(i=>i!==null);return s.length===0?null:{items:s,explanation:xr(e.explanation)}}function Il(e,t="prefer-input"){const r=t==="prefer-output"?[{text:e.output,source:"output"},{text:e.input,source:"input"}]:[{text:e.input,source:"input"},{text:e.output,source:"output"}];for(const s of r){const i=LB(s.text);if(i!==null)return{value:i,source:s.source}}return null}function LB(e){const t=(e==null?void 0:e.trim())??"";if(!t)return null;const r=qd(t);if(r!==null)return r;const s=t.match(/```(?:json)?\s*([\s\S]+?)```/i);if(s!=null&&s[1]){const m=qd(s[1].trim());if(m!==null)return m}const i=t.indexOf("{"),l=t.lastIndexOf("}");if(i>=0&&l>i){const m=qd(t.slice(i,l+1));if(m!==null)return m}const c=t.indexOf("["),d=t.lastIndexOf("]");return c>=0&&d>c?qd(t.slice(c,d+1)):null}function qd(e){try{return JSON.parse(e)}catch{return null}}function Uc(e,t){return Gc(e).map((s,i)=>OD(s,{fallbackIdPrefix:"task",fallbackTitle:`Task ${i+1}`,fallbackStatus:"pending",updatedAt:t})).filter(s=>s!==null)}function Gc(e){if(Array.isArray(e))return e.flatMap(r=>Gc(r));if(!Tm(e))return[];if(WB(e))return[e];const t=["tasks","todos","items","entries","results","data"];for(const r of t){if(!(r in e))continue;const s=Gc(e[r]);if(s.length>0)return s}return Object.values(e).flatMap(r=>Gc(r))}function _D(e){const r=Gc(e).map(i=>cb(i)).filter(i=>i!==null);if(r.length>0)return r;if(!Tm(e))return[];const s=cb(e);return s?[s]:[]}function OD(e,t){if(!Tm(e))return null;const r=xr(e.step)??xr(e.title)??xr(e.content)??xr(e.task)??xr(e.text)??xr(e.name)??xr(e.subject)??xr(e.description)??t.fallbackTitle,s=cb(e)??BB(t.fallbackIdPrefix,r),i=OB(e,r);return{id:s,title:r,status:_B(e.status,t.fallbackStatus),detail:i,updatedAt:t.updatedAt}}function FB(e,t){const r=e.get(t.id);if(!r){e.set(t.id,{...t});return}e.set(t.id,{id:r.id,title:t.title||r.title,status:t.status,detail:t.detail??r.detail,updatedAt:t.updatedAt})}function Rf(e,t){e.clear();for(const r of t)e.set(r.id,{...r})}function _B(e,t){var s;const r=(s=xr(e))==null?void 0:s.toLowerCase().replace(/[\s-]+/g,"_");return r?["pending","todo","open","queued","not_started","created"].includes(r)?"pending":["in_progress","progress","active","doing","running","started"].includes(r)?"in_progress":["completed","complete","done","success","succeeded","finished","closed"].includes(r)?"completed":["failed","error","errored"].includes(r)?"failed":["cancelled","canceled","aborted","skipped"].includes(r)?"cancelled":t:t}function OB(e,t){const r=[xr(e.detail),xr(e.details),xr(e.description),xr(e.reason),xr(e.summary),xr(e.note),xr(e.priority)].filter(s=>s!==null);for(const s of r)if(s!==t)return s;return null}function cb(e){return xr(e.id)??xr(e.taskId)??xr(e.task_id)??xr(e.uuid)??xr(e.key)}function BB(e,t){return`${e}:${t.trim().toLowerCase()}`}function WB(e){return[e.step,e.title,e.content,e.task,e.text,e.subject,e.name,e.description].some(t=>xr(t)!==null)}function jm(e){return e.trim().toLowerCase().replace(/[\s_.-]+/g,"")}function Tm(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function xr(e){if(typeof e!="string")return null;const t=e.trim();return t||null}function UB(){return n.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",className:"conversation-action-icon",children:[n.jsx("rect",{x:"7",y:"5",width:"9",height:"11",rx:"2.5"}),n.jsx("path",{d:"M5.5 12.5H5A2 2 0 0 1 3 10.5V5a2 2 0 0 1 2-2h5.5"})]})}function HB(){return n.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",className:"conversation-action-icon",children:[n.jsx("circle",{cx:"6",cy:"5",r:"2.25"}),n.jsx("circle",{cx:"14",cy:"6",r:"2.25"}),n.jsx("circle",{cx:"14",cy:"14",r:"2.25"}),n.jsx("path",{d:"M8.4 5.7h2.2a2.7 2.7 0 0 1 2.7 2.7v1.2"}),n.jsx("path",{d:"M8.1 5.9l4.1 6.2"})]})}function zB(){return n.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",className:"conversation-action-icon",children:[n.jsx("path",{d:"M10 2.8l1.6 3.4 3.8.5-2.8 2.6.7 3.9-3.3-1.8-3.3 1.8.7-3.9-2.8-2.6 3.8-.5L10 2.8z"}),n.jsx("path",{d:"M15.8 13.3l.7 1.5 1.7.2-1.2 1.1.3 1.8-1.5-.8-1.5.8.3-1.8-1.2-1.1 1.7-.2.7-1.5z"})]})}function BD(){return n.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",className:"conversation-action-icon",children:[n.jsx("circle",{cx:"6",cy:"5",r:"2.2"}),n.jsx("circle",{cx:"14",cy:"5",r:"2.2"}),n.jsx("circle",{cx:"10",cy:"14",r:"2.2"}),n.jsx("path",{d:"M8.2 5h3.6"}),n.jsx("path",{d:"M10 7.2v4.6"}),n.jsx("path",{d:"M7.3 6.8l1.7 4"}),n.jsx("path",{d:"M12.7 6.8l-1.7 4"})]})}function qB(){return n.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",className:"conversation-action-icon",children:[n.jsx("path",{d:"M4.5 5.5h1.2"}),n.jsx("path",{d:"M8 5.5h7.5"}),n.jsx("path",{d:"M4.5 10h1.2"}),n.jsx("path",{d:"M8 10h7.5"}),n.jsx("path",{d:"M4.5 14.5h1.2"}),n.jsx("path",{d:"M8 14.5h7.5"}),n.jsx("path",{d:"M5.1 5.5l.5.5 1-1"}),n.jsx("circle",{cx:"5.1",cy:"10",r:".8",fill:"currentColor",stroke:"none"}),n.jsx("path",{d:"M5.1 14.5l.5.5 1-1"})]})}const NS={in_progress:0,failed:1,pending:2,completed:3,cancelled:4};function $B({provider:e,messages:t,variant:r="header"}){const[s,i]=p.useState(!1),l=p.useMemo(()=>AB(t,e),[t,e]);if(!l||l.items.length===0)return null;const c=LD(l.items),d=c.in_progress||c.pending,m=d>0?d:l.items.length,f=[...l.items].sort((g,w)=>{const k=NS[g.status]-NS[w.status];return k!==0?k:g.updatedAt.localeCompare(w.updatedAt)}),v=r==="composer"?"conversation-task-progress-button composer-task-progress-button":"conversation-header-ai-button conversation-task-progress-button";return n.jsxs(n.Fragment,{children:[n.jsxs("button",{type:"button",className:v,"data-variant":r,"aria-label":o("conversation.taskProgressButton",{count:l.items.length}),title:o("conversation.taskProgressButton",{count:l.items.length}),onClick:()=>{i(!0)},children:[n.jsx("span",{className:"conversation-header-ai-button-label","aria-hidden":"true",children:n.jsx(qB,{})}),n.jsx("span",{className:"conversation-task-progress-badge",children:m})]}),n.jsx(Fn,{open:s,title:o("conversation.taskProgressModalTitle"),description:o("conversation.taskProgressModalDescription",{count:l.items.length}),className:"conversation-task-progress-modal",onClose:()=>{i(!1)},children:n.jsxs("div",{className:"conversation-task-progress-modal-body",children:[n.jsxs("div",{className:"conversation-task-progress-summary",children:[n.jsx(Cc,{label:o("conversation.taskProgressSummaryTotal"),value:l.items.length}),n.jsx(Cc,{label:o("conversation.taskProgressStatusInProgress"),value:c.in_progress}),n.jsx(Cc,{label:o("conversation.taskProgressStatusPending"),value:c.pending}),n.jsx(Cc,{label:o("conversation.taskProgressStatusCompleted"),value:c.completed}),c.failed>0?n.jsx(Cc,{label:o("conversation.taskProgressStatusFailed"),value:c.failed}):null]}),l.explanation?n.jsxs("div",{className:"conversation-task-progress-explanation",children:[n.jsx("strong",{children:o("conversation.taskProgressExplanationTitle")}),n.jsx("p",{children:l.explanation})]}):null,n.jsx("ol",{className:"conversation-task-progress-list",children:f.map(g=>n.jsxs("li",{className:"conversation-task-progress-item","data-status":g.status,children:[n.jsx("span",{className:"conversation-task-progress-item-indicator","data-status":g.status,"aria-hidden":"true"}),n.jsxs("div",{className:"conversation-task-progress-item-body",children:[n.jsxs("div",{className:"conversation-task-progress-item-header",children:[n.jsx("strong",{children:g.title}),n.jsx("span",{className:"conversation-task-progress-item-status",children:VB(g.status)})]}),g.detail?n.jsx("p",{className:"conversation-task-progress-item-detail",children:g.detail}):null]})]},g.id))})]})})]})}function Cc({label:e,value:t}){return n.jsxs("div",{className:"conversation-task-progress-summary-card",children:[n.jsx("span",{children:e}),n.jsx("strong",{children:t})]})}function VB(e){switch(e){case"in_progress":return o("conversation.taskProgressStatusInProgress");case"completed":return o("conversation.taskProgressStatusCompleted");case"failed":return o("conversation.taskProgressStatusFailed");case"cancelled":return o("conversation.taskProgressStatusCancelled");case"pending":default:return o("conversation.taskProgressStatusPending")}}const GB="codingns.conversation.composer-draft:",KB=1,YB=[{id:"builtin-stage-and-summarize",text:"请将本次会话变更的所有代码提交到git暂存区,然后总结一条中文的提交信息"},{id:"builtin-review-module",text:"分析本项目 模块的代码实现,并分析存在的问题"},{id:"builtin-group-commits",text:"分析当前项目中的未提交文件,按照功能模块进行分类提交,提交信息格式请参考我最近的提交记录"}];function Bv(){return typeof window<"u"&&typeof window.localStorage<"u"}function XB(e){if(!e||typeof e!="object")return null;const t="id"in e?e.id:null,r="fileName"in e?e.fileName:null,s="mimeType"in e?e.mimeType:null,i="fileSize"in e?e.fileSize:null,l="lastModified"in e?e.lastModified:null,c="contentBase64"in e?e.contentBase64:null;if(typeof t!="string"||typeof r!="string"||typeof s!="string"||typeof i!="number"||typeof l!="number"||typeof c!="string")return null;const d=t.trim(),m=r.trim(),f=s.trim(),v=c.trim();return!d||!m||!f||i<0||l<0||!v?null:{id:d,fileName:m,mimeType:f,fileSize:i,lastModified:l,contentBase64:v}}function QB(e){if(!e||typeof e!="object")return null;const t="content"in e?e.content:null,r="attachments"in e?e.attachments:null;if(typeof t!="string"||!Array.isArray(r))return null;const s=r.map(i=>XB(i)).filter(i=>i!==null);return s.length!==r.length||t.length===0&&s.length===0?null:{content:t,attachments:s}}function Kc(e){return`${GB}${e}`}function JB(e){var t,r;return{id:((r=(t=globalThis.crypto)==null?void 0:t.randomUUID)==null?void 0:r.call(t))??`phrase-${Date.now()}-${Math.random().toString(16).slice(2)}`,text:e.trim()}}function ZB(e){if(!Bv())return null;const t=e.trim();if(!t)return null;const r=window.localStorage.getItem(Kc(t));if(!r)return null;try{const s=JSON.parse(r),i=s&&typeof s=="object"&&"draft"in s&&s.draft&&typeof s.draft=="object"?s.draft:s,l=QB(i);return l||(window.localStorage.removeItem(Kc(t)),null)}catch{return window.localStorage.removeItem(Kc(t)),null}}function eW(e,t){if(!Bv())return!1;const r=e.trim();if(!r)return!1;if(t.content.length===0&&t.attachments.length===0)return WD(r),!0;try{return window.localStorage.setItem(Kc(r),JSON.stringify({schemaVersion:KB,draft:t})),!0}catch{return!1}}function WD(e){if(!Bv())return;const t=e.trim();t&&window.localStorage.removeItem(Kc(t))}const PS="workbench:focus-composer",Yc="provider-default",DS=["codex","claude-code","opencode","gemini","kimi"],tW=new Set(["codex","claude-code","opencode"]),nW=new Set(["codex","claude-code","opencode"]),RS={position:"absolute",width:"1px",height:"1px",padding:0,margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0};function rW(e){return[{id:Yc,name:o("conversation.modelUseCliDefault"),provider:e,usesProviderDefault:!0}]}function AS(e){return rW(e)}function MS(e){return e.usesProviderDefault===!0||e.id===Yc}function sW(){var e,t;return((t=(e=globalThis.crypto)==null?void 0:e.randomUUID)==null?void 0:t.call(e))??`${Date.now()}-${Math.random().toString(16).slice(2)}`}function IS(e){if(e){e.value="";try{const t=e.showPicker;if(typeof t=="function"){t.call(e);return}}catch{}e.click()}}function iW(e,t,r,s){const i=globalThis.atob(r),l=Uint8Array.from(i,c=>c.charCodeAt(0));return new File([l],e,{type:t,lastModified:s})}function aW(e){return e.trim().toLowerCase().startsWith("image/")}function Xc(e){const t=e.type.trim().toLowerCase();return t.length>0?t:"application/octet-stream"}function UD(e){return aW(Xc(e))?"image":"file"}function HD(e,t=sW()){const r=UD(e);return{id:t,file:e,kind:r,previewUrl:r==="image"?URL.createObjectURL(e):null}}function oW(e){const t=iW(e.fileName,e.mimeType,e.contentBase64,e.lastModified);return HD(t,e.id)}function lW(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function cW(e){const t=e.trim().replace(/\s+/g," ");return t.length===0?o("conversation.forkDraftEmpty"):t.length>140?`${t.slice(0,140)}…`:t}function uW(e,t){return t===e?nW.has(t)?null:o("conversation.forkProviderNativeUnsupported"):tW.has(t)?null:o("conversation.forkProviderReconstructedUnsupported")}function zD(e){return(e==null?void 0:e.canStartSession)===!1}function dW(e){return zD(e)?(e==null?void 0:e.limitations[0])??o("conversation.capabilityDenied"):null}function hW(e,t){return{id:t,kind:UD(e),fileName:e.name,mimeType:Xc(e),fileSize:e.size}}function ES(e){return new Promise((t,r)=>{const s=new FileReader;s.onerror=()=>{r(s.error??new Error("FILE_READ_FAILED"))},s.onload=()=>{const i=typeof s.result=="string"?s.result:"",l=i.includes(",")?i.split(",").at(-1)??"":i;t(l)},s.readAsDataURL(e)})}function mW(e){e.forEach(t=>{t.previewUrl&&URL.revokeObjectURL(t.previewUrl)})}function pW(e,t){const r=new Set(e.map(i=>`${i.file.name}:${i.file.size}:${i.file.lastModified}`)),s=[...e];return t.forEach(i=>{const l=`${i.name}:${i.size}:${i.lastModified}`;r.has(l)||(r.add(l),s.push(HD(i)))}),s}function Nm({capabilities:e,placeholder:t,draftStorageId:r,forkDraft:s=null,onClearForkDraft:i,onForkDraftChange:l,panelRef:c,portalContainer:d=null,hasActiveRun:m=null,canInterrupt:f=null,contextUsage:v=null,taskProvider:g=null,taskMessages:w=[],hasPendingQueuedMessages:k=!1,isSubmitting:y,isRunning:S=!1,onInterrupt:T,onQueueSend:j,onSend:N}){const D=sr(),H=p.useId(),B=p.useId(),[I,A]=p.useState(""),[L,_]=p.useState(""),[F,te]=p.useState("medium"),[E,se]=p.useState([]),[X,K]=p.useState(!1),[G,q]=p.useState(!1),[U,Q]=p.useState(YB),[P,W]=p.useState(!1),[J,R]=p.useState(!1),[ve,pe]=p.useState(""),[Y,Se]=p.useState(!1),[Le,re]=p.useState(!1),[Ce,Xe]=p.useState(!1),[Ue,ct]=p.useState(!1),[Nt,Ke]=p.useState(null),[ut,vt]=p.useState(!1),[Te,_e]=p.useState({}),[we,qe]=p.useState(null),ke=p.useRef(null),Ee=p.useRef(null),$e=p.useRef(null),wt=p.useRef(!1),me=p.useRef(new Set),Pe=p.useRef(new Map),Ge=p.useRef(0),{showToast:dt}=Qn(),Ye=di(),Dt=X_(e),ae=ma(ue=>cf(Dt)?ue.profile.providers[Dt]:null),We=(ae==null?void 0:ae.defaultModel)??null,jt=(ae==null?void 0:ae.defaultReasoningLevel)??null,Rt=p.useMemo(()=>Df(e,"send_message"),[e]),cn=p.useMemo(()=>Df(e,"interrupt"),[e]),Vt=p.useMemo(()=>Df(e,"attachments"),[e]),Gt=p.useMemo(()=>{var Ve;const ue=(Ve=e==null?void 0:e.modelOptions)==null?void 0:Ve.map(St=>{var It;return{...St,provider:Dt,supportedReasoningEfforts:(It=St.supportedReasoningEfforts)==null?void 0:It.filter(vn=>vn==="low"||vn==="medium"||vn==="high"||vn==="xhigh")}});return ue!=null&&ue.length?ue:AS(Dt)},[e==null?void 0:e.modelOptions,Dt]),pn=p.useMemo(()=>Gt.find(ue=>ue.id===L)??null,[Gt,L]),ie=J_(e),Be=Q_(e),Mt=p.useMemo(()=>[{value:"low",label:o("conversation.reasoningLow")},{value:"medium",label:o("conversation.reasoningMedium")},{value:"high",label:o("conversation.reasoningHigh")},{value:"xhigh",label:o("conversation.reasoningMaximum")}],[]),Tt=p.useMemo(()=>{if(!ie)return[];const ue=pn==null?void 0:pn.supportedReasoningEfforts;return!ue||ue.length===0?Mt:Mt.filter(Ve=>ue.includes(Ve.value))},[ie,Mt,pn==null?void 0:pn.supportedReasoningEfforts]),xn=p.useMemo(()=>Gt.map(ue=>({value:ue.id,label:MS(ue)?o("conversation.modelUseCliDefault"):ue.name})),[Gt]),dn=p.useMemo(()=>Tt.map(ue=>({value:ue.value,label:ue.label})),[Tt]),Nn=p.useMemo(()=>[{command:"/plan",label:o("conversation.slashCommandPlan")},{command:"/review",label:o("conversation.slashCommandReview")},{command:"/explain",label:o("conversation.slashCommandExplain")}],[]),Sn=(e==null?void 0:e.inRunInputMode)??"none",Et=!!s,In=(s==null?void 0:s.targetProvider)??null,wn=!!s&&(e==null?void 0:e.provider)===In,Z=p.useMemo(()=>s?wn?e:Nt??Ga(s.targetProvider):null,[e,Nt,s,wn]),ce=p.useMemo(()=>{var Ve;if(!s)return[];const ue=(Ve=Z==null?void 0:Z.modelOptions)==null?void 0:Ve.map(St=>{var It;return{...St,provider:s.targetProvider,supportedReasoningEfforts:(It=St.supportedReasoningEfforts)==null?void 0:It.filter(vn=>vn==="low"||vn==="medium"||vn==="high"||vn==="xhigh")}});return ue!=null&&ue.length?ue:AS(s.targetProvider)},[Z==null?void 0:Z.modelOptions,s]),ge=p.useMemo(()=>ce.map(ue=>({value:ue.id,label:MS(ue)?o("conversation.modelUseCliDefault"):ue.name})),[ce]),Ie=p.useMemo(()=>!s||!s.targetModel?Yc:ce.some(ue=>ue.id===s.targetModel)?s.targetModel:Yc,[ce,s]),He=p.useMemo(()=>s?DS.filter(ue=>uW(s.sourceProvider,ue)!==null?!1:!zD(Te[ue]??null)):[],[s,Te]),Je=p.useMemo(()=>s?He.length>0?He:[s.targetProvider]:[],[s,He]),ft=p.useMemo(()=>Je.map(ue=>({value:ue,label:Vs(ue,"full")})),[Je]),gt=p.useMemo(()=>s?dW(Te[s.targetProvider]??Z??null):null,[Z,s,Te]),nt=m??null,yt=S&&Sn==="streaming_guidance"&&nt===!1&&!FP(e),rt=!Et&&S&&Sn==="streaming_guidance"&&!yt,oe=!Et&&S&&typeof j=="function"&&Z_(e,nt),Ne=!Et&&S&&!rt&&!oe,Lt=Et&&!!gt,Wt=I.trim().length>0||E.length>0,Kt=f??cn.allowed,En=S&&Kt&&!!T&&!Ce&&!Wt&&!Ue&&!y,Hn=!En&&!Wt&&(Ue||y||S||!S&&k),jn=o(Ue||y||k?"conversation.sendingState":"conversation.runtimeRunning"),Qt=o(S?oe?"conversation.queueGuidanceButton":rt?"conversation.sendGuidanceButton":"conversation.sendButton":"conversation.sendButton"),ir=p.useCallback(ue=>{_(ue),cf(Dt)&&nu({providers:{[Dt]:{defaultModel:ue}}}).catch(()=>{})},[Dt]),De=p.useCallback(ue=>{te(ue),cf(Dt)&&nu({providers:{[Dt]:{defaultReasoningLevel:ue}}}).catch(()=>{})},[Dt]),ze=p.useCallback(ue=>{me.current.forEach(Ve=>{URL.revokeObjectURL(Ve)}),me.current.clear(),ue.forEach(Ve=>{Ve.previewUrl&&me.current.add(Ve.previewUrl)}),se(ue)},[]),$t=p.useCallback(ue=>{ue.length!==0&&se(Ve=>{const St=pW(Ve,ue);return St.forEach(It=>{It.previewUrl&&me.current.add(It.previewUrl)}),St})},[]),an=p.useCallback(ue=>{Pe.current.delete(ue),se(Ve=>{const St=Ve.find(It=>It.id===ue);return St!=null&&St.previewUrl&&(me.current.delete(St.previewUrl),URL.revokeObjectURL(St.previewUrl)),Ve.filter(It=>It.id!==ue)})},[]),kt=p.useCallback(ue=>{const Ve=Array.from(ue.target.files??[]);Ve.length>0&&$t(Ve),ue.target.value=""},[$t]),Zt=p.useCallback(ue=>{var St;D.isMobile||!Vt.allowed||Ne||!((((St=ue.dataTransfer.files)==null?void 0:St.length)??0)>0||Array.from(ue.dataTransfer.items??[]).some(It=>It.kind==="file"))||(ue.preventDefault(),ue.dataTransfer.dropEffect="copy",G||q(!0),re(!1))},[Vt.allowed,G,Ne,D.isMobile]),Pn=p.useCallback(ue=>{const Ve=ue.relatedTarget;Ve instanceof Node&&ue.currentTarget.contains(Ve)||q(!1)},[]),Sr=p.useCallback(ue=>{if(D.isMobile||!Vt.allowed||Ne)return;const Ve=Array.from(ue.dataTransfer.files??[]);Ve.length!==0&&(ue.preventDefault(),q(!1),$t(Ve))},[Vt.allowed,Ne,$t,D.isMobile]),Jt=p.useCallback(ue=>{if(!Vt.allowed||Ne)return;const Ve=ue==="camera"?$e.current:Ee.current;IS(Ve),K(!1)},[Vt.allowed,Ne]),Un=p.useCallback(()=>{if(!(!Vt.allowed||Ne)){if(re(!1),D.isNativeMobile){Ye.trigger("selection"),K(!0);return}IS(Ee.current)}},[Vt.allowed,Ye,Ne,D.isNativeMobile]),gr=p.useCallback(()=>{re(ue=>!ue)},[]),ar=p.useCallback(ue=>{var Ve;A(St=>St.trimStart().startsWith(ue)?St:St.trim()?`${ue} ${St.trim()}`:`${ue} `),re(!1),(Ve=ke.current)==null||Ve.focus()},[]),qn=p.useCallback(async ue=>{const Ve=U;Ge.current+=1,Q(ue),Se(!0);try{const St=await S_(ue.map(It=>({id:It.id,text:It.text})));return Q(St.items.map(It=>({id:It.id,text:It.text}))),!0}catch(St){return Q(Ve),dt({title:St instanceof Error?St.message:o("conversation.quickPhraseSaveFailed"),tone:"error"}),!1}finally{Se(!1)}},[U,dt]),br=p.useCallback(async()=>{const ue=ve.trim();!ue||!await qn([...U,JB(ue)])||(pe(""),R(!1))},[qn,ve,U]),zn=p.useCallback(ue=>{qn(U.filter(Ve=>Ve.id!==ue))},[qn,U]),Cr=p.useCallback((ue,Ve)=>{const St=U.findIndex(ln=>ln.id===ue);if(St<0)return;const It=St+Ve;if(It<0||It>=U.length)return;const vn=[...U],[fn]=vn.splice(St,1);vn.splice(It,0,fn),qn(vn)},[qn,U]),Yr=p.useCallback(ue=>{var Ve;A(ue),W(!1),(Ve=ke.current)==null||Ve.focus()},[]),ls=p.useCallback(ue=>{const Ve=ue?ZB(ue):null,St=(Ve==null?void 0:Ve.attachments.map(It=>oW(It)))??[];Pe.current=new Map(((Ve==null?void 0:Ve.attachments)??[]).map(It=>[It.id,It])),ze(St),A((Ve==null?void 0:Ve.content)??""),re(!1)},[ze]);p.useEffect(()=>{if(!Gt.length)return;if(We&&Gt.some(Ve=>Ve.id===We)){L!==We&&_(We);return}if(Gt.some(Ve=>Ve.id===L))return;const ue=Gt[0].id;_(ue)},[Gt,Dt,L,We]),p.useEffect(()=>{if(!eO(Dt)||Tt.length===0)return;if(jt&&Tt.some(St=>St.value===jt)){F!==jt&&te(jt);return}const ue=e==null?void 0:e.defaultReasoningLevel;if(ue&&Tt.some(St=>St.value===ue)){F!==ue&&te(ue);return}if(Tt.some(St=>St.value===F))return;const Ve=Tt[0].value;te(Ve)},[Tt,e==null?void 0:e.defaultReasoningLevel,Dt,F,jt]),p.useEffect(()=>{let ue=!1;const Ve=Ge.current;return x_().then(St=>{ue||Ge.current!==Ve||Q(St.items.map(It=>({id:It.id,text:It.text})))}).catch(()=>{}),()=>{ue=!0}},[]),p.useEffect(()=>{ls(r)},[r,ls]),p.useEffect(()=>{if(!r)return;const ue=r,Ve=new Set(E.map(vn=>vn.id));Pe.current.forEach((vn,fn)=>{Ve.has(fn)||Pe.current.delete(fn)});let St=!1;async function It(){if(I.length===0&&E.length===0){WD(ue);return}const vn=await Promise.all(E.map(async fn=>{const ln=Pe.current.get(fn.id);return ln&&ln.fileName===fn.file.name&&ln.fileSize===fn.file.size&&ln.lastModified===fn.file.lastModified&&ln.mimeType===Xc(fn.file)?ln:{id:fn.id,fileName:fn.file.name,mimeType:Xc(fn.file),fileSize:fn.file.size,lastModified:fn.file.lastModified,contentBase64:await ES(fn.file)}}));St||(Pe.current=new Map(vn.map(fn=>[fn.id,fn])),eW(ue,{content:I,attachments:vn}))}return It(),()=>{St=!0}},[E,I,r]),p.useEffect(()=>{const ue=ke.current;ue&&(ue.style.height="0px",ue.style.height=`${Math.min(ue.scrollHeight,120)}px`)},[I]),p.useEffect(()=>{Vt.allowed||(Pe.current.clear(),K(!1),ze([]))},[Vt.allowed,ze]),p.useEffect(()=>{D.isMobile||K(!1)},[D.isMobile]),p.useEffect(()=>()=>{me.current.forEach(ue=>{URL.revokeObjectURL(ue)}),me.current.clear()},[]),p.useEffect(()=>{function ue(){var Ve;(Ve=ke.current)==null||Ve.focus()}return window.addEventListener(PS,ue),()=>{window.removeEventListener(PS,ue)}},[]),p.useEffect(()=>{if(!s){Ke(null),vt(!1),_e({}),qe(null);return}if(wn){Ke(null),vt(!1);return}let ue=!1;return Ke(Ga(s.targetProvider)),vt(!0),zl(s.targetProvider,s.workspaceId).then(Ve=>{ue||Ke(Ve)}).catch(()=>{ue||Ke(Ga(s.targetProvider))}).finally(()=>{ue||vt(!1)}),()=>{ue=!0}},[s==null?void 0:s.targetProvider,s==null?void 0:s.workspaceId,wn]),p.useEffect(()=>{if(!s){_e({});return}let ue=!1;return Nv(DS,s.workspaceId).then(Ve=>{ue||_e(Ve)}),()=>{ue=!0}},[s==null?void 0:s.workspaceId]),p.useEffect(()=>{!s||!l||He.length!==0&&(He.includes(s.targetProvider)||l({...s,targetProvider:He[0]??s.targetProvider,targetModel:null}))},[s,l,He]),p.useEffect(()=>{!s||!s.targetModel||!l||ce.some(ue=>ue.id===s.targetModel)||l({...s,targetModel:null})},[ce,s,l]);const ts=p.useCallback(ue=>{if(!(!s||!l||ue===s.targetProvider)){if(ue!==s.sourceProvider&&s.targetProvider===s.sourceProvider){qe(ue);return}l({...s,targetProvider:ue,targetModel:null})}},[s,l]),Hr=p.useCallback(ue=>{!s||!l||l({...s,targetModel:ue===Yc?null:ue})},[s,l]),cs=p.useCallback(()=>{!s||!we||!l||(l({...s,targetProvider:we,targetModel:null}),qe(null))},[s,l,we]),Ir=p.useCallback(()=>{qe(null)},[]);async function vr(ue){if(wt.current)return;const Ve=I.trim(),St=E;if(Ve.length===0&&St.length===0||!Rt.allowed||Ne||Lt){dt({title:Ne?o("conversation.runtimeRunning"):gt??Rt.reason??o("conversation.capabilityDenied"),tone:"error"});return}wt.current=!0,Ye.trigger(ue==="queue"?"selection":"action"),ct(!0),A(""),se([]),K(!1),q(!1),W(!1),R(!1),re(!1);try{const It=await Promise.all(St.map(async ln=>({kind:ln.kind,fileName:ln.file.name,mimeType:Xc(ln.file),fileSize:ln.file.size,contentBase64:await ES(ln.file)}))),vn=St.map(ln=>hW(ln.file,ln.id));await(ue==="queue"&&j?j:N)(Ve,{model:Et||pn!=null&&pn.usesProviderDefault?void 0:L||void 0,reasoningLevel:Et?void 0:ie&&Tt.length>0?F:void 0,attachments:It,attachmentMeta:vn}),mW(St),St.forEach(ln=>{ln.previewUrl&&me.current.delete(ln.previewUrl)})}catch(It){A(Ve),se(St),dt({title:It instanceof Error&&It.message==="FILE_READ_FAILED"?o("conversation.attachmentReadFailed"):It instanceof Error?It.message:o("conversation.capabilityDenied"),tone:"error"})}finally{ct(!1),wt.current=!1}}async function wr(ue){ue.preventDefault(),await vr(oe?"queue":"send")}async function Yt(){if(!(!Kt||!T||Ce))try{Xe(!0),Ye.trigger("action"),await T()}catch(ue){dt({title:ue instanceof Error?ue.message:o("conversation.capabilityInterruptDisabled"),tone:"error"})}finally{Xe(!1)}}const bn=Ue||y||Ne||Lt||!Rt.allowed||!Wt,yn=Ue||y||Ne||!Vt.allowed,Tn=I.length===0&&!Ne,or=n.jsxs("section",{ref:c,className:"composer-panel",children:[n.jsxs("form",{className:"composer-form",onSubmit:wr,children:[n.jsx("input",{id:H,ref:Ee,type:"file",multiple:!0,tabIndex:-1,"aria-hidden":"true",style:RS,onChange:kt}),n.jsx("input",{id:B,ref:$e,type:"file",accept:"image/*",capture:"environment",tabIndex:-1,"aria-hidden":"true",style:RS,onChange:kt}),n.jsxs("div",{className:"composer-input-container","data-drag-active":G?"true":void 0,onDragOver:Zt,onDragLeave:Pn,onDrop:Sr,children:[s?n.jsxs("div",{className:"composer-fork-draft",children:[n.jsxs("div",{className:"composer-fork-draft-main",children:[n.jsxs("div",{className:"composer-fork-draft-copy",children:[n.jsx("span",{className:"composer-fork-draft-label",children:o("conversation.forkDraftLabel")}),n.jsx("span",{className:"composer-fork-draft-text",children:cW(s.content)})]}),n.jsxs("div",{className:"composer-fork-config",children:[n.jsxs("div",{className:"composer-fork-config-grid",children:[n.jsxs("div",{className:"composer-fork-field",children:[n.jsx("span",{className:"composer-fork-model-label",children:o("conversation.forkTargetProviderLabel")}),n.jsx($d,{ariaLabel:o("conversation.forkTargetProviderLabel"),value:s.targetProvider,options:ft,onChange:ue=>ts(ue),compact:!0})]}),n.jsxs("div",{className:"composer-fork-field",children:[n.jsx("span",{className:"composer-fork-model-label",children:o("conversation.forkTargetModelLabel")}),n.jsx($d,{ariaLabel:o("conversation.forkTargetModelLabel"),value:Ie,options:ge,onChange:Hr,disabled:ut||Lt,compact:!0})]})]}),gt?n.jsx("p",{className:"composer-capability-hint",children:gt}):null]})]}),i?n.jsx("button",{type:"button",className:"composer-fork-draft-clear","aria-label":o("conversation.forkDraftClear"),title:o("conversation.forkDraftClear"),onClick:i,children:n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}):null]}):null,E.length>0?n.jsx("div",{className:"composer-attachments",children:E.map(ue=>n.jsxs("div",{className:"composer-attachment-card",children:[ue.previewUrl?n.jsx("img",{src:ue.previewUrl,alt:o("conversation.attachmentPreviewAlt"),className:"composer-attachment-preview"}):n.jsx("div",{className:"composer-attachment-file","aria-hidden":"true",children:n.jsxs("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[n.jsx("path",{d:"M14 2H7a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V7z"}),n.jsx("path",{d:"M14 2v5h5"}),n.jsx("path",{d:"M9 13h6"}),n.jsx("path",{d:"M9 17h6"})]})}),n.jsxs("div",{className:"composer-attachment-meta",children:[n.jsx("span",{className:"attachment-name",title:ue.file.name,children:ue.file.name}),n.jsx("span",{className:"attachment-size",children:lW(ue.file.size)})]}),n.jsx("button",{type:"button",className:"attachment-remove",onClick:()=>an(ue.id),"aria-label":o("conversation.removeAttachment"),children:n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},ue.id))}):null,G?n.jsx("div",{className:"composer-drop-hint",children:o("conversation.attachmentDropHint")}):null,n.jsxs("div",{className:"composer-input-wrapper",children:[n.jsx("textarea",{ref:ke,className:"composer-input",value:I,placeholder:t??o("conversation.composerPlaceholder"),readOnly:Ne,"aria-readonly":Ne,onChange:ue=>A(ue.target.value),rows:1,onFocus:()=>re(!1),onPaste:ue=>{if(Ne||!Vt.allowed)return;const Ve=Array.from(ue.clipboardData.items).filter(St=>St.kind==="file").map(St=>St.getAsFile()).filter(St=>!!St);Ve.length!==0&&(ue.preventDefault(),$t(Ve))},onKeyDown:ue=>{ue.key==="Escape"&&re(!1),ue.key==="Enter"&&!ue.shiftKey&&(ue.preventDefault(),bn||wr(ue))}}),Tn?n.jsx("button",{type:"button",className:"composer-quick-phrase-trigger","aria-label":o("conversation.quickPhraseTrigger"),title:o("conversation.quickPhraseTrigger"),onClick:()=>{W(!0),re(!1)},children:n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("path",{d:"M7 8h10"}),n.jsx("path",{d:"M7 12h8"}),n.jsx("path",{d:"M7 16h5"}),n.jsx("path",{d:"M5 5h14v14H9l-4 4V5z"})]})}):null]}),Le?n.jsx("div",{className:"composer-slash-menu",role:"menu","aria-label":o("conversation.slashMenuTitle"),children:Nn.map(ue=>n.jsxs("button",{type:"button",className:"composer-slash-item",onClick:()=>ar(ue.command),children:[n.jsx("span",{className:"composer-slash-command",children:ue.command}),n.jsx("span",{className:"composer-slash-label",children:ue.label})]},ue.command))}):null,n.jsxs("div",{className:"composer-controls",children:[n.jsxs("div",{className:"composer-controls-left",children:[Vt.allowed?D.isNativeMobile?n.jsx("button",{type:"button",className:"composer-attach-btn","aria-label":o("conversation.attachFiles"),title:o("conversation.attachFiles"),disabled:yn,onClick:Un,children:n.jsx(Af,{})}):yn?n.jsx("button",{type:"button",className:"composer-attach-btn","aria-label":o("conversation.attachFiles"),title:o("conversation.attachFiles"),disabled:!0,children:n.jsx(Af,{})}):n.jsx("label",{htmlFor:H,className:"composer-attach-btn","aria-label":o("conversation.attachFiles"),title:o("conversation.attachFiles"),onClick:()=>{re(!1)},children:n.jsx(Af,{})}):null,Et?null:n.jsx($d,{ariaLabel:o("conversation.modelSelectorLabel"),value:L,options:xn,onChange:ir}),!Et&&ie&&Tt.length>0?n.jsx($d,{ariaLabel:o("conversation.reasoningSelectorLabel"),value:F,options:dn,onChange:ue=>De(ue),compact:!0}):null,Be?n.jsxs("button",{type:"button",className:"composer-slash-btn",onClick:gr,title:o("conversation.slashMenu"),children:[n.jsx("span",{className:"slash-icon",children:"/"}),n.jsx("span",{children:o("conversation.slashMenu")})]}):null,n.jsx(kW,{contextUsage:v}),n.jsx($B,{provider:g,messages:w,variant:"composer"})]}),Hn?n.jsx("div",{className:"composer-send-group",children:n.jsx("button",{className:"composer-send composer-send-busy",type:"button",disabled:!0,"aria-label":jn,title:jn,children:n.jsxs("svg",{className:"composer-send-spinner",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",children:[n.jsx("circle",{cx:"12",cy:"12",r:"8",stroke:"currentColor",strokeOpacity:"0.28",strokeWidth:"2.5"}),n.jsx("path",{d:"M20 12a8 8 0 0 0-8-8",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"})]})})}):n.jsx("div",{className:"composer-send-group",children:En?n.jsx("button",{className:"composer-send composer-send-busy",type:"button",onClick:()=>{Yt()},"aria-label":o("conversation.capabilityInterrupt"),title:o("conversation.capabilityInterrupt"),children:n.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:n.jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})}):n.jsx("button",{className:"composer-send",type:"submit",disabled:bn,"aria-label":Qt,title:Qt,children:n.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[n.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),n.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})})})]})]})]}),n.jsx(Fn,{open:P,title:o("conversation.quickPhraseModalTitle"),description:o("conversation.quickPhraseModalDescription"),className:"composer-quick-phrase-modal",onClose:()=>{W(!1),R(!1)},children:n.jsxs("div",{className:"composer-quick-phrase-modal-body",children:[n.jsxs("div",{className:"composer-quick-phrase-toolbar",children:[n.jsx("div",{className:"composer-quick-phrase-toolbar-copy",children:n.jsx("span",{children:o("conversation.quickPhraseListLabel")})}),n.jsx("button",{type:"button",className:"primary-button",disabled:Y,onClick:()=>R(!0),children:o("conversation.quickPhraseOpenCreateAction")})]}),n.jsx("div",{className:"composer-quick-phrase-list",role:"list","aria-label":o("conversation.quickPhraseListLabel"),children:U.length===0?n.jsx("div",{className:"composer-quick-phrase-empty",children:o("conversation.quickPhraseEmpty")}):U.map((ue,Ve)=>n.jsxs("div",{className:"composer-quick-phrase-item",role:"listitem",children:[n.jsxs("button",{type:"button",className:"composer-quick-phrase-select",onClick:()=>Yr(ue.text),children:[n.jsx("span",{className:"composer-quick-phrase-order",children:o("conversation.quickPhraseOrderLabel",{index:Ve+1})}),n.jsx("span",{className:"composer-quick-phrase-text",children:ue.text})]}),n.jsxs("div",{className:"composer-quick-phrase-actions",children:[n.jsx("button",{type:"button",className:"composer-quick-phrase-action",disabled:Y||Ve===0,"aria-label":o("conversation.quickPhraseMoveUp"),title:o("conversation.quickPhraseMoveUp"),onClick:()=>Cr(ue.id,-1),children:"↑"}),n.jsx("button",{type:"button",className:"composer-quick-phrase-action",disabled:Y||Ve===U.length-1,"aria-label":o("conversation.quickPhraseMoveDown"),title:o("conversation.quickPhraseMoveDown"),onClick:()=>Cr(ue.id,1),children:"↓"}),n.jsx("button",{type:"button",className:"composer-quick-phrase-action is-danger",disabled:Y,"aria-label":o("conversation.quickPhraseDelete"),title:o("conversation.quickPhraseDelete"),onClick:()=>zn(ue.id),children:"×"})]})]},ue.id))})]})}),n.jsx(Fn,{open:J,title:o("conversation.quickPhraseCreateModalTitle"),description:o("conversation.quickPhraseCreateModalDescription"),className:"composer-quick-phrase-create-modal",onClose:()=>R(!1),children:n.jsxs("div",{className:"composer-quick-phrase-modal-body",children:[n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("conversation.quickPhraseCreateLabel")}),n.jsx("textarea",{className:"composer-quick-phrase-textarea",value:ve,placeholder:o("conversation.quickPhraseCreatePlaceholder"),rows:4,onChange:ue=>pe(ue.target.value)})]}),n.jsxs("div",{className:"workbench-modal-actions",children:[n.jsx("button",{type:"button",className:"secondary-button",onClick:()=>R(!1),children:o("common.cancel")}),n.jsx("button",{type:"button",className:"primary-button",disabled:Y||ve.trim().length===0,onClick:()=>{br()},children:o("conversation.quickPhraseCreateAction")})]})]})}),n.jsx(Fn,{open:we!==null,title:o("conversation.forkSwitchConfirmTitle"),description:o("conversation.forkSwitchConfirmDescription"),className:"composer-fork-confirm-modal",onClose:Ir,children:n.jsxs("div",{className:"composer-fork-confirm-body",children:[n.jsxs("div",{className:"composer-fork-confirm-list",children:[n.jsxs("div",{className:"composer-fork-confirm-item",children:[n.jsx("span",{className:"composer-fork-confirm-icon is-keep","aria-hidden":"true",children:n.jsx(vW,{})}),n.jsxs("div",{className:"composer-fork-confirm-copy",children:[n.jsx("strong",{children:o("conversation.forkSwitchConfirmKeepTitle")}),n.jsx("p",{children:o("conversation.forkSwitchConfirmKeepBody")})]})]}),n.jsxs("div",{className:"composer-fork-confirm-item",children:[n.jsx("span",{className:"composer-fork-confirm-icon is-convert","aria-hidden":"true",children:n.jsx(wW,{})}),n.jsxs("div",{className:"composer-fork-confirm-copy",children:[n.jsx("strong",{children:o("conversation.forkSwitchConfirmConvertTitle")}),n.jsx("p",{children:o("conversation.forkSwitchConfirmConvertBody")})]})]}),n.jsxs("div",{className:"composer-fork-confirm-item",children:[n.jsx("span",{className:"composer-fork-confirm-icon is-drop","aria-hidden":"true",children:n.jsx(yW,{})}),n.jsxs("div",{className:"composer-fork-confirm-copy",children:[n.jsx("strong",{children:o("conversation.forkSwitchConfirmDropTitle")}),n.jsx("p",{children:o("conversation.forkSwitchConfirmDropBody")})]})]})]}),n.jsxs("div",{className:"workbench-modal-actions",children:[n.jsx("button",{type:"button",className:"secondary-button",onClick:Ir,children:o("conversation.forkSwitchKeepNative")}),n.jsx("button",{type:"button",className:"primary-button",onClick:cs,children:o("conversation.forkSwitchConfirmAction")})]})]})}),n.jsx(fW,{open:X&&D.isNativeMobile,onClose:()=>K(!1),onSelectCamera:()=>Jt("camera"),onSelectLibrary:()=>Jt("library")})]});return d?Vn.createPortal(or,d):or}function fW({open:e,onClose:t,onSelectCamera:r,onSelectLibrary:s}){return!e||typeof document>"u"?null:Vn.createPortal(n.jsx("div",{className:"ios-action-sheet-overlay composer-attachment-sheet-overlay",role:"presentation",onClick:t,children:n.jsxs("div",{className:"mobile-workspace-home-sheet composer-attachment-sheet",role:"dialog","aria-modal":"true","aria-label":o("conversation.attachmentSourceSheetTitle"),onClick:i=>i.stopPropagation(),children:[n.jsxs("div",{className:"mobile-workspace-home-sheet-card composer-attachment-sheet-card",children:[n.jsxs("div",{className:"mobile-workspace-home-sheet-header",children:[n.jsx("strong",{children:o("conversation.attachmentSourceSheetTitle")}),n.jsx("span",{children:o("conversation.attachmentSourceSheetDescription")})]}),n.jsxs("div",{className:"mobile-workspace-home-group composer-attachment-sheet-actions",children:[n.jsxs("button",{type:"button",className:"mobile-workspace-home-row composer-attachment-sheet-option","aria-label":o("conversation.attachmentTakePhoto"),onClick:r,children:[n.jsxs("span",{className:"composer-attachment-sheet-option-copy",children:[n.jsx("strong",{children:o("conversation.attachmentTakePhoto")}),n.jsx("span",{children:o("conversation.attachmentTakePhotoHint")})]}),n.jsx(gW,{})]}),n.jsxs("button",{type:"button",className:"mobile-workspace-home-row composer-attachment-sheet-option","aria-label":o("conversation.attachmentChooseFromLibrary"),onClick:s,children:[n.jsxs("span",{className:"composer-attachment-sheet-option-copy",children:[n.jsx("strong",{children:o("conversation.attachmentChooseFromLibrary")}),n.jsx("span",{children:o("conversation.attachmentChooseFromLibraryHint")})]}),n.jsx(bW,{})]})]})]}),n.jsx("button",{type:"button",className:"ios-action-sheet-cancel",onClick:t,children:o("common.cancel")})]})}),document.body)}function gW(){return n.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[n.jsx("path",{d:"M4 8h3l1.5-2h7L17 8h3a1 1 0 0 1 1 1v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V9a1 1 0 0 1 1-1Z"}),n.jsx("circle",{cx:"12",cy:"13",r:"4"})]})}function Af(){return n.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"4"}),n.jsx("path",{d:"M8 12h8M12 8v8"})]})}function bW(){return n.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[n.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2.5"}),n.jsx("path",{d:"m7.5 15 3-3 2.5 2.5 3-4L18 13.5"}),n.jsx("circle",{cx:"8.75",cy:"8.75",r:"1.25",fill:"currentColor",stroke:"none"})]})}function vW(){return n.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:[n.jsx("path",{d:"M12 3 4 7v5c0 5 3.5 8 8 9 4.5-1 8-4 8-9V7l-8-4Z"}),n.jsx("path",{d:"m9.5 12 1.8 1.8L15 10.2"})]})}function wW(){return n.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:[n.jsx("path",{d:"M4 7h9"}),n.jsx("path",{d:"m10 3 4 4-4 4"}),n.jsx("path",{d:"M20 17h-9"}),n.jsx("path",{d:"m14 13-4 4 4 4"})]})}function yW(){return n.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:[n.jsx("path",{d:"m7 7 10 10"}),n.jsx("path",{d:"M17 7 7 17"}),n.jsx("path",{d:"M12 3v2"}),n.jsx("path",{d:"M12 19v2"})]})}function $d({ariaLabel:e,value:t,options:r,onChange:s,disabled:i=!1,compact:l=!1}){const[c,d]=p.useState(!1),m=p.useRef(null),f=p.useRef(null),v=p.useRef(null),[g,w]=p.useState(null),k=p.useId(),y=r.find(T=>T.value===t)??r[0]??null,S=p.useCallback(()=>{const T=f.current;if(!T||typeof window>"u")return;const j=T.getBoundingClientRect(),N=window.innerWidth,D=window.innerHeight,H=12,B=10,I=Math.max(160,N-H*2),A=l?140:220,L=Math.min(I,Math.max(j.width,A)),_=Math.min(Math.max(H,j.left),Math.max(H,N-L-H)),F=j.top-H,te=D-j.bottom-H,E=F>=180||F>=te;w({position:"fixed",left:_,width:L,maxWidth:I,top:E?void 0:j.bottom+B,bottom:E?D-j.top+B:void 0})},[l]);return p.useEffect(()=>{if(!c)return;function T(N){var H,B;const D=N.target;!((H=m.current)!=null&&H.contains(D))&&!((B=v.current)!=null&&B.contains(D))&&d(!1)}function j(N){N.key==="Escape"&&d(!1)}return window.addEventListener("pointerdown",T),window.addEventListener("keydown",j),window.addEventListener("resize",S),window.addEventListener("scroll",S,!0),S(),()=>{window.removeEventListener("pointerdown",T),window.removeEventListener("keydown",j),window.removeEventListener("resize",S),window.removeEventListener("scroll",S,!0)}},[c,S]),y?n.jsxs("div",{ref:m,className:`composer-mac-select ${l?"is-compact":""}`,"data-open":c?"true":"false",children:[n.jsxs("button",{ref:f,type:"button",className:"composer-mac-select-trigger","aria-label":e,"aria-haspopup":"listbox","aria-expanded":c,"aria-controls":k,disabled:i,onClick:()=>d(T=>!T),children:[n.jsx("span",{className:"composer-mac-select-label",children:y.label}),n.jsx("svg",{className:"composer-mac-select-chevron",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:n.jsx("polyline",{points:"6 14 12 8 18 14"})})]}),c&&g&&typeof document<"u"?Vn.createPortal(n.jsx("div",{ref:v,className:"composer-mac-select-popover",style:g,role:"presentation",children:n.jsx("div",{id:k,className:"composer-mac-select-list",role:"listbox","aria-label":e,children:r.map(T=>{const j=T.value===t;return n.jsxs("button",{type:"button",role:"option","aria-selected":j,className:`composer-mac-select-option ${j?"is-selected":""}`,onClick:()=>{s(T.value),d(!1)},children:[n.jsx("span",{className:"composer-mac-select-option-check","aria-hidden":"true",children:j?"✓":""}),n.jsx("span",{className:"composer-mac-select-option-label",children:T.label})]},T.value)})})}),document.body):null]}):null}function kW({contextUsage:e}){const[t,r]=p.useState(!1),s=p.useRef(null),i=p.useRef(null),[l,c]=p.useState(null),d=p.useId(),m=e?Math.round(e.usageRatio*100):null,f=e?Math.max(0,Math.min(e.usageRatio,1)):0,v=xW(f),g=e?SW(e.contextWindowSource):null,w=e?`${o("conversation.contextUsageTitle")} ${m}%`:o("conversation.contextUsageUnavailable"),k=p.useCallback(()=>{const y=s.current;if(!y||typeof window>"u")return;const S=y.getBoundingClientRect(),T=window.innerWidth,j=window.innerHeight,N=12,D=10,H=Math.min(240,Math.max(188,T-N*2)),B=Math.min(Math.max(N,S.left+S.width/2-H/2),Math.max(N,T-H-N)),I=S.top-N,A=j-S.bottom-N,L=I>=140||I>=A;c({position:"fixed",left:B,width:H,maxWidth:T-N*2,top:L?void 0:S.bottom+D,bottom:L?j-S.top+D:void 0})},[]);return p.useEffect(()=>{if(!t)return;function y(T){var N,D;const j=T.target;!((N=s.current)!=null&&N.contains(j))&&!((D=i.current)!=null&&D.contains(j))&&r(!1)}function S(T){T.key==="Escape"&&r(!1)}return window.addEventListener("pointerdown",y),window.addEventListener("keydown",S),window.addEventListener("resize",k),window.addEventListener("scroll",k,!0),k(),()=>{window.removeEventListener("pointerdown",y),window.removeEventListener("keydown",S),window.removeEventListener("resize",k),window.removeEventListener("scroll",k,!0)}},[t,k]),n.jsxs(n.Fragment,{children:[n.jsx("button",{ref:s,type:"button",className:`composer-context-ring ${v}`,style:{"--context-usage-progress":`${f}`},"aria-label":w,"aria-expanded":t,"aria-describedby":t?d:void 0,onClick:()=>r(y=>!y),onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),onFocus:()=>r(!0),onBlur:()=>r(!1),children:n.jsx("span",{className:"composer-context-ring-value",children:m===null?"--":n.jsxs(n.Fragment,{children:[n.jsx("span",{children:m}),n.jsx("span",{className:"composer-context-ring-suffix",children:"%"})]})})}),t&&l&&typeof document<"u"?Vn.createPortal(n.jsx("div",{ref:i,id:d,className:"composer-context-tooltip",style:l,role:"tooltip",children:e?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"composer-context-tooltip-title",children:o("conversation.contextUsageTitle")}),n.jsxs("div",{className:"composer-context-tooltip-line",children:[m,"% · ",Mf(e.promptTokens)," /"," ",Mf(e.contextWindow)," tokens"]}),e.cachedInputTokens>0?n.jsx("div",{className:"composer-context-tooltip-line",children:o("conversation.contextUsageCachedTokens").replace("{count}",Mf(e.cachedInputTokens))}):null,g?n.jsx("div",{className:"composer-context-tooltip-meta",children:g}):null,e.isEstimated?n.jsx("div",{className:"composer-context-tooltip-meta",children:o("conversation.contextUsageEstimated")}):null]}):n.jsx("div",{className:"composer-context-tooltip-line",children:o("conversation.contextUsageUnavailable")})}),document.body):null]})}function xW(e){return e>=.95?"is-critical":e>=.8?"is-warning":"is-normal"}function SW(e){switch(e){case"provider-log":return o("conversation.contextUsageSourceProviderLog");case"provider-runtime":return o("conversation.contextUsageSourceProviderRuntime");case"provider-config":return o("conversation.contextUsageSourceProviderConfig");case"model-map":return o("conversation.contextUsageSourceModelMap");default:return""}}function Mf(e){return new Intl.NumberFormat().format(e)}function CW(e,t){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const jW=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,TW=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,NW={};function LS(e,t){return(NW.jsx?TW:jW).test(e)}const PW=/[ \t\n\f\r]/g;function DW(e){return typeof e=="object"?e.type==="text"?FS(e.value):!1:FS(e)}function FS(e){return e.replace(PW,"")===""}class Eu{constructor(t,r,s){this.normal=r,this.property=t,s&&(this.space=s)}}Eu.prototype.normal={};Eu.prototype.property={};Eu.prototype.space=void 0;function qD(e,t){const r={},s={};for(const i of e)Object.assign(r,i.property),Object.assign(s,i.normal);return new Eu(r,s,t)}function ub(e){return e.toLowerCase()}class Bs{constructor(t,r){this.attribute=r,this.property=t}}Bs.prototype.attribute="";Bs.prototype.booleanish=!1;Bs.prototype.boolean=!1;Bs.prototype.commaOrSpaceSeparated=!1;Bs.prototype.commaSeparated=!1;Bs.prototype.defined=!1;Bs.prototype.mustUseProperty=!1;Bs.prototype.number=!1;Bs.prototype.overloadedBoolean=!1;Bs.prototype.property="";Bs.prototype.spaceSeparated=!1;Bs.prototype.space=void 0;let RW=0;const kn=qo(),Or=qo(),db=qo(),bt=qo(),tr=qo(),El=qo(),zs=qo();function qo(){return 2**++RW}const hb=Object.freeze(Object.defineProperty({__proto__:null,boolean:kn,booleanish:Or,commaOrSpaceSeparated:zs,commaSeparated:El,number:bt,overloadedBoolean:db,spaceSeparated:tr},Symbol.toStringTag,{value:"Module"})),If=Object.keys(hb);class Wv extends Bs{constructor(t,r,s,i){let l=-1;if(super(t,r),_S(this,"space",i),typeof s=="number")for(;++l<If.length;){const c=If[l];_S(this,If[l],(s&hb[c])===hb[c])}}}Wv.prototype.defined=!0;function _S(e,t,r){r&&(e[t]=r)}function ql(e){const t={},r={};for(const[s,i]of Object.entries(e.properties)){const l=new Wv(s,e.transform(e.attributes||{},s),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(l.mustUseProperty=!0),t[s]=l,r[ub(s)]=s,r[ub(l.attribute)]=s}return new Eu(t,r,e.space)}const $D=ql({properties:{ariaActiveDescendant:null,ariaAtomic:Or,ariaAutoComplete:null,ariaBusy:Or,ariaChecked:Or,ariaColCount:bt,ariaColIndex:bt,ariaColSpan:bt,ariaControls:tr,ariaCurrent:null,ariaDescribedBy:tr,ariaDetails:null,ariaDisabled:Or,ariaDropEffect:tr,ariaErrorMessage:null,ariaExpanded:Or,ariaFlowTo:tr,ariaGrabbed:Or,ariaHasPopup:null,ariaHidden:Or,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:tr,ariaLevel:bt,ariaLive:null,ariaModal:Or,ariaMultiLine:Or,ariaMultiSelectable:Or,ariaOrientation:null,ariaOwns:tr,ariaPlaceholder:null,ariaPosInSet:bt,ariaPressed:Or,ariaReadOnly:Or,ariaRelevant:null,ariaRequired:Or,ariaRoleDescription:tr,ariaRowCount:bt,ariaRowIndex:bt,ariaRowSpan:bt,ariaSelected:Or,ariaSetSize:bt,ariaSort:null,ariaValueMax:bt,ariaValueMin:bt,ariaValueNow:bt,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function VD(e,t){return t in e?e[t]:t}function GD(e,t){return VD(e,t.toLowerCase())}const AW=ql({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:El,acceptCharset:tr,accessKey:tr,action:null,allow:null,allowFullScreen:kn,allowPaymentRequest:kn,allowUserMedia:kn,alt:null,as:null,async:kn,autoCapitalize:null,autoComplete:tr,autoFocus:kn,autoPlay:kn,blocking:tr,capture:null,charSet:null,checked:kn,cite:null,className:tr,cols:bt,colSpan:null,content:null,contentEditable:Or,controls:kn,controlsList:tr,coords:bt|El,crossOrigin:null,data:null,dateTime:null,decoding:null,default:kn,defer:kn,dir:null,dirName:null,disabled:kn,download:db,draggable:Or,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:kn,formTarget:null,headers:tr,height:bt,hidden:db,high:bt,href:null,hrefLang:null,htmlFor:tr,httpEquiv:tr,id:null,imageSizes:null,imageSrcSet:null,inert:kn,inputMode:null,integrity:null,is:null,isMap:kn,itemId:null,itemProp:tr,itemRef:tr,itemScope:kn,itemType:tr,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:kn,low:bt,manifest:null,max:null,maxLength:bt,media:null,method:null,min:null,minLength:bt,multiple:kn,muted:kn,name:null,nonce:null,noModule:kn,noValidate:kn,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:kn,optimum:bt,pattern:null,ping:tr,placeholder:null,playsInline:kn,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:kn,referrerPolicy:null,rel:tr,required:kn,reversed:kn,rows:bt,rowSpan:bt,sandbox:tr,scope:null,scoped:kn,seamless:kn,selected:kn,shadowRootClonable:kn,shadowRootDelegatesFocus:kn,shadowRootMode:null,shape:null,size:bt,sizes:null,slot:null,span:bt,spellCheck:Or,src:null,srcDoc:null,srcLang:null,srcSet:null,start:bt,step:null,style:null,tabIndex:bt,target:null,title:null,translate:null,type:null,typeMustMatch:kn,useMap:null,value:Or,width:bt,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:tr,axis:null,background:null,bgColor:null,border:bt,borderColor:null,bottomMargin:bt,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:kn,declare:kn,event:null,face:null,frame:null,frameBorder:null,hSpace:bt,leftMargin:bt,link:null,longDesc:null,lowSrc:null,marginHeight:bt,marginWidth:bt,noResize:kn,noHref:kn,noShade:kn,noWrap:kn,object:null,profile:null,prompt:null,rev:null,rightMargin:bt,rules:null,scheme:null,scrolling:Or,standby:null,summary:null,text:null,topMargin:bt,valueType:null,version:null,vAlign:null,vLink:null,vSpace:bt,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:kn,disableRemotePlayback:kn,prefix:null,property:null,results:bt,security:null,unselectable:null},space:"html",transform:GD}),MW=ql({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:zs,accentHeight:bt,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:bt,amplitude:bt,arabicForm:null,ascent:bt,attributeName:null,attributeType:null,azimuth:bt,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:bt,by:null,calcMode:null,capHeight:bt,className:tr,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:bt,diffuseConstant:bt,direction:null,display:null,dur:null,divisor:bt,dominantBaseline:null,download:kn,dx:null,dy:null,edgeMode:null,editable:null,elevation:bt,enableBackground:null,end:null,event:null,exponent:bt,externalResourcesRequired:null,fill:null,fillOpacity:bt,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:El,g2:El,glyphName:El,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:bt,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:bt,horizOriginX:bt,horizOriginY:bt,id:null,ideographic:bt,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:bt,k:bt,k1:bt,k2:bt,k3:bt,k4:bt,kernelMatrix:zs,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:bt,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:bt,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:bt,overlineThickness:bt,paintOrder:null,panose1:null,path:null,pathLength:bt,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:tr,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:bt,pointsAtY:bt,pointsAtZ:bt,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:zs,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:zs,rev:zs,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:zs,requiredFeatures:zs,requiredFonts:zs,requiredFormats:zs,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:bt,specularExponent:bt,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:bt,strikethroughThickness:bt,string:null,stroke:null,strokeDashArray:zs,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:bt,strokeOpacity:bt,strokeWidth:null,style:null,surfaceScale:bt,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:zs,tabIndex:bt,tableValues:null,target:null,targetX:bt,targetY:bt,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:zs,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:bt,underlineThickness:bt,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:bt,values:null,vAlphabetic:bt,vMathematical:bt,vectorEffect:null,vHanging:bt,vIdeographic:bt,version:null,vertAdvY:bt,vertOriginX:bt,vertOriginY:bt,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:bt,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:VD}),KD=ql({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),YD=ql({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:GD}),XD=ql({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),IW={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},EW=/[A-Z]/g,OS=/-[a-z]/g,LW=/^data[-\w.:]+$/i;function FW(e,t){const r=ub(t);let s=t,i=Bs;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&LW.test(t)){if(t.charAt(4)==="-"){const l=t.slice(5).replace(OS,OW);s="data"+l.charAt(0).toUpperCase()+l.slice(1)}else{const l=t.slice(4);if(!OS.test(l)){let c=l.replace(EW,_W);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}i=Wv}return new i(s,t)}function _W(e){return"-"+e.toLowerCase()}function OW(e){return e.charAt(1).toUpperCase()}const BW=qD([$D,AW,KD,YD,XD],"html"),Uv=qD([$D,MW,KD,YD,XD],"svg");function WW(e){return e.join(" ").trim()}var xl={},Ef,BS;function UW(){if(BS)return Ef;BS=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,r=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,l=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,d=/^\s+|\s+$/g,m=`
|
|
70
|
-
`,f="/",v="*",g="",w="comment",k="declaration";function y(T,j){if(typeof T!="string")throw new TypeError("First argument must be a string");if(!T)return[];j=j||{};var N=1,D=1;function H(X){var K=X.match(t);K&&(N+=K.length);var G=X.lastIndexOf(m);D=~G?X.length-G:D+X.length}function B(){var X={line:N,column:D};return function(K){return K.position=new I(X),_(),K}}function I(X){this.start=X,this.end={line:N,column:D},this.source=j.source}I.prototype.content=T;function A(X){var K=new Error(j.source+":"+N+":"+D+": "+X);if(K.reason=X,K.filename=j.source,K.line=N,K.column=D,K.source=T,!j.silent)throw K}function L(X){var K=X.exec(T);if(K){var G=K[0];return H(G),T=T.slice(G.length),K}}function _(){L(r)}function F(X){var K;for(X=X||[];K=te();)K!==!1&&X.push(K);return X}function te(){var X=B();if(!(f!=T.charAt(0)||v!=T.charAt(1))){for(var K=2;g!=T.charAt(K)&&(v!=T.charAt(K)||f!=T.charAt(K+1));)++K;if(K+=2,g===T.charAt(K-1))return A("End of comment missing");var G=T.slice(2,K-2);return D+=2,H(G),T=T.slice(K),D+=2,X({type:w,comment:G})}}function E(){var X=B(),K=L(s);if(K){if(te(),!L(i))return A("property missing ':'");var G=L(l),q=X({type:k,property:S(K[0].replace(e,g)),value:G?S(G[0].replace(e,g)):g});return L(c),q}}function se(){var X=[];F(X);for(var K;K=E();)K!==!1&&(X.push(K),F(X));return X}return _(),se()}function S(T){return T?T.replace(d,g):g}return Ef=y,Ef}var WS;function HW(){if(WS)return xl;WS=1;var e=xl&&xl.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(xl,"__esModule",{value:!0}),xl.default=r;const t=e(UW());function r(s,i){let l=null;if(!s||typeof s!="string")return l;const c=(0,t.default)(s),d=typeof i=="function";return c.forEach(m=>{if(m.type!=="declaration")return;const{property:f,value:v}=m;d?i(f,v,m):v&&(l=l||{},l[f]=v)}),l}return xl}var jc={},US;function zW(){if(US)return jc;US=1,Object.defineProperty(jc,"__esModule",{value:!0}),jc.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,r=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,l=function(f){return!f||r.test(f)||e.test(f)},c=function(f,v){return v.toUpperCase()},d=function(f,v){return"".concat(v,"-")},m=function(f,v){return v===void 0&&(v={}),l(f)?f:(f=f.toLowerCase(),v.reactCompat?f=f.replace(i,d):f=f.replace(s,d),f.replace(t,c))};return jc.camelCase=m,jc}var Tc,HS;function qW(){if(HS)return Tc;HS=1;var e=Tc&&Tc.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},t=e(HW()),r=zW();function s(i,l){var c={};return!i||typeof i!="string"||(0,t.default)(i,function(d,m){d&&m&&(c[(0,r.camelCase)(d,l)]=m)}),c}return s.default=s,Tc=s,Tc}var $W=qW();const VW=yu($W),QD=JD("end"),Hv=JD("start");function JD(e){return t;function t(r){const s=r&&r.position&&r.position[e]||{};if(typeof s.line=="number"&&s.line>0&&typeof s.column=="number"&&s.column>0)return{line:s.line,column:s.column,offset:typeof s.offset=="number"&&s.offset>-1?s.offset:void 0}}}function GW(e){const t=Hv(e),r=QD(e);if(t&&r)return{start:t,end:r}}function Qc(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?zS(e.position):"start"in e||"end"in e?zS(e):"line"in e||"column"in e?mb(e):""}function mb(e){return qS(e&&e.line)+":"+qS(e&&e.column)}function zS(e){return mb(e&&e.start)+"-"+mb(e&&e.end)}function qS(e){return e&&typeof e=="number"?e:1}class bs extends Error{constructor(t,r,s){super(),typeof r=="string"&&(s=r,r=void 0);let i="",l={},c=!1;if(r&&("line"in r&&"column"in r?l={place:r}:"start"in r&&"end"in r?l={place:r}:"type"in r?l={ancestors:[r],place:r.position}:l={...r}),typeof t=="string"?i=t:!l.cause&&t&&(c=!0,i=t.message,l.cause=t),!l.ruleId&&!l.source&&typeof s=="string"){const m=s.indexOf(":");m===-1?l.ruleId=s:(l.source=s.slice(0,m),l.ruleId=s.slice(m+1))}if(!l.place&&l.ancestors&&l.ancestors){const m=l.ancestors[l.ancestors.length-1];m&&(l.place=m.position)}const d=l.place&&"start"in l.place?l.place.start:l.place;this.ancestors=l.ancestors||void 0,this.cause=l.cause||void 0,this.column=d?d.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=d?d.line:void 0,this.name=Qc(l.place)||"1:1",this.place=l.place||void 0,this.reason=this.message,this.ruleId=l.ruleId||void 0,this.source=l.source||void 0,this.stack=c&&l.cause&&typeof l.cause.stack=="string"?l.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}bs.prototype.file="";bs.prototype.name="";bs.prototype.reason="";bs.prototype.message="";bs.prototype.stack="";bs.prototype.column=void 0;bs.prototype.line=void 0;bs.prototype.ancestors=void 0;bs.prototype.cause=void 0;bs.prototype.fatal=void 0;bs.prototype.place=void 0;bs.prototype.ruleId=void 0;bs.prototype.source=void 0;const zv={}.hasOwnProperty,KW=new Map,YW=/[A-Z]/g,XW=new Set(["table","tbody","thead","tfoot","tr"]),QW=new Set(["td","th"]),ZD="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function JW(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=t.filePath||void 0;let s;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");s=aU(r,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");s=iU(r,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:s,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Uv:BW,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},l=e0(i,e,void 0);return l&&typeof l!="string"?l:i.create(e,i.Fragment,{children:l||void 0},void 0)}function e0(e,t,r){if(t.type==="element")return ZW(e,t,r);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return eU(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return nU(e,t,r);if(t.type==="mdxjsEsm")return tU(e,t);if(t.type==="root")return rU(e,t,r);if(t.type==="text")return sU(e,t)}function ZW(e,t,r){const s=e.schema;let i=s;t.tagName.toLowerCase()==="svg"&&s.space==="html"&&(i=Uv,e.schema=i),e.ancestors.push(t);const l=n0(e,t.tagName,!1),c=oU(e,t);let d=$v(e,t);return XW.has(t.tagName)&&(d=d.filter(function(m){return typeof m=="string"?!DW(m):!0})),t0(e,c,l,t),qv(c,d),e.ancestors.pop(),e.schema=s,e.create(t,l,c,r)}function eU(e,t){if(t.data&&t.data.estree&&e.evaluater){const s=t.data.estree.body[0];return s.type,e.evaluater.evaluateExpression(s.expression)}lu(e,t.position)}function tU(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);lu(e,t.position)}function nU(e,t,r){const s=e.schema;let i=s;t.name==="svg"&&s.space==="html"&&(i=Uv,e.schema=i),e.ancestors.push(t);const l=t.name===null?e.Fragment:n0(e,t.name,!0),c=lU(e,t),d=$v(e,t);return t0(e,c,l,t),qv(c,d),e.ancestors.pop(),e.schema=s,e.create(t,l,c,r)}function rU(e,t,r){const s={};return qv(s,$v(e,t)),e.create(t,e.Fragment,s,r)}function sU(e,t){return t.value}function t0(e,t,r,s){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(t.node=s)}function qv(e,t){if(t.length>0){const r=t.length>1?t:t[0];r&&(e.children=r)}}function iU(e,t,r){return s;function s(i,l,c,d){const f=Array.isArray(c.children)?r:t;return d?f(l,c,d):f(l,c)}}function aU(e,t){return r;function r(s,i,l,c){const d=Array.isArray(l.children),m=Hv(s);return t(i,l,c,d,{columnNumber:m?m.column-1:void 0,fileName:e,lineNumber:m?m.line:void 0},void 0)}}function oU(e,t){const r={};let s,i;for(i in t.properties)if(i!=="children"&&zv.call(t.properties,i)){const l=cU(e,i,t.properties[i]);if(l){const[c,d]=l;e.tableCellAlignToStyle&&c==="align"&&typeof d=="string"&&QW.has(t.tagName)?s=d:r[c]=d}}if(s){const l=r.style||(r.style={});l[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return r}function lU(e,t){const r={};for(const s of t.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&e.evaluater){const l=s.data.estree.body[0];l.type;const c=l.expression;c.type;const d=c.properties[0];d.type,Object.assign(r,e.evaluater.evaluateExpression(d.argument))}else lu(e,t.position);else{const i=s.name;let l;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&e.evaluater){const d=s.value.data.estree.body[0];d.type,l=e.evaluater.evaluateExpression(d.expression)}else lu(e,t.position);else l=s.value===null?!0:s.value;r[i]=l}return r}function $v(e,t){const r=[];let s=-1;const i=e.passKeys?new Map:KW;for(;++s<t.children.length;){const l=t.children[s];let c;if(e.passKeys){const m=l.type==="element"?l.tagName:l.type==="mdxJsxFlowElement"||l.type==="mdxJsxTextElement"?l.name:void 0;if(m){const f=i.get(m)||0;c=m+"-"+f,i.set(m,f+1)}}const d=e0(e,l,c);d!==void 0&&r.push(d)}return r}function cU(e,t,r){const s=FW(e.schema,t);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=s.commaSeparated?CW(r):WW(r)),s.property==="style"){let i=typeof r=="object"?r:uU(e,String(r));return e.stylePropertyNameCase==="css"&&(i=dU(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&s.space?IW[s.property]||s.property:s.attribute,r]}}function uU(e,t){try{return VW(t,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};const s=r,i=new bs("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=ZD+"#cannot-parse-style-attribute",i}}function n0(e,t,r){let s;if(!r)s={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let l=-1,c;for(;++l<i.length;){const d=LS(i[l])?{type:"Identifier",name:i[l]}:{type:"Literal",value:i[l]};c=c?{type:"MemberExpression",object:c,property:d,computed:!!(l&&d.type==="Literal"),optional:!1}:d}s=c}else s=LS(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(s.type==="Literal"){const i=s.value;return zv.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(s);lu(e)}function lu(e,t){const r=new bs("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=ZD+"#cannot-handle-mdx-estrees-without-createevaluater",r}function dU(e){const t={};let r;for(r in e)zv.call(e,r)&&(t[hU(r)]=e[r]);return t}function hU(e){let t=e.replace(YW,mU);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function mU(e){return"-"+e.toLowerCase()}const Lf={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},pU={};function Vv(e,t){const r=pU,s=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,i=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return r0(e,s,i)}function r0(e,t,r){if(fU(e)){if("value"in e)return e.type==="html"&&!r?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return $S(e.children,t,r)}return Array.isArray(e)?$S(e,t,r):""}function $S(e,t,r){const s=[];let i=-1;for(;++i<e.length;)s[i]=r0(e[i],t,r);return s.join("")}function fU(e){return!!(e&&typeof e=="object")}const VS=document.createElement("i");function Gv(e){const t="&"+e+";";VS.innerHTML=t;const r=VS.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===t?!1:r}function $s(e,t,r,s){const i=e.length;let l=0,c;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,r=r>0?r:0,s.length<1e4)c=Array.from(s),c.unshift(t,r),e.splice(...c);else for(r&&e.splice(t,r);l<s.length;)c=s.slice(l,l+1e4),c.unshift(t,0),e.splice(...c),l+=1e4,t+=1e4}function oi(e,t){return e.length>0?($s(e,e.length,0,t),e):t}const GS={}.hasOwnProperty;function s0(e){const t={};let r=-1;for(;++r<e.length;)gU(t,e[r]);return t}function gU(e,t){let r;for(r in t){const i=(GS.call(e,r)?e[r]:void 0)||(e[r]={}),l=t[r];let c;if(l)for(c in l){GS.call(i,c)||(i[c]=[]);const d=l[c];bU(i[c],Array.isArray(d)?d:d?[d]:[])}}}function bU(e,t){let r=-1;const s=[];for(;++r<t.length;)(t[r].add==="after"?e:s).push(t[r]);$s(e,0,0,s)}function i0(e,t){const r=Number.parseInt(e,t);return r<9||r===11||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"�":String.fromCodePoint(r)}function ji(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ks=to(/[A-Za-z]/),gs=to(/[\dA-Za-z]/),vU=to(/[#-'*+\--9=?A-Z^-~]/);function Xh(e){return e!==null&&(e<32||e===127)}const pb=to(/\d/),wU=to(/[\dA-Fa-f]/),yU=to(/[!-/:-@[-`{-~]/);function sn(e){return e!==null&&e<-2}function Xn(e){return e!==null&&(e<0||e===32)}function An(e){return e===-2||e===-1||e===32}const Pm=to(new RegExp("\\p{P}|\\p{S}","u")),_o=to(/\s/);function to(e){return t;function t(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function $l(e){const t=[];let r=-1,s=0,i=0;for(;++r<e.length;){const l=e.charCodeAt(r);let c="";if(l===37&&gs(e.charCodeAt(r+1))&&gs(e.charCodeAt(r+2)))i=2;else if(l<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(l))||(c=String.fromCharCode(l));else if(l>55295&&l<57344){const d=e.charCodeAt(r+1);l<56320&&d>56319&&d<57344?(c=String.fromCharCode(l,d),i=1):c="�"}else c=String.fromCharCode(l);c&&(t.push(e.slice(s,r),encodeURIComponent(c)),s=r+i+1,c=""),i&&(r+=i,i=0)}return t.join("")+e.slice(s)}function _n(e,t,r,s){const i=s?s-1:Number.POSITIVE_INFINITY;let l=0;return c;function c(m){return An(m)?(e.enter(r),d(m)):t(m)}function d(m){return An(m)&&l++<i?(e.consume(m),d):(e.exit(r),t(m))}}const kU={tokenize:xU};function xU(e){const t=e.attempt(this.parser.constructs.contentInitial,s,i);let r;return t;function s(d){if(d===null){e.consume(d);return}return e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),_n(e,t,"linePrefix")}function i(d){return e.enter("paragraph"),l(d)}function l(d){const m=e.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=m),r=m,c(d)}function c(d){if(d===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(d);return}return sn(d)?(e.consume(d),e.exit("chunkText"),l):(e.consume(d),c)}}const SU={tokenize:CU},KS={tokenize:jU};function CU(e){const t=this,r=[];let s=0,i,l,c;return d;function d(D){if(s<r.length){const H=r[s];return t.containerState=H[1],e.attempt(H[0].continuation,m,f)(D)}return f(D)}function m(D){if(s++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&N();const H=t.events.length;let B=H,I;for(;B--;)if(t.events[B][0]==="exit"&&t.events[B][1].type==="chunkFlow"){I=t.events[B][1].end;break}j(s);let A=H;for(;A<t.events.length;)t.events[A][1].end={...I},A++;return $s(t.events,B+1,0,t.events.slice(H)),t.events.length=A,f(D)}return d(D)}function f(D){if(s===r.length){if(!i)return w(D);if(i.currentConstruct&&i.currentConstruct.concrete)return y(D);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(KS,v,g)(D)}function v(D){return i&&N(),j(s),w(D)}function g(D){return t.parser.lazy[t.now().line]=s!==r.length,c=t.now().offset,y(D)}function w(D){return t.containerState={},e.attempt(KS,k,y)(D)}function k(D){return s++,r.push([t.currentConstruct,t.containerState]),w(D)}function y(D){if(D===null){i&&N(),j(0),e.consume(D);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:l}),S(D)}function S(D){if(D===null){T(e.exit("chunkFlow"),!0),j(0),e.consume(D);return}return sn(D)?(e.consume(D),T(e.exit("chunkFlow")),s=0,t.interrupt=void 0,d):(e.consume(D),S)}function T(D,H){const B=t.sliceStream(D);if(H&&B.push(null),D.previous=l,l&&(l.next=D),l=D,i.defineSkip(D.start),i.write(B),t.parser.lazy[D.start.line]){let I=i.events.length;for(;I--;)if(i.events[I][1].start.offset<c&&(!i.events[I][1].end||i.events[I][1].end.offset>c))return;const A=t.events.length;let L=A,_,F;for(;L--;)if(t.events[L][0]==="exit"&&t.events[L][1].type==="chunkFlow"){if(_){F=t.events[L][1].end;break}_=!0}for(j(s),I=A;I<t.events.length;)t.events[I][1].end={...F},I++;$s(t.events,L+1,0,t.events.slice(A)),t.events.length=I}}function j(D){let H=r.length;for(;H-- >D;){const B=r[H];t.containerState=B[1],B[0].exit.call(t,e)}r.length=D}function N(){i.write([null]),l=void 0,i=void 0,t.containerState._closeFlow=void 0}}function jU(e,t,r){return _n(e,e.attempt(this.parser.constructs.document,t,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Bl(e){if(e===null||Xn(e)||_o(e))return 1;if(Pm(e))return 2}function Dm(e,t,r){const s=[];let i=-1;for(;++i<e.length;){const l=e[i].resolveAll;l&&!s.includes(l)&&(t=l(t,r),s.push(l))}return t}const fb={name:"attention",resolveAll:TU,tokenize:NU};function TU(e,t){let r=-1,s,i,l,c,d,m,f,v;for(;++r<e.length;)if(e[r][0]==="enter"&&e[r][1].type==="attentionSequence"&&e[r][1]._close){for(s=r;s--;)if(e[s][0]==="exit"&&e[s][1].type==="attentionSequence"&&e[s][1]._open&&t.sliceSerialize(e[s][1]).charCodeAt(0)===t.sliceSerialize(e[r][1]).charCodeAt(0)){if((e[s][1]._close||e[r][1]._open)&&(e[r][1].end.offset-e[r][1].start.offset)%3&&!((e[s][1].end.offset-e[s][1].start.offset+e[r][1].end.offset-e[r][1].start.offset)%3))continue;m=e[s][1].end.offset-e[s][1].start.offset>1&&e[r][1].end.offset-e[r][1].start.offset>1?2:1;const g={...e[s][1].end},w={...e[r][1].start};YS(g,-m),YS(w,m),c={type:m>1?"strongSequence":"emphasisSequence",start:g,end:{...e[s][1].end}},d={type:m>1?"strongSequence":"emphasisSequence",start:{...e[r][1].start},end:w},l={type:m>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[r][1].start}},i={type:m>1?"strong":"emphasis",start:{...c.start},end:{...d.end}},e[s][1].end={...c.start},e[r][1].start={...d.end},f=[],e[s][1].end.offset-e[s][1].start.offset&&(f=oi(f,[["enter",e[s][1],t],["exit",e[s][1],t]])),f=oi(f,[["enter",i,t],["enter",c,t],["exit",c,t],["enter",l,t]]),f=oi(f,Dm(t.parser.constructs.insideSpan.null,e.slice(s+1,r),t)),f=oi(f,[["exit",l,t],["enter",d,t],["exit",d,t],["exit",i,t]]),e[r][1].end.offset-e[r][1].start.offset?(v=2,f=oi(f,[["enter",e[r][1],t],["exit",e[r][1],t]])):v=0,$s(e,s-1,r-s+3,f),r=s+f.length-v-2;break}}for(r=-1;++r<e.length;)e[r][1].type==="attentionSequence"&&(e[r][1].type="data");return e}function NU(e,t){const r=this.parser.constructs.attentionMarkers.null,s=this.previous,i=Bl(s);let l;return c;function c(m){return l=m,e.enter("attentionSequence"),d(m)}function d(m){if(m===l)return e.consume(m),d;const f=e.exit("attentionSequence"),v=Bl(m),g=!v||v===2&&i||r.includes(m),w=!i||i===2&&v||r.includes(s);return f._open=!!(l===42?g:g&&(i||!w)),f._close=!!(l===42?w:w&&(v||!g)),t(m)}}function YS(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const PU={name:"autolink",tokenize:DU};function DU(e,t,r){let s=0;return i;function i(k){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(k),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),l}function l(k){return ks(k)?(e.consume(k),c):k===64?r(k):f(k)}function c(k){return k===43||k===45||k===46||gs(k)?(s=1,d(k)):f(k)}function d(k){return k===58?(e.consume(k),s=0,m):(k===43||k===45||k===46||gs(k))&&s++<32?(e.consume(k),d):(s=0,f(k))}function m(k){return k===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(k),e.exit("autolinkMarker"),e.exit("autolink"),t):k===null||k===32||k===60||Xh(k)?r(k):(e.consume(k),m)}function f(k){return k===64?(e.consume(k),v):vU(k)?(e.consume(k),f):r(k)}function v(k){return gs(k)?g(k):r(k)}function g(k){return k===46?(e.consume(k),s=0,v):k===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(k),e.exit("autolinkMarker"),e.exit("autolink"),t):w(k)}function w(k){if((k===45||gs(k))&&s++<63){const y=k===45?w:g;return e.consume(k),y}return r(k)}}const Lu={partial:!0,tokenize:RU};function RU(e,t,r){return s;function s(l){return An(l)?_n(e,i,"linePrefix")(l):i(l)}function i(l){return l===null||sn(l)?t(l):r(l)}}const a0={continuation:{tokenize:MU},exit:IU,name:"blockQuote",tokenize:AU};function AU(e,t,r){const s=this;return i;function i(c){if(c===62){const d=s.containerState;return d.open||(e.enter("blockQuote",{_container:!0}),d.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(c),e.exit("blockQuoteMarker"),l}return r(c)}function l(c){return An(c)?(e.enter("blockQuotePrefixWhitespace"),e.consume(c),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(c))}}function MU(e,t,r){const s=this;return i;function i(c){return An(c)?_n(e,l,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):l(c)}function l(c){return e.attempt(a0,t,r)(c)}}function IU(e){e.exit("blockQuote")}const o0={name:"characterEscape",tokenize:EU};function EU(e,t,r){return s;function s(l){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(l),e.exit("escapeMarker"),i}function i(l){return yU(l)?(e.enter("characterEscapeValue"),e.consume(l),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):r(l)}}const l0={name:"characterReference",tokenize:LU};function LU(e,t,r){const s=this;let i=0,l,c;return d;function d(g){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),m}function m(g){return g===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(g),e.exit("characterReferenceMarkerNumeric"),f):(e.enter("characterReferenceValue"),l=31,c=gs,v(g))}function f(g){return g===88||g===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(g),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),l=6,c=wU,v):(e.enter("characterReferenceValue"),l=7,c=pb,v(g))}function v(g){if(g===59&&i){const w=e.exit("characterReferenceValue");return c===gs&&!Gv(s.sliceSerialize(w))?r(g):(e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return c(g)&&i++<l?(e.consume(g),v):r(g)}}const XS={partial:!0,tokenize:_U},QS={concrete:!0,name:"codeFenced",tokenize:FU};function FU(e,t,r){const s=this,i={partial:!0,tokenize:B};let l=0,c=0,d;return m;function m(I){return f(I)}function f(I){const A=s.events[s.events.length-1];return l=A&&A[1].type==="linePrefix"?A[2].sliceSerialize(A[1],!0).length:0,d=I,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),v(I)}function v(I){return I===d?(c++,e.consume(I),v):c<3?r(I):(e.exit("codeFencedFenceSequence"),An(I)?_n(e,g,"whitespace")(I):g(I))}function g(I){return I===null||sn(I)?(e.exit("codeFencedFence"),s.interrupt?t(I):e.check(XS,S,H)(I)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),w(I))}function w(I){return I===null||sn(I)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(I)):An(I)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),_n(e,k,"whitespace")(I)):I===96&&I===d?r(I):(e.consume(I),w)}function k(I){return I===null||sn(I)?g(I):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),y(I))}function y(I){return I===null||sn(I)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(I)):I===96&&I===d?r(I):(e.consume(I),y)}function S(I){return e.attempt(i,H,T)(I)}function T(I){return e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),j}function j(I){return l>0&&An(I)?_n(e,N,"linePrefix",l+1)(I):N(I)}function N(I){return I===null||sn(I)?e.check(XS,S,H)(I):(e.enter("codeFlowValue"),D(I))}function D(I){return I===null||sn(I)?(e.exit("codeFlowValue"),N(I)):(e.consume(I),D)}function H(I){return e.exit("codeFenced"),t(I)}function B(I,A,L){let _=0;return F;function F(K){return I.enter("lineEnding"),I.consume(K),I.exit("lineEnding"),te}function te(K){return I.enter("codeFencedFence"),An(K)?_n(I,E,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(K):E(K)}function E(K){return K===d?(I.enter("codeFencedFenceSequence"),se(K)):L(K)}function se(K){return K===d?(_++,I.consume(K),se):_>=c?(I.exit("codeFencedFenceSequence"),An(K)?_n(I,X,"whitespace")(K):X(K)):L(K)}function X(K){return K===null||sn(K)?(I.exit("codeFencedFence"),A(K)):L(K)}}}function _U(e,t,r){const s=this;return i;function i(c){return c===null?r(c):(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),l)}function l(c){return s.parser.lazy[s.now().line]?r(c):t(c)}}const Ff={name:"codeIndented",tokenize:BU},OU={partial:!0,tokenize:WU};function BU(e,t,r){const s=this;return i;function i(f){return e.enter("codeIndented"),_n(e,l,"linePrefix",5)(f)}function l(f){const v=s.events[s.events.length-1];return v&&v[1].type==="linePrefix"&&v[2].sliceSerialize(v[1],!0).length>=4?c(f):r(f)}function c(f){return f===null?m(f):sn(f)?e.attempt(OU,c,m)(f):(e.enter("codeFlowValue"),d(f))}function d(f){return f===null||sn(f)?(e.exit("codeFlowValue"),c(f)):(e.consume(f),d)}function m(f){return e.exit("codeIndented"),t(f)}}function WU(e,t,r){const s=this;return i;function i(c){return s.parser.lazy[s.now().line]?r(c):sn(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),i):_n(e,l,"linePrefix",5)(c)}function l(c){const d=s.events[s.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?t(c):sn(c)?i(c):r(c)}}const UU={name:"codeText",previous:zU,resolve:HU,tokenize:qU};function HU(e){let t=e.length-4,r=3,s,i;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(s=r;++s<t;)if(e[s][1].type==="codeTextData"){e[r][1].type="codeTextPadding",e[t][1].type="codeTextPadding",r+=2,t-=2;break}}for(s=r-1,t++;++s<=t;)i===void 0?s!==t&&e[s][1].type!=="lineEnding"&&(i=s):(s===t||e[s][1].type==="lineEnding")&&(e[i][1].type="codeTextData",s!==i+2&&(e[i][1].end=e[s-1][1].end,e.splice(i+2,s-i-2),t-=s-i-2,s=i+2),i=void 0);return e}function zU(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function qU(e,t,r){let s=0,i,l;return c;function c(g){return e.enter("codeText"),e.enter("codeTextSequence"),d(g)}function d(g){return g===96?(e.consume(g),s++,d):(e.exit("codeTextSequence"),m(g))}function m(g){return g===null?r(g):g===32?(e.enter("space"),e.consume(g),e.exit("space"),m):g===96?(l=e.enter("codeTextSequence"),i=0,v(g)):sn(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),m):(e.enter("codeTextData"),f(g))}function f(g){return g===null||g===32||g===96||sn(g)?(e.exit("codeTextData"),m(g)):(e.consume(g),f)}function v(g){return g===96?(e.consume(g),i++,v):i===s?(e.exit("codeTextSequence"),e.exit("codeText"),t(g)):(l.type="codeTextData",f(g))}}class $U{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,r){const s=r??Number.POSITIVE_INFINITY;return s<this.left.length?this.left.slice(t,s):t>this.left.length?this.right.slice(this.right.length-s+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-s+this.left.length).reverse())}splice(t,r,s){const i=r||0;this.setCursor(Math.trunc(t));const l=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return s&&Nc(this.left,s),l.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Nc(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Nc(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const r=this.left.splice(t,Number.POSITIVE_INFINITY);Nc(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Nc(this.left,r.reverse())}}}function Nc(e,t){let r=0;if(t.length<1e4)e.push(...t);else for(;r<t.length;)e.push(...t.slice(r,r+1e4)),r+=1e4}function c0(e){const t={};let r=-1,s,i,l,c,d,m,f;const v=new $U(e);for(;++r<v.length;){for(;r in t;)r=t[r];if(s=v.get(r),r&&s[1].type==="chunkFlow"&&v.get(r-1)[1].type==="listItemPrefix"&&(m=s[1]._tokenizer.events,l=0,l<m.length&&m[l][1].type==="lineEndingBlank"&&(l+=2),l<m.length&&m[l][1].type==="content"))for(;++l<m.length&&m[l][1].type!=="content";)m[l][1].type==="chunkText"&&(m[l][1]._isInFirstContentOfListItem=!0,l++);if(s[0]==="enter")s[1].contentType&&(Object.assign(t,VU(v,r)),r=t[r],f=!0);else if(s[1]._container){for(l=r,i=void 0;l--;)if(c=v.get(l),c[1].type==="lineEnding"||c[1].type==="lineEndingBlank")c[0]==="enter"&&(i&&(v.get(i)[1].type="lineEndingBlank"),c[1].type="lineEnding",i=l);else if(!(c[1].type==="linePrefix"||c[1].type==="listItemIndent"))break;i&&(s[1].end={...v.get(i)[1].start},d=v.slice(i,r),d.unshift(s),v.splice(i,r-i+1,d))}}return $s(e,0,Number.POSITIVE_INFINITY,v.slice(0)),!f}function VU(e,t){const r=e.get(t)[1],s=e.get(t)[2];let i=t-1;const l=[];let c=r._tokenizer;c||(c=s.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(c._contentTypeTextTrailing=!0));const d=c.events,m=[],f={};let v,g,w=-1,k=r,y=0,S=0;const T=[S];for(;k;){for(;e.get(++i)[1]!==k;);l.push(i),k._tokenizer||(v=s.sliceStream(k),k.next||v.push(null),g&&c.defineSkip(k.start),k._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(v),k._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=void 0)),g=k,k=k.next}for(k=r;++w<d.length;)d[w][0]==="exit"&&d[w-1][0]==="enter"&&d[w][1].type===d[w-1][1].type&&d[w][1].start.line!==d[w][1].end.line&&(S=w+1,T.push(S),k._tokenizer=void 0,k.previous=void 0,k=k.next);for(c.events=[],k?(k._tokenizer=void 0,k.previous=void 0):T.pop(),w=T.length;w--;){const j=d.slice(T[w],T[w+1]),N=l.pop();m.push([N,N+j.length-1]),e.splice(N,2,j)}for(m.reverse(),w=-1;++w<m.length;)f[y+m[w][0]]=y+m[w][1],y+=m[w][1]-m[w][0]-1;return f}const GU={resolve:YU,tokenize:XU},KU={partial:!0,tokenize:QU};function YU(e){return c0(e),e}function XU(e,t){let r;return s;function s(d){return e.enter("content"),r=e.enter("chunkContent",{contentType:"content"}),i(d)}function i(d){return d===null?l(d):sn(d)?e.check(KU,c,l)(d):(e.consume(d),i)}function l(d){return e.exit("chunkContent"),e.exit("content"),t(d)}function c(d){return e.consume(d),e.exit("chunkContent"),r.next=e.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,i}}function QU(e,t,r){const s=this;return i;function i(c){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),_n(e,l,"linePrefix")}function l(c){if(c===null||sn(c))return r(c);const d=s.events[s.events.length-1];return!s.parser.constructs.disable.null.includes("codeIndented")&&d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?t(c):e.interrupt(s.parser.constructs.flow,r,t)(c)}}function u0(e,t,r,s,i,l,c,d,m){const f=m||Number.POSITIVE_INFINITY;let v=0;return g;function g(j){return j===60?(e.enter(s),e.enter(i),e.enter(l),e.consume(j),e.exit(l),w):j===null||j===32||j===41||Xh(j)?r(j):(e.enter(s),e.enter(c),e.enter(d),e.enter("chunkString",{contentType:"string"}),S(j))}function w(j){return j===62?(e.enter(l),e.consume(j),e.exit(l),e.exit(i),e.exit(s),t):(e.enter(d),e.enter("chunkString",{contentType:"string"}),k(j))}function k(j){return j===62?(e.exit("chunkString"),e.exit(d),w(j)):j===null||j===60||sn(j)?r(j):(e.consume(j),j===92?y:k)}function y(j){return j===60||j===62||j===92?(e.consume(j),k):k(j)}function S(j){return!v&&(j===null||j===41||Xn(j))?(e.exit("chunkString"),e.exit(d),e.exit(c),e.exit(s),t(j)):v<f&&j===40?(e.consume(j),v++,S):j===41?(e.consume(j),v--,S):j===null||j===32||j===40||Xh(j)?r(j):(e.consume(j),j===92?T:S)}function T(j){return j===40||j===41||j===92?(e.consume(j),S):S(j)}}function d0(e,t,r,s,i,l){const c=this;let d=0,m;return f;function f(k){return e.enter(s),e.enter(i),e.consume(k),e.exit(i),e.enter(l),v}function v(k){return d>999||k===null||k===91||k===93&&!m||k===94&&!d&&"_hiddenFootnoteSupport"in c.parser.constructs?r(k):k===93?(e.exit(l),e.enter(i),e.consume(k),e.exit(i),e.exit(s),t):sn(k)?(e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),v):(e.enter("chunkString",{contentType:"string"}),g(k))}function g(k){return k===null||k===91||k===93||sn(k)||d++>999?(e.exit("chunkString"),v(k)):(e.consume(k),m||(m=!An(k)),k===92?w:g)}function w(k){return k===91||k===92||k===93?(e.consume(k),d++,g):g(k)}}function h0(e,t,r,s,i,l){let c;return d;function d(w){return w===34||w===39||w===40?(e.enter(s),e.enter(i),e.consume(w),e.exit(i),c=w===40?41:w,m):r(w)}function m(w){return w===c?(e.enter(i),e.consume(w),e.exit(i),e.exit(s),t):(e.enter(l),f(w))}function f(w){return w===c?(e.exit(l),m(c)):w===null?r(w):sn(w)?(e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),_n(e,f,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),v(w))}function v(w){return w===c||w===null||sn(w)?(e.exit("chunkString"),f(w)):(e.consume(w),w===92?g:v)}function g(w){return w===c||w===92?(e.consume(w),v):v(w)}}function Jc(e,t){let r;return s;function s(i){return sn(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),r=!0,s):An(i)?_n(e,s,r?"linePrefix":"lineSuffix")(i):t(i)}}const JU={name:"definition",tokenize:eH},ZU={partial:!0,tokenize:tH};function eH(e,t,r){const s=this;let i;return l;function l(k){return e.enter("definition"),c(k)}function c(k){return d0.call(s,e,d,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(k)}function d(k){return i=ji(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),k===58?(e.enter("definitionMarker"),e.consume(k),e.exit("definitionMarker"),m):r(k)}function m(k){return Xn(k)?Jc(e,f)(k):f(k)}function f(k){return u0(e,v,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(k)}function v(k){return e.attempt(ZU,g,g)(k)}function g(k){return An(k)?_n(e,w,"whitespace")(k):w(k)}function w(k){return k===null||sn(k)?(e.exit("definition"),s.parser.defined.push(i),t(k)):r(k)}}function tH(e,t,r){return s;function s(d){return Xn(d)?Jc(e,i)(d):r(d)}function i(d){return h0(e,l,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(d)}function l(d){return An(d)?_n(e,c,"whitespace")(d):c(d)}function c(d){return d===null||sn(d)?t(d):r(d)}}const nH={name:"hardBreakEscape",tokenize:rH};function rH(e,t,r){return s;function s(l){return e.enter("hardBreakEscape"),e.consume(l),i}function i(l){return sn(l)?(e.exit("hardBreakEscape"),t(l)):r(l)}}const sH={name:"headingAtx",resolve:iH,tokenize:aH};function iH(e,t){let r=e.length-2,s=3,i,l;return e[s][1].type==="whitespace"&&(s+=2),r-2>s&&e[r][1].type==="whitespace"&&(r-=2),e[r][1].type==="atxHeadingSequence"&&(s===r-1||r-4>s&&e[r-2][1].type==="whitespace")&&(r-=s+1===r?2:4),r>s&&(i={type:"atxHeadingText",start:e[s][1].start,end:e[r][1].end},l={type:"chunkText",start:e[s][1].start,end:e[r][1].end,contentType:"text"},$s(e,s,r-s+1,[["enter",i,t],["enter",l,t],["exit",l,t],["exit",i,t]])),e}function aH(e,t,r){let s=0;return i;function i(v){return e.enter("atxHeading"),l(v)}function l(v){return e.enter("atxHeadingSequence"),c(v)}function c(v){return v===35&&s++<6?(e.consume(v),c):v===null||Xn(v)?(e.exit("atxHeadingSequence"),d(v)):r(v)}function d(v){return v===35?(e.enter("atxHeadingSequence"),m(v)):v===null||sn(v)?(e.exit("atxHeading"),t(v)):An(v)?_n(e,d,"whitespace")(v):(e.enter("atxHeadingText"),f(v))}function m(v){return v===35?(e.consume(v),m):(e.exit("atxHeadingSequence"),d(v))}function f(v){return v===null||v===35||Xn(v)?(e.exit("atxHeadingText"),d(v)):(e.consume(v),f)}}const oH=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],JS=["pre","script","style","textarea"],lH={concrete:!0,name:"htmlFlow",resolveTo:dH,tokenize:hH},cH={partial:!0,tokenize:pH},uH={partial:!0,tokenize:mH};function dH(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function hH(e,t,r){const s=this;let i,l,c,d,m;return f;function f(R){return v(R)}function v(R){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(R),g}function g(R){return R===33?(e.consume(R),w):R===47?(e.consume(R),l=!0,S):R===63?(e.consume(R),i=3,s.interrupt?t:P):ks(R)?(e.consume(R),c=String.fromCharCode(R),T):r(R)}function w(R){return R===45?(e.consume(R),i=2,k):R===91?(e.consume(R),i=5,d=0,y):ks(R)?(e.consume(R),i=4,s.interrupt?t:P):r(R)}function k(R){return R===45?(e.consume(R),s.interrupt?t:P):r(R)}function y(R){const ve="CDATA[";return R===ve.charCodeAt(d++)?(e.consume(R),d===ve.length?s.interrupt?t:E:y):r(R)}function S(R){return ks(R)?(e.consume(R),c=String.fromCharCode(R),T):r(R)}function T(R){if(R===null||R===47||R===62||Xn(R)){const ve=R===47,pe=c.toLowerCase();return!ve&&!l&&JS.includes(pe)?(i=1,s.interrupt?t(R):E(R)):oH.includes(c.toLowerCase())?(i=6,ve?(e.consume(R),j):s.interrupt?t(R):E(R)):(i=7,s.interrupt&&!s.parser.lazy[s.now().line]?r(R):l?N(R):D(R))}return R===45||gs(R)?(e.consume(R),c+=String.fromCharCode(R),T):r(R)}function j(R){return R===62?(e.consume(R),s.interrupt?t:E):r(R)}function N(R){return An(R)?(e.consume(R),N):F(R)}function D(R){return R===47?(e.consume(R),F):R===58||R===95||ks(R)?(e.consume(R),H):An(R)?(e.consume(R),D):F(R)}function H(R){return R===45||R===46||R===58||R===95||gs(R)?(e.consume(R),H):B(R)}function B(R){return R===61?(e.consume(R),I):An(R)?(e.consume(R),B):D(R)}function I(R){return R===null||R===60||R===61||R===62||R===96?r(R):R===34||R===39?(e.consume(R),m=R,A):An(R)?(e.consume(R),I):L(R)}function A(R){return R===m?(e.consume(R),m=null,_):R===null||sn(R)?r(R):(e.consume(R),A)}function L(R){return R===null||R===34||R===39||R===47||R===60||R===61||R===62||R===96||Xn(R)?B(R):(e.consume(R),L)}function _(R){return R===47||R===62||An(R)?D(R):r(R)}function F(R){return R===62?(e.consume(R),te):r(R)}function te(R){return R===null||sn(R)?E(R):An(R)?(e.consume(R),te):r(R)}function E(R){return R===45&&i===2?(e.consume(R),G):R===60&&i===1?(e.consume(R),q):R===62&&i===4?(e.consume(R),W):R===63&&i===3?(e.consume(R),P):R===93&&i===5?(e.consume(R),Q):sn(R)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(cH,J,se)(R)):R===null||sn(R)?(e.exit("htmlFlowData"),se(R)):(e.consume(R),E)}function se(R){return e.check(uH,X,J)(R)}function X(R){return e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),K}function K(R){return R===null||sn(R)?se(R):(e.enter("htmlFlowData"),E(R))}function G(R){return R===45?(e.consume(R),P):E(R)}function q(R){return R===47?(e.consume(R),c="",U):E(R)}function U(R){if(R===62){const ve=c.toLowerCase();return JS.includes(ve)?(e.consume(R),W):E(R)}return ks(R)&&c.length<8?(e.consume(R),c+=String.fromCharCode(R),U):E(R)}function Q(R){return R===93?(e.consume(R),P):E(R)}function P(R){return R===62?(e.consume(R),W):R===45&&i===2?(e.consume(R),P):E(R)}function W(R){return R===null||sn(R)?(e.exit("htmlFlowData"),J(R)):(e.consume(R),W)}function J(R){return e.exit("htmlFlow"),t(R)}}function mH(e,t,r){const s=this;return i;function i(c){return sn(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),l):r(c)}function l(c){return s.parser.lazy[s.now().line]?r(c):t(c)}}function pH(e,t,r){return s;function s(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(Lu,t,r)}}const fH={name:"htmlText",tokenize:gH};function gH(e,t,r){const s=this;let i,l,c;return d;function d(P){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(P),m}function m(P){return P===33?(e.consume(P),f):P===47?(e.consume(P),B):P===63?(e.consume(P),D):ks(P)?(e.consume(P),L):r(P)}function f(P){return P===45?(e.consume(P),v):P===91?(e.consume(P),l=0,y):ks(P)?(e.consume(P),N):r(P)}function v(P){return P===45?(e.consume(P),k):r(P)}function g(P){return P===null?r(P):P===45?(e.consume(P),w):sn(P)?(c=g,q(P)):(e.consume(P),g)}function w(P){return P===45?(e.consume(P),k):g(P)}function k(P){return P===62?G(P):P===45?w(P):g(P)}function y(P){const W="CDATA[";return P===W.charCodeAt(l++)?(e.consume(P),l===W.length?S:y):r(P)}function S(P){return P===null?r(P):P===93?(e.consume(P),T):sn(P)?(c=S,q(P)):(e.consume(P),S)}function T(P){return P===93?(e.consume(P),j):S(P)}function j(P){return P===62?G(P):P===93?(e.consume(P),j):S(P)}function N(P){return P===null||P===62?G(P):sn(P)?(c=N,q(P)):(e.consume(P),N)}function D(P){return P===null?r(P):P===63?(e.consume(P),H):sn(P)?(c=D,q(P)):(e.consume(P),D)}function H(P){return P===62?G(P):D(P)}function B(P){return ks(P)?(e.consume(P),I):r(P)}function I(P){return P===45||gs(P)?(e.consume(P),I):A(P)}function A(P){return sn(P)?(c=A,q(P)):An(P)?(e.consume(P),A):G(P)}function L(P){return P===45||gs(P)?(e.consume(P),L):P===47||P===62||Xn(P)?_(P):r(P)}function _(P){return P===47?(e.consume(P),G):P===58||P===95||ks(P)?(e.consume(P),F):sn(P)?(c=_,q(P)):An(P)?(e.consume(P),_):G(P)}function F(P){return P===45||P===46||P===58||P===95||gs(P)?(e.consume(P),F):te(P)}function te(P){return P===61?(e.consume(P),E):sn(P)?(c=te,q(P)):An(P)?(e.consume(P),te):_(P)}function E(P){return P===null||P===60||P===61||P===62||P===96?r(P):P===34||P===39?(e.consume(P),i=P,se):sn(P)?(c=E,q(P)):An(P)?(e.consume(P),E):(e.consume(P),X)}function se(P){return P===i?(e.consume(P),i=void 0,K):P===null?r(P):sn(P)?(c=se,q(P)):(e.consume(P),se)}function X(P){return P===null||P===34||P===39||P===60||P===61||P===96?r(P):P===47||P===62||Xn(P)?_(P):(e.consume(P),X)}function K(P){return P===47||P===62||Xn(P)?_(P):r(P)}function G(P){return P===62?(e.consume(P),e.exit("htmlTextData"),e.exit("htmlText"),t):r(P)}function q(P){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),U}function U(P){return An(P)?_n(e,Q,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(P):Q(P)}function Q(P){return e.enter("htmlTextData"),c(P)}}const Kv={name:"labelEnd",resolveAll:yH,resolveTo:kH,tokenize:xH},bH={tokenize:SH},vH={tokenize:CH},wH={tokenize:jH};function yH(e){let t=-1;const r=[];for(;++t<e.length;){const s=e[t][1];if(r.push(e[t]),s.type==="labelImage"||s.type==="labelLink"||s.type==="labelEnd"){const i=s.type==="labelImage"?4:2;s.type="data",t+=i}}return e.length!==r.length&&$s(e,0,e.length,r),e}function kH(e,t){let r=e.length,s=0,i,l,c,d;for(;r--;)if(i=e[r][1],l){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[r][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(c){if(e[r][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(l=r,i.type!=="labelLink")){s=2;break}}else i.type==="labelEnd"&&(c=r);const m={type:e[l][1].type==="labelLink"?"link":"image",start:{...e[l][1].start},end:{...e[e.length-1][1].end}},f={type:"label",start:{...e[l][1].start},end:{...e[c][1].end}},v={type:"labelText",start:{...e[l+s+2][1].end},end:{...e[c-2][1].start}};return d=[["enter",m,t],["enter",f,t]],d=oi(d,e.slice(l+1,l+s+3)),d=oi(d,[["enter",v,t]]),d=oi(d,Dm(t.parser.constructs.insideSpan.null,e.slice(l+s+4,c-3),t)),d=oi(d,[["exit",v,t],e[c-2],e[c-1],["exit",f,t]]),d=oi(d,e.slice(c+1)),d=oi(d,[["exit",m,t]]),$s(e,l,e.length,d),e}function xH(e,t,r){const s=this;let i=s.events.length,l,c;for(;i--;)if((s.events[i][1].type==="labelImage"||s.events[i][1].type==="labelLink")&&!s.events[i][1]._balanced){l=s.events[i][1];break}return d;function d(w){return l?l._inactive?g(w):(c=s.parser.defined.includes(ji(s.sliceSerialize({start:l.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(w),e.exit("labelMarker"),e.exit("labelEnd"),m):r(w)}function m(w){return w===40?e.attempt(bH,v,c?v:g)(w):w===91?e.attempt(vH,v,c?f:g)(w):c?v(w):g(w)}function f(w){return e.attempt(wH,v,g)(w)}function v(w){return t(w)}function g(w){return l._balanced=!0,r(w)}}function SH(e,t,r){return s;function s(g){return e.enter("resource"),e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),i}function i(g){return Xn(g)?Jc(e,l)(g):l(g)}function l(g){return g===41?v(g):u0(e,c,d,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function c(g){return Xn(g)?Jc(e,m)(g):v(g)}function d(g){return r(g)}function m(g){return g===34||g===39||g===40?h0(e,f,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):v(g)}function f(g){return Xn(g)?Jc(e,v)(g):v(g)}function v(g){return g===41?(e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),e.exit("resource"),t):r(g)}}function CH(e,t,r){const s=this;return i;function i(d){return d0.call(s,e,l,c,"reference","referenceMarker","referenceString")(d)}function l(d){return s.parser.defined.includes(ji(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?t(d):r(d)}function c(d){return r(d)}}function jH(e,t,r){return s;function s(l){return e.enter("reference"),e.enter("referenceMarker"),e.consume(l),e.exit("referenceMarker"),i}function i(l){return l===93?(e.enter("referenceMarker"),e.consume(l),e.exit("referenceMarker"),e.exit("reference"),t):r(l)}}const TH={name:"labelStartImage",resolveAll:Kv.resolveAll,tokenize:NH};function NH(e,t,r){const s=this;return i;function i(d){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(d),e.exit("labelImageMarker"),l}function l(d){return d===91?(e.enter("labelMarker"),e.consume(d),e.exit("labelMarker"),e.exit("labelImage"),c):r(d)}function c(d){return d===94&&"_hiddenFootnoteSupport"in s.parser.constructs?r(d):t(d)}}const PH={name:"labelStartLink",resolveAll:Kv.resolveAll,tokenize:DH};function DH(e,t,r){const s=this;return i;function i(c){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelLink"),l}function l(c){return c===94&&"_hiddenFootnoteSupport"in s.parser.constructs?r(c):t(c)}}const _f={name:"lineEnding",tokenize:RH};function RH(e,t){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),_n(e,t,"linePrefix")}}const jh={name:"thematicBreak",tokenize:AH};function AH(e,t,r){let s=0,i;return l;function l(f){return e.enter("thematicBreak"),c(f)}function c(f){return i=f,d(f)}function d(f){return f===i?(e.enter("thematicBreakSequence"),m(f)):s>=3&&(f===null||sn(f))?(e.exit("thematicBreak"),t(f)):r(f)}function m(f){return f===i?(e.consume(f),s++,m):(e.exit("thematicBreakSequence"),An(f)?_n(e,d,"whitespace")(f):d(f))}}const Rs={continuation:{tokenize:LH},exit:_H,name:"list",tokenize:EH},MH={partial:!0,tokenize:OH},IH={partial:!0,tokenize:FH};function EH(e,t,r){const s=this,i=s.events[s.events.length-1];let l=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,c=0;return d;function d(k){const y=s.containerState.type||(k===42||k===43||k===45?"listUnordered":"listOrdered");if(y==="listUnordered"?!s.containerState.marker||k===s.containerState.marker:pb(k)){if(s.containerState.type||(s.containerState.type=y,e.enter(y,{_container:!0})),y==="listUnordered")return e.enter("listItemPrefix"),k===42||k===45?e.check(jh,r,f)(k):f(k);if(!s.interrupt||k===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),m(k)}return r(k)}function m(k){return pb(k)&&++c<10?(e.consume(k),m):(!s.interrupt||c<2)&&(s.containerState.marker?k===s.containerState.marker:k===41||k===46)?(e.exit("listItemValue"),f(k)):r(k)}function f(k){return e.enter("listItemMarker"),e.consume(k),e.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||k,e.check(Lu,s.interrupt?r:v,e.attempt(MH,w,g))}function v(k){return s.containerState.initialBlankLine=!0,l++,w(k)}function g(k){return An(k)?(e.enter("listItemPrefixWhitespace"),e.consume(k),e.exit("listItemPrefixWhitespace"),w):r(k)}function w(k){return s.containerState.size=l+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(k)}}function LH(e,t,r){const s=this;return s.containerState._closeFlow=void 0,e.check(Lu,i,l);function i(d){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,_n(e,t,"listItemIndent",s.containerState.size+1)(d)}function l(d){return s.containerState.furtherBlankLines||!An(d)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,c(d)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,e.attempt(IH,t,c)(d))}function c(d){return s.containerState._closeFlow=!0,s.interrupt=void 0,_n(e,e.attempt(Rs,t,r),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d)}}function FH(e,t,r){const s=this;return _n(e,i,"listItemIndent",s.containerState.size+1);function i(l){const c=s.events[s.events.length-1];return c&&c[1].type==="listItemIndent"&&c[2].sliceSerialize(c[1],!0).length===s.containerState.size?t(l):r(l)}}function _H(e){e.exit(this.containerState.type)}function OH(e,t,r){const s=this;return _n(e,i,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(l){const c=s.events[s.events.length-1];return!An(l)&&c&&c[1].type==="listItemPrefixWhitespace"?t(l):r(l)}}const ZS={name:"setextUnderline",resolveTo:BH,tokenize:WH};function BH(e,t){let r=e.length,s,i,l;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){s=r;break}e[r][1].type==="paragraph"&&(i=r)}else e[r][1].type==="content"&&e.splice(r,1),!l&&e[r][1].type==="definition"&&(l=r);const c={type:"setextHeading",start:{...e[s][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",l?(e.splice(i,0,["enter",c,t]),e.splice(l+1,0,["exit",e[s][1],t]),e[s][1].end={...e[l][1].end}):e[s][1]=c,e.push(["exit",c,t]),e}function WH(e,t,r){const s=this;let i;return l;function l(f){let v=s.events.length,g;for(;v--;)if(s.events[v][1].type!=="lineEnding"&&s.events[v][1].type!=="linePrefix"&&s.events[v][1].type!=="content"){g=s.events[v][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||g)?(e.enter("setextHeadingLine"),i=f,c(f)):r(f)}function c(f){return e.enter("setextHeadingLineSequence"),d(f)}function d(f){return f===i?(e.consume(f),d):(e.exit("setextHeadingLineSequence"),An(f)?_n(e,m,"lineSuffix")(f):m(f))}function m(f){return f===null||sn(f)?(e.exit("setextHeadingLine"),t(f)):r(f)}}const UH={tokenize:HH};function HH(e){const t=this,r=e.attempt(Lu,s,e.attempt(this.parser.constructs.flowInitial,i,_n(e,e.attempt(this.parser.constructs.flow,i,e.attempt(GU,i)),"linePrefix")));return r;function s(l){if(l===null){e.consume(l);return}return e.enter("lineEndingBlank"),e.consume(l),e.exit("lineEndingBlank"),t.currentConstruct=void 0,r}function i(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),t.currentConstruct=void 0,r}}const zH={resolveAll:p0()},qH=m0("string"),$H=m0("text");function m0(e){return{resolveAll:p0(e==="text"?VH:void 0),tokenize:t};function t(r){const s=this,i=this.parser.constructs[e],l=r.attempt(i,c,d);return c;function c(v){return f(v)?l(v):d(v)}function d(v){if(v===null){r.consume(v);return}return r.enter("data"),r.consume(v),m}function m(v){return f(v)?(r.exit("data"),l(v)):(r.consume(v),m)}function f(v){if(v===null)return!0;const g=i[v];let w=-1;if(g)for(;++w<g.length;){const k=g[w];if(!k.previous||k.previous.call(s,s.previous))return!0}return!1}}}function p0(e){return t;function t(r,s){let i=-1,l;for(;++i<=r.length;)l===void 0?r[i]&&r[i][1].type==="data"&&(l=i,i++):(!r[i]||r[i][1].type!=="data")&&(i!==l+2&&(r[l][1].end=r[i-1][1].end,r.splice(l+2,i-l-2),i=l+2),l=void 0);return e?e(r,s):r}}function VH(e,t){let r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type==="lineEnding")&&e[r-1][1].type==="data"){const s=e[r-1][1],i=t.sliceStream(s);let l=i.length,c=-1,d=0,m;for(;l--;){const f=i[l];if(typeof f=="string"){for(c=f.length;f.charCodeAt(c-1)===32;)d++,c--;if(c)break;c=-1}else if(f===-2)m=!0,d++;else if(f!==-1){l++;break}}if(t._contentTypeTextTrailing&&r===e.length&&(d=0),d){const f={type:r===e.length||m||d<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:l?c:s.start._bufferIndex+c,_index:s.start._index+l,line:s.end.line,column:s.end.column-d,offset:s.end.offset-d},end:{...s.end}};s.end={...f.start},s.start.offset===s.end.offset?Object.assign(s,f):(e.splice(r,0,["enter",f,t],["exit",f,t]),r+=2)}r++}return e}const GH={42:Rs,43:Rs,45:Rs,48:Rs,49:Rs,50:Rs,51:Rs,52:Rs,53:Rs,54:Rs,55:Rs,56:Rs,57:Rs,62:a0},KH={91:JU},YH={[-2]:Ff,[-1]:Ff,32:Ff},XH={35:sH,42:jh,45:[ZS,jh],60:lH,61:ZS,95:jh,96:QS,126:QS},QH={38:l0,92:o0},JH={[-5]:_f,[-4]:_f,[-3]:_f,33:TH,38:l0,42:fb,60:[PU,fH],91:PH,92:[nH,o0],93:Kv,95:fb,96:UU},ZH={null:[fb,zH]},ez={null:[42,95]},tz={null:[]},nz=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:ez,contentInitial:KH,disable:tz,document:GH,flow:XH,flowInitial:YH,insideSpan:ZH,string:QH,text:JH},Symbol.toStringTag,{value:"Module"}));function rz(e,t,r){let s={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0};const i={},l=[];let c=[],d=[];const m={attempt:A(B),check:A(I),consume:N,enter:D,exit:H,interrupt:A(I,{interrupt:!0})},f={code:null,containerState:{},defineSkip:S,events:[],now:y,parser:e,previous:null,sliceSerialize:w,sliceStream:k,write:g};let v=t.tokenize.call(f,m);return t.resolveAll&&l.push(t),f;function g(te){return c=oi(c,te),T(),c[c.length-1]!==null?[]:(L(t,0),f.events=Dm(l,f.events,f),f.events)}function w(te,E){return iz(k(te),E)}function k(te){return sz(c,te)}function y(){const{_bufferIndex:te,_index:E,line:se,column:X,offset:K}=s;return{_bufferIndex:te,_index:E,line:se,column:X,offset:K}}function S(te){i[te.line]=te.column,F()}function T(){let te;for(;s._index<c.length;){const E=c[s._index];if(typeof E=="string")for(te=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===te&&s._bufferIndex<E.length;)j(E.charCodeAt(s._bufferIndex));else j(E)}}function j(te){v=v(te)}function N(te){sn(te)?(s.line++,s.column=1,s.offset+=te===-3?2:1,F()):te!==-1&&(s.column++,s.offset++),s._bufferIndex<0?s._index++:(s._bufferIndex++,s._bufferIndex===c[s._index].length&&(s._bufferIndex=-1,s._index++)),f.previous=te}function D(te,E){const se=E||{};return se.type=te,se.start=y(),f.events.push(["enter",se,f]),d.push(se),se}function H(te){const E=d.pop();return E.end=y(),f.events.push(["exit",E,f]),E}function B(te,E){L(te,E.from)}function I(te,E){E.restore()}function A(te,E){return se;function se(X,K,G){let q,U,Q,P;return Array.isArray(X)?J(X):"tokenize"in X?J([X]):W(X);function W(Y){return Se;function Se(Le){const re=Le!==null&&Y[Le],Ce=Le!==null&&Y.null,Xe=[...Array.isArray(re)?re:re?[re]:[],...Array.isArray(Ce)?Ce:Ce?[Ce]:[]];return J(Xe)(Le)}}function J(Y){return q=Y,U=0,Y.length===0?G:R(Y[U])}function R(Y){return Se;function Se(Le){return P=_(),Q=Y,Y.partial||(f.currentConstruct=Y),Y.name&&f.parser.constructs.disable.null.includes(Y.name)?pe():Y.tokenize.call(E?Object.assign(Object.create(f),E):f,m,ve,pe)(Le)}}function ve(Y){return te(Q,P),K}function pe(Y){return P.restore(),++U<q.length?R(q[U]):G}}}function L(te,E){te.resolveAll&&!l.includes(te)&&l.push(te),te.resolve&&$s(f.events,E,f.events.length-E,te.resolve(f.events.slice(E),f)),te.resolveTo&&(f.events=te.resolveTo(f.events,f))}function _(){const te=y(),E=f.previous,se=f.currentConstruct,X=f.events.length,K=Array.from(d);return{from:X,restore:G};function G(){s=te,f.previous=E,f.currentConstruct=se,f.events.length=X,d=K,F()}}function F(){s.line in i&&s.column<2&&(s.column=i[s.line],s.offset+=i[s.line]-1)}}function sz(e,t){const r=t.start._index,s=t.start._bufferIndex,i=t.end._index,l=t.end._bufferIndex;let c;if(r===i)c=[e[r].slice(s,l)];else{if(c=e.slice(r,i),s>-1){const d=c[0];typeof d=="string"?c[0]=d.slice(s):c.shift()}l>0&&c.push(e[i].slice(0,l))}return c}function iz(e,t){let r=-1;const s=[];let i;for(;++r<e.length;){const l=e[r];let c;if(typeof l=="string")c=l;else switch(l){case-5:{c="\r";break}case-4:{c=`
|
|
71
|
-
`;break}case-3:{c=`\r
|
|
72
|
-
`;break}case-2:{c=t?" ":" ";break}case-1:{if(!t&&i)continue;c=" ";break}default:c=String.fromCharCode(l)}i=l===-2,s.push(c)}return s.join("")}function az(e){const s={constructs:s0([nz,...(e||{}).extensions||[]]),content:i(kU),defined:[],document:i(SU),flow:i(UH),lazy:{},string:i(qH),text:i($H)};return s;function i(l){return c;function c(d){return rz(s,l,d)}}}function oz(e){for(;!c0(e););return e}const eC=/[\0\t\n\r]/g;function lz(){let e=1,t="",r=!0,s;return i;function i(l,c,d){const m=[];let f,v,g,w,k;for(l=t+(typeof l=="string"?l.toString():new TextDecoder(c||void 0).decode(l)),g=0,t="",r&&(l.charCodeAt(0)===65279&&g++,r=void 0);g<l.length;){if(eC.lastIndex=g,f=eC.exec(l),w=f&&f.index!==void 0?f.index:l.length,k=l.charCodeAt(w),!f){t=l.slice(g);break}if(k===10&&g===w&&s)m.push(-3),s=void 0;else switch(s&&(m.push(-5),s=void 0),g<w&&(m.push(l.slice(g,w)),e+=w-g),k){case 0:{m.push(65533),e++;break}case 9:{for(v=Math.ceil(e/4)*4,m.push(-2);e++<v;)m.push(-1);break}case 10:{m.push(-4),e=1;break}default:s=!0,e=1}g=w+1}return d&&(s&&m.push(-5),t&&m.push(t),m.push(null)),m}}const cz=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function uz(e){return e.replace(cz,dz)}function dz(e,t,r){if(t)return t;if(r.charCodeAt(0)===35){const i=r.charCodeAt(1),l=i===120||i===88;return i0(r.slice(l?2:1),l?16:10)}return Gv(r)||e}const f0={}.hasOwnProperty;function hz(e,t,r){return t&&typeof t=="object"&&(r=t,t=void 0),mz(r)(oz(az(r).document().write(lz()(e,t,!0))))}function mz(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:l(_e),autolinkProtocol:_,autolinkEmail:_,atxHeading:l(Ke),blockQuote:l(Ce),characterEscape:_,characterReference:_,codeFenced:l(Xe),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:l(Xe,c),codeText:l(Ue,c),codeTextData:_,data:_,codeFlowValue:_,definition:l(ct),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:l(Nt),hardBreakEscape:l(ut),hardBreakTrailing:l(ut),htmlFlow:l(vt,c),htmlFlowData:_,htmlText:l(vt,c),htmlTextData:_,image:l(Te),label:c,link:l(_e),listItem:l(qe),listItemValue:w,listOrdered:l(we,g),listUnordered:l(we),paragraph:l(ke),reference:R,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:l(Ke),strong:l(Ee),thematicBreak:l(wt)},exit:{atxHeading:m(),atxHeadingSequence:B,autolink:m(),autolinkEmail:re,autolinkProtocol:Le,blockQuote:m(),characterEscapeValue:F,characterReferenceMarkerHexadecimal:pe,characterReferenceMarkerNumeric:pe,characterReferenceValue:Y,characterReference:Se,codeFenced:m(T),codeFencedFence:S,codeFencedFenceInfo:k,codeFencedFenceMeta:y,codeFlowValue:F,codeIndented:m(j),codeText:m(K),codeTextData:F,data:F,definition:m(),definitionDestinationString:H,definitionLabelString:N,definitionTitleString:D,emphasis:m(),hardBreakEscape:m(E),hardBreakTrailing:m(E),htmlFlow:m(se),htmlFlowData:F,htmlText:m(X),htmlTextData:F,image:m(q),label:Q,labelText:U,lineEnding:te,link:m(G),listItem:m(),listOrdered:m(),listUnordered:m(),paragraph:m(),referenceString:ve,resourceDestinationString:P,resourceTitleString:W,resource:J,setextHeading:m(L),setextHeadingLineSequence:A,setextHeadingText:I,strong:m(),thematicBreak:m()}};g0(t,(e||{}).mdastExtensions||[]);const r={};return s;function s(me){let Pe={type:"root",children:[]};const Ge={stack:[Pe],tokenStack:[],config:t,enter:d,exit:f,buffer:c,resume:v,data:r},dt=[];let Ye=-1;for(;++Ye<me.length;)if(me[Ye][1].type==="listOrdered"||me[Ye][1].type==="listUnordered")if(me[Ye][0]==="enter")dt.push(Ye);else{const Dt=dt.pop();Ye=i(me,Dt,Ye)}for(Ye=-1;++Ye<me.length;){const Dt=t[me[Ye][0]];f0.call(Dt,me[Ye][1].type)&&Dt[me[Ye][1].type].call(Object.assign({sliceSerialize:me[Ye][2].sliceSerialize},Ge),me[Ye][1])}if(Ge.tokenStack.length>0){const Dt=Ge.tokenStack[Ge.tokenStack.length-1];(Dt[1]||tC).call(Ge,void 0,Dt[0])}for(Pe.position={start:Oa(me.length>0?me[0][1].start:{line:1,column:1,offset:0}),end:Oa(me.length>0?me[me.length-2][1].end:{line:1,column:1,offset:0})},Ye=-1;++Ye<t.transforms.length;)Pe=t.transforms[Ye](Pe)||Pe;return Pe}function i(me,Pe,Ge){let dt=Pe-1,Ye=-1,Dt=!1,ae,We,jt,Rt;for(;++dt<=Ge;){const cn=me[dt];switch(cn[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{cn[0]==="enter"?Ye++:Ye--,Rt=void 0;break}case"lineEndingBlank":{cn[0]==="enter"&&(ae&&!Rt&&!Ye&&!jt&&(jt=dt),Rt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Rt=void 0}if(!Ye&&cn[0]==="enter"&&cn[1].type==="listItemPrefix"||Ye===-1&&cn[0]==="exit"&&(cn[1].type==="listUnordered"||cn[1].type==="listOrdered")){if(ae){let Vt=dt;for(We=void 0;Vt--;){const Gt=me[Vt];if(Gt[1].type==="lineEnding"||Gt[1].type==="lineEndingBlank"){if(Gt[0]==="exit")continue;We&&(me[We][1].type="lineEndingBlank",Dt=!0),Gt[1].type="lineEnding",We=Vt}else if(!(Gt[1].type==="linePrefix"||Gt[1].type==="blockQuotePrefix"||Gt[1].type==="blockQuotePrefixWhitespace"||Gt[1].type==="blockQuoteMarker"||Gt[1].type==="listItemIndent"))break}jt&&(!We||jt<We)&&(ae._spread=!0),ae.end=Object.assign({},We?me[We][1].start:cn[1].end),me.splice(We||dt,0,["exit",ae,cn[2]]),dt++,Ge++}if(cn[1].type==="listItemPrefix"){const Vt={type:"listItem",_spread:!1,start:Object.assign({},cn[1].start),end:void 0};ae=Vt,me.splice(dt,0,["enter",Vt,cn[2]]),dt++,Ge++,jt=void 0,Rt=!0}}}return me[Pe][1]._spread=Dt,Ge}function l(me,Pe){return Ge;function Ge(dt){d.call(this,me(dt),dt),Pe&&Pe.call(this,dt)}}function c(){this.stack.push({type:"fragment",children:[]})}function d(me,Pe,Ge){this.stack[this.stack.length-1].children.push(me),this.stack.push(me),this.tokenStack.push([Pe,Ge||void 0]),me.position={start:Oa(Pe.start),end:void 0}}function m(me){return Pe;function Pe(Ge){me&&me.call(this,Ge),f.call(this,Ge)}}function f(me,Pe){const Ge=this.stack.pop(),dt=this.tokenStack.pop();if(dt)dt[0].type!==me.type&&(Pe?Pe.call(this,me,dt[0]):(dt[1]||tC).call(this,me,dt[0]));else throw new Error("Cannot close `"+me.type+"` ("+Qc({start:me.start,end:me.end})+"): it’s not open");Ge.position.end=Oa(me.end)}function v(){return Vv(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function w(me){if(this.data.expectingFirstListItemValue){const Pe=this.stack[this.stack.length-2];Pe.start=Number.parseInt(this.sliceSerialize(me),10),this.data.expectingFirstListItemValue=void 0}}function k(){const me=this.resume(),Pe=this.stack[this.stack.length-1];Pe.lang=me}function y(){const me=this.resume(),Pe=this.stack[this.stack.length-1];Pe.meta=me}function S(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function T(){const me=this.resume(),Pe=this.stack[this.stack.length-1];Pe.value=me.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function j(){const me=this.resume(),Pe=this.stack[this.stack.length-1];Pe.value=me.replace(/(\r?\n|\r)$/g,"")}function N(me){const Pe=this.resume(),Ge=this.stack[this.stack.length-1];Ge.label=Pe,Ge.identifier=ji(this.sliceSerialize(me)).toLowerCase()}function D(){const me=this.resume(),Pe=this.stack[this.stack.length-1];Pe.title=me}function H(){const me=this.resume(),Pe=this.stack[this.stack.length-1];Pe.url=me}function B(me){const Pe=this.stack[this.stack.length-1];if(!Pe.depth){const Ge=this.sliceSerialize(me).length;Pe.depth=Ge}}function I(){this.data.setextHeadingSlurpLineEnding=!0}function A(me){const Pe=this.stack[this.stack.length-1];Pe.depth=this.sliceSerialize(me).codePointAt(0)===61?1:2}function L(){this.data.setextHeadingSlurpLineEnding=void 0}function _(me){const Ge=this.stack[this.stack.length-1].children;let dt=Ge[Ge.length-1];(!dt||dt.type!=="text")&&(dt=$e(),dt.position={start:Oa(me.start),end:void 0},Ge.push(dt)),this.stack.push(dt)}function F(me){const Pe=this.stack.pop();Pe.value+=this.sliceSerialize(me),Pe.position.end=Oa(me.end)}function te(me){const Pe=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Ge=Pe.children[Pe.children.length-1];Ge.position.end=Oa(me.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(Pe.type)&&(_.call(this,me),F.call(this,me))}function E(){this.data.atHardBreak=!0}function se(){const me=this.resume(),Pe=this.stack[this.stack.length-1];Pe.value=me}function X(){const me=this.resume(),Pe=this.stack[this.stack.length-1];Pe.value=me}function K(){const me=this.resume(),Pe=this.stack[this.stack.length-1];Pe.value=me}function G(){const me=this.stack[this.stack.length-1];if(this.data.inReference){const Pe=this.data.referenceType||"shortcut";me.type+="Reference",me.referenceType=Pe,delete me.url,delete me.title}else delete me.identifier,delete me.label;this.data.referenceType=void 0}function q(){const me=this.stack[this.stack.length-1];if(this.data.inReference){const Pe=this.data.referenceType||"shortcut";me.type+="Reference",me.referenceType=Pe,delete me.url,delete me.title}else delete me.identifier,delete me.label;this.data.referenceType=void 0}function U(me){const Pe=this.sliceSerialize(me),Ge=this.stack[this.stack.length-2];Ge.label=uz(Pe),Ge.identifier=ji(Pe).toLowerCase()}function Q(){const me=this.stack[this.stack.length-1],Pe=this.resume(),Ge=this.stack[this.stack.length-1];if(this.data.inReference=!0,Ge.type==="link"){const dt=me.children;Ge.children=dt}else Ge.alt=Pe}function P(){const me=this.resume(),Pe=this.stack[this.stack.length-1];Pe.url=me}function W(){const me=this.resume(),Pe=this.stack[this.stack.length-1];Pe.title=me}function J(){this.data.inReference=void 0}function R(){this.data.referenceType="collapsed"}function ve(me){const Pe=this.resume(),Ge=this.stack[this.stack.length-1];Ge.label=Pe,Ge.identifier=ji(this.sliceSerialize(me)).toLowerCase(),this.data.referenceType="full"}function pe(me){this.data.characterReferenceType=me.type}function Y(me){const Pe=this.sliceSerialize(me),Ge=this.data.characterReferenceType;let dt;Ge?(dt=i0(Pe,Ge==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):dt=Gv(Pe);const Ye=this.stack[this.stack.length-1];Ye.value+=dt}function Se(me){const Pe=this.stack.pop();Pe.position.end=Oa(me.end)}function Le(me){F.call(this,me);const Pe=this.stack[this.stack.length-1];Pe.url=this.sliceSerialize(me)}function re(me){F.call(this,me);const Pe=this.stack[this.stack.length-1];Pe.url="mailto:"+this.sliceSerialize(me)}function Ce(){return{type:"blockquote",children:[]}}function Xe(){return{type:"code",lang:null,meta:null,value:""}}function Ue(){return{type:"inlineCode",value:""}}function ct(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Nt(){return{type:"emphasis",children:[]}}function Ke(){return{type:"heading",depth:0,children:[]}}function ut(){return{type:"break"}}function vt(){return{type:"html",value:""}}function Te(){return{type:"image",title:null,url:"",alt:null}}function _e(){return{type:"link",title:null,url:"",children:[]}}function we(me){return{type:"list",ordered:me.type==="listOrdered",start:null,spread:me._spread,children:[]}}function qe(me){return{type:"listItem",spread:me._spread,checked:null,children:[]}}function ke(){return{type:"paragraph",children:[]}}function Ee(){return{type:"strong",children:[]}}function $e(){return{type:"text",value:""}}function wt(){return{type:"thematicBreak"}}}function Oa(e){return{line:e.line,column:e.column,offset:e.offset}}function g0(e,t){let r=-1;for(;++r<t.length;){const s=t[r];Array.isArray(s)?g0(e,s):pz(e,s)}}function pz(e,t){let r;for(r in t)if(f0.call(t,r))switch(r){case"canContainEols":{const s=t[r];s&&e[r].push(...s);break}case"transforms":{const s=t[r];s&&e[r].push(...s);break}case"enter":case"exit":{const s=t[r];s&&Object.assign(e[r],s);break}}}function tC(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Qc({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Qc({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Qc({start:t.start,end:t.end})+") is still open")}function fz(e){const t=this;t.parser=r;function r(s){return hz(s,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function gz(e,t){const r={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,r),e.applyData(t,r)}function bz(e,t){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,r),[e.applyData(t,r),{type:"text",value:`
|
|
73
|
-
`}]}function vz(e,t){const r=t.value?t.value+`
|
|
74
|
-
`:"",s={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(s.className=["language-"+i[0]]);let l={type:"element",tagName:"code",properties:s,children:[{type:"text",value:r}]};return t.meta&&(l.data={meta:t.meta}),e.patch(t,l),l=e.applyData(t,l),l={type:"element",tagName:"pre",properties:{},children:[l]},e.patch(t,l),l}function wz(e,t){const r={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function yz(e,t){const r={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function kz(e,t){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(t.identifier).toUpperCase(),i=$l(s.toLowerCase()),l=e.footnoteOrder.indexOf(s);let c,d=e.footnoteCounts.get(s);d===void 0?(d=0,e.footnoteOrder.push(s),c=e.footnoteOrder.length):c=l+1,d+=1,e.footnoteCounts.set(s,d);const m={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+i,id:r+"fnref-"+i+(d>1?"-"+d:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(c)}]};e.patch(t,m);const f={type:"element",tagName:"sup",properties:{},children:[m]};return e.patch(t,f),e.applyData(t,f)}function xz(e,t){const r={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Sz(e,t){if(e.options.allowDangerousHtml){const r={type:"raw",value:t.value};return e.patch(t,r),e.applyData(t,r)}}function b0(e,t){const r=t.referenceType;let s="]";if(r==="collapsed"?s+="[]":r==="full"&&(s+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+s}];const i=e.all(t),l=i[0];l&&l.type==="text"?l.value="["+l.value:i.unshift({type:"text",value:"["});const c=i[i.length-1];return c&&c.type==="text"?c.value+=s:i.push({type:"text",value:s}),i}function Cz(e,t){const r=String(t.identifier).toUpperCase(),s=e.definitionById.get(r);if(!s)return b0(e,t);const i={src:$l(s.url||""),alt:t.alt};s.title!==null&&s.title!==void 0&&(i.title=s.title);const l={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,l),e.applyData(t,l)}function jz(e,t){const r={src:$l(t.url)};t.alt!==null&&t.alt!==void 0&&(r.alt=t.alt),t.title!==null&&t.title!==void 0&&(r.title=t.title);const s={type:"element",tagName:"img",properties:r,children:[]};return e.patch(t,s),e.applyData(t,s)}function Tz(e,t){const r={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,r);const s={type:"element",tagName:"code",properties:{},children:[r]};return e.patch(t,s),e.applyData(t,s)}function Nz(e,t){const r=String(t.identifier).toUpperCase(),s=e.definitionById.get(r);if(!s)return b0(e,t);const i={href:$l(s.url||"")};s.title!==null&&s.title!==void 0&&(i.title=s.title);const l={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,l),e.applyData(t,l)}function Pz(e,t){const r={href:$l(t.url)};t.title!==null&&t.title!==void 0&&(r.title=t.title);const s={type:"element",tagName:"a",properties:r,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function Dz(e,t,r){const s=e.all(t),i=r?Rz(r):v0(t),l={},c=[];if(typeof t.checked=="boolean"){const v=s[0];let g;v&&v.type==="element"&&v.tagName==="p"?g=v:(g={type:"element",tagName:"p",properties:{},children:[]},s.unshift(g)),g.children.length>0&&g.children.unshift({type:"text",value:" "}),g.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),l.className=["task-list-item"]}let d=-1;for(;++d<s.length;){const v=s[d];(i||d!==0||v.type!=="element"||v.tagName!=="p")&&c.push({type:"text",value:`
|
|
75
|
-
`}),v.type==="element"&&v.tagName==="p"&&!i?c.push(...v.children):c.push(v)}const m=s[s.length-1];m&&(i||m.type!=="element"||m.tagName!=="p")&&c.push({type:"text",value:`
|
|
76
|
-
`});const f={type:"element",tagName:"li",properties:l,children:c};return e.patch(t,f),e.applyData(t,f)}function Rz(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const r=e.children;let s=-1;for(;!t&&++s<r.length;)t=v0(r[s])}return t}function v0(e){const t=e.spread;return t??e.children.length>1}function Az(e,t){const r={},s=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(r.start=t.start);++i<s.length;){const c=s[i];if(c.type==="element"&&c.tagName==="li"&&c.properties&&Array.isArray(c.properties.className)&&c.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}const l={type:"element",tagName:t.ordered?"ol":"ul",properties:r,children:e.wrap(s,!0)};return e.patch(t,l),e.applyData(t,l)}function Mz(e,t){const r={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Iz(e,t){const r={type:"root",children:e.wrap(e.all(t))};return e.patch(t,r),e.applyData(t,r)}function Ez(e,t){const r={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Lz(e,t){const r=e.all(t),s=r.shift(),i=[];if(s){const c={type:"element",tagName:"thead",properties:{},children:e.wrap([s],!0)};e.patch(t.children[0],c),i.push(c)}if(r.length>0){const c={type:"element",tagName:"tbody",properties:{},children:e.wrap(r,!0)},d=Hv(t.children[1]),m=QD(t.children[t.children.length-1]);d&&m&&(c.position={start:d,end:m}),i.push(c)}const l={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,l),e.applyData(t,l)}function Fz(e,t,r){const s=r?r.children:void 0,l=(s?s.indexOf(t):1)===0?"th":"td",c=r&&r.type==="table"?r.align:void 0,d=c?c.length:t.children.length;let m=-1;const f=[];for(;++m<d;){const g=t.children[m],w={},k=c?c[m]:void 0;k&&(w.align=k);let y={type:"element",tagName:l,properties:w,children:[]};g&&(y.children=e.all(g),e.patch(g,y),y=e.applyData(g,y)),f.push(y)}const v={type:"element",tagName:"tr",properties:{},children:e.wrap(f,!0)};return e.patch(t,v),e.applyData(t,v)}function _z(e,t){const r={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}const nC=9,rC=32;function Oz(e){const t=String(e),r=/\r?\n|\r/g;let s=r.exec(t),i=0;const l=[];for(;s;)l.push(sC(t.slice(i,s.index),i>0,!0),s[0]),i=s.index+s[0].length,s=r.exec(t);return l.push(sC(t.slice(i),i>0,!1)),l.join("")}function sC(e,t,r){let s=0,i=e.length;if(t){let l=e.codePointAt(s);for(;l===nC||l===rC;)s++,l=e.codePointAt(s)}if(r){let l=e.codePointAt(i-1);for(;l===nC||l===rC;)i--,l=e.codePointAt(i-1)}return i>s?e.slice(s,i):""}function Bz(e,t){const r={type:"text",value:Oz(String(t.value))};return e.patch(t,r),e.applyData(t,r)}function Wz(e,t){const r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,r),e.applyData(t,r)}const Uz={blockquote:gz,break:bz,code:vz,delete:wz,emphasis:yz,footnoteReference:kz,heading:xz,html:Sz,imageReference:Cz,image:jz,inlineCode:Tz,linkReference:Nz,link:Pz,listItem:Dz,list:Az,paragraph:Mz,root:Iz,strong:Ez,table:Lz,tableCell:_z,tableRow:Fz,text:Bz,thematicBreak:Wz,toml:Vd,yaml:Vd,definition:Vd,footnoteDefinition:Vd};function Vd(){}const w0=-1,Rm=0,Zc=1,Qh=2,Yv=3,Xv=4,Qv=5,Jv=6,y0=7,k0=8,iC=typeof self=="object"?self:globalThis,Hz=(e,t)=>{const r=(i,l)=>(e.set(l,i),i),s=i=>{if(e.has(i))return e.get(i);const[l,c]=t[i];switch(l){case Rm:case w0:return r(c,i);case Zc:{const d=r([],i);for(const m of c)d.push(s(m));return d}case Qh:{const d=r({},i);for(const[m,f]of c)d[s(m)]=s(f);return d}case Yv:return r(new Date(c),i);case Xv:{const{source:d,flags:m}=c;return r(new RegExp(d,m),i)}case Qv:{const d=r(new Map,i);for(const[m,f]of c)d.set(s(m),s(f));return d}case Jv:{const d=r(new Set,i);for(const m of c)d.add(s(m));return d}case y0:{const{name:d,message:m}=c;return r(new iC[d](m),i)}case k0:return r(BigInt(c),i);case"BigInt":return r(Object(BigInt(c)),i);case"ArrayBuffer":return r(new Uint8Array(c).buffer,c);case"DataView":{const{buffer:d}=new Uint8Array(c);return r(new DataView(d),c)}}return r(new iC[l](c),i)};return s},aC=e=>Hz(new Map,e)(0),Sl="",{toString:zz}={},{keys:qz}=Object,Pc=e=>{const t=typeof e;if(t!=="object"||!e)return[Rm,t];const r=zz.call(e).slice(8,-1);switch(r){case"Array":return[Zc,Sl];case"Object":return[Qh,Sl];case"Date":return[Yv,Sl];case"RegExp":return[Xv,Sl];case"Map":return[Qv,Sl];case"Set":return[Jv,Sl];case"DataView":return[Zc,r]}return r.includes("Array")?[Zc,r]:r.includes("Error")?[y0,r]:[Qh,r]},Gd=([e,t])=>e===Rm&&(t==="function"||t==="symbol"),$z=(e,t,r,s)=>{const i=(c,d)=>{const m=s.push(c)-1;return r.set(d,m),m},l=c=>{if(r.has(c))return r.get(c);let[d,m]=Pc(c);switch(d){case Rm:{let v=c;switch(m){case"bigint":d=k0,v=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+m);v=null;break;case"undefined":return i([w0],c)}return i([d,v],c)}case Zc:{if(m){let w=c;return m==="DataView"?w=new Uint8Array(c.buffer):m==="ArrayBuffer"&&(w=new Uint8Array(c)),i([m,[...w]],c)}const v=[],g=i([d,v],c);for(const w of c)v.push(l(w));return g}case Qh:{if(m)switch(m){case"BigInt":return i([m,c.toString()],c);case"Boolean":case"Number":case"String":return i([m,c.valueOf()],c)}if(t&&"toJSON"in c)return l(c.toJSON());const v=[],g=i([d,v],c);for(const w of qz(c))(e||!Gd(Pc(c[w])))&&v.push([l(w),l(c[w])]);return g}case Yv:return i([d,c.toISOString()],c);case Xv:{const{source:v,flags:g}=c;return i([d,{source:v,flags:g}],c)}case Qv:{const v=[],g=i([d,v],c);for(const[w,k]of c)(e||!(Gd(Pc(w))||Gd(Pc(k))))&&v.push([l(w),l(k)]);return g}case Jv:{const v=[],g=i([d,v],c);for(const w of c)(e||!Gd(Pc(w)))&&v.push(l(w));return g}}const{message:f}=c;return i([d,{name:m,message:f}],c)};return l},oC=(e,{json:t,lossy:r}={})=>{const s=[];return $z(!(t||r),!!t,new Map,s)(e),s},Jh=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?aC(oC(e,t)):structuredClone(e):(e,t)=>aC(oC(e,t));function Vz(e,t){const r=[{type:"text",value:"↩"}];return t>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),r}function Gz(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function Kz(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||Vz,s=e.options.footnoteBackLabel||Gz,i=e.options.footnoteLabel||"Footnotes",l=e.options.footnoteLabelTagName||"h2",c=e.options.footnoteLabelProperties||{className:["sr-only"]},d=[];let m=-1;for(;++m<e.footnoteOrder.length;){const f=e.footnoteById.get(e.footnoteOrder[m]);if(!f)continue;const v=e.all(f),g=String(f.identifier).toUpperCase(),w=$l(g.toLowerCase());let k=0;const y=[],S=e.footnoteCounts.get(g);for(;S!==void 0&&++k<=S;){y.length>0&&y.push({type:"text",value:" "});let N=typeof r=="string"?r:r(m,k);typeof N=="string"&&(N={type:"text",value:N}),y.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+w+(k>1?"-"+k:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(m,k),className:["data-footnote-backref"]},children:Array.isArray(N)?N:[N]})}const T=v[v.length-1];if(T&&T.type==="element"&&T.tagName==="p"){const N=T.children[T.children.length-1];N&&N.type==="text"?N.value+=" ":T.children.push({type:"text",value:" "}),T.children.push(...y)}else v.push(...y);const j={type:"element",tagName:"li",properties:{id:t+"fn-"+w},children:e.wrap(v,!0)};e.patch(f,j),d.push(j)}if(d.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:l,properties:{...Jh(c),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
|
|
77
|
-
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(d,!0)},{type:"text",value:`
|
|
78
|
-
`}]}}const Am=(function(e){if(e==null)return Jz;if(typeof e=="function")return Mm(e);if(typeof e=="object")return Array.isArray(e)?Yz(e):Xz(e);if(typeof e=="string")return Qz(e);throw new Error("Expected function, string, or object as test")});function Yz(e){const t=[];let r=-1;for(;++r<e.length;)t[r]=Am(e[r]);return Mm(s);function s(...i){let l=-1;for(;++l<t.length;)if(t[l].apply(this,i))return!0;return!1}}function Xz(e){const t=e;return Mm(r);function r(s){const i=s;let l;for(l in e)if(i[l]!==t[l])return!1;return!0}}function Qz(e){return Mm(t);function t(r){return r&&r.type===e}}function Mm(e){return t;function t(r,s,i){return!!(Zz(r)&&e.call(this,r,typeof s=="number"?s:void 0,i||void 0))}}function Jz(){return!0}function Zz(e){return e!==null&&typeof e=="object"&&"type"in e}const x0=[],e4=!0,gb=!1,t4="skip";function S0(e,t,r,s){let i;typeof t=="function"&&typeof r!="function"?(s=r,r=t):i=t;const l=Am(i),c=s?-1:1;d(e,void 0,[])();function d(m,f,v){const g=m&&typeof m=="object"?m:{};if(typeof g.type=="string"){const k=typeof g.tagName=="string"?g.tagName:typeof g.name=="string"?g.name:void 0;Object.defineProperty(w,"name",{value:"node ("+(m.type+(k?"<"+k+">":""))+")"})}return w;function w(){let k=x0,y,S,T;if((!t||l(m,f,v[v.length-1]||void 0))&&(k=n4(r(m,v)),k[0]===gb))return k;if("children"in m&&m.children){const j=m;if(j.children&&k[0]!==t4)for(S=(s?j.children.length:-1)+c,T=v.concat(j);S>-1&&S<j.children.length;){const N=j.children[S];if(y=d(N,S,T)(),y[0]===gb)return y;S=typeof y[1]=="number"?y[1]:S+c}}return k}}}function n4(e){return Array.isArray(e)?e:typeof e=="number"?[e4,e]:e==null?x0:[e]}function Zv(e,t,r,s){let i,l,c;typeof t=="function"&&typeof r!="function"?(l=void 0,c=t,i=r):(l=t,c=r,i=s),S0(e,l,d,i);function d(m,f){const v=f[f.length-1],g=v?v.children.indexOf(m):void 0;return c(m,g,v)}}const bb={}.hasOwnProperty,r4={};function s4(e,t){const r=t||r4,s=new Map,i=new Map,l=new Map,c={...Uz,...r.handlers},d={all:f,applyData:a4,definitionById:s,footnoteById:i,footnoteCounts:l,footnoteOrder:[],handlers:c,one:m,options:r,patch:i4,wrap:l4};return Zv(e,function(v){if(v.type==="definition"||v.type==="footnoteDefinition"){const g=v.type==="definition"?s:i,w=String(v.identifier).toUpperCase();g.has(w)||g.set(w,v)}}),d;function m(v,g){const w=v.type,k=d.handlers[w];if(bb.call(d.handlers,w)&&k)return k(d,v,g);if(d.options.passThrough&&d.options.passThrough.includes(w)){if("children"in v){const{children:S,...T}=v,j=Jh(T);return j.children=d.all(v),j}return Jh(v)}return(d.options.unknownHandler||o4)(d,v,g)}function f(v){const g=[];if("children"in v){const w=v.children;let k=-1;for(;++k<w.length;){const y=d.one(w[k],v);if(y){if(k&&w[k-1].type==="break"&&(!Array.isArray(y)&&y.type==="text"&&(y.value=lC(y.value)),!Array.isArray(y)&&y.type==="element")){const S=y.children[0];S&&S.type==="text"&&(S.value=lC(S.value))}Array.isArray(y)?g.push(...y):g.push(y)}}}return g}}function i4(e,t){e.position&&(t.position=GW(e))}function a4(e,t){let r=t;if(e&&e.data){const s=e.data.hName,i=e.data.hChildren,l=e.data.hProperties;if(typeof s=="string")if(r.type==="element")r.tagName=s;else{const c="children"in r?r.children:[r];r={type:"element",tagName:s,properties:{},children:c}}r.type==="element"&&l&&Object.assign(r.properties,Jh(l)),"children"in r&&r.children&&i!==null&&i!==void 0&&(r.children=i)}return r}function o4(e,t){const r=t.data||{},s="value"in t&&!(bb.call(r,"hProperties")||bb.call(r,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function l4(e,t){const r=[];let s=-1;for(t&&r.push({type:"text",value:`
|
|
79
|
-
`});++s<e.length;)s&&r.push({type:"text",value:`
|
|
80
|
-
`}),r.push(e[s]);return t&&e.length>0&&r.push({type:"text",value:`
|
|
81
|
-
`}),r}function lC(e){let t=0,r=e.charCodeAt(t);for(;r===9||r===32;)t++,r=e.charCodeAt(t);return e.slice(t)}function cC(e,t){const r=s4(e,t),s=r.one(e,void 0),i=Kz(r),l=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return i&&l.children.push({type:"text",value:`
|
|
82
|
-
`},i),l}function c4(e,t){return e&&"run"in e?async function(r,s){const i=cC(r,{file:s,...t});await e.run(i,s)}:function(r,s){return cC(r,{file:s,...e||t})}}function uC(e){if(e)throw e}var Of,dC;function u4(){if(dC)return Of;dC=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,r=Object.defineProperty,s=Object.getOwnPropertyDescriptor,i=function(f){return typeof Array.isArray=="function"?Array.isArray(f):t.call(f)==="[object Array]"},l=function(f){if(!f||t.call(f)!=="[object Object]")return!1;var v=e.call(f,"constructor"),g=f.constructor&&f.constructor.prototype&&e.call(f.constructor.prototype,"isPrototypeOf");if(f.constructor&&!v&&!g)return!1;var w;for(w in f);return typeof w>"u"||e.call(f,w)},c=function(f,v){r&&v.name==="__proto__"?r(f,v.name,{enumerable:!0,configurable:!0,value:v.newValue,writable:!0}):f[v.name]=v.newValue},d=function(f,v){if(v==="__proto__")if(e.call(f,v)){if(s)return s(f,v).value}else return;return f[v]};return Of=function m(){var f,v,g,w,k,y,S=arguments[0],T=1,j=arguments.length,N=!1;for(typeof S=="boolean"&&(N=S,S=arguments[1]||{},T=2),(S==null||typeof S!="object"&&typeof S!="function")&&(S={});T<j;++T)if(f=arguments[T],f!=null)for(v in f)g=d(S,v),w=d(f,v),S!==w&&(N&&w&&(l(w)||(k=i(w)))?(k?(k=!1,y=g&&i(g)?g:[]):y=g&&l(g)?g:{},c(S,{name:v,newValue:m(N,y,w)})):typeof w<"u"&&c(S,{name:v,newValue:w}));return S},Of}var d4=u4();const Bf=yu(d4);function vb(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function h4(){const e=[],t={run:r,use:s};return t;function r(...i){let l=-1;const c=i.pop();if(typeof c!="function")throw new TypeError("Expected function as last argument, not "+c);d(null,...i);function d(m,...f){const v=e[++l];let g=-1;if(m){c(m);return}for(;++g<i.length;)(f[g]===null||f[g]===void 0)&&(f[g]=i[g]);i=f,v?m4(v,d)(...f):c(null,...f)}}function s(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function m4(e,t){let r;return s;function s(...c){const d=e.length>c.length;let m;d&&c.push(i);try{m=e.apply(this,c)}catch(f){const v=f;if(d&&r)throw v;return i(v)}d||(m&&m.then&&typeof m.then=="function"?m.then(l,i):m instanceof Error?i(m):l(m))}function i(c,...d){r||(r=!0,t(c,...d))}function l(c){i(null,c)}}const Hi={basename:p4,dirname:f4,extname:g4,join:b4,sep:"/"};function p4(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Fu(e);let r=0,s=-1,i=e.length,l;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(l){r=i+1;break}}else s<0&&(l=!0,s=i+1);return s<0?"":e.slice(r,s)}if(t===e)return"";let c=-1,d=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(l){r=i+1;break}}else c<0&&(l=!0,c=i+1),d>-1&&(e.codePointAt(i)===t.codePointAt(d--)?d<0&&(s=i):(d=-1,s=c));return r===s?s=c:s<0&&(s=e.length),e.slice(r,s)}function f4(e){if(Fu(e),e.length===0)return".";let t=-1,r=e.length,s;for(;--r;)if(e.codePointAt(r)===47){if(s){t=r;break}}else s||(s=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function g4(e){Fu(e);let t=e.length,r=-1,s=0,i=-1,l=0,c;for(;t--;){const d=e.codePointAt(t);if(d===47){if(c){s=t+1;break}continue}r<0&&(c=!0,r=t+1),d===46?i<0?i=t:l!==1&&(l=1):i>-1&&(l=-1)}return i<0||r<0||l===0||l===1&&i===r-1&&i===s+1?"":e.slice(i,r)}function b4(...e){let t=-1,r;for(;++t<e.length;)Fu(e[t]),e[t]&&(r=r===void 0?e[t]:r+"/"+e[t]);return r===void 0?".":v4(r)}function v4(e){Fu(e);const t=e.codePointAt(0)===47;let r=w4(e,!t);return r.length===0&&!t&&(r="."),r.length>0&&e.codePointAt(e.length-1)===47&&(r+="/"),t?"/"+r:r}function w4(e,t){let r="",s=0,i=-1,l=0,c=-1,d,m;for(;++c<=e.length;){if(c<e.length)d=e.codePointAt(c);else{if(d===47)break;d=47}if(d===47){if(!(i===c-1||l===1))if(i!==c-1&&l===2){if(r.length<2||s!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(m=r.lastIndexOf("/"),m!==r.length-1){m<0?(r="",s=0):(r=r.slice(0,m),s=r.length-1-r.lastIndexOf("/")),i=c,l=0;continue}}else if(r.length>0){r="",s=0,i=c,l=0;continue}}t&&(r=r.length>0?r+"/..":"..",s=2)}else r.length>0?r+="/"+e.slice(i+1,c):r=e.slice(i+1,c),s=c-i-1;i=c,l=0}else d===46&&l>-1?l++:l=-1}return r}function Fu(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const y4={cwd:k4};function k4(){return"/"}function wb(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function x4(e){if(typeof e=="string")e=new URL(e);else if(!wb(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return S4(e)}function S4(e){if(e.hostname!==""){const s=new TypeError('File URL host must be "localhost" or empty on darwin');throw s.code="ERR_INVALID_FILE_URL_HOST",s}const t=e.pathname;let r=-1;for(;++r<t.length;)if(t.codePointAt(r)===37&&t.codePointAt(r+1)===50){const s=t.codePointAt(r+2);if(s===70||s===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const Wf=["history","path","basename","stem","extname","dirname"];class C0{constructor(t){let r;t?wb(t)?r={path:t}:typeof t=="string"||C4(t)?r={value:t}:r=t:r={},this.cwd="cwd"in r?"":y4.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<Wf.length;){const l=Wf[s];l in r&&r[l]!==void 0&&r[l]!==null&&(this[l]=l==="history"?[...r[l]]:r[l])}let i;for(i in r)Wf.includes(i)||(this[i]=r[i])}get basename(){return typeof this.path=="string"?Hi.basename(this.path):void 0}set basename(t){Hf(t,"basename"),Uf(t,"basename"),this.path=Hi.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Hi.dirname(this.path):void 0}set dirname(t){hC(this.basename,"dirname"),this.path=Hi.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Hi.extname(this.path):void 0}set extname(t){if(Uf(t,"extname"),hC(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Hi.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){wb(t)&&(t=x4(t)),Hf(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Hi.basename(this.path,this.extname):void 0}set stem(t){Hf(t,"stem"),Uf(t,"stem"),this.path=Hi.join(this.dirname||"",t+(this.extname||""))}fail(t,r,s){const i=this.message(t,r,s);throw i.fatal=!0,i}info(t,r,s){const i=this.message(t,r,s);return i.fatal=void 0,i}message(t,r,s){const i=new bs(t,r,s);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Uf(e,t){if(e&&e.includes(Hi.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Hi.sep+"`")}function Hf(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function hC(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function C4(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const j4=(function(e){const s=this.constructor.prototype,i=s[e],l=function(){return i.apply(l,arguments)};return Object.setPrototypeOf(l,s),l}),T4={}.hasOwnProperty;class ew extends j4{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=h4()}copy(){const t=new ew;let r=-1;for(;++r<this.attachers.length;){const s=this.attachers[r];t.use(...s)}return t.data(Bf(!0,{},this.namespace)),t}data(t,r){return typeof t=="string"?arguments.length===2?($f("data",this.frozen),this.namespace[t]=r,this):T4.call(this.namespace,t)&&this.namespace[t]||void 0:t?($f("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[r,...s]=this.attachers[this.freezeIndex];if(s[0]===!1)continue;s[0]===!0&&(s[0]=void 0);const i=r.call(t,...s);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const r=Kd(t),s=this.parser||this.Parser;return zf("parse",s),s(String(r),r)}process(t,r){const s=this;return this.freeze(),zf("process",this.parser||this.Parser),qf("process",this.compiler||this.Compiler),r?i(void 0,r):new Promise(i);function i(l,c){const d=Kd(t),m=s.parse(d);s.run(m,d,function(v,g,w){if(v||!g||!w)return f(v);const k=g,y=s.stringify(k,w);D4(y)?w.value=y:w.result=y,f(v,w)});function f(v,g){v||!g?c(v):l?l(g):r(void 0,g)}}}processSync(t){let r=!1,s;return this.freeze(),zf("processSync",this.parser||this.Parser),qf("processSync",this.compiler||this.Compiler),this.process(t,i),pC("processSync","process",r),s;function i(l,c){r=!0,uC(l),s=c}}run(t,r,s){mC(t),this.freeze();const i=this.transformers;return!s&&typeof r=="function"&&(s=r,r=void 0),s?l(void 0,s):new Promise(l);function l(c,d){const m=Kd(r);i.run(t,m,f);function f(v,g,w){const k=g||t;v?d(v):c?c(k):s(void 0,k,w)}}}runSync(t,r){let s=!1,i;return this.run(t,r,l),pC("runSync","run",s),i;function l(c,d){uC(c),i=d,s=!0}}stringify(t,r){this.freeze();const s=Kd(r),i=this.compiler||this.Compiler;return qf("stringify",i),mC(t),i(t,s)}use(t,...r){const s=this.attachers,i=this.namespace;if($f("use",this.frozen),t!=null)if(typeof t=="function")m(t,r);else if(typeof t=="object")Array.isArray(t)?d(t):c(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function l(f){if(typeof f=="function")m(f,[]);else if(typeof f=="object")if(Array.isArray(f)){const[v,...g]=f;m(v,g)}else c(f);else throw new TypeError("Expected usable value, not `"+f+"`")}function c(f){if(!("plugins"in f)&&!("settings"in f))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");d(f.plugins),f.settings&&(i.settings=Bf(!0,i.settings,f.settings))}function d(f){let v=-1;if(f!=null)if(Array.isArray(f))for(;++v<f.length;){const g=f[v];l(g)}else throw new TypeError("Expected a list of plugins, not `"+f+"`")}function m(f,v){let g=-1,w=-1;for(;++g<s.length;)if(s[g][0]===f){w=g;break}if(w===-1)s.push([f,...v]);else if(v.length>0){let[k,...y]=v;const S=s[w][1];vb(S)&&vb(k)&&(k=Bf(!0,S,k)),s[w]=[f,k,...y]}}}}const N4=new ew().freeze();function zf(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function qf(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function $f(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function mC(e){if(!vb(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function pC(e,t,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Kd(e){return P4(e)?e:new C0(e)}function P4(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function D4(e){return typeof e=="string"||R4(e)}function R4(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const A4="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",fC=[],gC={allowDangerousHtml:!0},M4=/^(https?|ircs?|mailto|xmpp)$/i,I4=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function j0(e){const t=E4(e),r=L4(e);return F4(t.runSync(t.parse(r),r),e)}function E4(e){const t=e.rehypePlugins||fC,r=e.remarkPlugins||fC,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...gC}:gC;return N4().use(fz).use(r).use(c4,s).use(t)}function L4(e){const t=e.children||"",r=new C0;return typeof t=="string"&&(r.value=t),r}function F4(e,t){const r=t.allowedElements,s=t.allowElement,i=t.components,l=t.disallowedElements,c=t.skipHtml,d=t.unwrapDisallowed,m=t.urlTransform||_4;for(const v of I4)Object.hasOwn(t,v.from)&&(""+v.from+(v.to?"use `"+v.to+"` instead":"remove it")+A4+v.id,void 0);return Zv(e,f),JW(e,{Fragment:n.Fragment,components:i,ignoreInvalidStyle:!0,jsx:n.jsx,jsxs:n.jsxs,passKeys:!0,passNode:!0});function f(v,g,w){if(v.type==="raw"&&w&&typeof g=="number")return c?w.children.splice(g,1):w.children[g]={type:"text",value:v.value},g;if(v.type==="element"){let k;for(k in Lf)if(Object.hasOwn(Lf,k)&&Object.hasOwn(v.properties,k)){const y=v.properties[k],S=Lf[k];(S===null||S.includes(v.tagName))&&(v.properties[k]=m(String(y||""),k,v))}}if(v.type==="element"){let k=r?!r.includes(v.tagName):l?l.includes(v.tagName):!1;if(!k&&s&&typeof g=="number"&&(k=!s(v,g,w)),k&&w&&typeof g=="number")return d&&v.children?w.children.splice(g,1,...v.children):w.children.splice(g,1),g}}}function _4(e){const t=e.indexOf(":"),r=e.indexOf("?"),s=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||r!==-1&&t>r||s!==-1&&t>s||M4.test(e.slice(0,t))?e:""}function bC(e,t){const r=String(e);if(typeof t!="string")throw new TypeError("Expected character");let s=0,i=r.indexOf(t);for(;i!==-1;)s++,i=r.indexOf(t,i+t.length);return s}function O4(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function B4(e,t,r){const i=Am((r||{}).ignore||[]),l=W4(t);let c=-1;for(;++c<l.length;)S0(e,"text",d);function d(f,v){let g=-1,w;for(;++g<v.length;){const k=v[g],y=w?w.children:void 0;if(i(k,y?y.indexOf(k):void 0,w))return;w=k}if(w)return m(f,v)}function m(f,v){const g=v[v.length-1],w=l[c][0],k=l[c][1];let y=0;const T=g.children.indexOf(f);let j=!1,N=[];w.lastIndex=0;let D=w.exec(f.value);for(;D;){const H=D.index,B={index:D.index,input:D.input,stack:[...v,f]};let I=k(...D,B);if(typeof I=="string"&&(I=I.length>0?{type:"text",value:I}:void 0),I===!1?w.lastIndex=H+1:(y!==H&&N.push({type:"text",value:f.value.slice(y,H)}),Array.isArray(I)?N.push(...I):I&&N.push(I),y=H+D[0].length,j=!0),!w.global)break;D=w.exec(f.value)}return j?(y<f.value.length&&N.push({type:"text",value:f.value.slice(y)}),g.children.splice(T,1,...N)):N=[f],T+N.length}}function W4(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const r=!e[0]||Array.isArray(e[0])?e:[e];let s=-1;for(;++s<r.length;){const i=r[s];t.push([U4(i[0]),H4(i[1])])}return t}function U4(e){return typeof e=="string"?new RegExp(O4(e),"g"):e}function H4(e){return typeof e=="function"?e:function(){return e}}const Vf="phrasing",Gf=["autolink","link","image","label"];function z4(){return{transforms:[X4],enter:{literalAutolink:$4,literalAutolinkEmail:Kf,literalAutolinkHttp:Kf,literalAutolinkWww:Kf},exit:{literalAutolink:Y4,literalAutolinkEmail:K4,literalAutolinkHttp:V4,literalAutolinkWww:G4}}}function q4(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Vf,notInConstruct:Gf},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Vf,notInConstruct:Gf},{character:":",before:"[ps]",after:"\\/",inConstruct:Vf,notInConstruct:Gf}]}}function $4(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Kf(e){this.config.enter.autolinkProtocol.call(this,e)}function V4(e){this.config.exit.autolinkProtocol.call(this,e)}function G4(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function K4(e){this.config.exit.autolinkEmail.call(this,e)}function Y4(e){this.exit(e)}function X4(e){B4(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Q4],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),J4]],{ignore:["link","linkReference"]})}function Q4(e,t,r,s,i){let l="";if(!T0(i)||(/^w/i.test(t)&&(r=t+r,t="",l="http://"),!Z4(r)))return!1;const c=e5(r+s);if(!c[0])return!1;const d={type:"link",title:null,url:l+t+c[0],children:[{type:"text",value:t+c[0]}]};return c[1]?[d,{type:"text",value:c[1]}]:d}function J4(e,t,r,s){return!T0(s,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+r,children:[{type:"text",value:t+"@"+r}]}}function Z4(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function e5(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let r=t[0],s=r.indexOf(")");const i=bC(e,"(");let l=bC(e,")");for(;s!==-1&&i>l;)e+=r.slice(0,s+1),r=r.slice(s+1),s=r.indexOf(")"),l++;return[e,r]}function T0(e,t){const r=e.input.charCodeAt(e.index-1);return(e.index===0||_o(r)||Pm(r))&&(!t||r!==47)}N0.peek=c5;function t5(){this.buffer()}function n5(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function r5(){this.buffer()}function s5(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function i5(e){const t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=ji(this.sliceSerialize(e)).toLowerCase(),r.label=t}function a5(e){this.exit(e)}function o5(e){const t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=ji(this.sliceSerialize(e)).toLowerCase(),r.label=t}function l5(e){this.exit(e)}function c5(){return"["}function N0(e,t,r,s){const i=r.createTracker(s);let l=i.move("[^");const c=r.enter("footnoteReference"),d=r.enter("reference");return l+=i.move(r.safe(r.associationId(e),{after:"]",before:l})),d(),c(),l+=i.move("]"),l}function u5(){return{enter:{gfmFootnoteCallString:t5,gfmFootnoteCall:n5,gfmFootnoteDefinitionLabelString:r5,gfmFootnoteDefinition:s5},exit:{gfmFootnoteCallString:i5,gfmFootnoteCall:a5,gfmFootnoteDefinitionLabelString:o5,gfmFootnoteDefinition:l5}}}function d5(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:r,footnoteReference:N0},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(s,i,l,c){const d=l.createTracker(c);let m=d.move("[^");const f=l.enter("footnoteDefinition"),v=l.enter("label");return m+=d.move(l.safe(l.associationId(s),{before:m,after:"]"})),v(),m+=d.move("]:"),s.children&&s.children.length>0&&(d.shift(4),m+=d.move((t?`
|
|
83
|
-
`:" ")+l.indentLines(l.containerFlow(s,d.current()),t?P0:h5))),f(),m}}function h5(e,t,r){return t===0?e:P0(e,t,r)}function P0(e,t,r){return(r?"":" ")+e}const m5=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];D0.peek=v5;function p5(){return{canContainEols:["delete"],enter:{strikethrough:g5},exit:{strikethrough:b5}}}function f5(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:m5}],handlers:{delete:D0}}}function g5(e){this.enter({type:"delete",children:[]},e)}function b5(e){this.exit(e)}function D0(e,t,r,s){const i=r.createTracker(s),l=r.enter("strikethrough");let c=i.move("~~");return c+=r.containerPhrasing(e,{...i.current(),before:c,after:"~"}),c+=i.move("~~"),l(),c}function v5(){return"~"}function w5(e){return e.length}function y5(e,t){const r=t||{},s=(r.align||[]).concat(),i=r.stringLength||w5,l=[],c=[],d=[],m=[];let f=0,v=-1;for(;++v<e.length;){const S=[],T=[];let j=-1;for(e[v].length>f&&(f=e[v].length);++j<e[v].length;){const N=k5(e[v][j]);if(r.alignDelimiters!==!1){const D=i(N);T[j]=D,(m[j]===void 0||D>m[j])&&(m[j]=D)}S.push(N)}c[v]=S,d[v]=T}let g=-1;if(typeof s=="object"&&"length"in s)for(;++g<f;)l[g]=vC(s[g]);else{const S=vC(s);for(;++g<f;)l[g]=S}g=-1;const w=[],k=[];for(;++g<f;){const S=l[g];let T="",j="";S===99?(T=":",j=":"):S===108?T=":":S===114&&(j=":");let N=r.alignDelimiters===!1?1:Math.max(1,m[g]-T.length-j.length);const D=T+"-".repeat(N)+j;r.alignDelimiters!==!1&&(N=T.length+N+j.length,N>m[g]&&(m[g]=N),k[g]=N),w[g]=D}c.splice(1,0,w),d.splice(1,0,k),v=-1;const y=[];for(;++v<c.length;){const S=c[v],T=d[v];g=-1;const j=[];for(;++g<f;){const N=S[g]||"";let D="",H="";if(r.alignDelimiters!==!1){const B=m[g]-(T[g]||0),I=l[g];I===114?D=" ".repeat(B):I===99?B%2?(D=" ".repeat(B/2+.5),H=" ".repeat(B/2-.5)):(D=" ".repeat(B/2),H=D):H=" ".repeat(B)}r.delimiterStart!==!1&&!g&&j.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&N==="")&&(r.delimiterStart!==!1||g)&&j.push(" "),r.alignDelimiters!==!1&&j.push(D),j.push(N),r.alignDelimiters!==!1&&j.push(H),r.padding!==!1&&j.push(" "),(r.delimiterEnd!==!1||g!==f-1)&&j.push("|")}y.push(r.delimiterEnd===!1?j.join("").replace(/ +$/,""):j.join(""))}return y.join(`
|
|
84
|
-
`)}function k5(e){return e==null?"":String(e)}function vC(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function x5(e,t,r,s){const i=r.enter("blockquote"),l=r.createTracker(s);l.move("> "),l.shift(2);const c=r.indentLines(r.containerFlow(e,l.current()),S5);return i(),c}function S5(e,t,r){return">"+(r?"":" ")+e}function C5(e,t){return wC(e,t.inConstruct,!0)&&!wC(e,t.notInConstruct,!1)}function wC(e,t,r){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return r;let s=-1;for(;++s<t.length;)if(e.includes(t[s]))return!0;return!1}function yC(e,t,r,s){let i=-1;for(;++i<r.unsafe.length;)if(r.unsafe[i].character===`
|
|
85
|
-
`&&C5(r.stack,r.unsafe[i]))return/[ \t]/.test(s.before)?"":" ";return`\\
|
|
86
|
-
`}function j5(e,t){const r=String(e);let s=r.indexOf(t),i=s,l=0,c=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;s!==-1;)s===i?++l>c&&(c=l):l=1,i=s+t.length,s=r.indexOf(t,i);return c}function T5(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function N5(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function P5(e,t,r,s){const i=N5(r),l=e.value||"",c=i==="`"?"GraveAccent":"Tilde";if(T5(e,r)){const g=r.enter("codeIndented"),w=r.indentLines(l,D5);return g(),w}const d=r.createTracker(s),m=i.repeat(Math.max(j5(l,i)+1,3)),f=r.enter("codeFenced");let v=d.move(m);if(e.lang){const g=r.enter(`codeFencedLang${c}`);v+=d.move(r.safe(e.lang,{before:v,after:" ",encode:["`"],...d.current()})),g()}if(e.lang&&e.meta){const g=r.enter(`codeFencedMeta${c}`);v+=d.move(" "),v+=d.move(r.safe(e.meta,{before:v,after:`
|
|
87
|
-
`,encode:["`"],...d.current()})),g()}return v+=d.move(`
|
|
88
|
-
`),l&&(v+=d.move(l+`
|
|
89
|
-
`)),v+=d.move(m),f(),v}function D5(e,t,r){return(r?"":" ")+e}function tw(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function R5(e,t,r,s){const i=tw(r),l=i==='"'?"Quote":"Apostrophe",c=r.enter("definition");let d=r.enter("label");const m=r.createTracker(s);let f=m.move("[");return f+=m.move(r.safe(r.associationId(e),{before:f,after:"]",...m.current()})),f+=m.move("]: "),d(),!e.url||/[\0- \u007F]/.test(e.url)?(d=r.enter("destinationLiteral"),f+=m.move("<"),f+=m.move(r.safe(e.url,{before:f,after:">",...m.current()})),f+=m.move(">")):(d=r.enter("destinationRaw"),f+=m.move(r.safe(e.url,{before:f,after:e.title?" ":`
|
|
90
|
-
`,...m.current()}))),d(),e.title&&(d=r.enter(`title${l}`),f+=m.move(" "+i),f+=m.move(r.safe(e.title,{before:f,after:i,...m.current()})),f+=m.move(i),d()),c(),f}function A5(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function cu(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Zh(e,t,r){const s=Bl(e),i=Bl(t);return s===void 0?i===void 0?r==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:s===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}R0.peek=M5;function R0(e,t,r,s){const i=A5(r),l=r.enter("emphasis"),c=r.createTracker(s),d=c.move(i);let m=c.move(r.containerPhrasing(e,{after:i,before:d,...c.current()}));const f=m.charCodeAt(0),v=Zh(s.before.charCodeAt(s.before.length-1),f,i);v.inside&&(m=cu(f)+m.slice(1));const g=m.charCodeAt(m.length-1),w=Zh(s.after.charCodeAt(0),g,i);w.inside&&(m=m.slice(0,-1)+cu(g));const k=c.move(i);return l(),r.attentionEncodeSurroundingInfo={after:w.outside,before:v.outside},d+m+k}function M5(e,t,r){return r.options.emphasis||"*"}function I5(e,t){let r=!1;return Zv(e,function(s){if("value"in s&&/\r?\n|\r/.test(s.value)||s.type==="break")return r=!0,gb}),!!((!e.depth||e.depth<3)&&Vv(e)&&(t.options.setext||r))}function E5(e,t,r,s){const i=Math.max(Math.min(6,e.depth||1),1),l=r.createTracker(s);if(I5(e,r)){const v=r.enter("headingSetext"),g=r.enter("phrasing"),w=r.containerPhrasing(e,{...l.current(),before:`
|
|
91
|
-
`,after:`
|
|
92
|
-
`});return g(),v(),w+`
|
|
93
|
-
`+(i===1?"=":"-").repeat(w.length-(Math.max(w.lastIndexOf("\r"),w.lastIndexOf(`
|
|
94
|
-
`))+1))}const c="#".repeat(i),d=r.enter("headingAtx"),m=r.enter("phrasing");l.move(c+" ");let f=r.containerPhrasing(e,{before:"# ",after:`
|
|
95
|
-
`,...l.current()});return/^[\t ]/.test(f)&&(f=cu(f.charCodeAt(0))+f.slice(1)),f=f?c+" "+f:c,r.options.closeAtx&&(f+=" "+c),m(),d(),f}A0.peek=L5;function A0(e){return e.value||""}function L5(){return"<"}M0.peek=F5;function M0(e,t,r,s){const i=tw(r),l=i==='"'?"Quote":"Apostrophe",c=r.enter("image");let d=r.enter("label");const m=r.createTracker(s);let f=m.move("![");return f+=m.move(r.safe(e.alt,{before:f,after:"]",...m.current()})),f+=m.move("]("),d(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(d=r.enter("destinationLiteral"),f+=m.move("<"),f+=m.move(r.safe(e.url,{before:f,after:">",...m.current()})),f+=m.move(">")):(d=r.enter("destinationRaw"),f+=m.move(r.safe(e.url,{before:f,after:e.title?" ":")",...m.current()}))),d(),e.title&&(d=r.enter(`title${l}`),f+=m.move(" "+i),f+=m.move(r.safe(e.title,{before:f,after:i,...m.current()})),f+=m.move(i),d()),f+=m.move(")"),c(),f}function F5(){return"!"}I0.peek=_5;function I0(e,t,r,s){const i=e.referenceType,l=r.enter("imageReference");let c=r.enter("label");const d=r.createTracker(s);let m=d.move("![");const f=r.safe(e.alt,{before:m,after:"]",...d.current()});m+=d.move(f+"]["),c();const v=r.stack;r.stack=[],c=r.enter("reference");const g=r.safe(r.associationId(e),{before:m,after:"]",...d.current()});return c(),r.stack=v,l(),i==="full"||!f||f!==g?m+=d.move(g+"]"):i==="shortcut"?m=m.slice(0,-1):m+=d.move("]"),m}function _5(){return"!"}E0.peek=O5;function E0(e,t,r){let s=e.value||"",i="`",l=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(s);)i+="`";for(/[^ \r\n]/.test(s)&&(/^[ \r\n]/.test(s)&&/[ \r\n]$/.test(s)||/^`|`$/.test(s))&&(s=" "+s+" ");++l<r.unsafe.length;){const c=r.unsafe[l],d=r.compilePattern(c);let m;if(c.atBreak)for(;m=d.exec(s);){let f=m.index;s.charCodeAt(f)===10&&s.charCodeAt(f-1)===13&&f--,s=s.slice(0,f)+" "+s.slice(m.index+1)}}return i+s+i}function O5(){return"`"}function L0(e,t){const r=Vv(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(r===e.url||"mailto:"+r===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}F0.peek=B5;function F0(e,t,r,s){const i=tw(r),l=i==='"'?"Quote":"Apostrophe",c=r.createTracker(s);let d,m;if(L0(e,r)){const v=r.stack;r.stack=[],d=r.enter("autolink");let g=c.move("<");return g+=c.move(r.containerPhrasing(e,{before:g,after:">",...c.current()})),g+=c.move(">"),d(),r.stack=v,g}d=r.enter("link"),m=r.enter("label");let f=c.move("[");return f+=c.move(r.containerPhrasing(e,{before:f,after:"](",...c.current()})),f+=c.move("]("),m(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(m=r.enter("destinationLiteral"),f+=c.move("<"),f+=c.move(r.safe(e.url,{before:f,after:">",...c.current()})),f+=c.move(">")):(m=r.enter("destinationRaw"),f+=c.move(r.safe(e.url,{before:f,after:e.title?" ":")",...c.current()}))),m(),e.title&&(m=r.enter(`title${l}`),f+=c.move(" "+i),f+=c.move(r.safe(e.title,{before:f,after:i,...c.current()})),f+=c.move(i),m()),f+=c.move(")"),d(),f}function B5(e,t,r){return L0(e,r)?"<":"["}_0.peek=W5;function _0(e,t,r,s){const i=e.referenceType,l=r.enter("linkReference");let c=r.enter("label");const d=r.createTracker(s);let m=d.move("[");const f=r.containerPhrasing(e,{before:m,after:"]",...d.current()});m+=d.move(f+"]["),c();const v=r.stack;r.stack=[],c=r.enter("reference");const g=r.safe(r.associationId(e),{before:m,after:"]",...d.current()});return c(),r.stack=v,l(),i==="full"||!f||f!==g?m+=d.move(g+"]"):i==="shortcut"?m=m.slice(0,-1):m+=d.move("]"),m}function W5(){return"["}function nw(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function U5(e){const t=nw(e),r=e.options.bulletOther;if(!r)return t==="*"?"-":"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(r===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+r+"`) to be different");return r}function H5(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function O0(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function z5(e,t,r,s){const i=r.enter("list"),l=r.bulletCurrent;let c=e.ordered?H5(r):nw(r);const d=e.ordered?c==="."?")":".":U5(r);let m=t&&r.bulletLastUsed?c===r.bulletLastUsed:!1;if(!e.ordered){const v=e.children?e.children[0]:void 0;if((c==="*"||c==="-")&&v&&(!v.children||!v.children[0])&&r.stack[r.stack.length-1]==="list"&&r.stack[r.stack.length-2]==="listItem"&&r.stack[r.stack.length-3]==="list"&&r.stack[r.stack.length-4]==="listItem"&&r.indexStack[r.indexStack.length-1]===0&&r.indexStack[r.indexStack.length-2]===0&&r.indexStack[r.indexStack.length-3]===0&&(m=!0),O0(r)===c&&v){let g=-1;for(;++g<e.children.length;){const w=e.children[g];if(w&&w.type==="listItem"&&w.children&&w.children[0]&&w.children[0].type==="thematicBreak"){m=!0;break}}}}m&&(c=d),r.bulletCurrent=c;const f=r.containerFlow(e,s);return r.bulletLastUsed=c,r.bulletCurrent=l,i(),f}function q5(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function $5(e,t,r,s){const i=q5(r);let l=r.bulletCurrent||nw(r);t&&t.type==="list"&&t.ordered&&(l=(typeof t.start=="number"&&t.start>-1?t.start:1)+(r.options.incrementListMarker===!1?0:t.children.indexOf(e))+l);let c=l.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(c=Math.ceil(c/4)*4);const d=r.createTracker(s);d.move(l+" ".repeat(c-l.length)),d.shift(c);const m=r.enter("listItem"),f=r.indentLines(r.containerFlow(e,d.current()),v);return m(),f;function v(g,w,k){return w?(k?"":" ".repeat(c))+g:(k?l:l+" ".repeat(c-l.length))+g}}function V5(e,t,r,s){const i=r.enter("paragraph"),l=r.enter("phrasing"),c=r.containerPhrasing(e,s);return l(),i(),c}const G5=Am(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function K5(e,t,r,s){return(e.children.some(function(c){return G5(c)})?r.containerPhrasing:r.containerFlow).call(r,e,s)}function Y5(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}B0.peek=X5;function B0(e,t,r,s){const i=Y5(r),l=r.enter("strong"),c=r.createTracker(s),d=c.move(i+i);let m=c.move(r.containerPhrasing(e,{after:i,before:d,...c.current()}));const f=m.charCodeAt(0),v=Zh(s.before.charCodeAt(s.before.length-1),f,i);v.inside&&(m=cu(f)+m.slice(1));const g=m.charCodeAt(m.length-1),w=Zh(s.after.charCodeAt(0),g,i);w.inside&&(m=m.slice(0,-1)+cu(g));const k=c.move(i+i);return l(),r.attentionEncodeSurroundingInfo={after:w.outside,before:v.outside},d+m+k}function X5(e,t,r){return r.options.strong||"*"}function Q5(e,t,r,s){return r.safe(e.value,s)}function J5(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function Z5(e,t,r){const s=(O0(r)+(r.options.ruleSpaces?" ":"")).repeat(J5(r));return r.options.ruleSpaces?s.slice(0,-1):s}const W0={blockquote:x5,break:yC,code:P5,definition:R5,emphasis:R0,hardBreak:yC,heading:E5,html:A0,image:M0,imageReference:I0,inlineCode:E0,link:F0,linkReference:_0,list:z5,listItem:$5,paragraph:V5,root:K5,strong:B0,text:Q5,thematicBreak:Z5};function e6(){return{enter:{table:t6,tableData:kC,tableHeader:kC,tableRow:r6},exit:{codeText:s6,table:n6,tableData:Yf,tableHeader:Yf,tableRow:Yf}}}function t6(e){const t=e._align;this.enter({type:"table",align:t.map(function(r){return r==="none"?null:r}),children:[]},e),this.data.inTable=!0}function n6(e){this.exit(e),this.data.inTable=void 0}function r6(e){this.enter({type:"tableRow",children:[]},e)}function Yf(e){this.exit(e)}function kC(e){this.enter({type:"tableCell",children:[]},e)}function s6(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,i6));const r=this.stack[this.stack.length-1];r.type,r.value=t,this.exit(e)}function i6(e,t){return t==="|"?t:e}function a6(e){const t=e||{},r=t.tableCellPadding,s=t.tablePipeAlign,i=t.stringLength,l=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
96
|
-
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:w,table:c,tableCell:m,tableRow:d}};function c(k,y,S,T){return f(v(k,S,T),k.align)}function d(k,y,S,T){const j=g(k,S,T),N=f([j]);return N.slice(0,N.indexOf(`
|
|
97
|
-
`))}function m(k,y,S,T){const j=S.enter("tableCell"),N=S.enter("phrasing"),D=S.containerPhrasing(k,{...T,before:l,after:l});return N(),j(),D}function f(k,y){return y5(k,{align:y,alignDelimiters:s,padding:r,stringLength:i})}function v(k,y,S){const T=k.children;let j=-1;const N=[],D=y.enter("table");for(;++j<T.length;)N[j]=g(T[j],y,S);return D(),N}function g(k,y,S){const T=k.children;let j=-1;const N=[],D=y.enter("tableRow");for(;++j<T.length;)N[j]=m(T[j],k,y,S);return D(),N}function w(k,y,S){let T=W0.inlineCode(k,y,S);return S.stack.includes("tableCell")&&(T=T.replace(/\|/g,"\\$&")),T}}function o6(){return{exit:{taskListCheckValueChecked:xC,taskListCheckValueUnchecked:xC,paragraph:c6}}}function l6(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:u6}}}function xC(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function c6(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const r=this.stack[this.stack.length-1];r.type;const s=r.children[0];if(s&&s.type==="text"){const i=t.children;let l=-1,c;for(;++l<i.length;){const d=i[l];if(d.type==="paragraph"){c=d;break}}c===r&&(s.value=s.value.slice(1),s.value.length===0?r.children.shift():r.position&&s.position&&typeof s.position.start.offset=="number"&&(s.position.start.column++,s.position.start.offset++,r.position.start=Object.assign({},s.position.start)))}}this.exit(e)}function u6(e,t,r,s){const i=e.children[0],l=typeof e.checked=="boolean"&&i&&i.type==="paragraph",c="["+(e.checked?"x":" ")+"] ",d=r.createTracker(s);l&&d.move(c);let m=W0.listItem(e,t,r,{...s,...d.current()});return l&&(m=m.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,f)),m;function f(v){return v+c}}function d6(){return[z4(),u5(),p5(),e6(),o6()]}function h6(e){return{extensions:[q4(),d5(e),f5(),a6(e),l6()]}}const m6={tokenize:w6,partial:!0},U0={tokenize:y6,partial:!0},H0={tokenize:k6,partial:!0},z0={tokenize:x6,partial:!0},p6={tokenize:S6,partial:!0},q0={name:"wwwAutolink",tokenize:b6,previous:V0},$0={name:"protocolAutolink",tokenize:v6,previous:G0},va={name:"emailAutolink",tokenize:g6,previous:K0},Yi={};function f6(){return{text:Yi}}let xo=48;for(;xo<123;)Yi[xo]=va,xo++,xo===58?xo=65:xo===91&&(xo=97);Yi[43]=va;Yi[45]=va;Yi[46]=va;Yi[95]=va;Yi[72]=[va,$0];Yi[104]=[va,$0];Yi[87]=[va,q0];Yi[119]=[va,q0];function g6(e,t,r){const s=this;let i,l;return c;function c(g){return!yb(g)||!K0.call(s,s.previous)||rw(s.events)?r(g):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),d(g))}function d(g){return yb(g)?(e.consume(g),d):g===64?(e.consume(g),m):r(g)}function m(g){return g===46?e.check(p6,v,f)(g):g===45||g===95||gs(g)?(l=!0,e.consume(g),m):v(g)}function f(g){return e.consume(g),i=!0,m}function v(g){return l&&i&&ks(s.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(g)):r(g)}}function b6(e,t,r){const s=this;return i;function i(c){return c!==87&&c!==119||!V0.call(s,s.previous)||rw(s.events)?r(c):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(m6,e.attempt(U0,e.attempt(H0,l),r),r)(c))}function l(c){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(c)}}function v6(e,t,r){const s=this;let i="",l=!1;return c;function c(g){return(g===72||g===104)&&G0.call(s,s.previous)&&!rw(s.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(g),e.consume(g),d):r(g)}function d(g){if(ks(g)&&i.length<5)return i+=String.fromCodePoint(g),e.consume(g),d;if(g===58){const w=i.toLowerCase();if(w==="http"||w==="https")return e.consume(g),m}return r(g)}function m(g){return g===47?(e.consume(g),l?f:(l=!0,m)):r(g)}function f(g){return g===null||Xh(g)||Xn(g)||_o(g)||Pm(g)?r(g):e.attempt(U0,e.attempt(H0,v),r)(g)}function v(g){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(g)}}function w6(e,t,r){let s=0;return i;function i(c){return(c===87||c===119)&&s<3?(s++,e.consume(c),i):c===46&&s===3?(e.consume(c),l):r(c)}function l(c){return c===null?r(c):t(c)}}function y6(e,t,r){let s,i,l;return c;function c(f){return f===46||f===95?e.check(z0,m,d)(f):f===null||Xn(f)||_o(f)||f!==45&&Pm(f)?m(f):(l=!0,e.consume(f),c)}function d(f){return f===95?s=!0:(i=s,s=void 0),e.consume(f),c}function m(f){return i||s||!l?r(f):t(f)}}function k6(e,t){let r=0,s=0;return i;function i(c){return c===40?(r++,e.consume(c),i):c===41&&s<r?l(c):c===33||c===34||c===38||c===39||c===41||c===42||c===44||c===46||c===58||c===59||c===60||c===63||c===93||c===95||c===126?e.check(z0,t,l)(c):c===null||Xn(c)||_o(c)?t(c):(e.consume(c),i)}function l(c){return c===41&&s++,e.consume(c),i}}function x6(e,t,r){return s;function s(d){return d===33||d===34||d===39||d===41||d===42||d===44||d===46||d===58||d===59||d===63||d===95||d===126?(e.consume(d),s):d===38?(e.consume(d),l):d===93?(e.consume(d),i):d===60||d===null||Xn(d)||_o(d)?t(d):r(d)}function i(d){return d===null||d===40||d===91||Xn(d)||_o(d)?t(d):s(d)}function l(d){return ks(d)?c(d):r(d)}function c(d){return d===59?(e.consume(d),s):ks(d)?(e.consume(d),c):r(d)}}function S6(e,t,r){return s;function s(l){return e.consume(l),i}function i(l){return gs(l)?r(l):t(l)}}function V0(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Xn(e)}function G0(e){return!ks(e)}function K0(e){return!(e===47||yb(e))}function yb(e){return e===43||e===45||e===46||e===95||gs(e)}function rw(e){let t=e.length,r=!1;for(;t--;){const s=e[t][1];if((s.type==="labelLink"||s.type==="labelImage")&&!s._balanced){r=!0;break}if(s._gfmAutolinkLiteralWalkedInto){r=!1;break}}return e.length>0&&!r&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}const C6={tokenize:M6,partial:!0};function j6(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:D6,continuation:{tokenize:R6},exit:A6}},text:{91:{name:"gfmFootnoteCall",tokenize:P6},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:T6,resolveTo:N6}}}}function T6(e,t,r){const s=this;let i=s.events.length;const l=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let c;for(;i--;){const m=s.events[i][1];if(m.type==="labelImage"){c=m;break}if(m.type==="gfmFootnoteCall"||m.type==="labelLink"||m.type==="label"||m.type==="image"||m.type==="link")break}return d;function d(m){if(!c||!c._balanced)return r(m);const f=ji(s.sliceSerialize({start:c.end,end:s.now()}));return f.codePointAt(0)!==94||!l.includes(f.slice(1))?r(m):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),t(m))}}function N6(e,t){let r=e.length;for(;r--;)if(e[r][1].type==="labelImage"&&e[r][0]==="enter"){e[r][1];break}e[r+1][1].type="data",e[r+3][1].type="gfmFootnoteCallLabelMarker";const s={type:"gfmFootnoteCall",start:Object.assign({},e[r+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[r+3][1].end),end:Object.assign({},e[r+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const l={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},c={type:"chunkString",contentType:"string",start:Object.assign({},l.start),end:Object.assign({},l.end)},d=[e[r+1],e[r+2],["enter",s,t],e[r+3],e[r+4],["enter",i,t],["exit",i,t],["enter",l,t],["enter",c,t],["exit",c,t],["exit",l,t],e[e.length-2],e[e.length-1],["exit",s,t]];return e.splice(r,e.length-r+1,...d),e}function P6(e,t,r){const s=this,i=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let l=0,c;return d;function d(g){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),m}function m(g){return g!==94?r(g):(e.enter("gfmFootnoteCallMarker"),e.consume(g),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",f)}function f(g){if(l>999||g===93&&!c||g===null||g===91||Xn(g))return r(g);if(g===93){e.exit("chunkString");const w=e.exit("gfmFootnoteCallString");return i.includes(ji(s.sliceSerialize(w)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):r(g)}return Xn(g)||(c=!0),l++,e.consume(g),g===92?v:f}function v(g){return g===91||g===92||g===93?(e.consume(g),l++,f):f(g)}}function D6(e,t,r){const s=this,i=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let l,c=0,d;return m;function m(y){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(y),e.exit("gfmFootnoteDefinitionLabelMarker"),f}function f(y){return y===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(y),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",v):r(y)}function v(y){if(c>999||y===93&&!d||y===null||y===91||Xn(y))return r(y);if(y===93){e.exit("chunkString");const S=e.exit("gfmFootnoteDefinitionLabelString");return l=ji(s.sliceSerialize(S)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(y),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),w}return Xn(y)||(d=!0),c++,e.consume(y),y===92?g:v}function g(y){return y===91||y===92||y===93?(e.consume(y),c++,v):v(y)}function w(y){return y===58?(e.enter("definitionMarker"),e.consume(y),e.exit("definitionMarker"),i.includes(l)||i.push(l),_n(e,k,"gfmFootnoteDefinitionWhitespace")):r(y)}function k(y){return t(y)}}function R6(e,t,r){return e.check(Lu,t,e.attempt(C6,t,r))}function A6(e){e.exit("gfmFootnoteDefinition")}function M6(e,t,r){const s=this;return _n(e,i,"gfmFootnoteDefinitionIndent",5);function i(l){const c=s.events[s.events.length-1];return c&&c[1].type==="gfmFootnoteDefinitionIndent"&&c[2].sliceSerialize(c[1],!0).length===4?t(l):r(l)}}function I6(e){let r=(e||{}).singleTilde;const s={name:"strikethrough",tokenize:l,resolveAll:i};return r==null&&(r=!0),{text:{126:s},insideSpan:{null:[s]},attentionMarkers:{null:[126]}};function i(c,d){let m=-1;for(;++m<c.length;)if(c[m][0]==="enter"&&c[m][1].type==="strikethroughSequenceTemporary"&&c[m][1]._close){let f=m;for(;f--;)if(c[f][0]==="exit"&&c[f][1].type==="strikethroughSequenceTemporary"&&c[f][1]._open&&c[m][1].end.offset-c[m][1].start.offset===c[f][1].end.offset-c[f][1].start.offset){c[m][1].type="strikethroughSequence",c[f][1].type="strikethroughSequence";const v={type:"strikethrough",start:Object.assign({},c[f][1].start),end:Object.assign({},c[m][1].end)},g={type:"strikethroughText",start:Object.assign({},c[f][1].end),end:Object.assign({},c[m][1].start)},w=[["enter",v,d],["enter",c[f][1],d],["exit",c[f][1],d],["enter",g,d]],k=d.parser.constructs.insideSpan.null;k&&$s(w,w.length,0,Dm(k,c.slice(f+1,m),d)),$s(w,w.length,0,[["exit",g,d],["enter",c[m][1],d],["exit",c[m][1],d],["exit",v,d]]),$s(c,f-1,m-f+3,w),m=f+w.length-2;break}}for(m=-1;++m<c.length;)c[m][1].type==="strikethroughSequenceTemporary"&&(c[m][1].type="data");return c}function l(c,d,m){const f=this.previous,v=this.events;let g=0;return w;function w(y){return f===126&&v[v.length-1][1].type!=="characterEscape"?m(y):(c.enter("strikethroughSequenceTemporary"),k(y))}function k(y){const S=Bl(f);if(y===126)return g>1?m(y):(c.consume(y),g++,k);if(g<2&&!r)return m(y);const T=c.exit("strikethroughSequenceTemporary"),j=Bl(y);return T._open=!j||j===2&&!!S,T._close=!S||S===2&&!!j,d(y)}}}class E6{constructor(){this.map=[]}add(t,r,s){L6(this,t,r,s)}consume(t){if(this.map.sort(function(l,c){return l[0]-c[0]}),this.map.length===0)return;let r=this.map.length;const s=[];for(;r>0;)r-=1,s.push(t.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),t.length=this.map[r][0];s.push(t.slice()),t.length=0;let i=s.pop();for(;i;){for(const l of i)t.push(l);i=s.pop()}this.map.length=0}}function L6(e,t,r,s){let i=0;if(!(r===0&&s.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=r,e.map[i][2].push(...s);return}i+=1}e.map.push([t,r,s])}}function F6(e,t){let r=!1;const s=[];for(;t<e.length;){const i=e[t];if(r){if(i[0]==="enter")i[1].type==="tableContent"&&s.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const l=s.length-1;s[l]=s[l]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(r=!0);t+=1}return s}function _6(){return{flow:{null:{name:"table",tokenize:O6,resolveAll:B6}}}}function O6(e,t,r){const s=this;let i=0,l=0,c;return d;function d(F){let te=s.events.length-1;for(;te>-1;){const X=s.events[te][1].type;if(X==="lineEnding"||X==="linePrefix")te--;else break}const E=te>-1?s.events[te][1].type:null,se=E==="tableHead"||E==="tableRow"?I:m;return se===I&&s.parser.lazy[s.now().line]?r(F):se(F)}function m(F){return e.enter("tableHead"),e.enter("tableRow"),f(F)}function f(F){return F===124||(c=!0,l+=1),v(F)}function v(F){return F===null?r(F):sn(F)?l>1?(l=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(F),e.exit("lineEnding"),k):r(F):An(F)?_n(e,v,"whitespace")(F):(l+=1,c&&(c=!1,i+=1),F===124?(e.enter("tableCellDivider"),e.consume(F),e.exit("tableCellDivider"),c=!0,v):(e.enter("data"),g(F)))}function g(F){return F===null||F===124||Xn(F)?(e.exit("data"),v(F)):(e.consume(F),F===92?w:g)}function w(F){return F===92||F===124?(e.consume(F),g):g(F)}function k(F){return s.interrupt=!1,s.parser.lazy[s.now().line]?r(F):(e.enter("tableDelimiterRow"),c=!1,An(F)?_n(e,y,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(F):y(F))}function y(F){return F===45||F===58?T(F):F===124?(c=!0,e.enter("tableCellDivider"),e.consume(F),e.exit("tableCellDivider"),S):B(F)}function S(F){return An(F)?_n(e,T,"whitespace")(F):T(F)}function T(F){return F===58?(l+=1,c=!0,e.enter("tableDelimiterMarker"),e.consume(F),e.exit("tableDelimiterMarker"),j):F===45?(l+=1,j(F)):F===null||sn(F)?H(F):B(F)}function j(F){return F===45?(e.enter("tableDelimiterFiller"),N(F)):B(F)}function N(F){return F===45?(e.consume(F),N):F===58?(c=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(F),e.exit("tableDelimiterMarker"),D):(e.exit("tableDelimiterFiller"),D(F))}function D(F){return An(F)?_n(e,H,"whitespace")(F):H(F)}function H(F){return F===124?y(F):F===null||sn(F)?!c||i!==l?B(F):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(F)):B(F)}function B(F){return r(F)}function I(F){return e.enter("tableRow"),A(F)}function A(F){return F===124?(e.enter("tableCellDivider"),e.consume(F),e.exit("tableCellDivider"),A):F===null||sn(F)?(e.exit("tableRow"),t(F)):An(F)?_n(e,A,"whitespace")(F):(e.enter("data"),L(F))}function L(F){return F===null||F===124||Xn(F)?(e.exit("data"),A(F)):(e.consume(F),F===92?_:L)}function _(F){return F===92||F===124?(e.consume(F),L):L(F)}}function B6(e,t){let r=-1,s=!0,i=0,l=[0,0,0,0],c=[0,0,0,0],d=!1,m=0,f,v,g;const w=new E6;for(;++r<e.length;){const k=e[r],y=k[1];k[0]==="enter"?y.type==="tableHead"?(d=!1,m!==0&&(SC(w,t,m,f,v),v=void 0,m=0),f={type:"table",start:Object.assign({},y.start),end:Object.assign({},y.end)},w.add(r,0,[["enter",f,t]])):y.type==="tableRow"||y.type==="tableDelimiterRow"?(s=!0,g=void 0,l=[0,0,0,0],c=[0,r+1,0,0],d&&(d=!1,v={type:"tableBody",start:Object.assign({},y.start),end:Object.assign({},y.end)},w.add(r,0,[["enter",v,t]])),i=y.type==="tableDelimiterRow"?2:v?3:1):i&&(y.type==="data"||y.type==="tableDelimiterMarker"||y.type==="tableDelimiterFiller")?(s=!1,c[2]===0&&(l[1]!==0&&(c[0]=c[1],g=Yd(w,t,l,i,void 0,g),l=[0,0,0,0]),c[2]=r)):y.type==="tableCellDivider"&&(s?s=!1:(l[1]!==0&&(c[0]=c[1],g=Yd(w,t,l,i,void 0,g)),l=c,c=[l[1],r,0,0])):y.type==="tableHead"?(d=!0,m=r):y.type==="tableRow"||y.type==="tableDelimiterRow"?(m=r,l[1]!==0?(c[0]=c[1],g=Yd(w,t,l,i,r,g)):c[1]!==0&&(g=Yd(w,t,c,i,r,g)),i=0):i&&(y.type==="data"||y.type==="tableDelimiterMarker"||y.type==="tableDelimiterFiller")&&(c[3]=r)}for(m!==0&&SC(w,t,m,f,v),w.consume(t.events),r=-1;++r<t.events.length;){const k=t.events[r];k[0]==="enter"&&k[1].type==="table"&&(k[1]._align=F6(t.events,r))}return e}function Yd(e,t,r,s,i,l){const c=s===1?"tableHeader":s===2?"tableDelimiter":"tableData",d="tableContent";r[0]!==0&&(l.end=Object.assign({},Rl(t.events,r[0])),e.add(r[0],0,[["exit",l,t]]));const m=Rl(t.events,r[1]);if(l={type:c,start:Object.assign({},m),end:Object.assign({},m)},e.add(r[1],0,[["enter",l,t]]),r[2]!==0){const f=Rl(t.events,r[2]),v=Rl(t.events,r[3]),g={type:d,start:Object.assign({},f),end:Object.assign({},v)};if(e.add(r[2],0,[["enter",g,t]]),s!==2){const w=t.events[r[2]],k=t.events[r[3]];if(w[1].end=Object.assign({},k[1].end),w[1].type="chunkText",w[1].contentType="text",r[3]>r[2]+1){const y=r[2]+1,S=r[3]-r[2]-1;e.add(y,S,[])}}e.add(r[3]+1,0,[["exit",g,t]])}return i!==void 0&&(l.end=Object.assign({},Rl(t.events,i)),e.add(i,0,[["exit",l,t]]),l=void 0),l}function SC(e,t,r,s,i){const l=[],c=Rl(t.events,r);i&&(i.end=Object.assign({},c),l.push(["exit",i,t])),s.end=Object.assign({},c),l.push(["exit",s,t]),e.add(r+1,0,l)}function Rl(e,t){const r=e[t],s=r[0]==="enter"?"start":"end";return r[1][s]}const W6={name:"tasklistCheck",tokenize:H6};function U6(){return{text:{91:W6}}}function H6(e,t,r){const s=this;return i;function i(m){return s.previous!==null||!s._gfmTasklistFirstContentOfListItem?r(m):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),l)}function l(m){return Xn(m)?(e.enter("taskListCheckValueUnchecked"),e.consume(m),e.exit("taskListCheckValueUnchecked"),c):m===88||m===120?(e.enter("taskListCheckValueChecked"),e.consume(m),e.exit("taskListCheckValueChecked"),c):r(m)}function c(m){return m===93?(e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),d):r(m)}function d(m){return sn(m)?t(m):An(m)?e.check({tokenize:z6},t,r)(m):r(m)}}function z6(e,t,r){return _n(e,s,"whitespace");function s(i){return i===null?r(i):t(i)}}function q6(e){return s0([f6(),j6(),I6(e),_6(),U6()])}const $6={};function Y0(e){const t=this,r=e||$6,s=t.data(),i=s.micromarkExtensions||(s.micromarkExtensions=[]),l=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),c=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);i.push(q6(r)),l.push(d6()),c.push(h6(r))}const em="*** Begin Patch",tm="*** End Patch";function CC(e){const t=e.replace(/\r\n/g,`
|
|
98
|
-
`);if(!t.includes(em)||!t.includes(tm))return null;const r=t.split(`
|
|
99
|
-
`),s=[];let i=null,l=null;for(const c of r){if(c===em||c===tm)continue;if(c.startsWith("*** Update File: ")){i=Xf("update",c.slice(17)),s.push(i),l=null;continue}if(c.startsWith("*** Add File: ")){i=Xf("add",c.slice(14)),s.push(i),l={oldLineNumber:0,newLineNumber:1};continue}if(c.startsWith("*** Delete File: ")){i=Xf("delete",c.slice(17)),s.push(i),l=null;continue}if(!i)continue;if(c.startsWith("*** Move to: ")){i.nextPath=c.slice(13),i.lines.push({kind:"meta",text:c,oldLineNumber:null,newLineNumber:null});continue}if(c.startsWith("@@")){l=Y6(c)??{oldLineNumber:0,newLineNumber:0},i.lines.push({kind:"hunk",text:c,oldLineNumber:null,newLineNumber:null});continue}if(c==="*** End of File"){i.lines.push({kind:"meta",text:c,oldLineNumber:null,newLineNumber:null});continue}if(i.action==="add"&&c.startsWith("+")){i.additions+=1,i.lines.push({kind:"add",text:c,oldLineNumber:null,newLineNumber:(l==null?void 0:l.newLineNumber)??i.additions}),l&&(l.newLineNumber+=1);continue}if(!l){i.lines.push({kind:"meta",text:c,oldLineNumber:null,newLineNumber:null});continue}if(c.startsWith("+")){i.additions+=1,i.lines.push({kind:"add",text:c,oldLineNumber:null,newLineNumber:l.newLineNumber}),l.newLineNumber+=1;continue}if(c.startsWith("-")){i.deletions+=1,i.lines.push({kind:"remove",text:c,oldLineNumber:l.oldLineNumber,newLineNumber:null}),l.oldLineNumber+=1;continue}if(c.startsWith(" ")||c.length===0){i.lines.push({kind:"context",text:c,oldLineNumber:l.oldLineNumber,newLineNumber:l.newLineNumber}),l.oldLineNumber+=1,l.newLineNumber+=1;continue}i.lines.push({kind:"meta",text:c,oldLineNumber:null,newLineNumber:null})}return s.length===0?null:{files:s,totalAdditions:s.reduce((c,d)=>c+d.additions,0),totalDeletions:s.reduce((c,d)=>c+d.deletions,0)}}function V6(e,t=[]){const r=e.replace(/\r\n/g,`
|
|
100
|
-
`).trim();if(!r)return null;if(r.includes(em)&&r.includes(tm))return r;const s=[...new Set(t.map(i=>i.trim()).filter(i=>i.length>0))];return s.length!==1||!X6(r)?null:[em,`*** Update File: ${s[0]}`,r,tm].join(`
|
|
101
|
-
`)}function G6(e){const t=Q6(e);if(!t)return[];const r=t.replace(/\r\n/g,`
|
|
102
|
-
`).split(`
|
|
103
|
-
`),s=[];let i=!1;for(const l of r){const c=l.trim();if(!i){/^Success\.\s+Updated the following files:/i.test(c)&&(i=!0);continue}if(!c){if(s.length>0)break;continue}const d=c.match(/^[A-Z?]\s+(.+)$/),m=((d==null?void 0:d[1])??c).trim();if(!m)break;s.push(m)}return[...new Set(s)]}function K6(e){return e.replace(/\\/g,"/").split("/").at(-1)||e}function Xf(e,t){return{path:t,nextPath:null,action:e,additions:0,deletions:0,lines:[]}}function Y6(e){const t=e.match(/^@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@/);return t?{oldLineNumber:Number(t[1]),newLineNumber:Number(t[2])}:null}function X6(e){return e.startsWith("@@")||e.startsWith("*** Update File: ")||e.startsWith("*** Add File: ")||e.startsWith("*** Delete File: ")||e.includes(`
|
|
104
|
-
@@`)||e.startsWith("+")||e.startsWith("-")}function Q6(e){const t=e.trim();if(!t)return"";if(!t.startsWith("{"))return t;try{const r=JSON.parse(t);if(!r||typeof r!="object"||Array.isArray(r))return t;const s=r;if(typeof s.output=="string"&&s.output.trim().length>0)return s.output;if(typeof s.result=="string"&&s.result.trim().length>0)return s.result;if(typeof s.message=="string"&&s.message.trim().length>0)return s.message}catch{return t}return t}const J6=/data:image\/([a-zA-Z0-9.+-]+);base64,([A-Za-z0-9+/=]+)/g,Z6=/!\[([^\]]*)\]\((data:image\/[a-zA-Z0-9.+-]+;base64,[A-Za-z0-9+/=]+)\)/g,eq=/<img\b[^>]*src=["'](data:image\/[a-zA-Z0-9.+-]+;base64,[A-Za-z0-9+/=]+)["'][^>]*>/gi,tq=/<image\b([^>]*)>([\s\S]*?)<\/image>/gi,nq=/\[\[CODINGNS_IMAGE_ATTACHMENTS\]\][\s\S]*?\[\[\/CODINGNS_IMAGE_ATTACHMENTS\]\]/g;function Oo(e){const t=rq(e),r=sq(t);return r||X0(t)}function rq(e){return e.replace(nq,"")}function sq(e){const t=e.trim();if(!iq(t))return null;try{const r=JSON.parse(t),s=aq(r);return s.text||s.inlineImages.length>0?s:null}catch{return null}}function iq(e){return e.length<2?!1:e.startsWith("[")&&e.endsWith("]")||e.startsWith("{")&&e.endsWith("}")}function aq(e){const t=[],r=[];return Th(e,t,r),{text:J0(t.join(`
|
|
105
|
-
|
|
106
|
-
`)),inlineImages:Q0(r)}}function Th(e,t,r){if(typeof e=="string"){const c=X0(e);c.text&&t.push(c.text),r.push(...c.inlineImages);return}if(e==null)return;if(Array.isArray(e)){e.forEach(c=>Th(c,t,r));return}if(typeof e!="object")return;const s=e,i=new Set,l=oq(s);l&&(r.push(l),["type","source","media_type","mime_type","mimeType","data","image_url","imageUrl","url","src","alt","name"].forEach(c=>{c in s&&i.add(c)}));for(const c of["image_url","url","src","source"]){const d=s[c];typeof d!="string"||!Z0(d)||(r.push(Ao(d,si(s.alt))),i.add(c))}for(const c of["text","message","content","output","result","summary","caption"])c in s&&(i.add(c),Th(s[c],t,r));i.size>0||Object.values(s).forEach(c=>{Th(c,t,r)})}function X0(e){const t=[];let r=e;return r=r.replace(tq,(s,i,l)=>{const c=hq(i,"name"),d=dq(l);return d!=null&&d.url&&t.push(Ao(d.url,d.altText||c)),""}),r=r.replace(Z6,(s,i,l)=>(t.push(Ao(l,i)),"")),r=r.replace(eq,(s,i)=>(t.push(Ao(i,null)),"")),r=r.replace(J6,(s,i,l)=>(t.push(Ao(s,null,`image/${i}`,nm(l))),"")),{text:J0(r),inlineImages:Q0(t)}}function Ao(e,t,r,s){const i=r??lq(e)??"image/png";return{url:e,mimeType:i,altText:uu(t),estimatedBytes:s??cq(e)}}function oq(e){const t=uq(e.source);if(t){const i=si(t.type).trim().toLowerCase(),l=TC(t.media_type??t.mime_type??t.mimeType),c=jC(t.data);if(i==="base64"&&l&&c)return Ao(`data:${l};base64,${c}`,uu(si(t.alt)||si(t.name)||si(e.alt)||si(e.name)),l,nm(c))}const r=TC(e.media_type??e.mime_type??e.mimeType),s=jC(e.data);return r&&s?Ao(`data:${r};base64,${s}`,uu(si(e.alt)||si(e.name)),r,nm(s)):null}function Q0(e){const t=new Map;return e.forEach(r=>{t.has(r.url)||t.set(r.url,r)}),[...t.values()]}function J0(e){return e.replace(/\r\n/g,`
|
|
107
|
-
`).replace(/[ \t]{2,}/g," ").replace(/[ \t]+\n/g,`
|
|
108
|
-
`).replace(/\n{3,}/g,`
|
|
109
|
-
|
|
110
|
-
`).trim()}function Z0(e){return/^data:image\/[a-zA-Z0-9.+-]+;base64,[A-Za-z0-9+/=]+$/.test(e.trim())}function lq(e){var r;const t=e.match(/^data:(image\/[a-zA-Z0-9.+-]+);base64,/i);return((r=t==null?void 0:t[1])==null?void 0:r.toLowerCase())??null}function cq(e){const t=e.match(/^data:image\/[a-zA-Z0-9.+-]+;base64,([A-Za-z0-9+/=]+)$/i);return t?nm(t[1]):null}function nm(e){const t=e.trim(),r=t.endsWith("==")?2:t.endsWith("=")?1:0;return Math.max(0,Math.floor(t.length*3/4)-r)}function uu(e){const t=si(e).trim();return t.length>0?t:null}function jC(e){if(typeof e!="string")return null;const t=e.replace(/\s+/g,"").trim();return/^[A-Za-z0-9+/=]+$/.test(t)?t:null}function TC(e){if(typeof e!="string")return null;const t=e.trim().toLowerCase();return t.startsWith("image/")?t:null}function si(e){return typeof e=="string"?e:""}function uq(e){return!e||typeof e!="object"||Array.isArray(e)?null:e}function dq(e){const t=e.trim();if(t.length===0)return null;try{const r=JSON.parse(t),s=si(r.image_url??r.imageUrl).trim(),i=uu(si(r.name)||si(r.alt));return{url:Z0(s)?s:null,altText:i}}catch{const r=t.match(/(data:image\/[a-zA-Z0-9.+-]+;base64,[A-Za-z0-9+/=]+)/i);return r?{url:r[1],altText:null}:null}}function hq(e,t){const r=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),s=e.match(new RegExp(`${r}\\s*=\\s*(?:"([^"]*)"|'([^']*)'|\\[([^\\]]*)\\]|([^\\s>]+))`,"i"));return uu((s==null?void 0:s[1])??(s==null?void 0:s[2])??(s==null?void 0:s[3])??(s==null?void 0:s[4])??"")}const eR="codingns.user-app.conversation-scroll",Cl=1,mq=200,pq=1e7;function tR(){return typeof window<"u"&&typeof window.localStorage<"u"}function nR(e){return e.trim()}function rR(e){return!Number.isFinite(e)||e<=0?0:Math.min(Math.round(e),pq)}function sR(e){return!e||typeof e!="object"?null:{scrollTop:rR(e.scrollTop),stickToBottom:e.stickToBottom===!0,lastMessageSignature:typeof e.lastMessageSignature=="string"?e.lastMessageSignature:null,updatedAt:Number.isFinite(e.updatedAt)?e.updatedAt:0}}function iR(){if(!tR())return{schemaVersion:Cl,bySessionId:{}};const e=window.localStorage.getItem(eR);if(!e)return{schemaVersion:Cl,bySessionId:{}};try{const t=JSON.parse(e);if(!t||typeof t!="object"||t.schemaVersion!==Cl||!t.bySessionId||typeof t.bySessionId!="object"||Array.isArray(t.bySessionId))return{schemaVersion:Cl,bySessionId:{}};const r=Object.fromEntries(Object.entries(t.bySessionId).map(([s,i])=>{const l=sR(i);return l?[s,l]:null}).filter(s=>!!s));return{schemaVersion:Cl,bySessionId:r}}catch{return{schemaVersion:Cl,bySessionId:{}}}}function fq(e){if(tR())try{window.localStorage.setItem(eR,JSON.stringify(e))}catch{}}function Xd(e){const t=nR(e);if(!t)return null;const r=iR().bySessionId[t],s=sR(r);return s?{scrollTop:s.scrollTop,stickToBottom:s.stickToBottom,lastMessageSignature:s.lastMessageSignature}:null}function NC(e,t){const r=nR(e);if(!r)return;const s=iR();s.bySessionId[r]={scrollTop:rR(t.scrollTop),stickToBottom:t.stickToBottom,lastMessageSignature:t.lastMessageSignature,updatedAt:Date.now()};const i=Object.entries(s.bySessionId).sort((l,c)=>c[1].updatedAt-l[1].updatedAt).slice(0,mq);s.bySessionId=Object.fromEntries(i),fq(s)}function gq(e){return e.replace(/(\.{3,}|…+)$/,"").trimEnd()}function bq(e){var s;const t=e.match(/^\s*<turn_aborted>([\s\S]*?)<\/turn_aborted>\s*$/i);if(!t)return null;const r=((s=t[1])==null?void 0:s.trim())??"";return!r||/^previous turn aborted$/i.test(r)?{detail:null}:{detail:r}}function vq(e){return o(e==="user"?"conversation.turnAbortedUser":e==="runtime"?"conversation.turnAbortedUnexpected":"conversation.turnAbortedGeneric")}const wq=480,PC=80,DC=240,yq=120,kq=50,xq=3500,aR=p.createContext(!1);function kb(e){return e.replace(/\\/g,"/")}function rm(e){return/^[a-zA-Z]:\//.test(e)}function Sq(e){return e.startsWith("/")||e.startsWith("//")||rm(e)}function Cq(e){return/^[a-zA-Z][a-zA-Z\d+.-]*:/.test(e)&&!rm(e)}function RC(e){return e.replace(/\/+$/,"")}function jq(e){const t=e.indexOf("#"),r=t>=0?e.slice(0,t):e,s=r.indexOf("?");return(s>=0?r.slice(0,s):r).replace(/:(\d+)(?::(\d+))?$/,"")}function Tq(e){const t=[];for(const r of kb(e).split("/"))if(!(!r||r===".")){if(r===".."){if(t.length===0)return null;t.pop();continue}t.push(r)}return t.join("/")}function sw(e){try{return decodeURIComponent(e)}catch{return e}}function Nq(e,t){const r=sw(e).trim();if(!r||r.startsWith("#"))return null;let s=r;if(/^file:\/\//i.test(s))try{s=decodeURIComponent(new URL(s).pathname),/^\/[a-zA-Z]:\//.test(s)&&(s=s.slice(1))}catch{return null}else if(Cq(s))return null;if(s=kb(jq(s.trim())),!s)return null;const i=RC(kb(t.trim()));if(!i)return null;if(Sq(s)){const l=RC(s),c=rm(i)?i.toLowerCase():i,d=rm(l)?l.toLowerCase():l;if(d===c)return null;const m=`${c}/`;return d.startsWith(m)?l.slice(i.length+1):null}return Tq(s)}function xb(e){return e.kind==="tool_call"||e.kind==="tool_result"}function oR(e){return e.toolCall?e.toolCall:xb(e)?{callId:e.rawRef||e.id,name:"tool",input:e.kind==="tool_call"?e.content:"",output:e.kind==="tool_result"&&e.content?e.content:null,error:null,status:e.kind==="tool_call"?"running":"completed"}:null}function Pq(e){return e==="shell_command"||e==="tool"?o("conversation.roleTool"):e}function lR(e){if(!e.trim())return null;try{const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?null:t}catch{return null}}function So(e,t){const r=e[t];return typeof r=="string"?r:""}function Dq(e){if(e.name==="apply_patch"){const l=CC(e.input);if(l)return l;const c=G6(e.output||e.error||""),d=V6(e.input,c);return d?CC(d):null}if(e.name!=="Write"&&e.name!=="Edit"&&e.name!=="MultiEdit")return null;const t=lR(e.input);if(!t)return null;const r=So(t,"file_path")||So(t,"path");if(!r)return null;if(e.name==="Write"){const l=So(t,"content"),c=l.length>0?l.split(/\r?\n/):[];return{files:[{path:r,nextPath:null,action:"add",additions:c.length,deletions:0,lines:c.map((d,m)=>({kind:"add",text:`+${d}`,oldLineNumber:null,newLineNumber:m+1}))}],totalAdditions:c.length,totalDeletions:0}}if(e.name==="Edit"){const l=So(t,"old_string").split(/\r?\n/),c=So(t,"new_string").split(/\r?\n/);return AC(r,[{oldLines:l,newLines:c}])}const i=(Array.isArray(t.edits)?t.edits:[]).map(l=>{if(!l||typeof l!="object"||Array.isArray(l))return null;const c=l;return{oldLines:So(c,"old_string").split(/\r?\n/),newLines:So(c,"new_string").split(/\r?\n/)}}).filter(l=>!!l);return i.length>0?AC(r,i):null}function AC(e,t){const r=[];let s=0,i=0;return t.forEach((l,c)=>{r.push({kind:"hunk",text:`@@ -1,${l.oldLines.length} +1,${l.newLines.length} @@`,oldLineNumber:null,newLineNumber:null}),l.oldLines.forEach((d,m)=>{d.length===0&&l.oldLines.length===1&&l.newLines.length>0||(i+=1,r.push({kind:"remove",text:`-${d}`,oldLineNumber:m+1,newLineNumber:null}))}),l.newLines.forEach((d,m)=>{d.length===0&&l.newLines.length===1&&l.oldLines.length>0||(s+=1,r.push({kind:"add",text:`+${d}`,oldLineNumber:null,newLineNumber:m+1}))}),c<t.length-1&&r.push({kind:"meta",text:"***",oldLineNumber:null,newLineNumber:null})}),{files:[{path:e,nextPath:null,action:"update",additions:s,deletions:i,lines:r}],totalAdditions:s,totalDeletions:i}}function Rq(e){const t=lR(e.input),r=t&&typeof t.command=="string"?t.command.trim():"";if(r)return`${o("conversation.toolPreviewCommand")}:${r}`;if(e.name==="read_thread_terminal")return o("conversation.toolPreviewTerminal");const s=e.input||e.error||e.output||o("conversation.toolResultEmpty");return s.length>60?`${s.slice(0,60)}...`:s}function Aq(e){var l;const t=e.map(c=>({message:c,tool:oR(c)})).filter(c=>!!c.tool);if(t.length===0)return null;const r={...t[0].tool};let s=!1,i=!1;for(const{message:c,tool:d}of t)c.kind==="tool_call"&&(s=!0,!r.input&&d.input&&(r.input=d.input)),c.kind==="tool_result"&&(i=!0,r.output=d.output,r.error=d.error,r.status=d.status,!r.input&&d.input&&(r.input=d.input)),!r.name&&d.name&&(r.name=d.name);return{key:t.map(({message:c})=>c.id).join(":"),tool:r,hasRequest:s,hasResult:i,updatedAt:((l=t.at(-1))==null?void 0:l.message.timestamp)??t[0].message.timestamp}}function Mq(e){const t=new Map;for(const r of e){const s=oR(r);if(!s)continue;const i=t.get(s.callId);if(i){i.messages.push(r);continue}t.set(s.callId,{messages:[r],firstSequence:r.sequence})}return Array.from(t.values()).sort((r,s)=>r.firstSequence-s.firstSequence).map(r=>Aq(r.messages)).filter(r=>!!r)}function Iq(e){const t=[];for(let r=0;r<e.length;r+=1){const s=e[r];if(!xb(s)){t.push({type:"message",key:s.id,message:s});continue}const i=[s];let l=r+1;for(;l<e.length;){const d=e[l];if(!xb(d))break;i.push(d),l+=1}const c=Mq(i);if(c.length===0){t.push({type:"message",key:s.id,message:s}),r=l-1;continue}c.forEach(d=>{t.push({type:"tool_group",key:d.key,group:d})}),r=l-1}return t}function Eq(e,t){if(!tO(null,e))return!1;const r=t.trim();return/AGENTS\.md instructions for/i.test(r)&&/<INSTRUCTIONS>/i.test(r)&&/<\/INSTRUCTIONS>/i.test(r)}function Lq(e){const t=e.split(/\r?\n/).map(r=>r.trim()).find(Boolean);return t?t.replace(/^#+\s*/,""):o("conversation.rulesMessageTitle")}function Fq(e,t){const r=new Set;if(t!=="kimi")return r;for(const s of e){if(s.role==="system"&&s.kind==="text"){r.add(s.id);continue}break}return r}function du(e){var t;return typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(r=>du(r)).join(""):e&&typeof e=="object"&&"props"in e?du(((t=e.props)==null?void 0:t.children)??""):""}function _q(e){const t=Array.isArray(e)?e[0]:e;if(!p.isValidElement(t))return null;const r=t.props,s=typeof r.className=="string"?r.className:"",i=/language-([^\s]+)/.exec(s);return{content:du(r.children).replace(/\n$/,""),codeClassName:s||void 0,language:(i==null?void 0:i[1])??null}}function Oq(e){if(typeof document>"u"||typeof document.execCommand!="function")return!1;const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly","true"),t.style.position="fixed",t.style.top="-9999px",t.style.left="-9999px",t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy")}catch{return!1}finally{document.body.removeChild(t)}}async function iw(e,t){var r;if(!(t.isDesktop&&(await t.bridge.writeClipboardText(e)).ok)){if(typeof navigator<"u"&&((r=navigator.clipboard)!=null&&r.writeText))try{await navigator.clipboard.writeText(e);return}catch{}if(!Oq(e))throw new Error(o("conversation.copyContentFailed"))}}function Bq({className:e,children:t,onCopy:r}){const s=p.useContext(aR),i=du(t).trim();if(s||!i)return n.jsx("code",{className:e||void 0,children:t});function l(c){c.key!=="Enter"&&c.key!==" "||(c.preventDefault(),r(i))}return n.jsx("code",{className:[e,"markdown-inline-copy"].filter(Boolean).join(" "),role:"button",tabIndex:0,"aria-label":o("conversation.copyAction"),onClick:()=>r(i),onKeyDown:l,children:t})}function Wq({href:e,children:t,className:r,onInteract:s}){const i=du(t).trim()||(e?sw(e).trim():"");return n.jsx(aR.Provider,{value:!0,children:n.jsx("a",{href:e,className:[r,"markdown-interactive-link"].filter(Boolean).join(" "),onClick:l=>{l.preventDefault(),s(e,i)},children:t})})}function cR({language:e,codeClassName:t,content:r}){const{showToast:s}=Qn(),i=sr(),l=(e==null?void 0:e.trim().toLowerCase())??null,c=l==="text",d=l||"code";async function m(){try{await iw(r,i),s({title:o("conversation.copyContentSuccess"),tone:"success"})}catch(f){s({title:f instanceof Error?f.message:o("conversation.copyContentFailed"),tone:"error"})}}return n.jsxs("div",{className:`code-block${c?" text-code-block":""}`,children:[n.jsxs("div",{className:"code-header",children:[n.jsx("span",{className:"code-header-label",children:d}),n.jsx("button",{className:"code-copy-button",type:"button",onClick:()=>void m(),children:o("conversation.copyAction")})]}),n.jsx("pre",{className:t,children:n.jsx("code",{children:r})})]})}function Hc({content:e,className:t}){const{showToast:r}=Qn(),s=sr(),{navigationGroups:i,currentWorkspaceId:l,revealWorkspaceFile:c}=Mr(),d=p.useMemo(()=>{var v;return((v=i.find(g=>g.workspace.id===l))==null?void 0:v.workspace)??null},[l,i]);async function m(v){if(v.trim())try{await iw(v,s),r({title:o("conversation.copyContentSuccess"),tone:"success"})}catch(g){r({title:g instanceof Error?g.message:o("conversation.copyContentFailed"),tone:"error"})}}function f(v,g){const w=v&&(d!=null&&d.path)?Nq(v,d.path):null;w&&c({workspaceId:(d==null?void 0:d.id)??l,filePath:w,openViewer:!1})||m(g||(v?sw(v).trim():""))}return n.jsx("div",{className:t,children:n.jsx(j0,{remarkPlugins:[Y0],components:{p:({node:v,...g})=>n.jsx("p",{...g}),a(v){return n.jsx(Wq,{href:typeof v.href=="string"?v.href:void 0,className:typeof v.className=="string"?v.className:void 0,onInteract:f,children:v.children})},pre(v){const g=_q(v.children);return g?n.jsx(cR,{language:g.language,codeClassName:g.codeClassName,content:g.content}):n.jsx("pre",{children:v.children})},code(v){const g=typeof v.className=="string"?v.className:"";return n.jsx(Bq,{className:g||void 0,onCopy:w=>{m(w)},children:v.children})}},children:e})})}function MC(e,t){return e.kind!=="image"||!(t!=null&&t.contentBase64)||t.mimeType!==e.mimeType?null:`data:${t.mimeType};base64,${t.contentBase64}`}function Uq(e){return typeof e!="number"||!Number.isFinite(e)||e<0?null:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Qd({sessionId:e,attachmentPayloads:t=[],attachments:r=[],inlineImages:s=[]}){return n.jsx(Hq,{sessionId:e,attachments:r,attachmentPayloads:t,inlineImages:s})}function Hq({sessionId:e,attachmentPayloads:t=[],attachments:r=[],inlineImages:s=[]}){const[i,l]=p.useState({}),[c,d]=p.useState(null),m=p.useMemo(()=>r.map((w,k)=>{const y=MC(w,t==null?void 0:t[k]);if(y)return{id:w.id,kind:w.kind,fileName:w.fileName,fileSize:w.fileSize,url:y,status:"ready"};const S=i[w.id];return{id:w.id,kind:w.kind,fileName:w.fileName,fileSize:w.fileSize,url:(S==null?void 0:S.url)??null,status:(S==null?void 0:S.status)??(e?"loading":"error")}}),[t,r,i,e]),f=p.useMemo(()=>s.map((w,k)=>({id:`inline-image-${k}`,kind:"image",fileName:w.altText||`${o("conversation.imageAttachmentLabel")} ${k+1}`,fileSize:w.estimatedBytes,url:w.url,status:"ready"})),[s]),v=p.useMemo(()=>[...f,...m],[m,f]),g=v.find(w=>w.id===c)??null;return p.useEffect(()=>{if(!c)return;function w(k){k.key==="Escape"&&d(null)}return window.addEventListener("keydown",w),()=>window.removeEventListener("keydown",w)},[c]),p.useEffect(()=>{const w=r.filter((S,T)=>!MC(S,t==null?void 0:t[T]));if(!e||w.length===0){l({});return}let k=!1;const y=[];return l(Object.fromEntries(w.map(S=>[S.id,{id:S.id,kind:S.kind,fileName:S.fileName,fileSize:S.fileSize,url:null,status:"loading"}]))),Promise.all(w.map(async S=>{try{const T=await C_(e,S.id),j=URL.createObjectURL(T);return y.push(j),{id:S.id,kind:S.kind,fileName:S.fileName,fileSize:S.fileSize,url:j,status:"ready"}}catch{return{id:S.id,kind:S.kind,fileName:S.fileName,fileSize:S.fileSize,url:null,status:"error"}}})).then(S=>{if(k){y.forEach(T=>URL.revokeObjectURL(T));return}l(Object.fromEntries(S.map(T=>[T.id,T])))}),()=>{k=!0,y.forEach(S=>URL.revokeObjectURL(S))}},[t,r,e]),v.length===0?null:n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"message-attachments",children:v.map(w=>{const k=w.kind==="image",y=w.status==="loading"?o("conversation.attachmentPreviewLoading"):w.status==="error"?o("conversation.attachmentPreviewUnavailable"):o(k?"conversation.attachmentPreviewOpen":"conversation.attachmentDownload"),S=Uq(w.fileSize),T=n.jsx("div",{className:"message-attachment-card",children:k?w.url?n.jsx("img",{className:"message-attachment-thumbnail",src:w.url,alt:w.fileName||o("conversation.attachmentPreviewAlt"),loading:"lazy"}):n.jsx("div",{className:"message-attachment-placeholder","aria-hidden":"true",children:w.status==="loading"?o("conversation.attachmentPreviewLoading"):o("conversation.attachmentPreviewUnavailable")}):n.jsxs("div",{className:"message-attachment-file-card",children:[n.jsx("div",{className:"message-attachment-file-icon","aria-hidden":"true",children:n.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[n.jsx("path",{d:"M14 2H7a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V7z"}),n.jsx("path",{d:"M14 2v5h5"}),n.jsx("path",{d:"M9 13h6"}),n.jsx("path",{d:"M9 17h6"})]})}),n.jsxs("div",{className:"message-attachment-file-meta",children:[n.jsx("strong",{title:w.fileName,children:w.fileName}),n.jsx("span",{children:S??o("conversation.fileAttachmentLabel")})]})]})});return!k&&w.url?n.jsx("a",{className:"message-attachment-button",href:w.url,download:w.fileName,"aria-label":`${w.fileName} - ${y}`,title:y,children:T},w.id):n.jsx("button",{type:"button",className:"message-attachment-button",onClick:()=>k&&w.url&&d(w.id),disabled:!w.url,"aria-label":`${w.fileName} - ${y}`,title:y,children:T},w.id)})}),g!=null&&g.url?n.jsxs("div",{className:"workbench-modal-layer message-image-modal",role:"dialog","aria-modal":"true",children:[n.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":o("conversation.attachmentPreviewClose"),onClick:()=>d(null)}),n.jsxs("div",{className:"workbench-modal-card surface-card message-image-modal-card",children:[n.jsxs("div",{className:"workbench-modal-header message-image-modal-header",children:[n.jsxs("div",{className:"workbench-modal-title-wrap",children:[n.jsx("h2",{children:o("conversation.imagePreviewTitle")}),n.jsx("p",{children:g.fileName})]}),n.jsx(zo,{"aria-label":o("conversation.attachmentPreviewClose"),onClick:()=>d(null)})]}),n.jsxs("div",{className:"message-image-modal-body",children:[n.jsx("div",{className:"message-image-modal-stage",children:n.jsx("img",{className:"message-image-modal-image",src:g.url,alt:g.fileName||o("conversation.attachmentPreviewAlt")})}),n.jsx("p",{className:"message-image-modal-hint",children:o("conversation.imagePreviewHint")})]})]})]}):null]})}function zq(){return n.jsx("div",{className:"timeline-skeleton","aria-hidden":"true",children:Array.from({length:3},(e,t)=>n.jsxs("article",{className:`timeline-skeleton-item ${t%2===0?"assistant":"user"}`,children:[n.jsx("div",{className:"timeline-skeleton-avatar"}),n.jsxs("div",{className:"timeline-skeleton-bubble",children:[n.jsx("span",{className:"timeline-skeleton-line long"}),n.jsx("span",{className:"timeline-skeleton-line medium"}),n.jsx("span",{className:"timeline-skeleton-line short"})]})]},t))})}function qq({tool:e,preview:t}){const[r,s]=p.useState(null);return p.useEffect(()=>{if(r===null)return;function i(l){l.key==="Escape"&&s(null)}return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[r]),n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"tool-call-item apply-patch-item",children:t.files.map((i,l)=>n.jsxs("button",{type:"button",className:"apply-patch-summary-row",onClick:()=>s(l),children:[n.jsx("span",{className:"apply-patch-summary-label",children:IC(i.action)}),n.jsx("span",{className:"apply-patch-summary-file",title:Qf(i),children:K6(i.nextPath??i.path)}),n.jsxs("span",{className:"apply-patch-summary-stats",children:[n.jsxs("span",{className:"apply-patch-summary-added",children:["+",i.additions]}),n.jsxs("span",{className:"apply-patch-summary-removed",children:["-",i.deletions]})]})]},EC(i,l)))}),r!==null&&typeof document<"u"?Vn.createPortal(n.jsxs("div",{className:"workbench-modal-layer apply-patch-modal",role:"dialog","aria-modal":"true",children:[n.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":o("common.close"),onClick:()=>s(null)}),n.jsxs("div",{className:"workbench-modal-card surface-card apply-patch-modal-card",children:[n.jsxs("div",{className:"workbench-modal-header",children:[n.jsxs("div",{className:"workbench-modal-title-wrap",children:[n.jsx("h2",{children:o("conversation.applyPatchDialogTitle")}),n.jsx("p",{children:o("conversation.applyPatchDialogDescription")})]}),n.jsx(zo,{onClick:()=>s(null)})]}),(()=>{const i=t.files[r];return i?n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"apply-patch-modal-totals",children:[n.jsxs("span",{className:"apply-patch-stat-pill positive",children:[o("conversation.applyPatchAddedStat")," +",i.additions]}),n.jsxs("span",{className:"apply-patch-stat-pill negative",children:[o("conversation.applyPatchRemovedStat")," -",i.deletions]})]}),n.jsxs("div",{className:"apply-patch-modal-body",children:[n.jsxs("section",{className:"apply-patch-file-panel",children:[n.jsxs("div",{className:"apply-patch-file-panel-header",children:[n.jsxs("div",{className:"apply-patch-file-panel-title",children:[n.jsx("span",{className:"apply-patch-summary-label",children:IC(i.action)}),n.jsx("strong",{children:Qf(i)})]}),n.jsxs("div",{className:"apply-patch-summary-stats",children:[n.jsxs("span",{className:"apply-patch-summary-added",children:["+",i.additions]}),n.jsxs("span",{className:"apply-patch-summary-removed",children:["-",i.deletions]})]})]}),n.jsx("div",{className:"apply-patch-diff-view",children:n.jsx("div",{className:"apply-patch-diff-scroll",children:i.lines.map((l,c)=>n.jsxs("div",{className:`apply-patch-diff-line ${Xq(l.kind)}`,children:[n.jsx("span",{className:"apply-patch-line-number",children:LC(l.oldLineNumber)}),n.jsx("span",{className:"apply-patch-line-number",children:LC(l.newLineNumber)}),n.jsx("span",{className:"apply-patch-line-content",children:l.text||" "})]},`${Qf(i)}:${c}`))})})]},EC(i,r)),e.error?n.jsxs("section",{className:"apply-patch-error-panel",children:[n.jsx("div",{className:"tool-call-section-label",children:o("conversation.toolResultLabel")}),n.jsx("pre",{className:"tool-call-error",children:e.error})]}):null]})]}):null})()]})]}),document.body):null]})}function $q({group:e}){const[t,r]=p.useState(!1),{tool:s,hasRequest:i,hasResult:l}=e,c=Pq(s.name),d=p.useMemo(()=>MB(s,null,e.updatedAt),[e.updatedAt,s]),m=p.useMemo(()=>Dq(s),[s.input,s.name]);if(m)return n.jsx(qq,{tool:s,preview:m});if(d)return n.jsx(Vq,{tool:s,snapshot:d,expanded:t,hasRequest:i,hasResult:l,onToggleExpanded:()=>{r(g=>!g)}});const f=Rq(s),v=!!(s.input||s.output||s.error);return n.jsxs("div",{className:`tool-call-item ${l?"tool-result":""}`,children:[n.jsxs("button",{type:"button",className:"tool-call-header",onClick:()=>v&&r(g=>!g),children:[n.jsxs("div",{className:"tool-call-info",children:[n.jsx("span",{className:"tool-call-name",children:c}),n.jsx("span",{className:"tool-call-input-preview",children:f})]}),n.jsx("div",{className:"tool-call-meta",children:v&&n.jsx("span",{className:`tool-call-toggle ${t?"expanded":""}`,children:n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:n.jsx("polyline",{points:"6 9 12 15 18 9"})})})})]}),t&&v&&n.jsxs("div",{className:"tool-call-output",children:[i&&s.input&&n.jsxs("div",{className:"tool-call-section",children:[n.jsx("div",{className:"tool-call-section-label",children:o("conversation.toolInputLabel")}),n.jsx("pre",{children:s.input})]}),(l||s.error||s.output)&&n.jsxs("div",{className:"tool-call-section",children:[n.jsx("div",{className:"tool-call-section-label",children:o("conversation.toolResultLabel")}),n.jsx("pre",{className:s.error?"tool-call-error":void 0,children:s.error||s.output||o("conversation.toolResultEmpty")})]})]})]})}function Vq({tool:e,snapshot:t,expanded:r,hasRequest:s,hasResult:i,onToggleExpanded:l}){const c=LD(t.items),d=o(r?"conversation.taskCardRawCollapse":"conversation.taskCardRawExpand");return n.jsxs("div",{className:"tool-call-item task-tool-item",children:[n.jsxs("div",{className:"task-tool-header",children:[n.jsxs("div",{className:"task-tool-heading",children:[n.jsx("span",{className:"task-tool-badge",children:t.source==="plan"?o("conversation.taskCardPlanTitle"):o("conversation.taskCardTodoTitle")}),n.jsxs("div",{className:"task-tool-heading-main",children:[n.jsx("strong",{children:Gq(t,e.name)}),n.jsx("span",{className:"task-tool-summary-text",children:Kq(t.items,c)})]})]}),n.jsx("button",{type:"button",className:"task-tool-raw-toggle",onClick:l,children:d})]}),n.jsx("ol",{className:"task-tool-list",children:t.items.map(m=>n.jsxs("li",{className:"task-tool-list-item","data-status":m.status,children:[n.jsx("span",{className:"task-tool-item-indicator","data-status":m.status,"aria-hidden":"true"}),n.jsx("strong",{className:"task-tool-item-title",children:m.title}),m.detail?n.jsx("span",{className:"task-tool-item-detail",children:m.detail}):null,n.jsx("span",{className:"task-tool-item-status",children:Yq(m.status)})]},m.id))}),r?n.jsxs("div",{className:"tool-call-output",children:[s&&e.input?n.jsxs("div",{className:"tool-call-section",children:[n.jsx("div",{className:"tool-call-section-label",children:o("conversation.toolInputLabel")}),n.jsx("pre",{children:e.input})]}):null,i||e.error||e.output?n.jsxs("div",{className:"tool-call-section",children:[n.jsx("div",{className:"tool-call-section-label",children:o("conversation.toolResultLabel")}),n.jsx("pre",{className:e.error?"tool-call-error":void 0,children:e.error||e.output||o("conversation.toolResultEmpty")})]}):null]}):null]})}function Gq(e,t){if(e.source==="plan")return o("conversation.taskCardPlanUpdated");const r=t.trim().toLowerCase();return r==="taskcreate"||r==="todowrite"||r==="todoread"||r.startsWith("task"),o("conversation.taskCardTodoUpdated")}function Kq(e,t){const r=[o("conversation.taskCardSummaryTotal",{count:e.length})];return t.in_progress>0&&r.push(o("conversation.taskCardSummaryInProgress",{count:t.in_progress})),t.pending>0&&r.push(o("conversation.taskCardSummaryPending",{count:t.pending})),t.completed>0&&r.push(o("conversation.taskCardSummaryCompleted",{count:t.completed})),t.failed>0&&r.push(o("conversation.taskCardSummaryFailed",{count:t.failed})),r.join(" / ")}function Yq(e){switch(e){case"in_progress":return o("conversation.taskProgressStatusInProgress");case"completed":return o("conversation.taskProgressStatusCompleted");case"failed":return o("conversation.taskProgressStatusFailed");case"cancelled":return o("conversation.taskProgressStatusCancelled");case"pending":default:return o("conversation.taskProgressStatusPending")}}function IC(e){return o(e==="add"?"conversation.applyPatchAddedLabel":e==="delete"?"conversation.applyPatchDeletedLabel":"conversation.applyPatchEditedLabel")}function Qf(e){return e.nextPath&&e.nextPath!==e.path?`${e.path} -> ${e.nextPath}`:e.nextPath??e.path}function EC(e,t){return`${e.path}:${e.nextPath??""}:${t}`}function Xq(e){return e==="add"?"is-added":e==="remove"?"is-removed":e==="hunk"?"is-hunk":e==="meta"?"is-meta":"is-context"}function LC(e){return e===null||e<=0?"":String(e)}function Qq(e){return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function uR({timestamp:e,leading:t,children:r}){return n.jsxs("div",{className:"user-message-footer",children:[n.jsx("div",{className:"user-message-footer-leading",children:t}),n.jsxs("div",{className:"user-message-footer-trailing",children:[n.jsx("time",{className:"message-time",dateTime:e,children:Qq(e)}),r]})]})}function Po({text:e,canCopy:t=!0,canFork:r=!1,compact:s=!1,onFork:i}){const{showToast:l}=Qn(),c=sr(),[d,m]=p.useState(!1),[f,v]=p.useState(!1),g=e.trim().length>0,w=t&&g;async function k(){if(!(!w||d)){m(!0);try{await iw(e,c),l({title:o("conversation.copyContentSuccess"),tone:"success"})}catch(S){l({title:S instanceof Error?S.message:o("conversation.copyContentFailed"),tone:"error"})}finally{m(!1)}}}async function y(){if(!(!i||f)){v(!0);try{await i()}finally{v(!1)}}}return!w&&!r?null:n.jsxs("div",{className:s?"message-metadata-bar compact":"message-metadata-bar",children:[w?n.jsx("button",{type:"button",className:"message-metadata-action","aria-label":o("conversation.copyAction"),title:o("conversation.copyAction"),onClick:()=>{k()},disabled:d,children:n.jsx(UB,{})}):null,r?n.jsx("button",{type:"button",className:"message-metadata-action","aria-label":o(f?"conversation.forkingAction":"conversation.forkFromHereAction"),title:o(f?"conversation.forkingAction":"conversation.forkFromHereAction"),onClick:()=>{y()},disabled:f,children:n.jsx(HB,{})}):null]})}function Jq({message:e,kind:t,tone:r,actionState:s,onRetry:i,onForkMessage:l}){const[c,d]=p.useState(!1),m=Lq(e.content),f=r==="user-message",v=o(t==="system_prompt"?"conversation.systemPromptTitle":"conversation.rulesMessageTitle"),g=o(t==="system_prompt"?"conversation.systemPromptHint":"conversation.rulesMessageHint"),w=o(c?t==="system_prompt"?"conversation.systemPromptCollapse":"conversation.rulesMessageCollapse":t==="system_prompt"?"conversation.systemPromptExpand":"conversation.rulesMessageExpand");return n.jsx("article",{className:`message-item ${r} rules-message-row`,"data-message-id":e.id,children:n.jsxs("div",{className:"message-content-wrapper",children:[n.jsxs("div",{className:"rules-message-card",children:[n.jsxs("button",{type:"button",className:"rules-message-toggle","aria-expanded":c,onClick:()=>d(k=>!k),children:[n.jsxs("div",{className:"rules-message-heading",children:[n.jsx("span",{className:"rules-message-badge",children:v}),n.jsx("span",{className:"rules-message-summary",children:m})]}),n.jsx("span",{className:"rules-message-action",children:w})]}),n.jsx("p",{className:"rules-message-hint",children:g}),c&&n.jsx("div",{className:"rules-message-body",children:n.jsx(Hc,{content:e.content,className:"message-text message-content markdown-content"})}),f?n.jsx(uR,{timestamp:e.timestamp,children:n.jsx(Po,{text:e.content,canCopy:s.canCopy,canFork:s.canFork&&!!(l&&e.deliveryState==="sent"),compact:!0,onFork:l?()=>l(e):null})}):n.jsx(Po,{text:e.content,canCopy:s.canCopy,canFork:s.canFork&&!!(l&&e.deliveryState==="sent"),onFork:l?()=>l(e):null})]}),e.deliveryState==="failed"&&e.clientRequestId&&n.jsx("button",{className:"retry-button",type:"button",onClick:()=>i(e.clientRequestId),children:o("conversation.resendButton")})]})})}function Zq({message:e,provider:t,interruptedSource:r=null,foldedPromptKind:s=null,actionState:i,onRetry:l,onForkMessage:c,assistantAvatar:d}){const m=e.role==="user",f=e.kind==="thinking",v=e.role==="assistant"&&e.kind==="text",g=t==="codex"&&e.kind==="text"?bq(e.content):null,w=s??(Eq(t,e.content)?"rules":null),k=p.useMemo(()=>Oo(e.content),[e.content]),y=k.text,S=k.inlineImages,[T,j]=p.useState(!1),[N,D]=p.useState(!1),[H,B]=p.useState(null),[I,A]=p.useState(null);if(w){const L=e.role==="user"?"user-message":e.role==="assistant"?"assistant-message":"system-message";return n.jsx(Jq,{message:e,kind:w,tone:L,actionState:i,onRetry:l,onForkMessage:c})}if(g){const L=vq(r),_=g.detail?`${L}
|
|
111
|
-
|
|
112
|
-
${g.detail}`:L;return n.jsxs("article",{className:"message-item assistant-message","data-message-id":e.id,children:[n.jsx("div",{className:"message-avatar",children:d??n.jsx(Jf,{})}),n.jsxs("div",{className:"message-content-wrapper",children:[n.jsx(Hc,{content:_,className:"message-text message-content markdown-content"}),n.jsx(Po,{text:_,canCopy:i.canCopy,canFork:!1,onFork:null})]})]})}if(m){const L=e.origin==="butler_proxy"||e3(e.clientRequestId),_=e.origin==="butler_proxy"&&typeof e.originRef=="string"&&e.originRef.trim().length>0;async function F(){if(!_)return;const E=!T;if(j(E),!(!E||I||N)){D(!0),B(null);try{const se=await XP(e.originRef);A(se.task)}catch(se){B(se instanceof Error?se.message:o("conversation.butlerOriginDetailLoadFailed"))}finally{D(!1)}}}const te=L?_?n.jsxs("div",{className:"message-origin-detail-anchor",children:[n.jsx("button",{type:"button",className:"message-origin-badge message-origin-badge-button","aria-expanded":T,onClick:()=>{F()},children:o("conversation.butlerProxyMessageBadge")}),T?n.jsxs("div",{className:"message-origin-detail-popover",role:"dialog","aria-live":"polite",children:[n.jsx("strong",{children:o("conversation.butlerOriginDetailTitle")}),N?n.jsx("p",{children:o("conversation.butlerOriginDetailLoading")}):H?n.jsx("p",{children:H}):I?n.jsxs(n.Fragment,{children:[n.jsxs("p",{children:[o("conversation.butlerOriginDetailObjectiveLabel"),":",I.objective]}),n.jsxs("p",{children:[o("conversation.butlerOriginDetailStatusLabel"),":",t3(I.status)]}),n.jsxs("p",{children:[o("conversation.butlerOriginDetailSummaryLabel"),":",I.lastAutomationSummary||o("conversation.butlerAnalysisEmpty")]}),I.waitingReason?n.jsxs("p",{children:[o("conversation.butlerOriginDetailWaitingReasonLabel"),":",I.waitingReason]}):null]}):n.jsx("p",{children:o("conversation.butlerAnalysisEmpty")})]}):null]}):n.jsx("span",{className:"message-origin-badge",children:o("conversation.butlerProxyMessageBadge")}):null;return n.jsx("article",{className:"message-item user-message","data-message-id":e.id,children:n.jsxs("div",{className:"message-content-wrapper",children:[n.jsx(Qd,{sessionId:e.sessionId,attachments:e.attachments,attachmentPayloads:e.attachmentPayloads,inlineImages:S}),y?n.jsx(Hc,{content:y,className:"message-text message-content markdown-content"}):null,e.deliveryState==="failed"&&e.clientRequestId&&n.jsx("button",{className:"retry-button",type:"button",onClick:()=>l(e.clientRequestId),children:o("conversation.resendButton")}),n.jsx(uR,{timestamp:e.timestamp,leading:te,children:n.jsx(Po,{text:y,canCopy:i.canCopy,canFork:i.canFork&&!!(c&&e.deliveryState==="sent"),compact:!0,onFork:c?()=>c(e):null})})]})})}return f?n.jsxs("article",{className:"message-item assistant-message thinking-message-row","data-message-id":e.id,children:[n.jsx("div",{className:"message-avatar",children:d??n.jsx(Jf,{})}),n.jsxs("div",{className:"thinking-message-content",children:[n.jsx("div",{className:"thinking-message-label",children:o("conversation.thinkingLabel")}),n.jsx(Qd,{sessionId:e.sessionId,attachments:e.attachments,attachmentPayloads:e.attachmentPayloads,inlineImages:S}),y&&n.jsx(Hc,{content:y,className:"message-text message-content markdown-content thinking-message-text"}),n.jsx(Po,{text:y,canCopy:i.canCopy,canFork:i.canFork&&!!(c&&e.deliveryState==="sent"),onFork:c?()=>c(e):null})]})]}):v?n.jsxs("article",{className:"message-item assistant-message","data-message-id":e.id,children:[n.jsx("div",{className:"message-avatar",children:d??n.jsx(Jf,{})}),n.jsxs("div",{className:"message-content-wrapper",children:[n.jsx(Qd,{sessionId:e.sessionId,attachments:e.attachments,attachmentPayloads:e.attachmentPayloads,inlineImages:S}),y&&n.jsx(Hc,{content:y,className:"message-text message-content markdown-content"}),n.jsx(Po,{text:y,canCopy:i.canCopy,canFork:i.canFork&&!!(c&&e.deliveryState==="sent"),onFork:c?()=>c(e):null})]})]}):n.jsx("article",{className:"message-item system-message","data-message-id":e.id,children:n.jsxs("div",{className:"message-content-wrapper",children:[n.jsx(Qd,{sessionId:e.sessionId,attachments:e.attachments,attachmentPayloads:e.attachmentPayloads,inlineImages:S}),y?n.jsx("div",{className:"message-text message-content",children:n.jsx(cR,{language:"text",content:y})}):null,n.jsx(Po,{text:y,canCopy:i.canCopy,canFork:i.canFork&&!!(c&&e.deliveryState==="sent"),onFork:c?()=>c(e):null})]})})}function Jf(){return n.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("path",{d:"M12 16v-4M12 8h.01"})]})}function e3(e){return typeof e=="string"&&e.startsWith("butler-follow-up:")}function t3(e){switch(e){case"waiting_user":return o("shell.butlerAutomationStatusWaitingUser");case"completed":return o("shell.butlerAutomationStatusCompleted");case"failed":return o("shell.butlerAutomationStatusFailed");case"cancelled":return o("shell.butlerAutomationStatusCancelled");case"active":default:return o("shell.butlerAutomationStatusActive")}}function Im({sessionId:e="session",messages:t,historyState:r,loadingOlderMessages:s=!1,hasOlderMessages:i=!1,onLoadOlderMessages:l=()=>{},onRetryMessage:c,onForkMessage:d,provider:m,interruptedSource:f=null,runtimeThinkingPlaceholder:v=null,assistantAvatar:g}){var vt;const{showToast:w}=Qn(),k=p.useRef(null),y=p.useRef(e),S=p.useRef(0),T=p.useRef(null),j=p.useRef(!0),N=p.useRef(null),D=p.useRef(null),H=p.useRef(!1),B=p.useRef(Xd(e)),I=p.useRef(((vt=Xd(e))==null?void 0:vt.lastMessageSignature)??null),A=p.useRef(Xd(e)),L=p.useRef(null),_=p.useRef(null),F=p.useRef(null),te=p.useRef(0),E=p.useRef(!1),[se,X]=p.useState(!1),[K,G]=p.useState(!1),q=p.useRef(!1),U=Iq(t),Q=p.useMemo(()=>Fq(t,m),[t,m]),P=p.useMemo(()=>n3(t),[t]),W=r==="loading"&&t.length===0;function J(Te){const we=Te.scrollHeight-Te.clientHeight-Te.scrollTop<=PC;return{scrollTop:Te.scrollTop,stickToBottom:we,lastMessageSignature:q.current&&!we?I.current:jl(t.at(-1)??null)}}function R(Te){return A.current=J(Te),A.current}function ve(Te){const _e=Te.scrollHeight-Te.clientHeight-Te.scrollTop,we=_e<=PC;j.current=we,we&&q.current&&(Xe(),q.current=!1,I.current=jl(t.at(-1)??null),G(!1)),X(t.length>0&&(_e>DC||q.current)),R(Te)}function pe(Te=k.current){Te&&R(Te),A.current&&NC(e,A.current)}function Y(Te){A.current&&NC(Te,A.current)}function Se(){L.current!==null&&(window.clearTimeout(L.current),L.current=null)}function Le(){Se(),L.current=window.setTimeout(()=>{L.current=null,pe()},yq)}function re(Te){Te.scrollTop=Te.scrollHeight}function Ce(){_.current!==null&&(window.clearTimeout(_.current),_.current=null)}function Xe(){Ce(),E.current=!1,F.current=null,te.current=0}function Ue(Te,_e){const we=Math.max(0,Te.scrollHeight-Te.clientHeight),qe=Math.max(0,Math.min(_e,we));Te.scrollTop=qe,j.current=!1,X(t.length>0&&(we-qe>DC||q.current))}function ct(){Ce(),E.current&&(_.current=window.setTimeout(()=>{_.current=null;const Te=k.current,_e=F.current;if(!Te||_e===null){Xe();return}if(Ue(Te,_e),Date.now()<te.current){ct();return}Xe(),ve(Te)},kq))}function Nt(Te,_e){E.current=!0,F.current=Te,te.current=Date.now()+xq,Ue(_e,Te),ct()}function Ke(Te){return H.current||!i||s||r!=="ready"||Te.scrollTop>wq?!1:(H.current=!0,N.current=Te.scrollHeight-Te.scrollTop,D.current=jl(t[0]??null),l(),!0)}p.useEffect(()=>{r==="error"&&w({title:o("conversation.historyLoadFailed"),tone:"error"})},[r,w]),p.useLayoutEffect(()=>{var Te,_e;y.current!==e&&(Y(y.current),y.current=e,S.current=0,T.current=null,B.current=Xd(e),I.current=((Te=B.current)==null?void 0:Te.lastMessageSignature)??null,A.current=B.current,j.current=((_e=B.current)==null?void 0:_e.stickToBottom)??!0,N.current=null,D.current=null,Xe(),q.current=!1,G(!1),X(!1))},[e]),p.useLayoutEffect(()=>()=>{Se(),Xe(),Y(y.current)},[e]),p.useLayoutEffect(()=>{const Te=k.current,_e=jl(t.at(-1)??null);if(!Te){S.current=t.length,T.current=_e;return}const we=S.current,qe=T.current,ke=B.current;if(ke&&r==="ready"){const Pe=!ke.stickToBottom&&ke.lastMessageSignature!==null&&_e!==null&&ke.lastMessageSignature!==_e;ke.stickToBottom?(Xe(),re(Te)):Nt(ke.scrollTop,Te),q.current=Pe,I.current=ke.lastMessageSignature,G(Pe),B.current=null,ve(Te),S.current=t.length,T.current=_e,R(Te);return}if(ke&&r==="error"){ke.stickToBottom?(Xe(),re(Te)):Nt(ke.scrollTop,Te),B.current=null,ve(Te),S.current=t.length,T.current=_e,R(Te);return}if(E.current){Ue(Te,F.current??Te.scrollTop),S.current=t.length,T.current=_e,R(Te);return}const Ee=jl(t[0]??null),$e=N.current,wt=D.current;$e!==null&&!s&&wt!==null&&wt!==Ee&&t.length>=we?(Te.scrollTop=Math.max(0,Te.scrollHeight-$e),N.current=null,D.current=null):N.current!==null&&!s?(N.current=null,D.current=null):j.current&&(we===0||t.length!==we||_e!==qe)&&re(Te),ve(Te),S.current=t.length,T.current=_e},[r,s,t,e]),p.useEffect(()=>{if(!i){H.current=!1;return}!s&&N.current===null&&(H.current=!1)},[i,s,t.length]);function ut(){const Te=k.current;Te&&(ve(Te),Le(),Ke(Te))}return n.jsxs("section",{className:"message-timeline",children:[r==="loading"&&n.jsx("div",{className:"timeline-status",children:n.jsx("span",{className:"status-text",children:o("conversation.historyLoading")})}),n.jsxs("div",{ref:k,className:"message-list",onScroll:ut,children:[W?n.jsx(zq,{}):null,s?n.jsx("div",{className:"timeline-status timeline-status-inline",children:n.jsx("span",{className:"status-text",children:o("conversation.historyLoadingOlder")})}):null,U.length===0&&r==="ready"&&n.jsx("div",{className:"timeline-empty",children:n.jsx("p",{className:"status-text",children:o("conversation.timelineEmpty")})}),U.map(Te=>Te.type==="tool_group"?n.jsx("article",{className:"message-item tool-message-row",children:n.jsx($q,{group:Te.group})},Te.key):n.jsx(Zq,{message:Te.message,provider:m,foldedPromptKind:Q.has(Te.message.id)?"system_prompt":null,actionState:P.get(Te.message.id)??{canCopy:Te.message.role==="user",canFork:!1},onRetry:c,onForkMessage:d,interruptedSource:f,assistantAvatar:g},Te.key)),v?n.jsx("div",{className:"timeline-status timeline-status-inline thinking-status-inline",children:n.jsxs("span",{className:"status-text thinking-status-text","aria-label":v,children:[n.jsx("span",{children:gq(v)||v}),n.jsx("span",{className:"thinking-status-dots","aria-hidden":"true",children:"..."})]})}):null]}),se?n.jsxs("button",{type:"button",className:"conversation-scroll-to-bottom-button","data-has-new":K?"true":"false","aria-label":o("conversation.scrollToBottomAction"),title:o("conversation.scrollToBottomAction"),onClick:()=>{const Te=k.current;Te&&(Xe(),re(Te),q.current=!1,I.current=jl(t.at(-1)??null),G(!1),ve(Te),pe(Te))},children:[K?n.jsx("span",{className:"conversation-scroll-to-bottom-button-badge",children:"NEW"}):null,n.jsx("svg",{className:"conversation-scroll-to-bottom-button-icon",viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",children:n.jsx("path",{d:"M10 4.25a.75.75 0 0 1 .75.75v7.19l2.72-2.72a.75.75 0 1 1 1.06 1.06l-4 4a.75.75 0 0 1-1.06 0l-4-4a.75.75 0 1 1 1.06-1.06l2.72 2.72V5a.75.75 0 0 1 .75-.75Zm-4 11a.75.75 0 0 1 0-1.5h8a.75.75 0 0 1 0 1.5H6Z",fill:"currentColor"})})]}):null]})}function jl(e){return e?JSON.stringify({id:e.id,content:e.content,attachments:e.attachments,timestamp:e.timestamp,deliveryState:e.deliveryState,toolCall:e.toolCall?{status:e.toolCall.status,output:e.toolCall.output,error:e.toolCall.error}:null}):null}function n3(e){const t=new Map;let r=0;function s(i){let l=null;for(let c=i-1;c>=r;c-=1){const d=e[c];if(!(!d||!r3(d))){l=d.id;break}}for(let c=r;c<i;c+=1){const d=e[c];if(d){if(d.role==="user"){t.set(d.id,{canCopy:!0,canFork:!1});continue}t.set(d.id,{canCopy:d.id===l,canFork:d.id===l})}}}for(let i=0;i<e.length;i+=1){const l=e[i];l&&l.role==="user"&&i>r&&(s(i),r=i)}return s(e.length),t}function r3(e){return e.role==="user"?!1:e.kind!=="tool_call"&&e.kind!=="tool_result"}function dR(){return n.jsxs("section",{className:"butler-loading-panel",role:"status","aria-live":"polite",children:[n.jsxs("div",{className:"butler-loading-orb","aria-hidden":"true",children:[n.jsx("span",{className:"butler-loading-ring butler-loading-ring-primary"}),n.jsx("span",{className:"butler-loading-ring butler-loading-ring-secondary"}),n.jsx("span",{className:"butler-loading-core"})]}),n.jsxs("div",{className:"butler-loading-copy",children:[n.jsx("h1",{children:o("shell.butlerLoadingTitle")}),n.jsx("p",{children:o("shell.butlerLoadingDescription")})]})]})}const FC="butler:records-updated";function aw(e){if(typeof window>"u")return()=>{};const t=()=>{e()};return window.addEventListener(FC,t),()=>{window.removeEventListener(FC,t)}}class hR{constructor(t){Ze(this,"socket",null);Ze(this,"disposed",!1);Ze(this,"authRecoveryInFlight",!1);Ze(this,"latestCursor");Ze(this,"subscribed",!1);Ze(this,"pendingOlderRequest",null);Ze(this,"inFlightOlderRequest",null);Ze(this,"connectionManager");this.options=t,this.latestCursor=t.cursor,this.connectionManager=new iP({onReconnect:r=>{this.connect(r)},onStateChange:t.onConnectionChange})}start(){this.connectionManager.start()}updateCursor(t){this.latestCursor=t}reconnectNow(){this.connectionManager.reconnectNow()}requestOlderMessages(t,r){return!this.socket||this.socket.readyState!==WebSocket.OPEN?!1:this.subscribed?(this.sendOlderMessagesRequest(t,r),!0):(this.pendingOlderRequest={cursor:t,limit:r},!0)}close(){var t;this.disposed=!0,this.subscribed=!1,this.pendingOlderRequest=null,this.inFlightOlderRequest=null,this.connectionManager.close(),(t=this.socket)==null||t.close(),this.socket=null}connect(t){var l;if(this.disposed)return;t&&this.socket&&(this.socket.close(),this.socket=null);const r=(l=nr.getState().session)==null?void 0:l.accessToken;if(!r){this.options.onUnauthorized();return}const s=`${QT("/ws")}?access_token=${encodeURIComponent(r)}`,i=new WebSocket(s);this.subscribed=!1,this.socket=i,i.addEventListener("open",()=>{i.send(JSON.stringify({type:"session.subscribe",sessionId:this.options.sessionId,cursor:this.latestCursor,limit:this.options.limit}))}),i.addEventListener("message",c=>{const d=JSON.parse(c.data);if(d.type==="system.connected"){this.connectionManager.markConnected();return}if(d.type==="session.subscribed"){this.subscribed=!0,this.options.onSubscribed(),this.flushPendingOlderRequest();return}if(d.type==="session.error"){if(this.clearOlderMessagesRequest(),d.error_code==="UNAUTHORIZED"){this.handleUnauthorized();return}this.options.onError(d);return}if(d.type==="session.runtime_status"){this.options.onRuntimeStatus(d);return}if(d.type==="session.activity"){this.options.onActivity(d);return}if(d.type==="session.history_older"){this.clearOlderMessagesRequest(),this.options.onOlderHistory(d);return}if(d.type==="session.runtime_message"){this.options.onRuntimeMessage(d);return}if(d.type==="session.runtime_error"){this.options.onRuntimeError(d);return}if(d.type==="session.interrupted"){this.options.onInterrupted(d);return}if(d.type==="session.permission_request"){this.options.onPermissionRequest(d);return}if(d.type==="session.permission_request_resolved"){this.options.onPermissionRequestResolved(d);return}this.latestCursor=d.cursor,this.options.onEnvelope(d)}),i.addEventListener("close",()=>{this.disposed||this.socket!==i||(this.subscribed=!1,this.requeueInFlightOlderRequest(),this.connectionManager.markDisconnected())}),i.addEventListener("error",()=>{this.disposed||this.socket!==i||this.connectionManager.markTransientFailure()})}handleUnauthorized(){if(this.authRecoveryInFlight||this.disposed)return;this.authRecoveryInFlight=!0,this.subscribed=!1,this.requeueInFlightOlderRequest();const t=this.socket;this.socket=null,t==null||t.close(),nr.refresh().then(r=>{if(this.authRecoveryInFlight=!1,!this.disposed){if(r.status==="refreshed"){this.connectionManager.reconnectNow();return}if(r.status==="deferred"){this.connectionManager.markDisconnected();return}this.options.onUnauthorized()}})}sendOlderMessagesRequest(t,r){var s;this.inFlightOlderRequest={cursor:t,limit:r},(s=this.socket)==null||s.send(JSON.stringify({type:"session.load_older",sessionId:this.options.sessionId,cursor:t,limit:r}))}flushPendingOlderRequest(){if(!this.pendingOlderRequest)return;const t=this.pendingOlderRequest;this.pendingOlderRequest=null,this.sendOlderMessagesRequest(t.cursor,t.limit)}clearOlderMessagesRequest(){this.pendingOlderRequest=null,this.inFlightOlderRequest=null}requeueInFlightOlderRequest(){this.inFlightOlderRequest&&(this.pendingOlderRequest=this.inFlightOlderRequest,this.inFlightOlderRequest=null)}}function _C(e){return{session:(e==null?void 0:e.session)??null,capabilities:(e==null?void 0:e.capabilities)??null,runtimeHasActiveRun:(e==null?void 0:e.runtimeHasActiveRun)??null,runtimeCanInterrupt:(e==null?void 0:e.runtimeCanInterrupt)??null,contextUsage:(e==null?void 0:e.contextUsage)??null,messages:(e==null?void 0:e.messages)??[],permissionRequests:(e==null?void 0:e.permissionRequests)??[],queuedMessages:(e==null?void 0:e.queuedMessages)??[],historyState:"idle",loadingOlderMessages:!1,olderCursor:(e==null?void 0:e.olderCursor)??null,hasOlderMessages:(e==null?void 0:e.hasOlderMessages)??!1,connectionState:"closed",lastCursor:(e==null?void 0:e.lastCursor)??null,pagesLoaded:(e==null?void 0:e.pagesLoaded)??0,interruptSource:(e==null?void 0:e.interruptSource)??null,errorCode:null,errorDetail:null}}function Em(e,t,r="sent",s=null){const i=t.kind??(t.role==="tool"?"tool_result":"text"),l=t.toolCall??(i==="tool_call"||i==="tool_result"?{callId:t.rawRef||t.messageId,name:"tool",input:i==="tool_call"?t.content:"",output:i==="tool_result"&&t.content?t.content:null,error:null,status:i==="tool_call"?"running":"completed"}:null);return{id:t.messageId,sessionId:e,role:t.role,kind:i,content:t.content,toolCall:l,attachments:t.attachments??[],attachmentPayloads:null,origin:t.origin??null,originRef:t.originRef??null,timestamp:t.timestamp,sequence:t.sequence,rawRef:t.rawRef,deliveryState:r,clientRequestId:s}}function mR(e,t,r,s=[],i=[],l=Number.MAX_SAFE_INTEGER){return{id:`pending-${r}`,sessionId:e,role:"user",kind:"text",content:t,toolCall:null,attachments:s,attachmentPayloads:i,origin:null,originRef:null,timestamp:new Date().toISOString(),sequence:l,rawRef:`pending://${r}`,deliveryState:"sending",clientRequestId:r}}function Dc(e,t,r){const s=new Map;for(const i of e)s.set(i.id,i);for(const i of r){const l=Em(t,i),c=R3(s,l);if(c&&c!==l.id)continue;const d=D3(s,l);d&&d!==l.id&&s.delete(d);const m=s.get(i.messageId)??null;s.set(i.messageId,m?h3(m,l):l)}return pR(Array.from(s.values()))}function OC(e,t,r,s){const i=s===null?null:e.find(m=>m.clientRequestId===s)??null,l=e.filter(m=>m.clientRequestId!==s),c=Em(t,r,"sent",s),d=d3(c,i);return pR([...l.filter(m=>m.id!==d.id),d])}function Sb(e,t){return e.map(r=>r.clientRequestId===t?{...r,deliveryState:"failed"}:r)}function s3(e){const t=[];for(const r of e){const s=t.at(-1);if(!s||!fR(s,r)){t.push(r);continue}t[t.length-1]=v3(s,r)}return t}function i3(e){const t=[];for(const r of e){if(!p3(r)){t.push(r);continue}let s=t.length-1;for(;s>=0&&f3(t[s]);)s-=1;const i=s>=0?t[s]:null;if(!i||!fR(i,r)){t.push(r);continue}t[s]=w3(i,r)}return t}function a3(e){const t=[];let r=null,s=!1;for(const i of e)if(!g3(r,i,s)){if(t.push(i),hu(i)){r=i,s=!1;continue}r&&Cb(i)&&(s=!0)}return t}function o3(e){const t=[];for(const r of e){const s=t.at(-1);if(!s||!gR(s,r)){t.push(r);continue}t[t.length-1]=bR(s,r)}return t}function l3(e){const t=[];for(const r of e){if(t.push(r),t.length<4)continue;const s=t[t.length-4],i=t[t.length-3],l=t[t.length-2],c=t[t.length-1];b3(s,i,l,c)&&t.splice(t.length-3,3,bR(i,c))}return t}function c3(e){const t=[];for(const r of e){const s=t.at(-1);if(!s||!y3(s,r)){t.push(r);continue}t[t.length-1]=x3(s,r)}return t}function u3(e){const t=[];for(const r of e){const s=t.findIndex(i=>k3(i,r));if(s===-1){t.push(r);continue}t[s]=S3(t[s],r)}return t}function pR(e){const t=[...e].sort((r,s)=>r.sequence!==s.sequence?r.sequence-s.sequence:r.timestamp.localeCompare(s.timestamp));return u3(c3(a3(l3(o3(i3(s3(t)))))))}function d3(e,t){if(!t||!m3(t,e))return e;const r=e.attachments??[];return{...e,sequence:t.sequence,timestamp:t.timestamp,attachments:r.length>0?r:t.attachments??[],attachmentPayloads:t.attachmentPayloads??null}}function h3(e,t){if(e.id!==t.id)return t;if(e.role!==t.role||e.kind!==t.kind||e.rawRef!==t.rawRef)return mu(e,t);const r=C3(e.toolCall,t.toolCall),s=T3(e.content,t.content,e.timestamp,t.timestamp),i=N3(e.attachments,t.attachments);return{...mu(e,t),content:s,toolCall:r,attachments:i,attachmentPayloads:e.attachmentPayloads??t.attachmentPayloads??null,timestamp:e.timestamp.localeCompare(t.timestamp)>=0?e.timestamp:t.timestamp,sequence:Math.max(e.sequence,t.sequence)}}function m3(e,t){return Lm(e)&&t.role==="user"&&t.kind==="text"&&e.sequence>t.sequence}function fR(e,t){if(e.deliveryState!=="sent"||t.deliveryState!=="sent"||!e.rawRef.startsWith("codex://")||!t.rawRef.startsWith("codex://")||e.role!==t.role||e.kind!==t.kind||e.toolCall!==null||t.toolCall!==null||e.kind!=="text"&&e.kind!=="thinking")return!1;const r=Oo(e.content),s=Oo(t.content);return Vl(e.timestamp,t.timestamp,30*1e3)&&rr(r.text)===rr(s.text)&&P3(r.inlineImages,s.inlineImages)}function p3(e){return e.deliveryState==="sent"&&e.rawRef.startsWith("codex://")&&e.role==="assistant"&&(e.kind==="text"||e.kind==="thinking")&&e.toolCall===null}function f3(e){return e.deliveryState==="sent"&&e.rawRef.startsWith("codex://")&&(e.kind==="tool_call"||e.kind==="tool_result")}function g3(e,t,r){return!e||r||!hu(e)||!hu(t)?!1:Vl(e.timestamp,t.timestamp,120*1e3)&&rr(e.content)===rr(t.content)}function hu(e){return e.deliveryState==="sent"&&e.rawRef.startsWith("opencode://")&&e.role==="user"&&e.kind==="text"}function Cb(e){return e.deliveryState==="sent"&&e.rawRef.startsWith("opencode://")&&e.role==="assistant"&&e.kind==="text"}function gR(e,t){return Cb(e)&&Cb(t)&&Vl(e.timestamp,t.timestamp,120*1e3)&&rr(e.content)===rr(t.content)}function b3(e,t,r,s){return!e||!t||!r||!s||!hu(e)||!hu(r)?!1:gR(t,s)&&Vl(e.timestamp,r.timestamp,120*1e3)&&rr(e.content)===rr(r.content)}function bR(e,t){var c,d;const r=((c=e.attachments)==null?void 0:c.length)??0,s=((d=t.attachments)==null?void 0:d.length)??0;if(r!==s)return r>s?e:t;const i=rr(e.content).length,l=rr(t.content).length;return i!==l?i>l?e:t:mu(e,t)}function v3(e,t){var m,f;const r=((m=e.attachments)==null?void 0:m.length)??0,s=((f=t.attachments)==null?void 0:f.length)??0;if(r!==s)return r>s?e:t;const i=Oo(e.content).inlineImages.length,l=Oo(t.content).inlineImages.length;if(i!==l)return i>l?e:t;const c=e.content!==rr(e.content),d=t.content!==rr(t.content);return c!==d?c?t:e:t}function w3(e,t){var m,f;const r=((m=e.attachments)==null?void 0:m.length)??0,s=((f=t.attachments)==null?void 0:f.length)??0;if(r!==s)return r>s?e:t;const i=Oo(e.content).inlineImages.length,l=Oo(t.content).inlineImages.length;if(i!==l)return i>l?e:t;const c=e.content!==rr(e.content),d=t.content!==rr(t.content);return c!==d&&c?t:e}function y3(e,t){return!BC(e)||!BC(t)?!1:e.role===t.role&&Vl(e.timestamp,t.timestamp,120*1e3)&&rr(e.content)===rr(t.content)}function k3(e,t){return!WC(e)||!WC(t)?!1:e.role===t.role&&Vl(e.timestamp,t.timestamp,120*1e3)&&rr(e.content)===rr(t.content)}function BC(e){return e.deliveryState==="sent"&&e.rawRef.startsWith("gemini://session/")&&e.kind==="text"&&e.toolCall===null&&(e.role==="user"||e.role==="assistant")}function WC(e){return e.deliveryState==="sent"&&e.rawRef.startsWith("kimi://session/")&&e.kind==="text"&&e.toolCall===null&&(e.role==="user"||e.role==="assistant")}function x3(e,t){var m,f;const r=((m=e.attachments)==null?void 0:m.length)??0,s=((f=t.attachments)==null?void 0:f.length)??0;if(r!==s)return r>s?e:t;const i=rr(e.content).length,l=rr(t.content).length;if(i!==l)return i>l?e:t;const c=e.rawRef.includes("#file="),d=t.rawRef.includes("#file=");return c!==d?c?e:t:mu(e,t)}function S3(e,t){var m,f;const r=((m=e.attachments)==null?void 0:m.length)??0,s=((f=t.attachments)==null?void 0:f.length)??0;if(r!==s)return r>s?e:t;const i=rr(e.content).length,l=rr(t.content).length;if(i!==l)return i>l?e:t;const c=e.rawRef.includes("/context#"),d=t.rawRef.includes("/context#");return c!==d?c?e:t:mu(e,t)}function C3(e,t){return e?t?{...j3(e,t),input:vR(e.input,t.input),output:HC(e.output,t.output),error:HC(e.error,t.error)}:e:t}function j3(e,t){const r=UC(e.status),s=UC(t.status);return s!==r?s>r?t:e:t}function UC(e){return e==="running"?0:1}function T3(e,t,r,s){const i=rr(e),l=rr(t);return i===l?e.length>=t.length?e:t:i.length>l.length&&i.includes(l)?e:l.length>i.length&&l.includes(i)||s.localeCompare(r)>=0?t:e}function N3(e,t){const r=(e==null?void 0:e.length)??0,s=(t==null?void 0:t.length)??0;return s!==r?s>r?t:e:t??e}function vR(e,t){return t.length>e.length?t:e}function HC(e,t){return e===null?t:t===null?e:vR(e,t)}function mu(e,t){return t.timestamp!==e.timestamp?t.timestamp.localeCompare(e.timestamp)>=0?t:e:t.sequence!==e.sequence?t.sequence>=e.sequence?t:e:t}function rr(e){return e.replace(/\r\n/g,`
|
|
113
|
-
`).trimEnd()}function P3(e,t){return e.length===0||t.length===0?!0:e.length!==t.length?!1:e.every((r,s)=>{var i;return r.url===((i=t[s])==null?void 0:i.url)})}function D3(e,t){return yR(t)?wR(e,t,"optimistic"):null}function R3(e,t){return Lm(t)?wR(e,t,"authoritative"):null}function wR(e,t,r){const s=sm(t.timestamp),i=rr(t.content);let l=null,c=Number.POSITIVE_INFINITY;for(const[d,m]of e.entries()){if(!(r==="optimistic"?Lm(m):yR(m))||rr(m.content)!==i)continue;const v=sm(m.timestamp),g=Math.abs(v-s);g>300*1e3||g<c&&(l=d,c=g)}return l}function Lm(e){return e.role!=="user"||e.kind!=="text"||e.deliveryState==="failed"?!1:e.rawRef.startsWith("pending://")||e.rawRef.startsWith("synthetic://")||e.rawRef.includes("#synthetic")}function yR(e){return e.role==="user"&&e.kind==="text"&&!Lm(e)}function sm(e){const t=Date.parse(e);return Number.isFinite(t)?t:0}function A3(e){return e.reduce((r,s)=>Number.isFinite(s.sequence)&&s.sequence>r?s.sequence:r,0)+1}function Vl(e,t,r){return Math.abs(sm(e)-sm(t))<=r}const zC=60,M3=400,kR="butler-diagnostic://";class xR{constructor(t){Ze(this,"state");Ze(this,"listeners",new Set);Ze(this,"realtimeClient",null);Ze(this,"realtimeSessionId",null);Ze(this,"selectedControlSessionId",null);Ze(this,"controlSessionReloadInFlight",!1);Ze(this,"terminalSyncTimer",null);Ze(this,"terminalSyncArmed",!1);Ze(this,"terminalSyncCompletedControlSessionId",null);Ze(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));Ze(this,"getState",()=>this.state);this.workspaceId=t,this.state={loading:!0,sending:!1,switchingProvider:!1,initialized:!1,profile:null,activeProvider:"codex",controlSession:null,capabilities:Tl("codex"),overview:null,events:[],messages:[],historyState:"idle",runtimeHasActiveRun:null,runtimeCanInterrupt:null,contextUsage:null,error:null}}async initialize(){this.patch({loading:!0,error:null});try{const t=await wm();if(!t.initialized||!t.profile){this.patch({loading:!1,initialized:!1,profile:null,activeProvider:"codex",capabilities:Tl("codex"),controlSession:null,messages:[],historyState:"idle",overview:null,events:[],runtimeHasActiveRun:null,runtimeCanInterrupt:null,contextUsage:null});return}const r=t.profile;this.patch({initialized:!0,profile:r,activeProvider:r.providerId,capabilities:Tl(r.providerId)}),await this.reloadForProvider(r.providerId),this.patch({loading:!1})}catch(t){this.patch({loading:!1,error:Oi(t)})}}async initializeProfile(t){this.patch({loading:!0,error:null});try{const r=await fO(t);if(!r.initialized||!r.profile)throw new Error("BUTLER_PROFILE_INIT_FAILED");this.patch({initialized:!0,profile:r.profile,activeProvider:r.profile.providerId,capabilities:Tl(r.profile.providerId)}),await this.reloadForProvider(r.profile.providerId)}catch(r){throw this.patch({error:Oi(r)}),r}finally{this.patch({loading:!1})}}async switchProvider(t){if(!this.state.initialized||!this.state.profile||this.state.activeProvider===t)return;const r={activeProvider:this.state.activeProvider,profile:this.state.profile,controlSession:this.state.controlSession,capabilities:this.state.capabilities,overview:this.state.overview,events:this.state.events,messages:this.state.messages,historyState:this.state.historyState,runtimeHasActiveRun:this.state.runtimeHasActiveRun,runtimeCanInterrupt:this.state.runtimeCanInterrupt,contextUsage:this.state.contextUsage};this.patch({switchingProvider:!0,error:null,activeProvider:t,controlSession:null,messages:[],historyState:"idle",overview:null,events:[],runtimeHasActiveRun:null,runtimeCanInterrupt:null,contextUsage:null,capabilities:Tl(t)});try{const s=await Hx({providerId:t});if(!s.initialized||!s.profile)throw new Error("BUTLER_PROFILE_UPDATE_FAILED");this.patch({initialized:!0,profile:s.profile,activeProvider:s.profile.providerId}),await Promise.all([this.refreshCapabilities(s.profile.providerId),this.refreshOverview(),this.refreshEvents()]),await this.startFreshSession({preserveSwitchingState:!0})}catch(s){throw this.patch({...r,error:Oi(s)}),s}finally{this.patch({switchingProvider:!1})}}async updateProfile(t){if(!(!this.state.initialized||!this.state.profile)){this.patch({loading:!0,error:null});try{const r=await Hx(t);if(!r.initialized||!r.profile)throw new Error("BUTLER_PROFILE_UPDATE_FAILED");this.patch({initialized:!0,profile:r.profile,activeProvider:r.profile.providerId})}catch(r){throw this.patch({error:Oi(r)}),r}finally{this.patch({loading:!1})}}}async sendMessage(t,r){const s=t.trim();if(!(!s||!this.state.initialized)){this.patch({sending:!0,error:null});try{const i=this.state.controlSession;if(i){const l=await yO({controlSessionId:i.id,content:s,model:(r==null?void 0:r.model)??null,reasoningLevel:(r==null?void 0:r.reasoningLevel)??null,permissionMode:(r==null?void 0:r.permissionMode)??null});this.selectedControlSessionId=l.controlSession.id,this.patch({controlSession:l.controlSession})}else{const l=await wO({content:s,model:(r==null?void 0:r.model)??null,reasoningLevel:(r==null?void 0:r.reasoningLevel)??null,permissionMode:(r==null?void 0:r.permissionMode)??null});this.selectedControlSessionId=l.controlSession.id,this.patch({controlSession:l.controlSession})}await this.reloadControlSession(this.selectedControlSessionId),await Promise.all([this.refreshOverview(),this.refreshEvents()])}catch(i){throw this.patch({error:Oi(i)}),i}finally{this.patch({sending:!1})}}}async retryMessage(t){const r=this.state.messages.find(s=>s.clientRequestId===t);!r||!r.content.trim()||await this.sendMessage(r.content)}async interrupt(){var r;const t=((r=this.state.controlSession)==null?void 0:r.session.sessionId)??null;t&&(await TP(t),this.patch({runtimeHasActiveRun:!1,runtimeCanInterrupt:!1}))}async startFreshSession(t){if(this.state.initialized){this.teardownRealtime(),this.selectedControlSessionId=null,this.terminalSyncArmed=!1,this.terminalSyncCompletedControlSessionId=null,this.patch({sending:!1,error:null,controlSession:null,messages:[],historyState:"ready",runtimeHasActiveRun:null,runtimeCanInterrupt:null,contextUsage:null});try{await vO()}catch(r){throw this.patch({historyState:"error",error:Oi(r)}),r}this.patch({switchingProvider:t!=null&&t.preserveSwitchingState?this.state.switchingProvider:!1})}}async refreshAll(){if(this.state.initialized){this.patch({loading:!0,error:null});try{await this.reloadForProvider(this.state.activeProvider)}finally{this.patch({loading:!1})}}}async reloadEventsAndOverview(){this.state.initialized&&await Promise.all([this.refreshOverview(),this.refreshEvents()])}async reloadForProvider(t){Ft("butler.runtime.reload_for_provider.start",{workspaceId:this.workspaceId,providerId:t,selectedControlSessionId:this.selectedControlSessionId}),await Promise.all([this.refreshCapabilities(t),this.refreshOverview(),this.refreshEvents()]),await this.reloadControlSession(this.selectedControlSessionId),Ft("butler.runtime.reload_for_provider.end",{workspaceId:this.workspaceId,providerId:t,selectedControlSessionId:this.selectedControlSessionId})}async openControlSession(t){this.selectedControlSessionId=t.trim()||null,await this.reloadControlSession(this.selectedControlSessionId)}async adoptControlSession(t){this.selectedControlSessionId=t.id,this.patch({controlSession:t}),await this.reloadControlSession(t.id)}async reloadControlSession(t){var i,l,c,d;const r=((i=this.state.controlSession)==null?void 0:i.id)??null,s=this.state.historyState==="ready"&&r!==null&&(t==null||t===r);Ft("butler.runtime.reload_control_session.start",{workspaceId:this.workspaceId,requestedControlSessionId:t??null,currentControlSessionId:r,currentSessionId:((c=(l=this.state.controlSession)==null?void 0:l.session)==null?void 0:c.sessionId)??null,currentMessages:this.state.messages.length,currentHistoryState:this.state.historyState,backgroundReload:s}),s||this.patch({historyState:"loading"});try{const f=(t?await bO(t):await gO()).controlSession;if(!f){this.selectedControlSessionId=null,this.terminalSyncArmed=!1,this.terminalSyncCompletedControlSessionId=null,this.teardownRealtime(),this.patch({controlSession:null,messages:[],historyState:"ready",runtimeHasActiveRun:null,runtimeCanInterrupt:null,contextUsage:null}),Ft("butler.runtime.reload_control_session.empty",{workspaceId:this.workspaceId,requestedControlSessionId:t??null});return}this.selectedControlSessionId=f.id;const[v,g]=await Promise.all([Pv(f.session.sessionId,null,zC,"forward"),tb(f.session.sessionId)]);((d=this.state.controlSession)==null?void 0:d.id)!==f.id&&(this.terminalSyncCompletedControlSessionId=null),this.terminalSyncArmed=g.hasActiveRun||f.status==="running",g.hasActiveRun?this.terminalSyncCompletedControlSessionId=null:this.terminalSyncArmed||(this.terminalSyncCompletedControlSessionId=f.id);const w=v.messages.map(k=>Em(f.session.sessionId,k));this.ensureRealtimeSubscription(f.session.sessionId,v.cursor),this.patch({controlSession:f,messages:$C(w,f,{runningState:g.runningState,runtimeHasActiveRun:g.hasActiveRun,runtimeCanInterrupt:g.canInterrupt,detail:g.detail,errorDetail:g.errorDetail,updatedAt:g.updatedAt}),historyState:"ready",runtimeHasActiveRun:g.hasActiveRun,runtimeCanInterrupt:g.canInterrupt,contextUsage:g.contextUsage}),Ft("butler.runtime.reload_control_session.end",{workspaceId:this.workspaceId,controlSessionId:f.id,sessionId:f.session.sessionId,messages:w.length,historyState:"ready",hasActiveRun:g.hasActiveRun,canInterrupt:g.canInterrupt,terminalSyncArmed:this.terminalSyncArmed,terminalSyncCompletedControlSessionId:this.terminalSyncCompletedControlSessionId})}catch(m){this.patch({historyState:"error",error:Oi(m)}),Ft("butler.runtime.reload_control_session.error",{workspaceId:this.workspaceId,requestedControlSessionId:t??null,message:Oi(m)})}}async refreshCapabilities(t){try{const r=await zl(t,this.workspaceId);this.patch({capabilities:r})}catch{this.patch({capabilities:Tl(t)})}}async refreshOverview(){try{const t=await ym();this.patch({overview:t.overview})}catch(t){this.patch({error:Oi(t)})}}async refreshEvents(){try{const t=await kO();this.patch({events:t.items})}catch(t){this.patch({error:Oi(t)})}}patch(t){this.state={...this.state,...t},this.emit()}emit(){for(const t of this.listeners)t()}ensureRealtimeSubscription(t,r){if(this.realtimeClient&&this.realtimeSessionId===t){this.realtimeClient.updateCursor(r),Ft("butler.runtime.realtime.reuse",{workspaceId:this.workspaceId,sessionId:t,cursor:r});return}this.teardownRealtime(),this.realtimeSessionId=t,Ft("butler.runtime.realtime.subscribe",{workspaceId:this.workspaceId,sessionId:t,cursor:r}),this.realtimeClient=new hR({sessionId:t,cursor:r,limit:zC,onConnectionChange:()=>{},onSubscribed:()=>{},onEnvelope:s=>{this.handleRealtimeMessages(s.sessionId,s.messages)},onOlderHistory:s=>{this.handleRealtimeMessages(s.sessionId,s.messages)},onRuntimeMessage:s=>{this.handleRealtimeRuntimeMessage(s)},onActivity:s=>{this.handleRealtimeActivity(s)},onRuntimeStatus:s=>{this.handleRealtimeStatus(s)},onRuntimeError:s=>{this.handleRealtimeRuntimeError(s)},onInterrupted:s=>{this.handleRealtimeInterrupted(s)},onPermissionRequest:()=>{},onPermissionRequestResolved:()=>{},onError:s=>{this.isActiveControlSession(s.sessionId??null)&&this.patch({error:s.detail})},onUnauthorized:()=>{this.patch({error:o("common.unauthorized")})}}),this.realtimeClient.start()}teardownRealtime(){var t;this.clearTerminalSyncTimer(),this.realtimeSessionId&&Ft("butler.runtime.realtime.teardown",{workspaceId:this.workspaceId,sessionId:this.realtimeSessionId}),(t=this.realtimeClient)==null||t.close(),this.realtimeClient=null,this.realtimeSessionId=null}clearTerminalSyncTimer(){this.terminalSyncTimer!==null&&(window.clearTimeout(this.terminalSyncTimer),this.terminalSyncTimer=null)}scheduleTerminalSessionSync(t,r){var s;this.clearTerminalSyncTimer(),Ft("butler.runtime.terminal_sync.scheduled",{workspaceId:this.workspaceId,controlSessionId:((s=this.state.controlSession)==null?void 0:s.id)??null,reason:t,...r}),this.terminalSyncTimer=window.setTimeout(()=>{var i,l,c;if(this.terminalSyncTimer=null,this.controlSessionReloadInFlight){Ft("butler.runtime.terminal_sync.skipped_inflight",{workspaceId:this.workspaceId,controlSessionId:((i=this.state.controlSession)==null?void 0:i.id)??null,reason:t,...r});return}this.controlSessionReloadInFlight=!0,this.terminalSyncCompletedControlSessionId=((l=this.state.controlSession)==null?void 0:l.id)??null,Ft("butler.runtime.terminal_sync.start",{workspaceId:this.workspaceId,controlSessionId:((c=this.state.controlSession)==null?void 0:c.id)??null,reason:t,...r}),this.reloadControlSession().finally(()=>{var d;this.controlSessionReloadInFlight=!1,Ft("butler.runtime.terminal_sync.end",{workspaceId:this.workspaceId,controlSessionId:((d=this.state.controlSession)==null?void 0:d.id)??null,reason:t,...r})})},M3)}handleRealtimeMessages(t,r){var i,l,c;if(!this.isActiveControlSession(t)){Ft("butler.runtime.realtime.messages.ignored",{workspaceId:this.workspaceId,sessionId:t,incoming:r.length,activeSessionId:((i=this.state.controlSession)==null?void 0:i.session.sessionId)??null});return}const s=I3(this.state.messages,t,r);this.patch({messages:$C(s,this.state.controlSession,{runningState:((l=this.state.controlSession)==null?void 0:l.session.runningState)??"idle",runtimeHasActiveRun:this.state.runtimeHasActiveRun??!1,runtimeCanInterrupt:this.state.runtimeCanInterrupt??!1,detail:null,errorDetail:this.state.error,updatedAt:((c=this.state.controlSession)==null?void 0:c.updatedAt)??new Date().toISOString()}),historyState:"ready"}),Ft("butler.runtime.realtime.messages",{workspaceId:this.workspaceId,sessionId:t,incoming:r.length,messages:s.length})}handleRealtimeRuntimeMessage(t){this.handleRealtimeMessages(t.sessionId,[t.message])}handleRealtimeActivity(t){var i;if(!this.isActiveControlSession(t.sessionId))return;t.hasActiveRun&&(this.terminalSyncArmed=!0,this.terminalSyncCompletedControlSessionId=null);const r=((i=this.state.controlSession)==null?void 0:i.id)??null,s=!t.hasActiveRun&&this.terminalSyncArmed&&r!==null&&this.terminalSyncCompletedControlSessionId!==r;Ft("butler.runtime.realtime.activity",{workspaceId:this.workspaceId,sessionId:t.sessionId,hasActiveRun:t.hasActiveRun,canInterrupt:t.canInterrupt,updatedAt:t.updatedAt,shouldSyncTerminalState:s,terminalSyncArmed:this.terminalSyncArmed,terminalSyncCompletedControlSessionId:this.terminalSyncCompletedControlSessionId}),this.patch({runtimeHasActiveRun:t.hasActiveRun,runtimeCanInterrupt:t.canInterrupt}),s&&this.scheduleTerminalSessionSync("activity_terminal",{sessionId:t.sessionId,updatedAt:t.updatedAt})}handleRealtimeStatus(t){var c;if(!this.isActiveControlSession(t.sessionId))return;const r=t.status==="starting"||t.status==="running";r&&(this.terminalSyncArmed=!0,this.terminalSyncCompletedControlSessionId=null);const s=t.status==="completed"||t.status==="failed"||t.status==="interrupted",i=((c=this.state.controlSession)==null?void 0:c.id)??null,l=s&&!r&&this.terminalSyncArmed&&i!==null&&this.terminalSyncCompletedControlSessionId!==i;Ft("butler.runtime.realtime.status",{workspaceId:this.workspaceId,sessionId:t.sessionId,status:t.status,timestamp:t.timestamp,shouldSyncTerminalState:l,terminalSyncArmed:this.terminalSyncArmed,terminalSyncCompletedControlSessionId:this.terminalSyncCompletedControlSessionId}),this.patch({runtimeHasActiveRun:r,runtimeCanInterrupt:r?!0:this.state.runtimeCanInterrupt}),l&&this.scheduleTerminalSessionSync("status_terminal",{sessionId:t.sessionId,status:t.status,timestamp:t.timestamp})}handleRealtimeRuntimeError(t){this.isActiveControlSession(t.sessionId)&&(Ft("butler.runtime.realtime.error",{workspaceId:this.workspaceId,sessionId:t.sessionId,detail:t.detail,errorCode:t.error_code}),this.patch({error:t.detail,runtimeHasActiveRun:!1}),this.reloadControlSession())}handleRealtimeInterrupted(t){this.isActiveControlSession(t.sessionId)&&(Ft("butler.runtime.realtime.interrupted",{workspaceId:this.workspaceId,sessionId:t.sessionId,detail:t.detail}),this.patch({runtimeHasActiveRun:!1,runtimeCanInterrupt:!1,error:t.detail}),this.reloadControlSession())}isActiveControlSession(t){var r;return!!(t&&((r=this.state.controlSession)==null?void 0:r.session.sessionId)===t)}}function Kn(e,t){const[r,s]=p.useState(()=>t(e.getState()));return p.useEffect(()=>(s(t(e.getState())),e.subscribe(()=>{s(t(e.getState()))})),[t,e]),r}function Tl(e){const t=[{id:"provider-default",name:o("conversation.modelUseCliDefault"),usesProviderDefault:!0}];return{provider:e,canStartSession:!0,canResumeSession:!0,canSendMessage:!0,inRunInputMode:e==="claude-code"?"streaming_guidance":"none",supportsSubagents:!1,supportsInterrupt:!0,supportsStructuredToolCalls:!0,supportsTokenUsage:!0,supportsAttachments:!1,supportsPermissionPrompt:!0,supportsCheckpoint:!1,supportsQueueWhileRunning:!1,supportsRunSteering:!1,supportsSlashMenu:!1,supportsReasoningSelector:!0,modelOptions:t,defaultReasoningLevel:null,limitations:[]}}function I3(e,t,r){const s=new Map;for(const i of e.filter(l=>!SR(l)))s.set(qC(i),i);for(const i of r){const l=Em(t,i);s.set(qC(l),l)}return[...s.values()].sort((i,l)=>i.sequence!==l.sequence?i.sequence-l.sequence:i.timestamp.localeCompare(l.timestamp))}function qC(e){return e.id||e.rawRef}function $C(e,t,r){const s=e.filter(l=>!SR(l));if(s.length>0||!t)return s;const i=E3(t,r);return i?[...s,L3(t,i,r.updatedAt)]:s}function E3(e,t){var d,m,f;if(t.runtimeHasActiveRun)return null;const r=t.runningState,s=e.status==="failed"||r==="failed";if(!(s||r==="completed"||r==="interrupted"||r==="idle"&&e.status!=="running"))return null;const l=((d=e.lastSummary)==null?void 0:d.trim())||((m=t.errorDetail)==null?void 0:m.trim())||((f=t.detail)==null?void 0:f.trim())||null,c=[s?"本轮助手会话已结束,但没有收到可展示的助手消息。":"本轮助手会话已结束,但 provider 没有返回可展示的助手消息。"];return l&&(c.push(""),c.push(`诊断信息:${l}`)),c.join(`
|
|
114
|
-
`)}function L3(e,t,r){const s=Number.isFinite(e.session.messageCount)?e.session.messageCount:0;return{id:`butler-diagnostic-${e.id}`,sessionId:e.session.sessionId,role:"system",kind:"text",content:t,toolCall:null,attachments:[],attachmentPayloads:null,origin:"system",originRef:e.id,timestamp:r??e.updatedAt,sequence:s+1,rawRef:`${kR}${e.id}`,deliveryState:"sent",clientRequestId:null}}function SR(e){return e.rawRef.startsWith(kR)}function Oi(e){return e instanceof Error?e.message:String(e)}const jb={"risk-first":["risk","blocker","verification"],"blocker-first":["blocker","risk","verification"],"verification-first":["verification","risk","blocker"],"progress-first":["progress","risk","blocker"]},CR=300,F3={displayName:"",providerId:"codex",agentsMode:"inline",personaTone:"direct",personaLanguage:"zh-CN",personaSummaryStyle:"brief",focusRiskPreference:"conservative",reportPriorityPreset:"risk-first"},Zf={displayName:"",agentsMode:"inline",agentsFilePath:"",agentsContent:"",personaTone:"direct",personaLanguage:"zh-CN",personaSummaryStyle:"brief",focusRiskPreference:"conservative",reportPriorityPreset:"risk-first",summaryDebounceSeconds:CR},_3=[{value:60,labelKey:"shell.butlerSummaryDebounceOption1Minute"},{value:180,labelKey:"shell.butlerSummaryDebounceOption3Minutes"},{value:300,labelKey:"shell.butlerSummaryDebounceOption5Minutes"},{value:600,labelKey:"shell.butlerSummaryDebounceOption10Minutes"},{value:900,labelKey:"shell.butlerSummaryDebounceOption15Minutes"},{value:1800,labelKey:"shell.butlerSummaryDebounceOption30Minutes"}],ca={builder:["🧠","🤖","🦾","🛠️","⚙️","🧩","🚀","🛰️","🔧","💡"],analyst:["🦉","🧭","🔍","📚","🧪","📐","🗂️","📝","🧮","📊"],direct:["🦅","🛡️","⚡","🎯","🪓","🧱","🔨","📌","🧰","🏹"],steady:["🐢","🐘","🦬","🦫","🌲","⛰️","🪨","🧺","🧷","🕰️"],friendly:["🐼","🦊","🐻","🐶","🐱","🐹","🐰","🦄","🌼","🍀"],default:["🧠","🤖","🦉","🧩","📚","💡","🛠️","🚀","🌟","🪄","🧭","🔮"]};function O3(e){if(typeof document>"u")return!1;const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly","true"),t.style.position="fixed",t.style.opacity="0",t.style.pointerEvents="none",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy")}catch{return!1}finally{document.body.removeChild(t)}}async function B3(e){var t;if(typeof navigator<"u"&&((t=navigator.clipboard)!=null&&t.writeText))try{await navigator.clipboard.writeText(e);return}catch{}if(!O3(e))throw new Error(o("conversation.copyContentFailed"))}function W3(){var gt,nt,yt,rt;const{workspaceId:e=""}=Ho(),t=fr(),{showToast:r}=Qn(),{requestNavigationRefresh:s,setAuxiliaryPanel:i}=Mr(),l=p.useRef(null),c=p.useRef(null),[d,m]=p.useState(F3),[f,v]=p.useState(!1),[g,w]=p.useState(Zf),[k,y]=p.useState(!1),[S,T]=p.useState(0),[j,N]=p.useState([]),[D,H]=p.useState([]),[B,I]=p.useState([]),[A,L]=p.useState([]),[_,F]=p.useState(!1),[te,E]=p.useState(!1),[se,X]=p.useState(!1),[K,G]=p.useState(null),[q,U]=p.useState(null),[Q,P]=p.useState(!1),[W,J]=p.useState(null),[R,ve]=p.useState({itemId:null,kind:null});(!l.current||c.current!==e)&&(l.current=new xR(e),c.current=e);const pe=l.current,Y=Kn(pe,oe=>oe.loading),Se=Kn(pe,oe=>oe.sending),Le=Kn(pe,oe=>oe.switchingProvider),re=Kn(pe,oe=>oe.initialized),Ce=Kn(pe,oe=>oe.profile),Xe=Kn(pe,oe=>oe.activeProvider),Ue=Kn(pe,oe=>oe.controlSession),ct=Kn(pe,oe=>oe.capabilities),Nt=Kn(pe,oe=>oe.overview),Ke=Kn(pe,oe=>oe.events),ut=Kn(pe,oe=>oe.messages),vt=Kn(pe,oe=>oe.historyState),Te=Kn(pe,oe=>oe.runtimeHasActiveRun),_e=Kn(pe,oe=>oe.runtimeCanInterrupt),we=Kn(pe,oe=>oe.contextUsage),qe=Kn(pe,oe=>oe.error),ke=p.useRef(null),Ee=((gt=Ce==null?void 0:Ce.displayName)==null?void 0:gt.trim())||d.displayName.trim()||o("shell.butlerEntry"),$e=p.useMemo(()=>m$({displayName:Ee,providerId:(Ce==null?void 0:Ce.providerId)??d.providerId,tone:(Ce==null?void 0:Ce.persona.tone)??d.personaTone}),[Ee,d.personaTone,d.providerId,Ce==null?void 0:Ce.persona.tone,Ce==null?void 0:Ce.providerId]),wt=p.useMemo(()=>D.filter(oe=>TR(oe.status)).slice(0,3),[D]),me=p.useMemo(()=>((Nt==null?void 0:Nt.projects)??[]).map(oe=>oe.id).sort(),[Nt==null?void 0:Nt.projects]),Pe=p.useCallback(async()=>{if(!re){L([]);return}try{const oe=await nb();L(oe.items)}catch(oe){r({title:o("shell.butlerSidebarLoadFailed"),description:oe instanceof Error?oe.message:void 0,tone:"error"})}},[re,r]),Ge=p.useCallback(()=>{E(!0)},[]),dt=p.useCallback(()=>{X(!0),Pe()},[Pe]),Ye=p.useCallback(oe=>{w(Ne=>({...Ne,...oe}))},[]),Dt=p.useCallback(async oe=>{E(!1),G(oe),U(null),J(null),P(!0);try{const Ne=await XP(oe);U(Ne.task)}catch(Ne){J(Ne instanceof Error?Ne.message:o("shell.butlerAutomationRoundLoadFailed"))}finally{P(!1)}},[]),ae=p.useCallback(async oe=>{ve({itemId:oe.id,kind:"analyze"});try{const Ne=await TO(oe.id);N(Lt=>VC(Lt,Ne.item)),L(Lt=>s$(Lt,Ne.controlSession)),await pe.adoptControlSession(Ne.controlSession),r({title:o("shell.butlerTodoAnalyzeQueued"),tone:"success"})}catch(Ne){r({title:o("shell.butlerTodoAnalyzeFailed"),description:Ne instanceof Error?Ne.message:void 0,tone:"error"})}finally{ve({itemId:null,kind:null})}},[r]),We=p.useCallback(async oe=>{ve({itemId:oe.id,kind:"start"});try{const Ne=await NO(oe.id);N(Lt=>VC(Lt,Ne.item)),Ne.followUpTask&&H(Lt=>r$(Lt,Ne.followUpTask)),s(),r({title:o("shell.butlerTodoStartSessionSucceeded"),tone:"success"}),t(Yn(Ne.item.workspaceId,Ne.session.sessionId))}catch(Ne){r({title:o("shell.butlerTodoStartSessionFailed"),description:Ne instanceof Error?Ne.message:void 0,tone:"error"})}finally{ve({itemId:null,kind:null})}},[t,s,r]),jt=p.useCallback(oe=>{var Lt;const Ne=(Lt=oe.assistantState.linkedSessionId)==null?void 0:Lt.trim();Ne&&t(Yn(oe.workspaceId,Ne))},[t]),Rt=p.useCallback(async oe=>{var Lt;const Ne=(Lt=oe.assistantState.generatedPrompt)==null?void 0:Lt.trim();if(Ne)try{await B3(Ne),r({title:o("shell.butlerTodoCopyPromptSucceeded"),tone:"success"})}catch(Wt){r({title:Wt instanceof Error?Wt.message:o("conversation.copyContentFailed"),tone:"error"})}},[r]),cn=p.useCallback(async()=>{if(Ce){if(!g.displayName.trim()){r({title:o("shell.butlerInitNameRequired"),tone:"warning"});return}y(!0);try{await pe.updateProfile({displayName:g.displayName.trim(),agentsMode:g.agentsMode,agentsFilePath:g.agentsMode==="file"?g.agentsFilePath:null,agentsContent:g.agentsContent,persona:{tone:g.personaTone,language:g.personaLanguage,summaryStyle:g.personaSummaryStyle},focus:{...Ce.focus,riskPreference:g.focusRiskPreference,reportPriority:jb[g.reportPriorityPreset],summaryDebounceSeconds:g.summaryDebounceSeconds}}),r({title:o("shell.butlerSettingsSaved"),tone:"success"})}catch(oe){r({title:o("shell.butlerSettingsSaveFailed"),description:oe instanceof Error?oe.message:void 0,tone:"error"})}finally{y(!1)}}},[Ce,g,r,pe]);p.useEffect(()=>{pe.initialize()},[pe]),p.useEffect(()=>{var Ne,Lt;const oe=JSON.stringify({workspaceId:e,activeProvider:Xe,controlSessionId:(Ue==null?void 0:Ue.id)??null,sessionId:((Ne=Ue==null?void 0:Ue.session)==null?void 0:Ne.sessionId)??null,messages:ut.length,historyState:vt,runtimeHasActiveRun:Te,runtimeCanInterrupt:_e,loading:Y,sending:Se,switchingProvider:Le,error:qe});ke.current!==oe&&(ke.current=oe,Ft("butler.page.timeline_state",{workspaceId:e,activeProvider:Xe,controlSessionId:(Ue==null?void 0:Ue.id)??null,sessionId:((Lt=Ue==null?void 0:Ue.session)==null?void 0:Lt.sessionId)??null,messages:ut.length,historyState:vt,runtimeHasActiveRun:Te,runtimeCanInterrupt:_e,loading:Y,sending:Se,switchingProvider:Le,error:qe??null}))},[e,Xe,Ue==null?void 0:Ue.id,(nt=Ue==null?void 0:Ue.session)==null?void 0:nt.sessionId,ut.length,vt,Te,_e,Y,Se,Le,qe]),p.useEffect(()=>{qe&&r({title:o("shell.butlerLoadFailed"),description:qe,tone:"error"})},[qe,r]),p.useEffect(()=>{if(!Ce){w(Zf);return}w({displayName:Ce.displayName,agentsMode:Ce.agentsMode,agentsFilePath:c$(Ce),agentsContent:Ce.agentsContent,personaTone:Ce.persona.tone,personaLanguage:Ce.persona.language,personaSummaryStyle:Ce.persona.summaryStyle,focusRiskPreference:Ce.focus.riskPreference,reportPriorityPreset:l$(Ce.focus.reportPriority),summaryDebounceSeconds:Ce.focus.summaryDebounceSeconds??Zf.summaryDebounceSeconds})},[Ce]),p.useEffect(()=>{if(!re){N([]),H([]),I([]),L([]);return}let oe=!1;async function Ne(){try{const[Kt,un,En,Hn]=await Promise.all([Iu(),km(),nb(),Promise.all(me.map(jn=>YP(jn)))]);oe||(N(Kt.items),H(un.items),L(En.items),I(Hn.flatMap(jn=>jn.items)))}catch(Kt){if(oe)return;N([]),H([]),I([]),L([]),r({title:o("shell.butlerSidebarLoadFailed"),description:Kt instanceof Error?Kt.message:void 0,tone:"error"})}}Ne();function Lt(){Ne()}const Wt=window.setInterval(()=>{Ne()},15e3);return window.addEventListener(Fo,Lt),()=>{oe=!0,window.clearInterval(Wt),window.removeEventListener(Fo,Lt)}},[re,me,r]),p.useEffect(()=>aw(()=>{pe.reloadEventsAndOverview()}),[pe]);const Vt=p.useMemo(()=>[{value:"codex",label:"Codex"}],[]),Gt=p.useMemo(()=>[{value:"inline",label:o("shell.butlerAgentsModeInline")},{value:"file",label:o("shell.butlerAgentsModeFile")}],[]),pn=p.useMemo(()=>[{value:"direct",label:o("shell.butlerToneDirect")},{value:"steady",label:o("shell.butlerToneSteady")},{value:"friendly",label:o("shell.butlerToneFriendly")}],[]),ie=p.useMemo(()=>[{value:"zh-CN",label:o("shell.butlerLanguageZhCn")},{value:"en-US",label:o("shell.butlerLanguageEnUs")},{value:"bilingual",label:o("shell.butlerLanguageBilingual")}],[]),Be=p.useMemo(()=>[{value:"brief",label:o("shell.butlerSummaryBrief")},{value:"structured",label:o("shell.butlerSummaryStructured")},{value:"thorough",label:o("shell.butlerSummaryThorough")}],[]),Mt=p.useMemo(()=>[{value:"conservative",label:o("shell.butlerRiskConservative")},{value:"balanced",label:o("shell.butlerRiskBalanced")},{value:"proactive",label:o("shell.butlerRiskProactive")}],[]),Tt=p.useMemo(()=>[{value:"risk-first",label:o("shell.butlerReportRiskFirst")},{value:"blocker-first",label:o("shell.butlerReportBlockerFirst")},{value:"verification-first",label:o("shell.butlerReportVerificationFirst")},{value:"progress-first",label:o("shell.butlerReportProgressFirst")}],[]),xn=Ba(Vt,d.providerId),dn=Ba(Gt,d.agentsMode),Nn=Ba(pn,d.personaTone),Sn=Ba(ie,d.personaLanguage),Et=Ba(Be,d.personaSummaryStyle),In=Ba(Mt,d.focusRiskPreference),wn=Ba(Tt,d.reportPriorityPreset),Z=d.agentsMode==="inline"?o("shell.butlerAgentsModeInlineDescription"):o("shell.butlerAgentsModeFileDescription"),ce=[dn,Sn,In],ge=p.useMemo(()=>n.jsx(U3,{overview:Nt,events:Ke,inboxItems:j,followUpTasks:D,patrolPlans:B,settingsForm:g,savingSettings:k,onOpenFollowUpHistory:Ge,onOpenFollowUpDetail:Dt,onAnalyzeTodo:ae,onStartTodoSession:We,onOpenTodoSession:jt,onCopyTodoPrompt:Rt,todoActionState:R,onSettingsFormChange:Ye,onSaveSettings:()=>{cn()}}),[Ke,ae,Rt,Ge,D,Dt,jt,cn,Ye,We,j,Nt,B,k,g,R]);p.useEffect(()=>{if(!re){i(null);return}return i(ge),()=>{i(null)}},[re,i,ge]);async function Ie(oe){oe.preventDefault();const Ne=d.displayName.trim();if(!Ne){r({title:o("shell.butlerInitNameRequired"),tone:"warning"});return}const Lt={displayName:Ne,providerId:d.providerId,agentsMode:d.agentsMode,persona:{tone:d.personaTone,language:d.personaLanguage,summaryStyle:d.personaSummaryStyle},focus:{projectIds:[],riskPreference:d.focusRiskPreference,reportPriority:jb[d.reportPriorityPreset],summaryDebounceSeconds:CR}};v(!0);try{await pe.initializeProfile(Lt),r({title:o("shell.butlerInitSuccess"),tone:"success"})}catch(Wt){r({title:o("shell.butlerInitFailed"),description:Wt instanceof Error?Wt.message:void 0,tone:"error"})}finally{v(!1)}}async function He(oe){if(oe!==Xe)try{await pe.switchProvider(oe),ft(oe),r({title:o("shell.butlerProviderSwitched"),description:o("shell.butlerProviderSwitchedDescription",{provider:Ba(Vt,oe)}),tone:"success"})}catch(Ne){r({title:o("shell.butlerProviderSwitchFailed"),description:Ne instanceof Error?Ne.message:void 0,tone:"error"})}}async function Je(){try{ft(Xe),await pe.startFreshSession(),r({title:o("shell.butlerNewSessionStarted"),tone:"success"})}catch(oe){r({title:o("shell.butlerNewSessionFailed"),description:oe instanceof Error?oe.message:void 0,tone:"error"})}}function ft(oe){T(Ne=>Ne+1),t($i(e),{replace:!0}),oe&&s()}return Y&&!re&&!f?n.jsx("main",{className:"workbench-page butler-page-shell butler-loading-shell",children:n.jsx(dR,{})}):re?n.jsxs(n.Fragment,{children:[n.jsxs("main",{className:"workbench-page conversation-page-shell butler-page-shell butler-chat-workspace",children:[n.jsxs("header",{className:"workbench-auxiliary-header butler-main-header","data-window-drag-handle":"conversation-header",children:[n.jsx("div",{className:"butler-header-main",children:n.jsxs("div",{className:"butler-header-analysis-anchor",onMouseEnter:()=>{F(!0)},onMouseLeave:()=>{F(!1)},children:[n.jsx("div",{className:"butler-chat-avatar","aria-hidden":"true",children:n.jsx("span",{children:$e})}),n.jsx("div",{className:"butler-main-heading",children:n.jsx("h1",{tabIndex:0,onFocus:()=>{F(!0)},onBlur:()=>{F(!1)},children:Ee})}),_?n.jsxs("div",{className:"butler-header-analysis-popover",role:"status","aria-live":"polite",children:[n.jsx("strong",{children:o("conversation.butlerAnalysisTitle")}),wt.length>0?wt.map(oe=>n.jsxs("div",{className:"butler-header-analysis-item",children:[n.jsxs("p",{children:[o("conversation.butlerAnalysisObjectiveLabel"),":",oe.objective]}),n.jsxs("p",{children:[o("conversation.butlerAnalysisStatusLabel"),":",_u(oe.status)]}),n.jsxs("p",{children:[o("conversation.butlerAnalysisSummaryLabel"),":",oe.lastAutomationSummary||oe.waitingReason||o("conversation.butlerAnalysisEmpty")]})]},oe.id)):n.jsx("p",{children:o("conversation.butlerAnalysisEmpty")})]}):null]})}),n.jsxs("div",{className:"butler-toolbar-cluster",children:[n.jsx("div",{className:"butler-provider-switcher",children:n.jsx("select",{"aria-label":o("shell.butlerProviderLabel"),value:Xe,disabled:Vt.length<=1||Le||Se,onChange:oe=>{He(oe.target.value)},children:Vt.map(oe=>n.jsx("option",{value:oe.value,children:oe.label},oe.value))})}),n.jsx("button",{type:"button",className:"terminal-tab-control butler-header-icon-button","aria-label":o("shell.butlerNewSessionAction"),title:o("shell.butlerNewSessionAction"),disabled:Y||Se||Le,onClick:()=>{Je()},children:n.jsx("span",{className:"terminal-toolbar-icon","aria-hidden":"true",children:n.jsx(f$,{})})}),n.jsx("button",{type:"button",className:"terminal-tab-control butler-header-icon-button","aria-label":o("shell.butlerHistoryAction"),title:o("shell.butlerHistoryAction"),disabled:Y||Se||Le,onClick:()=>{dt()},children:n.jsx("span",{className:"terminal-toolbar-icon","aria-hidden":"true",children:n.jsx(g$,{})})})]})]}),n.jsx("section",{className:"butler-main-column",children:n.jsxs("div",{className:"butler-conversation-shell",children:[n.jsx(Im,{sessionId:(yt=Ue==null?void 0:Ue.session)==null?void 0:yt.sessionId,messages:ut,historyState:vt,loadingOlderMessages:!1,hasOlderMessages:!1,provider:Xe,assistantAvatar:n.jsx("span",{className:"butler-message-avatar","aria-hidden":"true",children:$e}),onLoadOlderMessages:()=>{},onRetryMessage:oe=>{const Ne=ut.find(Lt=>Lt.clientRequestId===oe);if(Ne!=null&&Ne.content.trim()){pe.sendMessage(Ne.content);return}pe.retryMessage(oe)}}),n.jsx("div",{className:"butler-composer-shell",children:n.jsx(Nm,{capabilities:ct,draftStorageId:`butler:${Xe}:${S}`,placeholder:o("shell.butlerComposerPlaceholder",{displayName:Ee}),hasActiveRun:Te,canInterrupt:_e,contextUsage:we,isSubmitting:Se||Le,isRunning:Te??!1,onInterrupt:async()=>{await pe.interrupt(),s()},onSend:async(oe,Ne)=>{var Lt;(((Lt=Ne==null?void 0:Ne.attachments)==null?void 0:Lt.length)??0)>0&&r({title:o("shell.butlerAttachmentUnsupported"),tone:"warning"}),await pe.sendMessage(oe,{model:(Ne==null?void 0:Ne.model)??null,reasoningLevel:(Ne==null?void 0:Ne.reasoningLevel)??null,permissionMode:null}),s()}})})]},`timeline:${Xe}:${S}`)})]}),n.jsx(Fn,{open:te,title:o("shell.butlerFollowUpHistoryTitle"),description:o("shell.butlerFollowUpHistoryDescription"),onClose:()=>{E(!1)},children:n.jsx(Y3,{tasks:D,onOpenFollowUpDetail:Dt,onClose:()=>{E(!1)}})}),n.jsx(Fn,{open:se,title:o("shell.butlerHistoryTitle"),description:o("shell.butlerHistoryDescription"),onClose:()=>{X(!1)},children:n.jsx(V3,{sessions:A,activeControlSessionId:(Ue==null?void 0:Ue.id)??null,onSelectSession:async oe=>{await pe.openControlSession(oe.id),X(!1)}})}),n.jsx(Fn,{open:K!==null,title:o("shell.butlerAutomationRoundDetailsTitle"),description:((rt=q==null?void 0:q.sessionTitle)==null?void 0:rt.trim())||(q==null?void 0:q.projectName)||o("shell.butlerAutomationRoundDetailsDescription"),onClose:()=>{G(null),U(null),J(null),P(!1)},children:n.jsx(t$,{task:q,loading:Q,error:W})})]}):n.jsxs("main",{className:"workbench-page butler-page-shell butler-init-shell",children:[n.jsxs("div",{className:"butler-init-backdrop","aria-hidden":"true",children:[n.jsx("span",{className:"butler-init-glow butler-init-glow-primary"}),n.jsx("span",{className:"butler-init-glow butler-init-glow-secondary"})]}),n.jsxs("div",{className:"butler-init-layout",children:[n.jsxs("aside",{className:"butler-init-sidebar",children:[n.jsx("section",{className:"butler-init-hero-card",children:n.jsxs("div",{className:"butler-init-hero-copy",children:[n.jsx("h1",{children:o("shell.butlerInitTitle")}),n.jsx("p",{children:o("shell.butlerInitDescription")})]})}),n.jsxs("section",{className:"butler-init-preview-card",children:[n.jsx("header",{className:"butler-init-section-header",children:n.jsx("div",{children:n.jsx("h2",{children:o("shell.butlerInitPreviewTitle")})})}),n.jsxs("div",{className:"butler-init-preview-identity",children:[n.jsxs("div",{className:"butler-init-preview-nameplate",children:[n.jsx("div",{className:"butler-chat-avatar butler-init-preview-avatar",children:n.jsx("span",{children:$e})}),n.jsx("strong",{children:Ee})]}),n.jsx("span",{className:"butler-init-preview-provider",children:xn})]}),n.jsx("div",{className:"butler-init-chip-list",children:ce.map(oe=>n.jsx("span",{className:"butler-init-chip",children:oe},oe))}),n.jsxs("div",{className:"butler-init-preview-rows",children:[n.jsxs("div",{className:"butler-init-preview-row",children:[n.jsx("span",{children:o("shell.butlerPersonaToneLabel")}),n.jsx("strong",{children:Nn})]}),n.jsxs("div",{className:"butler-init-preview-row",children:[n.jsx("span",{children:o("shell.butlerInitPreviewRuleLabel")}),n.jsx("strong",{children:dn})]}),n.jsxs("div",{className:"butler-init-preview-row",children:[n.jsx("span",{children:o("shell.butlerPersonaSummaryStyleLabel")}),n.jsx("strong",{children:Et})]}),n.jsxs("div",{className:"butler-init-preview-row",children:[n.jsx("span",{children:o("shell.butlerReportPriorityPresetLabel")}),n.jsx("strong",{children:wn})]})]})]})]}),n.jsxs("form",{className:"butler-init-form",onSubmit:Ie,children:[n.jsxs("section",{className:"butler-init-form-section",children:[n.jsx("header",{className:"butler-init-section-header",children:n.jsx("div",{children:n.jsx("h2",{children:o("shell.butlerInitBasicsTitle")})})}),n.jsxs("div",{className:"butler-init-basic-grid",children:[n.jsxs("label",{className:"butler-form-field",children:[n.jsx("span",{children:o("shell.butlerDisplayNameLabel")}),n.jsx("input",{className:"butler-form-control",value:d.displayName,onChange:oe=>m(Ne=>({...Ne,displayName:oe.target.value})),placeholder:o("shell.butlerDisplayNamePlaceholder")}),n.jsx("small",{children:o("shell.butlerDisplayNameHint")})]}),n.jsxs("label",{className:"butler-form-field",children:[n.jsx("span",{children:o("shell.butlerProviderLabel")}),n.jsx("select",{className:"butler-form-control",value:d.providerId,disabled:Vt.length<=1,onChange:oe=>m(Ne=>({...Ne,providerId:oe.target.value})),children:Vt.map(oe=>n.jsx("option",{value:oe.value,children:oe.label},oe.value))})]}),n.jsxs("label",{className:"butler-form-field butler-form-field-wide",children:[n.jsx("span",{children:o("shell.butlerAgentsModeLabel")}),n.jsx("select",{className:"butler-form-control",value:d.agentsMode,onChange:oe=>m(Ne=>({...Ne,agentsMode:oe.target.value})),children:Gt.map(oe=>n.jsx("option",{value:oe.value,children:oe.label},oe.value))}),n.jsx("small",{children:Z})]})]})]}),n.jsxs("section",{className:"butler-init-form-section",children:[n.jsx("header",{className:"butler-init-section-header",children:n.jsx("div",{children:n.jsx("h2",{children:o("shell.butlerInitPersonaTitle")})})}),n.jsxs("div",{className:"butler-init-persona-grid",children:[n.jsxs("label",{className:"butler-form-field",children:[n.jsx("span",{children:o("shell.butlerPersonaToneLabel")}),n.jsx("select",{className:"butler-form-control",value:d.personaTone,onChange:oe=>m(Ne=>({...Ne,personaTone:oe.target.value})),children:pn.map(oe=>n.jsx("option",{value:oe.value,children:oe.label},oe.value))})]}),n.jsxs("label",{className:"butler-form-field",children:[n.jsx("span",{children:o("shell.butlerPersonaLanguageLabel")}),n.jsx("select",{className:"butler-form-control",value:d.personaLanguage,onChange:oe=>m(Ne=>({...Ne,personaLanguage:oe.target.value})),children:ie.map(oe=>n.jsx("option",{value:oe.value,children:oe.label},oe.value))})]}),n.jsxs("label",{className:"butler-form-field",children:[n.jsx("span",{children:o("shell.butlerPersonaSummaryStyleLabel")}),n.jsx("select",{className:"butler-form-control",value:d.personaSummaryStyle,onChange:oe=>m(Ne=>({...Ne,personaSummaryStyle:oe.target.value})),children:Be.map(oe=>n.jsx("option",{value:oe.value,children:oe.label},oe.value))})]})]})]}),n.jsxs("section",{className:"butler-init-form-section",children:[n.jsx("header",{className:"butler-init-section-header",children:n.jsx("div",{children:n.jsx("h2",{children:o("shell.butlerInitPreferenceTitle")})})}),n.jsxs("div",{className:"butler-init-preferences-grid",children:[n.jsxs("label",{className:"butler-form-field",children:[n.jsx("span",{children:o("shell.butlerFocusRiskPreferenceLabel")}),n.jsx("select",{className:"butler-form-control",value:d.focusRiskPreference,onChange:oe=>m(Ne=>({...Ne,focusRiskPreference:oe.target.value})),children:Mt.map(oe=>n.jsx("option",{value:oe.value,children:oe.label},oe.value))})]}),n.jsxs("label",{className:"butler-form-field",children:[n.jsx("span",{children:o("shell.butlerReportPriorityPresetLabel")}),n.jsx("select",{className:"butler-form-control",value:d.reportPriorityPreset,onChange:oe=>m(Ne=>({...Ne,reportPriorityPreset:oe.target.value})),children:Tt.map(oe=>n.jsx("option",{value:oe.value,children:oe.label},oe.value))})]})]})]}),n.jsx("div",{className:"butler-init-actions",children:n.jsx("button",{className:"butler-init-submit",type:"submit",disabled:Y||f,children:o(Y||f?"shell.butlerInitSubmitting":"shell.butlerInitSubmit")})})]})]})]})}function U3(e){const[t,r]=p.useState("info"),s=[{id:"info",label:o("shell.butlerSidebarInfoTab")},{id:"automation",label:o("shell.butlerSidebarAutomationTab")},{id:"settings",label:o("shell.butlerSidebarSettingsTab")}];return n.jsxs("div",{className:"butler-side-column",children:[n.jsx("div",{className:"workbench-auxiliary-header butler-side-header",children:n.jsx("div",{className:"workbench-info-tabs butler-side-tabs",role:"tablist","aria-label":o("shell.butlerSidebarTabsLabel"),children:s.map(i=>n.jsx("button",{type:"button",role:"tab","aria-selected":t===i.id,className:t===i.id?"workbench-info-tab active":"workbench-info-tab",onClick:()=>{r(i.id)},children:i.label},i.id))})}),t==="info"?n.jsx(H3,{overview:e.overview,inboxItems:e.inboxItems,followUpTasks:e.followUpTasks,onOpenFollowUpHistory:e.onOpenFollowUpHistory,onOpenFollowUpDetail:e.onOpenFollowUpDetail,onAnalyzeTodo:e.onAnalyzeTodo,onStartTodoSession:e.onStartTodoSession,onOpenTodoSession:e.onOpenTodoSession,onCopyTodoPrompt:e.onCopyTodoPrompt,todoActionState:e.todoActionState}):t==="automation"?n.jsx(z3,{overview:e.overview,followUpTasks:e.followUpTasks,patrolPlans:e.patrolPlans}):n.jsx(J3,{settingsForm:e.settingsForm,savingSettings:e.savingSettings,onSettingsFormChange:e.onSettingsFormChange,onSaveSettings:e.onSaveSettings})]})}function H3(e){var c;const[t,r]=p.useState(!1),s=p.useMemo(()=>t?e.followUpTasks:e.followUpTasks.filter(d=>TR(d.status)),[e.followUpTasks,t]),i=p.useMemo(()=>{var d;return n$(((d=e.overview)==null?void 0:d.verifications)??[],t)},[(c=e.overview)==null?void 0:c.verifications,t]),l=p.useMemo(()=>t?e.inboxItems:e.inboxItems.filter(d=>d.status!=="closed"),[e.inboxItems,t]);return n.jsxs(n.Fragment,{children:[n.jsx("section",{className:"butler-side-card",children:n.jsxs("label",{className:"butler-record-toggle",children:[n.jsx("input",{type:"checkbox",checked:t,onChange:d=>r(d.target.checked)}),n.jsx("span",{children:o("shell.butlerInfoShowCompletedAction")})]})}),n.jsx(K3,{tasks:s,onOpenFollowUpHistory:e.onOpenFollowUpHistory,onOpenFollowUpDetail:e.onOpenFollowUpDetail}),n.jsx(q3,{title:o("shell.butlerInfoVerificationRecordsTitle"),items:i,emptyText:o("shell.butlerInfoVerificationRecordsEmpty")}),n.jsx($3,{title:o("shell.butlerInfoTodoRecordsTitle"),items:l,emptyText:o("shell.butlerInfoTodoRecordsEmpty"),todoActionState:e.todoActionState,onAnalyzeTodo:e.onAnalyzeTodo,onStartTodoSession:e.onStartTodoSession,onOpenTodoSession:e.onOpenTodoSession,onCopyTodoPrompt:e.onCopyTodoPrompt})]})}function z3(e){const t=p.useMemo(()=>Z3(e.patrolPlans,e.followUpTasks,e.overview),[e.followUpTasks,e.overview,e.patrolPlans]),r=p.useMemo(()=>e$(e.followUpTasks,e.overview),[e.followUpTasks,e.overview]);return n.jsxs(n.Fragment,{children:[n.jsx(X3,{items:t,emptyText:o("shell.butlerAutomationTasksEmpty")}),n.jsx(Q3,{items:r,emptyText:o("shell.butlerAutomationRunsEmpty")})]})}function q3(e){return n.jsxs("section",{className:"butler-side-card",children:[n.jsx("header",{children:n.jsx("h2",{children:e.title})}),e.items.length>0?n.jsx("div",{className:"butler-record-list",children:e.items.map(t=>n.jsx(G3,{title:t.title,content:t.content},`${t.title}:${t.content}`))}):n.jsx("p",{className:"butler-secondary-text",children:e.emptyText})]})}function $3(e){return n.jsxs("section",{className:"butler-side-card",children:[n.jsx("header",{children:n.jsx("h2",{children:e.title})}),e.items.length>0?n.jsx("div",{className:"butler-record-list",children:e.items.map(t=>{var d,m;const r=e.todoActionState.itemId===t.id?e.todoActionState.kind:null,s=!!((d=t.assistantState.generatedPrompt)!=null&&d.trim()),i=!!((m=t.assistantState.linkedSessionId)!=null&&m.trim()),l=t.assistantState.lifecycleStage==="analyzing",c=i||s&&!l&&t.status!=="closed";return n.jsxs("article",{className:"butler-todo-card",children:[n.jsxs("header",{className:"butler-todo-card-header",children:[n.jsxs("div",{children:[n.jsx("strong",{children:t.title}),n.jsx("span",{children:t.projectName})]}),n.jsxs("div",{className:"butler-todo-card-badges",children:[n.jsx("span",{className:"butler-inline-badge",children:u$(t.status)}),n.jsx("span",{className:"butler-inline-badge",children:a$(t.assistantState.lifecycleStage)})]})]}),n.jsx("p",{children:t.content}),n.jsx("p",{className:"butler-secondary-text",children:t.assistantState.lastError||t.assistantState.analysisSummary||o("shell.butlerTodoLifecycleEmpty")}),s?n.jsx("div",{className:"butler-todo-prompt-preview",children:n.jsxs("details",{className:"butler-todo-prompt-preview-details",children:[n.jsx("summary",{children:o("shell.butlerTodoPromptPreviewAction")}),n.jsx("pre",{children:t.assistantState.generatedPrompt})]})}):null,n.jsxs("div",{className:"butler-todo-card-actions",children:[n.jsx("button",{type:"button",className:"secondary-button",disabled:r!==null||t.status==="closed"||l,onClick:()=>{e.onAnalyzeTodo(t)},children:o(r==="analyze"||l?"shell.butlerTodoAnalyzeRunning":s?"shell.butlerTodoReanalyzeAction":"shell.butlerTodoAnalyzeAction")}),n.jsx("button",{type:"button",className:"secondary-button",disabled:r!==null||!c,onClick:()=>{if(i){e.onOpenTodoSession(t);return}e.onStartTodoSession(t)},children:o(r==="start"?"shell.butlerTodoStartSessionRunning":i?"shell.butlerTodoOpenSessionAction":l?"shell.butlerTodoWaitForPromptAction":s?"shell.butlerTodoStartSessionAction":"shell.butlerTodoAnalyzeFirstAction")}),n.jsx("button",{type:"button",className:"secondary-button",disabled:!s,onClick:()=>{e.onCopyTodoPrompt(t)},children:o("shell.butlerTodoCopyPromptAction")})]})]},t.id)})}):n.jsx("p",{className:"butler-secondary-text",children:e.emptyText})]})}function V3(e){return e.sessions.length===0?n.jsx("p",{className:"butler-secondary-text",children:o("shell.butlerHistoryEmpty")}):n.jsx("div",{className:"butler-record-list",children:e.sessions.map(t=>{var i,l,c,d,m;const r=t.id===e.activeControlSessionId,s=((i=t.title)==null?void 0:i.trim())||((l=t.session.title)==null?void 0:l.trim())||((c=t.lastSummary)==null?void 0:c.trim())||t.sessionId;return n.jsxs("article",{className:"butler-todo-card",children:[n.jsxs("header",{className:"butler-todo-card-header",children:[n.jsxs("div",{children:[n.jsx("strong",{children:s}),n.jsx("span",{children:o$(t.updatedAt)})]}),n.jsxs("div",{className:"butler-todo-card-badges",children:[n.jsx("span",{className:"butler-inline-badge",children:t.purpose==="todo_analysis"?o("shell.butlerControlSessionKindTodoAnalysis"):o("shell.butlerControlSessionKindChat")}),n.jsx("span",{className:"butler-inline-badge",children:d$(t.status)}),r?n.jsx("span",{className:"butler-inline-badge",children:o("shell.butlerCurrentSessionBadge")}):null]})]}),n.jsx("p",{className:"butler-secondary-text",children:((d=t.lastSummary)==null?void 0:d.trim())||((m=t.session.title)==null?void 0:m.trim())||t.sessionId}),n.jsx("div",{className:"butler-todo-card-actions",children:n.jsx("button",{type:"button",className:"secondary-button",disabled:r,onClick:()=>{e.onSelectSession(t)},children:o(r?"shell.butlerCurrentSessionBadge":"shell.butlerHistoryOpenAction")})})]},t.id)})})}function G3(e){return n.jsxs("div",{className:"butler-simple-info-block",children:[n.jsx("span",{children:e.title}),n.jsx("strong",{children:e.content})]})}function K3(e){const t=p.useMemo(()=>[...e.tasks].sort((r,s)=>Ar(Bo(s))-Ar(Bo(r))).slice(0,5),[e.tasks]);return n.jsxs("section",{className:"butler-side-card",children:[n.jsxs("header",{children:[n.jsx("div",{className:"butler-card-header-copy",children:n.jsx("h2",{children:o("shell.butlerInfoFollowUpRecordsTitle")})}),n.jsx("button",{type:"button",className:"secondary-button butler-side-header-action",onClick:e.onOpenFollowUpHistory,children:o("shell.butlerFollowUpHistoryAction")})]}),t.length>0?n.jsx("div",{className:"butler-record-list",children:t.map(r=>n.jsx(jR,{task:r,onOpenFollowUpDetail:e.onOpenFollowUpDetail},r.id))}):n.jsx("p",{className:"butler-secondary-text",children:o("shell.butlerInfoFollowUpRecordsEmpty")})]})}function Y3(e){const t=p.useMemo(()=>[...e.tasks].sort((r,s)=>Ar(Bo(s))-Ar(Bo(r))),[e.tasks]);return n.jsx("div",{className:"butler-follow-up-history-panel",children:t.length>0?n.jsx("div",{className:"butler-record-list",children:t.map(r=>n.jsx(jR,{task:r,onOpenFollowUpDetail:async s=>{e.onClose(),await e.onOpenFollowUpDetail(s)}},r.id))}):n.jsx("p",{className:"butler-secondary-text",children:o("shell.butlerInfoFollowUpRecordsEmpty")})})}function jR(e){var i,l,c;const{task:t}=e,r=((i=t.sessionTitle)==null?void 0:i.trim())||t.projectName,s=((l=t.waitingReason)==null?void 0:l.trim())||((c=t.lastAutomationSummary)==null?void 0:c.trim())||t.objective;return n.jsxs("article",{className:"butler-follow-up-status-card",children:[n.jsxs("header",{className:"butler-follow-up-status-header",children:[n.jsxs("div",{className:"butler-follow-up-status-title-group",children:[n.jsx("strong",{children:r}),n.jsx("span",{children:t.projectName})]}),n.jsx("span",{className:"butler-automation-status-badge","data-status":t.status,children:_u(t.status)})]}),n.jsx("div",{className:"butler-follow-up-status-body",children:n.jsx("p",{children:s})}),n.jsxs("footer",{className:"butler-follow-up-status-footer",children:[n.jsx("span",{children:Wl(Bo(t))}),n.jsx("button",{type:"button",className:"secondary-button butler-follow-up-status-action",onClick:()=>{e.onOpenFollowUpDetail(t.id)},children:o("shell.butlerAutomationViewRoundsAction")})]})]})}function X3(e){return n.jsxs("section",{className:"butler-side-card",children:[n.jsx("header",{children:n.jsx("h2",{children:o("shell.butlerAutomationTasksTitle")})}),e.items.length>0?n.jsx("div",{className:"butler-record-list",children:e.items.map(t=>n.jsxs("article",{className:"butler-automation-card",children:[n.jsxs("header",{className:"butler-automation-card-header",children:[n.jsxs("div",{className:"butler-automation-card-title-group",children:[n.jsx("strong",{children:t.title}),n.jsx("span",{children:t.projectName})]}),n.jsx("span",{className:"butler-automation-status-badge","data-status":"active",children:t.statusLabel})]}),n.jsxs("div",{className:"butler-automation-card-body",children:[n.jsxs("div",{className:"butler-automation-row",children:[n.jsx("span",{children:o("shell.butlerAutomationTaskTypeLabel")}),n.jsx("strong",{children:t.taskTypeLabel})]}),n.jsxs("div",{className:"butler-automation-row",children:[n.jsx("span",{children:o("shell.butlerAutomationTaskLastRunLabel")}),n.jsx("strong",{children:Wl(t.lastRunAt)})]})]}),n.jsxs("footer",{className:"butler-automation-card-footer",children:[n.jsx("span",{children:o("shell.butlerAutomationTaskNextRunLabel")}),n.jsx("strong",{children:Wl(t.nextRunAt)})]})]},t.id))}):n.jsx("p",{className:"butler-secondary-text",children:e.emptyText})]})}function Q3(e){return n.jsxs("section",{className:"butler-side-card",children:[n.jsx("header",{children:n.jsx("h2",{children:o("shell.butlerAutomationRunsTitle")})}),e.items.length>0?n.jsx("div",{className:"butler-record-list",children:e.items.map(t=>n.jsxs("article",{className:"butler-automation-card",children:[n.jsxs("header",{className:"butler-automation-card-header",children:[n.jsxs("div",{className:"butler-automation-card-title-group",children:[n.jsx("strong",{children:t.title}),n.jsx("span",{children:t.projectName})]}),n.jsx("span",{className:"butler-automation-status-badge","data-status":"active",children:t.statusLabel})]}),n.jsxs("div",{className:"butler-automation-card-body",children:[n.jsxs("div",{className:"butler-automation-row",children:[n.jsx("span",{children:o("shell.butlerAutomationRunSourceLabel")}),n.jsx("strong",{children:t.sourceLabel})]}),n.jsxs("div",{className:"butler-automation-row",children:[n.jsx("span",{children:o("shell.butlerAutomationRunSummaryLabel")}),n.jsx("strong",{children:t.summary})]})]}),n.jsxs("footer",{className:"butler-automation-card-footer",children:[n.jsx("span",{children:o("shell.butlerAutomationRunProcessedAtLabel")}),n.jsx("strong",{children:Wl(t.createdAt)})]})]},t.id))}):n.jsx("p",{className:"butler-secondary-text",children:e.emptyText})]})}function J3(e){return n.jsxs("section",{className:"butler-side-card butler-settings-panel",children:[n.jsx("header",{children:n.jsx("h2",{children:o("shell.butlerSettingsTitle")})}),n.jsxs("label",{className:"butler-form-field",children:[n.jsx("span",{children:o("shell.butlerDisplayNameLabel")}),n.jsx("input",{"aria-label":o("shell.butlerDisplayNameLabel"),className:"butler-form-control",value:e.settingsForm.displayName,disabled:e.savingSettings,onChange:t=>{e.onSettingsFormChange({displayName:t.target.value})}})]}),n.jsxs("label",{className:"butler-form-field",children:[n.jsx("span",{children:o("shell.butlerAgentsModeLabel")}),n.jsxs("select",{"aria-label":o("shell.butlerAgentsModeLabel"),className:"butler-form-control",value:e.settingsForm.agentsMode,disabled:e.savingSettings,onChange:t=>{e.onSettingsFormChange({agentsMode:t.target.value})},children:[n.jsx("option",{value:"inline",children:o("shell.butlerAgentsModeInline")}),n.jsx("option",{value:"file",children:o("shell.butlerAgentsModeFile")})]}),n.jsx("small",{children:e.settingsForm.agentsMode==="file"?o("shell.butlerAgentsModeFileDescription"):o("shell.butlerAgentsModeInlineDescription")})]}),e.settingsForm.agentsMode==="file"?n.jsxs("label",{className:"butler-form-field",children:[n.jsx("span",{children:o("shell.butlerAgentsFilePathLabel")}),n.jsx("input",{"aria-label":o("shell.butlerAgentsFilePathLabel"),className:"butler-form-control butler-settings-file-path",value:e.settingsForm.agentsFilePath,readOnly:!0,disabled:e.savingSettings})]}):null,n.jsxs("label",{className:"butler-form-field",children:[n.jsx("span",{children:o("shell.butlerAgentsContentLabel")}),n.jsx("textarea",{"aria-label":o("shell.butlerAgentsContentLabel"),className:"butler-form-control butler-settings-agents-editor",rows:10,value:e.settingsForm.agentsContent,disabled:e.savingSettings,placeholder:o("shell.butlerAgentsContentPlaceholder"),onChange:t=>{e.onSettingsFormChange({agentsContent:t.target.value})}}),n.jsx("small",{children:o("shell.butlerAgentsContentHint")})]}),n.jsxs("label",{className:"butler-form-field",children:[n.jsx("span",{children:o("shell.butlerPersonaToneLabel")}),n.jsxs("select",{"aria-label":o("shell.butlerPersonaToneLabel"),className:"butler-form-control",value:e.settingsForm.personaTone,disabled:e.savingSettings,onChange:t=>{e.onSettingsFormChange({personaTone:t.target.value})},children:[n.jsx("option",{value:"direct",children:o("shell.butlerToneDirect")}),n.jsx("option",{value:"steady",children:o("shell.butlerToneSteady")}),n.jsx("option",{value:"friendly",children:o("shell.butlerToneFriendly")})]})]}),n.jsxs("label",{className:"butler-form-field",children:[n.jsx("span",{children:o("shell.butlerPersonaLanguageLabel")}),n.jsxs("select",{"aria-label":o("shell.butlerPersonaLanguageLabel"),className:"butler-form-control",value:e.settingsForm.personaLanguage,disabled:e.savingSettings,onChange:t=>{e.onSettingsFormChange({personaLanguage:t.target.value})},children:[n.jsx("option",{value:"zh-CN",children:o("shell.butlerLanguageZhCn")}),n.jsx("option",{value:"en-US",children:o("shell.butlerLanguageEnUs")}),n.jsx("option",{value:"bilingual",children:o("shell.butlerLanguageBilingual")})]})]}),n.jsxs("label",{className:"butler-form-field",children:[n.jsx("span",{children:o("shell.butlerPersonaSummaryStyleLabel")}),n.jsxs("select",{"aria-label":o("shell.butlerPersonaSummaryStyleLabel"),className:"butler-form-control",value:e.settingsForm.personaSummaryStyle,disabled:e.savingSettings,onChange:t=>{e.onSettingsFormChange({personaSummaryStyle:t.target.value})},children:[n.jsx("option",{value:"brief",children:o("shell.butlerSummaryBrief")}),n.jsx("option",{value:"structured",children:o("shell.butlerSummaryStructured")}),n.jsx("option",{value:"thorough",children:o("shell.butlerSummaryThorough")})]})]}),n.jsxs("label",{className:"butler-form-field",children:[n.jsx("span",{children:o("shell.butlerFocusRiskPreferenceLabel")}),n.jsxs("select",{"aria-label":o("shell.butlerFocusRiskPreferenceLabel"),className:"butler-form-control",value:e.settingsForm.focusRiskPreference,disabled:e.savingSettings,onChange:t=>{e.onSettingsFormChange({focusRiskPreference:t.target.value})},children:[n.jsx("option",{value:"conservative",children:o("shell.butlerRiskConservative")}),n.jsx("option",{value:"balanced",children:o("shell.butlerRiskBalanced")}),n.jsx("option",{value:"proactive",children:o("shell.butlerRiskProactive")})]})]}),n.jsxs("label",{className:"butler-form-field",children:[n.jsx("span",{children:o("shell.butlerReportPriorityPresetLabel")}),n.jsxs("select",{"aria-label":o("shell.butlerReportPriorityPresetLabel"),className:"butler-form-control",value:e.settingsForm.reportPriorityPreset,disabled:e.savingSettings,onChange:t=>{e.onSettingsFormChange({reportPriorityPreset:t.target.value})},children:[n.jsx("option",{value:"risk-first",children:o("shell.butlerReportRiskFirst")}),n.jsx("option",{value:"blocker-first",children:o("shell.butlerReportBlockerFirst")}),n.jsx("option",{value:"verification-first",children:o("shell.butlerReportVerificationFirst")}),n.jsx("option",{value:"progress-first",children:o("shell.butlerReportProgressFirst")})]})]}),n.jsxs("label",{className:"butler-form-field",children:[n.jsx("span",{children:o("shell.butlerSummaryDebounceLabel")}),n.jsx("select",{"aria-label":o("shell.butlerSummaryDebounceLabel"),className:"butler-form-control",value:String(e.settingsForm.summaryDebounceSeconds),disabled:e.savingSettings,onChange:t=>{e.onSettingsFormChange({summaryDebounceSeconds:Number(t.target.value)})},children:_3.map(t=>n.jsx("option",{value:t.value,children:o(t.labelKey)},t.value))})]}),n.jsx("div",{className:"butler-inline-actions",children:n.jsx("button",{type:"button",className:"primary-button",disabled:e.savingSettings,onClick:e.onSaveSettings,children:e.savingSettings?o("shell.butlerSettingsSaving"):o("shell.butlerSettingsSaveAction")})})]})}function Wl(e){if(!e)return"-";const t=new Date(e);return Number.isNaN(t.getTime())?e:new Intl.DateTimeFormat(void 0,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(t)}function Bo(e){return e.updatedAt||e.lastAutomationAt||e.lastCheckedAt||e.createdAt}function Z3(e,t,r){const s=new Map(((r==null?void 0:r.projects)??[]).map(c=>[c.id,c.name])),i=e.map(c=>({id:`patrol-plan:${c.id}`,title:c.name,projectName:s.get(c.projectId)??c.projectId,taskTypeLabel:KC("patrol_plan",c.triggerType),statusLabel:c.enabled?o("shell.butlerAutomationTaskEnabled"):o("shell.butlerAutomationTaskDisabled"),nextRunAt:c.nextRunAt,lastRunAt:c.lastScheduledAt})),l=t.map(c=>{var d;return{id:`follow-up:${c.id}`,title:((d=c.sessionTitle)==null?void 0:d.trim())||c.projectName,projectName:c.projectName,taskTypeLabel:KC("follow_up"),statusLabel:_u(c.status),nextRunAt:c.nextCheckAt,lastRunAt:c.lastAutomationAt||c.lastCheckedAt||c.updatedAt}});return[...i,...l].sort((c,d)=>{const m=Ar(c.nextRunAt),f=Ar(d.nextRunAt);return m!==f?m===0?1:f===0?-1:m-f:Ar(d.lastRunAt)-Ar(c.lastRunAt)}).slice(0,10)}function e$(e,t){const r=new Map(((t==null?void 0:t.projects)??[]).map(l=>[l.id,l.name])),s=((t==null?void 0:t.patrols)??[]).map(l=>{var c;return{id:`patrol-run:${l.id}`,title:o("shell.butlerAutomationPatrolRunTitle"),projectName:r.get(l.projectId)??l.projectId,sourceLabel:YC("patrol_run"),statusLabel:l.status,summary:((c=l.summary)==null?void 0:c.trim())||o("shell.butlerAutomationRunEmptySummary"),createdAt:l.finishedAt||l.startedAt||l.createdAt}}),i=e.flatMap(l=>(l.rounds??[]).map(c=>{var d,m;return{id:`follow-up-round:${l.id}:${c.roundNumber}`,title:`${((d=l.sessionTitle)==null?void 0:d.trim())||l.projectName} · ${o("shell.butlerAutomationRoundLabel",{round:c.roundNumber})}`,projectName:l.projectName,sourceLabel:YC("follow_up_round"),statusLabel:_u(c.status),summary:((m=c.summary)==null?void 0:m.trim())||o("shell.butlerAutomationRunEmptySummary"),createdAt:c.createdAt}}));return[...s,...i].sort((l,c)=>Ar(c.createdAt)-Ar(l.createdAt)).slice(0,12)}function t$(e){if(e.loading)return n.jsx("p",{className:"butler-secondary-text",children:o("shell.butlerAutomationRoundLoading")});if(e.error)return n.jsx("p",{className:"butler-secondary-text",children:e.error});if(!e.task)return n.jsx("p",{className:"butler-secondary-text",children:o("shell.butlerAutomationRoundEmpty")});const t=[...e.task.rounds??[]].sort((r,s)=>Ar(s.createdAt)-Ar(r.createdAt));return n.jsxs("div",{className:"butler-follow-up-rounds",children:[n.jsxs("div",{className:"butler-follow-up-round-summary",children:[n.jsx("strong",{children:e.task.objective}),n.jsx("span",{children:o("conversation.butlerCurrentFollowUpProgress",{current:e.task.autoContinueCount,max:e.task.maxAutoContinueCount??5})})]}),t.length>0?n.jsx("div",{className:"butler-follow-up-round-list",children:t.map(r=>n.jsxs("article",{className:"butler-follow-up-round-card",children:[n.jsxs("header",{className:"butler-follow-up-round-header",children:[n.jsxs("div",{children:[n.jsx("strong",{children:o("shell.butlerAutomationRoundLabel",{round:r.roundNumber})}),n.jsx("span",{children:h$(r.kind)})]}),n.jsx("span",{children:Wl(r.createdAt)})]}),n.jsxs("div",{className:"butler-follow-up-round-body",children:[n.jsxs("p",{children:[o("shell.butlerAutomationRoundProcessedAtLabel"),":",Wl(r.createdAt)]}),n.jsxs("p",{children:[o("shell.butlerAutomationRoundStatusLabel"),":",_u(r.status)]}),r.observedRunningState?n.jsxs("p",{children:[o("shell.butlerAutomationRoundObservedStateLabel"),":",r.observedRunningState]}):null,n.jsxs("p",{children:[o("shell.butlerAutomationRoundSummaryLabel"),":",r.summary||o("conversation.butlerAnalysisEmpty")]}),r.waitingReason?n.jsxs("p",{children:[o("shell.butlerAutomationRoundWaitingReasonLabel"),":",r.waitingReason]}):null,r.continuePrompt?n.jsxs("p",{children:[o("shell.butlerAutomationRoundPromptLabel"),":",r.continuePrompt]}):null]})]},`${r.roundNumber}:${r.createdAt}`))}):n.jsx("p",{className:"butler-secondary-text",children:o("shell.butlerAutomationRoundEmpty")})]})}function n$(e,t){return[...e].filter(r=>t||i$(r.status)).sort((r,s)=>Ar(GC(s))-Ar(GC(r))).slice(0,5).map(r=>{var s,i;return{title:((s=r.targetRef)==null?void 0:s.trim())||r.verificationType,content:((i=r.summary)==null?void 0:i.trim())||o("shell.butlerInfoVerificationFallback",{status:r.status})}})}function VC(e,t){const r=e.filter(s=>s.id!==t.id);return[t,...r].sort((s,i)=>Ar(i.updatedAt)-Ar(s.updatedAt))}function r$(e,t){const r=e.filter(s=>s.id!==t.id);return[t,...r].sort((s,i)=>Ar(Bo(i))-Ar(Bo(s)))}function s$(e,t){const r=e.filter(s=>s.id!==t.id);return[t,...r].sort((s,i)=>Ar(i.updatedAt)-Ar(s.updatedAt))}function TR(e){return e==="active"||e==="waiting_user"}function i$(e){return e==="queued"||e==="running"||e==="failed"}function a$(e){switch(e){case"analyzing":return o("shell.butlerTodoLifecycleAnalyzing");case"analyzed":return o("shell.butlerTodoLifecycleAnalyzed");case"session_created":return o("shell.butlerTodoLifecycleSessionCreated");case"follow_up_active":return o("shell.butlerTodoLifecycleFollowUpActive");case"completed":return o("shell.butlerTodoLifecycleCompleted");case"failed":return o("shell.butlerTodoLifecycleFailed");case"pending":default:return o("shell.butlerTodoLifecyclePending")}}function GC(e){return e.finishedAt||e.startedAt||e.createdAt}function Ar(e){if(!e)return 0;const t=new Date(e).getTime();return Number.isNaN(t)?0:t}function o$(e){const t=Ar(e);return t<=0?"-":new Intl.DateTimeFormat("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(new Date(t))}function l$(e){for(const[t,r]of Object.entries(jb))if(r.length===e.length&&r.every((s,i)=>s===e[i]))return t;return"risk-first"}function c$(e){var s;if((s=e.agentsFilePath)!=null&&s.trim())return e.agentsFilePath.trim();const t=e.workspacePath.includes("\\")?"\\":"/";return`${e.workspacePath.replace(/[\\/]+$/,"")}${t}AGENTS.md`}function u$(e){switch(e){case"pending":return o("shell.butlerInfoTodoPending");case"in_progress":return o("shell.butlerInfoTodoInProgress");case"closed":return o("shell.butlerInfoTodoClosed");default:return o("shell.butlerInfoTodoPending")}}function d$(e){switch(e){case"running":return o("shell.butlerInfoTodoInProgress");case"failed":return o("shell.butlerTodoLifecycleFailed");case"closed":return o("shell.butlerInfoTodoClosed");case"idle":default:return o("shell.butlerInfoTodoPending")}}function _u(e){switch(e){case"active":return o("shell.butlerAutomationStatusActive");case"waiting_user":return o("shell.butlerAutomationStatusWaitingUser");case"completed":return o("shell.butlerAutomationStatusCompleted");case"failed":return o("shell.butlerAutomationStatusFailed");case"cancelled":return o("shell.butlerAutomationStatusCancelled");default:return o("shell.butlerAutomationStatusActive")}}function h$(e){switch(e){case"started":return o("shell.butlerAutomationRoundKindStarted");case"continue":return o("shell.butlerAutomationRoundKindContinue");case"queued":return o("shell.butlerAutomationRoundKindQueued");case"waiting_user":return o("shell.butlerAutomationRoundKindWaitingUser");case"completed":return o("shell.butlerAutomationRoundKindCompleted");case"failed":return o("shell.butlerAutomationRoundKindFailed");case"cancelled":return o("shell.butlerAutomationRoundKindCancelled");case"limit_reached":return o("shell.butlerAutomationRoundKindLimitReached");default:return e}}function KC(e,t){if(e==="follow_up")return o("shell.butlerAutomationTaskTypeFollowUp");switch(t){case"interval":return o("shell.butlerAutomationTaskTypeInterval");case"cron":return o("shell.butlerAutomationTaskTypeCron");case"manual":default:return o("shell.butlerAutomationTaskTypeManual")}}function YC(e){return o(e==="patrol_run"?"shell.butlerAutomationRunSourcePatrol":"shell.butlerAutomationRunSourceFollowUp")}function m$(e){const r=`${e.displayName.trim()}:${e.providerId}:${e.tone}`,s=p$(e);if(!r)return ca.default[0];const i=Array.from(r).reduce((l,c)=>{const d=c.codePointAt(0)??0;return l+d},0);return s[i%s.length]}function p$(e){const t=e.displayName.trim().toLowerCase();return/(bot|ai|智能|助手|助理|管家|buddy|helper)/.test(t)?ca.builder:/(书|学|知|研|析|查|review|audit|scan)/.test(t)?ca.analyst:e.tone==="friendly"?ca.friendly:e.tone==="steady"?ca.steady:e.tone==="direct"?e.providerId==="claude-code"?ca.analyst:ca.direct:e.providerId==="claude-code"?ca.analyst:ca.default}function Ba(e,t){var r;return((r=e.find(s=>s.value===t))==null?void 0:r.label)??t}function f$(){return n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),n.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}function g$(){return n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("path",{d:"M12 8v5l3 2"}),n.jsx("path",{d:"M5 3v4"}),n.jsx("path",{d:"M19 3v4"}),n.jsx("path",{d:"M4 7h16"}),n.jsx("rect",{x:"3",y:"5",width:"18",height:"16",rx:"2"})]})}function Gl(e){return e.flatMap(t=>[{workspace:t.workspace,label:t.workspace.name,subtitle:t.workspace.path,depth:0,kind:"workspace",meta:null},...NR(t.childWorktrees??[])])}function pa(e,t){const r=t==null?void 0:t.trim();if(!r)return null;for(const s of e){if(s.workspace.id===r)return{workspace:s.workspace,sessions:s.sessions,childWorktrees:s.childWorktrees??[],meta:null};const i=PR(s.childWorktrees??[],r);if(i)return i}return null}function NR(e){return e.flatMap(t=>[{workspace:t.workspace,label:t.meta.displayName||t.workspace.name,subtitle:t.workspace.path,depth:t.meta.depth,kind:"worktree",meta:t.meta},...NR(t.children)])}function PR(e,t){for(const r of e){if(r.workspace.id===t)return{workspace:r.workspace,sessions:r.sessions,childWorktrees:r.children,meta:r.meta};const s=PR(r.children,t);if(s)return s}return null}const b$=10080*60*1e3;function v$(e,t){return w$(e.hosts,e.activeHostId).flatMap(r=>{const s=r.id===e.activeHostId?t:y$(r.id);return[{kind:"host",host:r,workspaceCount:s.length},...s.map(i=>({kind:"workspace",host:r,workspace:i.workspace,option:i}))]})}function w$(e,t){return[...e].sort((r,s)=>{if(r.id===t)return-1;if(s.id===t)return 1;const i=r.lastConnectedAt??r.updatedAt??r.createdAt;return(s.lastConnectedAt??s.updatedAt??s.createdAt).localeCompare(i)})}function y$(e){const t=GP(b$,e);return t?Gl(ou(t)):[]}function DR({children:e,className:t,frameRef:r,...s}){return n.jsx("div",{ref:r,className:["mobile-top-header-frame",t].filter(Boolean).join(" "),...s,children:e})}function Kl({currentWorkspace:e,workspaces:t,workspaceOptions:r,onSelectWorkspace:s,className:i,containerRef:l,heading:c,content:d,sheetContent:m,triggerLabel:f,triggerAriaLabel:v,onTriggerClick:g,trailing:w,gestureHandlers:k}){const[y,S]=p.useState(!1),[T,j]=p.useState(null),N=di(),D=fr(),{showToast:H}=Qn(),B=Ya(E=>E),I=Ja(B),A=r??t.map(E=>({workspace:{...E,repoRoot:E.path},label:E.name,subtitle:E.path,depth:0,kind:"workspace",meta:null})),L=v$(B,A),_=(e==null?void 0:e.name)??(I==null?void 0:I.name)??null,F=(e==null?void 0:e.path)??(I==null?void 0:I.baseUrl)??null;if(!_)return null;async function te(E){const se=E.kind==="host"?`host:${E.host.id}`:`workspace:${E.host.id}:${E.workspace.id}`;if(!T){j(se);try{E.host.id!==B.activeHostId&&(N.trigger("selection"),await ZP.switchHost(E.host.id)),E.kind==="host"?D(As()):(E.workspace.id!==(e==null?void 0:e.id)||E.host.id!==B.activeHostId)&&await(s==null?void 0:s(E.workspace.id)),S(!1)}catch(X){H({title:k$(X,E.host.name),tone:"error"})}finally{j(null)}}}return n.jsxs(n.Fragment,{children:[n.jsx(DR,{className:i,frameRef:l,...k,children:n.jsxs("section",{className:"mobile-workspace-home-header",children:[n.jsx("h1",{className:"mobile-workspace-switcher-heading",children:c??_}),n.jsxs("div",{className:"mobile-workspace-home-toolbar-top",children:[n.jsxs("button",{type:"button",className:"mobile-workspace-home-switcher","aria-label":v??o("shell.workspaceHomeSwitcherLabel"),onClick:()=>{if(g){g();return}N.trigger("selection"),S(!0)},children:[n.jsx("span",{className:"mobile-workspace-home-switcher-label",children:f??_}),n.jsx(j$,{})]}),n.jsx("div",{className:"mobile-workspace-home-toolbar-actions",children:w})]}),F?n.jsx("p",{className:"mobile-workspace-home-path",children:F}):null,d]})}),y&&!g?S$(n.jsxs(C$,{title:o("shell.hostWorkspaceSwitcherTitle"),onClose:()=>S(!1),children:[n.jsx("div",{className:"mobile-workspace-home-group mobile-workspace-home-sheet-group",children:L.map(E=>n.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-sheet-row","data-host-entry-kind":E.kind,"data-host-active":E.host.id===B.activeHostId,"data-worktree-kind":E.kind==="workspace"?E.option.kind:void 0,"data-worktree-depth":E.kind==="workspace"?E.option.depth+1:0,disabled:T!==null,onClick:()=>{te(E)},children:[n.jsxs("div",{className:E.kind==="host"?"mobile-workspace-home-session-main mobile-host-workspace-switcher-host-main":"mobile-workspace-home-session-main",style:{"--mobile-workspace-tree-depth":String(E.kind==="host"?0:E.option.depth+1)},children:[n.jsxs("span",{className:"mobile-workspace-home-session-title",children:[E.kind==="host"?n.jsx("span",{className:"mobile-host-workspace-switcher-host-badge",children:o("shell.hostSwitcherNodeBadge")}):null,E.kind==="workspace"&&E.option.kind==="worktree"?n.jsx("span",{className:"mobile-workspace-home-worktree-badge",children:o("shell.mobileWorktreeBadge")}):null,E.kind==="host"?E.host.name:E.option.label]}),n.jsx("span",{className:"mobile-workspace-home-session-meta",children:E.kind==="host"?x$(E.host,E.workspaceCount):E.option.subtitle})]}),n.jsx("span",{className:"mobile-workspace-home-row-trailing",children:E.kind==="host"&&E.host.id===B.activeHostId?n.jsx(XC,{}):E.kind==="workspace"&&E.workspace.id===(e==null?void 0:e.id)&&E.host.id===B.activeHostId?n.jsx(XC,{}):n.jsx(T$,{})})]},E.kind==="host"?`host-${E.host.id}`:`workspace-${E.host.id}-${E.workspace.id}`))}),m?m(()=>S(!1)):null]})):null]})}function k$(e,t){return e instanceof Yh?e.code==="HOST_UNREACHABLE"?o("shell.hostSwitchUnreachable",{name:t}):o("shell.hostSwitchMissing"):o("shell.hostSwitchFailed")}function x$(e,t){return e?e.lastUsername?o("shell.hostSwitcherWorkspaceCountWithUser",{username:e.lastUsername,count:t}):t>0?o("shell.hostSwitcherWorkspaceCount",{count:t}):e.baseUrl:""}function S$(e){return typeof document>"u"?null:Vn.createPortal(e,document.body)}function C$({title:e,onClose:t,children:r}){return n.jsx("div",{className:"ios-action-sheet-overlay",role:"presentation",onClick:t,children:n.jsxs("div",{className:"mobile-workspace-home-sheet",role:"dialog","aria-modal":"true","aria-label":e,onClick:s=>s.stopPropagation(),children:[n.jsxs("div",{className:"mobile-workspace-home-sheet-card",children:[n.jsx("div",{className:"mobile-workspace-home-sheet-header",children:n.jsx("strong",{children:e})}),r]}),n.jsx("button",{type:"button",className:"ios-action-sheet-cancel",onClick:t,children:o("common.cancel")})]})})}function j$(){return n.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:n.jsx("path",{d:"M4 6.5L8 10l4-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function T$(){return n.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:n.jsx("path",{d:"M6 3.5L10.5 8 6 12.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function XC(){return n.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:n.jsx("path",{d:"M3.5 8.5L6.5 11.5L12.5 5.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.8"})})}const RR="mobile.butler.active-tab",Nh=["info","automation","settings"],N$=15e3,ow=56,lw=1.2,QC=360;function P$(){if(typeof window>"u")return"info";try{const e=window.localStorage.getItem(RR);return e==="automation"||e==="settings"?e:"info"}catch{return"info"}}function D$(e,t){return e==="settings"?"settings":e==="automation"?"automation":e==="info"?"info":t}function R$(e,t,r){if(!t)return{closeSidebar:!1,nextTab:e};const s=r.x-t.x,i=r.y-t.y;if(Math.abs(s)<ow)return{closeSidebar:!1,nextTab:e};if(Math.abs(s)<Math.abs(i)*lw)return{closeSidebar:!1,nextTab:e};const l=Nh.indexOf(e);if(s>0&&l===0)return{closeSidebar:!0,nextTab:e};const c=s<0?Math.min(Nh.length-1,l+1):Math.max(0,l-1);return{closeSidebar:!1,nextTab:Nh[c]??e}}function A$(e,t){if(!e)return null;const r=t.x-e.x,s=t.y-e.y;return Math.abs(r)<ow||Math.abs(r)<Math.abs(s)*lw?null:r>0?"list":"sidebar"}function eg(e){return e instanceof Element?!!e.closest("input, textarea, select, option, label, button, a, [contenteditable='true'], [data-mobile-butler-gesture='ignore']"):!1}function M$(){var $e,wt,me,Pe,Ge,dt,Ye,Dt;const{workspaceId:e=""}=Ho(),t=ui(),r=fr(),{showToast:s}=Qn(),{navigationGroups:i,requestNavigationRefresh:l,selectWorkspace:c}=Mr(),d=(($e=i.find(ae=>ae.workspace.id===e))==null?void 0:$e.workspace)??null,m=new URLSearchParams(t.search).get("tab"),f=p.useRef(P$()),v=D$(m,f.current),g=p.useRef(null),w=p.useRef(null),k=p.useRef(null),y=p.useRef(null),S=p.useRef(null),[T,j]=p.useState(null),[N,D]=p.useState(null),[H,B]=p.useState({loading:!0,initialized:!1,profile:null,overview:null,followUpTasks:[],inboxItems:[],patrolPlans:[],controlSessions:[]});(!y.current||S.current!==e)&&(y.current=new xR(e),S.current=e);const I=y.current,A=Kn(I,ae=>ae.loading),L=Kn(I,ae=>ae.initialized),_=Kn(I,ae=>ae.profile),F=Kn(I,ae=>ae.activeProvider),te=Kn(I,ae=>ae.controlSession),E=Kn(I,ae=>ae.capabilities),se=Kn(I,ae=>ae.messages),X=Kn(I,ae=>ae.historyState),K=Kn(I,ae=>ae.runtimeHasActiveRun),G=Kn(I,ae=>ae.runtimeCanInterrupt),q=Kn(I,ae=>ae.contextUsage),{composerPortalTarget:U}=lv(),Q=p.useRef(null);p.useEffect(()=>{if(f.current=v,!(typeof window>"u"))try{window.localStorage.setItem(RR,v)}catch{}},[v]),p.useEffect(()=>{if(m===v)return;const ae=new URLSearchParams(t.search);ae.set("tab",v),r({pathname:t.pathname,search:`?${ae.toString()}`},{replace:!0})},[v,t.pathname,t.search,r,m]),p.useEffect(()=>{e&&c(e)},[c,e]),p.useEffect(()=>{e&&I.initialize()},[I,e]),p.useEffect(()=>{if(!e){B({loading:!1,initialized:!1,profile:null,overview:null,followUpTasks:[],inboxItems:[],patrolPlans:[],controlSessions:[]});return}let ae=!1;async function We(Vt){B(Gt=>({...Gt,loading:!0}));try{const Gt=await wm();if(!Gt.initialized||!Gt.profile){ae||B({loading:!1,initialized:!1,profile:null,overview:null,followUpTasks:[],inboxItems:[],patrolPlans:[],controlSessions:[]});return}const[pn,ie,Be,Mt]=await Promise.all([ym(),km(),Iu({workspaceId:e}),nb()]),Tt=pn.overview.projects.filter(dn=>dn.workspaceId===e).map(dn=>dn.id),xn=await Promise.all(Tt.map(dn=>YP(dn)));if(ae)return;B({loading:!1,initialized:!0,profile:Gt.profile,overview:pn.overview,followUpTasks:ie.items.filter(dn=>dn.workspaceId===e),inboxItems:Be.items.filter(dn=>dn.status!=="closed"),patrolPlans:xn.flatMap(dn=>dn.items),controlSessions:Mt.items})}catch(Gt){if(ae)return;B(pn=>({...pn,loading:!1})),Vt&&s({title:o("shell.butlerLoadFailed"),description:Gt instanceof Error?Gt.message:void 0,tone:"error"})}}We(!0);const jt=window.setInterval(()=>{We(!1)},N$),Rt=aw(()=>{We(!1)}),cn=()=>{We(!1)};return window.addEventListener(Fo,cn),()=>{ae=!0,window.clearInterval(jt),Rt(),window.removeEventListener(Fo,cn)}},[s,e]);const P=p.useMemo(()=>{var ae;return new Set((((ae=H.overview)==null?void 0:ae.projects)??[]).filter(We=>We.workspaceId===e).map(We=>We.id))},[(wt=H.overview)==null?void 0:wt.projects,e]),W=p.useMemo(()=>H.followUpTasks.filter(ae=>_$(ae.status)),[H.followUpTasks]),J=p.useMemo(()=>{var ae;return(((ae=H.overview)==null?void 0:ae.verifications)??[]).filter(We=>We.projectId?P.has(We.projectId):!1)},[(me=H.overview)==null?void 0:me.verifications,P]),R=p.useMemo(()=>[...W].sort((ae,We)=>qi(rg(We))-qi(rg(ae))).slice(0,4),[W]),ve=p.useMemo(()=>L$(J),[J]),pe=p.useMemo(()=>F$(H.inboxItems.filter(ae=>ae.status!=="closed")).slice(0,4),[H.inboxItems]),Y=p.useMemo(()=>B$(H.patrolPlans,H.followUpTasks,H.overview,P),[H.followUpTasks,H.overview,H.patrolPlans,P]),Se=p.useMemo(()=>W$(H.followUpTasks,H.overview,P),[H.followUpTasks,H.overview,P]),Le=H.loading||A,re=!Le&&(!H.initialized||!L||!H.profile),Ce=((Pe=_==null?void 0:_.displayName)==null?void 0:Pe.trim())||((dt=(Ge=H.profile)==null?void 0:Ge.displayName)==null?void 0:dt.trim())||o("shell.butlerEntry"),Xe=!te&&se.length===0,Ue=!re&&T===null,ct=v==="info"?n.jsxs(n.Fragment,{children:[n.jsx(ng,{title:o("shell.butlerInfoFollowUpRecordsTitle"),emptyText:o("shell.butlerInfoFollowUpRecordsEmpty"),actionLabel:o("shell.butlerFollowUpHistoryAction"),onAction:()=>j("list"),items:R.map(ae=>{var We,jt,Rt;return{id:ae.id,title:((We=ae.sessionTitle)==null?void 0:We.trim())||ae.projectName,content:((jt=ae.waitingReason)==null?void 0:jt.trim())||((Rt=ae.lastAutomationSummary)==null?void 0:Rt.trim())||ae.objective||o("shell.butlerInfoFollowUpFallback",{updatedAt:Ph(rg(ae))})}})}),n.jsx(ng,{title:o("shell.butlerInfoVerificationRecordsTitle"),emptyText:o("shell.butlerInfoVerificationRecordsEmpty"),items:ve.map((ae,We)=>({id:`${ae.title}:${We}`,title:ae.title,content:ae.content}))}),n.jsx(ng,{title:o("shell.butlerInfoTodoRecordsTitle"),emptyText:o("shell.butlerInfoTodoRecordsEmpty"),items:pe.map((ae,We)=>({id:`${ae.title}:${We}`,title:ae.title,content:ae.content}))})]}):v==="automation"?n.jsxs(n.Fragment,{children:[n.jsx(JC,{title:o("shell.butlerAutomationTasksTitle"),emptyText:o("shell.butlerAutomationTasksEmpty"),items:Y.map(ae=>({id:ae.id,title:ae.title,subtitle:ae.projectName,status:ae.statusLabel,content:`${o("shell.butlerAutomationTaskTypeLabel")} · ${ae.taskTypeLabel}`,meta:`${o("shell.butlerAutomationTaskNextRunLabel")} · ${Ph(ae.nextRunAt)}`}))}),n.jsx(JC,{title:o("shell.butlerAutomationRunsTitle"),emptyText:o("shell.butlerAutomationRunsEmpty"),items:Se.map(ae=>({id:ae.id,title:ae.title,subtitle:ae.projectName,status:ae.statusLabel,content:`${ae.sourceLabel} · ${ae.summary}`,meta:Ph(ae.createdAt)}))})]}):n.jsxs("section",{className:"mobile-feature-panel surface-card mobile-butler-record-section",children:[n.jsx("div",{className:"mobile-feature-section-header",children:n.jsx("div",{children:n.jsx("h2",{children:o("shell.butlerSidebarSettingsTab")})})}),n.jsxs("div",{className:"mobile-butler-settings-summary",children:[n.jsx(tg,{label:o("shell.butlerDisplayNameLabel"),value:Ce}),n.jsx(tg,{label:o("shell.butlerProviderLabel"),value:nj(F)}),n.jsx(tg,{label:o("shell.mobileButlerAssistantWorkspaceLabel"),value:((Ye=H.profile)==null?void 0:Ye.workspacePath)??(d==null?void 0:d.path)??"-"})]})]});E$(Q,N,Ue,`${e}:${T??"none"}`);function Nt(ae){ae!==v&&r($i(e,ae),{replace:!0})}function Ke(ae){if(ae.changedTouches.length!==1){g.current=null;return}if(eg(ae.target)){g.current=null;return}const We=ae.changedTouches[0];g.current={x:We.clientX,y:We.clientY}}function ut(ae){if(ae.changedTouches.length!==1)return;const We=g.current;g.current=null;const jt=ae.changedTouches[0],Rt=A$(We,{x:jt.clientX,y:jt.clientY});Rt&&j(Rt)}function vt(ae){if(ae.changedTouches.length!==1){w.current=null;return}if(eg(ae.target)){w.current=null;return}const We=ae.changedTouches[0];w.current={x:We.clientX,y:We.clientY}}function Te(ae){const We=w.current;if(w.current=null,!We||ae.changedTouches.length!==1)return;const jt=ae.changedTouches[0],Rt=jt.clientX-We.x,cn=jt.clientY-We.y;Rt>-ow||Math.abs(Rt)<Math.abs(cn)*lw||j(null)}function _e(ae){if(ae.changedTouches.length!==1){k.current=null;return}if(eg(ae.target)){k.current=null;return}const We=ae.changedTouches[0];k.current={x:We.clientX,y:We.clientY}}function we(ae){const We=k.current;if(k.current=null,ae.changedTouches.length!==1)return;const jt=ae.changedTouches[0],Rt=R$(v,We,{x:jt.clientX,y:jt.clientY});if(Rt.closeSidebar){j(null);return}Rt.nextTab!==v&&Nt(Rt.nextTab)}async function qe(ae){await I.openControlSession(ae),j(null)}async function ke(){await I.startFreshSession(),j(null),l()}async function Ee(ae,We){var jt;(((jt=We==null?void 0:We.attachments)==null?void 0:jt.length)??0)>0&&s({title:o("shell.butlerAttachmentUnsupported"),tone:"warning"}),await I.sendMessage(ae,{model:(We==null?void 0:We.model)??null,reasoningLevel:(We==null?void 0:We.reasoningLevel)??null,permissionMode:null}),l()}return d?n.jsxs("main",{ref:Q,className:"mobile-feature-page mobile-page-fixed-root mobile-butler-page mobile-butler-page-shell","data-mobile-butler-drawer":T??"none",children:[n.jsx(Kl,{currentWorkspace:d,workspaces:i.map(ae=>ae.workspace),heading:o("shell.mobileButlerEntry"),triggerLabel:d.name,onSelectWorkspace:ae=>{c(ae),r($i(ae,v))},trailing:n.jsxs("div",{className:"mobile-butler-header-trailing","data-mobile-butler-gesture":"ignore",children:[n.jsxs("div",{className:"mobile-butler-hero-top mobile-butler-toolbar-identity",children:[n.jsx("div",{className:"mobile-butler-hero-badge",children:"AI"}),n.jsxs("div",{className:"mobile-butler-hero-copy",children:[n.jsx("strong",{children:Ce}),n.jsx("span",{children:nj(F)})]})]}),n.jsxs("div",{className:"mobile-butler-toolbar-actions",children:[n.jsx("button",{type:"button",className:"mobile-butler-toolbar-button","aria-label":o("shell.butlerHistoryAction"),title:o("shell.butlerHistoryAction"),onClick:()=>j("list"),children:"≡"}),n.jsx("button",{type:"button",className:"mobile-butler-toolbar-button","aria-label":o("shell.butlerSidebarTabsLabel"),title:o("shell.butlerSidebarTabsLabel"),onClick:()=>j("sidebar"),children:"ⓘ"})]})]})}),n.jsxs("div",{className:"mobile-butler-stage-shell",children:[T?n.jsx("button",{type:"button",className:"mobile-butler-drawer-scrim","aria-label":o("common.close"),onClick:()=>j(null)}):null,n.jsxs("aside",{className:"mobile-butler-drawer mobile-butler-drawer-list",style:{width:`min(88vw, ${QC}px)`},onTouchStart:vt,onTouchEnd:Te,children:[n.jsxs("div",{className:"mobile-butler-drawer-header",children:[n.jsxs("div",{children:[n.jsx("h2",{children:o("shell.butlerHistoryTitle")}),n.jsx("p",{children:o("shell.butlerHistoryDescription")})]}),n.jsx("button",{type:"button",className:"mobile-butler-toolbar-button","aria-label":o("shell.butlerNewSessionAction"),onClick:()=>{ke()},children:"+"})]}),n.jsx("div",{className:"mobile-butler-list-body",children:n.jsx(I$,{activeControlSessionId:(te==null?void 0:te.id)??null,sessions:H.controlSessions,onSelectSession:ae=>{qe(ae)}})})]}),n.jsx("div",{className:"mobile-butler-main-stage",onTouchStart:Ke,onTouchEnd:ut,children:Le?n.jsx("section",{className:"mobile-butler-loading-shell",children:n.jsx(dR,{})}):re?n.jsxs("section",{className:"mobile-butler-empty-panel",children:[n.jsx("h2",{children:o("shell.mobileButlerEmptyTitle")}),n.jsx("p",{children:o("shell.mobileButlerEmptyBody")})]}):n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"mobile-butler-chat-body",children:Xe?n.jsxs("section",{className:"mobile-butler-empty-panel",children:[n.jsx("h2",{children:o("shell.butlerConversationTitle")}),n.jsx("p",{children:o("shell.butlerProjectSyncEmptyState")})]}):n.jsx("div",{className:"conversation-timeline-shell mobile-butler-timeline-shell",children:n.jsx(Im,{sessionId:(Dt=te==null?void 0:te.session)==null?void 0:Dt.sessionId,messages:se,historyState:X,loadingOlderMessages:!1,hasOlderMessages:!1,provider:F,onLoadOlderMessages:()=>{},onRetryMessage:ae=>{I.retryMessage(ae)}})})}),Ue?n.jsx("div",{className:"mobile-butler-chat-composer","data-mobile-butler-gesture":"ignore",children:n.jsx(Nm,{capabilities:E,draftStorageId:`mobile-butler:${e}:${F}`,panelRef:D,portalContainer:U,placeholder:o("shell.butlerComposerPlaceholder",{displayName:Ce}),hasActiveRun:K??!1,canInterrupt:G??!1,contextUsage:q,isSubmitting:A,isRunning:K??!1,onInterrupt:async()=>{await I.interrupt(),l()},onSend:async(ae,We)=>{await Ee(ae,We)}})}):null]})}),n.jsxs("aside",{className:"mobile-butler-drawer mobile-butler-drawer-sidebar",style:{width:`min(88vw, ${QC}px)`},onTouchStart:_e,onTouchEnd:we,children:[n.jsx("div",{className:"mobile-butler-segmented-shell","data-mobile-butler-gesture":"ignore",children:n.jsx("div",{className:"mobile-butler-segmented-control",role:"tablist","aria-label":o("shell.butlerSidebarTabsLabel"),children:Nh.map(ae=>{const We=v===ae,jt=o(ae==="info"?"shell.butlerSidebarInfoTab":ae==="automation"?"shell.butlerSidebarAutomationTab":"shell.butlerSidebarSettingsTab");return n.jsx("button",{type:"button",role:"tab",className:"mobile-butler-segmented-button","aria-selected":We,onClick:()=>{Nt(ae)},children:jt},ae)})})}),n.jsx("div",{className:"mobile-page-top-body mobile-butler-body mobile-butler-sidebar-body",children:ct})]})]})]}):n.jsx("main",{className:"mobile-feature-page mobile-page-scroll-root",children:n.jsxs("article",{className:"mobile-feature-empty surface-card",children:[n.jsx("h1",{children:o("shell.workspaceDetailMissingTitle")}),n.jsx("p",{children:o("shell.workspaceDetailMissingBody")})]})})}function tg({label:e,value:t}){return n.jsxs("div",{className:"mobile-butler-info-metric",children:[n.jsx("span",{children:e}),n.jsx("strong",{title:t,children:t})]})}function JC(e){return n.jsxs("section",{className:"mobile-feature-panel surface-card mobile-butler-record-section",children:[n.jsxs("div",{className:"mobile-feature-section-header",children:[n.jsx("div",{children:n.jsx("h2",{children:e.title})}),n.jsx("span",{className:"mobile-feature-counter",children:e.items.length})]}),e.items.length>0?n.jsx("div",{className:"mobile-butler-record-list",children:e.items.map(t=>n.jsxs("article",{className:"mobile-butler-record-card",children:[n.jsxs("header",{className:"mobile-butler-record-header",children:[n.jsxs("div",{className:"mobile-butler-record-copy",children:[n.jsx("strong",{children:t.title}),t.subtitle?n.jsx("span",{children:t.subtitle}):null]}),t.status?n.jsx("span",{className:"mobile-butler-record-badge",children:t.status}):null]}),n.jsx("p",{children:t.content}),t.meta?n.jsx("footer",{children:t.meta}):null]},t.id))}):n.jsx("p",{className:"mobile-butler-empty-text",children:e.emptyText})]})}function ng(e){return n.jsxs("section",{className:"mobile-feature-panel surface-card mobile-butler-record-section mobile-butler-record-section-compact",children:[n.jsxs("div",{className:"mobile-feature-section-header",children:[n.jsx("div",{children:n.jsx("h2",{children:e.title})}),e.actionLabel&&e.onAction?n.jsx("button",{type:"button",className:"mobile-butler-section-action",onClick:e.onAction,children:e.actionLabel}):null]}),e.items.length>0?n.jsx("div",{className:"mobile-butler-record-list mobile-butler-record-list-compact",children:e.items.map(t=>n.jsxs("article",{className:"mobile-butler-compact-record",children:[n.jsx("span",{children:t.title}),n.jsx("strong",{children:t.content})]},t.id))}):n.jsx("p",{className:"mobile-butler-empty-text",children:e.emptyText})]})}function I$(e){return e.sessions.length===0?n.jsx("p",{className:"mobile-butler-empty-text",children:o("shell.butlerHistoryEmpty")}):n.jsx("div",{className:"mobile-butler-record-list",children:e.sessions.map(t=>{var i,l,c,d,m;const r=t.id===e.activeControlSessionId,s=((i=t.title)==null?void 0:i.trim())||((l=t.session.title)==null?void 0:l.trim())||((c=t.lastSummary)==null?void 0:c.trim())||t.sessionId;return n.jsxs("article",{className:"mobile-butler-record-card mobile-butler-history-card","data-active":r,children:[n.jsxs("header",{className:"mobile-butler-record-header",children:[n.jsxs("div",{className:"mobile-butler-record-copy",children:[n.jsx("strong",{children:s}),n.jsx("span",{children:Ph(t.updatedAt)})]}),r?n.jsx("span",{className:"mobile-butler-record-badge",children:o("shell.butlerCurrentSessionBadge")}):null]}),n.jsx("p",{children:((d=t.lastSummary)==null?void 0:d.trim())||((m=t.session.title)==null?void 0:m.trim())||t.sessionId}),n.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{e.onSelectSession(t.id)},children:o(r?"shell.butlerCurrentSessionBadge":"shell.butlerHistoryOpenAction")})]},t.id)})})}function E$(e,t,r,s){p.useEffect(()=>{const i=e.current;if(!r||!i){i&&i.style.removeProperty("--mobile-conversation-composer-height");return}if(!t){i.style.removeProperty("--mobile-conversation-composer-height");return}const l=i,c=t;function d(){!e.current||!c.isConnected||l.style.setProperty("--mobile-conversation-composer-height",`${c.offsetHeight}px`)}d();const m=typeof ResizeObserver<"u"?new ResizeObserver(d):null;return m==null||m.observe(c),window.addEventListener("resize",d),()=>{m==null||m.disconnect(),window.removeEventListener("resize",d),i.style.removeProperty("--mobile-conversation-composer-height")}},[t,r,s,e])}function L$(e){return[...e].filter(t=>O$(t.status)).sort((t,r)=>qi(tj(r))-qi(tj(t))).slice(0,4).map(t=>{var r,s;return{title:((r=t.targetRef)==null?void 0:r.trim())||t.verificationType,content:((s=t.summary)==null?void 0:s.trim())||o("shell.butlerInfoVerificationFallback",{status:t.status})}})}function F$(e){return e.map(t=>({title:t.title,content:`${t.projectName} · ${U$(t.status)}`}))}function _$(e){return e==="active"||e==="waiting_user"}function O$(e){return e==="queued"||e==="running"||e==="failed"}function B$(e,t,r,s){const i=new Map(((r==null?void 0:r.projects)??[]).filter(d=>s.has(d.id)).map(d=>[d.id,d.name])),l=e.filter(d=>s.has(d.projectId)).map(d=>({id:`patrol-plan:${d.id}`,title:d.name,projectName:i.get(d.projectId)??d.projectId,taskTypeLabel:ZC("patrol_plan",d.triggerType),statusLabel:d.enabled?o("shell.butlerAutomationTaskEnabled"):o("shell.butlerAutomationTaskDisabled"),nextRunAt:d.nextRunAt,lastRunAt:d.lastScheduledAt})),c=t.map(d=>{var m;return{id:`follow-up:${d.id}`,title:((m=d.sessionTitle)==null?void 0:m.trim())||d.projectName,projectName:d.projectName,taskTypeLabel:ZC("follow_up"),statusLabel:AR(d.status),nextRunAt:d.nextCheckAt,lastRunAt:d.lastAutomationAt||d.lastCheckedAt||d.updatedAt}});return[...l,...c].sort((d,m)=>{const f=qi(d.nextRunAt),v=qi(m.nextRunAt);return f!==v?f===0?1:v===0?-1:f-v:qi(m.lastRunAt)-qi(d.lastRunAt)}).slice(0,8)}function W$(e,t,r){const s=new Map(((t==null?void 0:t.projects)??[]).filter(c=>r.has(c.id)).map(c=>[c.id,c.name])),i=((t==null?void 0:t.patrols)??[]).filter(c=>r.has(c.projectId)).map(c=>{var d;return{id:`patrol-run:${c.id}`,title:o("shell.butlerAutomationPatrolRunTitle"),projectName:s.get(c.projectId)??c.projectId,sourceLabel:ej("patrol_run"),statusLabel:c.status,summary:((d=c.summary)==null?void 0:d.trim())||o("shell.butlerAutomationRunEmptySummary"),createdAt:c.finishedAt||c.startedAt||c.createdAt}}),l=e.flatMap(c=>(c.rounds??[]).map(d=>{var m,f;return{id:`follow-up-round:${c.id}:${d.roundNumber}`,title:`${((m=c.sessionTitle)==null?void 0:m.trim())||c.projectName} · ${o("shell.butlerAutomationRoundLabel",{round:d.roundNumber})}`,projectName:c.projectName,sourceLabel:ej("follow_up_round"),statusLabel:AR(d.status),summary:((f=d.summary)==null?void 0:f.trim())||o("shell.butlerAutomationRunEmptySummary"),createdAt:d.createdAt}}));return[...i,...l].sort((c,d)=>qi(d.createdAt)-qi(c.createdAt)).slice(0,10)}function U$(e){switch(e){case"pending":return o("shell.butlerInfoTodoPending");case"in_progress":return o("shell.butlerInfoTodoInProgress");case"closed":return o("shell.butlerInfoTodoClosed");default:return o("shell.butlerInfoTodoPending")}}function rg(e){return e.updatedAt||e.lastAutomationAt||e.lastCheckedAt||e.createdAt}function AR(e){switch(e){case"active":return o("shell.butlerAutomationStatusActive");case"waiting_user":return o("shell.butlerAutomationStatusWaitingUser");case"completed":return o("shell.butlerAutomationStatusCompleted");case"failed":return o("shell.butlerAutomationStatusFailed");case"cancelled":return o("shell.butlerAutomationStatusCancelled");default:return o("shell.butlerAutomationStatusActive")}}function ZC(e,t){if(e==="follow_up")return o("shell.butlerAutomationTaskTypeFollowUp");switch(t){case"interval":return o("shell.butlerAutomationTaskTypeInterval");case"cron":return o("shell.butlerAutomationTaskTypeCron");case"manual":default:return o("shell.butlerAutomationTaskTypeManual")}}function ej(e){return o(e==="patrol_run"?"shell.butlerAutomationRunSourcePatrol":"shell.butlerAutomationRunSourceFollowUp")}function tj(e){return e.finishedAt||e.startedAt||e.createdAt}function qi(e){if(!e)return 0;const t=new Date(e).getTime();return Number.isNaN(t)?0:t}function Ph(e){if(!e)return"-";const t=new Date(e);return Number.isNaN(t.getTime())?e:new Intl.DateTimeFormat(void 0,{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(t)}function nj(e){switch(e){case"claude-code":return"Claude Code";case"codex":default:return"Codex"}}function H$(){const{shellMode:e}=Mr();return e==="mobile"?n.jsx(M$,{}):n.jsx(W3,{})}function MR({connectionState:e,onReconnect:t}){const{showToast:r,dismissToast:s}=Qn();return p.useEffect(()=>{if(e==="connected"||e==="closed"){s("conversation-connection-state");return}if(e==="reconnect_failed"){r({id:"conversation-connection-state",title:o("conversation.connectionReconnectFailed"),description:o("conversation.reconnectFailedExplain"),tone:"warning",durationMs:null,action:{label:o("conversation.reconnectButton"),onClick:t}});return}r({id:"conversation-connection-state",title:o("conversation.connectionReconnecting"),description:o("conversation.reconnectExplain"),tone:"info",durationMs:3200})},[e,s,t,r]),null}const Jd="provider-default",z$=420,q$=520,$$=32,V$=48;function G$(e){if(typeof document>"u")return!1;const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly","true"),t.style.position="fixed",t.style.opacity="0",t.style.pointerEvents="none",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy")}catch{return!1}finally{document.body.removeChild(t)}}async function K$(e,t){var r;if(!(t.isDesktop&&(await t.bridge.writeClipboardText(e)).ok)){if(typeof navigator<"u"&&((r=navigator.clipboard)!=null&&r.writeText))try{await navigator.clipboard.writeText(e);return}catch{}if(!G$(e))throw new Error(o("conversation.copyContentFailed"))}}function Zd(e,t,r){return Math.min(Math.max(e,t),r)}function sg(e){return e&&$c.includes(e)?e:"codex"}function Tb(e){return e?e.nodeType===Node.ELEMENT_NODE?e:e.parentElement:null}function rj(e){var r,s;const t=Tb(e);return((s=(r=t==null?void 0:t.closest("[data-message-id]"))==null?void 0:r.getAttribute("data-message-id"))==null?void 0:s.trim())||null}function Y$(e,t){return[t.trim()||o("conversation.selectionActionDefaultPrompt"),"",o("conversation.selectionActionQuotedLabel"),"```text",e.trim(),"```"].join(`
|
|
115
|
-
`)}function ig(e){if(typeof window>"u")return null;const t=window.getSelection();if(!t||t.rangeCount===0||t.isCollapsed)return null;const r=t.getRangeAt(0),s=Tb(r.startContainer),i=Tb(r.endContainer);if(!s||!i||!e.contains(s)||!e.contains(i))return null;const l=t.toString().trim();if(!l)return null;const c=r.getBoundingClientRect();if(!c.width&&!c.height)return null;const d=rj(r.startContainer),m=rj(r.endContainer);return{text:l,sourceMessageId:d&&d===m?d:null,rect:{left:c.left,top:c.top,right:c.right,bottom:c.bottom,width:c.width,height:c.height}}}function X$({containerRef:e,session:t,currentCapabilities:r}){const s=fr(),i=sr(),{showToast:l}=Qn(),{shellMode:c,requestNavigationRefresh:d,selectWorkspace:m,upsertNavigationSession:f}=Mr(),v=ma(we=>we.profile.providers),[g,w]=p.useState(null),[k,y]=p.useState(!1),[S,T]=p.useState(""),[j,N]=p.useState(!1),[D,H]=p.useState(sg(t==null?void 0:t.provider)),[B,I]=p.useState(Jd),[A,L]=p.useState(null),[_,F]=p.useState({}),[te,E]=p.useState(!1),[se,X]=p.useState(!1),[K,G]=p.useState(!1),[q,U]=p.useState(0),[Q,P]=p.useState(null),[W,J]=p.useState(()=>({width:typeof window>"u"?0:window.innerWidth,height:typeof window>"u"?0:window.innerHeight})),R=p.useRef(!1),ve=p.useRef(!1),pe=p.useRef(null),Y=p.useRef(null),Se=c==="mobile"||i.isMobile,Le=p.useMemo(()=>we=>{var qe,ke;return((ke=(qe=v[we])==null?void 0:qe.defaultModel)==null?void 0:ke.trim())||Jd},[v]),re=p.useMemo(()=>D===(t==null?void 0:t.provider)&&r?r:A??Ga(D),[r,A,D,t==null?void 0:t.provider]),Ce=p.useMemo(()=>{var qe;const we=Ga(D).modelOptions??[];return(qe=re.modelOptions)!=null&&qe.length?re.modelOptions:we},[re.modelOptions,D]),Xe=p.useMemo(()=>Ce.find(we=>we.id===B)??Ce[0]??null,[Ce,B]),Ue=p.useMemo(()=>{const we=_[D]??(D===(t==null?void 0:t.provider)?r:A);return!we||we.canStartSession!==!1?null:we.limitations[0]??o("conversation.capabilityDenied")},[r,A,_,D,t==null?void 0:t.provider]),ct=p.useMemo(()=>{var me;if(!g||typeof window>"u")return null;const we=(me=e.current)==null?void 0:me.getBoundingClientRect(),qe=we?Math.max(80,we.left+80):96,ke=we?Math.min(W.width-80,we.right-80):W.width-96,Ee=we?Math.max(12,we.top+12):12,$e=we?Math.max(Ee,we.bottom-48):Math.max(12,W.height-48),wt=g.rect.left+g.rect.width/2;return{left:Zd(wt,qe,Math.max(qe,ke)),top:Zd(g.rect.top-48,Ee,$e)}},[e,g,W.height,W.width]),Nt=p.useMemo(()=>{var jt;if(!g||typeof window>"u")return null;const we=(jt=e.current)==null?void 0:jt.getBoundingClientRect(),qe=(we==null?void 0:we.left)??0,ke=(we==null?void 0:we.right)??W.width,Ee=(we==null?void 0:we.top)??0,$e=(we==null?void 0:we.bottom)??W.height;if(Se)return{left:W.width/2,top:W.height/2,width:Math.min(420,Math.max(280,W.width-24)),maxHeight:Math.max(260,W.height-$$),transform:"translate(-50%, -50%)"};const wt=Math.max(280,Math.min(W.width-24,ke-qe-24)),me=Math.min(420,wt),Pe=g.rect.left+g.rect.width/2,Ge=Math.max(12,qe+12),dt=Math.max(Ge,Math.min(W.width-me-12,ke-me-12)),Ye=Math.min(q$,Math.max(280,$e-Ee-24),Math.max(280,W.height-24)),Dt=Math.max(12,Ee+12),ae=Math.max(Dt,Math.min(W.height-Ye-12,$e-Ye-12)),We=g.rect.top-z$-18;return{left:Zd(Pe-me/2,Ge,dt),top:Zd(We,Dt,ae),width:me,maxHeight:Ye}},[e,Se,g,W.height,W.width]);p.useEffect(()=>{if(typeof window>"u")return;const we=()=>{J({width:window.innerWidth,height:window.innerHeight})};return we(),window.addEventListener("resize",we),()=>{window.removeEventListener("resize",we)}},[]),p.useEffect(()=>{if(!t){Y.current!==null&&typeof window<"u"&&(window.clearTimeout(Y.current),Y.current=null),pe.current=null,ve.current=!1,w(null),y(!1);return}const we=sg(t.provider);H(we),I(Le(we))},[Le,t]),p.useEffect(()=>{if(!t||!e.current||typeof window>"u"){Y.current!==null&&(window.clearTimeout(Y.current),Y.current=null),pe.current=null,ve.current=!1,w(null);return}const we=e.current,qe=Ge=>{R.current||(pe.current=Ge,w(Ge),Ge||y(!1))},ke=()=>{Y.current!==null&&(window.clearTimeout(Y.current),Y.current=null)},Ee=(Ge,dt)=>{if(pe.current=Ge,ke(),dt!=null&&dt.immediate){qe(Ge);return}Y.current=window.setTimeout(()=>{Y.current=null,qe(pe.current)},V$)},$e=()=>{const Ge=ig(we);if(ve.current){pe.current=Ge;return}Ee(Ge)},wt=()=>{const Ge=ig(we);if(ve.current){pe.current=Ge;return}Ee(Ge,{immediate:!0})},me=Ge=>{!(Ge.target instanceof Node)||!we.contains(Ge.target)||(ve.current=!0,ke())},Pe=()=>{ve.current&&(ve.current=!1,Ee(ig(we)))};return document.addEventListener("pointerdown",me),document.addEventListener("selectionchange",$e),window.addEventListener("pointerup",Pe),window.addEventListener("pointercancel",Pe),window.addEventListener("mouseup",Pe),window.addEventListener("touchend",Pe),window.addEventListener("resize",wt),window.addEventListener("scroll",wt,!0),()=>{ke(),document.removeEventListener("pointerdown",me),document.removeEventListener("selectionchange",$e),window.removeEventListener("pointerup",Pe),window.removeEventListener("pointercancel",Pe),window.removeEventListener("mouseup",Pe),window.removeEventListener("touchend",Pe),window.removeEventListener("resize",wt),window.removeEventListener("scroll",wt,!0)}},[e,t]),p.useEffect(()=>{(!k||!(g!=null&&g.sourceMessageId))&&N(!1)},[k,g==null?void 0:g.sourceMessageId]),p.useEffect(()=>{if(!k||!t)return;let we=!1;return D===t.provider&&r?(E(!1),L(r),()=>{we=!0}):(E(!0),L(Ga(D)),zl(D,t.workspaceId).then(qe=>{we||L(qe)}).catch(()=>{we||L(Ga(D))}).finally(()=>{we||E(!1)}),()=>{we=!0})},[k,r,D,t]),p.useEffect(()=>{if(!k||!t){F({});return}let we=!1;return Nv($c,t.workspaceId).then(qe=>{we||F(qe)}),()=>{we=!0}},[k,t]),p.useEffect(()=>{if(!k||!t)return;const we=$c.filter(ke=>{const Ee=_[ke];return!Ee||Ee.canStartSession!==!1});if(we.length===0||we.includes(D))return;const qe=we[0];H(qe),I(Le(qe))},[k,Le,_,D,t]),p.useEffect(()=>{var qe;const we=Le(D);if(!Ce.some(ke=>ke.id===B)){if(Ce.some(ke=>ke.id===we)){I(we);return}I(((qe=Ce[0])==null?void 0:qe.id)??Jd)}},[Ce,Le,B,D]),p.useEffect(()=>{if(!k){R.current=!1;return}R.current=!0},[k]),p.useEffect(()=>{if(typeof window>"u")return;const we=qe=>{qe.key==="Escape"&&(y(!1),w(null),R.current=!1)};return window.addEventListener("keydown",we),()=>{window.removeEventListener("keydown",we)}},[]);async function Ke(){if(g)try{await K$(g.text,i),l({title:o("conversation.copyContentSuccess"),tone:"success"})}catch(we){l({title:we instanceof Error?we.message:o("conversation.copyContentFailed"),tone:"error"})}}function ut(){g&&(P({title:"",content:g.text}),U(we=>we+1),G(!0),y(!1),w(null),R.current=!1)}function vt(){if(!g||!t)return;const we=sg(t.provider);H(we),I(Le(we)),T(""),N(!1),y(!0)}async function Te(){var we,qe,ke,Ee;if(!(!g||!t)){if(Ue){l({title:Ue,tone:"error"});return}X(!0);try{const $e=Y$(g.text,S),wt=(Xe==null?void 0:Xe.id)===Jd?null:(Xe==null?void 0:Xe.id)??null;let me=null;if(j&&g.sourceMessageId)me=await jP(t.sessionId,{sourceType:"message",sourceMessageId:g.sourceMessageId,strategy:"auto",targetProvider:D,sessionKind:"annotation",annotationSourceMessageId:g.sourceMessageId,annotationSourceText:g.text}),f(me),await Rv(me.sessionId,{content:$e,clientRequestId:((qe=(we=globalThis.crypto)==null?void 0:we.randomUUID)==null?void 0:qe.call(we))??`selection-action-${Date.now()}-${Math.random().toString(16).slice(2)}`,model:wt});else{const Pe=await Dv({workspaceId:t.workspaceId,provider:D,content:$e,clientRequestId:((Ee=(ke=globalThis.crypto)==null?void 0:ke.randomUUID)==null?void 0:Ee.call(ke))??`selection-action-${Date.now()}-${Math.random().toString(16).slice(2)}`,model:wt,parentSessionId:t.sessionId,sessionKind:"annotation",annotationSourceMessageId:g.sourceMessageId??null,annotationSourceText:g.text});me=Pe.session??await Tv(Pe.sessionId)}f(me),d(),m(me.workspaceId),s(Yn(me.workspaceId,me.sessionId)),y(!1),w(null),R.current=!1}catch($e){l({title:$e instanceof Error?$e.message:o("conversation.selectionActionFailed"),tone:"error"})}finally{X(!1)}}}function _e(we=!1){y(!1),R.current=!1,we&&w(null)}return!t||!g||!ct||typeof document>"u"?n.jsx(rb,{open:K,preferredWorkspaceId:(t==null?void 0:t.workspaceId)??null,preferredSessionId:(t==null?void 0:t.sessionId)??null,creationRequestId:q,initialDraft:Q,onClose:()=>G(!1)}):n.jsxs(n.Fragment,{children:[Vn.createPortal(n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"conversation-selection-toolbar",style:ct,onMouseDown:we=>we.preventDefault(),children:[n.jsx("button",{type:"button",className:"conversation-selection-action",onClick:()=>void Ke(),children:o("conversation.copyAction")}),n.jsx("button",{type:"button",className:"conversation-selection-action",onClick:ut,children:o("conversation.selectionTodoAction")}),n.jsx("button",{type:"button",className:"conversation-selection-action is-primary",onClick:vt,children:o("conversation.selectionActionButton")})]}),k&&Nt?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:`conversation-selection-dialog-backdrop${Se?" is-mobile":""}`,onMouseDown:()=>_e(!1)}),n.jsxs("div",{className:`conversation-selection-action-dialog${Se?" is-centered":""}`,style:Nt,role:"dialog","aria-modal":"true","aria-label":o("conversation.selectionActionButton"),onMouseDown:we=>we.stopPropagation(),children:[n.jsxs("div",{className:"conversation-selection-action-dialog-header",children:[n.jsx("strong",{children:o("conversation.selectionActionButton")}),n.jsx("button",{type:"button",className:"conversation-selection-action-dialog-close","aria-label":o("common.close"),onClick:()=>_e(!1),children:"×"})]}),n.jsx("p",{className:"conversation-selection-action-dialog-quote",children:g.text}),n.jsxs("label",{className:"conversation-selection-field",children:[n.jsx("span",{children:o("conversation.selectionActionPromptLabel")}),n.jsx("textarea",{value:S,rows:4,placeholder:o("conversation.selectionActionPromptPlaceholder"),onChange:we=>T(we.target.value)})]}),n.jsxs("label",{className:"conversation-selection-checkbox",children:[n.jsx("input",{type:"checkbox",checked:j,disabled:!g.sourceMessageId,onChange:we=>N(we.target.checked)}),n.jsx("span",{children:o("conversation.selectionActionIncludeContext")})]}),g.sourceMessageId?null:n.jsx("p",{className:"conversation-selection-hint",children:o("conversation.selectionActionContextUnavailable")}),Ue?n.jsx("p",{className:"conversation-selection-hint",children:Ue}):null,n.jsxs("div",{className:"conversation-selection-grid",children:[n.jsxs("label",{className:"conversation-selection-field",children:[n.jsx("span",{children:o("conversation.forkTargetProviderLabel")}),n.jsx("select",{value:D,onChange:we=>{const qe=we.target.value;H(qe),I(Le(qe))},children:$c.map(we=>{var qe;return n.jsx("option",{value:we,disabled:((qe=_[we])==null?void 0:qe.canStartSession)===!1,children:Vs(we,"full")},we)})})]}),n.jsxs("label",{className:"conversation-selection-field",children:[n.jsx("span",{children:o("conversation.forkTargetModelLabel")}),n.jsx("select",{value:B,disabled:te||!!Ue,onChange:we=>I(we.target.value),children:Ce.map(we=>n.jsx("option",{value:we.id,children:we.name},we.id))})]})]}),n.jsxs("div",{className:"conversation-selection-actions",children:[n.jsx("button",{type:"button",className:"secondary-button",onClick:()=>_e(!1),children:o("common.cancel")}),n.jsx("button",{type:"button",className:"primary-button",disabled:se||!!Ue,onClick:()=>void Te(),children:o(se?"conversation.sendingState":"conversation.selectionActionSubmit")})]})]})]}):null]}),document.body),n.jsx(rb,{open:K,preferredWorkspaceId:t.workspaceId,preferredSessionId:t.sessionId,creationRequestId:q,initialDraft:Q,onClose:()=>G(!1)})]})}const Q$=new Set(["abstract","as","async","await","break","case","catch","class","const","continue","default","delete","do","else","enum","export","extends","false","finally","for","from","function","if","implements","import","in","instanceof","interface","let","new","null","package","private","protected","public","readonly","return","static","super","switch","this","throw","true","try","type","typeof","undefined","var","void","while","with","yield"]),J$=new Set(["and","as","assert","async","await","break","class","continue","def","del","elif","else","except","False","finally","for","from","global","if","import","in","is","lambda","None","nonlocal","not","or","pass","raise","return","True","try","while","with","yield"]),Z$=new Set(["case","do","done","elif","else","esac","export","fi","for","function","if","in","local","readonly","return","then","until","while"]),eV=new Set(["add","alter","and","as","asc","between","by","create","delete","desc","drop","from","group","having","insert","into","join","left","like","limit","not","null","offset","on","or","order","right","select","set","table","union","update","values","where"]),tV=new Set(["add","arg","cmd","copy","entrypoint","env","expose","from","healthcheck","label","maintainer","onbuild","run","shell","stopsignal","user","volume","workdir","as"]),nV=new Set(["trace","debug","info","warn","warning","error","fatal"]);function IR({workspaceId:e,filePath:t,open:r,onClose:s,onSaved:i,diffContent:l}){const[c,d]=p.useState(null),[m,f]=p.useState(""),[v,g]=p.useState(!1),[w,k]=p.useState(!1),[y,S]=p.useState("preview"),[T,j]=p.useState("default"),[N,D]=p.useState(0),[H,B]=p.useState("fit"),[I,A]=p.useState(1),[L,_]=p.useState(1),[F,te]=p.useState(110),[E,se]=p.useState(!0),{showToast:X}=Qn(),K=sr(),G=p.useRef(s),q=p.useRef(X),U=p.useMemo(()=>uw(t),[t]),Q=p.useMemo(()=>AV(l),[l]),P=(c==null?void 0:c.kind)??null,W=!!(c!=null&&c.capabilities.canEdit),J=!!(c!=null&&c.capabilities.canRefresh),R=aV(P,U),ve=p.useMemo(()=>oV(c,K.isDesktop),[K.isDesktop,c]),pe=p.useMemo(()=>Pb(ve,N),[ve,N]),Y=p.useMemo(()=>lV(ve,N,L,F,E),[ve,N,L,F,E]),Se=p.useMemo(()=>Pb(ve,N),[ve,N]),Le=(c==null?void 0:c.content)??"",re=W&&m!==Le,Ce=FR(P),Xe=Nb(P);if(p.useEffect(()=>{G.current=s},[s]),p.useEffect(()=>{q.current=X},[X]),p.useEffect(()=>{if(!r){d(null),f(""),g(!1),k(!1),S(ER(t,null)),LR({setResourceRefreshVersion:D,setImageScale:A,setImageScaleMode:B,setPdfPage:_,setPdfScale:te,setPdfFitWidth:se}),j("default");return}if(!e||!t)return;const _e=e,we=t;let qe=!1;async function ke(){g(!0);try{const Ee=await wf(_e,we);qe||ag(Ee,we,{preserveMode:!1,setPreview:d,setEditorContent:f,setMode:S,setResourceRefreshVersion:D,setImageScale:A,setImageScaleMode:B,setPdfPage:_,setPdfScale:te,setPdfFitWidth:se})}catch(Ee){qe||(q.current({title:og(Ee,o("conversation.filePanelOpenFailed")),tone:"error"}),G.current())}finally{qe||g(!1)}}return ke(),()=>{qe=!0}},[t,r,e]),p.useEffect(()=>{if(!r)return;function _e(we){we.key==="Escape"&&s()}return window.addEventListener("keydown",_e),()=>{window.removeEventListener("keydown",_e)}},[s,r]),!r||!t||typeof document>"u")return null;const Ue=t,ct=e;async function Nt(){if(!(!ct||!(c!=null&&c.version)||!W)){k(!0);try{await nO(ct,Ue,m,c.version);const _e=await wf(ct,Ue);ag(_e,Ue,{preserveMode:!1,setPreview:d,setEditorContent:f,setMode:S,setResourceRefreshVersion:D,setImageScale:A,setImageScaleMode:B,setPdfPage:_,setPdfScale:te,setPdfFitWidth:se}),await i(Ue),X({title:o("conversation.filePanelSaveSuccess"),tone:"success"})}catch(_e){X({title:og(_e,o("conversation.filePanelSaveFailed")),tone:"error"})}finally{k(!1)}}}async function Ke(){if(!(!ct||!J||re)){g(!0);try{const _e=await wf(ct,Ue);ag(_e,Ue,{preserveMode:!0,setPreview:d,setEditorContent:f,setMode:S,setResourceRefreshVersion:D,setImageScale:A,setImageScaleMode:B,setPdfPage:_,setPdfScale:te,setPdfFitWidth:se}),D(we=>we+1)}catch(_e){X({title:og(_e,o("conversation.fileViewerRefreshFailed")),tone:"error"})}finally{g(!1)}}}async function ut(){if(!ve)return;const _e=await K.bridge.openExternal(ve);_e.ok||X({title:_e.detail??o("conversation.fileViewerOpenExternalFailed"),tone:"error"})}const vt=sV({canShowPreviewTab:Ce,canShowCodeTab:Xe,canEdit:W}),Te=iV({preview:c,isDirty:re,handleRefreshPreview:Ke,handleOpenExternal:ut,imageScaleMode:H,imageScale:I,setImageScale:A,setImageScaleMode:B,pdfPage:L,setPdfPage:_,pdfScale:F,setPdfScale:te,pdfFitWidth:E,setPdfFitWidth:se});return Vn.createPortal(n.jsxs("div",{className:"workbench-modal-layer",children:[n.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":o("common.close"),onClick:s}),n.jsxs("section",{className:"workbench-modal-card surface-card file-viewer-modal","data-size":T,"data-resizable":K.isDesktop&&T!=="full"?"true":void 0,role:"dialog","aria-modal":"true","aria-label":t,children:[n.jsxs("div",{className:"workbench-modal-header",children:[n.jsxs("div",{className:"workbench-modal-title-wrap",children:[n.jsx("h2",{children:t}),n.jsx("p",{children:o("conversation.fileViewerHint").replace("{language}",R)})]}),n.jsx(zo,{onClick:s})]}),n.jsxs("div",{className:"file-viewer-toolbar",children:[n.jsxs("div",{className:"file-viewer-toolbar-start",children:[n.jsxs("div",{className:"file-viewer-tabs",role:"tablist","aria-label":o("conversation.fileViewerModeLabel"),children:[vt.includes("preview")?n.jsx("button",{type:"button",className:"file-viewer-tab","data-active":y==="preview",role:"tab","aria-selected":y==="preview",onClick:()=>S("preview"),children:o("conversation.fileViewerPreview")}):null,vt.includes("code")?n.jsx("button",{type:"button",className:"file-viewer-tab","data-active":y==="code",role:"tab","aria-selected":y==="code",onClick:()=>S("code"),children:o("conversation.fileViewerCode")}):null,vt.includes("edit")?n.jsx("button",{type:"button",className:"file-viewer-tab","data-active":y==="edit",role:"tab","aria-selected":y==="edit",onClick:()=>S("edit"),disabled:!W,children:o("conversation.fileViewerEdit")}):null]}),n.jsx("span",{className:"file-viewer-language",children:R})]}),n.jsxs("div",{className:"file-viewer-toolbar-end",children:[n.jsxs("div",{className:"file-viewer-size-group",role:"group","aria-label":o("conversation.fileViewerSizeLabel"),children:[n.jsx("button",{type:"button",className:"secondary-button file-viewer-action-button","data-active":T==="default",onClick:()=>j("default"),children:o("conversation.fileViewerSizeDefault")}),n.jsx("button",{type:"button",className:"secondary-button file-viewer-action-button","data-active":T==="wide",onClick:()=>j("wide"),children:o("conversation.fileViewerSizeWide")}),n.jsx("button",{type:"button",className:"secondary-button file-viewer-action-button","data-active":T==="full",onClick:()=>j("full"),children:o("conversation.fileViewerSizeFull")})]}),n.jsx("div",{className:"file-viewer-actions",children:Te.map(_e=>n.jsx("button",{type:"button",className:"secondary-button file-viewer-action-button","data-active":_e.active?"true":void 0,onClick:()=>void _e.onClick(),disabled:_e.disabled,children:_e.label},_e.id))}),W?n.jsx("button",{type:"button",className:"primary-button",onClick:()=>void Nt(),disabled:!re||w,children:o(w?"conversation.filePanelSaving":"conversation.filePanelSave")}):null]})]}),n.jsx("div",{className:"workbench-modal-body file-viewer-body",children:v?n.jsx("p",{className:"status-text",children:o("common.loading")}):(c==null?void 0:c.supported)===!1?n.jsx("p",{className:"status-text",children:c.reason??o("conversation.filePanelUnsupported")}):y==="edit"?n.jsx("textarea",{className:"file-viewer-editor","data-testid":"file-viewer-editor",value:m,onChange:_e=>f(_e.target.value),spellCheck:!1}):y==="preview"&&P==="html"?n.jsx(cV,{src:Se,filePath:t}):y==="preview"&&P==="image"?n.jsx(uV,{src:pe,filePath:t,scale:I,scaleMode:H}):y==="preview"&&P==="pdf"?n.jsx(dV,{src:Y,filePath:t}):y==="preview"&&P==="markdown"?n.jsx(hV,{content:m}):n.jsx(_R,{content:m,language:U,overviewMarkers:Q})})]})]}),document.body)}function ER(e,t){return t==="markdown"||t==="html"||t==="image"||t==="pdf"||PV(e??"")||DV(e??"")?"preview":"code"}function ag(e,t,r){r.setPreview(e),r.setEditorContent(e.content??""),r.setMode(s=>r.preserveMode&&rV(s,e.kind)?s:ER(t,e.kind)),LR(r)}function LR(e){e.setResourceRefreshVersion(0),e.setImageScale(1),e.setImageScaleMode("fit"),e.setPdfPage(1),e.setPdfScale(110),e.setPdfFitWidth(!0)}function FR(e){return e==="markdown"||e==="html"||e==="image"||e==="pdf"}function Nb(e){return e==="text"||e==="markdown"||e==="html"}function rV(e,t){return e==="preview"?FR(t):Nb(t)}function sV(e){const t=[];return e.canShowPreviewTab&&t.push("preview"),e.canShowCodeTab?(t.push("code"),t.push("edit")):e.canEdit&&t.push("edit"),t}function iV(e){var s;if(!((s=e.preview)!=null&&s.supported))return[];const t=[],r=!e.preview.capabilities.canRefresh||e.isDirty;return e.preview.kind==="image"&&t.push({id:"image-zoom-out",label:o("conversation.fileViewerZoomOut"),onClick:()=>{e.setImageScaleMode("custom"),e.setImageScale(i=>Math.max(.25,sj(i-.25)))}},{id:"image-zoom-in",label:o("conversation.fileViewerZoomIn"),onClick:()=>{e.setImageScaleMode("custom"),e.setImageScale(i=>Math.min(4,sj(i+.25)))}},{id:"image-fit",label:o("conversation.fileViewerFit"),active:e.imageScaleMode==="fit",onClick:()=>{e.setImageScaleMode("fit"),e.setImageScale(1)}},{id:"image-actual",label:o("conversation.fileViewerActualSize"),active:e.imageScaleMode==="actual",onClick:()=>{e.setImageScaleMode("actual"),e.setImageScale(1)}},{id:"image-refresh",label:o("conversation.fileViewerRefreshPreview"),disabled:r,onClick:e.handleRefreshPreview}),e.preview.kind==="pdf"&&t.push({id:"pdf-prev-page",label:o("conversation.fileViewerPreviousPage"),disabled:e.pdfPage<=1,onClick:()=>e.setPdfPage(i=>Math.max(1,i-1))},{id:"pdf-page-indicator",label:o("conversation.fileViewerPageIndicator").replace("{page}",String(e.pdfPage)),disabled:!0,onClick:()=>{}},{id:"pdf-next-page",label:o("conversation.fileViewerNextPage"),onClick:()=>e.setPdfPage(i=>i+1)},{id:"pdf-zoom-out",label:o("conversation.fileViewerZoomOut"),onClick:()=>{e.setPdfFitWidth(!1),e.setPdfScale(i=>Math.max(50,Math.round(i-10)))}},{id:"pdf-zoom-in",label:o("conversation.fileViewerZoomIn"),onClick:()=>{e.setPdfFitWidth(!1),e.setPdfScale(i=>Math.min(300,Math.round(i+10)))}},{id:"pdf-fit-width",label:o("conversation.fileViewerFitWidth"),active:e.pdfFitWidth,onClick:()=>e.setPdfFitWidth(!0)},{id:"pdf-refresh",label:o("conversation.fileViewerRefreshPreview"),disabled:r,onClick:e.handleRefreshPreview}),(e.preview.kind==="html"||e.preview.kind==="markdown"||e.preview.kind==="text")&&t.push({id:"text-refresh",label:o("conversation.fileViewerRefreshPreview"),disabled:r,onClick:e.handleRefreshPreview}),e.preview.previewUrl&&t.push({id:"open-external",label:o("conversation.fileViewerOpenExternal"),onClick:e.handleOpenExternal}),t}function aV(e,t){switch(e){case"image":return o("conversation.fileViewerImage");case"pdf":return o("conversation.fileViewerPdf");case"html":return"HTML";case"markdown":return"Markdown";default:return BR(t)}}function Pb(e,t){if(!e)return null;const r=new URL(e,window.location.origin);return r.searchParams.set("_preview",String(t)),r.hash="",r.toString()}function oV(e,t){var r;return e?!t&&e.previewPath&&typeof window<"u"&&((r=window.location)!=null&&r.origin)?new URL(e.previewPath,window.location.origin).toString():e.previewUrl??null:null}function lV(e,t,r,s,i){const l=Pb(e,t);if(!l)return null;const c=new URL(l,window.location.origin),d=new URLSearchParams;return d.set("page",String(r)),d.set("zoom",i?"page-width":String(s)),c.hash=d.toString(),c.toString()}function sj(e){return Math.round(e*100)/100}function cV({src:e,filePath:t}){return e?n.jsx("div",{className:"file-viewer-html-frame-shell",children:n.jsx("iframe",{className:"file-viewer-html-frame","data-testid":"file-viewer-html-preview",title:t,src:e,sandbox:"allow-forms allow-modals allow-scripts"},e)}):n.jsx("p",{className:"status-text",children:o("conversation.fileViewerHtmlPreviewUnavailable")})}function uV({src:e,filePath:t,scale:r,scaleMode:s}){return e?n.jsx("div",{className:"file-viewer-media-shell","data-mode":s,children:n.jsx("div",{className:"file-viewer-image-stage",children:n.jsx("img",{className:"file-viewer-image","data-testid":"file-viewer-image-preview","data-mode":s,src:e,alt:t,style:s==="fit"?void 0:{transform:`scale(${r})`}})})}):n.jsx("p",{className:"status-text",children:o("conversation.fileViewerImageUnavailable")})}function dV({src:e,filePath:t}){return e?n.jsx("div",{className:"file-viewer-pdf-shell",children:n.jsx("iframe",{className:"file-viewer-pdf-frame","data-testid":"file-viewer-pdf-preview",title:t,src:e},e)}):n.jsx("p",{className:"status-text",children:o("conversation.fileViewerPdfUnavailable")})}function hV({content:e}){return n.jsx("div",{className:"markdown-content file-viewer-markdown",children:n.jsx(j0,{remarkPlugins:[Y0],components:{code(t){const r=typeof t.className=="string"?t.className:"",s=/language-([\w-]+)/.exec(r);return s?n.jsx(_R,{content:String(t.children).replace(/\n$/,""),language:dw(s[1]??"plain")}):n.jsx("code",{className:r||void 0,children:t.children})}},children:e})})}function _R({content:e,language:t,overviewMarkers:r=[]}){const s=e.split(/\r?\n/),i=p.useRef(null),l=p.useMemo(()=>{const c=new Map;for(const d of r)for(let m=0;m<d.span;m++)c.set(d.line+m,d.kind);return c},[r]);return n.jsxs("div",{className:"file-viewer-code-block",children:[n.jsx("div",{className:"file-viewer-code-header",children:BR(t)}),n.jsxs("div",{className:"file-viewer-scroll-shell",children:[n.jsx("div",{className:"file-viewer-code-body",ref:i,children:s.map((c,d)=>{const m=mV(c,t),f=d+1,v=l.get(f);return n.jsxs("div",{className:`file-viewer-code-line${v?` diff-line-${v}`:""}`,children:[n.jsx("span",{className:"file-viewer-code-gutter",children:f}),n.jsx("code",{className:"file-viewer-code-content",children:m.length?m.map((g,w)=>n.jsx("span",{className:`code-token ${g.kind}`,children:g.text},`${d}-${w}-${g.text}`)):n.jsx("span",{className:"code-token plain",children:" "})})]},`${d}-${c}`)})}),n.jsx(IV,{markers:r,totalLines:s.length,scrollContainerRef:i})]})]})}function mV(e,t){const r=dw(t);return r==="json"?pV(e):r==="yaml"?vV(e):r==="toml"?wV(e):r==="ini"?OR(e):r==="env"?yV(e):r==="properties"?kV(e):r==="conf"?xV(e):r==="editorconfig"?SV(e):r==="dockerfile"?CV(e):r==="gitignore"?jV(e):r==="log"?TV(e):r==="python"?eu(e,J$,"#"):r==="shell"?eu(e,Z$,"#"):r==="sql"?bV(e):r==="html"||r==="xml"?fV(e):r==="css"?gV(e):r==="markdown"?[{text:e,kind:"plain"}]:eu(e,Q$,"//")}function eu(e,t,r){const s=[];let i=0;for(;i<e.length;){const l=e.slice(i);if(l.startsWith(r)){s.push({text:l,kind:"comment"});break}const c=/^(?:'[^'\\]*(?:\\.[^'\\]*)*'|"[^"\\]*(?:\\.[^"\\]*)*"|`[^`\\]*(?:\\.[^`\\]*)*`)/.exec(l);if(c){s.push({text:c[0],kind:"string"}),i+=c[0].length;continue}const d=/^(?:0x[\da-fA-F]+|\d+(?:\.\d+)?(?:e[+-]?\d+)?)/.exec(l);if(d){s.push({text:d[0],kind:"number"}),i+=d[0].length;continue}const m=/^[A-Za-z_][\w$-]*/.exec(l);if(m){const v=m[0],g=v.toLowerCase();v==="true"||v==="false"||g==="true"||g==="false"?s.push({text:v,kind:"boolean"}):v==="null"||v==="None"||g==="none"?s.push({text:v,kind:"null"}):t.has(v)||t.has(g)?s.push({text:v,kind:"keyword"}):s.push({text:v,kind:"plain"}),i+=v.length;continue}const f=/^(?:===|!==|==|!=|<=|>=|=>|&&|\|\||[+\-*/%=<>!?:|&^~]+)/.exec(l);if(f){s.push({text:f[0],kind:"operator"}),i+=f[0].length;continue}s.push({text:l[0]??"",kind:"plain"}),i+=1}return s}function pV(e){const t=[];let r=0;for(;r<e.length;){const s=e.slice(r),i=/^"(?:[^"\\]|\\.)*"/.exec(s);if(i){const m=e.slice(r+i[0].length).trimStart()[0];t.push({text:i[0],kind:m===":"?"attr":"string"}),r+=i[0].length;continue}const l=/^(?:-?\d+(?:\.\d+)?(?:e[+-]?\d+)?)/i.exec(s);if(l){t.push({text:l[0],kind:"number"}),r+=l[0].length;continue}const c=/^(?:true|false|null)\b/.exec(s);if(c){const m=c[0]==="null"?"null":"boolean";t.push({text:c[0],kind:m}),r+=c[0].length;continue}const d=/^(?::|,|\{|\}|\[|\])/.exec(s);if(d){t.push({text:d[0],kind:"operator"}),r+=d[0].length;continue}t.push({text:s[0]??"",kind:"plain"}),r+=1}return t}function fV(e){const t=[];let r=0;for(;r<e.length;){const s=e.slice(r);if(s.startsWith("<!--")){t.push({text:s,kind:"comment"});break}const i=/^(<\/?[\w:-]+)/.exec(s);if(i){t.push({text:i[0],kind:"tag"}),r+=i[0].length;continue}const l=/^([\w:-]+)(=)/.exec(s);if(l){t.push({text:l[1]??"",kind:"attr"}),t.push({text:l[2]??"",kind:"operator"}),r+=l[0].length;continue}const c=/^(?:'[^']*'|"[^"]*")/.exec(s);if(c){t.push({text:c[0],kind:"string"}),r+=c[0].length;continue}const d=/^(?:\/?>)/.exec(s);if(d){t.push({text:d[0],kind:"operator"}),r+=d[0].length;continue}t.push({text:s[0]??"",kind:"plain"}),r+=1}return t}function gV(e){const t=[];let r=0;for(;r<e.length;){const s=e.slice(r);if(s.startsWith("/*")){t.push({text:s,kind:"comment"});break}const i=/^(?:'[^']*'|"[^"]*")/.exec(s);if(i){t.push({text:i[0],kind:"string"}),r+=i[0].length;continue}const l=/^([A-Za-z-]+)(\s*:)/.exec(s);if(l){t.push({text:l[1]??"",kind:"attr"}),t.push({text:l[2]??"",kind:"operator"}),r+=l[0].length;continue}const c=/^(?:#(?:[\da-fA-F]{3,8})|\d+(?:\.\d+)?(?:px|rem|em|vh|vw|%)?)/.exec(s);if(c){t.push({text:c[0],kind:"number"}),r+=c[0].length;continue}const d=/^(?:@media|@supports|@import|@keyframes)\b/.exec(s);if(d){t.push({text:d[0],kind:"keyword"}),r+=d[0].length;continue}const m=/^(?:[{}:;(),.>])/.exec(s);if(m){t.push({text:m[0],kind:"operator"}),r+=m[0].length;continue}t.push({text:s[0]??"",kind:"plain"}),r+=1}return t}function bV(e){return eu(e,eV,"--")}function vV(e){const t=[];let r=0;for(;r<e.length;){const s=e.slice(r);if(s.startsWith("#")){t.push({text:s,kind:"comment"});break}const i=/^([A-Za-z0-9_.-]+)(\s*:)/.exec(s);if(i){t.push({text:i[1]??"",kind:"attr"}),t.push({text:i[2]??"",kind:"operator"}),r+=i[0].length;continue}const l=/^(?:'[^']*'|"[^"]*")/.exec(s);if(l){t.push({text:l[0],kind:"string"}),r+=l[0].length;continue}const c=/^(?:-?\d+(?:\.\d+)?)/.exec(s);if(c){t.push({text:c[0],kind:"number"}),r+=c[0].length;continue}const d=/^(?:true|false|yes|no|null|~)\b/i.exec(s);if(d){const f=d[0].toLowerCase(),v=f==="null"||f==="~"?"null":"boolean";t.push({text:d[0],kind:v}),r+=d[0].length;continue}const m=/^(?:[-?:,[\]{}|>])/.exec(s);if(m){t.push({text:m[0],kind:"operator"}),r+=m[0].length;continue}t.push({text:s[0]??"",kind:"plain"}),r+=1}return t}function wV(e){const t=[];let r=0;for(;r<e.length;){const s=e.slice(r);if(s.startsWith("#")){t.push({text:s,kind:"comment"});break}const i=/^(\[\[?[^\]]+\]?\])/.exec(s);if(i){t.push({text:i[0],kind:"tag"}),r+=i[0].length;continue}const l=/^([A-Za-z0-9_.-]+)(\s*=)/.exec(s);if(l){t.push({text:l[1]??"",kind:"attr"}),t.push({text:l[2]??"",kind:"operator"}),r+=l[0].length;continue}const c=Fm(s,{trueValues:["true"],falseValues:["false"],nullValues:[]});if(c){t.push(...c.tokens),r+=c.length;continue}const d=/^(?:[,[\]{}])/.exec(s);if(d){t.push({text:d[0],kind:"operator"}),r+=d[0].length;continue}t.push({text:s[0]??"",kind:"plain"}),r+=1}return t}function OR(e){const t=[];let r=0;for(;r<e.length;){const s=e.slice(r),i=s.trimStart();if(i.startsWith(";")||i.startsWith("#")){t.push({text:s,kind:"comment"});break}const l=/^(\[[^\]]+\])/.exec(s);if(l){t.push({text:l[0],kind:"tag"}),r+=l[0].length;continue}const c=/^([A-Za-z0-9_.-]+)(\s*[=:])/.exec(s);if(c){t.push({text:c[1]??"",kind:"attr"}),t.push({text:c[2]??"",kind:"operator"}),r+=c[0].length;continue}const d=Fm(s,{trueValues:["true","yes","on"],falseValues:["false","no","off"],nullValues:["null"]});if(d){t.push(...d.tokens),r+=d.length;continue}t.push({text:s[0]??"",kind:"plain"}),r+=1}return t}function yV(e){if(e.trimStart().startsWith("#"))return[{text:e,kind:"comment"}];const r=/^(\s*)(export)(\s+)/.exec(e),s=r?r[0].length:0,i=[];r&&(i.push({text:r[1]??"",kind:"plain"}),i.push({text:r[2]??"",kind:"keyword"}),i.push({text:r[3]??"",kind:"plain"}));const l=e.slice(s),c=/^([A-Za-z_][A-Za-z0-9_]*)(=)/.exec(l);if(!c)return OR(e);i.push({text:c[1]??"",kind:"attr"}),i.push({text:c[2]??"",kind:"operator"});const d=l.slice(c[0].length),m=Fm(d,{trueValues:["true"],falseValues:["false"],nullValues:["null"]});return m?(i.push(...m.tokens),i):(i.push({text:d,kind:"plain"}),i)}function kV(e){return cw(e,{commentPrefixes:["#","!"],allowSection:!1,delimiters:["=",":"]})}function xV(e){return cw(e,{commentPrefixes:["#",";"],allowSection:!0,delimiters:["=",":"]})}function SV(e){return cw(e,{commentPrefixes:["#",";"],allowSection:!0,delimiters:["="]})}function CV(e){return eu(e,tV,"#")}function jV(e){const t=e.trimStart();if(!t)return[];if(t.startsWith("#"))return[{text:e,kind:"comment"}];if(t.startsWith("!")){const r=e.length-t.length,s=e.slice(0,r),i=t.slice(1);return[{text:s,kind:"plain"},{text:"!",kind:"operator"},{text:i,kind:"string"}]}return[{text:e,kind:"string"}]}function TV(e){const t=[];let r=0;for(;r<e.length;){const s=e.slice(r);if(s.startsWith("#")){t.push({text:s,kind:"comment"});break}const i=/^(?:\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}:\d{2}(?:[.,]\d{3,6})?(?:Z|[+-]\d{2}:\d{2})?)/.exec(s);if(i){t.push({text:i[0],kind:"tag"}),r+=i[0].length;continue}const l=/^(?:\[(TRACE|DEBUG|INFO|WARN|WARNING|ERROR|FATAL)\])/.exec(s);if(l){t.push({text:s.slice(0,l[0].length),kind:"keyword"}),r+=l[0].length;continue}const c=/^[A-Za-z_][\w-]*/.exec(s);if(c){const m=c[0];nV.has(m.toLowerCase())?t.push({text:m,kind:"keyword"}):t.push({text:m,kind:"plain"}),r+=m.length;continue}const d=/^(?:\d+(?:\.\d+)?)/.exec(s);if(d){t.push({text:d[0],kind:"number"}),r+=d[0].length;continue}t.push({text:s[0]??"",kind:"plain"}),r+=1}return t}function cw(e,t){const r=e.trimStart();if(t.commentPrefixes.some(m=>r.startsWith(m)))return[{text:e,kind:"comment"}];if(t.allowSection){const m=/^(\[[^\]]+\])/.exec(e);if(m)return[{text:m[0],kind:"tag"}]}const s=/^([A-Za-z0-9_.\-*?]+)(\s*(?:=|:))/.exec(e);if(!s)return[{text:e,kind:"plain"}];const i=(s[2]??"").trim();if(!t.delimiters.includes(i))return[{text:e,kind:"plain"}];const l=[{text:s[1]??"",kind:"attr"},{text:s[2]??"",kind:"operator"}],c=e.slice(s[0].length),d=NV(c);return d.length&&l.push(...d),l}function NV(e){if(!e)return[];const t=[];let r=0;for(;r<e.length;){const s=e.slice(r),i=Fm(s,{trueValues:["true","yes","on"],falseValues:["false","no","off"],nullValues:["null"]});if(i){t.push(...i.tokens),r+=i.length;continue}if(s.startsWith("#")||s.startsWith(";")){t.push({text:s,kind:"comment"});break}t.push({text:s[0]??"",kind:"plain"}),r+=1}return t}function Fm(e,t){const r=/^(?:'[^']*'|"[^"]*")/.exec(e);if(r)return{tokens:[{text:r[0],kind:"string"}],length:r[0].length};const s=/^(?:-?\d+(?:\.\d+)?)/.exec(e);if(s)return{tokens:[{text:s[0],kind:"number"}],length:s[0].length};const i=/^[A-Za-z0-9_.:+/-]+/.exec(e);if(!i)return null;const l=i[0],c=l.toLowerCase();return t.trueValues.includes(c)?{tokens:[{text:l,kind:"boolean"}],length:l.length}:t.falseValues.includes(c)?{tokens:[{text:l,kind:"boolean"}],length:l.length}:t.nullValues.includes(c)?{tokens:[{text:l,kind:"null"}],length:l.length}:{tokens:[{text:l,kind:"plain"}],length:l.length}}function uw(e){var s,i;if(!e)return"plain";const t=((s=e.split(/[\\/]/).pop())==null?void 0:s.toLowerCase())??"";if(t===".env"||t.startsWith(".env."))return"env";if(t===".editorconfig")return"editorconfig";if(t==="dockerfile"||t.endsWith(".dockerfile"))return"dockerfile";if(t===".gitignore")return"gitignore";switch(((i=e.split(".").pop())==null?void 0:i.toLowerCase())??""){case"md":case"markdown":return"markdown";case"ts":case"tsx":return"typescript";case"js":case"jsx":case"mjs":case"cjs":return"javascript";case"json":return"json";case"log":return"log";case"properties":return"properties";case"toml":return"toml";case"ini":return"ini";case"conf":return"conf";case"dockerfile":return"dockerfile";case"css":case"scss":case"less":return"css";case"html":case"htm":return"html";case"xml":case"svg":return"xml";case"py":return"python";case"sh":case"bash":case"zsh":return"shell";case"sql":return"sql";case"yml":case"yaml":return"yaml";case"rs":return"rust";case"go":return"go";case"java":return"java";case"c":case"h":case"cpp":case"cc":case"hpp":return"cpp";default:return"plain"}}function dw(e){const t=e.toLowerCase();switch(t){case"ts":case"tsx":case"typescript":return"typescript";case"js":case"jsx":case"javascript":return"javascript";case"bash":case"shell":case"sh":case"zsh":return"shell";case"md":case"markdown":return"markdown";case"properties":return"properties";case"toml":return"toml";case"ini":return"ini";case"env":return"env";case"conf":return"conf";case"editorconfig":return"editorconfig";case"dockerfile":return"dockerfile";case"gitignore":return"gitignore";case"log":return"log";default:return t}}function BR(e){switch(dw(e)){case"typescript":return"TypeScript";case"javascript":return"JavaScript";case"markdown":return"Markdown";case"json":return"JSON";case"properties":return"Properties";case"toml":return"TOML";case"ini":return"INI";case"env":return"ENV";case"conf":return"CONF";case"editorconfig":return"EditorConfig";case"dockerfile":return"Dockerfile";case"gitignore":return"GitIgnore";case"log":return"Log";case"css":return"CSS";case"html":return"HTML";case"xml":return"XML";case"python":return"Python";case"shell":return"Shell";case"sql":return"SQL";case"yaml":return"YAML";case"rust":return"Rust";case"go":return"Go";case"java":return"Java";case"cpp":return"C/C++";default:return o("conversation.fileViewerPlainText")}}function PV(e){return uw(e)==="markdown"}function DV(e){return uw(e)==="html"}function og(e,t){return e instanceof Kr?e.message:t}function RV(e){const t=[],r=e.replace(/\r\n/g,`
|
|
116
|
-
`).split(`
|
|
117
|
-
`);let s=0,i=0;for(const l of r){if(l.startsWith("diff --git")||l.startsWith("index ")||l.startsWith("--- ")||l.startsWith("+++ ")){t.push({kind:"meta",text:l,oldLineNo:null,newLineNo:null});continue}const c=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(l);if(c){s=parseInt(c[1],10),i=parseInt(c[2],10),t.push({kind:"hunk",text:l,oldLineNo:null,newLineNo:null});continue}if(l.startsWith(" ")||l===""){t.push({kind:"context",text:l.slice(1),oldLineNo:s,newLineNo:i}),s++,i++;continue}if(l.startsWith("+")){t.push({kind:"add",text:l.slice(1),oldLineNo:null,newLineNo:i}),i++;continue}if(l.startsWith("-")){t.push({kind:"remove",text:l.slice(1),oldLineNo:s,newLineNo:null}),s++;continue}t.push({kind:"meta",text:l,oldLineNo:null,newLineNo:null})}return t}function AV(e){if(!(e!=null&&e.trim()))return[];const t=RV(e),r=[];let s=0,i=[];function l(){if(i.length===0){s=0;return}const c=s>0?"modify":"add";MV(r,i,c),s=0,i=[]}for(const c of t){if(c.kind==="remove"){s+=1;continue}if(c.kind==="add"){c.newLineNo!==null&&i.push(c.newLineNo);continue}l()}return l(),r}function MV(e,t,r){const s=t.filter(c=>c>0);if(s.length===0)return;let i=s[0]??1,l=i;for(let c=1;c<s.length;c+=1){const d=s[c]??l;if(d===l+1){l=d;continue}e.push({line:i,span:l-i+1,kind:r}),i=d,l=d}e.push({line:i,span:l-i+1,kind:r})}function IV({markers:e,totalLines:t,scrollContainerRef:r}){const[s,i]=p.useState({top:0,height:0});if(p.useEffect(()=>{const c=r.current;if(!c){i({top:0,height:0});return}const d=c;function m(){const{clientHeight:f,scrollHeight:v,scrollTop:g}=d;if(v<=0||f<=0||v<=f){i({top:0,height:0});return}const w=f/v,k=Math.min(100,Math.max(12,w*100)),y=v-f,S=Math.max(0,100-k),T=y<=0?0:g/y*S;i({top:T,height:k})}return m(),d.addEventListener("scroll",m,{passive:!0}),window.addEventListener("resize",m),()=>{d.removeEventListener("scroll",m),window.removeEventListener("resize",m)}},[r]),e.length===0&&s.height===0)return null;const l=Math.max(t,1);return n.jsxs("div",{className:"file-overview-ruler","data-testid":"file-overview-ruler","aria-hidden":"true",children:[e.map(c=>{const d=(c.line-1)/l*100,m=Math.max(2,c.span/l*100);return n.jsx("div",{className:`file-overview-marker is-${c.kind}`,"data-kind":c.kind,style:{top:`${d}%`,height:`${m}%`}},`${c.kind}-${c.line}-${c.span}`)}),s.height>0?n.jsx("div",{className:"file-overview-viewport",style:{top:`${s.top}%`,height:`${s.height}%`}}):null]})}function Wo(e){const t=e.toLowerCase();if(t===".env"||t.startsWith(".env."))return"ENV";if(t.endsWith(".d.ts"))return"DTS";switch(t.includes(".")?t.slice(t.lastIndexOf(".")+1):""){case"ts":return"TS";case"tsx":return"TSX";case"js":return"JS";case"jsx":return"JSX";case"json":return"{}";case"md":return"MD";case"css":return"CSS";case"scss":return"SASS";case"html":return"HTML";case"yml":case"yaml":return"YAML";case"png":case"jpg":case"jpeg":case"gif":case"svg":case"webp":return"IMG";case"txt":return"TXT";default:return"FILE"}}function Uo(e){const t=e.toLowerCase();return t===".env"||t.startsWith(".env.")?"env":t.endsWith(".md")?"md":t.endsWith(".css")||t.endsWith(".scss")?"style":t.endsWith(".png")||t.endsWith(".jpg")||t.endsWith(".jpeg")||t.endsWith(".gif")||t.endsWith(".svg")||t.endsWith(".webp")?"image":t.endsWith(".ts")||t.endsWith(".tsx")||t.endsWith(".js")||t.endsWith(".jsx")?"code":t.endsWith(".json")||t.endsWith(".yml")||t.endsWith(".yaml")?"data":"default"}const EV=new Set([".ds_store","thumbs.db","ehthumbs.db","desktop.ini",".spotlight-v100",".trashes",".fseventsd","__macosx","$recycle.bin","system volume information",".apdisk",".appledouble",".temporaryitems"]),LV=["._"];function lg(e){return e.split(/[/\\]/).filter(Boolean).pop()??e}function FV(e){const t=e.trim().toLowerCase();return t?EV.has(t)||LV.some(r=>t.startsWith(r)):!1}function hw(e,t,r){return r?[...e]:e.filter(s=>!FV(t(s)))}function Dh(e,t){return hw(e,r=>r.name,t)}function _V(e,t){return t?e:Object.entries(e).reduce((r,[s,i])=>(r[s]=Dh(i,!1),r),{})}async function cg(e,t){const[r,s]=await Promise.all([NP(t),p_(e)]);return OV(r.changes,s.items)}function OV(e,t){const r=new Set(t.map(s=>Ah(s.path)));return e.filter(s=>r.has(Ah(s.path))||s.oldPath!==null&&r.has(Ah(s.oldPath)))}function BV(e){const t=ij("","");for(const r of e){const s=Ah(r.path),i=s.split("/").filter(Boolean);let l=t;i.forEach((c,d)=>{const m=i.slice(0,d+1).join("/");if(d===i.length-1){l.children.set(`file:${m}`,{kind:"file",name:c,path:s,change:r});return}const f=`directory:${m}`,v=l.children.get(f);if(v&&v.kind==="directory"){l=v;return}const g=ij(c,m);l.children.set(f,g),l=g})}return HR(UR([...t.children.values()]))}function WR(e,t){const r=e.oldPath?`${e.oldPath} -> ${e.path}`:e.path;return mw(e)?`${r} ${t}`:r}function mw(e){return e.status==="D"||e.stagedStatus==="D"||e.worktreeStatus==="D"}function Rh(e){return e.split("/").filter(Boolean).pop()??e}function Ah(e){return e.replace(/\\/g,"/").replace(/^\.\//,"").trim()}function ij(e,t){return{kind:"directory",name:e,path:t,children:new Map}}function UR(e){return[...e].sort((t,r)=>t.kind!==r.kind?t.kind==="directory"?-1:1:t.name.localeCompare(r.name,"zh-CN")).map(t=>t.kind==="directory"?{kind:"directory",name:t.name,path:t.path,children:UR([...t.children.values()])}:t)}function HR(e){return e.map(t=>{var c;if(t.kind!=="directory")return t;const r=HR(t.children);let s=t.name,i=t.path,l=r;for(;l.length===1&&((c=l[0])==null?void 0:c.kind)==="directory";){const d=l[0];s=`${s}/${d.name}`,i=d.path,l=d.children}return{kind:"directory",name:s,path:i,children:l}})}const WV=450,UV=60*1e3,aj=20,oj=16;function HV({sessionId:e,workspaceId:t,showSystemFiles:r,selectedPath:s,refreshVersion:i,onCountChange:l,onSelectFile:c,onOpenFile:d}){const[m,f]=p.useState("tree"),[v,g]=p.useState([]),[w,k]=p.useState(!0),[y,S]=p.useState(!1),[T,j]=p.useState([]),N=p.useRef(null),{showToast:D}=Qn();p.useEffect(()=>{const se=Ur(eh(t,e),UV);f("tree"),g(se??[]),k(se===null),S(!1),j([]),N.current=null},[e,t]),p.useEffect(()=>{let se=!1;async function X(){k(!0);try{const K=await cg(e,t);se||(g(K),_s(eh(t,e),K))}catch(K){se||D({title:ug(K,o("conversation.filePanelSessionLoadFailed")),tone:"error"})}finally{se||k(!1)}}return X(),()=>{se=!0}},[i,e,D,t]);async function H(){k(!0);try{const se=await cg(e,t);g(se),_s(eh(t,e),se)}catch(se){D({title:ug(se,o("conversation.filePanelSessionLoadFailed")),tone:"error"})}finally{k(!1)}}async function B(){if(F.length!==0){S(!0);try{await DP(t,F.map(X=>X.path));const se=await cg(e,t);g(se),_s(eh(t,e),se),D({title:o("conversation.filePanelSessionStageSuccess"),tone:"success"})}catch(se){D({title:ug(se,o("git.stageFailed")),tone:"error"})}finally{S(!1)}}}function I(se){j(X=>X.includes(se)?X.filter(K=>K!==se):[...X,se])}function A(se){const X=Date.now(),K=N.current;return N.current={filePath:se,timestamp:X},(K==null?void 0:K.filePath)===se&&X-K.timestamp<=WV}async function L(se,X){if(X&&A(se)){await d(se),N.current=null;return}X||(N.current=null),await c(se)}const _=p.useMemo(()=>hw(v,se=>Rh(se.path),r),[v,r]),F=_.filter(se=>!se.staged),te=BV(_),E=new Set(T);return p.useEffect(()=>{l==null||l(_.length)},[l,_.length]),n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"file-panel-session-toolbar",children:[n.jsxs("div",{className:"file-panel-view-modes",role:"tablist","aria-label":o("conversation.filePanelSessionViewLabel"),children:[n.jsx("button",{className:m==="tree"?"file-panel-view-button active":"file-panel-view-button",type:"button",role:"tab","aria-selected":m==="tree",onClick:()=>f("tree"),children:o("conversation.filePanelSessionTreeView")}),n.jsx("button",{className:m==="list"?"file-panel-view-button active":"file-panel-view-button",type:"button",role:"tab","aria-selected":m==="list",onClick:()=>f("list"),children:o("conversation.filePanelSessionListView")})]}),n.jsxs("div",{className:"file-panel-session-actions",children:[n.jsx("button",{className:"secondary-button",type:"button",onClick:()=>void H(),disabled:w||y,children:o("conversation.filePanelRefresh")}),n.jsx("button",{className:"primary-button",type:"button",onClick:()=>void B(),disabled:y||F.length===0,children:o("conversation.filePanelSessionStageAll")})]})]}),n.jsxs("div",{className:"file-panel-session-summary",children:[n.jsx("span",{children:`${o("conversation.filePanelSessionSummary")} ${_.length}`}),n.jsx("span",{children:`${o("conversation.filePanelSessionUnstagedSummary")} ${F.length}`})]}),n.jsx("div",{className:"file-tree",children:w?n.jsx("p",{className:"file-tree-status status-text",children:o("conversation.filePanelSessionLoading")}):_.length===0?n.jsx("p",{className:"file-tree-status status-text",children:o("conversation.filePanelSessionEmpty")}):m==="tree"?zR({nodes:te,depth:0,collapsedPathSet:E,selectedPath:s,onToggleTreePath:I,onFileClick:L}):zV({items:_,selectedPath:s,onFileClick:L})})]})}function zR({nodes:e,depth:t,collapsedPathSet:r,selectedPath:s,onToggleTreePath:i,onFileClick:l}){return e.map(c=>{if(c.kind==="directory"){const d=!r.has(c.path);return n.jsxs("div",{className:"file-tree-node",children:[n.jsxs("button",{className:"file-tree-item",type:"button","data-kind":"directory","aria-expanded":d,style:{paddingInlineStart:`${aj+t*oj}px`},onClick:()=>i(c.path),children:[n.jsx("span",{className:"file-tree-chevron","aria-hidden":"true",children:d?"v":">"}),n.jsx("span",{className:"file-tree-label",children:c.name})]}),d?n.jsx("div",{className:"file-tree-children",children:zR({nodes:c.children,depth:t+1,collapsedPathSet:r,selectedPath:s,onToggleTreePath:i,onFileClick:l})}):null]},`session-directory:${c.path}`)}return n.jsx("div",{className:"file-tree-node",children:n.jsxs("button",{className:"file-tree-item is-session-change",type:"button","data-active":s===c.change.path,"data-kind":"file",style:{paddingInlineStart:`${aj+t*oj}px`},onClick:()=>void l(c.change.path,!mw(c.change)),children:[n.jsx("span",{className:"file-tree-chevron is-hidden","aria-hidden":"true",children:">"}),n.jsx("span",{className:"git-tree-file-icon","data-kind":Uo(c.name),"aria-hidden":"true",children:Wo(c.name)}),n.jsxs("span",{className:"file-tree-label",children:[n.jsx("span",{className:"file-tree-name",children:c.name}),n.jsx("span",{className:"file-tree-path",children:WR(c.change,o("conversation.filePanelSessionDeleted"))})]}),n.jsxs("span",{className:"file-session-item-meta",children:[n.jsx("span",{className:"file-session-badge","data-status":c.change.status,children:c.change.status}),n.jsx("span",{className:"file-session-badge subtle",children:c.change.staged?o("git.stagedLabel"):o("git.workingTreeLabel")})]})]})},`session-file:${c.path}`)})}function zV({items:e,selectedPath:t,onFileClick:r}){return e.map(s=>n.jsx("div",{className:"file-session-list-item",children:n.jsxs("button",{className:"file-session-list-button",type:"button","data-active":t===s.path,onClick:()=>void r(s.path,!mw(s)),children:[n.jsx("span",{className:"git-tree-file-icon","data-kind":Uo(Rh(s.path)),"aria-hidden":"true",children:Wo(Rh(s.path))}),n.jsxs("span",{className:"file-tree-label",children:[n.jsx("span",{className:"file-tree-name",children:Rh(s.path)}),n.jsx("span",{className:"file-tree-path",children:WR(s,o("conversation.filePanelSessionDeleted"))})]}),n.jsxs("span",{className:"file-session-item-meta",children:[n.jsx("span",{className:"file-session-badge","data-status":s.status,children:s.status}),n.jsx("span",{className:"file-session-badge subtle",children:s.staged?o("git.stagedLabel"):o("git.workingTreeLabel")})]})]})},`session-list:${s.path}`))}function eh(e,t){return`file-panel.session-changes.${e}.${t}`}function ug(e,t){return e instanceof Kr?e.message:typeof e=="object"&&e&&"message"in e?String(e.message??t):t}const mr="",qV=450,Bi=8,th=4,$V=176,VV=120,GV=300*1e3,KV=60*1e3,lj=1600,YV=20,XV=16;function pw({className:e,sessionId:t,workspaceId:r,hideHeading:s=!1,externalRevealRequest:i=null,externalWindowMode:l=!1,workbenchShellOverrides:c}){var us,zt;const d=Mr(),{navigationGroups:m,subscribeFileTree:f,requestFileTreeRefresh:v,addFileTreeSnapshotListener:g,subscribeGitSnapshot:w,requestGitRefresh:k,addGitSnapshotListener:y}={...d,...c},[S,T]=p.useState({}),[j,N]=p.useState([]),[D,H]=p.useState([]),[B,I]=p.useState(mr),[A,L]=p.useState([]),[_,F]=p.useState(null),[te,E]=p.useState(!1),[se,X]=p.useState(!1),[K,G]=p.useState(!1),[q,U]=p.useState(!1),[Q,P]=p.useState(""),[W,J]=p.useState(null),[R,ve]=p.useState(!1),[pe,Y]=p.useState(null),[Se,Le]=p.useState("workspace"),[re,Ce]=p.useState(0),[Xe,Ue]=p.useState(0),[ct,Nt]=p.useState(!1),[Ke,ut]=p.useState(!1),[vt,Te]=p.useState(null),[_e,we]=p.useState(null),[qe,ke]=p.useState(null),[Ee,$e]=p.useState(null),[wt,me]=p.useState([]),[Pe,Ge]=p.useState(!1),[dt,Ye]=p.useState(null),Dt=p.useRef({}),ae=p.useRef([]),We=p.useRef(mr),jt=p.useRef(!1),Rt=p.useRef(null),cn=p.useRef(null),Vt=p.useRef(null),Gt=p.useRef(null),pn=p.useRef(null),ie=p.useRef(null),Be=p.useRef(0),Mt=p.useRef(new Map),{showToast:Tt}=Qn(),xn=sr(),dn=ci(V=>V.showSystemFiles),Nn=!!(t!=null&&t.trim()),Sn=s&&xn.isMobile;p.useEffect(()=>{Ft("file_panel.props",{sessionId:t,workspaceId:r,externalWindowMode:l})},[l,t,r]),p.useEffect(()=>{We.current=B},[B]);function Et(V){T(fe=>{const xe=typeof V=="function"?V(fe):V;return Dt.current=xe,xe})}function In(V){N(fe=>{const xe=typeof V=="function"?V(fe):V;return ae.current=xe,xe})}p.useEffect(()=>{var ht,ot;if(an(),!r){an(),jt.current=!1,Dt.current={},ae.current=[],We.current=mr,Et({}),In([]),H([]),I(mr),U(!1),P(""),J(null),ve(!1),E(!1),Ge(!1),Ye(null),L([]),F(null),Te(null),we(null),ke(null);return}jt.current=!0;const V=Ur(mj(r),GV);Ft("file_panel.workspace_snapshot",{workspaceId:r,cached:!!V,cachedRootItems:((ot=(ht=V==null?void 0:V.treeCache)==null?void 0:ht[mr])==null?void 0:ot.length)??0,cachedDirectoryCount:Object.keys((V==null?void 0:V.treeCache)??{}).length});const fe=h8((V==null?void 0:V.activeDirectoryPath)??mr,(V==null?void 0:V.treeCache)??{}),xe=hj((V==null?void 0:V.expandedDirectories)??[],fe),at=sh((V==null?void 0:V.treeCache)??{},fe,xe);Dt.current=at,ae.current=xe,We.current=fe,Et(at),In(xe),H([]),I(fe),E(!1),X(!1),U(!1),P(""),J(null),ve(!1),queueMicrotask(()=>{jt.current=!1})},[r]),p.useEffect(()=>{if(!i||i.workspaceId!==r)return;const V=()=>{if(ie.current===i.requestId)return;ie.current=i.requestId,Le("workspace"),(i.openViewer?qn(i.filePath):ar(i.filePath)).catch(xe=>{Tt({title:Wi(xe,o("conversation.filePanelOpenFailed")),tone:"error"})})};if(jt.current){queueMicrotask(V);return}V()},[i,qn,ar,Tt,r]),p.useEffect(()=>{if(r)return g(V=>{V.workspaceId===r&&(Et(fe=>({...fe,[V.path]:V.items})),V.path===mr&&E(!1),H(fe=>fe.filter(xe=>xe!==V.path)),ze(V.path,V.items))})},[g,r]),p.useEffect(()=>()=>{an()},[]),p.useEffect(()=>{r&&f(r,hg(ae.current,We.current))},[B,j,f,r]),p.useEffect(()=>{L([]),F(null),Y(null),Ye(null),Ce(0),Nt(!1),ut(!1),Te(null),we(null),ke(null),Rt.current=null,Be.current+=1},[t]),p.useEffect(()=>{!Nn&&Se==="session"&&Le("workspace")},[Se,Nn]),p.useEffect(()=>{if(!ct&&!Ke&&!vt)return;function V(xe){var tn,Ln,Jn;if(!(xe.target instanceof Node))return;const at=((tn=cn.current)==null?void 0:tn.contains(xe.target))??!1,ht=((Ln=Vt.current)==null?void 0:Ln.contains(xe.target))??!1,ot=((Jn=Gt.current)==null?void 0:Jn.contains(xe.target))??!1;!at&&!ht&&!ot&&(Nt(!1),ut(!1),Te(null),we(null))}function fe(xe){xe.key==="Escape"&&(Nt(!1),ut(!1),Te(null),we(null))}return document.addEventListener("pointerdown",V),document.addEventListener("keydown",fe),()=>{document.removeEventListener("pointerdown",V),document.removeEventListener("keydown",fe)}},[ct,Ke,vt]),p.useLayoutEffect(()=>{if(!vt||typeof window>"u"){we(null);return}const V=vt;function fe(){const at=Gt.current;if(!at)return;const ht=at.getBoundingClientRect();we(s8({x:V.positionX,y:V.positionY},{width:ht.width||$V,height:ht.height||at.scrollHeight||0},{width:window.innerWidth,height:window.innerHeight}))}fe();const xe=window.requestAnimationFrame(fe);return window.addEventListener("resize",fe),window.addEventListener("scroll",fe,!0),()=>{window.cancelAnimationFrame(xe),window.removeEventListener("resize",fe),window.removeEventListener("scroll",fe,!0)}},[vt]),p.useEffect(()=>{if(!r)return;const V=hj(j,B),fe=sh(S,B,V);_s(mj(r),{treeCache:fe,expandedDirectories:V,activeDirectoryPath:B})},[B,j,S,r]),p.useEffect(()=>{if(jt.current)return;const V=sh(S,B,j);p8(S,V)||Et(V)},[B,j,S]),p.useEffect(()=>{let V=!1;const fe=(r==null?void 0:r.trim())??null;async function xe(ht){if(!fe)return;const ot=Dh(Dt.current[mr]??[],dn),tn=(ht==null?void 0:ht.silent)!==!0&&ot.length===0;tn&&E(!0),Ft("file_panel.load_root_tree.start",{sessionId:t,workspaceId:fe,silent:(ht==null?void 0:ht.silent)===!0,cachedRootItems:ot.length});try{const Ln=await ir(mr,{force:!0});V||(Ft("file_panel.load_root_tree.end",{sessionId:t,workspaceId:fe,itemCount:Ln.length}),Et(Jn=>({...sh(Jn,We.current,ae.current),[mr]:Ln})))}catch(Ln){!V&&!pj(Ln)&&Tt({title:Wi(Ln,o("conversation.filePanelLoadFailed")),tone:"error"})}finally{!V&&tn&&E(!1)}}if(Dh(Dt.current[mr]??[],dn).length>0){const ht=window.setTimeout(()=>{fe&&(f(fe,hg(ae.current,We.current)),xe({silent:!0}))},1500);return()=>{V=!0,window.clearTimeout(ht)}}return xe(),()=>{V=!0}},[t,dn,Tt,r]),p.useEffect(()=>{if(!r||!t){Ue(0);return}const V=Ur(f8(r,t),KV);Ft("file_panel.session_change_count.snapshot",{sessionId:t,workspaceId:r,cached:V!==null,cachedCount:V}),Ue(V??0)},[t,re,r]),p.useEffect(()=>{if(!r){me([]);return}const V=r.trim();w(V),k(V)},[r,w,k]),p.useEffect(()=>{if(!r)return;const V=r.trim();return y(fe=>{var xe;fe.workspaceId===V&&me(((xe=fe.status)==null?void 0:xe.changes)??[])})},[y,r]);const wn=p.useMemo(()=>hw(wt,V=>lg(V.path),dn),[wt,dn]),Z=p.useMemo(()=>{const V=new Map,fe=new Set;for(const xe of wn){const at=xe.path.replace(/\\/g,"/"),ht=xe.worktreeStatus??xe.stagedStatus??xe.status;V.set(at,ht);const ot=at.split("/");for(let tn=1;tn<ot.length;tn++)fe.add(ot.slice(0,tn).join("/"))}return{statusByPath:V,changedDirs:fe}},[wn]),ce=p.useMemo(()=>_V(S,dn),[dn,S]),ge=p.useMemo(()=>W===null?null:Dh(W,dn),[W,dn]),Ie=ce[mr]??[],He=q&&ge!==null,Je=p.useMemo(()=>Pe?Db(Ie,ce,Z.statusByPath,Z.changedDirs):Ie,[Z.changedDirs,Z.statusByPath,Ie,Pe,ce]),ft=p.useMemo(()=>He?(ge??[]).map(V=>ki(V.path,V.kind)):qR(Je,ce,j,Pe,Z.statusByPath,Z.changedDirs),[j,Z.changedDirs,Z.statusByPath,He,Pe,ge,ce,Je]),gt=((us=m.find(V=>V.workspace.id===r))==null?void 0:us.workspace)??null,nt=dj(A),yt=(nt==null?void 0:nt.path)??null,rt=(nt==null?void 0:nt.kind)==="file"?nt.path:null,oe=p.useMemo(()=>new Set(A.map(V=>V.path)),[A]),Ne=p.useMemo(()=>rh(A),[A]),Lt=!!(gt!=null&>.path&&A.length===1&&yt),Wt=A.length===1&&(nt==null?void 0:nt.kind)==="file",Kt=Ne.length>0,un=Ne.length>0,En=!!(Ee!=null&&Ee.items.length&&r),Hn=!!((rt?ua(rt):B)&&j.length);async function jn(V,fe=!1){if(!r)return[];if(!fe){const xe=Dt.current[V];if(xe)return xe}V===mr?E(!0):H(xe=>Ih(xe,V));try{const xe=await ir(V,{force:fe});return Et(at=>({...at,[V]:xe})),xe}catch(xe){throw pj(xe)||Tt({title:Wi(xe,o("conversation.filePanelLoadFailed")),tone:"error"}),xe}finally{V===mr?E(!1):H(xe=>xe.filter(at=>at!==V))}}async function Qt(V){if(!r)return;const fe=(V==null?void 0:V.activeDirectoryPath)??We.current,xe=(V==null?void 0:V.expandedDirectories)??ae.current,at=m8(Dt.current,fe,xe);Ft("file_panel.refresh_tree_cache.start",{sessionId:t,workspaceId:r,targetDirectories:at});const ot=(await Promise.all(at.map(async tn=>{const Ln=await ir(tn,{force:!0});return[tn,Ln]}))).reduce((tn,[Ln,Jn])=>(tn[Ln]=Jn,tn),{});Ft("file_panel.refresh_tree_cache.end",{sessionId:t,workspaceId:r,targetDirectories:at,directoryCount:Object.keys(ot).length}),Et(ot)}async function ir(V,fe){if(!r)return[];if(!(fe!=null&&fe.force)){const at=Dt.current[V];if(at)return at}const xe=hg(Ih(ae.current,V),V||We.current);return f(r,xe),v(r,[V]),De(V,lj,{allowCached:(fe==null?void 0:fe.force)!==!0})}function De(V,fe=lj,xe){const at=Dt.current[V];return(xe==null?void 0:xe.allowCached)!==!1&&at?Promise.resolve(at):new Promise((ht,ot)=>{const tn=window.setTimeout(()=>{$t(V,tn),ot(new Error(`FILE_TREE_SNAPSHOT_TIMEOUT:${V}`))},fe),Ln=Mt.current.get(V)??[];Mt.current.set(V,[...Ln,{resolve:ht,reject:ot,timerId:tn}])})}function ze(V,fe){const xe=Mt.current.get(V)??[];xe.length!==0&&(Mt.current.delete(V),xe.forEach(at=>{window.clearTimeout(at.timerId),at.resolve(fe)}))}function $t(V,fe){const at=(Mt.current.get(V)??[]).filter(ht=>ht.timerId!==fe);if(at.length===0){Mt.current.delete(V);return}Mt.current.set(V,at)}function an(){for(const[V,fe]of Mt.current.entries())fe.forEach(xe=>{window.clearTimeout(xe.timerId),xe.reject(new Error(`FILE_TREE_ABORTED:${V}`))});Mt.current.clear()}function kt(V){L([V]),F(V.path)}function Zt(V){I(V.kind==="directory"?V.path:ua(V.path))}function Pn(V){const fe=ZV(ft,_,V);L(fe),F(V.path),Zt(V)}function Sr(V){const fe=JV(A,V),xe=dj(fe);L(fe),F(V.path),xe&&Zt(xe)}function Jt(V){kt(V),Zt(V)}function Un(V,fe){if(fe!=null&&fe.shiftKey){Pn(V);return}if(nh(fe)){Sr(V);return}Jt(V)}async function gr(V,fe=!1){const xe=pu(V,fe);if(!xe.length){I(mr);return}In(at=>GR(at,xe)),I(xe[xe.length-1]??mr);for(const at of xe)try{await jn(at)}catch{return}}async function ar(V){const fe=ki(V,"file");kt(fe),Zt(fe),await gr(V)}async function qn(V){Y(V),Ye(null),Rt.current=null,Be.current+=1,ar(V);const fe=Be.current,xe=V.replace(/\\/g,"/"),at=Z.statusByPath.get(xe);if(r&&at&&at!=="?"&&at!=="D")try{const ht=await PP(r,V,!1);Be.current===fe&&Ye(ht.content||null)}catch{Be.current===fe&&Ye(null)}}function br(V){const fe=Date.now(),xe=Rt.current;return Rt.current={filePath:V,timestamp:fe},(xe==null?void 0:xe.filePath)===V&&fe-xe.timestamp<=qV}function zn(){Rt.current=null}async function Cr(V,fe){const xe=ki(V,"file");if(fe!=null&&fe.shiftKey||nh(fe)){zn(),Un(xe,fe);return}if(br(V)){await qn(V);return}Un(xe,fe),await gr(V)}function Yr(){U(!1),P(""),J(null),zn()}async function ls(V,fe){const xe=ki(V.path,V.kind);if(fe!=null&&fe.shiftKey||nh(fe)){zn(),Un(xe,fe);return}if(V.kind==="directory"){Yr(),Un(xe,fe),await ts(V.path);return}if(br(V.path)){Yr(),await qn(V.path);return}await ar(V.path)}async function ts(V){if(kt(ki(V,"directory")),I(V),!ae.current.includes(V))try{await jn(V),In(fe=>Ih(fe,V))}catch{}}async function Hr(V){if(kt(ki(V,"directory")),I(V),ae.current.includes(V)){cs(V);return}await ts(V)}function cs(V){In(fe=>fe.filter(xe=>xe!==V&&!xe.startsWith(`${V}/`))),I(ua(V)),L([]),F(null)}async function Ir(){if(!r)return;const V=r;try{if(k(V),await Qt(),rt&&await gr(rt),He&&Q.trim()){const fe=await _c(V,Q.trim());J(fe.items)}}catch(fe){Tt({title:Wi(fe,o("conversation.filePanelLoadFailed")),tone:"error"})}}async function vr(V){if(V==null||V.preventDefault(),!r||!Q.trim()){J(null);return}ve(!0);try{const fe=await _c(r,Q.trim());J(fe.items)}catch(fe){Tt({title:Wi(fe,o("conversation.filePanelSearchFailed")),tone:"error"})}finally{ve(!1)}}function wr(){if(q){U(!1),P(""),J(null);return}U(!0)}function Yt(V){ut(!1),V()}function bn(){var V;(V=pn.current)==null||V.click()}async function yn(V){var ot;const fe=((ot=V.target.files)==null?void 0:ot[0])??null;if(V.target.value="",!fe||!r)return;const xe=QV(fe.name);if(!xe){Tt({title:o("conversation.filePanelUploadFailed"),tone:"error"});return}const at=cj(B,nt),ht=uj(at,xe);G(!0);try{const tn=await o8(fe);await rO({workspaceId:r,path:ht,contentBase64:tn}),await Qt(),await ar(ht),Tt({title:o("conversation.filePanelUploadSuccess",{name:xe}),tone:"success"})}catch(tn){Tt({title:Wi(tn,o("conversation.filePanelUploadFailed")),tone:"error"})}finally{G(!1)}}async function Tn(V=rt){if(!(!r||!V)){G(!0);try{const fe=await sO(r,V),xe=l8(fe.contentBase64);c8(fe.fileName,new Blob([xe],{type:"application/octet-stream"})),Tt({title:o("conversation.filePanelDownloadSuccess",{name:fe.fileName}),tone:"success"})}catch(fe){Tt({title:Wi(fe,o("conversation.filePanelDownloadFailed")),tone:"error"})}finally{G(!1)}}}function or(){const V=rt?ua(rt):B;!V||!ae.current.includes(V)||cs(V)}async function ue(V,fe=cj(B,nt)){if(!r)return;const xe=fe,at=xe?`${xe}/`:"",ht=window.prompt(o(V==="create_file"?"conversation.filePanelCreateFilePrompt":"conversation.filePanelCreateDirectoryPrompt"),at);if(!(ht!=null&&ht.trim()))return;const ot=ht.trim();X(!0);try{await vf({workspaceId:r,opType:V,dstPath:ot,content:V==="create_file"?"":void 0}),await Qt(),V==="create_directory"?(await gr(ot,!0),kt(ki(ot,"directory")),I(ot)):await ar(ot)}catch(tn){Tt({title:Wi(tn,o("conversation.filePanelMutateFailed")),tone:"error"})}finally{X(!1)}}function Ve(V,fe=Ne){var at;if(fe.length===0)return;const xe=rh(fe);$e({mode:V,items:xe}),L(xe),F(((at=xe[xe.length-1])==null?void 0:at.path)??null),Tt({title:V==="copy"?o("conversation.filePanelCopySelectionSuccess",{count:xe.length}):o("conversation.filePanelCutSelectionSuccess",{count:xe.length}),tone:"success"}),Te(null)}async function St(V=n8(nt,B)){if(!r||!Ee||!Ee.items.length)return;const fe=V??mr,xe=Ee.items.map(at=>({source:at,destinationPath:uj(fe,lg(at.path)||at.path)}));X(!0);try{for(const ot of xe)Ee.mode==="cut"&&Mh(ot.source.path)===Mh(ot.destinationPath)||await vf({workspaceId:r,opType:Ee.mode==="copy"?"copy":"move",srcPath:ot.source.path,dstPath:ot.destinationPath});const at=xe.map(ot=>ki(ot.destinationPath,ot.source.kind)),ht=at[at.length-1]??null;if(Ee.mode==="cut"&&$e(null),L(at),F((ht==null?void 0:ht.path)??null),ht&&Zt(ht),zn(),await Qt({activeDirectoryPath:(ht==null?void 0:ht.kind)==="directory"?ht.path:ht?ua(ht.path):We.current,expandedDirectories:ae.current}),He&&Q.trim()){const ot=await _c(r,Q.trim());J(ot.items)}Ce(ot=>ot+1),Tt({title:o("conversation.filePanelPasteSuccess",{count:at.length}),tone:"success"}),Te(null)}catch(at){await Qt().catch(()=>{}),Tt({title:Wi(at,o("conversation.filePanelPasteFailed")),tone:"error"})}finally{X(!1)}}function It(V=Ne){!V.length||se||(ke(rh(V)),Te(null))}async function vn(){var fe,xe;if(!r||!(qe!=null&&qe.length))return;const V=rh(qe);X(!0);try{for(const ot of V)await vf({workspaceId:r,opType:"delete",srcPath:ot.path});const at=r8(B,V),ht=ae.current.filter(ot=>!V.some(tn=>tn.kind==="directory"&&im(tn.path,ot)));if(pe&&V.some(ot=>im(ot.path,pe))&&(Be.current+=1,Y(null),Ye(null)),ke(null),L([]),F(null),We.current=at,ae.current=ht,I(at),In(ht),zn(),await Qt({activeDirectoryPath:at,expandedDirectories:ht}),He&&Q.trim()){const ot=await _c(r,Q.trim());J(ot.items)}Ce(ot=>ot+1),Tt({title:V.length===1?o("conversation.filePanelDeleteSuccess",{name:lg(((fe=V[0])==null?void 0:fe.path)??"")||((xe=V[0])==null?void 0:xe.path)||""}):o("conversation.filePanelDeleteSelectionSuccess",{count:V.length}),tone:"success"})}catch(at){Tt({title:Wi(at,o("conversation.filePanelMutateFailed")),tone:"error"})}finally{X(!1)}}async function fn(V,fe=nt){const xe=(gt==null?void 0:gt.path)??"",at=(fe==null?void 0:fe.path)??null;if(at===null||!xe){Nt(!1);return}try{const ht=a8(xe),ot=V==="absolute"?i8(xe,at,ht):Mh(at,ht);await u8(ot,xn),Tt({title:o(V==="absolute"?"conversation.filePanelCopyAbsolutePathSuccess":"conversation.filePanelCopyRelativePathSuccess"),tone:"success"})}catch(ht){Tt({title:ht instanceof Error?ht.message:o("conversation.filePanelCopyPathFailed"),tone:"error"})}finally{Nt(!1),Te(null)}}function ln(V,fe,xe){return[{id:`open-${V.path}`,label:V.kind==="directory"?j.includes(V.path)?o("conversation.filePanelCollapseDirectory"):o("conversation.filePanelExpandDirectory"):o("conversation.filePanelOpenFile"),onSelect:()=>{if(V.kind==="directory"){Hr(V.path);return}qn(V.path)}},{id:`download-${V.path}`,label:o("conversation.filePanelDownload"),disabled:V.kind!=="file"||K,onSelect:()=>{Tn(V.kind==="file"?V.path:null)}},{id:`create-file-${V.path}`,label:o("conversation.filePanelNewFile"),disabled:!r||se||K,onSelect:()=>{ue("create_file",xe)}},{id:`create-directory-${V.path}`,label:o("conversation.filePanelNewDirectory"),disabled:!r||se||K,onSelect:()=>{ue("create_directory",xe)}},{id:`copy-${V.path}`,label:o("conversation.filePanelCopy"),disabled:fe.length===0,onSelect:()=>Ve("copy",fe)},{id:`cut-${V.path}`,label:o("conversation.filePanelCut"),disabled:fe.length===0,onSelect:()=>Ve("cut",fe)},{id:`paste-${V.path}`,label:o("conversation.filePanelPaste"),disabled:!En,onSelect:()=>{St(xe)}},{id:`copy-relative-${V.path}`,label:o("conversation.filePanelCopyRelativePath"),onSelect:()=>{fn("relative",V)}},{id:`copy-absolute-${V.path}`,label:o("conversation.filePanelCopyAbsolutePath"),onSelect:()=>{fn("absolute",V)}},{id:`delete-${V.path}`,label:o("conversation.filePanelDelete"),disabled:fe.length===0||se||K,onSelect:()=>It(fe)}]}async function jr(V,fe){if(xn.isMobile)return;V.preventDefault();const xe=ki(fe.path,fe.kind),at=oe.has(xe.path)?Ne:[xe],ht=xe.kind==="directory"?xe.path:ua(xe.path);oe.has(xe.path)||Jt(xe);const ot=ln(xe,at,ht);if(xn.isDesktop){await Cv(ot);return}xn.isWeb&&(Nt(!1),ut(!1),Te({positionX:V.clientX,positionY:V.clientY,items:ot}))}p.useEffect(()=>{if(Se!=="workspace")return;function V(fe){if(!e8(fe)||fe.altKey||fe.shiftKey||t8(fe.target))return;const xe=fe.key.toLowerCase();if(xe==="c"&&un){fe.preventDefault(),Ve("copy");return}if(xe==="x"&&un){fe.preventDefault(),Ve("cut");return}xe==="v"&&En&&(fe.preventDefault(),St())}return document.addEventListener("keydown",V),()=>{document.removeEventListener("keydown",V)}},[Se,un,En,Ve,St]);function Gn(V,fe){return n.jsx(n.Fragment,{children:V.map(xe=>{const at=ki(xe.path,xe.kind),ht=xe.kind==="directory",ot=ht&&j.includes(xe.path),tn=ht&&D.includes(xe.path),Ln=ce[xe.path]??[],Jn=Pe?Db(Ln,ce,Z.statusByPath,Z.changedDirs):Ln,Nr=oe.has(xe.path),Ks=yt===xe.path,Er=Z.statusByPath.get(xe.path.replace(/\\/g,"/")),Lr=ht&&Z.changedDirs.has(xe.path.replace(/\\/g,"/")),xs=(Ee==null?void 0:Ee.mode)==="cut"&&Ee.items.some(lr=>lr.path===xe.path);return n.jsxs("div",{className:"file-tree-node",children:[n.jsxs("button",{className:"file-tree-item",type:"button","data-active":Ks,"data-selected":Nr,"data-cut-pending":xs||void 0,"data-kind":xe.kind,"aria-expanded":ht?ot:void 0,style:{paddingInlineStart:`${YV+fe*XV}px`},onClick:lr=>{if(ht){if(lr.shiftKey||nh(lr)){zn(),Un(at,lr);return}zn(),Un(at,lr),Hr(xe.path);return}Cr(xe.path,lr)},onContextMenu:lr=>{jr(lr,xe)},children:[n.jsx("span",{className:`file-tree-chevron${ht?"":" is-hidden"}`,"aria-hidden":"true",children:ot?"v":">"}),ht?null:n.jsx("span",{className:"git-tree-file-icon","data-kind":Uo(xe.name),"aria-hidden":"true",children:Wo(xe.name)}),n.jsx("span",{className:"file-tree-label","data-status":Er??void 0,"data-has-changes":Lr||void 0,children:xe.name}),!ht&&Er?n.jsx("span",{className:"git-status-badge","data-status":Er,"aria-label":Er,children:Er}):null,ht&&Lr?n.jsx("span",{className:"file-tree-dir-badge","aria-hidden":"true"}):null,tn?n.jsx("span",{className:"file-tree-meta",children:o("common.loading")}):null]}),ht&&ot?n.jsx("div",{className:"file-tree-children",children:tn&&!Ln.length?n.jsx("p",{className:"file-tree-empty",children:o("common.loading")}):Jn.length?Gn(Jn,fe+1):n.jsx("p",{className:"file-tree-empty",children:o("conversation.filePanelEmptyDirectory")})}):null]},`${xe.kind}-${xe.path}`)})})}function zr(V){return n.jsx(n.Fragment,{children:V.map(fe=>{const xe=fe.kind==="directory",at=oe.has(fe.path),ht=yt===fe.path;return n.jsx("div",{className:"file-tree-node",children:n.jsxs("button",{className:"file-tree-item is-search-result",type:"button","data-active":ht,"data-selected":at,"data-kind":fe.kind,onClick:ot=>{ls(fe,ot)},onContextMenu:ot=>{jr(ot,fe)},children:[n.jsx("span",{className:"file-tree-chevron is-hidden","aria-hidden":"true",children:">"}),xe?null:n.jsx("span",{className:"git-tree-file-icon","data-kind":Uo(fe.name),"aria-hidden":"true",children:Wo(fe.name)}),n.jsxs("span",{className:"file-tree-label",children:[n.jsx("span",{className:"file-tree-name",children:fe.name}),n.jsx("span",{className:"file-tree-path",children:fe.path})]})]})},`search-${fe.kind}-${fe.path}`)})})}return n.jsx("section",{className:["conversation-panel","surface-card","file-panel",e].filter(Boolean).join(" "),"data-testid":"file-context-panel",children:r?n.jsxs(n.Fragment,{children:[n.jsx(IR,{workspaceId:r,filePath:pe,open:pe!==null,onClose:()=>{Be.current+=1,Y(null),Ye(null)},onSaved:async V=>{await Qt(),await ar(V),Ce(fe=>fe+1)},diffContent:dt}),s?null:n.jsx("div",{className:"file-panel-heading-row",children:n.jsx("h2",{className:"file-panel-heading",children:o("conversation.filePanelTitle")})}),n.jsxs("div",{className:"file-panel-tabs",role:"tablist","aria-label":o("conversation.filePanelTitle"),children:[n.jsx("button",{className:Se==="workspace"?"file-panel-tab active":"file-panel-tab",type:"button",role:"tab","aria-selected":Se==="workspace",onClick:()=>Le("workspace"),children:o("conversation.filePanelWorkspaceTab")}),n.jsxs("button",{className:Se==="session"?"file-panel-tab active":"file-panel-tab",type:"button",role:"tab","aria-selected":Se==="session",onClick:()=>{Nn&&Le("session")},disabled:!Nn,children:[o("conversation.filePanelSessionTab"),n.jsx("span",{className:"file-panel-tab-badge","aria-label":`${o("conversation.filePanelSessionTab")} ${Xe}`,children:Xe})]})]}),Se==="workspace"?n.jsxs(n.Fragment,{children:[n.jsx("input",{ref:pn,"data-testid":"file-panel-upload-input",type:"file",hidden:!0,onChange:V=>void yn(V)}),Sn?n.jsx("div",{className:"file-panel-toolbar file-panel-toolbar-mobile","aria-label":o("conversation.filePanelTitle"),children:n.jsxs("div",{className:"file-mobile-action-shell",ref:Vt,children:[n.jsxs("button",{className:"secondary-button file-mobile-action-trigger",type:"button","aria-label":o("conversation.filePanelActionsMenu"),"aria-haspopup":"menu","aria-expanded":Ke,"data-active":Ke,onClick:()=>{Nt(!1),ut(V=>!V)},children:[n.jsx("span",{children:o("conversation.filePanelActionsMenu")}),n.jsx(N8,{})]}),Ke?n.jsxs("div",{className:"file-mobile-action-menu",role:"menu","aria-label":o("conversation.filePanelActionsMenu"),children:[n.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>Yt(()=>Ve("copy")),disabled:!un,children:o("conversation.filePanelCopy")}),n.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>Yt(()=>Ve("cut")),disabled:!un,children:o("conversation.filePanelCut")}),n.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>Yt(()=>St()),disabled:!En||se||K,children:o("conversation.filePanelPaste")}),n.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>{ut(!1),wr()},children:o(q?"conversation.filePanelHideSearch":"conversation.filePanelShowSearch")}),n.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>{ut(!1),Ge(V=>!V)},disabled:wn.length===0,children:o(Pe?"conversation.filePanelShowAll":"conversation.filePanelFilterChanges")}),n.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>Yt(Ir),disabled:te||se||R,children:o("conversation.filePanelRefresh")}),n.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>{ut(!1),or()},disabled:!Hn,children:o("conversation.filePanelCollapseCurrent")}),n.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>{ut(!1),bn()},disabled:se||K,children:o("conversation.filePanelUpload")}),n.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>Yt(Tn),disabled:!Wt||K,children:o("conversation.filePanelDownload")}),n.jsx("button",{className:"file-mobile-action-menu-item danger",type:"button",role:"menuitem",onClick:()=>Yt(It),disabled:!Kt||se||K,children:o("conversation.filePanelDelete")}),n.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>Yt(()=>ue("create_file")),disabled:se||K,children:o("conversation.filePanelNewFile")}),n.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>Yt(()=>ue("create_directory")),disabled:se||K,children:o("conversation.filePanelNewDirectory")}),n.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>Yt(()=>fn("absolute")),disabled:!Lt,children:o("conversation.filePanelCopyAbsolutePath")}),n.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>Yt(()=>fn("relative")),disabled:!Lt,children:o("conversation.filePanelCopyRelativePath")})]}):null]})}):n.jsxs("div",{className:"file-panel-toolbar","aria-label":o("conversation.filePanelTitle"),children:[n.jsx("button",{className:"file-toolbar-button",type:"button",title:o("conversation.filePanelCopy"),"aria-label":o("conversation.filePanelCopy"),onClick:()=>Ve("copy"),disabled:!un,children:n.jsx(w8,{})}),n.jsx("button",{className:"file-toolbar-button",type:"button",title:o("conversation.filePanelCut"),"aria-label":o("conversation.filePanelCut"),onClick:()=>Ve("cut"),disabled:!un,children:n.jsx(y8,{})}),n.jsx("button",{className:"file-toolbar-button",type:"button",title:o("conversation.filePanelPaste"),"aria-label":o("conversation.filePanelPaste"),onClick:()=>void St(),disabled:!En||se||K,children:n.jsx(k8,{})}),n.jsxs("div",{className:"file-toolbar-menu-shell",ref:cn,children:[n.jsx("button",{className:"file-toolbar-button",type:"button",title:o("conversation.filePanelCopyPath"),"aria-label":o("conversation.filePanelCopyPath"),"aria-haspopup":"menu","aria-expanded":ct,"data-active":ct,onClick:()=>{ut(!1),Nt(V=>!V)},disabled:!Lt,children:n.jsx(v8,{})}),ct?n.jsxs("div",{className:"file-toolbar-menu",role:"menu",children:[n.jsx("button",{className:"file-toolbar-menu-item",type:"button",role:"menuitem",onClick:()=>void fn("absolute"),children:o("conversation.filePanelCopyAbsolutePath")}),n.jsx("button",{className:"file-toolbar-menu-item",type:"button",role:"menuitem",onClick:()=>void fn("relative"),children:o("conversation.filePanelCopyRelativePath")})]}):null]}),n.jsx("button",{className:"file-toolbar-button",type:"button",title:o("conversation.filePanelCollapseCurrent"),"aria-label":o("conversation.filePanelCollapseCurrent"),onClick:or,disabled:!Hn,children:n.jsx(g8,{})}),n.jsx("button",{className:"file-toolbar-button",type:"button",title:o("conversation.filePanelRefresh"),"aria-label":o("conversation.filePanelRefresh"),onClick:()=>void Ir(),disabled:te||se||R,children:n.jsx(b8,{})}),n.jsx("button",{className:"file-toolbar-button",type:"button",title:o("conversation.filePanelSearchButton"),"aria-label":o("conversation.filePanelSearchButton"),"data-active":q,onClick:wr,disabled:te,children:n.jsx(fj,{})}),wn.length>0?n.jsx("button",{className:"file-toolbar-button",type:"button",title:o(Pe?"conversation.filePanelShowAll":"conversation.filePanelFilterChanges"),"aria-label":o(Pe?"conversation.filePanelShowAll":"conversation.filePanelFilterChanges"),"data-active":Pe,onClick:()=>Ge(V=>!V),children:n.jsx(P8,{})}):null,n.jsx("button",{className:"file-toolbar-button",type:"button",title:o("conversation.filePanelUpload"),"aria-label":o("conversation.filePanelUpload"),onClick:bn,disabled:se||K,children:n.jsx(S8,{})}),n.jsx("button",{className:"file-toolbar-button",type:"button",title:o("conversation.filePanelDownload"),"aria-label":o("conversation.filePanelDownload"),onClick:()=>void Tn(),disabled:!Wt||K,children:n.jsx(C8,{})}),n.jsx("button",{className:"file-toolbar-button danger",type:"button",title:o("conversation.filePanelDelete"),"aria-label":o("conversation.filePanelDelete"),onClick:()=>It(),disabled:!Kt||se||K,children:n.jsx(j8,{})}),n.jsx("button",{className:"file-toolbar-button",type:"button",title:o("conversation.filePanelNewFile"),"aria-label":o("conversation.filePanelNewFile"),onClick:()=>void ue("create_file"),disabled:se||K,children:n.jsx(x8,{})}),n.jsx("button",{className:"file-toolbar-button",type:"button",title:o("conversation.filePanelNewDirectory"),"aria-label":o("conversation.filePanelNewDirectory"),onClick:()=>void ue("create_directory"),disabled:se||K,children:n.jsx(T8,{})})]}),vt&&typeof document<"u"?Vn.createPortal(n.jsx("div",{className:"file-web-context-menu",ref:Gt,role:"menu","aria-label":o("conversation.filePanelActionsMenu"),style:{left:`${(_e==null?void 0:_e.left)??Math.max(8,vt.positionX)}px`,top:`${(_e==null?void 0:_e.top)??Math.max(8,vt.positionY)}px`,maxHeight:_e?`${_e.maxHeight}px`:void 0},children:vt.items.map(V=>n.jsx("button",{className:["file-web-context-menu-item",V.label===o("conversation.filePanelDelete")?"danger":""].filter(Boolean).join(" "),type:"button",role:"menuitem",disabled:V.disabled,onClick:()=>{Te(null),V.onSelect()},children:V.label},V.id))}),document.body):null,q?n.jsxs("form",{className:"file-toolbar-search",onSubmit:V=>void vr(V),children:[n.jsx("input",{value:Q,onChange:V=>P(V.target.value),placeholder:o("conversation.filePanelSearchPlaceholder")}),Sn?n.jsx("button",{className:"secondary-button file-mobile-search-submit",type:"submit","aria-label":o("conversation.filePanelSearchButton"),disabled:R,children:o("conversation.filePanelSearchButton")}):n.jsx("button",{className:"file-toolbar-button",type:"submit",title:o("conversation.filePanelSearchButton"),"aria-label":o("conversation.filePanelSearchButton"),disabled:R,children:n.jsx(fj,{})})]}):null,n.jsx("div",{className:"file-tree","data-search-mode":He,children:te&&Ie.length===0?n.jsx("p",{className:"file-tree-status status-text",children:o("common.loading")}):He?ge!=null&&ge.length?zr(ge):n.jsx("p",{className:"file-tree-status status-text",children:o("conversation.filePanelSearchEmpty")}):Pe?Je.length?Gn(Je,0):n.jsx("p",{className:"file-tree-status status-text",children:o("conversation.filePanelNoChanges")}):Ie.length?Gn(Ie,0):n.jsx("p",{className:"file-tree-status status-text",children:o("conversation.filePanelEmptyDirectory")})}),n.jsxs(Fn,{open:qe!==null,title:o("conversation.filePanelDeleteConfirmTitle"),description:o("conversation.filePanelDeleteConfirmDescription"),onClose:()=>{se||ke(null)},children:[n.jsx("p",{className:"workbench-section-empty",children:qe!=null&&qe.length?qe.length===1?((zt=qe[0])==null?void 0:zt.kind)==="directory"?o("conversation.filePanelDeleteDirectoryConfirm",{path:qe[0].path}):o("conversation.filePanelDeleteFileConfirm",{path:qe[0].path}):o("conversation.filePanelDeleteSelectionConfirm",{count:qe.length}):""}),n.jsxs("div",{className:"workbench-modal-actions",children:[n.jsx("button",{type:"button",className:"secondary-button",disabled:se,onClick:()=>ke(null),children:o("common.cancel")}),n.jsx("button",{type:"button",className:"secondary-button workbench-danger-button",disabled:se,onClick:()=>{vn()},children:o(se?"conversation.filePanelDeleting":"conversation.filePanelDelete")})]})]})]}):Nn&&t?n.jsx(HV,{sessionId:t,workspaceId:r,showSystemFiles:dn,selectedPath:rt,refreshVersion:re,onCountChange:Ue,onSelectFile:ar,onOpenFile:qn}):n.jsx("section",{className:"file-panel-section",children:n.jsx("p",{className:"status-text",children:o("conversation.filePanelSessionNoSession")})})]}):n.jsx("section",{className:"file-panel-section",children:n.jsx("p",{className:"status-text",children:o("conversation.filePanelNoWorkspace")})})})}function ua(e){return e.includes("/")?e.split("/").slice(0,-1).join("/"):mr}function pu(e,t=!1){const r=e.split("/").filter(Boolean),s=t?r.length:r.length-1,i=[];for(let l=0;l<s;l+=1)i.push(r.slice(0,l+1).join("/"));return i}function cj(e,t){return e||((t==null?void 0:t.kind)==="directory"?t.path:t!=null&&t.path?ua(t.path):mr)}function uj(e,t){return e?`${e}/${t}`:t}function QV(e){var t;return((t=e.split(/[/\\]/).pop())==null?void 0:t.trim())??""}function ki(e,t){return{path:e,kind:t}}function dj(e){return e[e.length-1]??null}function JV(e,t){return e.findIndex(s=>s.path===t.path)>=0?e.filter(s=>s.path!==t.path):[...e,t]}function ZV(e,t,r){const s=e.findIndex(d=>d.path===r.path);if(s<0)return[r];const i=t?e.findIndex(d=>d.path===t):s;if(i<0)return[r];const l=Math.min(i,s),c=Math.max(i,s);return e.slice(l,c+1)}function nh(e){return!!(e!=null&&e.ctrlKey||e!=null&&e.metaKey)}function e8(e){return e.ctrlKey||e.metaKey}function t8(e){if(!(e instanceof HTMLElement))return!1;const t=e.tagName.toLowerCase();return t==="input"||t==="textarea"||t==="select"||e.isContentEditable}function rh(e){const t=[...new Map(e.map(s=>[s.path,s])).values()].sort((s,i)=>s.path.localeCompare(i.path)),r=[];for(const s of t)r.some(i=>i.kind==="directory"&&im(i.path,s.path))||r.push(s);return r}function n8(e,t){return(e==null?void 0:e.kind)==="directory"?e.path:e!=null&&e.path?ua(e.path):t}function r8(e,t){let r=e;for(;r&&t.some(s=>s.kind==="directory"&&im(s.path,r));)r=ua(r);return r}function qR(e,t,r,s,i,l){const c=[];for(const d of e){if(c.push(ki(d.path,d.kind)),d.kind!=="directory"||!r.includes(d.path))continue;const m=t[d.path]??[],f=s?Db(m,t,i,l):m;c.push(...qR(f,t,r,s,i,l))}return c}function s8(e,t,r){const s=Math.max(0,r.width),i=Math.max(0,r.height),l=Math.max(0,i-Bi*2),c=Math.max(0,s-Bi*2),d=Math.min(Math.max(t.width,0),c),m=Math.max(0,i-e.y-th-Bi),f=Math.max(0,e.y-th-Bi),v=m<t.height&&f>m,w=dg(Math.max(v?f:m,VV),0,l),k=Math.min(Math.max(t.height,0),w),y=v?e.y-th-k:e.y+th,S=Math.max(Bi,i-Bi-k),T=Math.max(Bi,s-Bi-d);return{top:dg(y,Bi,S),left:dg(e.x,Bi,T),maxHeight:Math.max(0,w)}}function dg(e,t,r){return!Number.isFinite(e)||r<t?t:Math.min(Math.max(e,t),r)}function Mh(e,t="posix"){return e?$R(e,t):"."}function i8(e,t,r){const s=$R(e,r),i=Mh(t,r).replace(/^\.[/\\]?/,"");if(!i)return s;const l=VR(r),c=i.replace(/^[/\\]+/,"");return c?s.endsWith("/")||s.endsWith("\\")?`${s}${c}`:`${s}${l}${c}`:s}function a8(e){return/^[a-zA-Z]:[\\/]/.test(e)||e.includes("\\")?"windows":"posix"}function $R(e,t){return e&&(VR(t)==="\\"?e.replace(/\//g,"\\"):e.replace(/\\/g,"/"))}function VR(e){return e==="windows"?"\\":"/"}function im(e,t){return t===e||t.startsWith(`${e}/`)}async function o8(e){const t=await e.arrayBuffer(),r=new Uint8Array(t),s=32768;let i="";for(let l=0;l<r.length;l+=s){const c=r.subarray(l,l+s);i+=String.fromCharCode(...c)}return btoa(i)}function l8(e){const t=atob(e),r=new Uint8Array(t.length);for(let s=0;s<t.length;s+=1)r[s]=t.charCodeAt(s);return r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength)}function c8(e,t){if(typeof document>"u")throw new Error(o("conversation.filePanelDownloadFailed"));const r=window.URL.createObjectURL(t),s=document.createElement("a");s.href=r,s.download=e,document.body.append(s),s.click(),s.remove(),window.URL.revokeObjectURL(r)}async function u8(e,t){var r;if(!(t.isDesktop&&(await t.bridge.writeClipboardText(e)).ok)){if(typeof navigator<"u"&&((r=navigator.clipboard)!=null&&r.writeText))try{await navigator.clipboard.writeText(e);return}catch{}if(!d8(e))throw new Error(o("conversation.filePanelCopyPathFailed"))}}function d8(e){if(typeof document>"u"||typeof document.execCommand!="function")return!1;const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly","true"),t.style.position="fixed",t.style.top="-9999px",t.style.left="-9999px",t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy")}catch{return!1}finally{document.body.removeChild(t)}}function h8(e,t){return e&&pu(e,!0).every(i=>i in t)?e:mr}function hj(e,t){if(!t)return[];const r=pu(t,!0);return e.filter(s=>r.includes(s))}function sh(e,t,r){const s=fw(t,r);return Object.entries(e).reduce((i,[l,c])=>(s.has(l)&&(i[l]=c),i),{})}function m8(e,t,r){const i=[...fw(t,r)].filter(l=>l===mr||l in e);return i.length?i:[mr]}function fw(e,t){const r=new Set([mr]),s=GR(t,pu(e,!0));for(const i of s){r.add(i);for(const l of pu(i,!0))r.add(l)}return r}function p8(e,t){const r=Object.keys(e),s=Object.keys(t);return r.length!==s.length?!1:r.every(i=>e[i]===t[i])}function Ih(e,t){return e.includes(t)?e:[...e,t]}function GR(e,t){return t.reduce((r,s)=>Ih(r,s),e)}function mj(e){return`file-panel.workspace-tree.${e}`}function f8(e,t){return`file-panel.session-change-count.${e}.${t}`}function hg(e,t){return[...fw(t,e)]}function Wi(e,t){return e instanceof Kr?e.message:t}function pj(e){return e instanceof Error&&(e.message.startsWith("FILE_TREE_SNAPSHOT_TIMEOUT:")||e.message.startsWith("FILE_TREE_ABORTED:"))}function g8(){return n.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:n.jsx("path",{d:"M2.5 4.5h11v2h-11zM2.5 7.5h7v2h-7zM2.5 10.5h4v2h-4z",fill:"currentColor"})})}function b8(){return n.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:n.jsx("path",{d:"M12.8 5.2A5.5 5.5 0 1 0 13.5 8h-1.8A3.7 3.7 0 1 1 10.6 5l-1.4 1.4h4V2l-1.4 1.4z",fill:"currentColor"})})}function fj(){return n.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:n.jsx("path",{d:"M11.2 10.1l3 3-1.1 1.1-3-3a5 5 0 1 1 1.1-1.1zM6.8 10.3a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7z",fill:"currentColor"})})}function v8(){return n.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[n.jsx("path",{d:"M3.5 4.3h5.2v1.4H4.9v5.4H3.5zm3.8-2.1h5.2v9.5H7.3z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),n.jsx("path",{d:"M5.7 10.8h4.5",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})]})}function w8(){return n.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[n.jsx("path",{d:"M5 2.5h7.5v9H5z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),n.jsx("path",{d:"M3.5 5H2.4V13.5H10V12.4",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})]})}function y8(){return n.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:n.jsx("path",{d:"M4.2 4.2a1.4 1.4 0 1 1 0 2.8 1.4 1.4 0 0 1 0-2.8zm0 5.4a1.4 1.4 0 1 1 0 2.8 1.4 1.4 0 0 1 0-2.8zm1-3.2 6.6 5.6M5.2 9.6l6.6-5.6",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})})}function k8(){return n.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[n.jsx("path",{d:"M4 3.5h8v10H4zM6 2.2h4v2H6z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),n.jsx("path",{d:"M6 7.2h4M6 9.6h4",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})]})}function x8(){return n.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[n.jsx("path",{d:"M4 1.5h5l3 3v10H4z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),n.jsx("path",{d:"M9 1.5v3h3",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),n.jsx("path",{d:"M8 6.5v5M5.5 9h5",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})]})}function S8(){return n.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[n.jsx("path",{d:"M3 11.5v2h10v-2",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),n.jsx("path",{d:"M8 2.5v8",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),n.jsx("path",{d:"m5.5 5 2.5-2.5L10.5 5",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]})}function C8(){return n.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[n.jsx("path",{d:"M3 11.5v2h10v-2",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),n.jsx("path",{d:"M8 2.5v8",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),n.jsx("path",{d:"m5.5 8.5 2.5 2.5 2.5-2.5",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]})}function j8(){return n.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:n.jsx("path",{d:"M3.5 4.5h9M6.2 2.5h3.6l.6 1.4H13v1.2H3V3.9h2.6zM5.2 5.7v6.1m2.8-6.1v6.1m2.8-6.1v6.1M4.4 13.5h7.2",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})}function T8(){return n.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[n.jsx("path",{d:"M1.8 4.5h4l1.2 1.3h7.2v6.7H1.8z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),n.jsx("path",{d:"M8.5 7.2v4M6.5 9.2h4",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})]})}function N8(){return n.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:n.jsx("path",{d:"m4 6 4 4 4-4",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})})}function P8(){return n.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:n.jsx("path",{d:"M1.5 2h13l-5 6v5l-3 1.5V8z",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"})})}function Db(e,t,r,s){const i=[];for(const l of e){const c=l.path.replace(/\\/g,"/");l.kind==="file"?r.has(c)&&i.push(l):KR(c,t,r,s)&&i.push(l)}return i}function KR(e,t,r,s,i){const l=i??new Set;if(l.has(e))return!1;l.add(e);const c=t[e];if(!c)return s.has(e);for(const d of c){const m=d.path.replace(/\\/g,"/");if(d.kind==="file"){if(r.has(m))return!0}else if(KR(m,t,r,s,l))return!0}return!1}const D8=Object.freeze(Object.defineProperty({__proto__:null,FileContextPanel:pw},Symbol.toStringTag,{value:"Module"})),mg=56,gj=28,pg=72,ih=8,bj=960,vj=60*1e3,wj=20,yj=9,kj=9,fg=68,Es=12,ah=8,Rb=260,R8=120,gg=6e4,am={authMode:"none",username:"",password:"",token:"",rememberOnHost:!1};function gw({className:e,workspaceId:t,panelActive:r=!0,externalWindowMode:s=!1,workbenchShellOverrides:i}){const l=fr(),c=sr(),d=Mr(),{subscribeGitSnapshot:m,requestGitRefresh:f,addGitSnapshotListener:v,requestNavigationRefresh:g,selectWorkspace:w,upsertNavigationSession:k}={...d,...i},[y,S]=p.useState(null),[T,j]=p.useState([]),[N,D]=p.useState(0),[H,B]=p.useState(null),[I,A]=p.useState(!1),[L,_]=p.useState(null),[F,te]=p.useState(null),[E,se]=p.useState(""),[X,K]=p.useState(!1),[G,q]=p.useState(!1),[U,Q]=p.useState([]),[P,W]=p.useState(!0),[J,R]=p.useState(!1),[ve,pe]=p.useState(()=>typeof window<"u"?window.innerWidth<=bj:!1),[Y,Se]=p.useState([]),[Le,re]=p.useState(null),[Ce,Xe]=p.useState("unstaged"),[Ue,ct]=p.useState(null),[Nt,Ke]=p.useState(null),[ut,vt]=p.useState(!1),[Te,_e]=p.useState(null),[we,qe]=p.useState(!1),[ke,Ee]=p.useState(null),[$e,wt]=p.useState(null),[me,Pe]=p.useState(null),[Ge,dt]=p.useState(!1),[Ye,Dt]=p.useState(null),[ae,We]=p.useState(!1),[jt,Rt]=p.useState(!1),[cn,Vt]=p.useState([]),[Gt,pn]=p.useState(!1),[ie,Be]=p.useState(new Set),[Mt,Tt]=p.useState(new Map),[xn,dn]=p.useState(null),[Nn,Sn]=p.useState(!1),[Et,In]=p.useState(am),[wn,Z]=p.useState("generic"),[ce,ge]=p.useState(null),[Ie,He]=p.useState(null),[Je,ft]=p.useState(null),[gt,nt]=p.useState(mg),[yt,rt]=p.useState(!1),[oe,Ne]=p.useState(null),[Lt,Wt]=p.useState(null),Kt=p.useRef(null),un=p.useRef(null),En=p.useRef(null),Hn=p.useRef(null),jn=p.useRef(null),Qt=p.useRef(null),ir=p.useRef(null),De=p.useRef(new Map),ze=p.useRef(new Map),$t=p.useRef(0),an=p.useRef(r),{showToast:kt}=Qn(),Zt=c.isDesktop&&!ve;p.useEffect(()=>{Ft("git_sidebar.props",{workspaceId:t,externalWindowMode:s})},[s,t]),p.useEffect(()=>{Q([]),W(!0),D(0),B(null),A(!1),te(null),se(""),R(!1),Se([]),re(null),Xe("unstaged"),ct(null),Ke(null),vt(!1),_e(null),qe(!1),Ee(null),wt(null),Pe(null),dt(!1),Dt(null),We(!1),Rt(!1),Vt([]),Be(new Set),Tt(new Map),dn(null),Sn(!1),In(am),Z("generic"),ge(null),He(null),ft(null),rt(!1),nt(mg),Ne(null),Wt(null),ze.current.clear(),De.current.clear()},[t]),p.useEffect(()=>{function $(){pe(window.innerWidth<=bj)}return $(),window.addEventListener("resize",$),()=>{window.removeEventListener("resize",$)}},[]),p.useEffect(()=>{if(!yt)return;const $=document.body.style.cursor,be=document.body.style.userSelect;document.body.style.cursor="row-resize",document.body.style.userSelect="none";function lt(en){Gn(en.clientY)}function Pt(){rt(!1)}return window.addEventListener("pointermove",lt),window.addEventListener("pointerup",Pt),()=>{document.body.style.cursor=$,document.body.style.userSelect=be,window.removeEventListener("pointermove",lt),window.removeEventListener("pointerup",Pt)}},[yt]),p.useEffect(()=>{var lt,Pt;if(!(t!=null&&t.trim())){S(null),j([]),D(0),B(null),_(null),K(!1);return}const $=t.trim(),be=Ur(vg($),vj);if(Ft("git_sidebar.snapshot",{workspaceId:$,cached:!!be,cachedHistoryCount:((lt=be==null?void 0:be.history)==null?void 0:lt.length)??0,cachedChangedCount:((Pt=be==null?void 0:be.status)==null?void 0:Pt.changes.length)??0}),be){Sr(be),K(!1);return}S(null),j([]),D(0),B(null),_(null),K(!0)},[t]),p.useEffect(()=>{if(t!=null&&t.trim())return v($=>{var be,lt,Pt;$.workspaceId===t.trim()&&(Ft("git_sidebar.snapshot_received",{workspaceId:$.workspaceId,changedCount:((be=$.status)==null?void 0:be.changes.length)??0,historyCount:$.history.length,branchCount:(((lt=$.branches)==null?void 0:lt.local.length)??0)+(((Pt=$.branches)==null?void 0:Pt.remote.length)??0)}),Sr($),K(!1))})},[v,t]),p.useEffect(()=>{if(!(t!=null&&t.trim()))return;const $=t.trim(),be=Ur(vg($),vj)!==null;if(m($),be){f($);return}Jt()},[f,m,t]),p.useEffect(()=>{const $=an.current;an.current=r,t!=null&&t.trim()&&!$&&r&&f(t.trim())},[r,f,t]),p.useEffect(()=>{t&&_s(vg(t),{status:y,history:T,historyTotalCount:N,historyNextCursor:H,branches:L})},[L,T,H,N,y,t]),p.useEffect(()=>{if(!y||!F)return;y.changes.find(be=>be.path===F)||te(null)},[F,y]),p.useEffect(()=>{F8(Hn.current)},[E]),p.useEffect(()=>{ve||(Se([]),re(null),ct(null),ge(null))},[ve]),p.useEffect(()=>{if(!y){Se([]);return}const $=new Set(y.changes.map(be=>be.path));Se(be=>be.filter(lt=>$.has(lt)))},[y]);function Pn(){const $=En.current;if(!$)return;$.querySelectorAll(".git-tree-shell").forEach(lt=>{lt.scrollTop=0})}function Sr($){S($.status),j(Array.isArray($.history)?$.history:[]),D(typeof $.historyTotalCount=="number"?$.historyTotalCount:0),B(typeof $.historyNextCursor=="string"?$.historyNextCursor:null),_($.branches??null)}function Jt($){t!=null&&t.trim()&&(K(!0),Ft("git_sidebar.refresh_requested",{workspaceId:t.trim(),resetTreeScroll:!1}),f(t.trim()))}async function Un($){if(!(t!=null&&t.trim()))return;const be=t.trim();K(!0);try{const[lt,Pt,en]=await Promise.all([NP(be),Ex(be,wj,null),RP(be)]);Sr({status:lt,history:Pt.items,historyTotalCount:Pt.totalCount,historyNextCursor:Pt.nextCursor,branches:en}),f(be),$!=null&&$.resetTreeScroll&&requestAnimationFrame(()=>{Pn()})}catch(lt){kt({title:Ds(lt,o("git.panelLoadFailed")),tone:"error"})}finally{K(!1)}}async function gr(){if(!(!t||!H||I)){A(!0);try{const $=await Ex(t,wj,H);j(be=>{const lt=new Set(be.map(en=>en.commitHash)),Pt=$.items.filter(en=>!lt.has(en.commitHash));return[...be,...Pt]}),D($.totalCount),B($.nextCursor)}catch($){kt({title:Ds($,o("git.panelLoadFailed")),tone:"error"})}finally{A(!1)}}}function ar($){if(!P||I||!H)return;const be=$.currentTarget;be.scrollHeight-be.scrollTop-be.clientHeight<=40&&gr()}async function qn(){if(t){q(!0);try{const $=await I_(t,"ai");se($.validation.normalizedDraft.subject||$.draft.subject)}catch($){kt({title:Ds($,o("git.draftFailed")),tone:"error"})}finally{q(!1)}}}async function br($,be){if(t&&$.length){q(!0);try{const lt=be?await A_(t,$):await DP(t,$);S(lt),te($[$.length-1]??null),Se(Pt=>Pt.filter(en=>!$.includes(en))),re(null),Jt()}catch(lt){K(!1),kt({title:Ds(lt,o("git.stageFailed")),tone:"error"})}finally{q(!1)}}}async function zn($){if(t&&$.length){q(!0);try{const be=await M_(t,$);S(be),$.includes(F??"")&&te(null),Se(lt=>lt.filter(Pt=>!$.includes(Pt))),re(null),Jt()}catch(be){K(!1),kt({title:Ds(be,o("git.discardFailed")),tone:"error"})}finally{q(!1)}}}async function Cr(){if(!(!t||!E.trim())){q(!0);try{await E_(t,E8(E)),kt({title:o("git.commitSuccess"),tone:"success"}),se(""),te(null),Jt()}catch($){kt({title:Ds($,o("git.commitFailed")),tone:"error"})}finally{q(!1)}}}function Yr($){In(B8(xn)),Sn(!0),ls($)}async function ls($){const be=t==null?void 0:t.trim();if(!be){Z("generic");return}try{const lt=await Fx(be);if((t==null?void 0:t.trim())!==be)return;Z(U8(lt,$))}catch{if((t==null?void 0:t.trim())!==be)return;Z("generic")}}function ts(){const $=W8(Et),be=o(wn==="github"?"git.remoteAuthGithubPatPlaceholder":"shell.clonePasswordPlaceholder");if(Et.authMode==="basic"){if(!Et.username.trim()){kt({title:o("shell.cloneUsernamePlaceholder"),tone:"error"});return}if(!Et.password){kt({title:be,tone:"error"});return}}if(Et.authMode==="token"&&!Et.token){kt({title:o("shell.cloneTokenPlaceholder"),tone:"error"});return}dn($),Sn(!1),kt({title:o($?"git.remoteAuthSaved":"git.remoteAuthCleared"),description:$&&Et.rememberOnHost?o("git.remoteAuthRememberHint"):void 0,tone:"success"})}async function Hr(){if(t){pn(!0);try{const $=await Fx(t);if($.length===0){kt({title:o("git.noRemotes"),tone:"error"});return}if($.length===1){cs([$[0].name]);return}Vt($),Be(new Set),Tt(new Map),Rt(!0)}catch($){kt({title:Ds($,o("git.remoteFailed")),tone:"error"})}finally{pn(!1)}}}async function cs($){if(!t||$.length===0)return;q(!0),Tt(new Map);const be=new Map;let lt=!1;try{for(const Pt of $)try{const en=await Lx(t,"push",Pt,xn,Et.rememberOnHost);be.set(Pt,{ok:!0,summary:en.summary})}catch(en){if(lt=!0,be.set(Pt,{ok:!1,summary:Ds(en,o("git.remoteFailed"))}),Tt(new Map(be)),Dj(en)){Yr(Pt);return}}Tt(be),Jt(),lt||(kt({title:o("git.pushAllSuccess",{count:String($.length)}),tone:"success"}),Rt(!1))}finally{q(!1)}}async function Ir($){if(t){if($==="push"){R(!1),Hr();return}q(!0);try{const be=await Lx(t,$,void 0,xn,Et.rememberOnHost);kt({title:be.summary,tone:"success"}),R(!1),Jt()}catch(be){if(Dj(be)){Yr();return}kt({title:Ds(be,o("git.remoteFailed")),tone:"error"})}finally{q(!1)}}}async function vr(){if(t){q(!0);try{const $=await L_(t);se($.commitSubject??""),kt({title:$.summary||o("git.undoLastCommitSuccess"),tone:"success"}),R(!1),Jt()}catch($){kt({title:Ds($,o("git.undoLastCommitFailed")),tone:"error"})}finally{q(!1)}}}async function wr($){if(t){q(!0);try{const be=await O_(t,$,!1);_(be),R(!1),Jt()}catch(be){kt({title:Ds(be,o("git.branchFailed")),tone:"error"})}finally{q(!1)}}}async function Yt($){const be=t==null?void 0:t.trim();if(!be)throw new Error(o("git.panelLoadFailed"));const lt=ze.current.get($);if(lt)return lt;const Pt=await F_(be,$);return ze.current.set($,Pt),Pt}async function bn($){Ke(null),ct(null),_e($),Ee(null);const be=ze.current.get($)??null;if(wt(be),qe(!be),be)return;const lt=$t.current+1;$t.current=lt;try{const Pt=await Yt($);if($t.current!==lt)return;wt(Pt)}catch(Pt){if($t.current!==lt)return;Ee(Ds(Pt,o("git.commitDetailLoadFailed"))),wt(null)}finally{$t.current===lt&&qe(!1)}}function yn(){_e(null),qe(!1),Ee(null),wt(null)}async function Tn($){try{const be=await Yt($);await Qr(be.versionLabel,o("git.copyCommitVersionSuccess"))}catch(be){kt({title:Ds(be,o("git.commitDetailLoadFailed")),tone:"error"})}}function or($){Ke(null),ct(null),Pe($),Dt(null),dt(!0)}function ue($){var lt;const be=((lt=T[0])==null?void 0:lt.commitHash)===$.commitHash&&$.commitKind==="local";return[{id:`view-changes:${$.commitHash}`,label:o("git.viewCommitChanges"),onSelect:()=>void bn($.commitHash)},{id:`copy-hash:${$.commitHash}`,label:o("git.copyCommitHash"),onSelect:()=>void Qr($.commitHash,o("git.copyCommitHashSuccess"))},{id:`copy-message:${$.commitHash}`,label:o("git.copyCommitMessage"),onSelect:()=>void Qr(Nl($),o("git.copyCommitMessageSuccess"))},{id:`copy-version:${$.commitHash}`,label:o("git.copyCommitVersion"),onSelect:()=>void Tn($.commitHash)},{id:`explain:${$.commitHash}`,label:o("git.explainCommitAction"),onSelect:()=>or($.commitHash)},...be?[{id:`undo:${$.commitHash}`,label:o("git.undoLastCommit"),disabled:G,onSelect:()=>void vr()}]:[]]}async function Ve($){Ke(null),ct(null),await Cv(ue($))}async function St(){var $,be;if(!(!t||!me||!Ye||ae)){We(!0);try{const lt=await Yt(me),Pt=await Dv({workspaceId:t,provider:Ye,content:L8(lt),clientRequestId:((be=($=globalThis.crypto)==null?void 0:$.randomUUID)==null?void 0:be.call($))??`git-explain-${Date.now()}-${Math.random().toString(16).slice(2)}`}),en=Pt.session??await Tv(Pt.sessionId);k(en),g(),w(en.workspaceId),l(Yn(en.workspaceId,en.sessionId)),dt(!1),Pe(null),Dt(null),kt({title:o("git.explainCommitStarted"),tone:"success"})}catch(lt){kt({title:Ds(lt,o("git.explainCommitFailed")),tone:"error"})}finally{We(!1)}}}function It($){Q(be=>be.includes($)?be.filter(lt=>lt!==$):[...be,$])}const vn=450;function fn($){const be=Date.now(),lt=Kt.current;return Kt.current={filePath:$,timestamp:be},(lt==null?void 0:lt.filePath)===$&&be-lt.timestamp<=vn}async function ln($,be){if(be.binary){kt({title:o("git.binaryDiff"),tone:"info"});return}if(be.status==="A"||be.status==="?")Wt(null),Ne($);else if(t)try{const lt=await PP(t,$,be.staged);Wt(lt.content),Ne($)}catch{Wt(null),Ne($)}}function jr($){te($),re(null),Se(be=>be.includes($)?be.filter(lt=>lt!==$):[...be,$])}function Gn($){const be=un.current;if(!be||!Number.isFinite($))return;const lt=be.getBoundingClientRect(),Pt=lt.height-ih;if(!Number.isFinite(lt.top)||!Number.isFinite(lt.height)||Pt<=0)return;const en=($-lt.top-ih/2)/Pt*100;if(!Number.isFinite(en))return;const ns=Math.max(gj,Math.min(pg,Math.round(en)));nt(ns)}function zr($){$.preventDefault(),Gn($.clientY),rt(!0)}const us=(y==null?void 0:y.changes)??[],zt=us.filter($=>Ab($,"staged")),V=us.filter($=>Ab($,"unstaged")),fe=Nj(zt,"staged"),xe=Nj(V,"unstaged"),at=new Set(U),ht=new Set(Y),ot=Pj(Y,us,"staged"),tn=Pj(Y,us,"unstaged"),Ln=us.length===0&&((y==null?void 0:y.snapshot.ahead)??0)>0,Jn=zt.length>0&&E.trim().length>0,Nr=(L==null?void 0:L.currentBranch)??(y==null?void 0:y.snapshot.branch)??o("common.unknown"),Ks=xn!==null,Er=wn==="github",Lr=o(Er?"git.remoteAuthDescriptionGithub":"git.remoteAuthDescription"),xs=o(Er?"git.remoteAuthGithubPatLabel":"shell.clonePasswordLabel"),lr=o(Er?"git.remoteAuthGithubPatPlaceholder":"shell.clonePasswordPlaceholder"),Di=o(Er?"git.remoteAuthGithubUsernamePlaceholder":"shell.cloneUsernamePlaceholder"),ds=Number.isFinite(gt)?gt:mg,Xi=P?`minmax(120px, ${ds}fr) ${ih}px minmax(140px, ${100-ds}fr)`:`minmax(120px, 1fr) ${ih}px auto`;p.useEffect(()=>{Le==="staged"&&ot.length===0&&re(null),Le==="unstaged"&&tn.length===0&&re(null)},[Le,ot.length,tn.length]),p.useEffect(()=>{if(!ve)return;const $=V.length>0?"unstaged":zt.length>0?"staged":"history";Xe(be=>be==="unstaged"&&V.length>0||be==="staged"&&zt.length>0?be:$)},[ve,zt.length,V.length]),p.useEffect(()=>{Ue&&(T.some($=>$.commitHash===Ue)||ct(null))},[T,Ue]),p.useEffect(()=>{Nt&&(T.some($=>$.commitHash===Nt)||Ke(null))},[Nt,T]),p.useEffect(()=>{ve&&Ce!=="history"&&J&&R(!1)},[ve,J,Ce]),p.useLayoutEffect(()=>{if(ve||!J){He(null);return}function $(){const lt=jn.current,Pt=Qt.current;!lt||!Pt||typeof window>"u"||He(Mb(lt.getBoundingClientRect(),{width:Pt.getBoundingClientRect().width||Rb,height:Pt.getBoundingClientRect().height||Pt.scrollHeight||0},{width:window.innerWidth,height:window.innerHeight}))}$();const be=window.requestAnimationFrame($);return window.addEventListener("resize",$),window.addEventListener("scroll",$,!0),()=>{window.cancelAnimationFrame(be),window.removeEventListener("resize",$),window.removeEventListener("scroll",$,!0)}},[G,L==null?void 0:L.local.length,Nr,ve,J,Ks]);const Xr=Ue??Nt;p.useLayoutEffect(()=>{if(!Xr){ft(null);return}const $=Xr;function be(){const Pt=De.current.get($)??null,en=ir.current;!Pt||!en||typeof window>"u"||ft(Mb(Pt.getBoundingClientRect(),{width:en.getBoundingClientRect().width||Rb,height:en.getBoundingClientRect().height||en.scrollHeight||0},{width:window.innerWidth,height:window.innerHeight}))}be();const lt=window.requestAnimationFrame(be);return window.addEventListener("resize",be),window.addEventListener("scroll",be,!0),()=>{window.cancelAnimationFrame(lt),window.removeEventListener("resize",be),window.removeEventListener("scroll",be,!0)}},[Xr,T.length]),p.useEffect(()=>{if(!Xr||typeof document>"u")return;const $=Xr;function be(lt){const Pt=lt.target;if(!(Pt instanceof Node))return;const en=De.current.get($)??null,ns=ir.current;en!=null&&en.contains(Pt)||ns!=null&&ns.contains(Pt)||(ct(null),Ke(null))}return document.addEventListener("pointerdown",be),()=>{document.removeEventListener("pointerdown",be)}},[Xr]);async function Qr($,be){var lt;try{if(typeof navigator>"u"||!((lt=navigator.clipboard)!=null&<.writeText))throw new Error("clipboard unavailable");await navigator.clipboard.writeText($),kt({title:be,tone:"success"})}catch{kt({title:o("common.copyContentFailed"),tone:"error"})}}async function hi($,be){typeof window<"u"&&!window.confirm(o("git.discardConfirm",{path:be}))||await zn($)}function mi($){const be=($==null?void 0:$.desktopFloating)===!0&&!ve,lt=be?{top:(Ie==null?void 0:Ie.top)??Es,left:(Ie==null?void 0:Ie.left)??Es,maxHeight:Ie==null?void 0:Ie.maxHeight,transformOrigin:(Ie==null?void 0:Ie.transformOrigin)??"top right"}:void 0,Pt=n.jsxs("div",{ref:be?Qt:void 0,className:"git-operations-menu","data-floating":be?"true":"false",style:lt,children:[n.jsxs("div",{className:"git-menu-section",children:[n.jsx("span",{className:"git-menu-caption",children:o("git.currentBranch")}),n.jsx("strong",{className:"git-menu-branch",children:Nr})]}),n.jsxs("div",{className:"git-menu-section",children:[n.jsx("span",{className:"git-menu-caption",children:o("git.remoteAuthStatusLabel")}),n.jsxs("div",{className:"git-menu-branch-list",children:[n.jsx("strong",{className:"git-menu-branch",children:o(Ks?"git.remoteAuthConfigured":"git.remoteAuthNotConfigured")}),n.jsx("button",{className:"git-menu-item",type:"button",disabled:G,onClick:()=>Yr(),children:n.jsx("span",{children:o("git.remoteAuthAction")})})]})]}),n.jsxs("div",{className:"git-menu-section",children:[n.jsx("span",{className:"git-menu-caption",children:o("git.branchTitle")}),n.jsx("div",{className:"git-menu-branch-list",children:L==null?void 0:L.local.map(en=>n.jsx("button",{className:"git-menu-item",type:"button",disabled:G||en.current,onClick:()=>void wr(en.name),children:n.jsx("span",{children:en.current?`${o("git.switchBranch")} ${en.name}`:`${o("git.switchBranchTo")} ${en.name}`})},en.name))})]}),n.jsxs("div",{className:"git-menu-section",children:[n.jsx("button",{className:"git-menu-item",type:"button",disabled:G,onClick:()=>{R(!1),vt(!0)},children:n.jsx("span",{children:o("git.viewAllVersions")})}),n.jsx("button",{className:"git-menu-item",type:"button",disabled:G,onClick:()=>void Ir("fetch"),children:n.jsx("span",{children:o("git.fetch")})}),n.jsx("button",{className:"git-menu-item",type:"button",disabled:G,onClick:()=>void Ir("pull"),children:n.jsx("span",{children:o("git.pull")})}),n.jsx("button",{className:"git-menu-item",type:"button",disabled:G,onClick:()=>void Ir("push"),children:n.jsx("span",{children:o("git.push")})}),n.jsx("button",{className:"git-menu-item",type:"button",disabled:G,onClick:()=>void vr(),children:n.jsx("span",{children:o("git.undoLastCommit")})}),n.jsx("button",{className:"git-menu-item",type:"button",disabled:G||X,onClick:()=>void Un({resetTreeScroll:!0}),children:n.jsx("span",{children:o("git.refresh")})})]})]});return be?typeof document>"u"?null:Vn.createPortal(Pt,document.body):Pt}function Ri($,be){if(be){De.current.set($,be);return}De.current.delete($)}function qr(){var lt;if(!Xr||typeof document>"u")return null;const $=T.find(Pt=>Pt.commitHash===Xr);if(!$)return null;const be=((lt=T[0])==null?void 0:lt.commitHash)===$.commitHash&&$.commitKind==="local";return Vn.createPortal(n.jsx("div",{ref:ir,className:"git-history-entry-menu","data-floating":"true",style:{top:(Je==null?void 0:Je.top)??Es,left:(Je==null?void 0:Je.left)??Es,maxHeight:Je==null?void 0:Je.maxHeight,transformOrigin:(Je==null?void 0:Je.transformOrigin)??"top right"},children:n.jsx(M8,{item:$,canUndo:be,actioning:G,onViewCommitChanges:Pt=>void bn(Pt),onCopyCommitHash:Pt=>void Qr(Pt,o("git.copyCommitHashSuccess")),onCopyCommitMessage:Pt=>void Qr(Nl(Pt),o("git.copyCommitMessageSuccess")),onCopyCommitVersion:Pt=>void Tn(Pt),onExplainCommitChange:Pt=>void or(Pt),onUndoLastCommit:()=>void vr()})}),document.body)}return n.jsxs("section",{className:["conversation-panel","surface-card","git-sidebar",e].filter(Boolean).join(" "),"data-testid":"git-sidebar",children:[n.jsxs("section",{className:"git-card git-scaffold-section",children:[n.jsxs("div",{className:"git-editor-row",children:[n.jsx("textarea",{ref:Hn,rows:1,value:E,onChange:$=>se(ZR($.target.value)),onKeyDown:$=>{$.key==="Enter"&&$.preventDefault()},placeholder:o("git.commitSubjectPlaceholder")}),n.jsx("button",{className:"git-icon-button",type:"button","aria-label":o("git.generateDraft"),title:o("git.generateDraft"),onClick:()=>void qn(),disabled:G||X,children:n.jsx(z8,{})})]}),n.jsxs("div",{className:"git-primary-actions",children:[n.jsx("button",{className:"secondary-button",type:"button",onClick:()=>void Un({resetTreeScroll:!0}),disabled:G||X||!t,children:o("git.refreshNow")}),n.jsx("button",{className:"primary-button git-primary-submit",type:"button",onClick:()=>{if(Ln){Hr();return}Cr()},disabled:G||!Ln&&!Jn,children:o(Ln?"git.pushNow":"git.commitNow")})]})]}),ve?n.jsxs("div",{className:"git-mobile-sections",children:[n.jsx(bg,{title:o("git.stagedChangesTitle"),count:zt.length,expanded:Ce==="staged",onToggle:()=>Xe("staged"),children:n.jsx(Sj,{title:o("git.stagedChangesTitle"),nodes:fe,collapsedTreePathSet:at,onToggleTreePath:It,onToggleMobileSelection:jr,selectedMobilePathSet:ht,selectedTargets:ot,actioning:G,variant:"staged",swipeRowState:ce,onSwipeRowChange:ge,onStageToggle:br,onDiscardWithConfirm:hi,onClearSelectedTargets:()=>Se($=>$.filter(be=>!ot.includes(be))),onPreviewFile:ln})}),n.jsx(bg,{title:o("git.changesTitle"),count:V.length,expanded:Ce==="unstaged",onToggle:()=>Xe("unstaged"),children:n.jsx(Sj,{title:o("git.changesTitle"),nodes:xe,collapsedTreePathSet:at,onToggleTreePath:It,onToggleMobileSelection:jr,selectedMobilePathSet:ht,selectedTargets:tn,actioning:G,variant:"unstaged",swipeRowState:ce,onSwipeRowChange:ge,onStageToggle:br,onDiscardWithConfirm:hi,onClearSelectedTargets:()=>Se($=>$.filter(be=>!tn.includes(be))),onPreviewFile:ln})}),n.jsxs(bg,{title:o("git.recentVersionsTitle"),count:N,expanded:Ce==="history",onToggle:()=>Xe("history"),trailingContent:n.jsx("span",{className:"badge",children:Nr}),headerAction:n.jsx("button",{className:"git-icon-button git-mobile-section-action",type:"button","aria-label":o("git.operationMenu"),title:o("git.operationMenu"),"aria-expanded":J,onClick:()=>{Xe("history"),R($=>!$)},disabled:G,children:n.jsx(fu,{})}),children:[J?n.jsx("div",{className:"git-mobile-operations-shell",children:mi()}):null,n.jsx(A8,{history:T,historyLoadingMore:I,hasMore:!!H,actioning:G,openCommitHash:Ue,onMenuTriggerRef:Ri,onToggleMenu:$=>ct(be=>be===$?null:$),onViewCommitChanges:$=>void bn($),onCopyCommitHash:$=>void Qr($,o("git.copyCommitHashSuccess")),onCopyCommitMessage:$=>void Qr(Nl($),o("git.copyCommitMessageSuccess")),onCopyCommitVersion:$=>void Tn($),onExplainCommitChange:$=>void or($),onUndoLastCommit:()=>void vr(),onLoadMore:()=>void gr()})]})]}):n.jsxs("div",{ref:un,className:"git-content-split",style:{gridTemplateRows:Xi},children:[n.jsx("section",{className:"git-card git-tree-panel",children:n.jsxs("div",{ref:En,className:"git-tree-panel-body",children:[zt.length>0?n.jsx(xj,{title:o("git.stagedChangesTitle"),count:zt.length,nodes:fe,selectedPath:F,collapsedTreePathSet:at,onToggleTreePath:It,onSelectFile:te,onPreviewFile:($,be)=>{fn($)&&ln($,be)},onToggleMobileSelection:jr,onStageToggle:br,onDiscard:zn,actioning:G,variant:"staged",isMobileViewport:ve,selectedMobilePathSet:ht,selectedTargets:ot,mobileActionMenuOpen:Le==="staged",onToggleMobileActionMenu:()=>re($=>$==="staged"?null:"staged"),onClearSelectedTargets:()=>Se($=>$.filter(be=>!ot.includes(be)))}):null,n.jsx(xj,{title:o("git.changesTitle"),count:V.length,nodes:xe,selectedPath:F,collapsedTreePathSet:at,onToggleTreePath:It,onSelectFile:te,onPreviewFile:($,be)=>{fn($)&&ln($,be)},onToggleMobileSelection:jr,onStageToggle:br,onDiscard:zn,actioning:G,variant:"unstaged",isMobileViewport:ve,selectedMobilePathSet:ht,selectedTargets:tn,mobileActionMenuOpen:Le==="unstaged",onToggleMobileActionMenu:()=>re($=>$==="unstaged"?null:"unstaged"),onClearSelectedTargets:()=>Se($=>$.filter(be=>!tn.includes(be)))})]})}),n.jsx("button",{className:"git-panel-divider",type:"button",role:"separator","aria-label":o("git.resizePanels"),"aria-orientation":"horizontal","aria-valuemin":gj,"aria-valuemax":pg,"aria-valuenow":P?ds:pg,"data-dragging":yt,onPointerDown:zr,children:n.jsx("span",{className:"git-panel-divider-handle","aria-hidden":"true"})}),n.jsxs("section",{className:"git-card git-history-section",children:[n.jsxs("div",{className:"git-history-topbar",children:[n.jsxs("button",{className:"git-section-toggle",type:"button","aria-expanded":P,"aria-label":o(P?"git.collapseRecentVersions":"git.expandRecentVersions"),onClick:()=>W($=>!$),children:[n.jsxs("span",{className:"git-section-toggle-main",children:[n.jsx(_m,{expanded:P}),n.jsx("span",{children:o("git.recentVersionsTitle")})]}),n.jsx("span",{className:"workbench-section-counter",children:N})]}),n.jsxs("div",{className:"git-history-actions",children:[n.jsx("span",{className:"badge",children:Nr}),n.jsx("button",{className:"git-icon-button",type:"button",ref:jn,"aria-label":o("git.operationMenu"),title:o("git.operationMenu"),onClick:()=>R($=>!$),disabled:G,children:n.jsx(fu,{})}),J?mi({desktopFloating:!0}):null]})]}),P?n.jsx(jj,{history:T,historyLoadingMore:I,hasMore:!!H,actioning:G,openCommitHash:Nt,useNativeContextMenu:Zt,onMenuTriggerRef:Ri,onScroll:ar,onToggleMenu:$=>{if(Zt){const be=T.find(lt=>lt.commitHash===$);be&&Ve(be);return}Ke(be=>be===$?null:$)},onOpenContextMenu:$=>void Ve($),onViewCommitChanges:$=>void bn($),onCopyCommitHash:$=>void Qr($,o("git.copyCommitHashSuccess")),onCopyCommitMessage:$=>void Qr(Nl($),o("git.copyCommitMessageSuccess")),onCopyCommitVersion:$=>void Tn($),onExplainCommitChange:$=>void or($),onUndoLastCommit:()=>void vr(),onLoadMore:()=>void gr()}):null]})]}),n.jsxs(Fn,{open:jt,title:o("git.selectRemoteTitle"),description:o("git.selectRemoteDesc"),onClose:()=>{G||Rt(!1)},children:[n.jsxs("div",{className:"git-remote-auth-banner",children:[n.jsxs("div",{className:"git-remote-auth-banner-copy",children:[n.jsx("strong",{children:o("git.remoteAuthStatusLabel")}),n.jsx("span",{children:o(Ks?"git.remoteAuthConfigured":"git.remoteAuthNotConfigured")})]}),n.jsx("button",{className:"secondary-button",type:"button",disabled:G,onClick:()=>Yr(),children:o("git.remoteAuthAction")})]}),n.jsx("div",{className:"git-remote-select-list",children:cn.map($=>{const be=ie.has($.name),lt=Mt.get($.name);return n.jsxs("label",{className:"git-remote-item",children:[n.jsx("input",{type:"checkbox",checked:be,disabled:G,onChange:()=>{Be(Pt=>{const en=new Set(Pt);return en.has($.name)?en.delete($.name):en.add($.name),en})}}),n.jsxs("span",{className:"git-remote-item-body",children:[n.jsx("span",{className:"git-remote-name",children:$.name}),n.jsx("span",{className:"git-remote-url",children:$.pushUrl}),lt&&n.jsx("span",{className:`git-remote-result ${lt.ok?"ok":"err"}`,children:lt.summary})]})]},$.name)})}),n.jsxs("div",{className:"git-remote-actions",children:[n.jsx("button",{className:"secondary-button",type:"button",disabled:G,onClick:()=>Rt(!1),children:o("common.close")}),n.jsx("button",{className:"primary-button",type:"button",disabled:G||ie.size===0,onClick:()=>void cs(Array.from(ie)),children:G?o("git.pushing"):o("git.pushSelected",{count:String(ie.size)})})]})]}),n.jsxs(Fn,{open:Nn,title:o("git.remoteAuthTitle"),description:Lr,onClose:()=>{G||Sn(!1)},children:[n.jsxs("div",{className:"workbench-clone-form",children:[n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("shell.cloneAuthModeLabel")}),n.jsxs("select",{value:Et.authMode,disabled:G,onChange:$=>In(be=>({...be,authMode:$.target.value})),children:[n.jsx("option",{value:"none",children:o("shell.cloneAuthModeNone")}),n.jsx("option",{value:"basic",children:o("shell.cloneAuthModeBasic")}),n.jsx("option",{value:"token",children:o("shell.cloneAuthModeToken")})]})]}),Et.authMode==="basic"?n.jsxs(n.Fragment,{children:[n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("shell.cloneUsernameLabel")}),n.jsx("input",{type:"text",value:Et.username,placeholder:Di,autoComplete:"username",onChange:$=>In(be=>({...be,username:$.target.value}))})]}),n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:xs}),n.jsx("input",{type:"password",value:Et.password,placeholder:lr,autoComplete:"current-password",onChange:$=>In(be=>({...be,password:$.target.value}))})]})]}):null,Et.authMode==="token"?n.jsxs(n.Fragment,{children:[n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("shell.cloneUsernameLabel")}),n.jsx("input",{type:"text",value:Et.username,placeholder:o("shell.cloneTokenUsernamePlaceholder"),autoComplete:"username",onChange:$=>In(be=>({...be,username:$.target.value}))})]}),n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("shell.cloneTokenLabel")}),n.jsx("input",{type:"password",value:Et.token,placeholder:o("shell.cloneTokenPlaceholder"),autoComplete:"current-password",onChange:$=>In(be=>({...be,token:$.target.value}))})]})]}):null,Er?n.jsx("p",{className:"git-remote-auth-hint",children:o("git.remoteAuthGithubPatHint")}):null,Et.authMode!=="none"?n.jsxs("label",{className:"settings-checkbox git-remote-auth-remember-toggle",children:[n.jsx("input",{type:"checkbox",checked:Et.rememberOnHost,onChange:$=>In(be=>({...be,rememberOnHost:$.target.checked}))}),n.jsx("span",{children:o("git.remoteAuthRemember")})]}):null,n.jsx("p",{className:"git-remote-auth-hint",children:o("git.remoteAuthSessionHint")})]}),n.jsxs("div",{className:"git-remote-actions",children:[n.jsx("button",{className:"secondary-button",type:"button",disabled:G,onClick:()=>Sn(!1),children:o("common.close")}),n.jsx("button",{className:"primary-button",type:"button",disabled:G,onClick:ts,children:o("git.remoteAuthSave")})]})]}),n.jsx(Fn,{open:ut,title:o("git.viewAllVersions"),description:o("git.viewAllVersionsDescription",{count:String(N)}),onClose:()=>vt(!1),children:n.jsx(jj,{history:T,historyLoadingMore:I,hasMore:!!H,actioning:G,openCommitHash:Nt,className:"git-history-modal-list",onMenuTriggerRef:Ri,onToggleMenu:$=>Ke(be=>be===$?null:$),onViewCommitChanges:$=>void bn($),onCopyCommitHash:$=>void Qr($,o("git.copyCommitHashSuccess")),onCopyCommitMessage:$=>void Qr(Nl($),o("git.copyCommitMessageSuccess")),onCopyCommitVersion:$=>void Tn($),onExplainCommitChange:$=>void or($),onUndoLastCommit:()=>void vr(),onLoadMore:()=>void gr()})}),n.jsx(Fn,{open:Te!==null,className:"git-commit-detail-modal",title:($e==null?void 0:$e.subject)||o("git.commitDetailTitle"),description:$e?o("git.commitDetailDescription",{hash:$e.shortHash}):o("git.commitDetailLoading"),onClose:yn,children:we?n.jsx("div",{className:"git-commit-detail-state",children:n.jsx("p",{children:o("git.commitDetailLoading")})}):ke?n.jsx("div",{className:"git-commit-detail-state is-error",children:n.jsx("p",{children:ke})}):$e?n.jsxs("div",{className:"git-commit-detail-shell",children:[n.jsxs("div",{className:"git-commit-detail-meta-grid",children:[n.jsxs("div",{className:"git-commit-detail-meta-card",children:[n.jsx("span",{children:o("git.commitVersionLabel")}),n.jsx("strong",{children:$e.versionLabel})]}),n.jsxs("div",{className:"git-commit-detail-meta-card",children:[n.jsx("span",{children:o("git.commitHashLabel")}),n.jsx("strong",{children:$e.commitHash})]}),n.jsxs("div",{className:"git-commit-detail-meta-card",children:[n.jsx("span",{children:o("git.commitAuthorLabel")}),n.jsx("strong",{children:$e.authorName})]}),n.jsxs("div",{className:"git-commit-detail-meta-card",children:[n.jsx("span",{children:o("git.commitTimeLabel")}),n.jsx("strong",{children:_8($e.authoredAt)})]})]}),n.jsxs("section",{className:"git-commit-detail-section",children:[n.jsx("div",{className:"git-commit-detail-section-header",children:n.jsx("h3",{children:o("git.commitMessageLabel")})}),n.jsx("pre",{className:"git-commit-detail-message",children:Nl($e)})]}),n.jsxs("section",{className:"git-commit-detail-section",children:[n.jsxs("div",{className:"git-commit-detail-section-header",children:[n.jsx("h3",{children:o("git.changedFilesTitle")}),n.jsx("span",{className:"workbench-section-counter",children:$e.changedFiles.length})]}),n.jsx("div",{className:"git-commit-detail-file-list",children:$e.changedFiles.map($=>n.jsxs("div",{className:"git-commit-detail-file-item",children:[n.jsx("span",{className:"git-commit-detail-file-status","data-status":$.status,children:$.status}),n.jsxs("div",{className:"git-commit-detail-file-copy",children:[n.jsx("strong",{children:$.path}),$.oldPath?n.jsx("span",{children:o("git.renamedFromLabel",{path:$.oldPath})}):null]})]},`${$.status}:${$.oldPath??""}:${$.path}`))})]}),n.jsxs("section",{className:"git-commit-detail-section",children:[n.jsxs("div",{className:"git-commit-detail-section-header",children:[n.jsx("h3",{children:o("git.commitDiffLabel")}),$e.diffTruncated?n.jsx("span",{className:"git-commit-detail-truncated",children:o("git.diffTruncated")}):null]}),n.jsx("pre",{className:"git-commit-detail-diff",children:$e.diffContent||o("git.emptyDiff")})]})]}):n.jsx("div",{className:"git-commit-detail-state",children:n.jsx("p",{children:o("git.commitDetailEmpty")})})}),n.jsx(Fn,{open:Ge,className:"git-explain-provider-modal",title:o("git.explainCommitTitle"),description:o("git.explainCommitDescription"),onClose:()=>{ae||(dt(!1),Pe(null),Dt(null))},children:n.jsxs("div",{className:"git-explain-provider-shell",children:[n.jsx(_v,{workspaceId:t,selectedProvider:Ye,pendingProvider:ae?Ye:null,disabled:ae,onSelect:$=>Dt($)}),n.jsxs("div",{className:"git-explain-provider-actions",children:[n.jsx("button",{type:"button",className:"secondary-button",disabled:ae,onClick:()=>{dt(!1),Pe(null),Dt(null)},children:o("common.cancel")}),n.jsx("button",{type:"button",className:"primary-button",disabled:!Ye||ae,onClick:()=>void St(),children:o(ae?"conversation.sendingState":"git.startExplainCommit")})]})]})}),n.jsx(IR,{workspaceId:t,filePath:oe,open:oe!==null,onClose:()=>{Ne(null),Wt(null)},onSaved:async()=>{await Un({resetTreeScroll:!0})},diffContent:Lt}),qr()]})}function xj({title:e,count:t,nodes:r,selectedPath:s,collapsedTreePathSet:i,onToggleTreePath:l,onSelectFile:c,onPreviewFile:d,onToggleMobileSelection:m,onStageToggle:f,onDiscard:v,actioning:g,variant:w,isMobileViewport:k,selectedMobilePathSet:y,selectedTargets:S,mobileActionMenuOpen:T,onToggleMobileActionMenu:j,onClearSelectedTargets:N}){const D=bw(r),H=o(w==="staged"?"git.unstageAll":"git.stageAll");return n.jsxs("section",{className:"git-tree-group","data-variant":w,children:[n.jsxs("div",{className:"git-section-header git-tree-group-header",children:[n.jsx("h3",{children:e}),n.jsxs("div",{className:"git-tree-group-actions",children:[n.jsx("span",{className:"workbench-section-counter",children:t}),!k&&D.length>0?n.jsxs(n.Fragment,{children:[n.jsx("button",{className:"git-icon-button",type:"button","aria-label":H,title:H,onClick:()=>void f(D,w==="staged"),disabled:g,children:n.jsx(Ib,{staged:w==="staged"})}),w==="unstaged"?n.jsx("button",{className:"git-icon-button danger",type:"button","aria-label":o("git.discardAll"),title:o("git.discardAll"),onClick:()=>void v(D),disabled:g,children:n.jsx(Eb,{})}):null]}):null,k&&S.length>0?n.jsx("button",{className:"git-icon-button",type:"button","aria-label":o("git.operationMenu"),title:o("git.operationMenu"),onClick:j,disabled:g,children:n.jsx(fu,{})}):null]}),k&&T?n.jsxs("div",{className:"git-selection-menu",children:[n.jsxs("div",{className:"git-menu-section",children:[n.jsx("span",{className:"git-menu-caption",children:o("git.selectedFiles")}),n.jsx("strong",{className:"git-menu-branch",children:S.length})]}),n.jsxs("div",{className:"git-menu-section",children:[n.jsx("button",{className:"git-menu-item",type:"button",disabled:g,onClick:()=>void f(S,w==="staged"),children:n.jsx("span",{children:o(w==="staged"?"git.unstage":"git.stage")})}),w==="unstaged"?n.jsx("button",{className:"git-menu-item",type:"button",disabled:g,onClick:()=>void v(S),children:n.jsx("span",{children:o("git.discard")})}):null,n.jsx("button",{className:"git-menu-item",type:"button",disabled:g,onClick:N,children:n.jsx("span",{children:o("git.clearSelection")})})]})]}):null]}),n.jsx("div",{className:"git-tree-shell",role:"tree","aria-label":e,children:r.length?XR({nodes:r,depth:0,collapsedTreePathSet:i,selectedPath:s,onToggleTreePath:l,onSelectFile:c,onPreviewFile:d,onToggleMobileSelection:m,onStageToggle:f,onDiscard:v,actioning:g,variant:w,isMobileViewport:k,selectedMobilePathSet:y}):n.jsx("p",{className:"git-tree-status",children:o("git.noChanges")})})]})}function bg({title:e,count:t,expanded:r,onToggle:s,trailingContent:i,headerAction:l,children:c}){return n.jsxs("section",{className:"git-mobile-section","data-expanded":r,children:[n.jsxs("div",{className:"git-mobile-section-header",children:[n.jsxs("button",{className:"git-mobile-section-toggle",type:"button","aria-expanded":r,onClick:s,children:[n.jsxs("span",{className:"git-mobile-section-toggle-main",children:[n.jsx(_m,{expanded:r}),n.jsx("h3",{children:e})]}),n.jsxs("span",{className:"git-mobile-section-toggle-meta",children:[i,n.jsx("span",{className:"workbench-section-counter",children:t})]})]}),l?n.jsx("div",{className:"git-mobile-section-header-action",children:l}):null]}),r?n.jsx("div",{className:"git-mobile-section-body",children:c}):null]})}function Sj({title:e,nodes:t,collapsedTreePathSet:r,onToggleTreePath:s,onToggleMobileSelection:i,selectedMobilePathSet:l,selectedTargets:c,actioning:d,variant:m,swipeRowState:f,onSwipeRowChange:v,onStageToggle:g,onDiscardWithConfirm:w,onClearSelectedTargets:k,onPreviewFile:y}){return n.jsxs("div",{className:"git-mobile-record-shell",children:[c.length>0?n.jsxs("div",{className:"git-mobile-selection-toolbar",children:[n.jsxs("span",{className:"git-mobile-selection-count",children:[o("git.selectedFiles")," ",c.length]}),n.jsxs("div",{className:"git-mobile-selection-actions",children:[n.jsx("button",{type:"button",className:"secondary-button",disabled:d,onClick:()=>void g(c,m==="staged"),children:o(m==="staged"?"git.unstage":"git.stage")}),m==="unstaged"?n.jsx("button",{type:"button",className:"secondary-button workbench-danger-button",disabled:d,onClick:()=>void w(c,`${c.length}`),children:o("git.discard")}):null,n.jsx("button",{type:"button",className:"secondary-button",disabled:d,onClick:k,children:o("git.clearSelection")})]})]}):null,n.jsx("div",{className:"git-mobile-record-list",role:"tree","aria-label":e,children:t.length?YR({nodes:t,depth:0,collapsedTreePathSet:r,onToggleTreePath:s,onToggleMobileSelection:i,selectedMobilePathSet:l,actioning:d,variant:m,swipeRowState:f,onSwipeRowChange:v,onStageToggle:g,onDiscardWithConfirm:w,onPreviewFile:y}):n.jsx("p",{className:"git-tree-status",children:o("git.noChanges")})})]})}function YR({nodes:e,depth:t,collapsedTreePathSet:r,onToggleTreePath:s,onToggleMobileSelection:i,selectedMobilePathSet:l,actioning:c,variant:d,swipeRowState:m,onSwipeRowChange:f,onStageToggle:v,onDiscardWithConfirm:g,onPreviewFile:w}){return e.map(k=>{if(k.kind==="directory"){const T=!r.has(k.path),j=bw(k.children),N=`directory:${k.path}`;return n.jsxs("div",{className:"git-mobile-record-branch",children:[n.jsx(Cj,{rowKey:N,openState:(m==null?void 0:m.path)===N?m.direction:null,onOpenStateChange:D=>f(D?{path:N,direction:D}:null),trailingActions:j.length>0?[{label:o(d==="staged"?"git.unstage":"git.stage"),tone:"accent",onPress:()=>void v(j,d==="staged")},...d==="unstaged"?[{label:o("git.discard"),tone:"danger",onPress:()=>void g(j,k.path)}]:[]]:null,children:n.jsxs("button",{className:"git-mobile-record git-mobile-record-directory",type:"button",style:{paddingInlineStart:`${yj+t*kj}px`},onClick:()=>s(k.path),children:[n.jsxs("span",{className:"git-mobile-record-leading",children:[n.jsx("span",{className:"git-tree-chevron","data-expanded":T,children:n.jsx(_m,{expanded:T})}),n.jsx("span",{className:"git-mobile-record-title",children:k.name})]}),n.jsx("span",{className:"git-mobile-record-meta",children:j.length})]})}),T?n.jsx("div",{className:"git-mobile-record-children",role:"group",children:YR({nodes:k.children,depth:t+1,collapsedTreePathSet:r,onToggleTreePath:s,onToggleMobileSelection:i,selectedMobilePathSet:l,actioning:c,variant:d,swipeRowState:m,onSwipeRowChange:f,onStageToggle:v,onDiscardWithConfirm:g,onPreviewFile:w})}):null]},N)}const y=`file:${k.path}`,S=l.has(k.path);return n.jsx(Cj,{rowKey:y,openState:(m==null?void 0:m.path)===y?m.direction:null,onOpenStateChange:T=>f(T?{path:y,direction:T}:null),trailingActions:[{label:o("git.preview"),tone:"neutral",onPress:()=>w(k.change.path,k.change)},{label:o(d==="staged"?"git.unstage":"git.stage"),tone:"accent",onPress:()=>void v([k.change.path],d==="staged")},...d==="unstaged"?[{label:o("git.discard"),tone:"danger",onPress:()=>void g([k.change.path],k.path)}]:[]],children:n.jsxs("div",{className:"git-mobile-record git-mobile-record-file","data-active":S,style:{paddingInlineStart:`${yj+t*kj}px`},children:[n.jsx("input",{className:"git-tree-select-checkbox",type:"checkbox",checked:S,"aria-label":`${o("git.selectFile")} ${k.name}`,onChange:()=>i(k.change.path)}),n.jsxs("button",{className:"git-mobile-record-file-main",type:"button",onClick:()=>i(k.change.path),children:[n.jsx("span",{className:"git-tree-file-icon","data-kind":Uo(k.name),"aria-hidden":"true",children:Wo(k.name)}),n.jsxs("span",{className:"git-mobile-record-copy",children:[n.jsx("span",{className:"git-mobile-record-title",children:k.name}),n.jsx("span",{className:"git-mobile-record-path",children:k.path})]}),n.jsx("span",{className:"git-status-badge","data-status":k.status,children:k.status})]})]})},y)})}function Cj({rowKey:e,openState:t,onOpenStateChange:r,trailingActions:s,children:i}){const l=di(),c=p.useRef(null),[d,m]=p.useState(0),f=((s==null?void 0:s.length)??0)*fg;p.useEffect(()=>{t||m(0)},[t,e]);const v=d!==0?d:t==="trailing"?-f:0;function g(S){var T,j;S.button===0&&(c.current={pointerId:S.pointerId,startX:S.clientX},(j=(T=S.currentTarget).setPointerCapture)==null||j.call(T,S.pointerId))}function w(S){const T=c.current;if(!T||T.pointerId!==S.pointerId)return;const j=f>0?f+10:0,N=Math.max(-j,Math.min(0,S.clientX-T.startX));m(N)}function k(S){var j,N;const T=c.current;if(!(!T||T.pointerId!==S.pointerId)){if((N=(j=S.currentTarget).releasePointerCapture)==null||N.call(j,S.pointerId),c.current=null,d<=-44&&(s!=null&&s.length)){l.trigger("gesture"),r("trailing"),m(0);return}r(null),m(0)}}function y(S){var j,N;const T=c.current;!T||T.pointerId!==S.pointerId||((N=(j=S.currentTarget).releasePointerCapture)==null||N.call(j,S.pointerId),c.current=null,m(0))}return n.jsxs("div",{className:"git-mobile-swipe-row","data-open-state":t??"closed","data-dragging":d!==0,children:[s==null?void 0:s.map((S,T)=>n.jsx("button",{type:"button",className:"git-mobile-swipe-action trailing","data-tone":S.tone,style:{right:T*fg,width:fg},onClick:()=>{l.trigger(S.tone==="danger"?"warning":"action"),r(null),S.onPress()},children:S.label},`trailing-${T}`)),n.jsx("div",{className:"git-mobile-swipe-content",style:{transform:`translateX(${v}px)`},onPointerDown:g,onPointerMove:w,onPointerUp:k,onPointerCancel:y,children:i})]})}function A8({history:e,historyLoadingMore:t,hasMore:r,actioning:s,openCommitHash:i,onMenuTriggerRef:l,onToggleMenu:c,onViewCommitChanges:d,onCopyCommitHash:m,onCopyCommitMessage:f,onCopyCommitVersion:v,onExplainCommitChange:g,onUndoLastCommit:w,onLoadMore:k}){return e.length?n.jsxs("div",{className:"git-mobile-history-list",children:[e.map(y=>n.jsx("article",{className:"git-mobile-history-entry","data-kind":y.commitKind,children:n.jsxs("div",{className:"git-mobile-history-entry-main",children:[n.jsx("span",{className:"git-history-marker","data-kind":y.commitKind,"aria-hidden":"true"}),n.jsxs("div",{className:"git-mobile-history-copy",children:[n.jsxs("div",{className:"git-history-title-row",children:[n.jsx("strong",{title:y.subject,children:y.subject}),n.jsx("span",{className:"git-history-kind-badge","data-kind":y.commitKind,children:eA(y.commitKind)})]}),y.refs.length>0?n.jsx("div",{className:"git-history-ref-list",children:y.refs.map(S=>n.jsx("span",{className:"git-history-ref-pill","data-kind":S.kind,"data-remote-index":String(tA(S.remoteName)),children:S.name},`${y.commitHash}:${S.kind}:${S.name}`))}):null,n.jsxs("div",{className:"git-history-meta",children:[n.jsx("span",{className:"git-history-hash",children:y.commitHash.slice(0,8)}),n.jsx("span",{children:y.authorName}),n.jsx("time",{dateTime:y.authoredAt,children:nA(y.authoredAt)})]})]}),n.jsx("button",{type:"button",className:"git-icon-button",ref:S=>l(y.commitHash,S),"aria-label":o("git.historyItemMenu"),onClick:()=>c(y.commitHash),children:n.jsx(fu,{})})]})},y.commitHash)),r?n.jsx("button",{type:"button",className:"secondary-button git-mobile-history-more",disabled:t,onClick:k,children:t?`${o("git.refreshNow")}...`:o("common.loadMore")}):null]}):n.jsx("p",{className:"git-tree-status",children:o("git.noHistory")})}function jj({history:e,historyLoadingMore:t,hasMore:r,actioning:s,openCommitHash:i,className:l,useNativeContextMenu:c=!1,onMenuTriggerRef:d,onScroll:m,onToggleMenu:f,onOpenContextMenu:v,onViewCommitChanges:g,onCopyCommitHash:w,onCopyCommitMessage:k,onCopyCommitVersion:y,onExplainCommitChange:S,onUndoLastCommit:T,onLoadMore:j}){return e.length?n.jsxs("div",{className:["git-history-list",l].filter(Boolean).join(" "),onScroll:m,children:[e.map(N=>{const D=i===N.commitHash;return n.jsxs("article",{className:"git-history-entry","data-kind":N.commitKind,"data-menu-open":D?"true":"false",onContextMenu:H=>{!c||!v||(H.preventDefault(),H.stopPropagation(),v(N))},children:[n.jsx("span",{className:"git-history-marker","data-kind":N.commitKind,"aria-hidden":"true"}),n.jsxs("div",{className:"git-history-body",children:[n.jsxs("div",{className:"git-history-title-row",children:[n.jsx("strong",{title:N.subject,children:N.subject}),n.jsxs("div",{className:"git-history-title-actions",children:[n.jsx("span",{className:"git-history-kind-badge","data-kind":N.commitKind,children:eA(N.commitKind)}),c?null:n.jsx("button",{type:"button",className:"git-icon-button git-history-more",ref:H=>d(N.commitHash,H),"aria-label":o("git.historyItemMenu"),onClick:()=>{f(N.commitHash)},children:n.jsx(fu,{})})]})]}),N.refs.length>0?n.jsx("div",{className:"git-history-ref-list",children:N.refs.map(H=>n.jsx("span",{className:"git-history-ref-pill","data-kind":H.kind,"data-remote-index":String(tA(H.remoteName)),children:H.name},`${N.commitHash}:${H.kind}:${H.name}`))}):null,n.jsxs("div",{className:"git-history-meta",children:[n.jsx("span",{className:"git-history-hash",children:N.commitHash.slice(0,8)}),n.jsx("span",{children:N.authorName}),n.jsx("time",{dateTime:N.authoredAt,children:nA(N.authoredAt)})]})]})]},N.commitHash)}),t?n.jsxs("p",{className:"git-history-loading",children:[o("git.refreshNow"),"..."]}):null,r?n.jsx("button",{type:"button",className:"secondary-button git-mobile-history-more",disabled:t,onClick:j,children:t?`${o("git.refreshNow")}...`:o("common.loadMore")}):null]}):n.jsx("p",{className:"status-text",children:o("git.noHistory")})}function M8({item:e,canUndo:t,actioning:r,onViewCommitChanges:s,onCopyCommitHash:i,onCopyCommitMessage:l,onCopyCommitVersion:c,onExplainCommitChange:d,onUndoLastCommit:m}){return n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",className:"git-menu-item",onClick:()=>s(e.commitHash),children:n.jsx("span",{children:o("git.viewCommitChanges")})}),n.jsx("button",{type:"button",className:"git-menu-item",onClick:()=>i(e.commitHash),children:n.jsx("span",{children:o("git.copyCommitHash")})}),n.jsx("button",{type:"button",className:"git-menu-item",onClick:()=>l(e),children:n.jsx("span",{children:o("git.copyCommitMessage")})}),n.jsx("button",{type:"button",className:"git-menu-item",onClick:()=>c(e.commitHash),children:n.jsx("span",{children:o("git.copyCommitVersion")})}),n.jsx("button",{type:"button",className:"git-menu-item",onClick:()=>d(e.commitHash),children:n.jsx("span",{children:o("git.explainCommitAction")})}),t?n.jsx("button",{type:"button",className:"git-menu-item",disabled:r,onClick:m,children:n.jsx("span",{children:o("git.undoLastCommit")})}):null]})}function XR({nodes:e,depth:t,collapsedTreePathSet:r,selectedPath:s,onToggleTreePath:i,onSelectFile:l,onPreviewFile:c,onToggleMobileSelection:d,onStageToggle:m,onDiscard:f,actioning:v,variant:g,isMobileViewport:w,selectedMobilePathSet:k}){return e.map(y=>{if(y.kind==="directory"){const j=!r.has(y.path),N=bw(y.children),D=`${o(g==="staged"?"git.unstage":"git.stage")} ${y.path}`,H=`${o("git.discard")} ${y.path}`;return n.jsxs("div",{className:"git-tree-node",children:[n.jsxs("div",{className:"git-tree-row",role:"treeitem","aria-expanded":j,children:[n.jsxs("button",{className:"git-tree-trigger",type:"button",style:{paddingInlineStart:`${6+t*8}px`},onClick:()=>i(y.path),children:[n.jsx("span",{className:"git-tree-chevron","data-expanded":j,children:n.jsx(_m,{expanded:j})}),n.jsx("span",{className:"git-tree-label git-tree-label-directory",children:y.name})]}),!w&&N.length>0?n.jsxs("div",{className:"git-row-actions",children:[n.jsx("button",{className:"git-icon-button",type:"button","aria-label":D,title:D,onClick:()=>void m(N,g==="staged"),disabled:v,children:n.jsx(Ib,{staged:g==="staged"})}),g==="unstaged"?n.jsx("button",{className:"git-icon-button danger",type:"button","aria-label":H,title:H,onClick:()=>void f(N),disabled:v,children:n.jsx(Eb,{})}):null]}):null]}),j?n.jsx("div",{className:"git-tree-children",role:"group",children:XR({nodes:y.children,depth:t+1,collapsedTreePathSet:r,selectedPath:s,onToggleTreePath:i,onSelectFile:l,onPreviewFile:c,onToggleMobileSelection:d,onStageToggle:m,onDiscard:f,actioning:v,variant:g,isMobileViewport:w,selectedMobilePathSet:k})}):null]},`directory:${y.path}`)}const S=k.has(y.path),T=w?S:s===y.path;return w?n.jsxs("div",{className:"git-tree-row",role:"treeitem","data-active":T,"data-mobile":"true",children:[n.jsx("input",{className:"git-tree-select-checkbox",type:"checkbox",checked:S,"aria-label":`${o("git.selectFile")} ${y.name}`,onChange:()=>d(y.change.path)}),n.jsxs("button",{className:"git-tree-file-button",type:"button","data-active":T,"data-mobile":"true",style:{paddingInlineStart:`${18+t*8}px`},onClick:()=>d(y.change.path),children:[n.jsx("span",{className:"git-tree-file-icon","data-kind":Uo(y.name),"aria-hidden":"true",children:Wo(y.name)}),n.jsx("span",{className:"git-tree-label-wrap",children:n.jsx("span",{className:"git-tree-label",children:y.name})}),n.jsx("span",{className:"git-tree-file-meta",children:n.jsx("span",{className:"git-status-badge","data-status":y.status,children:y.status})})]})]},`file:${y.path}`):n.jsxs("div",{className:"git-tree-row",role:"treeitem","data-active":T,children:[n.jsxs("button",{className:"git-tree-file-button",type:"button","data-active":T,style:{paddingInlineStart:`${18+t*8}px`},onClick:()=>{l(y.change.path),c&&c(y.change.path,y.change)},children:[n.jsx("span",{className:"git-tree-file-icon","data-kind":Uo(y.name),"aria-hidden":"true",children:Wo(y.name)}),n.jsx("span",{className:"git-tree-label-wrap",children:n.jsx("span",{className:"git-tree-label",children:y.name})}),n.jsx("span",{className:"git-tree-file-meta",children:n.jsx("span",{className:"git-status-badge","data-status":y.status,children:y.status})})]}),n.jsxs("div",{className:"git-row-actions",children:[n.jsx("button",{className:"git-icon-button",type:"button","aria-label":y.variant==="staged"?o("git.unstage"):o("git.stage"),title:y.variant==="staged"?o("git.unstage"):o("git.stage"),onClick:()=>void m([y.change.path],y.variant==="staged"),disabled:v,children:n.jsx(Ib,{staged:y.variant==="staged"})}),g==="unstaged"?n.jsx("button",{className:"git-icon-button danger",type:"button","aria-label":o("git.discard"),title:o("git.discard"),onClick:()=>void f([y.change.path]),disabled:v,children:n.jsx(Eb,{})}):null]})]},`file:${y.path}`)})}function Tj(e,t){return{kind:"directory",name:e,path:t,children:new Map}}function Nj(e,t){const r=Tj("","");for(const s of e){const i=s.path.replace(/\\/g,"/"),l=i.split("/").filter(Boolean);let c=r;l.forEach((d,m)=>{const f=l.slice(0,m+1).join("/");if(m===l.length-1){c.children.set(`file:${f}`,{kind:"file",name:d,path:i,change:s,status:I8(s,t),variant:t});return}const v=`directory:${f}`,g=c.children.get(v);if(g&&g.kind==="directory"){c=g;return}const w=Tj(d,f);c.children.set(v,w),c=w})}return JR(QR([...r.children.values()]))}function QR(e){return[...e].sort((t,r)=>t.kind!==r.kind?t.kind==="directory"?-1:1:t.name.localeCompare(r.name,"zh-CN")).map(t=>t.kind==="directory"?{kind:"directory",name:t.name,path:t.path,children:QR([...t.children.values()])}:t)}function JR(e){return e.map(t=>{var c;if(t.kind!=="directory")return t;const r=JR(t.children);let s=t.name,i=t.path,l=r;for(;l.length===1&&((c=l[0])==null?void 0:c.kind)==="directory";){const d=l[0];s=`${s}/${d.name}`,i=d.path,l=d.children}return{kind:"directory",name:s,path:i,children:l}})}function Pj(e,t,r){const s=new Set(e);return t.filter(i=>Ab(i,r)&&s.has(i.path)).map(i=>i.path)}function bw(e){const t=[],r=new Set;function s(i){if(i.kind==="file"){r.has(i.path)||(r.add(i.path),t.push(i.path));return}i.children.forEach(s)}return e.forEach(s),t}function Ab(e,t){return t==="staged"?!!e.stagedStatus:!!e.worktreeStatus}function I8(e,t){return t==="staged"?e.stagedStatus??e.status:e.worktreeStatus??e.status}function E8(e){return{subject:ZR(e).trim(),body:null,footer:null,source:"manual"}}function ZR(e){return e.replace(/[\r\n]+/g," ")}function Nl(e){const t=e.subject.trim(),r=e.body.trim();return r?`${t}
|
|
118
|
-
|
|
119
|
-
${r}`:t}function L8(e){const t=e.changedFiles.map(i=>`- [${i.status}] ${i.path}${i.oldPath?` (from ${i.oldPath})`:""}`).join(`
|
|
120
|
-
`),r=e.diffContent.length>gg?e.diffContent.slice(0,gg):e.diffContent,s=e.diffContent.length>gg||e.diffTruncated?`
|
|
121
|
-
注意:diff 内容过长,下面已经截断,只分析可见部分,同时明确指出可能遗漏的区域。`:"";return["请你分析下面这个 Git 提交。","输出要求:","1. 先用 3 到 5 句话说明这次改动的核心目的。","2. 按文件说明关键改动点,不要泛泛而谈。","3. 指出潜在风险、边界情况和可能的回归点。","4. 如果提交信息写得差,给出一条更合适的中文提交说明。","",`版本号:${e.versionLabel}`,`Commit Hash:${e.commitHash}`,`提交标题:${e.subject}`,`提交作者:${e.authorName} <${e.authorEmail}>`,`提交时间:${e.authoredAt}`,"","变更文件:",t||"- 无",s,"","Diff:",r||"(empty diff)"].join(`
|
|
122
|
-
`)}function F8(e){if(!e)return;e.style.height="0px";const t=Math.min(Math.max(e.scrollHeight,34),120);e.style.height=`${t}px`,e.style.overflowY=e.scrollHeight>120?"auto":"hidden"}function eA(e){switch(e){case"local":return o("git.historyKindLocal");case"remote":return o("git.historyKindRemote");default:return o("git.historyKindShared")}}function tA(e){if(!e)return 0;let t=0;for(const r of e)t=t*33+r.charCodeAt(0)>>>0;return t%6}function _8(e){const t=Date.parse(e);return Number.isNaN(t)?e:new Intl.DateTimeFormat("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1}).format(t)}function Ds(e,t){return e instanceof Kr?O8(e)??e.message:typeof e=="object"&&e&&"message"in e?e.message:t}function vg(e){return`git-sidebar.snapshot.${e}`}function O8(e){switch(e.errorCode){case"UNAUTHORIZED":return o("git.errors.unauthorized");case"WORKSPACE_NOT_FOUND":return o("git.errors.workspaceNotFound");case"INVALID_WORKSPACE":return o("git.errors.invalidWorkspace");case"NOT_GIT_REPOSITORY":return o("git.errors.notGitRepository");case"GIT_REPO_NOT_FOUND":return o("git.errors.repoNotFound");case"PATH_OUT_OF_WORKSPACE":return o("git.errors.pathOutOfWorkspace");case"INVALID_TARGET":return o("git.errors.invalidTarget");case"NOT_STAGED":return o("git.errors.notStaged");case"EMPTY_STAGED_CHANGES":return o("git.errors.emptyStagedChanges");case"BRANCH_CONFLICT":return o("git.errors.branchConflict");case"BRANCH_NOT_FOUND":return o("git.errors.branchNotFound");case"REMOTE_NOT_FOUND":return o("git.errors.remoteNotFound");case"GIT_REMOTE_AUTH_FAILED":return o("git.errors.remoteAuthFailed");case"GIT_PUSH_FAILED":return o("git.errors.pushFailed");case"GIT_PULL_FAILED":return o("git.errors.pullFailed");case"GIT_REMOTE_FAILED":return o("git.errors.remoteFailed");case"GIT_COMMAND_TIMEOUT":return o("git.errors.commandTimeout");case"GIT_DISCARD_FAILED":return o("git.discardFailed");case"GIT_UNDO_FAILED":return o("git.undoLastCommitFailed");default:return null}}function Dj(e){return e instanceof Kr&&e.errorCode==="GIT_REMOTE_AUTH_FAILED"}function B8(e){return!e||!e.mode||e.mode==="none"?am:e.mode==="basic"?{authMode:"basic",username:e.username??"",password:e.password??"",token:"",rememberOnHost:!1}:e.mode==="token"?{authMode:"token",username:e.username??"",password:"",token:e.token??"",rememberOnHost:!1}:am}function W8(e){return e.authMode==="none"?null:e.authMode==="basic"?{mode:"basic",username:e.username.trim(),password:e.password}:{mode:"token",username:e.username.trim()||void 0,token:e.token}}function U8(e,t){const r=e.find(i=>i.name===t)??e.find(i=>i.name==="origin")??e[0];if(!r)return"generic";const s=r.pushUrl||r.fetchUrl;return H8(s)?"github":"generic"}function H8(e){const t=(e==null?void 0:e.trim().toLowerCase())??"";return t.startsWith("https://github.com/")||t.startsWith("http://github.com/")||t.startsWith("ssh://git@github.com/")||t.startsWith("git@github.com:")}function Mb(e,t,r){const s=Math.max(0,r.width),i=Math.max(0,r.height),l=Math.max(0,i-Es*2),c=Math.max(0,s-Es*2),d=Math.min(Math.max(t.width||Rb,0),c),m=Math.max(0,i-e.bottom-ah-Es),f=Math.max(0,e.top-ah-Es),v=m<t.height&&f>m,w=wg(Math.max(v?f:m,R8),0,l),k=Math.min(Math.max(t.height,0),w),y=v?e.top-ah-k:e.bottom+ah,S=Math.max(Es,i-Es-k),T=Math.max(Es,s-Es-d);return{top:wg(y,Es,S),left:wg(e.right-d,Es,T),maxHeight:Math.max(0,w),transformOrigin:`${v?"bottom":"top"} right`}}function wg(e,t,r){return!Number.isFinite(e)||r<t?t:Math.min(Math.max(e,t),r)}function _m({expanded:e}){return n.jsx("svg",{className:"git-chevron-icon",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:e?"rotate(0deg)":"rotate(-90deg)"},"aria-hidden":"true",children:n.jsx("polyline",{points:"6 9 12 15 18 9"})})}function Ib({staged:e}){return e?n.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:n.jsx("path",{d:"M5 12h14"})}):n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:[n.jsx("path",{d:"M12 5v14"}),n.jsx("path",{d:"M5 12h14"})]})}function Eb(){return n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:[n.jsx("path",{d:"M10 7L6 11l4 4",strokeLinecap:"round",strokeLinejoin:"round"}),n.jsx("path",{d:"M7 11h7c3.87 0 7 3.13 7 7 0 1.9-.76 3.63-2 4.89",strokeLinecap:"round",strokeLinejoin:"round"})]})}function z8(){return n.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:n.jsx("path",{d:"M12 3l1.9 5.1L19 10l-5.1 1.9L12 17l-1.9-5.1L5 10l5.1-1.9L12 3z"})})}function fu(){return n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:[n.jsx("circle",{cx:"5",cy:"12",r:"1.8"}),n.jsx("circle",{cx:"12",cy:"12",r:"1.8"}),n.jsx("circle",{cx:"19",cy:"12",r:"1.8"})]})}function nA(e){try{return new Intl.DateTimeFormat("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(new Date(e))}catch{return e}}const q8=Object.freeze(Object.defineProperty({__proto__:null,GitSidebar:gw,resolveGitOperationsMenuPosition:Mb},Symbol.toStringTag,{value:"Module"})),Rc=5;function rA({session:e}){const{showToast:t}=Qn(),{requestNavigationRefresh:r}=Mr(),[s,i]=p.useState(!1),[l,c]=p.useState(!1),[d,m]=p.useState(null),[f,v]=p.useState(null),[g,w]=p.useState(null),[k,y]=p.useState(""),[S,T]=p.useState(""),[j,N]=p.useState(Rc),[D,H]=p.useState(!1),[B,I]=p.useState(0),A=p.useMemo(()=>{var K;return((K=e==null?void 0:e.title)==null?void 0:K.trim())||null},[e==null?void 0:e.title]),L=p.useMemo(()=>d?{workspaceId:d.workspaceId,project:d.project,session:d.session}:null,[d]),_=(d==null?void 0:d.latestFollowUpTask)??null;if(p.useEffect(()=>{i(!1),H(!1),v(null),m(null),y(""),T(""),N(Rc)},[e==null?void 0:e.sessionId]),p.useEffect(()=>{if(!(e!=null&&e.sessionId)){c(!1);return}let K=!1;return c(!0),v(null),MO(e.sessionId).then(G=>{K||m(G.context)}).catch(G=>{K||(m(null),v(G instanceof Error?G.message:o("conversation.butlerActionLoadFailed")))}).finally(()=>{K||c(!1)}),()=>{K=!0}},[B,e==null?void 0:e.sessionId]),!(e!=null&&e.sessionId))return null;function F(){l||I(K=>K+1)}function te(){!d&&!l&&F()}async function E(){if(!L){te();return}const K=k.trim();if(!K){t({title:o("conversation.butlerFollowUpObjectiveRequired"),tone:"warning"});return}w("follow-up");try{const G=await CO({projectId:L.project.id,butlerSessionId:L.session.id,objective:K,completionCriteria:S.trim()||void 0,maxAutoContinueCount:j});m(q=>q&&{...q,latestFollowUpTask:G.task}),r(),t({title:o("conversation.butlerFollowUpStarted"),description:o("conversation.butlerFollowUpStartedDescription",{projectName:L.project.name}),tone:"success"}),y(""),T(""),N(Rc),i(!1)}catch(G){t({title:o("conversation.butlerFollowUpFailed"),description:G instanceof Error?G.message:void 0,tone:"error"})}finally{w(null)}}async function se(){if(_){w("follow-up");try{const K=await jO(_.id);m(G=>G&&{...G,latestFollowUpTask:K.task}),r(),t({title:o("conversation.butlerFollowUpStopped"),description:o("conversation.butlerFollowUpStoppedDescription"),tone:"success"}),i(!1)}catch(K){t({title:o("conversation.butlerFollowUpStopFailed"),description:K instanceof Error?K.message:void 0,tone:"error"})}finally{w(null)}}}async function X(){if(!L){te();return}w("verification");try{await IO({projectId:L.project.id,butlerSessionId:L.session.id,verificationType:"browser",targetRef:A||L.session.title||L.project.name}),r(),t({title:o("conversation.butlerVerificationStarted"),description:o("conversation.butlerVerificationStartedDescription",{projectName:L.project.name}),tone:"success"}),i(!1)}catch(K){t({title:o("conversation.butlerVerificationFailed"),description:K instanceof Error?K.message:void 0,tone:"error"})}finally{w(null)}}return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"conversation-butler-entry",onMouseEnter:()=>{H(!0),te()},onMouseLeave:()=>{H(!1)},children:[n.jsx("button",{type:"button",className:"conversation-header-ai-button","aria-label":o("conversation.butlerActionButton"),title:o("conversation.butlerActionButton"),onFocus:()=>{H(!0),te()},onBlur:()=>{H(!1)},onClick:()=>{i(!0),te()},children:n.jsx("span",{className:"conversation-header-ai-button-label","aria-hidden":"true",children:n.jsx(zB,{})})}),D?n.jsxs("div",{className:"conversation-butler-analysis-popover",role:"status","aria-live":"polite",children:[n.jsx("strong",{children:o("conversation.butlerAnalysisTitle")}),l?n.jsx("p",{children:o("conversation.butlerActionLoading")}):f?n.jsx("p",{children:f}):_?n.jsxs(n.Fragment,{children:[n.jsxs("p",{children:[o("conversation.butlerAnalysisObjectiveLabel"),":",_.objective]}),n.jsxs("p",{children:[o("conversation.butlerAnalysisStatusLabel"),":",Rj(_.status)]}),n.jsxs("p",{children:[o("conversation.butlerAnalysisSummaryLabel"),":",_.lastAutomationSummary||_.waitingReason||o("conversation.butlerAnalysisEmpty")]}),_.waitingReason?n.jsxs("p",{children:[o("conversation.butlerAnalysisWaitingReasonLabel"),":",_.waitingReason]}):null]}):n.jsx("p",{children:o("conversation.butlerAnalysisEmpty")})]}):null]}),n.jsx(Fn,{open:s,title:o("conversation.butlerActionModalTitle"),description:o("conversation.butlerActionModalDescription"),onClose:()=>{g||i(!1)},children:n.jsxs("div",{className:"conversation-butler-modal",children:[l?n.jsx("p",{className:"conversation-butler-modal-hint",children:o("conversation.butlerActionLoading")}):null,!l&&f?n.jsx("p",{className:"conversation-butler-modal-error",children:f}):null,!l&&!f&&L?n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"conversation-butler-target-card",children:[n.jsx("span",{children:o("conversation.butlerActionProjectLabel")}),n.jsx("strong",{children:L.project.name})]}),n.jsxs("div",{className:"conversation-butler-target-card",children:[n.jsx("span",{children:o("conversation.butlerActionSessionLabel")}),n.jsx("strong",{children:L.session.title||A||L.session.sessionId})]}),n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("conversation.butlerFollowUpObjectiveLabel")}),n.jsx("textarea",{rows:4,value:k,placeholder:o("conversation.butlerFollowUpObjectivePlaceholder"),disabled:g!==null,onChange:K=>{y(K.target.value)}})]}),n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("conversation.butlerFollowUpCompletionCriteriaLabel")}),n.jsx("textarea",{rows:3,value:S,placeholder:o("conversation.butlerFollowUpCompletionCriteriaPlaceholder"),disabled:g!==null,onChange:K=>{T(K.target.value)}})]}),n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("conversation.butlerFollowUpRoundLimitLabel")}),n.jsx("input",{type:"number",min:1,max:20,value:j,disabled:g!==null,onChange:K=>{const G=Number.parseInt(K.target.value,10);N(Number.isFinite(G)?G:Rc)}}),n.jsx("small",{children:o("conversation.butlerFollowUpRoundLimitHint")})]}),_&&(_.status==="active"||_.status==="waiting_user")?n.jsxs("div",{className:"conversation-butler-target-card",children:[n.jsx("span",{children:o("conversation.butlerCurrentFollowUpLabel")}),n.jsx("strong",{children:Rj(_.status)}),n.jsx("small",{children:o("conversation.butlerCurrentFollowUpProgress",{current:_.autoContinueCount,max:_.maxAutoContinueCount??Rc})}),n.jsx("button",{type:"button",className:"workbench-secondary-button",disabled:g!==null,onClick:()=>{se()},children:o("conversation.butlerStopFollowUpAction")})]}):null,n.jsxs("div",{className:"conversation-butler-action-grid",children:[n.jsxs("button",{type:"button",className:"conversation-butler-action-card",disabled:g!==null,onClick:()=>{E()},children:[n.jsx("strong",{children:o("conversation.butlerFollowUpAction")}),n.jsx("span",{children:o("conversation.butlerFollowUpActionDescription")})]}),n.jsxs("button",{type:"button",className:"conversation-butler-action-card",disabled:g!==null,onClick:()=>{X()},children:[n.jsx("strong",{children:o("conversation.butlerVerificationAction")}),n.jsx("span",{children:o("conversation.butlerVerificationActionDescription")})]})]})]}):null]})})]})}function Rj(e){switch(e){case"waiting_user":return o("shell.butlerAutomationStatusWaitingUser");case"completed":return o("shell.butlerAutomationStatusCompleted");case"failed":return o("shell.butlerAutomationStatusFailed");case"cancelled":return o("shell.butlerAutomationStatusCancelled");case"active":default:return o("shell.butlerAutomationStatusActive")}}function $8({session:e,onOpenBranchTree:t}){return e?n.jsxs("div",{className:"mobile-conversation-session-actions",children:[t?n.jsx("button",{type:"button",className:"conversation-header-ai-button","aria-label":o("conversation.branchTreeAction"),title:o("conversation.branchTreeAction"),onClick:t,children:n.jsx("span",{className:"conversation-header-ai-button-label","aria-hidden":"true",children:n.jsx(BD,{})})}):null,n.jsx(rA,{session:e})]}):null}function V8({requests:e,replyingRequestId:t,onReply:r}){const[s,i]=p.useState({}),l=p.useMemo(()=>e.filter(c=>c.status==="pending"),[e]);return l.length===0?null:n.jsxs("section",{className:"permission-request-list",children:[n.jsxs("div",{className:"permission-request-list-header",children:[n.jsx("div",{children:n.jsx("strong",{children:o("conversation.permissionRequestSectionTitle")})}),n.jsx("span",{className:"permission-request-count",children:l.length})]}),n.jsx("div",{className:"permission-request-stack",children:l.map(c=>{var w,k;const d=s[c.id]??{},m=c.paths.filter(Boolean),f=c.kind==="command"&&!!((w=c.command)!=null&&w.trim()),v=c.questions.length===0&&m.length===0&&!f&&!!((k=c.summary)!=null&&k.trim()),g=c.kind==="user_input"&&c.questions.some(y=>{var S;return(((S=d[y.id])==null?void 0:S.filter(Boolean).length)??0)===0});return n.jsxs("article",{className:"permission-request-card",children:[n.jsxs("header",{className:"permission-request-card-header",children:[n.jsxs("div",{className:"permission-request-provider",children:[n.jsx("span",{className:"permission-request-provider-icon","aria-hidden":"true",children:n.jsx("img",{src:EP(c.provider),alt:"",loading:"lazy"})}),n.jsxs("div",{className:"permission-request-provider-copy",children:[n.jsx("strong",{children:c.title}),n.jsx("span",{children:Vs(c.provider,"full")})]})]}),n.jsx("span",{className:"permission-request-kind",children:G8(c.kind)})]}),n.jsxs("div",{className:"permission-request-card-body",children:[m.length>0?n.jsx("div",{className:"permission-request-block",children:n.jsx("ul",{className:"permission-request-target-list",children:m.map(y=>n.jsxs("li",{className:"permission-request-target-item",children:[n.jsx("strong",{children:K8(y)}),n.jsx("span",{children:y})]},`${c.id}:${y}`))})}):null,f?n.jsxs("div",{className:"permission-request-block",children:[n.jsx("div",{className:"permission-request-block-label",children:o("conversation.permissionRequestCommandLabel")}),n.jsx("pre",{children:c.command})]}):null,v?n.jsx("p",{className:"permission-request-summary",children:c.summary}):null,c.questions.length>0?n.jsxs("div",{className:"permission-request-block",children:[n.jsx("div",{className:"permission-request-block-label",children:o("conversation.permissionRequestQuestionsLabel")}),n.jsx("div",{className:"permission-request-question-list",children:c.questions.map(y=>n.jsxs("div",{className:"permission-request-question",children:[n.jsx("div",{className:"permission-request-question-header",children:y.header}),n.jsx("p",{children:y.question}),n.jsx("div",{className:"permission-request-question-options",children:y.options.map(S=>{var j;const T=((j=d[y.id])==null?void 0:j.includes(S.label))??!1;return n.jsxs("label",{className:"permission-request-question-option",children:[n.jsx("input",{type:"radio",name:`${c.id}:${y.id}`,checked:T,onChange:()=>{i(N=>({...N,[c.id]:{...N[c.id]??{},[y.id]:[S.label]}}))}}),n.jsxs("span",{children:[n.jsx("strong",{children:S.label}),S.description?n.jsx("small",{children:S.description}):null]})]},`${y.id}:${S.label}`)})})]},y.id))})]}):null]}),n.jsx("footer",{className:"permission-request-card-footer",children:c.actions.map(y=>n.jsx("button",{type:"button",className:`permission-request-action permission-request-action-${y.tone}`,disabled:t===c.id||y.value==="submit"&&g,onClick:()=>void r(c.id,{action:y.value,answers:c.kind==="user_input"?d:void 0}),children:t===c.id?o("conversation.permissionRequestSubmitting"):y.label},`${c.id}:${y.value}`))})]},c.id)})})]})}function G8(e){return o(e==="command"?"conversation.permissionRequestKindCommand":e==="file_change"?"conversation.permissionRequestKindFileChange":e==="permissions"?"conversation.permissionRequestKindPermissions":e==="user_input"?"conversation.permissionRequestKindUserInput":"conversation.permissionRequestKindToolCall")}function K8(e){return e.split(/[/\\]+/).filter(Boolean).at(-1)??e}function Y8({items:e,deletingQueueItemId:t=null,steeringQueueItemId:r=null,canSteer:s=!1,onDelete:i,onSteer:l}){return e.length===0?null:n.jsxs("section",{className:"queued-message-list","aria-label":o("conversation.queueTitle"),children:[n.jsx("div",{className:"queued-message-list__header",children:n.jsx("h2",{children:`${o("conversation.queueTitle")} · ${e.length}`})}),n.jsx("div",{className:"queued-message-list__items",children:e.map((c,d)=>{const m=c.status==="queued"||c.status==="failed",f=s&&typeof l=="function"&&c.status==="queued";return n.jsxs("article",{className:"queued-message-item",children:[n.jsxs("div",{className:"queued-message-item__main",children:[n.jsx("span",{className:"queued-message-item__order","aria-hidden":"true",children:d+1}),n.jsx("p",{className:"queued-message-item__content",title:c.content||o("conversation.queueImageOnly"),children:c.content||o("conversation.queueImageOnly")}),n.jsx("span",{className:`queued-message-item__status queued-message-item__status--${c.status}`,children:c.status==="failed"?o("conversation.queueStatusFailed"):o("conversation.queueStatusQueued")}),n.jsxs("div",{className:"queued-message-item__actions",children:[f?n.jsx("button",{type:"button",className:"queued-message-item__action queued-message-item__action--steer",onClick:()=>void l(c.id),disabled:r===c.id,"aria-label":o("conversation.queueSteer"),title:o("conversation.queueSteer"),children:r===c.id?o("conversation.queueSteering"):o("conversation.queueSteer")}):null,m?n.jsx("button",{type:"button",className:"queued-message-item__action queued-message-item__action--delete",onClick:()=>void i(c.id),disabled:t===c.id,"aria-label":o("conversation.queueDelete"),title:o("conversation.queueDelete"),children:t===c.id?"…":"×"}):null]})]}),c.errorDetail?n.jsx("p",{className:"queued-message-item__error",children:c.errorDetail}):null]},c.id)})})]})}const Ll=196,Mo=82,Aj=28,Mj=24,sA=34,Lb=18,X8=332,oh=360,om=840,Q8=520,J8=36,Ij=18,Z8=.22,eG=2.4,tG=6;function nG(e,t){return(t.lastMessageAt??t.updatedAt).localeCompare(e.lastMessageAt??e.updatedAt)}function iA(e,t,r){var k,y;if(!t)return null;const s=e.find(S=>S.workspace.id===t);if(!s)return null;const i=new Map(s.sessions.map(S=>[S.sessionId,S])),l=i.get(r)??null;if(!l)return null;const c=new Map;for(const S of s.sessions){const T=((k=S.parentSessionId)==null?void 0:k.trim())||null;if(!T)continue;const j=c.get(T)??[];c.set(T,[...j,S.sessionId])}const d=new Set,m=new Set;let f=l,v=l.sessionId;for(;f&&!m.has(f.sessionId);){d.add(f.sessionId),m.add(f.sessionId),v=f.sessionId;const S=((y=f.parentSessionId)==null?void 0:y.trim())||null;f=S?i.get(S)??null:null}const g=aA(v,0,i,c,new Set),w=sG(g);return{root:g,current:l,currentPathIds:d,relatedSessionIds:w,sessionsById:i}}function rG(e){return((e==null?void 0:e.relatedSessionIds.size)??0)>1}function aA(e,t,r,s,i){const l=r.get(e);if(!l)throw new Error(`Session ${e} not found`);const c=new Set(i);c.add(e);const d=[...s.get(e)??[]].filter(m=>!c.has(m)).sort((m,f)=>{const v=r.get(m),g=r.get(f);return!v||!g?0:nG(v,g)});return{session:l,depth:t,children:d.map(m=>aA(m,t+1,r,s,c))}}function sG(e){const t=new Set;function r(s){t.add(s.session.sessionId),s.children.forEach(r)}return r(e),t}function oA(e){const t=au(e),r=e.lastMessageAt??e.updatedAt,s=r?new Intl.DateTimeFormat(void 0,{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(new Date(r)):null;return[Vs(e.provider),s,t].filter(Boolean).join(" · ")}function lA(e){return e.isArchived===!0}function iG(e){return[...e].sort((t,r)=>t.sequence-r.sequence).filter(t=>t.content.trim().length>0||t.kind==="tool_call"||t.kind==="tool_result")}function cA(e,t){return e<=0||t<=0?1:Math.min(1,e/t)}function yg(e,t){const r=Math.max(420,e-32),s=Math.ceil(t+J8),i=r,l=Math.min(Q8,i);return{minWidth:l,maxWidth:i,defaultWidth:Math.min(i,Math.max(l,s))}}function aG(e,t,r,s){const i=cA(e,r),l=r*i,c=s*i,d=l<e?(e-l)/2:0;return{scale:i,offsetX:d,offsetY:0,shellWidth:Math.max(e,l),shellHeight:c}}function Fb(e,t,r){return Math.min(r,Math.max(t,e))}function oG(e,t,r,s){if(e<=0||t<=0||r<=0||s<=0)return 1;const i=Math.max(1,e-Ij*2),l=Math.max(1,t-Ij*2);return Math.min(1,i/r,l/s)}function lm(e,t,r,s,i){const l=s*e.scale,c=i*e.scale,d=(t-l)/2,m=(r-c)/2,f=l<=t?d:Fb(e.offsetX,t-l,0),v=c<=r?m:Fb(e.offsetY,r-c,0);return{scale:e.scale,offsetX:f,offsetY:v}}function lh(e,t,r,s){const i=oG(e,t,r,s);return lm({scale:i,offsetX:(e-r*i)/2,offsetY:(t-s*i)/2},e,t,r,s)}function lG(e,t,r,s,i,l,c,d){const m=(r-e.offsetX)/e.scale,f=(s-e.offsetY)/e.scale;return lm({scale:t,offsetX:r-m*t,offsetY:s-f*t},i,l,c,d)}function cG(e){var r;const t=e.content.trim();if(t.length>0){const s=t.replace(/\s+/g," ").trim();return s.length<=160?s:`${s.slice(0,157)}...`}return(r=e.toolCall)!=null&&r.name?`${e.toolCall.name} ${o("conversation.branchTreeToolMessageFallback")}`:o("conversation.branchTreeMessageEmpty")}function uG(e){switch(e.role){case"assistant":return o("conversation.roleAssistant");case"system":return o("conversation.roleSystem");case"tool":return o("conversation.roleTool");case"user":default:return o("conversation.roleUser")}}function _b(e,t){const r=t.get(e.session.sessionId);if(r!==void 0)return r;if(e.children.length===0)return t.set(e.session.sessionId,Ll),Ll;const s=e.children.reduce((l,c,d)=>{const m=l+_b(c,t);return d===0?m:m+Lb},0),i=Math.max(Ll,s);return t.set(e.session.sessionId,i),i}function uA(e){const t=new Map,r=[],s=new Map;function i(d,m,f){const v=_b(d,t),g=m+v/2,w=Mj+f*(Mo+sA),k=g-Ll/2,y=d.children.reduce((N,D,H)=>{const B=N+_b(D,t);return H===0?B:B+Lb},0);let S=m+Math.max(0,(v-y)/2);const T=d.children.map(N=>{const D=i(N,S,f+1);return S+=D.subtreeWidth+Lb,D}),j={node:d,children:T,x:k,y:w,centerX:g,centerY:w+Mo/2,subtreeWidth:v};return r.push(j),s.set(d.session.sessionId,j),j}const l=i(e,Aj,0),c=r.reduce((d,m)=>Math.max(d,m.y+Mo),0);return{root:l,nodes:r,bySessionId:s,width:l.subtreeWidth+Aj*2,height:c+Mj}}function dG(e){return Math.max(0,Math.min(255,Number.parseFloat(e)))}function hG(e){const t=e.trim();if(t.startsWith("#")){const s=t.slice(1);if(s.length===3){const[i,l,c]=s.split("").map(d=>Number.parseInt(d.repeat(2),16));return{r:i,g:l,b:c}}if(s.length>=6)return{r:Number.parseInt(s.slice(0,2),16),g:Number.parseInt(s.slice(2,4),16),b:Number.parseInt(s.slice(4,6),16)}}const r=t.match(/rgba?\(([^)]+)\)/i);if(r){const[s,i,l]=r[1].split(",").map(c=>dG(c));return{r:s,g:i,b:l}}return null}function la(e,t,r){const s=hG(e);return s?`rgba(${s.r}, ${s.g}, ${s.b}, ${t})`:r}function mG(e,t,r,s,i,l){const c=e.getContext("2d");if(!c)return;const d=c,m=window.devicePixelRatio||1;e.width=Math.max(1,Math.floor(t.width*m)),e.height=Math.max(1,Math.floor(t.height*m)),e.style.width=`${t.width}px`,e.style.height=`${t.height}px`,d.setTransform(m,0,0,m,0,0),d.clearRect(0,0,t.width,t.height);const f=window.getComputedStyle(e),v=f.getPropertyValue("--accent").trim()||"#3b82f6",g=f.getPropertyValue("--border-primary").trim()||"#d4d8df",w=f.getPropertyValue("--bg-surface").trim()||"#ffffff";if(!l){const y=d.createLinearGradient(0,0,t.width,t.height);y.addColorStop(0,la(w,.38,"rgba(255, 255, 255, 0.38)")),y.addColorStop(1,la(v,.05,"rgba(59, 130, 246, 0.05)")),d.fillStyle=y,d.fillRect(0,0,t.width,t.height)}function k(y){for(const S of y.children){const T=s.has(y.node.session.sessionId)&&s.has(S.node.session.sessionId),j=y.node.session.sessionId===i||S.node.session.sessionId===i;d.beginPath(),d.moveTo(y.centerX,y.y+Mo-10);const N=y.y+Mo+sA*.52;d.bezierCurveTo(y.centerX,N,S.centerX,N,S.centerX,S.y+10),d.lineWidth=j?3:T?2.5:1.5,d.strokeStyle=j?la(v,.52,"rgba(59, 130, 246, 0.52)"):T?la(v,.32,"rgba(59, 130, 246, 0.32)"):la(g,.72,"rgba(148, 163, 184, 0.72)"),d.stroke(),d.beginPath(),d.arc(S.centerX,S.y,j?4.5:3.5,0,Math.PI*2),d.fillStyle=j?la(v,.9,"rgba(59, 130, 246, 0.9)"):la(g,.78,"rgba(148, 163, 184, 0.78)"),d.fill(),k(S)}}k(t.root);for(const y of t.nodes){const S=y.node.session.sessionId===r,T=y.node.session.sessionId===i,j=s.has(y.node.session.sessionId);if(!S&&!T&&!j)continue;const N=d.createRadialGradient(y.centerX,y.centerY,10,y.centerX,y.centerY,T?90:64);N.addColorStop(0,la(v,T?.22:.14,"rgba(59, 130, 246, 0.22)")),N.addColorStop(1,"rgba(59, 130, 246, 0)"),d.fillStyle=N,d.beginPath(),d.ellipse(y.centerX,y.centerY,Ll*.72,Mo*.9,0,0,Math.PI*2),d.fill(),(T||S)&&(d.beginPath(),d.arc(y.centerX,y.y+12,T?6:5,0,Math.PI*2),d.fillStyle=la(v,.94,"rgba(59, 130, 246, 0.94)"),d.fill())}}function pG(e,t,r){const s=Math.min(X8,t-24),i=e.left+e.width/2-s/2,l=Math.max(12,Math.min(t-s-12,i)),m=r-e.bottom-12<220&&e.top>oh?Math.max(12,e.top-oh-12):Math.max(12,Math.min(r-oh-12,e.bottom+12));return{width:s,left:l,top:m,maxHeight:Math.min(oh,r-24)}}function fG({model:e,selectedSession:t,selectedTreeNode:r,previewEntry:s,onClose:i,onOpenSession:l}){const c=Ki(t.title,o("common.unknown")),d=t.sessionId===e.current.sessionId,m=lA(t),f=Ru(r.session),v=Mv(r.session),g=Iv(r.session),w=BP(r.session);return n.jsxs("div",{className:"conversation-branch-preview-popover",role:"dialog","aria-label":`${o("conversation.branchTreePreviewTitle")} ${c.fullTitle}`,children:[n.jsxs("div",{className:"conversation-branch-preview-popover-header",children:[n.jsxs("div",{className:"conversation-branch-preview-card-title-row",children:[n.jsx("strong",{title:c.fullTitle,children:c.displayTitle}),d?n.jsx("span",{className:"conversation-branch-current-badge",children:o("conversation.branchTreeCurrentBadge")}):null,m?n.jsx("span",{className:"conversation-branch-archived-badge",children:o("conversation.branchTreeArchivedBadge")}):null]}),n.jsx("button",{type:"button",className:"conversation-branch-preview-close","aria-label":o("common.close"),onClick:i,children:"x"})]}),n.jsx("p",{className:"conversation-branch-preview-popover-meta",children:oA(t)}),v&&f||w&&g?n.jsxs("div",{className:"conversation-branch-badge-row",children:[w&&g?n.jsx("span",{className:`session-fork-badge ${g}`,children:w}):null,v&&f?n.jsx("span",{className:`session-fork-badge ${f}`,children:v}):null]}):null,n.jsx("div",{className:"conversation-branch-preview-messages",children:s.status==="loading"?n.jsx("p",{className:"conversation-branch-empty",children:o("conversation.branchTreePreviewLoading")}):s.status==="error"?n.jsx("p",{className:"conversation-branch-empty",children:s.error||o("conversation.branchTreePreviewFailed")}):s.messages.length>0?s.messages.map(k=>n.jsxs("article",{className:"conversation-branch-preview-message",children:[n.jsxs("div",{className:"conversation-branch-preview-message-meta",children:[n.jsx("span",{children:uG(k)}),n.jsx("span",{children:new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit"}).format(new Date(k.timestamp))})]}),n.jsx("p",{children:cG(k)})]},`${t.sessionId}:${k.messageId}`)):n.jsx("p",{className:"conversation-branch-empty",children:o("conversation.branchTreePreviewEmpty")})}),n.jsx("div",{className:"conversation-branch-preview-actions",children:n.jsx("button",{type:"button",className:"secondary-button",disabled:d,onClick:()=>l(t),children:o(d?"conversation.branchTreeCurrentAction":"conversation.branchTreeSwitchAction")})})]})}function gG({layout:e,model:t,selectedSessionId:r,onSelectSession:s,onBackgroundClick:i,stageScale:l,desktopStageLayout:c,transform:d,isMobileViewport:m,viewportRef:f,onRegisterNodeElement:v,onViewportTouchStart:g,onViewportTouchMove:w,onViewportTouchEnd:k}){const y=p.useRef(null);return p.useEffect(()=>{const S=y.current;S&&mG(S,e,t.current.sessionId,t.currentPathIds,r,m)},[m,e,t.current.sessionId,t.currentPathIds,r]),n.jsx("div",{ref:f,className:"conversation-branch-canvas-viewport","data-scaled":l<.999,"data-mobile":m,onClick:S=>{S.target===S.currentTarget&&(i==null||i())},onTouchStart:g,onTouchMove:w,onTouchEnd:k,onTouchCancel:k,children:n.jsx("div",{className:"conversation-branch-canvas-stage-shell",style:{width:m?"100%":c.shellWidth,height:m?"100%":c.shellHeight},onClick:S=>{S.target===S.currentTarget&&(i==null||i())},children:n.jsxs("div",{className:"conversation-branch-canvas-stage",style:{width:e.width,height:e.height,transform:d?`translate(${d.offsetX}px, ${d.offsetY}px) scale(${d.scale})`:`translate(${c.offsetX}px, ${c.offsetY}px) scale(${c.scale})`,transformOrigin:"top left"},onClick:()=>{if(i){i();return}s(null)},children:[n.jsx("canvas",{ref:y,className:"conversation-branch-canvas",width:e.width,height:e.height,"aria-hidden":"true"}),e.nodes.map(S=>{const T=Ki(S.node.session.title,o("common.unknown")),j=Ru(S.node.session),N=Mv(S.node.session),D=Iv(S.node.session),H=BP(S.node.session),B=S.node.session.sessionId===t.current.sessionId,I=S.node.session.sessionId===r,A=t.currentPathIds.has(S.node.session.sessionId),L=lA(S.node.session);return n.jsx("button",{ref:_=>v(S.node.session.sessionId,_),type:"button",className:"conversation-branch-smart-card conversation-branch-canvas-node","data-current":B,"data-selected":I,"data-current-path":A,"data-archived":L,style:{left:S.x,top:S.y,width:Ll,minHeight:Mo},"aria-pressed":I,onClick:_=>{_.stopPropagation(),s(S.node.session.sessionId)},children:n.jsxs("div",{className:"conversation-branch-smart-card-main",children:[n.jsxs("div",{className:"conversation-branch-smart-card-title-row",children:[n.jsx("strong",{title:T.fullTitle,children:T.displayTitle}),B?n.jsx("span",{className:"conversation-branch-current-badge",children:o("conversation.branchTreeCurrentBadge")}):null,L?n.jsx("span",{className:"conversation-branch-archived-badge",children:o("conversation.branchTreeArchivedBadge")}):null]}),n.jsx("p",{children:oA(S.node.session)}),N&&j||H&&D?n.jsxs("div",{className:"conversation-branch-badge-row",children:[H&&D?n.jsx("span",{className:`session-fork-badge ${D}`,children:H}):null,N&&j?n.jsx("span",{className:`session-fork-badge ${j}`,children:N}):null]}):null]})},S.node.session.sessionId)})]})})})}function bG({model:e,onOpenSession:t,onClose:r,dialogLabel:s,dialogStyle:i,showResizeHandle:l,onBeginResize:c}){const d=p.useMemo(()=>uA(e.root),[e.root]),m=p.useRef(null),f=p.useRef(new Map),[v,g]=p.useState(null),[w,k]=p.useState(0),[y,S]=p.useState(0),[T,j]=p.useState(null),[N,D]=p.useState({}),H=p.useRef(new Set),[B,I]=p.useState(typeof window<"u"?window.innerWidth<=om:!1),[A,L]=p.useState(null),_=p.useRef({mode:"idle",startDistance:0,startScale:1,startOffsetX:0,startOffsetY:0,startTouchX:0,startTouchY:0,anchorX:0,anchorY:0,moved:!1});p.useEffect(()=>{const P=m.current;if(!P)return;const W=P;function J(){k(W.clientWidth),S(W.clientHeight),I(window.innerWidth<=om)}if(J(),typeof ResizeObserver>"u")return window.addEventListener("resize",J),()=>window.removeEventListener("resize",J);const R=new ResizeObserver(J);return R.observe(P),()=>R.disconnect()},[]),p.useEffect(()=>{g(null)},[e.current.sessionId,e.root.session.sessionId]);const F=p.useMemo(()=>cA(w,d.width),[w,d.width]),te=p.useMemo(()=>aG(w,y,d.width,d.height),[y,w,d.height,d.width]);p.useEffect(()=>{if(!B||w<=0||y<=0){L(null);return}L(P=>P?lm(P,w,y,d.width,d.height):lh(w,y,d.width,d.height))},[y,w,B,d.height,d.width]);const E=v?e.sessionsById.get(v)??null:null,se=E?d.bySessionId.get(E.sessionId)??null:null,X=E?N[E.sessionId]??{status:"idle",messages:[],error:null}:null,K=B&&!!r;p.useEffect(()=>{if(!v){j(null);return}const P=v;function W(){const J=f.current.get(P);if(!J){j(null);return}j(J.getBoundingClientRect())}return W(),window.addEventListener("resize",W),window.addEventListener("scroll",W,!0),()=>{window.removeEventListener("resize",W),window.removeEventListener("scroll",W,!0)}},[v,F]),p.useEffect(()=>{if(!B)return;const P=v;if(!P)return;const W=window.requestAnimationFrame(()=>{const J=f.current.get(P);J&&j(J.getBoundingClientRect())});return()=>window.cancelAnimationFrame(W)},[B,A,v]),p.useEffect(()=>{if(!(E!=null&&E.sessionId)||(X==null?void 0:X.status)==="ready"||H.current.has(E.sessionId))return;let P=!1;return H.current.add(E.sessionId),D(W=>{var J;return{...W,[E.sessionId]:{status:"loading",messages:((J=W[E.sessionId])==null?void 0:J.messages)??[],error:null}}}),Pv(E.sessionId,null,6,"backward").then(W=>{H.current.delete(E.sessionId),!P&&D(J=>({...J,[E.sessionId]:{status:"ready",messages:iG(W.messages),error:null}}))}).catch(W=>{H.current.delete(E.sessionId),!P&&D(J=>{var R;return{...J,[E.sessionId]:{status:"error",messages:((R=J[E.sessionId])==null?void 0:R.messages)??[],error:W instanceof Error?W.message:o("conversation.branchTreePreviewFailed")}}})}),()=>{P=!0}},[E==null?void 0:E.sessionId]);function G(P){!B||w<=0||y<=0||L(W=>{const J=W??lh(w,y,d.width,d.height);return lm(P(J),w,y,d.width,d.height)})}function q(P){if(!B)return;const W=P.currentTarget.getBoundingClientRect();if(P.touches.length>=2){const ve=P.touches[0],pe=P.touches[1],Y=Math.hypot(pe.clientX-ve.clientX,pe.clientY-ve.clientY),Se=(ve.clientX+pe.clientX)/2-W.left,Le=(ve.clientY+pe.clientY)/2-W.top,re=A??lh(w,y,d.width,d.height);_.current={mode:"pinch",startDistance:Y,startScale:re.scale,startOffsetX:re.offsetX,startOffsetY:re.offsetY,startTouchX:Se,startTouchY:Le,anchorX:Se,anchorY:Le,moved:!1};return}const J=P.touches[0],R=A??lh(w,y,d.width,d.height);_.current={mode:"pan",startDistance:0,startScale:R.scale,startOffsetX:R.offsetX,startOffsetY:R.offsetY,startTouchX:J.clientX,startTouchY:J.clientY,anchorX:0,anchorY:0,moved:!1}}function U(P){if(!B)return;const W=_.current;if(P.touches.length>=2){const Y=P.currentTarget.getBoundingClientRect(),Se=P.touches[0],Le=P.touches[1],re=Math.hypot(Le.clientX-Se.clientX,Le.clientY-Se.clientY);if(re<=0||W.startDistance<=0)return;P.preventDefault();const Ce=(Se.clientX+Le.clientX)/2-Y.left,Xe=(Se.clientY+Le.clientY)/2-Y.top,Ue=Fb(W.startScale*(re/W.startDistance),Z8,eG);_.current={...W,mode:"pinch",moved:!0,anchorX:Ce,anchorY:Xe},G(ct=>lG({...ct,scale:W.startScale,offsetX:W.startOffsetX,offsetY:W.startOffsetY},Ue,Ce,Xe,w,y,d.width,d.height));return}if(W.mode!=="pan"||P.touches.length!==1)return;const J=P.touches[0],R=J.clientX-W.startTouchX,ve=J.clientY-W.startTouchY;(W.moved||Math.hypot(R,ve)>=tG)&&(P.preventDefault(),_.current={...W,moved:!0},G(Y=>({...Y,offsetX:W.startOffsetX+R,offsetY:W.startOffsetY+ve})))}function Q(){_.current={mode:"idle",startDistance:0,startScale:(A==null?void 0:A.scale)??1,startOffsetX:(A==null?void 0:A.offsetX)??0,startOffsetY:(A==null?void 0:A.offsetY)??0,startTouchX:0,startTouchY:0,anchorX:0,anchorY:0,moved:!1}}return n.jsxs(n.Fragment,{children:[n.jsxs("section",{className:`conversation-branch-tree-pane${r?" conversation-branch-dialog":""}${K?" conversation-branch-dialog-mobile-bare":""}`,role:r?"dialog":void 0,"aria-modal":r?"true":void 0,"aria-label":s,style:i,children:[K?null:n.jsx("div",{className:"conversation-branch-tree-pane-header",children:n.jsxs("div",{className:"conversation-branch-tree-pane-topbar",children:[n.jsxs("div",{className:"conversation-branch-tree-pane-heading",children:[n.jsx("h3",{children:o("conversation.branchTreeMapTitle")}),n.jsx("p",{children:o("conversation.branchTreeMapDescription")})]}),r?n.jsx("button",{type:"button",className:"conversation-branch-pane-close","aria-label":o("common.close"),onClick:r,children:"x"}):null]})}),n.jsxs("div",{className:"conversation-branch-canvas-shell",children:[K?n.jsx("button",{type:"button",className:"conversation-branch-pane-close conversation-branch-mobile-floating-close","aria-label":o("common.close"),onClick:r,children:"x"}):null,K?null:n.jsx("div",{className:"conversation-branch-canvas-tip",children:o("conversation.branchTreePreviewDescription")}),n.jsx(gG,{layout:d,model:e,selectedSessionId:v,onSelectSession:g,onBackgroundClick:K?r:void 0,stageScale:F,desktopStageLayout:te,transform:B?A:null,isMobileViewport:B,viewportRef:m,onRegisterNodeElement:(P,W)=>{if(W){f.current.set(P,W);return}f.current.delete(P)},onViewportTouchStart:q,onViewportTouchMove:U,onViewportTouchEnd:Q})]}),l?n.jsx("div",{className:"conversation-branch-dialog-resizer",role:"separator","aria-orientation":"vertical","aria-label":o("conversation.branchTreeResizeHandle"),onMouseDown:P=>c==null?void 0:c(P.clientX)}):null]}),E&&se&&X&&T&&typeof document<"u"?Vn.createPortal(n.jsx("div",{className:"conversation-branch-preview-floating",style:pG(T,window.innerWidth,window.innerHeight),children:n.jsx(fG,{model:e,selectedSession:E,selectedTreeNode:se.node,previewEntry:X,onClose:()=>g(null),onOpenSession:t})}),document.body):null]})}function vG({open:e,navigationGroups:t,workspaceId:r,sessionId:s,onClose:i,onOpenSession:l}){const c=p.useMemo(()=>iA(t,r,s),[t,s,r]),d=p.useMemo(()=>c?uA(c.root):null,[c]),[m,f]=p.useState(null),[v,g]=p.useState(typeof window<"u"?window.innerWidth>om:!0);p.useEffect(()=>{if(!e)return;function S(T){T.key==="Escape"&&i()}return window.addEventListener("keydown",S),()=>window.removeEventListener("keydown",S)},[i,e]),p.useEffect(()=>{if(typeof window>"u")return;function S(){const T=window.innerWidth>om;if(g(T),!T){f(null);return}const j=yg(window.innerWidth,(d==null?void 0:d.width)??0);f(N=>N===null?j.defaultWidth:Math.min(j.maxWidth,Math.max(j.minWidth,N)))}return S(),window.addEventListener("resize",S),()=>window.removeEventListener("resize",S)},[d==null?void 0:d.width]);function w(S){if(typeof window>"u"||!v)return;const T=yg(window.innerWidth,(d==null?void 0:d.width)??0),j=m??T.defaultWidth;function N(H){const B=H.clientX-S;f(Math.min(T.maxWidth,Math.max(T.minWidth,j+B)))}function D(){document.removeEventListener("mousemove",N),document.removeEventListener("mouseup",D)}document.addEventListener("mousemove",N),document.addEventListener("mouseup",D)}if(!e||!c||typeof document>"u")return null;const k=yg(window.innerWidth,(d==null?void 0:d.width)??0),y=v?m??k.defaultWidth:void 0;return Vn.createPortal(n.jsxs("div",{className:"workbench-modal-layer conversation-branch-panel-layer",children:[n.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":o("common.close"),onClick:i}),n.jsx(bG,{model:c,onOpenSession:l,onClose:i,dialogLabel:o("conversation.branchTreeTitle"),dialogStyle:y?{width:y,maxWidth:k.maxWidth,minWidth:k.minWidth}:void 0,showResizeHandle:v,onBeginResize:w})]}),document.body)}function wG(e){const t=e.trim().length;return t<=16?"xl":t<=26?"lg":t<=38?"md":"sm"}function dA({session:e,actions:t,workspaceContext:r=null}){const s=sr(),i=p.useCallback(d=>{!s.isDesktop||s.ui.osFamily!=="macos"||d.button!==0||gv(d.target)&&bv()},[s.isDesktop,s.ui.osFamily]);if(!e)return n.jsxs("header",{className:"conversation-header conversation-header-skeleton","aria-hidden":"true","data-window-drag-handle":"conversation-header",onMouseDownCapture:i,children:[n.jsxs("div",{className:"conversation-header-main",children:[n.jsx("span",{className:"skeleton-line short"}),n.jsx("span",{className:"skeleton-line long"})]}),t?n.jsx("div",{className:"conversation-header-actions",children:t}):null]});const l=Ki(e.title,o("conversation.titleFallback")),c=wG(l.displayTitle);return n.jsxs("header",{className:"conversation-header","data-workspace-tone":(r==null?void 0:r.tone)??"root",style:ai(r),"data-window-drag-handle":"conversation-header",onMouseDownCapture:i,children:[n.jsx("div",{className:"conversation-header-main",children:n.jsx("h1",{className:`conversation-title is-${c}`,title:l.fullTitle,children:l.displayTitle})}),t?n.jsx("div",{className:"conversation-header-actions",children:t}):null]})}const Ej=30,Eh=40,Lj=300*1e3,yG=600,kG=5e3,xG=1e4;function kg(){const e=Ti.getState().profile.defaultPermissionMode;return e==="default"?null:e}class SG{constructor(t,r={}){Ze(this,"state");Ze(this,"listeners",new Set);Ze(this,"realtimeClient",null);Ze(this,"historyBootstrapFallbackTimer",null);Ze(this,"historyBootstrapEnvelopeReceived",!1);Ze(this,"markSeenTimer",null);Ze(this,"markSeenInFlight",!1);Ze(this,"lastMarkSeenRequestAt",0);Ze(this,"seenWatermark",null);Ze(this,"runtimeRefreshTimer",null);Ze(this,"runtimeRefreshMode",null);Ze(this,"replaceSnapshotSeedOnBackfill",!1);Ze(this,"pendingReplyDebugTraces",[]);Ze(this,"hasAuthoritativeBootstrapMessages");Ze(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));Ze(this,"getState",()=>this.state);var c;this.sessionId=t,this.options=r;const s=Ur(jg(t),Lj);this.hasAuthoritativeBootstrapMessages=(((c=r.bootstrapMessages)==null?void 0:c.length)??0)>0;const i=ch(r.initialSession??null,(s==null?void 0:s.session)??null),l=Dc((s==null?void 0:s.messages)??[],this.sessionId,r.bootstrapMessages??[]);this.replaceSnapshotSeedOnBackfill=!this.hasAuthoritativeBootstrapMessages&&((s==null?void 0:s.messages.length)??0)>0&&((s==null?void 0:s.messages.length)??0)<=Eh&&((s==null?void 0:s.pagesLoaded)??0)<=1,this.state=_C({session:i,capabilities:(s==null?void 0:s.capabilities)??null,runtimeHasActiveRun:(s==null?void 0:s.runtimeHasActiveRun)??null,runtimeCanInterrupt:(s==null?void 0:s.runtimeCanInterrupt)??null,contextUsage:(s==null?void 0:s.contextUsage)??null,messages:l,permissionRequests:(s==null?void 0:s.permissionRequests)??[],queuedMessages:(s==null?void 0:s.queuedMessages)??[],olderCursor:(s==null?void 0:s.olderCursor)??null,hasOlderMessages:(s==null?void 0:s.hasOlderMessages)??!1,lastCursor:(s==null?void 0:s.lastCursor)??null,interruptSource:(s==null?void 0:s.interruptSource)??null,pagesLoaded:(s==null?void 0:s.pagesLoaded)??0}),this.seenWatermark=(i==null?void 0:i.lastSeenAt)??null}async initialize(){this.historyBootstrapEnvelopeReceived=!1,this.clearHistoryBootstrapFallbackTimer();const t=this.options.bootstrapMessages??[],r=Dc(this.state.messages,this.sessionId,t),s=this.hasAuthoritativeBootstrapMessages;this.patch({messages:r,historyState:jG(this.state.session,s?r.length:0),loadingOlderMessages:!1,olderCursor:s?null:this.state.olderCursor,hasOlderMessages:Pl({session:this.state.session,loadedMessageCount:r.length,olderCursor:s?null:this.state.olderCursor,pagesLoaded:this.state.pagesLoaded,currentHasOlderMessages:this.state.hasOlderMessages}),pagesLoaded:s?Math.max(this.state.pagesLoaded,1):this.state.pagesLoaded,errorCode:null,errorDetail:null}),this.shouldRefreshSessionDetail()&&this.refreshSessionMetadata(),this.shouldRefreshRuntimeSnapshot()&&this.refreshRuntimeSnapshot("bootstrap"),this.refreshPermissionRequests(),this.refreshQueue();try{this.startRealtime(),s&&this.scheduleMarkSeen()}catch(i){this.handleError(i)}}async reload(){var r,s;this.clearHistoryBootstrapFallbackTimer(),this.historyBootstrapEnvelopeReceived=!1,(r=this.realtimeClient)==null||r.close(),this.realtimeClient=null;const t=Ur(jg(this.sessionId),Lj);this.state=_C({session:ch(this.options.initialSession??null,(t==null?void 0:t.session)??null),capabilities:(t==null?void 0:t.capabilities)??null,runtimeHasActiveRun:(t==null?void 0:t.runtimeHasActiveRun)??null,runtimeCanInterrupt:(t==null?void 0:t.runtimeCanInterrupt)??null,contextUsage:(t==null?void 0:t.contextUsage)??null,messages:Dc((t==null?void 0:t.messages)??[],this.sessionId,this.options.bootstrapMessages??[]),permissionRequests:(t==null?void 0:t.permissionRequests)??[],queuedMessages:(t==null?void 0:t.queuedMessages)??[],olderCursor:(t==null?void 0:t.olderCursor)??null,hasOlderMessages:(t==null?void 0:t.hasOlderMessages)??!1,lastCursor:(t==null?void 0:t.lastCursor)??null,pagesLoaded:(t==null?void 0:t.pagesLoaded)??0}),this.seenWatermark=((s=this.state.session)==null?void 0:s.lastSeenAt)??null,this.replaceSnapshotSeedOnBackfill=!this.hasAuthoritativeBootstrapMessages&&((t==null?void 0:t.messages.length)??0)>0&&((t==null?void 0:t.messages.length)??0)<=Eh&&((t==null?void 0:t.pagesLoaded)??0)<=1,this.emit(),await this.initialize()}applyNavigationSession(t){if(!t||t.sessionId!==this.sessionId)return;const r=ch(this.state.session,t);r!==this.state.session&&this.patch({session:r,hasOlderMessages:Pl({session:r,loadedMessageCount:this.state.messages.length,olderCursor:this.state.olderCursor,pagesLoaded:this.state.pagesLoaded,currentHasOlderMessages:this.state.hasOlderMessages})})}async sendMessage(t,r){const s=Wj();this.beginPendingReplyDebugTrace("send_live",s,t.length);const i=mR(this.sessionId,t,s,(r==null?void 0:r.attachmentMeta)??[],(r==null?void 0:r.attachments)??[],A3(this.state.messages));this.patch({messages:[...this.state.messages,i],session:Ui(this.state.session,"running"),runtimeHasActiveRun:Uj(this.state.session,this.state.capabilities)?!0:this.state.runtimeHasActiveRun,runtimeCanInterrupt:Hj(this.state.session,this.state.capabilities)?!0:this.state.runtimeCanInterrupt});try{const l=await this.sendMessageWithFallback(t,s,r);this.markPendingReplyDebugTraceResponseReady(s,{returnedMessageId:l.message.messageId,returnedProviderSessionId:l.message.providerSessionId}),this.patch({messages:OC(this.state.messages,this.sessionId,l.message,s)})}catch(l){throw this.failPendingReplyDebugTrace(s,l),this.patch({messages:Sb(this.state.messages,s),session:Ui(this.state.session,"failed"),runtimeHasActiveRun:!1,runtimeCanInterrupt:!1}),l}}async retryMessage(t){const r=this.state.messages.find(s=>s.clientRequestId===t);if(r){this.patch({messages:this.state.messages.map(s=>s.clientRequestId===t?{...s,deliveryState:"sending"}:s),runtimeHasActiveRun:Uj(this.state.session,this.state.capabilities)?!0:this.state.runtimeHasActiveRun,runtimeCanInterrupt:Hj(this.state.session,this.state.capabilities)?!0:this.state.runtimeCanInterrupt}),this.beginPendingReplyDebugTrace("retry_live",t,r.content.length);try{const s=await this.sendMessageWithFallback(r.content,t,{attachments:r.attachmentPayloads??[],attachmentMeta:r.attachments});this.markPendingReplyDebugTraceResponseReady(t,{returnedMessageId:s.message.messageId,returnedProviderSessionId:s.message.providerSessionId}),this.patch({messages:OC(this.state.messages,this.sessionId,s.message,t)})}catch(s){throw this.failPendingReplyDebugTrace(t,s),this.patch({messages:Sb(this.state.messages,t),session:Ui(this.state.session,"failed")}),s}}}async enqueueMessage(t,r){const s=Wj();try{const i=await N_(this.sessionId,{content:t,clientRequestId:s,model:(r==null?void 0:r.model)??null,reasoningLevel:(r==null?void 0:r.reasoningLevel)??null,permissionMode:kg(),attachments:(r==null?void 0:r.attachments)??[]});this.patch({queuedMessages:RG(this.state.queuedMessages,i)}),await this.refreshQueue()}catch(i){throw i}}async deleteQueuedMessage(t){await P_(this.sessionId,t),await this.refreshQueue()}async steerQueuedMessage(t){await D_(this.sessionId,t),await this.refreshRuntimeSnapshot("queue_steer")}async interrupt(){await TP(this.sessionId),this.patch({session:Ui(this.state.session,"interrupted"),runtimeHasActiveRun:!1,runtimeCanInterrupt:!1,interruptSource:"user",errorCode:null,errorDetail:null})}async replyPermissionRequest(t,r){if(!(this.state.permissionRequests.find(l=>l.id===t)??null))return;const i=await R_(this.sessionId,t,r);this.patch({permissionRequests:Tg(this.state.permissionRequests,i)})}reconnect(){var t;(t=this.realtimeClient)==null||t.reconnectNow()}async loadOlderMessages(){var t;if(!(this.state.historyState!=="ready"||this.state.loadingOlderMessages||!this.state.olderCursor)){this.patch({loadingOlderMessages:!0,errorCode:null,errorDetail:null});try{if(!((t=this.realtimeClient)==null?void 0:t.requestOlderMessages(this.state.olderCursor,Ej)))throw new Error("REALTIME_NOT_CONNECTED")}catch(r){const s=r instanceof Error?r.message:"unknown";this.patch({loadingOlderMessages:!1,errorCode:"HISTORY_LOAD_MORE_FAILED",errorDetail:s})}}}destroy(){var t;this.clearHistoryBootstrapFallbackTimer(),(t=this.realtimeClient)==null||t.close(),this.realtimeClient=null,this.pendingReplyDebugTraces.length=0,this.markSeenTimer!==null&&(window.clearTimeout(this.markSeenTimer),this.markSeenTimer=null),this.runtimeRefreshTimer!==null&&(window.clearTimeout(this.runtimeRefreshTimer),this.runtimeRefreshTimer=null),this.runtimeRefreshMode=null}startRealtime(){var r;if(!((r=nr.getState().session)==null?void 0:r.accessToken)){nr.clear();return}this.realtimeClient=new hR({sessionId:this.sessionId,cursor:this.state.lastCursor,limit:Eh,onSubscribed:()=>{Ft("session_send.realtime_subscribed",{sessionId:this.sessionId,lastCursor:this.state.lastCursor}),this.patch({connectionState:"connected",hasOlderMessages:Pl({session:this.state.session,loadedMessageCount:this.state.messages.length,olderCursor:this.state.olderCursor,pagesLoaded:this.state.pagesLoaded,currentHasOlderMessages:this.state.hasOlderMessages})}),this.scheduleHistoryBootstrapFallback()},onConnectionChange:s=>{var l;const i=this.state.connectionState;if(this.patch({connectionState:s,session:s==="reconnecting"&&da((l=this.state.session)==null?void 0:l.runningState)?Ui(this.state.session,"reconnecting"):this.state.session}),s==="connected"){this.clearRuntimeRefreshTimer("poll"),i!=="closed"&&i!=="connected"&&this.patch({errorCode:null,errorDetail:null});return}this.scheduleRuntimeRefresh("poll","connection_state_change")},onEnvelope:s=>{var c,d;this.historyBootstrapEnvelopeReceived=!0,this.clearHistoryBootstrapFallbackTimer();const i=s.type==="session.backfill"&&this.replaceSnapshotSeedOnBackfill,l=this.mergeHistoryMessages(s.messages,s.type==="session.backfill");this.patch({messages:l,lastCursor:s.cursor,historyState:"ready",olderCursor:s.type==="session.backfill"&&!i&&this.state.pagesLoaded>1?this.state.olderCursor:s.olderCursor??this.state.olderCursor,hasOlderMessages:s.type==="session.backfill"?!i&&this.state.pagesLoaded>1?this.state.hasOlderMessages:!!s.olderCursor:Pl({session:this.state.session,loadedMessageCount:l.length,olderCursor:this.state.olderCursor,pagesLoaded:this.state.pagesLoaded,currentHasOlderMessages:this.state.hasOlderMessages}),pagesLoaded:s.type==="session.backfill"?!i&&this.state.pagesLoaded>1?this.state.pagesLoaded:Math.max(this.state.pagesLoaded,l.length>0?1:0):this.state.pagesLoaded,session:Ui(this.state.session,Bj(s.type,(c=this.state.session)==null?void 0:c.runningState))}),(d=this.realtimeClient)==null||d.updateCursor(s.cursor),this.scheduleMarkSeen(),this.state.queuedMessages.length>0&&this.refreshQueue()},onOlderHistory:s=>{const i=this.mergeHistoryMessages(s.messages,!1);this.patch({messages:i,historyState:"ready",loadingOlderMessages:!1,olderCursor:s.olderCursor,hasOlderMessages:!!s.olderCursor,pagesLoaded:this.state.pagesLoaded+1,errorCode:null,errorDetail:null})},onRuntimeMessage:s=>{this.handleRuntimeMessage(s)},onActivity:s=>{this.handleActivity(s)},onRuntimeStatus:s=>{this.handleRuntimeStatus(s)},onRuntimeError:s=>{this.handleRuntimeError(s)},onInterrupted:s=>{this.handleInterrupted(s)},onPermissionRequest:s=>{this.handlePermissionRequest(s)},onPermissionRequestResolved:s=>{this.handlePermissionRequestResolved(s)},onError:s=>{this.patch({loadingOlderMessages:!1,errorCode:s.error_code,errorDetail:s.detail})},onUnauthorized:()=>{nr.clear()}}),this.realtimeClient.start()}patch(t){let r=t;Object.prototype.hasOwnProperty.call(t,"session")&&(this.syncSeenWatermark(t.session??null),r={...t,session:this.applySeenWatermark(t.session??null)}),this.state={...this.state,...r},(Object.prototype.hasOwnProperty.call(r,"session")||Object.prototype.hasOwnProperty.call(r,"capabilities")||Object.prototype.hasOwnProperty.call(r,"contextUsage")||Object.prototype.hasOwnProperty.call(r,"messages")||Object.prototype.hasOwnProperty.call(r,"permissionRequests")||Object.prototype.hasOwnProperty.call(r,"queuedMessages"))&&this.persistSnapshot(),this.emit()}mergeHistoryMessages(t,r){const s=r&&this.replaceSnapshotSeedOnBackfill?this.state.messages.filter(l=>l.deliveryState!=="sent"):this.state.messages,i=Dc(s,this.sessionId,t);return r&&(this.replaceSnapshotSeedOnBackfill=!1),i}handleError(t){this.clearHistoryBootstrapFallbackTimer();const r=t instanceof Error?t.message:"unknown";this.patch({historyState:"error",errorCode:"RUNTIME_INIT_FAILED",errorDetail:r})}scheduleMarkSeen(){if(this.markSeenTimer!==null)return;const t=this.getTargetSeenAt();if(this.markSeenInFlight||t===null)return;const r=this.getMarkSeenThrottleDelayMs(),s=Math.max(yG,r);this.markSeenTimer=window.setTimeout(()=>{this.markSeenTimer=null;const i=this.getTargetSeenAt();i!==null&&(Ft("session_seen.start",{sessionId:this.sessionId,targetSeenAt:i,seenWatermark:this.seenWatermark}),this.markSeenInFlight=!0,this.lastMarkSeenRequestAt=Date.now(),f_(this.sessionId).then(()=>{var l,c;this.bumpSeenWatermark(i),this.patch({session:Fj(this.state.session,i)}),(c=(l=this.options).onSeen)==null||c.call(l,this.sessionId,i),Ft("session_seen.end",{sessionId:this.sessionId,seenWatermark:this.seenWatermark})}).catch(()=>{Ft("session_seen.error",{sessionId:this.sessionId,targetSeenAt:i})}).finally(()=>{this.markSeenInFlight=!1,this.shouldMarkSeen()&&this.scheduleMarkSeen()}))},s)}clearRuntimeRefreshTimer(t){this.runtimeRefreshTimer!==null&&(t&&this.runtimeRefreshMode!==t||(window.clearTimeout(this.runtimeRefreshTimer),this.runtimeRefreshTimer=null,this.runtimeRefreshMode=null))}scheduleHistoryBootstrapFallback(){this.historyBootstrapEnvelopeReceived||this.historyBootstrapFallbackTimer!==null||(this.historyBootstrapFallbackTimer=window.setTimeout(()=>{this.historyBootstrapFallbackTimer=null,!this.historyBootstrapEnvelopeReceived&&this.resolveHistoryBootstrapFallback()},350))}clearHistoryBootstrapFallbackTimer(){this.historyBootstrapFallbackTimer!==null&&(window.clearTimeout(this.historyBootstrapFallbackTimer),this.historyBootstrapFallbackTimer=null)}async resolveHistoryBootstrapFallback(){try{const t=await Pv(this.sessionId,null,Ej,"backward");if(this.historyBootstrapEnvelopeReceived)return;this.historyBootstrapEnvelopeReceived=!0;const r=this.mergeHistoryMessages(t.messages,!0),s=this.replaceSnapshotSeedOnBackfill;this.patch({messages:r,historyState:"ready",olderCursor:!s&&this.state.pagesLoaded>1?this.state.olderCursor:t.nextCursor,hasOlderMessages:!s&&this.state.pagesLoaded>1?this.state.hasOlderMessages:Pl({session:this.state.session,loadedMessageCount:r.length,olderCursor:t.nextCursor,pagesLoaded:this.state.pagesLoaded,currentHasOlderMessages:this.state.hasOlderMessages}),lastCursor:t.cursor??this.state.lastCursor,pagesLoaded:!s&&this.state.pagesLoaded>1?this.state.pagesLoaded:r.length>0?Math.max(this.state.pagesLoaded,1):this.state.pagesLoaded,errorCode:null,errorDetail:null}),this.scheduleMarkSeen()}catch{}}scheduleRuntimeRefresh(t,r){var s,i;if(!da((s=this.state.session)==null?void 0:s.runningState)){this.clearRuntimeRefreshTimer();return}t==="poll"&&this.state.connectionState==="connected"||(this.clearRuntimeRefreshTimer(),this.runtimeRefreshMode=t,Ft("session_runtime.refresh.schedule",{sessionId:this.sessionId,mode:t,reason:r,connectionState:this.state.connectionState,runningState:((i=this.state.session)==null?void 0:i.runningState)??null}),this.runtimeRefreshTimer=window.setTimeout(()=>{const l=this.runtimeRefreshMode??t;this.runtimeRefreshTimer=null,this.runtimeRefreshMode=null,this.refreshRuntimeState(l,r)},t==="poll"?xG:1200))}async refreshRuntimeState(t,r){var s,i,l,c,d;Ft("session_runtime.refresh.start",{sessionId:this.sessionId,mode:t,reason:r,connectionState:this.state.connectionState,runningState:((s=this.state.session)==null?void 0:s.runningState)??null});try{const m=await tb(this.sessionId);this.patch({session:_j(this.state.session,m),runtimeHasActiveRun:m.hasActiveRun,runtimeCanInterrupt:m.canInterrupt,contextUsage:m.contextUsage,...Sg(m,this.state.interruptSource)}),await this.refreshQueue();const f=t==="poll"&&this.state.connectionState!=="connected"&&da((i=this.state.session)==null?void 0:i.runningState);Ft("session_runtime.refresh.end",{sessionId:this.sessionId,mode:t,reason:r,connectionState:this.state.connectionState,runningState:((l=this.state.session)==null?void 0:l.runningState)??null,continuePolling:f}),f&&this.scheduleRuntimeRefresh("poll","connection_poll")}catch(m){Ft("session_runtime.refresh.error",{sessionId:this.sessionId,mode:t,reason:r,connectionState:this.state.connectionState,runningState:((c=this.state.session)==null?void 0:c.runningState)??null,message:m instanceof Error?m.message:"unknown"}),t==="poll"&&this.state.connectionState!=="connected"&&da((d=this.state.session)==null?void 0:d.runningState)&&this.scheduleRuntimeRefresh("poll","connection_poll_retry")}}async refreshSessionMetadata(){const t=[];this.state.session===null&&t.push(Tv(this.sessionId).then(r=>{this.patch({session:ch(r,this.state.session)})}).catch(()=>{})),Oj(this.state.capabilities)&&t.push(k_(this.sessionId).then(r=>{this.patch({capabilities:r})}).catch(()=>{})),t.length!==0&&await Promise.allSettled(t)}async refreshPermissionRequests(){try{const t=await CP(this.sessionId);this.patch({permissionRequests:t.items})}catch{return}}shouldRefreshSessionDetail(){return this.state.session===null||Oj(this.state.capabilities)||this.state.session.runningState===null}shouldRefreshRuntimeSnapshot(){return this.state.contextUsage===null}async refreshRuntimeSnapshot(t){Ft("session_runtime.snapshot.start",{sessionId:this.sessionId,reason:t});try{const r=await tb(this.sessionId);this.patch({session:_j(this.state.session,r),runtimeHasActiveRun:r.hasActiveRun,runtimeCanInterrupt:r.canInterrupt,contextUsage:r.contextUsage,...Sg(r,this.state.interruptSource)}),await this.refreshQueue(),Ft("session_runtime.snapshot.end",{sessionId:this.sessionId,reason:t,hasContextUsage:r.contextUsage!==null})}catch(r){Ft("session_runtime.snapshot.error",{sessionId:this.sessionId,reason:t,message:r instanceof Error?r.message:"unknown"})}}async refreshQueue(){try{const t=await T_(this.sessionId);this.patch({queuedMessages:t.items})}catch{return}}async sendMessageWithFallback(t,r,s){var i;try{return await Rv(this.sessionId,{content:t,clientRequestId:r,model:(s==null?void 0:s.model)??null,reasoningLevel:(s==null?void 0:s.reasoningLevel)??null,permissionMode:kg(),attachments:(s==null?void 0:s.attachments)??[]})}catch(l){if(!(l instanceof Kr)||l.status!==404&&l.status!==405||(((i=s==null?void 0:s.attachments)==null?void 0:i.length)??0)>0)throw l;return Ft("session_send.live_fallback",{sessionId:this.sessionId,clientRequestId:r,reason:l.message}),j_(this.sessionId,{content:t,clientRequestId:r,permissionMode:kg()})}}handleRuntimeStatus(t){var s;const r=xg((s=this.state.session)==null?void 0:s.runningState,t.status);this.patch({session:Ui(this.state.session,r),runtimeHasActiveRun:da(r)?this.state.runtimeHasActiveRun??!0:!1,runtimeCanInterrupt:da(r)?this.state.runtimeCanInterrupt:!1,interruptSource:r==="interrupted"?t.interruptSource??this.state.interruptSource:r==="completed"||r==="failed"?null:this.state.interruptSource,errorCode:null,errorDetail:r===t.status?t.detail:this.state.errorDetail}),cm(r)&&(this.completePendingReplyDebugTraceWithoutAssistant("session_send.client_terminal_before_message",{status:t.status,detail:t.detail}),this.clearRuntimeRefreshTimer(),this.refreshQueue(),this.refreshRuntimeSnapshot("runtime_terminal"))}handleActivity(t){if(this.patch({session:NG(this.state.session,t),runtimeHasActiveRun:t.hasActiveRun,runtimeCanInterrupt:t.canInterrupt,...Sg(t,this.state.interruptSource)}),cm(t.runningState)){this.clearRuntimeRefreshTimer(),this.refreshQueue();return}(t.runningState==="stale"||t.runningState==="unknown")&&this.scheduleRuntimeRefresh("tail","activity_watchdog")}handleRuntimeMessage(t){var s;t.message.role==="assistant"&&this.completePendingReplyDebugTrace(t);const r=Dc(this.state.messages,this.sessionId,[t.message]);this.patch({messages:r,historyState:"ready",hasOlderMessages:Pl({session:this.state.session,loadedMessageCount:r.length,olderCursor:this.state.olderCursor,pagesLoaded:this.state.pagesLoaded,currentHasOlderMessages:this.state.hasOlderMessages}),session:Ui(this.state.session,Bj("session.delta",(s=this.state.session)==null?void 0:s.runningState))}),this.scheduleMarkSeen(),this.state.queuedMessages.length>0&&this.refreshQueue()}handleRuntimeError(t){var s;const r=xg((s=this.state.session)==null?void 0:s.runningState,"failed");this.completePendingReplyDebugTraceWithoutAssistant("session_send.client_runtime_error",{errorCode:t.error_code,detail:t.detail}),this.clearRuntimeRefreshTimer(),this.patch({session:Ui(this.state.session,r),runtimeHasActiveRun:!1,runtimeCanInterrupt:!1,interruptSource:null,errorCode:r==="failed"?t.error_code:this.state.errorCode,errorDetail:r==="failed"?t.detail:this.state.errorDetail}),this.refreshQueue()}handleInterrupted(t){var s;const r=xg((s=this.state.session)==null?void 0:s.runningState,"interrupted");this.completePendingReplyDebugTraceWithoutAssistant("session_send.client_interrupted",{detail:t.detail}),this.clearRuntimeRefreshTimer(),this.patch({session:Ui(this.state.session,r),runtimeHasActiveRun:!1,runtimeCanInterrupt:!1,interruptSource:r==="interrupted"?t.interruptSource??this.state.interruptSource:this.state.interruptSource,errorCode:r==="interrupted"?null:this.state.errorCode,errorDetail:r==="interrupted"?t.detail:this.state.errorDetail}),this.refreshQueue()}handlePermissionRequest(t){this.patch({permissionRequests:Tg(this.state.permissionRequests,t.request)})}handlePermissionRequestResolved(t){this.patch({permissionRequests:Tg(this.state.permissionRequests,t.request)})}shouldMarkSeen(){return this.getTargetSeenAt()!==null}getTargetSeenAt(){const t=[...this.state.messages].reverse().find(s=>s.role!=="user");if(!t)return null;const r=this.seenWatermark;return r?t.timestamp>r?t.timestamp:null:t.timestamp}syncSeenWatermark(t){t!=null&&t.lastSeenAt&&this.bumpSeenWatermark(t.lastSeenAt)}bumpSeenWatermark(t){this.seenWatermark&&this.seenWatermark>=t||(this.seenWatermark=t)}getMarkSeenThrottleDelayMs(){return this.lastMarkSeenRequestAt<=0?0:Math.max(0,kG-(Date.now()-this.lastMarkSeenRequestAt))}applySeenWatermark(t){return!t||!this.seenWatermark?t:Fj(t,this.seenWatermark)}emit(){for(const t of this.listeners)t()}persistSnapshot(){_s(jg(this.sessionId),{session:this.state.session,capabilities:this.state.capabilities,runtimeHasActiveRun:this.state.runtimeHasActiveRun,runtimeCanInterrupt:this.state.runtimeCanInterrupt,contextUsage:this.state.contextUsage,messages:DG(this.state.messages),permissionRequests:this.state.permissionRequests,queuedMessages:this.state.queuedMessages,olderCursor:this.state.olderCursor,hasOlderMessages:this.state.hasOlderMessages,lastCursor:this.state.lastCursor,pagesLoaded:this.state.pagesLoaded,interruptSource:this.state.interruptSource})}beginPendingReplyDebugTrace(t,r,s){const i={mode:t,clientRequestId:r,startedAtMs:performance.now(),responseReadyAtMs:null,contentLength:s};this.pendingReplyDebugTraces.push(i),Ft(`session_send.${t}.client_start`,{sessionId:this.sessionId,clientRequestId:r,contentLength:s})}markPendingReplyDebugTraceResponseReady(t,r={}){const s=this.pendingReplyDebugTraces.find(i=>i.clientRequestId===t);!s||s.responseReadyAtMs!==null||(s.responseReadyAtMs=performance.now(),Ft(`session_send.${s.mode}.client_response`,{sessionId:this.sessionId,clientRequestId:t,durationMs:Math.round(s.responseReadyAtMs-s.startedAtMs),...r}))}failPendingReplyDebugTrace(t,r){const s=this.pendingReplyDebugTraces.find(i=>i.clientRequestId===t);s&&(Ft(`session_send.${s.mode}.client_error`,{sessionId:this.sessionId,clientRequestId:t,durationMs:Math.round(performance.now()-s.startedAtMs),error:r instanceof Error?r.message:String(r)}),this.removePendingReplyDebugTrace(s.clientRequestId))}completePendingReplyDebugTrace(t){const r=this.pendingReplyDebugTraces[0];if(!r)return;const s=performance.now();Ft(`session_send.${r.mode}.first_assistant_message`,{sessionId:this.sessionId,clientRequestId:r.clientRequestId,durationMs:Math.round(s-r.startedAtMs),responseToAssistantMs:r.responseReadyAtMs===null?null:Math.round(s-r.responseReadyAtMs),messageId:t.message.messageId,kind:t.message.kind,contentLength:t.message.content.length}),this.removePendingReplyDebugTrace(r.clientRequestId)}completePendingReplyDebugTraceWithoutAssistant(t,r={}){const s=this.pendingReplyDebugTraces[0];s&&(Ft(t,{sessionId:this.sessionId,clientRequestId:s.clientRequestId,durationMs:Math.round(performance.now()-s.startedAtMs),responseReady:s.responseReadyAtMs!==null,...r}),this.removePendingReplyDebugTrace(s.clientRequestId))}removePendingReplyDebugTrace(t){const r=this.pendingReplyDebugTraces.findIndex(s=>s.clientRequestId===t);r<0||this.pendingReplyDebugTraces.splice(r,1)}}function ys(e,t){const[r,s]=p.useState(()=>t(e.getState()));return p.useEffect(()=>(s(t(e.getState())),e.subscribe(()=>{s(t(e.getState()))})),[t,e]),r}function CG(e){const t=e==null?void 0:e.messageCount;return typeof t=="number"&&Number.isFinite(t)?t:null}function jG(e,t){return t>0?"ready":"loading"}function TG(e,t){const r=CG(e);return r!==null?r>t:t>=Eh}function Pl(e){return e.olderCursor?!0:e.pagesLoaded>1?e.currentHasOlderMessages:TG(e.session,e.loadedMessageCount)}function Ui(e,t){return e&&{...e,runningState:t,activityState:mA(e,t,e.completedAt??null,da(t))}}function Fj(e,t){return!e||e.lastSeenAt&&e.lastSeenAt>=t?e:{...e,lastSeenAt:t,activityState:e.activityState==="completed_unread"?"idle":e.activityState}}function _j(e,t){return hA(e,{runningState:t.runningState,activityResolutionSource:t.activityResolutionSource,activityConfidence:t.activityConfidence,runId:t.runId,detail:t.detail,interruptSource:t.interruptSource,errorCode:t.errorCode,errorDetail:t.errorDetail,hasActiveRun:t.hasActiveRun,updatedAt:t.updatedAt,watchdogTriggeredAt:t.watchdogTriggeredAt})}function NG(e,t){return hA(e,t)}function hA(e,t){if(!e)return e;const r=PG(t.activityResolutionSource),s=cm(t.runningState)?Cg(e.completedAt,t.updatedAt):null,i=t.runningState==="completed"||t.runningState==="interrupted"||t.runningState==="failed"?Cg(e.lastEventAt,t.updatedAt):t.updatedAt;return{...e,runningState:t.runningState,activitySource:r,activityResolutionSource:t.activityResolutionSource,activityConfidence:t.activityConfidence,runId:t.runId,lastEventAt:i,completedAt:s,lastErrorCode:t.runningState==="failed"?t.errorCode??e.lastErrorCode:null,lastErrorDetail:t.runningState==="failed"?t.errorDetail??t.detail??e.lastErrorDetail:null,watchdogTriggeredAt:t.watchdogTriggeredAt,updatedAt:Cg(e.updatedAt,t.updatedAt)??t.updatedAt,activityState:mA(e,t.runningState,s,t.hasActiveRun)}}function mA(e,t,r,s){return s||da(t)?"running":r&&(!e.lastSeenAt||r>e.lastSeenAt)?"completed_unread":e.activityState==="running"||e.activityState==="completed_unread"?"idle":e.activityState??"idle"}function da(e){return e==="starting"||e==="running"||e==="reconnecting"}function cm(e){return e==="completed"||e==="interrupted"||e==="failed"}function Oj(e){if(e===null)return!0;const t=e.modelOptions??[];return t.length===0?!0:t.every(r=>r.usesProviderDefault===!0)}function Bj(e,t){return e==="session.backfill"?t??"idle":t==="completed"||t==="interrupted"||t==="failed"?t:"running"}function xg(e,t){return cm(e)?e:t}function Sg(e,t){return e.runningState==="failed"?{interruptSource:null,errorCode:e.errorCode,errorDetail:e.errorDetail??e.detail}:e.runningState==="interrupted"?{interruptSource:e.interruptSource??null,errorCode:null,errorDetail:e.detail}:e.runningState==="completed"?{interruptSource:null,errorCode:null,errorDetail:e.detail}:{interruptSource:t,errorCode:null,errorDetail:null}}function PG(e){return e==="authoritative_runtime"||e==="authoritative_provider_event"?"runtime":e==="inferred_log"?"inferred":"none"}function Cg(e,t){return e?t?e>=t?e:t:e:t??null}function Wj(){var e,t;if(typeof((e=globalThis.crypto)==null?void 0:e.randomUUID)=="function")return globalThis.crypto.randomUUID();if(typeof((t=globalThis.crypto)==null?void 0:t.getRandomValues)=="function"){const r=new Uint8Array(16);globalThis.crypto.getRandomValues(r),r[6]=r[6]&15|64,r[8]=r[8]&63|128;const s=Array.from(r,i=>i.toString(16).padStart(2,"0")).join("");return`${s.slice(0,8)}-${s.slice(8,12)}-${s.slice(12,16)}-${s.slice(16,20)}-${s.slice(20)}`}return`fallback-${Date.now()}-${Math.random().toString(16).slice(2,10)}`}function Uj(e,t){return e?t&&e.provider===t.provider?!!t.canSendMessage:IP(e.provider):!1}function Hj(e,t){return e?t&&e.provider===t.provider?!(!t.supportsInterrupt||e.provider==="claude-code"&&e.activitySource==="inferred"):e.provider==="codex"||e.provider==="opencode"?!0:e.provider==="claude-code"&&e.activitySource!=="inferred":!1}function jg(e){return`session-runtime.snapshot.${e}`}function DG(e){return e.filter(t=>t.deliveryState==="sent").slice(-600)}function RG(e,t){const r=e.filter(s=>s.id!==t.id);return r.push(t),r.sort((s,i)=>s.orderIndex-i.orderIndex),r}function Tg(e,t){const r=e.filter(s=>s.id!==t.id);return r.push(t),r.sort((s,i)=>s.status!==i.status?s.status==="pending"?-1:1:i.createdAt.localeCompare(s.createdAt)),r}function ch(e,t){if(!e)return t;if(!t||zj(e,t))return e;if(zj(t,e))return t;const r=Date.parse(e.updatedAt||e.lastMessageAt||e.createdAt),s=Date.parse(t.updatedAt||t.lastMessageAt||t.createdAt);return!Number.isFinite(r)||!Number.isFinite(s)?t:r>=s?e:t}function zj(e,t){return qj(e)&&!qj(t)&&e.lastEventAt===t.lastEventAt&&e.lastMessageAt===t.lastMessageAt&&e.completedAt===t.completedAt}function qj(e){return e.activityState==="running"||da(e.runningState)}function pY(){return Oe.request("/api/terminals/shells")}function fY(e){return Oe.request(`/api/terminals?workspaceId=${encodeURIComponent(e)}`)}function AG(e){return Oe.request(`/api/terminals/templates/${encodeURIComponent(e)}/stop`,{method:"POST"})}function gY(e){return Oe.request("/api/terminals",{method:"POST",body:JSON.stringify(e)})}function bY(e){return Oe.request(`/api/terminals/${encodeURIComponent(e)}`,{method:"DELETE"})}function vY(e){return Oe.request(`/api/terminals/${encodeURIComponent(e)}/record`,{method:"DELETE"})}function wY(e,t={}){const r=new URLSearchParams;typeof t.beforeSeq=="number"&&r.set("beforeSeq",String(t.beforeSeq)),typeof t.limit=="number"&&r.set("limit",String(t.limit));const s=r.toString();return Oe.request(`/api/terminals/${encodeURIComponent(e)}/history${s?`?${s}`:""}`)}function MG(e){return Oe.request("/api/terminals/templates",{method:"POST",body:JSON.stringify(e)})}function IG(e,t){return Oe.request(`/api/terminals/templates/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})}function EG(e){return Oe.request(`/api/terminals/templates/${encodeURIComponent(e)}`,{method:"DELETE"})}function $j(e,t){return Oe.request(`/api/terminals/templates/${encodeURIComponent(e)}/run`,{method:"POST",body:JSON.stringify(t)})}function LG(e){return[{value:"",label:o("terminal.runtimeAutoOption"),description:o("terminal.runtimeAutoDescription")},{value:"tmux",label:e==="windows"?o("terminal.runtimePersistentLabel"):"tmux",description:o(e==="windows"?"terminal.runtimeWindowsPersistentDescription":"terminal.runtimeTmuxDescription")},{value:"embedded-pty",label:"embedded-pty",description:o("terminal.runtimeEmbeddedDescription")}]}function Vj(e,t){return e?e==="conpty-powershell"?o("terminal.runtimeConptyPowerShellLabel"):e==="conpty-cmd"?o("terminal.runtimeConptyCmdLabel"):e==="conpty-git-bash"?o("terminal.runtimeConptyGitBashLabel"):e==="tmux"&&t==="windows"?o("terminal.runtimePersistentLabel"):e:o("terminal.runtimeAutoOption")}function yY(e,t){return e?e==="embedded-pty"?"pty":e==="conpty-powershell"||e==="conpty-cmd"||e==="conpty-git-bash"||e==="tmux"&&t==="windows"?o("terminal.runtimePersistentShortLabel"):e:o("terminal.runtimeAutoShortLabel")}function FG(e){return e instanceof Kr?e.errorCode==="RUNTIME_DEPENDENCY_MISSING"||e.message.includes("当前系统未安装 tmux"):!1}function _G({open:e,busy:t=!1,onClose:r,onConfirmFallback:s}){return p.useEffect(()=>{if(!e)return;function i(l){l.key==="Escape"&&!t&&r()}return window.addEventListener("keydown",i),()=>{window.removeEventListener("keydown",i)}},[t,r,e]),!e||typeof document>"u"?null:Vn.createPortal(n.jsxs("div",{className:"workbench-modal-layer",children:[n.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":o("common.close"),onClick:()=>{t||r()}}),n.jsxs("section",{className:"workbench-modal-card surface-card terminal-runtime-fallback-modal",role:"dialog","aria-modal":"true","aria-label":o("terminal.runtimeMissingDialogTitle"),children:[n.jsxs("div",{className:"workbench-modal-header",children:[n.jsxs("div",{className:"workbench-modal-title-wrap",children:[n.jsx("h2",{children:o("terminal.runtimeMissingDialogTitle")}),n.jsx("p",{children:o("terminal.runtimeMissingDialogDescription")})]}),n.jsx(zo,{onClick:()=>{t||r()}})]}),n.jsxs("div",{className:"workbench-modal-body terminal-runtime-fallback-body",children:[n.jsxs("section",{className:"terminal-runtime-fallback-section",children:[n.jsx("span",{className:"badge","data-tone":"error",children:"tmux"}),n.jsx("p",{className:"status-text",children:o("terminal.runtimeMissingInstallDescription")}),n.jsxs("ul",{className:"terminal-runtime-fallback-list",children:[n.jsx("li",{children:o("terminal.runtimeMissingInstallMacArm")}),n.jsx("li",{children:o("terminal.runtimeMissingInstallMacIntel")}),n.jsx("li",{children:o("terminal.runtimeMissingInstallDebian")}),n.jsx("li",{children:o("terminal.runtimeMissingInstallFedora")})]})]}),n.jsxs("section",{className:"terminal-runtime-fallback-section",children:[n.jsx("span",{className:"badge",children:"embedded-pty"}),n.jsx("p",{className:"status-text",children:o("terminal.runtimeMissingFallbackDescription")})]}),n.jsxs("div",{className:"workbench-modal-actions",children:[n.jsx("button",{type:"button",className:"secondary-button",disabled:t,onClick:r,children:o("terminal.runtimeMissingKeepAction")}),n.jsx("button",{type:"button",className:"primary-button",disabled:t,onClick:s,children:o(t?"terminal.runtimeMissingFallbackPending":"terminal.runtimeMissingFallbackAction")})]})]})]})]}),document.body)}const uh={mode:"command",name:"",cwd:"",target:"",args:"",port:"",proxyEnabled:!1},Gj=60*1e3;function OG(e){return e?new Date(e).toLocaleString():o("common.unknown")}function BG(e){return e.split(" ").map(t=>t.trim()).filter(Boolean)}function WG(e){var t,r,s;return((t=e.find(i=>i.id==="cmd"&&i.available))==null?void 0:t.id)??((r=e.find(i=>i.available))==null?void 0:r.id)??((s=e[0])==null?void 0:s.id)??""}function UG(e){const t=e.name.trim();if(t)return t;const r=e.target.trim(),s=e.args.trim();return r?s?`${r} ${s}`:r:e.mode==="script"?o("terminalManager.defaultScriptName"):o("terminalManager.defaultCommandName")}function HG(e){const t=e.args.join(" ");return t?`${e.command} ${t}`:e.command}function zG(e){return{mode:pA(e),name:e.name,cwd:e.cwd,target:e.command,args:e.args.join(" "),port:e.port===null?"":String(e.port),proxyEnabled:e.proxyEnabled}}function qG(e){return Gb(`/proxy/${encodeURIComponent(e)}`)}function pA(e){const t=e.command.toLowerCase();return t.endsWith(".ps1")||t.endsWith(".bat")||t.endsWith(".cmd")||t.endsWith(".sh")?"script":"command"}function $G(e){const t=e.trim();if(!t)return null;const r=Number(t);return Number.isInteger(r)?r:Number.NaN}function Kj(e,t){return e.get(t)??null}function VG(e,t){return e.port===null?{tone:"untracked",title:o("terminalManager.portUnset"),summary:o("terminalManager.portUnsetDescription"),badgeLabel:o("terminalManager.portUnset")}:t!=null&&t.occupied?{tone:"running",title:o("terminalManager.portOccupied"),summary:t.processName||o("terminalManager.processCommandFallback"),badgeLabel:t.processId?`PID ${t.processId}`:o("terminalManager.statusRunning"),badgeTone:"success"}:{tone:"idle",title:o("terminalManager.portAvailable"),summary:o("terminalManager.portAvailableDescription"),badgeLabel:o("terminalManager.statusStopped")}}function GG(e){return e!=null&&e.terminationScope?e.terminationScope==="process_group"?o("terminalManager.terminationScopeProcessGroup"):o("terminalManager.terminationScopeProcess"):null}function KG({open:e,title:t,description:r,onClose:s,children:i,className:l}){return p.useEffect(()=>{if(!e)return;function c(d){d.key==="Escape"&&s()}return window.addEventListener("keydown",c),()=>{window.removeEventListener("keydown",c)}},[s,e]),!e||typeof document>"u"?null:Vn.createPortal(n.jsxs("div",{className:"workbench-modal-layer",children:[n.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":o("common.close"),onClick:s}),n.jsxs("section",{className:["workbench-modal-card","surface-card","terminal-manager-modal-card",l].filter(Boolean).join(" "),role:"dialog","aria-modal":"true","aria-label":t,children:[n.jsxs("div",{className:"workbench-modal-header",children:[n.jsxs("div",{className:"workbench-modal-title-wrap",children:[n.jsx("h2",{children:t}),n.jsx("p",{children:r})]}),n.jsx(zo,{onClick:s})]}),n.jsx("div",{className:"workbench-modal-body",children:i})]})]}),document.body)}function YG({open:e,busy:t,title:r,description:s,confirmLabel:i,onClose:l,onConfirm:c,className:d}){return p.useEffect(()=>{if(!e)return;function m(f){f.key==="Escape"&&!t&&l()}return window.addEventListener("keydown",m),()=>{window.removeEventListener("keydown",m)}},[t,l,e]),!e||typeof document>"u"?null:Vn.createPortal(n.jsxs("div",{className:"workbench-modal-layer",children:[n.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":o("common.close"),disabled:t,onClick:l}),n.jsxs("section",{className:["workbench-modal-card","surface-card",d].filter(Boolean).join(" "),role:"dialog","aria-modal":"true","aria-label":r,children:[n.jsx("div",{className:"workbench-modal-header",children:n.jsxs("div",{className:"workbench-modal-title-wrap",children:[n.jsx("h2",{children:r}),n.jsx("p",{children:s})]})}),n.jsx("div",{className:"workbench-modal-body",children:n.jsxs("div",{className:"workbench-modal-actions terminal-manager-confirm-actions",children:[n.jsx("button",{type:"button",className:"secondary-button",disabled:t,onClick:l,children:o("common.cancel")}),n.jsx("button",{type:"button",className:"secondary-button workbench-danger-button",disabled:t,onClick:()=>{c()},children:t?o("terminalManager.templateRemoving"):i})]})})]})]}),document.body)}function Yj({label:e,value:t,options:r,open:s,onToggle:i,onChange:l}){const c=r.find(d=>d.value===t)??r[0]??null;return n.jsxs("div",{className:"field-group terminal-manager-mobile-picker",children:[n.jsx("span",{children:e}),n.jsxs("button",{type:"button",className:"terminal-manager-mobile-picker-trigger","aria-label":`${e} ${(c==null?void 0:c.label)??""}`.trim(),"aria-expanded":s?"true":"false",onClick:i,children:[n.jsxs("span",{className:"terminal-manager-mobile-picker-copy",children:[n.jsx("strong",{children:(c==null?void 0:c.label)??o("common.unknown")}),c!=null&&c.description?n.jsx("span",{children:c.description}):null]}),n.jsx(XG,{expanded:s})]}),s?n.jsx("div",{className:"terminal-manager-mobile-picker-list",role:"listbox","aria-label":e,children:r.map(d=>{const m=d.value===t;return n.jsxs("button",{type:"button",role:"option",className:"terminal-manager-mobile-picker-option","aria-selected":m,disabled:d.disabled,onClick:()=>{l(d.value)},children:[n.jsxs("span",{className:"terminal-manager-mobile-picker-option-copy",children:[n.jsx("strong",{children:d.label}),d.description?n.jsx("span",{children:d.description}):null]}),n.jsx("span",{className:"terminal-manager-mobile-picker-option-indicator","aria-hidden":"true",children:m?n.jsx(JG,{}):n.jsx(QG,{})})]},d.value||"__empty__")})}):null]})}function XG({expanded:e}){return n.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",className:"terminal-manager-mobile-picker-chevron","data-expanded":e?"true":"false",children:n.jsx("path",{d:"M4 6.5L8 10l4-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.7"})})}function QG(){return n.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:n.jsx("path",{d:"M6 3.5L10.5 8 6 12.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function JG(){return n.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:n.jsx("path",{d:"M3.5 8.5L6.5 11.5L12.5 5.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.8"})})}function vw({className:e,currentWorkspaceId:t,navigationGroups:r,externalWindowMode:s=!1,workbenchShellOverrides:i}){var cn,Vt,Gt,pn;const l=sr(),c=Mr(),{subscribeTerminalManagerSnapshot:d,requestTerminalManagerRefresh:m,addTerminalManagerSnapshotListener:f}={...c,...i},v=(t==null?void 0:t.trim())||null,[g,w]=p.useState([]),[k,y]=p.useState([]),[S,T]=p.useState([]),[j,N]=p.useState([]),[D,H]=p.useState(""),[B,I]=p.useState(""),[A,L]=p.useState(uh),[_,F]=p.useState(null),[te,E]=p.useState(null),[se,X]=p.useState([]),[K,G]=p.useState(!1),[q,U]=p.useState(!1),[Q,P]=p.useState(null),[W,J]=p.useState(null),[R,ve]=p.useState(null),[pe,Y]=p.useState(null),[Se,Le]=p.useState(null),[re,Ce]=p.useState(!1),[Xe,Ue]=p.useState(null),{showToast:ct}=Qn(),Nt=(e==null?void 0:e.includes("mobile-tool-process-panel"))??!1,Ke=_!==null,ut=_==="edit"?k.find(ie=>ie.id===te)??null:null,vt=_==="edit";p.useEffect(()=>{Ft("terminal_manager.props",{currentWorkspaceId:t,workspaceCount:r.length,externalWindowMode:s})},[t,s,r.length]);const Te=p.useMemo(()=>j.find(ie=>ie.id===D)??null,[D,j]),_e=p.useMemo(()=>LG(l.ui.osFamily),[l.ui.osFamily]),we=p.useMemo(()=>new Map(S.map(ie=>[ie.templateId,ie])),[S]),qe=p.useMemo(()=>S.filter(ie=>ie.occupied).length,[S]),ke=p.useMemo(()=>k.filter(ie=>ie.port!==null).length,[k]),Ee=(Te==null?void 0:Te.available)===!1&&j.length>0;p.useEffect(()=>{H(ie=>j.length?ie&&j.some(Be=>Be.id===ie)?ie:WG(j):"")},[j]),p.useEffect(()=>{!Ke||!v||j.length>0||wt(v)},[v,j.length,Ke]),p.useEffect(()=>{Ke||Ue(null)},[Ke]),p.useEffect(()=>{_==="edit"&&te&&!ut&&(F(null),E(null),L(uh),I(""),Ue(null))},[ut,te,_]),p.useEffect(()=>{!pe||R===pe.templateId||k.some(ie=>ie.id===pe.templateId)||Y(null)},[pe,R,k]),p.useEffect(()=>{if(!v){w([]),y([]),T([]),G(!1);return}const ie=Ur(Ng(v),Gj);Ft("terminal_manager.snapshot",{workspaceId:v,cached:!!ie,cachedTemplateCount:(ie==null?void 0:ie.templates.length)??0,cachedStatusCount:(ie==null?void 0:ie.templateStatuses.length)??0}),ie?(w(ie.terminals),y(ie.templates),T(ie.templateStatuses),N(ie.shellOptions??[]),G(!1)):(w([]),y([]),T([]),N([]),G(!0))},[v]),p.useEffect(()=>{if(v)return f(ie=>{ie.workspaceId===v&&(Ft("terminal_manager.snapshot_received",{workspaceId:ie.workspaceId,terminalCount:ie.terminals.length,templateCount:ie.templates.length,statusCount:ie.templateStatuses.length}),$e(ie),G(!1))})},[v,f]),p.useEffect(()=>{if(!v)return;const ie=Ur(Ng(v),Gj)!==null;if(d(v),ie){const Be=window.setTimeout(()=>{wt(v)},1500);return()=>{window.clearTimeout(Be)}}wt(v)},[v,m,d]),p.useEffect(()=>{v&&_s(Ng(v),{terminals:g,templates:k,templateStatuses:S,shellOptions:j})},[v,j,S,k,g]);function $e(ie){w(ie.terminals),y(ie.templates),T(ie.templateStatuses),N(ie.shellOptions??[])}function wt(ie){Ft("terminal_manager.refresh_requested",{workspaceId:ie}),m(ie)}function me(){F(null),E(null),L(uh),I(""),Ue(null)}function Pe(){E(null),L(uh),I(""),F("create")}function Ge(ie){E(ie.id),L(zG(ie)),I(ie.runtimeType??""),F("edit")}async function dt(ie){if(v){J(ie);try{await AG(ie),wt(v),ct({title:o("terminalManager.stopProcessSuccess"),tone:"success"})}catch(Be){ct({title:Be instanceof Error?Be.message:o("terminalManager.stopProcessFailed"),tone:"error"})}finally{J(null)}}}async function Ye(){if(!v||!A.target.trim())return;const ie=$G(A.port);if(Number.isNaN(ie)){ct({title:o("terminalManager.invalidPort"),tone:"error"});return}if(A.proxyEnabled&&ie===null){ct({title:o("terminalManager.proxyPortRequired"),tone:"error"});return}U(!0);try{const Be={workspaceId:v,name:UG(A),cwd:A.cwd.trim()||void 0,command:A.target.trim(),args:BG(A.args),port:ie,proxyEnabled:A.proxyEnabled,runtimeType:B||null};if(vt&&te){const Mt=await IG(te,Be);y(Tt=>Tt.map(xn=>xn.id===Mt.id?Mt:xn))}else await MG(Be);me(),wt(v),ct({title:o(vt?"terminalManager.templateUpdateSuccess":"terminalManager.templateSaveSuccess"),tone:"success"})}catch(Be){ct({title:Be instanceof Error?Be.message:o(vt?"terminalManager.templateUpdateFailed":"terminalManager.templateSaveFailed"),tone:"error"})}finally{U(!1)}}async function Dt(ie){const Be=await l.bridge.openExternal(ie);Be.ok||ct({title:Be.detail||o("terminalManager.openProxyUrlFailed"),tone:"error"})}async function ae(ie,Be){if(v){ve(ie.id);try{await EG(ie.id),y(Mt=>Mt.filter(Tt=>Tt.id!==ie.id)),T(Mt=>Mt.filter(Tt=>Tt.templateId!==ie.id)),X(Mt=>Mt.filter(Tt=>Tt!==ie.id)),Y(Mt=>(Mt==null?void 0:Mt.templateId)===ie.id?null:Mt),te===ie.id&&me(),wt(v),ct({title:o("terminalManager.templateDeleteSuccess"),tone:"success"})}catch(Mt){ct({title:Mt instanceof Error?Mt.message:o("terminalManager.templateDeleteFailed"),tone:"error"})}finally{ve(null)}}}async function We(ie){if(!v)return;const Be=Te!=null&&Te.available?Te.shell:void 0;P(ie);try{await $j(ie,{shell:Be}),wt(v),ct({title:o("terminalManager.templateRunSuccess"),tone:"success"})}catch(Mt){if(FG(Mt)){Le({templateId:ie,shell:Be});return}ct({title:Mt instanceof Error?Mt.message:o("terminalManager.templateRunFailed"),tone:"error"})}finally{P(null)}}async function jt(){if(!(!v||!Se)){Ce(!0);try{await $j(Se.templateId,{shell:Se.shell,runtimeType:"embedded-pty"}),Le(null),wt(v),ct({title:o("terminalManager.templateRunSuccess"),tone:"success"})}catch(ie){ct({title:ie instanceof Error?ie.message:o("terminalManager.templateRunFailed"),tone:"error"})}finally{Ce(!1)}}}function Rt(ie){X(Be=>Be.includes(ie)?Be.filter(Mt=>Mt!==ie):[...Be,ie])}return r.length?v?n.jsxs("section",{className:["conversation-panel","surface-card","terminal-manager-panel",e].filter(Boolean).join(" "),children:[n.jsx(_G,{open:Se!==null,busy:re,onClose:()=>{re||Le(null)},onConfirmFallback:()=>{jt()}}),n.jsxs("div",{className:"terminal-manager-header terminal-manager-desktop-header",children:[n.jsxs("div",{className:"terminal-manager-panel-heading",children:[n.jsx("span",{className:"terminal-manager-panel-eyebrow",children:o("terminalManager.quickLaunchTitle")}),n.jsxs("div",{children:[n.jsx("h2",{children:o("terminalManager.templateSectionTitle")}),n.jsx("p",{className:"status-text",children:o("terminalManager.desktopPanelDescription")})]})]}),n.jsxs("div",{className:"terminal-manager-overview",children:[n.jsxs("article",{className:"terminal-manager-overview-card",children:[n.jsx("span",{children:o("terminalManager.runningCountLabel")}),n.jsx("strong",{children:qe})]}),n.jsxs("article",{className:"terminal-manager-overview-card",children:[n.jsx("span",{children:o("terminalManager.portWatchCountLabel")}),n.jsx("strong",{children:ke})]}),n.jsxs("article",{className:"terminal-manager-overview-card",children:[n.jsx("span",{children:o("terminalManager.terminalCountLabel")}),n.jsx("strong",{children:g.length})]})]}),n.jsxs("div",{className:"terminal-manager-toolbar terminal-manager-toolbar-header",children:[n.jsx("button",{className:"ghost-button",type:"button",disabled:!v||K,onClick:()=>{v&&wt(v)},children:o("terminalManager.refresh")}),n.jsx("button",{className:"primary-button",type:"button",disabled:!v,onClick:()=>{Pe()},children:o("terminalManager.openCreateModalAction")})]})]}),n.jsxs("section",{className:"terminal-manager-section",children:[n.jsxs("div",{className:"terminal-manager-section-header",children:[n.jsxs("div",{children:[n.jsx("h3",{children:o("terminalManager.templateSectionTitle")}),n.jsx("p",{className:"status-text",children:o("terminalManager.templateSectionDescription")})]}),n.jsx("span",{className:"workbench-section-counter",children:k.length})]}),K&&!k.length?n.jsx("p",{className:"status-text",children:o("common.loading")}):null,k.length?n.jsx("div",{className:"terminal-manager-list",children:k.map(ie=>{const Be=Kj(we,ie.id),Mt=VG(ie,Be),Tt=GG(Be),xn=se.includes(ie.id),dn=o(xn?"terminalManager.hideDetailsAction":"terminalManager.showDetailsAction"),Nn=ie.proxyEnabled&&ie.proxySlug?qG(ie.proxySlug):null;return n.jsxs("article",{className:"terminal-manager-card terminal-manager-desktop-card","data-tone":Mt.tone,"data-expanded":xn?"true":"false",children:[n.jsxs("div",{className:"terminal-manager-card-header",children:[n.jsxs("div",{className:"terminal-manager-card-title",children:[n.jsx("span",{className:"terminal-manager-card-indicator","aria-hidden":"true"}),n.jsx("strong",{children:ie.name})]}),n.jsxs("div",{className:"terminal-manager-card-tools",children:[n.jsx("span",{className:"badge terminal-runtime-badge",children:Vj(ie.runtimeType,l.ui.osFamily)}),n.jsx("span",{className:"badge",children:pA(ie)==="script"?o("terminalManager.scriptMode"):o("terminalManager.commandMode")}),n.jsx("button",{className:"terminal-manager-detail-toggle",type:"button","aria-label":dn,"aria-expanded":xn,onClick:()=>{Rt(ie.id)},children:"i"})]})]}),n.jsxs("div",{className:"terminal-manager-status-panel",children:[n.jsxs("div",{className:"terminal-manager-status-copy",children:[n.jsx("p",{className:"terminal-manager-status-title",children:Mt.title}),n.jsx("p",{className:"status-text",children:Mt.summary})]}),n.jsxs("div",{className:"terminal-manager-status-badges",children:[n.jsx("span",{className:"terminal-manager-stat-pill",children:ie.port===null?o("terminalManager.portUnset"):`${o("terminalManager.portLabel")} ${ie.port}`}),n.jsx("span",{className:"badge","data-tone":Mt.badgeTone,children:Mt.badgeLabel}),Be!=null&&Be.occupied&&Be.processGroupId?n.jsx("span",{className:"badge",children:`PGID ${Be.processGroupId}`}):null,ie.proxyEnabled?n.jsx("span",{className:"badge",children:o("terminalManager.proxyEnabled")}):null]})]}),n.jsxs("div",{className:"terminal-manager-actions",children:[Be!=null&&Be.occupied?n.jsx("button",{className:"secondary-button",type:"button",disabled:W===ie.id,onClick:()=>{dt(ie.id)},children:W===ie.id?o("terminalManager.stoppingProcess"):o("terminalManager.stopProcessAction")}):null,n.jsx("button",{className:"secondary-button",type:"button",disabled:Q===ie.id||Ee,onClick:()=>{We(ie.id)},children:Q===ie.id?o("terminalManager.runningTemplate"):o("terminalManager.runTemplateAction")})]}),xn?n.jsxs("section",{className:"terminal-manager-details","aria-label":o("terminalManager.detailsSectionTitle"),children:[n.jsxs("div",{className:"terminal-manager-detail-grid",children:[n.jsxs("div",{className:"terminal-manager-detail-item terminal-manager-detail-item-wide",children:[n.jsx("span",{children:o("terminalManager.commandPreviewLabel")}),n.jsx("strong",{children:HG(ie)})]}),n.jsxs("div",{className:"terminal-manager-detail-item",children:[n.jsx("span",{children:o("terminalManager.cwdLabel")}),n.jsx("strong",{children:ie.cwd})]}),n.jsxs("div",{className:"terminal-manager-detail-item",children:[n.jsx("span",{children:o("terminal.runtimeField")}),n.jsx("strong",{children:Vj(ie.runtimeType,l.ui.osFamily)})]}),n.jsxs("div",{className:"terminal-manager-detail-item",children:[n.jsx("span",{children:o("terminalManager.updatedAt")}),n.jsx("strong",{children:OG(ie.updatedAt)})]}),n.jsxs("div",{className:"terminal-manager-detail-item",children:[n.jsx("span",{children:o("terminalManager.portLabel")}),n.jsx("strong",{children:ie.port===null?o("terminalManager.portUnset"):ie.port})]}),n.jsxs("div",{className:"terminal-manager-detail-item terminal-manager-detail-item-wide",children:[n.jsx("span",{children:o("terminalManager.proxyField")}),n.jsx("strong",{children:Nn??o("terminalManager.proxyDisabledDescription")})]}),Be!=null&&Be.processId?n.jsxs("div",{className:"terminal-manager-detail-item",children:[n.jsx("span",{children:o("terminalManager.processIdLabel")}),n.jsx("strong",{children:Be.processId})]}):null,Be!=null&&Be.processGroupId?n.jsxs("div",{className:"terminal-manager-detail-item",children:[n.jsx("span",{children:o("terminalManager.processGroupIdLabel")}),n.jsx("strong",{children:Be.processGroupId})]}):null,Tt?n.jsxs("div",{className:"terminal-manager-detail-item",children:[n.jsx("span",{children:o("terminalManager.terminationScopeLabel")}),n.jsx("strong",{children:Tt})]}):null,Be!=null&&Be.parentProcessId?n.jsxs("div",{className:"terminal-manager-detail-item",children:[n.jsx("span",{children:o("terminalManager.parentProcessIdLabel")}),n.jsx("strong",{children:Be.parentProcessId})]}):null,Be!=null&&Be.processCommandLine?n.jsxs("div",{className:"terminal-manager-detail-item terminal-manager-detail-item-wide",children:[n.jsx("span",{children:o("terminalManager.processCommandLabel")}),n.jsx("strong",{children:Be.processCommandLine})]}):null,Be!=null&&Be.parentProcessCommandLine?n.jsxs("div",{className:"terminal-manager-detail-item terminal-manager-detail-item-wide",children:[n.jsx("span",{children:o("terminalManager.parentProcessCommandLabel")}),n.jsx("strong",{children:Be.parentProcessCommandLine})]}):null]}),n.jsxs("div",{className:"terminal-manager-actions terminal-manager-detail-actions",children:[Nn?n.jsx("button",{className:"secondary-button",type:"button",onClick:()=>{Dt(Nn)},children:o("terminalManager.openProxyUrlAction")}):null,n.jsx("button",{className:"secondary-button",type:"button",disabled:q||R===ie.id,onClick:()=>{Ge(ie)},children:o("terminalManager.editAction")}),n.jsx("button",{className:"secondary-button workbench-danger-button",type:"button",disabled:R===ie.id,onClick:()=>{Y({templateId:ie.id,name:ie.name,occupied:!!(Be!=null&&Be.occupied)})},children:R===ie.id?o("terminalManager.templateRemoving"):o("terminalManager.removeAction")})]})]}):null]},ie.id)})}):n.jsx("section",{className:"workbench-empty-state minimal",children:n.jsx("p",{children:o("terminalManager.emptyTemplateBody")})})]}),n.jsx(KG,{open:Ke,title:o(vt?"terminalManager.editModalTitle":"terminalManager.createModalTitle"),description:o(vt?"terminalManager.editModalDescription":"terminalManager.createModalDescription"),className:Nt?"terminal-manager-mobile-modal":void 0,onClose:me,children:n.jsxs("section",{className:"terminal-manager-modal-form",children:[Nt?n.jsxs(n.Fragment,{children:[n.jsx(Yj,{label:o("terminalManager.shellField"),value:D,open:Xe==="shell",options:j.map(ie=>({value:ie.id,label:ie.label,description:ie.available?null:ie.unavailableReason??o("terminalManager.shellUnavailable"),disabled:!ie.available})),onToggle:()=>{Ue(ie=>ie==="shell"?null:"shell")},onChange:ie=>{H(ie),Ue(null)}}),(Te==null?void 0:Te.available)===!1&&Te.unavailableReason?n.jsx("p",{className:"status-text",children:Te.unavailableReason}):null,n.jsx(Yj,{label:o("terminal.runtimeField"),value:B,open:Xe==="runtime",options:_e.map(ie=>({value:ie.value,label:ie.label,description:ie.description})),onToggle:()=>{Ue(ie=>ie==="runtime"?null:"runtime")},onChange:ie=>{I(ie),Ue(null)}}),n.jsx("p",{className:"status-text",children:((cn=_e.find(ie=>ie.value===B))==null?void 0:cn.description)??((Vt=_e[0])==null?void 0:Vt.description)})]}):n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"field-group",children:[n.jsx("span",{children:o("terminalManager.shellField")}),n.jsx("select",{value:D,onChange:ie=>{H(ie.target.value)},children:j.map(ie=>n.jsx("option",{value:ie.id,disabled:!ie.available,children:ie.available?ie.label:`${ie.label} - ${o("terminalManager.shellUnavailable")}`},ie.id))}),(Te==null?void 0:Te.available)===!1&&Te.unavailableReason?n.jsx("p",{className:"status-text",children:Te.unavailableReason}):null]}),n.jsxs("div",{className:"field-group",children:[n.jsx("span",{children:o("terminal.runtimeField")}),n.jsx("select",{value:B,onChange:ie=>{I(ie.target.value)},children:_e.map(ie=>n.jsx("option",{value:ie.value,children:ie.label},ie.value||"auto"))}),n.jsx("p",{className:"status-text",children:((Gt=_e.find(ie=>ie.value===B))==null?void 0:Gt.description)??((pn=_e[0])==null?void 0:pn.description)})]})]}),n.jsxs("div",{className:"terminal-manager-mode-row",role:"tablist","aria-label":o("terminalManager.modeField"),children:[n.jsx("button",{type:"button",className:A.mode==="command"?"workbench-info-tab active":"workbench-info-tab",onClick:()=>{L(ie=>({...ie,mode:"command"}))},children:o("terminalManager.commandMode")}),n.jsx("button",{type:"button",className:A.mode==="script"?"workbench-info-tab active":"workbench-info-tab",onClick:()=>{L(ie=>({...ie,mode:"script"}))},children:o("terminalManager.scriptMode")})]}),n.jsxs("div",{className:"terminal-manager-grid",children:[n.jsxs("div",{className:"field-group",children:[n.jsx("span",{children:o("terminalManager.templateNameField")}),n.jsx("input",{value:A.name,placeholder:o("terminalManager.templateNamePlaceholder"),onChange:ie=>{L(Be=>({...Be,name:ie.target.value}))}})]}),n.jsxs("div",{className:"field-group",children:[n.jsx("span",{children:o("terminalManager.cwdField")}),n.jsx("input",{value:A.cwd,placeholder:o("terminalManager.cwdPlaceholder"),onChange:ie=>{L(Be=>({...Be,cwd:ie.target.value}))}})]})]}),n.jsxs("div",{className:"terminal-manager-grid",children:[n.jsxs("div",{className:"field-group",children:[n.jsx("span",{children:A.mode==="script"?o("terminalManager.scriptPathField"):o("terminalManager.commandField")}),n.jsx("input",{value:A.target,placeholder:A.mode==="script"?o("terminalManager.scriptPathPlaceholder"):o("terminalManager.commandPlaceholder"),onChange:ie=>{L(Be=>({...Be,target:ie.target.value}))}})]}),n.jsxs("div",{className:"field-group",children:[n.jsx("span",{children:o("terminalManager.argsField")}),n.jsx("input",{value:A.args,placeholder:o("terminalManager.argsPlaceholder"),onChange:ie=>{L(Be=>({...Be,args:ie.target.value}))}})]})]}),n.jsxs("div",{className:"terminal-manager-grid",children:[n.jsxs("div",{className:"field-group",children:[n.jsx("span",{children:o("terminalManager.portField")}),n.jsx("input",{value:A.port,placeholder:o("terminalManager.portPlaceholder"),onChange:ie=>{L(Be=>({...Be,port:ie.target.value}))}})]}),n.jsxs("div",{className:"field-group terminal-manager-proxy-field",children:[n.jsx("span",{children:o("terminalManager.proxyField")}),n.jsxs("div",{className:"terminal-manager-proxy-control",children:[n.jsx("span",{children:o("terminalManager.proxyToggleLabel")}),n.jsxs("label",{className:"terminal-manager-proxy-switch",children:[n.jsx("input",{type:"checkbox",role:"switch","aria-label":o("terminalManager.proxyField"),checked:A.proxyEnabled,onChange:ie=>{L(Be=>({...Be,proxyEnabled:ie.target.checked}))}}),n.jsx("span",{className:"terminal-manager-proxy-track","aria-hidden":"true",children:n.jsx("span",{className:"terminal-manager-proxy-thumb"})})]})]})]})]}),n.jsxs("div",{className:"terminal-manager-actions",children:[n.jsx("button",{className:"secondary-button",type:"button",onClick:me,children:o("common.close")}),n.jsx("button",{className:"primary-button",type:"button",disabled:!v||q||!A.target.trim(),onClick:()=>{Ye()},children:o(q?vt?"terminalManager.templateUpdating":"terminalManager.templateSaving":vt?"terminalManager.saveTemplateChangesAction":"terminalManager.saveLaunchAction")})]})]})}),n.jsx(YG,{open:pe!==null,busy:pe!==null&&R===pe.templateId,title:o("terminalManager.removeConfirmTitle"),description:pe?o(pe.occupied?"terminalManager.removeRunningConfirmTarget":"terminalManager.removeConfirmTarget",{name:pe.name}):"",confirmLabel:o("terminalManager.removeConfirmAction"),className:Nt?"terminal-manager-mobile-modal":"terminal-manager-confirm-modal",onClose:()=>{R||Y(null)},onConfirm:()=>{if(!pe)return;const ie=k.find(Be=>Be.id===pe.templateId);if(!ie){Y(null);return}Kj(we,ie.id),ae(ie)}})]}):n.jsx("section",{className:"workbench-empty-state minimal",children:n.jsx("p",{children:o("terminalManager.noCurrentWorkspaceBody")})}):n.jsx("section",{className:"workbench-empty-state minimal",children:n.jsx("p",{children:o("terminalManager.emptyWorkspaceBody")})})}function Ng(e){return`terminal-manager.snapshot.${e}`}const ZG=Object.freeze(Object.defineProperty({__proto__:null,TerminalManagerPanel:vw},Symbol.toStringTag,{value:"Module"})),fA="mobile.conversation.preview.mode",gA="mobile.conversation.tool.panel";function Pg(){if(typeof window>"u")return"preview";try{return window.localStorage.getItem(fA)==="immersive"?"immersive":"preview"}catch{return"preview"}}function Io(e){if(!(typeof window>"u"))try{window.localStorage.setItem(fA,e)}catch{}}function Xj(){if(typeof window>"u")return"files";try{const e=window.localStorage.getItem(gA);return e==="git"||e==="processes"?e:"files"}catch{return"files"}}function Qj(e){if(!(typeof window>"u"))try{window.localStorage.setItem(gA,e)}catch{}}function e9(e,t,r){if(!t)return null;const s=e.find(c=>c.workspace.id===t);if(!s)return null;const i=JN([s]).filter(c=>!c.session.isArchived&&!ba(c.session)),l=i.findIndex(c=>c.session.sessionId===r);return l<0?null:i[l+1]??null}const t9=15e3,Jj=.6,Dg=.6,Zj=8,n9=36,r9=48,s9=96,i9=320,a9="workbench:focus-composer";function o9(){const{sessionId:e="",workspaceId:t}=Ho(),r=ui(),s=fr(),i=p.useMemo(()=>new URLSearchParams(r.search),[r.search]),l=f9(i.get("toolPanel")),c=(t==null?void 0:t.trim())||null,d=p.useMemo(()=>h9(e,c,i),[c,i,e]),m=p.useMemo(()=>R9(e,r.state),[r.state,e]);return d?n.jsx(d9,{draft:d,navigate:s,initialToolPanel:l}):n.jsx(l9,{sessionId:e,bootstrapMessages:m,initialToolPanel:l})}function l9({sessionId:e,bootstrapMessages:t,initialToolPanel:r}){var Qt,ir;const{shellMode:s,navigationGroups:i,requestNavigationRefresh:l,selectWorkspace:c,setSessionWorkspace:d,markNavigationSessionSeen:m,favoriteSessions:f,archiveSession:v,unarchiveSession:g,startDraftSession:w,upsertNavigationSession:k}=Mr(),y=fr(),S=p.useRef(null),T=p.useRef(null),[j,N]=p.useState(!1),[D,H]=p.useState(null),[B,I]=p.useState(!1),[A,L]=p.useState(!1),[_,F]=p.useState(null),[te,E]=p.useState(!1),[se,X]=p.useState(!1),[K,G]=p.useState(null),q=p.useMemo(()=>i.flatMap(De=>De.sessions).find(De=>De.sessionId===e)??null,[i,e]);(!S.current||T.current!==e)&&((Qt=S.current)==null||Qt.destroy(),S.current=new SG(e,{initialSession:q,bootstrapMessages:t,onSeen:(De,ze)=>{m(De,ze)}}),T.current=e);const U=S.current,{showToast:Q,dismissToast:P}=Qn(),W=ci(De=>De.notificationPreferences.notifyOnPermissionRequest),J=sr(),R=di(),ve=p.useRef(null),pe=p.useRef(null),Y=p.useRef(null),Se=p.useRef((q==null?void 0:q.runningState)??null),Le=p.useRef(new Set),re=ys(U,De=>De.session),Ce=ys(U,De=>De.capabilities),Xe=ys(U,De=>De.runtimeHasActiveRun),Ue=ys(U,De=>De.runtimeCanInterrupt),ct=ys(U,De=>De.messages),Nt=ys(U,De=>De.permissionRequests),Ke=ys(U,De=>De.queuedMessages),ut=ys(U,De=>De.contextUsage),vt=ys(U,De=>De.historyState),Te=ys(U,De=>De.errorCode),_e=ys(U,De=>De.errorDetail),we=ys(U,De=>De.interruptSource),qe=ys(U,De=>De.loadingOlderMessages),ke=ys(U,De=>De.hasOlderMessages),Ee=ys(U,De=>De.connectionState),[$e,wt]=p.useState(null),[me,Pe]=p.useState(null),Ge=S9(re),dt=Ge&&FP(Ce)&&(re==null?void 0:re.provider)===(Ce==null?void 0:Ce.provider),Ye=Ke.some(De=>De.status==="queued"||De.status==="dispatching"),Dt=C9({sessionId:e,provider:(re==null?void 0:re.provider)??null,runningState:(re==null?void 0:re.runningState)??null,activityState:(re==null?void 0:re.activityState)??null,runtimeHasActiveRun:Xe,messages:ct})?o("conversation.runtimeThinkingPlaceholder",{provider:o("conversation.providerCodex")}):null,ae=s!=="mobile",We=TA(!ae),jt=(re==null?void 0:re.workspaceId)??(q==null?void 0:q.workspaceId)??null,Rt=CA({enabled:!ae,initialPanel:r,workspaceId:jt,suspendMainGesture:!ae&&We.isVisible}),cn=p.useMemo(()=>new Set(f.map(De=>De.session.sessionId)),[f]),Vt=p.useMemo(()=>i.map(De=>De.workspace),[i]),Gt=p.useMemo(()=>Gl(i),[i]),pn=p.useMemo(()=>vm(i),[i]),ie=p.useMemo(()=>vA(i,(re==null?void 0:re.workspaceId)??(q==null?void 0:q.workspaceId)??null,cn),[cn,i,q==null?void 0:q.workspaceId,re==null?void 0:re.workspaceId]),Be=p.useMemo(()=>wA(f,i),[f,i]),[Mt,Tt]=p.useState([]),xn=p.useMemo(()=>[...Be,...ie],[Be,ie]),dn=p.useMemo(()=>jt?Vt.find(De=>De.id===jt)??null:null,[jt,Vt]),Nn=(jt?pn[jt]??null:null)??(dn?Mu(dn):null),Sn=p.useMemo(()=>pa(i,jt),[jt,i]),Et=Gt.find(De=>De.workspace.id===jt)??(Sn?{workspace:Sn.workspace,label:Sn.workspace.name,subtitle:Sn.workspace.path}:null),In=p.useMemo(()=>e9(i,jt,e),[jt,i,e]),wn=(re==null?void 0:re.provider)??(q==null?void 0:q.provider)??null,Z=p.useMemo(()=>{var De;return Ki(((De=re??q)==null?void 0:De.title)??null,o("conversation.titleFallback"))},[q,re]),ce=re??q??null,ge=ae?null:SA(We.mainGestureHandlers,Rt.mainGestureHandlers);p.useEffect(()=>{const De=ha(xn,e,ze=>ze.session.sessionId);De.length!==0&&Tt(ze=>{const $t=new Set(ze);let an=!1;for(const kt of De)$t.has(kt)||($t.add(kt),an=!0);return an?Array.from($t):ze})},[xn,e]);const He=p.useMemo(()=>I9(ce,ct),[ce,ct]),Je=(ce==null?void 0:ce.workspaceId)??(q==null?void 0:q.workspaceId)??null,ft=p.useMemo(()=>iA(i,Je,e),[Je,i,e]),gt=rG(ft),nt=!!(ce&&Je&>),yt=()=>{X(!0)},rt=p.useMemo(()=>(Sn==null?void 0:Sn.sessions.filter(De=>De.isArchived===!0&&!ba(De)))??[],[Sn]),oe=p.useRef(null),Ne=p.useRef(null),Lt=p.useRef(null),Wt=p.useRef(null),[Kt,un]=p.useState(null),{composerPortalTarget:En}=lv();p.useEffect(()=>{U.applyNavigationSession(q)},[q,U]),p.useEffect(()=>(U.initialize(),()=>{U.destroy()}),[U]),p.useEffect(()=>(d(e,(re==null?void 0:re.workspaceId)??null),()=>{d(e,null)}),[re==null?void 0:re.workspaceId,e,d]),p.useEffect(()=>{X(!1),G(null)},[e]),p.useEffect(()=>()=>{Y.current!==null&&(window.clearTimeout(Y.current),Y.current=null)},[]),p.useEffect(()=>{if(!Te||!_e){Y.current!==null&&(window.clearTimeout(Y.current),Y.current=null),pe.current=null,ve.current=null,P("conversation-runtime-error");return}const De=`${Te}:${_e}`;if(!(ve.current===De||pe.current===De)){if(Y.current!==null&&(window.clearTimeout(Y.current),Y.current=null),c9((re==null?void 0:re.provider)??null,Te,_e)){pe.current=De,Y.current=window.setTimeout(()=>{pe.current=null,Y.current=null,ve.current=De,Q({id:"conversation-runtime-error",title:o("conversation.runtimeErrorTitle"),description:_e,tone:"error",durationMs:null})},t9);return}pe.current=null,ve.current=De,Q({id:"conversation-runtime-error",title:o("conversation.runtimeErrorTitle"),description:_e,tone:"error",durationMs:null})}},[P,Te,_e,re==null?void 0:re.provider,Q]),p.useEffect(()=>{const De=Se.current,ze=(re==null?void 0:re.runningState)??null;(De==="starting"||De==="running"||De==="reconnecting")&&ze==="completed"&&R.trigger("success"),Se.current=ze},[R,re==null?void 0:re.runningState]),p.useEffect(()=>{const De=Nt.filter($t=>$t.status==="pending"),ze=(re==null?void 0:re.workspaceId)??(q==null?void 0:q.workspaceId)??null;for(const $t of De)Le.current.has($t.id)||(Le.current.add($t.id),W&&(Q({id:`permission-request-${$t.id}`,title:o("conversation.permissionRequestToastTitle"),description:$t.title,tone:"warning",durationMs:8e3,action:ze?{label:o("shell.contextOpenSession"),onClick:()=>{y(Yn(ze,e))}}:void 0}),J.bridge.showNotification(o("conversation.permissionRequestToastTitle"),$t.title)))},[q==null?void 0:q.workspaceId,y,W,Nt,J.bridge,re==null?void 0:re.workspaceId,e,Q]),kA(Lt,Kt,!ae,e),xA(Lt,Wt,!ae,e);async function Hn(De,ze){var kt,Zt;const $t=K;if(!$t){await U.sendMessage(De,{model:ze==null?void 0:ze.model,reasoningLevel:ze==null?void 0:ze.reasoningLevel,attachments:ze==null?void 0:ze.attachments,attachmentMeta:ze==null?void 0:ze.attachmentMeta}),l();return}let an=null;try{an=await jP(e,{sourceType:"message",sourceMessageId:$t.sourceMessageId,sourceMessageSnapshot:$t.sourceMessageSnapshot,strategy:"auto",targetProvider:$t.targetProvider}),k(an),await Rv(an.sessionId,{content:De,clientRequestId:((Zt=(kt=globalThis.crypto)==null?void 0:kt.randomUUID)==null?void 0:Zt.call(kt))??`fork-${Date.now()}-${Math.random().toString(16).slice(2)}`,model:$t.targetModel,reasoningLevel:(ze==null?void 0:ze.reasoningLevel)??null,attachments:(ze==null?void 0:ze.attachments)??[]}),G(null),l(),c(an.workspaceId),Io("preview"),y(Yn(an.workspaceId,an.sessionId)),Q({title:o("conversation.forkMessageSucceeded"),tone:"success"})}catch(Pn){throw an&&(k(an),l()),Pn}}function jn(De){c(De),y(Ni(De))}return n.jsxs(n.Fragment,{children:[n.jsxs("main",{ref:Lt,className:"workbench-page conversation-page-shell mobile-page-fixed-root mobile-conversation-page","data-mobile-shell":!ae,"data-preview-mode":ae?void 0:We.displayMode,"data-preview-dragging":ae?void 0:We.isDragging,"data-workspace-tone":(Nn==null?void 0:Nn.tone)??"root","data-worktree-depth":(Nn==null?void 0:Nn.depth)??0,"data-tool-panel-open":ae?void 0:Rt.isOpen,style:{...ae?{}:We.pageStyle,...ai(Nn)??{}},children:[ae?n.jsx(dA,{session:re??q,workspaceContext:Nn,actions:n.jsxs(n.Fragment,{children:[nt?n.jsx(x9,{onOpenBranchTree:yt}):null,n.jsx(rA,{session:re??q})]})}):null,ae?null:n.jsx(Kl,{containerRef:Wt,className:"mobile-conversation-page-header",gestureHandlers:ge??void 0,currentWorkspace:Et?{id:Et.workspace.id,name:Et.label,path:Et.subtitle}:Vt[0]??null,workspaces:Vt,workspaceOptions:Gt,onSelectWorkspace:jn,heading:Z.fullTitle,trailing:n.jsxs("div",{className:"mobile-conversation-toolbar-main",children:[n.jsx("span",{className:"mobile-conversation-toolbar-title",title:Z.fullTitle,children:Z.displayTitle}),n.jsx($8,{session:re??q,onOpenBranchTree:nt?yt:void 0})]})}),ae?null:n.jsx(NA,{visible:!Rt.isOpen&&We.isVisible,widthPx:We.previewWidthPx,isDragging:We.isDragging,gestureHandlers:We.railGestureHandlers,activeSessionId:e,createSessionActionLabel:jt&&wn?o("shell.createSession"):void 0,favoriteItems:Be,items:ie,expandedRootIds:Mt,workspaceSectionLabel:(Et==null?void 0:Et.label)??o("shell.mobileConversationCurrentWorkspaceSection"),onCreateSession:jt&&wn?()=>{w(jt,wn)}:void 0,archiveCurrentActionLabel:o("shell.archiveCurrentSessionAction"),archiveFolderActionLabel:rt.length>0?o("shell.archiveFolderLabel"):void 0,onArchiveActiveSession:()=>{I(!0)},onOpenArchiveFolder:rt.length>0?()=>{L(!0)}:void 0,onToggleSubsessions:De=>{Tt(ze=>ze.includes(De)?ze.filter($t=>$t!==De):[...ze,De])},onActivate:De=>{We.closePreview(),c(De.workspace.id),y(Yn(De.workspace.id,De.session.sessionId))}}),n.jsx("div",{className:"mobile-conversation-stage",...ge??{},children:n.jsxs("div",{ref:oe,className:"mobile-conversation-main",children:[n.jsx(MR,{connectionState:Ee,onReconnect:()=>U.reconnect()}),n.jsx(V8,{requests:Nt,replyingRequestId:D,onReply:async(De,ze)=>{H(De);try{await U.replyPermissionRequest(De,ze)}catch($t){Q({title:o("conversation.permissionRequestReplyFailed"),description:$t instanceof Error?$t.message:void 0,tone:"error"})}finally{H(null)}}}),n.jsx("div",{ref:Ne,className:"conversation-timeline-shell",children:n.jsx(Im,{sessionId:e,messages:He,historyState:vt,loadingOlderMessages:qe,hasOlderMessages:ke,provider:(re==null?void 0:re.provider)??null,interruptedSource:we,runtimeThinkingPlaceholder:Dt,onLoadOlderMessages:()=>{U.loadOlderMessages()},onRetryMessage:De=>{U.retryMessage(De)},onForkMessage:De=>{re&&(G({sourceMessageId:De.id,sourceMessageSnapshot:{role:De.role,kind:De.kind??(De.role==="tool"?"tool_result":"text"),content:De.content},content:De.content,sourceProvider:re.provider,workspaceId:re.workspaceId,targetProvider:re.provider,targetModel:null}),u9())}})}),n.jsx(X$,{containerRef:Ne,session:re??q??null,currentCapabilities:Ce}),n.jsx(Y8,{items:Ke,deletingQueueItemId:$e,steeringQueueItemId:me,canSteer:dt,onDelete:async De=>{wt(De);try{await U.deleteQueuedMessage(De)}finally{wt(null)}},onSteer:async De=>{Pe(De);try{await U.steerQueuedMessage(De),l()}finally{Pe(null)}}}),Rt.isOpen?null:n.jsx(Nm,{capabilities:Ce,draftStorageId:e,forkDraft:K,onClearForkDraft:()=>G(null),onForkDraftChange:De=>G(De),panelRef:ae?void 0:un,portalContainer:ae?null:En,hasActiveRun:Xe,contextUsage:ut,taskProvider:((ir=re??q)==null?void 0:ir.provider)??null,taskMessages:ct,hasPendingQueuedMessages:Ye,canInterrupt:Ue,isSubmitting:j,isRunning:Ge,onInterrupt:async()=>{await U.interrupt(),l()},onSend:async(De,ze)=>{N(!0);try{await Hn(De,{model:ze==null?void 0:ze.model,reasoningLevel:ze==null?void 0:ze.reasoningLevel,attachments:ze==null?void 0:ze.attachments,attachmentMeta:ze==null?void 0:ze.attachmentMeta})}finally{N(!1)}},onQueueSend:async(De,ze)=>{N(!0);try{K?await Hn(De,{model:ze==null?void 0:ze.model,reasoningLevel:ze==null?void 0:ze.reasoningLevel,attachments:ze==null?void 0:ze.attachments,attachmentMeta:ze==null?void 0:ze.attachmentMeta}):await U.enqueueMessage(De,{model:ze==null?void 0:ze.model,reasoningLevel:ze==null?void 0:ze.reasoningLevel,attachments:ze==null?void 0:ze.attachments,attachmentMeta:ze==null?void 0:ze.attachmentMeta})}finally{N(!1)}}})]})}),!ae&&jt?n.jsx(jA,{activePanel:Rt.activePanel,open:Rt.isOpen,sessionId:e,workspaceId:jt,navigationGroups:i,onClose:()=>{Rt.closePanel()},onSelectPanel:De=>{Rt.selectPanel(De)},onSelectPanelBySwipe:De=>{if(De===null){Rt.closePanel();return}Rt.selectPanel(De)}}):null]}),n.jsx(vG,{open:se,navigationGroups:i,workspaceId:Je,sessionId:e,onClose:()=>X(!1),onOpenSession:De=>{X(!1),c(De.workspaceId),Io("preview"),y(Yn(De.workspaceId,De.sessionId))}}),n.jsx(k9,{open:B,busy:te,onClose:()=>{te||I(!1)},onConfirm:async()=>{if(!te){E(!0);try{if(await v(e),I(!1),Q({title:o("shell.archiveAdded"),tone:"success"}),jt){if(c(jt),Io("preview"),In){y(Yn(In.workspace.id,In.session.sessionId));return}y(Ni(jt));return}y("/workspaces")}catch(De){Q({title:De instanceof Error?De.message:o("shell.navigationLoadFailed"),tone:"error"})}finally{E(!1)}}}}),n.jsx(DA,{open:A,workspaceName:(Sn==null?void 0:Sn.workspace.name)??null,sessions:rt,restoringSessionId:_,onClose:()=>{_||L(!1)},onRestore:async De=>{F(De);try{await g(De),Q({title:o("shell.archiveRestored"),tone:"success"})}catch(ze){Q({title:ze instanceof Error?ze.message:o("shell.navigationLoadFailed"),tone:"error"})}finally{F(null)}}})]})}function c9(e,t,r){return e!=="opencode"?!1:t==="OPENCODE_REQUEST_TIMEOUT"||t==="PROVIDER_RUNTIME_TIMEOUT"||/\bSERVER_TIMEOUT\b/i.test(r)||/timeout/i.test(r)||/超时/.test(r)}function u9(){typeof window>"u"||window.dispatchEvent(new CustomEvent(a9))}function d9({draft:e,navigate:t,initialToolPanel:r}){const{shellMode:s,navigationGroups:i,requestNavigationRefresh:l,selectWorkspace:c,setSessionWorkspace:d,upsertNavigationSession:m,favoriteSessions:f,unarchiveSession:v,startDraftSession:g}=Mr(),[w,k]=p.useState(!1),[y,S]=p.useState([]),T=p.useMemo(()=>Ga(e.provider),[e.provider]),[j,N]=p.useState(T),D=s!=="mobile",{showToast:H}=Qn(),B=p.useMemo(()=>m9(e),[e]),I=TA(!D),A=CA({enabled:!D,initialPanel:r,sessionId:e.sessionId,workspaceId:e.workspaceId,suspendMainGesture:!D&&I.isVisible}),L=p.useMemo(()=>new Set(f.map(Ke=>Ke.session.sessionId)),[f]),_=p.useMemo(()=>i.map(Ke=>Ke.workspace),[i]),F=p.useMemo(()=>Gl(i),[i]),te=p.useMemo(()=>vm(i),[i]),E=p.useMemo(()=>_.find(Ke=>Ke.id===e.workspaceId)??null,[e.workspaceId,_]),se=te[e.workspaceId]??(E?Mu(E):null),X=p.useMemo(()=>Ki(B.title??null,o("conversation.titleFallback")),[B]),K=p.useMemo(()=>vA(i,e.workspaceId,L),[e.workspaceId,L,i]),G=p.useMemo(()=>wA(f,i),[f,i]),[q,U]=p.useState([]),Q=p.useMemo(()=>[...G,...K],[G,K]),P=p.useMemo(()=>pa(i,e.workspaceId),[e.workspaceId,i]),W=p.useMemo(()=>(P==null?void 0:P.sessions.filter(Ke=>Ke.isArchived===!0&&!ba(Ke)))??[],[P]),J=F.find(Ke=>Ke.workspace.id===e.workspaceId)??(P?{workspace:P.workspace,label:P.workspace.name,subtitle:P.workspace.path}:null),R=D?null:SA(I.mainGestureHandlers,A.mainGestureHandlers),[ve,pe]=p.useState(!1),[Y,Se]=p.useState(null),Le=p.useRef(null),re=p.useRef(null),Ce=p.useRef(null),[Xe,Ue]=p.useState(null),{composerPortalTarget:ct}=lv();p.useEffect(()=>{const Ke=ha(Q,e.sessionId,ut=>ut.session.sessionId);Ke.length!==0&&U(ut=>{const vt=new Set(ut);let Te=!1;for(const _e of Ke)vt.has(_e)||(vt.add(_e),Te=!0);return Te?Array.from(vt):ut})},[e.sessionId,Q]),p.useEffect(()=>(d(e.sessionId,e.workspaceId),()=>{d(e.sessionId,null)}),[e.sessionId,e.workspaceId,d]),p.useEffect(()=>{let Ke=!1;return N(T),zl(e.provider,e.workspaceId).then(ut=>{Ke||N(ut)}).catch(()=>{}),()=>{Ke=!0}},[e.provider,e.workspaceId,T]),kA(re,Xe,!D,e.sessionId),xA(re,Ce,!D,e.sessionId);function Nt(Ke){c(Ke),t(Ni(Ke))}return n.jsx(n.Fragment,{children:n.jsxs("main",{ref:re,className:"workbench-page conversation-page-shell mobile-page-fixed-root mobile-conversation-page","data-mobile-shell":!D,"data-preview-mode":D?void 0:I.displayMode,"data-preview-dragging":D?void 0:I.isDragging,"data-workspace-tone":(se==null?void 0:se.tone)??"root","data-worktree-depth":(se==null?void 0:se.depth)??0,"data-tool-panel-open":D?void 0:A.isOpen,style:{...D?{}:I.pageStyle,...ai(se)??{}},children:[D?n.jsx(dA,{session:B,workspaceContext:se}):null,D?null:n.jsx(Kl,{containerRef:Ce,className:"mobile-conversation-page-header",gestureHandlers:R??void 0,currentWorkspace:J?{id:J.workspace.id,name:J.label,path:J.subtitle}:_[0]??null,workspaces:_,workspaceOptions:F,onSelectWorkspace:Nt,heading:X.fullTitle,trailing:n.jsx("span",{className:"mobile-conversation-toolbar-title",title:X.fullTitle,children:X.displayTitle})}),D?null:n.jsx(NA,{visible:!A.isOpen&&I.isVisible,widthPx:I.previewWidthPx,isDragging:I.isDragging,gestureHandlers:I.railGestureHandlers,activeSessionId:e.sessionId,createSessionActionLabel:o("shell.createSession"),favoriteItems:G,items:K,expandedRootIds:q,workspaceSectionLabel:(J==null?void 0:J.label)??o("shell.mobileConversationCurrentWorkspaceSection"),onCreateSession:()=>{g(e.workspaceId,e.provider)},archiveFolderActionLabel:W.length>0?o("shell.archiveFolderLabel"):void 0,onOpenArchiveFolder:W.length>0?()=>{pe(!0)}:void 0,onToggleSubsessions:Ke=>{U(ut=>ut.includes(Ke)?ut.filter(vt=>vt!==Ke):[...ut,Ke])},onActivate:Ke=>{I.closePreview(),c(Ke.workspace.id),t(Yn(Ke.workspace.id,Ke.session.sessionId))}}),n.jsx("div",{className:"mobile-conversation-stage",...R??{},children:n.jsxs("div",{ref:Le,className:"mobile-conversation-main",children:[n.jsx(MR,{connectionState:"closed",onReconnect:()=>{}}),n.jsx("div",{className:"conversation-timeline-shell",children:n.jsx(Im,{sessionId:e.sessionId,messages:y,historyState:"ready",loadingOlderMessages:!1,hasOlderMessages:!1,provider:e.provider,runtimeThinkingPlaceholder:null,onLoadOlderMessages:()=>{},onRetryMessage:()=>{}})}),A.isOpen?null:n.jsx(Nm,{capabilities:j,draftStorageId:e.sessionId,panelRef:D?void 0:Ue,portalContainer:D?null:ct,contextUsage:null,taskProvider:e.provider,taskMessages:y,isSubmitting:w,isRunning:!1,onSend:async(Ke,ut)=>{var _e,we,qe,ke;const vt=M9();S(Ee=>[...Ee,mR(e.sessionId,Ke,vt,(ut==null?void 0:ut.attachmentMeta)??[],(ut==null?void 0:ut.attachments)??[])]),k(!0);const Te=performance.now();Ft("session_send.start_live.client_start",{draftSessionId:e.sessionId,workspaceId:e.workspaceId,provider:e.provider,clientRequestId:vt,contentLength:Ke.length});try{const Ee=Ti.getState().profile.defaultPermissionMode,$e=await Dv({workspaceId:e.workspaceId,provider:e.provider,content:Ke,clientRequestId:vt,model:(ut==null?void 0:ut.model)??null,reasoningLevel:(ut==null?void 0:ut.reasoningLevel)??null,permissionMode:Ee==="default"?null:Ee,attachments:(ut==null?void 0:ut.attachments)??[]});Ft("session_send.start_live.client_response",{draftSessionId:e.sessionId,sessionId:$e.sessionId,workspaceId:((_e=$e.session)==null?void 0:_e.workspaceId)??e.workspaceId,provider:$e.provider,clientRequestId:vt,durationMs:Math.round(performance.now()-Te),returnedMessageId:((we=$e.message)==null?void 0:we.messageId)??null}),$e.session&&m($e.session);const wt=((ke=(qe=$e.session)==null?void 0:qe.workspaceId)==null?void 0:ke.trim())||e.workspaceId;d($e.sessionId,wt),Io("preview"),t(Yn(wt,$e.sessionId),{replace:!0,state:$e.message?{bootstrap:{sessionId:$e.sessionId,messages:[$e.message]}}:null}),l()}catch(Ee){throw Ft("session_send.start_live.client_error",{draftSessionId:e.sessionId,workspaceId:e.workspaceId,provider:e.provider,clientRequestId:vt,durationMs:Math.round(performance.now()-Te),error:Ee instanceof Error?Ee.message:String(Ee)}),S($e=>Sb($e,vt)),Ee}finally{k(!1)}}})]})}),D?null:n.jsx(jA,{activePanel:A.activePanel,open:A.isOpen,sessionId:e.sessionId,workspaceId:e.workspaceId,navigationGroups:i,onClose:()=>{A.closePanel()},onSelectPanel:Ke=>{A.selectPanel(Ke)},onSelectPanelBySwipe:Ke=>{if(Ke===null){A.closePanel();return}A.selectPanel(Ke)}}),n.jsx(DA,{open:ve,workspaceName:(P==null?void 0:P.workspace.name)??null,sessions:W,restoringSessionId:Y,onClose:()=>{Y||pe(!1)},onRestore:async Ke=>{Se(Ke);try{await v(Ke),H({title:o("shell.archiveRestored"),tone:"success"})}catch(ut){H({title:ut instanceof Error?ut.message:o("shell.navigationLoadFailed"),tone:"error"})}finally{Se(null)}}})]})})}function h9(e,t,r,s=null){var c,d;if(!D9(e))return null;const i=t??((c=r.get("workspaceId"))==null?void 0:c.trim())??null,l=((d=r.get("provider"))==null?void 0:d.trim())??s??null;return!i||!IP(l)?null:{sessionId:e,workspaceId:i,provider:l}}function m9(e){const t=new Date().toISOString();return{sessionId:e.sessionId,workspaceId:e.workspaceId,provider:e.provider,providerSessionId:`draft://${e.sessionId}`,rawStoreRef:`draft://${e.sessionId}`,parentSessionId:null,isSubagent:!1,subagentLabel:null,isArchived:!1,title:Y_(e.provider),messageCount:0,lastMessageAt:null,createdAt:t,updatedAt:t,syncStatus:"idle",syncCursor:null,lastSyncAt:null,lastErrorCode:null,lastErrorDetail:null,resumedAt:null,runningState:"idle",activitySource:"none",lastEventAt:null,completedAt:null,lastSeenAt:null,activityState:"idle"}}function p9(e){var t;return((t=e.parentSessionId)==null?void 0:t.trim())||null}function bA(e){const t=new Map(e.map(i=>[i.sessionId,i])),r=new Map,s=i=>{const l=r.get(i.sessionId);if(typeof l=="boolean")return l;if(i.isArchived)return r.set(i.sessionId,!1),!1;const c=p9(i);if(!c)return r.set(i.sessionId,!0),!0;const d=t.get(c);if(!d)return r.set(i.sessionId,!0),!0;const m=s(d);return r.set(i.sessionId,m),m};return e.filter(i=>s(i))}function vA(e,t,r){if(!t)return[];const s=pa(e,t);if(!s)return[];const i=bA(s.sessions).map(c=>({session:c,workspace:s.workspace}));return Vh(i).filter(c=>!r.has(c.item.session.sessionId)&&!pm(c.children,d=>r.has(d.session.sessionId)))}function wA(e,t){return e.filter(r=>!ba(r.session)).flatMap(r=>{const s=pa(t,r.workspace.id);if(!s)return[];const i=Vh(bA(s.sessions).map(c=>({session:c,workspace:s.workspace}))),l=yA(i,r.session.sessionId);return l?[l]:[]})}function yA(e,t){for(const r of e){if(r.item.session.sessionId===t)return r;const s=yA(r.children,t);if(s)return s}return null}function kA(e,t,r,s){p.useEffect(()=>{const i=e.current;if(!r||!i){i&&i.style.removeProperty("--mobile-conversation-composer-height");return}if(!t){i.style.removeProperty("--mobile-conversation-composer-height");return}const l=i,c=t;function d(){!e.current||!c.isConnected||l.style.setProperty("--mobile-conversation-composer-height",`${c.offsetHeight}px`)}d();const m=typeof ResizeObserver<"u"?new ResizeObserver(d):null;return m==null||m.observe(c),window.addEventListener("resize",d),()=>{m==null||m.disconnect(),window.removeEventListener("resize",d),i.style.removeProperty("--mobile-conversation-composer-height")}},[t,r,s,e])}function xA(e,t,r,s){p.useEffect(()=>{const i=e.current,l=t.current;if(!r||!i){i&&i.style.removeProperty("--mobile-conversation-page-header-height");return}if(!l){i.style.removeProperty("--mobile-conversation-page-header-height");return}const c=i,d=l;function m(){!e.current||!d.isConnected||c.style.setProperty("--mobile-conversation-page-header-height",`${d.offsetHeight}px`)}m();const f=typeof ResizeObserver<"u"?new ResizeObserver(m):null;return f==null||f.observe(d),window.addEventListener("resize",m),()=>{f==null||f.disconnect(),window.removeEventListener("resize",m),i.style.removeProperty("--mobile-conversation-page-header-height")}},[r,t,s,e])}function f9(e){return e==="files"||e==="git"||e==="processes"?e:null}function SA(...e){const t=e.filter(Boolean);return{onTouchStart(r){t.forEach(s=>s.onTouchStart(r))},onTouchMove(r){t.forEach(s=>s.onTouchMove(r))},onTouchEnd(r){t.forEach(s=>s.onTouchEnd(r))},onTouchCancel(r){t.forEach(s=>s.onTouchCancel(r))}}}function CA(e){const t=ui(),r=fr(),s=di(),i=p.useRef(null),[l,c]=p.useState(()=>e.initialPanel??Xj()),d=e.initialPanel??l,m=e.enabled&&e.workspaceId!==null&&e.initialPanel!==null;p.useEffect(()=>{if(!e.enabled){i.current=null;return}const N=e.initialPanel??Xj();c(N),Qj(N)},[e.enabled,e.initialPanel]);function f(N,D){const H=new URLSearchParams(t.search);N?(H.set("toolPanel",N),c(N),Qj(N)):H.delete("toolPanel");const B=H.toString();r({pathname:t.pathname,search:B?`?${B}`:""},{replace:(D==null?void 0:D.replace)??!1})}function v(N){s.trigger("selection"),f(N,{replace:m})}function g(){m&&(s.trigger("gesture"),f(null,{replace:!0}))}function w(N){if(!e.enabled||!e.workspaceId)return;const D=N??d;s.trigger("gesture"),f(D)}function k(N){if(!e.enabled||N.changedTouches.length!==1){i.current=null;return}if(g9(N.target)){i.current=null;return}const D=N.changedTouches[0];i.current={x:D.clientX,y:D.clientY}}function y(N){const D=i.current;if(i.current=null,!D||N.changedTouches.length!==1||m||e.suspendMainGesture)return;const H=N.changedTouches[0],B=H.clientX-D.x,I=H.clientY-D.y;B>-56||Math.abs(B)<=Math.abs(I)*1.15||w()}function S(N){const D=i.current;if(i.current=null,!D||N.changedTouches.length!==1||!m)return;const H=N.changedTouches[0],B=H.clientX-D.x,I=H.clientY-D.y;B<56||Math.abs(B)<=Math.abs(I)*1.15||g()}return{activePanel:d,closePanel:g,isOpen:m,mainGestureHandlers:{onTouchStart:k,onTouchMove:()=>{},onTouchEnd:y,onTouchCancel:()=>{i.current=null}},openPanel:w,panelGestureHandlers:{onTouchStart:k,onTouchMove:()=>{},onTouchEnd:S,onTouchCancel:()=>{i.current=null}},selectPanel:v}}function jA(e){const t=p.useRef(null);if(!e.open)return null;function r(i){if(i.changedTouches.length!==1){t.current=null;return}if(b9(i.target)){t.current=null;return}const l=i.changedTouches[0];t.current={x:l.clientX,y:l.clientY}}function s(i){const l=t.current;if(t.current=null,!l||i.changedTouches.length!==1)return;const c=i.changedTouches[0],d=c.clientX-l.x,m=c.clientY-l.y;if(Math.abs(d)<56||Math.abs(d)<=Math.abs(m)*1.15)return;const f=["files","git","processes"],v=f.indexOf(e.activePanel);if(d<0){e.onSelectPanelBySwipe(f[Math.min(f.length-1,v+1)]??e.activePanel);return}if(v===0){e.onSelectPanelBySwipe(null);return}e.onSelectPanelBySwipe(f[Math.max(0,v-1)]??e.activePanel)}return n.jsxs("section",{className:"mobile-conversation-tool-panel","data-panel":e.activePanel,onTouchStart:r,onTouchEnd:s,onTouchCancel:()=>{t.current=null},children:[n.jsxs("header",{className:"mobile-conversation-tool-panel-header","data-preview-gesture":"ignore",children:[n.jsx("button",{type:"button",className:"mobile-conversation-tool-panel-back","aria-label":o("shell.mobileConversationToolCloseAction"),title:o("shell.mobileConversationToolCloseAction"),onClick:e.onClose,children:n.jsx("span",{"aria-hidden":"true",children:"‹"})}),n.jsx("div",{className:"mobile-conversation-tool-panel-tabs",role:"tablist","aria-label":o("shell.mobileConversationToolTabsLabel"),children:["files","git","processes"].map(i=>n.jsx("button",{type:"button",role:"tab","aria-selected":e.activePanel===i,className:"mobile-conversation-tool-panel-tab",onClick:()=>{e.onSelectPanel(i)},children:o(i==="files"?"shell.filesEntry":i==="git"?"shell.gitEntry":"shell.mobileConversationToolProcessesTab")},i))})]}),n.jsx("div",{className:"mobile-conversation-tool-panel-body",children:e.activePanel==="files"?n.jsx(pw,{className:"mobile-conversation-tool-surface",hideHeading:!0,sessionId:e.sessionId,workspaceId:e.workspaceId}):e.activePanel==="git"?n.jsx(gw,{className:"mobile-conversation-tool-surface",panelActive:!0,workspaceId:e.workspaceId}):n.jsx(vw,{className:"mobile-conversation-tool-surface mobile-tool-native-panel mobile-tool-process-panel",currentWorkspaceId:e.workspaceId,navigationGroups:e.navigationGroups})})]})}function g9(e){return e instanceof Element?!!e.closest("input, textarea, select, option, label, button, a, [contenteditable='true'], [data-preview-gesture='ignore']"):!1}function b9(e){return e instanceof Element?!!e.closest("input, textarea, select, option, [contenteditable='true']"):!1}function TA(e){const t=di(),[r,s]=p.useState(()=>e?Pg():"immersive"),[i,l]=p.useState(()=>eT()),[c,d]=p.useState(()=>e&&Pg()==="preview"?"default":"closed"),m=p.useRef(c),f=p.useRef(null);p.useEffect(()=>{m.current=c},[c]),p.useEffect(()=>{if(!e){f.current=null,m.current="closed",d("closed"),s("immersive");return}const L=Pg();s(L),d(L==="preview"?"default":"closed")},[e]),p.useEffect(()=>{e&&Io(r)},[e,r]),p.useEffect(()=>{if(typeof window>"u")return;function L(){l(eT())}return L(),window.addEventListener("resize",L),()=>{window.removeEventListener("resize",L)}},[]);function v(L){m.current=L,d(L)}function g(L="default"){v(L),s("preview")}function w(){v("closed"),s("immersive")}function k(){v("expanded"),s("preview")}function y(){if(m.current!=="closed"){t.trigger("gesture"),w();return}t.trigger("gesture"),g()}function S(L,_){const F=_.touches[0]??_.changedTouches[0];if(!e||!F){f.current=null;return}if(w9(_.target)){f.current=null;return}if(L==="main"){if(m.current==="closed"&&F.clientX>s9){f.current=null;return}}else if(m.current==="closed"){f.current=null;return}f.current={source:L,intent:L==="rail"?"rail":m.current==="closed"?"open":"close",startX:F.clientX,startY:F.clientY,lastX:F.clientX,lastY:F.clientY,horizontalLocked:!1}}function T(L){const _=f.current,F=L.touches[0];if(!e||!_||!F)return;const te=F.clientX-_.startX,E=F.clientY-_.startY;if(_.lastX=F.clientX,_.lastY=F.clientY,!_.horizontalLocked){if(Math.abs(te)<Zj&&Math.abs(E)<Zj)return;if(Math.abs(te)<=Math.abs(E)){f.current=null;return}if(_.intent==="open"&&te<=0){f.current=null;return}if(_.intent==="close"&&te>=0){f.current=null;return}_.horizontalLocked=!0}}function j(L){var E;const _=f.current;if(f.current=null,!(_!=null&&_.horizontalLocked))return;const F=(E=L==null?void 0:L.changedTouches)==null?void 0:E[0];F&&(_.lastX=F.clientX,_.lastY=F.clientY);const te=_.lastX-_.startX;if(_.intent==="open"){te>=n9&&(t.trigger("gesture"),g("default"));return}if(_.intent==="close"){te<=-34&&(t.trigger("gesture"),w());return}if(te<=-34){t.trigger("gesture"),w();return}te>=r9&&m.current==="default"&&(t.trigger("gesture"),k())}const N=c==="expanded"?Dg:c==="default"?Jj:0,D=Math.round(i*N*100)/100,H=N===0?0:N/Dg,B={"--mobile-conversation-preview-default-width":`${Math.round(i*Jj*100)/100}px`,"--mobile-conversation-preview-max-width":`${Math.round(i*Dg*100)/100}px`,"--mobile-conversation-preview-width":`${D}px`,"--mobile-conversation-preview-progress":H.toFixed(4)};return{closePreview:w,displayMode:c==="closed"?"immersive":"preview",isDragging:!1,isVisible:c!=="closed",mainGestureHandlers:{onTouchStart:L=>S("main",L),onTouchMove:T,onTouchEnd:j,onTouchCancel:j},pageStyle:B,previewWidthPx:D,railGestureHandlers:{onTouchStart:L=>S("rail",L),onTouchMove:T,onTouchEnd:j,onTouchCancel:j},togglePreview:y}}function NA({visible:e,widthPx:t,isDragging:r,gestureHandlers:s,activeSessionId:i,createSessionActionLabel:l,favoriteItems:c,items:d,expandedRootIds:m,workspaceSectionLabel:f,onCreateSession:v,archiveCurrentActionLabel:g,archiveFolderActionLabel:w,onArchiveActiveSession:k,onOpenArchiveFolder:y,onToggleSubsessions:S,onActivate:T}){if(!e)return null;function j(N,D){const{workspaceName:H,ancestorExpanded:B=!1,ancestorHasNextSiblings:I=[],hasNextSibling:A=!1,isFirstSibling:L=!1}=D??{},_=N.item.session.sessionId,F=N.children,te=N.depth===0&&F.length>0,E=B||te&&m.includes(_),se=N.depth>0?[...I,A]:[...I];return n.jsxs("div",{className:"mobile-conversation-preview-tree-node",children:[n.jsxs("div",{className:"mobile-conversation-preview-tree-row",style:{"--mobile-preview-tree-depth":N.depth},children:[N.depth>0?n.jsxs("div",{className:"mobile-conversation-preview-guides","aria-hidden":"true",children:[I.map((X,K)=>X?n.jsx("span",{className:"mobile-conversation-preview-guide-column",style:{"--mobile-preview-tree-level":K+1}},`${_}:ancestor:${K}`):null),n.jsx("span",{className:"mobile-conversation-preview-guide-branch","data-continue":A,"data-first":L,style:{"--mobile-preview-tree-level":N.depth},children:n.jsx("span",{className:"mobile-conversation-preview-guide-branch-horizontal"})})]}):null,n.jsx(v9,{entry:N.item,activeSessionId:i,hasSubsessions:te,subsessionsExpanded:E,workspaceName:H,onToggleSubsessions:te?()=>{S(_)}:void 0,onActivate:T})]}),F.length>0&&E?n.jsx("div",{className:"mobile-conversation-preview-children",children:F.map((X,K)=>j(X,{workspaceName:H,ancestorExpanded:!0,ancestorHasNextSiblings:se,hasNextSibling:K<F.length-1,isFirstSibling:K===0}))}):null]},`${N.item.workspace.id}:${_}`)}return n.jsxs("aside",{className:"mobile-conversation-preview-rail terminal-mobile-list-rail surface-card","data-dragging":r,style:{width:`${t}px`,maxWidth:`${t}px`},...s,children:[l&&v?n.jsx("div",{className:"mobile-conversation-preview-topbar terminal-mobile-list-footer",children:n.jsxs("button",{type:"button",className:"mobile-conversation-preview-create-button workbench-import-toggle terminal-mobile-list-create",onClick:v,children:[n.jsx("span",{className:"workbench-import-toggle-symbol","aria-hidden":"true",children:"+"}),n.jsx("span",{className:"workbench-import-toggle-label",children:l})]})}):null,n.jsxs("div",{className:"mobile-conversation-preview-body terminal-mobile-list-body",children:[c.length>0?n.jsxs("section",{className:"mobile-conversation-preview-group mobile-conversation-preview-list-favorites terminal-mobile-list-group terminal-mobile-list-group-pinned",children:[n.jsxs("div",{className:"mobile-conversation-preview-group-heading terminal-mobile-list-group-heading",children:[n.jsx("span",{children:o("shell.favoriteSectionTitle")}),n.jsx("span",{className:"workbench-section-counter",children:c.length})]}),n.jsx("div",{className:"mobile-conversation-preview-list mobile-conversation-preview-list-static terminal-mobile-session-list",children:c.map(N=>n.jsx("div",{children:j(N,{workspaceName:N.item.workspace.name})},`favorite:${N.item.workspace.id}:${N.item.session.sessionId}`))})]}):null,n.jsxs("section",{className:"mobile-conversation-preview-group mobile-conversation-preview-group-workspace terminal-mobile-list-group terminal-mobile-list-group-workspace",children:[n.jsxs("div",{className:"mobile-conversation-preview-group-heading terminal-mobile-list-group-heading",children:[n.jsx("span",{children:f}),n.jsx("span",{className:"workbench-section-counter",children:d.length})]}),d.length===0?n.jsx("div",{className:"workbench-session-empty",children:o("shell.emptyWorkspaceSessions")}):n.jsx("div",{className:"mobile-conversation-preview-list terminal-mobile-session-list","data-preview-gesture":"ignore",children:d.map(N=>j(N))})]})]}),g&&k||w&&y?n.jsxs("div",{className:"mobile-conversation-preview-actions terminal-mobile-list-footer",children:[g&&k?n.jsx("button",{type:"button",className:"mobile-conversation-preview-archive-button workbench-import-toggle",onClick:()=>{k()},children:g}):null,w&&y?n.jsx("button",{type:"button",className:"mobile-conversation-preview-archive-button workbench-import-toggle",onClick:y,children:w}):null]}):null]})}function v9({entry:e,activeSessionId:t,hasSubsessions:r=!1,subsessionsExpanded:s=!1,onActivate:i,onToggleSubsessions:l,workspaceName:c}){const d=e.session.sessionId===t;return n.jsxs("article",{className:"mobile-conversation-preview-entry terminal-mobile-session-card","data-active":d,children:[r?n.jsx("button",{type:"button",className:"mobile-conversation-preview-toggle","aria-label":o(s?"shell.subagentCollapse":"shell.subagentExpand"),title:o(s?"shell.subagentCollapse":"shell.subagentExpand"),"aria-expanded":s,onClick:m=>{m.stopPropagation(),l==null||l()},children:n.jsx("span",{className:tT(e.session,{isActive:d,hasSubsessions:r}),"aria-hidden":"true"})}):n.jsx("span",{className:tT(e.session,{isActive:d,hasSubsessions:r}),"aria-hidden":"true"}),n.jsx("button",{type:"button",className:"mobile-conversation-preview-item terminal-mobile-session-primary","data-active":d,onClick:()=>i(e),children:n.jsxs("div",{className:"mobile-conversation-preview-item-body",children:[n.jsx("span",{className:"mobile-conversation-preview-item-title",children:e.session.title||o("common.unknown")}),n.jsx("span",{className:"mobile-conversation-preview-item-meta",children:PA(e.session,c)})]})})]})}function eT(){return typeof window>"u"?390:Math.max(window.innerWidth||390,320)}function w9(e){return e instanceof Element?!!e.closest("input, textarea, select, option, label, [contenteditable='true'], [data-preview-gesture='ignore']"):!1}function tT(e,t){const r=Av("mobile-conversation-preview-indicator",e,{hasSubagents:t.hasSubsessions});return r.endsWith(" is-idle")&&t.isActive?"mobile-conversation-preview-indicator is-active":r}function PA(e,t){const r=au(e);return[t??null,Vs(e.provider),y9(e.lastMessageAt??e.updatedAt),r].filter(Boolean).join(" · ")}function y9(e){return e?new Date(e).toLocaleString(void 0,{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}):o("common.unknown")}function k9({open:e,busy:t,onClose:r,onConfirm:s}){return p.useEffect(()=>{if(!e)return;function i(l){l.key==="Escape"&&!t&&r()}return window.addEventListener("keydown",i),()=>{window.removeEventListener("keydown",i)}},[t,r,e]),!e||typeof document>"u"?null:Vn.createPortal(n.jsxs("div",{className:"workbench-modal-layer",children:[n.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":o("common.close"),disabled:t,onClick:r}),n.jsxs("section",{className:"workbench-modal-card surface-card",role:"dialog","aria-modal":"true","aria-label":o("shell.archiveConfirmTitle"),children:[n.jsx("div",{className:"workbench-modal-header",children:n.jsxs("div",{className:"workbench-modal-title-wrap",children:[n.jsx("h2",{children:o("shell.archiveConfirmTitle")}),n.jsx("p",{children:o("shell.archiveConfirmDescription")})]})}),n.jsx("div",{className:"workbench-modal-body",children:n.jsxs("div",{className:"workbench-modal-actions",children:[n.jsx("button",{type:"button",className:"secondary-button",disabled:t,onClick:r,children:o("common.cancel")}),n.jsx("button",{type:"button",className:"secondary-button workbench-danger-button",disabled:t,onClick:()=>{s()},children:o("shell.archiveAction")})]})})]})]}),document.body)}function DA({open:e,workspaceName:t,sessions:r,restoringSessionId:s,onClose:i,onRestore:l}){return p.useEffect(()=>{if(!e)return;function c(d){d.key==="Escape"&&!s&&i()}return window.addEventListener("keydown",c),()=>{window.removeEventListener("keydown",c)}},[i,e,s]),!e||typeof document>"u"?null:Vn.createPortal(n.jsxs("div",{className:"workbench-modal-layer",children:[n.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":o("common.close"),disabled:!!s,onClick:i}),n.jsxs("section",{className:"workbench-modal-card surface-card",role:"dialog","aria-modal":"true","aria-label":o("shell.archiveModalTitle"),children:[n.jsx("div",{className:"workbench-modal-header",children:n.jsxs("div",{className:"workbench-modal-title-wrap",children:[n.jsx("h2",{children:o("shell.archiveModalTitle")}),n.jsx("p",{children:t?`${t} · ${o("shell.archiveModalDescription")}`:o("shell.archiveModalDescription")})]})}),n.jsx("div",{className:"workbench-modal-body",children:r.length>0?n.jsx("div",{className:"workbench-archive-list",children:r.map(c=>{const d=Ki(c.title,o("common.unknown"));return n.jsxs("article",{className:"workbench-archive-item",children:[n.jsxs("div",{className:"workbench-archive-item-main",children:[n.jsx("strong",{title:d.fullTitle,children:d.displayTitle}),n.jsx("p",{children:PA(c)})]}),n.jsx("button",{type:"button",className:"secondary-button",disabled:s===c.sessionId,onClick:()=>{l(c.sessionId)},children:o("shell.unarchiveAction")})]},c.sessionId)})}):n.jsx("p",{className:"workbench-section-empty",children:o("shell.archiveEmpty")})})]})]}),document.body)}function x9(e){return n.jsx("button",{type:"button",className:"conversation-header-ai-button","aria-label":o("conversation.branchTreeAction"),title:o("conversation.branchTreeAction"),onClick:e.onOpenBranchTree,children:n.jsx("span",{className:"conversation-header-ai-button-label","aria-hidden":"true",children:n.jsx(BD,{})})})}function S9(e){return e?e.activityState==="running"?!0:e.runningState==="starting"||e.runningState==="running"||e.runningState==="reconnecting":!1}function C9(e){const t=j9(e),[r,s]=p.useState(t==="show"),i=p.useRef(null);return p.useEffect(()=>{i.current!==null&&(window.clearTimeout(i.current),i.current=null),s(t==="show")},[e.sessionId]),p.useEffect(()=>{if(t==="show"){i.current!==null&&(window.clearTimeout(i.current),i.current=null),s(!0);return}if(t==="hide_immediately"){i.current!==null&&(window.clearTimeout(i.current),i.current=null),s(!1);return}!r||i.current!==null||(i.current=window.setTimeout(()=>{i.current=null,s(!1)},i9))},[t,r]),p.useEffect(()=>()=>{i.current!==null&&window.clearTimeout(i.current)},[]),r}function j9(e){const{provider:t,runningState:r,activityState:s,runtimeHasActiveRun:i,messages:l}=e;if(t!=="codex")return"hide_immediately";const c=P9(l);return c<0||N9(l,c)?"hide_immediately":T9(r,s,i)?"show":"hide_deferred"}function T9(e,t,r){return r===!0||t==="running"||e==="starting"||e==="running"||e==="reconnecting"}function N9(e,t){return e.slice(t+1).some(r=>r.role==="assistant"&&(r.kind==="text"||r.kind==="thinking"))}function P9(e){let t=-1;for(let r=e.length-1;r>=0;r-=1){const s=e[r];if(s.role==="user"&&s.kind==="text"){t=r;break}}return t}function D9(e){return e.startsWith("draft-")}function R9(e,t){if(!t||typeof t!="object")return[];const r=t.bootstrap;if(!r||typeof r!="object")return[];const s=r.sessionId,i=r.messages;return s!==e||!Array.isArray(i)?[]:i.filter(A9)}function A9(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.messageId=="string"&&typeof t.provider=="string"&&typeof t.providerSessionId=="string"&&typeof t.role=="string"&&typeof t.content=="string"&&typeof t.timestamp=="string"&&typeof t.sequence=="number"&&typeof t.rawRef=="string"}function M9(){const e=globalThis.crypto;return e&&typeof e.randomUUID=="function"?e.randomUUID():`${Date.now()}-${Math.random().toString(16).slice(2)}`}function I9(e,t){var i;if(!e||e.forkSourceType!=="message"||typeof e.inheritedPrefixMessageCount!="number"||e.inheritedPrefixMessageCount<0)return t;const r=((i=e.createdAt)==null?void 0:i.trim())||"";if(r.length===0)return t;const s=Math.max(0,e.inheritedPrefixMessageCount);return t.filter(l=>l.sequence<=s?!0:l.timestamp>=r)}function E9(){return p.useEffect(()=>{const e=document.documentElement.style.background,t=document.body.style.background;return document.documentElement.style.background="transparent",document.body.style.background="transparent",()=>{document.documentElement.style.background=e,document.body.style.background=t}},[]),n.jsx("main",{className:"desktop-detach-preview-page","aria-hidden":"true",children:n.jsxs("section",{className:"desktop-detach-preview-card",children:[n.jsx("header",{className:"desktop-detach-preview-bar",children:n.jsx("strong",{className:"desktop-detach-preview-title",children:"小窗口"})}),n.jsx("div",{className:"desktop-detach-preview-body",children:n.jsx("span",{className:"desktop-detach-preview-badge"})})]})})}function L9(e){return{navigationGroups:e,subscribeFileTree:()=>{},requestFileTreeRefresh:()=>{},addFileTreeSnapshotListener:()=>()=>{},subscribeGitSnapshot:()=>{},requestGitRefresh:()=>{},addGitSnapshotListener:()=>()=>{}}}function F9(){return{subscribeGitSnapshot:()=>{},requestGitRefresh:()=>{},addGitSnapshotListener:()=>()=>{}}}function _9(){return{subscribeTerminalManagerSnapshot:()=>{},requestTerminalManagerRefresh:()=>{},addTerminalManagerSnapshotListener:()=>()=>{}}}function O9(e){return e.kind==="files"?o("shell.filesEntry"):e.kind==="git"?o("shell.gitEntry"):e.kind==="processes"?o("shell.terminalManagerEntry"):e.kind}function B9(){const{windowId:e}=Ho(),t=fr(),r=sr(),s=ci(N=>N.sessionDisplaySortMode),[i,l]=p.useState(null),[c,d]=p.useState(!0),[m,f]=p.useState(null),[v,g]=p.useState([]),[w,k]=p.useState(null);p.useEffect(()=>{let N=!1;async function D(){if(!e){l(null),d(!1),f(o("desktopWindow.invalidWindowId"));return}d(!0),f(null);const H=await r.bridge.getWindowDescriptor(e),B=H.ok?H.value??null:r.windows.getDescriptor(e);if(!N){if(!B){l(null),d(!1),f(H.detail??o("desktopWindow.loadDescriptorFailed"));return}r.windows.registerDescriptor(B),r.windows.markWindowOpen(B.windowId),l(B),d(!1)}}return D(),()=>{N=!0}},[r,e]),p.useEffect(()=>{if(!(i!=null&&i.workspaceId)){g([]);return}let N=!1;async function D(){try{const H=await vP();if(N)return;g(ou(H,s))}catch{if(N)return;g([])}}return D(),()=>{N=!0}},[i==null?void 0:i.workspaceId,s]),p.useEffect(()=>{if(!i){k(null);return}const N=new aP({onConnectionChange:()=>{},onSnapshot:D=>{g(ou(D,s))},onUnauthorized:()=>{nr.clear(),t(`/login?returnTo=${encodeURIComponent(`/desktop-window/${i.windowId}`)}`,{replace:!0})}});return k(N),N.start(),()=>{N.close(),k(null)}},[i,t,s]);const y=p.useMemo(()=>w?{navigationGroups:v,subscribeFileTree:w.subscribeFileTree.bind(w),requestFileTreeRefresh:w.requestFileTreeRefresh.bind(w),addFileTreeSnapshotListener:w.addFileTreeSnapshotListener.bind(w),subscribeGitSnapshot:w.subscribeGit.bind(w),requestGitRefresh:w.requestGitRefresh.bind(w),addGitSnapshotListener:w.addGitSnapshotListener.bind(w)}:L9(v),[v,w]),S=p.useMemo(()=>w?{subscribeGitSnapshot:w.subscribeGit.bind(w),requestGitRefresh:w.requestGitRefresh.bind(w),addGitSnapshotListener:w.addGitSnapshotListener.bind(w)}:F9(),[w]),T=p.useMemo(()=>w?{subscribeTerminalManagerSnapshot:w.subscribeTerminalManager.bind(w),requestTerminalManagerRefresh:w.requestTerminalManagerRefresh.bind(w),addTerminalManagerSnapshotListener:w.addTerminalManagerSnapshotListener.bind(w)}:_9(),[w]);if(!r.isDesktop)return n.jsx(eo,{to:"/",replace:!0});if(c)return n.jsx("main",{className:"desktop-window-page",children:n.jsx("p",{className:"status-text",children:o("common.loading")})});if(m)return n.jsx("main",{className:"desktop-window-page",children:n.jsx("p",{className:"status-text",children:m})});if(!i)return n.jsx("main",{className:"desktop-window-page",children:n.jsx("p",{className:"status-text",children:o("desktopWindow.loadDescriptorFailed")})});let j=null;return i.kind==="files"?j=n.jsx(pw,{sessionId:i.sessionId,workspaceId:i.workspaceId,externalWindowMode:!0,workbenchShellOverrides:y}):i.kind==="git"?j=n.jsx(gw,{workspaceId:i.workspaceId,externalWindowMode:!0,workbenchShellOverrides:S}):i.kind==="processes"&&(j=n.jsx(vw,{currentWorkspaceId:i.workspaceId,navigationGroups:v,externalWindowMode:!0,workbenchShellOverrides:T})),j?n.jsx("main",{className:"desktop-window-page",children:n.jsx("div",{className:"desktop-window-body","data-window-kind":i.kind,"aria-label":O9(i),children:j})}):n.jsx("main",{className:"desktop-window-page",children:n.jsx("p",{className:"status-text",children:o("desktopWindow.unsupportedKind",{kind:i.kind})})})}function ww({open:e,workspaces:t,workspaceOptions:r,initialWorkspaceId:s,onClose:i,onSelect:l}){const[c,d]=p.useState(""),[m,f]=p.useState(!1),v=di(),g=p.useMemo(()=>r??t.map(y=>({workspace:y,label:y.name,subtitle:y.path,depth:0,kind:"workspace",meta:null})),[r,t]),w=p.useMemo(()=>g.map(y=>y.workspace.id).join("|"),[g]);if(p.useEffect(()=>{e&&(d(W9(g,s)),f(!1))},[s,e,w]),!e||typeof document>"u")return null;const k=g.find(y=>y.workspace.id===c)??g[0]??null;return Vn.createPortal(n.jsx("div",{className:"ios-action-sheet-overlay",role:"presentation",onClick:i,children:n.jsxs("div",{className:"mobile-workspace-home-sheet",role:"dialog","aria-modal":"true","aria-label":o("shell.createSessionModalTitle"),onClick:y=>y.stopPropagation(),children:[n.jsxs("div",{className:"mobile-workspace-home-sheet-card",children:[n.jsx("div",{className:"mobile-workspace-home-sheet-header",children:n.jsx("strong",{children:o("shell.createSessionModalTitle")})}),n.jsxs("div",{className:"mobile-feature-form mobile-workspace-home-form mobile-create-session-form",children:[n.jsx("p",{className:"mobile-create-session-description",children:o("shell.createSessionModalDescription")}),n.jsxs("div",{className:"mobile-feature-field",children:[n.jsx("span",{children:o("shell.createSessionWorkspaceLabel")}),n.jsxs("button",{type:"button",className:"mobile-create-session-workspace-trigger","aria-label":`${o("shell.createSessionWorkspaceLabel")} ${(k==null?void 0:k.label)??""}`.trim(),"aria-expanded":m?"true":"false",disabled:g.length===0,onClick:()=>{v.trigger("selection"),f(y=>!y)},children:[n.jsxs("span",{className:"mobile-create-session-workspace-copy",children:[n.jsx("strong",{children:(k==null?void 0:k.label)??o("common.unknown")}),n.jsx("span",{children:(k==null?void 0:k.subtitle)??o("common.unknown")})]}),n.jsx(U9,{expanded:m})]}),m?n.jsx("div",{className:"mobile-workspace-home-group mobile-create-session-workspace-list",role:"list",children:g.map(y=>n.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-create-session-workspace-row","data-worktree-kind":y.kind,"data-worktree-depth":y.depth,onClick:()=>{y.workspace.id!==c&&v.trigger("selection"),d(y.workspace.id),f(!1)},children:[n.jsxs("span",{className:"mobile-create-session-workspace-option-copy",style:{"--mobile-workspace-tree-depth":String(y.depth)},children:[n.jsxs("strong",{children:[y.kind==="worktree"?n.jsx("span",{className:"mobile-workspace-home-worktree-badge",children:o("shell.mobileWorktreeBadge")}):null,y.label]}),n.jsx("span",{children:y.subtitle})]}),n.jsx("span",{className:"mobile-workspace-home-row-trailing",children:y.workspace.id===c?n.jsx(z9,{}):n.jsx(H9,{})})]},y.workspace.id))}):null]}),n.jsxs("div",{className:"mobile-create-session-provider-block",children:[n.jsxs("div",{className:"mobile-create-session-provider-header",children:[n.jsx("span",{className:"mobile-create-session-provider-label",children:o("shell.createSessionProviderLabel")}),n.jsx("span",{className:"mobile-create-session-provider-hint",children:o("shell.providerOptionHint")})]}),n.jsx(_v,{disabled:!c,workspaceId:c||null,onSelect:y=>{c&&l(c,y)}})]})]})]}),n.jsx("button",{type:"button",className:"ios-action-sheet-cancel",onClick:i,children:o("common.cancel")})]})}),document.body)}function W9(e,t){var r;return t&&e.some(s=>s.workspace.id===t)?t:((r=e[0])==null?void 0:r.workspace.id)??""}function U9({expanded:e}){return n.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",className:"mobile-create-session-workspace-chevron","data-expanded":e?"true":"false",children:n.jsx("path",{d:"M4 6.5L8 10l4-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function H9(){return n.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:n.jsx("path",{d:"M6 3.5L10.5 8 6 12.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function z9(){return n.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:n.jsx("path",{d:"M3.5 8.5L6.5 11.5L12.5 5.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.8"})})}const q9=420,$9=156;function V9({entry:e,isFavorite:t,isActive:r=!1,depth:s=0,variant:i="default",workspaceTone:l="root",hasSubsessions:c=!1,subsessionsExpanded:d=!1,showActions:m=!0,onActivate:f,onToggleSubsessions:v,onToggleFavorite:g,onArchive:w,onUnarchive:k,onRename:y}){const[S,T]=p.useState(!1),[j,N]=p.useState(null),[D,H]=p.useState(null),B=p.useRef(null),I=p.useRef(!1),A=p.useRef(null),L=di(),{session:_,workspace:F}=e,te=_.title??_.sessionId,E=Vs(_.provider),se=[E,G9(_.lastMessageAt??_.updatedAt??null),au(_)].filter(Boolean).join(" · "),X=Y9(_),K=X?X9(X):null,G=i==="mobile"?null:au(_),q=G?OP("session-list-activity-badge",_):null;p.useEffect(()=>()=>{P()},[]),p.useLayoutEffect(()=>{if(!S||!D||typeof window>"u"){N(null);return}const re=()=>{var ct,Nt;const Ue=zP(D,{width:((ct=A.current)==null?void 0:ct.offsetWidth)??0,height:((Nt=A.current)==null?void 0:Nt.offsetHeight)??0},{width:window.innerWidth,height:window.innerHeight},{estimatedHeightPx:$9});N({position:"fixed",left:`${Math.round(Ue.left)}px`,top:`${Math.round(Ue.top)}px`,width:`${Math.round(Ue.width)}px`,maxWidth:"calc(100vw - 24px)",maxHeight:`${Math.round(Ue.maxHeight)}px`,transformOrigin:Ue.transformOrigin})},Ce=Ue=>{var Nt;const ct=Ue.target;ct&&!((Nt=A.current)!=null&&Nt.contains(ct))&&Q()},Xe=Ue=>{Ue.key==="Escape"&&Q()};return re(),window.addEventListener("pointerdown",Ce),window.addEventListener("keydown",Xe),window.addEventListener("resize",re),window.addEventListener("scroll",re,!0),()=>{window.removeEventListener("pointerdown",Ce),window.removeEventListener("keydown",Xe),window.removeEventListener("resize",re),window.removeEventListener("scroll",re,!0)}},[D,S]);function U(re){H(re),T(!0)}function Q(){T(!1),H(null)}function P(){B.current!==null&&(window.clearTimeout(B.current),B.current=null)}function W(re){if(!m||re.pointerType==="mouse")return;const Ce={x:re.clientX,y:re.clientY};P(),B.current=window.setTimeout(()=>{I.current=!0,L.trigger("gesture"),U(Ce)},q9)}function J(){P()}function R(){if(I.current){I.current=!1;return}L.trigger("selection"),f(_.sessionId)}const ve=async()=>{const re=window.prompt(o("shell.renameModalDescription"),te);re&&(await y(_.sessionId,re.trim()),Q())},pe=async()=>{if(_.isArchived){await k(_.sessionId),Q();return}await w(_.sessionId),Q()},Y=()=>{g(_.sessionId),Q()},Se=re=>{if(re.key!=="ContextMenu"&&!(re.shiftKey&&re.key==="F10"))return;re.preventDefault(),re.stopPropagation();const Ce=re.currentTarget.getBoundingClientRect();U({x:Ce.right,y:Ce.bottom})},Le=S&&typeof document<"u"?Vn.createPortal(n.jsxs("div",{ref:A,className:"session-action-menu surface-card",role:"menu","aria-label":o("shell.sessionMoreAction"),style:j??{position:"fixed",top:0,left:0,visibility:"hidden"},onClick:re=>re.stopPropagation(),children:[n.jsx("button",{type:"button",className:"session-action-menu-item",role:"menuitem",onClick:Y,children:o(t?"shell.unfavoriteAction":"shell.favoriteAction")}),n.jsx("button",{type:"button",className:"session-action-menu-item",role:"menuitem",onClick:()=>void pe(),children:_.isArchived?o("shell.unarchiveAction"):o("shell.archiveAction")}),n.jsx("button",{type:"button",className:"session-action-menu-item",role:"menuitem",onClick:()=>void ve(),children:o("shell.renameAction")})]}),document.body):null;return n.jsxs("article",{className:"session-list-item","data-depth":s,"data-active":r,"data-workspace-tone":l,"data-has-subsessions":c,"data-variant":i,onContextMenu:re=>{m&&(re.preventDefault(),re.stopPropagation(),U({x:re.clientX,y:re.clientY}))},children:[c?n.jsx("button",{type:"button",className:"session-list-subsession-toggle","aria-label":o(d?"shell.subagentCollapse":"shell.subagentExpand"),title:o(d?"shell.subagentCollapse":"shell.subagentExpand"),"aria-expanded":d,onClick:re=>{re.stopPropagation(),L.trigger("selection"),v==null||v()},children:n.jsx("span",{className:nT(_,{isActive:r,hasSubsessions:c}),"aria-hidden":"true"})}):n.jsx("span",{className:nT(_,{isActive:r,hasSubsessions:c}),"aria-hidden":"true"}),n.jsx("button",{type:"button",className:"session-list-link",onClick:R,onPointerDown:W,onPointerUp:J,onPointerCancel:J,onPointerLeave:J,onKeyDown:Se,children:n.jsxs("div",{className:"session-list-copy",children:[n.jsx("div",{className:"session-list-title",children:te||o("shell.searchEntry")}),n.jsx("div",{className:"session-list-meta",children:i==="mobile"?n.jsx("span",{children:se}):n.jsxs(n.Fragment,{children:[n.jsx("span",{children:F.name}),G&&q?n.jsxs(n.Fragment,{children:[n.jsx("span",{"aria-hidden":"true",children:"·"}),n.jsx("span",{className:q,children:G})]}):null,n.jsx("span",{"aria-hidden":"true",children:"·"}),n.jsx("span",{children:E})]})}),K?n.jsx("div",{className:"session-list-error",title:X??void 0,children:K}):null]})}),Le]})}function nT(e,t){return Av("session-list-indicator",e,{isActive:t.isActive,hasSubagents:t.hasSubsessions})}function G9(e){return e?new Date(e).toLocaleString(void 0,{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}):o("common.unknown")}function K9(e){return Du(e)||e.syncStatus==="error"}function Y9(e){var s,i;if(!K9(e))return null;const t=((s=e.lastErrorCode)==null?void 0:s.trim())??"",r=((i=e.lastErrorDetail)==null?void 0:i.replace(/\s+/g," ").trim())??"";return t&&r&&!r.includes(t)?`${t} · ${r}`:r||t||(e.syncStatus==="error"&&!Du(e)?o("conversation.syncStatusError"):o("conversation.runtimeErrorTitle"))}function X9(e,t=96){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1)).trimEnd()}…`}const dh=5;function Q9(){var pe;const e=fr(),{navigationGroups:t,favoriteSessionIds:r,currentWorkspaceId:s,currentSessionId:i,navigationLoading:l,selectWorkspace:c,toggleFavoriteSession:d,archiveSession:m,unarchiveSession:f,renameSession:v,startDraftSession:g}=Mr(),w=Gl(t),k=p.useMemo(()=>vm(t),[t]),y=pa(t,s)??pa(t,((pe=t[0])==null?void 0:pe.workspace.id)??null),S=w.find(Y=>Y.workspace.id===(y==null?void 0:y.workspace.id))??(y?{workspace:y.workspace,label:y.workspace.name,subtitle:y.workspace.path}:null),T=p.useMemo(()=>new Set(r),[r]),j=p.useMemo(()=>y?y.sessions.filter(Y=>{var re;if(Y.isArchived)return!1;const Se=((re=Y.parentSessionId)==null?void 0:re.trim())||null;if(!Se)return!0;const Le=y.sessions.find(Ce=>Ce.sessionId===Se);return!Le||!Le.isArchived}).map(Y=>({session:Y,workspace:y.workspace})):[],[y]),N=p.useMemo(()=>j.filter(Y=>T.has(Y.session.sessionId)),[j,T]),D=p.useMemo(()=>Vh(j),[j]),H=p.useMemo(()=>Vh(N),[N]),B=p.useMemo(()=>y?y.sessions.filter(Y=>Y.isArchived===!0&&!ba(Y)):[],[y]),I=(y==null?void 0:y.workspace.id)??"",A=!!I,[L,_]=p.useState([]),[F,te]=p.useState({}),[E,se]=p.useState(!1),[X,K]=p.useState(!1),[G,q]=p.useState(null);p.useEffect(()=>{te(Y=>{const Se={};for(const Le of D){const re=li(Gi(Le));if(re.length===0)continue;const Ce=re.findIndex(Xe=>Xe.item.session.sessionId===i);Se[Le.item.session.sessionId]=nK(re.length,dh,Y[Le.item.session.sessionId],Ce)}return rK(Y,Se)?Y:Se})},[i,D]),p.useEffect(()=>{if(!i)return;const Y=ha(D,i,Se=>Se.session.sessionId);Y.length!==0&&_(Se=>{const Le=new Set(Se);let re=!1;for(const Ce of Y)Le.has(Ce)||(Le.add(Ce),re=!0);return re?Array.from(Le):Se})},[i,D]);function U(Y){_(Se=>Se.includes(Y)?Se.filter(Le=>Le!==Y):[...Se,Y])}function Q(Y){return F[Y]??dh}function P(Y){te(Se=>({...Se,[Y]:(Se[Y]??dh)+dh}))}function W(Y,Se){Io("immersive"),e(Yn(Y,Se))}function J(Y,Se){se(!1),Io("immersive"),g(Y,Se)}async function R(Y){q(Y);try{await f(Y)}finally{q(Se=>Se===Y?null:Se)}}function ve(Y,Se=!1,Le=[],re=!1,Ce=!1){var ke;const Xe=Y.item.session.sessionId,Ue=Y.children,ct=Y.depth===0&&Ue.length>0,Nt=Se||ct&&L.includes(Xe),Ke=Nt&&ct,ut=Ke?tK(Y,Q(Xe)):Y,vt=Nt?ut.children:[],Te=li(Ue).length,_e=li(vt).length,we=Ke&&_e<Te,qe=Y.depth>0?[...Le,re]:[...Le];return n.jsxs("div",{className:"session-list-tree-node",children:[n.jsxs("div",{className:"session-list-tree-row",style:{"--session-tree-depth":Y.depth},children:[Y.depth>0?n.jsxs("div",{className:"session-tree-guides","aria-hidden":"true",style:{"--session-tree-depth":Y.depth},children:[Le.map((Ee,$e)=>Ee?n.jsx("span",{className:"session-tree-guide-column",style:{"--session-tree-level":$e+1}},`${Xe}:ancestor:${$e}`):null),n.jsx("span",{className:"session-tree-guide-branch","data-continue":re,"data-first":Ce,style:{"--session-tree-level":Y.depth},children:n.jsx("span",{className:"session-tree-guide-branch-horizontal"})})]}):null,n.jsx(V9,{entry:Y.item,isFavorite:T.has(Xe),isActive:i===Xe,depth:Y.depth,variant:"mobile",workspaceTone:((ke=k[Y.item.workspace.id])==null?void 0:ke.tone)??"root",hasSubsessions:ct,subsessionsExpanded:Nt,onActivate:Ee=>W(Y.item.workspace.id,Ee),onToggleSubsessions:ct?()=>U(Xe):void 0,onToggleFavorite:Ee=>{d(Ee)},onArchive:Ee=>m(Ee),onUnarchive:Ee=>f(Ee),onRename:(Ee,$e)=>v(Ee,$e)})]}),Nt&&vt.length>0?n.jsx("div",{className:"session-list-children",children:vt.map((Ee,$e)=>ve(Ee,!0,qe,$e<vt.length-1,$e===0))}):null,we?n.jsx("div",{className:"session-list-children",children:n.jsx("button",{type:"button",className:"secondary-button",onClick:()=>P(Xe),children:o("shell.subagentExpandMore")})}):null]},`${Y.item.workspace.id}:${Xe}`)}return n.jsxs("main",{className:"session-index-page mobile-feature-page mobile-page-scroll-root mobile-page-with-top-header",children:[n.jsx(Kl,{currentWorkspace:S?{id:S.workspace.id,name:S.label,path:S.subtitle}:null,workspaces:t.map(Y=>Y.workspace),workspaceOptions:w,onSelectWorkspace:Y=>{c(Y),e(Ni(Y))},content:n.jsx("button",{type:"button",className:"primary-button mobile-session-index-create-button",disabled:l||!A,onClick:()=>se(!0),children:o("shell.createSession")})}),n.jsxs("div",{className:"mobile-page-top-body",children:[n.jsx("div",{className:"session-index-archive-actions",children:n.jsxs("button",{type:"button",className:"primary-button mobile-session-index-create-button session-index-archive-button",disabled:l||!y,onClick:()=>K(!0),children:[n.jsx("span",{children:o("shell.archiveViewAction")}),n.jsx("span",{className:"session-index-archive-count",children:B.length})]})}),H.length>0?n.jsxs("section",{className:"session-section session-section-sheet",children:[n.jsxs("header",{className:"session-section-heading",children:[n.jsx("div",{children:n.jsx("h2",{children:o("shell.favoriteSectionTitle")})}),n.jsx("span",{className:"session-section-count",children:N.length})]}),n.jsx("div",{className:"session-current-workspace-list",children:H.map(Y=>ve(Y))})]}):null,n.jsxs("section",{className:"session-section session-section-sheet",children:[n.jsxs("header",{className:"session-section-heading",children:[n.jsx("div",{children:n.jsx("h2",{children:o("shell.mobileConversationCurrentWorkspaceSection")})}),n.jsx("span",{className:"session-section-count",children:D.length})]}),D.length===0?n.jsx("p",{className:"session-section-empty",children:o(l?"shell.searchSessionHint":"shell.emptyWorkspaceSessions")}):n.jsx("div",{className:"session-current-workspace-list",children:D.map(Y=>ve(Y))})]})]}),n.jsx(ww,{open:E,workspaces:t.map(Y=>Y.workspace),workspaceOptions:w,initialWorkspaceId:s??I,onClose:()=>se(!1),onSelect:J}),n.jsx(J9,{open:X,workspaceName:(S==null?void 0:S.label)??(y==null?void 0:y.workspace.name)??null,sessions:B,restoringSessionId:G,onClose:()=>{G||K(!1)},onRestore:Y=>void R(Y)})]})}function J9({open:e,workspaceName:t,sessions:r,restoringSessionId:s,onClose:i,onRestore:l}){return p.useEffect(()=>{if(!e)return;function c(d){d.key==="Escape"&&!s&&i()}return window.addEventListener("keydown",c),()=>{window.removeEventListener("keydown",c)}},[i,e,s]),!e||typeof document>"u"?null:Vn.createPortal(n.jsxs("div",{className:"workbench-modal-layer",children:[n.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":o("common.close"),disabled:!!s,onClick:i}),n.jsxs("section",{className:"workbench-modal-card surface-card",role:"dialog","aria-modal":"true","aria-label":o("shell.archiveModalTitle"),children:[n.jsx("div",{className:"workbench-modal-header",children:n.jsxs("div",{className:"workbench-modal-title-wrap",children:[n.jsx("h2",{children:o("shell.archiveModalTitle")}),n.jsx("p",{children:t?`${t} · ${o("shell.archiveModalDescription")}`:o("shell.archiveModalDescription")})]})}),n.jsx("div",{className:"workbench-modal-body",children:r.length>0?n.jsx("div",{className:"workbench-archive-list",children:r.map(c=>n.jsxs("article",{className:"workbench-archive-item",children:[n.jsxs("div",{className:"workbench-archive-item-main",children:[n.jsx("strong",{title:c.title??c.sessionId,children:c.title??c.sessionId}),n.jsx("p",{children:Z9(c)})]}),n.jsx("button",{type:"button",className:"secondary-button",disabled:s===c.sessionId,onClick:()=>{l(c.sessionId)},children:o("shell.unarchiveAction")})]},c.sessionId))}):n.jsx("p",{className:"workbench-section-empty",children:o("shell.archiveEmpty")})})]})]}),document.body)}function Z9(e){const t=Vs(e.provider),r=eK(e.lastMessageAt??e.updatedAt??null);return[t,r].filter(Boolean).join(" · ")}function eK(e){if(!e)return null;const t=Date.parse(e);return Number.isNaN(t)?null:new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(t)}function tK(e,t){const r=new Set(li(Gi(e)).sort((s,i)=>(i.item.session.lastMessageAt??i.item.session.updatedAt).localeCompare(s.item.session.lastMessageAt??s.item.session.updatedAt)).slice(0,t).map(s=>s.item.session.sessionId));return{...e,children:RA(Gi(e),r)}}function RA(e,t){return e.flatMap(r=>{const s=RA(Gi(r),t);return!t.has(r.item.session.sessionId)&&s.length===0?[]:[{...r,children:s}]})}function nK(e,t,r,s=-1){if(e<=0)return 0;const i=s>=0?Math.max(t,s+1):t;return Math.min(e,Math.max(r??0,i))}function rK(e,t){const r=Object.keys(e),s=Object.keys(t);return r.length!==s.length?!1:r.every(i=>e[i]===t[i])}function sK(){const{currentWorkspaceId:e,currentSessionId:t,navigationGroups:r}=Mr();if(!e)return n.jsx("main",{className:"mobile-feature-page mobile-page-scroll-root",children:n.jsxs("article",{className:"mobile-feature-empty surface-card",children:[n.jsx("h1",{children:o("shell.filesEntry")}),n.jsx("p",{children:o("shell.toolsWorkspaceRequiredBody")})]})});const s=r.flatMap(l=>l.sessions).find(l=>l.sessionId===t&&l.workspaceId===e),i=s?Yn(e,s.sessionId):Ni(e);return n.jsx(eo,{to:`${i}?toolPanel=files`,replace:!0})}function iK(){const{currentWorkspaceId:e,currentSessionId:t,navigationGroups:r}=Mr();if(!e)return n.jsx("main",{className:"mobile-feature-page mobile-page-scroll-root",children:n.jsxs("article",{className:"mobile-feature-empty surface-card",children:[n.jsx("h1",{children:o("shell.gitEntry")}),n.jsx("p",{children:o("shell.toolsWorkspaceRequiredBody")})]})});const s=r.flatMap(l=>l.sessions).find(l=>l.sessionId===t&&l.workspaceId===e),i=s?Yn(e,s.sessionId):Ni(e);return n.jsx(eo,{to:`${i}?toolPanel=git`,replace:!0})}function aK(){const{currentWorkspaceId:e,currentSessionId:t,navigationGroups:r}=Mr();if(!e)return n.jsx("main",{className:"mobile-feature-page mobile-page-scroll-root",children:n.jsxs("article",{className:"mobile-feature-empty surface-card",children:[n.jsx("h1",{children:o("shell.terminalManagerEntry")}),n.jsx("p",{children:o("shell.toolsWorkspaceRequiredBody")})]})});const s=r.flatMap(l=>l.sessions).find(l=>l.sessionId===t&&l.workspaceId===e),i=s?Yn(e,s.sessionId):Ni(e);return n.jsx(eo,{to:`${i}?toolPanel=processes`,replace:!0})}function oK(){var c,d;const{navigationGroups:e,currentWorkspaceId:t,currentSessionId:r}=Mr(),s=((c=e.find(m=>m.workspace.id===t))==null?void 0:c.workspace)??((d=e[0])==null?void 0:d.workspace)??null;if(!s)return n.jsx("main",{className:"mobile-feature-page mobile-page-scroll-root",children:n.jsxs("article",{className:"mobile-feature-empty surface-card",children:[n.jsx("h1",{children:o("shell.mobileSessionsEntry")}),n.jsx("p",{children:o("shell.emptyNavigationBody")})]})});const i=e.flatMap(m=>m.sessions).find(m=>m.sessionId===r&&m.workspaceId===s.id),l=i?Yn(s.id,i.sessionId):Ni(s.id);return n.jsx(eo,{to:l,replace:!0})}function lK(e){return e.status==="active"}function cK(e){return e.status==="queued"||e.status==="running"}function uK(e,t){return e.filter(lK).length+t.filter(cK).length}function dK(e){const t=p.useMemo(()=>e.notifications.filter(r=>e.showArchivedNotifications||!e.archivedNotificationIds.has(r.id)),[e.archivedNotificationIds,e.notifications,e.showArchivedNotifications]);return n.jsx(Fn,{open:e.open,title:o("shell.globalNotificationsPanelTitle"),description:o("shell.globalNotificationsPanelDescription"),className:"workbench-notification-modal-card mobile-notification-modal-card",onClose:e.onClose,children:n.jsxs("div",{className:"workbench-notification-pane mobile-notification-pane",role:"tabpanel","aria-label":o("shell.globalNotificationsAction"),children:[n.jsx("div",{className:"workbench-notification-toolbar",children:n.jsxs("label",{className:"workbench-notification-filter",children:[n.jsx("input",{type:"checkbox",checked:e.showArchivedNotifications,onChange:r=>e.onToggleShowArchivedNotifications(r.target.checked)}),n.jsx("span",{children:o("shell.globalNotificationsShowArchived")})]})}),t.length>0?n.jsx("div",{className:"workbench-notification-list",children:t.map(r=>{const s=e.archivedNotificationIds.has(r.id);return n.jsxs("article",{className:"workbench-notification-item","data-archived":s,children:[n.jsxs("button",{type:"button",className:"workbench-notification-item-content",onClick:()=>{e.onSelectNotification(r)},children:[n.jsx("span",{className:"workbench-notification-item-kind",children:hK(r.kind)}),n.jsx("strong",{children:r.title}),n.jsx("p",{children:r.body})]}),n.jsxs("div",{className:"workbench-notification-item-side",children:[n.jsx("time",{children:mK(r.createdAt)}),n.jsx("button",{type:"button",className:"secondary-button workbench-notification-item-action-button",onClick:()=>{if(s){e.onUnarchiveNotification(r.id);return}e.onArchiveNotification(r.id)},children:o(s?"shell.globalNotificationsRemoveArchiveAction":"shell.globalNotificationsArchiveAction")})]})]},r.id)})}):n.jsx("p",{className:"workbench-notification-empty",children:o("shell.globalNotificationsEmpty")})]})})}function hK(e){switch(e){case"follow_up_waiting_user":return o("shell.globalNotificationKindWaitingUser");case"follow_up_completed":return o("shell.globalNotificationKindFollowUpCompleted");case"follow_up_failed":return o("shell.globalNotificationKindFollowUpFailed");case"verification_failed":return o("shell.globalNotificationKindVerificationFailed");default:return o("shell.globalNotificationsPanelTitle")}}function mK(e){const t=new Date(e);return Number.isNaN(t.getTime())?e:new Intl.DateTimeFormat(void 0,{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(t)}function pK(e){return e.isArchived!==!0&&!ba(e)}function AA(e){return e.activityState==="running"||e.runningState==="starting"||e.runningState==="running"||e.runningState==="reconnecting"}function fK(e){return e.activityState==="idle"&&AA(e)===!1}function rT(e){return e==="creating"||e==="running"}function sT(e){return e.lastEventAt??e.lastMessageAt??e.updatedAt??e.createdAt}function iT(e){return e?new Date(e).toLocaleString(void 0,{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}):o("common.unknown")}function Co(e){return e!==null&&e>0}const hh=60*1e3,gK=15e3;function bK(){var qe;const e=fr(),{showToast:t}=Qn(),r=Mr(),{navigationGroups:s,currentWorkspaceId:i,refreshNavigation:l,selectWorkspace:c,startDraftSession:d,subscribeGitSnapshot:m,requestGitRefresh:f,addGitSnapshotListener:v,subscribeTerminalManagerSnapshot:g,requestTerminalManagerRefresh:w,addTerminalManagerSnapshotListener:k}=r,y=r.globalNotifications??[],S=new Set(r.archivedNotificationIds??[]),T=r.showArchivedNotifications??!1,j=r.unreadNotificationCount??0,N=r.setShowArchivedNotifications??(()=>{}),D=r.archiveNotification??(()=>{}),H=r.unarchiveNotification??(()=>{}),[B,I]=p.useState(null),[A,L]=p.useState(!1),[_,F]=p.useState(!1),[te,E]=p.useState(!1),[se,X]=p.useState({gitLoading:!1,terminalLoading:!1,branch:null,activeTerminalCount:null,changedFileCount:null,quickLaunchRunning:null}),[K,G]=p.useState({loading:!0,activeTaskCount:0,pendingInboxCount:0}),q=Gl(s),U=pa(s,i)??pa(s,((qe=s[0])==null?void 0:qe.workspace.id)??null),Q=(U==null?void 0:U.workspace)??null,P=q.find(ke=>ke.workspace.id===(Q==null?void 0:Q.id))??(Q?{workspace:Q,label:Q.name,subtitle:Q.path}:null),W=[...(U==null?void 0:U.sessions)??[]].filter(pK),J=W.filter(AA),R=W.filter(fK),ve=W.filter(ke=>ke.isFavorite===!0),pe=J.slice(0,6),Y=ve.slice(0,6),Se=se.quickLaunchRunning===null?"…":se.quickLaunchRunning?o("shell.workspaceHomeQuickLaunchRunning"):o("shell.workspaceHomeQuickLaunchStopped");p.useEffect(()=>{const ke=(Q==null?void 0:Q.id)??null;if(!ke){X({gitLoading:!1,terminalLoading:!1,branch:null,activeTerminalCount:null,changedFileCount:null,quickLaunchRunning:null});return}const Ee=Ur(Rg(ke),hh);X($e=>{var wt,me;return{...$e,gitLoading:Ee===null,branch:((wt=Ee==null?void 0:Ee.status)==null?void 0:wt.snapshot.branch)??null,changedFileCount:((me=Ee==null?void 0:Ee.status)==null?void 0:me.changes.length)??null}})},[Q==null?void 0:Q.id]),p.useEffect(()=>{const ke=(Q==null?void 0:Q.id)??null;if(ke)return v(Ee=>{Ee.workspaceId===ke&&(_s(Rg(ke),Ee),X($e=>{var wt,me,Pe;return{...$e,gitLoading:!1,branch:((wt=Ee.status)==null?void 0:wt.snapshot.branch)??((me=Ee.branches)==null?void 0:me.currentBranch)??null,changedFileCount:((Pe=Ee.status)==null?void 0:Pe.changes.length)??null}}))})},[v,Q==null?void 0:Q.id]),p.useEffect(()=>{const ke=(Q==null?void 0:Q.id)??null;if(!ke){X($e=>({...$e,gitLoading:!1,branch:null,changedFileCount:null}));return}const Ee=Ur(Ag(ke),hh);X($e=>({...$e,terminalLoading:Ee===null,activeTerminalCount:Ee?Ee.terminals.filter(wt=>rT(wt.status)).length:null,quickLaunchRunning:Ee?Ee.templateStatuses.some(wt=>wt.occupied):null}))},[Q==null?void 0:Q.id]),p.useEffect(()=>{const ke=(Q==null?void 0:Q.id)??null;if(!ke){X(Ee=>({...Ee,terminalLoading:!1,activeTerminalCount:null,quickLaunchRunning:null}));return}return k(Ee=>{Ee.workspaceId===ke&&(_s(Ag(ke),{terminals:Ee.terminals,templates:Ee.templates,templateStatuses:Ee.templateStatuses}),X($e=>({...$e,terminalLoading:!1,activeTerminalCount:Ee.terminals.filter(wt=>rT(wt.status)).length,quickLaunchRunning:Ee.templateStatuses.some(wt=>wt.occupied)})))})},[k,Q==null?void 0:Q.id]),p.useEffect(()=>{const ke=(Q==null?void 0:Q.id)??null;if(!ke)return;const Ee=Ur(Rg(ke),hh)!==null;m(ke),!Ee&&f(ke)},[Q==null?void 0:Q.id,f,m]),p.useEffect(()=>{const ke=(Q==null?void 0:Q.id)??null;if(!ke)return;const Ee=Ur(Ag(ke),hh)!==null;g(ke),!Ee&&w(ke)},[Q==null?void 0:Q.id,w,g]),p.useEffect(()=>{const ke=(Q==null?void 0:Q.id)??null;if(!ke){G({loading:!1,activeTaskCount:0,pendingInboxCount:0});return}let Ee=!1;async function $e(Ge){G(dt=>({...dt,loading:!0}));try{const dt=await wm();if(!dt.initialized||!dt.profile){Ee||G({loading:!1,activeTaskCount:0,pendingInboxCount:0});return}const[Ye,Dt,ae]=await Promise.all([ym(),km(),Iu({workspaceId:ke})]);if(Ee)return;const We=new Set(Ye.overview.projects.filter(Rt=>Rt.workspaceId===ke).map(Rt=>Rt.id)),jt=Ye.overview.verifications.filter(Rt=>Rt.projectId?We.has(Rt.projectId):!1);G({loading:!1,activeTaskCount:uK(Dt.items.filter(Rt=>Rt.workspaceId===ke),jt),pendingInboxCount:ae.items.filter(Rt=>Rt.status!=="closed").length})}catch(dt){if(Ee)return;G(Ye=>({...Ye,loading:!1})),Ge&&t({title:o("shell.butlerLoadFailed"),description:dt instanceof Error?dt.message:void 0,tone:"error"})}}$e(!0);const wt=window.setInterval(()=>{$e(!1)},gK),me=aw(()=>{$e(!1)}),Pe=()=>{$e(!1)};return window.addEventListener(Fo,Pe),()=>{Ee=!0,window.clearInterval(wt),me(),window.removeEventListener(Fo,Pe)}},[Q==null?void 0:Q.id,t]);async function Le(ke){await l(),c(ke.id),I(null),e(Fs(ke.id))}async function re(ke){await l(),c(ke.id),I(null),e(Fs(ke.id))}function Ce(){Q&&(c(Q.id),e(YN(Q.id,"git")))}function Xe(){Q&&(c(Q.id),e(Ro(Q.id)))}function Ue(){Q&&(c(Q.id),e(rv(Q.id)))}function ct(){Q&&(c(Q.id),e($i(Q.id)))}function Nt(){Q&&e(Ni(Q.id))}function Ke(){Q&&L(!0)}function ut(ke,Ee){L(!1),d(ke,Ee)}function vt(){Q&&(c(Q.id),e(Fs(Q.id)))}function Te(ke){c(ke)}const _e=[{label:o("shell.workspaceHomeMetricActive"),value:J.length,accent:Co(J.length),onClick:W.length>0?Nt:void 0},{label:o("shell.workspaceHomeMetricUnread"),value:j,accent:Co(j),onClick:()=>E(!0)},{label:o("shell.workspaceHomeMetricTerminal"),value:se.terminalLoading?"…":se.activeTerminalCount??"—",accent:se.terminalLoading===!1&&Co(se.activeTerminalCount),onClick:Q?Xe:void 0},{label:o("shell.workspaceHomeMetricChanges"),value:se.gitLoading?"…":se.changedFileCount??"—",accent:se.gitLoading===!1&&Co(se.changedFileCount),onClick:Q?Ce:void 0}],we=[{label:o("shell.workspaceHomeWaitingInputLabel"),value:R.length,accent:Co(R.length),onClick:W.length>0?Nt:void 0},{label:o("shell.workspaceHomeButlerLabel"),value:K.loading?"…":K.activeTaskCount,accent:K.loading===!1&&Co(K.activeTaskCount),onClick:Q?ct:void 0},{label:o("shell.workspaceHomeQuickLaunchStatusLabel"),value:Se,accent:se.quickLaunchRunning===!0,onClick:Q?Ue:void 0},{label:o("shell.butlerInboxAction"),value:K.loading?"…":K.pendingInboxCount,accent:K.loading===!1&&Co(K.pendingInboxCount),onClick:Q?()=>F(!0):void 0}];return n.jsxs("main",{className:"mobile-feature-page mobile-page-scroll-root mobile-page-with-top-header mobile-workspace-home-page",children:[n.jsx(Kl,{currentWorkspace:P?{id:P.workspace.id,name:P.label,path:P.subtitle}:null,workspaces:s.map(ke=>ke.workspace),workspaceOptions:q,onSelectWorkspace:Te,sheetContent:ke=>n.jsxs("div",{className:"mobile-workspace-home-group mobile-workspace-home-sheet-group",children:[n.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-sheet-row",onClick:()=>{ke(),I("import")},children:[n.jsx("span",{className:"mobile-workspace-home-row-label",children:o("shell.importWorkspaceTitle")}),n.jsx("span",{className:"mobile-workspace-home-row-trailing",children:n.jsx(Wa,{})})]}),n.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-sheet-row",onClick:()=>{ke(),I("clone")},children:[n.jsx("span",{className:"mobile-workspace-home-row-label",children:o("shell.cloneWorkspaceTitle")}),n.jsx("span",{className:"mobile-workspace-home-row-trailing",children:n.jsx(Wa,{})})]})]})}),Q?n.jsx(n.Fragment,{children:n.jsxs("div",{className:"mobile-page-top-body mobile-workspace-home-body",children:[n.jsx("section",{className:"mobile-workspace-home-section",children:n.jsx("div",{className:"mobile-workspace-home-metrics-card","aria-label":o("shell.workspaceHomeStatusSectionTitle"),children:n.jsx("div",{className:"mobile-workspace-home-toolbar-summary",children:_e.map(ke=>ke.onClick?n.jsxs("button",{type:"button",className:"mobile-workspace-home-toolbar-metric","data-accent":ke.accent?"true":void 0,onClick:ke.onClick,children:[n.jsx("strong",{className:"mobile-workspace-home-toolbar-metric-value",children:ke.value}),n.jsx("span",{className:"mobile-workspace-home-toolbar-metric-label",children:ke.label})]},ke.label):n.jsxs("div",{className:"mobile-workspace-home-toolbar-metric","data-accent":ke.accent?"true":void 0,role:"listitem",children:[n.jsx("strong",{className:"mobile-workspace-home-toolbar-metric-value",children:ke.value}),n.jsx("span",{className:"mobile-workspace-home-toolbar-metric-label",children:ke.label})]},ke.label))})})}),n.jsx("section",{className:"mobile-workspace-home-section",children:n.jsxs("div",{className:"mobile-workspace-home-primary-actions",children:[n.jsx("button",{type:"button",className:"secondary-button",onClick:vt,children:o("shell.workspaceDetailTitle")}),n.jsx("button",{type:"button",className:"primary-button",onClick:Ke,children:o("shell.createSession")})]})}),n.jsx("section",{className:"mobile-workspace-home-section",children:n.jsx("div",{className:"mobile-workspace-home-group",children:we.map(ke=>n.jsxs("button",{type:"button",className:"mobile-workspace-home-row","data-accent":ke.accent?"true":void 0,onClick:ke.onClick,children:[n.jsx("span",{className:"mobile-workspace-home-row-label",children:ke.label}),n.jsxs("span",{className:"mobile-workspace-home-row-trailing",children:[n.jsx("strong",{children:ke.value}),n.jsx(Wa,{})]})]},ke.label))})}),n.jsxs("section",{className:"mobile-workspace-home-section",children:[n.jsxs("div",{className:"mobile-workspace-home-section-header",children:[n.jsx("p",{className:"mobile-workspace-home-section-title",children:o("shell.workspaceHomeActiveSessionsSectionTitle")}),Q?n.jsx("button",{type:"button",className:"mobile-workspace-home-link-button",onClick:Nt,children:o("shell.workspaceHomeViewAllAction")}):null]}),n.jsx("div",{className:"mobile-workspace-home-group",children:pe.length===0?n.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-empty-row",onClick:Ke,children:[n.jsxs("div",{className:"mobile-workspace-home-session-main",children:[n.jsx("span",{className:"mobile-workspace-home-session-title",children:o("shell.createSession")}),n.jsx("span",{className:"mobile-workspace-home-session-meta",children:Q.name})]}),n.jsx("span",{className:"mobile-workspace-home-row-trailing",children:n.jsx(Wa,{})})]}):pe.map(ke=>n.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-session-row",onClick:()=>e(Yn(Q.id,ke.sessionId)),children:[n.jsxs("div",{className:"mobile-workspace-home-session-main",children:[n.jsx("span",{className:"mobile-workspace-home-session-title",children:ke.title||o("common.unknown")}),n.jsxs("span",{className:"mobile-workspace-home-session-meta",children:[Vs(ke.provider,"full")," · ",iT(sT(ke))]})]}),n.jsx("span",{className:"mobile-workspace-home-row-trailing",children:n.jsx(Wa,{})})]},ke.sessionId))})]}),Y.length>0?n.jsxs("section",{className:"mobile-workspace-home-section",children:[n.jsx("div",{className:"mobile-workspace-home-section-header",children:n.jsx("p",{className:"mobile-workspace-home-section-title",children:o("shell.favoriteSectionTitle")})}),n.jsx("div",{className:"mobile-workspace-home-group",children:Y.map(ke=>n.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-session-row",onClick:()=>e(Yn(Q.id,ke.sessionId)),children:[n.jsxs("div",{className:"mobile-workspace-home-session-main",children:[n.jsx("span",{className:"mobile-workspace-home-session-title",children:ke.title||o("common.unknown")}),n.jsxs("span",{className:"mobile-workspace-home-session-meta",children:[Vs(ke.provider,"full")," · ",iT(sT(ke))]})]}),n.jsx("span",{className:"mobile-workspace-home-row-trailing",children:n.jsx(Wa,{})})]},ke.sessionId))})]}):null]})}):n.jsx("div",{className:"mobile-page-top-body mobile-workspace-home-body",children:n.jsxs("section",{className:"mobile-workspace-home-section mobile-workspace-home-empty",children:[n.jsx("p",{className:"mobile-workspace-home-section-title",children:o("shell.workspaceHomeSwitcherTitle")}),n.jsxs("div",{className:"mobile-workspace-home-group",children:[n.jsxs("button",{type:"button",className:"mobile-workspace-home-row",onClick:()=>I("import"),children:[n.jsx("span",{className:"mobile-workspace-home-row-label",children:o("shell.importWorkspaceTitle")}),n.jsx("span",{className:"mobile-workspace-home-row-trailing",children:n.jsx(Wa,{})})]}),n.jsxs("button",{type:"button",className:"mobile-workspace-home-row",onClick:()=>I("clone"),children:[n.jsx("span",{className:"mobile-workspace-home-row-label",children:o("shell.cloneWorkspaceTitle")}),n.jsx("span",{className:"mobile-workspace-home-row-trailing",children:n.jsx(Wa,{})})]})]})]})}),n.jsx(rD,{open:B==="import",onClose:()=>I(null),onImported:Le}),n.jsx(tD,{open:B==="clone",onClose:()=>I(null),onCloned:re}),n.jsx(ww,{open:A,workspaces:s.map(ke=>ke.workspace),workspaceOptions:q,initialWorkspaceId:(Q==null?void 0:Q.id)??i??null,onClose:()=>L(!1),onSelect:ut}),n.jsx(rb,{open:_,preferredWorkspaceId:(Q==null?void 0:Q.id)??null,compactComposer:!0,onClose:()=>F(!1)}),n.jsx(dK,{open:te,notifications:y,archivedNotificationIds:S,showArchivedNotifications:T,onClose:()=>E(!1),onToggleShowArchivedNotifications:N,onArchiveNotification:D,onUnarchiveNotification:H,onSelectNotification:ke=>{E(!1),ke.routePath&&e(ke.routePath)}})]})}function Rg(e){return`git-sidebar.snapshot.${e}`}function Ag(e){return`terminal-manager.snapshot.${e}`}function Wa(){return n.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:n.jsx("path",{d:"M6 3.5L10.5 8 6 12.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function MA({workspace:e,state:t,variant:r,actions:s,matrixLimit:i}){return e?r==="mobile"?n.jsx(vK,{workspace:e,state:t,actions:s,matrixLimit:i}):r==="desktop-modal"?n.jsx(wK,{workspace:e,state:t,actions:s,matrixLimit:i}):n.jsx(yK,{workspace:e,state:t,actions:s,matrixLimit:i}):n.jsx("p",{className:"workbench-section-empty",children:o("shell.workspaceDetailMissingBody")})}function vK({workspace:e,state:t,actions:r,matrixLimit:s}){var g,w,k;const i=t.primaryAnalysis,l=((g=t.runtime)==null?void 0:g.runtimeSession)??null,c=s?t.matrixItems.slice(0,s):t.matrixItems,d=kw(t),m=yw(t),[f,v]=p.useState(!1);return n.jsxs(n.Fragment,{children:[n.jsxs("section",{className:"mobile-feature-panel surface-card mobile-workspace-composition-panel",children:[n.jsx("div",{className:"mobile-feature-section-header",children:n.jsx("div",{children:n.jsx("h2",{children:o("shell.workspaceDetailDebugTitle")})})}),t.loading&&i===null?n.jsx("p",{children:o("common.loading")}):null,t.error?n.jsx("p",{className:"status-text","data-tone":"error",children:t.error}):null,i?n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"mobile-detail-grid mobile-workspace-detail-grid",children:[n.jsxs("div",{className:"mobile-detail-metric",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugOverallStatusLabel")}),n.jsx("strong",{children:xw(d)})]}),n.jsxs("div",{className:"mobile-detail-metric",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugFrameworkLabel")}),n.jsx("strong",{children:i.primaryFramework??o("common.unknown")})]}),n.jsxs("div",{className:"mobile-detail-metric",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugConfidenceLabel")}),n.jsx("strong",{children:EA(i.confidence)})]}),n.jsxs("div",{className:"mobile-detail-metric",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugSummaryServiceCountLabel")}),n.jsx("strong",{children:d.totalServices})]}),n.jsxs("div",{className:"mobile-detail-metric",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugCompatibilityLabel")}),n.jsx("strong",{children:Eo(i.compatibilityLevel)})]}),n.jsxs("div",{className:"mobile-detail-metric",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugInjectionLabel")}),n.jsx("strong",{children:gu(i.recommendedInjectionMode??"none")})]}),n.jsxs("div",{className:"mobile-detail-metric",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugRuntimeStatusLabel")}),n.jsx("strong",{children:tu((l==null?void 0:l.status)??null)})]}),n.jsxs("div",{className:"mobile-detail-metric",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugFailureStageLabel")}),n.jsx("strong",{children:bu((l==null?void 0:l.failureStage)??null)})]}),n.jsxs("div",{className:"mobile-detail-metric",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugServiceDiscoveryLabel")}),n.jsx("strong",{children:Fl(i.requiresServiceDiscoveryHandling)})]}),n.jsxs("div",{className:"mobile-detail-metric",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugHmrLabel")}),n.jsx("strong",{children:Fl(i.requiresHmrHandling)})]}),n.jsxs("div",{className:"mobile-detail-metric",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugCallbackLabel")}),n.jsx("strong",{children:Fl(i.requiresCallbackHandling)})]}),n.jsxs("div",{className:"mobile-detail-metric mobile-detail-metric-wide",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugAiFallbackLabel")}),n.jsx("strong",{children:Cw(i.aiFallbackPolicy)})]}),n.jsxs("div",{className:"mobile-detail-metric mobile-detail-metric-wide",children:[n.jsx("span",{children:o("shell.manageWorkspacePathLabel")}),n.jsx("strong",{children:e.path})]}),n.jsxs("div",{className:"mobile-detail-metric mobile-detail-metric-wide",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugFrameworkNoteLabel")}),n.jsx("strong",{children:((w=t.currentCompatibilityItem)==null?void 0:w.notes)??o("shell.workspaceDetailDebugFrameworkNoteEmpty")})]}),n.jsxs("div",{className:"mobile-detail-metric mobile-detail-metric-wide",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugOverallSummaryLabel")}),n.jsx("strong",{children:Sw(d)})]}),n.jsxs("div",{className:"mobile-detail-metric mobile-detail-metric-wide",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugReasonsLabel")}),n.jsx("strong",{children:dm(i.reasons,"shell.workspaceDetailDebugEmptyReasons")})]}),n.jsxs("div",{className:"mobile-detail-metric mobile-detail-metric-wide",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugFilesLabel")}),n.jsx("strong",{children:dm(i.detectedFiles,"shell.workspaceDetailDebugEmptyFiles")})]})]}),t.runtime===null?n.jsx("p",{className:"status-text",children:o("shell.workspaceDetailDebugRuntimeEmpty")}):null,r?n.jsx("div",{className:"workbench-modal-actions",children:r}):null]}):null]}),m.length>0?n.jsxs("section",{className:"mobile-feature-panel surface-card mobile-workspace-composition-panel",children:[n.jsxs("div",{className:"mobile-feature-section-header",children:[n.jsx("div",{children:n.jsx("h2",{children:o("shell.workspaceDetailDebugDetectedServicesTitle")})}),n.jsx("span",{className:"mobile-feature-counter",children:m.length})]}),n.jsx("div",{className:"mobile-feature-stack mobile-debug-service-stack",children:m.map(y=>{var S,T,j;return n.jsxs("article",{className:"surface-card mobile-debug-service-card",children:[n.jsxs("div",{className:"mobile-debug-service-card-primary-row",children:[n.jsx("h3",{children:y.service.name}),n.jsxs("div",{className:"mobile-debug-service-card-inline-metric",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugServiceFrameworkLabel")}),n.jsx("strong",{children:((S=y.analysis)==null?void 0:S.primaryFramework)??o("common.unknown")})]})]}),n.jsxs("div",{className:"mobile-debug-service-card-meta-row",children:[n.jsx("p",{title:y.service.cwd,children:wu(y.service.cwd,e.path)}),n.jsx("span",{className:"mobile-debug-service-card-category","data-tone":LA(y.category),children:vu(y.category)})]}),n.jsxs("div",{className:"mobile-debug-service-card-secondary-row",children:[n.jsxs("div",{className:"mobile-debug-service-card-inline-metric",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugServiceCommandLabel")}),n.jsx("strong",{children:jw(y.service)})]}),n.jsxs("div",{className:"mobile-debug-service-card-inline-metric","data-tone":FA(((T=y.analysis)==null?void 0:T.compatibilityLevel)??"unknown"),children:[n.jsx("span",{children:o("shell.workspaceDetailDebugCompatibilityLabel")}),n.jsx("strong",{children:Eo(((j=y.analysis)==null?void 0:j.compatibilityLevel)??"unknown")})]})]})]},y.service.id)})})]}):null,(k=t.runtime)!=null&&k.services.length?n.jsxs("section",{className:"mobile-feature-panel surface-card mobile-workspace-composition-panel",children:[n.jsxs("div",{className:"mobile-feature-section-header",children:[n.jsx("div",{children:n.jsx("h2",{children:o("shell.workspaceDetailDebugRuntimeServicesTitle")})}),n.jsx("span",{className:"mobile-feature-counter",children:t.runtime.services.length})]}),n.jsx("div",{className:"mobile-feature-stack",children:t.runtime.services.map(y=>{var S,T,j,N,D;return n.jsxs("article",{className:"surface-card mobile-session-row",children:[n.jsxs("div",{className:"mobile-session-row-primary mobile-session-row-primary-static",children:[n.jsx("span",{className:"mobile-session-row-title",children:y.service.name}),n.jsx("span",{className:"mobile-session-row-provider",children:vu(um(y.service,y.analysis))})]}),n.jsxs("div",{className:"mobile-detail-grid mobile-workspace-detail-grid",children:[n.jsxs("div",{className:"mobile-detail-metric",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugServicePathLabel")}),n.jsx("strong",{title:y.service.cwd,children:wu(y.service.cwd,e.path)})]}),n.jsxs("div",{className:"mobile-detail-metric",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugRuntimeServicePortLabel")}),n.jsx("strong",{children:_A(((S=y.binding)==null?void 0:S.leasedPort)??((T=y.portLease)==null?void 0:T.port)??null)})]}),n.jsxs("div",{className:"mobile-detail-metric",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugRuntimeServiceBindingLabel")}),n.jsx("strong",{children:OA(((j=y.binding)==null?void 0:j.status)??null)})]}),n.jsxs("div",{className:"mobile-detail-metric",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugRuntimeServiceProcessLabel")}),n.jsx("strong",{children:BA(((N=y.processInstance)==null?void 0:N.status)??null)})]}),n.jsxs("div",{className:"mobile-detail-metric",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugRuntimeServiceFailureLabel")}),n.jsx("strong",{children:bu(((D=y.processInstance)==null?void 0:D.failureStage)??(l==null?void 0:l.failureStage)??null)})]}),n.jsxs("div",{className:"mobile-detail-metric mobile-detail-metric-wide",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugRuntimeServiceAiLabel")}),n.jsx("strong",{children:BK(y.aiFallbackEdits.map(H=>H.status))})]})]})]},y.service.id)})})]}):null,c.length>0?n.jsx("section",{className:"mobile-feature-panel surface-card mobile-workspace-composition-panel",children:n.jsx(IA,{items:c,layout:"mobile",open:f,onOpen:()=>v(!0),onClose:()=>v(!1)})}):null]})}function wK({workspace:e,state:t,actions:r,matrixLimit:s}){var m,f,v;const i=t.primaryAnalysis,l=((m=t.runtime)==null?void 0:m.runtimeSession)??null,c=s?t.matrixItems.slice(0,s):t.matrixItems,d=kw(t);return n.jsxs("div",{className:"workbench-manage-list",children:[t.loading&&i===null?n.jsx("p",{className:"workbench-manage-status status-text",children:o("common.loading")}):null,t.error?n.jsx("p",{className:"workbench-manage-status status-text","data-tone":"error",children:t.error}):null,i?n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"workbench-manage-detail-block",children:[n.jsx("span",{className:"workbench-manage-detail-label",children:o("shell.workspaceDetailDebugOverallStatusLabel")}),n.jsx("p",{className:"workbench-manage-detail-value",children:xw(d)}),n.jsx("p",{className:"workbench-manage-hint",children:Sw(d)})]}),n.jsxs("div",{className:"workbench-manage-detail-block",children:[n.jsx("span",{className:"workbench-manage-detail-label",children:o("shell.manageWorkspacePathLabel")}),n.jsx("p",{className:"workbench-manage-detail-value",children:e.path})]}),n.jsx("div",{className:"workbench-manage-detail-block",children:n.jsxs("div",{className:"workbench-manage-kv-list",children:[n.jsxs("div",{className:"workbench-manage-kv-item",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugFrameworkLabel")}),n.jsx("span",{children:i.primaryFramework??o("common.unknown")})]}),n.jsxs("div",{className:"workbench-manage-kv-item",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugConfidenceLabel")}),n.jsx("span",{children:EA(i.confidence)})]}),n.jsxs("div",{className:"workbench-manage-kv-item",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugCompatibilityLabel")}),n.jsx("span",{children:Eo(i.compatibilityLevel)})]}),n.jsxs("div",{className:"workbench-manage-kv-item",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugInjectionLabel")}),n.jsx("span",{children:gu(i.recommendedInjectionMode??"none")})]}),n.jsxs("div",{className:"workbench-manage-kv-item",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugRuntimeStatusLabel")}),n.jsx("span",{children:tu((l==null?void 0:l.status)??null)})]}),n.jsxs("div",{className:"workbench-manage-kv-item",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugFailureStageLabel")}),n.jsx("span",{children:bu((l==null?void 0:l.failureStage)??null)})]}),n.jsxs("div",{className:"workbench-manage-kv-item",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugAiFallbackLabel")}),n.jsx("span",{children:Cw(i.aiFallbackPolicy)})]})]})}),n.jsxs("div",{className:"workbench-manage-detail-block",children:[n.jsx("span",{className:"workbench-manage-detail-label",children:o("shell.workspaceDetailDebugDetectedServicesTitle")}),t.services.length>0?n.jsx("div",{className:"workbench-manage-type-list",children:t.services.map(g=>{const w=t.analyses.find(k=>k.serviceId===g.id)??null;return n.jsxs("div",{className:"workbench-manage-type-item",children:[n.jsx("span",{className:"workbench-manage-type-meta",children:n.jsxs("span",{className:"workbench-manage-type-name",children:[g.name," · ",vu(um(g,w))]})}),n.jsxs("span",{title:g.cwd,children:[wu(g.cwd,e.path)," · ",(w==null?void 0:w.primaryFramework)??o("common.unknown")," · ",Eo((w==null?void 0:w.compatibilityLevel)??"unknown")," · ",jw(g)]})]},g.id)})}):n.jsx("p",{className:"workbench-section-empty",children:o("shell.workspaceDetailDebugRuntimeEmpty")})]}),n.jsxs("div",{className:"workbench-manage-detail-block",children:[n.jsx("span",{className:"workbench-manage-detail-label",children:o("shell.workspaceDetailDebugFrameworkNoteLabel")}),n.jsx("p",{className:"workbench-manage-hint",children:((f=t.currentCompatibilityItem)==null?void 0:f.notes)??o("shell.workspaceDetailDebugFrameworkNoteEmpty")})]}),n.jsxs("div",{className:"workbench-manage-detail-block",children:[n.jsx("span",{className:"workbench-manage-detail-label",children:o("shell.workspaceDetailDebugReasonsLabel")}),n.jsx("p",{className:"workbench-manage-hint",children:dm(i.reasons,"shell.workspaceDetailDebugEmptyReasons")})]}),n.jsxs("div",{className:"workbench-manage-detail-block",children:[n.jsx("span",{className:"workbench-manage-detail-label",children:o("shell.workspaceDetailDebugFilesLabel")}),n.jsx("p",{className:"workbench-manage-hint",children:dm(i.detectedFiles,"shell.workspaceDetailDebugEmptyFiles")})]}),n.jsxs("div",{className:"workbench-manage-detail-block",children:[n.jsx("span",{className:"workbench-manage-detail-label",children:o("shell.workspaceDetailDebugRuntimeServicesTitle")}),(v=t.runtime)!=null&&v.services.length?n.jsx("div",{className:"workbench-manage-type-list",children:t.runtime.services.map(g=>{var w,k,y,S;return n.jsxs("div",{className:"workbench-manage-type-item",children:[n.jsx("span",{className:"workbench-manage-type-meta",children:n.jsxs("span",{className:"workbench-manage-type-name",children:[g.service.name," · ",vu(um(g.service,g.analysis))]})}),n.jsxs("span",{title:g.service.cwd,children:[wu(g.service.cwd,e.path)," · ",o("shell.workspaceDetailDebugRuntimeServicePortLabel")," ",_A(((w=g.binding)==null?void 0:w.leasedPort)??((k=g.portLease)==null?void 0:k.port)??null)," · ",o("shell.workspaceDetailDebugRuntimeServiceBindingLabel")," ",OA(((y=g.binding)==null?void 0:y.status)??null)," · ",o("shell.workspaceDetailDebugRuntimeServiceProcessLabel")," ",BA(((S=g.processInstance)==null?void 0:S.status)??null)]})]},g.service.id)})}):n.jsx("p",{className:"workbench-section-empty",children:o("shell.workspaceDetailDebugRuntimeEmpty")})]}),n.jsxs("div",{className:"workbench-manage-detail-block",children:[n.jsx("span",{className:"workbench-manage-detail-label",children:o("shell.workspaceDetailDebugMatrixTitle")}),n.jsx("div",{className:"workbench-manage-type-list",children:c.map(g=>n.jsxs("div",{className:"workbench-manage-type-item",children:[n.jsx("span",{className:"workbench-manage-type-meta",children:n.jsx("span",{className:"workbench-manage-type-name",children:g.framework})}),n.jsxs("span",{children:[Eo(g.compatibilityLevel)," · ",gu(g.recommendedInjectionMode)]})]},g.framework))})]}),r?n.jsx("div",{className:"workbench-modal-actions",children:r}):null]}):null]})}function yK({workspace:e,state:t,actions:r,matrixLimit:s}){var w,k;const i=t.primaryAnalysis,l=((w=t.runtime)==null?void 0:w.runtimeSession)??null,c=s?t.matrixItems.slice(0,s):t.matrixItems,d=kw(t),m=yw(t),f=((k=t.analyses[0])==null?void 0:k.createdAt)??null,[v,g]=p.useState(!1);return n.jsxs("div",{className:"debug-readiness-page",children:[t.loading&&i===null?n.jsx("p",{className:"workbench-manage-status status-text",children:o("common.loading")}):null,t.error?n.jsx("p",{className:"workbench-manage-status status-text","data-tone":"error",children:t.error}):null,i?n.jsxs(n.Fragment,{children:[n.jsxs("section",{className:"debug-readiness-hero surface-card",children:[n.jsxs("div",{className:"debug-readiness-hero-header",children:[n.jsxs("div",{className:"debug-readiness-hero-copy",children:[n.jsx("span",{className:"debug-readiness-eyebrow",children:e.name??o("shell.workspaceDetailDebugPageHeroEyebrow")}),n.jsx("h2",{children:o("shell.workspaceDetailDebugPageTitle")}),n.jsx("p",{children:Sw(d)})]}),r?n.jsx("div",{className:"debug-readiness-hero-actions",children:r}):null]}),n.jsxs("div",{className:"debug-readiness-summary-grid",children:[n.jsxs("article",{className:"debug-readiness-summary-card","data-tone":d.overallTone,children:[n.jsx("span",{children:o("shell.workspaceDetailDebugOverallStatusLabel")}),n.jsx("strong",{children:xw(d)}),n.jsx("small",{children:d.autoInjectionEligible?o("shell.workspaceDetailDebugAutoInjectionEligible"):o("shell.workspaceDetailDebugAutoInjectionBlocked")})]}),n.jsxs("article",{className:"debug-readiness-summary-card",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugSummaryServiceCountLabel")}),n.jsx("strong",{children:d.totalServices}),n.jsx("small",{children:o("shell.workspaceDetailDebugDetectedServicesTitle")})]}),n.jsxs("article",{className:"debug-readiness-summary-card",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugSummaryWebCountLabel")}),n.jsx("strong",{children:d.webServiceCount}),n.jsx("small",{children:SK(d)})]}),n.jsxs("article",{className:"debug-readiness-summary-card",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugSummaryDesktopShellCountLabel")}),n.jsx("strong",{children:d.desktopShellCount}),n.jsx("small",{children:o("shell.workspaceDetailDebugDesktopShellSummaryHint")})]}),n.jsxs("article",{className:"debug-readiness-summary-card",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugRuntimeStatusLabel")}),n.jsx("strong",{children:tu((l==null?void 0:l.status)??null)}),n.jsx("small",{children:bu((l==null?void 0:l.failureStage)??null)})]}),n.jsxs("article",{className:"debug-readiness-summary-card",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugLastAnalyzedAtLabel")}),n.jsx("strong",{children:aT(f)}),n.jsx("small",{children:CK(t.targetSourceType)})]})]}),n.jsx("div",{className:"debug-readiness-chip-row",children:d.categoryChips.map(y=>n.jsx("span",{className:"debug-readiness-chip","data-tone":y.tone,children:y.label},y.key))}),n.jsxs("div",{className:"debug-readiness-hero-meta",children:[n.jsx("span",{children:o("shell.manageWorkspacePathLabel")}),n.jsx("strong",{children:e.path})]})]}),n.jsxs("div",{className:"debug-readiness-layout",children:[n.jsxs("section",{className:"debug-readiness-section surface-card",children:[n.jsx("div",{className:"debug-readiness-section-header",children:n.jsxs("div",{children:[n.jsx("h3",{children:o("shell.workspaceDetailDebugDetectedServicesTitle")}),n.jsx("p",{children:o("shell.workspaceDetailDebugServiceSectionDescription")})]})}),n.jsx("div",{className:"debug-readiness-service-grid",children:m.map(y=>{var S,T,j;return n.jsxs("article",{className:"debug-readiness-service-card",children:[n.jsxs("div",{className:"debug-readiness-service-card-header",children:[n.jsxs("div",{children:[n.jsx("strong",{children:y.service.name}),n.jsx("p",{children:wu(y.service.cwd,e.path)})]}),n.jsx("span",{className:"debug-readiness-chip","data-tone":LA(y.category),children:vu(y.category)})]}),n.jsxs("div",{className:"debug-readiness-service-card-grid",children:[n.jsxs("div",{children:[n.jsx("span",{children:o("shell.workspaceDetailDebugServiceFrameworkLabel")}),n.jsx("strong",{children:((S=y.analysis)==null?void 0:S.primaryFramework)??o("common.unknown")})]}),n.jsxs("div",{children:[n.jsx("span",{children:o("shell.workspaceDetailDebugCompatibilityLabel")}),n.jsx("strong",{children:Eo(((T=y.analysis)==null?void 0:T.compatibilityLevel)??"unknown")})]}),n.jsxs("div",{children:[n.jsx("span",{children:o("shell.workspaceDetailDebugInjectionLabel")}),n.jsx("strong",{children:gu(((j=y.analysis)==null?void 0:j.recommendedInjectionMode)??"none")})]}),n.jsxs("div",{children:[n.jsx("span",{children:o("shell.workspaceDetailDebugRuntimeStatusLabel")}),n.jsx("strong",{children:tu(jK(y))})]})]}),n.jsxs("div",{className:"debug-readiness-service-card-list",children:[n.jsxs("p",{children:[n.jsx("span",{children:o("shell.workspaceDetailDebugServiceCommandLabel")}),n.jsx("strong",{children:jw(y.service)})]}),n.jsxs("p",{children:[n.jsx("span",{children:o("shell.workspaceDetailDebugServiceRequirementsLabel")}),n.jsx("strong",{children:TK(y.analysis)})]}),n.jsxs("p",{children:[n.jsx("span",{children:o("shell.workspaceDetailDebugServiceActionLabel")}),n.jsx("strong",{children:PK(y)})]}),n.jsxs("p",{children:[n.jsx("span",{children:o("shell.workspaceDetailDebugReasonsLabel")}),n.jsx("strong",{children:NK(y)})]})]})]},y.service.id)})})]}),n.jsxs("aside",{className:"debug-readiness-sidebar",children:[n.jsxs("section",{className:"debug-readiness-section surface-card",children:[n.jsx("div",{className:"debug-readiness-section-header",children:n.jsxs("div",{children:[n.jsx("h3",{children:o("shell.workspaceDetailDebugRuntimeHistoryTitle")}),n.jsx("p",{children:o("shell.workspaceDetailDebugRuntimeSectionDescription")})]})}),t.runtimeHistory.length>0?n.jsx("div",{className:"debug-readiness-runtime-list",children:t.runtimeHistory.map(y=>n.jsxs("article",{className:"debug-readiness-runtime-item",children:[n.jsxs("div",{className:"debug-readiness-runtime-item-header",children:[n.jsx("strong",{children:DK(y)}),n.jsx("span",{children:tu(y.runtimeSession.status)})]}),n.jsx("p",{children:RK(y)}),n.jsxs("div",{className:"debug-readiness-runtime-item-grid",children:[n.jsxs("span",{children:[o("shell.workspaceDetailDebugRuntimeHistoryTimeLabel")," ",aT(y.runtimeSession.startedAt??y.runtimeSession.createdAt)]}),n.jsxs("span",{children:[o("shell.workspaceDetailDebugRuntimeHistoryServiceLabel")," ",AK(y)]}),n.jsxs("span",{children:[o("shell.workspaceDetailDebugRuntimeServiceFailureLabel")," ",bu(y.runtimeSession.failureStage??null)]}),n.jsxs("span",{children:[o("shell.workspaceDetailDebugRuntimeHistoryResultLabel")," ",MK(y)]})]})]},y.runtimeSession.id))}):n.jsx("p",{className:"workbench-section-empty",children:o("shell.workspaceDetailDebugRuntimeEmpty")})]}),n.jsx("section",{className:"debug-readiness-section surface-card",children:n.jsx(IA,{items:c,layout:"desktop",open:v,onOpen:()=>g(!0),onClose:()=>g(!1)})})]})]})]}):null]})}function IA({items:e,layout:t,open:r,onOpen:s,onClose:i}){const l=xK(e);return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:t==="mobile"?void 0:"debug-readiness-section-body",children:[n.jsxs("div",{className:t==="mobile"?"mobile-feature-section-header":"debug-readiness-section-header",children:[n.jsxs("div",{children:[t==="mobile"?n.jsx("h2",{children:o("shell.workspaceDetailDebugMatrixTitle")}):null,t==="desktop"?n.jsx("h3",{children:o("shell.workspaceDetailDebugMatrixTitle")}):null,n.jsx("p",{children:o("shell.workspaceDetailDebugMatrixSectionDescription")})]}),n.jsx("span",{className:t==="mobile"?"mobile-feature-counter":"debug-readiness-matrix-counter",children:e.length})]}),n.jsxs("div",{className:`debug-readiness-matrix-entry${t==="mobile"?" debug-readiness-matrix-entry-mobile":""}`,children:[n.jsxs("div",{className:"debug-readiness-matrix-summary-row",children:[n.jsxs("span",{className:"debug-readiness-matrix-summary-pill","data-tone":"success",children:[o("shell.workspaceDetailDebugCompatibilitySupported"),n.jsx("strong",{children:l.supportedCount})]}),n.jsxs("span",{className:"debug-readiness-matrix-summary-pill","data-tone":"warn",children:[o("shell.workspaceDetailDebugCompatibilityConditional"),n.jsx("strong",{children:l.conditionalCount})]}),n.jsxs("span",{className:"debug-readiness-matrix-summary-pill","data-tone":"danger",children:[o("shell.workspaceDetailDebugCompatibilityUnsupported"),n.jsx("strong",{children:l.unsupportedCount})]}),n.jsxs("span",{className:"debug-readiness-matrix-summary-pill","data-tone":"neutral",children:[o("shell.workspaceDetailDebugCompatibilityUnknown"),n.jsx("strong",{children:l.unknownCount})]})]}),n.jsx("button",{type:"button",className:"secondary-button debug-readiness-matrix-open-button",onClick:s,children:o("shell.workspaceDetailDebugMatrixOpenAction")})]})]}),n.jsx(Fn,{open:r,title:o("shell.workspaceDetailDebugMatrixTitle"),description:o("shell.workspaceDetailDebugMatrixModalDescription"),className:`debug-readiness-matrix-modal-card${t==="mobile"?" debug-readiness-matrix-modal-card-mobile":""}`,onClose:i,children:n.jsxs("div",{className:"debug-readiness-matrix-modal",children:[n.jsxs("div",{className:"debug-readiness-matrix-summary-row debug-readiness-matrix-summary-row-modal",children:[n.jsxs("span",{className:"debug-readiness-matrix-summary-pill","data-tone":"success",children:[o("shell.workspaceDetailDebugCompatibilitySupported"),n.jsx("strong",{children:l.supportedCount})]}),n.jsxs("span",{className:"debug-readiness-matrix-summary-pill","data-tone":"warn",children:[o("shell.workspaceDetailDebugCompatibilityConditional"),n.jsx("strong",{children:l.conditionalCount})]}),n.jsxs("span",{className:"debug-readiness-matrix-summary-pill","data-tone":"danger",children:[o("shell.workspaceDetailDebugCompatibilityUnsupported"),n.jsx("strong",{children:l.unsupportedCount})]}),n.jsxs("span",{className:"debug-readiness-matrix-summary-pill","data-tone":"neutral",children:[o("shell.workspaceDetailDebugCompatibilityUnknown"),n.jsx("strong",{children:l.unknownCount})]})]}),n.jsx("div",{className:"debug-readiness-matrix-table-wrap",children:n.jsxs("table",{className:"debug-readiness-matrix-table",children:[n.jsx("thead",{children:n.jsxs("tr",{children:[n.jsx("th",{scope:"col",children:o("shell.workspaceDetailDebugMatrixFrameworkHeader")}),n.jsx("th",{scope:"col",children:o("shell.workspaceDetailDebugMatrixCompatibilityHeader")}),n.jsx("th",{scope:"col",children:o("shell.workspaceDetailDebugMatrixInjectionHeader")}),n.jsx("th",{scope:"col",children:o("shell.workspaceDetailDebugMatrixDiscoveryHeader")}),n.jsx("th",{scope:"col",children:o("shell.workspaceDetailDebugMatrixHmrHeader")}),n.jsx("th",{scope:"col",children:o("shell.workspaceDetailDebugMatrixCallbackHeader")}),n.jsx("th",{scope:"col",children:o("shell.workspaceDetailDebugMatrixAiHeader")}),n.jsx("th",{scope:"col",children:o("shell.workspaceDetailDebugMatrixNotesHeader")})]})}),n.jsx("tbody",{children:e.map(c=>{const d=FA(c.compatibilityLevel);return n.jsxs("tr",{children:[n.jsx("th",{scope:"row",className:"debug-readiness-matrix-framework-cell",children:c.framework}),n.jsx("td",{children:n.jsx(Ac,{className:"debug-readiness-matrix-badge",tone:d,icon:EK(c.compatibilityLevel),label:IK(c.compatibilityLevel),title:Eo(c.compatibilityLevel)})}),n.jsx("td",{children:n.jsx("span",{className:"debug-readiness-matrix-badge debug-readiness-matrix-badge-subtle","data-tone":"neutral",title:gu(c.recommendedInjectionMode),children:LK(c.recommendedInjectionMode)})}),n.jsx("td",{children:n.jsx(Ac,{className:"debug-readiness-matrix-flag",tone:c.requiresServiceDiscoveryHandling?"warn":"success",icon:c.requiresServiceDiscoveryHandling?"warn":"check",label:Mg(c.requiresServiceDiscoveryHandling),title:Fl(c.requiresServiceDiscoveryHandling)})}),n.jsx("td",{children:n.jsx(Ac,{className:"debug-readiness-matrix-flag",tone:c.requiresHmrHandling?"warn":"success",icon:c.requiresHmrHandling?"warn":"check",label:Mg(c.requiresHmrHandling),title:Fl(c.requiresHmrHandling)})}),n.jsx("td",{children:n.jsx(Ac,{className:"debug-readiness-matrix-flag",tone:c.requiresCallbackHandling?"warn":"success",icon:c.requiresCallbackHandling?"warn":"check",label:Mg(c.requiresCallbackHandling),title:Fl(c.requiresCallbackHandling)})}),n.jsx("td",{children:n.jsx(Ac,{className:"debug-readiness-matrix-badge debug-readiness-matrix-badge-subtle",tone:_K(c.aiFallbackPolicy),icon:OK(c.aiFallbackPolicy),label:FK(c.aiFallbackPolicy),title:Cw(c.aiFallbackPolicy)})}),n.jsx("td",{className:"debug-readiness-matrix-note-cell",children:c.notes})]},c.framework)})})]})}),n.jsxs("div",{className:"debug-readiness-matrix-legend",children:[n.jsx("p",{children:o("shell.workspaceDetailDebugMatrixLegendSummary")}),n.jsxs("div",{className:"debug-readiness-matrix-legend-grid",children:[n.jsxs("div",{children:[n.jsx("strong",{children:o("shell.workspaceDetailDebugMatrixDiscoveryHeader")}),n.jsx("span",{children:o("shell.workspaceDetailDebugMatrixDiscoveryNote")})]}),n.jsxs("div",{children:[n.jsx("strong",{children:o("shell.workspaceDetailDebugMatrixHmrHeader")}),n.jsx("span",{children:o("shell.workspaceDetailDebugMatrixHmrNote")})]}),n.jsxs("div",{children:[n.jsx("strong",{children:o("shell.workspaceDetailDebugMatrixCallbackHeader")}),n.jsx("span",{children:o("shell.workspaceDetailDebugMatrixCallbackNote")})]}),n.jsxs("div",{children:[n.jsx("strong",{children:o("shell.workspaceDetailDebugMatrixAiHeader")}),n.jsx("span",{children:o("shell.workspaceDetailDebugMatrixAiNote")})]})]})]})]})})]})}function Ac({tone:e,icon:t,label:r,title:s,className:i}){return n.jsxs("span",{className:i,"data-tone":e,title:s,children:[n.jsx(kK,{kind:t}),n.jsx("span",{children:r})]})}function kK({kind:e}){return e==="check"?n.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:n.jsx("path",{d:"M3.2 8.3L6.4 11.5L12.8 4.8",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.9"})}):e==="cross"?n.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:n.jsx("path",{d:"M4.4 4.4L11.6 11.6M11.6 4.4L4.4 11.6",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"1.9"})}):e==="warn"?n.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[n.jsx("path",{d:"M8 2.2L14 13.4H2L8 2.2Z",fill:"currentColor",opacity:"0.18"}),n.jsx("path",{d:"M8 5.3V8.8M8 11.3H8.01",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.7"}),n.jsx("path",{d:"M8 2.2L14 13.4H2L8 2.2Z",fill:"none",stroke:"currentColor",strokeLinejoin:"round",strokeWidth:"1.2"})]}):n.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[n.jsx("circle",{cx:"8",cy:"8",r:"5.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4"}),n.jsx("path",{d:"M8 5.1V8.4M8 11H8.01",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"1.7"})]})}function EA(e){switch(e){case"high":return o("shell.workspaceDetailDebugConfidenceHigh");case"medium":return o("shell.workspaceDetailDebugConfidenceMedium");case"low":return o("shell.workspaceDetailDebugConfidenceLow");default:return e}}function yw(e){return e.services.map(t=>{var i;const r=e.analyses.find(l=>l.serviceId===t.id)??null,s=((i=e.runtime)==null?void 0:i.services.find(l=>l.service.id===t.id))??null;return{service:t,analysis:r,runtimeItem:s,category:um(t,r)}})}function kw(e){const t=yw(e),r=t.filter(y=>y.category!=="desktop_shell"),s=r.map(y=>y.analysis).filter(y=>y!==null),i=s.length>0?s:e.analyses,l=i.filter(y=>y.compatibilityLevel==="supported").length,c=i.filter(y=>y.compatibilityLevel==="conditional").length,d=i.filter(y=>y.compatibilityLevel==="unsupported").length,m=i.filter(y=>y.compatibilityLevel==="unknown").length,f=t.filter(y=>y.category==="desktop_shell").length,v=t.length,g=r.length,w=d>0?"danger":c>0?"warn":l>0?"success":"neutral",k=[g>0?{key:"web",label:o("shell.workspaceDetailDebugSummaryWebServicesChip",{count:g}),tone:g===l&&c===0?"success":"warn"}:null,f>0?{key:"desktop-shell",label:o("shell.workspaceDetailDebugSummaryDesktopShellChip",{count:f}),tone:"neutral"}:null,d>0?{key:"unsupported",label:o("shell.workspaceDetailDebugSummaryUnsupportedChip",{count:d}),tone:"danger"}:null].filter(y=>y!==null);return{totalServices:v,webServiceCount:g,desktopShellCount:f,supportedCount:l,conditionalCount:c,unsupportedCount:d,unknownCount:m,autoInjectionEligible:e.autoInjectionEligible,overallTone:w,categoryChips:k}}function xK(e){return{supportedCount:e.filter(t=>t.compatibilityLevel==="supported").length,conditionalCount:e.filter(t=>t.compatibilityLevel==="conditional").length,unsupportedCount:e.filter(t=>t.compatibilityLevel==="unsupported").length,unknownCount:e.filter(t=>t.compatibilityLevel==="unknown").length}}function um(e,t){if((t==null?void 0:t.primaryFramework)==="tauri"||(t==null?void 0:t.primaryFramework)==="electron")return"desktop_shell";switch(e.role){case"frontend":return"frontend";case"backend":return"backend";case"worker":return"worker";case"mock":return"mock";default:return"custom"}}function LA(e){switch(e){case"frontend":return"success";case"backend":return"warn";case"desktop_shell":return"neutral";case"worker":case"mock":case"custom":default:return"neutral"}}function xw(e){return e.unsupportedCount>0?o("shell.workspaceDetailDebugOverallStatusBlocked"):e.conditionalCount>0?o("shell.workspaceDetailDebugOverallStatusConditional"):e.supportedCount>0?o("shell.workspaceDetailDebugOverallStatusSupported"):o("shell.workspaceDetailDebugCompatibilityUnknown")}function Sw(e){return e.totalServices===0?o("shell.workspaceDetailDebugOverallSummaryEmpty"):e.desktopShellCount>0&&e.webServiceCount>0?o("shell.workspaceDetailDebugOverallSummaryMixed",{webCount:e.webServiceCount,desktopCount:e.desktopShellCount}):e.desktopShellCount>0&&e.webServiceCount===0?o("shell.workspaceDetailDebugOverallSummaryDesktopOnly",{count:e.desktopShellCount}):o("shell.workspaceDetailDebugOverallSummaryWebOnly",{count:e.webServiceCount})}function SK(e){return o("shell.workspaceDetailDebugCompatibilityBreakdown",{supported:e.supportedCount,conditional:e.conditionalCount,unsupported:e.unsupportedCount})}function CK(e){switch(e){case"repo":return o("shell.workspaceDetailDebugTargetSourceRepo");case"worktree":return o("shell.workspaceDetailDebugTargetSourceWorktree");default:return o("common.unknown")}}function jK(e){var t,r,s,i,l;return((r=(t=e.runtimeItem)==null?void 0:t.processInstance)==null?void 0:r.status)==="running"?"RUNNING":((i=(s=e.runtimeItem)==null?void 0:s.processInstance)==null?void 0:i.status)==="error"?"FAILED":e.runtimeItem&&((l=e.runtimeItem.binding)==null?void 0:l.status)==="RELEASED"?"STOPPED":null}function TK(e){if(!e)return o("shell.workspaceDetailDebugEmptyReasons");const t=[e.requiresServiceDiscoveryHandling?o("shell.workspaceDetailDebugFailureStageServiceDiscovery"):null,e.requiresHmrHandling?o("shell.workspaceDetailDebugFailureStageHmr"):null,e.requiresCallbackHandling?o("shell.workspaceDetailDebugFailureStageCallback"):null].filter(r=>r!==null);return t.length>0?t.join(" / "):o("shell.workspaceDetailDebugRequirementsNone")}function NK(e){var t;if(e.category==="desktop_shell")return o("shell.workspaceDetailDebugServiceOverviewDesktopShell");switch((t=e.analysis)==null?void 0:t.compatibilityLevel){case"supported":return o("shell.workspaceDetailDebugServiceOverviewSupported");case"conditional":return o("shell.workspaceDetailDebugServiceOverviewConditional");case"unsupported":return o("shell.workspaceDetailDebugServiceOverviewUnsupported");default:return o("shell.workspaceDetailDebugServiceOverviewUnknown")}}function PK(e){var t;if(e.category==="desktop_shell")return o("shell.workspaceDetailDebugServiceActionDesktopShell");switch((t=e.analysis)==null?void 0:t.compatibilityLevel){case"supported":return o("shell.workspaceDetailDebugServiceActionSupported");case"conditional":return o("shell.workspaceDetailDebugServiceActionConditional");case"unsupported":return o("shell.workspaceDetailDebugServiceActionUnsupported");default:return o("shell.workspaceDetailDebugServiceActionUnknown")}}function DK(e){return o("shell.workspaceDetailDebugRuntimeHistoryTitleWithIndex",{id:e.runtimeSession.id.slice(0,8)})}function RK(e){const t=e.services.filter(r=>{var s,i;return((s=r.processInstance)==null?void 0:s.status)==="error"||((i=r.binding)==null?void 0:i.status)==="FAILED"}).map(r=>r.service.name);return t.length>0?o("shell.workspaceDetailDebugRuntimeHistoryFailedSummary",{services:t.join("、")}):o("shell.workspaceDetailDebugRuntimeHistoryGenericSummary")}function AK(e){return e.services.length===0?o("shell.workspaceDetailDebugRuntimeHistoryNoServices"):e.services.map(t=>t.service.name).join("、")}function MK(e){const t=e.services.some(r=>{var s;return((s=r.processInstance)==null?void 0:s.status)==="running"});return e.runtimeSession.status==="RUNNING"||t?o("shell.workspaceDetailDebugRuntimeHistoryResultRunning"):e.runtimeSession.status==="FAILED"?o("shell.workspaceDetailDebugRuntimeHistoryResultFailed"):e.runtimeSession.status==="STOPPED"?o("shell.workspaceDetailDebugRuntimeHistoryResultStopped"):o("shell.workspaceDetailDebugRuntimeHistoryResultPreparing")}function aT(e){if(!e)return o("shell.workspaceDetailDebugFailureStageEmpty");const t=new Date(e);return Number.isNaN(t.getTime())?e:new Intl.DateTimeFormat("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(t)}function Eo(e){switch(e){case"supported":return o("shell.workspaceDetailDebugCompatibilitySupported");case"conditional":return o("shell.workspaceDetailDebugCompatibilityConditional");case"unsupported":return o("shell.workspaceDetailDebugCompatibilityUnsupported");default:return o("shell.workspaceDetailDebugCompatibilityUnknown")}}function IK(e){switch(e){case"supported":return o("shell.workspaceDetailDebugMatrixCompatibilitySupportedShort");case"conditional":return o("shell.workspaceDetailDebugMatrixCompatibilityConditionalShort");case"unsupported":return o("shell.workspaceDetailDebugMatrixCompatibilityUnsupportedShort");default:return o("shell.workspaceDetailDebugMatrixCompatibilityUnknownShort")}}function EK(e){switch(e){case"supported":return"check";case"conditional":return"warn";case"unsupported":return"cross";default:return"neutral"}}function FA(e){switch(e){case"supported":return"success";case"conditional":return"warn";case"unsupported":return"danger";default:return"neutral"}}function gu(e){switch(e){case"cli":return o("shell.workspaceDetailDebugInjectionCli");case"env":return o("shell.workspaceDetailDebugInjectionEnv");case"override":return o("shell.workspaceDetailDebugInjectionOverride");case"ai_fallback":return o("shell.workspaceDetailDebugInjectionAiFallback");default:return o("shell.workspaceDetailDebugInjectionNone")}}function LK(e){switch(e){case"cli":return o("shell.workspaceDetailDebugMatrixInjectionCliShort");case"env":return o("shell.workspaceDetailDebugMatrixInjectionEnvShort");case"override":return o("shell.workspaceDetailDebugMatrixInjectionOverrideShort");case"ai_fallback":return o("shell.workspaceDetailDebugMatrixInjectionAiFallbackShort");default:return o("shell.workspaceDetailDebugMatrixInjectionNoneShort")}}function tu(e){switch(e){case"PREPARING":return o("shell.workspaceDetailDebugRuntimePreparing");case"RUNNING":return o("shell.workspaceDetailDebugRuntimeRunning");case"FAILED":return o("shell.workspaceDetailDebugRuntimeFailed");case"STOPPED":return o("shell.workspaceDetailDebugRuntimeStopped");default:return o("shell.workspaceDetailDebugRuntimeNotStarted")}}function bu(e){switch(e){case null:case"":return o("shell.workspaceDetailDebugFailureStageEmpty");case"service_discovery":return o("shell.workspaceDetailDebugFailureStageServiceDiscovery");case"hmr":return o("shell.workspaceDetailDebugFailureStageHmr");case"callback":return o("shell.workspaceDetailDebugFailureStageCallback");case"ai_fallback_required":return o("shell.workspaceDetailDebugFailureStageAiFallbackRequired");case"adapter_selection":return o("shell.workspaceDetailDebugFailureStageAdapterSelection");case"launch_requirements":return o("shell.workspaceDetailDebugFailureStageLaunchRequirements");case"command_execution":return o("shell.workspaceDetailDebugFailureStageCommandExecution");case"process_exit":return o("shell.workspaceDetailDebugFailureStageProcessExit");case"process_runtime_error":return o("shell.workspaceDetailDebugFailureStageProcessRuntimeError");case"stale_runtime_binding":return o("shell.workspaceDetailDebugFailureStageStaleRuntimeBinding");default:return o("shell.workspaceDetailDebugFailureStageUnknown",{code:e})}}function Fl(e){return o(e?"shell.workspaceDetailDebugRequirementRequired":"shell.workspaceDetailDebugRequirementNotRequired")}function Mg(e){return o(e?"shell.workspaceDetailDebugMatrixRequirementRequiredShort":"shell.workspaceDetailDebugMatrixRequirementNotRequiredShort")}function Cw(e){switch(e){case"never":return o("shell.workspaceDetailDebugAiPolicyNever");case"conditional":return o("shell.workspaceDetailDebugAiPolicyConditional");default:return o("shell.workspaceDetailDebugAiPolicyAllowed")}}function FK(e){switch(e){case"never":return o("shell.workspaceDetailDebugMatrixAiNeverShort");case"conditional":return o("shell.workspaceDetailDebugMatrixAiConditionalShort");default:return o("shell.workspaceDetailDebugMatrixAiAllowedShort")}}function _K(e){switch(e){case"never":return"danger";case"conditional":return"warn";default:return"success"}}function OK(e){switch(e){case"never":return"cross";case"conditional":return"warn";default:return"check"}}function dm(e,t){return e.length>0?e.join(", "):o(t)}function vu(e){switch(e){case"frontend":return o("shell.workspaceDetailDebugRoleFrontend");case"backend":return o("shell.workspaceDetailDebugRoleBackend");case"worker":return o("shell.workspaceDetailDebugRoleWorker");case"mock":return o("shell.workspaceDetailDebugRoleMock");case"desktop_shell":return o("shell.workspaceDetailDebugRoleDesktopShell");default:return o("shell.workspaceDetailDebugRoleCustom")}}function _A(e){return e===null?o("shell.workspaceDetailDebugPortEmpty"):String(e)}function OA(e){switch(e){case"ALLOCATED":return o("shell.workspaceDetailDebugBindingAllocated");case"LISTENING":return o("shell.workspaceDetailDebugBindingListening");case"FAILED":return o("shell.workspaceDetailDebugBindingFailed");case"RELEASED":return o("shell.workspaceDetailDebugBindingReleased");default:return o("shell.workspaceDetailDebugBindingUnknown")}}function BA(e){switch(e){case"creating":return o("shell.workspaceDetailDebugProcessCreating");case"running":return o("shell.workspaceDetailDebugProcessRunning");case"closed":return o("shell.workspaceDetailDebugProcessClosed");case"error":return o("shell.workspaceDetailDebugProcessError");default:return o("shell.workspaceDetailDebugProcessUnknown")}}function BK(e){return e.length===0?o("shell.workspaceDetailDebugAiEditEmpty"):e.map(t=>WK(t)).join(", ")}function WK(e){switch(e){case"PENDING":return o("shell.workspaceDetailDebugAiEditPending");case"APPLIED":return o("shell.workspaceDetailDebugAiEditApplied");case"ROLLED_BACK":return o("shell.workspaceDetailDebugAiEditRolledBack");case"REJECTED":return o("shell.workspaceDetailDebugAiEditRejected");default:return e}}function wu(e,t){const r=oT(t),s=oT(e);return s===r?".":s.startsWith(`${r}/`)?s.slice(r.length+1):s}function jw(e){return[e.command,...e.args].filter(Boolean).join(" ")}function oT(e){return e.replace(/\\/g,"/").replace(/\/+$/g,"")}function WA(e){const[t,r]=p.useState({loading:!1,error:null,targetId:null,targetSourceType:null,autoInjectionEligible:!1,services:[],analyses:[],runtime:null,runtimeHistory:[],matrixItems:[]});p.useEffect(()=>{if(!(e!=null&&e.id)||!e.path){r({loading:!1,error:null,targetId:null,targetSourceType:null,autoInjectionEligible:!1,services:[],analyses:[],runtime:null,runtimeHistory:[],matrixItems:[]});return}let l=!1;return r(c=>({...c,loading:!0,error:null})),(async()=>{try{const c=await l_({workspaceId:e.id,rootPath:e.path}),[d,m]=await Promise.all([c_(c.target.id,5),u_()]),f=UK(d);if(l)return;r({loading:!1,error:null,targetId:c.target.id,targetSourceType:c.target.sourceType,autoInjectionEligible:c.autoInjectionEligible,services:c.services,analyses:c.analyses,runtime:f,runtimeHistory:d.items,matrixItems:m.items})}catch(c){if(l)return;r({loading:!1,error:c instanceof Error?c.message:o("shell.workspaceDetailDebugAnalyzeFailed"),targetId:null,targetSourceType:null,autoInjectionEligible:!1,services:[],analyses:[],runtime:null,runtimeHistory:[],matrixItems:[]})}})(),()=>{l=!0}},[e==null?void 0:e.id,e==null?void 0:e.path]);const s=p.useMemo(()=>HK(t.services,t.analyses),[t.analyses,t.services]),i=p.useMemo(()=>t.matrixItems.find(l=>l.framework===((s==null?void 0:s.primaryFramework)??"unknown"))??null,[s==null?void 0:s.primaryFramework,t.matrixItems]);return{...t,primaryAnalysis:s,currentCompatibilityItem:i}}function UK(e){return e.items[0]??null}function HK(e,t){if(t.length===0)return null;const r=new Map(t.filter(i=>i.serviceId).map(i=>[i.serviceId,i]));return[...e].sort((i,l)=>zK(i,l)).map(i=>r.get(i.id)??null).find(i=>i!==null)??t[0]??null}function zK(e,t){const r=lT(e.role)-lT(t.role);return r!==0?r:e.name.localeCompare(t.name)}function lT(e){switch(e){case"frontend":return 0;case"backend":return 1;case"worker":return 2;case"mock":return 3;default:return 4}}function qK(e){return e.isArchived!==!0&&!ba(e)}function $K(e){return e.isArchived===!0&&!ba(e)}const Ig=60*1e3,Eg=10;function VK(){var Q;const{workspaceId:e=""}=Ho(),t=fr(),{showToast:r}=Qn(),{navigationGroups:s,currentWorkspaceId:i,favoriteSessionIds:l,workspaceManagementStateById:c,selectWorkspace:d,subscribeGitSnapshot:m,requestGitRefresh:f,subscribeWorkspaceManagementSnapshot:v,requestWorkspaceManagementRefresh:g,toggleFavoriteSession:w,archiveSession:k,unarchiveSession:y,startDraftSession:S}=Mr(),[T,j]=p.useState(!1),[N,D]=p.useState(!1),[H,B]=p.useState(Eg),I=Gl(s),A=pa(s,e),L=(A==null?void 0:A.workspace)??null,_=I.find(P=>P.workspace.id===(L==null?void 0:L.id))??(L?{workspace:L,label:L.name,subtitle:L.path}:null),F=p.useMemo(()=>[...(A==null?void 0:A.sessions)??[]].filter(qK),[A]),te=p.useMemo(()=>[...(A==null?void 0:A.sessions)??[]].filter($K),[A]);p.useEffect(()=>{e&&d(e)},[d,e]),p.useEffect(()=>{if(!e)return;m(e),v(e);const P=Ur(YK(e),Ig)!==null,W=Ur(cT(e),Ig)!==null;P||f(e),W||g(e)},[f,g,m,v,e]),p.useEffect(()=>{B(Eg)},[e]);const E=p.useMemo(()=>{if(!e)return{loading:!1,error:null,hasMeaningfulSummary:!1,summary:null};const P=Ur(cT(e),Ig),W=c[e]??null,J=(W==null?void 0:W.detail)??(L?XK(L,P):P??null);return{loading:(W==null?void 0:W.loading)??!1,error:(W==null?void 0:W.error)??null,hasMeaningfulSummary:QK(J),summary:J}},[L,e,c]),se=p.useMemo(()=>E.summary?UP(E.summary.codeComposition.items,o("shell.manageWorkspaceCodeCompositionOther")):[],[E.summary]),X=p.useMemo(()=>se.length>0?HP(se):void 0,[se]),K=p.useMemo(()=>te.slice(0,H),[te,H]),G=WA(L?{id:L.id,path:L.path,name:L.name}:null);async function q(){if(!(!L||!(typeof window>"u"||window.confirm(o("shell.manageWorkspaceRemoveConfirmTarget",{name:L.name}))))){j(!0);try{await wP(L.id),r({title:o("shell.manageWorkspaceRemoveSuccess"),tone:"success"}),t("/workspaces",{replace:!0})}catch(W){r({title:W instanceof Error?W.message:o("shell.manageWorkspaceRemoveFailed"),tone:"error"})}finally{j(!1)}}}function U(P,W){D(!1),S(P,W)}return L?n.jsxs("main",{className:"mobile-feature-page mobile-page-scroll-root mobile-page-with-top-header mobile-workspace-detail-page",children:[n.jsx(Kl,{currentWorkspace:_?{id:_.workspace.id,name:_.label,path:_.subtitle}:null,workspaces:s.map(P=>P.workspace),workspaceOptions:I,heading:o("shell.workspaceDetailTitle"),triggerLabel:(_==null?void 0:_.label)??L.name,onSelectWorkspace:P=>{d(P),t(Fs(P))},content:n.jsxs("div",{className:"mobile-workspace-detail-header-actions",children:[n.jsx("button",{type:"button",className:"primary-button",onClick:()=>D(!0),children:o("shell.createSession")}),n.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{d(L.id),t(XN(L.id))},children:o("shell.filesEntry")}),n.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{d(L.id),t(Ro(L.id))},children:o("shell.terminalsEntry")})]})}),n.jsxs("div",{className:"mobile-page-top-body mobile-workspace-detail-body",children:[n.jsxs("section",{className:"mobile-feature-panel surface-card mobile-workspace-detail-summary-panel",children:[n.jsxs("div",{className:"mobile-feature-section-header",children:[n.jsx("div",{children:n.jsx("h2",{children:o("shell.workspaceDetailSummaryTitle")})}),i!==L.id?n.jsx("button",{type:"button",className:"secondary-button mobile-workspace-detail-switch-button",onClick:()=>d(L.id),children:o("shell.switchWorkspace")}):null]}),E.loading&&E.summary===null?n.jsx("p",{children:o("common.loading")}):null,E.error?n.jsx("p",{className:"status-text","data-tone":"error",children:E.error}):null,E.summary?n.jsxs("div",{className:"mobile-detail-grid mobile-workspace-detail-grid",children:[n.jsxs("div",{className:"mobile-detail-metric mobile-detail-metric-wide",children:[n.jsx("span",{children:o("shell.manageWorkspacePathLabel")}),n.jsx("strong",{title:E.summary.path,children:E.summary.path})]}),n.jsxs("div",{className:"mobile-detail-metric",children:[n.jsx("span",{children:o("shell.manageWorkspaceCurrentBranch")}),n.jsx("strong",{title:E.summary.git.currentBranch??o("common.unknown"),children:E.summary.git.currentBranch??o("common.unknown")})]}),n.jsxs("div",{className:"mobile-detail-metric",children:[n.jsx("span",{children:o("shell.manageWorkspaceGitCommitCount")}),n.jsx("strong",{children:E.hasMeaningfulSummary?E.summary.git.commitCount??0:"—"})]}),n.jsxs("div",{className:"mobile-detail-metric",children:[n.jsx("span",{children:o("shell.manageWorkspaceCodeCompositionFiles")}),n.jsx("strong",{children:E.hasMeaningfulSummary?E.summary.codeComposition.scannedFileCount:"—"})]})]}):null,n.jsxs("div",{className:"mobile-feature-inline-actions mobile-workspace-detail-summary-actions",children:[n.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{d(L.id),t(QN(L.id))},children:o("shell.gitEntry")}),n.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{d(L.id),t(rv(L.id))},children:o("shell.terminalManagerEntry")}),n.jsx("button",{type:"button",className:"secondary-button workbench-danger-button",disabled:T,onClick:()=>{q()},children:o(T?"shell.manageWorkspaceRemoving":"shell.manageWorkspaceRemoveAction")})]})]}),n.jsx(MA,{workspace:L?{id:L.id,path:L.path,name:L.name}:null,state:G,variant:"mobile"}),n.jsxs("section",{className:"mobile-feature-panel surface-card mobile-workspace-composition-panel",children:[n.jsxs("div",{className:"mobile-feature-section-header",children:[n.jsx("div",{children:n.jsx("h2",{children:o("shell.manageWorkspaceCodeCompositionLabel")})}),E.summary?n.jsx("span",{className:"mobile-feature-counter",children:E.summary.codeComposition.scannedFileCount}):null]}),E.loading&&E.summary===null?n.jsx("p",{children:o("common.loading")}):null,E.summary?se.length>0?n.jsxs("div",{className:"workbench-manage-type-chart",children:[n.jsxs("div",{className:"workbench-manage-type-chart-ring",style:X,"aria-hidden":"true",children:[n.jsx("strong",{className:"workbench-manage-type-chart-total",children:E.summary.codeComposition.scannedFileCount}),n.jsx("span",{className:"workbench-manage-type-chart-caption",children:o("shell.manageWorkspaceCodeCompositionFiles")})]}),n.jsx("div",{className:"workbench-manage-type-list",children:se.map(P=>n.jsxs("div",{className:"workbench-manage-type-item",children:[n.jsxs("span",{className:"workbench-manage-type-meta",children:[n.jsx("span",{className:"workbench-manage-type-swatch",style:{backgroundColor:P.color},"aria-hidden":"true"}),n.jsx("span",{className:"workbench-manage-type-name",children:P.type})]}),n.jsxs("span",{children:[P.count," · ",WP(P)]})]},P.key))})]}):n.jsx("p",{children:E.summary.codeComposition.error??o("shell.manageWorkspaceNoCodeComposition")}):null,(Q=E.summary)!=null&&Q.codeComposition.truncated?n.jsx("p",{className:"mobile-workspace-composition-note",children:o("shell.manageWorkspaceCodeTruncated",{count:E.summary.codeComposition.scannedFileCount})}):null]}),n.jsxs("section",{className:"mobile-feature-section",children:[n.jsxs("div",{className:"mobile-feature-section-header",children:[n.jsx("div",{children:n.jsx("h2",{children:o("shell.recentSessionsSectionTitle")})}),n.jsx("span",{className:"mobile-feature-counter",children:F.length})]}),n.jsx("div",{className:"mobile-feature-stack",children:F.length===0?n.jsx("article",{className:"mobile-feature-empty surface-card",children:n.jsx("p",{children:o("shell.emptyWorkspaceSessions")})}):F.map(P=>{const W=Ki(P.title,o("common.unknown")),J=l.includes(P.sessionId);return n.jsxs("article",{className:"mobile-session-row surface-card",children:[n.jsxs("button",{type:"button",className:"mobile-session-row-primary",onClick:()=>t(Yn(L.id,P.sessionId)),children:[n.jsx("span",{className:"mobile-session-row-title",title:W.fullTitle,children:W.displayTitle}),n.jsx("span",{className:"mobile-session-row-provider",children:Vs(P.provider)})]}),n.jsxs("div",{className:"mobile-session-row-actions",children:[n.jsx("span",{className:"mobile-feature-badge mobile-session-row-count",children:P.messageCount}),n.jsx("button",{type:"button",className:"mobile-session-row-action","aria-label":o(J?"shell.unfavoriteAction":"shell.favoriteAction"),title:o(J?"shell.unfavoriteAction":"shell.favoriteAction"),onClick:()=>{w(P.sessionId)},children:n.jsx(GK,{active:J})}),n.jsx("button",{type:"button",className:"mobile-session-row-action","aria-label":o("shell.archiveAction"),title:o("shell.archiveAction"),onClick:()=>{k(P.sessionId)},children:n.jsx(KK,{})})]})]},P.sessionId)})})]}),te.length>0?n.jsxs("section",{className:"mobile-feature-section",children:[n.jsxs("div",{className:"mobile-feature-section-header",children:[n.jsx("div",{children:n.jsx("h2",{children:o("shell.archiveModalTitle")})}),n.jsx("span",{className:"mobile-feature-counter",children:te.length})]}),n.jsx("div",{className:"mobile-feature-stack",children:K.map(P=>n.jsxs("article",{className:"mobile-session-row surface-card",children:[n.jsxs("div",{className:"mobile-session-row-primary mobile-session-row-primary-static",children:[n.jsx("span",{className:"mobile-session-row-title",title:P.title,children:P.title}),n.jsx("span",{className:"mobile-session-row-provider",children:Vs(P.provider)})]}),n.jsx("div",{className:"mobile-session-row-actions",children:n.jsx("button",{type:"button",className:"secondary-button mobile-session-row-restore",onClick:()=>{y(P.sessionId)},children:o("shell.unarchiveAction")})})]},P.sessionId))}),K.length<te.length?n.jsx("button",{type:"button",className:"secondary-button mobile-workspace-detail-expand-button",onClick:()=>{B(P=>P+Eg)},children:o("shell.archiveExpandMore")}):null]}):null]}),n.jsx(ww,{open:N,workspaces:s.map(P=>P.workspace),workspaceOptions:I,initialWorkspaceId:i??L.id,onClose:()=>D(!1),onSelect:U})]}):n.jsx("main",{className:"mobile-feature-page mobile-page-scroll-root",children:n.jsxs("article",{className:"mobile-feature-empty surface-card",children:[n.jsx("h1",{children:o("shell.workspaceDetailMissingTitle")}),n.jsx("p",{children:o("shell.workspaceDetailMissingBody")}),n.jsx("button",{type:"button",className:"secondary-button",onClick:()=>t("/workspaces"),children:o("shell.mobileWorkspacesEntry")})]})})}function GK({active:e}){return n.jsx("svg",{viewBox:"0 0 24 24",fill:e?"currentColor":"none",stroke:"currentColor",strokeWidth:"1.8",children:n.jsx("path",{d:"m12 3.6 2.6 5.2 5.7.8-4.1 4 1 5.7L12 16.5 6.8 19.3l1-5.7-4.1-4 5.7-.8Z"})})}function KK(){return n.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[n.jsx("path",{d:"M4 7.5h16"}),n.jsx("path",{d:"M6.4 7.5h11.2l-.9 10.2a2 2 0 0 1-2 1.8H9.3a2 2 0 0 1-2-1.8Z"}),n.jsx("path",{d:"M8 4.5h8a1.5 1.5 0 0 1 1.5 1.5v1.5h-11V6A1.5 1.5 0 0 1 8 4.5Z"}),n.jsx("path",{d:"M10 11.5h4"})]})}function cT(e){return`workspace-management.summary.${e}`}function YK(e){return`git-sidebar.snapshot.${e}`}function XK(e,t){const r=(t==null?void 0:t.git.repoRoot)??e.repoRoot??null;return{workspaceId:e.id,name:e.name,path:e.path,git:{isRepository:(t==null?void 0:t.git.isRepository)??!!r,repoRoot:r,currentBranch:(t==null?void 0:t.git.currentBranch)??null,commitCount:(t==null?void 0:t.git.commitCount)??null,remotes:(t==null?void 0:t.git.remotes)??[],error:(t==null?void 0:t.git.error)??null},codeComposition:(t==null?void 0:t.codeComposition)??{scannedFileCount:0,truncated:!1,items:[],error:null}}}function QK(e){return e?e.git.isRepository||e.git.repoRoot!==null||e.git.currentBranch!==null||e.git.commitCount!==null||e.git.remotes.length>0||e.codeComposition.scannedFileCount>0||e.codeComposition.items.length>0||e.codeComposition.error!==null:!1}function JK(){var d;const{workspaceId:e=""}=Ho(),t=fr(),{navigationGroups:r,selectWorkspace:s}=Mr(),i=((d=r.find(m=>m.workspace.id===e))==null?void 0:d.workspace)??null;p.useEffect(()=>{e&&s(e)},[s,e]);const l=p.useMemo(()=>i?{id:i.id,path:i.path,name:i.name}:null,[i]),c=WA(l);return i?n.jsx("main",{className:"workbench-page conversation-page-shell debug-readiness-page-shell",children:n.jsx(MA,{workspace:l,state:c,variant:"desktop-page",actions:n.jsx("button",{type:"button",className:"secondary-button",onClick:()=>t(Fs(i.id)),children:o("shell.goBack")})})}):n.jsx("main",{className:"workbench-page conversation-page-shell debug-readiness-page-shell",children:n.jsxs("div",{className:"workbench-empty-guide surface-card",children:[n.jsx("h1",{children:o("shell.workspaceDetailMissingTitle")}),n.jsx("p",{children:o("shell.workspaceDetailMissingBody")})]})})}function ZK({isDesktop:e,viewportClass:t}){return e||t==="expanded"?"desktop":"mobile"}function e7(){const e=sr(),t=ZK(e);return n.jsx(DB,{shellMode:t})}const t7=[{titleKey:"workbench.emptyResumeTitle",bodyKey:"workbench.emptyResumeBody"},{titleKey:"workbench.emptyNewTitle",bodyKey:"workbench.emptyNewBody"},{titleKey:"workbench.emptyCompanionTitle",bodyKey:"workbench.emptyCompanionBody"}];function n7(){return n.jsx("main",{className:"workbench-page conversation-page-shell",children:n.jsx("section",{className:"workbench-center-placeholder",children:n.jsxs("div",{className:"workbench-empty-guide surface-card",children:[n.jsx("p",{className:"workbench-empty-eyebrow",children:o("workbench.emptyEyebrow")}),n.jsx("div",{className:"workbench-empty-main",children:n.jsxs("div",{className:"workbench-empty-copy",children:[n.jsx("h1",{children:o("workbench.emptyTitle")}),n.jsx("p",{className:"workbench-empty-body",children:o("workbench.emptyBody")})]})}),n.jsx("ol",{className:"workbench-empty-steps",children:t7.map((e,t)=>n.jsxs("li",{className:"workbench-empty-step",children:[n.jsx("span",{className:"workbench-empty-step-index",children:t+1}),n.jsxs("div",{className:"workbench-empty-step-copy",children:[n.jsx("h2",{children:o(e.titleKey)}),n.jsx("p",{children:o(e.bodyKey)})]})]},e.titleKey))}),n.jsx("p",{className:"workbench-empty-tip",children:o("workbench.emptyTip")})]})})})}function r7(){const{shellMode:e}=Mr();return e==="mobile"?n.jsx(eo,{to:"/workspaces",replace:!0}):n.jsx(n7,{})}const uT=2e4,s7=1e3,i7=5e3;function a7({isOpen:e,onClose:t}){const[r,s]=p.useState(null),[i,l]=p.useState(null),[c,d]=p.useState(!1),[m,f]=p.useState(!1),[v,g]=p.useState(null),w=p.useRef(null);if(p.useEffect(()=>{if(!e)return;let T=!1;async function j(){d(!0),g(null),l(null);try{const N=await Oe.request("/api/observability/runtime/session",{method:"POST",body:JSON.stringify({ttlMs:uT})});if(T){await Lg(N.sessionId);return}w.current=N.sessionId,s(N);const D=await dT(N.sessionId);if(T){await Lg(N.sessionId);return}l(D)}catch(N){T||g(Fg(N))}finally{T||d(!1)}}return j(),()=>{T=!0;const N=w.current;w.current=null,s(null),l(null),d(!1),f(!1),g(null),N&&Lg(N)}},[e]),p.useEffect(()=>{const T=(r==null?void 0:r.sessionId)??null;if(!e||!T)return;const j=T;let N=!1;async function D(){f(!0);try{const B=await dT(j);N||(l(B),g(null))}catch(B){N||g(Fg(B))}finally{N||f(!1)}}const H=window.setInterval(()=>{D()},s7);return()=>{N=!0,window.clearInterval(H)}},[e,r==null?void 0:r.sessionId]),p.useEffect(()=>{const T=(r==null?void 0:r.sessionId)??null;if(!e||!T)return;const j=T;let N=!1;async function D(){try{const B=await Oe.request(`/api/observability/runtime/session/${j}/heartbeat`,{method:"POST",body:JSON.stringify({ttlMs:uT})});N||s(B)}catch(B){N||g(Fg(B))}}const H=window.setInterval(()=>{D()},i7);return()=>{N=!0,window.clearInterval(H)}},[e,r==null?void 0:r.sessionId]),!e)return null;const k=Object.entries((i==null?void 0:i.backgroundTasks.taskTypes)??{}),y=Object.entries((i==null?void 0:i.schedulers.schedulers)??{}),S=Object.entries((i==null?void 0:i.backgroundTasks.totals)??{});return n.jsxs("div",{className:"workbench-modal-layer","aria-hidden":!e,children:[n.jsx("div",{className:"workbench-modal-backdrop",onClick:t,"aria-hidden":"true"}),n.jsxs("div",{className:"workbench-modal-card surface-card parallel-task-debug-modal-card",role:"dialog","aria-modal":"true","aria-labelledby":"parallel-task-debug-title",children:[n.jsxs("div",{className:"workbench-modal-header",children:[n.jsxs("div",{className:"workbench-modal-title-wrap",children:[n.jsx("h2",{id:"parallel-task-debug-title",children:o("settings.parallelTaskDebugModalTitle")}),n.jsx("p",{children:o("settings.parallelTaskDebugModalDescription")})]}),n.jsxs("div",{className:"workbench-modal-header-actions",children:[n.jsx("span",{className:"parallel-task-debug-status-chip","data-tone":v?"error":"active",children:o(v?"settings.parallelTaskDebugStatusError":"settings.parallelTaskDebugStatusActive")}),n.jsx(zo,{onClick:t,"aria-label":o("settings.parallelTaskDebugClose")})]})]}),n.jsxs("div",{className:"workbench-modal-body parallel-task-debug-body",children:[n.jsxs("div",{className:"parallel-task-debug-meta-grid",children:[n.jsxs("div",{className:"parallel-task-debug-meta-card",children:[n.jsx("span",{children:o("settings.parallelTaskDebugObservedAt")}),n.jsx("strong",{children:_g(i==null?void 0:i.observedAt)})]}),n.jsxs("div",{className:"parallel-task-debug-meta-card",children:[n.jsx("span",{children:o("settings.parallelTaskDebugSessionExpireAt")}),n.jsx("strong",{children:_g(r==null?void 0:r.expiresAt)})]}),n.jsxs("div",{className:"parallel-task-debug-meta-card",children:[n.jsx("span",{children:o("settings.parallelTaskDebugSessionTtl")}),n.jsx("strong",{children:o7((r==null?void 0:r.ttlMs)??null)})]}),n.jsxs("div",{className:"parallel-task-debug-meta-card",children:[n.jsx("span",{children:o("settings.parallelTaskDebugCollectorState")}),n.jsx("strong",{children:i!=null&&i.eventLoop.enabled?o("settings.parallelTaskDebugCollectorEnabled"):o("settings.parallelTaskDebugCollectorDisabled")})]})]}),c?n.jsx("div",{className:"parallel-task-debug-empty",children:o("settings.parallelTaskDebugLoading")}):null,!c&&v?n.jsx("div",{className:"parallel-task-debug-error",children:v}):null,!c&&!v&&i?n.jsxs(n.Fragment,{children:[n.jsxs("section",{className:"parallel-task-debug-section",children:[n.jsxs("div",{className:"parallel-task-debug-section-header",children:[n.jsx("h3",{children:o("settings.parallelTaskDebugCountersTitle")}),n.jsx("span",{children:o(m?"common.loading":"settings.parallelTaskDebugAutoRefresh")})]}),n.jsx("div",{className:"parallel-task-debug-counter-grid",children:S.map(([T,j])=>n.jsxs("div",{className:"parallel-task-debug-counter-card",children:[n.jsx("span",{children:l7(T)}),n.jsx("strong",{children:j})]},T))})]}),n.jsxs("section",{className:"parallel-task-debug-section",children:[n.jsxs("div",{className:"parallel-task-debug-section-header",children:[n.jsx("h3",{children:o("settings.parallelTaskDebugTaskMetricsTitle")}),n.jsx("span",{children:k.length})]}),k.length>0?n.jsx("div",{className:"parallel-task-debug-grid",children:k.map(([T,j])=>n.jsxs("article",{className:"parallel-task-debug-panel",children:[n.jsxs("div",{className:"parallel-task-debug-panel-header",children:[n.jsx("strong",{children:T}),n.jsx("span",{children:hT(j.executionLane)})]}),n.jsxs("div",{className:"parallel-task-debug-panel-body",children:[n.jsxs("span",{children:[o("settings.parallelTaskDebugWaitAvg"),": ",ri(j.waitMs.avg)]}),n.jsxs("span",{children:[o("settings.parallelTaskDebugRunAvg"),": ",ri(j.runMs.avg)]}),n.jsxs("span",{children:[o("settings.parallelTaskDebugRunMax"),": ",ri(j.runMs.max)]}),n.jsxs("span",{children:[o("settings.parallelTaskDebugStartedCount"),": ",j.counters.started??0]}),n.jsxs("span",{children:[o("settings.parallelTaskDebugFinishedCount"),": ",j.counters.finished??0]}),n.jsxs("span",{children:[o("settings.parallelTaskDebugFailedCount"),": ",j.counters.failed??0]}),n.jsxs("span",{children:[o("settings.parallelTaskDebugCacheHitCount"),": ",j.counters.cache_hit??0]})]})]},T))}):n.jsx("div",{className:"parallel-task-debug-empty",children:o("settings.parallelTaskDebugEmpty")})]}),n.jsxs("section",{className:"parallel-task-debug-section",children:[n.jsxs("div",{className:"parallel-task-debug-section-header",children:[n.jsx("h3",{children:o("settings.parallelTaskDebugSchedulerTitle")}),n.jsx("span",{children:y.length})]}),y.length>0?n.jsx("div",{className:"parallel-task-debug-grid",children:y.map(([T,j])=>n.jsxs("article",{className:"parallel-task-debug-panel",children:[n.jsxs("div",{className:"parallel-task-debug-panel-header",children:[n.jsx("strong",{children:T}),n.jsx("span",{children:j.lastIdle?o("settings.parallelTaskDebugIdle"):o("settings.parallelTaskDebugBusy")})]}),n.jsxs("div",{className:"parallel-task-debug-panel-body",children:[n.jsxs("span",{children:[o("settings.parallelTaskDebugTickTotal"),": ",j.tickTotal]}),n.jsxs("span",{children:[o("settings.parallelTaskDebugIdleTickTotal"),": ",j.idleTickTotal]}),n.jsxs("span",{children:[o("settings.parallelTaskDebugTaskCountTotal"),": ",j.taskCountTotal]}),n.jsxs("span",{children:[o("settings.parallelTaskDebugSchedulerErrorTotal"),": ",j.errorTotal]}),n.jsxs("span",{children:[o("settings.parallelTaskDebugLastDuration"),": ",ri(j.lastDurationMs)]}),n.jsxs("span",{children:[o("settings.parallelTaskDebugNextDelay"),": ",ri(j.nextDelayMs)]})]})]},T))}):n.jsx("div",{className:"parallel-task-debug-empty",children:o("settings.parallelTaskDebugEmpty")})]}),n.jsxs("section",{className:"parallel-task-debug-section",children:[n.jsxs("div",{className:"parallel-task-debug-section-header",children:[n.jsx("h3",{children:o("settings.parallelTaskDebugEventLoopTitle")}),n.jsx("span",{children:i.eventLoop.enabled?o("settings.parallelTaskDebugCollectorEnabled"):o("settings.parallelTaskDebugCollectorDisabled")})]}),n.jsxs("div",{className:"parallel-task-debug-counter-grid",children:[n.jsxs("div",{className:"parallel-task-debug-counter-card",children:[n.jsx("span",{children:o("settings.parallelTaskDebugEventLoopResolution")}),n.jsx("strong",{children:ri(i.eventLoop.resolutionMs)})]}),n.jsxs("div",{className:"parallel-task-debug-counter-card",children:[n.jsx("span",{children:o("settings.parallelTaskDebugEventLoopMean")}),n.jsx("strong",{children:ri(i.eventLoop.meanMs)})]}),n.jsxs("div",{className:"parallel-task-debug-counter-card",children:[n.jsx("span",{children:o("settings.parallelTaskDebugEventLoopP95")}),n.jsx("strong",{children:ri(i.eventLoop.p95Ms)})]}),n.jsxs("div",{className:"parallel-task-debug-counter-card",children:[n.jsx("span",{children:o("settings.parallelTaskDebugEventLoopP99")}),n.jsx("strong",{children:ri(i.eventLoop.p99Ms)})]}),n.jsxs("div",{className:"parallel-task-debug-counter-card",children:[n.jsx("span",{children:o("settings.parallelTaskDebugEventLoopMax")}),n.jsx("strong",{children:ri(i.eventLoop.maxMs)})]})]})]}),n.jsxs("section",{className:"parallel-task-debug-section",children:[n.jsxs("div",{className:"parallel-task-debug-section-header",children:[n.jsx("h3",{children:o("settings.parallelTaskDebugRecentActivitiesTitle")}),n.jsx("span",{children:i.recentTaskActivities.length})]}),i.recentTaskActivities.length>0?n.jsx("div",{className:"parallel-task-debug-activity-list",children:i.recentTaskActivities.map(T=>n.jsxs("article",{className:"parallel-task-debug-activity-item",children:[n.jsxs("div",{className:"parallel-task-debug-activity-main",children:[n.jsxs("div",{className:"parallel-task-debug-activity-title-row",children:[n.jsx("strong",{children:T.taskType}),n.jsx("span",{children:c7(T.eventType)}),n.jsx("span",{children:hT(T.executionLane)})]}),n.jsxs("p",{children:[o("settings.parallelTaskDebugTaskKey"),": ",T.key]}),n.jsxs("p",{children:[o("settings.parallelTaskDebugStatus"),": ",T.status?u7(T.status):"-"]})]}),n.jsxs("div",{className:"parallel-task-debug-activity-meta",children:[n.jsx("span",{children:_g(T.recordedAt)}),n.jsxs("span",{children:[o("settings.parallelTaskDebugAttempt"),": ",T.attempt??"-"]}),n.jsxs("span",{children:[o("settings.parallelTaskDebugWaitMs"),": ",ri(T.waitMs)]}),n.jsxs("span",{children:[o("settings.parallelTaskDebugRunMs"),": ",ri(T.runMs)]}),n.jsxs("span",{children:[o("settings.parallelTaskDebugSource"),": ",T.source??"-"]}),T.errorMessage?n.jsxs("span",{children:[o("settings.parallelTaskDebugError"),": ",T.errorMessage]}):null]})]},T.eventId))}):n.jsx("div",{className:"parallel-task-debug-empty",children:o("settings.parallelTaskDebugEmpty")})]})]}):null]})]})]})}async function dT(e){return await Oe.request(`/api/observability/runtime?sessionId=${encodeURIComponent(e)}`)}async function Lg(e){try{await Oe.request(`/api/observability/runtime/session/${e}`,{method:"DELETE"})}catch{}}function Fg(e){return e instanceof Error&&e.message?e.message:o("settings.parallelTaskDebugLoadFailed")}function _g(e){if(!e)return"-";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function ri(e){return e==null||Number.isNaN(e)?"-":`${Math.round(e*100)/100} ms`}function o7(e){return e===null||Number.isNaN(e)?"-":`${Math.round(e/1e3)} s`}function l7(e){switch(e){case"enqueue":return o("settings.parallelTaskDebugMetricEnqueue");case"dedupe":return o("settings.parallelTaskDebugMetricDedupe");case"started":return o("settings.parallelTaskDebugMetricStarted");case"finished":return o("settings.parallelTaskDebugMetricFinished");case"failed":return o("settings.parallelTaskDebugMetricFailed");case"cancelled":return o("settings.parallelTaskDebugMetricCancelled");case"timeout":return o("settings.parallelTaskDebugMetricTimeout");case"cache_hit":return o("settings.parallelTaskDebugMetricCacheHit");default:return e}}function hT(e){switch(e){case"host_background":return o("settings.parallelTaskDebugLaneHostBackground");case"helper_process":return o("settings.parallelTaskDebugLaneHelperProcess");case"external_process":return o("settings.parallelTaskDebugLaneExternalProcess");default:return o("settings.parallelTaskDebugLaneRequestMainThread")}}function c7(e){switch(e){case"enqueued":return o("settings.parallelTaskDebugEventEnqueued");case"deduped":return o("settings.parallelTaskDebugEventDeduped");case"started":return o("settings.parallelTaskDebugEventStarted");case"finished":return o("settings.parallelTaskDebugEventFinished");case"failed":return o("settings.parallelTaskDebugEventFailed");case"cancelled":return o("settings.parallelTaskDebugEventCancelled");case"timeout":return o("settings.parallelTaskDebugEventTimeout");case"cache_hit":return o("settings.parallelTaskDebugEventCacheHit");default:return e}}function u7(e){switch(e){case"queued":return o("settings.parallelTaskDebugTaskStatusQueued");case"running":return o("settings.parallelTaskDebugTaskStatusRunning");case"succeeded":return o("settings.parallelTaskDebugTaskStatusSucceeded");case"failed":return o("settings.parallelTaskDebugTaskStatusFailed");case"cancelled":return o("settings.parallelTaskDebugTaskStatusCancelled");case"timeout":return o("settings.parallelTaskDebugTaskStatusTimeout");default:return e}}async function mT(){const e=Gs(),t=Rn.getState(),r=await e.bridge.getAndroidRuntimeInfo();if(!r.ok||!r.value)throw new Error(r.detail??"读取 Android 运行时信息失败。");const s=await Oe.request(`/api/client/release-manifest?channel=${encodeURIComponent(t.releaseChannel)}&platform=android-apk`),i=s.versionCode>r.value.versionCode;return{checkedAt:new Date().toISOString(),currentVersion:r.value.version,currentVersionCode:r.value.versionCode,hasUpdate:i,manifest:s,runtimeInfo:r.value}}async function d7(e){return Gs().bridge.installAndroidUpdate(e)}function h7(){const[e,t]=p.useState(!1),[r,s]=p.useState(!1),[i,l]=p.useState(null),[c,d]=p.useState(null),[m,f]=p.useState(null),[v,g]=p.useState(!1),[w,k]=p.useState(null),y=p.useRef(!1);p.useEffect(()=>{if(w===null){y.current=!1;return}const j=w;async function N(){if(!y.current){y.current=!0;try{const B=await mT();if(f(B.manifest),d(B.currentVersion),g(B.hasUpdate),!B.hasUpdate||B.currentVersionCode>=j){l(o("settings.androidInstallSucceeded"));return}l(o("settings.androidInstallCancelled"))}catch(B){l(B instanceof Error?B.message:o("settings.releaseCheckFailed"))}finally{k(null)}}}function D(){N()}function H(){document.visibilityState==="visible"&&N()}return window.addEventListener("focus",D),document.addEventListener("visibilitychange",H),()=>{window.removeEventListener("focus",D),document.removeEventListener("visibilitychange",H)}},[w]);async function S(){t(!0),l(null),k(null);try{const j=await mT();f(j.manifest),d(j.currentVersion),g(j.hasUpdate),l(j.hasUpdate?o("settings.releaseUpdateReady"):o("settings.releaseUpToDate"))}catch(j){l(j instanceof Error?j.message:o("settings.releaseCheckFailed"))}finally{t(!1)}}async function T(){if(m){s(!0),l(null),k(null);try{const j=await d7(m);if(j.status==="installer_started"){l(o("settings.androidInstallerStarted")),k(m.versionCode);return}if(j.status==="permission_required"){l(j.detail??o("settings.androidInstallPermissionRequired")),k(null);return}if(j.status==="already_up_to_date"){l(o("settings.releaseUpToDate")),g(!1),k(null);return}l(j.detail??o("settings.releaseInstallFailed")),k(null)}catch(j){l(j instanceof Error?j.message:o("settings.releaseInstallFailed")),k(null)}finally{s(!1)}}}return n.jsxs("div",{className:"settings-update-card",children:[n.jsxs("div",{className:"settings-update-summary",children:[n.jsxs("div",{className:"settings-update-field",children:[n.jsx("span",{className:"settings-update-label",children:o("settings.releaseCurrentVersion")}),n.jsx("strong",{className:"settings-update-value",children:c??o("settings.releaseUnknownVersion")})]}),n.jsxs("div",{className:"settings-update-field",children:[n.jsx("span",{className:"settings-update-label",children:o("settings.releaseTargetVersion")}),n.jsx("strong",{className:"settings-update-value",children:(m==null?void 0:m.version)??"-"})]})]}),i?n.jsx("p",{className:"settings-update-status","data-tone":v?"warning":"success",children:i}):null,n.jsxs("div",{className:"settings-update-actions",children:[n.jsx("button",{className:"secondary-button",type:"button",disabled:e||r,onClick:S,children:o(e?"common.loading":"settings.releaseCheckNow")}),n.jsx("button",{className:"primary-button",type:"button",disabled:!m||!v||r,onClick:T,children:o(r?"common.loading":"settings.releaseInstallNow")})]})]})}function m7(){const e=Gs(),t=e.isDesktop,[r,s]=p.useState(!1),[i,l]=p.useState(!1),[c,d]=p.useState(!1),[m,f]=p.useState(null),v=FN(D=>D.latestState),g=(v==null?void 0:v.currentVersion)??null,w=(v==null?void 0:v.manifest)??null,k=(v==null?void 0:v.hasUpdate)??!1;async function y(){s(!0),f(null);try{const D=await _N({notify:"always"});f(pT(D.manifest,D.hasUpdate))}catch(D){f(D instanceof Error?D.message:o("settings.releaseCheckFailed"))}finally{s(!1)}}async function S(){if(!(!w||!k)){l(!0),f(null);try{const D=await PL();if(!D.ok){f(D.detail??o("settings.releaseInstallFailed"));return}f(o("settings.releaseInstallStarted")),await e.bridge.showNotification(o("settings.releaseInstallStarted"),w.version)}catch(D){f(D instanceof Error?D.message:o("settings.releaseInstallFailed"))}finally{l(!1)}}}async function T(){if(w!=null&&w.htmlUrl){d(!0);try{const D=await e.bridge.openExternal(w.htmlUrl);D.ok||f(D.detail??o("settings.releasePageOpenFailed"))}catch(D){f(D instanceof Error?D.message:o("settings.releasePageOpenFailed"))}finally{d(!1)}}}const j=!!(t&&w&&k),N=m??(t?v?pT(v.manifest,v.hasUpdate):null:o("settings.clientUpdateUnsupported"));return n.jsxs("div",{className:"settings-update-card",children:[n.jsxs("div",{className:"settings-update-summary",children:[n.jsxs("div",{className:"settings-update-field",children:[n.jsx("span",{className:"settings-update-label",children:o("settings.releaseCurrentVersion")}),n.jsx("strong",{className:"settings-update-value",children:g??o("settings.releaseUnknownVersion")})]}),n.jsxs("div",{className:"settings-update-field",children:[n.jsx("span",{className:"settings-update-label",children:o("settings.releaseTargetVersion")}),n.jsx("strong",{className:"settings-update-value",children:(w==null?void 0:w.version)??"-"})]})]}),N?n.jsx("p",{className:"settings-update-status","data-tone":p7(w,k,N),children:N}):null,n.jsxs("div",{className:"settings-update-actions",children:[n.jsx("button",{className:"secondary-button",type:"button",disabled:!t||r||i,onClick:y,children:o(r?"common.loading":"settings.releaseCheckNow")}),n.jsx("button",{className:"primary-button",type:"button",disabled:!j||i,onClick:S,children:o(i?"common.loading":"settings.releaseInstallNow")}),n.jsx("button",{className:"secondary-button",type:"button",disabled:!(w!=null&&w.htmlUrl)||r||i||c,onClick:T,children:o(c?"common.loading":"settings.releaseOpenPage")})]})]})}function pT(e,t){return o(t?"settings.releaseUpdateReady":"settings.releaseUpToDate")}function p7(e,t,r){return r===o("settings.clientUpdateUnsupported")?"neutral":t?"warning":"success"}function UA(){const e=Gs();return e.platform==="desktop"?n.jsx(m7,{}):e.platform==="android"?n.jsx(h7,{}):n.jsx("div",{className:"settings-update-card",children:n.jsx("p",{className:"settings-update-status","data-tone":"neutral",children:o("settings.clientUpdateUnsupported")})})}async function fT(){return await Oe.request("/api/system/model-switch")}async function f7(e){return await Oe.request("/api/system/model-switch",{method:"POST",body:JSON.stringify(e)})}const g7=/(https?:\/\/[^\s]+)/i;function HA(){const e=xu(B=>{var I;return((I=B.session)==null?void 0:I.accessToken)??null}),[t,r]=p.useState(null),[s,i]=p.useState(!0),[l,c]=p.useState(null),[d,m]=p.useState(null),[f,v]=p.useState(null),[g,w]=p.useState(!1),[k,y]=p.useState("codex");p.useEffect(()=>{let B=!0;if(!e){r(null),m(null),v(null),i(!1);return}return(async()=>{i(!0);try{const A=await fT();if(!B)return;r(A),m(null),y(L=>bT(A,L))}catch(A){if(!B)return;m(Og(A))}finally{B&&i(!1)}})(),()=>{B=!1}},[e]);async function S(){const B=await fT();r(B),m(null),y(I=>bT(B,I))}async function T(){if(e){c("refresh"),m(null),v(null);try{await S(),v(o("settings.modelManagementRefreshSuccess"))}catch(B){m(Og(B))}finally{c(null)}}}async function j(B,I){if(!e||I.isCurrent)return;const A=gT(B,I.id);c(A),m(null),v(null);try{const L=await f7({app:B,presetId:I.id});QP(),r(_=>b7(_,L)),v(o("settings.modelManagementSwitchSuccess",{app:L.displayName,preset:L.currentPresetName??I.name}))}catch(L){m(Og(L))}finally{c(null)}}const N=(t==null?void 0:t.items)??[],D=N.find(B=>B.app===k)??N[0]??null,H=w7(N);return n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"settings-model-panel",children:n.jsxs("div",{className:"settings-release-card",children:[f?n.jsx("p",{className:"settings-release-status",children:f}):null,d?n.jsx("p",{className:"settings-release-status",children:d}):null,H?n.jsxs("section",{className:"settings-model-missing-state",children:[n.jsx("p",{className:"settings-model-missing-copy",children:H.message}),n.jsx("a",{className:"settings-tailscale-link settings-model-missing-link",href:H.url,rel:"noreferrer",target:"_blank",children:H.url})]}):N.length>0?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"settings-model-grid",children:N.map(B=>n.jsxs("section",{className:"settings-model-card",children:[n.jsxs("div",{className:"settings-model-card-main",children:[n.jsxs("div",{className:"settings-model-card-copy",children:[n.jsx("strong",{className:"settings-model-card-title",children:B.displayName}),n.jsx("span",{className:"settings-model-card-status","data-status":B.status,children:v7(B.status)})]}),n.jsxs("div",{className:"settings-model-value-line",children:[n.jsx("strong",{className:"settings-model-preset-value",children:B.currentPresetName??o("settings.modelManagementPresetMissing")}),n.jsx("strong",{className:"settings-model-current-value",children:B.currentModel??o("settings.modelManagementModelUnknown")})]})]}),B.statusText?n.jsx("p",{className:"settings-model-card-note",children:B.statusText}):null]},B.app))}),n.jsx("div",{className:"settings-model-panel-actions",children:n.jsx("button",{className:"secondary-button settings-model-open-action",type:"button",disabled:!e||s,onClick:()=>{w(!0)},children:o("settings.modelManagementOpenSwitcher")})})]}):n.jsx("div",{className:"settings-model-empty",children:o("settings.modelManagementOptionsEmpty")})]})}),n.jsxs(Fn,{open:g&&!H,title:o("settings.modelManagementModalTitle"),description:o("settings.modelManagementModalDescription"),className:"settings-model-modal",headerActions:n.jsx("button",{className:"secondary-button",type:"button",disabled:!e||s||l!==null,onClick:()=>{T()},children:o(l==="refresh"?"common.loading":"settings.modelManagementRefresh")}),onClose:()=>w(!1),children:[n.jsx("div",{className:"settings-model-tabs",role:"tablist","aria-label":o("settings.modelManagementTabsLabel"),children:N.map(B=>{const I=(D==null?void 0:D.app)===B.app;return n.jsx("button",{type:"button",role:"tab",className:"settings-model-tab","aria-selected":I,"data-active":I?"true":"false",onClick:()=>y(B.app),children:B.displayName},B.app)})}),D?n.jsxs("section",{className:"settings-model-modal-panel",children:[n.jsxs("div",{className:"settings-model-modal-summary",children:[n.jsxs("div",{className:"settings-model-modal-summary-row",children:[n.jsx("span",{children:o("settings.modelManagementCurrentProfile")}),n.jsx("strong",{children:D.currentPresetName??o("settings.modelManagementPresetMissing")})]}),n.jsxs("div",{className:"settings-model-modal-summary-row",children:[n.jsx("span",{children:o("settings.modelManagementCurrentModel")}),n.jsx("strong",{children:D.currentModel??o("settings.modelManagementModelUnknown")})]})]}),D.statusText?n.jsx("p",{className:"settings-model-modal-note",children:D.statusText}):null,D.options.length>0?n.jsx("div",{className:"settings-model-switcher-list",children:D.options.map(B=>{const I=gT(D.app,B.id);return n.jsxs("div",{className:"settings-model-switcher-item","data-current":B.isCurrent?"true":"false",children:[n.jsxs("div",{className:"settings-model-switcher-item-main",children:[n.jsx("strong",{children:B.name}),n.jsx("span",{children:B.model??o("settings.modelManagementModelUnknown")})]}),n.jsx("div",{className:"settings-model-switcher-item-actions",children:B.isCurrent?n.jsx("span",{className:"settings-model-card-status","data-status":"ready",children:o("settings.modelManagementCurrentTag")}):n.jsx("button",{className:"secondary-button settings-model-option-action",type:"button",disabled:s||l!==null||D.status!=="ready",onClick:()=>{j(D.app,B)},children:o(l===I?"common.loading":"settings.modelManagementSwitchAction")})})]},`${D.app}:${B.id}`)})}):n.jsx("div",{className:"settings-model-empty",children:D.statusText??o("settings.modelManagementOptionsEmpty")})]}):n.jsx("div",{className:"settings-model-empty",children:o("settings.modelManagementOptionsEmpty")})]})]})}function gT(e,t){return`switch:${e}:${t}`}function b7(e,t){return e&&{...e,scannedAt:new Date().toISOString(),items:e.items.map(r=>r.app===t.app?t:r)}}function bT(e,t){var s;return e.items.some(i=>i.app===t)?t:((s=e.items[0])==null?void 0:s.app)??"codex"}function v7(e){switch(e){case"unconfigured":return o("settings.modelManagementStatusUnconfigured");case"unavailable":return o("settings.modelManagementStatusUnavailable");case"error":return o("settings.modelManagementStatusError");default:return o("settings.modelManagementStatusReady")}}function Og(e){return e instanceof Kr?e.message||o("settings.modelManagementLoadFailed"):e instanceof Error?e.message:o("settings.modelManagementLoadFailed")}function w7(e){var i,l,c;if(e.length===0||!e.every(d=>d.status==="unavailable"&&!d.cliAvailable&&!!d.statusText))return null;const t=((l=(i=e[0])==null?void 0:i.statusText)==null?void 0:l.trim())??"",r=((c=t.match(g7))==null?void 0:c[1])??"";return r?{message:t.replace(r,"").trim(),url:r}:null}async function vT(){const e=Rn.getState();return Oe.request(`/api/client/service-update?channel=${encodeURIComponent(e.releaseChannel)}`)}async function y7(e){const t=Rn.getState();return Oe.request("/api/client/service-update/install",{method:"POST",body:JSON.stringify({packageName:e,channel:t.releaseChannel})})}async function k7(e){return Oe.request(`/api/client/service-update/tasks/${encodeURIComponent(e)}`)}const x7=1500;function zA(){const e=Gs(),[t,r]=p.useState(!1),[s,i]=p.useState(!1),[l,c]=p.useState(null),[d,m]=p.useState(null),[f,v]=p.useState(null),g=(d==null?void 0:d.packages[0])??null;p.useEffect(()=>{if(!f||!Bg(f.status))return;let S=!1;const T=window.setTimeout(async()=>{var j;try{const N=await k7(f.taskId);if(S)return;if(v(N),c(Ob(N)),!Bg(N.status)){i(!1);const D=await vT();if(S)return;m(D),v(((j=D.packages[0])==null?void 0:j.installTask)??N),c(wT(D.packages[0]??null,N)),N.restartRequired&&await e.bridge.showNotification(o("settings.serverRestartRequired"),N.targetVersion??"-")}}catch(N){if(S)return;i(!1),c(N instanceof Error?N.message:o("settings.serverInstallFailed"))}},x7);return()=>{S=!0,window.clearTimeout(T)}},[e.bridge,f]);async function w(){r(!0),c(null);try{const S=await vT(),T=S.packages[0]??null;m(S),v((T==null?void 0:T.installTask)??null),c(wT(T,(T==null?void 0:T.installTask)??null)),T!=null&&T.hasUpdate&&await e.bridge.showNotification(o("settings.serverUpdateReady"),`${o("settings.serverTargetVersion")}: ${T.latestVersion??"-"}`)}catch(S){c(S instanceof Error?S.message:o("settings.serverCheckFailed"))}finally{r(!1)}}async function k(){if(g!=null&&g.packageName){i(!0),c(null);try{const S=await y7(g.packageName);v(S),c(Ob(S))}catch(S){i(!1),c(S instanceof Error?S.message:o("settings.serverInstallFailed"))}}}const y=!!(g&&g.checkStatus!=="check_failed"&&g.hasUpdate&&!g.restartRequired&&!Bg(f==null?void 0:f.status));return n.jsxs("div",{className:"settings-update-card",children:[n.jsxs("div",{className:"settings-update-summary",children:[n.jsxs("div",{className:"settings-update-field",children:[n.jsx("span",{className:"settings-update-label",children:o("settings.serverCurrentVersion")}),n.jsx("strong",{className:"settings-update-value",children:(g==null?void 0:g.currentVersion)??"-"})]}),n.jsxs("div",{className:"settings-update-field",children:[n.jsx("span",{className:"settings-update-label",children:o("settings.serverTargetVersion")}),n.jsx("strong",{className:"settings-update-value",children:(g==null?void 0:g.latestVersion)??"-"})]})]}),l?n.jsx("p",{className:"settings-update-status","data-tone":S7(g,f),children:l}):null,n.jsxs("div",{className:"settings-update-actions",children:[n.jsx("button",{className:"secondary-button",type:"button",disabled:t||s,onClick:w,children:o(t?"common.loading":"settings.serverCheckNow")}),n.jsx("button",{className:"primary-button",type:"button",disabled:!y||t||s,onClick:k,children:o(s?"common.loading":"settings.serverInstallNow")})]})]})}function wT(e,t){return t?Ob(t):e?e.restartRequired?o("settings.serverRestartRequired"):e.checkStatus==="check_failed"?e.checkError??o("settings.serverCheckFailed"):e.latestVersion?e.hasUpdate?o("settings.serverUpdateReady"):o("settings.serverUpToDate"):o("settings.serverLatestUnknown"):o("settings.serverCheckNow")}function Ob(e){switch(e.status){case"queued":return o("settings.serverInstallQueued");case"running":return o("settings.serverInstalling");case"succeeded":return e.restartRequired?o("settings.serverRestartRequired"):o("settings.serverInstallSucceeded");case"cancelled":return o("settings.serverInstallCancelled");case"timeout":return o("settings.serverInstallTimeout");case"failed":return e.errorMessage??o("settings.serverInstallFailed");default:return e.errorMessage??o("settings.serverInstallFailed")}}function S7(e,t){if(t)switch(t.status){case"queued":case"running":return"warning";case"succeeded":return t.restartRequired?"warning":"success";case"failed":case"cancelled":case"timeout":return"danger";default:return"neutral"}return e?e.checkStatus==="check_failed"?"danger":e.restartRequired||e.hasUpdate?"warning":"success":"neutral"}function Bg(e){return e==="queued"||e==="running"}async function yT(){return await Oe.request("/api/skills/overview")}async function C7(e){await Oe.request("/api/skills/import",{method:"POST",body:JSON.stringify(e)})}async function j7(e){await Oe.request("/api/skills/sync",{method:"POST",body:JSON.stringify(e)})}function qA(){const e=xu(N=>{var D;return((D=N.session)==null?void 0:D.accessToken)??null}),[t,r]=p.useState(null),[s,i]=p.useState(!0),[l,c]=p.useState(null),[d,m]=p.useState(null),[f,v]=p.useState(null),[g,w]=p.useState(!1);p.useEffect(()=>{let N=!0;if(!e){r(null),m(null),v(null),i(!1);return}return(async()=>{i(!0);try{const H=await yT();if(!N)return;r(H),m(null)}catch(H){if(!N)return;m(ph(H))}finally{N&&i(!1)}})(),()=>{N=!1}},[e]);async function k(){const N=await yT();r(N),m(null)}async function y(){if(e){c("refresh"),m(null),v(null);try{await k(),v(o("settings.skillRefreshSuccess"))}catch(N){m(ph(N))}finally{c(null)}}}async function S(N){if(e){c(kT(N)),m(null),v(null);try{await C7({targetCli:N.targetCli,directoryPath:N.directoryPath,expectedContentHash:N.contentHash}),await k(),v(o("settings.skillImportSuccess",{name:N.name,target:Ic(N.targetCli)}))}catch(D){m(ph(D))}finally{c(null)}}}async function T(N){if(!e)return;const D=N.bindings.filter(H=>H.enabled).map(H=>H.targetCli);if(D.length===0){m(o("settings.skillSyncTargetMissing"));return}c(xT(N.skill.id)),m(null),v(null);try{await j7({skillId:N.skill.id,targetCli:D}),await k(),v(o("settings.skillSyncSuccess",{name:N.skill.name}))}catch(H){m(ph(H))}finally{c(null)}}const j=(t==null?void 0:t.summary)??{managedSkillCount:0,managedEntryCount:0,unmanagedEntryCount:0,conflictedEntryCount:0,diagnosticCount:0};return n.jsxs("div",{className:"settings-skill-panel",children:[n.jsxs("div",{className:"settings-release-card",children:[n.jsxs("div",{className:"settings-skill-summary-grid",children:[n.jsx(Mc,{label:o("settings.skillSummaryManagedSkills"),value:String(j.managedSkillCount)}),n.jsx(Mc,{label:o("settings.skillSummaryManagedEntries"),value:String(j.managedEntryCount)}),n.jsx(Mc,{label:o("settings.skillSummaryUnmanagedEntries"),value:String(j.unmanagedEntryCount)}),n.jsx(Mc,{label:o("settings.skillSummaryConflictedEntries"),value:String(j.conflictedEntryCount)}),n.jsx(Mc,{label:o("settings.skillSummaryDiagnostics"),value:String(j.diagnosticCount)})]}),n.jsx("div",{className:"settings-release-actions settings-skill-panel-actions",children:n.jsx("button",{className:"secondary-button",type:"button",disabled:!e,onClick:()=>{w(!0)},children:o("settings.skillManageAction")})})]}),n.jsxs(Fn,{open:g,title:o("settings.skillConfigModalTitle"),description:o("settings.skillConfigModalDescription"),className:"settings-skill-modal",headerActions:n.jsx("button",{className:"secondary-button",type:"button",disabled:!e||s||l!==null,onClick:()=>{y()},children:o(l==="refresh"?"common.loading":"settings.skillRefresh")}),onClose:()=>w(!1),children:[n.jsx("div",{className:"settings-release-meta",children:n.jsxs("span",{children:[o("settings.skillScannedAt"),": ",s?o("common.loading"):N7(t==null?void 0:t.scannedAt)]})}),f?n.jsx("p",{className:"settings-release-status",children:f}):null,d?n.jsx("p",{className:"settings-release-status",children:d}):null,n.jsx(mh,{title:o("settings.skillManagedListTitle"),emptyText:o("settings.skillManagedEmpty"),items:(t==null?void 0:t.managedSkills)??[],renderItem:N=>{const D=xT(N.skill.id);return n.jsxs("div",{className:"settings-skill-entry",children:[n.jsxs("div",{className:"settings-skill-entry-main",children:[n.jsx("strong",{className:"settings-skill-entry-title",children:N.skill.name}),n.jsxs("p",{className:"settings-skill-entry-meta",children:[o("settings.skillDirectoryName"),": ",N.skill.directoryName]}),n.jsxs("p",{className:"settings-skill-entry-meta",children:[o("settings.skillSsotPath"),": ",n.jsx("span",{className:"settings-skill-path",children:N.ssotPath})]}),n.jsx("div",{className:"settings-skill-tags",children:N.bindings.map(H=>n.jsxs("span",{className:"settings-skill-tag","data-status":H.syncStatus,children:[Ic(H.targetCli)," · ",T7(H.syncStatus)]},`${N.skill.id}-${H.targetCli}`))})]}),n.jsx("div",{className:"settings-skill-entry-actions",children:n.jsx("button",{className:"secondary-button",type:"button",disabled:s||l!==null,onClick:()=>{T(N)},children:o(l===D?"common.loading":"settings.skillSyncAction")})})]},N.skill.id)}}),n.jsx(mh,{title:o("settings.skillUnmanagedListTitle"),emptyText:o("settings.skillUnmanagedEmpty"),items:(t==null?void 0:t.unmanagedEntries)??[],renderItem:N=>{const D=kT(N);return n.jsxs("div",{className:"settings-skill-entry",children:[n.jsxs("div",{className:"settings-skill-entry-main",children:[n.jsx("strong",{className:"settings-skill-entry-title",children:N.name}),n.jsxs("p",{className:"settings-skill-entry-meta",children:[o("settings.skillSourceCli"),": ",Ic(N.targetCli)]}),n.jsxs("p",{className:"settings-skill-entry-meta",children:[o("settings.skillDirectoryPath"),": ",n.jsx("span",{className:"settings-skill-path",children:N.directoryPath})]})]}),n.jsx("div",{className:"settings-skill-entry-actions",children:n.jsx("button",{className:"secondary-button",type:"button",disabled:s||l!==null,onClick:()=>{S(N)},children:o(l===D?"common.loading":"settings.skillImportAction")})})]},`${N.targetCli}:${N.directoryPath}`)}}),n.jsx(mh,{title:o("settings.skillConflictedListTitle"),emptyText:o("settings.skillConflictedEmpty"),items:(t==null?void 0:t.conflictedEntries)??[],renderItem:N=>n.jsx("div",{className:"settings-skill-entry",children:n.jsxs("div",{className:"settings-skill-entry-main",children:[n.jsx("strong",{className:"settings-skill-entry-title",children:N.name}),n.jsxs("p",{className:"settings-skill-entry-meta",children:[o("settings.skillSourceCli"),": ",Ic(N.targetCli)]}),n.jsxs("p",{className:"settings-skill-entry-meta",children:[o("settings.skillDirectoryPath"),": ",n.jsx("span",{className:"settings-skill-path",children:N.directoryPath})]})]})},`${N.targetCli}:${N.directoryPath}`)}),n.jsx(mh,{title:o("settings.skillDiagnosticsTitle"),emptyText:o("settings.skillDiagnosticsEmpty"),items:(t==null?void 0:t.diagnostics)??[],renderItem:N=>n.jsx("div",{className:"settings-skill-entry",children:n.jsxs("div",{className:"settings-skill-entry-main",children:[n.jsxs("strong",{className:"settings-skill-entry-title",children:[Ic(N.targetCli)," · ",N.code]}),n.jsx("p",{className:"settings-skill-entry-meta",children:N.detail}),n.jsxs("p",{className:"settings-skill-entry-meta",children:[o("settings.skillDirectoryPath"),":"," ",n.jsx("span",{className:"settings-skill-path",children:N.directoryPath??N.rootDir})]})]})},`${N.targetCli}:${N.code}:${N.directoryPath??N.rootDir}`)})]})]})}function mh({title:e,emptyText:t,items:r,renderItem:s}){return n.jsxs("section",{className:"settings-skill-section",children:[n.jsx("h3",{className:"settings-skill-section-title",children:e}),r.length>0?n.jsx("div",{className:"settings-skill-entry-list",children:r.map(i=>s(i))}):n.jsx("div",{className:"settings-skill-empty",children:t})]})}function Mc({label:e,value:t}){return n.jsxs("div",{className:"settings-skill-summary-card",children:[n.jsx("span",{children:e}),n.jsx("strong",{children:t})]})}function kT(e){return`import:${e.targetCli}:${e.directoryPath}`}function xT(e){return`sync:${e}`}function ph(e){return e instanceof Kr?e.message||o("settings.skillLoadFailed"):e instanceof Error?e.message:o("settings.skillLoadFailed")}function Ic(e){switch(e){case"claude-code":return o("settings.skillTargetClaudeCode");case"gemini":return o("settings.skillTargetGemini");case"opencode":return o("settings.skillTargetOpenCode");default:return o("settings.skillTargetCodex")}}function T7(e){switch(e){case"conflicted":return o("settings.skillBindingConflicted");case"failed":return o("settings.skillBindingFailed");case"pending":return o("settings.skillBindingPending");default:return o("settings.skillBindingSynced")}}function N7(e){if(!e)return"-";const t=Date.parse(e);return Number.isNaN(t)?e:new Date(t).toLocaleString()}async function ST(){return await Oe.request("/api/system/tailscale/status")}async function P7(e){return await Oe.request("/api/system/tailscale/config",{method:"PUT",body:JSON.stringify(e)})}async function D7(){return await Oe.request("/api/system/tailscale/enable",{method:"POST"})}async function R7(){return await Oe.request("/api/system/tailscale/disable",{method:"POST"})}async function A7(){return await Oe.request("/api/system/tailscale/login",{method:"POST"})}async function M7(){return await Oe.request("/api/system/tailscale/logout",{method:"POST"})}function $A(){const e=sr(),[t,r]=p.useState(null),[s,i]=p.useState(""),[l,c]=p.useState(""),[d,m]=p.useState(!0),[f,v]=p.useState(null),[g,w]=p.useState(null),[k,y]=p.useState(!1),[S,T]=p.useState(!1),j=p.useRef(!0),N=p.useRef(!1),D=p.useRef(async()=>{});N.current=S;function H(X){r(X),i(X.controlServerUrl??""),c(X.hostname??""),w(null),N.current&&!jT(X.lastError)&&T(!1)}D.current=async X=>{X||m(!0);try{const K=await ST();if(!j.current)return;H(K)}catch(K){if(!j.current)return;w(gh(K))}finally{j.current&&!X&&m(!1)}},p.useEffect(()=>{j.current=!0,D.current(!1);const X=window.setInterval(()=>{D.current(!0)},5e3);return()=>{j.current=!1,window.clearInterval(X)}},[]),p.useEffect(()=>{if(!S)return;function X(){D.current(!0)}function K(){document.visibilityState==="visible"&&D.current(!0)}return window.addEventListener("focus",X),document.addEventListener("visibilitychange",K),()=>{window.removeEventListener("focus",X),document.removeEventListener("visibilitychange",K)}},[S]);const B=((t==null?void 0:t.controlServerUrl)??"")!==s.trim()||((t==null?void 0:t.hostname)??"")!==l.trim(),I=jT(t==null?void 0:t.lastError),A=L7(e.ui.osFamily)&&I;async function L(){const X=await P7({controlServerUrl:CT(s),hostname:CT(l)});return H(X),X}async function _(X){v(X),w(null);try{B&&X!=="disable"&&X!=="logout"&&await L();const K=X==="enable"?await D7():X==="disable"?await R7():X==="login"?await A7():await M7();r(K),i(K.controlServerUrl??""),c(K.hostname??"")}catch(K){w(gh(K))}finally{v(null)}}async function F(){v("save"),w(null);try{const X=await L();r(X),y(!1)}catch(X){w(gh(X))}finally{v(null)}}async function te(){v("refresh"),w(null);try{const X=await ST();H(X)}catch(X){w(gh(X))}finally{v(null),m(!1)}}async function E(){const X=F7(e.ui.osFamily);if(X){v("install"),w(null);try{const K=await e.bridge.openExternal(X);if(!K.ok){w(K.detail??o("settings.tailscaleInstallOpenFailed"));return}T(!0)}catch(K){w(K instanceof Error?K.message:o("settings.tailscaleInstallOpenFailed"))}finally{v(null)}}}function se(){f!=="save"&&y(!1)}return n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"settings-tailscale-panel",children:n.jsxs("div",{className:"settings-release-card",children:[n.jsxs("div",{className:"settings-tailscale-summary",children:[n.jsx(fh,{label:o("settings.tailscaleStatusIndicator"),value:n.jsxs("span",{className:"settings-tailscale-status-indicator","data-tone":_7((t==null?void 0:t.phase)??"disabled"),children:[n.jsx("span",{className:"settings-tailscale-status-dot","aria-hidden":"true"}),E7((t==null?void 0:t.phase)??"disabled")]})}),n.jsx(fh,{label:o("settings.tailscaleServerAddress"),value:(t==null?void 0:t.reachableBaseUrl)??o("settings.tailscaleUnavailable"),href:(t==null?void 0:t.reachableBaseUrl)??void 0}),n.jsx(fh,{label:o("settings.tailscaleAccountName"),value:(t==null?void 0:t.accountName)??o("settings.tailscaleUnavailable")}),n.jsx(fh,{label:o("settings.tailscaleIpAddress"),value:I7(t)})]}),(t==null?void 0:t.phase)==="needs_login"&&t.loginUrl?n.jsx("div",{className:"settings-release-notes",children:n.jsx("p",{className:"settings-tailscale-login-url",children:n.jsx("a",{className:"settings-tailscale-link",href:t.loginUrl,rel:"noreferrer",target:"_blank",children:t.loginUrl})})}):null,t!=null&&t.lastError||g?n.jsx("p",{className:"settings-release-status",children:g??(t==null?void 0:t.lastError)}):null,n.jsxs("div",{className:"settings-release-actions settings-tailscale-panel-actions",children:[A?n.jsx("button",{className:"settings-button",type:"button",disabled:d||f!==null,onClick:()=>{E()},children:o(f==="install"?"common.loading":"settings.tailscaleInstallAction")}):null,n.jsx("button",{className:"secondary-button",type:"button",disabled:d||f!==null,onClick:()=>y(!0),children:o("settings.tailscaleConfigure")}),n.jsx("button",{className:"secondary-button",type:"button",disabled:d||f!==null,onClick:()=>{te()},children:o(f==="refresh"?"common.loading":"settings.tailscaleRefresh")}),t!=null&&t.enabled?n.jsx("button",{className:"secondary-button",type:"button",disabled:d||f!==null||I,onClick:()=>{_("disable")},children:o(f==="disable"?"common.loading":"settings.tailscaleDisable")}):n.jsx("button",{className:"secondary-button",type:"button",disabled:d||f!==null||I,onClick:()=>{_("enable")},children:o(f==="enable"?"common.loading":"settings.tailscaleEnable")}),n.jsx("button",{className:"secondary-button",type:"button",disabled:d||f!==null||!(t!=null&&t.enabled)||I,onClick:()=>{_("login")},children:o(f==="login"?"common.loading":"settings.tailscaleLogin")}),n.jsx("button",{className:"secondary-button",type:"button",disabled:d||f!==null||!(t!=null&&t.enabled)||I,onClick:()=>{_("logout")},children:o(f==="logout"?"common.loading":"settings.tailscaleLogout")})]})]})}),n.jsx(Fn,{open:k,title:o("settings.tailscaleConfigModalTitle"),description:o("settings.tailscaleConfigModalDescription"),className:"settings-tailscale-modal",onClose:se,children:n.jsxs("div",{className:"settings-tailscale-modal-body",children:[n.jsxs("div",{className:"settings-tailscale-form",children:[n.jsxs("label",{className:"settings-tailscale-field",children:[n.jsx("span",{className:"settings-tailscale-field-label",children:o("settings.tailscaleControlServer")}),n.jsx("input",{"aria-label":o("settings.tailscaleControlServer"),className:"settings-text-input",placeholder:o("settings.tailscaleControlServerPlaceholder"),value:s,onChange:X=>i(X.target.value)})]}),n.jsxs("label",{className:"settings-tailscale-field",children:[n.jsx("span",{className:"settings-tailscale-field-label",children:o("settings.tailscaleHostname")}),n.jsx("input",{"aria-label":o("settings.tailscaleHostname"),className:"settings-text-input",placeholder:o("settings.tailscaleHostnamePlaceholder"),value:l,onChange:X=>c(X.target.value)})]})]}),n.jsxs("div",{className:"settings-tailscale-modal-actions",children:[n.jsx("button",{className:"secondary-button",type:"button",disabled:f==="save",onClick:se,children:o("common.cancel")}),n.jsx("button",{className:"settings-button",type:"button",disabled:f!==null||!B,onClick:()=>{F()},children:o(f==="save"?"common.loading":"common.save")})]})]})})]})}function fh({label:e,value:t,href:r}){return n.jsx("section",{className:"settings-model-card settings-tailscale-summary-card",children:n.jsxs("div",{className:"settings-model-card-main settings-tailscale-summary-card-main",children:[n.jsx("div",{className:"settings-model-card-copy",children:n.jsx("strong",{className:"settings-model-card-title",children:e})}),n.jsx("div",{className:"settings-tailscale-summary-value",children:r&&typeof t=="string"?n.jsx("a",{className:"settings-tailscale-link",href:r,target:"_blank",rel:"noreferrer",children:t}):t})]})})}function CT(e){const t=e.trim();return t.length>0?t:null}function gh(e){return e instanceof Kr||e instanceof Error?e.message:o("settings.tailscaleLoadFailed")}function I7(e){if(!e)return o("settings.tailscaleUnavailable");const t=[e.tailnetIpv4,e.tailnetIpv6].filter(r=>!!r);return t.length>0?t.join(" / "):o("settings.tailscaleUnavailable")}function E7(e){switch(e){case"blocked_uninitialized":return o("settings.tailscalePhaseBlockedUninitialized");case"starting":return o("settings.tailscalePhaseStarting");case"needs_login":return o("settings.tailscalePhaseNeedsLogin");case"running":return o("settings.tailscalePhaseRunning");case"stopping":return o("settings.tailscalePhaseStopping");case"error":return o("settings.tailscalePhaseError");case"disabled":default:return o("settings.tailscalePhaseDisabled")}}function jT(e){return e?e.includes("Tailscale CLI"):!1}function L7(e){return e==="macos"||e==="windows"}function F7(e){switch(e){case"macos":return"https://tailscale.com/download/mac";case"windows":return"https://tailscale.com/download/windows";default:return null}}function _7(e){switch(e){case"running":return"green";case"starting":case"needs_login":case"error":return"yellow";case"disabled":case"blocked_uninitialized":case"stopping":default:return"gray"}}function TT({title:e,description:t,actions:r,content:s,className:i}){return n.jsx(DR,{className:i,children:n.jsxs("section",{className:"mobile-workspace-home-header mobile-page-header",children:[n.jsx("h1",{className:"mobile-workspace-switcher-heading",children:e}),n.jsxs("div",{className:"mobile-workspace-home-toolbar-top mobile-page-header-main",children:[n.jsx("div",{className:"mobile-page-header-copy",children:n.jsx("div",{className:"mobile-workspace-home-switcher mobile-page-header-static-title",children:n.jsx("span",{className:"mobile-workspace-home-switcher-label",children:e})})}),r?n.jsx("div",{className:"mobile-workspace-home-toolbar-actions mobile-page-header-actions",children:r}):null]}),t?n.jsx("p",{className:"mobile-workspace-home-path mobile-page-header-description",children:t}):null,s?n.jsx("div",{className:"mobile-page-header-content",children:s}):null]})})}function O7(e){return e==="appearance"||e==="model-management"||e==="server-connection"||e==="remote-access"||e==="skills"||e==="security-privacy"||e==="software-update"}function B7(e){return o(e==="en-US"?"locale.enUS":"locale.zhCN")}function W7(e){return o(e==="beta"?"settings.releaseBeta":"settings.releaseStable")}function U7(e){switch(e){case"acceptEdits":return o("settings.permissionModeAcceptEdits");case"bypassPermissions":return o("settings.permissionModeBypassPermissions");default:return o("settings.permissionModeDefault")}}function H7(){const e=fr(),{theme:t,selectedTheme:r,autoTheme:s,setTheme:i,setAutoTheme:l}=MN(),c=Ya(R=>R),d=qg(R=>R.profile.language),m=qg(R=>R.profile.defaultPermissionMode),f=ci(R=>R.sessionDisplaySortMode),v=ci(R=>R.showSystemFiles),g=ci(R=>R.notificationPreferences.notifyOnPermissionRequest),w=ci(R=>R.notificationPreferences.notifyOnSessionCompleted),k=ci(R=>R.notificationPreferences.notifyOnSessionFailed),y={language:d,defaultPermissionMode:m},S=sr(),T=qb(c.platform),j=T,N=Ub(c)??"",[D,H]=p.useState(N);p.useEffect(()=>{H(N)},[N]);function B(){nr.clear(),Ti.resetToLocalFallback(),e("/login",{replace:!0})}function I(R){i(R)}function A(R){l(R)}function L(R){try{return Pi(R)}catch{return null}}const _=L(D),F=_!==null&&_!==N;function te(R){R.preventDefault(),_&&Rn.update({hosts:c.hosts.map(ve=>ve.id===c.activeHostId?{...ve,baseUrl:_,updatedAt:new Date().toISOString()}:ve)})}const E=[{value:"default",label:o("settings.permissionModeDefault")},{value:"acceptEdits",label:o("settings.permissionModeAcceptEdits")},{value:"bypassPermissions",label:o("settings.permissionModeBypassPermissions")}],se=[{value:"createdAt",label:o("settings.sessionSortModeCreatedAt")},{value:"updatedAt",label:o("settings.sessionSortModeUpdatedAt")},{value:"title",label:o("settings.sessionSortModeTitle")}];function X(R){Rn.update({releaseChannel:R==="beta"?"beta":"stable"})}function K(R){Rn.update({autoReconnect:R})}function G(R){Rn.update({autoCheckUpdate:R})}function q(R){const ve=R==="acceptEdits"||R==="bypassPermissions"?R:"default";Ti.updateProfile({defaultPermissionMode:ve}).catch(()=>{})}function U(R){const ve=R==="updatedAt"||R==="title"?R:"createdAt";No.setSessionDisplaySortMode(ve)}function Q(R){No.setShowSystemFiles(R)}function P(R){No.setNotificationPreferences({notifyOnPermissionRequest:R})}function W(R){No.setNotificationPreferences({notifyOnSessionCompleted:R})}function J(R){No.setNotificationPreferences({notifyOnSessionFailed:R})}return{platform:S,theme:t,selectedTheme:r,autoTheme:s,applyTheme:I,applyAutoTheme:A,runtimeConfig:c,accountPreferences:y,sessionDisplaySortMode:f,showSystemFiles:v,notifyOnPermissionRequest:g,notifyOnSessionCompleted:w,notifyOnSessionFailed:k,showServerSettings:j,canConfigureServerAddress:T,hostBaseUrlDraft:D,setHostBaseUrlDraft:H,canSaveHostBaseUrl:F,permissionModeOptions:E,sessionDisplaySortModeOptions:se,handleHostBaseUrlSubmit:te,handleLogout:B,updateReleaseChannel:X,updateAutoReconnect:K,updateAutoCheckUpdate:G,updateDefaultPermissionMode:q,updateSessionDisplaySortMode:U,updateShowSystemFiles:Q,updateNotifyOnPermissionRequest:P,updateNotifyOnSessionCompleted:W,updateNotifyOnSessionFailed:J}}function NT(){const e=H7(),t=LN();return e.platform.isMobile?n.jsx(q7,{model:e,appVersion:t}):n.jsx(z7,{model:e,appVersion:t})}function z7({model:e,appVersion:t}){const[r,s]=p.useState(!1),{theme:i,selectedTheme:l,autoTheme:c,applyTheme:d,applyAutoTheme:m,runtimeConfig:f,accountPreferences:v,sessionDisplaySortMode:g,showSystemFiles:w,notifyOnPermissionRequest:k,notifyOnSessionCompleted:y,notifyOnSessionFailed:S,showServerSettings:T,hostBaseUrlDraft:j,setHostBaseUrlDraft:N,canSaveHostBaseUrl:D,permissionModeOptions:H,sessionDisplaySortModeOptions:B,platform:I,handleHostBaseUrlSubmit:A,handleLogout:L,updateReleaseChannel:_,updateAutoReconnect:F,updateAutoCheckUpdate:te,updateDefaultPermissionMode:E,updateSessionDisplaySortMode:se,updateShowSystemFiles:X,updateNotifyOnPermissionRequest:K,updateNotifyOnSessionCompleted:G,updateNotifyOnSessionFailed:q}=e;return n.jsxs("div",{className:"settings-page",children:[n.jsxs("div",{className:"settings-container",children:[n.jsx("h1",{className:"settings-title",children:o("settings.title")}),n.jsxs("section",{className:"settings-section",children:[n.jsx("h2",{className:"settings-section-title",children:o("settings.appearance")}),n.jsxs("div",{className:"settings-card",children:[n.jsxs("div",{className:"settings-row",children:[n.jsxs("div",{className:"settings-row-label",children:[n.jsx("span",{className:"settings-row-title",children:o("settings.language")}),n.jsx("span",{className:"settings-row-description",children:o("settings.languageDescription")})]}),n.jsx("div",{className:"settings-row-control",children:n.jsx(nv,{})})]}),n.jsxs("div",{className:"settings-row settings-row-theme",children:[n.jsxs("div",{className:"settings-row-label",children:[n.jsx("span",{className:"settings-row-title",children:o("settings.theme")}),n.jsx("span",{className:"settings-row-description",children:o("settings.themeDescription")})]}),n.jsxs("div",{className:"settings-row-control settings-row-control-stretch",children:[n.jsxs("div",{className:"settings-theme-panel",children:[n.jsxs("div",{className:"settings-theme-toggle-row",children:[n.jsx("span",{className:"settings-row-title",children:o("settings.autoTheme")}),n.jsx(Ls,{checked:c,label:o("settings.autoTheme"),onChange:m})]}),n.jsx("span",{className:"settings-theme-note",children:o("settings.autoThemeDescription")})]}),n.jsx("div",{className:"theme-selector",children:PN.map(U=>n.jsxs("button",{type:"button",className:`theme-card ${l===U.id&&!c?"active":""}`,"aria-pressed":l===U.id&&!c,disabled:c,onClick:()=>d(U.id),children:[n.jsx("span",{className:"theme-preview",style:{background:U.color}}),n.jsx("span",{className:"theme-label",children:DN(U)}),l===U.id&&!c?n.jsx("span",{className:"theme-check",children:"✓"}):null]},U.id))})]})]}),n.jsxs("div",{className:"settings-row",children:[n.jsxs("div",{className:"settings-row-label",children:[n.jsx("span",{className:"settings-row-title",children:o("settings.workspaceSessionSortMode")}),n.jsx("span",{className:"settings-row-description",children:o("settings.workspaceSessionSortModeDescription")})]}),n.jsx("div",{className:"settings-row-control",children:n.jsx("select",{"aria-label":o("settings.workspaceSessionSortMode"),className:"settings-select",value:g,onChange:U=>se(U.target.value),children:B.map(U=>n.jsx("option",{value:U.value,children:U.label},U.value))})})]}),n.jsxs("div",{className:"settings-row",children:[n.jsxs("div",{className:"settings-row-label",children:[n.jsx("span",{className:"settings-row-title",children:o("settings.showSystemFiles")}),n.jsx("span",{className:"settings-row-description",children:o("settings.showSystemFilesDescription")})]}),n.jsx("div",{className:"settings-row-control",children:n.jsx(Ls,{checked:w,label:o("settings.showSystemFiles"),onChange:X})})]})]})]}),T?n.jsxs("section",{className:"settings-section",children:[n.jsx("h2",{className:"settings-section-title",children:o("settings.serverConnection")}),n.jsxs("div",{className:"settings-card",children:[n.jsxs("div",{className:"settings-row",children:[n.jsxs("div",{className:"settings-row-label",children:[n.jsx("span",{className:"settings-row-title",children:o("settings.serverAddress")}),n.jsx("span",{className:"settings-row-description",children:o("settings.serverDescription")})]}),n.jsx("div",{className:"settings-row-control settings-row-control-stretch",children:n.jsxs("form",{className:"settings-inline-form",onSubmit:A,children:[n.jsx("input",{"aria-label":o("settings.serverAddress"),className:"settings-text-input",value:j,onChange:U=>N(U.target.value)}),n.jsx("button",{className:"settings-button",disabled:!D,type:"submit",children:o("common.save")})]})})]}),n.jsxs("div",{className:"settings-row",children:[n.jsxs("div",{className:"settings-row-label",children:[n.jsx("span",{className:"settings-row-title",children:o("settings.autoReconnect")}),n.jsx("span",{className:"settings-row-description",children:o("settings.autoReconnectDescription")})]}),n.jsx("div",{className:"settings-row-control",children:n.jsx(Ls,{checked:f.autoReconnect,label:o("settings.autoReconnect"),onChange:F})})]})]})]}):null,n.jsxs("section",{className:"settings-section",children:[n.jsx("h2",{className:"settings-section-title",children:o("settings.modelManagement")}),n.jsx("div",{className:"settings-card",children:n.jsx("div",{className:"settings-row",children:n.jsx("div",{className:"settings-row-control settings-row-control-stretch",children:n.jsx(HA,{})})})})]}),n.jsxs("section",{className:"settings-section",children:[n.jsx("h2",{className:"settings-section-title",children:o("settings.remoteAccess")}),n.jsx("div",{className:"settings-card",children:n.jsx("div",{className:"settings-row",children:n.jsx("div",{className:"settings-row-control settings-row-control-stretch",children:n.jsx($A,{})})})})]}),n.jsxs("section",{className:"settings-section",children:[n.jsx("h2",{className:"settings-section-title",children:o("settings.skills")}),n.jsx("div",{className:"settings-card",children:n.jsx("div",{className:"settings-row",children:n.jsx("div",{className:"settings-row-control settings-row-control-stretch",children:n.jsx(qA,{})})})})]}),n.jsxs("section",{className:"settings-section",children:[n.jsx("h2",{className:"settings-section-title",children:o("settings.securityPrivacy")}),n.jsxs("div",{className:"settings-card",children:[n.jsxs("div",{className:"settings-row",children:[n.jsxs("div",{className:"settings-row-label",children:[n.jsx("span",{className:"settings-row-title",children:o("settings.defaultPermissionMode")}),n.jsx("span",{className:"settings-row-description",children:o("settings.defaultPermissionModeDescription")})]}),n.jsx("div",{className:"settings-row-control",children:n.jsx("select",{"aria-label":o("settings.defaultPermissionMode"),className:"settings-select",value:v.defaultPermissionMode,onChange:U=>E(U.target.value),children:H.map(U=>n.jsx("option",{value:U.value,children:U.label},U.value))})})]}),n.jsxs("div",{className:"settings-row",children:[n.jsxs("div",{className:"settings-row-label",children:[n.jsx("span",{className:"settings-row-title",children:o("settings.notifyOnPermissionRequest")}),n.jsx("span",{className:"settings-row-description",children:o("settings.notifyOnPermissionRequestDescription")})]}),n.jsx("div",{className:"settings-row-control",children:n.jsx(Ls,{checked:k,label:o("settings.notifyOnPermissionRequest"),onChange:K})})]}),n.jsxs("div",{className:"settings-row",children:[n.jsxs("div",{className:"settings-row-label",children:[n.jsx("span",{className:"settings-row-title",children:o("settings.notifyOnSessionCompleted")}),n.jsx("span",{className:"settings-row-description",children:o("settings.notifyOnSessionCompletedDescription")})]}),n.jsx("div",{className:"settings-row-control",children:n.jsx(Ls,{checked:y,label:o("settings.notifyOnSessionCompleted"),onChange:G})})]}),n.jsxs("div",{className:"settings-row",children:[n.jsxs("div",{className:"settings-row-label",children:[n.jsx("span",{className:"settings-row-title",children:o("settings.notifyOnSessionFailed")}),n.jsx("span",{className:"settings-row-description",children:o("settings.notifyOnSessionFailedDescription")})]}),n.jsx("div",{className:"settings-row-control",children:n.jsx(Ls,{checked:S,label:o("settings.notifyOnSessionFailed"),onChange:q})})]})]})]}),n.jsxs("section",{className:"settings-section",children:[n.jsx("h2",{className:"settings-section-title",children:o("settings.softwareUpdate")}),n.jsxs("div",{className:"settings-card",children:[n.jsxs("div",{className:"settings-row",children:[n.jsxs("div",{className:"settings-row-label",children:[n.jsx("span",{className:"settings-row-title",children:o("settings.releaseChannel")}),n.jsx("span",{className:"settings-row-description",children:o("settings.releaseChannelDescription")})]}),n.jsx("div",{className:"settings-row-control",children:n.jsxs("select",{"aria-label":o("settings.releaseChannel"),className:"settings-select",value:f.releaseChannel,onChange:U=>_(U.target.value),children:[n.jsx("option",{value:"stable",children:o("settings.releaseStable")}),n.jsx("option",{value:"beta",children:o("settings.releaseBeta")})]})})]}),n.jsxs("div",{className:"settings-row",children:[n.jsx("div",{className:"settings-row-label",children:n.jsx("span",{className:"settings-row-title",children:o("settings.serverUpdate")})}),n.jsx("div",{className:"settings-row-control settings-row-control-stretch",children:n.jsx(zA,{})})]}),I.isWeb?null:n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"settings-row",children:[n.jsx("div",{className:"settings-row-label",children:n.jsx("span",{className:"settings-row-title",children:o("settings.autoCheckUpdate")})}),n.jsx("div",{className:"settings-row-control",children:n.jsx(Ls,{checked:f.autoCheckUpdate,label:o("settings.autoCheckUpdate"),onChange:te})})]}),n.jsxs("div",{className:"settings-row",children:[n.jsx("div",{className:"settings-row-label",children:n.jsx("span",{className:"settings-row-title",children:o("settings.clientUpdate")})}),n.jsx("div",{className:"settings-row-control settings-row-control-stretch",children:n.jsx(UA,{})})]})]})]})]}),n.jsxs("section",{className:"settings-section",children:[n.jsx("h2",{className:"settings-section-title",children:o("settings.advancedSettings")}),n.jsx("div",{className:"settings-card",children:n.jsxs("div",{className:"settings-row",children:[n.jsxs("div",{className:"settings-row-label",children:[n.jsx("span",{className:"settings-row-title",children:o("settings.parallelTaskDebug")}),n.jsx("span",{className:"settings-row-description",children:o("settings.parallelTaskDebugDescription")})]}),n.jsx("div",{className:"settings-row-control",children:n.jsx("button",{className:"settings-button",type:"button",onClick:()=>s(!0),children:o("settings.parallelTaskDebugAction")})})]})})]}),n.jsxs("div",{className:"settings-footer settings-footer-with-logout",children:[n.jsxs("span",{className:"settings-version",children:["CodingNS v",t]}),n.jsx("button",{className:"settings-button settings-button-danger settings-button-sticky",onClick:L,type:"button",children:o("common.logout")})]})]}),n.jsx(a7,{isOpen:r,onClose:()=>s(!1)})]})}function q7({model:e,appVersion:t}){const r=fr(),{section:s}=Ho(),i=O7(s)?s:null,l=[{id:"appearance",title:o("settings.appearance"),description:o("settings.appearanceSectionSummary"),value:B7(e.accountPreferences.language),icon:n.jsx(J7,{})}];return e.showServerSettings&&l.push({id:"server-connection",title:o("settings.serverConnection"),description:o("settings.serverConnectionSectionSummary"),value:Ub(e.runtimeConfig)??"",icon:n.jsx(Z7,{})}),l.push({id:"model-management",title:o("settings.modelManagement"),description:o("settings.modelManagementSectionSummary"),value:o("settings.modelManagementNavValue"),icon:n.jsx(rY,{})},{id:"remote-access",title:o("settings.remoteAccess"),description:o("settings.remoteAccessSectionSummary"),value:o("settings.tailscaleBrand"),icon:n.jsx(tY,{})},{id:"skills",title:o("settings.skills"),description:o("settings.skillsSectionSummary"),value:o("settings.skillsNavValue"),icon:n.jsx(nY,{})},{id:"security-privacy",title:o("settings.securityPrivacy"),description:o("settings.securityPrivacySectionSummary"),value:U7(e.accountPreferences.defaultPermissionMode),icon:n.jsx(sY,{})},{id:"software-update",title:o("settings.softwareUpdate"),description:o("settings.softwareUpdateSectionSummary"),value:W7(e.runtimeConfig.releaseChannel),icon:n.jsx(eY,{})}),(i?l.find(d=>d.id===i)??null:null)?n.jsxs("div",{className:"settings-page settings-page-mobile mobile-page-scroll-root mobile-page-with-top-header",children:[n.jsx(TT,{title:o("settings.title")}),n.jsxs("div",{className:"settings-mobile-container",children:[i==="appearance"?n.jsx($7,{model:e}):null,i==="model-management"?n.jsx(Y7,{}):null,i==="server-connection"&&e.showServerSettings?n.jsx(V7,{model:e}):null,i==="remote-access"?n.jsx(K7,{}):null,i==="skills"?n.jsx(X7,{}):null,i==="security-privacy"?n.jsx(G7,{model:e}):null,i==="software-update"?n.jsx(Q7,{model:e}):null]}),n.jsx(PT,{onLogout:e.handleLogout})]}):n.jsxs("div",{className:"settings-page settings-page-mobile mobile-page-scroll-root mobile-page-with-top-header",children:[n.jsx(TT,{title:o("settings.title")}),n.jsxs("div",{className:"settings-mobile-container",children:[n.jsx("section",{className:"settings-mobile-group-section",children:n.jsx("div",{className:"settings-mobile-list",children:l.map(d=>n.jsxs("button",{type:"button",className:"settings-mobile-nav-row",onClick:()=>r(`/settings/${d.id}`),children:[n.jsx("span",{className:"settings-mobile-nav-icon",children:d.icon}),n.jsxs("span",{className:"settings-mobile-nav-copy",children:[n.jsx("span",{className:"settings-mobile-nav-title",children:d.title}),n.jsx("span",{className:"settings-mobile-nav-description",children:d.description})]}),n.jsxs("span",{className:"settings-mobile-nav-trailing",children:[d.value?n.jsx("span",{className:"settings-mobile-nav-value",children:d.value}):null,n.jsx(iY,{})]})]},d.id))})}),n.jsx("div",{className:"settings-footer settings-footer-mobile",children:n.jsxs("span",{className:"settings-version",children:["CodingNS v",t]})})]}),n.jsx(PT,{onLogout:e.handleLogout})]})}function $7({model:e}){return n.jsxs(n.Fragment,{children:[n.jsxs("section",{className:"settings-mobile-group-section",children:[n.jsx("h2",{className:"settings-mobile-group-title",children:o("settings.language")}),n.jsx("p",{className:"settings-mobile-group-note",children:o("settings.languageDescription")}),n.jsx("div",{className:"settings-mobile-list",children:n.jsxs("div",{className:"settings-mobile-form-row",children:[n.jsx("div",{className:"settings-mobile-row-copy",children:n.jsx("span",{className:"settings-mobile-row-title",children:o("settings.language")})}),n.jsx(nv,{variant:"compact",className:"settings-mobile-language-switcher"})]})})]}),n.jsxs("section",{className:"settings-mobile-group-section",children:[n.jsx("h2",{className:"settings-mobile-group-title",children:o("settings.theme")}),n.jsx("p",{className:"settings-mobile-group-note",children:o("settings.themeDescription")}),n.jsxs("div",{className:"settings-mobile-list",children:[n.jsxs("div",{className:"settings-mobile-form-row",children:[n.jsxs("div",{className:"settings-mobile-row-copy",children:[n.jsx("span",{className:"settings-mobile-row-title",children:o("settings.autoTheme")}),n.jsx("span",{className:"settings-mobile-row-description",children:o("settings.autoThemeDescription")})]}),n.jsx(Ls,{checked:e.autoTheme,label:o("settings.autoTheme"),onChange:e.applyAutoTheme})]}),PN.map(t=>{const r=e.selectedTheme===t.id&&!e.autoTheme;return n.jsxs("button",{type:"button",className:`settings-mobile-choice-row${r?" active":""}`,"aria-pressed":r,disabled:e.autoTheme,onClick:()=>e.applyTheme(t.id),children:[n.jsxs("span",{className:"settings-mobile-choice-leading",children:[n.jsx("span",{className:"settings-mobile-choice-dot",style:{background:t.color},"aria-hidden":"true"}),n.jsx("span",{className:"settings-mobile-choice-label",children:DN(t)})]}),n.jsx("span",{className:"settings-mobile-choice-indicator","aria-hidden":"true",children:r?n.jsx(aY,{}):null})]},t.id)})]})]}),n.jsxs("section",{className:"settings-mobile-group-section",children:[n.jsx("h2",{className:"settings-mobile-group-title",children:o("settings.fileManager")}),n.jsx("p",{className:"settings-mobile-group-note",children:o("settings.workspaceSessionSortModeDescription")}),n.jsxs("div",{className:"settings-mobile-list",children:[n.jsxs("div",{className:"settings-mobile-form-row",children:[n.jsxs("div",{className:"settings-mobile-row-copy",children:[n.jsx("span",{className:"settings-mobile-row-title",children:o("settings.workspaceSessionSortMode")}),n.jsx("span",{className:"settings-mobile-row-description",children:o("settings.workspaceSessionSortModeDescription")})]}),n.jsx("select",{"aria-label":o("settings.workspaceSessionSortMode"),className:"settings-select settings-mobile-select",value:e.sessionDisplaySortMode,onChange:t=>e.updateSessionDisplaySortMode(t.target.value),children:e.sessionDisplaySortModeOptions.map(t=>n.jsx("option",{value:t.value,children:t.label},t.value))})]}),n.jsxs("div",{className:"settings-mobile-form-row",children:[n.jsxs("div",{className:"settings-mobile-row-copy",children:[n.jsx("span",{className:"settings-mobile-row-title",children:o("settings.showSystemFiles")}),n.jsx("span",{className:"settings-mobile-row-description",children:o("settings.showSystemFilesDescription")})]}),n.jsx(Ls,{checked:e.showSystemFiles,label:o("settings.showSystemFiles"),onChange:e.updateShowSystemFiles})]})]})]})]})}function V7({model:e}){return n.jsxs(n.Fragment,{children:[e.canConfigureServerAddress?n.jsxs("section",{className:"settings-mobile-group-section",children:[n.jsx("h2",{className:"settings-mobile-group-title",children:o("settings.serverAddress")}),n.jsx("p",{className:"settings-mobile-group-note",children:o("settings.serverDescription")}),n.jsx("div",{className:"settings-mobile-list",children:n.jsxs("form",{className:"settings-mobile-form-stack",onSubmit:e.handleHostBaseUrlSubmit,children:[n.jsx("input",{"aria-label":o("settings.serverAddress"),className:"settings-text-input settings-mobile-input",value:e.hostBaseUrlDraft,onChange:t=>e.setHostBaseUrlDraft(t.target.value)}),n.jsx("button",{className:"settings-mobile-primary-button",disabled:!e.canSaveHostBaseUrl,type:"submit",children:o("common.save")})]})})]}):null,n.jsxs("section",{className:"settings-mobile-group-section",children:[n.jsx("h2",{className:"settings-mobile-group-title",children:o("settings.serverConnection")}),n.jsx("div",{className:"settings-mobile-list",children:n.jsxs("div",{className:"settings-mobile-form-row",children:[n.jsxs("div",{className:"settings-mobile-row-copy",children:[n.jsx("span",{className:"settings-mobile-row-title",children:o("settings.autoReconnect")}),n.jsx("span",{className:"settings-mobile-row-description",children:o("settings.autoReconnectDescription")})]}),n.jsx(Ls,{checked:e.runtimeConfig.autoReconnect,label:o("settings.autoReconnect"),onChange:e.updateAutoReconnect})]})})]})]})}function G7({model:e}){return n.jsxs(n.Fragment,{children:[n.jsxs("section",{className:"settings-mobile-group-section",children:[n.jsx("h2",{className:"settings-mobile-group-title",children:o("settings.securityPrivacy")}),n.jsx("p",{className:"settings-mobile-group-note",children:o("settings.securityPrivacySectionSummary")}),n.jsx("div",{className:"settings-mobile-list",children:n.jsxs("div",{className:"settings-mobile-form-row",children:[n.jsxs("div",{className:"settings-mobile-row-copy",children:[n.jsx("span",{className:"settings-mobile-row-title",children:o("settings.defaultPermissionMode")}),n.jsx("span",{className:"settings-mobile-row-description",children:o("settings.defaultPermissionModeDescription")})]}),n.jsx("select",{"aria-label":o("settings.defaultPermissionMode"),className:"settings-select settings-mobile-select",value:e.accountPreferences.defaultPermissionMode,onChange:t=>e.updateDefaultPermissionMode(t.target.value),children:e.permissionModeOptions.map(t=>n.jsx("option",{value:t.value,children:t.label},t.value))})]})})]}),n.jsxs("section",{className:"settings-mobile-group-section",children:[n.jsx("h2",{className:"settings-mobile-group-title",children:o("settings.notificationSettings")}),n.jsx("p",{className:"settings-mobile-group-note",children:o("settings.notificationSettingsDescription")}),n.jsxs("div",{className:"settings-mobile-list",children:[n.jsxs("div",{className:"settings-mobile-form-row",children:[n.jsxs("div",{className:"settings-mobile-row-copy",children:[n.jsx("span",{className:"settings-mobile-row-title",children:o("settings.notifyOnPermissionRequest")}),n.jsx("span",{className:"settings-mobile-row-description",children:o("settings.notifyOnPermissionRequestDescription")})]}),n.jsx(Ls,{checked:e.notifyOnPermissionRequest,label:o("settings.notifyOnPermissionRequest"),onChange:e.updateNotifyOnPermissionRequest})]}),n.jsxs("div",{className:"settings-mobile-form-row",children:[n.jsxs("div",{className:"settings-mobile-row-copy",children:[n.jsx("span",{className:"settings-mobile-row-title",children:o("settings.notifyOnSessionCompleted")}),n.jsx("span",{className:"settings-mobile-row-description",children:o("settings.notifyOnSessionCompletedDescription")})]}),n.jsx(Ls,{checked:e.notifyOnSessionCompleted,label:o("settings.notifyOnSessionCompleted"),onChange:e.updateNotifyOnSessionCompleted})]}),n.jsxs("div",{className:"settings-mobile-form-row",children:[n.jsxs("div",{className:"settings-mobile-row-copy",children:[n.jsx("span",{className:"settings-mobile-row-title",children:o("settings.notifyOnSessionFailed")}),n.jsx("span",{className:"settings-mobile-row-description",children:o("settings.notifyOnSessionFailedDescription")})]}),n.jsx(Ls,{checked:e.notifyOnSessionFailed,label:o("settings.notifyOnSessionFailed"),onChange:e.updateNotifyOnSessionFailed})]})]})]})]})}function K7(){return n.jsxs("section",{className:"settings-mobile-group-section",children:[n.jsx("h2",{className:"settings-mobile-group-title",children:o("settings.remoteAccess")}),n.jsx("div",{className:"settings-mobile-panel-shell settings-mobile-remote-shell",children:n.jsx($A,{})})]})}function Y7(){return n.jsxs("section",{className:"settings-mobile-group-section",children:[n.jsx("h2",{className:"settings-mobile-group-title",children:o("settings.modelManagement")}),n.jsx("div",{className:"settings-mobile-panel-shell settings-mobile-model-shell",children:n.jsx(HA,{})})]})}function X7(){return n.jsxs("section",{className:"settings-mobile-group-section",children:[n.jsx("h2",{className:"settings-mobile-group-title",children:o("settings.skills")}),n.jsx("div",{className:"settings-mobile-panel-shell settings-mobile-skill-shell",children:n.jsx(qA,{})})]})}function Q7({model:e}){return n.jsxs(n.Fragment,{children:[n.jsxs("section",{className:"settings-mobile-group-section",children:[n.jsx("h2",{className:"settings-mobile-group-title",children:o("settings.softwareUpdate")}),n.jsx("div",{className:"settings-mobile-list",children:n.jsxs("div",{className:"settings-mobile-form-row",children:[n.jsxs("div",{className:"settings-mobile-row-copy",children:[n.jsx("span",{className:"settings-mobile-row-title",children:o("settings.releaseChannel")}),n.jsx("span",{className:"settings-mobile-row-description",children:o("settings.releaseChannelDescription")})]}),n.jsxs("select",{"aria-label":o("settings.releaseChannel"),className:"settings-select settings-mobile-select",value:e.runtimeConfig.releaseChannel,onChange:t=>e.updateReleaseChannel(t.target.value),children:[n.jsx("option",{value:"stable",children:o("settings.releaseStable")}),n.jsx("option",{value:"beta",children:o("settings.releaseBeta")})]})]})})]}),n.jsxs("section",{className:"settings-mobile-group-section",children:[n.jsx("h2",{className:"settings-mobile-group-title",children:o("settings.serverUpdate")}),n.jsx("div",{className:"settings-mobile-panel-shell settings-mobile-update-shell",children:n.jsx(zA,{})})]}),e.platform.isWeb?null:n.jsxs("section",{className:"settings-mobile-group-section",children:[n.jsx("h2",{className:"settings-mobile-group-title",children:o("settings.clientUpdate")}),n.jsx("div",{className:"settings-mobile-list",children:n.jsxs("div",{className:"settings-mobile-form-row",children:[n.jsx("div",{className:"settings-mobile-row-copy",children:n.jsx("span",{className:"settings-mobile-row-title",children:o("settings.autoCheckUpdate")})}),n.jsx(Ls,{checked:e.runtimeConfig.autoCheckUpdate,label:o("settings.autoCheckUpdate"),onChange:e.updateAutoCheckUpdate})]})}),n.jsx("div",{className:"settings-mobile-panel-shell settings-mobile-update-shell",children:n.jsx(UA,{})})]})]})}function PT({onLogout:e}){return n.jsx("div",{className:"settings-mobile-sticky-footer",children:n.jsx("button",{type:"button",className:"settings-mobile-danger-button settings-mobile-danger-button-sticky",onClick:e,children:o("common.logout")})})}function Ls({checked:e,label:t,onChange:r}){return n.jsxs("label",{className:"settings-mobile-switch","aria-label":t,onClick:s=>{s.target instanceof HTMLInputElement||(s.preventDefault(),r(!e))},children:[n.jsx("input",{type:"checkbox","aria-label":t,checked:e,onChange:s=>r(s.target.checked)}),n.jsx("span",{className:"settings-mobile-switch-track","aria-hidden":"true",children:n.jsx("span",{className:"settings-mobile-switch-thumb"})})]})}function J7(){return n.jsxs("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:[n.jsx("path",{d:"M10 3.5a6.5 6.5 0 1 0 6.5 6.5c0-.8-.6-1.4-1.4-1.4h-1.6A1.5 1.5 0 0 1 12 7.1V5.5c0-1.1-.9-2-2-2Z"}),n.jsx("circle",{cx:"6.6",cy:"9.2",r:".8",fill:"currentColor",stroke:"none"}),n.jsx("circle",{cx:"8.8",cy:"6.8",r:".8",fill:"currentColor",stroke:"none"}),n.jsx("circle",{cx:"12.1",cy:"6.6",r:".8",fill:"currentColor",stroke:"none"})]})}function Z7(){return n.jsxs("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:[n.jsx("path",{d:"M4 7.5 10 4l6 3.5v5L10 16l-6-3.5v-5Z"}),n.jsx("path",{d:"M10 9.5V16"}),n.jsx("path",{d:"M4 7.5 10 11l6-3.5"})]})}function eY(){return n.jsxs("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:[n.jsx("rect",{x:"3.5",y:"4",width:"13",height:"9.5",rx:"2.2"}),n.jsx("path",{d:"M7 16h6"}),n.jsx("path",{d:"M10 13.5V16"}),n.jsx("path",{d:"m8 8 2 2 3-3"})]})}function tY(){return n.jsxs("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:[n.jsx("circle",{cx:"10",cy:"10",r:"5.8"}),n.jsx("path",{d:"M10 4.2c1.5 1.3 2.4 3.5 2.4 5.8s-.9 4.5-2.4 5.8c-1.5-1.3-2.4-3.5-2.4-5.8s.9-4.5 2.4-5.8Z"}),n.jsx("path",{d:"M4.6 8.1h10.8"}),n.jsx("path",{d:"M4.6 11.9h10.8"})]})}function nY(){return n.jsxs("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.7","aria-hidden":"true",children:[n.jsx("rect",{x:"3.5",y:"4",width:"13",height:"12",rx:"2.5"}),n.jsx("path",{d:"M6 7h8M6 10h8M6 13h4",strokeLinecap:"round"}),n.jsx("path",{d:"m12.7 13.2 1.4 1.4 2.6-2.8",strokeLinecap:"round",strokeLinejoin:"round"})]})}function rY(){return n.jsxs("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.7","aria-hidden":"true",children:[n.jsx("rect",{x:"3.5",y:"4",width:"13",height:"12",rx:"2.5"}),n.jsx("path",{d:"M6.2 8.1h7.6M6.2 11.9h4.1",strokeLinecap:"round"}),n.jsx("path",{d:"m12.8 11.3 1.3 1.3 2-2.2",strokeLinecap:"round",strokeLinejoin:"round"})]})}function sY(){return n.jsxs("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:[n.jsx("path",{d:"M10 3.2 15 5v4.4c0 3-1.9 5.8-5 7.4-3.1-1.6-5-4.4-5-7.4V5l5-1.8Z"}),n.jsx("path",{d:"m8.3 9.8 1.2 1.2 2.4-2.5"})]})}function iY(){return n.jsx("svg",{viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:n.jsx("path",{d:"m4 2 4 4-4 4"})})}function aY(){return n.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:n.jsx("path",{d:"m3.5 8.2 2.6 2.6 6-6"})})}function oY({runtimeKey:e,children:t}){return n.jsx("div",{children:t},e)}function lY(){const e=IL();return n.jsx(oY,{runtimeKey:e,children:n.jsx(Kg,{})})}function cY(){const e=xu(r=>r.session),t=ui();if(!e){const r=`${t.pathname}${t.search}`;return n.jsx(eo,{to:`/login?returnTo=${encodeURIComponent(r)}`,replace:!0})}return n.jsx(lY,{})}function DT(){const{shellMode:e}=Mr();return n.jsx(eo,{to:e==="mobile"?"/workspaces":"/landing",replace:!0})}const uY=[{path:"/bootstrap",element:n.jsx(HL,{})},{path:"/login",element:n.jsx(YL,{})},{path:"/desktop-window-preview",element:n.jsx(E9,{})},{path:"/",element:n.jsx(cY,{}),children:[{path:"desktop-window/:windowId",element:n.jsx(B9,{})},{element:n.jsx(e7,{}),children:[{index:!0,element:n.jsx(DT,{})},{path:"landing",element:n.jsx(r7,{})},{path:"workspaces",element:n.jsx(bK,{})},{path:"workspaces/:workspaceId",element:n.jsx(VK,{})},{path:"workspaces/:workspaceId/debug",element:n.jsx(JK,{})},{path:"workspaces/:workspaceId/sessions",element:n.jsx(Q9,{})},{path:"workspaces/:workspaceId/sessions/:sessionId",element:n.jsx(o9,{})},{path:"workspaces/:workspaceId/tools",element:n.jsx(oK,{})},{path:"workspaces/:workspaceId/tools/files",element:n.jsx(sK,{})},{path:"workspaces/:workspaceId/tools/git",element:n.jsx(iK,{})},{path:"workspaces/:workspaceId/tools/processes",element:n.jsx(aK,{})},{path:"workspaces/:workspaceId/terminals",lazy:async()=>({Component:(await _l(()=>import("./TerminalPage-D00S4KM6.js"),__vite__mapDeps([0,1]))).TerminalPage})},{path:"workspaces/:workspaceId/butler",element:n.jsx(H$,{})},{path:"settings",element:n.jsx(NT,{})},{path:"settings/:section",element:n.jsx(NT,{})},{path:"*",element:n.jsx(DT,{})}]}]}];function dY(){return L1(uY)}function hY(){const e=ma(r=>r.profile.language),t=p.useMemo(()=>dY(),[]);return n.jsx(tL,{children:n.jsx(xL,{children:n.jsx(uL,{language:e,children:n.jsx(bL,{children:n.jsxs(kL,{children:[n.jsx(AL,{}),n.jsx(q1,{router:t})]})})})})})}fE().finally(()=>{eI.createRoot(document.getElementById("root")).render(n.jsx(hY,{}))});export{iP as C,Kl as M,_G as T,nr as a,di as b,gv as c,fr as d,Ho as e,Mr as f,QT as g,Qn as h,fY as i,Ur as j,n as k,LG as l,yY as m,Vj as n,bY as o,wY as p,Vn as q,p as r,bv as s,o as t,sr as u,gY as v,_s as w,FG as x,vY as y,pY as z};
|