@open-mercato/cezar 0.19.0-pr1908.4332 → 0.19.0-pr1908.4707
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/dist/agent-config/account-identity.js +3 -0
- package/dist/agent-config/account-identity.js.map +1 -1
- package/dist/agent-config/catalog.d.ts +7 -1
- package/dist/agent-config/catalog.js +174 -4
- package/dist/agent-config/catalog.js.map +1 -1
- package/dist/agent-config/model-settings/gemini.d.ts +8 -0
- package/dist/agent-config/model-settings/gemini.js +16 -0
- package/dist/agent-config/model-settings/gemini.js.map +1 -0
- package/dist/agent-config/model-settings/kimi.d.ts +7 -0
- package/dist/agent-config/model-settings/kimi.js +13 -0
- package/dist/agent-config/model-settings/kimi.js.map +1 -0
- package/dist/agent-config/model-settings/omp.d.ts +11 -0
- package/dist/agent-config/model-settings/omp.js +17 -0
- package/dist/agent-config/model-settings/omp.js.map +1 -0
- package/dist/agent-config/model-settings/shared.d.ts +6 -0
- package/dist/agent-config/model-settings/shared.js +17 -3
- package/dist/agent-config/model-settings/shared.js.map +1 -1
- package/dist/agent-config/models.js +6 -0
- package/dist/agent-config/models.js.map +1 -1
- package/dist/agent-config/validate.js +15 -0
- package/dist/agent-config/validate.js.map +1 -1
- package/dist/automations/automation-cli.d.ts +2 -0
- package/dist/automations/automation-cli.js +82 -2
- package/dist/automations/automation-cli.js.map +1 -1
- package/dist/automations/deferred-start.d.ts +5 -4
- package/dist/automations/deferred-start.js +5 -1
- package/dist/automations/deferred-start.js.map +1 -1
- package/dist/automations/paused-work.d.ts +24 -0
- package/dist/automations/paused-work.js +61 -0
- package/dist/automations/paused-work.js.map +1 -0
- package/dist/automations/pr-head.d.ts +3 -0
- package/dist/automations/pr-head.js +8 -4
- package/dist/automations/pr-head.js.map +1 -1
- package/dist/automations/prompts.js +1 -0
- package/dist/automations/prompts.js.map +1 -1
- package/dist/automations/store.d.ts +16 -0
- package/dist/automations/store.js +44 -0
- package/dist/automations/store.js.map +1 -1
- package/dist/automations/task-template.js +1 -0
- package/dist/automations/task-template.js.map +1 -1
- package/dist/automations/templates.js +1 -0
- package/dist/automations/templates.js.map +1 -1
- package/dist/automations/types.d.ts +24 -0
- package/dist/automations/types.js +2 -0
- package/dist/automations/types.js.map +1 -1
- package/dist/automations/validate-input.d.ts +188 -0
- package/dist/automations/validate-input.js +85 -0
- package/dist/automations/validate-input.js.map +1 -0
- package/dist/config.d.ts +12 -5
- package/dist/config.js +4 -12
- package/dist/config.js.map +1 -1
- package/dist/contract/agent-config.d.ts +9 -0
- package/dist/contract/agent-profiles.d.ts +74 -20
- package/dist/contract/agent.d.ts +12 -0
- package/dist/contract/artifacts.d.ts +138 -0
- package/dist/contract/assets.d.ts +83 -0
- package/dist/contract/automations.d.ts +158 -0
- package/dist/contract/dashboard-costs.d.ts +2 -0
- package/dist/contract/dashboard.d.ts +8 -0
- package/dist/contract/deferred-start.d.ts +33 -0
- package/dist/contract/dispatch.d.ts +9 -0
- package/dist/contract/events.d.ts +6 -0
- package/dist/contract/github.d.ts +13 -0
- package/dist/contract/health.d.ts +12 -0
- package/dist/contract/impact.d.ts +134 -0
- package/dist/contract/index.d.ts +6 -0
- package/dist/contract/index.js +2955 -2547
- package/dist/contract/managers.d.ts +79 -0
- package/dist/contract/runners.d.ts +15 -0
- package/dist/contract/runs.d.ts +292 -0
- package/dist/contract/skills.d.ts +67 -0
- package/dist/contract/telemetry.d.ts +5 -1
- package/dist/contract/transfer.d.ts +1932 -0
- package/dist/contract/workflows.d.ts +87 -0
- package/dist/contract/workspace-layouts.d.ts +6 -0
- package/dist/contract/workspace.d.ts +111 -37
- package/dist/core/agent-env.js +43 -1
- package/dist/core/agent-env.js.map +1 -1
- package/dist/core/agent-errors.d.ts +3 -0
- package/dist/core/agent-errors.js +13 -0
- package/dist/core/agent-errors.js.map +1 -1
- package/dist/core/agent-model-policy.d.ts +1 -1
- package/dist/core/agent-model-policy.js +1 -1
- package/dist/core/agent-model-policy.js.map +1 -1
- package/dist/core/agent-profiles.d.ts +19 -3
- package/dist/core/agent-profiles.js +27 -3
- package/dist/core/agent-profiles.js.map +1 -1
- package/dist/core/agent-runner.d.ts +44 -10
- package/dist/core/agent-runner.js +21 -7
- package/dist/core/agent-runner.js.map +1 -1
- package/dist/core/antigravity-runner.js +2 -1
- package/dist/core/antigravity-runner.js.map +1 -1
- package/dist/core/backend-detect.d.ts +3 -2
- package/dist/core/backend-detect.js +80 -1
- package/dist/core/backend-detect.js.map +1 -1
- package/dist/core/claude-cli-runner.js +30 -3
- package/dist/core/claude-cli-runner.js.map +1 -1
- package/dist/core/claude-model-catalog.d.ts +6 -1
- package/dist/core/claude-model-catalog.js +20 -0
- package/dist/core/claude-model-catalog.js.map +1 -1
- package/dist/core/claude-usage-status.d.ts +8 -0
- package/dist/core/claude-usage-status.js +48 -0
- package/dist/core/claude-usage-status.js.map +1 -0
- package/dist/core/codex-app-server-runner.d.ts +8 -0
- package/dist/core/codex-app-server-runner.js +84 -13
- package/dist/core/codex-app-server-runner.js.map +1 -1
- package/dist/core/codex-model-catalog.js +42 -0
- package/dist/core/codex-model-catalog.js.map +1 -1
- package/dist/core/codex-ui-mapper.d.ts +7 -0
- package/dist/core/codex-ui-mapper.js +12 -2
- package/dist/core/codex-ui-mapper.js.map +1 -1
- package/dist/core/copilot-acp-runner.js +5 -1
- package/dist/core/copilot-acp-runner.js.map +1 -1
- package/dist/core/cursor-agent-runner.js +5 -1
- package/dist/core/cursor-agent-runner.js.map +1 -1
- package/dist/core/gemini-acp-runner.d.ts +37 -0
- package/dist/core/gemini-acp-runner.js +537 -0
- package/dist/core/gemini-acp-runner.js.map +1 -0
- package/dist/core/gemini-credentials.d.ts +21 -0
- package/dist/core/gemini-credentials.js +80 -0
- package/dist/core/gemini-credentials.js.map +1 -0
- package/dist/core/gemini-sessions.d.ts +18 -0
- package/dist/core/gemini-sessions.js +41 -0
- package/dist/core/gemini-sessions.js.map +1 -0
- package/dist/core/gemini-ui-mapper.d.ts +30 -0
- package/dist/core/gemini-ui-mapper.js +80 -0
- package/dist/core/gemini-ui-mapper.js.map +1 -0
- package/dist/core/junie-runner.js +2 -1
- package/dist/core/junie-runner.js.map +1 -1
- package/dist/core/kimi-home.d.ts +7 -0
- package/dist/core/kimi-home.js +13 -0
- package/dist/core/kimi-home.js.map +1 -0
- package/dist/core/kimi-model-catalog.d.ts +17 -0
- package/dist/core/kimi-model-catalog.js +45 -0
- package/dist/core/kimi-model-catalog.js.map +1 -0
- package/dist/core/kimi-runner.d.ts +90 -0
- package/dist/core/kimi-runner.js +874 -0
- package/dist/core/kimi-runner.js.map +1 -0
- package/dist/core/kimi-ui-mapper.d.ts +71 -0
- package/dist/core/kimi-ui-mapper.js +399 -0
- package/dist/core/kimi-ui-mapper.js.map +1 -0
- package/dist/core/model-identity.js +11 -0
- package/dist/core/model-identity.js.map +1 -1
- package/dist/core/model-presets.js +10 -0
- package/dist/core/model-presets.js.map +1 -1
- package/dist/core/omp-rpc-runner.d.ts +41 -0
- package/dist/core/omp-rpc-runner.js +451 -0
- package/dist/core/omp-rpc-runner.js.map +1 -0
- package/dist/core/omp-ui-mapper.d.ts +56 -0
- package/dist/core/omp-ui-mapper.js +468 -0
- package/dist/core/omp-ui-mapper.js.map +1 -0
- package/dist/core/opencode-http.d.ts +2 -0
- package/dist/core/opencode-http.js +2 -2
- package/dist/core/opencode-http.js.map +1 -1
- package/dist/core/opencode-server-runner.d.ts +3 -1
- package/dist/core/opencode-server-runner.js +197 -25
- package/dist/core/opencode-server-runner.js.map +1 -1
- package/dist/core/opencode-v2-events.d.ts +11 -0
- package/dist/core/opencode-v2-events.js +105 -0
- package/dist/core/opencode-v2-events.js.map +1 -0
- package/dist/core/pi-runner.js +5 -1
- package/dist/core/pi-runner.js.map +1 -1
- package/dist/core/private-mcp.d.ts +1 -1
- package/dist/core/private-mcp.js +2 -2
- package/dist/core/private-mcp.js.map +1 -1
- package/dist/core/process-signals.d.ts +29 -0
- package/dist/core/process-signals.js +85 -0
- package/dist/core/process-signals.js.map +1 -0
- package/dist/core/provider-auth.d.ts +25 -2
- package/dist/core/provider-auth.js +132 -12
- package/dist/core/provider-auth.js.map +1 -1
- package/dist/core/runner-factory.d.ts +1 -0
- package/dist/core/runner-factory.js +38 -1
- package/dist/core/runner-factory.js.map +1 -1
- package/dist/core/runner-model-catalog.d.ts +8 -0
- package/dist/core/runner-model-catalog.js +3 -0
- package/dist/core/runner-model-catalog.js.map +1 -1
- package/dist/core/tool-display.js +2 -0
- package/dist/core/tool-display.js.map +1 -1
- package/dist/core/ui-events.d.ts +1 -1
- package/dist/core/usage-limit.d.ts +2 -2
- package/dist/core/usage-limit.js +5 -3
- package/dist/core/usage-limit.js.map +1 -1
- package/dist/data-gitignore.d.ts +1 -1
- package/dist/data-gitignore.js +1 -0
- package/dist/data-gitignore.js.map +1 -1
- package/dist/dispatch/engine.d.ts +4 -0
- package/dist/dispatch/engine.js +9 -0
- package/dist/dispatch/engine.js.map +1 -1
- package/dist/e2e-setup.d.ts +8 -3
- package/dist/e2e-setup.js +31 -16
- package/dist/e2e-setup.js.map +1 -1
- package/dist/handoff.d.ts +2 -2
- package/dist/handoff.js +5 -5
- package/dist/handoff.js.map +1 -1
- package/dist/impact/demo-review.json +781 -0
- package/dist/impact/diff.d.ts +21 -0
- package/dist/impact/diff.js +81 -0
- package/dist/impact/diff.js.map +1 -0
- package/dist/impact/evidence.d.ts +67 -0
- package/dist/impact/evidence.js +238 -0
- package/dist/impact/evidence.js.map +1 -0
- package/dist/impact/impact-cli.d.ts +12 -0
- package/dist/impact/impact-cli.js +141 -0
- package/dist/impact/impact-cli.js.map +1 -0
- package/dist/impact/launch.d.ts +46 -0
- package/dist/impact/launch.js +145 -0
- package/dist/impact/launch.js.map +1 -0
- package/dist/impact/model.d.ts +551 -0
- package/dist/impact/model.js +188 -0
- package/dist/impact/model.js.map +1 -0
- package/dist/impact/publish.d.ts +30 -0
- package/dist/impact/publish.js +119 -0
- package/dist/impact/publish.js.map +1 -0
- package/dist/impact/render.d.ts +41 -0
- package/dist/impact/render.js +109 -0
- package/dist/impact/render.js.map +1 -0
- package/dist/impact/template.html +670 -0
- package/dist/impact/validate.d.ts +25 -0
- package/dist/impact/validate.js +273 -0
- package/dist/impact/validate.js.map +1 -0
- package/dist/index.js +19 -4
- package/dist/index.js.map +1 -1
- package/dist/managers/engine.js +5 -2
- package/dist/managers/engine.js.map +1 -1
- package/dist/pack-check.d.ts +1 -0
- package/dist/pack-check.js +14 -0
- package/dist/pack-check.js.map +1 -1
- package/dist/paths.d.ts +6 -0
- package/dist/paths.js +19 -1
- package/dist/paths.js.map +1 -1
- package/dist/runs/agent-error-telemetry.js +7 -4
- package/dist/runs/agent-error-telemetry.js.map +1 -1
- package/dist/runs/agent-tmpdir.d.ts +25 -6
- package/dist/runs/agent-tmpdir.js +136 -25
- package/dist/runs/agent-tmpdir.js.map +1 -1
- package/dist/runs/artifacts.d.ts +52 -0
- package/dist/runs/artifacts.js +243 -0
- package/dist/runs/artifacts.js.map +1 -0
- package/dist/runs/event-history.d.ts +12 -0
- package/dist/runs/event-history.js +61 -0
- package/dist/runs/event-history.js.map +1 -1
- package/dist/runs/project-assets.d.ts +9 -0
- package/dist/runs/project-assets.js +57 -0
- package/dist/runs/project-assets.js.map +1 -0
- package/dist/runs/review-gate.d.ts +10 -0
- package/dist/runs/review-gate.js +12 -0
- package/dist/runs/review-gate.js.map +1 -1
- package/dist/runs/store.d.ts +70 -4
- package/dist/runs/store.js +139 -26
- package/dist/runs/store.js.map +1 -1
- package/dist/server/agent-setup.d.ts +1 -1
- package/dist/server/agent-setup.js +2 -1
- package/dist/server/agent-setup.js.map +1 -1
- package/dist/server/artifacts.d.ts +33 -0
- package/dist/server/artifacts.js +133 -0
- package/dist/server/artifacts.js.map +1 -0
- package/dist/server/dashboard.d.ts +5 -0
- package/dist/server/forge/github-assets.d.ts +7 -0
- package/dist/server/forge/github-assets.js +100 -0
- package/dist/server/forge/github-assets.js.map +1 -0
- package/dist/server/forge/github.d.ts +11 -0
- package/dist/server/forge/github.js +42 -0
- package/dist/server/forge/github.js.map +1 -1
- package/dist/server/open-in-app.js +3 -0
- package/dist/server/open-in-app.js.map +1 -1
- package/dist/server/provider-action-gate.js +12 -4
- package/dist/server/provider-action-gate.js.map +1 -1
- package/dist/server/server.d.ts +10012 -6701
- package/dist/server/server.js +353 -193
- package/dist/server/server.js.map +1 -1
- package/dist/server/star-count.d.ts +5 -5
- package/dist/server/star-count.js +5 -5
- package/dist/server/star-count.js.map +1 -1
- package/dist/server-install/steps.js +1 -0
- package/dist/server-install/steps.js.map +1 -1
- package/dist/skills-provision.js +7 -1
- package/dist/skills-provision.js.map +1 -1
- package/dist/skills.d.ts +10 -6
- package/dist/skills.js +11 -6
- package/dist/skills.js.map +1 -1
- package/dist/transfer/automations-file.d.ts +46 -0
- package/dist/transfer/automations-file.js +172 -0
- package/dist/transfer/automations-file.js.map +1 -0
- package/dist/transfer/config-bundle.d.ts +100 -0
- package/dist/transfer/config-bundle.js +430 -0
- package/dist/transfer/config-bundle.js.map +1 -0
- package/dist/webhooks/outbox.js +83 -63
- package/dist/webhooks/outbox.js.map +1 -1
- package/dist/workflows/graph.d.ts +27 -0
- package/dist/workflows/load.js +2 -2
- package/dist/workflows/load.js.map +1 -1
- package/dist/workflows/resume-fallback.d.ts +13 -6
- package/dist/workflows/resume-fallback.js +26 -6
- package/dist/workflows/resume-fallback.js.map +1 -1
- package/dist/workflows/run.d.ts +121 -10
- package/dist/workflows/run.js +363 -61
- package/dist/workflows/run.js.map +1 -1
- package/dist/workflows/templates.d.ts +27 -16
- package/dist/workflows/templates.js +17 -0
- package/dist/workflows/templates.js.map +1 -1
- package/dist/workflows/types.d.ts +21 -0
- package/dist/workflows/types.js +3 -1
- package/dist/workflows/types.js.map +1 -1
- package/dist/workspace/agent-accounts.d.ts +27 -15
- package/dist/workspace/agent-accounts.js +4 -14
- package/dist/workspace/agent-accounts.js.map +1 -1
- package/dist/workspace/agent-profiles.js +3 -0
- package/dist/workspace/agent-profiles.js.map +1 -1
- package/dist/workspace/config.d.ts +12 -6
- package/dist/workspace/config.js +3 -13
- package/dist/workspace/config.js.map +1 -1
- package/dist/workspace/dashboard-costs.d.ts +1 -0
- package/dist/workspace/dashboard-costs.js +1 -0
- package/dist/workspace/dashboard-costs.js.map +1 -1
- package/dist/workspace/dashboard-insights.d.ts +1 -0
- package/dist/workspace/dashboard-insights.js +5 -2
- package/dist/workspace/dashboard-insights.js.map +1 -1
- package/dist/workspace/dashboard-overview.js +2 -0
- package/dist/workspace/dashboard-overview.js.map +1 -1
- package/dist/workspace/dashboard.d.ts +1 -0
- package/package.json +5 -4
- package/scripts/check-pack.mjs +3 -2
- package/scripts/copy-assets.mjs +17 -0
- package/scripts/mock-claude.mjs +106 -1
- package/scripts/mock-gemini-acp.mjs +195 -0
- package/scripts/mock-kimi-acp.mjs +126 -0
- package/scripts/mock-omp-rpc.mjs +194 -0
- package/skills/change-impact/SKILL.md +117 -0
- package/skills/change-impact/references/analysis-contract.md +141 -0
- package/skills/change-impact/references/public-api.md +92 -0
- package/skills/change-impact/references/visual-contract.md +71 -0
- package/web/dist/assets/{active-forge-DEmP_h4r.js → active-forge-DO2AaQ-s.js} +1 -1
- package/web/dist/assets/agent-task-pickers-CZpw4vcZ.js +1 -0
- package/web/dist/assets/{alert-dialog-BZkKvKiu.js → alert-dialog-BihfE0uZ.js} +1 -1
- package/web/dist/assets/arrow-down-DACdHKjc.js +1 -0
- package/web/dist/assets/arrow-left-BtT8zuL0.js +1 -0
- package/web/dist/assets/arrow-up-BAPSgozC.js +1 -0
- package/web/dist/assets/ask-answer-Co3javaA.js +1 -0
- package/web/dist/assets/{ask-card-CfNUHYt9.js → ask-card-DLtNyMH_.js} +2 -2
- package/web/dist/assets/assets-view-CLCckPll.js +1 -0
- package/web/dist/assets/{automation-format-BPrWgGBz.js → automation-format-BXwiLf2G.js} +1 -1
- package/web/dist/assets/automations-route-JizzZrRf.js +1 -0
- package/web/dist/assets/blink-1oEUjxch.webp +0 -0
- package/web/dist/assets/blink-B4Y4PYCR.webp +0 -0
- package/web/dist/assets/blink-BpqW08tf.webp +0 -0
- package/web/dist/assets/blink-C380t2a5.webp +0 -0
- package/web/dist/assets/blink-CLn5VMYQ.webp +0 -0
- package/web/dist/assets/blink-Cn_tI5Yd.webp +0 -0
- package/web/dist/assets/blink-D4EaTnc2.webp +0 -0
- package/web/dist/assets/blink-DY4Sm5aw.webp +0 -0
- package/web/dist/assets/blink-mcM10OfP.webp +0 -0
- package/web/dist/assets/body-CXEwT_gR.webp +0 -0
- package/web/dist/assets/body-D-UrLURv.webp +0 -0
- package/web/dist/assets/body-D7Q8eJDv.webp +0 -0
- package/web/dist/assets/body-DdNSx4-d.webp +0 -0
- package/web/dist/assets/body-DlFNtp32.webp +0 -0
- package/web/dist/assets/body-EreQeu3g.webp +0 -0
- package/web/dist/assets/body-Goc64z5o.webp +0 -0
- package/web/dist/assets/body-_FLmHm_q.webp +0 -0
- package/web/dist/assets/body-v5xTmq5E.webp +0 -0
- package/web/dist/assets/{bot-qZRkHkDp.js → bot-Cm-PLA1M.js} +1 -1
- package/web/dist/assets/{button-BrxohNcK.js → button-BqkA8Ovk.js} +1 -1
- package/web/dist/assets/{centered-state-CSW_o4N7.js → centered-state-CquGIOsq.js} +1 -1
- package/web/dist/assets/check-B1z-_MCO.js +1 -0
- package/web/dist/assets/chevron-left-CDAxCC2p.js +1 -0
- package/web/dist/assets/chevron-right-DPaV033p.js +1 -0
- package/web/dist/assets/chunk-KS7C4IRE-DtL2Gzw3.js +3 -0
- package/web/dist/assets/{circle-alert-COKQc-87.js → circle-alert-B7VNkPC2.js} +1 -1
- package/web/dist/assets/circle-check-LWKCYKhA.js +1 -0
- package/web/dist/assets/{collapsible-BJ0sxcz9.js → collapsible-BuSDxSYs.js} +1 -1
- package/web/dist/assets/command-CfdVVS0V.js +1 -0
- package/web/dist/assets/{commit-list-HXZj01RO.js → commit-list-D5Nuv2HC.js} +1 -1
- package/web/dist/assets/compare-variants-BBOnUKfp.js +1 -0
- package/web/dist/assets/composer-BPIW4tmM.js +18 -0
- package/web/dist/assets/composer-attachments-DyC9yyGs.js +3 -0
- package/web/dist/assets/concerned-BIuYysOA.webp +0 -0
- package/web/dist/assets/concerned-BWTrkjRS.webp +0 -0
- package/web/dist/assets/concerned-BW_ywmzK.webp +0 -0
- package/web/dist/assets/concerned-CXQVACqJ.webp +0 -0
- package/web/dist/assets/concerned-DdsJa1t2.webp +0 -0
- package/web/dist/assets/concerned-Dlln-1nu.webp +0 -0
- package/web/dist/assets/concerned-DrSCYUQV.webp +0 -0
- package/web/dist/assets/concerned-TOjmS1qX.webp +0 -0
- package/web/dist/assets/concerned-tIx9dV3J.webp +0 -0
- package/web/dist/assets/dashboard-B_ytEQ_y.js +44 -0
- package/web/dist/assets/diff-BQScRHXz.js +3 -0
- package/web/dist/assets/diff-stat-CxDTnfya.js +1 -0
- package/web/dist/assets/diff-view-8m9Rnct7.js +13 -0
- package/web/dist/assets/{directional-usage-BtjgT5nc.js → directional-usage-BerE4wJK.js} +1 -1
- package/web/dist/assets/dist-Br4Ra_c5.js +1 -0
- package/web/dist/assets/{download-DH68Y5Vz.js → download-HBguClwD.js} +1 -1
- package/web/dist/assets/dropdown-menu-CDv5Teql.js +1 -0
- package/web/dist/assets/excited-8dK2gfAF.webp +0 -0
- package/web/dist/assets/excited-B-w6ozXs.webp +0 -0
- package/web/dist/assets/excited-B4Sch7Ub.webp +0 -0
- package/web/dist/assets/excited-BPQk8ECE.webp +0 -0
- package/web/dist/assets/excited-BRFi0cue.webp +0 -0
- package/web/dist/assets/excited-BvbUAHvw.webp +0 -0
- package/web/dist/assets/excited-CCH-VUDr.webp +0 -0
- package/web/dist/assets/excited-TMExhEMj.webp +0 -0
- package/web/dist/assets/excited-cSRbau5J.webp +0 -0
- package/web/dist/assets/{external-link-BVYdhpSK.js → external-link-Bclznsu3.js} +1 -1
- package/web/dist/assets/file-preview-DQ7iQhe0.js +2 -0
- package/web/dist/assets/{file-DYpKJvYs.js → file-rCLi_p-R.js} +1 -1
- package/web/dist/assets/file-tree-Bm38qEZP.js +1 -0
- package/web/dist/assets/focused-XMnI1Trp.webp +0 -0
- package/web/dist/assets/{folder-CeFUSrsO.js → folder-leteY9jH.js} +1 -1
- package/web/dist/assets/follow-up-engine-Q1EcpRpB.js +1 -0
- package/web/dist/assets/git-pull-request-CURFMFaU.js +1 -0
- package/web/dist/assets/{git-pull-request-draft-DL1VMp1L.js → git-pull-request-draft-BZgJrUou.js} +1 -1
- package/web/dist/assets/git-tab-loading-CF0flOMS.js +1 -0
- package/web/dist/assets/github-DcvXvc4J.js +1 -0
- package/web/dist/assets/happy-B7LJPne_.webp +0 -0
- package/web/dist/assets/happy-CCpAho8w.webp +0 -0
- package/web/dist/assets/happy-Ch9wxHii.webp +0 -0
- package/web/dist/assets/happy-CnoCjXOf.webp +0 -0
- package/web/dist/assets/happy-DVeEwiyo.webp +0 -0
- package/web/dist/assets/happy-URIT6hFl.webp +0 -0
- package/web/dist/assets/happy-ZufSdCLm.webp +0 -0
- package/web/dist/assets/happy-kfLwwDLp.webp +0 -0
- package/web/dist/assets/happy-nVffy2Sx.webp +0 -0
- package/web/dist/assets/{host-usage-o1rC0TiP.js → host-usage-CX8OXl8q.js} +1 -1
- package/web/dist/assets/icon-tooltip-BMkyRHLt.js +1 -0
- package/web/dist/assets/impact-control-Deh1F44q.js +1 -0
- package/web/dist/assets/impact-model-Dj6tIycu.js +1 -0
- package/web/dist/assets/index-DuW72uFI.js +33 -0
- package/web/dist/assets/index-jRkTI5kE.css +2 -0
- package/web/dist/assets/{input-BxjGaO_P.js → input-BO795Un9.js} +1 -1
- package/web/dist/assets/laptop-D2EKUOdE.webp +0 -0
- package/web/dist/assets/layers-YoqiEcNh.js +1 -0
- package/web/dist/assets/layout-cards-Cvq2XaJL.js +1 -0
- package/web/dist/assets/{layout-grid-C4d5rrDE.js → layout-grid-CSvbdC6i.js} +1 -1
- package/web/dist/assets/left-BBmAC9hS.webp +0 -0
- package/web/dist/assets/left-BUX98ijg.webp +0 -0
- package/web/dist/assets/left-CCrTs359.webp +0 -0
- package/web/dist/assets/left-CxWtAZHp.webp +0 -0
- package/web/dist/assets/left-DDCoVDRG.webp +0 -0
- package/web/dist/assets/left-DFGwPnRL.webp +0 -0
- package/web/dist/assets/left-D_qxT7z_.webp +0 -0
- package/web/dist/assets/left-QXVHT2zO.webp +0 -0
- package/web/dist/assets/left-S_rwAL-X.webp +0 -0
- package/web/dist/assets/leg-left-0EW5L4pu.webp +0 -0
- package/web/dist/assets/leg-left-BGo9dZbQ.webp +0 -0
- package/web/dist/assets/leg-left-BZ8ETYLj.webp +0 -0
- package/web/dist/assets/leg-left-BahG1x_b.webp +0 -0
- package/web/dist/assets/leg-left-C-DJQ3Pt.webp +0 -0
- package/web/dist/assets/leg-left-C6ZvH8fW.webp +0 -0
- package/web/dist/assets/leg-left-DsfFyCf7.webp +0 -0
- package/web/dist/assets/leg-left-Iq6VC-OZ.webp +0 -0
- package/web/dist/assets/leg-left-rVU9cV-d.webp +0 -0
- package/web/dist/assets/leg-right-2MnCGKHj.webp +0 -0
- package/web/dist/assets/leg-right-BCgv_Tjj.webp +0 -0
- package/web/dist/assets/leg-right-BOxKTHZ9.webp +0 -0
- package/web/dist/assets/leg-right-BeDSbUV7.webp +0 -0
- package/web/dist/assets/leg-right-BwrF93s6.webp +0 -0
- package/web/dist/assets/leg-right-CU-y_n5h.webp +0 -0
- package/web/dist/assets/leg-right-DKSfNi2y.webp +0 -0
- package/web/dist/assets/leg-right-Dq0ze2e4.webp +0 -0
- package/web/dist/assets/leg-right-t34e1CvD.webp +0 -0
- package/web/dist/assets/lib-BQXq3kEf.js +1 -0
- package/web/dist/assets/loader-circle-DjzuGw6j.js +1 -0
- package/web/dist/assets/manager-chat-C4QqN-w6.js +1 -0
- package/web/dist/assets/manager-index-BGNDfiIy.js +1 -0
- package/web/dist/assets/manager-new-Dek6H9Bg.js +2 -0
- package/web/dist/assets/managers-Dufza9IX.js +1 -0
- package/web/dist/assets/{markdown-Di8pirEb.js → markdown-CP2EQDsL.js} +1 -1
- package/web/dist/assets/{markdown-rDA5iFAU.js → markdown-YWy3FUHK.js} +2 -2
- package/web/dist/assets/mascot-picker-0_LGzV_f.js +1 -0
- package/web/dist/assets/{message-square-CstvkIHe.js → message-square-beq8DjLH.js} +1 -1
- package/web/dist/assets/new-task-form-BgMiEphZ.js +2 -0
- package/web/dist/assets/pencil-RUM53auZ.js +1 -0
- package/web/dist/assets/picker-pill-BO6YUs1F.js +1 -0
- package/web/dist/assets/play-Cj3p2Q5t.js +1 -0
- package/web/dist/assets/plus-Bdmhj8CR.js +1 -0
- package/web/dist/assets/portrait-BJ2e30PF.webp +0 -0
- package/web/dist/assets/portrait-BeDbYw8Z.webp +0 -0
- package/web/dist/assets/portrait-Bq7D7LzX.webp +0 -0
- package/web/dist/assets/portrait-C6HtaggP.webp +0 -0
- package/web/dist/assets/portrait-CcOzDXGs.webp +0 -0
- package/web/dist/assets/portrait-D44z6yep.webp +0 -0
- package/web/dist/assets/portrait-DHLQRy13.webp +0 -0
- package/web/dist/assets/portrait-DU3qlTxc.webp +0 -0
- package/web/dist/assets/portrait-q94U_uD6.webp +0 -0
- package/web/dist/assets/project-router-xmadY-N9.js +1 -0
- package/web/dist/assets/queries-ba5qZ3kd.js +1 -0
- package/web/dist/assets/reasoning-effort-pill-B8Z1RaXL.js +1 -0
- package/web/dist/assets/reference-chip-C9pVQk05.js +1 -0
- package/web/dist/assets/reference-conflict-action-DxUm18aD.js +1 -0
- package/web/dist/assets/repo-git-DFf8ZGZv.js +1 -0
- package/web/dist/assets/right-BFOa1Ihi.webp +0 -0
- package/web/dist/assets/right-BLsBZrK1.webp +0 -0
- package/web/dist/assets/right-BVU3rYuj.webp +0 -0
- package/web/dist/assets/right-BbES4jIG.webp +0 -0
- package/web/dist/assets/right-C2klSA-G.webp +0 -0
- package/web/dist/assets/right-Cte2BTL5.webp +0 -0
- package/web/dist/assets/right-Dz7jYN17.webp +0 -0
- package/web/dist/assets/right-W2oGaUHb.webp +0 -0
- package/web/dist/assets/right-XJjUU0AU.webp +0 -0
- package/web/dist/assets/run-actions-CLIUiXwS.js +1 -0
- package/web/dist/assets/{run-diff-CFHlmgGA.js → run-diff-CxS_a1EO.js} +2 -2
- package/web/dist/assets/{save-C4TDysfG.js → save-zfKVAo2Y.js} +1 -1
- package/web/dist/assets/{scroll-within-D3mqUngk.js → scroll-within-DhWf-4MN.js} +1 -1
- package/web/dist/assets/search-CCE2KMtX.js +1 -0
- package/web/dist/assets/{search-x-BkezzsKh.js → search-x-BxcYdvqm.js} +1 -1
- package/web/dist/assets/{settings-2-DIHmg7wZ.js → settings-2-B0yYRU0q.js} +1 -1
- package/web/dist/assets/sheet-DxqNqi5S.js +1 -0
- package/web/dist/assets/skills-BmQ9hZ2c.js +1 -0
- package/web/dist/assets/sortable.esm-Dj7Kk-Wk.js +5 -0
- package/web/dist/assets/square--LrBHma0.js +1 -0
- package/web/dist/assets/standing-C42GacCE.webp +0 -0
- package/web/dist/assets/standing-C5Tul1Nv.webp +0 -0
- package/web/dist/assets/standing-CUU2Jka6.webp +0 -0
- package/web/dist/assets/standing-Ca5nprIS.webp +0 -0
- package/web/dist/assets/standing-CgOaMKRT.webp +0 -0
- package/web/dist/assets/standing-ClF4PE2-.webp +0 -0
- package/web/dist/assets/standing-CoS9fBjb.webp +0 -0
- package/web/dist/assets/standing-DZrhVTuG.webp +0 -0
- package/web/dist/assets/standing-MhG0Chks.webp +0 -0
- package/web/dist/assets/status-dot-Dxb9pPsK.js +1 -0
- package/web/dist/assets/tabs-CmEFauE4.js +1 -0
- package/web/dist/assets/{tag-B56iP2zA.js → tag-TWBVKabJ.js} +1 -1
- package/web/dist/assets/task-commits-sdhrDSta.js +1 -0
- package/web/dist/assets/{task-graph-ZjFyDrAV.js → task-graph-DqXUw-PM.js} +1 -1
- package/web/dist/assets/task-notes-ur3eZYQs.js +1 -0
- package/web/dist/assets/task-workspace-BvamqKbw.js +28 -0
- package/web/dist/assets/terminal-CmRAOyqu.js +1 -0
- package/web/dist/assets/terminal-drawer-BiRjtnip.js +1 -0
- package/web/dist/assets/{terminal-pane-CeYi-FvS.js → terminal-pane-YnSc_Vhs.js} +2 -2
- package/web/dist/assets/{textarea-BXN4nZ0d.js → textarea-C58jseO-.js} +1 -1
- package/web/dist/assets/toaster-5ad4wwJ9.js +1 -0
- package/web/dist/assets/tooltip-45rfBiq8.js +1 -0
- package/web/dist/assets/tracker-CcyqVPEo.js +4 -0
- package/web/dist/assets/triangle-alert-C1mTIqxM.js +1 -0
- package/web/dist/assets/typing-left-BWPbVi7e.webp +0 -0
- package/web/dist/assets/typing-right-HDY0V90O.webp +0 -0
- package/web/dist/assets/{upload-D_kW6AjR.js → upload-C2gxSnMR.js} +1 -1
- package/web/dist/assets/use-now-DD2atNhs.js +1 -0
- package/web/dist/assets/utils-Br_dqwn-.js +60 -0
- package/web/dist/assets/{workflow-j8scU63W.js → workflow-WvO4bTRt.js} +1 -1
- package/web/dist/assets/workflow-graph-B2oESW5u.js +13 -0
- package/web/dist/assets/worktree-lifecycle-BxYvSKsA.js +1 -0
- package/web/dist/assets/{worktree-lifecycle-operation-mYB7KCpQ.js → worktree-lifecycle-operation-BRID04bW.js} +1 -1
- package/web/dist/assets/x-CZSnHsZ4.js +1 -0
- package/web/dist/assets/{zoomable-image-CW-pQ6ZO.js → zoomable-image-DCITEnK-.js} +1 -1
- package/web/dist/index.html +70 -60
- package/web/dist/assets/agent-task-pickers-8skJH9bS.js +0 -1
- package/web/dist/assets/arrow-down-cBTb_EjO.js +0 -1
- package/web/dist/assets/arrow-left-BvR1Oqhc.js +0 -1
- package/web/dist/assets/arrow-up-Cn0IS81u.js +0 -1
- package/web/dist/assets/ask-answer-Cfb0vEFv.js +0 -1
- package/web/dist/assets/automations-route-B4axw9eb.js +0 -1
- package/web/dist/assets/check-B5omShEO.js +0 -1
- package/web/dist/assets/chevron-left-D74_-PJ_.js +0 -1
- package/web/dist/assets/chevron-right-C3fLn_fF.js +0 -1
- package/web/dist/assets/circle-check-j6r9xbE5.js +0 -1
- package/web/dist/assets/compare-variants-CDrFR7P_.js +0 -1
- package/web/dist/assets/composer-GntpkeQD.js +0 -18
- package/web/dist/assets/composer-attachments-Xa-qW8Eq.js +0 -3
- package/web/dist/assets/dashboard-CJW-Xk7f.js +0 -44
- package/web/dist/assets/diff-RPASOQVF.js +0 -3
- package/web/dist/assets/diff-view-Ckaab4uQ.js +0 -13
- package/web/dist/assets/file-preview-DOSEbcqV.js +0 -2
- package/web/dist/assets/git-tab-loading-DhclV71X.js +0 -1
- package/web/dist/assets/git-toolbar-Bk-3i42V.js +0 -1
- package/web/dist/assets/github-TdBnzj-H.js +0 -1
- package/web/dist/assets/icon-tooltip-CUJLXOxf.js +0 -1
- package/web/dist/assets/index-CDhEdFaZ.js +0 -33
- package/web/dist/assets/index-Dk1VTlxY.css +0 -2
- package/web/dist/assets/layout-cards-BYOEsNbu.js +0 -1
- package/web/dist/assets/lib-D2__YoPr.js +0 -1
- package/web/dist/assets/loader-circle-DCpZCAyT.js +0 -1
- package/web/dist/assets/manager-chat-B1Taq3Eg.js +0 -1
- package/web/dist/assets/manager-index-COwisKDf.js +0 -1
- package/web/dist/assets/manager-new-BdJPiBs2.js +0 -2
- package/web/dist/assets/manager-pickers-CvYpd5cU.js +0 -1
- package/web/dist/assets/managers-CDiETPHi.js +0 -1
- package/web/dist/assets/pencil-DWtoOm2f.js +0 -1
- package/web/dist/assets/picker-pill-DQICTO2N.js +0 -1
- package/web/dist/assets/play-BYwEI1EA.js +0 -1
- package/web/dist/assets/plus-BPopgSYQ.js +0 -1
- package/web/dist/assets/popover-DzdYqnHw.js +0 -1
- package/web/dist/assets/project-router-CmpQcVZp.js +0 -1
- package/web/dist/assets/queries-DOHu2y2B.js +0 -1
- package/web/dist/assets/reference-chip-ty5g_OLC.js +0 -1
- package/web/dist/assets/reference-conflict-action-B2LrO-o3.js +0 -1
- package/web/dist/assets/repo-git-CyoBxHfP.js +0 -1
- package/web/dist/assets/sheet-7RYAcp_E.js +0 -1
- package/web/dist/assets/skills-BBqk5FoM.js +0 -1
- package/web/dist/assets/sortable.esm-O2daV3YI.js +0 -5
- package/web/dist/assets/square-BPbl10lx.js +0 -1
- package/web/dist/assets/status-dot-C_5ryAFi.js +0 -1
- package/web/dist/assets/tabs-EEnYYrJF.js +0 -1
- package/web/dist/assets/task-commits-DFalvqkF.js +0 -1
- package/web/dist/assets/task-notes-DRDKGsIw.js +0 -1
- package/web/dist/assets/task-workspace-D2ak5sTE.js +0 -28
- package/web/dist/assets/terminal-B-JX8x9P.js +0 -1
- package/web/dist/assets/terminal-drawer-S0cBMANF.js +0 -1
- package/web/dist/assets/toaster-DrFdGtNN.js +0 -3
- package/web/dist/assets/tooltip-p6YPEpXC.js +0 -1
- package/web/dist/assets/tracker-CFDEuaFt.js +0 -4
- package/web/dist/assets/triangle-alert-Crbc2knA.js +0 -1
- package/web/dist/assets/use-now-DQpgbshl.js +0 -1
- package/web/dist/assets/utils-Df_1kJEk.js +0 -60
- package/web/dist/assets/workflow-graph-Cye5SBdg.js +0 -13
- package/web/dist/assets/worktree-lifecycle-Da61xsLH.js +0 -1
- package/web/dist/assets/x-sQR-jRBj.js +0 -1
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/terminal-pane-YnSc_Vhs.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-runtime-CCIEwYL0.js","assets/queries-ba5qZ3kd.js","assets/utils-Br_dqwn-.js","assets/bundle-mjs-rHxsej31.js","assets/preload-helper-Czpn1I53.js","assets/host-usage-CX8OXl8q.js","assets/use-desktop-BNN3U2y9.js","assets/clipboard-DvCUPLwM.js","assets/terminal-pane-BrP-ENHg.css","assets/dashboard-B_ytEQ_y.js","assets/chunk-KS7C4IRE-DtL2Gzw3.js","assets/sortable.esm-Dj7Kk-Wk.js","assets/worktree-lifecycle-BxYvSKsA.js","assets/managers-Dufza9IX.js","assets/sheet-DxqNqi5S.js","assets/button-BqkA8Ovk.js","assets/x-CZSnHsZ4.js","assets/reference-chip-C9pVQk05.js","assets/circle-check-LWKCYKhA.js","assets/git-pull-request-CURFMFaU.js","assets/git-pull-request-draft-BZgJrUou.js","assets/triangle-alert-C1mTIqxM.js","assets/use-now-DD2atNhs.js","assets/dist-Br4Ra_c5.js","assets/status-dot-Dxb9pPsK.js","assets/automation-format-BXwiLf2G.js","assets/chevron-right-DPaV033p.js","assets/circle-alert-B7VNkPC2.js","assets/download-HBguClwD.js","assets/tooltip-45rfBiq8.js","assets/format-DHK74MwW.js","assets/token-metrics-DXeuToH8.js","assets/compare-variants-BBOnUKfp.js","assets/check-B1z-_MCO.js","assets/search-x-BxcYdvqm.js","assets/collapsible-BuSDxSYs.js","assets/alert-dialog-BihfE0uZ.js","assets/toaster-5ad4wwJ9.js","assets/project-router-xmadY-N9.js","assets/directional-usage-BerE4wJK.js","assets/centered-state-CquGIOsq.js","assets/markdown-YWy3FUHK.js","assets/chunk-BO2N2NFS-Bde6epwZ.js","assets/lib-BxQXEXDF.js","assets/run-diff-CxS_a1EO.js","assets/task-commits-sdhrDSta.js","assets/git-tab-loading-CF0flOMS.js","assets/arrow-left-BtT8zuL0.js","assets/bot-Cm-PLA1M.js","assets/run-actions-CLIUiXwS.js","assets/dropdown-menu-CDv5Teql.js","assets/external-link-Bclznsu3.js","assets/folder-leteY9jH.js","assets/pencil-RUM53auZ.js","assets/reference-conflict-action-DxUm18aD.js","assets/ask-answer-Co3javaA.js","assets/new-task-form-BgMiEphZ.js","assets/impact-model-Dj6tIycu.js","assets/active-forge-DO2AaQ-s.js","assets/upload-C2gxSnMR.js","assets/loader-circle-DjzuGw6j.js","assets/diff-stat-CxDTnfya.js","assets/icon-tooltip-BMkyRHLt.js","assets/layers-YoqiEcNh.js","assets/layout-grid-CSvbdC6i.js","assets/terminal-CmRAOyqu.js","assets/textarea-C58jseO-.js","assets/workflow-WvO4bTRt.js","assets/composer-attachments-DyC9yyGs.js","assets/use-submit-shortcut-BJ10ZshV.js","assets/picker-pill-BO6YUs1F.js","assets/search-CCE2KMtX.js","assets/lib-BQXq3kEf.js","assets/diff-BQScRHXz.js","assets/scroll-within-DhWf-4MN.js","assets/zoomable-image-DCITEnK-.js","assets/commit-list-D5Nuv2HC.js","assets/task-notes-ur3eZYQs.js","assets/layout-cards-Cvq2XaJL.js","assets/save-zfKVAo2Y.js","assets/input-BO795Un9.js","assets/task-workspace-BvamqKbw.js","assets/arrow-down-DACdHKjc.js","assets/worktree-lifecycle-operation-BRID04bW.js","assets/file-preview-DQ7iQhe0.js","assets/file-rCLi_p-R.js","assets/file-tree-Bm38qEZP.js","assets/markdown-CP2EQDsL.js","assets/message-square-beq8DjLH.js","assets/composer-BPIW4tmM.js","assets/arrow-up-BAPSgozC.js","assets/plus-Bdmhj8CR.js","assets/square--LrBHma0.js","assets/command-CfdVVS0V.js","assets/play-Cj3p2Q5t.js","assets/follow-up-engine-Q1EcpRpB.js","assets/reasoning-effort-pill-B8Z1RaXL.js","assets/tabs-CmEFauE4.js","assets/drawer-state-DasOAIpO.js","assets/types-BTlmexWF.js","assets/ask-card-DLtNyMH_.js","assets/repo-git-DFf8ZGZv.js","assets/impact-control-Deh1F44q.js","assets/github-DcvXvc4J.js","assets/chevron-left-CDAxCC2p.js","assets/tag-TWBVKabJ.js","assets/agent-task-pickers-CZpw4vcZ.js","assets/tracker-CcyqVPEo.js","assets/workflow-graph-B2oESW5u.js","assets/settings-2-B0yYRU0q.js","assets/workflow-graph-DLioOiRN.css","assets/skills-BmQ9hZ2c.js","assets/manager-index-BGNDfiIy.js","assets/manager-new-Dek6H9Bg.js","assets/mascot-picker-0_LGzV_f.js","assets/manager-chat-C4QqN-w6.js","assets/automations-route-JizzZrRf.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,$n as o,$r as s,$t as c,A as l,Aa as u,Ar as d,B as f,Bn as p,Bt as m,C as h,Ca as g,Cn as _,Co as v,Cr as y,Da as b,Dn as x,E as S,Eo as C,Er as w,F as T,Fn as E,Fr as D,Ft as O,G as k,Gn as A,Gt as j,Hn as ee,Ht as M,Ia as N,In as te,It as ne,J as P,Ja as F,Ji as re,Jn as I,Jt as ie,K as L,Kn as ae,Kt as oe,Li as se,Ln as ce,Lt as R,Mn as z,Mr as le,Na as ue,Nn as de,Nr as fe,Nt as B,Oa as pe,On as me,Or as he,Pa as ge,Pi as _e,Pn as ve,Pt as ye,Q as be,Qi as xe,Qr as Se,Qt as Ce,Ra as we,Rn as Te,Rt as Ee,S as De,Sn as Oe,So as ke,St as Ae,T as je,Ta as Me,To as Ne,Tr as Pe,Ua as Fe,Ui as Ie,Un as Le,Ut as Re,V as ze,Va as Be,Vn as Ve,Vt as He,W as Ue,Wa as We,Wn as Ge,Wr as Ke,Xn as qe,Y as Je,Ya as Ye,Yi as Xe,Yn as Ze,Yt as Qe,Z as $e,Za as et,Zr as tt,Zt as nt,_ as rt,_a as it,_n as at,_o as ot,_t as st,aa as ct,an as lt,ao as ut,bn as dt,bo as ft,c as pt,ca as mt,cn as ht,co as gt,ct as _t,d as vt,da as yt,dn as bt,do as xt,dt as St,ei as Ct,en as wt,eo as Tt,er as Et,et as Dt,f as Ot,fa as kt,fn as At,fo as jt,g as Mt,gn as Nt,go as Pt,h as Ft,ha as It,ho as Lt,i as Rt,ia as zt,in as Bt,io as Vt,it as Ht,j as Ut,jn as Wt,ka as Gt,l as Kt,ln as qt,lo as Jt,lt as Yt,m as Xt,ma as Zt,mn as Qt,mo as $t,na as en,no as tn,nr as nn,nt as rn,o as an,oi as on,on as sn,oo as cn,ot as ln,p as un,pa as dn,pn as V,po as fn,pr as pn,pt as mn,q as hn,qa as gn,qn as _n,qt as vn,r as H,ra as yn,ro as bn,rt as xn,s as Sn,si as Cn,so as U,st as wn,ta as Tn,tn as En,tt as Dn,u as On,un as kn,uo as W,ut as An,v as jn,vo as Mn,vr as Nn,wa as Pn,wn as Fn,wo as In,x as Ln,xa as Rn,xi as zn,xn as Bn,xo as Vn,xr as Hn,xt as Un,y as Wn,yn as Gn,yo as Kn,yr as qn,z as Jn,za as Yn,zr as Xn,zt as Zn}from"./queries-ba5qZ3kd.js";import{Dt as Qn,Et as $n,J as er,L as tr,R as nr,T as rr,V as ir,a as ar,bt as or,c as sr,f as cr,g as lr,i as ur,kt as dr,lt as fr,m as pr,n as mr,o as hr,p as gr,r as _r,t as G,u as vr,wt as yr,y as br,yt as xr}from"./utils-Br_dqwn-.js";import{t as Sr}from"./preload-helper-Czpn1I53.js";import{a as Cr,c as wr,f as Tr,i as Er,l as Dr,n as Or,o as K,p as kr,r as Ar,s as jr,t as Mr,u as Nr}from"./chunk-KS7C4IRE-DtL2Gzw3.js";import{o as Pr,t as Fr}from"./worktree-lifecycle-BxYvSKsA.js";import{f as Ir,l as Lr,u as Rr,v as zr}from"./managers-Dufza9IX.js";import{C as Br,S as Vr,_ as Hr,a as Ur,b as Wr,c as Gr,d as Kr,f as qr,g as Jr,h as Yr,i as Xr,l as Zr,m as Qr,n as $r,o as ei,p as ti,r as ni,s as ri,t as ii,u as ai,v as oi,w as si,x as ci,y as li}from"./sortable.esm-Dj7Kk-Wk.js";import{i as ui,n as di,o as fi,r as pi,s as mi,t as hi}from"./sheet-DxqNqi5S.js";import{a as gi,c as _i,d as vi,f as yi,i as bi,l as xi,n as Si,o as Ci,r as wi,s as Ti,t as Ei,u as Di}from"./host-usage-CX8OXl8q.js";import{t as Oi}from"./use-desktop-BNN3U2y9.js";import{C as ki,D as Ai,M as ji,N as q,O as Mi,S as Ni,T as Pi,_ as Fi,b as Ii,f as Li,g as Ri,h as zi,j as Bi,m as Vi,p as Hi,t as J,v as Ui,w as Wi,x as Gi,y as Ki}from"./button-BqkA8Ovk.js";import{a as qi,at as Ji,c as Yi,ct as Xi,dt as Zi,f as Qi,g as $i,gt as ea,h as ta,i as na,lt as ra,m as ia,mt as aa,n as oa,o as sa,ot as ca,s as la,st as ua,ut as da,yt as fa}from"./git-tab-loading-CF0flOMS.js";import{t as pa}from"./arrow-down-DACdHKjc.js";import{t as ma}from"./arrow-left-BtT8zuL0.js";import{c as ha,d as ga,h as _a,i as va,m as ya,o as ba,p as xa,r as Sa,t as Ca,u as wa}from"./worktree-lifecycle-operation-BRID04bW.js";import{c as Ta,i as Ea,r as Da,t as Oa,u as ka}from"./reference-chip-C9pVQk05.js";import{t as Aa}from"./arrow-up-BAPSgozC.js";import{t as ja}from"./bot-Cm-PLA1M.js";import{A as Ma,C as Na,D as Pa,M as Fa,S as Ia,_ as La,b as Ra,g as za,k as Ba,v as Va,x as Ha,y as Ua}from"./run-actions-CLIUiXwS.js";import{t as Wa}from"./check-B1z-_MCO.js";import{a as Ga,i as Ka,n as qa,o as Ja,r as Ya,s as Xa,t as Za}from"./dist-Br4Ra_c5.js";import{t as Qa}from"./chevron-right-DPaV033p.js";import{t as $a}from"./circle-check-LWKCYKhA.js";import{i as eo,l as to,m as no,n as ro,p as io,r as ao,s as oo,t as so}from"./dropdown-menu-CDv5Teql.js";import{n as co,t as lo}from"./pencil-RUM53auZ.js";import{a as uo,i as fo,n as po,r as mo}from"./reference-conflict-action-DxUm18aD.js";import{t as ho}from"./external-link-Bclznsu3.js";import{g as go,v as _o,y as vo}from"./impact-model-Dj6tIycu.js";import{t as yo}from"./file-rCLi_p-R.js";import{t as bo}from"./folder-leteY9jH.js";import{n as xo,t as So}from"./active-forge-DO2AaQ-s.js";import{n as Co,t as wo}from"./upload-C2gxSnMR.js";import{t as To}from"./layers-YoqiEcNh.js";import{t as Eo}from"./loader-circle-DjzuGw6j.js";import{t as Do}from"./message-square-beq8DjLH.js";import{_ as Oo,a as ko,b as Ao,c as jo,g as Mo,h as No,i as Po,l as Fo,m as Io,n as Lo,o as Ro,p as zo,r as Bo,s as Vo,t as Ho,u as Uo,v as Wo,x as Go,y as Ko}from"./composer-BPIW4tmM.js";import{t as qo}from"./play-Cj3p2Q5t.js";import{t as Jo}from"./plus-Bdmhj8CR.js";import{t as Yo}from"./search-x-BxcYdvqm.js";import{t as Xo}from"./search-CCE2KMtX.js";import{t as Zo}from"./square--LrBHma0.js";import{n as Qo,t as $o}from"./textarea-C58jseO-.js";import{t as es}from"./triangle-alert-C1mTIqxM.js";import{t as ts}from"./workflow-WvO4bTRt.js";import{t as ns}from"./x-CZSnHsZ4.js";import{a as rs,i as is,n as as,r as os,t as ss}from"./tooltip-45rfBiq8.js";import{n as cs,r as ls,t as us}from"./collapsible-BuSDxSYs.js";import{a as ds,c as fs,i as ps,n as ms,o as hs,r as gs,s as _s,t as vs}from"./alert-dialog-BihfE0uZ.js";import{A as ys,C as bs,D as xs,E as Ss,O as Cs,T as ws,_ as Ts,a as Es,b as Ds,c as Os,d as ks,f as As,g as js,i as Ms,k as Ns,l as Ps,m as Fs,n as Is,p as Ls,r as Rs,s as zs,t as Bs,u as Vs,y as Hs}from"./use-now-DD2atNhs.js";import{i as Us,n as Ws,r as Gs,t as Ks}from"./tabs-CmEFauE4.js";import{t as qs}from"./input-BO795Un9.js";import{r as Y,t as Js}from"./toaster-5ad4wwJ9.js";import{A as Ys,B as Xs,C as Zs,D as Qs,E as $s,H as ec,J as tc,K as nc,N as rc,O as ic,P as ac,S as oc,T as sc,U as cc,V as lc,_ as uc,a as dc,b as fc,c as pc,d as mc,f as hc,g as gc,h as _c,k as vc,l as yc,m as bc,n as xc,o as Sc,p as Cc,q as wc,r as Tc,s as Ec,t as Dc,u as Oc,v as kc,w as Ac,y as jc,z as Mc}from"./new-task-form-BgMiEphZ.js";import{t as Nc}from"./status-dot-Dxb9pPsK.js";import{a as Pc,c as Fc,i as Ic,l as Lc,n as Rc,o as zc,r as Bc,s as Vc,t as X}from"./project-router-xmadY-N9.js";import{a as Hc,c as Uc,i as Wc,l as Gc,n as Kc,o as qc,r as Jc,s as Yc,t as Xc}from"./command-CfdVVS0V.js";import{n as Zc}from"./format-DHK74MwW.js";import{S as Qc,m as $c,u as el,v as tl,x as nl}from"./composer-attachments-DyC9yyGs.js";import{n as rl,r as il,t as al}from"./directional-usage-BerE4wJK.js";import{t as ol}from"./diff-stat-CxDTnfya.js";import{t as sl}from"./icon-tooltip-BMkyRHLt.js";import{t as cl}from"./token-metrics-DXeuToH8.js";import{t as ll}from"./lib-BQXq3kEf.js";import{a as ul,i as dl,n as fl,t as pl}from"./picker-pill-BO6YUs1F.js";import{t as ml}from"./clipboard-DvCUPLwM.js";import{n as hl,t as gl}from"./centered-state-CquGIOsq.js";import{t as _l}from"./reasoning-effort-pill-B8Z1RaXL.js";import{a as vl,o as yl,r as bl,t as xl}from"./markdown-YWy3FUHK.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 Sl=class extends C{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 xt({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=Cl(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=Cl(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=Cl(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=Cl(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){$t.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=>Kn(t,e))}findAll(e={}){return this.getAll().filter(t=>Kn(e,t))}notify(e){$t.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return $t.batch(()=>Promise.all(e.map(e=>e.continue().catch(Vn))))}};function Cl(e){return e.options.scope?.id}var wl=class extends C{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??ot(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(){$t.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=>ft(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>ft(e,t)):t}notify(e){$t.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){$t.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){$t.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Tl=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new wl,this.#t=e.mutationCache||new Sl,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=Ne.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=fn.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(v(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=Lt(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return $t.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;$t.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return $t.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=$t.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(Vn).catch(Vn)}invalidateQueries(e,t={}){return $t.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=$t.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(Vn)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(Vn)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(v(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Vn).catch(Vn)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Vn).catch(Vn)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return fn.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(Pt(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{ke(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(Pt(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{ke(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||=ot(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===In&&(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()}},Z=e(t(),1),El=n();function Dl(){return new Tl({defaultOptions:{queries:{refetchInterval:!1,staleTime:5*6e4,gcTime:30*6e4,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:(e,t)=>t instanceof pn&&t.status>=400&&t.status<500?!1:t instanceof pn&&t.status===0?e<3:e<1,retryDelay:(e,t)=>t instanceof pn&&t.status===0?Math.min(250*2**e,1e3):Math.min(1e3*2**e,3e4)},mutations:{retry:!1}}})}var Ol=q(`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`}]]),kl=q(`arrow-left-right`,[[`path`,{d:`M8 3 4 7l4 4`,key:`9rb6wj`}],[`path`,{d:`M4 7h16`,key:`6tx8e3`}],[`path`,{d:`m16 21 4-4-4-4`,key:`siv7j2`}],[`path`,{d:`M20 17H4`,key:`h6l3hr`}]]),Al=q(`bell`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]),jl=q(`blocks`,[[`path`,{d:`M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2`,key:`1ah6g2`}],[`rect`,{x:`14`,y:`2`,width:`8`,height:`8`,rx:`1`,key:`88lufb`}]]),Ml=q(`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`}]]),Nl=q(`check-check`,[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]),Pl=q(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),Fl=q(`chevrons-left`,[[`path`,{d:`m11 17-5-5 5-5`,key:`13zhaf`}],[`path`,{d:`m18 17-5-5 5-5`,key:`h8a8et`}]]),Il=q(`chevrons-right`,[[`path`,{d:`m6 17 5-5-5-5`,key:`xnjwq`}],[`path`,{d:`m13 17 5-5-5-5`,key:`17xmmf`}]]),Ll=q(`clock-3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6h4`,key:`135r8i`}]]),Rl=q(`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`}]]),zl=q(`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`}]]),Bl=q(`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`}]]),Vl=q(`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`}]]),Hl=q(`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`}]]),Ul=q(`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`}]]),Wl=q(`flask-conical`,[[`path`,{d:`M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2`,key:`18mbvz`}],[`path`,{d:`M6.453 15h11.094`,key:`3shlmq`}],[`path`,{d:`M8.5 2h7`,key:`csnxdl`}]]),Gl=q(`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`}]]),Kl=q(`folder-open`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 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.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),ql=q(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`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`}]]),Jl=q(`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`}]]),Yl=q(`folders`,[[`path`,{d:`M20 5a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h2.5a1.5 1.5 0 0 1 1.2.6l.6.8a1.5 1.5 0 0 0 1.2.6z`,key:`a4852j`}],[`path`,{d:`M3 8.268a2 2 0 0 0-1 1.738V19a2 2 0 0 0 2 2h11a2 2 0 0 0 1.732-1`,key:`yxbcw3`}]]),Xl=q(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),Zl=q(`gift`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M20 11v8a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-8`,key:`1sqzm4`}],[`path`,{d:`M7.5 7a1 1 0 0 1 0-5A4.8 8 0 0 1 12 7a4.8 8 0 0 1 4.5-5 1 1 0 0 1 0 5`,key:`kc0143`}],[`rect`,{x:`3`,y:`7`,width:`18`,height:`4`,rx:`1`,key:`1hberx`}]]),Ql=q(`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`}]]),$l=q(`inbox`,[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]),eu=q(`key-round`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),tu=q(`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`}]]),nu=q(`lightbulb`,[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]),ru=q(`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`}]]),iu=q(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),au=q(`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`}]]),ou=q(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),su=q(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),cu=q(`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`}]]),lu=q(`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`}]]),uu=q(`notebook-pen`,[[`path`,{d:`M13.4 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7.4`,key:`re6nr2`}],[`path`,{d:`M2 6h4`,key:`aawbzj`}],[`path`,{d:`M2 10h4`,key:`l0bgd4`}],[`path`,{d:`M2 14h4`,key:`1gsvsf`}],[`path`,{d:`M2 18h4`,key:`1bu2t1`}],[`path`,{d:`M21.378 5.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z`,key:`pqwjuv`}]]),du=q(`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`}]]),fu=q(`package`,[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 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.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]),pu=q(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),mu=q(`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`}]]),hu=q(`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`}]]),gu=q(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),_u=q(`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`}]]),vu=q(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),yu=q(`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`}]]),bu=q(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),xu=q(`shield-off`,[[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71`,key:`1jlk70`}],[`path`,{d:`M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264`,key:`18rp1v`}]]),Su=q(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),Cu=q(`split`,[[`path`,{d:`M16 3h5v5`,key:`1806ms`}],[`path`,{d:`M8 3H3v5`,key:`15dfkv`}],[`path`,{d:`M12 22v-8.3a4 4 0 0 0-1.172-2.872L3 3`,key:`1qrqzj`}],[`path`,{d:`m15 9 6-6`,key:`ko1vev`}]]),wu=q(`star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]),Tu=q(`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`}]]),Eu=q(`ticket`,[[`path`,{d:`M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z`,key:`qn84l0`}],[`path`,{d:`M13 5v2`,key:`dyzc3o`}],[`path`,{d:`M13 17v2`,key:`1ont0d`}],[`path`,{d:`M13 11v2`,key:`1wjjxi`}]]),Du=q(`unplug`,[[`path`,{d:`m19 5 3-3`,key:`yk6iyv`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z`,key:`1snsnr`}]]),Ou=q(`webhook`,[[`path`,{d:`M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2`,key:`q3hayz`}],[`path`,{d:`m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06`,key:`1go1hn`}],[`path`,{d:`m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8`,key:`qlwsc0`}]]),ku={jira:{label:`Jira`,scopeLabel:`Jira projects`},linear:{label:`Linear`,scopeLabel:`Linear teams`}},Au=dr.options.map(e=>({kind:e,...ku[e]}));function ju(e){let t=Z.useRef({value:e,previous:e});return Z.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Q=i(),Mu=`Label`,Nu=Z.forwardRef((e,t)=>(0,Q.jsx)(Pi.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));Nu.displayName=Mu;var Pu=Nu;function Fu(e,[t,n]){return Math.min(n,Math.max(t,e))}var Iu=e(r(),1),Lu=[` `,`Enter`,`ArrowUp`,`ArrowDown`],Ru=[` `,`Enter`],zu=`Select`,[Bu,Vu,Hu]=no(zu),[Uu,Wu]=Wi(zu,[Hu,Ga]),Gu=Ga(),[Ku,qu]=Uu(zu),[Ju,Yu]=Uu(zu),Xu=`SelectProvider`;function Zu(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=Gu(t),[_,v]=Z.useState(null),[y,b]=Z.useState(null),[x,S]=Z.useState(!1),C=io(l),[w,T]=Gi({prop:r,defaultProp:i??!1,onChange:a,caller:zu}),[E,D]=Gi({prop:o,defaultProp:s,onChange:c,caller:zu}),O=Z.useRef(null),k=Z.useRef(E);Z.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]=Z.useState(new Set),M=Ki(),N=Array.from(j).map(e=>e.props.value).join(`;`),te=Z.useCallback(e=>{ee(t=>new Set(t).add(e))},[]),ne=Z.useCallback(e=>{ee(t=>{let n=new Set(t);return n.delete(e),n})},[]),P={required:p,trigger:_,onTriggerChange:v,valueNode:y,onValueNodeChange:b,valueNodeHasChildren:x,onValueNodeHasChildrenChange:S,contentId:M,value:E,onValueChange:D,open:w,onOpenChange:T,dir:C,triggerPointerDownPosRef:O,disabled:f,name:u,autoComplete:d,form:m,nativeOptions:j,nativeSelectKey:N,isFormControl:A};return(0,Q.jsx)(Ka,{...g,children:(0,Q.jsx)(Ku,{scope:t,...P,children:(0,Q.jsx)(Bu.Provider,{scope:t,children:(0,Q.jsx)(Ju,{scope:t,onNativeOptionAdd:te,onNativeOptionRemove:ne,children:Zd(h)?h(P):n})})})})}Zu.displayName=Xu;var Qu=e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,Q.jsx)(Zu,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,Q.jsxs)(Q.Fragment,{children:[n,e?(0,Q.jsx)(Xd,{__scopeSelect:t}):null]})})};Qu.displayName=zu;var $u=`SelectTrigger`,ed=Z.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=Gu(n),o=qu($u,n),s=o.disabled||r,c=Bi(t,o.onTriggerChange),l=Vu(n),u=Z.useRef(`touch`),[d,f,p]=$d(e=>{let t=l().filter(e=>!e.disabled),n=ef(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,Q.jsx)(Za,{asChild:!0,...a,children:(0,Q.jsx)(Pi.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":Qd(o.value)?``:void 0,...i,ref:c,onClick:ki(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:ki(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:ki(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&Lu.includes(e.key)&&(m(),e.preventDefault())})})})});ed.displayName=$u;var td=`SelectValue`,nd=Z.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=qu(td,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=Bi(t,c.onValueNodeChange);Ni(()=>{l(u)},[l,u]);let f=Qd(c.value);return(0,Q.jsx)(Pi.span,{...s,asChild:!f&&s.asChild,ref:d,style:{pointerEvents:`none`},children:(0,Q.jsx)(Z.Fragment,{children:f?o:a},f?`placeholder`:`value`)})});nd.displayName=td;var rd=`SelectIcon`,id=Z.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,Q.jsx)(Pi.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});id.displayName=rd;var ad=`SelectPortal`,[od,sd]=Uu(ad,{forceMount:void 0}),cd=e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,Q.jsx)(od,{scope:e.__scopeSelect,forceMount:n,children:(0,Q.jsx)(zi,{asChild:!0,...r})})};cd.displayName=ad;var ld=`SelectContent`,ud=Z.forwardRef((e,t)=>{let n=sd(ld,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=qu(ld,e.__scopeSelect),[o,s]=Z.useState();return Ni(()=>{s(new DocumentFragment)},[]),(0,Q.jsx)(Ii,{present:r||a.open,children:({present:e})=>e?(0,Q.jsx)(_d,{...i,ref:t}):(0,Q.jsx)(dd,{...i,fragment:o})})});ud.displayName=ld;var dd=Z.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,fragment:i}=e;return i?Iu.createPortal((0,Q.jsx)(pd,{scope:n,children:(0,Q.jsx)(Bu.Slot,{scope:n,children:(0,Q.jsx)(`div`,{ref:t,children:r})})}),i):null});dd.displayName=`SelectContentFragment`;var fd=10,[pd,md]=Uu(ld),hd=`SelectContentImpl`,gd=Mi(`SelectContent.RemoveScroll`),_d=Z.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=qu(ld,n),[y,b]=Z.useState(null),[x,S]=Z.useState(null),C=Bi(t,b),[w,T]=Z.useState(null),[E,D]=Z.useState(null),O=Vu(n),[k,A]=Z.useState(!1),j=Z.useRef(!1);Z.useEffect(()=>{if(y)return Li(y)},[y]),Vi();let ee=Z.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]),M=Z.useCallback(()=>ee([w,y]),[ee,w,y]);Z.useEffect(()=>{k&&M()},[k,M]);let{onOpenChange:N,triggerPointerDownPosRef:te}=v;Z.useEffect(()=>{if(y){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(te.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(te.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(y)||N(!1),document.removeEventListener(`pointermove`,t),te.current=null};return te.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,N,te]),Z.useEffect(()=>{let e=()=>N(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[N]);let[ne,P]=$d(e=>{let t=O().filter(e=>!e.disabled),n=ef(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),F=Z.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]),re=Z.useCallback(()=>y?.focus(),[y]),I=Z.useCallback((e,t,n)=>{let r=!j.current&&!n;(v.value!==void 0&&v.value===t||r)&&D(e)},[v.value]),ie=r===`popper`?xd:yd,L=ie===xd?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,Q.jsx)(pd,{scope:n,content:y,viewport:x,onViewportChange:S,itemRefCallback:F,selectedItem:w,onItemLeave:re,itemTextRefCallback:I,focusSelectedItem:M,selectedItemText:E,position:r,isPositioned:k,searchRef:ne,children:(0,Q.jsx)(Hi,{as:gd,allowPinchZoom:!0,children:(0,Q.jsx)(Ri,{asChild:!0,trapped:v.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:ki(i,e=>{v.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,Q.jsx)(Fi,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:(0,Q.jsx)(ie,{role:`listbox`,id:v.contentId,"data-state":v.open?`open`:`closed`,dir:v.dir,onContextMenu:e=>e.preventDefault(),..._,...L,onPlaced:()=>A(!0),ref:C,style:{display:`flex`,flexDirection:`column`,outline:`none`,..._.style},onKeyDown:ki(_.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&P(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()}})})})})})})});_d.displayName=hd;var vd=`SelectItemAlignedPosition`,yd=Z.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=qu(ld,n),o=md(ld,n),[s,c]=Z.useState(null),[l,u]=Z.useState(null),d=Bi(t,u),f=Vu(n),p=Z.useRef(!1),m=Z.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:_,focusSelectedItem:v}=o,y=Z.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-fd,d=Fu(a,[fd,Math.max(fd,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-fd,d=Fu(a,[fd,Math.max(fd,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-fd*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-fd,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=`${fd}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]);Ni(()=>y(),[y]);let[b,x]=Z.useState();return Ni(()=>{l&&x(window.getComputedStyle(l).zIndex)},[l]),(0,Q.jsx)(Sd,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:Z.useCallback(e=>{e&&m.current===!0&&(y(),v?.(),m.current=!1)},[y,v]),children:(0,Q.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:b},children:(0,Q.jsx)(Pi.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});yd.displayName=vd;var bd=`SelectPopperPosition`,xd=Z.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=fd,...a}=e,o=Gu(n);return(0,Q.jsx)(Ya,{...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)`}})});xd.displayName=bd;var[Sd,Cd]=Uu(ld,{}),wd=`SelectViewport`,Td=Z.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=md(wd,n),o=Cd(wd,n),s=Bi(t,a.onViewportChange),c=Z.useRef(0);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.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,Q.jsx)(Bu.Slot,{scope:n,children:(0,Q.jsx)(Pi.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:ki(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-fd*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})})})]})});Td.displayName=wd;var Ed=`SelectGroup`,[Dd,Od]=Uu(Ed),kd=Z.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Ki();return(0,Q.jsx)(Dd,{scope:n,id:i,children:(0,Q.jsx)(Pi.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});kd.displayName=Ed;var Ad=`SelectLabel`,jd=Z.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Od(Ad,n);return(0,Q.jsx)(Pi.div,{id:i.id,...r,ref:t})});jd.displayName=Ad;var Md=`SelectItem`,[Nd,Pd]=Uu(Md),Fd=Z.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=qu(Md,n),c=md(Md,n),l=s.value===r,[u,d]=Z.useState(a??``),[f,p]=Z.useState(!1),m=Bi(t,Ui(e=>c.itemRefCallback?.(e,r,i))),h=Ki(),g=Z.useRef(`touch`),_=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};return(0,Q.jsx)(Nd,{scope:n,value:r,disabled:i,textId:h,isSelected:l,onItemTextChange:Z.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,Q.jsx)(Bu.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,Q.jsx)(Pi.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:ki(o.onFocus,()=>p(!0)),onBlur:ki(o.onBlur,()=>p(!1)),onClick:ki(o.onClick,()=>{g.current!==`mouse`&&_()}),onPointerUp:ki(o.onPointerUp,()=>{g.current===`mouse`&&_()}),onPointerDown:ki(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:ki(o.onPointerMove,e=>{g.current=e.pointerType,i?c.onItemLeave?.():g.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ki(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:ki(o.onKeyDown,e=>{i||e.target!==e.currentTarget||c.searchRef?.current!==``&&e.key===` `||(Ru.includes(e.key)&&_(),e.key===` `&&e.preventDefault())})})})})});Fd.displayName=Md;var Id=`SelectItemText`,Ld=Z.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=qu(Id,n),s=md(Id,n),c=Pd(Id,n),l=Yu(Id,n),[u,d]=Z.useState(null),f=Ui(e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=Bi(t,d,c.onItemTextChange,f),m=u?.textContent,h=Z.useMemo(()=>(0,Q.jsx)(`option`,{value:c.value,disabled:c.disabled,children:m},c.value),[c.disabled,c.value,m]),{onNativeOptionAdd:g,onNativeOptionRemove:_}=l;return Ni(()=>(g(h),()=>_(h)),[g,_,h]),(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Pi.span,{id:c.textId,...a,ref:p}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!Qd(o.value)?Iu.createPortal(a.children,o.valueNode):null]})});Ld.displayName=Id;var Rd=`SelectItemIndicator`,zd=Z.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return Pd(Rd,n).isSelected?(0,Q.jsx)(Pi.span,{"aria-hidden":!0,...r,ref:t}):null});zd.displayName=Rd;var Bd=`SelectScrollUpButton`,Vd=Z.forwardRef((e,t)=>{let n=md(Bd,e.__scopeSelect),r=Cd(Bd,e.__scopeSelect),[i,a]=Z.useState(!1),o=Bi(t,r.onScrollButtonChange);return Ni(()=>{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,Q.jsx)(Wd,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});Vd.displayName=Bd;var Hd=`SelectScrollDownButton`,Ud=Z.forwardRef((e,t)=>{let n=md(Hd,e.__scopeSelect),r=Cd(Hd,e.__scopeSelect),[i,a]=Z.useState(!1),o=Bi(t,r.onScrollButtonChange);return Ni(()=>{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,Q.jsx)(Wd,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});Ud.displayName=Hd;var Wd=Z.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=md(`SelectScrollButton`,n),o=Z.useRef(null),s=Vu(n),c=Z.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return Z.useEffect(()=>()=>c(),[c]),Ni(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,Q.jsx)(Pi.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:ki(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:ki(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:ki(i.onPointerLeave,()=>{c()})})}),Gd=`SelectSeparator`,Kd=Z.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,Q.jsx)(Pi.div,{"aria-hidden":!0,...r,ref:t})});Kd.displayName=Gd;var qd=`SelectArrow`,Jd=Z.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Gu(n);return md(qd,n).position===`popper`?(0,Q.jsx)(qa,{...i,...r,ref:t}):null});Jd.displayName=qd;var Yd=`SelectBubbleInput`,Xd=Z.forwardRef(({__scopeSelect:e,...t},n)=>{let r=qu(Yd,e),{value:i,onValueChange:a,required:o,disabled:s,name:c,autoComplete:l,form:u}=r,{nativeOptions:d,nativeSelectKey:f}=r,p=Z.useRef(null),m=Bi(n,p),h=i??``,g=ju(h),_=Array.from(d).some(e=>(e.props.value??``)===``);return Z.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,Q.jsxs)(Pi.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:c,autoComplete:l,disabled:s,form:u,onChange:e=>a(e.target.value),...t,style:{...rs,...t.style},ref:m,defaultValue:h,children:[Qd(i)&&!_?(0,Q.jsx)(`option`,{value:``}):null,Array.from(d)]},f)});Xd.displayName=Yd;function Zd(e){return typeof e==`function`}function Qd(e){return e===``||e===void 0}function $d(e){let t=Ui(e),n=Z.useRef(``),r=Z.useRef(0),i=Z.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=Z.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return Z.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function ef(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=tf(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 tf(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var nf=`Switch`,[rf,af]=Wi(nf),[of,sf]=rf(nf);function cf(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]=Gi({prop:n,defaultProp:i??!1,onChange:c,caller:nf}),[m,h]=Z.useState(null),[g,_]=Z.useState(null),v={checked:f,setChecked:p,disabled:a,control:m,setControl:h,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:Z.useRef(!1),required:l,defaultChecked:i,isFormControl:!m||!!o||!!m.closest(`form`),bubbleInput:g,setBubbleInput:_};return(0,Q.jsx)(of,{scope:t,...v,children:gf(d)?d(v):r})}var lf=`SwitchTrigger`,uf=Z.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}=sf(lf,e),h=Bi(r,u),g=Z.useRef(c);return Z.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,Q.jsx)(Pi.button,{type:`button`,role:`switch`,"aria-checked":c,"aria-required":l,"data-state":_f(c),"data-disabled":s?``:void 0,disabled:s,value:o,...n,ref:h,onClick:ki(t,e=>{d(e=>!e),m&&p&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})});uf.displayName=lf;var df=Z.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,Q.jsx)(cf,{__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,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(uf,{...d,ref:t,__scopeSwitch:n}),e&&(0,Q.jsx)(hf,{__scopeSwitch:n})]})})});df.displayName=nf;var ff=`SwitchThumb`,pf=Z.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=sf(ff,n);return(0,Q.jsx)(Pi.span,{"data-state":_f(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});pf.displayName=ff;var mf=`SwitchBubbleInput`,hf=Z.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}=sf(mf,e),m=Bi(n,p),h=ju(a),g=Ja(r);Z.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 _=Z.useRef(a);return(0,Q.jsx)(Pi.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%)`}})});hf.displayName=mf;function gf(e){return typeof e==`function`}function _f(e){return e?`checked`:`unchecked`}var vf=ji(`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-primary text-primary-foreground [a&]:hover:bg-primary/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-primary underline-offset-4 [a&]:hover:underline`}},defaultVariants:{variant:`default`}});function yf({className:e,variant:t=`default`,asChild:n=!1,...r}){return(0,Q.jsx)(n?Ai:`span`,{"data-slot":`badge`,"data-variant":t,className:G(vf({variant:t}),e),...r})}var bf=/^(?:\\\\\?\\)?[A-Za-z]:$/,xf=/^(?:[\\/]{2}(?!\?[\\/])|\\\\\?\\UNC\\)[^\\/]+[\\/][^\\/]+$/i;function Sf(e){let t=e.replace(/[\\/]+$/,``);if(bf.test(t)||xf.test(t))return null;let n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));if(n<0)return null;if(n===0)return t.slice(0,1);let r=t.slice(0,n);return bf.test(r)?t.slice(0,n+1):r}var Cf=`x-apple.systempreferences:com.apple.preference.security?Privacy_FilesAndFolders`,wf=`inline-flex items-center gap-1 rounded-md border border-border px-2 py-1 text-foreground hover:bg-muted`;function Tf({path:e,selected:t,onSelect:n,onEnter:r,decorate:i,emptyHint:a,showHidden:o=!1}){let s=je(e,o),c=s.data?.parent??null,l=e===null?null:Sf(e);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{"data-slot":`fs-breadcrumb`,className:`truncate font-mono text-meta text-soft-foreground`,title:s.data?.path??void 0,children:s.data?.path??(s.isError?``:`Loading…`)}),!s.isError&&s.data?.parent===null?(0,Q.jsxs)(`p`,{"data-slot":`fs-root-hint`,className:`text-label text-soft-foreground`,children:[`This is the browse root. To browse elsewhere, change`,` `,(0,Q.jsx)(`a`,{href:`/settings/global/projects`,className:`text-foreground underline underline-offset-4 hover:text-muted-foreground`,children:`Default browse folder in Settings → Projects`}),`.`]}):null,s.isError?(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,Q.jsx)(`p`,{"data-slot":`fs-error`,className:`min-w-0 break-words text-ui text-danger`,children:s.error instanceof Error?s.error.message:`could not list that folder`}),s.error instanceof pn&&s.error.status===403?(0,Q.jsx)(`p`,{"data-slot":`fs-privacy-hint`,className:`text-label text-soft-foreground`,children:`Allow it under Privacy & Security ▸ Files & Folders, then try again.`}):null,(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-label`,children:[l===null?null:(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`fs-error-back`,onClick:()=>r(l),className:wf,children:[(0,Q.jsx)(Bl,{className:`size-3.5`,"aria-hidden":!0}),`Back`]}),s.error instanceof pn&&s.error.status===403?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`a`,{"data-slot":`fs-privacy-settings`,href:Cf,target:`_blank`,rel:`noreferrer`,className:wf,children:`Open Privacy Settings`}),(0,Q.jsx)(`button`,{type:`button`,"data-slot":`fs-retry`,onClick:()=>void s.refetch(),className:wf,children:`Try again`})]}):null]})]}):(0,Q.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,Q.jsx)(`li`,{className:`flex`,children:(0,Q.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-ui hover:bg-muted`,children:[(0,Q.jsx)(Bl,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),`Up one level`]})}),(s.data?.dirs??[]).map(e=>(0,Q.jsxs)(`li`,{className:`flex items-stretch`,children:[(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`fs-dir`,"aria-pressed":t?.path===e.path,onClick:()=>n(e),onDoubleClick:()=>r(e.path),className:G(`flex min-w-0 flex-1 items-center gap-2 px-3 py-2 text-left text-ui hover:bg-muted`,t?.path===e.path&&`bg-muted`),children:[(0,Q.jsx)(bo,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`truncate`,children:e.name}),i?.(e)]}),(0,Q.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,Q.jsx)(Qa,{className:`size-3.5`,"aria-hidden":`true`})})]},e.path)),s.data&&s.data.dirs.length===0?(0,Q.jsx)(`li`,{className:`px-3 py-2 text-ui text-muted-foreground`,children:a}):null]}),s.data?.truncated?(0,Q.jsx)(`p`,{"data-slot":`fs-truncated`,className:`text-meta text-muted-foreground`,children:`Too many folders to list — only the first ones are shown.`}):null]})}function Ef(e,t,n=!1){let r=je(e,n);return t?.path??r.data?.path??null}function Df({open:e,onOpenChange:t}){let[n,r]=(0,Z.useState)(null),[i,o]=(0,Z.useState)(null),s=a(),c=Yt(),l=Nr(),u=new Set((s.data?.projects??[]).filter(e=>!e.unregistered).map(e=>e.root)),d=e=>{r(e),o(null),c.reset()},f=Ef(n,i);return(0,Q.jsx)(ws,{open:e,onOpenChange:t,children:(0,Q.jsxs)(Ss,{"data-slot":`add-project-dialog`,className:`sm:max-w-lg`,children:[(0,Q.jsxs)(Ns,{children:[(0,Q.jsx)(ys,{children:`Open local folder`}),(0,Q.jsx)(xs,{children:`Pick the folder cezar should run in. Git repos are marked; any folder works.`})]}),(0,Q.jsx)(Tf,{path:n,selected:i,onSelect:o,onEnter:d,emptyHint:`No subfolders here — “Add project” registers this folder.`,decorate:e=>(0,Q.jsxs)(Q.Fragment,{children:[e.isRepo?(0,Q.jsx)(yf,{variant:`outline`,className:`shrink-0 text-micro`,children:`git`}):null,u.has(e.path)?(0,Q.jsx)(yf,{variant:`ghost`,className:`shrink-0 text-micro text-muted-foreground`,children:`already added`}):null]})}),c.isError?(0,Q.jsx)(`p`,{"data-slot":`add-project-error`,className:`min-w-0 break-words text-ui text-danger`,children:c.error instanceof Error?c.error.message:`could not add that folder`}):null,(0,Q.jsxs)(Cs,{className:`min-w-0 sm:items-center sm:justify-between`,children:[(0,Q.jsx)(`span`,{"data-slot":`add-project-target`,className:`min-w-0 truncate font-mono text-meta text-muted-foreground`,title:f??void 0,children:f??``}),(0,Q.jsxs)(`span`,{className:`flex shrink-0 gap-2`,children:[(0,Q.jsx)(J,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,Q.jsx)(J,{"data-slot":`add-project-confirm`,disabled:f===null||c.isPending,onClick:()=>{f===null||c.isPending||c.mutate(f,{onSuccess:({project:e})=>{t(!1),l(`/p/${encodeURIComponent(e.id)}/`)}})},children:c.isPending?`Adding…`:`Add project`})]})]})]})})}function Of({className:e,...t}){return(0,Q.jsx)(Pu,{"data-slot":`label`,className:G(`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})}function kf(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 Af({open:e,onOpenChange:t}){let[n,r]=(0,Z.useState)(``),[i,o]=(0,Z.useState)(``),[s,c]=(0,Z.useState)(null),[l,u]=(0,Z.useState)(!1),d=(0,Z.useRef)(!1),f=a(),p=rt(),{mutate:m,isPending:h}=p,g=Nr(),_=kf(p.error),v=(0,Z.useMemo)(()=>`co-${Math.random().toString(36).slice(2)}-${Date.now().toString(36)}`,[]),y=(0,Z.useRef)(v);y.current=v,(0,Z.useEffect)(()=>Jr((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,Z.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,Z.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,Z.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,Q.jsx)(ws,{open:e,onOpenChange:e=>p.isPending?void 0:t(e),children:(0,Q.jsxs)(Ss,{"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,Q.jsxs)(Ns,{children:[(0,Q.jsx)(ys,{children:`Clone from GitHub`}),(0,Q.jsxs)(xs,{children:[`The service clones with `,(0,Q.jsx)(`code`,{children:`gh`}),` into your checkout root and adds the result as a project.`]})]}),(0,Q.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,Q.jsx)(Of,{htmlFor:`clone-url`,children:`Repository`}),(0,Q.jsx)(qs,{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,Q.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,Q.jsx)(Of,{htmlFor:`clone-name`,children:`Folder name`}),(0,Q.jsx)(qs,{id:`clone-name`,"data-slot":`clone-name`,placeholder:b===``?`repo`:b,value:i,disabled:p.isPending,onChange:e=>o(e.target.value)}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,Q.jsx)(`p`,{"data-slot":`clone-target`,className:`min-w-0 flex-1 truncate font-mono text-meta text-soft-foreground`,title:C,children:C}),p.isPending?(0,Q.jsx)(J,{"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,Q.jsx)(yu,{className:`size-3.5`,"aria-hidden":`true`})}):(0,Q.jsx)(J,{asChild:!0,variant:`ghost`,size:`icon-sm`,className:`size-7`,children:(0,Q.jsx)(Or,{to:`/settings/global/projects`,"data-slot":`clone-root-settings`,"aria-label":`Edit checkout root`,title:`Edit checkout root`,children:(0,Q.jsx)(yu,{className:`size-3.5`,"aria-hidden":`true`})})})]})]}),p.isPending?(0,Q.jsx)(`p`,{"data-slot":`clone-progress`,className:`truncate font-mono text-meta text-muted-foreground`,children:s??`Starting the clone…`}):null,p.isError?(0,Q.jsx)(`div`,{"data-slot":`clone-error`,className:`grid min-w-0 gap-1.5 text-ui text-danger`,children:_?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{children:`GitHub requires SAML authorization for this organization.`}),(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`a`,{"data-slot":`clone-sso-link`,className:`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,Q.jsxs)(`details`,{className:`min-w-0`,children:[(0,Q.jsx)(`summary`,{children:`Error details`}),(0,Q.jsx)(`p`,{className:`whitespace-pre-wrap break-all`,children:p.error instanceof Error?p.error.message:null})]})]}):(0,Q.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,Q.jsxs)(Cs,{children:[(0,Q.jsx)(J,{variant:`outline`,disabled:p.isPending,onClick:()=>t(!1),children:`Cancel`}),(0,Q.jsx)(J,{"data-slot":`clone-confirm`,disabled:n.trim()===``||x===``||p.isPending,onClick:w,children:p.isPending?`Cloning…`:p.isError?`Retry clone`:`Clone`})]})]})})}function jf({className:e,size:t=`default`,...n}){return(0,Q.jsx)(df,{"data-slot":`switch`,"data-size":t,className:G(`peer group/switch inline-flex shrink-0 items-center rounded-full border border-transparent shadow-xs 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-[1.15rem] data-[size=default]:w-8 data-[size=sm]:h-3.5 data-[size=sm]:w-6 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input`,e),...n,children:(0,Q.jsx)(pf,{"data-slot":`switch-thumb`,className:G(`pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0`)})})}var Mf=[{slug:`github/codespaces-nextjs`,label:`Next.js`,description:`Minimal Next.js app (GitHub)`},{slug:`vercel/ai-chatbot`,label:`Next.js AI chatbot`,description:`Full-featured AI chat app (Vercel)`},{slug:`vercel/nextjs-postgres-nextauth-tailwindcss-template`,label:`Next.js admin dashboard`,description:`Postgres, Auth.js and Tailwind (Vercel)`},{slug:`github/codespaces-react`,label:`React + Vite`,description:`React single-page app (GitHub)`},{slug:`antfu-collective/vitesse`,label:`Vue + Vite`,description:`Opinionated Vue starter (Vitesse)`},{slug:`nuxt-ui-templates/starter-vue`,label:`Vue + Nuxt UI`,description:`Vue + Vite with Nuxt UI (Nuxt)`},{slug:`mugnavo/cove`,label:`Vite+`,description:`TanStack Start on Vite+ (vp), Better Auth`},{slug:`w3cj/hono-open-api-starter`,label:`Hono`,description:`Type-safe JSON API with OpenAPI docs`},{slug:`github/codespaces-express`,label:`Express`,description:`Node.js web server (GitHub)`},{slug:`andrewmcodes/obsidian-beginner-vault-template`,label:`Obsidian vault`,description:`Your own knowledge base in Markdown`},{slug:`chibat/chrome-extension-typescript-starter`,label:`Chrome extension`,description:`TypeScript extension starter`},{slug:`actions/typescript-action`,label:`GitHub Action`,description:`TypeScript action with tests (GitHub)`},{slug:`microsoft/python-package-template`,label:`Python package`,description:`Packaging, tests and CI (Microsoft)`},{slug:`github/codespaces-flask`,label:`Flask`,description:`Python web app (GitHub)`},{slug:`github/codespaces-django`,label:`Django`,description:`Python web framework (GitHub)`},{slug:`github/codespaces-rails`,label:`Ruby on Rails`,description:`Rails app (GitHub)`},{slug:`github/codespaces-jupyter`,label:`Jupyter notebooks`,description:`Data science and ML (GitHub)`}];function Nf(e){let t=e.trim().toLowerCase();return t===``||Mf.some(e=>e.slug.toLowerCase()===t)?Mf:Mf.filter(e=>[e.label,e.slug,e.description].some(e=>e.toLowerCase().includes(t)))}function Pf({value:e,onChange:t,disabled:n,id:r}){let[i,a]=(0,Z.useState)(-1),o=(0,Z.useId)(),s=Nf(e),c=(0,Z.useRef)(null),l=e.trim();(0,Z.useEffect)(()=>{i<0||c.current?.querySelector(`[data-index="${i}"]`)?.scrollIntoView?.({block:`nearest`})},[i]),(0,Z.useEffect)(()=>{c.current?.querySelector(`[aria-selected="true"]`)?.scrollIntoView?.({block:`nearest`})},[l]);let u=e=>{n||(t(e),a(-1))};return(0,Q.jsxs)(`div`,{className:`grid gap-2 md:flex md:min-h-0 md:flex-1 md:flex-col`,children:[(0,Q.jsx)(qs,{id:r,"data-slot":`create-template`,role:`combobox`,"aria-expanded":s.length>0,"aria-controls":o,"aria-autocomplete":`list`,"aria-activedescendant":i>=0?`${o}-${i}`:void 0,autoComplete:`off`,placeholder:`Search, or paste owner/repo or a URL`,value:e,disabled:n,onBlur:()=>a(-1),onChange:e=>{t(e.target.value),a(-1)},onKeyDown:e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault();let t=e.key===`ArrowDown`?1:-1;a(e=>s.length===0?-1:(e+t+s.length)%s.length)}else if(e.key===`Enter`&&i>=0){e.preventDefault();let t=s[i];t&&u(t.slug)}}}),s.length>0?(0,Q.jsx)(`ul`,{ref:c,id:o,role:`listbox`,"aria-label":`Suggested templates`,"aria-disabled":n||void 0,"data-slot":`create-template-suggestions`,className:G(`max-h-56 overflow-y-auto overscroll-contain rounded-md border border-border p-1`,`md:max-h-none md:min-h-36 md:flex-1`,n?`pointer-events-none opacity-50`:void 0),children:s.map((e,t)=>{let n=e.slug===l;return(0,Q.jsxs)(`li`,{id:`${o}-${t}`,role:`option`,"aria-selected":n,"data-index":t,"data-slot":`create-template-suggestion`,"data-template":e.slug,onMouseDown:e=>e.preventDefault(),onClick:()=>u(e.slug),onMouseEnter:()=>a(t),onMouseLeave:()=>a(-1),className:G(`grid cursor-pointer gap-0.5 rounded-sm border px-2 py-1.5`,n?`border-primary bg-primary/5`:`border-transparent`,t===i&&!n?`bg-accent text-accent-foreground`:void 0),children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-baseline justify-between gap-2`,children:[(0,Q.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1.5 text-sm font-medium`,children:[e.label,n?(0,Q.jsx)($a,{className:`size-3.5 shrink-0 text-primary`,"aria-hidden":`true`}):null]}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-meta text-muted-foreground`,children:e.description})]}),(0,Q.jsx)(`span`,{className:`truncate font-mono text-meta text-soft-foreground`,children:e.slug})]},e.slug)})}):(0,Q.jsxs)(`p`,{"data-slot":`create-template-no-match`,className:`px-1 text-label text-muted-foreground`,children:[`No suggested template matches — any `,(0,Q.jsx)(`span`,{className:`font-mono`,children:`owner/repo`}),` or GitHub URL works.`]})]})}function Ff(e){return e.trimStart().replace(/\s+/g,`-`)}function If({open:e,onOpenChange:t}){let[n,r]=(0,Z.useState)(``),[i,o]=(0,Z.useState)(!0),[s,c]=(0,Z.useState)(``),[l,u]=(0,Z.useState)(``),[d,f]=(0,Z.useState)(`empty`),[p,m]=(0,Z.useState)(null),h=a(),g=Ut(),_=De(),v=Nr(),y=(0,Z.useMemo)(()=>`np-${Math.random().toString(36).slice(2)}-${Date.now().toString(36)}`,[]),b=(0,Z.useRef)(y);b.current=y,(0,Z.useEffect)(()=>Jr((e,t)=>{if(e!==`checkout-progress`)return;let n=t;n?.checkoutId===b.current&&(n.phase===`cloning`&&n.line?m(n.line):n.phase!==`cloning`&&m(null))}),[]);let x=g.data,S=x?.available===!0&&Array.isArray(x.owners)&&x.owners.length>0,C=(0,Z.useMemo)(()=>x?.available&&Array.isArray(x.owners)?x.owners:[],[x]),w=C.some(e=>e.login===s)?s:C[0]?.login??``,T=i&&S,E=n.trim(),D=fr.test(E),O=E===``||D?null:E.length>100?`At most 100 characters.`:`Use letters, digits, “.”, “-” and “_” only.`,k=h.data?.projectsDir??``,A=D?`${k.replace(/\/+$/,``)}/${E}`:``,j=T&&d===`template`,ee=j&&l.trim()===``,M=()=>{if(!D||_.isPending||i&&g.isPending||ee)return;m(null);let e=l.trim();_.mutate({name:E,checkoutId:y,...T?{github:{owner:w,...j&&e!==``?{template:e}:{}}}:{}},{onSuccess:({project:e})=>{t(!1),v(`/p/${encodeURIComponent(e.id)}/`)}})},N=_.isPending,te=g.isPending||S;return(0,Q.jsx)(ws,{open:e,onOpenChange:e=>N?void 0:t(e),children:(0,Q.jsxs)(Ss,{"data-slot":`create-project-dialog`,className:G(`max-h-[calc(100dvh-2rem)] overflow-y-auto`,te?`md:h-[min(50rem,calc(100dvh-4rem))] md:max-w-3xl md:grid-rows-[auto_minmax(0,1fr)_auto] md:overflow-hidden`:void 0),children:[(0,Q.jsxs)(Ns,{children:[(0,Q.jsx)(ys,{children:`New project`}),(0,Q.jsx)(xs,{children:`cezar creates a new git repository in your checkout root and adds it as a project.`})]}),(0,Q.jsxs)(`div`,{"data-slot":`create-layout`,className:G(`grid gap-6`,te?`md:min-h-0 md:grid-cols-[minmax(0,5fr)_minmax(0,6fr)]`:void 0),children:[te?(0,Q.jsx)(`div`,{"data-slot":`create-owners-column`,className:`min-w-0 md:flex md:min-h-0 md:flex-col md:border-r md:border-border md:pr-6`,children:S?(0,Q.jsx)(Lf,{owners:C,value:w,disabled:N||!T,onChange:c}):(0,Q.jsx)(zf,{})}):null,(0,Q.jsxs)(`div`,{"data-slot":`create-form-column`,className:G(`grid min-w-0 content-start gap-4`,te?`md:-m-1 md:flex md:min-h-0 md:flex-col md:overflow-y-auto md:p-1`:void 0),children:[(0,Q.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,Q.jsx)(Of,{htmlFor:`create-name`,children:`Name`}),(0,Q.jsx)(qs,{id:`create-name`,"data-slot":`create-name`,autoFocus:!0,placeholder:`my-project`,value:n,disabled:N,"aria-invalid":O!==null,"aria-describedby":`create-name-hint`,onChange:e=>r(Ff(e.target.value)),onKeyDown:e=>{e.key===`Enter`&&M()}}),O?(0,Q.jsx)(`p`,{id:`create-name-hint`,"data-slot":`create-name-error`,className:`text-label text-danger`,children:O}):(0,Q.jsx)(`p`,{id:`create-name-hint`,"data-slot":`create-target`,className:`min-w-0 truncate font-mono text-meta text-soft-foreground`,title:A,children:A})]}),(0,Q.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-border p-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(Of,{htmlFor:`create-github`,className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(iu,{className:`size-3.5`,"aria-hidden":`true`}),`Create a private GitHub repository`]}),(0,Q.jsx)(jf,{id:`create-github`,"data-slot":`create-github`,checked:T,disabled:N||!S,onCheckedChange:o})]}),g.isPending?(0,Q.jsx)(`p`,{className:`text-label text-muted-foreground`,children:`Checking GitHub…`}):S?null:(0,Q.jsx)(`p`,{"data-slot":`create-github-unavailable`,className:`text-label text-muted-foreground`,children:x&&!x.available?x.reason:`Could not read your GitHub accounts — the project will be created locally only.`}),T?(0,Q.jsxs)(`p`,{className:`text-label text-muted-foreground`,children:[`Created as `,(0,Q.jsx)(`strong`,{children:`private`}),` under `,(0,Q.jsx)(`strong`,{children:w}),` — you can change its visibility on GitHub.`]}):null]}),(0,Q.jsxs)(`div`,{"data-slot":`create-start`,className:`grid gap-3 rounded-md border border-border p-3 md:flex md:min-h-0 md:flex-1 md:flex-col`,children:[(0,Q.jsx)(`span`,{id:`create-start-label`,className:`text-sm font-medium`,children:`Start with`}),(0,Q.jsxs)(`div`,{role:`radiogroup`,"aria-labelledby":`create-start-label`,className:`grid gap-2 sm:grid-cols-2`,children:[(0,Q.jsx)(Rf,{slot:`create-start-empty`,checked:!j,disabled:N,title:`Empty repository`,hint:`One empty commit, no files.`,onSelect:()=>f(`empty`)}),(0,Q.jsx)(Rf,{slot:`create-start-template`,checked:j,disabled:N||!T,title:`From a template`,hint:T?`Copy a GitHub template.`:`Needs a GitHub repository.`,onSelect:()=>f(`template`)})]}),j?(0,Q.jsxs)(`div`,{className:`grid gap-1.5 md:flex md:min-h-0 md:flex-1 md:flex-col`,children:[(0,Q.jsx)(Of,{htmlFor:`create-template`,children:`Template`}),(0,Q.jsx)(Pf,{id:`create-template`,value:l,disabled:N,onChange:u})]}):null]}),N?(0,Q.jsx)(`p`,{"data-slot":`create-progress`,className:`truncate font-mono text-meta text-muted-foreground`,children:p??`Starting…`}):null,_.isError?(0,Q.jsx)(`p`,{"data-slot":`create-error`,className:`whitespace-pre-line text-ui text-danger`,children:_.error instanceof Error?_.error.message:`could not create the project`}):null]})]}),(0,Q.jsxs)(Cs,{children:[(0,Q.jsx)(J,{variant:`outline`,disabled:N,onClick:()=>t(!1),children:`Cancel`}),(0,Q.jsx)(J,{"data-slot":`create-confirm`,disabled:!D||N||ee||i&&g.isPending,onClick:M,children:N?`Creating…`:`Create`})]})]})})}function Lf({owners:e,value:t,disabled:n,onChange:r}){let i=(0,Z.useRef)([]),a=(t,n)=>{if(e.length===0)return;let a=(t+n+e.length)%e.length,o=e[a]?.login;o!==void 0&&(r(o),i.current[a]?.focus())};return(0,Q.jsxs)(`div`,{className:`grid gap-3 md:flex md:min-h-0 md:flex-1 md:flex-col`,children:[(0,Q.jsx)(`span`,{id:`create-owner-label`,className:`eyebrow text-muted-foreground`,children:`Select organization`}),(0,Q.jsx)(`div`,{role:`radiogroup`,"aria-labelledby":`create-owner-label`,"data-slot":`create-owner`,className:`-mx-1 grid max-h-64 content-start gap-2 overflow-y-auto px-1 py-0.5 md:max-h-none md:min-h-0 md:flex-1`,children:e.map((e,o)=>{let s=e.login===t;return(0,Q.jsxs)(`button`,{ref:e=>{i.current[o]=e},type:`button`,role:`radio`,"aria-checked":s,tabIndex:s?0:-1,disabled:n,"data-slot":`create-owner-option`,"data-owner":e.login,onClick:()=>r(e.login),onKeyDown:e=>{e.key===`ArrowDown`||e.key===`ArrowRight`?(e.preventDefault(),a(o,1)):(e.key===`ArrowUp`||e.key===`ArrowLeft`)&&(e.preventDefault(),a(o,-1))},className:G(`flex w-full items-center gap-3 rounded-lg border bg-card px-3 py-2.5 text-left outline-none transition-colors`,`focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,s?`border-primary bg-primary/5`:`border-border hover:bg-muted/50`),children:[(0,Q.jsx)(Bf,{owner:e}),(0,Q.jsxs)(`span`,{className:`grid min-w-0 flex-1 gap-0.5`,children:[(0,Q.jsxs)(`span`,{className:`flex items-center gap-1.5 truncate text-sm font-semibold`,children:[e.login,s?(0,Q.jsx)($a,{className:`size-4 shrink-0 text-primary`,"aria-hidden":`true`}):null]}),e.personal?(0,Q.jsx)(`span`,{className:`text-label text-muted-foreground`,children:`Personal account`}):e.description?(0,Q.jsx)(`span`,{className:`line-clamp-2 text-label text-muted-foreground`,children:e.description}):null]})]},e.login)})})]})}function Rf({slot:e,checked:t,disabled:n,title:r,hint:i,onSelect:a}){return(0,Q.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":t,disabled:n,"data-slot":e,onClick:a,className:G(`grid gap-0.5 rounded-md border px-3 py-2 text-left outline-none transition-colors`,`focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50`,t?`border-primary bg-primary/5`:`border-border hover:bg-muted/50`),children:[(0,Q.jsx)(`span`,{className:`text-sm font-medium`,children:r}),(0,Q.jsx)(`span`,{className:`text-label text-muted-foreground`,children:i})]})}function zf(){return(0,Q.jsxs)(`div`,{className:`grid gap-3`,"data-slot":`create-owners-loading`,"aria-hidden":`true`,children:[(0,Q.jsx)(`span`,{className:`eyebrow text-muted-foreground`,children:`Select organization`}),[0,1].map(e=>(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg border border-border px-3 py-2.5`,children:[(0,Q.jsx)(`span`,{className:`size-9 shrink-0 animate-pulse rounded-full bg-muted`}),(0,Q.jsx)(`span`,{className:`h-3 w-24 animate-pulse rounded bg-muted`})]},e))]})}function Bf({owner:e}){let[t,n]=(0,Z.useState)(!1),r=e.personal?`rounded-full`:`rounded-md`;return e.avatarUrl&&!t?(0,Q.jsx)(`img`,{src:e.avatarUrl,alt:``,width:36,height:36,loading:`lazy`,onError:()=>n(!0),"data-slot":`create-owner-avatar`,className:G(`size-9 shrink-0 bg-muted`,r)}):(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:G(`flex size-9 shrink-0 items-center justify-center bg-muted text-sm font-semibold text-muted-foreground uppercase`,r),children:e.login.slice(0,1)})}var Vf=class extends Z.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(e){console.error(`[cezar] ${this.props.label} failed to render`,e),Y(`${this.props.label} failed to open: ${e instanceof Error?e.message:String(e)}`,{tone:`danger`}),this.props.onError()}render(){return this.state.failed?null:this.props.children}};function Hf(e){return(0,Q.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,...e,children:(0,Q.jsx)(`path`,{d:`M12 1.9a10.1 10.1 0 0 0-3.2 19.7c.5.1.7-.2.7-.5v-1.8c-2.8.6-3.4-1.2-3.4-1.2-.5-1.2-1.1-1.5-1.1-1.5-.9-.6.1-.6.1-.6 1 .1 1.5 1 1.5 1 .9 1.6 2.4 1.1 3 .9.1-.7.4-1.1.6-1.4-2.2-.3-4.6-1.1-4.6-5 0-1.1.4-2 1-2.7-.1-.3-.4-1.3.1-2.7 0 0 .9-.3 2.8 1a9.6 9.6 0 0 1 5 0c1.9-1.3 2.8-1 2.8-1 .5 1.4.2 2.4.1 2.7.6.7 1 1.6 1 2.7 0 3.9-2.4 4.7-4.6 5 .4.3.7.9.7 1.9v2.8c0 .3.2.6.7.5A10.1 10.1 0 0 0 12 1.9z`})})}var Uf=[{to:`/`,label:`Tasks`,icon:ru,match:[`/`,`/tasks`,`/compare`],badge:`tasks-unread`},{to:`/inbox`,label:`Inbox`,icon:$l,match:[`/inbox`],badge:`inbox-count`,inbox:!0},{to:`/git`,label:`Git`,icon:xo,match:[`/git`]},{to:`/github`,label:`GitHub`,icon:Hf,match:[`/github`],forge:!0},{to:`/tracker`,label:`Tracker`,icon:Eu,match:[`/tracker`],tracker:!0},{to:`/assets`,label:`Assets`,icon:To,match:[`/assets`]},{to:`/automations`,label:`Automations`,icon:Pa,match:[`/automations`],automations:!0},{to:`/skills`,label:`Skills`,icon:Ba,match:[`/skills`],badge:`skills-update`},{to:`/workflows`,label:`Workflows`,icon:ts,match:[`/workflows`]},{to:`/settings`,label:`Settings`,icon:yu,match:[`/settings`]}];function Wf({forge:e=!1,inbox:t=!1,automations:n=!1,tracker:r}={}){return Uf.filter(i=>(!i.forge||e)&&(!i.inbox||t)&&(!i.automations||n)&&(!i.tracker||r!==void 0)).map(e=>e.tracker?{...e,label:r?ku[r].label:e.label}:e)}function Gf(e,t){return t===`/`?e===`/`:e===t||e.startsWith(t+`/`)}function Kf(e){let t=null;for(let n of Uf)for(let r of n.match)Gf(e,r)&&(t===null||r.length>t.length)&&(t={to:n.to,length:r.length});return t?.to??null}function qf(e){let t=Kf(e);return Uf.find(e=>e.to===t)??null}var Jf=`cez-theme`,Yf=`(prefers-color-scheme: light)`,Xf=`dark`,Zf={light:`#ffffff`,dark:`#0d0d0d`};function Qf(e){return e===`light`||e===`dark`||e===`system`?e:Xf}function $f(e,t){return e===`light`||e===`system`&&t?`light`:`dark`}function ep(){try{return Qf(localStorage.getItem(Jf))}catch{return Xf}}function tp(e){try{localStorage.setItem(Jf,e)}catch{}}function np(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(Yf).matches}function rp(e,t){e.classList.toggle(`light`,t===`light`),e.style.colorScheme=t,e.ownerDocument.querySelector(`meta[name="theme-color"]`)?.setAttribute(`content`,Zf[t])}var ip=Z.createContext(null);function ap({children:e}){let[t,n]=Z.useState(ep),[r,i]=Z.useState(np);Z.useEffect(()=>{let e=window.matchMedia?.(Yf);if(!e)return;i(e.matches);let t=e=>i(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let a=$f(t,r);Z.useLayoutEffect(()=>{rp(document.documentElement,a)},[a]);let o=Z.useCallback(e=>{n(e),tp(e)},[]),s=Z.useMemo(()=>({theme:t,resolvedTheme:a,setTheme:o}),[t,a,o]);return(0,Q.jsx)(ip.Provider,{value:s,children:e})}function op(){return Z.useContext(ip)?.resolvedTheme??$f(ep(),np())}function sp(){let e=Z.useContext(ip);if(!e)throw Error(`cezar: useTheme() must be called inside <ThemeProvider>`);return e}var cp={light:`dark`,dark:`system`,system:`light`},lp={light:Tu,dark:lu,system:cu},up={light:`light`,dark:`dark`,system:`system`};function dp({className:e}){let{theme:t,setTheme:n}=sp(),r=cp[t],i=lp[t];return(0,Q.jsx)(J,{type:`button`,variant:`ghost`,size:`icon-sm`,className:e,"data-slot":`theme-toggle`,"data-theme-pref":t,title:`Theme: ${up[t]}`,"aria-label":`Theme: ${up[t]}. Switch to ${up[r]}.`,onClick:()=>n(r),children:(0,Q.jsx)(i,{"aria-hidden":`true`})})}function fp(e){if(!Array.isArray(e))return[];let t=new Set;for(let n of e){if(typeof n!=`string`)continue;let e=n.trim();if(!(e===``||t.has(e))&&(t.add(e),t.size>=200))break}return[...t]}function pp(e){return[...e].sort((e,t)=>t.lastOpenedAt.localeCompare(e.lastOpenedAt))}function mp(e,t){let n=fp(t);if(n.length===0)return pp(e);let r=new Map(n.map((e,t)=>[e,t])),i=[],a=[];for(let t of e)r.has(t.id)?i.push(t):a.push(t);return i.sort((e,t)=>r.get(e.id)-r.get(t.id)),[...pp(a),...i]}function hp(e,t,n){return t===n||t<0||n<0||t>=e.length||n>=e.length?[...e]:$r([...e],t,n)}var gp=`regular`,_p=[{value:`regular`,label:`Regular`},{value:`automation`,label:`Automations`},{value:`all`,label:`All`}],vp=`cez-task-origin`;function yp(e){if(!e.deferredBinding)return e.automationId??e.automation?.automationId??e.automationTrigger?.automationId??e.automationTracker?.automationId}function bp(e,t){let n=yp(e);if(n!==void 0)return n;let r=e.dispatch?.rootRunId;if(r===void 0||r===e.id)return;let i=t(r);return i===void 0?void 0:yp(i)}function xp(e,t){return t===`all`?!0:t===`automation`?e!==void 0:e===void 0}function Sp(e){return e===`regular`||e===`automation`||e===`all`?e:gp}function Cp(){try{return Sp(localStorage.getItem(vp))}catch{return gp}}var wp=new Set,Tp;function Ep(e){try{localStorage.setItem(vp,e)}catch{Tp=e}for(let e of wp)e()}function Dp(){return Tp??Cp()}function Op(e){wp.add(e);let t=t=>{(t.key===null||t.key===`cez-task-origin`)&&e()};return window.addEventListener(`storage`,t),()=>{wp.delete(e),window.removeEventListener(`storage`,t)}}function kp(){return[Z.useSyncExternalStore(Op,Dp,()=>gp),Ep]}var Ap=`cezar:open-task-palette`;function jp(e){window.dispatchEvent(new CustomEvent(Ap,{detail:e}))}function Mp(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function Np(){let e=W(),t=bt(),n=Z.useRef(0),r=Z.useRef(Promise.resolve()),i=Z.useMemo(()=>fp(t.data?.sidebar?.projectOrder),[t.data?.sidebar?.projectOrder]),a=Z.useCallback(t=>{let i=e.getQueryData(V.uiState);if(i===void 0)return;let{projectOrder:a,...o}=Mp(i.sidebar),s=t===null?o:{...o,projectOrder:t};e.setQueryData(V.uiState,{...i,sidebar:s});let c=++n.current,l=r.current.then(async()=>{let t=await zt({sidebar:s},{keepalive:!0});c===n.current&&e.setQueryData(V.uiState,t)});r.current=l.catch(t=>{Y(t instanceof Error?t.message:String(t),{tone:`danger`}),c===n.current&&e.invalidateQueries({queryKey:V.uiState})})},[e]),o=Z.useCallback(e=>{let t=fp(e);t.length!==0&&a(t.slice(0,200))},[a]),s=Z.useCallback(()=>a(null),[a]);return{order:i,canReorder:t.data!==void 0,setOrder:o,reset:s}}var Pp=`cezar:open-command-palette`;function Fp(){window.dispatchEvent(new Event(Pp))}function Ip(e){return[...e].sort((e,t)=>Date.parse(t.createdAt)-Date.parse(e.createdAt))}function Lp(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,t]of a.entries()){let n=e=>e!==void 0&&/^#?\d+$/.test(e),r=n(t)||/^(pr|issue)$/.test(t)&&n(a[e+1]),s=0;for(let e=i.indexOf(t);e!==-1;e=i.indexOf(t,e+1)){let n=e===0||!/[a-z0-9]/.test(i[e-1]??``),a=!/[a-z0-9]/.test(i[e+t.length]??``);s=Math.max(s,r&&n&&a?1:(n?1:.5)*(a?1:.8)/(1+e/48))}if(s===0)return 0;o+=s}return o/a.length}var Rp=e=>({pullRequestUrl:e.pullRequestUrl,referencedPullRequestUrl:e.referencedPullRequestUrl,referencedPrCandidates:e.referencedPrCandidates,prNumber:e.prNumber,prRefs:e.prRefs,issueNumber:e.issueNumber,referencedIssueUrl:e.referencedIssueUrl,referencedIssueCandidates:e.referencedIssueCandidates,markerRefs:e.markerRefs});function zp(e,t,n){let r=Ip(e).map(e=>({projectId:t,id:e.id,title:e.title,titleSummary:e.titleSummary,titleOrigin:e.titleOrigin,status:e.status,activity:e.activity,createdAt:e.createdAt,finishedAt:e.finishedAt,seenAt:e.seenAt,archived:e.archived,autoResumeAt:e.autoResumeAt,awaitingAnswerSince:e.awaitingAnswerSince,idleClosedAt:e.idleClosedAt,workflow:e.workflow,branch:e.branch,startedAt:e.startedAt,lastActivityAt:p(e),...Zp(Rp(e)),...Zp({automationId:yp(e),dispatch:e.dispatch&&{rootRunId:e.dispatch.rootRunId,parentRunId:e.dispatch.parentRunId,kind:e.dispatch.kind}})})),i=new Set(r.map(Qp)),a=(n??[]).filter(e=>!i.has(Qp(e))).sort((e,t)=>t.createdAt.localeCompare(e.createdAt)),o=[...r,...a],s=new Map(o.map(e=>[e.id,e]));return o.map(e=>{if(e.automationId!==void 0)return e;let t=bp(e,e=>s.get(e));return t===void 0?e:{...e,automationId:t}})}var Bp=`w-12 text-right`;function Vp({label:e}){return(0,Q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 flex-1`,children:e}),(0,Q.jsxs)(`span`,{"aria-hidden":`true`,className:`flex shrink-0 gap-1 text-meta font-normal`,children:[(0,Q.jsx)(`span`,{className:G(Bp,`after:content-['Updated']`)}),(0,Q.jsx)(`span`,{className:G(Bp,`after:content-['Created']`)})]})]})}function Hp(e){return e.status===`running`&&e.activity!==`monitoring`}function Up(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:Gp().format(t)}var Wp,Gp=()=>Wp??=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`});function Kp(e,t,n=new Map){return e.map(e=>{let r=Ge(e),i=z(e,e.projectId===null?void 0:n.get(e.projectId)),a=i.map(e=>`${e.kind} #${e.number}`).join(` `),o=e.projectId===null?null:t.get(e.projectId)??null;return{task:e,key:Qp(e),label:r,references:a,refList:i,value:`task ${r} ${a} ${e.id}`,keywords:[...o?[o]:[],...e.automationId?[`automation`,`automatic`]:[]],projectName:o,title:`${Hp(e)?`Working now`:`Updated ${Up(e.lastActivityAt)}`} · created ${Up(e.createdAt)}`}})}function qp(e,t,n=50){if(t.trim()===``)return{shown:e.slice(0,n),total:e.length};let r=[];return e.forEach((e,n)=>{let i=Lp(e.value,t,e.keywords);i>0&&r.push({entry:e,score:i,index:n})}),r.sort((e,t)=>t.score-e.score||e.index-t.index),{shown:r.slice(0,n).map(e=>e.entry),total:r.length}}function Jp({entries:e,children:t}){let n=Ht(),r=Z.useMemo(()=>e.flatMap(e=>e.refList.map(t=>({projectId:e.task.projectId??n??``,kind:t.kind,number:t.number}))).filter(e=>e.projectId!==``),[e,n]),i=r.map(e=>`${e.projectId} ${e.kind}#${e.number}`).join(`|`),a=Z.useRef(r);a.current=r;let[o,s]=Z.useState(r);return Z.useEffect(()=>{let e=setTimeout(()=>s(a.current),250);return()=>clearTimeout(e)},[i]),(0,Q.jsx)(Da,{projectId:n,requests:o,children:t})}var Yp=`[&_[cmdk-group-items]]:flex [&_[cmdk-group-items]]:flex-col`;function Xp({hidden:e}){return e<=0?null:(0,Q.jsxs)(qc,{forceMount:!0,disabled:!0,value:`__more-tasks`,"data-slot":`palette-more-tasks`,className:`order-last py-1.5! text-xs text-soft-foreground data-[disabled=true]:opacity-100`,children:[e,` more — keep typing to narrow`]})}function Zp(e){return Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0))}var Qp=e=>`${e.projectId??``}/${e.id}`;function $p(e){let t=e.filter(e=>Ra(e)).sort((e,t)=>(t.finishedAt??``).localeCompare(e.finishedAt??``)),n=new Set(t.map(Qp));return{recentlyFinished:t,otherTasks:e.filter(e=>!n.has(Qp(e)))}}function em(e,t,n=[]){let r=mp(e,n);return[...r.filter(e=>e.id!==t),...r.filter(e=>e.id===t)]}function tm(){let e=Vc(),t=a(),n=T(),r=t.data,i=r?.bootProject??n.data?.bootProject??null,o=R(e,i),s=r!==void 0&&r.projects.length>1,c=Ee(s),l=c.data?.referenceStatuses;Z.useEffect(()=>{l&&Rt(l)},[l]);let u=Z.useMemo(()=>new Map((r?.projects??[]).map(e=>[e.id,e.name])),[r]),d=(e==="default"?null:e)??i,f=Z.useMemo(()=>zp(o.data??[],d,c.data?.runs),[o.data,d,c.data]),p=Je();return{activeProjectId:e,registry:r,health:n,multiProject:s,projectNames:u,repoBases:Z.useMemo(()=>{let e=new Map;for(let t of r?.projects??[])t.repoUrl&&e.set(t.id,t.repoUrl);return d&&p&&!e.has(d)&&e.set(d,p),e},[r,d,p]),runsProjectId:d,tasks:f}}function nm(e,t=``){let n=`/tasks/${e.id}${t}`;return e.projectId===null?n:Pc(e.projectId,n)}var rm=`cezar:palette-opened`;function im(e){window.dispatchEvent(new CustomEvent(rm,{detail:e}))}function am(e,t,n){Z.useEffect(()=>{t&&im(e)},[t,e]),Z.useEffect(()=>{let t=t=>{t.detail!==e&&n()};return window.addEventListener(rm,t),()=>window.removeEventListener(rm,t)},[e,n])}function om(){let[e,t]=Z.useState(!1),n=Fc();Vs(`k`,()=>t(e=>!e));let r=Z.useCallback(()=>{t(!1),n(`/new`)},[n]);Vs(`n`,r),ks(`c`,r),Z.useEffect(()=>{let e=()=>t(!0);return window.addEventListener(Pp,e),()=>window.removeEventListener(Pp,e)},[]);let i=Z.useCallback(()=>t(!1),[]);return am(`command`,e,i),Z.useEffect(()=>{e&&ec(`command`)},[e]),(0,Q.jsx)(Kc,{open:e,onOpenChange:e=>{e||Xs(`command`),t(e)},title:`Command palette`,description:`Search projects, tasks, views, actions, and skills`,showCloseButton:!1,filter:Lp,commandProps:{onKeyDown:Z.useCallback(e=>{if(e.key!==`Tab`||e.shiftKey||e.altKey||e.metaKey||e.ctrlKey)return;let n=e.currentTarget.querySelector(`[cmdk-item][data-selected="true"][data-slot="palette-task"]`),r=n?.dataset.runId;r&&(e.preventDefault(),tc(`cmdk_tab`),t(!1),jp({runId:r,projectId:n.dataset.projectId??null}))},[])},className:`top-[10vh] translate-y-0 sm:max-w-2xl lg:max-w-3xl xl:max-w-4xl`,children:(0,Q.jsx)(cm,{close:i})})}var sm=Z.memo(function({entry:e,showProject:t,now:n,onSelect:r,slot:i=`palette-task`,current:a=!1}){let{task:s,label:c,projectName:l}=e,u=o(s),d=s.projectId?e.refList[0]:void 0;return(0,Q.jsxs)(qc,{value:e.value,keywords:e.keywords,"data-slot":i,"data-run-id":s.id,"data-project-id":s.projectId??void 0,onSelect:()=>r(s),children:[(0,Q.jsx)(Nc,{tone:u.tone,pulse:u.pulse,"aria-label":u.label,role:`img`}),d&&s.projectId?(0,Q.jsx)(`span`,{"data-slot":`palette-task-refs`,className:`flex shrink-0 items-center gap-1 [&_svg]:size-3!`,onClick:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:(0,Q.jsx)(mo,{run:s,projectId:s.projectId,reference:d,compact:!0,className:`h-auto shrink-0 gap-[2px] px-1.5 py-px text-micro`})}):null,(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:c,children:Le(c,d?.number)?Ze(c).rest:c}),s.automationId?(0,Q.jsxs)(`span`,{"data-slot":`palette-task-automation`,title:`Started by an automation`,className:`flex shrink-0 items-center gap-0.5 text-xs text-soft-foreground`,children:[(0,Q.jsx)(Pa,{"aria-hidden":`true`,className:`size-3!`}),`auto`]}):null,t&&l?(0,Q.jsx)(`span`,{"data-slot":`palette-task-project`,className:`shrink-0 truncate text-xs text-soft-foreground`,children:l}):null,a?(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-primary`,children:`open`}):null,(0,Q.jsxs)(`span`,{"data-slot":`palette-task-age`,title:e.title,className:`flex shrink-0 gap-1 text-xs tabular-nums`,children:[(0,Q.jsx)(`span`,{"data-slot":`palette-task-updated`,className:G(Bp,`text-muted-foreground`),children:Hp(s)?`now`:Zc(s.lastActivityAt,n)}),(0,Q.jsx)(`span`,{"data-slot":`palette-task-created`,className:G(Bp,`text-soft-foreground`),children:Zc(s.createdAt,n)})]})]})});function cm({close:e}){let t=Fc(),n=Nr(),[r,i]=Z.useState(``),a=r.trim()!==``,o=Z.useRef(new Set);Z.useEffect(()=>{for(let e of rc(r))o.current.add(e)},[r]),Z.useEffect(()=>()=>lc(o.current),[]);let{theme:s,setTheme:c}=sp(),{activeProjectId:l,registry:u,health:d,multiProject:f,projectNames:p,repoBases:m,tasks:h}=tm(),g=d.data?.capabilities.managers===!0,_=zr(g),v=So(),y=oe(),b=Bt(),[x]=Z.useState(Date.now),{order:S}=Np(),C=Z.useMemo(()=>f&&u?em(u.projects,l,S):[],[f,u,l,S]),w=Z.useMemo(()=>{let{recentlyFinished:e,otherTasks:t}=$p(h);return{all:Kp(h,p,m),recentlyFinished:Kp(e,p,m),otherTasks:Kp(t,p,m)}},[h,p,m]),T=a?{shown:[],total:0}:qp(w.recentlyFinished,``,20),E=qp(a?w.all:w.otherTasks,r),D=f,O=b.data?.skillUsage,k=Z.useMemo(()=>Mo(y.data??[],O),[y.data,O]),A=n=>{e(),t(n)},j=t=>{e(),n(t)},ee=n=>{e(),t(Pc(n,`/`))},M=Z.useCallback(n=>{tc(`cmdk`),e(),t(nm(n))},[e,t]),N=cp[s];return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Hc,{placeholder:`Search projects, tasks, views, actions, skills…`,value:r,onValueChange:i}),(0,Q.jsxs)(Yc,{className:`max-h-[55vh] min-h-[14rem] sm:max-h-[60vh] lg:max-h-[68vh]`,children:[(0,Q.jsx)(Jc,{children:`Nothing matches.`}),(0,Q.jsx)(Wc,{children:(0,Q.jsxs)(qc,{value:`new task`,"data-slot":`palette-view`,"data-nav-to":`/new`,onSelect:()=>A(`/new`),children:[(0,Q.jsx)(Jo,{"aria-hidden":`true`}),`New task`,(0,Q.jsx)(Gc,{children:`C`})]})}),(0,Q.jsxs)(Jp,{entries:[...T.shown,...E.shown],children:[!a&&T.shown.length>0?(0,Q.jsxs)(Wc,{heading:(0,Q.jsx)(Vp,{label:`Recently finished`}),className:Yp,children:[T.shown.map(e=>(0,Q.jsx)(sm,{entry:e,showProject:D,now:x,onSelect:M},e.key)),(0,Q.jsx)(Xp,{hidden:T.total-T.shown.length})]}):null,(0,Q.jsxs)(Wc,{heading:`Views`,children:[f?(0,Q.jsxs)(qc,{value:`view All tasks`,"data-slot":`palette-view`,"data-nav-to":`/tasks`,onSelect:()=>j(`/tasks`),children:[(0,Q.jsx)(To,{"aria-hidden":`true`}),`All tasks`]}):null,Wf({forge:v!=null,inbox:d.data?.capabilities.followups===!0,automations:d.data?.capabilities.automations===!0,tracker:u?.projects.find(e=>e.id===(l??u.bootProject))?.tracker}).map(e=>{let t=e.icon;return(0,Q.jsxs)(qc,{value:`view ${e.label}`,"data-slot":`palette-view`,"data-nav-to":e.to,onSelect:()=>A(e.to),children:[(0,Q.jsx)(t,{"aria-hidden":`true`}),e.label]},e.to)}),g?(0,Q.jsxs)(qc,{value:`view Manager`,"data-slot":`palette-view`,"data-nav-to":`/manager`,onSelect:()=>j(`/manager`),children:[(0,Q.jsx)(ja,{"aria-hidden":`true`}),`Manager`]}):null,Ir(_.data?.managers??[]).map(e=>(0,Q.jsxs)(qc,{value:`manager ${e.name} ${e.id}`,"data-slot":`palette-manager`,"data-nav-to":`/manager/${e.id}`,onSelect:()=>j(`/manager/${encodeURIComponent(e.id)}`),children:[(0,Q.jsx)(ja,{"aria-hidden":`true`}),e.name]},e.id)),g?(0,Q.jsxs)(qc,{value:`new manager`,"data-slot":`palette-view`,"data-nav-to":`/manager/new`,onSelect:()=>j(`/manager/new`),children:[(0,Q.jsx)(Jo,{"aria-hidden":`true`}),`New manager`]}):null,(0,Q.jsxs)(qc,{value:`view global settings`,"data-slot":`palette-view`,"data-nav-to":`/settings/global`,onSelect:()=>j(`/settings/global`),children:[(0,Q.jsx)(yu,{"aria-hidden":`true`}),`Global settings`]})]}),C.length>0?(0,Q.jsx)(Wc,{heading:`Projects`,children:C.map(e=>{let t=e.id===l,n=e.status===`missing`;return(0,Q.jsxs)(qc,{value:`project ${e.name} ${e.id}`,keywords:[e.root],"data-slot":`palette-project`,"data-project-id":e.id,disabled:n,onSelect:()=>ee(e.id),children:[(0,Q.jsx)(Kl,{"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),n?(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-soft-foreground`,children:`folder not found`}):e.branch===void 0?null:(0,Q.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-soft-foreground`,children:e.branch}),t?(0,Q.jsx)(Wa,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},e.id)})}):null,E.shown.length>0?(0,Q.jsxs)(Wc,{heading:(0,Q.jsx)(Vp,{label:`Tasks`}),className:Yp,children:[E.shown.map(e=>(0,Q.jsx)(sm,{entry:e,showProject:D,now:x,onSelect:M},e.key)),(0,Q.jsx)(Xp,{hidden:E.total-E.shown.length})]}):null]}),(0,Q.jsx)(Wc,{heading:`Actions`,children:(0,Q.jsxs)(qc,{value:`action toggle theme`,"data-slot":`palette-action`,"data-action":`toggle-theme`,onSelect:()=>{c(N),e()},children:[(0,Q.jsx)(lu,{"aria-hidden":`true`}),`Toggle theme`,(0,Q.jsxs)(Gc,{className:`tracking-normal`,children:[s,` → `,N]})]})}),k.length>0?(0,Q.jsx)(Wc,{heading:`Skills`,children:k.map(e=>(0,Q.jsxs)(qc,{value:`skill ${e.name} ${e.path}`,keywords:e.description?[e.description]:void 0,"data-slot":`palette-skill`,"data-skill":e.name,onSelect:()=>A(`/new?skill=${encodeURIComponent(e.name)}`),children:[(0,Q.jsx)(`span`,{className:`shrink-0 font-medium`,children:e.name}),e.description?(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null]},e.path))}):null]})]})}function lm({className:e}){return(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`command-palette-hint`,title:`Search — command palette (⌘K / Ctrl+K)`,onClick:()=>Fp(),className:G(`flex w-full items-center gap-1.5 rounded-md border border-border bg-muted/30 px-2 py-1 text-left text-xs font-medium text-soft-foreground transition-colors hover:bg-muted hover:text-foreground`,e),children:[(0,Q.jsx)(Xo,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`truncate`,children:`Search…`}),(0,Q.jsx)(`kbd`,{"aria-hidden":`true`,className:`ml-auto shrink-0 rounded-[5px] border border-b-2 border-border bg-card px-[5px] py-px font-mono text-micro font-medium text-muted-foreground`,children:Os(`k`)})]})}function um(e){let t=zc(e);return t===`/settings`||t.startsWith(`/settings/`)}var dm=`cez-last-location`;function fm(){try{let e=localStorage.getItem(dm);return e===null?null:JSON.parse(e)}catch{return null}}function pm(e){try{localStorage.setItem(dm,JSON.stringify(e))}catch{}}var mm=new Set([`projectId`,`pathname`,`search`,`hash`]);function hm(e){if(typeof e!=`object`||!e||Array.isArray(e))return null;let t=e;if(Object.keys(t).some(e=>!mm.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/`)||um(t.pathname)||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(Ic(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 gm(e,t){let n=t.projects.find(t=>t.id===e);return n!==void 0&&n.status!==`missing`}function _m(e,t){if(t===void 0)return null;let n;try{n=Ic(e.pathname)}catch{return null}return n===null||!gm(n,t)?null:hm({projectId:n,pathname:e.pathname,...e.search===``?{}:{search:e.search},...e.hash===``?{}:{hash:e.hash}})}function vm(e,t,n){let r=hm(e);return r===null||!(t===void 0?n!==void 0&&r.projectId===n:gm(r.projectId,t))?null:`${r.pathname}${r.search??``}${r.hash??``}`}function ym(e,t){if(e===void 0)return t;let{projects:n}=e;return n.length===0||n.some(e=>e.id===t)?t:mp(n.filter(e=>e.status!==`missing`),[])[0]?.id??t}function bm(e,t){let n=hm(e);return n!==null&&n.projectId===t.projectId&&n.pathname===t.pathname&&(n.search??``)===(t.search??``)&&(n.hash??``)===(t.hash??``)}function xm(e){return(e?.providers??[]).filter(e=>e.status===`connected`&&e.enabled!==!1).map(e=>e.provider)}function Sm(e){if(e!==void 0)return xm(e).length>0}function Cm(e){let t=[];return e.worktreeSetupConfigured===!1&&t.push({id:`worktrees`,label:`Prepare worktrees`,description:`Install dependencies and copy env files into every task worktree.`,action:`Set up`,to:`/settings/worktrees`}),e.forge?.available===!1&&t.push({id:`github`,label:`Connect GitHub`,description:`Pull requests and issues need the GitHub CLI.`,action:`Connect`,to:`/github`}),t}var wm={claude:{install:`npm i -g @anthropic-ai/claude-code`,login:`claude`},codex:{install:`npm i -g @openai/codex`,login:`codex login`}};function Tm(e){let t=new Map((e?.providers??[]).map(e=>[e.provider,e]));return Object.keys(wm).flatMap(e=>{let n=wm[e];if(!n)return[];let r=t.get(e);if(r?.status===`connected`||r?.enabled===!1)return[];let i=r?.status===`disconnected`;return[{provider:e,label:Zs[e],state:i?`signed-out`:`missing`,command:i?n.login:n.install,login:n.login}]})}var Em=[{id:`task-tabs-2026-10`,preview:`tabs`,title:`Task tabs and layouts`,description:`Chat, Changes, Preview and Terminal as tabs in every task. Save a layout by name.`,releasedAt:`2026-10-19`},{id:`task-palette-2026-10`,preview:`palette`,title:`Task palette`,description:`Press ⌘P in a task to act on it or jump to another one.`,releasedAt:`2026-10-18`},{id:`design-mode-2026-10`,preview:`design`,title:`Design Mode`,description:`Point at any element of your running app and tell the agent what to change.`,releasedAt:`2026-10-17`,hero:{action:`Try it`,task:`Start the app’s dev server so I can review it in Preview.`},needs:`designMode`},{id:`worktree-scripts-2026-10`,preview:`scripts`,action:`Set up scripts`,title:`Worktree scripts`,description:`Install dependencies and copy env files into every new task worktree.`,releasedAt:`2026-10-17`,to:`/settings/worktrees`},{id:`workflow-editor-2026-10`,preview:`workflow`,action:`Open Workflows`,title:`Workflow editor`,description:`Build a workflow as a graph of steps and run it on a task.`,releasedAt:`2026-10-08`,to:`/workflows`},{id:`automations-2026-09`,preview:`automations`,action:`Open Automations`,title:`Automations`,description:`Start tasks on a schedule or from GitHub events, written as a prompt.`,releasedAt:`2026-09-15`,to:`/automations`,needs:`automations`}];function Dm(e,t){return e.needs===`designMode`?t.designMode===!0:e.needs!==`automations`||t.automations===!0}function Om(e){let t=new Set(e.dismissed??[]),n=Em.find(n=>n.hero&&!t.has(n.id)&&Dm(n,e));return n?.hero?{...n,hero:n.hero}:null}var km=864e5,Am=3,jm=36e5,Mm=60;function Nm(e){if(!e)return null;let t=new Date(e).getTime();return Number.isNaN(t)?null:t}function Pm(e,t){let n=new Date(t).toISOString(),r=Nm(e?.lastVisitAt);return r===null?{firstVisitAt:e?.firstVisitAt??n,lastVisitAt:n}:t-r<jm?null:t-r<14*km?{lastVisitAt:n}:{lastVisitAt:n,returnedFrom:e?.lastVisitAt,returnedAt:n}}function Fm(e,t){let n=Nm(e?.returnedAt),r=e?.returnedFrom;if(n===null||Nm(r)===null||!r||t-n>Am*km)return null;let i=Nm(e?.welcomeBackClosedAt);return i!==null&&i>=n?null:r}function Im(e,t){let n=Nm(e)??1/0;return Em.filter(e=>(Nm(e.releasedAt)??0)>n&&Dm(e,t))}function Lm(e,t,n){let r=Nm(e?.firstVisitAt),i=new Map;if(r===null)return i;let a=new Set(e?.dismissedAnnouncements??[]);for(let e of Em){let o=Nm(e.releasedAt);!e.to||o===null||a.has(e.id)||!Dm(e,t)||o<=r||n-o>Mm*km||i.has(e.to)||i.set(e.to,e.id)}return i}function Rm(e,t){return e!==`/`&&(t===e||t.startsWith(`${e}/`))}function zm(e){let t=e=>Nm(e.finishedAt)??Nm(e.startedAt)??Nm(e.createdAt)??0;return e.filter(e=>!e.archived&&nn(e)).sort((e,n)=>t(n)-t(e))}function Bm(e,t){let n=e[0],r=n?e.length>1?`${e.length} tasks are waiting for you`:n.status===`review`?`One task is ready for your review`:n.status===`waiting`||Et(n)?`One task is waiting for your answer`:`One task needs a look`:null,i=t===0?null:t===1?`there is a new feature to try`:`there are ${t} new features to try`;return r&&i?`${r}, and ${i}.`:r?`${r}.`:i?`${i.charAt(0).toUpperCase()}${i.slice(1)}.`:null}var Vm=90;function Hm(e,t){return Em.filter(n=>{let r=Nm(n.releasedAt);return r!==null&&t-r<=Vm*km&&Dm(n,e)})}function Um(e,t,n){let r=Nm(e?.firstVisitAt);if(r===null)return!1;let i=Math.max(r,Nm(e?.whatsNewSeenAt)??0);return Hm(t,n).some(e=>(Nm(e.releasedAt)??0)>i)}var Wm=()=>typeof matchMedia==`function`&&matchMedia(`(pointer: coarse)`).matches&&Math.min(screen.width,screen.height)<600,Gm=()=>/\bCezarMobile\//.test(navigator.userAgent);function Km(){return typeof matchMedia==`function`&&matchMedia(`(display-mode: standalone)`).matches||navigator.standalone===!0}var qm=()=>Wm()&&(Gm()||Km()),Jm;function Ym(e){Jm??=e}function Xm(e){return e===Jm}function Zm(e){return(e.agentCheckSkipped===!0||Sm(e.providers)===!0)&&(e.registry?.projects.some(e=>e.status===`ok`)??!1)}function Qm(e){return e.health===void 0&&!e.healthFailed?`wait`:e.health?.capabilities.managers===!0?e.registry===void 0&&!e.registryFailed||e.agentCheckSkipped===void 0&&!e.uiStateFailed||e.agentCheckSkipped!==!0&&e.providers===void 0&&!e.providersFailed?`wait`:Zm(e)?`manager`:`restore`:`restore`}function $m(e,t,n){let r=vm(e,t,n),i=r===null?n===void 0?null:ym(t,n):Ic(r.replace(/[?#].*$/,``));return i===null?`/`:`/p/${encodeURIComponent(i)}/`}var eh=`https://github.com/open-mercato/cezar`,th=`cez:star-toast-seen`;function nh(e){if(!Number.isFinite(e)||e<0)return`0`;let t=Math.floor(e);if(t<1e3)return String(t);let n=t/1e3,r=Math.floor(n*10)/10;return r<100?`${r.toFixed(1).replace(/\.0$/,``)}k`:`${Math.floor(n)}k`}var rh=`cez:star-ask`,ih=1500;function ah(e=uh()){if(!e)return null;try{let t=e.getItem(rh);if(t!==null){let e=JSON.parse(t);return{asks:Number.isInteger(e.asks)&&e.asks>=0?e.asks:3,...typeof e.lastAskedAt==`string`?{lastAskedAt:e.lastAskedAt}:{},...e.outcome===`starred`||e.outcome===`never`?{outcome:e.outcome}:{}}}let n=e.getItem(th);return n===null?{asks:0}:{asks:1,lastAskedAt:n}}catch{return null}}function oh(e,t=uh()){try{t?.setItem(rh,JSON.stringify(e))}catch{}}function sh(e,t){if(!e||e.outcome||e.asks>=3)return!1;if(!e.lastAskedAt)return!0;let n=Date.parse(e.lastAskedAt);return!Number.isFinite(n)||t-n>=12096e5}function ch(e){return(e??[]).filter(e=>dh.has(e.status)).length}function lh(e){return e.visible&&e.focused&&!e.typing&&!e.dialogOpen&&e.now-e.lastInteractionAt>=0&&e.now-e.lastInteractionAt<=6e4}function uh(){try{return globalThis.localStorage??null}catch{return null}}var dh=new Set([`done`,`review`]);function fh(e,t){let n=new Map,r=!1,i=!1;for(let a of t??[]){n.set(a.id,a.status);let t=e.get(a.id);t===void 0||t===a.status||dh.has(a.status)&&(r=!0,a.pullRequestUrl&&(i=!0))}return{succeeded:r,withPullRequest:i,statuses:n}}var ph=[`354.6,217.3 511.0,307.6 421.0,359.6 354.6,321.2 267.9,371.2 267.9,471.3 444.6,573.3 354.6,625.3 177.9,523.3 177.9,319.3`,`177.9,284.6 354.6,182.6 354.6,78.7 177.9,180.7`,`354.6,372.3 397.0,396.8 397.0,445.8 354.6,470.3 312.1,445.8 312.1,396.8`,`483.7,372.3 526.1,396.8 526.1,445.8 483.7,470.3 441.2,445.8 441.2,396.8`],mh={x:177.9,y:78.7,width:348.2,height:546.6},hh={mark:26,name:19,gap:11.4};function gh({height:e=hh.mark,className:t}){return(0,Q.jsx)(`svg`,{"data-slot":`brand-mark`,"aria-hidden":`true`,focusable:`false`,viewBox:`${mh.x} ${mh.y} ${mh.width} ${mh.height}`,height:e,width:e*mh.width/mh.height,fill:`currentColor`,className:G(`shrink-0`,t),children:ph.map(e=>(0,Q.jsx)(`polygon`,{points:e},e))})}function _h({className:e,name:t=`cezar`,logoUrl:n=null}){return(0,Q.jsxs)(`span`,{"data-slot":`brand-lockup`,className:G(`flex min-w-0 items-center text-foreground`,e),style:{gap:hh.gap},children:[n?(0,Q.jsx)(`img`,{"data-slot":`brand-logo`,src:n,alt:``,className:`size-[26px] shrink-0 object-contain`}):(0,Q.jsx)(gh,{}),(0,Q.jsx)(`span`,{"data-slot":`brand-name`,className:G(`max-w-full truncate leading-none font-semibold tracking-normal`,t===`cezar`&&`lowercase`),style:{fontFamily:`var(--brand)`,fontSize:hh.name},children:t})]})}var vh=`relative flex h-9 flex-1 items-center justify-center rounded-[5px] text-ui font-semibold outline-none transition-colors focus-visible:ring-[3px] focus-visible:ring-ring/50`,yh=`bg-foreground text-background`,bh=`text-foreground hover:bg-background/60`;function xh({manager:e,attention:t,onNavigate:n}){let{pathname:r,search:i}=Dr();return(0,Q.jsxs)(`nav`,{"aria-label":`Mode`,"data-slot":`mode-switch`,className:`mx-2.5 mb-2 flex gap-0.5 rounded-md bg-muted-foreground/20 p-[3px]`,children:[(0,Q.jsx)(Or,{to:e?`/`:`${r}${i}`,"aria-current":e?void 0:`page`,onClick:n,className:G(vh,e?bh:yh),children:`Tasks`}),(0,Q.jsxs)(Or,{to:`/manager`,"aria-current":e?`page`:void 0,onClick:n,className:G(vh,e?yh:bh),children:[`Manager`,t?(0,Q.jsxs)(`span`,{"data-slot":`manager-attention`,className:`absolute top-1.5 right-2 flex`,children:[(0,Q.jsx)(`span`,{className:`size-1.5 rounded-full bg-info`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`, needs you`})]}):null]})]})}var Sh=`relative flex h-14 min-w-0 flex-1 flex-col items-center justify-center gap-0.5 text-meta font-medium text-muted-foreground outline-none transition-colors focus-visible:ring-[3px] focus-visible:ring-ring/50`,Ch=`font-semibold text-foreground`;function wh({manager:e,attention:t,menuOpen:n,onMore:r}){let i=zs(),o=T(),s=a(),c=Dr();if(i)return null;let l=s.data?.bootProject??o.data?.bootProject;return(0,Q.jsxs)(`nav`,{"aria-label":`App`,"data-slot":`phone-bottom-bar`,className:`flex border-t border-border bg-background md:hidden`,children:[(0,Q.jsxs)(Or,{to:`/manager`,"aria-current":e?`page`:void 0,className:G(Sh,e&&Ch),children:[(0,Q.jsx)(ja,{className:`size-5`,"aria-hidden":`true`}),`Manager`,t?(0,Q.jsxs)(`span`,{"data-slot":`bottom-bar-attention`,className:`absolute top-2 left-[calc(50%+8px)] flex`,children:[(0,Q.jsx)(`span`,{className:`size-1.5 rounded-full bg-info`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`, needs you`})]}):null]}),(0,Q.jsxs)(Or,{to:$m(_m(c,s.data)??fm(),s.data,l),"aria-current":e?void 0:`page`,className:G(Sh,!e&&Ch),children:[(0,Q.jsx)(ru,{className:`size-5`,"aria-hidden":`true`}),`Tasks`]}),(0,Q.jsxs)(`button`,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":n,onClick:r,className:Sh,children:[(0,Q.jsx)(uo,{className:`size-5`,"aria-hidden":`true`}),`More`]})]})}function Th({...e}){return(0,Q.jsx)(Qu,{"data-slot":`select`,...e})}function Eh({...e}){return(0,Q.jsx)(nd,{"data-slot":`select-value`,...e})}function Dh({className:e,size:t=`default`,children:n,...r}){return(0,Q.jsxs)(ed,{"data-slot":`select-trigger`,"data-size":t,className:G(`flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-card px-3 py-2 text-sm whitespace-nowrap shadow-xs 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-9 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,Q.jsx)(id,{asChild:!0,children:(0,Q.jsx)(Xa,{className:`size-4 opacity-50`})})]})}function Oh({className:e,children:t,position:n=`item-aligned`,align:r=`center`,...i}){return(0,Q.jsx)(cd,{children:(0,Q.jsxs)(ud,{"data-slot":`select-content`,className:G(`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,Q.jsx)(Ah,{}),(0,Q.jsx)(Td,{className:G(`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,Q.jsx)(jh,{})]})})}function kh({className:e,children:t,...n}){return(0,Q.jsxs)(Fd,{"data-slot":`select-item`,className:G(`relative flex w-full cursor-pointer 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,Q.jsx)(`span`,{"data-slot":`select-item-indicator`,className:`absolute right-2 flex size-3.5 items-center justify-center`,children:(0,Q.jsx)(zd,{children:(0,Q.jsx)(Wa,{className:`size-4`})})}),(0,Q.jsx)(Ld,{children:t})]})}function Ah({className:e,...t}){return(0,Q.jsx)(Vd,{"data-slot":`select-scroll-up-button`,className:G(`flex cursor-pointer items-center justify-center py-1`,e),...t,children:(0,Q.jsx)(Pl,{className:`size-4`})})}function jh({className:e,...t}){return(0,Q.jsx)(Ud,{"data-slot":`select-scroll-down-button`,className:G(`flex cursor-pointer items-center justify-center py-1`,e),...t,children:(0,Q.jsx)(Xa,{className:`size-4`})})}function Mh(e){return/^\d/.test(e)&&!e.includes(`+`)?`v${e}`:e}function Nh(e,t){return!!t&&e.activeRuns>0&&e.scheduled?.target!==t}function Ph({label:e=`Update when idle`,doing:t,onClick:n,disabled:r}){return(0,Q.jsx)(os,{delayDuration:300,children:(0,Q.jsxs)(ss,{children:[(0,Q.jsx)(is,{asChild:!0,children:(0,Q.jsx)(J,{variant:`outline`,size:`sm`,onClick:n,disabled:r,children:e})}),(0,Q.jsxs)(as,{"data-slot":`update-when-idle-tooltip`,side:`bottom`,className:`max-w-64`,children:[`Waits until no task is running or queued, then `,t,` and restarts. Tasks waiting on your reply don't hold it up. You can close this window and keep working.`]})]})})}function Fh(e){let t=/-pr(\d+)\./.exec(e);return t?Number(t[1]):null}function Ih({data:e,onApply:t,onSchedule:n,applying:r}){let i=Re(),a=_t(),[o,s]=(0,Z.useState)(`worktrees`),[c,l]=(0,Z.useState)(``),[u,d]=(0,Z.useState)(null),[f,p]=(0,Z.useState)(!1),m=e.job?.status===`running`||e.job?.status===`restarting`,h=e.installed.find(e=>e.active),g=i.data?.checkouts??[],_=i.data?.pulls,v=!i.data||g.length>0,y=v?o:`pulls`,b=c.trim().toLowerCase(),x=(0,Z.useMemo)(()=>g.filter(e=>!b||[e.branch,e.task?.title,e.task?.id,e.commit?.subject,e.worktree,e.pr?`#${e.pr}`:``].filter(Boolean).some(e=>e.toLowerCase().includes(b))),[g,b]),S=(0,Z.useMemo)(()=>(_?.items??[]).filter(e=>!e.version&&!f?!1:!b||[`#${e.number}`,String(e.number),e.title,e.branch,e.author??``].some(e=>e.toLowerCase().includes(b))),[_,b,f]),C=(_?.items??[]).filter(e=>!e.version).length,w=y===`worktrees`?g.find(e=>e.id===u):void 0,T=y===`pulls`?_?.items.find(e=>e.version&&e.version===u):void 0,E=w?.id??T?.version??null,D=!!w&&(!w.built||w.stale),O=!!E&&E===h?.id&&!D,k=T&&!T.installed?`Install & restart`:D?`${w.built?`Rebuild`:`Build`} & ${w.id===h?.id?`restart`:`switch`}`:`Switch & restart`;return(0,Q.jsxs)(`div`,{"data-slot":`self-update-development`,className:`flex min-w-0 flex-col gap-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`div`,{role:`tablist`,"aria-label":`Development builds`,className:`flex rounded-md border border-border bg-muted/40 p-0.5`,children:[...v?[{value:`worktrees`,label:`Worktrees`,count:g.length}]:[],{value:`pulls`,label:`Pull requests`,count:(_?.items.length??0)-C}].map(e=>(0,Q.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":y===e.value,onClick:()=>{s(e.value),d(null)},className:G(`rounded-[5px] px-3 py-1 text-label font-semibold transition-colors`,y===e.value?`bg-card text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`),children:[e.label,i.data?(0,Q.jsx)(`span`,{className:`ml-1.5 font-normal text-muted-foreground`,children:e.count}):null]},e.value))}),(0,Q.jsx)(J,{variant:`ghost`,size:`sm`,onClick:()=>a.mutate(),disabled:a.isPending||i.isFetching,children:a.isPending?`Refreshing…`:`Refresh`})]}),(0,Q.jsx)(qs,{"aria-label":`Filter`,value:c,onChange:e=>l(e.target.value),placeholder:y===`worktrees`?`Filter by task, branch, commit or #PR`:`Filter by #number, title, branch or author`,className:`h-8 text-ui`}),(0,Q.jsx)(`div`,{className:`max-h-72 min-h-24 overflow-y-auto rounded-md border border-border`,children:i.isPending?(0,Q.jsx)(`p`,{className:`px-3 py-3 text-label text-muted-foreground`,children:`Looking for worktrees and pull requests…`}):i.error?(0,Q.jsx)(`p`,{className:`px-3 py-3 text-label text-danger`,children:i.error.message}):y===`worktrees`?(0,Q.jsxs)(Q.Fragment,{children:[x.length===0?(0,Q.jsx)(`p`,{className:`px-3 py-3 text-label text-muted-foreground`,children:`Nothing matches.`}):null,(0,Q.jsx)(`div`,{role:`listbox`,"aria-label":`Worktrees`,children:x.map(e=>(0,Q.jsx)(Rh,{checkout:e,active:e.id===h?.id,selected:u===e.id,onSelect:()=>d(e.id)},e.worktree))})]}):(0,Q.jsxs)(Q.Fragment,{children:[_&&!_.available?(0,Q.jsx)(`p`,{className:`px-3 py-2 text-label text-muted-foreground`,children:_.reason}):null,_?.available&&S.length===0?(0,Q.jsx)(`p`,{className:`px-3 py-3 text-label text-muted-foreground`,children:_.items.length===0?`No open pull requests on ${_.repo}.`:b?`Nothing matches.`:`No open pull request has a preview build.`}):null,(0,Q.jsx)(`div`,{role:`listbox`,"aria-label":`Pull requests`,children:S.map(e=>(0,Q.jsx)(zh,{pull:e,active:!!e.version&&e.version===h?.id,selected:!!e.version&&u===e.version,onSelect:()=>e.version&&d(e.version)},e.number))}),C>0?(0,Q.jsx)(`button`,{type:`button`,onClick:()=>p(e=>!e),className:`w-full border-t border-border px-3 py-2 text-left text-label text-muted-foreground hover:text-foreground`,children:f?`Hide the ${C} without a preview build`:`${C} more without a preview build (forks, CI not green yet) — show`}):null]})}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-2`,children:[(0,Q.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-meta text-muted-foreground`,title:w?.worktree,children:w?D?`${w.built?`Built before its last commit`:`Not built yet`} — runs npm run build in ${w.worktree} first (about a minute).`:w.worktree:T?`Installs ${T.version} from npm.`:y===`worktrees`?`Linked, not copied: a worktree that is not built, or built before its last commit, is built before the switch.`:`Preview builds CI publishes for green same-repo pull requests.`}),!O&&Nh(e,E)?(0,Q.jsx)(Ph,{label:`When idle`,doing:T?`${T.installed?`switches to`:`installs`} PR #${T.number}'s build`:`${D?`builds and switches to`:`switches to`} ${w.branch}`,onClick:()=>n(E),disabled:!e.canSelfUpdate||r||m}):null,(0,Q.jsx)(J,{size:`sm`,variant:`contrast`,onClick:()=>E&&t(E),disabled:!E||O||!e.canSelfUpdate||r||m,children:k})]})]})}function Lh({selected:e,disabled:t,onSelect:n,title:r,children:i}){return(0,Q.jsx)(`div`,{role:`option`,"aria-selected":e,"aria-disabled":t,tabIndex:t?-1:0,title:r,onClick:()=>!t&&n(),onKeyDown:e=>{!t&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),n())},className:G(`flex min-w-0 flex-col gap-0.5 border-b border-border px-3 py-2 last:border-b-0 outline-none`,t?`cursor-not-allowed opacity-55`:`cursor-pointer hover:bg-muted/50 focus-visible:bg-muted/60`,e&&`bg-primary/10 hover:bg-primary/10`),children:i})}function Rh({checkout:e,active:t,selected:n,onSelect:r}){let i=e.task?.title??e.commit?.subject??e.branch;return(0,Q.jsxs)(Lh,{selected:n,disabled:!e.id,onSelect:r,title:e.worktree,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-ui font-medium`,children:i}),e.pr?(0,Q.jsxs)(yf,{variant:`outline`,children:[`#`,e.pr]}):null,t?(0,Q.jsx)(yf,{variant:`secondary`,children:`current`}):null,e.built?e.stale?(0,Q.jsx)(yf,{variant:`outline`,children:`needs rebuild`}):null:(0,Q.jsx)(yf,{variant:`outline`,children:`not built`})]}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-meta text-muted-foreground`,children:[(0,Q.jsx)(`span`,{className:`shrink-0 font-mono`,children:e.branch}),e.task?(0,Q.jsxs)(`span`,{className:`shrink-0`,children:[`· `,e.task.status]}):null,e.commit?(0,Q.jsxs)(`span`,{className:`min-w-0 truncate`,children:[`· `,e.commit.sha,` `,e.task?e.commit.subject:``,` · `,Zc(e.commit.at),` ago`]}):null,e.builtAt?(0,Q.jsxs)(`span`,{className:`shrink-0`,children:[`· built `,Zc(e.builtAt),` ago`]}):null]})]})}function zh({pull:e,active:t,selected:n,onSelect:r}){return(0,Q.jsxs)(Lh,{selected:n,disabled:!e.version,onSelect:r,title:e.url,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsxs)(`span`,{className:`shrink-0 text-ui text-muted-foreground`,children:[`#`,e.number]}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-ui font-medium`,children:e.title}),e.draft?(0,Q.jsx)(yf,{variant:`outline`,children:`draft`}):null,t?(0,Q.jsx)(yf,{variant:`secondary`,children:`current`}):e.version?e.installed?(0,Q.jsx)(yf,{variant:`outline`,children:`installed`}):null:(0,Q.jsx)(yf,{variant:`outline`,children:`no build`})]}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-meta text-muted-foreground`,children:[e.author?(0,Q.jsx)(`span`,{className:`shrink-0`,children:e.author}):null,(0,Q.jsxs)(`span`,{className:`min-w-0 truncate font-mono`,children:[`· `,e.branch]}),(0,Q.jsxs)(`span`,{className:`shrink-0`,children:[`· updated `,Zc(e.updatedAt),` ago`]}),e.version?(0,Q.jsxs)(`span`,{className:`shrink-0`,children:[`· build `,e.publishedAt?`${Zc(e.publishedAt)} ago`:e.version]}):null]})]})}function Bh({open:e,onOpenChange:t,autoApply:n,brandName:r=`cezar`}){let i=M(e),a=wn(),o=j(),s=un(),c=m(),l=Mt(),[u,d]=(0,Z.useState)(``),f=i.data,p=(0,Z.useRef)(null),h=(0,Z.useRef)(!1);return(0,Z.useEffect)(()=>{!n||h.current||!f||!f.canSelfUpdate||f.job||(h.current=!0,!(f.activeRuns>0)&&s.mutate(n))},[n,f,s]),(0,Q.jsx)(ws,{open:e,onOpenChange:e=>{!e&&f?.job?.status===`running`||t(e)},children:(0,Q.jsxs)(Ss,{"data-slot":`self-update-dialog`,className:`sm:max-w-xl`,ref:p,onOpenAutoFocus:e=>{e.preventDefault(),p.current?.focus()},children:[(0,Q.jsxs)(Ns,{children:[(0,Q.jsxs)(ys,{className:`flex items-center gap-2`,children:[(0,Q.jsxs)(`span`,{children:[r,` `,f?`v${f.version}`:``]}),(0,Q.jsx)(Kh,{data:f})]}),(0,Q.jsxs)(xs,{className:`sr-only`,children:[`Update `,r,`, pick a release channel or switch versions.`]})]}),f?(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-5`,children:[(0,Q.jsx)(Uh,{data:f,busy:o.isPending,onChange:e=>{d(``),o.mutate(e)}}),(0,Q.jsx)(Wh,{data:f,checking:a.isPending,onCheck:()=>a.mutate(),onApply:e=>s.mutate(e),onSchedule:e=>c.mutate(e),applying:s.isPending||c.isPending}),f.channel===`development`?(0,Q.jsx)(Ih,{data:f,onApply:e=>s.mutate(e),onSchedule:e=>c.mutate(e),applying:s.isPending||c.isPending}):(0,Q.jsx)(Gh,{data:f,picked:u,onPick:d,onApply:e=>s.mutate(e),onSchedule:e=>c.mutate(e),applying:s.isPending||c.isPending}),f.canSelfUpdate?null:(0,Q.jsx)(qh,{data:f}),f.scheduled?(0,Q.jsxs)(`div`,{"data-slot":`self-update-scheduled`,className:`flex items-center justify-between gap-3 rounded-md border border-primary/40 bg-primary/5 px-3 py-2 text-label`,children:[(0,Q.jsxs)(`p`,{className:`min-w-0`,children:[r,` switches to `,(0,Q.jsx)(`span`,{className:`font-semibold`,children:Mh(f.scheduled.target)}),` as soon as no task is running. You can close this window and keep working.`]}),(0,Q.jsx)(J,{variant:`ghost`,size:`sm`,onClick:()=>l.mutate(),disabled:l.isPending,children:`Cancel`})]}):f.activeRuns>0&&f.canSelfUpdate?(0,Q.jsxs)(`p`,{className:`rounded-md border border-pending/50 bg-pending/10 px-3 py-2 text-label text-foreground`,children:[f.activeRuns,` task`,f.activeRuns===1?` is`:`s are`,` running. A restart interrupts them; `,r,` re-queues or resumes them on the way back up.`,` `,`The “when idle” buttons wait for them to finish instead.`]}):null,o.error?(0,Q.jsxs)(`p`,{className:`text-label text-danger`,children:[`Could not switch the channel: `,o.error.message,o.variables===`development`?` The running ${r} server predates the Development channel — restart ${r} to load it.`:null]}):null,s.error?(0,Q.jsx)(`p`,{className:`text-label text-danger`,children:s.error.message}):null,c.error?(0,Q.jsx)(`p`,{className:`text-label text-danger`,children:c.error.message}):null,l.error?(0,Q.jsx)(`p`,{className:`text-label text-danger`,children:l.error.message}):null,f.job?(0,Q.jsx)(Jh,{data:f}):null]}):i.error?(0,Q.jsx)(`p`,{className:`text-ui text-danger`,children:i.error.message}):null]})})}var Vh=[{value:`stable`,label:`Stable`},{value:`nightly`,label:`Nightly`},{value:`development`,label:`Development`}],Hh={stable:`Tagged releases.`,nightly:`A fresh build of main every night.`,development:`A cezar worktree or an open pull request. Never updates on its own.`};function Uh({data:e,busy:t,onChange:n}){return(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`div`,{className:`text-ui font-semibold`,children:`Release channel`}),(0,Q.jsx)(`div`,{className:`text-label text-muted-foreground`,children:Hh[e.channel]})]}),(0,Q.jsx)(`div`,{role:`radiogroup`,"aria-label":`Release channel`,"data-slot":`channel-toggle`,className:`flex shrink-0 rounded-md border border-border bg-muted/40 p-0.5`,children:Vh.map(r=>{let i=e.channel===r.value;return(0,Q.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":i,disabled:t,onClick:()=>!i&&n(r.value),className:G(`rounded-[5px] px-3 py-1 text-label font-semibold transition-colors`,i?`bg-card text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`),children:r.label},r.value)})})]})}function Wh({data:e,checking:t,onCheck:n,onApply:r,onSchedule:i,applying:a}){let o=e.job?.status===`running`||e.job?.status===`restarting`,s=e.installed.find(e=>e.active),c=s?.source===`registry`?Fh(s.version):null,l=s&&(s.source===`link`||s.source===`local`||c!==null)?s:null;if(l||e.channel===`development`){let i=e.channel===`development`?null:e.latest[e.channel],s=i!==null&&e.installed.some(e=>e.source===`registry`&&e.id===i);return(0,Q.jsxs)(`div`,{"data-slot":`self-update-latest`,className:`flex flex-col gap-2 rounded-md border border-border bg-card px-3 py-2.5`,children:[(0,Q.jsx)(`div`,{className:`min-w-0 text-ui break-words`,children:l?.source===`link`?(0,Q.jsxs)(Q.Fragment,{children:[`Running worktree `,(0,Q.jsx)(`span`,{className:`font-mono text-label font-semibold`,children:l.branch??l.id}),`, not a release.`]}):l?.source===`local`?(0,Q.jsx)(Q.Fragment,{children:`Running a local build, not a release.`}):c===null?(0,Q.jsxs)(Q.Fragment,{children:[`Running `,(0,Q.jsxs)(`span`,{className:`font-semibold`,children:[`v`,e.version]}),`. Pick a worktree or a pull request below.`]}):(0,Q.jsxs)(Q.Fragment,{children:[`Running the preview build of `,(0,Q.jsxs)(`span`,{className:`font-semibold`,children:[`PR #`,c]}),`, not a release.`]})}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-3 gap-y-2`,children:[(0,Q.jsx)(`div`,{className:`min-w-0 text-meta break-words text-muted-foreground`,children:e.channel===`development`?`Switch the channel back to Stable or Nightly to follow releases again.`:e.checkedAt?(0,Q.jsxs)(Q.Fragment,{children:[i?(0,Q.jsxs)(Q.Fragment,{children:[`Newest `,e.channel,`: `,(0,Q.jsxs)(`span`,{className:`font-mono text-foreground`,children:[`v`,i]}),` ·`,` `]}):null,`checked `,new Date(e.checkedAt).toLocaleTimeString()]}):`The npm registry has not answered yet.`}),e.channel===`development`?null:(0,Q.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:[(0,Q.jsx)(J,{variant:`ghost`,size:`sm`,onClick:n,disabled:t||o,children:t?`Checking…`:`Check again`}),i?(0,Q.jsx)(J,{size:`sm`,"aria-label":s?`Back to v${i}`:`Install v${i} & restart`,onClick:()=>r(i),disabled:!e.canSelfUpdate||a||o,children:s?`Switch back`:`Install & restart`}):null]})]})]})}let u=e.updateAvailable;return(0,Q.jsxs)(`div`,{"data-slot":`self-update-latest`,className:G(`flex flex-wrap items-center justify-between gap-x-3 gap-y-2 rounded-md border px-3 py-2.5`,u?`border-primary/40 bg-primary/5`:`border-border bg-card`),children:[(0,Q.jsxs)(`div`,{className:`min-w-[14rem] flex-1 text-ui break-words`,children:[e.checkedAt?u?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`span`,{className:`font-semibold`,children:[`v`,u]}),` is available on `,e.channel,`.`]}):(0,Q.jsxs)(Q.Fragment,{children:[`You are on the newest `,e.channel,` version`,e.channel===`nightly`&&e.latest.nightly?` (v${e.latest.nightly})`:``,`.`]}):(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:`The npm registry has not answered yet.`}),e.checkedAt?(0,Q.jsxs)(`div`,{className:`text-meta text-muted-foreground`,children:[`checked `,new Date(e.checkedAt).toLocaleTimeString()]}):null]}),(0,Q.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:[(0,Q.jsx)(J,{variant:`ghost`,size:`sm`,onClick:n,disabled:t||o,children:t?`Checking…`:`Check again`}),Nh(e,u)?(0,Q.jsx)(Ph,{doing:`installs ${Mh(u)}`,onClick:()=>i(u),disabled:!e.canSelfUpdate||a||o}):null,u?(0,Q.jsx)(J,{size:`sm`,onClick:()=>r(u),disabled:!e.canSelfUpdate||a||o,children:`Update & restart`}):null]})]})}function Gh({data:e,picked:t,onPick:n,onApply:r,onSchedule:i,applying:a}){let o=e.job?.status===`running`||e.job?.status===`restarting`,s=(0,Z.useMemo)(()=>{let t=e.channel===`stable`?e.installed.filter(e=>e.source===`local`).map(e=>({value:e.id,label:`v${e.version} · local build`,installed:!0,active:e.active})):[],n=e.available.filter(t=>t.channel===e.channel).map(t=>({value:t.version,label:`v${t.version}${t.publishedAt?` · ${t.publishedAt.slice(0,10)}`:``}`,installed:t.installed,active:e.installed.some(e=>e.active&&e.id===t.version)}));return[...t,...n]},[e]),c=s.find(e=>e.value===t);return(0,Q.jsxs)(`div`,{"data-slot":`self-update-picker`,className:`flex min-w-0 flex-col gap-2`,children:[(0,Q.jsxs)(`div`,{className:`text-ui font-semibold`,children:[`Pick a version `,(0,Q.jsxs)(`span`,{className:`font-normal text-muted-foreground`,children:[`· `,e.channel]})]}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsxs)(Th,{value:t,onValueChange:n,disabled:s.length===0||o,children:[(0,Q.jsx)(Dh,{size:`sm`,"aria-label":`Version`,className:`w-0 min-w-0 flex-1 text-ui`,children:(0,Q.jsx)(Eh,{placeholder:s.length===0?`No versions known`:`Choose a version to install`})}),(0,Q.jsx)(Oh,{className:`max-h-72`,children:s.map(e=>(0,Q.jsx)(kh,{value:e.value,children:(0,Q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[e.label,e.active?(0,Q.jsx)(yf,{variant:`secondary`,children:`current`}):e.installed?(0,Q.jsx)(yf,{variant:`outline`,children:`installed`}):null]})},e.value))})]}),c&&!c.active&&Nh(e,c.value)?(0,Q.jsx)(Ph,{label:`When idle`,doing:`${c.installed?`switches to`:`installs`} ${Mh(c.value)}`,onClick:()=>i(c.value),disabled:!e.canSelfUpdate||a||o}):null,(0,Q.jsx)(J,{size:`sm`,variant:`contrast`,onClick:()=>c&&r(c.value),disabled:!c||c.active||!e.canSelfUpdate||a||o,children:c?.installed?`Switch & restart`:`Install & restart`})]}),(0,Q.jsx)(`p`,{className:`text-meta text-muted-foreground`,children:`Any version, older ones included. Installed versions stay on disk, so switching back is instant.`})]})}function Kh({data:e}){let t=e?.installed.find(e=>e.active);if(t?.source===`local`)return(0,Q.jsx)(yf,{variant:`outline`,children:`local build`});if(t?.source===`link`)return(0,Q.jsxs)(yf,{variant:`outline`,children:[`worktree · `,t.branch??t.id]});let n=t?Fh(t.version):null;return n===null?null:(0,Q.jsxs)(yf,{variant:`outline`,children:[`PR #`,n,` build`]})}function qh({data:e}){let t=e.installKind===`checkout`?`node packages/cezar/dist/index.js install`:e.installKind===`global-npm`?`cezar install`:`npx cezar-cli install`;return(0,Q.jsxs)(`div`,{"data-slot":`self-update-install-hint`,className:`rounded-md border border-border bg-muted/40 px-3 py-2.5 text-label`,children:[(0,Q.jsx)(`p`,{children:e.reason}),(0,Q.jsx)(`p`,{className:`mt-1.5 text-muted-foreground`,children:`Run this once, then start cezar with the plain command:`}),(0,Q.jsx)(`pre`,{className:`mt-1.5 overflow-x-auto rounded bg-background px-2 py-1.5 font-mono text-label`,children:t})]})}function Jh({data:e}){let t=e.job,n=W(),r=(0,Z.useRef)(null),[i,a]=(0,Z.useState)(`waiting`);return(0,Z.useEffect)(()=>{r.current?.scrollTo({top:r.current.scrollHeight})},[t.log.length]),(0,Z.useEffect)(()=>{if(t.status!==`restarting`)return;let r=!1,i=Date.now(),o=()=>{a(`back`),n.removeQueries({queryKey:V.selfUpdate}),window.setTimeout(()=>window.location.reload(),400)},s=async()=>{if(!r){try{if((await on()).version!==e.version)return o();let t=await zn().catch(()=>null);if(t&&!t.job)return o()}catch{}if(Date.now()-i>9e4){a(`timeout`);return}window.setTimeout(s,1e3)}};return window.setTimeout(s,1500),()=>{r=!0}},[t.status,e.version,n]),(0,Q.jsxs)(`div`,{"data-slot":`self-update-job`,className:`flex min-w-0 flex-col gap-1.5`,children:[(0,Q.jsx)(`div`,{className:`flex items-center justify-between text-label`,children:(0,Q.jsx)(`span`,{className:`font-semibold`,children:t.status===`running`?`Installing ${t.target}…`:t.status===`failed`?`Install of ${t.target} failed`:i===`back`?`Back — reloading`:i===`timeout`?`Restart took too long — reload the page by hand`:`Restarting into ${t.target}…`})}),(0,Q.jsx)(`pre`,{ref:r,className:`max-h-40 min-w-0 overflow-y-auto rounded-md border border-border bg-background px-2 py-1.5 font-mono text-meta leading-[1.5] break-all whitespace-pre-wrap text-muted-foreground`,children:t.log.join(`
|
|
3
|
+
`)}),t.error?(0,Q.jsx)(`p`,{className:`text-label text-danger`,children:t.error}):null]})}var Yh=`cez-sidebar-width`;function Xh(e){let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?Math.min(420,Math.max(264,Math.round(t))):264}function Zh(){try{let e=localStorage.getItem(Yh);return e===null?264:Xh(e)}catch{return 264}}function Qh(e){try{localStorage.setItem(Yh,String(Xh(e)))}catch{}}function $h(){let[e]=Z.useState(()=>{if(typeof document>`u`)return null;let e=document.documentElement.dataset.cezDesktop;return e===`macos`||e===`windows`||e===`linux`?e:null});return e}var eg=new Set;function tg(e){eg.add(e);let t=t=>{t.key!==null&&t.key!==`cez-sidebar-width`||(ng=null,e())};return window.addEventListener(`storage`,t),()=>{eg.delete(e),window.removeEventListener(`storage`,t)}}var ng=null;function rg(){return ng??Zh()}function ig(e){let t=Xh(e);Qh(t),ng=Zh()===t?null:t;for(let e of eg)e()}function ag(){return[Z.useSyncExternalStore(tg,rg,rg),ig]}var og=`cez-sidebar-folded`,sg=new Set,cg=null;function lg(){try{return localStorage.getItem(og)===`1`}catch{return!1}}function ug(){return cg??lg()}function dg(e){sg.add(e);let t=t=>{t.key!==null&&t.key!==`cez-sidebar-folded`||(cg=null,e())};return window.addEventListener(`storage`,t),()=>{sg.delete(e),window.removeEventListener(`storage`,t)}}function fg(e){try{e?localStorage.setItem(og,`1`):localStorage.removeItem(og)}catch{}cg=lg()===e?null:e;for(let e of sg)e()}function pg(){return[Z.useSyncExternalStore(dg,ug,ug),fg]}var mg=Ds()?`Meta+B`:`Control+B`;function hg({onFold:e,ref:t}){return(0,Q.jsx)(J,{ref:t,variant:`ghost`,size:`icon-sm`,"data-slot":`sidebar-fold`,"aria-label":`Hide sidebar`,"aria-keyshortcuts":mg,title:`Hide sidebar (${Hs(`Mod+B`)})`,onClick:e,className:`-mr-1.5 text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,Q.jsx)(mu,{className:`size-4`,"aria-hidden":`true`})})}function gg({slot:e=`sidebar`,width:t,onWidthChange:n,titlebarInset:r=!1,children:i}){return(0,Q.jsxs)(`aside`,{"data-slot":e,style:{width:t},className:G(`relative hidden shrink-0 flex-col border-r border-border bg-sidebar md:flex`,r&&`pt-[28px]`),children:[i,(0,Q.jsx)(_g,{width:t,onWidthChange:n})]})}function _g({width:e,onWidthChange:t}){let n=Z.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(Xh(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,Q.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(Xh(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-violet/40 focus-visible:bg-violet/60 focus-visible:outline-none`})}function vg({slot:e,title:t,children:n}){return(0,Q.jsxs)(pi,{side:`left`,"data-slot":e,showCloseButton:!1,className:`w-[264px] gap-0 border-border bg-sidebar p-0 sm:max-w-none md:hidden`,"aria-describedby":void 0,children:[(0,Q.jsx)(fi,{className:`sr-only`,children:t}),n((0,Q.jsx)(di,{asChild:!0,children:(0,Q.jsx)(J,{variant:`ghost`,size:`icon`,"aria-label":`Close menu`,className:`-mr-2 size-11`,children:(0,Q.jsx)(ns,{className:`size-[17px]`,"aria-hidden":`true`})})}))]})}var yg=[],bg=new Set;function xg(){for(let e of bg)e()}function Sg(e){return bg.add(e),()=>{bg.delete(e)}}function Cg(){return yg.length>0}function wg(e){let t={onExit:e};return yg.push(t),xg(),()=>{let e=yg.indexOf(t);e<0||(yg.splice(e,1),xg())}}function Tg(){for(let e of[...yg])e.onExit()}function Eg(){return(0,Z.useSyncExternalStore)(Sg,Cg,Cg)}var Dg=`(min-width: 768px)`,Og=Z.createContext(void 0),kg=Z.memo(function({children:e,mainRef:t}){return(0,Q.jsx)(`main`,{ref:t,"data-slot":`main`,className:`row-start-3 min-h-0 overflow-y-auto overscroll-contain`,children:e})});function Ag(){return Z.useContext(Og)}var jg=new Set;function Mg(e){return wr({path:`/tasks/:id`,end:!0},zc(e))!==null}var Ng=Z.memo(function({children:e,repo:t=null,inboxCount:n=null,unreadCount:r=null,skillsUpdateAvailable:i=!1,newNavItems:a=jg,version:o=null,latestVersion:s=null,starCount:c=null,taskQuickList:l,hostWidget:u,whatsNew:d,toolsMenu:f,forgeAvailable:p=!0,inboxAvailable:m=!0,automationsAvailable:h=!0,tracker:g,singleProject:_=!1,banner:v,footerBanner:y,projectGroups:b,brandName:x=`cezar`,brandLogoUrl:S=null,managersAvailable:C=!1,managerAttention:w=!1,managerSidebar:T,managerRail:E,projectSwitcher:D=null}){let{pathname:O}=Dr(),k=zc(O),A=Kf(k),j=qf(k),ee=j?.to===`/tracker`&&g?{...j,label:ku[g].label}:j,M=um(O),N=C&&tl(O),te=wr({path:`/tasks/:id/*`,end:!0},k)!==null,[ne,P]=Z.useState(!1),F=Z.useCallback(()=>P(!1),[]),re=Z.useCallback(()=>P(!0),[]),[I]=Z.useState(qm),ie=I&&C&&!M&&!te,L=Z.useRef(null),ae=Mg(O),[oe,se]=ag();Z.useLayoutEffect(()=>{if(ae)return;let e=L.current;e&&(e.scrollTop=0)},[O,ae]),Z.useEffect(()=>{P(!1)},[O]),Z.useEffect(()=>{let e=window.matchMedia?.(Dg);if(!e)return;e.matches&&P(!1);let t=e=>{e.matches&&P(!1)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let ce={activeTo:A,items:Z.useMemo(()=>Wf({forge:p,inbox:m,automations:h,tracker:g}),[p,m,h,g]),repo:t,inboxCount:m?n:null,unreadCount:r,skillsUpdateAvailable:i,newNavItems:a,version:o,latestVersion:s,starCount:c,taskQuickList:l,hostWidget:u,whatsNew:d,toolsMenu:f,projectGroups:b,singleProject:_,brandName:x,brandLogoUrl:S,managersAvailable:C,managerMode:N,managerAttention:w,managerSidebar:T,managerRail:E},R=$h(),z=Eg(),[le]=pg(),ue=!M&&(z||le);return(0,Q.jsxs)(`div`,{"data-slot":`app-shell`,"data-desktop":R??void 0,"data-chromeless":M?``:void 0,style:ie?{"--phone-bar":`3.5rem`}:void 0,className:`flex h-dvh overflow-hidden bg-background text-foreground pl-[env(safe-area-inset-left)] pr-[env(safe-area-inset-right)]`,children:[R===`macos`?(0,Q.jsx)(`div`,{"data-slot":`desktop-titlebar`,"data-tauri-drag-region":``,className:`fixed inset-x-0 top-0 z-[60] flex h-[28px] select-none items-center pl-[80px]`,children:o&&s&&s!==o?(0,Q.jsx)(Pg,{latestVersion:s,brandName:x}):null}):null,M?null:z?(0,Q.jsx)(Ig,{...ce,desktop:R}):(0,Q.jsx)(Fg,{...ce,width:oe,onWidthChange:se,desktop:R}),(0,Q.jsxs)(`div`,{className:G(`grid min-w-0 flex-1 grid-rows-[auto_auto_1fr_auto] overflow-hidden`,R===`macos`&&`pt-[28px]`),children:[M?null:(0,Q.jsxs)(hi,{open:ne,onOpenChange:P,children:[(0,Q.jsx)(Xg,{title:N?`Manager`:ee?.label??x,attention:C&&w&&!N}),(0,Q.jsx)(zg,{...ce,onNavigate:F})]}),ue&&!N?(0,Q.jsx)(Rg,{switcher:D,fallbackName:t?.name??x,activeTo:A}):null,v?(0,Q.jsx)(`div`,{"data-slot":`banner-slot`,className:`row-start-2`,children:v}):null,(0,Q.jsx)(kg,{mainRef:L,children:e}),(0,Q.jsxs)(`div`,{"data-slot":`composer`,className:`row-start-4 pb-[env(safe-area-inset-bottom)]`,children:[y,ie?(0,Q.jsx)(wh,{manager:N,attention:w,menuOpen:ne,onMore:re}):null]})]})]})});function Pg({latestVersion:e,brandName:t}){let[n,r]=Z.useState(!1);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`titlebar-update`,onClick:()=>r(!0),title:`Update ${t} to v${e} and restart`,className:`inline-flex h-[18px] items-center gap-1 rounded-full border border-primary/40 bg-primary/15 px-2 text-meta font-semibold text-foreground transition-colors hover:bg-primary/30`,children:[(0,Q.jsx)(Nc,{tone:`pending`,pulse:!0,className:`size-[5px] shrink-0`}),`Update `,t,(0,Q.jsxs)(`span`,{className:`font-mono font-medium text-muted-foreground`,children:[`v`,e]})]}),n?(0,Q.jsx)(Bh,{open:n,onOpenChange:r,autoApply:e,brandName:t}):null]})}var Fg=Z.memo(function({width:e,onWidthChange:t,desktop:n=null,...r}){let[i,a]=pg(),[o,s]=Z.useState(!1),c=Z.useRef(null);Z.useEffect(()=>{o&&!i&&c.current?.focus()},[o,i]);let l=e=>{s(!0),a(e)};return Vs(`b`,()=>{if(bs())return;let e=document.activeElement;s(!e||e===document.body||e.closest(`[data-slot="sidebar"], [data-slot="sidebar-rail"]`)!==null),a(!i)},{inEditable:!0}),i?(0,Q.jsx)(Lg,{...r,slot:`sidebar-rail`,onExpand:()=>l(!1),expandTitle:`Show sidebar (${Hs(`Mod+B`)})`,expandShortcut:mg,autoFocus:o,desktop:n}):(0,Q.jsx)(gg,{width:e,onWidthChange:t,titlebarInset:n===`macos`,children:(0,Q.jsx)(Bg,{...r,compactHeader:n===`macos`,headerAction:(0,Q.jsx)(hg,{ref:c,onFold:()=>l(!0)})})})});function Ig({desktop:e,...t}){return Vs(`b`,()=>{bs()||Tg()},{inEditable:!0}),(0,Q.jsx)(Lg,{...t,slot:`focus-sidebar-rail`,onExpand:Tg,expandTitle:`Show sidebar (${Hs(`Mod+B`)}, turns Focus off)`,expandShortcut:mg,desktop:e})}function Lg({slot:e,items:t,activeTo:n,inboxCount:r,unreadCount:i,skillsUpdateAvailable:a,newNavItems:o,brandName:s,brandLogoUrl:c,managerMode:l,managerRail:u,onExpand:d,expandTitle:f,expandShortcut:p,autoFocus:m=!1,desktop:h}){return(0,Q.jsxs)(`aside`,{"data-slot":e,className:G(`hidden w-12 shrink-0 flex-col items-center gap-1 border-r border-border bg-sidebar pt-[max(env(safe-area-inset-top),0.75rem)] pb-[max(env(safe-area-inset-bottom),0.5rem)] md:flex`,h===`macos`&&`pt-[36px]`),children:[(0,Q.jsx)(`span`,{"data-slot":`rail-brand`,role:`img`,"aria-label":s,title:s,className:`flex h-8 items-center text-foreground`,children:c?(0,Q.jsx)(`img`,{src:c,alt:``,className:`size-[22px] object-contain`}):(0,Q.jsx)(gh,{height:22})}),l?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(J,{asChild:!0,variant:`contrast`,size:`icon-sm`,className:`mt-1`,children:(0,Q.jsx)(Or,{to:`/manager/new`,"data-slot":`rail-new-manager`,"aria-label":`New manager`,title:`New manager`,children:(0,Q.jsx)(Jo,{className:`size-4`,"aria-hidden":`true`})})}),u]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(J,{asChild:!0,variant:`contrast`,size:`icon-sm`,className:`mt-1`,children:(0,Q.jsx)(X,{to:`/new`,"data-slot":`rail-new-task`,"aria-label":`New task`,title:`New task (C)`,children:(0,Q.jsx)(Jo,{className:`size-4`,"aria-hidden":`true`})})}),(0,Q.jsx)(`nav`,{"aria-label":`Main`,className:`flex min-h-0 flex-col items-center gap-1 overflow-y-auto pt-2`,children:t.map(e=>{let t=e.icon,s=e.to===n,c=e.badge===`inbox-count`&&!!r||e.badge===`tasks-unread`&&!!i||e.badge===`skills-update`&&a||o.has(e.to);return(0,Q.jsxs)(X,{to:e.to,"aria-label":e.label,title:e.label,"aria-current":s?`page`:void 0,className:G(`relative flex size-8 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,s&&`bg-muted text-foreground`),children:[(0,Q.jsx)(t,{className:`size-4`,"aria-hidden":`true`}),c?(0,Q.jsx)(`span`,{"data-slot":`rail-marker`,"aria-hidden":`true`,className:`absolute top-1 right-1 size-1.5 rounded-full bg-violet`}):null]},e.to)})})]}),(0,Q.jsx)(J,{type:`button`,variant:`ghost`,size:`icon-sm`,"data-slot":e===`sidebar-rail`?`sidebar-unfold`:void 0,"data-action":e===`focus-sidebar-rail`?`expand-sidebar`:void 0,"aria-label":`Show sidebar`,"aria-keyshortcuts":p,title:f,autoFocus:m,onClick:d,className:`mt-auto shrink-0 text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,Q.jsx)(hu,{className:`size-4`,"aria-hidden":`true`})})]})}function Rg({switcher:e,fallbackName:t,activeTo:n}){let r=e?.activeName??t,i=e?.projects??[];return(0,Q.jsx)(`header`,{"data-slot":`project-header`,className:`row-start-1 hidden h-11 shrink-0 items-center border-b border-border bg-card px-3 md:flex`,children:i.length===0?(0,Q.jsx)(`span`,{"data-slot":`project-header-name`,className:`truncate px-2 text-body font-semibold`,children:r}):(0,Q.jsxs)(so,{children:[(0,Q.jsx)(to,{asChild:!0,children:(0,Q.jsxs)(J,{variant:`ghost`,size:`sm`,"data-slot":`project-switcher`,"aria-label":`Project: ${r} — switch project`,className:`min-w-0 gap-1.5 px-2 text-body font-semibold`,children:[(0,Q.jsx)(`span`,{className:`truncate`,children:r}),(0,Q.jsx)(Xa,{className:`size-4 shrink-0 text-muted-foreground`,"aria-hidden":`true`})]})}),(0,Q.jsxs)(ro,{align:`start`,className:`w-60`,children:[(0,Q.jsx)(eo,{className:`text-xs text-soft-foreground`,children:`Projects`}),(0,Q.jsx)(oo,{}),i.map(t=>{let r=t.id===e?.activeId;return(0,Q.jsx)(ao,{asChild:!0,children:(0,Q.jsxs)(Or,{to:`/p/${encodeURIComponent(t.id)}${n&&n!==`/`?n:`/`}`,"data-slot":`project-switcher-item`,"aria-current":r?`true`:void 0,children:[(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t.name}),r?(0,Q.jsx)(Wa,{className:`size-4`,"aria-hidden":`true`}):null]})},t.id)})]})]})})}var zg=Z.memo(function({onNavigate:e,...t}){return(0,Q.jsx)(vg,{slot:`mobile-nav-drawer`,title:`Navigation`,children:n=>(0,Q.jsx)(Bg,{...t,onNavigate:e,headerAction:n})})});function Bg({activeTo:e,items:t,repo:n,inboxCount:r,unreadCount:i,skillsUpdateAvailable:a,newNavItems:o,version:s,latestVersion:c,starCount:l,taskQuickList:u,hostWidget:d,whatsNew:f,toolsMenu:p,projectGroups:m,singleProject:h,brandName:g,brandLogoUrl:_,managersAvailable:v,managerMode:y,managerAttention:b,managerSidebar:x,onNavigate:S,headerAction:C,compactHeader:w=!1}){return(0,Q.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,Q.jsxs)(`div`,{className:G(`flex items-center gap-[9px] px-3.5 pb-2.5`,w?`pt-1.5`:`pt-3.5`),children:[(0,Q.jsx)(_h,{name:g,logoUrl:_}),n&&!m&&!y?(0,Q.jsxs)(`span`,{"data-slot":`repo-chip`,className:`ml-auto truncate font-mono text-meta font-medium text-soft-foreground`,children:[n.name,` / `,n.branch]}):null,C?(0,Q.jsx)(`div`,{className:G(`shrink-0`,(!n||m)&&`ml-auto`),children:C}):null]}),v?(0,Q.jsx)(xh,{manager:y,attention:b,onNavigate:S}):null,y?(0,Q.jsx)(`div`,{"data-slot":`manager-sidebar`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-2 pb-2`,children:(0,Q.jsx)(Og.Provider,{value:S,children:x})}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex gap-1.5 px-2.5 pt-1 pb-2`,children:[(0,Q.jsx)(J,{asChild:!0,variant:`contrast`,className:`relative min-w-0 flex-1 justify-center`,children:(0,Q.jsxs)(X,{to:`/new`,onClick:S,children:[(0,Q.jsx)(Jo,{className:`size-[15px]`,"aria-hidden":`true`}),`New task`,(0,Q.jsx)(`kbd`,{"aria-hidden":`true`,className:`absolute right-2.5 rounded-[5px] border border-b-2 border-contrast-foreground/25 bg-transparent px-[5px] py-px font-mono text-micro font-medium text-contrast-foreground/60`,children:`C`})]})}),h?null:(0,Q.jsx)(qg,{})]}),(0,Q.jsx)(`div`,{className:`shrink-0 px-1.5`,children:(0,Q.jsx)(Ug,{onNavigate:S})}),m?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`shrink-0 border-b border-border px-1.5 pt-0.5 pb-2`,children:(0,Q.jsx)(Wg,{onNavigate:S})}),(0,Q.jsx)(`div`,{"data-slot":`project-groups`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-1.5 pt-1.5 pb-2`,children:(0,Q.jsx)(Og.Provider,{value:S,children:m})})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`nav`,{"aria-label":`Main`,className:`px-2.5 py-1.5`,children:t.map(t=>{let n=t.to===e,s=t.icon;return(0,Q.jsxs)(X,{to:t.to,onClick:S,"aria-current":n?`page`:void 0,className:G(`flex h-11 w-full items-center gap-2.5 rounded-md px-2.5 text-ui font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground md:h-[34px]`,n&&`bg-muted font-semibold text-foreground`),children:[(0,Q.jsx)(s,{className:`size-4 shrink-0`,"aria-hidden":`true`}),t.label,t.badge===`inbox-count`&&r?(0,Q.jsx)(`span`,{"data-slot":`nav-badge`,className:`ml-auto rounded-full bg-violet px-1.5 py-px text-micro font-semibold text-violet-foreground`,children:r}):null,t.badge===`tasks-unread`&&i?(0,Q.jsx)(`span`,{"data-slot":`nav-unread-badge`,title:`${i} unread finished ${i===1?`task`:`tasks`}`,className:`ml-auto rounded-full bg-violet px-1.5 py-px text-micro font-semibold text-violet-foreground`,children:i}):null,t.badge===`skills-update`&&a?(0,Q.jsxs)(`span`,{"data-slot":`nav-update-marker`,className:`ml-auto flex items-center`,children:[(0,Q.jsx)(`span`,{className:`size-1.5 rounded-full bg-violet`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Skills update available`})]}):null,o.has(t.to)?(0,Q.jsxs)(`span`,{"data-slot":`nav-new-marker`,className:`ml-auto flex items-center`,children:[(0,Q.jsx)(`span`,{className:`size-1.5 rounded-full bg-violet`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`New`})]}):null]},t.to)})}),(0,Q.jsx)(`div`,{"data-slot":`task-quick-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-2.5 pb-2`,children:u})]})]}),(0,Q.jsxs)(`div`,{"data-slot":`sidebar-footer`,className:`flex flex-col gap-1.5 border-t border-border px-3.5 py-2.5`,children:[y?null:(0,Q.jsxs)(Q.Fragment,{children:[f,d,(0,Q.jsx)(lm,{})]}),Gm()?(0,Q.jsx)(Kg,{onNavigate:S}):null,(0,Q.jsxs)(`div`,{"data-slot":`sidebar-footer-controls`,className:`flex items-center gap-2`,children:[(0,Q.jsx)(`div`,{"data-slot":`tools-menu`,className:`shrink-0`,children:p}),s?(0,Q.jsx)(Jg,{version:s,latestVersion:c,brandName:g}):null,l===null?null:(0,Q.jsx)(Yg,{count:l}),(0,Q.jsx)(Gg,{onNavigate:S,className:`ml-auto`}),(0,Q.jsx)(dp,{})]})]})]})}var Vg=`flex h-11 w-full items-center gap-2.5 rounded-md px-2.5 text-ui font-semibold text-foreground transition-colors hover:bg-muted md:h-9`;function Hg(e){return G(`size-4 shrink-0`,e?`text-violet`:`text-violet/70`)}function Ug({onNavigate:e}){return(0,Q.jsx)(Ar,{to:`/dashboard`,"data-slot":`dashboard-link`,onClick:e,className:({isActive:e})=>G(Vg,e&&`bg-muted`),children:({isActive:e})=>(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Qr,{className:Hg(e),"aria-hidden":`true`}),`Dashboard`]})})}function Wg({onNavigate:e}){let{pathname:t}=Dr(),n=t===`/tasks`;return(0,Q.jsxs)(Or,{to:`/tasks`,"data-slot":`all-tasks-link`,onClick:e,"aria-current":n?`page`:void 0,className:G(Vg,n&&`bg-muted`),children:[(0,Q.jsx)(To,{className:Hg(n),"aria-hidden":`true`}),`All tasks`]})}function Gg({className:e,onNavigate:t}){return(0,Q.jsx)(J,{asChild:!0,variant:`ghost`,size:`icon`,className:G(`size-7`,e),children:(0,Q.jsx)(Or,{to:`/settings/global`,"data-slot":`global-settings-link`,"aria-label":`Global settings`,title:`Global settings`,onClick:t,children:(0,Q.jsx)(yu,{className:`size-4`,"aria-hidden":`true`})})})}function Kg({onNavigate:e}){return(0,Q.jsxs)(`a`,{href:`cezar://servers`,"data-slot":`servers-link`,onClick:e,className:Vg,children:[(0,Q.jsx)(vu,{className:Hg(!1),"aria-hidden":`true`}),`Servers`]})}function qg(){let[e,t]=Z.useState(!1),[n,r]=Z.useState(!1),[i,a]=Z.useState(!1);return(0,Q.jsxs)(so,{children:[(0,Q.jsx)(to,{asChild:!0,children:(0,Q.jsx)(J,{variant:`outline`,size:`icon`,"aria-label":`Add project`,title:`Add project`,className:`size-11 shrink-0 md:size-9`,children:(0,Q.jsx)(Kl,{className:`size-4`,"aria-hidden":`true`})})}),(0,Q.jsxs)(ro,{align:`start`,className:`w-56`,children:[(0,Q.jsx)(eo,{className:`text-xs text-soft-foreground`,children:`Add project`}),(0,Q.jsxs)(ao,{"data-slot":`add-project-local`,onSelect:()=>{t(!0),ac(`folder`)},children:[(0,Q.jsx)(bo,{"aria-hidden":`true`}),`Open local folder…`]}),(0,Q.jsxs)(ao,{"data-slot":`add-project-clone`,onSelect:()=>{r(!0),ac(`clone`)},children:[(0,Q.jsx)(Hf,{"aria-hidden":`true`}),`Clone from GitHub…`]}),(0,Q.jsxs)(ao,{"data-slot":`add-project-create`,onSelect:()=>{a(!0),ac(`new`)},children:[(0,Q.jsx)(ql,{"aria-hidden":`true`}),`New project…`]})]}),e?(0,Q.jsx)(Vf,{label:`Open local folder`,onError:()=>t(!1),children:(0,Q.jsx)(Df,{open:!0,onOpenChange:t})}):null,n?(0,Q.jsx)(Vf,{label:`Clone from GitHub`,onError:()=>r(!1),children:(0,Q.jsx)(Af,{open:!0,onOpenChange:r})}):null,i?(0,Q.jsx)(Vf,{label:`New project`,onError:()=>a(!1),children:(0,Q.jsx)(If,{open:!0,onOpenChange:a})}):null]})}function Jg({version:e,latestVersion:t,brandName:n}){let r=!!(t&&t!==e),[i,a]=Z.useState(!1);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`version-chip`,"data-update-available":r?`true`:void 0,title:r?`v${e} — update available: v${t}`:`v${e}`,"aria-label":r?`${n} v${e}, update to v${t} available — open updater`:`${n} v${e} — open updater`,onClick:()=>a(!0),className:`flex min-w-0 cursor-pointer items-center gap-1 rounded-full border border-border px-1.5 py-px font-mono text-micro font-medium text-soft-foreground outline-none hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:[r?(0,Q.jsx)(Nc,{tone:`pending`,pulse:!0,className:`size-[5px] shrink-0`}):null,(0,Q.jsxs)(`span`,{className:`truncate`,children:[`v`,e]})]}),i?(0,Q.jsx)(Bh,{open:i,onOpenChange:a,brandName:n}):null]})}function Yg({count:e}){let t=nh(e);return(0,Q.jsxs)(`a`,{"data-slot":`star-chip`,href:eh,target:`_blank`,rel:`noopener noreferrer`,title:`Star cezar on GitHub — ${e.toLocaleString()} stars`,"aria-label":`Star cezar on GitHub — ${e.toLocaleString()} stars`,className:`flex shrink-0 items-center gap-1 rounded-full border border-border px-1.5 py-px font-mono text-micro font-medium text-soft-foreground outline-none hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:`⭐`}),(0,Q.jsx)(`span`,{children:t})]})}function Xg({title:e,attention:t=!1}){return(0,Q.jsx)(`header`,{"data-slot":`mobile-top-bar`,className:`row-start-1 border-b border-border bg-card pt-[env(safe-area-inset-top)] md:hidden`,children:(0,Q.jsxs)(`div`,{className:`flex h-11 items-center gap-2.5 px-3`,children:[(0,Q.jsx)(mi,{asChild:!0,children:(0,Q.jsxs)(J,{variant:`ghost`,size:`icon`,"aria-label":`Open menu`,className:`relative -ml-1.5 size-11`,children:[(0,Q.jsx)(ou,{className:`size-[17px]`,"aria-hidden":`true`}),t?(0,Q.jsxs)(`span`,{"data-slot":`mobile-manager-attention`,className:`absolute top-2.5 right-2.5 flex`,children:[(0,Q.jsx)(`span`,{className:`size-1.5 rounded-full bg-info`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`A manager needs you`})]}):null]})}),(0,Q.jsx)(`span`,{className:`truncate text-body font-semibold`,children:e}),(0,Q.jsx)(`div`,{"data-slot":`mobile-status`,className:`ml-auto flex items-center gap-2`})]})})}function Zg(e,t){return e.startsWith(`@`)?{mode:`tasks`,query:e.slice(1)}:e.startsWith(`>`)?{mode:t?`commands`:`tasks`,query:e.slice(1)}:e.startsWith(`#`)?{mode:t?`files`:`tasks`,query:e.slice(1)}:{mode:t?`all`:`tasks`,query:e}}var Qg=e=>e.replace(/^[@>#]/,``),$g=(e,t,n)=>Lp(e,Qg(t),n);function e_(e){return(wr(`/p/:projectId/tasks/:id/*`,e)??wr(`/tasks/:id/*`,e))?.params.id}function t_(e,t,n=50){let r=t.trim();if(r===``)return e.slice(0,n);let i=[];for(let t of e){let e=t.slice(t.lastIndexOf(`/`)+1),n=Lp(t,r)+Lp(e,r);n>0&&i.push({path:t,score:n})}return i.sort((e,t)=>t.score-e.score||e.path.length-t.path.length),i.slice(0,n).map(e=>e.path)}var n_=6,r_=`task-palette-task`;function i_(){let e=Dr(),t=e_(e.pathname),n=Fc(),r=o_(),[i,a]=Z.useState(!1),[o,s]=Z.useState(null),[c,l]=Z.useState(``),[u,d]=Z.useState(``),[f,p]=Z.useState(!1),[m,h]=Z.useState(null),[g,_]=Z.useState(null),[v,y]=Z.useState(null),b=Z.useRef(null),x=Z.useRef(null),S=Z.useRef(!1),C=Z.useRef(!1),w=Z.useRef(null),T=Zi();am(`task`,i,Z.useCallback(()=>a(!1),[]));let E=Z.useRef(new Set),D=Z.useRef(!1),O=Z.useRef(i);O.current=i;let k=Z.useCallback((e,t,{reopen:n=!1}={})=>{!O.current&&!n&&ec(e?`task`:`task_switch`),D.current=!1,s(e),l(t),d(``),p(!1),y(null),h(null),S.current=!1,C.current=!1,a(!0)},[]),A=()=>[...x.current?.querySelectorAll(`[cmdk-item][data-slot="${r_}"]`)??[]];Vs(`p`,()=>{if(v)return;if(!i){t?k(t,``):k(null,`@`);return}if(p(!1),(f||!c.startsWith(`@`))&&o){l(`@`),D.current=!0,h({step:1});return}let e=A(),n=e.findIndex(e=>e.dataset.value===u);D.current=!0,h({step:n+1>=e.length?0:n+1})},{inEditable:!0}),Z.useEffect(()=>{if(!m)return;let e=setTimeout(()=>{let e=A(),t=e[Math.min(m.step,e.length-1)];t?.dataset.value&&d(t.dataset.value),h(null)},0);return()=>clearTimeout(e)},[m,c]);let j=Z.useCallback(e=>{if(e.projectId===null||e.projectId===r){k(e.runId,``);return}w.current=e.runId,a(!1),n(nm({id:e.runId,projectId:e.projectId}))},[r,n,k]);Z.useEffect(()=>{let e=e=>{let n=e.detail;n?j(n):t?k(t,``):k(null,`@`)};return window.addEventListener(Ap,e),()=>window.removeEventListener(Ap,e)},[j,t,k]),Z.useEffect(()=>{i||s(null)},[e.pathname]),Z.useEffect(()=>{!i&&!C.current&&s(null)},[i]),Z.useEffect(()=>{w.current&&w.current===t&&(w.current=null,k(t,``,{reopen:!0}))},[t,k]);let ee=Z.useCallback(()=>{C.current&&(C.current=!1,F.current.open||s(null))},[]),M=(e,t=!1)=>{let n=b.current?.build().find(t=>t.id===e);if(!n||n.unavailable)return;if(vc(n.id,`palette`),n.id===`rename`){n.perform();return}S.current=!0,C.current=d_(n.id),a(!1);let r=t&&n.performBeside?n.performBeside:n.perform;if(f_(n.id))return r();setTimeout(r,0)},N=Z.useCallback(e=>{S.current=!0,tc(D.current?`cycle`:`enter`),a(!1),n(nm(e))},[n]),te=Z.useCallback(()=>{let e=b.current?.run;e&&(p(!0),l(Ge(e)),setTimeout(()=>x.current?.querySelector(`[cmdk-input]`)?.select(),0))},[]),ne=()=>{let e=c.trim();e&&b.current&&b.current.rename(e),S.current=!0,a(!1)},P=e=>{T.ready&&y({id:e,label:m_(e,b.current?.commands)})},F=Z.useRef({open:i,recording:v,pageTaskId:t,byChord:new Map,show:k,beginRename:te});F.current={open:i,recording:v,pageTaskId:t,byChord:new Map([...T.bindings].map(([e,t])=>[t,e])),show:k,beginRename:te},Z.useEffect(()=>{let e=e=>{if(e.repeat||e.defaultPrevented)return;let t=F.current;if(t.open||t.recording||!t.pageTaskId)return;let n=js(e),r=n?t.byChord.get(n):void 0;if(!n||!r||!h_(e.target,n)||bs())return;let i=b.current;if(!i||i.run.id!==t.pageTaskId)return;let a=i.build().find(e=>e.id===r);if(a){if(e.preventDefault(),a.unavailable)return void Y(a.unavailable);if(vc(a.id,`shortcut`),a.id===`rename`){t.show(t.pageTaskId,``,{reopen:!0}),setTimeout(t.beginRename,0);return}a.perform(`shortcut`)}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let re=e=>{if(v){if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`)return y(null);if(!e.metaKey&&!e.ctrlKey&&!e.altKey&&!e.shiftKey&&(e.key===`Backspace`||e.key===`Delete`))return T.assign(v.id,null),Y(`Removed the shortcut for ${v.label}`),y(null);let t=js(e.nativeEvent);if(!t){let t=Fs(e.nativeEvent);t&&y({...v,problem:t});return}let n=Ts(t);if(n)return y({...v,problem:`${Hs(t)} — ${n}`});let r=[...T.bindings].find(([e,n])=>n===t&&e!==v.id)?.[0];return T.assign(v.id,t),Y(`${Hs(t)} → ${v.label}${r?` (was ${m_(r,b.current?.commands)})`:``}`),y(null)}if(e.nativeEvent.isComposing||e.keyCode===229)return;if(f){e.key===`Enter`&&(e.preventDefault(),ne());return}let n=x.current?.querySelector(`[cmdk-item][data-selected="true"]`);if(e.key===`Tab`&&!e.shiftKey&&!e.altKey&&!e.metaKey&&!e.ctrlKey){let t=n?.dataset.slot===r_?n.dataset.runId:void 0;if(!t)return;e.preventDefault(),tc(`tab`),j({runId:t,projectId:n?.dataset.projectId??null});return}if(e.key===`Enter`&&e.altKey&&n?.dataset.commandId){e.preventDefault(),M(n.dataset.commandId,!0);return}if(e.key===`Enter`&&e.shiftKey&&n?.dataset.commandId&&p_(n.dataset.commandId)){e.preventDefault(),P(n.dataset.commandId);return}e.key===`Backspace`&&c===``&&o!==null&&o!==t&&(e.preventDefault(),k(t??null,`@`))},{mode:I,query:ie}=f?{mode:`all`,query:``}:Zg(c,o!==null);return Z.useEffect(()=>{if(!(!i||f||v))for(let e of rc(ie,I===`all`?void 0:I))E.current.add(e)},[i,f,v,ie,I]),Z.useEffect(()=>{i||E.current.size===0||(lc(E.current),E.current=new Set)},[i]),(0,Q.jsxs)(Q.Fragment,{children:[o??t?(0,Q.jsx)(y_,{runId:o??t,apiRef:b,onCommands:_,onRename:te,onDialogDone:ee,open:i},o??t):null,(0,Q.jsx)(Kc,{open:i,onOpenChange:e=>{e||Xs(I===`tasks`?`tasks`:I===`files`?`files`:`actions`),a(e)},title:`Task palette`,description:`Act on a task, switch tasks, or open one of its files`,showCloseButton:!1,filter:$g,commandProps:{value:u,onValueChange:d,onKeyDown:re,shouldFilter:!f&&!v&&I!==`files`},onOpenAutoFocus:e=>{let t=e.currentTarget?.querySelector(`[cmdk-input]`);t&&(e.preventDefault(),t.focus(),t.setSelectionRange(t.value.length,t.value.length))},onCloseAutoFocus:e=>{S.current&&e.preventDefault()},onEscapeKeyDown:e=>{if(v)return e.preventDefault(),y(null);f&&(e.preventDefault(),p(!1),l(``))},className:`top-[10vh] translate-y-0 sm:max-w-2xl lg:max-w-3xl xl:max-w-4xl`,children:(0,Q.jsxs)(`div`,{ref:x,"data-slot":`task-palette`,"data-mode":v?`record`:f?`rename`:I,className:`contents`,children:[(0,Q.jsx)(Hc,{placeholder:v?`Press a shortcut — ⌫ removes it, esc cancels`:a_(f?`rename`:I),value:c,onValueChange:l}),o&&!f&&I!==`tasks`?(0,Q.jsx)(s_,{runId:o,picked:o!==t}):null,(0,Q.jsx)(Yc,{className:`max-h-[55vh] min-h-[14rem] sm:max-h-[60vh] lg:max-h-[68vh]`,children:v?(0,Q.jsx)(Wc,{heading:`Shortcut for ${v.label}`,children:(0,Q.jsxs)(qc,{value:`record`,"data-slot":`task-palette-recorder`,onSelect:()=>{},children:[(0,Q.jsx)(tu,{"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:v.problem??`Press the keys for this command…`}),T.bindings.get(v.id)?(0,Q.jsx)(Gc,{children:Hs(T.bindings.get(v.id))}):null]})}):f?(0,Q.jsx)(Wc,{heading:`Rename`,children:(0,Q.jsxs)(qc,{value:`rename`,"data-slot":`task-palette-rename`,onSelect:ne,children:[(0,Q.jsx)(lo,{"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:c.trim()?`Rename to “${c.trim()}”`:`Type the new name`}),(0,Q.jsx)(Gc,{children:`↵`})]})}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Jc,{children:`Nothing matches.`}),I===`all`||I===`commands`?(0,Q.jsx)(c_,{commands:g?.runId===o?g.commands:[],bindings:T.bindings,onPerform:M,onRecord:P}):null,I===`files`&&o?(0,Q.jsx)(__,{runId:o,query:ie,onPick:e=>{S.current=!0,a(!1);let t=ha(o);t?setTimeout(()=>t.openFile(e),0):(ba(o,e),n(`/tasks/${o}`))}}):null,I===`all`||I===`tasks`?(0,Q.jsx)(g_,{recentOnly:I===`all`,exclude:I===`all`?o:null,current:t,query:ie,onPick:N}):null]})}),(0,Q.jsx)(v_,{mode:v?`record`:f?`rename`:I})]})})]})}function a_(e){switch(e){case`rename`:return`New name…`;case`tasks`:return`Switch to a task…`;case`files`:return`Open a file in this task…`;case`commands`:return`Run a command on this task…`;default:return`Act on this task — @ tasks · > commands · # files`}}function o_(){let e=Vc(),t=a(),n=T(),r=t.data?.bootProject??n.data?.bootProject??null;return(e==="default"?null:e)??r}function s_({runId:e,picked:t}){let n=Ae(e).data;if(!n)return null;let r=o(n);return(0,Q.jsxs)(`div`,{"data-slot":`task-palette-subject`,className:`flex min-w-0 items-center gap-2 border-b border-border px-3 py-2 text-xs text-muted-foreground`,children:[(0,Q.jsx)(`span`,{className:`shrink-0`,children:`Task`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium text-foreground`,children:Ge(n)}),(0,Q.jsx)(il,{className:`shrink-0`,dot:r.tone,pulse:r.pulse,children:r.label}),t?(0,Q.jsx)(`span`,{className:`shrink-0 text-soft-foreground`,children:`⌫ back to tasks`}):null]})}function c_({commands:e,bindings:t,onPerform:n,onRecord:r}){return(0,Q.jsx)(Q.Fragment,{children:ta.map(i=>{let a=e.filter(e=>e.group===i.id&&!e.hidden);return a.length===0?null:(0,Q.jsx)(Wc,{heading:i.heading,children:a.map(e=>{let a=l_(e,t);return(0,Q.jsxs)(qc,{value:`${i.heading} ${e.label} ${e.id}`,keywords:e.keywords,disabled:e.unavailable!==void 0,"data-slot":`task-palette-command`,"data-command-id":e.id,"aria-checked":e.pressed,onSelect:()=>n(e.id),className:G(`group/command`,e.danger&&`data-[selected=true]:text-danger`),children:[e.icon,(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),e.unavailable?(0,Q.jsx)(`span`,{className:`shrink-0 truncate text-xs text-soft-foreground`,children:e.unavailable}):e.pressed?(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-primary`,children:`on`}):null,p_(e.id)?(0,Q.jsx)(`button`,{type:`button`,"data-slot":`task-palette-record`,"aria-label":`Set a shortcut for ${e.label}`,title:`Set a shortcut (⇧↵)`,className:`hidden shrink-0 rounded p-0.5 text-soft-foreground group-hover/command:inline-flex hover:text-foreground`,onPointerDown:e=>e.preventDefault(),onClick:t=>{t.stopPropagation(),r(e.id)},children:(0,Q.jsx)(tu,{"aria-hidden":`true`,className:`size-3.5!`})}):null,a?(0,Q.jsx)(Gc,{children:a}):null]},e.id)})},i.id)})})}function l_(e,t){let n=t.get(e.id);if(n)return Hs(n);let r=e.shortcut&&/^[1-9]$/.test(e.shortcut)?t.get(`tab:${e.shortcut}`):void 0;return r?Hs(r):e.shortcut}var u_=new Set([`stop`,`delete`]),d_=e=>u_.has(e)||e.startsWith(`git:`),f_=e=>e.startsWith(`copy:`)||e===`open-pr`,p_=e=>!e.startsWith(`layout:`);function m_(e,t=[]){return As.find(t=>t.id===e)?.label??t.find(t=>t.id===e)?.label??e}function h_(e,t){let n=t.split(`+`).includes(`Mod`);return e instanceof HTMLElement&&e.closest(`.xterm`)?n&&Ds():Ps(e)&&!(e instanceof HTMLElement&&e.closest(`[cmdk-input]`))?n:!0}function g_({recentOnly:e,exclude:t,current:n,query:r,onPick:i}){let{tasks:a,multiProject:o,projectNames:s,repoBases:c}=tm(),l=ga(),u=Z.useMemo(()=>{let n=wa(a,e=>e.id,l),r=new Set(l);return Kp(e?n.filter(e=>r.has(e.id)&&e.id!==t).slice(0,n_):n,s,c)},[a,l,e,t,s,c]),{shown:d,total:f}=Z.useMemo(()=>qp(u,r),[u,r]),[p]=Z.useState(Date.now);return d.length===0?null:(0,Q.jsx)(Jp,{entries:d,children:(0,Q.jsxs)(Wc,{heading:(0,Q.jsx)(Vp,{label:e?`Recent tasks`:`Tasks`}),className:Yp,children:[d.map(e=>(0,Q.jsx)(sm,{entry:e,slot:r_,showProject:o,now:p,onSelect:i,current:e.task.id===n},e.key)),(0,Q.jsx)(Xp,{hidden:f-d.length})]})})}function __({runId:e,query:t,onPick:n}){let r=B(e),i=Z.useMemo(()=>t_(r.data?.paths??[],t),[r.data,t]);return r.isPending?(0,Q.jsx)(`p`,{className:`px-3 py-6 text-center text-xs text-soft-foreground`,children:`Loading files…`}):r.isError?(0,Q.jsx)(`p`,{className:`px-3 py-6 text-center text-xs text-soft-foreground`,children:r.error.message}):(0,Q.jsx)(Wc,{heading:`Files`,children:i.map(e=>{let t=e.lastIndexOf(`/`);return(0,Q.jsxs)(qc,{value:`file ${e}`,"data-slot":`task-palette-file`,onSelect:()=>n(e),children:[(0,Q.jsx)(yo,{"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`shrink-0 font-medium`,children:e.slice(t+1)}),t>0?(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.slice(0,t)}):null]},e)})})}function v_({mode:e}){return(0,Q.jsx)(`div`,{"data-slot":`task-palette-footer`,className:`flex flex-wrap gap-x-3 gap-y-1 border-t border-border px-3 py-1.5 text-meta text-soft-foreground`,children:(e===`record`?[`⌫ remove`,`esc cancel`]:e===`rename`?[`↵ save`,`esc cancel`]:e===`tasks`?[`↵ open`,`tab act on it`,`${Os(`p`)} next`]:e===`files`?[`↵ open in Code`]:[`↵ run`,`⌥↵ open beside`,`⇧↵ set shortcut`,`@ tasks`,`> commands`,`# files`]).map(e=>(0,Q.jsx)(`span`,{children:e},e))})}var y_=Z.memo(function(e){let t=Ae(e.runId).data;return t?(0,Q.jsx)(b_,{run:t,...e}):null});function b_(e){let t=na(e.run);return(0,Q.jsx)(Da,{projectId:t.projectId,requests:t.requests,children:(0,Q.jsx)(x_,{...e})})}function x_({run:e,apiRef:t,onCommands:n,onRename:r,onDialogDone:i}){let a=ha(e.id),o=e_(Dr().pathname)===e.id,s=la(e,{surface:`palette`,onMarkedUnread:a?.markedUnread,onScreen:o}),c=da(e),l=Yi(e,sa(e)),u=T().data?.capabilities?.terminal===!0,d=L(e.id),f=Fc(),p=o_(),m=Fn(e),h=()=>$i({run:e,canResume:l.canResumeHere,git:c.action,gitPending:c.pending,workspace:ha(e.id),terminalAvailable:u,openChoices:l.choices,prUrl:m?.url,taskUrl:`${window.location.origin}${p?Pc(p,`/tasks/${e.id}`):`/tasks/${e.id}`}`},{markRead:()=>s.markRead.mutate(),markUnread:()=>s.markUnread.mutate(),pin:e=>s.pin.mutate(e===`shortcut`?`shortcut`:void 0),archive:e=>s.archive.mutate(e===`shortcut`?`shortcut`:void 0),rename:r,finish:()=>s.finish.mutate(),confirmStop:()=>s.setConfirming(`cancel`),confirmDelete:()=>s.setConfirming(`delete`),resumeInTerminal:()=>s.terminal.mutate(),gitAction:c.onAction,openIn:l.open,navigate:e=>f(e),openUrl:e=>window.open(e,`_blank`,`noopener,noreferrer`),copy:(e,t)=>void qi(e,`${t} copied`)}),g=h();t.current={run:e,commands:g,build:h,rename:e=>d.mutate({title:e},{onError:e=>Y(e.message,{tone:`danger`})})};let _=g.map(e=>`${e.id}|${e.label}|${e.unavailable??``}|${+!!e.pressed}|${e.shortcut??``}`).join(`
|
|
4
|
+
`),v=Z.useRef(g);v.current=g,Z.useEffect(()=>n({runId:e.id,commands:v.current}),[_,n,e.id]);let y=s.confirming!==null||c.commitOpen||c.pending!==null||s.delete.isPending||s.cancel.isPending,b=Z.useRef(y);return Z.useEffect(()=>{b.current&&!y&&i(),b.current=y},[y,i]),(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Qi,{run:e,confirming:s.confirming,lifecycleDelete:s.lifecycleDelete,onOpenChange:e=>!e&&s.setConfirming(null),onConfirm:e=>e===`delete`?s.delete.mutate():s.cancel.mutate()}),c.dialogs]})}var S_=Z.createContext(null);function C_({children:e}){let[t,n]=Z.useState(`active`),r=Z.useMemo(()=>[t,n],[t]);return(0,Q.jsx)(S_.Provider,{value:r,children:e})}function w_(){let e=Z.useContext(S_);if(!e)throw Error(`useListView must be used inside a <ListViewProvider>`);return e}var T_=1e4,E_=e=>Math.min(100,Math.max(0,e)),D_=e=>e===void 0||e<80?`ok`:e<90?`warn`:`critical`;function O_(){let e=Oi(),t=Ci();return!e||t!==`local`?null:(0,Q.jsx)(k_,{})}function k_(){let e=Ti(),t=Si(),n=wi(),[r,i]=(0,Z.useState)(void 0),a=n!==void 0&&r===n;(0,Z.useEffect)(()=>{if(n===void 0)return;let e=Math.max(0,n+T_-Date.now()),t=setTimeout(()=>i(n),e);return()=>clearTimeout(t)},[n]);let o=e===void 0?void 0:Di(e),s=o?.cpuPct,c=a?`stale`:o!==void 0&&o.cpuLimited&&s===void 0?`—`:s===void 0?t.length===0?`sampling…`:`—`:`${Math.round(s)}%`,l=o===void 0||o.memUsedBytes===void 0||o.memTotalBytes<=0?void 0:o.memUsedBytes/o.memTotalBytes*100,u=a?`stale`:l===void 0?`—`:`${Math.round(l)}%`,d=o===void 0?`—`:yi(o.memUsedBytes,o.memTotalBytes),f=o?.cpuLimited===!0?`${o.cpuLimitKind===`cpuset`?`cpuset `:``}${vi(o.cpuCores)}`:void 0,p=`CPU ${c}${f===void 0?``:` of ${f}`}, RAM ${u} (${d})`;return(0,Q.jsxs)(X,{to:`/settings/resources`,"data-slot":`host-usage-widget`,"data-state":a?`stale`:`live`,"data-frames":t.length,"aria-label":`Machine usage: ${p}. Open Settings, Resources.`,title:p,className:G(`grid grid-cols-[auto_minmax(0,1fr)_auto_auto_minmax(0,1fr)_auto] items-center gap-x-1.5 rounded-md border border-border px-2 py-1 text-meta leading-[14px] text-soft-foreground transition-colors hover:bg-muted hover:text-foreground`,a?`opacity-70`:null),children:[(0,Q.jsx)(A_,{label:`CPU`,pct:a?void 0:s,valueSlot:`host-usage-widget-cpu`,value:c}),(0,Q.jsx)(A_,{label:`RAM`,pct:a?void 0:l,valueSlot:`host-usage-widget-mem-pct`,value:u,gutter:!0})]})}function A_({label:e,pct:t,valueSlot:n,value:r,gutter:i}){let a=D_(t);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:G(`font-medium tracking-wide text-muted-foreground`,i===!0?`ml-1`:null),children:e}),(0,Q.jsx)(`span`,{"data-slot":`host-usage-widget-${e.toLowerCase()}-bar`,"data-level":a,role:`meter`,"aria-label":e,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":t===void 0?void 0:Math.round(E_(t)),className:`h-1.5 overflow-hidden rounded-full bg-muted`,children:(0,Q.jsx)(`span`,{className:G(`block h-full rounded-full transition-[width] duration-500`,a===`critical`?`bg-destructive`:a===`warn`?`bg-pending`:`bg-primary`),style:{width:`${t===void 0?0:E_(t)}%`}})}),(0,Q.jsx)(`span`,{"data-slot":n,className:G(`text-right font-medium tabular-nums`,a===`critical`?`text-destructive`:a===`warn`?`text-pending-strong`:`text-foreground`),children:r})]})}function j_({status:e,pending:t,error:n,dismissals:r,onDismissAuthFailures:i}){if(t||!e)return null;let a;try{a=Tt(e)}catch{return null}let o=$s(a,r);if(o.length>0)return(0,Q.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,Q.jsx)(Nc,{tone:`danger`}),(0,Q.jsxs)(`span`,{children:[`Provider authentication failed during a task:`,` `,o.map(({label:e})=>e).join(`, `),`.`]}),(0,Q.jsx)(X,{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,Q.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,Q.jsx)(ns,{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,Q.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,Q.jsx)(Nc,{tone:c?`danger`:`pending`}),(0,Q.jsx)(`span`,{children:s?`No agent provider is enabled.`:c?`No connected provider could be verified.`:`No agent provider credentials were found.`}),(0,Q.jsx)(X,{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 M_(e){if(!(typeof e!=`object`||!e||Array.isArray(e)))return e}function N_(){let e=Dt(),t=bt(),n=W(),r=(0,Z.useRef)(Promise.resolve()),i=(0,Z.useRef)(0),a=(0,Z.useRef)(0),o=(0,Z.useRef)(M_(t.data));(0,Z.useEffect)(()=>{a.current===0&&(o.current=M_(t.data))},[t.data]);let s=(0,Z.useCallback)(e=>{let t=V.uiState,s=M_(n.getQueryData(t)),c=Ac(sc(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 zt({dismissedProviderAuthFailures:c});o.current=M_(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}),Y(e instanceof Error?e.message:String(e),{tone:`danger`}))}finally{--a.current}})},[n]);return(0,Q.jsx)(j_,{status:e.data,pending:e.isPending,error:e.isError,dismissals:sc(M_(t.data)?.dismissedProviderAuthFailures),onDismissAuthFailures:s})}var P_=`https://github.com/open-mercato/cezar/blob/main/docs/telemetry.md`,F_=`https://github.com/open-mercato/cezar/blob/main/packages/cezar/src/telemetry.ts`;function I_(e){return e!==void 0&&e.consent===`unknown`&&e.blockedBy===null}var L_=[`How many tasks you start (agent, model)`,`How many messages you send`,`Which pages you open`,`Errors, with your paths removed`,`Version, OS, app or CLI`,`A random install id`],R_=[`Prompts, messages, code, diffs`,`File paths`,`Repo, branch or project names`,`Keys or credentials`,`Your IP, in any payload`];function z_(){let e=W();return(0,Z.useCallback)(async t=>{try{let n=await Tn({consent:t});return e.setQueryData(V.telemetryConsent,n),t===`denied`&&F(),!0}catch(e){return Y(e instanceof Error?e.message:String(e),{tone:`danger`}),!1}},[e])}function B_({busy:e,onAnswer:t,size:n}){let r=n===`lg`?`min-h-11`:`h-9`;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(J,{variant:`outline`,className:r,disabled:e,"data-slot":`telemetry-deny`,onClick:()=>t(`denied`),children:`Don’t share`}),(0,Q.jsx)(J,{className:r,disabled:e,"data-slot":`telemetry-grant`,onClick:()=>t(`granted`),children:`Share usage data`})]})}function V_(){let e=nt(),t=z_(),[n,r]=(0,Z.useState)(!1),[i,a]=(0,Z.useState)(!1);if(!I_(e.data))return null;let o=async e=>{r(!0);let n=await t(e);r(!1),n&&a(!1)};return(0,Q.jsxs)(`div`,{"data-slot":`telemetry-consent-banner`,className:`px-4 pb-3 md:px-5 md:pb-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-3 rounded-lg border bg-card px-4 py-3 shadow-lg`,children:[(0,Q.jsx)(bu,{className:`hidden size-[18px] shrink-0 text-violet sm:block`,"aria-hidden":`true`}),(0,Q.jsxs)(`p`,{className:`min-w-0 flex-1 basis-[280px] text-ui leading-relaxed text-muted-foreground`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-foreground`,children:`Help improve cezar?`}),` With your OK we send task counts and crash reports to the maintainers — never prompts, code, paths or repo names. Change it anytime in Settings → Privacy.`,` `,(0,Q.jsx)(`button`,{type:`button`,"data-slot":`telemetry-details`,className:`underline underline-offset-2 hover:text-foreground`,onClick:()=>a(!0),children:`Details`})]}),(0,Q.jsx)(`div`,{className:`flex gap-2`,children:(0,Q.jsx)(B_,{busy:n,onAnswer:e=>void o(e),size:`sm`})})]}),(0,Q.jsx)(U_,{open:i,onOpenChange:a,busy:n,onAnswer:e=>void o(e)})]})}function H_({title:e,tone:t,items:n}){let r=t===`ok`?Wa:ns;return(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`span`,{className:`block text-ui font-medium text-foreground`,children:e}),(0,Q.jsx)(`ul`,{className:`mt-2 space-y-1.5`,children:n.map(e=>(0,Q.jsxs)(`li`,{className:`flex gap-2 text-ui leading-snug text-muted-foreground`,children:[(0,Q.jsx)(r,{className:`mt-0.5 size-3.5 shrink-0 ${t===`ok`?`text-success`:`text-soft-foreground`}`,"aria-hidden":`true`}),e]},e))})]})}function U_({open:e,onOpenChange:t,busy:n,onAnswer:r}){return(0,Q.jsx)(ws,{open:e,onOpenChange:t,children:(0,Q.jsx)(Ss,{"data-slot":`telemetry-details-dialog`,className:`max-h-[calc(100dvh-2rem)] gap-0 overflow-y-auto p-0 sm:max-w-[480px]`,onOpenAutoFocus:e=>{e.preventDefault(),e.currentTarget.focus()},children:(0,Q.jsxs)(`div`,{className:`space-y-5 p-6`,children:[(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(`span`,{className:`block eyebrow text-muted-foreground`,children:`What is sent`}),(0,Q.jsx)(ys,{className:`text-xl font-semibold tracking-tight`,children:`Usage data, in full`}),(0,Q.jsx)(xs,{className:`text-sm leading-relaxed text-muted-foreground`,children:`Counts of what you use and reports of what broke, so cezar’s maintainers at Open Mercato can fix bugs without you filing them. Off until you say yes.`})]}),(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsx)(H_,{title:`Shared`,tone:`ok`,items:L_}),(0,Q.jsx)(H_,{title:`Never shared`,tone:`no`,items:R_})]}),(0,Q.jsxs)(`p`,{className:`text-xs leading-relaxed text-soft-foreground`,children:[`Every label is a closed list the server enforces. Withdraw anytime in Settings → Privacy or with `,(0,Q.jsx)(`code`,{className:`font-mono`,children:`cezar telemetry disable`}),` — the install id is deleted.`,` `,(0,Q.jsx)(`a`,{href:F_,target:`_blank`,rel:`noopener noreferrer`,className:`underline underline-offset-2 hover:text-foreground`,children:`Read the code`}),` · `,(0,Q.jsx)(`a`,{href:P_,target:`_blank`,rel:`noopener noreferrer`,className:`underline underline-offset-2 hover:text-foreground`,children:`Privacy notice`})]}),(0,Q.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:(0,Q.jsx)(B_,{busy:n,onAnswer:r,size:`lg`})})]})})})}function W_(e){return e.kind===`tracker`&&!!e.trackerTrigger&&(!e.trackerTrigger.access||e.trackerTrigger.access.writes.length>0)}var G_=`Creates a paused, read-only automation. Review its prompt and grant any required writes in the cockpit editor before enabling.`,K_=e=>`"${e.replace(/(["\\$`!])/g,`\\$1`)}"`;function q_(e){return e%3600==0?`${e/3600}h`:e%60==0?`${e/60}m`:`${e}s`}function J_(e){if(e.schedules&&e.schedules.length>1||e.kind===`tracker`)return!1;if(e.kind===`schedule`)return!!e.schedule&&(e.schedule.type!==`once`||!!e.schedule.date);if(!e.events?.length)return!1;let t=e.filters??{};return!([`assignees`,`allLabels`,`excludeLabels`,`changedLabels`].some(e=>(t[e]?.length??0)>0)||t.lookbackDays!==void 0&&t.lookbackDays!==7||t.maxRecords!==void 0&&t.maxRecords!==25)}function Y_(e){let t=[`cez automation add`,`--name ${K_(e.name||`untitled`)}`];if(e.kind===`schedule`&&e.schedule?.type===`once`){let n=ir(e.schedule);t.push(`--at ${K_(`${n.date} ${nr(n.hour,n.minute)}`)}`)}else if(e.kind===`schedule`&&e.schedule)t.push(`--cron ${K_(tr(e.schedule))}`);else{t.push(`--on ${(e.events??[]).join(`,`)}`),t.push(`--every ${q_(e.intervalSeconds??300)}`);for(let n of e.filters?.anyLabels??[])t.push(`--label ${K_(n)}`);for(let n of e.filters?.authors??[])t.push(`--author ${K_(n)}`)}let{task:n}=e;return n.workflow&&t.push(`--workflow ${K_(n.workflow)}`),n.runner&&t.push(`--runner ${K_(n.runner)}`),n.model&&t.push(`--model ${K_(n.model)}`),n.autonomous===!1?t.push(`--no-autonomous`):n.autonomous&&t.push(`--autonomous`),n.dispatch&&(t.push(`--dispatch`),n.dispatch.maxSubtasks!==void 0&&t.push(`--max-subtasks ${n.dispatch.maxSubtasks}`),n.dispatch.reviewChild&&t.push(`--review-child`)),e.enable&&t.push(`--enable`),t.push(`--prompt ${K_(n.prompt||`…`)}`),t.join(` `)}function X_(e){let t={name:e.name||`untitled`,kind:e.kind,...e.kind===`schedule`?{schedule:e.schedule,...e.schedules?{schedules:e.schedules}:{}}:e.kind===`tracker`?{trackerTrigger:e.trackerTrigger?{...e.trackerTrigger,access:{version:1,writes:[]}}:void 0,intervalSeconds:e.intervalSeconds??1800,filters:{lookbackDays:7,maxRecords:25,...e.filters}}:{events:e.events,intervalSeconds:e.intervalSeconds??300,filters:{lookbackDays:7,maxRecords:25,...e.filters}},task:e.task,...e.enable&&!W_(e)?{enable:!0}:{}};return`cez automation create --json '${JSON.stringify(t).replace(/'/g,`'\\''`)}'`}function Z_(e){return J_(e)?Y_(e):X_(e)}var Q_=()=>[sr(),`automations`];function $_(){let e=T(),t=e.data!==void 0;return{known:t,off:t&&e.data?.capabilities?.automations!==!0}}function ev(e){let t=W(),n=Vc(),r=gt({queryKey:Q_(),queryFn:({signal:e})=>Se({signal:e}),enabled:e});return(0,Z.useEffect)(()=>Jr((e,r)=>{if(e!==`automation-change`)return;let i=r;typeof i.project==`string`&&(n===null||i.project===n)&&t.invalidateQueries({queryKey:Q_()})}),[n,t]),r}function tv(e){let t=W(),n=()=>t.invalidateQueries({queryKey:Q_()}),r=e=>Y(e instanceof Error?e.message:String(e),{tone:`danger`}),i=U({mutationFn:async e=>{e.kind===`schedule`?(await Rn(e.id),Y(`Started "${e.name}" — the task is queued.`)):(await w(e.id,`execute`),Y(`Checking events for "${e.name}" now.`))},onSuccess:()=>void n(),onError:r}),a=U({mutationFn:async e=>{await w(e.id,`preview`),Y(`Preview queued for "${e.name}" — no tasks will launch. See the execution log for results.`)},onSuccess:()=>void n(),onError:r}),o=U({mutationFn:e=>pe(e.id,!e.enabled),onSuccess:()=>void n(),onError:r}),s=U({mutationFn:async e=>{let{cancelled:t,kept:n}=await y(e.id),r=n.length?` ${n.length} kept: ${n.length===1?`it has`:`they have`} running subtasks — stop ${n.length===1?`it`:`them`} from Tasks.`:``;Y(`Cancelled ${t.length} queued task${t.length===1?``:`s`} of "${e.name}".${r}`)},onSuccess:()=>void n(),onError:r}),c=U({mutationFn:e=>le({name:`${e.name} (copy)`,...e.description?{description:e.description}:{},kind:e.kind,...e.kind===`schedule`?{schedule:e.schedule,...e.schedules?{schedules:e.schedules}:{}}:e.kind===`tracker`?{trackerTrigger:e.trackerTrigger,intervalSeconds:e.intervalSeconds,filters:e.filters}:{events:e.events,intervalSeconds:e.intervalSeconds,filters:e.filters},task:e.task}),onSuccess:e=>{Y(`Duplicated as "${e.automation.name}", paused.`),n()},onError:r}),l=U({mutationFn:e=>Xn(e.id),onSuccess:()=>void n(),onError:r});return{preview:e=>a.mutateAsync(e).then(()=>void 0,()=>void 0),runNow:e=>i.mutateAsync(e).then(()=>void 0,()=>void 0),toggleEnabled:e=>o.mutateAsync(e).then(()=>void 0,()=>void 0),loadWork:e=>tt(e.id).catch(e=>{r(e)}),cancelQueued:e=>s.mutateAsync(e).then(()=>void 0,()=>void 0),duplicate:e=>c.mutateAsync(e).then(()=>void 0,()=>void 0),remove:e=>l.mutateAsync(e).then(()=>void 0,()=>void 0),copyCli:async e=>{await nv(Z_({name:e.name,kind:e.kind,trackerTrigger:e.trackerTrigger,schedule:e.schedule,schedules:e.schedules,events:e.events,intervalSeconds:e.intervalSeconds,filters:e.filters,task:e.task}),W_(e)?G_:void 0)},busy:a.isPending||i.isPending||o.isPending||s.isPending||c.isPending||l.isPending}}async function nv(e,t){try{await ml(e),Y(t?`Copied to the clipboard. ${t}`:`Copied to the clipboard.`)}catch{Y(`Copy failed — select the text to copy it.`,{tone:`danger`})}}function rv({compact:e=!1,enabled:t=!0}){let[n,r]=(0,Z.useState)([]),i=$_(),a=ev(t&&i.known&&!i.off).data?.automations.filter(e=>e.deferredStart)??[];return!a.length&&!n.length?null:(0,Q.jsxs)(`section`,{"aria-label":`Scheduled tasks`,className:e?`px-2 py-3`:`border-b p-4 md:px-5`,children:[(0,Q.jsxs)(`h2`,{className:`mb-2 eyebrow text-muted-foreground`,children:[`Scheduled · `,a.length]}),n.length>0&&(0,Q.jsxs)(`p`,{role:`status`,children:[`This scheduled task already started. `,n.map((e,t)=>(0,Q.jsxs)(X,{to:`/tasks/${e}`,className:`mr-3 underline`,children:[`View run `,t+1]},e))]}),e?a.map(e=>(0,Q.jsxs)(X,{to:`/#scheduled-${e.id}`,className:`block truncate rounded px-2 py-1.5 text-sm`,children:[`◷ `,e.name]},e.id)):(0,Q.jsx)(`div`,{className:`grid gap-3`,children:a.map(e=>(0,Q.jsx)(iv,{item:e,onAlreadyStarted:r},e.id))})]})}function iv({item:e,onAlreadyStarted:t}){let n=Dr(),r=e.deferredStart,i=Fc(),a=W(),[o,s]=(0,Z.useState)(!1),[c,l]=(0,Z.useState)(``),[u,d]=(0,Z.useState)(null),[f,p]=(0,Z.useState)(``),[m,h]=(0,Z.useState)(``),g=()=>{if(u){d(null);return}p(e.schedule?.date??``),h(`${String(e.schedule?.hour??0).padStart(2,`0`)}:${String(e.schedule?.minute??0).padStart(2,`0`)}`),d(e),l(``)},_=async e=>{s(!0),l(``);try{await e()}catch(e){e instanceof pn&&e.runIds?.length?t(e.runIds):l(e instanceof Error?e.message:String(e))}finally{await a.invalidateQueries({queryKey:Q_()}),s(!1)}},v=r.runIds.length>0,y=v&&r.status===`failed`&&r.failureKind===`ambiguous`,b=r.failureKind===`binding-invalid`,x=`scheduled-${e.id}`,[S,C]=(0,Z.useState)(!1);(0,Z.useEffect)(()=>{n.hash===`#${x}`&&(C(!0),document.getElementById(x)?.scrollIntoView?.({block:`nearest`}))},[x,n.hash,n.key]);let w=e.task.steps?.flatMap(e=>e.skill?[e.skill]:[])??[],T=e.task.workflow??(w.length?`Skills: ${w.join(`, `)}`:`Inline steps`),E=r.binding.models?.map(e=>`${e.step?`${e.step}: `:``}${e.runner} / ${e.model??`Provider default`}`).join(`; `)??e.task.model??`Resolved step models unavailable`,D=r.status===`failed`?`Couldn't start`:r.status===`missed`?`Missed`:r.status===`launching`?`Starting…`:r.holdUntil?`Waiting for reset`:`Scheduled`;return(0,Q.jsxs)(`details`,{id:x,open:S,onToggle:e=>C(e.currentTarget.open),className:`rounded-lg border p-3`,children:[(0,Q.jsxs)(`summary`,{className:`cursor-pointer text-sm`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:e.name}),(0,Q.jsxs)(`span`,{className:`ml-2 text-muted-foreground`,children:[D,` · `,new Date(r.notBefore).toLocaleString(`en-GB`,{timeZone:r.timeZone}),` · `,r.timeZone]})]}),(0,Q.jsxs)(`div`,{className:`mt-3 space-y-3 text-sm`,children:[(0,Q.jsx)(`p`,{className:`whitespace-pre-wrap break-words`,children:e.task.prompt}),(0,Q.jsxs)(`p`,{className:`text-muted-foreground`,children:[T,` · `,E,` · `,r.binding.accounts.map(e=>`${e.runner} / ${e.id}`).join(`, `)]}),(0,Q.jsx)(`p`,{className:`text-muted-foreground`,children:`The server must be running. This is the earliest start; account holds and queue limits still apply.`}),r.holdUntil&&(0,Q.jsxs)(`p`,{children:[`Waiting until `,new Date(r.holdUntil).toLocaleString(`en-GB`,{timeZone:r.timeZone}),` for a newer observed reset.`]}),r.error&&(0,Q.jsx)(`p`,{role:`status`,children:r.error}),y&&(0,Q.jsx)(`p`,{children:`Check the runs below. Start missing runs creates only the ones that do not exist yet — a run you deleted starts again. Dismiss removes this entry and starts nothing.`}),r.runIds.map((e,t)=>(0,Q.jsxs)(X,{to:`/tasks/${e}`,className:`mr-3 underline`,children:[`Check run `,t+1]},e)),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsx)(J,{size:`sm`,variant:`ghost`,disabled:o,onClick:()=>void _(()=>ml(e.task.prompt)),children:`Copy prompt`}),(0,Q.jsx)(J,{size:`sm`,variant:`outline`,disabled:o||v&&!y,onClick:()=>void _(async()=>{let t=await Rn(e.id,e.revision);i(`/tasks/${t.runId}`)}),children:y?`Start missing runs`:r.status===`failed`?`Retry`:`Run now`}),(0,Q.jsx)(J,{size:`sm`,variant:`ghost`,disabled:o||v||b,onClick:g,children:`Change time`}),(0,Q.jsx)(J,{size:`sm`,variant:`ghost`,disabled:o||v&&!y,onClick:()=>void _(()=>Xn(e.id,e.revision)),children:y?`Dismiss`:`Cancel`})]}),u&&!b&&(0,Q.jsxs)(`form`,{className:`flex flex-wrap items-end gap-2`,onSubmit:t=>{t.preventDefault(),_(async()=>{let[t,n]=m.split(`:`).map(Number);await Yn(e.id,{expectedRevision:u.revision,name:u.name,kind:`schedule`,task:u.task,schedule:{type:`once`,date:f,hour:t??0,minute:n??0},enabled:!0}),d(null)})},children:[(0,Q.jsxs)(`label`,{children:[`Date`,(0,Q.jsx)(qs,{type:`date`,required:!0,value:f,onChange:e=>p(e.target.value)})]}),(0,Q.jsxs)(`label`,{children:[`Time (server time zone)`,(0,Q.jsx)(qs,{type:`time`,required:!0,value:m,onChange:e=>h(e.target.value)})]}),(0,Q.jsx)(J,{type:`submit`,disabled:o,children:`Save time`})]}),c&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-destructive`,children:c})]})]})}var av=new Map,ov=new Set,sv=()=>{for(let e of ov)e()},cv=e=>(ov.add(e),()=>{ov.delete(e)});function lv(e=sr()){av.delete(e),sv()}function uv(){let e=$_(),t=Vc(),n=t??sr(),r=(0,Z.useSyncExternalStore)(cv,()=>av.has(n)),i=ev(!1),a=i.data?.automations.some(e=>e.deferredStart)??!1;return(0,Z.useEffect)(()=>Jr((e,r)=>{e===`automation-change`&&(t===null||r.project===t)&&lv(n)}),[t,n]),(0,Z.useEffect)(()=>{i.data&&!a&&!av.has(n)&&(av.set(n,i.dataUpdatedAt),sv())},[i.data,i.dataUpdatedAt,a,n]),e.known&&!e.off&&(!r||a)}function dv({archived:e,onToggle:t,className:n}){let r=e?Ol:fa;return(0,Q.jsx)(sl,{label:e?`Move back to the active list`:`Move to the archived list`,children:(0,Q.jsx)(`button`,{type:`button`,"data-slot":`archive-toggle`,"aria-label":e?`Unarchive task`:`Archive task`,onClick:n=>{n.stopPropagation(),t(!e)},className:G(`inline-flex size-5 shrink-0 items-center justify-center rounded-sm text-soft-foreground transition-colors hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,n),children:(0,Q.jsx)(r,{className:`size-3`,"aria-hidden":`true`})})})}function fv(){return(0,Q.jsx)(`span`,{"data-slot":`unread-marker`,className:`sr-only`,children:`, unread`})}var pv={statuses:[],workflows:[],automations:[]};function mv(e){return e.statuses.length+e.workflows.length+e.automations.length}function hv(e){let t=new Map(e.map(e=>[e.id,e]));return new Map(e.map(e=>[e.id,bp(e,e=>t.get(e))]))}var gv=(e,t)=>e.length===0||t!==void 0&&e.includes(t);function _v(e,t,n,r){return e.filter(e=>{let i=r.get(e.id);return!(!xp(i,t)||!gv(n.statuses,e.status)||!gv(n.workflows,ve(e))||t!==`regular`&&!gv(n.automations,i))})}function vv(e,t){return t===`all`?[...e]:_v(e,t,pv,hv(e))}function yv(e,t,n,r,i){let a=new Map;for(let o of _v(e,t,{...n,[i]:[]},r)){let e=i===`statuses`?o.status:i===`workflows`?ve(o):r.get(o.id);e!==void 0&&a.set(e,(a.get(e)??0)+1)}return a}function bv(e,t,n){return{regular:_v(e,`regular`,t,n).length,automation:_v(e,`automation`,t,n).length,all:_v(e,`all`,t,n).length}}function xv(e){let t=new Set;for(let n of e)n!==void 0&&t.add(n);return[...t].sort((e,t)=>e.localeCompare(t))}function Sv(e){let t=new Map;for(let n of e)t.has(n.id)||t.set(n.id,{run:n,depth:0,children:[],childCount:0,descendantCount:0});let n=e=>{let n=e.dispatch?.parentRunId;if(n===void 0||n===e.id)return null;let r=t.get(n);if(r===void 0)return null;let i=new Set([e.id]),a=r;for(;a!==void 0;){if(i.has(a.run.id))return null;i.add(a.run.id);let e=a.run.dispatch?.parentRunId;a=e===void 0?void 0:t.get(e)}return r},r=[];for(let i of e){let e=t.get(i.id);if(e===void 0||e.run!==i)continue;let a=n(i);a===null?r.push(e):a.children.push(e)}let i=(e,t)=>{e.depth=t,e.childCount=e.children.length;let n=0;for(let r of e.children)n+=1+i(r,t+1);return e.descendantCount=n,n};for(let e of r)i(e,0);return r}function Cv(e,t){let n=[],r=e=>{for(let i of e)n.push(i),(i.children.length===0||t===void 0||t(i.run.id))&&r(i.children)};return r(e),n}function wv(e,t){return Cv(Sv(e),t)}function Tv(e){return e<=0?null:`${e} subtask${e===1?``:`s`}`}function Ev(e){return e.dispatch?.parentRunId===void 0?null:e.dispatch.kind??`implement`}var Dv=Z.createContext(void 0);function Ov({runs:e,view:t,onViewChange:n,currentRunId:r=null,now:i=Date.now(),showTokens:a=!0,showCost:o=!0,onTogglePin:s,onToggleArchive:c}){let l=Ve(e),u=Te(e,t),d=t===`archived`?void 0:s;return(0,Q.jsxs)(`div`,{"data-slot":`quick-list`,children:[(0,Q.jsx)(`div`,{className:`sticky top-0 z-10 bg-sidebar pt-2 pb-1`,children:(0,Q.jsxs)(`div`,{className:`inline-flex w-full gap-0.5 rounded-md bg-muted p-[3px]`,children:[(0,Q.jsxs)(jv,{view:`active`,current:t,onSelect:n,count:l.active,children:[`Active`,l.waiting>0&&t!==`active`?(0,Q.jsx)(Nc,{tone:`pending`,pulse:!0,"data-slot":`waiting-dot`,"aria-label":`needs you`}):null]}),(0,Q.jsx)(jv,{view:`archived`,current:t,onSelect:n,count:l.archived,children:`Archived`})]})}),u.length===0?(0,Q.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,Q.jsx)(kv,{buckets:u,currentRunId:r,now:i,showTokens:a,showCost:o,onTogglePin:d,onToggleArchive:c})]})}function kv({buckets:e,currentRunId:t=null,now:n=Date.now(),scope:r=null,showTokens:i=!0,showCost:a=!0,onTogglePin:o,onToggleArchive:s}){let[c,l]=Z.useState(()=>new Set),u=e=>l(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n});return(0,Q.jsx)(Q.Fragment,{children:e.map(e=>(0,Q.jsxs)(`div`,{"data-slot":`quick-list-bucket`,"data-bucket":e.label,children:[(0,Q.jsx)(`h2`,{className:`px-3 pt-2.5 pb-1 eyebrow text-soft-foreground`,children:e.label}),Av(e.rows).map(e=>(0,Q.jsx)(Mv,{row:e.run.row,depth:e.depth,childCount:e.childCount,currentRunId:t,now:n,scope:r,showTokens:i,showCost:a,expanded:e.run.row.kind===`group`&&c.has(e.run.row.groupId),onToggle:u,onTogglePin:o,onToggleArchive:s},e.run.id))]},e.label))})}function Av(e){return wv(e.map(e=>e.kind===`group`?{id:`group:${e.groupId}`,row:e}:{id:e.run.id,dispatch:e.run.dispatch,row:e}))}function jv({view:e,current:t,onSelect:n,count:r,children:i}){let a=e===t;return(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`view-tab`,"data-view":e,"aria-pressed":a,onClick:()=>n(e),className:G(`flex h-7 flex-1 items-center justify-center gap-1.5 rounded-[7px] text-label font-medium text-muted-foreground`,a&&`bg-card font-semibold text-foreground shadow-xs`),children:[i,r>0?(0,Q.jsx)(`span`,{className:`font-mono text-meta tabular-nums`,children:r}):null]})}function Mv({row:e,depth:t,childCount:n,currentRunId:r,now:i,scope:a,expanded:o,onToggle:s,showTokens:c,showCost:l,onTogglePin:u,onToggleArchive:d}){return e.kind===`run`?(0,Q.jsx)(Rv,{run:e.run,depth:t,childCount:n,queuePosition:e.queuePosition,currentRunId:r,now:i,scope:a,showTokens:c,showCost:l,onTogglePin:u,onToggleArchive:d}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex items-center rounded-sm hover:bg-muted`,children:[(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`group-tile`,"data-group-id":e.groupId,"aria-expanded":o,onClick:()=>s(e.groupId),className:`flex min-w-0 flex-1 items-center gap-2 px-2.5 py-[7px] text-left`,children:[(0,Q.jsx)(Xa,{className:G(`size-3 shrink-0 text-soft-foreground transition-transform`,!o&&`-rotate-90`),"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`min-w-[7rem] flex-1 truncate text-ui font-medium`,children:e.title}),(0,Q.jsxs)(`span`,{className:`shrink-0 rounded-full bg-muted px-1.5 py-px font-mono text-micro font-semibold text-muted-foreground`,children:[`×`,e.members.length]})]}),(0,Q.jsx)(X,{to:Pc(a,`/compare/${e.groupId}`),"data-slot":`group-compare`,title:`Compare the variants`,"aria-label":`Compare the variants of ${e.title}`,className:`mr-1.5 inline-flex size-6 shrink-0 items-center justify-center rounded-sm text-soft-foreground hover:bg-violet/10 hover:text-violet`,children:(0,Q.jsx)(_u,{className:`size-3.5`,"aria-hidden":`true`})})]}),o?e.members.map(e=>(0,Q.jsx)(Rv,{run:e,queuePosition:null,currentRunId:r,now:i,scope:a,variant:!0,showTokens:c,showCost:l,onTogglePin:u,onToggleArchive:d},e.id)):null]})}var Nv=`flex w-0 shrink-0 items-center gap-0.5 overflow-hidden opacity-0 group-hover/task-row:mr-1.5 group-hover/task-row:w-auto group-hover/task-row:opacity-100 group-focus-within/task-row:mr-1.5 group-focus-within/task-row:w-auto group-focus-within/task-row:opacity-100 no-hover:mr-1.5 no-hover:w-auto no-hover:opacity-100`,Pv=`no-hover:size-7`,Fv=`group-hover/task-row:hidden group-focus-within/task-row:hidden`,Iv=`no-hover:hidden`,Lv=`group-hover/task-row:min-w-0 group-focus-within/task-row:min-w-0 no-hover:min-w-0`,Rv=Z.memo(function({run:e,depth:t=0,childCount:n=0,queuePosition:r,currentRunId:i,now:a,scope:s,variant:c=!1,showTokens:l,showCost:u,onTogglePin:d,onToggleArchive:f}){let m=!!f&&(!!e.archived||!za(e.status)),h=!!d||m,g=o(e),_=Z.useId(),v=e.id===i,y=Wt(e,Z.useContext(Dv)),b=Ge(e),x=Le(b,y?.number)?Ze(b).rest:b,S=Ra(e),C=Ua(e),w=c?``:r===null?Zc(p(e),a):`#${r}`,T=Tv(n),E=Ev(e);return(0,Q.jsxs)(`div`,{"data-slot":`task-row`,"data-run-id":e.id,"data-active":v?`true`:void 0,"data-depth":t,style:t>0?{paddingLeft:`${10+t*14}px`}:void 0,className:G(`group/task-row flex items-center gap-2 rounded-sm pl-2.5 hover:bg-muted`,v&&`bg-muted`,c&&`pl-[26px]`),children:[(0,Q.jsx)(X,{to:Pc(s,`/tasks/${e.id}`),tabIndex:-1,"aria-hidden":`true`,"data-slot":`task-row-dot-link`,className:`-ml-2.5 flex shrink-0 items-center self-stretch pl-2.5`,children:(0,Q.jsx)(Nc,{id:_,tone:g.tone,pulse:g.pulse,"aria-label":g.label,role:`img`})}),y?(0,Q.jsx)(mo,{run:e,reference:y,compact:!0,className:`h-auto shrink-0 gap-[2px] px-1.5 py-px text-micro`}):null,(0,Q.jsxs)(X,{to:Pc(s,`/tasks/${e.id}`),title:b,"aria-current":v?`page`:void 0,"aria-describedby":_,"data-slot":`task-row-link`,className:G(`flex min-w-0 flex-1 items-center gap-2 py-[7px]`,h?`pr-0.5`:`pr-2.5`),children:[c?(0,Q.jsx)(`span`,{className:`inline-flex size-[15px] shrink-0 items-center justify-center rounded-full bg-violet/15 font-mono text-[9.5px] font-semibold text-violet`,children:e.variant??`?`}):null,(0,Q.jsxs)(`span`,{"data-slot":`task-row-title`,className:G(`min-w-[7rem] flex-1 truncate text-ui`,h&&Lv,S?`font-semibold text-foreground`:C?`font-medium text-muted-foreground`:`font-medium`),children:[c?zv(e,l,u):x,e.queueWaitReason&&(0,Q.jsx)(`span`,{className:`block truncate text-meta font-normal text-muted-foreground`,children:va(e.queueWaitReason)})]}),(0,Q.jsxs)(`span`,{"data-slot":`task-row-meta`,className:G(`contents`,h&&Fv),children:[(0,Q.jsxs)(`span`,{"data-slot":`task-row-meta-droppable`,className:G(`contents`,h&&Iv),children:[E?(0,Q.jsx)(`span`,{"data-slot":`dispatch-kind`,className:`shrink-0 rounded-full bg-muted px-1.5 py-px text-micro font-medium text-muted-foreground`,children:E}):null,e.diffStat?(0,Q.jsx)(ol,{stat:e.diffStat,className:`hidden shrink-0 text-micro @min-[23rem]/sidebar:inline`}):null,T?(0,Q.jsx)(`span`,{"data-slot":`subtask-count`,title:T,className:`hidden shrink-0 rounded-full bg-muted px-1.5 py-px text-micro font-medium text-muted-foreground @min-[19rem]/sidebar:inline`,children:n}):null]}),w&&(r!==null||!y)?(0,Q.jsx)(`span`,{"data-slot":`task-row-age`,className:G(`shrink-0 text-meta text-soft-foreground tabular-nums`,E&&t>0&&r===null&&`hidden @min-[19rem]/sidebar:inline`),children:w}):null]}),S?(0,Q.jsx)(fv,{}):null]}),s===null&&e.subject?(0,Q.jsx)(ia,{run:e,className:h?`mr-0.5`:`mr-2.5`}):null,h?(0,Q.jsxs)(`div`,{"data-slot":`task-row-actions`,className:Nv,children:[d?(0,Q.jsx)(ua,{pinned:!!e.pinned,onToggle:t=>d(e,t),className:Pv}):null,m&&f?(0,Q.jsx)(dv,{archived:!!e.archived,onToggle:t=>f(e,t),className:Pv}):null]}):null]})});function zv(e,t,n){let r=[e.runner??`claude`];t&&(e.inputTokens!==void 0||e.outputTokens!==void 0)&&r.push(rl(e.inputTokens,e.outputTokens));let i=Oe(e.costUsd);return n&&i&&r.push(i),r.join(` · `)}function Bv(){let e=T(),t=R(Vc(),e.data?.bootProject??null),n=hn(`sidebar`),r=cl(e.data),[i,a]=w_(),o=uv(),[s]=kp(),c=Z.useMemo(()=>t.data?vv(t.data,s):void 0,[t.data,s]),l=Lc(`/tasks/:id/*`),u=Lc(`/tasks/:id`),d=Bs(3e4),f=Z.useCallback((e,t)=>n.mutate({id:e.id,pinned:t},{onError:e=>Y(e.message,{tone:`danger`})}),[n.mutate]),p=Xt(`sidebar`),m=Z.useCallback((e,t)=>p.mutate({id:e.id,archived:t},{onError:e=>Y(e.message,{tone:`danger`})}),[p.mutate]),h=Ht(),g=Je(),_=Z.useMemo(()=>h===void 0?[]:(c??[]).flatMap(e=>z(e).map(e=>({projectId:h,kind:e.kind,number:e.number}))),[c,h]);return c?(0,Q.jsx)(Da,{projectId:h,requests:_,children:(0,Q.jsxs)(Dv.Provider,{value:g,children:[i===`active`&&o&&(0,Q.jsx)(rv,{compact:!0}),(0,Q.jsx)(Ov,{runs:c,view:i,onViewChange:a,currentRunId:l?.params.id??u?.params.id??null,now:d,showTokens:r.tokens,showCost:r.cost,onTogglePin:f,onToggleArchive:m})]})}):null}function Vv({projects:e,folder:t,onClose:n,onSave:r}){let[i,a]=Z.useState(t?.name??``),[o,s]=Z.useState(t?.projectIds??[]),[c,l]=Z.useState(!1);return(0,Q.jsx)(ws,{open:!0,onOpenChange:e=>{e||n()},children:(0,Q.jsxs)(Ss,{"data-slot":`project-folder-dialog`,children:[(0,Q.jsxs)(Ns,{children:[(0,Q.jsx)(ys,{children:t?`Organise folder`:`Create project folder`}),(0,Q.jsx)(xs,{children:`Group projects for a client or any other part of your work.`})]}),(0,Q.jsxs)(`label`,{className:`grid gap-2 text-sm font-medium`,children:[`Folder name`,(0,Q.jsx)(qs,{autoFocus:!0,value:i,onChange:e=>a(e.target.value),placeholder:`Client name`})]}),(0,Q.jsxs)(`fieldset`,{role:`group`,"aria-label":`Select projects`,className:`grid max-h-60 gap-1 overflow-y-auto`,children:[(0,Q.jsx)(`legend`,{className:`mb-2 text-sm font-medium`,children:`Projects`}),e.map(e=>(0,Q.jsxs)(`label`,{className:`flex min-h-9 items-center gap-2 rounded px-2 text-sm hover:bg-muted`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked:o.includes(e.id),onChange:t=>s(n=>t.target.checked?[...n,e.id]:n.filter(t=>t!==e.id))}),(0,Q.jsx)(bo,{className:`size-3.5 text-muted-foreground`,"aria-hidden":`true`}),e.name]},e.id))]}),(0,Q.jsxs)(Cs,{className:`sm:justify-between`,children:[t?c?(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(J,{type:`button`,variant:`danger-ghost`,onClick:()=>r(null,t.id),children:`Confirm delete`}),(0,Q.jsx)(J,{type:`button`,variant:`ghost`,onClick:()=>l(!1),children:`Keep folder`})]}):(0,Q.jsx)(J,{type:`button`,variant:`danger-ghost`,onClick:()=>l(!0),children:`Delete folder`}):(0,Q.jsx)(`span`,{}),(0,Q.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Q.jsx)(J,{type:`button`,variant:`outline`,onClick:n,children:`Cancel`}),(0,Q.jsx)(J,{type:`button`,disabled:!i.trim(),onClick:()=>r({id:t?.id??crypto.randomUUID(),name:i.trim(),projectIds:o},t?.id),children:`Save folder`})]})]})]})})}var Hv=`cez-project-folders`;function Uv(e){if(!Array.isArray(e))return[];let t=new Set,n=new Set;return e.flatMap(e=>{if(typeof e!=`object`||!e)return[];let r=e,i=typeof r.id==`string`?r.id.trim():``;if(!i||t.has(i)||typeof r.name!=`string`||!r.name.trim())return[];t.add(i);let a=Array.isArray(r.projectIds)?[...new Set(r.projectIds.filter(e=>typeof e==`string`&&!n.has(e)))]:[];return a.forEach(e=>n.add(e)),[{id:i,name:r.name.trim(),projectIds:a}]})}function Wv(){try{let e=localStorage.getItem(Hv);return e===null?[]:Uv(JSON.parse(e))}catch{return[]}}function Gv(e){try{localStorage.setItem(Hv,JSON.stringify(e))}catch{}}function Kv(e,t,n){let r=e.filter(e=>e.id!==n&&e.id!==t?.id);return t&&(r=r.map(e=>({...e,projectIds:e.projectIds.filter(e=>!t.projectIds.includes(e))})),r.push(t)),r}function qv(e,t,n){return e.map(e=>e.id===n?e.projectIds.includes(t)?e:{...e,projectIds:[...e.projectIds,t]}:e.projectIds.includes(t)?{...e,projectIds:e.projectIds.filter(e=>e!==t)}:e)}var Jv=`cez-sidebar-collapsed`;function Yv(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 Xv(){try{let e=localStorage.getItem(Jv);return e===null?{}:Yv(JSON.parse(e))}catch{return{}}}function Zv(e){try{localStorage.setItem(Jv,JSON.stringify(e))}catch{}}function Qv(e,t,n){let r=e?.[t];return r===void 0?t!==n:r}function $v(e,t,n,r){let i=e?.[`folder:${t}`];return i===void 0?!(r!==null&&n.includes(r)):i}var ey=10;function ty(e){let[t,n]=Z.useState(Xv),r=Z.useRef(t),i=Z.useCallback(e=>{r.current=e,Zv(e),n(e)},[]);return{collapsed:t,toggle:Z.useCallback(t=>{i({...r.current,[t]:!Qv(r.current,t,e)})},[e,i]),expand:Z.useCallback(e=>{if(!(e in r.current))return;let t={...r.current};delete t[e],i(t)},[i])}}var ny=new Set;function ry({projects:e,bootProjectId:t,inboxAvailable:n=!1,automationsAvailable:r=!1,inboxCount:i=null,skillsUpdateAvailable:a=!1,newNavItems:o=ny}){let{pathname:s}=Dr(),c=Ic(s),l=c??t,{collapsed:u,toggle:d,expand:f}=ty(l),[p,m]=Z.useState(Wv),h=Z.useCallback(e=>{f(e);for(let t of p)t.projectIds.includes(e)&&f(`folder:${t.id}`)},[f,p]),[g,_]=Z.useState(void 0),v=Z.useCallback((e,t)=>{let n=Kv(p,e,t);m(n),Gv(n),_(void 0)},[p]),[y]=w_(),b=Kf(zc(s)),x=Lc(`/tasks/:id/*`),S=Lc(`/tasks/:id`),C=x?.params.id??S?.params.id??null,w=Bs(3e4),E=cl(T().data),{order:D,canReorder:O,setOrder:k}=Np(),A=Z.useMemo(()=>{let t=mp(e,D),n=t.filter(e=>e.unregistered);return n.length===0?t:[...n,...t.filter(e=>!e.unregistered)]},[e,D]),j=Z.useMemo(()=>A.map(e=>e.id),[A]),ee=qr(Kr(Zr,{activationConstraint:{distance:4}}),Kr(Gr,{coordinateGetter:Xr})),M=O&&A.length>1,N=Z.useCallback(e=>{let{active:t,over:n}=e;if(n===null||n.id===t.id)return;let r=String(t.id),i=String(n.id),a=j.indexOf(r),o=j.indexOf(i);if(a===-1||o===-1)return;let s=p.find(e=>e.projectIds.includes(r)),c=p.find(e=>e.projectIds.includes(i));if(s?.id!==c?.id){let e=qv(p,r,c?.id??null);m(e),Gv(e)}k(hp(j,a,o))},[p,j,k]),te=Z.useMemo(()=>{let e=e=>{let t=j.indexOf(String(e));return{name:A[t]?.name??String(e),position:`position ${t+1} of ${j.length}`}};return{onDragStart:({active:t})=>{let{name:n,position:r}=e(t.id);return`Picked up ${n}, ${r}.`},onDragOver:({active:t,over:n})=>n?`${e(t.id).name} moved to ${e(n.id).position}.`:`${e(t.id).name} is not over a drop position.`,onDragEnd:({active:t,over:n})=>n?`${e(t.id).name} dropped at ${e(n.id).position}.`:`${e(t.id).name} dropped. The order is unchanged.`,onDragCancel:({active:t})=>`Reordering cancelled. ${e(t.id).name} returned to ${e(t.id).position}.`}},[A,j]),ne=A.map(e=>(0,Q.jsx)(ay,{project:e,boot:e.id===t,active:e.id===c,collapsed:Qv(u,e.id,l),onToggle:d,onSelect:h,view:y,activeTo:b,currentRunId:C,now:w,inboxAvailable:n,automationsAvailable:r,inboxCount:i,skillsUpdateAvailable:a,newNavItems:o,showTokens:E.tokens,showCost:E.cost,sortable:M,position:j.indexOf(e.id)+1,total:j.length},e.id)),P=new Map(A.map((e,t)=>[e.id,ne[t]])),F=Z.useMemo(()=>[...p.map(e=>({folder:e,projects:A.filter(t=>e.projectIds.includes(t.id))})),{folder:null,projects:A.filter(e=>!p.some(t=>t.projectIds.includes(e.id)))}].filter(({folder:e,projects:t})=>e!==null||t.length>0||p.length===0),[p,A]),re=Z.useMemo(()=>F.flatMap(({folder:e,projects:t})=>{let n=t.map(e=>e.id);return e&&$v(u,e.id,n,c)?[]:n}),[F,u,c]);return(0,Q.jsxs)(`div`,{"data-slot":`project-group-list`,children:[(0,Q.jsx)(`div`,{className:`mb-1 flex justify-end`,children:(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`project-folder-create`,onClick:()=>_(null),className:`flex h-7 items-center gap-1 rounded px-2 text-xs text-muted-foreground hover:bg-muted hover:text-foreground`,children:[(0,Q.jsx)(ql,{className:`size-3.5`,"aria-hidden":`true`}),` New folder`]})}),(0,Q.jsx)(ri,{sensors:ee,collisionDetection:ai,accessibility:{announcements:te},onDragEnd:N,children:(0,Q.jsx)(ii,{items:re,strategy:ni,children:F.map(({folder:e,projects:t})=>{let n=t.map(e=>e.id),r=e&&$v(u,e.id,n,c);return(0,Q.jsx)(Z.Fragment,{children:e?(0,Q.jsxs)(`div`,{"data-slot":`project-folder`,"data-folder":e.id,className:`mb-1`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center`,children:[(0,Q.jsxs)(`button`,{type:`button`,"aria-expanded":!r,onClick:()=>d(`folder:${e.id}`),className:`flex h-8 min-w-0 flex-1 items-center gap-2 rounded px-2 text-xs font-semibold text-muted-foreground hover:bg-muted`,children:[(0,Q.jsx)(Xa,{className:G(`size-3 transition-transform`,r&&`-rotate-90`),"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`truncate`,children:e.name}),(0,Q.jsx)(`span`,{className:`ml-auto`,"aria-label":`${t.length} project${t.length===1?``:`s`}`,children:t.length})]}),(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Edit ${e.name}`,onClick:()=>_(e),className:`size-8 rounded text-xs text-muted-foreground hover:bg-muted`,children:`…`})]}),r?null:(0,Q.jsx)(`div`,{className:`ml-2 border-l border-border pl-1`,children:t.length===0?(0,Q.jsx)(`div`,{className:`px-2 py-1 text-xs text-muted-foreground`,children:`No projects`}):t.map(e=>P.get(e.id))})]}):t.map(e=>P.get(e.id))},e?.id??`ungrouped`)})})}),g!==void 0&&(0,Q.jsx)(Vv,{projects:e,folder:g,onClose:()=>_(void 0),onSave:v})]})}function iy({name:e,position:t,total:n,disabled:r,handleProps:i}){return(0,Q.jsx)(`button`,{type:`button`,"data-slot":`project-group-grip`,disabled:r,"aria-label":`Reorder ${e}, position ${t} of ${n}`,className:G(`flex h-11 w-6 shrink-0 cursor-grab items-center justify-center rounded text-muted-foreground opacity-0 outline-none transition-opacity md:h-[34px] md:w-4`,`touch-none focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50`,`group-hover/row:opacity-100 group-focus-within/row:opacity-100`,`[@media(hover:none)]:opacity-100`,r&&`cursor-default group-hover/row:opacity-0 group-focus-within/row:opacity-0 [@media(hover:none)]:opacity-0`),...i,children:(0,Q.jsx)(xa,{"aria-hidden":`true`,className:`size-3.5`})})}function ay({project:e,boot:t,active:n,collapsed:r,onToggle:i,onSelect:a,view:o,activeTo:s,currentRunId:c,now:l,inboxAvailable:u,automationsAvailable:d,inboxCount:f,skillsUpdateAvailable:p,newNavItems:m,showTokens:h,showCost:g,sortable:_,position:v,total:y}){let b=e.status===`missing`,x=_&&!b&&!e.unregistered,{attributes:S,listeners:C,setNodeRef:w,transform:T,transition:E,isDragging:D}=Ur({id:e.id,disabled:!x}),O={transform:ti.Translate.toString(T),transition:E},k=(0,Q.jsx)(iy,{name:e.name,position:v,total:y,disabled:!x,handleProps:{...S,...C}}),A=$e(e.id,!r&&!b,t),j=Je(),ee=e.repoUrl??(n?j:void 0),M=Ag(),N=hn(`sidebar`,e.id,t?`default`:e.id),ne=Z.useCallback((e,t)=>N.mutate({id:e.id,pinned:t},{onError:e=>Y(e.message,{tone:`danger`})}),[N.mutate]),P=Xt(`sidebar`,e.id,t?`default`:e.id),F=Z.useCallback((e,t)=>P.mutate({id:e.id,archived:t},{onError:e=>Y(e.message,{tone:`danger`})}),[P.mutate]),[re]=kp(),I=A.data?Ve(A.data).waiting:0,ie=A.data?te(Te(vv(A.data,re),o),ey):[],L=ie.flatMap(t=>t.rows.flatMap(t=>z(t.kind===`run`?t.run:t.members[0]).map(t=>({projectId:e.id,kind:t.kind,number:t.number}))));if(b)return(0,Q.jsx)(`div`,{ref:w,style:O,"data-slot":`project-group`,"data-project":e.id,"data-status":`missing`,className:G(`mb-1`,D&&`relative z-10 opacity-40`),children:(0,Q.jsxs)(`div`,{className:`flex items-center`,children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`w-6 shrink-0 md:w-4`}),(0,Q.jsxs)(`div`,{"data-slot":`project-group-header`,title:`${e.root} is gone — remove it in Global settings → Projects`,className:`flex h-11 min-w-0 flex-1 items-center gap-[7px] rounded-lg px-2 text-ui font-semibold opacity-55 md:h-[34px]`,children:[(0,Q.jsx)(`span`,{className:`w-3 shrink-0`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`truncate`,children:e.name}),(0,Q.jsx)(`span`,{"data-slot":`project-missing`,className:`ml-auto shrink-0 rounded-full bg-danger/15 px-[7px] py-px text-micro font-medium text-danger`,children:`folder not found`})]})]})});let ae=`project-group-${e.id}`;return(0,Q.jsxs)(`div`,{ref:w,style:O,"data-slot":`project-group`,"data-project":e.id,"data-status":e.status,"data-collapsed":r?``:void 0,"data-dragging":D?``:void 0,"data-active":n?``:void 0,className:G(`mb-1`,D&&`relative z-10 opacity-40`),children:[(0,Q.jsxs)(`div`,{className:`group/row flex items-center`,children:[k,(0,Q.jsxs)(`div`,{"data-slot":`project-group-row`,className:G(`flex min-w-0 flex-1 items-center rounded-lg transition-colors hover:bg-muted`,n&&`bg-muted`),children:[(0,Q.jsx)(`button`,{type:`button`,onClick:()=>i(e.id),"aria-expanded":!r,"aria-controls":ae,"aria-label":`${r?`Expand`:`Collapse`} ${e.name}`,"data-slot":`project-group-disclosure`,className:G(`flex h-11 w-[27px] shrink-0 items-center justify-center rounded-lg md:h-[34px]`),children:(0,Q.jsx)(Xa,{className:G(`size-3 shrink-0 text-muted-foreground transition-transform`,r&&`-rotate-90`),"aria-hidden":`true`})}),(0,Q.jsxs)(X,{to:Pc(e.id,`/`),onClick:()=>{a(e.id),M?.()},"aria-current":n?`true`:void 0,"data-slot":`project-group-header`,className:G(`flex h-11 min-w-0 flex-1 items-center gap-[7px] rounded-lg pr-2 text-left text-ui font-semibold md:h-[34px]`,n&&`text-foreground`),children:[(0,Q.jsx)(`span`,{className:`truncate`,children:e.name}),e.unregistered?(0,Q.jsx)(`span`,{"data-slot":`project-unregistered`,title:`cezar is serving this folder — it is not in your saved projects. Add it from this project's Settings.`,className:`shrink-0 rounded-full bg-muted px-[7px] py-px text-micro font-medium text-soft-foreground`,children:`not saved`}):null,I?(0,Q.jsx)(`span`,{"data-slot":`project-attention`,title:`${I} task${I===1?``:`s`} need${I===1?`s`:``} you`,className:`shrink-0 rounded-full bg-violet px-1.5 py-px text-micro font-semibold text-violet-foreground`,children:I}):null,e.branch?(0,Q.jsx)(`span`,{"data-slot":`project-branch`,className:`ml-auto max-w-[92px] truncate font-mono text-micro font-medium text-soft-foreground`,children:e.branch}):null]})]})]}),r?null:(0,Q.jsxs)(`div`,{id:ae,"data-slot":`project-group-body`,className:`mt-1 ml-[14px] border-l border-border pl-2`,children:[(0,Q.jsx)(`nav`,{"aria-label":`${e.name} navigation`,children:Wf({forge:e.forge===`github`,inbox:u,automations:d,tracker:e.tracker}).map(t=>{let r=n&&t.to===s,i=t.icon;return(0,Q.jsxs)(X,{to:Pc(e.id,t.to),onClick:M,"aria-current":r?`page`:void 0,className:G(`flex h-11 w-full items-center gap-2.5 rounded-md px-2.5 text-ui font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground md:h-[30px]`,r&&`bg-muted font-semibold text-foreground`),children:[(0,Q.jsx)(i,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),t.label,t.badge===`inbox-count`&&n&&f?(0,Q.jsx)(`span`,{"data-slot":`nav-badge`,className:`ml-auto rounded-full bg-violet px-1.5 py-px text-micro font-semibold text-violet-foreground`,children:f}):null,t.badge===`skills-update`&&n&&p?(0,Q.jsxs)(`span`,{"data-slot":`nav-update-marker`,className:`ml-auto flex items-center`,children:[(0,Q.jsx)(`span`,{className:`size-1.5 rounded-full bg-violet`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Skills update available`})]}):null,n&&m.has(t.to)?(0,Q.jsxs)(`span`,{"data-slot":`nav-new-marker`,className:`ml-auto flex items-center`,children:[(0,Q.jsx)(`span`,{className:`size-1.5 rounded-full bg-violet`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`New`})]}):null]},t.to)})}),(0,Q.jsx)(Da,{projectId:e.id,requests:L,children:(0,Q.jsx)(Dv.Provider,{value:ee,children:(0,Q.jsx)(kv,{buckets:ie,currentRunId:n?c:null,now:l,scope:e.id,showTokens:h,showCost:g,onTogglePin:o===`archived`?void 0:ne,onToggleArchive:F})})}),(0,Q.jsx)(X,{to:Pc(e.id,`/`),onClick:M,"data-slot":`project-group-more`,className:`flex h-9 items-center rounded-md px-3 text-label text-muted-foreground transition-colors hover:text-foreground md:h-7`,children:`More…`})]})]})}var oy={claude:!0,codex:!0,junie:!0,opencode:!0,cursor:!0,pi:!0,copilot:!0,omp:!0,antigravity:!0,gemini:!0,kimi:!0},sy=e=>Object.hasOwn(oy,e.name);function cy(e){let t=e.checks.filter(sy);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`:e.disk?.level===`critical`?`disk almost full — ${ly(e.disk.freeBytes)} free`:null}function ly(e){return _(e)||`under 100 MB`}function uy(e){let t=e.disk;if(!t||t.level===`ok`)return null;let n=t.worktreesBytes?` Task worktrees use ${_(t.worktreesBytes)}.`:``,r=t.level===`critical`?` New agents will not start until space is freed.`:``;return`Only ${ly(t.freeBytes)} free on the disk holding task worktrees.${n}${r} Reclaim finished tasks' worktrees (branches are kept) or delete old tasks.`}function dy(e){let t=`cezar v${e.version}`,n=cy(e);if(n)return`${t} · ${n}`;let r=e.disk?.level===`low`?` · low disk space (${ly(e.disk.freeBytes)} free)`:``,i=e.checks.filter(e=>!e.available).map(e=>e.name);return r?`${t}${r}`:i.length?`${t} · optional: ${i.join(`, `)} not installed`:t}function fy(e){return e===void 0||e?.available?null:e?e.available===void 0?null:`GitHub is unreachable — ${e.reason??`unknown reason`}. The GitHub tab can retry.`:`No GitHub remote detected — the GitHub tab is hidden. Every plain-git feature still works.`}function py({health:e,forge:t}){if(!e)return null;let n=fy(t),r=cy(e),i=uy(e);return(0,Q.jsxs)(so,{children:[(0,Q.jsx)(to,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`tools-menu-trigger`,title:dy(e),className:`flex items-center gap-1.5 rounded-full border border-border px-2 py-0.5 text-meta font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:[(0,Q.jsx)(Nc,{tone:r||i?`pending`:`success`}),`Tools`,(0,Q.jsx)(Xa,{className:`size-[11px]`,"aria-hidden":`true`})]})}),(0,Q.jsxs)(ro,{side:`top`,align:`start`,"data-slot":`tools-menu-content`,className:`w-[240px]`,children:[(0,Q.jsx)(eo,{className:`eyebrow text-soft-foreground`,children:`Installed tools`}),e.checks.map(e=>e.available?(0,Q.jsx)(my,{check:e},e.name):(0,Q.jsx)(gy,{check:e},e.name)),n?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(oo,{}),(0,Q.jsx)(`p`,{"data-slot":`forge-note`,className:`px-2 py-1.5 text-meta leading-snug text-muted-foreground`,children:n})]}):null,i?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(oo,{}),(0,Q.jsx)(`p`,{"data-slot":`disk-note`,className:`px-2 pt-1.5 text-meta leading-snug text-muted-foreground`,children:i}),(0,Q.jsx)(ao,{asChild:!0,children:(0,Q.jsx)(X,{to:`/settings/worktrees`,"data-slot":`disk-reclaim`,className:`text-meta font-semibold text-violet`,children:`Manage worktrees →`})})]}):null,(0,Q.jsx)(oo,{}),(0,Q.jsx)(ao,{asChild:!0,children:(0,Q.jsxs)(Or,{to:hy,"data-slot":`tools-settings`,className:`gap-2 text-label text-muted-foreground`,children:[(0,Q.jsx)(yu,{className:`size-3.5`,"aria-hidden":`true`}),`Agent accounts`]})})]})]})}function my({check:e}){return(0,Q.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,Q.jsx)(Nc,{tone:`success`}),(0,Q.jsx)(`span`,{className:`font-mono text-label font-medium`,children:e.name}),(0,Q.jsx)(`span`,{"data-slot":`tool-version`,className:`ml-auto font-mono text-meta font-medium text-muted-foreground tabular-nums`,children:e.version??`not found`})]})}var hy=`/settings/global/accounts`;function gy({check:e}){let t=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(Nc,{tone:`danger`}),(0,Q.jsx)(`span`,{className:`font-mono text-label font-medium`,children:e.name}),(0,Q.jsx)(`span`,{"data-slot":`tool-version`,className:`ml-auto font-mono text-meta font-medium text-muted-foreground`,children:`not found`})]}),e.hint||sy(e)?(0,Q.jsxs)(`span`,{className:`flex items-end justify-between gap-3 pl-[15px]`,children:[e.hint?(0,Q.jsx)(`span`,{"data-slot":`tool-hint`,className:`min-w-0 text-meta leading-snug text-muted-foreground`,children:e.hint}):null,sy(e)?(0,Q.jsx)(`span`,{"data-slot":`tool-setup`,className:`ml-auto shrink-0 text-meta font-semibold text-violet`,children:`Set up →`}):null]}):null]});return sy(e)?(0,Q.jsx)(ao,{asChild:!0,children:(0,Q.jsx)(Or,{to:`${hy}?agent=${encodeURIComponent(e.name)}`,"data-slot":`tool-row`,"data-tool":e.name,"data-available":`false`,className:`flex-col items-stretch gap-1`,children:t})}):(0,Q.jsx)(`div`,{"data-slot":`tool-row`,"data-tool":e.name,"data-available":`false`,className:`flex flex-col items-stretch gap-1 rounded-sm px-2 py-1.5`,children:t})}var _y=Object.assign({"../../assets/mascots/analyst/blink.webp":`/assets/blink-mcM10OfP.webp`,"../../assets/mascots/analyst/body.webp":`/assets/body-v5xTmq5E.webp`,"../../assets/mascots/analyst/concerned.webp":`/assets/concerned-DrSCYUQV.webp`,"../../assets/mascots/analyst/excited.webp":`/assets/excited-BvbUAHvw.webp`,"../../assets/mascots/analyst/happy.webp":`/assets/happy-nVffy2Sx.webp`,"../../assets/mascots/analyst/left.webp":`/assets/left-BUX98ijg.webp`,"../../assets/mascots/analyst/leg-left.webp":`/assets/leg-left-0EW5L4pu.webp`,"../../assets/mascots/analyst/leg-right.webp":`/assets/leg-right-BCgv_Tjj.webp`,"../../assets/mascots/analyst/portrait.webp":`/assets/portrait-Bq7D7LzX.webp`,"../../assets/mascots/analyst/right.webp":`/assets/right-BbES4jIG.webp`,"../../assets/mascots/analyst/standing.webp":`/assets/standing-ClF4PE2-.webp`,"../../assets/mascots/automator/blink.webp":`/assets/blink-C380t2a5.webp`,"../../assets/mascots/automator/body.webp":`/assets/body-DlFNtp32.webp`,"../../assets/mascots/automator/concerned.webp":`/assets/concerned-CXQVACqJ.webp`,"../../assets/mascots/automator/excited.webp":`/assets/excited-cSRbau5J.webp`,"../../assets/mascots/automator/happy.webp":`/assets/happy-Ch9wxHii.webp`,"../../assets/mascots/automator/left.webp":`/assets/left-CCrTs359.webp`,"../../assets/mascots/automator/leg-left.webp":`/assets/leg-left-DsfFyCf7.webp`,"../../assets/mascots/automator/leg-right.webp":`/assets/leg-right-CU-y_n5h.webp`,"../../assets/mascots/automator/portrait.webp":`/assets/portrait-C6HtaggP.webp`,"../../assets/mascots/automator/right.webp":`/assets/right-W2oGaUHb.webp`,"../../assets/mascots/automator/standing.webp":`/assets/standing-CoS9fBjb.webp`,"../../assets/mascots/base/blink.webp":`/assets/blink-DY4Sm5aw.webp`,"../../assets/mascots/base/body.webp":`/assets/body-Goc64z5o.webp`,"../../assets/mascots/base/concerned.webp":`/assets/concerned-TOjmS1qX.webp`,"../../assets/mascots/base/excited.webp":`/assets/excited-TMExhEMj.webp`,"../../assets/mascots/base/happy.webp":`/assets/happy-URIT6hFl.webp`,"../../assets/mascots/base/left.webp":`/assets/left-D_qxT7z_.webp`,"../../assets/mascots/base/leg-left.webp":`/assets/leg-left-BahG1x_b.webp`,"../../assets/mascots/base/leg-right.webp":`/assets/leg-right-BOxKTHZ9.webp`,"../../assets/mascots/base/portrait.webp":`/assets/portrait-DHLQRy13.webp`,"../../assets/mascots/base/right.webp":`/assets/right-Dz7jYN17.webp`,"../../assets/mascots/base/standing.webp":`/assets/standing-C5Tul1Nv.webp`,"../../assets/mascots/builder/blink.webp":`/assets/blink-CLn5VMYQ.webp`,"../../assets/mascots/builder/body.webp":`/assets/body-D7Q8eJDv.webp`,"../../assets/mascots/builder/concerned.webp":`/assets/concerned-BIuYysOA.webp`,"../../assets/mascots/builder/excited.webp":`/assets/excited-CCH-VUDr.webp`,"../../assets/mascots/builder/happy.webp":`/assets/happy-CCpAho8w.webp`,"../../assets/mascots/builder/left.webp":`/assets/left-S_rwAL-X.webp`,"../../assets/mascots/builder/leg-left.webp":`/assets/leg-left-Iq6VC-OZ.webp`,"../../assets/mascots/builder/leg-right.webp":`/assets/leg-right-Dq0ze2e4.webp`,"../../assets/mascots/builder/portrait.webp":`/assets/portrait-BeDbYw8Z.webp`,"../../assets/mascots/builder/right.webp":`/assets/right-C2klSA-G.webp`,"../../assets/mascots/builder/standing.webp":`/assets/standing-CUU2Jka6.webp`,"../../assets/mascots/dispatcher/blink.webp":`/assets/blink-B4Y4PYCR.webp`,"../../assets/mascots/dispatcher/body.webp":`/assets/body-CXEwT_gR.webp`,"../../assets/mascots/dispatcher/concerned.webp":`/assets/concerned-BWTrkjRS.webp`,"../../assets/mascots/dispatcher/excited.webp":`/assets/excited-B-w6ozXs.webp`,"../../assets/mascots/dispatcher/happy.webp":`/assets/happy-kfLwwDLp.webp`,"../../assets/mascots/dispatcher/left.webp":`/assets/left-CxWtAZHp.webp`,"../../assets/mascots/dispatcher/leg-left.webp":`/assets/leg-left-C6ZvH8fW.webp`,"../../assets/mascots/dispatcher/leg-right.webp":`/assets/leg-right-BwrF93s6.webp`,"../../assets/mascots/dispatcher/portrait.webp":`/assets/portrait-BJ2e30PF.webp`,"../../assets/mascots/dispatcher/right.webp":`/assets/right-XJjUU0AU.webp`,"../../assets/mascots/dispatcher/standing.webp":`/assets/standing-DZrhVTuG.webp`,"../../assets/mascots/guardian/blink.webp":`/assets/blink-1oEUjxch.webp`,"../../assets/mascots/guardian/body.webp":`/assets/body-D-UrLURv.webp`,"../../assets/mascots/guardian/concerned.webp":`/assets/concerned-DdsJa1t2.webp`,"../../assets/mascots/guardian/excited.webp":`/assets/excited-B4Sch7Ub.webp`,"../../assets/mascots/guardian/happy.webp":`/assets/happy-ZufSdCLm.webp`,"../../assets/mascots/guardian/left.webp":`/assets/left-BBmAC9hS.webp`,"../../assets/mascots/guardian/leg-left.webp":`/assets/leg-left-BZ8ETYLj.webp`,"../../assets/mascots/guardian/leg-right.webp":`/assets/leg-right-DKSfNi2y.webp`,"../../assets/mascots/guardian/portrait.webp":`/assets/portrait-q94U_uD6.webp`,"../../assets/mascots/guardian/right.webp":`/assets/right-BFOa1Ihi.webp`,"../../assets/mascots/guardian/standing.webp":`/assets/standing-MhG0Chks.webp`,"../../assets/mascots/planner/blink.webp":`/assets/blink-D4EaTnc2.webp`,"../../assets/mascots/planner/body.webp":`/assets/body-EreQeu3g.webp`,"../../assets/mascots/planner/concerned.webp":`/assets/concerned-tIx9dV3J.webp`,"../../assets/mascots/planner/excited.webp":`/assets/excited-BPQk8ECE.webp`,"../../assets/mascots/planner/happy.webp":`/assets/happy-B7LJPne_.webp`,"../../assets/mascots/planner/left.webp":`/assets/left-DDCoVDRG.webp`,"../../assets/mascots/planner/leg-left.webp":`/assets/leg-left-rVU9cV-d.webp`,"../../assets/mascots/planner/leg-right.webp":`/assets/leg-right-t34e1CvD.webp`,"../../assets/mascots/planner/portrait.webp":`/assets/portrait-D44z6yep.webp`,"../../assets/mascots/planner/right.webp":`/assets/right-BLsBZrK1.webp`,"../../assets/mascots/planner/standing.webp":`/assets/standing-Ca5nprIS.webp`,"../../assets/mascots/reviewer/blink.webp":`/assets/blink-BpqW08tf.webp`,"../../assets/mascots/reviewer/body.webp":`/assets/body-_FLmHm_q.webp`,"../../assets/mascots/reviewer/concerned.webp":`/assets/concerned-BW_ywmzK.webp`,"../../assets/mascots/reviewer/excited.webp":`/assets/excited-BRFi0cue.webp`,"../../assets/mascots/reviewer/happy.webp":`/assets/happy-CnoCjXOf.webp`,"../../assets/mascots/reviewer/left.webp":`/assets/left-QXVHT2zO.webp`,"../../assets/mascots/reviewer/leg-left.webp":`/assets/leg-left-BGo9dZbQ.webp`,"../../assets/mascots/reviewer/leg-right.webp":`/assets/leg-right-BeDSbUV7.webp`,"../../assets/mascots/reviewer/portrait.webp":`/assets/portrait-CcOzDXGs.webp`,"../../assets/mascots/reviewer/right.webp":`/assets/right-BVU3rYuj.webp`,"../../assets/mascots/reviewer/standing.webp":`/assets/standing-C42GacCE.webp`,"../../assets/mascots/scout/blink.webp":`/assets/blink-Cn_tI5Yd.webp`,"../../assets/mascots/scout/body.webp":`/assets/body-DdNSx4-d.webp`,"../../assets/mascots/scout/concerned.webp":`/assets/concerned-Dlln-1nu.webp`,"../../assets/mascots/scout/excited.webp":`/assets/excited-8dK2gfAF.webp`,"../../assets/mascots/scout/happy.webp":`/assets/happy-DVeEwiyo.webp`,"../../assets/mascots/scout/left.webp":`/assets/left-DFGwPnRL.webp`,"../../assets/mascots/scout/leg-left.webp":`/assets/leg-left-C-DJQ3Pt.webp`,"../../assets/mascots/scout/leg-right.webp":`/assets/leg-right-2MnCGKHj.webp`,"../../assets/mascots/scout/portrait.webp":`/assets/portrait-DU3qlTxc.webp`,"../../assets/mascots/scout/right.webp":`/assets/right-Cte2BTL5.webp`,"../../assets/mascots/scout/standing.webp":`/assets/standing-CgOaMKRT.webp`,"../../assets/mascots/shared/focused.webp":`/assets/focused-XMnI1Trp.webp`,"../../assets/mascots/shared/laptop.webp":`/assets/laptop-D2EKUOdE.webp`,"../../assets/mascots/shared/typing-left.webp":`/assets/typing-left-BWPbVi7e.webp`,"../../assets/mascots/shared/typing-right.webp":`/assets/typing-right-HDY0V90O.webp`});function vy(e,t){let n=_y[`../../assets/mascots/${e}/${t}.webp`];if(!n)throw Error(`Missing mascot artwork: ${e}/${t}`);return n}var yy=[{shape:`M16 3a13 13 0 1 0 0 26 13 13 0 0 0 0-26Z`,eyes:[18,11]},{shape:`M16 2c5 6 11 11 11 17a11 11 0 0 1-22 0C5 13 11 8 16 2Z`,eyes:[17.5,14]},{shape:`M8.5 26A6.5 6.5 0 0 1 6 13.5a7 7 0 0 1 8-5.2 7.500 7.500 0 0 1 12.7 3.2A7.500 7.500 0 0 1 24 26Z`,eyes:[18,12.5]},{shape:`M8 3h12a5 5 0 0 1 5 5v11a5 5 0 0 1-5 5H8a5 5 0 0 1-5-5V8a5 5 0 0 1 5-5Z`,eyes:[13,9],companion:`M22 12c3 3.600 7 6.400 7 10.500a7 7 0 0 1-14 0C15 18.400 19 15.600 22 12Z`},{shape:`M16 3a13 13 0 1 0 0 26 13 13 0 0 0 0-26Z`,eyes:[17,9.5]},{shape:`M16 3c6 0 10.500 8 10.500 15S22 29 16 29 5.500 25 5.500 18 10 3 16 3Z`,eyes:[18,10.5]},{shape:`M10 7h12a9 9 0 0 1 0 18H10a9 9 0 0 1 0-18Z`,eyes:[19,12]},{shape:`M16 4c1.500 0 2.700.8 3.500 2.200l8.600 15.600c1.300 2.500-.4 5.200-3.200 5.200H7.100c-2.800 0-4.500-2.700-3.200-5.200l8.600-15.600C13.300 4.800 14.500 4 16 4Z`,eyes:[16,13]},{shape:`M9 3h14a6 6 0 0 1 6 6v14a6 6 0 0 1-6 6H9a6 6 0 0 1-6-6V9a6 6 0 0 1 6-6Z`,eyes:[18,9.5]}],by=[`oklch(0.60 0.20 295)`,`oklch(0.66 0.17 250)`,`oklch(0.72 0.15 152)`,`oklch(0.70 0.11 180)`,`oklch(0.55 0.07 55)`,`oklch(0.70 0.17 50)`,`oklch(0.62 0.20 22)`,`oklch(0.70 0.19 350)`,`oklch(0.55 0.17 275)`],xy=`oklch(0.58 0.17 250)`;function Sy(e){let t=Math.abs(Math.trunc(e))%64;return{...yy[t%yy.length],fill:by[(t+Math.floor(t/yy.length))%by.length]}}function Cy({x:e,y:t,scale:n=1}){let r=e=>(0,Q.jsx)(`ellipse`,{cx:e,cy:t,rx:.95*n,ry:1.9*n,fill:`white`,transform:`rotate(-10 ${e} ${t})`});return(0,Q.jsxs)(Q.Fragment,{children:[r(e),r(e+4.2*n)]})}function wy({avatar:e,mascot:t,className:n}){let r=(0,Z.useId)(),[i,a]=(0,Z.useState)(),o=Sy(e),s=`companion`in o?o.companion:void 0;return t&&i!==t?(0,Q.jsx)(`img`,{onError:()=>a(t),src:vy(t,`portrait`),alt:``,"aria-hidden":`true`,"data-slot":`manager-avatar`,"data-mascot":t,className:G(`size-11 shrink-0 object-contain`,n)}):(0,Q.jsxs)(`svg`,{viewBox:`0 0 32 32`,"aria-hidden":`true`,"data-slot":`manager-avatar`,"data-persona":e,className:G(`size-11 shrink-0`,n),children:[(0,Q.jsx)(`defs`,{children:(0,Q.jsxs)(`radialGradient`,{id:r,cx:`0.35`,cy:`0.2`,r:`0.9`,children:[(0,Q.jsx)(`stop`,{offset:`0`,stopColor:`white`,stopOpacity:`0.32`}),(0,Q.jsx)(`stop`,{offset:`1`,stopColor:`white`,stopOpacity:`0`})]})}),(0,Q.jsx)(`path`,{d:o.shape,fill:o.fill}),(0,Q.jsx)(`path`,{d:o.shape,fill:`url(#${r})`}),(0,Q.jsx)(Cy,{x:o.eyes[0],y:o.eyes[1]}),s?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`path`,{d:s,fill:xy,stroke:`var(--background)`,strokeWidth:`1`}),(0,Q.jsx)(`path`,{d:s,fill:`url(#${r})`}),(0,Q.jsx)(Cy,{x:21,y:21,scale:.75})]}):null]})}function Ty({manager:e,active:t,now:n,onNavigate:r}){let i=Ey(e);return(0,Q.jsxs)(Or,{to:`/manager/${encodeURIComponent(e.id)}`,"data-slot":`manager-row`,"data-unread":i||void 0,"aria-current":t?`page`:void 0,onClick:r,className:G(`flex min-h-16 items-center gap-2.5 rounded-xl px-2 py-1.5 outline-none transition-colors hover:bg-muted focus-visible:ring-[3px] focus-visible:ring-ring/50`,t&&`bg-muted`),children:[(0,Q.jsx)(wy,{avatar:e.avatar,mascot:e.mascot}),(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,Q.jsxs)(`span`,{className:G(`min-w-0 flex-1 truncate text-ui`,i?`font-semibold text-foreground`:`font-medium`),children:[e.name,i?(0,Q.jsx)(fv,{}):null]}),i?(0,Q.jsx)(`span`,{"data-slot":`manager-unread`,className:`size-2 shrink-0 self-center rounded-full bg-info`,"aria-hidden":`true`}):(0,Q.jsx)(`span`,{className:`shrink-0 text-meta text-soft-foreground`,children:Qc(e.lastActivityAt,n)})]}),(0,Q.jsx)(`span`,{className:`block truncate text-meta text-muted-foreground`,children:nl(e)})]})]})}function Ey(e){return e.unread>0||e.pendingActions>0||e.pendingQuestions>0}function Dy(){let e=zr(T().data?.capabilities.managers===!0).data?.managers;return(0,Z.useMemo)(()=>Ir(e??[]),[e])}function Oy({manager:e,active:t}){let n=Ey(e);return(0,Q.jsxs)(Or,{to:`/manager/${encodeURIComponent(e.id)}`,"data-slot":`manager-rail-item`,"data-unread":n||void 0,"aria-current":t?`page`:void 0,"aria-label":n?`${e.name}, unread`:e.name,title:e.name,className:G(`relative flex size-9 shrink-0 items-center justify-center rounded-md outline-none transition-colors hover:bg-muted focus-visible:ring-[3px] focus-visible:ring-ring/50`,t&&`bg-muted ring-1 ring-border`),children:[(0,Q.jsx)(wy,{avatar:e.avatar,mascot:e.mascot,className:`size-7`}),n?(0,Q.jsx)(`span`,{"data-slot":`manager-unread`,className:`absolute top-0.5 right-0.5 size-2 rounded-full bg-info ring-2 ring-sidebar`,"aria-hidden":`true`}):null]})}function ky(){let{pathname:e}=Dr(),t=Dy();return t.length===0?null:(0,Q.jsx)(`nav`,{"aria-label":`Managers`,"data-slot":`manager-rail`,className:`flex min-h-0 flex-col items-center gap-1 overflow-y-auto overscroll-contain pt-2`,children:t.map(t=>(0,Q.jsx)(Oy,{manager:t,active:e===`/manager/${encodeURIComponent(t.id)}`},t.id))})}function Ay(){let{pathname:e}=Dr(),t=Ag(),n=Dy(),r=new Date(Bs(6e4));return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[n.map(n=>(0,Q.jsx)(Ty,{manager:n,active:e===`/manager/${encodeURIComponent(n.id)}`,now:r,onNavigate:t},n.id)),n.length>0?(0,Q.jsx)(J,{asChild:!0,variant:`ghost`,size:`sm`,className:`mt-1 justify-start gap-2 text-muted-foreground`,children:(0,Q.jsxs)(Or,{to:`/manager/new`,"data-slot":`new-manager`,onClick:t,children:[(0,Q.jsx)(Jo,{"aria-hidden":`true`,className:`size-4`}),`New manager`]})}):null]})}function jy(e){return e?.trim()||null}function My({projectName:e,pageLabel:t,brandName:n}){let r=jy(e),i=jy(t),a=jy(n??null)??`cezar`;return r&&i?`${r} — ${i} · ${a}`:r?`${r} · ${a}`:i?`${i} · ${a}`:a}function Ny(e){let t=My(e);(0,Z.useEffect)(()=>{document.title=t},[t]),(0,Z.useEffect)(()=>{let t=document.querySelector(`link[rel="icon"]`);t||(t=document.createElement(`link`),t.rel=`icon`,document.head.append(t)),t.href=e.brandLogoUrl??`/icon.svg`,t.type=e.brandLogoUrl?.includes(`.svg?`)?`image/svg+xml`:``},[e.brandLogoUrl])}function Py(e,t,n){if(e===void 0||n===void 0||t===null||t!==e.bootProject||n.bootProject!==t||n.capabilities?.localHandoff!==!0||e.projects.some(e=>e.id===t))return e;let r=n.repoRoot,i=r?.replace(/[\\/]+$/,``).split(/[\\/]/).pop();return i?{...e,projects:[{id:t,root:r,name:i,addedAt:``,lastOpenedAt:``,source:`local`,status:n.repo?`ok`:`not-git`,unregistered:!0,...n.repo?{branch:n.repo.branch}:{}},...e.projects]}:e}var Fy={claude:`Anthropic’s coding agent. Uses your Claude account.`,codex:`OpenAI’s coding agent. Uses your ChatGPT account.`,opencode:`Open-source agent. Works with many model providers.`,cursor:`Cursor’s agent, without the editor. Uses your Cursor account.`,copilot:`GitHub’s coding agent. Uses your Copilot plan.`};function Iy(e,t){let n=new Map((t?.providers??[]).map(e=>[e.provider,e])),r=e.agents.flatMap(e=>{let t=n.get(e.provider);if(t?.status===`connected`||t?.enabled===!1)return[];let r=t===void 0||t.status===`not-installed`?`missing`:`signed-out`;return[{...e,label:Zs[e.provider],description:Fy[e.provider],state:r}]});return[...r.filter(e=>e.state===`signed-out`),...r.filter(e=>e.state===`missing`)]}var Ly=/\u001B\][^\u0007\u001B]*(?:\u0007|\u001B\\)|\u001B\[[0-?]*[ -/]*[@-~]/g,Ry=/https?:\/\/[^\s"'<>\u0007\u001B]+/g;function zy(e){let t=e.replace(Ly,` `).match(Ry)??[];for(let e of t.reverse()){let t=By(e.replace(/[.,;:)\]]+$/,``));if(t&&![`localhost`,`127.0.0.1`,`[::1]`].includes(t.hostname))return t.href}return null}function By(e){try{return new URL(e)}catch{return null}}var Vy=Z.lazy(()=>Sr(()=>import(`./terminal-pane-YnSc_Vhs.js`).then(e=>({default:e.TerminalPane})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10]))),Hy=3e3,Uy=60,Wy=4,Gy=1e4;function Ky(e,t){return Iy(e,t).some(e=>e.state===`signed-out`)?`Sign in to an agent`:`Pick your agent`}function qy({setup:e,status:t}){let n=f(),r=Qe(),i=Ft(),a=ln(),o=a.mutateAsync,s=a.mutate,c=Iy(e,t),[l,u]=Z.useState(e.session),[d,p]=Z.useState(null),m=e.session;Z.useEffect(()=>{m&&(u(m),m.exitCode===null&&p(null))},[m]);let h=r.mutate,g=Z.useCallback((e,t)=>{p(null),h({provider:e,action:t},{onSuccess:e=>u(e),onError:n=>{p({provider:e,action:t,message:n.message}),s()}})},[s,h]),_=Z.useRef(null),v=Z.useCallback((e,t)=>{if(_.current===e.id)return;_.current=e.id;let{provider:r,action:i}=e,a=Zs[r];i===`install`&&n(),o().then(e=>{let n=e.providers.find(e=>e.provider===r);if(n?.status===`connected`)return;let o=n!==void 0&&n.status!==`not-installed`;i===`install`&&o?g(r,`login`):p(i===`login`||t?{provider:r,action:i,message:t||`The sign-in to ${a} did not finish.`}:{provider:r,action:i,message:`${a} installed, but cezar cannot find it. Restart cezar from a new terminal, or check that npm’s global folder is on your PATH.`})},()=>p({provider:r,action:i,message:`cezar could not check the agent. Try again.`}))},[g,n,o]),y=m?.exitCode??null;Z.useEffect(()=>{if(!(!m||y===null)){if(m.action===`install`&&y!==0){if(_.current===m.id)return;_.current=m.id,n(),p({provider:m.provider,action:m.action,message:`${Zs[m.provider]} did not install. The terminal says why.`});return}v(m,``)}},[y,n,m,v]);let b=Z.useRef(null);m&&(b.current=m.id),Z.useEffect(()=>{m||!l||l.exitCode!==null||b.current!==l.id||(u(null),v(l,`The terminal closed before it finished.`))},[m,v,l]);let x=l!==null&&l.exitCode===null,S=x&&l?.action===`install`,C=x&&l?.action===`login`;Z.useEffect(()=>{if(!C)return;let e=0,t=window.setInterval(()=>{e+=1,(e<=Uy||e%Wy===0)&&s()},Hy);return()=>window.clearInterval(t)},[s,C]),Z.useEffect(()=>{if(x)return;let e=window.setInterval(()=>s(),Gy);return()=>window.clearInterval(e)},[s,x]);let w=Z.useRef(null);w.current=C&&l?l.id:null;let T=Z.useRef(!1);Z.useEffect(()=>(T.current=!0,()=>{T.current=!1;let e=w.current;window.setTimeout(()=>{!T.current&&e&&Hn(e).catch(()=>{})},0)}),[]);let E=()=>{l&&i.mutate(l.id),u(null)},D=()=>{p(null),x||u(null)};return(0,Q.jsx)(`div`,{className:`mt-7 flex w-full flex-col gap-3 text-left`,children:c.map(e=>{let t=l?.provider===e.provider,n=d?.provider===e.provider?d:null,i=x||r.isPending;return(0,Q.jsxs)(`div`,{"data-slot":`agent-row`,"data-state":e.state,"data-provider":e.provider,className:`rounded-xl border border-border bg-card p-4`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`div`,{className:`text-lead text-foreground`,children:e.label}),(0,Q.jsx)(`div`,{className:`text-ui text-muted-foreground`,children:e.state===`missing`?e.description:`Installed, not signed in`})]}),(0,Q.jsx)(Jy,{row:e,open:t,busy:i,onStart:g})]}),!t&&!n&&e.state===`missing`&&e.installCommand===null?(0,Q.jsx)(`p`,{className:`mt-3 text-ui text-soft-foreground`,children:e.installHint}):null,!t&&!n&&e.state===`missing`&&e.installCommand?(0,Q.jsx)(Yy,{command:e.installCommand}):null,t&&l?(0,Q.jsx)(Xy,{session:l,running:x,installing:S},l.id):null,n&&!t?(0,Q.jsx)(Yy,{command:(n.action===`install`?e.installCommand:e.loginCommand)??``}):null,n?(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center justify-between gap-3`,children:[(0,Q.jsx)(`p`,{role:`alert`,className:`min-w-0 flex-1 text-ui text-danger`,children:n.message}),(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(J,{size:`sm`,variant:`outline`,className:`font-normal`,onClick:D,children:`Close`}),(0,Q.jsx)(J,{size:`sm`,className:`font-normal`,disabled:r.isPending,onClick:()=>g(n.provider,n.action),children:`Try again`})]})]}):null,t&&x?(0,Q.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-3`,children:[(0,Q.jsx)(`p`,{className:`text-ui text-soft-foreground`,children:S?`Sign-in comes next.`:`This page continues by itself.`}),(0,Q.jsx)(J,{size:`sm`,variant:`outline`,className:`font-normal`,onClick:E,children:`Cancel`})]}):null]},e.provider)})})}function Jy({row:e,open:t,busy:n,onStart:r}){return t?null:e.state===`signed-out`?(0,Q.jsx)(J,{className:`font-normal`,disabled:n||e.loginCommand===null,onClick:()=>r(e.provider,`login`),children:`Sign in`}):e.installCommand===null?null:(0,Q.jsx)(J,{className:`font-normal`,disabled:n,onClick:()=>r(e.provider,`install`),children:`Install`})}function Yy({command:e}){return(0,Q.jsxs)(`code`,{className:`mt-3 block truncate font-mono text-meta text-soft-foreground`,title:e,children:[(0,Q.jsx)(`span`,{className:`select-none`,children:`$ `}),e]})}function Xy({session:e,running:t,installing:n}){let[r,i]=Z.useState(null),a=e.id,o=Z.useRef(``),s=e.action===`login`,c=Z.useMemo(()=>({read:async e=>{let t=await ct(a,e);return s&&t.data&&(o.current=(o.current+t.data).slice(-16384),i(zy(o.current))),t},write:e=>We(a,e),resize:(e,t)=>it(a,e,t)}),[a,s]),l=Z.useMemo(()=>({id:a,exitCode:t?null:e.exitCode,topic:t?e.topic:null}),[a,t,e.exitCode,e.topic]),u=Zs[e.provider];return(0,Q.jsxs)(`div`,{"data-slot":`agent-setup-terminal`,className:`mt-3 flex flex-col gap-2`,children:[t?(0,Q.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-ui text-muted-foreground`,children:[(0,Q.jsx)(Eo,{className:`size-3.5 shrink-0 motion-safe:animate-spin`,"aria-hidden":`true`}),n?e.command.startsWith(`sudo `)?`Installing ${u}. Click the terminal and type your computer password if it asks.`:`Installing ${u}…`:`Sign in to ${u}. Click the terminal to answer its questions.`]}):null,(0,Q.jsx)(Yy,{command:e.command}),(0,Q.jsx)(`div`,{className:`relative h-72 overflow-hidden rounded-lg border border-border bg-card-2`,children:(0,Q.jsx)(Z.Suspense,{fallback:null,children:(0,Q.jsx)(Vy,{runId:e.runId,session:l,active:!0,io:c})})}),s&&r&&t?(0,Q.jsx)(J,{asChild:!0,size:`sm`,variant:`outline`,className:`self-start font-normal`,children:(0,Q.jsxs)(`a`,{href:r,target:`_blank`,rel:`noopener noreferrer`,children:[`Open sign-in page`,(0,Q.jsx)(ho,{"aria-hidden":`true`})]})}):null]})}function Zy(){let e=W();return Z.useCallback(t=>{let n=V.uiState,r=e.getQueryData(n),i={...r?.onboarding,...typeof t==`function`?t(r?.onboarding):t};e.setQueryData(n,{...r,onboarding:i}),zt({onboarding:i}).then(t=>e.setQueryData(n,t)).catch(t=>{e.setQueryData(n,r),Y(t instanceof Error?t.message:String(t),{tone:`danger`})})},[e])}function Qy({title:e,slot:t,rail:n,why:r,subtitle:i,banner:a,wide:o=!1,children:s}){return(0,Q.jsxs)(`section`,{"data-onboarding":``,"data-slot":`first-run`,"data-first-run":t,className:G(`mx-auto flex w-full flex-1 flex-col items-center px-1 pt-6 pb-12 text-center md:pt-12`,o?`max-w-3xl`:`max-w-2xl`),children:[a,n,(0,Q.jsx)(`h2`,{className:G(`text-4xl font-light tracking-tight text-balance text-foreground`,n&&`mt-8`),children:e}),r?(0,Q.jsx)(`p`,{className:`mt-3 max-w-md text-lead text-muted-foreground`,children:r}):null,i?(0,Q.jsx)(`p`,{className:`mt-2 text-body text-muted-foreground`,children:i}):null,s]})}var $y=`inline-flex items-center gap-1.5 text-ui text-muted-foreground transition-colors hover:text-foreground`,eb=`inline-flex h-[30px] items-center gap-1.5 rounded-full border border-border px-3 text-label text-muted-foreground transition-colors hover:border-muted-foreground hover:text-foreground`,tb=`inline-flex h-8 items-center gap-2 rounded-full px-3 text-ui text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`;function nb(){let[e,t]=Z.useState(0);return Z.useLayoutEffect(()=>{let e=()=>{let e=document.querySelector(`aside[data-slot="sidebar"]`);t(e?Math.max(0,e.getBoundingClientRect().right)/2:0)};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),e}function rb({title:e,description:t,onOpenChange:n,onSubmit:r,footer:i,wide:a=!1,children:o}){let s=nb();return(0,Q.jsx)(ws,{open:!0,onOpenChange:n,children:(0,Q.jsxs)(Ss,{"data-onboarding":``,className:G(`gap-0 p-0`,a?`sm:max-w-lg`:`sm:max-w-md`),style:s?{left:`calc(50% + ${s}px)`}:void 0,onKeyDown:e=>{r&&e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),r())},children:[(0,Q.jsxs)(Ns,{className:`border-b border-border px-6 py-5 text-left`,children:[(0,Q.jsx)(ys,{className:`text-xl font-light tracking-tight`,children:e}),(0,Q.jsx)(xs,{children:t})]}),(0,Q.jsx)(`div`,{className:`px-6 py-5 text-left`,children:o}),(0,Q.jsx)(Cs,{className:`border-t border-border px-6 py-4`,children:i})]})})}function ib({title:e,description:t,pages:n,slot:r,onOpenChange:i}){let[a,o]=Z.useState(0),s=n[Math.min(a,n.length-1)];if(!s)return null;let c=a>=n.length-1,l=()=>c?i(!1):o(a+1);return(0,Q.jsx)(rb,{wide:!0,title:e,description:t,onOpenChange:i,onSubmit:l,footer:(0,Q.jsxs)(`div`,{className:`flex w-full items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`mr-auto flex items-center gap-1.5`,"aria-label":`${a+1} of ${n.length}`,children:n.map((e,t)=>(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:G(`h-1.5 rounded-full transition-all`,t===a?`w-4 bg-violet`:`w-1.5 bg-border`)},e.id))}),a>0?(0,Q.jsx)(J,{variant:`outline`,className:`font-normal`,onClick:()=>o(a-1),children:`Back`}):null,(0,Q.jsx)(J,{className:`font-normal`,onClick:l,children:c?`Done`:`Next`})]}),children:(0,Q.jsxs)(`div`,{"data-slot":r,"data-page":s.id,onKeyDown:e=>{e.key===`ArrowRight`&&!c&&o(a+1),e.key===`ArrowLeft`&&a>0&&o(a-1)},children:[(0,Q.jsx)(`div`,{"aria-hidden":`true`,className:`onboarding-preview flex h-44 items-end justify-center overflow-hidden rounded-lg border border-border px-8 pt-6`,children:s.picture}),(0,Q.jsxs)(`div`,{className:`mt-5 flex min-h-28 flex-col`,children:[(0,Q.jsx)(`h3`,{className:`text-lg font-light tracking-tight text-foreground`,children:s.title}),(0,Q.jsx)(`p`,{className:`mt-1 text-ui text-muted-foreground`,children:s.body}),s.action?(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>{i(!1),s.action?.onClick()},className:`mt-3 inline-flex items-center gap-1 self-start text-ui text-violet hover:underline`,children:[s.action.label,(0,Q.jsx)(_a,{className:`size-3.5`,"aria-hidden":`true`})]}):null]})]})})}function ab({title:e,description:t,picture:n,recommended:r=!1,badge:i=`Start here`,onClick:a}){return(0,Q.jsxs)(`button`,{type:`button`,onClick:a,"data-recommended":r||void 0,className:G(`group relative flex flex-col items-center gap-4 rounded-xl border px-4 pt-7 pb-5 text-center transition-colors`,r?`onboarding-announcement`:`border-border bg-card hover:border-muted-foreground`),children:[r?(0,Q.jsx)(`span`,{className:`absolute top-3 right-3 eyebrow text-violet`,children:i}):null,(0,Q.jsx)(`span`,{className:`grid h-16 place-items-center`,"aria-hidden":`true`,children:n}),(0,Q.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-lg font-light text-foreground`,children:e}),(0,Q.jsx)(`span`,{className:`text-label text-muted-foreground`,children:t})]})]})}function ob({title:e,description:t,picture:n,value:r,selected:i,disabled:a=!1,reason:o,onClick:s}){return(0,Q.jsxs)(`button`,{type:`button`,"data-value":r,"aria-pressed":i,"aria-label":e,disabled:a,title:o,onClick:s,className:G(`flex items-center gap-3 rounded-xl border px-4 py-3 text-left transition-colors disabled:opacity-50`,i?`onboarding-announcement border-violet/60`:`border-border bg-card hover:border-muted-foreground`),children:[(0,Q.jsx)(`span`,{className:`grid size-12 shrink-0 place-items-center`,"aria-hidden":`true`,children:n}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,Q.jsx)(`span`,{className:`text-lead text-foreground`,children:e}),(0,Q.jsx)(`span`,{className:`text-label text-muted-foreground`,children:t})]})]})}function sb({steps:e}){return(0,Q.jsx)(`ol`,{"data-slot":`step-rail`,className:`flex items-center gap-2 text-label`,children:e.map((e,t)=>(0,Q.jsxs)(`li`,{"data-step":e.id,"data-state":e.state,className:`flex items-center gap-2`,children:[t>0?(0,Q.jsx)(`span`,{className:G(`h-px w-6`,e.state===`next`?`bg-border`:`bg-violet/60`),"aria-hidden":`true`}):null,(0,Q.jsxs)(`span`,{className:G(`inline-flex items-center gap-1.5`,e.state===`current`?`text-foreground`:e.state===`done`?`text-muted-foreground`:`text-soft-foreground`),children:[(0,Q.jsx)(`span`,{className:G(`grid size-5 place-items-center rounded-full border font-mono text-micro`,e.state===`done`&&`border-violet/60 bg-violet/15 text-violet`,e.state===`current`&&`border-violet text-foreground`,e.state===`next`&&`border-border text-soft-foreground`),"aria-hidden":`true`,children:e.state===`done`?(0,Q.jsx)(Wa,{className:`size-3`}):t+1}),e.label,e.state===`current`?(0,Q.jsx)(`span`,{className:`sr-only`,children:`(current step)`}):null]})]},e.id))})}function cb({bar:e,children:t,className:n}){return(0,Q.jsxs)(`div`,{className:G(`w-full max-w-xs rounded-t-lg border border-b-0 border-border bg-background shadow-[0_-12px_40px_-20px_var(--violet)]`,n),children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5 border-b border-border px-3 py-2`,children:[(0,Q.jsx)(`span`,{className:`size-1.5 rounded-full bg-muted-foreground/40`}),(0,Q.jsx)(`span`,{className:`size-1.5 rounded-full bg-muted-foreground/40`}),(0,Q.jsx)(`span`,{className:`size-1.5 rounded-full bg-muted-foreground/40`}),e]}),(0,Q.jsx)(`div`,{className:`p-3`,children:t})]})}var lb=`h-2 rounded bg-muted`;function ub(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 db(e){let t=new URLSearchParams;e.skill&&t.set(`skill`,e.skill),e.ref&&t.set(`ref`,e.ref),e.todo&&t.set(`todo`,e.todo);let n=t.toString();return n?`/new?${n}`:`/new`}function fb(e){return`${e.kind===`pr`?`Address GitHub pull request`:`Fix GitHub issue`} #${e.number}: ${e.title}\n\n${e.url}`}function pb(e,t=[]){let n=fb(e);return e.body?.trim()&&(n+=`\n\n---\n\n${e.body.trim()}`),t.length&&(n+=mb(t)),n}function mb(e){return`\n\nUse these skills where relevant: ${e.join(`, `)}.`}function hb(e,t){return e.replace(/\{\{\s*number\s*\}\}/gi,()=>`#${t.number}`).replace(/\{\{\s*title\s*\}\}/gi,()=>t.title).replace(/\{\{\s*url\s*\}\}/gi,()=>t.url)}function gb(e,t){if(e.includes(t.url))return!0;let n=t.kind===`pr`?String.raw`(?:pull\s+request|pr)`:String.raw`issue`;return new RegExp(String.raw`\b${n}\s*#?\s*${t.number}\b`,`i`).test(e)}function _b(e,t,n){let r=(n??``).trim();if(!r)return pb(e,t);let i=fb(e),a=r.startsWith(i)?i+hb(r.slice(i.length),e):hb(r,e),o=gb(a,e)?a:`${i}\n\n${a}`;return t.length?o+mb(t):o}function vb(e){let t=[];for(let n of e.slice(0,8)){let e=new Set(t.map(e=>e.id)),r=n;for(let t=2;e.has(r);t++)r=`${n}-${t}`;t.push({id:r,name:n,skill:n,prompt:`{{task}}`})}return t}function yb(e,t,n,r,i={}){return t?{...i,workflow:t,task:_b(e,n,r)}:n.length?{...i,steps:vb(n),task:_b(e,[],r)}:{...i,workflow:`quick-task`,task:_b(e,[],r)}}function bb(e){let t=new Set;for(let n of e)for(let e of n.labels)t.add(e);return[...t].sort((e,t)=>e.toLowerCase().localeCompare(t.toLowerCase()))}function xb(e,t={}){let n=(t.query??``).trim().toLowerCase(),r=t.labels??[],i=n.replace(/^#/,``),a=i!==``&&/^\d+$/.test(i);return e.filter(e=>r.length>0&&!r.every(t=>e.labels.includes(t))?!1:n===``?!0:a?String(e.number).includes(i):`#${e.number} ${e.title} ${e.author} ${e.body??``}`.toLowerCase().includes(n))}function Sb(e,t){let n=t===`oldest`?1:-1;return[...e].sort((e,t)=>e.createdAt===t.createdAt?(e.number-t.number)*n:e.createdAt<t.createdAt?-n:n)}function Cb(e,t){return e.trim()!==``&&t===0}function wb(e){if(!e||!/^[0-9a-fA-F]{6}$/.test(e))return{borderColor:`var(--border)`,color:`var(--muted-foreground)`};let t=`#${e}`;return{backgroundColor:`${t}22`,borderColor:`${t}66`,color:`color-mix(in srgb, ${t} 50%, var(--foreground))`}}function Tb({gitRepo:e}){let t=Dt(),n=bt().data?.onboarding?.agentCheckSkipped===!0;return t.data===void 0&&!n?null:Sm(t.data)===!1&&!n?(0,Q.jsx)(rx,{}):e===void 0?null:e?(0,Q.jsx)(Wb,{}):(0,Q.jsx)(ux,{})}function Eb({step:e,...t}){return(0,Q.jsx)(Qy,{...t,rail:e?(0,Q.jsx)(Ob,{current:e}):void 0})}var Db=[{id:`agent`,label:`Agent`},{id:`project`,label:`Project`},{id:`task`,label:`First task`}];function Ob({current:e}){let t=Db.findIndex(t=>t.id===e);return(0,Q.jsx)(`ol`,{"data-slot":`step-rail`,className:`flex items-center gap-2 text-label`,children:Db.map((e,n)=>{let r=n<t?`done`:n===t?`current`:`next`;return(0,Q.jsxs)(`li`,{"data-step":e.id,"data-state":r,className:`flex items-center gap-2`,children:[n>0?(0,Q.jsx)(`span`,{className:G(`h-px w-6`,n<=t?`bg-violet/60`:`bg-border`),"aria-hidden":`true`}):null,(0,Q.jsxs)(`span`,{className:G(`inline-flex items-center gap-1.5`,r===`current`?`text-foreground`:r===`done`?`text-muted-foreground`:`text-soft-foreground`),children:[(0,Q.jsx)(`span`,{className:G(`grid size-5 place-items-center rounded-full border font-mono text-micro`,r===`done`&&`border-violet/60 bg-violet/15 text-violet`,r===`current`&&`border-violet text-foreground`,r===`next`&&`border-border text-soft-foreground`),"aria-hidden":`true`,children:r===`done`?(0,Q.jsx)(Wa,{className:`size-3`}):n+1}),e.label,r===`current`?(0,Q.jsx)(`span`,{className:`sr-only`,children:`(current step)`}):null]})]},e.id)})})}var kb=$y,Ab=eb;function jb({children:e}){return(0,Q.jsx)(`ol`,{className:`flex list-decimal flex-col gap-2.5 pl-5 text-ui text-muted-foreground marker:text-soft-foreground`,children:e})}var Mb=`https://cli.github.com`;function Nb(e,t){let n=l(t),r=n.start.mutate;return Z.useEffect(()=>{e&&r()},[e,r]),n}function Pb(e){let t=e.state;return e.start.error?Fb(e.start.error)?`The GitHub CLI is not installed.`:`Sign-in did not finish.`:t?.status===`pending`?`Enter this code on GitHub. It opened in your browser.`:t?.status===`failed`?`Sign-in did not finish.`:t?.status===`done`?`Signed in.`:`Signing in through your browser.`}function Fb(e){return e instanceof pn&&e.status===503}function Ib(e,t){let n=navigator.clipboard?.writeText(e);if(!n){Y(t);return}n.then(()=>Y(`Copied`),()=>Y(t))}function Lb({children:e}){return(0,Q.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-ui text-muted-foreground`,children:[(0,Q.jsx)(Eo,{className:`size-3.5 animate-spin`,"aria-hidden":`true`}),e]})}function Rb({signIn:e}){let t=e.state;return e.start.error?Fb(e.start.error)?(0,Q.jsxs)(jb,{children:[(0,Q.jsx)(`li`,{children:(0,Q.jsx)(`a`,{href:Mb,target:`_blank`,rel:`noopener noreferrer`,className:`text-violet hover:underline`,children:`Install the GitHub CLI`})}),(0,Q.jsx)(`li`,{children:`Come back and press Try again.`})]}):(0,Q.jsx)(`p`,{role:`alert`,className:`text-ui whitespace-pre-line text-danger`,children:e.start.error.message}):t?.status===`failed`?(0,Q.jsx)(`p`,{role:`alert`,className:`text-ui whitespace-pre-line text-danger`,children:t.error}):t?.status===`done`?(0,Q.jsx)(Lb,{children:t.login?`Signed in as ${t.login}.`:`Signed in.`}):t?.status===`pending`?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg border border-border bg-background py-3 pr-2 pl-5`,children:[(0,Q.jsx)(`span`,{"data-testid":`github-login-code`,"aria-label":`One-time code`,className:`font-mono text-2xl tracking-widest text-foreground select-all`,children:t.code}),(0,Q.jsx)(J,{variant:`ghost`,size:`icon`,className:`size-8 shrink-0`,"aria-label":`Copy code`,onClick:()=>Ib(t.code,`Select the code and copy it`),children:(0,Q.jsx)(co,{"aria-hidden":`true`})})]}),(0,Q.jsx)(Lb,{children:`Waiting for GitHub…`})]}):(0,Q.jsx)(Lb,{children:`Starting…`})}function zb({signIn:e,onClose:t}){let n=e.state;return e.start.error!==null||n?.status===`failed`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(J,{variant:`outline`,className:`font-normal`,onClick:t,children:`Close`}),(0,Q.jsx)(J,{className:`font-normal`,onClick:()=>e.start.mutate(),disabled:e.start.isPending,children:`Try again`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(J,{variant:`outline`,className:`font-normal`,onClick:()=>{n?.status!==`done`&&e.cancel.mutate(),t()},children:n?.status===`done`?`Close`:`Cancel`}),n?.status===`pending`?(0,Q.jsx)(J,{asChild:!0,className:`font-normal`,children:(0,Q.jsx)(`a`,{href:n.url,target:`_blank`,rel:`noopener noreferrer`,children:`Open GitHub`})}):null]})}function Bb({command:e}){return(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg border border-border bg-background px-3 py-2.5`,children:[(0,Q.jsxs)(`code`,{className:`min-w-0 flex-1 truncate font-mono text-ui text-foreground select-all`,children:[(0,Q.jsx)(`span`,{className:`text-soft-foreground select-none`,children:`$ `}),e]}),(0,Q.jsx)(J,{variant:`ghost`,size:`icon`,className:`size-7 shrink-0`,"aria-label":`Copy ${e}`,onClick:()=>Ib(e,`Select the command and copy it`),children:(0,Q.jsx)(co,{"aria-hidden":`true`})})]})}var Vb=`flex h-14 w-full items-center gap-3 rounded-xl border border-border bg-card px-5 transition-colors focus-within:border-primary focus-within:shadow-[0_0_0_4px_color-mix(in_srgb,var(--violet)_14%,transparent)]`,Hb=[{icon:Wl,label:`Fix a failing test`,task:`Find a failing or flaky test and fix it.`},{icon:Co,label:`Summarize recent commits`,task:`Summarize the recent commits on this branch.`},{icon:ya,label:`Update the README`,task:`Update the README for the recent changes.`}],Ub=[{icon:ya,label:`Write a README`,task:`Write a README that explains what this project is for and how to run it.`},{icon:Wl,label:`Set up tests`,task:`Set up a test runner with one passing example test.`},{icon:Co,label:`Add a CI workflow`,task:`Add a CI workflow that installs dependencies and runs the tests on every push.`}];function Wb(){let e=Fc(),t=T(),n=mn(),r=t.data?.forge,i=S({limit:3},r?.kind===`github`&&r.available!==!1),a=i.data?.available?i.data.issues.filter(e=>e.kind===`issue`).slice(0,3):[],[o,s]=Z.useState(``),c=t=>e(db({ref:t.trim()})),l=n.data?.info!==void 0&&n.data.info!==null&&n.data.log.length<=1&&a.length===0&&!i.isFetching,u=l?Ub:Hb;return(0,Q.jsxs)(Eb,{title:`What should we build?`,slot:`welcome`,banner:(0,Q.jsx)(Gb,{}),children:[(0,Q.jsxs)(`form`,{className:G(Vb,`mt-7`),onSubmit:e=>{e.preventDefault(),c(o)},children:[(0,Q.jsx)(`input`,{value:o,onChange:e=>s(e.target.value),placeholder:`Describe a task for the agent…`,"aria-label":`Describe a task for the agent`,className:`h-full min-w-0 flex-1 bg-transparent text-lead text-foreground outline-none placeholder:text-soft-foreground`}),(0,Q.jsx)(J,{type:`submit`,size:`icon`,variant:`ghost`,"aria-label":`Continue to the composer`,className:`size-9 shrink-0`,children:(0,Q.jsx)(_a,{"aria-hidden":`true`})})]}),(0,Q.jsx)(`div`,{className:`mt-3 flex flex-wrap justify-center gap-2`,children:u.map(({icon:e,label:t,task:n})=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>c(n),className:`inline-flex h-8 items-center gap-2 rounded-full px-3 text-ui text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:[(0,Q.jsx)(e,{className:`size-3.5`,"aria-hidden":`true`}),t]},t))}),(0,Q.jsx)(Zb,{}),(0,Q.jsx)(Qb,{fresh:l,issues:a,colors:i.data?.labelColors??{}})]})}function Gb(){let e=T(),t=bt(),n=Zy(),r=Fc(),i=t.data?.onboarding?.dismissedAnnouncements,a=t.data?Om({dismissed:i,designMode:e.data?.capabilities.designMode}):null;if(!a)return null;let o=()=>n({dismissedAnnouncements:[...i??[],a.id]});return(0,Q.jsxs)(`div`,{"data-slot":`announcement`,className:`onboarding-announcement relative mb-14 flex w-full items-stretch overflow-hidden rounded-xl border text-left`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col justify-center p-6`,children:[(0,Q.jsx)(`span`,{className:`eyebrow text-violet`,children:`New`}),(0,Q.jsx)(`span`,{className:`mt-1 text-2xl font-light tracking-tight text-foreground`,children:a.title}),(0,Q.jsx)(`p`,{className:`mt-2 max-w-sm text-ui text-muted-foreground`,children:a.description}),(0,Q.jsxs)(J,{size:`sm`,className:`mt-5 self-start font-normal`,onClick:()=>{o(),r(db({ref:a.hero.task}))},children:[a.hero.action,(0,Q.jsx)(_a,{"aria-hidden":`true`})]})]}),(0,Q.jsx)(Kb,{}),(0,Q.jsx)(`button`,{type:`button`,onClick:o,"aria-label":`Close ${a.title} announcement`,className:`absolute top-3 right-3 grid size-7 place-items-center rounded-full text-soft-foreground hover:text-foreground`,children:(0,Q.jsx)(ns,{className:`size-3.5`,"aria-hidden":`true`})})]})}function Kb(){return(0,Q.jsx)(`div`,{className:`onboarding-picture hidden w-64 shrink-0 items-end justify-center pt-6 pr-6 sm:flex`,"aria-hidden":`true`,children:(0,Q.jsxs)(`div`,{className:`w-full rounded-t-lg border border-b-0 border-border bg-background p-3 shadow-[0_-12px_40px_-20px_var(--violet)]`,children:[(0,Q.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,Q.jsx)(`span`,{className:`size-1.5 rounded-full bg-muted-foreground/40`}),(0,Q.jsx)(`span`,{className:`size-1.5 rounded-full bg-muted-foreground/40`}),(0,Q.jsx)(`span`,{className:`size-1.5 rounded-full bg-muted-foreground/40`})]}),(0,Q.jsx)(`div`,{className:`mt-3 h-2 w-2/3 rounded bg-muted`}),(0,Q.jsx)(`div`,{className:`mt-2 h-2 w-1/2 rounded bg-muted`}),(0,Q.jsxs)(`div`,{className:`relative mt-4 flex items-center gap-2`,children:[(0,Q.jsxs)(`span`,{className:`relative h-6 w-16 rounded-md border border-violet bg-violet/15 outline-2 outline-offset-2 outline-violet/40`,children:[(0,Q.jsx)(`span`,{className:`absolute -top-1 -left-1 size-1.5 rounded-[2px] bg-violet`}),(0,Q.jsx)(`span`,{className:`absolute -top-1 -right-1 size-1.5 rounded-[2px] bg-violet`}),(0,Q.jsx)(`span`,{className:`absolute -bottom-1 -left-1 size-1.5 rounded-[2px] bg-violet`}),(0,Q.jsx)(`span`,{className:`absolute -right-1 -bottom-1 size-1.5 rounded-[2px] bg-violet`})]}),(0,Q.jsx)(`span`,{className:`h-6 w-10 rounded-md bg-muted`}),(0,Q.jsx)(`span`,{className:`absolute top-7 left-6 rounded-md rounded-tl-sm border border-border bg-card px-2 py-1 text-micro whitespace-nowrap text-foreground shadow-md`,children:`Make this button larger`})]}),(0,Q.jsx)(`div`,{className:`mt-9 h-2 w-3/4 rounded bg-muted`})]})})}function qb(){let e=jn(),t=T(),n=mn(),r=bt(),i=Zy(),a=e.data?.worktreeLifecycle,o=Cm({worktreeSetupConfigured:e.data?(a?.afterCreate.length??0)>0:void 0,forge:t.data?.forge}),s=n.data?.info,c=s!=null&&!s.remote&&t.data?.capabilities.singleProject!==!0,l=r.data?.onboarding?.setupDismissed===!0,u=Z.useCallback(()=>i({setupDismissed:!0}),[i]);return{steps:o,unpublished:c,folder:s?mx(s.root):``,dismissed:l||!r.data,dismiss:u}}var Jb={worktrees:fu,github:Hf},Yb=30,Xb=6;function Zb(){let e=ne(),t=Z.useMemo(()=>{let t=new Date;t.setHours(0,0,0,0);let n=Array.from({length:Yb},(e,n)=>{let r=new Date(t);return r.setDate(t.getDate()-(Yb-1-n)),{date:r,count:0}}),r=n[0]?.date.getTime()??0;for(let t of e.data??[]){let e=new Date(t.createdAt);e.setHours(0,0,0,0);let i=n[Math.round((e.getTime()-r)/864e5)];i&&(i.count+=1)}return n},[e.data]),n=t.reduce((e,t)=>e+t.count,0);if(n===0)return null;let r=Math.max(1,...t.map(e=>e.count)),i=e=>e===0?0:Math.max(1,Math.round(e/r*Math.min(r,Xb))),a=e=>e.toLocaleDateString(void 0,{month:`short`,day:`numeric`});return(0,Q.jsxs)(`div`,{"data-slot":`activity-strip`,className:`mt-12 w-full`,children:[(0,Q.jsxs)(`div`,{className:`mb-3 flex items-baseline justify-between text-ui`,children:[(0,Q.jsx)(`span`,{className:`text-soft-foreground`,children:`Activity`}),(0,Q.jsxs)(`span`,{className:`text-soft-foreground`,children:[n,` `,n===1?`task`:`tasks`,` in the last `,Yb,` days`]})]}),(0,Q.jsx)(os,{delayDuration:100,children:(0,Q.jsx)(`div`,{className:`flex items-end justify-between`,role:`img`,"aria-label":`${n} tasks in the last ${Yb} days`,children:t.map(e=>(0,Q.jsxs)(ss,{children:[(0,Q.jsx)(is,{asChild:!0,children:(0,Q.jsx)(`span`,{className:`flex flex-col-reverse gap-1 py-1`,children:Array.from({length:Math.max(1,i(e.count))},(t,n)=>(0,Q.jsx)(`span`,{className:G(`size-2.5 rounded-[3px]`,e.count>0?`bg-violet`:`bg-muted`)},n))})}),(0,Q.jsx)(as,{children:`${a(e.date)}: ${e.count} ${e.count===1?`task`:`tasks`}`})]},e.date.toISOString()))})}),(0,Q.jsx)(`div`,{className:`mt-2 flex justify-between font-mono text-micro text-soft-foreground`,children:t.filter((e,t)=>t%7==1||t===Yb-1).map(e=>(0,Q.jsx)(`span`,{children:a(e.date)},e.date.toISOString()))})]})}function Qb({fresh:e,issues:t,colors:n}){let r=mn(),i=r.data?.info&&!e?r.data.log.slice(0,3):[],a=ex(oe(t.length===0&&i.length===0).data??[]);return t.length>0?(0,Q.jsx)($b,{label:`Or pick up an issue`,slot:`issues`,children:(0,Q.jsx)(`ul`,{className:`w-full divide-y divide-border rounded-xl border border-border bg-card p-1.5 text-left`,children:t.map(e=>(0,Q.jsx)(`li`,{className:`first:[&>a]:rounded-t-lg last:[&>a]:rounded-b-lg`,children:(0,Q.jsxs)(X,{to:db({ref:fb(e)}),className:`group flex flex-col gap-1.5 px-3 py-2.5 transition-colors hover:bg-muted`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-body text-foreground`,children:e.title}),(0,Q.jsx)(_a,{className:`ml-auto size-3.5 shrink-0 text-soft-foreground opacity-0 transition-opacity group-hover:opacity-100`,"aria-hidden":`true`})]}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-meta text-soft-foreground`,children:[(0,Q.jsxs)(`span`,{className:`font-mono`,children:[`#`,e.number]}),(0,Q.jsx)(`span`,{children:e.author}),(0,Q.jsxs)(`span`,{children:[Zc(e.createdAt),` ago`]}),e.comments>0?(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Q.jsx)(Do,{className:`size-3`,"aria-hidden":`true`}),e.comments]}):null,e.labels.map(e=>(0,Q.jsx)(`span`,{style:wb(n[e]),className:`rounded-full border px-1.5 py-px text-micro`,children:e},e))]})]})},e.number))})}):i.length>0?(0,Q.jsx)($b,{label:`Or continue recent work`,slot:`commits`,children:(0,Q.jsx)(`ul`,{className:`w-full divide-y divide-border rounded-xl border border-border bg-card p-1.5 text-left`,children:i.map(e=>(0,Q.jsx)(`li`,{className:`first:[&>a]:rounded-t-lg last:[&>a]:rounded-b-lg`,children:(0,Q.jsxs)(X,{to:db({ref:`Continue the work from commit ${e.hash} (${e.subject}).`}),className:`group flex flex-col gap-1 px-3 py-2.5 transition-colors hover:bg-muted`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-body text-foreground`,children:e.subject}),(0,Q.jsx)(_a,{className:`ml-auto size-3.5 shrink-0 text-soft-foreground opacity-0 transition-opacity group-hover:opacity-100`,"aria-hidden":`true`})]}),(0,Q.jsxs)(`span`,{className:`flex items-center gap-2 text-meta text-soft-foreground`,children:[(0,Q.jsx)(`span`,{className:`font-mono`,children:e.hash}),(0,Q.jsx)(`span`,{children:e.author}),(0,Q.jsx)(`span`,{children:e.when})]})]})},e.hash))})}):a.length>0?(0,Q.jsx)($b,{label:`Or start with a skill`,slot:`skills`,children:(0,Q.jsx)(`div`,{className:`flex flex-wrap justify-center gap-2`,children:a.map(e=>(0,Q.jsx)(X,{to:db({skill:e.name}),className:Ab,title:e.description,children:e.name},e.name))})}):null}function $b({label:e,slot:t,children:n}){return(0,Q.jsxs)(`div`,{"data-slot":`start-from`,"data-start-from":t,className:`mt-14 flex w-full flex-col items-center gap-3`,children:[(0,Q.jsx)(`div`,{className:`text-ui text-soft-foreground`,children:e}),n]})}function ex(e){let t=e.filter(e=>e.source!==`global`&&e.source!==`builtin`),n=e.filter(e=>e.source===`global`);return[...t,...n].slice(0,4)}function tx({folder:e,onOpenChange:t}){let{projectId:n}=ut(),r=Ut(),i=Dn(),a=r.data?.available===!0?r.data.owners:null,[o,s]=Z.useState(null),[c,l]=Z.useState(()=>hx(e)),u=o??a?.[0]?.login??``,d=()=>{i.isPending||!u||!c.trim()||i.mutate({projectId:n??`default`,owner:u,name:c.trim()},{onSuccess:({slug:e})=>{t(!1),Y(`Published to ${e}`)}})},f=a!==null,p=Nb(!r.isPending&&!f,()=>void r.refetch()),m=p.state?.status===`done`&&!r.isFetching&&r.data?.available===!1?r.data.reason:null;return(0,Q.jsxs)(rb,{title:`Publish to GitHub`,description:f?`A new private repository. You can make it public on GitHub later.`:m?`Signed in, but GitHub listed no accounts.`:Pb(p),onOpenChange:t,onSubmit:f?d:void 0,footer:m?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(J,{variant:`outline`,className:`font-normal`,onClick:()=>t(!1),children:`Close`}),(0,Q.jsx)(J,{className:`font-normal`,onClick:()=>void r.refetch(),children:`Check again`})]}):f?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(J,{variant:`outline`,className:`font-normal`,onClick:()=>t(!1),children:`Cancel`}),(0,Q.jsx)(J,{className:`font-normal`,onClick:d,disabled:i.isPending||!u||!c.trim(),children:i.isPending?`Publishing…`:`Publish`})]}):(0,Q.jsx)(zb,{signIn:p,onClose:()=>t(!1)}),children:[r.isPending?(0,Q.jsx)(`p`,{className:`text-ui text-soft-foreground`,children:`Checking GitHub…`}):m?(0,Q.jsx)(`p`,{role:`alert`,className:`text-ui text-danger`,children:m}):f?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,role:`radiogroup`,"aria-label":`Owner`,children:a.map(e=>(0,Q.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":e.login===u,onClick:()=>s(e.login),className:G(`inline-flex h-8 items-center gap-2 rounded-full border px-3 text-ui transition-colors`,e.login===u?`border-primary text-foreground`:`border-border text-muted-foreground hover:text-foreground`),children:e.login},e.login))}),(0,Q.jsxs)(`label`,{className:`flex items-center gap-1 rounded-lg border border-input bg-background px-3 font-mono text-ui focus-within:border-ring`,children:[(0,Q.jsxs)(`span`,{className:`text-soft-foreground`,children:[u,`/`]}),(0,Q.jsx)(`input`,{value:c,onChange:e=>l(e.target.value),"aria-label":`Repository name`,className:`h-9 min-w-0 flex-1 bg-transparent text-foreground outline-none`})]})]}):(0,Q.jsx)(Rb,{signIn:p}),i.error?(0,Q.jsx)(`p`,{role:`alert`,className:`mt-3 text-xs whitespace-pre-line text-danger`,children:i.error.message}):null]})}function nx(){let{steps:e,unpublished:t,folder:n,dismissed:r,dismiss:i}=qb(),[a,o]=Z.useState(!1),s=e[0];if(r||s===void 0&&!t)return null;let c=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(s?Jb[s.id]:Hf,{className:`size-3.5 text-muted-foreground`,"aria-hidden":!0}),s?s.label:`Publish to GitHub`,(0,Q.jsx)(_a,{className:`size-3.5 text-muted-foreground`,"aria-hidden":`true`})]}),l=`inline-flex h-7 items-center gap-1.5 rounded-full bg-muted px-3 text-foreground`;return(0,Q.jsxs)(`div`,{"data-onboarding":``,"data-slot":`setup-pill`,className:`mb-3 inline-flex items-center gap-2 self-start rounded-full border border-border bg-card py-1 pr-1 pl-3 text-ui`,children:[(0,Q.jsx)(`span`,{className:`text-soft-foreground`,children:`Setup`}),s?(0,Q.jsx)(X,{to:s.to,className:l,children:c}):(0,Q.jsx)(`button`,{type:`button`,className:l,onClick:()=>o(!0),"data-setup-step":`publish`,children:c}),(0,Q.jsx)(`button`,{type:`button`,onClick:i,"aria-label":`Hide setup`,className:`grid size-7 place-items-center rounded-full text-soft-foreground hover:text-foreground`,children:(0,Q.jsx)(ns,{className:`size-3.5`,"aria-hidden":`true`})}),a?(0,Q.jsx)(tx,{folder:n,onOpenChange:o}):null]})}function rx(){let e=Ot();return e.isPending?null:e.data?.available?(0,Q.jsx)(ix,{setup:e.data}):(0,Q.jsx)(ax,{})}function ix({setup:e}){let t=Dt(),n=ln(),r=Zy(),i=Iy(e,t.data).length===0;return(0,Q.jsxs)(Eb,{title:Ky(e,t.data),slot:`sign-in`,step:`agent`,why:`cezar installs the coding agent and signs you in, right here. No API key needed.`,children:[i?(0,Q.jsxs)(`div`,{"data-slot":`agents-off`,className:`mt-7 flex w-full flex-col gap-3 rounded-xl border border-border bg-card p-4 text-left sm:flex-row sm:items-center sm:justify-between`,children:[(0,Q.jsx)(`span`,{className:`text-body text-foreground`,children:`All agents are turned off.`}),(0,Q.jsx)(J,{asChild:!0,size:`sm`,className:`font-normal`,children:(0,Q.jsx)(X,{to:`/settings/agents#providers`,children:`Turn one on`})})]}):(0,Q.jsx)(qy,{setup:e,status:t.data}),(0,Q.jsxs)(`div`,{className:`mt-7 flex flex-wrap justify-center gap-5`,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:()=>n.mutate(),disabled:n.isPending,className:kb,children:n.isPending?`Checking…`:`Check again`}),(0,Q.jsx)(X,{to:`/settings/agents`,className:kb,children:`Other agents`}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>r({agentCheckSkipped:!0}),className:kb,children:`Continue anyway`})]})]})}function ax(){let e=Dt(),t=ln(),n=Wn(),r=Zy(),i=Tm(e.data),[a,o]=Z.useState(null),[s,c]=Z.useState(null),l=t.mutate;Z.useEffect(()=>{let e=window.setInterval(()=>l(),sx);return()=>window.clearInterval(e)},[l]),Z.useEffect(()=>{if(!a)return;let e=0,t=window.setInterval(()=>{if(e+=1,e>cx){window.clearInterval(t),o(null);return}l()},ox);return()=>window.clearInterval(t)},[a,l]);let u=e=>{c(null),n.mutate({provider:e},{onSuccess:t=>{t.opened?o(e):l()},onError:t=>c({provider:e,message:t.message})})};return(0,Q.jsxs)(Eb,{title:`Sign in to an agent`,slot:`sign-in`,step:`agent`,why:`cezar runs the coding agent you already use. No API key needed.`,children:[(0,Q.jsxs)(`div`,{className:`mt-7 flex w-full flex-col gap-3 text-left`,children:[i.length===0?(0,Q.jsxs)(`div`,{"data-slot":`agents-off`,className:`flex flex-col gap-3 rounded-xl border border-border bg-card p-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,Q.jsx)(`span`,{className:`text-body text-foreground`,children:`All agents are turned off.`}),(0,Q.jsx)(J,{asChild:!0,size:`sm`,className:`font-normal`,children:(0,Q.jsx)(X,{to:`/settings/agents#providers`,children:`Turn one on`})})]}):null,i.map(e=>{let t=a===e.provider,r=s?.provider===e.provider?s.message:null;return(0,Q.jsxs)(`div`,{"data-slot":`agent-row`,"data-state":e.state,className:`rounded-xl border border-border bg-card p-4`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`div`,{className:`text-lead text-foreground`,children:e.label}),(0,Q.jsx)(`div`,{className:`text-ui text-muted-foreground`,children:t?`Finish in Terminal`:e.state===`missing`?`Not installed`:`Installed, not signed in`})]}),e.state===`signed-out`?t?(0,Q.jsx)(Eo,{className:`size-4 shrink-0 text-violet motion-safe:animate-spin`,"aria-label":`Waiting for sign-in`}):(0,Q.jsx)(J,{className:`font-normal`,onClick:()=>u(e.provider),disabled:n.isPending,children:`Sign in`}):null]}),e.state===`signed-out`&&!t&&!r?(0,Q.jsx)(`p`,{className:`mt-3 text-ui text-soft-foreground`,children:`Opens the login in Terminal.`}):null,t?(0,Q.jsx)(`p`,{className:`mt-3 text-ui text-soft-foreground`,children:`This page continues by itself.`}):null,r?(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-col gap-3`,children:[(0,Q.jsx)(`p`,{className:`text-ui text-muted-foreground`,children:r}),(0,Q.jsxs)(jb,{children:[(0,Q.jsxs)(`li`,{children:[(0,Q.jsx)(`span`,{className:`text-foreground`,children:`Open Terminal and paste:`}),(0,Q.jsx)(`div`,{className:`mt-2`,children:(0,Q.jsx)(Bb,{command:e.command})})]}),(0,Q.jsx)(`li`,{children:`Come back. cezar checks by itself.`})]})]}):null,e.state===`missing`?(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-col gap-3`,children:[(0,Q.jsxs)(jb,{children:[(0,Q.jsxs)(`li`,{children:[(0,Q.jsx)(`span`,{className:`text-foreground`,children:`Open Terminal and paste:`}),(0,Q.jsx)(`div`,{className:`mt-2`,children:(0,Q.jsx)(Bb,{command:e.command})})]}),(0,Q.jsxs)(`li`,{children:[(0,Q.jsx)(`span`,{className:`text-foreground`,children:`Then sign in:`}),(0,Q.jsx)(`div`,{className:`mt-2`,children:(0,Q.jsx)(Bb,{command:e.login})})]}),(0,Q.jsx)(`li`,{children:`Come back. cezar checks by itself.`})]}),(0,Q.jsxs)(`p`,{className:`text-label text-soft-foreground`,children:[`Needs Node.js.`,` `,(0,Q.jsx)(`a`,{href:`https://nodejs.org`,target:`_blank`,rel:`noopener noreferrer`,className:`text-violet hover:underline`,children:`Get it`})]})]}):null]},e.provider)})]}),(0,Q.jsxs)(`div`,{className:`mt-7 flex flex-wrap justify-center gap-5`,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:()=>l(),disabled:t.isPending,className:kb,children:t.isPending?`Checking…`:`Check again`}),(0,Q.jsx)(X,{to:`/settings/agents`,className:kb,children:`Other agents`}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>r({agentCheckSkipped:!0}),className:kb,children:`Continue anyway`})]})]})}var ox=3e3,sx=1e4,cx=60;function lx(){let{projectId:e}=ut(),t=a(),n=T(),r=e??t.data?.bootProject,i=t.data?.projects.find(e=>e.id===r);return i?i.root:e===null||e===n.data?.bootProject?n.data?.repoRoot:void 0}function ux(){let e=T().data?.capabilities.singleProject===!0,t=lx(),n=t?mx(t):`This folder`,[r,i]=Z.useState(!1);return(0,Q.jsxs)(Eb,{title:`Pick a project`,slot:`pick-project`,step:`project`,why:`Tasks run inside a git repository, each in its own worktree.`,subtitle:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`font-mono`,children:n}),` isn’t a git repository.`,e?null:(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(`button`,{type:`button`,onClick:()=>i(!0),className:`text-violet hover:underline`,children:`Initialize git here`})]})]}),children:[e?null:(0,Q.jsx)(dx,{}),r?(0,Q.jsx)(px,{folder:n,onOpenChange:i}):null]})}function dx(){let e=st(),t=Ut(),n=Yt(),r=Nr(),[i,a]=Z.useState(``),[o,s]=Z.useState(0),[c,l]=Z.useState(null),u=(e.data?.repos??[]).filter(e=>e.name.toLowerCase().includes(i.trim().toLowerCase())).slice(0,6),d=t.data!==void 0&&!t.data.available,f=!e.isPending&&(e.data?.repos.length??0)===0,p=e=>{if(e.projectId){r(`/p/${encodeURIComponent(e.projectId)}/`);return}n.mutate(e.path,{onSuccess:({project:e})=>r(`/p/${encodeURIComponent(e.id)}/`),onError:e=>Y(e.message,{tone:`danger`})})},m=e=>{l(e),ac(e)};return(0,Q.jsxs)(Q.Fragment,{children:[f?(0,Q.jsxs)(`div`,{"data-slot":`no-repos`,className:`mt-8 grid w-full gap-3 sm:grid-cols-3`,children:[(0,Q.jsx)(ab,{title:`New project`,description:`An empty repository here, or a new private one on GitHub.`,recommended:d,onClick:()=>m(`new`),picture:(0,Q.jsx)(`span`,{className:`grid size-12 place-items-center rounded-lg border border-dashed border-muted-foreground/60`,children:(0,Q.jsxs)(`span`,{className:`relative size-4`,children:[(0,Q.jsx)(`span`,{className:`absolute top-1/2 left-0 h-0.5 w-full -translate-y-1/2 rounded bg-muted-foreground`}),(0,Q.jsx)(`span`,{className:`absolute top-0 left-1/2 h-full w-0.5 -translate-x-1/2 rounded bg-muted-foreground`})]})})}),d?(0,Q.jsx)(ab,{title:`Connect GitHub`,description:`Sign in to the GitHub CLI to clone and publish.`,onClick:()=>l(`connect`),picture:(0,Q.jsx)(Hf,{className:`size-9 text-muted-foreground`,"aria-hidden":!0})}):(0,Q.jsx)(ab,{title:`Clone from GitHub`,description:`Any repository you can read, by URL or owner/name.`,recommended:!0,onClick:()=>m(`clone`),picture:(0,Q.jsxs)(`span`,{className:`flex w-16 flex-col gap-1.5`,children:[(0,Q.jsxs)(`span`,{className:`flex items-center gap-1.5 rounded-md border border-violet bg-violet/15 px-1.5 py-1`,children:[(0,Q.jsx)(`span`,{className:`size-1.5 rounded-full bg-violet`}),(0,Q.jsx)(`span`,{className:`h-1 flex-1 rounded bg-violet/60`})]}),(0,Q.jsxs)(`span`,{className:`flex items-center gap-1.5 rounded-md border border-border px-1.5 py-1`,children:[(0,Q.jsx)(`span`,{className:`size-1.5 rounded-full bg-muted-foreground/50`}),(0,Q.jsx)(`span`,{className:`h-1 w-3/4 rounded bg-muted`})]}),(0,Q.jsxs)(`span`,{className:`flex items-center gap-1.5 rounded-md border border-border px-1.5 py-1`,children:[(0,Q.jsx)(`span`,{className:`size-1.5 rounded-full bg-muted-foreground/50`}),(0,Q.jsx)(`span`,{className:`h-1 w-1/2 rounded bg-muted`})]})]})}),(0,Q.jsx)(ab,{title:`Open a folder`,description:`A repository that already lives on this disk.`,onClick:()=>m(`folder`),picture:(0,Q.jsxs)(`span`,{className:`flex w-16 flex-col gap-1.5`,children:[(0,Q.jsx)(`span`,{className:`h-2 w-10 rounded-sm bg-muted-foreground/70`}),(0,Q.jsx)(`span`,{className:`ml-3 h-1.5 w-9 rounded bg-muted`}),(0,Q.jsx)(`span`,{className:`ml-3 h-1.5 w-7 rounded bg-muted`}),(0,Q.jsx)(`span`,{className:`ml-3 h-1.5 w-8 rounded bg-muted`})]})})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`mt-7 w-full rounded-xl border border-border bg-card p-1.5 text-left`,children:[(0,Q.jsxs)(`label`,{className:`flex h-11 items-center gap-2 rounded-lg border border-input bg-background px-3 focus-within:border-ring`,children:[(0,Q.jsx)(Xo,{className:`size-4 text-soft-foreground`,"aria-hidden":`true`}),(0,Q.jsx)(`input`,{value:i,onChange:e=>{a(e.target.value),s(0)},onKeyDown:e=>{if(e.key===`ArrowDown`)e.preventDefault(),s(e=>Math.min(e+1,u.length-1));else if(e.key===`ArrowUp`)e.preventDefault(),s(e=>Math.max(e-1,0));else if(e.key===`Enter`){let e=u[o];e&&p(e)}},placeholder:`Search repositories`,"aria-label":`Search repositories`,className:`min-w-0 flex-1 bg-transparent text-lead text-foreground outline-none placeholder:text-soft-foreground`})]}),(0,Q.jsx)(`ul`,{role:`listbox`,"aria-label":`Repositories`,className:`mt-1`,children:e.isPending?(0,Q.jsx)(`li`,{className:`px-3 py-2.5 text-ui text-soft-foreground`,children:`Looking for repositories…`}):u.length===0?(0,Q.jsx)(`li`,{className:`px-3 py-2.5 text-ui text-soft-foreground`,children:`No repositories found`}):u.map((e,t)=>(0,Q.jsx)(`li`,{role:`option`,"aria-selected":t===o,children:(0,Q.jsxs)(`button`,{type:`button`,onMouseEnter:()=>s(t),onClick:()=>p(e),disabled:n.isPending,className:G(`flex w-full items-center gap-3 rounded-lg px-3 py-2.5 text-left`,t===o&&`bg-muted`),children:[(0,Q.jsx)(`span`,{className:`truncate text-lead text-foreground`,children:e.name}),(0,Q.jsx)(`span`,{className:`ml-auto truncate font-mono text-meta text-soft-foreground`,children:gx(e.path)})]})},e.path))})]}),(0,Q.jsxs)(`div`,{className:`mt-5 flex flex-wrap justify-center gap-6`,children:[(0,Q.jsxs)(`button`,{type:`button`,className:kb,onClick:()=>m(`new`),children:[(0,Q.jsx)(Jo,{className:`size-3.5`,"aria-hidden":`true`}),`New project`]}),d?(0,Q.jsxs)(`button`,{type:`button`,className:kb,onClick:()=>l(`connect`),"data-slot":`connect-github`,children:[(0,Q.jsx)(Hf,{className:`size-3.5`,"aria-hidden":!0}),`Connect GitHub`]}):(0,Q.jsxs)(`button`,{type:`button`,className:kb,onClick:()=>m(`clone`),children:[(0,Q.jsx)(Hf,{className:`size-3.5`,"aria-hidden":!0}),`Clone from GitHub`]}),(0,Q.jsxs)(`button`,{type:`button`,className:kb,onClick:()=>m(`folder`),children:[(0,Q.jsx)(bo,{className:`size-3.5`,"aria-hidden":`true`}),`Browse…`]})]})]}),c===`new`?(0,Q.jsx)(Vf,{label:`New project`,onError:()=>l(null),children:(0,Q.jsx)(If,{open:!0,onOpenChange:e=>!e&&l(null)})}):null,c===`clone`?(0,Q.jsx)(Vf,{label:`Clone from GitHub`,onError:()=>l(null),children:(0,Q.jsx)(Af,{open:!0,onOpenChange:e=>!e&&l(null)})}):null,c===`folder`?(0,Q.jsx)(Vf,{label:`Open local folder`,onError:()=>l(null),children:(0,Q.jsx)(Df,{open:!0,onOpenChange:e=>!e&&l(null)})}):null,c===`connect`?(0,Q.jsx)(fx,{onOpenChange:e=>!e&&l(null)}):null]})}function fx({onOpenChange:e}){let t=Z.useCallback(()=>e(!1),[e]),n=Nb(!0,e=>{Y(e?`GitHub connected as ${e}`:`GitHub connected`),t()});return(0,Q.jsx)(rb,{title:`Connect GitHub`,description:Pb(n),onOpenChange:e,footer:(0,Q.jsx)(zb,{signIn:n,onClose:t}),children:(0,Q.jsx)(Rb,{signIn:n})})}function px({folder:e,onOpenChange:t}){let{projectId:n}=ut(),r=Jn(),i=()=>{r.isPending||r.mutate(n??`default`,{onSuccess:()=>{t(!1),Y(`Initialized git in ${e}`)}})};return(0,Q.jsxs)(rb,{title:`Initialize git in ${e}`,description:`Git keeps a history of your files. cezar runs this for you and uploads nothing. node_modules and .env files stay out.`,onOpenChange:t,onSubmit:i,footer:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(J,{variant:`outline`,onClick:()=>t(!1),className:`font-normal`,children:`Cancel`}),(0,Q.jsx)(J,{onClick:i,disabled:r.isPending,className:`font-normal`,children:r.isPending?`Initializing…`:`Initialize`})]}),children:[(0,Q.jsx)(`pre`,{className:`rounded-lg border border-border bg-background px-3 py-2.5 font-mono text-xs leading-relaxed text-foreground`,children:`$ git init -b main
|
|
5
|
+
$ git add -A
|
|
6
|
+
$ git commit -m "Initial commit"`}),r.error?(0,Q.jsx)(`p`,{role:`alert`,className:`mt-3 text-xs whitespace-pre-line text-danger`,children:r.error.message}):null]})}function mx(e){return e.split(/[\\/]/).filter(Boolean).pop()??e}function hx(e){return e.trim().replace(/\s+/g,`-`).replace(/[^A-Za-z0-9._-]/g,``).slice(0,100)||`project`}function gx(e){let t=e.split(`/`);return t.pop(),t.join(`/`).replace(/^\/Users\/[^/]+|^\/home\/[^/]+/,`~`)}function _x(e){let t=bt(),n=T(),r=Zy(),i=t.data?.onboarding,a=t.data!==void 0,o=Z.useRef(!1);Z.useEffect(()=>{if(!a||o.current)return;o.current=!0;let e=Pm(i,Date.now());e&&r(e)},[a,i,r]);let s=n.data?.capabilities.designMode,c=n.data?.capabilities.automations,l=Z.useMemo(()=>a?Lm(i,{designMode:s,automations:c},Date.now()):new Map,[a,i,s,c]);return Z.useEffect(()=>{let t=[...l].filter(([t])=>e===t||e.startsWith(`${t}/`)).map(([,e])=>e);t.length>0&&r({dismissedAnnouncements:[...i?.dismissedAnnouncements??[],...t].slice(-50)})},[e,l,i,r]),Z.useMemo(()=>new Set(Uf.filter(e=>[...l.keys()].some(t=>Rm(e.to,t))).map(e=>e.to)),[l])}function vx({runs:e}){let t=bt(),n=T(),r=Zy(),[i]=Z.useState(()=>Date.now()),[a,o]=Z.useState(!1),s=Fm(t.data?.onboarding,i);if(!s)return null;let c=zm(e),l=Im(s,{designMode:n.data?.capabilities.designMode,automations:n.data?.capabilities.automations}),u=new Date(s).toLocaleString(`en`,{month:`long`}),d=c[0],f=Bm(c,l.length);return f?(0,Q.jsxs)(`section`,{"data-onboarding":``,"data-slot":`welcome-back`,"aria-label":`Welcome back`,className:`onboarding-announcement relative mb-4 flex flex-col gap-4 rounded-xl border py-5 pr-14 pl-6 sm:flex-row sm:items-center sm:gap-8 sm:pr-20`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 sm:flex-1`,children:[(0,Q.jsx)(`h2`,{className:`text-xl font-light tracking-tight text-foreground`,children:`Welcome back`}),(0,Q.jsx)(`p`,{className:`mt-1 text-body text-muted-foreground`,children:f})]}),(0,Q.jsxs)(`div`,{className:`grid shrink-0 auto-cols-fr grid-flow-col gap-2`,children:[d?(0,Q.jsx)(J,{asChild:!0,size:`sm`,className:`w-full font-normal`,children:(0,Q.jsx)(X,{to:`/tasks/${d.id}`,"data-slot":`welcome-back-waiting`,children:c.length>1?`Open tasks`:d.status===`review`?`Review task`:`Open task`})}):null,l.length>0?(0,Q.jsx)(J,{variant:`outline`,size:`sm`,className:`w-full font-normal`,"data-slot":`welcome-back-news`,onClick:()=>{o(!0),r({whatsNewSeenAt:new Date().toISOString()})},children:`See what’s new`}):null]}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>r({welcomeBackClosedAt:new Date().toISOString()}),"aria-label":`Close welcome back`,className:`absolute top-3 right-3 grid size-8 place-items-center rounded-full text-soft-foreground transition-colors hover:bg-muted hover:text-foreground`,children:(0,Q.jsx)(ns,{className:`size-4`,"aria-hidden":`true`})}),a?(0,Q.jsx)(bx,{items:l,description:`${l.length} ${l.length===1?`change`:`changes`} since ${u}.`,onOpenChange:o}):null]}):null}function yx(){let e=bt(),t=T(),n=Zy(),[r,i]=Z.useState(!1),[a]=Z.useState(()=>Date.now()),o={designMode:t.data?.capabilities.designMode,automations:t.data?.capabilities.automations},s=Hm(o,a);if(!e.data||s.length===0)return null;let c=Um(e.data.onboarding,o,a);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`whats-new`,onClick:()=>{i(!0),n({whatsNewSeenAt:new Date().toISOString()})},className:`flex h-8 w-full items-center gap-2.5 rounded-md px-2.5 text-ui text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:[(0,Q.jsx)(Zl,{className:`size-4 shrink-0`,"aria-hidden":`true`}),`What’s new`,c?(0,Q.jsxs)(`span`,{className:`ml-auto flex items-center`,children:[(0,Q.jsx)(`span`,{className:`size-1.5 rounded-full bg-violet`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Unread`})]}):null]}),r?(0,Q.jsx)(bx,{items:s,description:`Recent changes in cezar.`,onOpenChange:i}):null]})}function bx({items:e,description:t,onOpenChange:n}){let r=Fc(),[i,a]=Z.useState(0),o=e[Math.min(i,e.length-1)];if(!o)return null;let s=i>=e.length-1,c=()=>s?n(!1):a(i+1),l=o.to?o.action:o.hero?.action;return(0,Q.jsx)(rb,{wide:!0,title:`What’s new`,description:t,onOpenChange:n,onSubmit:c,footer:(0,Q.jsxs)(`div`,{className:`flex w-full items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`mr-auto flex items-center gap-1.5`,"aria-label":`${i+1} of ${e.length}`,children:e.map((e,t)=>(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:G(`h-1.5 rounded-full transition-all`,t===i?`w-4 bg-violet`:`w-1.5 bg-border`)},e.id))}),i>0?(0,Q.jsx)(J,{variant:`outline`,className:`font-normal`,onClick:()=>a(i-1),children:`Back`}):null,(0,Q.jsx)(J,{className:`font-normal`,onClick:c,children:s?`Done`:`Next`})]}),children:(0,Q.jsxs)(`div`,{"data-slot":`whats-new-item`,"data-feature":o.preview,onKeyDown:e=>{e.key===`ArrowRight`&&!s&&a(i+1),e.key===`ArrowLeft`&&i>0&&a(i-1)},children:[(0,Q.jsx)(xx,{id:o.preview}),(0,Q.jsxs)(`div`,{className:`mt-5 flex min-h-32 flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-label`,children:[(0,Q.jsx)(`span`,{className:`rounded-full bg-violet/15 px-2 py-0.5 text-violet`,children:`New`}),(0,Q.jsx)(`span`,{className:`text-soft-foreground`,children:new Date(o.releasedAt).toLocaleDateString(`en`,{month:`short`,day:`numeric`})})]}),(0,Q.jsx)(`h3`,{className:`mt-2 text-lg font-light tracking-tight text-foreground`,children:o.title}),(0,Q.jsx)(`p`,{className:`mt-1 text-ui text-muted-foreground`,children:o.description}),l?(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>{n(!1),o.to?r(o.to):o.hero&&r(db({ref:o.hero.task}))},className:`mt-3 inline-flex items-center gap-1 text-ui text-violet hover:underline`,children:[l,(0,Q.jsx)(_a,{className:`size-3.5`,"aria-hidden":`true`})]}):null]})]})})}function xx({id:e}){return(0,Q.jsxs)(`div`,{"aria-hidden":`true`,className:`onboarding-preview flex h-44 items-end justify-center overflow-hidden rounded-lg border border-border px-8 pt-6`,children:[e===`tabs`?(0,Q.jsx)(Sx,{}):null,e===`palette`?(0,Q.jsx)(Cx,{}):null,e===`design`?(0,Q.jsx)(wx,{}):null,e===`scripts`?(0,Q.jsx)(Tx,{}):null,e===`workflow`?(0,Q.jsx)(Ex,{}):null,e===`automations`?(0,Q.jsx)(Dx,{}):null]})}function Sx(){return(0,Q.jsxs)(cb,{bar:(0,Q.jsx)(`span`,{className:`ml-3 flex gap-3 text-micro`,children:[`Chat`,`Changes`,`Preview`,`Terminal`].map(e=>(0,Q.jsx)(`span`,{className:e===`Preview`?`text-foreground underline decoration-violet decoration-2 underline-offset-[9px]`:`text-soft-foreground`,children:e},e))}),children:[(0,Q.jsx)(`div`,{className:G(lb,`w-3/4`)}),(0,Q.jsx)(`div`,{className:G(lb,`mt-2 w-1/2`)}),(0,Q.jsx)(`div`,{className:`mt-3 h-12 rounded-md border border-border bg-card`})]})}function Cx(){return(0,Q.jsxs)(`div`,{className:`w-full max-w-xs self-center rounded-lg border border-border bg-background p-2 shadow-[0_18px_40px_-20px_var(--violet)]`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border px-1 pb-2 text-meta text-soft-foreground`,children:[(0,Q.jsx)(`span`,{className:`rounded border border-border px-1 font-mono text-micro text-muted-foreground`,children:`⌘P`}),`Jump to a task or run an action`]}),[`Fix the login redirect`,`Open Changes`,`Terminal in a column`].map((e,t)=>(0,Q.jsx)(`div`,{className:G(`mt-1 rounded px-2 py-1.5 text-meta`,t===0?`bg-violet/15 text-foreground`:`text-muted-foreground`),children:e},e))]})}function wx(){return(0,Q.jsxs)(cb,{children:[(0,Q.jsx)(`div`,{className:G(lb,`w-2/3`)}),(0,Q.jsxs)(`div`,{className:`relative mt-4 flex items-center gap-2`,children:[(0,Q.jsxs)(`span`,{className:`relative h-6 w-16 rounded-md border border-violet bg-violet/15`,children:[(0,Q.jsx)(`span`,{className:`absolute -top-1 -left-1 size-1.5 rounded-[2px] bg-violet`}),(0,Q.jsx)(`span`,{className:`absolute -top-1 -right-1 size-1.5 rounded-[2px] bg-violet`}),(0,Q.jsx)(`span`,{className:`absolute -bottom-1 -left-1 size-1.5 rounded-[2px] bg-violet`}),(0,Q.jsx)(`span`,{className:`absolute -right-1 -bottom-1 size-1.5 rounded-[2px] bg-violet`})]}),(0,Q.jsx)(`span`,{className:`h-6 w-10 rounded-md bg-muted`}),(0,Q.jsx)(`span`,{className:`absolute top-7 left-6 rounded-md rounded-tl-sm border border-border bg-card px-2 py-1 text-micro whitespace-nowrap text-foreground shadow-md`,children:`Make this button larger`})]}),(0,Q.jsx)(`div`,{className:G(lb,`mt-10 w-3/4`)})]})}function Tx(){return(0,Q.jsxs)(cb,{bar:(0,Q.jsx)(`span`,{className:`ml-3 text-micro text-soft-foreground`,children:`After worktree creation`}),children:[[`npm install`,`cp .env.example .env`].map(e=>(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 py-1 font-mono text-meta`,children:[(0,Q.jsx)(`span`,{className:`text-soft-foreground`,children:`$`}),(0,Q.jsx)(`span`,{className:`flex-1 text-foreground`,children:e}),(0,Q.jsx)(`span`,{className:`text-success`,children:`done`})]},e)),(0,Q.jsxs)(`div`,{className:`mt-2 flex items-center gap-2 font-mono text-meta text-soft-foreground`,children:[(0,Q.jsx)(`span`,{children:`$`}),(0,Q.jsx)(`span`,{className:`h-3 w-1.5 bg-violet`})]})]})}function Ex(){return(0,Q.jsx)(`div`,{className:`flex w-full max-w-64 items-center self-center`,children:[`Plan`,`Build`,`Review`].map((e,t)=>(0,Q.jsxs)(Z.Fragment,{children:[t>0?(0,Q.jsx)(`span`,{className:`h-px flex-1 bg-muted-foreground/40`}):null,(0,Q.jsx)(`span`,{className:G(`rounded-md border bg-background px-3 py-2 text-meta`,t===1?`border-violet text-foreground shadow-[0_10px_30px_-14px_var(--violet)]`:`border-border text-muted-foreground`),children:e})]},e))})}function Dx(){return(0,Q.jsx)(cb,{children:[`Every weekday at 9:00`,`When a pull request is merged`].map(e=>(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 py-1.5 text-meta text-foreground`,children:[(0,Q.jsx)(`span`,{className:`flex-1`,children:e}),(0,Q.jsx)(`span`,{className:`flex h-3.5 w-6 items-center justify-end rounded-full bg-violet px-0.5`,children:(0,Q.jsx)(`span`,{className:`size-2.5 rounded-full bg-violet-foreground`})})]},e))})}function Ox(e,t){return A(e,`active`).filter(e=>!t||nn(e)).map(e=>e.id)}function kx(e,t,n){if(e.length===0)return null;let r=t===void 0?-1:e.indexOf(t);return r===-1?n===`next`?e[0]:e[e.length-1]:e.length===1?null:e[(r+(n===`next`?1:-1)+e.length)%e.length]}function Ax(e){return!e.altKey||e.metaKey||e.ctrlKey||e.repeat||e.key!==`ArrowUp`&&e.key!==`ArrowDown`?null:{direction:e.key===`ArrowUp`?`previous`:`next`,needsYouOnly:e.shiftKey}}var jx=`cezar:switch-task`;function Mx(){let{pathname:e}=Dr(),t=Fc(),n=Vc(),r=a(),i=T(),o=R(n,r.data?.bootProject??i.data?.bootProject??null),s=Z.useRef({pathname:e,runs:o.data,navigate:t});s.current={pathname:e,runs:o.data,navigate:t},Z.useEffect(()=>{let e=(e,t)=>{let n=s.current,r=kx(Ox(n.runs??[],t),e_(n.pathname),e);return r===null?!1:(tc(`arrow`),n.navigate(`/tasks/${r}`),!0)},t=t=>{let n=Ax(t);!n||t.defaultPrevented||t.target instanceof HTMLElement&&t.target.closest(`.xterm`)||bs()||(t.preventDefault(),e(n.direction,n.needsYouOnly))},n=t=>{let n=t.detail;n!==`previous`&&n!==`next`||bs()||e(n,!0)};return window.addEventListener(`keydown`,t),window.addEventListener(jx,n),()=>{window.removeEventListener(`keydown`,t),window.removeEventListener(jx,n)}},[])}function Nx(){return Mx(),null}var Px=e=>[e,`webhooks`];function Fx(e,t){return gt({queryKey:Px(e),queryFn:({signal:t})=>Fe.list(e,t),enabled:t,retry:!1})}function Ix(e,t){let n=W();(0,Z.useEffect)(()=>{if(!t||!globalThis.EventSource)return;let r=!1,i,a=`${hr()}${ur}/p/${encodeURIComponent(e)}/webhooks/events`,o=t=>{r||_r(t.type,t.data)&&n.invalidateQueries({queryKey:Px(e)})},s=()=>{r||i||(i=new EventSource(a,{withCredentials:!0}),i.addEventListener(`change`,o),i.addEventListener(`resync`,o))},c=()=>{i?.removeEventListener(`change`,o),i?.removeEventListener(`resync`,o),i?.close(),i=void 0},l=t=>{!t.persisted||r||i||(n.invalidateQueries({queryKey:Px(e)}),s())};return window.addEventListener(`pagehide`,c),window.addEventListener(`pageshow`,l),s(),()=>{r=!0,window.removeEventListener(`pagehide`,c),window.removeEventListener(`pageshow`,l),c()}},[n,e,t])}function Lx({projectId:e}){let t=T(),n=!t.isError&&t.data?.capabilities?.webhooks===!0,r=Fx(e,n);return Ix(e,n),Rx(e,n?r.data:void 0),null}function Rx(e,t){let n=(0,Z.useRef)(void 0);(0,Z.useEffect)(()=>{if(!t){n.current=void 0;return}let r=n.current;if(n.current={projectId:e,data:t},!r||r.projectId!==e)return;let i=new Map(r.data.receivers.map(e=>[e.id,e.state]));for(let e of t.receivers)!i.has(e.id)||i.get(e.id)===e.state||(e.state===`active`||e.state===`disabled`)&&(e.state===`active`?Y(`${e.name} is now active`):Y(`${e.name} was disabled — open it to repair and test`,{tone:`danger`}));let a=t.webhookHealth.saturation?.dropped??0,o=r.data.webhookHealth.saturation?.dropped??0;a>o&&Y(`${a-o===1?`1 webhook delivery was`:`${a-o} webhook deliveries were`} dropped — webhook storage capacity was exceeded`,{tone:`danger`})},[e,t])}function zx(){return(0,Q.jsxs)(`div`,{"data-route":`automations`,className:`flex min-h-full flex-col`,children:[(0,Q.jsxs)(`header`,{className:`sticky top-0 z-10 hidden h-14 shrink-0 items-center gap-3 border-b border-border bg-background px-5 md:flex`,children:[(0,Q.jsx)(`h1`,{className:`text-base font-semibold`,children:`Automations`}),(0,Q.jsx)(`p`,{className:`text-ui text-muted-foreground`,children:`Scheduled and GitHub-triggered runs.`})]}),(0,Q.jsx)(`p`,{"data-slot":`automations-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading automations…`})]})}function Bx(){return(0,Q.jsx)(`div`,{"data-route":`compare`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(gl,{icon:(0,Q.jsx)(Eo,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading variants…`,subtitle:`Fetching every variant's status, spend and diff summary.`})})}function Vx(){return(0,Q.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(gl,{icon:(0,Q.jsx)(Eo,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading GitHub…`,subtitle:`Fetching open issues and pull requests.`})})}var Hx=[{id:`all`,label:`All`},{id:`impact`,label:`Impact`},{id:`html`,label:`HTML`},{id:`markdown`,label:`Markdown`},{id:`image`,label:`Images`}];function Ux(e,t){return t===`all`?[...e]:t===`impact`?e.filter(e=>e.subject!==void 0):e.filter(e=>e.kind===t)}function Wx(e,t){return t===`running`||t===`queued`?`running`:e.stale===!0?`stale`:e.stale===!1?`current`:`none`}function Gx(e){return`/tasks/${encodeURIComponent(e.runId)}/assets/${encodeURIComponent(e.name)}`}function Kx(e){return e.kind===`pr`?{to:`/github/prs/${e.number}`,label:`PR #${e.number}`,title:`Pull request #${e.number}`}:{to:`/git/files/${e.path.split(`/`).map(encodeURIComponent).join(`/`)}`,label:`spec ${e.path.split(`/`).pop()??e.path}`,title:e.path}}function qx(){let e=P(),t=ne(),[n,r]=(0,Z.useState)(`all`),i=(0,Z.useMemo)(()=>new Map((t.data??[]).map(e=>[e.id,e.status])),[t.data]),a=(0,Z.useMemo)(()=>Ux(e.data?.assets??[],n),[e.data,n]),o=e=>i.get(e.runId)??e.runStatus,s=e.data?.assets.length??0;return(0,Q.jsxs)(`div`,{"data-route":`assets`,className:`flex min-h-full flex-col`,children:[(0,Q.jsxs)(`header`,{className:`sticky top-0 z-10 hidden h-14 shrink-0 items-center gap-3 border-b border-border bg-background px-5 md:flex`,children:[(0,Q.jsx)(`h1`,{className:`text-base font-semibold`,children:`Assets`}),(0,Q.jsx)(`p`,{className:`text-ui text-soft-foreground`,children:`Every page and report your agents wrote, newest first.`})]}),(0,Q.jsx)(`div`,{className:`flex flex-1 flex-col gap-3 p-3 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-5 md:pb-5`,children:e.isPending?(0,Q.jsx)(`p`,{"data-slot":`assets-loading`,className:`py-6 text-center text-xs text-soft-foreground`,children:`Loading assets…`}):e.isError?(0,Q.jsxs)(`p`,{role:`alert`,className:`py-6 text-center text-xs text-destructive`,children:[`Could not load assets: `,e.error instanceof Error?e.error.message:String(e.error)]}):s===0?(0,Q.jsx)(gl,{icon:(0,Q.jsx)(To,{}),title:`No assets yet`,subtitle:`When an agent writes a page or report into its artifacts folder, it shows up here and in its task's Assets tab.`}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{role:`group`,"aria-label":`Filter assets`,className:`flex w-fit max-w-full flex-wrap gap-0.5 rounded-lg bg-muted p-0.5`,children:Hx.map(({id:e,label:t})=>(0,Q.jsx)(`button`,{type:`button`,"data-slot":`assets-filter`,"aria-pressed":n===e,onClick:()=>r(e),className:G(`h-7 rounded-[7px] px-3 text-label font-medium text-muted-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,n===e&&`bg-card font-semibold text-foreground shadow-xs`),children:t},e))}),a.length===0?(0,Q.jsxs)(`p`,{"data-slot":`assets-filter-empty`,className:`py-6 text-center text-xs text-soft-foreground`,children:[`No `,Hx.find(e=>e.id===n)?.label.toLowerCase(),` assets.`]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`hidden overflow-x-auto rounded-lg border border-border md:block`,children:(0,Q.jsxs)(`table`,{"data-slot":`assets-table`,className:`w-full border-collapse text-ui`,children:[(0,Q.jsx)(`thead`,{children:(0,Q.jsxs)(`tr`,{className:`border-b border-border text-left text-meta font-medium text-muted-foreground`,children:[(0,Q.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Asset`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Subject`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`State`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Version`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Updated`})]})}),(0,Q.jsx)(`tbody`,{children:a.map(e=>(0,Q.jsxs)(`tr`,{"data-slot":`asset-row`,className:`border-b border-border last:border-b-0 hover:bg-muted/50`,children:[(0,Q.jsx)(`td`,{className:`max-w-0 px-3 py-2`,children:(0,Q.jsx)(Jx,{row:e})}),(0,Q.jsx)(`td`,{className:`px-3 py-2`,children:(0,Q.jsx)(Yx,{row:e})}),(0,Q.jsx)(`td`,{className:`px-3 py-2`,children:(0,Q.jsx)(Zx,{state:Wx(e,o(e))})}),(0,Q.jsxs)(`td`,{className:`px-3 py-2 font-mono text-xs tabular-nums`,children:[`v`,e.versionCount]}),(0,Q.jsx)(`td`,{className:`px-3 py-2 whitespace-nowrap text-muted-foreground`,children:(0,Q.jsx)(Qx,{iso:e.updatedAt})})]},`${e.runId}/${e.name}`))})]})}),(0,Q.jsx)(`ul`,{"data-slot":`assets-cards`,className:`flex flex-col gap-2 md:hidden`,children:a.map(e=>(0,Q.jsxs)(`li`,{"data-slot":`asset-card`,className:`flex flex-col gap-1.5 rounded-lg border border-border bg-card p-3 text-ui`,children:[(0,Q.jsx)(Jx,{row:e}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground`,children:[(0,Q.jsx)(Yx,{row:e}),(0,Q.jsx)(Zx,{state:Wx(e,o(e))}),(0,Q.jsxs)(`span`,{className:`font-mono tabular-nums`,children:[`v`,e.versionCount]}),(0,Q.jsx)(Qx,{iso:e.updatedAt})]})]},`${e.runId}/${e.name}`))})]}),e.data?.truncated?(0,Q.jsxs)(`p`,{"data-slot":`assets-truncated`,className:`text-xs text-soft-foreground`,children:[`Showing the newest `,s,` assets.`]}):null]})})]})}function Jx({row:e}){let t=Gx(e);return(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,Q.jsx)(X,{"data-slot":`asset-link`,to:t,className:`truncate font-semibold text-foreground hover:underline focus-visible:underline focus-visible:outline-none`,children:e.title??e.name}),(0,Q.jsxs)(`span`,{className:`truncate text-xs text-muted-foreground`,children:[(0,Q.jsx)(`span`,{className:`font-mono`,children:e.name}),` · `,(0,Q.jsx)(X,{"data-slot":`asset-task-link`,to:t,className:`hover:text-foreground hover:underline`,children:e.runTitle})]})]})}function Yx({row:e}){if(!e.subject)return(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});let t=Kx(e.subject);return(0,Q.jsx)(X,{"data-slot":`asset-subject`,to:t.to,title:t.title,className:`whitespace-nowrap text-foreground hover:underline`,children:t.label})}var Xx={running:{label:`running`,dot:`bg-pending animate-pulse`,className:`text-foreground`},stale:{label:`stale`,dot:`bg-pending`,className:`border-pending/50 text-pending-strong`},current:{label:`current`,dot:`bg-success`,className:`text-foreground`},none:{label:`—`,dot:null,className:`text-muted-foreground`}};function Zx({state:e}){let{label:t,dot:n,className:r}=Xx[e];return(0,Q.jsxs)(`span`,{"data-slot":`asset-state`,"data-state":e,title:e===`none`?`No subject, or its state cannot be told`:void 0,className:G(`inline-flex items-center gap-1.5 rounded-full border border-border px-2 py-0.5 text-meta font-medium whitespace-nowrap`,r),children:[n?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:G(`size-1.5 rounded-full`,n)}):null,t]})}function Qx({iso:e}){let t=Zc(e);return(0,Q.jsx)(`time`,{dateTime:e,title:new Date(e).toLocaleString(),children:t?`${t} ago`:``})}var $x={workflow:null,skills:[],runner:null,model:null},eS=`cez-followup-selection`,tS=Dc.map(e=>e.id);function nS(e){let t=e&&typeof e==`object`?e:{};return{workflow:typeof t.workflow==`string`?t.workflow:null,skills:Array.isArray(t.skills)?t.skills.filter(e=>typeof e==`string`):[],runner:tS.includes(t.runner)?t.runner:null,model:typeof t.model==`string`?t.model:null}}function rS(){try{let e=localStorage.getItem(eS);return e?nS(JSON.parse(e)):{...$x}}catch{return{...$x}}}function iS(e){try{localStorage.setItem(eS,JSON.stringify({...rS(),...e}))}catch{}}var aS=`cez-followup-prompt:`;function oS(e){try{return localStorage.getItem(aS+e)??``}catch{return``}}function sS(e,t){try{t===``?localStorage.removeItem(aS+e):localStorage.setItem(aS+e,t)}catch{}}function cS(e){let t=Dt(),n=jn(),r=bn(t.data),i=n.data?.defaultRunner,a=bc(e.runner,r,i??r[0]??`claude`),o=O(a),s=n.data?.modelsLocked===!0,c=hc(s?null:e.model,a,n.data?.defaultModels,o.data),l=mc(a,c,o.data),{accounts:u,repoAccount:d}=fc(),f=u.some(t=>t.provider===a&&t.id===e.account)?e.account:null;return{runner:a,runnerExplicit:e.runner!==null,model:c,reasoningEffort:Cc(e.reasoningEffort??null,a,c,o.data),reasoningEfforts:l,runners:r,defaultRunner:i,canRun:t.isSuccess&&r.length>0,modelsLocked:s,providerPending:t.isPending,providerError:t.isError,accounts:u,account:f,repoAccount:d}}function lS(e){let[t,n]=(0,Z.useState)(uS);return(0,Z.useEffect)(()=>{e&&iS({runner:t.runner,model:t.model})},[e,t.runner,t.model]),pS(t,n),[t,n]}function uS(){let e=rS();return{runner:e.runner,model:e.model,account:null}}function dS(){return lS(!0)}function fS(){return lS(!1)}function pS(e,t){let n=Dt(),r=jn(),i=bn(n.data),a=bc(e.runner,i,r.data?.defaultRunner??i[0]??`claude`),o=n.isSuccess&&i.length>0,s=o&&e.runner!==null&&!i.includes(e.runner),c=o&&e.model!==null&&Ec(e.model,a);(0,Z.useEffect)(()=>{!s&&!c||t({...e,runner:s?null:e.runner,model:c?null:e.model})},[s,c,e,t])}function mS(e){return{runner:gc(e.runner,e.defaultRunner,e.runnerExplicit),model:e.modelsLocked?void 0:e.model||void 0,reasoningEffort:e.modelsLocked?void 0:e.reasoningEffort||void 0}}function hS(e){return{...mS(e),...e.account?{agentProfile:e.account}:{}}}function gS({pick:e,onChange:t,disabled:n=!1,accounts:r=!1}){let i=cS(e),{runner:a,model:o,reasoningEffort:s,reasoningEfforts:c,runners:l,canRun:u,modelsLocked:d}=i,f=jn(),p=O(a),m=pc(a,p.data,[e.model,f.data?.defaultModels?.[a]]),h=n||!u,g=r?i.accounts:[];return(0,Q.jsxs)(Q.Fragment,{children:[l.length>1||l.some(e=>jc(g,e))?(0,Q.jsx)(fl,{runners:l,value:a,accounts:g,account:r?i.account:null,repoAccount:r?i.repoAccount:void 0,disabled:h,onPick:(n,i)=>t(r?{runner:n,account:i,model:n===a?e.model:null,reasoningEffort:n===a?e.reasoningEffort??null:null}:{runner:n,account:null,model:null,reasoningEffort:null})}):null,(0,Q.jsx)(pl,{slot:`model-pill`,ariaLabel:`Model`,label:m.find(e=>e.id===o).label,value:o,disabled:h,readOnly:d===!0,disabledHint:d?`Model selection is locked to native coding-agent settings.`:void 0,onPick:n=>t({...e,model:n,reasoningEffort:null}),options:m.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:Sc(a,p.data,p.isError)}),(0,Q.jsx)(_l,{runner:a,model:o,value:s,options:c,disabled:h,modelsLocked:d,onPick:n=>t({...e,reasoningEffort:n||null})})]})}function _S({templates:e,onInsert:t,triggerClassName:n,disabled:r,iconOnly:i=!1}){let[a,o]=(0,Z.useState)(!1),s=(0,Z.useRef)(null),c=Fc();return e.length===0?null:(0,Q.jsxs)(Is,{open:a,onOpenChange:o,children:[(0,Q.jsx)(Es,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`prompt-template-trigger`,"aria-label":`Insert a prompt template`,title:`Insert a prompt template`,disabled:r,className:G(`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`:`px-2.5`,n),children:[(0,Q.jsx)(uu,{"aria-hidden":`true`,className:`size-3 shrink-0 text-violet`}),i?null:(0,Q.jsxs)(Q.Fragment,{children:[`templates`,(0,Q.jsx)(Xa,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})]})}),(0,Q.jsx)(Ms,{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,Q.jsxs)(Xc,{filter:Io,children:[(0,Q.jsx)(Hc,{placeholder:`search templates…`,onInput:()=>s.current?.scrollTo(0,0)}),(0,Q.jsxs)(Yc,{ref:s,"data-slot":`prompt-template-list-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,Q.jsx)(Jc,{children:`Nothing matches.`}),(0,Q.jsx)(Wc,{heading:`Insert a template`,children:e.map(e=>(0,Q.jsxs)(qc,{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),o(!1)},children:[(0,Q.jsxs)(`span`,{className:`flex w-full items-center gap-1.5`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-label font-medium text-foreground`,children:e.label}),e.skills&&e.skills.length>0?(0,Q.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-micro font-medium text-violet`,children:[(0,Q.jsx)(Ba,{"aria-hidden":`true`,className:`size-2.5`}),e.skills.length]}):null]}),(0,Q.jsx)(`span`,{className:`line-clamp-1 text-meta text-soft-foreground`,children:e.text})]},e.id))}),(0,Q.jsx)(Uc,{}),(0,Q.jsx)(Wc,{children:(0,Q.jsx)(qc,{value:`edit prompt templates settings`,"data-slot":`prompt-template-settings`,className:`text-label text-muted-foreground`,onSelect:()=>{o(!1),c(`/settings/instructions#prompt-templates`)},children:`Edit templates…`})})]})]})})]})}var vS=o({status:`waiting`});function yS(e){return e.filter(e=>!e.startedTaskId)}function bS(e){return e.runnable??!!(e.suggestedSkill||e.suggestedPrompt)}function xS(){let e=T(),t=e.data?.capabilities.followups===!0,n=e.data!==void 0&&!t,r=Ce(!n),i=ne(),a=r.data===void 0?void 0:yS(r.data);return(0,Q.jsxs)(`div`,{"data-route":`inbox`,className:`flex min-h-full flex-col`,children:[(0,Q.jsxs)(`header`,{className:`sticky top-0 z-10 hidden h-14 shrink-0 items-center gap-3 border-b border-border bg-background px-5 md:flex`,children:[(0,Q.jsx)(`h1`,{className:`text-base font-semibold`,children:`Inbox`}),(0,Q.jsx)(`p`,{className:`text-ui text-soft-foreground`,children:n?`Disabled for this server; per-task Notes still run.`:`Follow-ups agents suggested when they finished a task.`})]}),(0,Q.jsx)(`div`,{className:`flex flex-1 flex-col p-3 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-5 md:pb-5`,children:n?(0,Q.jsx)(gl,{icon:(0,Q.jsx)($l,{}),tone:`neutral`,title:`The follow-up inbox is off`,subtitle:`Agents are not asked to leave follow-ups. Set CEZ_FOLLOWUPS=1 and restart the service to turn the inbox on.`,heading:`h2`}):a===void 0?r.isError?(0,Q.jsx)(gl,{icon:(0,Q.jsx)(es,{}),tone:`danger`,title:`Could not load the inbox`,subtitle:r.error.message,heading:`h2`}):null:a.length===0?e.isPending?null:(0,Q.jsx)(gl,{icon:(0,Q.jsx)($l,{}),tone:`neutral`,title:`Inbox empty`,subtitle:`Agents drop follow-up suggestions here when they finish a task.`,heading:`h2`}):(0,Q.jsx)(`ul`,{"data-slot":`todo-list`,className:`mx-auto flex w-full max-w-3xl flex-col gap-2.5`,children:a.map(e=>(0,Q.jsx)(SS,{todo:e,sourceTaskExists:e.taskId===void 0?null:i.data?.some(t=>t.id===e.taskId)??!1},e.id))})})]})}function SS({todo:e,sourceTaskExists:t}){let n=Fc(),r=W(),i=Bt(),[a,o]=fS(),s=cS(a),[c,l]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(``),f=(0,Z.useRef)(null),p=T(),m=ko(jo(i.data?.promptTemplates),p.data?.capabilities),h=e=>{let t=f.current?.selectionStart??u.length,n=Ro(u,t,e);d(n.text),requestAnimationFrame(()=>{f.current?.focus(),f.current?.setSelectionRange(n.caret,n.caret)})},g=U({mutationFn:async()=>s.canRun?N(e.id,{...mS(s),prompt:u.trim()||void 0}):null,onSuccess:e=>{if(e===null)return;Mc(`inbox`);let{run:t}=e;r.invalidateQueries({queryKey:H.todos}),r.invalidateQueries({queryKey:H.runs.all}),n(`/tasks/${t.id}`)},onError:e=>Y(e.message,{tone:`danger`})}),_=U({mutationFn:()=>dn(e.id),onSuccess:()=>{r.setQueryData(H.todos,t=>t?.filter(t=>t.id!==e.id)),r.invalidateQueries({queryKey:H.todos})},onError:e=>Y(e.message,{tone:`danger`})}),v=g.isPending||_.isPending,y=bS(e);return(0,Q.jsxs)(`li`,{"data-slot":`todo-card`,"data-id":e.id,className:`flex flex-col gap-2.5 rounded-lg border border-border bg-card p-4 shadow-xs`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Q.jsx)(Nc,{tone:vS.tone,pulse:vS.pulse,title:vS.label,className:`mt-[5px]`}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`p`,{"data-slot":`todo-summary`,className:`text-sm leading-snug font-medium text-foreground`,children:e.summary}),(0,Q.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:[e.ts?(0,Q.jsxs)(`span`,{children:[Zc(e.ts),` ago`]}):null,e.action?(0,Q.jsx)(`span`,{children:e.action}):null,e.taskId===void 0?null:t?(0,Q.jsx)(X,{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,Q.jsx)(`span`,{"data-slot":`todo-source-gone`,children:`source task deleted`}),mr(e.prUrl)?(0,Q.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,Q.jsxs)(`span`,{"data-slot":`todo-skill`,className:`font-mono`,children:[`skill: `,e.suggestedSkill]}):null]})]}),(0,Q.jsx)(`div`,{className:`flex shrink-0 items-center gap-1.5 self-center`,children:y?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(J,{type:`button`,variant:`contrast`,size:`sm`,"data-action":`todo-run`,title:`Start a task from this follow-up`,disabled:v||!s.canRun,onClick:()=>g.mutate(),children:[(0,Q.jsx)(qo,{"aria-hidden":`true`,className:`size-3`}),`Run`]}),(0,Q.jsx)(J,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`todo-dismiss`,title:`Check off (remove)`,disabled:v,onClick:()=>_.mutate(),children:`Dismiss`})]}):(0,Q.jsxs)(J,{type:`button`,variant:`contrast`,size:`sm`,"data-action":`todo-acknowledge`,title:`Acknowledge and remove this note`,disabled:v,onClick:()=>_.mutate(),children:[(0,Q.jsx)(Wa,{"aria-hidden":`true`,className:`size-3`}),`Acknowledge`]})})]}),y?(0,Q.jsxs)(`div`,{"data-slot":`todo-engine`,className:`flex flex-wrap items-center gap-2 pl-5`,children:[(0,Q.jsx)(gS,{pick:a,onChange:o,disabled:v||!s.canRun}),!s.providerPending&&!s.canRun?(0,Q.jsxs)(`span`,{"data-slot":`todo-provider-gate`,className:`inline-flex flex-wrap items-center gap-1 text-xs text-muted-foreground`,children:[s.providerError?`Provider authentication could not be verified.`:`Connect an agent provider to run this follow-up.`,(0,Q.jsx)(X,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null]}):null,y?c?(0,Q.jsxs)(`div`,{"data-slot":`todo-instructions`,className:`flex flex-col gap-2 pl-5`,children:[(0,Q.jsx)($o,{ref:f,"data-slot":`todo-instructions-input`,"aria-label":`Extra instructions for this follow-up`,value:u,onChange:e=>d(e.target.value),placeholder:`Add instructions for the agent… (appended to the suggestion above)`,maxLength:2e4,className:`min-h-16 text-ui`}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(_S,{templates:m,onInsert:h}),(0,Q.jsx)(`button`,{type:`button`,"data-slot":`todo-instructions-hide`,onClick:()=>l(!1),className:`text-xs font-medium text-muted-foreground underline decoration-border underline-offset-2 hover:text-foreground`,children:`Hide`})]})]}):(0,Q.jsx)(`button`,{type:`button`,"data-slot":`todo-instructions-toggle`,onClick:()=>l(!0),className:`self-start pl-5 text-xs font-medium text-muted-foreground underline decoration-border underline-offset-2 hover:text-foreground`,children:u.trim()?`Edit instructions (added)`:`+ Add instructions`}):null]})}var CS=e=>String(e).padStart(2,`0`);function wS(e){return JSON.stringify({...e,task:``})}function TS(e,t){let n=t=>new Intl.DateTimeFormat(`en-CA`,{timeZone:t,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`}).formatToParts(e),r;try{r=n(t)}catch{r=n()}let i=e=>r.find(t=>t.type===e)?.value??``;return{date:`${i(`year`)}-${i(`month`)}-${i(`day`)}`,hour:Number(i(`hour`)),minute:Number(i(`minute`))}}function ES(e,t,n,r){let i=Math.round((Date.parse(`${e}T00:00:00Z`)-Date.parse(`${r}T00:00:00Z`))/864e5),a=`${CS(t)}:${CS(n)}`;return i===0?`Today, ${a}`:i===1?`Tomorrow, ${a}`:`${new Date(`${e}T00:00:00Z`).toLocaleDateString(`en-GB`,{weekday:`short`,day:`numeric`,month:`short`,...e.slice(0,4)===r.slice(0,4)?{}:{year:`numeric`},timeZone:`UTC`}).replace(`,`,``)}, ${a}`}function DS(e,t,n,r=Date.now()){if(!e)return`Now`;let i=TS(r,t?.timeZone??n).date,a=t&&TS(Date.parse(t.notBefore),t.timeZone),o=a&&ES(a.date,a.hour,a.minute,i);return e.start.kind===`usage-reset`?o?`After reset · ${o}`:`After reset`:o||(AS(e.start.date)?jS(e.start)?ES(e.start.date,e.start.hour,e.start.minute,i):`Pick a time`:`Pick a date`)}function OS(e,t,n){if(!e)return`Schedule start`;if(!t)return DS(e,t,n);let r=new Date(t.notBefore).toLocaleString(`en-GB`,{dateStyle:`full`,timeStyle:`short`,timeZone:t.timeZone});return`${e.start.kind===`usage-reset`?`After the usage limit resets: `:`Starts `}${r} (${t.timeZone})`}function kS(e,t=Date.now()){let{date:n,hour:r}=TS(t+2*36e5,e);return{kind:`at`,date:n,hour:r,minute:0}}function AS(e){if(!/^\d{4}-\d{2}-\d{2}$/.test(e))return!1;let t=new Date(`${e}T00:00:00Z`);return Number.isFinite(t.getTime())&&t.toISOString().slice(0,10)===e}function jS(e){return Number.isInteger(e.hour)&&e.hour>=0&&e.hour<24&&Number.isInteger(e.minute)&&e.minute>=0&&e.minute<60}function MS(e){return AS(e.date)?jS(e)?Date.parse(`${e.date}T${CS(e.hour)}:${CS(e.minute)}:00Z`)+12*36e5<=Date.now()?{date:`Choose a future date and time.`}:{}:{time:`Enter a complete time.`}:{date:e.date?`Enter a complete, valid date.`:`Pick a date to schedule this task.`}}function NS({task:e,value:t,onChange:n,disabledReason:r,onBlockedChange:i,onLabelChange:a,open:o,onOpenChange:s}){let[c,l]=(0,Z.useState)(!1),u=o??c,d=e=>{l(e),s?.(e)},f=(0,Z.useRef)(u);(0,Z.useEffect)(()=>{u&&!f.current&&cc(),f.current=u},[u]);let p=(e,t)=>{nc(e),n(t)},[m,h]=(0,Z.useState)(!1),[g,_]=(0,Z.useState)(``),[v,y]=(0,Z.useState)(!1),[b,x]=(0,Z.useState)(!1),[S,C]=(0,Z.useState)(),[w,T]=(0,Z.useState)(``),[E,D]=(0,Z.useState)(0),[O,k]=(0,Z.useState)(!1),A=t?.start.kind===`at`?MS(t.start):{},j=A.date??A.time,ee=(0,Z.useRef)(0),M=(0,Z.useRef)(void 0),N=(0,Z.useRef)(null);t?.start.kind===`at`&&(N.current=t.start);let te=(0,Z.useId)(),ne=(0,Z.useId)(),P=(0,Z.useId)(),F=wS(e),I=!!e.task.trim(),ie=JSON.stringify({...e,task:`Check scheduling options`}),L=S?.key===ie?S.data:void 0,ae=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{let e=L?.timeZone;if(!e||t?.start.kind!==`at`||!ae.current)return;let r=JSON.stringify(t.start)===JSON.stringify(ae.current),i=kS(e);ae.current=null,r&&JSON.stringify(i)!==JSON.stringify(t.start)&&n({start:i})},[L?.timeZone,t?.start.kind]);let oe=r??(w||(L?L.usageReset.available?void 0:L.usageReset.message:`Checking scheduling options…`)),se=t?.start.kind===`usage-reset`;(0,Z.useEffect)(()=>{if(!u&&!se)return;let e=!1;return T(``),Ct({task:JSON.parse(ie)}).then(t=>{e||C({key:ie,data:t})}).catch(()=>{e||T(`Could not load scheduling options. Try again.`)}),()=>{e=!0}},[u,ie,E,se]);let ce=JSON.stringify(t?.start);(0,Z.useLayoutEffect)(()=>(ee.current++,h(!1),_(t?.invalidated??``),y(!!t?.invalidated),k(!1),t?.preview&&(t.settingsKey!==F||r)&&n({start:t.start}),()=>{ee.current++}),[F,ce,r,t?.invalidated]),(0,Z.useLayoutEffect)(()=>{t?.start.kind!==`usage-reset`||!oe||(ee.current++,h(!1),t.preview&&n({start:t.start}))},[oe,t?.start.kind]);let R=async()=>{if(clearTimeout(M.current),!t||r||t.start.kind===`usage-reset`&&oe||j||!e.task.trim())return;let i=++ee.current;n({start:t.start,invalidated:t.invalidated}),h(!0),_(``),y(!1),k(!1);try{let r=await re({task:e,start:t.start});if(i!==ee.current)return;r.available?n({start:t.start,preview:r,settingsKey:F}):(_(r.message),k(r.reason===`window-over`),y(r.reason===`account-unverifiable`))}catch(e){i===ee.current&&(_(t.start.kind===`at`?`Could not check the start time. Try again.`:e instanceof Error?e.message:String(e)),y(!0))}finally{i===ee.current&&h(!1)}};(0,Z.useEffect)(()=>{if(!(!t||r||!e.task.trim()||j)&&!(t.start.kind===`usage-reset`&&oe)&&!(t.preview&&t.settingsKey===F))return M.current=setTimeout(()=>void R(),600),()=>clearTimeout(M.current)},[F,I,ce,r,t?.start.kind===`usage-reset`&&oe]),(0,Z.useEffect)(()=>{if(!t?.preview)return;let e,r=()=>{let i=Date.parse(t.preview.notBefore)-Date.now();i>0?e=setTimeout(r,Math.min(i,2147483647)):n({start:t.start,invalidated:`The previewed start time has passed. Check the start time again.`})};return r(),()=>clearTimeout(e)},[t?.preview]);let z=!(t?.start.kind===`usage-reset`&&oe)&&!m&&!j&&!r&&t?.settingsKey===F&&t.preview&&Date.parse(t.preview.notBefore)>Date.now()?t.preview:void 0,le=!t||z?void 0:r??(t.start.kind===`usage-reset`&&oe?oe:m?`Checking the start time…`:g||j||(e.task.trim()?t.start.kind===`at`?`Checking the start time…`:`Finding when your usage limit resets…`:`Describe the task to schedule it.`));(0,Z.useEffect)(()=>{i?.(le)},[le]);let ue=b?j:void 0,de=g||j?ne:void 0,fe=DS(t,z,L?.timeZone),B=OS(t,z,L?.timeZone);return(0,Z.useEffect)(()=>{a?.(t?{text:fe,title:B}:void 0)},[t?`${fe}\n${B}`:void 0]),(0,Q.jsxs)(Is,{open:u,onOpenChange:d,children:[(0,Q.jsx)(Es,{asChild:!0,children:(0,Q.jsx)(J,{type:`button`,size:`icon-sm`,"data-slot":`start-time-trigger`,className:`h-8 w-7 rounded-l-none border-l border-primary-foreground/25`,"aria-label":`Choose task start time`,title:B,children:(0,Q.jsx)(Xa,{"aria-hidden":`true`,className:G(`size-4 transition-transform`,u&&`rotate-180`)})})}),(0,Q.jsxs)(Ms,{align:`end`,className:`w-80 max-w-[calc(100vw-2rem)] max-h-(--radix-popover-content-available-height) overflow-y-auto overscroll-contain space-y-3`,children:[(0,Q.jsxs)(`fieldset`,{className:`space-y-3`,children:[(0,Q.jsx)(`legend`,{className:`font-medium`,children:`Start task`}),(0,Q.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`input`,{type:`radio`,name:te,"aria-describedby":de,checked:!t,onChange:()=>p(`now`,null)}),`Now`]}),(0,Q.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`input`,{type:`radio`,name:te,"aria-describedby":de,disabled:!!r,checked:t?.start.kind===`at`,onChange:()=>{let e=N.current??kS(L?.timeZone);ae.current=!N.current&&!L?e:null,p(`at`,{start:e})}}),`Pick date & time`]}),(0,Q.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`input`,{type:`radio`,name:te,"aria-describedby":oe?P:de,disabled:!!oe,checked:t?.start.kind===`usage-reset`,onChange:()=>p(`usage_reset`,{start:{kind:`usage-reset`}})}),`After usage limit resets`]})]}),oe&&!r&&(0,Q.jsx)(`p`,{id:P,className:`text-sm text-muted-foreground`,children:oe}),w&&(0,Q.jsx)(J,{type:`button`,variant:`outline`,onClick:()=>D(e=>e+1),children:`Retry options`}),r&&(0,Q.jsx)(`p`,{id:P,role:`status`,className:`text-sm text-muted-foreground`,children:r}),t?.start.kind===`at`&&(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:L?`Server time zone: ${L.timeZone}`:`Loading server time zone…`}),(0,Q.jsxs)(`label`,{className:`block text-sm`,children:[`Date`,(0,Q.jsx)(qs,{"aria-describedby":de,onBlur:()=>x(!0),"aria-invalid":b&&A.date||O?!0:void 0,type:`date`,max:`9999-12-31`,value:t.start.date,onChange:e=>n({start:{...t.start,date:e.target.value}})})]}),(0,Q.jsxs)(`label`,{className:`block text-sm`,children:[`Time (server time zone)`,(0,Q.jsx)(qs,{"aria-describedby":de,onBlur:()=>x(!0),"aria-invalid":b&&A.time||O?!0:void 0,type:`time`,value:jS(t.start)?`${CS(t.start.hour)}:${CS(t.start.minute)}`:``,onChange:e=>{let[r,i]=e.target.value?e.target.value.split(`:`).map(Number):[-1,-1];n({start:{...t.start,hour:r??-1,minute:i??-1}})}})]})]}),t&&!r&&(0,Q.jsxs)(Q.Fragment,{children:[t.start.kind===`usage-reset`&&L?.usageReset.available&&(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:L.usageReset.provider===`claude`?`The task waits until your Claude usage limit resets, then starts. Cezar knows the reset time from limits your earlier Claude tasks hit.`:`The task waits until your Codex usage limit resets, then starts. Cezar reads the reset time from Codex.`}),t.start.kind===`usage-reset`&&!oe&&!z&&!g&&(0,Q.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:le}),t.start.kind===`usage-reset`&&!oe&&(z||g&&v)&&(0,Q.jsx)(J,{type:`button`,variant:`outline`,size:`sm`,disabled:m||!e.task.trim(),onClick:()=>void R(),children:g?`Try again`:`Refresh`}),t.start.kind===`at`&&v&&(0,Q.jsx)(J,{type:`button`,variant:`outline`,disabled:m||!!j||!e.task.trim(),onClick:()=>void R(),children:`Retry`}),t.start.kind===`at`&&!z&&!g&&!j&&(0,Q.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:le}),z&&(0,Q.jsxs)(`div`,{role:`status`,className:`space-y-1 text-sm`,children:[(0,Q.jsxs)(`p`,{children:[`Earliest start: `,new Date(z.notBefore).toLocaleString(`en-GB`,{timeZone:z.timeZone}),` · `,z.timeZone]}),z.observation&&(0,Q.jsx)(`p`,{children:z.observation}),(0,Q.jsx)(`p`,{className:`text-muted-foreground`,children:`The server must be running. Scheduling does not reserve allowance; account holds and queue limits still apply.`})]})]}),!b&&j&&!g&&(0,Q.jsx)(`p`,{id:ne,className:`text-sm text-muted-foreground`,children:j}),(g||ue)&&(0,Q.jsx)(`p`,{id:ne,role:`alert`,className:`text-sm text-destructive`,children:g||ue})]})]})}var PS=[{id:`slash-skills`,title:`Type / for a skill`,body:`A skill is a playbook the agent follows for one kind of job. Type / in the box to pick one as you write.`,anchor:`textarea`,picture:`slash`},{id:`source`,title:`Skills and workflows`,body:`Nothing picked runs the built-in quick task. A workflow chains steps with checks between them: plan, build, review.`,anchor:`[data-slot="source-pill"]`,picture:`source`},{id:`worktree`,title:`Each task in its own worktree`,body:`The agent works on a branch in a separate checkout, so your working tree stays yours. Uncheck to work in place.`,anchor:`[data-slot="worktree-toggle"]`,picture:`worktree`},{id:`autonomous`,title:`Autonomous runs do not wait`,body:`Checked, the agent carries on without asking you anything until it is done. Unchecked, it stops when it needs you.`,anchor:`[data-slot="autonomous-toggle"]`,picture:`autonomous`},{id:`variants`,title:`Run it twice, keep the better one`,body:`×2 or ×3 runs the same task in parallel, each in its own worktree. You compare the diffs and keep one.`,anchor:`[data-slot="variants-pill"]`,picture:`variants`},{id:`model`,title:`Pick the model`,body:`auto follows the agent’s own default. Choose a larger model for hard work and a faster one for small fixes.`,anchor:`[data-slot="model-pill"]`,picture:`model`},{id:`attachments`,title:`Paste a screenshot`,body:`Drop or paste images and files into the box. The agent sees them with the task.`,anchor:`[aria-label="Attach files"]`,picture:`attachments`},{id:`schedule`,title:`Start it later`,body:`The arrow beside Start schedules the task: tonight, tomorrow morning, or when your usage limit resets.`,anchor:`[data-slot="start-time-trigger"]`,picture:`schedule`},{id:`dispatch`,title:`Let the task fan out`,body:`With dispatch on, the agent can split the work into subtasks that run as their own tasks, and merges what it accepts.`,anchor:`[data-slot="dispatch-toggle"]`,picture:`dispatch`},{id:`ask`,title:`Just ask`,body:`Ask answers a question from the checkout and changes nothing: no branch, no worktree, nothing to review.`,anchor:`[data-slot="ask-toggle"]`,picture:`ask`},{id:`base-branch`,title:`Where it forks from`,body:`Tasks branch off the base branch and pull requests target it. Change it here for every task that follows.`,anchor:`[data-slot="base-pill"]`,picture:`base`},{id:`followups`,title:`Follow-ups land in the inbox`,body:`The agent may note work it found but did not do. Those notes land in the Inbox, ready to run later.`,anchor:`[data-slot="generate-followups-toggle"]`,picture:`followups`},{id:`templates`,title:`Prompt templates`,body:`Insert a saved piece of text at the caret. A template assigned to a skill applies itself when you pick the skill.`,anchor:`[data-slot="prompt-template-trigger"]`,picture:`templates`},{id:`project`,title:`Which project`,body:`Skills, workflows, settings and the draft all follow the project picked here.`,anchor:`[data-slot="project-pill"]`,picture:`project`}];function FS(e){let t=PS.filter(t=>e.present.has(t.anchor));if(e.replay)return t;if(e.off)return[];let n=new Set(e.seen??[]);return t.filter(e=>!n.has(e.id)).slice(0,2)}function IS(e,t){return[...(e??[]).filter(e=>e!==t),t].slice(-50)}function LS(e,t){let n=new Set(e??[]);return PS.filter(e=>t.has(e.anchor)).every(e=>n.has(e.id))}var RS=5e3;function zS({anchorRoot:e,ready:t,loaded:n,seen:r,off:i,onSeen:a,onOff:o}){let[s,c]=Z.useState(null),[l,u]=Z.useState(0),[d,f]=Z.useState(()=>new Set),[p,m]=Z.useState(null),[h,g]=Z.useState(null),_=Z.useRef(null),v=Z.useRef(null),y=Z.useCallback(()=>e.current?.querySelector(`[data-slot="composer"]`)??null,[e]),b=Z.useCallback(()=>{let e=y();return new Set(e?PS.filter(t=>e.querySelector(t.anchor)!==null).map(e=>e.anchor):[])},[y]);Z.useEffect(()=>{if(!t||!n||s!==null)return;let e=b();f(e),c(FS({seen:r,off:i,present:e}))},[t,n,s,r,i,b]);let x=s&&t?s[l]:void 0,S=x?.id;Z.useLayoutEffect(()=>{if(!x){m(null),g(null);return}let t=e.current,n=()=>{let e=y()?.querySelector(x.anchor);if(!t||!e){m(null),g(null);return}let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();m({top:r.top-n.top,left:r.left-n.left,width:r.width,height:r.height});let i=_.current?.getBoundingClientRect();g(i?Math.min(Math.max(r.left+r.width/2-i.left,18),Math.max(i.width-18,18)):null)};n(),window.addEventListener(`resize`,n);let r=t&&typeof ResizeObserver<`u`?new ResizeObserver(n):null;return t&&r?.observe(t),()=>{window.removeEventListener(`resize`,n),r?.disconnect()}},[x,e,y]);let C=Z.useCallback(()=>{S&&(a(S),u(e=>e+1))},[S,a]);Z.useEffect(()=>{if(!x||x.anchor===`textarea`)return;let e=y()?.querySelector(x.anchor);if(e)return e.addEventListener(`click`,C),()=>e.removeEventListener(`click`,C)},[x,y,C]),Z.useEffect(()=>{v.current=S?Date.now():null},[S]);let w=Z.useRef({currentId:S,onSeen:a});if(w.current={currentId:S,onSeen:a},Z.useEffect(()=>()=>{let{currentId:e,onSeen:t}=w.current;e&&v.current!==null&&Date.now()-v.current>=RS&&t(e)},[]),!n||!t||s===null)return null;if(!x){let e=LS(r,d)||i===!0;return(0,Q.jsx)(`div`,{className:`mt-3 flex justify-center`,children:(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`composer-tips-link`,onClick:()=>{i&&o(!1);let t=b();f(t),c(FS({seen:r,off:!1,present:t,replay:e})),u(0)},className:G($y,`text-label text-soft-foreground`),children:[(0,Q.jsx)(nu,{className:`size-3.5`,"aria-hidden":`true`}),e?`Show me around`:`Tips`]})})}let T=l>=s.length-1,E=p!==null&&p.height>40;return(0,Q.jsxs)(Q.Fragment,{children:[p?(0,Q.jsx)(`span`,{"data-slot":`composer-tip-halo`,"aria-hidden":`true`,className:G(`composer-tip-halo pointer-events-none absolute z-10`,E?`rounded-xl`:`rounded-full`),style:{top:p.top-4,left:p.left-4,width:p.width+8,height:p.height+8}}):null,(0,Q.jsxs)(`div`,{"data-slot":`composer-tip`,"data-tip":x.id,role:`note`,"aria-label":`Tip: ${x.title}`,className:`relative mt-3`,children:[h===null?null:(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`composer-tip-arrow z-10`,style:{left:h}}),(0,Q.jsxs)(`div`,{ref:_,className:`onboarding-announcement relative flex items-stretch overflow-hidden rounded-xl border text-left`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col justify-center p-5 pr-10 sm:pr-5`,children:[(0,Q.jsxs)(`span`,{className:`eyebrow text-violet`,children:[`Tip `,l+1,` of `,s.length]}),(0,Q.jsx)(`span`,{className:`mt-1 text-lg font-light tracking-tight text-foreground`,children:x.title}),(0,Q.jsx)(`p`,{className:`mt-1 max-w-md text-ui text-muted-foreground`,children:x.body}),(0,Q.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-x-4 gap-y-2`,children:[(0,Q.jsx)(J,{size:`sm`,className:`font-normal`,onClick:C,children:T?`Got it`:`Next tip`}),(0,Q.jsx)(`button`,{type:`button`,className:$y,onClick:()=>{o(!0),u(s.length)},children:`Don’t show tips`})]})]}),(0,Q.jsx)(WS,{id:x.picture}),(0,Q.jsx)(`button`,{type:`button`,onClick:C,"aria-label":`Close tip`,className:`absolute top-3 right-3 grid size-7 place-items-center rounded-full text-soft-foreground hover:text-foreground`,children:(0,Q.jsx)(ns,{className:`size-3.5`,"aria-hidden":`true`})})]})]})]})}var BS=`h-1.5 rounded bg-muted`,VS=`tip-rise flex items-center gap-2 rounded-md px-2 py-1 text-micro`;function HS({children:e}){return(0,Q.jsx)(`div`,{className:`onboarding-picture hidden w-60 shrink-0 items-end justify-center pt-5 pr-5 sm:flex`,"aria-hidden":`true`,children:(0,Q.jsx)(`div`,{className:`w-full rounded-t-lg border border-b-0 border-border bg-background p-3 shadow-[0_-12px_40px_-20px_var(--violet)]`,children:e})})}function US({rows:e,pick:t=0,start:n=0}){return(0,Q.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:e.map((e,r)=>(0,Q.jsxs)(`div`,{style:{"--i":n+r},className:G(VS,r===t?`bg-violet/15 text-foreground`:`text-muted-foreground`),children:[(0,Q.jsx)(`span`,{className:G(`size-1.5 rounded-full`,r===t?`bg-violet`:`bg-muted-foreground/40`)}),e]},e))})}function WS({id:e}){switch(e){case`slash`:return(0,Q.jsxs)(HS,{children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1 rounded-md border border-violet/60 px-2 py-1.5 font-mono text-meta text-foreground`,children:[(0,Q.jsx)(`span`,{className:`text-violet`,children:`/`}),`fix`,(0,Q.jsx)(`span`,{className:`tip-caret ml-px h-3 w-px bg-violet`})]}),(0,Q.jsx)(`div`,{className:`mt-2`,children:(0,Q.jsx)(US,{rows:[`fix-issue`,`write-tests`,`review-pr`]})})]});case`source`:return(0,Q.jsx)(HS,{children:(0,Q.jsx)(`div`,{className:`flex items-center py-3`,children:[`Plan`,`Build`,`Review`].map((e,t)=>(0,Q.jsxs)(Z.Fragment,{children:[t>0?(0,Q.jsx)(`span`,{className:`h-px flex-1 bg-muted-foreground/40`}):null,(0,Q.jsx)(`span`,{style:{"--i":t},className:G(`tip-rise rounded-md border px-2 py-1 text-micro`,t===1?`border-violet text-foreground`:`border-border text-muted-foreground`),children:e})]},e))})});case`worktree`:case`base`:return(0,Q.jsxs)(HS,{children:[(0,Q.jsxs)(`svg`,{viewBox:`0 0 200 64`,className:`h-16 w-full`,fill:`none`,strokeWidth:`2`,strokeLinecap:`round`,children:[(0,Q.jsx)(`path`,{d:`M12 48 H188`,className:`stroke-muted-foreground/50`}),(0,Q.jsx)(`path`,{d:`M60 48 C 80 48, 84 20, 104 20 H188`,pathLength:1,className:`tip-draw stroke-violet`}),(0,Q.jsx)(`circle`,{cx:`60`,cy:`48`,r:`3.5`,className:`fill-background stroke-muted-foreground/70`}),(0,Q.jsx)(`circle`,{cx:`150`,cy:`20`,r:`3.5`,style:{"--i":2},className:`tip-rise fill-violet`})]}),(0,Q.jsxs)(`div`,{className:`flex justify-between font-mono text-micro text-soft-foreground`,children:[(0,Q.jsx)(`span`,{children:e===`base`?`base: main`:`main`}),(0,Q.jsx)(`span`,{className:`text-violet`,children:e===`base`?`cez/1a2b`:`worktree`})]})]});case`autonomous`:return(0,Q.jsxs)(HS,{children:[(0,Q.jsx)(`div`,{className:G(BS,`w-3/4`)}),(0,Q.jsx)(`div`,{className:G(BS,`mt-1.5 w-1/2`)}),(0,Q.jsx)(`div`,{className:`mt-3 h-1.5 w-full overflow-hidden rounded bg-muted`,children:(0,Q.jsx)(`div`,{className:`tip-progress h-full rounded bg-violet`})}),(0,Q.jsxs)(`div`,{className:`mt-2 flex items-center justify-between text-micro`,children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:`No questions asked`}),(0,Q.jsxs)(`span`,{style:{"--i":10},className:`tip-rise inline-flex items-center gap-1 text-success`,children:[(0,Q.jsx)(Wa,{className:`size-3`}),` done`]})]})]});case`variants`:return(0,Q.jsxs)(HS,{children:[(0,Q.jsx)(`div`,{className:`grid grid-cols-3 gap-1.5`,children:[0,1,2].map(e=>(0,Q.jsxs)(`div`,{style:{"--i":e},className:G(`tip-rise rounded-md border p-1.5`,e===1?`border-violet`:`border-border`),children:[(0,Q.jsx)(`div`,{className:G(BS,`w-full`)}),(0,Q.jsx)(`div`,{className:G(BS,`mt-1 w-2/3`)}),(0,Q.jsx)(`div`,{className:`mt-2 flex justify-end`,children:e===1?(0,Q.jsx)(Wa,{className:`size-3 text-violet`}):(0,Q.jsx)(`span`,{className:`size-3`})})]},e))}),(0,Q.jsx)(`div`,{className:`mt-2 text-center font-mono text-micro text-soft-foreground`,children:`×3 · keep one`})]});case`model`:return(0,Q.jsx)(HS,{children:(0,Q.jsx)(US,{rows:[`auto`,`opus · hard work`,`haiku · small fixes`],pick:1})});case`attachments`:return(0,Q.jsxs)(HS,{children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`tip-drop grid size-9 place-items-center rounded-md border border-violet/60 bg-violet/15`,children:(0,Q.jsx)(`span`,{className:`size-4 rounded-sm bg-violet/60`})}),(0,Q.jsx)(`span`,{className:`tip-drop grid h-9 items-center rounded-md border border-border px-2 text-micro text-muted-foreground`,style:{animationDelay:`900ms`},children:`design.pdf`})]}),(0,Q.jsx)(`div`,{className:G(BS,`mt-3 w-2/3`)})]});case`schedule`:return(0,Q.jsx)(HS,{children:(0,Q.jsx)(US,{rows:[`Now`,`Tonight at 23:00`,`When the usage limit resets`],pick:1})});case`dispatch`:return(0,Q.jsx)(HS,{children:(0,Q.jsxs)(`svg`,{viewBox:`0 0 200 72`,className:`h-[72px] w-full`,fill:`none`,strokeWidth:`2`,strokeLinecap:`round`,children:[(0,Q.jsx)(`rect`,{x:`12`,y:`28`,width:`44`,height:`16`,rx:`4`,className:`stroke-violet`}),[12,36,60].map((e,t)=>(0,Q.jsxs)(Z.Fragment,{children:[(0,Q.jsx)(`path`,{d:`M56 36 C 90 36, 100 ${e}, 128 ${e}`,pathLength:1,style:{"--i":t},className:`tip-draw stroke-muted-foreground/60`}),(0,Q.jsx)(`rect`,{x:`128`,y:e-7,width:`56`,height:`14`,rx:`4`,style:{"--i":t+2},className:`tip-rise stroke-border fill-card`})]},e))]})});case`ask`:return(0,Q.jsxs)(HS,{children:[(0,Q.jsx)(`div`,{className:`ml-auto w-3/4 rounded-lg rounded-br-sm bg-violet/15 px-2 py-1 text-micro text-foreground`,children:`Where is the retry logic?`}),(0,Q.jsxs)(`div`,{style:{"--i":2},className:`tip-rise mt-2 w-5/6 rounded-lg rounded-bl-sm border border-border px-2 py-1 text-micro text-muted-foreground`,children:[(0,Q.jsx)(`span`,{className:`font-mono text-foreground`,children:`src/runs/retry.ts`}),`, nothing changed.`]})]});case`followups`:return(0,Q.jsxs)(HS,{children:[(0,Q.jsx)(`div`,{className:`mb-1 eyebrow text-soft-foreground`,children:`Inbox`}),(0,Q.jsx)(US,{rows:[`Add a test for the empty case`,`Document the new flag`,`Remove the old helper`],pick:0})]});case`templates`:return(0,Q.jsxs)(HS,{children:[(0,Q.jsx)(`div`,{className:G(BS,`w-3/4`)}),(0,Q.jsx)(`div`,{style:{"--i":1},className:`tip-rise mt-1.5 rounded-sm border border-violet/60 bg-violet/15 px-1.5 py-1 text-micro text-foreground`,children:`Run the tests and report what you ran.`}),(0,Q.jsx)(`div`,{className:G(BS,`mt-1.5 w-1/2`)})]});case`project`:return(0,Q.jsx)(HS,{children:(0,Q.jsx)(US,{rows:[`shop-web`,`billing-api`,`docs`],pick:1})})}}function GS({onLongPress:e,onClick:t,delayMs:n=450,moveTolerance:r=8}){let i=(0,Z.useRef)({onLongPress:e,onClick:t});i.current={onLongPress:e,onClick:t};let a=(0,Z.useRef)(null),o=(0,Z.useRef)({x:0,y:0}),s=(0,Z.useRef)(!1),c=(0,Z.useCallback)(()=>{a.current!==null&&(clearTimeout(a.current),a.current=null)},[]);return(0,Z.useEffect)(()=>c,[c]),{onPointerDown:(0,Z.useCallback)(e=>{s.current=!1,c(),e.button===0&&(o.current={x:e.clientX??0,y:e.clientY??0},a.current=setTimeout(()=>{a.current=null,s.current=!0,i.current.onLongPress()},n))},[c,n]),onPointerMove:(0,Z.useCallback)(e=>{if(a.current===null)return;let t=(e.clientX??0)-o.current.x,n=(e.clientY??0)-o.current.y;Math.hypot(t,n)>r&&c()},[c,r]),onPointerUp:c,onPointerCancel:c,onContextMenu:(0,Z.useCallback)(e=>{e.preventDefault(),c(),!s.current&&(s.current=!0,i.current.onLongPress())},[c]),onClick:(0,Z.useCallback)(e=>{if(s.current){s.current=!1,e.preventDefault();return}i.current.onClick?.()},[]),onKeyDown:(0,Z.useCallback)(e=>{(e.key===`ArrowDown`||e.key===`Enter`&&e.shiftKey)&&(e.preventDefault(),i.current.onLongPress())},[])}}function KS({available:e,value:t,onChange:n,onSettingsOpenChange:r,runners:i,parentRunner:a,parentModels:o}){let[s,c]=(0,Z.useState)(!1),l=Oi(),u=(0,Z.useRef)({});t!==null&&(u.current=t);let d=(t??u.current).runner??a,f=O(d,e&&d!==a),p=d===a?o:pc(d,f.data),m=e=>{c(e),r?.(e)},h=t!==null,g=GS({onLongPress:()=>m(!0),onClick:()=>n(h?null:u.current)});if(!e)return null;let _=(0,Q.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":h,"aria-label":`Dispatch`,"data-slot":`dispatch-toggle`,"data-state":h?`on`:`off`,...g,className:G(l?`inline-flex h-full w-[26px] items-center justify-center transition-colors hover:bg-muted`:G(ul,`w-[26px] justify-center px-0`),h&&(l?`hover:bg-primary/15`:`border-primary/60 bg-primary/10 text-primary hover:bg-primary/15 hover:text-primary`)),children:(0,Q.jsx)(Cu,{"aria-hidden":`true`,className:G(`size-3 shrink-0`,h?`text-primary`:`text-soft-foreground`)})}),v=(0,Q.jsx)($S,{value:t,remembered:u.current,onChange:n,runners:i,models:p}),y=(0,Q.jsxs)(as,{side:`top`,sideOffset:6,className:`max-w-[260px]`,children:[(0,Q.jsx)(`div`,{className:`font-medium`,children:h?`Dispatch — on`:`Dispatch — off`}),(0,Q.jsx)(`div`,{className:`text-contrast-foreground/80`,children:h?`Splits this task into subtasks it runs as separate tasks`:`Let this task split into subtasks`}),l?(0,Q.jsx)(`div`,{className:`mt-0.5 text-contrast-foreground/60`,children:`▾ limits and subtask defaults`}):null]}),b=l?(0,Q.jsxs)(`span`,{"data-slot":`dispatch-control`,"data-state":h?`on`:`off`,className:G(`inline-flex h-[26px] items-stretch overflow-hidden rounded-full border border-border bg-card text-muted-foreground transition-colors`,h&&`border-primary/60 bg-primary/10 text-primary`),children:[(0,Q.jsx)(os,{delayDuration:300,children:(0,Q.jsxs)(ss,{children:[(0,Q.jsx)(is,{asChild:!0,children:_}),y]})}),(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Dispatch settings`,"aria-haspopup":`dialog`,"aria-expanded":s,"data-slot":`dispatch-settings-trigger`,onClick:()=>m(!s),className:G(`inline-flex w-[18px] items-center justify-center border-l border-border transition-colors hover:bg-muted`,h&&`border-primary/40 hover:bg-primary/15`),children:(0,Q.jsx)(Xa,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})})]}):(0,Q.jsx)(os,{delayDuration:300,children:(0,Q.jsxs)(ss,{children:[(0,Q.jsx)(is,{asChild:!0,children:_}),y]})});return l?(0,Q.jsxs)(Is,{open:s,onOpenChange:m,children:[(0,Q.jsx)(Rs,{asChild:!0,children:b}),(0,Q.jsx)(Ms,{align:`start`,sideOffset:8,"data-slot":`dispatch-settings`,className:`w-[340px] max-w-[calc(100vw-2rem)] p-3.5`,children:v})]}):(0,Q.jsxs)(Q.Fragment,{children:[b,(0,Q.jsx)(hi,{open:s,onOpenChange:m,children:(0,Q.jsxs)(pi,{side:`bottom`,"data-slot":`dispatch-settings`,className:`rounded-t-xl p-4 pt-16 pb-[max(1rem,env(safe-area-inset-bottom))]`,children:[(0,Q.jsx)(fi,{className:`sr-only`,children:`Dispatch`}),(0,Q.jsx)(ui,{className:`sr-only`,children:`Split this task into subtasks run as separate tasks`}),v]})})]})}function qS({label:e,htmlFor:t,children:n}){return(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsx)(`label`,{htmlFor:t,className:`shrink-0 text-xs text-foreground`,children:e}),n]})}var JS=`h-7 max-w-[180px] rounded-md border border-input bg-card px-2 text-xs shadow-xs outline-none transition-[color,box-shadow] hover:bg-muted focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`,YS=[2,3,4,5,8,10,15,20,30,50],XS=.5,ZS=1e4;function QS(e){let t={};return e.maxSubtasks!==void 0&&(t.maxSubtasks=e.maxSubtasks),e.inFlight!==void 0&&(t.inFlight=e.inFlight),e.runner!==void 0&&(t.runner=e.runner),e.model!==void 0&&(t.model=e.model),e.budgetUsd!==void 0&&(t.budgetUsd=e.budgetUsd),t}function $S({value:e,remembered:t,onChange:n,runners:r,models:i}){let a=(0,Z.useId)(),o=e!==null,s=e??t,c=e=>n(QS({...s,...e})),l=i.filter(e=>e.id!==``),u=Dc.filter(e=>r.includes(e.id)),d=s.maxSubtasks!==void 0&&!YS.some(e=>e===s.maxSubtasks)?[...YS,s.maxSubtasks].sort((e,t)=>e-t):[...YS];return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Q.jsxs)(`header`,{className:`flex items-start gap-2.5`,children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`flex size-7 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary`,children:(0,Q.jsx)(Cu,{className:`size-3.5`})}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`div`,{className:`text-ui font-semibold leading-tight text-foreground`,children:`Dispatch`}),(0,Q.jsx)(`p`,{className:`mt-0.5 text-xs leading-snug text-muted-foreground`,children:`Split this task into subtasks run as separate tasks`})]}),(0,Q.jsx)(jf,{"aria-label":`Dispatch`,"data-slot":`dispatch-settings-switch`,checked:o,onCheckedChange:e=>n(e?t:null)})]}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-border pt-3`,children:[(0,Q.jsx)(qS,{label:`Max subtasks`,htmlFor:`${a}-max`,children:(0,Q.jsxs)(`select`,{id:`${a}-max`,"data-slot":`dispatch-max-subtasks`,className:JS,value:s.maxSubtasks??``,onChange:e=>c({maxSubtasks:e.target.value===``?void 0:Number(e.target.value)}),children:[(0,Q.jsx)(`option`,{value:``,children:`unlimited`}),d.map(e=>(0,Q.jsx)(`option`,{value:e,children:e},e))]})}),(0,Q.jsx)(qS,{label:`In flight at once`,htmlFor:`${a}-flight`,children:(0,Q.jsx)(`select`,{id:`${a}-flight`,"data-slot":`dispatch-in-flight`,className:JS,value:s.inFlight??4,onChange:e=>{let t=Number(e.target.value);c({inFlight:t===4?void 0:t})},children:Array.from({length:4},(e,t)=>t+1).map(e=>(0,Q.jsx)(`option`,{value:e,children:e},e))})}),(0,Q.jsx)(qS,{label:`Subtask runner`,htmlFor:`${a}-runner`,children:(0,Q.jsxs)(`select`,{id:`${a}-runner`,"data-slot":`dispatch-runner`,className:JS,value:s.runner??``,onChange:e=>c({runner:e.target.value===``?void 0:e.target.value,model:void 0}),children:[(0,Q.jsx)(`option`,{value:``,children:`same as parent`}),u.map(e=>(0,Q.jsx)(`option`,{value:e.id,children:e.label},e.id))]})}),(0,Q.jsx)(qS,{label:`Subtask model`,htmlFor:`${a}-model`,children:(0,Q.jsxs)(`select`,{id:`${a}-model`,"data-slot":`dispatch-model`,className:JS,value:s.model??``,onChange:e=>c({model:e.target.value===``?void 0:e.target.value}),children:[(0,Q.jsx)(`option`,{value:``,children:`same as parent`}),l.map(e=>(0,Q.jsx)(`option`,{value:e.id,children:e.label},e.id)),s.model!==void 0&&!l.some(e=>e.id===s.model)?(0,Q.jsx)(`option`,{value:s.model,children:s.model}):null]})}),(0,Q.jsx)(qS,{label:`Budget per subtask`,htmlFor:`${a}-budget`,children:(0,Q.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(qs,{id:`${a}-budget`,"data-slot":`dispatch-budget`,type:`number`,inputMode:`decimal`,placeholder:`none`,step:.5,min:XS,max:ZS,className:`h-7 w-24 px-2 text-xs md:text-xs`,value:s.budgetUsd??``,onChange:e=>{let t=e.target.value,n=Number(t);c({budgetUsd:t===``||!Number.isFinite(n)||n<=0?void 0:Math.min(ZS,Math.max(XS,n))})}}),(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`USD`})]})})]}),(0,Q.jsxs)(`p`,{className:`text-xs leading-snug text-muted-foreground`,children:[`The engine keeps its own brakes: `,4,` in flight and budgets carved out of this task's. These only tell the agent what you want.`]})]})}function eC({label:e,url:t,hint:n,showIcon:r=!0,copySlot:i=`bm-copy`}){let a=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{a.current?.setAttribute(`href`,t)},[t]);let o=async()=>{try{await ml(t),Y(`Bookmarklet URL copied.`)}catch{Y(`Copy failed — drag the button instead.`,{tone:`danger`})}};return(0,Q.jsxs)(`div`,{"data-slot":`bm-row`,className:`flex min-w-0 items-center gap-2.5`,children:[(0,Q.jsxs)(`a`,{ref:a,draggable:!0,"data-slot":`bm-link`,title:`Drag me to your bookmarks bar`,onClick:e=>{e.preventDefault(),Y(`Drag me to your bookmarks bar`)},className:`inline-flex shrink-0 items-center gap-1.5 rounded-md border border-border bg-card px-2.5 py-1 font-mono text-xs font-medium text-foreground shadow-xs transition-colors hover:bg-muted`,children:[r?(0,Q.jsx)(Pa,{"aria-hidden":`true`,className:`size-3 text-primary`}):null,e]}),(0,Q.jsx)(`button`,{type:`button`,"data-slot":i,title:`Copy the bookmarklet URL`,onClick:()=>void o(),className:`shrink-0 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground`,children:`Copy`}),n?(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-meta text-soft-foreground`,children:n}):null]})}var tC=`http://localhost:4321`;function nC(e,t,n,r=tC,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)}`}var rC={ai:`From this project’s .ai/skills; always enabled while present.`,cezar:`From this project’s .ai/cezar/skills; always enabled while present.`,agents:`From .agents/skills or an agent-specific folder; always enabled while present.`,global:`User-wide from ~/.agents/skills or ~/.claude/skills, shared across projects.`,team:`Shared from a team repository configured for this project; importable skills can be enabled or disabled here.`,builtin:`Built into Cezar rather than installed from a skill repository.`};function iC({source:e,className:t,teamRepo:n}){let r=zo({source:e}),i=e===`team`&&n?`Shared from ${n}, a team skills repository configured for this project.`:rC[e];return(0,Q.jsx)(os,{delayDuration:300,children:(0,Q.jsxs)(ss,{children:[(0,Q.jsx)(is,{asChild:!0,children:(0,Q.jsx)(`span`,{"data-slot":`skill-source`,"data-source":e,"aria-label":i,className:G(`shrink-0 rounded-full border border-border px-2 py-px font-mono text-micro`,r?`font-semibold text-foreground`:`text-soft-foreground`,t),children:e})}),(0,Q.jsx)(as,{side:`top`,sideOffset:6,className:`max-w-[260px]`,children:i})]})})}function aC({skill:e,usedBy:t,heading:n=`h2`,enabled:r=!0,activation:i}){return(0,Q.jsxs)(`div`,{"data-slot":`skill-detail`,className:`mx-auto w-full min-w-0 max-w-[var(--measure)]`,children:[(0,Q.jsxs)(`section`,{"data-slot":`skill-properties`,className:`rounded-lg border border-border bg-muted/20 p-4`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-4`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2.5`,children:[(0,Q.jsx)(n,{className:`min-w-0 font-mono text-lg font-semibold break-all`,children:e.name}),(0,Q.jsx)(iC,{source:e.source,teamRepo:e.team?.repo})]}),(0,Q.jsxs)(`p`,{"data-slot":`skill-path`,className:`mt-1 font-mono text-micro break-all text-soft-foreground`,children:[e.path,e.team?` · from ${e.team.repo}`:``]}),e.description?(0,Q.jsx)(`p`,{"data-slot":`skill-description`,className:`mt-2.5 text-ui text-muted-foreground`,children:e.description}):null]}),i?(0,Q.jsx)(jf,{"data-slot":`skill-activation-detail`,"aria-label":i.ariaLabel,checked:i.checked,disabled:i.disabled,onCheckedChange:i.onCheckedChange,size:`sm`,className:`mt-1.5 shrink-0`}):null]}),r?(0,Q.jsx)(oC,{skill:e}):null,t===void 0?null:(0,Q.jsxs)(`section`,{"data-slot":`skill-used-by`,className:`mt-4 border-t border-border pt-4`,children:[(0,Q.jsx)(`h3`,{className:`eyebrow text-soft-foreground`,children:`Used by`}),t.length>0?(0,Q.jsx)(`ul`,{className:`mt-1.5 flex flex-col gap-1`,children:t.map(e=>(0,Q.jsxs)(`li`,{className:`flex items-center gap-1.5 font-mono text-xs text-muted-foreground`,children:[(0,Q.jsx)(_a,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),e]},e))}):(0,Q.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:`Not referenced by any workflow yet — quick-task picks it up when the task mentions it.`})]})]}),(0,Q.jsxs)(`section`,{"data-slot":`skill-content`,className:`mt-6 min-w-0 border-t border-border pt-5`,children:[(0,Q.jsx)(`h3`,{className:`eyebrow text-soft-foreground`,children:`Content`}),(0,Q.jsx)(`div`,{"data-slot":`skill-body`,className:`mt-3 text-sm`,children:(0,Q.jsx)(xl,{children:e.body})})]})]})}function oC({skill:e}){let t=ze(),n=T(),r=a(),[i,o]=(0,Z.useState)(!1),s=t.data?.key??``,c=window.location.origin,l=Vc()??n.data?.bootProject??null,u=r.data?.projects.find(e=>e.id===l)?.name??yM(n.data)?.name??null,d=nC(e.name,i,s,c,l);return(0,Q.jsxs)(`section`,{"data-slot":`skill-run-from-github`,className:`mt-5 border-t border-border pt-4`,children:[(0,Q.jsx)(`h3`,{className:`eyebrow text-soft-foreground`,children:`Run from GitHub`}),(0,Q.jsx)(`p`,{className:`mt-1.5 text-xs text-muted-foreground`,children:`Drag the button to your bookmarks bar, then click it on a GitHub PR or issue.`}),(0,Q.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 text-xs font-medium`,children:[(0,Q.jsx)(jf,{"data-slot":`bookmarklet-auto`,size:`sm`,"aria-label":`Start automatically`,checked:i,onCheckedChange:o}),(0,Q.jsx)(`span`,{children:`Start automatically`})]}),(0,Q.jsx)(`div`,{className:`mt-3`,children:(0,Q.jsx)(eC,{label:u?`/${e.name} (${u})`:`/${e.name}`,url:d,showIcon:!1,copySlot:`skill-bookmarklet-copy`})}),(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`To update an existing bookmarklet after changing this option, drag the button to your bookmarks bar again.`}),(0,Q.jsx)(X,{to:`/settings/bookmarklets`,"data-slot":`skill-bookmarklets-settings`,className:`mt-2 inline-block text-xs font-medium text-violet hover:underline`,children:`Manage saved bookmarklets`})]})}function sC({skill:e,onClose:t}){return(0,Q.jsx)(ws,{open:e!==null,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsx)(Ss,{"data-slot":`skill-preview`,className:`block max-h-[80dvh] overflow-y-auto sm:max-w-2xl`,children:e?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(ys,{className:`sr-only`,children:e.name}),(0,Q.jsx)(xs,{className:`sr-only`,children:`Skill preview with GitHub launcher`}),(0,Q.jsx)(aC,{skill:e,heading:`h3`}),(0,Q.jsx)(`p`,{className:`mt-5`,children:(0,Q.jsx)(X,{to:`/skills?skill=${encodeURIComponent(e.name)}`,"data-slot":`skill-preview-manage`,onClick:t,className:`text-xs font-semibold text-violet hover:underline`,children:`Open in the Skills catalog`})})]}):null})})}function cC({source:e,ready:t,skills:n,skillUsage:r,workflows:i,onPick:a}){let[o,s]=(0,Z.useState)(!1),[c,l]=(0,Z.useState)(``),[u,d]=(0,Z.useState)(null),f=(0,Z.useRef)(null),{mostUsed:p,project:m,global:h}=Oo(Ko(n,c,r),r),g=i.find(e=>e.name===kc),_=Ao(i,c).filter(e=>e.name!==kc),v=Wo(`no skill`,`none plain ${kc} ${g?.description??``}`,c)>0,y=!v&&p.length===0&&m.length===0&&h.length===0&&_.length===0,b=e=>{a(e),s(!1)},x=t=>b(e?.source===t.source&&e.ref===t.ref?null:t),S=(t,n)=>{let r=e?.source===`skill`&&e.ref===t.name;return(0,Q.jsxs)(qc,{value:`skill ${t.name} ${t.path}`,keywords:Go(t.name,t.description),"data-slot":`source-option`,"data-source-kind":`skill`,"data-source-ref":t.name,onSelect:()=>x({source:`skill`,ref:t.name}),children:[(0,Q.jsx)(`span`,{className:G(`shrink-0 text-xs`,n&&`font-semibold`),children:t.name}),t.description?(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:t.description}):null,(0,Q.jsx)(`button`,{type:`button`,"data-slot":`source-skill-view`,"aria-label":`View skill ${t.name}`,title:`View skill`,onClick:e=>{e.preventDefault(),e.stopPropagation(),d(t)},className:`ml-auto shrink-0 rounded-sm p-0.5 text-soft-foreground transition-colors hover:text-foreground`,children:(0,Q.jsx)(vo,{"aria-hidden":`true`,className:`size-3.5`})}),r?(0,Q.jsx)(Wa,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},t.path)},C=e===null?Jo:e.source===`skill`?Ba:ts,w=(0,Q.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:G(ul,`text-meta`,e===null?`border-dashed text-soft-foreground`:`rounded-r-none border-r-0 border-foreground/60 pr-1.5 text-foreground`),children:[(0,Q.jsx)(C,{"aria-hidden":`true`,className:G(`size-3 shrink-0`,e===null?`text-soft-foreground`:`text-violet`)}),(0,Q.jsx)(`span`,{className:`max-w-44 truncate`,children:t?e?.ref??`Skill`:`…`}),dl]});return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(sC,{skill:u,onClose:()=>d(null)}),(0,Q.jsxs)(Is,{open:o,onOpenChange:e=>{s(e),e||l(``)},children:[(0,Q.jsxs)(`span`,{className:`inline-flex items-center`,children:[(0,Q.jsx)(Es,{asChild:!0,children:w}),e!==null&&t?(0,Q.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:G(ul,`rounded-l-none border-foreground/60 pl-1.5 pr-2 text-soft-foreground hover:text-foreground`),children:(0,Q.jsx)(ns,{"aria-hidden":`true`,className:`size-3`})}):null]}),(0,Q.jsx)(Ms,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Q.jsxs)(Xc,{shouldFilter:!1,children:[(0,Q.jsx)(Hc,{placeholder:`search skills & workflows…`,value:c,onValueChange:l,onInput:()=>f.current?.scrollTo(0,0)}),(0,Q.jsxs)(Yc,{ref:f,"data-slot":`source-menu`,className:`max-h-[min(18rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[y?(0,Q.jsx)(Jc,{children:`Nothing matches.`}):null,v?(0,Q.jsx)(Wc,{children:(0,Q.jsxs)(qc,{value:`none no-skill`,keywords:[`none`,`plain`,...Go(kc)],"data-slot":`source-option`,"data-source-kind":`none`,onSelect:()=>b(null),children:[(0,Q.jsx)(Ta,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-soft-foreground`}),(0,Q.jsx)(`span`,{className:`shrink-0 text-xs font-medium`,children:`No skill`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:g?.description??`One agent run on your task — no ceremony.`}),e===null?(0,Q.jsx)(Wa,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-primary`}):null]})}):null,p.length>0?(0,Q.jsx)(Wc,{heading:`Most used`,children:p.map(e=>S(e,zo(e)))}):null,m.length>0?(0,Q.jsx)(Wc,{heading:`Project skills`,children:m.map(e=>S(e,!0))}):null,_.length>0?(0,Q.jsx)(Wc,{heading:`Workflows`,children:_.map(t=>{let n=e?.source===`workflow`&&e.ref===t.name;return(0,Q.jsxs)(qc,{value:`workflow ${t.name}`,keywords:Go(t.name,t.description),"data-slot":`source-option`,"data-source-kind":`workflow`,"data-source-ref":t.name,onSelect:()=>x({source:`workflow`,ref:t.name}),children:[(0,Q.jsx)(`span`,{className:`shrink-0 text-xs`,children:t.name}),t.description?(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:t.description}):null,n?(0,Q.jsx)(Wa,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-primary`}):null]},t.name)})}):null,h.length>0?(0,Q.jsx)(Wc,{heading:`Global`,children:h.map(e=>S(e,!1))}):null]})]})})]})]})}function lC(e,t,n){let r=e.skill===``?{source:`workflow`,ref:`quick-task`}:{source:`skill`,ref:e.skill};return Tc({task:e.ref,source:r,model:``,runner:t,defaultRunner:n,variants:1,images:[],todoId:e.todo})}function uC(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 dC(e,t){return`Use the "${e}" skill on: ${t}`}function fC(e,t){return t&&e===`source-dependent`?!1:e}function pC(e,t){return e.worktree===null?null:(e.worktreeBasis??`default`)===(t??`default`)?e.worktree:null}function mC(e){let t=e.dispatch===!0,n=e.configuredAutonomous===`source-dependent`?e.source===`skill`:e.configuredAutonomous,r=e.interactive!==!0&&void 0;return{autonomous:e.explicitAutonomous??(t?!0:void 0)??r??n,worktree:e.hasGit?e.variants>1||t?!0:e.explicitWorktree??r??e.configuredWorktree:!1}}function hC(e){return e.readOnly===!0&&e.hasGit?`Asks a read-only question about the current checkout — no branch, nothing to clean up.`:e.dispatch===!0?e.autonomous===!0?`Runs on its own and fans work out to subtasks — it will not pause for you.`:`Fans work out to subtasks in isolated worktrees.`:e.worktree?`Runs in an isolated worktree — review everything before it lands.`:e.hasGit&&e.newBranch?`Runs in the repo working tree on a new branch from base — your checkout switches to it.`:e.hasGit&&e.autoLand?e.autonomous===!0?`Runs in the repo working tree, one write task at a time — finished work is checked and lands on the base branch.`:`Runs in the repo working tree, one write task at a time — review the changes, then Commit lands them on the base branch.`: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 gC={text:``,source:null,runner:null,agentProfile:null,model:null,reasoningEffort:null,variants:1,worktree:null,autonomous:null,generateFollowups:null,dispatch:null},_C=`cez-new-task-draft`;function vC(e){return e===null?_C:`${_C}:${e}`}function yC(e){let t=e&&typeof e==`object`?e:{};return{text:typeof t.text==`string`?t.text:``,source:xC(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,reasoningEffort:typeof t.reasoningEffort==`string`?t.reasoningEffort:null,variants:t.variants===2||t.variants===3?t.variants:1,worktree:typeof t.worktree==`boolean`?t.worktree:null,...typeof t.worktreeBasis==`string`?{worktreeBasis:t.worktreeBasis}:{},...t.newBranch===!0?{newBranch:!0}:{},...typeof t.branchName==`string`&&t.branchName?{branchName:t.branchName}:{},autonomous:typeof t.autonomous==`boolean`?t.autonomous:null,generateFollowups:typeof t.generateFollowups==`boolean`?t.generateFollowups:null,dispatch:bC(t.dispatch),...typeof t.readOnly==`boolean`?{readOnly:t.readOnly}:{}}}function bC(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e,n={},r=(e,t)=>typeof e==`number`&&Number.isInteger(e)&&e>=1&&e<=t?e:void 0,i=r(t.maxSubtasks,50);i!==void 0&&(n.maxSubtasks=i);let a=r(t.inFlight,4);return a!==void 0&&(n.inFlight=a),typeof t.runner==`string`&&Dc.some(e=>e.id===t.runner)&&(n.runner=t.runner),typeof t.model==`string`&&t.model!==``&&t.model.length<=120&&(n.model=t.model),typeof t.budgetUsd==`number`&&Number.isFinite(t.budgetUsd)&&t.budgetUsd>0&&t.budgetUsd<=1e4&&(n.budgetUsd=t.budgetUsd),n}function xC(e){return!!e&&typeof e==`object`&&(e.source===`skill`||e.source===`workflow`)&&typeof e.ref==`string`}var SC=new Map;function CC(e=null){let t=vC(e),n=SC.get(t);if(n)return{...n};let r;try{let e=localStorage.getItem(t);r=e?yC(JSON.parse(e)):{...gC}}catch{r={...gC}}return SC.set(t,r),{...r}}function wC(e,t=null){let n=vC(t);SC.set(n,{...e});try{localStorage.setItem(n,JSON.stringify(e))}catch{}}function TC(e=null){let{branchName:t,readOnly:n,...r}=CC(e);wC({...r,text:``,source:null},e)}var EC=new Map;function DC(e=null){return[...EC.get(vC(e))??[]]}function OC(e,t=null){let n=vC(t);e.length===0?EC.delete(n):EC.set(n,[...e])}function kC(e,t){if(e===t)return{moved:!1,reason:`same-project`};let n=CC(e),r=DC(e);if(n.text===``&&r.length===0)return{moved:!1,reason:`nothing-to-move`};let i=CC(t);return i.text!==``||DC(t).length>0?{moved:!1,reason:`destination-busy`}:(wC({...i,text:n.text},t),wC({...n,text:``},e),OC(r,t),OC([],e),{moved:!0})}var AC=new Map;function jC(e){return`cez-pending-schedule:${e??`default`}`}function MC(e){let t=AC.get(e);if(t)return t;try{let t=JSON.parse(sessionStorage.getItem(e)??`null`);if(lr.safeParse(t).success)return t}catch{}return null}function NC(e,t){t?AC.set(e,t):AC.delete(e);try{t?sessionStorage.setItem(e,JSON.stringify(t)):sessionStorage.removeItem(e)}catch{}}function PC(){let[e]=kr(),t=Fc(),n=W(),{projectId:r}=Tr(),i=ut().projectId,o=a(),[s]=(0,Z.useState)(()=>ub(e)),c=T(),l=ht(),u=oe(),d=mn(),f=Bt(),p=bt(),m=Zy(),h=(0,Z.useRef)(null),g=jn(),_=qt(),[v,y]=(0,Z.useState)(()=>({...CC(i),...s.ref===``?{}:{text:s.ref},...s.skill===``?{}:{source:{source:`skill`,ref:s.skill}}}));(0,Z.useEffect)(()=>{wC(v,i)},[v,i]);let b=e=>y(t=>({...t,...e})),[x,S]=(0,Z.useState)(()=>DC(i));(0,Z.useEffect)(()=>{OC(x,i)},[x,i]);let C=f.data?.recentSources,w=u.data,E=f.data?.skillUsage,k=(0,Z.useMemo)(()=>Mo(w??[],E),[w,E]),A=l.data?.workflows??[],j=o.data?.projects??[],ee=e=>o.data?.bootProject===e?null:e,M=u.isError&&u.data===void 0||l.isError&&l.data===void 0,N=!u.isPending&&!l.isPending&&!f.isPending,te=g.data?.taskWorkspace===`in-place`,ne=d.data?.info!=null&&(te||g.data?.profile===`trunk`),P=ne&&v.variants<=1&&v.dispatch===null&&(v.readOnly??(g.data?.profile===`trunk`&&dc(v.text))),F=(M?v.source:_c(v.source,k,A))??yc(g.data,P,M?null:k),re=F?.source===`skill`?k.find(e=>e.name===F.ref):void 0,I=(0,Z.useRef)(null),ie=(0,Z.useMemo)(()=>ko(jo(f.data?.promptTemplates),c.data?.capabilities),[f.data?.promptTemplates,c.data?.capabilities]),L=Po(ie,F?.source===`skill`?[F.ref]:[]),ae=(0,Z.useRef)(v.text);ae.current=v.text;let se=(0,Z.useRef)(``);(0,Z.useEffect)(()=>{if(!N)return;let e=Fo(ae.current,se.current,L);se.current=e.applied,e.text!==ae.current&&b({text:e.text})},[L,N]);let ce=Dt(),R=bn(ce.data),z=g.data?.defaultRunner,le=z??`claude`,ue=R.length>0?bc(v.runner,R,le):null,de=ue??le,B=ce.isSuccess&&R.length>0,pe=O(de),me=g.data?.modelsLocked===!0,he=ue===null?[]:pc(ue,pe.data,[v.model,g.data?.defaultModels?.[ue]]),ge=ue===null?``:hc(me?null:v.model,ue,g.data?.defaultModels,pe.data),_e=ue===null?``:Cc(v.reasoningEffort,ue,ge,pe.data),ve=ue===null?[]:mc(ue,ge,pe.data),{accounts:ye,repoAccount:be}=fc(),xe=ye.some(e=>e.provider===de&&e.id===v.agentProfile)?v.agentProfile:null,Se=oc(de,xe??be?.[de]),Ce=(0,Z.useRef)(!1);(0,Z.useEffect)(()=>{let e=B&&!Ce.current;Ce.current=B,e&&document.activeElement===document.body&&document.querySelector(`textarea[aria-label="Describe a task for the agent"]`)?.focus()},[B]);let we=d.data===void 0||d.data.info!==null,Te=we?v.variants:1,Ee=we,De=c.data?.capabilities.dispatch===!0&&we,Oe=De?v.dispatch:null,ke=Oe!==null,[Ae,je]=(0,Z.useState)(!1),[Me,Ne]=(0,Z.useState)(!1),Pe=(0,Z.useRef)(null),Fe=e=>{b({dispatch:e}),Pe.current!==null&&clearTimeout(Pe.current),Pe.current=null,je(e!==null),e!==null&&(Pe.current=setTimeout(()=>je(!1),6e3))};(0,Z.useEffect)(()=>()=>{Pe.current!==null&&clearTimeout(Pe.current)},[]);let Ie=Te>1||ke,Le=mC({hasGit:we,variants:Te,explicitAutonomous:v.autonomous,explicitWorktree:pC(v,g.data?.taskWorkspace),interactive:re?.interactive,configuredAutonomous:fC(_.data?.composerDefaults?.autonomous??_.data?.composerDefaults?.inheritedAutonomous??`source-dependent`,g.data?.landing===`auto`),configuredWorktree:g.data?.taskWorkspace?g.data.taskWorkspace===`worktree`:_.data?.composerDefaults?.worktree??_.data?.composerDefaults?.inheritedWorktree??!0,source:F?.source??`workflow`,dispatch:ke}),Re=P&&!ke&&Te<=1,ze=Le.worktree&&!Re,Be=Le.autonomous,Ve=c.data===void 0||c.data.capabilities.followups,He=Ve?v.generateFollowups??f.data?.lastGenerateFollowups??!0:!1,[Ue,We]=(0,Z.useState)(()=>s.auto&&s.ref!==``),[Ge,Ke]=(0,Z.useState)(()=>!s.auto&&s.ref!==``?{kind:`prefill`}:null),qe=(0,Z.useRef)(!1),Je=(0,Z.useRef)(!1);(0,Z.useEffect)(()=>{qe.current||(qe.current=!0,e.toString()!==``&&t(`/new`,{replace:!0}))},[]),(0,Z.useEffect)(()=>{if(!Je.current&&!(!s.auto||s.ref===``)&&!ce.isPending){if(ot.current){Je.current=!0,We(!1),Ke({kind:`prefill`});return}if(!B||ue===null){Je.current=!0,Ke({kind:`prefill`}),We(!1);return}if(!g.isPending){if(Je.current=!0,z===void 0){Ke({kind:`prefill`}),We(!1);return}if(ue!==z){Ke({kind:`prefill`}),We(!1);return}(async()=>{let e=``;try{e=(await Cn()).key}catch{}if(e!==``&&s.key===e)try{let e=await D(lC(s,ue,z));Mc(`bookmarklet`),TC(i),n.invalidateQueries({queryKey:H.runs.all}),t(uc(e));return}catch(e){Ke({kind:`failed`,message:e instanceof Error?e.message:String(e)})}else Ke({kind:`blocked`});We(!1)})()}}},[g.isPending,z,ce.isPending,B,ue]),(0,Z.useEffect)(()=>{if(Ge===null||!N)return;Ke(null);let e=s.skill!==``&&!M&&!k.some(e=>e.name===s.skill)?s.skill:``;e!==``&&b({text:dC(s.skill,s.ref),source:null});let{message:t,tone:n}=uC(Ge,e);Y(t,{tone:n}),document.querySelector(`[data-slot="composer"] button[aria-label="Start task"]`)?.focus()},[Ge,N]);let[Ye,Xe]=(0,Z.useState)(null),[Ze,Qe]=(0,Z.useState)(),[$e,et]=(0,Z.useState)(),[tt,nt]=(0,Z.useState)(!1),rt=jC(i),[it,at]=(0,Z.useState)(()=>MC(rt)),ot=(0,Z.useRef)(it),[st,ct]=(0,Z.useState)(!1),[lt,dt]=(0,Z.useState)(),ft=async(e,r)=>{NC(rt,null),lv(),r||TC(i),ot.current=null,at(null),await n.invalidateQueries({queryKey:Q_()}),e.outcome===`cancelled`&&Y(`The original schedule was already cancelled.`),t(e.outcome===`launched`&&e.runIds[0]?`/tasks/${e.runIds[0]}`:`/`)},pt=async(e,t=!1)=>{let n=ot.current!==null;ot.current=e,NC(rt,e);let r;try{r=await fe(e)}catch(t){throw!n&&t instanceof pn&&(t.status===400||t.status===409&&(t.message===`Settings or reset time changed. Check the preview again.`||t.message===`Automations are off — this cockpit was started with CEZ_AUTOMATIONS=0`))?(NC(rt,null),ot.current=null,at(null),Xe(e=>e&&{start:e.start,invalidated:t.message})):at(e),t}await ft(r.scheduled,t)},mt=async()=>{if(!(!ot.current||st)){ct(!0),dt(void 0);try{await pt(ot.current,!0)}catch(e){dt(e instanceof Error?e.message:String(e))}finally{ct(!1)}}},gt=(e,t)=>Tc({task:e.trim(),source:F,model:ge,reasoningEffort:_e,modelsLocked:me,runner:ue??z??`claude`,runnerExplicit:v.runner!==null,agentProfile:xe,defaultRunner:z,variants:Te,images:t,worktree:ze,newBranch:v.newBranch,branch:v.branchName,autonomous:Be,generateFollowups:He,todoId:s.todo,dispatch:Oe,readOnly:Re,inPlaceByDefault:te}),_t=x.length?`Remove attachments to schedule this task.`:s.todo?`Tasks linked to a todo can only start now.`:c.data?.capabilities?.automations===!0?void 0:`Scheduling is disabled on this server.`,vt=gt(v.text,x),yt=!_t&&!!Ye?.preview&&Date.parse(Ye.preview.notBefore)>Date.now()&&Ye.settingsKey===wS(vt);return Ue?(0,Q.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,Q.jsx)(hl,{}),(0,Q.jsxs)(`div`,{"data-slot":`auto-starting`,role:`status`,className:`text-center`,children:[(0,Q.jsx)(`h1`,{className:`animate-pulse text-lg font-semibold tracking-tight`,children:`Starting task…`}),(0,Q.jsx)(`p`,{className:`mt-1.5 text-ui text-muted-foreground`,children:`Launched from a bookmarklet — taking you to the run.`})]})]}):(0,Q.jsx)(`div`,{"data-route":`new`,"data-onboarding":``,className:`relative isolate flex min-h-full flex-col items-center overflow-x-clip px-6 pt-[clamp(32px,7vh,84px)] pb-16 max-md:px-3.5 max-md:pt-7`,children:(0,Q.jsxs)(`div`,{ref:h,className:`relative w-full max-w-[720px]`,children:[(0,Q.jsxs)(`header`,{className:`mb-7 text-center max-md:mb-5`,children:[(0,Q.jsx)(`h1`,{className:`text-4xl font-light tracking-tight text-balance text-foreground max-md:text-3xl`,children:`What should the agent work on?`}),(0,Q.jsx)(`p`,{"data-slot":`run-mode-note`,className:`mx-auto mt-3 max-w-md text-lead text-muted-foreground max-md:text-ui`,children:hC({worktree:ze,hasGit:we,dispatch:ke,autonomous:Be,newBranch:v.newBranch,readOnly:Re,autoLand:g.data?.landing===`auto`&&g.data.landingBlocked===null})})]}),it&&(0,Q.jsxs)(`div`,{role:`alert`,className:`mb-4 rounded-lg border p-4 text-sm`,children:[(0,Q.jsx)(`p`,{children:`The original task may already be scheduled. Recover it before starting another task.`}),(0,Q.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap`,children:it.task.task}),(0,Q.jsx)(`p`,{className:`mt-2`,children:`Recovery uses the original prompt, settings and start time. Your current edits will not be submitted. If scheduling is disabled, restore it on the server and retry recovery; the original request is kept to prevent duplicates. Once recovered, you can manage the task in Scheduled.`}),(0,Q.jsx)(`button`,{type:`button`,className:`mt-3 underline`,disabled:st,onClick:()=>void mt(),children:st?`Recovering original schedule…`:`Recover original schedule`})]}),lt&&(0,Q.jsx)(`p`,{role:`alert`,className:`mb-3 text-sm`,children:lt}),(0,Q.jsx)(Ho,{ref:I,onSubmit:async(e,r)=>{if(ot.current)throw Error(`Recover the original schedule before starting another task.`);if(!B||ue===null)throw Error(ce.isPending?`Checking agent providers…`:ce.isError?`Provider authentication could not be verified.`:`Connect an agent provider before starting a task.`);if(Se.blocked!==null){let e=await Se.verify();if(e!==null)throw Error(e)}if(!N)throw Error(`Still loading workflows and skills — try again in a second.`);let a=gt(e,r);if(Ye){if(_t||!Ye.preview||Date.parse(Ye.preview.notBefore)<=Date.now()||Ye.settingsKey!==wS(a))throw Error(`Check the start time again after changing the task settings.`);await pt({task:a,start:Ye.start,previewRevision:Ye.preview.previewRevision,idempotencyKey:crypto.randomUUID()}),wc(Ye.start.kind===`at`?`at`:`usage_reset`);return}let o=await D(a);Mc(`new_task`),en({lastTask:F,...F?{recentSources:Oc(C,F)}:{},...Ve?{lastGenerateFollowups:He}:{},...F?.source===`skill`&&f.data!==void 0?{skillUsage:Uo(f.data.skillUsage,F.ref)}:{}}).then(()=>n.invalidateQueries({queryKey:H.uiState})).catch(()=>{}),TC(i),n.invalidateQueries({queryKey:H.runs.all}),t(uc(o))},value:v.text,onValueChange:e=>b({text:e}),images:x,onImagesChange:S,autoFocus:!0,placeholder:`Describe a task for the agent — / for skills…`,ariaLabel:`Describe a task for the agent`,sendAriaLabel:Ye?`Schedule task`:`Start task`,sendLabel:Ye?`Schedule task`:void 0,submitDisabled:!!it||st||!N||!!Ye&&!yt,disabled:!B,disabledReason:ce.isPending?`Checking agent providers…`:ce.isError?`Provider authentication could not be verified.`:`Connect an agent provider before starting a task.`,autocompleteSkills:!0,sendShortcut:`↵`,sendMenu:(0,Q.jsx)(NS,{task:vt,value:Ye,onChange:Xe,disabledReason:_t,onBlockedChange:Qe,onLabelChange:et,open:tt,onOpenChange:nt}),footerStart:(0,Q.jsxs)(Q.Fragment,{children:[j.length>1&&r!==void 0?(0,Q.jsx)(HC,{projects:j,projectId:r,onPick:e=>{let n=kC(i,ee(e));!n.moved&&n.reason===`destination-busy`&&Y(`Kept your draft in ${j.find(e=>e.id===(i??o.data?.bootProject))?.name??r}; ${j.find(t=>t.id===e)?.name??e} already has an unsent draft.`,{tone:`danger`}),t(`/p/${encodeURIComponent(e)}/new`,{replace:!0})}}):null,(0,Q.jsx)(cC,{source:F,ready:N,skills:k,skillUsage:E,workflows:A,onPick:e=>b({source:e})}),R.length>1||R.some(e=>jc(ye,e))?(0,Q.jsx)(fl,{runners:R,value:de,accounts:ye,account:xe,repoAccount:be,onPick:(e,t)=>b({runner:e,agentProfile:t,...e===de?{}:{model:null,reasoningEffort:null}}),disabled:!B}):null,(0,Q.jsx)(pl,{slot:`model-pill`,ariaLabel:`Model`,label:he.find(e=>e.id===ge)?.label??`auto`,value:ge,disabled:!B,readOnly:me,disabledHint:me?`Model selection is locked to native coding-agent settings.`:void 0,onPick:e=>b({model:e,reasoningEffort:null}),options:he.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:Sc(de,pe.data,pe.isError)}),(0,Q.jsx)(_l,{runner:de,model:ge,value:_e,options:ve,disabled:!B,modelsLocked:me,onPick:e=>b({reasoningEffort:e||null})}),(0,Q.jsx)(pl,{slot:`variants-pill`,ariaLabel:`Parallel variants`,label:Te>1?`×${Te} variants`:`×1`,value:String(Te),onPick:e=>b({variants:Number(e)}),disabled:!we,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`}]}),(0,Q.jsx)(FC,{}),ne?(0,Q.jsx)(IC,{on:Re,auto:v.readOnly===void 0,onChange:e=>b({readOnly:e})}):null,Ee&&!Re?(0,Q.jsx)(LC,{on:ze,disabled:Ie,disabledReason:ke?`Dispatch forks this task's commits — subtasks need a worktree`:`Parallel variants always use isolated worktrees`,onChange:e=>b({worktree:e,worktreeBasis:g.data?.taskWorkspace??`default`})}):null,Ee&&!ze&&!Re?(0,Q.jsx)(RC,{on:v.newBranch===!0,name:v.branchName??``,onChange:e=>b({newBranch:e}),onNameChange:e=>b({branchName:e})}):null,(0,Q.jsx)(zC,{on:Be,onChange:e=>b({autonomous:e})}),Ve?(0,Q.jsx)(BC,{on:He,onChange:e=>b({generateFollowups:e})}):null,ie.length>0||De?(0,Q.jsx)(FC,{}):null,(0,Q.jsx)(_S,{templates:ie,iconOnly:!0,onInsert:e=>I.current?.insertAtCaret(e)}),(0,Q.jsx)(KS,{available:De,value:Oe,onChange:Fe,onSettingsOpenChange:Ne,runners:R,parentRunner:de,parentModels:he}),d.data?.info?(0,Q.jsx)(FC,{}):null,d.data?(0,Q.jsx)(UC,{repo:d.data}):null,re?.interactive&&(v.autonomous===null||v.worktree===null)?(0,Q.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]}),footerEnd:(0,Q.jsxs)(Q.Fragment,{children:[Ye&&$e&&!Ze?(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`schedule-summary`,title:$e.title,onClick:()=>nt(!0),className:`flex max-w-[16rem] items-center gap-1 truncate rounded-md px-1.5 py-1 text-xs text-muted-foreground hover:bg-muted hover:text-foreground`,children:[(0,Q.jsx)(Ll,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Q.jsx)(`span`,{className:`truncate`,children:$e.text})]}):null,Ye&&Ze?(0,Q.jsx)(`span`,{role:`status`,"data-slot":`schedule-blocked`,title:Ze,className:`max-w-[16rem] truncate text-xs text-muted-foreground`,children:Ze}):null,!B&&!ce.isPending?(0,Q.jsx)(X,{to:`/settings/agents#providers`,className:`text-xs font-medium text-foreground underline underline-offset-4`,children:`Configure providers`}):null]})}),Se.blocked===null?null:(0,Q.jsxs)(`p`,{"data-slot":`account-signed-out`,role:`alert`,className:`mt-2 rounded-md border border-destructive/30 bg-destructive/[0.07] px-3 py-1.5 text-xs text-muted-foreground`,children:[Se.blocked,` `,(0,Q.jsx)(Or,{to:`/settings/global/accounts`,className:`font-medium text-foreground underline underline-offset-2`,children:`Agent accounts`})]}),ke&&(Me||Ae)?(0,Q.jsxs)(`p`,{"data-slot":`dispatch-hint`,className:`mt-2 rounded-md border border-primary/25 bg-primary/[0.07] px-3 py-1.5 text-xs text-muted-foreground`,children:[(0,Q.jsx)(`strong`,{className:`font-semibold text-foreground`,children:`Dispatch is on.`}),` Splits this task into subtasks it runs as separate tasks. Worktree stays on. Long-press the icon for limits.`]}):null,(0,Q.jsx)(zS,{anchorRoot:h,ready:B&&N&&!it,loaded:p.data!==void 0,seen:p.data?.onboarding?.composerTipsSeen,off:p.data?.onboarding?.composerTipsOff,onSeen:e=>m(t=>({composerTipsSeen:IS(t?.composerTipsSeen,e)})),onOff:e=>m({composerTipsOff:e})}),(0,Q.jsx)(GC,{onPick:e=>b({text:e})})]})})}function FC(){return(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`mx-0.5 h-3.5 w-px shrink-0 bg-border max-md:hidden`})}function IC({on:e,auto:t,onChange:n}){return(0,Q.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":e,"data-slot":`ask-toggle`,onClick:()=>n(!e),title:e?`Read-only question — answers from the checkout, changes nothing${t?` (picked because the message is a question)`:``}`:`Check to ask a read-only question instead of filing a change`,className:G(ul,e&&`border-primary/60 text-foreground`),children:[e?(0,Q.jsx)(Wa,{"aria-hidden":`true`,className:`size-3 shrink-0 text-primary`}):(0,Q.jsx)(Zo,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),`Ask`]})}function LC({on:e,disabled:t,disabledReason:n,onChange:r}){return(0,Q.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":e,disabled:t,"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:G(ul,e&&`border-primary/60 text-foreground`),children:[e?(0,Q.jsx)(Wa,{"aria-hidden":`true`,className:`size-3 shrink-0 text-primary`}):(0,Q.jsx)(Zo,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),`Worktree`]})}function RC({on:e,name:t,onChange:n,onNameChange:r}){return(0,Q.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Q.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":e,"data-slot":`new-branch-toggle`,onClick:()=>n(!e),title:e?`Switches the repo checkout to a new branch from the base before the agent starts`:`Runs on whatever branch is checked out — check to start a new branch from the base`,className:G(ul,e&&`border-primary/60 text-foreground`),children:[e?(0,Q.jsx)(Wa,{"aria-hidden":`true`,className:`size-3 shrink-0 text-primary`}):(0,Q.jsx)(Zo,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),`New branch`]}),e?(0,Q.jsx)(`input`,{"aria-label":`New branch name`,"data-slot":`new-branch-name`,value:t,placeholder:`feat/… (auto)`,onChange:e=>r(e.target.value),className:`h-6 w-36 rounded-md border border-input bg-card px-2 font-mono text-meta outline-none focus-visible:border-ring`}):null]})}function zC({on:e,disabled:t,onChange:n}){return(0,Q.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":e,disabled:t,"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:G(ul,e&&!t&&`border-primary/60 text-foreground`),children:[e?(0,Q.jsx)(Wa,{"aria-hidden":`true`,className:`size-3 shrink-0 text-primary`}):(0,Q.jsx)(Zo,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),`Autonomous`]})}function BC({on:e,onChange:t}){return(0,Q.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`,className:G(ul,e&&`border-primary/60 text-foreground`),children:[e?(0,Q.jsx)(Wa,{"aria-hidden":`true`,className:`size-3 shrink-0 text-primary`}):(0,Q.jsx)(Zo,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),`Follow-ups`]})}function VC(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 HC({projects:e,projectId:t,onPick:n}){let[r,i]=(0,Z.useState)(!1),[a,o]=(0,Z.useState)(``),s=e.find(e=>e.id===t),c=VC(e,a);return(0,Q.jsxs)(Is,{open:r,onOpenChange:e=>{i(e),e||o(``)},children:[(0,Q.jsx)(Es,{asChild:!0,children:(0,Q.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:G(ul,`border-foreground/60 text-foreground`),children:[(0,Q.jsx)(Kl,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),(0,Q.jsx)(`span`,{className:`max-w-40 truncate`,children:s?.name??t}),dl]})}),(0,Q.jsx)(Ms,{align:`start`,sideOffset:8,className:`w-[300px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Q.jsxs)(Xc,{shouldFilter:!1,children:[(0,Q.jsx)(Hc,{placeholder:`search projects…`,value:a,onValueChange:o}),(0,Q.jsxs)(Yc,{"data-slot":`project-menu`,className:`max-h-[min(18rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[c.length===0?(0,Q.jsx)(Jc,{children:`Nothing matches.`}):null,c.map(e=>(0,Q.jsxs)(qc,{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,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs font-medium`,children:e.name}),e.status===`missing`?(0,Q.jsx)(`span`,{className:`shrink-0 text-meta text-soft-foreground`,children:`folder not found`}):e.branch===void 0?null:(0,Q.jsx)(`span`,{className:`shrink-0 font-mono text-meta text-soft-foreground`,children:e.branch}),e.id===t?(0,Q.jsx)(Wa,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},e.id))]}),(0,Q.jsx)(`p`,{className:`border-t border-border px-3 py-2 text-meta leading-snug text-soft-foreground`,children:`Skills, workflows, settings and the draft re-resolve against the selected project.`})]})})]})}function UC({repo:e}){let t=W(),n=U({mutationFn:e=>xe({baseBranch:e}),onSuccess:e=>{t.invalidateQueries({queryKey:H.repo}),Y(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=>Y(e.message,{tone:`danger`})});return e.info?(0,Q.jsx)(pl,{slot:`base-pill`,ariaLabel:`Base branch`,label:(0,Q.jsxs)(`span`,{className:`text-meta`,children:[`base: `,e.baseBranch??e.info.branch]}),value:e.baseBranch??``,onPick:e=>n.mutate(e===``?null:e),searchPlaceholder:`Search branches…`,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}var WC=[{icon:Wl,label:`Fix a failing test`,task:`Fix a failing or flaky test`},{icon:Co,label:`Summarize recent commits`,task:`Summarize recent commits on this branch`},{icon:ya,label:`Update the README`,task:`Update the README for recent changes`}];function GC({onPick:e}){return(0,Q.jsx)(`div`,{className:`mt-4 flex flex-wrap justify-center gap-2 max-md:justify-start`,children:WC.map(({icon:t,label:n,task:r})=>(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`suggested-chip`,onClick:()=>e(r),className:tb,children:[(0,Q.jsx)(t,{"aria-hidden":`true`,className:`size-3.5`}),n]},n))})}function KC(){return(0,Q.jsx)(`div`,{"data-route":`not-found`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(gl,{icon:(0,Q.jsx)(zl,{}),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,Q.jsx)(J,{asChild:!0,variant:`outline`,children:(0,Q.jsx)(X,{to:`/`,children:`Back to tasks`})})})})}function qC(){return(0,Q.jsx)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(gl,{icon:(0,Q.jsx)(Eo,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading repository…`,subtitle:`Fetching the repo's git state.`})})}function JC(){return(0,Q.jsxs)(`div`,{"data-route":`skills`,className:`flex min-h-full flex-col`,children:[(0,Q.jsxs)(`header`,{className:`sticky top-0 z-10 hidden h-14 shrink-0 items-center gap-3 border-b border-border bg-background px-5 md:flex`,children:[(0,Q.jsx)(`h1`,{className:`text-base font-semibold`,children:`Skills`}),(0,Q.jsx)(`p`,{className:`text-ui text-muted-foreground`,children:`Markdown playbooks agents can follow.`})]}),(0,Q.jsx)(`p`,{"data-slot":`skills-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading skills…`})]})}function YC({projectId:e,registry:t}){let n=t.projects.length?t.projects:[{id:t.bootProject,name:t.bootProject}];return(0,Q.jsx)(`div`,{"data-route":`unknown-project`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(gl,{icon:(0,Q.jsx)(Jl,{}),tone:`neutral`,title:`“${e}” isn’t registered here`,subtitle:`This workspace doesn’t serve a project by that id. The link may come from another machine’s workspace — these are the projects this one can open:`,children:(0,Q.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,Q.jsx)(`li`,{children:(0,Q.jsxs)(Or,{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,Q.jsxs)(`span`,{className:`font-mono text-meta font-normal text-soft-foreground`,children:[`/p/`,e.id]})]})},e.id))})})})}function XC(){return(0,Q.jsx)(`div`,{"data-route":`workflows`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(gl,{icon:(0,Q.jsx)(Eo,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading workflows…`,subtitle:`Fetching the saved workflows and the node catalog.`})})}function ZC(e){return Dc.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 QC=e=>e.length>Dc.length;function $C({rows:e,runner:t,accountFor:n,providerStatus:r,disabled:i=!1,accountDisabled:a=!1,onPick:o}){let s=QC(e);return(0,Q.jsx)(`div`,{role:`radiogroup`,"aria-label":`Default runner`,"data-slot":`agents-runner`,className:G(`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=tn(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,Q.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:G(`rounded-sm px-3 py-1.5 text-left font-mono text-ui font-medium transition-colors disabled:opacity-50`,p?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`),children:[c.label,s?(0,Q.jsx)(`span`,{"data-slot":c.missing?`agents-account-missing`:`agents-account-dir`,"data-runner":c.runner.id,className:`ml-2 font-sans text-meta text-soft-foreground`,children:c.desc}):null]},`${c.runner.id}:${c.account??``}`)})})}function ew({open:e,onOpenChange:t,providers:n,initialProvider:r}){let[i,a]=(0,Z.useState)(null),[o,s]=(0,Z.useState)(null),[c,l]=(0,Z.useState)(r??n[0]??`claude`),[u,d]=(0,Z.useState)(``),[f,p]=(0,Z.useState)(``),[m,h]=(0,Z.useState)(!1),g=Ln(),_=f.trim();return(0,Q.jsx)(ws,{open:e,onOpenChange:t,children:(0,Q.jsxs)(Ss,{"data-slot":`add-account-dialog`,className:`sm:max-w-lg`,children:[(0,Q.jsxs)(Ns,{children:[(0,Q.jsx)(ys,{children:`Add agent account`}),(0,Q.jsx)(xs,{children:`The config folder this account uses. It does not have to exist yet — Connect signs in and the CLI creates it.`})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 text-ui`,children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:`Agent`}),(0,Q.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-ui outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:n.map(e=>(0,Q.jsx)(`option`,{value:e,children:e},e))})]}),(0,Q.jsxs)(`label`,{className:`flex min-w-0 flex-1 items-center gap-2 text-ui`,children:[(0,Q.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`Name`}),(0,Q.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-ui outline-none focus-visible:border-ring`})]})]}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Q.jsxs)(`label`,{className:`flex min-w-0 items-center gap-2 text-ui`,children:[(0,Q.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`Folder`}),(0,Q.jsx)(`input`,{type:`text`,spellCheck:!1,autoComplete:`off`,"aria-label":`Config folder`,"data-slot":`add-account-dir`,value:f,placeholder:c===`codex`?`~/.codex-second`:c===`omp`?`~/.omp/agent-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-label outline-none focus-visible:border-ring`}),(0,Q.jsx)(J,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`add-account-browse`,"aria-expanded":m,onClick:()=>h(e=>!e),children:m?`Hide folders`:`Browse…`})]}),(0,Q.jsxs)(`p`,{className:`text-meta text-soft-foreground`,children:[`A `,(0,Q.jsx)(`code`,{children:`~`}),` is kept as written and expanded when the agent runs.`]})]}),m?(0,Q.jsx)(Tf,{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,Q.jsx)(`p`,{"data-slot":`add-account-error`,className:`min-w-0 break-words text-ui text-danger`,children:g.error instanceof Error?g.error.message:`could not add that folder`}):null,(0,Q.jsxs)(Cs,{className:`min-w-0 sm:items-center sm:justify-end`,children:[(0,Q.jsx)(J,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,Q.jsx)(J,{"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),Y(`Account added — use Connect to sign in`)}})},children:g.isPending?`Adding…`:`Add account`})]})]})})}var tw={claude:`Claude Code`,codex:`Codex`,junie:`Junie`,opencode:`OpenCode`,cursor:`Cursor`,pi:`pi`,copilot:`GitHub Copilot CLI`,omp:`OMP`,antigravity:`Antigravity`,gemini:`Gemini CLI`,kimi:`Kimi Code`},nw={claude:`curl -fsSL https://claude.ai/install.sh | bash`,codex:`npm i -g @openai/codex`,junie:`https://www.jetbrains.com/junie/`,opencode:`https://opencode.ai`,cursor:`curl https://cursor.com/install -fsS | bash`,pi:`https://github.com/badlogic/pi-mono`,copilot:`npm i -g @github/copilot`,omp:`brew install can1357/tap/omp`,antigravity:`https://antigravity.google/docs/cli/`,gemini:`npm i -g @google/gemini-cli`,kimi:`https://moonshotai.github.io/kimi-code/`},rw={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 iw(){let e=vt();return e.isPending?(0,Q.jsx)(`p`,{"data-slot":`accounts-loading`,className:`p-4 text-ui text-soft-foreground md:p-6`,children:`Loading agent accounts…`}):e.isError?(0,Q.jsx)(gl,{icon:(0,Q.jsx)(Ql,{}),tone:`danger`,title:`Agent accounts did not load`,subtitle:e.error.message,heading:`h2`}):(0,Q.jsx)(aw,{data:e.data})}function aw({data:e}){let t=T(),[n,r]=(0,Z.useState)(null),[i,a]=(0,Z.useState)(null),o=An(),s=et,[c]=kr(),l=c.get(`agent`),u=s.find(e=>e===l)??`claude`;return e.editable?(0,Q.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,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Agent accounts`}),(0,Q.jsx)(`p`,{className:`text-ui text-muted-foreground`,children:`One agent per tab: whether it is installed, and which logins you have. Add a second config folder to keep a work account beside a personal one; each project picks which it uses in its own Agents settings.`})]}),(0,Q.jsx)(sw,{profiles:e}),(0,Q.jsxs)(Ks,{defaultValue:u,children:[(0,Q.jsx)(Gs,{variant:`line`,"data-slot":`accounts-tabs`,children:s.map(e=>(0,Q.jsx)(Us,{value:e,"data-provider":e,children:tw[e]},e))}),s.map(n=>(0,Q.jsx)(Ws,{value:n,className:`pt-4`,children:(0,Q.jsx)(ow,{provider:n,check:t.data?.checks?.find(e=>e.name===n),accounts:e.profiles.filter(e=>e.provider===n),canCarryAccounts:e.profileCapableProviders.includes(n),onAdd:()=>r(n),onRemove:a})},n))]},u),n===null?null:(0,Q.jsx)(ew,{open:!0,onOpenChange:e=>!e&&r(null),providers:e.profileCapableProviders,initialProvider:n},n),(0,Q.jsx)(vs,{open:i!==null,onOpenChange:e=>!e&&a(null),children:(0,Q.jsxs)(ps,{"data-slot":`accounts-remove-confirm`,children:[(0,Q.jsxs)(_s,{children:[(0,Q.jsxs)(fs,{children:[`Remove “`,i?.label,`”?`]}),(0,Q.jsxs)(ds,{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,Q.jsxs)(hs,{children:[(0,Q.jsx)(gs,{children:`Cancel`}),(0,Q.jsx)(ms,{"data-action":`accounts-remove-confirm`,disabled:o.isPending,onClick:()=>{let e=i;e&&o.mutate(e.id,{onSuccess:()=>{a(null),Y(`Removed ${e.label}`)},onError:e=>Y(e.message,{tone:`danger`})})},children:`Remove`})]})]})})]}):(0,Q.jsxs)(`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,Q.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Agent accounts`}),(0,Q.jsx)(`p`,{"data-slot":`accounts-hosted`,className:`text-ui text-soft-foreground`,children:`Agent accounts are disabled for remote access. On a trusted, authenticated self-hosted deployment, set CEZ_REMOTE_AGENT_ACCOUNTS=1 and restart cezar.`})]})}function ow({provider:e,check:t,accounts:n,canCarryAccounts:r,onAdd:i,onRemove:a}){let o=t?.available===!0;return(0,Q.jsxs)(`div`,{"data-slot":`accounts-provider`,"data-provider":e,className:`flex flex-col gap-4`,children:[(0,Q.jsxs)(`dl`,{className:`divide-y divide-border/60 overflow-hidden rounded-md border border-border bg-card text-ui`,children:[(0,Q.jsx)(cw,{label:`Installed`,children:t===void 0?(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:`Checking…`}):o?(0,Q.jsx)(`span`,{"data-slot":`agent-installed`,children:`Yes`}):(0,Q.jsxs)(`span`,{"data-slot":`agent-installed`,className:`text-muted-foreground`,children:[`No — `,(0,Q.jsx)(`code`,{className:`text-label`,children:nw[e]})]})}),o&&t?.version?(0,Q.jsx)(cw,{label:`Version`,children:(0,Q.jsx)(`span`,{"data-slot":`agent-version`,className:`font-mono text-label`,children:t.version})}):null,(0,Q.jsx)(cw,{label:`Accounts`,children:(0,Q.jsx)(`span`,{children:n.length===1?`the discovered one`:`${n.length} (1 discovered, ${n.length-1} added)`})})]}),(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsx)(`h3`,{className:`text-ui font-semibold text-foreground`,children:`Logins`}),r?(0,Q.jsx)(J,{type:`button`,variant:`outline`,size:`sm`,"data-action":`accounts-add`,"data-provider":e,onClick:i,children:`Add account`}):null]}),(0,Q.jsx)(`ul`,{className:`divide-y divide-border/60 rounded-md border border-border bg-card`,children:n.map(e=>(0,Q.jsx)(lw,{account:e,onRemove:()=>a(e)},e.id))}),r?null:(0,Q.jsxs)(`p`,{"data-slot":`accounts-single-only`,className:`text-meta text-soft-foreground`,children:[tw[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 sw({profiles:e}){let t=W(),n=qt(),r=Dt(),i=ye(),a=He(),o=U({mutationFn:e=>yn(e),onSuccess:e=>t.setQueryData(V.config,e),onError:e=>Y(e.message,{tone:`danger`})});if(n.data===void 0)return null;let s=ZC(e.profiles),c=n.data.agentDefaults.runner??`claude`,l=n.data.agentDefaults.models??{};return(0,Q.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,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h3`,{className:`text-ui font-semibold text-foreground`,children:`Defaults for new projects`}),(0,Q.jsx)(`p`,{className:`text-ui 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,Q.jsx)($C,{rows:s,runner:c,accountFor:t=>e.defaults[t]??null,providerStatus:r,disabled:o.isPending,accountDisabled:a.isPending,onPick:(e,t,n)=>{e!==c&&o.mutate({agentDefaults:{runner:e}}),n&&a.mutate({projectId:null,provider:e,profileId:t},{onError:e=>Y(e.message,{tone:`danger`})})}}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Default model per agent`}),Dc.map(e=>(0,Q.jsxs)(`label`,{className:`flex items-center gap-3`,children:[(0,Q.jsx)(`span`,{className:`w-24 shrink-0 font-mono text-xs text-muted-foreground`,children:e.label}),(0,Q.jsxs)(`select`,{"aria-label":`Default model for ${e.label}`,"data-slot":`accounts-default-model`,"data-runner":e.id,value:l[e.id]??``,disabled:o.isPending,onChange:t=>o.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:[pc(e.id,i[e.id].data,[l[e.id]]).map(e=>(0,Q.jsx)(`option`,{value:e.id,children:e.id===``?`auto (default)`:e.label},e.id)),Sc(e.id,i[e.id].data,i[e.id].isError)?(0,Q.jsx)(`option`,{disabled:!0,children:Sc(e.id,i[e.id].data,i[e.id].isError)}):null]})]},e.id))]})]})}function cw({label:e,children:t}){return(0,Q.jsxs)(`div`,{className:`flex items-baseline gap-3 px-3.5 py-2.5`,children:[(0,Q.jsx)(`dt`,{className:`w-28 shrink-0 text-muted-foreground`,children:e}),(0,Q.jsx)(`dd`,{className:`min-w-0 flex-1`,children:t})]})}function lw({account:e,onRemove:t}){let[n,r]=(0,Z.useState)(!1),i=er(e),a=Wn(),o=xn(),s=Sn(i,e.status===void 0),c=e.status??s.data?.status,l=c?rw[c.status]:void 0;return(0,Q.jsxs)(`li`,{"data-slot":`account-row`,"data-account":e.id,className:`flex flex-col gap-2 px-3.5 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-ui font-medium text-foreground`,children:e.label}),e.isDefault?(0,Q.jsx)(yf,{variant:`ghost`,className:`shrink-0 text-micro text-muted-foreground`,children:`discovered`}):null]}),(0,Q.jsx)(`p`,{"data-slot":`account-path`,className:`mt-0.5 truncate font-mono text-meta text-soft-foreground`,title:e.path,children:e.configDir}),(0,Q.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-2 text-xs text-muted-foreground`,children:[(0,Q.jsx)(Nc,{tone:l?.tone??`neutral`,pulse:l===void 0}),(0,Q.jsx)(`span`,{"data-slot":`account-status`,children:l?.label??`Checking…`}),e.exists?e.looksValid?null:(0,Q.jsxs)(`span`,{"data-slot":`account-unrecognised`,children:[`— this folder does not look like `,tw[e.provider],` config yet`]}):(0,Q.jsx)(`span`,{"data-slot":`account-missing`,children:`— folder not created yet; Connect will make it`})]}),c?.status===`not-installed`&&c.hint?(0,Q.jsx)(`p`,{"data-slot":`account-install-hint`,className:`mt-1 text-xs text-soft-foreground`,children:c.hint}):null]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[c?.status!==`connected`&&c?.status!==`not-installed`?(0,Q.jsx)(J,{type:`button`,size:`sm`,"data-action":`account-connect`,disabled:a.isPending,onClick:()=>a.mutate({provider:e.provider,...e.isDefault?{}:{profileId:e.id}},{onSuccess:e=>Y(e.opened?`Finish signing in in the terminal, then Check again.`:`This account is already connected.`),onError:e=>e instanceof pn&&e.command?Y(`${e.message} — run: ${e.command}`,{tone:`danger`,expected:!0}):Y(e.message,{tone:`danger`})}),children:`Connect`}):null,(0,Q.jsx)(J,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`account-recheck`,disabled:o.isPending,title:`Re-probe this account's login now, instead of waiting for the cached answer`,onClick:()=>o.mutate(i,{onError:e=>Y(e.message,{tone:`danger`})}),children:`Check again`}),(0,Q.jsx)(J,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`account-details-toggle`,"aria-expanded":n,onClick:()=>r(e=>!e),children:n?`Hide details`:`Show details`})]})]}),n?(0,Q.jsx)(uw,{account:e,routeId:i,onRemove:t}):null]})}function uw({account:e,routeId:t,onRemove:n}){let r=T(),i=an(t,!0),a=Ue(),o=k(),[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(e.label),d=lt(),f=r.data?r.data.capabilities?.localHandoff??!0:!1,p=o.data?.targets??[],m=p.filter(e=>Na(e.id)===void 0&&e.id!==`terminal`&&e.id!==`finder`).map(e=>({target:e})),h=p.filter(e=>Na(e.id)===void 0).map(e=>({target:e})),g=(e,n,r)=>a.mutate({routeId:t,file:e,...r?{target:r}:{}},{onError:e=>Y(e.message,{tone:`danger`}),onSuccess:()=>Y(`Opened ${n}`)});return(0,Q.jsxs)(`div`,{"data-slot":`account-details`,className:`rounded-md border border-border/60 bg-muted/30 p-3`,children:[i.isPending?(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Reading account details…`}):i.isError?(0,Q.jsx)(`p`,{"data-slot":`account-details-error`,className:`text-xs text-danger`,children:i.error.message}):i.data.available?(0,Q.jsx)(`dl`,{"data-slot":`account-identity`,className:`grid grid-cols-[7rem_minmax(0,1fr)] gap-x-3 gap-y-1 text-xs`,children:i.data.fields.map(e=>(0,Q.jsxs)(Z.Fragment,{children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:e.label}),(0,Q.jsx)(`dd`,{className:`min-w-0 truncate text-foreground`,title:e.value,children:e.value})]},e.label))}):(0,Q.jsx)(`p`,{"data-slot":`account-identity-unavailable`,className:`text-xs text-muted-foreground`,children:i.data.reason??`No account details to show.`}),f?(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5 border-t border-border/60 pt-2.5`,children:[(0,Q.jsx)(`span`,{className:`mr-1 text-xs text-muted-foreground`,children:`Config files`}),e.files.map(e=>(0,Q.jsx)(Ia,{slot:`account-open-file`,label:e.label,triggerVariant:`outline`,disabled:a.isPending,title:e.exists?e.path:`${e.path} — not created yet`,choices:m,onPick:t=>g(e.id,e.label,t),leading:(0,Q.jsxs)(ao,{"data-target":`system`,onSelect:()=>g(e.id,e.label),children:[(0,Q.jsx)(ho,{"aria-hidden":`true`}),`System default`]})},e.id)),(0,Q.jsx)(Ia,{slot:`account-open-folder`,label:`Folder`,disabled:a.isPending,title:e.path,choices:h,onPick:e=>g(`folder`,`folder`,e),leading:(0,Q.jsxs)(ao,{"data-target":`system`,onSelect:()=>g(`folder`,`folder`),children:[(0,Q.jsx)(ho,{"aria-hidden":`true`}),`System default`]})})]}):null,e.isDefault?null:(0,Q.jsxs)(`div`,{"data-slot":`account-manage`,className:`mt-3 flex flex-wrap items-center gap-2 border-t border-border/60 pt-2.5`,children:[(0,Q.jsx)(`span`,{className:`mr-1 text-xs text-muted-foreground`,children:`Account`}),s?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`input`,{type:`text`,autoFocus:!0,"aria-label":`Name for ${e.label}`,"data-slot":`account-rename-input`,value:l,onChange:e=>u(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,Q.jsx)(J,{type:`button`,size:`sm`,"data-action":`account-rename-save`,disabled:d.isPending||l.trim()===``||l.trim()===e.label,onClick:()=>d.mutate({id:e.id,label:l.trim()},{onSuccess:()=>c(!1),onError:e=>Y(e.message,{tone:`danger`})}),children:`Save`}),(0,Q.jsx)(J,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>{u(e.label),c(!1)},children:`Cancel`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(J,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-rename`,onClick:()=>c(!0),children:`Rename`}),(0,Q.jsx)(J,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-remove`,onClick:n,children:`Remove`}),(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Renaming changes what cezar calls this account, not its folder.`})]})]})]})}var dw=1500;function fw(e,t){let n=(0,Z.useMemo)(()=>e.split(`
|
|
7
|
+
`).map(e=>[{content:e}]),[e]),r=(0,Z.useMemo)(()=>bl(t),[t]),i=n.length>dw,[a,o]=(0,Z.useState)(null);return(0,Z.useEffect)(()=>{if(r===null||i)return;let t=!1;return vl(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:yl(e,r)?.tokens??n}var pw=`m-0 min-h-full w-full whitespace-pre font-mono text-xs leading-[1.7] px-3 py-2 [tab-size:2]`;function mw({value:e,onChange:t,language:n,readOnly:r,className:i,...a}){let o=fw(e,n),s=(0,Z.useRef)(null),c=(0,Z.useRef)(null),l=()=>{let e=c.current,t=s.current;!e||!t||(t.scrollTop=e.scrollTop,t.scrollLeft=e.scrollLeft)};return(0,Z.useLayoutEffect)(l,[e]),(0,Q.jsxs)(`div`,{"data-slot":`code-editor`,className:G(`relative overflow-hidden rounded-md border border-input bg-card`,i),children:[(0,Q.jsx)(`pre`,{ref:s,"aria-hidden":`true`,className:G(pw,`pointer-events-none absolute inset-0 overflow-auto text-soft-foreground`),children:o.map((e,t)=>(0,Q.jsx)(`span`,{className:`block`,children:e.length===0?`
|
|
8
|
+
`:(0,Q.jsxs)(Q.Fragment,{children:[e.map((e,t)=>(0,Q.jsx)(`span`,{style:e.color===void 0?void 0:{color:e.color},children:e.content},t)),`
|
|
9
|
+
`]})},t))}),(0,Q.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:G(pw,`relative block resize-none overflow-auto bg-transparent text-transparent caret-foreground outline-none`,`selection:bg-primary/30 focus-visible:ring-0`,r&&`cursor-default`),...a})]})}function hw(e){if(e.trim()===``)return null;try{JSON.parse(e)}catch{return null}let t=_w(e),n=e.includes(`\r
|
|
10
|
+
`)?`\r
|
|
11
|
+
`:`
|
|
12
|
+
`,r=``,i=0,a=()=>n+t.repeat(i);for(let t=0;t<e.length;t++){let n=e[t];if(n===`"`){let n=t+1;for(;e[n]!==`"`;)n+=e[n]===`\\`?2:1;r+=e.slice(t,n+1),t=n}else if(n===`{`||n===`[`){let o=n===`{`?`}`:`]`,s=gw(e,t+1);e[s]===o?(r+=n+o,t=s):(i++,r+=n+a())}else n===`}`||n===`]`?(i--,r+=a()+n):n===`,`?r+=`,`+a():n===`:`?r+=`: `:/\s/.test(n)||(r+=n)}return r+(e.endsWith(`
|
|
13
|
+
`)?n:``)}function gw(e,t){let n=t;for(;n<e.length&&/\s/.test(e[n]);)n++;return n}function _w(e){let t=[...e.matchAll(/\n([ \t]+)\S/g)].map(e=>e[1]);return t.length===0?` `:t[0].startsWith(` `)?` `:` `.repeat(Math.min(Math.min(...t.map(e=>e.length)),8))}var vw=`An editor-plus-commit: a saved change reaches a run after you commit it to the base branch.`;function yw(e){return t=>t.runners.includes(e)}function bw(e,t,n,r){let i=yw(e);return{id:t,label:n,note:r,files:t===`mcp`?e=>i(e)&&(e.holdsMcp===!0||e.kind===`mcp`):e=>i(e)&&e.kind===t}}var xw=[{id:`claude`,label:`Claude`,groups:[bw(`claude`,`settings`,`Settings`),bw(`claude`,`mcp`,`MCP`,`A dedicated .mcp.json (key: mcpServers), shared via version control.`),bw(`claude`,`memory`,`Memory & instructions`)]},{id:`codex`,label:`Codex`,note:vw,groups:[bw(`codex`,`settings`,`Settings`),bw(`codex`,`mcp`,`MCP`,`Inside config.toml under [mcp_servers.<id>] — the same file as Codex’s settings.`),bw(`codex`,`memory`,`Memory & instructions`)]},{id:`copilot`,label:`GitHub Copilot`,note:vw,groups:[bw(`copilot`,`settings`,`Settings`),bw(`copilot`,`mcp`,`MCP`,`A dedicated ~/.copilot/mcp-config.json. Per-run --additional-mcp-config augments it rather than replacing it.`),bw(`copilot`,`memory`,`Memory & instructions`)]},{id:`antigravity`,label:`Antigravity`,note:vw,groups:[bw(`antigravity`,`settings`,`Settings`),bw(`antigravity`,`mcp`,`MCP`,"The shared ~/.gemini/config/mcp_config.json — `agy mcp add|remove` edits the same file."),bw(`antigravity`,`memory`,`Memory & instructions`)]},{id:`opencode`,label:`OpenCode`,note:vw,groups:[bw(`opencode`,`settings`,`Settings`),bw(`opencode`,`mcp`,`MCP`,`Under the "mcp" key in opencode.json — the same file as OpenCode’s settings.`),bw(`opencode`,`memory`,`Memory & instructions`)]},{id:`cursor`,label:`Cursor`,note:"Cursor Agent CLI (`agent`). Auth via `agent login` or CURSOR_API_KEY. No separate memory file — instructions live in rules/MCP elsewhere.",groups:[bw(`cursor`,`settings`,`Settings`),bw(`cursor`,`mcp`,`MCP`,`User ~/.cursor/mcp.json and project .cursor/mcp.json.`)]},{id:`omp`,label:`OMP`,note:vw,groups:[bw(`omp`,`settings`,`Settings`),bw(`omp`,`mcp`,`MCP`,`A dedicated mcp.json (key: mcpServers) — project .omp/mcp.json, user ~/.omp/agent/mcp.json.`),bw(`omp`,`memory`,`Memory & instructions`)]},{id:`pi`,label:`Pi`,groups:[bw(`pi`,`settings`,`Settings`),bw(`pi`,`memory`,`Memory & instructions`)]},{id:`gemini`,label:`Gemini CLI`,note:vw,groups:[bw(`gemini`,`settings`,`Settings`),bw(`gemini`,`mcp`,`MCP`,`Under the "mcpServers" key in settings.json — the same file as Gemini CLI’s settings.`),bw(`gemini`,`memory`,`Memory & instructions`)]},{id:`kimi`,label:`Kimi`,note:vw,groups:[bw(`kimi`,`settings`,`Settings`),bw(`kimi`,`memory`,`Memory & instructions`)]}];function Sw(e){let t=xw.find(t=>t.id===e);if(!t)throw Error(`no agent descriptor for ${e}`);return t}var Cw=`{
|
|
14
|
+
"mcpServers": {
|
|
15
|
+
"example-stdio": {
|
|
16
|
+
"command": "/absolute/path/to/your-mcp-server",
|
|
17
|
+
"args": [],
|
|
18
|
+
"env": { "API_TOKEN": "your-personal-token" }
|
|
19
|
+
},
|
|
20
|
+
"example-http": {
|
|
21
|
+
"type": "http",
|
|
22
|
+
"url": "https://mcp.example.com/mcp",
|
|
23
|
+
"headers": { "Authorization": "Bearer your-personal-token" }
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
`;function ww(e){return e.private?`Private to this project — added to every run at launch, takes effect on the next session. Never committed.`: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 Tw(){let e=pt(),t=T(),n=(0,Z.useMemo)(()=>t.data?xc(t.data.checks):xw.map(e=>e.id),[t.data]);return e.isPending?(0,Q.jsx)(`p`,{"data-slot":`agent-config-loading`,className:`p-4 text-ui text-soft-foreground md:p-6`,children:`Loading agent config…`}):e.isError?(0,Q.jsx)(gl,{icon:(0,Q.jsx)(Ul,{}),tone:`danger`,title:`Agent config did not load`,subtitle:e.error.message,heading:`h2`}):(0,Q.jsx)(Ew,{listing:e.data,installed:n})}function Ew({listing:e,installed:t}){let[n,r]=(0,Z.useState)(`claude`),[i,a]=(0,Z.useState)(null),o=Sw(n),s=e.files.find(e=>e.id===i)??null,c=e=>{r(e),a(null)};return(0,Q.jsxs)(`div`,{"data-slot":`agent-config`,className:`flex flex-col gap-4 p-4 md:p-6`,children:[!e.editable&&(0,Q.jsx)(`div`,{"data-slot":`agent-config-readonly`,className:`rounded-md border border-border bg-muted/40 px-3 py-2 text-ui 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,Q.jsx)(`div`,{"data-slot":`agent-config-agents`,role:`tablist`,className:`flex flex-wrap gap-1 rounded-md bg-muted/40 p-1`,children:xw.map(e=>(0,Q.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:G(`flex items-center gap-2 rounded-md px-3 py-1.5 text-ui transition-colors`,e.id===o.id?`bg-background font-semibold shadow-sm`:`hover:bg-muted/60`),children:[e.label,!t.includes(e.id)&&(0,Q.jsx)(yf,{variant:`outline`,className:`text-micro text-soft-foreground`,children:`not installed`})]},e.id))}),o.note&&(0,Q.jsx)(`p`,{"data-slot":`agent-config-agent-note`,className:`text-label text-soft-foreground`,children:o.note}),(0,Q.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-[minmax(0,20rem)_minmax(0,1fr)]`,children:[(0,Q.jsx)(`nav`,{"data-slot":`agent-config-nav`,className:`flex flex-col gap-5`,children:(0,Q.jsx)(Dw,{agent:o,listing:e,selectedId:i,onSelect:a})}),(0,Q.jsx)(`div`,{"data-slot":`agent-config-editor-pane`,children:s?(0,Q.jsx)(kw,{file:s},s.id):(0,Q.jsx)(`div`,{className:`flex h-full min-h-40 items-center justify-center rounded-md border border-dashed border-border text-ui text-soft-foreground`,children:`Select a config file to view or edit it.`})})]})]})}function Dw({agent:e,listing:t,selectedId:n,onSelect:r}){return(0,Q.jsx)(Q.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)?null:(0,Q.jsxs)(`section`,{"data-slot":`agent-config-group`,"data-group":i.id,"data-agent":e.id,children:[(0,Q.jsx)(`p`,{className:`mb-1 eyebrow text-soft-foreground`,children:i.label}),i.note&&(0,Q.jsx)(`p`,{className:`mb-2 text-label text-soft-foreground`,children:i.note}),(0,Q.jsx)(`ul`,{className:`flex flex-col gap-1`,children:a.map(e=>(0,Q.jsx)(`li`,{children:(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`agent-config-file`,"data-selected":e.id===n,onClick:()=>r(e.id),className:G(`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-ui transition-colors`,e.id===n?`bg-primary/15 text-foreground`:`hover:bg-muted/60`),children:[(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-label`,children:e.label}),e.seeded&&(0,Q.jsx)(yf,{variant:`outline`,className:`shrink-0 text-micro`,children:`seeded`}),e.private&&(0,Q.jsx)(yf,{variant:`outline`,className:`shrink-0 text-micro`,children:`private`}),!e.exists&&(0,Q.jsx)(`span`,{className:`shrink-0 text-meta text-soft-foreground`,children:`absent`})]})},e.id))}),o&&t.userMcp&&(0,Q.jsx)(Ow,{userMcp:t.userMcp})]},i.id)})})}function Ow({userMcp:e}){return(0,Q.jsxs)(`div`,{"data-slot":`agent-config-user-mcp`,className:`mt-3`,children:[(0,Q.jsx)(`h4`,{className:`mb-1 text-label font-semibold`,children:`User & local scopes`}),(0,Q.jsxs)(`p`,{className:`mb-2 text-label text-soft-foreground`,children:[`Managed by `,(0,Q.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,Q.jsx)(`ul`,{className:`flex flex-wrap gap-1`,children:e.servers.map(e=>(0,Q.jsx)(`li`,{children:(0,Q.jsx)(yf,{variant:`outline`,className:`font-mono text-meta`,children:e})},e))}):(0,Q.jsx)(`p`,{className:`text-label text-soft-foreground`,children:`No user-scoped MCP servers.`}):(0,Q.jsx)(`p`,{className:`text-label text-soft-foreground`,children:`Could not read the file.`})]})}function kw({file:e}){let t=Kt(e.id),n=rn(e.id),[r,i]=(0,Z.useState)(null),[a,o]=(0,Z.useState)(!1),[s,c]=(0,Z.useState)(null),l=t.data?.version??null;(0,Z.useEffect)(()=>{t.data&&(i(e.private&&!t.data.exists?Cw: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,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`font-mono text-ui`,children:e.label}),(0,Q.jsx)(yf,{variant:`outline`,className:`text-micro uppercase`,children:e.format}),(0,Q.jsx)(`a`,{href:e.docsUrl,target:`_blank`,rel:`noreferrer`,className:`text-label text-soft-foreground underline hover:text-foreground`,children:`docs`})]}),(0,Q.jsx)(`p`,{"data-slot":`agent-config-precedence`,className:`text-label text-soft-foreground`,children:e.precedence}),(0,Q.jsxs)(`p`,{"data-slot":`agent-config-effect`,className:`text-label text-foreground/80`,children:[ww(e),e.hotReload?` ${e.hotReload}`:``]}),t.isPending?(0,Q.jsx)(`p`,{className:`text-ui text-soft-foreground`,children:`Loading file…`}):t.isError?(0,Q.jsx)(`p`,{className:`text-ui text-destructive`,children:t.error.message}):(0,Q.jsx)(mw,{value:u,language:e.format,readOnly:!f,onChange:e=>{i(e),c(null)},"aria-label":`${e.label} contents`,className:`h-[26rem]`}),s&&(0,Q.jsx)(`p`,{"data-slot":`agent-config-format-error`,className:`text-label text-destructive`,children:s}),a&&(0,Q.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-label`,children:[(0,Q.jsx)(`span`,{children:`The file changed on disk since you opened it.`}),(0,Q.jsx)(J,{size:`sm`,variant:`outline`,onClick:()=>void t.refetch(),children:`Reload from disk`})]}),f&&(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(J,{size:`sm`,onClick:()=>{c(null),o(!1);let t=e.format===`json`?hw(u)??u:u;n.mutate({content:t,version:l},{onSuccess:()=>{i(null),Y(`${e.exists?`Saved`:`Created`} ${e.label}`)},onError:e=>{e instanceof pn&&e.status===409?o(!0):e instanceof pn&&e.status===400?c(e.message):Y(e.message,{tone:`danger`})}})},disabled:!d||n.isPending,children:e.exists?`Save`:`Create`}),(0,Q.jsx)(J,{size:`sm`,variant:`ghost`,onClick:()=>{i(null),c(null)},disabled:!d||n.isPending,children:`Revert`}),d&&(0,Q.jsx)(`span`,{className:`text-label text-soft-foreground`,children:`Unsaved changes`})]})]})}var Aw=[{id:`claude`,label:`Claude Code`,login:`claude auth login`},{id:`codex`,label:`Codex`,login:`codex login`},{id:`junie`,label:`Junie`,login:`junie login`},{id:`opencode`,label:`OpenCode`,login:`opencode auth login`},{id:`cursor`,label:`Cursor`,login:`agent login`},{id:`pi`,label:`pi`,login:`pi /login`},{id:`copilot`,label:`GitHub Copilot CLI`,login:`copilot login`},{id:`omp`,label:`OMP`,login:`omp`},{id:`antigravity`,label:`Antigravity`,login:`agy`},{id:`gemini`,label:`Gemini CLI`,login:`gemini`},{id:`kimi`,label:`Kimi Code`,login:`kimi login`}],jw=e=>({claude:e,codex:e,junie:e,opencode:e,cursor:e,pi:e,copilot:e,omp:e,antigravity:e,gemini:e,kimi:e}),Mw={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 Nw(e,t,n){return{providers:e.providers.map(e=>e.provider===t?{...e,enabled:n}:e)}}function Pw(){let e=Dt(),t=ln(),n=Un(),r=W(),[i,a]=(0,Z.useState)(null),o=(0,Z.useRef)(Promise.resolve()),s=(0,Z.useRef)(jw(0)),c=(0,Z.useRef)(jw(0)),l=(0,Z.useRef)(e.data);(0,Z.useEffect)(()=>{i&&tn(e.data,i.provider)?.status===`connected`&&a(null)},[i,e.data]),(0,Z.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?tn(l.current,e.provider)?.enabled??e.enabled:e.enabled}))}}},[e.data]);let f=(0,Z.useCallback)((e,t)=>{let n=V.providerStatus,i=r.getQueryData(n);if(!i)return;l.current||=i;let a=Nw(i,e,t);c.current[e]+=1,r.setQueryData(n,a);let d=++s.current[e];o.current=o.current.then(async()=>{try{let i=await u(e,t),a=tn(i,e)?.enabled;if(a===void 0)return;if(l.current=Nw(l.current??i,e,a),d===s.current[e]){let t=r.getQueryData(n);r.setQueryData(n,t?Nw(t,e,a):i)}}catch(t){if(d===s.current[e]){let i=tn(l.current,e)?.enabled,a=r.getQueryData(n);a&&i!==void 0?r.setQueryData(n,Nw(a,e,i)):l.current?r.setQueryData(n,l.current):r.removeQueries({queryKey:n,exact:!0}),Y(t instanceof Error?t.message:String(t),{tone:`danger`})}}finally{--c.current[e]}})},[r]),p=U({mutationFn:e=>d(e),onSuccess:async e=>{a(null),Y(e.opened?`Finish signing in in the terminal, then check again.`:`Provider is already connected.`),await r.invalidateQueries({queryKey:V.providerStatus})},onError:(e,t)=>{if(e instanceof pn&&e.command){let n=Aw.find(e=>e.id===t)?.label??t;a({provider:t,label:n,message:e.message,command:e.command});return}Y(e.message,{tone:`danger`})}}),m=async e=>{try{await ml(e),Y(`Command copied`)}catch{Y(`Could not copy the command`,{tone:`danger`})}};return(0,Q.jsxs)(`section`,{id:`providers`,"data-slot":`provider-settings`,className:`scroll-mt-20`,children:[(0,Q.jsxs)(`div`,{className:`mb-2`,children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Providers`}),(0,Q.jsx)(`p`,{className:`text-ui text-muted-foreground`,children:`Connect the coding agents available on this computer.`})]}),e.isError?(0,Q.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,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-ui font-medium text-foreground`,children:`Provider status could not be loaded`}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.error.message})]}),(0,Q.jsx)(J,{type:`button`,variant:`outline`,size:`sm`,disabled:e.isFetching,onClick:()=>void e.refetch(),children:`Retry`})]}):null,(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:Aw.map(r=>{let a=tn(e.data,r.id),o=a?.status,s=o?Mw[o]:e.isPending?{label:`Checking…`,tone:`neutral`}:Mw.unknown,c=p.isPending&&p.variables===r.id,l=o===`disconnected`||o===`unknown`,u=a?.authFailureId;return(0,Q.jsxs)(Z.Fragment,{children:[(0,Q.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,Q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h3`,{className:`text-ui font-semibold text-foreground`,children:r.label}),(0,Q.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,Q.jsx)(Nc,{tone:s.tone,pulse:e.isPending}),(0,Q.jsx)(`span`,{children:s.label}),a?.enabled===!1?(0,Q.jsx)(`span`,{children:`Disabled`}):null]}),o===`not-installed`?(0,Q.jsxs)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:[`Install `,r.label,`, then run `,(0,Q.jsx)(`code`,{children:r.login}),`.`]}):o===`unknown`||e.isError&&!o?(0,Q.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:a?.hint??`Verification failed. Check again when the provider is available.`}):a?.hint?(0,Q.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:a.hint}):null]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[o===`not-installed`?null:(0,Q.jsx)(jf,{checked:a?.enabled??!0,"aria-label":`Use ${r.label}`,onCheckedChange:e=>f(r.id,e)}),l?(0,Q.jsx)(J,{type:`button`,variant:`ghost`,size:`sm`,disabled:t.isPending,onClick:()=>t.mutate(void 0,{onError:e=>Y(e.message,{tone:`danger`})}),children:`Check again`}):null,o===`disconnected`?(0,Q.jsx)(J,{type:`button`,variant:`outline`,size:`sm`,disabled:p.isPending,onClick:()=>p.mutate(r.id),children:c?`Opening…`:`Connect`}):null,u===void 0?null:(0,Q.jsx)(J,{type:`button`,variant:`outline`,size:`sm`,disabled:n.isPending,onClick:()=>n.mutate({provider:r.id,authFailureId:u},{onSuccess:()=>Y(`${r.label} can be tried again.`),onError:e=>Y(e.message,{tone:`danger`})}),children:`Try again`})]})]}),u===void 0?null:(0,Q.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,Q.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,Q.jsx)(`p`,{className:`text-ui text-foreground`,children:i.message}),(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,Q.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,Q.jsx)(J,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void m(i.command),children:`Copy command`})]})]}):null]},r.id)})})]})}function Fw(){let e=W();return U({mutationFn:e=>xe(e),onSuccess:t=>{e.setQueryData(H.config,t),e.invalidateQueries({queryKey:H.health}),e.invalidateQueries({queryKey:H.repo})},onError:e=>Y(e.message,{tone:`danger`})})}function Iw(){let e=jn(),t=ye(),n=Dt();return e.isPending?(0,Q.jsx)(`p`,{"data-slot":`agents-loading`,className:`p-4 text-ui text-soft-foreground md:p-6`,children:`Loading agent settings…`}):e.isError?(0,Q.jsx)(gl,{icon:(0,Q.jsx)(ja,{}),tone:`danger`,title:`Agent settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,Q.jsx)(Lw,{config:e.data,catalogs:t,providerStatus:n})}function Lw({config:e,catalogs:t,providerStatus:n}){let r=Fw(),i=ut().projectId??`default`,a=On(i),o=Zn(i),s=vt(),c=mn().data?.info?.root,l=(c?s.data?.selections[c]:void 0)?.[e.defaultRunner]??s.data?.defaults[e.defaultRunner]??`default`;return(0,Q.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,Q.jsx)(Pw,{}),(0,Q.jsx)(Vw,{defaultRunner:e.defaultRunner,providerStatus:n,saving:r.isPending,onPick:e=>r.mutate({defaultRunner:e})}),(0,Q.jsx)(Bw,{policy:a.data,loadError:a.isError?a.error:null,profiles:s.data?.profiles??[],providerStatus:n,catalogs:t,modelsLocked:e.modelsLocked,defaultProfileId:l,defaultRunner:e.defaultRunner,saving:o.isPending,onRetry:()=>void a.refetch(),onSave:(e,t,n)=>{a.data&&o.mutate({expectedRevision:a.data.revision,expectedIncarnation:a.data.incarnation,enabled:e,candidates:t??a.data.candidates},{onSuccess:()=>n?.(),onError:e=>{e instanceof pn&&e.status===409&&a.refetch(),Y(e instanceof pn&&e.status===409&&e.message.includes(`changed`)?`Fallback settings changed elsewhere — reloaded. Try again.`:e instanceof Error?e.message:`Could not save fallback settings`,{tone:`danger`})}})}}),(0,Q.jsx)(Hw,{title:`Default models`,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,Q.jsx)(`div`,{className:`flex max-w-md flex-col gap-2`,children:Dc.map(i=>{let a=tn(n.data,i.id),o=!n.isPending&&!n.isError&&a?.enabled===!0&&a.status===`connected`,s=n.isPending?`Checking provider authentication…`:n.isError?`Provider authentication could not be verified.`:a?.enabled===!1?`This provider is disabled. Enable it above or choose another provider.`:o?void 0:`Connect this provider before selecting it.`,c=t[i.id],l=Sc(i.id,c.data,c.isError),u=pc(i.id,c.data,[e.defaultModels[i.id]]),d=e.defaultModels[i.id]??``,f=u.find(e=>e.id===d)?.label??d??`auto (default)`;return(0,Q.jsxs)(`label`,{className:`flex items-center gap-3`,children:[(0,Q.jsx)(`span`,{className:`w-24 shrink-0 font-mono text-xs text-muted-foreground`,children:i.label}),e.modelsLocked?(0,Q.jsx)(`output`,{"aria-label":`Default model for ${i.label}`,"data-slot":`agents-model`,"data-runner":i.id,title:`Model selection is locked to native coding-agent settings.`,className:`block w-full rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs`,children:f}):(0,Q.jsxs)(`select`,{"aria-label":`Default model for ${i.label}`,"data-slot":`agents-model`,"data-runner":i.id,value:d,title:s??i.desc,disabled:r.isPending||!o,onChange:e=>r.mutate({defaultModels:{[i.id]:e.target.value||null},defaultModelsAuto:{[i.id]:e.target.value===``}}),className:`block w-full 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,Q.jsx)(`option`,{value:e.id,children:e.id===``?`auto (default)`:e.label},e.id)),l?(0,Q.jsx)(`option`,{disabled:!0,children:l}):null]})]},i.id)})})})]})}function Rw({id:e,label:t,disabled:n,children:r}){let{attributes:i,listeners:a,setNodeRef:o,setActivatorNodeRef:s,transform:c,transition:l,isDragging:u}=Ur({id:e,disabled:n});return(0,Q.jsxs)(`li`,{ref:o,"data-slot":`fallback-row`,style:{transform:ti.Transform.toString(c),transition:l},className:`relative flex flex-wrap items-center gap-2 rounded-md border border-border bg-card px-3 py-1.5 text-sm ${u?`z-10 shadow-md`:``}`,children:[(0,Q.jsx)(J,{ref:s,type:`button`,variant:`ghost`,size:`icon-sm`,className:`min-h-11 min-w-11 shrink-0 cursor-grab touch-none active:cursor-grabbing aria-disabled:cursor-default aria-disabled:opacity-50`,...i,...a,"aria-label":t,"aria-disabled":n||void 0,children:(0,Q.jsx)(xa,{"aria-hidden":`true`})}),r]})}var zw=10;function Bw({policy:e,loadError:t,profiles:n,providerStatus:r,catalogs:i,modelsLocked:a,defaultProfileId:o,defaultRunner:s,saving:c,onSave:l,onRetry:u}){let d=qr(Kr(Zr,{activationConstraint:{distance:4}}),Kr(Gr,{coordinateGetter:Xr})),f=(0,Z.useRef)(null),p=`Automatic fallback`,m=`When the agent working on a task runs out of its usage allowance, the next agent below continues the same task.`,h=e=>Dc.find(t=>t.id===e)?.label??e,g=Dc.flatMap(e=>{let t=n.filter(t=>t.provider===e.id);return(t.length>0?t:[{id:`default`,provider:e.id,label:`Default`}]).map(t=>({key:`${e.id}:${t.id}`,provider:e.id,profileId:t.id,label:`${e.label} · ${t.id==="default"?`Default`:t.label||t.id}`}))}),_=e=>`${e.provider}:${e.profileId}`,v=new Set(e?.candidates.map(_)??[]),y=g.filter(e=>!v.has(e.key)),[b,x]=(0,Z.useState)(``),[S,C]=(0,Z.useState)(``),[w,T]=(0,Z.useState)(``),E=y.find(e=>e.key===b)??y[0];if(t){let e=t instanceof pn&&t.status===409&&t.message===`agent fallback is local-only`;return(0,Q.jsxs)(Hw,{title:p,hint:m,children:[(0,Q.jsx)(`p`,{"data-slot":`fallback-unavailable`,className:`max-w-md text-ui text-muted-foreground`,children:e?`Automatic fallback is available on a local cockpit only.`:`Fallback settings did not load — ${t.message}`}),e?null:(0,Q.jsx)(J,{type:`button`,variant:`outline`,size:`sm`,className:`w-fit`,onClick:u,children:`Retry`})]})}if(!e)return(0,Q.jsx)(Hw,{title:p,hint:m,children:(0,Q.jsx)(`p`,{"data-slot":`fallback-loading`,className:`text-ui text-soft-foreground`,children:`Loading fallback settings…`})});let D=e.candidates,O=e=>g.find(t=>t.key===_(e))?.label??`${h(e.provider)} · ${e.profileId}`,k=e=>{if(e.profileId!=="default"&&!n.some(t=>t.id===e.profileId&&t.provider===e.provider))return`Account removed — will be skipped`;if(a&&e.model)return`Model selection is locked — remove and add this agent again to use native settings.`;let t=tn(r.data,e.provider);if(t?.enabled===!1)return`Provider disabled — will be skipped`;if(t&&t.status!==`connected`)return`Not connected — will be skipped`},A=e=>e.provider===s&&e.profileId===o?`This is the default agent — skipped for tasks that start on it`:void 0,j=()=>{if(!E||c)return;let t=E.label;l(e.enabled,[...D,{provider:E.provider,profileId:E.profileId,...!a&&S?{model:S}:{}}],()=>{x(``),C(``),T(`${t} added at position ${D.length+1}`)})},ee=t=>{let n=D[t];if(!n||c)return;let r=D.filter((e,n)=>n!==t);l(e.enabled&&r.length>0,r,()=>T(`${O(n)} removed from fallback`))},M=(t,n)=>{let r=t+n,i=D[t];if(!i||c||r===t||r<0||r>=D.length)return;let a=D.filter((e,n)=>n!==t);a.splice(r,0,i),l(e.enabled,a,()=>T(`${O(i)} moved to position ${r+1}`))},N=E?.provider??s,te=i[N],ne=Sc(N,te?.data,te?.isError??!1),P=D.length>=zw;return(0,Q.jsx)(Hw,{title:p,hint:m,action:(0,Q.jsx)(jf,{"aria-label":`Automatic fallback`,"aria-describedby":`fallback-state fallback-disclosure`,"data-slot":`fallback-enabled`,checked:e.enabled,disabled:c||D.length===0,onCheckedChange:e=>l(e)}),children:(0,Q.jsxs)(`div`,{"data-slot":`fallback-section`,className:`flex max-w-md flex-col gap-3`,children:[(0,Q.jsx)(`p`,{id:`fallback-state`,className:`text-ui text-muted-foreground`,children:e.enabled?`On — agents take over in the order below.`:D.length===0?`Off — add an agent first.`:`Off — the list is saved but not used.`}),(0,Q.jsx)(`p`,{id:`fallback-disclosure`,className:`text-ui text-muted-foreground`,children:`The next agent’s provider receives the task and its repository context, and may bill its own plan.`}),D.length===0?(0,Q.jsx)(`p`,{"data-slot":`fallback-empty`,className:`text-ui text-muted-foreground`,children:`No fallback agents yet. Add the agent that should take over first.`}):(0,Q.jsx)(ri,{sensors:d,collisionDetection:ai,accessibility:{screenReaderInstructions:{draggable:`Press Space to pick up an agent, arrow keys to move, Space to drop, or Escape to cancel.`},announcements:{onDragStart:({active:e})=>{let t=D.find(t=>_(t)===e.id);return t?`Picked up ${O(t)}.`:`Picked up agent.`},onDragOver:({over:e})=>e?`Position ${D.findIndex(t=>_(t)===e.id)+1} of ${D.length}.`:`Outside the list.`,onDragEnd:()=>`Drag ended. Changes are saved after dropping in a new position.`,onDragCancel:()=>`Reordering cancelled. Order unchanged.`}},onDragStart:()=>{f.current=e.revision},onDragCancel:()=>{f.current=null},onDragEnd:({active:t,over:n})=>{let r=f.current;if(f.current=null,!n||c||r!==e.revision)return;let i=D.findIndex(e=>_(e)===t.id),a=D.findIndex(e=>_(e)===n.id);i>=0&&a>=0&&M(i,a-i)},children:(0,Q.jsx)(ii,{items:D.map(_),strategy:ei,children:(0,Q.jsx)(`ol`,{"aria-label":`Fallback order`,"data-slot":`fallback-order`,className:`flex flex-col gap-1.5`,children:D.map((e,t)=>{let n=O(e),r=k(e),i=A(e);return(0,Q.jsxs)(Rw,{id:_(e),label:`Reorder ${n}, position ${t+1} of ${D.length}`,disabled:c||D.length<2,children:[(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:[t+1,`.`]}),` `,n,(0,Q.jsxs)(`span`,{className:`text-muted-foreground`,children:[` · `,e.model??`auto model`]}),r?(0,Q.jsx)(`span`,{className:`block text-xs text-danger`,children:r}):null,i?(0,Q.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:i}):null]}),(0,Q.jsxs)(`span`,{className:`flex gap-1`,children:[(0,Q.jsx)(J,{type:`button`,variant:`ghost`,size:`icon-xs`,className:`aria-disabled:opacity-50 aria-disabled:hover:bg-transparent`,"aria-label":`Move ${n} up`,"aria-disabled":c||t===0||void 0,onClick:()=>M(t,-1),children:(0,Q.jsx)(Aa,{})}),(0,Q.jsx)(J,{type:`button`,variant:`ghost`,size:`icon-xs`,className:`aria-disabled:opacity-50 aria-disabled:hover:bg-transparent`,"aria-label":`Move ${n} down`,"aria-disabled":c||t===D.length-1||void 0,onClick:()=>M(t,1),children:(0,Q.jsx)(pa,{})}),(0,Q.jsx)(J,{type:`button`,variant:`danger-ghost`,size:`icon-xs`,className:`aria-disabled:opacity-50 aria-disabled:hover:bg-transparent`,"aria-label":`Remove ${n} from fallback`,"aria-disabled":c||void 0,onClick:()=>ee(t),children:(0,Q.jsx)(ns,{})})]})]},_(e))})})})}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsxs)(`select`,{"aria-label":`Agent to add`,"data-slot":`fallback-add-agent`,value:E?.key??``,onChange:e=>{x(e.target.value),C(``)},disabled:c||P||y.length===0,className:`min-w-0 flex-1 basis-full sm:basis-0 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:[y.length===0?(0,Q.jsx)(`option`,{value:``,children:`Every agent is already listed`}):null,y.map(e=>(0,Q.jsx)(`option`,{value:e.key,children:e.label},e.key))]}),a?(0,Q.jsx)(`output`,{"aria-label":`Model for the agent to add`,title:`Model selection is locked to native coding-agent settings.`,className:`min-w-0 flex-1 rounded-md border border-input bg-muted/30 px-3 py-1.5 text-sm text-muted-foreground`,children:`Native agent settings`}):(0,Q.jsxs)(`select`,{"aria-label":`Model for the agent to add`,"data-slot":`fallback-add-model`,value:S,onChange:e=>C(e.target.value),disabled:c||P||!E,className:`min-w-0 flex-1 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,Q.jsx)(`option`,{value:``,children:`auto model`}),pc(N,te?.data,[]).map(e=>e.id?(0,Q.jsx)(`option`,{value:e.id,children:e.label},e.id):null),ne?(0,Q.jsx)(`option`,{disabled:!0,children:ne}):null]}),(0,Q.jsxs)(J,{type:`button`,variant:`outline`,size:`sm`,"data-slot":`fallback-add`,disabled:c||P||!E,onClick:j,children:[(0,Q.jsx)(Jo,{}),` Add agent`]})]}),P?(0,Q.jsxs)(`p`,{className:`text-ui text-muted-foreground`,children:[`Up to `,zw,` agents.`]}):null,(0,Q.jsxs)(`div`,{"data-slot":`fallback-terms`,className:`space-y-2 text-ui text-muted-foreground`,children:[(0,Q.jsx)(`p`,{children:`Settings changes apply to new tasks. Each agent is tried once. If no agent in the list can continue, the task stops and waits for you.`}),(0,Q.jsxs)(`details`,{children:[(0,Q.jsx)(`summary`,{className:`w-fit cursor-pointer rounded-sm outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:`Scope and permissions`}),(0,Q.jsxs)(`div`,{className:`mt-2 space-y-2`,children:[(0,Q.jsx)(`p`,{children:`Quick task and the final step of step-list workflows can switch agents; workflow graphs and earlier steps keep waiting for the limit to reset.`}),(0,Q.jsx)(`p`,{children:`Task budgets still apply. Tool restrictions are enforced by Claude only; other agents run with their own permissions.`})]})]})]}),(0,Q.jsx)(`p`,{role:`status`,"aria-live":`polite`,className:`sr-only`,children:w})]})})}function Vw({defaultRunner:e,providerStatus:t,saving:n,onPick:r}){let i=vt(),o=a(),s=ut(),c=mn(),l=He(),u=s.projectId??`default`,d=c.data?.info?.root,f=d?i.data?.selections[d]:void 0,p=i.data?.defaults,m=ZC(i.data?.profiles??[]),h=QC(m);return(0,Q.jsxs)(Hw,{title:h?`Default agent`:`Default runner`,hint:h?`Preselected for new tasks in THIS repo, and used by the chain planner. Each task can still pick another agent or account. The account is stored on this machine only — it is never committed, so a teammate keeps their own.`:`Preselected for new tasks in THIS repo, and used by the chain planner. Each task can still pick another runner.`,children:[(0,Q.jsx)($C,{rows:m,runner:e,accountFor:e=>f?.[e]??p?.[e]??null,providerStatus:t,disabled:n,accountDisabled:l.isPending||o.data===void 0,onPick:(t,n,i)=>{t!==e&&r(t),i&&l.mutate({projectId:u,provider:t,profileId:n},{onError:e=>Y(e.message,{tone:`danger`})})}}),!t.isPending&&!t.isError&&tn(t.data,e)?.enabled===!1?(0,Q.jsx)(`p`,{className:`text-ui text-muted-foreground`,children:`This provider is disabled. Enable it above or choose another provider.`}):null,h?(0,Q.jsx)(`p`,{className:`max-w-md text-ui text-muted-foreground`,children:`Tasks already started under another account can’t be resumed here — their sessions live in that account’s folder.`}):null]})}function Hw({title:e,hint:t,children:n,action:r}){return(0,Q.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,Q.jsx)(`p`,{className:`text-ui text-muted-foreground`,children:t})]}),r]}),n]})}var Uw=`cez-accent`,Ww=`cez-density`,Gw=`cez-width`,Kw=`lime`,qw=`comfortable`,Jw=`wide`;function Yw(e){return e===`lime`||e===`violet`?e:Kw}function Xw(e){return e===`comfortable`||e===`compact`||e===`ultra`?e:qw}function Zw(e){return e===`narrow`||e===`wide`?e:Jw}function Qw(e){let t=e&&typeof e==`object`?e:{};return{accent:Yw(t.accent),density:Xw(t.density),width:Zw(t.width)}}function $w(){try{return{accent:Yw(localStorage.getItem(Uw)),density:Xw(localStorage.getItem(Ww)),width:Zw(localStorage.getItem(Gw))}}catch{return{accent:Kw,density:qw,width:Jw}}}function eT(e){try{localStorage.setItem(Uw,e.accent),localStorage.setItem(Ww,e.density),localStorage.setItem(Gw,e.width)}catch{}}function tT(e,t){t.accent===`lime`?delete e.dataset.accent:e.dataset.accent=t.accent,t.density===`comfortable`?delete e.dataset.density:e.dataset.density=t.density,t.width===`wide`?delete e.dataset.width:e.dataset.width=t.width}var nT=Z.createContext(null);function rT({children:e}){let t=W(),n=bt(),[r,i]=Z.useState($w),a=n.data;Z.useEffect(()=>{if(a===void 0)return;let e=Qw(a.appearance);i(e),eT(e)},[a]),Z.useLayoutEffect(()=>{tT(document.documentElement,r)},[r]);let o=Z.useCallback(e=>{i(e),eT(e),zt({appearance:e}).then(e=>t.setQueryData(V.uiState,e)).catch(e=>{Y(e instanceof Error?e.message:String(e),{tone:`danger`}),t.invalidateQueries({queryKey:V.uiState})})},[t]),s=Z.useCallback(e=>o({...r,accent:e}),[o,r]),c=Z.useCallback(e=>o({...r,density:e}),[o,r]),l=Z.useCallback(e=>o({...r,width:e}),[o,r]),u=Z.useMemo(()=>({accent:r.accent,density:r.density,width:r.width,setAccent:s,setDensity:c,setWidth:l}),[r,s,c,l]);return(0,Q.jsx)(nT.Provider,{value:u,children:e})}function iT(){let e=Z.useContext(nT);if(!e)throw Error(`cezar: useAppearance() must be called inside <AppearanceProvider>`);return e}var aT=[{value:`system`,label:`System`,icon:cu},{value:`light`,label:`Light`,icon:Tu},{value:`dark`,label:`Dark`,icon:lu}],oT=[{value:`lime`,label:`Lime`,swatch:`var(--accent-lime)`},{value:`violet`,label:`Violet`,swatch:`var(--violet)`}],sT=[{value:`comfortable`,label:`Comfortable`},{value:`compact`,label:`Compact`},{value:`ultra`,label:`Compact for real`}],cT=[{value:`narrow`,label:`Narrow`},{value:`wide`,label:`Full`}];function lT({slot:e,label:t,value:n,options:r,onChange:i}){return(0,Q.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`,children:r.map(e=>{let t=e.value===n;return(0,Q.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":t,"data-value":e.value,onClick:()=>i(e.value),className:G(`flex items-center gap-2 rounded-sm px-3 py-1.5 text-ui font-medium transition-colors`,t?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`),children:[e.icon?(0,Q.jsx)(e.icon,{"aria-hidden":`true`,className:`size-3.5`}):null,e.swatch?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`size-3 rounded-full border border-border`,style:{background:e.swatch}}):null,e.label]},e.value)})})}function uT({title:e,hint:t,children:n}){return(0,Q.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,Q.jsx)(`p`,{className:`text-ui text-muted-foreground`,children:t})]}),n]})}function dT(){let e=a(),{order:t,canReorder:n,reset:r}=Np();return!((e.data?.projects.length??0)>1)||t.length===0?null:(0,Q.jsx)(uT,{title:`Project order`,hint:`The sidebar is in the order you dragged it into. Reset puts it back to most-recently-opened first. Shared with every browser signed in to this cezar.`,children:(0,Q.jsx)(J,{type:`button`,variant:`outline`,size:`sm`,"data-slot":`appearance-project-order-reset`,disabled:!n,onClick:r,className:`w-fit`,children:`Reset order`})})}function fT(){let e=qt(),t=W(),n=(0,Z.useRef)(null),[r,i]=(0,Z.useState)(null);(0,Z.useEffect)(()=>()=>{r&&URL.revokeObjectURL(r.url)},[r]);let a=U({mutationFn:e=>yn(e),onSuccess:e=>t.setQueryData(V.config,e),onError:e=>Y(e.message,{tone:`danger`})}),o=U({mutationFn:async e=>e?Be(e):Ke(),onSuccess:e=>{let n=t.getQueryData(V.config);n&&t.setQueryData(V.config,{...n,branding:{...n.branding,logoUrl:e}}),i(null)},onError:e=>Y(e.message,{tone:`danger`})}),s=e.data?.branding,[c,l]=(0,Z.useState)(s?.name??`cezar`),[u,d]=(0,Z.useState)(s?.name??`cezar`);return(0,Z.useEffect)(()=>{s&&c===u&&(l(s.name),d(s.name))},[s?.name]),(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(uT,{title:`Instance name`,hint:`Shown in the sidebar and browser tab across this workspace.`,children:(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`input`,{"data-slot":`branding-name`,"aria-label":`Instance name`,maxLength:80,value:c,onChange:e=>l(e.currentTarget.value),onBlur:()=>{let e=c.trim();if(!e){l(s?.name??`cezar`);return}e!==s?.name&&a.mutate({branding:{name:e}}),d(e)},className:`h-9 w-64 rounded-md border border-border bg-background px-3 text-sm`}),(0,Q.jsx)(J,{type:`button`,variant:`outline`,size:`sm`,disabled:!s||s.name===`cezar`||a.isPending,onClick:()=>a.mutate({branding:{name:null}}),children:`Reset name`})]})}),(0,Q.jsx)(uT,{title:`Logo`,hint:`PNG, JPEG, WebP, GIF, AVIF, or safe SVG up to 2 MB. Stored on this machine and shared by its browsers.`,children:(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 rounded-lg border border-border bg-card p-3`,children:[r?(0,Q.jsx)(`img`,{src:r.url,alt:`Logo preview`,className:`size-10 rounded-md border border-border bg-background object-contain p-1`}):s?.logoUrl?(0,Q.jsx)(`img`,{src:s.logoUrl,alt:`Current instance logo`,className:`size-10 rounded-md border border-border bg-background object-contain p-1`}):(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`size-10 rounded-md border border-dashed border-border bg-background`}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`p`,{className:`truncate text-sm font-medium text-foreground`,children:r?.file.name??(s?.logoUrl?`Current logo`:`No logo selected`)}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Choose an image to preview it before saving.`})]}),(0,Q.jsx)(`input`,{ref:n,"data-slot":`branding-logo`,"aria-label":`Upload logo`,type:`file`,accept:`image/png,image/jpeg,image/webp,image/gif,image/avif,image/svg+xml`,disabled:o.isPending,hidden:!0,onChange:e=>{let t=e.currentTarget.files?.[0];t&&i({file:t,url:URL.createObjectURL(t)}),e.currentTarget.value=``}}),(0,Q.jsxs)(J,{type:`button`,variant:`outline`,size:`sm`,disabled:!s||o.isPending,onClick:()=>n.current?.click(),children:[(0,Q.jsx)(wo,{"aria-hidden":`true`,className:`size-3.5`}),`Choose logo`]}),r?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(J,{type:`button`,size:`sm`,disabled:o.isPending,onClick:()=>o.mutate(r.file),children:`Save logo`}),(0,Q.jsx)(J,{type:`button`,variant:`outline`,size:`sm`,disabled:o.isPending,onClick:()=>i(null),children:`Cancel`})]}):s?.logoUrl?(0,Q.jsx)(J,{type:`button`,variant:`outline`,size:`sm`,disabled:o.isPending,onClick:()=>o.mutate(null),children:`Remove logo`}):null]})})]})}function pT(){let{theme:e,setTheme:t}=sp(),{accent:n,density:r,width:i,setAccent:a,setDensity:o,setWidth:s}=iT(),c=Ji();return(0,Q.jsxs)(`div`,{"data-slot":`appearance-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,Q.jsx)(fT,{}),(0,Q.jsx)(uT,{title:`Theme`,hint:`System follows your OS preference. Applies to this browser.`,children:(0,Q.jsx)(lT,{slot:`appearance-theme`,label:`Theme`,value:e,options:aT,onChange:t})}),(0,Q.jsx)(uT,{title:`Accent`,hint:`The primary action color. Saved with this repo's cockpit state.`,children:(0,Q.jsx)(lT,{slot:`appearance-accent`,label:`Accent`,value:n,options:oT,onChange:a})}),(0,Q.jsx)(uT,{title:`Density`,hint:`Compact tightens spacing across the cockpit — text stays the same size.`,children:(0,Q.jsx)(lT,{slot:`appearance-density`,label:`Density`,value:r,options:sT,onChange:o})}),(0,Q.jsx)(uT,{title:`Reading width`,hint:`Full gives task sessions, commits, and skill content the whole available area. Narrow keeps a comfortable reading column. The Changes tab is always full-width.`,children:(0,Q.jsx)(lT,{slot:`appearance-width`,label:`Reading width`,value:i,options:cT,onChange:s})}),(0,Q.jsx)(uT,{title:`Usage gauges`,hint:`Claude account, plan limits left (5h, 7d) and context fill in the task header. Applies to this browser.`,children:(0,Q.jsx)(lT,{slot:`appearance-live-usage`,label:`Usage gauges`,value:c?`on`:`off`,options:[{value:`on`,label:`Show`},{value:`off`,label:`Hide`}],onChange:e=>ca(e===`on`)})}),(0,Q.jsx)(dT,{})]})}function $({title:e,hint:t,children:n}){return(0,Q.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,Q.jsx)(`p`,{className:`text-ui text-muted-foreground`,children:t})]}),n]})}var mT=2e4;function hT(){let e=qt();return e.isPending?(0,Q.jsx)(`p`,{className:`p-4 text-ui text-soft-foreground md:p-6`,children:`Loading instructions…`}):e.isError?(0,Q.jsx)(gl,{icon:(0,Q.jsx)(aa,{}),tone:`danger`,title:`Instructions did not load`,subtitle:e.error.message,heading:`h2`}):(0,Q.jsx)(gT,{config:e.data})}function gT({config:e}){let t=W(),n=U({mutationFn:e=>yn(e),onSuccess:e=>t.setQueryData(V.config,e),onError:e=>Y(e.message,{tone:`danger`})}),[r,i]=(0,Z.useState)(e.systemPrompt??``),a=r.trim(),o=a===(e.systemPrompt??``),s=a.length>mT;return(0,Q.jsx)(`div`,{"data-slot":`global-instructions-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,Q.jsxs)($,{title:`Global system prompt`,hint:`Read by every agent step of every new task, in every project. A project's own system prompt is added after it and takes precedence where they conflict.`,children:[(0,Q.jsx)($o,{"aria-label":`Global system prompt`,"data-slot":`global-instructions-prompt`,value:r,onChange:e=>i(e.target.value),placeholder:`General rules for every project — conventions, tone, review requirements…`,className:`min-h-32 max-w-xl`}),(0,Q.jsxs)(`div`,{className:`flex max-w-xl items-center gap-3`,children:[(0,Q.jsx)(J,{type:`button`,variant:`outline`,size:`sm`,"data-action":`global-instructions-save`,disabled:o||s||n.isPending,onClick:()=>n.mutate({systemPrompt:a===``?null:a},{onSuccess:()=>Y(a===``?`Global instructions cleared`:`Global instructions saved`)}),children:`Save`}),s?(0,Q.jsxs)(`p`,{"data-slot":`global-instructions-limit`,className:`text-meta text-danger`,children:[a.length.toLocaleString(),` characters — the limit is `,mT.toLocaleString(),`.`]}):(0,Q.jsx)(`p`,{className:`text-meta text-soft-foreground`,children:`Leave empty and save to clear. Applied to new runs only.`})]})]})})}function _T({embedded:e=!1}={}){let t=Bt();return t.isPending?(0,Q.jsx)(`p`,{"data-slot":`prompt-templates-loading`,className:e?`text-ui text-soft-foreground`:`p-4 text-ui text-soft-foreground md:p-6`,children:`Loading prompt templates…`}):t.isError?(0,Q.jsx)(gl,{icon:(0,Q.jsx)(uu,{}),tone:`danger`,title:`Prompt templates did not load`,subtitle:t.error.message,heading:`h2`}):(0,Q.jsx)(vT,{initial:jo(t.data.promptTemplates),embedded:e})}function vT({initial:e,embedded:t}){let n=W(),r=oe(),i=Bt(),[a,o]=(0,Z.useState)(e),[s,c]=(0,Z.useState)(``),[l,u]=(0,Z.useState)(``),d=U({mutationFn:e=>en({promptTemplates:e}),onSuccess:e=>{n.setQueryData(H.uiState,e),Y(`Prompt templates saved`)},onError:e=>Y(e.message,{tone:`danger`})}),f=JSON.stringify(a)!==JSON.stringify(e),p=a.some(e=>e.label.trim()===``||e.text.trim()===``),m=(e,t)=>o(n=>n.map(n=>n.id===e?{...n,...t}:n)),h=(e,t)=>o(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=>o(t=>t.filter(t=>t.id!==e));return(0,Q.jsx)(`div`,{"data-slot":`prompt-templates-section`,className:t?`flex w-full flex-col gap-7`:`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,Q.jsxs)(bT,{title:`Prompt templates`,hint:`Reusable snippets you can insert into a prompt — the new-task composer, the GitHub hand-over, and the Inbox's “Add instructions” box all offer this list. Assign a template to a skill and it fills the prompt in for you when you pick that skill, as long as you have not typed anything yet.`,children:[(0,Q.jsx)(`div`,{"data-slot":`prompt-template-list`,className:`flex flex-col gap-3`,children:a.length===0?(0,Q.jsx)(`p`,{"data-slot":`prompt-templates-empty`,className:`text-ui text-soft-foreground`,children:`No templates. Add one below, or reset to the built-ins.`}):a.map(e=>(0,Q.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,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(qs,{"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,Q.jsx)(J,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`prompt-template-remove`,title:`Remove this template`,onClick:()=>g(e.id),children:(0,Q.jsx)(ns,{"aria-hidden":`true`,className:`size-3.5`})})]}),(0,Q.jsx)($o,{"aria-label":`Text for ${e.label||`this template`}`,"data-slot":`prompt-template-text-input`,value:e.text,maxLength:Bo,onChange:t=>m(e.id,{text:t.target.value}),className:`min-h-14 text-ui`}),(0,Q.jsxs)(`div`,{className:`mt-0.5 flex flex-wrap items-center gap-1.5`,children:[(0,Q.jsx)(yT,{label:e.label,skills:r.data??[],skillUsage:i.data?.skillUsage,selected:e.skills??[],onToggle:t=>h(e.id,t)}),(e.skills??[]).map(t=>(0,Q.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-meta font-medium text-foreground transition-colors hover:bg-danger/10 hover:text-danger`,children:[t,(0,Q.jsx)(ns,{"aria-hidden":`true`,className:`size-3`})]},t))]})]},e.id))}),(0,Q.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,Q.jsx)(qs,{"aria-label":`New template label`,"data-slot":`prompt-template-new-label`,placeholder:`Label (e.g. "Add tests")`,value:s,maxLength:80,onChange:e=>c(e.target.value)}),(0,Q.jsx)($o,{"aria-label":`New template text`,"data-slot":`prompt-template-new-text`,placeholder:`The instructions to insert…`,value:l,maxLength:Bo,onChange:e=>u(e.target.value),className:`min-h-14 text-ui`}),(0,Q.jsxs)(J,{type:`button`,variant:`outline`,size:`sm`,"data-action":`prompt-template-add`,disabled:!s.trim()||!l.trim(),onClick:()=>{let e=s.trim(),t=l.trim();!e||!t||(o(n=>[...n,{id:Vo(),label:e,text:t}]),c(``),u(``))},className:`self-start`,children:[(0,Q.jsx)(Jo,{"aria-hidden":`true`,className:`size-3.5`}),`Add template`]})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Q.jsx)(J,{type:`button`,variant:`contrast`,size:`sm`,"data-action":`prompt-templates-save`,disabled:!f||p||d.isPending,onClick:()=>d.mutate(a),children:`Save`}),(0,Q.jsx)(J,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`prompt-templates-reset`,disabled:d.isPending,onClick:()=>o(Lo.map(e=>({...e}))),children:`Reset to defaults`}),p?(0,Q.jsx)(`p`,{"data-slot":`prompt-templates-invalid`,className:`text-meta text-danger`,children:`Every template needs both a label and text.`}):null]})]})})}function yT({label:e,skills:t,skillUsage:n,selected:r,onToggle:i}){let[a,o]=(0,Z.useState)(!1),[s,c]=(0,Z.useState)(``),l=(0,Z.useRef)(null),{mostUsed:u,project:d,global:f}=Oo(Ko(t,s,n),n),p=(e,t)=>{let n=r.includes(e.name);return(0,Q.jsxs)(qc,{value:`skill ${e.name} ${e.path}`,keywords:Go(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,Q.jsx)(`span`,{className:G(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.description?(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,n?(0,Q.jsx)(Wa,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-primary`}):null]},e.path)};return(0,Q.jsxs)(Is,{open:a,onOpenChange:e=>{o(e),e||c(``)},children:[(0,Q.jsx)(Es,{asChild:!0,children:(0,Q.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:G(`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,Q.jsx)(Ba,{"aria-hidden":`true`,className:`size-3 shrink-0 text-violet`}),t.length===0?`no skills found`:`apply with…`,(0,Q.jsx)(Xa,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Q.jsx)(Ms,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Q.jsxs)(Xc,{shouldFilter:!1,children:[(0,Q.jsx)(Hc,{placeholder:`search skills…`,value:s,onValueChange:c,onInput:()=>l.current?.scrollTo(0,0)}),(0,Q.jsxs)(Yc,{ref:l,"data-slot":`prompt-template-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[u.length===0&&d.length===0&&f.length===0?(0,Q.jsx)(Jc,{children:`Nothing matches.`}):null,u.length>0?(0,Q.jsx)(Wc,{heading:`Most used`,children:u.map(e=>p(e,zo(e)))}):null,d.length>0?(0,Q.jsx)(Wc,{heading:`Project skills`,children:d.map(e=>p(e,!0))}):null,f.length>0?(0,Q.jsx)(Wc,{heading:`Global`,children:f.map(e=>p(e,!1))}):null]})]})})]})}function bT({title:e,hint:t,children:n}){return(0,Q.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,Q.jsx)(`p`,{className:`text-ui text-muted-foreground`,children:t})]}),n]})}var xT=2e4,ST=4e3;function CT(){let e=jn();return e.isPending?(0,Q.jsx)(`p`,{"data-slot":`instructions-loading`,className:`p-4 text-ui text-soft-foreground md:p-6`,children:`Loading instructions…`}):e.isError?(0,Q.jsx)(gl,{icon:(0,Q.jsx)(aa,{}),tone:`danger`,title:`Instructions did not load`,subtitle:e.error.message,heading:`h2`}):(0,Q.jsx)(wT,{config:e.data})}function wT({config:e}){let t=Fw(),[n,r]=(0,Z.useState)(e.systemPrompt??``),i=n.trim(),a=i===(e.systemPrompt??``),o=i.length>xT,s=()=>t.mutate({systemPrompt:i===``?null:i},{onSuccess:()=>Y(i===``?`System prompt cleared`:`System prompt saved`)}),[c,l]=(0,Z.useState)(e.branchNaming??``),u=c.trim(),d=u===(e.branchNaming??``),f=u.length>ST;return(0,Q.jsxs)(`div`,{"data-slot":`instructions-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,Q.jsxs)($,{title:`System prompt`,hint:`Read by every agent step of every new task in this project, whichever runner executes it. Added after the global instructions (General settings → Instructions) and takes precedence over them.`,children:[(0,Q.jsx)($o,{"aria-label":`System prompt`,"data-slot":`instructions-system-prompt`,value:n,onChange:e=>r(e.target.value),placeholder:`Extra rules for every agent run — conventions, tone, review requirements…`,className:`min-h-32 max-w-xl`}),(0,Q.jsxs)(`div`,{className:`flex max-w-xl items-center gap-3`,children:[(0,Q.jsx)(J,{type:`button`,variant:`outline`,size:`sm`,"data-action":`instructions-save-prompt`,disabled:a||o||t.isPending,onClick:s,children:`Save`}),o?(0,Q.jsxs)(`p`,{"data-slot":`instructions-prompt-limit`,className:`text-meta text-danger`,children:[i.length.toLocaleString(),` characters — the limit is `,xT.toLocaleString(),`.`]}):(0,Q.jsx)(`p`,{className:`text-meta text-soft-foreground`,children:`Leave empty and save to clear. Applied to new runs only.`})]})]}),(0,Q.jsxs)($,{title:`Branch naming`,hint:`How new task branches are named. Generated from the first prompt.`,children:[(0,Q.jsx)($o,{"aria-label":`Branch naming`,"data-slot":`instructions-branch-naming`,value:c,onChange:e=>l(e.target.value),placeholder:`Describe your branch naming convention…`,className:`min-h-24 max-w-xl`}),(0,Q.jsxs)(`div`,{className:`flex max-w-xl items-center gap-3`,children:[(0,Q.jsx)(J,{type:`button`,variant:`outline`,size:`sm`,"data-action":`instructions-save-branch-naming`,disabled:d||f||t.isPending,onClick:()=>t.mutate({branchNaming:u===``?null:u},{onSuccess:()=>Y(u===``?`Branch naming cleared`:`Branch naming saved`)}),children:`Save`}),f?(0,Q.jsxs)(`p`,{"data-slot":`instructions-branch-naming-limit`,className:`text-meta text-danger`,children:[u.length.toLocaleString(),` characters — the limit is`,` `,ST.toLocaleString(),`.`]}):(0,Q.jsx)(`p`,{className:`text-meta text-soft-foreground`,children:`Leave empty for the default names. A new task waits for its name before it forks.`})]})]}),(0,Q.jsx)(`div`,{id:`prompt-templates`,className:`scroll-mt-20`,children:(0,Q.jsx)(_T,{embedded:!0})})]})}function TT(){let e=Zi(),[t,n]=Z.useState(null),[r,i]=Z.useState(null),a=Object.keys(e.overrides).length>0,o=Z.useMemo(()=>{let t=new Map;for(let e of As)t.set(e.group,[...t.get(e.group)??[],e]);let n=Object.keys(e.overrides).filter(t=>!As.some(e=>e.id===t)&&e.overrides[t]).map(e=>({id:e,label:e.replace(/^[a-z-]+:/,``),group:`Other`}));return n.length>0&&t.set(`Other`,n),[...t]},[e.overrides]);Z.useEffect(()=>{if(!t)return;let r=r=>{if(r.key===`Tab`&&!r.metaKey&&!r.ctrlKey&&!r.altKey||(r.preventDefault(),r.stopImmediatePropagation(),r.key===`Escape`))return n(null);if(!r.metaKey&&!r.ctrlKey&&!r.altKey&&!r.shiftKey&&(r.key===`Backspace`||r.key===`Delete`))return e.assign(t,null),n(null);let a=js(r);if(!a){let e=Fs(r);e&&i(e);return}let o=Ts(a);if(o)return i(`${Hs(a)} — ${o}`);let s=[...e.bindings].find(([e,n])=>n===a&&e!==t)?.[0];e.assign(t,a),s&&Y(`${Hs(a)} moved from ${ET(s)} to ${ET(t)}`),n(null)},a=e=>{(e.target instanceof Element?e.target.closest(`[data-slot="shortcut-chord"]`):null)?.closest(`[data-command-id]`)?.dataset.commandId!==t&&n(null)};return window.addEventListener(`keydown`,r,{capture:!0}),window.addEventListener(`pointerdown`,a,{capture:!0}),()=>{window.removeEventListener(`keydown`,r,{capture:!0}),window.removeEventListener(`pointerdown`,a,{capture:!0})}},[t,e]);let s=Ds();return(0,Q.jsxs)(`div`,{"data-slot":`keyboard-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,Q.jsx)(`section`,{className:`flex flex-col gap-2`,children:(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Task shortcuts`}),(0,Q.jsxs)(`p`,{className:`text-ui text-muted-foreground`,children:[`Run a task’s commands from the keyboard while the task is open. `,Hs(`Mod+P`),` lists them all; press `,s?`⇧↵`:`Shift+Enter`,` on a row there to set its shortcut. `,s?`⌘`:`Ctrl`,` chords also work while you type. `,s?`⌥↑ / ⌥↓`:`Alt+↑ / Alt+↓`,` go to the previous / next task,`,` `,s?`⌥⇧↑ / ⌥⇧↓`:`Alt+Shift+↑ / Alt+Shift+↓`,` to the previous / next one that needs you`,ic()===`desktop`?` — and ${s?`⌃⌥↑ / ⌃⌥↓`:`Ctrl+Alt+↑ / Ctrl+Alt+↓`} do that from any application.`:`.`]})]}),(0,Q.jsxs)(J,{variant:`outline`,size:`sm`,"data-action":`reset-all-shortcuts`,disabled:!a||!e.ready,onClick:e.resetAll,children:[(0,Q.jsx)(gu,{"aria-hidden":`true`}),` Reset all`]})]})}),o.map(([a,o])=>(0,Q.jsxs)(`section`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`h3`,{className:`eyebrow text-soft-foreground`,children:a}),(0,Q.jsx)(`ul`,{className:`flex flex-col divide-y divide-border rounded-md border border-border`,children:o.map(a=>{let o=e.bindings.get(a.id),s=t===a.id,c=a.id in e.overrides;return(0,Q.jsxs)(`li`,{"data-slot":`shortcut-row`,"data-command-id":a.id,className:`flex items-center gap-2 px-3 py-1.5`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,children:a.label}),s?(0,Q.jsx)(`span`,{"data-slot":`shortcut-recording`,className:`text-xs text-primary`,children:r??`Press keys… (esc cancels, ⌫ removes)`}):null,(0,Q.jsx)(`button`,{type:`button`,"data-slot":`shortcut-chord`,"aria-label":o?`Change the shortcut for ${a.label} (${Hs(o)})`:`Set a shortcut for ${a.label}`,disabled:!e.ready,onClick:()=>{i(null),n(s?null:a.id)},onBlur:()=>{s&&n(null)},className:G(`min-w-16 rounded-[5px] border border-b-2 px-1.5 py-0.5 font-mono text-xs`,s?`border-primary text-primary`:`border-border text-muted-foreground hover:text-foreground`),children:o?Hs(o):(0,Q.jsx)(tu,{"aria-hidden":`true`,className:`mx-auto size-3.5`})}),c?(0,Q.jsx)(J,{variant:`ghost`,size:`icon-sm`,"aria-label":`Reset ${a.label} to ${Ls[a.id]?Hs(Ls[a.id]):`no shortcut`}`,title:`Reset to default`,onClick:()=>e.reset(a.id),children:(0,Q.jsx)(gu,{"aria-hidden":`true`})}):o?(0,Q.jsx)(J,{variant:`ghost`,size:`icon-sm`,"aria-label":`Remove the shortcut for ${a.label}`,title:`Remove`,onClick:()=>e.assign(a.id,null),children:(0,Q.jsx)(ns,{"aria-hidden":`true`})}):(0,Q.jsx)(`span`,{className:`size-7 shrink-0`})]},a.id)})})]},a))]})}function ET(e){return As.find(t=>t.id===e)?.label??e}var DT=[{type:`merge-pr`,label:`Merges`,description:`Show the project, pull request, method and head commit first.`},{type:`enable-automation`,label:`Automations`,description:`Show the name, revision and definition first.`},{type:`add-job`,label:`Jobs`,description:`Show the name, interval and full prompt first.`}];function OT(){let e=W(),t=bt(),n=t.data?.managerConfirm,r=(t,n)=>{let r=e.getQueryData(V.uiState)?.managerConfirm,i={...Object.fromEntries(el.map(e=>[e,$c(r,e)])),[t]:n};e.setQueryData(V.uiState,e=>({...e,managerConfirm:i})),zt({managerConfirm:i}).catch(t=>{Y(t instanceof Error?t.message:String(t),{tone:`danger`}),e.invalidateQueries({queryKey:V.uiState})})};return(0,Q.jsxs)(`div`,{"data-slot":`manager-confirm-settings`,className:`flex max-w-2xl flex-col gap-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Confirm before approving`}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Approve opens a summary to confirm. With a switch off, Approve sends straight away. The card still appears and still needs your tap: a manager never acts on its own.`})]}),(0,Q.jsx)(`ul`,{className:`flex flex-col gap-3`,children:DT.map(({type:e,label:i,description:a})=>(0,Q.jsxs)(`li`,{className:`flex items-center justify-between gap-4 rounded-lg border border-border bg-card p-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium`,children:i}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:a})]}),(0,Q.jsx)(jf,{"aria-label":i,checked:$c(n,e),disabled:t.data===void 0,onCheckedChange:t=>r(e,t)})]},e))})]})}function kT(){let e=oe();return e.isPending?(0,Q.jsx)(`p`,{"data-slot":`bookmarklets-loading`,className:`p-4 text-ui text-soft-foreground md:p-6`,children:`Loading bookmarklets…`}):e.isError?(0,Q.jsx)(gl,{icon:(0,Q.jsx)(es,{}),tone:`danger`,heading:`h2`,title:`Could not load bookmarklets`,subtitle:e.error.message}):(0,Q.jsx)(`div`,{className:`flex min-h-full flex-1 overflow-y-auto px-4 py-5 md:px-7`,children:(0,Q.jsx)(AT,{skills:No(e.data??[])})})}function AT({skills:e}){let t=ze(),n=T(),r=a(),[i,o]=(0,Z.useState)(!1),[s,c]=(0,Z.useState)(``),l=t.data?.key??``,u=window.location.origin,d=Vc()??n.data?.bootProject??null,f=r.data?.projects.find(e=>e.id===d)?.name??yM(n.data)?.name??null,p=s.trim().toLowerCase(),m=e.filter(e=>e.name.toLowerCase().includes(p));return(0,Q.jsxs)(`div`,{"data-slot":`bookmarklet-panel`,className:`mx-auto w-full max-w-2xl`,children:[(0,Q.jsx)(`h2`,{className:`text-base font-semibold`,children:`Run from GitHub`}),(0,Q.jsxs)(`p`,{className:`mt-2 text-ui leading-relaxed text-muted-foreground`,children:[`Drag a button below to your browser's bookmarks bar. On any GitHub PR or issue, click it to open this cockpit directly. The cockpit must be running: `,(0,Q.jsx)(`span`,{className:`font-mono`,children:`npx cezar`}),`.`]}),(0,Q.jsxs)(`label`,{className:`mt-4 flex items-center gap-2 text-ui font-medium`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,"data-slot":`bm-auto`,checked:i,onChange:e=>o(e.target.checked),className:`size-3.5`}),`One-click launch (auto-submit)`,` `,(0,Q.jsx)(`span`,{className:`font-normal text-soft-foreground`,children:`— re-drag the buttons after changing this`})]}),(0,Q.jsx)(`div`,{"data-slot":`bm-generic`,className:`mt-4`,children:(0,Q.jsx)(eC,{label:f?`cezar (${f}): this PR/issue`:`cezar: this PR/issue`,url:nC(``,!1,l,u,d),hint:`prefills the form — nothing starts by itself`})}),(0,Q.jsx)(qs,{"data-slot":`bm-filter`,placeholder:`Filter skills…`,"aria-label":`Filter bookmarklet skills`,value:s,onChange:e=>c(e.target.value),className:`mt-5 h-8 text-ui`}),(0,Q.jsx)(`div`,{"data-slot":`bm-list`,className:`mt-3 flex flex-col gap-2`,children:m.length>0?m.map(e=>(0,Q.jsx)(eC,{label:f?`/${e.name} (${f})`:`/${e.name}`,url:nC(e.name,i,l,u,d),hint:e.source},e.path)):(0,Q.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:e.length>0?`(no skills match)`:`(no skills yet — the generic launcher above still works)`})})]})}function jT(){return window.__TAURI_INTERNALS__}function MT(){return window.__CEZ_DESKTOP__?.notch===!0&&jT()!==void 0}function NT(){let[e,t]=Z.useState(null);return Z.useEffect(()=>{let e=!0;return jT()?.invoke(`notch_enabled`).then(n=>{e&&t(n===!0)}).catch(()=>void 0),()=>{e=!1}},[]),e===null?null:(0,Q.jsxs)(`section`,{"data-slot":`notch-setting`,className:`flex items-start justify-between gap-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:(0,Q.jsx)(`label`,{htmlFor:`notch-enabled`,children:`Manager notch`})}),(0,Q.jsx)(`p`,{className:`text-ui text-muted-foreground`,children:`Shows the managers that are working or need you around the camera at the top of the screen. It stays out of the way while none are. On by default.`})]}),(0,Q.jsx)(jf,{id:`notch-enabled`,"data-slot":`notch-toggle`,checked:e,onCheckedChange:e=>{t(e),jT()?.invoke(`set_notch_enabled`,{enabled:e})}})]})}function PT(){let e=W(),t=bt(),[n,r]=Z.useState(!1),[i,a]=Z.useState(Br),o=t.data;Z.useEffect(()=>{o!==void 0&&r(Vr(o.notifications).enabled)},[o]);let s=Z.useCallback(t=>{r(t),zt({notifications:{enabled:t}}).then(t=>e.setQueryData(V.uiState,t)).catch(t=>{Y(t instanceof Error?t.message:String(t),{tone:`danger`}),e.invalidateQueries({queryKey:V.uiState})})},[e]),c=Z.useCallback(e=>{if(!e){s(!1);return}if(Br()!=="default"){s(!0);return}s(!0),Notification.requestPermission().then(e=>a(e)).catch(()=>a(Br()))},[s]),l=i===`unsupported`;return(0,Q.jsxs)(`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,Q.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:(0,Q.jsx)(`label`,{htmlFor:`notifications-enabled`,children:`Notify when an agent needs you`})}),(0,Q.jsx)(`p`,{className:`text-ui 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,Q.jsx)(jf,{id:`notifications-enabled`,"data-slot":`notifications-toggle`,checked:n,disabled:l,onCheckedChange:c})]}),l?(0,Q.jsx)(`p`,{"data-slot":`notifications-unsupported`,className:`text-ui text-muted-foreground`,children:`This browser does not support notifications, so the toggle is unavailable here.`}):null,!l&&n&&i===`denied`?(0,Q.jsx)(`p`,{"data-slot":`notifications-denied`,className:`text-ui text-danger`,children:`This browser is blocking notifications for the cockpit. The preference is saved, but nothing will be delivered here until you allow notifications in the browser's site settings.`}):null]}),MT()?(0,Q.jsx)(NT,{}):null]})}var FT=function(e,t){let n=e,r=LT[t],i=null,a=0,o=null,s=[],c={},l=function(e,t){a=n*4+17,i=function(e){let t=Array(e);for(let n=0;n<e;n+=1){t[n]=Array(e);for(let r=0;r<e;r+=1)t[n][r]=null}return t}(a),u(0,0),u(a-7,0),u(0,a-7),p(),f(),h(e,t),n>=7&&m(e),o??=v(n,r,s),g(o,t)},u=function(e,t){for(let n=-1;n<=7;n+=1)if(!(e+n<=-1||a<=e+n))for(let r=-1;r<=7;r+=1)t+r<=-1||a<=t+r||(0<=n&&n<=6&&(r==0||r==6)||0<=r&&r<=6&&(n==0||n==6)||2<=n&&n<=4&&2<=r&&r<=4?i[e+n][t+r]=!0:i[e+n][t+r]=!1)},d=function(){let e=0,t=0;for(let n=0;n<8;n+=1){l(!0,n);let r=zT.getLostPoint(c);(n==0||e>r)&&(e=r,t=n)}return t},f=function(){for(let e=8;e<a-8;e+=1)i[e][6]??(i[e][6]=e%2==0);for(let e=8;e<a-8;e+=1)i[6][e]??(i[6][e]=e%2==0)},p=function(){let e=zT.getPatternPosition(n);for(let t=0;t<e.length;t+=1)for(let n=0;n<e.length;n+=1){let r=e[t],a=e[n];if(i[r][a]==null)for(let e=-2;e<=2;e+=1)for(let t=-2;t<=2;t+=1)e==-2||e==2||t==-2||t==2||e==0&&t==0?i[r+e][a+t]=!0:i[r+e][a+t]=!1}},m=function(e){let t=zT.getBCHTypeNumber(n);for(let n=0;n<18;n+=1){let r=!e&&(t>>n&1)==1;i[Math.floor(n/3)][n%3+a-8-3]=r}for(let n=0;n<18;n+=1){let r=!e&&(t>>n&1)==1;i[n%3+a-8-3][Math.floor(n/3)]=r}},h=function(e,t){let n=r<<3|t,o=zT.getBCHTypeInfo(n);for(let t=0;t<15;t+=1){let n=!e&&(o>>t&1)==1;t<6?i[t][8]=n:t<8?i[t+1][8]=n:i[a-15+t][8]=n}for(let t=0;t<15;t+=1){let n=!e&&(o>>t&1)==1;t<8?i[8][a-t-1]=n:t<9?i[8][15-t-1+1]=n:i[8][15-t-1]=n}i[a-8][8]=!e},g=function(e,t){let n=-1,r=a-1,o=7,s=0,c=zT.getMaskFunction(t);for(let t=a-1;t>0;t-=2)for(t==6&&--t;;){for(let n=0;n<2;n+=1)if(i[r][t-n]==null){let a=!1;s<e.length&&(a=(e[s]>>>o&1)==1),c(r,t-n)&&(a=!a),i[r][t-n]=a,--o,o==-1&&(s+=1,o=7)}if(r+=n,r<0||a<=r){r-=n,n=-n;break}}},_=function(e,t){let n=0,r=0,i=0,a=Array(t.length),o=Array(t.length);for(let s=0;s<t.length;s+=1){let c=t[s].dataCount,l=t[s].totalCount-c;r=Math.max(r,c),i=Math.max(i,l),a[s]=Array(c);for(let t=0;t<a[s].length;t+=1)a[s][t]=255&e.getBuffer()[t+n];n+=c;let u=zT.getErrorCorrectPolynomial(l),d=VT(a[s],u.getLength()-1).mod(u);o[s]=Array(u.getLength()-1);for(let e=0;e<o[s].length;e+=1){let t=e+d.getLength()-o[s].length;o[s][e]=t>=0?d.getAt(t):0}}let s=0;for(let e=0;e<t.length;e+=1)s+=t[e].totalCount;let c=Array(s),l=0;for(let e=0;e<r;e+=1)for(let n=0;n<t.length;n+=1)e<a[n].length&&(c[l]=a[n][e],l+=1);for(let e=0;e<i;e+=1)for(let n=0;n<t.length;n+=1)e<o[n].length&&(c[l]=o[n][e],l+=1);return c},v=function(e,t,n){let r=HT.getRSBlocks(e,t),i=UT();for(let t=0;t<n.length;t+=1){let r=n[t];i.put(r.getMode(),4),i.put(r.getLength(),zT.getLengthInBits(r.getMode(),e)),r.write(i)}let a=0;for(let e=0;e<r.length;e+=1)a+=r[e].dataCount;if(i.getLengthInBits()>a*8)throw`code length overflow. (`+i.getLengthInBits()+`>`+a*8+`)`;for(i.getLengthInBits()+4<=a*8&&i.put(0,4);i.getLengthInBits()%8!=0;)i.putBit(!1);for(;!(i.getLengthInBits()>=a*8||(i.put(236,8),i.getLengthInBits()>=a*8));)i.put(17,8);return _(i,r)};c.addData=function(e,t){t||=`Byte`;let n=null;switch(t){case`Numeric`:n=WT(e);break;case`Alphanumeric`:n=GT(e);break;case`Byte`:n=KT(e);break;case`Kanji`:n=qT(e);break;default:throw`mode:`+t}s.push(n),o=null},c.isDark=function(e,t){if(e<0||a<=e||t<0||a<=t)throw e+`,`+t;return i[e][t]},c.getModuleCount=function(){return a},c.make=function(){if(n<1){let e=1;for(;e<40;e++){let t=HT.getRSBlocks(e,r),n=UT();for(let t=0;t<s.length;t++){let r=s[t];n.put(r.getMode(),4),n.put(r.getLength(),zT.getLengthInBits(r.getMode(),e)),r.write(n)}let i=0;for(let e=0;e<t.length;e++)i+=t[e].dataCount;if(n.getLengthInBits()<=i*8)break}n=e}l(!1,d())},c.createTableTag=function(e,t){e||=2,t=t===void 0?e*4:t;let n=``;n+=`<table style="`,n+=` border-width: 0px; border-style: none;`,n+=` border-collapse: collapse;`,n+=` padding: 0px; margin: `+t+`px;`,n+=`">`,n+=`<tbody>`;for(let t=0;t<c.getModuleCount();t+=1){n+=`<tr>`;for(let r=0;r<c.getModuleCount();r+=1)n+=`<td style="`,n+=` border-width: 0px; border-style: none;`,n+=` border-collapse: collapse;`,n+=` padding: 0px; margin: 0px;`,n+=` width: `+e+`px;`,n+=` height: `+e+`px;`,n+=` background-color: `,n+=c.isDark(t,r)?`#000000`:`#ffffff`,n+=`;`,n+=`"/>`;n+=`</tr>`}return n+=`</tbody>`,n+=`</table>`,n},c.createSvgTag=function(e,t,n,r){let i={};typeof arguments[0]==`object`&&(i=arguments[0],e=i.cellSize,t=i.margin,n=i.alt,r=i.title),e||=2,t=t===void 0?e*4:t,n=typeof n==`string`?{text:n}:n||{},n.text=n.text||null,n.id=n.text?n.id||`qrcode-description`:null,r=typeof r==`string`?{text:r}:r||{},r.text=r.text||null,r.id=r.text?r.id||`qrcode-title`:null;let a=c.getModuleCount()*e+t*2,o,s,l,u,d=``,f;for(f=`l`+e+`,0 0,`+e+` -`+e+`,0 0,-`+e+`z `,d+=`<svg version="1.1" xmlns="http://www.w3.org/2000/svg"`,d+=i.scalable?``:` width="`+a+`px" height="`+a+`px"`,d+=` viewBox="0 0 `+a+` `+a+`" `,d+=` preserveAspectRatio="xMinYMin meet"`,d+=r.text||n.text?` role="img" aria-labelledby="`+y([r.id,n.id].join(` `).trim())+`"`:``,d+=`>`,d+=r.text?`<title id="`+y(r.id)+`">`+y(r.text)+`</title>`:``,d+=n.text?`<description id="`+y(n.id)+`">`+y(n.text)+`</description>`:``,d+=`<rect width="100%" height="100%" fill="white" cx="0" cy="0"/>`,d+=`<path d="`,l=0;l<c.getModuleCount();l+=1)for(u=l*e+t,o=0;o<c.getModuleCount();o+=1)c.isDark(l,o)&&(s=o*e+t,d+=`M`+s+`,`+u+f);return d+=`" stroke="transparent" fill="black"/>`,d+=`</svg>`,d},c.createDataURL=function(e,t){e||=2,t=t===void 0?e*4:t;let n=c.getModuleCount()*e+t*2,r=t,i=n-t;return QT(n,n,function(t,n){if(r<=t&&t<i&&r<=n&&n<i){let i=Math.floor((t-r)/e),a=Math.floor((n-r)/e);return+!c.isDark(a,i)}else return 1})},c.createImgTag=function(e,t,n){e||=2,t=t===void 0?e*4:t;let r=c.getModuleCount()*e+t*2,i=``;return i+=`<img`,i+=` src="`,i+=c.createDataURL(e,t),i+=`"`,i+=` width="`,i+=r,i+=`"`,i+=` height="`,i+=r,i+=`"`,n&&(i+=` alt="`,i+=y(n),i+=`"`),i+=`/>`,i};let y=function(e){let t=``;for(let n=0;n<e.length;n+=1){let r=e.charAt(n);switch(r){case`<`:t+=`<`;break;case`>`:t+=`>`;break;case`&`:t+=`&`;break;case`"`:t+=`"`;break;default:t+=r;break}}return t},b=function(e){e=e===void 0?2:e;let t=c.getModuleCount()*1+e*2,n=e,r=t-e,i,a,o,s,l,u={"██":`█`,"█ ":`▀`," █":`▄`," ":` `},d={"██":`▀`,"█ ":`▀`," █":` `," ":` `},f=``;for(i=0;i<t;i+=2){for(o=Math.floor((i-n)/1),s=Math.floor((i+1-n)/1),a=0;a<t;a+=1)l=`█`,n<=a&&a<r&&n<=i&&i<r&&c.isDark(o,Math.floor((a-n)/1))&&(l=` `),n<=a&&a<r&&n<=i+1&&i+1<r&&c.isDark(s,Math.floor((a-n)/1))?l+=` `:l+=`█`,f+=e<1&&i+1>=r?d[l]:u[l];f+=`
|
|
28
|
+
`}return t%2&&e>0?f.substring(0,f.length-t-1)+Array(t+1).join(`▀`):f.substring(0,f.length-1)};return c.createASCII=function(e,t){if(e||=1,e<2)return b(t);--e,t=t===void 0?e*2:t;let n=c.getModuleCount()*e+t*2,r=t,i=n-t,a,o,s,l,u=Array(e+1).join(`██`),d=Array(e+1).join(` `),f=``,p=``;for(a=0;a<n;a+=1){for(s=Math.floor((a-r)/e),p=``,o=0;o<n;o+=1)l=1,r<=o&&o<i&&r<=a&&a<i&&c.isDark(s,Math.floor((o-r)/e))&&(l=0),p+=l?u:d;for(s=0;s<e;s+=1)f+=p+`
|
|
29
|
+
`}return f.substring(0,f.length-1)},c.renderTo2dContext=function(e,t){t||=2;let n=c.getModuleCount();for(let r=0;r<n;r++)for(let i=0;i<n;i++)e.fillStyle=c.isDark(r,i)?`black`:`white`,e.fillRect(i*t,r*t,t,t)},c};FT.stringToBytes=function(e){let t=[];for(let n=0;n<e.length;n+=1){let r=e.charCodeAt(n);t.push(r&255)}return t},FT.createStringToBytes=function(e,t){let n=function(){let n=XT(e),r=function(){let e=n.read();if(e==-1)throw`eof`;return e},i=0,a={};for(;;){let e=n.read();if(e==-1)break;let t=r(),o=r(),s=r(),c=String.fromCharCode(e<<8|t);a[c]=o<<8|s,i+=1}if(i!=t)throw i+` != `+t;return a}();return function(e){let t=[];for(let r=0;r<e.length;r+=1){let i=e.charCodeAt(r);if(i<128)t.push(i);else{let i=n[e.charAt(r)];typeof i==`number`?(i&255)==i?t.push(i):(t.push(i>>>8),t.push(i&255)):t.push(63)}}return t}};var IT={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},LT={L:1,M:0,Q:3,H:2},RT={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},zT=function(){let e=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],t=1335,n=7973,r={},i=function(e){let t=0;for(;e!=0;)t+=1,e>>>=1;return t};return r.getBCHTypeInfo=function(e){let n=e<<10;for(;i(n)-i(t)>=0;)n^=t<<i(n)-i(t);return(e<<10|n)^21522},r.getBCHTypeNumber=function(e){let t=e<<12;for(;i(t)-i(n)>=0;)t^=n<<i(t)-i(n);return e<<12|t},r.getPatternPosition=function(t){return e[t-1]},r.getMaskFunction=function(e){switch(e){case RT.PATTERN000:return function(e,t){return(e+t)%2==0};case RT.PATTERN001:return function(e,t){return e%2==0};case RT.PATTERN010:return function(e,t){return t%3==0};case RT.PATTERN011:return function(e,t){return(e+t)%3==0};case RT.PATTERN100:return function(e,t){return(Math.floor(e/2)+Math.floor(t/3))%2==0};case RT.PATTERN101:return function(e,t){return e*t%2+e*t%3==0};case RT.PATTERN110:return function(e,t){return(e*t%2+e*t%3)%2==0};case RT.PATTERN111:return function(e,t){return(e*t%3+(e+t)%2)%2==0};default:throw`bad maskPattern:`+e}},r.getErrorCorrectPolynomial=function(e){let t=VT([1],0);for(let n=0;n<e;n+=1)t=t.multiply(VT([1,BT.gexp(n)],0));return t},r.getLengthInBits=function(e,t){if(1<=t&&t<10)switch(e){case IT.MODE_NUMBER:return 10;case IT.MODE_ALPHA_NUM:return 9;case IT.MODE_8BIT_BYTE:return 8;case IT.MODE_KANJI:return 8;default:throw`mode:`+e}else if(t<27)switch(e){case IT.MODE_NUMBER:return 12;case IT.MODE_ALPHA_NUM:return 11;case IT.MODE_8BIT_BYTE:return 16;case IT.MODE_KANJI:return 10;default:throw`mode:`+e}else if(t<41)switch(e){case IT.MODE_NUMBER:return 14;case IT.MODE_ALPHA_NUM:return 13;case IT.MODE_8BIT_BYTE:return 16;case IT.MODE_KANJI:return 12;default:throw`mode:`+e}else throw`type:`+t},r.getLostPoint=function(e){let t=e.getModuleCount(),n=0;for(let r=0;r<t;r+=1)for(let i=0;i<t;i+=1){let a=0,o=e.isDark(r,i);for(let n=-1;n<=1;n+=1)if(!(r+n<0||t<=r+n))for(let s=-1;s<=1;s+=1)i+s<0||t<=i+s||n==0&&s==0||o==e.isDark(r+n,i+s)&&(a+=1);a>5&&(n+=3+a-5)}for(let r=0;r<t-1;r+=1)for(let i=0;i<t-1;i+=1){let t=0;e.isDark(r,i)&&(t+=1),e.isDark(r+1,i)&&(t+=1),e.isDark(r,i+1)&&(t+=1),e.isDark(r+1,i+1)&&(t+=1),(t==0||t==4)&&(n+=3)}for(let r=0;r<t;r+=1)for(let i=0;i<t-6;i+=1)e.isDark(r,i)&&!e.isDark(r,i+1)&&e.isDark(r,i+2)&&e.isDark(r,i+3)&&e.isDark(r,i+4)&&!e.isDark(r,i+5)&&e.isDark(r,i+6)&&(n+=40);for(let r=0;r<t;r+=1)for(let i=0;i<t-6;i+=1)e.isDark(i,r)&&!e.isDark(i+1,r)&&e.isDark(i+2,r)&&e.isDark(i+3,r)&&e.isDark(i+4,r)&&!e.isDark(i+5,r)&&e.isDark(i+6,r)&&(n+=40);let r=0;for(let n=0;n<t;n+=1)for(let i=0;i<t;i+=1)e.isDark(i,n)&&(r+=1);let i=Math.abs(100*r/t/t-50)/5;return n+=i*10,n},r}(),BT=function(){let e=Array(256),t=Array(256);for(let t=0;t<8;t+=1)e[t]=1<<t;for(let t=8;t<256;t+=1)e[t]=e[t-4]^e[t-5]^e[t-6]^e[t-8];for(let n=0;n<255;n+=1)t[e[n]]=n;let n={};return n.glog=function(e){if(e<1)throw`glog(`+e+`)`;return t[e]},n.gexp=function(t){for(;t<0;)t+=255;for(;t>=256;)t-=255;return e[t]},n}(),VT=function(e,t){if(e.length===void 0)throw e.length+`/`+t;let n=function(){let n=0;for(;n<e.length&&e[n]==0;)n+=1;let r=Array(e.length-n+t);for(let t=0;t<e.length-n;t+=1)r[t]=e[t+n];return r}(),r={};return r.getAt=function(e){return n[e]},r.getLength=function(){return n.length},r.multiply=function(e){let t=Array(r.getLength()+e.getLength()-1);for(let n=0;n<r.getLength();n+=1)for(let i=0;i<e.getLength();i+=1)t[n+i]^=BT.gexp(BT.glog(r.getAt(n))+BT.glog(e.getAt(i)));return VT(t,0)},r.mod=function(e){if(r.getLength()-e.getLength()<0)return r;let t=BT.glog(r.getAt(0))-BT.glog(e.getAt(0)),n=Array(r.getLength());for(let e=0;e<r.getLength();e+=1)n[e]=r.getAt(e);for(let r=0;r<e.getLength();r+=1)n[r]^=BT.gexp(BT.glog(e.getAt(r))+t);return VT(n,0).mod(e)},r},HT=function(){let e=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12,7,37,13],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],t=function(e,t){let n={};return n.totalCount=e,n.dataCount=t,n},n={},r=function(t,n){switch(n){case LT.L:return e[(t-1)*4+0];case LT.M:return e[(t-1)*4+1];case LT.Q:return e[(t-1)*4+2];case LT.H:return e[(t-1)*4+3];default:return}};return n.getRSBlocks=function(e,n){let i=r(e,n);if(i===void 0)throw`bad rs block @ typeNumber:`+e+`/errorCorrectionLevel:`+n;let a=i.length/3,o=[];for(let e=0;e<a;e+=1){let n=i[e*3+0],r=i[e*3+1],a=i[e*3+2];for(let e=0;e<n;e+=1)o.push(t(r,a))}return o},n}(),UT=function(){let e=[],t=0,n={};return n.getBuffer=function(){return e},n.getAt=function(t){let n=Math.floor(t/8);return(e[n]>>>7-t%8&1)==1},n.put=function(e,t){for(let r=0;r<t;r+=1)n.putBit((e>>>t-r-1&1)==1)},n.getLengthInBits=function(){return t},n.putBit=function(n){let r=Math.floor(t/8);e.length<=r&&e.push(0),n&&(e[r]|=128>>>t%8),t+=1},n},WT=function(e){let t=IT.MODE_NUMBER,n=e,r={};r.getMode=function(){return t},r.getLength=function(e){return n.length},r.write=function(e){let t=n,r=0;for(;r+2<t.length;)e.put(i(t.substring(r,r+3)),10),r+=3;r<t.length&&(t.length-r==1?e.put(i(t.substring(r,r+1)),4):t.length-r==2&&e.put(i(t.substring(r,r+2)),7))};let i=function(e){let t=0;for(let n=0;n<e.length;n+=1)t=t*10+a(e.charAt(n));return t},a=function(e){if(`0`<=e&&e<=`9`)return e.charCodeAt(0)-48;throw`illegal char :`+e};return r},GT=function(e){let t=IT.MODE_ALPHA_NUM,n=e,r={};r.getMode=function(){return t},r.getLength=function(e){return n.length},r.write=function(e){let t=n,r=0;for(;r+1<t.length;)e.put(i(t.charAt(r))*45+i(t.charAt(r+1)),11),r+=2;r<t.length&&e.put(i(t.charAt(r)),6)};let i=function(e){if(`0`<=e&&e<=`9`)return e.charCodeAt(0)-48;if(`A`<=e&&e<=`Z`)return e.charCodeAt(0)-65+10;switch(e){case` `:return 36;case`$`:return 37;case`%`:return 38;case`*`:return 39;case`+`:return 40;case`-`:return 41;case`.`:return 42;case`/`:return 43;case`:`:return 44;default:throw`illegal char :`+e}};return r},KT=function(e){let t=IT.MODE_8BIT_BYTE,n=FT.stringToBytes(e),r={};return r.getMode=function(){return t},r.getLength=function(e){return n.length},r.write=function(e){for(let t=0;t<n.length;t+=1)e.put(n[t],8)},r},qT=function(e){let t=IT.MODE_KANJI,n=FT.stringToBytes;(function(e,t){let r=n(e);if(r.length!=2||(r[0]<<8|r[1])!=t)throw`sjis not supported.`})(`友`,38726);let r=n(e),i={};return i.getMode=function(){return t},i.getLength=function(e){return~~(r.length/2)},i.write=function(e){let t=r,n=0;for(;n+1<t.length;){let r=(255&t[n])<<8|255&t[n+1];if(33088<=r&&r<=40956)r-=33088;else if(57408<=r&&r<=60351)r-=49472;else throw`illegal char at `+(n+1)+`/`+r;r=(r>>>8&255)*192+(r&255),e.put(r,13),n+=2}if(n<t.length)throw`illegal char at `+(n+1)},i},JT=function(){let e=[],t={};return t.writeByte=function(t){e.push(t&255)},t.writeShort=function(e){t.writeByte(e),t.writeByte(e>>>8)},t.writeBytes=function(e,n,r){n||=0,r||=e.length;for(let i=0;i<r;i+=1)t.writeByte(e[i+n])},t.writeString=function(e){for(let n=0;n<e.length;n+=1)t.writeByte(e.charCodeAt(n))},t.toByteArray=function(){return e},t.toString=function(){let t=``;t+=`[`;for(let n=0;n<e.length;n+=1)n>0&&(t+=`,`),t+=e[n];return t+=`]`,t},t},YT=function(){let e=0,t=0,n=0,r=``,i={},a=function(e){r+=String.fromCharCode(o(e&63))},o=function(e){if(e<0)throw`n:`+e;if(e<26)return 65+e;if(e<52)return 97+(e-26);if(e<62)return 48+(e-52);if(e==62)return 43;if(e==63)return 47;throw`n:`+e};return i.writeByte=function(r){for(e=e<<8|r&255,t+=8,n+=1;t>=6;)a(e>>>t-6),t-=6},i.flush=function(){if(t>0&&(a(e<<6-t),e=0,t=0),n%3!=0){let e=3-n%3;for(let t=0;t<e;t+=1)r+=`=`}},i.toString=function(){return r},i},XT=function(e){let t=e,n=0,r=0,i=0,a={};a.read=function(){for(;i<8;){if(n>=t.length){if(i==0)return-1;throw`unexpected end of file./`+i}let e=t.charAt(n);if(n+=1,e==`=`)return i=0,-1;e.match(/^\s$/)||(r=r<<6|o(e.charCodeAt(0)),i+=6)}let e=r>>>i-8&255;return i-=8,e};let o=function(e){if(65<=e&&e<=90)return e-65;if(97<=e&&e<=122)return e-97+26;if(48<=e&&e<=57)return e-48+52;if(e==43)return 62;if(e==47)return 63;throw`c:`+e};return a},ZT=function(e,t){let n=e,r=t,i=Array(e*t),a={};a.setPixel=function(e,t,r){i[t*n+e]=r},a.write=function(e){e.writeString(`GIF87a`),e.writeShort(n),e.writeShort(r),e.writeByte(128),e.writeByte(0),e.writeByte(0),e.writeByte(0),e.writeByte(0),e.writeByte(0),e.writeByte(255),e.writeByte(255),e.writeByte(255),e.writeString(`,`),e.writeShort(0),e.writeShort(0),e.writeShort(n),e.writeShort(r),e.writeByte(0);let t=s(2);e.writeByte(2);let i=0;for(;t.length-i>255;)e.writeByte(255),e.writeBytes(t,i,255),i+=255;e.writeByte(t.length-i),e.writeBytes(t,i,t.length-i),e.writeByte(0),e.writeString(`;`)};let o=function(e){let t=e,n=0,r=0,i={};return i.write=function(e,i){if(e>>>i)throw`length over`;for(;n+i>=8;)t.writeByte(255&(e<<n|r)),i-=8-n,e>>>=8-n,r=0,n=0;r=e<<n|r,n+=i},i.flush=function(){n>0&&t.writeByte(r)},i},s=function(e){let t=1<<e,n=(1<<e)+1,r=e+1,a=c();for(let e=0;e<t;e+=1)a.add(String.fromCharCode(e));a.add(String.fromCharCode(t)),a.add(String.fromCharCode(n));let s=JT(),l=o(s);l.write(t,r);let u=0,d=String.fromCharCode(i[u]);for(u+=1;u<i.length;){let e=String.fromCharCode(i[u]);u+=1,a.contains(d+e)?d+=e:(l.write(a.indexOf(d),r),a.size()<4095&&(a.size()==1<<r&&(r+=1),a.add(d+e)),d=e)}return l.write(a.indexOf(d),r),l.write(n,r),l.flush(),s.toByteArray()},c=function(){let e={},t=0,n={};return n.add=function(r){if(n.contains(r))throw`dup key:`+r;e[r]=t,t+=1},n.size=function(){return t},n.indexOf=function(t){return e[t]},n.contains=function(t){return e[t]!==void 0},n};return a},QT=function(e,t,n){let r=ZT(e,t);for(let i=0;i<t;i+=1)for(let t=0;t<e;t+=1)r.setPixel(t,i,n(t,i));let i=JT();r.write(i);let a=YT(),o=i.toByteArray();for(let e=0;e<o.length;e+=1)a.writeByte(o[e]);return a.flush(),`data:image/gif;base64,`+a};FT.stringToBytes;var $T=()=>Pe.api.v1.workspace.phones,eE=`/workspace/phones`,tE={list:[`workspace`,`phones`]};async function nE(e){return we(await $T().$get({},{init:{signal:e?.signal}}),eE)}async function rE(){return we(await $T().pairing.$post({}),`${eE}/pairing`)}async function iE(e){return we(await $T().pairing[`:id`].code.$post({param:{id:e}}),`${eE}/pairing/${e}/code`)}async function aE(e){return we(await $T().pairing[`:id`].approve.$post({param:{id:e}}),`${eE}/pairing/${e}/approve`)}async function oE(e){return we(await $T().pairing[`:id`].deny.$post({param:{id:e}}),`${eE}/pairing/${e}/deny`)}async function sE(e,t){return we(await $T()[`:deviceId`].$patch({param:{deviceId:e},json:{label:t}}),`${eE}/${e}`)}async function cE(e){return we(await $T()[`:deviceId`].$delete({param:{deviceId:e}}),`${eE}/${e}`)}async function lE(e,t){return we(await $T().relay.$put({json:{address:e,dropPhones:t}}),`${eE}/relay`)}async function uE(e){return we(await $T().relay.test.$post({json:{address:e}}),`${eE}/relay/test`)}function dE(){let e=W();return(0,Z.useEffect)(()=>Jr(t=>{t===`phone-pairing`&&e.invalidateQueries({queryKey:tE.list})}),[e]),gt({queryKey:tE.list,queryFn:({signal:e})=>nE({signal:e})})}var fE={"invalid-address":`That is not a relay address. Use https://host, or http:// only for 127.0.0.1, localhost or [::1], with no path.`,unreachable:`Could not reach that address. Check it, and that the relay is running.`,"not-a-relay":`Something answered, but it is not a cezar relay.`,incompatible:`This relay speaks a protocol version this cezar does not. Update whichever is older.`,"rate-limited":`The relay is limiting checks from this computer. Try again later.`,disabled:`The relay is switched off by its operator. Try again later.`,refused:`The relay refused the check. Make sure this computer’s clock is right.`};function pE({source:e}){return e===`env`?(0,Q.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Set by `,(0,Q.jsx)(`code`,{children:`CEZ_RELAY_URL`}),` in the environment cezar started with, so it cannot be changed here. Unset it and restart cezar to use this field.`]}):(0,Q.jsxs)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:[(0,Q.jsx)(`code`,{children:`CEZ_RELAY_URL`}),` is set, but it is not a valid relay address, so phones cannot connect. Fix or unset it, then restart cezar.`]})}function mE({phones:e,onSaved:t}){let n=W(),{relayOrigin:r,relaySource:i}=e,a=i===`env`||i===`env-invalid`,[o,s]=(0,Z.useState)(null),[c,l]=(0,Z.useState)(null),[u,d]=(0,Z.useState)(null),[f,p]=(0,Z.useState)(null),m=o??r,h=m.trim(),g=e.phones.length,_=U({mutationFn:e=>uE(e),onMutate:()=>{l(null),d(null)},onSuccess:(e,t)=>{e.ok?l(t):d(fE[e.reason])},onError:e=>d(e.message)}),v=U({mutationFn:e=>lE(e,g>0),onSuccess:e=>{n.setQueryData(tE.list,e),s(null),l(null),d(null),p(null),t(),Y(e.relaySource===`settings`?`Relay address saved`:`Using the default relay`)},onError:e=>{p(null),d(e.message)}}),y=e=>{g>0?p({address:e}):v.mutate(e)};return(0,Q.jsxs)(`div`,{className:`space-y-3 pt-2`,children:[(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(`label`,{htmlFor:`relay-address-input`,className:`text-sm`,children:`Relay address`}),(0,Q.jsx)(qs,{id:`relay-address-input`,className:`max-w-xl`,value:i===`env-invalid`?``:m,placeholder:a?void 0:`https://relay.example.com`,readOnly:a||_.isPending,inputMode:`url`,autoCapitalize:`none`,autoCorrect:`off`,spellCheck:!1,maxLength:300,onChange:e=>{s(e.target.value),l(null),d(null)}})]}),a?(0,Q.jsx)(pE,{source:i}):(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Only needed to use your own relay.`}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[i===`env-invalid`?null:(0,Q.jsx)(J,{variant:`outline`,size:`sm`,disabled:!h||_.isPending,onClick:()=>_.mutate(h),children:_.isPending?`Testing…`:`Test`}),a?null:(0,Q.jsx)(J,{size:`sm`,disabled:c!==h||h===r||v.isPending,onClick:()=>y(h),children:`Save`}),i===`settings`?(0,Q.jsx)(J,{variant:`ghost`,size:`sm`,disabled:v.isPending,onClick:()=>y(null),children:`Use default`}):null]}),c===h&&h?(0,Q.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:`This relay answered and speaks a compatible protocol version.`}):null,u?(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:u}):null,(0,Q.jsx)(vs,{open:f!==null,onOpenChange:e=>{e||p(null)},children:(0,Q.jsxs)(ps,{children:[(0,Q.jsxs)(_s,{children:[(0,Q.jsx)(fs,{children:f?.address===null?`Use the default relay?`:`Change the relay address?`}),(0,Q.jsxs)(ds,{children:[g===1?`Your phone disconnects now and leaves the list.`:`All ${g} phones disconnect now and leave the list.`,` To use `,g===1?`it`:`them`,` again, pair `,g===1?`it`:`them`,` again.`]})]}),(0,Q.jsxs)(hs,{children:[(0,Q.jsx)(gs,{disabled:v.isPending,children:`Cancel`}),(0,Q.jsx)(ms,{disabled:v.isPending,onClick:()=>{f&&v.mutate(f.address)},children:f?.address===null?`Use default and disconnect`:`Change and disconnect`})]})]})})]})}var hE={off:`not connected, because no phone is paired`,connecting:`connecting`,connected:`connected`,unreachable:`unreachable. Retrying`,replaced:`another cezar on this computer holds the connection`,"rate-limited":`too many connections. Retrying soon`,quota:`too much traffic today. Retrying later`,disabled:`switched off by its operator. Retrying later`,"update-required":`update cezar to keep using it`,locked:`the keychain is locked`,error:`stopped`},gE={"device-limit":`This relay cannot take another phone. Remove one first.`,"relay-error":`The relay did not confirm the phone, so it was not added.`,timeout:`Nobody answered in time.`,cancelled:`The pairing was cancelled.`,contested:`A second phone tried to use this code, so it was cancelled. Show a new code and try again.`,"bad-payload":`The phone sent something cezar cannot read.`,"tunnel-unsupported":`This phone and this cezar need updating to work together.`,"phone-left":`The phone went away before pairing finished.`},_E=new Set([`waiting`,`handshaking`,`confirm`,`approving`]);function vE({value:e}){let{path:t,size:n}=(0,Z.useMemo)(()=>{let t=FT(0,`M`);t.addData(e,`Byte`),t.make();let n=t.getModuleCount(),r=``;for(let e=0;e<n;e+=1)for(let i=0;i<n;i+=1)t.isDark(e,i)&&(r+=`M${i+4} ${e+4}h1v1h-1z`);return{path:r,size:n+8}},[e]);return(0,Q.jsx)(`svg`,{role:`img`,"aria-label":`QR code to scan with the Cezar app`,viewBox:`0 0 ${n} ${n}`,className:`size-56 rounded-md bg-qr-ground`,shapeRendering:`crispEdges`,children:(0,Q.jsx)(`path`,{d:t,className:`fill-qr-module`})})}function yE(e){let[t,n]=(0,Z.useState)(()=>Date.now());return(0,Z.useEffect)(()=>{if(!e)return;n(Date.now());let t=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(t)},[e]),e?Math.max(0,Math.ceil((Date.parse(e)-t)/1e3)):0}var bE=e=>`${Math.floor(e/60)}:${String(e%60).padStart(2,`0`)}`;function xE(e){return e.connected?`Connected`:e.lastSeenAt?`Seen ${new Date(e.lastSeenAt).toLocaleString()}`:`Not connected yet`}function SE({pairing:e,onDecide:t,deciding:n}){return(0,Q.jsx)(vs,{open:!0,children:(0,Q.jsxs)(ps,{children:[(0,Q.jsxs)(_s,{children:[(0,Q.jsx)(fs,{children:`Add this phone?`}),(0,Q.jsx)(ds,{children:`Check that your phone shows the same number. This phone can run tasks on this computer, with everything a task can do.`})]}),(0,Q.jsx)(`p`,{className:`text-center font-mono text-5xl font-semibold tracking-widest tabular-nums`,"data-testid":`phone-digits`,children:e.digits}),(0,Q.jsxs)(`p`,{className:`text-center text-sm text-muted-foreground`,children:[e.phone?.name,` (`,e.phone?.platform,`), as reported by the phone`]}),(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Approve only if you scanned or typed this inside the Cezar app, on your own phone.`}),(0,Q.jsxs)(hs,{children:[(0,Q.jsx)(gs,{disabled:n,onClick:()=>t(!1),children:`Deny`}),(0,Q.jsx)(ms,{disabled:n,onClick:()=>t(!0),children:`Approve`})]})]})})}function CE({phone:e,onRemove:t}){let n=W(),[r,i]=(0,Z.useState)(!1),[a,o]=(0,Z.useState)(e.label),s=U({mutationFn:()=>sE(e.deviceId,a.trim()),onSuccess:async()=>{i(!1),await n.invalidateQueries({queryKey:tE.list})},onError:e=>Y(e.message,{tone:`danger`})});return(0,Q.jsxs)(`li`,{className:`flex items-center gap-3 py-2`,children:[(0,Q.jsx)(Ma,{className:`size-4 shrink-0 text-muted-foreground`,"aria-hidden":!0}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[r?(0,Q.jsx)(`form`,{onSubmit:e=>{e.preventDefault(),a.trim()&&s.mutate()},children:(0,Q.jsx)(qs,{"aria-label":`Phone name`,value:a,maxLength:64,autoFocus:!0,onChange:e=>o(e.target.value),onBlur:()=>i(!1)})}):(0,Q.jsx)(`p`,{className:`truncate text-sm`,children:e.label}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:xE(e)})]}),(0,Q.jsx)(J,{variant:`ghost`,size:`icon`,"aria-label":`Rename ${e.label}`,onClick:()=>{o(e.label),i(!0)},children:(0,Q.jsx)(lo,{className:`size-4`,"aria-hidden":!0})}),(0,Q.jsx)(J,{variant:`ghost`,size:`icon`,"aria-label":`Remove ${e.label}`,onClick:t,children:(0,Q.jsx)(Qo,{className:`size-4`,"aria-hidden":!0})})]})}function wE(){let e=W(),t=dE(),[n,r]=(0,Z.useState)(null),[i,a]=(0,Z.useState)(null),[o,s]=(0,Z.useState)(null),[c,l]=(0,Z.useState)(null),u=()=>e.invalidateQueries({queryKey:tE.list}),d=t.data?.pairing??null,f=n&&d?.id===n.id?d:null,p=yE(n?.expiresAt),m=n!==null&&(f===null||f.status===`waiting`)&&p>0,h=U({mutationFn:rE,onMutate:()=>{s(null),a(null)},onSuccess:async e=>{r(e),await u()},onError:e=>s(e.message)}),g=U({mutationFn:e=>iE(e),onSuccess:e=>a(e.code),onError:e=>s(e.message)}),_=U({mutationFn:({id:e,approve:t})=>t?aE(e):oE(e),onSuccess:u,onError:e=>Y(e.message,{tone:`danger`})}),v=U({mutationFn:e=>cE(e),onSuccess:async()=>{l(null),await u()},onError:e=>Y(e.message,{tone:`danger`})});(0,Z.useEffect)(()=>{f?.status===`approved`&&(Y(`${f.phone?.name??`Phone`} added`),r(null))},[f?.status,f?.phone?.name]);let y=(0,Z.useRef)(null);y.current=n&&(!f||_E.has(f.status))?n.id:null,(0,Z.useEffect)(()=>()=>{y.current&&oE(y.current).catch(()=>{})},[]);let b=f?.status===`failed`?gE[f.failure??`phone-left`]:null,x=f?.status===`denied`?`You denied that phone. Nothing was added.`:null,S=n!==null&&!m&&(f===null||f.status===`expired`||f.status===`waiting`),C=t.data?.relay,w=t.data?.phones??[],T=t.data?.relaySource===`env-invalid`;return(0,Q.jsxs)(`div`,{className:`space-y-6 p-4 md:p-6`,children:[(0,Q.jsxs)(`section`,{"aria-labelledby":`connect-phone`,className:`space-y-3`,children:[(0,Q.jsx)(`h2`,{id:`connect-phone`,className:`text-sm font-medium`,children:`Connect a phone`}),m?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-start`,children:[(0,Q.jsx)(vE,{value:n.qr}),(0,Q.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[(0,Q.jsx)(`p`,{children:`Scan this inside the Cezar app, not with your camera app.`}),(0,Q.jsxs)(`p`,{className:`text-muted-foreground`,"aria-live":`off`,children:[`Expires in `,bE(p)]}),i?(0,Q.jsxs)(`dl`,{className:`space-y-1`,children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Code`}),(0,Q.jsx)(`dd`,{className:`font-mono text-lg tracking-wider`,children:i}),(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Relay address`}),(0,Q.jsx)(`dd`,{className:`font-mono break-all`,children:n.relayOrigin})]}):(0,Q.jsx)(J,{variant:`outline`,size:`sm`,disabled:g.isPending,onClick:()=>g.mutate(n.id),children:`Type a code instead`}),i?(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`The QR code is safer: only it lets the app check it reached this computer.`}):null]})]}):(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Traffic crosses the relay encrypted. The relay can drop it, not read it. You confirm each phone here.`}),(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`The relay is end-to-end encrypted, so it cannot read prompts, code or keys. It does see IP addresses and the timing and volume of traffic.`}),(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Scan only inside the Cezar app. A camera app opens the code in a browser, where a relay you do not run could read it and pair as a phone.`}),T?(0,Q.jsxs)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:[(0,Q.jsx)(`code`,{children:`CEZ_RELAY_URL`}),` is not a valid relay address. Fix or unset it, then restart cezar.`]}):null,(0,Q.jsx)(J,{disabled:h.isPending||T,onClick:()=>h.mutate(),children:S||b||x?`Show a new code`:`Connect a phone`})]}),f?.status===`handshaking`?(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Phone found. Checking it…`}):null,f?.status===`approving`?(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Adding the phone…`}):null,b??x?(0,Q.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:b??x}):null,o?(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:o}):null]}),(0,Q.jsxs)(`section`,{"aria-labelledby":`your-phones`,className:`space-y-2`,children:[(0,Q.jsx)(`h2`,{id:`your-phones`,className:`text-sm font-medium`,children:`Your phones`}),t.isError?(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:t.error.message}):null,w.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No phones yet.`}):(0,Q.jsx)(`ul`,{className:`divide-y divide-border`,children:w.map(e=>(0,Q.jsx)(CE,{phone:e,onRemove:()=>l(e)},e.deviceId))}),t.data?.undeniedGrants?(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`The relay could not cancel every notification permission for a removed phone. It lapses within 90 days.`}):null]}),C?(0,Q.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Relay: `,hE[C.status],C.detail?` (${C.detail})`:``]}):null,t.data?(0,Q.jsxs)(us,{children:[(0,Q.jsx)(ls,{asChild:!0,children:(0,Q.jsxs)(J,{variant:`ghost`,size:`sm`,className:`group -ml-2`,children:[(0,Q.jsx)(Qa,{className:`size-4 transition-transform group-data-[state=open]:rotate-90`,"aria-hidden":!0}),`Advanced`]})}),(0,Q.jsx)(cs,{children:(0,Q.jsx)(mE,{phones:t.data,onSaved:()=>{r(null),a(null),s(null)}})})]}):null,d?.status===`confirm`?(0,Q.jsx)(SE,{pairing:d,deciding:_.isPending,onDecide:e=>_.mutate({id:d.id,approve:e})}):null,(0,Q.jsx)(vs,{open:c!==null,onOpenChange:e=>{e||l(null)},children:(0,Q.jsxs)(ps,{children:[(0,Q.jsxs)(_s,{children:[(0,Q.jsxs)(fs,{children:[`Remove `,c?.label,`?`]}),(0,Q.jsx)(ds,{children:`It loses access to this computer at once. To use it again, pair it again.`})]}),(0,Q.jsxs)(hs,{children:[(0,Q.jsx)(gs,{children:`Cancel`}),(0,Q.jsx)(ms,{onClick:()=>{c&&v.mutate(c.deviceId)},children:`Remove`})]})]})})]})}function TE(){let e=nt(),t=z_(),[n,r]=Z.useState(!1),i=e.data,a=i?.blockedBy??null;return(0,Q.jsx)(`div`,{"data-slot":`privacy-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,Q.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:(0,Q.jsx)(`label`,{htmlFor:`telemetry-enabled`,children:`Share usage data`})}),(0,Q.jsxs)(`p`,{className:`text-ui text-muted-foreground`,children:[`Task counts and crash reports, sent to cezar’s maintainers at Open Mercato`,i?(0,Q.jsxs)(Q.Fragment,{children:[` (`,(0,Q.jsx)(`span`,{className:`font-mono text-label`,children:i.endpoint}),`)`]}):null,`. Never prompts, code, diffs, paths or repository names. Off unless you turn it on; turning it off deletes this machine’s install id.`]})]}),(0,Q.jsx)(jf,{id:`telemetry-enabled`,"data-slot":`telemetry-toggle`,checked:i?.consent===`granted`,disabled:!i||n,onCheckedChange:e=>{r(!0),t(e?`granted`:`denied`).finally(()=>r(!1))}})]}),a===`env`?(0,Q.jsxs)(`p`,{"data-slot":`telemetry-blocked`,className:`text-ui text-muted-foreground`,children:[(0,Q.jsx)(`code`,{className:`font-mono text-label`,children:`CEZ_TELEMETRY=0`}),` or`,` `,(0,Q.jsx)(`code`,{className:`font-mono text-label`,children:`DO_NOT_TRACK=1`}),` is set for this server, so nothing is sent whatever this switch says.`]}):a===`automation`?(0,Q.jsxs)(`p`,{"data-slot":`telemetry-blocked`,className:`text-ui text-muted-foreground`,children:[`This server runs under CI, a test runner or `,(0,Q.jsx)(`code`,{className:`font-mono text-label`,children:`CEZ_DRY_RUN=1`}),`, so nothing is sent from it.`]}):null,(0,Q.jsxs)(`a`,{href:P_,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex w-fit items-center gap-1 text-ui text-muted-foreground underline-offset-4 hover:text-foreground hover:underline`,children:[`Exactly what is collected`,(0,Q.jsx)(ka,{className:`size-3.5`,"aria-hidden":`true`})]})]})})}var EE=400,DE=Symbol(`none`),OE=e=>e===null?``:String(e);function kE({value:e,min:t,max:n,onCommit:r,allowEmpty:i=!1,emptyStepFrom:a,placeholder:o,disabled:s,"aria-label":c,"data-slot":l,className:u}){let d=(0,Z.useId)(),[f,p]=(0,Z.useState)(()=>OE(e)),m=(0,Z.useRef)(f),h=(0,Z.useRef)(null),g=(0,Z.useRef)(DE),_=(0,Z.useRef)({value:e,onCommit:r});_.current={value:e,onCommit:r};let v=e=>{m.current=e,p(e)};(0,Z.useEffect)(()=>{g.current=DE,h.current===null&&v(OE(e))},[e]);let y=(0,Z.useRef)(()=>{});(0,Z.useEffect)(()=>()=>{h.current!==null&&y.current()},[]);let b=e=>{let r=e.trim();if(r===``)return i?null:`invalid`;if(!/^-?\d+$/.test(r))return`invalid`;let a=Number(r);return a<t||a>n?`invalid`:a},x=b(f),S=x===`invalid`,C=()=>{h.current!==null&&(clearTimeout(h.current),h.current=null);let{value:e,onCommit:t}=_.current,n=b(m.current);if(n===`invalid`||n===e||g.current!==DE&&n===g.current)return;let r=t(n);r instanceof Promise&&(g.current=n,r.catch(()=>{g.current===n&&(g.current=DE),v(OE(_.current.value))}))};y.current=C;let w=e=>{let r=b(m.current),i=r===null?a??t:r===`invalid`?(_.current.value??a??t)+e:r+e;v(String(Math.min(n,Math.max(t,i)))),h.current!==null&&clearTimeout(h.current),h.current=setTimeout(C,EE)},T=t=>{t.key===`ArrowUp`||t.key===`ArrowDown`?(t.preventDefault(),w(t.key===`ArrowUp`?1:-1)):t.key===`Enter`?(t.preventDefault(),C()):t.key===`Escape`&&(h.current!==null&&clearTimeout(h.current),h.current=null,v(OE(e)))},E=typeof x==`number`?x:null,D=`flex h-1/2 w-6 items-center justify-center text-soft-foreground hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-40`;return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsxs)(`div`,{className:G(`flex w-28 items-stretch overflow-hidden rounded-md border border-input bg-card shadow-xs focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/50`,S&&`border-danger`,s&&`opacity-50`,u),children:[(0,Q.jsx)(`input`,{type:`text`,inputMode:`numeric`,role:`spinbutton`,"aria-label":c,"aria-valuemin":t,"aria-valuemax":n,"aria-valuenow":E??void 0,"aria-invalid":S||void 0,"aria-describedby":S?d:void 0,"data-slot":l,value:f,placeholder:o,disabled:s,onChange:e=>v(e.target.value),onBlur:C,onKeyDown:T,className:`min-w-0 flex-1 bg-transparent px-3 py-1.5 text-sm outline-none placeholder:text-soft-foreground`}),(0,Q.jsxs)(`div`,{className:`flex flex-col border-l border-input`,children:[(0,Q.jsx)(`button`,{type:`button`,tabIndex:-1,"aria-label":`Increase ${c}`,"data-action":`stepper-increment`,disabled:s||E!==null&&E>=n,onMouseDown:e=>e.preventDefault(),onClick:()=>w(1),className:D,children:(0,Q.jsx)(Pl,{className:`size-3.5`})}),(0,Q.jsx)(`button`,{type:`button`,tabIndex:-1,"aria-label":`Decrease ${c}`,"data-action":`stepper-decrement`,disabled:s||E!==null&&E<=t,onMouseDown:e=>e.preventDefault(),onClick:()=>w(-1),className:G(D,`border-t border-input`),children:(0,Q.jsx)(Xa,{className:`size-3.5`})})]})]}),S?(0,Q.jsxs)(`p`,{id:d,"data-slot":`stepper-invalid`,className:`text-meta text-danger`,children:[`Enter a whole number from `,t,` to `,n,i?`, or leave it empty`:``,`.`]}):null]})}var AE={inactive:`neutral`,active:`success`,paused:`neutral`,suspended:`pending`,disabled:`danger`},jE={inactive:`Inactive`,active:`Active`,paused:`Paused`,suspended:`Failing`,disabled:`Disabled`},ME={"cezar.json.v1":`Custom receiver`,"slack.v1":`Slack`,"discord.v1":`Discord`},NE={minimal:`Minimal`,standard:`Standard`},PE={main_and_questions:`Main tasks and questions from child tasks`,every_task:`Every task`},FE={attention:`Attention, review and results`,all:`All results`,custom:`Custom`},IE={0:`Immediately`,60:`1 minute`,180:`3 minutes`,600:`10 minutes`},LE={none:`Not tested`,success:`Passed`,transient_failure:`Failed — temporary error`,permanent_failure:`Failed`},RE={pending:`Queued`,in_flight:`Sending`,retrying:`Retrying`,blocked_policy:`Blocked by address policy`,delivered:`Delivered`,failed:`Failed`,superseded:`Superseded`,cancelled:`Cancelled`,dropped:`Dropped`},zE={timeout:`Receiver did not respond within 10 seconds`,connection_failed:`Could not connect to the receiver`,transport_failed:`Network error`,delivery_failed:`Delivery failed`,outcome_unknown:`Result unknown — it may have arrived`,rate_limited:`Rate limited`,expired:`Retry window ended`,aborted:`Stopped`,owner_restarted:`cezar restarted during delivery`,payload_invalid:`Message could not be built`,integrity_reset:`Webhook data was reset`,retained_capacity:`History storage is full`,newer_continuation:`A newer update replaced it`,operation_superseded:`A newer action replaced it`,failure_schedule_changed:`Automatic resume changed`,denied_address:`Address is never allowed`,local_network_consent_required:`Private-network delivery not allowed`,local_consent_required:`Private-network delivery not allowed`},BE={created:`Receiver added`,activated:`Activated`,resumed:`Resumed`,paused:`Paused`,deleted:`Deleted`,renamed:`Renamed`,configuration_changed:`Settings changed`,delivery_changed:`Delivery settings changed`,secret_rotated:`Signing key rotated`,test:`Test sent`,test_result:`Test result`,delivery_result:`Delivery result`,retry:`Retry requested`,replay:`Replay requested`,notice_acknowledged:`Change marked as reviewed`,history_pruned:`Old history removed`,integrity_reset:`Webhook data reset`},VE={"cockpit/api":`cockpit or API`,system:`cezar`};function HE(e){let t=e.replaceAll(`_`,` `).replace(/^http /i,`HTTP `);return t.charAt(0).toUpperCase()+t.slice(1)}var UE=e=>zE[e]??HE(e),WE=e=>BE[e]??HE(e);function GE(e,t,n){return`${e} ${e===1?t:n}`}function KE(e){try{if(e)return new Intl.DateTimeFormat(void 0,{timeZone:e}),{zone:e,label:e}}catch{}return{zone:void 0,label:`your local time`}}function qE(e,t){let n=new Date(e);return Number.isFinite(n.getTime())?n.toLocaleString(void 0,{timeZone:KE(t).zone,month:`short`,day:`numeric`,year:`numeric`,hour:`numeric`,minute:`2-digit`,timeZoneName:`short`}):`Time unavailable`}function JE(e){return{href:`https://github.com/open-mercato/cezar/blob/main/packages/cezar/docs/webhooks.md`,note:`Webhook guide`}}function YE(){let e=St();return{isPending:e.isPending,confirm:(t,n)=>e.mutate(t.id,{onSuccess:e=>{e.warning&&Y(e.warning,{tone:`danger`}),Y(`${t.name} removed from the workspace — its files are untouched`),n?.()},onError:e=>Y(e.message,{tone:`danger`})})}}function XE({project:e,onOpenChange:t,onConfirm:n}){let r=T(),i=Fx(e?.id??`default`,e!==null&&r.data?.capabilities?.webhooks===!0),a=i.data?.receivers.filter(e=>[`active`,`suspended`].includes(e.state))??[],o=a.reduce((e,t)=>e+t.pendingCount,0),s=a.reduce((e,t)=>e+t.inFlightCount,0);return(0,Q.jsx)(vs,{open:e!==null,onOpenChange:t,children:(0,Q.jsxs)(ps,{children:[(0,Q.jsxs)(_s,{children:[(0,Q.jsxs)(fs,{children:[`Remove `,e?.name,` from the workspace?`]}),(0,Q.jsxs)(ds,{children:[`This only unregisters the project — `,(0,Q.jsx)(`strong`,{children:`nothing on disk is deleted`}),`. The folder, its git history and its task history all stay exactly where they are, and adding it back later finds everything intact.`,a.length>0&&(0,Q.jsxs)(`span`,{className:`mt-2 block`,children:[GE(a.length,`receiver`,`receivers`),` will be paused. `,GE(o,`pending delivery`,`pending deliveries`),` will be cancelled; `,s,` in flight may still arrive.`]}),i.error&&(0,Q.jsx)(`span`,{className:`mt-2 block`,children:`Webhook state is unavailable. Removal will report whether receivers could be paused.`}),(0,Q.jsx)(`span`,{"data-testid":`remove-project-root`,className:`mt-1 block break-all font-mono text-meta text-foreground`,children:e?.root})]})]}),(0,Q.jsxs)(hs,{children:[(0,Q.jsx)(gs,{children:`Keep it`}),(0,Q.jsx)(ms,{"data-action":`projects-confirm-remove`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:n,children:`Remove from list`})]})]})})}var ZE=1,QE=16,$E={ok:`ok`,"not-git":`no git repo`,missing:`folder not found`};function eD(e){let t=new Date(e);return Number.isNaN(t.getTime())?`—`:t.toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function tD(){let e=qt(),t=a();return e.isPending||t.isPending?(0,Q.jsx)(`p`,{"data-slot":`projects-loading`,className:`p-4 text-ui text-soft-foreground md:p-6`,children:`Loading projects…`}):e.isError||t.isError?(0,Q.jsx)(gl,{icon:(0,Q.jsx)(Yl,{}),tone:`danger`,title:`Project settings did not load`,subtitle:(e.error??t.error)?.message,heading:`h2`}):(0,Q.jsx)(nD,{config:e.data,registry:t.data})}function nD({config:e,registry:t}){return(0,Q.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,Q.jsx)(rD,{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,Q.jsx)(rD,{configKey:`projectsDir`,value:e.projectsDir,title:`Default checkout folder`,hint:`Where “Clone from GitHub” and “New project” put 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,Q.jsx)(iD,{registry:t,workspaceMax:e.resources.maxParallel})]})}function rD({configKey:e,value:t,title:n,hint:r,placeholder:i,slot:a,savedLabel:o,footer:s,refreshProjects:c=!1}){let l=W(),u=U({mutationFn:t=>yn(e===`browseRoot`?{browseRoot:t}:{projectsDir:t}),onSuccess:t=>{l.setQueryData(V.config,t),e===`browseRoot`?l.invalidateQueries({queryKey:V.fsBrowseRoot}):c&&l.invalidateQueries({queryKey:V.projects})}}),[d,f]=(0,Z.useState)(t),p=d.trim(),m=p===t,h=u.isError?u.error.message:null;return(0,Q.jsxs)($,{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,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.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,Q.jsx)(J,{type:`button`,variant:`outline`,size:`sm`,"data-action":`projects-save-${a}-root`,disabled:m||p===``||u.isPending,onClick:()=>u.mutate(p,{onSuccess:()=>Y(`${o} set to ${p}`)}),children:`Save`})]}),h===null?(0,Q.jsx)(`p`,{className:`text-meta text-soft-foreground`,children:s}):(0,Q.jsxs)(`p`,{"data-slot":`projects-${a}-root-error`,role:`alert`,className:`text-meta text-danger`,children:[h,` — setting unchanged`]})]})}function iD({registry:e,workspaceMax:t}){let[n,r]=(0,Z.useState)(null),i=YE(),a=(0,Z.useMemo)(()=>Nt(e.projects),[e.projects]);return(0,Q.jsxs)($,{title:`Registered projects`,hint:`The folders you have added. While this list is empty the folder cezar is serving is listed as “not registered” with an Add button; once you have projects, starting cezar somewhere new neither registers nor lists that folder — use “Add project” when you want to keep it. “Tags” group connected repositories — give the API, the web app and the design system a shared “storefront” tag and the global Tasks page can show all three as one piece of work. “Max parallel” caps how many of that project's tasks run at once (leave it empty to inherit the workspace limit); the workspace limit (${t}) still applies as an overall ceiling, so a per-project value above it has no extra effect until the workspace limit is raised. Removing a project only unregisters it — no files on disk are deleted.`,children:[e.projects.length===0?(0,Q.jsx)(`p`,{"data-slot":`projects-empty`,className:`text-ui text-soft-foreground`,children:`No projects registered yet.`}):(0,Q.jsx)(`div`,{className:`overflow-x-auto rounded-md border border-border`,children:(0,Q.jsxs)(`table`,{className:`w-full border-collapse text-sm`,children:[(0,Q.jsx)(`caption`,{className:`sr-only`,children:`Projects in this workspace`}),(0,Q.jsxs)(`colgroup`,{children:[(0,Q.jsx)(`col`,{}),(0,Q.jsx)(`col`,{style:{width:`104px`}}),(0,Q.jsx)(`col`,{style:{width:`260px`}}),(0,Q.jsx)(`col`,{style:{width:`150px`}}),(0,Q.jsx)(`col`,{style:{width:`72px`}}),(0,Q.jsx)(`col`,{style:{width:`92px`}})]}),(0,Q.jsx)(`thead`,{children:(0,Q.jsxs)(`tr`,{className:`border-b border-border text-left text-label text-soft-foreground`,children:[(0,Q.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Project`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Status`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Tags`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Max parallel`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Added`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium text-right`,children:`Actions`})]})}),(0,Q.jsx)(`tbody`,{children:e.projects.map(n=>(0,Q.jsx)(aD,{project:n,isBoot:n.id===e.bootProject,workspaceMax:t,vocabulary:a,disabled:i.isPending,onRemove:()=>r(n)},n.id))})]})}),(0,Q.jsx)(XE,{project:n,onOpenChange:e=>!e&&r(null),onConfirm:()=>{if(!n)return;let e=n;r(null),i.confirm(e)}})]})}function aD({project:e,isBoot:t,workspaceMax:n,vocabulary:r,disabled:i,onRemove:a}){return(0,Q.jsxs)(`tr`,{"data-slot":`project-row`,"data-project":e.id,className:`border-b border-border last:border-0`,children:[(0,Q.jsxs)(`th`,{scope:`row`,className:`max-w-0 px-3 py-2 text-left font-normal`,children:[(0,Q.jsx)(`span`,{className:`block truncate text-foreground`,children:e.name}),(0,Q.jsx)(`span`,{className:`block truncate font-mono text-meta text-soft-foreground`,title:e.root,children:e.root})]}),(0,Q.jsxs)(`td`,{className:`px-3 py-2`,children:[(0,Q.jsx)(`span`,{"data-slot":`project-status`,className:e.status===`missing`?`text-label text-danger`:`text-label text-soft-foreground`,children:$E[e.status]}),e.unregistered?(0,Q.jsx)(`span`,{"data-slot":`project-unregistered`,className:`ml-1 text-meta text-soft-foreground`,children:`· not registered`}):e.status===`missing`?null:(0,Q.jsxs)(`span`,{className:`ml-1 text-meta text-soft-foreground`,children:[`· `,e.source]})]}),(0,Q.jsx)(`td`,{className:`px-3 py-2`,children:e.unregistered?(0,Q.jsx)(`span`,{className:`text-label text-soft-foreground`,children:`—`}):(0,Q.jsx)(sD,{project:e,vocabulary:r})}),(0,Q.jsx)(`td`,{className:`px-3 py-2`,children:e.unregistered?(0,Q.jsx)(`span`,{className:`text-label text-soft-foreground`,children:`—`}):(0,Q.jsx)(cD,{project:e,workspaceMax:n})}),(0,Q.jsx)(`td`,{className:`px-3 py-2 tabular-nums text-soft-foreground`,children:e.unregistered?`—`:eD(e.addedAt)}),(0,Q.jsxs)(`td`,{className:`px-3 py-2 text-right whitespace-nowrap`,children:[!e.unregistered&&e.status!==`missing`?(0,Q.jsx)(J,{asChild:!0,variant:`ghost`,size:`sm`,children:(0,Q.jsx)(Or,{to:`/p/${encodeURIComponent(e.id)}/settings`,"data-action":`project-settings`,"aria-label":`Settings for ${e.name}`,children:`Settings`})}):null,e.unregistered?(0,Q.jsx)(oD,{root:e.root,name:e.name,disabled:i,notAddable:e.notAddable===!0}):(0,Q.jsx)(J,{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 — stop it and use `cezar projects remove`":void 0,disabled:i||t,onClick:a,children:`Remove`})]})]})}function oD({root:e,name:t,disabled:n=!1,notAddable:r=!1}){let i=Yt();return(0,Q.jsx)(J,{type:`button`,variant:`outline`,size:`sm`,"data-action":`project-add-boot`,"aria-label":`Add ${t} to your projects`,title:r?`Your home directory or a cezar task worktree cannot be a project — start cezar in a project folder, or use Open local folder`:`cezar is serving this folder — save it to your projects`,disabled:n||r||i.isPending,onClick:()=>i.mutate(e,{onSuccess:()=>Y(`${t} added to your projects`),onError:e=>Y(e.message,{tone:`danger`})}),children:`Add project`})}function sD({project:e,vocabulary:t}){let n=sn(),[r,i]=(0,Z.useState)(``),[a,o]=(0,Z.useState)(!1),[s,c]=(0,Z.useState)(-1),l=(0,Z.useRef)(null),u=e.tags??[],d=at(t,u,r),f=a&&d.length>0,p=(t,r)=>{n.mutate({id:e.id,tags:t},{onSuccess:()=>Y(r),onError:e=>Y(e.message,{tone:`danger`})})},m=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){Y(`${e.name} already has the maximum of 20 tags`,{tone:`danger`});return}i(``),p([...u,n],`${e.name} tagged \u201c${n}\u201d`)}},h=t=>{p(u.filter(e=>e!==t),`\u201c${t}\u201d removed from ${e.name}`)},g=`project-tag-suggestions-${e.id}`;return(0,Q.jsxs)(`div`,{"data-slot":`project-tags`,className:`flex flex-wrap items-center gap-1`,children:[u.map(t=>(0,Q.jsxs)(`span`,{"data-slot":`project-tag`,className:`inline-flex max-w-full items-center gap-1 rounded-full bg-violet/15 py-px pr-1 pl-2 text-meta font-medium whitespace-nowrap text-violet`,children:[t,(0,Q.jsx)(`button`,{type:`button`,"data-action":`project-tag-remove`,"aria-label":`Remove tag ${t} from ${e.name}`,disabled:n.isPending,onClick:()=>h(t),className:`rounded-full p-0.5 hover:bg-violet/25 disabled:opacity-50`,children:(0,Q.jsx)(ns,{className:`size-3`,"aria-hidden":`true`})})]},t)),(0,Q.jsxs)(Is,{open:f,onOpenChange:o,children:[(0,Q.jsx)(Rs,{asChild:!0,children:(0,Q.jsx)(`input`,{ref:l,type:`text`,"data-slot":`project-tag-input`,"aria-label":`Add a tag to ${e.name}`,role:`combobox`,"aria-expanded":f,"aria-controls":f?g:void 0,"aria-autocomplete":`list`,"aria-activedescendant":f&&s>=0?`${g}-${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(d.length===0)return;e.preventDefault(),o(!0);let t=e.key===`ArrowDown`?1:-1,n=s+t;c(n>=d.length?-1:n<-1?d.length-1:n);return}if(e.key===`Escape`&&f){e.preventDefault(),o(!1),c(-1);return}if(e.key===`Enter`||e.key===`,`){e.preventDefault(),m(s>=0?d[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&&h(t)}},className:`h-6 w-16 min-w-0 flex-1 rounded-md border border-input bg-card px-1.5 text-label outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`})}),(0,Q.jsxs)(Ms,{align:`start`,sideOffset:4,id:g,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,Q.jsx)(`p`,{className:`px-2 pt-1 pb-1.5 text-micro text-soft-foreground`,children:`Tags used in this workspace`}),d.map((e,t)=>(0,Q.jsx)(`button`,{type:`button`,id:`${g}-${t}`,role:`option`,"aria-selected":t===s,"data-slot":`project-tag-suggestion`,onMouseDown:e=>e.preventDefault(),onClick:()=>{m(e),l.current?.focus()},onMouseEnter:()=>c(t),className:G(`flex w-full items-center rounded-sm px-2 py-1 text-left text-label font-medium text-violet`,t===s&&`bg-muted`),children:e},e))]})]})]})}function cD({project:e,workspaceMax:t}){let n=sn();return(0,Q.jsx)(kE,{"aria-label":`Max parallel tasks for ${e.name}`,"data-slot":`project-max-parallel`,value:e.maxParallel??null,min:ZE,max:QE,allowEmpty:!0,emptyStepFrom:Math.min(QE,Math.max(ZE,t)),placeholder:`Inherit (${t})`,className:`w-40`,onCommit:r=>n.mutateAsync({id:e.id,maxParallel:r},{onSuccess:()=>Y(r===null?`${e.name} inherits the workspace limit (${t})`:`${e.name} runs at most ${r} task${r===1?``:`s`} at a time`),onError:e=>Y(e.message,{tone:`danger`})})})}var lD=30,uD=100,dD=32,fD=60,pD=85,mD=e=>Math.min(100,Math.max(0,e));function hD(){xi({enabled:!Oi()});let e=Ci(),t=gi(),{isError:n}=_i(),r=Ti(),i=Si(),a=bi(),o=r===void 0?void 0:Di(r),s=o?.cpuPct,c=e===`local`,l=o?.memTotalBytes??0,u=o?.memUsedBytes!==void 0&&l>0?mD(o.memUsedBytes/l*100):0,d=s===void 0?void 0:s>pD?`bg-danger`:s>=fD?`bg-pending`:`bg-primary`,f=s===void 0?void 0:mD(s),p=i.length>=2?i.map((e,t)=>{let n=t/(lD-1)*uD,r=dD-mD(e.cpuPct)/100*dD;return`${n.toFixed(1)},${r.toFixed(1)}`}).join(` `):void 0,m=o===void 0||!o.cpuLimited?s===void 0?`sampling…`:`${Math.round(s)}%`:s===void 0?`—`:`${Math.round(s)}%`,h=o===void 0||!o.cpuLimited?void 0:`${o.cpuLimitKind===`cpuset`?`cpuset `:``}${vi(o.cpuCores)}`,g=o===void 0?void 0:`${o.memUsedBytes===void 0?`—`:_(o.memUsedBytes)} / ${_(o.memTotalBytes)}`;return(0,Q.jsxs)(`section`,{"data-slot":`machine-card`,"aria-labelledby":`machine-card-title`,className:`rounded-xl border border-border bg-card/60 p-4`,children:[(0,Q.jsxs)(`header`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(Nc,{tone:c?`success`:`neutral`,pulse:c}),(0,Q.jsx)(`h2`,{id:`machine-card-title`,className:`text-sm font-semibold`,children:`Machine`}),(0,Q.jsx)(`span`,{"data-slot":`machine-card-mode`,className:`text-meta text-soft-foreground`,children:c?`live`:`last known`}),(0,Q.jsx)(`span`,{"data-slot":`machine-card-freshness`,className:`ml-auto shrink-0 text-meta tabular-nums text-soft-foreground`,children:a===void 0?`waiting…`:`updated ${a} s ago`})]}),o?.hasContainer===!0?(0,Q.jsxs)(`p`,{"data-slot":`machine-card-limits`,className:`mt-2 text-meta text-soft-foreground`,children:[`cgroup limits detected · `,o.source]}):null,t?(0,Q.jsx)(`p`,{"data-slot":`machine-card-transport`,className:`mt-2 text-meta text-soft-foreground`,children:`The server refused this origin's host topic, so live values are polled from the authenticated route instead.`}):null,n&&r===void 0?(0,Q.jsx)(`p`,{"data-slot":`machine-card-error`,className:`mt-3 text-label text-soft-foreground`,children:`Host totals are unavailable right now.`}):null,(0,Q.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,Q.jsxs)(`div`,{"data-slot":`machine-card-cpu`,className:`grid grid-cols-[86px_1fr] items-start gap-3`,children:[(0,Q.jsxs)(`span`,{className:`pt-0.5 text-label text-soft-foreground`,children:[`CPU`,o?.cpuIsEffective===!0?` (effective)`:``]}),(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Q.jsx)(`span`,{"data-slot":`machine-card-cpu-value`,className:`w-32 shrink-0 text-ui tabular-nums`,children:h===void 0?m:`${h} · ${m}`}),(0,Q.jsx)(`div`,{className:`h-2 min-w-0 flex-1 overflow-hidden rounded-full bg-muted`,children:d===void 0||f===void 0?null:(0,Q.jsx)(`div`,{"data-slot":`machine-card-cpu-bar`,className:G(`h-full rounded-full`,d),style:{width:`${f}%`}})})]}),p===void 0?null:(0,Q.jsx)(`svg`,{"data-slot":`machine-card-cpu-sparkline`,className:`mt-1.5 h-8 w-full text-primary`,viewBox:`0 0 ${uD} ${dD}`,preserveAspectRatio:`none`,role:`img`,"aria-label":`CPU over the last up to ${i.length*2} seconds`,children:(0,Q.jsx)(`polyline`,{points:p,fill:`none`,stroke:`currentColor`,strokeWidth:1.5,vectorEffect:`non-scaling-stroke`})})]})]}),o===void 0?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{"data-slot":`machine-card-memory`,className:`grid grid-cols-[86px_1fr] items-center gap-3`,children:[(0,Q.jsxs)(`span`,{className:`text-label text-soft-foreground`,children:[`Memory`,o.memIsEffective?` (effective)`:``]}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,Q.jsx)(`span`,{"data-slot":`machine-card-memory-value`,className:`w-32 shrink-0 text-ui tabular-nums`,children:g}),(0,Q.jsx)(`div`,{className:`h-2 min-w-0 flex-1 overflow-hidden rounded-full bg-muted`,children:(0,Q.jsx)(`div`,{className:`h-full rounded-full bg-primary`,style:{width:`${u}%`}})})]})]}),typeof r?.swapTotalBytes==`number`&&typeof r?.swapUsedBytes==`number`?(0,Q.jsxs)(`div`,{"data-slot":`machine-card-swap`,className:`grid grid-cols-[86px_1fr] items-center gap-3`,children:[(0,Q.jsx)(`span`,{className:`text-label text-soft-foreground`,children:`Swap`}),(0,Q.jsxs)(`span`,{className:`text-ui tabular-nums`,children:[_(r.swapUsedBytes),` / `,_(r.swapTotalBytes)]})]}):null,r?.loadAvg===void 0?null:(0,Q.jsxs)(`div`,{"data-slot":`machine-card-load`,className:`grid grid-cols-[86px_1fr] items-center gap-3`,children:[(0,Q.jsx)(`span`,{className:`text-label text-soft-foreground`,children:`Load average`}),(0,Q.jsxs)(`span`,{className:`flex items-center gap-2 text-ui tabular-nums`,children:[r.loadAvg.one.toFixed(2),` · `,r.loadAvg.five.toFixed(2),` ·`,` `,r.loadAvg.fifteen.toFixed(2),(0,Q.jsx)(`span`,{"data-slot":`machine-card-load-cores`,className:`rounded-md border border-border px-1.5 py-0.5 text-meta text-soft-foreground`,children:o.hasContainer&&o.hostCpuCount!==void 0?`host ${o.hostCpuCount} cores`:`${r.cpuCount} cores`})]})]}),o.hasContainer&&o.hostCpuCount!==void 0?(0,Q.jsxs)(`p`,{"data-slot":`machine-card-host-context`,className:`text-meta tabular-nums text-soft-foreground`,children:[`host `,vi(o.hostCpuCount),` · `,_(r?.memTotalBytes??0),` RAM`]}):null]})]}),(0,Q.jsx)(`p`,{"data-slot":`machine-card-caveat`,className:`mt-3 border-t border-border pt-2 text-meta text-soft-foreground`,children:o?.hasContainer===!0?`Effective values come from this process’s own cgroup; host totals are labelled.`:o?.cgroupUnknown===!0?`No cgroup information available for this process - host totals only.`:`Host totals - no cgroup limit tighter than the host detected for this process.`})]})}var gD=1,_D=16,vD=16,yD=1440,bD=1,xD=60,SD=256;function CD(){let e=qt();return e.isPending?(0,Q.jsx)(`p`,{"data-slot":`resources-loading`,className:`p-4 text-ui text-soft-foreground md:p-6`,children:`Loading resource settings…`}):e.isError?(0,Q.jsx)(gl,{icon:(0,Q.jsx)(Xl,{}),tone:`danger`,title:`Resource settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,Q.jsx)(wD,{config:e.data})}function wD({config:e}){let t=W(),n=U({mutationFn:e=>yn(e),onSuccess:e=>t.setQueryData(V.config,e),onError:e=>Y(e.message,{tone:`danger`})}),[r,i]=(0,Z.useState)(e.resources.memoryLimitMb?String(e.resources.memoryLimitMb):``),a=e.resources.monitoringWakeIntervalMinutes??null,[o,s]=(0,Z.useState)(a===null?`park`:`interval`),[c,l]=(0,Z.useState)(String(a??5)),u=Number(c),d=!Number.isInteger(u)||u<bD||u>xD,f=o===`park`?a===null:!d&&a===u,p=()=>n.mutate({resources:{monitoringWakeIntervalMinutes:o===`park`?null:u}},{onSuccess:()=>Y(o===`park`?`Monitoring will stay parked`:`Monitoring will re-check every ${u} minutes`)}),m=e.resources.autoResumeOnUsageLimit??!0,h=e=>n.mutate({resources:{autoResumeOnUsageLimit:e}},{onSuccess:()=>Y(e?`Tasks stopped by a usage limit will resume themselves`:`Tasks stopped by a usage limit will stay failed`)}),g=r.trim()===``?0:Number(r),_=r.trim()!==``&&(!Number.isInteger(g)||g<SD),v=(e.resources.memoryLimitMb??0)===(_?-1:g),y=()=>n.mutate({resources:{memoryLimitMb:g===0?null:g}},{onSuccess:()=>Y(g===0?`Memory limit cleared`:`Memory limit set to ${g} MiB`)}),b=e.composerDefaults??{autonomous:null,worktree:null,inheritedAutonomous:`source-dependent`,inheritedWorktree:!0},x=(e,t)=>n.mutate({composerDefaults:{[e]:t===`inherit`?null:t===`on`}});return(0,Q.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,Q.jsx)(hD,{}),(0,Q.jsxs)($,{title:`Max parallel tasks`,hint:`How many tasks run at once across every project. The rest wait in the queue. A non-git directory always runs one at a time.`,children:[(0,Q.jsx)(kE,{"aria-label":`Max parallel tasks`,"data-slot":`resources-max-parallel`,value:e.resources.maxParallel,min:gD,max:_D,onCommit:e=>n.mutateAsync({resources:{maxParallel:e??gD}})}),(0,Q.jsxs)(`p`,{className:`text-meta text-soft-foreground`,children:[`Need a different limit for one project?`,` `,(0,Q.jsx)(Or,{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,Q.jsxs)($,{title:`Waiting-session idle timeout`,hint:`How long a plain waiting session may stay open without activity before its live backend session ends. Continue resumes it; set 0 to keep it open indefinitely.`,children:[(0,Q.jsx)(kE,{"aria-label":`Waiting-session idle timeout`,"data-slot":`resources-idle-timeout`,value:e.resources.idleTimeoutMinutes??0,min:0,max:yD,onCommit:e=>n.mutateAsync({resources:{idleTimeoutMinutes:e??0}})}),(0,Q.jsx)(`p`,{className:`text-meta text-soft-foreground`,children:`Minutes; 0 keeps plain waiting sessions alive. Monitoring sessions are already exempt.`})]}),(0,Q.jsxs)($,{title:`Extra monitoring sessions`,hint:`How many agent sessions may wait on CI, sub-agents, or monitored commands without using an active task slot. Extra sessions stay alive but pause the queue.`,children:[(0,Q.jsx)(kE,{"aria-label":`Extra monitoring sessions`,"data-slot":`resources-max-monitoring`,value:e.resources.maxMonitoringSessions??2,min:0,max:vD,onCommit:e=>n.mutateAsync({resources:{maxMonitoringSessions:e??0}})}),(0,Q.jsxs)(`p`,{className:`text-meta text-soft-foreground`,children:[`Capacity: `,e.resources.maxParallel,` active + `,e.resources.maxMonitoringSessions??2,` monitoring. Set 0 to make monitoring share active slots.`]})]}),(0,Q.jsxs)($,{title:`Monitoring wake-up`,hint:`Park uses no model turns. Re-check sends the same agent a follow-up on this cadence until work completes or the 40-wakeup safety cap is reached.`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsxs)(`select`,{"aria-label":`Monitoring wake-up`,"data-slot":`resources-monitoring-wake-mode`,value:o,disabled:n.isPending,onChange:e=>s(e.target.value),className:`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,Q.jsx)(`option`,{value:`park`,children:`Park until resumed`}),(0,Q.jsx)(`option`,{value:`interval`,children:`Re-check on an interval`})]}),o===`interval`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`input`,{type:`number`,min:bD,max:xD,"aria-label":`Wake interval in minutes`,"data-slot":`resources-monitoring-wake-interval`,value:c,disabled:n.isPending,onChange:e=>l(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,Q.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`minutes`})]}):null,(0,Q.jsx)(J,{type:`button`,variant:`outline`,size:`sm`,"data-action":`resources-save-monitoring-wake`,disabled:f||o===`interval`&&d||n.isPending,onClick:p,children:`Save`})]}),o===`interval`&&d?(0,Q.jsx)(`p`,{"data-slot":`resources-monitoring-wake-invalid`,className:`text-meta text-danger`,children:`Enter a whole number from 1 to 60 minutes.`}):(0,Q.jsx)(`p`,{className:`text-meta text-soft-foreground`,children:`Applied consistently to Claude, Codex and OpenCode.`})]}),(0,Q.jsxs)($,{title:`Auto-resume after a usage limit`,hint:`When an agent stops because its provider usage limit is reached, cezar waits for the reset the provider named and continues the task 30 seconds later — up to 12 times in a row without you. Off leaves the task failed with its Continue button.`,children:[(0,Q.jsxs)(`select`,{"aria-label":`Auto-resume after a usage limit`,"data-slot":`resources-auto-resume`,value:m?`on`:`off`,disabled:n.isPending,onChange:e=>h(e.target.value===`on`),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:[(0,Q.jsx)(`option`,{value:`on`,children:`On`}),(0,Q.jsx)(`option`,{value:`off`,children:`Off`})]}),(0,Q.jsx)(`p`,{className:`text-meta text-soft-foreground`,children:`Applies to Claude, Codex and OpenCode — whenever the provider says when the limit lifts.`})]}),(0,Q.jsxs)($,{title:`Per-task memory limit`,hint:`When a task's whole process tree crosses this, the engine pauses it with a warning and starts the next queued task. Leave empty for no limit.`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:SD,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,Q.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`MiB`}),(0,Q.jsx)(J,{type:`button`,variant:`outline`,size:`sm`,"data-action":`resources-save-memory`,disabled:v||_||n.isPending,onClick:y,children:`Save`})]}),_?(0,Q.jsxs)(`p`,{"data-slot":`resources-memory-invalid`,className:`text-meta text-danger`,children:[`Enter a whole number of at least `,SD,` MiB, or leave empty for no limit.`]}):(0,Q.jsx)(`p`,{className:`text-meta text-soft-foreground`,children:`Applies to newly started tasks.`})]}),(0,Q.jsxs)($,{title:`New task defaults`,hint:`Set stable composer defaults across projects. Explicit choices and run-shape constraints still win.`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,"data-slot":`resources-composer-defaults`,children:[(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:`Autonomous by default`}),(0,Q.jsxs)(`select`,{"aria-label":`Autonomous by default`,value:b.autonomous===null?`inherit`:b.autonomous?`on`:`off`,disabled:n.isPending,onChange:e=>x(`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,Q.jsx)(`option`,{value:`inherit`,children:`Inherit environment`}),(0,Q.jsx)(`option`,{value:`on`,children:`On`}),(0,Q.jsx)(`option`,{value:`off`,children:`Off`})]}),(0,Q.jsxs)(`span`,{className:`text-meta text-soft-foreground`,children:[`Inherited: `,b.inheritedAutonomous===`source-dependent`?`Source-dependent — skills on, workflows off`:b.inheritedAutonomous?`On`:`Off`]})]}),(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:`Use a worktree by default`}),(0,Q.jsxs)(`select`,{"aria-label":`Use a worktree by default`,value:b.worktree===null?`inherit`:b.worktree?`on`:`off`,disabled:n.isPending,onChange:e=>x(`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,Q.jsx)(`option`,{value:`inherit`,children:`Inherit environment`}),(0,Q.jsx)(`option`,{value:`on`,children:`On`}),(0,Q.jsx)(`option`,{value:`off`,children:`Off`})]}),(0,Q.jsxs)(`span`,{className:`text-meta text-soft-foreground`,children:[`Inherited: `,b.inheritedWorktree?`On`:`Off`]})]})]}),(0,Q.jsx)(`p`,{className:`text-meta text-soft-foreground`,children:`Interactive skills may recommend both off. Multi-step and parallel runs remain isolated.`})]})]})}function TD(){let e=qt();return e.isPending?(0,Q.jsx)(`p`,{"data-slot":`skills-settings-loading`,className:`p-4 text-ui text-soft-foreground md:p-6`,children:`Loading skill settings…`}):e.isError?(0,Q.jsx)(gl,{icon:(0,Q.jsx)(du,{}),tone:`danger`,title:`Skill settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,Q.jsx)(ED,{config:e.data})}function ED({config:e}){let t=W(),n=U({mutationFn:e=>yn(e),onSuccess:(e,n)=>{t.setQueryData(V.config,e),n.orgSkillsRepos&&t.invalidateQueries({predicate:e=>e.queryKey.includes(`skills`)})},onError:e=>Y(e.message,{tone:`danger`})}),r=e.skillsAutoUpdate===null,[i,a]=(0,Z.useState)(``),[o,s]=(0,Z.useState)(`main`),c=e.orgSkillsRepos,l=()=>{let e=i.trim();!e||c.some(t=>t.repo===e)||n.mutate({orgSkillsRepos:[...c,{repo:e,ref:o.trim()||`main`}]},{onSuccess:()=>a(``)})};return(0,Q.jsxs)(`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,Q.jsxs)(`section`,{"data-slot":`org-skills-repos`,className:`flex flex-col gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:(0,Q.jsx)(`label`,{htmlFor:`org-skills-repo`,children:`Organisation skills repositories`})}),(0,Q.jsxs)(`p`,{className:`text-ui text-muted-foreground`,children:[`Git repositories whose skills are available in every project, kept up to date from the remote. A project's own skills with the same name win. Use `,(0,Q.jsx)(`code`,{children:`owner/name`}),`, a git URL or a local path; access uses your existing git credentials.`]})]}),c.length>0&&(0,Q.jsx)(`ul`,{className:`flex flex-col gap-1`,children:c.map(e=>(0,Q.jsxs)(`li`,{className:`flex items-center justify-between gap-2 rounded-md border border-border px-3 py-1.5 text-ui`,children:[(0,Q.jsxs)(`span`,{className:`truncate`,children:[e.repo,` `,(0,Q.jsxs)(`span`,{className:`text-soft-foreground`,children:[`@ `,e.ref]})]}),(0,Q.jsx)(J,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":`Remove ${e.repo}`,disabled:n.isPending,onClick:()=>n.mutate({orgSkillsRepos:c.filter(t=>t.repo!==e.repo)}),children:`Remove`})]},e.repo))}),(0,Q.jsxs)(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:e=>{e.preventDefault(),l()},children:[(0,Q.jsx)(qs,{id:`org-skills-repo`,className:`min-w-48 flex-1`,placeholder:`my-org/skills`,value:i,onChange:e=>a(e.target.value)}),(0,Q.jsx)(qs,{"aria-label":`Branch or ref`,className:`w-28`,placeholder:`main`,value:o,onChange:e=>s(e.target.value)}),(0,Q.jsx)(J,{type:`submit`,size:`sm`,disabled:n.isPending||!i.trim(),children:`Add repository`})]})]}),(0,Q.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:(0,Q.jsx)(`label`,{htmlFor:`skills-auto-update`,children:`Update Open Mercato skills automatically`})}),(0,Q.jsx)(`p`,{className:`text-ui 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,Q.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-1`,children:[(0,Q.jsx)(jf,{id:`skills-auto-update`,"data-slot":`skills-auto-update`,checked:e.effectiveSkillsAutoUpdate,disabled:n.isPending,onCheckedChange:e=>n.mutate({skillsAutoUpdate:e})}),(0,Q.jsxs)(`span`,{className:`text-meta text-soft-foreground`,children:[e.effectiveSkillsAutoUpdate?`On`:`Off`,r?` (default)`:``]})]})]}),(0,Q.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,Q.jsx)(`span`,{children:r?`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,Q.jsx)(J,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`skills-use-default`,disabled:r||n.isPending,onClick:()=>n.mutate({skillsAutoUpdate:null}),children:`Use default`})]})]})]})}var DD=`block w-full max-w-md 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`,OD={profile:`trunk`,taskWorkspace:`in-place`,landing:`auto`,reviewGate:!1},kD={profile:null,taskWorkspace:null,landing:null,defaultSkill:null,askSkill:null};function AD({config:e}){let t=Fw(),n=(oe().data??[]).map(e=>e.name),r=e.profile===`trunk`,i=e.taskWorkspace===`in-place`;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)($,{title:`Development model`,hint:`Trunk-based: tasks work directly in the checkout one at a time, and changes that pass the required checks land on the base branch without a PR. Read-only questions run beside them. Every setting below stays adjustable.`,children:(0,Q.jsxs)(`select`,{"aria-label":`Development model`,"data-slot":`tasks-profile`,value:r?`trunk`:`branches`,disabled:t.isPending,onChange:e=>{let n=e.target.value===`trunk`;t.mutate(n?OD:kD,{onSuccess:()=>Y(n?`Trunk-based defaults applied`:`Branch-per-task defaults restored`)})},className:DD,children:[(0,Q.jsx)(`option`,{value:`branches`,children:`Branch per task (default) — a worktree and branch per task, reviewed before merging`}),(0,Q.jsx)(`option`,{value:`trunk`,children:`Trunk-based — work in the checkout, land checked changes on the base branch`})]})}),(0,Q.jsx)($,{title:`Where tasks work`,hint:`In the checkout: no worktree or branch per task. Write tasks take turns on the working tree, so two tasks started together never conflict. The composer can still ask for a worktree per task.`,children:(0,Q.jsxs)(`select`,{"aria-label":`Where tasks work`,"data-slot":`tasks-workspace`,value:e.taskWorkspace??``,disabled:t.isPending,onChange:e=>t.mutate({taskWorkspace:e.target.value||null}),className:DD,children:[(0,Q.jsx)(`option`,{value:``,children:`Composer default (isolated worktree)`}),(0,Q.jsx)(`option`,{value:`worktree`,children:`Isolated worktree per task`}),(0,Q.jsx)(`option`,{value:`in-place`,children:`The repo checkout, one write task at a time`})]})}),(0,Q.jsxs)($,{title:`How changes land`,hint:i?`Auto-land: a finished task waits for your review — check Changes, send corrections, then use the task header's Commit to the base branch: it commits, rebases on the remote, runs the required checks and pushes. Autonomous tasks land on their own. A conflict or a failing check goes back to the agent. The agent is told this permission is granted.`:`Auto-land applies to tasks that work in the checkout — set "Where tasks work" first.`,children:[(0,Q.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,Q.jsx)(jf,{"aria-label":`Auto-land on the base branch`,"data-slot":`tasks-landing`,checked:e.landing===`auto`,disabled:t.isPending,onCheckedChange:e=>t.mutate({landing:e?`auto`:null},{onSuccess:()=>Y(e?`Auto-land on — finished tasks push to the base branch`:`Auto-land off`)})}),(0,Q.jsx)(`span`,{className:`text-ui text-muted-foreground`,children:e.landing===`auto`?`Auto-land on the base branch`:`Review — nothing lands by itself (default)`})]}),e.landingBlocked?(0,Q.jsx)(`p`,{"data-slot":`tasks-landing-blocked`,className:`mt-2 text-ui text-destructive`,children:e.landingBlocked}):null]}),(0,Q.jsx)(MD,{config:e}),(0,Q.jsx)($,{title:`Default skills`,hint:`Preselected in the composer when nothing is picked: one for a new task, one for a read-only question (the Ask chip). A trunk-based project picks Ask on its own when the message ends with a question mark.`,children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row`,children:[(0,Q.jsx)(jD,{label:`New task skill`,slot:`tasks-default-skill`,value:e.defaultSkill,names:n,disabled:t.isPending,onChange:e=>t.mutate({defaultSkill:e})}),(0,Q.jsx)(jD,{label:`Ask skill`,slot:`tasks-ask-skill`,value:e.askSkill,names:n,disabled:t.isPending,onChange:e=>t.mutate({askSkill:e})})]})}),(0,Q.jsx)($,{title:`Team skill repositories`,hint:`Skills from the shared team repositories. Turn off for a project whose skills live in the repo itself. Project-wide instructions for every task are under Instructions.`,children:(0,Q.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,Q.jsx)(jf,{"aria-label":`Team skill repositories`,"data-slot":`tasks-team-skills`,checked:e.teamSkills,disabled:t.isPending,onCheckedChange:e=>t.mutate({teamSkills:e})}),(0,Q.jsx)(`span`,{className:`text-ui text-muted-foreground`,children:e.teamSkills?`On`:`Off`})]})})]})}function jD({label:e,slot:t,value:n,names:r,disabled:i,onChange:a}){let o=n&&!r.includes(n)?[n,...r]:r;return(0,Q.jsxs)(`label`,{className:`flex flex-1 flex-col gap-1 text-label text-muted-foreground`,children:[e,(0,Q.jsxs)(`select`,{"aria-label":e,"data-slot":t,value:n??``,disabled:i,onChange:e=>a(e.target.value||null),className:DD,children:[(0,Q.jsx)(`option`,{value:``,children:`None`}),o.map(e=>(0,Q.jsx)(`option`,{value:e,children:e},e))]})]})}function MD({config:e}){let t=Fw(),n=e.requiredChecks.join(`
|
|
30
|
+
`),[r,i]=(0,Z.useState)(n);return(0,Z.useEffect)(()=>i(n),[n]),(0,Q.jsx)($,{title:`Required checks`,hint:`Shell commands, one per line, run in the checkout before every auto-land (e.g. npm test). A failure goes back to the agent with its output.`,children:(0,Q.jsx)(`textarea`,{"aria-label":`Required checks`,"data-slot":`tasks-required-checks`,value:r,rows:3,spellCheck:!1,placeholder:`npm test`,disabled:t.isPending,onChange:e=>i(e.target.value),onBlur:()=>{let e=r.split(`
|
|
31
|
+
`).map(e=>e.trim()).filter(Boolean);e.join(`
|
|
32
|
+
`)!==n&&t.mutate({requiredChecks:e.length?e:null},{onSuccess:()=>Y(`Required checks saved`)})},className:`block w-full max-w-md rounded-md border border-input bg-card px-3 py-1.5 font-mono text-ui shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`})})}function ND(){let e=jn();return e.isPending?(0,Q.jsx)(`p`,{"data-slot":`tasks-loading`,className:`p-4 text-ui text-soft-foreground md:p-6`,children:`Loading task settings…`}):e.isError?(0,Q.jsx)(gl,{icon:(0,Q.jsx)(ru,{}),tone:`danger`,title:`Task settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,Q.jsx)(PD,{config:e.data})}function PD({config:e}){let t=mn(),n=Fw();return(0,Q.jsxs)(`div`,{"data-slot":`tasks-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,Q.jsx)(AD,{config:e}),(0,Q.jsx)($,{title:`Base branch`,hint:`New task worktrees branch from this and draft PRs target it. Also settable from the Git view.`,children:t.data?.info?(0,Q.jsxs)(`select`,{"aria-label":`Base branch`,"data-slot":`tasks-base-branch`,value:e.baseBranch??``,disabled:n.isPending,onChange:e=>n.mutate({baseBranch:e.target.value||null}),className:`block w-full max-w-md 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,Q.jsx)(`option`,{value:``,children:`follow checked-out branch (default)`}),t.data.branches.map(e=>(0,Q.jsx)(`option`,{value:e,children:e},e))]}):(0,Q.jsx)(`p`,{"data-slot":`tasks-base-branch-unavailable`,className:`text-ui text-soft-foreground`,children:t.isPending?`Loading branches…`:`Not a git repository — tasks run in place, no branching.`})}),(0,Q.jsx)($,{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,Q.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,Q.jsx)(jf,{"aria-label":`Review changes before finishing`,"data-slot":`tasks-review-gate`,checked:e.reviewGate??!1,disabled:n.isPending,onCheckedChange:e=>n.mutate({reviewGate:e},{onSuccess:()=>Y(e?`Review gate on`:`Review gate off`)})}),(0,Q.jsxs)(`span`,{className:`text-ui text-muted-foreground`,children:[e.reviewGate??!1?`On`:`Off`,e.reviewGate===null&&` (default)`]})]})}),(0,Q.jsx)($,{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,Q.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,Q.jsx)(jf,{"aria-label":`Live title updates`,"data-slot":`tasks-live-title-updates`,checked:e.liveTitleUpdates??!0,disabled:n.isPending,onCheckedChange:e=>n.mutate({liveTitleUpdates:e},{onSuccess:()=>Y(e?`Live title updates on`:`Live title updates off`)})}),(0,Q.jsxs)(`span`,{className:`text-ui text-muted-foreground`,children:[e.liveTitleUpdates??!0?`On`:`Off`,e.liveTitleUpdates===null&&` (default)`]})]})})]})}var FD=`/workspace/config-bundle`;async function ID(e,t={}){let n=ar(e),r=new Headers(t.headers);r.set(gn,Ye());try{return await fetch(n,{...t,headers:r,credentials:`include`})}catch(e){throw e instanceof DOMException&&e.name===`AbortError`?e:new pn(0,`cannot reach the cezar server (${n})`,{cause:e})}}async function LD(e){let t=await e.text().catch(()=>``),n;try{let e=JSON.parse(t);typeof e?.error==`string`&&(n=e.error)}catch{}return new pn(e.status,n??`${e.status} ${e.statusText||`request failed`}`.trim())}async function RD(e,t,n){let r=await ID(e,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t)});if(!r.ok)throw await LD(r);let i=n.safeParse(await r.json().catch(()=>void 0));if(!i.success)throw new pn(r.status,`the cezar server answered ${e} with an unexpected body`);return i.data}async function zD(e){let t=await ID(`${FD}${e===null?``:`?projects=${e.map(encodeURIComponent).join(`,`)}`}`);if(!t.ok)throw await LD(t);return{blob:await t.blob(),filename:BD(t.headers.get(`content-disposition`))}}function BD(e,t=new Date){let n=e?.match(/filename\*?=(?:UTF-8'')?"?([^";]+)"?/i);return n?.[1]?decodeURIComponent(n[1]):`cezar-config-${t.toISOString().slice(0,10)}.json`}function VD(e){return RD(`${FD}/preview`,e,gr)}function HD(e){return RD(`${FD}/import`,e,cr)}function UD(e){if(e.trim()===``)return{ok:!1,error:`this file is empty`};if(e.length>5242880)return{ok:!1,error:`this file is larger than 5 MB`};let t;try{t=JSON.parse(e)}catch{return{ok:!1,error:`this file is not JSON`}}let n=pr.safeParse(t);if(n.success)return{ok:!0,bundle:n.data};let r=n.error.issues,i=r.find(e=>e.path[0]===`format`)??r.find(e=>e.path[0]===`version`)??r[0],a=i&&i.path.length>0&&i.path[0]!==`format`&&i.path[0]!==`version`?` (at ${i.path.join(`.`)})`:``;return{ok:!1,error:`${i?.message??`not a cezar configuration bundle`}${a}`}}var WD=[`secret values`,`tracker connections`,`agent accounts`,`webhooks`,`paths`],GD=`rounded-md border border-input bg-card px-2 py-1 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,KD=`__skip__`;function qD(){let e=T().data?.capabilities?.localHandoff??!0;return(0,Q.jsxs)(`div`,{"data-slot":`transfer-section`,className:`mx-auto flex w-full max-w-3xl flex-col gap-8 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,Q.jsx)(JD,{}),(0,Q.jsx)(QD,{localHandoff:e})]})}function JD(){let e=a(),t=(e.data?.projects??[]).filter(e=>e.status!==`missing`),[n,r]=(0,Z.useState)(new Set),i=t.filter(e=>!n.has(e.id)),o=U({mutationFn:()=>zD(i.length===t.length?null:i.map(e=>e.id)),onSuccess:({blob:e,filename:t})=>{let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=t,document.body.append(r),r.click(),r.remove(),URL.revokeObjectURL(n),Y(`Downloaded ${t}`)},onError:e=>Y(e.message,{tone:`danger`})}),s=e=>r(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n});return(0,Q.jsx)($,{title:`Export`,hint:`Download this machine's portable settings — workspace preferences and, per project, its config, prompt templates and automations — as one JSON file.`,children:(0,Q.jsxs)(`div`,{"data-slot":`transfer-export`,className:`flex flex-col gap-3`,children:[e.isPending?(0,Q.jsx)(`p`,{className:`text-ui text-soft-foreground`,children:`Loading projects…`}):t.length===0?(0,Q.jsx)(`p`,{className:`text-ui text-soft-foreground`,children:`No projects registered — the file will carry workspace settings only.`}):(0,Q.jsxs)(`fieldset`,{className:`flex flex-col gap-1.5`,children:[(0,Q.jsx)(`legend`,{className:`mb-1 text-meta text-soft-foreground`,children:`Projects to include`}),t.map(e=>(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,"data-slot":`transfer-export-project`,checked:!n.has(e.id),onChange:()=>s(e.id)}),(0,Q.jsx)(`span`,{className:`font-medium`,children:e.name})]},e.id))]}),(0,Q.jsxs)(`p`,{"data-slot":`transfer-excluded`,className:`text-meta text-soft-foreground`,children:[`Not included: `,WD.join(`, `),`. Secret names and the tracker to reconnect travel as reminders.`]}),(0,Q.jsx)(`div`,{children:(0,Q.jsx)(J,{type:`button`,size:`sm`,"data-action":`transfer-download`,disabled:o.isPending||e.isPending,onClick:()=>o.mutate(),children:o.isPending?`Preparing…`:`Download`})})]})})}var YD={mapping:{},resolutions:{}};function XD(e,t){return{bundle:e,...t.selection?{selection:t.selection}:{},...Object.keys(t.mapping).length>0?{mapping:t.mapping}:{},...Object.keys(t.resolutions).length>0?{resolutions:t.resolutions}:{}}}function ZD(){return(0,Q.jsx)($,{title:`Import`,hint:`Apply a configuration bundle exported from another cezar.`,children:(0,Q.jsx)(`p`,{"data-slot":`transfer-import-hosted`,className:`text-ui text-soft-foreground`,children:`Import is only available on a local cockpit.`})})}function QD({localHandoff:e}){let t=(0,Z.useId)(),n=(0,Z.useRef)(null),[r,i]=(0,Z.useState)(null),[a,o]=(0,Z.useState)(null),[s,c]=(0,Z.useState)(YD),[l,u]=(0,Z.useState)(null),d=gt({queryKey:[`transfer`,`preview`,r?.nonce,s],queryFn:()=>VD(XD(r.bundle,s)),enabled:r!==null&&e,retry:!1,gcTime:0,placeholderData:Mn}),f=U({mutationFn:e=>HD({...XD(r.bundle,s),planDigest:e.planDigest}),onSuccess:e=>{u(e.applied),Y(`Applied ${e.applied.length} section${e.applied.length===1?``:`s`}`)},onError:()=>void d.refetch()});if(!e||d.data?.importAllowed===!1)return(0,Q.jsx)(ZD,{});let p=async e=>{let t=e.target.files?.[0];if(e.target.value=``,!t)return;if(u(null),f.reset(),c(YD),t.size>5242880){i(null),o(`this file is larger than 5 MB`);return}let n=UD(await t.text());if(!n.ok){i(null),o(n.error);return}o(null),i({name:t.name,bundle:n.bundle,nonce:Date.now()})},m=e=>{u(null),f.reset(),c(e)},h=r&&!d.isError?d.data:void 0,g=a??(r&&d.isError?d.error.message:null);return(0,Q.jsx)($,{title:`Import`,hint:`Apply a configuration bundle exported from another cezar. Nothing is written until you apply, and automations always land paused.`,children:(0,Q.jsxs)(`div`,{"data-slot":`transfer-import`,className:`flex flex-col gap-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`input`,{ref:n,id:t,type:`file`,accept:`application/json,.json`,"data-slot":`transfer-import-file`,className:`sr-only`,onChange:e=>void p(e)}),(0,Q.jsx)(J,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>n.current?.click(),children:`Choose file…`}),(0,Q.jsx)(`label`,{htmlFor:t,className:`text-meta text-soft-foreground`,children:r?r.name:`A .json file from Settings → Transfer → Export`})]}),g?(0,Q.jsx)(`p`,{role:`alert`,"data-slot":`transfer-import-error`,className:`text-ui text-danger`,children:g}):null,r&&!h&&d.isFetching?(0,Q.jsx)(`p`,{className:`text-ui text-soft-foreground`,children:`Reading the file…`}):null,h?(0,Q.jsx)($D,{plan:h,choices:s,onChange:m,busy:d.isFetching,applying:f.isPending,applyError:f.isError?f.error.message:null,applied:l,onApply:()=>f.mutate(h)}):null]})})}function $D({plan:e,choices:t,onChange:n,busy:r,applying:i,applyError:o,applied:s,onApply:c}){let l=(a().data?.projects??[]).filter(e=>e.status!==`missing`),u=e=>t.selection?t.selection.includes(e.id):e.selected,d=e.sections.filter(u),f=d.filter(e=>e.issues.length>0),p=t=>n(n=>{let r=n.selection??e.sections.filter(e=>e.selected).map(e=>e.id),i=r.includes(t.id)?r.filter(e=>e!==t.id):[...r,t.id];return{...n,selection:i}}),m=(e,t,r)=>n(n=>{let i=n.resolutions[e]??{};return{...n,resolutions:{...n.resolutions,[e]:{...i,keys:{...i.keys,[t]:r}}}}}),h=(e,t,r)=>n(n=>{let i=n.resolutions[e]??{},a={...i.automations};return r?a[String(t)]=r:delete a[String(t)],{...n,resolutions:{...n.resolutions,[e]:{...i,automations:a}}}}),g=(e,t)=>n(n=>{let r={...n.mapping};return t===``?delete r[String(e)]:r[String(e)]=t===KD?null:t,{...n,mapping:r}}),_=t=>t===void 0?`Workspace`:e.projects.find(e=>e.index===t)?.name??`Project ${t+1}`,v=e=>l.find(t=>t.id===e)?.name??e;return(0,Q.jsxs)(`div`,{"data-slot":`transfer-preview`,"aria-busy":r,className:`flex flex-col gap-6`,children:[e.projects.length>0?(0,Q.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-semibold`,children:`Projects`}),(0,Q.jsx)(`ul`,{className:`flex flex-col gap-2`,children:e.projects.map(e=>(0,Q.jsxs)(`li`,{"data-slot":`transfer-project`,"data-match":e.match,className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:e.name}),e.remote?(0,Q.jsx)(`span`,{className:`text-meta text-soft-foreground`,children:e.remote}):null,(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`text-soft-foreground`,children:`→`}),(0,Q.jsx)(nO,{name:e.name,value:tO(t.mapping[String(e.index)],e.targetProjectId),registered:l,onChange:t=>g(e.index,t)}),e.match===`remote`?(0,Q.jsx)(`span`,{className:`text-meta text-soft-foreground`,children:`(same remote)`}):null]},e.index))})]}):null,(0,Q.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-semibold`,children:`Sections`}),e.sections.length===0?(0,Q.jsx)(`p`,{className:`text-ui text-soft-foreground`,children:`This file changes nothing on this machine.`}):e.sections.map(e=>(0,Q.jsx)(rO,{section:e,title:`${_(e.projectIndex)} · ${eO[e.kind]}`,target:e.projectIndex===void 0?void 0:v(e.targetProjectId),checked:u(e),resolution:t.resolutions[e.id],onToggle:()=>p(e),onKey:(t,n)=>m(e.id,t,n),onRow:(t,n)=>h(e.id,t,n)},e.id))]}),(0,Q.jsx)(cO,{plan:e}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[f.length>0?(0,Q.jsx)(`p`,{"data-slot":`transfer-blocked`,className:`text-ui text-danger`,children:`Untick or fix the sections with problems before applying.`}):null,o?(0,Q.jsx)(`p`,{role:`alert`,"data-slot":`transfer-apply-error`,className:`text-ui text-danger`,children:o}):null,s?(0,Q.jsxs)(`p`,{"data-slot":`transfer-applied`,className:`text-ui text-foreground`,children:[`Applied `,s.length,` section`,s.length===1?``:`s`,`. Imported automations are paused — enable them on each project’s Automations page.`]}):null,(0,Q.jsx)(`div`,{children:(0,Q.jsx)(J,{type:`button`,size:`sm`,"data-action":`transfer-apply`,disabled:r||i||d.length===0||f.length>0||s!==null,onClick:c,children:i?`Applying…`:`Apply selected (${d.length})`})})]})]})}var eO={workspace:`settings`,config:`config`,promptTemplates:`prompt templates`,automations:`automations`};function tO(e,t){return e===null?KD:e??t??``}function nO({name:e,value:t,registered:n,onChange:r}){return(0,Q.jsxs)(`select`,{"aria-label":`Import ${e} into`,"data-slot":`transfer-mapping`,value:t,onChange:e=>r(e.target.value),className:GD,children:[(0,Q.jsx)(`option`,{value:``,children:`Choose a project…`}),n.map(e=>(0,Q.jsx)(`option`,{value:e.id,children:e.name},e.id)),(0,Q.jsx)(`option`,{value:KD,children:`Skip`})]})}function rO({section:e,title:t,target:n,checked:r,resolution:i,onToggle:a,onKey:o,onRow:s}){return(0,Q.jsxs)(`div`,{"data-slot":`transfer-section-card`,"data-section-id":e.id,className:`flex flex-col gap-2 rounded-lg border border-border bg-card p-3`,children:[(0,Q.jsxs)(`label`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked:r,onChange:a,"aria-label":t}),(0,Q.jsx)(`span`,{className:`font-medium`,children:t}),n?(0,Q.jsxs)(`span`,{className:`text-meta text-soft-foreground`,children:[`→ `,n]}):null,e.runsCommands?(0,Q.jsxs)(yf,{variant:`outline`,"data-slot":`transfer-runs-commands`,className:`border-warning text-warning`,children:[(0,Q.jsx)(es,{"aria-hidden":!0}),` runs shell commands`]}):null]}),e.issues.length>0?(0,Q.jsx)(`ul`,{"data-slot":`transfer-section-issues`,className:`text-meta text-danger`,children:e.issues.map(e=>(0,Q.jsx)(`li`,{children:e},e))}):null,e.changes.length>0?(0,Q.jsx)(`ul`,{className:`flex flex-col gap-1`,children:e.changes.map(e=>(0,Q.jsx)(aO,{change:e,value:i?.keys?.[e.key]??e.action,onChange:t=>o(e.key,t)},e.key))}):null,e.automations?.length?(0,Q.jsx)(`ul`,{className:`flex flex-col gap-1`,children:e.automations.map(e=>(0,Q.jsx)(sO,{row:e,resolution:i?.automations?.[String(e.index)],onChange:t=>s(e.index,t)},e.index))}):null,e.changes.length===0&&!e.automations?.length?(0,Q.jsx)(`p`,{className:`text-meta text-soft-foreground`,children:`Nothing to change.`}):null]})}function iO(e){if(e===void 0)return`(not set)`;let t=typeof e==`string`?JSON.stringify(e):JSON.stringify(e)??String(e);return t.length>120?`${t.slice(0,119)}…`:t}function aO({change:e,value:t,onChange:n}){return(0,Q.jsxs)(`li`,{"data-slot":`transfer-change`,"data-key":e.key,className:`flex flex-wrap items-center gap-2 text-meta`,children:[(0,Q.jsx)(`code`,{className:`font-mono text-foreground`,children:e.key}),(0,Q.jsx)(`span`,{"data-slot":`transfer-change-from`,className:`font-mono text-soft-foreground`,children:iO(e.from)}),(0,Q.jsx)(`span`,{"aria-hidden":!0,children:`→`}),(0,Q.jsx)(`span`,{"data-slot":`transfer-change-to`,className:`font-mono text-foreground`,children:iO(e.to)}),e.conflict?(0,Q.jsxs)(`select`,{"aria-label":`${e.key}: keep or take`,"data-slot":`transfer-change-action`,value:t,onChange:e=>n(e.target.value),className:GD,children:[(0,Q.jsx)(`option`,{value:`keep`,children:`Keep this machine’s`}),(0,Q.jsx)(`option`,{value:`take`,children:`Take imported`})]}):(0,Q.jsxs)(`span`,{className:`text-soft-foreground`,children:[`(`,e.action===`take`?`new`:`unchanged`,`)`]})]})}var oO={create:`create`,skip:`skip`,rename:`rename`,replace:`replace`};function sO({row:e,resolution:t,onChange:n}){let r=r=>{if(!r){n(e.collision&&t?{...t,acceptCommands:void 0}:void 0);return}n(t?{...t,acceptCommands:!0}:{action:e.collision?`rename`:`create`,acceptCommands:!0})};return(0,Q.jsxs)(`li`,{"data-slot":`transfer-automation`,"data-index":e.index,className:`flex flex-col gap-1 text-meta`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-foreground`,children:e.name}),(0,Q.jsx)(`span`,{className:`text-soft-foreground`,children:e.kind}),(0,Q.jsxs)(yf,{variant:`secondary`,children:[oO[e.action],e.newName&&e.action===`rename`?` → ${e.newName}`:``]}),e.collision?(0,Q.jsxs)(`select`,{"aria-label":`${e.name}: on a name collision`,"data-slot":`transfer-automation-action`,value:t?.action??`skip`,onChange:e=>n({...t,action:e.target.value,newName:void 0}),className:GD,children:[(0,Q.jsx)(`option`,{value:`skip`,children:`Skip`}),(0,Q.jsx)(`option`,{value:`rename`,children:`Rename`}),e.collision.id?(0,Q.jsx)(`option`,{value:`replace`,children:`Replace (and pause)`}):null]}):null,e.runsCommands?(0,Q.jsxs)(`label`,{className:`flex items-center gap-1 text-warning`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,"data-slot":`transfer-automation-accept`,checked:t?.acceptCommands===!0,onChange:e=>r(e.target.checked)}),(0,Q.jsx)(es,{"aria-hidden":!0,className:`size-3`}),` runs shell commands — allow`]}):null]}),[...e.issues,...e.warnings].map(t=>(0,Q.jsx)(`span`,{className:e.issues.includes(t)?`text-danger`:`text-soft-foreground`,children:t},t))]})}function cO({plan:e}){let t=e.projects.filter(e=>e.reminders.secretNames.length>0||e.reminders.tracker);return e.reminders.workspaceSecretNames.length===0&&t.length===0?null:(0,Q.jsxs)(`section`,{"data-slot":`transfer-reminders`,className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-semibold`,children:`Re-enter these secrets`}),(0,Q.jsx)(`p`,{className:`text-meta text-soft-foreground`,children:`A bundle never carries secret values or tracker credentials. Add them again on this machine after importing.`}),(0,Q.jsxs)(`ul`,{className:`flex flex-col gap-1 text-sm`,children:[e.reminders.workspaceSecretNames.length>0?(0,Q.jsxs)(`li`,{"data-slot":`transfer-reminder`,"data-scope":`workspace`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:`Workspace secrets:`}),` `,e.reminders.workspaceSecretNames.join(`, `)]}):null,t.map(e=>(0,Q.jsxs)(`li`,{"data-slot":`transfer-reminder`,"data-scope":`project:${e.index}`,children:[(0,Q.jsxs)(`span`,{className:`font-medium`,children:[e.name,`:`]}),` `,e.reminders.secretNames.length>0?`secrets ${e.reminders.secretNames.join(`, `)}`:null,e.reminders.secretNames.length>0&&e.reminders.tracker?`; `:null,e.reminders.tracker?`reconnect the ${e.reminders.tracker} tracker`:null]},e.index))]})]})}function lO(){let e=At(),t=Pr(),n=jn(),[r,i]=(0,Z.useState)(null),a=t.data?.worktrees??[],o=!!n.data?.worktreeLifecycle&&(n.data.worktreeLifecycle.afterCreate.length>0||n.data.worktreeLifecycle.beforeRemove.length>0),s=W(),[c,l]=(0,Z.useState)(null),u=async()=>{await Promise.all([s.invalidateQueries({queryKey:H.worktrees}),s.invalidateQueries({queryKey:Fr.all()})])},d=U({mutationFn:()=>mt(),onSuccess:e=>{u(),Y(e.reclaimed.length===0?o||a.some(e=>e.operation||e.autoCleanupSuppressed)?`No worktrees reclaimed yet. Pending cleanup or retained worktrees may keep usage above the limit.`:`Nothing to reclaim — all worktrees are within the limit`:`Reclaimed ${e.reclaimed.length} worktree${e.reclaimed.length===1?``:`s`} (branch kept)`)},onError:e=>Y(e.message,{tone:`danger`})}),f=U({mutationFn:async e=>o||a.some(t=>t.runId===e)?ge({requestId:crypto.randomUUID(),runId:e,intent:`remove-worktree`}):kt(e),onSuccess:(t,n)=>{u(),`operation`in t?(i({id:t.operation.id,title:e.data?.worktrees.find(e=>e.runId===n)?.title??n}),Y(`Cleanup requested. The worktree remains until cleanup and removal complete.`)):Y(`Worktree removed`)},onError:e=>Y(e.message,{tone:`danger`})}),p=U({mutationFn:e=>ge({requestId:crypto.randomUUID(),worktreeId:e,intent:`orphan`}),onSuccess:e=>{i({id:e.operation.id,title:`Orphan worktree`}),u(),Y(`Orphan cleanup requested. Review its progress below.`)},onError:e=>Y(e.message,{tone:`danger`})});if(e.isPending)return(0,Q.jsx)(`p`,{"data-slot":`worktrees-loading`,className:`text-ui text-soft-foreground`,children:`Loading worktrees…`});if(e.isError)return(0,Q.jsxs)(`p`,{"data-slot":`worktrees-error`,className:`text-ui text-danger`,children:[`Worktrees did not load: `,e.error.message]});let{worktrees:m,totalBytes:h,keep:g}=e.data,v=d.isPending||f.isPending||p.isPending;return(0,Q.jsxs)(`div`,{"data-slot":`worktrees-panel`,className:`flex flex-col gap-3`,children:[m.length===0?(0,Q.jsx)(`p`,{"data-slot":`worktrees-empty`,className:`text-ui text-soft-foreground`,children:`No task worktrees on disk.`}):(0,Q.jsx)(`div`,{className:`overflow-x-auto rounded-md border border-border`,children:(0,Q.jsxs)(`table`,{className:`w-full border-collapse text-sm`,children:[(0,Q.jsx)(`caption`,{className:`sr-only`,children:`Task worktrees currently materialized on disk`}),(0,Q.jsx)(`thead`,{children:(0,Q.jsxs)(`tr`,{className:`border-b border-border text-left text-label text-soft-foreground`,children:[(0,Q.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Task`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Status`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Size`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Age`}),(0,Q.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium text-right`,children:`Actions`})]})}),(0,Q.jsx)(`tbody`,{children:m.map(e=>(0,Q.jsx)(uO,{worktree:e,lifecycle:a.find(t=>t.runId===e.runId),disabled:v||!!a.find(t=>t.runId===e.runId)?.operation,onDelete:()=>l({kind:`delete`,runId:e.runId,title:e.title})},e.runId))})]})}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Q.jsxs)(`p`,{"data-slot":`worktrees-footer`,className:`text-label text-soft-foreground`,children:[m.length,` worktree`,m.length===1?``:`s`,h===null?` · size unavailable`:` · ${_(h)||`0 kB`} on disk`,` · `,g===0?`keeping all (unlimited)`:`keeping the last ${g}`]}),(0,Q.jsx)(J,{type:`button`,variant:`outline`,size:`sm`,"data-action":`worktrees-reclaim-now`,disabled:v,onClick:()=>l({kind:`reclaim`}),children:`Reclaim now`})]}),t.isError&&(0,Q.jsxs)(`p`,{className:`text-xs text-danger`,role:`alert`,children:[`Lifecycle state could not be loaded: `,t.error.message]}),a.filter(e=>e.operation||e.autoCleanupSuppressed||e.needsAttention||!e.task).map(e=>(0,Q.jsxs)(`section`,{className:`min-w-0 rounded-md border border-border p-3`,"data-slot":`lifecycle-worktree-row`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium`,children:e.task?.title??`Orphan worktree ${e.runId.slice(0,8)}`}),(0,Q.jsx)(`p`,{className:`break-all font-mono text-meta text-muted-foreground`,children:e.worktreePath}),e.error&&(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-danger`,children:e.error}),e.needsAttention&&(0,Q.jsxs)(`p`,{className:`mt-1 text-xs text-danger`,children:[e.operation?.phase===`setup`?`Setup needs attention`:`Cleanup needs attention`,` — worktree retained.`]}),e.autoCleanupSuppressed&&(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Automatic cleanup is suppressed for this generation because it was kept or cancelled. Explicit removal is still available.`}),e.operation?(0,Q.jsx)(`div`,{id:`lifecycle-operation-${e.operation.id}`,className:`mt-3 scroll-mt-4`,children:(0,Q.jsx)(Ca,{operationId:e.operation.id,worktreePath:e.worktreePath,taskTitle:e.task?.title})}):!e.task&&!e.error&&e.onDisk?(0,Q.jsx)(J,{className:`mt-2`,type:`button`,variant:`outline`,size:`sm`,disabled:v,onClick:()=>l({kind:`orphan`,worktreeId:e.worktreeId,title:e.worktreePath}),children:`Remove orphan worktree`}):null]},e.worktreeId)),r&&!a.some(e=>e.operation?.id===r.id)&&(0,Q.jsx)(`div`,{id:`lifecycle-operation-${r.id}`,children:(0,Q.jsx)(Ca,{operationId:r.id,taskTitle:r.title})}),(0,Q.jsx)(vs,{open:c!==null,onOpenChange:e=>!e&&l(null),children:(0,Q.jsxs)(ps,{children:[(0,Q.jsxs)(_s,{children:[(0,Q.jsx)(fs,{children:c?.kind===`delete`||c?.kind===`orphan`?`Delete this worktree?`:`Reclaim old worktrees?`}),(0,Q.jsx)(ds,{children:c?.kind===`delete`||c?.kind===`orphan`?(0,Q.jsxs)(Q.Fragment,{children:[`This removes the worktree directory and its branch — the local-only work is not recoverable afterwards. Configured cleanup scripts run first; failures retain the directory for your recovery choice.`,(0,Q.jsx)(`span`,{className:`mt-1 block truncate font-medium text-foreground`,title:c.title,children:c.title})]}):`Finished worktrees beyond the keep-limit are reclaimed now (directory only). Their branches are kept, so the work stays recoverable.`})]}),(0,Q.jsxs)(hs,{children:[(0,Q.jsx)(gs,{children:`Keep it`}),(0,Q.jsx)(ms,{"data-action":`worktrees-confirm`,className:c?.kind===`delete`||c?.kind===`orphan`?`bg-danger text-danger-foreground hover:brightness-[0.96]`:void 0,onClick:()=>{c?.kind===`reclaim`?d.mutate():c?.kind===`delete`?f.mutate(c.runId):c?.kind===`orphan`&&p.mutate(c.worktreeId),l(null)},children:c?.kind===`delete`||c?.kind===`orphan`?`Delete`:`Reclaim now`})]})]})})]})}function uO({worktree:e,lifecycle:t,disabled:n,onDelete:r}){return(0,Q.jsxs)(`tr`,{"data-slot":`worktree-row`,"data-run":e.runId,className:`border-b border-border last:border-0`,children:[(0,Q.jsxs)(`th`,{scope:`row`,className:`max-w-[220px] px-3 py-2 text-left font-normal`,children:[(0,Q.jsx)(`span`,{className:`block truncate text-foreground`,title:e.title,children:e.title}),(0,Q.jsx)(`span`,{className:`block truncate font-mono text-meta text-soft-foreground`,children:e.branch??e.runId.slice(0,8)})]}),(0,Q.jsxs)(`td`,{className:`px-3 py-2`,children:[(0,Q.jsx)(`span`,{className:`text-label text-soft-foreground`,children:e.status}),t?.needsAttention&&(0,Q.jsx)(`span`,{className:`block text-meta text-danger`,children:t.operation?.phase===`setup`?`Setup needs attention`:`Cleanup needs attention`}),t?.autoCleanupSuppressed&&(0,Q.jsx)(`span`,{className:`block text-meta text-muted-foreground`,children:`Automatic cleanup suppressed`}),e.reclaimable&&!t?.autoCleanupSuppressed?(0,Q.jsx)(`span`,{"data-slot":`worktree-reclaimable`,className:`ml-1 text-meta text-soft-foreground`,children:`(reclaimable)`}):null]}),(0,Q.jsx)(`td`,{className:`px-3 py-2 tabular-nums text-soft-foreground`,children:e.sizeBytes===null?`—`:_(e.sizeBytes)||`0 kB`}),(0,Q.jsx)(`td`,{className:`px-3 py-2 tabular-nums text-soft-foreground`,children:Zc(e.finishedAt??void 0)||`—`}),(0,Q.jsx)(`td`,{className:`px-3 py-2 text-right`,children:(0,Q.jsx)(J,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`worktree-delete`,"aria-label":`Delete the worktree for ${e.title}`,disabled:n,onClick:r,children:`Delete`})})]})}var dO=()=>({afterCreate:[],beforeRemove:[]}),fO=[`afterCreate`,`beforeRemove`],pO={afterCreate:`After worktree creation`,beforeRemove:`Before worktree removal`},mO=[[`root_path`,`The selected project’s root directory`],[`worktree_path`,`The isolated worktree directory`],[`worktree_id`,`Stable cez-prefixed resource identity`],[`task_id`,`The original task ID`]],hO=`w-full rounded-md border border-input bg-card px-3 py-2 text-sm outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`;function gO({config:e}){let t=W(),n=H.config,r=(0,Z.useRef)(!0);(0,Z.useEffect)(()=>(r.current=!0,()=>{r.current=!1}),[]);let i=Pr(),[a,o]=(0,Z.useState)(e.worktreeLifecycle??dO()),[c,l]=(0,Z.useState)(e.worktreeLifecycle??dO()),[u,d]=(0,Z.useState)(e.worktreeLifecycleRevision??null),[f,p]=(0,Z.useState)({}),[m,h]=(0,Z.useState)(``),[g,_]=(0,Z.useState)(``),[v,y]=(0,Z.useState)({}),[b,x]=(0,Z.useState)(null),S=(0,Z.useRef)(new Map),C=(0,Z.useRef)({draft:a,previewWorktree:g});C.current={draft:a,previewWorktree:g};let w=JSON.stringify(a)!==JSON.stringify(c);(0,Z.useEffect)(()=>{if(w)return;let t=e.worktreeLifecycle??dO();o(t),l(t),d(e.worktreeLifecycleRevision??null)},[e.worktreeLifecycle,e.worktreeLifecycleRevision,w]);let T=(e,t,n)=>{o(r=>({...r,[e]:r[e].map(e=>e.id===t?{...e,...n}:e)})),p(e=>({...e,[t]:``})),h(``),y(e=>{let n={...e};return delete n[t],n})},E=(e,t,n)=>{let r=S.current.get(t.id),i=r?.selectionStart??t.command.length,a=r?.selectionEnd??i,o=`{{ ${n} }}`;T(e,t.id,{command:t.command.slice(0,i)+o+t.command.slice(a)}),requestAnimationFrame(()=>{r?.focus(),r?.setSelectionRange(i+o.length,i+o.length)})},D=(e,t,n)=>{o(r=>{let i=[...r[e]],a=i.splice(t,1)[0];return i.splice(t+n,0,a),{...r,[e]:i}}),h(``)},O=async e=>{x(e.id);try{let t=await Xe({command:e.command,...g?{worktreeId:g}:{}}),n=fO.flatMap(e=>C.current.draft[e]).find(t=>t.id===e.id);if(!r.current||n?.command!==e.command||C.current.previewWorktree!==g)return;y(n=>({...n,[e.id]:t})),p(t=>({...t,[e.id]:``}))}catch(t){p(n=>({...n,[e.id]:t instanceof Error?t.message:`Preview failed`}))}finally{x(null)}},k=U({mutationFn:async()=>{p({}),h(``);let e=yr.safeParse(a);if(!e.success){let t={};for(let n of e.error.issues){let e=n.path[0],r=typeof n.path[1]==`number`?a[e]?.[n.path[1]]?.id:void 0;t[r??`form`]=n.message}throw p(t),Error(`Check the highlighted commands before saving.`)}for(let t of fO)for(let n of e.data[t]){if(!r.current)throw Error(`Settings closed; saving cancelled.`);try{await Xe({command:n.command})}catch(e){throw p({[n.id]:e instanceof Error?e.message:`Invalid template`}),Error(`Check the highlighted command before saving.`)}}if(!r.current)throw Error(`Settings closed; saving cancelled.`);return xe({worktreeLifecycle:e.data,worktreeLifecycleRevision:u})},onSuccess:e=>{let r=e.worktreeLifecycle??dO();l(r),o(r),d(e.worktreeLifecycleRevision??null),t.setQueryData(n,e),h(`Saved. Retry uses these commands. Saving does not restart paused scripts.`)}}),A=async()=>{try{let e=await s();t.setQueryData(n,e);let r=e.worktreeLifecycle??dO();o(r),l(r),d(e.worktreeLifecycleRevision??null),p({}),y({}),h(`Loaded saved scripts.`),k.reset()}catch(e){p({form:e instanceof Error?e.message:`Settings could not be loaded`})}},j=i.data?.worktrees.filter(e=>e.operation&&e.needsAttention)??[];return(0,Q.jsxs)(`div`,{id:`worktree-lifecycle-scripts`,className:`flex min-w-0 flex-col gap-5`,"data-slot":`worktree-lifecycle-editor`,children:[(0,Q.jsxs)(`div`,{className:`rounded-md border border-border bg-muted/30 p-3 text-ui text-muted-foreground`,children:[(0,Q.jsx)(`p`,{children:`Scripts apply only to this project. Saving commands opts in to running them as the Cezar host user, with that user’s local privileges.`}),(0,Q.jsx)(`p`,{className:`mt-1`,children:`Runtime: noninteractive Bash, in the isolated worktree directory. Bash must be installed on the host. Commands run in order; the default timeout is 30 minutes.`}),(0,Q.jsxs)(`p`,{className:`mt-1`,id:`lifecycle-variable-help`,children:[`Values are shell-escaped; do not wrap variable tokens in quotes. Use `,(0,Q.jsx)(`code`,{children:`\\{{`}),` for literal double braces, for example `,(0,Q.jsx)(`code`,{children:`docker inspect --format '\\{{.State.Status}}' container`}),`.`]})]}),(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[`Preview context`,(0,Q.jsxs)(`select`,{value:g,className:hO,onChange:e=>{_(e.target.value),y({})},children:[(0,Q.jsx)(`option`,{value:``,children:`Example values (illustrative)`}),i.data?.worktrees.filter(e=>e.onDisk).map(e=>(0,Q.jsx)(`option`,{value:e.worktreeId,children:e.task?.title??`Orphan ${e.runId.slice(0,8)}`},e.worktreeId))]})]}),fO.map(e=>(0,Q.jsxs)($,{title:pO[e],hint:e===`afterCreate`?`Run after a worktree is created and before its agent starts, including recreation after reclamation.`:`Run while the worktree files still exist, before removal or reclamation. Failure retains the directory for recovery.`,children:[a[e].length===0&&(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No commands. This phase completes without running a script.`}),a[e].map((t,n)=>(0,Q.jsxs)(`fieldset`,{className:`flex min-w-0 flex-col gap-2 rounded-md border border-border p-3`,disabled:k.isPending,children:[(0,Q.jsxs)(`legend`,{className:`px-1 text-xs font-medium`,children:[`Command `,n+1]}),(0,Q.jsx)(`label`,{className:`text-xs`,htmlFor:`lifecycle-name-${t.id}`,children:`Display name (optional)`}),(0,Q.jsx)(`input`,{id:`lifecycle-name-${t.id}`,className:hO,value:t.name??``,maxLength:120,onChange:n=>T(e,t.id,{name:n.target.value})}),(0,Q.jsxs)(`label`,{className:`text-xs`,htmlFor:`lifecycle-command-${t.id}`,children:[pO[e],` — command `,n+1]}),(0,Q.jsx)(`textarea`,{id:`lifecycle-command-${t.id}`,ref:e=>{e?S.current.set(t.id,e):S.current.delete(t.id)},className:`${hO} min-h-24 resize-y font-mono text-xs`,value:t.command,maxLength:32*1024,spellCheck:!1,"aria-describedby":`lifecycle-variable-help${f[t.id]?` lifecycle-error-${t.id}`:``}`,"aria-invalid":!!f[t.id],onChange:n=>T(e,t.id,{command:n.target.value})}),f[t.id]&&(0,Q.jsx)(`p`,{id:`lifecycle-error-${t.id}`,className:`text-xs text-danger`,role:`alert`,children:f[t.id]}),(0,Q.jsxs)(`details`,{className:`text-xs`,children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer py-1`,children:`Variables`}),(0,Q.jsx)(`ul`,{className:`mt-1 space-y-2`,children:mO.map(([r,i])=>(0,Q.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(J,{type:`button`,variant:`outline`,size:`sm`,"aria-label":`Insert ${r} into ${pO[e].toLowerCase()} command ${n+1}`,onClick:()=>E(e,t,r),children:(0,Q.jsx)(`code`,{children:`{{ ${r} }}`})}),(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:i})]},r))})]}),(0,Q.jsxs)(`details`,{className:`text-xs`,children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer py-1`,children:`Advanced timeout`}),(0,Q.jsxs)(`label`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[`Timeout in seconds (1–86,400; blank uses 1,800)`,(0,Q.jsx)(`input`,{type:`number`,min:1,max:86400,step:1,className:`${hO} max-w-32`,value:t.timeoutSeconds??``,onChange:n=>T(e,t.id,{timeoutSeconds:n.target.value===``?void 0:Number(n.target.value)})})]})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsx)(J,{type:`button`,variant:`outline`,size:`sm`,disabled:n===0,"aria-label":`Move ${pO[e].toLowerCase()} command ${n+1} up`,onClick:()=>D(e,n,-1),children:`Move up`}),(0,Q.jsx)(J,{type:`button`,variant:`outline`,size:`sm`,disabled:n===a[e].length-1,"aria-label":`Move ${pO[e].toLowerCase()} command ${n+1} down`,onClick:()=>D(e,n,1),children:`Move down`}),(0,Q.jsx)(J,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":`Remove ${pO[e].toLowerCase()} command ${n+1}`,onClick:()=>{o(n=>({...n,[e]:n[e].filter(e=>e.id!==t.id)})),h(``)},children:`Remove`}),(0,Q.jsx)(J,{type:`button`,variant:`outline`,size:`sm`,disabled:!t.command.trim()||b!==null,"aria-label":`Preview ${pO[e].toLowerCase()} command ${n+1}`,onClick:()=>void O(t),children:b===t.id?`Previewing…`:`Preview`})]}),v[t.id]&&(0,Q.jsxs)(`div`,{className:`min-w-0 rounded bg-muted p-2 text-xs`,children:[(0,Q.jsx)(`p`,{className:`font-medium`,children:v[t.id].illustrative?`Example preview — illustrative values`:`Selected worktree preview`}),(0,Q.jsxs)(`p`,{className:`break-all text-muted-foreground`,children:[`Working directory: `,v[t.id].cwd]}),(0,Q.jsx)(`pre`,{className:`mt-1 whitespace-pre-wrap break-all`,children:v[t.id].renderedCommand}),(0,Q.jsx)(`p`,{className:`mt-1 text-muted-foreground`,children:`Preview does not execute commands or expand shell expressions.`})]})]},t.id)),(0,Q.jsxs)(J,{type:`button`,variant:`outline`,size:`sm`,className:`self-start`,disabled:a[e].length>=32||k.isPending,onClick:()=>{o(t=>({...t,[e]:[...t[e],{id:crypto.randomUUID(),command:``}]})),h(``)},children:[`Add `,e===`afterCreate`?`setup`:`cleanup`,` command`]})]},e)),(f.form||k.error)&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:f.form??k.error?.message}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsx)(J,{type:`button`,disabled:!w||k.isPending,onClick:()=>k.mutate(),children:k.isPending?`Saving…`:`Save scripts`}),k.isError&&(0,Q.jsx)(J,{type:`button`,variant:`outline`,onClick:()=>void A(),children:`Reload saved scripts`})]}),m&&(0,Q.jsx)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:m}),j.length>0&&(0,Q.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[(0,Q.jsx)(`p`,{children:`Paused scripts wait for an explicit recovery choice.`}),j.map(e=>(0,Q.jsxs)(`a`,{className:`mt-1 block text-primary underline`,href:`#lifecycle-operation-${e.operation.id}`,children:[`Return to `,e.task?.title??`orphan worktree`,` and Retry`]},e.worktreeId))]})]})}var _O=0,vO=1e3;function yO(){let e=jn();return e.isPending?(0,Q.jsx)(`p`,{"data-slot":`worktrees-loading`,className:`p-4 text-ui text-soft-foreground md:p-6`,children:`Loading worktree settings…`}):e.isError?(0,Q.jsx)(gl,{icon:(0,Q.jsx)(Gl,{}),tone:`danger`,title:`Worktree settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,Q.jsx)(bO,{config:e.data})}function bO({config:e}){let t=W(),n=U({mutationFn:e=>xe(e),onSuccess:e=>t.setQueryData(H.config,e),onError:e=>Y(e.message,{tone:`danger`})}),[r,i]=(0,Z.useState)(String(e.worktreeRetention)),a=Number(r),o=r.trim()===``||!Number.isInteger(a)||a<_O||a>vO,s=e.worktreeRetention===(o?-1:a);return(0,Q.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,Q.jsxs)($,{title:`Keep last N 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,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:_O,max:vO,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,Q.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`worktrees`}),(0,Q.jsx)(J,{type:`button`,variant:`outline`,size:`sm`,"data-action":`resources-save-retention`,disabled:s||o||n.isPending,onClick:()=>n.mutate({worktreeRetention:a},{onSuccess:()=>{t.invalidateQueries({queryKey:H.worktrees}),Y(a===0?`Keeping all worktrees (unlimited)`:`Keeping the last ${a} finished worktree${a===1?``:`s`}`)}}),children:`Save`})]}),o?(0,Q.jsxs)(`p`,{"data-slot":`resources-retention-invalid`,className:`text-meta text-danger`,children:[`Enter a whole number from `,_O,` to `,vO,` (0 = unlimited).`]}):(0,Q.jsx)(`p`,{className:`text-meta text-soft-foreground`,children:a===0?`Keeping every finished worktree.`:`Keeping the last ${a} finished worktree${a===1?``:`s`} on disk.`})]}),(0,Q.jsx)(gO,{config:e}),(0,Q.jsx)($,{title:`Worktrees`,hint:`Task worktrees currently on disk. Delete one to reclaim its space now, or reclaim everything past the keep-limit at once. Reclamation keeps branches; deleting a worktree also deletes its managed branch.`,children:(0,Q.jsx)(lO,{})})]})}function xO(){let e=En(),t=c(),n=W(),[r,i]=(0,Z.useState)(`jira`),[a,o]=(0,Z.useState)(null),[s,l]=(0,Z.useState)(``),[u,d]=(0,Z.useState)(``),[f,p]=(0,Z.useState)(``),m=()=>{p(``),d(``),l(``),o(null)};(0,Z.useEffect)(()=>{m(),g(!1),b(null)},[sr()]);let[h,g]=(0,Z.useState)(!1),[_,v]=(0,Z.useState)(``),[y,b]=(0,Z.useState)(null),x=wt(r,_,h),S=x.data?.pages??[],C=S.find(e=>e.available)?.available?S.find(e=>e.available).source:void 0,w=(0,Z.useMemo)(()=>S.flatMap(e=>e.available?e.candidates:[]),[S]);(0,Z.useEffect)(()=>{g(!1),b(null),m()},[e.data?.connection?.id]);let T=S.find(e=>!e.available),E=async e=>{await n.invalidateQueries({queryKey:H.tracker.allFor(e)}),await n.invalidateQueries({queryKey:V.projects})},D=U({mutationFn:async()=>{if(!y||!C)throw Error(`Choose a tracker project first.`);let t=sr(),n=H.tracker.associationFor(t);return{...await Pn({kind:r,sourceId:C.id,externalId:y.id,...e.data?.connection?{connectionId:e.data.connection.id}:{}}),projectId:t,associationKey:n}},onSuccess:async e=>{await Promise.all([n.cancelQueries({queryKey:H.tracker.allFor(e.projectId)}),n.cancelQueries({queryKey:V.projects})]),n.setQueryData(e.associationKey,{association:e.association}),g(!1),b(null),await E(e.projectId),Y(`${e.association.externalName} connected`)},onError:e=>Y(e.message,{tone:`danger`})}),O=U({mutationFn:async()=>{let e=sr(),t=H.tracker.associationFor(e);return{...await he(),projectId:e,associationKey:t}},onSuccess:async e=>{await Promise.all([n.cancelQueries({queryKey:H.tracker.allFor(e.projectId)}),n.cancelQueries({queryKey:V.projects})]),n.setQueryData(e.associationKey,{association:null}),await E(e.projectId),Y(`Tracker disconnected`)},onError:e=>Y(e.message,{tone:`danger`})}),k=U({onMutate:()=>sr(),mutationFn:async()=>{let e=sr();if(!a)throw Error(`Choose a provider.`);return{...await Me(a===`jira`?{kind:`jira`,origin:s.trim(),email:u.trim(),token:f}:{kind:`linear`,key:f}),projectId:e}},onSuccess:async e=>{sr()===e.projectId&&(m(),g(!1),b(null)),await n.cancelQueries({queryKey:H.tracker.allFor(e.projectId)}),n.setQueryData([`tracker`,e.projectId,`connection`],{connection:e.connection,demo:e.demo}),await E(e.projectId),Y(`Credentials saved for this project. Browse and connect a scope.`)},onError:(e,t,n)=>{sr()===n&&p(``),Y(e.message,{tone:`danger`})}}),A=U({mutationFn:async()=>{let e=sr();return await Zt(),e},onSuccess:async e=>{sr()===e&&(m(),g(!1),b(null)),await n.cancelQueries({queryKey:H.tracker.allFor(e)}),n.setQueryData([`tracker`,e,`connection`],{connection:null,demo:!1}),await E(e),Y(`Project credentials removed`)},onError:e=>Y(e.message,{tone:`danger`})}),j=k.isPending||A.isPending,ee=t.data?.association,M=e.data?.connection,N=!!ee&&(e.data?.demo===!0||!!M&&M.kind===ee.kind&&M.id===ee.connectionId);return t.isPending?(0,Q.jsx)(`p`,{className:`p-6 text-sm text-muted-foreground`,children:`Loading tracker settings…`}):t.isError?(0,Q.jsx)(`p`,{className:`p-6 text-sm text-danger`,children:t.error.message}):(0,Q.jsxs)(`div`,{className:`mx-auto flex w-full max-w-2xl flex-col gap-6 p-4 md:p-6`,"data-slot":`tracker-settings`,children:[(0,Q.jsxs)(`section`,{className:`rounded-lg border border-border bg-card p-4`,children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Issue tracker`}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Connect a project or team from your issue tracker. Credentials belong only to this project and are stored locally outside the repository. Server-wide environment keys are not used.`}),N&&t.data.association?(0,Q.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-between gap-3 rounded-md border border-border p-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`font-medium`,children:t.data.association.externalName}),(0,Q.jsxs)(`a`,{className:`inline-flex items-center gap-1 text-xs text-violet hover:underline`,href:t.data.association.source.webUrl,target:`_blank`,rel:`noreferrer`,children:[ku[t.data.association.kind].label,` `,(0,Q.jsx)(ho,{className:`size-3`})]})]}),(0,Q.jsxs)(J,{variant:`outline`,onClick:()=>O.mutate(),disabled:O.isPending,children:[(0,Q.jsx)(Du,{className:`size-3.5`}),` Disconnect`]})]}):(0,Q.jsx)(`p`,{className:`mt-4 text-sm font-medium`,children:e.isPending?`Loading connection…`:e.isError?`Connection status unavailable.`:`No tracker connected.`})]}),ee&&M&&!e.isError&&!e.data?.demo&&!N?(0,Q.jsx)(`p`,{className:`text-sm text-warning`,children:`This scope needs reconnection with this project's credentials. Configure a connection, then browse and select its scope again.`}):null,e.data?.error?(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:e.data.error}):null,(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`For local credential cleanup, run `,(0,Q.jsx)(`code`,{children:`cez tracker-connections list`}),`, then `,(0,Q.jsx)(`code`,{children:`cez tracker-connections remove <id>`}),`. Local deletion does not revoke the vendor token.`]}),e.isError?(0,Q.jsxs)(`p`,{className:`text-sm text-danger`,children:[`Could not load project connection. `,(0,Q.jsx)(`button`,{onClick:()=>void e.refetch(),children:`Retry`})]}):null,(0,Q.jsxs)(`section`,{className:`rounded-lg border border-border bg-card p-4`,children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Connect a provider`}),(0,Q.jsx)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2`,children:Au.map(t=>{let n=!e.isError&&(e.data?.demo===!0||e.data?.connection?.kind===t.kind);return(0,Q.jsxs)(`div`,{className:`rounded-md border border-border p-3`,children:[(0,Q.jsx)(`p`,{className:`font-medium`,children:t.label}),e.data?.demo?null:(0,Q.jsxs)(J,{variant:`outline`,disabled:j||e.isPending||e.isError,onClick:()=>{m(),o(t.kind),g(!1),b(null)},children:[e.data?.connection?.kind===t.kind?`Replace`:`Configure`,` `,t.label,` credentials`]}),(0,Q.jsxs)(J,{className:`mt-3`,variant:`outline`,disabled:!n||j,onClick:()=>{i(t.kind),g(!0),v(``),b(null)},children:[(0,Q.jsx)(ea,{className:`size-3.5`}),` Browse `,t.label]}),n?null:(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`Configure credentials for this project to browse.`})]},t.kind)})})]}),e.data?.connection?(0,Q.jsx)(J,{variant:`outline`,disabled:j,onClick:()=>A.mutate(),children:`Remove project credentials`}):null,a?(0,Q.jsxs)(`form`,{className:`rounded-lg border border-border bg-card p-4`,onSubmit:e=>{e.preventDefault(),k.mutate()},autoComplete:`off`,children:[(0,Q.jsxs)(`h2`,{className:`font-medium`,children:[ku[a].label,` credentials for this project`]}),(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`Saved in a private .env file for this project, without encryption. Use read-only access limited to this project's data. Saving replaces this project's connection and requires selecting its scope again.`}),a===`jira`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`label`,{className:`mt-3 block text-sm`,children:[`Jira site URL`,(0,Q.jsx)(`input`,{"aria-label":`Jira site URL`,type:`url`,required:!0,value:s,onChange:e=>l(e.target.value),placeholder:`https://your-site.atlassian.net`,className:`mt-1 block w-full rounded border bg-background p-2`})]}),(0,Q.jsxs)(`label`,{className:`mt-3 block text-sm`,children:[`Account email`,(0,Q.jsx)(`input`,{"aria-label":`Account email`,type:`email`,required:!0,value:u,onChange:e=>d(e.target.value),className:`mt-1 block w-full rounded border bg-background p-2`})]})]}):null,(0,Q.jsxs)(`label`,{className:`mt-3 block text-sm`,children:[`API token`,(0,Q.jsx)(`input`,{"aria-label":`API token`,type:`password`,autoComplete:`new-password`,required:!0,maxLength:8192,value:f,onChange:e=>p(e.target.value),className:`mt-1 block w-full rounded border bg-background p-2`})]}),(0,Q.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,Q.jsx)(J,{type:`submit`,disabled:j,children:`Save project credentials`}),(0,Q.jsx)(J,{type:`button`,variant:`outline`,disabled:j,onClick:m,children:`Cancel`})]})]}):null,h?(0,Q.jsxs)(`section`,{className:`rounded-lg border border-violet/40 bg-card p-4`,"aria-label":`${ku[r].label} picker`,children:[(0,Q.jsxs)(`label`,{className:`text-xs font-medium`,htmlFor:`tracker-candidate-search`,children:[`Search `,ku[r].scopeLabel]}),(0,Q.jsx)(`input`,{id:`tracker-candidate-search`,className:`mt-2 h-9 w-full rounded-md border border-border bg-background px-3 text-sm`,value:_,onChange:e=>{v(e.target.value),b(null)},placeholder:`Search by name…`}),(0,Q.jsxs)(`div`,{className:`mt-3 max-h-64 space-y-1 overflow-auto`,children:[x.isPending?(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading…`}):null,x.isError?(0,Q.jsx)(SO,{reason:x.error.message,generation:x.errorUpdatedAt,retry:()=>void x.refetch()}):null,T&&!T.available?(0,Q.jsx)(SO,{reason:T.reason,generation:x.dataUpdatedAt,retryAfterSeconds:T.code===`rate_limited`?T.retryAfterSeconds:void 0,retry:()=>void x.refetch()}):null,w.map(e=>(0,Q.jsx)(`button`,{type:`button`,className:`block w-full rounded-md border px-3 py-2 text-left text-sm ${y?.id===e.id?`border-violet bg-violet/10`:`border-border`}`,onClick:()=>b(e),children:e.name},e.id)),!x.isPending&&!x.isError&&!T&&w.length===0?(0,Q.jsx)(`p`,{className:`py-3 text-sm text-muted-foreground`,children:`No projects or teams match.`}):null,x.hasNextPage?(0,Q.jsx)(J,{variant:`ghost`,onClick:()=>void x.fetchNextPage(),disabled:x.isFetchingNextPage,children:`Load more`}):null]}),(0,Q.jsxs)(`div`,{className:`mt-4 flex gap-2`,children:[(0,Q.jsx)(J,{variant:`contrast`,disabled:!y||D.isPending||j,onClick:()=>D.mutate(),children:`Connect`}),(0,Q.jsx)(J,{variant:`ghost`,onClick:()=>g(!1),children:`Cancel`})]})]}):null]})}function SO({reason:e,retry:t,retryAfterSeconds:n=0,generation:r}){let[i,a]=(0,Z.useState)(n);return(0,Z.useEffect)(()=>a(n),[e,n,r]),(0,Z.useEffect)(()=>{if(i<=0)return;let e=window.setInterval(()=>a(e=>Math.max(0,e-1)),1e3);return()=>window.clearInterval(e)},[i>0]),(0,Q.jsxs)(`div`,{className:`rounded-md border border-danger/30 bg-danger/5 p-3 text-sm`,children:[(0,Q.jsx)(`p`,{className:`text-danger`,children:e}),(0,Q.jsx)(J,{className:`mt-2`,variant:`outline`,disabled:i>0,onClick:t,children:i>0?`Retry in ${i}s`:`Retry`})]})}var CO={checks:`Check steps (workflow commands)`,cezar:`cezar itself (its own features — not the agents)`};function wO(e){return e===`keychain`?`Encrypted with a data key kept in your OS keychain.`:`Encrypted with a data key in ~/.cezar/secrets/.key (0600) — no OS keychain is available on this machine, so this is a private file, not a vault.`}function TO({scope:e,list:t,save:n,remove:r,invalidate:i}){let a=W(),[o,s]=(0,Z.useState)(``),[c,l]=(0,Z.useState)(``),[u,d]=(0,Z.useState)([`checks`]),[f,p]=(0,Z.useState)(null),m=o===``?null:or(o),h=U({mutationFn:async()=>{let e=sr();return await n(o,{value:c,audiences:u}),{projectId:e,saved:o}},onSuccess:async({projectId:e,saved:t})=>{sr()===e&&(s(``),l(``),p(null)),await i(a,e),Y(`${t} saved`)},onError:e=>p(e.message)}),g=U({mutationFn:async e=>{let t=sr();return await r(e),{projectId:t,removed:e}},onSuccess:async({projectId:e,removed:t})=>{await i(a,e),Y(`${t} removed`)},onError:e=>Y(e.message,{tone:`danger`})}),_=()=>{let e=or(o);if(e){p(e);return}if(u.length===0){p(`pick at least one audience`);return}p(null),h.mutate()},v=e=>d(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),y=e===`project`?`Project secrets`:`Workspace secrets`,b=e===`project`?`Values for this project only — an e2e runner’s model key, a staging login. They reach the audiences you pick and never an agent session.`:`Values shared by every project on this machine — a key cezar’s own features use, a token every project’s checks need. A project secret of the same name wins. They never reach an agent session.`,x=t.data?.secrets??[];return(0,Q.jsxs)(`div`,{className:`mx-auto flex w-full max-w-2xl flex-col gap-6 p-4 md:p-6`,"data-slot":`secrets-settings`,"data-scope":e,children:[(0,Q.jsxs)(`section`,{className:`rounded-lg border border-border bg-card p-4`,children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold`,children:y}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:b}),t.isPending?(0,Q.jsx)(`p`,{className:`mt-4 text-sm text-muted-foreground`,children:`Loading…`}):null,t.isError?(0,Q.jsx)(`p`,{role:`alert`,className:`mt-4 text-sm text-danger`,children:t.error?.message}):null,t.data&&x.length===0?(0,Q.jsx)(`p`,{className:`mt-4 text-sm text-muted-foreground`,children:`No secrets stored.`}):null,t.data&&x.length>0?(0,Q.jsx)(`ul`,{className:`mt-4 divide-y divide-border rounded-md border border-border`,"aria-label":`Stored ${e} secrets`,children:x.map(e=>(0,Q.jsxs)(`li`,{className:`flex items-center justify-between gap-3 px-3 py-2`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`code`,{className:`text-sm`,children:e.name}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.audiences.map(e=>CO[e].split(` (`)[0]).join(` · `)})]}),(0,Q.jsxs)(J,{variant:`outline`,"aria-label":`Delete ${e.name}`,disabled:g.isPending,onClick:()=>g.mutate(e.name),children:[(0,Q.jsx)(Qo,{className:`size-3.5`}),` Delete`]})]},e.name))}):null,t.data?.skipped?(0,Q.jsxs)(`p`,{role:`alert`,className:`mt-3 text-xs text-destructive`,"data-slot":`secrets-skipped`,children:[`Stored values cannot be read: `,t.data.skipped,`.`]}):null,t.data?(0,Q.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,"data-slot":`key-backend`,children:wO(t.data.keyBackend)}):null]}),(0,Q.jsxs)(`form`,{className:`rounded-lg border border-border bg-card p-4`,autoComplete:`off`,onSubmit:e=>{e.preventDefault(),_()},children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Add or replace a secret`}),(0,Q.jsxs)(`label`,{className:`mt-3 block text-sm`,children:[`Name`,(0,Q.jsx)(`input`,{"aria-label":`Name`,value:o,onChange:e=>{s(e.target.value.toUpperCase()),p(null)},autoComplete:`off`,spellCheck:!1,placeholder:`AI_GATEWAY_API_KEY`,"aria-invalid":m?!0:void 0,className:`mt-1 block w-full rounded border border-border bg-background p-2 font-mono`})]}),m?(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-danger`,children:m}):null,(0,Q.jsxs)(`label`,{className:`mt-3 block text-sm`,children:[`Value`,(0,Q.jsx)(`input`,{"aria-label":`Value`,type:`password`,autoComplete:`off`,required:!0,value:c,onChange:e=>l(e.target.value),className:`mt-1 block w-full rounded border border-border bg-background p-2`})]}),(0,Q.jsxs)(`fieldset`,{className:`mt-3`,children:[(0,Q.jsx)(`legend`,{className:`text-sm`,children:`Who may read it`}),xr.map(e=>(0,Q.jsxs)(`label`,{className:`mt-1 flex items-center gap-2 text-sm`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,"aria-label":CO[e],checked:u.includes(e),onChange:()=>v(e)}),CO[e]]},e)),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Agents are never an audience: a secret cannot be handed to a Claude Code, Codex or OpenCode session.`})]}),f&&f!==m?(0,Q.jsx)(`p`,{role:`alert`,className:`mt-2 text-sm text-danger`,children:f}):null,(0,Q.jsx)(`div`,{className:`mt-3`,children:(0,Q.jsx)(J,{type:`submit`,disabled:h.isPending||o===``||c===``||u.length===0||!!m,children:`Save secret`})})]})]})}function EO(){return(0,Q.jsx)(TO,{scope:`project`,list:be(),save:g,remove:yt,invalidate:(e,t)=>e.invalidateQueries({queryKey:H.secrets.allFor(t??``)})})}function DO(){return(0,Q.jsx)(TO,{scope:`workspace`,list:kn(),save:b,remove:It,invalidate:e=>e.invalidateQueries({queryKey:V.secrets})})}var OO={"task.attention_required":`Needs your input`,"task.review_ready":`Ready for review`,"task.finished":`Task finished`,"task.failed":`Task failed`,"task.cancelled":`Task cancelled`,"webhook.test":`Test message`},kO=`h-9 w-full rounded-md border border-input bg-card px-3 py-1 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`,AO=`text-ui text-muted-foreground`;function jO(e){return{format:e?.format??`cezar.json.v1`,name:e?.name??``,url:``,profile:e?.profile??`minimal`,preset:e?.preset??`attention`,events:e?.events??[],scope:e?.scope??`main_and_questions`,graceSeconds:e?.graceSeconds??180,local:e?.allowLocalNetwork??!1,scheduled:e?.includeScheduledFailures??!1}}function MO({id:e,label:t,children:n}){return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e?(0,Q.jsx)(`label`,{htmlFor:e,className:`text-sm font-medium`,children:t}):(0,Q.jsx)(`span`,{className:`text-sm font-medium`,children:t}),n]})}function NO({receiver:e,draft:t,setDraft:n,pending:r,blocked:i=!1,guideHref:a,save:o}){let s=(0,Z.useId)(),{format:c,name:l,url:u,profile:d,preset:f,events:p,scope:m,graceSeconds:h,local:g,scheduled:_}=t,v=(e,r)=>n({...t,[e]:r}),[y,b]=(0,Z.useState)(``),x=c!==`cezar.json.v1`,S=c===`slack.v1`?`Slack`:`Discord`,C;try{let e=new URL(u).hostname;e===`hooks.slack.com`&&(C=`slack.v1`),[`discord.com`,`discordapp.com`,`ptb.discord.com`,`canary.discord.com`].includes(e)&&(C=`discord.v1`)}catch{}let w=e=>n({...t,format:e,local:e===`cezar.json.v1`&&g});return(0,Q.jsxs)(`form`,{className:`flex flex-col gap-4`,onSubmit:t=>{if(t.preventDefault(),r||i)return;let n={format:c,name:l,...u||!e?{url:u}:{},profile:d,preset:f,events:p,scope:m,graceSeconds:h,allowLocalNetwork:!x&&g,includeScheduledFailures:_},a=e?Qn.safeParse({...n,expectedRevision:e.revision}):$n.safeParse(n);if(!a.success){b([...new Set(a.error.issues.map(e=>e.message.replace(/\.?$/,`.`)))].join(` `));return}b(``),o(a.data)},children:[(0,Q.jsx)(MO,{id:`${s}-destination`,label:`Destination`,children:(0,Q.jsxs)(`select`,{id:`${s}-destination`,className:kO,value:c,onChange:e=>w(e.target.value),children:[(0,Q.jsx)(`option`,{value:`cezar.json.v1`,children:`Custom receiver (signed cezar JSON)`}),(0,Q.jsx)(`option`,{value:`slack.v1`,children:`Slack channel (Incoming Webhook)`}),(0,Q.jsx)(`option`,{value:`discord.v1`,children:`Discord channel (Webhook URL)`})]})}),(0,Q.jsx)(MO,{id:`${s}-name`,label:`Name`,children:(0,Q.jsx)(qs,{id:`${s}-name`,value:l,onChange:e=>v(`name`,e.target.value),maxLength:100,required:!0,autoComplete:`off`})}),(0,Q.jsxs)(MO,{id:`${s}-url`,label:x?`Webhook URL`:`Receiver URL`,children:[(0,Q.jsx)(qs,{id:`${s}-url`,type:`url`,value:u,onChange:e=>v(`url`,e.target.value),required:!e,autoComplete:`off`,placeholder:e?`Leave blank to keep the current URL`:c===`slack.v1`?`https://hooks.slack.com/services/…`:c===`discord.v1`?`https://discord.com/api/webhooks/…`:`https://your-receiver.example/webhook`}),e&&(0,Q.jsxs)(`p`,{className:AO,children:[`Current: `,e.destination,` (path hidden)`]}),u.startsWith(`http:`)&&(0,Q.jsx)(`p`,{className:`text-ui text-warning`,children:`Plain HTTP is not encrypted. Use HTTPS outside a trusted local network.`}),!x&&C&&(0,Q.jsxs)(`div`,{role:`status`,className:`flex flex-wrap items-center gap-2 text-ui text-warning`,children:[(0,Q.jsxs)(`span`,{children:[`This is a `,C===`slack.v1`?`Slack`:`Discord`,` webhook. Switch the destination to post channel messages.`]}),(0,Q.jsxs)(J,{type:`button`,size:`sm`,variant:`outline`,className:`text-foreground`,onClick:()=>w(C),children:[`Use `,C===`slack.v1`?`Slack`:`Discord`]})]}),c===`slack.v1`&&(0,Q.jsxs)(`p`,{className:AO,children:[`In Slack, create an app with an Incoming Webhook, install it in your channel and paste its URL. `,(0,Q.jsx)(`a`,{className:`underline underline-offset-2 hover:text-foreground`,href:`https://docs.slack.dev/messaging/sending-messages-using-incoming-webhooks/`,target:`_blank`,rel:`noreferrer`,children:`Slack setup guide`})]}),c===`discord.v1`&&(0,Q.jsxs)(`p`,{className:AO,children:[`In Discord, open Server Settings → Integrations → Webhooks, create one and paste its URL. `,(0,Q.jsx)(`a`,{className:`underline underline-offset-2 hover:text-foreground`,href:`https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks`,target:`_blank`,rel:`noreferrer`,children:`Discord setup guide`})]}),x?(0,Q.jsxs)(`p`,{className:AO,children:[`Keep this URL secret — anyone who has it can post to the channel. `,S,` receivers need no signing key.`]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`label`,{className:`flex items-start gap-2 text-sm`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`mt-0.5`,checked:g,onChange:e=>v(`local`,e.target.checked)}),`Allow a receiver on this computer or private network`]}),g&&(0,Q.jsx)(`p`,{className:AO,children:`Tests will contact this private address. Hosted cezar sends to public HTTPS receivers only.`}),(0,Q.jsx)(`a`,{className:`text-ui text-muted-foreground underline underline-offset-2 hover:text-foreground`,href:`${a}#external-automation-receivers`,target:`_blank`,rel:`noreferrer`,children:`How to build a receiver`})]})]}),(0,Q.jsx)(MO,{id:`${s}-events`,label:`Events`,children:(0,Q.jsx)(`select`,{id:`${s}-events`,className:kO,value:f,onChange:e=>v(`preset`,e.target.value),children:[`attention`,`all`,`custom`].map(e=>(0,Q.jsx)(`option`,{value:e,children:FE[e]},e))})}),f===`custom`&&(0,Q.jsxs)(`fieldset`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`legend`,{className:`mb-1 text-sm font-medium`,children:`Choose events`}),Object.entries(OO).filter(([e])=>e!==`webhook.test`).map(([e,t])=>(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked:p.includes(e),onChange:t=>v(`events`,t.target.checked?[...p,e]:p.filter(t=>t!==e))}),t]},e))]}),(0,Q.jsxs)(MO,{id:`${s}-profile`,label:`Message content`,children:[(0,Q.jsxs)(`select`,{id:`${s}-profile`,className:kO,value:d,onChange:e=>v(`profile`,e.target.value),children:[(0,Q.jsx)(`option`,{value:`minimal`,children:`Minimal — IDs, status and your own title`}),(0,Q.jsx)(`option`,{value:`standard`,children:`Standard — task titles, questions and errors`})]}),(0,Q.jsx)(`p`,{className:AO,children:`Prompts and transcripts are never sent. Redaction of other text is best effort.`}),x&&d===`standard`&&(0,Q.jsxs)(`p`,{className:`text-ui text-warning`,children:[`Standard posts task titles, questions and error text to your `,S,` channel.`]})]}),x?(0,Q.jsx)(PO,{format:c,profile:d}):(0,Q.jsxs)(`details`,{children:[(0,Q.jsxs)(`summary`,{className:`cursor-pointer text-sm font-medium`,children:[`Preview JSON · `,d===`minimal`?`Minimal`:`Standard`]}),(0,Q.jsx)(`p`,{className:`mt-2 ${AO}`,children:`Example data only — nothing is sent.`}),(0,Q.jsx)(`pre`,{"aria-label":`Synthetic JSON sample`,className:`mt-2 max-h-64 overflow-auto whitespace-pre-wrap break-all rounded-md bg-muted p-3 text-xs`,children:JSON.stringify({id:`evt_00000000-0000-4000-8000-000000000001`,schemaVersion:1,sequence:1,occurredAt:`2026-01-01T12:00:00Z`,type:`task.attention_required`,source:{instanceId:`example-instance`,projectId:`example-project`,mode:`local`},task:{id:`example-task`,previousStatus:`running`,status:`waiting`,...d===`standard`?{title:`Example generated task title`}:{}},data:{episodeId:`example-episode`,since:`2026-01-01T12:00:00Z`,reason:`question`,requestId:`example-request`,...d===`standard`?{questions:[{question:`Which example option should be used?`,options:[{label:`Example A`},{label:`Example B`}]}]}:{}}},null,2)})]}),(0,Q.jsxs)(`details`,{children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium`,children:`Advanced`}),(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-col gap-4`,children:[(0,Q.jsx)(MO,{id:`${s}-scope`,label:`Tasks`,children:(0,Q.jsx)(`select`,{id:`${s}-scope`,className:kO,value:m,onChange:e=>v(`scope`,e.target.value),children:[`main_and_questions`,`every_task`].map(e=>(0,Q.jsx)(`option`,{value:e,children:PE[e]},e))})}),(0,Q.jsxs)(MO,{id:`${s}-grace`,label:`Waiting and review delay`,children:[(0,Q.jsx)(`select`,{id:`${s}-grace`,className:kO,value:h,onChange:e=>v(`graceSeconds`,Number(e.target.value)),children:[0,60,180,600].map(e=>(0,Q.jsx)(`option`,{value:e,children:IE[e]},e))}),(0,Q.jsx)(`p`,{className:AO,children:`Skipped if you reply, or the task stops waiting or leaves review, before the delay ends.`})]}),(0,Q.jsxs)(`label`,{className:`flex items-start gap-2 text-sm`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`mt-0.5`,checked:_,onChange:e=>v(`scheduled`,e.target.checked)}),`Include failures that will resume automatically (always included in All results)`]})]})]}),y&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:y}),(0,Q.jsx)(`div`,{children:(0,Q.jsx)(J,{type:`submit`,disabled:r||i,children:r?`Saving…`:e?`Review changes`:`Save receiver`})})]})}function PO({format:e,profile:t}){let n=e===`slack.v1`?`Slack`:`Discord`;return(0,Q.jsxs)(`details`,{children:[(0,Q.jsxs)(`summary`,{className:`cursor-pointer text-sm font-medium`,children:[`Preview `,n,` message · `,t===`minimal`?`Minimal`:`Standard`]}),(0,Q.jsx)(`p`,{className:`mt-2 ${AO}`,children:`Example data only — nothing is sent.`}),(0,Q.jsxs)(`div`,{"aria-label":`${n} message sample`,className:`mt-2 space-y-2 rounded-md border border-border bg-muted p-3 text-sm ${e===`discord.v1`?`border-l-4 border-l-pending`:``}`,children:[(0,Q.jsxs)(`p`,{className:`font-medium`,children:[`Needs your input · `,t===`standard`?`Example generated task title`:`a1b2c3d4`]}),(0,Q.jsx)(`p`,{children:`running → waiting`}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`example-project · a1b2c3d4 · Jan 1, 2026, 12:00 UTC`}),t===`standard`&&(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{children:`Which example option should be used?`}),(0,Q.jsx)(`p`,{children:`Example A · Example B`})]}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`cezar`})]})]})}var FO={local_consent_required:`This address is on this computer or a private network. Edit the receiver and turn on “Allow a receiver on this computer or private network”.`,server_port:`This address points at the cezar server itself. Use your receiver's own port.`,https_required:`This server only sends to HTTPS receivers. Use an https:// URL.`,public_destination_required:`This server only sends to public receivers. Use a publicly reachable HTTPS URL.`,metadata_hostname:`Cloud metadata hostnames are never allowed as receivers.`,denied_address:`The receiver resolves to an address that is never allowed.`,mixed_dns:`The receiver hostname resolves to both public and private addresses. Use a hostname with one kind of address.`,invalid_dns:`The receiver hostname did not resolve to a usable address.`,dns_not_found:`The receiver hostname does not resolve. Check the URL.`,invalid_url:`The receiver URL is not allowed. Use a plain http(s) URL without credentials or a fragment.`};function IO({projectId:e,test:t,openHistory:n}){let r=gt({queryKey:[...Px(e),`test-result`,t.receiverId,t.deliveryId],queryFn:()=>Fe.deliveries(e,t.receiverId),retry:!1}),i=r.data?.items.find(e=>e.deliveryId===t.deliveryId),a=r.data?.receiver,o=t.format??(a?.kind===`live`?a.format:void 0),s=i&&[`delivered`,`failed`,`cancelled`,`superseded`,`dropped`].includes(i.status),c=(0,Z.useRef)(void 0),l=s?i.status:void 0,u=i?.reason===`outcome_unknown`;(0,Z.useEffect)(()=>{let n=`${e}:${t.deliveryId}`;!l||c.current===n||(c.current=n,l===`delivered`&&!u?Y(`Test delivered to ${t.receiverName}`):Y(u?`Test result for ${t.receiverName} is unknown`:`Test to ${t.receiverName} failed`,{tone:`danger`}))},[e,t.deliveryId,t.receiverName,l,u]);let d=s&&i.status===`delivered`&&!u,f=r.error?`Test result is unavailable. Check the history.`:r.data&&!i?`Test sent. Its result is in the history.`:s?u?`Test result unknown — it may have arrived. Check your receiver before testing again.`:d?`Test delivered.${a?.kind===`live`&&[`inactive`,`paused`].includes(a.state)?` ${a.state===`paused`?`Resume`:`Activate`} the receiver to start sending task updates.`:``}`:`Test ${i.status===`failed`?`failed`:i.status}${i.reason?`: ${UE(i.reason)}`:``}.`:`Test sent — waiting for the result…`,p=!s||d||u?void 0:i.reason===`timeout`||i.reason===`connection_failed`?`Check that your receiver is reachable and responds within 10 seconds.`:/^http_(401|403)$/.test(i.reason??``)?o===`slack.v1`||o===`discord.v1`?`Check the webhook URL in Slack or Discord. If it was revoked or replaced, edit this receiver with the current URL and send a new test.`:`Check the receiver’s authentication and the signing key in its verifier.`:i.reason===`http_404`||i.reason===`http_410`?`Check the URL and that the endpoint still exists.`:FO[i.reason??``]?`${FO[i.reason]} Activation stays blocked until a test passes.`:`Fix the receiver, then send a new test. Tests are not retried automatically.`,m=d?`border-success/40`:s?`border-danger/30 bg-danger/5`:`border-border`;return(0,Q.jsxs)(`div`,{role:`status`,"data-test-delivery":t.deliveryId,className:`flex flex-wrap items-center justify-between gap-2 rounded-md border p-3 text-ui ${m}`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`p`,{children:f}),p&&(0,Q.jsx)(`p`,{className:`text-muted-foreground`,children:p})]}),(0,Q.jsx)(J,{size:`sm`,variant:`ghost`,onClick:()=>n(t.receiverId),children:`View in history`})]})}var LO=Object.keys(RE),RO={delivered:`text-success`,failed:`text-danger`,dropped:`text-danger`,blocked_policy:`text-warning`,retrying:`text-warning`};function zO({projectId:e,receiver:t,operation:n,tab:r,onTabChange:i}){let[a,o]=(0,Z.useState)(`deliveries`),s=r??a,c=e=>{o(e),i?.(e)},[l,u]=(0,Z.useState)(`all`),d=(0,Z.useId)(),[f,p]=(0,Z.useState)(``),[m,h]=(0,Z.useState)(``),[g,_]=(0,Z.useState)(),v=cn({queryKey:[...Px(e),t.id,`deliveries`,f],initialPageParam:void 0,queryFn:({pageParam:n})=>Fe.deliveries(e,t.id,n,f||void 0),getNextPageParam:e=>e.nextCursor,enabled:s===`deliveries`,retry:!1}),y=gt({queryKey:[...Px(e),t.id,`activity`],queryFn:()=>Fe.activity(e,t.id),enabled:s===`activity`,retry:!1}),b=[...new Map((v.data?.pages.flatMap(e=>e.items)??[]).map(e=>[e.deliveryId,e])).values()],x=b.filter(e=>l===`all`||e.status===l),S=v.data?.pages[0]?.timezone,C=e=>qE(e,S);return(0,Q.jsxs)(`section`,{className:`flex min-w-0 flex-col gap-3`,children:[t.kind===`history`&&(0,Q.jsxs)(`p`,{className:`rounded-md border border-border bg-muted p-3 text-ui text-muted-foreground`,children:[`Deleted `,qE(t.deletedAt),` — read-only. Its settings and signing keys are gone; history is kept for up to 30 days.`]}),(0,Q.jsxs)(Ks,{value:s,onValueChange:e=>c(e),children:[(0,Q.jsxs)(Gs,{"aria-label":`Receiver history`,children:[(0,Q.jsx)(Us,{value:`deliveries`,children:`Deliveries`}),(0,Q.jsx)(Us,{value:`activity`,children:`Activity`})]}),(0,Q.jsxs)(Ws,{value:`activity`,className:`flex flex-col gap-2`,children:[(0,Q.jsxs)(`p`,{className:`text-ui text-muted-foreground`,children:[`Times in `,KE(y.data?.timezone).label,`.`]}),y.isPending&&(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading activity…`}),y.error&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:y.error.message}),y.data?.items.map(e=>(0,Q.jsxs)(`div`,{className:`rounded-md border border-border p-3 text-sm`,children:[(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:WE(e.action)}),` `,(0,Q.jsxs)(`span`,{className:`text-muted-foreground`,children:[`· `,qE(e.at,y.data?.timezone),` · via `,VE[e.source],e.revision!==void 0&&` · revision ${e.revision}`]})]}),e.fields.length>0&&(0,Q.jsxs)(`p`,{className:`text-ui text-muted-foreground`,children:[`Changed: `,e.fields.join(`, `)]}),e.detail&&(0,Q.jsx)(`p`,{className:`text-ui text-muted-foreground`,children:e.detail})]},e.id)),y.data?.items.length===0&&(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No activity in the retained history.`}),y.data?.hasMore&&(0,Q.jsx)(`p`,{className:`text-ui text-muted-foreground`,children:`Showing the latest 100 actions.`})]}),(0,Q.jsxs)(Ws,{value:`deliveries`,className:`flex flex-col gap-3`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2`,children:[(0,Q.jsxs)(`form`,{className:`flex min-w-0 flex-1 items-end gap-2`,onSubmit:e=>{e.preventDefault(),p(m.trim())},children:[(0,Q.jsxs)(`label`,{className:`flex min-w-0 flex-1 flex-col gap-1.5 text-sm font-medium`,children:[`Task ID`,(0,Q.jsx)(qs,{value:m,onChange:e=>h(e.target.value),placeholder:`Optional — show one task’s deliveries`})]}),(0,Q.jsx)(J,{type:`submit`,variant:`outline`,children:`Find`})]}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Q.jsx)(`span`,{id:d,className:`text-sm font-medium`,children:`Result`}),(0,Q.jsxs)(Th,{value:l,onValueChange:u,children:[(0,Q.jsx)(Dh,{"aria-labelledby":d,children:(0,Q.jsx)(Eh,{})}),(0,Q.jsxs)(Oh,{children:[(0,Q.jsx)(kh,{value:`all`,children:`All results`}),LO.map(e=>(0,Q.jsx)(kh,{value:e,children:RE[e]},e))]})]})]})]}),(0,Q.jsxs)(`p`,{className:`text-ui text-muted-foreground`,children:[`Showing `,b.length?`1–${b.length}`:`0`,` of `,v.data?.pages[0]?.total??0,f?` for task ${f}`:``,`. The result filter applies to loaded entries. Times in `,KE(S).label,`.`]}),v.isPending&&(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading deliveries…`}),v.error&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:v.error.message}),!v.isPending&&x.length===0&&(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No deliveries match.`}),x.map(e=>(0,Q.jsxs)(`article`,{className:`min-w-0 rounded-md border border-border p-3 text-sm`,children:[(0,Q.jsxs)(`button`,{className:`w-full min-w-0 text-left`,type:`button`,"aria-expanded":g===e.deliveryId,onClick:()=>_(t=>t===e.deliveryId?void 0:e.deliveryId),children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:OO[e.eventType]}),` · `,(0,Q.jsx)(`span`,{className:RO[e.status],children:RE[e.status]}),(0,Q.jsxs)(`span`,{className:`block text-ui text-muted-foreground`,children:[C(e.createdAt),` · `,GE(e.attempts,`attempt`,`attempts`),e.taskId?` · task ${e.taskId.slice(0,8)}`:``]})]}),g===e.deliveryId&&(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-col gap-2 break-words border-t border-border pt-3 text-ui`,children:[(0,Q.jsxs)(`dl`,{className:`grid grid-cols-[auto_minmax(0,1fr)] gap-x-3 gap-y-1 [overflow-wrap:anywhere]`,children:[e.reason&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Reason`}),(0,Q.jsx)(`dd`,{children:UE(e.reason)})]}),e.httpStatus&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`HTTP status`}),(0,Q.jsx)(`dd`,{children:e.httpStatus})]}),e.nextAttemptAt&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Next attempt`}),(0,Q.jsx)(`dd`,{children:C(e.nextAttemptAt)})]}),(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Retries until`}),(0,Q.jsx)(`dd`,{children:C(e.expiresAt)}),e.taskId&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Task`}),(0,Q.jsxs)(`dd`,{children:[e.taskAvailability===`available`?(0,Q.jsx)(X,{className:`underline underline-offset-2`,to:`/tasks/${encodeURIComponent(e.taskId)}`,children:e.taskId}):e.taskId,e.taskAvailability===`deleted`&&` (deleted)`,e.taskAvailability===`unknown`&&` (availability unknown)`]})]}),(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Destination`}),(0,Q.jsx)(`dd`,{children:e.destination}),(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Event ID`}),(0,Q.jsx)(`dd`,{className:`font-mono text-xs`,children:e.eventId}),(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Delivery ID`}),(0,Q.jsx)(`dd`,{className:`font-mono text-xs`,children:e.deliveryId}),e.payloadRetainedUntil&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Payload kept until`}),(0,Q.jsx)(`dd`,{children:C(e.payloadRetainedUntil)})]}),e.historyRetainedUntil&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`History kept until`}),(0,Q.jsxs)(`dd`,{children:[C(e.historyRetainedUntil),` at most`]})]})]}),e.payloadAvailability===`not_created`&&(0,Q.jsx)(`p`,{className:`text-muted-foreground`,children:`No payload was created for this delivery.`}),e.payloadAvailability===`unknown`&&(0,Q.jsx)(`p`,{className:`text-muted-foreground`,children:`Payload availability is unknown.`}),e.response&&(0,Q.jsx)(`pre`,{className:`max-h-40 overflow-auto whitespace-pre-wrap rounded-md bg-muted p-2 text-xs`,children:e.response}),t.kind===`live`&&(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(J,{size:`sm`,variant:`outline`,disabled:!e.retryAllowed,onClick:()=>n(`retry`,e,t),children:`Retry now`}),(0,Q.jsx)(J,{size:`sm`,variant:`outline`,disabled:!e.replayAllowed,onClick:()=>n(`replay`,e,t),children:`Replay`}),!e.replayAllowed&&(0,Q.jsxs)(`span`,{className:`text-muted-foreground`,children:[`Replay unavailable: `,e.replayUnavailableReason?BO[e.replayUnavailableReason]:`the payload or receiver is no longer eligible.`]})]})]})]},e.deliveryId)),v.hasNextPage&&(0,Q.jsx)(`div`,{children:(0,Q.jsx)(J,{variant:`outline`,disabled:v.isFetchingNextPage,onClick:()=>void v.fetchNextPage(),children:`Load older`})})]})]})]})}var BO={receiver_deleted:`the receiver was deleted.`,receiver_inactive:`activate the receiver first.`,configuration_changed:`the receiver settings changed since.`,task_unavailable:`the task is deleted or its state cannot be checked.`,not_fresh:`the event is out of date.`,not_terminal:`the delivery has not finished yet.`,synthetic_test:`send a new test instead.`,payload_expired:`the payload is no longer kept.`,payload_unavailable:`the original payload is unavailable.`};function VO(){let e=Vc()??`default`,t=T();return t.isError?(0,Q.jsx)(`p`,{role:`status`,className:UO,children:`Webhook status unavailable — could not load server health.`}):t.data?(0,Q.jsx)(HO,{projectId:e,enabled:t.data?.capabilities.webhooks===!0,unsupportedPlatform:t.data?.capabilities.webhooksUnavailableReason===`unsupported_platform`},e):(0,Q.jsx)(`p`,{role:`status`,className:UO,children:`Loading webhook status…`})}function HO({projectId:e,enabled:t,unsupportedPlatform:n}){let r=W(),[i,a]=kr(),o=Dr(),s=(0,Z.useRef)({mounted:!1,token:Symbol()});(0,Z.useLayoutEffect)(()=>(s.current={mounted:!0,token:Symbol()},()=>{s.current.mounted=!1}),[o]);let c=e=>s.current.mounted&&s.current.token===e,l=i.get(`endpoint`)??``,u=i.get(`tab`)??`settings`,d=/^[A-Za-z0-9_-]{1,128}$/.test(l),f=[`settings`,`deliveries`,`activity`].includes(u),p=u===`activity`?`activity`:`deliveries`,m=(0,Z.useRef)(i.toString());(0,Z.useLayoutEffect)(()=>{m.current=i.toString()},[i]);let h=(e,t=`deliveries`)=>{let n=new URLSearchParams(m.current);e?(n.set(`endpoint`,e),n.set(`tab`,t)):(n.delete(`endpoint`),n.delete(`tab`)),n.toString()!==m.current&&(m.current=n.toString(),a(n))},g=JE(gt({queryKey:[`workspace`,`self-update`],queryFn:({signal:e})=>zn({signal:e}),retry:!1}).data),_=Fx(e,t),[v,y]=(0,Z.useState)(),[b,x]=(0,Z.useState)(()=>jO()),[S,C]=(0,Z.useState)(!1),[w,T]=(0,Z.useState)(``),[E,D]=(0,Z.useState)(),[O,k]=(0,Z.useState)(),A=(0,Z.useRef)(null),j=(0,Z.useRef)(null),ee=(0,Z.useRef)(null),M=(0,Z.useRef)(null),N=(e,t)=>{e.preventDefault();let n=[...document.querySelectorAll(`[role="dialog"][data-state="open"]`)];n.length&&!n.some(e=>t&&e.contains(t))||(t?.isConnected&&!t.matches(`:disabled`)?t.focus():A.current?.focus())},[te,ne]=(0,Z.useState)(!1),[P,F]=(0,Z.useState)(!1);(0,Z.useLayoutEffect)(()=>{v===`new`&&(y(void 0),x(jO()),C(!1),z(``))},[o]),(0,Z.useLayoutEffect)(()=>{k(void 0),ne(!1),F(!1)},[o]);let re=(0,Z.useRef)(new Map),I=(0,Z.useRef)(new Map),ie=(0,Z.useRef)(void 0);(0,Z.useLayoutEffect)(()=>{d&&f&&u!==`settings`&&(ie.current=re.current.get(l))},[l,d,f,u,_.data]);let L=(0,Z.useRef)(void 0),ae=_.data?.receivers.find(e=>e.id===l)??_.data?.history.find(e=>e.id===l),oe=gt({queryKey:[...Px(e),`resolve`,l,p],queryFn:async()=>(await(p===`activity`?Fe.activity(e,l):Fe.deliveries(e,l))).receiver,enabled:t&&d&&f&&u!==`settings`&&!ae,retry:!1});(0,Z.useEffect)(()=>{if(t&&d&&u===`settings`){let e=_.data?.receivers.find(e=>e.id===l);e&&L.current!==l&&(L.current=l,y(e),x(jO(e)),C(!1),z(``))}else L.current&&(L.current=void 0,y(void 0),x(jO()),C(!1))},[t,l,d,u,_.data]);let[se,ce]=(0,Z.useState)(!1),[R,z]=(0,Z.useState)(``),[le,ue]=(0,Z.useState)();(0,Z.useLayoutEffect)(()=>{ue(void 0)},[o.key]);let de=async(t,n)=>{let r=s.current.token,i=await Fe.test(e,t.id,n);c(r)&&ue({viewKey:o.key,deliveryId:i.deliveryId,receiverId:t.id,receiverName:t.name,initialState:t.state,deliveryRevision:t.deliveryRevision,format:t.format})},fe=cn({queryKey:[...Px(e),`history`],initialPageParam:void 0,queryFn:({pageParam:t})=>Fe.history(e,t),getNextPageParam:e=>e.nextCursor,enabled:t&&se,retry:!1}),B=U({onMutate:()=>({viewKey:s.current.token,form:v,confirmation:O}),mutationFn:async e=>{let t=s.current.token,n=await e();!(n&&typeof n==`object`&&`receiver`in n&&n.receiver&&typeof n.receiver==`object`&&`format`in n.receiver&&(n.receiver.format===`slack.v1`||n.receiver.format===`discord.v1`))&&c(t)&&n&&typeof n==`object`&&`secret`in n&&typeof n.secret==`string`&&n.secret.length>0&&(ee.current=v?j.current:M.current,T(``),D(n.secret))},onSuccess:async(t,n,i)=>{if(!i||!c(i.viewKey)){await r.invalidateQueries({queryKey:Px(e)});return}v===i.form&&O===i.confirmation&&(v&&(M.current=j.current),O?.deletesReceiver&&(M.current=A.current),v&&l&&u===`settings`&&h(),y(void 0),x(jO()),C(!1),k(void 0),z(``)),await r.invalidateQueries({queryKey:Px(e)})},onError:(t,n,i)=>{if(!i||!c(i.viewKey)){r.invalidateQueries({queryKey:Px(e)});return}v===i.form&&O===i.confirmation?(z(t.message),`status`in t&&t.status===409&&C(!0)):Y(`Earlier webhook action failed: ${t.message}`,{tone:`danger`}),r.invalidateQueries({queryKey:Px(e)})}}),pe=(e,t=document.activeElement)=>{M.current=t instanceof HTMLElement?t:null,ne(!1),F(!1),z(``),C(!1),k(e)},me=(t,n,r)=>{let i={expectedRevision:r.revision,deliveryRevision:r.deliveryRevision,operationId:crypto.randomUUID()};pe(t===`replay`?{title:`Replay this event?`,text:`Sends the same event again with a new 72-hour retry window. Your receiver or channel may show it twice.`,run:()=>Fe.replay(e,n.deliveryId,i)}:{title:`Retry this delivery now?`,text:`Sends the same message again now. Rate limits and freshness checks still apply.`,run:()=>Fe.retry(e,n.deliveryId,i)})},he=t=>({title:`Pause ${t.name}?`,text:`New events won’t be queued while it is paused.${GO(t.pendingCount)}`,run:()=>Fe.pause(e,t.id,t.revision)}),ge=t=>({title:`Delete ${t.name}?`,text:`${GO(t.pendingCount).trim()} Its settings${WO(t)?``:` and signing keys`} are removed; delivery history stays for up to 30 days.`.trim(),deletesReceiver:!0,run:()=>Fe.remove(e,t.id,t.revision)});if(n||!t)return(0,Q.jsx)(`div`,{"data-slot":`webhooks-settings`,className:UO,children:(0,Q.jsxs)(`section`,{className:`flex flex-col gap-3 rounded-lg border border-border bg-card p-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold`,children:n?`Webhooks aren’t available on this platform`:`Webhooks are off`}),(0,Q.jsx)(`p`,{className:`mt-1 text-ui text-muted-foreground`,children:n?`Delivery needs an OS-verified process identity to keep a single sender. Linux, macOS and Windows provide one; this platform does not.`:`Send task updates to Slack, Discord or your own endpoint when a task needs you, is ready for review or finishes.`})]}),!n&&(0,Q.jsxs)(`p`,{className:`text-ui`,children:[`Start cezar with `,(0,Q.jsx)(`code`,{children:`CEZ_WEBHOOKS=1`}),`, then reload this page. If someone else runs this server, ask them to turn webhooks on.`]}),(0,Q.jsx)(`a`,{className:`w-fit text-ui underline underline-offset-2 hover:text-foreground`,href:g.href,target:`_blank`,rel:`noreferrer`,children:g.note})]})});let _e=_.data?.receivers??[],ve=d&&f&&u!==`settings`?ae??oe.data:void 0,ye=_.data?.notice,be=ye?.receiverId?_e.find(e=>e.id===ye.receiverId):void 0,xe=v&&v!==`new`?_e.find(e=>e.id===v.id):void 0,Se=_.data?.historyCount??0,Ce=S&&(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-md border border-warning/50 bg-warning/10 p-3 text-ui`,role:`alert`,children:[(0,Q.jsx)(`p`,{children:`This receiver changed in the meantime, so nothing was applied. Review its latest state and confirm again.`}),v&&v!==`new`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{children:`Your draft is kept. Saving it replaces the latest settings below; a blank URL keeps the current destination.`}),_.isFetching?(0,Q.jsx)(`p`,{className:`text-muted-foreground`,children:`Loading the latest settings…`}):_.error?(0,Q.jsx)(`p`,{className:`text-danger`,children:`Couldn’t load the latest settings.`}):xe?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`font-medium`,children:[`Latest: revision `,xe.revision,` · `,jE[xe.state]]}),(0,Q.jsx)(KO,{receiver:xe,projectId:e})]}):(0,Q.jsx)(`p`,{children:`This receiver no longer exists. Close this dialog to return to the list.`}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsx)(J,{size:`sm`,variant:`outline`,disabled:_.isFetching,onClick:()=>void _.refetch(),children:`Refresh latest settings`}),(0,Q.jsx)(J,{size:`sm`,disabled:!xe||_.isFetching||!!_.error,onClick:()=>{xe&&(y(xe),C(!1),k(void 0),z(``))},children:`Keep draft and review again`})]})]}):(0,Q.jsx)(`p`,{children:`Cancel, check the refreshed receiver or its history, then choose the action again. Earlier consent is not reused.`})]});return(0,Q.jsxs)(`div`,{"data-slot":`webhooks-settings`,className:UO,children:[(0,Q.jsxs)(`section`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Receivers`}),(0,Q.jsxs)(`p`,{className:`text-ui text-muted-foreground`,children:[`Each receiver gets the task updates you choose while cezar is running. New receivers stay Inactive until you test and activate them. `,(0,Q.jsx)(`a`,{className:`underline underline-offset-2 hover:text-foreground`,href:g.href,target:`_blank`,rel:`noreferrer`,children:g.note})]})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,Q.jsx)(J,{variant:`ghost`,size:`icon`,"aria-label":`Refresh`,title:`Refresh`,disabled:_.isFetching,onClick:()=>void _.refetch(),children:(0,Q.jsx)(go,{})}),(0,Q.jsxs)(J,{ref:A,disabled:_.isPending||!!_.error,onClick:e=>{j.current=e.currentTarget,z(``),C(!1),x(jO()),y(`new`)},children:[(0,Q.jsx)(Jo,{}),`Add receiver`]})]})]}),ye&&(0,Q.jsxs)(`section`,{role:`status`,className:`flex min-w-0 flex-col gap-2 rounded-md border border-warning/50 bg-warning/10 p-3 text-sm [overflow-wrap:anywhere]`,children:[(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:WE(ye.action)}),ye.receiverName?` — ${ye.receiverName}`:``,(0,Q.jsxs)(`span`,{className:`text-muted-foreground`,children:[ye.destination?` · ${ye.destination}`:``,` · `,qE(ye.at),ye.source?` · via ${VE[ye.source]}`:``]})]}),(0,Q.jsx)(`p`,{className:`text-ui text-muted-foreground`,children:`Any local process, including agents, can change receivers and read signing keys. If this wasn’t you, review it.`}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsx)(J,{size:`sm`,variant:`outline`,disabled:B.isPending,onClick:()=>B.mutate(()=>Fe.acknowledge(e,_.data.changeSequence)),children:`Mark as reviewed`}),ye.receiverId&&(0,Q.jsx)(J,{size:`sm`,variant:`ghost`,onClick:()=>h(ye.receiverId,`activity`),children:`View activity`}),be&&[`active`,`suspended`].includes(be.state)&&(0,Q.jsx)(J,{size:`sm`,variant:`ghost`,onClick:e=>pe(he(be),e.currentTarget),children:`Pause receiver`}),be&&(0,Q.jsx)(J,{size:`sm`,variant:`danger-ghost`,onClick:e=>pe(ge(be),e.currentTarget),children:`Delete receiver`})]})]}),l&&(!d||!f)&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:`This receiver link is invalid.`}),d&&u===`settings`&&!_.isPending&&!_.error&&!_e.some(e=>e.id===l)&&(0,Q.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,Q.jsx)(`span`,{children:`This receiver’s settings are unavailable — it may have been deleted.`}),(0,Q.jsx)(J,{size:`sm`,variant:`outline`,onClick:()=>h(l,`deliveries`),children:`View its history`})]}),d&&f&&u!==`settings`&&!ve&&(0,Q.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:oe.error?`This receiver’s history is unavailable or no longer kept.`:`Loading history…`}),(R||_.error)&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:R||_.error?.message}),_.data?.webhookHealth.status!==`ready`&&_.data?.webhookHealth.reason&&(0,Q.jsx)(`p`,{role:`status`,className:`rounded-md border border-warning/50 bg-warning/10 p-3 text-ui`,children:_.data.webhookHealth.reason}),_.isPending&&(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading receivers…`}),!_.isPending&&!_.error&&!_e.length&&(0,Q.jsxs)(`div`,{className:`rounded-lg border border-dashed border-border p-6 text-center`,children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium`,children:`No receivers yet`}),(0,Q.jsx)(`p`,{className:`mt-1 text-ui text-muted-foreground`,children:`Add a Slack or Discord channel, or your own endpoint. Send a test, then activate it.`})]}),_e.map(t=>{let n=!WO(t),r=[`inactive`,`disabled`,`paused`].includes(t.state),i=t.state===`suspended`?`Test and recover`:t.state===`disabled`?`Test after repair`:`Send test`,a=[t.destination,`${NE[t.profile]} content`,`Last test: ${LE[t.lastTest].toLowerCase()}`,t.pendingCount?GE(t.pendingCount,`pending delivery`,`pending deliveries`):``,t.inFlightCount?`${t.inFlightCount} sending`:``].filter(Boolean).join(` · `);return(0,Q.jsxs)(`article`,{className:`flex min-w-0 flex-col gap-3 rounded-lg border border-border bg-card p-4`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsxs)(`h3`,{className:`flex flex-wrap items-center gap-2 text-sm font-semibold [overflow-wrap:anywhere]`,children:[t.name,(0,Q.jsx)(il,{dot:AE[t.state],children:jE[t.state]}),!n&&(0,Q.jsx)(il,{children:ME[t.format]})]}),(0,Q.jsx)(`p`,{className:`mt-1 break-words text-ui text-muted-foreground`,children:a}),t.consecutiveFailures>0&&(0,Q.jsxs)(`p`,{className:`mt-1 text-ui text-warning`,children:[GE(t.consecutiveFailures,`failed attempt`,`failed attempts`),` in a row.`,t.pendingCount>0?t.nextProbeAt?` Next retry ${qE(t.nextProbeAt)}.`:``:` Nothing is queued, so nothing will be retried until the next event.`]}),t.state===`paused`&&(0,Q.jsxs)(`p`,{className:`mt-1 text-ui text-muted-foreground`,children:[t.pauseReason===`project_removal`?`Paused when this project was removed from the workspace.`:`Paused.`,` New events aren’t queued.`]}),t.activationBlocked&&(0,Q.jsx)(`p`,{className:`mt-1 text-ui text-warning`,children:`Send a passing test of these settings before activating.`}),n&&t.retiredKeyExpiresAt&&(0,Q.jsxs)(`p`,{className:`mt-1 text-ui text-muted-foreground`,children:[`The previous signing key stops working `,qE(t.retiredKeyExpiresAt),`.`]})]}),le&&le.viewKey===o.key&&le.receiverId===t.id&&(0,Q.jsx)(IO,{projectId:e,test:le,openHistory:e=>h(e)},le.deliveryId),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[r&&(0,Q.jsx)(J,{size:`sm`,disabled:B.isPending||t.activationBlocked||t.state===`disabled`&&t.lastTest!==`success`,onClick:n=>pe({title:`${t.state===`paused`?`Resume`:`Activate`} ${t.name}?`,text:`Only events from now on are sent — nothing from before ${t.state===`paused`?`resuming`:`activation`}.${t.lastTest===`transient_failure`?` The last test failed with a temporary error, so delivery may still fail.`:``}`,receiver:t,standard:t.profile===`standard`,local:t.allowLocalNetwork,run:()=>t.state===`paused`?Fe.resume(e,t.id,t.revision):Fe.activate(e,t.id,t.revision)},n.currentTarget),children:t.state===`paused`?`Resume`:`Activate`}),(0,Q.jsx)(J,{size:`sm`,variant:`outline`,disabled:B.isPending,onClick:e=>{let n={expectedRevision:t.revision,deliveryRevision:t.deliveryRevision,operationId:crypto.randomUUID()};t.state===`suspended`?pe({title:`Test and recover?`,text:`If the test passes, ${t.name} becomes Active and sends its queued deliveries that are still current${t.pendingCount?` (${t.pendingCount} queued now)`:``}.`,run:()=>de(t,n)},e.currentTarget):B.mutate(()=>de(t,n))},children:i}),!r&&(0,Q.jsx)(J,{size:`sm`,variant:`outline`,onClick:e=>pe(he(t),e.currentTarget),children:`Pause`}),(0,Q.jsx)(J,{size:`sm`,variant:`outline`,onClick:e=>{j.current=e.currentTarget,x(jO(t)),C(!1),z(``),y(t),h(t.id,`settings`)},children:`Edit`}),(0,Q.jsx)(J,{size:`sm`,variant:`outline`,ref:e=>{e?re.current.set(t.id,e):re.current.delete(t.id)},onClick:()=>h(t.id),children:`History`}),(0,Q.jsxs)(so,{children:[(0,Q.jsx)(to,{asChild:!0,children:(0,Q.jsx)(J,{size:`icon-sm`,variant:`ghost`,"aria-label":`More actions for ${t.name}`,ref:e=>{e?I.current.set(t.id,e):I.current.delete(t.id)},children:(0,Q.jsx)(uo,{})})}),(0,Q.jsxs)(ro,{align:`end`,className:`w-[220px]`,children:[n&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(ao,{disabled:!!t.retiredKeyExpiresAt&&Date.parse(t.retiredKeyExpiresAt)>Date.now(),onSelect:()=>pe({title:`Rotate signing key?`,text:`Old and new keys both sign deliveries for 24 hours. Install the new key in your receiver within that time.`,run:()=>Fe.rotate(e,t.id,t.revision,`graceful`)},I.current.get(t.id)),children:[(0,Q.jsx)(eu,{}),`Rotate key`]}),(0,Q.jsxs)(ao,{onSelect:()=>pe({title:`Revoke old signing keys now?`,text:`Old keys stop signing immediately, and deliveries fail until your receiver uses the new key. Also remove old keys from your receiver — cezar can’t revoke keys it still accepts.`,run:()=>Fe.rotate(e,t.id,t.revision,`revoke_now`)},I.current.get(t.id)),children:[(0,Q.jsx)(xu,{}),`Revoke old keys`]}),(0,Q.jsx)(oo,{})]}),(0,Q.jsxs)(ao,{variant:`destructive`,onSelect:()=>pe(ge(t),I.current.get(t.id)),children:[(0,Q.jsx)(Qo,{}),`Delete`]})]})]})]})]},t.id)}),(Se>0||se)&&(0,Q.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`div`,{children:(0,Q.jsx)(J,{size:`sm`,variant:`ghost`,onClick:()=>ce(e=>!e),children:se?`Hide deleted receivers`:`Show deleted receivers (${Se})`})}),se&&(0,Q.jsxs)(Q.Fragment,{children:[fe.error&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:fe.error.message}),fe.data?.pages.flatMap(e=>e.items).map(e=>(0,Q.jsxs)(J,{ref:t=>{t?re.current.set(e.id,t):re.current.delete(e.id)},variant:`outline`,className:`h-auto max-w-full justify-start whitespace-normal py-2 text-left font-normal [overflow-wrap:anywhere]`,onClick:()=>h(e.id),children:[e.name,` — deleted `,qE(e.deletedAt)]},e.id)),fe.data&&!fe.data.pages.some(e=>e.items.length)&&(0,Q.jsx)(`p`,{className:`text-ui text-muted-foreground`,children:`No deleted receivers are kept.`}),fe.hasNextPage&&(0,Q.jsx)(`div`,{children:(0,Q.jsx)(J,{size:`sm`,variant:`outline`,disabled:fe.isFetchingNextPage,onClick:()=>void fe.fetchNextPage(),children:`Load older`})})]})]}),(0,Q.jsx)(ws,{open:v!==void 0&&!O,onOpenChange:e=>{!e&&!B.isPending&&(y(void 0),x(jO()),C(!1),l&&h())},children:(0,Q.jsxs)(Ss,{onCloseAutoFocus:e=>N(e,j.current),className:`max-h-[90dvh] overflow-y-auto`,children:[(0,Q.jsxs)(Ns,{children:[(0,Q.jsx)(ys,{children:v===`new`?`Add receiver`:`Edit receiver`}),(0,Q.jsx)(xs,{children:`New and changed receivers stay Inactive until you test and activate them.`})]}),v&&(0,Q.jsx)(NO,{receiver:v===`new`?void 0:v,guideHref:g.href,draft:b,setDraft:x,pending:B.isPending,blocked:S,save:t=>{if(v===`new`)B.mutate(()=>Fe.create(e,t));else{let n=v;pe({title:`Save changes?`,text:`Changing where or what ${n.name} sends makes it Inactive again${n.pendingCount?` and cancels ${GE(n.pendingCount,`pending delivery`,`pending deliveries`)}`:``}. A delivery already sending may still arrive. Renaming alone keeps it active.${n.format!==`cezar.json.v1`&&t.format===`cezar.json.v1`?` After saving, use Rotate key and copy the new signing key into your receiver before testing.`:``}`,run:()=>Fe.update(e,n.id,t)})}}},v===`new`?`new`:`${v.id}-${v.revision}`),Ce,R&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:R})]})}),(0,Q.jsx)(ws,{open:!!O,onOpenChange:e=>{!e&&!B.isPending&&k(void 0)},children:(0,Q.jsxs)(Ss,{onCloseAutoFocus:e=>N(e,M.current),className:`max-h-[90dvh] overflow-y-auto`,children:[(0,Q.jsxs)(Ns,{children:[(0,Q.jsx)(ys,{children:O?.title}),(0,Q.jsx)(xs,{children:O?.text})]}),O?.receiver&&(0,Q.jsx)(KO,{receiver:O.receiver,projectId:e}),O?.standard&&(0,Q.jsxs)(`label`,{className:`flex items-start gap-2 text-sm`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`mt-0.5`,checked:te,onChange:e=>ne(e.target.checked)}),`I understand Standard sends task titles, questions and error text to this receiver.`]}),O?.local&&(0,Q.jsxs)(`label`,{className:`flex items-start gap-2 text-sm`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`mt-0.5`,checked:P,onChange:e=>F(e.target.checked)}),`I allow delivery to this computer or private network.`]}),Ce,R&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:R}),(0,Q.jsxs)(Cs,{children:[(0,Q.jsx)(J,{variant:`outline`,disabled:B.isPending,onClick:()=>k(void 0),children:`Cancel`}),(0,Q.jsx)(J,{className:O?.deletesReceiver?`bg-danger text-danger-foreground hover:brightness-[0.96]`:void 0,disabled:B.isPending||S||!!O?.standard&&!te||!!O?.local&&!P,onClick:()=>O&&B.mutate(O.run),children:B.isPending?`Working…`:O?.deletesReceiver?`Delete`:`Confirm`})]})]})}),(0,Q.jsx)(ws,{open:!!E,onOpenChange:e=>{e||D(void 0)},children:(0,Q.jsxs)(Ss,{onCloseAutoFocus:e=>N(e,ee.current),className:`max-h-[90dvh] overflow-y-auto`,children:[(0,Q.jsxs)(Ns,{children:[(0,Q.jsx)(ys,{children:`Save your signing key`}),(0,Q.jsx)(xs,{children:`Copy it into your receiver now — it is shown only once. If you lose it, use Rotate key to get a new one (or Revoke old keys while a rotation is still overlapping).`})]}),(0,Q.jsx)(`code`,{tabIndex:0,className:`block select-text break-all rounded-md bg-muted p-3 font-mono text-sm`,children:E}),w&&(0,Q.jsx)(`p`,{role:`status`,className:`text-ui text-muted-foreground`,children:w}),(0,Q.jsxs)(Cs,{children:[(0,Q.jsx)(J,{variant:`outline`,onClick:async()=>{try{if(!E||!navigator.clipboard?.writeText)throw Error(`Clipboard unavailable`);await navigator.clipboard.writeText(E),T(`Key copied. Store it in your receiver.`)}catch{T(`Couldn’t copy — select the key and copy it manually before closing.`)}},children:`Copy key`}),(0,Q.jsx)(J,{onClick:()=>D(void 0),children:`I’ve saved the key`})]})]})}),(0,Q.jsx)(ws,{open:!!ve,onOpenChange:e=>{e||h()},children:(0,Q.jsxs)(Ss,{className:`max-h-[90dvh] overflow-y-auto sm:max-w-2xl [overflow-wrap:anywhere]`,onCloseAutoFocus:e=>{let t=ie.current;t?.isConnected&&(e.preventDefault(),t.focus())},children:[(0,Q.jsxs)(Ns,{className:`min-w-0`,children:[(0,Q.jsxs)(ys,{children:[ve?.name,` — history`]}),(0,Q.jsx)(xs,{children:`Delivery results and setting changes for this receiver.`})]}),ve&&(0,Q.jsx)(zO,{projectId:e,receiver:ve,tab:p,onTabChange:e=>h(ve.id,e),operation:me},ve.id)]})})]})}var UO=`mx-auto flex w-full max-w-2xl min-w-0 flex-col gap-6 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,WO=e=>(e.format??`cezar.json.v1`)!==`cezar.json.v1`,GO=e=>e?` ${GE(e,`pending delivery`,`pending deliveries`)} will be cancelled; one already sending may still arrive.`:``;function KO({receiver:e,projectId:t}){let n=e.preset===`custom`?e.events:e.preset===`all`?[`task.attention_required`,`task.review_ready`,`task.finished`,`task.failed`,`task.cancelled`]:[`task.attention_required`,`task.review_ready`,`task.finished`,`task.failed`],r=`text-muted-foreground`;return(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2 text-ui`,children:[(0,Q.jsxs)(`dl`,{className:`grid grid-cols-[auto_minmax(0,1fr)] gap-x-4 gap-y-1 rounded-md border border-border bg-card p-3 [overflow-wrap:anywhere]`,children:[(0,Q.jsx)(`dt`,{className:r,children:`Receiver`}),(0,Q.jsx)(`dd`,{children:e.name}),(0,Q.jsx)(`dt`,{className:r,children:`Destination`}),(0,Q.jsx)(`dd`,{children:e.format===`cezar.json.v1`?`Custom receiver (signed cezar JSON)`:`${ME[e.format]} channel`}),(0,Q.jsx)(`dt`,{className:r,children:`URL`}),(0,Q.jsx)(`dd`,{children:e.destination}),(0,Q.jsx)(`dt`,{className:r,children:`Project`}),(0,Q.jsx)(`dd`,{children:t}),(0,Q.jsx)(`dt`,{className:r,children:`Message content`}),(0,Q.jsx)(`dd`,{children:NE[e.profile]}),(0,Q.jsx)(`dt`,{className:r,children:`Events`}),(0,Q.jsxs)(`dd`,{children:[FE[e.preset],`: `,n.map(e=>OO[e]).join(`, `)]}),(0,Q.jsx)(`dt`,{className:r,children:`Tasks`}),(0,Q.jsx)(`dd`,{children:PE[e.scope]}),(0,Q.jsx)(`dt`,{className:r,children:`Waiting and review delay`}),(0,Q.jsx)(`dd`,{children:IE[e.graceSeconds]}),e.format===`cezar.json.v1`&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`dt`,{className:r,children:`Private network`}),(0,Q.jsx)(`dd`,{children:e.allowLocalNetwork?`Allowed`:`Not allowed`})]}),(0,Q.jsx)(`dt`,{className:r,children:`Failures that resume automatically`}),(0,Q.jsx)(`dd`,{children:e.preset===`all`||e.includeScheduledFailures?`Included`:`Excluded`})]}),e.destination.startsWith(`http:`)&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-warning`,children:`HTTP is unencrypted — others on the network may read these messages. Use HTTPS where possible.`})]})}var qO=`/assets/tester-army-tUUSV6JM.png`,JO=`https://github.com/tester-army/e2e`,YO={AI_GATEWAY_API_KEY:`Vercel AI Gateway`,OPENAI_API_KEY:`OpenAI`,ANTHROPIC_API_KEY:`Anthropic`,OPENROUTER_API_KEY:`OpenRouter`},XO=new Set([`queued`,`running`,`waiting`]);function ZO(e,t,n,r){if(XO.has(e))return`Setting up — cezar is installing and configuring e2e in its own worktree.`;let i=r?`its draft PR is ready — merge it to finish.`:`merge ${n?`branch ${n}`:`the setup task’s branch`} to finish.`;return e===`review`?`Ready for review — ${i}`:e===`done`?t?`Setup finished.`:`Setup finished — ${i}`:e===`failed`?`The last setup failed — open the task to see why, then try again.`:`The last setup was cancelled.`}function QO({ok:e,children:t}){return(0,Q.jsxs)(`li`,{className:`flex items-center gap-2 text-sm`,"data-ok":e,children:[e?(0,Q.jsx)(Wa,{className:`size-4 text-success`,"aria-hidden":!0}):(0,Q.jsx)(su,{className:`size-4 text-muted-foreground`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:e?void 0:`text-muted-foreground`,children:t})]})}function $O(){let e=W(),t=Nr(),n=h(),r=Ae(n.data?.setup?.runId),[i,a]=(0,Z.useState)(void 0),[o,s]=(0,Z.useState)(``),[c,l]=(0,Z.useState)(null),u=r.data?.status??n.data?.setup?.status,d=r.data?.pullRequestUrl&&/^https?:\/\//.test(r.data.pullRequestUrl)?r.data.pullRequestUrl:void 0,f=u!==void 0&&XO.has(u),p=n.data?.credentials??[],m=i??p[0]??`AI_GATEWAY_API_KEY`,g=!!(n.data?.configFile&&n.data.workflow),_=U({mutationFn:async()=>({projectId:sr(),runId:(await ue(o?{credential:{name:m,value:o}}:{})).runId}),onSuccess:async({projectId:n,runId:r})=>{s(``),l(null),await Promise.all([e.invalidateQueries({queryKey:H.e2e.allFor(n??``)}),e.invalidateQueries({queryKey:H.secrets.allFor(n??``)})]),Y(`e2e setup started`),sr()===n&&t(Pc(n,`/tasks/${r}`))},onError:e=>l(e.message)});return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,"data-slot":`e2e-settings`,children:[(0,Q.jsxs)(`section`,{className:`rounded-lg border border-border bg-card p-4`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Q.jsx)(`img`,{src:qO,alt:``,width:40,height:40,className:`size-10 shrink-0 rounded-md`}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold`,children:`TesterArmy e2e`}),(0,Q.jsx)(`span`,{"data-slot":`e2e-badge`,"data-state":f?`setting-up`:g?`installed`:`none`,className:g&&!f?`rounded-full bg-success/10 px-2 py-0.5 text-xs font-medium text-success`:`rounded-full bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground`,children:f?`Setting up`:g?`Installed`:`Not set up`})]}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Agentic browser end-to-end testing`})]}),(0,Q.jsxs)(`a`,{href:JO,target:`_blank`,rel:`noreferrer`,className:`inline-flex shrink-0 items-center gap-1 text-xs text-muted-foreground underline-offset-2 hover:text-foreground hover:underline`,children:[`tester-army/e2e `,(0,Q.jsx)(ho,{className:`size-3`,"aria-hidden":!0})]})]}),(0,Q.jsxs)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:[`cezar installs it for this project, points it at your dev server, writes a smoke test and an`,` `,(0,Q.jsx)(`code`,{children:`implement-and-e2e`}),` workflow, proves it all passes in a real browser and opens a draft PR for you to merge.`]}),n.isPending?(0,Q.jsx)(`p`,{className:`mt-4 text-sm text-muted-foreground`,children:`Loading…`}):null,n.isError?(0,Q.jsx)(`p`,{role:`alert`,className:`mt-4 text-sm text-danger`,children:n.error.message}):null,n.data?(0,Q.jsxs)(`ul`,{className:`mt-4 flex flex-col gap-1.5`,"aria-label":`e2e status`,children:[(0,Q.jsx)(QO,{ok:!!n.data.configFile,children:n.data.configFile?(0,Q.jsxs)(Q.Fragment,{children:[`Configured (`,(0,Q.jsx)(`code`,{children:n.data.configFile}),`)`]}):`Not configured in this checkout`}),(0,Q.jsxs)(QO,{ok:n.data.workflow,children:[(0,Q.jsx)(`code`,{children:`implement-and-e2e`}),` workflow `,n.data.workflow?`available`:`not added yet`]}),(0,Q.jsx)(QO,{ok:p.length>0,children:p.length>0?(0,Q.jsxs)(Q.Fragment,{children:[`Model key: `,(0,Q.jsx)(`code`,{children:p.join(`, `)})]}):`No model key — smoke tests run without one; agent steps need one`})]}):null,n.data?.setup&&u?(0,Q.jsxs)(`p`,{className:`mt-3 text-sm`,"data-slot":`e2e-setup-run`,"data-status":u,children:[ZO(u,!!n.data.configFile,r.data?.branch,d),` `,d&&!n.data.configFile?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`a`,{className:`underline`,href:d,target:`_blank`,rel:`noreferrer`,children:`Open the draft PR`}),` · `]}):null,(0,Q.jsx)(Or,{className:`underline`,to:Pc(sr(),`/tasks/${n.data.setup.runId}`),children:`Open the setup task`})]}):null]}),(0,Q.jsxs)(`form`,{className:`rounded-lg border border-border bg-card p-4`,autoComplete:`off`,onSubmit:e=>{e.preventDefault(),_.mutate()},children:[(0,Q.jsx)(`h2`,{className:`text-sm font-semibold`,children:g?`Set up again`:`Set up e2e`}),(0,Q.jsxs)(`label`,{className:`mt-3 block text-sm`,children:[`Model provider`,(0,Q.jsx)(`select`,{"aria-label":`Model provider`,value:m,onChange:e=>a(e.target.value),className:`mt-1 block w-full rounded border border-border bg-background p-2 outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:br.map(e=>(0,Q.jsxs)(`option`,{value:e,children:[YO[e],` (`,e,`)`,p.includes(e)?` — stored`:``]},e))})]}),(0,Q.jsxs)(`label`,{className:`mt-3 block text-sm`,children:[`API key `,(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:`(optional)`}),(0,Q.jsx)(`input`,{"aria-label":`API key`,type:`password`,autoComplete:`off`,value:o,onChange:e=>s(e.target.value),placeholder:p.includes(m)?`stored — leave empty to keep it`:``,className:`mt-1 block w-full rounded border border-border bg-background p-2`})]}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Stored encrypted as a project secret for check steps only — never handed to an agent session.`}),c?(0,Q.jsx)(`p`,{role:`alert`,className:`mt-2 text-sm text-danger`,children:c}):null,(0,Q.jsx)(`div`,{className:`mt-3`,children:(0,Q.jsx)(J,{type:`submit`,disabled:_.isPending||f||!n.data,children:f?`Setup in progress…`:g?`Set up again`:`Set up e2e`})})]})]})}function ek(){return(0,Q.jsxs)(`div`,{className:`mx-auto flex w-full max-w-2xl flex-col gap-4 p-4 md:p-6`,"data-slot":`integrations-settings`,children:[(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Tools cezar can set up in this project for you — each one as a task you review and merge.`}),(0,Q.jsxs)(Ks,{defaultValue:`test-frameworks`,children:[(0,Q.jsx)(Gs,{variant:`line`,"data-slot":`integrations-tabs`,children:(0,Q.jsx)(Us,{value:`test-frameworks`,children:`Test frameworks`})}),(0,Q.jsx)(Ws,{value:`test-frameworks`,className:`pt-4`,children:(0,Q.jsx)($O,{})})]})]})}var tk=[{id:`tracker`,title:`Issue tracker`,description:`Connect this project to Jira or Linear.`,icon:Eu,component:xO,scope:`project`},{id:`secrets`,title:`Secrets`,description:`Encrypted values for this project’s check steps and cezar — never for agents.`,icon:eu,component:EO,scope:`project`},{id:`webhooks`,title:`Webhooks`,description:`Send task updates to Slack, Discord or your own endpoint.`,icon:Ou,component:VO,scope:`project`},{id:`integrations`,title:`External integrations`,description:`Third-party tools cezar installs and wires into this project — test frameworks first.`,icon:jl,component:ek,scope:`project`},{id:`agents`,title:`Agents`,description:`Providers, default runner and models.`,icon:ja,component:Iw,scope:`project`},{id:`instructions`,title:`Instructions`,description:`What you write for the models: system prompt, branch naming, prompt templates.`,icon:aa,component:CT,scope:`project`},{id:`tasks`,title:`Tasks`,description:`Development model, landing, required checks, base branch, review, live titles.`,icon:ru,component:ND,scope:`project`},{id:`agent-config`,title:`Agent config`,description:`Edit the coding agents’ own config files, per scope.`,icon:Ul,component:Tw,scope:`project`},{id:`worktrees`,title:`Worktrees`,description:`How many finished task worktrees this project keeps on disk.`,icon:Gl,component:yO,scope:`project`},{id:`bookmarklets`,title:`Bookmarklets`,description:`Launch skills from a GitHub PR or issue.`,icon:Ml,component:kT,scope:`project`},{id:`appearance`,title:`Appearance`,description:`Theme, accent and density.`,icon:pu,component:pT,scope:`global`},{id:`notifications`,title:`Notifications`,description:`Browser notifications when an agent needs you.`,icon:Al,component:PT,scope:`global`},{id:`manager`,title:`Manager`,description:`Which approvals ask you to confirm first.`,icon:ja,component:OT,scope:`global`},{id:`keyboard`,title:`Keyboard`,description:`Shortcuts for task commands.`,icon:tu,component:TT,scope:`global`},{id:`resources`,title:`Resources`,description:`Parallel tasks and per-task memory limit, across every project.`,icon:Xl,component:CD,scope:`global`},{id:`skills`,title:`Skills`,description:`Updates for skills installed on this machine.`,icon:du,component:TD,scope:`global`},{id:`global-instructions`,title:`Instructions`,description:`A system prompt for every task in every project; a project’s own wins where they conflict.`,icon:aa,component:hT,scope:`global`},{id:`phones`,title:`Connect a phone`,description:`Pair the Cezar app with this computer through the relay.`,icon:Ma,component:wE,scope:`global`},{id:`workspace-secrets`,title:`Secrets`,description:`Encrypted values shared by every project on this machine — never for agents.`,icon:eu,component:DO,scope:`global`},{id:`accounts`,title:`Agent accounts`,description:`Second logins, and the agent and models a project uses when it has chosen none.`,icon:Ql,component:iw,scope:`global`},{id:`projects`,title:`Projects`,description:`The workspace registry and where GitHub checkouts land.`,icon:Yl,component:tD,scope:`global`},{id:`transfer`,title:`Transfer`,description:`Export this machine’s configuration to a file, or import one from another cezar.`,icon:kl,component:qD,scope:`global`},{id:`privacy`,title:`Privacy`,description:`Whether cezar shares usage data with its maintainers. Off unless you turn it on.`,icon:bu,component:TE,scope:`global`}];function nk(e,t){return tk.filter(n=>!n.hidden&&n.scope===e&&!(t?.singleProject===!0&&n.id===`projects`)&&!(t!==void 0&&t.managers!==!0&&n.id===`manager`)&&!(t?.phonePairing!==!0&&n.id===`phones`))}function rk(e){return{global:nk(`global`,e).filter(t=>t.id!==`manager`||e?.managers===!0),project:nk(`project`,e)}}var ik=null;function ak(e){um(e.pathname)||(ik={pathname:e.pathname,search:e.search,hash:e.hash})}function ok(){return ik}function sk(){let e=T(),t=!e.isError&&e.data?.capabilities?.webhooks===!0,n=e.data?.capabilities?.webhooksUnavailableReason===`unsupported_platform`,r=Fx(Vc()??`default`,t),i=r.data?.receivers??[],a=i.filter(e=>[`suspended`,`disabled`].includes(e.state)).length,o=i.filter(e=>e.state===`inactive`).length,s=i.reduce((e,t)=>e+t.pendingCount,0);return(0,Q.jsx)($,{title:`Webhooks`,hint:`Task updates sent to Slack, Discord or your own endpoint.`,children:(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-3 gap-y-1 rounded-md border border-border bg-card p-3 text-ui`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[e.isError?(0,Q.jsx)(`p`,{children:`Status unavailable — could not load server health.`}):e.data?n?(0,Q.jsx)(`p`,{children:`Not available on this server’s platform.`}):t?r.isPending?(0,Q.jsx)(`p`,{className:`text-muted-foreground`,children:`Loading…`}):r.error?(0,Q.jsx)(`p`,{className:`text-danger`,children:`Status unavailable — open Webhooks for details.`}):i.length?(0,Q.jsxs)(`p`,{children:[i.filter(e=>e.state===`active`).length,` active · `,i.filter(e=>e.state===`paused`).length,` paused`,o?` · ${o} inactive`:``,a?(0,Q.jsxs)(Q.Fragment,{children:[` · `,(0,Q.jsxs)(`span`,{className:`text-warning`,children:[a,` need attention`]})]}):``,s?` · ${s} pending`:``]}):(0,Q.jsx)(`p`,{children:`No receivers yet.`}):(0,Q.jsx)(`p`,{children:`Off on this server.`}):(0,Q.jsx)(`p`,{children:`Loading webhook status…`}),t&&!n&&!r.error&&r.data?.webhookHealth&&[`degraded`,`unavailable`].includes(r.data.webhookHealth.status)&&(0,Q.jsx)(`p`,{role:`status`,className:`text-warning`,children:r.data.webhookHealth.reason||`Webhook delivery needs attention. Open Webhooks for details.`})]}),(0,Q.jsx)(X,{className:`shrink-0 underline underline-offset-2 hover:text-foreground`,to:`/settings/webhooks`,children:t&&!n?`Manage webhooks`:`Open webhook settings`})]})})}function ck(){let e=Vc(),t=Py(a().data,e,T().data);return e===null?null:t?.projects.find(t=>t.id===e)?.root??null}function lk(e){ml(e).then(()=>Y(`Project folder copied`)).catch(()=>Y(e))}function uk(){let e=ck();return e===null?null:(0,Q.jsx)($,{title:`Project folder`,hint:`Where this project lives on disk. Every task worktree, git command and agent run resolves against it.`,children:(0,Q.jsxs)(`div`,{"data-slot":`project-location`,"data-variant":`field`,className:`flex items-start gap-3 rounded-md border border-border bg-card p-3`,children:[(0,Q.jsx)(`span`,{"data-slot":`project-location-path`,className:`min-w-0 flex-1 font-mono text-xs break-all text-foreground`,children:e}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,Q.jsx)(`button`,{type:`button`,"data-action":`project-location-copy`,title:`Copy the project folder path`,onClick:()=>lk(e),className:`text-xs font-medium text-muted-foreground transition-colors hover:text-foreground`,children:`Copy`}),(0,Q.jsx)(fk,{root:e})]})]})})}function dk(){let e=ck();return e===null?null:(0,Q.jsxs)(`div`,{"data-slot":`project-location`,"data-variant":`nav`,className:`mt-auto px-2.5 pt-3`,children:[(0,Q.jsx)(`p`,{className:`text-meta text-soft-foreground`,children:`Project folder`}),(0,Q.jsx)(`button`,{type:`button`,"data-action":`project-location-copy`,title:`${e} — click to copy`,onClick:()=>lk(e),className:`block w-full truncate text-left font-mono text-meta text-muted-foreground transition-colors hover:text-foreground`,children:e})]})}function fk({root:e}){let t=k(),n=U({mutationFn:e=>se(e),onError:e=>Y(e.message,{tone:`danger`})}),r=(t.data?.targets??[]).filter(e=>Na(e.id)===void 0).map(e=>({target:e}));return r.length===0?null:(0,Q.jsx)(Ia,{slot:`project-location-open`,label:`Open with`,triggerVariant:`outline`,title:e,disabled:n.isPending,choices:r,onPick:e=>n.mutate(e,{onSuccess:()=>Y(`Opening the project folder in ${r.find(t=>t.target.id===e)?.target.label??e}`)})})}function pk(e){let t=new Date(e);return Number.isNaN(t.getTime())?`—`:t.toLocaleDateString(void 0,{year:`numeric`,month:`short`,day:`numeric`})}function mk({capabilities:e}){let t=Vc(),n=a(),r=T(),i=qt();if(n.isPending)return(0,Q.jsx)(`p`,{"data-slot":`project-general-loading`,className:`text-ui text-soft-foreground`,children:`Loading project…`});if(n.isError)return(0,Q.jsxs)(`p`,{"data-slot":`project-general-error`,className:`text-ui text-danger`,children:[`Could not read the project registry — `,n.error.message]});let o=Py(n.data,t,r.data),s=o?.projects.find(e=>e.id===t);if(!o||!s)return null;let c=e?.singleProject!==!0&&s.unregistered!==!0;return(0,Q.jsxs)(`div`,{"data-slot":`project-general`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7`,children:[(0,Q.jsx)(uk,{}),(0,Q.jsx)(hk,{project:s,canRemove:c}),(0,Q.jsx)(sk,{}),s.unregistered?(0,Q.jsx)($,{title:`Add to your projects`,hint:`cezar is serving this folder because you started it here — starting cezar somewhere new never adds it to your project list for you. Adding it keeps it in the sidebar between runs and gives it a registry entry to hold settings like the task cap. Nothing on disk changes either way.`,children:(0,Q.jsx)(oD,{root:s.root,name:s.name,notAddable:s.notAddable===!0})}):null,c?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)($,{title:`Max parallel tasks`,hint:i.data?`How many of this project's tasks may run at once — leave it empty to inherit the workspace limit. The workspace limit (${i.data.resources.maxParallel}) still applies as an overall ceiling, so a higher value here has no extra effect until that one is raised.`:`How many of this project's tasks may run at once — leave it empty to inherit the workspace limit. The workspace limit still applies as an overall ceiling.`,children:i.data?(0,Q.jsx)(cD,{project:s,workspaceMax:i.data.resources.maxParallel}):(0,Q.jsx)(`p`,{className:`text-ui text-soft-foreground`,children:`Loading the workspace limit…`})}),(0,Q.jsx)(gk,{project:s,bootProject:o.bootProject})]}):null]})}function hk({project:e,canRemove:t}){return(0,Q.jsx)($,{title:`Project`,hint:`The registry entry for this checkout — re-probed every time the project list is read.`,children:(0,Q.jsxs)(`dl`,{"data-slot":`project-facts`,className:`grid grid-cols-[8rem_minmax(0,1fr)] gap-x-3 gap-y-1.5 rounded-md border border-border bg-card p-3 text-ui`,children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Name`}),(0,Q.jsx)(`dd`,{className:`min-w-0 truncate text-foreground`,children:e.name}),(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Status`}),(0,Q.jsxs)(`dd`,{"data-slot":`project-general-status`,className:e.status===`missing`?`text-danger`:`text-foreground`,children:[$E[e.status],e.status===`missing`?t?` — remove it below, or restore the folder`:` — restore the folder at the path above`:null]}),e.branch===void 0?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Branch`}),(0,Q.jsx)(`dd`,{className:`min-w-0 truncate font-mono text-xs text-foreground`,children:e.branch})]}),e.unregistered?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`In your projects`}),(0,Q.jsx)(`dd`,{"data-slot":`project-general-unregistered`,className:`text-foreground`,children:`No — served because cezar was started here`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Added`}),(0,Q.jsxs)(`dd`,{className:`text-foreground`,children:[pk(e.addedAt),(0,Q.jsx)(`span`,{className:`text-soft-foreground`,children:e.source===`checkout`?` · cloned from GitHub`:` · opened locally`})]}),(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Last opened`}),(0,Q.jsx)(`dd`,{className:`text-foreground`,children:pk(e.lastOpenedAt)})]})]})})}function gk({project:e,bootProject:t}){let[n,r]=(0,Z.useState)(null),i=YE(),a=Nr(),o=e.id===t;return(0,Q.jsxs)($,{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 adding it back later finds everything intact.`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Q.jsxs)(J,{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 — stop it and use `cezar projects remove`":void 0,disabled:o||i.isPending,onClick:()=>r(e),className:`text-danger`,children:[`Remove `,e.name]}),o?(0,Q.jsx)(`span`,{"data-slot":`project-general-remove-boot`,className:`text-meta text-soft-foreground`,children:"cezar is serving this project — stop cezar and run `cezar projects remove` to drop it."}):null]}),(0,Q.jsx)(XE,{project:n,onOpenChange:e=>!e&&r(null),onConfirm:()=>{r(null),i.confirm(e,()=>void a(`/p/${encodeURIComponent(t)}`))}})]})}function _k(e,t){return e===`global`?`/settings/global/${t}`:`/settings/${t}`}var vk=`/settings/global`;function yk(e,t){let n=`/p/${encodeURIComponent(e)}/settings`;return t===void 0?n:`${n}/${t}`}function bk(e){let{pathname:t}=Dr(),n=a().data,r=T().data,i=Ic(t),o=n?.bootProject??r?.bootProject??null,s=Z.useMemo(()=>{let e=[...n?.projects??[]].sort((e,t)=>t.lastOpenedAt.localeCompare(e.lastOpenedAt)).map(({id:e,name:t,status:n})=>({id:e,name:t,status:n}));if(i!==null&&!e.some(e=>e.id===i)){let t=i===o?r?.repo?.root.replace(/[\\/]+$/,``).split(/[\\/]/).pop():void 0;e.unshift({id:i,name:t||i,status:`ok`})}return e},[n,r,i,o]),c=s.find(e=>e.id===i)??null,l=c!==null&&(n?.projects??[]).some(e=>e.id===i),u=e?.singleProject===!0||s.length<=1||c!==null&&!l;return{projects:u&&c!==null&&!l?[c]:s,activeProjectId:i,activeProject:c,bootProjectId:o,flat:u}}function xk(e){let t=Nr();return Z.useCallback(()=>{let n=ok();if(n!==null){t(n);return}t(e===null?`/`:`/p/${encodeURIComponent(e)}/`)},[t,e])}function Sk(e){Z.useEffect(()=>{let t=t=>{t.key!==`Escape`||t.defaultPrevented||(t.target instanceof Element?t.target:null)?.closest(`input, textarea, select, [contenteditable]`)||document.querySelector(`[role="dialog"], [role="alertdialog"], [role="menu"], [role="listbox"]`)||e()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e])}var Ck=(e,t=!1)=>G(`flex h-[34px] shrink-0 items-center gap-2.5 rounded-md px-2.5 text-ui font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,t&&`h-11`,e&&`bg-muted font-semibold text-foreground`),wk=Z.createContext(!1);function Tk({children:e}){return(0,Q.jsx)(`p`,{className:`shrink-0 px-2.5 pt-1 pb-1 eyebrow text-soft-foreground`,children:e})}function Ek({project:e,sections:t,active:n,activeId:r,indent:i}){let a=Z.useContext(wk);return(0,Q.jsxs)(`div`,{className:G(`flex flex-col gap-0.5`,i&&`mt-0.5 ml-[14px] border-l border-border pl-2`),children:[(0,Q.jsxs)(Ar,{to:yk(e.id),end:!0,"data-slot":`settings-project-general`,"data-project":e.id,className:G(Ck(n&&r===null,a),!a&&`h-[30px]`,`text-ui`),children:[(0,Q.jsx)(Su,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),`General`]}),t.map(t=>{let i=n&&t.id===r;return(0,Q.jsxs)(Ar,{to:Pc(e.id,_k(`project`,t.id)),"data-project-section":t.id,"data-project":e.id,className:G(Ck(i,a),!a&&`h-[30px]`,`text-ui`),children:[(0,Q.jsx)(t.icon,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),t.title]},t.id)})]})}function Dk({project:e}){return(0,Q.jsx)(`span`,{className:`truncate`,children:e.name})}function Ok({project:e,indent:t}){let n=`${e.name} is gone — remove it in Projects`;return(0,Q.jsxs)(`div`,{"data-slot":`settings-project`,"data-project":e.id,"data-status":`missing`,title:n,className:`flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-ui font-medium opacity-55`,children:[t?(0,Q.jsx)(`span`,{className:`w-3 shrink-0`,"aria-hidden":`true`}):null,(0,Q.jsx)(`span`,{className:`truncate`,children:e.name}),(0,Q.jsx)(`span`,{className:`sr-only`,children:n}),(0,Q.jsx)(`span`,{className:`ml-auto shrink-0 rounded-full bg-danger/15 px-[7px] py-px text-micro font-medium text-danger`,children:`folder not found`})]})}function kk({project:e,sections:t,activeProjectId:n,activeId:r,openSectionId:i,onProjectPage:a,expanded:o,onToggle:s}){let c=e.id===n,l=Z.useContext(wk),u=`settings-project-${Z.useId()}-${e.id}`,d=!c&&a?yk(e.id,i??void 0):null;return e.status===`missing`?(0,Q.jsx)(Ok,{project:e,indent:!0}):(0,Q.jsxs)(`div`,{"data-slot":`settings-project`,"data-project":e.id,"data-status":e.status,"data-expanded":o?``:void 0,children:[(0,Q.jsxs)(`div`,{className:G(`flex items-center rounded-md`,c&&r===null&&`bg-muted`),children:[(0,Q.jsx)(`button`,{type:`button`,onClick:s,"aria-expanded":o,"aria-controls":o?u:void 0,"aria-label":`${o?`Collapse`:`Expand`} ${e.name}`,className:G(`flex shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-muted/60 hover:text-foreground`,l?`size-11`:`size-7`),children:(0,Q.jsx)(Xa,{"aria-hidden":`true`,className:G(`size-3 transition-transform`,!o&&`-rotate-90`)})}),d===null?(0,Q.jsx)(`button`,{type:`button`,onClick:s,"aria-expanded":o,"aria-controls":o?u:void 0,"data-slot":`settings-project-toggle`,className:G(`flex min-w-0 flex-1 items-center gap-1.5 rounded-md py-1.5 pr-2 text-left text-ui font-semibold transition-colors`,l&&`min-h-11`,c?`text-foreground`:`text-muted-foreground hover:text-foreground`),children:(0,Q.jsx)(Dk,{project:e})}):(0,Q.jsx)(Or,{to:d,"data-slot":`settings-project-link`,title:`Open ${e.name}'s ${t.find(e=>e.id===i)?.title??`General`}`,className:G(`flex min-w-0 flex-1 items-center gap-1.5 rounded-md py-1.5 pr-2 text-left text-ui font-semibold text-muted-foreground transition-colors hover:text-foreground`,l&&`min-h-11`),children:(0,Q.jsx)(Dk,{project:e})})]}),o?(0,Q.jsx)(`div`,{id:u,children:(0,Q.jsx)(Ek,{project:e,sections:t,active:c,activeId:r,indent:!0})}):null]})}function Ak(e){let[t,n]=ag();return(0,Q.jsx)(gg,{slot:`settings-sidebar`,width:t,onWidthChange:n,children:(0,Q.jsx)(Mk,{...e})})}function jk({onOpenChange:e,...t}){let{pathname:n}=Dr();return Z.useEffect(()=>{e(!1)},[n,e]),Z.useEffect(()=>{let t=window.matchMedia?.(`(min-width: 768px)`);if(!t)return;let n=t=>{t.matches&&e(!1)};return t.addEventListener(`change`,n),()=>t.removeEventListener(`change`,n)},[e]),(0,Q.jsx)(vg,{slot:`settings-mobile-drawer`,title:`Settings navigation`,children:e=>(0,Q.jsx)(Mk,{...t,headerAction:e})})}function Mk({scope:e,activeId:t,capabilities:n,tree:r,leave:i,headerAction:a}){let{global:o,project:s}=rk(n),c=!!a,l=r.activeProjectId,[u,d]=Z.useState({project:l,map:{}}),f=u.project===l?u.map:{},p=e=>f[e]??e===l,m=e=>d(t=>{let n=t.project===l?t.map:{};return{project:l,map:{...n,[e]:!(n[e]??e===l)}}}),h=e===`global`,[g]=r.projects,_=T().data,v=_?.version??null,y=_?.latestVersion??null,b=ie().data,x=b?.available?b.count??null:null,S=qt().data?.branding,C=S?.name??`cezar`,w=S?.logoUrl??null;return(0,Q.jsx)(wk.Provider,{value:c,children:(0,Q.jsxs)(`div`,{"data-slot":`settings-sidebar-content`,className:`flex min-h-0 flex-1 flex-col pt-[env(safe-area-inset-top)] pb-[env(safe-area-inset-bottom)]`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-[9px] px-3.5 pt-3.5 pb-2.5`,children:[(0,Q.jsx)(_h,{name:C,logoUrl:w}),(0,Q.jsxs)(J,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`settings-back`,title:`Back (Esc)`,onClick:i,className:G(`-mr-2 ml-auto shrink-0`,c?`h-11`:`h-[26px]`),children:[(0,Q.jsx)(ma,{"aria-hidden":`true`,className:`size-4`}),`Back`]}),a?(0,Q.jsx)(`div`,{className:`shrink-0`,children:a}):null]}),(0,Q.jsxs)(`nav`,{"aria-label":`Settings sections`,"data-slot":`settings-nav`,"data-scope":e,className:`flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto overscroll-contain px-2.5 py-1.5`,children:[(0,Q.jsx)(Tk,{children:`General settings`}),o.map(e=>{let n=h&&e.id===t;return(0,Q.jsxs)(Ar,{to:_k(`global`,e.id),"data-section":e.id,className:Ck(n,c),children:[(0,Q.jsx)(e.icon,{"aria-hidden":`true`,className:`size-4 shrink-0`}),e.title]},e.id)}),(0,Q.jsx)(`p`,{className:`shrink-0 px-2.5 pt-1 pb-2 text-meta text-soft-foreground`,children:`Stored in ~/.cezar`}),r.projects.length>0?(0,Q.jsx)(`div`,{"data-slot":`settings-project-tree`,className:`mt-1 flex shrink-0 flex-col gap-0.5 border-t border-border pt-3`,children:r.flat&&g?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Tk,{children:g.id===l?`This project`:g.name}),g.status===`missing`?(0,Q.jsx)(Ok,{project:g,indent:!1}):(0,Q.jsx)(Ek,{project:g,sections:s,active:g.id===l,activeId:t,indent:!1})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Tk,{children:`Project settings`}),r.projects.map(n=>(0,Q.jsx)(kk,{project:n,sections:s,activeProjectId:r.activeProjectId,activeId:t,openSectionId:e===`project`?t:null,onProjectPage:e===`project`,expanded:p(n.id),onToggle:()=>m(n.id)},n.id))]})}):null,e===`project`?(0,Q.jsx)(dk,{}):null]}),(0,Q.jsxs)(`div`,{"data-slot":`settings-sidebar-footer`,className:`flex flex-col gap-1.5 border-t border-border px-3.5 py-2.5`,children:[(0,Q.jsx)(lm,{}),(0,Q.jsxs)(`div`,{"data-slot":`settings-sidebar-footer-controls`,className:`flex items-center gap-2`,children:[v?(0,Q.jsx)(Jg,{version:v,latestVersion:y,brandName:C}):null,x===null?null:(0,Q.jsx)(Yg,{count:x}),(0,Q.jsx)(dp,{className:`ml-auto`})]})]})]})})}function Nk({scope:e,activeId:t,capabilities:n}){let r=rk(n)[e],i=e===`global`?Ar:Rc,a=e=>G(`rounded-full border px-3 py-1.5 text-ui font-medium whitespace-nowrap transition-colors`,e?`border-transparent bg-contrast text-contrast-foreground`:`border-border bg-card text-muted-foreground`);return(0,Q.jsxs)(`nav`,{"aria-label":`Sections of this area`,"data-slot":`settings-nav-mobile`,className:`flex shrink-0 gap-1.5 overflow-x-auto border-b border-border px-3 py-2.5 md:hidden`,children:[e===`project`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Or,{to:vk,"data-slot":`settings-all-pill`,className:a(!1),children:`‹ General settings`}),(0,Q.jsx)(i,{to:`/settings`,end:!0,"data-slot":`settings-nav-index`,className:a(!1),children:`General`})]}):null,r.map(n=>(0,Q.jsx)(i,{to:_k(e,n.id),"data-section":n.id,className:a(n.id===t),children:n.title},n.id))]})}function Pk({title:e,projectName:t}){return(0,Q.jsx)(`div`,{"data-slot":`settings-mobile-bar`,className:`shrink-0 border-b border-border bg-card pt-[env(safe-area-inset-top)] md:hidden`,children:(0,Q.jsxs)(`div`,{className:`flex h-[52px] items-center gap-1 px-2`,children:[(0,Q.jsx)(mi,{asChild:!0,children:(0,Q.jsx)(J,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":`Open settings menu`,className:`size-11`,children:(0,Q.jsx)(ou,{"aria-hidden":`true`,className:`size-[17px]`})})}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1`,children:(0,Q.jsx)(Fk,{title:e,projectName:t,as:`span`})})]})})}function Fk({title:e,projectName:t,as:n}){let r=n===`h1`?`text-base`:`text-body`;return(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-2`,children:[t?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{"data-slot":`settings-scope-chip`,className:G(`truncate font-semibold text-muted-foreground`,r),children:t}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:G(`shrink-0 font-normal text-soft-foreground`,r),children:`/`})]}):null,(0,Q.jsx)(n,{className:G(`truncate font-semibold`,r),children:e})]})}function Ik({scope:e,section:t,title:n,beside:r}){return(0,Q.jsxs)(`header`,{"data-slot":`settings-header`,className:`sticky top-0 z-10 hidden h-14 shrink-0 items-center gap-3 border-b border-border bg-background px-5 md:flex`,children:[(0,Q.jsx)(Fk,{title:n,projectName:r,as:`h1`}),t?(0,Q.jsx)(`p`,{className:`min-w-0 truncate text-ui text-soft-foreground`,children:t.description}):e===`project`?(0,Q.jsx)(`p`,{className:`text-ui text-soft-foreground`,children:`Project settings`}):null]})}function Lk({scope:e,section:t,capabilities:n,routeName:r,children:i}){let a=bk(n),o=xk(a.activeProjectId??a.bootProjectId);Sk(o);let s=a.activeProject?.name??a.activeProjectId,c=t?.title??(e===`global`?`Settings`:s??`Settings`),l=e===`project`&&t!==null?s:null,[u,d]=Z.useState(!1),f={scope:e,activeId:t?.id??null,capabilities:n,tree:a,leave:o};return(0,Q.jsx)(hi,{open:u,onOpenChange:d,children:(0,Q.jsxs)(`div`,{"data-route":r,className:`flex h-full min-h-full`,children:[(0,Q.jsx)(Ak,{...f}),(0,Q.jsx)(jk,{...f,onOpenChange:d}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col overflow-y-auto overscroll-contain`,children:[(0,Q.jsx)(Pk,{title:c,projectName:l}),(0,Q.jsx)(Ik,{scope:e,section:t,title:c,beside:l}),t?(0,Q.jsx)(Nk,{scope:e,activeId:t.id,capabilities:n}):null,(0,Q.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:i})]})]})})}function Rk({section:e,scope:t,capabilities:n}){let r=e.component;return(0,Q.jsx)(Lk,{scope:t,section:e,capabilities:n,routeName:t===`global`?`settings-global-${e.id}`:`settings-${e.id}`,children:(0,Q.jsx)(r,{})})}var zk=`flex items-center gap-3.5 rounded-lg border border-border bg-card p-4 shadow-xs transition-colors hover:bg-card-2`;function Bk({section:e}){return(0,Q.jsx)(`li`,{children:(0,Q.jsxs)(X,{to:_k(`project`,e.id),"data-section":e.id,className:zk,children:[(0,Q.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-md border border-border bg-muted text-muted-foreground`,children:(0,Q.jsx)(e.icon,{"aria-hidden":`true`,className:`size-4`})}),(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`span`,{className:`block text-sm font-medium text-foreground`,children:e.title}),(0,Q.jsx)(`span`,{className:`block text-xs text-soft-foreground`,children:e.description})]}),(0,Q.jsx)(Qa,{"aria-hidden":`true`,className:`size-4 shrink-0 text-soft-foreground`})]})})}function Vk({scope:e,capabilities:t}){let n=Dr(),r=rk(t)[e];if(e===`global`){let e=r[0];return(0,Q.jsx)(Er,{to:{pathname:_k(`global`,e.id),search:n.search,hash:n.hash},replace:!0})}return(0,Q.jsx)(Lk,{scope:e,section:null,capabilities:t,routeName:`settings`,children:(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col p-3 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-5 md:pb-5`,children:[(0,Q.jsx)(mk,{capabilities:t}),(0,Q.jsx)(`ul`,{"data-slot":`settings-index`,className:`mx-auto mt-7 flex w-full max-w-2xl flex-col gap-2.5 md:hidden`,children:r.map(e=>(0,Q.jsx)(Bk,{section:e},e.id))})]})})}var Hk={archive:`Archive`,restore:`Restore`,read:`Mark read`,unread:`Mark unread`};function Uk(e,t){return t===`restore`?!!e.archived:t===`archive`?!e.archived&&Va(e.status):La(e)&&Ra(e)===(t===`read`)}function Wk(e,t){let[n,r]=Z.useState(new Set),[i,a]=Z.useState(!1),[o,s]=Z.useState(``),c=Z.useRef(!1),l=e.filter(e=>n.has(e.id));return Z.useEffect(()=>{let t=new Set(e.map(e=>e.id));r(e=>{let n=new Set([...e].filter(e=>t.has(e)));return n.size===e.size?e:n})},[e]),{ids:n,selected:l,busy:i,message:o,toggle:Z.useCallback(e=>{c.current||r(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n})},[]),clear:()=>{c.current||r(new Set)},toggleAll:()=>{c.current||r(l.length===e.length?new Set:new Set(e.map(e=>e.id)))},apply:Z.useCallback(async(e,n)=>{if(c.current||!t)return;c.current=!0,a(!0),s(`${Hk[e]} in progress…`);let i=n.filter(t=>Uk(t,e)),o=new Set,l=[];for(let n of i)try{await t(n,e),o.add(n.id)}catch(e){l.push(`${Ge(n)}: ${e instanceof Error?e.message:`Request failed`}`)}r(e=>new Set([...e].filter(e=>!o.has(e)))),s(`${Hk[e]}: ${o.size} succeeded, ${n.length-i.length} skipped, ${l.length} failed.${l.length?` ${l.join(`; `)}`:``}`),c.current=!1,a(!1)},[t])}}function Gk({checked:e,mixed:t=!1,label:n,disabled:r,onChange:i}){let a=Z.useRef(null);return Z.useEffect(()=>{a.current&&(a.current.indeterminate=t)},[t]),(0,Q.jsx)(`input`,{ref:a,type:`checkbox`,"aria-label":n,checked:e,disabled:r,onChange:i,className:`size-4 shrink-0 cursor-pointer accent-primary focus-visible:outline-2 focus-visible:outline-ring`})}function Kk({displayed:e,selection:t,archived:n}){let{selected:r,busy:i}=t,a=[n?`restore`:`archive`,`read`,`unread`];return(0,Q.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center gap-2 rounded-md border border-border bg-card px-3 py-2 text-sm`,children:[(0,Q.jsx)(Gk,{label:`Select displayed tasks`,checked:e.length>0&&r.length===e.length,mixed:r.length>0&&r.length<e.length,disabled:i||e.length===0,onChange:t.toggleAll}),(0,Q.jsx)(`span`,{children:r.length>0?`${r.length} selected`:`Select tasks`}),r.length>0?(0,Q.jsxs)(Q.Fragment,{children:[a.map(e=>{let n=r.filter(t=>Uk(t,e)).length;return(0,Q.jsxs)(J,{type:`button`,size:`sm`,variant:`outline`,disabled:i||n===0,onClick:()=>void t.apply(e,r),children:[Hk[e],` (`,n,`)`]},e)}),(0,Q.jsx)(J,{type:`button`,size:`sm`,variant:`ghost`,disabled:i,onClick:t.clear,children:`Clear selection`}),(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Only eligible selected tasks are changed; others are skipped.`})]}):null,(0,Q.jsx)(`p`,{role:`status`,"aria-label":`Task action status`,"aria-live":`polite`,className:`w-full empty:hidden text-xs text-muted-foreground`,children:t.message})]})}function qk({run:e,busy:t,onAction:n}){let r=[e.archived?`restore`:`archive`,Ra(e)?`read`:`unread`],i={archive:fa,restore:Ol,read:vo,unread:Hl};return(0,Q.jsx)(`span`,{className:`inline-flex shrink-0 items-center gap-1`,children:r.filter(t=>Uk(e,t)).map(r=>{let a=i[r],o=`${Hk[r]}: ${Ge(e)}`;return(0,Q.jsx)(J,{type:`button`,variant:`ghost`,size:`icon-sm`,title:o,"aria-label":o,disabled:t,onClick:()=>void n(r,[e]),children:(0,Q.jsx)(a,{className:`size-3.5`,"aria-hidden":`true`})},r)})})}function Jk({slot:e,label:t,value:n,options:r,onChange:i,full:a=!1,allowRelease:o=!1,className:s}){return(0,Q.jsx)(`div`,{"data-slot":e,"data-full":a?`true`:void 0,role:`group`,"aria-label":t,className:G(`inline-flex gap-0.5 rounded-md bg-muted p-[3px]`,a&&`flex w-full`,s),children:r.map(e=>{let t=e.value===n;return(0,Q.jsxs)(`button`,{type:`button`,"data-value":e.value,"aria-pressed":t,onClick:()=>{t&&!o||i(e.value)},className:G(`flex h-7 items-center justify-center gap-1.5 rounded-[7px] px-3 text-label font-medium whitespace-nowrap text-muted-foreground transition-colors hover:text-foreground`,a&&`flex-1`,t&&`bg-card font-semibold text-foreground shadow-xs`),children:[e.label,e.count===void 0?null:(0,Q.jsx)(`small`,{className:`font-mono text-meta font-normal tabular-nums`,children:e.count})]},e.value)})})}function Yk({slot:e,label:t,options:n,selected:r,onToggle:i,onClear:a,searchPlaceholder:o,emptyLabel:s=`Nothing to filter by`}){let[c,l]=Z.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,Q.jsxs)(Is,{open:c,onOpenChange:l,children:[(0,Q.jsx)(Es,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`facet-${e}`,"data-active":u?`true`:void 0,"aria-label":`Filter by ${t.toLowerCase()}`,className:G(`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-violet/40 bg-violet/10 text-foreground`),children:[(0,Q.jsx)(`span`,{className:G(u&&`text-soft-foreground`),children:t}),u?(0,Q.jsx)(`span`,{className:`max-w-[140px] truncate font-semibold`,children:d}):null,(0,Q.jsx)(Xa,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Q.jsxs)(Ms,{align:`start`,className:`w-64 p-0`,"data-testid":`facet-${e}-menu`,children:[(0,Q.jsxs)(Xc,{children:[(0,Q.jsx)(Hc,{placeholder:o??`Search ${t.toLowerCase()}…`}),(0,Q.jsxs)(Yc,{children:[(0,Q.jsx)(Jc,{children:s}),(0,Q.jsx)(Wc,{children:n.map(e=>{let t=r.includes(e.value);return(0,Q.jsxs)(qc,{value:e.label,onSelect:()=>i(e.value),"data-slot":`facet-option`,"data-value":e.value,"aria-checked":t,role:`option`,children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:G(`flex size-4 shrink-0 items-center justify-center rounded-[4px] border`,t?`border-violet bg-violet text-violet-foreground`:`border-input`),children:t?(0,Q.jsx)(Wa,{className:`size-3`}):null}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),e.count===void 0?null:(0,Q.jsx)(`span`,{className:`shrink-0 font-mono text-meta text-soft-foreground tabular-nums`,children:e.count})]},e.value)})})]})]}),u?(0,Q.jsx)(`div`,{className:`border-t border-border p-1`,children:(0,Q.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 Xk({label:e,count:t,selected:n,onToggle:r,slot:i,tone:a=`neutral`}){return(0,Q.jsxs)(`button`,{type:`button`,"data-slot":i,"data-selected":n?`true`:void 0,"aria-pressed":n,onClick:r,className:G(`inline-flex h-7 items-center gap-1.5 rounded-full border px-2.5 text-xs font-medium transition-colors`,a===`tag`?`border-violet/25 bg-violet/10 text-violet hover:bg-violet/20`:`border-border bg-card text-muted-foreground hover:bg-muted hover:text-foreground`,n&&`border-violet bg-violet text-violet-foreground hover:bg-violet`),children:[e,t===void 0?null:(0,Q.jsx)(`span`,{className:G(`font-mono text-meta tabular-nums`,!n&&`text-soft-foreground`),children:t})]})}function Zk({slot:e,label:t,value:n,options:r,onChange:i}){return(0,Q.jsx)(Jk,{slot:e,label:t,value:n,options:r,onChange:i,allowRelease:!0})}function Qk({label:e,expanded:t,onToggle:n,className:r,wordClassName:i}){let[a,...o]=e.split(` `);return(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`subtask-toggle`,"aria-expanded":t,"aria-label":`${t?`Collapse`:`Expand`} ${e}`,onClick:n,className:G(`inline-flex shrink-0 items-center gap-0.5 rounded-full bg-muted py-px pr-1.5 pl-1 text-micro font-medium text-muted-foreground hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,r),children:[(0,Q.jsx)(Qa,{className:G(`size-3 transition-transform`,t&&`rotate-90`),"aria-hidden":`true`}),a,(0,Q.jsx)(`span`,{className:i,children:` ${o.join(` `)}`})]})}function $k({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`skeleton`,className:G(`animate-pulse rounded-md bg-accent`,e),...t})}var eA=[{id:`status`,label:`Status`,canFold:!1,defaultExpanded:!0,align:`left`,width:`116px`},{id:`task`,label:`Task`,canFold:!1,defaultExpanded:!0,align:`left`},{id:`workflow`,label:`Workflow`,canFold:!0,defaultExpanded:!0,align:`left`,width:`124px`,icon:`workflow`},{id:`branch`,label:`Branch`,canFold:!0,defaultExpanded:!1,align:`left`,width:`128px`,icon:`branch`},{id:`diff`,label:`±`,canFold:!0,defaultExpanded:!0,align:`left`,width:`78px`,icon:`diff`},{id:`reference`,label:`Ref`,canFold:!0,defaultExpanded:!0,align:`left`,width:`76px`,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:`76px`,icon:`cost`,capability:`cost`},{id:`cpu`,label:`CPU`,canFold:!0,defaultExpanded:!0,align:`right`,width:`68px`,icon:`cpu`},{id:`memory`,label:`Mem`,canFold:!0,defaultExpanded:!0,align:`right`,width:`88px`,icon:`memory`},{id:`started`,label:`Started`,canFold:!0,defaultExpanded:!0,align:`right`,width:`82px`,icon:`started`}],tA=new Map(eA.map(e=>[e.id,e]));function nA(e){return typeof e!=`object`||!e||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(e=>typeof e[1]==`boolean`))}function rA(e){let t={};for(let[n,r]of Object.entries(nA(e))){let e=tA.get(n);e?.canFold&&(t[e.id]=r)}return t}function iA(e,t){let n=tA.get(e);return!n||!n.canFold?!0:t[e]??n.defaultExpanded}function aA(e,t){let n=nA(e);return tA.get(t)?.canFold?{...n,[t]:!iA(t,rA(e))}:n}function oA(e){return eA.filter(t=>t.capability===void 0||e[t.capability])}function sA(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function cA(){let e=W(),t=bt(),n=Z.useRef(0),r=Z.useRef(0),i=Z.useRef(Promise.resolve()),a=Z.useMemo(()=>rA(t.data?.taskTable?.expandedColumns),[t.data?.taskTable?.expandedColumns]),o=Z.useCallback(t=>{if(!eA.find(e=>e.id===t)?.canFold)return;let a=e.getQueryData(V.uiState);if(a===void 0)return;let o=sA(a?.taskTable),s={...o,expandedColumns:aA(o.expandedColumns,t)};e.setQueryData(V.uiState,{...a,taskTable:s});let c=++n.current;r.current=c;let l=i.current.then(async()=>{let t=await zt({taskTable:s},{keepalive:!0});c===r.current&&e.setQueryData(V.uiState,t)});i.current=l.catch(t=>{Y(t instanceof Error?t.message:String(t),{tone:`danger`}),c===r.current&&e.invalidateQueries({queryKey:V.uiState})})},[e]);return{expandedColumns:a,isExpanded:Z.useCallback(e=>iA(e,a),[a]),toggleColumn:o,isPending:t.isPending}}var lA=Z.createContext(null);function uA({intervalMs:e,now:t,children:n}){let r=Bs(e,t===void 0);return(0,Q.jsx)(lA.Provider,{value:t??r,children:n})}function dA({at:e}){return(0,Q.jsx)(Q.Fragment,{children:Zc(e,Z.useContext(lA)??Date.now())})}var fA=12,pA=40;function mA({height:e,colSpan:t}){return e<=0?null:(0,Q.jsx)(`tr`,{"data-row-spacer":``,"aria-hidden":`true`,children:(0,Q.jsx)(`td`,{colSpan:t,style:{height:e,padding:0,border:0}})})}function hA(e,t=45){let n=e>100,r=Z.useRef(null),[i,a]=Z.useState({start:0,end:pA,height:t});if(Z.useLayoutEffect(()=>{if(!n)return;let e=r.current;if(!e)return;let i=e.closest(`[data-slot="main"]`),o=()=>{let n=i?i.getBoundingClientRect().top:0,r=i?i.clientHeight:window.innerHeight,o=e.getBoundingClientRect().top-n,s=e.querySelector(`:scope > tr:not([data-row-spacer]):not([data-row-unsampled])`)?.getBoundingClientRect().height,c=s!==void 0&&s>0?s:t,l=Math.floor(Math.max(0,-o)/c),u=Math.ceil(Math.max(0,r-o)/c),d=Math.max(0,l-fA),f=Math.max(d,u+fA);a(e=>e.start===d&&e.end===f&&e.height===c?e:{start:d,end:f,height:c})};o();let s=0,c=()=>{s===0&&(s=requestAnimationFrame(()=>{s=0,o()}))},l=i??window;l.addEventListener(`scroll`,c,{passive:!0}),window.addEventListener(`resize`,o);let u=typeof ResizeObserver==`function`?new ResizeObserver(o):void 0;for(let e of i?Array.from(i.children):[document.body])u?.observe(e);return()=>{s!==0&&cancelAnimationFrame(s),l.removeEventListener(`scroll`,c),window.removeEventListener(`resize`,o),u?.disconnect()}},[n,e,t]),!n)return{anchorRef:r,windowed:n,start:0,end:e,padTop:0,padBottom:0,ariaRowCount:void 0,ariaRowIndex:gA};let o=Math.max(1,i.end-i.start),s=Math.max(0,Math.min(i.start,e-o)),c=Math.min(Math.max(i.end,s+o),e);return{anchorRef:r,windowed:n,start:s,end:c,padTop:s*i.height,padBottom:(e-c)*i.height,ariaRowCount:e+1,ariaRowIndex:_A}}var gA=()=>void 0,_A=e=>e+2,vA=[],yA=rA(void 0),bA=()=>void 0,xA=3e4;function SA({runs:e,view:t,onViewChange:n,onArchiveFinished:r,onMarkAllRead:i,onRename:a,onTogglePin:o,onTaskAction:s,now:c,showTokens:l=!0,showCost:u=!0,expandedColumns:d=yA,onToggleColumn:f=bA,columnsPending:p=!1,origin:m=`all`,onOriginChange:h=()=>void 0,automationNames:g,gitRepo:_=!0,scheduledTasks:v,hasScheduledTasks:y=!!v,firstRun:b,setupPill:x,welcomeBack:S}){let[C,w]=Z.useState(``),[T,E]=Z.useState(new Set),D=Z.useCallback(e=>E(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n}),[]),[O,k]=Z.useState(pv),[j,M]=Z.useState(`recent`),N=e??vA,te=Z.useMemo(()=>N.some(e=>t===`archived`===e.archived),[N,t]),ne=Z.useMemo(()=>hv(N),[N]),P=Z.useMemo(()=>_v(N,m,O,ne),[N,m,O,ne]),F=Z.useMemo(()=>Ve(P),[P]),re=Z.useMemo(()=>dt(P,C),[P,C]),I=Z.useMemo(()=>ae(re,t,j),[re,t,j]),ie=C.trim()!==``,L=Z.useCallback(e=>ie||T.has(e),[ie,T]),oe=Z.useMemo(()=>qe(I,t).map(e=>({...e,rows:wv(e.runs,L),taskCount:wv(e.runs,()=>!1).length})),[I,t,L]),se=Z.useMemo(()=>oe.flatMap(e=>[...e.label?[{kind:`section`,section:e}]:[],...e.rows.map(e=>({kind:`row`,node:e}))]),[oe]),ce=Z.useMemo(()=>oe.flatMap(e=>e.rows.map(e=>e.run)),[oe]),R=Wk(ce,s),z=Z.useMemo(()=>ee(N),[N]),le=Z.useMemo(()=>Gn(re,t),[re,t]),ue=Z.useMemo(()=>Bn(N),[N]),de=Z.useMemo(()=>oA({tokens:l,cost:u}).map(e=>e.id===`started`?{...e,label:_n(j)}:e),[l,u,j]),fe=Z.useMemo(()=>Ha(N),[N]),B=hA(se.length),pe=t===`archived`?void 0:o;return(0,Q.jsx)(uA,{intervalMs:xA,now:c,children:(0,Q.jsxs)(`div`,{"data-route":`tasks`,className:`flex min-h-full flex-col`,children:[(0,Q.jsxs)(`header`,{className:`sticky top-0 z-10 hidden h-14 shrink-0 items-center gap-3 border-b border-border bg-background px-5 md:flex`,children:[(0,Q.jsx)(`h1`,{className:`text-base font-semibold`,children:`Tasks`}),(0,Q.jsxs)(`div`,{className:`inline-flex gap-0.5 rounded-md bg-muted p-[3px]`,children:[(0,Q.jsx)(EA,{view:`active`,current:t,onSelect:n,count:F.active,children:`Active`}),(0,Q.jsx)(EA,{view:`archived`,current:t,onSelect:n,count:F.archived,children:`Archived`})]}),(0,Q.jsx)(`div`,{className:`flex-1`}),fe>0?(0,Q.jsxs)(J,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`mark-all-read`,onClick:i,children:[(0,Q.jsx)(Nl,{className:`size-3.5`,"aria-hidden":`true`}),`Mark all read`]}):null,t===`active`&&ue>0?(0,Q.jsxs)(J,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`archive-finished`,onClick:r,children:[(0,Q.jsx)(fa,{className:`size-3.5`,"aria-hidden":`true`}),`Archive finished`]}):null,(0,Q.jsxs)(`div`,{className:`relative w-60`,children:[(0,Q.jsx)(Xo,{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,Q.jsx)(`input`,{type:`text`,value:C,onChange:e=>w(e.target.value),placeholder:`Search tasks…`,"aria-label":`Search tasks`,className:`h-9 w-full rounded-md border border-input bg-card pr-3 pl-8 text-ui text-foreground outline-none placeholder:text-soft-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`})]})]}),v,(0,Q.jsxs)(`div`,{className:`flex flex-1 flex-col p-3 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-5 md:pb-5`,children:[te?S:null,te?x:null,te?(0,Q.jsx)(TA,{runs:N,view:t,origin:m,onOriginChange:h,filters:O,onFiltersChange:k,automations:ne,automationNames:g,sortBy:j,onSortByChange:M}):null,s?(0,Q.jsx)(Kk,{displayed:ce,selection:R,archived:t===`archived`}):null,e===void 0?null:y&&N.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No tasks have started yet.`}):I.length===0?(0,Q.jsx)(wA,{view:t,query:C,filtered:mv(O)>0,onClearFilters:()=>k(pv),origin:m,hiddenByOrigin:m!==`all`&&_v(A(N,t),`all`,O,ne).length>0,onShowAll:()=>h(`all`),firstRun:b}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{"data-slot":`tasks-table`,className:`hidden overflow-x-auto rounded-lg border border-border bg-card shadow-xs md:block`,children:(0,Q.jsx)(os,{children:(0,Q.jsxs)(`table`,{className:`w-full border-collapse`,"aria-rowcount":B.ariaRowCount,children:[(0,Q.jsxs)(`colgroup`,{children:[s?(0,Q.jsx)(`col`,{style:{width:`112px`}}):null,de.map(e=>{let t=iA(e.id,d);return(0,Q.jsx)(`col`,{"data-column-id":e.id,"data-expanded":t,style:{width:t?e.width:`42px`}},e.id)})]}),(0,Q.jsx)(`thead`,{children:(0,Q.jsxs)(`tr`,{"aria-rowindex":B.windowed?1:void 0,children:[s?(0,Q.jsx)(`th`,{scope:`col`,children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Task controls`})}):null,de.map(e=>(0,Q.jsx)(OA,{column:e,expanded:iA(e.id,d),onToggle:f,disabled:p},e.id))]})}),(0,Q.jsxs)(`tbody`,{ref:B.anchorRef,className:`[&>tr:last-child>td]:border-b-0`,children:[(0,Q.jsx)(mA,{height:B.padTop,colSpan:de.length+ +!!s}),se.slice(B.start,B.end).map((e,t)=>e.kind===`section`?(0,Q.jsx)(`tr`,{"data-slot":`tasks-section`,"data-section":e.section.key,"data-row-unsampled":``,"aria-rowindex":B.ariaRowIndex(B.start+t),children:(0,Q.jsxs)(`th`,{scope:`rowgroup`,colSpan:de.length+ +!!s,className:G(AA,`border-b border-border bg-muted/40 px-3.5 py-1.5 text-left`),children:[e.section.label,` · `,e.section.taskCount]})},`section-${e.section.key}`):(0,Q.jsx)(MA,{ariaRowIndex:B.ariaRowIndex(B.start+t),gitRepo:_,run:e.node.run,depth:e.node.depth,childCount:e.node.childCount,subtasksExpanded:L(e.node.run.id),onToggleSubtasks:D,queuePosition:e.node.run.status===`queued`?z.get(e.node.run.id)??null:null,onRename:a,onTogglePin:pe,selectable:!!s,selected:R.ids.has(e.node.run.id),onSelect:R.toggle,actionsBusy:R.busy,onAction:R.apply,sortBy:j,columns:de,expandedColumns:d},e.node.run.id)),(0,Q.jsx)(mA,{height:B.padBottom,colSpan:de.length+ +!!s})]})]})})}),(0,Q.jsx)(CA,{cards:se.map(e=>e.kind===`section`?(0,Q.jsxs)(`h2`,{"data-slot":`tasks-section`,"data-section":e.section.key,className:G(AA,`px-1 pt-1`),children:[e.section.label,` · `,e.section.taskCount]},`section-${e.section.key}`):(0,Q.jsx)(RA,{run:e.node.run,depth:e.node.depth,childCount:e.node.childCount,subtasksExpanded:L(e.node.run.id),onToggleSubtasks:D,queuePosition:e.node.run.status===`queued`?z.get(e.node.run.id)??null:null,sortBy:j,showTokens:l,showCost:u,onTogglePin:pe,selectable:!!s,selected:R.ids.has(e.node.run.id),onSelect:R.toggle,actionsBusy:R.busy,onAction:R.apply,gitRepo:_},e.node.run.id))})]}),le.map(e=>(0,Q.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-label text-muted-foreground shadow-xs`,children:[(0,Q.jsx)(_u,{className:`size-[15px] shrink-0 text-soft-foreground`,"aria-hidden":`true`}),(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(`strong`,{className:`font-semibold text-foreground`,children:e.title}),` — `,e.count,` variants finished`]}),(0,Q.jsx)(J,{asChild:!0,variant:`outline`,size:`sm`,className:`md:ml-auto`,children:(0,Q.jsx)(X,{to:`/compare/${e.groupId}`,children:`Compare`})})]},e.groupId))]}),(0,Q.jsx)(X,{to:`/new`,"data-slot":`new-task-fab`,"aria-label":`New task`,className:`fixed right-4 bottom-[calc(16px+var(--phone-bar,0px)+env(safe-area-inset-bottom))] z-20 inline-flex size-14 items-center justify-center rounded-full bg-primary text-primary-foreground shadow-modal md:hidden`,children:(0,Q.jsx)(Jo,{className:`size-[22px]`,"aria-hidden":`true`})})]})})}function CA({cards:e}){let t=e.length>100,n=Z.useRef(null),r=Z.useRef(null),[i,a]=Z.useState(0);return Z.useLayoutEffect(()=>{if(!t)return;let e=()=>{let e=n.current,t=r.current;!e||!t||a(Math.max(0,Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop)))};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[t]),(0,Q.jsx)(`div`,{ref:e=>{n.current=e,e&&(r.current=e.closest(`[data-slot="main"]`))},"data-slot":`task-cards`,"data-virtualized":t,className:G(`flex flex-col md:hidden`,t?null:`gap-2.5`),children:t?(0,Q.jsx)(ll,{scrollRef:r,startMargin:i,children:e.map(e=>(0,Q.jsx)(`div`,{className:`pb-2.5`,children:e},e.key))}):e})}function wA({view:e,query:t,filtered:n=!1,onClearFilters:r=()=>void 0,origin:i=`all`,hiddenByOrigin:a=!1,onShowAll:o=()=>void 0,firstRun:s}){let c=t.trim(),l=c?`search-miss`:n?`filtered`:a?`origin-hidden`:e===`archived`?`archive`:`no-tasks`;return(0,Q.jsx)(`div`,{"data-slot":`tasks-empty`,"data-empty-kind":l,className:`flex flex-1 flex-col`,children:l===`filtered`?(0,Q.jsx)(gl,{heading:`h2`,icon:(0,Q.jsx)(Yo,{}),tone:`neutral`,title:`No tasks match these filters`,actions:(0,Q.jsx)(J,{type:`button`,variant:`outline`,onClick:r,children:`Clear filters`})}):l===`origin-hidden`?(0,Q.jsx)(gl,{heading:`h2`,icon:(0,Q.jsx)(ts,{}),tone:`neutral`,title:i===`regular`?`No regular tasks here`:`No automation tasks here`,subtitle:i===`regular`?`Tasks started by automations are hidden.`:`Only tasks started by automations are shown.`,actions:(0,Q.jsx)(J,{type:`button`,variant:`outline`,onClick:o,children:`Show all tasks`})}):l===`search-miss`?(0,Q.jsx)(gl,{heading:`h2`,icon:(0,Q.jsx)(Yo,{}),tone:`neutral`,title:`No matching tasks`,subtitle:`No tasks match “${c}”.`}):l===`archive`?(0,Q.jsx)(gl,{heading:`h2`,icon:(0,Q.jsx)(fa,{}),tone:`neutral`,title:`Nothing archived yet`,subtitle:`Finished tasks you archive land here.`}):s||(0,Q.jsx)(gl,{heading:`h2`,icon:(0,Q.jsx)(ru,{}),tone:`primary`,backdrop:!0,title:`No tasks yet`,subtitle:`Describe a task to get started.`,actions:(0,Q.jsx)(J,{asChild:!0,children:(0,Q.jsxs)(X,{to:`/new`,children:[(0,Q.jsx)(Jo,{"aria-hidden":`true`}),`New task`]})})})})}function TA({runs:e,view:t,origin:n,onOriginChange:r,filters:i,onFiltersChange:a,automations:o,automationNames:s,sortBy:c,onSortByChange:l}){let u=Z.useMemo(()=>e.filter(e=>t===`archived`?e.archived:!e.archived),[e,t]),d=bv(u,i,o),f=e=>yv(u,n,i,o,e),p=f(`statuses`),m=f(`workflows`),h=f(`automations`),g=xv(u.map(e=>o.get(e.id))),_=(e,t)=>a(n=>({...n,[e]:n[e].includes(t)?n[e].filter(e=>e!==t):[...n[e],t]})),v=e=>a(t=>({...t,[e]:[]})),y=mv(i);return(0,Q.jsxs)(`div`,{"data-slot":`tasks-filters`,className:`mb-3 flex flex-wrap items-center gap-1.5`,children:[(0,Q.jsx)(Jk,{slot:`task-origin`,label:`Show tasks started by`,value:n,options:_p.map(e=>({...e,count:d[e.value]})),onChange:r}),(0,Q.jsx)(`span`,{className:`mx-1 h-5 w-px bg-border`,"aria-hidden":`true`}),(0,Q.jsx)(Yk,{slot:`status`,label:`Status`,selected:i.statuses,onToggle:e=>_(`statuses`,e),onClear:()=>v(`statuses`),options:xv(u.map(e=>e.status)).map(e=>({value:e,label:e,count:p.get(e)??0})),emptyLabel:`No tasks to filter`}),(0,Q.jsx)(Yk,{slot:`workflow`,label:`Workflow`,selected:i.workflows,onToggle:e=>_(`workflows`,e),onClear:()=>v(`workflows`),options:xv(u.map(e=>ve(e))).map(e=>({value:e,label:e,count:m.get(e)??0})),emptyLabel:`No tasks to filter`}),n!==`regular`&&g.length>0?(0,Q.jsx)(Yk,{slot:`automation`,label:`Automation`,selected:i.automations,onToggle:e=>_(`automations`,e),onClear:()=>v(`automations`),options:g.map(e=>({value:e,label:s?.get(e)??e,count:h.get(e)??0})),emptyLabel:`No automation tasks`}):null,y>0?(0,Q.jsxs)(`button`,{type:`button`,"data-action":`clear-filters`,onClick:()=>a(()=>pv),className:`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,Q.jsx)(ns,{className:`size-3`,"aria-hidden":`true`}),`Clear (`,y,`)`]}):null,(0,Q.jsx)(`span`,{className:`mx-1 h-5 w-px bg-border`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`text-meta font-medium text-soft-foreground`,children:`Sort by`}),(0,Q.jsx)(Jk,{slot:`sort-by`,label:`Sort tasks by`,value:c,options:E,onChange:l})]})}function EA({view:e,current:t,onSelect:n,count:r,children:i}){let a=e===t;return(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`overview-tab`,"data-view":e,"aria-pressed":a,onClick:()=>n(e),className:G(`flex h-7 items-center justify-center gap-1.5 rounded-[7px] px-3 text-label font-medium text-muted-foreground`,a&&`bg-card font-semibold text-foreground shadow-xs`),children:[i,r>0?(0,Q.jsx)(`span`,{className:`font-mono text-meta tabular-nums`,children:r}):null]})}function DA({children:e,right:t=!1,columnId:n,folded:r=!1}){return(0,Q.jsx)(`th`,{scope:`col`,"data-column-id":n,"data-folded":r||void 0,className:G(`h-[38px] border-b border-border px-2.5 text-left eyebrow whitespace-nowrap text-soft-foreground first:pl-4 last:pr-4`,t&&`text-right`,r&&`px-0 first:pl-0 last:pr-0`),children:e})}function OA({column:e,expanded:t,onToggle:n,disabled:r}){if(!e.canFold)return(0,Q.jsx)(DA,{columnId:e.id,right:e.align===`right`,children:e.label});let i=t?`Fold`:`Expand`;return(0,Q.jsx)(DA,{columnId:e.id,right:e.align===`right`,folded:!t,children:(0,Q.jsxs)(ss,{children:[(0,Q.jsx)(is,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,"aria-label":`${i} ${e.label} column`,"aria-pressed":t,disabled:r,onClick:()=>n(e.id),className:G(`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,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{children:e.label}),(0,Q.jsx)(Fl,{className:`size-3 opacity-55`,"aria-hidden":`true`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(kA,{icon:e.icon}),(0,Q.jsx)(Il,{className:`size-3 opacity-70`,"aria-hidden":`true`})]})})}),(0,Q.jsxs)(as,{side:`top`,children:[e.label,` · `,i,` column`]})]})})}function kA({icon:e}){let t=`size-3.5`;switch(e){case`workflow`:return(0,Q.jsx)(ts,{className:t,"aria-hidden":`true`});case`branch`:return(0,Q.jsx)(xo,{className:t,"aria-hidden":`true`});case`diff`:return(0,Q.jsx)(_o,{className:t,"aria-hidden":`true`});case`reference`:return(0,Q.jsx)(ea,{className:t,"aria-hidden":`true`});case`tokens`:return(0,Q.jsx)(Rl,{className:t,"aria-hidden":`true`});case`cost`:return(0,Q.jsx)(Vl,{className:t,"aria-hidden":`true`});case`cpu`:return(0,Q.jsx)(Fa,{className:t,"aria-hidden":`true`});case`memory`:return(0,Q.jsx)(au,{className:t,"aria-hidden":`true`});case`started`:return(0,Q.jsx)(Ll,{className:t,"aria-hidden":`true`});default:return null}}var AA=`eyebrow text-soft-foreground`,jA=`h-11 border-b border-border px-2.5 whitespace-nowrap first:pl-4 last:pr-4`,MA=Z.memo(function({ariaRowIndex:e,gitRepo:t,run:n,depth:r,childCount:i,subtasksExpanded:a,onToggleSubtasks:s,queuePosition:c,onRename:l,onTogglePin:u,sortBy:d,columns:f,expandedColumns:p,selectable:m,selected:h,onSelect:g,actionsBusy:_,onAction:v}){let y=Fc(),b=o(n),S=x(n),C=`/tasks/${n.id}`,w=Oe(n.costUsd),T=Wt(n);return(0,Q.jsxs)(`tr`,{"data-slot":`task-table-row`,"data-run-id":n.id,"aria-rowindex":e,"data-depth":r,onClick:e=>{e.target.closest(`a, button, input`)||y(C)},className:`group/row cursor-pointer hover:bg-muted`,children:[m?(0,Q.jsx)(`td`,{className:`border-b border-border px-2`,children:(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Q.jsx)(Gk,{label:`Select ${Ge(n)}`,checked:h,disabled:_,onChange:()=>g(n.id)}),(0,Q.jsx)(qk,{run:n,busy:_,onAction:v})]})}):null,f.map(e=>{if(e.id===`memory`)return null;if(e.id===`cpu`){let t=iA(`cpu`,p),r=iA(`memory`,p);return c!==null&&(t||r)?(0,Q.jsxs)(`td`,{"data-slot":`queue-note`,"data-column-id":`cpu-memory`,colSpan:2,className:G(jA,`text-right font-mono text-meta text-soft-foreground`),children:[`#`,c,` in queue`]},e.id):(0,Q.jsx)(IA,{run:n,cpuExpanded:t,memoryExpanded:r},e.id)}return(0,Q.jsx)(NA,{gitRepo:t,column:e,expanded:iA(e.id,p),run:n,depth:r,childCount:i,subtasksExpanded:a,onToggleSubtasks:s,attention:b,scheduled:S,reference:T,cost:w,to:C,onRename:l,onTogglePin:u,sortBy:d},e.id)})]})});function NA({gitRepo:e,column:t,expanded:n,run:r,depth:i,childCount:a,subtasksExpanded:o,onToggleSubtasks:s,attention:c,scheduled:l,reference:u,cost:d,to:f,onRename:p,onTogglePin:m,sortBy:h}){if(!n)return(0,Q.jsx)(PA,{column:t.id});switch(t.id){case`status`:return(0,Q.jsx)(`td`,{"data-column-id":t.id,className:jA,children:(0,Q.jsxs)(il,{dot:c.tone,pulse:c.pulse,title:l?.title,children:[c.label,l?(0,Q.jsx)(`span`,{className:`tabular-nums`,children:l.label}):null]})});case`task`:return(0,Q.jsx)(`td`,{"data-column-id":t.id,className:G(jA,`max-w-0`),style:{minWidth:`${me(i)}px`},children:(0,Q.jsx)(FA,{run:r,depth:i,childCount:a,subtasksExpanded:o,onToggleSubtasks:s,to:f,onRename:p,onTogglePin:m})});case`workflow`:return(0,Q.jsx)(`td`,{"data-column-id":t.id,className:G(jA,`text-label text-muted-foreground`),children:ve(r)});case`branch`:return(0,Q.jsx)(`td`,{"data-column-id":t.id,className:jA,children:r.branch?(0,Q.jsx)(VA,{branch:r.branch}):HA(r,e)?(0,Q.jsx)(UA,{}):(0,Q.jsx)(zA,{})});case`diff`:return(0,Q.jsx)(`td`,{"data-column-id":t.id,className:jA,children:r.diffStat?(0,Q.jsx)(ol,{stat:r.diffStat}):(0,Q.jsx)(zA,{})});case`reference`:return(0,Q.jsx)(`td`,{"data-column-id":t.id,className:jA,children:u?(0,Q.jsx)(mo,{run:r,reference:u}):(0,Q.jsx)(zA,{})});case`tokens`:return(0,Q.jsx)(`td`,{"data-column-id":t.id,className:G(jA,`text-right text-xs text-muted-foreground`),children:(0,Q.jsx)(al,{inputTokens:r.inputTokens,outputTokens:r.outputTokens,variant:`table`,omitWhenUnknown:!1})});case`cost`:return(0,Q.jsx)(`td`,{"data-column-id":t.id,className:G(jA,`text-right font-mono text-xs text-muted-foreground tabular-nums`),children:d||(0,Q.jsx)(zA,{})});case`started`:return(0,Q.jsx)(`td`,{"data-column-id":t.id,className:G(jA,`text-right text-xs text-soft-foreground tabular-nums`),children:(0,Q.jsx)(dA,{at:I(r,h)})});case`cpu`:case`memory`:return null}}function PA({column:e}){return(0,Q.jsx)(`td`,{role:`presentation`,"aria-hidden":`true`,"data-column-id":e,"data-folded":`true`,className:G(jA,`px-0 first:pl-0 last:pr-0`)})}function FA({run:e,depth:t,childCount:n,subtasksExpanded:r,onToggleSubtasks:i,to:a,onRename:o,onTogglePin:s}){let c=Ge(e),l=ra(c,t=>o(e.id,t)),u=Ra(e),d=Ua(e),f=Tv(n),p=t>0?{paddingLeft:`${t*14}px`}:void 0;return l.editing?(0,Q.jsx)(`span`,{className:`flex min-w-0 items-center`,style:p,children:(0,Q.jsx)(Xi,{editor:l,className:`text-ui font-medium`})}):(0,Q.jsxs)(`span`,{className:`@container flex min-w-0 items-center gap-1.5`,style:p,children:[t>0?(0,Q.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`subtask-tick`,className:`shrink-0 font-mono text-meta leading-none text-soft-foreground`,children:`└`}):null,(0,Q.jsxs)(X,{to:a,title:c,className:G(`min-w-0 truncate text-ui`,u?`font-semibold text-foreground`:d?`font-medium text-muted-foreground`:`font-medium`),children:[c,u?(0,Q.jsx)(fv,{}):null]}),Ev(e)?(0,Q.jsx)(`span`,{"data-slot":`dispatch-kind`,className:`shrink-0 rounded-full bg-muted px-1.5 py-px text-micro font-medium text-muted-foreground @max-[300px]:hidden`,children:Ev(e)}):null,f?(0,Q.jsx)(Qk,{label:f,expanded:r,onToggle:()=>i(e.id),wordClassName:`@max-[260px]:hidden`}):null,(0,Q.jsxs)(`span`,{"data-slot":`row-actions`,className:G(`flex shrink-0 items-center gap-1.5`,!e.pinned&&`-ml-1.5 w-0 overflow-hidden group-hover/row:ml-0 group-hover/row:w-auto group-hover/row:overflow-visible group-focus-within/row:ml-0 group-focus-within/row:w-auto group-focus-within/row:overflow-visible no-hover:ml-0 no-hover:w-auto no-hover:overflow-visible`),children:[(0,Q.jsx)(`button`,{type:`button`,"data-slot":`row-rename`,"aria-label":`Rename task`,onClick:l.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,Q.jsx)(lo,{className:`size-3`,"aria-hidden":`true`})}),s?(0,Q.jsx)(ua,{pinned:!!e.pinned,onToggle:t=>s(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 IA({run:e,cpuExpanded:t,memoryExpanded:n}){let r=de(e,Hr(e.id));return(0,Q.jsxs)(Q.Fragment,{children:[t?(0,Q.jsx)(LA,{column:`cpu`,cell:r.cpu}):(0,Q.jsx)(PA,{column:`cpu`}),n?(0,Q.jsx)(LA,{column:`memory`,cell:r.mem}):(0,Q.jsx)(PA,{column:`memory`})]})}function LA({column:e,cell:t}){return(0,Q.jsx)(`td`,{"data-usage":e===`memory`?`mem`:e,"data-column-id":e,"data-usage-kind":t.kind,title:t.title,className:G(jA,`text-right font-mono tabular-nums`,t.kind===`live`&&`bg-violet/5 text-xs font-medium text-foreground`,t.kind===`peak`&&`text-meta text-soft-foreground`,t.kind===`none`&&`text-xs text-soft-foreground`),children:t.text||`—`})}var RA=Z.memo(function({run:e,depth:t,childCount:n,subtasksExpanded:r,onToggleSubtasks:i,queuePosition:a,sortBy:s,showTokens:c,showCost:l,onTogglePin:u,gitRepo:d,selectable:f,selected:p,onSelect:m,actionsBusy:h,onAction:g}){let _=Fc(),v=o(e),y=x(e),b=`/tasks/${e.id}`,S=Wt(e),C=Ra(e),w=Ua(e),T=Oe(e.costUsd),E=Tv(n),D=e.inputTokens!==void 0||e.outputTokens!==void 0;return(0,Q.jsxs)(`div`,{"data-slot":`task-card`,"data-run-id":e.id,"data-depth":t,style:t>0?{marginLeft:`${t*14}px`}:void 0,onClick:e=>{e.target.closest(`a, button, input`)||_(b)},className:`cursor-pointer rounded-lg border border-border bg-card px-3.5 py-3 shadow-xs`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[f?(0,Q.jsx)(Gk,{label:`Select ${Ge(e)}`,checked:p,disabled:h,onChange:()=>m(e.id)}):null,(0,Q.jsxs)(il,{dot:v.tone,pulse:v.pulse,className:`mt-px shrink-0`,title:y?.title,children:[v.label,y?(0,Q.jsx)(`span`,{className:`tabular-nums`,children:y.label}):null]}),(0,Q.jsxs)(X,{to:b,className:G(`min-w-0 flex-1 text-ui leading-[1.35]`,C?`font-semibold text-foreground`:w?`font-medium text-muted-foreground`:`font-medium`),children:[Ge(e),C?(0,Q.jsx)(fv,{}):null]}),Ev(e)?(0,Q.jsx)(`span`,{"data-slot":`dispatch-kind`,className:`mt-px shrink-0 rounded-full bg-muted px-1.5 py-px text-micro font-medium text-muted-foreground`,children:Ev(e)}):null,E?(0,Q.jsx)(Qk,{label:E,expanded:r,onToggle:()=>i(e.id),className:`mt-px`}):null,(0,Q.jsx)(`span`,{className:`mt-0.5 shrink-0 text-meta text-soft-foreground tabular-nums`,children:(0,Q.jsx)(dA,{at:I(e,s)})}),u?(0,Q.jsx)(ua,{pinned:!!e.pinned,onToggle:t=>u(e,t),className:`-mr-1 mt-px`}):null]}),(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5 font-mono text-meta font-medium text-muted-foreground tabular-nums`,children:[(0,Q.jsx)(`span`,{children:ve(e)}),a===null?(0,Q.jsxs)(Q.Fragment,{children:[e.branch?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(BA,{}),(0,Q.jsx)(`span`,{children:e.branch})]}):HA(e,d)?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(BA,{}),(0,Q.jsx)(UA,{})]}):null,e.diffStat?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(BA,{}),(0,Q.jsx)(ol,{stat:e.diffStat,className:`text-meta`})]}):null,c&&D?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(BA,{}),(0,Q.jsx)(al,{inputTokens:e.inputTokens,outputTokens:e.outputTokens})]}):null,l&&T?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(BA,{}),(0,Q.jsx)(`span`,{children:T})]}):null]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(BA,{}),(0,Q.jsxs)(`span`,{"data-slot":`queue-note`,children:[`#`,a,` in queue`]})]}),S?(0,Q.jsx)(mo,{run:e,reference:S,className:`h-5`}):null,f?(0,Q.jsx)(qk,{run:e,busy:h,onAction:g}):null]})]})});function zA(){return(0,Q.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`—`})}function BA(){return(0,Q.jsx)(`span`,{className:`text-soft-foreground`,"aria-hidden":`true`,children:`·`})}function VA({branch:e}){return(0,Q.jsx)(`span`,{className:`rounded-[6px] bg-muted px-1.5 py-0.5 font-mono text-meta font-medium text-muted-foreground`,children:e})}function HA(e,t){return t&&e.status===`running`&&!e.branch&&e.worktree!==!1}function UA(){return(0,Q.jsx)($k,{"data-slot":`branch-skeleton`,role:`status`,"aria-label":`naming branch`,className:`inline-block h-4 w-24 align-middle`})}function WA(){let e=ne(),t=cl(T().data),n=mn(),r=!n.data||n.data.info!==null,[i,a]=w_(),o=W(),s=sr(),c=Z.useCallback(async(e,t)=>{let n=t===`archive`||t===`restore`?await qn(s,e.id,t===`archive`,`tasks_table`):await Gt(s,e.id,t===`read`);sr()===s?Qt(o,n):o.invalidateQueries({queryKey:V.runsIndex}),o.invalidateQueries({queryKey:[s,`runs`]})},[s,o]),l=U({mutationFn:Nn,onSuccess:()=>o.invalidateQueries({queryKey:H.runs.all})}),u=U({mutationFn:_e,onSuccess:()=>o.invalidateQueries({queryKey:H.runs.all}),onError:e=>Y(e.message,{tone:`danger`})}),d=U({mutationFn:({id:e,title:t})=>Ie(e,{title:t}),onSuccess:e=>{Qt(o,e),o.invalidateQueries({queryKey:H.runs.all})},onError:e=>Y(e.message,{tone:`danger`})}),f=hn(`tasks_table`),p=d.mutate,m=Z.useCallback((e,t)=>p({id:e,title:t}),[p]),h=f.mutate,g=Z.useCallback((e,t)=>h({id:e.id,pinned:t},{onError:e=>Y(e.message,{tone:`danger`})}),[h]),_=cA(),[v,y]=kp(),b=$_(),x=uv(),S=Z.useMemo(()=>(e.data??[]).some(e=>e.automation??e.automationTrigger??e.automationTracker),[e.data]),C=ev(b.known&&!b.off&&(S&&v!==`regular`||x&&i===`active`)),w=Z.useMemo(()=>new Map((C.data?.automations??[]).map(e=>[e.id,e.name])),[C.data]),E=Ht();return(0,Q.jsx)(Da,{projectId:E,requests:Z.useMemo(()=>E===void 0?[]:(e.data??[]).flatMap(e=>z(e).map(e=>({projectId:E,kind:e.kind,number:e.number}))),[e.data,E]),children:(0,Q.jsx)(SA,{scheduledTasks:i===`active`?(0,Q.jsx)(rv,{enabled:x}):void 0,hasScheduledTasks:i===`active`&&!!C.data?.automations.some(e=>e.deferredStart),runs:e.data,view:i,onViewChange:a,onArchiveFinished:()=>l.mutate(),onMarkAllRead:()=>u.mutate(),onRename:m,onTogglePin:g,onTaskAction:c,showTokens:t.tokens,showCost:t.cost,expandedColumns:_.expandedColumns,onToggleColumn:_.toggleColumn,columnsPending:_.isPending,origin:v,onOriginChange:y,gitRepo:r,automationNames:w,firstRun:i===`active`?(0,Q.jsx)(Tb,{gitRepo:n.data?n.data.info!==null:n.isError?!0:void 0}):void 0,setupPill:i===`active`?(0,Q.jsx)(nx,{}):void 0,welcomeBack:i===`active`?(0,Q.jsx)(vx,{runs:e.data??vA}):void 0})})}var GA=[],KA=` untagged`,qA=[{value:`project`,label:`Project`},{value:`tag`,label:`Tag`},{value:`status`,label:`Status`},{value:`workflow`,label:`Workflow`}];function JA(e,t){return e===t?`none`:t}function YA(e,t){return[...e].sort((e,n)=>ce(I(e.run,t),I(n.run,t)))}var XA={query:``,tags:[],statuses:[],workflows:[]};function ZA(e,t){return e.includes(t)?e.filter(e=>e!==t):[...e,t]}function QA(e){return e.tags.length+e.statuses.length+e.workflows.length}function $A(e){return e.query.trim()!==``||QA(e)>0}function ej(e){return QA(e.filters)+(e.filters.query.trim()===``?0:1)+(e.groupBy===`none`?0:1)}function tj(e){return ej(e)>0}function nj(e,t){let n=new Map(t.map(e=>[e.id,e]));return e.map(e=>{let t=n.get(e.projectId);return{run:e,project:t,projectName:t?.name||e.projectId,tags:t?.tags??GA}})}var rj=e=>`${e.projectId}/${e.id}`;function ij(e){let t=new Map(e.map(e=>[rj(e.run),e.run]));return new Map(e.map(e=>[rj(e.run),bp(e.run,n=>t.get(`${e.run.projectId}/${n}`))]))}function aj(e,t,n){return e.filter(e=>xp(n.get(rj(e.run)),t))}function oj(e){let t=new Set;for(let n of e)t.add(n.run.workflow);return[...t].sort((e,t)=>e.localeCompare(t))}function sj(e){let t=new Set;for(let n of e)t.add(n.run.status);return[...t].sort((e,t)=>e.localeCompare(t))}function cj(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 lj=e=>e.tags.length===0?[KA]:e.tags,uj=(e,t)=>e.length===0||t.some(t=>e.includes(t)),dj=(e,t)=>{if(t.length===0)return!0;let n=lj(e).map(e=>e.toLowerCase());return t.some(e=>n.includes(e.toLowerCase()))};function fj(e){return[Ge(e.run),e.projectName,e.run.workflow,e.run.branch??``,...e.tags].join(`
|
|
33
|
+
`).toLowerCase()}function pj(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)||!uj(t.statuses,[e.run.status])||!uj(t.workflows,[e.run.workflow])||!dj(e,t.tags))return!1;if(r.length===0)return!0;let i=fj(e);return r.every(e=>i.includes(e))})}function mj(e,t,n,r){return pj(e,{...t,[r]:[]},n)}function hj(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(KA,`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 gj(e,t){let n=new Map(t.map(e=>[e.id,e.name]));return e.map(e=>n.get(e)||e)}var _j={query:`q`,tag:`tag`,untagged:`untagged`,status:`status`,workflow:`workflow`,groupBy:`group`,sort:`sort`,archived:`archived`},vj=new Set(qA.map(e=>e.value));function yj(e){let t=new URLSearchParams,n=e.filters.query.trim();n!==``&&t.set(_j.query,n);for(let n of e.filters.tags)n===` untagged`?t.set(_j.untagged,`1`):t.append(_j.tag,n);for(let n of e.filters.statuses)t.append(_j.status,n);for(let n of e.filters.workflows)t.append(_j.workflow,n);return e.groupBy!==`none`&&t.set(_j.groupBy,e.groupBy),e.sortBy!==`recent`&&t.set(_j.sort,e.sortBy),e.view===`archived`&&t.set(_j.archived,`1`),t}function bj(e){let t=e.getAll(_j.tag).filter(e=>e!==``);e.get(_j.untagged)===`1`&&t.push(KA);let n=e.get(_j.groupBy)??``;return{filters:{query:e.get(_j.query)??``,tags:t,statuses:e.getAll(_j.status).filter(e=>e!==``),workflows:e.getAll(_j.workflow).filter(e=>e!==``)},groupBy:vj.has(n)?n:`none`,sortBy:e.get(_j.sort)===`created`?`created`:`recent`,view:e.get(_j.archived)===`1`?`archived`:`active`}}var xj=15e3,Sj=e=>e?.runs.some(e=>e.usage!==void 0)?xj:!1,Cj=3e4,wj=250,Tj=1,Ej=new Set([`done`,`failed`,`cancelled`]);function Dj(){return kj({request:({task:e,archived:t})=>qn(e.run.projectId,e.run.id,t,`all_tasks`),patch:({archived:e})=>t=>({...t,archived:e})})}function Oj(){return kj({request:({task:e,read:t})=>Gt(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 kj({request:e,patch:t}){let n=W();return U({mutationFn:e,onMutate:async e=>{await n.cancelQueries({queryKey:V.runsIndex});let r=n.getQueryData(V.runsIndex),i=t(e),{task:a}=e;return n.setQueryData(V.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(V.runsIndex,r.previous),Y(e.message,{tone:`danger`})},onSettled:(e,t,{task:r})=>{n.invalidateQueries({queryKey:V.runsIndex}),n.invalidateQueries({queryKey:H.runs.all}),n.invalidateQueries({queryKey:[r.run.projectId,`runs`,`list`]})}})}function Aj(){let e=a(),t=cl(T().data),n=Ee(!0,Sj),[r,i]=kr(),{filters:o,groupBy:s,sortBy:c,view:l}=Z.useMemo(()=>bj(r),[r]),[u,d]=w_();Z.useEffect(()=>{u!==l&&d(l)},[l,u,d]);let f=e=>i(t=>yj(e(bj(t))),{replace:!0}),p=e=>f(t=>({...t,filters:e(t.filters)})),m=e=>f(t=>({...t,groupBy:e})),h=e=>f(t=>({...t,sortBy:e})),g=e=>f(t=>({...t,view:e})),[_,v]=Z.useState(o.query),[y,b]=Z.useState(new Set),x=Z.useCallback(e=>b(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n}),[]),S=o.query.trim()!==``,C=Z.useCallback(e=>S||y.has(e),[S,y]),w=Z.useRef(o.query);Z.useEffect(()=>{o.query!==w.current&&v(o.query),w.current=o.query},[o.query]),Z.useEffect(()=>{if(_===w.current)return;let e=setTimeout(()=>{w.current=_,p(e=>({...e,query:_}))},wj);return()=>clearTimeout(e)},[_]);let E=n.data?.referenceStatuses;Z.useEffect(()=>{E&&Rt(E)},[E]);let D=Z.useMemo(()=>e.data?.projects??[],[e.data]),O=Z.useMemo(()=>nj(n.data?.runs??[],D),[n.data,D]),[k,A]=kp(),j=Z.useMemo(()=>ij(O),[O]),ee=Z.useMemo(()=>aj(O,k,j),[O,k,j]),M=Z.useMemo(()=>{let e=e=>pj(aj(O,e,j),o,l).length;return{regular:e(`regular`),automation:e(`automation`),all:e(`all`)}},[O,j,o,l]),N=Z.useMemo(()=>YA(pj(ee,o,l),c),[ee,o,l,c]),te=Z.useMemo(()=>hj(N,s),[N,s]),ne=Z.useMemo(()=>N.flatMap(e=>z(e.run,e.project?.repoUrl).map(t=>({projectId:e.run.projectId,kind:t.kind,number:t.number}))),[N]),P=gj(n.data?.truncated??[],D),F=(e,t)=>p(n=>({...n,[e]:ZA(n[e],t)})),re=e=>p(t=>({...t,[e]:[]})),I=Dj(),ie=Oj(),L=I.mutate,ae=Z.useCallback((e,t)=>L({task:e,archived:t}),[L]),oe=ie.mutate,se=Z.useCallback((e,t)=>oe({task:e,read:t}),[oe]);if(n.isError||e.isError)return(0,Q.jsx)(`div`,{"data-route":`global-tasks`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(gl,{icon:(0,Q.jsx)(To,{}),tone:`danger`,title:`Tasks across projects did not load`,subtitle:(n.error??e.error)?.message})});let ce=(0,Q.jsxs)(`div`,{className:`relative w-full md:w-60`,children:[(0,Q.jsx)(Xo,{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,Q.jsx)(`input`,{type:`text`,value:_,onChange:e=>v(e.target.value),placeholder:`Search every project…`,"aria-label":`Search tasks across projects`,className:`h-9 w-full rounded-md border border-input bg-card pr-3 pl-8 text-ui text-foreground outline-none placeholder:text-soft-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`})]});return(0,Q.jsxs)(`div`,{"data-route":`global-tasks`,className:`flex min-h-full flex-col`,children:[(0,Q.jsxs)(`header`,{className:`sticky top-0 z-10 hidden h-14 shrink-0 items-center gap-3 border-b border-border bg-background px-5 md:flex`,children:[(0,Q.jsx)(`h1`,{className:`text-base font-semibold`,children:`All tasks`}),(0,Q.jsxs)(`div`,{className:`inline-flex gap-0.5 rounded-md bg-muted p-[3px]`,children:[(0,Q.jsx)(jj,{view:`active`,current:l,onSelect:g,children:`Active`}),(0,Q.jsx)(jj,{view:`archived`,current:l,onSelect:g,children:`Archived`})]}),(0,Q.jsx)(`div`,{className:`flex-1`}),(0,Q.jsxs)(`span`,{"data-slot":`global-tasks-count`,className:`text-label text-soft-foreground tabular-nums`,children:[N.length,` of `,O.length]}),ce]}),(0,Q.jsxs)(`div`,{className:`flex flex-1 flex-col gap-3 p-3 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-5 md:pb-5`,children:[(0,Q.jsx)(`div`,{className:`md:hidden`,children:ce}),(0,Q.jsx)(Mj,{filters:o,onToggle:F,onClearFacet:re,onClearAll:()=>{v(``),f(e=>({...e,filters:XA,groupBy:`none`}))},groupBy:s,onGroupByChange:m,sortBy:c,onSortByChange:h,projects:D,tasks:ee,view:l,origin:k,onOriginChange:A,originCounts:M}),P.length>0?(0,Q.jsxs)(`p`,{"data-slot":`global-tasks-truncated`,className:`text-meta text-soft-foreground`,children:[`Showing the `,n.data?.perProjectLimit,` most recently active tasks per project — older ones in`,` `,P.join(`, `),` are only in that project’s own Tasks page.`]}):null,n.data===void 0?null:N.length===0?(0,Q.jsx)(Gj,{view:l,filtered:$A(o),origin:k,hiddenByOrigin:k!==`all`&&M.all>0,onShowAll:()=>A(`all`)}):(0,Q.jsx)(uA,{intervalMs:Cj,children:(0,Q.jsx)(Da,{requests:ne,children:te.map(e=>(0,Q.jsxs)(`section`,{"data-slot":`task-group`,"data-group-key":e.key,children:[s===`none`?null:(0,Q.jsxs)(`h2`,{className:`mb-1.5 flex items-center gap-2 eyebrow text-soft-foreground`,children:[s===`project`?(0,Q.jsx)(Or,{to:Pc(e.key,`/`),"data-slot":`group-project-link`,className:`hover:text-foreground hover:underline`,children:e.label}):e.label,(0,Q.jsx)(`span`,{className:`font-mono text-meta font-medium tabular-nums`,children:e.tasks.length})]}),(0,Q.jsx)(Pj,{tasks:e.tasks,sortBy:c,isSubtasksExpanded:C,onToggleSubtasks:x,showProject:s!==`project`,onArchive:ae,onSetRead:se,busy:I.isPending||ie.isPending,showCost:t.cost})]},e.key))})})]})]})}function jj({view:e,current:t,onSelect:n,children:r}){let i=e===t;return(0,Q.jsx)(`button`,{type:`button`,"data-slot":`overview-tab`,"data-view":e,"aria-pressed":i,onClick:()=>n(e),className:G(`flex h-7 items-center justify-center rounded-[7px] px-3 text-label font-medium text-muted-foreground`,i&&`bg-card font-semibold text-foreground shadow-xs`),children:r})}function Mj({filters:e,onToggle:t,onClearFacet:n,onClearAll:r,groupBy:i,onGroupByChange:a,sortBy:o,onSortByChange:s,projects:c,tasks:l,view:u,origin:d,onOriginChange:f,originCounts:p}){let m=Z.useMemo(()=>Nt(c),[c]),h=Z.useMemo(()=>{let t=(t,n)=>cj(mj(l,e,u,t),n);return{tags:t(`tags`,lj),statuses:t(`statuses`,e=>[e.run.status]),workflows:t(`workflows`,e=>[e.run.workflow])}},[l,e,u]),g=e=>t=>({...t,count:e.get(t.value)??0});return(0,Q.jsxs)(`div`,{"data-slot":`global-tasks-filters`,className:`flex flex-col gap-2 rounded-lg border border-border bg-card p-2.5 shadow-xs`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,Q.jsx)(Jk,{slot:`task-origin`,label:`Show tasks started by`,value:d,options:_p.map(e=>({...e,count:p[e.value]})),onChange:f}),(0,Q.jsx)(`span`,{className:`mx-1 h-5 w-px bg-border`,"aria-hidden":`true`}),(0,Q.jsx)(Yk,{slot:`status`,label:`Status`,selected:e.statuses,onToggle:e=>t(`statuses`,e),onClear:()=>n(`statuses`),options:sj(l).map(e=>({value:e,label:e})).map(g(h.statuses)),emptyLabel:`No tasks to filter`}),(0,Q.jsx)(Yk,{slot:`workflow`,label:`Workflow`,selected:e.workflows,onToggle:e=>t(`workflows`,e),onClear:()=>n(`workflows`),options:oj(l).map(e=>({value:e,label:e})).map(g(h.workflows)),emptyLabel:`No tasks to filter`}),(0,Q.jsx)(`span`,{className:`mx-1 h-5 w-px bg-border`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`text-meta font-medium text-soft-foreground`,children:`Group by`}),(0,Q.jsx)(Zk,{slot:`group-by`,label:`Group tasks by`,value:i,options:qA,onChange:e=>a(JA(i,e))}),(0,Q.jsx)(`span`,{className:`mx-1 h-5 w-px bg-border`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`text-meta font-medium text-soft-foreground`,children:`Sort by`}),(0,Q.jsx)(Jk,{slot:`sort-by`,label:`Sort tasks by`,value:o,options:E,onChange:s}),tj({filters:e,groupBy:i})?(0,Q.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,Q.jsx)(ns,{className:`size-3`,"aria-hidden":`true`}),`Clear`,` (${ej({filters:e,groupBy:i})})`]}):null]}),m.length>0?(0,Q.jsxs)(`div`,{"data-slot":`tag-filters`,className:`flex flex-wrap items-center gap-1.5`,children:[(0,Q.jsx)(`span`,{className:`text-meta font-medium text-soft-foreground`,children:`Tags`}),m.map(n=>(0,Q.jsx)(Xk,{slot:`tag-filter`,tone:`tag`,label:n,count:h.tags.get(n)??0,selected:e.tags.some(e=>e.toLowerCase()===n.toLowerCase()),onToggle:()=>t(`tags`,n)},n)),(0,Q.jsx)(Xk,{slot:`tag-filter`,label:`Untagged`,count:h.tags.get(` untagged`)??0,selected:e.tags.includes(KA),onToggle:()=>t(`tags`,KA)})]}):(0,Q.jsxs)(`p`,{"data-slot":`no-tags-hint`,className:`text-meta text-soft-foreground`,children:[`Tag connected repositories in`,` `,(0,Q.jsx)(Or,{to:`/settings/global/projects`,className:`font-medium text-violet hover:underline`,children:`Settings → Projects`}),` `,`to group their tasks together here.`]})]})}var Nj=e=>e.dispatch;function Pj({tasks:e,sortBy:t,isSubtasksExpanded:n,onToggleSubtasks:r,showProject:i,onArchive:a,onSetRead:o,busy:s,showCost:c}){let l=Z.useMemo(()=>wv(e.map(e=>({id:e.run.id,dispatch:Nj(e.run),task:e})),n),[e,n]),u=hA(l.length),d=[(0,Q.jsx)(Fj,{className:`w-[104px]`,children:`Status`},`status`),(0,Q.jsx)(Fj,{children:`Task`},`task`),i?(0,Q.jsx)(Fj,{className:`w-[124px]`,children:`Project`},`project`):null,(0,Q.jsx)(Fj,{className:`hidden w-[120px] xl:table-cell`,children:`Tags`},`tags`),(0,Q.jsx)(Fj,{className:`w-[84px]`,children:`Ref`},`ref`),(0,Q.jsx)(Fj,{className:`hidden w-[108px] xl:table-cell`,children:`Workflow`},`workflow`),c?(0,Q.jsx)(Fj,{className:`hidden w-[64px] text-right lg:table-cell`,children:`Cost`},`cost`):null,(0,Q.jsx)(Fj,{className:`hidden w-[56px] text-right xl:table-cell`,children:`CPU`},`cpu`),(0,Q.jsx)(Fj,{className:`hidden w-[84px] text-right xl:table-cell`,children:`Mem`},`mem`),(0,Q.jsx)(Fj,{className:`w-[72px] text-right`,children:_n(t)},`age`),(0,Q.jsx)(Fj,{className:`w-[64px] text-right`,children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Actions`})},`actions`)].filter(e=>e!==null),f=d.length;return(0,Q.jsx)(`div`,{"data-slot":`global-tasks-table`,className:`overflow-x-auto rounded-lg border border-border bg-card shadow-xs`,children:(0,Q.jsx)(os,{children:(0,Q.jsxs)(`table`,{className:`w-full border-collapse`,"aria-rowcount":u.ariaRowCount,children:[(0,Q.jsx)(`thead`,{children:(0,Q.jsx)(`tr`,{"aria-rowindex":u.windowed?1:void 0,children:d})}),(0,Q.jsxs)(`tbody`,{ref:u.anchorRef,className:`[&>tr:last-child>td]:border-b-0`,children:[(0,Q.jsx)(mA,{height:u.padTop,colSpan:f}),l.slice(u.start,u.end).map((e,l)=>(0,Q.jsx)(Lj,{ariaRowIndex:u.ariaRowIndex(u.start+l),task:e.run.task,depth:e.depth,childCount:e.childCount,subtasksExpanded:n(e.run.id),onToggleSubtasks:r,sortBy:t,showProject:i,onArchive:a,onSetRead:o,busy:s,showCost:c},`${e.run.task.run.projectId}/${e.run.task.run.id}`)),(0,Q.jsx)(mA,{height:u.padBottom,colSpan:f})]})]})})})}function Fj({children:e,className:t}){return(0,Q.jsx)(`th`,{scope:`col`,className:G(`h-[38px] border-b border-border px-2.5 text-left eyebrow whitespace-nowrap text-soft-foreground first:pl-4 last:pr-4`,t),children:e})}var Ij=`h-11 border-b border-border px-2.5 whitespace-nowrap first:pl-4 last:pr-4`,Lj=Z.memo(function({ariaRowIndex:e,task:t,depth:n,childCount:r,subtasksExpanded:i,onToggleSubtasks:a,sortBy:s,showProject:c,onArchive:l,onSetRead:u,busy:d,showCost:f}){let{run:p}=t,m=o(p),h=Pc(p.projectId,`/tasks/${p.id}`),g=Ra(p),_=Ua(p),v=z(p,t.project?.repoUrl),y=Tv(r),b=de(p,p.usage);return(0,Q.jsxs)(`tr`,{"data-slot":`global-task-row`,"data-run-id":p.id,"aria-rowindex":e,"data-project":p.projectId,"data-depth":n,className:`hover:bg-muted`,children:[(0,Q.jsx)(`td`,{className:Ij,children:(0,Q.jsx)(il,{dot:m.tone,pulse:m.pulse,children:m.label})}),(0,Q.jsx)(`td`,{className:G(Ij,`min-w-[320px] max-w-0`),children:(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,style:n>0?{paddingLeft:`${n*14}px`}:void 0,children:[n>0?(0,Q.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`subtask-tick`,className:`shrink-0 font-mono text-meta leading-none text-soft-foreground`,children:`└`}):null,(0,Q.jsxs)(Or,{to:h,title:Ge(p),className:G(`min-w-0 truncate text-ui`,g?`font-semibold text-foreground`:_?`font-medium text-muted-foreground`:`font-medium`),children:[Ge(p),g?(0,Q.jsx)(fv,{}):null]}),Ev(p)?(0,Q.jsx)(`span`,{"data-slot":`dispatch-kind`,className:`shrink-0 rounded-full bg-muted px-1.5 py-px text-micro font-medium text-muted-foreground`,children:Ev(p)}):null,y?(0,Q.jsx)(Qk,{label:y,expanded:i,onToggle:()=>a(p.id)}):null]})}),c?(0,Q.jsx)(`td`,{className:G(Ij,`text-label text-muted-foreground`),children:(0,Q.jsx)(Or,{to:Pc(p.projectId,`/`),className:`truncate hover:text-foreground`,children:t.projectName})}):null,(0,Q.jsx)(`td`,{className:G(Ij,`hidden xl:table-cell`),children:t.tags.length>0?(0,Q.jsx)(`span`,{className:`flex flex-wrap items-center gap-1`,children:t.tags.map(e=>(0,Q.jsx)(Hj,{tag:e},e))}):(0,Q.jsx)(Wj,{})}),(0,Q.jsx)(`td`,{className:Ij,children:v.length>0?(0,Q.jsx)(Vj,{references:v,run:p}):(0,Q.jsx)(Wj,{})}),(0,Q.jsx)(`td`,{className:G(Ij,`hidden text-label text-muted-foreground xl:table-cell`),children:p.workflow}),f?(0,Q.jsx)(`td`,{className:G(Ij,`hidden text-right font-mono text-xs text-muted-foreground tabular-nums lg:table-cell`),children:Oe(p.costUsd)||(0,Q.jsx)(Wj,{})}):null,(0,Q.jsx)(Uj,{column:`cpu`,cell:b.cpu}),(0,Q.jsx)(Uj,{column:`memory`,cell:b.mem}),(0,Q.jsx)(`td`,{className:G(Ij,`text-right text-xs text-soft-foreground tabular-nums`),children:(0,Q.jsx)(dA,{at:I(p,s)})}),(0,Q.jsx)(`td`,{className:G(Ij,`text-right`),children:(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,Q.jsx)(zj,{task:t,busy:d,onSetRead:u}),(0,Q.jsx)(Bj,{task:t,busy:d,onArchive:l})]})})]})},Rj);function Rj(e,t){let{task:n,...r}=e,{task:i,...a}=t;return n.run!==i.run||n.project!==i.project||n.projectName!==i.projectName||n.tags!==i.tags?!1:Object.keys(r).every(e=>r[e]===a[e])}function zj({task:e,busy:t,onSetRead:n}){if(!La(e.run))return null;let r=Ra(e.run),i=Ge(e.run),a=r?`Mark ${i} read`:`Mark ${i} unread`,o=r?vo:Hl;return(0,Q.jsxs)(ss,{children:[(0,Q.jsx)(is,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,"data-action":r?`mark-read`:`mark-unread`,"aria-label":a,disabled:t,onClick:()=>n(e,r),className:G(`inline-flex size-7 items-center justify-center 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-violet`:`text-soft-foreground`),children:(0,Q.jsx)(o,{className:`size-3.5`,"aria-hidden":`true`})})}),(0,Q.jsx)(as,{side:`left`,children:r?`Mark read`:`Mark unread`})]})}function Bj({task:e,busy:t,onArchive:n}){let r=e.run.archived;if(!r&&!Ej.has(e.run.status))return null;let i=r?`Restore ${Ge(e.run)} to the active list`:`Archive ${Ge(e.run)}`;return(0,Q.jsxs)(ss,{children:[(0,Q.jsx)(is,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,"data-action":r?`unarchive-run`:`archive-run`,"aria-label":i,disabled:t,onClick:()=>n(e,!r),className:`inline-flex size-7 items-center justify-center 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,Q.jsx)(r?Ol:fa,{className:`size-3.5`,"aria-hidden":`true`})})}),(0,Q.jsx)(as,{side:`left`,children:r?`Restore`:`Archive`})]})}function Vj({references:e,run:t}){let n=e.slice(0,Tj),r=e.length-n.length,i=Ge(t);return(0,Q.jsxs)(`span`,{className:`flex flex-nowrap items-center gap-1`,children:[n.map(e=>(0,Q.jsx)(Oa,{reference:e,taskTitle:i,projectId:t.projectId,conflictAction:(0,Q.jsx)(po,{projectId:t.projectId,runId:t.id,prNumber:e.number}),className:`shrink-0`},`${e.kind}#${e.number}`)),r>0?(0,Q.jsx)(fo,{references:e,taskTitle:i,hidden:r,projectId:t.projectId}):null]})}function Hj({tag:e,className:t}){return(0,Q.jsx)(`span`,{"data-slot":`project-tag`,className:G(`inline-flex max-w-full items-center truncate rounded-full bg-muted px-1.5 py-px text-micro font-medium text-muted-foreground`,t),children:e})}function Uj({column:e,cell:t}){return(0,Q.jsx)(`td`,{"data-usage":e===`memory`?`mem`:e,"data-usage-kind":t.kind,title:t.title,className:G(Ij,`hidden text-right font-mono tabular-nums xl:table-cell`,t.kind===`live`&&`bg-violet/5 text-xs font-medium text-foreground`,t.kind===`peak`&&`text-meta text-soft-foreground`,t.kind===`none`&&`text-xs text-soft-foreground`),children:t.text||`—`})}function Wj(){return(0,Q.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`—`})}function Gj({view:e,filtered:t,origin:n=`all`,hiddenByOrigin:r=!1,onShowAll:i=()=>void 0}){return r?(0,Q.jsx)(`div`,{"data-slot":`global-tasks-empty`,"data-empty-kind":`origin-hidden`,children:(0,Q.jsx)(gl,{heading:`h2`,icon:(0,Q.jsx)(To,{}),tone:`neutral`,title:n===`regular`?`No regular tasks here`:`No automation tasks here`,subtitle:n===`regular`?`Tasks started by automations are hidden.`:`Only tasks started by automations are shown.`,actions:(0,Q.jsx)(J,{type:`button`,variant:`outline`,onClick:i,children:`Show all tasks`})})}):t?(0,Q.jsx)(gl,{heading:`h2`,icon:(0,Q.jsx)(Yo,{}),tone:`neutral`,title:`No matching tasks`,subtitle:`No task in any project matches these filters.`}):e===`archived`?(0,Q.jsx)(gl,{heading:`h2`,icon:(0,Q.jsx)(fa,{}),tone:`neutral`,title:`Nothing archived yet`,subtitle:`Finished tasks you archive land here, from every project.`}):(0,Q.jsx)(gl,{heading:`h2`,icon:(0,Q.jsx)(ru,{}),tone:`neutral`,title:`No tasks yet`,subtitle:`Start a task in any project and it shows up here.`})}var Kj=Ys(`dashboard`,()=>Sr(()=>import(`./dashboard-B_ytEQ_y.js`).then(e=>({default:e.DashboardRoute})),__vite__mapDeps([11,1,2,3,4,5,12,6,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33]))),qj=Ys(`compare`,()=>Sr(()=>import(`./compare-variants-BBOnUKfp.js`).then(e=>({default:e.CompareVariantsRoute})),__vite__mapDeps([34,1,2,3,4,5,12,6,17,35,28,36,37,38,39,40,41,26,32,33,42,43,44,45,46]))),Jj=Ys(`task-commits`,()=>Sr(()=>import(`./task-commits-sdhrDSta.js`).then(e=>e.n).then(e=>({default:e.TaskCommitsRoute})),__vite__mapDeps([47,1,2,3,4,5,12,6,8,17,48,14,49,19,20,21,22,23,24,25,18,26,50,51,52,53,54,35,55,56,39,57,58,7,59,60,40,61,62,31,32,63,64,65,66,36,67,68,69,37,38,70,41,71,33,72,73,74,9,42,75,76,77,78]))),Yj=(0,Z.lazy)(()=>Sr(()=>import(`./task-notes-ur3eZYQs.js`).then(e=>({default:e.TaskNotesRoute})),__vite__mapDeps([79,1,2,3,4,5,12,6,48,14,17,49,19,20,21,22,23,24,25,18,26,50,51,52,53,54,35,55,56,39,57,58,7,8,59,60,40,61,62,31,32,63,64,65,66,36,67,68,69,37,38,70,41,71,33,72,73,74,9,42,43,44,45,80,81,82]))),Xj=Ys(`task-workspace`,()=>Sr(()=>import(`./task-workspace-BvamqKbw.js`).then(e=>({default:e.TaskWorkspaceRoute})),__vite__mapDeps([83,1,2,3,4,5,6,12,16,17,18,8,48,14,49,19,20,21,22,23,24,25,26,50,51,52,53,54,35,55,56,39,57,58,7,59,60,40,61,62,31,32,63,64,65,66,36,67,68,69,37,38,70,41,71,33,72,73,74,9,42,84,85,28,86,43,44,45,87,88,89,90,91,92,93,94,95,96,97,98,99,82,100,77,101,46,75,76,102,47,78,80,81]))),Zj=Ys(`repo-git`,()=>Sr(()=>import(`./repo-git-DFf8ZGZv.js`).then(e=>({default:e.RepoGitRoute})),__vite__mapDeps([103,1,2,3,4,5,12,6,8,17,84,49,92,35,28,59,25,52,60,40,61,21,22,62,31,32,63,64,86,23,42,43,38,44,45,87,88,54,89,90,93,36,82,39,75,76,77,104,78,74]))),Qj=Ys(`github`,()=>Sr(()=>import(`./github-DcvXvc4J.js`).then(e=>({default:e.GithubRoute})),__vite__mapDeps([105,1,2,3,4,5,12,6,16,17,18,49,19,20,21,22,23,24,25,26,51,50,52,53,54,35,106,28,59,60,40,61,62,31,32,63,64,90,91,92,93,94,39,58,7,8,95,73,70,71,96,107,68,69,74,42,43,38,44,45,108,72,75,76,77,104]))),$j=Ys(`tracker`,()=>Sr(()=>import(`./tracker-CcyqVPEo.js`).then(e=>({default:e.TrackerRoute})),__vite__mapDeps([109,1,2,3,4,5,12,6,8,17,49,19,20,21,22,23,24,25,18,26,51,50,52,53,54,35,59,60,40,61,62,31,32,63,64,96,73,107,68,39,58,7,95,71,42,43,38,44,45,108,91,92,93,94,70,69,72,74]))),eM=Ys(`workflow-graph`,()=>Sr(()=>import(`./workflow-graph-B2oESW5u.js`).then(e=>({default:e.WorkflowGraphRoute})),__vite__mapDeps([110,1,2,3,4,5,12,6,17,50,20,30,53,61,111,21,66,90,96,93,81,94,107,67,68,23,69,18,38,82,39,40,9,42,112]))),tM=Ys(`skills`,()=>Sr(()=>import(`./skills-BmQ9hZ2c.js`).then(e=>({default:e.SkillsRoute})),__vite__mapDeps([113,1,2,3,4,5,12,6,17,49,51,50,52,25,53,54,20,59,60,40,61,21,22,62,31,32,63,64,91,92,35,93,94,18,24,39,58,7,8,95,73,70,71,23,82,42]))),nM=Ys(`manager`,()=>Sr(()=>import(`./manager-index-BGNDfiIy.js`).then(e=>({default:e.ManagerIndexRoute})),__vite__mapDeps([114,1,2,3,4,5,12,6,15,17,50,93,42,115,91,92,35,94,18,24,25,39,58,7,8,95,73,70,71,64,31,116,52]))),rM=Ys(`manager`,()=>Sr(()=>import(`./manager-new-Dek6H9Bg.js`).then(e=>({default:e.ManagerNewRoute})),__vite__mapDeps([115,1,2,3,4,5,12,6,15,91,17,92,35,93,94,18,24,25,39,58,7,8,95,73,70,71,64,31,116,52]))),iM=Ys(`manager`,()=>Sr(()=>import(`./manager-chat-C4QqN-w6.js`).then(e=>({default:e.ManagerChatRoute})),__vite__mapDeps([117,1,2,3,4,5,12,6,15,17,84,49,19,20,21,22,23,24,25,18,26,50,28,29,53,62,91,92,35,93,94,39,58,7,8,95,73,70,71,64,31,68,37,38,82,63,72,52,74,42,43,44,45,77,102,57,51,54,40,116]))),aM=Ys(`automations`,()=>Sr(()=>import(`./automations-route-JizzZrRf.js`).then(e=>({default:e.AutomationsRoute})),__vite__mapDeps([118,1,2,3,4,5,12,6,13,14,15,16,17,18,84,49,85,62,38,40,42,19,20,21,22,23,24,25,26,92,51,50,52,53,54,27,106,28,55,30,56,39,57,58,7,8,59,60,61,31,32,63,64,111,91,35,93,94,95,73,70,71,96,67,68,37,82,41,72,74])));function oM(){let e=Dr();return new URLSearchParams(e.search).get(`skill`)===`__bm`?(0,Q.jsx)(Bc,{to:{pathname:`/settings/bookmarklets`,hash:e.hash},replace:!0}):(0,Q.jsx)(Bc,{to:{pathname:`/skills`,search:e.search,hash:e.hash},replace:!0})}function sM({sectionId:e}){let t=Dr();return(0,Q.jsx)(Er,{to:{pathname:_k(`global`,e),search:t.search,hash:t.hash},replace:!0})}function cM(){return(0,Q.jsx)(`div`,{"data-route":`scope-resolving`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(`p`,{className:`px-4 py-6 text-center text-xs text-soft-foreground`,children:`Loading…`})})}function lM(){let{projectId:e=``}=Tr(),t=Dr(),n=a(),r=T();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,Q.jsx)(Er,{to:`/p/${encodeURIComponent(e)}${n||`/`}${t.search}${t.hash}`,replace:!0})}if(!n.isError)return(0,Q.jsx)(cM,{})}if(n.data){if(!(n.data.bootProject===e||n.data.projects.some(t=>t.id===e)))return(0,Q.jsx)(YC,{projectId:e,registry:n.data})}else if(!n.isError)return(0,Q.jsx)(cM,{});return(0,Q.jsxs)(Vt,{projectId:n.data?.bootProject===e?null:e,children:[(0,Q.jsx)(Lx,{projectId:e},`webhooks:${e}`),(0,Q.jsx)(Cr,{},e)]})}function uM(){let{projectId:e=``}=Tr();return(0,Q.jsx)(PC,{},e)}function dM(){let e=Dr(),t=T(),n=a(),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,Q.jsx)(cM,{});let o=r??`default`;if(e.pathname===`/`&&e.search===``&&e.hash===``){if(n.data===void 0&&!n.isError)return(0,Q.jsx)(cM,{});let e=vm(fm(),n.data,r);if(e!==null)return(0,Q.jsx)(Er,{to:e,replace:!0});let t=ym(n.data,o);if(t!==o)return(0,Q.jsx)(Er,{to:`/p/${encodeURIComponent(t)}/`,replace:!0})}let s=e.pathname===`/p`||e.pathname===`/p/`?`/`:e.pathname;return(0,Q.jsx)(Er,{to:`/p/${encodeURIComponent(o)}${s}${e.search}${e.hash}`,replace:!0})}function fM(){let e=T(),t=a(),n=Dt(),r=bt(),i=Qm({health:e.data,healthFailed:e.isError,registry:t.data,registryFailed:t.isError,providers:n.data,providersFailed:n.isError,agentCheckSkipped:r.data&&r.data.onboarding?.agentCheckSkipped===!0,uiStateFailed:r.isError});return i===`wait`?(0,Q.jsx)(cM,{}):i===`manager`?(0,Q.jsx)(Er,{to:`/manager`,replace:!0}):(0,Q.jsx)(dM,{})}function pM(){let e=Dr();return e.pathname===`/`&&e.search===``&&e.hash===``&&Xm(e.key)&&Wm()?(0,Q.jsx)(fM,{}):(0,Q.jsx)(dM,{})}function mM(){return Ym(Dr().key),null}var hM=[{pattern:`/`,pageLabel:`Tasks`},{pattern:`/tasks`,pageLabel:`All tasks`},{pattern:`/dashboard`,pageLabel:`Dashboard`},{pattern:`/manager/*`,pageLabel:`Manager`},{pattern:`/new`,pageLabel:`New task`},{pattern:`/compare/:groupId`,pageLabel:`Compare`},{pattern:`/git/*`,pageLabel:`Git`},{pattern:`/github/*`,pageLabel:`GitHub`},{pattern:`/tracker/*`,pageLabel:`Tracker`},{pattern:`/assets`,pageLabel:`Assets`},{pattern:`/automations/*`,pageLabel:`Automations`},{pattern:`/skills`,pageLabel:`Skills`},{pattern:`/inbox`,pageLabel:`Inbox`},{pattern:`/workflows/*`,pageLabel:`Workflows`},{pattern:`/settings/*`,pageLabel:`Settings`}];function gM(e){let t=zc(e),n=wr({path:`/tasks/:id/*`,end:!0},t);return n?{pageLabel:null,taskId:n.params.id??null}:{pageLabel:hM.find(({pattern:e})=>wr({path:e,end:!0},t))?.pageLabel??null,taskId:null}}function _M({children:e}){let t=T();return t.data&&t.data.capabilities.managers!==!0?(0,Q.jsx)(Er,{to:`/`,replace:!0}):(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(`div`,{role:`status`,className:`p-6 text-sm text-muted-foreground`,children:`Loading…`}),children:e})}var vM=(0,Z.memo)(function(){let e=T().data?.capabilities;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(mM,{}),(0,Q.jsxs)(jr,{children:[(0,Q.jsxs)(K,{path:`/p/:projectId`,element:(0,Q.jsx)(lM,{}),children:[(0,Q.jsx)(K,{index:!0,element:(0,Q.jsx)(WA,{})}),(0,Q.jsx)(K,{path:`new`,element:(0,Q.jsx)(uM,{})}),(0,Q.jsx)(K,{path:`tasks/:id`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(Sa,{}),children:(0,Q.jsx)(Xj,{})})}),(0,Q.jsx)(K,{path:`tasks/:id/chat`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(Sa,{}),children:(0,Q.jsx)(Xj,{view:`session`})})}),(0,Q.jsx)(K,{path:`tasks/:id/changes`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(oa,{tab:`changes`}),children:(0,Q.jsx)(Xj,{view:`changes`})})}),(0,Q.jsx)(K,{path:`tasks/:id/files`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(oa,{tab:`files`}),children:(0,Q.jsx)(Xj,{view:`files`})})}),(0,Q.jsx)(K,{path:`tasks/:id/graph`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(oa,{tab:`changes`}),children:(0,Q.jsx)(Xj,{view:`graph`})})}),(0,Q.jsx)(K,{path:`tasks/:id/commits`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(oa,{tab:`changes`}),children:(0,Q.jsx)(Xj,{view:`commits`})})}),(0,Q.jsx)(K,{path:`tasks/:id/notes`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(oa,{tab:`notes`}),children:(0,Q.jsx)(Yj,{})})}),(0,Q.jsx)(K,{path:`tasks/:id/preview`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(oa,{tab:`preview`}),children:(0,Q.jsx)(Xj,{view:`browser`})})}),(0,Q.jsx)(K,{path:`tasks/:id/assets`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(oa,{tab:`preview`}),children:(0,Q.jsx)(Xj,{view:`assets`})})}),(0,Q.jsx)(K,{path:`tasks/:id/assets/:name`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(oa,{tab:`preview`}),children:(0,Q.jsx)(Xj,{view:`assets`})})}),(0,Q.jsx)(K,{path:`tasks/:id/terminal`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(oa,{tab:`terminal`}),children:(0,Q.jsx)(Xj,{view:`terminal`})})}),(0,Q.jsx)(K,{path:`tasks/:id/commits/:sha`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(oa,{tab:`changes`}),children:(0,Q.jsx)(Jj,{})})}),(0,Q.jsx)(K,{path:`compare/:groupId`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(Bx,{}),children:(0,Q.jsx)(qj,{})})}),(0,Q.jsx)(K,{path:`git`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(qC,{}),children:(0,Q.jsx)(Zj,{tab:`changes`})})}),(0,Q.jsx)(K,{path:`git/commits`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(qC,{}),children:(0,Q.jsx)(Zj,{tab:`commits`})})}),(0,Q.jsx)(K,{path:`git/commits/:sha`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(qC,{}),children:(0,Q.jsx)(Zj,{tab:`commits`})})}),(0,Q.jsx)(K,{path:`git/branches`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(qC,{}),children:(0,Q.jsx)(Zj,{tab:`branches`})})}),(0,Q.jsx)(K,{path:`git/files`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(qC,{}),children:(0,Q.jsx)(Zj,{tab:`files`})})}),(0,Q.jsx)(K,{path:`git/files/*`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(qC,{}),children:(0,Q.jsx)(Zj,{tab:`files`})})}),(0,Q.jsx)(K,{path:`github`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(Vx,{}),children:(0,Q.jsx)(Qj,{view:`issues`,index:!0})})}),(0,Q.jsx)(K,{path:`tracker`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(cM,{}),children:(0,Q.jsx)($j,{})})}),(0,Q.jsx)(K,{path:`tracker/:id`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(cM,{}),children:(0,Q.jsx)($j,{})})}),(0,Q.jsx)(K,{path:`github/prs`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(Vx,{}),children:(0,Q.jsx)(Qj,{view:`prs`})})}),(0,Q.jsx)(K,{path:`github/issues/:n`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(Vx,{}),children:(0,Q.jsx)(Qj,{view:`issues`})})}),(0,Q.jsx)(K,{path:`github/prs/:n`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(Vx,{}),children:(0,Q.jsx)(Qj,{view:`prs`})})}),(0,Q.jsx)(K,{path:`github/prs/:n/changes`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(Vx,{}),children:(0,Q.jsx)(Qj,{view:`prs`,changes:!0})})}),(0,Q.jsx)(K,{path:`automations`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(zx,{}),children:(0,Q.jsx)(aM,{})})}),(0,Q.jsx)(K,{path:`automations/new`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(zx,{}),children:(0,Q.jsx)(aM,{mode:`new`})})}),(0,Q.jsx)(K,{path:`automations/:automationId`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(zx,{}),children:(0,Q.jsx)(aM,{mode:`edit`})})}),(0,Q.jsx)(K,{path:`automations/:automationId/log`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(zx,{}),children:(0,Q.jsx)(aM,{mode:`log`})})}),(0,Q.jsx)(K,{path:`skills`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(JC,{}),children:(0,Q.jsx)(tM,{})})}),(0,Q.jsx)(K,{path:`inbox`,element:(0,Q.jsx)(xS,{})}),(0,Q.jsx)(K,{path:`assets`,element:(0,Q.jsx)(qx,{})}),(0,Q.jsx)(K,{path:`workflows`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(XC,{}),children:(0,Q.jsx)(eM,{})})}),(0,Q.jsx)(K,{path:`workflows/:name`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(XC,{}),children:(0,Q.jsx)(eM,{})})}),(0,Q.jsx)(K,{path:`workflows-new/*`,element:(0,Q.jsx)(Bc,{to:`/workflows`,replace:!0})}),(0,Q.jsx)(K,{path:`settings`,element:(0,Q.jsx)(Vk,{scope:`project`,capabilities:e})}),(0,Q.jsx)(K,{path:`settings/skills`,element:(0,Q.jsx)(oM,{})}),(0,Q.jsx)(K,{path:`settings/prompt-templates`,element:(0,Q.jsx)(Bc,{to:{pathname:`/settings/instructions`,hash:`#prompt-templates`},replace:!0})}),nk(`project`,e).map(t=>(0,Q.jsx)(K,{path:`settings/${t.id}`,element:(0,Q.jsx)(Rk,{section:t,scope:`project`,capabilities:e})},t.id)),nk(`global`,e).map(e=>(0,Q.jsx)(K,{path:`settings/${e.id}`,element:(0,Q.jsx)(sM,{sectionId:e.id})},e.id)),(0,Q.jsx)(K,{path:`*`,element:(0,Q.jsx)(KC,{})})]}),(0,Q.jsx)(K,{path:`/tasks`,element:(0,Q.jsx)(Aj,{})}),(0,Q.jsx)(K,{path:`/dashboard`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(`div`,{role:`status`,className:`p-6 text-sm text-muted-foreground`,children:`Loading dashboard…`}),children:(0,Q.jsx)(Kj,{})})}),(0,Q.jsx)(K,{path:`/manager`,element:(0,Q.jsx)(_M,{children:(0,Q.jsx)(nM,{})})}),(0,Q.jsx)(K,{path:`/manager/new`,element:(0,Q.jsx)(_M,{children:(0,Q.jsx)(rM,{})})}),(0,Q.jsx)(K,{path:`/manager/:id`,element:(0,Q.jsx)(_M,{children:(0,Q.jsx)(iM,{})})}),(0,Q.jsx)(K,{path:`/settings/global`,element:(0,Q.jsx)(Vk,{scope:`global`,capabilities:e})}),nk(`global`,e).map(t=>(0,Q.jsx)(K,{path:_k(`global`,t.id),element:(0,Q.jsx)(Rk,{section:t,scope:`global`,capabilities:e})},t.id)),(0,Q.jsx)(K,{path:`*`,element:(0,Q.jsx)(pM,{})})]})]})});function yM(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 bM(e){return e?.available===!0&&(e.status===`available`||e.status===`error`)}var xM=(0,Z.memo)(function({children:e}){let{pathname:t}=Dr(),n=Vc(),r=T(),i=qt(),o=i.data?.branding,s=o!==void 0&&(o.name!==`cezar`||o.logoUrl!==null),c=ie(!s&&i.data!==void 0),l=r.data?.capabilities.followups===!0,u=r.data?.capabilities.automations===!0,d=Ce(l),f=r.data?.capabilities.managers===!0,p=zr(f),m=bM(vn(n??``,n!==null).data),h=_x(zc(t)),g=a().data,_=(0,Z.useMemo)(()=>Py(g,n,r.data),[g,n,r.data]),v=gM(t),y=_?.bootProject??r.data?.bootProject??null,b=R(n,y,(0,Z.useMemo)(()=>Ha,[])),x=n!==null&&n===y,S=_?.projects.find(e=>e.id===n),C=_?.projects.find(e=>e.id===y),w=n===null?C?.tracker:S?.tracker,E=v.taskId,D=$e(n??``,S!==void 0&&E!==null,_?.bootProject===n,(0,Z.useMemo)(()=>e=>{let t=E?e.find(e=>e.id===E):void 0;return t?Ge(t):void 0},[E])).data,O=t===`/settings/global`||t.startsWith(`/settings/global/`),k=O?null:S?.name??(x?yM(r.data)?.name??null:null);Ny({projectName:k,pageLabel:D??v.pageLabel,brandName:i.data?.branding.name,brandLogoUrl:i.data?.branding.logoUrl});let A=_&&_.projects.length>1?_:null,j=(0,Z.useMemo)(()=>yM(r.data),[r.data?.repo?.root,r.data?.repo?.branch]),ee=(0,Z.useMemo)(()=>O?null:{activeId:n??y,activeName:k,projects:(_?.projects??[]).map(({id:e,name:t})=>({id:e,name:t}))},[O,n,y,k,_?.projects]),M=(0,Z.useMemo)(()=>(0,Q.jsx)(N_,{}),[]),N=(0,Z.useMemo)(()=>(0,Q.jsx)(V_,{}),[]),te=(0,Z.useMemo)(()=>(0,Q.jsx)(Bv,{}),[]),ne=(0,Z.useMemo)(()=>(0,Q.jsx)(O_,{}),[]),P=(0,Z.useMemo)(()=>(0,Q.jsx)(yx,{}),[]),F=(0,Z.useMemo)(()=>(0,Q.jsx)(Ay,{}),[]),re=(0,Z.useMemo)(()=>(0,Q.jsx)(ky,{}),[]),I=(0,Z.useMemo)(()=>A?(0,Q.jsx)(ry,{projects:A.projects,bootProjectId:A.bootProject,inboxAvailable:l,automationsAvailable:u,inboxCount:d.data?.length??null,skillsUpdateAvailable:m,newNavItems:h}):void 0,[A,l,u,d.data?.length,m,h]),L=So(),ae=(0,Z.useMemo)(()=>(0,Q.jsx)(py,{health:r.data,forge:L}),[r.data,L]);return(0,Q.jsxs)(C_,{children:[(0,Q.jsx)(Ng,{repo:j,brandName:i.data?.branding.name??`cezar`,brandLogoUrl:i.data?.branding.logoUrl??null,version:r.data?.version??null,latestVersion:r.data?.latestVersion??null,starCount:!s&&c.data?.available?c.data.count??null:null,inboxCount:d.data?.length??null,unreadCount:b.data??null,skillsUpdateAvailable:m,newNavItems:h,forgeAvailable:L!=null,inboxAvailable:l,automationsAvailable:u,tracker:w,banner:M,whatsNew:P,footerBanner:N,singleProject:r.data?.capabilities.singleProject===!0,taskQuickList:te,hostWidget:ne,projectGroups:I,toolsMenu:ae,managersAvailable:f,managerAttention:Rr(p.data?.managers),managerSidebar:F,managerRail:re,projectSwitcher:ee,children:e}),(0,Q.jsx)(om,{}),(0,Q.jsx)(i_,{}),(0,Q.jsx)(Nx,{})]})});function SM(){let e=Dr(),t=a();return(0,Z.useEffect)(()=>{ak(e)},[e]),(0,Z.useEffect)(()=>{let n=_m(e,t.data);n!==null&&(bm(fm(),n)||pm(n))},[e.hash,e.pathname,e.search,t.data]),null}function CM(){let e=W(),t=Vr(bt().data?.notifications).enabled,n=(0,Z.useRef)(t);n.current=t;let r=(0,Z.useRef)(!1);r.current=T().data?.capabilities.managerSystemNotifications===!0;let i=(0,Z.useRef)(new Map),a=(0,Z.useRef)(null);return(0,Z.useEffect)(()=>{let t=Pt(H.runs.list()),o=Pt(Lr.list),s=e=>{if(!e)return;let{entering:t,counts:n}=Wr(a.current,e.managers);if(a.current=n,!(t.length===0||r.current||!c()))for(let e of t)wM(oi(e))},c=()=>si({enabled:n.current,hidden:document.visibilityState===`hidden`,permission:Br()}),l=e=>{let{entering:t,statuses:n}=ci(i.current,e);if(i.current=n,!(t.length===0||!c()))for(let e of t)wM(li(e))};return l(e.getQueryData(H.runs.list())),s(e.getQueryData(Lr.list)),e.getQueryCache().subscribe(e=>{e.type===`updated`&&(e.query.queryHash===t?l(e.query.state.data):e.query.queryHash===o&&s(e.query.state.data))})},[e]),null}function wM(e){let t=globalThis.Notification;if(typeof t==`function`)try{new t(e.title,{body:e.body,tag:e.tag})}catch{}}function TM(e,t=!0){return gt({queryKey:[...V.dashboard,`insights`,e],enabled:t,staleTime:5e3,refetchInterval:t?15e3:!1,refetchIntervalInBackground:!1,retry:!1,queryFn:async({signal:t})=>rr.parse(await we(await Pe.api.v1.workspace.dashboard.insights.$get({query:{period:e,tzOffsetMinutes:String(new Date().getTimezoneOffset())}},{init:{signal:t}}),`/workspace/dashboard/insights`))})}var EM=[`pointerdown`,`pointermove`,`keydown`,`wheel`,`touchstart`];function DM(){let e=document.activeElement;return e?e.isContentEditable||e.tagName===`TEXTAREA`||e.tagName===`INPUT`&&e.type!==`checkbox`:!1}var OM=()=>document.querySelector(`[role="dialog"],[role="alertdialog"]`)!==null;function kM(){let e=W(),t=qt(),n=t.data?.branding,r=n!==void 0&&(n.name!==`cezar`||n.logoUrl!==null),i=ie(t.data!==void 0&&!r),a=!r&&i.data?.available===!0,o=!r&&i.data?.available?i.data.count??null:null,[s,c]=(0,Z.useState)(!1),l=(0,Z.useRef)(a);l.current=a;let u=(0,Z.useRef)(new Map),d=(0,Z.useRef)(null),f=(0,Z.useRef)(0);return(0,Z.useEffect)(()=>{let t=Pt(H.runs.list()),n,r=()=>lh({now:Date.now(),visible:document.visibilityState===`visible`,focused:document.hasFocus(),lastInteractionAt:f.current,typing:DM(),dialogOpen:OM()}),i=()=>{let e=d.current;if(!(e===null||n)){if(Date.now()-e>18e5){d.current=null;return}r()&&(n=setTimeout(()=>{n=void 0;let e=ah();if(!(d.current===null||!r()||!l.current)){if(!sh(e,Date.now())){d.current=null;return}d.current=null,oh({...e,asks:e.asks+1,lastAskedAt:new Date().toISOString()}),c(!0)}},ih))}},a=e=>{let{succeeded:t,statuses:n}=fh(u.current,e);u.current=n,!(!t||!l.current)&&(ch(e)<3||sh(ah(),Date.now())&&(d.current=Date.now(),i()))},o=()=>{f.current=Date.now(),i()};for(let e of EM)window.addEventListener(e,o,{passive:!0});document.addEventListener(`visibilitychange`,i),window.addEventListener(`focus`,i),a(e.getQueryData(H.runs.list()));let s=e.getQueryCache().subscribe(e=>{e.query.queryHash!==t||e.type!==`updated`||a(e.query.state.data)});return()=>{s(),clearTimeout(n);for(let e of EM)window.removeEventListener(e,o);document.removeEventListener(`visibilitychange`,i),window.removeEventListener(`focus`,i)}},[e]),r?null:(0,Q.jsx)(jM,{open:s,onOpenChange:c,count:o})}function AM(e){let t=ah();t&&oh({...t,outcome:e})}function jM({open:e,onOpenChange:t,count:n}){let r=TM(`30d`,e).data?.delivered,i=r&&r.completedTasks>0?[{label:`Tasks done`,n:r.completedTasks,value:r.completedTasks.toLocaleString(`en-US`)},{label:`PRs opened`,n:r.prsOpened,value:r.prsOpened.toLocaleString(`en-US`)},{label:`Lines written`,n:r.additions,value:`+${r.additions.toLocaleString(`en-US`)}`}].filter(e=>e.n>0):null;return(0,Q.jsx)(ws,{open:e,onOpenChange:t,children:(0,Q.jsxs)(Ss,{"data-slot":`star-ask`,className:`gap-0 overflow-hidden p-0 sm:max-w-[440px]`,children:[(0,Q.jsxs)(`div`,{className:`relative flex h-36 items-center justify-center overflow-hidden border-b bg-card-2`,children:[(0,Q.jsx)(`div`,{"aria-hidden":`true`,className:`absolute inset-0 bg-[radial-gradient(circle_at_22%_35%,color-mix(in_oklab,var(--accent-lime)_32%,transparent),transparent_55%),radial-gradient(circle_at_80%_70%,color-mix(in_oklab,var(--violet)_38%,transparent),transparent_55%)]`}),(0,Q.jsxs)(`div`,{"aria-hidden":`true`,className:`relative flex items-center gap-4`,children:[(0,Q.jsx)(gh,{height:52,className:`text-foreground`}),(0,Q.jsx)(`span`,{className:`flex size-12 items-center justify-center rounded-full border bg-card shadow-md`,children:(0,Q.jsx)(wu,{className:`size-6 fill-current text-pending-strong`})})]}),n!==null&&(0,Q.jsxs)(`span`,{className:`absolute bottom-3 left-1/2 -translate-x-1/2 rounded-full border bg-card/80 px-2.5 py-0.5 font-mono text-meta text-muted-foreground backdrop-blur`,children:[`⭐ `,nh(n),` stars on GitHub`]})]}),(0,Q.jsxs)(`div`,{className:`space-y-4 p-6`,children:[(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(`span`,{className:`section-mark block eyebrow text-muted-foreground`,children:`Open source · MIT`}),(0,Q.jsx)(ys,{className:`text-xl font-semibold tracking-tight`,children:`Is cezar pulling its weight?`}),(0,Q.jsx)(xs,{className:`text-sm leading-relaxed text-muted-foreground`,children:`cezar is free, open source and runs on your machine, with no account to create. A GitHub star is how other developers find it, and how we know what to keep building.`})]}),i&&(0,Q.jsxs)(`div`,{className:`rounded-lg border bg-card-2 p-3`,children:[(0,Q.jsx)(`span`,{className:`block eyebrow text-soft-foreground`,children:`Your last 30 days with cezar`}),(0,Q.jsx)(`dl`,{className:`mt-2 grid gap-2`,style:{gridTemplateColumns:`repeat(${i.length}, minmax(0, 1fr))`},children:i.map(e=>(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col-reverse`,children:[(0,Q.jsx)(`dt`,{className:`text-xs text-soft-foreground`,children:e.label}),(0,Q.jsx)(`dd`,{className:`truncate text-lg font-semibold tabular-nums`,children:e.value})]},e.label))})]}),(0,Q.jsx)(J,{asChild:!0,className:`h-11 w-full text-sm font-semibold`,children:(0,Q.jsxs)(`a`,{href:eh,target:`_blank`,rel:`noopener noreferrer`,onClick:()=>{AM(`starred`),t(!1)},children:[(0,Q.jsx)(wu,{className:`size-4 fill-current`,"aria-hidden":`true`}),`Star cezar on GitHub`,(0,Q.jsx)(ka,{className:`size-4`,"aria-hidden":`true`})]})}),(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsx)(J,{variant:`ghost`,className:`min-h-11`,onClick:()=>t(!1),children:`Maybe later`}),(0,Q.jsx)(J,{variant:`ghost`,className:`min-h-11 text-soft-foreground`,onClick:()=>{AM(`never`),t(!1)},children:`Don’t ask again`})]})]})]})})}function MM(){let[e]=(0,Z.useState)(Dl);return(0,Q.jsx)(Jt,{client:e,children:(0,Q.jsx)(Yr,{children:(0,Q.jsxs)(Ei,{children:[(0,Q.jsx)(CM,{}),(0,Q.jsx)(kM,{}),(0,Q.jsx)(ap,{children:(0,Q.jsx)(rT,{children:(0,Q.jsxs)(Mr,{children:[(0,Q.jsx)(SM,{}),(0,Q.jsx)(Qs,{}),(0,Q.jsx)(Ea,{children:(0,Q.jsx)(xM,{children:(0,Q.jsx)(vM,{})})}),(0,Q.jsx)(Js,{})]})})})]})})})}function NM(){return(document.querySelector(`meta[name="cez-api-base"]`)?.getAttribute(`content`))?.trim()||``}vr(NM());var PM=document.getElementById(`root`);if(!PM)throw Error(`cezar: #root container is missing from index.html`);(0,El.createRoot)(PM).render((0,Q.jsx)(Z.StrictMode,{children:(0,Q.jsx)(MM,{})}));export{Oh as $,fb as A,Ty as B,bb as C,Sb as D,Cb as E,sb as F,tv as G,vy as H,cb as I,G_ as J,$_ as K,ob as L,ab as M,ib as N,yb as O,Qy as P,Th as Q,lb as R,Bx as S,wb as T,Q_ as U,wy as V,nv as W,W_ as X,Z_ as Y,wg as Z,oS as _,hu as _t,_k as a,jf as at,iS as b,Ll as bt,cC as c,ku as ct,iC as d,Cu as dt,kh as et,_S as f,Su as ft,cS as g,gu as gt,dS as h,_u as ht,Jk as i,Hf as it,vb as j,pb as k,aC as l,Ou as lt,hS as m,yu as mt,$k as n,Eh as nt,XC as o,Of as ot,gS as p,bu as pt,ev as q,Zk as r,op as rt,qC as s,yf as st,TM as t,Dh as tt,sC as u,Eu as ut,rS as v,mu as vt,xb as w,Vx as x,Nl as xt,sS as y,Vl as yt,$y as z};
|