@wjarka/cezarion 0.15.1 → 0.16.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 +167 -46
- package/dist/agent-config/catalog.d.ts +6 -2
- package/dist/agent-config/catalog.js +78 -3
- package/dist/agent-config/catalog.js.map +1 -1
- package/dist/agent-config/model-settings/shared.js +6 -3
- package/dist/agent-config/model-settings/shared.js.map +1 -1
- package/dist/agent-config/models.js +4 -0
- package/dist/agent-config/models.js.map +1 -1
- package/dist/agent-config/validate.js +6 -0
- package/dist/agent-config/validate.js.map +1 -1
- package/dist/artifacts/cli.js +10 -2
- package/dist/artifacts/cli.js.map +1 -1
- package/dist/automations/coordinator.d.ts +7 -0
- package/dist/automations/coordinator.js +22 -2
- package/dist/automations/coordinator.js.map +1 -1
- package/dist/automations/github-poller.d.ts +4 -4
- package/dist/automations/github-poller.js.map +1 -1
- package/dist/automations/schedule-runner.d.ts +130 -0
- package/dist/automations/schedule-runner.js +326 -0
- package/dist/automations/schedule-runner.js.map +1 -0
- package/dist/automations/scheduler.d.ts +38 -7
- package/dist/automations/scheduler.js +90 -22
- package/dist/automations/scheduler.js.map +1 -1
- package/dist/automations/store.d.ts +80 -3
- package/dist/automations/store.js +208 -16
- package/dist/automations/store.js.map +1 -1
- package/dist/automations/task-template.d.ts +42 -6
- package/dist/automations/task-template.js +152 -24
- package/dist/automations/task-template.js.map +1 -1
- package/dist/automations/types.d.ts +142 -6
- package/dist/automations/types.js +64 -6
- package/dist/automations/types.js.map +1 -1
- package/dist/autosave-holders.js +8 -12
- package/dist/autosave-holders.js.map +1 -1
- package/dist/ci-wait/client.d.ts +8 -1
- package/dist/ci-wait/client.js +43 -1
- package/dist/ci-wait/client.js.map +1 -1
- package/dist/ci-wait/controller.d.ts +83 -4
- package/dist/ci-wait/controller.js +76 -11
- package/dist/ci-wait/controller.js.map +1 -1
- package/dist/ci-wait/errors.d.ts +7 -1
- package/dist/ci-wait/errors.js +36 -0
- package/dist/ci-wait/errors.js.map +1 -1
- package/dist/ci-wait/github.d.ts +2 -0
- package/dist/ci-wait/github.js +3 -1
- package/dist/ci-wait/github.js.map +1 -1
- package/dist/ci-wait/mcp.d.ts +2 -98
- package/dist/ci-wait/mcp.js +11 -25
- package/dist/ci-wait/mcp.js.map +1 -1
- package/dist/ci-wait/supervisor.d.ts +2 -1
- package/dist/ci-wait/supervisor.js +2 -1
- package/dist/ci-wait/supervisor.js.map +1 -1
- package/dist/ci-wait/tools.d.ts +307 -0
- package/dist/ci-wait/tools.js +63 -0
- package/dist/ci-wait/tools.js.map +1 -0
- package/dist/config.d.ts +3 -0
- package/dist/config.js +7 -0
- package/dist/config.js.map +1 -1
- package/dist/contract/agent-config.d.ts +5 -0
- package/dist/contract/agent-profiles.d.ts +15 -0
- package/dist/contract/automation-schedule.d.ts +60 -0
- package/dist/contract/automations.d.ts +208 -36
- package/dist/contract/delegation.d.ts +96 -0
- package/dist/contract/discovery.d.ts +7 -0
- package/dist/contract/github.d.ts +1 -0
- package/dist/contract/health.d.ts +6 -0
- package/dist/contract/index.d.ts +3 -0
- package/dist/contract/index.js +1445 -745
- package/dist/contract/preview.d.ts +508 -0
- package/dist/contract/runs.d.ts +716 -15
- package/dist/contract/skills.d.ts +39 -0
- package/dist/contract/workflows.d.ts +6 -0
- package/dist/contract/workspace.d.ts +65 -0
- package/dist/contract/zoned-time.d.ts +35 -0
- package/dist/core/agent-env.d.ts +11 -0
- package/dist/core/agent-env.js +27 -5
- package/dist/core/agent-env.js.map +1 -1
- package/dist/core/agent-profiles.js +7 -0
- package/dist/core/agent-profiles.js.map +1 -1
- package/dist/core/agent-runner.d.ts +49 -1
- package/dist/core/agent-runner.js +2 -1
- package/dist/core/agent-runner.js.map +1 -1
- package/dist/core/backend-detect.d.ts +3 -2
- package/dist/core/backend-detect.js +27 -1
- package/dist/core/backend-detect.js.map +1 -1
- package/dist/core/claude-cli-runner.d.ts +1 -0
- package/dist/core/claude-cli-runner.js +69 -19
- package/dist/core/claude-cli-runner.js.map +1 -1
- package/dist/core/codex-app-server-runner.d.ts +1 -0
- package/dist/core/codex-app-server-runner.js +200 -25
- package/dist/core/codex-app-server-runner.js.map +1 -1
- package/dist/core/codex-app-server-transport.d.ts +7 -3
- package/dist/core/codex-app-server-transport.js +11 -9
- package/dist/core/codex-app-server-transport.js.map +1 -1
- package/dist/core/cursor-acp-runner.d.ts +1 -0
- package/dist/core/cursor-acp-runner.js +24 -9
- package/dist/core/cursor-acp-runner.js.map +1 -1
- package/dist/core/host-model-catalog.js +2 -0
- package/dist/core/host-model-catalog.js.map +1 -1
- package/dist/core/managed-session.js +2 -0
- package/dist/core/managed-session.js.map +1 -1
- package/dist/core/model-identity.js +2 -0
- package/dist/core/model-identity.js.map +1 -1
- package/dist/core/model-presets.js +3 -0
- package/dist/core/model-presets.js.map +1 -1
- package/dist/core/omp-model-catalog.d.ts +43 -0
- package/dist/core/omp-model-catalog.js +205 -0
- package/dist/core/omp-model-catalog.js.map +1 -0
- package/dist/core/omp-runner.d.ts +73 -0
- package/dist/core/omp-runner.js +990 -0
- package/dist/core/omp-runner.js.map +1 -0
- package/dist/core/omp-ui-mapper.d.ts +106 -0
- package/dist/core/omp-ui-mapper.js +882 -0
- package/dist/core/omp-ui-mapper.js.map +1 -0
- package/dist/core/opencode-server-runner.d.ts +18 -4
- package/dist/core/opencode-server-runner.js +337 -96
- package/dist/core/opencode-server-runner.js.map +1 -1
- package/dist/core/opencode-session-error.d.ts +11 -0
- package/dist/core/opencode-session-error.js +26 -0
- package/dist/core/opencode-session-error.js.map +1 -0
- package/dist/core/opencode-ui-mapper.js +4 -36
- package/dist/core/opencode-ui-mapper.js.map +1 -1
- package/dist/core/pi-runner.d.ts +1 -0
- package/dist/core/pi-runner.js +75 -12
- package/dist/core/pi-runner.js.map +1 -1
- package/dist/core/provider-auth.d.ts +9 -2
- package/dist/core/provider-auth.js +43 -6
- package/dist/core/provider-auth.js.map +1 -1
- package/dist/core/runner-factory.js +3 -0
- package/dist/core/runner-factory.js.map +1 -1
- package/dist/core/runner-model-catalog.js +1 -0
- package/dist/core/runner-model-catalog.js.map +1 -1
- package/dist/core/runner-stderr.d.ts +2 -0
- package/dist/core/runner-stderr.js +20 -0
- package/dist/core/runner-stderr.js.map +1 -0
- package/dist/core/session-process.d.ts +22 -0
- package/dist/core/session-process.js +202 -0
- package/dist/core/session-process.js.map +1 -0
- package/dist/core/ui-events.d.ts +1 -1
- package/dist/core/usage-limit.js +3 -60
- package/dist/core/usage-limit.js.map +1 -1
- package/dist/data-gitignore.d.ts +6 -0
- package/dist/data-gitignore.js +57 -0
- package/dist/data-gitignore.js.map +1 -0
- package/dist/delegation/capacity.d.ts +19 -0
- package/dist/delegation/capacity.js +34 -0
- package/dist/delegation/capacity.js.map +1 -0
- package/dist/delegation/cli.js +13 -4
- package/dist/delegation/cli.js.map +1 -1
- package/dist/delegation/conversations.d.ts +4 -2
- package/dist/delegation/conversations.js +8 -12
- package/dist/delegation/conversations.js.map +1 -1
- package/dist/delegation/credentials.d.ts +2 -0
- package/dist/delegation/credentials.js +10 -0
- package/dist/delegation/credentials.js.map +1 -1
- package/dist/delegation/destroy-observation.d.ts +42 -0
- package/dist/delegation/destroy-observation.js +115 -0
- package/dist/delegation/destroy-observation.js.map +1 -0
- package/dist/delegation/execution-identity.d.ts +6 -0
- package/dist/delegation/execution-identity.js +1 -1
- package/dist/delegation/execution-identity.js.map +1 -1
- package/dist/delegation/policy.d.ts +3 -2
- package/dist/delegation/policy.js +7 -5
- package/dist/delegation/policy.js.map +1 -1
- package/dist/delegation/process-liveness.d.ts +57 -20
- package/dist/delegation/process-liveness.js +114 -92
- package/dist/delegation/process-liveness.js.map +1 -1
- package/dist/delegation/provision.js +6 -6
- package/dist/delegation/provision.js.map +1 -1
- package/dist/delegation/results.js +4 -2
- package/dist/delegation/results.js.map +1 -1
- package/dist/delegation/retry-backoff.d.ts +23 -0
- package/dist/delegation/retry-backoff.js +18 -0
- package/dist/delegation/retry-backoff.js.map +1 -0
- package/dist/delegation/routes.d.ts +64 -58
- package/dist/delegation/scratch-cleanup.d.ts +29 -0
- package/dist/delegation/scratch-cleanup.js +143 -0
- package/dist/delegation/scratch-cleanup.js.map +1 -0
- package/dist/delegation/service.d.ts +20 -1
- package/dist/delegation/service.js +233 -70
- package/dist/delegation/service.js.map +1 -1
- package/dist/delegation/transport.d.ts +12 -6
- package/dist/delegation/workspace.d.ts +23 -4
- package/dist/delegation/workspace.js +147 -31
- package/dist/delegation/workspace.js.map +1 -1
- package/dist/git-worktree-lock-helper.js +8 -3
- package/dist/git-worktree-lock-helper.js.map +1 -1
- package/dist/git-worktree-lock.d.ts +6 -1
- package/dist/git-worktree-lock.js +10 -4
- package/dist/git-worktree-lock.js.map +1 -1
- package/dist/git-worktree-release.d.ts +20 -0
- package/dist/git-worktree-release.js +27 -0
- package/dist/git-worktree-release.js.map +1 -0
- package/dist/git-worktree.d.ts +8 -2
- package/dist/git-worktree.js +19 -2
- package/dist/git-worktree.js.map +1 -1
- package/dist/handoff.d.ts +2 -2
- package/dist/handoff.js +1 -1
- package/dist/index.js +109 -76
- package/dist/index.js.map +1 -1
- package/dist/paths.d.ts +1 -1
- package/dist/paths.js +5 -1
- package/dist/paths.js.map +1 -1
- package/dist/preview/cdp.d.ts +13 -0
- package/dist/preview/cdp.js +69 -0
- package/dist/preview/cdp.js.map +1 -0
- package/dist/preview/chromium.d.ts +75 -0
- package/dist/preview/chromium.js +394 -0
- package/dist/preview/chromium.js.map +1 -0
- package/dist/preview/dev-server.d.ts +68 -0
- package/dist/preview/dev-server.js +341 -0
- package/dist/preview/dev-server.js.map +1 -0
- package/dist/preview/host.d.ts +154 -0
- package/dist/preview/host.js +681 -0
- package/dist/preview/host.js.map +1 -0
- package/dist/preview/registration.d.ts +63 -0
- package/dist/preview/registration.js +109 -0
- package/dist/preview/registration.js.map +1 -0
- package/dist/preview/session.d.ts +73 -0
- package/dist/preview/session.js +347 -0
- package/dist/preview/session.js.map +1 -0
- package/dist/preview/url.d.ts +6 -0
- package/dist/preview/url.js +17 -0
- package/dist/preview/url.js.map +1 -0
- package/dist/runs/agent-tmpdir-removal.d.ts +15 -0
- package/dist/runs/agent-tmpdir-removal.js +60 -0
- package/dist/runs/agent-tmpdir-removal.js.map +1 -0
- package/dist/runs/agent-tmpdir.d.ts +12 -1
- package/dist/runs/agent-tmpdir.js +123 -34
- package/dist/runs/agent-tmpdir.js.map +1 -1
- package/dist/runs/delegation-state.d.ts +5 -1
- package/dist/runs/delegation-state.js +9 -0
- package/dist/runs/delegation-state.js.map +1 -1
- package/dist/runs/event-history.d.ts +4 -4
- package/dist/runs/event-history.js +97 -117
- package/dist/runs/event-history.js.map +1 -1
- package/dist/runs/history-compressor.d.ts +29 -0
- package/dist/runs/history-compressor.js +116 -0
- package/dist/runs/history-compressor.js.map +1 -0
- package/dist/runs/history-file.d.ts +36 -0
- package/dist/runs/history-file.js +463 -0
- package/dist/runs/history-file.js.map +1 -0
- package/dist/runs/human-ask-summary.js +18 -13
- package/dist/runs/human-ask-summary.js.map +1 -1
- package/dist/runs/legacy-index.d.ts +62 -0
- package/dist/runs/legacy-index.js +168 -0
- package/dist/runs/legacy-index.js.map +1 -0
- package/dist/runs/raw-record.d.ts +52 -0
- package/dist/runs/raw-record.js +145 -0
- package/dist/runs/raw-record.js.map +1 -0
- package/dist/runs/retention.d.ts +13 -6
- package/dist/runs/retention.js +42 -13
- package/dist/runs/retention.js.map +1 -1
- package/dist/runs/run-claims.d.ts +23 -0
- package/dist/runs/run-claims.js +24 -0
- package/dist/runs/run-claims.js.map +1 -0
- package/dist/runs/run-database.d.ts +385 -0
- package/dist/runs/run-database.js +930 -0
- package/dist/runs/run-database.js.map +1 -0
- package/dist/runs/run-index.d.ts +35 -9
- package/dist/runs/run-index.js +200 -25
- package/dist/runs/run-index.js.map +1 -1
- package/dist/runs/run-row.d.ts +44 -0
- package/dist/runs/run-row.js +84 -0
- package/dist/runs/run-row.js.map +1 -0
- package/dist/runs/run-search.d.ts +29 -0
- package/dist/runs/run-search.js +63 -0
- package/dist/runs/run-search.js.map +1 -0
- package/dist/runs/store-open-error.d.ts +24 -0
- package/dist/runs/store-open-error.js +61 -0
- package/dist/runs/store-open-error.js.map +1 -0
- package/dist/runs/store.d.ts +667 -32
- package/dist/runs/store.js +2153 -324
- package/dist/runs/store.js.map +1 -1
- package/dist/runs/transcript-facts.d.ts +77 -0
- package/dist/runs/transcript-facts.js +302 -0
- package/dist/runs/transcript-facts.js.map +1 -0
- package/dist/runs/webhook.js +5 -4
- package/dist/runs/webhook.js.map +1 -1
- package/dist/runs/worker-execution.d.ts +22 -0
- package/dist/runs/worker-execution.js +30 -0
- package/dist/runs/worker-execution.js.map +1 -0
- package/dist/server/capabilities.d.ts +1 -0
- package/dist/server/capabilities.js +2 -0
- package/dist/server/capabilities.js.map +1 -1
- package/dist/server/cockpit-ownership.d.ts +8 -0
- package/dist/server/cockpit-ownership.js +19 -0
- package/dist/server/cockpit-ownership.js.map +1 -1
- package/dist/server/forge/github.d.ts +1 -4
- package/dist/server/forge/github.js +47 -23
- package/dist/server/forge/github.js.map +1 -1
- package/dist/server/git.js +1 -1
- package/dist/server/git.js.map +1 -1
- package/dist/server/open-in-app.js +1 -0
- package/dist/server/open-in-app.js.map +1 -1
- package/dist/server/preview-socket.d.ts +36 -0
- package/dist/server/preview-socket.js +126 -0
- package/dist/server/preview-socket.js.map +1 -0
- package/dist/server/project-context.d.ts +31 -4
- package/dist/server/project-context.js +73 -9
- package/dist/server/project-context.js.map +1 -1
- package/dist/server/provider-action-gate.js +1 -0
- package/dist/server/provider-action-gate.js.map +1 -1
- package/dist/server/repo-branches.d.ts +4 -3
- package/dist/server/repo-branches.js +5 -4
- package/dist/server/repo-branches.js.map +1 -1
- package/dist/server/server.d.ts +4500 -2727
- package/dist/server/server.js +651 -202
- package/dist/server/server.js.map +1 -1
- package/dist/server/upgrade-router.d.ts +23 -0
- package/dist/server/upgrade-router.js +53 -0
- package/dist/server/upgrade-router.js.map +1 -0
- package/dist/server/validators.d.ts +6 -1
- package/dist/server/validators.js +4 -4
- package/dist/server/validators.js.map +1 -1
- package/dist/server/ws.d.ts +16 -16
- package/dist/server/ws.js +56 -54
- package/dist/server/ws.js.map +1 -1
- package/dist/skills-remote.d.ts +14 -0
- package/dist/skills-remote.js +91 -15
- package/dist/skills-remote.js.map +1 -1
- package/dist/task-cli/cli.js +40 -16
- package/dist/task-cli/cli.js.map +1 -1
- package/dist/task-cli/discovery.d.ts +4 -3
- package/dist/task-cli/discovery.js +4 -3
- package/dist/task-cli/discovery.js.map +1 -1
- package/dist/task-cli/http.d.ts +2 -0
- package/dist/task-cli/http.js +10 -4
- package/dist/task-cli/http.js.map +1 -1
- package/dist/task-cli/projections.d.ts +5 -2
- package/dist/task-cli/projections.js +13 -0
- package/dist/task-cli/projections.js.map +1 -1
- package/dist/task-cli/watch.d.ts +15 -2
- package/dist/task-cli/watch.js +31 -9
- package/dist/task-cli/watch.js.map +1 -1
- package/dist/ui-state.d.ts +4 -3
- package/dist/ui-state.js +8 -3
- package/dist/ui-state.js.map +1 -1
- package/dist/workflows/grouped-command.d.ts +31 -0
- package/dist/workflows/grouped-command.js +143 -0
- package/dist/workflows/grouped-command.js.map +1 -0
- package/dist/workflows/run.d.ts +223 -42
- package/dist/workflows/run.js +1316 -398
- package/dist/workflows/run.js.map +1 -1
- package/dist/workflows/types.d.ts +12 -0
- package/dist/workflows/types.js +20 -0
- package/dist/workflows/types.js.map +1 -1
- package/dist/workspace/agent-accounts.d.ts +5 -1
- package/dist/workspace/agent-accounts.js +1 -0
- package/dist/workspace/agent-accounts.js.map +1 -1
- package/dist/workspace/agent-profiles.js +1 -1
- package/dist/workspace/agent-profiles.js.map +1 -1
- package/dist/workspace/config.d.ts +3 -1
- package/dist/workspace/config.js +1 -0
- package/dist/workspace/config.js.map +1 -1
- package/dist/worktree-setup.d.ts +85 -0
- package/dist/worktree-setup.js +164 -0
- package/dist/worktree-setup.js.map +1 -0
- package/package.json +7 -5
- package/scripts/benchmark-run-store-fixture.ts +428 -0
- package/scripts/benchmark-run-store.ts +743 -0
- package/scripts/benchmark-stuck-destroys.ts +143 -0
- package/scripts/mock-autonomous.mjs +11 -0
- package/scripts/mock-ci-tool.mjs +20 -5
- package/scripts/mock-claude.mjs +110 -1
- package/scripts/mock-codex-app-server.mjs +117 -2
- package/scripts/mock-codex-coalesce-steer.mjs +59 -0
- package/scripts/mock-codex-reverse-steer.mjs +130 -0
- package/scripts/mock-cursor-acp.mjs +75 -1
- package/scripts/mock-omp-rpc.mjs +605 -0
- package/scripts/mock-opencode-serve.mjs +312 -22
- package/scripts/mock-pi-rpc.mjs +109 -3
- package/scripts/mock-runner-crash.mjs +42 -0
- package/scripts/mock-silent-tail.mjs +78 -0
- package/scripts/mock-turn-messages.mjs +5 -0
- package/scripts/omp-ci-wait.mjs +29 -0
- package/scripts/omp-restrict-delegation.yml +4 -0
- package/scripts/pi-ci-wait.mjs +12 -9
- package/scripts/seed-archive-profile.ts +3 -3
- package/web/dist/assets/agent-accounts-CFOBMVHc.js +1 -0
- package/web/dist/assets/alert-dialog-BrpNUwMt.js +1 -0
- package/web/dist/assets/app-window-CSHwDX9N.js +1 -0
- package/web/dist/assets/button-C_rd7CPp.js +43 -0
- package/web/dist/assets/compare-variants-D6WXhvXA.js +1 -0
- package/web/dist/assets/diff-DrEARXTV.js +3 -0
- package/web/dist/assets/diff-controls-B1-j7nFg.js +1 -0
- package/web/dist/assets/{diff-view-DPn6bQ5W.js → diff-view-DvGLjdTk.js} +3 -3
- package/web/dist/assets/dropdown-menu-BegOZFrj.js +1 -0
- package/web/dist/assets/format-DpNe3S0A.js +1 -0
- package/web/dist/assets/git-toolbar-Cw4ljmhB.js +1 -0
- package/web/dist/assets/github-CfV5sqL0.js +1 -0
- package/web/dist/assets/{image-preview-DJ8cgb1Z.js → image-preview-FOEfqpZP.js} +1 -1
- package/web/dist/assets/index-DgWWlOLy.js +13 -0
- package/web/dist/assets/index-fBFnuvxu.css +1 -0
- package/web/dist/assets/{nav-row-styles-3j64kH5s.js → nav-row-styles-vp2JbhuJ.js} +1 -1
- package/web/dist/assets/play-CmVAj_fu.js +1 -0
- package/web/dist/assets/popover-BohP6WTx.js +1 -0
- package/web/dist/assets/preview-pane-connected-qTA5KNoJ.js +3 -0
- package/web/dist/assets/preview-state-vuMviq6q.js +1 -0
- package/web/dist/assets/prompt-templates-Cubdut_C.js +15 -0
- package/web/dist/assets/repo-git-Cf4t5PD0.js +1 -0
- package/web/dist/assets/{run-diff-5-RRdcVz.js → run-diff-BpkUW37Z.js} +3 -3
- package/web/dist/assets/run-header-68WHf9wV.js +1 -0
- package/web/dist/assets/skills-DiVIgKeU.js +1 -0
- package/web/dist/assets/square-terminal-B6RYYieR.js +1 -0
- package/web/dist/assets/status-dot-CqTJHSP9.js +1 -0
- package/web/dist/assets/{tab-link-K0hjzEXR.js → tab-link-B07Hu4QX.js} +1 -1
- package/web/dist/assets/task-changes--lQF6EYf.js +1 -0
- package/web/dist/assets/task-commits-Cx0qy4DN.js +1 -0
- package/web/dist/assets/task-files-D50s-gKW.js +2 -0
- package/web/dist/assets/task-github-item-DaqmSwYT.js +1 -0
- package/web/dist/assets/task-thread-BPQ64lui.js +7 -0
- package/web/dist/assets/{task-thread-Bw_nQuTx.css → task-thread-zNE2Q9E-.css} +1 -1
- package/web/dist/assets/textarea-D20O4Pw0.js +1 -0
- package/web/dist/assets/thread-state-DWcFMrvb.js +4 -0
- package/web/dist/assets/use-hand-to-agent-state-BLIGmwbd.css +1 -0
- package/web/dist/assets/use-hand-to-agent-state-Cy9eyyfL.js +1 -0
- package/web/dist/assets/{utils-fzNfbPzA.js → utils-JsL3ZsJf.js} +1 -1
- package/web/dist/assets/workflows-jwG7uxqi.js +11 -0
- package/web/dist/assets/{zoomable-image-CDmZ_Rtl.js → zoomable-image-BJJ64KGc.js} +1 -1
- package/web/dist/cezarion-lockup-dark.svg +1 -13
- package/web/dist/cezarion-lockup-light.svg +1 -13
- package/web/dist/cezarion-mark-dark.svg +1 -12
- package/web/dist/cezarion-mark-light.svg +1 -12
- package/web/dist/index.html +16 -21
- package/web/dist/assets/agent-accounts-CU2ZDv24.js +0 -1
- package/web/dist/assets/alert-dialog-C-xYE_dg.js +0 -43
- package/web/dist/assets/chevron-right-BENZ-1ZN.js +0 -1
- package/web/dist/assets/collapsible-DD9J91Iv.js +0 -1
- package/web/dist/assets/compare-variants-5FmqpFSN.js +0 -1
- package/web/dist/assets/diff-controls-Bj0YrioE.js +0 -1
- package/web/dist/assets/diff-rE8rm75J2.js +0 -3
- package/web/dist/assets/diff-stat-BKDCSVfJ.js +0 -1
- package/web/dist/assets/dropdown-menu-Ch5BYQh_.js +0 -1
- package/web/dist/assets/format-dBiNDNVe.js +0 -1
- package/web/dist/assets/git-toolbar-ClVvf5iF.js +0 -1
- package/web/dist/assets/github-BkNOyour.css +0 -1
- package/web/dist/assets/github-DeZMeMwJ.js +0 -1
- package/web/dist/assets/github-item-detail-W5F6GVjF.js +0 -1
- package/web/dist/assets/github-sidebar-model-DcMu-IK2.js +0 -1
- package/web/dist/assets/highlighter-CdHqIwFr.js +0 -3
- package/web/dist/assets/index-CatemBEL.js +0 -8
- package/web/dist/assets/index-MvfD8bZJ.css +0 -1
- package/web/dist/assets/markdown-zdKeLIYA.js +0 -2
- package/web/dist/assets/mobile-run-bar-BCfmFi8V.js +0 -1
- package/web/dist/assets/prompt-templates-CBPp39IU.js +0 -15
- package/web/dist/assets/reference-chip-D6owncJT.js +0 -1
- package/web/dist/assets/repo-git-CtdkZFey.js +0 -1
- package/web/dist/assets/run-header-BcjoDi0W.js +0 -1
- package/web/dist/assets/sheet-ChnYVrp1.js +0 -1
- package/web/dist/assets/skills-C8YKp2vr.js +0 -1
- package/web/dist/assets/task-changes-BW8YdWG8.js +0 -1
- package/web/dist/assets/task-commits-q2kB2y6L.js +0 -1
- package/web/dist/assets/task-files-pPL6_3Cr.js +0 -2
- package/web/dist/assets/task-github-item-BXF5R52U.js +0 -1
- package/web/dist/assets/task-thread-DtkFL3EC.js +0 -10
- package/web/dist/assets/textarea-DxlkE-Yd.js +0 -1
- package/web/dist/assets/token-metrics-DIAjrPlM.js +0 -1
- package/web/dist/assets/use-desktop-CrDny2uG.js +0 -1
- package/web/dist/assets/use-submit-shortcut-KWJsC906.js +0 -1
- package/web/dist/assets/workflows-TmcPEj2K.js +0 -11
- /package/web/dist/assets/{lib-BQXq3kEf2.js → lib-BQXq3kEf.js} +0 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/html-BY76lXLH.js","assets/css-BsVw1vtW.js","assets/javascript-BgS3c2Ky.js","assets/core-BCsw8oQw.js","assets/lib-BxQXEXDF.js","assets/rolldown-runtime-QTnfLwEv.js","assets/preview-pane-connected-qTA5KNoJ.js","assets/react-runtime-CCIEwYL0.js","assets/button-C_rd7CPp.js","assets/utils-JsL3ZsJf.js","assets/bundle-mjs-BT31bpU6.js","assets/thread-state-DWcFMrvb.js","assets/createLucideIcon-BHp8sXmF.js","assets/app-window-CSHwDX9N.js","assets/status-dot-CqTJHSP9.js","assets/preview-state-vuMviq6q.js","assets/format-DpNe3S0A.js","assets/play-CmVAj_fu.js","assets/square-terminal-B6RYYieR.js","assets/info-DA1x_4bz.js","assets/dropdown-menu-BegOZFrj.js","assets/task-thread-BPQ64lui.js","assets/alert-dialog-BrpNUwMt.js","assets/run-header-68WHf9wV.js","assets/popover-BohP6WTx.js","assets/tab-link-B07Hu4QX.js","assets/agent-accounts-CFOBMVHc.js","assets/textarea-D20O4Pw0.js","assets/run-header-8GObNx6F.css","assets/prompt-templates-Cubdut_C.js","assets/search-x-I9Q8pgUa.js","assets/lib-BQXq3kEf.js","assets/zoomable-image-BJJ64KGc.js","assets/run-diff-BpkUW37Z.js","assets/task-thread-zNE2Q9E-.css","assets/compare-variants-D6WXhvXA.js","assets/task-changes--lQF6EYf.js","assets/git-toolbar-Cw4ljmhB.js","assets/diff-controls-B1-j7nFg.js","assets/diff-DrEARXTV.js","assets/image-preview-FOEfqpZP.js","assets/task-files-D50s-gKW.js","assets/task-commits-Cx0qy4DN.js","assets/task-github-item-DaqmSwYT.js","assets/use-hand-to-agent-state-Cy9eyyfL.js","assets/skills-DFBiAuJG.js","assets/use-hand-to-agent-state-BLIGmwbd.css","assets/repo-git-Cf4t5PD0.js","assets/nav-row-styles-vp2JbhuJ.js","assets/repo-git-CoKp-g9K.css","assets/github-CfV5sqL0.js","assets/workflows-jwG7uxqi.js","assets/skill-empty-hint-oOtzR3v0.js","assets/skills-DiVIgKeU.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,n,r,t as i}from"./react-runtime-CCIEwYL0.js";import{$ as a,Ai as o,At as s,B as c,Bi as l,Br as u,Bt as d,Ci as f,Cr as p,Ct as m,D as h,Di as g,Dr as _,Dt as v,E as y,Ei as b,Et as x,F as S,Fi as C,G as w,Gn as T,Gt as E,Hi as D,Hr as O,Ht as k,I as A,Ii as j,It as ee,J as te,Jr as M,Jt as ne,K as re,Kr as N,Kt as ie,L as P,Li as ae,M as oe,Mi as se,Mn as ce,Mt as le,N as ue,Ni as de,Nn as fe,Nr as pe,O as me,Oi as he,Ot as F,P as ge,Pi as I,Pt as _e,Q as ve,R as ye,Ri as be,Rr as xe,Rt as Se,S as Ce,Sa as we,Si as L,St as Te,T as Ee,Ti as De,Tt as R,U as Oe,Ui as ke,Ur as Ae,Ut as je,V as Me,Vi as Ne,Vr as Pe,Vt as Fe,W as Ie,Wt as Le,X as Re,Xt as ze,Yn as Be,Yr as Ve,Yt as He,Z as Ue,Zn as We,Zt as Ge,_ as Ke,_a as qe,_t as Je,a as Ye,ai as Xe,at as Ze,b as Qe,ba as $e,c as et,ca as tt,ct as nt,d as rt,dn as it,dt as at,ea as ot,et as st,f as ct,fa as lt,fn as ut,ft as dt,g as z,gi as ft,h as pt,ha as mt,hi as ht,hn as gt,ht as _t,i as vt,ii as yt,ir as bt,it as xt,j as St,ji as Ct,jn as wt,jt as Tt,k as Et,ki as Dt,l as Ot,la as kt,lt as At,m as jt,ma as Mt,mi as Nt,mn as Pt,mt as Ft,nn as It,nt as Lt,o as Rt,oa as zt,on as Bt,ot as Vt,p as Ht,pa as Ut,pi as Wt,pt as Gt,qr as Kt,r as qt,ra as Jt,ri as Yt,rt as Xt,s as Zt,sa as Qt,si as $t,sr as en,st as tn,t as B,ta as V,tt as nn,ua as rn,un as an,ut as on,v as H,vt as sn,w as cn,wt as ln,x as un,xa as dn,xi as fn,xt as pn,yi as mn,yt as hn,z as gn,zn as _n,zt as vn}from"./button-C_rd7CPp.js";import{A as yn,D as bn,G as xn,H as Sn,J as Cn,K as wn,T as Tn,U as En,W as Dn,_ as On,b as kn,d as An,f as jn,g as Mn,h as Nn,i as Pn,l as Fn,m as In,n as Ln,o as Rn,p as zn,q as Bn,r as Vn,s as Hn,t as U,v as Un,w as Wn}from"./utils-JsL3ZsJf.js";import{$ as Gn,A as Kn,An as qn,Bn as Jn,Bt as Yn,C as Xn,Cn as Zn,Ct as Qn,D as $n,Dn as er,Dt as tr,E as nr,En as rr,Fn as ir,Gn as ar,Gt as or,Hn as sr,Ht as cr,In as lr,It as ur,Jn as dr,Jt as fr,K as W,Kn as pr,Kt as mr,Ln as hr,Lt as gr,M as _r,Mn as vr,N as yr,Nn as br,On as xr,Ot as Sr,P as Cr,Pn as wr,Qt as Tr,R as Er,Rn as Dr,Rt as Or,S as kr,Sn as Ar,T as jr,Tn as Mr,Un as Nr,Ut as Pr,Vn as Fr,Vt as Ir,Wn as Lr,Wt as Rr,X as zr,Xn as Br,Xt as Vr,Y as Hr,Yt as Ur,Zt as Wr,_ as G,_n as Gr,_t as Kr,a as qr,an as Jr,at as Yr,b as K,bn as Xr,bt as Zr,c as Qr,cn as $r,ct as ei,d as ti,dn as ni,dt as ri,en as q,et as ii,f as ai,ft as oi,g as si,gt as ci,h as li,hn as ui,ht as di,i as fi,it as pi,j as mi,kn as hi,l as gi,ln as _i,lt as vi,m as yi,mn as bi,mt as xi,n as Si,nn as Ci,nt as wi,o as Ti,on as Ei,ot as Di,p as Oi,pn as ki,pt as Ai,q as ji,qn as J,qt as Mi,r as Ni,rn as Pi,rt as Fi,s as Ii,sn as Li,st as Ri,t as zi,tn as Bi,u as Vi,un as Hi,ut as Ui,v as Wi,vn as Gi,vt as Ki,w as qi,wn as Ji,wt as Yi,x as Xi,xn as Zi,xt as Qi,y as $i,yt as ea,z as ta,zn as na,zt as ra}from"./alert-dialog-BrpNUwMt.js";import{i as Y}from"./bundle-mjs-BT31bpU6.js";import{t as X}from"./createLucideIcon-BHp8sXmF.js";import{n as ia,t as aa}from"./status-dot-CqTJHSP9.js";import{_ as oa,a as sa,c as ca,d as la,f as ua,g as da,h as fa,i as pa,m as ma,o as ha,p as ga,r as _a,s as va,u as ya,y as ba}from"./nav-row-styles-vp2JbhuJ.js";import{i as xa,n as Sa,o as Ca,r as wa,s as Ta,t as Ea}from"./popover-BohP6WTx.js";import{A as Da,C as Oa,D as ka,E as Aa,F as ja,I as Ma,L as Na,M as Pa,N as Fa,O as Ia,P as La,S as Ra,T as za,_ as Ba,a as Va,b as Ha,c as Ua,d as Wa,f as Ga,g as Ka,h as qa,i as Ja,j as Ya,k as Xa,l as Za,m as Qa,n as $a,o as eo,p as to,r as no,t as ro,u as io,v as ao,w as oo,x as so,y as co}from"./prompt-templates-Cubdut_C.js";import{c as lo,d as uo,l as fo,s as po,t as mo,u as ho}from"./preview-state-vuMviq6q.js";import{a as go,c as _o,d as vo,f as yo,i as bo,l as xo,n as So,o as Co,r as Z,s as wo,t as To,u as Eo}from"./format-DpNe3S0A.js";import{t as Do}from"./play-CmVAj_fu.js";import{t as Oo}from"./search-x-I9Q8pgUa.js";import{t as ko}from"./square-terminal-B6RYYieR.js";import{n as Ao,t as jo}from"./agent-accounts-CFOBMVHc.js";import{C as Mo,S as No,_ as Po,a as Fo,b as Io,c as Lo,d as Ro,f as zo,g as Bo,h as Vo,i as Ho,l as Uo,m as Wo,o as Go,p as Ko,r as qo,s as Jo,t as Yo,u as Xo,v as Zo,w as Qo,x as $o,y as es}from"./dropdown-menu-BegOZFrj.js";import{a as ts,i as ns,n as rs,o as is,r as as,s as os,t as ss}from"./textarea-D20O4Pw0.js";import{a as cs,c as ls,d as us,f as ds,i as fs,n as ps,o as ms,r as hs,s as gs,t as _s,u as vs}from"./skills-DFBiAuJG.js";import{i as ys,n as bs}from"./chunk-BO2N2NFS-DE6qKn3r.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var xs=class extends we{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new dr({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=Ss(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=Ss(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=Ss(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=Ss(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){Qt.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>lt(t,e))}findAll(e={}){return this.getAll().filter(t=>lt(e,t))}notify(e){Qt.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return Qt.batch(()=>Promise.all(e.map(e=>e.continue().catch(Mt))))}};function Ss(e){return e.options.scope?.id}var Cs=class extends we{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??rn(r,t),a=this.get(i);return a||(a=new Jt({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){Qt.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Ut(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Ut(e,t)):t}notify(e){Qt.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Qt.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Qt.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},ws=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Cs,this.#t=e.mutationCache||new xs,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=dn.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=zt.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(qe(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=tt(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return Qt.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;Qt.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return Qt.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=Qt.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(Mt).catch(Mt)}invalidateQueries(e,t={}){return Qt.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=Qt.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(Mt)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(Mt)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(qe(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Mt).catch(Mt)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Mt).catch(Mt)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return zt.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(kt(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{mt(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(kt(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{mt(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=rn(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===$e&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Q=e(t(),1),Ts=n();function Es(e,t){if(e===`ping`)return{project:null,event:{type:`ping`}};let n;try{n=JSON.parse(t)}catch{return null}if(!Ds(n))return null;let r=n.project;if(typeof r!=`string`||r===``)return null;switch(e){case`run`:{let{project:e,...t}=n;return Os(t)?{project:r,event:{type:`run`,run:t}}:null}case`run-deleted`:{let e=n.id;return typeof e==`string`&&e?{project:r,event:{type:`run-deleted`,id:e}}:null}case`todos`:return Array.isArray(n.items)?{project:r,event:{type:`todos`,items:n.items}}:null;case`usage`:return Ds(n.usage)?{project:r,event:{type:`usage`,usage:n.usage}}:null;default:return null}}function Ds(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Os(e){return Ds(e)&&typeof e.id==`string`&&e.id!==``}function ks(e,t){if(!e)return;let n=e.findIndex(e=>e.id===t.id);if(n>=0){let r=[...e];return r[n]=Ms(e[n],t),r}let r=t.createdAt??``,i=e.findIndex(e=>(e.createdAt??``).localeCompare(r)<0),a=[...e];return a.splice(i<0?e.length:i,0,yn(t)),a}function As(e,t){if(!e)return;let n=e.filter(e=>e.id!==t);return n.length===e.length?e:n}function js(e,t){return e?.usage?{...t,usage:e.usage}:t}function Ms(e,t){return yn(e?.usage?{...t,usage:e.usage}:t)}var Ns=Object.freeze({});function Ps(){let e=Ns,t=new Set;return{subscribe(e){return t.add(e),()=>t.delete(e)},get:()=>e,set(n){e=n;for(let e of t)e()}}}var $=i(),Fs=Pn(`/workspace/events`),Is=2,Ls=3e3,Rs=[`run`,`run-deleted`,`todos`,`usage`,`ping`],zs=[`project-added`,`project-removed`,`checkout-progress`,`automation-change`],Bs=new Set;function Vs(e){return Bs.add(e),()=>{Bs.delete(e)}}var Hs=400;function Us(e){let t;return{onEvent(n){n.type!==`run`&&n.type!==`run-deleted`||t===void 0&&(t=setTimeout(()=>{t=void 0,e.invalidateQueries({queryKey:q.runsIndex})},Hs))},cancel(){clearTimeout(t),t=void 0}}}function Ws(e){return e[1]===`runs`&&e[2]===`list`}function Gs(e,t){return e.cancelQueries({queryKey:t}).then(()=>e.invalidateQueries({queryKey:t}))}function Ks(e){return e.invalidateQueries({predicate:e=>Ws(e.queryKey),refetchType:`none`}),e.getQueryCache().findAll({predicate:e=>Ws(e.queryKey)&&(e.state.data!==void 0||e.state.fetchStatus!==`idle`)}).map(t=>Gs(e,t.queryKey))}function qs(e){pr(()=>{for(let t of e.getQueryCache().findAll({predicate:e=>Ws(e.queryKey)}))t.state.data===void 0&&t.state.fetchStatus!==`idle`&&e.cancelQueries({queryKey:t.queryKey,exact:!0});return[e.invalidateQueries({queryKey:K.runs.all}),e.invalidateQueries({predicate:e=>Ws(e.queryKey)}),e.invalidateQueries({queryKey:q.runsIndex}),e.invalidateQueries({queryKey:K.todos}),Gs(e,K.health),e.invalidateQueries({queryKey:K.worktrees}),e.invalidateQueries({queryKey:K.repoBranches}),e.invalidateQueries({queryKey:q.providerStatus}),Gs(e,q.models(`cursor`)),e.invalidateQueries({predicate:({queryKey:e})=>e.length===3&&e[1]===`github`&&(e[2]===null||typeof e[2]==`number`)})]})}function Js(e){return Rn()??Ys(e)}function Ys(e){let t=e.getQueryData(q.projects)?.bootProject;return typeof t==`string`&&t!==``?t:e.getQueryData(K.health)?.bootProject??e.getQueryData([`default`,`health`])?.bootProject}function Xs(e,t){return[e===t?`default`:e,`runs`,`list`]}function Zs(e){let t=new Map,n=new Map,r=t=>{let r=n.get(JSON.stringify(t));if(!r)return;let i=e.getQueryCache().find({queryKey:t,exact:!0}),a=i?.promise;r.phase=`awaiting-fetch`,r.dirty=!1,e.invalidateQueries({queryKey:t,exact:!0}),i?.promise&&i.promise!==a&&(r.phase=`fetching`)},i=e.getQueryCache().subscribe(t=>{if(!n.size||t.type!==`updated`)return;let i=JSON.stringify(t.query.queryKey),a=n.get(i);if(a){if(t.action.type===`setState`){t.query.state.isInvalidated||e.invalidateQueries({queryKey:a.key,exact:!0,refetchType:`none`});return}if(t.action.type===`fetch`){a.phase===`awaiting-fetch`&&(a.phase=`fetching`),a.dirty=!1;return}if(t.action.type===`success`){if(!t.action.manual){a.phase===`fetching`&&!a.dirty?n.delete(i):r(a.key);return}a.phase!==`needs-start`&&(a.phase===`fetching`&&(a.dirty=!0),e.invalidateQueries({queryKey:a.key,exact:!0},{cancelRefetch:!1}))}}}),a=(t,r)=>{let i=JSON.stringify(t),a=e.getQueryCache().find({queryKey:t,exact:!0});if(!a)return;let o=n.get(i);!o&&(a.state.fetchStatus!==`idle`||a.state.isInvalidated)||o&&a.state.fetchStatus===`idle`?(n.set(i,{key:t,phase:`needs-start`,dirty:!1}),a.state.fetchStatus!==`idle`&&e.cancelQueries({queryKey:t,exact:!0}),r.some(e=>JSON.stringify(e)===i)||r.push(t)):o?.phase===`fetching`&&(o.dirty=!0)},o,s,c=(i=!1)=>{s!==void 0&&clearTimeout(s),s=void 0,o!==void 0&&cancelAnimationFrame(o),o=void 0;let c=[];for(let{key:r,baseList:i,baseQuery:o,baseUpdateCount:s,runs:l}of t.values()){let t=e.getQueryCache().find({queryKey:r,exact:!0});if(t!==o||t?.state.dataUpdateCount!==s||t?.state.data!==i){c.push(r),n.set(JSON.stringify(r),{key:r,phase:`needs-start`,dirty:!1}),e.cancelQueries({queryKey:r,exact:!0});continue}a(r,c),e.setQueryData(r,e=>{let t=e;for(let e of l.values())t=ks(t,e);return t})}if(t.clear(),!i)for(let e of c)r(e);return c},l=t=>{let n=[Xs(t,Ys(e))],r=[t,`runs`,`list`];return(t===Js(e)||e.getQueryState(r))&&n.push(r),t===Js(e)&&n.push(K.runs.list()),[...new Map(n.map(e=>[JSON.stringify(e),e])).values()]};return{onEvent(i,u){let d=l(i);if(u.type===`run`&&u.run.archived&&d.every(t=>!e.getQueryData(t)?.find(e=>e.id===u.run.id)?.archived)&&u.type===`run`){for(let r of d){let i=JSON.stringify(r),a=n.get(i);a?.phase===`fetching`&&(a.dirty=!0);let o=t.get(i);if(!o){let n=e.getQueryCache().find({queryKey:r,exact:!0});o={key:r,baseList:n?.state.data,baseQuery:n,baseUpdateCount:n?.state.dataUpdateCount,runs:new Map},t.set(i,o)}o.runs.set(u.run.id,u.run)}s===void 0&&(s=setTimeout(()=>{c()},50),typeof requestAnimationFrame==`function`&&(o=requestAnimationFrame(()=>{c()})));return}let f=c(!0);for(let t of d)a(t,f),u.type===`run`?e.setQueryData(t,e=>ks(e,u.run)):e.setQueryData(t,e=>As(e,u.id));for(let e of f)r(e)},flush:c,cancel(){i(),n.clear()}}}function Qs(e){let t=new Map;return{refresh(n){let r=K.runs.detail(n);if(!e.getQueryState(r))return;let i=JSON.stringify(r);clearTimeout(t.get(i)),e.cancelQueries({queryKey:r}),t.set(i,setTimeout(()=>{t.delete(i),e.invalidateQueries({queryKey:r})},400))},cancel(){for(let e of t.values())clearTimeout(e);t.clear()}}}var $s=400;function ec(e){return JSON.stringify([e.status,e.currentStepId,e.activity,e.delegation])}function tc(e){let t=new Map,n=new Map,r=(t,r)=>{if(r&&!e.getQueryState(t))return;let i=JSON.stringify(t);n.has(i)||n.set(i,setTimeout(()=>{n.delete(i),e.invalidateQueries({queryKey:t})},$s))};return{onRun(e){let n=e.delegation?.role===`worker`?e.delegation.parentRunId:void 0,i=ec(e),a=t.get(e.id);t.set(e.id,n===void 0?{shape:i}:{shape:i,parentRunId:n}),a?.shape!==i&&(r(K.runs.relationships(e.id),!0),n!==void 0&&r(K.runs.relationships(n),!0))},onDeleted(n){let i=t.get(n);t.delete(n),e.removeQueries({queryKey:K.runs.relationships(n)}),i?.parentRunId===void 0?r([...K.runs.all,`relationships`],!1):r(K.runs.relationships(i.parentRunId),!0)},cancel(){for(let e of n.values())clearTimeout(e);n.clear(),t.clear()}}}var nc={predicate:e=>e.queryKey[1]===`runs`&&e.queryKey[2]===`archived`};function rc(e,t){if(t.delegation?.role===`worker`)return;let n=!1;for(let r of e.getQueryCache().findAll(nc)){let i=r.state.data;if(i)if(i.pages.some(e=>e.runs.some(e=>e.id===t.id))){let a=yn(t);e.setQueryData(r.queryKey,{...i,pages:i.pages.map(e=>({...e,runs:e.runs.map(e=>e.id===t.id?{...a,...e.usage?{usage:e.usage}:{}}:e)}))}),(!t.archived||r.queryKey[3]!==``)&&(n=!0)}else t.archived&&(n=!0)}n&&e.invalidateQueries(nc)}function ic(e,t,n,r,i){switch(n.type){case`run`:{rc(e,n.run),i.onRun(n.run);let t=K.runs.detail(n.run.id);if(e.getQueryData(t)!==void 0&&e.setQueryData(t,e=>js(e,n.run)),r(n.run.id),n.run.delegation?.role===`worker`){let t=K.runs.detail(n.run.delegation.parentRunId);e.setQueryData(t,e=>{if(!e)return e;let{finishBlocked:t,...n}=e;return n}),r(n.run.delegation.parentRunId)}let a=K.runs.changes(n.run.id);e.getQueryData(a)!==void 0&&e.invalidateQueries({queryKey:a}),e.invalidateQueries({queryKey:K.worktrees}),e.invalidateQueries({queryKey:K.repoBranches});return}case`run-deleted`:i.onDeleted(n.id),e.removeQueries({queryKey:K.runs.detail(n.id)}),e.removeQueries({queryKey:K.runs.diff(n.id)}),e.setQueriesData(nc,e=>e&&e.pages.some(e=>e.runs.some(e=>e.id===n.id))?{...e,pages:e.pages.map(e=>({...e,runs:e.runs.filter(e=>e.id!==n.id)}))}:e),e.invalidateQueries(nc),e.invalidateQueries({queryKey:K.worktrees}),e.invalidateQueries({queryKey:K.repoBranches});return;case`todos`:e.setQueryData(K.todos,n.items);return;case`usage`:t.set(n.usage);return;case`ping`:return}}function ac(e,t=Fs){let n=V();(0,Q.useEffect)(()=>{let r=globalThis.EventSource;if(typeof r!=`function`)return;let i=null,a=Us(n),o=Qs(n),s=Zs(n),c=tc(n),l=!1,u,d=!1,p=!1,m=!1,h=!1,g=()=>{m=!0,h=!1;let e=q.providerStatus;n.cancelQueries({queryKey:e,exact:!0}).then(()=>n.invalidateQueries({queryKey:e,exact:!0,refetchType:`active`})).finally(()=>{if(p||!h){m=!1;return}g()})},_=()=>{p||u!==void 0||(u=setTimeout(()=>{u=void 0,p||v()},Ls))},v=()=>{i?.close(),i=new r(t,{withCredentials:!0}),i.addEventListener(`open`,()=>{if(l=!0,d&&(s.flush(),qs(n)),!d){pr(()=>Ks(n));for(let e of[K.health,q.models(`cursor`)])n.cancelQueries({queryKey:e}).then(()=>{p||n.invalidateQueries({queryKey:e})})}d=!0});for(let t of Rs)i.addEventListener(t,r=>{let i=Es(t,r.data);i&&(i.event.type===`ping`&&l&&(l=!1,pr(()=>Ks(n))),a.onEvent(i.event),i.project!==null&&(i.event.type===`run`||i.event.type===`run-deleted`)&&s.onEvent(i.project,i.event),!(i.project!==null&&i.project!==Js(n))&&ic(n,e,i.event,o.refresh,c))});for(let e of zs)i.addEventListener(e,t=>{let r;try{r=JSON.parse(t.data)}catch{return}e!==`checkout-progress`&&e!==`automation-change`&&n.invalidateQueries({queryKey:q.projects});for(let t of[...Bs])t(e,r)});i.addEventListener(`health`,e=>{let t;try{t=JSON.parse(e.data)}catch{return}let r=Cn.safeParse(t);r.success&&(n.cancelQueries({queryKey:K.health}),n.setQueryData(K.health,r.data))}),i.addEventListener(`model-catalog`,e=>{let t;try{t=JSON.parse(e.data)}catch{return}let r=wn.safeParse(t);if(!r.success||r.data.runner!==`cursor`)return;let i=q.models(`cursor`);n.cancelQueries({queryKey:i}),n.setQueryData(i,r.data)}),i.addEventListener(`provider-status`,e=>{let t;try{t=JSON.parse(e.data)}catch{return}let r=De(t);if(!r)return;let i=q.providerStatus,a=f(n.getQueryData(i),r);if(a!==void 0){n.setQueryData(i,a);return}if(m){h=!0;return}g()}),i.addEventListener(`error`,()=>{i?.readyState===Is&&_()})},y=()=>{document.visibilityState===`visible`&&(s.flush(),qs(n),(!i||i.readyState===Is)&&(clearTimeout(u),u=void 0,v()))},b=()=>{clearTimeout(u),u=void 0,s.flush(),i?.close()},x=e=>{e.persisted&&(qs(n),v())};return document.addEventListener(`visibilitychange`,y),window.addEventListener(`pagehide`,b),window.addEventListener(`pageshow`,x),v(),()=>{p=!0,clearTimeout(u),s.flush(),s.cancel(),a.cancel(),o.cancel(),c.cancel(),document.removeEventListener(`visibilitychange`,y),window.removeEventListener(`pagehide`,b),window.removeEventListener(`pageshow`,x),i?.close(),i=null}},[n,e,t])}var oc=(0,Q.createContext)(null);function sc({children:e}){let[t]=(0,Q.useState)(Ps);return ac(t),ji(),(0,$.jsx)(oc.Provider,{value:t,children:e})}function cc(e){let t=(0,Q.useContext)(oc),n=t?t.get:uc;return(0,Q.useSyncExternalStore)(t?t.subscribe:lc,()=>e?n()[e]:void 0,()=>void 0)}var lc=()=>()=>void 0,uc=()=>Ns;function dc(){return new ws({defaultOptions:{queries:{refetchInterval:!1,staleTime:5*6e4,gcTime:30*6e4,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:(e,t)=>t instanceof E&&t.status>=400&&t.status<500?!1:e<1},mutations:{retry:!1}}})}var fc=class extends Q.Component{state={error:null};static getDerivedStateFromError(e){return{error:e instanceof Error?e:Error(String(e))}}componentDidCatch(e,t){console.error(`cezar cockpit: uncaught render error`,e,t.componentStack)}render(){let{error:e}=this.state;return e?(0,$.jsxs)(`div`,{"data-slot":`app-error`,role:`alert`,style:{display:`flex`,minHeight:`100dvh`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:`12px`,padding:`24px`,textAlign:`center`,font:`14px/1.5 system-ui, sans-serif`},children:[(0,$.jsx)(`h1`,{style:{fontSize:`20px`,fontWeight:600,margin:0},children:`The cockpit hit an error`}),(0,$.jsxs)(`p`,{style:{margin:0,maxWidth:`52ch`},children:[`Reload to carry on. Nothing on disk changed — cezar’s state lives in`,` `,(0,$.jsx)(`code`,{children:`.ai/cezar/`}),`, and this page never wrote to it.`]}),(0,$.jsx)(`pre`,{"data-slot":`app-error-detail`,style:{margin:0,maxWidth:`100%`,overflowX:`auto`,textAlign:`left`,opacity:.75},children:e.message}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>location.reload(),style:{padding:`6px 14px`,cursor:`pointer`},children:`Reload`})]}):this.props.children}},pc=X(`archive-restore`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h2`,key:`tvwodi`}],[`path`,{d:`M20 8v11a2 2 0 0 1-2 2h-2`,key:`1gkqxj`}],[`path`,{d:`m9 15 3-3 3 3`,key:`1pd0qc`}],[`path`,{d:`M12 12v9`,key:`192myk`}]]),mc=X(`bookmark`,[[`path`,{d:`M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z`,key:`oz39mx`}]]),hc=X(`boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),gc=X(`braces`,[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]]),_c=X(`brush`,[[`path`,{d:`m11 10 3 3`,key:`fzmg1i`}],[`path`,{d:`M6.5 21A3.5 3.5 0 1 0 3 17.5a2.62 2.62 0 0 1-.708 1.792A1 1 0 0 0 3 21z`,key:`p4q2r7`}],[`path`,{d:`M9.969 17.031 21.378 5.624a1 1 0 0 0-3.002-3.002L6.967 14.031`,key:`wy6l02`}]]),vc=X(`check-check`,[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]),yc=X(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),bc=X(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),xc=X(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),Sc=X(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),Cc=X(`chevrons-left`,[[`path`,{d:`m11 17-5-5 5-5`,key:`13zhaf`}],[`path`,{d:`m18 17-5-5 5-5`,key:`h8a8et`}]]),wc=X(`chevrons-right`,[[`path`,{d:`m6 17 5-5-5-5`,key:`xnjwq`}],[`path`,{d:`m13 17 5-5-5-5`,key:`17xmmf`}]]),Tc=X(`clock-3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6h4`,key:`135r8i`}]]),Ec=X(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),Dc=X(`coins`,[[`path`,{d:`M13.744 17.736a6 6 0 1 1-7.48-7.48`,key:`bq4yh3`}],[`path`,{d:`M15 6h1v4`,key:`11y1tn`}],[`path`,{d:`m6.134 14.768.866-.5 2 3.464`,key:`17snzx`}],[`circle`,{cx:`16`,cy:`8`,r:`6`,key:`14bfc9`}]]),Oc=X(`compass`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z`,key:`9ktpf1`}]]),kc=X(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),Ac=X(`corner-left-up`,[[`path`,{d:`M14 9 9 4 4 9`,key:`1af5af`}],[`path`,{d:`M20 20h-7a4 4 0 0 1-4-4V4`,key:`1blwi3`}]]),jc=X(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),Mc=X(`diamond`,[[`path`,{d:`M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41l-7.59-7.59a2.41 2.41 0 0 0-3.41 0Z`,key:`1f1r0c`}]]),Nc=X(`dollar-sign`,[[`line`,{x1:`12`,x2:`12`,y1:`2`,y2:`22`,key:`7eqyqh`}],[`path`,{d:`M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6`,key:`1b0p4s`}]]),Pc=X(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),Fc=X(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Ic=X(`feather`,[[`path`,{d:`M12.67 19a2 2 0 0 0 1.416-.588l6.154-6.172a6 6 0 0 0-8.49-8.49L5.586 9.914A2 2 0 0 0 5 11.328V18a1 1 0 0 0 1 1z`,key:`18jl4k`}],[`path`,{d:`M16 8 2 22`,key:`vp34q`}],[`path`,{d:`M17.5 15H9`,key:`1oz8nu`}]]),Lc=X(`file-cog`,[[`path`,{d:`M15 8a1 1 0 0 1-1-1V2a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8z`,key:`1ckgky`}],[`path`,{d:`M20 8v12a2 2 0 0 1-2 2h-4.182`,key:`1726p0`}],[`path`,{d:`m3.305 19.53.923-.382`,key:`ao1pio`}],[`path`,{d:`M4 10.592V4a2 2 0 0 1 2-2h8`,key:`1foop0`}],[`path`,{d:`m4.228 16.852-.924-.383`,key:`1fv9zy`}],[`path`,{d:`m5.852 15.228-.383-.923`,key:`1a9hc2`}],[`path`,{d:`m5.852 20.772-.383.924`,key:`1sh9ke`}],[`path`,{d:`m8.148 15.228.383-.923`,key:`4yu6lf`}],[`path`,{d:`m8.53 21.696-.382-.924`,key:`18b0s9`}],[`path`,{d:`m9.773 16.852.922-.383`,key:`ti6xop`}],[`path`,{d:`m9.773 19.148.922.383`,key:`rws47d`}],[`circle`,{cx:`7`,cy:`18`,r:`3`,key:`lvkj7j`}]]),Rc=X(`folder-git-2`,[[`path`,{d:`M18 19a5 5 0 0 1-5-5v8`,key:`sz5oeg`}],[`path`,{d:`M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5`,key:`1w6njk`}],[`circle`,{cx:`13`,cy:`12`,r:`2`,key:`1j92g6`}],[`circle`,{cx:`20`,cy:`19`,r:`2`,key:`1obnsp`}]]),zc=X(`folder-search`,[[`path`,{d:`M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1`,key:`1bw5m7`}],[`path`,{d:`m21 21-1.9-1.9`,key:`1g2n9r`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}]]),Bc=X(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),Vc=X(`gem`,[[`path`,{d:`M10.5 3 8 9l4 13 4-13-2.5-6`,key:`b3dvk1`}],[`path`,{d:`M17 3a2 2 0 0 1 1.6.8l3 4a2 2 0 0 1 .013 2.382l-7.99 10.986a2 2 0 0 1-3.247 0l-7.99-10.986A2 2 0 0 1 2.4 7.8l2.998-3.997A2 2 0 0 1 7 3z`,key:`7w4byz`}],[`path`,{d:`M2 9h20`,key:`16fsjt`}]]),Hc=X(`git-pull-request-arrow`,[[`circle`,{cx:`5`,cy:`6`,r:`3`,key:`1qnov2`}],[`path`,{d:`M5 9v12`,key:`ih889a`}],[`circle`,{cx:`19`,cy:`18`,r:`3`,key:`1qljk2`}],[`path`,{d:`m15 9-3-3 3-3`,key:`1lwv8l`}],[`path`,{d:`M12 6h5a2 2 0 0 1 2 2v7`,key:`1yj91y`}]]),Uc=X(`hammer`,[[`path`,{d:`m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9`,key:`1hayfq`}],[`path`,{d:`m18 15 4-4`,key:`16gjal`}],[`path`,{d:`m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5`,key:`15ts47`}]]),Wc=X(`hexagon`,[[`path`,{d:`M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z`,key:`yt0hxn`}]]),Gc=X(`id-card`,[[`path`,{d:`M16 10h2`,key:`8sgtl7`}],[`path`,{d:`M16 14h2`,key:`epxaof`}],[`path`,{d:`M6.17 15a3 3 0 0 1 5.66 0`,key:`n6f512`}],[`circle`,{cx:`9`,cy:`11`,r:`2`,key:`yxgjnd`}],[`rect`,{x:`2`,y:`5`,width:`20`,height:`14`,rx:`2`,key:`qneu4z`}]]),Kc=X(`keyboard`,[[`path`,{d:`M10 8h.01`,key:`1r9ogq`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M14 8h.01`,key:`1primd`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}],[`path`,{d:`M18 8h.01`,key:`emo2bl`}],[`path`,{d:`M6 8h.01`,key:`x9i8wu`}],[`path`,{d:`M7 16h10`,key:`wp8him`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`,key:`18n3k1`}]]),qc=X(`link`,[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]),Jc=X(`list-checks`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]),Yc=X(`memory-stick`,[[`path`,{d:`M12 12v-2`,key:`fwoke6`}],[`path`,{d:`M12 18v-2`,key:`qj6yno`}],[`path`,{d:`M16 12v-2`,key:`heuere`}],[`path`,{d:`M16 18v-2`,key:`s1ct0w`}],[`path`,{d:`M2 11h1.5`,key:`15p63e`}],[`path`,{d:`M20 18v-2`,key:`12ehxp`}],[`path`,{d:`M20.5 11H22`,key:`khsy7a`}],[`path`,{d:`M4 18v-2`,key:`1c3oqr`}],[`path`,{d:`M8 12v-2`,key:`1mwtfd`}],[`path`,{d:`M8 18v-2`,key:`qcmpov`}],[`rect`,{x:`2`,y:`6`,width:`20`,height:`10`,rx:`2`,key:`1qcswk`}]]),Xc=X(`monitor`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]),Zc=X(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),Qc=X(`mouse-pointer-2`,[[`path`,{d:`M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z`,key:`edeuup`}]]),$c=X(`package-check`,[[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`path`,{d:`m16 17 2 2 4-4`,key:`uh5qu3`}],[`path`,{d:`M21 11.127V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.729l7 4a2 2 0 0 0 2 .001l1.32-.753`,key:`kpkbpo`}],[`path`,{d:`M3.29 7 12 12l8.71-5`,key:`19ckod`}],[`path`,{d:`m7.5 4.27 8.997 5.148`,key:`9yrvtv`}]]),el=X(`panel-left-close`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m16 15-3-3 3-3`,key:`14y99z`}]]),tl=X(`panel-left-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m14 9 3 3-3 3`,key:`8010ee`}]]),nl=X(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),rl=X(`pin`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`,key:`1nkz8b`}]]),il=X(`rocket`,[[`path`,{d:`M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5`,key:`qeys4`}],[`path`,{d:`M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09`,key:`u4xsad`}],[`path`,{d:`M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z`,key:`676m9`}],[`path`,{d:`M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05`,key:`92ym6u`}]]),al=X(`scale`,[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`path`,{d:`m19 8 3 8a5 5 0 0 1-6 0zV7`,key:`zcdpyk`}],[`path`,{d:`M3 7h1a17 17 0 0 0 8-2 17 17 0 0 0 8 2h1`,key:`1yorad`}],[`path`,{d:`m5 8 3 8a5 5 0 0 1-6 0zV7`,key:`eua70x`}],[`path`,{d:`M7 21h10`,key:`1b0cd5`}]]),ol=X(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),sl=X(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),cl=X(`shapes`,[[`path`,{d:`M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z`,key:`1bo67w`}],[`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`,key:`1bkyp8`}],[`circle`,{cx:`17.5`,cy:`17.5`,r:`3.5`,key:`w3z12y`}]]),ll=X(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),ul=X(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),dl=X(`waves-horizontal`,[[`path`,{d:`M2 12q2.5 2 5 0t5 0 5 0 5 0`,key:`8ddzzs`}],[`path`,{d:`M2 19q2.5 2 5 0t5 0 5 0 5 0`,key:`1wj4st`}],[`path`,{d:`M2 5q2.5 2 5 0t5 0 5 0 5 0`,key:`69x50u`}]]),fl=X(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),pl=X(`zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]),ml=`cez-last-location`;function hl(){try{let e=localStorage.getItem(ml);return e===null?null:JSON.parse(e)}catch{return null}}function gl(e){try{localStorage.setItem(ml,JSON.stringify(e))}catch{}}var _l=new Set([`projectId`,`pathname`,`search`,`hash`]);function vl(e){if(typeof e!=`object`||!e||Array.isArray(e))return null;let t=e;if(Object.keys(t).some(e=>!_l.has(e))||typeof t.projectId!=`string`||t.projectId.length<1||t.projectId.length>64||typeof t.pathname!=`string`||t.pathname.length<1||t.pathname.length>2048||!t.pathname.startsWith(`/p/`)||t.search!==void 0&&(typeof t.search!=`string`||t.search.length>4096||!t.search.startsWith(`?`))||t.hash!==void 0&&(typeof t.hash!=`string`||t.hash.length>2048||!t.hash.startsWith(`#`)))return null;try{if(Co(t.pathname)!==t.projectId)return null}catch{return null}return{projectId:t.projectId,pathname:t.pathname,...t.search===void 0?{}:{search:t.search},...t.hash===void 0?{}:{hash:t.hash}}}function yl(e,t){let n=t.projects.find(t=>t.id===e);return n!==void 0&&n.status!==`missing`}function bl(e,t){if(t===void 0)return null;let n;try{n=Co(e.pathname)}catch{return null}return n===null||!yl(n,t)?null:vl({projectId:n,pathname:e.pathname,...e.search===``?{}:{search:e.search},...e.hash===``?{}:{hash:e.hash}})}function xl(e,t,n){let r=vl(e);return r===null||!(t===void 0?n!==void 0&&r.projectId===n:yl(r.projectId,t))?null:`${r.pathname}${r.search??``}${r.hash??``}`}function Sl(e,t){let n=vl(e);return n!==null&&n.projectId===t.projectId&&n.pathname===t.pathname&&(n.search??``)===(t.search??``)&&(n.hash??``)===(t.hash??``)}var Cl=`cez-project-locations`;function wl(){try{let e=localStorage.getItem(Cl),t=e===null?null:JSON.parse(e);return typeof t==`object`&&t&&!Array.isArray(t)?t:{}}catch{return{}}}function Tl(e){let t=wl()[e];return t===void 0?null:t}function El(e){try{localStorage.setItem(Cl,JSON.stringify({...wl(),[e.projectId]:e}))}catch{}}function Dl(e,t,n){let r=vl(t);return r===null||r.projectId!==e||n===void 0||!yl(e,n)?null:`${r.pathname}${r.search??``}${r.hash??``}`}function Ol(){return(0,$.jsx)(`div`,{"data-route":`compare`,className:`flex min-h-full flex-col`,children:(0,$.jsx)(G,{icon:(0,$.jsx)(yo,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading variants…`,subtitle:`Fetching every variant's status, spend and diff summary.`})})}function kl(){return(0,$.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,$.jsx)(G,{icon:(0,$.jsx)(yo,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading GitHub…`,subtitle:`Fetching open issues and pull requests.`})})}var Al=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),jl=`VisuallyHidden`,Ml=Q.forwardRef((e,t)=>(0,$.jsx)(H.span,{...e,ref:t,style:{...Al,...e.style}}));Ml.displayName=jl;var Nl=Ml,Pl=`Collapsible`,[Fl,Il]=Ke(Pl),[Ll,Rl]=Fl(Pl),zl=Q.forwardRef((e,t)=>{let{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:a,onOpenChange:o,...s}=e,[c,l]=jt({prop:r,defaultProp:i??!1,onChange:o,caller:Pl});return(0,$.jsx)(Ll,{scope:n,disabled:a,contentId:ct(),open:c,onOpenToggle:Q.useCallback(()=>l(e=>!e),[l]),children:(0,$.jsx)(H.div,{"data-state":Gl(c),"data-disabled":a?``:void 0,...s,ref:t})})});zl.displayName=Pl;var Bl=`CollapsibleTrigger`,Vl=Q.forwardRef((e,t)=>{let{__scopeCollapsible:n,...r}=e,i=Rl(Bl,n);return(0,$.jsx)(H.button,{type:`button`,"aria-controls":i.open?i.contentId:void 0,"aria-expanded":i.open||!1,"data-state":Gl(i.open),"data-disabled":i.disabled?``:void 0,disabled:i.disabled,...r,ref:t,onClick:z(e.onClick,i.onOpenToggle)})});Vl.displayName=Bl;var Hl=`CollapsibleContent`,Ul=Q.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=Rl(Hl,e.__scopeCollapsible);return(0,$.jsx)(Ht,{present:n||i.open,children:({present:e})=>(0,$.jsx)(Wl,{...r,ref:t,present:e})})});Ul.displayName=Hl;var Wl=Q.forwardRef((e,t)=>{let{__scopeCollapsible:n,present:r,children:i,...a}=e,o=Rl(Hl,n),[s,c]=Q.useState(r),l=Q.useRef(null),u=cn(t,l),d=Q.useRef(0),f=d.current,p=Q.useRef(0),m=p.current,h=o.open||s,g=Q.useRef(h),_=Q.useRef(void 0);return Q.useEffect(()=>{let e=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(e)},[]),pt(()=>{let e=l.current;if(e){_.current=_.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();d.current=t.height,p.current=t.width,g.current||(e.style.transitionDuration=_.current.transitionDuration,e.style.animationName=_.current.animationName),c(r)}},[o.open,r]),(0,$.jsx)(H.div,{"data-state":Gl(o.open),"data-disabled":o.disabled?``:void 0,id:o.contentId,hidden:!h,...a,ref:u,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":m?`${m}px`:void 0,...e.style},children:h&&i})});function Gl(e){return e?`open`:`closed`}var Kl=zl;function ql(e){let t=Q.useRef({value:e,previous:e});return Q.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Jl=`Label`,Yl=Q.forwardRef((e,t)=>(0,$.jsx)(H.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));Yl.displayName=Jl;var Xl=Yl;function Zl(e,[t,n]){return Math.min(n,Math.max(t,e))}var Ql=e(r(),1),$l=[` `,`Enter`,`ArrowUp`,`ArrowDown`],eu=[` `,`Enter`],tu=`Select`,[nu,ru,iu]=Qo(tu),[au,ou]=Ke(tu,[iu,$o]),su=$o(),[cu,lu]=au(tu),[uu,du]=au(tu),fu=`SelectProvider`;function pu(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:m,internal_do_not_use_render:h}=e,g=su(t),[_,v]=Q.useState(null),[y,b]=Q.useState(null),[x,S]=Q.useState(!1),C=Mo(l),[w,T]=jt({prop:r,defaultProp:i??!1,onChange:a,caller:tu}),[E,D]=jt({prop:o,defaultProp:s,onChange:c,caller:tu}),O=Q.useRef(null),k=Q.useRef(E);Q.useEffect(()=>{let e=m?_?.ownerDocument.getElementById(m):_?.form;if(e instanceof HTMLFormElement){let t=()=>D(k.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[m,_,D]);let A=!_||!!m||!!_.closest(`form`),[j,ee]=Q.useState(new Set),te=ct(),M=Array.from(j).map(e=>e.props.value).join(`;`),ne=Q.useCallback(e=>{ee(t=>new Set(t).add(e))},[]),re=Q.useCallback(e=>{ee(t=>{let n=new Set(t);return n.delete(e),n})},[]),N={required:p,trigger:_,onTriggerChange:v,valueNode:y,onValueNodeChange:b,valueNodeHasChildren:x,onValueNodeHasChildrenChange:S,contentId:te,value:E,onValueChange:D,open:w,onOpenChange:T,dir:C,triggerPointerDownPosRef:O,disabled:f,name:u,autoComplete:d,form:m,nativeOptions:j,nativeSelectKey:M,isFormControl:A};return(0,$.jsx)(Io,{...g,children:(0,$.jsx)(cu,{scope:t,...N,children:(0,$.jsx)(nu.Provider,{scope:t,children:(0,$.jsx)(uu,{scope:t,onNativeOptionAdd:ne,onNativeOptionRemove:re,children:pd(h)?h(N):n})})})})}pu.displayName=fu;var mu=e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,$.jsx)(pu,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,$.jsxs)($.Fragment,{children:[n,e?(0,$.jsx)(fd,{__scopeSelect:t}):null]})})};mu.displayName=tu;var hu=`SelectTrigger`,gu=Q.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=su(n),o=lu(hu,n),s=o.disabled||r,c=cn(t,o.onTriggerChange),l=ru(n),u=Q.useRef(`touch`),[d,f,p]=hd(e=>{let t=l().filter(e=>!e.disabled),n=gd(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),m=e=>{s||(o.onOpenChange(!0),p()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,$.jsx)(Po,{asChild:!0,...a,children:(0,$.jsx)(H.button,{type:`button`,role:`combobox`,"aria-controls":o.open?o.contentId:void 0,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":md(o.value)?``:void 0,...i,ref:c,onClick:z(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:z(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(m(e),e.preventDefault())}),onKeyDown:z(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&$l.includes(e.key)&&(m(),e.preventDefault())})})})});gu.displayName=hu;var _u=`SelectValue`,vu=Q.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=lu(_u,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=cn(t,c.onValueNodeChange);pt(()=>{l(u)},[l,u]);let f=md(c.value);return(0,$.jsx)(H.span,{...s,asChild:!f&&s.asChild,ref:d,style:{pointerEvents:`none`},children:(0,$.jsx)(Q.Fragment,{children:f?o:a},f?`placeholder`:`value`)})});vu.displayName=_u;var yu=`SelectIcon`,bu=Q.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,$.jsx)(H.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});bu.displayName=yu;var xu=`SelectPortal`,[Su,Cu]=au(xu,{forceMount:void 0}),wu=e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,$.jsx)(Su,{scope:e.__scopeSelect,forceMount:n,children:(0,$.jsx)(Zt,{asChild:!0,...r})})};wu.displayName=xu;var Tu=`SelectContent`,Eu=Q.forwardRef((e,t)=>{let n=Cu(Tu,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=lu(Tu,e.__scopeSelect),[o,s]=Q.useState();return pt(()=>{s(new DocumentFragment)},[]),(0,$.jsx)(Ht,{present:r||a.open,children:({present:e})=>e?(0,$.jsx)(Nu,{...i,ref:t}):(0,$.jsx)(Du,{...i,fragment:o})})});Eu.displayName=Tu;var Du=Q.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,fragment:i}=e;return i?Ql.createPortal((0,$.jsx)(ku,{scope:n,children:(0,$.jsx)(nu.Slot,{scope:n,children:(0,$.jsx)(`div`,{ref:t,children:r})})}),i):null});Du.displayName=`SelectContentFragment`;var Ou=10,[ku,Au]=au(Tu),ju=`SelectContentImpl`,Mu=un(`SelectContent.RemoveScroll`),Nu=Q.forwardRef((e,t)=>{let{__scopeSelect:n}=e,{position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g,..._}=e,v=lu(Tu,n),[y,b]=Q.useState(null),[x,S]=Q.useState(null),C=cn(t,b),[w,T]=Q.useState(null),[E,D]=Q.useState(null),O=ru(n),[k,A]=Q.useState(!1),j=Q.useRef(!1);Q.useEffect(()=>{if(y)return vt(y)},[y]),Rt();let ee=Q.useCallback(e=>{let[t,...n]=O().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&x&&(x.scrollTop=0),n===r&&x&&(x.scrollTop=x.scrollHeight),n?.focus(),document.activeElement!==i))return},[O,x]),te=Q.useCallback(()=>ee([w,y]),[ee,w,y]);Q.useEffect(()=>{k&&te()},[k,te]);let{onOpenChange:M,triggerPointerDownPosRef:ne}=v;Q.useEffect(()=>{if(y){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(ne.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(ne.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(y)||M(!1),document.removeEventListener(`pointermove`,t),ne.current=null};return ne.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[y,M,ne]),Q.useEffect(()=>{let e=()=>M(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[M]);let[re,N]=hd(e=>{let t=O().filter(e=>!e.disabled),n=gd(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),ie=Q.useCallback((e,t,n)=>{let r=!j.current&&!n;(v.value!==void 0&&v.value===t||r)&&(T(e),r&&(j.current=!0))},[v.value]),P=Q.useCallback(()=>y?.focus(),[y]),ae=Q.useCallback((e,t,n)=>{let r=!j.current&&!n;(v.value!==void 0&&v.value===t||r)&&D(e)},[v.value]),oe=r===`popper`?Lu:Fu,se=oe===Lu?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,$.jsx)(ku,{scope:n,content:y,viewport:x,onViewportChange:S,itemRefCallback:ie,selectedItem:w,onItemLeave:P,itemTextRefCallback:ae,focusSelectedItem:te,selectedItemText:E,position:r,isPositioned:k,searchRef:re,children:(0,$.jsx)(Ye,{as:Mu,allowPinchZoom:!0,children:(0,$.jsx)(et,{asChild:!0,trapped:v.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:z(i,e=>{v.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,$.jsx)(Ot,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:(0,$.jsx)(oe,{role:`listbox`,id:v.contentId,"data-state":v.open?`open`:`closed`,dir:v.dir,onContextMenu:e=>e.preventDefault(),..._,...se,onPlaced:()=>A(!0),ref:C,style:{display:`flex`,flexDirection:`column`,outline:`none`,..._.style},onKeyDown:z(_.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&N(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=O().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>ee(t)),e.preventDefault()}})})})})})})});Nu.displayName=ju;var Pu=`SelectItemAlignedPosition`,Fu=Q.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=lu(Tu,n),o=Au(Tu,n),[s,c]=Q.useState(null),[l,u]=Q.useState(null),d=cn(t,u),f=ru(n),p=Q.useRef(!1),m=Q.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:_,focusSelectedItem:v}=o,y=Q.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&h&&g&&_){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=_.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Ou,d=Zl(a,[Ou,Math.max(Ou,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Ou,d=Zl(a,[Ou,Math.max(Ou,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-Ou*2,u=h.scrollHeight,d=window.getComputedStyle(l),m=parseInt(d.borderTopWidth,10),v=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=m+v+u+b+y,S=Math.min(g.offsetHeight*5,x),C=window.getComputedStyle(h),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-Ou,D=c-E,O=g.offsetHeight/2,k=g.offsetTop+O,A=m+v+k,j=x-A;if(A<=E){let e=o.length>0&&g===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-h.offsetTop-h.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+y);s.style.height=n+`px`}else{let e=o.length>0&&g===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,m+h.offsetTop+(e?w:0)+O)+j;s.style.height=t+`px`,h.scrollTop=A-E+h.offsetTop}s.style.margin=`${Ou}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,a.trigger,a.valueNode,s,l,h,g,_,a.dir,r]);pt(()=>y(),[y]);let[b,x]=Q.useState();return pt(()=>{l&&x(window.getComputedStyle(l).zIndex)},[l]),(0,$.jsx)(Ru,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:Q.useCallback(e=>{e&&m.current===!0&&(y(),v?.(),m.current=!1)},[y,v]),children:(0,$.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:b},children:(0,$.jsx)(H.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});Fu.displayName=Pu;var Iu=`SelectPopperPosition`,Lu=Q.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=Ou,...a}=e,o=su(n);return(0,$.jsx)(es,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});Lu.displayName=Iu;var[Ru,zu]=au(Tu,{}),Bu=`SelectViewport`,Vu=Q.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=Au(Bu,n),o=zu(Bu,n),s=cn(t,a.onViewportChange),c=Q.useRef(0);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,$.jsx)(nu.Slot,{scope:n,children:(0,$.jsx)(H.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:z(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-Ou*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})});Vu.displayName=Bu;var Hu=`SelectGroup`,[Uu,Wu]=au(Hu),Gu=Q.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=ct();return(0,$.jsx)(Uu,{scope:n,id:i,children:(0,$.jsx)(H.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});Gu.displayName=Hu;var Ku=`SelectLabel`,qu=Q.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Wu(Ku,n);return(0,$.jsx)(H.div,{id:i.id,...r,ref:t})});qu.displayName=Ku;var Ju=`SelectItem`,[Yu,Xu]=au(Ju),Zu=Q.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=lu(Ju,n),c=Au(Ju,n),l=s.value===r,[u,d]=Q.useState(a??``),[f,p]=Q.useState(!1),m=cn(t,rt(e=>c.itemRefCallback?.(e,r,i))),h=ct(),g=Q.useRef(`touch`),_=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};return(0,$.jsx)(Yu,{scope:n,value:r,disabled:i,textId:h,isSelected:l,onItemTextChange:Q.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,$.jsx)(nu.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,$.jsx)(H.div,{role:`option`,"aria-labelledby":h,"data-highlighted":f?``:void 0,"aria-selected":l&&f,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:m,onFocus:z(o.onFocus,()=>p(!0)),onBlur:z(o.onBlur,()=>p(!1)),onClick:z(o.onClick,()=>{g.current!==`mouse`&&_()}),onPointerUp:z(o.onPointerUp,()=>{g.current===`mouse`&&_()}),onPointerDown:z(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:z(o.onPointerMove,e=>{g.current=e.pointerType,i?c.onItemLeave?.():g.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:z(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:z(o.onKeyDown,e=>{i||e.target!==e.currentTarget||c.searchRef?.current!==``&&e.key===` `||(eu.includes(e.key)&&_(),e.key===` `&&e.preventDefault())})})})})});Zu.displayName=Ju;var Qu=`SelectItemText`,$u=Q.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=lu(Qu,n),s=Au(Qu,n),c=Xu(Qu,n),l=du(Qu,n),[u,d]=Q.useState(null),f=rt(e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=cn(t,d,c.onItemTextChange,f),m=u?.textContent,h=Q.useMemo(()=>(0,$.jsx)(`option`,{value:c.value,disabled:c.disabled,children:m},c.value),[c.disabled,c.value,m]),{onNativeOptionAdd:g,onNativeOptionRemove:_}=l;return pt(()=>(g(h),()=>_(h)),[g,_,h]),(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(H.span,{id:c.textId,...a,ref:p}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!md(o.value)?Ql.createPortal(a.children,o.valueNode):null]})});$u.displayName=Qu;var ed=`SelectItemIndicator`,td=Q.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return Xu(ed,n).isSelected?(0,$.jsx)(H.span,{"aria-hidden":!0,...r,ref:t}):null});td.displayName=ed;var nd=`SelectScrollUpButton`,rd=Q.forwardRef((e,t)=>{let n=Au(nd,e.__scopeSelect),r=zu(nd,e.__scopeSelect),[i,a]=Q.useState(!1),o=cn(t,r.onScrollButtonChange);return pt(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollTop>0;a(e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,$.jsx)(od,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});rd.displayName=nd;var id=`SelectScrollDownButton`,ad=Q.forwardRef((e,t)=>{let n=Au(id,e.__scopeSelect),r=zu(id,e.__scopeSelect),[i,a]=Q.useState(!1),o=cn(t,r.onScrollButtonChange);return pt(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;a(n)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,$.jsx)(od,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});ad.displayName=id;var od=Q.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=Au(`SelectScrollButton`,n),o=Q.useRef(null),s=ru(n),c=Q.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return Q.useEffect(()=>()=>c(),[c]),pt(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,$.jsx)(H.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:z(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:z(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:z(i.onPointerLeave,()=>{c()})})}),sd=`SelectSeparator`,cd=Q.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,$.jsx)(H.div,{"aria-hidden":!0,...r,ref:t})});cd.displayName=sd;var ld=`SelectArrow`,ud=Q.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=su(n);return Au(ld,n).position===`popper`?(0,$.jsx)(Zo,{...i,...r,ref:t}):null});ud.displayName=ld;var dd=`SelectBubbleInput`,fd=Q.forwardRef(({__scopeSelect:e,...t},n)=>{let r=lu(dd,e),{value:i,onValueChange:a,required:o,disabled:s,name:c,autoComplete:l,form:u}=r,{nativeOptions:d,nativeSelectKey:f}=r,p=Q.useRef(null),m=cn(n,p),h=i??``,g=ql(h),_=Array.from(d).some(e=>(e.props.value??``)===``);return Q.useEffect(()=>{let e=p.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(g!==h&&n){let t=new Event(`change`,{bubbles:!0});n.call(e,h),e.dispatchEvent(t)}},[g,h]),(0,$.jsxs)(H.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:c,autoComplete:l,disabled:s,form:u,onChange:e=>a(e.target.value),...t,style:{...Al,...t.style},ref:m,defaultValue:h,children:[md(i)&&!_?(0,$.jsx)(`option`,{value:``}):null,Array.from(d)]},f)});fd.displayName=dd;function pd(e){return typeof e==`function`}function md(e){return e===``||e===void 0}function hd(e){let t=rt(e),n=Q.useRef(``),r=Q.useRef(0),i=Q.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=Q.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return Q.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function gd(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=_d(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function _d(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var vd=`Switch`,[yd,bd]=Ke(vd),[xd,Sd]=yd(vd);function Cd(e){let{__scopeSwitch:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=jt({prop:n,defaultProp:i??!1,onChange:c,caller:vd}),[m,h]=Q.useState(null),[g,_]=Q.useState(null),v={checked:f,setChecked:p,disabled:a,control:m,setControl:h,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:Q.useRef(!1),required:l,defaultChecked:i,isFormControl:!m||!!o||!!m.closest(`form`),bubbleInput:g,setBubbleInput:_};return(0,$.jsx)(xd,{scope:t,...v,children:jd(d)?d(v):r})}var wd=`SwitchTrigger`,Td=Q.forwardRef(({__scopeSwitch:e,onClick:t,...n},r)=>{let{control:i,form:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:f,isFormControl:p,bubbleInput:m}=Sd(wd,e),h=cn(r,u),g=Q.useRef(c);return Q.useEffect(()=>{let e=a?i?.ownerDocument.getElementById(a):i?.form;if(e instanceof HTMLFormElement){let t=()=>d(g.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[i,a,d]),(0,$.jsx)(H.button,{type:`button`,role:`switch`,"aria-checked":c,"aria-required":l,"data-state":Md(c),"data-disabled":s?``:void 0,disabled:s,value:o,...n,ref:h,onClick:z(t,e=>{d(e=>!e),m&&p&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})});Td.displayName=wd;var Ed=Q.forwardRef((e,t)=>{let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,$.jsx)(Cd,{__scopeSwitch:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Td,{...d,ref:t,__scopeSwitch:n}),e&&(0,$.jsx)(Ad,{__scopeSwitch:n})]})})});Ed.displayName=vd;var Dd=`SwitchThumb`,Od=Q.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=Sd(Dd,n);return(0,$.jsx)(H.span,{"data-state":Md(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});Od.displayName=Dd;var kd=`SwitchBubbleInput`,Ad=Q.forwardRef(({__scopeSwitch:e,...t},n)=>{let{control:r,hasConsumerStoppedPropagationRef:i,checked:a,defaultChecked:o,required:s,disabled:c,name:l,value:u,form:d,bubbleInput:f,setBubbleInput:p}=Sd(kd,e),m=cn(n,p),h=ql(a),g=No(r);Q.useEffect(()=>{let e=f;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=!i.current;if(h!==a&&n){let t=new Event(`click`,{bubbles:r});n.call(e,a),e.dispatchEvent(t)}},[f,h,a,i]);let _=Q.useRef(a);return(0,$.jsx)(H.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:o??_.current,required:s,disabled:c,name:l,value:u,form:d,...t,tabIndex:-1,ref:m,style:{...t.style,...g,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})});Ad.displayName=kd;function jd(e){return typeof e==`function`}function Md(e){return e?`checked`:`unchecked`}var Nd=`Tabs`,[Pd,Fd]=Ke(Nd,[Bo]),Id=Bo(),[Ld,Rd]=Pd(Nd),zd=Q.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=Mo(s),[d,f]=jt({prop:r,onChange:i,defaultProp:a??``,caller:Nd});return(0,$.jsx)(Ld,{scope:n,baseId:ct(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,$.jsx)(H.div,{dir:u,"data-orientation":o,...l,ref:t})})});zd.displayName=Nd;var Bd=`TabsList`,Vd=Q.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=Rd(Bd,n),o=Id(n);return(0,$.jsx)(Vo,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,$.jsx)(H.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});Vd.displayName=Bd;var Hd=`TabsTrigger`,Ud=Q.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=Rd(Hd,n),s=Id(n),c=Kd(o.baseId,r),l=qd(o.baseId,r),u=r===o.value;return(0,$.jsx)(Wo,{asChild:!0,...s,focusable:!i,active:u,children:(0,$.jsx)(H.button,{type:`button`,role:`tab`,"aria-selected":u,"aria-controls":l,"data-state":u?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:z(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:z(e.onKeyDown,e=>{i||e.target!==e.currentTarget||[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:z(e.onFocus,()=>{let e=o.activationMode!==`manual`;!u&&!i&&e&&o.onValueChange(r)})})})});Ud.displayName=Hd;var Wd=`TabsContent`,Gd=Q.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=Rd(Wd,n),c=Kd(s.baseId,r),l=qd(s.baseId,r),u=r===s.value,d=Q.useRef(u);return Q.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,$.jsx)(Ht,{present:i||u,children:({present:n})=>(0,$.jsx)(H.div,{"data-state":u?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:l,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?`0s`:void 0},children:n&&a})})});Gd.displayName=Wd;function Kd(e,t){return`${e}-trigger-${t}`}function qd(e,t){return`${e}-content-${t}`}var Jd=zd,Yd=Vd,Xd=Ud,Zd=Gd,[Qd,$d]=Ke(`Tooltip`,[$o]),ef=$o(),tf=`TooltipProvider`,nf=700,rf=`tooltip.open`,[af,of]=Qd(tf),sf=e=>{let{__scopeTooltip:t,delayDuration:n=nf,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=Q.useRef(!0),s=Q.useRef(!1),c=Q.useRef(0);return Q.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,$.jsx)(af,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:Q.useCallback(()=>{r<=0||(window.clearTimeout(c.current),o.current=!1)},[r]),onClose:Q.useCallback(()=>{r<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r))},[r]),isPointerInTransitRef:s,onPointerInTransitChange:Q.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};sf.displayName=tf;var cf=`Tooltip`,[lf,uf]=Qd(cf),df=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=of(cf,e.__scopeTooltip),l=ef(t),[u,d]=Q.useState(null),f=ct(),p=Q.useRef(0),m=o??c.disableHoverableContent,h=s??c.delayDuration,g=Q.useRef(!1),[_,v]=jt({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(rf))):c.onClose(),a?.(e)},caller:cf}),y=Q.useMemo(()=>_?g.current?`delayed-open`:`instant-open`:`closed`,[_]),b=Q.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,v(!0)},[v]),x=Q.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v(!1)},[v]),S=Q.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,v(!0),p.current=0},h)},[h,v]);return Q.useEffect(()=>()=>{p.current&&=(window.clearTimeout(p.current),0)},[]),(0,$.jsx)(Io,{...l,children:(0,$.jsx)(lf,{scope:t,contentId:f,open:_,stateAttribute:y,trigger:u,onTriggerChange:d,onTriggerEnter:Q.useCallback(()=>{c.isOpenDelayedRef.current?S():b()},[c.isOpenDelayedRef,S,b]),onTriggerLeave:Q.useCallback(()=>{m?x():(window.clearTimeout(p.current),p.current=0)},[x,m]),onOpen:b,onClose:x,disableHoverableContent:m,children:n})})};df.displayName=cf;var ff=`TooltipTrigger`,pf=Q.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=uf(ff,n),a=of(ff,n),o=ef(n),s=cn(t,Q.useRef(null),i.onTriggerChange),c=Q.useRef(!1),l=Q.useRef(!1),u=Q.useCallback(()=>c.current=!1,[]);return Q.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,$.jsx)(Po,{asChild:!0,...o,children:(0,$.jsx)(H.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:z(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:z(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:z(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:z(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:z(e.onBlur,i.onClose),onClick:z(e.onClick,i.onClose)})})});pf.displayName=ff;var mf=`TooltipPortal`,[hf,gf]=Qd(mf,{forceMount:void 0}),_f=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=uf(mf,t);return(0,$.jsx)(hf,{scope:t,forceMount:n,children:(0,$.jsx)(Ht,{present:n||a.open,children:(0,$.jsx)(Zt,{asChild:!0,container:i,children:r})})})};_f.displayName=mf;var vf=`TooltipContent`,yf=Q.forwardRef((e,t)=>{let n=gf(vf,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=uf(vf,e.__scopeTooltip);return(0,$.jsx)(Ht,{present:r||o.open,children:o.disableHoverableContent?(0,$.jsx)(wf,{side:i,...a,ref:t}):(0,$.jsx)(bf,{side:i,...a,ref:t})})}),bf=Q.forwardRef((e,t)=>{let n=uf(vf,e.__scopeTooltip),r=of(vf,e.__scopeTooltip),i=Q.useRef(null),a=cn(t,i),[o,s]=Q.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=Q.useCallback(()=>{s(null),d(!1)},[d]),p=Q.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=Of(r,Df(r,n.getBoundingClientRect())),a=kf(t.getBoundingClientRect()),o=jf([...i,...a]);s(o),d(!0)},[d]);return Q.useEffect(()=>()=>f(),[f]),Q.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),Q.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!Af(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,$.jsx)(wf,{...e,ref:a})}),[xf,Sf]=Qd(cf,{isInside:!1}),Cf=Ce(`TooltipContent`),wf=Q.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=uf(vf,n),l=ef(n),{onClose:u}=c;return Q.useEffect(()=>(document.addEventListener(rf,u),()=>document.removeEventListener(rf,u)),[u]),Q.useEffect(()=>{if(c.trigger){let e=e=>{e.target instanceof Node&&e.target.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,$.jsx)(Ot,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,$.jsxs)(es,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,$.jsx)(Cf,{children:r}),(0,$.jsx)(xf,{scope:n,isInside:!0,children:(0,$.jsx)(Nl,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});yf.displayName=vf;var Tf=`TooltipArrow`,Ef=Q.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=ef(n);return Sf(Tf,n).isInside?null:(0,$.jsx)(Zo,{...i,...r,ref:t})});Ef.displayName=Tf;function Df(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function Of(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function kf(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function Af(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function jf(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),Mf(t)}function Mf(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var Nf=sf,Pf=df,Ff=pf,If=_f,Lf=yf,Rf=Ef;function zf(e){let t=Ai(),n=mi(),r=he(t.data),i=n.data?.defaultRunner,a=Pa(e.runner,r,i??r[0]??`claude`),o=gr(a),s=n.data?.modelsLocked===!0,{accounts:c,repoAccount:l}=Ao(),u=c.some(t=>t.provider===a&&t.id===e.account)?e.account:null,d=Ya(s?null:e.model,a,n.data?.defaultModels,o.data),f=Aa(a,d,o.data);return{runner:a,runnerExplicit:e.runner!==null,model:d,effort:s?``:Da(e.effort,f),effortOptions:f,runners:r,defaultRunner:i,canRun:t.isSuccess&&r.length>0,modelsLocked:s,providerPending:t.isPending,providerError:t.isError,accounts:c,account:u,repoAccount:l}}function Bf(e){return{runner:La(e.runner,e.defaultRunner,e.runnerExplicit),model:e.modelsLocked?void 0:e.model||void 0,effort:e.modelsLocked?void 0:e.effort||void 0}}function Vf(e){return{...Bf(e),...e.account?{agentProfile:e.account}:{}}}function Hf({pick:e,onChange:t,disabled:n=!1,accounts:r=!1,layout:i}){let a=(0,Q.useRef)(null),o=(0,Q.useRef)(null),[s,c]=(0,Q.useState)(()=>typeof window<`u`&&window.innerWidth<=767);(0,Q.useLayoutEffect)(()=>{let e=a.current;if(i!==`row`||!e)return;let t=()=>{let t=window.innerWidth<=767||e.getBoundingClientRect().width<550,n=document.activeElement;o.current=n instanceof HTMLElement&&e.contains(n)?n:null,c(t)};t();let n=typeof ResizeObserver>`u`?null:new ResizeObserver(t);return n?.observe(e),window.addEventListener(`resize`,t),()=>{n?.disconnect(),window.removeEventListener(`resize`,t)}},[i]),(0,Q.useLayoutEffect)(()=>{let e=o.current;o.current=null,e&&e.isConnected&&document.activeElement!==e&&e.focus()},[s]);let l=zf(e),{runner:u,model:d,effort:f,effortOptions:p,runners:m,canRun:h,modelsLocked:g}=l,_=mi(),v=gr(u),y=Ia(u,v.data,[e.model,_.data?.defaultModels?.[u]]),b=n||!h,x=r?l.accounts:[],S=m.length>1||m.some(e=>jo(x,e))?(0,$.jsx)(co,{icon:(0,$.jsx)(le,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,runners:m,value:u,accounts:x,account:r?l.account:null,repoAccount:r?l.repoAccount:void 0,disabled:b,onPick:(n,i)=>t(r?{runner:n,account:i,model:n===u?e.model:null,effort:e.effort}:{runner:n,account:null,model:null,effort:e.effort})},`runner`):null,C=(0,$.jsx)(Ba,{icon:(0,$.jsx)(Ie,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`model-pill`,ariaLabel:`Model`,label:d===``?`Default`:y.find(e=>e.id===d).label,value:d,disabled:b,readOnly:g===!0,disabledHint:g?`Model selection is locked to native coding-agent settings.`:void 0,onPick:n=>{let r=Aa(u,n,v.data);t({...e,model:n,effort:e.effort===null?null:Da(e.effort,r)})},options:y.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:ka(u,v.data,v.isError,v.isFetching)},`model`),w=(0,$.jsx)(Ba,{icon:(0,$.jsx)(st,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`effort-pill`,ariaLabel:`Effort`,label:p.find(e=>e.value===f)?.label??`auto`,value:f,disabled:b,readOnly:g===!0,disabledHint:g?`Effort selection is locked to native coding-agent settings.`:void 0,onPick:n=>t({...e,effort:n}),options:p.map(e=>({value:e.value,label:e.label,desc:e.desc}))},`effort`);return i===`row`?(0,$.jsx)(`div`,{ref:a,"data-slot":`engine-row-box`,children:(0,$.jsx)(`div`,{"data-slot":`engine-row`,className:`engine-row`,role:`group`,"aria-label":`Agent settings`,children:(0,$.jsx)(ao,{children:s?[S,w,C]:[S,C,w]})})}):(0,$.jsxs)(ao,{children:[S,C,w]})}function Uf({templates:e,onInsert:t,triggerClassName:n,disabled:r,iconOnly:i=!1,label:a=`Template`}){let[o,s]=(0,Q.useState)(!1),c=(0,Q.useRef)(null),l=Eo();return e.length===0?null:(0,$.jsxs)(Ea,{open:o,onOpenChange:s,children:[(0,$.jsx)(xa,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,"data-slot":`prompt-template-trigger`,"aria-label":`Insert a prompt template`,title:`Insert a prompt template`,disabled:r,className:U(`inline-flex h-[26px] items-center gap-1.5 rounded-full border border-border bg-card text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-50`,i?`w-[26px] justify-center px-0`:`h-11 gap-2 rounded-lg px-3 text-foreground`,n),children:[(0,$.jsx)(Je,{"aria-hidden":`true`,className:i?`size-3 shrink-0 text-accent-icon`:`size-[18px] shrink-0 text-muted-foreground`}),i?null:(0,$.jsxs)($.Fragment,{children:[a,(0,$.jsx)(ge,{"aria-hidden":`true`,className:`size-[13px] shrink-0 text-soft-foreground`})]})]})}),(0,$.jsx)(wa,{align:`start`,sideOffset:8,"data-slot":`prompt-template-menu`,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,onCloseAutoFocus:e=>e.preventDefault(),children:(0,$.jsxs)(Ua,{filter:cs,children:[(0,$.jsx)(Ga,{placeholder:`search templates…`,onInput:()=>c.current?.scrollTo(0,0)}),(0,$.jsxs)(Qa,{ref:c,"data-slot":`prompt-template-list-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,$.jsx)(io,{children:`Nothing matches.`}),(0,$.jsx)(Wa,{heading:`Insert a template`,children:e.map(e=>(0,$.jsxs)(to,{value:`template ${e.label} ${e.id}`,keywords:[e.text,...e.skills??[]],"data-slot":`prompt-template-option`,"data-template":e.id,title:e.text,className:`flex-col items-start gap-0.5`,onSelect:()=>{t(e.text),s(!1)},children:[(0,$.jsxs)(`span`,{className:`flex w-full items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] font-medium text-foreground`,children:e.label}),e.skills&&e.skills.length>0?(0,$.jsxs)(`span`,{"data-slot":`prompt-template-assigned`,title:`Applied automatically with: ${e.skills.join(`, `)}`,className:`inline-flex shrink-0 items-center gap-0.5 text-[12px] font-medium text-accent-text`,children:[(0,$.jsx)(F,{"aria-hidden":`true`,className:`size-2.5`}),e.skills.length]}):null]}),(0,$.jsx)(`span`,{className:`line-clamp-1 text-[11px] text-soft-foreground`,children:e.text})]},e.id))}),(0,$.jsx)(qa,{}),(0,$.jsx)(Wa,{children:(0,$.jsx)(to,{value:`edit prompt templates settings`,"data-slot":`prompt-template-settings`,className:`text-[12px] text-muted-foreground`,onSelect:()=>{s(!1),l(`/settings/prompt-templates`)},children:`Edit templates…`})})]})]})})]})}function Wf(e){return e.filter(e=>!e.startedTaskId)}function Gf(e){return e.runnable??!!(e.suggestedSkill||e.suggestedPrompt)}function Kf(){let e=W(),t=e.data?.capabilities.followups===!0,n=e.data!==void 0&&!t,r=mr(!n),i=Or(),a=ci(),o=oi().data?.projects?.find(e=>e.id===a)?.name,s=r.data===void 0?void 0:Wf(r.data);return(0,$.jsxs)(`div`,{"data-route":`inbox`,"data-inbox-empty":s?.length===0&&!n,className:`task-flow-page flex min-h-full flex-col`,children:[(0,$.jsxs)(`header`,{className:`flex shrink-0 flex-col gap-5`,children:[(0,$.jsx)(`h1`,{className:`text-[28px] font-medium`,children:`Inbox`}),(0,$.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:n?`Disabled for this server; per-task Notes still run.`:`Follow-ups from your agents. Review the suggestion, then start a new task.`})]}),(0,$.jsx)(`div`,{className:`flex flex-1 flex-col`,children:n?(0,$.jsx)(G,{icon:(0,$.jsx)(At,{}),tone:`neutral`,title:`Inbox is off`,subtitle:`Agents are not asked to leave follow-ups. Set CEZ_FOLLOWUPS=1 and restart Cezarion to enable Inbox.`,heading:`h2`}):s===void 0?r.isError?(0,$.jsx)(G,{icon:(0,$.jsx)(_e,{}),tone:`danger`,title:`Could not load the inbox`,subtitle:r.error.message,actions:(0,$.jsx)(B,{variant:`outline`,onClick:()=>void r.refetch(),children:`Retry`}),heading:`h2`}):(0,$.jsx)(`div`,{role:`status`,className:`rounded-xl border border-border bg-card p-6 text-sm text-muted-foreground`,children:`Loading follow-ups…`}):s.length===0?e.isPending?null:(0,$.jsx)(G,{icon:(0,$.jsx)(At,{}),tone:`neutral`,title:`You’re all caught up`,subtitle:`No follow-ups to review. New suggestions and notes from your agents will appear here.`,heading:`h2`}):(0,$.jsx)(`ul`,{"data-slot":`todo-list`,className:`flex w-full flex-col gap-5`,children:s.map(e=>(0,$.jsx)(qf,{todo:e,projectName:o,sourceTaskListed:e.taskId===void 0?null:i.data?.some(t=>t.id===e.taskId)??!1},e.id))})})]})}function qf({todo:e,projectName:t,sourceTaskListed:n}){let r=Sr(n===!1?e.taskId:void 0),i=n===!0||r.isSuccess,a=n===!1&&r.error instanceof E&&r.error.status===404,o=Eo(),s=V(),c=Mi(),[l,u]=(0,Q.useState)({runner:null,model:null,effort:null,account:null}),d=zf(l),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(``),g=(0,Q.useRef)(null),_=Va(c.data?.promptTemplates),v=e=>{let t=g.current?.selectionStart??m.length,n=no(m,t,e);h(n.text),requestAnimationFrame(()=>{g.current?.focus(),g.current?.setSelectionRange(n.caret,n.caret)})},y=J({mutationFn:async()=>d.canRun?ft(e.id,{...Bf(d),prompt:m.trim()||void 0}):null,onSuccess:e=>{if(e===null)return;let{run:t}=e;s.invalidateQueries({queryKey:K.todos}),s.invalidateQueries({queryKey:K.runs.all}),o(`/tasks/${t.id}`)},onError:e=>L(e.message,{tone:`danger`})}),b=J({mutationFn:()=>Yt(e.id),onSuccess:()=>{s.setQueryData(K.todos,t=>t?.filter(t=>t.id!==e.id)),s.invalidateQueries({queryKey:K.todos})},onError:e=>L(e.message,{tone:`danger`})}),x=y.isPending||b.isPending,S=Gf(e);return(0,$.jsxs)(`li`,{"data-slot":`todo-card`,"data-runnable":S,"data-id":e.id,className:`flex flex-col gap-2.5 rounded-lg border border-border bg-card p-4 shadow-xs`,children:[(0,$.jsx)(`div`,{className:`flex items-start gap-3`,children:(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{"data-slot":`todo-summary`,className:`text-sm leading-snug font-medium text-foreground`,children:e.summary}),(0,$.jsxs)(`div`,{"data-slot":`todo-meta`,className:`mt-1.5 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-soft-foreground`,children:[t?(0,$.jsx)(`span`,{children:t}):null,(0,$.jsx)(`span`,{children:S?`Runnable follow-up`:`Note only`}),e.ts?(0,$.jsxs)(`span`,{children:[So(e.ts),` ago`]}):null,e.action?(0,$.jsx)(`span`,{children:e.action}):null,e.taskId===void 0?null:i?(0,$.jsxs)(Z,{to:`/tasks/${e.taskId}`,"data-slot":`todo-source`,className:`text-muted-foreground underline decoration-border underline-offset-2 hover:text-foreground`,children:[`Source task `,(0,$.jsx)(`span`,{"aria-hidden":`true`,children:`↗`})]}):a?(0,$.jsx)(`span`,{"data-slot":`todo-source-gone`,children:`source task deleted`}):null,Ln(e.prUrl)?(0,$.jsx)(`a`,{href:e.prUrl,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`todo-pr`,className:`text-muted-foreground underline decoration-border underline-offset-2 hover:text-foreground`,children:`PR`}):null,e.suggestedSkill?(0,$.jsxs)(`span`,{"data-slot":`todo-skill`,className:`font-mono`,children:[`skill: `,e.suggestedSkill]}):null]})]})}),S&&e.suggestedPrompt&&e.suggestedPrompt!==e.summary?(0,$.jsx)(`p`,{"data-slot":`todo-prompt`,className:`whitespace-pre-wrap break-words text-[13px] leading-relaxed text-muted-foreground`,children:e.suggestedPrompt}):null,S?(0,$.jsxs)(`div`,{"data-slot":`todo-engine`,className:`flex min-w-0 flex-col gap-2 pl-5`,children:[(0,$.jsx)(Hf,{layout:`row`,pick:l,onChange:u,disabled:x||!d.canRun}),!d.providerPending&&!d.canRun?(0,$.jsxs)(`span`,{"data-slot":`todo-provider-gate`,className:`inline-flex flex-wrap items-center gap-1 text-xs text-muted-foreground`,children:[d.providerError?`Provider authentication could not be verified.`:`Connect an agent provider to run this follow-up.`,(0,$.jsx)(Z,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null]}):null,S?f?(0,$.jsxs)(`div`,{"data-slot":`todo-instructions`,className:`flex flex-col gap-2 pl-5`,children:[(0,$.jsx)(`label`,{htmlFor:`todo-instructions-${e.id}`,className:`text-xs text-muted-foreground`,children:`Additional instructions`}),(0,$.jsx)(ss,{ref:g,id:`todo-instructions-${e.id}`,"data-slot":`todo-instructions-input`,"aria-label":`Extra instructions for this follow-up`,value:m,onChange:e=>h(e.target.value),placeholder:`Add instructions for the agent… (appended to the suggestion above)`,maxLength:2e4,className:`min-h-11 text-[13px]`})]}):(0,$.jsx)(`button`,{type:`button`,"data-slot":`todo-instructions-toggle`,onClick:()=>p(!0),className:`self-start pl-5 text-xs font-medium text-muted-foreground underline decoration-border underline-offset-2 hover:text-foreground`,children:m.trim()?`Edit instructions (added)`:`+ Add instructions`}):null,(0,$.jsxs)(`div`,{"data-slot":`todo-actions`,className:`flex flex-wrap items-center gap-3`,children:[S&&f?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Uf,{templates:_,onInsert:v}),(0,$.jsx)(B,{type:`button`,variant:`outline`,"data-slot":`todo-instructions-hide`,onClick:()=>p(!1),children:`Hide instructions`})]}):null,S?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(B,{type:`button`,variant:`primary`,size:`sm`,"data-action":`todo-run`,title:`Start a task from this follow-up`,disabled:x||!d.canRun,onClick:()=>y.mutate(),children:`Run follow-up`}),(0,$.jsx)(B,{type:`button`,variant:`outline`,size:`sm`,"data-action":`todo-dismiss`,title:`Check off (remove)`,disabled:x,onClick:()=>b.mutate(),children:`Dismiss`})]}):(0,$.jsx)(B,{type:`button`,variant:`outline`,size:`sm`,"data-action":`todo-acknowledge`,title:`Acknowledge and remove this note`,disabled:x,onClick:()=>b.mutate(),children:`Acknowledge`})]})]})}function Jf(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName;return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||e.isContentEditable?!0:e.closest(`[contenteditable=""], [contenteditable="true"]`)!==null}function Yf(e){return e instanceof HTMLElement&&e.closest(`[cmdk-input]`)!==null}function Xf(e,t){return!(typeof e.key!=`string`||e.key.toLowerCase()!==t.toLowerCase()||!e.metaKey&&!e.ctrlKey||e.altKey||e.shiftKey||e.repeat||Jf(e.target)&&!Yf(e.target))}function Zf(e,t){let n=Q.useRef(t);Q.useLayoutEffect(()=>{n.current=t}),Q.useEffect(()=>{let t=t=>{Xf(t,e)&&(t.preventDefault(),n.current(t))};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e])}function Qf(e,t){return!(typeof e.key!=`string`||e.key.toLowerCase()!==t.toLowerCase()||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||e.repeat||Jf(e.target))}function $f(e,t=typeof navigator>`u`?``:navigator.platform){let n=e.toUpperCase();return/mac|iphone|ipad|ipod/i.test(t)?`⌘${n}`:`Ctrl+${n}`}function ep(e,t){let n=Q.useRef(t);Q.useLayoutEffect(()=>{n.current=t}),Q.useEffect(()=>{let t=t=>{Qf(t,e)&&n.current(t)};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e])}function tp(e){let[t,n]=Q.useState(()=>Date.now());return Q.useEffect(()=>{if(Bi())return;let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}var np=`(hover: none) and (pointer: coarse)`;function rp(){return typeof globalThis.matchMedia==`function`&&globalThis.matchMedia(np).matches}function ip(e){return e.key!==`Enter`||e.shiftKey||e.altKey||e.repeat||e.isComposing?!1:e.metaKey||e.ctrlKey?!0:!rp()}function ap(e=typeof navigator>`u`?``:navigator.platform){return/mac|iphone|ipad|ipod/i.test(e)?`⌘↵`:`Ctrl+↵`}var op={png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,gif:`image/gif`,webp:`image/webp`,svg:`image/svg+xml`,bmp:`image/bmp`,avif:`image/avif`,md:`text/markdown`,markdown:`text/markdown`,txt:`text/plain`,log:`text/plain`,pdf:`application/pdf`};function sp(e){return Tn(e.type)?e.type:op[e.name.split(`.`).pop()?.toLowerCase()??``]??null}async function cp(e){let t=new Uint8Array(await e.arrayBuffer()),n=``;for(let e=0;e<t.length;e+=32768)n+=String.fromCharCode(...t.subarray(e,e+32768));let r=btoa(n),i=sp(e)??`application/octet-stream`,a=bn(i);return{mediaType:i,data:r,...a?{preview:`data:${i};base64,${r}`}:{},name:e.name||(a?`pasted image`:`pasted.${Wn(i)}`),isImage:a}}function lp(e,t){let n=[],r=[],i=t;for(let t of e){let e=t.name||`attachment`;if(sp(t)===null){r.push(`${e} is not a supported attachment (images, PDF and plain-text files such as TXT or MD)`);continue}if(t.size>5242880){r.push(`${e} is too large (max 5 MB)`);continue}if(i>=4){r.push(`${e} skipped — max 4 attachments per message`);continue}n.push(t),i+=1}return{accepted:n,rejected:r}}var up=new Set([`/`,`@`]);function dp(e,t){for(let n=t-1;n>=0;--n){let r=e[n];if(/\s/.test(r))return null;if(up.has(r))return n>0&&!/\s/.test(e[n-1])?null:{trigger:r,start:n,query:e.slice(n+1,t)}}return null}function fp(e,t,n,r){let i=`${t.trigger}${r} `;return{text:e.slice(0,t.start)+i+e.slice(n),caret:t.start+i.length}}function pp(){let e=window;return e.SpeechRecognition??e.webkitSpeechRecognition}function mp(e,t){let n=e,r=``;for(let e=t.resultIndex;e<t.results.length;e+=1){let i=t.results[e],a=i[0]?.transcript??``;i.isFinal?n+=a:r+=a}return{finalText:n,interim:r}}function hp(e){let[t,n]=Q.useState(null),r=Q.useRef(null),i=Q.useRef(``),[a]=Q.useState(()=>pp()!==void 0),o=Q.useCallback(()=>{let e=r.current;r.current=null,i.current=``,n(null),e&&(e.onresult=null,e.onerror=null,e.onend=null,e.abort())},[]);return Q.useEffect(()=>o,[o]),{supported:a,recording:t,start:Q.useCallback(()=>{if(r.current)return;let t=pp();if(!t)return;let a;try{a=new t,a.lang=navigator.language||`en-US`,a.continuous=!0,a.interimResults=!0;let s=Date.now();a.onresult=e=>{let t=mp(i.current,e);i.current=t.finalText,n({transcript:t.finalText+t.interim,startedAt:s})},a.onerror=t=>{e(`Dictation failed${t.error?` — ${t.error}`:``}`),o()},a.start(),r.current=a,n({transcript:``,startedAt:s})}catch{e(`Dictation failed — the microphone could not be started`),o()}},[e,o]),cancel:Q.useCallback(()=>o(),[o]),finish:Q.useCallback(()=>{let e=r.current,a=(i.current+``).trim()===``?``:i.current,o=t?.transcript??a;return e&&(e.onresult=null,e.onerror=null,e.onend=null,e.stop()),r.current=null,i.current=``,n(null),o.trim()},[t])}}function gp(e,t){let n=Math.max(0,Math.floor((t-e)/1e3));return`${Math.floor(n/60)}:${String(n%60).padStart(2,`0`)}`}var _p=new Map,vp={KeyA:`Yes, approved.`,KeyC:`Continue.`};function yp({onSubmit:e,retainDraftUntilSuccess:t=!1,onStop:n,onFinish:r,finishing:i=!1,secondaryAction:a,stopOnEmpty:o=!1,stopping:c=!1,emptySubmitLabel:l,compactFeedback:u=!1,idleFeedback:f,pendingLabel:p=`Starting task…`,failureHint:m=`Could not confirm submission. Check Tasks before you retry. Your draft is kept.`,clearOnSuccess:h=!0,onPendingChange:g,value:_,onValueChange:v,autoFocus:y=!1,mobileCollapsible:b=!1,mobileDisclosureKey:x,footerStart:S,footerEnd:C,sessionControls:w,executionOptions:T,agentOptions:E,sendAriaLabel:D=`Send`,disabled:O=!1,disabledReason:k=`Session closed — Continue to reopen.`,allowEmptySubmit:A=!1,placeholder:j=`Reply — / for skills, @ for files…`,ariaLabel:ee=`Reply to the agent`,autocompleteSkills:te=!0,quickReplies:M=!1,getMentionCandidates:ne,ref:re}){let[N,ie]=(0,Q.useState)(``),P=_??N,ae=(0,Q.useRef)(P);ae.current=P;let oe=(0,Q.useRef)(v);oe.current=v;let se=(0,Q.useCallback)(e=>{let t=typeof e==`function`?e(ae.current):e;ie(t),oe.current?.(t)},[]),[ce,de]=(0,Q.useState)([]),fe=(0,Q.useRef)(ce);fe.current=ce;let[pe,me]=(0,Q.useState)(!1),he=c||pe,F=(0,Q.useRef)(he);F.current=he;let I=P.trim()!==``||ce.length>0,_e=!I&&(n!==void 0&&o||he),ve=!I&&!_e&&r!==void 0,ye=_e||ve||!I&&l!==void 0,be=!I&&l?l:D,[xe,Se]=(0,Q.useState)(!1),Ce=(0,Q.useRef)(!1),we=(0,Q.useRef)(0),Te=(0,Q.useRef)(!0);(0,Q.useEffect)(()=>(Te.current=!0,()=>{Te.current=!1}),[]);let[Ee,De]=(0,Q.useState)(null),R=he||t&&xe,Oe=()=>F.current||t&&Ce.current,[ke,Ae]=(0,Q.useState)(null),[je,Me]=(0,Q.useState)(``),[Ne,Pe]=(0,Q.useState)(!1),Fe=(0,Q.useRef)(null),Ie=(0,Q.useId)(),Le=(0,Q.useId)(),Re=(0,Q.useRef)(new Map),ze=x===void 0?Re.current:_p,Be=x??`default`,[,Ve]=(0,Q.useReducer)(e=>e+1,0),He=ze.get(Be)??!1,Ue=b&&!He,We=(0,Q.useRef)(null),Ge=(0,Q.useRef)(null),Ke=(0,Q.useRef)(null),qe=Pr(te&&Ne),Je=Mi(),Ye=V(),Xe=hp(e=>L(e,{tone:`danger`}));(0,Q.useEffect)(()=>{y&&Fe.current?.focus()},[]),(0,Q.useImperativeHandle)(re,()=>({insertAtCaret:e=>{if(Oe())return;let t=Fe.current,n=no(ae.current,t?.selectionStart??ae.current.length,e);se(n.text),Ke.current=n.caret,t?.focus()}}),[se,t]);let Ze=(0,Q.useCallback)(()=>{let e=Fe.current;if(!e||O||Oe()){Ae(null);return}let t=dp(e.value,e.selectionStart??e.value.length);if(t?.trigger===`/`&&!te||t?.trigger===`@`&&ne===void 0)return Ae(null);t?.trigger===`/`&&Pe(!0),Ae(t)},[te,O,ne,t]),Qe=(0,Q.useMemo)(()=>ke===null?[]:ke.trigger===`/`?ps(qe.data??[],ke.query,Je.data?.skillUsage).map(e=>({value:`${e.name} ${e.path}`,insert:e.name,label:e.name,description:e.description,emphasized:fs(e)})):(ne?.()??[]).filter(e=>hs(e,ke.query)).map(e=>({value:e,insert:e,label:e,emphasized:!1})),[ne,qe.data,ke,Je.data?.skillUsage]),$e=Qe.some(e=>e.value===je)?je:Qe[0]?.value,et=ke!==null;(0,Q.useLayoutEffect)(()=>{!et||!$e||[...Ge.current?.querySelectorAll(`[data-slot="composer-menu-item"]`)??[]].find(e=>e.getAttribute(`data-value`)===$e)?.scrollIntoView({block:`nearest`})},[$e,et]);let tt=(0,Q.useCallback)(()=>Ae(null),[]),nt=e=>{let t=Fe.current;if(!t||ke===null||Oe())return;let n=t.selectionStart??t.value.length,r=fp(t.value,ke,n,e.insert);ke.trigger===`/`&&Je.data!==void 0&&Kt({skillUsage:_s(Je.data.skillUsage,e.insert)}).then(()=>Ye.invalidateQueries({queryKey:K.uiState})).catch(()=>{}),se(r.text),Ke.current=r.caret,Ae(null),t.focus()};(0,Q.useLayoutEffect)(()=>{let e=Ke.current,t=Fe.current;e!==null&&t&&(t.setSelectionRange(e,e),Ke.current=null)},[P]),(0,Q.useLayoutEffect)(()=>{let e=Fe.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,220)}px`)},[P,He]);let rt=(0,Q.useCallback)(e=>{if(O||Oe())return;let n=we.current,r=lp(e,fe.current.length);for(let e of r.rejected)L(e,{tone:`danger`});for(let e of r.accepted)cp(e).then(e=>{!Te.current||t&&Ce.current&&!F.current||n!==we.current||de(t=>t.length>=4?t:[...t,e])},()=>L(`${e.name||`Attachment`} could not be read — try attaching it again`,{tone:`danger`}))},[O,t]),it=e=>{let t=[...e.clipboardData?.items??[]].filter(e=>e.kind===`file`).map(e=>e.getAsFile()).filter(e=>e!==null);t.length!==0&&(e.preventDefault(),rt(t))},at=e=>{let t=[...e.dataTransfer?.files??[]];t.length!==0&&(e.preventDefault(),rt(t))},ot=(0,Q.useCallback)(async(n,r,i)=>{let a=n.trim();if(!(O||c||Ce.current)&&!(a===``&&r.length===0&&!A)){Ce.current=!0,t&&(we.current+=1),Se(!0),De(null),g?.(!0),Ae(null),i&&!t&&(se(``),de([]));try{await e(a,r.map(({mediaType:e,data:t})=>({mediaType:e,data:t}))),Te.current&&t&&h&&(ae.current===n&&se(``),fe.current===r&&de([]))}catch(e){if(!Te.current&&t)return;let a=e instanceof Error?e.message:String(e);t?De(a):(L(a,{tone:`danger`}),i&&(se(e=>e===``?n:`${n}\n${e}`),de(e=>[...r,...e].slice(0,4))))}finally{Ce.current=!1,Te.current&&(g?.(!1),Se(!1))}}},[A,O,c,e,t,h,g,se]),st=(0,Q.useCallback)(()=>{O||c||Ce.current||ot(ae.current,fe.current,!0)},[O,c,ot]),ct=async()=>{if(!(!n||c||Ce.current)){Ce.current=!0,Se(!0),me(!0),De(null);try{await n()}catch(e){Te.current&&De(e instanceof Error?e.message:String(e))}finally{Ce.current=!1,Te.current&&(Se(!1),me(!1))}}},lt=e=>{if(et){if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),Qe.length===0)return;let t=Qe.findIndex(e=>e.value===$e),n=e.key===`ArrowDown`?1:-1,r=Qe[(t+n+Qe.length)%Qe.length];Me(r.value);return}if(e.key===`Escape`){e.preventDefault(),tt();return}if((e.key===`Enter`||e.key===`Tab`)&&!e.shiftKey){let t=Qe.find(e=>e.value===$e);if(t){e.preventDefault(),nt(t);return}tt()}}ip({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.preventDefault(),st())};(0,Q.useEffect)(()=>{if(!M||O)return;let e=e=>{if(!e.altKey||e.metaKey||e.ctrlKey||e.repeat||Jf(e.target))return;let t=vp[e.code];t!==void 0&&(e.preventDefault(),ot(t,[],!1))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[O,M,ot]);let ut=e=>{if(O||F.current||Ce.current&&(e||t))return;let n=Xe.finish();if(n===``)return;let r=P.trim()===``?n:`${P.replace(/\s*$/,``)} ${n}`;if(e){t&&se(r),ot(r,ce,!0);return}se(r),Ke.current=r.length,Fe.current?.focus()},dt=Xe.recording,z=Xe.supported?(0,$.jsxs)(B,{type:`button`,variant:`ghost`,size:`sm`,disabled:O||R,"aria-label":`Start dictation`,title:`Dictation`,className:U(`h-11 gap-1.5 px-2.5 text-xs font-medium text-muted-foreground md:h-8`,Ue&&`hidden md:inline-flex`),onClick:()=>{Oe()||Xe.start()},children:[(0,$.jsx)(_t,{"aria-hidden":`true`,className:`size-3.5`}),T||w?null:`Dictation`]}):null,ft=ve?(0,$.jsxs)(B,{type:`button`,"data-slot":`composer-finish`,"aria-label":i?`Finishing…`:`Finish`,"aria-busy":i||void 0,title:`Close the session and mark this task done`,disabled:xe||he||i,className:`h-11 w-auto gap-[7px] px-5 active:opacity-80`,onClick:()=>void r?.(),children:[(0,$.jsx)(ue,{"aria-hidden":`true`}),i?`Finishing…`:`Finish`]}):null,pt=n||he?(0,$.jsxs)(B,{type:`button`,variant:`outline`,size:`icon-sm`,"aria-label":he?`Stopping…`:`Stop`,"aria-busy":he||void 0,title:he?`Waiting for execution to stop`:`Stop execution; keep existing work`,disabled:xe||he,className:U(`h-11 min-w-11 active:opacity-80`,ye?`w-auto px-3`:`w-11`),onClick:()=>void ct(),children:[(0,$.jsx)(s,{"aria-hidden":`true`,className:`size-3 fill-current`}),ye?he?`Stopping…`:`Stop`:null]}):null,mt=he||xe||Ee!==null||f!=null,ht=(0,$.jsx)($.Fragment,{children:t||n||c?(0,$.jsx)(`div`,{className:U(`overflow-y-auto text-xs leading-5 text-muted-foreground`,u&&!mt?`h-0`:`px-3 pb-2 md:px-4`,u?mt&&`min-h-6`:`h-24 md:h-20`),children:(0,$.jsx)(`div`,{id:`${Ie}-submission`,role:Ee===null?`status`:`alert`,"aria-atomic":`true`,tabIndex:Ee===null?void 0:0,className:`break-words`,children:he?`Stopping execution. Your draft is kept.`:xe?p:Ee===null?f??null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`font-medium text-foreground`,children:Ee}),(0,$.jsx)(`p`,{children:m})]})})}):null}),gt=(0,$.jsxs)(`div`,{"data-slot":`composer-submit-row`,className:U(`ml-auto flex min-w-0 flex-wrap items-center justify-end gap-1 md:flex-nowrap`,T&&`new-task-submission`),children:[T||w?null:z,C?(0,$.jsx)(`div`,{id:Le,"data-slot":`composer-footer-end`,className:U(`min-w-0 flex-wrap items-center gap-1.5 md:flex-nowrap`,T&&`mr-auto`,b&&`max-md:[&_button]:min-h-11 max-md:[&_button]:min-w-11`,Ue?`hidden md:flex`:`flex`),children:(0,$.jsx)(`div`,{className:`contents`,inert:R||void 0,children:C})}):null,(0,$.jsxs)(`div`,{className:`flex min-w-[100px] items-center justify-end gap-1`,"data-slot":`composer-actions`,children:[pt??a,ft,!_e&&!ve?(0,$.jsxs)(B,{type:`button`,size:`icon-sm`,"aria-label":be,"aria-busy":xe&&!he||void 0,disabled:O||xe||he||!I&&!A,className:U(T?`h-12 w-full gap-2 px-6`:w?`h-11 w-auto gap-2 px-5`:`size-11`,!I&&l&&`w-auto px-3`,`active:opacity-80`),onClick:st,children:[!w&&!I&&l?(0,$.jsx)(Do,{"aria-hidden":`true`}):null,T||w||!I&&l?be:null,w||I||!l?(0,$.jsx)(Et,{"aria-hidden":`true`}):null]}):null]})]});return(0,$.jsxs)(Ea,{open:et,onOpenChange:e=>e?void 0:tt(),children:[(0,$.jsx)(Sa,{asChild:!0,children:(0,$.jsxs)(`div`,{ref:We,"data-slot":`composer`,"data-disabled":O||void 0,onDrop:at,onDragOver:e=>e.preventDefault(),className:U(T&&`new-task-composer`,w&&`session-composer`,O&&`opacity-80`),children:[(0,$.jsxs)(`div`,{"data-slot":`composer-editor`,className:U(`rounded-xl border border-[var(--composer-border)] bg-card shadow-none transition-[border-color,box-shadow] focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/15`,T&&`new-task-editor`),children:[ce.length>0?(0,$.jsx)(`div`,{"data-slot":`composer-thumbs`,className:`flex flex-nowrap items-center gap-2 overflow-x-auto px-4 pt-3 md:flex-wrap md:overflow-visible`,children:ce.map((e,t)=>(0,$.jsxs)(`button`,{type:`button`,"aria-label":`Remove ${e.name}`,title:R?`Attachment submitted`:`Click to remove`,disabled:R,className:U(`group relative shrink-0 overflow-hidden rounded-md border border-border`,e.isImage?`size-12`:`flex h-12 min-w-11 max-w-[200px] items-center gap-1.5 bg-muted/40 px-2.5 text-xs text-muted-foreground`),onClick:()=>{Oe()||de(e=>e.filter((e,n)=>n!==t))},children:[e.isImage?(0,$.jsx)(`img`,{src:e.preview,alt:``,className:`size-full object-cover`}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(hn,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,$.jsx)(`span`,{className:`truncate`,children:e.name})]}),(0,$.jsx)(`span`,{className:`absolute inset-0 hidden items-center justify-center bg-background/70 group-hover:flex group-focus-visible:flex`,children:(0,$.jsx)(d,{"aria-hidden":`true`,className:`size-4`})})]},`${e.name}-${t}`))}):null,(0,$.jsx)(`label`,{htmlFor:Ie,className:T?`hidden px-5 pt-5 text-xs text-muted-foreground md:block`:`sr-only`,children:T?`Task description`:ee}),(0,$.jsx)(`textarea`,{ref:Fe,id:Ie,autoComplete:`off`,rows:1,value:P,disabled:O,readOnly:R,"aria-busy":R||void 0,"aria-describedby":t?`${Ie}-submission`:void 0,"aria-label":ee,placeholder:O?k:j,className:U(`block min-h-11 w-full resize-none bg-transparent px-3 pt-2.5 pb-1 text-base leading-normal outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed md:min-h-[54px] md:px-4 md:pt-3 md:text-sm`,Ue?`max-h-11 md:max-h-[220px]`:`max-h-[220px]`,T&&`md:text-base`),onChange:e=>{Oe()||(se(e.target.value),Ze())},onKeyDown:lt,onSelect:Ze,onPaste:it}),T?(0,$.jsxs)(`p`,{"data-slot":`composer-skill-hint`,className:`flex items-center gap-2 px-5 pt-3 pb-2 text-xs text-muted-foreground`,children:[(0,$.jsx)(le,{"aria-hidden":`true`,className:`size-[15px] shrink-0`}),`Type / for a skill or workflow`]}):null,w&&dt?(0,$.jsx)(`div`,{"data-slot":`session-controls`,inert:R||void 0,children:w}):null,dt?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(xp,{transcript:dt.transcript,startedAt:dt.startedAt,insertionDisabled:R,onCancel:Xe.cancel,onInsert:()=>ut(!1),onInsertAndSend:()=>ut(!0)}),pt?(0,$.jsx)(`div`,{className:`flex justify-end px-2 pb-2`,children:pt}):null]}):(0,$.jsxs)(`div`,{"data-slot":`composer-toolbar`,className:`flex flex-wrap items-center gap-1 gap-y-1 px-1.5 pt-1 pb-1.5 md:gap-y-1.5 md:px-2 md:pt-1.5 md:pb-2`,children:[w?(0,$.jsx)(`div`,{"data-slot":`session-controls`,inert:R||void 0,children:w}):null,(0,$.jsxs)(`div`,{"data-slot":`composer-footer-start`,className:U(`flex min-w-0 flex-wrap items-center gap-1`,T&&`w-full`),children:[(0,$.jsx)(bp,{disabled:O||R,onFiles:rt}),b?(0,$.jsx)(B,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`size-11 md:hidden`,"aria-label":He?`Collapse composer`:`Expand composer`,"aria-expanded":He,"aria-controls":C?`${Ie} ${Le}`:Ie,onClick:()=>{ze.set(Be,!He),Ve()},children:(0,$.jsx)(ge,{"aria-hidden":`true`,className:U(`transition-transform motion-reduce:transition-none`,!He&&`rotate-180`)})}):null,(0,$.jsx)(`div`,{className:`contents`,inert:R||void 0,children:S}),T||w?(0,$.jsx)(`div`,{children:z}):null]}),T?null:gt]}),T?null:ht]}),T?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{"data-slot":`composer-agent-options`,inert:R||void 0,children:E}),(0,$.jsx)(`div`,{"data-slot":`composer-execution-panel`,inert:R||void 0,children:T}),gt,(0,$.jsx)(`div`,{"data-slot":`composer-feedback`,children:ht})]}):null]})}),(0,$.jsx)(wa,{side:`top`,align:`start`,sideOffset:8,className:`w-80 max-w-[calc(100vw-2rem)] p-0`,onOpenAutoFocus:e=>e.preventDefault(),onInteractOutside:e=>{We.current?.contains(e.target)&&e.preventDefault()},children:(0,$.jsx)(Ua,{shouldFilter:!1,value:$e??``,onValueChange:Me,children:(0,$.jsx)(Qa,{ref:Ge,"data-slot":`composer-menu`,"data-trigger":ke?.trigger,className:`max-h-[min(16rem,var(--radix-popover-content-available-height))] p-1`,children:Qe.length===0?(0,$.jsx)(`p`,{className:`px-3 py-4 text-center text-xs text-muted-foreground`,children:ke?.trigger===`@`?`No files seen in this session yet — full file search arrives with the Files tab.`:qe.isPending?`Loading skills…`:`No matching skills.`}):Qe.map(e=>(0,$.jsxs)(to,{value:e.value,"data-slot":`composer-menu-item`,"data-emphasized":e.emphasized||void 0,onSelect:()=>nt(e),children:[(0,$.jsx)(`span`,{className:U(`shrink-0 truncate`,e.emphasized&&`font-semibold`,ke?.trigger===`@`&&`font-mono text-xs`),children:e.label}),e.description?(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null]},e.value))})})})]})}function bp({disabled:e,onFiles:t}){let n=(0,Q.useRef)(null);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(B,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Attach files`,title:`Attach an image, PDF, TXT or MD file (or paste a screenshot)`,disabled:e,className:`size-11 text-muted-foreground`,onClick:()=>n.current?.click(),children:(0,$.jsx)(hn,{"aria-hidden":`true`,className:`size-[15px]`})}),(0,$.jsx)(`input`,{ref:n,type:`file`,accept:`image/*,application/pdf,text/plain,text/markdown,.pdf,.txt,.md,.markdown,.log`,multiple:!0,className:`hidden`,"aria-hidden":`true`,tabIndex:-1,onChange:e=>{t([...e.target.files??[]]),e.target.value=``}})]})}function xp({transcript:e,startedAt:t,insertionDisabled:n,onCancel:r,onInsert:i,onInsertAndSend:a}){let o=tp(1e3);return(0,$.jsxs)(`div`,{"data-slot":`dictation-overlay`,role:`status`,"aria-label":`Dictation in progress`,className:`flex items-center gap-2.5 rounded-b-xl border-t border-border bg-muted/60 px-3 py-2`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 flex-none animate-pulse rounded-full bg-danger motion-reduce:animate-none`}),(0,$.jsx)(`span`,{"data-slot":`dictation-timer`,className:`text-xs font-medium text-muted-foreground tabular-nums`,children:gp(t,o)}),(0,$.jsx)(`span`,{"data-slot":`dictation-transcript`,"aria-live":`polite`,className:`min-w-0 flex-1 truncate text-sm text-foreground`,children:e===``?(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`Listening…`}):e}),(0,$.jsx)(B,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Cancel dictation`,className:`size-11 text-muted-foreground md:size-8`,onClick:r,children:(0,$.jsx)(d,{"aria-hidden":`true`})}),(0,$.jsx)(B,{type:`button`,variant:`outline`,size:`icon-sm`,disabled:n,"aria-label":`Insert transcription`,className:`size-11 md:size-8`,onClick:i,children:(0,$.jsx)(ue,{"aria-hidden":`true`})}),(0,$.jsx)(B,{type:`button`,size:`icon-sm`,disabled:n,"aria-label":`Insert transcription and send`,className:`size-11 md:size-8`,onClick:a,children:(0,$.jsx)(Et,{"aria-hidden":`true`})})]})}var Sp={name:`cezar-syn`,type:`dark`,fg:`var(--syn-var)`,bg:`transparent`,settings:[{scope:[`keyword`,`storage`,`constant.language`,`variable.language`,`entity.other.attribute-name`,`support.type.property-name`],settings:{foreground:`var(--syn-key)`}},{scope:[`string`,`punctuation.definition.string`],settings:{foreground:`var(--syn-str)`}},{scope:[`entity.name.function`,`support.function`,`entity.name.tag`,`entity.name.type`,`entity.name.class`,`support.class`,`support.type`],settings:{foreground:`var(--syn-fn)`}},{scope:[`comment`,`punctuation.definition.comment`],settings:{foreground:`var(--syn-com)`}},{scope:[`constant.numeric`,`constant.character`,`constant.other`,`support.constant`,`keyword.other.unit`],settings:{foreground:`var(--syn-num)`}},{scope:[`punctuation`,`keyword.operator`,`meta.brace`,`punctuation.separator`,`punctuation.terminator`],settings:{foreground:`var(--syn-punc)`}},{scope:[`variable`,`entity.name.variable`],settings:{foreground:`var(--syn-var)`}}]},Cp={typescript:()=>Y(()=>import(`./typescript-bsJCZSQ-.js`),[]),tsx:()=>Y(()=>import(`./tsx-udAQXfEw.js`),[]),javascript:()=>Y(()=>import(`./javascript-BgS3c2Ky.js`),[]),jsx:()=>Y(()=>import(`./jsx-Bz0zcwM4.js`),[]),json:()=>Y(()=>import(`./json-qhed-kSA.js`),[]),jsonc:()=>Y(()=>import(`./jsonc-CYpm1nAK.js`),[]),shellscript:()=>Y(()=>import(`./shellscript-CLZ0U2zV.js`),[]),python:()=>Y(()=>import(`./python-gzcpVVnB.js`),[]),markdown:()=>Y(()=>import(`./markdown-BYOwaDjH.js`),[]),css:()=>Y(()=>import(`./css-BsVw1vtW.js`),[]),html:()=>Y(()=>import(`./html-BY76lXLH.js`),__vite__mapDeps([0,1,2])),diff:()=>Y(()=>import(`./diff-woXpYk--.js`),[]),yaml:()=>Y(()=>import(`./yaml-rwi0_p6S.js`),[]),toml:()=>Y(()=>import(`./toml-CcmNWLt0.js`),[]),go:()=>Y(()=>import(`./go-rLFTqkRN.js`),[]),rust:()=>Y(()=>import(`./rust-Cfkwpbl8.js`),[]),sql:()=>Y(()=>import(`./sql-BsFa4tDR.js`),[])},wp={ts:`typescript`,js:`javascript`,mjs:`javascript`,cjs:`javascript`,bash:`shellscript`,sh:`shellscript`,shell:`shellscript`,zsh:`shellscript`,console:`shellscript`,py:`python`,md:`markdown`,yml:`yaml`,golang:`go`,rs:`rust`,vue:`html`,xml:`html`},Tp=new Set([``,`plaintext`,`text`,`txt`,`plain`]);function Ep(e){let t=e.trim().toLowerCase();return t in Cp?t:wp[t]??null}function Dp(e){return Tp.has(e.trim().toLowerCase())}function Op(){return[...Object.keys(Cp),...Object.keys(wp),...Tp].filter(e=>e!==``)}function kp(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);if(n<=0)return null;let r=t.slice(n+1).toLowerCase();return Ep({mts:`typescript`,cts:`typescript`,htm:`html`}[r]??r)}var Ap=null,jp=null,Mp=new Set,Np=new Map;function Pp(){return jp??=Promise.all([Y(()=>import(`./core-BCsw8oQw.js`),__vite__mapDeps([3,4,5])),Y(()=>import(`./engine-javascript-FQvzRocB.js`),[])]).then(async([{createHighlighterCore:e},{createJavaScriptRegexEngine:t}])=>(Ap=await e({themes:[Sp],langs:[],engine:t({forgiving:!0})}),Ap)),jp}function Fp(e){let t=Ep(e);if(t===null||Mp.has(t))return Promise.resolve();let n=Np.get(t);return n||(n=Pp().then(async e=>{await e.loadLanguage(await Cp[t]()),Mp.add(t)}).catch(()=>{Np.delete(t)}),Np.set(t,n)),n}function Ip(e){return{tokens:e.split(`
|
|
3
|
+
`).map(e=>[{content:e}]),fg:`var(--syn-var)`,bg:`transparent`}}function Lp(e,t,n={}){if(Dp(t))return Ip(e);let r=Ep(t);if(r===null)return Ip(e);if(!Ap||!Mp.has(r))return null;try{let t=Ap.codeToTokens(e,{lang:r,theme:Sp.name,tokenizeTimeLimit:n.tokenizeTimeLimit});return{tokens:t.tokens.map(e=>e.map(({content:e,color:t})=>({content:e,color:t}))),fg:t.fg??`var(--syn-var)`,bg:`transparent`}}catch{return Ip(e)}}async function Rp(e,t,n={}){return Lp(e,t,n)||(await Fp(t),Lp(e,t,n)??Ip(e))}function zp({isOpen:e,onClose:t,onConfirm:n,url:r}){return(0,$.jsx)(zi,{open:e,onOpenChange:e=>{e||t()},children:(0,$.jsxs)(fi,{"data-slot":`link-safety-dialog`,children:[(0,$.jsxs)(Ii,{children:[(0,$.jsx)(Qr,{children:`Open this link?`}),(0,$.jsxs)(qr,{children:[`It leaves cezar in a new tab. The words of a link in a transcript are the agent's — the address below is where it actually goes.`,(0,$.jsx)(`span`,{"data-slot":`link-safety-url`,className:`mt-3 block wrap-anywhere rounded-md border border-border bg-muted px-3 py-2 font-mono text-xs text-foreground`,children:r})]})]}),(0,$.jsxs)(Ti,{children:[(0,$.jsx)(Ni,{children:`Cancel`}),(0,$.jsx)(Si,{onClick:n,children:`Open link`})]})]})})}var Bp=(0,Q.createContext)(null),Vp=/^\/(?:api|p|tasks|new|settings|skills|workflows|git|github|inbox|automations)(?:\/|[?#]|$)/;function Hp(e,t){if(!e||/[\u0000-\u001f]/.test(e)||e.startsWith(`#`)||e.startsWith(`//`))return null;let n=e.indexOf(`#`),r=n<0?e:e.slice(0,n),i=n<0?``:e.slice(n),a=t.projectId?`/p/${encodeURIComponent(t.projectId)}`:``,o=`/tasks/${encodeURIComponent(t.runId)}/files`;if(r.startsWith(`${o}?artifact=`)){let e=new URLSearchParams(r.slice(o.length+1));return[...e.keys()].length===1&&/^[0-9a-f-]{36}$/i.test(e.get(`artifact`)??``)?a+r+i:null}if(Vp.test(r))return null;let s=/^[a-z]:[\\/]/i.test(r);if(!s&&/^[a-z][a-z\d+.-]*:/i.test(r)&&!/^file:/i.test(r))return null;let c=/^file:/i.test(r)?r:decodeURIComponent(r);if(/[\u0000-\u001f]/.test(c))return null;if(t.basePath&&!c.startsWith(`/`)&&!s&&!/^file:/i.test(r)){let e=t.basePath.replaceAll(`\\`,`/`);c=e.slice(0,e.lastIndexOf(`/`)+1)+c}return`${a}${o}?path=${encodeURIComponent(c)}${i}`}function Up({href:e,children:t,internal:n,...r}){let[i,a]=(0,Q.useState)(!1);return e?n?(0,$.jsx)(`a`,{...r,href:e,"data-streamdown":`link`,className:`text-accent-text underline underline-offset-2`,children:t}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`a`,{...r,href:e,"data-streamdown":`link`,className:`cursor-pointer text-accent-text underline underline-offset-2`,onClick:e=>{e.preventDefault(),a(!0)},children:t}),(0,$.jsx)(zp,{isOpen:i,url:e,onClose:()=>a(!1),onConfirm:()=>{window.open(e,`_blank`,`noreferrer`),a(!1)}})]}):(0,$.jsx)(`span`,{children:t})}var Wp={name:`shiki`,type:`code-highlighter`,getThemes:()=>[Sp,Sp],getSupportedLanguages:()=>Op(),supportsLanguage:e=>Op().includes(String(e).toLowerCase()),highlight:({code:e,language:t},n)=>Lp(e,String(t))||(Rp(e,String(t)).then(e=>n?.(e)),null)};function Gp(){let e=t=>{if(!t.children)return;let n=[];for(let r of t.children)if(r.type===`text`&&r.value?.includes(`
|
|
4
|
+
`)){let e=r.value.split(/\r?\n/);e.forEach((t,r)=>{r>0&&!(t===``&&r===e.length-1)&&n.push({type:`break`}),t&&n.push({type:`text`,value:t})})}else e(r),n.push(r);t.children=n};return e}var Kp=[...Object.values(bs),Gp],qp=[`p`,`strong`,`em`,`del`,`code`,`a`],Jp={p:`span`,a:`span`},Yp={enabled:!0,renderModal:e=>(0,$.jsx)(zp,{...e})},Xp=(0,Q.memo)(function({children:e,breaks:t=!1,inline:n=!1,document:r=!1}){let i=(0,Q.useContext)(Bp),a=(0,Q.useMemo)(()=>{let e=new Set;function n(){let t=n=>{if((n.type===`link`||n.type===`definition`)&&n.url&&i){let t=Hp(n.url,i);t&&(n.url=t,e.add(t))}n.children?.forEach(t)};return t}return{remark:[...t?Kp:Object.values(bs),n],components:{...i||r?{a:({href:t,children:n})=>r&&!i&&!/^(?:https?:|mailto:|#)/i.test(t??``)?(0,$.jsx)(`span`,{children:n}):(0,$.jsx)(Up,{href:t,internal:e.has(t??``),children:n})}:{},...r?{img:({alt:e})=>(0,$.jsxs)(`span`,{className:`text-muted-foreground`,children:[`[Image: `,e||`embedded image`,`]`]})}:{}}}},[i,t,r]);return(0,$.jsx)(ys,{className:n?`thread-markdown thread-markdown-inline`:`thread-markdown`,plugins:{code:Wp},shikiTheme:[Sp,Sp],remarkPlugins:i?a.remark:t?Kp:void 0,allowedElements:n?qp:void 0,unwrapDisallowed:n||void 0,components:n?Jp:i||r?a.components:void 0,linkSafety:Yp,controls:{code:{copy:!0,download:!1},table:!1,mermaid:!1},lineNumbers:!1,children:e})});function Zp({source:e,className:t}){return(0,$.jsx)(`span`,{"data-slot":`skill-source`,"data-source":e,className:U(`shrink-0 rounded bg-accent-strong/10 px-2 py-1 text-[12px]`,fs({source:e})?`font-semibold text-foreground`:`text-soft-foreground`,t),children:e===`team`?`Team`:e})}function Qp({skill:e,usedBy:t,heading:n=`h2`}){return(0,$.jsxs)(`div`,{"data-slot":`skill-detail`,className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col items-start gap-4`,children:[(0,$.jsxs)(`span`,{className:`sw-detail-source text-[12px]`,children:[(0,$.jsx)(Zp,{source:e.source}),` skill`]}),(0,$.jsx)(n,{className:`min-w-0 text-[19px] font-normal md:text-2xl break-words [overflow-wrap:anywhere]`,children:e.name})]}),(0,$.jsxs)(`p`,{"data-slot":`skill-path`,className:`mt-4 text-[12px] break-all text-soft-foreground`,children:[e.path,e.team?` · from ${e.team.repo}`:``]}),e.description?(0,$.jsx)(`p`,{"data-slot":`skill-description`,className:`mt-2.5 text-[13px] text-muted-foreground`,children:e.description}):null,t===void 0?null:(0,$.jsxs)(`section`,{"data-slot":`skill-used-by`,className:`mt-5`,children:[(0,$.jsx)(`h3`,{className:`text-[13px] font-semibold`,children:`Used by`}),t.length>0?(0,$.jsx)(`ul`,{className:`mt-1.5 flex flex-col gap-1`,children:t.map(e=>(0,$.jsxs)(`li`,{className:`flex items-center gap-1.5 font-mono text-xs text-muted-foreground`,children:[(0,$.jsx)(me,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),e]},e))}):(0,$.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:`Not referenced by a workflow yet. quick-task can use it when the task mentions it.`})]}),(0,$.jsx)(`section`,{className:`mt-5`,children:(0,$.jsx)(`div`,{"data-slot":`skill-body`,className:`mt-2 text-sm`,children:(0,$.jsx)(Xp,{children:e.body})})})]})}function $p({skill:e,onClose:t}){return(0,$.jsx)(rs,{open:e!==null,onOpenChange:e=>e?void 0:t(),children:(0,$.jsx)(as,{"data-slot":`skill-preview`,className:`block max-h-[80dvh] overflow-y-auto sm:max-w-2xl`,children:e?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(os,{className:`sr-only`,children:e.name}),(0,$.jsx)(ns,{className:`sr-only`,children:`Read-only skill preview`}),(0,$.jsx)(Qp,{skill:e,heading:`h3`}),(0,$.jsx)(`p`,{className:`mt-5`,children:(0,$.jsx)(Z,{to:`/skills?skill=${encodeURIComponent(e.name)}`,"data-slot":`skill-preview-manage`,onClick:t,className:`text-xs font-semibold text-accent-text hover:underline`,children:`Open in the Skills catalog`})})]}):null})})}function em(e){try{let t=new URL(e),n=t.pathname===`/`?``:t.pathname.replace(/\/$/,``);return`${t.host}${n}`||e}catch{return e}}function tm(e,t,n){let r=e.skill===``?{source:`workflow`,ref:`quick-task`}:{source:`skill`,ref:e.skill};return za({task:e.ref,source:r,model:``,runner:t,defaultRunner:n,variants:1,images:[],todoId:e.todo})}function nm(e,t){return e.kind===`failed`?{message:`Auto-start failed: ${e.message} — review and press Start`,tone:`danger`}:e.kind===`blocked`?{message:`Auto-start blocked (bad key) — review and press Start`,tone:`danger`}:t===``?{message:`Prefilled from link — review and press Start`,tone:`default`}:{message:`Unknown skill "${t}" — prefilled for quick-task; review and press Start`,tone:`danger`}}function rm(e,t){return`Use the "${e}" skill on: ${t}`}function im(e){let t=e.configuredAutonomous===`source-dependent`?e.source===`skill`:e.configuredAutonomous,n=e.interactive!==!0&&void 0;return{autonomous:e.planFirst?!1:e.explicitAutonomous??n??t,worktree:e.hasGit?e.variants>1?!0:e.explicitWorktree??n??e.configuredWorktree:!1}}function am(e){return e.worktree?`Runs in an isolated worktree — review everything before it lands.`:e.hasGit?`Runs in the repo working tree — your checkout is modified directly.`:`Runs in place — no git repository detected, so there is no worktree to isolate in.`}var om={text:``,source:null,runner:null,agentProfile:null,model:null,effort:null,variants:1,planFirst:!1,worktree:null,autonomous:null,generateFollowups:null},sm=`cez-new-task-draft`;function cm(e){return e===null?sm:`${sm}:${e}`}function lm(e){let t=e&&typeof e==`object`?e:{};return{text:typeof t.text==`string`?t.text:``,source:um(t.source)?t.source:null,runner:typeof t.runner==`string`?t.runner:null,agentProfile:typeof t.agentProfile==`string`?t.agentProfile:null,model:typeof t.model==`string`?t.model:null,effort:typeof t.effort==`string`?t.effort:null,variants:t.variants===2||t.variants===3?t.variants:1,planFirst:t.planFirst===!0,worktree:typeof t.worktree==`boolean`?t.worktree:null,autonomous:typeof t.autonomous==`boolean`?t.autonomous:null,generateFollowups:typeof t.generateFollowups==`boolean`?t.generateFollowups:null}}function um(e){return!!e&&typeof e==`object`&&(e.source===`skill`||e.source===`workflow`)&&typeof e.ref==`string`}var dm=new Map,fm=new Map;function pm(e=null){return fm.get(cm(e))??0}function mm(e=null){let t=cm(e),n=dm.get(t);if(n)return{...n};let r;try{let e=localStorage.getItem(t);r=e?lm(JSON.parse(e)):{...om}}catch{r={...om}}return dm.set(t,r),{...r}}function hm(e,t=null){let n=cm(t);fm.set(n,pm(t)+1),dm.set(n,{...e});try{localStorage.setItem(n,JSON.stringify(e))}catch{}}function gm(e=null,t){t!==void 0&&pm(e)!==t||hm({...mm(e),text:``,source:null},e)}function _m(e){let t=typeof e==`string`?new URLSearchParams(e):e;return{skill:(t.get(`skill`)??``).trim(),ref:(t.get(`ref`)??t.get(`task`)??``).trim(),auto:t.get(`auto`)===`1`,key:t.get(`key`)??``,todo:(t.get(`todo`)??``).trim()}}function vm(e,t,n){return{task:e,steps:[...n.steps],rationale:n.rationale,fallback:n.fallback,images:[...t]}}function ym(e,t){return!Number.isInteger(t)||t<0||t>=e.length?[...e]:e.filter((e,n)=>n!==t)}function bm(e,t,n){let r=[...e];if(!Number.isInteger(t)||t<0||t>=r.length)return r;let i=Math.max(0,Math.min(r.length-1,n));if(i===t)return r;let[a]=r.splice(t,1);return r.splice(i,0,a),r}function xm(e){return e.command??e.prompt??``}function Sm(e,t=120){let n=e.split(`
|
|
5
|
+
`)[0]??``;return n.length>t?`${n.slice(0,t-1)}…`:n}function Cm(e){let{task:t,steps:n,model:r,modelsLocked:i,effort:a,runner:o,runnerExplicit:s,defaultRunner:c,variants:l,images:u,generateFollowups:d,todoId:f}=e;return{task:t,steps:[...n],model:i?void 0:r||void 0,effort:i?void 0:a||void 0,runner:La(o,c,s),variants:l>1?l:void 0,images:u.length>0?[...u]:void 0,generateFollowups:d!==!1&&void 0,todoId:f||void 0}}function wm({className:e,type:t,...n}){return(0,$.jsx)(`input`,{type:t,"data-slot":`input`,className:U(`h-11 w-full min-w-0 rounded-md border border-input bg-[var(--task-brand-bg)] px-3 py-1 text-base shadow-none transition-[color,box-shadow] outline-none selection:bg-accent-strong selection:text-accent-strong-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-soft-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm`,`focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`,`aria-invalid:border-destructive aria-invalid:ring-destructive/20`,e),...n})}function Tm({plan:e,starting:t,startAvailable:n,startUnavailableReason:r,startUnavailableAction:i,onStepsChange:a,onStart:o,onDiscard:s}){let[c,l]=(0,Q.useState)(null),[u,f]=(0,Q.useState)(null),p=(0,Q.useRef)(null),m=(0,Q.useId)();(0,Q.useEffect)(()=>{p.current?.focus({preventScroll:!0});let e=p.current?.closest(`[data-slot="main"]`);e&&(e.scrollTop=0)},[]);let h=()=>{l(null),f(null)},g=(t,n)=>{t.preventDefault(),c!==null&&c!==n&&a(bm(e.steps,c,n)),h()},_=e.steps.length===0;return(0,$.jsxs)(`div`,{"data-slot":`plan-page`,children:[(0,$.jsxs)(`header`,{"data-slot":`plan-page-header`,children:[(0,$.jsx)(`h1`,{children:`New task / Plan first`}),(0,$.jsx)(`p`,{children:`Review the proposed chain before launching.`})]}),(0,$.jsx)(`div`,{"data-slot":`plan-canvas`,children:(0,$.jsxs)(`section`,{ref:p,tabIndex:-1,"aria-labelledby":m,"data-slot":`plan-review`,className:`flex flex-col outline-none`,onKeyDown:e=>{e.key!==`Escape`||e.defaultPrevented||e.target.closest(`[role="dialog"], [role="alertdialog"]`)||(e.preventDefault(),s())},children:[(0,$.jsxs)(`header`,{"data-slot":`dialog-header`,className:`flex flex-col gap-1 px-5 pt-4 pb-3.5 text-left`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,$.jsx)(`h2`,{id:m,"data-slot":`dialog-title`,className:`text-[11px] font-semibold tracking-[0.08em] text-muted-foreground uppercase`,children:`Proposed chain`}),(0,$.jsx)(`button`,{type:`button`,onClick:s,"aria-label":`Discard the plan`,className:`-mt-1 -mr-1 rounded-md p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:(0,$.jsx)(d,{"aria-hidden":`true`,className:`size-4`})})]}),(0,$.jsx)(`p`,{"data-slot":`plan-task`,title:e.task,className:`text-[18px] font-medium text-foreground`,children:Sm(e.task)}),e.fallback?(0,$.jsx)(`p`,{"data-slot":`plan-fallback`,className:`text-xs text-soft-foreground italic`,children:`planner unavailable — single-step plan`}):e.rationale===``?null:(0,$.jsx)(`p`,{"data-slot":`plan-rationale`,className:`text-xs text-muted-foreground`,children:e.rationale})]}),(0,$.jsx)(`ol`,{"data-slot":`plan-steps`,className:`flex-1 space-y-2 overflow-y-auto px-5 py-4`,children:_?(0,$.jsx)(`li`,{className:`py-6 text-center text-sm text-muted-foreground`,children:`(no steps left — discard and plan again)`}):e.steps.map((t,n)=>(0,$.jsxs)(`li`,{"data-slot":`plan-step`,"data-step-id":t.id,draggable:!0,onDragStart:()=>l(n),onDragOver:e=>{e.preventDefault(),f(n)},onDragLeave:()=>f(e=>e===n?null:e),onDrop:e=>g(e,n),onDragEnd:h,className:U(`flex items-center gap-2.5 rounded-lg border border-border bg-card-2 px-3 py-2.5`,c===n&&`opacity-50`,u===n&&c!==null&&c!==n&&`border-ring`),children:[(0,$.jsx)(nt,{"aria-hidden":`true`,className:`size-3.5 shrink-0 cursor-grab text-soft-foreground`}),(0,$.jsx)(`span`,{className:`w-5 shrink-0 font-mono text-[11px] text-soft-foreground tabular-nums`,children:String(n+1).padStart(2,`0`)}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`text-[13px] font-medium`,children:t.name??t.id}),t.skill?(0,$.jsx)(`span`,{"data-slot":`plan-badge-skill`,title:`skill`,className:`shrink-0 rounded-full bg-accent-strong/15 px-1.5 py-px font-mono text-[11px] font-medium text-accent-text`,children:t.skill}):null,t.command?(0,$.jsx)(`span`,{"data-slot":`plan-badge-check`,className:`shrink-0 rounded-full bg-muted px-1.5 py-px text-[11px] font-medium text-muted-foreground`,children:`check`}):null]}),(0,$.jsx)(`p`,{className:`mt-3 whitespace-pre-wrap break-words font-mono text-[11px] text-muted-foreground`,children:xm(t)})]}),(0,$.jsxs)(`span`,{"data-slot":`plan-step-actions`,className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(B,{type:`button`,variant:`ghost`,size:`icon-sm`,"data-slot":`plan-step-up`,"aria-label":`Move step ${n+1} up`,disabled:n===0,className:`size-7 text-muted-foreground`,onClick:()=>a(bm(e.steps,n,n-1)),children:`Move up`}),(0,$.jsx)(B,{type:`button`,variant:`ghost`,size:`icon-sm`,"data-slot":`plan-step-down`,"aria-label":`Move step ${n+1} down`,disabled:n===e.steps.length-1,className:`size-7 text-muted-foreground`,onClick:()=>a(bm(e.steps,n,n+1)),children:`Move down`}),(0,$.jsx)(B,{type:`button`,variant:`ghost`,size:`icon-sm`,"data-slot":`plan-step-remove`,"aria-label":`Remove step ${n+1}`,className:`size-7 text-muted-foreground hover:text-danger`,onClick:()=>a(ym(e.steps,n)),children:`Remove`})]})]},t.id))}),!n&&r?(0,$.jsxs)(`p`,{id:`plan-start-guidance`,className:`flex flex-wrap items-center gap-1.5 border-t border-border px-5 pt-3 text-xs text-muted-foreground`,children:[(0,$.jsx)(`span`,{children:r}),i]}):null,(0,$.jsxs)(`div`,{"data-slot":`plan-actions`,className:`flex flex-wrap items-center gap-3 px-6 pt-3 pb-6`,children:[(0,$.jsxs)(B,{type:`button`,"data-slot":`plan-start`,disabled:_||t||!n,title:n?void 0:r,"aria-describedby":!n&&r?`plan-start-guidance`:void 0,onClick:o,children:[(0,$.jsx)(Do,{"aria-hidden":`true`,className:`size-3.5`}),t?`Starting…`:`Start`]}),(0,$.jsx)(Em,{steps:e.steps,disabled:_}),(0,$.jsx)(B,{type:`button`,variant:`outline`,onClick:s,children:`Discard`})]}),(0,$.jsx)(`p`,{className:`px-6 pb-6 text-xs text-muted-foreground`,children:`No steps left? Start is disabled. A planner failure shows a single-step fallback.`})]})})]})}function Em({steps:e,disabled:t}){let n=V(),[r,i]=(0,Q.useState)(!1),[a,o]=(0,Q.useState)(``),[s,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(!1),d=async t=>{let r=a.trim();if(!(r===``||l)){u(!0);try{let a=await Pt({name:r,steps:e,...t?{overwrite:!0}:{}});L(`Saved — ${a.path.split(`/`).pop()??a.path}`),n.invalidateQueries({queryKey:K.workflows}),c(!1),i(!1),o(``)}catch(e){e instanceof E&&e.exists===!0?c(!0):L(e instanceof Error?e.message:String(e),{tone:`danger`})}finally{u(!1)}}};return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(B,{type:`button`,variant:`outline`,"data-slot":`plan-save`,disabled:t,onClick:()=>i(!0),children:`Save as chain`}),(0,$.jsx)(rs,{open:r,onOpenChange:e=>i(!!e),children:(0,$.jsxs)(as,{"data-slot":`plan-save-dialog`,className:`sm:max-w-sm`,showCloseButton:!1,children:[(0,$.jsxs)(is,{children:[(0,$.jsx)(os,{children:`Save as chain`}),(0,$.jsx)(ns,{children:`Saves these steps as a reusable workflow — it joins the picker like any other chain.`})]}),(0,$.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),d(!1)},children:[(0,$.jsx)(`label`,{htmlFor:`plan-chain-name`,className:`mb-2 block text-[11px] text-muted-foreground`,children:`Chain name`}),(0,$.jsx)(wm,{id:`plan-chain-name`,value:a,onChange:e=>o(e.target.value),"aria-label":`Chain name`,placeholder:`e.g. fix-and-verify-v2`,maxLength:80,autoFocus:!0}),(0,$.jsxs)(ts,{className:`mt-4`,children:[(0,$.jsx)(B,{type:`button`,variant:`outline`,onClick:()=>i(!1),children:`Cancel`}),(0,$.jsx)(B,{type:`submit`,disabled:a.trim()===``||l,children:l?`Saving…`:`Save chain`})]})]})]})}),(0,$.jsx)(zi,{open:s,onOpenChange:e=>e?void 0:c(!1),children:(0,$.jsxs)(fi,{"data-slot":`plan-overwrite-dialog`,children:[(0,$.jsxs)(Ii,{children:[(0,$.jsxs)(Qr,{children:[`Overwrite “`,a.trim(),`”?`]}),(0,$.jsx)(qr,{children:`A chain with this name already exists. Overwriting replaces its steps with this plan.`})]}),(0,$.jsxs)(Ti,{children:[(0,$.jsx)(Ni,{children:`Cancel`}),(0,$.jsx)(Si,{onClick:()=>void d(!0),children:`Overwrite chain`})]})]})})]})}function Dm(){let[e]=ke(),t=Eo(),n=V(),r=(0,Q.useRef)(null),[i,a]=(0,Q.useState)(()=>typeof window<`u`&&window.innerWidth<=767),{projectId:o}=D(),s=Le().projectId,c=oi(),[l]=(0,Q.useState)(()=>_m(e)),u=W(),d=Vr(),f=Pr(),p=Qn(),m=Mi(),h=mi(),g=Wr(),[_,y]=(0,Q.useState)(()=>({...mm(s),...l.ref===``?{}:{text:l.ref},...l.skill===``?{}:{source:{source:`skill`,ref:l.skill}}})),b=(0,Q.useRef)(_);(0,Q.useEffect)(()=>{hm(b.current,s)},[s]);let x=(0,Q.useRef)(!1),S=(0,Q.useRef)(!0);(0,Q.useEffect)(()=>(S.current=!0,()=>{S.current=!1}),[]);let C=e=>{if(!S.current||x.current)return;let t={...b.current,...e};b.current=t,hm(t,s),y(t)},w=m.data?.recentSources,T=f.data,E=m.data?.skillUsage,k=(0,Q.useMemo)(()=>gs(T??[],E),[T,E]),A=d.data?.workflows??[],j=c.data?.projects??[],ee=j.find(e=>e.id===(o??c.data?.bootProject))?.webhook?.url,[te,M]=(0,Q.useState)(!1),ne=ee!==void 0&&te,re=f.data!==void 0&&d.data!==void 0&&!m.isPending,N=Fa(_.source,k,A),ie=N?.source===`skill`?k.find(e=>e.name===N.ref):void 0,P=(0,Q.useRef)(null),ae=(0,Q.useRef)(null),oe=(0,Q.useMemo)(()=>Va(m.data?.promptTemplates),[m.data?.promptTemplates]),se=$a(oe,N?.source===`skill`?[N.ref]:[]),ce=(0,Q.useRef)(_.text);ce.current=_.text;let ue=(0,Q.useRef)(``);(0,Q.useEffect)(()=>{if(!re||x.current)return;let e=eo(ce.current,ue.current,se);ue.current=e.applied,e.text!==ce.current&&C({text:e.text})},[se,re]);let de=Ai(),fe=he(de.data),pe=h.data?.defaultRunner,me=pe??`claude`,F=fe.length>0?Pa(_.runner,fe,me):null,ge=F??me,I=de.isSuccess&&fe.length>0,_e=gr(ge),ve=h.data?.modelsLocked===!0,ye=F===null?[]:Ia(F,_e.data,[_.model,h.data?.defaultModels?.[F]]),be=F===null?``:Ya(ve?null:_.model,F,h.data?.defaultModels,_e.data),xe=Aa(ge,be,_e.data),Se=ve?``:Da(_.effort,xe),{accounts:Ce,repoAccount:we}=Ao(),Te=Ce.some(e=>e.provider===ge&&e.id===_.agentProfile)?_.agentProfile:null,Ee=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{let e=I&&!Ee.current;Ee.current=I,e&&document.activeElement===document.body&&document.querySelector(`textarea[aria-label="Describe a task for the agent"]`)?.focus()},[I]);let De=p.data===void 0||p.data.info!==null,R=De?_.variants:1,Oe=De,Ae=R>1,je=im({hasGit:De,variants:R,planFirst:_.planFirst,explicitAutonomous:_.autonomous,explicitWorktree:_.worktree,interactive:ie?.interactive,configuredAutonomous:g.data?.composerDefaults?.autonomous??g.data?.composerDefaults?.inheritedAutonomous??`source-dependent`,configuredWorktree:g.data?.composerDefaults?.worktree??g.data?.composerDefaults?.inheritedWorktree??!0,source:N?.source??`workflow`}),Me=je.worktree,Ne=je.autonomous,Pe=u.data===void 0||u.data.capabilities.followups,Fe=Pe?_.generateFollowups??m.data?.lastGenerateFollowups??!0:!1,[Re,ze]=(0,Q.useState)(null),[Ve,He]=(0,Q.useState)(!1),[Ue,We]=(0,Q.useState)(!1),[Ge,Ke]=(0,Q.useState)(()=>l.auto&&l.ref!==``);(0,Q.useLayoutEffect)(()=>{let e=r.current;if(!e)return;let t=()=>a(window.innerWidth<=767||e.getBoundingClientRect().width<550);t();let n=typeof ResizeObserver>`u`?null:new ResizeObserver(t);return n?.observe(e),window.addEventListener(`resize`,t),()=>{n?.disconnect(),window.removeEventListener(`resize`,t)}},[Ge]);let[qe,Je]=(0,Q.useState)(()=>!l.auto&&l.ref!==``?{kind:`prefill`}:null),Ye=(0,Q.useRef)(!1),Xe=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{Ye.current||(Ye.current=!0,e.toString()!==``&&t(`/new`,{replace:!0}))},[]),(0,Q.useEffect)(()=>{if(Xe.current||!l.auto||l.ref===``||de.isPending)return;if(!I||F===null){Xe.current=!0,Je({kind:`prefill`}),Ke(!1);return}if(h.isPending)return;if(Xe.current=!0,pe===void 0){Je({kind:`prefill`}),Ke(!1);return}let e=pm(s);(async()=>{let r=``;try{r=(await Be()).key}catch{}if(r!==``&&l.key===r)try{let r=await ut(tm(l,F,pe));gm(s,e),n.invalidateQueries({queryKey:K.runs.all}),S.current&&t(ja(r));return}catch(e){Je({kind:`failed`,message:e instanceof Error?e.message:String(e)})}else Je({kind:`blocked`});Ke(!1)})()},[h.isPending,pe,de.isPending,I,F]),(0,Q.useEffect)(()=>{if(qe===null||!re)return;Je(null);let e=l.skill!==``&&!k.some(e=>e.name===l.skill)?l.skill:``;e!==``&&C({text:rm(l.skill,l.ref),source:null});let{message:t,tone:n}=nm(qe,e);L(t,{tone:n}),document.querySelector(`[data-slot="composer"] button[aria-label="Start task"], [data-slot="composer"] button[aria-label="Plan task"]`)?.focus()},[qe,re]);let Ze=async(e,r)=>{let i=pm(s);if(!I||F===null)throw Error(de.isPending?`Checking agent providers…`:de.isError?`Provider authentication could not be verified.`:`Connect an agent provider before starting a task.`);if(!re)throw Error(`Still loading workflows and skills — try again in a second.`);if(_.planFirst){He(!0);try{let t=await O(e);S.current&&ze(vm(e,r,t))}finally{He(!1)}return}let a=await ut(Ma(za({task:e,source:N,model:be,modelsLocked:ve,effort:Se,runner:F,runnerExplicit:_.runner!==null,agentProfile:Te,defaultRunner:pe,variants:R,images:r,worktree:Me,autonomous:Ne,generateFollowups:Fe,todoId:l.todo}),ne));Kt({lastTask:N,...N?{recentSources:Xa(w,N)}:{},...Pe?{lastGenerateFollowups:Fe}:{},...N?.source===`skill`&&m.data!==void 0?{skillUsage:_s(m.data.skillUsage,N.ref)}:{}}).then(()=>n.invalidateQueries({queryKey:K.uiState})).catch(()=>{}),gm(s,i),n.invalidateQueries({queryKey:K.runs.all}),S.current&&t(ja(a))},Qe=async()=>{if(Re===null||Re.steps.length===0||Ue||!I||F===null)return;let e=pm(s);We(!0);try{let r=await ut(Ma(Cm({task:Re.task,steps:Re.steps,model:be,modelsLocked:ve,effort:Se,runner:F,runnerExplicit:_.runner!==null,defaultRunner:pe,variants:R,images:Re.images,generateFollowups:Fe,todoId:l.todo}),ne));Pe&&Kt({lastGenerateFollowups:Fe}).then(()=>n.invalidateQueries({queryKey:K.uiState})).catch(()=>{}),gm(s,e),ze(null),n.invalidateQueries({queryKey:K.runs.all}),S.current&&t(ja(r))}catch(e){L(e instanceof Error?e.message:String(e),{tone:`danger`})}finally{We(!1)}};if(Ge)return(0,$.jsxs)(`div`,{"data-route":`new`,className:`relative isolate flex min-h-full flex-col items-center justify-center overflow-x-clip px-6`,children:[(0,$.jsx)(Wi,{}),(0,$.jsxs)(`div`,{"data-slot":`auto-starting`,role:`status`,className:`text-center`,children:[(0,$.jsx)(`h1`,{className:`animate-pulse text-lg font-semibold tracking-tight`,children:`Starting task…`}),(0,$.jsx)(`p`,{className:`mt-1.5 text-[14px] text-muted-foreground`,children:`Launched from a bookmarklet — taking you to the run.`})]})]});let $e=fe.length>1||fe.some(e=>jo(Ce,e))?(0,$.jsx)(co,{icon:(0,$.jsx)(le,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,runners:fe,value:ge,accounts:Ce,account:Te,repoAccount:we,onPick:(e,t)=>C({runner:e,agentProfile:t,...e===ge?{}:{model:null}}),disabled:!I},`runner`):null,et=(0,$.jsx)(Ba,{icon:(0,$.jsx)(Ie,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`model-pill`,ariaLabel:`Model`,label:ye.find(e=>e.id===be)?.label??`auto`,value:be,disabled:!I,readOnly:ve,disabledHint:ve?`Model selection is locked to native coding-agent settings.`:void 0,onPick:e=>{let t=Aa(ge,e,_e.data);C({model:e,effort:_.effort===null?null:Da(_.effort,t)})},options:ye.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:ka(ge,_e.data,_e.isError,_e.isFetching)},`model`),tt=(0,$.jsx)(Ba,{icon:(0,$.jsx)(st,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`effort-pill`,ariaLabel:`Effort`,label:xe.find(e=>e.value===Se)?.label??`auto`,value:Se,disabled:!I,readOnly:ve,disabledHint:ve?`Effort selection is locked to native coding-agent settings.`:void 0,onPick:e=>C({effort:e}),options:xe.map(e=>({value:e.value,label:e.label,desc:e.desc}))},`effort`);return(0,$.jsxs)(`div`,{"data-route":`new`,"data-plan-review":Re===null?void 0:`true`,className:`relative isolate flex min-h-full flex-col overflow-x-clip pb-16`,children:[(0,$.jsxs)(`div`,{ref:ae,style:Re===null?void 0:{display:`none`},className:`relative z-[1] mx-auto w-full max-w-none px-11 pt-12 max-md:px-[18px] max-md:pt-[22px]`,children:[(0,$.jsxs)(`header`,{className:`mb-7 max-md:mb-5`,children:[(0,$.jsx)(`p`,{"data-slot":`page-eyebrow`,className:`mb-2 text-[11px] font-semibold tracking-[0.16em] text-[var(--accent-text)] uppercase`,children:`NEW TASK`}),(0,$.jsx)(`h1`,{className:`text-[30px] leading-[normal] font-semibold tracking-[-0.9px] max-md:text-[22px] max-md:leading-[29px] max-md:tracking-[-0.6px]`,children:`What should the agent work on?`}),(0,$.jsx)(`p`,{"data-slot":`page-description`,className:`mt-2 hidden text-[13px] text-muted-foreground md:block`,children:`Describe the outcome. Configure the run. Review everything before it lands.`})]}),(0,$.jsx)(yp,{ref:P,onSubmit:Ze,retainDraftUntilSuccess:!0,idleFeedback:(0,$.jsxs)(`div`,{"data-slot":`new-task-mode-note`,className:`flex items-center justify-between gap-3 text-[11px] text-muted-foreground`,children:[(0,$.jsx)(`span`,{children:_.planFirst?`Review the plan before starting the task.`:`Start immediately with the selected configuration.`}),(0,$.jsx)(`kbd`,{className:`hidden font-sans md:inline`,children:ap()})]}),pendingLabel:_.planFirst?`Planning task…`:`Starting task…`,failureHint:_.planFirst?`Could not create the plan. Your draft is kept. Please retry.`:void 0,clearOnSuccess:!_.planFirst,onPendingChange:e=>{x.current=e},value:_.text,onValueChange:e=>C({text:e}),autoFocus:!0,placeholder:`Describe a task for the agent — / for skills…`,ariaLabel:`Describe a task for the agent`,sendAriaLabel:_.planFirst?`Plan task`:`Start task`,disabled:!I||Ue,disabledReason:de.isPending?`Checking agent providers…`:de.isError?`Provider authentication could not be verified.`:`Connect an agent provider before starting a task.`,autocompleteSkills:!0,footerStart:(0,$.jsxs)($.Fragment,{children:[j.length>1&&o!==void 0?(0,$.jsx)(Nm,{projects:j,projectId:o,onPick:e=>t(`/p/${encodeURIComponent(e)}/new`,{replace:!0})}):null,(0,$.jsx)(Uf,{label:`Template`,templates:oe,onInsert:e=>P.current?.insertAtCaret(e)}),(0,$.jsx)(Pm,{source:N,ready:re,skills:k,skillUsage:E,workflows:A,onPick:e=>C({source:e})})]}),agentOptions:(0,$.jsx)(`div`,{ref:r,"data-slot":`agent-options`,role:`group`,"aria-label":`Agent settings`,className:`new-task-agent-options`,children:(0,$.jsx)(ao,{children:i?[$e,tt,et]:[$e,et,tt]})}),executionOptions:(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[(0,$.jsxs)(`details`,{"data-slot":`execution-options`,open:!0,className:`group rounded-xl border border-border bg-card xl:self-start`,children:[(0,$.jsxs)(`summary`,{className:`flex min-h-[44px] cursor-pointer list-none flex-wrap items-center gap-x-2 gap-y-1 px-3 py-2 text-xs text-muted-foreground hover:bg-muted/50 focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-foreground [&::-webkit-details-marker]:hidden`,children:[(0,$.jsx)(v,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),(0,$.jsx)(`span`,{className:`font-medium text-foreground`,children:`Execution settings`}),(0,$.jsxs)(`span`,{"data-slot":`execution-summary`,hidden:!0,className:`min-w-0 basis-full truncate pl-5 xl:ml-auto xl:basis-auto xl:pl-0`,children:[Oa.find(e=>e.id===ge)?.label??ge,` · `,ye.find(e=>e.id===be)?.label??`auto`]})]}),(0,$.jsxs)(`div`,{className:`space-y-3 border-t border-border px-5 pt-3 pb-5`,children:[(0,$.jsx)(`p`,{className:`hidden text-[11px] text-muted-foreground xl:block`,children:`Control where and how this task runs.`}),(0,$.jsxs)(`div`,{role:`group`,"aria-label":`Run settings`,className:`new-task-run-settings`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-xs text-muted-foreground`,children:[(0,$.jsx)(`span`,{children:`Parallel variants`}),(0,$.jsx)(Ba,{slot:`variants-pill`,ariaLabel:`Parallel variants`,label:R>1?`×${R} variants`:`×1`,value:String(R),onPick:e=>C({variants:Number(e)}),disabled:!De,hint:`How many times to run this task in parallel — each variant gets its own worktree, and you pick the diff you keep. ×1 runs it once.`,disabledHint:`Parallel variants need a git repository — each variant runs in its own worktree.`,options:[{value:`1`,label:`×1`,desc:`One run`},{value:`2`,label:`×2 variants`,desc:`Two competing runs — pick the diff you keep`},{value:`3`,label:`×3 variants`,desc:`Three competing runs — pick the diff you keep`}]})]}),Oe?(0,$.jsx)(Om,{on:Me,disabled:Ae,disabledReason:`Parallel variants always use isolated worktrees`,onChange:e=>C({worktree:e})}):null,(0,$.jsx)(km,{on:Ne,disabled:_.planFirst,onChange:e=>C({autonomous:e})}),ee===void 0?null:(0,$.jsx)(Am,{on:ne,url:ee,onChange:M}),ie?.interactive&&(_.autonomous===null||_.worktree===null)?(0,$.jsx)(`p`,{className:`basis-full text-xs text-muted-foreground`,"data-slot":`interactive-skill-hint`,children:`This skill recommends an interactive run in the current checkout. You can change either setting.`}):null,p.data?(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-xs text-muted-foreground`,children:[(0,$.jsx)(`span`,{children:`Base branch`}),(0,$.jsx)(Fm,{repo:p.data})]}):null]}),(0,$.jsxs)(`p`,{"data-slot":`execution-tip`,className:`hidden rounded-lg bg-background p-3 text-[11px] leading-5 text-muted-foreground xl:block`,children:[(0,$.jsx)(nn,{"aria-hidden":`true`,className:`mb-2 size-[18px] text-accent-text`}),Me&&De?`Changes stay in their own worktree, separate from your working directory.`:`Changes are made in the current working directory.`]})]})]}),Pe?(0,$.jsx)(`section`,{"data-slot":`followups-options`,"aria-label":`Follow-ups preference`,className:`rounded-xl border border-border bg-card p-4`,children:(0,$.jsx)(jm,{on:Fe,onChange:e=>C({generateFollowups:e})})}):null]}),footerEnd:(0,$.jsxs)($.Fragment,{children:[!I&&!de.isPending?(0,$.jsx)(Z,{to:`/settings/agents#providers`,className:`text-xs font-medium text-foreground underline underline-offset-4`,children:`Configure providers`}):null,(0,$.jsx)(Im,{planFirst:_.planFirst,planning:Ve,onModeChange:e=>C({planFirst:e})}),(0,$.jsx)(`kbd`,{"aria-hidden":`true`,className:`hidden rounded-[5px] border border-b-2 border-border bg-card px-[5px] py-px font-mono text-[11px] font-medium text-muted-foreground md:inline`,children:ap()})]})}),(0,$.jsx)(`p`,{"data-slot":`run-mode-note`,className:`mt-2.5 text-[13px] text-muted-foreground`,children:am({worktree:Me,hasGit:De})})]}),Re===null?null:(0,$.jsx)(Tm,{plan:Re,starting:Ue,startAvailable:I,startUnavailableReason:de.isPending?`Checking agent providers…`:de.isError?`Provider authentication could not be verified.`:`Connect an agent provider before starting a task.`,startUnavailableAction:de.isPending?void 0:(0,$.jsx)(Z,{to:`/settings/agents#providers`,children:`Configure providers`}),onStepsChange:e=>ze(t=>t&&{...t,steps:e}),onStart:()=>void Qe(),onDiscard:()=>{ze(null),requestAnimationFrame(()=>ae.current?.querySelector(`textarea`)?.focus())}})]})}function Om({on:e,disabled:t,disabledReason:n,onChange:r}){return(0,$.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":e,disabled:t,"aria-label":`Worktree`,"data-slot":`worktree-toggle`,onClick:()=>r(!e),title:t?n:e?`Runs in an isolated worktree — uncheck to run in the repo working tree`:`Runs in the repo working tree — check to isolate in a worktree`,className:`flex items-center justify-between gap-3 px-0 py-3 text-left`,children:[(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`block text-[13px] font-medium`,children:`Worktree`}),(0,$.jsx)(`span`,{className:`block text-[12px] text-muted-foreground`,children:`Run in an isolated working copy`})]}),(0,$.jsx)(`span`,{"aria-hidden":`true`,className:U(`flex h-6 w-10 shrink-0 items-center rounded-full border p-0.5`,e?`border-accent-strong bg-accent-strong`:`border-muted-foreground bg-muted`),children:(0,$.jsx)(`span`,{className:U(`size-[18px] rounded-full`,e?`ml-auto bg-accent-strong-foreground`:`bg-foreground`)})})]})}function km({on:e,disabled:t,onChange:n}){return(0,$.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":e,disabled:t,"aria-label":`Autonomous`,"data-slot":`autonomous-toggle`,onClick:()=>n(!e),title:t?`Plan-first runs are interactive — autonomous is unavailable`:e?`Autonomous — the agent runs to completion without pausing for you`:`Runs interactively — check to let the agent finish without pausing for you`,className:`flex items-center justify-between gap-3 px-0 py-3 text-left disabled:opacity-50`,children:[(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`block text-[13px] font-medium`,children:`Autonomous`}),(0,$.jsx)(`span`,{className:`block text-[12px] text-muted-foreground`,children:`Let the agent proceed without prompts`})]}),(0,$.jsx)(`span`,{"aria-hidden":`true`,className:U(`flex h-6 w-10 shrink-0 items-center rounded-full border p-0.5`,e?`border-accent-strong bg-accent-strong`:`border-muted-foreground bg-muted`),children:(0,$.jsx)(`span`,{className:U(`size-[18px] rounded-full`,e?`ml-auto bg-accent-strong-foreground`:`bg-foreground`)})})]})}function Am({on:e,url:t,onChange:n}){return(0,$.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":e,"aria-label":`Notify webhook`,"data-slot":`notify-webhook-toggle`,onClick:()=>n(!e),title:e?`Status changes go to ${em(t)}`:`Check to send this task's status changes to ${em(t)}`,className:`flex min-h-11 items-center justify-between gap-3 px-0 py-3 text-left`,children:[(0,$.jsxs)(`span`,{className:`min-w-0`,children:[(0,$.jsx)(`span`,{className:`block text-[13px] font-medium`,children:`Notify webhook`}),(0,$.jsx)(`span`,{"data-slot":`notify-webhook-subtitle`,className:`block truncate text-[12px] text-muted-foreground`,children:`Send status changes`})]}),(0,$.jsx)(`span`,{"aria-hidden":`true`,className:U(`flex h-6 w-10 shrink-0 items-center rounded-full border p-0.5`,e?`border-accent-strong bg-accent-strong`:`border-muted-foreground bg-muted`),children:(0,$.jsx)(`span`,{className:U(`size-[18px] rounded-full`,e?`ml-auto bg-accent-strong-foreground`:`bg-foreground`)})})]})}function jm({on:e,onChange:t}){return(0,$.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":e,"data-slot":`generate-followups-toggle`,onClick:()=>t(!e),title:e?`Agents can add newly discovered follow-up work to the task inbox`:`Follow-up generation is off; agents still maintain the handoff journal`,"aria-label":`Follow-ups`,className:`flex min-h-11 w-full items-center justify-between gap-4 text-left text-foreground`,children:[(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`block text-[16px]`,children:`Follow-ups`}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs leading-[1.5] text-muted-foreground`,children:`Generate suggestions in Inbox after this task. Enabled by default; your choice is remembered.`})]}),(0,$.jsx)(`span`,{"aria-hidden":`true`,className:U(`flex h-6 w-10 shrink-0 items-center rounded-full border p-0.5`,e?`border-accent-strong bg-accent-strong`:`border-muted-foreground bg-muted`),children:(0,$.jsx)(`span`,{className:U(`size-[18px] rounded-full`,e?`ml-auto bg-accent-strong-foreground`:`bg-foreground`)})})]})}function Mm(e,t){let n=t.trim().toLowerCase();if(n===``)return[...e];let r=e=>{let t=e.name.toLowerCase(),r=e.id.toLowerCase();return t.startsWith(n)||r.startsWith(n)?0:t.includes(n)||r.includes(n)?1:2};return e.map((e,t)=>({project:e,rank:r(e),index:t})).filter(e=>e.rank<2).sort((e,t)=>e.rank-t.rank||e.index-t.index).map(e=>e.project)}function Nm({projects:e,projectId:t,onPick:n}){let[r,i]=(0,Q.useState)(!1),[a,o]=(0,Q.useState)(``),s=e.find(e=>e.id===t),c=Mm(e,a);return(0,$.jsxs)(Ea,{open:r,onOpenChange:e=>{i(e),e||o(``)},children:[(0,$.jsx)(xa,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,"data-slot":`project-pill`,"aria-label":`Project`,title:`Which project this task runs in — its skills, workflows, settings and draft`,className:U(so,`border-foreground/60 font-semibold text-foreground`),children:[(0,$.jsx)(Ue,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),(0,$.jsx)(`span`,{className:`max-w-40 truncate`,children:s?.name??t}),Ha]})}),(0,$.jsx)(wa,{align:`start`,sideOffset:8,className:`w-[300px] max-w-[calc(100vw-2rem)] p-0`,children:(0,$.jsxs)(Ua,{shouldFilter:!1,children:[(0,$.jsx)(Ga,{placeholder:`search projects…`,value:a,onValueChange:o}),(0,$.jsxs)(Qa,{"data-slot":`project-menu`,className:`max-h-[min(18rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[c.length===0?(0,$.jsx)(io,{children:`Nothing matches.`}):null,c.map(e=>(0,$.jsxs)(to,{value:e.id,keywords:[e.name],"data-slot":`project-option`,"data-project-id":e.id,disabled:e.status===`missing`,onSelect:()=>{n(e.id),i(!1)},children:[(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs font-medium`,children:e.name}),e.status===`missing`?(0,$.jsx)(`span`,{className:`shrink-0 text-[11px] text-soft-foreground`,children:`folder not found`}):e.branch===void 0?null:(0,$.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-soft-foreground`,children:e.branch}),e.id===t?(0,$.jsx)(ue,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},e.id))]}),(0,$.jsx)(`p`,{className:`border-t border-border px-3 py-2 text-[11px] leading-snug text-soft-foreground`,children:`Skills, workflows, settings and the draft re-resolve against the selected project.`})]})})]})}function Pm({source:e,ready:t,skills:n,skillUsage:r,workflows:i,onPick:a}){let[o,s]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(``),[f,p]=(0,Q.useState)(null),m=(0,Q.useRef)(null),{mostUsed:h,project:g,global:_,ranked:v}=vs(n,l,r),y=i.find(e=>e.name===Ra),b=us(i,l).filter(e=>e.name!==Ra),x=i.some(e=>e.name!==Ra),S=ls(`no skill`,`none plain ${Ra} ${y?.description??``}`,l)>0,C=!S&&(v?v.length===0:h.length===0&&g.length===0&&_.length===0)&&b.length===0,w=e=>{a(e),s(!1)},T=t=>w(e?.source===t.source&&e.ref===t.ref?null:t),E=(t,n)=>{let r=e?.source===`skill`&&e.ref===t.name;return(0,$.jsxs)(to,{value:`skill ${t.name} ${t.path}`,keywords:ds(t.name,t.description),"data-slot":`source-option`,"data-source-kind":`skill`,"data-source-ref":t.name,onSelect:()=>T({source:`skill`,ref:t.name}),children:[(0,$.jsx)(`span`,{className:U(`shrink-0 font-mono text-xs`,n&&`font-semibold`),children:t.name}),t.description?(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:t.description}):null,(0,$.jsx)(`button`,{type:`button`,"data-slot":`source-skill-view`,"aria-label":`View skill ${t.name}`,title:`View skill`,onClick:e=>{e.preventDefault(),e.stopPropagation(),p(t)},className:`ml-auto shrink-0 rounded-sm p-0.5 text-soft-foreground transition-colors hover:text-foreground`,children:(0,$.jsx)(Na,{"aria-hidden":`true`,className:`size-3.5`})}),r?(0,$.jsx)(ue,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},t.path)},D=e===null||e.source===`skill`?F:Se,O=(0,$.jsxs)(`button`,{type:`button`,"data-slot":`source-pill`,"data-source-kind":e?.source??`none`,"aria-label":`Choose a skill or workflow`,title:e===null?`No skill — the task runs as one plain agent step. Pick a skill or workflow to change that.`:`Runs the ${e.source} "${e.ref}" — pick it again, or press ✕, to run without it`,disabled:!t,onKeyDown:t=>{e===null||t.metaKey||t.ctrlKey||t.altKey||t.key!==`Backspace`&&t.key!==`Delete`||(t.preventDefault(),a(null))},className:U(so,`font-mono text-[11px]`,e===null?`text-muted-foreground`:`rounded-r-none border-r-0 border-foreground/60 pr-1.5 font-semibold text-foreground`),children:[(0,$.jsx)(D,{"aria-hidden":`true`,className:U(`size-3 shrink-0`,e===null?`text-muted-foreground`:`text-accent-icon`)}),(0,$.jsx)(`span`,{className:`max-w-44 truncate`,children:t?e?.ref??(x?`Skill or workflow`:`Skill`):`…`}),Ha]});return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)($p,{skill:f,onClose:()=>p(null)}),(0,$.jsxs)(Ea,{open:o,onOpenChange:e=>{s(e),e||u(``)},children:[(0,$.jsxs)(`span`,{className:`inline-flex items-center`,children:[(0,$.jsx)(xa,{asChild:!0,children:O}),e!==null&&t?(0,$.jsx)(`button`,{type:`button`,"data-slot":`source-pill-clear`,"aria-label":`Clear the ${e.source} ${e.ref}`,title:`Run without it`,onClick:()=>a(null),className:U(so,`rounded-l-none border-foreground/60 pl-1.5 pr-2 text-soft-foreground hover:text-foreground`),children:(0,$.jsx)(d,{"aria-hidden":`true`,className:`size-3`})}):null]}),(0,$.jsx)(wa,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,$.jsxs)(Ua,{shouldFilter:!1,children:[(0,$.jsx)(Ga,{placeholder:`search skills & workflows…`,value:l,onValueChange:u,onInput:()=>m.current?.scrollTo(0,0)}),(0,$.jsxs)(Qa,{ref:m,"data-slot":`source-menu`,className:`max-h-[min(18rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[C?(0,$.jsx)(io,{children:`Nothing matches.`}):null,S?(0,$.jsx)(Wa,{children:(0,$.jsxs)(to,{value:`none no-skill`,keywords:[`none`,`plain`,...ds(Ra)],"data-slot":`source-option`,"data-source-kind":`none`,onSelect:()=>w(null),children:[(0,$.jsx)(c,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-soft-foreground`}),(0,$.jsx)(`span`,{className:`shrink-0 text-xs font-medium`,children:`No skill`}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:y?.description??`One agent run on your task — no ceremony.`}),e===null?(0,$.jsx)(ue,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-link-foreground`}):null]})}):null,v?v.length>0?(0,$.jsx)(Wa,{children:v.map(e=>E(e,fs(e)))}):null:(0,$.jsxs)($.Fragment,{children:[h.length>0?(0,$.jsx)(Wa,{heading:`Most used`,children:h.map(e=>E(e,fs(e)))}):null,g.length>0?(0,$.jsx)(Wa,{heading:`Project skills`,children:g.map(e=>E(e,!0))}):null]}),b.length>0?(0,$.jsx)(Wa,{heading:`Workflows`,children:b.map(t=>{let n=e?.source===`workflow`&&e.ref===t.name;return(0,$.jsxs)(to,{value:`workflow ${t.name}`,keywords:ds(t.name,t.description),"data-slot":`source-option`,"data-source-kind":`workflow`,"data-source-ref":t.name,onSelect:()=>T({source:`workflow`,ref:t.name}),children:[(0,$.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:t.name}),t.description?(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:t.description}):null,n?(0,$.jsx)(ue,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-link-foreground`}):null]},t.name)})}):null,_.length>0?(0,$.jsx)(Wa,{heading:`Global`,children:_.map(e=>E(e,!1))}):null]})]})})]})]})}function Fm({repo:e}){let t=V(),n=J({mutationFn:e=>N({baseBranch:e}),onSuccess:e=>{t.invalidateQueries({queryKey:K.repo}),L(e.baseBranch?`New tasks will branch off "${e.baseBranch}" (PRs target it too).`:`Base branch cleared — new tasks fork from the checked-out branch.`)},onError:e=>L(e.message,{tone:`danger`})});return e.info?(0,$.jsx)(Ba,{searchPlaceholder:`Search branches…`,slot:`base-pill`,ariaLabel:`Base branch`,label:(0,$.jsx)(`span`,{className:`text-[11px]`,children:e.baseBranch??e.info.branch}),value:e.baseBranch??``,onPick:e=>n.mutate(e===``?null:e),options:[{value:``,label:`follow checked-out branch (${e.info.branch})`,desc:`New task worktrees fork from whatever branch is checked out`},...e.branches.map(e=>({value:e,label:e}))]}):null}function Im({planFirst:e,planning:t,onModeChange:n}){return(0,$.jsxs)(`div`,{"data-slot":`mode-seg`,role:`radiogroup`,"aria-label":`Run mode`,className:`inline-flex items-center gap-0.5 rounded-lg bg-muted p-[3px]`,children:[(0,$.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":!e,onClick:()=>n(!1),className:U(`h-6 rounded-md px-2 text-xs transition-colors`,e?`font-medium text-muted-foreground hover:text-foreground`:`bg-card font-semibold text-foreground shadow-xs`),children:[e?null:(0,$.jsx)(ue,{"aria-hidden":`true`,className:`size-3.5`}),`Start`]}),(0,$.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":e,"aria-busy":t||void 0,"data-slot":`mode-plan`,onClick:()=>n(!0),className:U(`h-6 rounded-md px-2 text-xs transition-colors`,e?`bg-contrast font-semibold text-contrast-foreground ring-2 ring-ring/55`:`font-medium text-muted-foreground hover:text-foreground`,t&&`animate-pulse`),children:t?`Planning…`:`Plan first`})]})}function Lm(){return(0,$.jsx)(`div`,{"data-route":`not-found`,className:`flex min-h-full flex-col`,children:(0,$.jsx)(G,{icon:(0,$.jsx)(Oc,{}),tone:`neutral`,title:`Page not found`,subtitle:`Nothing lives at this address. The link may be mistyped, or it points at something that is gone.`,actions:(0,$.jsx)(B,{asChild:!0,variant:`outline`,children:(0,$.jsx)(Z,{to:`/`,children:`Back to tasks`})})})})}function Rm(){return(0,$.jsx)(`div`,{className:`px-[18px] pt-2 md:hidden`,children:(0,$.jsxs)(Z,{to:`/git`,"data-slot":`git-back`,className:`inline-flex min-h-11 items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground`,children:[(0,$.jsx)(h,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`Back to Git`]})})}function zm(){let{pathname:e,search:t}=l();return(0,$.jsxs)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:[_o(e)!==`/git`||new URLSearchParams(t).get(`view`)===`repo`?(0,$.jsx)(Rm,{}):null,(0,$.jsx)(G,{icon:(0,$.jsx)(yo,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading repository…`,subtitle:`Fetching the repo's git state.`})]})}function Bm(){return(0,$.jsxs)(`div`,{"data-route":`skills`,"aria-busy":`true`,className:`mx-auto min-h-full w-full px-[18px] py-6 md:p-9`,children:[(0,$.jsx)(`h1`,{className:`text-[30px] font-semibold tracking-tight`,children:`Skills`}),(0,$.jsx)(`p`,{className:`mt-1 text-[13px] text-muted-foreground`,children:`Markdown playbooks your agents can follow.`}),(0,$.jsx)(`p`,{"data-slot":`skills-loading`,role:`status`,className:`mt-6 text-xs text-muted-foreground`,children:`Loading skills…`}),(0,$.jsxs)(`div`,{"aria-hidden":`true`,className:`mt-4 flex flex-col gap-[22px] motion-safe:animate-pulse`,children:[(0,$.jsx)(`div`,{className:`h-11 rounded-lg border border-border bg-card`}),(0,$.jsx)(`div`,{className:`h-80 rounded-xl border border-border bg-card`})]})]})}function Vm({projectId:e,registry:t}){let n=t.projects.length?t.projects:[{id:t.bootProject,name:t.bootProject}];return(0,$.jsx)(`div`,{"data-route":`unknown-project`,className:`flex min-h-full flex-col`,children:(0,$.jsx)(G,{icon:(0,$.jsx)(zc,{}),tone:`neutral`,title:`“${e}” isn’t registered here`,subtitle:`This cezar doesn’t serve a project by that id. The link may come from another machine’s workspace — these are the projects registered on this one:`,children:(0,$.jsx)(`ul`,{"data-slot":`registered-projects`,className:`mx-auto flex w-full max-w-xs flex-col gap-1.5 text-left`,children:n.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsxs)(o,{to:`/p/${encodeURIComponent(e.id)}/`,className:`flex items-baseline gap-2 rounded-md border border-border bg-card px-3 py-2 text-sm font-medium text-foreground shadow-xs transition-colors hover:bg-card-2`,children:[e.name||e.id,(0,$.jsxs)(`span`,{className:`font-mono text-[11px] font-normal text-soft-foreground`,children:[`/p/`,e.id]})]})},e.id))})})})}function Hm(){return(0,$.jsxs)(`div`,{"data-route":`workflows`,"aria-busy":`true`,className:`mx-auto min-h-full w-full px-[18px] py-6 md:p-9`,children:[(0,$.jsx)(`h1`,{className:`text-[30px] font-semibold tracking-tight`,children:`Workflows`}),(0,$.jsx)(`p`,{className:`mt-1 text-[13px] text-muted-foreground`,children:`Portable skill chains. Steps run from top to bottom.`}),(0,$.jsx)(`p`,{"data-slot":`workflows-loading`,role:`status`,className:`mt-6 text-xs text-muted-foreground`,children:`Loading workflows…`}),(0,$.jsxs)(`div`,{"aria-hidden":`true`,className:`mt-4 flex flex-col gap-[22px] motion-safe:animate-pulse`,children:[(0,$.jsx)(`div`,{className:`h-11 rounded-lg border border-border bg-card`}),(0,$.jsx)(`div`,{className:`h-80 rounded-xl border border-border bg-card`})]})]})}function Um({tab:e}){return(0,$.jsx)(`div`,{"data-route":`task-${e}`,className:`flex min-h-full flex-col`,children:(0,$.jsx)(G,{icon:(0,$.jsx)(yo,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:e===`changes`?`Loading changes…`:`Loading files…`,subtitle:`Fetching the run record.`})})}function Wm({tab:e,error:t}){let n=t instanceof E&&t.status===404;return(0,$.jsx)(`div`,{"data-route":`task-${e}`,className:`flex min-h-full flex-col`,children:(0,$.jsx)(G,{icon:n?(0,$.jsx)(Oo,{}):(0,$.jsx)(_e,{size:16}),tone:n?`neutral`:`danger`,title:n?`Task not found`:`Could not load this task`,subtitle:n?`No run has this id. It may have been deleted, or the link is from another machine.`:t.message,actions:(0,$.jsx)(B,{asChild:!0,variant:`outline`,children:(0,$.jsx)(Z,{to:`/`,children:`Back to tasks`})})})})}var Gm={issue:`issue`,pr:`pull request`};function Km({kind:e,number:t,heading:n=`h1`}){let r=(0,$.jsx)(`div`,{"data-slot":`task-github-loading`,className:`flex min-h-full flex-1 flex-col`,children:(0,$.jsx)(G,{icon:(0,$.jsx)(yo,{className:`motion-safe:animate-spin`}),tone:`neutral`,heading:n,title:`Loading ${Gm[e]}${t===void 0?``:` #${t}`}…`,subtitle:t===void 0?`Fetching the run record.`:`Asking GitHub.`})});return n===`h2`?r:(0,$.jsx)(`div`,{"data-route":`task-github-item`,className:`flex min-h-full flex-col`,children:r})}function qm(){return(0,$.jsx)(`div`,{"data-route":`task-thread`,className:`flex min-h-full flex-col`,children:(0,$.jsx)(G,{icon:(0,$.jsx)(yo,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading task…`,subtitle:`Fetching the run and its session transcript.`})})}var Jm=class extends Q.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(e,t){console.error(`cezar cockpit: the preview pane crashed`,e,t.componentStack)}render(){return this.state.failed?(0,$.jsxs)(`div`,{"data-slot":`preview-pane-error`,role:`alert`,className:`flex h-full flex-col items-center justify-center gap-3 p-6 text-center`,children:[(0,$.jsx)(`p`,{className:`text-sm font-semibold text-foreground`,children:`The preview hit an error`}),(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`The task is unaffected. Close the preview and open it again.`}),(0,$.jsx)(B,{variant:`outline`,onClick:this.props.onClose,children:`Close preview`})]}):this.props.children}},Ym=`(min-width: 1180px)`,Xm=`(max-width: 767px)`;function Zm(e,t){let[n,r]=(0,Q.useState)(()=>window.matchMedia?.(e).matches??t);return(0,Q.useEffect)(()=>{let t=window.matchMedia?.(e);if(!t)return;let n=()=>r(t.matches);return n(),t.addEventListener(`change`,n),()=>t.removeEventListener(`change`,n)},[e]),n}var Qm=(0,Q.lazy)(()=>Y(()=>import(`./preview-pane-connected-qTA5KNoJ.js`).then(e=>({default:e.ConnectedPreviewPane})),__vite__mapDeps([6,5,7,8,9,10,11,12,13,14,15,16,17,18,19,20]))),$m=`cez.preview.pane-width`,eh=58,th=30,nh=75,rh=2,ih=e=>Math.min(nh,Math.max(th,Math.round(e)));function ah(){try{let e=Number(window.localStorage.getItem($m));return e>0?ih(e):eh}catch{return eh}}function oh(e){let[t,n]=(0,Q.useState)(void 0);return(0,Q.useEffect)(()=>{let t=e.current?.closest(`[data-slot="main"]`);if(!t)return;let r=()=>n(t.clientHeight||void 0);if(r(),typeof ResizeObserver>`u`)return;let i=new ResizeObserver(r);return i.observe(t),()=>i.disconnect()},[e]),t}function sh({run:e,state:t,children:n}){let r=Zm(Ym,!0),i=Zm(Xm,!1),a=(0,Q.useRef)(null),o=oh(a),[s,c]=(0,Q.useState)(ah);(0,Q.useEffect)(()=>{try{window.localStorage.setItem($m,String(s))}catch{}},[s]);let l=t.open&&e!==void 0,u=l&&!r,d=u&&!t.session,f=u&&t.session,p=e=>{let t=a.current?.getBoundingClientRect();!t||t.width===0||c(ih((t.right-e)/t.width*100))},m=e=>{e.currentTarget.setPointerCapture?.(e.pointerId)},h=e=>{e.currentTarget.hasPointerCapture?.(e.pointerId)&&p(e.clientX)},g=e=>{if(e.key===`ArrowLeft`)c(e=>ih(e+rh));else if(e.key===`ArrowRight`)c(e=>ih(e-rh));else return;e.preventDefault()},_={"--preview-pane":`${s}%`,...o===void 0?{}:{"--preview-h":`${o}px`}};return(0,$.jsxs)(`div`,{ref:a,"data-slot":`task-split`,"data-pane":l?`open`:`closed`,"data-takeover":d?``:void 0,className:`preview-split flex min-h-full`,style:_,children:[(0,$.jsx)(`div`,{"data-slot":`task-main`,hidden:d&&i,"data-collapsed":d&&!i?``:void 0,className:`min-w-0 flex-1`,children:n}),l?(0,$.jsxs)($.Fragment,{children:[r?(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize preview`,"aria-valuemin":th,"aria-valuemax":nh,"aria-valuenow":s,tabIndex:0,"data-slot":`preview-divider`,className:`preview-divider`,onPointerDown:m,onPointerMove:h,onKeyDown:g}):null,(0,$.jsx)(`aside`,{"data-slot":`preview-pane`,"data-phone":i?``:void 0,hidden:f,className:`preview-pane`,children:(0,$.jsx)(Jm,{onClose:t.closePane,children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(`p`,{role:`status`,className:`p-6 text-sm text-muted-foreground`,children:`Opening the preview…`}),children:(0,$.jsx)(Qm,{run:e,servers:e.previewServers??[],request:t.request,onSession:d?t.showSession:void 0,onPort:t.setPort,onLive:t.setLive,onClose:t.closePane})})})})]}):null]})}function ch(){let{id:e}=D(),t=Sr(e),n=W().data?.capabilities?.preview===!0,r=po(e),i=t.data?lo(t.data):!1,a=(0,Q.useMemo)(()=>({...r,worktreeRemoved:i}),[r,i]);return n?(0,$.jsx)(mo.Provider,{value:a,children:(0,$.jsx)(sh,{run:t.data,state:r,children:(0,$.jsx)(de,{})})}):(0,$.jsx)(de,{})}var lh=qt(`inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 [&>svg]:pointer-events-none [&>svg]:size-3`,{variants:{variant:{default:`bg-accent-strong text-accent-strong-foreground [a&]:hover:bg-accent-strong/90`,secondary:`bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90`,destructive:`bg-destructive text-destructive-foreground focus-visible:ring-destructive/20 [a&]:hover:bg-destructive/90`,outline:`border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground`,ghost:`[a&]:hover:bg-accent [a&]:hover:text-accent-foreground`,link:`text-link-foreground underline-offset-4 [a&]:hover:underline`}},defaultVariants:{variant:`default`}});function uh({className:e,variant:t=`default`,asChild:n=!1,...r}){return(0,$.jsx)(n?Qe:`span`,{"data-slot":`badge`,"data-variant":t,className:U(lh({variant:t}),e),...r})}function dh({className:e,orientation:t=`horizontal`,...n}){return(0,$.jsx)(Jd,{"data-slot":`tabs`,"data-orientation":t,orientation:t,className:U(`group/tabs flex gap-2 data-[orientation=horizontal]:flex-col`,e),...n})}var fh=qt(`group/tabs-list inline-flex w-fit items-center justify-center rounded-md p-[3px] text-muted-foreground group-data-[orientation=horizontal]/tabs:h-9 group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function ph({className:e,variant:t=`default`,...n}){return(0,$.jsx)(Yd,{"data-slot":`tabs-list`,"data-variant":t,className:U(fh({variant:t}),e),...n})}function mh({className:e,...t}){return(0,$.jsx)(Xd,{"data-slot":`tabs-trigger`,className:U(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-sm border border-transparent px-3 py-1 text-[13px] font-medium whitespace-nowrap text-muted-foreground transition-all group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 group-data-[variant=default]/tabs-list:data-[state=active]:shadow-xs group-data-[variant=line]/tabs-list:data-[state=active]:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent`,`data-[state=active]:bg-card data-[state=active]:font-semibold data-[state=active]:text-foreground`,`after:absolute after:bg-accent-strong after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-[state=active]:after:opacity-100`,e),...t})}function hh({className:e,...t}){return(0,$.jsx)(Zd,{"data-slot":`tabs-content`,className:U(`flex-1 outline-none`,e),...t})}var gh={folder:Bc,terminal:ko,vscode:Ec,cursor:Qc,zed:pl,windsurf:dl,sublime:Ic,idea:Mc,pycharm:Wc,webstorm:ho,goland:cl,rubymine:Vc,phpstorm:gc,clion:jc,rider:hc,"android-studio":fo,xcode:Uc,warp:il,claude:ia,codex:ll,opencode:ia,pi:ia,omp:ia};function _h(e){return e.icon&&gh[e.icon]||Ta}function vh(e){let t=/^cli:(claude|codex|opencode|pi|cursor|omp)$/.exec(e);return t?t[1]:void 0}function yh({choices:e,onPick:t,label:n=`Open in…`,title:r,triggerVariant:i=`ghost`,disabled:a=!1,leading:o,trailing:s,slot:c}){return(0,$.jsxs)(Yo,{children:[(0,$.jsx)(Ko,{asChild:!0,children:(0,$.jsxs)(B,{variant:i,size:`sm`,title:r,disabled:a,"data-slot":c,children:[(0,$.jsx)(Ta,{"aria-hidden":`true`}),n]})}),(0,$.jsxs)(qo,{align:`end`,children:[o,o&&e.length>0?(0,$.jsx)(Uo,{}):null,e.map(({target:e,suffix:n,title:r})=>{let i=_h(e);return(0,$.jsxs)(Ho,{"data-target":e.id,title:r,onSelect:()=>t(e.id),children:[(0,$.jsx)(i,{"aria-hidden":`true`}),e.label,n??``]},e.id)}),s]})]})}function bh(e){return Oa.flatMap(t=>{let n=e.filter(e=>e.provider===t.id);return n.length<2?[{runner:t,account:null,label:t.label,desc:t.desc,missing:!1}]:n.map(e=>({runner:t,account:e.isDefault?null:e.id,label:`${t.label} · ${e.label}`,desc:e.exists?e.configDir:`${e.configDir} — folder not created yet`,missing:!e.exists}))})}var xh=e=>e.length>Oa.length;function Sh({rows:e,runner:t,accountFor:n,providerStatus:r,disabled:i=!1,accountDisabled:a=!1,onPick:o}){let s=xh(e);return(0,$.jsx)(`div`,{role:`radiogroup`,"aria-label":`Default runner`,"data-slot":`agents-runner`,className:U(`gap-0.5 rounded-md border border-border bg-card p-0.5`,s?`flex max-w-md flex-col`:`inline-flex w-fit`),children:e.map(c=>{let l=g(r.data,c.runner.id),u=!r.isPending&&!r.isError&&l?.enabled===!0&&l.status===`connected`,d=r.isPending?`Checking provider authentication…`:r.isError?`Provider authentication could not be verified.`:l?.enabled===!1?`This provider is disabled. Enable it above or choose another provider.`:u?void 0:`Connect this provider before selecting it.`,f=e.filter(e=>e.runner.id===c.runner.id).length>1,p=c.runner.id===t&&c.account===n(c.runner.id);return(0,$.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":p,"data-value":c.runner.id,"data-account":c.account??``,title:d??c.desc,disabled:i||!u||f&&a,onClick:()=>o(c.runner.id,c.account,f),className:U(`rounded-sm px-3 py-1.5 text-left font-mono text-[13px] font-medium transition-colors disabled:opacity-50`,p?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`),children:[c.label,s?(0,$.jsx)(`span`,{"data-slot":c.missing?`agents-account-missing`:`agents-account-dir`,"data-runner":c.runner.id,className:`ml-2 font-sans text-[11px] text-soft-foreground`,children:c.desc}):null]},`${c.runner.id}:${c.account??``}`)})})}function Ch({path:e,selected:t,onSelect:n,onEnter:r,decorate:i,emptyHint:a,showHidden:o=!1}){let s=Er(e,o),c=s.data?.parent??null;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{"data-slot":`fs-breadcrumb`,className:`truncate font-mono text-[11px] text-soft-foreground`,title:s.data?.path??void 0,children:s.data?.path??(s.isError?``:`Loading…`)}),s.isError?(0,$.jsx)(`p`,{"data-slot":`fs-error`,className:`min-w-0 break-words text-[13px] text-danger`,children:s.error instanceof Error?s.error.message:`could not list that folder`}):(0,$.jsxs)(`ul`,{"data-slot":`fs-listing`,className:`max-h-64 divide-y divide-border/60 overflow-y-auto overscroll-contain rounded-md border border-border`,children:[c===null?null:(0,$.jsx)(`li`,{className:`flex`,children:(0,$.jsxs)(`button`,{type:`button`,"data-slot":`fs-up`,onClick:()=>r(c),className:`flex flex-1 items-center gap-2 px-3 py-2 text-left text-[13px] hover:bg-muted`,children:[(0,$.jsx)(Ac,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),`Up one level`]})}),(s.data?.dirs??[]).map(e=>(0,$.jsxs)(`li`,{className:`flex items-stretch`,children:[(0,$.jsxs)(`button`,{type:`button`,"data-slot":`fs-dir`,"aria-pressed":t?.path===e.path,onClick:()=>n(e),onDoubleClick:()=>r(e.path),className:U(`flex min-w-0 flex-1 items-center gap-2 px-3 py-2 text-left text-[13px] hover:bg-muted`,t?.path===e.path&&`bg-muted`),children:[(0,$.jsx)(Bc,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,$.jsx)(`span`,{className:`truncate`,children:e.name}),i?.(e)]}),(0,$.jsx)(`button`,{type:`button`,"data-slot":`fs-enter`,"aria-label":`Open ${e.name}`,onClick:()=>r(e.path),className:`flex shrink-0 items-center px-2.5 text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,$.jsx)(Sc,{className:`size-3.5`,"aria-hidden":`true`})})]},e.path)),s.data&&s.data.dirs.length===0?(0,$.jsx)(`li`,{className:`px-3 py-2 text-[13px] text-muted-foreground`,children:a}):null]}),s.data?.truncated?(0,$.jsx)(`p`,{"data-slot":`fs-truncated`,className:`text-[11px] text-muted-foreground`,children:`Too many folders to list — only the first ones are shown.`}):null]})}function wh(e,t,n=!1){let r=Er(e,n);return t?.path??r.data?.path??null}function Th({open:e,onOpenChange:t,providers:n,initialProvider:r}){let[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(r??n[0]??`claude`),[u,d]=(0,Q.useState)(``),[f,p]=(0,Q.useState)(``),[m,h]=(0,Q.useState)(!1),g=Cr(),_=f.trim();return(0,$.jsx)(rs,{open:e,onOpenChange:t,children:(0,$.jsxs)(as,{"data-slot":`add-account-dialog`,className:`sm:max-w-lg`,children:[(0,$.jsxs)(is,{children:[(0,$.jsx)(os,{children:`Add agent account`}),(0,$.jsx)(ns,{children:`The config folder this account uses. It does not have to exist yet — Connect signs in and the CLI creates it.`})]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(`label`,{className:`flex items-center gap-2 text-[13px]`,children:[(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`Agent`}),(0,$.jsx)(`select`,{"aria-label":`Agent`,"data-slot":`add-account-provider`,value:c,onChange:e=>l(e.target.value),className:`rounded-md border border-input bg-card px-2 py-1 text-[13px] outline-none focus-visible:border-ring`,children:n.map(e=>(0,$.jsx)(`option`,{value:e,children:e},e))})]}),(0,$.jsxs)(`label`,{className:`flex min-w-0 flex-1 items-center gap-2 text-[13px]`,children:[(0,$.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`Name`}),(0,$.jsx)(`input`,{type:`text`,"aria-label":`Account name`,"data-slot":`add-account-label`,value:u,placeholder:`Work`,onChange:e=>d(e.target.value),className:`min-w-0 flex-1 rounded-md border border-input bg-card px-2 py-1 text-[13px] outline-none focus-visible:border-ring`})]})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,$.jsxs)(`label`,{className:`flex min-w-0 items-center gap-2 text-[13px]`,children:[(0,$.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`Folder`}),(0,$.jsx)(`input`,{type:`text`,spellCheck:!1,autoComplete:`off`,"aria-label":`Config folder`,"data-slot":`add-account-dir`,value:f,placeholder:c===`codex`?`~/.codex-second`:`~/.claude-second`,onChange:e=>{p(e.target.value),s(null),g.reset()},className:`min-w-0 flex-1 rounded-md border border-input bg-card px-2 py-1 font-mono text-[13px] outline-none focus-visible:border-ring`}),(0,$.jsx)(B,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`add-account-browse`,"aria-expanded":m,onClick:()=>h(e=>!e),children:m?`Hide folders`:`Browse…`})]}),(0,$.jsxs)(`p`,{className:`text-[11px] text-soft-foreground`,children:[`A `,(0,$.jsx)(`code`,{children:`~`}),` is kept as written and expanded when the agent runs.`]})]}),m?(0,$.jsx)(Ch,{path:i,selected:o,onSelect:e=>{s(e),p(e.path),g.reset()},onEnter:e=>{a(e),s(null),g.reset()},showHidden:!0,emptyHint:`No subfolders here — pick this folder by typing its path above.`}):null,g.isError?(0,$.jsx)(`p`,{"data-slot":`add-account-error`,className:`min-w-0 break-words text-[13px] text-danger`,children:g.error instanceof Error?g.error.message:`could not add that folder`}):null,(0,$.jsxs)(ts,{className:`min-w-0 sm:items-center sm:justify-end`,children:[(0,$.jsx)(B,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,$.jsx)(B,{"data-slot":`add-account-confirm`,disabled:_===``||g.isPending,onClick:()=>{_===``||g.isPending||g.mutate({provider:c,configDir:_,...u.trim()?{label:u.trim()}:{}},{onSuccess:()=>{t(!1),d(``),p(``),s(null),h(!1),L(`Account added — use Connect to sign in`)}})},children:g.isPending?`Adding…`:`Add account`})]})]})})}function Eh(e){let t=(0,Q.useRef)(null),n=e.rows.find(t=>t.runner.id===e.runner&&t.account===e.accountFor(t.runner.id));return(0,$.jsxs)(`details`,{ref:t,className:`settings-agent-picker`,children:[(0,$.jsxs)(`summary`,{children:[(0,$.jsx)(le,{"aria-hidden":`true`,className:`size-4 text-accent-text`}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1`,children:(n?.label??e.runner).replace(/^codex/,`Codex`).replace(/^claude/,`Claude Code`)}),(0,$.jsx)(ge,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`})]}),(0,$.jsx)(Sh,{...e,onPick:(...n)=>{e.onPick(...n),t.current&&(t.current.open=!1)}})]})}var Dh={claude:`Claude Code`,codex:`Codex`,opencode:`OpenCode`,pi:`pi`,cursor:`Cursor`,omp:`OMP`},Oh={claude:`npm i -g @anthropic-ai/claude-code`,codex:`npm i -g @openai/codex`,opencode:`https://opencode.ai`,pi:`https://github.com/badlogic/pi-mono`,cursor:`https://cursor.com/docs/cli/installation`,omp:`https://omp.sh`},kh={connected:{label:`Connected`,tone:`success`},disconnected:{label:`Not connected`,tone:`pending`},"not-installed":{label:`Not installed`,tone:`neutral`},unknown:{label:`Could not verify`,tone:`danger`}};function Ah(){let e=nr();return e.isPending?(0,$.jsx)(`p`,{"data-slot":`accounts-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agent accounts…`}):e.isError?(0,$.jsx)(G,{icon:(0,$.jsx)(Gc,{}),tone:`danger`,title:`Agent accounts did not load`,subtitle:e.error.message,heading:`h2`}):(0,$.jsx)(jh,{data:e.data})}function jh({data:e}){let t=W(),[n,r]=(0,Q.useState)(null),[i,a]=(0,Q.useState)(null),o=Zr(),s=[`claude`,`codex`,`opencode`,`pi`,`cursor`,`omp`];return e.editable?(0,$.jsxs)(`div`,{"data-slot":`accounts-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-5 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,$.jsx)(`div`,{children:(0,$.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Manage runner installations, logins and defaults for new projects.`})}),(0,$.jsxs)(dh,{defaultValue:`claude`,children:[(0,$.jsx)(ph,{variant:`line`,"data-slot":`accounts-tabs`,children:s.map(e=>(0,$.jsx)(mh,{value:e,"data-provider":e,children:Dh[e]},e))}),s.map(n=>(0,$.jsx)(hh,{value:n,className:`pt-4`,children:(0,$.jsx)(Mh,{provider:n,check:t.data?.checks?.find(e=>e.name===n),accounts:e.profiles.filter(e=>e.provider===n),canCarryAccounts:e.profileCapableProviders.includes(n),defaultAccountId:e.defaults[n]??null,onAdd:()=>r(n),onRemove:a})},n))]}),(0,$.jsx)(Nh,{profiles:e}),n===null?null:(0,$.jsx)(Th,{open:!0,onOpenChange:e=>!e&&r(null),providers:e.profileCapableProviders,initialProvider:n},n),(0,$.jsx)(zi,{open:i!==null,onOpenChange:e=>!e&&a(null),children:(0,$.jsxs)(fi,{"data-slot":`accounts-remove-confirm`,children:[(0,$.jsxs)(Ii,{children:[(0,$.jsxs)(Qr,{children:[`Remove “`,i?.label,`”?`]}),(0,$.jsxs)(qr,{children:[`This only forgets the account. Nothing in `,i?.configDir,` is deleted — not your login, not your sessions. Projects using it fall back to the default account, and tasks that ran under it can no longer be resumed from here.`]})]}),(0,$.jsxs)(Ti,{children:[(0,$.jsx)(Ni,{children:`Cancel`}),(0,$.jsx)(Si,{"data-action":`accounts-remove-confirm`,disabled:o.isPending,onClick:()=>{let e=i;e&&o.mutate(e.id,{onSuccess:()=>{a(null),L(`Removed ${e.label}`)},onError:e=>L(e.message,{tone:`danger`})})},children:`Remove`})]})]})})]}):(0,$.jsx)(`div`,{"data-slot":`accounts-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-4 p-4 md:p-6`,children:(0,$.jsx)(`p`,{"data-slot":`accounts-hosted`,className:`text-[13px] text-soft-foreground`,children:`Agent accounts are managed from the machine that owns the checkout — this cockpit runs in hosted mode.`})})}function Mh({provider:e,check:t,accounts:n,canCarryAccounts:r,defaultAccountId:i,onAdd:a,onRemove:o}){let s=t?.available===!0,c=n.filter(e=>e.isDefault).length;return(0,$.jsxs)(`div`,{"data-slot":`accounts-provider`,"data-provider":e,className:`flex flex-col gap-4`,children:[(0,$.jsx)(`h3`,{className:`settings-account-provider-title`,children:Dh[e]}),(0,$.jsxs)(`div`,{className:`settings-account-installation settings-readout`,children:[t===void 0?(0,$.jsx)(`span`,{children:`Checking…`}):s?(0,$.jsx)(`span`,{"data-slot":`agent-installed`,children:`Installed`}):(0,$.jsxs)(`span`,{"data-slot":`agent-installed`,children:[`Not installed — `,(0,$.jsx)(`code`,{children:Oh[e]})]}),s&&t?.version?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:` · `}),(0,$.jsx)(`span`,{"data-slot":`agent-version`,children:t.version})]}):null,(0,$.jsxs)(`span`,{className:`settings-account-count`,children:[n.length,` `,n.length===1?`account`:`accounts`,` (`,c,` discovered, `,n.length-c,` added)`]})]}),(0,$.jsx)(`ul`,{className:`bg-card`,children:[...n].sort((e,t)=>Number(t.id===i)-Number(e.id===i)).map(e=>(0,$.jsx)(Ph,{account:e,isMachineDefault:i===e.id||i===null&&e.isDefault,onRemove:()=>o(e)},e.id))}),r?(0,$.jsx)(`div`,{className:`settings-account-add-row`,children:(0,$.jsx)(B,{type:`button`,variant:`outline`,size:`sm`,"data-action":`accounts-add`,"data-provider":e,onClick:a,children:`Add account`})}):null,r?null:(0,$.jsxs)(`p`,{"data-slot":`accounts-single-only`,className:`text-[11px] text-soft-foreground`,children:[Dh[e],` can only hold one account here: it keeps its credentials outside its config folder, so a second folder would change settings without changing the login — which would say “work account” while billing the other one.`]})]})}function Nh({profiles:e}){let[t,n]=(0,Q.useState)(null),r=V(),i=Wr(),a=Ai(),o=ur(),s=Ir(),c=J({mutationFn:e=>M(e),onSuccess:e=>r.setQueryData(q.config,e),onError:e=>L(e.message,{tone:`danger`})});if(i.data===void 0)return null;let l=bh(e.profiles),u=i.data.agentDefaults.runner??`claude`,d=i.data.agentDefaults.models??{};return(0,$.jsxs)(`section`,{"data-slot":`accounts-defaults`,className:`flex flex-col gap-3 rounded-lg border border-border bg-card/40 p-3.5`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:`Defaults for new projects`}),(0,$.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`What a project runs when it has not chosen for itself — set once instead of per repository. A project that has chosen keeps its own.`})]}),(0,$.jsx)(Eh,{rows:l,runner:u,accountFor:t=>e.defaults[t]??null,providerStatus:a,disabled:c.isPending,accountDisabled:s.isPending,onPick:(e,t,n)=>{e!==u&&c.mutate({agentDefaults:{runner:e}}),n&&s.mutate({projectId:null,provider:e,profileId:t},{onError:e=>L(e.message,{tone:`danger`})})}}),(0,$.jsxs)(`div`,{className:`settings-account-models flex flex-col gap-2`,children:[(0,$.jsxs)(`label`,{className:`settings-model-agent-choice`,children:[(0,$.jsx)(`span`,{children:`Default model for`}),(0,$.jsx)(`select`,{"aria-label":`Model agent`,value:t??u,onChange:e=>n(e.target.value),children:Oa.map(e=>(0,$.jsx)(`option`,{value:e.id,children:Dh[e.id]},e.id))})]}),Oa.filter(e=>e.id===(t??u)).map(e=>(0,$.jsxs)(`label`,{className:`settings-account-model flex items-center gap-3`,children:[(0,$.jsx)(Ie,{className:`size-4 text-accent-icon shrink-0`}),(0,$.jsx)(`span`,{className:`w-24 shrink-0 text-xs text-muted-foreground`,children:Dh[e.id]}),(0,$.jsxs)(`select`,{"aria-label":`Default model for ${e.label}`,"data-slot":`accounts-default-model`,"data-runner":e.id,value:d[e.id]??``,disabled:c.isPending,onChange:t=>c.mutate({agentDefaults:{models:{[e.id]:t.target.value||null}}}),className:`block w-full max-w-xs rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[Ia(e.id,o[e.id].data,[d[e.id]]).map(e=>(0,$.jsx)(`option`,{value:e.id,children:e.id===``?`Native default`:e.label},e.id)),ka(e.id,o[e.id].data,o[e.id].isError,o[e.id].isFetching)?(0,$.jsx)(`option`,{disabled:!0,children:ka(e.id,o[e.id].data,o[e.id].isError,o[e.id].isFetching)}):null]})]},e.id))]})]})}function Ph({account:e,isMachineDefault:t,onRemove:n}){let[r,i]=(0,Q.useState)(!1),a=kn(e),o=_r(),s=di(),c=Xn(a,e.status===void 0),l=e.status??c.data?.status,u=l?kh[l.status]:void 0;return(0,$.jsxs)(`li`,{"data-slot":`account-row`,"data-account":e.id,className:`flex flex-col gap-2 px-3.5 py-3`,children:[(0,$.jsxs)(`div`,{className:`settings-account-card`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`text-[13px] font-medium text-foreground`,children:e.label}),e.isDefault?(0,$.jsx)(uh,{variant:`ghost`,className:`shrink-0 text-[12px] text-muted-foreground`,children:`discovered`}):null]}),t&&(0,$.jsx)(`p`,{className:`settings-account-default-note`,children:`Default account for new projects. Credentials are not displayed.`}),(0,$.jsxs)(`div`,{className:`settings-account-readout settings-readout`,children:[(0,$.jsx)(`p`,{"data-slot":`account-path`,className:`mt-0.5 truncate font-mono text-[11px] text-soft-foreground`,title:e.path,children:e.configDir}),(0,$.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-2 text-xs text-muted-foreground`,children:[(0,$.jsx)(aa,{tone:u?.tone??`neutral`,pulse:u===void 0}),(0,$.jsx)(`span`,{"data-slot":`account-status`,children:u?.label??`Checking…`}),e.exists?e.looksValid?null:(0,$.jsxs)(`span`,{"data-slot":`account-unrecognised`,children:[`— this folder does not look like `,Dh[e.provider],` config yet`]}):(0,$.jsx)(`span`,{"data-slot":`account-missing`,children:`— folder not created yet; Connect will make it`})]})]})]}),(0,$.jsxs)(`div`,{className:`settings-account-actions`,children:[l?.status===`connected`?null:(0,$.jsx)(B,{type:`button`,size:`sm`,"data-action":`account-connect`,disabled:o.isPending,onClick:()=>o.mutate({provider:e.provider,...e.isDefault?{}:{profileId:e.id}},{onSuccess:e=>L(e.opened?`Finish signing in in the terminal, then Check again.`:`This account is already connected.`),onError:e=>L(e instanceof E&&e.command?`${e.message} — run: ${e.command}`:e.message,{tone:`danger`})}),children:`Connect`}),(0,$.jsx)(B,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-recheck`,disabled:s.isPending,title:`Re-probe this account's login now, instead of waiting for the cached answer`,onClick:()=>s.mutate(a,{onError:e=>L(e.message,{tone:`danger`})}),children:`Check again`}),(0,$.jsx)(Ih,{account:e,onRemove:n}),(0,$.jsx)(B,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-details-toggle`,"aria-expanded":r,onClick:()=>i(e=>!e),children:r?`Hide details`:`Show details`})]})]}),r?(0,$.jsx)(Fh,{account:e,routeId:a}):null]})}function Fh({account:e,routeId:t}){let n=kr(t,!0),r=Gn(),i=ii().data?.targets??[],a=i.filter(e=>vh(e.id)===void 0&&e.id!==`terminal`&&e.id!==`finder`).map(e=>({target:e})),o=i.filter(e=>vh(e.id)===void 0).map(e=>({target:e})),s=(e,n,i)=>r.mutate({routeId:t,file:e,...i?{target:i}:{}},{onError:e=>L(e.message,{tone:`danger`}),onSuccess:()=>L(`Opened ${n}`)});return(0,$.jsxs)(`div`,{"data-slot":`account-details`,className:`rounded-md border border-border/60 bg-muted/30 p-3`,children:[n.isPending?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Reading account details…`}):n.isError?(0,$.jsx)(`p`,{"data-slot":`account-details-error`,className:`text-xs text-danger`,children:n.error.message}):n.data.available?(0,$.jsx)(`dl`,{"data-slot":`account-identity`,className:`grid grid-cols-[7rem_minmax(0,1fr)] gap-x-3 gap-y-1 text-xs`,children:n.data.fields.map(e=>(0,$.jsxs)(Q.Fragment,{children:[(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:e.label}),(0,$.jsx)(`dd`,{className:`min-w-0 truncate text-foreground`,title:e.value,children:e.value})]},e.label))}):(0,$.jsx)(`p`,{"data-slot":`account-identity-unavailable`,className:`text-xs text-muted-foreground`,children:n.data.reason??`No account details to show.`}),(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5 border-t border-border/60 pt-2.5`,children:[(0,$.jsx)(`span`,{className:`mr-1 text-xs text-muted-foreground`,children:`Config files`}),e.files.map(e=>(0,$.jsx)(yh,{slot:`account-open-file`,label:e.label,triggerVariant:`outline`,disabled:r.isPending,title:e.exists?e.path:`${e.path} — not created yet`,choices:a,onPick:t=>s(e.id,e.label,t),leading:(0,$.jsxs)(Ho,{"data-target":`system`,onSelect:()=>s(e.id,e.label),children:[(0,$.jsx)(Ta,{"aria-hidden":`true`}),`System default`]})},e.id)),(0,$.jsx)(yh,{slot:`account-open-folder`,label:`Folder`,disabled:r.isPending,title:e.path,choices:o,onPick:e=>s(`folder`,`folder`,e),leading:(0,$.jsxs)(Ho,{"data-target":`system`,onSelect:()=>s(`folder`,`folder`),children:[(0,$.jsx)(Ta,{"aria-hidden":`true`}),`System default`]})})]})]})}function Ih({account:e,onRemove:t}){let[n,r]=(0,Q.useState)(!1),[i,a]=(0,Q.useState)(e.label),o=fr();return(0,$.jsx)($.Fragment,{children:e.isDefault?null:(0,$.jsx)(`div`,{"data-slot":`account-manage`,className:`settings-account-management`,children:n?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`input`,{type:`text`,autoFocus:!0,"aria-label":`Name for ${e.label}`,"data-slot":`account-rename-input`,value:i,onChange:e=>a(e.target.value),className:`w-48 rounded-md border border-input bg-card px-2 py-1 text-xs outline-none focus-visible:border-ring`}),(0,$.jsx)(B,{type:`button`,size:`sm`,"data-action":`account-rename-save`,disabled:o.isPending||i.trim()===``||i.trim()===e.label,onClick:()=>o.mutate({id:e.id,label:i.trim()},{onSuccess:()=>r(!1),onError:e=>L(e.message,{tone:`danger`})}),children:`Save`}),(0,$.jsx)(B,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>{a(e.label),r(!1)},children:`Cancel`})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(B,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-rename`,onClick:()=>r(!0),children:`Rename`}),(0,$.jsx)(B,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-remove`,onClick:t,children:`Remove account`}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Renaming changes what cezar calls this account, not its folder.`})]})})})}var Lh=1500;function Rh(e,t){let n=(0,Q.useMemo)(()=>e.split(`
|
|
6
|
+
`).map(e=>[{content:e}]),[e]),r=(0,Q.useMemo)(()=>Ep(t),[t]),i=n.length>Lh,[a,o]=(0,Q.useState)(null);return(0,Q.useEffect)(()=>{if(r===null||i)return;let t=!1;return Rp(e,r).then(n=>{t||o({key:e,tokens:n.tokens})}),()=>{t=!0}},[e,r,i]),r===null||i?n:a?.key===e?a.tokens:Lp(e,r)?.tokens??n}var zh=`m-0 min-h-full w-full whitespace-pre font-mono text-xs leading-[1.7] px-3 py-2 [tab-size:2]`;function Bh({value:e,onChange:t,language:n,readOnly:r,className:i,...a}){let o=Rh(e,n),s=(0,Q.useRef)(null),c=(0,Q.useRef)(null),l=()=>{let e=c.current,t=s.current;!e||!t||(t.scrollTop=e.scrollTop,t.scrollLeft=e.scrollLeft)};return(0,Q.useLayoutEffect)(l,[e]),(0,$.jsxs)(`div`,{"data-slot":`code-editor`,className:U(`relative overflow-hidden rounded-md border border-input bg-card`,i),children:[(0,$.jsx)(`pre`,{ref:s,"aria-hidden":`true`,className:U(zh,`pointer-events-none absolute inset-0 overflow-auto text-soft-foreground`),children:o.map((e,t)=>(0,$.jsx)(`span`,{className:`block`,children:e.length===0?`
|
|
7
|
+
`:(0,$.jsxs)($.Fragment,{children:[e.map((e,t)=>(0,$.jsx)(`span`,{style:e.color===void 0?void 0:{color:e.color},children:e.content},t)),`
|
|
8
|
+
`]})},t))}),(0,$.jsx)(`textarea`,{ref:c,"data-slot":`code-editor-input`,value:e,readOnly:r,onChange:e=>t?.(e.target.value),onScroll:l,spellCheck:!1,autoCorrect:`off`,autoCapitalize:`off`,autoComplete:`off`,wrap:`off`,className:U(zh,`relative block resize-none overflow-auto bg-transparent text-transparent caret-foreground outline-none`,`selection:bg-accent-strong/30 focus-visible:ring-0`,r&&`cursor-default`),...a})]})}var Vh=`An editor-plus-commit: a saved change reaches a run after you commit it to the base branch.`;function Hh(e){return t=>t.runners.includes(e)}function Uh(e,t,n,r,i){let a=Hh(e),o=t===`mcp`?e=>a(e)&&(e.holdsMcp===!0||e.kind===`mcp`):e=>a(e)&&e.kind===t;return{id:t,label:n,note:r,...i?{empty:i}:{},files:o}}var Wh=[{id:`claude`,label:`Claude`,groups:[Uh(`claude`,`settings`,`Settings`),Uh(`claude`,`mcp`,`MCP`,`A dedicated .mcp.json (key: mcpServers), shared via version control.`),Uh(`claude`,`memory`,`Memory & instructions`)]},{id:`codex`,label:`Codex`,note:Vh,groups:[Uh(`codex`,`settings`,`Settings`),Uh(`codex`,`mcp`,`MCP`,`Inside config.toml under [mcp_servers.<id>] — the same file as Codex’s settings.`),Uh(`codex`,`memory`,`Memory & instructions`)]},{id:`opencode`,label:`OpenCode`,note:Vh,groups:[Uh(`opencode`,`settings`,`Settings`),Uh(`opencode`,`mcp`,`MCP`,`Under the "mcp" key in opencode.json — the same file as OpenCode’s settings.`),Uh(`opencode`,`memory`,`Memory & instructions`)]},{id:`pi`,label:`Pi`,note:Vh,groups:[Uh(`pi`,`settings`,`Settings`),Uh(`pi`,`mcp`,`MCP`,`Pi ships no MCP client, so it has no MCP file to edit.`,`Nothing to list: Pi’s README says "No MCP." Give Pi tools as CLI programs with a README (Pi skills), or install a Pi extension that adds MCP support and configure servers there.`),Uh(`pi`,`memory`,`Memory & instructions`)]},{id:`cursor`,label:`Cursor`,note:Vh,groups:[Uh(`cursor`,`settings`,`Settings`),Uh(`cursor`,`mcp`,`MCP`,`Cursor CLI uses the editor’s MCP configuration.`),Uh(`cursor`,`memory`,`Memory & instructions`,`Cursor also reads CLAUDE.md and .cursor/rules.`)]},{id:`omp`,label:`OMP`,note:Vh,groups:[Uh(`omp`,`settings`,`Settings`),Uh(`omp`,`mcp`,`MCP`,`A dedicated mcp.json (key: mcpServers) at ~/.omp/agent and in the project’s .omp/ folder.`),Uh(`omp`,`memory`,`Memory & instructions`)]}];function Gh(e){let t=Wh.find(t=>t.id===e);if(!t)throw Error(`no agent descriptor for ${e}`);return t}function Kh(e){return e.seeded?`Copied into each run’s worktree — takes effect on your next run.`:e.tracked===`tracked`?`Runs read the committed copy — this edit applies after you commit it.`:e.tracked===`outside-repo`?`Applies to every session on this machine.`:`Personal, git-ignored.`}function qh(){let e=qi(),t=W(),n=(0,Q.useMemo)(()=>t.data?oo(t.data.checks):Wh.map(e=>e.id),[t.data]);return e.isPending?(0,$.jsx)(`p`,{"data-slot":`agent-config-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agent config…`}):e.isError?(0,$.jsx)(G,{icon:(0,$.jsx)(Lc,{}),tone:`danger`,title:`Agent config did not load`,subtitle:e.error.message,heading:`h2`}):(0,$.jsx)(Jh,{listing:e.data,installed:n})}function Jh({listing:e,installed:t}){let[n,r]=(0,Q.useState)(`claude`),[i,a]=(0,Q.useState)(null),o=Gh(n),s=e.files.find(e=>e.id===i)??null,c=e=>{r(e),a(null)};return(0,$.jsxs)(`div`,{"data-slot":`agent-config`,className:`flex flex-col gap-5 p-4 md:p-6`,children:[(0,$.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Edit agent instructions and MCP configuration for this project.`}),!e.editable&&(0,$.jsx)(`div`,{"data-slot":`agent-config-readonly`,className:`rounded-md border border-border bg-muted/40 px-3 py-2 text-[13px] text-soft-foreground`,children:`Read-only: agent config is edited from the machine that owns the checkout (this cockpit runs in hosted mode). You can still see every file and which one wins.`}),(0,$.jsx)(`div`,{"data-slot":`agent-config-agents`,role:`tablist`,className:`flex flex-wrap gap-1`,children:Wh.map(e=>(0,$.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":e.id===o.id,"data-slot":`agent-config-agent`,"data-agent":e.id,"data-selected":e.id===o.id,onClick:()=>c(e.id),className:U(`flex min-w-11 items-center justify-center gap-2 rounded-md px-3 py-1.5 text-[13px] transition-colors`,e.id===o.id?`bg-background font-semibold shadow-sm`:`hover:bg-muted/60`),children:[e.label,!t.includes(e.id)&&(0,$.jsx)(uh,{variant:`outline`,className:`text-[12px] text-soft-foreground`,children:`not installed`})]},e.id))}),o.note&&(0,$.jsx)(`p`,{"data-slot":`agent-config-agent-note`,className:`text-[12px] text-soft-foreground`,children:o.note}),(0,$.jsxs)(`div`,{className:`grid min-w-0 gap-6 lg:grid-cols-[minmax(0,20rem)_minmax(0,1fr)]`,children:[(0,$.jsx)(`nav`,{"data-slot":`agent-config-nav`,className:`flex min-w-0 flex-col gap-5`,children:(0,$.jsx)(Yh,{agent:o,listing:e,selectedId:i,onSelect:a})}),(0,$.jsx)(`div`,{"data-slot":`agent-config-editor-pane`,className:`min-w-0`,children:s?(0,$.jsx)(Zh,{file:s},s.id):(0,$.jsx)(`div`,{className:`flex h-full min-h-40 items-center justify-center rounded-md border border-dashed border-border text-[13px] text-soft-foreground`,children:`Select a config file to view or edit it.`})})]})]})}function Yh({agent:e,listing:t,selectedId:n,onSelect:r}){return(0,$.jsx)($.Fragment,{children:e.groups.map(i=>{let a=t.files.filter(i.files),o=e.id===`claude`&&i.id===`mcp`;return a.length===0&&!(o&&t.userMcp)&&!i.empty?null:(0,$.jsxs)(`section`,{"data-slot":`agent-config-group`,"data-group":i.id,"data-agent":e.id,children:[(0,$.jsx)(`p`,{className:`mb-1 text-[11px] font-medium uppercase tracking-wide text-soft-foreground`,children:i.label}),i.note&&(0,$.jsx)(`p`,{className:`mb-2 text-[12px] text-soft-foreground`,children:i.note}),a.length===0&&i.empty&&(0,$.jsx)(`p`,{"data-slot":`agent-config-group-empty`,className:`rounded-md border border-dashed border-border px-3 py-2 text-[12px] text-soft-foreground`,children:i.empty}),(0,$.jsx)(`ul`,{className:`flex flex-col gap-1`,children:a.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{type:`button`,"data-slot":`agent-config-file`,"data-selected":e.id===n,onClick:()=>r(e.id),className:U(`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-[13px] transition-colors`,e.id===n?`bg-accent-strong/15 text-foreground`:`hover:bg-muted/60`),children:[(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[12px]`,children:e.label}),e.seeded&&(0,$.jsx)(uh,{variant:`outline`,className:`shrink-0 text-[12px]`,children:`seeded`}),!e.exists&&(0,$.jsx)(`span`,{className:`shrink-0 text-[11px] text-soft-foreground`,children:`absent`})]})},e.id))}),o&&t.userMcp&&(0,$.jsx)(Xh,{userMcp:t.userMcp})]},i.id)})})}function Xh({userMcp:e}){return(0,$.jsxs)(`div`,{"data-slot":`agent-config-user-mcp`,className:`mt-3`,children:[(0,$.jsx)(`h4`,{className:`mb-1 text-[12px] font-semibold`,children:`User & local scopes`}),(0,$.jsxs)(`p`,{className:`mb-2 text-[12px] text-soft-foreground`,children:[`Managed by `,(0,$.jsx)(`code`,{className:`font-mono`,children:`claude mcp add`}),` in `,e.path,` — cezar does not edit Claude’s state file.`]}),e.readable?e.servers.length>0?(0,$.jsx)(`ul`,{className:`flex flex-wrap gap-1`,children:e.servers.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsx)(uh,{variant:`outline`,className:`font-mono text-[11px]`,children:e})},e))}):(0,$.jsx)(`p`,{className:`text-[12px] text-soft-foreground`,children:`No user-scoped MCP servers.`}):(0,$.jsx)(`p`,{className:`text-[12px] text-soft-foreground`,children:`Could not read the file.`})]})}function Zh({file:e}){let t=jr(e.id),n=xi(e.id),[r,i]=(0,Q.useState)(null),[a,o]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)(null),l=t.data?.version??null;(0,Q.useEffect)(()=>{t.data&&(i(t.data.content),o(!1),c(null))},[t.data?.version,t.data]);let u=r??t.data?.content??``,d=t.data?u!==t.data.content:!1,f=e.writable;return(0,$.jsxs)(`div`,{"data-slot":`settings-config-editor`,className:`flex flex-col gap-3`,children:[(0,$.jsx)(`h3`,{className:`text-sm`,children:`Configuration file`}),(0,$.jsxs)(`p`,{"data-slot":`agent-config-scope`,title:e.path,className:`text-[12px] text-muted-foreground break-words`,children:[e.scope.charAt(0).toUpperCase()+e.scope.slice(1),` scope · `,e.path]}),(0,$.jsxs)(`div`,{className:`settings-readout flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.label}),(0,$.jsx)(uh,{variant:`outline`,className:`text-[12px] uppercase`,children:e.format}),(0,$.jsx)(`a`,{href:e.docsUrl,target:`_blank`,rel:`noreferrer`,className:`text-[12px] text-soft-foreground underline hover:text-foreground`,children:`docs`})]}),(0,$.jsxs)(`div`,{className:`settings-config-content-heading`,children:[(0,$.jsx)(`h3`,{children:e.kind===`mcp`||e.holdsMcp?`MCP configuration`:`File contents`}),(e.kind===`mcp`||e.holdsMcp)&&(0,$.jsx)(`p`,{children:`Review server commands before saving. MCP servers execute locally.`})]}),t.isPending?(0,$.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:`Loading file…`}):t.isError?(0,$.jsx)(`p`,{className:`text-[13px] text-destructive`,children:t.error.message}):(0,$.jsx)(Bh,{value:u,language:e.format,readOnly:!f,onChange:i,"aria-label":`${e.label} contents`,className:`h-[210px]`}),s&&(0,$.jsx)(`p`,{"data-slot":`agent-config-format-error`,className:`text-[12px] text-destructive`,children:s}),a&&(0,$.jsxs)(`div`,{"data-slot":`agent-config-conflict`,className:`flex items-center justify-between gap-2 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-[12px]`,children:[(0,$.jsx)(`span`,{children:`The file changed on disk since you opened it.`}),(0,$.jsx)(B,{size:`sm`,variant:`outline`,onClick:()=>void t.refetch(),children:`Reload from disk`})]}),f&&(0,$.jsxs)(`div`,{className:`settings-form-actions`,children:[(0,$.jsx)(B,{size:`sm`,onClick:()=>{c(null),o(!1),n.mutate({content:u,version:l},{onSuccess:()=>{i(null),L(`${e.exists?`Saved`:`Created`} ${e.label}`)},onError:e=>{e instanceof E&&e.status===409?o(!0):e instanceof E&&e.status===400?c(e.message):L(e.message,{tone:`danger`})}})},disabled:!d||n.isPending,children:e.exists?`Save file`:`Create file`}),(0,$.jsx)(B,{size:`sm`,variant:`outline`,onClick:()=>i(null),disabled:!d||n.isPending,children:`Reset`}),d&&(0,$.jsx)(`span`,{className:`text-[12px] text-soft-foreground`,children:`Unsaved changes`})]}),(0,$.jsxs)(`div`,{className:`settings-config-save-help`,children:[(0,$.jsx)(`p`,{"data-slot":`agent-config-precedence`,className:`text-[12px] text-soft-foreground`,children:e.precedence}),(0,$.jsxs)(`p`,{"data-slot":`agent-config-effect`,className:`text-[12px] text-foreground/80`,children:[Kh(e),e.hotReload?` ${e.hotReload}`:``]}),e.readOnlyReason&&(0,$.jsx)(`p`,{children:e.readOnlyReason})]})]})}function Qh({className:e,size:t=`default`,...n}){return(0,$.jsx)(Ed,{"data-slot":`switch`,"data-size":t,className:U(`peer group/switch inline-flex shrink-0 items-center rounded-full border border-transparent shadow-none transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-6 data-[size=default]:w-10 data-[size=sm]:h-3.5 data-[size=sm]:w-6 data-[state=checked]:bg-accent-strong data-[state=unchecked]:bg-input`,e),...n,children:(0,$.jsx)(Od,{"data-slot":`switch-thumb`,className:U(`pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-[18px] group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-[state=checked]:translate-x-5 group-data-[size=default]/switch:data-[state=unchecked]:translate-x-0.5 group-data-[size=sm]/switch:data-[state=checked]:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-[state=unchecked]:translate-x-0`)})})}var $h=[{id:`claude`,label:`Claude Code`,login:`claude auth login`},{id:`codex`,label:`Codex`,login:`codex login`},{id:`opencode`,label:`OpenCode`,login:`opencode auth login`},{id:`pi`,label:`pi`,login:`pi /login`},{id:`cursor`,label:`Cursor`,login:`agent login`},{id:`omp`,label:`OMP`,login:`omp login`}],eg=e=>({claude:e,codex:e,opencode:e,pi:e,cursor:e,omp:e}),tg={connected:{label:`Credentials found`,tone:`success`},disconnected:{label:`Not connected`,tone:`pending`},"not-installed":{label:`Not installed`,tone:`neutral`},unknown:{label:`Could not verify`,tone:`danger`}};function ng(e,t,n){return{providers:e.providers.map(e=>e.provider===t?{...e,enabled:n}:e)}}function rg(){let e=Ai(),t=Ki(),n=tr(),r=V(),[i,a]=(0,Q.useState)(null),o=(0,Q.useRef)(Promise.resolve()),s=(0,Q.useRef)(eg(0)),c=(0,Q.useRef)(eg(0)),l=(0,Q.useRef)(e.data);(0,Q.useEffect)(()=>{i&&g(e.data,i.provider)?.status===`connected`&&a(null)},[i,e.data]),(0,Q.useEffect)(()=>{if(e.data){if(Object.values(c.current).every(e=>e===0)||!l.current){l.current=e.data;return}l.current={providers:e.data.providers.map(e=>({...e,enabled:c.current[e.provider]>0?g(l.current,e.provider)?.enabled??e.enabled:e.enabled}))}}},[e.data]);let u=(0,Q.useCallback)((e,t)=>{let n=q.providerStatus,i=r.getQueryData(n);if(!i)return;l.current||=i;let a=ng(i,e,t);c.current[e]+=1,r.setQueryData(n,a);let u=++s.current[e];o.current=o.current.then(async()=>{try{let i=await ht(e,t),a=g(i,e)?.enabled;if(a===void 0)return;if(l.current=ng(l.current??i,e,a),u===s.current[e]){let t=r.getQueryData(n);r.setQueryData(n,t?ng(t,e,a):i)}}catch(t){if(u===s.current[e]){let i=g(l.current,e)?.enabled,a=r.getQueryData(n);a&&i!==void 0?r.setQueryData(n,ng(a,e,i)):l.current?r.setQueryData(n,l.current):r.removeQueries({queryKey:n,exact:!0}),L(t instanceof Error?t.message:String(t),{tone:`danger`})}}finally{--c.current[e]}})},[r]),d=J({mutationFn:e=>Bt(e),onSuccess:async(e,t)=>{a(null),L(e.opened?`Finish signing in in the terminal, then check again.`:`Provider is already connected.`),await r.invalidateQueries({queryKey:q.providerStatus}),xn(t)&&await $i(r,t,`none`)},onError:(e,t)=>{if(e instanceof E&&e.command){let n=$h.find(e=>e.id===t)?.label??t;a({provider:t,label:n,message:e.message,command:e.command});return}L(e.message,{tone:`danger`})}}),f=async e=>{try{await navigator.clipboard.writeText(e),L(`Command copied`)}catch{L(`Could not copy the command`,{tone:`danger`})}};return(0,$.jsxs)(`section`,{id:`providers`,"data-slot":`provider-settings`,className:`scroll-mt-20`,children:[(0,$.jsxs)(`div`,{className:`mb-2`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Providers`}),(0,$.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Connect the coding agents available on this computer.`})]}),e.isError?(0,$.jsxs)(`div`,{role:`alert`,className:`mb-3 flex flex-wrap items-center justify-between gap-2 rounded-md border border-danger/30 bg-danger/5 px-3 py-2.5`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`text-[13px] font-medium text-foreground`,children:`Provider status could not be loaded`}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.error.message})]}),(0,$.jsx)(B,{type:`button`,variant:`outline`,size:`sm`,disabled:e.isFetching,onClick:()=>void e.refetch(),children:`Retry`})]}):null,(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:$h.map(r=>{let a=g(e.data,r.id),o=a?.status,s=o?tg[o]:e.isPending?{label:`Checking…`,tone:`neutral`}:tg.unknown,c=d.isPending&&d.variables===r.id,l=o===`disconnected`||o===`unknown`,p=a?.authFailureId;return(0,$.jsxs)(Q.Fragment,{children:[(0,$.jsxs)(`div`,{"data-slot":`provider-card`,"data-provider":r.id,className:`rounded-md border border-border bg-card px-3.5 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:r.label}),(0,$.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,$.jsx)(aa,{tone:s.tone,pulse:e.isPending}),(0,$.jsx)(`span`,{children:s.label}),a?.enabled===!1?(0,$.jsx)(`span`,{children:`Disabled`}):null]}),o===`not-installed`?(0,$.jsxs)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:[`Install `,r.label,`, then run `,(0,$.jsx)(`code`,{children:r.login}),`.`]}):o===`unknown`||e.isError&&!o?(0,$.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:`Verification failed. Check again when the provider is available.`}):a?.hint?(0,$.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:a.hint}):null]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[o===`not-installed`?null:(0,$.jsx)(Qh,{checked:a?.enabled??!0,"aria-label":`Use ${r.label}`,onCheckedChange:e=>u(r.id,e)}),l?(0,$.jsx)(B,{type:`button`,variant:`ghost`,size:`sm`,disabled:t.isPending,onClick:()=>t.mutate(void 0,{onError:e=>L(e.message,{tone:`danger`})}),children:`Check again`}):null,o===`disconnected`?(0,$.jsx)(B,{type:`button`,variant:`outline`,size:`sm`,disabled:d.isPending,onClick:()=>d.mutate(r.id),children:c?`Opening…`:`Connect`}):null,p===void 0?null:(0,$.jsx)(B,{type:`button`,variant:`outline`,size:`sm`,disabled:n.isPending,onClick:()=>n.mutate({provider:r.id,authFailureId:p},{onSuccess:()=>L(`${r.label} can be tried again.`),onError:e=>L(e.message,{tone:`danger`})}),children:`Try again`})]})]}),p===void 0?null:(0,$.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`Use this after completing the provider sign-in flow. cezar cannot validate the credential without a task/model request; it will verify it on the next task.`})]}),i?.provider===r.id&&o!==`connected`?(0,$.jsxs)(`div`,{role:`region`,"aria-label":`${i.label} manual sign-in`,className:`rounded-md border border-pending/40 bg-pending/5 px-3.5 py-3`,children:[(0,$.jsx)(`p`,{className:`text-[13px] text-foreground`,children:i.message}),(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`code`,{className:`min-w-0 flex-1 overflow-x-auto rounded-sm bg-muted px-2 py-1.5 text-xs`,children:i.command}),(0,$.jsx)(B,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void f(i.command),children:`Copy command`})]})]}):null]},r.id)})})]})}var ig=2e4;function ag(){let e=mi(),t=ur(),n=Ai();return e.isPending?(0,$.jsx)(`p`,{"data-slot":`agents-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agent settings…`}):e.isError?(0,$.jsx)(G,{icon:(0,$.jsx)(oe,{}),tone:`danger`,title:`Agent settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,$.jsx)(og,{config:e.data,catalogs:t,providerStatus:n})}function og({config:e,catalogs:t,providerStatus:n}){let r=Qn(),i=V(),a=J({mutationFn:e=>N(e),onSuccess:e=>{i.setQueryData(K.config,e),i.invalidateQueries({queryKey:K.health}),i.invalidateQueries({queryKey:K.repo})},onError:e=>L(e.message,{tone:`danger`})}),[o,s]=(0,Q.useState)(e.systemPrompt??``),c=o.trim(),l=c===(e.systemPrompt??``),u=c.length>ig;return(0,$.jsxs)(`div`,{"data-slot":`agents-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,$.jsx)(sg,{defaultRunner:e.defaultRunner,providerStatus:n,saving:a.isPending,onPick:e=>a.mutate({defaultRunner:e})}),(0,$.jsx)(cg,{title:`Default model`,hint:e.modelsLocked?`Models are locked to the defaults configured in the native coding-agent settings.`:`The model preselected in the composer for each runner. Auto lets the runner decide per task.`,children:(0,$.jsx)(`div`,{className:`flex flex-col gap-4`,children:Oa.map(r=>{let i=g(n.data,r.id),o=!n.isPending&&!n.isError&&i?.enabled===!0&&i.status===`connected`,s=n.isPending?`Checking provider authentication…`:n.isError?`Provider authentication could not be verified.`:i?.enabled===!1?`This provider is disabled. Enable it above or choose another provider.`:o?void 0:`Connect this provider before selecting it.`,c=t[r.id],l=ka(r.id,c.data,c.isError,c.isFetching),u=Ia(r.id,c.data,[e.defaultModels[r.id]]),d=e.defaultModels[r.id]??``,f=u.find(e=>e.id===d)?.label??d??`auto (default)`;return(0,$.jsxs)(`label`,{className:`settings-option-row`,children:[(0,$.jsx)(`div`,{children:(0,$.jsx)(`h3`,{children:r.label})}),e.modelsLocked?(0,$.jsx)(`output`,{"aria-label":`Default model for ${r.label}`,"data-slot":`agents-model`,"data-runner":r.id,title:`Model selection is locked to native coding-agent settings.`,className:`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs`,children:f}):(0,$.jsxs)(`select`,{"aria-label":`Default model for ${r.label}`,"data-slot":`agents-model`,"data-runner":r.id,value:d,title:s??r.desc,disabled:a.isPending||!o,onChange:e=>a.mutate({defaultModels:{[r.id]:e.target.value||null}}),className:`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[u.map(e=>(0,$.jsx)(`option`,{value:e.id,children:e.id===``?`Native agent default`:e.label},e.id)),l?(0,$.jsx)(`option`,{disabled:!0,children:l}):null]})]},r.id)})})}),(0,$.jsxs)(cg,{title:`System prompt`,hint:`Extra instructions for every run in this project.`,children:[(0,$.jsx)(ss,{"aria-label":`System prompt`,"data-slot":`agents-system-prompt`,value:o,onChange:e=>s(e.target.value),placeholder:`Extra rules for every agent run — conventions, tone, review requirements…`,className:`min-h-48 w-full`}),(0,$.jsxs)(`div`,{className:`settings-form-actions`,children:[(0,$.jsx)(B,{type:`button`,variant:`primary`,size:`sm`,"data-action":`agents-save-prompt`,disabled:l||u||a.isPending,onClick:()=>a.mutate({systemPrompt:c===``?null:c},{onSuccess:()=>L(c===``?`System prompt cleared`:`System prompt saved`)}),children:`Save prompt`}),u?(0,$.jsxs)(`p`,{"data-slot":`agents-prompt-limit`,className:`text-[11px] text-danger`,children:[c.length.toLocaleString(),` characters — the limit is`,` `,ig.toLocaleString(),`.`]}):(0,$.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Leave empty and save to clear. Applied to new runs only.`})]})]}),(0,$.jsxs)(`section`,{"data-slot":`agents-task-runs`,className:`settings-field flex flex-col gap-5`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Task runs`}),(0,$.jsx)(lg,{title:`Live title updates`,hint:`Refresh a task's short title through the namer model as the run progresses. A manual rename always wins and stops updates for that task.`,children:(0,$.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,$.jsx)(Qh,{"aria-label":`Live title updates`,"data-slot":`agents-live-title-updates`,checked:e.liveTitleUpdates??!0,disabled:a.isPending,onCheckedChange:e=>a.mutate({liveTitleUpdates:e},{onSuccess:()=>L(e?`Live title updates on`:`Live title updates off`)})}),(0,$.jsxs)(`span`,{className:`text-[13px] text-muted-foreground`,children:[e.liveTitleUpdates??!0?`On`:`Off`,e.liveTitleUpdates===null&&` (default)`]})]})}),(0,$.jsx)(lg,{title:`Review changes before finishing`,hint:`When on, a task with changes pauses so you can Accept, Send back, or open a Draft PR. Autonomous tasks always skip this and finish on their own. Default: off — tasks finish without asking.`,children:(0,$.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,$.jsx)(Qh,{"aria-label":`Review changes before finishing`,"data-slot":`agents-review-gate`,checked:e.reviewGate??!1,disabled:a.isPending,onCheckedChange:e=>a.mutate({reviewGate:e},{onSuccess:()=>L(e?`Review gate on`:`Review gate off`)})}),(0,$.jsxs)(`span`,{className:`text-[13px] text-muted-foreground`,children:[e.reviewGate??!1?`On`:`Off`,e.reviewGate===null&&` (default)`]})]})}),(0,$.jsx)(lg,{title:`Base branch`,hint:`New task worktrees branch from this and draft PRs target it. Also settable from the Git view.`,children:r.data?.info?(0,$.jsxs)(`select`,{"aria-label":`Base branch`,"data-slot":`agents-base-branch`,value:e.baseBranch??``,disabled:a.isPending,onChange:e=>a.mutate({baseBranch:e.target.value||null}),className:`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[(0,$.jsx)(`option`,{value:``,children:`follow checked-out branch (default)`}),r.data.branches.map(e=>(0,$.jsx)(`option`,{value:e,children:e},e))]}):(0,$.jsx)(`p`,{"data-slot":`agents-base-branch-unavailable`,className:`text-[13px] text-soft-foreground`,children:r.isPending?`Loading branches…`:`Not a git repository — tasks run in place, no branching.`})})]}),(0,$.jsxs)(`details`,{className:`settings-disclosure`,children:[(0,$.jsx)(`summary`,{children:`Provider connections`}),(0,$.jsx)(rg,{})]})]})}function sg({defaultRunner:e,providerStatus:t,saving:n,onPick:r}){let i=nr(),a=oi(),o=Le(),s=Qn(),c=Ir(),l=o.projectId??`default`,u=s.data?.info?.root,d=u?i.data?.selections[u]:void 0,f=i.data?.defaults,p=bh(i.data?.profiles??[]),m=xh(p);return(0,$.jsxs)(cg,{title:`Default runner`,hint:`Project defaults. A task can override these choices.`,children:[(0,$.jsx)(Eh,{rows:p,runner:e,accountFor:e=>d?.[e]??f?.[e]??null,providerStatus:t,disabled:n,accountDisabled:c.isPending||a.data===void 0,onPick:(t,n,i)=>{t!==e&&r(t),i&&c.mutate({projectId:l,provider:t,profileId:n},{onError:e=>L(e.message,{tone:`danger`})})}}),!t.isPending&&!t.isError&&g(t.data,e)?.enabled===!1?(0,$.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`This provider is disabled. Enable it above or choose another provider.`}):null,m?(0,$.jsx)(`p`,{className:`max-w-md text-[13px] text-muted-foreground`,children:`The account is personal and never committed. Tasks already started under another account can’t be resumed here — their sessions live in that account’s folder.`}):null]})}function cg({title:e,hint:t,children:n}){return(0,$.jsxs)(`section`,{className:`settings-field flex flex-col gap-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,$.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}function lg({title:e,hint:t,children:n}){return(0,$.jsxs)(`section`,{className:`settings-option-row`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{children:e}),(0,$.jsx)(`p`,{children:t})]}),n]})}var ug=`cez-accent`,dg=`cez-density`,fg=`cez-width`,pg=`cezarion`,mg=`comfortable`,hg=`narrow`;function gg(e){return pg}function _g(e){return e===`comfortable`||e===`compact`||e===`ultra`?e:mg}function vg(e){return e===`narrow`||e===`wide`?e:hg}function yg(e){let t=e&&typeof e==`object`?e:{};return{accent:gg(t.accent),density:_g(t.density),width:vg(t.width)}}function bg(){try{return{accent:gg(localStorage.getItem(ug)),density:_g(localStorage.getItem(dg)),width:vg(localStorage.getItem(fg))}}catch{return{accent:pg,density:mg,width:hg}}}function xg(e){try{localStorage.setItem(ug,e.accent),localStorage.setItem(dg,e.density),localStorage.setItem(fg,e.width)}catch{}}function Sg(e,t){t.accent===`cezarion`?delete e.dataset.accent:e.dataset.accent=t.accent,t.density===`comfortable`?delete e.dataset.density:e.dataset.density=t.density,t.width===`narrow`?delete e.dataset.width:e.dataset.width=t.width}var Cg=Q.createContext(null);function wg({children:e}){let t=V(),n=Tr(),[r,i]=Q.useState(bg),a=n.data;Q.useEffect(()=>{if(a===void 0)return;let e=yg(a.appearance);i(e),xg(e)},[a]),Q.useLayoutEffect(()=>{Sg(document.documentElement,r)},[r]);let o=Q.useCallback(e=>{i(e),xg(e),Ve({appearance:e}).then(e=>t.setQueryData(q.uiState,e)).catch(e=>{L(e instanceof Error?e.message:String(e),{tone:`danger`}),t.invalidateQueries({queryKey:q.uiState})})},[t]),s=Q.useCallback(e=>o({...r,accent:e}),[o,r]),c=Q.useCallback(e=>o({...r,density:e}),[o,r]),l=Q.useCallback(e=>o({...r,width:e}),[o,r]),u=Q.useMemo(()=>({accent:r.accent,density:r.density,width:r.width,setAccent:s,setDensity:c,setWidth:l}),[r,s,c,l]);return(0,$.jsx)(Cg.Provider,{value:u,children:e})}function Tg(){let e=Q.useContext(Cg);if(!e)throw Error(`cezar: useAppearance() must be called inside <AppearanceProvider>`);return e}var Eg=`cez-theme`,Dg=`(prefers-color-scheme: light)`,Og=`dark`;function kg(e){return e===`light`||e===`dark`||e===`system`?e:Og}function Ag(e,t){return e===`light`||e===`system`&&t?`light`:`dark`}function jg(){try{return kg(localStorage.getItem(Eg))}catch{return Og}}function Mg(e){try{localStorage.setItem(Eg,e)}catch{}}function Ng(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(Dg).matches}function Pg(e,t){e.classList.toggle(`light`,t===`light`),e.style.colorScheme=t}function Fg(e){return`/cezarion-mark-${e}.svg`}function Ig(e){let t=document.querySelector(`link[rel="icon"]`);t&&(t.href=Fg(e))}var Lg=Q.createContext(null);function Rg({children:e}){let[t,n]=Q.useState(jg),[r,i]=Q.useState(Ng);Q.useEffect(()=>{let e=window.matchMedia?.(Dg);if(!e)return;i(e.matches);let t=e=>i(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let a=Ag(t,r);Q.useLayoutEffect(()=>{Pg(document.documentElement,a),Ig(a)},[a]);let o=Q.useCallback(e=>{n(e),Mg(e)},[]),s=Q.useMemo(()=>({theme:t,resolvedTheme:a,setTheme:o}),[t,a,o]);return(0,$.jsx)(Lg.Provider,{value:s,children:e})}function zg(){let e=Q.useContext(Lg);if(!e)throw Error(`cezar: useTheme() must be called inside <ThemeProvider>`);return e}var Bg=[{value:`system`,label:`System`,icon:Xc},{value:`light`,label:`Light`,icon:ul},{value:`dark`,label:`Dark`,icon:Zc}],Vg=[{value:`cezarion`,label:`Cezarion`,swatch:`var(--accent-strong)`}],Hg=[{value:`comfortable`,label:`Comfortable`},{value:`compact`,label:`Compact`},{value:`ultra`,label:`Compact for real`}],Ug=[{value:`narrow`,label:`Narrow`},{value:`wide`,label:`Wide`}];function Wg({slot:e,label:t,value:n,options:r,onChange:i}){return(0,$.jsx)(`div`,{role:`radiogroup`,"aria-label":t,"data-slot":e,className:`inline-flex w-fit gap-0.5 rounded-md border border-border bg-card p-0.5 max-md:max-w-full max-md:flex-wrap`,children:r.map(e=>{let t=e.value===n;return(0,$.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":t,"data-value":e.value,onClick:()=>i(e.value),className:U(`flex min-h-11 items-center gap-2 rounded-sm px-3 py-1.5 text-[13px] font-medium transition-colors`,t?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`),children:[e.icon?(0,$.jsx)(e.icon,{"aria-hidden":`true`,className:`size-3.5`}):null,e.swatch?(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`size-3 rounded-full border border-border`,style:{background:e.swatch}}):null,e.label]},e.value)})})}function Gg({title:e,hint:t,children:n}){return(0,$.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,$.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}function Kg(){let{theme:e,setTheme:t}=zg(),{accent:n,density:r,width:i,setAccent:a,setDensity:o,setWidth:s}=Tg();return(0,$.jsxs)(`div`,{"data-slot":`appearance-section`,className:`flex w-full flex-col gap-7 rounded-lg border border-border bg-card p-5`,children:[(0,$.jsx)(Gg,{title:`Theme`,hint:`System follows your OS preference. Applies to this browser.`,children:(0,$.jsx)(Wg,{slot:`appearance-theme`,label:`Theme`,value:e,options:Bg,onChange:t})}),Vg.length>1?(0,$.jsx)(Gg,{title:`Accent`,hint:`The cockpit brand accent. Saved with your workspace appearance.`,children:(0,$.jsx)(Wg,{slot:`appearance-accent`,label:`Accent`,value:n,options:Vg,onChange:a})}):null,(0,$.jsx)(Gg,{title:`Density`,hint:`Compact tightens spacing across the cockpit — text stays the same size.`,children:(0,$.jsx)(Wg,{slot:`appearance-density`,label:`Density`,value:r,options:Hg,onChange:o})}),(0,$.jsx)(Gg,{title:`Reading width`,hint:`Wide lets a task's session and commits use more of the screen. Narrow keeps a comfortable reading column. The Changes tab is always full-width.`,children:(0,$.jsx)(Wg,{slot:`appearance-width`,label:`Reading width`,value:i,options:Ug,onChange:s})}),(0,$.jsxs)(`div`,{className:`settings-appearance-preview settings-readout`,children:[(0,$.jsx)(`span`,{className:`text-[12px] text-soft-foreground`,children:`PREVIEW`}),(0,$.jsx)(`p`,{className:`mt-3 text-base`,children:`Review finalization retries`}),(0,$.jsxs)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:[`Needs you · cezar · Task `,`#`,`227`]}),(0,$.jsx)(`span`,{className:`mt-3 inline-flex rounded-md border border-accent-strong/30 bg-accent-strong/10 px-4 py-3 text-xs text-accent-text`,children:`Open task`})]}),(0,$.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:`Changes apply immediately. Theme is browser-local; density and reading width are saved with your workspace.`})]})}var qg=`http://localhost:4321`;function Jg(e,t,n,r=qg,i=null){let a=e=>encodeURIComponent(e).replaceAll(`'`,`%27`),o=`(()=>{const m=location.href.match(/^https:\\/\\/github\\.com\\/([^\\/]+)\\/([^\\/]+)\\/(pull|issues)\\/\\d+/);if(!m){alert('Open a GitHub PR or issue first');return;}const q='${`${e?`skill=${a(e)}&`:``}auto=${t?`1`:`0`}&key=${a(n)}&ref=`}'+encodeURIComponent(location.href);open('${r.replaceAll(`'`,`%27`)}${i===null||i===``?`/new`:`/p/${a(i)}/new`}?'+q,'_blank');})();`;return`javascript:${encodeURIComponent(o)}`}function Yg(){let e=Pr();return e.isPending?(0,$.jsx)(`p`,{"data-slot":`bookmarklets-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading bookmarklets…`}):e.isError?(0,$.jsx)(G,{icon:(0,$.jsx)(_e,{}),tone:`danger`,heading:`h2`,title:`Could not load bookmarklets`,subtitle:e.error.message}):(0,$.jsx)(`div`,{className:`flex min-h-full flex-1 overflow-y-auto`,children:(0,$.jsx)(Xg,{skills:ms(e.data??[])})})}function Xg({skills:e}){let t=Hr(),n=W(),r=oi(),[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(``),c=t.data?.key??``,l=window.location.origin,u=xo()??n.data?.bootProject??null,d=r.data?.projects.find(e=>e.id===u)?.name??RD(n.data)?.name??null,f=o.trim().toLowerCase(),p=e.filter(e=>e.name.toLowerCase().includes(f));return(0,$.jsxs)(`div`,{"data-slot":`bookmarklet-panel`,className:`flex w-full min-w-0 flex-col gap-[18px] p-5`,children:[(0,$.jsx)(`h2`,{className:`text-xl font-semibold`,children:`Run from GitHub`}),(0,$.jsxs)(`p`,{className:`text-[13px] leading-relaxed text-muted-foreground`,children:[`Drag a launcher to your browser's bookmarks bar. Then open a GitHub PR or issue and click that bookmark. Cezar must be running: `,(0,$.jsx)(`span`,{className:`font-mono`,children:`npx cezarion`}),`.`]}),(0,$.jsxs)(`div`,{className:`settings-bookmarklet-project rounded-lg bg-background p-3.5`,children:[(0,$.jsxs)(`p`,{className:`text-[13px]`,children:[`Project`,d?` · ${d}`:``]}),(0,$.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`Launchers target this cockpit and this project. Keep Cezarion running.`})]}),(0,$.jsxs)(`label`,{className:`flex min-h-11 items-center gap-2.5 text-[13px] font-medium`,children:[(0,$.jsx)(`input`,{type:`checkbox`,"data-slot":`bm-auto`,checked:i,onChange:e=>a(e.target.checked),className:`size-[18px] shrink-0`}),`One-click launch (auto-submit)`]}),(0,$.jsx)(`p`,{className:`text-xs leading-relaxed text-soft-foreground`,children:`Off by default. Re-drag the launchers after changing this option.`}),(0,$.jsx)(`div`,{"data-slot":`bm-generic`,className:`rounded-lg border border-border bg-muted/30 p-3.5`,children:(0,$.jsx)(Zg,{label:d?`cezar (${d}): this PR/issue`:`cezar: this PR/issue`,url:Jg(``,!1,c,l,u),generic:!0,hint:`Prefills the form only—never auto-starts, even when auto-submit is on.`})}),(0,$.jsx)(wm,{"data-slot":`bm-filter`,placeholder:`Filter bookmarklet skills…`,"aria-label":`Filter bookmarklet skills`,value:o,onChange:e=>s(e.target.value),className:`h-11 text-[13px]`}),(0,$.jsx)(`div`,{"data-slot":`bm-list`,className:`flex flex-col divide-y divide-border [&>[data-slot=bm-row]]:py-3.5`,children:p.length>0?p.map(e=>(0,$.jsx)(Zg,{label:d?`/${e.name} (${d})`:`/${e.name}`,url:Jg(e.name,i,c,l,u)},e.path)):(0,$.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:e.length>0?`(no skills match)`:`(no skills yet — the generic launcher above still works)`})}),(0,$.jsx)(`p`,{className:`text-xs leading-relaxed text-soft-foreground`,children:`These are bookmarklet drag sources, not run buttons. Clicking one here explains installation; it does not start a task.`}),(0,$.jsx)(`p`,{className:`text-xs leading-relaxed text-soft-foreground md:hidden`,children:`No drag-and-drop? Copy the URL for manual bookmark setup where your browser allows it, or install using a desktop browser.`})]})}function Zg({label:e,url:t,hint:n,generic:r=!1}){let i=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{i.current?.setAttribute(`href`,t)},[t]);let a=async()=>{try{await navigator.clipboard.writeText(t),L(`Bookmarklet URL copied.`)}catch{L(`Copy failed — drag the button instead.`,{tone:`danger`})}};return(0,$.jsxs)(`div`,{"data-slot":`bm-row`,className:`flex min-w-0 flex-col gap-2.5`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`a`,{ref:i,draggable:!0,"data-slot":`bm-link`,title:`Drag me to your bookmarks bar`,"aria-label":`${r?`Drag to bookmarks`:`Drag launcher`}: ${e}`,onClick:e=>{e.preventDefault(),L(`Drag me to your bookmarks bar`)},className:`inline-flex min-h-11 min-w-0 items-center rounded-md border border-border px-3 text-xs font-medium transition-colors hover:bg-muted ${r?`bg-accent-strong/10 text-accent-text`:`bg-card text-foreground`}`,children:(0,$.jsx)(`span`,{className:`break-words`,children:e})}),(0,$.jsx)(`button`,{type:`button`,"data-slot":`bm-copy`,title:`Copy the bookmarklet URL`,onClick:()=>void a(),className:`min-h-11 shrink-0 rounded-md border border-border px-3 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:`Copy URL`})]}),n?(0,$.jsx)(`p`,{className:`text-xs leading-relaxed text-soft-foreground`,children:n}):null]})}function Qg(e){return{enabled:(e&&typeof e==`object`?e:{}).enabled===!0}}function $g(){let e=globalThis.Notification;if(typeof e!=`function`)return`unsupported`;let t=e.permission;return t===`granted`||t===`denied`?t:`default`}function e_(e,t){let n=new Map,r=[];for(let i of t??[]){let t={status:i.status,wantsAttention:sr(i)};n.set(i.id,t);let a=e.get(i.id);a!==void 0&&(a.status===t.status&&a.wantsAttention===t.wantsAttention||t.wantsAttention&&r.push(i))}return{entering:r,statuses:n}}function t_(e){return e.enabled&&e.hidden&&e.permission===`granted`}function n_(e){let t=Br(e).label;return{title:e.titleSummary??e.title,body:`Task ${t}`,tag:`cezar-run-${e.id}`}}function r_(){let e=V(),t=Tr(),[n,r]=Q.useState(!1),[i,a]=Q.useState($g),o=t.data;Q.useEffect(()=>{o!==void 0&&r(Qg(o.notifications).enabled)},[o]);let s=Q.useCallback(t=>{r(t),Ve({notifications:{enabled:t}}).then(t=>e.setQueryData(q.uiState,t)).catch(t=>{L(t instanceof Error?t.message:String(t),{tone:`danger`}),e.invalidateQueries({queryKey:q.uiState})})},[e]),c=Q.useCallback(e=>{if(!e){s(!1);return}if($g()!=="default"){s(!0);return}s(!0),Notification.requestPermission().then(e=>a(e)).catch(()=>a($g()))},[s]),l=i===`unsupported`;return(0,$.jsx)(`div`,{"data-slot":`notifications-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:(0,$.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:(0,$.jsx)(`label`,{htmlFor:`notifications-enabled`,children:`Notify when an agent needs you`})}),(0,$.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`A browser notification when a task starts waiting, asks for review, or fails — only while this tab is in the background. Off by default.`})]}),(0,$.jsx)(Qh,{id:`notifications-enabled`,"data-slot":`notifications-toggle`,checked:n,disabled:l,onCheckedChange:c})]}),l?null:(0,$.jsxs)(`p`,{"data-slot":`notifications-permission`,"data-permission":i,className:`mt-4 text-[13px] text-muted-foreground`,children:[`Browser permission · `,i===`granted`?`Allowed`:i===`denied`?`Blocked`:`Not requested`]}),(0,$.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Permission is requested only when you enable notifications.`}),l?(0,$.jsx)(`p`,{"data-slot":`notifications-unsupported`,className:`text-[13px] text-muted-foreground`,children:`This browser does not support notifications, so the toggle is unavailable here.`}):null,!l&&n&&i===`denied`?(0,$.jsxs)(`div`,{"data-slot":`notifications-denied`,className:`mt-5 flex flex-col gap-2`,children:[(0,$.jsx)(`h3`,{className:`text-sm`,children:`Allow notifications in your browser`}),(0,$.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`This browser is blocking notifications. Your preference is saved. Allow notifications in the browser’s site settings to receive them.`}),(0,$.jsx)(`p`,{className:`settings-readout`,children:`Notifications are blocked for this site.`})]}):null]})})}function i_({open:e,onOpenChange:t}){let[n,r]=(0,Q.useState)(null),[i,a]=(0,Q.useState)(null),o=oi(),s=ea(),c=Ne(),l=new Set((o.data?.projects??[]).map(e=>e.root)),u=e=>{r(e),a(null),s.reset()},d=wh(n,i);return(0,$.jsx)(rs,{open:e,onOpenChange:t,children:(0,$.jsxs)(as,{"data-slot":`add-project-dialog`,className:`sm:max-w-lg`,children:[(0,$.jsxs)(is,{children:[(0,$.jsx)(os,{children:`Open local folder`}),(0,$.jsx)(ns,{children:`Pick the folder cezar should run in. Git repos are marked; any folder works.`})]}),(0,$.jsx)(Ch,{path:n,selected:i,onSelect:a,onEnter:u,emptyHint:`No subfolders here — “Add project” registers this folder.`,decorate:e=>(0,$.jsxs)($.Fragment,{children:[e.isRepo?(0,$.jsx)(uh,{variant:`outline`,className:`shrink-0 text-[12px]`,children:`git`}):null,l.has(e.path)?(0,$.jsx)(uh,{variant:`ghost`,className:`shrink-0 text-[12px] text-muted-foreground`,children:`already added`}):null]})}),s.isError?(0,$.jsx)(`p`,{"data-slot":`add-project-error`,className:`min-w-0 break-words text-[13px] text-danger`,children:s.error instanceof Error?s.error.message:`could not add that folder`}):null,(0,$.jsxs)(ts,{className:`min-w-0 sm:items-center sm:justify-between`,children:[(0,$.jsx)(`span`,{"data-slot":`add-project-target`,className:`min-w-0 truncate font-mono text-[11px] text-muted-foreground`,title:d??void 0,children:d??``}),(0,$.jsxs)(`span`,{className:`flex shrink-0 gap-2`,children:[(0,$.jsx)(B,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,$.jsx)(B,{"data-slot":`add-project-confirm`,disabled:d===null||s.isPending,onClick:()=>{d===null||s.isPending||s.mutate(d,{onSuccess:({project:e})=>{t(!1),c(`/p/${encodeURIComponent(e.id)}/`)}})},children:s.isPending?`Adding…`:`Add project`})]})]})]})})}function a_(){let e=Qi();return{isPending:e.isPending,confirm:(t,n)=>e.mutate(t.id,{onSuccess:()=>{L(`${t.name} removed from the workspace — its files are untouched`),n?.()},onError:e=>L(e.message,{tone:`danger`})})}}function o_({project:e,onOpenChange:t,onConfirm:n}){return(0,$.jsx)(zi,{open:e!==null,onOpenChange:t,children:(0,$.jsxs)(fi,{children:[(0,$.jsxs)(Ii,{children:[(0,$.jsxs)(Qr,{children:[`Remove `,e?.name,` from the workspace?`]}),(0,$.jsxs)(qr,{children:[`This only unregisters the project — `,(0,$.jsx)(`strong`,{children:`nothing on disk is deleted`}),`. The folder, its git history and its task history all stay exactly where they are, and opening it again re-registers it with everything intact.`,(0,$.jsx)(`span`,{className:`mt-1 block truncate font-mono text-[11px] text-foreground`,title:e?.root,children:e?.root})]})]}),(0,$.jsxs)(Ti,{children:[(0,$.jsx)(Ni,{children:`Keep it`}),(0,$.jsx)(Si,{"data-action":`projects-confirm-remove`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:n,children:`Remove from list`})]})]})})}function s_({title:e,hint:t,children:n}){return(0,$.jsxs)(`section`,{className:`settings-field flex flex-col gap-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,$.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}var c_=1,l_={ok:`ok`,"not-git":`no git repo`,missing:`folder not found`};function u_(e){let t=new Date(e);return Number.isNaN(t.getTime())?`—`:t.toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function d_(){let e=Wr(),t=oi();return e.isPending||t.isPending?(0,$.jsx)(`p`,{"data-slot":`projects-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading projects…`}):e.isError||t.isError?(0,$.jsx)(G,{icon:(0,$.jsx)(a,{}),tone:`danger`,title:`Project settings did not load`,subtitle:(e.error??t.error)?.message,heading:`h2`}):(0,$.jsx)(f_,{config:e.data,registry:t.data})}function f_({config:e,registry:t}){let[n,r]=(0,Q.useState)(!1);return(0,$.jsxs)(`div`,{"data-slot":`projects-section`,className:`mx-auto flex w-full max-w-4xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,$.jsx)(p_,{configKey:`browseRoot`,value:e.browseRoot,title:`Default browse folder`,hint:`Where “Open local folder…” starts. The picker cannot navigate above this folder.`,placeholder:`~/`,slot:`browse`,savedLabel:`Browse folder`,footer:`Only affects folder browsing; GitHub checkouts use the separate checkout folder.`}),(0,$.jsx)(p_,{configKey:`projectsDir`,value:e.projectsDir,title:`Default checkout folder`,hint:`Where “Clone from GitHub” puts new projects: <folder>/<project name>.`,placeholder:`~/cezar/projects`,slot:`checkout`,savedLabel:`Checkout folder`,footer:`Only affects new checkouts; projects already registered keep their location.`,refreshProjects:!0}),(0,$.jsx)(m_,{registry:t,workspaceMax:e.resources.maxParallel}),(0,$.jsx)(B,{className:`self-start`,onClick:()=>r(!0),children:`Add project`}),n?(0,$.jsx)(i_,{open:!0,onOpenChange:r}):null]})}function p_({configKey:e,value:t,title:n,hint:r,placeholder:i,slot:a,savedLabel:o,footer:s,refreshProjects:c=!1}){let l=V(),u=J({mutationFn:t=>M(e===`browseRoot`?{browseRoot:t}:{projectsDir:t}),onSuccess:t=>{l.setQueryData(q.config,t),e===`browseRoot`?l.invalidateQueries({queryKey:q.fsBrowseRoot}):c&&l.invalidateQueries({queryKey:q.projects})}}),[d,f]=(0,Q.useState)(t),p=d.trim(),m=p===t,h=u.isError?u.error.message:null;return(0,$.jsxs)(s_,{title:n,hint:`${r} ${e===`browseRoot`?`Choose an existing folder; it is verified writable before saving.`:`The folder is created recursively if needed, then verified writable before saving.`}`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`input`,{type:`text`,spellCheck:!1,"aria-label":n,"aria-invalid":h!==null,"data-slot":`projects-${a}-root`,value:d,disabled:u.isPending,placeholder:i,onChange:e=>{f(e.target.value),u.isError&&u.reset()},className:`block w-full max-w-sm rounded-md border border-input bg-card px-3 py-1.5 font-mono text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-danger disabled:opacity-50`}),(0,$.jsx)(B,{type:`button`,variant:`outline`,size:`sm`,"data-action":`projects-save-${a}-root`,disabled:m||p===``||u.isPending,onClick:()=>u.mutate(p,{onSuccess:()=>L(`${o} set to ${p}`)}),children:`Save`})]}),h===null?(0,$.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:s}):(0,$.jsxs)(`p`,{"data-slot":`projects-${a}-root-error`,role:`alert`,className:`text-[11px] text-danger`,children:[h,` — setting unchanged`]})]})}function m_({registry:e,workspaceMax:t}){let[n,r]=(0,Q.useState)(null),i=a_(),a=(0,Q.useMemo)(()=>Ci(e.projects),[e.projects]);return(0,$.jsxs)(s_,{title:`Registered projects`,hint:`Connected repositories. Removing a project only unregisters it — no files on disk are deleted.`,children:[e.projects.length===0?(0,$.jsx)(`p`,{"data-slot":`projects-empty`,className:`text-[13px] text-soft-foreground`,children:`No projects registered yet.`}):(0,$.jsx)(`div`,{className:`overflow-x-auto rounded-md border border-border`,children:(0,$.jsxs)(`table`,{className:`w-full border-collapse text-sm`,children:[(0,$.jsx)(`caption`,{className:`sr-only`,children:`Projects registered in this workspace`}),(0,$.jsxs)(`colgroup`,{children:[(0,$.jsx)(`col`,{}),(0,$.jsx)(`col`,{style:{width:`104px`}}),(0,$.jsx)(`col`,{style:{width:`260px`}}),(0,$.jsx)(`col`,{style:{width:`150px`}}),(0,$.jsx)(`col`,{style:{width:`72px`}}),(0,$.jsx)(`col`,{style:{width:`92px`}})]}),(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{className:`border-b border-border text-left text-[12px] text-soft-foreground`,children:[(0,$.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Project`}),(0,$.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Status`}),(0,$.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Tags`}),(0,$.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Max parallel`}),(0,$.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Added`}),(0,$.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium text-right`,children:`Actions`})]})}),(0,$.jsx)(`tbody`,{children:e.projects.map(n=>(0,$.jsx)(h_,{project:n,isBoot:n.id===e.bootProject,workspaceMax:t,vocabulary:a,disabled:i.isPending,onRemove:()=>r(n)},n.id))})]})}),(0,$.jsx)(o_,{project:n,onOpenChange:e=>!e&&r(null),onConfirm:()=>{if(!n)return;let e=n;r(null),i.confirm(e)}})]})}function h_({project:e,isBoot:t,workspaceMax:n,vocabulary:r,disabled:i,onRemove:a}){return(0,$.jsxs)(`tr`,{"data-slot":`project-row`,"data-project":e.id,className:`border-b border-border last:border-0`,children:[(0,$.jsxs)(`th`,{scope:`row`,className:`max-w-0 px-3 py-2 text-left font-normal`,children:[(0,$.jsx)(`span`,{className:`block truncate text-foreground`,children:e.name}),(0,$.jsx)(`span`,{className:`block truncate font-mono text-[11px] text-soft-foreground`,title:e.root,children:e.root})]}),(0,$.jsxs)(`td`,{className:`px-3 py-2`,children:[(0,$.jsx)(`span`,{"data-slot":`project-status`,className:e.status===`missing`?`text-[12px] text-danger`:`text-[12px] text-soft-foreground`,children:l_[e.status]}),e.status===`missing`?null:(0,$.jsxs)(`span`,{className:`ml-1 text-[11px] text-soft-foreground`,children:[`· `,e.source]})]}),(0,$.jsx)(`td`,{className:`px-3 py-2`,children:(0,$.jsx)(g_,{project:e,vocabulary:r})}),(0,$.jsx)(`td`,{className:`px-3 py-2`,children:(0,$.jsx)(__,{project:e,workspaceMax:n})}),(0,$.jsx)(`td`,{className:`px-3 py-2 tabular-nums text-soft-foreground`,children:u_(e.addedAt)}),(0,$.jsxs)(`td`,{className:`px-3 py-2 text-right`,children:[e.status===`missing`?null:(0,$.jsx)(B,{asChild:!0,variant:`outline`,className:`mr-2`,children:(0,$.jsx)(o,{to:`/p/${encodeURIComponent(e.id)}`,children:`Open`})}),(0,$.jsx)(B,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`project-remove`,"aria-label":`Remove ${e.name} from the workspace — unregisters it, no files are deleted`,title:t?`cezar is serving this project — it re-registers itself at every start`:void 0,disabled:i||t,onClick:a,children:`Remove`})]})]})}function g_({project:e,vocabulary:t}){let n=Ur(),[r,i]=(0,Q.useState)(``),[a,o]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)(-1),l=(0,Q.useRef)(null),u=e.tags??[],f=Pi(t,u,r),p=a&&f.length>0,m=(t,r)=>{n.mutate({id:e.id,tags:t},{onSuccess:()=>L(r),onError:e=>L(e.message,{tone:`danger`})})},h=t=>{let n=t.trim().slice(0,32);if(c(-1),n){if(u.some(e=>e.toLowerCase()===n.toLowerCase())){i(``);return}if(u.length>=20){L(`${e.name} already has the maximum of 20 tags`,{tone:`danger`});return}i(``),m([...u,n],`${e.name} tagged \u201c${n}\u201d`)}},g=t=>{m(u.filter(e=>e!==t),`\u201c${t}\u201d removed from ${e.name}`)},_=`project-tag-suggestions-${e.id}`;return(0,$.jsxs)(`div`,{"data-slot":`project-tags`,className:`flex flex-wrap items-center gap-1`,children:[u.map(t=>(0,$.jsxs)(`span`,{"data-slot":`project-tag`,className:`inline-flex max-w-full items-center gap-1 rounded-full bg-accent-strong/15 py-px pr-1 pl-2 text-[11px] font-medium whitespace-nowrap text-accent-text`,children:[t,(0,$.jsx)(`button`,{type:`button`,"data-action":`project-tag-remove`,"aria-label":`Remove tag ${t} from ${e.name}`,disabled:n.isPending,onClick:()=>g(t),className:`rounded-full p-0.5 hover:bg-accent-strong/25 disabled:opacity-50`,children:(0,$.jsx)(d,{className:`size-3`,"aria-hidden":`true`})})]},t)),(0,$.jsxs)(Ea,{open:p,onOpenChange:o,children:[(0,$.jsx)(Sa,{asChild:!0,children:(0,$.jsx)(`input`,{ref:l,type:`text`,"data-slot":`project-tag-input`,"aria-label":`Add a tag to ${e.name}`,role:`combobox`,"aria-expanded":p,"aria-controls":p?_:void 0,"aria-autocomplete":`list`,"aria-activedescendant":p&&s>=0?`${_}-${s}`:void 0,placeholder:u.length===0?`Add tag…`:`+`,value:r,maxLength:32,disabled:n.isPending,onFocus:()=>o(!0),onBlur:()=>o(!1),onChange:e=>{if(o(!0),c(-1),e.target.value.includes(`,`)){i(e.target.value.replace(/,/g,``));return}i(e.target.value)},onKeyDown:e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(f.length===0)return;e.preventDefault(),o(!0);let t=e.key===`ArrowDown`?1:-1,n=s+t;c(n>=f.length?-1:n<-1?f.length-1:n);return}if(e.key===`Escape`&&p){e.preventDefault(),o(!1),c(-1);return}if(e.key===`Enter`||e.key===`,`){e.preventDefault(),h(s>=0?f[s]??r:r);return}if(e.key===`Tab`){o(!1);return}if(e.key===`Backspace`&&r===``&&u.length>0){e.preventDefault();let t=u[u.length-1];t!==void 0&&g(t)}},className:`h-6 w-16 min-w-0 flex-1 rounded-md border border-input bg-card px-1.5 text-[12px] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`})}),(0,$.jsxs)(wa,{align:`start`,sideOffset:4,id:_,role:`listbox`,"data-slot":`project-tag-suggestions`,className:`w-56 p-1`,onOpenAutoFocus:e=>e.preventDefault(),onCloseAutoFocus:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[(0,$.jsx)(`p`,{className:`px-2 pt-1 pb-1.5 text-[11px] text-soft-foreground`,children:`Tags used in this workspace`}),f.map((e,t)=>(0,$.jsx)(`button`,{type:`button`,id:`${_}-${t}`,role:`option`,"aria-selected":t===s,"data-slot":`project-tag-suggestion`,onMouseDown:e=>e.preventDefault(),onClick:()=>{h(e),l.current?.focus()},onMouseEnter:()=>c(t),className:U(`flex w-full items-center rounded-sm px-2 py-1 text-left text-[12px] font-medium text-accent-text`,t===s&&`bg-muted`),children:e},e))]})]})]})}function __({project:e,workspaceMax:t}){let n=Ur(),r=e.maxParallel===void 0?``:String(e.maxParallel);return(0,$.jsxs)(`select`,{"aria-label":`Max parallel tasks for ${e.name}`,"data-slot":`project-max-parallel`,value:r,disabled:n.isPending,onChange:r=>{let i=r.target.value,a=i===``?null:Number(i);n.mutate({id:e.id,maxParallel:a},{onSuccess:()=>L(a===null?`${e.name} inherits the workspace limit (${t})`:`${e.name} runs at most ${a} task${a===1?``:`s`} at a time`),onError:e=>L(e.message,{tone:`danger`})})},className:`block w-44 rounded-md border border-input bg-card px-2 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[(0,$.jsxs)(`option`,{value:``,children:[`Inherit workspace (`,t,`)`]}),Array.from({length:16},(e,t)=>t+c_).map(e=>(0,$.jsx)(`option`,{value:e,children:e},e))]})}function v_(){let e=Mi();return e.isPending?(0,$.jsx)(`p`,{"data-slot":`prompt-templates-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading prompt templates…`}):e.isError?(0,$.jsx)(G,{icon:(0,$.jsx)(Je,{}),tone:`danger`,title:`Prompt templates did not load`,subtitle:e.error.message,heading:`h2`}):(0,$.jsx)(y_,{initial:Va(e.data.promptTemplates)})}function y_({initial:e}){let t=V(),n=Pr(),r=Mi(),[i,a]=(0,Q.useState)(e),[o,s]=(0,Q.useState)(``),[c,l]=(0,Q.useState)(``),u=J({mutationFn:e=>Kt({promptTemplates:e}),onSuccess:e=>{t.setQueryData(K.uiState,e),L(`Prompt templates saved`)},onError:e=>L(e.message,{tone:`danger`})}),f=JSON.stringify(i)!==JSON.stringify(e),p=i.some(e=>e.label.trim()===``||e.text.trim()===``),m=(e,t)=>a(n=>n.map(n=>n.id===e?{...n,...t}:n)),h=(e,t)=>a(n=>n.map(n=>{if(n.id!==e)return n;let r=n.skills??[],i=r.includes(t)?r.filter(e=>e!==t):[...r,t],{skills:a,...o}=n;return i.length>0?{...o,skills:i}:o})),g=e=>a(t=>t.filter(t=>t.id!==e));return(0,$.jsx)(`div`,{"data-slot":`prompt-templates-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:(0,$.jsxs)(x_,{title:`Reusable instructions`,hint:`Insert templates from task composers, or apply them automatically with selected skills when the prompt is empty.`,children:[(0,$.jsx)(`div`,{"data-slot":`prompt-template-list`,className:`flex flex-col gap-3`,children:i.length===0?(0,$.jsx)(`p`,{"data-slot":`prompt-templates-empty`,className:`text-[13px] text-soft-foreground`,children:`No templates. Add one below, or reset to the built-ins.`}):i.map(e=>(0,$.jsxs)(`div`,{"data-slot":`prompt-template-row`,"data-template":e.id,className:`flex flex-col gap-1.5 rounded-md border border-border bg-card p-3`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(`label`,{htmlFor:`template-label-${e.id}`,className:`text-sm`,children:`Template label`}),(0,$.jsx)(wm,{id:`template-label-${e.id}`,"aria-label":`Label for ${e.label||`this template`}`,"data-slot":`prompt-template-label-input`,value:e.label,maxLength:80,onChange:t=>m(e.id,{label:t.target.value}),className:`flex-1`})]}),(0,$.jsx)(`label`,{htmlFor:`template-text-${e.id}`,className:`text-sm`,children:`Instructions`}),(0,$.jsx)(ss,{id:`template-text-${e.id}`,"aria-label":`Text for ${e.label||`this template`}`,"data-slot":`prompt-template-text-input`,value:e.text,maxLength:2e3,onChange:t=>m(e.id,{text:t.target.value}),className:`min-h-14 text-[13px]`}),(0,$.jsx)(`p`,{className:`mt-3 text-sm`,children:`Apply automatically with skills`}),(0,$.jsxs)(`div`,{className:`mt-0.5 flex flex-wrap items-center gap-1.5`,children:[(0,$.jsx)(b_,{label:e.label,skills:n.data??[],skillUsage:r.data?.skillUsage,selected:e.skills??[],onToggle:t=>h(e.id,t)}),(e.skills??[]).map(t=>(0,$.jsxs)(`button`,{type:`button`,"data-slot":`prompt-template-skill-chip`,"data-skill":t,title:`Stop applying “${e.label}” automatically with ${t}`,onClick:()=>h(e.id,t),className:`inline-flex items-center gap-1 rounded-full border border-border bg-muted px-2 py-px font-mono text-[11px] font-medium text-foreground transition-colors hover:bg-danger/10 hover:text-danger`,children:[t,(0,$.jsx)(d,{"aria-hidden":`true`,className:`size-3`})]},t))]}),(0,$.jsx)(B,{type:`button`,className:`self-start`,variant:`outline`,size:`sm`,"data-action":`prompt-template-remove`,title:`Remove this template`,onClick:()=>g(e.id),children:`Delete template`})]},e.id))}),(0,$.jsxs)(`div`,{"data-slot":`prompt-template-new`,className:`flex flex-col gap-1.5 rounded-md border border-dashed border-border p-3`,children:[(0,$.jsx)(`h3`,{className:`text-lg`,children:`New template`}),(0,$.jsx)(`label`,{htmlFor:`new-template-label`,className:`text-sm`,children:`Label`}),(0,$.jsx)(wm,{id:`new-template-label`,"aria-label":`New template label`,"data-slot":`prompt-template-new-label`,placeholder:`e.g. Review security`,value:o,maxLength:80,onChange:e=>s(e.target.value)}),(0,$.jsx)(`label`,{htmlFor:`new-template-text`,className:`text-sm`,children:`Instructions to insert`}),(0,$.jsx)(ss,{id:`new-template-text`,"aria-label":`New template text`,"data-slot":`prompt-template-new-text`,placeholder:`Enter reusable instructions…`,value:c,maxLength:2e3,onChange:e=>l(e.target.value),className:`min-h-14 text-[13px]`}),(0,$.jsxs)(B,{type:`button`,variant:`outline`,size:`sm`,"data-action":`prompt-template-add`,disabled:!o.trim()||!c.trim(),onClick:()=>{let e=o.trim(),t=c.trim();!e||!t||(a(n=>[...n,{id:Ja(),label:e,text:t}]),s(``),l(``))},className:`self-start`,children:[(0,$.jsx)(pn,{"aria-hidden":`true`,className:`size-3.5`}),`Add template`]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(B,{type:`button`,variant:`primary`,size:`sm`,"data-action":`prompt-templates-save`,disabled:!f||p||u.isPending,onClick:()=>u.mutate(i),children:`Save`}),(0,$.jsx)(B,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`prompt-templates-reset`,disabled:u.isPending,onClick:()=>a(ro.map(e=>({...e}))),children:`Reset to defaults`}),p?(0,$.jsx)(`p`,{"data-slot":`prompt-templates-invalid`,className:`text-[11px] text-danger`,children:`Every template needs both a label and text.`}):null]})]})})}function b_({label:e,skills:t,skillUsage:n,selected:r,onToggle:i}){let[a,o]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)(``),l=(0,Q.useRef)(null),{mostUsed:u,project:d,global:f,ranked:p}=vs(t,s,n),m=(e,t)=>{let n=r.includes(e.name);return(0,$.jsxs)(to,{value:`skill ${e.name} ${e.path}`,keywords:ds(e.name,e.description),"data-slot":`prompt-template-skill-option`,"data-skill":e.name,"data-selected":n?`true`:void 0,onSelect:()=>i(e.name),children:[(0,$.jsx)(`span`,{className:U(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.description?(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,n?(0,$.jsx)(ue,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-link-foreground`}):null]},e.path)};return(0,$.jsxs)(Ea,{open:a,onOpenChange:e=>{o(e),e||c(``)},children:[(0,$.jsx)(xa,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,"data-slot":`prompt-template-skills-trigger`,"aria-label":`Apply ${e||`this template`} automatically with a skill`,title:`Pick the skills this template applies itself to`,disabled:t.length===0,className:U(`inline-flex h-[26px] items-center gap-1.5 rounded-full border border-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-50`,r.length>0&&`border-foreground/60 font-semibold text-foreground`),children:[(0,$.jsx)(F,{"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),t.length===0?`no skills found`:`apply with…`,(0,$.jsx)(ge,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,$.jsx)(wa,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,$.jsxs)(Ua,{shouldFilter:!1,children:[(0,$.jsx)(Ga,{placeholder:`search skills…`,value:s,onValueChange:c,onInput:()=>l.current?.scrollTo(0,0)}),(0,$.jsxs)(Qa,{ref:l,"data-slot":`prompt-template-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(p?p.length===0:u.length===0&&d.length===0&&f.length===0)?(0,$.jsx)(io,{children:`Nothing matches.`}):null,p?p.length>0?(0,$.jsx)(Wa,{children:p.map(e=>m(e,fs(e)))}):null:(0,$.jsxs)($.Fragment,{children:[u.length>0?(0,$.jsx)(Wa,{heading:`Most used`,children:u.map(e=>m(e,fs(e)))}):null,d.length>0?(0,$.jsx)(Wa,{heading:`Project skills`,children:d.map(e=>m(e,!0))}):null,f.length>0?(0,$.jsx)(Wa,{heading:`Global`,children:f.map(e=>m(e,!1))}):null]})]})]})})]})}function x_({title:e,hint:t,children:n}){return(0,$.jsxs)(`section`,{className:`settings-field flex flex-col gap-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,$.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}var S_=1,C_=1,w_=60,T_=256;function E_(){let e=Wr();return e.isPending?(0,$.jsx)(`p`,{"data-slot":`resources-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading resource settings…`}):e.isError?(0,$.jsx)(G,{icon:(0,$.jsx)(st,{}),tone:`danger`,title:`Resource settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,$.jsx)(D_,{config:e.data})}function D_({config:e}){let t=V(),n=J({mutationFn:e=>M(e),onSuccess:e=>t.setQueryData(q.config,e),onError:e=>L(e.message,{tone:`danger`})}),[r,i]=(0,Q.useState)(e.resources.memoryLimitMb?String(e.resources.memoryLimitMb):``),a=e.resources.monitoringWakeIntervalMinutes??null,[s,c]=(0,Q.useState)(a===null?`park`:`interval`),[l,u]=(0,Q.useState)(String(a??5)),d=Number(l),f=!Number.isInteger(d)||d<C_||d>w_,p=s===`park`?a===null:!f&&a===d,m=()=>n.mutate({resources:{monitoringWakeIntervalMinutes:s===`park`?null:d}},{onSuccess:()=>L(s===`park`?`Monitoring will stay parked`:`Monitoring will re-check every ${d} minutes`)}),h=e.resources.autoResumeOnUsageLimit??!0,g=e=>n.mutate({resources:{autoResumeOnUsageLimit:e}},{onSuccess:()=>L(e?`Tasks stopped by a usage limit will resume themselves`:`Tasks stopped by a usage limit will stay failed`)}),_=r.trim()===``?0:Number(r),v=r.trim()!==``&&(!Number.isInteger(_)||_<T_),y=(e.resources.memoryLimitMb??0)===(v?-1:_),b=()=>n.mutate({resources:{memoryLimitMb:_===0?null:_}},{onSuccess:()=>L(_===0?`Memory limit cleared`:`Memory limit set to ${_} MiB`)}),x=e.composerDefaults??{autonomous:null,worktree:null,inheritedAutonomous:`source-dependent`,inheritedWorktree:!0},S=(e,t)=>n.mutate({composerDefaults:{[e]:t===`inherit`?null:t===`on`}});return(0,$.jsxs)(`div`,{"data-slot":`resources-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,$.jsxs)(s_,{title:`Max parallel tasks`,hint:`Limit simultaneously running tasks.`,children:[(0,$.jsx)(`select`,{"aria-label":`Max parallel tasks`,"data-slot":`resources-max-parallel`,value:e.resources.maxParallel,disabled:n.isPending,onChange:e=>n.mutate({resources:{maxParallel:Number(e.target.value)}}),className:`block w-28 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:Array.from({length:16},(e,t)=>t+S_).map(e=>(0,$.jsx)(`option`,{value:e,children:e},e))}),(0,$.jsxs)(`p`,{className:`text-[11px] text-soft-foreground`,children:[`Need a different limit for one project?`,` `,(0,$.jsx)(o,{to:`/settings/global/projects`,"data-slot":`resources-project-limits-link`,className:`font-medium text-foreground underline decoration-border underline-offset-2 hover:decoration-foreground`,children:`Configure per-project limits`}),`.`]})]}),(0,$.jsxs)(s_,{title:`Extra monitoring sessions`,hint:`Additional capacity reserved for monitoring.`,children:[(0,$.jsx)(`select`,{"aria-label":`Extra monitoring sessions`,"data-slot":`resources-max-monitoring`,value:e.resources.maxMonitoringSessions??2,disabled:n.isPending,onChange:e=>n.mutate({resources:{maxMonitoringSessions:Number(e.target.value)}}),className:`block w-28 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:Array.from({length:17},(e,t)=>(0,$.jsx)(`option`,{value:t,children:t},t))}),(0,$.jsxs)(`p`,{className:`text-[11px] text-soft-foreground`,children:[`Capacity: `,e.resources.maxParallel,` active + `,e.resources.maxMonitoringSessions??2,` monitoring. Set 0 to make monitoring share active slots.`]})]}),(0,$.jsxs)(s_,{title:`Monitoring wake-up`,hint:`Wake monitoring sessions periodically.`,children:[(0,$.jsxs)(`div`,{className:`settings-resource-controls flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(Qh,{"aria-label":`Monitoring wake-up`,"data-slot":`resources-monitoring-wake-mode`,checked:s===`interval`,disabled:n.isPending,onCheckedChange:e=>c(e?`interval`:`park`)}),s===`interval`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{htmlFor:`monitoring-wake-interval`,className:`w-full text-sm`,children:`Wake interval`}),(0,$.jsx)(`input`,{id:`monitoring-wake-interval`,type:`number`,min:C_,max:w_,"aria-label":`Wake interval in minutes`,"data-slot":`resources-monitoring-wake-interval`,value:l,disabled:n.isPending,onChange:e=>u(e.target.value),className:`block w-24 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`}),(0,$.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`minutes`})]}):null,(0,$.jsx)(B,{type:`button`,variant:`outline`,size:`sm`,"data-action":`resources-save-monitoring-wake`,disabled:p||s===`interval`&&f||n.isPending,onClick:m,children:`Save`})]}),s===`interval`&&f?(0,$.jsx)(`p`,{"data-slot":`resources-monitoring-wake-invalid`,className:`text-[11px] text-danger`,children:`Enter a whole number from 1 to 60 minutes.`}):(0,$.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Applied consistently to Claude, Codex and OpenCode.`})]}),(0,$.jsxs)(s_,{title:`Auto-resume after a usage limit`,hint:`Resume eligible tasks once the provider usage limit resets.`,children:[(0,$.jsx)(Qh,{"aria-label":`Auto-resume after a usage limit`,"data-slot":`resources-auto-resume`,checked:h,disabled:n.isPending,onCheckedChange:g}),(0,$.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Applies to Claude, Codex and OpenCode — whenever the provider says when the limit lifts.`})]}),(0,$.jsxs)(s_,{title:`Per-task memory limit`,hint:`Leave blank for no limit.`,children:[(0,$.jsxs)(`div`,{className:`settings-resource-controls flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:T_,step:256,"aria-label":`Per-task memory limit in MiB`,"data-slot":`resources-memory-limit`,value:r,disabled:n.isPending,placeholder:`no limit`,onChange:e=>i(e.target.value),className:`block w-32 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`}),(0,$.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`MiB`}),(0,$.jsx)(B,{type:`button`,variant:`outline`,size:`sm`,"data-action":`resources-save-memory`,disabled:y||v||n.isPending,onClick:b,children:`Save`})]}),v?(0,$.jsxs)(`p`,{"data-slot":`resources-memory-invalid`,className:`text-[11px] text-danger`,children:[`Enter a whole number of at least `,T_,` MiB, or leave empty for no limit.`]}):(0,$.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Applies to newly started tasks.`})]}),(0,$.jsxs)(s_,{title:`New task defaults`,hint:`Apply to new tasks unless overridden.`,children:[(0,$.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,"data-slot":`resources-composer-defaults`,children:[(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,$.jsx)(`span`,{className:`font-medium`,children:`Autonomous by default`}),(0,$.jsxs)(`select`,{"aria-label":`Autonomous by default`,value:x.autonomous===null?`inherit`:x.autonomous?`on`:`off`,disabled:n.isPending,onChange:e=>S(`autonomous`,e.target.value),className:`rounded-md border border-input bg-card px-3 py-1.5 shadow-xs outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:[(0,$.jsx)(`option`,{value:`inherit`,children:`Inherit environment`}),(0,$.jsx)(`option`,{value:`on`,children:`On`}),(0,$.jsx)(`option`,{value:`off`,children:`Off`})]}),(0,$.jsxs)(`span`,{className:`text-[11px] text-soft-foreground`,children:[`Inherited: `,x.inheritedAutonomous===`source-dependent`?`Source-dependent — skills on, workflows off`:x.inheritedAutonomous?`On`:`Off`]})]}),(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,$.jsx)(`span`,{className:`font-medium`,children:`Use a worktree by default`}),(0,$.jsxs)(`select`,{"aria-label":`Use a worktree by default`,value:x.worktree===null?`inherit`:x.worktree?`on`:`off`,disabled:n.isPending,onChange:e=>S(`worktree`,e.target.value),className:`rounded-md border border-input bg-card px-3 py-1.5 shadow-xs outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:[(0,$.jsx)(`option`,{value:`inherit`,children:`Inherit environment`}),(0,$.jsx)(`option`,{value:`on`,children:`On`}),(0,$.jsx)(`option`,{value:`off`,children:`Off`})]}),(0,$.jsxs)(`span`,{className:`text-[11px] text-soft-foreground`,children:[`Inherited: `,x.inheritedWorktree?`On`:`Off`]})]})]}),(0,$.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Interactive skills may recommend both off. Multi-step and parallel runs remain isolated.`})]})]})}function O_(){let e=Wr(),t=oi().data?.bootProject??``,n=Rr(t,!!t);return e.isPending?(0,$.jsx)(`p`,{"data-slot":`skills-settings-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading skill settings…`}):e.isError?(0,$.jsx)(G,{icon:(0,$.jsx)($c,{}),tone:`danger`,title:`Skill settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,$.jsx)(k_,{projectId:t,config:e.data,update:n.data,updateError:n.error})}function k_({projectId:e,config:t,update:n,updateError:r}){let i=V(),a=J({mutationFn:e=>M(e),onSuccess:e=>i.setQueryData(q.config,e),onError:e=>L(e.message,{tone:`danger`})}),s=t.skillsAutoUpdate===null,c=(()=>{if(r)return`Installation status is unavailable right now.`;if(!n)return`Checking tracked Open Mercato installations…`;if(n.status===`unavailable`)return n.scopes.find(e=>e.reason)?.reason??`Automatic skill updates are unavailable.`;if(n.scopes.every(e=>e.skills.length===0))return`No tracked Open Mercato installation found.`;let e=new Set(n.scopes.flatMap(e=>e.skills)).size;return n.status===`current`?`${e} tracked skill${e===1?``:`s`} · Up to date`:`${e} tracked Open Mercato skill${e===1?``:`s`} found.`})();return(0,$.jsx)(`div`,{"data-slot":`skills-settings-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-4 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:(0,$.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:(0,$.jsx)(`label`,{htmlFor:`skills-auto-update`,children:`Update Open Mercato skills automatically`})}),(0,$.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Checks installed Open Mercato skills in the background and applies available updates. Other skills and untracked folders are never changed.`})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-1`,children:[(0,$.jsx)(Qh,{id:`skills-auto-update`,"data-slot":`skills-auto-update`,checked:t.effectiveSkillsAutoUpdate,disabled:a.isPending,onCheckedChange:e=>a.mutate({skillsAutoUpdate:e})}),(0,$.jsxs)(`span`,{className:`text-[11px] text-soft-foreground`,children:[t.effectiveSkillsAutoUpdate?`On`:`Off`,s?` (default)`:``]})]})]}),(0,$.jsx)(`h3`,{className:`mt-4 text-lg`,children:`Installation status`}),(0,$.jsx)(`p`,{"data-slot":`skills-installation-status`,role:r||n?.status===`unavailable`?`status`:void 0,className:n?.status===`current`&&n.scopes.some(e=>e.skills.length>0)?`text-[13px] text-success`:`text-[13px] text-soft-foreground`,children:c}),(0,$.jsx)(`p`,{className:`mt-3 text-[13px] text-muted-foreground`,children:`Manage installed skills and sources from the Skills catalog.`}),e?(0,$.jsx)(B,{asChild:!0,variant:`outline`,className:`mt-2 self-start`,children:(0,$.jsx)(o,{to:`/p/${encodeURIComponent(e)}/skills`,children:`Open Skills`})}):null,(0,$.jsxs)(`details`,{className:`settings-disclosure`,children:[(0,$.jsx)(`summary`,{children:`Update preference inheritance`}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 rounded-md border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground`,children:[(0,$.jsx)(`span`,{children:s?`No override is saved. CEZ_SKILLS_AUTO_UPDATE supplies the inherited default when set; otherwise it is on.`:`An explicit workspace override is saved.`}),(0,$.jsx)(B,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`skills-use-default`,disabled:s||a.isPending,onClick:()=>a.mutate({skillsAutoUpdate:null}),children:`Use default`})]})]})]})})}var A_=[[`overall`,`Overall`],[`needsYou`,`Needs You`],[`finished`,`Finished`],[`working`,`Working`]];function j_(){let e=Hn(),t=Ui(e);return t.isPending?(0,$.jsx)(`p`,{role:`status`,className:`p-4 text-sm text-muted-foreground`,children:`Loading sidebar settings…`}):t.isError?(0,$.jsxs)(`div`,{className:`space-y-3 p-4`,children:[(0,$.jsxs)(`p`,{role:`alert`,children:[`Sidebar settings did not load: `,t.error.message]}),(0,$.jsx)(B,{className:`min-h-[44px]`,onClick:()=>void t.refetch(),children:`Retry`})]}):(0,$.jsx)(M_,{scope:e,initial:t.data.sidebarLimits??{}},e)}function M_({scope:e,initial:t}){let n=V(),r=Dn(void 0),i=N_(t),[a,o]=(0,Q.useState)(()=>({values:i,saved:i,received:i})),{values:s,saved:c}=a,l=e=>o(t=>({...t,values:e})),u=Bn.safeParse(Object.fromEntries(A_.map(([e])=>[e,s[e]===null?null:Number(s[e])]))),d=e=>s[e]!==null&&(s[e].trim()===``||!Number.isSafeInteger(Number(s[e]))||Number(s[e])<=0),f=A_.some(([e])=>s[e]!==c[e]),p=J({onMutate:()=>n.cancelQueries({queryKey:[e,`ui-state`],exact:!0}),mutationFn:t=>Kt({sidebarLimits:t},e),onSuccess:async t=>{await n.cancelQueries({queryKey:[e,`ui-state`],exact:!0}),n.setQueryData([e,`ui-state`],t);let r=N_(t.sidebarLimits);o({values:r,saved:r,received:r})}});return!p.isPending&&!P_(a.received,i)&&o({values:f?s:i,saved:i,received:i}),(0,$.jsxs)(`form`,{"data-slot":`sidebar-settings`,className:`flex w-full max-w-2xl flex-col gap-5 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6`,onSubmit:e=>{e.preventDefault(),u.success&&!A_.some(([e])=>d(e))&&!p.isPending&&p.mutate(u.data)},children:[(0,$.jsx)(`p`,{id:`sidebar-limits-help`,className:`text-sm text-muted-foreground`,children:`Limits apply to this project on desktop and mobile. The overall budget is shared in section order: Needs You, Finished, then Working. Each section also respects its own limit. Unlimited removes only that constraint.`}),(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Pinned tasks and groups containing a pin bypass both limits. A task group counts as one row. Archived uses only the overall limit; archived pins are not exempt.`}),A_.map(([e,t])=>(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`label`,{htmlFor:`sidebar-${e}`,className:`text-sm font-medium`,children:t}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,$.jsx)(`input`,{id:`sidebar-${e}`,type:`number`,inputMode:`numeric`,min:`1`,step:`1`,value:s[e]??``,disabled:s[e]===null||p.isPending,"aria-invalid":d(e),"aria-describedby":d(e)?`sidebar-${e}-error sidebar-limits-help`:`sidebar-limits-help`,onChange:t=>l({...s,[e]:t.target.value}),className:`min-h-[44px] w-28 rounded-md border border-input bg-card px-3 text-sm outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50`}),(0,$.jsxs)(`label`,{className:`flex min-h-[44px] cursor-pointer items-center gap-2 text-sm`,children:[(0,$.jsx)(`input`,{type:`checkbox`,"aria-label":`${t} Unlimited`,checked:s[e]===null,disabled:p.isPending,onChange:t=>l({...s,[e]:t.target.checked?null:String(r[e]??10)}),className:`size-4 accent-[var(--accent-strong)]`}),`Unlimited`]})]}),d(e)&&(0,$.jsx)(`p`,{id:`sidebar-${e}-error`,className:`text-sm text-danger`,children:`Enter a positive whole number or choose Unlimited.`})]},e)),(0,$.jsx)(B,{type:`submit`,className:`min-h-[44px] self-start`,variant:`primary`,disabled:!f||!u.success||A_.some(([e])=>d(e))||p.isPending,children:p.isPending?`Saving…`:`Save sidebar limits`}),p.isError&&(0,$.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Could not save sidebar limits: `,p.error.message]}),p.isSuccess&&!f&&(0,$.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:`Sidebar limits saved.`})]})}function N_(e){let t=Dn(e);return Object.fromEntries(A_.map(([e])=>[e,t[e]===null?null:String(t[e])]))}function P_(e,t){return A_.every(([n])=>e[n]===t[n])}function F_({config:e}){let t=V(),n=W(),r=n.data?.capabilities?.localHandoff===!0,i=e.worktreeSetup?.commands??[],a=e.worktreeSetup?.timeoutSeconds??900,[o,s]=(0,Q.useState)(i.join(`
|
|
9
|
+
`)),[c,l]=(0,Q.useState)(String(a)),u=o.split(`
|
|
10
|
+
`).map(e=>e.trim()).filter(e=>e!==``),d=Number(c),f=u.length>20?`Enter at most 20 commands.`:u.some(e=>e.length>4e3)?`Keep each command under ${Sn.toLocaleString(`en-US`)} characters.`:c.trim()===``||!Number.isInteger(d)||d<1||d>7200?`Enter a whole number of seconds from 1 to ${En}.`:null,p=e.worktreeSetupIssue===null&&u.length===i.length&&u.every((e,t)=>e===i[t])&&(u.length===0||d===a),m=J({mutationFn:e=>N(e),onSuccess:e=>{t.setQueryData(K.config,e),s(u.join(`
|
|
11
|
+
`)),L(u.length===0?`Worktree setup cleared`:`Worktree setup saved`)},onError:e=>L(e.message,{tone:`danger`})}),h=()=>m.mutate({worktreeSetup:u.length===0?null:{commands:u,...d===900?{}:{timeoutSeconds:d}}}),g=`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50 read-only:bg-muted read-only:text-muted-foreground`;return(0,$.jsxs)(s_,{title:`Prepare new worktrees`,hint:`Runs in every new task and worker worktree before the agent starts, in order, stopping at the first failure. Empty = none.`,children:[(0,$.jsx)(`textarea`,{"data-slot":`worktree-setup-commands`,"aria-label":`Worktree setup commands, one per line`,rows:4,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,placeholder:`npm ci`,value:o,readOnly:!r,disabled:m.isPending,onChange:e=>s(e.target.value),className:`${g} min-h-24 w-full resize-y font-mono text-[13px] leading-relaxed`}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-soft-foreground`,children:[(0,$.jsx)(`span`,{children:`Timeout per command`}),(0,$.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:1,max:En,step:1,"data-slot":`worktree-setup-timeout`,value:c,readOnly:!r,disabled:m.isPending,onChange:e=>l(e.target.value),className:`${g} min-h-11 w-28 md:min-h-0`}),(0,$.jsx)(`span`,{children:`seconds`})]}),(0,$.jsx)(B,{type:`button`,variant:`primary`,size:`sm`,className:`min-h-11 self-start md:min-h-0`,"data-action":`worktree-setup-save`,disabled:!r||p||f!==null||m.isPending,onClick:h,children:`Save setup`})]}),n.data?.capabilities?.localHandoff===!1?(0,$.jsx)(`p`,{"data-slot":`worktree-setup-readonly`,className:`text-[11px] text-soft-foreground`,children:`Setup commands can be edited only on the machine running Cezar.`}):null,e.worktreeSetupIssue===null?null:(0,$.jsxs)(`p`,{"data-slot":`worktree-setup-issue`,className:`text-[11px] text-danger`,children:[`config.json has an invalid worktreeSetup (`,e.worktreeSetupIssue,`) — saving replaces it.`]}),f===null?null:(0,$.jsx)(`p`,{"data-slot":`worktree-setup-invalid`,className:`text-[11px] text-danger`,children:f})]})}var I_=0,L_=1e3;function R_(){let e=mi();return e.isPending?(0,$.jsx)(`p`,{"data-slot":`worktrees-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading worktree settings…`}):e.isError?(0,$.jsx)(G,{icon:(0,$.jsx)(Rc,{}),tone:`danger`,title:`Worktree settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,$.jsx)(z_,{config:e.data})}function z_({config:e}){let t=V(),n=J({mutationFn:e=>N(e),onSuccess:e=>t.setQueryData(K.config,e),onError:e=>L(e.message,{tone:`danger`})}),[r,i]=(0,Q.useState)(String(e.worktreeRetention)),a=Number(r),o=r.trim()===``||!Number.isInteger(a)||a<I_||a>L_,s=e.worktreeRetention===(o?-1:a);return(0,$.jsxs)(`div`,{"data-slot":`worktrees-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,$.jsxs)(s_,{title:`Keep N finished worktrees`,hint:`Older finished worktrees are reclaimed to free disk; their branch is kept so the work stays recoverable. 0 = unlimited. In-review and running tasks are never reclaimed, so the count on disk can exceed this.`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:I_,max:L_,step:1,"aria-label":`Keep last N finished worktrees`,"data-slot":`resources-worktree-retention`,value:r,disabled:n.isPending,onChange:e=>i(e.target.value),className:`block w-32 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`}),(0,$.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`worktrees`}),(0,$.jsx)(B,{type:`button`,variant:`primary`,size:`sm`,className:`self-start`,"data-action":`resources-save-retention`,disabled:s||o||n.isPending,onClick:()=>n.mutate({worktreeRetention:a},{onSuccess:()=>{t.invalidateQueries({queryKey:K.worktrees}),L(a===0?`Keeping all worktrees (unlimited)`:`Keeping the last ${a} finished worktree${a===1?``:`s`}`)}}),children:`Save retention`})]}),o?(0,$.jsxs)(`p`,{"data-slot":`resources-retention-invalid`,className:`text-[11px] text-danger`,children:[`Enter a whole number from `,I_,` to `,L_,` (0 = unlimited).`]}):(0,$.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:a===0?`Keeping every finished worktree.`:`Keeping the last ${a} finished worktree${a===1?``:`s`} on disk.`})]}),(0,$.jsx)(F_,{config:e}),(0,$.jsxs)(Z,{to:`/git/cleanup`,"data-slot":`worktrees-manage-link`,className:`inline-flex min-h-11 items-center gap-1 self-start text-[13px] font-medium text-link-foreground hover:underline focus-visible:outline-2 focus-visible:outline-ring md:min-h-0`,children:[`Manage worktrees on Git`,(0,$.jsx)(S,{"aria-hidden":`true`,className:`size-[14px]`})]})]})}function B_(e,t){return function(){return(0,$.jsx)(G,{icon:(0,$.jsx)(t,{}),tone:`neutral`,title:e,subtitle:`This section arrives in a later phase of the redesign.`,heading:`h2`})}}var V_=[{id:`sidebar`,title:`Sidebar`,description:`Overall and per-section task limits for this project.`,icon:st,component:j_,scope:`project`},{id:`agents`,title:`Agents`,description:`Default runner, models and system prompt.`,icon:oe,component:ag,scope:`project`},{id:`agent-config`,title:`Agent config`,description:`Edit the coding agents’ own config files, per scope.`,icon:Lc,component:qh,scope:`project`},{id:`worktrees`,title:`Worktrees`,description:`How many finished task worktrees this project keeps on disk.`,icon:Rc,component:R_,scope:`project`},{id:`bookmarklets`,title:`Bookmarklets`,description:`Launch skills from a GitHub PR or issue.`,icon:mc,component:Yg,scope:`project`},{id:`prompt-templates`,title:`Prompt templates`,description:`Reusable snippets for follow-up instructions.`,icon:uo,component:v_,scope:`project`},{id:`appearance`,title:`Appearance`,description:`Theme, accent and density.`,icon:sn,component:Kg,scope:`global`},{id:`notifications`,title:`Notifications`,description:`Browser notifications when an agent needs you.`,icon:St,component:r_,scope:`global`},{id:`resources`,title:`Resources`,description:`Parallel tasks and per-task memory limit, across every project.`,icon:st,component:E_,scope:`global`},{id:`skills`,title:`Skills`,description:`Updates for skills installed on this machine.`,icon:F,component:O_,scope:`global`},{id:`accounts`,title:`Agent accounts`,description:`Second logins, and the agent and models a project uses when it has chosen none.`,icon:on,component:Ah,scope:`global`},{id:`projects`,title:`Projects`,description:`The workspace registry and where GitHub checkouts land.`,icon:a,component:d_,scope:`global`},{id:`keyboard`,title:`Keyboard`,description:`Shortcuts.`,icon:Kc,component:B_(`Keyboard`,Kc),scope:`global`,hidden:!0}];function H_(e,t){return V_.filter(n=>!n.hidden&&n.scope===e&&!(t?.singleProject===!0&&n.id===`projects`))}var U_={needsYou:0,failedUnread:0,inMotion:0,finishedUnread:0};function W_(e){let t={...U_};for(let n of e){if(n.archived||vr(n))continue;let e=Br(n);e.bucket===`waiting`?t.needsYou+=1:e.tone===`running`?t.inMotion+=1:rr(n)&&(n.status===`failed`?t.failedUnread+=1:n.status===`done`&&(t.finishedUnread+=1))}return t}function G_(e){let t=new Map;for(let n of e){let e=t.get(n.projectId);e?e.push(n):t.set(n.projectId,[n])}return new Map([...t].map(([e,t])=>[e,W_(t)]))}function K_(e,t,n={}){if(n.unknown)return`${e} · activity unknown`;let r=q_(t).map(e=>e.text);return[e,r.length>0?r.join(` · `):`idle`].join(` · `)}function q_(e){let{needsYou:t,failedUnread:n,inMotion:r,finishedUnread:i}=e??U_,a=[];return t>0&&a.push({tone:`amber`,text:`${t} needs you`}),n>0&&a.push({tone:`red`,text:`${n} failed`}),r>0&&a.push({tone:`violet`,text:`${r} working`}),i>0&&a.push({tone:`green`,text:`${i} finished`}),a}function J_(e){let t={...U_};for(let n of e)n&&(t.needsYou+=n.needsYou,t.failedUnread+=n.failedUnread,t.inMotion+=n.inMotion,t.finishedUnread+=n.finishedUnread);return t}function Y_(e){let t=e.split(/[-_ .]+/).filter(e=>e!==``);return(t.length>=2?[t[0],t[1]].map(e=>[...e][0]):[...t[0]??``].slice(0,2)).join(``).toLowerCase()}var X_=`w-[228px] rounded-[10px] border-border bg-sidebar p-[5px] text-foreground shadow-[0_10px_28px_#00000047] motion-reduce:animate-none`,Z_=`h-8 gap-2.5 rounded-[6px] px-[9px] py-0 text-[13px] focus:bg-sidebar-row-hover focus:text-foreground [&_svg]:size-[15px] [&_svg]:text-soft-foreground focus:[&_svg]:text-foreground max-md:min-h-11`;function Q_(){let e=xo(),t=W(),n=oi(),r=n.data?.bootProject??t.data?.bootProject,i=e??r??null,a=n.data?.projects.find(e=>e.id===i),o=i===r?t.data?.repo:void 0,s=a?.root??o?.root;return{health:t,registry:n,projectId:i,project:a,root:s,name:a?.name??s?.split(/[\\/]/).filter(Boolean).at(-1),branch:o?.branch??a?.branch}}function $_({onNavigate:e}={}){let t=(0,Q.useRef)(null),n=(0,Q.useRef)(null),[r,i]=(0,Q.useState)(0),{health:a,registry:o,projectId:s,project:c,root:l,name:u,branch:d}=Q_(),f=a.data?.capabilities.localHandoff===!0,p=u??(o.isPending?`Loading project…`:`Project unavailable`),m=[f?l:void 0,d].filter(Boolean).join(` · `);return(0,$.jsxs)(`div`,{"data-slot":`project-header`,className:`flex min-w-0 items-center gap-2.5 px-[14px] pt-[14px] pb-2.5`,children:[(0,$.jsx)(`span`,{ref:t,"aria-hidden":`true`,"data-slot":`project-header-mark`,className:`flex size-7 shrink-0 items-center justify-center rounded-[7px] border border-soft-foreground bg-sidebar-row-selected text-[11px] leading-none font-semibold text-foreground`,children:u?Y_(u):`…`}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-px`,children:[(0,$.jsx)(`div`,{"data-slot":`project-header-name`,className:`truncate text-[14px] font-semibold text-foreground`,title:p,children:p}),(0,$.jsx)(`div`,{"data-slot":`project-header-detail`,dir:`rtl`,className:`truncate text-left font-mono text-[10.5px] text-soft-foreground`,title:m||void 0,children:(0,$.jsx)(`bdi`,{dir:`ltr`,children:m||(o.isPending?`Loading…`:`Branch unavailable`)})})]}),(0,$.jsx)(ev,{projectId:s,onNavigate:e,triggerRef:n,triggerClassName:`size-7 max-md:size-11`,align:`start`,alignOffset:r,onOpenChange:e=>{e&&t.current&&n.current&&i(t.current.getBoundingClientRect().left-n.current.getBoundingClientRect().left)}})]})}function ev({projectId:e,onNavigate:t,triggerRef:n,triggerClassName:r,align:i=`start`,alignOffset:a,side:o,onOpenChange:s}){let c=yw(),l=W(),u=oi(),[d,f]=(0,Q.useState)(!1),p=u.data?.bootProject??l.data?.bootProject,m=vi(e??`default`,e!==null,e===p),h=zr(e??`default`,e===p?`default`:e??`default`),g=(0,Q.useRef)(e);g.current=e;let _=u.data?.projects.find(t=>t.id===e),v=e===p?l.data?.repo:void 0,y=_?.root??v?.root,b=l.data?.capabilities.localHandoff===!0,x=(m.data??[]).filter(e=>!vr(e)&&rr(e)),S=m.isError?`Unavailable`:m.data===void 0?`Loading…`:`${x.length} unread`;async function C(){f(!0);let t=0;try{for(let n of x){if(g.current!==e)break;try{await h.mutateAsync(n.id)}catch{t+=1}}t>0&&L(`Could not mark ${t} task${t===1?``:`s`} read. Try again.`,{tone:`danger`})}finally{f(!1)}}async function w(){if(y)try{await navigator.clipboard.writeText(y),L(`Project folder copied`)}catch{L(`Could not copy path: ${y}`,{tone:`danger`})}}return(0,$.jsxs)(Yo,{onOpenChange:s,children:[(0,$.jsx)(Ko,{asChild:!0,children:(0,$.jsx)(`button`,{"data-slot":`project-menu-trigger`,ref:n,type:`button`,"aria-label":`Project menu`,className:U(`flex shrink-0 items-center justify-center rounded-[6px] text-soft-foreground hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring data-[state=open]:bg-sidebar-row-selected data-[state=open]:text-foreground`,r),children:(0,$.jsx)(Pc,{"aria-hidden":`true`,className:`size-[15px]`})})}),(0,$.jsxs)(qo,{align:i,alignOffset:a,side:o,sideOffset:4,className:X_,children:[(0,$.jsxs)(Ho,{className:Z_,disabled:d||m.isError||m.data===void 0||x.length===0||e===null,onSelect:()=>{C()},children:[(0,$.jsx)(vc,{"aria-hidden":`true`}),` Mark all read`,(0,$.jsx)(`span`,{className:`ml-auto text-[11.5px] text-soft-foreground`,children:d?`Marking…`:S})]}),(0,$.jsx)(Uo,{className:`mx-0`}),b&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(tv,{projectId:e??`default`,disabled:!y||_?.status===`missing`}),(0,$.jsxs)(Ho,{className:Z_,disabled:!y,onSelect:()=>{w()},children:[(0,$.jsx)(kc,{"aria-hidden":`true`}),` Copy path`]}),(0,$.jsx)(Uo,{className:`mx-0`})]}),(0,$.jsx)(Ho,{asChild:!0,className:Z_,children:(0,$.jsxs)(Z,{to:`/settings`,onClick:t??c,children:[(0,$.jsx)(sl,{"aria-hidden":`true`}),` Project settings`]})})]})]})}function tv({disabled:e,projectId:t}){let n=ii(),r=J({mutationFn:e=>pe(e,t),onError:e=>L(e.message,{tone:`danger`}),onSuccess:()=>L(`Opening project folder`)}),i=(n.data?.targets??[]).filter(e=>vh(e.id)===void 0);return(0,$.jsxs)(Xo,{children:[(0,$.jsxs)(zo,{className:Z_,disabled:e||r.isPending,children:[(0,$.jsx)(Ta,{"aria-hidden":`true`}),` Open in`]}),(0,$.jsx)(Go,{children:(0,$.jsxs)(Ro,{className:X_,children:[i.map(e=>{let t=_h(e);return(0,$.jsxs)(Ho,{className:Z_,"data-target":e.id,onSelect:()=>r.mutate(e.id),children:[(0,$.jsx)(t,{"aria-hidden":`true`}),e.label]},e.id)}),i.length===0&&(0,$.jsx)(Ho,{className:Z_,disabled:!0,children:n.isError?`Apps unavailable`:n.isPending?`Loading apps…`:`No apps available`})]})})]})}function nv(){let e=xo(),t=oi().data;return e===null?null:t?.projects.find(t=>t.id===e)?.root??null}function rv(e){navigator.clipboard.writeText(e).then(()=>L(`Project folder copied`)).catch(()=>L(e))}function iv(){let e=nv();return e===null?null:(0,$.jsx)(s_,{title:`Project folder`,hint:`Where this project lives on disk. Every task worktree, git command and agent run resolves against it.`,children:(0,$.jsxs)(`div`,{"data-slot":`project-location`,"data-variant":`field`,className:`flex flex-col gap-3`,children:[(0,$.jsx)(`span`,{"data-slot":`project-location-path`,className:`w-full min-w-0 rounded-md border border-border bg-background p-3 text-[13px] break-all text-foreground`,children:e}),(0,$.jsxs)(`div`,{className:`flex w-full flex-wrap items-center gap-2 border-t border-border pt-4`,children:[(0,$.jsxs)(`button`,{type:`button`,"data-action":`project-location-copy`,title:`Copy the project folder path`,onClick:()=>rv(e),className:`inline-flex min-h-11 items-center gap-2 rounded-md border border-border bg-card px-3 text-xs text-foreground transition-colors hover:bg-muted`,children:[(0,$.jsx)(Oe,{"aria-hidden":`true`,className:`size-4`}),`Copy path`]}),(0,$.jsx)(av,{root:e})]})]})})}function av({root:e}){let t=ii(),n=J({mutationFn:e=>pe(e),onError:e=>L(e.message,{tone:`danger`})}),r=(t.data?.targets??[]).filter(e=>vh(e.id)===void 0).map(e=>({target:e}));return r.length===0?null:(0,$.jsx)(yh,{slot:`project-location-open`,label:`Open with`,triggerVariant:`outline`,title:e,disabled:n.isPending,choices:r,onPick:e=>n.mutate(e,{onSuccess:()=>L(`Opening the project folder in ${r.find(t=>t.target.id===e)?.target.label??e}`)})})}function ov({project:e}){let t=Ur(),n=or(),r=(0,Q.useId)(),i=(0,Q.useId)(),a=(0,Q.useId)(),[o,s]=(0,Q.useState)(e.webhook?.url??``),[c,l]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(null),f=e.webhook,p=o.trim(),m=p!==(f?.url??``)||c!==``,h=t.isPending||n.isPending,g=n=>{p&&t.mutate({id:e.id,webhook:{url:p,...c?{token:c}:{}}},{onSuccess:()=>{l(``),n?n():L(`Task webhook saved`)},onError:e=>L(e.message,{tone:`danger`})})},_=()=>n.mutate(e.id,{onSuccess:e=>d(e.dryRun?{ok:!0,text:`Dry run: nothing was sent.`}:e.ok?{ok:!0,text:`Delivered (HTTP ${e.status??200}).`}:{ok:!1,text:`Not delivered: ${e.error??`unknown error`}.`}),onError:e=>d({ok:!1,text:e.message})});return(0,$.jsx)(s_,{title:`Task webhook`,hint:`Tasks you hand off, or start with notify on, POST their status changes here with the token as a Bearer header.`,children:(0,$.jsxs)(`form`,{"data-slot":`task-webhook`,className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),d(null),g()},children:[(0,$.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[(0,$.jsxs)(`label`,{htmlFor:r,className:`flex flex-col gap-1 text-[13px]`,children:[(0,$.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:`URL`}),(0,$.jsx)(wm,{id:r,"data-slot":`task-webhook-url`,type:`url`,inputMode:`url`,autoComplete:`off`,spellCheck:!1,placeholder:`https://bot.example/hooks/cez`,value:o,onChange:e=>s(e.target.value)})]}),(0,$.jsxs)(`label`,{htmlFor:i,className:`flex flex-col gap-1 text-[13px]`,children:[(0,$.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:`Token`}),(0,$.jsx)(wm,{id:i,"data-slot":`task-webhook-token`,type:`password`,autoComplete:`new-password`,spellCheck:!1,"aria-describedby":a,placeholder:f?.tokenSet?`Token set — type to replace`:`Optional Bearer token`,value:c,onChange:e=>l(e.target.value)})]})]}),(0,$.jsx)(`p`,{id:a,className:`-mt-1 text-[11px] text-soft-foreground`,children:f?.tokenSet?`The token is stored in ~/.cezar and never shown again. Leave it empty to keep it.`:`The token is stored in ~/.cezar, never in the repo.`}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(B,{type:`submit`,size:`sm`,className:`max-sm:h-11`,"data-action":`task-webhook-save`,disabled:h||!p||!m,children:`Save`}),(0,$.jsx)(B,{type:`button`,size:`sm`,className:`max-sm:h-11`,variant:`outline`,"data-action":`task-webhook-test`,disabled:h||!p,onClick:()=>{d(null),m?g(_):_()},children:`Send test`}),f?.tokenSet?(0,$.jsx)(B,{type:`button`,size:`sm`,className:`max-sm:h-11`,variant:`ghost`,"data-action":`task-webhook-clear-token`,disabled:h,onClick:()=>t.mutate({id:e.id,webhook:{url:f.url,token:``}},{onSuccess:()=>L(`Webhook token cleared`),onError:e=>L(e.message,{tone:`danger`})}),children:`Clear token`}):null,f?(0,$.jsx)(B,{type:`button`,size:`sm`,className:`max-sm:h-11`,variant:`danger-ghost`,"data-action":`task-webhook-remove`,disabled:h,onClick:()=>t.mutate({id:e.id,webhook:null},{onSuccess:()=>{s(``),l(``),d(null),L(`Task webhook removed`)},onError:e=>L(e.message,{tone:`danger`})}),children:`Remove`}):null]}),u?(0,$.jsx)(`p`,{"data-slot":`task-webhook-result`,role:`status`,className:u.ok?`text-[13px] text-muted-foreground`:`text-[13px] text-danger`,children:u.text}):null]})})}function sv(e){let t=new Date(e);return Number.isNaN(t.getTime())?`—`:t.toLocaleDateString(void 0,{year:`numeric`,month:`short`,day:`numeric`})}function cv({capabilities:e}){let t=xo(),n=oi(),r=Wr();if(n.isPending)return(0,$.jsx)(`p`,{"data-slot":`project-general-loading`,className:`text-[13px] text-soft-foreground`,children:`Loading project…`});if(n.isError)return(0,$.jsxs)(`p`,{"data-slot":`project-general-error`,className:`text-[13px] text-danger`,children:[`Could not read the project registry — `,n.error.message]});let i=n.data,a=i?.projects.find(e=>e.id===t);if(!i||!a)return null;let o=e?.singleProject!==!0;return(0,$.jsxs)(`div`,{"data-slot":`project-general`,className:`flex w-full flex-col gap-5`,children:[(0,$.jsxs)(`section`,{className:`flex flex-col gap-5 rounded-lg border border-border bg-card p-5 [&_select]:min-h-11 [&_select]:w-full`,children:[(0,$.jsx)(`h2`,{className:`text-lg font-semibold`,children:`General`}),(0,$.jsx)(iv,{}),(0,$.jsx)(lv,{project:a,canRemove:o}),o?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(s_,{title:`Max parallel tasks`,hint:r.data?`The workspace limit (${r.data.resources.maxParallel}) still applies as an overall ceiling.`:`How many of this project's tasks may run at once. The workspace limit still applies as an overall ceiling.`,children:r.data?(0,$.jsx)(__,{project:a,workspaceMax:r.data.resources.maxParallel}):(0,$.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:`Loading the workspace limit…`})}),(0,$.jsx)(ov,{project:a},a.id)]}):null]}),o?(0,$.jsx)(`section`,{className:`rounded-lg border border-border bg-card p-5`,children:(0,$.jsx)(uv,{project:a,bootProject:i.bootProject})}):null]})}function lv({project:e,canRemove:t}){return(0,$.jsxs)(`dl`,{"data-slot":`project-facts`,className:`grid grid-cols-1 gap-4 text-[13px] sm:grid-cols-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-[11px] text-muted-foreground`,children:`Project`}),(0,$.jsx)(`dd`,{className:`mt-1 font-medium`,children:e.name})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-[11px] text-muted-foreground`,children:`Branch`}),(0,$.jsx)(`dd`,{className:`mt-1 break-all`,children:e.branch??`—`})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-[11px] text-muted-foreground`,children:`Status`}),(0,$.jsxs)(`dd`,{"data-slot":`project-general-status`,className:e.status===`missing`?`mt-1 text-danger`:`mt-1`,children:[l_[e.status],e.status===`missing`?t?` — remove it below, or restore the folder`:` — restore the folder at the path above`:null]})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-[11px] text-muted-foreground`,children:`Added`}),(0,$.jsxs)(`dd`,{className:`mt-1`,children:[sv(e.addedAt),(0,$.jsx)(`span`,{className:`text-soft-foreground`,children:e.source===`checkout`?` · cloned from GitHub`:` · opened locally`})]})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-[11px] text-muted-foreground`,children:`Last opened`}),(0,$.jsx)(`dd`,{className:`mt-1`,children:sv(e.lastOpenedAt)})]})]})}function uv({project:e,bootProject:t}){let[n,r]=(0,Q.useState)(null),i=a_(),a=Ne(),o=e.id===t;return(0,$.jsxs)(s_,{title:`Remove from workspace`,hint:`Unregisters this project so it leaves the sidebar and the project list. Nothing on disk is deleted — the folder, its git history and its task history all stay, and opening it again re-registers it.`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsxs)(B,{type:`button`,variant:`outline`,size:`sm`,"data-action":`project-general-remove`,"aria-label":`Remove ${e.name} from the workspace — unregisters it, no files are deleted`,title:o?`cezar is serving this project — it re-registers itself at every start`:void 0,disabled:o||i.isPending,onClick:()=>r(e),className:`text-danger`,children:[`Remove `,e.name]}),o?(0,$.jsx)(`span`,{"data-slot":`project-general-remove-boot`,className:`text-[11px] text-soft-foreground`,children:`cezar is serving this project — it re-registers itself at every start.`}):null]}),(0,$.jsx)(o_,{project:n,onOpenChange:e=>!e&&r(null),onConfirm:()=>{r(null),i.confirm(e,()=>void a(`/p/${encodeURIComponent(t)}`))}})]})}function dv(e,t){return e===`global`?`/settings/global/${t}`:`/settings/${t}`}var fv=dv(`global`,`appearance`);function pv(e){return e===`global`?{Link:o,NavLink:Ct}:{Link:Z,NavLink:bo}}function mv({scope:e,title:t,mobileTitle:n}){let r=Q_().name;return(0,$.jsxs)(`header`,{"data-slot":`settings-main-header`,className:`settings-route-header flex shrink-0 flex-col gap-2`,children:[(0,$.jsxs)(`h1`,{className:`text-[15px] font-semibold tracking-normal max-md:text-[24px] max-md:font-normal`,children:[(0,$.jsx)(`span`,{className:`md:hidden`,children:n}),(0,$.jsxs)(`span`,{className:`max-md:hidden`,children:[t,` · `,e===`global`?`every project`:r??`this project`]})]}),e===`global`?(0,$.jsx)(`span`,{"data-slot":`settings-scope-chip`,className:`sr-only`,children:`Global settings`}):null]})}function hv({scope:e,activeId:t,capabilities:n}){let{NavLink:r}=pv(e),i=H_(e,n);return(0,$.jsxs)(`details`,{className:`settings-section-picker md:hidden`,children:[(0,$.jsxs)(`summary`,{children:[i.find(e=>e.id===t)?.title??`General`,(0,$.jsx)(ge,{"aria-hidden":`true`,className:`size-5 text-muted-foreground`})]}),(0,$.jsxs)(`nav`,{"aria-label":`Settings sections`,"data-slot":`settings-nav-mobile`,"data-scope":e,children:[e===`project`?(0,$.jsx)(r,{to:`/settings`,end:!0,"data-slot":`settings-nav-index`,children:`General`}):null,i.map(t=>(0,$.jsx)(r,{to:dv(e,t.id),"data-section":t.id,children:t.title},t.id))]})]},`${e}-${t}`)}function gv({section:e,scope:t,capabilities:n}){let r=e.component;return(0,$.jsxs)(`div`,{"data-route":t===`global`?`settings-global-${e.id}`:`settings-${e.id}`,className:`settings-route mx-auto flex min-h-full w-full flex-col`,children:[(0,$.jsx)(mv,{scope:t,title:e.title,mobileTitle:t===`global`?`Global settings`:`Project settings`}),(0,$.jsxs)(`div`,{className:`settings-route-body flex min-w-0 flex-1 flex-col md:flex-row`,children:[(0,$.jsx)(hv,{scope:t,activeId:e.id,capabilities:n}),(0,$.jsxs)(`section`,{className:`settings-panel min-w-0 self-start md:flex-1`,"aria-label":e.title,children:[(0,$.jsx)(`h2`,{className:`settings-panel-title`,children:e.title}),(0,$.jsx)(r,{})]})]})]})}function _v({capabilities:e}){return(0,$.jsxs)(`div`,{"data-route":`settings`,className:`settings-route mx-auto flex min-h-full w-full flex-col`,children:[(0,$.jsx)(mv,{scope:`project`,title:`General`,mobileTitle:`Project settings`}),(0,$.jsxs)(`div`,{className:`settings-route-body flex min-w-0 flex-1 flex-col md:flex-row`,children:[(0,$.jsx)(hv,{scope:`project`,activeId:null,capabilities:e}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,$.jsx)(cv,{capabilities:e}),(0,$.jsx)(`h2`,{className:`settings-other-title mt-6 rounded-t-lg border border-b-0 border-border bg-card px-5 pt-5 text-base font-semibold md:hidden`,children:`Other project settings`}),(0,$.jsx)(`ul`,{"data-slot":`settings-index`,className:`mt-7 flex w-full flex-col gap-5 md:hidden`,children:H_(`project`,e).map(e=>(0,$.jsx)(`li`,{children:(0,$.jsxs)(Z,{to:dv(`project`,e.id),"data-section":e.id,className:`flex items-center gap-3.5 rounded-lg border border-border bg-card p-4 transition-colors hover:bg-card-2`,children:[(0,$.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center text-accent-text`,children:(0,$.jsx)(e.icon,{"aria-hidden":`true`,className:`size-4`})}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`span`,{className:`block text-sm font-medium text-foreground`,children:e.title}),(0,$.jsx)(`span`,{className:`block text-xs text-soft-foreground`,children:e.description})]}),(0,$.jsx)(S,{"aria-hidden":`true`,className:`size-4 shrink-0 text-soft-foreground`})]})},e.id))}),(0,$.jsxs)(`p`,{className:`mt-5 w-full text-[12px] text-soft-foreground`,children:[`Appearance, notifications, host resources and the project registry live in`,` `,(0,$.jsx)(o,{to:fv,"data-slot":`settings-global-link`,className:`underline underline-offset-2 hover:text-foreground`,children:`Global settings`}),`.`]})]})]})]})}function vv(e){if(e<1e3)return String(e);let t=[`k`,`M`,`B`,`T`],n=Math.floor(Math.log10(e)/3);return n>t.length?e.toExponential(0).replace(`+`,``):`${Math.floor(e/1e3**n)}${t[n-1]}`}function yv({stat:e,className:t,compact:n=!1}){let r=`+${e.adds} −${e.dels} across ${e.files} ${e.files===1?`file`:`files`}`,i=e.repointed?`${r} — measured against another branch checked out in this task's worktree, as this task found it`:void 0;return(0,$.jsxs)(`span`,{"data-slot":`diff-stat`,...i?{"data-repointed":`true`,"aria-label":i}:{},...n&&!i?{"aria-label":r}:{},title:i??r,className:U(`font-mono text-xs font-semibold tabular-nums`,e.repointed&&`cursor-help underline decoration-dotted underline-offset-2`,t),children:[(0,$.jsxs)(`span`,{className:`text-success`,children:[`+`,n?vv(e.adds):e.adds.toLocaleString(`en-US`)]}),` `,(0,$.jsxs)(`span`,{className:`text-danger`,children:[`−`,n?vv(e.dels):e.dels.toLocaleString(`en-US`)]})]})}function bv(e){return e===void 0?`unknown`:new Intl.NumberFormat().format(e)}function xv(e,t){return`Input tokens: ${bv(e)}; output tokens: ${bv(t)}`}function Sv(e,t,n=`compact`){let r=e===void 0?`—`:To(e),i=t===void 0?`—`:To(t);return n===`table`?`${r} / ${i}`:`IN ${r} · OUT ${i}`}function Cv({inputTokens:e,outputTokens:t,variant:n=`compact`,omitWhenUnknown:r=!0,className:i,title:a}){return r&&e===void 0&&t===void 0?null:(0,$.jsx)(`span`,{"data-slot":`directional-usage`,"aria-label":xv(e,t),title:a,className:U(`font-mono tabular-nums`,i),children:Sv(e,t,n)})}function wv(e,t){let[n,r]=(0,Q.useState)(!1),[i,a]=(0,Q.useState)(``),o=(0,Q.useRef)(!1);return{editing:n,draft:i,setDraft:a,begin:()=>{a(e),o.current=!1,r(!0)},commit:()=>{if(o.current)return;o.current=!0,r(!1);let n=i.trim();n.length===0||n===e||t(n)},cancel:()=>{o.current=!0,r(!1)}}}function Tv({editor:e,className:t}){return(0,$.jsx)(`input`,{"data-slot":`title-input`,"aria-label":`Task title`,autoFocus:!0,value:e.draft,onChange:t=>e.setDraft(t.target.value),onBlur:e.commit,onKeyDown:t=>{t.key===`Enter`?(t.preventDefault(),e.commit()):t.key===`Escape`&&(t.preventDefault(),e.cancel())},className:U(`w-full min-w-0 rounded-sm border border-border bg-card px-1.5 py-0.5 outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,t)})}function Ev({className:e,dot:t,shape:n=`filled`,pulse:r=!1,children:i,...a}){return(0,$.jsxs)(`span`,{"data-slot":`pill`,className:U(`inline-flex items-center gap-1.5 rounded-full bg-muted px-2.5 py-[3px] text-xs font-medium whitespace-nowrap text-muted-foreground`,e),...a,children:[t?(0,$.jsx)(aa,{tone:t,shape:n,pulse:r}):null,i]})}function Dv({pinned:e,onToggle:t,className:n}){return(0,$.jsx)(`button`,{type:`button`,"data-slot":`pin-toggle`,"data-pinned":e?`true`:void 0,"aria-pressed":e,"aria-label":e?`Unpin task`:`Pin task`,title:e?`Unpin from the top of the list`:`Pin to the top of the list`,onClick:n=>{n.stopPropagation(),t(!e)},className:U(`inline-flex size-5 shrink-0 items-center justify-center rounded-sm text-soft-foreground transition-colors motion-reduce:transition-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,n,`max-md:min-h-11 max-md:min-w-11 no-hover:min-h-11 no-hover:min-w-11`),children:(0,$.jsx)(rl,{"data-slot":`pin-icon`,className:`size-[12px]`,fill:e?`currentColor`:`none`,"aria-hidden":`true`})})}var Ov=(0,Q.createContext)(null);function kv({children:e}){let[t,n]=(0,Q.useState)(()=>new Map),r=(0,Q.useCallback)((e,t)=>{n(n=>{let r=new Map(n);return r.set(e,t),r})},[]),i=(0,Q.useCallback)(e=>{n(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},[]),a=Kr((0,Q.useMemo)(()=>[...t.values()].flat(),[t])),o=(0,Q.useMemo)(()=>({publish:r,retract:i,lookup:a}),[r,i,a]);return(0,$.jsx)(Ov.Provider,{value:o,children:e})}var Av=(0,Q.createContext)(null);function jv({projectId:e,repoBase:t,requests:n,children:r}){let i=(0,Q.useContext)(Ov),a=(0,Q.useContext)(Av),o=(0,Q.useId)();(0,Q.useEffect)(()=>{if(i)return i.publish(o,n),()=>i.retract(o)},[i,o,n.map(e=>`${e.projectId} ${e.kind}#${e.number}`).sort().join(`|`)]);let s=Kr(i?Mv:n),c=i?.lookup??s,l=t??(a&&a.projectId===e?a.repoBase:void 0),u=(0,Q.useMemo)(()=>({lookup:c,projectId:e,repoBase:l}),[c,e,l]);return(0,$.jsx)(Av.Provider,{value:u,children:r})}var Mv=[];function Nv(e,t,n){let r=(0,Q.useContext)(Av),i=n??r?.projectId;return!r||!i||t===void 0?Fv:r.lookup({projectId:i,kind:e,number:t})}function Pv(){let e=(0,Q.useContext)(Av);return{projectId:e?.projectId,repoBase:e?.repoBase}}var Fv=Object.freeze({state:`idle`}),Iv={success:`border-success/40 text-success`,danger:`border-danger/40 text-danger`,accent:`border-accent-strong/35 text-accent-text`,merged:`border-merged-strong/35 text-merged-text`,info:`border-info/40 text-info`,neutral:`border-border text-muted-foreground`,pending:`border-pending-strong/45 text-pending-strong`,conflict:`border-conflict/45 text-conflict`},Lv={success:`text-success`,danger:`text-danger`,accent:`text-merged-text`,merged:`text-merged-text`,info:`text-info`,neutral:`text-soft-foreground`,pending:`text-pending-strong`,conflict:`text-conflict`},Rv={success:`hover:bg-success/10`,danger:`hover:bg-danger/10`,accent:`hover:bg-accent-strong/10`,merged:`hover:bg-merged-strong/10`,info:`hover:bg-info/10`,neutral:`hover:bg-muted`,pending:`hover:bg-pending-strong/10`,conflict:`hover:bg-conflict/10`},zv={draft:Ze,"review-required":Vt,"changes-requested":Ft,"checks-pending":null,"checks-failing":Me,ready:P,merged:Xt,closed:xt,open:ye,completed:P,"not-planned":c};function Bv({reference:e,taskTitle:t,status:n,conflicting:r,conflictAction:i,projectId:a,to:o,className:s,compact:c=!1,plain:l=!1,inert:u=!1}){let{kind:d,number:f,url:p}=e,m=Nv(d,f,a),h=n??m.status,g=Lr(h),_=d===`PR`&&(r??m.conflicting)===!0,v=_?Nr:g,y=l?U(`inline-flex items-center gap-1 rounded-[2px] text-inherit`,_&&`text-conflict font-medium`,!u&&`group/reference focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-link-foreground`,s):U(`inline-flex h-[22px] items-center gap-1 rounded-md border px-1.5 font-mono text-[12px] font-normal`,Iv[v?.tone??`accent`],s),b=qv(m,v,_?g:void 0),x=l?f?`${d===`PR`?`PR `:``}#${f}`:d:f?`${!c&&d===`Issue`?`Issue `:``}#${f}`:d,S=d===`PR`?`pull request`:`issue`,C=`Open the ${S} for ${t}${v?` — ${v.label}`:``}`,w=l&&v?Lv[v.tone]:void 0,T=(0,$.jsxs)($.Fragment,{children:[_?(0,$.jsx)(_e,{className:U(`size-2.5 shrink-0`,w),"aria-hidden":`true`}):(0,$.jsx)(Xv,{status:v?h:void 0,className:l?U(`size-2.5`,w):void 0}),l?(0,$.jsx)(`span`,{className:u?void 0:`underline-offset-2 group-hover/reference:underline group-focus-visible/reference:underline`,children:x}):x]});if(l&&u)return(0,$.jsx)(`span`,{"data-slot":d===`PR`?`pr-chip`:`issue-chip`,"data-status":h,"data-inert":`true`,..._?{"data-conflicting":`true`}:{},className:y,children:T});let E=!o&&(!p||!Ln(p))?(0,$.jsx)(`span`,{"data-slot":d===`PR`?`pr-chip`:`issue-chip`,"data-status":h,..._?{"data-conflicting":`true`}:{},"aria-label":v?`${S} ${x} — ${v.label}`:void 0,className:y,children:T}):(0,$.jsx)(Vv,{to:o,url:p,"data-slot":d===`PR`?`pr-chip`:`issue-chip`,"data-status":h,..._?{"data-conflicting":`true`}:{},title:b?void 0:p,"aria-label":C,className:l?y:U(y,Rv[v?.tone??`accent`]),children:T});if(!b)return E;let D=(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`span`,{className:`block font-medium`,children:[d===`PR`?`Pull request`:`Issue`,f?` #${f}`:``,` · `,b.headline]}),(0,$.jsx)(`span`,{className:`block`,children:b.detail}),b.also?(0,$.jsx)(`span`,{className:`block opacity-70`,children:b.also}):null,p&&Ln(p)?(0,$.jsx)(`span`,{className:`block opacity-70`,children:p.replace(/^https?:\/\//,``)}):null]});return(0,$.jsx)(Kv,{chip:E,action:_?i:void 0,state:m.state,children:D})}function Vv({to:e,url:t,children:n,...r}){return e?(0,$.jsx)(o,{to:e,...r,children:n}):(0,$.jsx)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,...r,children:n})}var Hv=(0,Q.createContext)(()=>{});function Uv(){return(0,Q.useContext)(Hv)}var Wv=150,Gv=120;function Kv({chip:e,action:t,state:n,children:r}){let[i,a]=(0,Q.useState)(!1),o=(0,Q.useRef)(null),s=(0,Q.useRef)(null),c=(0,Q.useRef)(void 0),l=(0,Q.useCallback)((e,t)=>{clearTimeout(c.current),c.current=setTimeout(()=>a(e),t)},[]),u=(0,Q.useCallback)(()=>{clearTimeout(c.current),a(!1)},[]);(0,Q.useEffect)(()=>()=>clearTimeout(c.current),[]);let d=e=>e instanceof Node&&(s.current?.contains(e)||o.current?.contains(e));return(0,$.jsxs)(Ea,{open:i,onOpenChange:e=>e?a(!0):u(),children:[(0,$.jsx)(Sa,{asChild:!0,ref:o,onPointerEnter:e=>{e.pointerType!==`touch`&&l(!0,Wv)},onPointerLeave:e=>{e.pointerType!==`touch`&&l(!1,Gv)},onFocus:()=>a(!0),onBlur:e=>{d(e.relatedTarget)||u()},onKeyDown:e=>{if(e.key===`Escape`)return u();if(e.key!==`Tab`||e.shiftKey||!t)return;let n=s.current?.querySelector(`button:not([disabled]), [href], input, select, textarea, [tabindex]:not([tabindex="-1"])`);n&&(e.preventDefault(),n.focus())},...t?{"aria-haspopup":`dialog`,"aria-expanded":i}:{},children:e}),(0,$.jsxs)(wa,{ref:s,side:`top`,role:t?`dialog`:`tooltip`,"data-slot":`reference-status-card`,"data-tooltip-state":n,className:`w-64 space-y-2 p-3 text-xs`,onOpenAutoFocus:e=>e.preventDefault(),onCloseAutoFocus:e=>{e.preventDefault(),d(document.activeElement)&&o.current?.focus()},onPointerEnter:()=>clearTimeout(c.current),onPointerLeave:e=>{e.pointerType!==`touch`&&l(!1,Gv)},children:[(0,$.jsx)(`div`,{className:`space-y-0.5`,children:r}),t?(0,$.jsx)(Hv.Provider,{value:u,children:t}):null]})]})}function qv(e,t,n){if(t){let{label:r,hint:i}=t,a=n?`also ${Jv(n.label)} — ${n.hint}`:void 0;return e.state===`unavailable`?{headline:r,detail:`last known — GitHub is unreachable${e.reason?` (${e.reason})`:``}`,...a?{also:a}:{}}:{headline:r,detail:i,...a?{also:a}:{}}}switch(e.state){case`loading`:return{headline:`Checking GitHub…`,detail:`the status of this reference is on its way`};case`unavailable`:return{headline:`Status unavailable`,detail:e.reason??`GitHub could not be reached — the chip says nothing rather than guessing`};case`unknown`:return{headline:`Not found on this repository`,detail:`GitHub has no such number here — the reference may point at another repo`};default:return null}}function Jv(e){return e.charAt(0).toLowerCase()+e.slice(1)}function Yv({kind:e,number:t,className:n}){let r=Nv(e,t),i=Lr(r.status),a=e===`PR`&&r.conflicting===!0,o=a?Nr:i;if(!o)return null;let s=U(`size-2.5`,Lv[o.tone]);return(0,$.jsx)(`span`,{"data-slot":`reference-status-glyph`,"data-status":r.status,...a?{"data-conflicting":`true`}:{},"aria-hidden":`true`,className:U(`inline-flex items-center`,n),children:a?(0,$.jsx)(_e,{className:U(`shrink-0`,s),"aria-hidden":`true`}):(0,$.jsx)(Xv,{status:r.status,className:s})})}function Xv({status:e,className:t}){if(!e)return null;if(e===`checks-pending`)return(0,$.jsx)(gn,{"data-slot":`status-dot`,"data-tone":`pending`,className:U(`size-3 animate-pulse motion-reduce:animate-none`,t),"aria-hidden":`true`});let n=zv[e];return n?(0,$.jsx)(n,{className:U(`size-2.5 shrink-0`,t),"aria-hidden":`true`}):null}var Zv={claude:`Claude Code`,codex:`Codex`,opencode:`OpenCode`,pi:`pi`,cursor:`Cursor`,omp:`OMP`};function Qv(e){let t=e.currentStepId?e.steps.find(t=>t.id===e.currentStepId):void 0;if(t?.backend)return t.backend;if(e.runner)return e.runner;for(let t=e.steps.length-1;t>=0;--t){let n=e.steps[t]?.backend;if(n)return n}return`claude`}function $v(e){return e.runner??`claude`}function ey(e,t){let n=g(t,e);return n?.enabled===!1?{provider:e,usable:!1,reason:`${Zv[e]} is disabled. Enable it in Settings → Agents → Providers.`}:n?.status===`connected`?{provider:e,usable:!0}:{provider:e,usable:!1,reason:`${Zv[e]} credentials are unavailable. Authorize it in Settings → Agents → Providers.`}}function ty(e,t){return ey(Qv(e),t)}function ny(e,t){return ey($v(e),t)}function ry(e){let t=Ai(),n=Qv(e);return t.isSuccess&&t.data?ty(e,t.data):{provider:n,usable:!0}}function iy(e){let t=Ai(),n=$v(e);return t.isSuccess&&t.data?ny(e,t.data):t.isError?{provider:n,usable:!1,reason:`Provider authentication could not be verified.`}:{provider:n,usable:!1,reason:`Checking agent providers…`}}function ay(e){return e===`running`||e===`queued`||e===`waiting`}function oy(e){return[...e.steps].reverse().find(e=>e.sessionId)?.sessionId}function sy(e){return[...e.steps].reverse().find(e=>e.sessionId)?.backend??e.runner??`claude`}var cy=/^[A-Za-z0-9._][A-Za-z0-9._-]{0,199}$/;function ly(e,t){if(cy.test(t))switch(e){case`codex`:return`codex resume ${t}`;case`cursor`:return;case`opencode`:return`opencode --session ${t}`;case`pi`:return`pi --session ${t}`;case`omp`:return;default:return`claude --resume ${t}`}}function uy(e){if(ay(e.status))return;let t=oy(e);if(t===void 0||!cy.test(t))return;let n=sy(e),r=n===`cursor`||n===`omp`?e.cliResumeCommand:ly(n,t);if(r!==void 0)return e.worktreePath?`cd ${e.worktreePath} && ${r}`:r}function dy(e,t){let n=vh(t);return!n||ay(e.status)?!1:n===sy(e)&&oy(e)!==void 0}function fy(e){return e.status===`cancelled`&&e.startedAt===void 0&&e.workflowDef!==void 0&&e.steps.every(e=>e.status===`pending`&&e.startedAt===void 0&&!e.sessionId)}function py(e){let t=ay(e.status),n=oy(e)!==void 0;return{finish:e.status===`waiting`||e.status===`review`,continueRun:!t&&!e.stopping&&e.delegation?.role!==`invalid`&&!(e.delegation?.role===`worker`&&e.delegation.destroy)&&(n||fy(e)),terminal:!t&&n,notes:!0,archive:!t,pin:!e.archived&&!vr(e),markUnread:Ji(e)&&!rr(e),cancel:t,deleteRun:!t}}function my(e,t=!1){return e.status===`waiting`&&e.finishBlocked===null&&Br(e,t).bucket===`waiting`}function hy(e){return`Merge head branch and resolve conflicts in ${e?`PR number ${e}`:`this pull request`}`}function gy(e){return e===`review`?`Accept the changes without a PR`:`Close the session`}function _y(e,t){let n=e.filter(e=>!e.archived&&e.status===`queued`).sort((e,t)=>e.createdAt.localeCompare(t.createdAt)).findIndex(e=>e.id===t);return n>=0?n+1:void 0}var vy=[50,100,200,400,800,1e3,1e3,1e3,1e3],yy=e=>new Promise(t=>setTimeout(t,e));function by(e){return e instanceof E&&e.status===409&&e.message===`run is still active`}async function xy(e,t=yy){for(let n=0;;n+=1)try{return await e()}catch(e){let r=vy[n];if(!by(e)||r===void 0)throw e;await t(r)}}function Sy(e){return ay(e.status)?`live`:py(e).continueRun?`resume`:`unavailable`}function Cy(e,t){let n=cr(e.id,t),r=yr(e.id,t),i=ry(e),a=iy(e),[o,s]=(0,Q.useState)(void 0),[c,l]=(0,Q.useState)(!1),u=(0,Q.useRef)(!1),d=Sy(e),f=d===`resume`?!a.usable:d===`live`&&!i.usable,p=d===`unavailable`?`no-session`:f?`provider`:void 0,m=p===`no-session`?`This session has ended and no agent session was recorded, so the answer cannot be delivered.`:p===`provider`?d===`resume`?a.reason:i.reason:void 0,h=(e,t)=>a.usable?r.mutateAsync({text:e,...t===void 0?{}:{images:t}}):Promise.reject(Error(a.reason??`The run provider is unavailable.`));return{mode:d,blockedBy:p,reason:m,isPending:c||n.isPending||r.isPending,error:o,send:async(t,r)=>{if(p||u.current)return m;u.current=!0,l(!0),s(void 0);try{if(d===`resume`){await xy(()=>h(t,r));return}try{await n.mutateAsync({text:t,...r===void 0?{}:{images:r}})}catch(n){if(n instanceof E&&n.status===409&&oy(e)!==void 0){try{await xy(()=>h(t,r))}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`Session closed. Retry to reopen the session. ${t}`)}return}throw n}return}catch(e){let t=e instanceof Error?e.message:String(e);return s(t),t}finally{u.current=!1,l(!1)}}}}function wy({run:e,projectId:t,prNumber:n}){let r=Cy(e,t),i=Uv(),[a,o]=(0,Q.useState)(!1),s=a||r.isPending,c=!!r.blockedBy,l=async()=>{if(s||c)return;let e=r.mode===`resume`;o(!0);try{let t=await r.send(hy(n));t?L(t,{tone:`danger`}):(L(`${e?`Task reopened`:`Sent to the task`} — resolving conflicts${n?` in PR #${n}`:``}`),i())}finally{o(!1)}};return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(B,{type:`button`,size:`sm`,"data-slot":`reference-conflict-action`,disabled:c||s,onClick:()=>void l(),className:`h-7 w-full text-xs`,children:s?`Sending…`:`Resolve conflicts`}),c&&r.reason?(0,$.jsx)(`span`,{className:`block opacity-70`,children:r.reason}):null]})}function Ty({projectId:e,runId:t,prNumber:n}){let r=ei(e,t);return r.data?(0,$.jsx)(wy,{run:r.data,projectId:e,prNumber:n}):(0,$.jsx)(B,{type:`button`,size:`sm`,disabled:!0,className:`h-7 w-full text-xs`,children:r.isError?`Unavailable`:`Loading…`})}function Ey({runId:e,prNumber:t}){let{projectId:n}=Pv();return n===void 0?(0,$.jsx)(Dy,{runId:e,prNumber:t}):(0,$.jsx)(Ty,{projectId:n,runId:e,prNumber:t})}function Dy({runId:e,prNumber:t}){let n=Sr(e);return n.data?(0,$.jsx)(wy,{run:n.data,prNumber:t}):(0,$.jsx)(B,{type:`button`,size:`sm`,disabled:!0,className:`h-7 w-full text-xs`,children:n.isError?`Unavailable`:`Loading…`})}function Oy({run:e,reference:t,className:n,compact:r=!1,plain:i=!1,inert:a=!1}){let{projectId:o,repoBase:s}=Pv(),c=o!==void 0&&t.number!==void 0?Gr(o,e.id,{kind:t.kind,number:t.number,url:t.url},s):void 0;return(0,$.jsx)(Bv,{reference:t,taskTitle:hr(e),to:c,conflictAction:(0,$.jsx)(Ey,{runId:e.id,prNumber:t.number}),className:n,compact:r,plain:i,inert:a})}function ky({delayDuration:e=0,...t}){return(0,$.jsx)(Nf,{"data-slot":`tooltip-provider`,delayDuration:e,...t})}function Ay({...e}){return(0,$.jsx)(Pf,{"data-slot":`tooltip`,...e})}function jy({...e}){return(0,$.jsx)(Ff,{"data-slot":`tooltip-trigger`,...e})}function My({className:e,sideOffset:t=0,children:n,...r}){return(0,$.jsx)(If,{children:(0,$.jsxs)(Lf,{"data-slot":`tooltip-content`,sideOffset:t,className:U(`z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in rounded-md bg-contrast px-3 py-1.5 text-xs text-balance text-contrast-foreground fade-in-0 zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95`,e),...r,children:[n,(0,$.jsx)(Rf,{className:`z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-contrast fill-contrast`})]})})}var Ny=[{id:`status`,label:`Status`,canFold:!1,defaultExpanded:!0,align:`left`,width:`120px`},{id:`task`,label:`Task`,canFold:!1,defaultExpanded:!0,align:`left`,width:`320px`},{id:`workflow`,label:`Workflow`,canFold:!0,defaultExpanded:!0,align:`left`,width:`84px`,icon:`workflow`},{id:`branch`,label:`Branch`,canFold:!0,defaultExpanded:!1,align:`left`,width:`120px`,icon:`branch`},{id:`diff`,label:`±`,canFold:!0,defaultExpanded:!0,align:`left`,width:`84px`,icon:`diff`},{id:`reference`,label:`Ref`,canFold:!0,defaultExpanded:!0,align:`left`,width:`104px`,icon:`reference`},{id:`tokens`,label:`IN / OUT`,canFold:!0,defaultExpanded:!0,align:`right`,width:`112px`,icon:`tokens`,capability:`tokens`},{id:`cost`,label:`Cost`,canFold:!0,defaultExpanded:!0,align:`right`,width:`64px`,icon:`cost`,capability:`cost`},{id:`cpu`,label:`CPU`,canFold:!0,defaultExpanded:!0,align:`right`,width:`60px`,icon:`cpu`},{id:`memory`,label:`Mem`,canFold:!0,defaultExpanded:!0,align:`right`,width:`80px`,icon:`memory`},{id:`started`,label:`Started`,canFold:!0,defaultExpanded:!0,align:`right`,width:`68px`,icon:`started`}],Py=new Map(Ny.map(e=>[e.id,e]));function Fy(e){return typeof e!=`object`||!e||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(e=>typeof e[1]==`boolean`))}function Iy(e){let t={};for(let[n,r]of Object.entries(Fy(e))){let e=Py.get(n);e?.canFold&&(t[e.id]=r)}return t}function Ly(e,t){let n=Py.get(e);return!n||!n.canFold?!0:t[e]??n.defaultExpanded}function Ry(e,t){let n=Fy(e);return Py.get(t)?.canFold?{...n,[t]:!Ly(t,Iy(e))}:n}function zy(e){return Ny.filter(t=>t.capability===void 0||e[t.capability])}function By(e){let t=e?.capabilities,n=t?.tokenMetrics!==!1;return{tokens:t?.tokenUsageMetrics??n,cost:t?.costMetrics??n}}function Vy(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function Hy(){let e=V(),t=Tr(),n=Q.useRef(0),r=Q.useRef(0),i=Q.useRef(Promise.resolve()),a=Q.useMemo(()=>Iy(t.data?.taskTable?.expandedColumns),[t.data?.taskTable?.expandedColumns]),o=Q.useCallback(t=>{if(!Ny.find(e=>e.id===t)?.canFold)return;let a=e.getQueryData(q.uiState);if(a===void 0)return;let o=Vy(a?.taskTable),s={...o,expandedColumns:Ry(o.expandedColumns,t)};e.setQueryData(q.uiState,{...a,taskTable:s});let c=++n.current;r.current=c;let l=i.current.then(async()=>{let t=await Ve({taskTable:s},{keepalive:!0});c===r.current&&e.setQueryData(q.uiState,t)});i.current=l.catch(t=>{L(t instanceof Error?t.message:String(t),{tone:`danger`}),c===r.current&&e.invalidateQueries({queryKey:q.uiState})})},[e]);return{expandedColumns:a,isExpanded:Q.useCallback(e=>Ly(e,a),[a]),toggleColumn:o,isPending:t.isPending}}function Uy({runs:e,view:t,onViewChange:n,onArchiveFinished:r,archivePending:i=!1,onMarkAllRead:a,onRename:o,onTogglePin:s,now:c=Date.now(),showTokens:l=!0,showCost:u=!0,expandedColumns:d=Iy(void 0),onToggleColumn:f=()=>void 0,columnsPending:p=!1,projectName:h,error:g,onRetry:_,archivedPages:v,archivedTotal:y,onArchivedSearch:b}){let[x,S]=Q.useState(``);Q.useEffect(()=>{b?.(x.trim())},[b,x]);let[C,w]=Q.useState(!1),T=Q.useRef(null),E=Q.useRef(!1),[D,O]=Q.useState(!1);Q.useEffect(()=>{let e=window.matchMedia?.(`(min-width: 768px)`);if(!e)return;let t=()=>{e.matches&&O(!1)};return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let k=e??[],A=br(k),j=v!==void 0&&v.query===x.trim(),ee=new Set(j?v.runs.map(e=>e.id):[]),te=Fr(k,j||x.trim()===``?v?.runs??[]:[]).slice(k.length),M=Ei(k,x),ne=new Set(M.map(e=>e.id)),re=Ei(k.filter(e=>ee.has(e.id)&&!ne.has(e.id)),``),N=na([...M,...re,...Ei(te,``)],t),ie=y??(A.archived>=200?`200+`:A.archived),P=ir(k),ae=Jr(Ei(k,x),t),oe=Li(k),se=zy({tokens:l,cost:u}),ce=er(k),le=t===`archived`?void 0:s;return(0,$.jsxs)(`div`,{"data-route":`tasks`,"data-presentation":C?`resources`:`summary`,className:`flex min-h-full flex-col gap-[22px] px-[18px] pt-6 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-9`,children:[(0,$.jsxs)(`header`,{ref:T,className:`flex shrink-0 flex-col gap-[22px]`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(`h1`,{className:`text-[30px] font-semibold tracking-tight`,children:`Project tasks`}),(0,$.jsxs)(`p`,{className:`text-[13px] text-muted-foreground`,children:[h?`${h} · `:``,C?`Every resource column shown. Fold columns without losing the saved view.`:`Review runs, pull requests and resource usage.`]})]}),(0,$.jsxs)(`div`,{className:`flex gap-6 border-b border-border`,children:[(0,$.jsx)(qy,{view:`active`,current:t,onSelect:n,count:A.active,children:`Active`}),(0,$.jsx)(qy,{view:`archived`,current:t,onSelect:n,count:ie,children:`Archived`})]}),(0,$.jsxs)(`div`,{"data-slot":`tasks-toolbar`,className:`flex flex-wrap items-center gap-2.5`,children:[ce>0?(0,$.jsxs)(B,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`mark-all-read`,className:`hidden md:inline-flex`,onClick:a,children:[(0,$.jsx)(vc,{className:`size-3.5`,"aria-hidden":`true`}),`Mark all read`]}):null,t===`active`&&oe>0?(0,$.jsxs)(B,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`archive-finished`,className:`inline-flex`,disabled:i,"aria-busy":i,onClick:r,children:[(0,$.jsx)(Ee,{className:`size-3.5`,"aria-hidden":`true`}),`Archive finished`]}):null,t===`active`&&(oe>0||i)?(0,$.jsxs)(Yo,{open:D,onOpenChange:O,children:[(0,$.jsx)(Ko,{asChild:!0,children:(0,$.jsx)(B,{type:`button`,variant:`ghost`,size:`icon`,className:`md:hidden`,"aria-label":`Task actions`,"aria-busy":i,children:(0,$.jsx)(Pc,{"aria-hidden":`true`})})}),(0,$.jsx)(qo,{align:`end`,className:`md:hidden`,onCloseAutoFocus:e=>{(E.current||window.matchMedia?.(`(min-width: 768px)`).matches)&&(e.preventDefault(),E.current=!1,T.current?.querySelector(`[data-view="active"]`)?.focus())},children:(0,$.jsxs)(Ho,{disabled:i||oe===0,onSelect:()=>{E.current=!0,r()},children:[(0,$.jsx)(Ee,{"aria-hidden":`true`}),i?`Archiving…`:`Archive finished`]})})]}):null,(0,$.jsxs)(`div`,{className:`relative order-first w-full md:w-auto md:flex-1`,children:[(0,$.jsx)(m,{className:`pointer-events-none absolute top-1/2 left-2.5 size-3.5 -translate-y-1/2 text-soft-foreground`,"aria-hidden":`true`}),(0,$.jsx)(`input`,{type:`text`,value:x,onChange:e=>S(e.target.value),placeholder:`Search tasks…`,"aria-label":`Search tasks`,className:`h-11 w-full rounded-md border border-input bg-card pr-3 pl-8 text-[13px] text-foreground outline-none placeholder:text-soft-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`})]}),(0,$.jsxs)(Ea,{children:[(0,$.jsx)(xa,{asChild:!0,children:(0,$.jsx)(B,{"data-slot":`task-columns-trigger`,variant:`outline`,className:`hidden min-h-11 md:inline-flex`,children:`Columns`})}),(0,$.jsxs)(wa,{align:`end`,className:`w-72`,children:[(0,$.jsx)(`h2`,{className:`mb-2 text-base font-medium`,children:`Visible columns`}),(0,$.jsx)(`p`,{className:`mb-4 text-xs text-muted-foreground`,children:`Status and Task · Always visible`}),(0,$.jsx)(`div`,{className:`grid grid-cols-2 gap-3`,children:se.filter(e=>e.canFold).map(e=>(0,$.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,$.jsx)(`input`,{"data-column-toggle":e.id,type:`checkbox`,checked:Ly(e.id,d),disabled:p,onChange:()=>f(e.id)}),e.id===`diff`?`Diff`:e.id===`reference`?`Reference`:e.id===`memory`?`Memory`:e.label]},e.id))}),(0,$.jsx)(`p`,{className:`mt-4 text-xs text-muted-foreground`,children:`Saved automatically. Tokens and cost appear only when supported.`}),(0,$.jsx)(B,{variant:`outline`,className:`mt-4`,onClick:()=>w(e=>!e),children:C?`Summary view`:`Resource columns`})]})]}),(0,$.jsx)(B,{asChild:!0,"data-slot":`new-task-inline`,className:`min-h-11 inline-flex max-md:hidden`,children:(0,$.jsxs)(Z,{to:`/new`,children:[(0,$.jsx)(pn,{"aria-hidden":`true`}),`New task`]})})]})]}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[e===void 0?g?(0,$.jsxs)(`div`,{role:`alert`,className:`rounded-xl border border-border bg-card p-6`,children:[(0,$.jsx)(`h2`,{className:`text-lg`,children:`Could not load tasks`}),(0,$.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:g}),(0,$.jsx)(B,{variant:`outline`,className:`mt-4`,onClick:_,children:`Retry`})]}):(0,$.jsx)(`div`,{role:`status`,"aria-label":`Loading tasks`,className:`rounded-xl border border-border bg-card p-6 text-sm text-muted-foreground`,children:`Loading tasks…`}):N.length===0?(0,$.jsx)(Wy,{view:t,query:x}):(0,$.jsxs)($.Fragment,{children:[C?null:(0,$.jsx)(Gy,{projectName:h,runs:N,positions:P,onRename:o,onTogglePin:le,now:c,showTokens:l,showCost:u}),(0,$.jsx)(`div`,{"data-slot":`tasks-table`,hidden:!C,className:U(`hidden overflow-x-auto rounded-lg border border-border bg-card`,C&&`md:block`),children:(0,$.jsx)(ky,{children:(0,$.jsxs)(`table`,{className:`w-full table-fixed border-collapse`,children:[(0,$.jsx)(`colgroup`,{children:se.map(e=>{let t=Ly(e.id,d);return(0,$.jsx)(`col`,{"data-column-id":e.id,"data-expanded":t,style:{width:t?e.width:`42px`}},e.id)})}),(0,$.jsx)(`thead`,{children:(0,$.jsx)(`tr`,{children:se.map(e=>(0,$.jsx)(Yy,{column:e,expanded:Ly(e.id,d),onToggle:f,disabled:p},e.id))})}),(0,$.jsx)(`tbody`,{className:`[&>tr:last-child>td]:border-b-0`,children:N.map(e=>(0,$.jsx)(Qy,{run:e,queuePosition:e.status===`queued`?P.get(e.id)??null:null,onRename:o,onTogglePin:le,now:c,columns:se,expandedColumns:d},e.id))})]})})}),(0,$.jsx)(`div`,{"data-slot":`task-cards`,className:`flex flex-col rounded-lg border border-border bg-card p-5 md:hidden`,children:N.map(e=>(0,$.jsx)(ab,{run:e,projectName:h,queuePosition:e.status===`queued`?P.get(e.id)??null:null,now:c,showTokens:l,showCost:u,onTogglePin:le},e.id))}),(0,$.jsx)(`p`,{className:`mt-[22px] text-[11px] text-muted-foreground md:hidden`,children:`Resource details—including tokens, cost, CPU and peak memory—are available when a task row is expanded.`})]}),t===`archived`&&v?.failed?(0,$.jsxs)(`p`,{role:`alert`,"data-slot":`archived-older-error`,className:`mt-3.5 flex items-center justify-center gap-2.5 text-[13px] text-muted-foreground`,children:[`Could not load older archived tasks.`,(0,$.jsx)(B,{variant:`outline`,className:`min-h-11`,onClick:v.onLoadMore,children:`Retry`})]}):t===`archived`&&v?.hasMore?(0,$.jsx)(B,{"data-slot":`archived-older`,variant:`outline`,className:`mt-3.5 min-h-11 self-center`,disabled:v.loading,onClick:v.onLoadMore,children:v.loading?`Loading older archived…`:`Show older archived`}):null,ae.map(e=>(0,$.jsxs)(`div`,{"data-slot":`compare-strip`,"data-group-id":e.groupId,className:`mt-3.5 flex flex-wrap items-center gap-2.5 rounded-lg border border-border bg-card px-3.5 py-2.5 text-[13px] text-muted-foreground shadow-xs`,children:[(0,$.jsx)(al,{className:`size-[15px] shrink-0 text-soft-foreground`,"aria-hidden":`true`}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`strong`,{className:`font-semibold text-foreground`,children:e.title}),` — `,e.count,` variants finished`]}),(0,$.jsx)(B,{asChild:!0,variant:`outline`,size:`sm`,className:`md:ml-auto`,children:(0,$.jsx)(Z,{to:`/compare/${e.groupId}`,children:`Compare`})})]},e.groupId))]})]})}function Wy({view:e,query:t}){let n=t.trim(),r=n?`search-miss`:e===`archived`?`archive`:`no-tasks`;return(0,$.jsx)(`div`,{"data-slot":`tasks-empty`,"data-empty-kind":r,className:`flex flex-1 flex-col`,children:r===`search-miss`?(0,$.jsx)(G,{heading:`h2`,icon:(0,$.jsx)(Oo,{}),tone:`neutral`,title:`No matching tasks`,subtitle:`No tasks match “${n}”.`}):r===`archive`?(0,$.jsx)(G,{heading:`h2`,icon:(0,$.jsx)(Ee,{}),tone:`neutral`,title:`Nothing archived yet`,subtitle:`Finished tasks you archive land here.`}):(0,$.jsx)(G,{heading:`h2`,icon:(0,$.jsx)(Jc,{}),tone:`primary`,backdrop:!0,title:`No tasks yet`,subtitle:`Describe a task to get started.`,actions:(0,$.jsx)(B,{asChild:!0,children:(0,$.jsxs)(Z,{to:`/new`,children:[(0,$.jsx)(pn,{"aria-hidden":`true`}),`New task`]})})})})}function Gy({projectName:e,runs:t,positions:n,onRename:r,onTogglePin:i,now:a,showTokens:o,showCost:s}){let[c,l]=Q.useState(()=>new Set);return(0,$.jsxs)(`div`,{"data-slot":`tasks-summary`,className:`hidden md:block`,children:[(0,$.jsx)(`div`,{className:`rounded-lg border border-border bg-card p-5`,children:(0,$.jsxs)(`table`,{className:`w-full table-fixed border-collapse`,children:[(0,$.jsxs)(`colgroup`,{children:[(0,$.jsx)(`col`,{}),(0,$.jsx)(`col`,{className:`w-[136px]`}),(0,$.jsx)(`col`,{className:`w-[106px]`}),(0,$.jsx)(`col`,{className:`w-[116px]`}),(0,$.jsx)(`col`,{className:`w-[70px]`})]}),(0,$.jsx)(`thead`,{children:(0,$.jsx)(`tr`,{children:[`Task`,`Workflow`,`Changes`,`Pull request`,`Started`].map(e=>(0,$.jsx)(`th`,{className:`h-8 border-b border-border text-left text-[12px] font-medium uppercase text-muted-foreground`,children:e},e))})}),(0,$.jsx)(`tbody`,{children:t.map(t=>{let u=Br(t),d=bi(t),f=Xr(t),p=c.has(t.id),m=`task-resources-${t.id}`;return(0,$.jsxs)(Q.Fragment,{children:[(0,$.jsxs)(`tr`,{"data-status":t.status,"data-slot":`task-summary-row`,className:`group/row border-b border-border last:border-0`,children:[(0,$.jsxs)(`td`,{className:`py-5 pr-4 align-top`,children:[(0,$.jsx)(tb,{run:t,to:`/tasks/${t.id}`,onRename:r,onTogglePin:i}),(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`button`,{type:`button`,"aria-label":`${p?`Hide`:`Show`} resources for ${hr(t)}`,"aria-expanded":p,"aria-controls":m,"aria-describedby":`summary-status-${t.id}`,onClick:()=>l(e=>{let n=new Set(e);return p?n.delete(t.id):n.add(t.id),n}),className:`inline-flex min-h-[26px] items-center gap-1 rounded-md p-0 text-[11px] text-muted-foreground hover:bg-muted focus-visible:outline-2 focus-visible:outline-ring`,children:(0,$.jsxs)(Ev,{id:`summary-status-${t.id}`,dot:u.tone,shape:u.shape,pulse:u.pulse,children:[u.label,d?` ${d.label}`:``]})}),e?(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e}):null,t.status===`queued`?(0,$.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`#`,n.get(t.id),` in queue`]}):null]})]}),(0,$.jsx)(`td`,{className:`truncate pr-3 text-xs text-muted-foreground`,title:Zn(t),children:Zn(t)}),(0,$.jsx)(`td`,{className:`pr-2 text-xs`,children:t.diffStat?(0,$.jsx)(yv,{stat:t.diffStat}):(0,$.jsx)(sb,{})}),(0,$.jsx)(`td`,{className:`pr-2`,children:f?(0,$.jsx)(Oy,{run:t,reference:f,compact:!0}):(0,$.jsx)(sb,{})}),(0,$.jsx)(`td`,{className:`text-xs text-muted-foreground`,children:So(t.startedAt??t.createdAt,a)})]}),p?(0,$.jsx)(`tr`,{children:(0,$.jsx)(`td`,{colSpan:5,className:`border-b border-border pb-5`,children:(0,$.jsx)(`div`,{id:m,className:`rounded-md bg-muted/50 p-4`,children:(0,$.jsx)(Ky,{run:t,showTokens:o,showCost:s})})})}):null]},t.id)})})]})}),(0,$.jsx)(`p`,{className:`mt-[22px] text-[11px] text-muted-foreground`,children:`Resource details—including tokens, cost, CPU and peak memory—are available when a task row is expanded.`})]})}function Ky({run:e,showTokens:t,showCost:n}){let r=Ar(e,cc(e.id));return(0,$.jsxs)(`dl`,{className:`grid grid-cols-2 gap-4 text-xs md:grid-cols-4`,children:[t?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:`Tokens in / out`}),(0,$.jsx)(`dd`,{className:`mt-1`,children:(0,$.jsx)(Cv,{inputTokens:e.inputTokens,outputTokens:e.outputTokens,omitWhenUnknown:!1})})]}):null,n?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:`Cost`}),(0,$.jsx)(`dd`,{className:`mt-1`,children:$r(e.costUsd)||`—`})]}):null,(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:`CPU`}),(0,$.jsx)(`dd`,{className:`mt-1`,title:r.cpu.title,children:r.cpu.text||`—`})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:`Memory`}),(0,$.jsx)(`dd`,{className:`mt-1`,title:r.mem.title,children:r.mem.text||`—`})]}),e.branch?(0,$.jsxs)(`div`,{className:`col-span-2`,children:[(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:`Branch`}),(0,$.jsx)(`dd`,{className:`mt-1 break-all`,children:e.branch})]}):null]})}function qy({view:e,current:t,onSelect:n,count:r,children:i}){let a=e===t;return(0,$.jsxs)(`button`,{type:`button`,"data-slot":`overview-tab`,"data-view":e,"aria-pressed":a,onClick:()=>n(e),className:U(`flex min-h-11 items-center justify-center gap-1.5 border-b-2 border-transparent text-[13px] font-medium text-muted-foreground`,a&&`border-accent-strong font-semibold text-accent-text`),children:[i,r===0?null:(0,$.jsxs)(`span`,{className:`tabular-nums`,children:[` · `,r]})]})}function Jy({children:e,right:t=!1,columnId:n,folded:r=!1}){return(0,$.jsx)(`th`,{scope:`col`,"data-column-id":n,"data-folded":r||void 0,className:U(`h-[38px] border-b border-border px-2.5 text-left text-[11px] font-semibold tracking-[0.05em] whitespace-nowrap text-supporting-foreground uppercase first:pl-4 last:pr-4`,t&&`text-right`,r&&`px-0 first:pl-0 last:pr-0`),children:e})}function Yy({column:e,expanded:t,onToggle:n,disabled:r}){if(!e.canFold)return(0,$.jsx)(Jy,{columnId:e.id,right:e.align===`right`,children:e.label});let i=t?`Fold`:`Expand`;return(0,$.jsx)(Jy,{columnId:e.id,right:e.align===`right`,folded:!t,children:(0,$.jsxs)(Ay,{children:[(0,$.jsx)(jy,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,"aria-label":`${i} ${e.label} column`,"aria-pressed":t,disabled:r,onClick:()=>n(e.id),className:U(`inline-flex h-8 w-full items-center gap-1 rounded-sm px-0.5 text-inherit outline-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-wait disabled:opacity-60`,e.align===`right`?`justify-end`:`justify-start`,!t&&`justify-center px-0`),children:t?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{children:e.label}),(0,$.jsx)(Cc,{className:`size-3 opacity-55`,"aria-hidden":`true`})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Xy,{icon:e.icon}),(0,$.jsx)(wc,{className:`size-3 opacity-70`,"aria-hidden":`true`})]})})}),(0,$.jsxs)(My,{side:`top`,children:[e.label,` · `,i,` column`]})]})})}function Xy({icon:e}){let t=`size-3.5`;switch(e){case`workflow`:return(0,$.jsx)(Se,{className:t,"aria-hidden":`true`});case`branch`:return(0,$.jsx)(nn,{className:t,"aria-hidden":`true`});case`diff`:return(0,$.jsx)(te,{className:t,"aria-hidden":`true`});case`reference`:return(0,$.jsx)(qc,{className:t,"aria-hidden":`true`});case`tokens`:return(0,$.jsx)(Dc,{className:t,"aria-hidden":`true`});case`cost`:return(0,$.jsx)(Nc,{className:t,"aria-hidden":`true`});case`cpu`:return(0,$.jsx)(Ie,{className:t,"aria-hidden":`true`});case`memory`:return(0,$.jsx)(Yc,{className:t,"aria-hidden":`true`});case`started`:return(0,$.jsx)(Tc,{className:t,"aria-hidden":`true`});default:return null}}var Zy=`h-[88px] border-b border-border px-2.5 whitespace-nowrap first:pl-4 last:pr-4`;function Qy({run:e,queuePosition:t,onRename:n,onTogglePin:r,now:i,columns:a,expandedColumns:o}){let s=Eo(),c=Br(e),l=bi(e),u=`/tasks/${e.id}`,d=$r(e.costUsd),f=Xr(e);return(0,$.jsx)(`tr`,{"data-slot":`task-table-row`,"data-run-id":e.id,onClick:e=>{e.target.closest(`a, button, input`)||s(u)},className:`group/row cursor-pointer hover:bg-muted`,children:a.map(a=>{if(a.id===`memory`)return null;if(a.id===`cpu`){let n=Ly(`cpu`,o),r=Ly(`memory`,o);return t!==null&&(n||r)?(0,$.jsxs)(`td`,{"data-slot":`queue-note`,"data-column-id":`cpu-memory`,colSpan:2,className:U(Zy,`text-right font-mono text-[11px] text-supporting-foreground`),children:[`#`,t,` in queue`]},a.id):(0,$.jsx)(nb,{run:e,cpuExpanded:n,memoryExpanded:r},a.id)}return(0,$.jsx)($y,{column:a,expanded:Ly(a.id,o),run:e,attention:c,scheduled:l,reference:f,cost:d,to:u,onRename:n,onTogglePin:r,now:i},a.id)})})}function $y({column:e,expanded:t,run:n,attention:r,scheduled:i,reference:a,cost:o,to:s,onRename:c,onTogglePin:l,now:u}){if(!t)return(0,$.jsx)(eb,{column:e.id});switch(e.id){case`status`:return(0,$.jsx)(`td`,{"data-column-id":e.id,className:U(Zy,`overflow-hidden`),children:(0,$.jsx)(Ev,{dot:r.tone,shape:r.shape,pulse:r.pulse,title:i?.title??r.label,className:`w-full max-w-full overflow-hidden`,children:(0,$.jsxs)(`span`,{className:`min-w-0 truncate`,children:[r.label,i?(0,$.jsxs)($.Fragment,{children:[` `,(0,$.jsx)(`span`,{className:`tabular-nums`,children:i.label})]}):null]})})});case`task`:return(0,$.jsx)(`td`,{"data-column-id":e.id,className:U(Zy,`min-w-[320px] max-w-0 whitespace-normal`),children:(0,$.jsx)(tb,{run:n,to:s,onRename:c,onTogglePin:l})});case`workflow`:return(0,$.jsx)(`td`,{"data-column-id":e.id,className:U(Zy,`max-w-0 truncate text-[13px] text-muted-foreground`),children:Zn(n)});case`branch`:return(0,$.jsx)(`td`,{"data-column-id":e.id,className:U(Zy,`max-w-0 overflow-hidden`),children:n.branch?(0,$.jsx)(cb,{branch:n.branch}):(0,$.jsx)(sb,{})});case`diff`:return(0,$.jsx)(`td`,{"data-column-id":e.id,className:U(Zy,`overflow-hidden`),children:n.diffStat?(0,$.jsx)(yv,{stat:n.diffStat,compact:!0,className:`block max-w-full`}):(0,$.jsx)(sb,{})});case`reference`:return(0,$.jsx)(`td`,{"data-column-id":e.id,className:U(Zy,`overflow-hidden`),children:a?(0,$.jsx)(Oy,{run:n,reference:a,compact:!0,className:`max-w-full overflow-hidden`}):(0,$.jsx)(sb,{})});case`tokens`:let t=xv(n.inputTokens,n.outputTokens);return(0,$.jsx)(`td`,{"data-column-id":e.id,className:U(Zy,`text-right text-xs text-muted-foreground`),children:(0,$.jsx)(Cv,{inputTokens:n.inputTokens,outputTokens:n.outputTokens,variant:`table`,omitWhenUnknown:!1,title:t,className:`block max-w-full overflow-hidden text-ellipsis`})});case`cost`:return(0,$.jsx)(`td`,{"data-column-id":e.id,className:U(Zy,`text-right font-mono text-xs text-muted-foreground tabular-nums`),children:o?(0,$.jsx)(ib,{text:o,accessibleText:`$${n.costUsd}`}):(0,$.jsx)(sb,{})});case`started`:return(0,$.jsx)(`td`,{"data-column-id":e.id,className:U(Zy,`text-right text-xs text-supporting-foreground tabular-nums`),children:So(n.startedAt??n.createdAt,u)});case`cpu`:case`memory`:return null}}function eb({column:e}){return(0,$.jsx)(`td`,{role:`presentation`,"aria-hidden":`true`,"data-column-id":e,"data-folded":`true`,className:U(Zy,`px-0 first:pl-0 last:pr-0`)})}function tb({run:e,to:t,onRename:n,onTogglePin:r}){let i=hr(e),a=wv(i,t=>n(e.id,t)),o=rr(e),s=Mr(e);return a.editing?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,"data-slot":`table-title-editor`,children:[(0,$.jsx)(Tv,{editor:a,className:`basis-full text-[13px] font-medium`}),(0,$.jsx)(B,{size:`sm`,"aria-label":`Save title`,onMouseDown:e=>e.preventDefault(),onClick:a.commit,children:`Save`}),(0,$.jsx)(B,{size:`sm`,variant:`outline`,"aria-label":`Cancel rename`,onMouseDown:e=>e.preventDefault(),onClick:a.cancel,children:`Cancel`})]}):(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[e.delegation?.role===`worker`?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:`Worker`}):null,(0,$.jsx)(Z,{to:t,title:i,className:U(`line-clamp-2 min-w-0 flex-1 whitespace-normal rounded-sm text-[13px] leading-[18px] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground`,o?`font-semibold text-foreground`:s?`font-normal text-foreground`:`font-medium`),children:i}),o?(0,$.jsx)(aa,{tone:xr(e),role:`img`,"aria-label":`unread`,title:`Unread — not opened since it finished`,className:`shrink-0`}):null,(0,$.jsx)(`button`,{type:`button`,"data-slot":`row-rename`,"aria-label":`Rename task`,onClick:a.begin,className:`shrink-0 rounded-sm p-0.5 text-soft-foreground opacity-0 transition-opacity group-hover/row:opacity-100 hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,$.jsx)(nl,{className:`size-3`,"aria-hidden":`true`})}),r?(0,$.jsx)(Dv,{pinned:!!e.pinned,onToggle:t=>r(e,t),className:`size-[19px] opacity-0 group-hover/row:opacity-100 focus-visible:opacity-100 no-hover:opacity-100 data-[pinned=true]:opacity-100`}):null]})}function nb({run:e,cpuExpanded:t,memoryExpanded:n}){let r=Ar(e,cc(e.id));return(0,$.jsxs)($.Fragment,{children:[t?(0,$.jsx)(rb,{column:`cpu`,cell:r.cpu}):(0,$.jsx)(eb,{column:`cpu`}),n?(0,$.jsx)(rb,{column:`memory`,cell:r.mem}):(0,$.jsx)(eb,{column:`memory`})]})}function rb({column:e,cell:t}){let n=t.text&&t.title?`${t.text}; ${t.title}`:t.text;return(0,$.jsx)(`td`,{"data-usage":e===`memory`?`mem`:e,"data-column-id":e,"data-usage-kind":t.kind,className:U(Zy,`overflow-hidden`,`text-right font-mono tabular-nums`,t.kind===`live`&&`bg-accent-strong/5 text-xs font-medium text-foreground`,t.kind===`peak`&&`text-[11px] text-supporting-foreground`,t.kind===`none`&&`text-xs text-soft-foreground`),children:(0,$.jsx)(ib,{text:t.text||`—`,accessibleText:n||void 0})})}function ib({text:e,accessibleText:t}){return(0,$.jsx)(`span`,{"data-slot":`bounded-metric`,...t?{"aria-label":t,title:t}:{},className:`block max-w-full overflow-hidden text-ellipsis`,children:e})}function ab({run:e,projectName:t,queuePosition:n,now:r,showTokens:i,showCost:a,onTogglePin:o}){let s=Eo(),[c,l]=Q.useState(!1),u=Br(e),d=bi(e),f=`/tasks/${e.id}`,p=Xr(e),m=rr(e),h=Mr(e);return(0,$.jsxs)(`div`,{"data-slot":`task-card`,"data-status":e.status,"data-run-id":e.id,onClick:e=>{e.target.closest(`a, button`)||s(f)},className:`cursor-pointer border-b border-border py-5 first:pt-0 last:border-0 last:pb-0`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start gap-2.5`,children:[(0,$.jsx)(`button`,{"data-slot":`mobile-resources-toggle`,type:`button`,"aria-controls":`mobile-resources-${e.id}`,"aria-describedby":`mobile-status-${e.id}`,"aria-label":c?`Hide resources`:`Show resources`,title:c?`Hide resources`:`Show resources`,"aria-expanded":c,onClick:()=>l(e=>!e),children:(0,$.jsxs)(Ev,{id:`mobile-status-${e.id}`,dot:u.tone,shape:u.shape,pulse:u.pulse,className:`mt-px shrink-0`,title:d?.title,children:[u.label,d?(0,$.jsx)(`span`,{className:`tabular-nums`,children:d.label}):null]})}),(0,$.jsxs)(Z,{to:f,className:U(`order-first w-full min-w-0 rounded-sm text-[14px] leading-[1.35] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground`,m?`font-semibold text-foreground`:h?`font-normal text-foreground`:`font-medium`),children:[e.delegation?.role===`worker`?(0,$.jsx)(`span`,{className:`mr-2 text-xs text-muted-foreground`,children:`Worker`}):null,hr(e)]}),m?(0,$.jsx)(aa,{tone:xr(e),role:`img`,"aria-label":`unread`,title:`Unread — not opened since it finished`,className:`mt-1.5 shrink-0`}):null,t?(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t}):null,o?(0,$.jsx)(Dv,{pinned:!!e.pinned,onToggle:t=>o(e,t),className:`-mr-1 mt-px`}):null]}),(0,$.jsxs)(`div`,{"data-slot":`mobile-task-meta`,className:`mt-4 grid grid-cols-[minmax(0,1fr)_auto_auto] items-center gap-3 text-xs text-muted-foreground`,children:[(0,$.jsx)(`span`,{children:Zn(e)}),n===null?e.diffStat?(0,$.jsx)(yv,{stat:e.diffStat}):(0,$.jsx)(sb,{}):(0,$.jsxs)(`span`,{"data-slot":`queue-note`,children:[`#`,n,` in queue`]}),(0,$.jsx)(`span`,{children:So(e.startedAt??e.createdAt,r)})]}),p?(0,$.jsx)(`div`,{className:`mt-3`,children:(0,$.jsx)(Oy,{run:e,reference:p})}):null,c?(0,$.jsx)(ob,{run:e,showTokens:i,showCost:a}):null]})}function ob({run:e,showTokens:t,showCost:n}){let r=Ar(e,cc(e.id));return(0,$.jsxs)(`dl`,{id:`mobile-resources-${e.id}`,className:`mt-3 grid grid-cols-2 gap-3 rounded-md bg-muted p-3 text-xs`,children:[e.branch?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{children:`Branch`}),(0,$.jsx)(`dd`,{children:e.branch})]}):null,(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{children:`CPU`}),(0,$.jsx)(`dd`,{children:r.cpu.text||`—`})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{children:`Memory`}),(0,$.jsx)(`dd`,{children:r.mem.text||`—`})]}),t?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{children:`IN / OUT`}),(0,$.jsx)(`dd`,{children:(0,$.jsx)(Cv,{inputTokens:e.inputTokens,outputTokens:e.outputTokens})})]}):null,n?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{children:`Cost`}),(0,$.jsx)(`dd`,{children:$r(e.costUsd)||`—`})]}):null]})}function sb(){return(0,$.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`—`})}function cb({branch:e}){return(0,$.jsx)(`span`,{title:e,className:`block truncate rounded-[6px] bg-muted px-1.5 py-0.5 font-mono text-[11px] font-medium text-muted-foreground`,children:e})}function lb(){let e=Or(),t=By(W().data),[n,r]=Q.useState(`active`),i=V(),a=db(e.data,n),o=J({mutationFn:()=>ne(),onSuccess:()=>i.invalidateQueries({queryKey:K.runs.all}),onError:e=>L(e.message,{tone:`danger`})}),s=J({mutationFn:_,onSuccess:()=>i.invalidateQueries({queryKey:K.runs.all}),onError:e=>L(e.message,{tone:`danger`})}),c=J({mutationFn:({id:e,title:t})=>xe(e,{title:t}),onSuccess:()=>i.invalidateQueries({queryKey:K.runs.all}),onError:e=>L(e.message,{tone:`danger`})}),l=wi(),u=tp(3e4),d=Hy(),f=ci(),p=Di(void 0,{retryOnMount:!1}),m=oi({retryOnMount:!1}).data?.projects?.find(e=>e.id===f)?.name;return(0,$.jsx)(jv,{projectId:f,repoBase:p,requests:Q.useMemo(()=>f===void 0?[]:(e.data??[]).flatMap(e=>{let t=Xr(e);return t?[{projectId:f,kind:t.kind,number:t.number}]:[]}),[e.data,f]),children:(0,$.jsx)(Uy,{runs:e.data,projectName:m,error:e.error?.message,onRetry:()=>void e.refetch(),view:n,onViewChange:r,onArchiveFinished:()=>{o.isPending||o.mutate()},archivePending:o.isPending,onMarkAllRead:()=>s.mutate(),onRename:(e,t)=>c.mutate({id:e,title:t}),onTogglePin:(e,t)=>l.mutate({id:e.id,pinned:t}),now:u,showTokens:t.tokens,showCost:t.cost,expandedColumns:d.expandedColumns,onToggleColumn:d.toggleColumn,columnsPending:d.isPending,archivedPages:a.pages,archivedTotal:a.total,onArchivedSearch:a.search})})}var ub=150;function db(e,t){let n=V(),[r,i]=Q.useState(``),[a,o]=Q.useState(``);Q.useEffect(()=>{let e=setTimeout(()=>o(r),ub);return()=>clearTimeout(e)},[r]);let s=e!==void 0&&br(e).archived>=200,c=$n(a,t===`archived`&&(a!==``||s)),l=c.data?.pages;return{pages:Q.useMemo(()=>l||c.isError?{runs:(l??[]).flatMap(e=>e.runs),query:c.isPlaceholderData?null:a,hasMore:c.hasNextPage,loading:c.isFetchingNextPage,onLoadMore:()=>void(l?c.fetchNextPage():c.refetch()),failed:c.isError}:void 0,[l,c]),total:(a===``?l:n.getQueryData(K.runs.archived(``))?.pages)?.[0]?.total,search:i}}function fb({slot:e,label:t,options:n,selected:r,onToggle:i,onClear:a,searchPlaceholder:o,emptyLabel:s=`Nothing to filter by`}){let[c,l]=Q.useState(!1),u=r.length>0,d=r.length===1?n.find(e=>e.value===r[0])?.label??r[0]:`${r.length} selected`;return(0,$.jsxs)(Ea,{open:c,onOpenChange:l,children:[(0,$.jsx)(xa,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,"data-slot":`facet-${e}`,"data-active":u?`true`:void 0,"aria-label":`Filter by ${t.toLowerCase()}`,className:U(`inline-flex h-7 items-center gap-1.5 rounded-full border border-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,u&&`border-accent-strong/40 bg-accent-strong/10 text-foreground`),children:[(0,$.jsx)(`span`,{className:U(u&&`text-soft-foreground`),children:t}),u?(0,$.jsx)(`span`,{className:`max-w-[140px] truncate font-semibold`,children:d}):null,(0,$.jsx)(xc,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,$.jsxs)(wa,{align:`start`,className:`w-64 p-0`,"data-testid":`facet-${e}-menu`,children:[(0,$.jsxs)(Ua,{children:[(0,$.jsx)(Ga,{placeholder:o??`Search ${t.toLowerCase()}…`}),(0,$.jsxs)(Qa,{children:[(0,$.jsx)(io,{children:s}),(0,$.jsx)(Wa,{children:n.map(e=>{let t=r.includes(e.value);return(0,$.jsxs)(to,{value:e.label,onSelect:()=>i(e.value),"data-slot":`facet-option`,"data-value":e.value,"aria-checked":t,role:`option`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,className:U(`flex size-4 shrink-0 items-center justify-center rounded-[4px] border`,t?`border-accent-strong bg-accent-strong text-accent-strong-foreground`:`border-input`),children:t?(0,$.jsx)(yc,{className:`size-3`}):null}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),e.count===void 0?null:(0,$.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-soft-foreground tabular-nums`,children:e.count})]},e.value)})})]})]}),u?(0,$.jsx)(`div`,{className:`border-t border-border p-1`,children:(0,$.jsxs)(`button`,{type:`button`,"data-action":`facet-${e}-clear`,onClick:()=>a(),className:`w-full rounded-sm px-2 py-1.5 text-left text-xs font-medium text-muted-foreground hover:bg-muted hover:text-foreground`,children:[`Clear `,t.toLowerCase()]})}):null]})]})}function pb({label:e,count:t,selected:n,onToggle:r,slot:i,tone:a=`neutral`}){return(0,$.jsxs)(`button`,{type:`button`,"data-slot":i,"data-selected":n?`true`:void 0,"aria-pressed":n,onClick:r,className:U(`inline-flex h-7 items-center gap-1.5 rounded-full border px-2.5 text-xs font-medium transition-colors`,a===`tag`?`border-accent-strong/25 bg-accent-strong/10 text-accent-text hover:bg-accent-strong/20`:`border-border bg-card text-muted-foreground hover:bg-muted hover:text-foreground`,n&&`border-accent-strong bg-accent-strong text-accent-strong-foreground hover:bg-accent-strong`),children:[e,t===void 0?null:(0,$.jsx)(`span`,{className:U(`font-mono text-[11px] tabular-nums`,!n&&`text-soft-foreground`),children:t})]})}function mb({slot:e,label:t,value:n,options:r,onChange:i,size:a=`compact`}){return(0,$.jsx)(`div`,{"data-slot":e,role:`group`,"aria-label":t,className:`inline-flex gap-0.5 rounded-md bg-muted p-[3px]`,children:r.map(e=>{let t=e.value===n;return(0,$.jsx)(`button`,{type:`button`,"data-value":e.value,"aria-pressed":t,disabled:e.disabled,title:e.title,onClick:()=>i(e.value),className:U(`flex h-6 items-center justify-center rounded-[6px] px-2.5 text-[12px] font-medium text-muted-foreground transition-colors hover:text-foreground disabled:pointer-events-none disabled:opacity-50`,a===`touch`&&`h-11 px-4 text-[13px]`,t&&`bg-card font-semibold text-foreground shadow-xs`),children:e.label},e.value)})})}var hb=` untagged`,gb=[{value:`project`,label:`Project`},{value:`tag`,label:`Tag`},{value:`status`,label:`Status`},{value:`workflow`,label:`Workflow`}];function _b(e,t){return e===t?`none`:t}var vb={query:``,tags:[],statuses:[],workflows:[]};function yb(e,t){return e.includes(t)?e.filter(e=>e!==t):[...e,t]}function bb(e){return(e.projects?.length??0)+e.tags.length+e.statuses.length+e.workflows.length}function xb(e){return e.query.trim()!==``||bb(e)>0}function Sb(e){return bb(e.filters)+(e.filters.query.trim()===``?0:1)+(e.groupBy===`none`?0:1)}function Cb(e){return Sb(e)>0}function wb(e,t){let n=new Map(t.map(e=>[e.id,e]));return e.filter(e=>!vr(e)).map(e=>{let t=n.get(e.projectId);return{run:e,project:t,projectName:t?.name||e.projectId,tags:t?.tags??[]}})}function Tb(e){let t=new Set;for(let n of e)t.add(n.run.workflow);return[...t].sort((e,t)=>e.localeCompare(t))}function Eb(e){let t=new Set;for(let n of e)t.add(n.run.status);return[...t].sort((e,t)=>e.localeCompare(t))}function Db(e,t){let n=new Map;for(let r of e)for(let e of t(r))n.set(e,(n.get(e)??0)+1);return n}var Ob=e=>e.tags.length===0?[hb]:e.tags,kb=(e,t)=>e.length===0||t.some(t=>e.includes(t)),Ab=(e,t)=>{if(t.length===0)return!0;let n=Ob(e).map(e=>e.toLowerCase());return t.some(e=>n.includes(e.toLowerCase()))};function jb(e){return[hr(e.run),e.projectName,e.run.workflow,e.run.branch??``,...e.tags].join(`
|
|
12
|
+
`).toLowerCase()}function Mb(e,t,n){let r=t.query.trim().toLowerCase().split(/\s+/).filter(Boolean);return e.filter(e=>{if((n===`archived`?!e.run.archived:e.run.archived)||!kb(t.projects??[],[e.run.projectId])||!kb(t.statuses,[e.run.status])||!kb(t.workflows,[e.run.workflow])||!Ab(e,t.tags))return!1;if(r.length===0)return!0;let i=jb(e);return r.every(e=>i.includes(e))})}function Nb(e,t,n,r){return Mb(e,{...t,[r]:[]},n)}function Pb(e,t){if(t===`none`)return[{key:`all`,label:``,tasks:[...e]}];let n=new Map,r=(e,t,r)=>{let i=n.get(e);i?i.tasks.push(r):n.set(e,{key:e,label:t,tasks:[r]})};for(let n of e)if(t===`project`)r(n.run.projectId,n.projectName,n);else if(t===`status`)r(n.run.status,n.run.status,n);else if(t===`workflow`)r(n.run.workflow,n.run.workflow,n);else if(n.tags.length===0)r(hb,`Untagged`,n);else for(let e of n.tags)r(e.toLowerCase(),e,n);return[...n.values()].sort((e,t)=>e.key===` untagged`?1:t.key===` untagged`?-1:t.tasks.length-e.tasks.length||e.label.localeCompare(t.label))}function Fb(e,t){let n=new Map(t.map(e=>[e.id,e.name]));return e.map(e=>n.get(e)||e)}var Ib={query:`q`,project:`project`,tag:`tag`,untagged:`untagged`,status:`status`,workflow:`workflow`,groupBy:`group`,archived:`archived`},Lb=new Set(gb.map(e=>e.value));function Rb(e){let t=new URLSearchParams,n=e.filters.query.trim();n!==``&&t.set(Ib.query,n);for(let n of e.filters.tags)n===` untagged`?t.set(Ib.untagged,`1`):t.append(Ib.tag,n);for(let n of e.filters.projects??[])t.append(Ib.project,n);for(let n of e.filters.statuses)t.append(Ib.status,n);for(let n of e.filters.workflows)t.append(Ib.workflow,n);return e.groupBy!==`none`&&t.set(Ib.groupBy,e.groupBy),e.view===`archived`&&t.set(Ib.archived,`1`),t}function zb(e){let t=e.getAll(Ib.tag).filter(e=>e!==``);e.get(Ib.untagged)===`1`&&t.push(hb);let n=e.get(Ib.groupBy)??``;return{filters:{query:e.get(Ib.query)??``,...e.has(Ib.project)?{projects:e.getAll(Ib.project).filter(Boolean)}:{},tags:t,statuses:e.getAll(Ib.status).filter(e=>e!==``),workflows:e.getAll(Ib.workflow).filter(e=>e!==``)},groupBy:Lb.has(n)?n:`none`,view:e.get(Ib.archived)===`1`?`archived`:`active`}}var Bb=15e3,Vb=250,Hb=1,Ub=220,Wb=new Set([`done`,`failed`,`cancelled`]);function Gb(){return qb({request:({task:e,archived:t})=>ze(e.run.projectId,e.run.id,t),patch:({archived:e})=>t=>({...t,archived:e})})}function Kb(){return qb({request:({task:e,read:t})=>Nt(e.run.projectId,e.run.id,t),patch:({read:e})=>t=>{if(e)return{...t,seenAt:new Date().toISOString()};let{seenAt:n,...r}=t;return r}})}function qb({request:e,patch:t}){let n=V();return J({mutationFn:e,onMutate:async e=>{await n.cancelQueries({queryKey:q.runsIndex});let r=n.getQueryData(q.runsIndex),i=t(e),{task:a}=e;return n.setQueryData(q.runsIndex,e=>e===void 0?e:{...e,runs:e.runs.map(e=>e.projectId===a.run.projectId&&e.id===a.run.id?i(e):e)}),{previous:r}},onError:(e,t,r)=>{r?.previous&&n.setQueryData(q.runsIndex,r.previous),L(e.message,{tone:`danger`})},onSettled:(e,t,{task:r})=>{n.invalidateQueries({queryKey:q.runsIndex}),n.invalidateQueries({queryKey:K.runs.all}),n.invalidateQueries({queryKey:[r.run.projectId,`runs`,`list`]})}})}function Jb(){let e=oi(),t=By(W().data),n=ra(!0,Bb),[r,i]=ke(),{filters:a,groupBy:s,view:c}=Q.useMemo(()=>zb(r),[r]),l=tp(3e4),u=e=>i(t=>Rb(e(zb(t))),{replace:!0}),d=e=>u(t=>({...t,filters:e(t.filters)})),f=e=>u(t=>({...t,groupBy:e})),p=e=>u(t=>({...t,view:e})),[h,g]=Q.useState(s!==`none`||a.tags.length>0),[_,y]=Q.useState(a.query),b=Q.useRef(a.query);Q.useEffect(()=>{a.query!==b.current&&y(a.query),b.current=a.query},[a.query]),Q.useEffect(()=>{if(_===b.current)return;let e=setTimeout(()=>{b.current=_,d(e=>({...e,query:_}))},Vb);return()=>clearTimeout(e)},[_]);let x=n.data?.referenceStatuses;Q.useEffect(()=>{x&&Xi(x)},[x]);let S=Q.useMemo(()=>e.data?.projects??[],[e.data]),C=Q.useMemo(()=>wb(n.data?.runs??[],S),[n.data,S]),w=Q.useMemo(()=>Mb(C,a,c),[C,a,c]),T=Q.useMemo(()=>Pb(w,s),[w,s]),E=Q.useMemo(()=>w.flatMap(e=>Zi(e.run,e.project?.repoUrl).map(t=>({projectId:e.run.projectId,kind:t.kind,number:t.number}))),[w]),D=Fb(n.data?.truncated??[],S),O=(e,t)=>d(n=>({...n,[e]:yb(n[e]??[],t)})),k=e=>d(t=>({...t,[e]:[]})),A=Gb(),j=Kb();if(n.isError||e.isError)return(0,$.jsx)(`div`,{"data-route":`global-tasks`,"data-presentation":s===`none`?`summary`:`cards`,"data-filter-details":h,className:`flex min-h-full flex-col gap-[22px] px-[18px] pt-6 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-9`,children:(0,$.jsx)(G,{icon:(0,$.jsx)(at,{}),tone:`danger`,title:`Tasks across projects did not load`,subtitle:(n.error??e.error)?.message,actions:(0,$.jsx)(B,{variant:`outline`,onClick:()=>{n.refetch(),e.refetch()},children:`Retry`})})});let ee=(0,$.jsxs)(`div`,{className:`relative w-full`,children:[(0,$.jsx)(m,{className:`pointer-events-none absolute top-1/2 left-2.5 size-3.5 -translate-y-1/2 text-soft-foreground`,"aria-hidden":`true`}),(0,$.jsx)(`input`,{type:`text`,value:_,onChange:e=>y(e.target.value),placeholder:`Search every project…`,"aria-label":`Search tasks across projects`,className:`h-11 w-full rounded-md border border-input bg-card pr-3 pl-8 text-[13px] text-foreground outline-none placeholder:text-soft-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`})]});return(0,$.jsxs)(`div`,{"data-route":`global-tasks`,"data-presentation":s===`none`?`summary`:`cards`,"data-filter-details":h,className:`flex min-h-full flex-col gap-[22px] px-[18px] pt-6 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-9`,children:[(0,$.jsxs)(`header`,{className:`flex shrink-0 flex-col gap-[22px]`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(`h1`,{className:`text-[30px] font-semibold tracking-tight`,children:`All tasks`}),(0,$.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:s===`none`?`Every project. One place to review what your agents have shipped.`:`Filter across projects and act on each run without opening the session.`})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-6 border-b border-border`,children:[(0,$.jsx)(Yb,{view:`active`,current:c,onSelect:p,children:`Active`}),(0,$.jsx)(Yb,{view:`archived`,current:c,onSelect:p,children:`Archived`}),(0,$.jsxs)(`span`,{"data-slot":`global-tasks-count`,className:`ml-auto text-[13px] text-soft-foreground tabular-nums`,children:[w.length,` of `,C.length]})]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2.5`,children:[(0,$.jsx)(`div`,{className:`min-w-0 basis-full md:flex-1 md:basis-auto`,children:ee}),(0,$.jsxs)(B,{variant:`outline`,"aria-expanded":h,onClick:()=>g(e=>!e),children:[(0,$.jsx)(v,{"aria-hidden":`true`}),`Filters`]}),(0,$.jsx)(B,{asChild:!0,className:`min-h-11`,children:(0,$.jsxs)(o,{to:wo(e.data?.bootProject??`default`,`/new`),children:[(0,$.jsx)(pn,{"aria-hidden":`true`}),`New task`]})})]})]}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-[22px]`,children:[(0,$.jsx)(Xb,{filters:a,onToggle:O,onClearFacet:k,onClearAll:()=>{y(``),u(e=>({...e,filters:vb,groupBy:`none`}))},groupBy:s,onGroupByChange:f,projects:S,tasks:C,view:c}),D.length>0?(0,$.jsxs)(`p`,{"data-slot":`global-tasks-truncated`,className:`text-[11px] text-soft-foreground`,children:[`Showing every active task and the newest `,n.data?.perProjectLimit,` archived tasks per project — older archived tasks in`,` `,D.join(`, `),` are in that project’s own Tasks page.`]}):null,n.data===void 0?(0,$.jsx)(`div`,{role:`status`,className:`rounded-xl border border-border bg-card p-6 text-sm text-muted-foreground`,children:`Loading tasks…`}):w.length===0?(0,$.jsx)(ax,{view:c,filtered:xb(a)}):(0,$.jsx)(jv,{requests:E,children:T.map(e=>(0,$.jsxs)(`section`,{"data-slot":`task-group`,"data-group-key":e.key,children:[s===`none`?null:(0,$.jsxs)(`h2`,{className:`mb-1.5 flex items-center gap-2 text-[12px] font-semibold tracking-[0.04em] text-soft-foreground uppercase`,children:[s===`project`?(0,$.jsx)(o,{to:wo(e.key,`/`),"data-slot":`group-project-link`,className:`hover:text-foreground hover:underline`,children:e.label}):e.label,(0,$.jsx)(`span`,{className:`font-mono text-[11px] font-medium tabular-nums`,children:e.tasks.length})]}),(0,$.jsx)(Zb,{tasks:e.tasks,now:l,showProject:s!==`project`,onArchive:(e,t)=>A.mutate({task:e,archived:t}),onSetRead:(e,t)=>j.mutate({task:e,read:t}),busy:A.isPending||j.isPending,showCost:t.cost})]},e.key))}),s===`none`&&w.length>0?(0,$.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Resource details—including tokens, cost, CPU and peak memory—are available when a task row is expanded.`}):null,S.length>1?(0,$.jsxs)(`section`,{"data-slot":`other-projects`,className:`rounded-lg border border-border bg-card p-5`,children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold`,children:`Other projects`}),(0,$.jsx)(`div`,{className:`mt-3 flex flex-col divide-y divide-border`,children:S.map(e=>(0,$.jsxs)(`div`,{className:`flex min-h-14 items-center justify-between gap-3`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-[13px]`,children:e.name}),(0,$.jsxs)(o,{to:wo(e.id,`/`),className:`inline-flex min-h-11 shrink-0 items-center rounded-md px-3 text-xs text-accent-text hover:bg-accent-strong/10`,children:[`View tasks`,(0,$.jsxs)(`span`,{className:`sr-only`,children:[` for `,e.name]})]})]},e.id))})]}):null]})]})}function Yb({view:e,current:t,onSelect:n,children:r}){let i=e===t;return(0,$.jsx)(`button`,{type:`button`,"data-slot":`overview-tab`,"data-view":e,"aria-pressed":i,onClick:()=>n(e),className:U(`flex min-h-11 items-center justify-center border-b-2 border-transparent text-[13px] font-medium text-muted-foreground`,i&&`border-accent-strong font-semibold text-accent-text`),children:r})}function Xb({filters:e,onToggle:t,onClearFacet:n,onClearAll:r,groupBy:i,onGroupByChange:a,projects:s,tasks:c,view:l}){let u=Q.useMemo(()=>Ci(s),[s]),f=Q.useMemo(()=>{let t=(t,n)=>Db(Nb(c,e,l,t),n);return{projects:t(`projects`,e=>[e.run.projectId]),tags:t(`tags`,Ob),statuses:t(`statuses`,e=>[e.run.status]),workflows:t(`workflows`,e=>[e.run.workflow])}},[c,e,l]),p=e=>t=>({...t,count:e.get(t.value)??0});return(0,$.jsxs)(`div`,{"data-slot":`global-tasks-filters`,className:`flex flex-col gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,$.jsx)(fb,{slot:`project`,label:`Project`,selected:e.projects??[],onToggle:e=>t(`projects`,e),onClear:()=>n(`projects`),options:[...new Map(c.map(e=>[e.run.projectId,e.projectName])).entries()].map(([e,t])=>({value:e,label:t})).map(p(f.projects)),emptyLabel:`No tasks to filter`}),(0,$.jsx)(fb,{slot:`status`,label:`Status`,selected:e.statuses,onToggle:e=>t(`statuses`,e),onClear:()=>n(`statuses`),options:Eb(c).map(e=>({value:e,label:e})).map(p(f.statuses)),emptyLabel:`No tasks to filter`}),(0,$.jsx)(fb,{slot:`workflow`,label:`Workflow`,selected:e.workflows,onToggle:e=>t(`workflows`,e),onClear:()=>n(`workflows`),options:Tb(c).map(e=>({value:e,label:e})).map(p(f.workflows)),emptyLabel:`No tasks to filter`}),(0,$.jsxs)(`div`,{"data-slot":`group-controls`,className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`mx-1 h-5 w-px bg-border`,"aria-hidden":`true`}),(0,$.jsx)(`span`,{className:`text-[11px] font-medium text-soft-foreground`,children:`Group by`}),(0,$.jsx)(mb,{slot:`group-by`,label:`Group tasks by`,value:i,options:gb,onChange:e=>a(_b(i,e))})]}),Cb({filters:e,groupBy:i})?(0,$.jsxs)(`button`,{type:`button`,"data-action":`clear-filters`,onClick:r,className:`ml-auto inline-flex h-7 items-center gap-1 rounded-full px-2 text-xs font-medium text-muted-foreground hover:bg-muted hover:text-foreground`,children:[(0,$.jsx)(d,{className:`size-3`,"aria-hidden":`true`}),`Clear`,` (${Sb({filters:e,groupBy:i})})`]}):null]}),u.length>0?(0,$.jsxs)(`div`,{"data-slot":`tag-filters`,className:`flex flex-wrap items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`text-[11px] font-medium text-soft-foreground`,children:`Tags`}),u.map(n=>(0,$.jsx)(pb,{slot:`tag-filter`,tone:`tag`,label:n,count:f.tags.get(n)??0,selected:e.tags.some(e=>e.toLowerCase()===n.toLowerCase()),onToggle:()=>t(`tags`,n)},n)),(0,$.jsx)(pb,{slot:`tag-filter`,label:`Untagged`,count:f.tags.get(` untagged`)??0,selected:e.tags.includes(hb),onToggle:()=>t(`tags`,hb)})]}):(0,$.jsxs)(`p`,{"data-slot":`no-tags-hint`,className:`text-[11px] text-soft-foreground`,children:[`Tag connected repositories in`,` `,(0,$.jsx)(o,{to:`/settings/global/projects`,className:`font-medium text-accent-text hover:underline`,children:`Settings → Projects`}),` `,`to group their tasks together here.`]})]})}function Zb({tasks:e,now:t,showProject:n,onArchive:r,onSetRead:i,busy:a,showCost:o}){return(0,$.jsxs)(`div`,{"data-slot":`global-tasks-table`,className:`overflow-x-auto rounded-lg border border-border bg-card p-5`,children:[(0,$.jsx)(`div`,{"data-slot":`global-summary-head`,className:`text-[12px]`,"aria-hidden":`true`,children:[`Task`,`Workflow`,`Changes`,`Pull request`,`Started`].map(e=>(0,$.jsx)(`span`,{children:e},e))}),(0,$.jsx)(ky,{children:e.map(e=>(0,$.jsx)(Qb,{task:e,now:t,showProject:n,onArchive:r,onSetRead:i,busy:a,showCost:o},`${e.run.projectId}/${e.run.id}`))})]})}function Qb({task:e,now:t,showProject:n,onArchive:r,onSetRead:i,busy:a,showCost:s}){let{run:c}=e,[l,u]=Q.useState(!1),d=Br(c),f=wo(c.projectId,`/tasks/${c.id}`),p=rr(c),m=Mr(c),h=Zi(c,e.project?.repoUrl),g=Ar(c,c.usage);return(0,$.jsxs)(`article`,{"data-status":c.status,"data-expanded":l,"data-slot":`global-task-row`,"data-run-id":c.id,"data-project":c.projectId,className:`hover:bg-muted max-md:flex max-md:flex-wrap max-md:items-center max-md:gap-x-3 max-md:gap-y-2 max-md:border-b max-md:border-border max-md:py-5 max-md:first:pt-0 max-md:last:border-0 max-md:last:pb-0`,children:[(0,$.jsxs)(`div`,{"data-slot":`global-task-title`,children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[c.delegation?.role===`worker`?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:`Worker`}):null,(0,$.jsx)(o,{to:f,title:hr(c),className:U(`min-w-0 truncate text-[14px] md:text-[13px]`,p?`font-semibold text-foreground`:m?`font-medium text-muted-foreground`:`font-medium`),children:hr(c)}),p?(0,$.jsx)(aa,{tone:xr(c),role:`img`,"aria-label":`unread`,title:`Unread — not opened since it finished`,className:`shrink-0`}):null]}),(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`button`,{type:`button`,"aria-expanded":l,"aria-label":`${l?`Hide`:`Show`} resources for ${hr(c)}`,onClick:()=>u(e=>!e),"aria-describedby":`global-status-${c.projectId}-${c.id}`,title:`Resources and actions`,className:`min-h-[26px] rounded-md p-0 text-[11px] text-muted-foreground hover:bg-muted`,children:(0,$.jsx)(Ev,{id:`global-status-${c.projectId}-${c.id}`,dot:d.tone,shape:d.shape,pulse:d.pulse,children:d.label})}),n?(0,$.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:(0,$.jsx)(o,{to:wo(c.projectId,`/`),className:`truncate hover:text-foreground`,children:e.projectName})}):null,(0,$.jsx)(`span`,{children:e.tags.length>0?(0,$.jsx)(`span`,{className:`flex flex-wrap items-center gap-1`,children:e.tags.map(e=>(0,$.jsx)(rx,{tag:e},e))}):null})]})]}),(0,$.jsx)(`div`,{"data-slot":`global-task-references`,children:h.length>0?(0,$.jsx)(tx,{references:h,run:c,repoBase:e.project?.repoUrl}):(0,$.jsx)(ix,{})}),(0,$.jsx)(`div`,{"data-slot":`global-task-workflow`,className:`text-[13px] text-muted-foreground`,children:c.workflow}),(0,$.jsx)(`div`,{"data-slot":`global-task-diff`,className:`text-xs text-muted-foreground`,children:(0,$.jsx)(`span`,{title:`Change totals are available in the project task list`,children:`—`})}),(0,$.jsx)(`div`,{"data-slot":`global-task-age`,className:`text-right text-xs text-soft-foreground tabular-nums`,children:So(c.startedAt??c.createdAt,t)}),(0,$.jsx)(`div`,{"data-slot":`global-task-actions`,children:(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,$.jsx)($b,{task:e,busy:a,onSetRead:i}),(0,$.jsx)(ex,{task:e,busy:a,onArchive:r}),(0,$.jsx)(B,{asChild:!0,variant:`outline`,children:(0,$.jsx)(o,{to:f,children:`Open task`})})]})}),l?(0,$.jsx)(`div`,{"data-slot":`global-task-resources`,className:`col-span-full`,children:(0,$.jsxs)(`dl`,{className:`grid grid-cols-2 gap-4 rounded-md bg-muted/50 p-4 text-xs md:grid-cols-3`,children:[s?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:`Cost`}),(0,$.jsx)(`dd`,{className:`mt-1`,children:$r(c.costUsd)||`—`})]}):null,(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:`CPU`}),(0,$.jsx)(`dd`,{"data-usage":`cpu`,"data-usage-kind":g.cpu.kind,title:g.cpu.title,className:`mt-1`,children:g.cpu.text||`—`})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:`Memory`}),(0,$.jsx)(`dd`,{"data-usage":`mem`,"data-usage-kind":g.mem.kind,title:g.mem.title,className:`mt-1`,children:g.mem.text||`—`})]})]})}):null]})}function $b({task:e,busy:t,onSetRead:n}){if(!Ji(e.run))return null;let r=rr(e.run),i=hr(e.run),a=r?`Mark ${i} read`:`Mark ${i} unread`,o=r?Na:Fc;return(0,$.jsxs)(Ay,{children:[(0,$.jsx)(jy,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,"data-action":r?`mark-read`:`mark-unread`,"aria-label":a,disabled:t,onClick:()=>n(e,r),className:U(`inline-flex size-11 items-center justify-center md:size-8 rounded-md transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none disabled:cursor-wait disabled:opacity-50`,r?`text-accent-icon`:`text-soft-foreground`),children:[(0,$.jsx)(o,{className:`size-3.5`,"aria-hidden":`true`}),(0,$.jsx)(`span`,{children:r?`Mark read`:`Mark unread`})]})}),(0,$.jsx)(My,{side:`left`,children:r?`Mark read`:`Mark unread`})]})}function ex({task:e,busy:t,onArchive:n}){let r=e.run.archived;if(!r&&!Wb.has(e.run.status))return null;let i=r?`Restore ${hr(e.run)} to the active list`:`Archive ${hr(e.run)}`;return(0,$.jsxs)(Ay,{children:[(0,$.jsx)(jy,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,"data-action":r?`unarchive-run`:`archive-run`,"aria-label":i,disabled:t,onClick:()=>n(e,!r),className:`inline-flex size-11 items-center justify-center md:size-8 rounded-md text-soft-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none disabled:cursor-wait disabled:opacity-50`,children:[(0,$.jsx)(r?pc:Ee,{className:`size-3.5`,"aria-hidden":`true`}),(0,$.jsx)(`span`,{children:r?`Unarchive`:`Archive`})]})}),(0,$.jsx)(My,{side:`left`,children:r?`Restore`:`Archive`})]})}function tx({references:e,run:t,repoBase:n}){let r=e.slice(0,Hb),i=e.length-r.length,a=hr(t);return(0,$.jsxs)(`span`,{className:`flex flex-nowrap items-center gap-1`,children:[r.map(e=>(0,$.jsx)(Bv,{reference:e,taskTitle:a,projectId:t.projectId,to:Gr(t.projectId,t.id,e,n),conflictAction:(0,$.jsx)(Ty,{projectId:t.projectId,runId:t.id,prNumber:e.number}),className:`shrink-0`},ki(e))),i>0?(0,$.jsx)(nx,{references:e,taskTitle:a,hidden:i,projectId:t.projectId,runId:t.id,repoBase:n}):null]})}function nx({references:e,taskTitle:t,hidden:n,projectId:r,runId:i,repoBase:a}){let[o,s]=Q.useState(!1),c=Q.useRef(!1),l=Q.useRef(void 0);Q.useEffect(()=>()=>clearTimeout(l.current),[]);let u=e=>e.pointerType!==`touch`,d=()=>clearTimeout(l.current),f=e=>{u(e)&&(d(),c.current=!0,s(!0))},p=e=>{u(e)&&(d(),l.current=setTimeout(()=>s(!1),Ub))};return(0,$.jsxs)(Ea,{open:o,onOpenChange:s,children:[(0,$.jsx)(xa,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,"data-slot":`reference-overflow`,"aria-label":`Show all ${e.length} references for ${t}`,onPointerEnter:f,onPointerLeave:p,onPointerDown:()=>{c.current=!1},onClick:()=>{c.current=!1},className:`shrink-0 rounded-full px-1 text-[11px] font-medium text-soft-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:[`+`,n]})}),(0,$.jsxs)(wa,{align:`start`,className:`w-auto min-w-40 p-1.5`,"data-slot":`reference-overflow-list`,onPointerEnter:f,onPointerLeave:p,onOpenAutoFocus:e=>{c.current&&e.preventDefault()},onCloseAutoFocus:e=>{c.current&&e.preventDefault()},children:[(0,$.jsx)(`p`,{className:`px-1 pb-1.5 text-[11px] text-soft-foreground`,children:`References`}),(0,$.jsx)(`span`,{className:`flex flex-col items-start gap-1`,children:e.map(e=>(0,$.jsx)(Bv,{reference:e,taskTitle:t,projectId:r,to:Gr(r,i,e,a)},ki(e)))})]})]})}function rx({tag:e,className:t}){return(0,$.jsx)(`span`,{"data-slot":`project-tag`,className:U(`inline-flex max-w-full items-center truncate rounded-full bg-muted px-1.5 py-px text-[11px] font-medium text-muted-foreground`,t),children:e})}function ix(){return(0,$.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`—`})}function ax({view:e,filtered:t}){return t?(0,$.jsx)(G,{heading:`h2`,icon:(0,$.jsx)(Oo,{}),tone:`neutral`,title:`No matching tasks`,subtitle:`No task in any project matches these filters.`}):e===`archived`?(0,$.jsx)(G,{heading:`h2`,icon:(0,$.jsx)(Ee,{}),tone:`neutral`,title:`Nothing archived yet`,subtitle:`Finished tasks you archive land here, from every project.`}):(0,$.jsx)(G,{heading:`h2`,icon:(0,$.jsx)(Jc,{}),tone:`neutral`,title:`No tasks yet`,subtitle:`Start a task in any project and it shows up here.`})}function ox({className:e,...t}){return(0,$.jsx)(Xl,{"data-slot":`label`,className:U(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}var sx=`quick-task`;function cx(e={}){let{prompt:t,workflow:n,runner:r,model:i,autonomous:a,...o}=e.task??{prompt:``},s=e.task===void 0;return{name:e.name??``,description:e.description??``,kind:e.kind??`schedule`,schedule:Mn(e.schedule??{type:`daily`}),events:e.events??[`issue.opened`],intervalSeconds:e.intervalSeconds??300,filters:e.filters??{lookbackDays:7,maxRecords:25},prompt:t,...n===void 0?s?{workflow:sx}:{}:{workflow:n},...r===void 0?{}:{runner:r},...i===void 0?{}:{model:i},autonomous:a??!0,enabled:e.enabled??e.enable??!1,taskExtra:o}}function lx(e){switch(e.type){case`daily`:case`weekdays`:return{type:e.type,hour:e.hour,minute:e.minute};case`weekly`:return{type:`weekly`,hour:e.hour,minute:e.minute,day:e.day};case`hours`:return{type:`hours`,every:e.every}}}function ux(e){return{...e.taskExtra,prompt:e.prompt,...e.workflow?{workflow:e.workflow}:{},...e.runner?{runner:e.runner}:{},...e.model?{model:e.model}:{},autonomous:e.autonomous}}function dx(e){return{name:e.name.trim(),...e.description.trim()?{description:e.description.trim()}:{},kind:e.kind,...e.kind===`schedule`?{schedule:lx(e.schedule)}:{events:e.events,intervalSeconds:e.intervalSeconds,filters:e.filters},task:ux(e)}}function fx(e){return{...dx(e),enable:e.enabled}}function px(e,t){return{...dx(e),enabled:e.enabled,expectedRevision:t}}function mx({...e}){return(0,$.jsx)(Kl,{"data-slot":`collapsible`,...e})}function hx({...e}){return(0,$.jsx)(Vl,{"data-slot":`collapsible-trigger`,...e})}function gx({...e}){return(0,$.jsx)(Ul,{"data-slot":`collapsible-content`,...e})}function _x({...e}){return(0,$.jsx)(mu,{"data-slot":`select`,...e})}function vx({...e}){return(0,$.jsx)(vu,{"data-slot":`select-value`,...e})}function yx({className:e,size:t=`default`,children:n,...r}){return(0,$.jsxs)(gu,{"data-slot":`select-trigger`,"data-size":t,className:U(`flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-[var(--task-brand-bg)] px-3 py-2 text-sm whitespace-nowrap shadow-none transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-11 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 hover:bg-muted [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...r,children:[n,(0,$.jsx)(bu,{asChild:!0,children:(0,$.jsx)(ge,{className:`size-4 opacity-50`})})]})}function bx({className:e,children:t,position:n=`item-aligned`,align:r=`center`,...i}){return(0,$.jsx)(wu,{children:(0,$.jsxs)(Eu,{"data-slot":`select-content`,className:U(`relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,align:r,...i,children:[(0,$.jsx)(Sx,{}),(0,$.jsx)(Vu,{className:U(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1`),children:t}),(0,$.jsx)(Cx,{})]})})}function xx({className:e,children:t,...n}){return(0,$.jsxs)(Zu,{"data-slot":`select-item`,className:U(`relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,$.jsx)(`span`,{"data-slot":`select-item-indicator`,className:`absolute right-2 flex size-3.5 items-center justify-center`,children:(0,$.jsx)(td,{children:(0,$.jsx)(ue,{className:`size-4`})})}),(0,$.jsx)($u,{children:t})]})}function Sx({className:e,...t}){return(0,$.jsx)(rd,{"data-slot":`select-scroll-up-button`,className:U(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,$.jsx)(A,{className:`size-4`})})}function Cx({className:e,...t}){return(0,$.jsx)(ad,{"data-slot":`select-scroll-down-button`,className:U(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,$.jsx)(ge,{className:`size-4`})})}function wx({pressed:e,onClick:t,disabled:n,children:r}){return(0,$.jsx)(`button`,{type:`button`,"aria-pressed":e,disabled:n,onClick:t,className:U(so,`h-11 px-4 text-[13px]`,e&&`border-transparent bg-accent-strong text-accent-strong-foreground hover:bg-accent-strong hover:text-accent-strong-foreground`),children:r})}var Tx=An.options,Ex=[{seconds:60,label:`1 minute`},{seconds:300,label:`5 minutes`},{seconds:900,label:`15 minutes`},{seconds:1800,label:`30 minutes`},{seconds:3600,label:`1 hour`}],Dx=[{key:`authors`,label:`Authors`},{key:`assignees`,label:`Assignees`},{key:`allLabels`,label:`Has all labels`},{key:`anyLabels`,label:`Has any label`},{key:`excludeLabels`,label:`Excludes labels`},{key:`changedLabels`,label:`Changed labels`,hint:`Required for the two label events.`}],Ox=e=>(e??[]).join(`, `),kx=e=>e.split(`,`).map(e=>e.trim()).filter(Boolean);function Ax(e){let t=Math.max(1,Math.round(e.intervalSeconds/60));return`Polls GitHub every ${t} minute${t===1?``:`s`} for ${e.events.join(`, `)||`no events`}. Enabling starts from a current-time baseline, so existing matches never launch tasks.`}function jx({draft:e,onChange:t,disabledReason:n}){let r=n=>{t({events:e.events.includes(n)?e.events.filter(e=>e!==n):[...e.events,n]})},i=n=>t({filters:{...e.filters,...n}}),a=(n,r)=>{let i=kx(r),{[n]:a,...o}=e.filters;t({filters:i.length?{...o,[n]:i}:o})},o=Ex.some(t=>t.seconds===e.intervalSeconds)?Ex:[...Ex,{seconds:e.intervalSeconds,label:`${Math.round(e.intervalSeconds/60)} minutes`}].sort((e,t)=>e.seconds-t.seconds);return(0,$.jsxs)(`div`,{className:`grid gap-4`,children:[n?(0,$.jsx)(`p`,{className:`text-xs text-pending-strong`,children:`GitHub unavailable · ${n}`}):null,(0,$.jsx)(`div`,{role:`group`,"aria-label":`GitHub events`,className:`flex flex-wrap gap-2`,children:Tx.map(t=>(0,$.jsx)(wx,{pressed:e.events.includes(t),onClick:()=>r(t),children:t},t))}),(0,$.jsxs)(`div`,{className:`grid gap-2`,children:[(0,$.jsx)(ox,{htmlFor:`automation-interval`,children:`Check every`}),(0,$.jsxs)(_x,{value:String(e.intervalSeconds),onValueChange:e=>t({intervalSeconds:Number(e)}),children:[(0,$.jsx)(yx,{id:`automation-interval`,className:`w-full sm:w-48`,"aria-label":`Check every`,children:(0,$.jsx)(vx,{})}),(0,$.jsx)(bx,{children:o.map(e=>(0,$.jsx)(xx,{value:String(e.seconds),children:e.label},e.seconds))})]})]}),(0,$.jsxs)(mx,{children:[(0,$.jsxs)(hx,{className:`group flex min-h-11 items-center gap-2 text-sm font-medium`,children:[`Filters`,(0,$.jsx)(ge,{"aria-hidden":`true`,className:`size-4 text-soft-foreground transition-transform motion-reduce:transition-none group-data-[state=open]:rotate-180`})]}),(0,$.jsx)(gx,{children:(0,$.jsxs)(`div`,{className:`grid gap-4 pt-2 sm:grid-cols-2`,children:[Dx.map(t=>(0,$.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,$.jsx)(ox,{htmlFor:`automation-filter-${t.key}`,children:t.label}),(0,$.jsx)(wm,{id:`automation-filter-${t.key}`,placeholder:`comma separated`,value:Ox(e.filters[t.key]),onChange:e=>a(t.key,e.target.value)}),t.hint?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.hint}):null]},t.key)),(0,$.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,$.jsx)(ox,{htmlFor:`automation-filter-lookback`,children:`Look back (days)`}),(0,$.jsx)(wm,{id:`automation-filter-lookback`,type:`number`,min:1,value:e.filters.lookbackDays,onChange:e=>i({lookbackDays:Math.max(1,Number(e.target.value)||1)})})]}),(0,$.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,$.jsx)(ox,{htmlFor:`automation-filter-max`,children:`Max records per check`}),(0,$.jsx)(wm,{id:`automation-filter-max`,type:`number`,min:1,value:e.filters.maxRecords,onChange:e=>i({maxRecords:Math.max(1,Number(e.target.value)||1)})})]})]})})]})]})}var Mx=[{type:`daily`,label:`Every day`},{type:`weekdays`,label:`Weekdays`},{type:`weekly`,label:`Weekly`},{type:`hours`,label:`Every N hours`}],Nx=e=>String(e).padStart(2,`0`);function Px({label:e,value:t,max:n,onCommit:r}){let[i,a]=(0,Q.useState)(Nx(t)),o=(0,Q.useRef)(null),s=!(/^\d{1,2}$/.test(i)&&Number(i)===t),c=`${e} must be 00–${Nx(n)}.`,l=(0,Q.useId)();return(0,Q.useEffect)(()=>{o.current?.setCustomValidity(s?c:``)},[s,c]),(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(wm,{ref:o,"aria-label":e,"aria-invalid":s||void 0,"aria-describedby":s?l:void 0,inputMode:`numeric`,maxLength:2,className:`w-20 text-center tabular-nums`,value:i,onChange:e=>{a(e.target.value),/^\d{1,2}$/.test(e.target.value)&&Number(e.target.value)<=n&&r(Number(e.target.value))},onBlur:()=>a(Nx(t))}),s?(0,$.jsx)(`p`,{id:l,className:`order-last basis-full text-xs text-destructive`,children:c}):null]})}function Fx({value:e,onChange:t,timeZone:n}){let r=n=>t({...e,...n});return(0,$.jsxs)(`div`,{className:`grid gap-4`,children:[(0,$.jsx)(`div`,{role:`group`,"aria-label":`Repeat`,className:`flex flex-wrap gap-2`,children:Mx.map(t=>(0,$.jsx)(wx,{pressed:e.type===t.type,onClick:()=>r({type:t.type}),children:t.label},t.type))}),e.type===`weekly`?(0,$.jsx)(`div`,{role:`group`,"aria-label":`Day of the week`,className:`flex flex-wrap gap-2`,children:In.map((t,n)=>(0,$.jsx)(wx,{pressed:e.day===n+1,onClick:()=>r({day:n+1}),children:t},t))}):null,e.type===`hours`?(0,$.jsxs)(`div`,{className:`grid gap-2`,children:[(0,$.jsx)(ox,{htmlFor:`automation-every`,children:`Run every`}),(0,$.jsxs)(_x,{value:String(e.every),onValueChange:e=>r({every:Number(e)}),children:[(0,$.jsx)(yx,{id:`automation-every`,className:`w-full sm:w-48`,"aria-label":`Run every`,children:(0,$.jsx)(vx,{})}),(0,$.jsx)(bx,{children:zn.map(e=>(0,$.jsx)(xx,{value:String(e),children:e===1?`hour`:`${e} hours`},e))})]}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Counted from midnight, so “every 6 hours” runs at 00:00, 06:00, 12:00 and 18:00.`})]}):(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`at`}),(0,$.jsx)(Px,{label:`Hour`,value:e.hour,max:23,onCommit:e=>r({hour:e})}),(0,$.jsx)(`span`,{"aria-hidden":`true`,children:`:`}),(0,$.jsx)(Px,{label:`Minute`,value:e.minute,max:59,onCommit:e=>r({minute:e})}),(0,$.jsx)(`span`,{className:`text-sm break-all text-muted-foreground`,children:n})]}),(0,$.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Cron: `,(0,$.jsx)(`code`,{className:`font-mono text-foreground`,children:Nn(e)})]})]})}function Ix(e,t){let n=t-e;if(n<=0)return`now`;let r=Math.floor(n/6e4);if(r<1)return`in <1m`;if(r<60)return`in ${r}m`;let i=Math.floor(r/60);return i<24?`in ${i}h`:`in ${Math.floor(i/24)}d`}var Lx=new Map;function Rx(e,t){if(!Number.isFinite(e))return null;let n=Lx.get(t);try{n??=new Intl.DateTimeFormat(`en-GB`,{timeZone:t,weekday:`short`,year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`})}catch{return null}Lx.set(t,n);let r={};for(let t of n.formatToParts(e))r[t.type]=t.value;let i=new Date(`${r.month} 1, ${r.year} UTC`).getUTCMonth();return{weekday:r.weekday,day:r.day,month:r.month,hour:r.hour,minute:r.minute,key:`${r.year}-${i}-${r.day}`,dayNumber:Math.floor(Date.UTC(Number(r.year),i,Number(r.day))/864e5)}}function zx(e,t){let n=Rx(Date.parse(e),t);return n?`${n.weekday} ${n.hour}:${n.minute}`:e}function Bx(e,t,n){let r=Rx(Date.parse(e),t),i=Rx(n,t);if(!r||!i)return e;let a=`${r.hour}:${r.minute}`,o=i.dayNumber-r.dayNumber;return o===0?`Today ${a}`:o===1?`Yesterday ${a}`:o>1&&o<7?`${r.weekday} ${a}`:`${r.day} ${r.month} ${a}`}var Vx=40*864e5,Hx=5;function Ux({schedule:e,timeZone:t,now:n=Date.now()}){let r=On(e,n+1,n+Vx,t,Hx);return(0,$.jsxs)(`section`,{"aria-labelledby":`next-runs-heading`,className:`rounded-xl border bg-card p-4`,children:[(0,$.jsx)(`h2`,{id:`next-runs-heading`,className:`mb-3 text-[15px] font-medium`,children:`Next 5 runs`}),r.length===0?(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No runs in the next 40 days.`}):(0,$.jsx)(`ol`,{"aria-label":`Next 5 runs`,className:`grid gap-1.5 text-sm`,children:r.map(e=>(0,$.jsxs)(`li`,{className:`flex items-baseline justify-between gap-3`,children:[(0,$.jsx)(`span`,{className:`font-medium tabular-nums`,children:zx(new Date(e).toISOString(),t)}),(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:Ix(n,e)})]},e))}),(0,$.jsxs)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:[`Times are in `,t,`, the zone this cezar runs in.`]})]})}function Wx({title:e,subtitle:t,action:n,children:r}){return(0,$.jsxs)(`main`,{"data-route":`automations`,className:`task-flow-page w-full max-w-full min-w-0 max-md:p-4!`,children:[(0,$.jsxs)(`header`,{className:`mb-6 flex flex-col items-start gap-5 max-md:mb-4 max-md:gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h1`,{className:`mb-2 text-[28px] font-medium max-md:text-[22px]`,children:e}),(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t})]}),n]}),r]})}function Gx({text:e}){return(0,$.jsx)(`div`,{role:`status`,className:`rounded-xl border bg-card p-6 text-sm text-muted-foreground`,children:e})}var Kx={schedule:`On a schedule`,github:`When GitHub changes`};function qx(e){return/placeholder|prompt|workflow|runner|model|task|autonomous/i.test(e)?`run`:/\bname\b/i.test(e)?`name`:/schedule|github|event|filter|label|interval|remote|forge|lookback|records?|hour|minute|poll|kind/i.test(e)?`when`:`form`}function Jx({title:e,failure:t,section:n,children:r}){return(0,$.jsxs)(`fieldset`,{className:`grid min-w-0 gap-4 rounded-xl border p-5 max-md:p-4!`,children:[(0,$.jsx)(`legend`,{className:`px-0`,children:e}),r,t?.section===n&&!t.conflict?(0,$.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:t.message}):null]})}function Yx({automation:e,forge:t,timeZone:n,onSaved:r,onReload:i}){let[a,o]=(0,Q.useState)(()=>cx(e)),[s,c]=(0,Q.useState)(e?.revision),[l,u]=(0,Q.useState)(),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(!1),[_,v]=(0,Q.useState)(``),y=e=>o(t=>({...t,...e})),b=async t=>{if(t.preventDefault(),d)return;let n=t.currentTarget;if(n instanceof HTMLFormElement&&!n.checkValidity()){n.reportValidity();return}f(!0),u(void 0);let i=`save`;try{if(e&&s!==void 0){let{automation:t}=await mn(e.id,px({...a,enabled:e.enabled},s));c(t.revision),a.enabled!==e.enabled&&(i=`enable`,await Wt(e.id,a.enabled))}else await an(fx(a));r()}catch(t){let n=t instanceof Error?t.message:String(t);i===`save`&&e&&t instanceof E&&t.status===409&&/revision conflict/i.test(n)?u({section:`form`,message:`Edited elsewhere — reload to see the latest version`,conflict:!0}):u({section:i===`enable`?`enable`:qx(n),message:n})}finally{f(!1)}},x=async()=>{if(!(!e||h)){g(!0),v(``);try{await gt(e.id),r()}catch(e){v(e instanceof Error?e.message:String(e))}finally{g(!1)}}},S=e?`Save changes`:a.enabled?`Save and enable`:`Save paused`,C=a.kind===`schedule`;return(0,$.jsx)(Wx,{title:e?`Edit automation`:`New automation`,subtitle:`Define when it runs and the ordinary task it launches.`,children:(0,$.jsxs)(`form`,{className:`automation-editor grid min-w-0 gap-5 md:grid-cols-[minmax(0,1fr)_320px] md:items-start`,onSubmit:b,children:[(0,$.jsxs)(`div`,{className:`grid min-w-0 gap-5`,children:[(0,$.jsx)(Jx,{title:`Name`,section:`name`,failure:l,children:(0,$.jsxs)(`div`,{className:`grid gap-2`,children:[(0,$.jsx)(ox,{htmlFor:`automation-name`,children:`Name`}),(0,$.jsx)(wm,{id:`automation-name`,value:a.name,onChange:e=>y({name:e.target.value}),required:!0})]})}),(0,$.jsxs)(Jx,{title:`When`,section:`when`,failure:l,children:[e?(0,$.jsxs)(`p`,{className:`text-sm`,children:[(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`Trigger · `}),Kx[a.kind]]}):(0,$.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[(0,$.jsx)(mb,{slot:`automation-kind`,label:`Trigger`,size:`touch`,value:a.kind,onChange:e=>y({kind:e}),options:[{value:`schedule`,label:Kx.schedule},{value:`github`,label:Kx.github,disabled:!t.available,...t.available?{}:{title:t.reason??`GitHub is unavailable`}}]}),t.available?null:(0,$.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:`GitHub unavailable · ${t.reason??`no GitHub access`}`})]}),C?(0,$.jsx)(Fx,{value:a.schedule,onChange:e=>y({schedule:e}),timeZone:n}):(0,$.jsx)(jx,{draft:a,onChange:y,...t.available?{}:{disabledReason:t.reason??`no GitHub access`}})]}),(0,$.jsxs)(Jx,{title:`What to run`,section:`run`,failure:l,children:[(0,$.jsxs)(`div`,{className:`grid gap-2`,children:[(0,$.jsx)(ox,{htmlFor:`automation-prompt`,children:`Prompt`}),(0,$.jsx)(ss,{id:`automation-prompt`,value:a.prompt,onChange:e=>y({prompt:e.target.value}),rows:4,required:!0}),(0,$.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:C?(0,$.jsxs)($.Fragment,{children:[`Available: `,`{{date}}`,` `,`{{time}}`,` `,`{{project}}`,` `,`{{automation}}`,`. A run-context block is appended automatically.`]}):(0,$.jsxs)($.Fragment,{children:[`Available: `,`{{github.number}}`,` `,`{{github.title}}`,` `,`{{github.url}}`,` `,`{{github.labels}}`,`. GitHub content is appended as untrusted context.`]})})]}),(0,$.jsx)(Xx,{draft:a,patch:y}),(0,$.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm`,children:[(0,$.jsx)(Qh,{"aria-label":`Autonomous`,checked:a.autonomous,onCheckedChange:e=>y({autonomous:e})}),(0,$.jsxs)(`span`,{children:[`Autonomous `,(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`· runs without waiting for answers`})]})]}),(0,$.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:`Each run is an ordinary task in its own worktree, queued behind the parallel cap, never auto-merged.`})]}),(0,$.jsxs)(Jx,{title:`Enable`,section:`enable`,failure:l,children:[(0,$.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm`,children:[(0,$.jsx)(Qh,{"aria-label":e?`Enabled`:`Enable after saving`,checked:a.enabled,onCheckedChange:e=>y({enabled:e})}),(0,$.jsx)(`span`,{children:e?`Enabled`:`Enable after saving`})]}),(0,$.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:C?`The first run is the next occurrence shown beside the schedule.`:`Enabling starts from a current-time baseline. Existing matches will not launch tasks.`})]}),l?.section===`form`?(0,$.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-3 text-sm text-destructive`,children:[(0,$.jsx)(`span`,{className:`break-words`,children:l.message}),l.conflict&&i?(0,$.jsx)(B,{type:`button`,variant:`outline`,onClick:i,children:`Reload`}):null]}):null,(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsx)(B,{type:`submit`,disabled:d,children:d?`Saving…`:S}),(0,$.jsx)(B,{type:`button`,variant:`outline`,asChild:!0,children:(0,$.jsx)(Z,{to:`/automations`,children:`Cancel`})})]}),e?(0,$.jsxs)(`div`,{className:`grid justify-items-start gap-2 border-t pt-4`,children:[p?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`text-sm break-words`,children:`Delete “${e.name}”? It will stop running and cannot be restored.`}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsx)(B,{type:`button`,variant:`danger-ghost`,"data-action":`automation-delete-confirm`,disabled:h,onClick:()=>void x(),children:`Delete automation`}),(0,$.jsx)(B,{type:`button`,variant:`outline`,disabled:h,onClick:()=>{m(!1),v(``)},children:`Keep`})]})]}):(0,$.jsx)(B,{type:`button`,variant:`outline`,"data-action":`automation-delete`,onClick:()=>m(!0),children:`Delete`}),_?(0,$.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:_}):null]}):null]}),(0,$.jsx)(`aside`,{className:`min-w-0 md:sticky md:top-4`,children:C?(0,$.jsx)(Ux,{schedule:a.schedule,timeZone:n}):(0,$.jsxs)(`section`,{className:`rounded-xl border bg-card p-4`,children:[(0,$.jsx)(`h2`,{className:`mb-2 text-[15px] font-medium`,children:`How it polls`}),(0,$.jsx)(`p`,{className:`text-sm break-words text-muted-foreground`,children:Ax(a)})]})})]})})}function Xx({draft:e,patch:t}){let n=Vr(),r=Ai(),i=mi(),a=e.runner??i.data?.defaultRunner??`claude`,o=gr(a),s=[...new Set([...(n.data?.workflows??[]).map(e=>e.name),...e.workflow?[e.workflow]:[]])],c=[...new Set([...he(r.data),...e.runner?[e.runner]:[]])],l=Ia(a,o.data,[e.model]),u=l.find(t=>t.id===(e.model??``))?.label??e.model??`auto`,d=e=>(0,$.jsx)(e,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`});return(0,$.jsx)(ao,{children:(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsx)(Ba,{slot:`automation-workflow-pill`,icon:d(Se),fieldLabel:!0,ariaLabel:`Workflow`,label:e.workflow??`inline steps`,value:e.workflow??``,disabled:e.workflow===void 0,disabledHint:`This automation carries its own steps.`,options:s.map(e=>({value:e,label:e})),onPick:e=>t({workflow:e})}),(0,$.jsx)(Ba,{slot:`automation-runner-pill`,icon:d(le),fieldLabel:!0,ariaLabel:`Runner`,label:e.runner??`default`,value:e.runner??``,options:[{value:``,label:`default`,desc:`The project’s default runner`},...c.map(e=>({value:e,label:Oa.find(t=>t.id===e)?.label??e}))],onPick:e=>{t({runner:e||void 0,model:void 0})}}),(0,$.jsx)(Ba,{slot:`automation-model-pill`,icon:d(Ie),fieldLabel:!0,ariaLabel:`Model`,label:u,value:e.model??``,options:l.map(e=>({value:e.id,label:e.label,desc:e.desc})),onPick:e=>t({model:e||void 0})})]})})}var Zx={launched:`success`,manual:`success`,"catch-up":`success`,skipped:`neutral`,"no-match":`neutral`,preview:`neutral`,baseline:`neutral`,duplicate:`neutral`,failed:`danger`,error:`danger`,"rate-limited":`danger`},Qx={launched:`Launched`,manual:`Manual`,"catch-up":`Catch up`,skipped:`Skipped`,"no-match":`No match`,preview:`Preview`,baseline:`Baseline`,duplicate:`Duplicate`,failed:`Failed`,error:`Error`,"rate-limited":`Rate limited`};function $x(e){let[t,n]=(0,Q.useState)(),[r,i]=(0,Q.useState)(``),a=(0,Q.useCallback)(()=>ce(e).then(({records:e})=>{n(e),i(``)}).catch(e=>i(String(e))),[e]);return(0,Q.useEffect)(()=>{a()},[a]),(0,Q.useEffect)(()=>Vs((t,n)=>{t===`automation-change`&&n.automationId===e&&a()}),[e,a]),{records:t,error:r,refresh:a}}function eS(e,t){return e.result!==`failed`&&e.result!==`error`||!e.receiptId||e.runId?!1:!t.some(t=>t.receiptId===e.receiptId&&(t.runId||t.seq>e.seq))}function tS({records:e,all:t,timeZone:n,onRetried:r}){let[i,a]=(0,Q.useState)(),[o,s]=(0,Q.useState)(),c=Date.now(),l=async e=>{a(e),s(void 0);try{await Xe(e),r()}catch(t){s({receiptId:e,message:t instanceof Error?t.message:String(t)})}finally{a(void 0)}};return(0,$.jsx)(`ol`,{className:`grid gap-3`,"aria-label":`Automation execution log`,children:e.map(e=>(0,$.jsxs)(`li`,{className:`min-w-0 rounded-xl border bg-card p-4`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,$.jsx)(Ev,{dot:Zx[e.result],children:Qx[e.result]}),(0,$.jsx)(`time`,{className:`text-xs text-muted-foreground`,dateTime:e.ts,title:e.ts,children:Bx(e.ts,n,c)})]}),e.reason?(0,$.jsx)(`p`,{className:`mt-2 text-sm break-words text-muted-foreground`,children:e.reason}):null,e.githubUrl||e.runId||eS(e,t)?(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-4 gap-y-2 text-sm`,children:[e.githubUrl?(0,$.jsx)(`a`,{className:`inline-flex min-h-11 items-center underline underline-offset-4 break-all`,href:e.githubUrl,target:`_blank`,rel:`noreferrer`,children:e.githubTitle??`GitHub #${e.githubNumber??``}`}):null,e.runId?(0,$.jsx)(Z,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${e.runId}`,children:`Open task`}):null,eS(e,t)?(0,$.jsx)(B,{variant:`outline`,disabled:i===e.receiptId,onClick:()=>void l(e.receiptId),children:`Retry task`}):null]}):null,o&&o.receiptId===e.receiptId?(0,$.jsx)(`p`,{role:`alert`,className:`mt-2 text-sm break-words text-destructive`,children:o.message}):null]},e.seq))})}var nS=`all`;function rS({label:e,value:t,onChange:n,options:r}){return(0,$.jsxs)(_x,{value:t,onValueChange:n,children:[(0,$.jsx)(yx,{"aria-label":e,className:`w-full sm:w-52`,children:(0,$.jsx)(vx,{})}),(0,$.jsx)(bx,{children:r.map(e=>(0,$.jsx)(xx,{value:e.value,children:e.label},e.value))})]})}function iS({automationId:e,automationName:t,timeZone:n}){let{records:r,error:i,refresh:a}=$x(e),[o,s]=(0,Q.useState)(nS),[c,l]=(0,Q.useState)(nS),u=(0,Q.useMemo)(()=>(r??[]).filter(e=>(o===nS||e.result===o)&&(c===nS||e.event===c)),[r,o,c]),d=(r??[]).some(e=>e.event);return(0,$.jsx)(Wx,{title:`Execution log`,subtitle:t??`Automation activity`,action:(0,$.jsx)(B,{variant:`outline`,asChild:!0,children:(0,$.jsx)(Z,{to:`/automations`,children:`Back to automations`})}),children:i&&!r?(0,$.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,$.jsx)(Gx,{text:i}),(0,$.jsx)(B,{variant:`outline`,onClick:()=>void a(),children:`Retry`})]}):r?r.length===0?(0,$.jsx)(Gx,{text:`Nothing has run yet.`}):(0,$.jsxs)(`div`,{className:`grid gap-4`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsx)(rS,{label:`Result`,value:o,onChange:s,options:[{value:nS,label:`All results`},...jn.options.map(e=>({value:e,label:Qx[e]}))]}),d?(0,$.jsx)(rS,{label:`Event`,value:c,onChange:l,options:[{value:nS,label:`All events`},...An.options.map(e=>({value:e,label:e}))]}):null]}),u.length===0?(0,$.jsx)(Gx,{text:`No rows match these filters.`}):(0,$.jsx)(tS,{records:u,all:r,timeZone:n,onRetried:()=>void a()})]}):(0,$.jsx)(Gx,{text:`Loading execution log…`})})}function aS({automationId:e,automationName:t,timeZone:n,showName:r=!1}){let{records:i,error:a,refresh:o}=$x(e);return(0,$.jsxs)(`section`,{"data-slot":`automation-inline-log`,className:`mt-4 min-w-0 border-t pt-4`,children:[(0,$.jsxs)(`h3`,{className:`mb-3 text-sm font-medium`,children:[`Recent activity`,r&&t?` · ${t}`:``]}),a&&!i?(0,$.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[(0,$.jsx)(Gx,{text:a}),(0,$.jsx)(B,{variant:`outline`,onClick:()=>void o(),children:`Retry`})]}):i?i.length===0?(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Nothing has run yet.`}):(0,$.jsx)(tS,{records:i.slice(0,5),all:i,timeZone:n,onRetried:()=>void o()}):(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading activity…`})]})}function oS({data:e,error:t,refresh:n}){let[r,i]=(0,Q.useState)({}),[a,o]=(0,Q.useState)({}),s=(e,t)=>i(n=>{let{[e]:r,...i}=n;return t?{...i,[e]:t}:i}),c=async(e,t)=>{o(t=>({...t,[e]:!0}));try{await t()}catch(t){s(e,{text:t instanceof Error?t.message:String(t),tone:`error`})}finally{o(t=>({...t,[e]:!1}))}},l=e=>c(e.id,async()=>{s(e.id,{text:`Starting…`,tone:`info`});let{runId:t}=await $t(e.id);s(e.id,{text:`Started task`,tone:`info`,runId:t}),n()}),u=e=>c(e.id,async()=>{s(e.id,void 0),await Wt(e.id,!e.enabled),await n()}),d=e=>c(e.id,async()=>{s(e.id,{text:`Checking…`,tone:`info`});let{checkId:t}=await It(e.id,`preview`);for(let r=0;r<60;r+=1){let r=await wt(t);if(r.status===`complete`){s(e.id,{text:`${r.matches??0} match${r.matches===1?``:`es`} found; no tasks launched.`,tone:`info`}),n();return}if(r.status===`error`)throw Error(r.error??`Preview failed`);await new Promise(e=>setTimeout(e,500))}throw Error(`Preview is still running`)});return(0,$.jsx)(Wx,{title:`Automations`,subtitle:`Schedules and GitHub checks run while Cezarion is open.`,action:(0,$.jsx)(B,{asChild:!0,children:(0,$.jsx)(Z,{to:`/automations/new`,children:`New automation`})}),children:t&&!e?(0,$.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,$.jsx)(Gx,{text:t}),(0,$.jsx)(B,{variant:`outline`,onClick:()=>void n(),children:`Retry`})]}):e?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(sS,{data:e}),e.automations.length===0?(0,$.jsx)(G,{icon:(0,$.jsx)(Fe,{}),tone:`neutral`,title:`No automations yet`,subtitle:`Create one paused, preview it, then enable it.`,heading:`h2`,actions:(0,$.jsx)(B,{asChild:!0,children:(0,$.jsx)(Z,{to:`/automations/new`,children:`New automation`})})}):(0,$.jsx)(`ul`,{className:`grid gap-3`,"aria-label":`Automations`,children:e.automations.map(t=>(0,$.jsx)(lS,{automation:t,timeZone:e.timeZone,note:r[t.id],busy:a[t.id]===!0,onRun:()=>void l(t),onToggle:()=>void u(t),onPreview:()=>void d(t)},t.id))})]}):(0,$.jsx)(Gx,{text:`Loading automations…`})})}function sS({data:e}){return(0,$.jsx)(`p`,{"data-slot":`automation-scheduler`,className:U(`mb-4 text-xs break-words`,e.scheduler.state===`scheduled`?`text-success`:`text-muted-foreground`),children:`Scheduler ${e.scheduler.state===`scheduled`?`running`:`idle`} · GitHub ${e.available?`available`:`unavailable`}${e.reason?` · ${e.reason}`:``} · ${e.timeZone}`})}function cS(e){return e.kind===`schedule`&&e.schedule?Un(e.schedule):`on ${(e.events??[]).join(`, `)} · every ${Math.round((e.intervalSeconds??300)/60)} min`}function lS({automation:e,timeZone:t,note:n,busy:r,onRun:i,onToggle:a,onPreview:o}){let s=e.kind===`schedule`,c=s?Te:tn,l=e.enabled&&s?e.nextRunAt:void 0;return(0,$.jsxs)(`li`,{"data-slot":`automation-card`,"data-kind":e.kind,className:`min-w-0 rounded-xl border bg-card p-4`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsxs)(`h2`,{className:`flex items-center gap-2 font-semibold break-words`,children:[(0,$.jsx)(c,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}),e.name]}),(0,$.jsx)(`p`,{className:`mt-1.5 text-[13px] break-words text-muted-foreground`,children:cS(e)})]}),(0,$.jsx)(Ev,{dot:e.enabled?`success`:`neutral`,children:e.enabled?`Enabled`:`Paused`})]}),(0,$.jsx)(`p`,{className:`mt-3 text-sm`,children:!s&&e.enabled?(0,$.jsx)(`span`,{children:`continuous`}):l?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{children:`Next run: ${zx(l,t)}`}),(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:` · ${Ix(Date.now(),Date.parse(l))}`})]}):(0,$.jsx)(`span`,{children:`Next run: —`})}),(0,$.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,$.jsx)(B,{variant:`outline`,asChild:!0,children:(0,$.jsx)(Z,{to:`/automations/${e.id}`,children:`Edit`})}),(0,$.jsx)(B,{variant:`outline`,asChild:!0,children:(0,$.jsx)(Z,{to:`/automations/${e.id}/log`,children:`Execution log`})}),(0,$.jsx)(B,{variant:`outline`,"data-action":`automation-toggle`,disabled:r,onClick:a,children:e.enabled?`Pause`:`Enable`}),s?(0,$.jsx)(B,{variant:`outline`,"data-action":`automation-run`,disabled:r,onClick:i,children:`Run now`}):(0,$.jsx)(B,{variant:`outline`,"data-action":`automation-preview`,disabled:r,onClick:o,children:`Test filter`})]}),n?(0,$.jsxs)(`p`,{role:n.tone===`error`?`alert`:`status`,className:U(`mt-3 text-sm break-words`,n.tone===`error`?`text-destructive`:`text-muted-foreground`),children:[n.text,n.runId?(0,$.jsxs)($.Fragment,{children:[` · `,(0,$.jsx)(Z,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${n.runId}`,children:`Open task`})]}):null]}):null,(0,$.jsx)(aS,{automationId:e.id,automationName:e.name,timeZone:t})]})}function uS(){let e=xo(),t=W(),n=t.data!==void 0,r=n&&t.data.capabilities?.automations!==!0,[i,a]=(0,Q.useState)(),[o,s]=(0,Q.useState)(``),c=(0,Q.useCallback)(()=>fe().then(e=>{a(e),s(``)}).catch(e=>s(String(e))),[]);return(0,Q.useEffect)(()=>{n&&!r&&c()},[n,r,c]),(0,Q.useEffect)(()=>Vs((t,n)=>{if(t!==`automation-change`)return;let r=n;typeof r.project==`string`&&(e===null||r.project===e)&&c()}),[e,c]),{data:i,error:o,refresh:c}}function dS({mode:e=`list`}){let{automationId:t}=D(),n=Eo(),{data:r,error:i,refresh:a}=uS(),[o,s]=(0,Q.useState)(0),c=W(),l=c.data!==void 0,u=l&&c.data.capabilities?.automations!==!0;if(!l)return(0,$.jsx)(`div`,{"data-route":`automations`,className:`task-flow-page flex min-h-full flex-col`,children:(0,$.jsx)(Gx,{text:`Loading automations…`})});if(u)return(0,$.jsx)(`div`,{"data-route":`automations`,className:`task-flow-page flex min-h-full flex-col`,children:(0,$.jsx)(G,{icon:(0,$.jsx)(Fe,{}),tone:`neutral`,title:`Automations are off`,subtitle:`This server does not run schedules, poll GitHub or launch tasks from them. Set CEZ_AUTOMATIONS=1 and restart cezar to turn automations on.`,heading:`h2`})});let d=()=>{n(`/automations`),a()},f=r?.automations.find(e=>e.id===t);if(e===`list`)return(0,$.jsx)(oS,{data:r,error:i,refresh:a});if(!r)return i?(0,$.jsx)(Wx,{title:`Automations`,subtitle:`Could not load automations.`,children:(0,$.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,$.jsx)(Gx,{text:i}),(0,$.jsx)(B,{variant:`outline`,onClick:()=>void a(),children:`Retry`})]})}):(0,$.jsx)(`div`,{"data-route":`automations`,className:`task-flow-page flex min-h-full flex-col`,children:(0,$.jsx)(Gx,{text:`Loading automations…`})});let p={available:r.available,...r.reason?{reason:r.reason}:{}};return e===`new`?(0,$.jsx)(Yx,{forge:p,timeZone:r.timeZone,onSaved:d}):e===`edit`?f?(0,$.jsx)(Yx,{automation:f,forge:p,timeZone:r.timeZone,onSaved:d,onReload:()=>void a().then(()=>s(e=>e+1))},`${f.id}:${o}`):(0,$.jsx)(Wx,{title:`Automation not found`,subtitle:`This automation may have been removed.`,children:(0,$.jsx)(B,{asChild:!0,variant:`outline`,children:(0,$.jsx)(Z,{to:`/automations`,children:`Back to automations`})})}):t?(0,$.jsx)(iS,{automationId:t,automationName:f?.name,timeZone:r.timeZone}):(0,$.jsx)(Gx,{text:`Automation not found.`})}function fS(e){return e instanceof Error?e.message.match(/https:\/\/github\.com\/orgs\/[A-Za-z0-9._-]+\/sso\?authorization_request=[A-Za-z0-9._~-]+(?![^\s'"<>])/)?.[0]??null:null}function pS({open:e,onOpenChange:t}){let[n,r]=(0,Q.useState)(``),[i,a]=(0,Q.useState)(``),[s,c]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(!1),d=(0,Q.useRef)(!1),f=oi(),p=Kn(),{mutate:m,isPending:h}=p,g=Ne(),_=fS(p.error),v=(0,Q.useMemo)(()=>`co-${Math.random().toString(36).slice(2)}-${Date.now().toString(36)}`,[]),y=(0,Q.useRef)(v);y.current=v,(0,Q.useEffect)(()=>Vs((e,t)=>{if(e!==`checkout-progress`)return;let n=t;n?.checkoutId===y.current&&(n.phase===`cloning`&&n.line?c(n.line):n.phase!==`cloning`&&c(null))}),[]);let b=(0,Q.useMemo)(()=>{let e=n.trim().replace(/\/+$/,``).replace(/\.git$/,``).split(`/`).pop()??``;return e.includes(`:`)?e.split(`:`).pop()??``:e},[n]),x=i.trim()===``?b:i.trim(),S=f.data?.projectsDir??``,C=x===``?``:`${S.replace(/\/+$/,``)}/${x}`,w=(0,Q.useCallback)(()=>{n.trim()===``||h||(d.current=!1,u(!1),c(null),m({url:n.trim(),checkoutId:v,...i.trim()===``?{}:{name:i.trim()}},{onSuccess:({project:e})=>{t(!1),g(`/p/${encodeURIComponent(e.id)}/`)}}))},[m,h,v,i,g,t,n]);return(0,Q.useEffect)(()=>{if(!l)return;let e=()=>{d.current&&(d.current=!1,u(!1),w())},t=()=>{document.visibilityState===`visible`&&e()};return window.addEventListener(`focus`,e),document.addEventListener(`visibilitychange`,t),()=>{window.removeEventListener(`focus`,e),document.removeEventListener(`visibilitychange`,t)}},[l,w]),(0,$.jsx)(rs,{open:e,onOpenChange:e=>p.isPending?void 0:t(e),children:(0,$.jsxs)(as,{"data-slot":`clone-project-dialog`,className:`min-w-0 max-h-[calc(100dvh-2rem)] overflow-x-hidden overflow-y-auto sm:max-w-lg`,children:[(0,$.jsxs)(is,{children:[(0,$.jsx)(os,{children:`Clone from GitHub`}),(0,$.jsxs)(ns,{children:[`cezar clones with `,(0,$.jsx)(`code`,{children:`gh`}),` into your checkout root and adds the result as a project.`]})]}),(0,$.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,$.jsx)(ox,{htmlFor:`clone-url`,children:`Repository`}),(0,$.jsx)(wm,{id:`clone-url`,"data-slot":`clone-url`,autoFocus:!0,placeholder:`owner/repo or https://github.com/owner/repo`,value:n,disabled:p.isPending,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`&&w()}})]}),(0,$.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,$.jsx)(ox,{htmlFor:`clone-name`,children:`Folder name`}),(0,$.jsx)(wm,{id:`clone-name`,"data-slot":`clone-name`,placeholder:b===``?`repo`:b,value:i,disabled:p.isPending,onChange:e=>a(e.target.value)}),(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,$.jsx)(`p`,{"data-slot":`clone-target`,className:`min-w-0 flex-1 truncate font-mono text-[11px] text-soft-foreground`,title:C,children:C}),p.isPending?(0,$.jsx)(B,{"data-slot":`clone-root-settings`,variant:`ghost`,size:`icon-sm`,className:`size-7`,"aria-label":`Edit checkout root`,title:`Edit checkout root`,disabled:!0,children:(0,$.jsx)(R,{className:`size-3.5`,"aria-hidden":`true`})}):(0,$.jsx)(B,{asChild:!0,variant:`ghost`,size:`icon-sm`,className:`size-7`,children:(0,$.jsx)(o,{to:`/settings/global/projects`,"data-slot":`clone-root-settings`,"aria-label":`Edit checkout root`,title:`Edit checkout root`,children:(0,$.jsx)(R,{className:`size-3.5`,"aria-hidden":`true`})})})]})]}),p.isPending?(0,$.jsx)(`p`,{"data-slot":`clone-progress`,className:`truncate font-mono text-[11px] text-muted-foreground`,children:s??`Starting the clone…`}):null,p.isError?(0,$.jsx)(`div`,{"data-slot":`clone-error`,className:`grid min-w-0 gap-1.5 text-[13px] text-danger`,children:_?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{children:`GitHub requires SAML authorization for this organization.`}),(0,$.jsxs)(`p`,{children:[(0,$.jsx)(`a`,{"data-slot":`clone-sso-link`,className:`inline-flex min-h-11 items-center font-medium underline underline-offset-2`,href:_,target:`_blank`,rel:`noreferrer`,onClick:()=>{d.current=!0,u(!0)},children:`Authorize this GitHub organization`}),l?` — return here after authorizing, or choose Retry clone.`:` — return to this tab to retry, or choose Retry clone.`]}),(0,$.jsxs)(`details`,{className:`min-w-0`,children:[(0,$.jsx)(`summary`,{className:`min-h-11 content-center`,children:`Error details`}),(0,$.jsx)(`p`,{className:`whitespace-pre-wrap break-all`,children:p.error instanceof Error?p.error.message:null})]})]}):(0,$.jsx)(`p`,{className:`min-w-0 whitespace-pre-wrap break-all`,children:p.error instanceof Error?p.error.message:`could not clone that repository`})}):null,(0,$.jsxs)(ts,{children:[(0,$.jsx)(B,{variant:`outline`,disabled:p.isPending,onClick:()=>t(!1),children:`Cancel`}),(0,$.jsx)(B,{"data-slot":`clone-confirm`,disabled:n.trim()===``||x===``||p.isPending,onClick:w,children:p.isPending?`Cloning…`:p.isError?`Retry clone`:`Clone`})]})]})})}var mS=e=>e.available?`success`:`danger`,hS=e=>e.available?`Installed`:`Not installed`,gS=e=>e.available?null:e.hint??null,_S=`/settings/agents`,vS=`inline-flex items-center rounded-sm text-xs font-medium text-foreground hover:underline focus-visible:underline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring max-md:min-h-11 no-hover:min-h-11`;function yS(){let e=W(),t=oi(),n=Hi(e.data?.repo?.remote),[r,i]=(0,Q.useState)(null),[a,o]=(0,Q.useState)(!1),s=async()=>{if(!(!e.data||a)){o(!0);try{await navigator.clipboard.writeText(JSON.stringify({version:e.data.version,checks:e.data.checks},null,2)),L(`Diagnostics copied`)}catch{L(`Could not copy diagnostics. Please try again.`,{tone:`danger`})}finally{o(!1)}}};return(0,$.jsxs)(`div`,{"data-route":`workspace-tools`,className:`w-full space-y-[22px] px-9 py-9 max-md:px-[18px] max-md:py-6`,children:[(0,$.jsx)(`h1`,{className:`text-[28px] font-normal leading-[1.5] max-md:text-[24px]`,children:`Workspace tools`}),e.data?.capabilities.singleProject===!0?null:(0,$.jsxs)(`section`,{className:`space-y-4 rounded-xl border border-border bg-card p-6 max-md:p-4`,"aria-labelledby":`add-project-heading`,children:[(0,$.jsx)(`h2`,{id:`add-project-heading`,className:`text-lg font-normal leading-[1.5]`,children:`Add project`}),(0,$.jsx)(`p`,{className:`text-[13px] leading-[1.5] text-muted-foreground`,children:`Open an existing local folder or clone a GitHub repository.`}),(0,$.jsxs)(`dl`,{className:`space-y-4 text-[13px] leading-[1.5] text-muted-foreground`,children:[e.data?.repoRoot?(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-x-3`,children:[(0,$.jsx)(`dt`,{children:`Local folder`}),(0,$.jsx)(`dd`,{className:`min-w-0 break-all`,children:e.data.repo?.root??e.data.repoRoot})]}):null,n?(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-x-3`,children:[(0,$.jsx)(`dt`,{children:`Repository`}),(0,$.jsx)(`dd`,{className:`min-w-0 break-all`,children:n.replace(/^https:\/\//,``)})]}):null,t.data?.projectsDir?(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-x-3`,children:[(0,$.jsx)(`dt`,{children:`Checkout folder`}),(0,$.jsx)(`dd`,{className:`min-w-0 break-all`,children:t.data.projectsDir})]}):null]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,$.jsx)(B,{variant:`outline`,className:`h-10 rounded-lg px-[15px] text-xs font-normal leading-[18px]`,onClick:()=>i(`local`),children:`Open local folder`}),(0,$.jsx)(B,{variant:`outline`,className:`h-10 rounded-lg px-[15px] text-xs font-normal leading-[18px]`,onClick:()=>i(`clone`),children:`Clone from GitHub`})]})]}),(0,$.jsxs)(`section`,{className:`space-y-4 rounded-xl border border-border bg-card p-6 max-md:p-4`,"aria-labelledby":`tools-heading`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsx)(`h2`,{id:`tools-heading`,className:`text-lg font-normal leading-[1.5]`,children:`Tools diagnostics`}),(0,$.jsx)(Z,{to:_S,"data-slot":`tools-settings`,className:vS,children:`Tool settings ›`})]}),(0,$.jsx)(`p`,{className:`text-[13px] leading-[1.5] text-muted-foreground`,children:`Check the tools available to this local workspace.`}),e.isError?(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:`Could not refresh tool diagnostics. Recheck to retry.`}):null,!e.data&&!e.isError?(0,$.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:`Checking installed tools…`}):null,e.data?(0,$.jsx)(`dl`,{className:`space-y-4 text-[13px] leading-[1.5] text-muted-foreground`,children:e.data.checks.map(e=>{let t=gS(e);return(0,$.jsxs)(`div`,{"data-slot":`tool-row`,"data-tool":e.name,"data-available":e.available,className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,$.jsxs)(`dt`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(aa,{tone:mS(e)}),(0,$.jsx)(`span`,{className:`font-mono text-[13px] font-medium text-foreground`,children:e.name})]}),(0,$.jsxs)(`dd`,{className:`flex min-w-0 flex-1 items-center gap-x-3 text-muted-foreground`,children:[(0,$.jsxs)(`span`,{className:`min-w-0 break-words`,children:[hS(e),e.version?` · ${e.version}`:``]}),e.available?null:(0,$.jsx)(Z,{to:_S,"data-slot":`tool-setup`,className:`${vS} ml-auto`,children:`Set up ›`})]}),t?(0,$.jsx)(`dd`,{"data-slot":`tool-hint`,className:`basis-full min-w-0 break-words pl-[15px] text-xs leading-snug text-muted-foreground`,children:t}):null]},e.name)})}):null,e.data?.checks.length===0?(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No tool diagnostics reported by this server.`}):null,(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,$.jsx)(B,{variant:`outline`,className:`h-10 rounded-lg px-[15px] text-xs font-normal leading-[18px]`,disabled:e.isFetching,onClick:()=>void e.refetch(),children:e.isFetching?`Checking tools…`:`Recheck tools`}),(0,$.jsx)(B,{variant:`outline`,className:`h-10 rounded-lg px-[15px] text-xs font-normal leading-[18px]`,disabled:!e.data||a,onClick:()=>void s(),children:a?`Copying…`:`Copy diagnostics`})]})]}),r===`local`?(0,$.jsx)(i_,{open:!0,onOpenChange:e=>{e||i(null)}}):null,r===`clone`?(0,$.jsx)(pS,{open:!0,onOpenChange:e=>{e||i(null)}}):null]})}var bS=(0,Q.lazy)(()=>Y(()=>import(`./task-thread-BPQ64lui.js`).then(e=>({default:e.TaskThreadRoute})),__vite__mapDeps([21,5,7,8,9,10,22,11,12,13,14,15,16,17,18,23,24,20,19,25,26,27,28,29,30,31,32,33,34]))),xS=(0,Q.lazy)(()=>Y(()=>import(`./compare-variants-D6WXhvXA.js`).then(e=>({default:e.CompareVariantsRoute})),__vite__mapDeps([35,5,7,8,9,10,22,16,12,30,33]))),SS=(0,Q.lazy)(()=>Y(()=>import(`./task-changes--lQF6EYf.js`).then(e=>({default:e.TaskChangesRoute})),__vite__mapDeps([36,5,7,8,9,10,22,23,12,13,14,24,20,15,16,19,25,18,26,27,28,37,38,39,40,32]))),CS=(0,Q.lazy)(()=>Y(()=>import(`./task-files-D50s-gKW.js`).then(e=>({default:e.TaskFilesRoute})),__vite__mapDeps([41,5,7,8,9,10,22,12,23,13,14,24,20,15,16,19,25,18,26,27,28]))),wS=(0,Q.lazy)(()=>Y(()=>import(`./task-commits-Cx0qy4DN.js`).then(e=>({default:e.TaskCommitsRoute})),__vite__mapDeps([42,5,7,8,9,10,22,23,12,13,14,24,20,15,16,19,25,18,26,27,28,38,30,31,39,40,32]))),TS=(0,Q.lazy)(()=>Y(()=>import(`./task-github-item-DaqmSwYT.js`).then(e=>({default:e.TaskGithubItemRoute})),__vite__mapDeps([43,7,5,8,9,10,22,23,12,13,14,24,20,15,16,19,25,18,26,27,28,30,44,29,17,45,39,40,32,46]))),ES=(0,Q.lazy)(()=>Y(()=>import(`./repo-git-Cf4t5PD0.js`).then(e=>({default:e.RepoGitRoute})),__vite__mapDeps([47,5,7,8,9,10,22,12,14,48,38,37,24,20,18,19,16,30,39,40,32,49]))),DS=(0,Q.lazy)(()=>Y(()=>import(`./github-CfV5sqL0.js`).then(e=>({default:e.GithubRoute})),__vite__mapDeps([50,5,7,8,9,10,22,14,12,48,24,20,29,27,16,25,44,17,45,39,40,32,46]))),OS=(0,Q.lazy)(()=>Y(()=>import(`./workflows-jwG7uxqi.js`).then(e=>({default:e.WorkflowsRoute})),__vite__mapDeps([51,5,7,8,9,10,22,20,27,45,52]))),kS=(0,Q.lazy)(()=>Y(()=>import(`./skills-DiVIgKeU.js`).then(e=>({default:e.SkillsRoute})),__vite__mapDeps([53,5,7,8,9,10,22,29,12,20,27,16,45,52])));function AS(){let e=l();return(0,$.jsx)(go,{to:{pathname:`/skills`,search:e.search,hash:e.hash},replace:!0})}function jS({sectionId:e}){let t=l();return(0,$.jsx)(se,{to:{pathname:dv(`global`,e),search:t.search,hash:t.hash},replace:!0})}function MS(){return(0,$.jsx)(`div`,{"data-route":`scope-resolving`,className:`flex min-h-full flex-col`,children:(0,$.jsx)(`p`,{className:`px-4 py-6 text-center text-xs text-soft-foreground`,children:`Loading…`})})}function NS(){let{projectId:e=``}=D(),t=l(),n=oi(),r=W();if(e==="default"){let e=n.data?.bootProject??(n.isError?r.data?.bootProject:void 0);if(e!==void 0){let n=t.pathname.replace(/^\/p\/default(?=\/|$)/,``);return(0,$.jsx)(se,{to:`/p/${encodeURIComponent(e)}${n||`/`}${t.search}${t.hash}`,replace:!0})}if(!n.isError)return(0,$.jsx)(MS,{})}if(n.data){if(!(n.data.bootProject===e||n.data.projects.some(t=>t.id===e)))return(0,$.jsx)(Vm,{projectId:e,registry:n.data})}else if(!n.isError)return(0,$.jsx)(MS,{});return(0,$.jsx)(je,{projectId:n.data?.bootProject===e?null:e,children:(0,$.jsx)(de,{},e)})}function PS(){let{projectId:e=``}=D();return(0,$.jsx)(Dm,{},e)}function FS(){let e=l(),t=W(),n=oi(),r=t.data?.bootProject??n.data?.bootProject,i=(t.data!==void 0||t.isError)&&(n.data!==void 0||n.isError);if(r===void 0&&!i)return(0,$.jsx)(MS,{});let a=r??`default`;if(e.pathname===`/`&&e.search===``&&e.hash===``){if(n.data===void 0&&!n.isError)return(0,$.jsx)(MS,{});let e=xl(hl(),n.data,r);if(e!==null)return(0,$.jsx)(se,{to:e,replace:!0})}let o=e.pathname===`/p`||e.pathname===`/p/`?`/`:e.pathname;return(0,$.jsx)(se,{to:`/p/${encodeURIComponent(a)}${o}${e.search}${e.hash}`,replace:!0})}var IS=[{pattern:`/`,pageLabel:`Tasks`},{pattern:`/tasks`,pageLabel:`All tasks`},{pattern:`/tools`,pageLabel:`Workspace tools`},{pattern:`/new`,pageLabel:`New task`},{pattern:`/compare/:groupId`,pageLabel:`Compare`},{pattern:`/git/*`,pageLabel:`Git`},{pattern:`/github/*`,pageLabel:`GitHub`},{pattern:`/automations/*`,pageLabel:`Automations`},{pattern:`/skills`,pageLabel:`Skills`},{pattern:`/inbox`,pageLabel:`Inbox`},{pattern:`/workflows/*`,pageLabel:`Workflows`},{pattern:`/settings/*`,pageLabel:`Settings`}];function LS(e){let t=_o(e),n=ae({path:`/tasks/:id/*`,end:!0},t);return n?{pageLabel:null,taskId:n.params.id??null}:{pageLabel:IS.find(({pattern:e})=>ae({path:e,end:!0},t))?.pageLabel??null,taskId:null}}function RS(e){return(0,$.jsxs)(I,{path:`/p/:projectId`,element:(0,$.jsx)(NS,{}),children:[(0,$.jsx)(I,{index:!0,element:(0,$.jsx)(lb,{})}),(0,$.jsx)(I,{path:`new`,element:(0,$.jsx)(PS,{})}),(0,$.jsxs)(I,{path:`tasks/:id`,element:(0,$.jsx)(ch,{}),children:[(0,$.jsx)(I,{index:!0,element:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(qm,{}),children:(0,$.jsx)(bS,{})})}),(0,$.jsx)(I,{path:`changes`,element:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(Um,{tab:`changes`}),children:(0,$.jsx)(SS,{})})}),(0,$.jsx)(I,{path:`files`,element:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(Um,{tab:`files`}),children:(0,$.jsx)(CS,{})})}),(0,$.jsx)(I,{path:`commits`,element:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(Um,{tab:`changes`}),children:(0,$.jsx)(wS,{})})}),(0,$.jsx)(I,{path:`commits/:sha`,element:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(Um,{tab:`changes`}),children:(0,$.jsx)(wS,{})})}),(0,$.jsx)(I,{path:`issue/:n`,element:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(Km,{kind:`issue`}),children:(0,$.jsx)(TS,{kind:`issue`})})}),(0,$.jsx)(I,{path:`pr/:n`,element:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(Km,{kind:`pr`}),children:(0,$.jsx)(TS,{kind:`pr`})})})]}),(0,$.jsx)(I,{path:`compare/:groupId`,element:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(Ol,{}),children:(0,$.jsx)(xS,{})})}),(0,$.jsx)(I,{path:`git`,element:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(zm,{}),children:(0,$.jsx)(ES,{section:`main`,index:!0})})}),(0,$.jsx)(I,{path:`git/commits`,element:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(zm,{}),children:(0,$.jsx)(ES,{section:`main`})})}),(0,$.jsx)(I,{path:`git/commits/:sha`,element:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(zm,{}),children:(0,$.jsx)(ES,{section:`main`})})}),(0,$.jsx)(I,{path:`git/not-landed`,element:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(zm,{}),children:(0,$.jsx)(ES,{section:`not-landed`})})}),(0,$.jsx)(I,{path:`git/cleanup`,element:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(zm,{}),children:(0,$.jsx)(ES,{section:`cleanup`})})}),(0,$.jsx)(I,{path:`git/branches`,element:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(zm,{}),children:(0,$.jsx)(ES,{section:`branches`})})}),(0,$.jsx)(I,{path:`git/changes`,element:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(zm,{}),children:(0,$.jsx)(ES,{section:`changes`})})}),(0,$.jsx)(I,{path:`github`,element:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(kl,{}),children:(0,$.jsx)(DS,{view:`issues`,index:!0})})}),(0,$.jsx)(I,{path:`github/prs`,element:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(kl,{}),children:(0,$.jsx)(DS,{view:`prs`})})}),(0,$.jsx)(I,{path:`github/issues/:n`,element:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(kl,{}),children:(0,$.jsx)(DS,{view:`issues`})})}),(0,$.jsx)(I,{path:`github/prs/:n`,element:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(kl,{}),children:(0,$.jsx)(DS,{view:`prs`})})}),(0,$.jsx)(I,{path:`github/prs/:n/changes`,element:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(kl,{}),children:(0,$.jsx)(DS,{view:`prs`,changes:!0})})}),(0,$.jsx)(I,{path:`automations`,element:(0,$.jsx)(dS,{})}),(0,$.jsx)(I,{path:`automations/new`,element:(0,$.jsx)(dS,{mode:`new`})}),(0,$.jsx)(I,{path:`automations/:automationId`,element:(0,$.jsx)(dS,{mode:`edit`})}),(0,$.jsx)(I,{path:`automations/:automationId/log`,element:(0,$.jsx)(dS,{mode:`log`})}),(0,$.jsx)(I,{path:`skills`,element:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(Bm,{}),children:(0,$.jsx)(kS,{})})}),(0,$.jsx)(I,{path:`inbox`,element:(0,$.jsx)(Kf,{})}),(0,$.jsx)(I,{path:`workflows`,element:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(Hm,{}),children:(0,$.jsx)(OS,{})})}),(0,$.jsx)(I,{path:`workflows/:name`,element:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(Hm,{}),children:(0,$.jsx)(OS,{})})}),(0,$.jsx)(I,{path:`settings`,element:(0,$.jsx)(_v,{capabilities:e})}),(0,$.jsx)(I,{path:`settings/skills`,element:(0,$.jsx)(AS,{})}),H_(`project`,e).map(t=>(0,$.jsx)(I,{path:`settings/${t.id}`,element:(0,$.jsx)(gv,{section:t,scope:`project`,capabilities:e})},t.id)),H_(`global`,e).map(e=>(0,$.jsx)(I,{path:`settings/${e.id}`,element:(0,$.jsx)(jS,{sectionId:e.id})},e.id)),(0,$.jsx)(I,{path:`*`,element:(0,$.jsx)(Lm,{})})]})}function zS(e,t){let n=be(j(RS(t)),e),r=n?.at(-1);return!n||!r||r.route.path===`*`?null:{pattern:`/${n.slice(1).map(e=>e.route.path).filter(e=>e!==void 0).join(`/`)}`.replace(/\/$/,``)||`/`,params:r.params}}function BS(){let e=W().data?.capabilities;return(0,$.jsxs)(C,{children:[RS(e),(0,$.jsx)(I,{path:`/tasks`,element:(0,$.jsx)(Jb,{})}),(0,$.jsx)(I,{path:`/tools`,element:(0,$.jsx)(yS,{})}),(0,$.jsx)(I,{path:`/settings/global`,element:(0,$.jsx)(se,{to:fv,replace:!0})}),H_(`global`,e).map(t=>(0,$.jsx)(I,{path:dv(`global`,t.id),element:(0,$.jsx)(gv,{section:t,scope:`global`,capabilities:e})},t.id)),(0,$.jsx)(I,{path:`*`,element:(0,$.jsx)(FS,{})})]})}var VS=2500,HS=e=>String(wo(e,`/`));function US(e,t,n){let r={href:HS(e),verify:!1},i=Dl(e,t,n.registry);if(i===null)return r;try{let e=zS(i.replace(/[?#].*$/,``),n.capabilities);return e===null?r:{href:i,verify:Object.keys(e.params).some(e=>e!==`projectId`)}}catch{return r}}async function WS(e,t,n,r,i){let a={projectId:e,signal:r},o=``;try{let s=zS(t,n);if(s===null)return!1;let{params:c}=s;if(o=s.pattern,o.startsWith(`/tasks/:id`)){let t=await We(e,c.id??``,{signal:r});if(o===`/tasks/:id/commits/:sha`)await en(c.id??``,c.sha??``,a);else if(o===`/tasks/:id/issue/:n`||o===`/tasks/:id/pr/:n`){let e=Number(c.n);if(!Number.isSafeInteger(e)||e<1)return!1;let n=o.endsWith(`/issue/:n`)?`issue`:`pr`;if(!Gi(t,i).some(t=>t.kind===n&&t.number===e))return i===void 0&&null;let r=await _n(o.endsWith(`/issue/:n`)?`issue`:`pr`,e,{},a);return r.available?r.item!==null:null}}else if(o===`/compare/:groupId`)await T(c.groupId??``,a);else if(o===`/git/commits/:sha`)await bt(c.sha??``,a);else if(o===`/github/issues/:n`||o.startsWith(`/github/prs/:n`)){let e=Number(c.n);if(!Number.isSafeInteger(e)||e<1)return!1;let t=await _n(o.startsWith(`/github/issues`)?`issue`:`pr`,e,{},a);return t.available?t.item!==null:null}else if(o===`/workflows/:name`){let{workflows:e,issues:t}=await p(a);return e.some(e=>e.name===c.name)?!0:t.length>0&&null}else if(o.startsWith(`/automations/:automationId`)){let e=await fe(a);return e.available?e.automations.some(e=>e.id===c.automationId):null}else return null;return!0}catch(e){return!KS(e,o)&&null}}var GS=/unknown revision|bad object|bad revision|unknown commit|not a commit hash|needed a single revision/i;function KS(e,t){return e instanceof E?e.status===404||(t===`/git/commits/:sha`||t===`/tasks/:id/commits/:sha`)&&e.status===409&&GS.test(e.message):!1}async function qS(e,t,n){let r=US(e,t,n);if(!r.verify)return r.href;let i=new AbortController,a=setTimeout(()=>i.abort(),VS);try{return await WS(e,r.href.replace(/[?#].*$/,``),n.capabilities,i.signal,n.repoBaseOf?.(e))===!1?HS(e):r.href}finally{clearTimeout(a)}}var JS={key:``,navigate:null,ticket:0};function YS(e,t){e!==JS.key&&JS.ticket++,JS.key=e,JS.navigate=t}function XS(){JS.ticket++}async function ZS(e,t,n){let r=++JS.ticket,i=JS.key,a=await qS(e,t,n);r===JS.ticket&&i===JS.key&&JS.navigate?.(a)}function QS(){let e=Ne(),t=l();Q.useLayoutEffect(()=>{YS(`${t.key}|${t.pathname}${t.search}${t.hash}`,e)},[e,t.key,t.pathname,t.search,t.hash])}function $S(){let e=oi().data,t=W().data,n=t?.capabilities,r=Q.useCallback(n=>e?.projects.find(e=>e.id===n)?.repoUrl??(n===(t?.bootProject??e?.bootProject)?Hi(t?.repo?.remote):void 0),[e,t]);QS();let{pathname:i,search:a,hash:o}=l(),s=Co(i),c=`${i}${a}${o}`;return{target:Q.useCallback(t=>t===s?{href:c,verify:!1}:US(t,Tl(t),{registry:e,capabilities:n}),[e,n,s,c]),go:Q.useCallback(async t=>{if(t===s)return XS();await ZS(t,Tl(t),{registry:e,capabilities:n,repoBaseOf:r})},[e,n,r,s])}}var eC=[{to:`/`,label:`Tasks`,icon:dt,match:[`/`,`/tasks`,`/compare`],badge:`tasks-unread`},{to:`/inbox`,label:`Inbox`,icon:At,match:[`/inbox`],badge:`inbox-count`,inbox:!0},{to:`/git`,label:`Git`,icon:nn,match:[`/git`]},{to:`/github`,label:`GitHub`,icon:tn,match:[`/github`],forge:!0},{to:`/automations`,label:`Automations`,icon:Fe,match:[`/automations`],automations:!0},{to:`/skills`,label:`Skills`,icon:F,match:[`/skills`],badge:`skills-update`},{to:`/workflows`,label:`Workflows`,icon:Se,match:[`/workflows`]},{to:`/settings`,label:`Settings`,icon:R,match:[`/settings`]}];function tC({forge:e=!1,inbox:t=!1,automations:n=!1}={}){return eC.filter(r=>(!r.forge||e)&&(!r.inbox||t)&&(!r.automations||n))}function nC(e,t){return t===`/`?e===`/`:e===t||e.startsWith(t+`/`)}function rC(e){let t=null;for(let n of eC)for(let r of n.match)nC(e,r)&&(t===null||r.length>t.length)&&(t={to:n.to,length:r.length});return t?.to??null}function iC(e){let t=rC(e);return eC.find(e=>e.to===t)??null}function aC(e){return/^\/(?:tasks|compare)\/[^/]+(?:\/|$)/.test(_o(e))}function oC(e,t){let n=_o(e);return/^\/git\/?$/.test(n)?new URLSearchParams(t).get(`view`)===`repo`:/^\/git\//.test(n)}var sC=[`/`,`/git`,`/github`],cC=[`/skills`,`/workflows`,`/settings`,`/inbox`,`/automations`],lC={light:`dark`,dark:`system`,system:`light`},uC={light:`light`,dark:`dark`,system:`system`};function dC({className:e,showLabel:t=!1,labelClassName:n}){let{theme:r,setTheme:i}=zg(),a=lC[r],o=Tt;return(0,$.jsxs)(B,{type:`button`,variant:`ghost`,size:`icon-sm`,className:e,"data-slot":`theme-toggle`,"data-theme-pref":r,title:`Theme: ${uC[r]}`,"aria-label":`Theme: ${uC[r]}. Switch to ${uC[a]}.`,onClick:()=>i(a),children:[(0,$.jsx)(o,{"aria-hidden":`true`}),t?(0,$.jsxs)(`span`,{className:n,children:[`Theme · `,r.charAt(0).toUpperCase()+r.slice(1)]}):null]})}var fC=`cezar:open-command-palette`;function pC(){window.dispatchEvent(new Event(fC))}function mC(e){return[...e].sort((e,t)=>Date.parse(t.createdAt)-Date.parse(e.createdAt))}function hC(e,t,n){let r=t.trim().toLowerCase();if(r===``)return 1;let i=(n?.length?`${e} ${n.join(` `)}`:e).toLowerCase(),a=r.split(/\s+/),o=0;for(let e of a){let t=i.indexOf(e);if(t===-1)return 0;let n=t===0||!/[a-z0-9]/.test(i[t-1]??``);o+=(n?1:.5)/(1+t/48)}return o/a.length}var gC=150;function _C(e,t,n,r=[]){let i=mC(e.filter(e=>!vr(e))).map(e=>({...e,projectId:t})),a=new Set(i.map(yC)),o=[...n??[],...r].filter(e=>vr(e)||a.has(yC(e))?!1:(a.add(yC(e)),!0)).sort((e,t)=>t.createdAt.localeCompare(e.createdAt));return[...i,...o]}function vC(e){let t=new Set;for(let n of[e.pullRequestUrl,e.referencedPullRequestUrl,e.referencedIssueUrl]){let e=n?/\/(\d+)\/?$/.exec(n):null;e&&t.add(Number(e[1]))}for(let n of[e.prNumber,e.issueNumber,e.markerRefs?.pr,e.markerRefs?.issue])typeof n==`number`&&Number.isInteger(n)&&n>0&&t.add(n);return[...t].flatMap(e=>[String(e),`#${e}`])}var yC=e=>`${e.projectId??``}/${e.id}`;function bC(e){let t=e.filter(e=>rr(e)).sort((e,t)=>(t.finishedAt??``).localeCompare(e.finishedAt??``)),n=new Set(t.map(yC));return{recentlyFinished:t,otherTasks:e.filter(e=>!n.has(yC(e)))}}function xC(e,t){return[...e].sort((e,n)=>Number(e.id===t)-Number(n.id===t)||n.lastOpenedAt.localeCompare(e.lastOpenedAt))}function SC(){let[e,t]=Q.useState(!1),n=Eo();Zf(`k`,()=>t(e=>!e));let r=Q.useCallback(()=>{t(!1),n(`/new`)},[n]);return Zf(`n`,r),ep(`c`,r),Q.useEffect(()=>{let e=()=>t(!0);return window.addEventListener(fC,e),()=>window.removeEventListener(fC,e)},[]),(0,$.jsx)(Za,{open:e,onOpenChange:t,title:`Command palette`,description:`Search projects, tasks, views, actions, and skills`,showCloseButton:!1,filter:hC,className:`top-[10vh] translate-y-0 sm:max-w-2xl lg:max-w-3xl xl:max-w-4xl`,children:(0,$.jsx)(wC,{close:()=>t(!1)})})}function CC({task:e,projectName:t,showProject:n,now:r,onSelect:i}){let a=Br(e),o=hr(e);return(0,$.jsxs)(to,{value:`task ${o} ${e.id}`,keywords:[...t?[t]:[],...vC(e),...[e.branch,e.workflow,e.workflowLabel,e.pullRequestUrl,e.referencedPullRequestUrl,e.referencedIssueUrl].filter(e=>!!e)],"data-slot":`palette-task`,"data-run-id":e.id,"data-project-id":e.projectId??void 0,onSelect:()=>i(e),children:[(0,$.jsx)(aa,{tone:a.tone,shape:a.shape,pulse:a.pulse,"aria-label":a.label,role:`img`}),e.delegation?.role===`worker`?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:`Worker`}):null,(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:o}),n&&t?(0,$.jsx)(`span`,{"data-slot":`palette-task-project`,className:`shrink-0 truncate text-xs text-soft-foreground`,children:t}):null,(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-soft-foreground tabular-nums`,children:So(e.finishedAt??e.createdAt,r)})]})}function wC({close:e}){let t=Eo(),n=Ne(),[r,i]=Q.useState(``),a=r.trim()!==``,o=xo(),{theme:s,setTheme:c}=zg(),l=Or(),u=Pr(),d=oi(),f=Mi(),p=W(),m=Date.now(),h=d.data,g=h!==void 0&&h.projects.length>1,_=ra(g),v=Q.useMemo(()=>g?xC(h.projects,o):[],[g,h,o]),y=Q.useMemo(()=>new Map((h?.projects??[]).map(e=>[e.id,e.name])),[h]),b=o??h?.bootProject??null,[x,S]=Q.useState(``);Q.useEffect(()=>{let e=setTimeout(()=>S(r),gC);return()=>clearTimeout(e)},[r]);let C=Yn(x),w=a?C.data?.runs:void 0,T=a&&!C.isPlaceholderData?(C.data?.truncated??[]).map(e=>y.get(e)??e):[],E=Q.useMemo(()=>_C(l.data??[],b,_.data?.runs,w),[l.data,b,_.data,w]),D=Q.useMemo(()=>bC(E),[E]),O=a?[]:D.recentlyFinished,k=a?E:D.otherTasks,A=g,j=e=>e.projectId===null?null:y.get(e.projectId)??null,ee=f.data?.skillUsage,te=Q.useMemo(()=>gs(u.data??[],ee),[u.data,ee]),M=n=>{e(),t(n)},ne=t=>{e(),n(t)},re=$S(),N=t=>{e(),re.go(t)},ie=n=>{e(),t(n.projectId===null?`/tasks/${n.id}`:wo(n.projectId,`/tasks/${n.id}`))},P=lC[s];return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Ga,{placeholder:`Search projects, tasks, views, actions, skills…`,value:r,onValueChange:i}),(0,$.jsxs)(Qa,{className:`max-h-[55vh] min-h-[14rem] sm:max-h-[60vh] lg:max-h-[68vh]`,children:[(0,$.jsx)(io,{children:`Nothing matches.`}),(0,$.jsx)(Wa,{children:(0,$.jsxs)(to,{value:`new task`,"data-slot":`palette-view`,"data-nav-to":`/new`,onSelect:()=>M(`/new`),children:[(0,$.jsx)(pn,{"aria-hidden":`true`}),`New task`,(0,$.jsx)(Ka,{children:`C`})]})}),!a&&O.length>0?(0,$.jsx)(Wa,{heading:`Recently finished`,children:O.map(e=>(0,$.jsx)(CC,{task:e,projectName:j(e),showProject:A,now:m,onSelect:ie},yC(e)))}):null,(0,$.jsxs)(Wa,{heading:`Views`,children:[g?(0,$.jsxs)(to,{value:`view All tasks`,"data-slot":`palette-view`,"data-nav-to":`/tasks`,onSelect:()=>ne(`/tasks`),children:[(0,$.jsx)(at,{"aria-hidden":`true`}),`All tasks`]}):null,tC({forge:p.data?.forge?.available===!0,inbox:p.data?.capabilities.followups===!0,automations:p.data?.capabilities.automations===!0}).map(e=>{let t=e.icon;return(0,$.jsxs)(to,{value:`view ${e.label}`,"data-slot":`palette-view`,"data-nav-to":e.to,onSelect:()=>M(e.to),children:[(0,$.jsx)(t,{"aria-hidden":`true`}),e.label]},e.to)})]}),v.length>0?(0,$.jsx)(Wa,{heading:`Projects`,children:v.map(e=>{let t=e.id===o,n=e.status===`missing`;return(0,$.jsxs)(to,{value:`project ${e.name} ${e.id}`,keywords:[e.root],"data-slot":`palette-project`,"data-project-id":e.id,disabled:n,onSelect:()=>N(e.id),children:[(0,$.jsx)(Ue,{"aria-hidden":`true`}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),n?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-soft-foreground`,children:`folder not found`}):e.branch===void 0?null:(0,$.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-soft-foreground`,children:e.branch}),t?(0,$.jsx)(ue,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},e.id)})}):null,k.length>0?(0,$.jsx)(Wa,{heading:`Tasks`,children:k.map(e=>(0,$.jsx)(CC,{task:e,projectName:j(e),showProject:A,now:m,onSelect:ie},yC(e)))}):null,(0,$.jsx)(Wa,{heading:`Actions`,children:(0,$.jsxs)(to,{value:`action toggle theme`,"data-slot":`palette-action`,"data-action":`toggle-theme`,onSelect:()=>{c(P),e()},children:[(0,$.jsx)(Tt,{"aria-hidden":`true`}),`Toggle theme`,(0,$.jsxs)(Ka,{className:`tracking-normal`,children:[s,` → `,P]})]})}),te.length>0?(0,$.jsx)(Wa,{heading:`Skills`,children:te.map(e=>(0,$.jsxs)(to,{value:`skill ${e.name} ${e.path}`,keywords:e.description?[e.description]:void 0,"data-slot":`palette-skill`,"data-skill":e.name,onSelect:()=>M(`/new?skill=${encodeURIComponent(e.name)}`),children:[(0,$.jsx)(`span`,{className:`shrink-0 font-medium`,children:e.name}),e.description?(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null]},e.path))}):null]}),T.length>0?(0,$.jsxs)(`p`,{"data-slot":`palette-search-truncated`,role:`status`,className:`border-t border-border px-3 py-2 text-[11px] text-soft-foreground`,children:[`More matches in `,T.join(`, `),`. Type more to narrow them.`]}):null]})}function TC({triggerClassName:e,icon:t=ve,iconClassName:n=`size-4`,side:r,origin:i,label:a,iconFrameClassName:o}={}){let[s,c]=Q.useState(!1),[l,u]=Q.useState(!1);return(0,$.jsxs)(Yo,{children:[(0,$.jsx)(Ko,{asChild:!0,children:(0,$.jsxs)(B,{variant:`ghost`,"aria-label":`Add project`,title:`Add project`,"data-origin":i,className:U(`size-9 p-0 text-muted-foreground`,e),children:[o?(0,$.jsx)(`span`,{"aria-hidden":`true`,className:o,children:(0,$.jsx)(t,{className:n,"aria-hidden":`true`})}):(0,$.jsx)(t,{className:n,"aria-hidden":`true`}),a?(0,$.jsx)(`span`,{children:a}):(0,$.jsx)(`span`,{className:`sr-only`,children:`Add project`})]})}),(0,$.jsxs)(qo,{align:`start`,side:r,className:`w-56`,children:[(0,$.jsx)(Fo,{className:`text-xs text-soft-foreground`,children:`Add project`}),(0,$.jsxs)(Ho,{"data-slot":`add-project-local`,onSelect:()=>c(!0),children:[(0,$.jsx)(Re,{"aria-hidden":`true`}),`Open local folder…`]}),(0,$.jsxs)(Ho,{"data-slot":`add-project-clone`,onSelect:()=>u(!0),children:[(0,$.jsx)(tn,{"aria-hidden":`true`}),`Clone from GitHub…`]})]}),s?(0,$.jsx)(i_,{open:!0,onOpenChange:c}):null,l?(0,$.jsx)(pS,{open:!0,onOpenChange:u}):null]})}function EC(e,t){let n=e=>e.split(`.`).slice(0,3).map(e=>Number.parseInt(e,10)||0),r=n(e),i=n(t);for(let e=0;e<3;e++){let t=(r[e]??0)-(i[e]??0);if(t!==0)return t>0}return!1}function DC({version:e,latestVersion:t,state:n,onApplyUpdate:r,onRestart:i,error:a,busy:o=!1,offline:s=!1}){let[c,l]=Q.useState(!1),u=Q.useRef(null),d=Q.useRef(!1),f=n?.status===`ready`,p=n?.status===`preparing`,m=n?.status===`restarting`,h=!!(e&&t&&EC(t,e)),g=n?.supported&&f&&!!i,_=n?.supported&&h&&!!r,v=n?.supported?f||m?`restart`:p||_?`update`:null:null,y=o||p||m,b=v===`restart`?`Restart required`:p?`Preparing update`:`Update from v${e} to v${t}`;return v?(0,$.jsxs)(zi,{open:c,onOpenChange:l,children:[(0,$.jsx)(`div`,{"data-slot":`application-update-action`,className:`flex size-11 shrink-0 items-center justify-center`,children:v?(0,$.jsx)(ky,{children:(0,$.jsxs)(Ay,{children:[(0,$.jsx)(jy,{asChild:!0,children:v===`update`?(0,$.jsx)(B,{variant:`ghost`,size:`icon`,className:`size-11 motion-safe:transition-transform motion-safe:duration-[var(--app-duration-1)] motion-safe:active:scale-[0.97]`,"aria-label":p?`Preparing update`:`Update application`,"aria-busy":y,disabled:!_||y||s,title:b,onClick:()=>{!_||y||s||d.current||(d.current=!0,r?.().finally(()=>{d.current=!1}))},children:(0,$.jsx)(w,{"aria-hidden":`true`,className:`size-[18px]`})}):(0,$.jsx)(B,{ref:u,variant:`ghost`,size:`icon`,className:`size-11 motion-safe:transition-transform motion-safe:duration-[var(--app-duration-1)] motion-safe:active:scale-[0.97]`,"aria-label":m?`Reconnecting after restart`:`Restart application`,"aria-busy":y,disabled:!g||y||s,title:b,onClick:()=>l(!0),children:(0,$.jsx)(Te,{"aria-hidden":`true`,className:`size-[18px]`})})}),(0,$.jsx)(My,{side:`bottom`,children:b})]})}):null}),(0,$.jsxs)(fi,{onCloseAutoFocus:e=>{e.preventDefault(),u.current?.focus()},children:[(0,$.jsxs)(Ii,{children:[(0,$.jsx)(Qr,{children:`Restart Cezarion?`}),(0,$.jsx)(qr,{children:`Running tasks will be recovered after restart. The cockpit will reconnect when the new version is ready.`})]}),(0,$.jsxs)(Ti,{children:[(0,$.jsx)(Ni,{children:`Restart Later`}),(0,$.jsx)(Si,{onClick:()=>{!g||y||s||d.current||(d.current=!0,l(!1),i?.().finally(()=>{d.current=!1}))},children:`Restart Now`})]})]})]}):null}function OC({version:e,latestVersion:t,state:n,error:r,offline:i=!1,busy:a=!1}){let o=r??(n?.status===`error`?n.message??`Update failed.`:null),s=n&&!n.supported&&e&&t&&EC(t,e),c=n?.message&&n.message!==`Update this installation manually.`?n.message:`Install the newer release using your original installation method, then restart Cezarion.`,l=o?null:i?`Connection lost. Reconnect to continue.`:n?.status===`preparing`||a&&n?.status!==`ready`?`Preparing update.`:n?.status===`restarting`?`Restarting. Reconnecting to the cockpit.`:a&&n?.status===`ready`?`Checking update status.`:s?`In-app updates are unavailable for this installation. ${c}`:null;return!o&&!l?null:(0,$.jsx)(`div`,{"data-slot":`application-update-feedback`,className:`px-4 pb-2 text-[11px] leading-4 text-muted-foreground`,children:o?(0,$.jsxs)(`p`,{role:`status`,children:[(0,$.jsx)(`span`,{className:`block truncate`,title:o,children:o}),(0,$.jsx)(`span`,{className:`block`,children:`Retry or update manually.`})]}):l?(0,$.jsx)(`p`,{role:`status`,title:l,children:l}):null})}var kC={amber:`text-signal-word-amber`,red:`text-signal-word-red`,violet:`text-status-running`,green:`text-success`};function AC({signal:e,known:t,current:n,maxParts:r,slot:i,className:a}){let o=q_(e).slice(0,r);return(0,$.jsx)(`span`,{"data-slot":i,className:U(`flex min-w-0 items-center font-medium`,n?`text-muted-foreground`:`text-soft-foreground`,a),children:t?o.length===0?`idle`:o.map((e,t)=>(0,$.jsxs)(`span`,{className:`flex items-center gap-x-[inherit]`,children:[t>0?(0,$.jsx)(`span`,{"aria-hidden":`true`,children:`·`}):null,(0,$.jsx)(`span`,{"data-tone":e.tone,className:kC[e.tone],children:e.text})]},e.tone)):`activity unknown`})}var jC={amber:`bg-pending text-signal-ink-amber`,red:`bg-danger text-signal-ink`,violet:`bg-status-running text-signal-ink`,green:`bg-success text-signal-ink`};function MC(e,t,n){return e>9&&!(n&&t>1)?22:t===1?18:14}function NC({position:e,segments:t,className:n,compact:r=!1}){let i=t.filter(e=>e.count>0);return i.length===0?null:(0,$.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`rail-pill-${e}`,className:U(`pointer-events-none absolute -right-[4px] box-border flex h-[17px] overflow-hidden rounded-[9px] border-2 border-background`,e===`top`?`-top-[6px]`:`top-[25px]`,n),children:i.map(({tone:e,count:t})=>(0,$.jsx)(`span`,{"data-segment":e,"data-count":t,style:{width:MC(t,i.length,r)},className:U(`flex items-center justify-center text-[10px] leading-[13px] font-bold tabular-nums`,jC[e]),children:t>9?`9+`:t},e))})}function PC(e){return{top:[{tone:`amber`,count:e?.needsYou??0},{tone:`red`,count:e?.failedUnread??0}],bottom:[{tone:`violet`,count:e?.inMotion??0},{tone:`green`,count:e?.finishedUnread??0}]}}function FC({...e}){return(0,$.jsx)(gi,{"data-slot":`sheet`,...e})}function IC({...e}){return(0,$.jsx)(si,{"data-slot":`sheet-trigger`,...e})}function LC({...e}){return(0,$.jsx)(Vi,{"data-slot":`sheet-close`,...e})}function RC({...e}){return(0,$.jsx)(yi,{"data-slot":`sheet-portal`,...e})}function zC({className:e,...t}){return(0,$.jsx)(Oi,{"data-slot":`sheet-overlay`,className:U(`fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function BC({className:e,children:t,side:n=`right`,showCloseButton:r=!0,overlayClassName:i,...a}){return(0,$.jsxs)(RC,{children:[(0,$.jsx)(zC,{className:i}),(0,$.jsxs)(ti,{"data-slot":`sheet-content`,className:U(`fixed z-50 flex flex-col gap-4 bg-background shadow-modal transition ease-in-out data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:animate-in data-[state=open]:duration-500`,n===`right`&&`inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm`,n===`left`&&`inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm`,n===`top`&&`inset-x-0 top-0 h-auto border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top`,n===`bottom`&&`inset-x-0 bottom-0 h-auto border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom`,e),...a,children:[t,r&&(0,$.jsxs)(Vi,{className:`absolute top-4 right-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-secondary`,children:[(0,$.jsx)(d,{className:`size-4`}),(0,$.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function VC({className:e,...t}){return(0,$.jsx)(`div`,{"data-slot":`sheet-header`,className:U(`flex flex-col gap-1.5 p-4`,e),...t})}function HC({className:e,...t}){return(0,$.jsx)(li,{"data-slot":`sheet-title`,className:U(`font-semibold text-foreground`,e),...t})}function UC({className:e,...t}){return(0,$.jsx)(ai,{"data-slot":`sheet-description`,className:U(`text-sm text-muted-foreground`,e),...t})}function WC(e,t){if(!e?.signals)return null;let n=e.signals;return J_(e.projects.filter(e=>e.id!==t).map(e=>n.get(e.id)))}function GC(e){let t=q_(e??void 0).map(e=>e.text);return t.length>0?`Open projects. Elsewhere: ${t.join(`, `)}`:`Open projects`}function KC({elsewhere:e}){if(!e)return null;let{top:t,bottom:n}=PC(e),r=`right-[2px] border-card`;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(NC,{position:`top`,segments:t,compact:!0,className:U(r,`top-[3px]`)}),(0,$.jsx)(NC,{position:`bottom`,segments:n,compact:!0,className:U(r,`top-[24px]`)})]})}function qC({version:e}){let{resolvedTheme:t}=zg();return(0,$.jsxs)(`div`,{"data-slot":`drawer-identity`,className:`flex shrink-0 items-center gap-[12px] border-b border-border pt-[env(safe-area-inset-top)] pr-[14px] pb-[14px] pl-[18px]`,children:[(0,$.jsx)(`img`,{src:`/cezarion-mark-${t}.svg`,alt:``,"aria-hidden":`true`,className:`mt-[14px] size-[32px] rounded-lg`}),(0,$.jsx)(`span`,{className:`mt-[14px] text-[18px] leading-none font-bold tracking-[-0.02em] text-foreground`,children:`Cezarion`}),e?(0,$.jsxs)(`span`,{"data-slot":`drawer-version`,title:`v${e}`,className:`mt-[14px] min-w-0 truncate text-[11px] leading-none text-soft-foreground`,children:[`v`,e]}):null,(0,$.jsx)(LC,{asChild:!0,children:(0,$.jsx)(B,{variant:`ghost`,size:`icon`,"aria-label":`Close menu`,className:`mt-[14px] ml-auto size-[44px] text-foreground`,children:(0,$.jsx)(d,{className:`size-[19px]`,"aria-hidden":`true`})})})]})}function JC({version:e,latestVersion:t,...n}){let r=n.state?.status===`ready`||n.state?.status===`preparing`||n.state?.status===`restarting`;if(!(e&&t&&EC(t,e))&&!r)return null;let i=n.state?.status,a=i===`preparing`?`Preparing update…`:i===`ready`||i===`restarting`?`Restart to finish updating`:`Update available · v${t}`;return(0,$.jsxs)(`div`,{"data-slot":`drawer-update`,className:`shrink-0 border-b border-border px-[18px] py-[6px]`,children:[(0,$.jsxs)(`div`,{className:`flex min-h-[44px] items-center gap-[8px]`,children:[(0,$.jsx)(aa,{tone:`pending`,className:`size-[6px] shrink-0`}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] font-medium text-foreground`,children:a}),(0,$.jsx)(DC,{version:e,latestVersion:t,...n})]}),(0,$.jsx)(OC,{version:e,latestVersion:t,state:n.state,error:n.error,offline:n.offline,busy:n.busy})]})}function YC({project:e,signal:t,known:n,current:r,onNavigate:i}){let{top:a,bottom:s}=PC(t),c=r?`border-sidebar-row-selected`:`border-sidebar`,l=`right-[-4px]`,u=(0,$.jsxs)(o,{to:wo(e.id,`/`),onClick:i,"data-slot":`drawer-project`,"data-project-id":e.id,"aria-current":r?`page`:void 0,className:U(`flex h-[64px] min-w-0 items-center gap-[12px] rounded-[10px] px-[10px] text-foreground hover:bg-sidebar-row-hover focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,r&&`flex-1 hover:bg-sidebar-row-selected`),children:[(0,$.jsxs)(`span`,{"aria-hidden":`true`,className:U(`relative flex size-[40px] shrink-0 items-center justify-center rounded-[10px] border text-[13px] leading-none font-semibold`,r?`border-soft-foreground bg-sidebar text-foreground`:`border-transparent bg-muted text-muted-foreground`),children:[Y_(e.name),(0,$.jsx)(NC,{position:`top`,segments:a,className:U(l,c)}),(0,$.jsx)(NC,{position:`bottom`,segments:s,className:U(l,c,`top-[29px]`)})]}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,$.jsx)(`span`,{className:`truncate text-[14.5px] leading-tight font-semibold`,children:e.name}),(0,$.jsx)(AC,{signal:t,known:n,current:r,slot:`drawer-project-state`,className:`flex-wrap gap-x-[6px] text-[11.5px] leading-tight`})]}),r?(0,$.jsx)(ue,{"aria-hidden":`true`,className:`size-[16px] shrink-0 text-foreground`}):null]});return r?(0,$.jsxs)(`div`,{"data-slot":`drawer-project-current`,className:`flex items-center rounded-[10px] bg-sidebar-row-selected pr-[4px]`,children:[u,(0,$.jsx)(ev,{projectId:e.id,onNavigate:i,triggerClassName:`size-[44px]`,align:`end`})]}):u}var XC=`flex h-[48px] w-full items-center gap-[12px] rounded-[10px] px-[10px] text-[14.5px] font-normal text-foreground hover:bg-sidebar-row-hover focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring [&_svg]:size-[18px] [&_svg]:shrink-0 [&_svg]:text-soft-foreground`;function ZC({nav:e,currentProjectId:t,onNavigate:n}){return(0,$.jsxs)(`div`,{"data-slot":`drawer-projects`,className:`shrink-0`,children:[(0,$.jsx)(`div`,{className:`px-[18px] pt-[14px] pb-[6px] text-[12px] font-medium text-soft-foreground`,id:`drawer-projects-label`,children:`Projects`}),(0,$.jsx)(`div`,{role:`group`,"data-slot":`drawer-projects-group`,"aria-labelledby":`drawer-projects-label`,className:`flex flex-col gap-[2px] px-[8px] pb-[8px]`,children:e.projects.map(r=>(0,$.jsx)(YC,{project:r,signal:e.signals?.get(r.id),known:e.signals!==null,current:r.id===t,onNavigate:n},r.id))}),e.singleProject?null:(0,$.jsxs)(`div`,{"data-slot":`drawer-workspace`,className:`flex flex-col gap-[2px] border-t border-border px-[8px] py-[8px]`,children:[(0,$.jsxs)(o,{to:`/tasks`,onClick:n,"data-slot":`drawer-all-projects`,className:XC,children:[(0,$.jsx)(at,{"aria-hidden":`true`}),`All projects · task overview`]}),(0,$.jsx)(TC,{origin:`mobile`,icon:ve,iconClassName:`size-[18px]`,label:`Add project`,triggerClassName:U(XC,`h-[48px] justify-start p-0 px-[10px] text-foreground`)})]})]})}function QC({onNavigate:e,tools:t}){let{theme:n,setTheme:r}=zg(),i=lC[n],a=n.charAt(0).toUpperCase()+n.slice(1);return(0,$.jsxs)(`div`,{"data-slot":`drawer-global`,className:`flex shrink-0 flex-col gap-[2px] border-t border-border px-[8px] pt-[8px] pb-[max(8px,env(safe-area-inset-bottom))]`,children:[t?(0,$.jsxs)(o,{to:`/tools`,onClick:e,"data-slot":`drawer-tools`,"aria-label":t.blocked?`Tools, needs setup`:void 0,"aria-describedby":t.blocked&&t.note?`drawer-tools-note`:void 0,className:U(XC,t.note&&`h-auto min-h-[48px] py-[6px]`),children:[(0,$.jsxs)(`span`,{className:`relative flex shrink-0`,children:[(0,$.jsx)(vn,{"aria-hidden":`true`}),t.blocked?(0,$.jsx)(aa,{tone:`pending`,"data-slot":`drawer-tools-dot`,className:`absolute -top-[2px] -right-[3px] ring-[1.5px] ring-sidebar`}):null]}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,$.jsx)(`span`,{children:`Tools`}),t.note?(0,$.jsx)(`span`,{id:`drawer-tools-note`,"data-slot":`drawer-tools-note`,className:`text-[11.5px] leading-tight text-soft-foreground`,children:t.note}):null]})]}):null,(0,$.jsxs)(o,{to:`/settings/global/appearance`,onClick:e,"data-slot":`drawer-global-settings`,className:XC,children:[(0,$.jsx)(ln,{"aria-hidden":`true`}),`Global settings`]}),(0,$.jsxs)(`button`,{type:`button`,"data-slot":`theme-toggle`,"data-theme-pref":n,"aria-label":`Theme: ${n.toLowerCase()}. Switch to ${i}.`,onClick:()=>r(i),className:XC,children:[(0,$.jsx)(Tt,{"aria-hidden":`true`}),`Theme · `,a]})]})}var $C=Q.createContext(null);function ew(){return Q.useContext($C)}function tw({slot:e,children:t}){return(0,Ql.createPortal)(t,e)}var nw=`(min-width: 768px)`;function rw(){let[e,t]=Q.useState(()=>window.matchMedia?.(nw).matches??!0);return Q.useEffect(()=>{let e=window.matchMedia?.(nw);if(!e)return;let n=()=>t(e.matches);return n(),e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}var iw=5;function aw({items:e,activeTo:t,needsYou:n=!1,inboxCount:r,skillsUpdateAvailable:i,onNavigate:a}){let[o,s]=(0,Q.useState)(!1),c=(0,Q.useRef)(null),l=e.filter(e=>e.to===`/inbox`||e.to===`/automations`),u=l.length>0&&e.length-l.length>iw?e.filter(e=>e.to===`/workflows`||l.includes(e)):l,d=e.filter(e=>!u.includes(e)),f=u.some(e=>e.to===t);return(0,$.jsx)(ky,{children:(0,$.jsxs)(`nav`,{ref:c,"aria-label":`Main`,"data-slot":`view-tabs`,onKeyDown:e=>{if(![`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key))return;let t=Array.from(c.current?.querySelectorAll(`[data-view-tab]`)??[]),n=t.indexOf(document.activeElement);n<0||(e.preventDefault(),t[e.key===`Home`?0:e.key===`End`?t.length-1:(n+(e.key===`ArrowRight`?1:-1)+t.length)%t.length]?.focus())},className:`flex shrink-0 items-center justify-between max-md:justify-start max-md:gap-1 max-md:overflow-x-auto border-b border-border px-3 pt-2.5 pb-2`,children:[d.map(e=>{let r=e.to===t,o=e.icon,s=e.to===`/`&&n&&!r?`bg-pending-strong`:e.to===`/skills`&&i?`bg-info`:null;return(0,$.jsxs)(Ay,{children:[(0,$.jsx)(jy,{asChild:!0,children:(0,$.jsxs)(Z,{to:e.to,onClick:a,"data-view-tab":!0,"aria-label":e.label,"aria-current":r?`page`:void 0,className:U(`relative flex h-[30px] min-w-0 items-center justify-center rounded-[7px] text-soft-foreground hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring max-md:min-h-11 max-md:min-w-11`,r?`shrink-0 gap-1.5 bg-sidebar-row-selected px-[9px] text-[12px] font-semibold text-foreground`:`w-7 shrink-0`),children:[(0,$.jsxs)(`span`,{className:`relative`,children:[(0,$.jsx)(o,{className:`size-[15px] shrink-0`,"aria-hidden":`true`}),s?(0,$.jsx)(`span`,{"aria-label":e.to===`/`?`Tasks need you`:`Skills update available`,"data-slot":e.to===`/`?`nav-needs-you-dot`:`nav-update-marker`,className:U(`absolute -top-1 -right-1 size-[7px] rounded-full border-[1.5px] border-sidebar`,s)}):null]}),r?(0,$.jsx)(`span`,{className:`truncate`,children:e.label}):null]})}),(0,$.jsx)(My,{side:`bottom`,sideOffset:6,style:{pointerEvents:`none`},children:e.label})]},e.to)}),u.length?(0,$.jsxs)(Yo,{open:o,onOpenChange:s,children:[(0,$.jsxs)(Ay,{children:[(0,$.jsx)(jy,{asChild:!0,children:(0,$.jsx)(Ko,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,"data-view-tab":!0,"aria-label":`More views`,"data-active":f?`true`:void 0,className:U(`relative flex h-[30px] w-7 shrink-0 items-center justify-center rounded-[7px] text-soft-foreground hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring max-md:min-h-11 max-md:min-w-11`,(o||f)&&`bg-sidebar-row-selected text-foreground`),children:[(0,$.jsx)(Pc,{className:`size-[15px]`,"aria-hidden":`true`}),r&&u.some(e=>e.to===`/inbox`)?(0,$.jsx)(`span`,{"data-slot":`overflow-inbox-dot`,className:`absolute top-1 right-0.5 size-[7px] rounded-full border-[1.5px] border-sidebar bg-pending-strong`}):null]})})}),(0,$.jsx)(My,{side:`bottom`,sideOffset:6,style:{pointerEvents:`none`},children:`More views`})]}),(0,$.jsx)(qo,{align:`end`,sideOffset:4,className:`w-48 rounded-[10px] border-border bg-sidebar p-[5px] shadow-[0_10px_28px_#00000047]`,children:u.map(e=>{let n=e.icon,i=e.to===t;return(0,$.jsx)(Ho,{asChild:!0,className:U(`h-8 max-md:min-h-11 gap-2.5 rounded-md px-[9px] text-[13px] text-foreground focus:bg-sidebar-row-hover`,i&&`bg-sidebar-row-selected font-medium`),children:(0,$.jsxs)(Z,{to:e.to,onClick:a,"aria-current":i?`page`:void 0,children:[(0,$.jsx)(n,{className:`size-[15px] text-soft-foreground`}),e.label,e.to===`/inbox`&&r?(0,$.jsx)(`span`,{"data-slot":`inbox-count`,className:`ml-auto rounded-full bg-inbox-count px-1.5 text-[11px] font-semibold text-inbox-count-foreground`,children:r}):null]})},e.to)})})]}):null]})})}var ow=[{to:`/skills`,label:`Skills`},{to:`/workflows`,label:`Workflows`},{to:`/settings`,label:`Project settings`}],sw=[`/inbox`,`/automations`],cw=`flex h-[50px] min-h-11 w-full items-center gap-[14px] rounded-[10px] px-[10px] text-[14.5px] text-foreground hover:bg-sidebar-row-hover focus-visible:outline-2 focus-visible:outline-ring [&_svg]:size-[18px] [&_svg]:shrink-0 [&_svg]:text-muted-foreground`;function lw({open:e,onOpenChange:t,onCloseAutoFocus:n,projectName:r,items:i,activeTo:a,inboxCount:o=null,skillsUpdateAvailable:s=!1}){let c=new Map(i.map(e=>[e.to,e])),l=ow.flatMap(({to:e,label:t})=>{let n=c.get(e);return n?[{to:e,label:t,icon:n.icon}]:[]}),u=sw.flatMap(e=>{let t=c.get(e);return t?[{to:e,label:t.label,icon:t.icon}]:[]}),d=()=>t(!1),f=({to:e,label:t,icon:n})=>{let r=e===a;return(0,$.jsxs)(Z,{to:e,onClick:d,"data-slot":`more-row`,"data-more-row":e,"aria-current":r?`page`:void 0,className:U(cw,r&&`bg-sidebar-row-selected hover:bg-sidebar-row-selected`),children:[(0,$.jsx)(n,{"aria-hidden":`true`}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t}),e===`/skills`&&s?(0,$.jsx)(`span`,{"data-slot":`skills-update`,className:`shrink-0 rounded-full bg-muted px-[10px] py-[3px] text-[12.5px] font-medium text-foreground`,children:`1 update`}):null,e===`/inbox`&&o?(0,$.jsx)(`span`,{"data-slot":`inbox-count`,className:`shrink-0 rounded-full bg-inbox-count px-[10px] py-[3px] text-[12.5px] font-semibold text-inbox-count-foreground`,children:o}):null,(0,$.jsx)(S,{"aria-hidden":`true`,className:`!size-[15px]`})]},e)};return(0,$.jsx)(FC,{open:e,onOpenChange:t,children:(0,$.jsxs)(BC,{side:`bottom`,"data-slot":`more-sheet`,showCloseButton:!1,onCloseAutoFocus:n,"aria-describedby":void 0,className:`gap-0 rounded-t-[20px] border-border bg-sidebar px-[14px] pt-[10px] pb-[max(14px,env(safe-area-inset-bottom))] md:hidden`,children:[(0,$.jsx)(`div`,{"aria-hidden":`true`,className:`mx-auto mb-[14px] h-[5px] w-[36px] rounded-[3px] bg-border`}),(0,$.jsxs)(`div`,{className:`flex items-baseline gap-[10px] px-[10px] pb-[6px]`,children:[(0,$.jsx)(HC,{className:`text-[17px] leading-tight font-bold`,children:`More`}),r?(0,$.jsx)(`span`,{"data-slot":`more-project`,className:`min-w-0 truncate text-[12.5px] text-soft-foreground`,children:r}):null]}),(0,$.jsx)(`div`,{className:`flex flex-col gap-[2px]`,children:l.map(f)}),u.length>0?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{role:`separator`,className:`mx-[10px] mt-[8px] border-t border-border`}),(0,$.jsx)(`div`,{className:`px-[10px] pt-[12px] pb-[4px] text-[12px] font-medium text-soft-foreground`,children:`Shown when their flag is on`}),(0,$.jsx)(`div`,{className:`flex flex-col gap-[2px]`,children:u.map(f)})]}):null]})})}var uw=`(min-width: 768px)`;function dw({items:e,activeTo:t,signal:n,projectName:r,inboxCount:i,skillsUpdateAvailable:a,showNewTask:o=!0}){let[s,c]=Q.useState(!1),u=Q.useRef(null),{pathname:d}=l();Q.useEffect(()=>{c(!1)},[d]),Q.useEffect(()=>{let e=window.matchMedia?.(uw);if(!e)return;e.matches&&c(!1);let t=e=>{e.matches&&c(!1)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let f=e.filter(e=>sC.includes(e.to)),p=t!==null&&cC.includes(t),{top:m}=PC(n),h=m.some(e=>e.count>0),g=e=>U(`relative flex h-full min-h-11 min-w-11 flex-1 flex-col items-center justify-center gap-[3px] text-[10.5px] leading-none focus-visible:outline-2 focus-visible:outline-ring`,e?`font-semibold text-foreground`:`font-medium text-soft-foreground`);return(0,$.jsxs)($.Fragment,{children:[o?(0,$.jsxs)(Z,{to:`/new`,"data-slot":`mobile-new-task`,className:`absolute right-4 bottom-full z-30 mb-4 flex h-12 items-center gap-2 rounded-[24px] bg-foreground px-[18px] text-[14px] font-semibold text-background shadow-[0_8px_24px_#00000055] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,children:[(0,$.jsx)(pn,{"aria-hidden":`true`,className:`size-[18px]`}),`New task`]}):null,(0,$.jsxs)(`nav`,{"aria-label":`Views`,"data-slot":`mobile-tab-bar`,className:`flex h-[54px] items-stretch`,children:[f.map(e=>{let n=e.to===t,r=e.icon,i=e.to===`/`&&h;return(0,$.jsxs)(Z,{to:e.to,"data-tab":e.to,"aria-current":n?`page`:void 0,className:g(n),children:[(0,$.jsxs)(`span`,{className:`relative`,children:[(0,$.jsx)(r,{"aria-hidden":`true`,className:`size-[21px]`}),i?(0,$.jsx)(NC,{position:`top`,segments:m,className:`-top-[6px] -right-[10px] border-sidebar`}):null]}),e.label]},e.to)}),(0,$.jsxs)(`button`,{ref:u,type:`button`,"data-tab":`more`,"aria-haspopup":`dialog`,"aria-expanded":s,"data-active":p?`true`:void 0,onClick:()=>c(!0),className:g(p),children:[(0,$.jsx)(`span`,{className:`relative`,children:(0,$.jsx)(re,{"aria-hidden":`true`,className:`size-[21px]`})}),`More`]})]}),(0,$.jsx)(lw,{open:s,onOpenChange:c,onCloseAutoFocus:e=>{u.current?.isConnected&&(e.preventDefault(),u.current.focus())},projectName:r,items:e,activeTo:t,inboxCount:i,skillsUpdateAvailable:a})]})}var fw=`cez-sidebar-width`;function pw(e){let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?Math.min(420,Math.max(264,Math.round(t))):264}function mw(){try{let e=localStorage.getItem(fw);return e===null?264:pw(e)}catch{return 264}}function hw(e){try{localStorage.setItem(fw,String(pw(e)))}catch{}}var gw=`(min-width: 768px)`,_w=Q.createContext(264),vw=Q.createContext(void 0);function yw(){return Q.useContext(vw)}function bw(e){return ae({path:`/tasks/:id`,end:!0},_o(e))!==null}function xw(e){let t=_o(e);return t===`/github`||t.startsWith(`/github/`)}function Sw({children:e,breadcrumb:t,repo:n=null,inboxCount:r=null,skillsUpdateAvailable:i=!1,version:a=null,latestVersion:o=null,applicationUpdate:s,onApplyUpdate:c,onRestart:u,applicationUpdateError:d,applicationUpdateBusy:f,applicationUpdateOffline:p,sidebarList:m,taskQuickList:h,sessionScope:g,toolsMenu:_,forgeAvailable:v=!0,inboxAvailable:y=!0,automationsAvailable:b=!0,banner:S,mobileProjects:C,projectHeader:w,sidebarProjectId:T,needsYou:E,projectRail:D,toolsStatus:O}){let{pathname:k,search:A}=l(),j=_o(k),ee=j===`/new`?`/new`:rC(j),te=iC(j),M=Co(k),ne=Ca(),re=!aC(k)&&!oC(k,A)&&!ne,N=M===null?void 0:C?.signals?.get(M),[ie,P]=Q.useState(!1),ae=aC(k),[oe,se]=Q.useState(null),ce=Q.useRef(null),le=Q.useRef(null),ue=Q.useRef(null),de=bw(k),fe=j===`/git`&&new URLSearchParams(A).get(`view`)===`repo`,[pe,me]=Q.useState(mw),he=Q.useCallback(e=>{let t=pw(e);me(t),hw(t)},[]);Q.useLayoutEffect(()=>{let e=ue.current;if(ue.current=k,de||e!==null&&Co(e)===Co(k)&&xw(e)&&xw(k))return;let t=le.current;t&&(t.scrollTop=0)},[k,de,fe]),Q.useEffect(()=>{P(!1)},[k]),Q.useEffect(()=>{let e=window.matchMedia?.(gw);if(!e)return;e.matches&&P(!1);let t=e=>{e.matches&&P(!1)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let F={activeTo:ee,items:tC({forge:v,inbox:y,automations:b}),repo:n,inboxCount:y?r:null,skillsUpdateAvailable:i,version:a,latestVersion:o,applicationUpdate:s,onApplyUpdate:c,onRestart:u,applicationUpdateError:d,applicationUpdateBusy:f,applicationUpdateOffline:p,sidebarList:m,taskQuickList:h,sessionScope:g,toolsMenu:_,projectHeader:w,sidebarProjectId:T,needsYou:E};return(0,$.jsx)(FC,{open:ie,onOpenChange:P,children:(0,$.jsxs)(`div`,{"data-slot":`app-shell`,className:`flex h-dvh overflow-hidden bg-background text-foreground pl-[env(safe-area-inset-left)] pr-[env(safe-area-inset-right)]`,children:[(0,$.jsx)(_w.Provider,{value:pe,children:D}),(0,$.jsx)(Cw,{...F,width:pe,onWidthChange:he}),(0,$.jsx)(Tw,{...F,mobileProjects:C,currentProjectId:M,toolsStatus:O,onNavigate:()=>P(!1),onCloseAutoFocus:e=>{ce.current?.isConnected&&(e.preventDefault(),ce.current.focus())}}),(0,$.jsxs)(`div`,{className:`grid min-w-0 flex-1 grid-rows-[auto_auto_1fr_auto] overflow-hidden`,children:[(0,$.jsx)(Aw,{title:te?.label??`cezar`,pushed:ae?{compare:j.startsWith(`/compare/`),onSlot:se}:null,repo:n,elsewhere:WC(C,M),onTrigger:e=>{ce.current=e}}),(0,$.jsxs)(`header`,{"data-slot":`desktop-breadcrumb`,className:U(`row-start-1 hidden min-w-0 items-center gap-3 border-b border-border text-[13px] text-muted-foreground md:flex`,j===`/new`?`h-[72px] px-11`:`h-16 px-9`),children:[(0,$.jsx)(Re,{"aria-hidden":`true`,className:`size-4 shrink-0`}),t?.project??n?.name?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`truncate font-medium text-foreground`,children:t?.project??n?.name}),(0,$.jsx)(`span`,{"aria-hidden":`true`,children:`/`})]}):null,(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:t?.page??te?.label??`Cezarion`}),t?.branch??n?.branch?(0,$.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2 text-[11px]`,children:[(0,$.jsx)(x,{"aria-hidden":`true`,className:`size-4 text-accent-text`}),t?.branch??n?.branch]}):null]}),S?(0,$.jsx)(`div`,{"data-slot":`banner-slot`,className:`row-start-2`,children:S}):null,(0,$.jsx)(`main`,{ref:le,"data-slot":`main`,className:U(`row-start-3 min-h-0 overflow-y-auto overscroll-contain`,re&&j!==`/new`&&`max-md:pb-20`),children:(0,$.jsx)($C.Provider,{value:ae?oe:null,children:e})}),(0,$.jsx)(`div`,{"data-slot":`composer`,className:U(`row-start-4 pb-[max(env(safe-area-inset-bottom),var(--kb,0px))]`,re&&`relative max-md:border-t max-md:border-border max-md:bg-sidebar`),children:re?(0,$.jsx)(`div`,{className:`md:hidden`,children:(0,$.jsx)(dw,{items:F.items,activeTo:ee,signal:N,projectName:C?.projects.find(e=>e.id===M)?.name??n?.name??null,inboxCount:F.inboxCount,skillsUpdateAvailable:i,showNewTask:j!==`/new`})}):null})]})]})})}function Cw({width:e,onWidthChange:t,...n}){return(0,$.jsxs)(`aside`,{"data-slot":`sidebar`,style:{width:e},className:`relative hidden shrink-0 flex-col border-r border-border bg-sidebar md:flex`,children:[(0,$.jsx)(Dw,{...n}),(0,$.jsx)(ww,{width:e,onWidthChange:t})]})}function ww({width:e,onWidthChange:t}){let n=Q.useRef(null),r=t=>{t.button===0&&(n.current={x:t.clientX,width:e},t.currentTarget.setPointerCapture(t.pointerId),t.preventDefault(),t.currentTarget.focus())},i=e=>{let r=n.current;r&&t(pw(r.width+(e.clientX-r.x)))},a=e=>{n.current&&(n.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))};return(0,$.jsx)(`div`,{"data-slot":`sidebar-resize-handle`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize the sidebar`,"aria-valuenow":e,"aria-valuemin":264,"aria-valuemax":420,tabIndex:0,onPointerDown:r,onPointerMove:i,onPointerUp:a,onPointerCancel:a,onKeyDown:n=>{let r=n.key===`ArrowLeft`?e-16:n.key===`ArrowRight`?e+16:n.key===`Home`?264:n.key===`End`?420:null;r!==null&&(n.preventDefault(),t(pw(r)))},onDoubleClick:()=>t(264),title:`Drag to resize the sidebar — double-click to reset`,className:`absolute inset-y-0 -right-[2px] z-20 w-[5px] cursor-col-resize touch-none bg-transparent transition-colors hover:bg-[var(--composer-border)] focus-visible:bg-[var(--composer-border)] focus-visible:outline-none`})}function Tw({onNavigate:e,onCloseAutoFocus:t,mobileProjects:n,currentProjectId:r,toolsStatus:i,version:a,latestVersion:o,applicationUpdate:s,onApplyUpdate:c,onRestart:l,applicationUpdateError:u,applicationUpdateBusy:d,applicationUpdateOffline:f,taskQuickList:p,sidebarProjectId:m}){return(0,$.jsxs)(BC,{side:`left`,"data-slot":`mobile-nav-drawer`,onCloseAutoFocus:t,overlayClassName:`bg-[var(--nav-scrim)]`,showCloseButton:!1,className:`w-[calc(100%-68px)] max-w-[334px] gap-0 border-border bg-sidebar p-0 sm:max-w-[334px] md:hidden`,"aria-describedby":void 0,children:[(0,$.jsx)(HC,{className:`sr-only`,children:`Navigation`}),(0,$.jsx)(qC,{version:a}),(0,$.jsx)(JC,{version:a,latestVersion:o,state:s,onApplyUpdate:c,onRestart:l,error:u,busy:d,offline:f}),(0,$.jsxs)(`div`,{"data-slot":`drawer-scroll`,className:`flex min-h-0 flex-1 flex-col overflow-y-auto overscroll-contain`,children:[n?(0,$.jsx)(ZC,{nav:n,currentProjectId:r,onNavigate:e}):null,p?(0,$.jsx)(Ew,{projectId:m,onNavigate:e,children:(0,$.jsx)(`div`,{"data-slot":`drawer-tasks`,className:`border-t border-border px-[8px] py-[8px]`,children:p})}):null]}),(0,$.jsx)(QC,{onNavigate:e,tools:i})]})}function Ew({projectId:e,onNavigate:t,children:n}){let r=Le(),i=e===void 0?r:{projectId:e,apiBase:`${Vn}/p/${encodeURIComponent(e)}`};return(0,$.jsx)(k.Provider,{value:i,children:(0,$.jsx)(vw.Provider,{value:t,children:n})})}function Dw({activeTo:e,items:t,repo:n,inboxCount:r,skillsUpdateAvailable:i,version:a,latestVersion:o,applicationUpdate:s,onApplyUpdate:c,onRestart:l,applicationUpdateError:u,applicationUpdateBusy:d,applicationUpdateOffline:f,sidebarList:p,taskQuickList:m,sessionScope:h,toolsMenu:g,projectHeader:_,sidebarProjectId:v,needsYou:y,onNavigate:b}){return(0,$.jsx)(Ew,{projectId:v,onNavigate:b,children:(0,$.jsxs)(`div`,{"data-slot":`sidebar-content`,className:`@container/sidebar flex min-h-0 flex-1 flex-col pt-[env(safe-area-inset-top)] pb-[env(safe-area-inset-bottom)]`,children:[(0,$.jsx)(`div`,{"data-slot":`sidebar-header`,className:`shrink-0`,children:_??(n?(0,$.jsxs)(`div`,{className:`px-[14px] pt-[14px] pb-2.5`,children:[(0,$.jsx)(`div`,{className:`truncate text-sm font-semibold`,children:n.name}),(0,$.jsx)(`div`,{className:`truncate font-mono text-[10.5px] text-soft-foreground`,children:n.branch})]}):null)}),(0,$.jsxs)(`div`,{"data-slot":`sidebar-actions`,className:`flex flex-col gap-2 px-3`,children:[(0,$.jsx)(Ow,{}),(0,$.jsx)(B,{asChild:!0,variant:`ghost`,className:U(`relative h-[32px] max-md:min-h-11 rounded-[7px] bg-muted w-full min-w-0 justify-start gap-2 px-2.5 text-[12.5px] font-medium text-foreground hover:bg-sidebar-row-hover hover:text-foreground`,e===`/new`&&`bg-sidebar-row-selected text-foreground font-medium hover:bg-sidebar-row-selected`),children:(0,$.jsxs)(Z,{to:`/new`,onClick:b,"data-sidebar-item":`new-task`,"aria-current":e===`/new`?`page`:void 0,children:[(0,$.jsx)(pn,{className:`size-[15px]`,"aria-hidden":`true`}),`New task`,(0,$.jsx)(`kbd`,{"aria-hidden":`true`,className:`sr-only`,children:`C`})]})})]}),h?(0,$.jsx)(`div`,{className:`shrink-0 px-3 pt-2`,children:h}):null,(0,$.jsx)(aw,{items:t,activeTo:e,needsYou:y,inboxCount:r,skillsUpdateAvailable:i,onNavigate:b}),(0,$.jsx)(`div`,{"data-slot":`project-task-navigation`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain p-3`,children:(0,$.jsx)(vw.Provider,{value:b,children:p??(0,$.jsx)(`div`,{"data-slot":`task-quick-list`,children:m})})}),(0,$.jsxs)(`div`,{"data-slot":`sidebar-footer`,className:`shrink-0`,children:[(0,$.jsxs)(`div`,{"data-slot":`sidebar-footer-controls`,className:`flex h-11 items-center justify-between gap-1 border-t border-border px-3`,children:[(0,$.jsx)(`div`,{"data-slot":`tools-menu`,className:`shrink-0`,children:g}),(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,"data-slot":`version-action`,children:[a?(0,$.jsx)(kw,{version:a,latestVersion:o}):null,(0,$.jsx)(DC,{version:a,latestVersion:o,state:s,onApplyUpdate:c,onRestart:l,error:u,busy:d,offline:f})]})]}),(0,$.jsx)(OC,{version:a,latestVersion:o,state:s,error:u,offline:f,busy:d})]})]})})}function Ow(){return(0,$.jsxs)(`button`,{type:`button`,"data-slot":`command-palette-hint`,title:`Search — command palette (⌘K / Ctrl+K)`,onClick:()=>pC(),className:`flex h-[32px] max-md:min-h-11 w-full items-center gap-2 rounded-[7px] border border-border bg-background px-2.5 text-left text-[12.5px] font-normal text-soft-foreground transition-colors hover:border-border hover:text-foreground`,children:[(0,$.jsx)(m,{className:`size-[14px] shrink-0`,"aria-hidden":`true`}),(0,$.jsx)(`span`,{className:`truncate`,children:`Search…`}),(0,$.jsx)(`kbd`,{"aria-hidden":`true`,className:`ml-auto shrink-0 font-sans text-[11px] font-normal text-soft-foreground`,children:$f(`k`)})]})}function kw({version:e,latestVersion:t}){let n=!!(t&&EC(t,e));return(0,$.jsxs)(`span`,{"data-slot":`version-chip`,"data-update-available":n?`true`:void 0,title:n?`v${e} — update available: v${t}`:`v${e}`,className:`flex min-w-0 items-center gap-1 font-mono text-[11px] text-soft-foreground`,children:[n?(0,$.jsx)(aa,{tone:`pending`,className:`size-[5px] shrink-0`}):null,(0,$.jsxs)(`span`,{className:`truncate`,children:[`v`,e]})]})}function Aw({title:e,pushed:t,repo:n,elsewhere:r,onTrigger:i}){return t?(0,$.jsx)(jw,{compare:t.compare,onSlot:t.onSlot}):(0,$.jsx)(`header`,{"data-slot":`mobile-top-bar`,className:`row-start-1 min-w-0 border-b border-border bg-card pt-[env(safe-area-inset-top)] md:hidden`,children:(0,$.jsxs)(`div`,{className:`flex h-[56px] min-w-0 items-center gap-[8px] px-[8px]`,children:[(0,$.jsx)(IC,{asChild:!0,children:(0,$.jsxs)(B,{variant:`ghost`,"aria-label":GC(r),onClick:e=>i(e.currentTarget),className:`relative h-[44px] w-[64px] shrink-0 justify-start rounded-md p-0 pl-[10px] text-foreground`,children:[(0,$.jsx)(Gt,{className:`size-[20px]`,"aria-hidden":`true`}),(0,$.jsx)(KC,{elsewhere:r})]})}),n?(0,$.jsx)(IC,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,"data-slot":`mobile-project-picker`,"aria-label":`Switch project: ${n.name}`,onClick:e=>i(e.currentTarget),className:`flex h-[44px] min-w-0 flex-1 items-center justify-start gap-[10px] rounded-md text-left focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`flex size-[28px] shrink-0 items-center justify-center rounded-[8px] border border-soft-foreground bg-sidebar-row-selected text-[11px] leading-none font-semibold text-foreground`,children:Y_(n.name)}),(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,$.jsx)(`span`,{className:`truncate text-[15px] leading-tight font-semibold text-foreground`,children:n.name}),n.branch?(0,$.jsx)(`span`,{className:`truncate font-mono text-[10.5px] leading-tight text-soft-foreground`,children:n.branch}):null]}),(0,$.jsx)(ge,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-soft-foreground`})]})}):null,e===`cezar`?n?null:(0,$.jsx)(`span`,{className:`flex-1`}):(0,$.jsx)(`span`,{"data-slot":`mobile-route-title`,className:U(`truncate text-[15px] font-semibold text-foreground`,n?`sr-only`:`min-w-0 flex-1 pl-[8px]`),children:e}),(0,$.jsx)(B,{variant:`ghost`,"aria-label":`Search`,"data-slot":`mobile-search`,onClick:()=>pC(),className:`ml-auto size-[44px] shrink-0 p-0 text-foreground`,children:(0,$.jsx)(m,{className:`size-[19px]`,"aria-hidden":`true`})})]})})}function jw({compare:e,onSlot:t}){let n=Eo();return(0,$.jsx)(`header`,{"data-slot":`mobile-top-bar`,"data-mode":`task`,className:`row-start-1 min-w-0 border-b border-border bg-card pt-[env(safe-area-inset-top)] md:hidden`,children:(0,$.jsxs)(`div`,{className:`flex h-[56px] min-w-0 items-center gap-[4px] px-[8px]`,children:[(0,$.jsx)(B,{variant:`ghost`,"aria-label":`Back`,"data-slot":`mobile-back`,onClick:()=>{let e=window.history.state?.idx;n(typeof e==`number`&&e>0?-1:`/`)},className:`size-[44px] shrink-0 p-0 text-foreground`,children:(0,$.jsx)(bc,{className:`size-[22px]`,"aria-hidden":`true`})}),e?(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[15px] font-semibold text-foreground`,children:`Compare variants`}):null,(0,$.jsx)(`div`,{"data-slot":`mobile-run-bar`,ref:t,className:U(`flex min-w-0 items-center gap-[4px]`,e?`shrink-0`:`flex-1`)})]})})}var Mw=`cez:application-restart-from`,Nw=24e4,Pw=3e4,Fw=`The response was lost; update status is unknown. Reconnect or check the current state before retrying.`;function Iw(e,t){let n=t?.applicationUpdate;return!!(n&&(n.status===`error`||e.kind===`apply`&&n.status===`ready`||e.kind===`restart`&&(n.status===`restarting`||n.status===`idle`&&e.initialVersion&&t.version!==e.initialVersion)))}function Lw(e,t=()=>window.location.reload()){let n=V(),r=Q.useRef(null),i=Q.useRef(e);i.current=e;let[a,o]=Q.useState(!1),[s,c]=Q.useState(null),[l,u]=Q.useState(()=>!navigator.onLine),d=Q.useRef(e?.version??null),f=Q.useRef(!1),[p,m]=Q.useState(()=>{try{return window.sessionStorage.getItem(Mw)}catch{return null}});Q.useEffect(()=>{let e=()=>u(!navigator.onLine);return window.addEventListener(`online`,e),window.addEventListener(`offline`,e),()=>{window.removeEventListener(`online`,e),window.removeEventListener(`offline`,e)}},[]),Q.useEffect(()=>{(e?.applicationUpdate?.status===`ready`||e?.applicationUpdate?.status===`restarting`)&&c(null)},[e?.applicationUpdate?.status]),Q.useEffect(()=>{if(!e?.version)return;d.current||=e.version;let n=d.current!==e.version,r=!!(p&&e.version!==p);if(n||r||p&&e.applicationUpdate?.status===`error`){try{window.sessionStorage.removeItem(Mw)}catch{}m(null)}(n||r)&&!f.current&&(f.current=!0,t())},[e?.version,e?.applicationUpdate?.status,p,t]);let h=Q.useCallback(e=>{n.setQueryData(K.health,t=>t&&{...t,applicationUpdate:e})},[n]),g=Q.useCallback((e,t)=>{if(r.current===e){if(e.reconciledRestart&&(t.source===`timeout`||t.source===`failure`&&t.cause instanceof E&&t.cause.status===0)&&(t={source:`health`,state:e.reconciledRestart}),r.current=null,clearTimeout(e.timer),t.source!==`response`&&e.controller.abort(),o(!1),t.source===`response`&&t.state&&h(t.state),t.source===`timeout`?c(Fw):t.source===`failure`?c(t.cause instanceof Error?t.cause.message:`The request failed.`):c(null),t.source===`failure`&&e.kind===`restart`){try{window.sessionStorage.removeItem(Mw)}catch{}m(null)}(t.source===`timeout`||t.source===`failure`)&&n.invalidateQueries({queryKey:K.health}),e.resolve(t.state)}},[n,h]);Q.useEffect(()=>{let t=r.current,n=e?.applicationUpdate;if(t&&!(n===t.initialState&&e?.version===t.initialVersion||!Iw(t,e))){if(t.kind===`restart`&&n?.status===`restarting`){t.reconciledRestart=n,o(!1),c(null),t.resolve(n);return}g(t,{source:`health`,state:n})}},[e?.applicationUpdate,e?.version,g]),Q.useEffect(()=>()=>{let e=r.current;e&&(r.current=null,clearTimeout(e.timer),e.controller.abort(),e.resolve(void 0))},[]);let _=Q.useCallback((e,t)=>{if(r.current)return Promise.resolve(void 0);let a=new AbortController,s=i.current?.applicationUpdate,l=i.current?.version,u=n.getQueryData(K.health)?.applicationUpdate;return o(!0),c(null),new Promise(o=>{let c={controller:a,initialState:s,initialCacheState:u,initialVersion:l,kind:e,resolve:o,timer:setTimeout(()=>g(c,{source:`timeout`}),e===`apply`?Nw:Pw)};r.current=c,t(a.signal).then(e=>{if(r.current!==c)return;let t=n.getQueryData(K.health),a=i.current,o=t?.applicationUpdate!==u&&Iw(c,t)?t.applicationUpdate:a?.applicationUpdate!==s&&Iw(c,a)?a.applicationUpdate:void 0;g(c,o?{source:`health`,state:o}:{source:`response`,state:e.state})},e=>g(c,{source:`failure`,cause:e}))})},[g,n]);return{apply:Q.useCallback(async()=>{await _(`apply`,ie)},[_]),restart:Q.useCallback(async()=>{if(r.current)return;let e=i.current?.version,t=await _(`restart`,yt);if(e&&t?.status===`restarting`){try{window.sessionStorage.setItem(Mw,e)}catch{}m(e)}},[_]),busy:a,error:s,offline:l}}var Rw=Q.createContext(null);function zw({children:e}){let[t,n]=Q.useState(`active`),r=Q.useMemo(()=>[t,n],[t]);return(0,$.jsx)(Rw.Provider,{value:r,children:e})}function Bw(){let e=Q.useContext(Rw);if(!e)throw Error(`useListView must be used inside a <ListViewProvider>`);return e}var Vw=[`claude`,`codex`,`opencode`,`pi`,`cursor`,`omp`],Hw={claude:`Claude Code`,codex:`Codex`,opencode:`OpenCode`,pi:`pi`,cursor:`Cursor`,omp:`OMP`};function Uw(e){if(typeof e!=`object`||!e||Array.isArray(e))return{};let t=e,n={};for(let e of Vw){let r=t[e];typeof r==`string`&&r.length>0&&r.length<=128&&(n[e]=r)}return n}function Ww(e,t){if(!e)return[];let n=new Map(e.providers.map(e=>[e.provider,e]));return Vw.flatMap(e=>{let r=n.get(e);return r?.status!==`disconnected`||!r.authFailureId||t[e]===r.authFailureId?[]:[{provider:e,label:Hw[e],authFailureId:r.authFailureId}]})}function Gw(e,t){return{...e,...Object.fromEntries(t.map(({provider:e,authFailureId:t})=>[e,t]))}}function Kw({status:e,pending:t,error:n,dismissals:r,onDismissAuthFailures:i}){if(t||!e)return null;let a;try{a=b(e)}catch{return null}let o=Ww(a,r);if(o.length>0)return(0,$.jsxs)(`div`,{"data-slot":`provider-banner`,role:`alert`,className:`flex min-h-9 items-center gap-2 border-b border-border bg-destructive/10 px-4 text-sm text-foreground`,children:[(0,$.jsx)(aa,{tone:`danger`}),(0,$.jsxs)(`span`,{children:[`Provider authentication failed during a task:`,` `,o.map(({label:e})=>e).join(`, `),`.`]}),(0,$.jsx)(Z,{to:`/settings/agents#providers`,className:`ml-auto shrink-0 font-medium underline underline-offset-4 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:`Open agent settings`}),(0,$.jsx)(`button`,{type:`button`,"aria-label":`Dismiss provider authentication alert`,onClick:()=>i(o),className:`shrink-0 rounded-sm p-1 text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:(0,$.jsx)(fl,{className:`size-4`,"aria-hidden":`true`})})]});if(n||a.providers.some(e=>e.enabled&&e.status===`connected`))return null;let s=a.providers.some(e=>e.status===`connected`),c=a.providers.some(e=>e.status===`unknown`);return(0,$.jsxs)(`div`,{"data-slot":`provider-banner`,role:`status`,className:`flex min-h-9 items-center gap-2 border-b border-border bg-muted/50 px-4 text-sm text-muted-foreground`,children:[(0,$.jsx)(aa,{tone:c?`danger`:`pending`}),(0,$.jsx)(`span`,{children:s?`No agent provider is enabled.`:c?`No connected provider could be verified.`:`No agent provider credentials were found.`}),(0,$.jsx)(Z,{to:`/settings/agents#providers`,className:`ml-auto shrink-0 font-medium text-foreground underline underline-offset-4 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:`Configure providers`})]})}function qw(e){if(!(typeof e!=`object`||!e||Array.isArray(e)))return e}function Jw(){let e=Ai(),t=Tr(),n=V(),r=(0,Q.useRef)(Promise.resolve()),i=(0,Q.useRef)(0),a=(0,Q.useRef)(0),o=(0,Q.useRef)(qw(t.data));(0,Q.useEffect)(()=>{a.current===0&&(o.current=qw(t.data))},[t.data]);let s=(0,Q.useCallback)(e=>{let t=q.uiState,s=qw(n.getQueryData(t)),c=Gw(Uw(s?.dismissedProviderAuthFailures),e),l={...s,dismissedProviderAuthFailures:c};a.current+=1,n.setQueryData(t,l);let u=++i.current;r.current=r.current.then(async()=>{try{let e=await Ve({dismissedProviderAuthFailures:c});o.current=qw(e),u===i.current&&n.setQueryData(t,e)}catch(e){u===i.current&&(o.current===void 0?n.removeQueries({queryKey:t,exact:!0}):n.setQueryData(t,o.current),n.invalidateQueries({queryKey:t}),L(e instanceof Error?e.message:String(e),{tone:`danger`}))}finally{--a.current}})},[n]);return(0,$.jsx)(Kw,{status:e.data,pending:e.isPending,error:e.isError,dismissals:Uw(qw(t.data)?.dismissedProviderAuthFailures),onDismissAuthFailures:s})}var Yw=`cez-project-rail-expanded`;function Xw(e,t){return e-232-t>=640}function Zw(){try{return localStorage.getItem(Yw)===`1`}catch{return!1}}function Qw(e){try{localStorage.setItem(Yw,e?`1`:`0`)}catch{}}function $w({project:e,signal:t,known:n,current:r,target:i,onSwitchProject:a,onSelectProject:s}){let c=K_(e.name,t,{unknown:!n});return(0,$.jsxs)(`div`,{"data-slot":`rail-project`,"data-project-id":e.id,className:`relative flex h-[52px] w-full shrink-0 items-center justify-center`,children:[r?(0,$.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`rail-current-bar`,className:`absolute top-1/2 left-0 h-5 w-[3px] -translate-y-1/2 rounded-r-[2px] bg-foreground`}):null,(0,$.jsxs)(`div`,{className:`relative size-9`,children:[(0,$.jsx)(o,{to:i.href,onClick:t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||(s?.(e.id),i.verify&&a&&(t.preventDefault(),a(e.id)))},"aria-label":c,title:c,"aria-current":r?`page`:void 0,className:U(`flex size-full items-center justify-center rounded-[9px] border text-[12px] leading-none font-semibold focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,r?`border-soft-foreground bg-sidebar-row-selected text-foreground`:`border-transparent bg-muted text-muted-foreground hover:text-foreground`),children:Y_(e.name)}),(0,$.jsx)(NC,{position:`top`,segments:PC(t).top}),(0,$.jsx)(NC,{position:`bottom`,segments:PC(t).bottom})]})]})}var eT=`motion-safe:rail-text-in`;function tT({project:e,signal:t,known:n,current:r,target:i,onSwitchProject:a,onSelectProject:s}){let c=K_(e.name,t,{unknown:!n}),{top:l,bottom:u}=PC(t),d=r?`border-sidebar-row-selected`:`border-background group-hover:border-sidebar-row-hover`;return(0,$.jsx)(`div`,{"data-slot":`rail-project`,"data-project-id":e.id,className:`w-full shrink-0`,children:(0,$.jsxs)(o,{to:i.href,onClick:t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||(s?.(e.id),i.verify&&a&&(t.preventDefault(),a(e.id)))},"aria-label":c,"aria-current":r?`page`:void 0,className:U(`group flex h-[52px] w-full items-center gap-[10px] rounded-[8px] px-[6px] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,r?`bg-sidebar-row-selected`:`hover:bg-sidebar-row-hover`),children:[(0,$.jsxs)(`span`,{"aria-hidden":`true`,"data-slot":`rail-mark`,className:U(`relative flex size-9 shrink-0 items-center justify-center rounded-[9px] border text-[12px] leading-none font-semibold`,r?`border-soft-foreground bg-sidebar text-foreground`:`border-transparent bg-muted text-muted-foreground`),children:[Y_(e.name),(0,$.jsx)(NC,{position:`top`,segments:l,className:d}),(0,$.jsx)(NC,{position:`bottom`,segments:u,className:d})]}),(0,$.jsxs)(`span`,{className:U(`flex min-w-0 flex-1 flex-col gap-px`,eT),children:[(0,$.jsx)(`span`,{"data-slot":`rail-project-name`,className:U(`truncate text-[13.5px] leading-[18px] font-semibold`,r?`text-foreground`:`text-muted-foreground`),children:e.name}),(0,$.jsx)(AC,{signal:t,known:n,current:r,maxParts:2,slot:`rail-project-state`,className:`h-4 gap-x-[4px] overflow-hidden text-[11px] leading-4 whitespace-nowrap`})]})]})})}function nT(e){return U(`flex shrink-0 items-center rounded-[8px] text-soft-foreground hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,e?`size-auto h-9 w-full justify-start gap-3 px-2.5 text-[13px] font-normal`:`size-9 justify-center`)}var rT=U(`truncate text-muted-foreground group-hover:text-foreground`,eT);function iT({to:e,label:t,slot:n,active:r,expanded:i,children:a}){return(0,$.jsxs)(o,{to:e,"data-slot":n,"aria-label":t,title:i?void 0:t,"aria-current":r?`page`:void 0,className:U(`group`,nT(i),r&&`bg-sidebar-row-selected text-foreground hover:bg-sidebar-row-selected`),children:[a,i?(0,$.jsx)(`span`,{className:rT,children:t}):null]})}function aT(e){let[t,n]=Q.useState(()=>window.innerWidth);return Q.useEffect(()=>{let e=()=>n(window.innerWidth);return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),Xw(t,e)}var oT=e=>({href:String(wo(e,`/`)),verify:!1});function sT({projects:e,signals:t,version:n,singleProject:r,projectTarget:i=oT,onSwitchProject:a,onSelectProject:o}){let{pathname:s}=l(),{resolvedTheme:c}=zg(),u=Q.useContext(_w),[d,f]=Q.useState(Zw),p=aT(u),m=d&&p,h=()=>{let e=!m;f(e),Qw(e)},g=Co(s),_=s===`/tasks`,v=s===`/settings/global`||s.startsWith(`/settings/global/`),y=n?`Cezarion v${n}`:`Cezarion`,b=Q.useId();return(0,$.jsxs)(`nav`,{id:b,"aria-label":`Projects`,"data-slot":`project-rail`,"data-expanded":m?`true`:`false`,style:{width:m?232:60},className:U(`hidden shrink-0 flex-col overflow-hidden border-r border-border bg-background pt-3 pb-3.5 transition-[width] duration-[160ms] ease-out motion-reduce:transition-none md:flex`,m?`items-stretch px-2.5`:`items-center`),children:[m?(0,$.jsxs)(`div`,{"data-slot":`rail-identity`,className:`flex shrink-0 flex-col gap-0.5`,children:[(0,$.jsxs)(`div`,{className:`flex h-[34px] items-center gap-[10px] px-0.5`,children:[(0,$.jsx)(`img`,{src:`/cezarion-mark-${c}.svg`,alt:``,"aria-hidden":`true`,"data-slot":`rail-app-mark`,className:`size-[34px] shrink-0 rounded-[8px]`}),(0,$.jsxs)(`span`,{className:U(`flex min-w-0 items-baseline gap-[10px] whitespace-nowrap`,eT),"aria-label":y,children:[(0,$.jsx)(`span`,{className:`text-[15px] leading-none font-bold text-foreground`,children:`Cezarion`}),n?(0,$.jsxs)(`span`,{"data-slot":`rail-version`,title:`v${n}`,className:`min-w-0 truncate text-[11px] leading-none text-soft-foreground`,children:[`v`,n]}):null]})]}),(0,$.jsx)(`div`,{"aria-hidden":`true`,className:`h-px w-full bg-border`}),(0,$.jsx)(`div`,{className:U(`px-1 pt-2.5 pb-1 text-[11px] font-medium text-soft-foreground`,eT),children:`Projects`})]}):(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-col items-center gap-0.5`,children:[(0,$.jsx)(`img`,{src:`/cezarion-mark-${c}.svg`,alt:y,title:y,"data-slot":`rail-app-mark`,className:`size-[34px] rounded-[9px]`}),(0,$.jsx)(`div`,{"aria-hidden":`true`,className:`mt-0.5 mb-1.5 h-px w-6 bg-border`})]}),(0,$.jsxs)(`div`,{"data-slot":`rail-projects`,className:U(`flex min-h-0 w-full flex-1 flex-col gap-0.5 overflow-y-auto overscroll-contain [scrollbar-width:none]`,m?`items-stretch`:`items-center`),children:[e.map(e=>{let n={project:e,signal:t?.get(e.id),known:t!==null,current:e.id===g,target:i(e.id),onSwitchProject:a,onSelectProject:o};return m?(0,$.jsx)(tT,{...n},e.id):(0,$.jsx)($w,{...n},e.id)}),r?null:m?(0,$.jsx)(TC,{origin:`rail`,icon:pn,iconClassName:`size-[15px] text-soft-foreground`,iconFrameClassName:`flex size-9 shrink-0 items-center justify-center rounded-[9px] border border-border`,label:`Add project`,side:`right`,triggerClassName:U(`h-[44px] w-full shrink-0 justify-start gap-[10px] rounded-[8px] px-[6px] text-[13px] font-normal text-muted-foreground hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring motion-safe:[&>span:last-child]:rail-text-in`)}):(0,$.jsx)(TC,{origin:`rail`,icon:pn,iconClassName:`size-[15px]`,side:`right`,triggerClassName:`shrink-0 rounded-[9px] border border-border text-soft-foreground hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`})]}),(0,$.jsxs)(`div`,{"data-slot":`rail-bottom`,className:U(`flex shrink-0 flex-col gap-0.5 pt-2`,m?`items-stretch`:`items-center`),children:[p?(0,$.jsxs)(`button`,{type:`button`,"data-slot":`rail-expand-toggle`,"aria-expanded":m,"aria-controls":b,"aria-label":m?`Collapse projects`:`Expand projects`,title:m?void 0:`Expand projects`,onClick:h,className:U(`group`,nT(m)),children:[m?(0,$.jsx)(el,{className:`size-4 shrink-0`,"aria-hidden":`true`}):(0,$.jsx)(tl,{className:`size-4 shrink-0`,"aria-hidden":`true`}),m?(0,$.jsx)(`span`,{className:rT,children:`Collapse`}):null]}):null,r?null:(0,$.jsx)(iT,{to:`/tasks`,label:`All projects`,slot:`rail-all-projects`,active:_,expanded:m,children:(0,$.jsx)(at,{className:`size-4 shrink-0`,"aria-hidden":`true`})}),(0,$.jsx)(iT,{to:`/settings/global/appearance`,label:`Global settings`,slot:`rail-global-settings`,active:v,expanded:m,children:(0,$.jsx)(ln,{className:`size-4 shrink-0`,"aria-hidden":`true`})}),(0,$.jsx)(dC,{showLabel:m,labelClassName:rT,className:U(`group`,nT(m),`[&_svg]:size-4`)})]})]})}function cT(){let e=V(),t=oi().data?.projects,n=ra().data,r=W().data?.capabilities.singleProject===!0,i=Q.useMemo(()=>n?G_(n.runs):null,[n]),a=t?.map(e=>e.id).join(`
|
|
13
|
+
`),o=Q.useRef(void 0);return Q.useEffect(()=>{a!==void 0&&(o.current!==void 0&&o.current!==a&&e.invalidateQueries({queryKey:q.runsIndex}),o.current=a)},[e,a]),Q.useMemo(()=>t?{projects:t,signals:i,singleProject:r}:null,[t,i,r])}var lT=60;function uT(e){return`title`in e?`Archived "${e.title.length>lT?`${e.title.slice(0,lT-1)}…`:e.title}"`:`Archived ${e.count} ${e.count===1?`task`:`tasks`}`}async function dT(e,t,n){let r=new Set(n),i=(await Promise.allSettled(t.map(async t=>{await(e===void 0?Ge(t,!1):ze(e,t,!1)),r.has(t)&&await(e===void 0?Pe(t,!0):u(e,t,!0))}))).find(e=>e.status===`rejected`);i&&L(i.reason instanceof Error?i.reason.message:`Could not undo the archive.`,{tone:`danger`})}function fT(){let e=document.activeElement;return!e||e===document.body||!e.isConnected}function pT(e,t){if(!e.isConnected)return t();let n=new MutationObserver(()=>{e.isConnected||(n.disconnect(),clearTimeout(r),t())}),r=setTimeout(()=>n.disconnect(),5e3);n.observe(document.body,{childList:!0,subtree:!0})}function mT(e,t){if(!fT())return;let n=e?.isConnected?e:t?.isConnected?t:null;n instanceof HTMLElement&&(n.tabIndex<0&&!n.hasAttribute(`tabindex`)&&(n.tabIndex=-1),n.focus({preventScroll:!0}))}function hT(e,t,n){if(!e)return()=>{};let r=t(e);return()=>pT(e,()=>mT(r,n))}function gT(e){let t=document.activeElement?.closest(`[data-slot="task-row"]`);return t?.getAttribute(`data-run-id`)===e?t:Array.from(document.querySelectorAll(`[data-slot="task-row"]`)).find(t=>t.getAttribute(`data-run-id`)===e)??null}var _T=e=>e?.querySelector(`a`)??null;function vT(e,t,n){let r=V(),[i,a]=Q.useState(null),o=e=>r.invalidateQueries({queryKey:[e,`runs`]}),s=(t,n,r,i)=>L(t,{action:{label:`Undo`,onAction:()=>void dT(e,r,i).finally(()=>void o(n))}}),c=Q.useRef(new Map);return{archiveOne:r=>{let i=c.current.get(r.id);if(i)return i;let a=t??Hn(),l=!!r.pinned,u=gT(r.id),d=hT(u,e=>{let t=Array.from(e.closest(`[data-slot="quick-list-bucket"]`)?.querySelectorAll(`[data-slot="task-row"]`)??[]),n=t.indexOf(e);return _T(t[n+1]??t[n-1])},u?.closest(`[data-slot="quick-list-bucket"]`)?.parentElement??null),f=(e===void 0?Ge(r.id,!0):ze(e,r.id,!0)).then(()=>(o(a),s(uT({title:hr(r)}),a,[r.id],l?[r.id]:[]),d(),n?.(),!0),e=>(L(e.message,{tone:`danger`}),!1)).finally(()=>c.current.delete(r.id));return c.current.set(r.id,f),f},sweep:r=>{let i=t??Hn();a(r);let c=document.activeElement,l=c?.matches(`[data-action="archive-group"]`)?c:null,u=hT(l,e=>_T(e.closest(`[data-slot="quick-list-bucket"]`)?.nextElementSibling?.querySelector(`[data-slot="task-row"]`)??void 0),l?.closest(`[data-slot="quick-list-bucket"]`)?.parentElement??null);(e===void 0?ne(r):He(e,r)).then(({ids:e,pinnedIds:t})=>{o(i),e.length>0&&s(uT({count:e.length}),i,e,t),u(),e.length>0&&n?.()},e=>L(e.message,{tone:`danger`})).finally(()=>a(null))},sweeping:i}}var yT=.6,bT=300,xT=100,ST={offset:0,phase:`idle`,past:!1},CT=null;function wT(e,t){CT&&CT.id!==e&&CT.close(),CT={id:e,close:t}}function TT(e){CT?.id===e&&(CT=null)}function ET(){if(!(typeof navigator>`u`||typeof navigator.vibrate!=`function`))try{navigator.vibrate(10)}catch{}}function DT({id:e,enabled:t,onArchive:n}){let[r,i]=Q.useState(ST),a=Q.useRef(null),o=Q.useRef(null),s=Q.useRef(!1),c=Q.useRef(!1),l=Q.useRef(void 0),u=()=>{c.current=!0,clearTimeout(l.current),l.current=void 0},d=()=>{c.current&&(clearTimeout(l.current),l.current=setTimeout(()=>{c.current=!1},bT))};Q.useEffect(()=>()=>clearTimeout(l.current),[]);let f=Q.useRef(r);f.current=r;let p=Q.useRef(n);p.current=n;let m=Q.useCallback(()=>{o.current=null,s.current=!1,TT(e),i(ST)},[e]);Q.useEffect(()=>{!t&&f.current.phase!==`committing`&&m()},[t,m]),Q.useEffect(()=>()=>TT(e),[e]);let h=r.phase===`open`;Q.useEffect(()=>{if(!h)return;let e=()=>m(),t=e=>{let t=a.current;t&&e.target instanceof Node&&t.contains(e.target)||m()};return document.addEventListener(`scroll`,e,{capture:!0,passive:!0}),document.addEventListener(`pointerdown`,t,!0),()=>{document.removeEventListener(`scroll`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,!0)}},[h,m]);let g=t=>{TT(e),i({offset:-t,phase:`committing`,past:!0});let n=e=>{e===!1&&m()};try{let e=p.current();e&&typeof e.then==`function`&&e.then(n,m)}catch{m()}};return{offset:r.offset,phase:r.phase,past:r.past,surfaceRef:a,bind:{onPointerDown:e=>{if(c.current=!1,!t||f.current.phase===`committing`||e.pointerType===`mouse`&&e.button!==0)return;let n=(a.current??e.currentTarget).getBoundingClientRect();o.current={pointerId:e.pointerId,x0:e.clientX,y0:e.clientY,base:f.current.phase===`open`?-88:0,width:n.width>0?n.width:320,axis:null,wasOpen:f.current.phase===`open`,samples:[{x:e.clientX,t:Date.now()}]}},onPointerMove:t=>{let n=o.current;if(!n||t.pointerId!==n.pointerId)return;let r=t.clientX-n.x0,a=t.clientY-n.y0;if(n.axis===null){if(Math.max(Math.abs(r),Math.abs(a))<10||(n.axis=Math.abs(r)>Math.abs(a)?`x`:`y`,n.axis===`y`))return;try{t.currentTarget.setPointerCapture?.(t.pointerId)}catch{}wT(e,m),u()}if(n.axis!==`x`)return;let c=Math.min(0,Math.max(-n.width,n.base+r)),l=-c>=yT*n.width;l&&!s.current&&ET(),s.current=l,n.samples.push({x:t.clientX,t:Date.now()}),n.samples.length>8&&n.samples.shift(),i({offset:c,phase:`dragging`,past:l})},onPointerUp:t=>{let n=o.current;if(!n||t.pointerId!==n.pointerId)return;if(o.current=null,n.axis!==`x`){n.axis===null&&n.wasOpen&&(u(),d(),m());return}d();let r=f.current.offset,a=Date.now(),c={x:t.clientX,t:a},l=n.samples.find(e=>a-e.t<=xT&&e.t<a),p=l?(c.x-l.x)/(c.t-l.t):0;s.current=!1,f.current.past||p<=-1&&-r>=40?g(n.width):p<1&&-r>=40?(wT(e,m),i({offset:-88,phase:`open`,past:!1})):m()},onPointerCancel:e=>{let t=o.current;!t||e.pointerId!==t.pointerId||(o.current=null,d(),t.axis===`x`&&m())},onClickCapture:e=>{c.current&&(c.current=!1,e.preventDefault(),e.stopPropagation())},onKeyDownCapture:()=>{c.current=!1}},close:m}}var OT=`[&>[data-ellipsis-hidden]]:pointer-events-none`,kT=`data-ellipsis-hidden`,AT=new Map;function jT(e){let t=getComputedStyle(e),n=`${t.fontStyle} ${t.fontWeight} ${t.fontSize} ${t.fontFamily} ${t.letterSpacing}`,r=AT.get(n);if(r!==void 0)return r;let i=document.createElement(`span`);i.textContent=`…`,i.setAttribute(`aria-hidden`,`true`),Object.assign(i.style,{position:`absolute`,visibility:`hidden`,whiteSpace:`pre`,fontStyle:t.fontStyle,fontWeight:t.fontWeight,fontSize:t.fontSize,fontFamily:t.fontFamily,letterSpacing:t.letterSpacing}),document.body.appendChild(i);let a=i.getBoundingClientRect().width;i.remove();let o=a||parseFloat(t.fontSize)||12;return a&&(!document.fonts||document.fonts.status===`loaded`)&&AT.set(n,o),o}function MT(e,t){if(e.scrollWidth<=e.clientWidth)return[];let n=e.getBoundingClientRect(),r=parseFloat(getComputedStyle(e).paddingRight)||0,i=n.left+e.clientLeft+e.clientWidth-r-t+.5;return Array.from(e.children).filter(e=>e.getBoundingClientRect().right>i)}function NT(e,t,n){Q.useLayoutEffect(()=>{let n=e.current;if(!t||!n||typeof ResizeObserver>`u`)return;let r=!0,i=()=>{if(!r)return;let e=new Set(MT(n,jT(n)));for(let t of Array.from(n.children))t.hasAttribute(kT)!==e.has(t)&&t.toggleAttribute(kT,e.has(t))},a=new ResizeObserver(i),o=new Set,s=()=>{for(let e of Array.from(n.children))o.has(e)||(o.add(e),a.observe(e))};a.observe(n),s(),i();let c=typeof MutationObserver>`u`?null:new MutationObserver(()=>{s(),i()});return c?.observe(n,{childList:!0}),document.fonts&&document.fonts.status!==`loaded`&&document.fonts.ready.then(i),()=>{r=!1,a.disconnect(),c?.disconnect();for(let e of Array.from(n.children))e.removeAttribute(kT)}},[e,t,n])}var PT=[`needs you`,`needs permission`,`needs review`,`failed`,`working`,`queued`,`scheduled`,`done`,`cancelled`];function FT(e){switch(e){case`needs you`:return`needs you`;case`needs permission`:return`needs permission`;case`needs review`:return`needs review`;case`failed`:return`failed`;case`queued`:return`queued`;case`scheduled`:return`scheduled`;case`done`:return`done`;case`cancelled`:return`cancelled`;default:return`working`}}function IT(e,t=2){return LT(e.map(e=>Br(e).label),t)}function LT(e,t=2){let n=new Map;for(let t of e){let e=FT(t);n.set(e,(n.get(e)??0)+1)}return PT.filter(e=>n.has(e)).slice(0,t).map(e=>`${n.get(e)} ${e}`)}function RT(e,t){let[n,...r]=e;if(!n)return new Set;let i=new Set(Zi(n,void 0,t).map(ki));for(let e of r){let n=new Set(Zi(e,void 0,t).map(ki));for(let e of i)n.has(e)||i.delete(e)}return i}function zT(e,t){let n,r=-1/0;for(let t of e){let e=t.finishedAt??t.createdAt,i=Date.parse(e);Number.isFinite(i)&&i>r&&(n=e,r=i)}return So(n,t)}function BT(e,t,n){return{families:IT(e),shared:RT(e,n),age:zT(e,t)}}function VT(e,t){let n=e?Date.parse(e):NaN;if(!Number.isFinite(n)||n<=t)return`scheduled`;let r=Math.max(1,Math.floor((n-t)/6e4));if(r<60)return`resumes in ${r}m`;let i=new Date(n),a=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`}).format(i);return n-t<864e5?`resumes ${a}`:`resumes ${new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`}).format(i)} ${a}`}var HT=`(hover: none)`;function UT(){let[e,t]=(0,Q.useState)(()=>typeof window.matchMedia==`function`&&window.matchMedia(HT).matches);return(0,Q.useEffect)(()=>{if(typeof window.matchMedia!=`function`)return;let e=window.matchMedia(HT);t(e.matches);let n=e=>t(e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}function WT(){let[e,t]=(0,Q.useState)(()=>typeof window.matchMedia!=`function`||window.matchMedia(`(min-width: 768px)`).matches);return(0,Q.useEffect)(()=>{if(typeof window.matchMedia!=`function`)return;let e=window.matchMedia(`(min-width: 768px)`),n=e=>t(e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}var GT=`cez-sidebar-collapsed`,KT=`cez-sidebar-sections-collapsed`;function qT(e){if(typeof e!=`object`||!e||Array.isArray(e))return{};let t={};for(let[n,r]of Object.entries(e))typeof r==`boolean`&&(t[n]=r);return t}function JT(e=GT){try{let t=localStorage.getItem(e);return t===null?{}:qT(JSON.parse(t))}catch{return{}}}function YT(e,t=GT){try{localStorage.setItem(t,JSON.stringify(e))}catch{}}var XT=`cez-sidebar-sections-changed`;function ZT(e){let[t,n]=(0,Q.useState)(()=>JT(KT)),[r,i]=(0,Q.useState)({}),a=(0,Q.useRef)(t);(0,Q.useEffect)(()=>{let e=e=>{if(e instanceof StorageEvent&&e.key!==null&&e.key!==`cez-sidebar-sections-collapsed`)return;let t=e instanceof CustomEvent?e.detail:JT(KT);a.current=t,n(t)};return window.addEventListener(`storage`,e),window.addEventListener(XT,e),()=>{window.removeEventListener(`storage`,e),window.removeEventListener(XT,e)}},[]),(0,Q.useEffect)(()=>{if(e===null||Object.keys(r).length===0)return;let t={...a.current};for(let[n,i]of Object.entries(r))t[JSON.stringify([e,n])]=i;i({}),a.current=t,n(t),YT(t,KT),window.dispatchEvent(new CustomEvent(XT,{detail:t}))},[e,r]);let o=t=>JSON.stringify([e,t]);return{isCollapsed:e=>e!==`Archived`&&(r[e]??t[o(e)])===!0,toggle:t=>{if(e===null){i(e=>({...e,[t]:e[t]!==!0}));return}let r=o(t),s={...a.current,[r]:a.current[r]!==!0};a.current=s,n(s),YT(s,KT),window.dispatchEvent(new CustomEvent(XT,{detail:s}))}}}function QT({runs:e,view:t,onViewChange:n,currentRunId:r=null,currentGroupId:i=null,now:a=Date.now(),showTokens:o=!0,showCost:s=!0,onTogglePin:c,onArchiveRun:l,onSweep:u,sweeping:d=null,showViewControls:f=!0,rowLimit:p,sidebarLimits:m,projectId:h=null}){let g=yw(),_=br(e),v=qn(e,t),y=hi(v,m??p??{overall:null}),b=t===`archived`?void 0:c,x=t===`archived`?void 0:l,C=t===`archived`?void 0:u,w=C?$T(e):void 0;return(0,$.jsxs)(`div`,{"data-slot":`quick-list`,children:[(0,$.jsxs)(`div`,{"data-slot":`quick-list-header`,className:`flex min-h-11 items-center gap-1.5 pr-[6px] pl-[10px] md:min-h-[26px]`,children:[(0,$.jsx)(`h2`,{className:`text-[13px] font-semibold text-foreground`,children:`Tasks`}),(0,$.jsx)(`span`,{className:`text-[11.5px] text-soft-foreground`,children:_[t]}),(0,$.jsxs)(Z,{to:`/`,onClick:g,className:`ml-auto flex min-h-11 items-center gap-0.5 text-[12px] text-soft-foreground hover:text-foreground md:min-h-[26px]`,children:[`All`,(0,$.jsx)(S,{className:`size-[13px]`,"aria-hidden":`true`})]})]}),f?(0,$.jsx)(`div`,{className:`sticky top-0 z-10 bg-sidebar pt-2 pb-1`,children:(0,$.jsxs)(`div`,{className:`inline-flex w-full gap-0.5 rounded-md bg-muted p-[2px]`,children:[(0,$.jsxs)(tE,{view:`active`,current:t,onSelect:n,count:_.active,children:[`Active`,_.waiting>0&&t!==`active`?(0,$.jsx)(aa,{tone:`pending`,pulse:!0,"data-slot":`waiting-dot`,"aria-label":`needs you`}):null]}),(0,$.jsx)(tE,{view:`archived`,current:t,onSelect:n,count:_.archived,children:`Archived`})]})}):null,v.length===0?(0,$.jsx)(`p`,{className:`px-3 py-3.5 text-xs text-soft-foreground`,children:t===`archived`?`Nothing archived yet.`:`No tasks yet — describe one.`}):(0,$.jsx)(eE,{buckets:y,allBuckets:t===`active`?v:y,sectionProjectId:h,currentRunId:Dr(r,e),currentGroupId:i,now:a,showTokens:o,showCost:s,onTogglePin:b,onArchiveRun:x,onSweep:C,sweeping:d,sweepCounts:w})]})}function $T(e){return{unpinned:ui(e,`unpinned`),pinned:ui(e,`pinned`)}}function eE({buckets:e,currentRunId:t=null,currentGroupId:n=null,now:r=Date.now(),scope:i=null,showTokens:a=!0,showCost:o=!0,onTogglePin:s,onArchiveRun:c,onSweep:l,sweeping:u=null,sweepCounts:d,projectName:f,allBuckets:p=e,sectionProjectId:m=i}){let h=Q.useId(),g=ZT(m),_=Q.useRef(null),v=Q.useRef(null);Q.useLayoutEffect(()=>{let e=v.current;if(!e||e.element.isConnected||(v.current=null,document.activeElement!==document.body))return;let t=p.find(t=>t.rows.some(t=>e.kind===`group`?t.kind===`group`&&t.groupId===e.id:t.kind===`run`?t.run.id===e.id:t.members.some(t=>t.id===e.id)));if(!t)return;let n=Array.from(_.current?.children??[]).find(e=>e.dataset.bucket===t.label),r=Array.from(n?.querySelectorAll(`[data-slot="task-row"], [data-slot="group-row"]`)??[]).find(t=>(e.kind===`group`?t.dataset.groupId:t.dataset.runId)===e.id);((e.kind===`group`?Array.from(r?.querySelectorAll(`a`)??[]).find(t=>e.element.tagName===`A`&&t.getAttribute(`href`)===e.element.getAttribute(`href`))??r?.querySelector(`[data-slot="group-tile"]`):r?.querySelector(`a`))??n?.querySelector(`[data-slot="section-toggle"]`))?.focus({preventScroll:!0})});let[y,b]=Q.useState(()=>new Set),x=e=>b(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n}),C=e=>(0,$.jsx)(nE,{row:e,currentRunId:t,currentGroupId:n,now:r,scope:i,showTokens:a,showCost:o,expanded:e.kind===`group`&&y.has(e.groupId),onToggle:x,onTogglePin:s,onArchiveRun:c});return(0,$.jsx)(`div`,{ref:_,className:`flex flex-col gap-3`,onFocusCapture:e=>{let t=e.target.closest(`[data-slot="task-row"], [data-slot="group-row"]`);v.current=t?.dataset.runId?{kind:`run`,id:t.dataset.runId,element:e.target}:t?.dataset.groupId?{kind:`group`,id:t.dataset.groupId,element:e.target}:null},onBlurCapture:e=>{e.currentTarget.contains(e.relatedTarget)||(v.current=null)},children:p.map(t=>{let n=t.label===`Archived`,r=g.isCollapsed(t.label),i=e.find(({label:e})=>e===t.label)?.rows??[],a=t.rows.flatMap(e=>e.kind===`run`?[e.run]:e.members),o=n?t.rows.length:a.length,s=a.length?Br(wr(a)):null,c=a.some(rr),p=`${h}-${t.label.replaceAll(` `,`-`)}`,m=r?S:ge;return(0,$.jsxs)(`div`,{"data-slot":`quick-list-bucket`,"data-bucket":t.label,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 pr-[6px]`,children:[(0,$.jsx)(`h2`,{id:p,className:`min-w-0 flex-1 text-[11px] font-medium text-soft-foreground`,children:n?(0,$.jsxs)(`span`,{className:`px-[10px] pt-[2px] pb-[4px]`,children:[t.label,` `,o]}):(0,$.jsxs)(`button`,{type:`button`,"data-slot":`section-toggle`,"aria-expanded":!r,"aria-controls":`${p}-rows`,"aria-label":`${t.label} ${o}`,onClick:()=>g.toggle(t.label),className:`flex min-h-[44px] w-full items-center gap-1.5 rounded-[4px] px-[10px] text-left hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-link-foreground md:min-h-[26px] no-hover:min-h-[44px]`,children:[(0,$.jsx)(m,{className:`size-[12px] shrink-0`,"aria-hidden":`true`}),(0,$.jsx)(`span`,{children:t.label}),` `,(0,$.jsx)(`span`,{className:`font-normal tabular-nums`,children:o}),s&&(t.label===`Needs you`||r)?(0,$.jsx)(aa,{tone:s.tone,shape:s.shape,pulse:s.pulse,role:`img`,"aria-label":s.label,title:s.label}):null,r&&c?(0,$.jsx)(`span`,{role:`img`,"aria-label":`unread`,title:`Unread tasks`,className:`size-[5px] shrink-0 rounded-full bg-foreground`}):null]})}),l&&d?(0,$.jsx)(gE,{label:t.label,headingId:p,projectName:f,counts:d,onSweep:l,sweeping:u}):null]}),(0,$.jsx)(`div`,{id:`${p}-rows`,hidden:r,children:!r&&i.map(e=>(0,$.jsx)(`div`,{children:C(e)},e.kind===`group`?e.groupId:e.run.id))})]},t.label)})})}function tE({view:e,current:t,onSelect:n,count:r,children:i}){let a=e===t;return(0,$.jsxs)(`button`,{type:`button`,"data-slot":`view-tab`,"data-view":e,"aria-pressed":a,onClick:()=>n(e),className:U(`flex min-h-11 min-w-0 flex-1 items-center justify-center gap-1.5 rounded-[7px] text-[11px] font-medium text-muted-foreground md:min-h-[22px]`,a&&`bg-card font-semibold text-foreground shadow-xs`),children:[i,r>0?(0,$.jsx)(`span`,{className:`font-mono text-[11px] tabular-nums`,children:r}):null]})}function nE({row:e,currentRunId:t,currentGroupId:n,now:r,scope:i,expanded:a,onToggle:o,showTokens:s,showCost:c,onTogglePin:l,onArchiveRun:u}){return e.kind===`run`?(0,$.jsx)(mE,{run:e.run,queuePosition:e.queuePosition,currentRunId:t,now:r,scope:i,showTokens:s,showCost:c,onTogglePin:l,onArchiveRun:u}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(iE,{row:e,now:r,scope:i,expanded:a,onToggle:o,active:n===e.groupId||!a&&e.members.some(e=>e.id===t)}),a?(0,$.jsx)(aE,{members:e.members,currentRunId:t,now:r,scope:i,showTokens:s,showCost:c,onTogglePin:l,onArchiveRun:u}):null]})}function rE(){let e=UT(),t=WT();return e||!t}function iE({row:e,now:t,scope:n,expanded:r,onToggle:i,active:a}){let o=yw(),s=Br(e.lead),c=n??void 0,{families:l,shared:u,age:d}=BT(e.members,t,c),f=rE(),p=e.members[0],m=Zi(p,void 0,c).filter(e=>u.has(ki(e))),h=Q.useRef(null);NT(h,!f&&m.length>0,`${l.join(`,`)}|${m.map(ki).join(`,`)}|${d}`);let g=[...l.map(e=>(0,$.jsx)(`span`,{children:e},`family-${e}`)),...m.map(e=>(0,$.jsx)(Oy,{run:p,reference:e,plain:!0,inert:f},`${e.kind}-${e.number}-${e.url}`)),...d?[(0,$.jsx)(`span`,{className:`tabular-nums`,children:d},`age`)]:[]],_=r?ge:S,v=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{"data-slot":`group-title`,className:U(`min-w-0 truncate text-[13px] leading-[1.45] font-medium text-muted-foreground`,a&&`text-foreground`),children:e.title}),(0,$.jsxs)(`span`,{"data-slot":`group-count`,className:`shrink-0 rounded-[9px] bg-muted px-1.5 py-px font-mono text-[11px] leading-[1.3] font-semibold tabular-nums text-muted-foreground`,children:[`×`,e.members.length]})]}),y=U(`block h-[16px] w-full min-w-0 truncate text-[11.5px] leading-[1.4] font-normal text-soft-foreground`,a&&`text-muted-foreground`),b=g.length?g.flatMap((e,t)=>t?[(0,$.jsx)(pE,{},`sep-${t}`),e]:[e]):`\xA0`,x=`w-full min-w-0 rounded-[2px] text-left focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground`;return(0,$.jsxs)(`div`,{"data-slot":`group-row`,"data-group-id":e.groupId,"data-active":a?`true`:void 0,"data-structure":f?`touch`:`pointer`,onClick:t=>{t.currentTarget.contains(t.target)&&(t.target.closest(`a, button`)||i(e.groupId))},className:U(`selection-row flex cursor-pointer items-start gap-2.5 rounded-[6px] py-1.5 pr-2 pl-2.5 hover:bg-sidebar-row-hover`,f&&`py-0`,a&&`bg-sidebar-row-selected hover:bg-sidebar-row-selected`),children:[(0,$.jsx)(`span`,{"data-slot":`task-row-dot`,className:U(`flex h-[19px] w-[12px] shrink-0 items-center justify-center`,f&&`mt-1.5`),children:(0,$.jsx)(aa,{tone:s.tone,shape:s.shape,pulse:s.pulse,"aria-label":s.label,title:s.label,role:`img`})}),f?(0,$.jsxs)(`button`,{type:`button`,"data-slot":`group-tile`,"data-group-id":e.groupId,"aria-expanded":r,onClick:()=>i(e.groupId),className:U(`flex flex-1 flex-col py-1.5`,x),children:[(0,$.jsx)(`span`,{className:`flex h-[19px] w-full min-w-0 items-center gap-1.5`,children:v}),(0,$.jsx)(`span`,{"data-slot":`group-meta`,className:y,children:b})]}):(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,$.jsx)(`button`,{type:`button`,"data-slot":`group-tile`,"data-group-id":e.groupId,"aria-expanded":r,onClick:()=>i(e.groupId),className:U(`flex h-[19px] items-center gap-1.5`,x),children:v}),(0,$.jsx)(`div`,{ref:h,"data-slot":`group-meta`,className:U(y,OT),children:b})]}),(0,$.jsxs)(`span`,{"data-slot":`group-trailing`,className:U(`flex h-[19px] w-[36px] shrink-0 items-center justify-end gap-0.5 no-hover:h-auto no-hover:w-[60px] no-hover:self-stretch`,f&&`mt-1.5 no-hover:mt-0`),children:[(0,$.jsx)(Z,{to:wo(n,`/compare/${e.groupId}`),onClick:o,"data-slot":`group-compare`,title:`Compare the variants`,"aria-label":`Compare the variants of ${e.title}`,className:`inline-flex size-[18px] shrink-0 items-center justify-center rounded-sm text-soft-foreground hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-link-foreground no-hover:size-[44px] no-hover:min-h-[44px] no-hover:min-w-[44px]`,children:(0,$.jsx)(al,{className:`size-[14px]`,"aria-hidden":`true`})}),(0,$.jsx)(`span`,{"data-slot":`group-disclosure`,"data-expanded":r?`true`:`false`,"aria-hidden":`true`,className:`inline-flex size-[14px] shrink-0 items-center justify-center text-soft-foreground`,children:(0,$.jsx)(_,{className:`size-[14px]`})})]})]})}function aE({members:e,currentRunId:t,now:n,scope:r,showTokens:i,showCost:a,onTogglePin:o,onArchiveRun:s}){let c=RT(e,r??void 0),l=(0,$.jsx)(`div`,{"data-slot":`variant-list`,className:`ml-[15.5px] border-l border-border pl-[6px]`,children:e.map(e=>(0,$.jsx)(mE,{run:e,queuePosition:null,currentRunId:t,now:n,scope:r,variant:!0,groupReferences:c,showTokens:i,showCost:a,onTogglePin:o,onArchiveRun:s},e.id))});return r?(0,$.jsx)(jv,{projectId:r,requests:e.flatMap(e=>Zi(e).map(e=>({projectId:r,kind:e.kind,number:e.number}))),children:l}):l}var oE=`opacity-0 group-hover/task-row:opacity-100 focus-visible:opacity-100 group-has-[:focus-visible]/task-row:opacity-100 no-hover:opacity-100`,sE=`opacity-0 group-hover/task-row:opacity-100 focus-visible:opacity-100 group-has-[:focus-visible]/task-row:opacity-100`,cE=`transition-opacity motion-reduce:transition-none group-hover/task-row:opacity-0 group-has-[:focus-visible]/task-row:opacity-0 max-md:absolute max-md:top-1/2 max-md:left-0 max-md:-translate-y-1/2 max-md:opacity-100 no-hover:absolute no-hover:top-1/2 no-hover:left-0 no-hover:-translate-y-1/2 no-hover:opacity-100`;function lE(e,t,n){let[r,i]=Q.useState(!1);return Q.useLayoutEffect(()=>{let n=e.current;if(!t||!n||typeof ResizeObserver>`u`)return;let r=()=>i(n.scrollWidth>n.clientWidth);r();let a=new ResizeObserver(r);return a.observe(n),document.fonts?.ready.then(r),()=>a.disconnect()},[e,t,n]),r}function uE(e){let t=document.createRange();t.selectNodeContents(e);let n=t.getBoundingClientRect?.().width;return n?Math.ceil(n):e.scrollWidth}function dE(e,t,n){let[r,i]=Q.useState(!1),[a,o]=Q.useState(0),s=Q.useRef(!1),c=Q.useRef(!1),l=Q.useRef(null),u=Q.useCallback(e=>{s.current=e,i(e)},[]);return Q.useLayoutEffect(()=>{let r=e.current;if(!t||!r||typeof ResizeObserver>`u`){l.current=null,u(!1);return}let i=!0,a=()=>{if(i){if(l.current?.key!==n){if(s.current){u(!1),o(e=>e+1);return}l.current={key:n,width:uE(r)}}u(l.current.width>r.clientWidth)}};a();let d=new ResizeObserver(a);d.observe(r);let f=new WeakMap,p=new ResizeObserver(e=>{let t=!1;for(let n of e??[]){let e=n.borderBoxSize?.[0]?.inlineSize??n.contentRect.width,r=f.get(n.target);f.set(n.target,e),r!==void 0&&r!==e&&(t=!0)}!t||!i||(l.current=null,a())}),m=new Set,h=()=>{let e=!1;for(let t of Array.from(r.children)){let{slot:n}=t.dataset;n===`task-row-age`||t.getAttribute(`aria-hidden`)===`true`||m.has(t)||(m.add(t),f.set(t,t.getBoundingClientRect().width),p.observe(t),e=!0)}return e};h();let g=typeof MutationObserver>`u`?null:new MutationObserver(()=>{!h()||!i||(l.current=null,a())});return g?.observe(r,{childList:!0}),document.fonts&&document.fonts.status!==`loaded`&&!c.current&&document.fonts.ready.then(()=>{c.current=!0,i&&(l.current=null,a())}),()=>{i=!1,d.disconnect(),p.disconnect(),g?.disconnect()}},[e,t,n,a,u]),t&&r}function fE(e,t,n,r){let{label:i}=e;if(i===`queued`)return t===null?i:`queued #${t}`;if(!(i===`needs you`||i===`done`||i===`cancelled`))return i===`scheduled`?VT(n.autoResumeAt,r):i}function pE(){return(0,$.jsx)(`span`,{"aria-hidden":`true`,children:` · `})}function mE({run:e,queuePosition:t,currentRunId:n,now:r,scope:i,variant:a=!1,groupReferences:o,showTokens:s,showCost:c,onTogglePin:l,onArchiveRun:u}){let d=Eo(),f=yw(),p=rE(),m=!!u&&p&&ni(e),h=DT({id:e.id,enabled:m,onArchive:()=>u?.(e)}),g=wo(i,`/tasks/${e.id}`),_=Br(e),v=e.id===n,y=Xr(e),b=Zi(e,void 0,i??void 0).filter(e=>!o?.has(ki(e))),x=hr(e),S=lr(x,y?.number)?Jn(x).rest:x,C=rr(e),w=a||t!==null?``:So(e.finishedAt??e.createdAt,r),T=fE(_,t,e,r),E=a&&s&&(e.inputTokens!==void 0||e.outputTokens!==void 0)?Sv(e.inputTokens,e.outputTokens):``,D=a&&c?$r(e.costUsd):``,O=Q.useRef(null),k=lE(O,a,`${e.runner}|${D}`),A=Q.useRef(null),j=`${w}|${T??``}|${b.map(e=>`${e.kind}-${e.number}-${e.url}`).join(`,`)}|${+!!e.notify}`,ee=dE(A,!!w,j);NT(A,!p&&b.length>0,`${j}|${+!!ee}`);let te=[];T&&te.push((0,$.jsx)(`span`,{"data-slot":`task-row-state`,children:T},`state`));for(let t of b)te.push((0,$.jsx)(Oy,{run:e,reference:t,plain:!0,inert:p},`${t.kind}-${t.number}-${t.url}`));w&&!ee&&te.push((0,$.jsx)(`span`,{"data-slot":`task-row-age`,className:`tabular-nums`,children:w},`age`)),E&&!k&&te.push((0,$.jsx)(`span`,{"data-slot":`task-row-tokens`,className:`tabular-nums`,children:E},`tokens`)),a&&!te.length&&_.label===`needs you`&&te.push((0,$.jsx)(`span`,{"data-slot":`task-row-state`,children:_.label},`state`));let M=(0,$.jsxs)(`div`,{"data-slot":`task-row`,"data-run-id":e.id,"data-active":v?`true`:void 0,onClick:e=>{e.currentTarget.contains(e.target)&&(e.target.closest(`a, button, input`)||(d(g),f?.()))},...m?h.bind:{},style:h.offset?{transform:`translateX(${h.offset}px)`}:void 0,className:U(`selection-row group/task-row flex cursor-pointer items-start gap-2.5 rounded-[6px] py-1.5 pr-2 pl-2.5 hover:bg-sidebar-row-hover`,m&&`select-none`,m&&h.phase!==`dragging`&&`motion-safe:transition-transform motion-safe:duration-200 motion-safe:ease-out`,v&&`bg-sidebar-row-selected hover:bg-sidebar-row-selected`),children:[(0,$.jsx)(`span`,{"data-slot":`task-row-dot`,className:`flex h-[19px] w-[12px] shrink-0 items-center justify-center`,children:(0,$.jsx)(aa,{tone:_.tone,shape:_.shape,pulse:_.pulse,"aria-label":_.label,title:_.label,role:`img`})}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,$.jsxs)(Z,{to:g,onClick:f,title:x,"aria-current":v?`page`:void 0,draggable:!m&&void 0,className:`flex h-[19px] min-w-0 items-center gap-2 rounded-[2px] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground`,children:[a?(0,$.jsx)(`span`,{"data-slot":`task-row-variant-letter`,className:U(`inline-flex size-[16px] shrink-0 items-center justify-center rounded-full bg-muted font-mono text-[10.5px] font-semibold text-muted-foreground`,v&&`bg-sidebar text-foreground`),children:e.variant??`?`}):null,(0,$.jsx)(`span`,{ref:a?O:void 0,"data-slot":`task-row-title`,className:U(`min-w-[7rem] flex-1 truncate text-[13px] leading-[1.45] font-medium text-muted-foreground`,a&&`min-w-0`,C&&`font-semibold text-foreground`,v&&`text-foreground`),children:a?(0,$.jsxs)($.Fragment,{children:[e.runner??`claude`,D?(0,$.jsxs)($.Fragment,{children:[` · `,(0,$.jsx)(`span`,{"data-slot":`variant-cost`,children:D})]}):null]}):S}),e.diffStat?(0,$.jsx)(yv,{stat:e.diffStat,className:`hidden shrink-0 text-[12px] @min-[23rem]/sidebar:inline`}):null]}),(0,$.jsxs)(`div`,{ref:A,"data-slot":`task-row-meta`,className:U(`h-[16px] min-w-0 truncate text-[11.5px] leading-[1.4] font-normal text-soft-foreground`,OT,v&&`text-muted-foreground`),children:[e.notify===!0?(0,$.jsx)(`span`,{"data-slot":`task-row-notify`,role:`img`,"aria-label":`Notifying the task webhook`,title:`Notifying the task webhook`,className:`mr-[4px] inline-block shrink-0 align-[-1px]`,children:(0,$.jsx)(ol,{"aria-hidden":`true`,className:`size-[10px]`})}):null,te.length?te.flatMap((e,t)=>t?[(0,$.jsx)(pE,{},`sep-${t}`),e]:[e]):e.notify===!0?null:`\xA0`]})]}),e.delegation?.role===`worker`?(0,$.jsxs)(`span`,{className:`sr-only`,children:[`Worker · `,_.label]}):null,(0,$.jsxs)(`span`,{"data-slot":`task-row-trailing`,className:`relative flex h-[19px] w-[16px] shrink-0 items-center justify-center max-md:h-auto max-md:w-11 max-md:self-stretch no-hover:h-auto no-hover:w-11 no-hover:self-stretch`,children:[C?(0,$.jsx)(aa,{tone:xr(e),role:`img`,"aria-label":`unread`,title:`Unread — not opened since it finished`,"data-slot":`unread-marker`,className:l?cE:void 0}):null,l?(0,$.jsx)(Dv,{pinned:!!e.pinned,onToggle:t=>l(e,t),className:U(`absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2`,oE)}):null,u&&!p&&ni(e)?(0,$.jsx)(`button`,{type:`button`,"data-action":`archive-run`,"aria-label":`Archive ${x}`,title:`Archive task`,onClick:t=>{t.stopPropagation(),u(e)},className:U(`absolute top-[19.5px] left-1/2 inline-flex size-5 -translate-x-1/2 items-center justify-center rounded-sm text-muted-foreground transition-colors hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none motion-reduce:transition-none`,sE),children:(0,$.jsx)(Ee,{className:`size-[12px] -translate-y-[2.5px]`,"aria-hidden":`true`})}):null]})]});return p?(0,$.jsxs)(`div`,{ref:h.surfaceRef,"data-slot":`task-row-swipe`,"data-swipe":m?`on`:void 0,className:U(`relative rounded-[6px]`,m&&`touch-pan-y touch-pinch-zoom overflow-hidden`),children:[h.offset<0?(0,$.jsx)(hE,{width:-h.offset,past:h.past,title:x,onArchive:()=>void u?.(e)}):null,M]}):M}function hE({width:e,past:t,title:n,onArchive:r}){return(0,$.jsx)(`div`,{"data-slot":`task-row-swipe-action`,"data-past":t?`true`:void 0,"aria-hidden":`true`,style:{width:e},className:U(`absolute inset-y-0 right-0 flex items-stretch justify-end overflow-hidden rounded-[6px]`,t?`bg-info text-signal-ink`:`bg-muted text-foreground`),children:t?(0,$.jsxs)(`span`,{className:`flex w-full items-center justify-center gap-2 text-[12px] font-semibold whitespace-nowrap`,children:[(0,$.jsx)(Ee,{className:`size-[16px] shrink-0`,"aria-hidden":`true`}),`Release to archive`]}):(0,$.jsxs)(`button`,{type:`button`,tabIndex:-1,"aria-label":`Archive ${n}`,onClick:e=>{e.stopPropagation(),r()},className:`flex w-[88px] shrink-0 flex-col items-center justify-center gap-1 text-[12px] font-semibold`,children:[(0,$.jsx)(Ee,{className:`size-[16px]`,"aria-hidden":`true`}),`Archive`]})})}function gE({label:e,headingId:t,projectName:n,counts:r,onSweep:i,sweeping:a}){let o=e===`Finished`?`unpinned`:null;if(!o||r[o]===0)return null;let s=a===o,c=`Archive all`;return(0,$.jsxs)(`button`,{type:`button`,"data-action":`archive-group`,"data-scope":o,disabled:s,"aria-busy":s?`true`:void 0,"aria-label":n?`${c}, ${n}`:void 0,"aria-describedby":t,onClick:()=>i(o),className:`relative inline-flex shrink-0 items-center gap-1 rounded-[4px] px-1.5 py-0.5 font-sans text-[11px] leading-[1.4] text-muted-foreground hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-link-foreground disabled:opacity-60 max-md:before:absolute max-md:before:top-1/2 max-md:before:left-0 max-md:before:h-11 max-md:before:w-full max-md:before:-translate-y-1/2 max-md:before:content-[''] no-hover:before:absolute no-hover:before:top-1/2 no-hover:before:left-0 no-hover:before:h-11 no-hover:before:w-full no-hover:before:-translate-y-1/2 no-hover:before:content-['']`,children:[(0,$.jsx)(Ee,{className:`size-[11px]`,"aria-hidden":`true`}),c]})}function _E({showViewControls:e=!0,projectId:t,boot:n=!1}){let r=yw(),i=t??Hn(),a=vi(i,!0,n),o=Ui(i,!0,n).data?.sidebarLimits??{},s=wi(i,n?`default`:i),c=vT(i,n?`default`:i,r),l=W(),u=By(l.data),[d,f]=Bw(),p=vo(`/tasks/:id/*`),m=vo(`/tasks/:id`),h=vo(`/compare/:groupId`),g=tp(3e4),_=ci(),v=t??_,y=Di(v),b=hi(qn(a.data??[],d),o),x=v===void 0?[]:b.flatMap(e=>e.rows.flatMap(e=>Zi(e.kind===`run`?e.run:e.members[0]).map(e=>({projectId:v,kind:e.kind,number:e.number}))));return a.data?(0,$.jsx)(jv,{projectId:v,repoBase:y,requests:x,children:(0,$.jsx)(QT,{showViewControls:e,sidebarLimits:o,projectId:v==="default"?l.data?.bootProject??null:v??null,runs:a.data,view:d,onViewChange:f,currentRunId:p?.params.id??m?.params.id??null,currentGroupId:h?.params.groupId??null,now:g,showTokens:u.tokens,showCost:u.cost,onTogglePin:(e,t)=>s.mutate({id:e.id,pinned:t}),onArchiveRun:c.archiveOne,onSweep:c.sweep,sweeping:c.sweeping})}):null}var vE={claude:!0,codex:!0,opencode:!0,pi:!0,cursor:!0,omp:!0},yE=e=>Object.hasOwn(vE,e.name);function bE(e){let t=e.checks.filter(yE);if(t.length&&!t.some(e=>e.available))return`no agent CLI found — install one to run tasks`;let n=t.find(t=>t.name===e.defaultRunner);return n&&!n.available?`default runner (${e.defaultRunner}) not found`:null}function xE(e){let t=`cezar v${e.version}`,n=bE(e);if(n)return`${t} · ${n}`;let r=e.checks.filter(e=>!e.available).map(e=>e.name);return r.length?`${t} · optional: ${r.join(`, `)} not installed`:t}function SE(e){return e.forge?.available?null:e.forge?`GitHub is unreachable — ${e.forge.reason??`unknown reason`}. The GitHub tab is hidden until it comes back.`:`No GitHub remote detected — the GitHub tab is hidden. Every plain-git feature still works.`}function CE({health:e,sessionScope:t}){if(!e)return null;let n=bE(e);return(0,$.jsxs)(Yo,{children:[(0,$.jsx)(Ko,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,"data-slot":`tools-menu-trigger`,"aria-label":`Tools`,title:xE(e),className:`relative flex items-center gap-1.5 rounded-[6px] px-2 py-1.5 text-[12px] font-normal text-soft-foreground transition-colors hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring data-[state=open]:bg-sidebar-row-selected data-[state=open]:text-foreground`,children:[(0,$.jsx)(vn,{className:`size-[15px]`,"aria-hidden":`true`}),n?(0,$.jsx)(aa,{tone:`pending`,className:`absolute top-1 left-5 size-1.5`}):null,`Tools`]})}),(0,$.jsxs)(qo,{side:`top`,align:`start`,"data-slot":`tools-menu-content`,className:`w-[240px]`,children:[t?(0,$.jsx)(`div`,{className:`px-2 py-2`,children:t}):null,(0,$.jsx)(Fo,{className:`text-[11px] font-semibold tracking-[.04em] text-soft-foreground uppercase`,children:`Installed tools`}),e.checks.map(e=>e.available?(0,$.jsx)(wE,{check:e},e.name):(0,$.jsx)(TE,{check:e},e.name)),SE(e)?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Uo,{}),(0,$.jsx)(`p`,{"data-slot":`forge-note`,className:`px-2 py-1.5 text-[11px] leading-snug text-muted-foreground`,children:SE(e)})]}):null,(0,$.jsx)(Uo,{}),(0,$.jsx)(Ho,{asChild:!0,children:(0,$.jsx)(o,{to:`/tools`,children:`Tools diagnostics`})}),(0,$.jsx)(Ho,{asChild:!0,children:(0,$.jsxs)(Z,{to:_S,"data-slot":`tools-settings`,className:`gap-2 text-[13px] text-muted-foreground`,children:[(0,$.jsx)(R,{className:`size-3.5`,"aria-hidden":`true`}),`Tool settings`]})})]})]})}function wE({check:e}){return(0,$.jsxs)(`div`,{"data-slot":`tool-row`,"data-tool":e.name,"data-available":`true`,className:`flex items-center gap-2 rounded-sm px-2 py-1.5`,children:[(0,$.jsx)(aa,{tone:mS(e)}),(0,$.jsx)(`span`,{className:`font-mono text-[13px] font-medium`,children:e.name}),(0,$.jsx)(`span`,{"data-slot":`tool-version`,className:`ml-auto font-mono text-[11px] font-medium text-muted-foreground tabular-nums`,children:e.version??`not found`})]})}function TE({check:e}){let t=gS(e);return(0,$.jsx)(Ho,{asChild:!0,children:(0,$.jsxs)(Z,{to:_S,"data-slot":`tool-row`,"data-tool":e.name,"data-available":`false`,className:`flex-col items-stretch gap-1`,children:[(0,$.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(aa,{tone:mS(e)}),(0,$.jsx)(`span`,{className:`font-mono text-[13px] font-medium`,children:e.name}),(0,$.jsx)(`span`,{"data-slot":`tool-version`,className:`ml-auto font-mono text-[11px] font-medium text-muted-foreground`,children:`not found`})]}),(0,$.jsxs)(`span`,{className:`flex items-end justify-between gap-3 pl-[15px]`,children:[t?(0,$.jsx)(`span`,{"data-slot":`tool-hint`,className:`min-w-0 text-[11px] leading-snug text-muted-foreground`,children:t}):null,(0,$.jsx)(`span`,{"data-slot":`tool-setup`,className:`ml-auto shrink-0 text-[11px] font-semibold text-accent-text`,children:`Set up →`})]})]})})}function EE(e){return e?.trim()||null}function DE({projectName:e,pageLabel:t}){let n=EE(e),r=EE(t);return n&&r?`${n} — ${r} · cezar`:n?`${n} · cezar`:r?`${r} · cezar`:`cezar`}function OE(e){let t=DE(e);(0,Q.useEffect)(()=>{document.title=t},[t])}function kE(e){let t=_o(e);return/^\/git\/branches(?:\/|$)/.test(t)?`branches`:/^\/git\/not-landed(?:\/|$)/.test(t)?`not-landed`:/^\/git\/cleanup(?:\/|$)/.test(t)?`cleanup`:/^\/git\/changes(?:\/|$)/.test(t)?`changes`:/^\/git(?:\/commits(?:\/[^/]+)?)?\/?$/.test(t)?`main`:null}var AE={main:`/git`,"not-landed":`/git/not-landed`,cleanup:`/git/cleanup`,branches:`/git/branches`,changes:`/git/changes`},jE=`/git?view=repo`,ME={second:`s`,minute:`m`,hour:`h`,day:`d`,week:`w`,month:`mo`,year:`y`};function NE(e){let t=/^(\d+) (second|minute|hour|day|week|month|year)s? ago$/.exec(e.trim());return t?`${t[1]}${ME[t[2]]}`:e}function PE(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}var FE=new Intl.DateTimeFormat(`en-US`,{weekday:`short`,month:`short`,day:`numeric`}),IE=new Intl.DateTimeFormat(`en-US`,{month:`short`,day:`numeric`,year:`numeric`});function LE(e,t){let n=Date.parse(e);if(Number.isNaN(n))return`Earlier`;let r=PE(t);if(n>=r)return`Today`;if(n>=PE(r-1))return`Yesterday`;let i=new Date(n);return(i.getFullYear()===new Date(t).getFullYear()?FE:IE).format(i)}function RE(e,t=Date.now()){let n=[];for(let r of e){let e=LE(r.at,t),i=n.at(-1);i?.label===e?i.commits.push(r):n.push({label:e,commits:[r]})}return n}function zE(e,t=Date.now()){return e.filter(e=>LE(e.at,t)===`Today`).length}function BE(e,t){return(e.baseBranch??t.branch)===t.branch?e.tracking:null}function VE(e,t=Date.now()){let n=e.fetchedAt?So(e.fetchedAt,t):``;return n?`fetched ${n} ago`:`never fetched`}function HE(e,t){let n=V(),r=[e,`repo`],i=[e,`health`],[a,o]=(0,Q.useState)(null),s=e=>L(e.message,{tone:`danger`}),c=()=>Promise.all([n.invalidateQueries({queryKey:r}),n.invalidateQueries({queryKey:i}),n.invalidateQueries({queryKey:q.projects})]),l=J({mutationFn:t=>Ae(t,e)}),u=async(e=!1)=>{let n=a?.branch??t.branch;try{let t=await l.mutateAsync(e?{branch:n,confirm:!0}:{branch:n});if(`risks`in t){o(t);return}o(null),L(t.summary),await c()}catch(e){o(null),L(e instanceof Error?e.message:String(e),{tone:`danger`}),await c()}},d=J({mutationFn:t=>it({name:t},e),onSuccess:async e=>{L(e.created?`Created and switched to ${e.branch}`:`Switched to ${e.branch}`),await c(),n.setQueryData(r,t=>t?.info?{...t,info:{...t.info,branch:e.branch}}:t),n.setQueryData(i,n=>n?.repo?.root===t.root?{...n,repo:{...n.repo,branch:e.branch}}:n)},onError:s}),f=J({mutationFn:t=>N({baseBranch:t},e),onSuccess:t=>{L(t.baseBranch?`New tasks now start from ${t.baseBranch}`:`New tasks now start from the checked-out branch`),n.invalidateQueries({queryKey:r}),n.invalidateQueries({queryKey:[e,`config`]})},onError:s});return{hasRemote:!!t.remote,pull:u,pulling:l.isPending,confirmation:a,dismissConfirmation:()=>{l.isPending||o(null)},switchBranch:d,setBase:f}}var UE={sidebar:{card:`gap-[8px] rounded-[8px] p-[10px]`,branchRow:`gap-[6px]`,branchIcon:`size-[14px]`,branch:`text-[12.5px]`,chevron:`size-[12px]`,pull:`h-[24px] gap-[4px] rounded-[6px] px-[8px] text-[11.5px] [&>svg]:size-[12px]`,line:`text-[11px]`,lineChevron:`size-[11px]`,dirty:`gap-[6px] pt-[6px] text-[11px] [&>svg]:size-[12px]`},screen:{card:`gap-[10px] rounded-[10px] p-[12px]`,branchRow:`gap-[8px]`,branchIcon:`size-[16px]`,branch:`text-[14px]`,chevron:`size-[14px]`,pull:`h-[36px] gap-[6px] rounded-[8px] px-[14px] text-[13px] [&>svg]:size-[14px]`,line:`text-[12px]`,lineChevron:`size-[12px]`,dirty:`h-[40px] gap-[8px] pt-[4px] text-[13px] [&>svg:first-child]:size-[14px] [&>svg:last-child]:size-[15px]`}};function WE({scope:e,repo:t,info:n,variant:r,onNavigate:i}){let a=UE[r],o=HE(e,n),s=t.baseBranch??n.branch,c=t.status.length,l=BE(t,n),u=o.switchBranch.isPending,d=(0,Q.useRef)(null);return(0,$.jsxs)(`section`,{"aria-label":`Checkout`,"data-slot":`git-checkout`,"data-variant":r,className:U(`flex flex-col border border-border`,a.card),children:[(0,$.jsxs)(`div`,{className:U(`flex min-w-0 items-center`,a.branchRow),children:[(0,$.jsxs)(Yo,{children:[(0,$.jsxs)(Ko,{"data-slot":`git-branch-menu`,"aria-label":`Branch ${n.branch}. Switch branch`,disabled:u,className:U(`group flex min-w-0 flex-1 items-center rounded-[4px] text-left outline-none focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-60`,a.branchRow,r===`screen`&&`min-h-11`),children:[(0,$.jsx)(nn,{"aria-hidden":`true`,className:U(`shrink-0 text-muted-foreground`,a.branchIcon)}),(0,$.jsx)(`span`,{"data-slot":`git-checkout-branch`,className:U(`min-w-0 flex-1 truncate font-mono font-semibold text-foreground`,a.branch),children:n.branch}),(0,$.jsx)(ge,{"aria-hidden":`true`,className:U(`shrink-0 text-soft-foreground group-hover:text-foreground`,a.chevron)})]}),(0,$.jsxs)(qo,{align:`start`,className:`w-64`,children:[(0,$.jsx)(Fo,{className:`text-xs text-soft-foreground`,children:`Switch branch`}),(0,$.jsx)(Jo,{value:n.branch,onValueChange:e=>{e!==n.branch&&o.switchBranch.mutate(e)},children:t.branches.map(e=>(0,$.jsx)(Lo,{value:e,"data-branch":e,className:`font-mono text-[12.5px]`,children:(0,$.jsx)(`span`,{className:`truncate`,children:e})},e))}),(0,$.jsx)(Uo,{}),(0,$.jsx)(Ho,{asChild:!0,children:(0,$.jsx)(Z,{to:AE.branches,"data-slot":`git-branch-menu-all`,onClick:i,children:`Create or find a branch…`})})]})]}),(0,$.jsxs)(`button`,{ref:d,type:`button`,"data-action":`repo-pull`,disabled:!o.hasRemote||o.pulling,title:o.hasRemote?`Pull ${n.branch}`:`No remote configured. Add a Git remote before pulling.`,onClick:()=>void o.pull(),className:U(`inline-flex shrink-0 items-center bg-muted font-medium text-foreground hover:brightness-110 focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 disabled:hover:brightness-100`,a.pull),children:[o.pulling?(0,$.jsx)(yo,{"aria-hidden":`true`,className:`motion-safe:animate-spin`}):(0,$.jsx)(y,{"aria-hidden":`true`}),`Pull`]})]}),l?(0,$.jsx)(GE,{tracking:l,className:a.line}):null,(0,$.jsxs)(Yo,{children:[(0,$.jsxs)(Ko,{"data-slot":`base-branch-picker`,"aria-label":`New tasks start from ${s}. Change the base branch`,disabled:o.setBase.isPending,className:U(`group flex min-w-0 items-center gap-[4px] self-start rounded-[4px] text-soft-foreground outline-none hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-60`,a.line,r===`screen`&&`min-h-[32px]`),children:[(0,$.jsx)(`span`,{className:`shrink-0`,children:`New tasks start from`}),(0,$.jsx)(`span`,{"data-slot":`base-branch`,className:`min-w-0 truncate font-mono text-muted-foreground group-hover:text-foreground`,children:s}),(0,$.jsx)(ge,{"aria-hidden":`true`,className:U(`shrink-0`,a.lineChevron)})]}),(0,$.jsxs)(qo,{align:`start`,className:`w-64`,children:[(0,$.jsx)(Fo,{className:`text-xs text-soft-foreground`,children:`New tasks start from`}),(0,$.jsxs)(Jo,{value:t.baseBranch??``,onValueChange:e=>o.setBase.mutate(e===``?null:e),children:[(0,$.jsx)(Lo,{value:``,"data-branch":``,className:`text-[12.5px]`,children:`The checked-out branch (default)`}),t.branches.map(e=>(0,$.jsx)(Lo,{value:e,"data-branch":e,className:`font-mono text-[12.5px]`,children:(0,$.jsx)(`span`,{className:`truncate`,children:e})},e))]})]})]}),c>0?(0,$.jsxs)(Z,{to:AE.changes,"data-slot":`git-uncommitted`,onClick:i,className:U(`flex min-w-0 items-center border-t border-border text-muted-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`,a.dirty),children:[(0,$.jsx)(_e,{"aria-hidden":`true`,className:`shrink-0 text-inbox-count-foreground`}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[c,` uncommitted file`,c===1?``:`s`]}),(0,$.jsx)(S,{"aria-hidden":`true`,className:`shrink-0 text-soft-foreground`})]}):null,(0,$.jsx)(KE,{checkout:o,returnFocus:d})]})}function GE({tracking:e,className:t}){let n=e.ref.split(`/`)[0]||e.ref,r=VE(e);return(0,$.jsx)(`p`,{"data-slot":`git-freshness`,className:U(`flex min-w-0 items-center gap-[4px] text-soft-foreground`,t),children:e.behind>0?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`span`,{"data-slot":`git-behind`,className:`shrink-0 font-medium text-inbox-count-foreground`,children:[e.behind,` behind `,n]}),(0,$.jsxs)(`span`,{className:`min-w-0 truncate`,children:[`· `,r]})]}):(0,$.jsxs)(`span`,{className:`min-w-0 truncate`,children:[`up to date · `,r]})})}function KE({checkout:e,returnFocus:t}){return(0,$.jsx)(zi,{open:e.confirmation!==null,onOpenChange:t=>!t&&e.dismissConfirmation(),children:(0,$.jsxs)(fi,{onCloseAutoFocus:e=>{e.preventDefault(),t.current?.focus()},children:[(0,$.jsxs)(Ii,{children:[(0,$.jsxs)(Qr,{children:[`Pull `,e.confirmation?.branch,` anyway?`]}),(0,$.jsx)(qr,{asChild:!0,children:(0,$.jsxs)(`div`,{className:`space-y-2`,children:[e.confirmation?.risks.includes(`active_runs`)?(0,$.jsx)(`p`,{children:`An active session is using this repository. Pulling can change files while it works.`}):null,e.confirmation?.risks.includes(`dirty_tree`)?(0,$.jsx)(`p`,{children:`The checkout has dirty files. Git may refuse the pull to protect them.`}):null]})})]}),(0,$.jsxs)(Ti,{children:[(0,$.jsx)(Ni,{className:`h-11`,disabled:e.pulling,children:`Cancel`}),(0,$.jsx)(Si,{className:`h-11`,disabled:e.pulling||e.confirmation===null,onClick:t=>{t.preventDefault(),e.pull(!0)},children:e.pulling?`Pulling…`:`Pull anyway`})]})]})})}var qE={main:Lt,"not-landed":Hc,cleanup:_c,branches:nn};function JE(e,t){switch(e){case`main`:return t?`Recently on ${t}`:`Recent commits`;case`not-landed`:return`Not landed`;case`cleanup`:return`Cleanup`;case`branches`:return`All branches`;case`changes`:return`Uncommitted changes`}}var YE=[`main`,`not-landed`,`cleanup`,`branches`];function XE({branch:e,counts:t,variant:n,active:r,onNavigate:i}){let a=n===`screen`;return(0,$.jsx)(`nav`,{"aria-label":`Git sections`,"data-slot":`git-sections`,className:a?sa:oa,children:YE.map(n=>{let o=qE[n],s=!a&&r===n,c=t[n];return(0,$.jsxs)(Z,{to:a&&n===`main`?jE:AE[n],"data-git-section":n,"aria-current":s?`page`:void 0,onClick:i,className:U(a?ca:U(fa,`text-[12.5px]`),da,s&&`bg-sidebar-row-selected text-foreground font-medium hover:bg-sidebar-row-selected`),children:[(0,$.jsx)(o,{"aria-hidden":`true`,className:a?va:ma}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:JE(n,e)}),c?(0,$.jsx)(`span`,{"data-slot":`git-section-count`,className:a?pa:la,children:c}):null,a?(0,$.jsx)(S,{"aria-hidden":`true`,className:_a}):null]},n)})})}function ZE({repo:e,info:t}){let n=W(),r=Yi(),i=new Map((r.data?.branches??[]).map(e=>[e.name,e])),a=V(),o=J({mutationFn:e=>it({name:e}),onSuccess:async e=>{L(e.created?`Created and switched to ${e.branch}`:`Switched to ${e.branch}`),await Promise.all([a.invalidateQueries({queryKey:K.repo}),a.invalidateQueries({queryKey:K.health})]),a.setQueryData(K.repo,t=>t?.info?{...t,info:{...t.info,branch:e.branch}}:t),a.setQueryData(K.health,n=>n?.repo?.root===t.root?{...n,repo:{...n.repo,branch:e.branch}}:n)},onError:e=>L(e.message,{tone:`danger`})}),[s,c]=(0,Q.useState)(``),[l,u]=(0,Q.useState)(``),d=l.trim().toLowerCase(),f=rD(e,r.data?.branches),p=d?f.filter(e=>e.toLowerCase().includes(d)):f;return(0,$.jsxs)(`section`,{"data-slot":`repo-branches`,className:`grid min-w-0 grid-cols-1 gap-5 px-[18px] py-[22px] md:grid-cols-[minmax(0,1fr)_290px] md:px-9`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:[(0,$.jsx)(`h2`,{className:`sr-only`,children:`Branches`}),(0,$.jsxs)(`label`,{className:`relative block`,children:[(0,$.jsx)(m,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,$.jsx)(wm,{"aria-label":`Filter branches`,placeholder:`Filter branches…`,value:l,onChange:e=>u(e.target.value),className:`h-11 pl-10`})]}),(0,$.jsxs)(`ul`,{"data-slot":`repo-branch-list`,className:`mt-4 flex min-w-0 flex-col divide-y divide-border border-t border-border md:max-h-[40rem] md:overflow-y-auto md:overscroll-contain`,children:[p.map(e=>{let n=e===t.branch,r=i.get(e);return(0,$.jsxs)(`li`,{"data-slot":`branch-row`,"data-branch":e,"data-branch-class":r?.class,className:`flex min-h-20 flex-col items-start justify-center gap-2 py-3 md:flex-row md:items-center md:justify-start md:py-2.5`,children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-[8px]`,children:[r?.runId?(0,$.jsx)(Z,{to:`/tasks/${r.runId}`,"data-slot":`branch-task-link`,title:r.title?`Open the task ${r.title}`:`Open the task`,className:`min-w-0 truncate rounded-[2px] text-[13px] underline-offset-2 hover:underline focus-visible:outline-2 focus-visible:outline-ring`,children:e}):(0,$.jsx)(`span`,{className:U(`min-w-0 truncate text-[13px]`,n&&`font-normal`),children:e}),r?(0,$.jsx)(nD,{entry:r}):null]}),e.startsWith(`cez/`)&&!n?null:n?(0,$.jsx)(`span`,{"data-slot":`branch-current`,className:`md:ml-auto flex shrink-0 items-center rounded-md bg-accent-strong/10 px-2 py-1.5 text-[12px] font-medium text-accent-text`,children:`Current`}):(0,$.jsxs)(B,{variant:`outline`,size:`sm`,"data-action":`switch-branch`,className:`md:ml-auto h-11`,disabled:o.isPending,onClick:()=>o.mutate(e),children:[(0,$.jsx)(nn,{size:16,"aria-hidden":`true`}),`Switch`]})]},e)}),p.length===0?(0,$.jsxs)(`li`,{"data-slot":`branch-empty`,className:`py-3 text-xs text-soft-foreground`,children:[`No branches match “`,l.trim(),`”.`]}):null]})]}),(0,$.jsxs)(`div`,{className:`min-w-0 self-start rounded-xl border border-border bg-card p-5`,children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold`,children:`Create a branch`}),(0,$.jsxs)(`form`,{"data-slot":`branch-create`,className:`mt-7 flex flex-col items-stretch gap-3`,onSubmit:e=>{e.preventDefault();let t=s.trim();t&&o.mutate(t,{onSuccess:()=>c(``)})},children:[(0,$.jsx)(`label`,{htmlFor:`new-branch-name`,className:`text-sm font-medium`,children:`Branch name`}),(0,$.jsx)(`p`,{className:`-mt-1 text-xs text-muted-foreground`,children:`Create from the selected base.`}),(0,$.jsx)(wm,{id:`new-branch-name`,"aria-label":`New branch name`,placeholder:`new-branch-name`,className:`h-11 bg-background`,value:s,onChange:e=>c(e.target.value)}),(0,$.jsxs)(B,{type:`submit`,variant:`primary`,size:`sm`,className:`min-h-11 self-start`,"data-action":`create-branch`,disabled:!s.trim()||o.isPending,children:[(0,$.jsx)(pn,{size:16,"aria-hidden":`true`}),`Create branch`]})]}),(0,$.jsx)(`p`,{className:`mt-3 border-t border-border pt-4 text-xs leading-relaxed text-muted-foreground`,children:`Switching branches changes your working tree. Review uncommitted changes first.`})]}),n.data?.forge?.available?(0,$.jsx)(QE,{}):null]})}function QE(){let e=ta({limit:20});return(0,$.jsxs)(`div`,{"data-slot":`repo-prs`,className:`max-w-xl`,children:[(0,$.jsx)(`h2`,{className:`text-xs font-semibold tracking-wide text-soft-foreground uppercase`,children:`Open pull requests`}),e.isPending?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`Loading pull requests…`}):e.isError?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:e.error.message}):e.data.available?e.data.prs.length===0?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`No open pull requests.`}):(0,$.jsx)(`ul`,{className:`mt-2 flex flex-col divide-y divide-border`,children:e.data.prs.map(e=>(0,$.jsx)($E,{pr:e},e.number))}):(0,$.jsx)(`p`,{"data-slot":`repo-prs-unavailable`,className:`mt-2 text-xs text-soft-foreground`,children:e.data.reason??`The forge is unreachable right now.`})]})}function $E({pr:e}){let t=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Vt,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,$.jsxs)(`span`,{className:`shrink-0 font-mono text-[11px] text-muted-foreground`,children:[`#`,e.number]}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px]`,children:e.title}),e.checks?(0,$.jsx)(eD,{checks:e.checks}):null]}),n=`flex min-w-0 items-center gap-2 rounded-sm px-1.5 py-2`;return(0,$.jsx)(`li`,{"data-slot":`pr-row`,"data-number":e.number,children:Ln(e.url)?(0,$.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:U(n,`hover:bg-muted`),children:t}):(0,$.jsx)(`span`,{className:n,children:t})})}function eD({checks:e}){return(0,$.jsx)(`span`,{"data-slot":`pr-checks`,"data-checks":e,className:U(`shrink-0 text-[12px] font-medium`,e===`passing`&&`text-success`,e===`failing`&&`text-danger`,e===`pending`&&`text-muted-foreground`),children:e})}var tD={active:`in use`,"not-landed":`not landed`,orphan:`not landed`,merged:`merged`,empty:`empty`,other:`yours`};function nD({entry:e}){return(0,$.jsx)(`span`,{"data-slot":`branch-class`,className:U(`shrink-0 rounded-[4px] border px-[5px] py-[1px] text-[10.5px] leading-[14px]`,e.class===`active`?`border-status-running/40 text-status-running`:e.class===`not-landed`||e.class===`orphan`?`border-inbox-count-foreground/40 text-inbox-count-foreground`:`border-border text-soft-foreground`),children:tD[e.class]})}function rD(e,t){let n=new Set(e.branches);for(let e of t??[])n.add(e.name);return[...n].sort((e,t)=>e.localeCompare(t))}function iD(e,t,n){let r=ri(e),i=Ri(e),a=r.data?.totalBytes??null,o=i.data?.counts??null,s=t&&n===`screen`?zE(t.log):0;return{main:s>0?`${s} today`:null,"not-landed":o?.notLanded?String(o.notLanded):null,cleanup:a?_i(a):r.data&&a===null&&o?.cleanup?String(o.cleanup):null,branches:t?String(rD(t,i.data?.branches).length):null}}function aD({scope:e}){let t=Yr(e),{pathname:n}=l(),r=yw(),i=t.data?.info?t.data:null,a=iD(e,i,`sidebar`);return(0,$.jsxs)(`div`,{"data-slot":`git-sidebar`,role:`region`,"aria-label":`Git`,className:ya,children:[i?.info?(0,$.jsx)(WE,{scope:e,repo:i,info:i.info,variant:`sidebar`,onNavigate:r},e):t.isPending?(0,$.jsx)(`div`,{"data-slot":`git-checkout-placeholder`,"aria-hidden":`true`,className:`h-[94px] rounded-[8px] border border-border`}):null,t.isPending?null:(0,$.jsx)(XE,{branch:i?.info?.branch??null,counts:a,variant:`sidebar`,active:kE(n),onNavigate:r})]})}var oD=[`assigned`,`no-task`,`has-task`,`all`],sD=[`review`,`mine`,`failing`,`all`],cD=1e3,lD=50,uD=`is:open review-requested:@me`,dD=`is:open status:failure`;function fD(e,t){return e===`prs`&&(t===`review`||t===`failing`)}function pD(e){return e===`review`?uD:e===`failing`?dD:null}function mD(e,t){return t===null?null:(e===`issues`?oD:sD).includes(t)?t:`all`}function hD(e,t,n,r=``){let i=`${n===void 0?e===`issues`?`/github`:`/github/prs`:`${e===`issues`?`/github/issues`:`/github/prs`}/${n}`}${r}`;return t===null?i:`${i}?filter=${encodeURIComponent(t)}`}function gD(e,t){let n=t??`all`;return n===`all`?e===`issues`?`all`:`all-prs`:n}function _D(e){return e===`all`?{view:`issues`,filter:`all`}:e===`all-prs`?{view:`prs`,filter:`all`}:{view:e===`review`||e===`mine`||e===`failing`?`prs`:`issues`,filter:e}}var vD=[{id:`assigned`,label:`Assigned to me`},{id:`no-task`,label:`No task yet`},{id:`has-task`,label:`Has a task`},{id:`all`,label:`All open`}],yD=[{id:`review`,label:`Review requested`},{id:`mine`,label:`Mine`},{id:`failing`,label:`Checks failing`},{id:`all-prs`,label:`All open`}],bD=Object.fromEntries([...vD,...yD].map(e=>[e.id,e.label]));function xD(e){return e===null?``:`${e.value}${e.bound===`atLeast`?`+`:``}`}function SD(e,t){if(t?.bound===`atLeast`)return e===`review`||e===`failing`?`At least ${t.value}: GitHub search returns at most ${lD} results.`:`At least ${t.value}: only the first ${cD} open items are loaded.`}var CD=(e,t)=>e!==void 0&&t!==void 0&&e.toLowerCase()===t.toLowerCase();function wD(e){try{let t=new URL(e).pathname.split(`/`).filter(Boolean);return t.length>=2?`${t[0]}/${t[1]}`.toLowerCase():null}catch{return null}}function TD(e,t,n){return new Set(e.filter(e=>!e.archived).flatMap(e=>ED(e,t,n)))}function ED(e,t,n){let r=t?.toLowerCase();return Zi(e,void 0,n).filter(e=>e.kind===`Issue`&&(!e.url||r!==void 0&&wD(e.url)===r)).map(e=>e.number)}function DD(e,t,n,r){let i=new Map;for(let a of e)!vr(a)&&ED(a,n,r).includes(t)&&i.set(a.id,a);return[...i.values()].sort((e,t)=>Date.parse(t.createdAt)-Date.parse(e.createdAt)||e.id.localeCompare(t.id))}function OD(e,t){let n=new Map(t.map(e=>[e.number,e]));return e.map(e=>n.get(e.number)??e)}function kD(e){return e?.available?{value:e.items.length,bound:e.truncated?`atLeast`:`exact`}:null}function AD({gh:e,tasks:t,review:n,failing:r}){let i={assigned:null,"no-task":null,"has-task":null,all:null,review:kD(n),mine:null,failing:kD(r),"all-prs":null};if(!e?.available)return i;let a=e.issues.length>=cD,o=e.prs.length>=cD,s=(e,t)=>({value:e,bound:t?`atLeast`:`exact`}),c=t?e.issues.filter(e=>t.has(e.number)).length:null;return{...i,all:s(e.issues.length,a),"all-prs":s(e.prs.length,o),assigned:e.viewerLogin?s(e.issues.filter(t=>t.assignees?.some(t=>CD(t,e.viewerLogin))).length,a):null,mine:e.viewerLogin?s(e.prs.filter(t=>CD(t.author,e.viewerLogin)).length,o):null,"has-task":c===null?null:s(c,a),"no-task":c===null?null:s(e.issues.length-c,a)}}var jD={assigned:ee,"no-task":ba,"has-task":oe,all:ye,review:Na,mine:Vt,failing:Me,"all-prs":ye};function MD(e,t){return e===`assigned`||e===`mine`?t.identity:e===`no-task`||e===`has-task`?t.tasks:null}function ND({model:e,variant:t,activeId:n,onNavigate:r}){let i=t===`screen`;return(0,$.jsx)($.Fragment,{children:[{key:`issues`,label:`Issues`,rows:vD},{key:`prs`,label:`Pull requests`,rows:yD}].map(t=>(0,$.jsxs)(`nav`,{"aria-label":t.label,"data-slot":`github-filter-group`,"data-group":t.key,className:i?sa:U(ua,t.key===`prs`&&`pt-[6px]`),children:[(0,$.jsx)(`h3`,{className:i?ha:ga,children:t.label}),t.rows.map(({id:t,label:a})=>{let o=jD[t],s=n===t,c=MD(t,e.blocked),l=e.counts[t],u=xD(l),d=U(i?ca:U(fa,`text-[12.5px]`),c?`cursor-not-allowed opacity-60`:da,s&&`bg-sidebar-row-selected text-foreground font-medium hover:bg-sidebar-row-selected`),f=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(o,{"aria-hidden":`true`,className:i?va:ma}),(0,$.jsx)(`span`,{className:`truncate`,children:a}),u?(0,$.jsx)(`span`,{"data-slot":`gh-filter-count`,title:SD(t,l),className:i?pa:la,children:u}):null,i?(0,$.jsx)(S,{"aria-hidden":`true`,className:U(_a,!u&&`ml-auto`)}):null]});if(c)return(0,$.jsxs)(`div`,{"data-gh-filter":t,"aria-disabled":`true`,title:c,className:d,children:[f,(0,$.jsx)(`span`,{className:`sr-only`,children:c})]},t);let{view:p,filter:m}=_D(t);return(0,$.jsx)(Z,{to:hD(p,m),"data-gh-filter":t,"aria-current":s?`page`:void 0,onClick:r,className:d,children:f},t)})]},t.key))})}function PD(e){let t=Fi(e,{limit:cD}).data,n=t?.available===!0,r=vi(e,!0,e==="default"),i=pi(e,`pr`,uD,n),a=pi(e,`pr`,dD,n),o=(0,Q.useMemo)(()=>r.data?TD(r.data,t?.repo,e):null,[r.data,t?.repo,e]);return{gh:t,counts:(0,Q.useMemo)(()=>AD({gh:t,tasks:o,review:i.data,failing:a.data}),[t,o,i.data,a.data]),blocked:{identity:t?.available===!0&&!t.viewerLogin?`GitHub login unavailable.`:null,tasks:r.isError&&!r.data?`Task list unavailable.`:null}}}function FD(e){return/^\/github\/prs(?:\/|$)/.test(_o(e))?`prs`:`issues`}function ID({scope:e}){let t=PD(e),{pathname:n}=l(),[r]=ke(),i=yw(),a=FD(n);return(0,$.jsx)(`div`,{"data-slot":`github-sidebar`,role:`region`,"aria-label":`GitHub`,className:ya,children:(0,$.jsx)(ND,{model:t,variant:`sidebar`,activeId:gD(a,mD(a,r.get(`filter`))),onNavigate:i})})}function LD({projectId:e,projectName:t,capabilities:n}){return(0,$.jsx)(`div`,{"data-slot":`settings-sidebar`,className:ya,children:[`project`,`global`].map(r=>{let i=r===`project`?`This project${t?` · ${t}`:``}`:`Global · every project`,a=r===`project`?`/p/${encodeURIComponent(e)}/settings`:`/settings/global`,o=H_(r,n).map(e=>({id:e.id,title:e.title,icon:e.icon,to:`${a}/${e.id}`})),s=r===`project`?[{id:`general`,title:`General`,icon:R,to:a},...o]:o;return(0,$.jsxs)(`nav`,{"aria-label":i,"data-slot":`settings-nav`,"data-scope":r,className:U(`flex flex-col gap-px`,r===`global`&&`pt-[6px]`),children:[(0,$.jsx)(`h3`,{title:i,className:ga,children:i}),s.map(({id:e,title:t,icon:n,to:r})=>(0,$.jsxs)(Ct,{to:r,end:!0,"data-section":e,className:({isActive:e})=>U(fa,da,e&&`bg-sidebar-row-selected text-foreground font-medium hover:bg-sidebar-row-selected`),children:[(0,$.jsx)(n,{"aria-hidden":`true`,className:ma}),(0,$.jsx)(`span`,{className:`truncate`,children:t})]},e))]},r)})})}function RD(e){let t=e?.repo;if(!t)return null;let n=t.root.replace(/[\\/]+$/,``).split(/[\\/]/).pop();return n?{name:n,branch:t.branch}:null}function zD(e){return e?.available===!0&&(e.status===`available`||e.status===`error`)}function BD({children:e}){let{pathname:t}=l(),n=xo(),r=W(),i=(0,Q.useRef)(void 0);r.data&&(i.current=r.data);let a=r.data??i.current,o=Lw(a),s=r.data?.capabilities.followups===!0,c=r.data?.capabilities.automations===!0,u=mr(s),d=zD(Rr(n??``,n!==null).data),f=oi().data,p=cT(),m=$S(),h=LS(t),g=f?.bootProject??r.data?.bootProject??null,_=n??g??`default`,v=_===g,y=vi(_,!0,v),b=n!==null&&n===g,x=f?.projects.find(e=>e.id===n),S=vi(n??``,x!==void 0&&h.taskId!==null,f?.bootProject===n).data,C=t===`/tools`||t===`/settings/global`||t.startsWith(`/settings/global/`),w=C?null:x?.name??(b?RD(r.data)?.name??null:null),T=h.taskId?S?.find(e=>e.id===h.taskId):void 0,E=T?hr(T):h.pageLabel;OE({projectName:w,pageLabel:E});let D=x?x.forge===`github`:r.data?.forge?.available===!0,O=_o(t),k=/^\/settings(?:\/|$)/.test(O)?(0,$.jsx)(LD,{projectId:_,projectName:f?.projects.find(e=>e.id===_)?.name??(v?RD(r.data)?.name??null:null),capabilities:r.data?.capabilities}):/^\/github(?:\/|$)/.test(O)&&D?(0,$.jsx)(ID,{scope:v?`default`:_}):/^\/git(?:\/|$)/.test(O)?(0,$.jsx)(aD,{scope:v?`default`:_}):void 0;return(0,$.jsxs)(zw,{children:[(0,$.jsx)(Sw,{repo:t===`/tools`?RD(r.data):C?null:x?{name:x.name,branch:x.id===g?r.data?.repo?.branch??``:``}:RD(r.data),breadcrumb:{project:t===`/tools`?`Workspace`:w,page:T?`Tasks / ${E}`:E??`Cezarion`,branch:T?.worktreePath?`Isolated worktree`:void 0},version:a?.version??null,latestVersion:a?.latestVersion??null,applicationUpdate:a?.applicationUpdate,onApplyUpdate:o.apply,onRestart:o.restart,applicationUpdateError:o.error,applicationUpdateBusy:o.busy,applicationUpdateOffline:o.offline||r.isError,inboxCount:u.data?.length??null,skillsUpdateAvailable:d,forgeAvailable:D,inboxAvailable:s,automationsAvailable:c,banner:(0,$.jsx)(Jw,{}),sidebarList:k,taskQuickList:(0,$.jsx)(_E,{projectId:_,boot:v}),sidebarProjectId:_,projectHeader:(0,$.jsx)($_,{}),mobileProjects:p,needsYou:br(y.data??[]).waiting>0,toolsMenu:(0,$.jsx)(CE,{health:r.data}),toolsStatus:r.data?{blocked:bE(r.data)!==null,note:SE(r.data)}:null,projectRail:p?(0,$.jsx)(sT,{...p,projectTarget:m.target,onSwitchProject:e=>void m.go(e),version:a?.version??null}):null,children:e}),(0,$.jsx)(SC,{})]})}function VD(){let e=l(),t=oi();return QS(),(0,Q.useEffect)(()=>{let n=bl(e,t.data);n!==null&&(Sl(hl(),n)||gl(n),Sl(Tl(n.projectId),n)||El(n))},[e.hash,e.pathname,e.search,t.data]),null}function HD(){let e=V(),t=Qg(Tr().data?.notifications).enabled,n=(0,Q.useRef)(t);return n.current=t,(0,Q.useEffect)(()=>{let t=e.getQueryCache(),r=new Map,i=new Map,a=new Map,o=new Set,s=new Map,c=0,l=e=>e.length===3&&typeof e[0]==`string`&&e[1]===`runs`&&e[2]===`list`,u=()=>{let e=new Set([...r.values()].flatMap(e=>[...e.keys()]));for(let t of i.keys())e.has(t)||(i.delete(t),a.delete(t),o.delete(t))},d=(e,t,s=!1,l=1/0)=>{let d=r.get(e),{statuses:f}=e_(new Map,t),p=t.filter(e=>{if((a.get(e.id)??0)>l)return!1;let t=d?.get(e.id),n=f.get(e.id),r=l===1/0?t:i.get(e.id);return t!==void 0&&r!==void 0&&(r.status!==n.status||r.wantsAttention!==n.wantsAttention)}),{entering:m,statuses:h}=e_(i,p);for(let[e,t]of f)!d?.has(e)&&!o.has(e)&&(a.get(e)??0)<=l&&(i.set(e,t),a.set(e,++c));for(let[e,t]of h){let n=i.get(e);n?.status===t.status&&n.wantsAttention===t.wantsAttention||(i.set(e,t),a.set(e,++c),o.add(e))}if(r.set(e,f),u(),!s&&m.length!==0&&t_({enabled:n.current,hidden:document.visibilityState===`hidden`,permission:$g()}))for(let e of m)UD(e)};for(let e of t.getAll().sort((e,t)=>e.state.dataUpdatedAt-t.state.dataUpdatedAt))l(e.queryKey)&&Array.isArray(e.state.data)&&d(e.queryHash,e.state.data,!0);return t.subscribe(e=>{if(l(e.query.queryKey)){if(e.type===`removed`)r.delete(e.query.queryHash),s.delete(e.query.queryHash),u();else if(e.type===`updated`&&(e.action.type===`fetch`&&s.set(e.query.queryHash,c),e.action.type===`success`&&Array.isArray(e.query.state.data))){let t=e.action.manual?1/0:s.get(e.query.queryHash)??0;d(e.query.queryHash,e.query.state.data,!1,t),e.action.manual||s.delete(e.query.queryHash)}}})},[e]),null}function UD(e){let t=globalThis.Notification;if(typeof t!=`function`)return;let n=n_(e);try{new t(n.title,{body:n.body,tag:n.tag})}catch{}}function WD(){let[e]=(0,Q.useState)(dc);return(0,Q.useEffect)(()=>ar(e),[e]),(0,$.jsx)(fc,{children:(0,$.jsx)(ot,{client:e,children:(0,$.jsxs)(sc,{children:[(0,$.jsx)(HD,{}),(0,$.jsx)(Rg,{children:(0,$.jsx)(wg,{children:(0,$.jsxs)(Dt,{children:[(0,$.jsx)(VD,{}),(0,$.jsx)(kv,{children:(0,$.jsx)(BD,{children:(0,$.jsx)(BS,{})})}),(0,$.jsx)(fn,{})]})})})]})})})}function GD(){return(document.querySelector(`meta[name="cez-api-base"]`)?.getAttribute(`content`))?.trim()||``}Fn(GD());var KD=document.getElementById(`root`);if(!KD)throw Error(`cezar: #root container is missing from index.html`);(0,Ts.createRoot)(KD).render((0,$.jsx)(Q.StrictMode,{children:(0,$.jsx)(WD,{})}));export{fy as $,Zc as $t,WT as A,em as At,mx as B,ip as Bt,HE as C,Km as Ct,VE as D,zm as Dt,BE as E,Hm as Et,BC as F,Bp as Ft,My as G,Vf as Gt,hx as H,tp as Ht,UC as I,Rp as It,wy as J,Ol as Jt,ky as K,zf as Kt,VC as L,Lp as Lt,rw as M,$p as Mt,ew as N,Zp as Nt,RE as O,Rm as Ot,FC as P,Xp as Pt,ay as Q,nl as Qt,HC as R,kp as Rt,KE as S,qm as St,AE as T,Um as Tt,By as U,Uf as Ut,gx as V,ap as Vt,Ay as W,Hf as Wt,dy as X,ol as Xt,Cy as Y,fl as Yt,gy as Z,al as Zt,ZE as _,vh as _t,cD as a,Sc as an,py as at,JE as b,Zm as bt,uD as c,yc as cn,Yv as ct,TD as d,Ev as dt,Xc as en,sy as et,DD as f,Tv as ft,iD as g,Xg as gt,pD as h,yv as ht,dD as i,kc as in,uy as it,tw as j,Qp as jt,NE as k,wm as kt,hD as l,_c as ln,jv as lt,OD as m,Cv as mt,ND as n,Hc as nn,my as nt,vD as o,xc as on,ry as ot,mD as p,wv as pt,jy as q,kl as qt,bD as r,Pc as rn,_y as rt,yD as s,bc as sn,Bv as st,PD as t,qc as tn,oy as tt,fD as u,pc as un,Nv as ut,rD as v,_h as vt,jE as w,Wm as wt,WE as x,Jm as xt,XE as y,Xm as yt,Ix as z,yp as zt};
|