agent-log-viewer 1.0.2 → 1.0.3
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 +18 -0
- package/dist/mcp-server.mjs +2458 -392
- package/dist/runtime-host.mjs +1613 -244
- package/dist/standalone/.next/BUILD_ID +1 -1
- package/dist/standalone/.next/app-path-routes-manifest.json +28 -25
- package/dist/standalone/.next/build-manifest.json +2 -2
- package/dist/standalone/.next/prerender-manifest.json +3 -3
- package/dist/standalone/.next/routes-manifest.json +18 -0
- package/dist/standalone/.next/server/account-migration-controller-worker.js +1 -1
- package/dist/standalone/.next/server/app/_global-error/page.js +3 -3
- package/dist/standalone/.next/server/app/_global-error/page.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/dist/standalone/.next/server/app/_global-error.html +1 -1
- package/dist/standalone/.next/server/app/_global-error.rsc +1 -1
- package/dist/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/_not-found/page.js +2 -2
- package/dist/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/dist/standalone/.next/server/app/_not-found.html +1 -1
- package/dist/standalone/.next/server/app/_not-found.rsc +2 -2
- package/dist/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- package/dist/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
- package/dist/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/dist/standalone/.next/server/app/api/access/route.js +1 -1
- package/dist/standalone/.next/server/app/api/access/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/account-migrations/[intentId]/route.js +1 -1
- package/dist/standalone/.next/server/app/api/account-migrations/[intentId]/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/accounts/claude/[id]/status/route.js +1 -1
- package/dist/standalone/.next/server/app/api/accounts/claude/[id]/status/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/accounts/claude/active/route.js +1 -1
- package/dist/standalone/.next/server/app/api/accounts/claude/active/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/accounts/claude/login/[operationId]/input/route.js +1 -1
- package/dist/standalone/.next/server/app/api/accounts/claude/login/[operationId]/input/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/accounts/claude/login/[operationId]/route.js +1 -1
- package/dist/standalone/.next/server/app/api/accounts/claude/login/[operationId]/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/accounts/claude/policy/route.js +1 -1
- package/dist/standalone/.next/server/app/api/accounts/claude/policy/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/accounts/claude/route.js +1 -1
- package/dist/standalone/.next/server/app/api/accounts/claude/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/accounts/claude/terminal/route.js +1 -1
- package/dist/standalone/.next/server/app/api/accounts/claude/terminal/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/accounts/codex/active/route.js +1 -1
- package/dist/standalone/.next/server/app/api/accounts/codex/active/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/accounts/codex/policy/route.js +1 -1
- package/dist/standalone/.next/server/app/api/accounts/codex/policy/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/accounts/codex/route.js +1 -1
- package/dist/standalone/.next/server/app/api/accounts/codex/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/accounts/codex/terminal/route.js +1 -1
- package/dist/standalone/.next/server/app/api/accounts/codex/terminal/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/accounts/route.js +1 -1
- package/dist/standalone/.next/server/app/api/accounts/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/agent/route.js +1 -1
- package/dist/standalone/.next/server/app/api/agent/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/agent/snapshot/route.js +1 -1
- package/dist/standalone/.next/server/app/api/agent/snapshot/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/answer/route.js +2 -1
- package/dist/standalone/.next/server/app/api/answer/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/artifact/route.js +1 -1
- package/dist/standalone/.next/server/app/api/artifact/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/attach-command/route.js +1 -1
- package/dist/standalone/.next/server/app/api/attach-command/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/attention/[id]/route.js +1 -1
- package/dist/standalone/.next/server/app/api/attention/[id]/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/attention/route.js +1 -1
- package/dist/standalone/.next/server/app/api/attention/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/board/route.js +1 -1
- package/dist/standalone/.next/server/app/api/board/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/bridge/route.js +2 -2
- package/dist/standalone/.next/server/app/api/bridge/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/conversations/[conversationId]/migration/route.js +1 -1
- package/dist/standalone/.next/server/app/api/conversations/[conversationId]/migration/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/conversations/route.js +1 -1
- package/dist/standalone/.next/server/app/api/conversations/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/files/route.js +2 -2
- package/dist/standalone/.next/server/app/api/files/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/flows/[id]/route.js +1 -1
- package/dist/standalone/.next/server/app/api/flows/[id]/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/flows/route.js +1 -1
- package/dist/standalone/.next/server/app/api/flows/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/image/route.js +1 -1
- package/dist/standalone/.next/server/app/api/image/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/inbox/route.js +2 -2
- package/dist/standalone/.next/server/app/api/inbox/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/lifecycle/reaper/route.js +1 -1
- package/dist/standalone/.next/server/app/api/lifecycle/reaper/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/limits/history/route.js +1 -1
- package/dist/standalone/.next/server/app/api/limits/history/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/limits/route.js +1 -1
- package/dist/standalone/.next/server/app/api/limits/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/log/preflight/route.js +1 -1
- package/dist/standalone/.next/server/app/api/log/preflight/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/log/project-delete/route.js +1 -1
- package/dist/standalone/.next/server/app/api/log/project-delete/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/log/provenance/route.js +67 -1
- package/dist/standalone/.next/server/app/api/log/provenance/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/log/route.js +1 -1
- package/dist/standalone/.next/server/app/api/log/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/log/suggestions/route.js +3 -0
- package/dist/standalone/.next/server/app/api/log/suggestions/route.js.nft.json +1 -0
- package/dist/standalone/.next/server/app/api/log/suggestions/route_client-reference-manifest.js +1 -0
- package/dist/standalone/.next/server/app/api/logs/route.js +1 -1
- package/dist/standalone/.next/server/app/api/logs/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/logs/stream/route.js +2 -2
- package/dist/standalone/.next/server/app/api/logs/stream/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/monitor/lock/route.js +1 -3
- package/dist/standalone/.next/server/app/api/monitor/lock/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/monitor/runs/route.js +1 -3
- package/dist/standalone/.next/server/app/api/monitor/runs/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/orchestrator/rotate/route.js +1 -1
- package/dist/standalone/.next/server/app/api/orchestrator/rotate/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/orchestrator/seat/route.js +1 -1
- package/dist/standalone/.next/server/app/api/orchestrator/seat/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/orchestrator/seat/status/route.js +2 -2
- package/dist/standalone/.next/server/app/api/orchestrator/seat/status/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/pipelines/[id]/route.js +1 -1
- package/dist/standalone/.next/server/app/api/pipelines/[id]/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/pipelines/preflight/route.js +1 -1
- package/dist/standalone/.next/server/app/api/pipelines/preflight/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/pipelines/route.js +2 -2
- package/dist/standalone/.next/server/app/api/pipelines/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/pipelines/tick/route.js +2 -2
- package/dist/standalone/.next/server/app/api/pipelines/tick/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/proc/route.js +1 -1
- package/dist/standalone/.next/server/app/api/proc/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/projects/create/route.js +2 -2
- package/dist/standalone/.next/server/app/api/projects/create/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/projects/crown/route.js +1 -1
- package/dist/standalone/.next/server/app/api/projects/crown/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/projects/directories/route.js +1 -0
- package/dist/standalone/.next/server/app/api/projects/directories/route.js.nft.json +1 -0
- package/dist/standalone/.next/server/app/api/projects/directories/route_client-reference-manifest.js +1 -0
- package/dist/standalone/.next/server/app/api/push/route.js +2 -2
- package/dist/standalone/.next/server/app/api/push/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/resources/route.js +1 -1
- package/dist/standalone/.next/server/app/api/resources/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/roles/route.js +2 -2
- package/dist/standalone/.next/server/app/api/roles/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/runtime/answer/route.js +2 -1
- package/dist/standalone/.next/server/app/api/runtime/answer/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/runtime/deployments/[deploymentId]/route.js +1 -1
- package/dist/standalone/.next/server/app/api/runtime/deployments/[deploymentId]/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/runtime/deployments/capabilities/v1/route.js +1 -1
- package/dist/standalone/.next/server/app/api/runtime/deployments/capabilities/v1/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/runtime/deployments/route.js +1 -1
- package/dist/standalone/.next/server/app/api/runtime/deployments/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/runtime/hosts/route.js +1 -0
- package/dist/standalone/.next/server/app/api/runtime/hosts/route.js.nft.json +1 -0
- package/dist/standalone/.next/server/app/api/runtime/hosts/route_client-reference-manifest.js +1 -0
- package/dist/standalone/.next/server/app/api/runtime/interrupt/route.js +2 -1
- package/dist/standalone/.next/server/app/api/runtime/interrupt/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/runtime/operations/[operationId]/route.js +2 -1
- package/dist/standalone/.next/server/app/api/runtime/operations/[operationId]/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/runtime/operations/route.js +1 -1
- package/dist/standalone/.next/server/app/api/runtime/operations/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/runtime/realtime/route.js +2 -1
- package/dist/standalone/.next/server/app/api/runtime/realtime/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/runtime/send/route.js +2 -1
- package/dist/standalone/.next/server/app/api/runtime/send/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/runtime/snapshot/route.js +1 -1
- package/dist/standalone/.next/server/app/api/runtime/snapshot/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/runtime/spawn/route.js +2 -1
- package/dist/standalone/.next/server/app/api/runtime/spawn/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/runtime/steer/route.js +2 -1
- package/dist/standalone/.next/server/app/api/runtime/steer/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/runtime/stream/route.js +2 -2
- package/dist/standalone/.next/server/app/api/runtime/stream/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/search/transcripts/route.js +2 -2
- package/dist/standalone/.next/server/app/api/search/transcripts/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/session/route.js +1 -1
- package/dist/standalone/.next/server/app/api/session/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/session/supersedence/route.js +1 -1
- package/dist/standalone/.next/server/app/api/session/supersedence/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/session/title/route.js +1 -1
- package/dist/standalone/.next/server/app/api/session/title/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/spawn/policy/route.js +3 -3
- package/dist/standalone/.next/server/app/api/spawn/policy/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/spawn/route.js +2 -2
- package/dist/standalone/.next/server/app/api/spawn/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/staging/route.js +2 -2
- package/dist/standalone/.next/server/app/api/staging/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/task-attachments/route.js +2 -2
- package/dist/standalone/.next/server/app/api/task-attachments/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/tasks/[id]/assignment/route.js +1 -1
- package/dist/standalone/.next/server/app/api/tasks/[id]/assignment/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/tasks/[id]/route.js +1 -1
- package/dist/standalone/.next/server/app/api/tasks/[id]/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/tasks/[id]/send/route.js +2 -1
- package/dist/standalone/.next/server/app/api/tasks/[id]/send/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/tasks/[id]/spawn/route.js +2 -1
- package/dist/standalone/.next/server/app/api/tasks/[id]/spawn/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/tasks/curator/route.js +1 -1
- package/dist/standalone/.next/server/app/api/tasks/curator/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/tasks/route.js +2 -2
- package/dist/standalone/.next/server/app/api/tasks/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/telegram/reports/route.js +1 -1
- package/dist/standalone/.next/server/app/api/telegram/reports/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/telegram/route.js +1 -1
- package/dist/standalone/.next/server/app/api/telegram/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/timeline/route.js +1 -1
- package/dist/standalone/.next/server/app/api/timeline/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/tmux/route.js +2 -1
- package/dist/standalone/.next/server/app/api/tmux/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/tmux/targets/route.js +1 -1
- package/dist/standalone/.next/server/app/api/tmux/targets/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/transcribe/backend/route.js +2 -2
- package/dist/standalone/.next/server/app/api/transcribe/backend/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/transcribe/route.js +2 -2
- package/dist/standalone/.next/server/app/api/transcribe/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/transcribe/token/route.js +2 -2
- package/dist/standalone/.next/server/app/api/transcribe/token/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/tts/backend/route.js +1 -1
- package/dist/standalone/.next/server/app/api/tts/backend/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/tts/route.js +1 -1
- package/dist/standalone/.next/server/app/api/tts/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/view/presence/route.js +1 -1
- package/dist/standalone/.next/server/app/api/view/presence/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/workflows/[id]/route.js +1 -1
- package/dist/standalone/.next/server/app/api/workflows/[id]/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/workflows/route.js +1 -1
- package/dist/standalone/.next/server/app/api/workflows/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/favicon.ico/route.js +1 -1
- package/dist/standalone/.next/server/app/favicon.ico/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/index.html +1 -1
- package/dist/standalone/.next/server/app/index.rsc +3 -3
- package/dist/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/dist/standalone/.next/server/app/index.segments/_full.segment.rsc +3 -3
- package/dist/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/index.segments/_index.segment.rsc +2 -2
- package/dist/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/dist/standalone/.next/server/app/page.js +17 -13
- package/dist/standalone/.next/server/app/page.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/dist/standalone/.next/server/app-paths-manifest.json +28 -25
- package/dist/standalone/.next/server/chunks/107.js +1 -0
- package/dist/standalone/.next/server/chunks/{1858.js → 1100.js} +2 -2
- package/dist/standalone/.next/server/chunks/1872.js +42 -0
- package/dist/standalone/.next/server/chunks/1952.js +3 -0
- package/dist/standalone/.next/server/chunks/2243.js +1 -0
- package/dist/standalone/.next/server/chunks/2260.js +104 -0
- package/dist/standalone/.next/server/chunks/2318.js +2 -2
- package/dist/standalone/.next/server/chunks/2324.js +1 -1
- package/dist/standalone/.next/server/chunks/2549.js +81 -0
- package/dist/standalone/.next/server/chunks/2682.js +85 -0
- package/dist/standalone/.next/server/chunks/3086.js +1 -1
- package/dist/standalone/.next/server/chunks/3214.js +1 -1
- package/dist/standalone/.next/server/chunks/3302.js +2 -0
- package/dist/standalone/.next/server/chunks/3336.js +1 -1
- package/dist/standalone/.next/server/chunks/3386.js +2 -0
- package/dist/standalone/.next/server/chunks/3558.js +1 -1
- package/dist/standalone/.next/server/chunks/3587.js +1 -1
- package/dist/standalone/.next/server/chunks/3740.js +20 -20
- package/dist/standalone/.next/server/chunks/3830.js +1 -0
- package/dist/standalone/.next/server/chunks/4191.js +1 -1
- package/dist/standalone/.next/server/chunks/4310.js +1 -0
- package/dist/standalone/.next/server/chunks/4509.js +1 -1
- package/dist/standalone/.next/server/chunks/4565.js +1 -0
- package/dist/standalone/.next/server/chunks/4651.js +2 -0
- package/dist/standalone/.next/server/chunks/4756.js +13 -0
- package/dist/standalone/.next/server/chunks/4972.js +1 -1
- package/dist/standalone/.next/server/chunks/5103.js +10 -0
- package/dist/standalone/.next/server/chunks/5408.js +1 -0
- package/dist/standalone/.next/server/chunks/5545.js +1 -0
- package/dist/standalone/.next/server/chunks/5689.js +1 -1
- package/dist/standalone/.next/server/chunks/6333.js +3 -3
- package/dist/standalone/.next/server/chunks/6487.js +10 -0
- package/dist/standalone/.next/server/chunks/6796.js +1 -1
- package/dist/standalone/.next/server/chunks/6820.js +99 -0
- package/dist/standalone/.next/server/chunks/6826.js +1 -1
- package/dist/standalone/.next/server/chunks/6839.js +81 -0
- package/dist/standalone/.next/server/chunks/6850.js +1 -1
- package/dist/standalone/.next/server/chunks/6909.js +1 -1
- package/dist/standalone/.next/server/chunks/6942.js +27 -0
- package/dist/standalone/.next/server/chunks/7139.js +82 -0
- package/dist/standalone/.next/server/chunks/7471.js +13 -13
- package/dist/standalone/.next/server/chunks/7644.js +2 -2
- package/dist/standalone/.next/server/chunks/7722.js +1 -1
- package/dist/standalone/.next/server/chunks/773.js +47 -0
- package/dist/standalone/.next/server/chunks/8263.js +81 -0
- package/dist/standalone/.next/server/chunks/8326.js +1 -0
- package/dist/standalone/.next/server/chunks/8444.js +1 -1
- package/dist/standalone/.next/server/chunks/8617.js +1 -1
- package/dist/standalone/.next/server/chunks/8817.js +1 -1
- package/dist/standalone/.next/server/chunks/8996.js +1 -1
- package/dist/standalone/.next/server/chunks/9307.js +1 -0
- package/dist/standalone/.next/server/chunks/9364.js +58 -58
- package/dist/standalone/.next/server/chunks/9381.js +42 -0
- package/dist/standalone/.next/server/chunks/9403.js +1 -0
- package/dist/standalone/.next/server/chunks/9434.js +3 -3
- package/dist/standalone/.next/server/chunks/9488.js +1 -0
- package/dist/standalone/.next/server/chunks/9750.js +1 -0
- package/dist/standalone/.next/server/chunks/9777.js +1 -0
- package/dist/standalone/.next/server/chunks/9937.js +1 -1
- package/dist/standalone/.next/server/chunks/9940.js +1 -1
- package/dist/standalone/.next/server/chunks/9998.js +1 -1
- package/dist/standalone/.next/server/files-response-worker.js +3 -3
- package/dist/standalone/.next/server/functions-config-manifest.json +3 -0
- package/dist/standalone/.next/server/instrumentation.js +1 -1
- package/dist/standalone/.next/server/middleware-build-manifest.js +1 -1
- package/dist/standalone/.next/server/pages/404.html +1 -1
- package/dist/standalone/.next/server/pages/500.html +1 -1
- package/dist/standalone/.next/server/resource-collector-worker.js +1 -1
- package/dist/standalone/.next/server/server-reference-manifest.json +1 -1
- package/dist/standalone/.next/server/wakatime-sync-worker.js +2 -2
- package/dist/standalone/.next/static/94yAMfjyhUPRgarycP9y4/_buildManifest.js +1 -0
- package/dist/standalone/.next/static/chunks/app/_global-error/page-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/access/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/account-migrations/[intentId]/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/accounts/claude/[id]/status/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/accounts/claude/active/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/accounts/claude/login/[operationId]/input/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/accounts/claude/login/[operationId]/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/accounts/claude/policy/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/accounts/claude/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/accounts/claude/terminal/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/accounts/codex/active/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/accounts/codex/policy/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/accounts/codex/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/accounts/codex/terminal/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/accounts/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/agent/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/agent/snapshot/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/answer/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/artifact/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/attach-command/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/attention/[id]/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/attention/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/board/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/bridge/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/conversations/[conversationId]/migration/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/conversations/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/files/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/flows/[id]/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/flows/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/image/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/inbox/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/lifecycle/reaper/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/limits/history/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/limits/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/log/preflight/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/log/project-delete/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/log/provenance/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/log/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/log/suggestions/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/logs/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/logs/stream/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/monitor/lock/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/monitor/runs/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/orchestrator/rotate/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/orchestrator/seat/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/orchestrator/seat/status/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/pipelines/[id]/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/pipelines/preflight/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/pipelines/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/pipelines/tick/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/proc/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/projects/create/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/projects/crown/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/projects/directories/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/push/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/resources/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/roles/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/runtime/answer/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/runtime/deployments/[deploymentId]/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/runtime/deployments/capabilities/v1/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/runtime/deployments/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/runtime/hosts/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/runtime/interrupt/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/runtime/operations/[operationId]/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/runtime/operations/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/runtime/realtime/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/runtime/send/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/runtime/snapshot/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/runtime/spawn/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/runtime/steer/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/runtime/stream/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/search/transcripts/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/session/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/session/supersedence/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/session/title/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/spawn/policy/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/spawn/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/staging/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/task-attachments/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/tasks/[id]/assignment/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/tasks/[id]/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/tasks/[id]/send/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/tasks/[id]/spawn/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/tasks/curator/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/tasks/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/telegram/reports/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/telegram/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/timeline/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/tmux/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/tmux/targets/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/transcribe/backend/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/transcribe/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/transcribe/token/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/tts/backend/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/tts/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/view/presence/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/workflows/[id]/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/workflows/route-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/app/page-1a141ae4aa9d31a9.js +85 -0
- package/dist/standalone/.next/static/chunks/{framework-d1de002210ddaaef.js → framework-04bc8c1a646a0097.js} +1 -1
- package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/app-error-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/forbidden-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/not-found-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/unauthorized-ae02882983617748.js +1 -0
- package/dist/standalone/.next/static/css/dc96fb2edbd8742e.css +1 -0
- package/dist/standalone/node_modules/{nanoid → next/node_modules/postcss/node_modules/nanoid}/non-secure/index.cjs +2 -2
- package/dist/standalone/node_modules/{nanoid → next/node_modules/postcss/node_modules/nanoid}/package.json +1 -1
- package/dist/standalone/node_modules/react/cjs/react.development.js +1 -1
- package/dist/standalone/node_modules/react/cjs/react.production.js +1 -1
- package/dist/standalone/node_modules/react/package.json +3 -3
- package/dist/standalone/node_modules/react-dom/cjs/react-dom-server-legacy.browser.production.js +1 -1
- package/dist/standalone/node_modules/react-dom/cjs/react-dom-server-legacy.node.production.js +1 -1
- package/dist/standalone/node_modules/react-dom/cjs/react-dom-server.browser.production.js +3 -3
- package/dist/standalone/node_modules/react-dom/cjs/react-dom-server.edge.production.js +3 -3
- package/dist/standalone/node_modules/react-dom/cjs/react-dom-server.node.production.js +3 -3
- package/dist/standalone/node_modules/react-dom/cjs/react-dom.production.js +1 -1
- package/dist/standalone/node_modules/react-dom/package.json +4 -4
- package/dist/standalone/package.json +9 -8
- package/dist/standalone/src/lib/inboxFiles.ts +203 -0
- package/package.json +9 -8
- package/dist/standalone/.next/server/chunks/156.js +0 -2
- package/dist/standalone/.next/server/chunks/1920.js +0 -27
- package/dist/standalone/.next/server/chunks/2338.js +0 -12
- package/dist/standalone/.next/server/chunks/2904.js +0 -42
- package/dist/standalone/.next/server/chunks/2977.js +0 -1
- package/dist/standalone/.next/server/chunks/3139.js +0 -10
- package/dist/standalone/.next/server/chunks/3598.js +0 -81
- package/dist/standalone/.next/server/chunks/4968.js +0 -1
- package/dist/standalone/.next/server/chunks/6977.js +0 -1
- package/dist/standalone/.next/server/chunks/7295.js +0 -10
- package/dist/standalone/.next/server/chunks/7868.js +0 -1
- package/dist/standalone/.next/server/chunks/8026.js +0 -1
- package/dist/standalone/.next/server/chunks/8600.js +0 -12
- package/dist/standalone/.next/server/chunks/9246.js +0 -47
- package/dist/standalone/.next/server/chunks/9733.js +0 -42
- package/dist/standalone/.next/static/2ybXlxpylgBaGz43zp2fM/_buildManifest.js +0 -1
- package/dist/standalone/.next/static/chunks/app/_global-error/page-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/access/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/account-migrations/[intentId]/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/accounts/claude/[id]/status/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/accounts/claude/active/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/accounts/claude/login/[operationId]/input/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/accounts/claude/login/[operationId]/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/accounts/claude/policy/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/accounts/claude/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/accounts/claude/terminal/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/accounts/codex/active/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/accounts/codex/policy/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/accounts/codex/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/accounts/codex/terminal/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/accounts/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/agent/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/agent/snapshot/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/answer/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/artifact/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/attach-command/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/attention/[id]/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/attention/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/board/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/bridge/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/conversations/[conversationId]/migration/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/conversations/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/files/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/flows/[id]/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/flows/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/image/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/inbox/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/lifecycle/reaper/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/limits/history/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/limits/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/log/preflight/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/log/project-delete/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/log/provenance/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/log/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/logs/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/logs/stream/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/monitor/lock/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/monitor/runs/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/orchestrator/rotate/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/orchestrator/seat/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/orchestrator/seat/status/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/pipelines/[id]/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/pipelines/preflight/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/pipelines/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/pipelines/tick/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/proc/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/projects/create/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/projects/crown/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/push/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/resources/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/roles/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/runtime/answer/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/runtime/deployments/[deploymentId]/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/runtime/deployments/capabilities/v1/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/runtime/deployments/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/runtime/interrupt/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/runtime/operations/[operationId]/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/runtime/operations/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/runtime/realtime/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/runtime/send/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/runtime/snapshot/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/runtime/spawn/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/runtime/steer/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/runtime/stream/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/search/transcripts/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/session/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/session/supersedence/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/session/title/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/spawn/policy/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/spawn/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/staging/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/task-attachments/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/tasks/[id]/assignment/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/tasks/[id]/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/tasks/[id]/send/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/tasks/[id]/spawn/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/tasks/curator/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/tasks/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/telegram/reports/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/telegram/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/timeline/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/tmux/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/tmux/targets/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/transcribe/backend/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/transcribe/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/transcribe/token/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/tts/backend/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/tts/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/view/presence/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/workflows/[id]/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/workflows/route-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/app/page-7ba2538fa87e3d62.js +0 -80
- package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/app-error-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/forbidden-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/not-found-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/unauthorized-c132c5ba005ff29e.js +0 -1
- package/dist/standalone/.next/static/css/498f12ddef7ecb0e.css +0 -1
- /package/dist/standalone/.next/static/{2ybXlxpylgBaGz43zp2fM → 94yAMfjyhUPRgarycP9y4}/_ssgManifest.js +0 -0
- /package/dist/standalone/node_modules/{nanoid → next/node_modules/postcss/node_modules/nanoid}/non-secure/package.json +0 -0
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8974],{56:(e,t,n)=>{"use strict";n.d(t,{Gp:()=>f,P3:()=>s,ln:()=>l,po:()=>m});let r=/^conversation_[A-Za-z0-9_-]{1,180}$/,i=/^[A-Za-z0-9_.:-]{1,200}$/;function a(e){let t=new Map(e.cards.map(e=>[e.path,e]));for(let n of e.slice.focusedPath?[e.slice.focusedPath,...e.slice.selectedPaths]:e.slice.selectedPaths){let e=t.get(n);if(e&&"string"==typeof e.conversationId&&r.test(e.conversationId))return e}return null}function s(e){let t=o("project",c(e.context.project,200)),n=a(e);return n?{state:"selected",conversationId:n.conversationId,...t,...o("label",c(n.label,80))}:{state:"none",...t}}function l(e){let t={capturedAt:new Date(e.now).toISOString(),...o("project",c(e.context.project,200)),...o("viewSessionId",e.identity?u(e.identity.viewSessionId):null),...o("deviceId",e.identity?u(e.identity.deviceId):null),...o("revision",p(e.revision))},n=a(e);return n?{version:1,state:"selected",conversationId:n.conversationId,...t,...o("path",d(n.path)),...o("label",c(n.label,80))}:{version:1,state:"none",...t}}function o(e,t){return null===t?{}:{[e]:t}}function c(e,t){if("string"!=typeof e)return null;let n=e.replace(/[\u0000-\u001f\u007f-\u009f]+/gu," ").trim();return n&&[...n].slice(0,t).join("").trim()||null}function d(e){let t=c(e,1025);return t&&t.length<=1024?t:null}function u(e){return"string"==typeof e&&i.test(e)?e:null}function p(e){return"number"==typeof e&&Number.isSafeInteger(e)&&e>=0?e:null}function m(e){if(!e||"object"!=typeof e||Array.isArray(e)||1!==e.version)return null;let t=function(e){if("string"!=typeof e||e.length>40)return null;let t=Date.parse(e);return Number.isFinite(t)?new Date(t).toISOString():null}(e.capturedAt);if(!t)return null;let n={capturedAt:t,...o("project",c(e.project,200)),...o("viewSessionId",u(e.viewSessionId)),...o("deviceId",u(e.deviceId)),...o("revision",p(e.revision))};if("none"===e.state)return{version:1,state:"none",...n};if("selected"!==e.state)return null;let i="string"==typeof e.conversationId&&r.test(e.conversationId)?e.conversationId:null;return i?{version:1,state:"selected",conversationId:i,...n,...o("path",d(e.path)),...o("label",c(e.label,80))}:null}function f(e){if(!e||!/^[A-Za-z0-9_-]+$/.test(e))return null;try{let t=e.replace(/-/g,"+").replace(/_/g,"/"),n=atob(t+"=".repeat((4-t.length%4)%4)),r=Uint8Array.from(n,e=>e.charCodeAt(0));return m(JSON.parse(new TextDecoder().decode(r)))}catch{return null}}},98:(e,t,n)=>{"use strict";n.d(t,{AD:()=>v,ag:()=>b});var r=n(1691);function i(e,t,n){if(!t)return;let r=e.at(-1);if(r&&r.changed===n){r.text+=t;return}e.push({text:t,changed:n})}function a(e,t){let n=[];for(let r of e)"same"===r.kind?i(n,r.text,!1):r.kind===t&&i(n,r.text,!0);return n}function s(e){return e.length?e.split("\n"):[]}function l(e){return"delete"===e.op||"move"===e.op||e.hunks.some(e=>e.lines.length>0)}function o(e){let t=e.filter(l),n=t.length>8,i=t.slice(0,8),s={remaining:64e3};return{files:i.map(e=>(function(e,t){var n;let i=0,s=0;for(let t of e.hunks)for(let e of t.lines)"+"===e.t?i+=1:"-"===e.t&&(s+=1);if(!((n=e.content).length<=2e4)&&(n.match(/\s/g)?.length??0)/n.length<.02)return{path:e.path,op:e.op,hunks:[],added:i,removed:s,binary:!0,truncated:!1};let l=!1,o=0,c=0,d=[];for(let n of e.hunks){if(c>=16){l=!0;break}let e=[],i=!1;for(let a of n.lines){if(o>=200){l=!0,i=!0;break}let n=(0,r.fp)(a.text);if(n.length>2e3&&(n=n.slice(0,2e3),l=!0),t.remaining-n.length<0){l=!0,i=!0;break}t.remaining-=n.length,e.push({t:a.t,text:n}),o+=1}if(e.length){let t=function(e){let t=e.map(e=>({...e})),n=0;for(;n<t.length;){if("-"!==t[n].t){n+=1;continue}let e=n;for(;n<t.length&&"-"===t[n].t;)n+=1;let r=n;for(;n<t.length&&"+"===t[n].t;)n+=1;let i=Math.min(r-e,n-r);for(let n=0;n<i;n+=1){let i=t[e+n],s=t[r+n];if(i.text===s.text)continue;let l=function(e,t){let n=Array.from(e),r=Array.from(t);if(!n.length||!r.length||n.length*r.length>25e4)return null;let i=r.length+1,a=new Uint16Array((n.length+1)*i);for(let e=1;e<=n.length;e+=1)for(let t=1;t<=r.length;t+=1)a[e*i+t]=n[e-1]===r[t-1]?a[(e-1)*i+t-1]+1:Math.max(a[(e-1)*i+t],a[e*i+t-1]);if(a[n.length*i+r.length]/Math.max(n.length,r.length)<.5)return null;let s=[],l=n.length,o=r.length;for(;l||o;)l&&o&&n[l-1]===r[o-1]?(s.push({kind:"same",text:n[l-1]}),l-=1,o-=1):l&&(!o||a[(l-1)*i+o]>=a[l*i+o-1])?(s.push({kind:"remove",text:n[l-1]}),l-=1):(s.push({kind:"add",text:r[o-1]}),o-=1);return s.reverse()}(i.text,s.text);l&&(i.intraline=a(l,"remove"),s.intraline=a(l,"add"))}}return t}(e);d.push(n.header?{header:n.header,lines:t}:{lines:t}),c+=1}if(i)break}return{path:e.path,op:e.op,hunks:d,added:i,removed:s,binary:!1,truncated:l}})(e,s)),filesTruncated:n}}let c={files:[],filesTruncated:!1};function d(e,t){let n=[];for(let t of s(e))n.push({t:"-",text:t});for(let e of s(t))n.push({t:"+",text:e});return{hunk:{lines:n},content:`${e}
|
|
2
|
-
${t}`}}function u(e){return"string"==typeof e?e:""}function p(e){return"string"==typeof e&&e.trim().length>0?e:null}let m=/^\*{0,3}\s*Add File:\s*(.+)$/,f=/^\*{0,3}\s*Update File:\s*(.+)$/,h=/^\*{0,3}\s*Delete File:\s*(.+)$/,x=/^\*{0,3}\s*Move to:\s*(.+)$/,g=/^@@(.*)$/;function b(e){let t=[],n=null,r=null,i=e=>{n&&(r=void 0!==e?{header:e,lines:[]}:{lines:[]},n.hunks.push(r))},a=e=>{n&&(r||i(),r.lines.push(e))};for(let s of e.split("\n")){if(/^\*{3}\s*(Begin|End) Patch/.test(s))continue;let e=s.match(m),l=s.match(f),o=s.match(h),c=s.match(x);if(e){n={path:e[1].trim(),op:"add",hunks:[],content:""},r=null,t.push(n);continue}if(l){n={path:l[1].trim(),op:"update",hunks:[],content:""},r=null,t.push(n);continue}if(o){n={path:o[1].trim(),op:"delete",hunks:[],content:""},r=null,t.push(n);continue}if(c&&n){n.op="move",n.path=c[1].trim();continue}let d=s.match(g);if(d){i(d[1].trim());continue}if(!n)continue;let u=s[0];a("+"===u?{t:"+",text:s.slice(1)}:"-"===u?{t:"-",text:s.slice(1)}:{t:" ",text:s.startsWith(" ")?s.slice(1):s})}for(let e of t)e.content=e.hunks.flatMap(e=>e.lines.map(e=>e.text)).join("\n");return o(t)}function v(e,t){return"Write"===e?function(e){let t=p(e.file_path??e.path),n=u(e.content??e.new_string);if(!t)return c;let{hunk:r,content:i}=d("",n);return o([{path:t,op:"add",hunks:[r],content:i}])}(t):"Edit"===e||"MultiEdit"===e||"NotebookEdit"===e?function(e){let t=p(e.file_path??e.path??e.notebook_path);if(!t)return c;let n=Array.isArray(e.edits)?e.edits.filter(e=>!!e&&"object"==typeof e):[{old_string:e.old_string,new_string:e.new_string??e.new_source??e.content}],r=[],i=[],a=!1;for(let e of n){let t=u(e.old_string),n=u(e.new_string??e.new_source??e.content);if(!t&&!n)continue;t&&(a=!0);let{hunk:s,content:l}=d(t,n);r.push(s),i.push(l)}return r.length?o([{path:t,op:a?"update":"add",hunks:r,content:i.join("\n")}]):c}(t):"apply_patch"===e?b(u(t.input)):c}},538:(e,t,n)=>{"use strict";n.d(t,{At:()=>i,WI:()=>a});let r=/\x1b\[[0-9;?]*[\x20-\x2f]*[\x40-\x7e]|\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)|\x1b[\x40-\x5f]/g;function i(e){let t=e.replace(r,"").replace(/\r\n/g,"\n");return t.includes("\r")?t.split("\n").map(e=>{if(!e.includes("\r"))return e;let t=e.split("\r").filter(e=>e.length>0);return t.length?t[t.length-1]:""}).join("\n"):t}function a(e){return e.replace(/\r\n|\r|\n/g,"⏎").replace(/\t/g,"⇥").replace(/ /g,"␠").replace(/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/g,e=>{let t=e.charCodeAt(0);return"^"+String.fromCharCode(127===t?63:t+64)})}},744:(e,t,n)=>{"use strict";n.d(t,{ez:()=>a,fn:()=>s});let r={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",avif:"image/avif",bmp:"image/bmp",svg:"image/svg+xml"},i=new Set(["txt","md","markdown","log","json","yaml","yml","toml","ini","conf","csv","tsv","xml","html","htm","css","scss","ts","tsx","js","jsx","mjs","cjs","py","rs","go","java","c","h","cpp","hpp","cs","rb","php","sh","bash","zsh","fish","sql","diff","patch"]);function a(e){return e.replace(/(:\d+){1,2}$/,"")}function s(e){let t=a(e).split("/").pop()??"",n=t.lastIndexOf(".");if(n<=0||t.slice(0,n).startsWith("."))return null;let s=t.slice(n+1).toLowerCase();if(!s)return null;if("pdf"===s)return{kind:"pdf",mime:"application/pdf"};let l=r[s];return l?{kind:"image",mime:l}:i.has(s)?{kind:"text",mime:"text/plain; charset=utf-8"}:null}},754:(e,t,n)=>{"use strict";let r,i,a,s,l,o,c,d,u,p,m,f,h,x,g,b,v,w,y,k,j,N,S,C,A,I,M,T,P,$,E,R,O,D,L,_,F,q,z;n.d(t,{Viewer:()=>NA});var H,U=n(5155),B=n(9072),K=n(9005),Y=n(2115);function W(e){return e.conversationId??e.path}function V(e){return!!e.migratedTo}function J(e){try{return decodeURIComponent(e)}catch{return e}}function G(e){let t=e.match(/^#c=(.+)$/);if(t)return{conversationId:J((t[1]??"").replace(/#question$/,"")),filePath:null,project:null};let n=e.match(/^#f=(.+)$/);if(n)return{conversationId:null,filePath:J((n[1]??"").replace(/#question$/,"")),project:null};let r=e.match(/^#p=(.+)$/);return r?{conversationId:null,filePath:null,project:J(r[1]??"")}:{conversationId:null,filePath:null,project:null}}function Q(e){return e.conversationId?"#c="+encodeURIComponent(e.conversationId):"#f="+encodeURIComponent(e.path)}function X(e){return e.path.startsWith("spawn:")}function Z(e,t){let n=null,r=null;for(let i of e)if(i.conversationId===t){if(X(i)){n=n??i;continue}if(r=r??i,!V(i))return i}return r??n}function ee(e,t){let n=new Set,r=e;for(;void 0!==t[r]&&!n.has(r);)n.add(r),r=t[r];return r}function et(e,t,n){if(t){let e=Z(n,t);if(e)return e.path}if(!e)return e;let r=n.find(t=>t.path===e);return r&&V(r)&&r.conversationId?Z(n,r.conversationId)?.path??e:e}function en(e){return e.some(V)?e.filter(e=>!V(e)):e}let er="llvFocus";function ei(e){return"string"==typeof e&&e.length>0&&e.length<=1024}function ea(e){return null===e||ei(e)}function es(e){if("object"!=typeof e||null===e)return null;let t=e[er];return"object"!=typeof t||null===t?null:1===t.v&&ea(t.conversationId)&&ea(t.path)&&ei(t.project)&&(null!==t.conversationId||null!==t.path)?{v:1,conversationId:t.conversationId,path:t.path,project:t.project}:null}function el(){return es(window.history.state)}function eo(e,t,n){"push"===e?window.history.pushState(t,"",n):window.history.replaceState(t,"",n)}function ec(e,t,{restore:n=!1}={}){let r={v:1,conversationId:e.conversationId??null,path:e.path,project:t};if(null===es({[er]:r}))return;let i=Q({conversationId:e.conversationId??void 0,path:e.path});eo(function(e,t,n){return n?"replace":e&&(e.conversationId&&t.conversationId?e.conversationId===t.conversationId:e.path&&t.path&&e.path===t.path)?"replace":"push"}(el(),r,n),{[er]:r},i)}function ed(e){eo(el()?"push":"replace",null,e)}let eu="llv:open-accounts",ep=null;function em(e,t){ep={engine:e,accountId:t,at:Date.now()},window.dispatchEvent(new CustomEvent(eu,{detail:{engine:e,accountId:t}}))}function ef(e){let t=t=>{let n=t.detail;n&&e(n)};return window.addEventListener(eu,t),()=>window.removeEventListener(eu,t)}var eh=n(4654),ex=n(6027);let eg=["-agents-tools-"];function eb(e,t){if(t?.trim())return t.trim();if("project_unresolved"===e)return"Unresolved project";for(let t of eg)if(e.startsWith(t)&&e.length>t.length)return e.slice(t.length);return e.replace(/^-+/,"")||e}var ev=n(1463);let ew="__overview__",ey=e=>Math.floor(e/300);function ek(){let e=void 0!==ev?ev.env?.NEXT_PUBLIC_LLV_SCHEME_AGE_HORIZON_HOURS:void 0,t=e?Number(e):NaN;return(Number.isFinite(t)&&t>0?t:48)*3600}function ej(e,t,n){return"live"===e.activity||"running"===e.proc||"recent"===e.activity||t<=0||t-e.mtime<=n}function eN(e){return"live"===e.activity?0:"recent"===e.activity?1:"stalled"===e.activity?2:3}function eS(e){if("claude-projects"===e.root){if("session"!==e.kind)return!1;if(!e.parent)return!0;let t=e.durableLineage;return t?.kind==="spawn"&&!t.memberships.length&&!e.handoff}return"codex-sessions"===e.root&&!e.parent}function eC(e){return"claude-projects"===e.root&&"subagent"===e.kind}function eA(e){return!!eC(e)||!!e.handoff&&!!e.parent||"codex-sessions"===e.root&&!!e.parent}function eI(e){return"shell"===e.engine}function eM(e){return e.project||"other"}function eT(e,t,n,r=[]){if(n){let t=e.find(e=>e.path===n);if(t?.cwd?.trim())return t.cwd.trim()}let i=new Map;for(let n of e){if(eM(n)!==t||null===n.projectRoot)continue;let e=n.projectRoot?.trim()||n.cwd?.trim();if(!e)continue;let r=i.get(e)??{count:0,newest:0};r.count+=1,r.newest=Math.max(r.newest,n.mtime),i.set(e,r)}return([...i].sort(([e,t],[n,r])=>r.count-t.count||r.newest-t.newest||e.localeCompare(n))[0]?.[0]??"")||r.find(e=>e.trim())?.trim()||""}function eP(e,t,n,r,i=[],a="/"){if(r){let t=e.find(e=>e.path===r)?.cwd?.trim();if(t)return t}let s=n.find(e=>e.project===t)?.projectRoot?.trim()??"";return s||eT(e,t,void 0,[...i,a])||a}let e$=new Set(["provisioning","implementing","reviewing","finishing"]);function eE(e,t=Date.now()/1e3,n=[],r=[],i=[],a={}){let s=new Map,l=(e,t=eb(e))=>{let n=s.get(e);return n||(n={project:e,displayName:t,liveCount:0,attentionCount:0,conversations:0,smt:0,catalogOnly:!0},s.set(e,n)),n};for(let n of e){let e=l(eM(n),eb(eM(n),n.projectName));e.catalogOnly=!1,"live"===n.activity&&(e.liveCount+=1),null!==eH(n,t)&&(e.attentionCount+=1),eS(n)&&(e.conversations+=1),e.smt=Math.max(e.smt,n.mtime)}for(let e of r){if(!e.project)continue;let t=l(e.project,eb(e.project,e.displayName));t.conversations=Math.max(t.conversations,e.conversations),t.smt=Math.max(t.smt,e.smt)}for(let e of n){if("closed"===e.state||!e.project)continue;let t=l(e.project,eb(e.project,a[e.project]));t.catalogOnly=!1,e$.has(e.state)&&(t.liveCount+=1),("needs_decision"===e.state||"paused"===e.state)&&(t.attentionCount+=1),t.smt=Math.max(t.smt,(Date.parse(e.createdAt)||0)/1e3)}for(let e of i){if("closed"===e.state&&!e.restored||!e.project)continue;let t=l(e.project,eb(e.project,a[e.project]));t.catalogOnly=!1,("provisioning"===e.state||"running"===e.state)&&(t.liveCount+=1),("needs_decision"===e.state||"paused"===e.state)&&(t.attentionCount+=1),t.smt=Math.max(t.smt,(Date.parse(e.createdAt)||0)/1e3)}return[...s.values()].sort((e,t)=>{let n=e.attentionCount>0;return n!==t.attentionCount>0?n?-1:1:e.liveCount!==t.liveCount?t.liveCount-e.liveCount:ey(t.smt)-ey(e.smt)||e.project.localeCompare(t.project)})}function eR(e){let t=new Map;for(let n of e){if(!n.parent)continue;let e=t.get(n.parent);e?e.push(n):t.set(n.parent,[n])}return t}function eO(e,t){let n=[],r=[...t.get(e.path)??[]],i=new Set([e.path]);for(;r.length;){let e=r.pop();i.has(e.path)||(i.add(e.path),n.push(e),r.push(...t.get(e.path)??[]))}return n}function eD(e,t){let n=[],r=[...t.get(e.path)??[]],i=new Set([e.path]),a=eM(e);for(;r.length;){let e=r.pop();if(!i.has(e.path))i.add(e.path),eM(e)===a&&(n.push(e),r.push(...t.get(e.path)??[]))}return n}function eL(e,t,n){return!n?.foldedEnginePaths?.has(e.path)&&(!!n?.promotedEnginePaths?.has(e.path)||!eI(e)&&("live"===e.activity||"running"===e.proc||"recent"===e.activity&&eA(e)||eA(e)&&t?.has(e.path)===!0))}function e_(e){return eL(e)||eI(e)&&("live"===e.activity||"running"===e.proc)}function eF(e,t,n={}){let r=new Map(e.map(e=>[e.path,e])),i=eR(e),a=new Map,s=new Map,{expandedConversationPaths:l,enginePlacement:o}=n,c=n.now??0,d=n.ageHorizonSeconds??ek(),u=e=>"recent"===e.activity||c>0&&c-e.mtime<=d,p=e=>ej(e,c,d),m=e=>{let t=e,n=e,i=new Set([e.path]);for(;n.parent&&!i.has(n.parent);){let a=r.get(n.parent);if(!a||eM(a)!==eM(e))break;i.add(a.path),n=a,p(a)&&(t=a)}return t};for(let n of e){if(eM(n)!==t)continue;if(function(e,t){if(!e.parent||!eA(e))return!1;let n=t.get(e.parent);return!!(n&&eM(n)!==eM(e))}(n,r)&&(0===c||"live"===n.activity||"running"===n.proc||u(n))){a.set(n.path,n);continue}let e=l?.has(n.path)===!0;if("live"===n.activity||"running"===n.proc||u(n)&&eA(n)||o?.promotedEnginePaths?.has(n.path)===!0||e&&(eS(n)||eA(n))){let e=m(n);eI(e)?s.set(e.path,e):a.set(e.path,e);continue}u(n)&&eS(n)&&a.set(n.path,n)}let f=function(e,t){let n=(e,n)=>{let r=e,i=new Set;for(let e=0;r&&!i.has(r.path);e+=1){if(r.path===n)return e;i.add(r.path),r=r.parent?t.get(r.parent):void 0}return 1/0},r=new Set;for(let t of e)for(let e of t.columns)e.file.path!==t.key&&r.add(e.file.path);let i=e.filter(e=>!r.has(e.key)),a=new Map;for(let e of i)for(let t of e.columns){let r=a.get(t.file.path);(!r||n(t.file,e.key)<n(t.file,r.key))&&a.set(t.file.path,e)}return i.map(e=>{let t=e.columns.filter(t=>a.get(t.file.path)===e);if(t.length===e.columns.length)return e;let n=Math.max(...t.map(e=>e.file.mtime),...t.flatMap(e=>e.tasks.map(e=>e.mtime)));return{...e,columns:t,smt:n}})}([...a.values()].map(e=>(function(e,t,n,r,i=()=>!0){let a=eD(e,t),s="live"===e.activity||"running"===e.proc,l=a.filter(e=>s&&eA(e)&&i(e)&&!r?.foldedEnginePaths?.has(e.path)||eL(e,n,r)).sort((e,t)=>("live"!==e.activity)-("live"!==t.activity)||ey(t.mtime)-ey(e.mtime)||e.path.localeCompare(t.path)),o=a.filter(e=>eI(e)&&"live"===e.activity).sort((e,t)=>ey(t.mtime)-ey(e.mtime)||e.path.localeCompare(t.path)),c=[e,...l].map(e=>({file:e,tasks:[]})),d=new Map(c.map(e=>[e.file.path,e]));for(let e of o)(e.parent&&d.get(e.parent)||c[0]).tasks.push(e);let u=new Set([...d.keys(),...o.map(e=>e.path)]),p=a.filter(e=>!u.has(e.path)).sort((e,t)=>t.mtime-e.mtime),m=Math.max(...c.map(e=>e.file.mtime),...o.map(e=>e.mtime));return{key:e.path,columns:c,returnable:[],finished:p,smt:m,orphanTask:!1}})(e,i,l,o,p)),r);for(let e of s.values())f.push({key:e.path,columns:[{file:e,tasks:[]}],returnable:[],finished:[],smt:e.mtime,orphanTask:!0});return f.sort((e,t)=>e.orphanTask!==t.orphanTask?e.orphanTask?1:-1:ey(t.smt)-ey(e.smt)||e.key.localeCompare(t.key))}function eq(e,t,n){if(!e)return[];let r=eR(t),i=[],a=new Set([e.path]),s=(e,t)=>{for(let l of(r.get(e.path)??[]).filter(e=>!a.has(e.path)).sort((e,t)=>eN(e)-eN(t)||t.mtime-e.mtime))a.add(l.path),n(l)&&(i.push({file:l,depth:t}),s(l,t+1))};return s(e,1),i}let ez={unowned:0,blocked:1,heuristic:2,stalled:3};function eH(e,t=Date.now()/1e3){return e.pendingQuestion?e.pendingQuestion.toolUseId:e.rateLimit?`${e.path}:rate-limited:${e.rateLimit.resetAt??"unknown"}`:e.waitingInput?`${e.path}:waiting:${Math.floor(e.waitingInput.since)}`:"stalled"===e.activity&&"running"===e.proc&&t-e.mtime<=7200?`${e.path}:stalled:${Math.floor(e.mtime)}`:null}function eU(e,t,n){let r=function(e,t,n){if(!e.length)return null;let r=null===t?-1:e.findIndex(e=>e.id===t);return -1===r?1===n?e[0]:e[e.length-1]:e[(r+n+e.length)%e.length]}(t,e.current,n);return r&&(e.current=r.id),r}let eB=(e=(0,eh.JK)())=>"uk"===e?"uk-UA":"en-US";function eK(e,t=(0,eh.JK)()){if(null==e||""===e)return null;let n=new Date("number"==typeof e?1e3*e:e);return Number.isNaN(n.getTime())?null:(0,eh.Tl)(t,"limits.asOf",{time:n.toLocaleTimeString(eB(t),{hour:"2-digit",minute:"2-digit",hour12:!1})})}function eY(e,t){return new Date(1e3*e).toLocaleTimeString(eB(t),{hour:"2-digit",minute:"2-digit",hour12:!1})}function eW(e,t){let n=(0,eh.JK)(),r=e-t;return r<=60?(0,eh.Tl)(n,"limits.now"):r<5400?(0,eh.Tl)(n,"limits.inMin",{n:Math.ceil(r/60)}):r<129600?(0,eh.Tl)(n,"limits.inHour",{n:Math.ceil(r/3600)}):(0,eh.Tl)(n,"limits.inDay",{n:Math.ceil(r/86400)})}function eV(e,t,n){if("number"!=typeof n||!Number.isFinite(n)||n<=0)return e("weekly"===t?"limits.week":"limits.5h");let r=function(e){if("number"!=typeof e||!Number.isFinite(e)||e<=0)return null;for(let t of[300,10080])if(Math.abs(e-t)<=.01*t)return t;return null}(n)??n;return 10080===r?e("limits.week"):300===r?e("limits.5h"):n%1440==0?e("limits.windowDays",{n:n/1440}):n>=60?e("limits.windowHours",{n:Math.round(n/60)}):e("limits.windowMinutes",{n:Math.round(n)})}function eJ(e,t){let n=new Date(1e3*e),r=n.toLocaleTimeString(eB(),{hour:"2-digit",minute:"2-digit",hour12:!1});return e-t<86400?r:n.toLocaleDateString(eB(),{day:"numeric",month:"short"})+" "+r}let eG=e=>e;function eQ(e){return e.split("/").slice(-2).join("/")}function eX(e){let t=new Set;for(let n of e)t.add(n.path);let n=new Map;for(let e of t){let t=eQ(e);n.has(t)?n.get(t)!==e&&n.set(t,null):n.set(t,e)}return e=>!e||t.has(e)?e:n.get(eQ(e))??e}let eZ="llv:flows-changed",e0=new Set,e1=e0,e2=new Set;function e5(e){return e2.add(e),()=>e2.delete(e)}let e4=new Set;function e3(e){return"closed"!==e.state||!0===e.restored}function e6(e){let t=new Map;for(let n of e){if(!e3(n))continue;let e=t.get(n.implementerPath);(!e||n.createdAt>e.createdAt)&&t.set(n.implementerPath,n)}return t}function e8(e,t=[]){let n=new Set;for(let r of e)for(let e of r.rounds)for(let{path:i}of te(r,e,t))n.add(i);return n}function e7(e,t,n){if(t.reviewerBindingId){let r=`reviewer:${t.n}:${t.reviewerBindingId}`,i=en([...n]).find(n=>n.durableLineage?.memberships.some(n=>"flow"===n.kind&&n.containerId===e.id&&"reviewer"===n.role&&n.round===t.n&&n.slot===r));if(i)return i.conversationId?Z(n,i.conversationId)??i:i}if(t.reviewerConversationId){let e=Z(n,t.reviewerConversationId);if(e)return e}let r=en([...n]).find(n=>n.durableLineage?.memberships.some(n=>"flow"===n.kind&&n.containerId===e.id&&"reviewer"===n.role&&n.round===t.n));if(r)return r;let i=t.reviewerPath?n.find(e=>e.path===t.reviewerPath)??null:null;return i?.conversationId?Z(n,i.conversationId)??i:i}function e9(e,t,n){let r=en([...n]),i=e7(e,t,n),a=r.filter(n=>n.durableLineage?.memberships.some(n=>"flow"===n.kind&&n.containerId===e.id&&"reviewer"===n.role&&n.round===t.n)).filter(e=>e!==i);return i?[...a,i]:a}function te(e,t,n=[]){let r=e9(e,t,n).map(e=>({path:e.path,conversationId:e.conversationId??null})),i=new Set(r.map(e=>e.path));if(!t.reviewerPath||i.has(t.reviewerPath))return r;let a=n.find(e=>e.path===t.reviewerPath)??null,s=e7(e,t,n);return s&&s.path!==t.reviewerPath&&s.conversationId&&(s.conversationId===t.reviewerConversationId||s.conversationId===a?.conversationId)||r.push({path:t.reviewerPath,conversationId:t.reviewerConversationId??a?.conversationId??null}),r}let tt=new Set;function tn(e,t){return!t.has(e.path)&&("claude"===e.engine||"codex"===e.engine)&&eS(e)}let tr=new Set(["spawn_pending","relay_pending","needs_decision","paused","approved"]),ti={waiting_ready:{labelKey:"flowStrip.startReview",action:"advance"},spawn_pending:{labelKey:"flowStrip.spawnReviewer",action:"advance"},relay_pending:{labelKey:"flowStrip.relayNotes",action:"advance"},needs_decision:{labelKey:"flowStrip.retryRound",action:"retry-round"},done_comment:{labelKey:"flowStrip.anotherRound",action:"another-round"}};function ta(e,t,n){var r;return t.block?.reason==="rate_limited"?{label:e("flowState.blocked_rate_limited"),detail:t.block.resetAt?e("flowState.rate_limit_until",{time:eY(t.block.resetAt,n)}):e("flowState.rate_limit_wait"),attention:!0,pending:null}:{label:(r=t.state,e(`flowState.${r}`)),detail:t.stateDetail,attention:tr.has(t.state),pending:ti[t.state]??null}}function ts(e){return e.block?null:"spawning"===e.state||"reviewing"===e.state?"reviewer":"waiting_ready"===e.state||"relaying"===e.state||"fixing"===e.state?"implementer":null}function tl(e){return e.block?null:"spawn_pending"===e.state||"spawning"===e.state||"reviewing"===e.state?"forward":"relay_pending"===e.state||"relaying"===e.state||"fixing"===e.state||"waiting_ready"===e.state&&e.rounds.length?"back":null}let to={APPROVE:"✓",REQUEST_CHANGES:"✖",COMMENT:"◆"};function tc(e){return"APPROVE"===e?{color:"var(--color-success)",soft:"var(--color-success-soft)"}:"REQUEST_CHANGES"===e?{color:"var(--color-danger)",soft:"var(--color-danger-soft)"}:"COMMENT"===e?{color:"var(--color-warning)",soft:"var(--color-warning-soft)"}:{color:"var(--color-muted)",soft:"var(--color-sunken)"}}async function td(e,t){try{let n=await fetch(`/api/flows/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(t)});if(n.ok)return"close"===t.action&&function(e){if(!e0.has(e))for(let t of(e0.add(e),e1=new Set(e0),e2))t()}(e),window.dispatchEvent(new Event(eZ)),null;let r=await n.json().catch(()=>null);return r?.error??(0,eh.Tl)((0,eh.JK)(),"flowModel.failed",{status:n.status})}catch{return(0,eh.Tl)((0,eh.JK)(),"common.serverUnavailable")}}var tu=n(1463);function tp(){let e=void 0!==tu?tu.env?.NEXT_PUBLIC_LLV_WORKER_COLLAPSE_MINUTES:void 0,t=e?Number(e):NaN;return Number.isFinite(t)&&t>0?6e4*t:9e5}function tm(e,t,n=eG){let r=e.durableLineage?.memberships.find(e=>"flow"===e.kind);if(r){let e=t.find(e=>e.id===r.containerId);if(e&&"reviewer"===r.role){let t=e.rounds.find(e=>e.n===r.round)??null;return{role:"reviewer",flow:e,round:t}}if(e&&"implementer"===r.role)return{role:"implementer",flow:e,round:null}}for(let r of t)for(let t of r.rounds)if(t.reviewerPath&&n(t.reviewerPath)===e.path)return{role:"reviewer",flow:r,round:t};for(let r of t)if(n(r.implementerPath)===e.path)return{role:"implementer",flow:r,round:null};return null}function tf(e,t){return!!(e.userAuthored||e.authorshipUnverified||"live"===e.activity||"stalled"===e.activity||"running"===e.proc||e.pendingQuestion||e.waitingInput||e.migration&&"committed"!==e.migration.phase&&"rolled-back"!==e.migration.phase||t.pinnedPaths.has(e.path)||t.protectedPaths?.has(e.path))}let th={flow:0,pipeline:1,origin:2,worktree:3},tx=new Set,tg=e=>1e13*eN(e)-e.mtime,tb="direct-review::";function tv(e){return e.id.startsWith(tb)}var tw=n(6505);function ty(e,t){return Math.floor(t.smt/300)-Math.floor(e.smt/300)||e.file.path.localeCompare(t.file.path)}function tk(e,t=Date.now()/1e3){return!!e.pendingQuestion||!!e.rateLimit||!!e.waitingInput||("stalled"===e.activity?null!==eH(e,t):"recent"===e.activity&&("claude"===e.engine||"codex"===e.engine)&&eS(e)&&!eC(e))}function tj(e,t,n,r,i=tN,a=tS){let{locale:s}=(0,eh.Ym)();return(0,Y.useMemo)(()=>{let l=(e,t)=>(0,eh.Tl)(s,e,t),o=function(e){let t=eR(e),n=new Map;for(let r of e)n.set(r.path,eO(r,t).length);return n}(e),c=new Map;for(let e of t){let t=c.get(e.file);(!t||e.ts>t.ts)&&c.set(e.file,e)}let d=e6(a.filter(e=>!tv(e))),u=e8(a,e),p=n.trim().toLowerCase(),m=e.filter(e=>!i.has(e.path)&&!u.has(e.path)&&(eS(e)||"live"===e.activity||"stalled"===e.activity||"recent"===e.activity&&!eI(e))).map(e=>{let t=eM(e),n=(0,ex.cr)(e.title),i=r-e.mtime,a=d.get(e.path),u=e.pendingQuestion||e.rateLimit||e.waitingInput?"waiting":"live"===e.activity?"working":tk(e,r)?"waiting":i<=86400?"recent":"older",p=function(e,t,n){var r;if(t.pendingQuestion)return e("plan"===t.pendingQuestion.kind?"status.awaitingPlan":"status.awaitingAnswer");if(t.rateLimit)return e("status.rateLimited");if(t.waitingInput)return e("status.awaitingTerminal");if("live"===t.activity&&t.plan?.current)return`${t.plan.done}/${t.plan.total} \xb7 ${t.plan.current}`;let i=n.get(t.path);return i?`${i.label} \xb7 ${(0,tw.rK)(i.ts)}`:"live"===t.activity?e("status.working"):eC(r=t)&&"running"!==r.proc?e("status.returnedResult"):"stalled"===t.activity?e("status.stalled"):tk(t)?e("status.finishedTurn"):""}(l,e,c);if(a){let e=ta(l,a,s);e.attention?u="waiting":("reviewing"===a.state||"relaying"===a.state||"spawning"===a.state)&&(u="working"),p=`${l("status.flow",{label:e.label})}${e.detail?` — ${e.detail}`:""}`}return{file:e,project:t,title:n,descendants:o.get(e.path)??0,smt:e.mtime,kind:u,statusLine:p}}).filter(e=>!p||`${e.title} ${e.project}`.toLowerCase().includes(p)),f=(e,t)=>t.smt-e.smt||e.file.path.localeCompare(t.file.path),h=m.filter(e=>"waiting"===e.kind).sort(f),x=m.filter(e=>"working"===e.kind).sort(f);return{waiting:h,working:x,recent:m.filter(e=>"recent"===e.kind).sort(ty),older:m.filter(e=>"older"===e.kind).sort(ty),livePreview:x.slice(0,3)}},[e,t,n,r,i,a,s])}let tN=new Set,tS=[];function tC(e,t=Date.now()/1e3){return e.pendingQuestion||e.rateLimit||e.waitingInput?"waiting":"live"===e.activity?"live":"recent"===e.activity&&eA(e)&&"running"!==e.proc?"returned":tk(e,t)?"stalled"===e.activity?"stalled":"waiting":"done"}let tA=new Map;function tI(e){let t=tA.get(e);if(!t)return 0;let n=t.getBoundingClientRect();return n.width?Math.max(-1,Math.min(1,(n.left+n.width/2)/window.innerWidth*2-1)):0}let tM=null;function tT(){if(!tM){let e=window.AudioContext??window.webkitAudioContext;if(!e)return null;tM=new e}return tM}let tP={waiting:[{freq:784,at:0,dur:.5},{freq:1175,at:.16,dur:.75}],returned:[{freq:659,at:0,dur:.3},{freq:784,at:.09,dur:.3},{freq:988,at:.18,dur:.65}],stalled:[{freq:880,at:0,dur:.35},{freq:587,at:.14,dur:.7}],question:[{freq:1047,at:0,dur:.28},{freq:1319,at:.12,dur:.35},{freq:1568,at:.24,dur:.6}],spawned:[{freq:523,at:0,dur:.14},{freq:784,at:.06,dur:.4}],dictWarn:[{freq:660,at:0,dur:.32}],dictStop:[{freq:523,at:0,dur:.3},{freq:330,at:.17,dur:.62}]};function t$(e,t,n=0){if(!function(){try{return"off"!==localStorage.getItem("llvSound")}catch{return!0}}())return;let r=tT();if(!r)return;if("running"!==r.state)return void r.resume().catch(()=>void 0);let i=r.currentTime+.02+n/1e3,a=r.destination;if("function"==typeof r.createStereoPanner){let e=r.createStereoPanner();e.pan.value=Math.max(-1,Math.min(1,t)),e.connect(r.destination),a=e}for(let t of tP[e])!function(e,t,n,r){let i=r+n.at,a=e.createOscillator();a.type="sine",a.frequency.value=n.freq;let s=e.createGain();s.gain.setValueAtTime(0,i),s.gain.linearRampToValueAtTime(.07,i+.012),s.gain.exponentialRampToValueAtTime(4e-4,i+n.dur),a.connect(s).connect(t),a.start(i),a.stop(i+n.dur+.05);let l=e.createOscillator();l.type="sine",l.frequency.value=2*n.freq;let o=e.createGain();o.gain.setValueAtTime(0,i),o.gain.linearRampToValueAtTime(.0126,i+.012),o.gain.exponentialRampToValueAtTime(3e-4,i+.7*n.dur),l.connect(o).connect(t),l.start(i),l.stop(i+n.dur)}(r,a,t,i)}let tE="/audio/cues",tR={attention:{file:"attention.mp3",tier:"priority"},failure:{file:"failure.mp3",tier:"priority"},launch:{file:"launch.mp3",tier:"salient"},success:{file:"success.mp3",tier:"salient"},"viewer-mcp":{file:"viewer-mcp.mp3",tier:"routine"},"tool-tick":{file:"tool-tick-1.mp3",variants:["tool-tick-1.mp3","tool-tick-2.mp3","tool-tick-3.mp3","tool-tick-4.mp3","tool-tick-5.mp3","tool-tick-6.mp3","tool-tick-7.mp3","tool-tick-8.mp3"],tier:"routine"}},tO={priority:1,salient:.75,routine:.5},tD={priority:3,salient:2,routine:1};function tL(e){return tR[e].tier}function t_(e){return"priority"===tL(e)}let tF={waiting:"attention",question:"attention",returned:"success",stalled:"failure",spawned:"launch"},tq="/audio/ambient/voice-call-loop.wav";function tz(e=tq){return"string"==typeof e&&e.length>0}let tH="llvSound",tU="llvAudioCueVolume",tB="llvAudioLoopEnabled",tK="llvAudioViewerLoopEnabled",tY="llvAudioLoopVolume",tW={cuesEnabled:!0,cueVolume:.4,loopEnabled:!1,viewerLoopEnabled:!1,loopVolume:.05},tV=null,tJ=new Set;function tG(){if(void 0!==r)return r;try{return window.localStorage}catch{return null}}function tQ(){for(let e of tJ)e()}function tX(e,t){if(!e)return null;try{return e.getItem(t)}catch{return null}}function tZ(e,t,n){let r=tX(e,t);return"on"===r||"off"!==r&&n}function t0(e,t,n){let r=Number.parseFloat(tX(e,t)??"");return Number.isFinite(r)?Math.max(0,Math.min(1,r)):n}function t1(){return tV??=function(e=tG()){return{cuesEnabled:tZ(e,tH,tW.cuesEnabled),cueVolume:t0(e,tU,tW.cueVolume),loopEnabled:tZ(e,tB,tW.loopEnabled),viewerLoopEnabled:tZ(e,tK,tW.viewerLoopEnabled),loopVolume:t0(e,tY,tW.loopVolume)}}()}function t2(e){let t={...t1(),...e},n=tG();if(n)try{void 0!==e.cuesEnabled&&n.setItem(tH,t.cuesEnabled?"on":"off"),void 0!==e.cueVolume&&n.setItem(tU,String(t.cueVolume)),void 0!==e.loopEnabled&&n.setItem(tB,t.loopEnabled?"on":"off"),void 0!==e.viewerLoopEnabled&&n.setItem(tK,t.viewerLoopEnabled?"on":"off"),void 0!==e.loopVolume&&n.setItem(tY,String(t.loopVolume))}catch{}return tV={...t,cueVolume:Math.max(0,Math.min(1,t.cueVolume)),loopVolume:Math.max(0,Math.min(1,t.loopVolume))},tQ(),tV}function t5(e){return tJ.add(e),()=>{tJ.delete(e)}}let t4={schedule:(e,t)=>setTimeout(e,t),cancel:e=>clearTimeout(e)},t3=function(e,t="function"==typeof fetch?fetch:null,n=t4){let r=new Map,i=new Set,a=new Set,s=(e,n)=>{let s=r.get(n);return s||(i.has(n)||a.has(n)||!t||(a.add(n),(async()=>{try{let i=await t(n);if(!i.ok)throw Error(`asset ${i.status}`);r.set(n,await e.decodeAudioData(await i.arrayBuffer()))}catch{i.add(n)}finally{a.delete(n)}})()),null)},l=t=>{let n=e();if(!n)return null;if("running"!==n.state)return n.resume().catch(()=>void 0),s(n,t),null;let r=s(n,t);return r?{context:n,buffer:r}:null};return{cues:{start(e){let t=l(e.src);if(!t)return null;try{let{context:n,buffer:r}=t,i=n.createBufferSource();i.buffer=r;let a=n.createGain();a.gain.value=e.gain;let s=n.createStereoPanner?.();return s?(s.pan.value=e.pan,a.connect(s),s.connect(n.destination)):a.connect(n.destination),i.connect(a),i.onended=()=>e.onEnded(),i.start(n.currentTime+Math.max(0,e.delaySeconds)),{stop(){try{i.stop()}catch{}}}}catch{return null}}},loop:{start(e){let t=l(e.src);if(!t)return null;try{var r,i;let a,s,l,o,{context:c,buffer:d}=t,u=c.createBufferSource();u.buffer=d,u.loop=!0,u.loopStart=0,u.loopEnd=d.duration;let p=c.createGain();p.gain.value=e.gain;let m=(r=p.gain,a=i=e.gain,s=i,l=c.currentTime,o=c.currentTime,{rampTo(e,t){let n,i=c.currentTime,d=(n=c.currentTime)>=o?s:n<=l?a:a+(n-l)/(o-l)*(s-a),u=i+Math.max(.01,t);r.cancelScheduledValues(i),r.setValueAtTime(d,i),r.linearRampToValueAtTime(e,u),a=d,s=e,l=i,o=u}});u.connect(p),p.connect(c.destination);let f=d.duration>0?d.duration:0,h=f>0?Math.max(0,e.offsetSeconds??0)%f:0,x=c.currentTime;u.start(x,h);let g=!1,b=null,v=0,w=0,y=e=>f>0?e%f:0,k=()=>{null!==b&&(n.cancel(b),b=null)},j=()=>{k(),g=!0;try{u.stop()}catch{}};return{rampTo(e,t){g||m.rampTo(Math.max(0,e),t)},pause(e){if(g||null!==b)return w;let t=Math.max(.01,e);return w=y(y(h+Math.max(0,c.currentTime-x))+t),m.rampTo(0,t),v=c.currentTime+t,b=n.schedule(j,1e3*t),w},resume:()=>!g&&(null===b||(null!==b&&c.currentTime<v?(k(),!0):(j(),!1))),stop(e){if(g)return;k(),g=!0;let t=Math.max(.01,e);m.rampTo(0,t);try{u.stop(c.currentTime+t+.05)}catch{}}}}catch{return null}}},warm(t){let n=e();if(n)for(let e of t)s(n,e)},reset(){r.clear(),i.clear(),a.clear()}}}(()=>tT()),t6=null,t8=null,t7=null,t9=0,ne=!1,nt=!1,nn=new Set,nr=new Map;function ni(){ne||(ne=!0,t5(()=>{t9=0,nl()}))}function na(){var e;let t,n,r,i,a,s,l,o,c,d,u,p,m;return t8??=(t=(e={asset:tq,transport:t3.loop,prefs:t1}).schedule??((e,t)=>setTimeout(e,t)),n=e.cancel??(e=>clearTimeout(e)),r=null,i=null,a=0,s=!1,l=null,o=!1,c=null,d=()=>{let t=.35*Math.max(0,Math.min(1,e.prefs().loopVolume));return l?.25*t:o?.4*t:t},u=()=>{let{cuesEnabled:t,loopEnabled:n,viewerLoopEnabled:r}=e.prefs();return!!tz(e.asset)&&!!t&&(s?n:r)},p=()=>{let{cuesEnabled:t,loopEnabled:n,viewerLoopEnabled:r}=e.prefs();return tz(e.asset)&&t&&(n||r)},m=t=>{if(!u())return void(r?(p()?(a=r.pause(1.5),i=r):(r.stop(1.5),i=null,a=0),r=null):p()||(i=null,a=0));if(!r){if(i?.resume()){r=i,i=null,r.rampTo(d(),2.5);return}i=null,r=e.transport.start({src:e.asset,gain:0,offsetSeconds:a}),r?.rampTo(d(),2.5);return}r.rampTo(d(),t)},{configured:()=>tz(e.asset),setVoiceConnected(e){e!==s&&((s=e)||(l=null,o=!1,null!==c&&(n(c),c=null)),m(2.5))},setSpeaking(e){e!==l&&(l=e,m(e?.3:.9))},duckForCue(e){t_(e)&&(o=!0,null!==c&&n(c),c=t(()=>{c=null,o=!1,m(.9)},1200),m(.3))},refresh(){m(.9)},wanted:u,state:()=>({playing:null!==r,gain:r?d():0,ducked:!!l||o,resumeAt:a})}),ni(),t8}function ns(e){var t;let n,r,i,a,s;return(t6??=(n=(t={transport:t3.cues,prefs:t1}).maxConcurrent??3,r=t.dedupeCapacity??2048,i=new Set,a=new Map,s=0,{play({cue:e,eventId:l,pan:o=0,delayMs:c=0}){let d;if(i.has(l))return"deduped";if(i.add(l),!(i.size<=r))for(let e of i){if(i.size<=r)break;i.delete(e)}let{cuesEnabled:u,cueVolume:p}=t.prefs();if(!u)return"disabled";if(a.size>=n){let t=(()=>{let e=null;for(let[t,n]of a)(!e||tD[tL(n.cue)]<tD[tL(e.cue)])&&(e={key:t,cue:n.cue,handle:n.handle});return e})();if(!t||tD[tL(e)]<=tD[tL(t.cue)])return"dropped";t.handle.stop(),a.delete(t.key)}let m=++s,f=t.transport.start({cue:e,src:function(e,t=Math.random){let n=tR[e],r=n.variants?.length?n.variants[Math.min(n.variants.length-1,Math.floor(t()*n.variants.length))]:n.file;return`${tE}/${r}`}(e),gain:(d=Math.max(0,Math.min(1,p)),tO[tL(e)]*d),pan:Math.max(-1,Math.min(1,o)),delaySeconds:Math.max(0,c)/1e3,onEnded:()=>{a.delete(m)}});return f?(a.set(m,{cue:e,handle:f}),t_(e)&&t.onPriorityCue?.(e),"played"):"blocked"},activeVoices:()=>[...a.values()].map(e=>e.cue),reset(){for(let e of a.values())e.handle.stop();a.clear(),i.clear()}}),ni(),t6).play(e)}function nl(){let e=na();if(e.refresh(),null!==t7&&(clearTimeout(t7),t7=null),!e.wanted()||e.state().playing){t9=0;return}t9>=30||(t9+=1,t7=setTimeout(()=>{t7=null,nl()},700))}function no(e,t){if(t?nn.add(e):(nn.delete(e),nr.delete(e)),t9=0,nn.size>0)return void nd();if(!nt){var n;nt=!0,n=()=>{nt=!1,nd()},"function"==typeof queueMicrotask?queueMicrotask(n):setTimeout(n,0)}}function nc(){let e=null;for(let t of nr.values())e=t;return e}function nd(){let e=na();e.setVoiceConnected(nn.size>0),e.setSpeaking(nn.size>0?nc():null),nl()}function nu(e,t){nr.delete(e),t&&nr.set(e,t),na().setSpeaking(nn.size>0?nc():null)}let np={waiting:"waiting",returned:"returned",stalled:"stalled"};function nm(e,t){let n=e,r=new Set;for(;t[n]&&!r.has(n);)r.add(n),n=t[n];return r.has(n)?e:n}let nf="llvArchivedProjects";function nh(e){try{window.localStorage.setItem(nf,JSON.stringify([...e]))}catch{}}var nx=n(7650);let ng="llv:pipelines-changed",nb="llv:pipelines-patched",nv="llv:session-titles-changed";async function nw(e){let t,n;try{t=await fetch("/api/session/title",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({path:e.path,conversationId:e.conversationId,title:e.title,baseRevision:e.baseRevision,windowName:e.windowName})})}catch{return{ok:!1,status:0,error:"network"}}try{n=await t.json()}catch{return{ok:!1,status:t.status,error:"invalid response"}}return t.ok&&n.ok?(window.dispatchEvent(new Event(nv)),{ok:!0,override:n.override??null,revision:n.revision??0}):{ok:!1,status:t.status,error:n.error??"save failed",conflict:n.conflict??null}}let ny="llv:tasks-changed";function nk(){window.dispatchEvent(new Event(ny))}async function nj(e,t,n){try{let r=await fetch(e,{method:t,...void 0===n?{}:{headers:{"content-type":"application/json"},body:JSON.stringify(n)}}),i=await r.json().catch(()=>null);if(!r.ok||!i)return{ok:!1,status:r.status,error:i?.error??(0,eh.Tl)((0,eh.JK)(),"tasks.failed",{status:r.status})};return nk(),{ok:!0,data:i}}catch{return{ok:!1,status:0,error:(0,eh.Tl)((0,eh.JK)(),"common.serverUnavailable")}}}function nN(){return"function"==typeof crypto?.randomUUID?crypto.randomUUID():Date.now().toString(36)+Math.random().toString(36).slice(2,10)}async function nS(e){let t=await nj("/api/tasks","POST",e);return t.ok?{task:t.data.task}:{error:t.error}}function nC(e){return`/api/task-attachments?sha=${encodeURIComponent(e.sha256)}&ext=${encodeURIComponent(e.ext)}`}async function nA(e){let t=new FormData;t.set("file",e);try{let e=await fetch("/api/task-attachments",{method:"POST",body:t}),n=await e.json().catch(()=>null);if(!e.ok||!n?.attachment)return{error:n?.error??(0,eh.Tl)((0,eh.JK)(),"tasks.failed",{status:e.status})};return{attachment:n.attachment}}catch{return{error:(0,eh.Tl)((0,eh.JK)(),"common.serverUnavailable")}}}let nI=new Map;async function nM(e){let t=nI.get(e);return t&&await t!==null?(0,eh.Tl)((0,eh.JK)(),"tasks.textNotSaved"):null}function nT(e,t){let n=void 0!==t.text?nI.get(e):void 0,r=(async()=>{n&&await n;let r=await nj(`/api/tasks/${encodeURIComponent(e)}`,"PATCH",t);return r.ok||404!==r.status?r.ok?null:r.error:(nk(),null)})();return void 0!==t.text&&(nI.set(e,r),r.finally(()=>{nI.get(e)===r&&nI.delete(e)})),r}async function nP(e){let t=await nj(`/api/tasks/${encodeURIComponent(e)}`,"DELETE");return t.ok||404!==t.status?t.ok?null:t.error:(nk(),null)}async function n$(e,t){let n=await nM(e);if(n)return{error:n};let r=await nj(`/api/tasks/${encodeURIComponent(e)}/assignment`,"POST",{path:t});return r.ok?{task:r.data.task}:{error:r.error}}async function nE(e,t){let n=await nj(`/api/tasks/${encodeURIComponent(e)}/assignment`,"DELETE","string"==typeof t?{path:t}:t);return n.ok||404!==n.status?n.ok?null:n.error:(nk(),null)}async function nR(e,t){let n=await nM(e);if(n)return{error:n};let r=await nj(`/api/tasks/${encodeURIComponent(e)}/send`,"POST",{paths:t});return r.ok?r.data:{error:r.error}}async function nO(e,t){let n=await nM(e);if(n)return{error:n};let r=await nj(`/api/tasks/${encodeURIComponent(e)}/spawn`,"POST",{retryOfLaunchId:t});return r.ok?r.data:{error:r.error}}let nD="llv:workflows-changed";function nL(e){return e.startsWith("wf-")}let n_="llv:files-changed";function nF(){window.dispatchEvent(new Event(n_))}let nq=new TextEncoder,nz=new TextDecoder,nH=e=>nq.encode(e).length;function nU(e){return e&&"object"==typeof e&&!Array.isArray(e)?e:null}function nB(e){return"string"==typeof e?e:""}function nK(e,t){let n=[...e];return n.length>t?n.slice(0,t-1).join("")+"…":e}function nY(e){return"string"==typeof e?e:Array.isArray(e)?e.map(e=>{let t=nU(e);if(!t)return"";let n=nB(t.type);return"text"===n||"input_text"===n||"output_text"===n?nB(t.text):""}).filter(Boolean).join("\n"):""}function nW(e){let t=nU(e);if(!t)return null==e||""===e?{}:nW({input:e});let n={},r=0;for(let[e,i]of Object.entries(t)){let t;if(r>=12)break;if("string"==typeof i)t=nK(i,256);else if("number"==typeof i||"boolean"==typeof i||null===i)t=i;else{let e;if(void 0===i)continue;try{e=JSON.stringify(i)??""}catch{e=""}if(!e)continue;t=nK(e,256)}n[e]=t,r+=1}let i=Object.entries(n);for(;i.length&&nH(JSON.stringify(Object.fromEntries(i)))>2048;)i=i.slice(0,-1);return Object.fromEntries(i)}let nV=new Set(["commandExecution","fileChange","mcpToolCall","dynamicToolCall","collabAgentToolCall","webSearch","imageView","imageGeneration"]);function nJ(e,t){let n=nU(e),r=nU(n?.message),i=r?.[t];return"number"==typeof i&&Number.isFinite(i)&&i>0?Math.floor(i):0}function nG(e){let t=nU(e);return t?{name:nK(nB(t.name)||"tool",128),engine:"codex"===t.engine?"codex":"claude",status:"ok"===t.status?"ok":"err"===t.status?"err":"unknown"===t.status?"unknown":"run",args:nW(t.args),...!0===t.argsOmitted?{argsOmitted:!0}:{}}:null}function nQ(e){return Array.isArray(e)?e.filter(e=>e&&"string"==typeof e.text&&(e.text.length>0||(e.omittedChars??0)>0||(e.omittedItems??0)>0||null!==nG(e.tool))).map(e=>{let t=nG(e.tool);return{itemId:"string"==typeof e.itemId?e.itemId:null,text:t?"":e.text,phase:t||"awaiting-echo"===e.phase?"awaiting-echo":"streaming",startedAt:"string"==typeof e.startedAt?e.startedAt:null,completedAt:"string"==typeof e.completedAt?e.completedAt:null,..."number"==typeof e.omittedChars&&e.omittedChars>0?{omittedChars:Math.floor(e.omittedChars)}:{},..."number"==typeof e.omittedItems&&e.omittedItems>0?{omittedItems:Math.floor(e.omittedItems)}:{},...t?{tool:t}:{}}}):[]}function nX(e){return Array.isArray(e.items)||Array.isArray(e.overflow)?[...nQ(e.overflow),...nQ(e.items)]:e.text?[{itemId:null,text:e.text,phase:"streaming",startedAt:null,completedAt:null}]:[]}function nZ(e,t){let n=t.length>544?t.length-544+1:0,r=t.slice(0,n),i=r.length?[{itemId:null,text:"",phase:"awaiting-echo",startedAt:r[0]?.startedAt??null,completedAt:r.at(-1)?.completedAt??null,omittedItems:r.reduce((e,t)=>e+(t.omittedItems??1),0),omittedChars:r.reduce((e,t)=>e+[...t.text].length+(t.omittedChars??0),0)},...t.slice(n)]:t,a=i.reduce((e,t)=>e+nH(t.text),0)-65536;a>0&&(i=i.map(e=>{if(a<=0)return e;let t=nH(e.text),n=function(e,t){let n=nq.encode(e),r=Math.min(t,n.length);for(;r<n.length&&(192&n[r])==128;)r+=1;return{omittedChars:[...nz.decode(n.subarray(0,r))].length,text:nz.decode(n.subarray(r))}}(e.text,a);return a-=t-nH(n.text),{...e,text:n.text,omittedChars:(e.omittedChars??0)+n.omittedChars}}));let s=32768,l=new Set;for(let e=i.length-1;e>=0;e-=1){let t=i[e].tool;if(!t)continue;let n=function(e){if(!Object.keys(e.args).length)return 0;try{return nH(JSON.stringify(e.args))}catch{return 0}}(t);if(n){if(n<=s){s-=n;continue}l.add(e)}}if(l.size&&(i=i.map((e,t)=>l.has(t)&&e.tool?{...e,tool:{...e.tool,args:{},argsOmitted:!0}}:e)),!i.length)return null;let o=Math.max(0,i.length-32),c=i.slice(0,o),d=i.slice(o);return{turnId:e,text:i.findLast(e=>!e.tool&&e.text)?.text??"",items:d,...c.length?{overflow:c}:{}}}function n0(e,t,n){if(!e)return[];let r=nX(e);return e.turnId===t?r:r.map(e=>"streaming"===e.phase?{...e,phase:"awaiting-echo",completedAt:e.completedAt??n}:e)}function n1(e){return e&&"object"==typeof e&&!Array.isArray(e)?e:null}function n2(e){return"string"==typeof e?e:""}function n5(e,t){return`voice:${JSON.stringify([e,t.map(e=>e.responseId)])}`}function n4(e){return Array.isArray(e)?e.flatMap(e=>{let t=n1(e),n=n2(t?.turnId),r=Array.isArray(t?.responses)?t.responses.flatMap(e=>{let t=n1(e),n=n2(t?.responseId);return n&&"string"==typeof t?.text?[{responseId:n,text:t.text}]:[]}):[];if(!n||0===r.length)return[];let i=n2(t?.sourceTurnId),a=n1(t?.streamChunk),s=a?.index,l=a?.startOffset,o=a?.endOffset,c=i&&Number.isInteger(s)&&Number.isInteger(l)&&Number.isInteger(o)&&s>=0&&l>=0&&o>l;return[{deliveryId:n5(n,r),turnId:n,responses:r,ready:t?.ready===!0,...c?{sourceTurnId:i,streamChunk:{index:s,startOffset:l,endOffset:o}}:{}}]}):[]}function n3(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if("string"!=typeof n||!n)continue;let e=t.indexOf(n);e>=0&&t.splice(e,1),t.push(n)}return t.slice(-256)}function n6(){return{cursor:0,retentionFloorSeq:0,filesRevision:0,hostEpoch:0,health:"unknown",scopeHeads:{},sessions:{},attentions:{},operations:{},edges:{},flows:{},workflows:{},tasks:{},deployments:{}}}function n8(e){let t={},n={};for(let r of e.sessions)n[r.conversationId]={...r,attentionIds:[...r.attentionIds],recentReceipts:[...r.recentReceipts],...r.voiceDeliveries?{voiceDeliveries:n4(r.voiceDeliveries)}:{},...r.acknowledgedVoiceDeliveryIds?{acknowledgedVoiceDeliveryIds:n3(r.acknowledgedVoiceDeliveryIds)}:{}},t[`session:${r.conversationId}`]=r.revision;let r={};for(let n of e.recentOperations)r[n.operationId]=n,t[`operation:${n.operationId}`]=n.revision;let i={};for(let n of e.edges)i[n.id]=n,t[`edge:${n.id}`]=n.revision;let a={};for(let{revision:n,value:r}of e.flows)a[r.id]=r,t[`flow:${r.id}`]=n;let s={};for(let{revision:n,value:r}of e.workflows)s[r.id]=r,t[`workflow:${r.id}`]=n;let l={};for(let{revision:n,value:r}of e.tasks)l[r.id]=r,t[`task:${r.id}`]=n;let o={};for(let n of e.deployments??[])o[n.deploymentId]=n,t[`deployment:${n.deploymentId}`]=n.revisionNumber;return{cursor:e.snapshotSeq,retentionFloorSeq:e.retentionFloorSeq,filesRevision:e.filesRevision,hostEpoch:e.runtime.hostEpoch,health:e.runtime.health,scopeHeads:t,sessions:n,attentions:function(e){let t={};for(let n of e)t[n.id]=n;return t}(e.attentions),operations:r,edges:i,flows:a,workflows:s,tasks:l,deployments:o}}function n7(e,t){return{conversationId:e,sessionKey:t.sessionKey??{engine:"codex",sessionId:e},hostKind:t.hostKind??"unhosted",host:t.host??"registering",turn:t.turn??"unknown",provenance:t.provenance??"structured",revision:0,attentionIds:[],recentReceipts:[],accountId:t.accountId??null,parentConversationId:t.parentConversationId??null,flowId:t.flowId??null,workflowId:t.workflowId??null,cwd:t.cwd??null,artifactPath:t.artifactPath??null,capabilities:t.capabilities??{steer:!1,structuredAttention:!1},activeTurnId:t.activeTurnId??null,pendingReconfigure:t.pendingReconfigure??null,drift:null}}function n9(e,t,n,r){let i=e.sessions[t]??n7(t,{}),a=n>i.revision?n:i.revision;e.sessions={...e.sessions,[t]:{...r(i),revision:a}}}function re(e,t){return"dead"===e.host?"dead":"conflict"===e.host?"conflict":"recovering"===e.host?"recovering":"unhosted"===e.host?"unhosted":t?"waiting_input":"running"===e.turn||"interrupt_requested"===e.turn?"working":"idle"===e.turn?"idle":"unknown"}function rt(e,t){return t.attentionIds.some(t=>e.attentions[t]?.state==="open")}function rn(e){return"delivered"===e||"applied"===e||"answered"===e||"rejected"===e||"failed"===e||"interrupted"===e}let rr={"dead-host":"receipt.human.deadHost","host-dead":"receipt.human.deadHost","no-host":"receipt.human.deadHost",unhosted:"receipt.human.deadHost","host-unavailable":"receipt.human.deadHost","stale-delivery-key":"receipt.human.staleKey",duplicate:"receipt.human.duplicate","turn-active":"receipt.human.turnActive","busy-turn":"receipt.human.turnActive","no-active-turn":"receipt.human.noTurn","stale-generation":"receipt.human.staleKey","stale-turn":"receipt.human.staleKey","unsupported-capability":"receipt.human.unsupportedCapability"};function ri(e){return e?rr[e.trim().toLowerCase()]??null:null}function ra(e){return"queued"===e||"delivering"===e||"turn-started"===e||"steered"===e||"delivered"===e||"answered"===e}function rs(){try{if("u">typeof crypto&&"function"==typeof crypto.randomUUID)return`op_${crypto.randomUUID()}`}catch{}return`op_${Date.now().toString(36)}_${Math.random().toString(36).slice(2)}`}n(1463);var rl=n(1463);let ro="llv:stream-reconnected";class rc extends Error{}function rd(){if(!function(e){if(void 0===e)return!1;switch(e.trim().replace(/^(["'])([\s\S]*)\1$/,"$2").trim().toLowerCase()){case"0":case"false":case"off":case"no":return!0;default:return!1}}(rl.env.NEXT_PUBLIC_RUNTIME_UI))return!0;try{return"1"===window.localStorage.getItem("llv_runtime_ui")}catch{return!1}}let ru=null;function rp(){return ru||(ru=function(e){let t={store:n6(),connection:"offline",resyncedAt:null,lastEventAt:null,enabled:!1,structuredHostsEnabled:!1},n=new Set,r=new Set,i=!1,a=null,s=0,l=!1,o=!1,c=!1,d=0,u=null,p=null,m=null,f=null,h=null,x=null,g=0,b=0,v=0;function w(){i||0===n.size||(i=!0,e.setTimeout(()=>{for(let e of(i=!1,n))e()},16))}function y(e){let n=t.connection;"live"===(t={...t,...e}).connection&&"live"!==n&&window.dispatchEvent(new Event(ro)),w()}function k(t){return t&&e.clearTimeout(t),null}function j(){g+=1,h&&e.clearInterval(h),h=null,x=k(x)}function N(){if(s+=1,p=k(p),a)try{a.close()}catch{}a=null}function S(){null===u&&"live"!==t.connection&&y({connection:"live"}),p=k(p),p=e.setTimeout(()=>{$()},2e4)}function C(){d=0,u=null,S()}async function A(){let t=await e.fetch("/api/runtime/snapshot",{headers:{accept:"application/json"}});if(t.ok)return await t.json();if(503===t.status){let e=null;try{e=(await t.json())?.code??null}catch{e=null}if("runtime-plane-absent"===e)throw new rc("runtime plane absent")}throw Error(`snapshot ${t.status}`)}function I(){N(),j(),m=k(m),f=k(f),o=!1,d=0,u=null,t={store:n6(),connection:"offline",resyncedAt:null,lastEventAt:null,enabled:!1,structuredHostsEnabled:!1},w()}function M(){c=!0,I()}async function T(t){if(l)return;l=!0;let n=s;try{let r=await A();if(n!==s)return;o=!0,y({store:n8(r),lastEventAt:e.now(),structuredHostsEnabled:!0===r.structuredHostsEnabled}),t&&(y({resyncedAt:e.now()}),f=k(f),f=e.setTimeout(()=>{f=null,y({resyncedAt:null})},6e3)),P(r.snapshotSeq)}catch(e){if(e instanceof rc)return M();if(n!==s)return;$()}finally{l=!1}}function P(n){let i;N();let l=s,o=`/api/runtime/stream?after=${encodeURIComponent(String(n))}`;try{i=e.createEventSource(o)}catch{$();return}a=i,i.onopen=()=>{l===s&&S()},i.onmessage=n=>{l===s&&function(n){let i;try{i=JSON.parse(n)}catch{return}y({lastEventAt:e.now()});let a=function(e,t){var n;if("files.revision"===t.kind){let n=function(e){if(e&&"object"==typeof e&&"filesRevision"in e){let t=e.filesRevision;if("number"==typeof t)return t}return 0}(t.payload);return n<=e.filesRevision?{outcome:"duplicate"}:{outcome:"applied",store:{...e,filesRevision:n,cursor:Math.max(e.cursor,t.seq)},filesBumped:!0}}if(t.seq<=e.cursor)return{outcome:"duplicate"};let r=(n=t.scope,`${n.type}:${n.id}`),i=e.scopeHeads[r]??0,a=t.revision??i+1;if(a<=i)return{outcome:"duplicate"};if(a>i+1)return{outcome:"gap",scope:r,expected:i+1,got:a};let s={...e,cursor:t.seq,scopeHeads:{...e.scopeHeads,[r]:a}};return function(e,t,n){switch(t.kind){case"session-status":{let r=t.payload,i=r.conversationId??t.scope.id,a=e.sessions[i],s={...a??n7(i,r),...r,conversationId:i,revision:n,attentionIds:r.attentionIds??a?.attentionIds??[],recentReceipts:a?.recentReceipts??[],acknowledgedVoiceDeliveryIds:n3(r.acknowledgedVoiceDeliveryIds??a?.acknowledgedVoiceDeliveryIds)};e.sessions={...e.sessions,[i]:s};break}case"turn-started":{let r=t.payload;n9(e,r.conversationId??t.scope.id,n,e=>({...e,turn:"running",activeTurnId:r.turnId??e.activeTurnId}));break}case"delta":{let r=t.payload,i="string"==typeof r.text?r.text:"";if(!i)break;n9(e,r.conversationId??t.scope.id,n,e=>{let n=r.turnId??e.activeTurnId??"unknown";return{...e,liveTurn:function(e,t,n,r=null){if(!n)return e??null;let i=n0(e,t,r),a=i.at(-1);return nZ(t,a?.phase!=="streaming"||a.tool?[...i,{itemId:null,text:n,phase:"streaming",startedAt:r,completedAt:null}]:[...i.slice(0,-1),{...a,text:a.text+n}])}(e.liveTurn,n,i,t.occurredAt??t.recordedAt??null)}});break}case"item":{let r=t.payload;if("completed"!==r.phase&&"started"!==r.phase)break;let i=r.phase;n9(e,r.conversationId??t.scope.id,n,e=>{var n,a;let s,l,o,c,d,u,p=r.turnId??e.activeTurnId??"unknown",m=r.voiceResponse;return{...e,liveTurn:function(e,t,n,r,i=null){let a,s,l="completed"===r?function(e){let t=nU(e);if(!t)return null;let n=nB(t.type),r=nU(t.message),i=nB(t.role)||nB(r?.role);return"agentMessage"!==n&&"agent_message"!==n&&"assistant"!==n&&("message"!==n||"assistant"!==i)?null:{itemId:nB(t.id)||nB(t.uuid)||nB(r?.id)||null,text:nB(t.text)||nY(t.content)||nY(r?.content)}}(n):null,o=function(e,t){let n=nU(e);if(!n)return[];let r=nB(n.type),i=nU(n.message),a=nB(n.role)||nB(i?.role),s=Array.isArray(i?.content)?i.content:Array.isArray(n.content)?n.content:null;if(("assistant"===r||"assistant"===a)&&s)return"completed"!==t?[]:s.flatMap(e=>{let t=nU(e);if(!t||"tool_use"!==nB(t.type))return[];let n=nB(t.id);return n?[{callId:n,name:nB(t.name)||"tool",engine:"claude",status:"run",args:nU(t.input)??{},...!0===t.inputOmitted?{argsOmitted:!0}:{},finished:!1}]:[]});if(("user"===r||"user"===a)&&s)return s.flatMap(e=>{let t=nU(e);if(!t||"tool_result"!==nB(t.type))return[];let n=nB(t.tool_use_id);return n?[{callId:n,name:null,engine:"claude",status:!0===t.is_error?"err":"ok",args:null,finished:!0}]:[]});let l=function(e,t,n){let r,i=nB(e.id)||nB(e.call_id)||nB(e.callId);if(!i||!nV.has(t))return null;let a="started"===n?"run":"inprogress"===(r=nB(e.status).toLowerCase())||"in_progress"===r||"running"===r||"pending"===r?"run":"failed"===r||"error"===r||"errored"===r||"declined"===r||"cancelled"===r||"canceled"===r||"commandExecution"===t&&"number"==typeof e.exitCode&&0!==e.exitCode||"mcpToolCall"===t&&void 0!==e.error&&null!==e.error||"dynamicToolCall"===t&&!1===e.success||"imageGeneration"===t&&void 0!==e.failure&&null!==e.failure?"err":"ok",s="completed"===n;if("commandExecution"===t){let t=nB(e.command),n=nB(e.cwd);return{callId:i,name:"shell",engine:"codex",status:a,args:{...t?{cmd:t}:{},...n?{workdir:n}:{}},finished:s}}if("fileChange"===t){let t=(Array.isArray(e.changes)?e.changes.map(nU).filter(Boolean):[]).slice(0,8).flatMap(e=>{let t=nB(e?.path);if(!t)return[];let n=nB(e?.kind).toLowerCase();return[`*** ${"add"===n?"Add":"delete"===n?"Delete":"Update"} File: ${t}`]});return{callId:i,name:"apply_patch",engine:"codex",status:a,args:t.length?{input:["*** Begin Patch",...t,"*** End Patch"].join("\n")}:{},finished:s}}if("mcpToolCall"===t){let t=nB(e.server),n=nB(e.tool)||"tool";return{callId:i,name:t?`mcp__${t}__${n}`:n,engine:"codex",status:a,args:nU(e.arguments)??{},finished:s}}return"dynamicToolCall"===t?{callId:i,name:nB(e.tool)||"tool",engine:"codex",status:a,args:nU(e.arguments)??{},finished:s}:"collabAgentToolCall"===t?{callId:i,name:nB(e.tool)||"Agent",engine:"codex",status:a,args:{...nB(e.prompt)?{prompt:nB(e.prompt)}:{},...nB(e.model)?{model:nB(e.model)}:{}},finished:s}:"webSearch"===t?{callId:i,name:"WebSearch",engine:"codex",status:a,args:{...nB(e.query)?{query:nB(e.query)}:{}},finished:s}:"imageView"===t?{callId:i,name:"view_image",engine:"codex",status:a,args:{...nB(e.path)?{path:nB(e.path)}:{}},finished:s}:{callId:i,name:"imagegen",engine:"codex",status:a,args:{...nB(e.revisedPrompt)?{prompt:nB(e.revisedPrompt)}:{}},finished:s}}(n,r,t);return l?[l]:[]}(n,r),c="completed"===r?nJ(n,"omittedToolCalls"):0,d="completed"===r?nJ(n,"omittedToolResults"):0;if(!l&&!o.length&&!c&&!d)return e??null;let u=n0(e,t,i),p=u;for(let e of(l&&(p=function(e,t,n){let r=t.itemId?e.findIndex(e=>!e.tool&&e.itemId===t.itemId):-1;if(r>=0){let i=e[r],a=e.slice();return a[r]={...i,text:t.text||i.text,...t.text?{omittedChars:void 0}:{},phase:"awaiting-echo",completedAt:n},a}let i=e.at(-1);return i?.phase!=="streaming"||i.tool?t.text?[...e,{itemId:t.itemId,text:t.text,phase:"awaiting-echo",startedAt:n,completedAt:n}]:e:[...e.slice(0,-1),{...i,itemId:t.itemId,text:t.text||i.text,...t.text?{omittedChars:void 0}:{},phase:"awaiting-echo",completedAt:n}]}(p,l,i)),o))p=function(e,t,n){let r=e.findIndex(e=>e.tool&&e.itemId===t.callId);if(r>=0){let i=e[r],a=i.tool,s=e.slice();return s[r]={...i,completedAt:t.finished?n:i.completedAt,tool:{...a,name:t.name?nK(t.name,128):a.name,status:t.finished||"run"===a.status?t.status:a.status,...t.args&&Object.keys(t.args).length&&!a.argsOmitted?{args:nW(t.args)}:{}}},s}return[...e,{itemId:t.callId,text:"",phase:"awaiting-echo",startedAt:n,completedAt:t.finished?n:null,tool:{name:nK(t.name||"tool",128),engine:t.engine,status:t.status,args:nW(t.args??{}),...t.argsOmitted?{argsOmitted:!0}:{}}}]}(p,e,i);return(p=function(e,t,n,r){if(!t)return e;let i=r?Date.parse(r):NaN,a=[];e.forEach((e,t)=>{let r=e.tool;if(!r||"claude"!==r.engine||"run"!==r.status||e.itemId&&n.has(e.itemId))return;let s=e.startedAt?Date.parse(e.startedAt):NaN;(Number.isNaN(i)||Number.isNaN(s)||!(s>i))&&a.push(t)});let s=new Set(a.slice(-t));return s.size?e.map((e,t)=>s.has(t)&&e.tool?{...e,completedAt:r,tool:{...e.tool,status:"unknown"}}:e):e}(p=function(e,t,n,r){if(!t)return e;let i=n?`omitted-tools:${n}`:null,a=i?e.findIndex(e=>e.itemId===i):-1;if(a>=0){let n=e[a];if((n.omittedItems??0)>=t)return e;let r=e.slice();return r[a]={...n,omittedItems:t},r}return[...e,{itemId:i,text:"",phase:"awaiting-echo",startedAt:r,completedAt:r,omittedItems:t}]}(p,c,(a=nU(n),s=nU(a?.message),nB(a?.id)||nB(a?.uuid)||nB(s?.id)||null),i),d,new Set(o.filter(e=>e.finished).map(e=>e.callId)),i))===u?e??null:nZ(t,p)}(e.liveTurn,p,r.item,i,t.occurredAt??t.recordedAt??null),voiceDeliveries:"completed"===i&&"string"==typeof m?.responseId&&"string"==typeof m.text?(n=e.voiceDeliveries,a={responseId:m.responseId,text:m.text},d=(c=(o=(l=(s=n4(n)).findIndex(e=>e.turnId===p))>=0?s[l]:{deliveryId:"",turnId:p,responses:[],ready:!1}).responses.findIndex(e=>e.responseId===a.responseId))>=0?o.responses.map((e,t)=>t===c?a:e):[...o.responses,a],u={deliveryId:n5(p,d),turnId:p,responses:d,ready:o.ready},l<0?[...s,u]:s.map((e,t)=>t===l?u:e)):e.voiceDeliveries}});break}case"voice-chunk":{let r=t.payload,i=n4([r.voiceDelivery])[0];n9(e,r.conversationId??t.scope.id,n,e=>({...e,voiceDeliveries:i?function(e,t){let n=n4(e),r=n4([t])[0];if(!r?.ready)return n;let i=n.find(e=>e.deliveryId===r.deliveryId);if(i){if(JSON.stringify(i)!==JSON.stringify(r))throw Error("voice delivery id belongs to different content");return n}return[...n,r]}(e.voiceDeliveries,i):e.voiceDeliveries}));break}case"turn-ended":{let r=t.payload;n9(e,r.conversationId??t.scope.id,n,e=>{var t,n,i,a;let s,l;return{...e,turn:"idle",activeTurnId:null,voiceDeliveries:r.turnId?(t=e.voiceDeliveries,n=r.turnId,i=r.outcome??"",a=e.acknowledgedVoiceDeliveryIds,l=(s=n4(t)).findIndex(e=>e.turnId===n),"completed"!==i?s.filter(e=>e.turnId!==n&&e.sourceTurnId!==n):l<0||s[l].ready?s:n3(a).includes(s[l].deliveryId)?s.filter((e,t)=>t!==l):s.map((e,t)=>t===l?{...e,ready:!0}:e)):e.voiceDeliveries}});break}case"voice-delivery-acknowledged":{let r=t.payload;n9(e,r.conversationId??t.scope.id,n,e=>{var t,n;let i=r.deliveryId??"";return{...e,voiceDeliveries:(t=e.voiceDeliveries,n4(t).filter(e=>e.deliveryId!==i)),acknowledgedVoiceDeliveryIds:(n=e.acknowledgedVoiceDeliveryIds,n3([...n3(n),i]))}});break}case"voice-delivery-progress":n9(e,t.payload.conversationId??t.scope.id,n,e=>e);break;case"attention":{let r=t.payload;e.attentions={...e.attentions,[r.id]:r},n9(e,r.conversationId,n,e=>e.attentionIds.includes(r.id)?e:{...e,attentionIds:[...e.attentionIds,r.id]});break}case"attention-resolved":{let r=t.payload,i=r.attentionId??r.id;if(!i)break;let a=e.attentions[i];a&&(e.attentions={...e.attentions,[i]:{...a,state:r.state??"resolved",unowned:!1}});let s=r.conversationId??a?.conversationId;s&&n9(e,s,n,e=>({...e,attentionIds:e.attentionIds.filter(e=>e!==i)}));break}case"receipt":{let r=t.payload,i={...r,revision:n};e.operations={...e.operations,[r.operationId]:i},n9(e,r.conversationId,e.sessions[r.conversationId]?.revision??0,e=>{var t,n;let r;return{...e,recentReceipts:(t=e.recentReceipts,n=i,r=t.filter(e=>e.operationId!==n.operationId),[n,...r].slice(0,8))}});break}case"edge.created":{let r=t.payload;e.edges={...e.edges,[r.id]:{...r,revision:n}};break}case"flow.state":{let n=t.payload;e.flows={...e.flows,[n.id]:n};break}case"reconcile.drift":{let r=t.payload;n9(e,r.conversationId,n,e=>({...e,drift:r}));break}case"deployment.state":{let n=t.payload;e.deployments={...e.deployments,[n.deploymentId]:n}}}}(s,t,a),{outcome:"applied",store:s,filesBumped:!1}}(t.store,i);if("applied"===a.outcome){if(y({store:a.store}),C(),a.filesBumped)for(let e of r)e(a.store.filesRevision)}else"duplicate"===a.outcome?C():T(!0)}(n.data)},i.onerror=()=>{l===s&&$()},i.addEventListener("heartbeat",()=>{l===s&&(y({lastEventAt:e.now()}),C())}),i.addEventListener("fault",e=>{if(l===s){try{let t=JSON.parse(e.data);if("runtime-host-unavailable"!==t.code)return}catch{return}$()}}),i.addEventListener("reset",()=>{l===s&&T(!0)})}function $(){let t,n;N();let r=e.now();(null===u&&(u=r),r-u>=15e3)?(N(),j(),t=g,y({connection:"degraded"}),O(t),h=e.setInterval(()=>void O(t),1e4),x=e.setTimeout(()=>{x=null,j(),u=null,d=0,E()},6e4)):(y({connection:"reconnecting"}),m=k(m),n=Math.min(500*2**d,8e3),d+=1,m=e.setTimeout(()=>{m=null,E()},n))}function E(){o?R():T(!1)}async function R(){let e=s;try{let n=await A();if(e!==s)return;y({structuredHostsEnabled:!0===n.structuredHostsEnabled}),P(t.store.cursor)}catch(t){if(t instanceof rc)return M();if(e!==s)return;$()}}async function O(n){let i=++b;try{let a=await A();if(n!==g||a.snapshotSeq<t.store.cursor||a.snapshotSeq===t.store.cursor&&i<v)return;v=Math.max(v,i);let s=t.store.filesRevision;if(y({store:n8(a),lastEventAt:e.now(),connection:"degraded",structuredHostsEnabled:!0===a.structuredHostsEnabled}),a.filesRevision>s)for(let e of r)e(a.filesRevision)}catch(i){if(i instanceof rc)return M();if(n!==g)return;let r=t.lastEventAt;null!==r&&e.now()-r>=6e4&&"offline"!==t.connection&&y({connection:"offline"})}}return{getState:()=>t,subscribe:e=>(n.add(e),()=>n.delete(e)),subscribeFilesRevision:e=>(r.add(e),()=>r.delete(e)),start(){c||t.enabled||(y({enabled:!0,connection:"reconnecting"}),T(!1))},stop(){I()},async refresh(){let n=s;try{let r=await A();if(n!==s||r.snapshotSeq<t.store.cursor)return!0;return o=!0,y({store:n8(r),lastEventAt:e.now(),structuredHostsEnabled:!0===r.structuredHostsEnabled}),!0}catch(e){return e instanceof rc&&M(),!1}}}}({fetch:(e,t)=>fetch(e,t),createEventSource:e=>new EventSource(e),now:()=>Date.now(),setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)})),ru}let rm={tmux:{status:"healthy"}},rf={files:[],pinOverlayPaths:[],requestScope:null,projectCatalog:[],projectAliases:{},projectDisplayNames:{},crownedProjects:[],projectCwds:{},flows:[],pipelines:[],workflows:[],tasks:[],systemHealth:rm,conversationAliases:{},launchRoutes:{},loaded:!1,catalogFailures:0};function rh(e,t){let n=[];return t&&n.push("path="+encodeURIComponent(t)),n.length?"/api/files?"+n.join("&"):"/api/files"}function rx(e,t){return JSON.stringify(e)===JSON.stringify(t)}function rg(e,t,n){let r=new Map(e.map(e=>[n(e),e])),i=t.map(e=>{let t=r.get(n(e));return void 0!==t&&rx(t,e)?t:e});return i.length===e.length&&i.every((t,n)=>t===e[n])?e:i}function rb(e,t){return{...t,files:rg(e.files,t.files,e=>e.path),projectCatalog:rg(e.projectCatalog,t.projectCatalog,e=>e.project),projectAliases:rx(e.projectAliases,t.projectAliases)?e.projectAliases:t.projectAliases,projectDisplayNames:rx(e.projectDisplayNames,t.projectDisplayNames)?e.projectDisplayNames:t.projectDisplayNames,crownedProjects:rx(e.crownedProjects,t.crownedProjects)?e.crownedProjects:t.crownedProjects,projectCwds:rx(e.projectCwds,t.projectCwds)?e.projectCwds:t.projectCwds,flows:rg(e.flows,t.flows,e=>e.id),pipelines:rg(e.pipelines,t.pipelines,e=>e.id),workflows:rg(e.workflows,t.workflows,e=>e.id),tasks:rg(e.tasks,t.tasks,e=>e.id),systemHealth:rx(e.systemHealth,t.systemHealth)?e.systemHealth:t.systemHealth,conversationAliases:rx(e.conversationAliases,t.conversationAliases)?e.conversationAliases:t.conversationAliases,launchRoutes:rx(e.launchRoutes,t.launchRoutes)?e.launchRoutes:t.launchRoutes}}let rv=(H=(e,t)=>fetch(e,t),i=rf,a=!1,s=new Map,l=new Map,o=new Map,c=0,d=0,u=Promise.resolve(),p=new Map,m=rf.pipelines,f=new Map,h=0,x=e=>e.catalogFailures===h?e:{...e,catalogFailures:h},g=e=>{if(!p.size)return[...e];let t=new Set,n=e.flatMap(e=>{let n=p.get(e.id);return n?(t.add(e.id),n.pipeline?[n.pipeline]:[]):[e]});for(let[e,r]of p)!t.has(e)&&r.pipeline&&n.push(r.pipeline);return n},b=e=>{if(!f.size)return e;let t=[...f.values()].filter(t=>!e.files.some(e=>e.path===t.path||void 0!==t.conversationId&&e.conversationId===t.conversationId));return t.length?{...e,files:[...e.files,...t]}:e},v=e=>{let t;return x({...t=b(s.get(e)?.data??(i.requestScope===e?i:{...rf,requestScope:e})),pipelines:g(t.pipelines)})},w=(e,t="background")=>{if(!a)for(let[n,r]of l){if(void 0!==e){e===r&&n(x(b(i)),t);continue}n(v(r),t)}},y=e=>{if(a)return;let t=e?0:h+1;t!==h&&(h=t,w(void 0,"urgent"))},k=e=>[...l.values()].some(t=>t===e),j=e=>{let t=o.get(e);t&&(o.delete(e),t.phase="canceled",void 0!==t.timer&&clearTimeout(t.timer),t.controller?.abort())},N=(e,t)=>"canceled"!==t.phase&&o.get(e)===t&&k(e),S=()=>{i={...i,pipelines:g(m)}},C=(e,t)=>{if(m=i.pipelines,t)for(let[t,n]of p)n.minGeneration<=e&&p.delete(t);p.size&&S()},A=()=>{for(;s.size>8;){let e=[...s.keys()].find(e=>!k(e));if(void 0===e)break;s.delete(e)}},I=(e,t,n)=>{s.delete(e),s.set(e,{data:t,etag:n}),A()},M=async(e,t,n,r,i=0,a)=>{try{let s=await T(e,t,n,r,i,a);return y(!0),s}catch(e){throw e instanceof Error&&"AbortError"===e.name||y(!1),e}},T=async(e,t,n,r,l=0,o)=>{var u,p,m,h,x;let g,b;if(a)return i;let v=rh(void 0,e);if(o){if(!N(v,o))return i;o.phase="active",o.controller=new AbortController}let y=++c,k=s.get(v),S=(u=k?.etag??"",p=t,m=n,b={},u&&(b["If-None-Match"]=u),void 0!==p&&(b["x-llv-files-revision"]=String(p)),void 0!==m&&(b["x-llv-files-generation"]=String(m)),Object.keys(b).length>0?b:void 0),A=S||o?.controller?{...S?{headers:S}:{},...o?.controller?{signal:o.controller.signal}:{}}:void 0;try{g=await H(v,A)}finally{o&&(o.controller=void 0)}if(a||o&&!N(v,o))return i;let M=rj(g,"x-llv-files-generation"),T=rj(g,"x-llv-files-target-generation"),P="stale"===g.headers.get("x-llv-files-projection-cache"),E=T??M??n,R=void 0!==E&&(P||void 0!==M&&void 0!==T&&M<T);if(304===g.status){if(!k)throw Error("files request returned 304 without a cached representation");if(y<d)return i;let n=i;return(i!==k.data||i.requestScope!==v)&&(h=i,x=k.data,i=rb(h,{...x,requestScope:v})),d=y,I(v,i,k.etag),C(r??y,!R),i!==n&&w(v),R&&void 0!==E?$(v,e,t,E,r??y,l,o):j(v),i}if(!g.ok)throw Error(`files request failed: ${g.status}`);let O=JSON.parse(await g.text());if(o&&!N(v,o)||y<d)return i;let D=Array.isArray(O)?{files:O,pinOverlayPaths:[],requestScope:v,projectCatalog:[],projectAliases:{},projectDisplayNames:{},crownedProjects:[],projectCwds:{},flows:[],pipelines:[],workflows:[],tasks:[],systemHealth:rm,conversationAliases:{},launchRoutes:{},loaded:!0,catalogFailures:0}:{files:O.files??[],pinOverlayPaths:O.pinOverlayPaths??[],requestScope:v,projectCatalog:O.projectCatalog??[],projectAliases:O.projectAliases??{},projectDisplayNames:O.projectDisplayNames??{},crownedProjects:O.crownedProjects??[],projectCwds:O.projectCwds??{},flows:O.flows??[],pipelines:O.pipelines??[],workflows:O.workflows??[],tasks:O.tasks??[],pipelinesError:O.pipelinesError,systemHealth:O.systemHealth??rm,conversationAliases:O.conversationAliases??{},launchRoutes:O.launchRoutes??{},loaded:!0,catalogFailures:0};for(let[e,t]of f)(void 0!==D.launchRoutes[e]||D.files.some(n=>n.path===e||void 0!==t.conversationId&&n.conversationId===t.conversationId))&&f.delete(e);let L=R&&e&&k?.data.files.some(t=>t.path===e)?{...k.data,requestScope:v}:D;i=rb(i,L),d=y;let _=g.headers.get("ETag");return I(v,i,_??void 0),C(r??y,!R),w(v),R&&void 0!==E?$(v,e,t,E,r??y,l,o):j(v),i},P=(e,t,n,r,s,l)=>{if(a)return Promise.resolve(i);let o=u.then(()=>M(e,t,n,r,s,l));return u=o.then(()=>void 0,()=>void 0),o},$=(e,t,n,r,i,s,l)=>{if(a)return;if(!k(e)){l&&j(e);return}let c=o.get(e);if(l){if(c!==l||"canceled"===l.phase)return}else if(c){c.targetGeneration<r&&(c.pinnedPath=t,c.revision=n,c.targetGeneration=r,c.logicalGeneration=i);return}let d=l??{pinnedPath:t,revision:n,targetGeneration:r,logicalGeneration:i,attempt:s,phase:"scheduled"};d.pinnedPath=t,d.revision=n,d.targetGeneration=r,d.logicalGeneration=i,d.attempt=s,d.phase="scheduled",l||o.set(e,d),d.timer=setTimeout(()=>{if(d.timer=void 0,!N(e,d))return void j(e);d.phase="queued";let t=d.attempt+1;P(d.pinnedPath,d.revision,d.targetGeneration,d.logicalGeneration,t,d).catch(()=>{$(e,d.pinnedPath,d.revision,d.targetGeneration,d.logicalGeneration,t,d)})},Math.min(1e3,25*2**Math.min(s,10)))},{read:()=>x(b(i)),readScope:e=>v(rh(void 0,e)),revalidate:(e,t)=>P(e,t),subscribe:(e,t)=>{if(a)return()=>{};let n=rh(void 0,t);return l.set(e,n),()=>{l.delete(e),k(n)||j(n),A()}},applyPipeline:(e,t)=>{if(a)return;let n=!!e.hiddenAt&&!e.restored;p.set(e.id,{pipeline:n?null:e,minGeneration:t?c+1:1/0}),S(),w(void 0,"urgent")},revertPipeline:e=>{a||p.delete(e)&&(S(),w(void 0,"urgent"))},applySpawnedConversation:e=>{if(!a){for(f.delete(e.path),f.set(e.path,e);f.size>8;){let e=f.keys().next().value;if(!e)break;f.delete(e)}w(void 0,"urgent")}},dispose:()=>{if(!a){for(let e of(a=!0,[...o.keys()]))j(e);l.clear()}}});function rw(e,t){(0,nx.flushSync)(()=>rv.applyPipeline(e,t)),window.dispatchEvent(new Event(nb))}function ry(e){(0,nx.flushSync)(()=>rv.revertPipeline(e)),window.dispatchEvent(new Event(nb))}function rk(e){(0,nx.flushSync)(()=>rv.applySpawnedConversation(e))}function rj(e,t){let n=e.headers.get(t);if(null===n||!/^\d+$/.test(n))return;let r=Number(n);return Number.isSafeInteger(r)?r:void 0}let rN={loaded:!1,ids:new Set},rS=new Set;function rC(){return rN}let rA={claim:!1,track:!1,suppressSelection:!1},rI="viewMode",rM="taskPanelOpen",rT="path:",rP=e=>`${rT}${e}`,r$=e=>`favorite:${e}`,rE=e=>`fold:${e}`,rR=e=>`tray:${e}`;function rO(e,t){let n=new Set,r=e;for(;void 0!==t[r]&&!n.has(r);)n.add(r),r=t[r];return r}function rD(e,t){return e.startsWith(rT)?rP(rO(e.slice(rT.length),t)):e}let rL={absent:0,manual:1,pinned:2,expanded:3,hidden:4};function r_(e,t){let n=new Map,r=(e,r)=>{let i=rO(e,t),a=n.get(i);(void 0===a||(rL[r]??0)>(rL[a]??0))&&n.set(i,r)};for(let t of e.prefs.hidden)r(t,"hidden");for(let t of e.prefs.expanded)r(t,"expanded");for(let t of e.prefs.manual)r(t,(e.explicitManual??[]).includes(t)?"pinned":"manual");return n}function rF(e,t){let n=new Set(e??[]),r=new Set(t??[]);return[...new Set([...n,...r])].filter(e=>n.has(e)!==r.has(e))}function rq(e,t={}){let n=e=>rP(rO(e,t));switch(e.kind){case"close":case"restore":return[n(e.path)];case"reconcile-roots":return[...e.roots,...e.removeManual].map(n);case"remap-paths":return e.pairs.flatMap(({from:e,to:t})=>[n(e),n(t)]);case"set-favorite":return[r$(e.id)];case"set-engine-child-fold":return[rE(e.id),n(e.path)];case"set-engine-tray-expanded":return[rR(e.parentId)];case"set-presentation":return[...void 0===e.viewMode?[]:[rI],...void 0===e.taskPanelOpen?[]:[rM]]}}function rz(e,t){let n=rD(t,e.pathAliases??{});return e.keyRevisions?.[n]??e.keyRevisionFloor??0}function rH(e){return[...new Set(e)]}function rU(e){return e.pathAliases??{}}function rB(e,t){let n=new Set,r=e;for(;void 0!==t[r];){if(n.has(r))throw Error("board path alias cycle");n.add(r),r=t[r]}return r}function rK(e,t=rU(e)){let n=function(e){let t={};for(let n of Object.keys(e)){let r=rB(n,e);n!==r&&(t[n]=r)}return t}(t),r=rH(e.prefs.hidden.map(e=>rB(e,n))),i=new Set(r),a=e=>rH(e.map(e=>rB(e,n)).filter(e=>!i.has(e))),s=a(e.prefs.manual),l=new Set(s);return{...e,pathAliases:n,explicitManual:a(e.explicitManual??[]).filter(e=>l.has(e)),prefs:{...e.prefs,manual:s,hidden:r,expanded:a(e.prefs.expanded),favorites:rH(e.prefs.favorites??[]),foldedEngineChildIds:rH(e.prefs.foldedEngineChildIds??[]),expandedEngineTrayParentIds:rH(e.prefs.expandedEngineTrayParentIds??[])}}}function rY(e,t){var n;let r,i,a,s=rK(e);for(let e of t){if("remap-paths"===e.kind){s=function(e,t,n=!1){let r=rU(e),i=t.filter(({from:e,to:t})=>rB(e,r)!==rB(t,r));if(0===i.length)return rK(e);let a=new Set(t.map(({from:e})=>rB(e,r))),s=new Set(i.map(({to:e})=>rB(e,r))),l=e=>{if(n)return!0;let t=rB(e,r);return!s.has(t)||a.has(t)},o=e.prefs.manual.filter(l),c=(e.explicitManual??[]).filter(l),d={...r};for(let{from:e,to:t}of i)d[e]=t;return rK({...e,explicitManual:c,prefs:{...e.prefs,manual:o}},d)}(s,e.pairs,e.targetPlacementAuthoritative);continue}if("reconcile-roots"===e.kind){s=function(e,t,n){let r=rU(e),i=new Set(n.map(e=>rB(e,r))),a=e.prefs.manual.filter(e=>!i.has(e)),s=(e.explicitManual??[]).filter(e=>!i.has(e)),l=new Set([...a,...e.prefs.hidden,...Object.values(r).map(e=>rB(e,r))]);for(let e of t.map(e=>rB(e,r)))l.has(e)||(a.push(e),l.add(e));return rK({...e,explicitManual:s,prefs:{...e.prefs,manual:a}})}(s,e.roots,e.removeManual);continue}if("restore"===e.kind){s=function(e,t,n){let r={...e.prefs,hidden:e.prefs.hidden.filter(e=>e!==t)},i=(e.explicitManual??[]).filter(e=>e!==t);if("auto"===n)return rK({...e,explicitManual:i,prefs:r});let a={...r,manual:r.manual.filter(e=>e!==t),expanded:r.expanded.filter(e=>e!==t)};return rK({...e,explicitManual:"manual"===n?[...i,t]:i,prefs:"manual"===n?{...a,manual:[...a.manual,t]}:{...a,expanded:[...a.expanded,t]}})}(s,rB(e.path,rU(s)),e.placement);continue}if("set-favorite"===e.kind){let t=e.favorite?rH([...s.prefs.favorites,e.id]):s.prefs.favorites.filter(t=>t!==e.id);s=rK({...s,prefs:{...s.prefs,favorites:t}});continue}if("set-engine-child-fold"===e.kind){let t=s.prefs.foldedEngineChildIds??[],n=e.folded?rH([...t,e.id]):t.filter(t=>t!==e.id),r=rB(e.path,rU(s));s=rK({...s,explicitManual:e.folded?(s.explicitManual??[]).filter(e=>e!==r):s.explicitManual,prefs:{...s.prefs,foldedEngineChildIds:n,manual:e.folded?s.prefs.manual.filter(e=>e!==r):s.prefs.manual,expanded:e.folded?s.prefs.expanded.filter(e=>e!==r):s.prefs.expanded}});continue}if("set-engine-tray-expanded"===e.kind){let t=s.prefs.expandedEngineTrayParentIds??[],n=e.expanded?rH([...t,e.parentId]):t.filter(t=>t!==e.parentId);s=rK({...s,prefs:{...s.prefs,expandedEngineTrayParentIds:n}});continue}if("set-presentation"===e.kind){s=rK({...s,prefs:{...s.prefs,...void 0===e.viewMode?{}:{viewMode:e.viewMode},...void 0===e.taskPanelOpen?{}:{taskPanelOpen:e.taskPanelOpen}}});continue}let t=rB(e.path,rU(s));s=rK({...s,explicitManual:(s.explicitManual??[]).filter(e=>e!==t),prefs:{...s.prefs,manual:s.prefs.manual.filter(e=>e!==t),expanded:s.prefs.expanded.filter(e=>e!==t),hidden:rH([...s.prefs.hidden,t])}})}return r=rU(n=s),i=new Set(n.prefs.hidden.map(e=>rB(e,r))),a=e.prefs.hidden.filter(e=>i.has(rB(e,r))),{...n,prefs:{...n.prefs,hidden:rH([...a,...n.prefs.hidden])}}}let rW={manual:[],hidden:[],expanded:[],favorites:[],foldedEngineChildIds:[],expandedEngineTrayParentIds:[],viewMode:null,taskPanelOpen:!1};function rV(e){return 0===e.manual.length&&0===e.hidden.length&&0===e.expanded.length&&0===e.favorites.length&&(e.foldedEngineChildIds?.length??0)===0&&(e.expandedEngineTrayParentIds?.length??0)===0&&null===e.viewMode&&!e.taskPanelOpen}function rJ(e){return Array.isArray(e)?e.filter(e=>"string"==typeof e):[]}let rG=new Map,rQ=new Map,rX=new Map,rZ={paths:new Set,armed:!1},r0=new Map,r1=e=>r0.get(e)??rZ,r2=new Map;function r5(e,t,n=!1){let r=rG.get(e)??{manual:[],expanded:[]};n?r.expanded.includes(t)||r.expanded.push(t):r.manual.includes(t)||r.manual.push(t),rG.set(e,r),rQ.get(e)?.()}let r4=new Set(["INVALID_REQUEST","PAYLOAD_TOO_LARGE"]),r3=new Set(["UNSUPPORTED_SCHEMA_VERSION"]);function r6(e,t){return JSON.stringify({prefs:e.prefs,pathAliases:e.pathAliases??{},explicitManual:e.explicitManual??[]})===JSON.stringify({prefs:t.prefs,pathAliases:t.pathAliases??{},explicitManual:t.explicitManual??[]})}function r8(e,t){if(0===t.length)return e;try{return rY(e,t)}catch{return e}}let r7=e=>e.map(e=>e.mutation),r9={prefs:rW,explicitManual:[],revision:0,sync:"unavailable",loaded:!1,selection:rZ.paths,selectionArmed:!1},ie=new Map;function it(e){let t=(0,Y.useRef)(null),[n,r]=(0,Y.useState)(()=>({project:e,snapshot:function(e){if(null===e)return r9;let t=r1(e),n=rX.get(e);return n?{prefs:n.prefs,explicitManual:n.explicitManual??[],revision:n.revision,sync:"current",loaded:!0,selection:t.paths,selectionArmed:t.armed}:{...r9,selection:t.paths,selectionArmed:t.armed}}(e)}));return(0,Y.useEffect)(()=>{if(null===e){t.current=null,r({project:e,snapshot:r9});return}let n=function(e){let t=ie.get(e);if(t)return t.refs+=1,t.store;let n=null;try{n=window.localStorage}catch{n=null}let r=function(e){var t;let n,{project:r,fetcher:i,storage:a}=e,s=e.scheduler??{setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e),setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e)},l="/api/board?project="+encodeURIComponent(r),o=rX.get(r),c=o??{schemaVersion:1,revision:0,updatedAt:new Date(0).toISOString(),pathAliases:{},explicitManual:[],keyRevisions:{},keyRevisionFloor:0,prefs:rW},d=[],u=!1,p=void 0!==o,m=!1,f=p?{prefs:c.prefs,explicitManual:c.explicitManual??[],revision:c.revision,sync:"current",loaded:!0,selection:r1(r).paths,selectionArmed:r1(r).armed}:{prefs:rW,explicitManual:[],revision:0,sync:"unavailable",loaded:!1,selection:r1(r).paths,selectionArmed:r1(r).armed},h=!1,x=0,g=null,b=null,v=1e3,w=!1,y=0,k=new Set,j=()=>{0===d.length&&(w=!1);let e=r8(c,r7(d));for(let t of(f={prefs:e.prefs,explicitManual:e.explicitManual??[],revision:c.revision,sync:m?"unavailable":0===d.length?u?"pending":"current":w?"stale":"pending",loaded:p,selection:r1(r).paths,selectionArmed:r1(r).armed},p&&!m&&rX.set(r,c),k))t()},N=e=>{let t=r1(r);if(e.paths!==t.paths||e.armed!==t.armed){0!==e.paths.size||e.armed?r0.set(r,e):r0.delete(r);for(let e of[...r2.get(r)??[]])e()}},S=(t=()=>j(),(n=r2.get(r)??new Set).add(t),r2.set(r,n),()=>{n.delete(t),0===n.size&&r2.delete(r)}),C=(e,t=null)=>{if(e.revision<c.revision)return void j();if(c=e,m=!1,d.length>0){var n;n=null===t?d:function(e,t,n){if(0===t.size)return[...e];let r=n.pathAliases??{};return e.map(e=>{let i={...e.observed},a=!1;for(let s of Object.keys(e.observed)){if(!t.has(rD(s,r)))continue;let e=rz(n,s);e!==i[s]&&(i[s]=e,a=!0)}return a?{...e,observed:i}:e})}(d,t,e),(d=n.filter(t=>!Object.entries(t.observed).some(([t,n])=>rz(e,t)>n))).length>0?w=!0:P()}j()},A=async(e,t)=>{y+=1;try{let n=await i("/api/board",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({schemaVersion:1,project:r,baseRevision:t,mutations:e})});if(n.ok){let e=await n.json();return{status:"ok",applied:e.applied,board:e.board}}if(409===n.status)return{status:"conflict",board:(await n.json()).board};if(n.status>=400&&n.status<500){let e=await n.json().catch(()=>null);if(e?.error!==void 0&&r4.has(e.error))return{status:"rejected"};if(e?.error!==void 0&&r3.has(e.error))return{status:"envelope"}}return{status:"error"}}catch{return{status:"error"}}},I=async(e,t)=>{y+=1;try{let n=await i("/api/board",{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({schemaVersion:1,project:r,baseRevision:t,patch:e})});if(n.ok){let e=await n.json();return{status:"ok",applied:e.applied,board:e.board}}if(409===n.status)return{status:"conflict",board:(await n.json()).board};return{status:"error"}}catch{return{status:"error"}}},M=e=>{let t;if(0===e.length)return;let n=r8(c,r7(d)),r=[...d,...e.map(e=>(function(e,t){let n={};for(let r of rq(e,t.pathAliases??{}))n[r]=rz(t,r);return{mutation:e,observed:n}})(e,c))];try{t=rY(c,r7(r))}catch{t=null}null!==t&&r6(n,t)||(d=r,j(),E())},T=()=>{if(!p||h)return;let e=rG.get(r);e&&(0!==e.manual.length||0!==e.expanded.length)&&(rG.delete(r),M([{kind:"set-presentation",viewMode:"scheme"},...e.manual.map(e=>({kind:"restore",path:e,placement:"manual"})),...e.expanded.map(e=>({kind:"restore",path:e,placement:"expanded"}))]))},P=()=>{null!==b&&(s.clearTimeout(b),b=null),v=1e3},$=()=>{if(null!==b||h)return;let e=v;v=Math.min(2*v,3e4),b=s.setTimeout(()=>{b=null,x=0,E()},e)},E=async()=>{if(u||h||0===d.length)return;u=!0,j();let e=function(e,t=128){let n=Math.max(1,Math.min(t,128)),r=[],i=0;for(let t of e){let e=function(e){let t=JSON.stringify(e);return"u"<typeof TextEncoder?t.length:new TextEncoder().encode(t).length}(t);if(r.length>0&&(r.length>=n||i+e>196608))break;r.push(t),i+=e}return r}(r7(d),g??128),t=await A(e,c.revision);if(u=!1,!h){if("ok"===t.status){P(),x=0,g=null,m=!1;let n=t.applied??r6(r8(c,e),t.board)?new Set(e.flatMap(e=>rq(e,t.board.pathAliases??{}))):null;d=d.slice(e.length),C(t.board,n),d.length&&E();return}if("rejected"===t.status){P(),x=0,1===e.length?(g=null,d=d.slice(1)):g=Math.max(1,Math.floor(e.length/2)),j(),d.length&&E();return}if("envelope"===t.status){g=null,m=!0,j(),$();return}if("conflict"===t.status){if(C(t.board),x+=1,0===d.length){x=0;return}x<=8?E():$();return}j(),$()}},R=async()=>{let e=null;try{let t=await i(l);t.ok&&(e=(await t.json()).board)}catch{e=null}if(!h){if(!e){m=!0,p=!0,j();return}if(p=!0,e.revision<c.revision)return void C(e);if(0===e.revision&&rV(e.prefs)){let t=function(e,t){if(!t)return null;let n={manual:[],hidden:[],expanded:[]},r=!1;try{let i=t.getItem(`llvCols:${e}`);if(i){let e=JSON.parse(i);n={manual:rJ(e.manual),hidden:rJ(e.hidden),expanded:rJ(e.expanded)},r=!0}}catch{}let i=t.getItem(`llvEmptyView:${e}`),a="scheme"===i||"list"===i?i:null,s="1"===t.getItem("llvTaskPanel");return r||null!==a||s?{...n,favorites:[],foldedEngineChildIds:[],expandedEngineTrayParentIds:[],viewMode:a,taskPanelOpen:s}:null}(r,a);if(t&&!rV(t)){c={...e,prefs:t},u=!0,j();let n=await I(t,0);if(u=!1,h)return;C("ok"===n.status||"conflict"===n.status?n.board:e,"ok"===n.status&&!0===n.applied?function(e,t){let n=new Set,r=t.pathAliases??{},i=r_(e,r),a=r_(t,r);for(let e of new Set([...i.keys(),...a.keys()]))(i.get(e)??"absent")!==(a.get(e)??"absent")&&n.add(rP(e));for(let r of rF(e.prefs.favorites,t.prefs.favorites))n.add(r$(r));for(let r of rF(e.prefs.foldedEngineChildIds,t.prefs.foldedEngineChildIds))n.add(rE(r));for(let r of rF(e.prefs.expandedEngineTrayParentIds,t.prefs.expandedEngineTrayParentIds))n.add(rR(r));return e.prefs.viewMode!==t.prefs.viewMode&&n.add(rI),e.prefs.taskPanelOpen!==t.prefs.taskPanelOpen&&n.add(rM),n}(e,n.board):null),d.length&&E();return}}C(e)}};rQ.set(r,T),R().then(T);let O=s.setInterval(()=>{if(u||h)return;let e=y;(async()=>{try{let t=await i(l);if(!t.ok)return;let n=(await t.json()).board;if(u||h||y!==e)return;if(n.revision!==c.revision)return void C(n);m&&0===d.length&&(m=!1,j())}catch{}})()},1e4);return{getSnapshot:()=>f,subscribe:e=>(k.add(e),()=>k.delete(e)),mutate(e){M(e)},toggleSelection(e){var t;let n;N({paths:(t=r1(r).paths,(n=new Set(t)).delete(e)||n.add(e),n),armed:r1(r).armed})},commitSelection(e,t){N({paths:function(e,t,n){if(!n)return new Set(t);if(0===t.length)return e;let r=new Set(e);for(let e of t)r.add(e);return r}(r1(r).paths,e,t),armed:r1(r).armed})},clearSelection(){N(rZ)},setSelectionArmed(e){N({paths:r1(r).paths,armed:e})},pruneSelectionTo(e){N({paths:function(e,t){for(let n of e)if(!t.has(n))return new Set([...e].filter(e=>t.has(e)));return e}(r1(r).paths,e),armed:r1(r).armed})},dispose(){h=!0,S(),P(),rQ.get(r)===T&&rQ.delete(r),s.clearInterval(O),k.clear()}}}({project:e,fetcher:(e,t)=>fetch(e,t),storage:n});return ie.set(e,{store:r,refs:1}),r}(e);t.current=n,r({project:e,snapshot:n.getSnapshot()});let i=n.subscribe(()=>r({project:e,snapshot:n.getSnapshot()}));return()=>{let n;i(),(n=ie.get(e))&&(n.refs-=1,n.refs>0||(ie.delete(e),n.store.dispose())),t.current=null}},[e]),{...n.project===e?n.snapshot:r9,mutate(e){t.current?.mutate(e)},close(e){t.current?.mutate([{kind:"close",path:e}])},restore(e,n){t.current?.mutate([{kind:"restore",path:e,placement:n}])},setViewMode(e){t.current?.mutate([{kind:"set-presentation",viewMode:e}])},setTaskPanelOpen(e){t.current?.mutate([{kind:"set-presentation",taskPanelOpen:e}])},setFavorite(e,n){t.current?.mutate([{kind:"set-favorite",id:e,favorite:n}])},setEngineChildFold(e,n,r){t.current?.mutate([{kind:"set-engine-child-fold",id:e,path:n,folded:r}])},setEngineTrayExpanded(e,n){t.current?.mutate([{kind:"set-engine-tray-expanded",parentId:e,expanded:n}])},toggleSelection(e){t.current?.toggleSelection(e)},commitSelection(e,n){t.current?.commitSelection(e,n)},clearSelection(){t.current?.clearSelection()},setSelectionArmed(e){t.current?.setSelectionArmed(e)},pruneSelectionTo(e){t.current?.pruneSelectionTo(e)}}}let ir="(max-width: 767px)";function ii(e){let t=window.matchMedia(ir);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)}function ia(){return(0,Y.useSyncExternalStore)(ii,()=>window.matchMedia(ir).matches,()=>!1)}let is={project:null,board:{renderedRevision:null,durableRevision:null,sync:"unavailable"}},il={mode:"overview",focusedPath:null,selectedPaths:[],visiblePaths:[],camera:null};function io(e,t){let n=e.z||1;return{x:-e.x/n,y:-e.y/n,width:t.w/n,height:t.h/n}}function ic(e,t,n={}){if(0===t.size)return[];let r=[],i=new Set;for(let n of e)if(!(!t.has(n)||i.has(n))&&(i.add(n),r.push(n),r.length>=64))return r;if(!n.includeUnordered)return r;for(let e of t)if(!i.has(e)&&(r.push(e),r.length>=64))break;return r}function id(e,t){return JSON.stringify(e)===JSON.stringify(t)}function iu(e,t,n){return{project:e.project,board:e.board,mode:t.mode,focusedPath:t.focusedPath,selectedPaths:t.selectedPaths,visiblePaths:t.visiblePaths,camera:t.camera,viewport:t.viewport??n}}let ip=(E=is,R=il,O=null,D=[],L=0,_=new Set,F=()=>{for(let e of _)e()},{reportContext(e){id(E,e)||(E=e,F())},reportSlice(e){if(id(R,e))return;let t=R.focusedPath!==e.focusedPath||!id(R.selectedPaths,e.selectedPaths);R=e,t&&(L+=1),F()},reportIdentity(e){id(O,e)||(O=e,F())},reportCards(e){id(D,e)||(D=e,F())},getContext:()=>E,getSlice:()=>R,getIdentity:()=>O,getCards:()=>D,getSelectionRevision:()=>L,subscribe:e=>(_.add(e),()=>_.delete(e))}),im="llvDeviceId";function ih(){return"u">typeof crypto&&"function"==typeof crypto.randomUUID?crypto.randomUUID():"vs-"+Math.random().toString(36).slice(2)+Date.now().toString(36)}function ix(e){try{let t=e?.getItem(im);if(t)return t}catch{}let t=ih();try{e?.setItem(im,t)}catch{}return t}function ig(e,t,n,r,i){return{schemaVersion:1,viewSessionId:t.viewSessionId,deviceId:t.deviceId,device:t.device,visibility:i,sequence:n,inputSequence:r,project:e.project,mode:e.mode,viewport:e.viewport,camera:e.camera,focusedPath:e.focusedPath,selectedPaths:e.selectedPaths,visiblePaths:e.visiblePaths,board:e.board}}async function ib(e){try{if(e.body&&"function"==typeof e.body.cancel)return void await e.body.cancel();"function"==typeof e.text&&await e.text()}catch{}}let iv=["pointerdown","keydown","touchstart","wheel"],iw={"content-type":"application/json"};function iy(){return"u"<typeof document||"hidden"!==document.visibilityState}var ik=n(4577);function ij({onReturn:e,precise:t,t:n}){let r=n(t?"attention.return":"attention.returnLine");return(0,U.jsx)("div",{"data-scheme-ui":!0,"data-testid":"focus-return-chip",className:"absolute left-3 top-[52px] z-40 flex items-center rounded-[10px] border border-border bg-card/95 p-1 shadow-1",children:(0,U.jsx)("button",{type:"button","data-testid":"attention-return",onClick:e,title:r,"aria-label":r,className:"inline-flex h-7 w-7 items-center justify-center rounded-[8px] text-muted hover:bg-canvas hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:(0,U.jsx)(ik.A,{className:"h-4 w-4","aria-hidden":!0})})})}let iN=(q=null,z=null,{setBoard:e=>(q=e,()=>{q===e&&(q=null)}),board:()=>q,setShell:e=>(z=e,()=>{z===e&&(z=null)}),shell:()=>z}),iS="llvAttentionHandoff:";function iC(e){if(!e)return null;try{let t=JSON.parse(e);if(!t.viewport||"object"!=typeof t.viewport)return null;return t}catch{return null}}function iA(e,t,n){let r=iS+t;try{let t=iC(e?.getItem(r)??null);if(t)return{first:!1,viewport:t.viewport}}catch{}let i=n();try{e?.setItem(r,JSON.stringify({viewport:i,claimedAt:new Date().toISOString()}))}catch{}return{first:!0,viewport:i}}function iI(e,t){try{e?.removeItem(iS+t)}catch{}}function iM(e){return"region"===e.kind||"point"===e.kind}function iT(e){switch(e.kind){case"conversation":return[e.path];case"pipeline":return[`group::pipeline::${e.pipelineId}`];case"stage":return[`slot::${e.pipelineId}::${e.stageId}`];case"flowRound":return[`deck::${e.flowId}`];case"task":return[`task::${e.taskId}`];case"draft":return[`draft::${e.draftId}`];case"region":case"point":return[]}}[{kind:"conversation",fields:'conversationId (the durable "conversation_…" id, resolved to its current transcript) or path (that transcript\'s .jsonl path) — at least one',example:'{"kind":"conversation","conversationId":"conversation_9f2c"}'},{kind:"pipeline",fields:"pipelineId (non-empty string)",example:'{"kind":"pipeline","pipelineId":"pipeline_9f2c"}'},{kind:"stage",fields:"pipelineId and stageId (non-empty strings)",example:'{"kind":"stage","pipelineId":"pipeline_9f2c","stageId":"review"}'},{kind:"flowRound",fields:"flowId (non-empty string) and round (integer, 0 or more)",example:'{"kind":"flowRound","flowId":"flow_9f2c","round":2}'},{kind:"task",fields:"taskId (non-empty string)",example:'{"kind":"task","taskId":"task_9f2c"}'},{kind:"draft",fields:"draftId (non-empty string), and a top-level project alongside target — a draft exists only on the operator's canvas, so the server cannot attribute it",example:'{"kind":"draft","draftId":"draft_9f2c"}'},{kind:"region",fields:"project (non-empty string) and rect {x, y, w, h} (finite numbers; w and h 0 or more)",example:'{"kind":"region","project":"live-log-viewer-next","rect":{"x":0,"y":0,"w":800,"h":600}}'},{kind:"point",fields:"project (non-empty string), x and y (finite numbers), and an optional zoom (greater than 0)",example:'{"kind":"point","project":"live-log-viewer-next","x":1200,"y":480}'}].map(e=>e.kind);let iP=e=>({x:e.x+e.w/2,y:e.y+e.h/2});function i$(e,t,n=[]){let r=iP(t),i=null;for(let t of e.named??[]){if(n.includes(t.key))continue;let e=iP(t.rect),a=Math.hypot(e.x-r.x,e.y-r.y);(!i||a<i.distance)&&(i={key:t.key,label:t.label,distance:a})}return i?{key:i.key,label:i.label}:null}function iE(e,t){return{project:e.project,rect:t,boardRevision:e.boardRevision}}let iR=()=>({resolution:"lost",frame:null,target:null,nearestAnchor:null,degraded:!1});function iO(e,t,n){if(!n)return iR();if(iM(e)){if(e.project!==n.project)return iR();let t="region"===e.kind?e.rect:{x:e.x-300,y:e.y-300,w:600,h:600};return{resolution:"exact",frame:iE(n,t),target:e,nearestAnchor:i$(n,t),degraded:!1}}let r=iT(e);for(let t of r){let r=n.rectFor(t);if(r)return{resolution:"exact",frame:iE(n,r),target:e,nearestAnchor:null,degraded:!1}}if(t&&t.project===n.project){let e=iP(t.rect);return{resolution:"approximate",frame:iE(n,t.rect),target:{kind:"point",project:n.project,x:e.x,y:e.y},nearestAnchor:i$(n,t.rect,r),degraded:!0}}return iR()}let iD=e=>new Promise(t=>{setTimeout(t,e)});function iL(e){return iM(e.target)?e.target.project:e.frameAtCreation.project}function i_(e){return e&&e.project.length>0&&e.rect.w>0&&e.rect.h>0?e:null}async function iF(e,t,n){return iq(e,n,e=>e.project===t)}async function iq(e,t,n){let r=t.timeoutMs??4e3,i=t.pollMs??40,a=t.sleep??iD,s=t.now??(()=>Date.now()),l=s()+r;for(;;){let t=e.board();if(t&&n(t))return t;if(s()>=l)return null;await a(i)}}async function iz(e,t,n={}){let r=iL(e),i=t.shell(),a="conversation"===e.target.kind;i&&i.project!==r&&(a?i.openConversation(r,null):i.openProject(r));let s=await iF(t,r,n),l=iO(e.target,i_(e.frameAtCreation),s?.index??null),o=!1;if(s&&"lost"===l.resolution&&"conversation"===e.target.kind&&i){let a=e.target.path;i.placePath(a),o=!0,s=await iq(t,n,e=>e.project===r&&null!==e.index.rectFor(a))??s,l=iO(e.target,i_(e.frameAtCreation),s.index)}return s&&l.frame&&"lost"!==l.resolution&&s.moveTo({rect:l.frame.rect,zoom:e.zoom,anchorKeys:function(e,t){if(!e||iM(e))return[];var n=iT(e);let r=[];for(let e of n){if(null===t.rectFor(e))continue;let n=t.concreteAnchorKey?.(e)??e;for(let t of n&&n!==e?[n,e]:[e])r.includes(t)||r.push(t)}return r}(l.degraded?null:l.target,s.index)})?("open"===e.intent&&"conversation"===e.target.kind&&i&&(i.openPathQuiet?i.openPathQuiet(e.target.path):o||i.placePath(e.target.path)),{resolution:l.resolution,moved:!0,frame:l.frame}):{resolution:"lost",moved:!1,frame:null}}function iH(e,t){let n=e?.worldRect;if(!n)return!1;let r=t.rect.x+t.rect.w/2,i=t.rect.y+t.rect.h/2;return r>=n.x&&r<=n.x+n.width&&i>=n.y&&i<=n.y+n.height}async function iU(e,t,n={}){let r=await iB(e,t,n);return r.moved&&!0!==r.aborted&&"conversation"===e.target.kind&&t.shell()?.recordFocusArrival?.(e.target.path,iL(e)),r}async function iB(e,t,n){let r=()=>n.signal?.aborted===!0;if(r())return{resolution:"lost",moved:!1,frame:null,aborted:!0};if(n.resume&&n.observe){let r=t.board();if(r&&r.project===iL(e)){let t=iO(e.target,i_(e.frameAtCreation),r.index);if(t.frame&&"lost"!==t.resolution&&iH(n.observe().camera,t.frame))return{resolution:t.resolution,moved:!0,frame:t.frame}}}let i=await iz(e,t,n);if(r())return{...i,aborted:!0};if(!i.moved||!i.frame||!n.observe)return i;let a=n.pollMs??40,s=n.sleep??iD,l=n.now??(()=>Date.now()),o=l()+(n.timeoutMs??4e3),c="open"===e.intent&&"conversation"===e.target.kind?e.target.path:null,d=null;for(;;){let e=n.observe();if(null!==c&&e.focusedPath===c)return i;if(e.camera)if(e.camera.worldRect){if(iH(e.camera,i.frame))return i}else{var u,p;if(u=d,p=e.camera,null!==u&&null!==p&&.5>Math.abs(u.x-p.x)&&.5>Math.abs(u.y-p.y)&&.005>Math.abs(u.zoom-p.zoom))return i}if(d=e.camera,r())return{...i,aborted:!0};if(l()>=o)return{resolution:"lost",moved:!1,frame:null};await s(a)}}async function iK(e,t,n,r={}){let i=n.shell();if("overview"===e.mode)return!!i&&(i.openOverview(),!0);let a=!!(t&&i&&i.project!==t),s=!!e.focusedPath&&!(e.camera&&t),l=!!(e.camera&&t);if(a&&!s&&(l&&e.focusedPath&&i.openPathQuiet?i.openConversation(t,null):i.openProject(t)),l){let a=await iF(n,t,r);if(a?.restoreCamera(e.camera))return e.focusedPath&&i?.openPathQuiet?.(e.focusedPath),!0}return e.focusedPath&&i?(s?i.openConversation(a?t:null,e.focusedPath):i.openPath(e.focusedPath),!0):!!(t&&i)}function iY(e){return`llv.attention.return-project.${e}`}function iW(e,t){if(!e||!t)return{};try{let n=e.getItem(iY(t));if(!n)return{};let r=JSON.parse(n);if(!r||"object"!=typeof r||Array.isArray(r))return{};return Object.fromEntries(Object.entries(r).filter(([,e])=>null===e||"string"==typeof e))}catch{return{}}}function iV(e,t,n){if(e&&t)try{e.setItem(iY(t),JSON.stringify(n))}catch{}}function iJ(e,t,n,r){let i=iW(e,t);delete i[n],iV(e,t,Object.fromEntries([...Object.entries(i),[n,r]].slice(-8)))}function iG(e,t,n){let r=iW(e,t);n in r&&(delete r[n],iV(e,t,r))}let iQ=new Map;function iX(){let e=ip.getSlice(),t=e.camera;return{mode:e.mode,camera:t?{x:t.x,y:t.y,zoom:t.zoom}:null,focusedPath:e.focusedPath,project:ip.getContext().project}}function iZ(e){return e.ok||null!==e.refusal}function i0(){try{return window.localStorage}catch{return null}}function i1(){let e=ip.getSlice();return{camera:e.camera,focusedPath:e.focusedPath}}let i2=e=>ip.subscribe(e);function i5({mobile:e,bus:t=iN,deviceId:n,viewSessionId:r,claimStorage:i,fetchFn:a,pollMs:s,timing:l,observe:o}){let{t:c}=(0,eh.Ym)(),[d,u]=(0,Y.useState)(n??null);(0,Y.useEffect)(()=>{void 0===n&&u(ix(i0()))},[n]);let p=e?null:n??d,m=(0,Y.useSyncExternalStore)(i2,()=>ip.getIdentity(),()=>null),f=void 0!==r?r:m?.viewSessionId??null,h=void 0!==i?i:function(){try{return window.sessionStorage}catch{return null}}(),x=o??i1,g=(0,Y.useRef)(new Set);(0,Y.useEffect)(()=>{let e=g.current;return()=>{for(let t of e)t.abort();e.clear()}},[]);let b=(0,Y.useRef)(new Map),v=(0,Y.useCallback)(e=>{let t=b.current.get(e)??function(e,t){try{return iC(e?.getItem(iS+t)??null)?.viewport??null}catch{return null}}(h,e)??iX();return{mode:t.mode,camera:t.camera,focusedPath:t.focusedPath}},[h]),w=(0,Y.useRef)(new Map),y=function({deviceId:e,captureViewport:t,pollMs:n=4e3,refusalTtlMs:r=12e3,fetchFn:i,surfaceVisible:a}){let[s,l]=(0,Y.useState)(null),[o,c]=(0,Y.useState)(0),[d,u]=(0,Y.useState)(null),p=i??("function"==typeof fetch?fetch:null),m=(0,Y.useRef)(iy);(0,Y.useEffect)(()=>{m.current=a??iy},[a]);let f=(0,Y.useCallback)(async()=>{if(!e||!p)return null;try{let t=await p(`/api/attention?deviceId=${encodeURIComponent(e)}`);if(!t.ok)return null;return await t.json()}catch{return null}},[e,p]),h=(0,Y.useCallback)(async(e,t)=>{let n;if(!p)return{ok:!1,refusal:null};try{n=await p(`/api/attention/${encodeURIComponent(e)}`,{method:"POST",headers:iw,body:JSON.stringify(t)})}catch{return{ok:!1,refusal:null}}if(n.ok)return{ok:!0};let r=null;try{r=await n.json()}catch{r=null}return{ok:!1,refusal:{requestId:e,reason:"string"==typeof r?.error?r.error:`http-${n.status}`,state:"string"==typeof r?.state?r.state:null}}},[p]),x=(0,Y.useCallback)(async()=>{let t=await f();if(!t)return;let n=t.live.find(e=>"pending"===e.request.state);n&&e&&m.current()?(ns({cue:"attention",eventId:`attention:${n.request.id}`}),await h(n.request.id,{kind:"offer",deviceId:e}),l(await f()??t)):l(t)},[f,h,e]),g=(0,Y.useCallback)(async(e,t)=>{let n=await h(e,t);return n.ok?u(null):n.refusal&&u(n.refusal),await x(),n},[h,x]);(0,Y.useEffect)(()=>{if(!e)return;let t=!1,r=async()=>{!t&&(await x(),t||c(e=>e+1))},i=setInterval(()=>{r()},n);r();let a=()=>{r()},s="u"<typeof document?null:document;return s?.addEventListener("visibilitychange",a),()=>{t=!0,clearInterval(i),s?.removeEventListener("visibilitychange",a)}},[e,n,x]);let b=(0,Y.useCallback)(async(t,n="operator")=>e?g(t.id,{kind:"accept",deviceId:e,via:n}):{ok:!1,refusal:null},[g,e]),v=(0,Y.useCallback)(async(n,r)=>{if(!e)return{ok:!1,refusal:null};if("lost"===r){let t=await g(n.id,{kind:"abandon",deviceId:e});return u({requestId:n.id,reason:"lost-target",state:null}),t}return g(n.id,{kind:"arrive",deviceId:e,resolution:r,returnPoint:{deviceId:e,capturedAt:new Date().toISOString(),...t(n.id)}})},[g,e,t]);return(0,Y.useEffect)(()=>{if(!d)return;let e=setTimeout(()=>u(e=>e===d?null:e),r);return()=>clearTimeout(e)},[d,r]),{view:s,offer:s?.offer??null,pollGeneration:o,refusal:d,dismissRefusal:(0,Y.useCallback)(()=>u(null),[]),accept:b,preview:(0,Y.useCallback)(async t=>{e&&await g(t.id,{kind:"preview",deviceId:e})},[g,e]),decline:(0,Y.useCallback)(async t=>{e&&await g(t.id,{kind:"decline",deviceId:e})},[g,e]),dismiss:(0,Y.useCallback)(async t=>{e&&await g(t.id,{kind:"dismiss",deviceId:e})},[g,e]),arrive:v,goBack:(0,Y.useCallback)(async(t,n="control")=>e?g(t.id,{kind:"return",deviceId:e,via:n}):{ok:!1,refusal:null},[g,e]),refresh:x}}({deviceId:p,captureViewport:v,...a?{fetchFn:a}:{},...s?{pollMs:s}:{}}),k=(0,Y.useCallback)(async(e,n=!1)=>{if(iQ.has(e.id))return;let r=new AbortController;iQ.set(e.id,r),g.current.add(r);let i=!1;try{let a=await iU(e,t,{...l??{},signal:r.signal,observe:x,resume:n});if(a.aborted){i=!0;return}let s=await y.arrive(e,a.resolution);s.ok?i=!0:iZ(s)||"lost"===a.resolution?iI(h,e.id):(i=!0,w.current.set(e.id,a.resolution))}finally{iQ.get(e.id)===r&&iQ.delete(e.id),g.current.delete(r),w.current.has(e.id)||b.current.delete(e.id),i||iG(i0(),p,e.id)}},[y,t,p,l,h,x]),j=(0,Y.useCallback)(async e=>{let t=iX();(b.current.set(e.id,t),(await y.accept(e,"auto-follow")).ok)?(iJ(i0(),p,e.id,t.project),iA(h,e.id,()=>t),await k(e)):b.current.delete(e.id)},[y,p,k,h]),N=(0,Y.useCallback)(async e=>{if(ns({cue:"attention",eventId:`attention:${e.id}`}),iQ.has(e.id))return;let t=iA(h,e.id,iX);b.current.set(e.id,t.viewport),iJ(i0(),p,e.id,t.viewport.project),await k(e,!t.first)},[p,k,h]),S=(0,Y.useCallback)(async e=>{let n=e.returnPoints.find(e=>e.deviceId===p);if(n){var r,i;if(!await iK(n,(r=i0(),i=e.id,iW(r,p)[i]??null),t,l??{}))return}iZ(await y.goBack(e,"control"))&&(iG(i0(),p,e.id),iI(h,e.id))},[y,t,p,l,h]),C=(0,Y.useRef)(new Set),A=(0,Y.useRef)(y.view),I=y.view;(0,Y.useEffect)(()=>{A.current=I},[I]);let M=y.pollGeneration;(0,Y.useEffect)(()=>{if(p&&0!==w.current.size)for(let e of A.current?.live??[]){let t=w.current.get(e.request.id);if(!(void 0===t||C.current.has(e.request.id))){if("accepted"!==e.request.state||e.request.acknowledgedBy!==p){w.current.delete(e.request.id),b.current.delete(e.request.id),iI(h,e.request.id);continue}C.current.add(e.request.id),(async()=>{try{let n=await y.arrive(e.request,t);if(!iZ(n))return;w.current.delete(e.request.id),b.current.delete(e.request.id),iI(h,e.request.id),n.ok||iG(i0(),p,e.request.id)}finally{C.current.delete(e.request.id)}})()}}},[M,y,p,h]);let T=(0,Y.useRef)(new Set),P=y.offer,$=P&&"actionable"===P.status?P.request.id:null,E=P&&"actionable"===P.status?P.request:null,R=P&&"following"===P.status&&"accepted"===P.request.state&&P.request.acknowledgedBy===p&&(void 0===P.request.directedSessionId||P.request.directedSessionId===f)&&!P.request.returnPoints.some(e=>e.deviceId===p)?P.request:null,O=R?.id??null;(0,Y.useEffect)(()=>{if(!p)return;let e=E??R;!e||T.current.has(e.id)||(T.current.add(e.id),E?j(e):N(e))},[p,$,E,O,R,j,N]);let D=(0,Y.useCallback)(()=>{P&&S(P.request)},[P,S]);return P&&"following"===P.status&&"following"===P.request.state&&(void 0===P.request.directedSessionId||P.request.directedSessionId===f)?(0,U.jsx)(ij,{onReturn:D,precise:P.returnAvailable,t:c}):null}var i4=n(1012),i3=n(6721),i6=n(233);function i8({count:e,mobile:t,queueOpen:n,filterActive:r,onToggleQueue:i,onNext:a,onToggleFilter:s}){let{t:l}=(0,eh.Ym)();return 0===e?(0,U.jsx)("div",{"data-attention-island":!0,"data-attention-zero":!0,role:"status","aria-label":l("attention.badge",{count:0}),className:"flex items-center rounded-full border border-border bg-card/95 px-3 py-1 text-[12px] font-bold text-muted shadow-1",children:t?(0,U.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,U.jsx)(i4.A,{className:"h-3 w-3","aria-hidden":!0})," 0"]}):(0,U.jsxs)("span",{children:[(0,U.jsx)("span",{className:"uppercase tracking-[0.08em]",children:l("attention.needsYou")})," 0"]})}):(0,U.jsxs)("div",{"data-attention-island":!0,className:"flex items-center overflow-hidden rounded-full border border-warning/45 bg-warning-soft shadow-1",children:[(0,U.jsx)("button",{type:"button","data-attention-count":!0,className:`text-[12px] font-bold text-warning hover:bg-warning/15 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent/40 ${t?"inline-flex min-h-11 items-center px-3.5":"px-3 py-1"}`,"aria-expanded":n,"aria-label":l("attention.badge",{count:e}),title:l("attention.openQueue"),onClick:i,children:t?(0,U.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,U.jsx)(i4.A,{className:"h-3 w-3","aria-hidden":!0})," ",e]}):(0,U.jsxs)("span",{children:[(0,U.jsx)("span",{className:"uppercase tracking-[0.08em]",children:l("attention.needsYou")})," ",e]})}),(0,U.jsx)("div",{className:"h-4 w-px shrink-0 bg-warning/45","aria-hidden":!0}),(0,U.jsx)("button",{type:"button","data-attention-next":!0,className:`text-[12px] font-bold text-warning hover:bg-warning/15 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent/40 ${t?"inline-flex min-h-11 items-center px-2.5":"inline-flex items-center gap-0.5 py-1 pl-2 pr-1.5"}`,"aria-label":l("attention.nextHint"),"aria-keyshortcuts":"n shift+n",title:l("attention.nextHint"),onClick:e=>a(e.shiftKey?-1:1),children:t?(0,U.jsx)(i3.A,{className:"h-4 w-4","aria-hidden":!0}):(0,U.jsxs)(U.Fragment,{children:[l("attention.next"),(0,U.jsx)(i3.A,{className:"h-3.5 w-3.5","aria-hidden":!0})]})}),t?null:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("div",{className:"h-4 w-px shrink-0 bg-warning/45","aria-hidden":!0}),(0,U.jsx)("button",{type:"button","data-attention-filter":!0,className:`px-2 py-1.5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent/40 ${r?"bg-warning/30 text-warning":"text-warning/70 hover:bg-warning/15 hover:text-warning"}`,"aria-pressed":r,title:l(r?"attention.filterOff":"attention.filterOn"),"aria-label":l(r?"attention.filterOff":"attention.filterOn"),onClick:s,children:(0,U.jsx)(i6.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})]})]})}let i7="llv-operator",i9="llv.operator.capability";var ae=n(7542),at=n(825),an=n(1275),ar=n(744);function ai(e){let t=e.match(/^#a=(.+)$/);if(!t)return null;try{return decodeURIComponent(t[1])}catch{return t[1]}}let aa=[];function as({containerRef:e,onClose:t,lockScroll:n=!0,manageFocus:r=!0}){let i=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{let t,a=(t=Symbol("modal-layer"),aa.push(t),t);i.current=a;let s=r&&document.activeElement instanceof HTMLElement?document.activeElement:null;r&&e.current?.focus();let l=n?document.body.style.overflow:null;return n&&(document.body.style.overflow="hidden"),()=>{aa=aa.filter(e=>e!==a),i.current=null,n&&null!==l&&(document.body.style.overflow=l),r&&s?.isConnected&&s.focus()}},[]),(0,Y.useEffect)(()=>{let n=n=>{let r=i.current;if(!r||!(aa.length>0)||aa[aa.length-1]!==r)return;if("Escape"===n.key)return void t();if("Tab"!==n.key)return;let a=e.current;if(!a)return;let s=[...a.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')].filter(e=>!e.hasAttribute("disabled")&&function(e){let t=e.getAttribute("tabindex");if(null===t)return!0;let n=Number.parseInt(t,10);return Number.isNaN(n)||n>=0}(e));if(!s.length){n.preventDefault(),a.focus();return}let l=s[0],o=s[s.length-1],c=document.activeElement,d=c instanceof HTMLElement&&a.contains(c);n.shiftKey?d&&c!==l&&c!==a||(n.preventDefault(),o.focus()):d&&c!==o||(n.preventDefault(),l.focus())};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[t,e])}let al=0,ao=new Set;function ac(e){let t=Number.isFinite(e)&&e>0?e:0;if(t!==al)for(let e of(al=t,[...ao]))e()}function ad(){return al}function au(e){return ao.add(e),()=>{ao.delete(e)}}var ap=n(5775),am=n(6565),af=n(2125),ah=n(8962);function ax({path:e,meta:t,mobile:n,onFailure:r}){let{t:i}=(0,eh.Ym)(),[a,s]=(0,Y.useState)(null),[l,o]=(0,Y.useState)(null),[c,d]=(0,Y.useState)(!0),[u,p]=(0,Y.useState)(1),[m,f]=(0,Y.useState)(0),[h,x]=(0,Y.useState)(0),[g,b]=(0,Y.useState)(!1),v=(0,Y.useRef)(null),w=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{let n=new AbortController,i=null;return fetch((0,ap.Fe)(e),{signal:n.signal,headers:{"if-match":t.etag}}).then(async e=>{if(!e.ok)return void r((0,ap.pB)(e.status));let t=await e.blob();n.signal.aborted||s(i=URL.createObjectURL(t))}).catch(()=>{n.signal.aborted||r("error")}),()=>{n.abort(),i&&URL.revokeObjectURL(i)}},[e,t.etag,r]);let y=(0,Y.useCallback)((e,t=0,n=0)=>{d(!1),p(r=>{let i=Math.min(16,Math.max(.1,r*e)),a=i/r;return f(e=>t-(t-e)*a),x(e=>n-(n-e)*a),i})},[]),k=(0,Y.useCallback)(()=>{d(!0),p(1),f(0),x(0)},[]),j=n?"h-11 w-11":"h-7 w-7",N=n?"h-5 w-5":"h-3.5 w-3.5";return(0,U.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,U.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5 border-b border-border px-3 py-1.5 text-[11.5px] text-muted",children:[l?(0,U.jsxs)("span",{"data-image-dimensions":!0,className:"tabular-nums",children:[l.w," \xd7 ",l.h]}):null,(0,U.jsxs)("span",{className:"ml-auto flex items-center gap-1.5",children:[(0,U.jsx)("button",{type:"button","aria-label":i("lightbox.zoomOut"),title:i("lightbox.zoomOut"),onClick:()=>y(1/1.4),className:`flex ${j} items-center justify-center rounded-[8px] border border-border bg-canvas text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,children:(0,U.jsx)(am.A,{className:N,"aria-hidden":!0})}),(0,U.jsx)("span",{className:"w-10 text-center tabular-nums",children:c?i("preview.fit"):`${Math.round(100*u)}%`}),(0,U.jsx)("button",{type:"button","aria-label":i("lightbox.zoomIn"),title:i("lightbox.zoomIn"),onClick:()=>y(1.4),className:`flex ${j} items-center justify-center rounded-[8px] border border-border bg-canvas text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,children:(0,U.jsx)(af.A,{className:N,"aria-hidden":!0})}),(0,U.jsx)("button",{type:"button","aria-label":i("preview.fitImage"),title:i("preview.fitImage"),onClick:k,className:`flex ${j} items-center justify-center rounded-[8px] border border-border focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${c?"bg-accent/15 text-accent":"bg-canvas text-muted hover:text-primary"}`,children:(0,U.jsx)(ah.A,{className:N,"aria-hidden":!0})})]})]}),(0,U.jsx)("div",{ref:w,className:`relative min-h-0 flex-1 overflow-hidden bg-canvas ${c?"":g?"cursor-grabbing":"cursor-grab"}`,onWheel:e=>{let t=w.current?.getBoundingClientRect();t&&y(e.deltaY<0?1.2:1/1.2,e.clientX-t.left-t.width/2,e.clientY-t.top-t.height/2)},onPointerDown:e=>{c||(e.preventDefault(),e.target.setPointerCapture?.(e.pointerId),v.current={x:e.clientX,y:e.clientY,tx:m,ty:h},b(!0))},onPointerMove:e=>{v.current&&(f(v.current.tx+e.clientX-v.current.x),x(v.current.ty+e.clientY-v.current.y))},onPointerUp:()=>{v.current=null,b(!1)},onDoubleClick:e=>{c?w.current?.getBoundingClientRect()&&(d(!1),p(2),f(0),x(0)):k()},children:(0,U.jsx)("div",{className:c?"flex h-full w-full items-center justify-center p-3":"flex h-full w-full items-center justify-center",children:a?(0,U.jsx)("img",{src:a,alt:t.name,draggable:!1,onLoad:e=>{let t=e.target;o({w:t.naturalWidth,h:t.naturalHeight})},onError:()=>r("error"),className:c?"max-h-full max-w-full object-contain":"max-w-none select-none",style:c?void 0:{transform:`translate(${m}px, ${h}px) scale(${u})`}}):(0,U.jsx)("span",{className:"text-[13px] text-muted",role:"status",children:i("preview.loading")})})})]})}let ag=new Set;var ab=n(4088),av=n(2363),aw=n(8135);let ay={ts:"typescript",tsx:"typescript",mts:"typescript",cts:"typescript",typescript:"typescript",js:"javascript",jsx:"javascript",mjs:"javascript",cjs:"javascript",javascript:"javascript",json:"json",jsonc:"json",sh:"bash",bash:"bash",zsh:"bash",shell:"bash",py:"python",python:"python",md:"markdown",markdown:"markdown",yml:"yaml",yaml:"yaml",css:"css",scss:"css",go:"go",html:"xml",xml:"xml",svg:"xml"},ak=null;async function aj(){try{let e=(await n.e(7067).then(n.bind(n,7067))).default,[t,r,i,a,s,l,o,c,d,u]=await Promise.all([n.e(3015).then(n.bind(n,3015)),n.e(9583).then(n.bind(n,9583)),n.e(7774).then(n.bind(n,7774)),n.e(6370).then(n.bind(n,6370)),n.e(2462).then(n.bind(n,2462)),n.e(2345).then(n.bind(n,2345)),n.e(1783).then(n.bind(n,1783)),n.e(8327).then(n.bind(n,8327)),n.e(858).then(n.bind(n,858)),n.e(7297).then(n.bind(n,7297))]);return e.registerLanguage("typescript",t.default),e.registerLanguage("javascript",r.default),e.registerLanguage("json",i.default),e.registerLanguage("bash",a.default),e.registerLanguage("python",s.default),e.registerLanguage("markdown",l.default),e.registerLanguage("yaml",o.default),e.registerLanguage("css",c.default),e.registerLanguage("go",d.default),e.registerLanguage("xml",u.default),e}catch{return null}}function aN(e,t){let[n,r]=(0,Y.useState)(null);return(0,Y.useEffect)(()=>{let n=t?ay[t.toLowerCase()]??null:null;if(!n||e.length>5e4)return;let i=!1;return(!ak&&(ak=aj()),ak).then(t=>{if(!i&&t&&t.getLanguage(n))try{let a=t.highlight(e,{language:n,ignoreIllegal:!0}).value;i||r({code:e,html:a})}catch{}}),()=>{i=!0}},[e,t]),n&&n.code===e?n.html:null}let aS=/<span[^>]*>|<\/span>/g;function aC(e,t){let n=[],r=e.toLowerCase(),i=t.toLowerCase(),a=r.indexOf(i);for(;-1!==a;)n.push(a),a=r.indexOf(i,a+Math.max(i.length,1));return n}function aA({line:e,query:t}){let n=aC(e,t);if(!n.length)return(0,U.jsx)(U.Fragment,{children:e});let r=[],i=0;return n.forEach((n,a)=>{r.push((0,U.jsx)(Y.Fragment,{children:e.slice(i,n)},`t${a}`)),r.push((0,U.jsx)("mark",{className:"rounded-[3px] bg-warning/40 text-primary",children:e.slice(n,n+t.length)},`m${a}`)),i=n+t.length}),r.push((0,U.jsx)(Y.Fragment,{children:e.slice(i)},"tail")),(0,U.jsx)(U.Fragment,{children:r})}function aI({path:e,meta:t,mobile:n,onFailure:r}){let{t:i}=(0,eh.Ym)(),[a,s]=(0,Y.useState)([]),[l,o]=(0,Y.useState)(0),[c,d]=(0,Y.useState)(!1),[u,p]=(0,Y.useState)(!0),[m,f]=(0,Y.useState)(""),[h,x]=(0,Y.useState)(0),g=(0,Y.useRef)(null),b=(0,Y.useRef)(null),v=l>=t.size,w=(0,Y.useCallback)(async()=>{if(c)return;d(!0);let n=new AbortController;g.current=n;try{let i=Math.min(l+262144,t.size)-1,a=await fetch((0,ap.Fe)(e),{signal:n.signal,headers:{range:`bytes=${l}-${i}`,"if-match":t.etag}});if(!a.ok)return void r((0,ap.pB)(a.status));let c=new Uint8Array(await a.arrayBuffer());s(e=>[...e,c]),o(e=>e+c.byteLength)}catch{n.signal.aborted||r("error")}finally{d(!1)}},[c,l,t,e,r]);(0,Y.useEffect)(()=>(t.size>0&&w(),()=>g.current?.abort()),[]);let y=(0,Y.useMemo)(()=>{if(!a.length)return"";let e=new Uint8Array(a.reduce((e,t)=>e+t.byteLength,0)),t=0;for(let n of a)e.set(n,t),t+=n.byteLength;return new TextDecoder("utf-8",{fatal:!1}).decode(e)},[a]),k=(0,Y.useMemo)(()=>y.split("\n"),[y]),j=(0,Y.useMemo)(()=>t.name.split(".").pop()??null,[t.name]),N=aN(y,m?null:j),S=(0,Y.useMemo)(()=>{let e,t;return N?(e=N.split("\n"),t=[],e.map(e=>{let n=t.join("");for(let n of e.matchAll(aS))"</span>"===n[0]?t.pop():t.push(n[0]);return n+e+"</span>".repeat(t.length)})):null},[N]),C=(0,Y.useMemo)(()=>{if(!m)return[];let e=[];return k.forEach((t,n)=>{for(let r of aC(t,m))e.push({line:n,offset:r})}),e},[k,m]),A=(0,Y.useCallback)(e=>{C.length&&x(t=>(t+e+C.length)%C.length)},[C.length]);(0,Y.useEffect)(()=>{if(!m||!C.length)return;let e=C[Math.min(h,C.length-1)].line;b.current?.querySelector(`[data-preview-line="${e}"]`)?.scrollIntoView({block:"center"})},[m,h,C]);let I=`${Math.max(String(k.length).length,3)}ch`,M=n?"h-11 w-11":"h-7 w-7",T=n?"h-5 w-5":"h-3.5 w-3.5";return(0,U.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,U.jsxs)("div",{className:"flex shrink-0 flex-wrap items-center gap-1.5 border-b border-border px-3 py-1.5",children:[(0,U.jsx)("input",{type:"search",value:m,onInput:e=>{f(e.target.value),x(0)},placeholder:i("preview.searchPlaceholder"),"aria-label":i("preview.searchPlaceholder"),className:`${n?"h-11":"h-7"} min-w-0 flex-1 rounded-[8px] border border-border bg-canvas px-2 text-[12px] text-primary placeholder:text-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`}),m?(0,U.jsx)("span",{className:"text-[11.5px] tabular-nums text-muted","data-preview-matches":!0,children:C.length?`${Math.min(h+1,C.length)}/${C.length}`:i("preview.noMatches")}):null,m?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("button",{type:"button","aria-label":i("preview.prevMatch"),title:i("preview.prevMatch"),onClick:()=>A(-1),className:`flex ${M} items-center justify-center rounded-[8px] border border-border bg-canvas text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,children:(0,U.jsx)(ab.A,{className:T,"aria-hidden":!0})}),(0,U.jsx)("button",{type:"button","aria-label":i("preview.nextMatch"),title:i("preview.nextMatch"),onClick:()=>A(1),className:`flex ${M} items-center justify-center rounded-[8px] border border-border bg-canvas text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,children:(0,U.jsx)(av.A,{className:T,"aria-hidden":!0})})]}):null,(0,U.jsx)("button",{type:"button","aria-pressed":u,"aria-label":i("preview.wrapLines"),title:i("preview.wrapLines"),onClick:()=>p(e=>!e),className:`flex ${M} items-center justify-center rounded-[8px] border border-border focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${u?"bg-accent/15 text-accent":"bg-canvas text-muted hover:text-primary"}`,children:(0,U.jsx)(aw.A,{className:T,"aria-hidden":!0})})]}),(0,U.jsx)("div",{ref:b,className:"min-h-0 flex-1 overflow-auto bg-canvas font-mono text-[11.5px] leading-[1.5]",children:(0,U.jsx)("div",{className:u?"":"w-max min-w-full",children:k.map((e,t)=>(0,U.jsxs)("div",{"data-preview-line":t,className:"flex",children:[(0,U.jsx)("span",{"data-line-number":!0,"aria-hidden":!0,className:"sticky left-0 shrink-0 select-none border-r border-border bg-sunken px-1.5 text-right text-muted",style:{width:I,minWidth:I},children:t+1}),m?(0,U.jsx)("span",{className:`px-2 ${u?"whitespace-pre-wrap break-all":"whitespace-pre"}`,children:(0,U.jsx)(aA,{line:e,query:m})}):S&&void 0!==S[t]?(0,U.jsx)("span",{className:`hljs bg-transparent px-2 ${u?"whitespace-pre-wrap break-all":"whitespace-pre"}`,dangerouslySetInnerHTML:{__html:S[t]}}):(0,U.jsx)("span",{className:`px-2 ${u?"whitespace-pre-wrap break-all":"whitespace-pre"}`,children:e})]},t))})}),(0,U.jsxs)("div",{className:"flex shrink-0 items-center gap-2 border-t border-border px-3 py-1.5 text-[11.5px] text-muted",children:[(0,U.jsx)("span",{children:i("preview.loadedOf",{loaded:(0,ap.z3)(l),size:(0,ap.z3)(t.size)})}),v?null:(0,U.jsx)("button",{type:"button",disabled:c,onClick:()=>void w(),className:`ml-auto rounded-[8px] border border-border bg-card font-semibold text-primary hover:bg-canvas focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-50 ${n?"h-11 px-3":"px-2.5 py-1"}`,children:i(c?"preview.loading":"preview.loadMore")})]})]})}let aM=(0,Y.lazy)(()=>n.e(8293).then(n.bind(n,8293))),aT="llvPreviewWidth";function aP(){try{let e=window.localStorage.getItem(aT),t=Number(e);if(Number.isFinite(t)&&t>=380)return t}catch{}return 560}function a$({mobile:e}){let[t,n]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{var e;return e=e=>{n(t=>({path:e.path,nonce:(t?.nonce??0)+1}))},ag.add(e),()=>{ag.delete(e)}},[]),(0,Y.useEffect)(()=>{let e=()=>{let e=ai(window.location.hash);n(t=>null!==e?{path:e,nonce:(t?.nonce??0)+1,fromFragment:!0}:t?.fromFragment?null:t)};return e(),window.addEventListener("hashchange",e),()=>window.removeEventListener("hashchange",e)},[]);let r=(0,Y.useCallback)(()=>{n(null),null!==ai(window.location.hash)&&window.history.replaceState(window.history.state,"",window.location.pathname+window.location.search)},[]);return t?(0,U.jsx)(aE,{open:t,mobile:e,onClose:r,onReload:n},"sheet"):null}function aE({open:e,mobile:t,onClose:n,onReload:r}){let{t:i}=(0,eh.Ym)(),a=(0,Y.useRef)(null),[s,l]=(0,Y.useState)(null),[o,c]=(0,Y.useState)(null),[d,u]=(0,Y.useState)(aP),p=(0,Y.useSyncExternalStore)(au,ad,()=>0);as({containerRef:a,onClose:n}),(0,Y.useEffect)(()=>{l(null),c(null);let t=new AbortController;return fetch((0,ap.BB)(e.path),{signal:t.signal}).then(async e=>{e.ok?l(await e.json()):c((0,ap.pB)(e.status))}).catch(()=>{t.signal.aborted||c("error")}),()=>t.abort()},[e]);let m=(0,Y.useCallback)(e=>{let t=e=>{u(Math.min(Math.max(380,window.innerWidth-e.clientX),Math.max(380,window.innerWidth-320-Math.max(0,ad()))))},n=()=>{window.removeEventListener("pointermove",t),window.removeEventListener("pointerup",n),u(e=>{try{window.localStorage.setItem(aT,String(e))}catch{}return e})};window.addEventListener("pointermove",t),window.addEventListener("pointerup",n)},[]),f=s?.name??(0,ap.BI)(e.path),h=s?.kind??(0,ar.fn)(e.path)?.kind??null,x=o??(s?"ready":"loading"),g=(0,Y.useCallback)(()=>r({...e,nonce:e.nonce+1}),[r,e]),b=(0,Y.useCallback)(e=>c(e),[]),v=o?(0,U.jsxs)("div",{className:"flex flex-1 flex-col items-center justify-center gap-3 p-6 text-center",role:"alert",children:[(0,U.jsx)(ae.A,{className:"h-8 w-8 text-warning","aria-hidden":!0}),(0,U.jsx)("div",{className:"max-w-[340px] text-[13px] font-semibold text-primary",children:i("missing"===o?"preview.missing":"denied"===o?"preview.denied":"unsupported"===o?"preview.unsupported":"oversized"===o?"preview.oversized":"changed"===o?"preview.changed":"aborted"===o?"preview.aborted":"preview.error")}),s?(0,U.jsx)("div",{className:"text-[12px] text-muted",children:(0,ap.z3)(s.size)}):null,"changed"===o||"error"===o||"aborted"===o?(0,U.jsx)("button",{type:"button",className:"rounded-[8px] border border-border bg-card px-3 py-1.5 text-[12.5px] font-semibold text-primary hover:bg-canvas focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:g,children:i("preview.reload")}):null]}):s?"text"===s.kind?(0,U.jsx)(aI,{path:e.path,meta:s,mobile:t,onFailure:b},`${e.nonce}`):"image"===s.kind?(0,U.jsx)(ax,{path:e.path,meta:s,mobile:t,onFailure:b},`${e.nonce}`):(0,U.jsx)(Y.Suspense,{fallback:(0,U.jsx)("div",{className:"flex flex-1 items-center justify-center p-6 text-[13px] text-muted",role:"status",children:i("preview.loading")}),children:(0,U.jsx)(aM,{path:e.path,etag:s.etag,mobile:t,onFailure:b},`${e.nonce}`)}):(0,U.jsx)("div",{className:"flex flex-1 items-center justify-center p-6 text-[13px] text-muted",role:"status",children:i("preview.loading")});return(0,nx.createPortal)((0,U.jsxs)("div",{ref:a,tabIndex:-1,role:"dialog","aria-modal":"true","aria-label":i("preview.dialogTitle",{name:f}),"data-artifact-preview":!0,"data-artifact-state":x,"data-artifact-kind":h??"",className:`fixed z-50 flex flex-col border-border bg-card shadow-1 focus-visible:outline-none ${t?"inset-0":"inset-y-0 right-0 border-l"}`,"data-artifact-preview-inset":t?void 0:p,style:t?void 0:{width:`max(380px, min(${d}px, calc(100vw - ${320+p}px)))`},children:[t?null:(0,U.jsx)("div",{role:"separator","aria-orientation":"vertical","aria-label":i("preview.resize"),title:i("preview.resize"),className:"absolute inset-y-0 left-0 w-1.5 cursor-col-resize hover:bg-accent/30",onPointerDown:e=>{e.preventDefault(),m(e.nativeEvent)}}),(0,U.jsxs)("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-2",children:[(0,U.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,U.jsx)("div",{className:"truncate text-[13px] font-bold text-primary",title:f,children:f}),(0,U.jsxs)("div",{className:"flex items-center gap-1.5 text-[11px] text-muted",children:[(0,U.jsx)("span",{children:i("pdf"===h?"preview.kindPdf":"image"===h?"preview.kindImage":"text"===h?"preview.kindText":"preview.kindUnknown")}),s?(0,U.jsx)("span",{"aria-hidden":!0,children:"\xb7"}):null,s?(0,U.jsx)("span",{children:(0,ap.z3)(s.size)}):null]})]}),(0,U.jsx)("a",{href:(0,ap.Fe)(e.path,{download:!0}),download:f,"aria-label":i("preview.download"),title:i("preview.download"),className:`flex shrink-0 items-center justify-center rounded-[8px] border border-border bg-canvas text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${t?"h-11 w-11":"h-7 w-7"}`,children:(0,U.jsx)(at.A,{className:t?"h-5 w-5":"h-3.5 w-3.5","aria-hidden":!0})}),(0,U.jsx)("a",{href:(0,ap.Fe)(e.path),target:"_blank",rel:"noreferrer","aria-label":i("preview.openExternal"),title:i("preview.openExternal"),className:`flex shrink-0 items-center justify-center rounded-[8px] border border-border bg-canvas text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${t?"h-11 w-11":"h-7 w-7"}`,children:(0,U.jsx)(an.A,{className:t?"h-5 w-5":"h-3.5 w-3.5","aria-hidden":!0})}),(0,U.jsx)("button",{type:"button","aria-label":i("preview.close"),title:i("preview.close"),onClick:n,className:`flex shrink-0 items-center justify-center rounded-[8px] border border-border bg-canvas text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${t?"h-11 w-11":"h-7 w-7"}`,children:(0,U.jsx)(K.A,{className:t?"h-5 w-5":"h-4 w-4","aria-hidden":!0})})]}),v]}),document.body)}let aR="llv.bridge.pendingAcks",aO=[],aD=!1;function aL(){if(!aD){aD=!0;try{let e=window.sessionStorage.getItem(aR),t=e?JSON.parse(e):null;if(!Array.isArray(t))return;aO=t.flatMap(e=>"string"==typeof e?.waitingOn&&"string"==typeof e.ackToken?[{waitingOn:e.waitingOn,ackToken:e.ackToken,at:Number(e.at)||0,sessionId:"string"==typeof e.sessionId?e.sessionId:null}]:[])}catch{}}}function a_(){try{window.sessionStorage.setItem(aR,JSON.stringify(aO))}catch{}}function aF(e,t,n={}){if(!e||!t)return;aL();let r={waitingOn:e,ackToken:t,at:n.now??Date.now(),sessionId:n.sessionId??null};aO=[...aO.filter(t=>t.waitingOn!==e),r].slice(-32),a_()}function aq(e){return aL(),aO.find(t=>t.waitingOn===e)?.ackToken??null}function az(){return aL(),aO.map(({waitingOn:e,ackToken:t,sessionId:n})=>({waitingOn:e,ackToken:t,sessionId:n}))}function aH(e){aL();let t=aO.filter(t=>t.waitingOn!==e);t.length!==aO.length&&(aO=t,a_())}let aU={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>{clearTimeout(e)}};class aB extends Error{constructor(e,t){super(e),this.name="DeadlineExceededError",this.timeoutMs=t}}function aK(e,t){let n=Math.max(1,Math.floor(e)),r=Math.min(Math.max(t.jitter??0,0),1),i=t.random??Math.random;return Math.max(0,Math.round(Math.min(t.maxMs,t.baseMs*2**Math.min(n-1,30))*(1-r*i())))}let aY=Math.floor(1e4),aW=globalThis;function aV(){return aW.__llvRetiredBridgeSessions??=[]}function aJ(e){return aV().find(t=>t.sessionId===e)??null}function aG(e){return 401===e||403===e}async function aQ(e,t,n,r){let i=function(e,t={}){let n,r=t.scheduler??aU,i=new AbortController,a=t.signal??null,s=!1,l=()=>{void 0!==n&&(r.clearTimeout(n),n=void 0),s&&(a?.removeEventListener("abort",o),s=!1)};function o(){l(),i.signal.aborted||i.abort(a?.reason)}return a?.aborted?i.abort(a.reason):(a&&(a.addEventListener("abort",o,{once:!0}),s=!0),Number.isFinite(e)&&e>=0&&(n=r.setTimeout(()=>{n=void 0,l(),i.signal.aborted||i.abort(new aB(t.reason??"deadline exceeded",e))},e))),{signal:i.signal,release:l}}(r.timeoutMs??8e3,{signal:r.signal??null,scheduler:r.scheduler??aU,reason:"bridge request deadline exceeded"});try{return await e(t,{...n,signal:i.signal})}finally{i.release()}}let aX={text:"",ackToken:"",commit:()=>void 0};async function aZ(e,t=fetch,n={}){if(!e)return;let r=await aQ(t,"/api/bridge",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({ackToken:e})},n);if(!r.ok)throw new a0(r.status)}class a0 extends Error{constructor(e){super(`bridge acknowledgement refused with ${e}`),this.name="BridgeAcknowledgementRefused",this.status=e}}function a1(e){return e instanceof a0&&409===e.status}async function a2(e=fetch,t=()=>!0,n={}){for(let r of az())if(t(r.waitingOn))try{await aZ(r.ackToken,e,n),aH(r.waitingOn)}catch(e){a1(e)&&aH(r.waitingOn)}}let a5=new Set,a4=new Map,a3=null,a6=null,a8=null;function a7(e,t){return e?.conversationId===t?.conversationId&&e?.phase===t?.phase}function a9(e){return a5.add(e),()=>a5.delete(e)}function se(){return a6}function st(){return a8}function sn(){return null}function sr(){return null}var si=n(56);function sa(e=Date.now()){return(0,si.ln)({context:ip.getContext(),slice:ip.getSlice(),cards:ip.getCards(),identity:ip.getIdentity(),revision:ip.getSelectionRevision(),now:e})}let ss=[];function sl(e){return e&&"object"==typeof e&&!Array.isArray(e)?e:null}function so(e,t){let n=sl(e);return n&&"string"==typeof n[t]?n[t]:null}function sc(e){let t=sl(e.turn),n=sl(e.item),r=(Array.isArray(e.content)?e.content:Array.isArray(n?.content)?n.content:[]).map(e=>"string"==typeof e?e:so(e,"text")??so(e,"transcript")??"").join("");return(so(e,"transcript")??so(e,"text")??so(e,"delta")??so(t,"transcript")??so(t,"text")??so(n,"transcript")??so(n,"text")??r).slice(0,12e3)}async function sd(e){let t=await e.json().catch(()=>({}));if(!e.ok)throw Error("string"==typeof t.error?t.error:`Realtime request failed (${e.status})`);return t}async function su(e){"complete"!==e.iceGatheringState&&await new Promise(t=>{let n=window.setTimeout(r,5e3);function r(){window.clearTimeout(n),e.removeEventListener("icegatheringstatechange",i),t()}function i(){"complete"===e.iceGatheringState&&r()}e.addEventListener("icegatheringstatechange",i)})}class sp{constructor(e){this.conversationId=e,this.snapshot={phase:"idle",lines:[],error:null,startedAt:null,micMuted:!1,outputMuted:!1},this.listeners=new Set,this.peer=null,this.events=null,this.media=null,this.audio=null,this.pendingWorkerDeliveries=new Map,this.acknowledgedWorkerDeliveries=new Set,this.deliveryAcknowledgedListeners=new Set,this.realtimeSessionId=null,this.workerDeliveryFlush=null,this.workerDeliveryWakeEpoch=null,this.unloadHangup=null,this.lineSequence=0,this.openTranscriptLines=new Map,this.epoch=0,this.subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e)),this.getSnapshot=()=>this.snapshot,this.onDeliveryAcknowledged=e=>(this.deliveryAcknowledgedListeners.add(e),()=>this.deliveryAcknowledgedListeners.delete(e)),this.micStream=()=>this.media,this.toggleMic=()=>{let e=!this.snapshot.micMuted;for(let t of this.media?.getAudioTracks()??[])t.enabled=!e;this.update({micMuted:e})},this.toggleOutput=()=>{let e=!this.snapshot.outputMuted;this.audio&&(this.audio.muted=e),this.update({outputMuted:e})},this.realtimeSession=()=>this.realtimeSessionId}async start(){if("connecting"===this.snapshot.phase||"live"===this.snapshot.phase)return;if(!navigator.mediaDevices?.getUserMedia||"u"<typeof RTCPeerConnection)return void this.setError("Realtime audio is unavailable in this browser");this.cleanupTransport(),this.update({phase:"connecting",error:null,startedAt:null,micMuted:!1,outputMuted:!1});let e=++this.epoch;try{let t=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}}),n=new RTCPeerConnection,r=n.createDataChannel("oai-events"),i=new Audio;for(let e of(i.autoplay=!0,i.hidden=!0,document.body.append(i),this.media=t,this.peer=n,this.events=r,this.audio=i,t.getAudioTracks()))n.addTrack(e,t);if(n.ontrack=({streams:t})=>{e===this.epoch&&(t[0]&&(i.srcObject=t[0]),i.play().catch(()=>void 0))},r.onmessage=t=>{e===this.epoch&&this.acceptWireMessage(t.data)},r.onopen=()=>{e===this.epoch&&(this.update({phase:"live",error:null,startedAt:Date.now()}),this.flushWorkerDeliveries())},this.unloadHangup=()=>{try{fetch("/api/runtime/realtime",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"stop",conversationId:this.conversationId,realtimeSessionId:this.realtimeSessionId}),keepalive:!0})}catch{}},window.addEventListener("pagehide",this.unloadHangup),r.onclose=()=>{e===this.epoch&&("live"===this.snapshot.phase||"connecting"===this.snapshot.phase)&&this.failWithServerReason("Realtime connection closed",e)},n.onconnectionstatechange=()=>{e===this.epoch&&("failed"===n.connectionState||"disconnected"===n.connectionState)&&this.failWithServerReason("Realtime connection was interrupted",e)},await n.setLocalDescription(await n.createOffer()),await su(n),e!==this.epoch)return;let a=n.localDescription?.sdp;if(!a)throw Error("The browser produced no WebRTC offer");let s=await sd(await fetch("/api/runtime/realtime",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"start",conversationId:this.conversationId,sdp:a,...ip.getIdentity()?{view:ip.getIdentity()}:{}})}));if(e!==this.epoch)return;if("string"!=typeof s.sdp)throw Error("Codex returned no WebRTC answer");this.realtimeSessionId="string"==typeof s.realtimeSessionId?s.realtimeSessionId:null,await n.setRemoteDescription({type:"answer",sdp:s.sdp})}catch(t){if(e!==this.epoch)return;this.cleanupTransport(),this.setError(t instanceof Error?t.message:String(t))}}async stop(){if("idle"===this.snapshot.phase)return;this.epoch+=1,this.update({phase:"stopping",error:null});let e=null;try{await sd(await fetch("/api/runtime/realtime",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"stop",conversationId:this.conversationId,realtimeSessionId:this.realtimeSessionId})}))}catch(t){e=t instanceof Error?t.message:String(t)}this.cleanupTransport(),this.update({phase:e?"error":"idle",error:e})}updateWorkerProgress(e,t,n){e&&t&&"live"===this.snapshot.phase&&this.writeLine(`progress:${e}`,"progress",t,!n,"replace")}reconcileWorkerDeliveries(e,t={}){let n=n4(e);if(t.authoritative){let e=new Set(n.map(e=>e.deliveryId));for(let[t,n]of this.pendingWorkerDeliveries)n.sourceTurnId&&!e.has(t)&&this.pendingWorkerDeliveries.delete(t)}for(let e of n)!e.ready||this.acknowledgedWorkerDeliveries.has(e.deliveryId)||this.pendingWorkerDeliveries.set(e.deliveryId,e);this.flushWorkerDeliveries()}flushWorkerDeliveries(){if("live"!==this.snapshot.phase||0===this.pendingWorkerDeliveries.size)return;if(this.workerDeliveryFlush){this.workerDeliveryWakeEpoch=this.epoch;return}let e=this.deliverPendingWorkerResponses();this.workerDeliveryFlush=e,e.finally(()=>{if(this.workerDeliveryFlush!==e)return;this.workerDeliveryFlush=null;let t=this.workerDeliveryWakeEpoch;this.workerDeliveryWakeEpoch=null,t===this.epoch&&this.flushWorkerDeliveries()})}async deliverPendingWorkerResponses(){for(;"live"===this.snapshot.phase;){let e,t=this.pendingWorkerDeliveries.values().next().value;if(!t)return;try{e=await sd(await fetch("/api/runtime/realtime",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"deliverWorkerResponse",conversationId:this.conversationId,realtimeSessionId:this.realtimeSessionId,delivery:t})}))}catch{return}if(!0!==e.acknowledged||e.deliveryId!==t.deliveryId)return;for(let e of(this.pendingWorkerDeliveries.delete(t.deliveryId),this.acknowledgedWorkerDeliveries.add(t.deliveryId),this.deliveryAcknowledgedListeners))e(t.deliveryId)}}publishSelectedContext(){if(this.realtimeSessionId)try{fetch("/api/runtime/realtime",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"selectedContext",conversationId:this.conversationId,realtimeSessionId:this.realtimeSessionId,selectedContext:sa()})}).catch(()=>void 0)}catch{}}acceptWireMessage(e){let t;if("string"!=typeof e)return;try{t=JSON.parse(e)}catch{return}let n=function(e){let t=sl(e);if(!t)return{kind:"ignored"};let n=so(t,"type")??so(t,"method")??"";if("input_transcript.added"===n){let e=sc(t);return e?{kind:"transcript",role:"user",text:e,final:!1}:{kind:"ignored"}}if("output_transcript.added"===n){let e=sc(t);return e?{kind:"transcript",role:"assistant",text:e,final:!1}:{kind:"ignored"}}if("turn.done"===n){let e,n=sc(t);return n?{kind:"transcript",role:"user"===(e=so(t,"role")??so(t.turn,"role")??so(t.item,"role"))||"input"===e?"user":("assistant"===e,"assistant"),text:n,final:!0}:{kind:"ignored"}}if("delegation.created"===n){let e=so(t.item,"id")??so(t.delegation,"id")??so(t,"delegation_item_id")??"";return e?{kind:"delegation",id:e}:{kind:"ignored"}}return"error"===n?{kind:"error",message:(so(t,"message")??so(t.error,"message")??"Realtime conversation failed").slice(0,500)}:{kind:"ignored"}}(t);if("transcript"===n.kind)this.writeTranscript(n.role,n.text,n.final),"user"===n.role&&n.final&&this.publishSelectedContext();else{if("delegation"===n.kind)return;"error"===n.kind&&this.setError(n.message)}}writeTranscript(e,t,n){this.openTranscriptLines.delete("user"===e?"assistant":"user");let r=this.openTranscriptLines.get(e)??`${e}:${++this.lineSequence}`;n?this.openTranscriptLines.delete(e):this.openTranscriptLines.set(e,r),this.writeLine(r,e,t,n,n?"replace":"append")}writeLine(e,t,n,r,i){let a=[...this.snapshot.lines],s=a.findIndex(t=>t.id===e);if(s<0)a.push({id:e,role:t,text:n.slice(-12e3),final:r});else{let e=a[s],t="replace"===i||n.startsWith(e.text)?n:`${e.text}${n}`;a[s]={...e,text:t.slice(-12e3),final:r}}this.update({lines:a.slice(-80)})}setError(e){this.update({phase:"error",error:e.slice(0,500)})}failWithServerReason(e,t){this.setError(e),(async()=>{try{let e=await sd(await fetch("/api/runtime/realtime",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"status",conversationId:this.conversationId})})),n=so(e.failure,"message")?.trim()??"";n&&t===this.epoch&&"error"===this.snapshot.phase&&this.setError(n)}catch{}})()}update(e){let t=this.snapshot.phase;for(let t of(this.snapshot={...this.snapshot,...e},this.listeners))t();this.snapshot.phase!==t&&function(e,t){if(a4.get(e)!==t){a4.set(e,t),"idle"!==t&&(a3=e);let n=null;for(let[e,t]of a4)"idle"!==t&&(n={conversationId:e,phase:t});let r=n;if(!r&&a3&&(r={conversationId:a3,phase:a4.get(a3)??"idle"}),!(a7(r,a6)&&a7(n,a8)))for(let e of(a6=r,a8=n,a5))e()}}(this.conversationId,this.snapshot.phase)}cleanupTransport(){for(let e of(this.openTranscriptLines.clear(),this.unloadHangup&&window.removeEventListener("pagehide",this.unloadHangup),this.unloadHangup=null,this.events?.close(),this.peer?.close(),this.media?.getTracks()??[]))e.stop();this.audio?.remove(),this.events=null,this.peer=null,this.media=null,this.audio=null,this.realtimeSessionId=null}}let sm=new Map;function sf(e){let t=sm.get(e);if(t)return t;let n=new sp(e);return sm.set(e,n),n}function sh({resolveClient:e=sf}){let t=(0,Y.useSyncExternalStore)(a9,se,sr),n=t?.conversationId??null;return!function(e,t,n={}){let r=(0,Y.useRef)([]),i=(0,Y.useRef)(null),{fetchFn:a,now:s,onState:l,random:o,scheduler:c}=n,d=n.pollMs??aY,u=n.requestTimeoutMs??8e3,p=(0,Y.useRef)({onState:l,random:o});(0,Y.useEffect)(()=>{p.current={onState:l,random:o}},[l,o]),(0,Y.useEffect)(()=>{let n;if(!e||!t)return;let l=a??fetch,o=c??aU,m=s??Date.now,f=new AbortController,h=!1,x=!1,g=0,b=[],v=e=>{x||p.current.onState?.(e)},w=(e,t)=>aQ(l,e,t,{timeoutMs:u,signal:f.signal,scheduler:o}),y=async(e,t)=>{let n=await w("/api/bridge",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({ackToken:e,realtimeSessionId:t})});if(!n.ok)throw new a0(n.status)},k=async e=>{let t=[...b.flatMap(e=>{let t=aq(e);return t?[{waitingOn:e,ackToken:t}]:[]}),...az().filter(t=>t.waitingOn.startsWith("voice:")&&(null===t.sessionId||t.sessionId===e))],n=new Set,r=0;for(let i of t){if(x||r>=4)break;if(!n.has(i.waitingOn)){n.add(i.waitingOn),r+=1;try{await y(i.ackToken,e),aH(i.waitingOn),b=b.filter(e=>e!==i.waitingOn)}catch(e){if(e instanceof a0&&aG(e.status))return e.status;a1(e)&&(aH(i.waitingOn),b=b.filter(e=>e!==i.waitingOn))}}}return null},j=(e,t)=>{var n,r;let i,a,s,l,o=(n=m(),r=p.current.random,i=aJ(e),s={sessionId:e,status:t,attempts:a=(i?.attempts??0)+1,nextAttemptAt:n+aK(a,{baseMs:6e4,maxMs:9e5,jitter:.2,...r?{random:r}:{}})},(l=aV().filter(t=>t.sessionId!==e)).push(s),aW.__llvRetiredBridgeSessions=l.slice(-16),s),c=Math.max(0,o.nextAttemptAt-m());return v({kind:"retired",sessionId:e,status:t,attempts:o.attempts,retryInMs:c}),{kind:"retired",retryInMs:c}},N=async()=>{var t;let n,a=e.realtimeSession();if(!a)return v({kind:"idle"}),{kind:"idle"};let s=aJ(a);if(s&&m()<s.nextAttemptAt)return v({kind:"retired",sessionId:a,status:s.status,attempts:s.attempts,retryInMs:Math.max(0,s.nextAttemptAt-m())}),{kind:"retired",retryInMs:Math.max(0,s.nextAttemptAt-m())};v({kind:"polling",sessionId:a});let l=await k(a);if(null!==l)return j(a,l);if(x||e.realtimeSession()!==a)return{kind:"settled"};let o=new URLSearchParams({realtimeSessionId:a});for(let e of r.current)o.append("acked",e);i.current&&o.set("lastBatchAt",i.current.toISOString());let c=await w(`/api/bridge?${o.toString()}`,{cache:"no-store"});if(aG(c.status))return j(a,c.status);if(429===(t=c.status)||t>=500)return{kind:"retryable"};if(!c.ok)return{kind:"settled"};(n=aV().filter(e=>e.sessionId!==a)).length!==aV().length&&(aW.__llvRetiredBridgeSessions=n);let d=(await c.json()).plan;if(!d||x||e.realtimeSession()!==a)return{kind:"settled"};if("deliver"===d.kind)return aF(d.delivery.deliveryId,d.ackToken,{sessionId:a}),e.reconcileWorkerDeliveries([d.delivery]),i.current=new Date,{kind:"settled"};if("already-acknowledged"!==d.kind)return{kind:"settled"};try{await y(d.ackToken,a)}catch(e){if(e instanceof a0&&aG(e.status))return j(a,e.status);if(!a1(e))return{kind:"retryable"}}return{kind:"settled"}},S=e=>{x||(void 0!==n&&o.clearTimeout(n),n=o.setTimeout(()=>{n=void 0,C()},e))},C=async()=>{let t;if(!x&&!h){h=!0;try{t=await N()}catch(e){t=(e instanceof aB||"object"==typeof e&&null!==e&&"AbortError"===e.name)&&x?{kind:"idle"}:{kind:"retryable"}}finally{h=!1}if(!x){if("retryable"===t.kind){let t=aK(g+=1,{baseMs:aY,maxMs:3e5,jitter:.3,...p.current.random?{random:p.current.random}:{}}),n=e.realtimeSession();n&&v({kind:"backing-off",sessionId:n,failures:g,delayMs:t}),S(t);return}g=0,S("retired"===t.kind?Math.min(t.retryInMs,d):d)}}},A=e.onDeliveryAcknowledged(e=>{x||aq(e)&&(r.current=[...r.current,e].slice(-256),b=[...b.filter(t=>t!==e),e].slice(-256),x||h||S(0))}),I=()=>{f.abort(Error("bridge relay page hidden"))},M=window;return M?.addEventListener("pagehide",I),C(),()=>{x=!0,M?.removeEventListener("pagehide",I),A(),void 0!==n&&o.clearTimeout(n),n=void 0,f.abort(Error("bridge relay stopped"))}},[e,a,s,c,t,d,u])}((0,Y.useMemo)(()=>n?e(n):null,[n,e]),t?.phase==="live"),null}var sx=n(9992),sg=n(2298);let sb={neutral:"bg-sunken text-muted",success:"bg-success-soft text-success",warning:"bg-warning-soft text-warning",danger:"bg-danger-soft text-danger",accent:"bg-accent-soft text-accent",info:"bg-info-soft text-info"};function sv({tone:e="neutral",className:t="",shrinkable:n=!1,style:r,children:i,...a}){return(0,U.jsx)("span",{className:`inline-flex min-h-5 ${n?"min-w-0 shrink":"shrink-0"} items-center gap-1 whitespace-nowrap rounded-full px-2 py-0.5 text-caption font-semibold leading-none tabular-nums ${r?"":sb[e]} ${t}`,style:r,...a,children:i})}var sw=n(9554);let sy=0;function sk(){return sy+=1,`att-${Date.now().toString(36)}-${sy}`}function sj(e){if(e.ownsPreview&&e.preview)try{URL.revokeObjectURL?.(e.preview)}catch{}}function sN(e){return 4*Math.ceil(e/3)}function sS(e){return String(Math.round(e/1048576*10)/10)}function sC(e,t){return t&&0!==e.length?t.supported?e.length>t.maxImages?(0,eh.Tl)((0,eh.JK)(),"img.tooManyStructured",{max:t.maxImages}):e.some(e=>{var n;let r;return r=(n=e.base64).endsWith("==")?2:+!!n.endsWith("="),Math.max(0,Math.floor(3*n.length/4)-r)>t.maxRawBytesPerImage})?(0,eh.Tl)((0,eh.JK)(),"img.structuredTooLarge",{max:sS(t.maxRawBytesPerImage)}):e.reduce((e,t)=>e+t.base64.length,0)>t.maxEncodedBytesPerRequest?(0,eh.Tl)((0,eh.JK)(),"img.structuredAggregateTooLarge",{max:sS(t.maxEncodedBytesPerRequest)}):null:t.reason??(0,eh.Tl)((0,eh.JK)(),"composer.structuredImagesUnavailable"):null}function sA(e){let t=[];for(let n of e)"ready"===n.status&&n.base64&&t.push({id:n.id,base64:n.base64,mime:n.mime,preview:n.preview});return t}function sI({attachments:e,onRemove:t,onRetry:n,onClearAll:r}){let{t:i}=(0,eh.Ym)(),a=ia();if(!e.length)return null;let s=e.filter(e=>"ready"===e.status).length,l=e.length>=2?(0,U.jsxs)("button",{type:"button",onClick:r,"aria-label":i("img.clearAllAria"),className:`inline-flex shrink-0 items-center gap-1 rounded-full border border-border bg-canvas font-semibold text-muted hover:text-danger focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${a?"h-11 px-3 text-[11px]":"h-6 px-2 text-[10.5px]"}`,children:[(0,U.jsx)(sx.TB,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",i("img.clearAll")]}):null,o=(0,U.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1 text-[10.5px] font-semibold text-muted",children:[i("composer.imagesCount",{count:s||e.length})," ",(0,U.jsx)(sx.Qp,{className:"h-3 w-3","aria-hidden":!0})," ",i("img.deliveryHint")]});return a?(0,U.jsxs)("div",{"data-testid":"attachment-tray","aria-label":i("composer.imagesCount",{count:s||e.length}),className:"no-scrollbar flex max-h-16 min-w-0 max-w-full items-center gap-2 overflow-x-auto overscroll-x-contain px-2 pb-1 pt-2",children:[e.map((e,r)=>(0,U.jsx)(sP,{attachment:e,index:r,onRemove:t,onRetry:n},e.id)),l]}):(0,U.jsxs)("div",{className:"flex min-w-0 max-w-full flex-wrap items-center gap-1.5","data-testid":"attachment-tray",children:[e.map((e,r)=>(0,U.jsx)(s$,{attachment:e,index:r,onRemove:t,onRetry:n},e.id)),o,l]})}function sM(e,t,n){return"reading"===e.status?(0,U.jsx)("span",{className:"absolute inset-0 flex items-center justify-center rounded bg-canvas/70","aria-label":t("img.readingAria",{n:n+1}),children:(0,U.jsx)(sx.kr,{className:"h-4 w-4 animate-spin text-muted","aria-hidden":!0})}):"error"===e.status?(0,U.jsx)("span",{className:"absolute inset-0 flex items-center justify-center rounded bg-danger/10","aria-hidden":!0,children:(0,U.jsx)("span",{className:"text-[10px] font-bold uppercase text-danger",children:"!"})}):null}function sT({attachment:e,index:t}){let{t:n}=(0,eh.Ym)();return"ready"===e.status&&e.preview?(0,U.jsx)("img",{src:e.preview,alt:n("img.previewAlt",{n:t+1}),className:"h-full w-full rounded border border-border object-cover"}):e.preview?(0,U.jsx)("img",{src:e.preview,alt:n("img.previewAlt",{n:t+1}),className:"h-full w-full rounded border border-border object-cover opacity-60"}):(0,U.jsx)("span",{className:"flex h-full w-full items-center justify-center rounded border border-border bg-sunken text-muted","aria-hidden":!0,children:(0,U.jsx)(sx.xf,{className:"h-4 w-4"})})}function sP({attachment:e,index:t,onRemove:n,onRetry:r}){let{t:i}=(0,eh.Ym)();return(0,U.jsxs)("div",{className:"relative flex h-12 w-12 shrink-0 flex-col","data-testid":"attachment-tile","data-status":e.status,children:[(0,U.jsxs)("span",{className:"relative h-12 w-12",children:[(0,U.jsx)(sT,{attachment:e,index:t}),sM(e,i,t)]}),(0,U.jsx)("button",{type:"button",onClick:()=>n(e.id),"aria-label":i("img.removeAria",{n:t+1}),className:"absolute right-0.5 top-0.5 flex h-6 w-6 items-center justify-center rounded-full border border-border bg-card text-muted shadow-1 before:absolute before:-inset-2.5 before:content-[''] hover:text-danger focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:(0,U.jsx)(sx.X,{className:"h-3 w-3","aria-hidden":!0})}),"error"===e.status?(0,U.jsxs)("button",{type:"button",onClick:()=>r(e.id),"aria-label":i("img.retryAria",{n:t+1}),className:"absolute inset-x-0 bottom-0 mx-auto flex h-5 items-center justify-center gap-0.5 rounded-full border border-border bg-card px-1.5 text-[9px] font-bold text-warning before:absolute before:-inset-3 before:content-[''] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:[(0,U.jsx)(sx.kt,{className:"h-3 w-3","aria-hidden":!0})," ",i("img.retry")]}):null]})}function s$({attachment:e,index:t,onRemove:n,onRetry:r}){let{t:i}=(0,eh.Ym)();return(0,U.jsxs)("div",{className:"group/img relative h-10 w-10","data-testid":"attachment-tile","data-status":e.status,children:[(0,U.jsx)(sT,{attachment:e,index:t}),sM(e,i,t),(0,U.jsx)("button",{type:"button",onClick:()=>n(e.id),"aria-label":i("img.removeAria",{n:t+1}),className:"absolute -right-1 -top-1 hidden h-4 w-4 items-center justify-center rounded-full border border-border bg-card text-muted shadow-1 hover:text-danger group-hover/img:flex focus-visible:flex focus-visible:outline-none",children:(0,U.jsx)(sx.X,{className:"h-2.5 w-2.5","aria-hidden":!0})}),"error"===e.status?(0,U.jsx)("button",{type:"button",onClick:()=>r(e.id),"aria-label":i("img.retryAria",{n:t+1}),className:"absolute -bottom-1 left-1/2 flex h-4 -translate-x-1/2 items-center justify-center rounded-full border border-border bg-card px-1 text-[8px] font-bold text-warning focus-visible:outline-none",children:(0,U.jsx)(sx.kt,{className:"h-2.5 w-2.5","aria-hidden":!0})}):null]})}function sE({onFiles:e,ariaLabel:t,className:n,disabled:r=!1,disabledReason:i}){let a=(0,Y.useRef)(null);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("input",{ref:a,type:"file",accept:"image/*",multiple:!0,disabled:r,className:"hidden",onChange:t=>{e(Array.from(t.target.files??[])),t.target.value=""}}),(0,U.jsx)("button",{type:"button","aria-label":t,title:i,disabled:r,onClick:()=>a.current?.click(),className:n,children:(0,U.jsx)(sx.xf,{className:"h-4 w-4","aria-hidden":!0})})]})}async function sR(e){if(!e.busy&&!e.voiceSending){e.setVoiceSending(!0);try{var t;let n=await e.stop();if(null===n)return;let r=(t=e.currentText(),n?t?`${t.trimEnd()} ${n}`:n:t);e.setText(r),await e.submit(r)}finally{e.setVoiceSending(!1)}}}function sO(e,t){return t?Math.min(e,Math.round(t.height*t.scale)):e}function sD(e,t,{maxPx:n,minPx:r=0,pinned:i}){(0,Y.useLayoutEffect)(()=>{var t,a,s;let l=e.current;if(!l)return;let o=l.scrollTop,c=(t=l.selectionStart,a=l.selectionEnd,t===(s=l.value.length)&&a===s);l.style.height="0px",l.style.height=function(e,t,n=0){return Math.min(Math.max(e+2,n),t)}(l.scrollHeight,n,r)+"px",function({pinned:e,caretAtEnd:t}){return e||t}({pinned:i,caretAtEnd:c})?l.scrollTop=l.scrollHeight:l.scrollTop=o},[e,t,n,r,i])}function sL(e){return`${Math.floor(e/60)}:${String(e%60).padStart(2,"0")}`}function s_(e){let t=new Int16Array(e.length);for(let n=0;n<e.length;n+=1){let r=Math.max(-1,Math.min(1,e[n]??0));t[n]=r<0?32768*r:32767*r}return t}function sF(e){return Math.min(60,Math.floor(e/2))}let sq=null,sz=null,sH=async()=>{try{let e=await fetch("/api/transcribe/token",{method:"POST"});if(!e.ok)return null;let t=await e.json();if("string"!=typeof t.token||!t.token)return null;return{token:t.token,provider:"soniox"===t.provider?"soniox":"elevenlabs"}}catch{return null}};function sU(){sz||sq&&sq.expiresAt>Date.now()||(sz=sH().then(e=>(sz=null,sq={token:e,expiresAt:Date.now()+(e?45e3:15e3)},e)))}let sB=async()=>{let e=sz;if(e){let t=await e;return t&&(sq=null),t}let t=sq;return t&&t.expiresAt>Date.now()?(t.token&&(sq=null),t.token):(sq=null,sH())};function sK({onError:e,onUnclaimedText:t,onLiveCommit:n}){let{t:r}=(0,eh.Ym)(),[i,a]=(0,Y.useState)("idle"),[s,l]=(0,Y.useState)(0),[o,c]=(0,Y.useState)(""),[d,u]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)(""),f=(0,Y.useRef)(0),h=(0,Y.useRef)(null),x=(0,Y.useRef)(null),g=(0,Y.useRef)([]),b=(0,Y.useRef)(null),v=(0,Y.useRef)(!1),w=(0,Y.useRef)(null),y=(0,Y.useRef)(null),k=(0,Y.useRef)(null),j=(0,Y.useRef)(null),N=(0,Y.useRef)(!1),S=(0,Y.useRef)(!0),C=()=>{null!==w.current&&(clearInterval(w.current),w.current=null)},A=()=>{null!==h.current&&(clearTimeout(h.current),h.current=null)},I=()=>{let e=k.current;k.current=null,e&&(cancelAnimationFrame(e.raf),e.ctx.close().catch(()=>void 0))},M=()=>{let e=b.current;if(b.current=null,e){try{e.processor.disconnect()}catch{}try{void 0!==e.closeFrame&&e.ws.readyState===WebSocket.OPEN&&e.ws.send(e.closeFrame)}catch{}try{e.ws.close()}catch{}e.stream.getTracks().forEach(e=>e.stop()),e.ctx.close().catch(()=>void 0)}},T=e=>{C(),I(),M(),c(""),a("idle");let n=j.current;if(j.current=null,v.current)return void n?.(null);let r=e.partial.trim();n?n(r):r&&t(r)};(0,Y.useEffect)(()=>()=>{S.current=!1,C(),I(),A(),v.current=!0,M();let e=x.current;e&&"inactive"!==e.state&&e.stop(),e?.stream.getTracks().forEach(e=>e.stop())},[]);let P=async()=>{C(),I();let n=x.current;x.current=null,n?.stream.getTracks().forEach(e=>e.stop());let i=new Blob(g.current,{type:"audio/webm"});g.current=[];let s=j.current;if(j.current=null,v.current||i.size<2e3){a("idle"),s?.(null);return}a("busy");try{let n=new FormData;n.append("file",i,"dictation.webm");let a=await fetch("/api/transcribe",{method:"POST",body:n}),l=await a.json();if(!a.ok||"string"!=typeof l.text){e(l.error??r("dictation.failed")),s?.(null);return}let o=l.text.trim();o?s?s(o):t(o):(e(r("dictation.silence")),s?.(null))}catch{e(r("common.serverUnavailable")),s?.(null)}finally{a("idle")}},$=async()=>{if(N.current||x.current||b.current)return;N.current=!0,a("starting"),v.current=!1;let t=null,i=!0;try{let s,[o,d]=await Promise.all([navigator.mediaDevices.getUserMedia({audio:{channelCount:1}}),sB()]);if(t=o,!S.current||v.current)return;if(c(""),!(null!==d&&(s=t,"soniox"===d.provider?((t,i)=>{let a;try{a=new AudioContext({sampleRate:16e3})}catch{return!1}let s=new WebSocket("wss://stt-rt.soniox.com/transcribe-websocket");s.binaryType="arraybuffer";let l=a.createScriptProcessor(4096,1,1),o={ws:s,ctx:a,processor:l,stream:t,preOpenQueue:[],partial:"",closeFrame:""};b.current=o;let d={finalText:""},u=a.createMediaStreamSource(t);return l.onaudioprocess=e=>{if(b.current!==o)return;let t=s_(e.inputBuffer.getChannelData(0)).buffer;s.readyState===WebSocket.OPEN?s.send(t):s.readyState===WebSocket.CONNECTING&&o.preOpenQueue.push(t)},u.connect(l),l.connect(a.destination),s.addEventListener("open",()=>{if(b.current===o){for(let e of(s.send(JSON.stringify(function({token:e,sampleRate:t,languageHints:n}){let r={api_key:e,model:"stt-rt-v5",audio_format:"pcm_s16le",sample_rate:Math.round(t),num_channels:1,enable_endpoint_detection:!0};return n?.length&&(r.language_hints=n),r}({token:i,sampleRate:a.sampleRate}))),o.preOpenQueue))s.send(e);o.preOpenQueue=[]}}),s.addEventListener("message",t=>{if(b.current!==o)return;let r=function(e,t){let n,r,i;if("string"!=typeof t)return null;try{n=JSON.parse(t)}catch{return null}if(!n||"object"!=typeof n||Array.isArray(n))return null;let a=n,s=e.finalText,l="",o=[];for(let e of Array.isArray(a.tokens)?a.tokens:[])if(e&&"object"==typeof e&&"string"==typeof e.text&&e.text){if(!0!==e.is_final){l+=e.text;continue}if("<end>"===e.text){let e=s.trim();e&&o.push(e),s="";continue}s+=e.text}return{state:{finalText:s},commit:o.join(" "),liveText:(s+l).replace(/^\s+/,""),finished:!0===a.finished,error:(r="string"==typeof a.error_message?a.error_message.trim():"",i=a.error_code,r.length>0||null!=i&&0!==i?r||`Soniox stream error ${String(i)}`:null)}}(d,t.data);if(r){if(d=r.state,r.error){e(r.error),T(o);return}r.commit&&n(r.commit),o.partial=r.liveText,c(o.partial),r.finished&&T(o)}}),s.addEventListener("close",()=>{b.current!==o||j.current||(e(r("dictation.connectionLost")),T(o))}),!0})(s,d.token):((t,i)=>{let a;try{a=new AudioContext({sampleRate:16e3})}catch{return!1}let s=new URLSearchParams({model_id:"scribe_v2_realtime",token:i,audio_format:"pcm_16000",commit_strategy:"vad",vad_silence_threshold_secs:"1.2"}),l=new WebSocket(`wss://api.elevenlabs.io/v1/speech-to-text/realtime?${s.toString()}`),o=a.createScriptProcessor(4096,1,1),d={ws:l,ctx:a,processor:o,stream:t,preOpenQueue:[],partial:""};b.current=d;let u=a.createMediaStreamSource(t);return o.onaudioprocess=e=>{if(b.current!==d)return;let t=l.readyState===WebSocket.OPEN;if(!t&&l.readyState!==WebSocket.CONNECTING)return;let n=JSON.stringify({message_type:"input_audio_chunk",audio_base_64:function(e){let t=new Uint8Array(s_(e).buffer),n="";for(let e=0;e<t.length;e+=1)n+=String.fromCharCode(t[e]??0);return btoa(n)}(e.inputBuffer.getChannelData(0))});t?l.send(n):d.preOpenQueue.push(n)},u.connect(o),o.connect(a.destination),l.addEventListener("open",()=>{if(b.current===d){for(let e of d.preOpenQueue)l.send(e);d.preOpenQueue=[]}}),l.addEventListener("message",t=>{if(b.current===d)try{let i=JSON.parse(t.data);if("partial_transcript"===i.message_type)d.partial=i.text??"";else if(("committed_transcript"===i.message_type||"committed_transcript_with_timestamps"===i.message_type)&&i.text)d.partial="",n(i.text);else if("auth_error"===i.message_type||"error"===i.message_type||"invalid_request"===i.message_type||"quota_exceeded"===i.message_type){e(i.error||r("dictation.liveError")),T(d);return}c(d.partial)}catch{}}),l.addEventListener("close",()=>{b.current!==d||j.current||(e(r("dictation.connectionLost")),T(d))}),!0})(s,d.token)))){let e=MediaRecorder.isTypeSupported("audio/webm;codecs=opus")?"audio/webm;codecs=opus":MediaRecorder.isTypeSupported("audio/webm")?"audio/webm":"",n=e?new MediaRecorder(t,{mimeType:e,audioBitsPerSecond:32e3}):new MediaRecorder(t,{audioBitsPerSecond:32e3});g.current=[],n.ondataavailable=e=>{e.data.size&&g.current.push(e.data)},n.onstop=()=>{P()},n.start(250),x.current=n}i=!1,(e=>{let t;try{t=new AudioContext}catch{return}let n=t.createAnalyser();n.fftSize=128,n.smoothingTimeConstant=.7,t.createMediaStreamSource(e).connect(n);let r=new Uint8Array(n.frequencyBinCount),i=()=>{if(!k.current)return;k.current.raf=requestAnimationFrame(i),n.getByteFrequencyData(r);let e=y.current;e&&function(e,t){let n=window.devicePixelRatio||1;(e.width!==56*n||e.height!==16*n)&&(e.width=56*n,e.height=16*n);let r=e.getContext("2d");if(!r)return;r.setTransform(n,0,0,n,0,0),r.clearRect(0,0,56,16);let i=Math.max(13,Math.floor(.65*t.length))/13,[a,s,l]=function(){let e=[198,40,40];if("u"<typeof document)return e;let t=getComputedStyle(document.documentElement).getPropertyValue("--color-danger").trim(),n=t.startsWith("#")?t.slice(1):"";if(6!==n.length)return e;let r=parseInt(n,16);return[r>>16&255,r>>8&255,255&r]}();for(let e=0;e<13;e+=1){let n=Math.floor(e*i),o=Math.max(n+1,Math.floor((e+1)*i)),c=0;for(let e=n;e<o;e+=1)c+=t[e]??0;let d=c/(o-n)/255,u=Math.max(1.5,16*d);r.fillStyle=`rgba(${a}, ${s}, ${l}, ${(.35+.65*d).toFixed(3)})`,r.fillRect(4.3076923076923075*e+1,(16-u)/2,2.3076923076923075,u)}}(e,r)};k.current={ctx:t,raf:requestAnimationFrame(i)}})(t),A(),u(!1),m(""),f.current=0,l(0),a("rec"),w.current=window.setInterval(()=>{var e,t;let n,i,a=f.current,s=a+1;f.current=s,l(s);let o=(e=a,t=s,n=600-sF(600),i=600-Math.min(30,Math.floor(150)),{warn:e<n&&t>=n,ping:e<i&&t>=i,capped:e<600&&t>=600});o.warn&&m(r("dictation.capWarn")),o.ping&&t$("dictWarn",0),o.capped&&(A(),u(!0),m(r("dictation.capStopped")),t$("dictStop",0),h.current=window.setTimeout(()=>{h.current=null,S.current&&u(!1)},5e3),x.current?.state==="recording"?x.current.stop():b.current&&T(b.current))},1e3)}catch{S.current&&e(t?r("dictation.unsupported"):r("dictation.noMic"))}finally{var s;i&&(s=t,s?.getTracks().forEach(e=>e.stop())),N.current=!1,S.current&&a(e=>"starting"===e?"idle":e)}};return{phase:i,elapsed:s,maxSeconds:600,remaining:Math.max(0,600-s),capStopped:d,srMessage:p,liveText:o,canvasRef:y,start:$,stop:()=>new Promise(e=>{let t=b.current;if(t){j.current=e,T(t);return}let n=x.current;n&&"recording"===n.state?(j.current=e,n.stop()):e(null)}),discard:()=>{v.current=!0,x.current?.state==="recording"?x.current.stop():b.current&&T(b.current)}}}function sY(e){window.addEventListener("resize",e);let t=window.visualViewport;return t?.addEventListener("resize",e),()=>{window.removeEventListener("resize",e),t?.removeEventListener("resize",e)}}function sW(){return(0,Y.useSyncExternalStore)(sY,()=>{var e;return Math.max(0,(e=window.innerHeight)-sO(e,window.visualViewport))},()=>0)}function sV({initialText:e,persistText:t,submit:n,disabled:r=!1,imageCapability:i=null,holdInputWhileBusy:a=!0}){let[s,l]=(0,Y.useState)(e),o=(0,Y.useRef)(s),c=e=>{let n="function"==typeof e?e(o.current):e;o.current=n,l(n),t(n)},[d,u]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)(!1),[f,h]=(0,Y.useState)(null),x=(0,Y.useRef)(null),g=(0,Y.useRef)(c);(0,Y.useLayoutEffect)(()=>{g.current=c});let b=(0,Y.useRef)(null),v=(0,Y.useCallback)(e=>{if(b.current?.(),b.current=null,x.current=e,!e)return;let t=!1,n=()=>{t=!0},r=()=>{t&&g.current(e.value)},i=()=>{t=!1,g.current(e.value)};e.addEventListener("compositionstart",n),e.addEventListener("input",r),e.addEventListener("compositionend",i),b.current=()=>{e.removeEventListener("compositionstart",n),e.removeEventListener("input",r),e.removeEventListener("compositionend",i)}},[]),w=ia(),y=(0,Y.useSyncExternalStore)(sY,()=>sO(window.innerHeight,window.visualViewport),()=>800),k=w?Math.max(44,Math.min(Math.max(160,Math.round(.4*y)),y-156)):160,j=function(e){let[t,n]=(0,Y.useState)([]),r=(0,Y.useRef)([]),i=(0,Y.useRef)([]),a=(0,Y.useRef)(!1),s=e.imageCapability??null;(0,Y.useEffect)(()=>(a.current=!1,()=>{for(let e of(a.current=!0,r.current))sj(e);r.current=[],i.current=[]}),[]);let l=e=>{a.current||(r.current=e,i.current=sA(e),n(e))},o=(e,t)=>{l(r.current.map(n=>n.id===e?t(n):n))},c=(0,Y.useMemo)(()=>sA(t),[t]),d=t=>{let n=sC(t,s);return!n||(e.onError(n),!1)},u=(t,n)=>{new Promise((e,t)=>{let r=new FileReader;r.onload=()=>{let i=String(r.result),a=i.indexOf(",");a<0?t(Error((0,eh.Tl)((0,eh.JK)(),"img.readFailed"))):e({base64:i.slice(a+1),mime:n.type||"image/png",dataUrl:i})},r.onerror=()=>t(r.error??Error((0,eh.Tl)((0,eh.JK)(),"img.readFailed"))),r.onabort=()=>t(Error((0,eh.Tl)((0,eh.JK)(),"img.readAborted"))),r.readAsDataURL(n)}).then(n=>{let i=r.current.find(e=>e.id===t);if(!i)return;let a=[...sA(r.current.filter(e=>e.id!==t)),{id:t,base64:n.base64,mime:n.mime,preview:i.preview||n.dataUrl}];if(sC(a,s)){e.onError(sC(a,s)),o(t,e=>({...e,status:"error",error:(0,eh.Tl)((0,eh.JK)(),"img.error")}));return}o(t,e=>({...e,status:"ready",base64:n.base64,mime:n.mime,preview:e.preview||n.dataUrl}))},e=>{r.current.some(e=>e.id===t)&&o(t,t=>({...t,status:"error",error:e instanceof Error?e.message:(0,eh.Tl)((0,eh.JK)(),"img.error")}))})},p=t=>{if(!t.length)return;if(s&&!s.supported)return void e.onError(s.reason??(0,eh.Tl)((0,eh.JK)(),"composer.structuredImagesUnavailable"));let n=[];for(let r of t){if(null===(0,sw.PG)(r.type)){e.onError((0,eh.Tl)((0,eh.JK)(),"img.unsupported",{name:r.name||r.type||(0,eh.Tl)((0,eh.JK)(),"img.unknownFile")}));continue}let t=s?.maxRawBytesPerImage??sw.YP;if(r.size>t){e.onError(s?(0,eh.Tl)((0,eh.JK)(),"img.structuredTooLarge",{max:sS(t)}):(0,eh.Tl)((0,eh.JK)(),"img.tooLarge",{name:r.name||(0,eh.Tl)((0,eh.JK)(),"img.image")}));continue}n.push(r)}if(!n.length)return;let i=r.current.filter(e=>"error"!==e.status).length;if(s){if(i+n.length>s.maxImages)return void e.onError((0,eh.Tl)((0,eh.JK)(),"img.tooManyStructured",{max:s.maxImages}));if(r.current.reduce((e,t)=>e+(t.base64?.length??sN(t.file.size)),0)+n.reduce((e,t)=>e+sN(t.size),0)>s.maxEncodedBytesPerRequest)return void e.onError((0,eh.Tl)((0,eh.JK)(),"img.structuredAggregateTooLarge",{max:sS(s.maxEncodedBytesPerRequest)}))}let a=n.map(e=>{let{preview:t,ownsPreview:n}=function(e){try{let t=URL.createObjectURL;if("function"==typeof t)return{preview:t(e),ownsPreview:!0}}catch{}return{preview:"",ownsPreview:!1}}(e);return{id:sk(),status:"reading",name:e.name||(0,eh.Tl)((0,eh.JK)(),"img.image"),mime:e.type||"image/png",preview:t,file:e,ownsPreview:n}});for(let i of(l([...r.current,...a]),n.length===t.length&&e.onAdded?.(),a))u(i.id,i.file)},m=()=>{for(let e of r.current)sj(e);l([])},f=t.some(e=>"reading"===e.status),h=t.some(e=>"error"===e.status);return{attachments:t,images:c,imagesRef:i,hasReading:f,hasError:h,addFiles:p,handlePaste:e=>{let t=Array.from(e.clipboardData.items).filter(e=>e.type.startsWith("image/")).map(e=>e.getAsFile()).filter(e=>null!==e);t.length&&(e.preventDefault(),p(t))},remove:e=>{let t=r.current.find(t=>t.id===e);t&&sj(t),l(r.current.filter(t=>t.id!==e))},retry:e=>{let t=r.current.find(t=>t.id===e);t&&"error"===t.status&&(o(e,e=>({...e,status:"reading",error:void 0})),u(e,t.file))},clearAll:m,settleDelivered:e=>{let t=[...r.current],n=!1;for(let r of e){let e=r.id?t.findIndex(e=>e.id===r.id):t.findIndex(e=>"ready"===e.status&&e.base64===r.base64&&e.mime===r.mime);if(e<0)continue;let[i]=t.splice(e,1);i&&sj(i),n=!0}n&&l(t)},clear:m,replace:e=>{if(!d(e))return!1;for(let e of r.current)sj(e);return l(e.map(e=>({id:e.id??sk(),status:"ready",name:(0,eh.Tl)((0,eh.JK)(),"img.image"),mime:e.mime,preview:e.preview,base64:e.base64,file:new File([],(0,eh.Tl)((0,eh.JK)(),"img.image"),{type:e.mime}),ownsPreview:!1}))),!0},validate:()=>d(i.current)}}({onError:e=>h({kind:"err",text:e}),onAdded:()=>h(null),imageCapability:i}),N=e=>{c(t=>t?t.trimEnd()+" "+e:e),h(null),requestAnimationFrame(()=>{let e=x.current;if(!e)return;e.focus();let t=e.value.length;e.setSelectionRange(t,t),e.scrollTop=e.scrollHeight})},S=sK({onError:e=>h({kind:"err",text:e}),onUnclaimedText:N,onLiveCommit:N}),C=S.liveText?(s?s.trimEnd()+" ":"")+S.liveText:s;sD(x,C,{maxPx:k,pinned:!!S.liveText});let A="rec"===S.phase,I="busy"===S.phase,M=a&&d||p||r,T=j.hasReading||j.hasError,P=!M&&!I&&!T&&(A||!!s.trim()||j.images.length>0);return{text:s,textRef:o,setText:c,setTextState:l,displayText:C,inputRef:x,attachInput:v,status:f,setStatus:h,busy:d,setBusy:u,voiceSending:p,dictation:S,attachments:j,insertSpoken:N,stopAndSend:()=>sR({busy:d,voiceSending:p,setVoiceSending:m,stop:S.stop,currentText:()=>o.current,setText:c,submit:n}),submit:n,dictationRecording:A,dictationBusy:I,fieldsDisabled:M,canSend:P,attachmentsBlocked:T}}let sJ={phase:"idle",lines:[],error:null,startedAt:null,micMuted:!1,outputMuted:!1},sG=new Set,sQ={store:n6(),connection:"offline",resyncedAt:null,lastEventAt:null,enabled:!1,structuredHostsEnabled:!1},sX=[];function sZ(e,t,n=Object.is){let r=rd()&&1?rp():null,i=(0,Y.useRef)(e),a=(0,Y.useRef)(n),s=(0,Y.useRef)(t),l=(0,Y.useRef)(null);i.current=e,a.current=n,s.current=t,(0,Y.useEffect)(()=>{r&&r.start()},[r]);let o=(0,Y.useCallback)(e=>r?r.subscribe(e):()=>{},[r]),c=(0,Y.useCallback)(()=>{if(!r)return s.current;let e=i.current(r.getState()),t=l.current;return t?.bus===r&&a.current(t.value,e)?t.value:(l.current={bus:r,value:e},e)},[r]),d=(0,Y.useCallback)(()=>s.current,[]);return(0,Y.useSyncExternalStore)(o,c,d)}function s0(){let e,t,n,r=(e=rd()&&1?rp():null,(0,Y.useEffect)(()=>{e&&e.start()},[e]),t=(0,Y.useCallback)(t=>e?e.subscribe(t):()=>{},[e]),n=(0,Y.useCallback)(()=>e?e.getState():sQ,[e]),(0,Y.useSyncExternalStore)(t,n,()=>sQ));return{enabled:r.enabled,structuredHostsEnabled:r.structuredHostsEnabled,connection:r.connection,resyncedAt:r.resyncedAt,store:r.store}}function s1(){return sZ(e=>e.enabled,!1)}function s2(e,t){return e===t||!!e&&!!t&&e.session===t.session&&e.structuredControlsEnabled===t.structuredControlsEnabled&&e.attentions.length===t.attentions.length&&e.attentions.every((e,n)=>e===t.attentions[n])}function s5(e,t,n){var r,i;let a=s3(e.store.sessions,t,n);return a?(r=e.store,i=e.structuredHostsEnabled,{session:a,uiState:re(a,rt(r,a)),attentions:a.attentionIds.map(e=>r.attentions[e]).filter(e=>!!e&&"open"===e.state).sort((e,t)=>Number(t.unowned)-Number(e.unowned)||e.createdAt.localeCompare(t.createdAt)),receipts:a.recentReceipts,legacy:"tmux-legacy"===a.hostKind,structuredControlsEnabled:i}):null}function s4(e){return sZ(t=>s5(t,e,null),null,s2)}function s3(e,t,n){return t&&e[t]?e[t]:n?Object.values(e).find(e=>e.artifactPath===n)??null:null}function s6(e){return sZ(t=>t.enabled&&e?t.store.flows[e]??null:null,null)}async function s8(e,t){try{let n=await fetch(e,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t)}),r=await n.json().catch(()=>({}));if(!n.ok)return{ok:!1,status:n.status,error:r.error};return{ok:!0,operationId:r.operationId,receipt:r.receipt,status:n.status}}catch{return{ok:!1,error:"network"}}}function s7(){return rd()?rp().refresh():Promise.resolve(!1)}let s9=new Set,le=null,lt=!1,ln=!1,lr=!1;async function li(){if(0!==s9.size){if(lt){ln=!0;return}lt=!0;try{let e=[...s9];for(let t=0;t<e.length;t+=64){let n=e.slice(t,t+64),r=n.map((e,t)=>({id:String(t),...null!==e.pid?{pid:e.pid}:{},...e.path?{path:e.path}:{}})),i={},a=!1;try{let e=await fetch("/api/tmux/targets",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({reqs:r})});e.ok?i=(await e.json()).targets??{}:a=!0}catch{a=!0}for(let e=0;e<n.length;e+=1){let t=n[e];s9.has(t)&&(a?t.onTarget({transportError:!0}):Object.prototype.hasOwnProperty.call(i,String(e))&&t.onTarget(i[String(e)]??null))}}}finally{lt=!1,ln&&(ln=!1,li())}}}let la="default",ls=/[/\\]accounts[/\\](?:claude|codex)[/\\]([^/\\]+)[/\\]/;function ll(e){if(!e)return la;let t=ls.exec(e);return t?t[1]:la}let lo={requested:"switching","waiting-turn":"pending",preparing:"switching","successor-starting":"switching",verifying:"switching",committed:"done","failed-recoverable":"failed","rolled-back":"rolled-back"};function lc(e){return e?lo[e.phase]??null:null}function ld(e){let t=e?.targetLabel?.trim();return t?t:e?.targetAccountId?.trim()||null}function lu(e,t){if(!e)return null;let n=lc(e);if("pending"!==n&&"switching"!==n)return e;let r=e.targetAccountId?.trim();return r&&t&&r===t?null:e}function lp(e){return"pending"===e||"switching"===e}function lm(e){return e&&"object"==typeof e&&!Array.isArray(e)?e:null}function lf(e,t=0){return"number"==typeof e&&Number.isFinite(e)?e:t}function lh(e){return"string"==typeof e?e:null}let lx=new Set(["draining","stopped","complete"]),lg=new Set(["disabled","idle","waiting-fresh","cooldown","draining"]);async function lb(e,t,n){if(!e.startsWith("conversation_")||!Number.isInteger(n)||n<0)return{ok:!1,error:null};try{let r=await fetch(`/api/conversations/${encodeURIComponent(e)}/migration`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:t,expectedRevision:n})});if(r.ok)return{ok:!0,error:null};let i=await r.json().catch(()=>null);return{ok:!1,error:lh(i?.error)}}catch{return{ok:!1,error:null}}}async function lv(e,t){if(!e.startsWith("conversation_"))return{ok:!1,state:"failed",phase:null,error:null};try{let n=await fetch(`/api/conversations/${encodeURIComponent(e)}/migration`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"reseat",path:t})}),r=await n.json().catch(()=>null),i=lh(r?.reseat),a=lh(r?.phase);if(n.ok)return{ok:!0,state:"already-migrating"===i?"already-migrating":"requested",phase:a,error:null};if("already-reseated"===i)return{ok:!0,state:"already-reseated",phase:null,error:null};return{ok:!1,state:"failed",phase:null,error:lh(r?.error)}}catch{return{ok:!1,state:"failed",phase:null,error:null}}}var lw=n(846);function ly({label:e,side:t="top",align:n="center",children:r}){return(0,U.jsxs)("span",{className:"group/hint relative inline-flex",children:[r,(0,U.jsx)("span",{role:"tooltip",className:`pointer-events-none absolute z-[60] whitespace-nowrap rounded-[7px] bg-primary px-2 py-1 text-[10.5px] font-semibold text-white opacity-0 shadow-1 transition-opacity delay-150 duration-100 group-focus-within/hint:opacity-100 group-hover/hint:opacity-100 ${"right"===n?"right-0":"left"===n?"left-0":"left-1/2 -translate-x-1/2"} ${"top"===t?"bottom-full mb-1.5":"top-full mt-1.5"}`,children:e})]})}function lk({onClose:e}){let{locale:t,t:n}=(0,eh.Ym)(),[r,i]=(0,Y.useState)(null),[a,s]=(0,Y.useState)(null),[l,o]=(0,Y.useState)(null),[c,d]=(0,Y.useState)(!1),[u,p]=(0,Y.useState)(null),m=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{let e=!1;return fetch("/api/transcribe/backend").then(e=>e.json()).then(t=>{!e&&Array.isArray(t.options)&&i(t)}).catch(()=>{e||s((0,eh.Tl)(t,"common.serverUnavailable"))}),()=>{e=!0}},[t]),(0,Y.useEffect)(()=>{let t=t=>{m.current&&!m.current.contains(t.target)&&e()},n=t=>{"Escape"===t.key&&e()};return window.addEventListener("pointerdown",t),window.addEventListener("keydown",n),()=>{window.removeEventListener("pointerdown",t),window.removeEventListener("keydown",n)}},[e]);let f=async(t,a)=>{if(r&&!r.lockedByEnv&&!u){if(!a){o(t),d(!1);return}p(t),s(null);try{let r=await fetch("/api/transcribe/backend",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({backend:t})}),a=await r.json();if(!r.ok)return void s(a.error??n("mic.saveFailed"));i(a),e()}catch{s(n("common.serverUnavailable"))}finally{p(null)}}},h=l&&r?r.options.find(e=>e.id===l):null;return(0,U.jsx)("div",{ref:m,role:"menu","aria-label":n("mic.menuTitle"),className:"absolute bottom-[calc(100%+6px)] right-0 z-40 w-[300px] rounded-[12px] border border-border bg-card p-1.5 shadow-2",children:h?(0,U.jsxs)("div",{className:"flex flex-col gap-2 p-2",children:[(0,U.jsx)("span",{className:"text-[12px] font-bold text-danger",children:n("mic.keyTitle",{name:n(`stt.${h.id}.name`)})}),(0,U.jsx)("span",{className:"text-[11.5px] leading-snug text-primary",children:n(`stt.${h.id}.fix`)}),(0,U.jsxs)("span",{className:"flex items-center gap-1 rounded-[8px] border border-border bg-canvas px-2 py-1.5",children:[(0,U.jsx)("code",{className:"min-w-0 flex-1 break-all font-mono text-[10.5px] text-primary",children:h.keyPath}),(0,U.jsxs)("button",{type:"button","aria-label":n("mic.copyPath"),title:n("mic.copyPath"),className:"inline-flex shrink-0 items-center gap-1 rounded-[6px] border border-border bg-card px-1.5 py-1 text-[10px] font-semibold text-muted hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>{navigator.clipboard.writeText(h.keyPath).then(()=>d(!0))},children:[c?(0,U.jsx)(sx.Jl,{className:"h-3 w-3 text-success","aria-hidden":!0}):(0,U.jsx)(sx.QR,{className:"h-3 w-3","aria-hidden":!0}),c?n("mic.copied"):n("mic.copy")]})]}),(0,U.jsxs)("button",{type:"button",className:"self-start rounded-[8px] px-2 py-1 text-[11px] font-semibold text-muted hover:bg-canvas hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>o(null),children:["← ",n("mic.back")]})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("div",{className:"px-2 pb-1 pt-1.5 text-label font-semibold text-secondary",children:n("mic.menuTitle")}),r?.lockedByEnv?(0,U.jsx)("div",{className:"px-2 pb-1 text-[10.5px] text-danger",children:n("mic.menuLocked")}):null,r||a?null:(0,U.jsxs)("div",{className:"flex items-center gap-2 px-2 py-2 text-[11.5px] text-muted",children:[(0,U.jsx)(sx.kr,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0})," ",n("mic.menuLoading")]}),(r?.options??[]).map(e=>{let t=r?.backend===e.id;return(0,U.jsxs)("button",{type:"button",role:"menuitemradio","aria-checked":t,disabled:!!r?.lockedByEnv||null!==u,onClick:()=>void f(e.id,e.available),className:`flex w-full items-start gap-2 rounded-[9px] px-2 py-1.5 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60 ${t?"bg-accent/10":"hover:bg-canvas"}`,children:[(0,U.jsx)("span",{className:"mt-[3px] flex h-3.5 w-3.5 shrink-0 items-center justify-center",children:u===e.id?(0,U.jsx)(sx.kr,{className:"h-3.5 w-3.5 animate-spin text-muted","aria-hidden":!0}):t?(0,U.jsx)(sx.Jl,{className:"h-3.5 w-3.5 text-accent","aria-hidden":!0}):(0,U.jsx)("span",{"aria-hidden":!0,className:"h-2 w-2 rounded-full",style:{backgroundColor:e.available?"var(--color-success)":"var(--color-warning)"}})}),(0,U.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,U.jsxs)("span",{className:"flex items-center gap-1.5 text-[12px] font-semibold text-primary",children:[n(`stt.${e.id}.name`),e.available?null:(0,U.jsx)("span",{className:"rounded-full bg-warning-soft px-1.5 py-px text-[9.5px] font-bold text-warning",children:n("mic.noKey")})]}),(0,U.jsx)("span",{className:"block text-[10.5px] leading-snug text-muted",children:n(`stt.${e.id}.desc`)})]})]},e.id)}),a?(0,U.jsx)("div",{className:"px-2 py-1 text-[10.5px] font-semibold text-danger",children:a}):null]})})}function lj({phase:e,elapsed:t,maxSeconds:n,remaining:r,capStopped:i,srMessage:a,canvasRef:s,start:l,stop:o,discard:c,onText:d,busy:u=!1,anchored:p=!1}){let{t:m}=(0,eh.Ym)(),f=ia(),[h,x]=(0,Y.useState)(!1),g=function({phase:e,elapsed:t,maxSeconds:n,capStopped:r}){if(r&&"rec"!==e)return"capStopped";if("rec"===e)return t>=n-sF(n)&&t<n?"recWarn":"recNormal";return"busy"===e?"busy":"starting"===e?"starting":"idle"}({phase:e,elapsed:t,maxSeconds:n,capStopped:i}),b=()=>{u||("idle"===e?l():"rec"===e&&o().then(e=>{e&&d(e)}))},v=(0,U.jsx)("span",{role:"status","aria-live":"polite",className:"sr-only",children:a});if("rec"===e){let e="recWarn"===g;return(0,U.jsxs)("span",{className:"flex shrink-0 items-center gap-1",children:[v,(0,U.jsxs)("button",{type:"button","aria-label":m("mic.stopRecognize"),title:e?m("mic.timeLeft",{time:sL(r)}):void 0,onClick:b,className:`flex items-center gap-1.5 rounded-control border px-2 text-label font-bold tabular-nums focus-visible:outline-none focus-visible:ring-2 ${f?"min-h-11":"py-2"} ${e?"border-warning/70 bg-warning-soft text-warning focus-visible:ring-warning/50":"border-danger/50 bg-danger-soft text-danger focus-visible:ring-danger/40"}`,children:[(0,U.jsx)("canvas",{ref:s,width:56,height:16,className:"h-4 w-14","aria-hidden":!0}),e?`−${sL(r)}`:sL(t)]}),(0,U.jsx)("button",{type:"button","aria-label":m("mic.cancel"),onClick:c,className:`inline-flex items-center justify-center rounded-control border border-border bg-card text-muted hover:text-danger focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${f?"h-11 w-11":"p-2"}`,children:(0,U.jsx)(sx.X,{className:"h-3.5 w-3.5","aria-hidden":!0})})]})}return"capStopped"===g?(0,U.jsxs)("span",{className:"flex shrink-0 items-center gap-1",children:[v,(0,U.jsxs)("span",{className:"flex items-center gap-1.5 rounded-control border border-warning/70 bg-warning-soft px-2 py-2 text-label font-bold text-warning",children:["busy"===e?(0,U.jsx)(sx.kr,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):(0,U.jsx)(sx.M6,{className:"h-3.5 w-3.5",fill:"currentColor","aria-hidden":!0}),m("mic.capStopped")]})]}):(0,U.jsxs)("span",{className:"relative inline-flex shrink-0",children:[v,(0,U.jsx)("button",{type:"button","aria-label":m("busy"===e?"mic.recognizing":"starting"===e?"mic.connecting":"mic.dictate"),title:m("busy"===e?"mic.recognizing":"starting"===e?"mic.connecting":"mic.dictateHint"),disabled:"idle"!==e||u,onClick:b,onPointerEnter:sU,onFocus:sU,onContextMenu:e=>{e.preventDefault(),x(e=>!e)},className:p?`relative inline-flex shrink-0 items-center justify-center rounded-control focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60 ${f?"h-8 w-8 before:absolute before:-inset-1.5 before:content-['']":"p-2"} ${"starting"===e?"bg-accent/10 text-accent":"text-muted hover:bg-sunken hover:text-accent"}`:`inline-flex shrink-0 items-center justify-center rounded-[8px] border focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60 ${f?"h-11 w-11":"p-2"} ${"starting"===e?"border-accent/40 bg-accent/10 text-accent":"border-border bg-card text-muted hover:text-accent"}`,children:"busy"===e?(0,U.jsx)(sx.kr,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):"starting"===e?(0,U.jsx)(sx.GO,{className:"h-4 w-4 animate-pulse motion-reduce:animate-none","aria-hidden":!0}):(0,U.jsx)(sx.GO,{className:"h-4 w-4","aria-hidden":!0})}),h?(0,U.jsx)(lk,{onClose:()=>x(!1)}):null]})}let lN=[];function lS({label:e,actions:t,onClose:n}){let r=(0,Y.useRef)(null);return(0,Y.useEffect)(()=>{let e=e=>{r.current&&!r.current.contains(e.target)&&n()},t=e=>{"Escape"===e.key&&n()};return window.addEventListener("pointerdown",e),window.addEventListener("keydown",t),()=>{window.removeEventListener("pointerdown",e),window.removeEventListener("keydown",t)}},[n]),(0,U.jsxs)("div",{ref:r,role:"menu","aria-label":e,className:"absolute bottom-[calc(100%+6px)] right-0 z-40 w-[220px] rounded-surface border border-border bg-raised p-1.5 shadow-2",children:[(0,U.jsx)("div",{className:"px-2 pb-1 pt-1.5 text-label font-semibold text-secondary",children:e}),t.map(e=>(0,U.jsxs)("button",{type:"button",role:"menuitem",disabled:e.disabled,onClick:()=>{e.onSelect(),n()},className:`flex w-full items-start gap-2 rounded-control px-2 py-1.5 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-50 ${"ok"===e.tone?"hover:bg-success/10":"hover:bg-sunken"}`,children:[(0,U.jsx)(sx.jG,{className:`mt-[2px] h-3.5 w-3.5 shrink-0 ${"ok"===e.tone?"text-success":"text-muted"}`,"aria-hidden":!0}),(0,U.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,U.jsx)("span",{className:"block text-ui font-semibold text-primary",children:e.label}),e.description?(0,U.jsx)("span",{className:"block text-caption leading-snug text-muted",children:e.description}):null]})]},e.id))]})}function lC({composer:e,placeholder:t,textareaAriaLabel:n,imageAriaLabel:r,leftSlot:i,sendLabelIdle:a,sendLabelRecording:s,sendTitleRecording:l,sendIdleClassName:o,sendIdleStyle:c,sendMenuLabel:d,sendMenuActions:u=[],showImage:p=!0,onImageFiles:m,imageDisabled:f=!1,imageDisabledReason:h,sendDisabledReason:x,onSendBlockedRecover:g,sendPayloadAvailable:b=!1,receipts:v,history:w=lN,voiceControl:y,voicePanel:k}){let{displayText:j,inputRef:N,attachInput:S,dictation:C,setText:A,attachments:I,voiceSending:M,insertSpoken:T,stopAndSend:P,submit:$,fieldsDisabled:E,canSend:R,dictationRecording:O,busy:D,status:L,dictationBusy:_,attachmentsBlocked:F}=e,{t:q}=(0,eh.Ym)(),z=ia(),[H,B]=(0,Y.useState)(!1),[K,W]=(0,Y.useState)(!1),[V,J]=(0,Y.useState)(-1),G=(0,Y.useId)(),Q=!!i||p,X=z?K&&p:Q,Z=u.length>0,ee=f&&I.images.length>0,et=I.hasReading?q("img.blockedReading"):I.hasError?q("img.blockedFailed"):void 0,en=!!x,er=R||b&&!E&&!_&&!F,ei=en||!er&&!Z||ee,ea=z?"relative h-8 w-8 before:absolute before:-inset-1.5 before:content-['']":"p-2",es=(0,U.jsxs)(U.Fragment,{children:[z&&p&&!O?(0,U.jsx)(ly,{label:q(K?"composer.optionsHide":"composer.optionsShow"),align:"right",children:(0,U.jsx)("button",{type:"button","data-testid":"composer-options-toggle","aria-expanded":K,"aria-controls":G,"aria-label":q(K?"composer.optionsHide":"composer.optionsShow"),onClick:()=>W(e=>!e),className:`inline-flex shrink-0 items-center justify-center rounded-control text-muted hover:bg-sunken hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${K?"bg-sunken text-accent":""} ${ea}`,children:(0,U.jsx)(lw.A,{className:"h-4 w-4","aria-hidden":!0})})}):null,y,(0,U.jsx)(lj,{...C,busy:M||en,onText:T,anchored:!0}),(0,U.jsxs)("span",{className:"relative inline-flex shrink-0",onContextMenu:e=>{Z&&!O&&(e.preventDefault(),B(e=>!e))},children:[(0,U.jsx)(ly,{label:en?x:O?l??s:a,align:"right",children:(0,U.jsx)("button",{type:O&&!en?"button":"submit",onClick:O&&!en?()=>void P():e=>{if(en||!er){e.preventDefault(),e.stopPropagation();return}J(-1)},disabled:ei,"aria-disabled":en||!er||ee,"aria-label":en?x:O?s:a,style:O?void 0:c,className:`inline-flex shrink-0 items-center justify-center rounded-control border text-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40 aria-disabled:opacity-40 ${ea} ${O?"border-danger bg-danger hover:opacity-90":o}`,children:D||M?(0,U.jsx)(sx.kr,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):(0,U.jsx)(sx.jG,{className:"h-4 w-4","aria-hidden":!0})})}),H&&Z&&d?(0,U.jsx)(lS,{label:d,actions:u,onClose:()=>B(!1)}):null]})]});return(0,U.jsxs)(U.Fragment,{children:[k,z&&!m?(0,U.jsx)(sI,{attachments:I.attachments,onRemove:I.remove,onRetry:I.retry,onClearAll:I.clearAll}):null,(0,U.jsxs)("div",{className:`flex rounded-control border border-border bg-sunken focus-within:ring-2 focus-within:ring-accent/40 ${O?"flex-col gap-1.5 p-2.5":"items-end gap-1 py-1 pl-2.5 pr-1"}`,children:[(0,U.jsx)("textarea",{ref:S,value:j,rows:1,readOnly:!!C.liveText,onChange:e=>{J(-1),A(e.target.value)},onFocus:sU,onPaste:e=>{let t=Array.from(e.clipboardData.items).filter(e=>e.type.startsWith("image/")).map(e=>e.getAsFile()).filter(e=>null!==e);if(f&&t.length)return void e.preventDefault();if(m){t.length&&(e.preventDefault(),m(t));return}I.handlePaste(e)},onDragOver:e=>{Array.from(e.dataTransfer.items).some(e=>e.type.startsWith("image/"))&&(e.preventDefault(),e.dataTransfer.dropEffect=f?"none":"copy")},onDrop:e=>{let t=Array.from(e.dataTransfer.files).filter(e=>e.type.startsWith("image/"));t.length&&(e.preventDefault(),e.stopPropagation(),f||(m??I.addFiles)(t))},onKeyDown:e=>{if(("ArrowUp"===e.key||"ArrowDown"===e.key)&&!O&&!e.metaKey&&!e.ctrlKey&&!e.altKey){let t=function(e,t,n,r){if(!n.length||e<0&&!r)return null;let i="ArrowUp"===t?Math.min(e+1,n.length-1):Math.max(e-1,-1);return i===e?null:{index:i,text:i<0?"":n[i]??""}}(V,e.key,w,0===j.length);if(t){e.preventDefault(),J(t.index),A(t.text),requestAnimationFrame(()=>{let e=N.current;e&&e.setSelectionRange(e.value.length,e.value.length)});return}}if("Enter"===e.key&&!e.shiftKey&&!e.nativeEvent.isComposing){if(e.preventDefault(),en||!er||ee)return;J(-1),"rec"===C.phase?P():$()}},placeholder:t,"aria-label":n,disabled:E,className:`min-w-0 resize-none overflow-y-auto bg-transparent py-1 text-ui leading-[18px] text-primary placeholder:text-muted focus-visible:outline-none disabled:opacity-60 ${O?"w-full":"flex-1 self-center"}`}),O?(0,U.jsx)("div",{className:"flex items-center justify-end gap-1",children:es}):es]}),z&&i?(0,U.jsx)("div",{"data-testid":"composer-runtime-row",className:"flex min-h-11 min-w-0 items-center gap-1.5",children:i}):null,Q&&X?(0,U.jsxs)("div",{id:G,"data-testid":"composer-options-row",className:"flex items-center justify-between gap-1.5",children:[(0,U.jsx)("div",{className:"flex min-w-0 items-center gap-1.5",children:z?null:i}),p?(0,U.jsx)(ly,{label:r,children:(0,U.jsx)(sE,{ariaLabel:r,className:`inline-flex shrink-0 items-center justify-center rounded-control text-muted hover:bg-sunken hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${ea}`,onFiles:m??I.addFiles,disabled:f,disabledReason:h})}):null]}):null,z||m?null:(0,U.jsx)(sI,{attachments:I.attachments,onRemove:I.remove,onRetry:I.retry,onClearAll:I.clearAll}),en?(0,U.jsxs)("span",{"data-testid":"composer-send-blocked",role:"status","aria-live":"polite",className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-caption font-semibold text-warning",children:[(0,U.jsx)("span",{className:"min-w-0",children:x}),g?(0,U.jsx)("button",{type:"button",onClick:g,className:"inline-flex min-h-8 shrink-0 items-center gap-1 rounded-control border border-border bg-card px-2 text-caption font-semibold text-primary hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:q("deadHost.recheck")}):null]}):null,m||en||!et?null:(0,U.jsx)("span",{role:"status","aria-live":"polite",className:"text-caption font-semibold text-warning",children:et}),L?(0,U.jsx)("span",{role:"status","aria-live":"err"===L.kind?"assertive":"polite",className:`truncate text-caption font-semibold ${"ok"===L.kind?"text-success":"info"===L.kind?"text-warning":"text-danger"}`,children:L.text}):null,f&&h?(0,U.jsx)("span",{role:"status",className:"text-caption font-semibold text-muted",children:h}):null,v?(0,U.jsx)("div",{className:"flex flex-wrap gap-1.5",children:v}):null]})}let lA=(e,t)=>(0,eh.Tl)((0,eh.JK)(),e,t);function lI({reference:e,stale:t=!1,className:n=""}){if(!e||"selected"!==e.state)return null;let r=e.label||e.conversationId;if(!r)return null;let i=lA("selectedContext.ariaSelected",{name:r,project:e.project??"—"}),a=t?`${i} — ${lA("selectedContext.stale")}`:i;return(0,U.jsxs)("span",{className:`inline-flex max-w-full items-center gap-1 rounded-md px-1.5 py-0.5 text-[11px] leading-tight ${t?"bg-sunken text-muted line-through decoration-1":"bg-sunken text-secondary"} ${n}`,"aria-label":a,title:a,"data-selected-context":e.state,...t?{"data-selected-context-stale":"true"}:{},children:[(0,U.jsx)(sx.kU,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),(0,U.jsx)("span",{className:"min-w-0 truncate",children:r})]})}function lM(e){return!(!e||"object"!=typeof e||Array.isArray(e))&&"string"==typeof e.conversationId&&Number.isInteger(e.generation)&&e.generation>0}function lT(e,t){return lM(e)&&e.conversationId===t.conversationId&&e.generation===t.generation}function lP(e){switch(e){case"queued":case"delivering":case"applying":case"pending":case"uncertain":return"delivering";case"rejected":case"failed":return"failed";default:return"delivered"}}let l$=new Map,lE=new Set,lR=[],lO=new Map,lD=[],lL=new Map,l_=[],lF=new Map;function lq(e,t){return e.at!==t.at?e.at-t.at:e.id<t.id?-1:+(e.id>t.id)}function lz(e,t){return(e.retiredAt??e.at)-(t.retiredAt??t.at)||lq(e,t)}function lH(e){return[...e.filter(e=>!e.retiredEchoId).sort(lq).slice(0,512),...e.filter(e=>!!e.retiredEchoId).sort(lz).slice(-512)].sort(lq)}function lU(e){return!(!e||"object"!=typeof e||Array.isArray(e))&&"string"==typeof e.id&&"string"==typeof e.text&&"number"==typeof e.at}function lB(e){return!(!e||"object"!=typeof e||Array.isArray(e))&&"string"==typeof e.id&&"string"==typeof e.key}function lK(e){if(lF.has(e))return lF.get(e)??null;try{let t=JSON.parse(sessionStorage.getItem("llvOutboxCurrentLaunch:"+e)??"null"),n=!t||"object"!=typeof t||Array.isArray(t)||"string"!=typeof t.id||"number"!=typeof t.at||void 0!==t.settledAt&&"number"!=typeof t.settledAt||void 0!==t.retiredEchoId&&"string"!=typeof t.retiredEchoId||void 0!==t.retiredAt&&"number"!=typeof t.retiredAt||void 0!==t.terminalReason&&"response-started"!==t.terminalReason&&"delivered-ttl"!==t.terminalReason?null:t;return lF.set(e,n),n}catch{return lF.set(e,null),null}}function lY(e,t){lF.set(e,t);try{if(t)sessionStorage.setItem("llvOutboxCurrentLaunch:"+e,JSON.stringify(t));else sessionStorage.removeItem("llvOutboxCurrentLaunch:"+e)}catch{}}function lW(e,t){if(!e)return t;if(e.id===t.id){let n=t.at>e.at?t:e,r=Math.max(e.settledAt??-1/0,t.settledAt??-1/0),i=[e,t].filter(e=>e.retiredEchoId||e.terminalReason).sort((e,t)=>(e.retiredAt??e.at)-(t.retiredAt??t.at)).at(-1);return{...n,...Number.isFinite(r)?{settledAt:r}:{},...i?{...i.retiredEchoId?{retiredEchoId:i.retiredEchoId}:{},...void 0!==i.retiredAt?{retiredAt:i.retiredAt}:{},...i.terminalReason?{terminalReason:i.terminalReason}:{}}:{}}}return t.at!==e.at?t.at>e.at?t:e:t.id>e.id?t:e}function lV(e,t){lY(e,lW(lK(e),t))}function lJ(e,t){let n=lK(e);n&&n.id!==t.id||lV(e,t)}function lG(e,t){return e.terminalReason?e.terminalReason:void 0!==e.settledAt&&t-e.settledAt>=6e5?"delivered-ttl":void 0}function lQ(e,t,n=Date.now()){if(!t.launchOwned)return;let r=t.settledAt??("delivered"===t.state?t.at:void 0),i=void 0!==t.responseStartedAt?"response-started":lG({settledAt:r},n),a={id:t.id,at:t.at,...void 0!==r?{settledAt:r}:{}};i?lJ(e,{...a,terminalReason:i,retiredAt:"response-started"===i?t.responseStartedAt:(r??t.at)+6e5}):lV(e,a)}function lX(e){let t=lO.get(e);if(t)return t;try{let t=JSON.parse(sessionStorage.getItem("llvOutboxEchoes:"+e)??"[]"),n=Array.isArray(t)?t.filter(lB).slice(-512):lD;return lO.set(e,n),n}catch{return lO.set(e,lD),lD}}function lZ(e,t){lO.set(e,t);try{if(t.length)sessionStorage.setItem("llvOutboxEchoes:"+e,JSON.stringify(t));else sessionStorage.removeItem("llvOutboxEchoes:"+e)}catch{}}function l0(e){return!(!e||"object"!=typeof e||Array.isArray(e))&&"string"==typeof e.id&&"string"==typeof e.key&&"number"==typeof e.at&&(void 0===e.echoBaseline||"number"==typeof e.echoBaseline)&&(void 0===e.echoBaselineIds||Array.isArray(e.echoBaselineIds)&&e.echoBaselineIds.every(e=>"string"==typeof e))&&(void 0===e.retiredEchoId||"string"==typeof e.retiredEchoId)&&(void 0===e.retiredAt||"number"==typeof e.retiredAt)&&(void 0===e.launchOwned||!0===e.launchOwned)}function l1(e){let t=lL.get(e);if(t)return t;try{let t=JSON.parse(sessionStorage.getItem("llvOutboxOccurrences:"+e)??"[]"),n=Array.isArray(t)?lH(t.filter(l0)):l_;return lL.set(e,n),n}catch{return lL.set(e,l_),l_}}function l2(e,t){let n=lH(t);lL.set(e,n);try{if(n.length)sessionStorage.setItem("llvOutboxOccurrences:"+e,JSON.stringify(n));else sessionStorage.removeItem("llvOutboxOccurrences:"+e)}catch{}}function l5(e,t){l$.set(e,t);try{if(t.length)sessionStorage.setItem("llvOutbox:"+e,JSON.stringify(t));else sessionStorage.removeItem("llvOutbox:"+e)}catch{}for(let e of lE)e()}function l4(e,t){let n=new Map(e.map(e=>[e.id,e]));for(let e of t){let t=n.get(e.id);(!t?.retiredEchoId||e.retiredEchoId)&&n.set(e.id,e)}return lH([...n.values()])}function l3(e){if("delivered"!==e.state&&void 0===e.responseStartedAt&&!e.retiredEchoId)return null;let t=on(e.echoText??e.text);return t?{id:e.id,key:t,at:e.at,...void 0!==e.echoBaseline?{echoBaseline:e.echoBaseline}:{},...e.echoBaselineIds?.length?{echoBaselineIds:e.echoBaselineIds}:{},...e.retiredEchoId?{retiredEchoId:e.retiredEchoId}:{},...void 0!==e.retiredAt?{retiredAt:e.retiredAt}:{},...e.launchOwned?{launchOwned:!0}:{}}:null}function l6(e,t){let n=Math.max(0,t.length-32);if(n>0){for(let r of t.slice(0,n))lQ(e,r);let r=t.slice(0,n).map(l3).filter(e=>null!==e);r.length&&l2(e,l4(l1(e),r))}l5(e,t.slice(-32))}function l8(e){let t=l$.get(e);if(t)return t;let n=function(e){try{let t=JSON.parse(sessionStorage.getItem("llvOutbox:"+e)??"[]");if(!Array.isArray(t))return lR;return t.filter(lU).slice(-32).map(e=>{let t=function(e){let t=e.owner;if(void 0===t||lM(t))return e;let n={...e};return delete n.owner,n}(e),n="number"==typeof t.images?t.images:0;if(t.launchOwned)return{...t,images:n};let r="delivering"===t.state||"queued"===t.state;return r&&n>0?{...t,images:n,state:"failed",needsReattach:!0}:{...t,images:n,state:r?"queued":t.state}})}catch{return lR}}(e);return l$.set(e,n),n}function l7(e,t){if(!t.text.trim()&&!t.images)return;let n=lK(e);if(n?.id===t.id){let t=lG(n,Date.now());if(t&&!n.terminalReason&&lJ(e,{...n,terminalReason:t,retiredAt:(n.settledAt??n.at)+6e5}),n.retiredEchoId||t)return}let r=l8(e),i=r.find(e=>e.id===t.id);if(i){var a;let n=t.state??"delivering",s=(a=i.state,"delivered"===n?"delivered":"failed"===n&&("queued"===a||"delivering"===a)?"failed":a),l={...i,...t.echoText&&t.echoText!==i.echoText?{echoText:t.echoText}:{},...t.owner&&!lT(i.owner,t.owner)?{owner:t.owner}:{},...s!==i.state?{state:s}:{},..."delivered"===s&&void 0===i.settledAt?{settledAt:t.settledAt??t.at}:{},..."failed"===s&&t.error&&t.error!==i.error?{error:t.error}:{}};(l.echoText!==i.echoText||l.owner!==i.owner||l.state!==i.state||l.settledAt!==i.settledAt||l.error!==i.error)&&l5(e,r.map(e=>e.id===t.id?l:e)),lQ(e,l),l.retiredEchoId&&lJ(e,{id:t.id,at:t.at,retiredEchoId:l.retiredEchoId,...void 0!==l.retiredAt?{retiredAt:l.retiredAt}:{}}),l.echoText!==i.echoText&&oo(e,lX(e));return}let s=l1(e).find(e=>e.id===t.id&&e.retiredEchoId);if(s?.retiredEchoId)return void lV(e,{id:t.id,at:s.at,retiredEchoId:s.retiredEchoId,retiredAt:s.retiredAt});let l=t.state??"delivering",o=n?.id===t.id?n.settledAt??t.settledAt:t.settledAt,c=void 0!==o?"delivered":l;lV(e,{id:t.id,at:t.at,..."delivered"===c?{settledAt:o??t.at}:{}}),l6(e,[...r,{...t,state:c,..."delivered"===c?{settledAt:o??t.at}:{},launchOwned:!0}]),oo(e,lX(e))}function l9(e,t,n){let r=l8(e);if(!r.some(e=>e.id===t))return;let i=r.map(e=>e.id===t?{...e,...n}:e),a=i.find(e=>e.id===t);a&&lQ(e,a),l5(e,i)}function oe(e,t){let n=l8(e),r=n.filter(e=>e.id!==t);r.length!==n.length&&l5(e,r)}function ot(e,t){if(e===t)return;let n=lK(e);n&&(lY(t,lW(lK(t),n)),lY(e,null));let r=l1(e);r.length&&(l2(t,l4(l1(t),r)),l2(e,l_));let i=lX(e);if(i.length){let n=lX(t),r=new Map(i.map(e=>[e.id,e]));for(let e of n)r.delete(e.id),r.set(e.id,e);lZ(t,[...r.values()].slice(-512)),lZ(e,lD)}let a=l8(e);if(a.length){let n=new Map(l8(t).map(e=>[e.id,e]));for(let e of a){let t=n.get(e.id);if(!t){n.set(e.id,e);continue}e.retiredEchoId&&!t.retiredEchoId&&n.set(e.id,{...t,retiredEchoId:e.retiredEchoId,retiredAt:e.retiredAt})}l6(t,[...n.values()].sort((e,t)=>e.at-t.at)),l5(e,lR)}oo(t,lX(t))}function on(e){return e.trim()}let or=new Map,oi=new Set,oa=new Map;function os(e){let t=new Map;for(let n of e)t.set(n.key,(t.get(n.key)??0)+1);return t}function ol(e,t){if(!e||e.size!==t.size)return!1;for(let[n,r]of t)if(e.get(n)!==r)return!1;return!0}function oo(e,t){let n=l8(e),r=l1(e);if(!n.length&&!r.length)return;let i=new Set([...r.flatMap(e=>e.retiredEchoId?[e.retiredEchoId]:[]),...n.flatMap(e=>e.retiredEchoId?[e.retiredEchoId]:[])]),a=[...r.map(e=>({type:"tombstone",id:e.id,at:e.at,key:e.key,echoBaseline:e.echoBaseline,echoBaselineIds:e.echoBaselineIds,retiredEchoId:e.retiredEchoId,launchOwned:e.launchOwned})),...n.map(e=>({type:"queue",id:e.id,at:e.at,key:on(e.echoText??e.text),echoBaseline:e.echoBaseline,echoBaselineIds:e.echoBaselineIds,retiredEchoId:e.retiredEchoId,launchOwned:e.launchOwned}))].sort((e,t)=>e.at-t.at),s=new Map;for(let e of a){if(e.retiredEchoId)continue;let n=new Set(e.echoBaselineIds??[]),r=n.size?0:e.echoBaseline??0,a=t.find(t=>!(t.key!==e.key||n.has(t.id))&&(r>0?(r-=1,!1):!i.has(t.id)));a&&(i.add(a.id),s.set(`${e.type}:${e.id}`,{echoId:a.id,retiredAt:Date.now()}))}let l=!1,o=r.map(e=>{let t=s.get(`tombstone:${e.id}`);return t?(l=!0,{...e,retiredEchoId:t.echoId,retiredAt:t.retiredAt}):e});l&&l2(e,o);let c=new Map;for(let e of o){if(!e.retiredEchoId)continue;let t=c.get(e.key)??[];t.push({at:e.at,echoId:e.retiredEchoId}),c.set(e.key,t)}let d=!1,u=n.map(e=>{let t=s.get(`queue:${e.id}`);if(t)return d=!0,{...e,retiredEchoId:t.echoId,retiredAt:t.retiredAt};if(e.retiredEchoId)return e;let n=on(e.echoText??e.text),r=new Set(e.echoBaselineIds??[]);for(let t of c.get(n)??[])t.at<=e.at&&r.add(t.echoId);return r.size===(e.echoBaselineIds?.length??0)?e:(d=!0,{...e,echoBaseline:Math.max(e.echoBaseline??0,r.size),echoBaselineIds:[...r]})});for(let t of o)t.launchOwned&&t.retiredEchoId&&lJ(e,{id:t.id,at:t.at,retiredEchoId:t.retiredEchoId,retiredAt:t.retiredAt});for(let t of u)t.launchOwned&&t.retiredEchoId&&lJ(e,{id:t.id,at:t.at,retiredEchoId:t.retiredEchoId,retiredAt:t.retiredAt});d&&l5(e,u)}function oc(e){return lE.add(e),()=>{lE.delete(e)}}function od(e){return(0,Y.useSyncExternalStore)(oc,()=>l8(e),()=>lR)}function ou({entries:e,ready:t,onDispatch:n}){let r=t?e.some(e=>"delivering"===e.state&&!e.launchOwned)?null:e.find(e=>"queued"===e.state)??null:null,i=r?.id??null,a=(0,Y.useRef)({next:r,onDispatch:n});return(0,Y.useLayoutEffect)(()=>{a.current={next:r,onDispatch:n}}),(0,Y.useEffect)(()=>{let e=a.current.next;e&&a.current.onDispatch(e)},[i]),null}class op extends Error{constructor(){super("composer admission timed out"),this.name="ComposerAdmissionTimeoutError"}}async function om({read:e,refresh:t,late:n,timeoutMs:r=3e4,pollIntervalMs:i=1e3,signal:a}){let s=Date.now()+r,l=new Promise(()=>{}),o=n?n.then(e=>e??l,()=>l):l;for(;!a?.aborted;){let n=e();if(null!==n)return n;let r=s-Date.now();if(r<=0)break;let l=await Promise.race([(function(e,t,n){return n?.aborted||t<=0?Promise.resolve():new Promise(r=>{let i=setTimeout(a,t);function a(){clearTimeout(i),n?.removeEventListener("abort",a),r()}n?.addEventListener("abort",a,{once:!0}),e().then(a,a)})})(t,r,a).then(e),o]);if(null!==l)return l;let c=await Promise.race([(function(e,t){return t?.aborted||e<=0?Promise.resolve():new Promise(n=>{let r=setTimeout(i,e);function i(){clearTimeout(r),t?.removeEventListener("abort",i),n()}t?.addEventListener("abort",i,{once:!0})})})(Math.min(i,Math.max(0,s-Date.now())),a).then(e),o]);if(null!==c)return c}return null}var of=n(7532);let oh="gpt-5.6-sol",ox="gpt-5.6-terra",og="gpt-5.6-luna",ob=new Set([oh,ox,og,"gpt-5.5","gpt-5.4","gpt-5.4-mini"]);function ov(e){return!e?.trim()||ob.has(e.trim())}let ow={claude:[{id:"opus",label:"Opus 5",shortLabel:"Opus 5",use:"review"},{id:"fable",label:"Fable",shortLabel:"Fable",use:"general"},{id:"sonnet",label:"Sonnet",shortLabel:"Sonnet",use:"implement"},{id:"haiku",label:"Haiku",shortLabel:"Haiku",use:"general"}],codex:[{id:oh,label:"GPT-5.6-Sol",shortLabel:"5.6-Sol",use:"review"},{id:ox,label:"GPT-5.6-Terra",shortLabel:"5.6-Terra",use:"implement"},{id:og,label:"GPT-5.6-Luna",shortLabel:"5.6-Luna",use:"general"}]};function oy(e){return"codex"===e?oh:"opus"}let ok=["fable","opus","sonnet","haiku"];function oj(e){if("string"!=typeof e)return null;let t=e.trim().toLowerCase();if(!t||t.length>128||/[\u0000-\u001f\u007f]/.test(t))return null;for(let e of ok)if(t===e||RegExp(`(?:^|[-_.])${e}(?:[-_.]|$)`).test(t))return e;return null}let oN=0,oS=new Set;function oC(e,t){let n={id:++oN,kind:e,text:t};for(let e of oS)e(n)}function oA(e,t){let n=(0,eh.JK)(),r=e.results.length,i=(0,eh.Tl)(n,"tasks.sendOk",{delivered:e.delivered,total:r});if(!e.failed)return{kind:"ok",text:i};let a=new Map(t.map(e=>[e.path,e])),s=e.results.filter(e=>!e.ok).map(e=>{let t=a.get(e.path),r=t?(0,tw.cr)(t.title,40):e.path.split("/").pop()??e.path;return(0,eh.Tl)(n,"tasks.sendFailPart",{title:r,error:e.error??""})});return{kind:"err",text:`${i}; ${s.join("; ")}`}}function oI(){let e=ia(),[t,n]=(0,Y.useState)([]);return((0,Y.useEffect)(()=>{let e=e=>{n(t=>[...t.slice(-3),e]),window.setTimeout(()=>n(t=>t.filter(t=>t.id!==e.id)),6e3)};return oS.add(e),()=>{oS.delete(e)}},[]),t.length)?(0,U.jsx)("div",{className:e?"z-50 flex shrink-0 flex-col gap-1.5 border-t border-border bg-canvas px-3 py-2 pb-[max(0.5rem,env(safe-area-inset-bottom))]":"pointer-events-none absolute inset-x-0 bottom-14 z-50 flex flex-col items-center gap-1.5 px-3",children:t.map(t=>(0,U.jsxs)("div",{className:`pointer-events-auto flex items-start gap-2 overflow-hidden rounded-surface border-l-[3px] bg-raised py-2 pl-3 pr-2 text-ui text-primary shadow-2 ${e?"w-full":"max-w-[560px]"} ${"ok"===t.kind?"border-l-success":"border-l-danger"}`,role:"status",children:[(0,U.jsx)("span",{className:`mt-px shrink-0 font-semibold ${"ok"===t.kind?"text-success":"text-danger"}`,"aria-hidden":!0,children:"ok"===t.kind?"✓":"✕"}),(0,U.jsx)("span",{className:"min-w-0 flex-1 break-words",children:t.text}),(0,U.jsx)("button",{type:"button",className:`shrink-0 rounded text-muted opacity-70 hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${e?"-my-1 -mr-1 flex h-11 w-11 items-center justify-center":"mt-0.5 p-0.5"}`,"aria-label":(0,eh.Tl)((0,eh.JK)(),"viewer.closeNotification"),onClick:()=>n(e=>e.filter(e=>e.id!==t.id)),children:(0,U.jsx)(sx.X,{className:e?"h-4 w-4":"h-3 w-3","aria-hidden":!0})})]},t.id))}):null}function oM(e){return`llvAgentRuntime:${W(e)}`}function oT(e){return oM(e)+":phase"}function oP(e){return oT(e)+":operation"}function o$(e){return oT(e)+":rollback"}function oE(e){return oM(e)+":resume"}function oR(e){return oM(e)+":profile"}function oO(e){let t=e.engine,n=ow[t],r="claude"===e.engine?oj(e.launchModel??e.model)??e.model??null:e.model??null,i=n.some(e=>e.id===r)?r:n[0].id,a=(0,of.ve)(t,i)??[];return{model:i,effort:a.includes(e.effort??"")?e.effort:a[0],fast:e.fast??!1}}function oD(e){return function(e,t){let n=oO(e);try{let r=JSON.parse(localStorage.getItem(t)??"null");if(!r)return null;let i=e.engine,a=ow[i].some(e=>e.id===r.model)?r.model:n.model,s=(0,of.ve)(i,a)??[];return{model:a,effort:s.includes(r.effort??"")?r.effort:n.effort,fast:"codex"===i&&"boolean"==typeof r.fast?r.fast:n.fast}}catch{return null}}(e,oE(e))}function oL(e){try{var t,n;let r=JSON.parse(localStorage.getItem(oR(e))??"null");if(!r||"object"!=typeof r)return null;let i=e.engine,a={};ow[i].some(e=>e.id===r.model)&&(a.model=r.model);let s=(0,of.ve)(i,a.model??(t=e,n=r,ow[t.engine].some(e=>e.id===n.model)?n.model:oO(t).model))??[];return"string"==typeof r.effort&&s.includes(r.effort)&&(a.effort=r.effort),"codex"===i&&"boolean"==typeof r.fast&&(a.fast=r.fast),Object.keys(a).length?a:null}catch{return null}}function o_(e,t){let n={...oL(e)??{},...t},r=e.engine;void 0!==t.model&&void 0!==n.effort&&(n.effort=(0,of.TS)(r,n.model,n.effort)??n.effort),"codex"!==r&&delete n.fast;try{localStorage.setItem(oR(e),JSON.stringify(n))}catch{}return n}function oF(e){let t=oO(e),n=oL(e);if(!n)return t;let r=e.engine,i=n.model??t.model,a=(0,of.ve)(r,i)??[],s=n.effort&&a.includes(n.effort)?n.effort:(0,of.TS)(r,i,n.effort??t.effort)??t.effort;return{model:i,effort:s,fast:"codex"===r&&(n.fast??t.fast)}}function oq(e){try{let t=JSON.parse(localStorage.getItem(o$(e))??"null"),n=t?.draft;if(!n||"string"!=typeof n.model||"string"!=typeof n.effort||"boolean"!=typeof n.fast)return null;let r=t?.profile;if(null!==r&&("object"!=typeof r||Array.isArray(r)))return null;let i=t?.runtimeRevision;return{operationId:"string"==typeof t?.operationId?t.operationId:null,supersededOperationId:"string"==typeof t?.supersededOperationId?t.supersededOperationId:null,runtimeRevision:Number.isSafeInteger(i)&&i>=0?i:null,draft:n,profile:r??null}}catch{return null}}function oz(e,t){try{localStorage.setItem(o$(e),JSON.stringify(t))}catch{}}let oH={minimal:"reasoningTier.minimal",low:"reasoningTier.low",medium:"reasoningTier.medium",high:"reasoningTier.high",xhigh:"reasoningTier.xhigh",max:"reasoningTier.max",ultra:"reasoningTier.ultra"};function oU(e,t){let n=oH[t];return n?e(n):t}function oB(e,t){return ow[e].find(e=>e.id===t)?.label??t}function oK({file:e,surface:t,runtimeSettings:n,runtimeSession:r}){var i;let{t:a}=(0,eh.Ym)(),s=ia(),l="claude"===e.engine||"codex"===e.engine?e.engine:null,o="structured"===t?"structured":"resume"===t?"resume":"live-root"===t?"live-root":null,[c,d]=(0,Y.useState)(()=>l?oO(e):{model:"",effort:"",fast:!1}),u=(0,Y.useRef)(c),[p,m]=(0,Y.useState)("idle"),[f,h]=(0,Y.useState)(""),x=(0,Y.useRef)(0),g=(0,Y.useRef)(null),b=(0,Y.useRef)(null),[v,w]=(0,Y.useState)(0),[y,k]=(0,Y.useState)(!1),[j,N]=(0,Y.useState)("root"),[S,C]=(0,Y.useState)(""),A=(0,Y.useRef)(null),I=W(e);(0,Y.useEffect)(()=>{if(!l||"live-root"!==o&&"structured"!==o)return;let t=function(e){let t=oO(e);try{let n=JSON.parse(localStorage.getItem(oM(e))??"null"),r=e.engine,i=ow[r].some(e=>e.id===n?.model)?n.model:t.model,a=(0,of.ve)(r,i)??[];return{model:i,effort:a.includes(n?.effort??"")?n.effort:t.effort,fast:"codex"===r&&"boolean"==typeof n?.fast?n.fast:t.fast}}catch{return t}}(e);u.current=t,d(t);let n=localStorage.getItem(oT(e));g.current=localStorage.getItem(oP(e)),b.current=oq(e),m("pending"===n||"confirming"===n?n:"idle"),h("")},[l,e.path,o]);let M=(0,Y.useRef)(I),T=r?.conversationId;(0,Y.useEffect)(()=>{if(M.current!==I){var e=M.current;if(e&&e!==I)try{for(let t of[":profile",":resume",":phase",":phase:operation",":phase:rollback",""]){let n=localStorage.getItem(`llvAgentRuntime:${e}${t}`);null!==n&&(null===localStorage.getItem(`llvAgentRuntime:${I}${t}`)&&localStorage.setItem(`llvAgentRuntime:${I}${t}`,n),localStorage.removeItem(`llvAgentRuntime:${e}${t}`))}}catch{}M.current=I,w(e=>e+1)}},[I]);let P=(0,Y.useCallback)((t=null)=>{let n=b.current??oq(e);t&&n?.operationId!==t||(b.current=null,localStorage.removeItem(o$(e)))},[e]),$=(0,Y.useCallback)(t=>{u.current=t.draft,d(t.draft);try{localStorage.setItem(oM(e),JSON.stringify(t.draft)),t.profile?localStorage.setItem(oR(e),JSON.stringify(t.profile)):localStorage.removeItem(oR(e))}catch{}P(t.operationId)},[P,e]),E=(0,Y.useCallback)(async t=>{let n=x.current;m("saving"),h("");try{let r=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"reconfigure",path:e.path,conversationId:T,...t,fast:"codex"===l?t.fast:void 0})}),i=await r.json();if(n!==x.current)return;if(!r.ok||!i.ok)throw Error(i.error??a("runtimeConfig.failed"));g.current=i.operationId??i.receipt?.operationId??null;let s=b.current;s&&(b.current={...s,operationId:g.current},oz(e,b.current));let c="structured"===o||"pending"===i.outcome?"pending":"confirming";localStorage.setItem(oT(e),c),g.current?localStorage.setItem(oP(e),g.current):localStorage.removeItem(oP(e)),m(c)}catch(t){if(n!==x.current)return;let e=b.current;e&&$(e),h(t instanceof Error?t.message:a("runtimeConfig.failed")),m("error")}},[l,e,o,$,T,a]);(0,Y.useEffect)(()=>{if("live-root"!==o||"pending"!==p)return;let e=window.setInterval(()=>void E(c),1500);return()=>window.clearInterval(e)},[o,p,E,c]),(0,Y.useEffect)(()=>{if("structured"!==o)return;let t=r?.pendingReconfigure;if(t){let n=b.current,i=r.revision,a=null!==n&&(null===n.runtimeRevision||i>n.runtimeRevision);if(!(null===n||n.supersededOperationId!==t.operationId&&(n.operationId===t.operationId||a)))return;g.current=t.operationId,n&&(b.current={...n,operationId:t.operationId,runtimeRevision:Math.max(n.runtimeRevision??i,i)},oz(e,b.current)),localStorage.setItem(oT(e),"pending"),localStorage.setItem(oP(e),t.operationId),m("pending");return}let n=g.current,i=localStorage.getItem(oT(e)),s=!n&&("pending"===i||"confirming"===i),l=r?.recentReceipts.find(e=>"reconfigure"===e.kind&&(n?e.operationId===n:s&&("applied"===e.status||"failed"===e.status||"rejected"===e.status)));if(l){if(localStorage.removeItem(oT(e)),localStorage.removeItem(oP(e)),"applied"===l.status)P(l.operationId),g.current=null,m("applied"),n&&oC("ok",a("runtimeConfig.applied"));else if("failed"===l.status||"rejected"===l.status){let t=b.current??oq(e);t?.operationId===l.operationId&&$(t),g.current=null,m("error"),h(l.reason??a("runtimeConfig.failed")),n&&oC("err",l.reason??a("runtimeConfig.failed"))}}},[P,e,o,$,r,a]),(0,Y.useEffect)(()=>{if("live-root"!==o||"confirming"!==p)return;let t=("claude"===l?oj(e.launchModel??e.model):e.model)===c.model,n=e.effort===c.effort,r="claude"===l||e.fast===c.fast;t&&n&&r&&(localStorage.removeItem(oT(e)),localStorage.removeItem(oP(e)),P(g.current),g.current=null,m("applied"))},[p,P,l,e,c,o]);let R="saving"===p||"pending"===p||"confirming"===p||!!("structured"===o&&r?.pendingReconfigure),O=(0,Y.useMemo)(()=>{if(!l)return{model:"",effort:"",fast:!1};if("live-root"===o||"structured"===o)return"error"===p?oO(e):c;if("resume"===o)return oD(e)??oO(e);return oF(e)},[l,o,p,c,e,v]),D=(0,Y.useMemo)(()=>l?(0,of.ve)(l,O.model)??[]:[],[l,O.model]),L="codex"===l,_=a("composer.settingsNextResume"),F=(0,Y.useCallback)(e=>{C(a("composer.nextMessageUses",{model:l?oB(l,e.model):e.model,effort:oU(a,e.effort)}))},[l,a]),q=(0,Y.useCallback)(t=>{if(l){if("live-root"===o||"structured"===o){x.current+=1,g.current=null,localStorage.removeItem(oT(e)),localStorage.removeItem(oP(e));let n=u.current,i=b.current,a=Number.isSafeInteger(r?.revision)?r.revision:null,s=i?.runtimeRevision===null||i?.runtimeRevision===void 0?a:null===a?i.runtimeRevision:Math.max(i.runtimeRevision,a),c={operationId:null,supersededOperationId:i?.operationId??i?.supersededOperationId??null,runtimeRevision:s,draft:i?.draft??n,profile:i?i.profile:oL(e)};b.current=c,oz(e,c);let p=t.model?(0,of.ve)(l,t.model)??[]:(0,of.ve)(l,n.model)??[],m={...n,...t,effort:t.effort??(p.includes(n.effort)?n.effort:p[0]??n.effort)};u.current=m,d(m);try{localStorage.setItem(oM(e),JSON.stringify(m))}catch{}F(m),"structured"===o&&o_(e,t),E(m);return}"resume"===o?F(function(e,t){let n=e.engine,r={...oD(e)??oO(e),...t};void 0!==t.model&&(r.effort=(0,of.TS)(n,r.model,r.effort)??r.effort),"codex"!==n&&(r.fast=!1);try{localStorage.setItem(oE(e),JSON.stringify(r))}catch{}return r}(e,t)):(o_(e,t),F(oF(e))),w(e=>e+1)}},[l,o,e,F,E,r]),z=(0,Y.useCallback)(()=>{k(!1),N("root"),A.current?.focus()},[]),H=e=>{q({effort:e}),s||z()},B=e=>{q({model:e}),s||z()},K=e=>{q({fast:e}),s||z()};if(!l||!o)return null;let V=(i=O.model,ow[l].find(e=>e.id===i)?.shortLabel??i),J=oU(a,O.effort),G=`${a("composer.runtimePill")} — ${oB(l,O.model)}, ${J}`;return(0,U.jsxs)("span",{className:"relative inline-flex",onPointerDown:e=>e.stopPropagation(),children:[(0,U.jsxs)("button",{ref:A,type:"button","aria-haspopup":"menu","aria-expanded":y,"aria-busy":R||void 0,"aria-label":G,"data-runtime-pill":!0,onClick:()=>y?z():k(!0),onKeyDown:e=>{y||"ArrowDown"!==e.key&&"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),k(!0))},className:`inline-flex h-7 min-w-0 shrink items-center gap-1 rounded-control px-1.5 text-label font-semibold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 motion-reduce:transition-none ${s?"relative min-h-11 before:absolute before:-inset-x-1 before:-inset-y-2 before:content-['']":""} ${"error"===p?"text-danger":"text-secondary hover:bg-sunken hover:text-primary"} ${y?"bg-sunken text-primary":""}`,children:[(0,U.jsx)(sx.Kq,{className:"h-3.5 w-3.5 shrink-0 text-accent","aria-hidden":!0}),(0,U.jsxs)("span",{className:"max-w-[52vw] truncate md:max-w-[16rem]",children:[V," \xb7 ",J]}),R?(0,U.jsx)(sx.kr,{className:"h-3 w-3 shrink-0 animate-spin motion-reduce:animate-none","aria-hidden":!0}):(0,U.jsx)(sx.yQ,{className:"h-3 w-3 shrink-0","aria-hidden":!0})]}),R?(0,U.jsx)("span",{className:"ml-1 self-center text-[10px] font-semibold text-accent","data-runtime-switch-pending":!0,children:a("runtimeConfig.pending")}):null,y&&!s?(0,U.jsx)(oY,{t:a,engine:l,face:O,efforts:D,speedShown:L,panel:j,setPanel:N,effortLocked:!1,modelLocked:!1,speedLocked:!1,lockReason:_,onSelectEffort:H,onSelectModel:B,onSelectFast:K,onClose:z}):null,y&&s?(0,U.jsx)(oJ,{t:a,engine:l,face:O,efforts:D,speedShown:L,effortLocked:!1,modelLocked:!1,speedLocked:!1,lockReason:_,onSelectEffort:H,onSelectModel:B,onSelectFast:K,onClose:()=>{k(!1),A.current?.focus()}}):null,(0,U.jsx)("span",{className:"sr-only",role:"status","aria-live":"polite","data-runtime-pill-status":!0,children:S}),"error"===p&&f?(0,U.jsx)("span",{className:"sr-only",role:"status","aria-live":"assertive",children:f}):null]})}function oY({t:e,engine:t,face:n,efforts:r,speedShown:i,panel:a,setPanel:s,effortLocked:l,modelLocked:o,speedLocked:c,lockReason:d,onSelectEffort:u,onSelectModel:p,onSelectFast:m,onClose:f}){let h=(0,Y.useRef)(null),x=(0,Y.useRef)([]),[g,b]=(0,Y.useState)(0),v=(0,Y.useMemo)(()=>(function({t:e,engine:t,face:n,efforts:r,speedShown:i,panel:a,effortLocked:s,modelLocked:l,speedLocked:o,lockReason:c,onSelectEffort:d,onSelectModel:u,onSelectFast:p,onOpenPanel:m}){let f=t=>({key:"back",kind:"back",label:t,checked:!1,enabled:!0,role:"menuitem",ariaLabel:`${e("composer.backTo")} — ${t}`,activate:()=>m("root")});if("model"===a)return[f(e("composer.modelGroup")),...ow[t].map(e=>({key:e.id,kind:"model",label:e.label,checked:n.model===e.id,enabled:!l,reason:l?c:void 0,role:"menuitemradio",activate:()=>u(e.id)}))];if("speed"===a)return[f(e("composer.speedGroup")),{key:"standard",kind:"speed",label:e("composer.speedStandard"),checked:!n.fast,enabled:!o,reason:o?c:void 0,role:"menuitemradio",activate:()=>p(!1)},{key:"fast",kind:"speed",label:e("composer.speedFastTier"),checked:n.fast,enabled:!o,reason:o?c:void 0,role:"menuitemradio",activate:()=>p(!0)}];let h=r.map(t=>({key:`tier-${t}`,kind:"tier",label:oU(e,t),checked:n.effort===t,enabled:!s,reason:s?c:void 0,role:"menuitemradio",activate:()=>d(t)})),x=[{key:"model",kind:"submenu",label:e("composer.modelGroup"),detail:ow[t].find(e=>e.id===n.model)?.shortLabel??n.model,checked:!1,enabled:!0,submenu:"model",role:"menuitem",activate:()=>m("model")}];return i&&x.push({key:"speed",kind:"submenu",label:e("composer.speedGroup"),detail:n.fast?e("composer.speedFastTier"):e("composer.speedStandard"),checked:!1,enabled:!0,submenu:"speed",role:"menuitem",activate:()=>m("speed")}),[...h,...x]})({t:e,engine:t,face:n,efforts:r,speedShown:i,panel:a,effortLocked:l,modelLocked:o,speedLocked:c,lockReason:d,onSelectEffort:u,onSelectModel:p,onSelectFast:m,onOpenPanel:s}),[e,t,n,r,i,a,l,o,c,d,u,p,m,s]),w=(0,Y.useMemo)(()=>v.map((e,t)=>e.enabled?t:-1).filter(e=>e>=0),[v]);(0,Y.useEffect)(()=>{let e=v.findIndex(e=>e.checked&&e.enabled),t=e>=0?e:w[0]??0;b(t),x.current[t]?.focus()},[a]),(0,Y.useEffect)(()=>{let e=e=>{h.current&&!h.current.contains(e.target)&&f()};return window.addEventListener("pointerdown",e),()=>window.removeEventListener("pointerdown",e)},[f]);let y=e=>{b(e),x.current[e]?.focus()},k=e=>{if(!w.length)return;let t=w.indexOf(g),n=t<0?0:(t+e+w.length)%w.length;y(w[n])};return(0,U.jsx)("div",{ref:h,role:"menu","aria-label":e("composer.runtimePill"),"data-runtime-popover":!0,onKeyDown:e=>{switch(e.key){case"ArrowDown":e.preventDefault(),k(1);break;case"ArrowUp":e.preventDefault(),k(-1);break;case"Home":e.preventDefault(),w.length&&y(w[0]);break;case"End":e.preventDefault(),w.length&&y(w.at(-1));break;case"ArrowRight":{let t=v[g];t?.submenu&&(e.preventDefault(),s(t.submenu));break}case"ArrowLeft":"root"!==a&&(e.preventDefault(),s("root"));break;case"Escape":e.preventDefault(),f();break;case"Enter":case" ":e.preventDefault(),v[g]?.activate();break;case"Tab":f()}},className:"absolute bottom-[calc(100%+6px)] left-0 z-40 w-[240px] rounded-surface border border-border bg-raised p-1.5 shadow-2 motion-reduce:transition-none",children:"root"===a?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(oW,{label:e("composer.reasoningGroup"),children:v.filter(e=>"tier"===e.kind).map(e=>(0,U.jsx)(oV,{row:e,active:v.indexOf(e)===g,refFor:t=>{x.current[v.indexOf(e)]=t}},e.key))}),(0,U.jsx)("div",{className:"mx-2 my-1 border-t border-border/70",role:"separator"}),v.filter(e=>"submenu"===e.kind).map(e=>(0,U.jsx)(oV,{row:e,active:v.indexOf(e)===g,refFor:t=>{x.current[v.indexOf(e)]=t}},e.key))]}):(0,U.jsx)("div",{role:"group","aria-label":"model"===a?e("composer.modelGroup"):e("composer.speedGroup"),children:v.map((e,t)=>(0,U.jsx)(oV,{row:e,active:t===g,refFor:e=>{x.current[t]=e}},e.key))})})}function oW({label:e,children:t}){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("div",{className:"px-2 pb-1 pt-1.5 text-label font-semibold text-secondary",children:e}),(0,U.jsx)("div",{role:"group","aria-label":e,children:t})]})}function oV({row:e,active:t,refFor:n}){let r=e.reason?`${e.label} — ${e.reason}`:e.label;if("back"===e.kind)return(0,U.jsxs)("button",{ref:n,type:"button",role:"menuitem",tabIndex:t?0:-1,"aria-label":e.ariaLabel,onClick:e.activate,"data-runtime-row":"back",className:"flex w-full items-center gap-1 rounded-control px-2 py-1.5 text-left text-ui font-semibold text-secondary hover:bg-sunken focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:[(0,U.jsx)(sx.JG,{className:"h-3.5 w-3.5 shrink-0 text-muted","aria-hidden":!0}),e.label]});let i="submenu"===e.kind;return(0,U.jsxs)("button",{ref:n,type:"button",role:e.role,"aria-checked":"menuitemradio"===e.role?e.checked:void 0,"aria-haspopup":i?"menu":void 0,"aria-disabled":!e.enabled||void 0,disabled:!e.enabled,tabIndex:t?0:-1,"aria-label":e.reason?r:void 0,title:e.reason,onClick:e.activate,"data-runtime-row":e.kind,"data-runtime-value":e.key,className:`flex min-h-[28px] w-full items-center gap-2 rounded-control px-2 py-1 text-left text-ui hover:bg-sunken focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:cursor-not-allowed disabled:opacity-50 ${e.checked?"text-primary":"text-secondary"}`,children:[(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate",children:e.label}),e.detail?(0,U.jsx)("span",{className:"shrink-0 text-caption text-muted",children:e.detail}):null,e.checked?(0,U.jsx)(sx.Jl,{className:"h-3.5 w-3.5 shrink-0 text-accent","aria-hidden":!0}):null,i?(0,U.jsx)(sx.c_,{className:"h-3.5 w-3.5 shrink-0 text-muted","aria-hidden":!0}):null]})}function oJ({t:e,engine:t,face:n,efforts:r,speedShown:i,effortLocked:a,modelLocked:s,speedLocked:l,lockReason:o,onSelectEffort:c,onSelectModel:d,onSelectFast:u,onClose:p}){let m=(0,Y.useRef)(null);return(0,Y.useEffect)(()=>{m.current?.focus();let e=e=>{"Escape"===e.key&&p()};window.addEventListener("keydown",e);let t=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{window.removeEventListener("keydown",e),document.body.style.overflow=t}},[p]),(0,U.jsx)("div",{className:"fixed inset-0 z-[70] flex items-end justify-center bg-black/40",role:"presentation",onClick:e=>{e.target===e.currentTarget&&p()},children:(0,U.jsxs)("div",{ref:m,role:"dialog","aria-modal":"true","aria-label":e("composer.runtimePill"),tabIndex:-1,"data-runtime-sheet":!0,className:"max-h-[80vh] w-full max-w-[440px] overflow-y-auto rounded-t-[16px] bg-card p-3 pb-[max(0.75rem,env(safe-area-inset-bottom))] shadow-2 focus-visible:outline-none",children:[(0,U.jsx)("div",{className:"mx-auto mb-2 h-1 w-10 rounded-full bg-border","aria-hidden":!0}),(0,U.jsx)(oG,{label:e("composer.reasoningGroup"),children:r.map(t=>(0,U.jsx)(oQ,{label:oU(e,t),checked:n.effort===t,disabled:a,reason:a?o:void 0,onSelect:()=>c(t)},t))}),(0,U.jsx)(oG,{label:e("composer.modelGroup"),children:ow[t].map(e=>(0,U.jsx)(oQ,{label:e.label,checked:n.model===e.id,disabled:s,reason:s?o:void 0,onSelect:()=>d(e.id)},e.id))}),i?(0,U.jsxs)(oG,{label:e("composer.speedGroup"),children:[(0,U.jsx)(oQ,{label:e("composer.speedStandard"),checked:!n.fast,disabled:l,reason:l?o:void 0,onSelect:()=>u(!1)}),(0,U.jsx)(oQ,{label:e("composer.speedFastTier"),checked:n.fast,disabled:l,reason:l?o:void 0,onSelect:()=>u(!0)})]}):null]})})}function oG({label:e,children:t}){return(0,U.jsxs)("div",{className:"mb-2",role:"radiogroup","aria-label":e,children:[(0,U.jsx)("div",{className:"mb-1 px-1 text-label font-semibold text-secondary",children:e}),t]})}function oQ({label:e,checked:t,disabled:n=!1,reason:r,onSelect:i}){return(0,U.jsxs)("button",{type:"button",role:"radio","aria-checked":t,"aria-disabled":n||void 0,disabled:n,"aria-label":r?`${e} — ${r}`:void 0,title:r,onClick:i,"data-runtime-sheet-row":!0,className:`flex min-h-11 w-full items-center gap-2 rounded-control px-2 text-left text-body hover:bg-sunken focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-50 ${t?"text-primary":"text-secondary"}`,children:[(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate",children:e}),t?(0,U.jsx)(sx.Jl,{className:"h-4 w-4 shrink-0 text-accent","aria-hidden":!0}):null]})}function oX(e,t){switch(t.status){case"queued":return"number"==typeof t.queuePosition?e("runtime.receipt.queuedPos",{position:t.queuePosition}):e("runtime.receipt.queued");case"rejected":case"failed":var n;let r;return(r=ri(n=t.reason))?e(r):n?e("receipt.human.verbatim",{reason:n}):e("composer.receiptFailed");default:return e(`runtime.receipt.${t.status}`)}}function oZ({receipt:e,actionsDisabled:t=!1,onRetry:n,onEdit:r}){var i;let{t:a}=(0,eh.Ym)(),s="rejected"===e.status||"failed"===e.status;return(0,U.jsxs)("span",{className:"inline-flex flex-wrap items-center gap-1.5 text-[11px] font-semibold","data-operation":e.operationId,children:[(0,U.jsx)(sv,{tone:"rejected"===(i=e.status)||"failed"===i?"danger":"delivered"===i||"applied"===i||"answered"===i?"success":"uncertain"===i?"warning":"neutral","data-receipt-status":e.status,...s?{role:"status","aria-live":"polite"}:{},children:oX(a,e)}),s&&n?(0,U.jsx)("button",{type:"button",disabled:t,className:"min-h-11 rounded-full border border-border bg-canvas px-3 py-0.5 text-muted hover:border-accent/45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-50 sm:min-h-0 sm:px-2",onClick:n,children:a("runtime.receipt.retry")}):null,s&&r?(0,U.jsx)("button",{type:"button",disabled:t,className:"min-h-11 rounded-full border border-border bg-canvas px-3 py-0.5 text-muted hover:border-accent/45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-50 sm:min-h-0 sm:px-2",onClick:r,children:a("runtime.receipt.edit")}):null,rn(e.status)||"pending"===e.status?null:(0,U.jsx)("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-muted motion-reduce:animate-none","aria-hidden":!0})]})}function o0(e){return"rejected"===e||"failed"===e}function o1(e){return"turn-started"===e||"steered"===e||rn(e)&&!o0(e)}function o2(e){return"send"===e.kind||"steer"===e.kind}let o5=(e,t)=>Date.parse(t.at)-Date.parse(e.at),o4=new Map,o3=new Set,o6=e=>"llvReceiptsDismissed:"+e,o8={state:"enabled"},o7={state:"hidden"},o9=e=>({state:"disabled",reason:e}),ce=e=>({state:"enabled",note:e}),ct=e=>e?.supported?o8:o9("composer.structuredImagesProtocol");function cn(e){if(!e||e.legacy||!e.structuredControlsEnabled)return!1;let t=e.session.hostKind;return"codex-app-server"===t||"claude-broker"===t}function cr(e){return"claude-projects"===e.root?"session"===e.kind:"codex-sessions"===e.root}function ci(e,t,n={}){var r;if("shell"===e.engine)return"shell";if(e.supersededBy)return"superseded";let i=(r=t)&&!r.legacy&&r.structuredControlsEnabled&&("dead"===r.session.host||"unhosted"===r.session.host)?{kind:"dead"}:cn(t)?{kind:"structured"}:t&&t.legacy||t&&!t.structuredControlsEnabled||!n.runtimeEnabled?{kind:"legacy"}:{kind:"unresolved"};return"structured"===i.kind?"structured":"dead"===i.kind?"dead":"claude-projects"===e.root&&"subagent"===e.kind?n.root?.liveness==="live"?n.root.structured?"structured-subagent":"live-subagent":void 0===n.root&&"unresolved"!==i.kind&&"running"===e.proc?"live-subagent":cr(e)?"resume":"inert":"unresolved"===i.kind?"running"===e.proc?"unresolved":cr(e)?"resume":"inert":"running"===e.proc?"subagent"===e.kind||e.parent?"live-subagent":"live-root":cr(e)?"resume":"inert"}let ca=["stop","compact","terminal"];function cs(e){var t;let n=s1(),r=s4(W(e)),i="claude-projects"===e.root&&"subagent"===e.kind,a=(t=i?e.parent:null,sZ(e=>s5(e,null,t),null,s2)),s={runtimeEnabled:n,...n&&i?{root:function(e){if(!e)return{liveness:"unknown",structured:!1};let t=cn(e),n=e.session.host;return{liveness:"dead"===n||"unhosted"===n?"gated":"hosted"===n?"live":"unknown",structured:t,imageInput:t?e.session.capabilities?.imageInput??null:null}}(a)}:{}},l=function(e,t,n={}){let r=ci(e,t,n);switch(r){case"live-root":return{surface:r,controls:{stop:o8,compact:o8,runtime:o8,kill:o8,terminal:o8,images:o8,send:o8}};case"live-subagent":return{surface:r,controls:{stop:ce("strip.stopSubagent"),compact:o9("strip.compactSubagent"),runtime:o7,kill:o8,terminal:o8,images:o8,send:o8}};case"structured-subagent":return{surface:r,controls:{stop:ce("strip.stopSubagent"),compact:o9("strip.compactSubagent"),runtime:o7,kill:o8,terminal:o8,images:ct(n.root?.imageInput),send:o8}};case"structured":var i;return{surface:r,controls:{stop:o8,compact:(i=t?.session,i?.hostKind!=="codex-app-server"||i.sessionKey?.engine!=="codex"?o9("strip.compactEngineUnsupported"):"running"===i.turn||"interrupt_requested"===i.turn||i.activeTurnId?o9("strip.compactBusyTurn"):o8),runtime:o8,kill:o8,terminal:o8,images:ct(t?.session.capabilities?.imageInput),send:o8}};case"resume":return{surface:r,controls:{stop:o7,compact:o7,runtime:o8,kill:o7,terminal:o8,images:o8,send:o8}};case"dead":return{surface:r,controls:{stop:o7,compact:o7,runtime:o7,kill:o7,terminal:o8,images:o9("composer.imagesBlockedDuringRecovery"),send:o8}};case"superseded":return{surface:r,controls:{stop:o7,compact:o7,runtime:o7,kill:o7,terminal:o8,images:o7,send:o9("superseded.sendBlocked")}};case"shell":return{surface:r,controls:{stop:o7,compact:o7,runtime:o7,kill:"running"===e.proc?o8:o7,terminal:o7,images:o7,send:o7}};case"unresolved":return{surface:r,controls:{stop:o7,compact:o7,runtime:o7,kill:o7,terminal:o7,images:o7,send:o9("strip.resolving")}};default:return{surface:"inert",controls:{stop:o7,compact:o7,runtime:o7,kill:o7,terminal:cr(e)?o8:o7,images:o7,send:o7}}}}(e,r,s),o=(!r?.structuredControlsEnabled||r.legacy?null:"codex-app-server"===r.session.hostKind||"claude-broker"===r.session.hostKind?r:null)??("structured-subagent"===l.surface?a:null);return{caps:l,runtime:r,structuredSession:o,runtimeEnabled:n,attachMode:function(e,t,n={}){let r=ci(e,t,n);return"live-root"===r||"live-subagent"===r?"live":"resume"}(e,r,s)}}var cl=n(2437),co=n(8272),cc=n(5688),cd=n(8980),cu=n(4614);function cp({phase:e,start:t,stop:n,t:r}){let i="connecting"===e||"live"===e||"stopping"===e,a=r("connecting"===e?"voice.connecting":"stopping"===e?"voice.stopping":i?"voice.stop":"voice.start");return(0,U.jsx)(ly,{label:a,align:"right",children:(0,U.jsx)("button",{type:"button","data-testid":"voice-call-button","aria-label":a,"aria-pressed":i,onClick:()=>void(i?n():t()),className:`inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-control border focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${i?"border-danger/60 bg-danger/10 text-danger hover:bg-danger/20":"border-border text-muted hover:bg-sunken hover:text-accent"}`,children:"connecting"===e||"stopping"===e?(0,U.jsx)(sx.kr,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):i?(0,U.jsx)(sx.M6,{className:"h-3.5 w-3.5 fill-current","aria-hidden":!0}):(0,U.jsx)(cl.A,{className:"h-4 w-4","aria-hidden":!0})})})}function cm({startedAt:e,t}){let n,[r,i]=(0,Y.useState)(()=>Date.now());return(0,Y.useEffect)(()=>{let e=window.setInterval(()=>i(Date.now()),1e3);return()=>window.clearInterval(e)},[]),(0,U.jsx)("span",{className:"font-mono tabular-nums text-caption text-secondary","aria-label":t("voice.elapsed"),"data-testid":"voice-elapsed",children:(n=Math.max(0,Math.floor((r-e)/1e3)),`${Math.floor(n/60)}:${String(n%60).padStart(2,"0")}`)})}let cf=[0,1,2,3];function ch({stream:e,t}){let n=(0,Y.useRef)([]);return(0,Y.useEffect)(()=>{let t,r=window.AudioContext??window.webkitAudioContext;if(!e||!r||"function"!=typeof requestAnimationFrame)return;try{t=new r}catch{return}let i=t.createAnalyser();i.fftSize=256,i.smoothingTimeConstant=.7,t.createMediaStreamSource(e).connect(i);let a=new Uint8Array(i.frequencyBinCount),s=0,l=()=>{i.getByteFrequencyData(a);let e=0;for(let t of a)e+=t*t;let t=Math.min(1,Math.sqrt(e/a.length)/90);n.current.forEach((e,n)=>{if(!e)return;let r=.25+.12*n,i=3+26*Math.max(0,t-.4*r);e.style.height=`${Math.min(14,i).toFixed(1)}px`,e.style.opacity=t>.5*r?"1":"0.45"}),s=requestAnimationFrame(l)};return l(),()=>{cancelAnimationFrame(s),t.close().catch(()=>void 0)}},[e]),(0,U.jsx)("span",{className:"flex h-4 items-center gap-[2px]",role:"img","aria-label":t("voice.micLevel"),"data-testid":"voice-mic-level",children:cf.map(e=>(0,U.jsx)("span",{ref:t=>{n.current[e]=t},className:"w-[2px] rounded-full bg-success/80 transition-[height] duration-75",style:{height:"3px",opacity:.45}},e))})}function cx({on:e,onClick:t,label:n,testId:r,OnIcon:i,OffIcon:a}){return(0,U.jsx)("button",{type:"button","data-testid":r,"aria-label":n,"aria-pressed":e,title:n,onClick:t,className:`inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-control focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${e?"text-danger hover:bg-danger/10":"text-muted hover:bg-sunken hover:text-secondary"}`,children:(0,U.jsx)(e?i:a,{className:"h-3.5 w-3.5","aria-hidden":!0})})}function cg({phase:e,lines:t,error:n,startedAt:r=null,stream:i=null,micMuted:a=!1,outputMuted:s=!1,onToggleMic:l,onToggleOutput:o,onRetry:c,t:d}){let u,p,{ref:m,onScroll:f}=(u=(0,Y.useRef)(null),p=(0,Y.useRef)(!0),(0,Y.useEffect)(()=>{let e=u.current;e&&p.current&&(e.scrollTop=e.scrollHeight)},[t]),{ref:u,onScroll:()=>{let e=u.current;e&&(p.current=e.scrollHeight-e.scrollTop-e.clientHeight<24)}});if("idle"===e&&0===t.length&&!n)return null;let h="live"===e,x="connecting"===e?d("voice.connecting"):"stopping"===e?d("voice.stopping"):h?d("voice.live"):"error"===e?d("voice.failed"):d("voice.ended");return(0,U.jsxs)("section",{"aria-label":d("voice.panel"),"data-phase":e,className:`overflow-hidden rounded-control border bg-raised/70 ${"error"===e?"border-danger/40":h?"border-success/40":"border-border"}`,children:[(0,U.jsxs)("header",{className:"flex items-center gap-2 border-b border-border/60 px-2 py-1.5",children:[(0,U.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${h?"animate-pulse bg-success":"error"===e?"bg-danger":"idle"===e?"bg-muted":"bg-accent"}`,"aria-hidden":!0}),(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate text-caption text-muted",role:"status",children:x}),h&&null!==r?(0,U.jsx)(cm,{startedAt:r,t:d}):null,h&&!a?(0,U.jsx)(ch,{stream:i,t:d}):null,h&&l?(0,U.jsx)(cx,{on:a,onClick:l,testId:"voice-mic-toggle",label:a?d("voice.micUnmute"):d("voice.micMute"),OnIcon:co.A,OffIcon:cc.A}):null,h&&o?(0,U.jsx)(cx,{on:s,onClick:o,testId:"voice-output-toggle",label:s?d("voice.outputUnmute"):d("voice.outputMute"),OnIcon:cd.A,OffIcon:cu.A}):null]}),(0,U.jsx)("div",{ref:m,onScroll:f,"aria-live":"polite",className:"max-h-48 space-y-1.5 overflow-y-auto p-2",children:t.map((e,n)=>{let r=t[n-1]?.role!==e.role;return(0,U.jsxs)("div",{className:r&&n>0?"pt-1":void 0,children:[r?(0,U.jsx)("span",{className:`block text-caption uppercase tracking-wide ${"progress"===e.role?"text-accent":"user"===e.role?"text-secondary":"text-success"}`,children:"user"===e.role?d("voice.you"):"progress"===e.role?d("voice.progress"):d("voice.agent")}):null,(0,U.jsxs)("span",{className:`block text-label leading-snug ${"progress"===e.role&&!e.final?"text-muted":"text-primary"}`,children:[e.text,e.final?null:(0,U.jsx)("span",{className:"ml-0.5 inline-block h-3 w-px animate-pulse bg-current align-middle","aria-hidden":!0})]})]},e.id)})}),n?(0,U.jsxs)("div",{role:"alert",className:"flex items-start gap-2 border-t border-danger/30 bg-danger/5 px-2 py-1.5",children:[(0,U.jsx)("p",{className:"min-w-0 flex-1 text-label text-danger",children:n}),c?(0,U.jsxs)("button",{type:"button","data-testid":"voice-retry",onClick:c,className:"inline-flex shrink-0 items-center gap-1 rounded-control border border-danger/40 px-1.5 py-0.5 text-caption text-danger hover:bg-danger/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-danger/40",children:[(0,U.jsx)(sx.kt,{className:"h-3 w-3","aria-hidden":!0}),d("voice.retry")]}):null]}):null]})}var cb=n(2359);let cv=new Set,cw=0;function cy(e){return cv.add(e),()=>cv.delete(e)}function ck(){return cw}function cj(){return 0}let cN={width:380,height:560};function cS(){let e=window.documentPictureInPicture;return e&&"function"==typeof e.requestWindow?e:null}function cC(){return null!==cS()}let cA="data-llv-adopted-style";function cI(e){for(let t of Array.from(e.document.head.querySelectorAll(`[${cA}]`)))t.remove();for(let t of Array.from(document.styleSheets))try{let n=Array.from(t.cssRules).map(e=>e.cssText).join("\n"),r=e.document.createElement("style");r.setAttribute(cA,""),r.textContent=n,e.document.head.appendChild(r)}catch{let n=t.href;if(!n)continue;let r=e.document.createElement("link");r.setAttribute(cA,""),r.rel="stylesheet",r.href=n,e.document.head.appendChild(r)}e.document.documentElement.className=document.documentElement.className,e.document.body.className=document.body.className,e.document.documentElement.lang=document.documentElement.lang,e.document.documentElement.dir=document.documentElement.dir}function cM({phase:e,t}){return("connecting"===e||"live"===e)&&cC()?(0,U.jsx)(ly,{label:t("voice.float"),align:"right",children:(0,U.jsx)("button",{type:"button","data-testid":"voice-float-button","aria-label":t("voice.float"),onClick:()=>(function(){for(let e of(cw+=1,cv))e()})(),className:"inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-control border border-border text-muted hover:bg-sunken hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:(0,U.jsx)(cb.A,{className:"h-4 w-4","aria-hidden":!0})})}):null}let cT=new Map,cP=new Map;async function c$(e,t=fetch,n=Date.now){let r=e.trim();if(!r)return null;let i=cT.get(r);if(i&&n()-i.cachedAt<3e4)return i.conversationId;let a=cP.get(r);if(a)return a;let s=(async()=>{try{let e=await t("/api/orchestrator/seat?project="+encodeURIComponent(r));if(!e.ok)return null;let i=await e.json(),a=!0===i.exists&&"string"==typeof i.seat?.conversationId?i.seat.conversationId:null;return cT.set(r,{conversationId:a,cachedAt:n()}),a}catch{return null}finally{cP.delete(r)}})();return cP.set(r,s),s}async function cE(e,t,n=fetch,r=Date.now){return!!e.startsWith("conversation_")&&await c$(t,n,r)===e}let cR=new Map,cO=new Map,cD=new Set,cL=0;function c_(){for(let e of(cL+=1,cD))e()}function cF(e,t,n){return e.set(t,n),c_(),()=>{e.get(t)===n&&(e.delete(t),c_())}}function cq(e){return cD.add(e),()=>cD.delete(e)}function cz(){return null}let cH=new Map,cU=new Map,cB=new Map,cK=0;function cY(e){let t=cH.get(e),n=t?.findLast(e=>e.primary)??t?.[t.length-1],r=n?cB.get(e)?.get(n.id):void 0;return!!r&&cU.get(e)!==r&&(cU.set(e,r),!0)}function cW(){return cK>0}function cV(){return!1}function cJ(){return cL}function cG(){return 0}let cQ=new Set(["delivery-auto-retry","interrupt-auto-retry"]),cX=e=>"llvSent:"+e,cZ=e=>e.retryOfOperationId??null,c0=new Set;function c1({receipts:e,actionsDisabled:t=!1,dismissed:n=c0,onRetry:r,onEdit:i,onDismiss:a}){let{t:s}=(0,eh.Ym)(),l=(0,Y.useId)(),[o,c]=(0,Y.useState)(!1),d=e=>"send"===e.kind||"steer"===e.kind,u=e=>d(e)&&("failed"===e.status||"rejected"===e.status)&&"string"==typeof e.text&&e.text.length>0&&e.text.length<240,p=function(e,t=new Set){let n=e.filter(e=>o2(e)&&!!e.text).sort(o5),r=[],i=new Map;for(let e of n){let t=`${e.kind}\u0000${e.text}`,n=i.get(t);n?n.push(e):(i.set(t,[e]),r.push(t))}let a=[];for(let e of r){let n=i.get(e);if(o1(n[0].status))continue;let r=n.filter(e=>!o1(e.status)&&!(rn(e.status)&&t.has(e.operationId)));r.length&&a.push({current:r[0],attempts:r})}return a}(e,n),m=p.flatMap(e=>e.attempts),f=e=>{let t=new Map;for(let n of e.slice(1)){let e=oX(s,n);t.set(e,(t.get(e)??0)+1)}return[...t].map(([e,t])=>t>1?`${e} \xd7${t}`:e)},h=function(e,t=new Set){return e.filter(e=>(!o2(e)||!e.text)&&!o1(e.status)&&!(rn(e.status)&&t.has(e.operationId)))}(e,n),x=m.filter(e=>!rn(e.status)),g=m.filter(e=>o0(e.status)),b=x.some(e=>"string"==typeof e.reason&&cQ.has(e.reason)),v=s("runtime.receipt.summary",{count:m.length}),w=s(o?"runtime.receipt.hideDetails":"runtime.receipt.showDetails");return(0,U.jsxs)(U.Fragment,{children:[m.length?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)("details",{className:"group w-full min-w-0 rounded-control border border-border bg-sunken/55 text-caption text-secondary","data-runtime-receipt-stack":!0,open:o,onToggle:e=>c(e.currentTarget.open),children:[(0,U.jsxs)("summary",{"aria-describedby":l,"aria-label":`${w}. ${v}`,className:"flex min-h-11 max-h-11 cursor-pointer list-none items-center gap-1 overflow-hidden rounded-control px-1.5 py-1 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 [&::-webkit-details-marker]:hidden",children:[(0,U.jsx)(sx.c_,{className:"h-3 w-3 shrink-0 text-muted transition-transform duration-150 group-open:rotate-90 motion-reduce:transition-none","aria-hidden":!0}),(0,U.jsx)("span",{className:"shrink-0 font-semibold text-primary",children:v}),(0,U.jsx)("span",{className:"min-w-[3rem] flex-1 truncate text-right text-muted","data-receipt-preview":!0,title:m[0].text??void 0,children:m[0].text}),(0,U.jsxs)("span",{className:"flex shrink-0 items-center gap-1","data-receipt-counts":!0,children:[x.length?(0,U.jsxs)(sv,{tone:"warning","data-receipt-pending-count":!0,"aria-label":`${s("runtime.receipt.pendingCount",{count:x.length})}${b?` \xb7 ${s("runtime.receipt.busyRetry")}`:""}`,title:b?s("runtime.receipt.busyRetry"):s("runtime.receipt.pendingCount",{count:x.length}),children:[b?(0,U.jsx)(sx.kr,{className:"h-3 w-3 animate-spin motion-reduce:animate-none","aria-hidden":!0}):null,(0,U.jsxs)("span",{className:"sr-only",children:[s("runtime.receipt.pendingCount",{count:x.length}),b?` \xb7 ${s("runtime.receipt.busyRetry")}`:null]}),(0,U.jsx)("span",{"aria-hidden":!0,"data-receipt-count-value":!0,children:x.length})]}):null,g.length?(0,U.jsxs)(sv,{tone:"danger","data-receipt-problem-count":!0,"aria-label":s("runtime.receipt.problemCount",{count:g.length}),title:s("runtime.receipt.problemCount",{count:g.length}),children:[(0,U.jsx)("span",{"aria-hidden":!0,children:"!"}),(0,U.jsx)("span",{className:"sr-only",children:s("runtime.receipt.problemCount",{count:g.length})}),(0,U.jsx)("span",{"aria-hidden":!0,"data-receipt-count-value":!0,children:g.length})]}):null]})]}),(0,U.jsx)("div",{className:"max-h-36 space-y-1 overflow-y-auto border-t border-border/70 p-1.5","data-runtime-receipt-details":!0,children:p.map(e=>{let n=e.current,l=f(e.attempts),o="failed"===n.status,c=!rn(n.status),d=c&&"string"==typeof n.reason&&cQ.has(n.reason);return(0,U.jsxs)("div",{className:"flex min-w-0 flex-col items-end gap-0.5 rounded-control bg-card/70 px-2 py-1",...c?{"data-optimistic-message":"true"}:{},children:[(0,U.jsxs)("div",{className:"flex w-full min-w-0 flex-wrap items-start justify-end gap-1.5",children:[(0,U.jsx)("span",{className:"min-w-[8rem] flex-1 whitespace-pre-wrap break-words text-right text-secondary","data-receipt-message":!0,children:n.text}),e.attempts.length>1?(0,U.jsxs)(sv,{tone:"neutral","data-receipt-attempt-count":!0,"aria-label":s("runtime.receipt.attemptCount",{count:e.attempts.length}),title:s("runtime.receipt.attemptCount",{count:e.attempts.length}),children:[(0,U.jsxs)("span",{"aria-hidden":!0,children:["\xd7",e.attempts.length]}),(0,U.jsx)("span",{className:"sr-only",children:s("runtime.receipt.attemptCount",{count:e.attempts.length})})]}):null,(0,U.jsx)(oZ,{receipt:n,actionsDisabled:t,onRetry:o?()=>r(n):void 0,onEdit:u(n)?()=>i(n):void 0}),a&&o0(n.status)?(0,U.jsx)("button",{type:"button","aria-label":s("runtime.receipt.dismiss"),title:s("runtime.receipt.dismiss"),"data-receipt-dismiss":!0,className:"inline-flex min-h-11 min-w-11 shrink-0 items-center justify-center rounded text-muted hover:text-danger focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:min-h-0 sm:min-w-0 sm:px-0.5",onClick:()=>a(e.attempts.filter(e=>rn(e.status)).map(e=>e.operationId)),children:(0,U.jsx)(sx.X,{className:"h-3 w-3","aria-hidden":!0})}):null,"pending"===n.status?(0,U.jsx)("span",{className:"h-1.5 w-1.5 shrink-0 animate-pulse rounded-full bg-muted motion-reduce:animate-none","aria-hidden":!0}):null,d?(0,U.jsx)("span",{className:"min-w-0 max-w-[52%] truncate text-caption text-muted","data-runtime-receipt-busy":!0,title:s("runtime.receipt.busyRetry"),children:s("runtime.receipt.busyRetry")}):null]}),l.length?(0,U.jsx)("span",{className:"min-w-0 max-w-full truncate text-caption text-muted","data-receipt-history":!0,title:l.join(" \xb7 "),children:l.join(" \xb7 ")}):null]},n.operationId)})})]}),(0,U.jsxs)("span",{id:l,className:"sr-only",role:"status","aria-live":"polite","data-runtime-receipt-status":!0,children:[s("runtime.receipt.statusSummary",{pending:s("runtime.receipt.statusPending",{count:x.length}),problems:s("runtime.receipt.statusProblems",{count:g.length})}),` ${p.map(e=>[oX(s,e.current),...f(e.attempts)].join(" \xb7 ")).join(". ")}.`,b?` ${s("runtime.receipt.busyRetry")}`:null]})]}):null,h.map(e=>{let n="failed"===e.status;return(0,U.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,U.jsx)(oZ,{receipt:e,actionsDisabled:t,onRetry:d(e)&&n?()=>r(e):void 0,onEdit:u(e)?()=>i(e):void 0}),a&&o0(e.status)?(0,U.jsx)("button",{type:"button","aria-label":s("runtime.receipt.dismiss"),title:s("runtime.receipt.dismiss"),"data-receipt-dismiss":!0,className:"inline-flex min-h-11 min-w-11 shrink-0 items-center justify-center rounded text-muted hover:text-danger focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:min-h-0 sm:min-w-0 sm:px-0.5",onClick:()=>a([e.operationId]),children:(0,U.jsx)(sx.X,{className:"h-3 w-3","aria-hidden":!0})}):null]},e.operationId)})]})}function c2(e,t){let n=t.trim();if(!n)return e;let r=e.trimStart();return r.startsWith(n)?r.slice(n.length).trimStart():e}let c5=e=>"llvPendingSend:"+e,c4=e=>"llvDraftImages:"+e;function c3(e){if(!Array.isArray(e))return null;let t=[];for(let n of e){if(!n||"object"!=typeof n||Array.isArray(n)||"string"!=typeof n.base64||"string"!=typeof n.mime)return null;t.push({..."string"==typeof n.id?{id:n.id}:{},base64:n.base64,mime:n.mime,preview:`data:${n.mime};base64,${n.base64}`})}return t}function c6(e){try{let t=JSON.parse(sessionStorage.getItem(c5(e))??"[]");if(!Array.isArray(t))return[];return t.filter(e=>!!e&&"string"==typeof e.key&&"string"==typeof e.text).slice(0,8).map(e=>{let t=c3(e.images),n=null!==t&&!1!==e.payloadComplete,r=function(e){if(!e||"object"!=typeof e||Array.isArray(e))return;let t={};return"string"==typeof e.model&&(t.model=e.model),"string"==typeof e.effort&&(t.effort=e.effort),"boolean"==typeof e.fast&&(t.fast=e.fast),Object.keys(t).length?t:void 0}(e.runtime);return{key:e.key,text:e.text,images:t??[],...r?{runtime:r}:{},...!0===e.runtimeCaptured?{runtimeCaptured:!0}:{},...n?{}:{payloadComplete:!1},..."string"==typeof e.operationId?{operationId:e.operationId}:{},...!0===e.reconciling?{reconciling:!0}:{}}})}catch{return[]}}function c8(e){let t={...e};return delete t.reconciling,t}function c7(e){return"composer-unconfirmed:"+e}function c9(e){return"claude-projects"===e.root?"session"===e.kind||"subagent"===e.kind:"codex-sessions"===e.root}let de=e=>"llvDraft:"+e,dt="llv-compose-draft";function dn(e,t){try{for(let n of[sessionStorage.getItem("llvComposerOwner:"+e),e])if(n&&n!==t)for(let e of[de,c4,c5,cX,o6]){let r=sessionStorage.getItem(e(n));null!==r&&(null===sessionStorage.getItem(e(t))&&sessionStorage.setItem(e(t),r),sessionStorage.removeItem(e(n)))}if(t===e)sessionStorage.removeItem("llvComposerOwner:"+e);else sessionStorage.setItem("llvComposerOwner:"+e,t)}catch{}}let dr=new Map;function di({claimKeys:e}){let t=(0,Y.useRef)(null),n=[...new Set(e)],r=n.join("\0");return(0,Y.useLayoutEffect)(()=>{let e=()=>t.current?.closest("form")?.querySelector("textarea")??null,r=e(),i=n.map(e=>dr.get(e)).find(Boolean);if(r&&i){for(let e of n)dr.delete(e);let e=document.activeElement;if((!e||e===document.body||!e.isConnected)&&dl()-i.at<1e4){r.focus({preventScroll:!0});let e=Math.min(i.end,r.value.length);r.setSelectionRange(Math.min(i.start,e),e),r.scrollTop=i.scrollTop}}return()=>{let t=e();if(!t||document.activeElement!==t)return;let r=dl();for(let[e,t]of dr)r-t.at>=1e4&&dr.delete(e);let i={start:t.selectionStart??t.value.length,end:t.selectionEnd??t.value.length,scrollTop:t.scrollTop,at:r};for(let e of n)dr.set(e,i)}},[r]),(0,U.jsx)("span",{ref:t,hidden:!0,"aria-hidden":!0})}function da(e,t){let n=de(e),r=sessionStorage.getItem(n)??"";sessionStorage.setItem(n,r.trim()?r.replace(/\s*$/,"")+"\n\n"+t:t),window.dispatchEvent(new CustomEvent(dt,{detail:{path:e}}))}let ds=e=>new Date(e).toLocaleTimeString("uk"===(0,eh.JK)()?"uk-UA":"en-US",{hour12:!1,hour:"2-digit",minute:"2-digit"});function dl(){return Date.now()}function dc(e){let t=(0,Y.useSyncExternalStore)(cq,cW,cV),n=W(e.file);return t&&n.startsWith("conversation_")?(0,U.jsx)(dd,{cardId:n,composerProps:e,primary:!0===e.primaryPlace}):(0,U.jsx)(du,{...e})}function dd({cardId:e,composerProps:t,primary:n}){let r=(0,Y.useId)(),i=(0,Y.useCallback)(t=>{if(t)return function(e,t,n=!1,r=null){let i=r??t,a={id:i,node:t,primary:n};return cH.set(e,[...cH.get(e)??[],a]),cY(e),c_(),()=>{let t=cH.get(e);if(!t)return;let n=t.filter(e=>e!==a);if(n.length===t.length)return;let r=cB.get(e);r?.delete(i),r?.size===0&&cB.delete(e),n.length?cH.set(e,n):cH.delete(e),cY(e),c_()}}(e,t,n,r)},[e,r,n]);return(0,Y.useEffect)(()=>{var n;let i;n={file:t.file,pollPaused:t.pollPaused??!1,deadHost:t.deadHost??!1,sendBlockedReason:t.sendBlockedReason??null,placeholder:t.placeholder},(i=cB.get(e)??new Map).set(r,n),cB.set(e,i),cY(e)&&c_()},[e,t.deadHost,t.file,t.placeholder,t.pollPaused,t.sendBlockedReason,r]),(0,U.jsx)("div",{ref:i,"data-testid":"voice-composer-card-slot",className:"contents"})}function du({file:e,pollPaused:t=!1,deadHost:n=!1,sendBlockedReason:r=null,placeholder:i,dockNode:a}){var s,l,o,c,d,u;let p,m,f,h,x,g,{t:b}=(0,eh.Ym)(),v=W(e),{caps:w,structuredSession:y}=cs(e),k=v.startsWith("conversation_")&&y?.session.hostKind==="codex-app-server"&&"hosted"===y.session.host,j=y?.session.liveTurn,N=(s=j?.turnId??"",l=j?.text??"",o=!!(j?.turnId&&y?.session.activeTurnId===j.turnId),c=y?.session.voiceDeliveries??[],p=(0,Y.useMemo)(()=>k&&v.startsWith("conversation_")?sf(v):null,[v,k]),m=(0,Y.useSyncExternalStore)(p?.subscribe??(()=>()=>void 0),p?.getSnapshot??(()=>sJ),()=>sJ),(0,Y.useEffect)(()=>{p&&s&&l&&p.updateWorkerProgress(s,l,o)},[p,m.phase,l,o,s]),(0,Y.useEffect)(()=>{p?.reconcileWorkerDeliveries(c,{authoritative:!0})},[p,m.phase,c]),{...m,micStream:p?.micStream()??null,toggleMic:()=>p?.toggleMic(),toggleOutput:()=>p?.toggleOutput(),realtimeSession:()=>p?.realtimeSession()??null,start:()=>p?.start()??Promise.resolve(),stop:()=>p?.stop()??Promise.resolve()}),S=(0,Y.useSyncExternalStore)(cq,()=>{var e;return k&&(e=v)?cO.get(e)??null:null},cz),C=(0,Y.useCallback)(e=>{if(e)return cF(cR,v,e)},[v]),A=y?.session.capabilities?.imageInput,I=w.controls.images,M=!!(y&&"enabled"!==I.state),T=M?b("disabled"===I.state?I.reason:"composer.structuredImagesProtocol"):void 0,P=lu(e.migration,ll(e.path)),$="switching"===lc(P),E=lp(lc(P)),R=function(e,t,n=!0){let[r,i]=(0,Y.useState)(null);return(0,Y.useEffect)(()=>{var r;if(n&&(null!==e||t))return r={pid:e,path:t??"",onTarget(e){"object"==typeof e&&null!==e&&"transportError"in e||i(e)}},s9.add(r),null===le&&(le=setInterval(()=>void li(),5e3)),lr||(lr=!0,setTimeout(()=>{lr=!1,li()},0)),()=>{s9.delete(r),0===s9.size&&null!==le&&(clearInterval(le),le=null)}},[e,t,n]),null!==e||t?r:null}(e.pid,c9(e)?e.path:void 0,!t),O=sV({initialText:()=>(dn(e.path,v),ot(e.path,v),sessionStorage.getItem(de(v))??""),persistText:e=>{e?sessionStorage.setItem(de(v),e):sessionStorage.removeItem(de(v))},submit:e=>ez(e),imageCapability:y?A??null:null,holdInputWhileBusy:!1}),D=function(e,t={}){let n=t.fetchFn,r=t.conversationId?.trim()??"";return(0,Y.useCallback)(async()=>{if(!e)return aX;let t=n??fetch;await a2(t,e=>!e.startsWith("voice:"));try{let e=new URLSearchParams({mode:"turn-start"});r&&e.set("conversationId",r);let n=await aQ(t,`/api/bridge?${e.toString()}`,{cache:"no-store"},{});if(!n.ok)return aX;let i=(await n.json()).prelude;if(!i?.text)return aX;return{text:i.text,ackToken:i.ackToken,commit:()=>{aZ(i.ackToken,t).catch(()=>void 0)}}}catch{return aX}},[r,e,n])}(k,{conversationId:v}),{text:L,textRef:_,setText:F,setTextState:q,inputRef:z,setStatus:H,busy:B,setBusy:K,voiceSending:V,attachments:J}=O,G=(0,Y.useRef)(!1),Q=ia(),[X,Z]=(0,Y.useState)([]),ee=od(v),et=(0,Y.useSyncExternalStore)(e=>(oi.add(e),()=>oi.delete(e)),()=>or.get(v)??oa,()=>oa),en=(0,Y.useRef)(new Map),er=(0,Y.useRef)(new Set),[ei,ea]=(0,Y.useState)([]),[es,el]=(0,Y.useState)(()=>c6(v).some(e=>e.reconciling)),[eo,ec]=(0,Y.useState)(()=>c6(v).some(e=>!1!==e.payloadComplete)),[ed,eu]=(0,Y.useState)([]),ep=(0,Y.useRef)(rs()),em=(0,Y.useRef)([]),ef=(0,Y.useRef)(new Set),ex=e=>{let t=aq(e);t&&aZ(t).then(()=>aH(e)).catch(()=>{})},eg=(0,Y.useRef)(ex);(0,Y.useEffect)(()=>{eg.current=ex});let eb=(0,Y.useRef)(new Map),ev=function(e,t){let n=[...e,...t],r=new Map,i=new Map;for(let e of n){let t=r.get(e.operationId)??new Set;t.add(e.idempotencyKey),r.set(e.operationId,t);let n=i.get(e.idempotencyKey)??new Set;n.add(e.operationId),i.set(e.idempotencyKey,n)}let a=(e,t)=>t.revision-e.revision||Date.parse(t.at)-Date.parse(e.at)||e.operationId.localeCompare(t.operationId)||e.idempotencyKey.localeCompare(t.idempotencyKey),s=[...e.map(e=>({receipt:e,durable:!0})),...t.map(e=>({receipt:e,durable:!1}))].sort((e,t)=>a(e.receipt,t.receipt)),l=new Map;for(let e of s)l.has(e.receipt.operationId)||l.set(e.receipt.operationId,e);let o=new Set,c=[];for(let e of[...l.values()].sort((e,t)=>Number(t.durable)-Number(e.durable)||a(e.receipt,t.receipt)))o.has(e.receipt.idempotencyKey)||(o.add(e.receipt.idempotencyKey),c.push(e.receipt));let d=new Map(c.map(e=>[e.operationId,e])),u=new Set(c.filter(e=>(r.get(e.operationId)?.size??0)>1||(i.get(e.idempotencyKey)?.size??0)>1).map(e=>e.operationId)),p=new Set;for(let e of c){let t=new Set([e.operationId]),n=[],r=cZ(e),i=!1;for(;r;){if(t.has(r)){i=!0;break}t.add(r);let e=d.get(r);if(!e)break;n.push(r),r=cZ(e)}if(!i){for(let e of n)p.add(e);continue}let a=[e.operationId,...n].map(e=>d.get(e)).filter(e=>!!e).filter(e=>u.has(e.operationId));if(1===a.length&&a[0].operationId===e.operationId)for(let e of n)p.add(e)}return c.filter(e=>!p.has(e.operationId)).sort((e,t)=>Date.parse(t.at)-Date.parse(e.at)||t.revision-e.revision||e.operationId.localeCompare(t.operationId)||e.idempotencyKey.localeCompare(t.idempotencyKey))}((d=e.path,sZ(e=>{if(!e.enabled||!d&&!v)return sX;let t=s3(e.store.sessions,v,d);return t?.recentReceipts??sX},sX)),ei);(0,Y.useEffect)(()=>{for(let e of ev)ra(e.status)&&eg.current(e.idempotencyKey)},[ev]);let ew=(u=y?.session.liveTurn?.turnId)?[...ev].sort(o5).find(e=>o2(e)&&(e.turnId===u||e.operationId===u))??null:null,ey=ew?.idempotencyKey;(0,Y.useEffect)(()=>{ey&&function(e,t,n){let r=l8(e),i=r.find(e=>e.id===t);if(!i||void 0!==i.responseStartedAt)return;let a=r.map(e=>e.id===t?{...e,state:"delivered",settledAt:e.settledAt??n,responseStartedAt:n}:e),s=a.find(e=>e.id===t);s&&lQ(e,s,n),l5(e,a)}(v,ey,dl())},[v,ey]);let ek=(0,Y.useRef)(ev);(0,Y.useLayoutEffect)(()=>{ek.current=ev},[ev]);let ej=(0,Y.useRef)(new Map),eN=(0,Y.useRef)({cardId:v,active:!0});(0,Y.useLayoutEffect)(()=>{let e={cardId:v,active:!0};return eN.current=e,()=>{e.active=!1}},[v]);let eS=new Set(ed),eC=e=>{let t;if(!e.length)return;let n=(t=new Set(e),[...ed.filter(e=>!t.has(e)),...e].slice(-64));eu(n);try{n.length?sessionStorage.setItem(o6(v),JSON.stringify(n)):sessionStorage.removeItem(o6(v))}catch{}},eA=new Set(ee.filter(e=>void 0!==e.responseStartedAt).map(e=>e.id));ey&&eA.add(ey);let eI=function(e,t,n,r,i=o4,a=o3){let s=new Set,l=[];for(let t of e.filter(e=>o2(e)&&!!e.text).sort(o5))s.has(t.idempotencyKey)||(s.add(t.idempotencyKey),l.push(t));let o=new Map(i),c=new Set;for(let e of[...l].reverse()){if(!o1(e.status)||"interrupted"===e.status||n.has(e.operationId))continue;let t=e.text?.trim();t&&function(e,t){let n=e.trim();for(let[e,r]of t){if(r<=0)continue;let i=e.trim();if(i===n||240===n.length&&i.startsWith(n))return t.set(e,r-1),!0}return!1}(t,o)&&c.add(e.operationId)}let d=[];for(let e of l){if(!o1(e.status)||"interrupted"===e.status||n.has(e.operationId)||a.has(e.idempotencyKey)||c.has(e.operationId))continue;let i=Date.parse(e.at);Number.isFinite(i)&&!(t>=i+2e3)&&(r-i>=6e5||d.push(e))}return d}(ev,1e3*e.mtime,eS,dl(),et,eA),eM=e=>{em.current=e,ec(e.some(e=>!1!==e.payloadComplete));try{e.length?sessionStorage.setItem(c5(v),JSON.stringify(e.map(({key:e,text:t,images:n,runtime:r,runtimeCaptured:i,reconciling:a,payloadComplete:s,operationId:l})=>({key:e,text:t,images:n.map(({id:e,base64:t,mime:n})=>({...e?{id:e}:{},base64:t,mime:n})),...r?{runtime:r}:{},...i?{runtimeCaptured:!0}:{},...a?{reconciling:!0}:{},...!1===s?{payloadComplete:!1}:{},...l?{operationId:l}:{}})))):sessionStorage.removeItem(c5(v))}catch{try{sessionStorage.setItem(c5(v),JSON.stringify(e.map(({key:e,text:t,runtime:n,runtimeCaptured:r,reconciling:i,operationId:a})=>({key:e,text:t,...n?{runtime:n}:{},...r?{runtimeCaptured:!0}:{},...i?{reconciling:!0}:{},...a?{operationId:a}:{},payloadComplete:!1}))))}catch{}}},eT=e=>{let t=ef.current;for(t.delete(e),t.add(e);t.size>32;){let e=t.values().next().value;if(void 0===e)break;t.delete(e)}},eP=(e,t)=>{let n=ej.current.get(e);n&&(n.abort(),ej.current.delete(e),H(null),rn(t.status)&&!ra(t.status)&&(eM(em.current.map(t=>t.key===e?c8(t):t)),ep.current===e&&(ep.current=rs())),el(ej.current.size>0))},e$=(e,t)=>{if(ej.current.has(e))return;let n=new AbortController;ej.current.set(e,n),el(!0),om({read:()=>ek.current.find(t=>t.idempotencyKey===e&&(ra(t.status)||rn(t.status)))??null,refresh:s7,late:t,timeoutMs:3e4,pollIntervalMs:1e3,signal:n.signal}).then(t=>{if(!n.signal.aborted){if(null===t){let t;return void(ej.current.delete(e),eM(em.current.map(t=>t.key===e?c8(t):t)),(t=em.current.find(t=>t.key===e))&&(el(ej.current.size>0||!1===t.payloadComplete),H({kind:"err",text:b("composer.deliveryUnconfirmed")}),er.current.has(e)&&l9(v,e,{state:"failed",settledAt:dl(),error:b("composer.deliveryUnconfirmed")}),ea(n=>{var r;return[(r=t.text,{operationId:c7(e),idempotencyKey:e,conversationId:v,kind:"send",status:"uncertain",text:r,at:new Date().toISOString(),revision:0}),...n.filter(t=>t.idempotencyKey!==e&&t.operationId!==c7(e))].slice(0,8)})))}ea(e=>[t,...e.filter(e=>e.operationId!==t.operationId)].slice(0,8))}})};(0,Y.useEffect)(()=>()=>{for(let e of ej.current.values())e.abort();ej.current.clear()},[]),(0,Y.useEffect)(()=>{for(let t of(dn(e.path,v),ot(e.path,v),Z(function(e){try{let t=JSON.parse(sessionStorage.getItem(cX(e))??"[]");return Array.isArray(t)?t:[]}catch{return[]}}(v)),ea([]),eu(function(e){try{let t=JSON.parse(sessionStorage.getItem(o6(e))??"[]");if(!Array.isArray(t))return[];return t.filter(e=>"string"==typeof e).slice(-64)}catch{return[]}}(v)),ej.current.values()))t.abort();ej.current.clear();let t=c6(v);em.current=t,ec(t.some(e=>!1!==e.payloadComplete)),eb.current=new Map;let n=sessionStorage.getItem(de(v))??"",r=t.find(e=>!1!==e.payloadComplete),i=function(e){try{let t=sessionStorage.getItem(c4(e));return null===t?null:c3(JSON.parse(t))}catch{return null}}(v);G.current=!1;let a=i??(r?.text===n?r.images:[]),s=J.replace(a.map(e=>({...e})));queueMicrotask(()=>{G.current=!0}),r&&s&&r.runtimeCaptured&&eb.current.set(r.key,r.runtime);let l=t.filter(e=>e.reconciling).map(e=>e.key),o=t.some(e=>!1===e.payloadComplete);for(let e of(el(l.length>0||o),(l.length||o)&&H({kind:"err",text:b("composer.admissionTimedOut")}),l))e$(e);ef.current=new Set},[v]),(0,Y.useEffect)(()=>{G.current&&function(e,t,n){try{if(!t.length&&!n)return void sessionStorage.removeItem(c4(e));sessionStorage.setItem(c4(e),JSON.stringify(t.map(({id:e,base64:t,mime:n})=>({...e?{id:e}:{},base64:t,mime:n}))))}catch{}}(v,J.images,em.current.length>0)},[J.images,v]),(0,Y.useEffect)(()=>{var e;for(let[e]of ej.current){let t=ev.find(t=>t.idempotencyKey===e&&(ra(t.status)||rn(t.status)));t&&eP(e,t)}for(let e of em.current)!ej.current.has(e.key)&&ep.current===e.key&&ev.find(t=>t.idempotencyKey===e.key&&rn(t.status)&&!ra(t.status))&&(ep.current=rs());if(!em.current.length)return;let t=(e=em.current,e.map(e=>{let t=ev.find(t=>!!e.operationId&&cZ(t)===e.operationId)??ev.find(t=>t.operationId===e.operationId)??ev.find(t=>t.idempotencyKey===e.key);return t&&t.operationId!==e.operationId?{...e,operationId:t.operationId}:e}));t.some((e,t)=>e!==em.current[t])&&eM(t);let{settled:n,remaining:r}=function(e,t){let n=new Map,r=new Map;for(let e of t){if(!ra(e.status))continue;let t=r.get(e.operationId);t&&("delivered"!==e.status||"delivered"===t.status)||r.set(e.operationId,e);let i=n.get(e.idempotencyKey);i&&("delivered"!==e.status||"delivered"===i.status)||n.set(e.idempotencyKey,e)}let i=[],a=[];for(let t of e){let e=n.get(t.key)??(t.operationId?r.get(t.operationId):void 0);if(!e){a.push(t);continue}let s="delivered"===e.status&&"string"==typeof e.text&&e.text?e.text:t.text;i.push({entry:t,text:s})}return{settled:i,remaining:a}}(em.current,ev),i=r.some(e=>!1===e.payloadComplete&&!ev.some(t=>(t.idempotencyKey===e.key||t.operationId===e.operationId)&&rn(t.status)));if(el(ej.current.size>0||i),n.length)for(let e of(eM(r),n)){if(eT(e.entry.key),er.current.has(e.entry.key)){let t=ev.find(t=>t.idempotencyKey===e.entry.key&&ra(t.status)),n=t?lP(t.status):"delivered";l9(v,e.entry.key,{state:n,settledAt:dl()})}else{let t=c2(_.current,e.text);t!==_.current&&F(t)}J.settleDelivered(e.entry.images),e.entry.key===ep.current&&(ep.current=rs())}},[ev,v]),(0,Y.useEffect)(()=>{for(let e of ee){if(e.launchOwned||"delivered"===e.state)continue;let t=ev.find(t=>t.idempotencyKey===e.id&&(ra(t.status)||rn(t.status)));if(!t)continue;let n=lP(t.status);n!==e.state&&("failed"!==e.state||"delivered"===n||"delivering"===n&&ra(t.status))&&l9(v,e.id,{state:n,settledAt:dl()})}},[ev,ee,v]);let eE=(0,Y.useRef)({card:v,ids:new Set});(0,Y.useEffect)(()=>{var e;let t,n,r;if(eE.current.card!==v&&(eE.current={card:v,ids:new Set}),E)return void eE.current.ids.clear();for(let i of(e=eE.current.ids,t=l8(v),n=[],r=t.map(t=>{if(!t.heldForSwitch||"delivering"!==t.state||t.retiredEchoId||void 0!==t.responseStartedAt||e?.has(t.id))return t;n.push(t.id);let r={...t,state:"queued"};return delete r.heldForSwitch,r}),n.length&&l5(v,r),n))eE.current.ids.add(i),ef.current.delete(i)},[E,v,ee]),(0,Y.useEffect)(()=>{let e=e=>{if(e.detail?.path!==v)return;let t=sessionStorage.getItem(de(v))??"";_.current=t,q(t),requestAnimationFrame(()=>{let e=z.current;e&&(e.focus(),e.setSelectionRange(e.value.length,e.value.length))})};return window.addEventListener(dt,e),()=>window.removeEventListener(dt,e)},[v,z,q,_]),(0,Y.useEffect)(()=>{let t=()=>Z(t=>{let n=t.filter(t=>"held"===t.state||"queued"===t.state||"recovering"===t.state||"failed"===t.state||("pane"===t.via?1e3*e.mtime<t.at+2e3&&Date.now()-t.at<6e5:Date.now()-t.at<9e4));return n.length!==t.length&&sessionStorage.setItem(cX(v),JSON.stringify(n)),n.length!==t.length?n:t});t();let n=setInterval(t,5e3);return()=>clearInterval(n)},[e.mtime,v]);let eR=(f=(0,Y.useSyncExternalStore)(ip.subscribe,ip.getContext,()=>is),h=(0,Y.useSyncExternalStore)(ip.subscribe,ip.getSlice,()=>il),x=(0,Y.useSyncExternalStore)(ip.subscribe,ip.getCards,()=>ss),(0,Y.useMemo)(()=>(0,si.P3)({context:f,slice:h,cards:x}),[f,h,x]));if("hidden"===w.controls.send.state)return null;let eO=c9(e);if(null===R&&!eO)return null;let eD="unresolved"===w.surface,eL=r??(eD?b("strip.resolving"):null),e_=null===R&&!y&&!eD,eF=e_&&"claude-projects"===e.root&&"subagent"===e.kind,eq=e=>{Z(e),sessionStorage.setItem(cX(v),JSON.stringify(e))},ez=(e,t)=>{var r;let i,a,s,l,o=t?.preserveDraft??!1,c=e??_.current,d=o?[]:J.imagesRef.current.map(e=>({...e}));if(V||es||!c.trim()&&!d.length)return;if(n&&!y)return void H({kind:"err",text:b("deadHost.sendBlocked")});if(y&&M&&d.length)return void H({kind:"err",text:T});if(eL)return void H({kind:"err",text:eL});if(y&&d.length&&!J.validate())return;let u=rs();en.current.set(u,d),er.current.add(u),r={id:u,text:c,images:d.length,at:dl(),echoBaseline:((i=or.get(v))||(i=os(lX(v)),or.set(v,i)),i.get(on(c))??0)},a=on(r.echoText??r.text),s=r.echoBaselineIds??lX(v).filter(e=>e.key===a).map(e=>e.id),l={...r,echoBaseline:r.echoBaseline??s.length,...s.length?{echoBaselineIds:s}:{},state:"queued"},l6(v,[...l8(v).filter(e=>e.id!==r.id),l]),o||(F(""),J.clearAll()),H(null),z.current?.focus()},eH=async(t,r,i)=>{var a,s,l;let o=t??L,c=(i?en.current.get(i)??[]:J.imagesRef.current).map(e=>({...e})),d=(e,t,n)=>{i&&(l9(v,i,{state:e,settledAt:dl(),...t?{error:t}:{},...n?{heldForSwitch:!0}:{}}),"delivered"===e&&en.current.delete(i))},u=e=>(ra(e.status)&&ex(p),d(lP(e.status),void 0,"queued"===e.status)),p=(a=ep.current,r?.clientMessageId||a),m=em.current.find(e=>e.key===p),f=m?.selectedContext??sa(),h=m?null:await D(),x=m||!await cE(v,e.project)?"":(s={path:e.path,project:e.project},function(e,t,n){let r=t.focusedPath&&t.focusedPath!==n.path?t.focusedPath:null,i=t.selectedPaths.filter(e=>e!==n.path&&e!==r);if(!(e.project&&e.project!==n.project)&&!r&&0===i.length)return"";let a=[];if(e.project&&a.push(`project ${e.project}`),r&&a.push(`focused conversation ${r}`),i.length>0){let e=i.slice(0,6),t=i.length-e.length;a.push(`selected ${e.join(", ")}${t>0?` (+${t} more)`:""}`)}return`[viewer context — the operator is looking at: ${a.join("; ")}]`}(ip.getContext(),ip.getSlice(),s)),g=x?`${x}
|
|
3
|
-
${o}`:o,w=m?.text??(h?.text?`${h.text}
|
|
4
|
-
|
|
5
|
-
${g}`:g),k=m?m.images.map(e=>({...e})):c;if(!w.trim()&&!k.length){i&&oe(v,i);return}if(B||V||es){i&&l9(v,i,{state:"queued"});return}if(i&&w!==o&&function(e,t,n){let r=l8(e),i=r.find(e=>e.id===t);if(!i||i.retiredEchoId)return;let a=on(n);if(!a||on(i.echoText??i.text)===a)return;let s=lX(e).filter(e=>e.key===a).map(e=>e.id);l5(e,r.map(e=>{if(e.id!==t)return e;let r={...e,echoText:n,echoBaseline:s.length};return s.length?r.echoBaselineIds=s:delete r.echoBaselineIds,r}))}(v,i,w),n&&!y){H({kind:"err",text:b("deadHost.sendBlocked")}),d("failed",b("deadHost.sendBlocked"));return}if(y&&M&&k.length){H({kind:"err",text:T}),d("failed",T);return}if(eL){H({kind:"err",text:eL}),d("failed",eL);return}if(y&&k.length&&!J.validate())return;K(!0),H(n?{kind:"info",text:b("composer.receiptRecovering")}:null);let j=e_&&!eF,N=!!y||j;if(N&&!eb.current.has(p)){let t;for(eb.current.set(p,m?.runtimeCaptured?m.runtime:y?function(e){let t=oL(e);if(!t)return;let n=e.engine,r={};return t.model&&(r.model=t.model),t.effort&&(r.effort=t.effort),"codex"===n&&"boolean"==typeof t.fast&&(r.fast=t.fast),Object.keys(r).length?r:void 0}(e):(t=oD(e))?{...t.model?{model:t.model}:{},...t.effort?{effort:t.effort}:{},..."codex"===e.engine?{fast:t.fast}:{}}:{});eb.current.size>32;){let e=eb.current.keys().next().value;if(void 0===e)break;eb.current.delete(e)}}let S=eb.current.get(p),C=!(y&&M&&k.length>0),A=C&&!ef.current.has(p)&&!em.current.some(e=>e.key===p);A&&eM([{key:p,text:w,images:k,...S?{runtime:S}:{},selectedContext:f,...N?{runtimeCaptured:!0}:{}},...em.current].slice(0,8));let I=(e,t)=>{ef.current.has(p)||(eT(p),i||F(c2(_.current,e)),J.settleDelivered(t))},$=e=>{if(ef.current.has(p))return;let t=k.length,n="held"===e.outcome||"queued"===e.outcome||"recovering"===e.outcome,a=dl(),s={id:a,text:w.trim()||(t?b("composer.imagesCount",{count:t}):""),at:a,via:"resumed"===e.outcome||e.spawned?"spawn":"pane",state:n?e.outcome:"sent",clientMessageId:p},l=!i||!n;l&&eq([...r?X.filter(e=>e.id!==r.receiptId):X,s].slice(-8));let o=em.current.find(e=>e.key===p);if(eM(em.current.filter(e=>e.key!==p)),ea(e=>e.filter(e=>e.idempotencyKey!==p&&e.operationId!==c7(p))),ep.current===p&&(ep.current=rs()),I(w,o?.images??k),d(n?"delivering":"delivered",void 0,n),l){let t=lp(lc(P)),r=ld(P);H({kind:n?"info":"ok",text:n?t?r?b("composer.deliveryHeld",{label:r}):b("composer.deliveryHeldUnnamed"):b("composer.deliveryHeldWaiting"):"resumed"===e.outcome||e.spawned?b("composer.spawned",{target:e.target??""}):e.imagePaths?.length?b("composer.sentPaths",{count:e.imagePaths.length}):b("common.sent")})}i||z.current?.focus()},E=eN.current,R=null;try{R=Promise.resolve(y?C?(l={conversationId:y.session.conversationId,text:w.trim(),images:k.map(e=>({base64:e.base64,mime:e.mime})),idempotencyKey:p,policy:"interrupt-active",...S?{runtime:S}:{},selectedContext:f},s8("/api/runtime/send",{conversationId:l.conversationId,text:l.text,images:l.images,idempotencyKey:l.idempotencyKey,policy:l.policy??"interrupt-active",...l.runtime?{runtime:l.runtime}:{},...l.selectedContext?{selectedContext:l.selectedContext}:{}})).then(e=>({ok:e.ok,structured:!0,error:e.error,status:e.status,receipt:e.receipt,outcome:e.receipt?.status==="delivering"||e.receipt?.status==="delivered"?e.receipt.status:"queued"})):{ok:!1,structured:!0,error:T}:fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({pid:e.pid??void 0,path:e.path,text:w,idempotencyKey:p,clientMessageId:p,images:k.map(e=>({base64:e.base64,mime:e.mime})),origin:{kind:"operator"},...j?S??{}:{}})}).then(async e=>{let t=await e.json();return{...t,status:e.status,ok:e.ok&&!0===t.ok}}));let t=await function(e,t=15e3){let n;return Promise.race([e,new Promise((e,r)=>{n=setTimeout(()=>r(new op),t)})]).finally(()=>{void 0!==n&&clearTimeout(n)})}(R,15e3);if(h?.ackToken&&aF(p,h.ackToken),t.ok&&(!t.structured||t.receipt&&ra(t.receipt.status))?ex(p):t.ok||aH(p),!t.ok){if(t.structured&&t.receipt){let e=("send"===t.receipt.kind||"steer"===t.receipt.kind)&&!t.receipt.text&&w.trim()?{...t.receipt,text:w.trim()}:t.receipt;if(ea(t=>[e,...t.filter(t=>t.operationId!==e.operationId)].slice(0,8)),ra(e.status)){let n=em.current.find(e=>e.key===p);eM(em.current.filter(e=>e.key!==p));let r="delivered"===e.status&&"string"==typeof t.receipt.text&&t.receipt.text?t.receipt.text:n?.text??w;I(r,n?.images??k),u(e),ep.current===p&&(ep.current=rs()),"delivered"===e.status&&H({kind:"ok",text:b("common.sent")}),i||z.current?.focus();return}rn(e.status)&&ep.current===p&&(ep.current=rs())}if(ef.current.has(p))return;!(!rn(t.receipt?.status??"pending")&&(void 0===t.status||t.status>=500))&&A&&eM(em.current.filter(e=>e.key!==p)),d("failed",t.error??b("common.failedSend")),H({kind:"err",text:t.error??b("common.failedSend")});return}if(t.structured&&t.receipt){ea(e=>[t.receipt,...e.filter(e=>e.operationId!==t.receipt.operationId)].slice(0,8));let e=em.current.find(e=>e.key===p);eM(em.current.filter(e=>e.key!==p)),ep.current===p&&(ep.current=rs()),I(w,e?.images??k),u(t.receipt),i||z.current?.focus();return}$(t)}catch(e){if(!ef.current.has(p)&&(H({kind:"err",text:e instanceof op?b("composer.admissionTimedOut"):b("common.serverUnavailable")}),e instanceof op||d("failed",b("common.serverUnavailable")),e instanceof op)){eM(em.current.map(e=>e.key===p?{...e,reconciling:!0}:e));let e=R?.then(e=>{let t=e.receipt;if(t&&(ra(t.status)||rn(t.status)))return("send"===t.kind||"steer"===t.kind)&&!t.text&&w.trim()?{...t,text:w.trim()}:t;if(!e.ok||e.structured||!E.active||eN.current!==E)return null;let n=ej.current.get(p);return $(e),n?.abort(),ej.current.delete(p),el(ej.current.size>0),null});e$(p,e)}}finally{K(!1)}},eU=async e=>{if(!B&&!V){K(!0),H(null);try{let t=await fetch(`/api/runtime/operations/${encodeURIComponent(e.operationId)}`,{method:"POST"}),n=await t.json().catch(()=>({}));if(!t.ok||!n.receipt)return void H({kind:"err",text:n.error??b("common.failedSend")});ea(e=>[n.receipt,...e.filter(e=>e.operationId!==n.receipt.operationId)].slice(0,8))}catch{H({kind:"err",text:b("common.serverUnavailable")})}finally{K(!1)}}},eB=e=>{e.preventDefault(),ez()},eK=n&&!y,eY=eK||es||!!eL,eW=(g=[...ee.filter(e=>"queued"===e.state||"delivering"===e.state),...ee.filter(e=>"delivered"===e.state||"failed"===e.state)].sort((e,t)=>t.at-e.at).map(e=>e.text).filter(e=>e.trim().length>0)).filter((e,t)=>e!==g[t-1]),eV=B||V||J.images.length>0,eJ=y?b("composer.sendStructuredAria"):eD?b("composer.resolvingAria"):e_?b("composer.spawnAria"):b("composer.sendAria",{target:R??""}),eG=(0,U.jsx)(lC,{composer:O,placeholder:i??(eD?b("composer.placeholderResolving"):eF?b("composer.placeholderRelay"):e_?b("composer.placeholderSpawn"):b("composer.placeholderSend")),textareaAriaLabel:b("composer.textAria"),imageAriaLabel:b("composer.addImages"),sendLabelIdle:e_?b("composer.launchAgent"):b("composer.sendToAgent"),sendLabelRecording:b("composer.stopAndSend"),sendTitleRecording:b("composer.stopAndSendTitle"),sendIdleClassName:"border-accent bg-accent hover:opacity-90",sendMenuLabel:b("composer.sendMenuTitle"),history:eW,voiceControl:k?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(cp,{phase:N.phase,start:N.start,stop:N.stop,t:b}),(0,U.jsx)(cM,{phase:N.phase,t:b})]}):void 0,voicePanel:k&&!S?(0,U.jsx)("div",{ref:C,"data-testid":"voice-dock-slot",className:"flex flex-col"}):void 0,sendMenuActions:e_&&!eF||eY?[]:[{id:"quick-ack",label:b("composer.quickAckLabel"),description:b("composer.quickAck"),disabled:eV,tone:"ok",onSelect:()=>ez(b("composer.quickAck"),{preserveDraft:!0})}],showImage:!eK,imageDisabled:M,imageDisabledReason:T,sendPayloadAvailable:eo,sendDisabledReason:eK?b("deadHost.sendBlocked"):es?b("composer.admissionTimedOut"):eL??void 0,onSendBlockedRecover:()=>void s7(),receipts:ev.length?(0,U.jsx)(c1,{receipts:ev,actionsDisabled:B||V||eK,dismissed:eS,onRetry:e=>void eU(e),onEdit:e=>{B||V||!e.text||(ep.current=rs(),F(e.text),H(null),requestAnimationFrame(()=>{z.current?.focus(),z.current?.setSelectionRange(e.text.length,e.text.length)}))},onDismiss:eC}):void 0,leftSlot:"hidden"!==w.controls.runtime.state?(0,U.jsx)(oK,{file:e,surface:w.surface,runtimeSettings:y?.session.capabilities?.runtimeSettings??null,runtimeSession:y?.session??null}):null}),eQ=(0,U.jsxs)("form",{onSubmit:eB,"data-testid":Q?"bounded-mobile-composer":void 0,className:`flex shrink-0 flex-col gap-1.5 border-t border-border bg-card px-2.5 ${Q?"max-h-[min(38dvh,20rem)] overflow-x-clip overflow-y-auto overscroll-y-contain py-1.5":"py-2"}`,"aria-label":eJ,children:[(0,U.jsx)(di,{claimKeys:[v,e.path]}),(0,U.jsx)(ou,{entries:ee,ready:!B&&!V&&!es,onDispatch:e=>{l9(v,e.id,{state:"delivering"}),er.current.add(e.id),eH(e.text,{clientMessageId:e.id},e.id)}}),"selected"===eR.state?(0,U.jsx)("div",{className:"flex justify-end",children:(0,U.jsx)(lI,{reference:eR})}):null,$?(0,U.jsxs)("div",{role:"status","aria-live":"polite",className:"flex items-center gap-1.5 rounded-control border border-warning/45 bg-warning-soft px-2 py-1 text-label font-semibold text-warning",children:[(0,U.jsx)(sx.eW,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),(0,U.jsx)("span",{className:"min-w-0 truncate",children:b("migrate.heldSend")})]}):null,X.length||eI.length?(0,U.jsxs)("div",{className:"flex flex-col gap-0.5","aria-label":b("composer.queueAria"),children:[eI.map(e=>(0,U.jsxs)("div",{"data-delivery-echo":!0,className:"flex items-center justify-end gap-1.5",children:[(0,U.jsx)(sx.Jl,{className:"h-3 w-3 shrink-0 text-success","aria-hidden":!0}),(0,U.jsx)("span",{className:"sr-only",children:b("composer.deliveredEcho")}),(0,U.jsx)("span",{className:"min-w-0 max-w-[85%] truncate text-label text-secondary",title:e.text??void 0,children:e.text}),(0,U.jsx)("span",{className:"inline-flex shrink-0 items-center gap-0.5 text-caption tabular-nums text-muted",children:ds(Date.parse(e.at))}),(0,U.jsx)("button",{type:"button","aria-label":b("runtime.receipt.dismiss"),className:`inline-flex shrink-0 items-center justify-center rounded text-muted hover:text-danger focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${Q?"h-11 w-11":"px-0.5"}`,onClick:()=>eC([e.operationId]),children:(0,U.jsx)(sx.X,{className:Q?"h-4 w-4":"h-3 w-3","aria-hidden":!0})})]},e.operationId)),X.map(e=>{let t=function(e,t){switch(t){case"held":return{label:e("composer.receiptHeld"),tone:"warning"};case"queued":return{label:e("composer.receiptQueued"),tone:"warning"};case"recovering":return{label:e("composer.receiptRecovering"),tone:"warning"};case"failed":return{label:e("composer.receiptFailed"),tone:"danger"};default:return null}}(b,e.state);return(0,U.jsxs)("div",{className:"flex items-center justify-end gap-1.5",children:[t?(0,U.jsx)(sv,{tone:t.tone,role:"status","aria-live":"polite",children:t.label}):null,"failed"===e.state?(0,U.jsx)("button",{type:"button","aria-label":b("composer.retrySend"),title:b("composer.retrySend"),disabled:B||V,className:`inline-flex shrink-0 items-center justify-center rounded text-muted hover:text-accent disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${Q?"h-11 w-11":"px-0.5"}`,onClick:()=>{eH(e.text,{receiptId:e.id,clientMessageId:e.clientMessageId})},children:(0,U.jsx)(sg.A,{className:Q?"h-4 w-4":"h-3 w-3","aria-hidden":!0})}):null,(0,U.jsx)("span",{className:"min-w-0 max-w-[85%] truncate text-label text-secondary",title:e.text,children:e.text}),(0,U.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-0.5 text-caption tabular-nums text-muted",children:["spawn"===e.via?(0,U.jsx)(sx.jG,{className:"h-2.5 w-2.5","aria-hidden":!0}):(0,U.jsx)(sx.Qp,{className:"h-2.5 w-2.5","aria-hidden":!0}),ds(e.at)]}),(0,U.jsx)("button",{type:"button","aria-label":b("composer.removeFromQueue"),className:`inline-flex shrink-0 items-center justify-center rounded text-muted hover:text-danger focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${Q?"h-11 w-11":"px-0.5"}`,onClick:()=>eq(X.filter(t=>t.id!==e.id)),children:(0,U.jsx)(sx.X,{className:Q?"h-4 w-4":"h-3 w-3","aria-hidden":!0})})]},e.id)})]}):null,S?(0,nx.createPortal)((0,U.jsx)("form",{onSubmit:eB,"aria-label":eJ,className:"flex flex-col gap-1.5",children:eG}),S):eG]});return void 0===a?eQ:a?(0,nx.createPortal)(eQ,a):(0,U.jsx)("div",{hidden:!0,"data-testid":"voice-composer-parked",children:eQ})}function dp(){(0,Y.useSyncExternalStore)(cq,cJ,cG);let e=(0,Y.useSyncExternalStore)(a9,st,sn);(0,Y.useEffect)(()=>(cK+=1,c_(),()=>{cK-=1,c_()}),[]);let t=new Set([...cH.keys()]);return e&&t.add(e.conversationId),(0,Y.useEffect)(()=>{for(let e of[...cU.keys()])!t.has(e)&&(cU.delete(e)||cB.delete(e))&&c_()}),(0,U.jsx)(U.Fragment,{children:[...t].map(e=>{let t,n=cU.get(e)??null;return n?(0,U.jsx)(du,{file:n.file,pollPaused:n.pollPaused,deadHost:n.deadHost,sendBlockedReason:n.sendBlockedReason,placeholder:n.placeholder,dockNode:(t=cH.get(e),t?.length?(t.findLast(e=>e.primary)??t[t.length-1]).node:null)},e):null})})}function dm({mobile:e,resolveClient:t=sf}){var n;let{t:r}=(0,eh.Ym)(),i=(0,Y.useSyncExternalStore)(a9,se,sr),{supported:a,pipWindow:s,open:l,close:o}=function(){let[e,t]=(0,Y.useState)(null),n=cC(),r=(0,Y.useCallback)(async()=>{let n,r=cS();if(r&&!e){try{n=await r.requestWindow({...cN})}catch{return}cI(n),t(n)}},[e]),i=(0,Y.useCallback)(()=>{e?.close(),t(null)},[e]);return(0,Y.useEffect)(()=>{if(!e)return;let n=()=>t(null);e.addEventListener("pagehide",n);let r=function(e){if("u"<typeof MutationObserver)return()=>void 0;let t=!1,n=()=>{t||(t=!0,setTimeout(()=>{t=!1,e.closed||cI(e)},0))},r=new MutationObserver(n);r.observe(document.head,{childList:!0,subtree:!0,characterData:!0});let i=new MutationObserver(n);i.observe(document.documentElement,{attributes:!0,attributeFilter:["class","lang","dir"]});let a=new MutationObserver(n);return a.observe(document.body,{attributes:!0,attributeFilter:["class"]}),()=>{r.disconnect(),i.disconnect(),a.disconnect()}}(e);return()=>{r(),e.removeEventListener("pagehide",n)}},[e]),{supported:n,pipWindow:e,open:r,close:i}}(),c=i?.conversationId??null,d=(0,Y.useMemo)(()=>c?t(c):null,[c,t]),u=(0,Y.useSyncExternalStore)(d?.subscribe??df,d?.getSnapshot??dx,dx);!function(e,t=null){let n=(0,Y.useRef)(Symbol("realtime-ambient-owner"));(0,Y.useEffect)(()=>{let t=n.current;return no(t,e),()=>no(t,!1)},[e]),(0,Y.useEffect)(()=>{let r=n.current;return nu(r,e?t:null),()=>nu(r,null)},[e,t])}(n="live"===u.phase,function(e,t){let[n,r]=(0,Y.useState)(e),[i,a]=(0,Y.useState)(sG);return n!==e&&(r(e),a(e?new Set(t.map(e=>e.id)):sG)),(0,Y.useMemo)(()=>e?function(e){for(let t=e.length-1;t>=0;t-=1){let n=e[t];if(n&&"progress"!==n.role){if(n.final)return null;return"user"===n.role?"operator":"agent"}}return null}(t.filter(e=>!i.has(e.id))):null,[i,t,e])}(n,u.lines));let p=i?.phase??"idle",m="connecting"===p||"live"===p;(0,Y.useEffect)(()=>{"idle"===p&&s&&o()},[o,p,s]);let f=(0,Y.useSyncExternalStore)(cy,ck,cj),h=(0,Y.useRef)(f);(0,Y.useEffect)(()=>{f===h.current||(h.current=f,!e&&a&&m&&!s&&l())},[m,f,e,l,s,a]);let x=(0,Y.useSyncExternalStore)(cq,()=>c?cR.get(c)??null:null,cz),g=(0,Y.useCallback)(e=>{if(e&&c)return cF(cO,c,e)},[c]);if(!d||!c)return null;let b=(0,U.jsx)(cg,{phase:u.phase,lines:u.lines,error:u.error,startedAt:u.startedAt,stream:d.micStream(),micMuted:u.micMuted,outputMuted:u.outputMuted,onToggleMic:()=>d.toggleMic(),onToggleOutput:()=>d.toggleOutput(),onRetry:()=>void d.start(),t:r});return s&&!e?(0,nx.createPortal)((0,U.jsxs)("div",{"data-testid":"voice-pip-chrome",className:"flex h-full w-full flex-col gap-2 overflow-y-auto bg-canvas p-2 text-primary",children:[(0,U.jsxs)("header",{className:"flex shrink-0 items-center gap-1.5",children:[(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate text-caption uppercase tracking-wide text-muted",children:r("voice.floatSurface")}),(0,U.jsx)("button",{type:"button","data-testid":"voice-float-dock","aria-label":r("voice.dock"),title:r("voice.dock"),onClick:o,className:"inline-flex min-h-7 min-w-7 items-center justify-center rounded-control border border-border px-1.5 text-muted hover:bg-sunken hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:(0,U.jsx)(cb.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),(0,U.jsx)("div",{className:"min-h-0 shrink-0",children:b}),(0,U.jsx)("div",{"data-testid":"voice-pip-composer-slot",ref:g,className:"flex shrink-0 flex-col gap-1.5"})]}),s.document.body):x?(0,nx.createPortal)(b,x):null}let df=()=>()=>void 0,dh={phase:"idle",lines:[],error:null,startedAt:null,micMuted:!1,outputMuted:!1},dx=()=>dh,dg={live:{badge:"success",dot:"bg-success",pulse:!0},reconnecting:{badge:"warning",dot:"bg-warning",pulse:!0},degraded:{badge:"warning",dot:"bg-warning",pulse:!1},offline:{badge:"danger",dot:"bg-danger",pulse:!1}},db={live:"runtime.announce.live",reconnecting:"runtime.announce.reconnecting",degraded:"runtime.announce.degraded",offline:"runtime.announce.offline"};function dv({connection:e,resynced:t,legacy:n,compact:r,announce:i,t:a}){let s=dg[e];return(0,U.jsxs)(sv,{tone:s.badge,"data-connection":e,className:`backdrop-blur ${r?"":"shadow-1"}`,children:[(0,U.jsx)("span",{className:`h-2 w-2 rounded-full ${s.dot} ${s.pulse?"animate-pulse motion-reduce:animate-none":""}`,"aria-hidden":!0}),(0,U.jsx)("span",{children:a(`runtime.${e}`)}),n?(0,U.jsxs)("span",{className:"font-normal text-muted",children:["\xb7 ",a("runtime.legacyProvenance")]}):null,t?(0,U.jsx)("span",{className:"rounded-full bg-accent-soft px-1.5 text-accent",children:a("runtime.resynced")}):null,(0,U.jsx)("span",{role:"status","aria-live":"polite",className:"sr-only",children:i})]})}function dw({connection:e,resynced:t,legacy:n,compact:r,announce:i,t:a}){return r||"live"!==e?(0,U.jsx)("div",{className:r?"pointer-events-auto absolute right-2 top-1.5 z-30":"pointer-events-auto fixed bottom-3 left-3 z-20",children:(0,U.jsx)(dv,{connection:e,resynced:t,legacy:n,compact:r,announce:i,t:a})}):(0,U.jsx)("span",{role:"status","aria-live":"polite",className:"sr-only",children:i})}function dy({legacy:e,compact:t}){let{t:n}=(0,eh.Ym)(),{enabled:r,connection:i,resyncedAt:a}=s0(),s=null!==a,l=function(e,t=600){let[n,r]=(0,Y.useState)(e),i=(0,Y.useRef)(e);return(0,Y.useEffect)(()=>{i.current=e;let n=window.setTimeout(()=>{i.current===e&&r(e)},t);return()=>window.clearTimeout(n)},[e,t]),n}(n(s?"runtime.announce.resynced":db[i]));return r?(0,U.jsx)(dw,{connection:i,resynced:s,legacy:e,compact:t,announce:l,t:n}):null}function dk(e,t){if(0===t.length)return[];let n=new Set(t),r=new Map;for(let t of e){let e=W(t);if(!n.has(e))continue;let i=r.get(e);(!i||t.mtime>i.mtime)&&r.set(e,t)}return[...r.entries()].map(([e,t])=>({id:e,file:t,project:eM(t)})).sort((e,t)=>t.file.mtime-e.file.mtime)}var dj=n(4e3),dN=n(8744);let dS="llvKeepAwake",dC=(0,Y.createContext)(null);function dA({children:e,environment:t}){return(0,U.jsx)(dC.Provider,{value:function(e){let[t,n]=(0,Y.useState)({enabled:!1,status:"off"}),r=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{let t=function(e){let t=new Set,n={enabled:!1,status:"off"},r=null,i=null,a=0,s=-1,l=!1,o=!1,c=null!==e.request&&e.secureContext,d=e=>{let r={...n,...e};if(r.enabled!==n.enabled||r.status!==n.status)for(let e of(n=r,t))e()},u=()=>null===e.request?"unsupported":e.secureContext?n.enabled&&l?"waiting":"off":"insecure",p=()=>{r&&i&&r.removeEventListener("release",i),i=null},m=e=>{a+=1;let t=r;p(),r=null,d({status:e}),t&&Promise.resolve(t.release()).catch(()=>{})},f=t=>{if(t===r){if(p(),r=null,!l||!n.enabled||!e.isVisible())return void d({status:u()});if(!o){o=!0,h();return}d({status:"interrupted"})}};function h(){if(!l||!n.enabled)return;if(!c)return void d({status:u()});if(!e.isVisible())return void d({status:"waiting"});if(r||s===a)return;let t=++a;s=t,d({status:"requesting"}),e.request("screen").then(e=>{(s===t&&(s=-1),t!==a)?Promise.resolve(e.release()).catch(()=>{}):(r=e,i=()=>f(e),e.addEventListener("release",i),!0===e.released)?f(e):d({status:"active"})},e=>{if(s===t&&(s=-1),t===a){let t;d({status:"NotAllowedError"===(t=e?.name)||"SecurityError"===t?"blocked":"failed"})}})}return{getState:()=>n,subscribe:e=>(t.add(e),()=>void t.delete(e)),start(){if(l)return;l=!0;let t=(()=>{try{return e.storage?.getItem(dS)==="1"}catch{return!1}})();d({enabled:t}),d({status:u()}),t&&h()},stop(){l&&(l=!1,m(u()))},setEnabled(t){if(t!==n.enabled){d({enabled:t});try{e.storage?.setItem(dS,t?"1":"0")}catch{}o=!1,t?h():m(u())}},syncVisibility(){if(l){if(e.isVisible()){o=!1,h();return}n.enabled&&m(u())}}}}(e?e():function(){let e=navigator.wakeLock,t=null;try{t=window.localStorage}catch{t=null}return{request:e&&"function"==typeof e.request?t=>e.request(t):null,secureContext:"boolean"!=typeof window.isSecureContext||window.isSecureContext,isVisible:()=>"hidden"!==document.visibilityState,storage:t}}());r.current=t;let i=t.subscribe(()=>n(t.getState())),a=()=>t.syncVisibility();return document.addEventListener("visibilitychange",a),window.addEventListener("pageshow",a),t.start(),()=>{i(),document.removeEventListener("visibilitychange",a),window.removeEventListener("pageshow",a),t.stop(),r.current=null}},[e]);let i=(0,Y.useCallback)(e=>r.current?.setEnabled(e),[]);return{...t,setEnabled:i}}(t),children:e})}function dI({children:e,environment:t}){let n=(0,Y.useContext)(dC),r=ia();return n||!r?(0,U.jsx)(U.Fragment,{children:e}):(0,U.jsx)(dA,{environment:t,children:e})}let dM={unsupported:"keepAwake.unsupported",insecure:"keepAwake.insecure",off:"keepAwake.off",requesting:"keepAwake.requesting",active:"keepAwake.active",waiting:"keepAwake.waiting",interrupted:"keepAwake.interrupted",blocked:"keepAwake.blocked",failed:"keepAwake.failed"},dT=new Set(["unsupported","insecure"]),dP="keep-awake-caption";function d$(){let{t:e}=(0,eh.Ym)(),t=(0,Y.useContext)(dC);if(!t)return null;let{enabled:n,status:r,setEnabled:i}=t,a=dT.has(r),s="off"!==r&&"requesting"!==r&&"active"!==r,l=n&&!a;return(0,U.jsxs)("div",{"data-testid":"keep-awake-row","data-wake-lock-status":r,className:"flex flex-col gap-0.5 px-1.5 py-0.5",children:[(0,U.jsxs)("div",{className:"flex min-h-11 items-center gap-2",children:[(0,U.jsx)("span",{className:"min-w-0 flex-1 text-[13px] font-semibold text-primary",children:e("keepAwake.label")}),(0,U.jsx)("button",{type:"button",role:"switch","aria-checked":l,"aria-label":e(l?"keepAwake.disableAria":"keepAwake.enableAria"),"aria-describedby":dP,title:e(dM[r]),disabled:a,onClick:()=>i(!n),className:`flex h-11 w-11 shrink-0 items-center justify-center rounded-full border bg-card focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:cursor-not-allowed disabled:opacity-45 ${"active"===r?"border-accent/45 text-accent":"border-border text-muted hover:text-primary"}`,children:l?(0,U.jsx)(dj.A,{className:"h-5 w-5","aria-hidden":!0}):(0,U.jsx)(dN.A,{className:"h-5 w-5","aria-hidden":!0})})]}),(0,U.jsx)("span",{id:dP,role:"status",className:`text-[11px] leading-snug ${s?"text-warning":"text-muted"}`,children:e(dM[r])})]})}var dE=n(710),dR=n(2571),dO=n(2749),dD=n(9375);function dL(e,t,n){return t in dD.en?e(t):n}function d_(e,t){return dL(e,`effortTier.${t}`,t)}function dF({roomy:e,className:t,...n}){let r=e?"h-8 min-w-0 rounded-control border border-border bg-card px-2 text-body text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60":"h-7 min-w-0 rounded-control border border-border bg-card px-1.5 text-ui text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60";return(0,U.jsx)("select",{...n,className:t?`${r} ${t}`:r})}function dq({engine:e,model:t,effort:n,speed:r,disabled:i,roomy:a,onModel:s,onEffort:l,onSpeed:o}){let{t:c}=(0,eh.Ym)();return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(dF,{value:t,disabled:i,roomy:a,"aria-label":c("draft.modelAria"),title:c("draft.modelAria"),onChange:e=>s(e.target.value),children:[(0,U.jsx)("option",{value:"",children:c("draft.modelDefault")}),ow[e].map(e=>(0,U.jsx)("option",{value:e.id,children:e.label},e.id))]}),(0,U.jsxs)(dF,{value:n,disabled:i,roomy:a,"aria-label":c("draft.reasoningAria"),title:c("draft.reasoningAria"),onChange:e=>l(e.target.value),children:[(0,U.jsx)("option",{value:"",children:c("draft.effortDefault")}),of.Lw[e].map(e=>(0,U.jsx)("option",{value:e,children:d_(c,e)},e))]}),"codex"===e?(0,U.jsxs)(dF,{value:r,disabled:i,roomy:a,"aria-label":c("draft.speedAria"),title:c("draft.speedTitle"),onChange:e=>o(e.target.value),children:[(0,U.jsx)("option",{value:"",children:c("draft.speedDefault")}),(0,U.jsx)("option",{value:"fast",children:c("draft.speedFast")}),(0,U.jsx)("option",{value:"standard",children:c("draft.speedStandard")})]}):null]})}let dz=[{key:"claude",label:"Claude"},{key:"codex",label:"Codex"}];function dH(e){let t=Array.isArray(e?.accounts)?e.accounts.flatMap(e=>"string"==typeof e.id&&"string"==typeof e.label?[{id:e.id,label:e.label,authPresent:!1!==e.authPresent}]:[]):[];return{active:"string"==typeof e?.active?e.active:"",accounts:t}}function dU(){let[e,t]=(0,Y.useState)(null);return(0,Y.useEffect)(()=>{let e=!1;return fetch("/api/accounts").then(async n=>{if(n.ok&&!e){var r;t((r=await n.json(),{claude:dH(r?.claude),codex:dH(r?.codex)}))}}).catch(()=>{}),()=>{e=!0}},[]),e}function dB(e={}){let t,{storage:n,onEngineChange:r}=e,i=e=>n?.read(e)??"",a=(e,t)=>n?.write(e,t),s=dU(),l=void 0!==e.catalog?e.catalog:s,[o,c]=(0,Y.useState)(()=>{let t=i("engine");return"codex"===t||"claude"===t?t:e.initialEngine??"claude"}),[d,u]=(0,Y.useState)(()=>i("model")||e.initialModel||oy(o)),[p,m]=(0,Y.useState)(()=>i("effort")||e.initialEffort||""),[f,h]=(0,Y.useState)(()=>{let e=i("speed");return"fast"===e||"standard"===e?e:""}),[x,g]=(0,Y.useState)(()=>i("accountId")),b=e=>{u(e),a("model",e)},v=e=>{m(e),a("effort",e)},w=e=>{g(e),a("accountId",e)},y=l?.[o]??null;return{engine:o,model:d,effort:p,speed:f,accountId:x,launchAccountId:(t=l?.[o]??null)?t.accounts.some(e=>e.id===x)?x:t.active:"",catalog:l,accounts:y?.accounts??[],activeAccountId:y?.active??"",setEngine:e=>{r?.(e),c(e),a("engine",e),w(""),b(oy(e)),p&&!(0,of.z9)(e,p)&&v("")},setModel:b,setEffort:v,setSpeed:e=>{h(e),a("speed",e)},setAccountId:w}}function dK({engine:e,disabled:t,roomy:n,onChange:r}){let{t:i}=(0,eh.Ym)();return(0,U.jsx)("div",{className:"flex shrink-0 items-center gap-1",role:"radiogroup","aria-label":i("draft.engineAria"),children:dz.map(({key:i,label:a})=>{let s=e===i,l=(0,tw.t7)(i);return(0,U.jsx)("button",{type:"button",role:"radio","aria-checked":s,disabled:t,onClick:()=>r(i),style:s?{backgroundColor:"var(--color-card)",color:l.color,borderColor:l.color}:void 0,className:`rounded-full border font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60 ${n?"px-3 py-1 text-ui":"px-2 py-0.5 text-[10.5px]"} ${s?"":"border-transparent bg-transparent text-muted hover:text-primary"}`,children:a},i)})})}function dY({draft:e,disabled:t,roomy:n,className:r}){let{t:i}=(0,eh.Ym)();return e.accounts.length?(0,U.jsx)(dF,{value:e.launchAccountId,disabled:t,roomy:n,className:r,onChange:t=>e.setAccountId(t.target.value),"aria-label":i("draft.accountAria",{engine:"codex"===e.engine?"Codex":"Claude"}),children:e.accounts.map(t=>(0,U.jsx)("option",{value:t.id,disabled:!t.authPresent,children:t.id===e.activeAccountId?i("draft.accountDefault",{label:t.label}):t.authPresent?t.label:i("draft.accountNeedsLogin",{label:t.label})},t.id))}):null}function dW({draft:e,disabled:t,stacked:n}){let{t:r}=(0,eh.Ym)();return n?(0,U.jsxs)("div",{className:"flex flex-col gap-2.5",children:[(0,U.jsx)(dV,{label:r("draft.engineAria"),children:(0,U.jsx)(dK,{engine:e.engine,disabled:t,roomy:!0,onChange:e.setEngine})}),e.accounts.length?(0,U.jsx)(dV,{label:r("launch.account"),children:(0,U.jsx)(dY,{draft:e,disabled:t,roomy:!0,className:"w-full"})}):null,(0,U.jsx)(dV,{label:r("launch.reasoning"),children:(0,U.jsx)("div",{className:"flex flex-wrap items-center gap-2 [&>select]:min-w-28 [&>select]:flex-1",children:(0,U.jsx)(dq,{engine:e.engine,model:e.model,effort:e.effort,speed:e.speed,disabled:t,roomy:!0,onModel:e.setModel,onEffort:e.setEffort,onSpeed:e.setSpeed})})})]}):(0,U.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,U.jsx)(dK,{engine:e.engine,disabled:t,onChange:e.setEngine}),(0,U.jsx)(dY,{draft:e,disabled:t}),(0,U.jsx)(dq,{engine:e.engine,model:e.model,effort:e.effort,speed:e.speed,disabled:t,onModel:e.setModel,onEffort:e.setEffort,onSpeed:e.setSpeed})]})}function dV({label:e,className:t,children:n}){return(0,U.jsxs)("div",{className:`flex min-w-0 flex-col gap-1 ${t??""}`,children:[(0,U.jsx)("span",{className:"text-label font-semibold text-muted",children:e}),n]})}let dJ="claude",dG="opus",dQ=`## Initial visible status
|
|
6
|
-
Your first turn after receiving this mandate must produce a visible assistant status in this conversation. For a FRESH seat with no missions, greet in exactly two lines:
|
|
7
|
-
Ready in {project}.
|
|
8
|
-
Tell me what to ship — I open lanes, spawn implementers and reviewers, and merge on APPROVE. Nothing starts until you ask.
|
|
9
|
-
Use the actual project name in place of {project}. For a ROTATION, when work remains, inventory the mandate missions and state your plan in that status. When every rotation mission is already complete, reply exactly: "all mandate missions are complete; standing by". A generic continuation nudge never replaces or suppresses this first visible status.`,dX=`You are the viewer's built-in Manager (issues #182, #691) — the agent that owns the board and runs the whole conveyor through the viewer's own HTTP API and MCP tools. You never act outside them.
|
|
10
|
-
|
|
11
|
-
${dQ}
|
|
12
|
-
|
|
13
|
-
## Two channels to the operator
|
|
14
|
-
The operator talks to whoever they want, you included. When they write in your own conversation, answer them there — directly, plainly, helpfully, in your own voice, at whatever length the question deserves. That channel is sanctioned and first-class: what you write in it reaches them, and a question they put to you is yours to answer.
|
|
15
|
-
The second channel is the bridge report log below. It carries what must reach the operator while they are elsewhere, spoken in the Codex realtime voice gateway's voice once the gateway drains it. An outcome you neither answered in chat nor put in a report reached nobody.
|
|
16
|
-
|
|
17
|
-
## Bridge reports — the second channel (manager -> gateway)
|
|
18
|
-
Append one report per meaningful outcome, with a stable key so a retry after a host death is a no-op rather than a duplicate. Classes, and nothing outside this list:
|
|
19
|
-
- status — brief progress worth surfacing; keep these rare.
|
|
20
|
-
- completed / failed — a stage, review, merge or deploy settled.
|
|
21
|
-
- blocked — you cannot proceed and need a decision.
|
|
22
|
-
- review_verdict — an APPROVE or REQUEST_CHANGES with the round and PR.
|
|
23
|
-
- question — you need an answer from the user; the gateway will ask them and reply.
|
|
24
|
-
Bodies are short prose, at most 2 KB, no transcript payloads, no raw tool output, no secrets, no full board dumps. Say what happened and what it means, with ids and links. Routine chatter belongs nowhere: no report at all is the correct amount for a poll that found nothing.
|
|
25
|
-
|
|
26
|
-
## Directives (gateway -> you)
|
|
27
|
-
The gateway relays the user's intent to you with send_message. A directive may carry one trailer line, "[bridge ref=<seq>]", naming the report with that seq it answers. Treat only a trailer as an answer — never read one into unrelated prose.
|
|
28
|
-
|
|
29
|
-
## Steering the operator's attention (request_attention)
|
|
30
|
-
The two channels above carry words; this one carries their screen. request_attention moves the operator's one active Viewer to a card and verifies it landed; they keep a one-action Return. Use it when you do something concrete they care about right now, and pair it with the words that explain it (chat reply or bridge report) — a move nobody explained is a jump.
|
|
31
|
-
Move them when: you just spawned or resumed a worker for something they asked for (focus that conversation as you say it is running); a review verdict, merge or deploy lands (focus the card it landed on); a lane blocks on THEM (focus the surface that is blocking, and ask in the same breath).
|
|
32
|
-
Do not move them for polling, routine status, your own bookkeeping, or twice for the same event. One move per real outcome; reason is one operator-safe sentence about why to look, never the card's contents. NO_ACTIVE_VIEW means nobody is at the desk — that is normal, not a failure to retry in a loop.
|
|
33
|
-
Targets are typed and discriminated by kind. The shapes, verbatim:
|
|
34
|
-
- conversation — {"kind":"conversation","conversationId":"conversation_..."} (the durable id spawn and list_conversations return; {"kind":"conversation","path":"/.../transcript.jsonl"} works too)
|
|
35
|
-
- stage — {"kind":"stage","pipelineId":"pipeline_...","stageId":"review"}; pipeline — {"kind":"pipeline","pipelineId":"pipeline_..."}
|
|
36
|
-
- flow round — {"kind":"flowRound","flowId":"flow_...","round":2}; task — {"kind":"task","taskId":"task_..."}
|
|
37
|
-
- draft — {"kind":"draft","draftId":"draft_..."} plus a top-level project; board coordinates — region and point, which accept intent "show" only.
|
|
38
|
-
intent "show" frames and highlights the card; intent "open" also opens it. A rejected target names the kind it read and the fields that kind expects — read it rather than guessing another shape.
|
|
39
|
-
|
|
40
|
-
## Conveyor rules
|
|
41
|
-
Drive every accepted piece of work through: GitHub issue -> worktree lane -> implementer agent -> review flow -> merge bar -> batched deploy -> cleanup.
|
|
42
|
-
- One lane (worktree + branch) per issue; one owner per file across active worktrees.
|
|
43
|
-
- Spawn implementers via POST /api/spawn with src = YOUR transcript path (lineage draws the diagram edges) and role per the role table; workers end with "REVIEW_READY: <PR url>".
|
|
44
|
-
- Reviews run as flows (POST /api/flows) or fresh reviewer spawns (role: "reviewer", reviews: <implementer ref>) — a fresh reviewer every round, verdict contract "VERDICT: APPROVE|REQUEST_CHANGES".
|
|
45
|
-
- Merge bar: merge only on an APPROVE verdict with green gates (tsc + tests). Never merge red.
|
|
46
|
-
- Keep task cards updated via /api/tasks. Report state changes as bridge reports.
|
|
47
|
-
|
|
48
|
-
## Pipeline stage contract
|
|
49
|
-
A pipeline is a GRAPH of stages, not a list. Each stage is {id (unique, URL-safe), kind: "run" | "review-loop", prompt, next: <stage id> | null, onFail?: {to, maxRounds?} (run stages only), role: {roleId, params?}} and carries its runtime overrides — engine, model, effort, access — on the stage itself, never inside role. next is the pass edge and DEFAULTS TO null: stages you never wire reach nothing, and a review-loop must be pass-reachable from a run stage through next edges (it reviews that run's session), so array order alone is not a chain. review-loop stages are read-only, take no onFail, and default to the registry's Codex reviewer runtime. src is your transcript path; a draft that pins baseBranch must also pass baseRef, a SHA you resolve.
|
|
50
|
-
|
|
51
|
-
## Start-by-default pipeline contract
|
|
52
|
-
When the operator asks for work, assess complexity, compose stages/roles, POST /api/pipelines with autoStart: true (or start it immediately after creation), and put the work in motion without a confirmation step or draft. Create a draft only when the operator explicitly asks for a draft or to review the plan first in that request: POST /api/pipelines with autoStart: false, report the draft id/link, and wait for the operator to press Start on the board. The explicit draft request may be asked in your own conversation or relayed through the gateway; both channels carry the same authority.
|
|
53
|
-
|
|
54
|
-
## Deploys
|
|
55
|
-
YOU decide when to deploy, and you execute it yourself. Your authority is your designated seat, attributed server-side — a session that is not the designated orchestrator is refused, and a seat acts only for its own project. Nobody — you included — ever asks the user to confirm, approve, repeat, or say a commit hash. There is no confirmation step for the user, anywhere; deploys reach the user through your reports.
|
|
56
|
-
1. Prepare: merges landed on origin/main, gates green. Never deploy red.
|
|
57
|
-
2. Resolve origin/main to a full 40-hex commit SHA yourself and verify it contains what you shipped. The SHA is machine evidence — never route it through the user.
|
|
58
|
-
3. Call deploy_exact_sha with revision=<sha>. Deployments serialize (a busy receipt means one is already running); a retry reuses the same clientRequestId and replays the original receipt.
|
|
59
|
-
4. Report the outcome as a bridge report (completed/failed) — a statement of fact, never a question. The deployment ledger is the durable audit of what shipped and when.
|
|
60
|
-
|
|
61
|
-
## Fences
|
|
62
|
-
- Operate exclusively through the viewer API and MCP tools (spawn, flows, pipelines, tasks, files, agent/snapshot, tmux). No direct process or runtime manipulation.
|
|
63
|
-
- If this checkout carries an llv-conveyor skill, it is your playbook; otherwise the conveyor rules above are the playbook.
|
|
64
|
-
- Replacing manual spawns is a non-goal: the user's own agents keep working; you coordinate, you do not take over.
|
|
65
|
-
- Re-derive board state per turn from bounded snapshots rather than accumulating it in context.`;var dZ=n(6408);function d0(e){if(!e||"object"!=typeof e||Array.isArray(e))return null;let t=e.intent;return"string"==typeof e.project&&"string"==typeof e.mandate&&("pending"===e.state||"active"===e.state)&&t&&"string"==typeof t.clientRequestId&&("spawn"===t.mode||"existing"===t.mode)?{project:e.project,seatEpoch:"number"==typeof e.seatEpoch?e.seatEpoch:0,conversationId:"string"==typeof e.conversationId?e.conversationId:null,path:"string"==typeof e.path?e.path:null,mandate:e.mandate,promptVersion:"number"==typeof e.promptVersion?e.promptVersion:null,predecessorConversationId:"string"==typeof e.predecessorConversationId?e.predecessorConversationId:null,state:e.state,intent:{clientRequestId:t.clientRequestId,mode:t.mode,launchId:"string"==typeof t.launchId?t.launchId:null,error:"string"==typeof t.error?t.error:null},designatedAt:"string"==typeof e.designatedAt?e.designatedAt:"",activatedAt:"string"==typeof e.activatedAt?e.activatedAt:null}:null}function d1(e){let{status:t}=e,n=t?.seat&&t.exists?t.seat:null,r=t?.pending??null,i=d5(t,e.submitFailure),a=r?.intent.error??null;if(n?.conversationId){var s,l;let t=(s=e.file,"resume"===(l=e.surface)?"resumable":"dead"===l||"superseded"===l||"inert"===l||"shell"===l?"dead":s&&null!==l&&"unresolved"!==l?"stalled"===s.activity?"stalled":"live":"resolving");return{kind:"live",seat:n,conversationId:n.conversationId,liveness:t,rotation:function(e,t,n){let r="dead"===t,i=n?.designated?n.rotation:null;if(i){let e=[];return("strongly_recommend"===i.level&&e.push("context"),r&&e.push("dead"),i.recommended||e.length)?{level:"strongly_recommend"===i.level?"strongly_recommend":"recommend",contextPercent:n?.context?.percent??null,reasons:e,notes:i.reasons,source:"server"}:null}let a=[],s="number"==typeof e?.ctx?.pct?e.ctx.pct:null;return(null!==s&&s>=50&&a.push("context"),r&&a.push("dead"),a.length)?{level:a.includes("context")?"strongly_recommend":"recommend",contextPercent:s,reasons:a,source:"client"}:null}(e.file,t,e.incumbent??null),transition:e.submitting?{kind:"creating",launchId:r?.intent.launchId??null}:a?{kind:"error",error:a}:i?{kind:"error",error:i.error}:r?{kind:"creating",launchId:r.intent.launchId}:null}}return e.submitting?{kind:"creating",launchId:r?.intent.launchId??null,clientRequestId:r?.intent.clientRequestId??null,designatedAt:r?.designatedAt??""}:a?{kind:"intent-error",error:a,retry:"fresh",designatedAt:r?.designatedAt??""}:i?{kind:"intent-error",error:i.error,retry:i.retry,designatedAt:r?.designatedAt??""}:r?{kind:"creating",launchId:r.intent.launchId,clientRequestId:r.intent.clientRequestId,designatedAt:r.designatedAt}:t?{kind:"draft",vacated:!!t.seat&&!t.exists}:e.statusFailed?{kind:"unavailable"}:{kind:"loading"}}function d2(e,t){if("live"!==e.kind||"stalled"!==e.liveness||!t)return!1;let n=t.lastTurn;if(!n||null!==n.endedAt)return!0;let r=t.lastAssistantMessageAt;if("number"==typeof r&&r>=n.startedAt)return!1;let i=Date.parse(e.seat.designatedAt);return!(Number.isFinite(i)&&n.startedAt>=i&&(null===r||"number"==typeof r&&r<i))}function d5(e,t){return!t||d4(e,t.clientRequestId)?null:{error:t.error,retry:"ambiguous"===t.kind?"same":"fresh"}}function d4(e,t){return!!e&&!!t&&(e.seat?.intent.clientRequestId===t||e.pending?.intent.clientRequestId===t&&null!==e.pending.intent.error)}function d3(){return("u">typeof crypto&&"function"==typeof crypto.randomUUID?crypto.randomUUID():Date.now().toString(36)+"-"+Math.random().toString(36).slice(2,12)).replace(/[^A-Za-z0-9_-]/g,"").slice(0,128).padEnd(8,"0")}function d6(e,t,n){let r="string"==typeof t?.error&&t.error?t.error:`the seat route answered HTTP ${e}`;return 409===e&&t?.code==="seat_intent_in_progress"?null:e>=400&&e<500?{kind:"terminal",error:r,clientRequestId:n}:{kind:"ambiguous",error:r,clientRequestId:n}}function d8({incumbent:e,file:t,catalog:n,predecessorConversationId:r,rotating:i,opening:a,onRotate:s}){var l;let o,{t:c}=(0,eh.Ym)(),d=e?.designated?e:null,u=d?.engine??(t?.engine==="claude"||t?.engine==="codex"?t.engine:null),p=d?.model??t?.model??null,m=d?.effort??null,f=d?.accountId??null,h=f?n?.[u??"claude"]?.accounts.find(e=>e.id===f)?.label??f:null,x=u?(0,tw.zZ)(u):null,g=d?.context??(l=t,(o=l?.ctx)?{tokens:o.usedTokens,limit:o.windowTokens,percent:o.pct,estimated:"exact"!==o.confidence,basis:""}:null);return(0,U.jsxs)("div",{"data-orchestrator-incumbent":!0,className:"flex shrink-0 flex-col gap-1 border-b border-border bg-sunken px-3 py-1.5","aria-label":c("orchPanel.incumbentAria"),children:[(0,U.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1",children:[x?(0,U.jsx)(sv,{style:x.style,children:x.label}):null,p?(0,U.jsxs)("span",{className:"min-w-0 shrink truncate text-ui font-semibold text-primary",title:m?`${p} \xb7 ${m}`:p,children:[p,m?(0,U.jsxs)("span",{className:"font-normal text-muted",children:[" \xb7 ",m]}):null]}):(0,U.jsx)("span",{className:"text-ui text-muted",children:c("orchPanel.incumbentUnknown")}),h?(0,U.jsx)(sv,{tone:"neutral",shrinkable:!0,title:c("orchPanel.accountTitle",{account:h}),children:(0,U.jsx)("span",{className:"min-w-0 truncate",children:h})}):null,(0,U.jsx)(d7,{context:g}),(0,U.jsxs)("button",{type:"button","data-orchestrator-rotate":!0,onClick:s,disabled:i||a,title:c("orchPanel.rotateTitle"),className:"ml-auto inline-flex h-6 shrink-0 items-center gap-1 rounded-control border border-border bg-card px-2 text-caption font-semibold text-secondary hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60",children:[a?(0,U.jsx)(dR.A,{className:"h-3 w-3 animate-spin","aria-hidden":!0}):(0,U.jsx)(dO.A,{className:"h-3 w-3","aria-hidden":!0}),c("orchPanel.rotate")]})]}),r?(0,U.jsxs)("a",{href:"#c="+encodeURIComponent(r),"data-orchestrator-predecessor":r,title:c("orchPanel.predecessorTitle"),className:"inline-flex min-w-0 items-center gap-1 self-start text-caption text-muted hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:[(0,U.jsx)(dZ.A,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),(0,U.jsx)("span",{className:"truncate",children:c("orchPanel.predecessor")})]}):null]})}function d7({context:e}){let{t}=(0,eh.Ym)();if(!e||null===e.tokens)return null;let{percent:n,estimated:r}=e,i=null===n||n<50?{text:"text-secondary",bar:"bg-secondary/50"}:n>=90?{text:"text-danger",bar:"bg-danger"}:{text:"text-warning",bar:"bg-warning"},a=[null===n?t("orchPanel.ctxUnknownWindow",{used:e.tokens.toLocaleString("en-US")}):t("orchPanel.ctxTitle",{percent:String(n),used:e.tokens.toLocaleString("en-US"),window:(e.limit??0).toLocaleString("en-US")}),e.basis].filter(Boolean).join("\n");return(0,U.jsxs)("span",{"data-orchestrator-context":null===n?"unknown":String(n),className:"inline-flex shrink-0 items-center gap-1",title:a,"aria-label":null===n?t("orchPanel.ctxAriaUnknown"):t("orchPanel.ctxAria",{percent:String(n)}),children:[(0,U.jsxs)("span",{className:`text-caption font-semibold tabular-nums ${i.text}`,children:[r?"~":"",null===n?function(e){if(e>=1e6){let t=e/1e6;return`${t>=10||Number.isInteger(t)?Math.round(t):Math.round(10*t)/10}M`}return e>=1e3?`${Math.round(e/1e3)}K`:`${e}`}(e.tokens):`${n}%`]}),null===n?null:(0,U.jsx)("span",{className:"h-1 w-8 overflow-hidden rounded-full bg-border","aria-hidden":!0,children:(0,U.jsx)("span",{className:`block h-full rounded-full ${i.bar}`,style:{width:`${Math.min(100,n)}%`}})})]})}var d9=n(9680);async function ue(e){try{if("u">typeof navigator&&navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}return!1}function ut({t:e,label:t,value:n}){let[r,i]=(0,Y.useState)(!1);return(0,Y.useEffect)(()=>{if(!r)return;let e=window.setTimeout(()=>i(!1),1600);return()=>window.clearTimeout(e)},[r]),(0,U.jsxs)("div",{className:"flex items-stretch gap-1.5",children:[(0,U.jsx)("code",{className:"min-w-0 flex-1 overflow-x-auto whitespace-pre rounded-control border border-border bg-sunken px-2 py-1.5 font-mono text-[11.5px] leading-relaxed text-primary",children:n}),(0,U.jsxs)("button",{type:"button","aria-label":t,title:t,onClick:()=>void ue(n).then(e=>e&&i(!0)),className:"inline-flex min-h-11 shrink-0 items-center gap-1 self-stretch rounded-control border border-border bg-canvas px-2.5 text-label font-semibold text-secondary hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:min-h-0 sm:py-1",children:[r?(0,U.jsx)(sx.Jl,{className:"h-3.5 w-3.5 text-success","aria-hidden":!0}):(0,U.jsx)(sx.QR,{className:"h-3.5 w-3.5","aria-hidden":!0}),e(r?"attach.copied":"attach.copy")]})]})}function un({t:e,loading:t,error:n,command:r,live:i=null,onClose:a,onSecondary:s,secondaryBusy:l=!1,secondaryError:o=null}){let c=s?(0,U.jsxs)("button",{type:"button",onClick:s,disabled:l,className:"inline-flex min-h-11 items-center gap-1.5 rounded-control border border-border bg-canvas px-3 text-label font-semibold text-muted hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-50 sm:min-h-9",children:[l?(0,U.jsx)(sx.kr,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):null,e("attach.secondaryViewer")]}):null,d=o?(0,U.jsx)("p",{role:"alert",className:"w-full text-caption font-semibold text-danger",children:o}):null;return(0,U.jsx)("div",{className:"fixed inset-0 z-[80] flex items-center justify-center bg-black/40 p-3",role:"presentation",onClick:e=>{e.target===e.currentTarget&&a()},children:(0,U.jsxs)("div",{role:"dialog","aria-modal":"true","aria-label":e("attach.dialogTitle"),className:"flex max-h-[85vh] w-full max-w-[560px] flex-col gap-3 overflow-y-auto rounded-surface border border-border bg-card p-4 shadow-2",children:[(0,U.jsxs)("div",{className:"flex items-start gap-2",children:[(0,U.jsx)(sx.ke,{className:"mt-0.5 h-4 w-4 shrink-0 text-accent","aria-hidden":!0}),(0,U.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,U.jsx)("h2",{className:"text-body font-bold text-primary",children:e("attach.dialogTitle")}),i?(0,U.jsx)("p",{className:"mt-0.5 text-label text-muted",children:e("attach.hint")}):r?(0,U.jsx)("p",{className:"mt-0.5 text-label text-muted",children:e("attach.dialogIntro",{account:r.accountLabel})}):null]}),(0,U.jsx)("button",{type:"button",onClick:a,"aria-label":e("common.close"),className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-full border border-border bg-canvas text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:h-8 sm:w-8",children:(0,U.jsx)(sx.X,{className:"h-4 w-4","aria-hidden":!0})})]}),t?(0,U.jsxs)("div",{role:"status","aria-live":"polite",className:"flex items-center gap-2 py-4 text-label font-semibold text-muted",children:[(0,U.jsx)(sx.kr,{className:"h-4 w-4 animate-spin","aria-hidden":!0})," ",e("attach.loading")]}):n?(0,U.jsx)("div",{role:"alert",className:"rounded-control border border-danger/45 bg-danger-soft px-3 py-2 text-label font-semibold text-danger",children:n}):i?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(ut,{t:e,label:e("attach.copy"),value:i.command}),(0,U.jsx)(ut,{t:e,label:e("attach.copyReadonly"),value:i.readOnlyCommand}),(0,U.jsxs)("div",{className:"flex items-start gap-1.5 text-caption font-semibold text-muted",children:[(0,U.jsx)(sx.ke,{className:"mt-0.5 h-3.5 w-3.5 shrink-0","aria-hidden":!0}),(0,U.jsx)("span",{children:e("attach.readonlyHint")})]}),(0,U.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2 border-t border-border pt-3",children:[(0,U.jsxs)("button",{type:"button",onClick:()=>void ue(i.command),className:"inline-flex min-h-11 items-center gap-1.5 rounded-control border border-accent bg-accent px-3 text-label font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 sm:min-h-9",children:[(0,U.jsx)(sx.QR,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",e("attach.copyFull")]}),c,d]})]}):r?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(ut,{t:e,label:e("attach.copyCwd"),value:r.cdCommand}),(0,U.jsx)(ut,{t:e,label:e("attach.copyCommand"),value:r.command}),"subagent-root"===r.note?(0,U.jsx)("p",{className:"text-caption text-muted",children:e("attach.subagentNote")}):null,(0,U.jsxs)("div",{className:"flex items-start gap-1.5 text-caption font-semibold text-warning",children:[(0,U.jsx)(i4.A,{className:"mt-0.5 h-3.5 w-3.5 shrink-0","aria-hidden":!0}),(0,U.jsx)("span",{children:e("attach.takeoverWarning")})]}),(0,U.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2 border-t border-border pt-3",children:[(0,U.jsxs)("button",{type:"button",onClick:()=>void ue(r.fullCommand),className:"inline-flex min-h-11 items-center gap-1.5 rounded-control border border-accent bg-accent px-3 text-label font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 sm:min-h-9",children:[(0,U.jsx)(sx.QR,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",e("attach.copyFull")]}),c,d]})]}):null]})})}function ur({file:e,onClose:t,mode:n="resume"}){let{t:r}=(0,eh.Ym)(),[i,a]=(0,Y.useState)(null),[s,l]=(0,Y.useState)(null),[o,c]=(0,Y.useState)(null),[d,u]=(0,Y.useState)(!0),[p,m]=(0,Y.useState)(!1),[f,h]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{let t=!1;return("live"===n?fetch(`/api/tmux?attach=1&path=${encodeURIComponent(e.path)}`).then(async e=>{let n=await e.json().catch(()=>({}));t||(e.ok&&n.attach?l({command:n.attach.command,readOnlyCommand:n.attach.readOnlyCommand}):c(n.error??r("attach.unavailable")))}):fetch(`/api/attach-command?path=${encodeURIComponent(e.path)}`).then(async e=>{let n=await e.json().catch(()=>({}));t||(e.ok?a(n):c(n.error??r("attach.unavailable")))})).catch(()=>{t||c(r("attach.network"))}).finally(()=>{t||u(!1)}),()=>{t=!0}},[e.path,n]);let x=async()=>{if(!p){m(!0),h(null);try{let t=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"attach-terminal",path:e.path})});if(!t.ok){let e=await t.json().catch(()=>({}));h(e.error??r("attach.secondaryFailed"))}}catch{h(r("attach.secondaryFailed"))}finally{m(!1)}}};return(0,U.jsx)(un,{t:r,loading:d,error:o,command:i,live:s,onClose:t,onSecondary:()=>void x(),secondaryBusy:p,secondaryError:f})}function ui(e,t=(0,eh.JK)()){let n=Math.max(0,Math.round(e)),r="uk"===t?{h:" год",m:" хв",s:" с",sep:" "}:{h:"h",m:"m",s:"s",sep:" "},i=Math.floor(n/3600),a=Math.floor(n%3600/60),s=n%60,l=[];return i>0?(l.push(`${i}${r.h}`),a>0&&l.push(`${a}${r.m}`)):a>0?(l.push(`${a}${r.m}`),s>0&&l.push(`${s}${r.s}`)):l.push(`${s}${r.s}`),l.join(r.sep)}function ua(e){return"live"===e.activity&&(!e.lastTurn||null===e.lastTurn.endedAt)}function us(e){let t=e.lastTurn;return t&&null!==t.endedAt?Math.max(0,(t.endedAt-t.startedAt)/1e3):null}function ul({t:e,cap:t,ariaLabel:n,hint:r,busy:i,onClick:a,children:s,className:l="",isMobile:o}){let c="disabled"===t.state,d=c?e(t.reason):"enabled"===t.state&&t.note?e(t.note):"",u=d?`${e(n)} — ${d}`:e(n);return(0,U.jsx)(ly,{label:d||e(r),children:(0,U.jsx)("button",{type:"button","aria-label":u,"aria-disabled":c||void 0,disabled:c||i,onClick:a,className:`inline-flex shrink-0 items-center justify-center gap-1 rounded-control text-muted hover:bg-sunken focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-50 ${o?"h-11 w-11":"p-2"} ${l}`,children:i?(0,U.jsx)(sx.kr,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):s})})}function uo({t:e,surface:t}){let n=(()=>{switch(t){case"structured":return null;case"live-subagent":return{icon:(0,U.jsx)(sx.eW,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),label:e("composer.root"),title:e("composer.titleRelay")};case"resume":return{icon:(0,U.jsx)(sx.jG,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),label:e("strip.resume"),title:e("composer.titleSpawnResumed")};case"dead":return{icon:(0,U.jsx)(sx.ke,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),label:e("strip.deadMode"),title:e("deadHost.body")};default:return{icon:(0,U.jsx)(sx.ke,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),label:e("strip.live"),title:e("branch.live")}}})();return n?(0,U.jsxs)("span",{className:"inline-flex min-w-0 items-center gap-1 rounded-control bg-sunken px-1.5 py-1 text-caption font-semibold text-secondary",title:n.title,children:[n.icon,(0,U.jsx)("span",{className:"truncate",children:n.label})]}):null}function uc({t:e,isMobile:t,caps:n,layout:r,compactArmed:i,stopBusy:a,compactBusy:s,recheckBusy:l=!1,overflowOpen:o,onStop:c,onCompact:d,onRecheck:u=()=>void 0,onTerminal:p,onToggleOverflow:m,status:f}){let{controls:h,surface:x}=n,g=t||"full"!==r,b=g&&("hidden"!==h.compact.state||"hidden"!==h.terminal.state),v="hidden"!==h.stop.state?(0,U.jsx)(ul,{t:e,isMobile:t,cap:h.stop,ariaLabel:"composer.interruptAria",hint:"composer.interruptTitle",busy:a,onClick:c,className:"hover:text-danger",children:(0,U.jsx)(sx.M6,{className:"h-4 w-4",fill:"currentColor","aria-hidden":!0})}):null,w=(0,U.jsx)(ul,{t:e,isMobile:t,cap:{state:"enabled"},ariaLabel:"deadHost.recheck",hint:"strip.recheckHint",busy:l,onClick:u,className:"hover:text-accent",children:(0,U.jsx)(sx.kt,{className:"h-4 w-4","aria-hidden":!0})}),y="hidden"!==h.compact.state?(0,U.jsx)(ul,{t:e,isMobile:t,cap:h.compact,ariaLabel:"composer.compactAria",hint:i?"composer.compactConfirmTitle":"composer.compactTitle",busy:s,onClick:d,className:i?"bg-info/10 text-info":"hover:text-info",children:i?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(sx.Jl,{className:"h-4 w-4","aria-hidden":!0}),(0,U.jsx)("span",{className:"text-[10.5px] font-bold",children:e("composer.compactConfirm")})]}):(0,U.jsx)(sx.O0,{className:"h-4 w-4","aria-hidden":!0})}):null,k="hidden"!==h.terminal.state?(0,U.jsx)(ul,{t:e,isMobile:t,cap:h.terminal,ariaLabel:"attach.dialogTitle",hint:"attach.dialogTitle",onClick:p,className:"hover:text-accent",children:(0,U.jsx)(sx.ke,{className:"h-4 w-4","aria-hidden":!0})}):null;return(0,U.jsxs)("div",{"data-agent-control-strip":!0,"data-strip-surface":x,"data-strip-layout":r,className:"flex shrink-0 flex-col gap-1 border-t border-border bg-card px-2.5 py-1.5",children:[(0,U.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[(0,U.jsx)(uo,{t:e,surface:x}),v,w,g?null:y,g?null:k,b?(0,U.jsx)(ly,{label:e("strip.moreActions"),children:(0,U.jsx)("button",{type:"button","aria-expanded":o,"aria-label":e("strip.moreActions"),onClick:m,className:`inline-flex shrink-0 items-center justify-center rounded-control text-muted hover:bg-sunken hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${t?"h-11 w-11":"p-2"}`,children:(0,U.jsx)(d9.A,{className:"h-4 w-4","aria-hidden":!0})})}):null]}),b&&o?(0,U.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[y,k]}):null,f?(0,U.jsx)("span",{role:"status","aria-live":"err"===f.kind?"assertive":"polite",className:`truncate text-caption font-semibold ${"ok"===f.kind?"text-success":"info"===f.kind?"text-warning":"text-danger"}`,children:f.text}):null]})}function ud({file:e}){let{t}=(0,eh.Ym)(),r=ia(),{caps:i,attachMode:a,structuredSession:s}=cs(e),l=(0,Y.useRef)(null),[o,c]=(0,Y.useState)("full"),[d,u]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)(!1),[f,h]=(0,Y.useState)(!1),[x,g]=(0,Y.useState)(!1),[b,v]=(0,Y.useState)(!1),w=(0,Y.useRef)(null),[y,k]=(0,Y.useState)(!1),[j,N]=(0,Y.useState)(null),S=async()=>{if("live"===a)return void k(!0);N(null);try{let r=await fetch(`/api/attach-command?path=${encodeURIComponent(e.path)}`),i=await r.json();if(r.ok&&i.fullCommand){let{copyText:e}=await Promise.resolve().then(n.bind(n,8074));if(await e(i.fullCommand))return void N({kind:"ok",text:t("attach.copiedFull")})}}catch{}k(!0)},C=(0,Y.useCallback)(e=>{if(l.current?.disconnect(),l.current=null,!e||"u"<typeof ResizeObserver)return;let t=new ResizeObserver(e=>{let t=e[0]?.contentRect.width??999;c(t>=430?"full":t>=300?"narrow":"mini")});t.observe(e),l.current=t},[]);if((0,Y.useEffect)(()=>{if(!b)return;let e=window.setTimeout(()=>v(!1),4e3);return()=>window.clearTimeout(e)},[b]),!ca.some(e=>"hidden"!==i.controls[e].state))return null;let A=async()=>{if(!p){m(!0),N(null);try{var n,r;let i=s?await (n=s.session.conversationId,r=rs(),s8("/api/runtime/interrupt",{conversationId:n,operationId:r})):await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"interrupt",path:e.path})}).then(async e=>{let t=await e.json();return{ok:e.ok&&!0===t.ok,error:t.error}});N(i.ok?{kind:"interrupt",turnStartedAt:e.lastTurn?.startedAt??null}:{kind:"err",text:i.error??t("composer.failedInterrupt")})}catch{N({kind:"err",text:t("common.serverUnavailable")})}finally{m(!1)}}},I=async()=>{if(!x){g(!0),N(null);try{await s7()||N({kind:"err",text:t("deadHost.recheckFailed")})}finally{g(!1)}}},M=async()=>{if(!b)return void v(!0);if(v(!1),f)return;h(!0),N(null);let n=w.current??rs();w.current=n;try{var r,i,a;let s,l=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"compact",path:e.path,operationId:n})}),o=await l.json(),c=o.receipt?.status==="rejected"||o.receipt?.status==="failed",d=l.ok&&!!o.ok&&!c;(d||c)&&(w.current=null),N(d?{kind:"ok",text:t("composer.compactSent")}:{kind:"err",text:(r=o.receipt?.reason,i=o.error,a=o.code,(s=ri(r))?t(s):"unsupported-capability"===a?t("receipt.human.unsupportedCapability"):i??t("composer.failedCompact"))})}catch{N({kind:"err",text:t("common.serverUnavailable")})}finally{h(!1)}};return(0,U.jsxs)("div",{ref:C,children:[(0,U.jsx)(uc,{t:t,isMobile:r,caps:i,layout:o,compactArmed:b,stopBusy:p,compactBusy:f,recheckBusy:x,overflowOpen:d,onStop:()=>void A(),onCompact:()=>void M(),onRecheck:()=>void I(),onTerminal:()=>void S(),onToggleOverflow:()=>u(e=>!e),status:j&&"interrupt"===j.kind?(e.lastTurn?.startedAt??null)!==j.turnStartedAt?null:ua(e)?{kind:"ok",text:t("composer.escapeSentWaiting")}:{kind:"ok",text:t("composer.escapeSent")}:j}),y?(0,U.jsx)(ur,{file:e,mode:a,onClose:()=>k(!1)}):null]})}var uu=n(7990),up=n(4760);let um=new Set,uf=null,uh=null,ux=null,ug=null,ub=!1,uv=!1,uw=!1,uy=!1,uk=0,uj=new Map;function uN(e,t){return e&&t(e),null}function uS(){uk+=1,ug?.close(),ug=null,uj=new Map}function uC(){uf=uN(uf,clearInterval)}async function uA(){if(0!==um.size){if(ub){uv=!0;return}ub=!0;try{let e=[...um];for(let t=0;t<e.length;t+=64){let n=e.slice(t,t+64),r=n.map((e,t)=>({id:String(t),path:e.path,offset:e.getOffset()})),i={},a=!1;try{let e=await fetch("/api/logs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({reqs:r})});i=(await e.json()).chunks??{}}catch{a=!0}for(let e=0;e<n.length;e+=1){let t=n[e];if(um.has(t))if(a)t.onChunk({transportError:!0});else{let n=i[String(e)];n&&t.onChunk(n)}}}}finally{ub=!1,uv&&(uv=!1,uA())}}}function uI(){uw||(uw=!0,setTimeout(()=>{uw=!1,uy&&uA()},0))}function uM(){0!==um.size&&(uS(),uy=!0,null===uf&&(uf=setInterval(()=>void uA(),1200)),uI(),uh=uN(uh,clearTimeout),uh=setTimeout(()=>{uh=null,0!==um.size&&(uy=!1,uC(),uP(0))},6e4))}function uT(){if(ux=uN(ux,clearTimeout),0===um.size)return;if("u"<typeof EventSource||um.size>64)return void uM();uy=!1,uC(),uh=uN(uh,clearTimeout),uS();let e=uk,t=[...um],n=t.map((e,t)=>({id:String(t),path:e.path,offset:e.getOffset()}));uj=new Map(n.map((e,n)=>[e.id,t[n]]));let r=new EventSource(`/api/logs/stream?subs=${encodeURIComponent(JSON.stringify(n))}`);ug=r,r.addEventListener("chunk",t=>{let n;if(e===uk&&r===ug){try{n=JSON.parse(t.data)}catch{return}if("string"==typeof n.id&&n.chunk&&"object"==typeof n.chunk){var i,a;let e;i=n.id,a=n.chunk,(e=uj.get(i))&&um.has(e)&&e.onChunk(a)}}}),r.onerror=()=>{if(e===uk&&r===ug){for(let e of um)e.onChunk({transportError:!0});uM()}}}function uP(e=300){uy?uI():(ux=uN(ux,clearTimeout),ux=setTimeout(uT,e))}let u$=e=>new TextEncoder().encode(e).length,uE=new Map;function uR(e,t){let n=t>0?Math.min(t,6e3):6e3;if(e.win.lines.length<=n)return e;let r=e.win.lines.slice(0,e.win.lines.length-n),i=r.reduce((e,t)=>e+u$(t+"\n"),0);return{...e,win:{lines:e.win.lines.slice(-n),start:e.win.start+r.length},historyStart:e.historyStart+i,hasMore:!0}}function uO(e,t){let n=uE.get(e);if(!n)return null;uE.delete(e);let r=uR(n,t);return uE.set(e,r),r}var uD=n(9103),uL=n(4962),u_=n(4890);let uF={starting:dR.A,binding:dR.A,queued:uD.A,reconciling:dR.A,"recoverable-timeout":uD.A,"live-late-success":uL.A,failed:u_.A,recovered:uL.A};function uq({launch:e,t,onRetry:n}){var r,i;let a=uF[e.state],s=t(`spawnCard.${e.state}`),l=t(`spawnCard.initial.${e.initialMessage}`);return(0,U.jsxs)("div",{"data-launch-chips":!0,"data-launch-state":e.state,"data-launch-initial":e.initialMessage,className:"my-2 flex flex-wrap items-center gap-1.5",role:"status","aria-live":"failed"===e.state?"assertive":"polite",children:[(0,U.jsxs)("span",{"data-launch-chip":"state",title:s,className:`inline-flex min-w-0 max-w-full items-center gap-1 rounded-full border px-2 py-0.5 text-caption font-semibold ${"failed"===(r=e.state)?"border-danger/45 bg-danger-soft text-danger":"live-late-success"===r||"recovered"===r?"border-success/45 bg-success-soft text-success":"queued"===r||"recoverable-timeout"===r?"border-warning/45 bg-warning-soft text-warning":"border-border bg-sunken text-secondary"}`,children:[(0,U.jsx)(a,{className:`h-3 w-3 shrink-0 ${"starting"===(i=e.state)||"binding"===i||"reconciling"===i?"animate-spin motion-reduce:animate-none":""}`,"aria-hidden":!0}),(0,U.jsx)("span",{className:"truncate",children:t(`spawnChip.${e.state}`)}),(0,U.jsx)("span",{className:"sr-only",children:s})]}),(0,U.jsxs)("span",{"data-launch-chip":"initial",title:l,className:"inline-flex min-w-0 max-w-full items-center rounded-full border border-border bg-sunken px-2 py-0.5 text-caption font-semibold text-muted",children:[(0,U.jsx)("span",{className:"truncate",children:t(`spawnChip.initial.${e.initialMessage}`)}),(0,U.jsx)("span",{className:"sr-only",children:l})]}),"recovered"!==e.state&&"live-late-success"!==e.state?(0,U.jsx)("span",{"data-launch-chip":"id",title:t("spawnCard.launch",{id:e.launchId}),className:"inline-flex shrink-0 items-center rounded-full border border-border/70 px-2 py-0.5 font-mono text-caption text-muted/80",children:e.launchId.slice(0,8)}):null,e.error?(0,U.jsx)("span",{"data-launch-chip":"error",className:"min-w-0 basis-full break-words text-caption font-semibold text-danger",children:e.error}):null,"failed"===e.state&&e.retrySafe&&n?(0,U.jsxs)("button",{type:"button","data-launch-retry":!0,onClick:n,title:t("spawnCard.retrySafe"),className:"inline-flex min-h-8 shrink-0 items-center gap-1 rounded-full border border-border bg-card px-2 text-caption font-semibold text-primary hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 [@media(pointer:coarse)]:min-h-11",children:[(0,U.jsx)(sg.A,{className:"h-3 w-3","aria-hidden":!0})," ",t("launchHistory.retryLabel")]}):null]})}function uz({launch:e,onRetry:t}){let{t:n}=(0,eh.Ym)();return(0,U.jsx)(uq,{launch:e,t:n,onRetry:t})}let uH=/(?:\/\.codex\/sessions\/|\/\.claude\/projects\/|\/\.claude\/plugins\/data\/codex-openai-codex\/state\/|^\/tmp\/claude-\d+\/)/;function uU({status:e,className:t}){let n=t??"h-3.5 w-3.5";return"ok"===e?(0,U.jsx)(sx.Jl,{className:n,"aria-hidden":!0}):"err"===e?(0,U.jsx)(sx.X,{className:n,"aria-hidden":!0}):(0,U.jsx)(sx.kr,{className:`${n} animate-spin motion-reduce:animate-none`,"aria-hidden":!0})}function uB({file:e,line:t}){let n=t?`${e}:${t}`:e,r="inline-block min-w-0 max-w-full truncate rounded-md bg-sunken px-1.5 py-0.5 align-bottom font-mono text-[11.5px]";return uH.test(e)?(0,U.jsx)("a",{href:`#f=${encodeURIComponent(e)}`,className:`${r} text-accent underline decoration-dotted`,title:n,children:n}):(0,U.jsx)("code",{className:r,title:n,children:n})}var uK=n(8074);function uY({src:e,alt:t,caption:n,onClose:r}){let{t:i}=(0,eh.Ym)(),[a,s]=(0,Y.useState)(1),[l,o]=(0,Y.useState)(0),[c,d]=(0,Y.useState)(0),[u,p]=(0,Y.useState)(!1),m=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{let e=e=>{"Escape"===e.key&&r()};window.addEventListener("keydown",e);let t=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{window.removeEventListener("keydown",e),document.body.style.overflow=t}},[r]);let f=(e,t=0,n=0)=>{let r=Math.min(8,Math.max(.25,a*e)),i=r/a;s(r),o(t-(t-l)*i),d(n-(n-c)*i)},h=()=>{s(1),o(0),d(0)};return(0,nx.createPortal)((0,U.jsxs)("div",{className:"fixed inset-0 z-50 flex flex-col bg-black/85 backdrop-blur-sm",role:"dialog","aria-modal":"true","aria-label":t,onClick:r,children:[(0,U.jsxs)("div",{className:"flex items-center gap-2 px-4 py-2.5",onClick:e=>e.stopPropagation(),children:[(0,U.jsx)("span",{className:"min-w-0 truncate text-[12.5px] font-semibold text-white/85",children:n??t}),(0,U.jsxs)("span",{className:"ml-auto flex items-center gap-1.5",children:[(0,U.jsx)("button",{className:"inline-flex items-center rounded-lg border border-white/25 bg-white/10 px-2.5 py-1 text-white hover:bg-white/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/60","aria-label":i("lightbox.zoomOut"),onClick:()=>f(1/1.4),children:(0,U.jsx)(am.A,{className:"h-4 w-4","aria-hidden":!0})}),(0,U.jsxs)("button",{className:"rounded-lg border border-white/25 bg-white/10 px-2 py-1 text-[11.5px] font-semibold text-white hover:bg-white/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/60","aria-label":i("lightbox.resetZoom"),onClick:h,children:[Math.round(100*a),"%"]}),(0,U.jsx)("button",{className:"inline-flex items-center rounded-lg border border-white/25 bg-white/10 px-2.5 py-1 text-white hover:bg-white/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/60","aria-label":i("lightbox.zoomIn"),onClick:()=>f(1.4),children:(0,U.jsx)(af.A,{className:"h-4 w-4","aria-hidden":!0})}),(0,U.jsx)("button",{className:"ml-1 inline-flex items-center rounded-lg border border-white/25 bg-white/10 px-2.5 py-1 text-white hover:bg-white/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/60","aria-label":i("common.close"),onClick:r,children:(0,U.jsx)(sx.X,{className:"h-4 w-4","aria-hidden":!0})})]})]}),(0,U.jsx)("div",{className:"min-h-0 flex-1 touch-none overflow-hidden",onClick:e=>e.stopPropagation(),onWheel:e=>{let t=e.currentTarget.getBoundingClientRect(),n=e.clientX-t.left-t.width/2,r=e.clientY-t.top-t.height/2;f(e.deltaY<0?1.18:1/1.18,n,r)},onPointerDown:e=>{e.currentTarget.setPointerCapture(e.pointerId),m.current={x:e.clientX,y:e.clientY,tx:l,ty:c},p(!0)},onPointerMove:e=>{m.current&&(o(m.current.tx+(e.clientX-m.current.x)),d(m.current.ty+(e.clientY-m.current.y)))},onPointerUp:()=>{m.current=null,p(!1)},onPointerCancel:()=>{m.current=null,p(!1)},onDoubleClick:()=>1===a?f(2):h(),children:(0,U.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,U.jsx)("img",{src:e,alt:t,draggable:!1,className:`max-h-full max-w-full select-none ${u?"":"transition-transform duration-75"} ${a>1?"cursor-grab active:cursor-grabbing":"cursor-zoom-in"}`,style:{transform:`translate(${l}px, ${c}px) scale(${a})`}})})})]}),document.body)}let uW="opacity-70 transition-opacity motion-reduce:transition-none hover:opacity-100 focus-visible:opacity-100 group-hover/msg:opacity-100",uV="pr-[28px] [@media(pointer:coarse)]:pr-[50px]";var uJ=n(3194);let uG=String.raw`(?:\\.|[^)\s\\])+`,uQ=String.raw`!\[[^\]]*\]\(${uG}\)`,uX=String.raw`\[[^\]]+\]\(${uG}\)`,uZ=RegExp(`(${uQ}|\`[^\`]+\`|\\*\\*[^*]+\\*\\*|${uX}|https?://[^\\s<>"')\\]]+)`,"g"),u0=new RegExp(String.raw`^\s*!\[([^\]]*)\]\((${uG})\)\s*$`),u1=new RegExp(String.raw`^!\[([^\]]*)\]\((${uG})\)$`),u2=new RegExp(String.raw`^\[([^\]]+)\]\((${uG})\)$`);function u5({text:e}){let[t,n]=(0,Y.useState)(!1),r=(0,Y.useRef)(null);return(0,Y.useEffect)(()=>()=>{null!==r.current&&window.clearTimeout(r.current)},[]),(0,U.jsx)("span",{title:t?(0,uJ.tr)("common.copied"):(0,uJ.tr)("common.clickToCopy"),onClick:t=>{t.preventDefault(),t.stopPropagation(),(0,uK.copyText)(e).then(e=>{e&&(n(!0),null!==r.current&&window.clearTimeout(r.current),r.current=window.setTimeout(()=>n(!1),1400))})},className:`cursor-copy rounded-md px-1.5 py-0.5 font-mono ${t?"bg-success/15 text-success":"bg-sunken"}`,children:e})}function u4({code:e,lang:t,copyLabel:n}){let r=aN(e,t);return(0,U.jsxs)("div",{className:"group/code relative my-1.5 max-w-full",children:[r?(0,U.jsx)("pre",{className:`hljs max-w-full overflow-x-auto rounded-[10px] border border-border bg-canvas py-2 pl-3 font-mono text-[11.5px] ${uV}`,dangerouslySetInnerHTML:{__html:r}}):(0,U.jsx)("pre",{className:`max-w-full overflow-x-auto rounded-[10px] border border-border bg-canvas py-2 pl-3 font-mono text-[11.5px] ${uV}`,children:e}),(0,U.jsx)(uK.i,{text:e,label:n??(0,uJ.tr)("feed.copyCode"),className:`absolute right-[6px] top-[6px] ${uW} group-hover/code:opacity-100`})]})}let u3="break-all text-accent underline decoration-accent/40 underline-offset-2 hover:decoration-accent";function u6({href:e,label:t}){let n,r,i,a=e.replace(/\\([()])/g,"$1"),s=(n=a.replace(/^file:\/\//,""),/^(?:\/|~\/)/.test(n)?n:null);if(null!==s&&null!==(0,ar.fn)(s))return(0,U.jsx)("a",{href:(0,ap.Fe)(s),title:a,className:u3,onClick:e=>{e.preventDefault();for(let e of[...ag])e({path:s})},children:t});let l=null!==s?(i=(r=e.replace(/\\([()])/g,"$1")).replace(/^file:\/\//,""),/^(?:\/|~\/)/.test(i)?`#f=${encodeURIComponent(i.replace(/:\d+$/,""))}`:r):a,o=/^https?:\/\//.test(l);return(0,U.jsx)("a",{href:l,target:o?"_blank":void 0,rel:o?"noreferrer":void 0,title:a,className:u3,children:t})}function u8({alt:e,src:t}){let[n,r]=(0,Y.useState)(!1),[i,a]=(0,Y.useState)(!1),s=function(e){let t=e.replace(/\\([()])/g,"$1");if(/^(?:https?:)?\/\//.test(t)||t.startsWith("data:"))return t;let n=t.replace(/^file:\/\//,"");return`/api/image?path=${encodeURIComponent(n)}`}(t);return i?(0,U.jsx)(u6,{href:t,label:e||t}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("img",{src:s,alt:e,title:e||void 0,loading:"lazy",onClick:()=>r(!0),onError:()=>a(!0),className:"my-1 max-h-[240px] max-w-full cursor-zoom-in rounded-[10px] border border-border align-top"}),n?(0,U.jsx)(uY,{src:s,alt:e,caption:e||void 0,onClose:()=>r(!1)}):null]})}function u7({images:e}){return(0,U.jsx)("div",{className:"my-1.5 flex flex-wrap items-start gap-2",children:e.map((e,t)=>(0,U.jsx)(u8,{alt:e.alt,src:e.src},t))})}function u9(e){return e.split(uZ).map((e,t)=>{if(!e)return null;if(e.startsWith("`")&&e.endsWith("`"))return(0,U.jsx)(u5,{text:e.slice(1,-1)},t);if(e.startsWith("**")&&e.endsWith("**"))return(0,U.jsx)("b",{children:u9(e.slice(2,-2))},t);let n=e.match(u1);if(n)return(0,U.jsx)(u8,{alt:n[1],src:n[2]},t);let r=e.match(u2);if(r)return(0,U.jsx)(u6,{href:r[2],label:r[1]},t);if(/^https?:\/\//.test(e)){let n=e.replace(/[.,;:!?…»)]+$/,""),r=e.slice(n.length),i=n.length>72?n.slice(0,69)+"…":n;return(0,U.jsxs)("span",{children:[(0,U.jsx)(u6,{href:n,label:i}),r]},t)}return e})}let pe=/^\s*\|.*\|\s*$/,pt=/^:?-{1,}:?$/;function pn({rows:e}){let t=e.map(e=>e.trim().replace(/^\|/,"").replace(/\|$/,"").split("|").map(e=>e.trim())),n=t.length>1&&t[1].every(e=>pt.test(e)),r=n?t[0]:null,i=n?t.slice(2):t;return(0,U.jsx)("div",{className:"my-1.5 max-w-full overflow-x-auto",children:(0,U.jsxs)("table",{className:"border-collapse text-[12.5px]",children:[r?(0,U.jsx)("thead",{children:(0,U.jsx)("tr",{children:r.map((e,t)=>(0,U.jsx)("th",{className:"border border-border bg-sunken px-2.5 py-1 text-left font-semibold",children:u9(e)},t))})}):null,(0,U.jsx)("tbody",{children:i.map((e,t)=>(0,U.jsx)("tr",{children:e.map((e,t)=>(0,U.jsx)("td",{className:"border border-border px-2.5 py-1 align-top",children:u9(e)},t))},t))})]})})}let pr=/^\s*```/,pi=/^\s*```\s*$/;function pa(e){return e.match(/^\s*```+\s*([A-Za-z0-9+#_-]+)/)?.[1]??null}function ps(e,t){let n=e.match(/^#{1,6}\s+(.*)$/);if(n)return(0,U.jsx)("span",{className:"text-[14px] font-bold",children:u9(n[1])},t);let r=e.match(/^>\s?(.*)$/);return r?(0,U.jsx)("span",{className:"border-l-2 border-border pl-2 text-muted",children:u9(r[1])},t):(0,U.jsx)(Y.Fragment,{children:u9(e)},t)}function pl(e){let t=e.split("\n"),n=[],r=0;for(;r<t.length;){if(pr.test(t[r])){let e=r,i=pa(t[r]);for(r++;r<t.length&&!pi.test(t[r]);)r++;let a=t.slice(e+1,r).join("\n");r<t.length&&r++,"\n"===n[n.length-1]&&n.pop(),n.push((0,U.jsx)(u4,{code:a,lang:i},`c${e}`));continue}if(pe.test(t[r])){let e=r;for(;r<t.length&&pe.test(t[r]);)r++;"\n"===n[n.length-1]&&n.pop(),n.push((0,U.jsx)(pn,{rows:t.slice(e,r)},`t${e}`));continue}if(u0.test(t[r])){let e=r,i=[];for(;r<t.length;){let e=t[r].match(u0);if(!e)break;i.push({alt:e[1],src:e[2]}),r++}"\n"===n[n.length-1]&&n.pop(),n.push((0,U.jsx)(u7,{images:i},`i${e}`));continue}n.push(ps(t[r],r)),++r<t.length&&n.push("\n")}return n}function po({nodes:e}){return e}function pc(){return{chunks:[],keys:0}}function pd(e,t,n){let r=e.chunks[e.chunks.length-1];if(r&&r.nodes.length<48)return r;let i={key:e.keys++,from:t,sep:n,lines:0,nodes:[],element:null};return e.chunks.push(i),i}function pu(e){let t=e.chunks[e.chunks.length-1];t.element=(0,U.jsx)(po,{nodes:t.nodes},t.key)}function pp(e){return e.chunks.map(e=>e.element)}function pm(){return{stableChars:0,stableLines:0,lineStart:!0,region:pc(),run:null,sep:!1,provisional:!1,anchor:"",source:"",streaming:!1,rendered:null,keys:0}}function pf(e,t){var n,r;let i=e.run,a=e.region.chunks[e.region.chunks.length-1];a.nodes.length=i.slot;let{node:s,block:l}=(n=i,r=t,"images"===n.kind?{node:(0,U.jsx)(u7,{images:n.images},`i${n.key}`),block:!0}:"table"===n.kind?!r&&n.rows.length<2?{node:ps(n.rows[0],`p${n.key}`),block:!1}:{node:(0,U.jsx)(pn,{rows:n.rows},`t${n.key}`),block:!0}:r?(n.joined??=n.code.join("\n"),{node:(0,U.jsx)(u4,{code:n.joined,lang:n.lang},`c${n.key}`),block:!0}):{node:(0,U.jsx)(po,{nodes:pp(n.body)},`f${n.key}`),block:!1});!l&&i.sep&&a.nodes.push("\n"),a.nodes.push(s),e.sep=!l,pu(e.region)}function ph(e){pf(e,!0),e.run=null,e.provisional=!1}function px(e,t,n){let r=pd(e.body,0,!1);e.shown++>0&&r.nodes.push("\n"),r.nodes.push((0,U.jsx)(Y.Fragment,{children:t},n)),pu(e.body)}function pg(e,t,n){var r;let i,a=e.run;if(a){let n=e.region.chunks[e.region.chunks.length-1];if("fence"===a.kind)return(n.lines++,pi.test(t))?void ph(e):(a.code.push(t),a.joined=null,px(a,t,e.keys++),void pf(e,!1));if("table"===a.kind&&pe.test(t)){n.lines++,a.rows.push(t),pf(e,!1);return}if("images"===a.kind){let r=t.match(u0);if(r){n.lines++,a.images.push({alt:r[1],src:r[2]}),pf(e,!1);return}}ph(e)}let s=pd(e.region,n,e.sep);if(s.lines++,pr.test(t)){e.run={kind:"fence",slot:s.nodes.length,sep:e.sep,key:e.keys++,lang:pa(t),code:[],joined:null,body:pc(),shown:0},px(e.run,t,e.keys++),pf(e,!1);return}if(pe.test(t)){e.run={kind:"table",slot:s.nodes.length,sep:e.sep,key:e.keys++,rows:[t]},pf(e,!1);return}let l=t.match(u0);if(l){e.run={kind:"images",slot:s.nodes.length,sep:e.sep,key:e.keys++,images:[{alt:l[1],src:l[2]}]},pf(e,!1);return}r=ps(t,e.keys++),i=e.region.chunks[e.region.chunks.length-1],e.sep&&i.nodes.push("\n"),i.nodes.push(r),e.sep=!0,pu(e.region)}function pb({text:e,streaming:t}){let[n]=(0,Y.useState)(pm);return function(e,t,n){if(null!==e.rendered&&t===e.source&&n===e.streaming)return e.rendered;0===e.stableChars||e.lineStart&&!(t.length<e.source.length)&&10===t.charCodeAt(e.stableChars-1)&&t.startsWith(e.source)||function(e,t,n){if(!n||!e.anchor||!e.lineStart)return!1;let r=t.lastIndexOf(e.anchor);if(r<0)return!1;let i=r+e.anchor.length,a=e.stableChars-i;if(a<=0||!t.startsWith(e.source.slice(a)))return!1;let s=e.region.chunks;for(let e of s)e.from-=a;let l=s.findIndex(e=>e.from>=0);if(l<0)return!1;let o=s.slice(l),c=pm(),d=o[0].from,u=t.slice(0,d).split("\n"),p=0;for(let e=0;e<u.length-1;e++)pg(c,u[e],p),p+=u[e].length+1;if(c.run||c.sep!==o[0].sep)return!1;for(let t of c.region.chunks)t.key=e.region.keys++,t.element=(0,U.jsx)(po,{nodes:t.nodes},t.key);return e.region.chunks=[...c.region.chunks,...o],e.stableChars=i,e.stableLines=e.region.chunks.reduce((e,t)=>e+t.lines,0),!0}(e,t,n)||(e.stableChars=0,e.stableLines=0,e.lineStart=!0,e.region=pc(),e.run=null,e.sep=!1,e.provisional=!1,e.anchor="");let r=t.slice(e.stableChars).split("\n"),i=n?r.length-1:r.length,a=e.stableChars;for(let t=0;t<i;t++)pg(e,r[t],a),a+=r[t].length+1,e.provisional=!1;i>0&&(e.lineStart=a<=t.length,e.stableChars=Math.min(a,t.length),e.stableLines+=i,e.anchor=t.slice(Math.max(0,e.stableChars-128),e.stableChars)),!n&&e.run&&ph(e);let s=null;if(n){let t=r[r.length-1],n=e.run?.kind==="fence"&&pi.test(t);if(n!==e.provisional&&(pf(e,n),e.provisional=n),!n){let n=[];e.sep&&n.push("\n");let r=e.run?.kind==="fence"||u0.test(t);n.push((0,U.jsx)(Y.Fragment,{children:r?t:u9(t)},"v")),s=n}}let l=(0,U.jsxs)(U.Fragment,{children:[pp(e.region),s]});return e.source=t,e.streaming=n,e.rendered=l,l}(n,e,t)}var pv=n(7516);let pw=/^\*{0,3}\s*(?:Add|Update|Delete) File:\s*(.+)$/;function py({item:e,tool:t}){let{t:n}=(0,eh.Ym)(),r=(0,Y.useMemo)(()=>(0,pv.K8)(t.name,t.args,t.engine),[t.name,t.args,t.engine]),i="err"===t.status,a="run"===t.status?n("render.executing"):"err"===t.status?n("render.error"):"unknown"===t.status?n("feed.liveToolOutcomeOmitted"):"",s="apply_patch"!==t.name||r.chips.length?"":function(e){if("string"!=typeof e)return"";let t=e.split("\n").flatMap(e=>{let t=e.match(pw);if(!t)return[];let n=t[1].trim().replace(/[/\\]+$/,"");return[n.split(/[/\\]/).pop()||n]});return t.slice(0,4).join(", ")+(t.length>4?", …":"")}(t.args.input),l=s?`${r.summary} \xb7 ${s}`:r.summary,o=t.argsOmitted?`${l} \xb7 ${n("feed.liveToolArgsOmitted")}`:l,c=(0,tw.T0)(e.completedAt??e.startedAt??void 0);return(0,U.jsxs)("div",{"data-live-turn":!0,"data-live-turn-item-id":e.itemId??void 0,"data-live-tool":t.name,"data-live-tool-status":t.status,className:`ml-9 flex items-center gap-2 rounded-control py-0.5 text-ui ${i?"border-l-2 border-danger bg-danger-soft pl-2 pr-1 text-danger":"text-muted"}`,children:[(0,U.jsx)(sx.c9,{name:r.icon,className:"h-3.5 w-3.5 shrink-0"}),(0,U.jsx)("span",{className:`min-w-0 flex-1 truncate ${i?"font-semibold":"text-secondary"}`,title:o,children:o}),"ok"!==t.status?(0,U.jsxs)("span",{className:`inline-flex shrink-0 items-center gap-1 text-caption font-semibold ${i?"text-danger":"text-muted"}`,children:["unknown"!==t.status?(0,U.jsx)(uU,{status:t.status,className:"h-3 w-3"}):null,a]}):null,c?(0,U.jsx)("span",{className:"shrink-0 text-caption tabular-nums text-muted",children:c}):null]})}function pk({items:e}){let{t}=(0,eh.Ym)();return e.length?(0,U.jsx)("div",{"data-live-turn-group":!0,children:e.map((n,r)=>n.tool?(0,U.jsx)(py,{item:n,tool:n.tool},n.itemId??`${n.startedAt??"live"}:${r}`):(0,U.jsxs)("div",{"data-live-turn":!0,"data-live-turn-item-id":n.itemId??void 0,className:"my-2 ml-9 whitespace-pre-wrap [overflow-wrap:anywhere] text-ui text-primary",children:[n.omittedItems?(0,U.jsx)("span",{"data-live-turn-omitted-items":!0,className:"text-muted",children:`${t("feed.liveOmittedItems",{count:n.omittedItems,chars:n.omittedChars??0})}
|
|
66
|
-
`}):n.omittedChars?(0,U.jsx)("span",{"data-live-turn-omitted-chars":!0,className:"text-muted",children:`${t("feed.liveOmittedChars",{chars:n.omittedChars})}
|
|
67
|
-
`}):null,(0,U.jsx)(pb,{text:n.text,streaming:"streaming"===n.phase}),"streaming"===n.phase&&r===e.length-1?(0,U.jsx)("span",{className:"ml-0.5 inline-block h-3.5 w-1.5 animate-pulse rounded-[2px] bg-accent align-text-bottom","aria-hidden":!0}):null]},n.itemId??`${n.startedAt??"live"}:${r}`))}):null}function pj({entries:e,t,onCancel:n,onRetry:r,switchHold:i=null}){return e.length?(0,U.jsx)("div",{"data-outbox":!0,"aria-label":t("outbox.queueAria"),role:"log","aria-live":"polite",children:e.map(e=>{let a=function(e,t,n){if(n&&("delivering"===t.state||"queued"===t.state))return{label:n.label?e("outbox.heldForSwitch",{label:n.label}):e("outbox.heldForSwitchUnnamed"),icon:(0,U.jsx)(uD.A,{className:"h-3 w-3","aria-hidden":!0}),className:"text-warning"};switch(t.state){case"delivering":return{label:e("outbox.delivering"),icon:(0,U.jsx)(sx.kr,{className:"h-3 w-3 animate-spin motion-reduce:animate-none","aria-hidden":!0}),className:"text-warning"};case"failed":return{label:t.needsReattach?e("outbox.reattach"):t.error??e("outbox.failed"),icon:(0,U.jsx)(i4.A,{className:"h-3 w-3","aria-hidden":!0}),className:"text-danger"};case"delivered":return{label:e("outbox.delivered"),icon:null,className:"text-muted"};default:return{label:e("outbox.queued"),icon:(0,U.jsx)(uD.A,{className:"h-3 w-3","aria-hidden":!0}),className:"text-warning"}}}(t,e,i);return(0,U.jsx)("div",{"data-outbox-entry":e.id,"data-outbox-state":e.state,className:"group/msg my-3 flex items-start justify-end gap-1.5",children:(0,U.jsxs)("div",{className:"flex max-w-[75%] flex-col items-end gap-1",children:[(0,U.jsxs)("div",{className:"w-full whitespace-pre-wrap break-words rounded-surface bg-user px-4 py-2.5 opacity-80",children:[pl(e.text),e.images?(0,U.jsx)("span",{className:"mt-1 block text-caption font-semibold text-muted",children:t("composer.imagesCount",{count:e.images})}):null]}),(0,U.jsxs)("div",{className:`flex items-center gap-1 text-caption font-semibold ${a.className}`,children:[a.icon,(0,U.jsx)("span",{"data-outbox-status":!0,className:"min-w-0 truncate",children:a.label}),"failed"!==e.state||e.needsReattach?null:(0,U.jsx)("button",{type:"button","data-outbox-retry":e.id,"aria-label":t("outbox.retry"),title:t("outbox.retry"),onClick:()=>r(e.id),className:"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded text-muted hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 [@media(pointer:coarse)]:h-11 [@media(pointer:coarse)]:w-11",children:(0,U.jsx)(sg.A,{className:"h-3 w-3","aria-hidden":!0})}),"queued"===e.state||"failed"===e.state?(0,U.jsx)("button",{type:"button","data-outbox-cancel":e.id,"aria-label":t("outbox.cancel"),title:t("outbox.cancel"),onClick:()=>n(e.id),className:"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded text-muted hover:text-danger focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 [@media(pointer:coarse)]:h-11 [@media(pointer:coarse)]:w-11",children:(0,U.jsx)(sx.X,{className:"h-3 w-3","aria-hidden":!0})}):null]})]})},e.id)})}):null}function pN({cardId:e,entries:t,switchHold:n=null}){let{t:r}=(0,eh.Ym)();return(0,U.jsx)(pj,{entries:t,t:r,onCancel:t=>oe(e,t),onRetry:t=>{let n,r;(r=(n=l8(e)).find(e=>e.id===t))&&"failed"===r.state&&!r.needsReattach&&l5(e,n.map(e=>e.id===t?{...e,state:"queued",error:void 0}:e))},switchHold:n})}let pS=new Map,pC=new Set,pA=new Set,pI=e=>`llvAssistantClaims:${e}`;function pM({item:e}){return"sourceId"in e&&"string"==typeof e.sourceId&&e.sourceId?e.sourceId:null}function pT({item:e}){return"tool"===e.kind?e.id?[e.id]:[]:"cmd-group"===e.kind?e.ids.filter(e=>"string"==typeof e&&e.length>0):[]}function pP(e){let t=pM(e);return[...t?[t]:[],...pT(e)]}function p$(e){let t=pS.get(e);if(t)return t;try{let t=JSON.parse(sessionStorage.getItem(pI(e))??"[]"),n=new Set(Array.isArray(t)?t.filter(e=>"string"==typeof e&&e.length>0).slice(-544):[]);return pS.set(e,n),n}catch{return pS.set(e,pA),pA}}function pE(e,t){pS.set(e,t);try{t.size?sessionStorage.setItem(pI(e),JSON.stringify([...t])):sessionStorage.removeItem(pI(e))}catch{}}function pR(e){if("string"!=typeof e&&"number"!=typeof e)return null;let t=Date.parse(String(e));return Number.isFinite(t)?t:null}let pO=["launch","outbox","delta"];function pD({name:e,path:t}){let{t:n}=(0,eh.Ym)(),[r,i]=(0,Y.useState)("thumb"),[a,s]=(0,Y.useState)(null),[l,o]=(0,Y.useState)(!1),[c,d]=(0,Y.useState)(!1),[u,p]=(0,Y.useState)("");(0,Y.useEffect)(()=>{if(!l)return;let e=window.setTimeout(()=>o(!1),5e3);return()=>window.clearTimeout(e)},[l]);let m=`/api/inbox?name=${encodeURIComponent(e)}`,f=async()=>{d(!0),p("");try{let e=await fetch(m,{method:"DELETE"}),t=await e.json();if(!e.ok||!t.ok)return void p(t.error??n("common.failedDelete"));s("deleted")}catch{p(n("common.serverUnavailable"))}finally{d(!1),o(!1)}};return a?(0,U.jsx)("div",{className:"my-2 flex justify-end",children:(0,U.jsxs)("span",{className:"inline-flex max-w-[75%] items-center gap-1.5 rounded-full border border-border bg-sunken px-2.5 py-1 text-[11.5px] font-semibold text-muted",title:t,children:[(0,U.jsx)(sx.c9,{name:"image",className:"h-3.5 w-3.5"}),(0,U.jsx)("span",{className:"truncate",children:e}),(0,U.jsxs)("span",{className:"shrink-0",children:["\xb7 ","deleted"===a?n("inbox.deleted"):n("inbox.fileGone")]})]})}):"chip"===r?(0,U.jsx)("div",{className:"my-2 flex justify-end",children:(0,U.jsxs)("button",{type:"button",onClick:()=>i("thumb"),className:"inline-flex max-w-[75%] items-center gap-2 rounded-[14px] border border-border bg-card px-3.5 py-2 text-[13px] shadow-1",title:t,children:[(0,U.jsx)("span",{className:"flex h-6.5 w-6.5 shrink-0 items-center justify-center rounded-lg bg-sunken",children:(0,U.jsx)(sx.c9,{name:"image",className:"h-4 w-4"})}),(0,U.jsx)("span",{className:"truncate font-mono text-[12px]",children:e}),(0,U.jsx)("span",{className:"shrink-0 text-[12px] font-semibold text-accent",children:n("common.show")})]})}):(0,U.jsxs)("div",{className:"my-2 flex justify-end",children:[(0,U.jsxs)("div",{className:"max-w-[75%]",children:[(0,U.jsx)("img",{src:m,alt:n("inbox.attachedAlt",{name:e}),onClick:()=>i("full"),onError:()=>s("missing"),className:"ml-auto block max-h-[240px] cursor-zoom-in rounded-[14px] border border-border"}),(0,U.jsxs)("div",{className:"mt-1 flex flex-wrap items-center justify-end gap-1.5 text-[11px]",children:[(0,U.jsx)("span",{className:"min-w-0 truncate font-mono text-muted",title:t,children:e}),(0,U.jsx)("button",{type:"button",onClick:()=>i("chip"),className:"shrink-0 text-muted hover:text-primary",children:n("common.collapse")}),l?(0,U.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-[10px] border border-danger/30 bg-danger-soft px-1.5 py-0.5",children:[(0,U.jsx)("span",{className:"px-1 font-semibold text-danger",children:n("inbox.confirmDelete")}),(0,U.jsx)("button",{type:"button",className:"rounded-lg bg-danger px-2 py-0.5 font-bold text-white disabled:opacity-60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-danger/50",disabled:c,onClick:f,children:c?n("trash.deleting"):n("trash.confirmYes")}),(0,U.jsx)("button",{type:"button",className:"rounded-lg border border-border bg-card px-2 py-0.5 font-semibold text-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>o(!1),children:n("common.cancel")})]}):(0,U.jsxs)("button",{type:"button",onClick:()=>o(!0),"aria-label":n("inbox.deleteAria",{name:e}),className:"inline-flex shrink-0 items-center gap-1 rounded-full border border-border bg-card px-2 py-0.5 font-semibold text-muted hover:border-danger/40 hover:text-danger focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:[(0,U.jsx)(sx.TB,{className:"h-3 w-3","aria-hidden":!0})," ",n("inbox.deleteFromDisk")]}),u?(0,U.jsx)("span",{className:"shrink-0 font-semibold text-danger",children:u}):null]})]}),"full"===r?(0,U.jsx)(uY,{src:m,alt:n("inbox.attachedAlt",{name:e}),caption:t,onClose:()=>i("thumb")}):null]})}var pL=n(3719);let p_=new Uint32Array([0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5,0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174,0xe49b69c1,0xefbe4786,0xfc19dc6,0x240ca1cc,0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da,0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,0xc6e00bf3,0xd5a79147,0x6ca6351,0x14292967,0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85,0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3,0xd192e819,0xd6990624,0xf40e3585,0x106aa070,0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3,0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208,0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2]),pF=(e,t)=>e>>>t|e<<32-t;function pq(e){return function(e){let t=new Uint32Array([0x6a09e667,0xbb67ae85,0x3c6ef372,0xa54ff53a,0x510e527f,0x9b05688c,0x1f83d9ab,0x5be0cd19]),n=new Uint8Array(64*Math.ceil((e.length+9)/64));n.set(e),n[e.length]=128;let r=new DataView(n.buffer),i=8*e.length;r.setUint32(n.length-8,Math.floor(i/0x100000000),!1),r.setUint32(n.length-4,i>>>0,!1);let a=new Uint32Array(64);for(let e=0;e<n.length;e+=64){for(let t=0;t<16;t+=1)a[t]=r.getUint32(e+4*t,!1);for(let e=16;e<64;e+=1){let t=a[e-15],n=a[e-2],r=pF(t,7)^pF(t,18)^t>>>3,i=pF(n,17)^pF(n,19)^n>>>10;a[e]=a[e-16]+r+a[e-7]+i>>>0}let n=t[0],i=t[1],s=t[2],l=t[3],o=t[4],c=t[5],d=t[6],u=t[7];for(let e=0;e<64;e+=1){let t=u+(pF(o,6)^pF(o,11)^pF(o,25))+(o&c^~o&d)+p_[e]+a[e]>>>0,r=(pF(n,2)^pF(n,13)^pF(n,22))+(n&i^n&s^i&s)>>>0;u=d,d=c,c=o,o=l+t>>>0,l=s,s=i,i=n,n=t+r>>>0}t[0]=t[0]+n>>>0,t[1]=t[1]+i>>>0,t[2]=t[2]+s>>>0,t[3]=t[3]+l>>>0,t[4]=t[4]+o>>>0,t[5]=t[5]+c>>>0,t[6]=t[6]+d>>>0,t[7]=t[7]+u>>>0}let s="";for(let e of t)s+=e.toString(16).padStart(8,"0");return s}(new TextEncoder().encode(JSON.stringify({text:e,images:[]})))}function pz(e){let t,n;if("user"===e.kind||"tmsg"===e.kind)t=e.ts,n=e.text;else{if("sysmsg"!==e.kind||!e.deliveredMessage)return null;t=e.deliveredMessage.ts,n=e.text}if(!n.trim())return null;let r="string"==typeof t||"number"==typeof t?new Date(t).getTime():NaN;return Number.isFinite(r)?{item:e,text:n,tsMs:r}:null}let pH=new WeakMap;function pU(e){let t=pH.get(e.item);if(t)return t;let n=e.text.trim(),r=[pq(n)];return n!==e.text&&r.push(pq(e.text)),pH.set(e.item,r),r}function pB(e,t){let n=new Map;if(0===t.length)return n;let r=new Map;for(let t of e){let e=pz(t);if(e)for(let t of pU(e)){let n=r.get(t);n?n.push(e):r.set(t,[e])}}if(0===r.size)return n;for(let{occurrence:e,settledMs:i}of t.map(e=>({occurrence:e,settledMs:Date.parse(e.deliveredAt)})).filter(({settledMs:e})=>Number.isFinite(e)).sort((e,t)=>e.settledMs-t.settledMs)){let t=r.get(e.textDigest);if(!t)continue;let a=null,s=1/0;for(let e of t){if(n.has(e.item))continue;let t=Math.abs(e.tsMs-i);t<=6e5&&t<s&&(a=e,s=t)}a&&n.set(a.item,{origin:e.origin,...e.senderRole?{senderRole:e.senderRole}:{},...e.selectedContext?{selectedContext:e.selectedContext}:{}})}return n}class pK{constructor(e){if(this.limit=e,this.values=new Map,!Number.isInteger(e)||e<1)throw Error("BoundedLru limit must be a positive integer")}get size(){return this.values.size}get(e){let t=this.values.get(e);if(void 0!==t)return this.values.delete(e),this.values.set(e,t),t}set(e,t){for(this.values.delete(e),this.values.set(e,t);this.values.size>this.limit;){let e=this.values.keys().next().value;if(void 0===e)return;this.values.delete(e)}}clear(){this.values.clear()}}let pY={forItem:()=>null},pW=(0,Y.createContext)(pY),pV=pW.Provider,pJ=new pK(48),pG=[1500,4e3,1e4];function pQ(e){if(!e||"object"!=typeof e||Array.isArray(e)||"operator"!==e.origin&&"agent"!==e.origin)return null;let t=(0,pL.S)(e.senderRole),n=(0,si.po)(e.selectedContext);return{origin:e.origin,...t?{senderRole:t}:{},...n?{selectedContext:n}:{}}}let pX=/^[a-f0-9]{64}$/;function pZ(e,t,n,r){if(0===e.drivers.length)return!1;if(!t)return!0;let i=pB(e.candidates,t.occurrences);return e.drivers.some(e=>!(e.engineMessageId&&e.engineMessageId in t.messages||i.has(e.item))&&(!!e.engineMessageId||!n||r-e.tsMs<12e4))}let p0=new WeakMap,p1=1,p2=[];function p5({bytes:e,text:t}){let[n,r]=(0,Y.useState)(!1),i=Math.round(e/1024);return n?(0,U.jsxs)("div",{className:"my-2 ml-9 overflow-hidden rounded-surface border border-border bg-card",children:[(0,U.jsx)("pre",{className:"max-h-[340px] overflow-auto whitespace-pre-wrap break-all bg-sunken px-3 py-2 font-mono text-[11.5px]",children:t}),(0,U.jsx)("button",{type:"button",onClick:()=>r(!1),className:"block w-full border-t border-border px-3 py-1.5 text-[12px] text-muted",children:(0,uJ.tr)("common.collapse")})]}):(0,U.jsxs)("button",{type:"button",onClick:()=>r(!0),className:"my-2 ml-9 flex items-center gap-2 rounded-surface border border-border bg-card px-3 py-1.5 text-[13px]",children:[(0,U.jsx)("span",{className:"flex h-6 w-6 items-center justify-center rounded-lg bg-sunken",children:(0,U.jsx)(sx.c9,{name:"blob",className:"h-3.5 w-3.5"})}),(0,U.jsx)("span",{className:"font-semibold",children:(0,uJ.tr)("render.dataKb",{n:i})}),(0,U.jsx)("span",{className:"ml-1 text-[12px] font-semibold text-accent",children:(0,uJ.tr)("common.show")})]})}let p4=new Set(["wait","write_stdin"]);function p3(e){return p4.has(e.tool)}function p6(e){let t=(0,eh.JK)(),n=(e,n)=>(0,eh.Tl)(t,e,n);if(!Number.isFinite(e)||e<0)return"";if(e<1e3)return n("tools.durationMs",{n:Math.round(e)});let r=e/1e3;if(r<60)return n("tools.durationSec",{n:r<10?Math.round(10*r)/10:Math.round(r)});let i=Math.round(r);return n("tools.durationMin",{m:Math.floor(i/60),s:i%60})}let p8={add:"text-diff-add",update:"text-accent",delete:"text-diff-del",move:"text-accent"};function p7({line:e}){let t="+"===e.t?"bg-diff-add-soft text-diff-add":"-"===e.t?"bg-diff-del-soft text-diff-del":"text-primary",n="+"===e.t?"bg-diff-add-strong":"bg-diff-del-strong";return(0,U.jsxs)("div",{className:`whitespace-pre px-2 ${t}`,children:[e.t,e.intraline?e.intraline.map((e,t)=>e.changed?(0,U.jsx)("span",{className:n,children:e.text},t):e.text):e.text||" "]})}function p9({file:e}){var t;let[n,r]=(0,Y.useState)(!1),i=function(e){let t=[];for(let n of e){let e=!0;for(let r of n.lines)t.push({line:r,header:e?n.header:void 0}),e=!1}return t}(e.hunks),a=i.length>8,s=n?i:i.slice(0,8),l=e.hunks.flatMap(e=>e.lines.map(e=>e.t+e.text)).join("\n");return(0,U.jsxs)("div",{className:"group/diff relative overflow-hidden rounded-[10px] border border-border bg-sunken",children:[(0,U.jsxs)("div",{className:"flex items-center gap-2 border-b border-border px-2.5 py-1 text-[11.5px]",children:[(0,U.jsx)("span",{className:`shrink-0 font-semibold uppercase ${p8[e.op]}`,children:e.op}),(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate",children:(0,U.jsx)(uB,{file:e.path})}),e.binary?null:(0,U.jsxs)("span",{className:"shrink-0 font-mono text-[11px]",children:[(0,U.jsxs)("span",{className:"text-diff-add",children:["+",e.added]})," ",(0,U.jsxs)("span",{className:"text-diff-del",children:["−",e.removed]})]}),l?(0,U.jsx)(uK.i,{text:l,label:(0,uJ.tr)("tools.copyDiff"),className:`shrink-0 ${uW} group-hover/diff:opacity-100`}):null]}),e.binary?(0,U.jsx)("div",{className:"px-2.5 py-2 text-[11.5px] text-muted",children:(0,uJ.tr)("tools.binaryContent",{size:(t=e.added+e.removed,`${Math.max(1,Math.round(t/1024))} kB`)})}):i.length?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("div",{className:"max-w-full overflow-x-auto py-1 font-mono text-[11.5px] leading-[1.5]",children:s.map(({line:e,header:t},n)=>(0,U.jsxs)("div",{children:[t?(0,U.jsx)("div",{className:"whitespace-pre px-2 text-muted",children:`@@ ${t}`}):null,(0,U.jsx)(p7,{line:e})]},n))}),a?(0,U.jsx)("button",{type:"button",onClick:()=>r(e=>!e),className:"w-full border-t border-border px-2.5 py-1 text-left text-[11px] font-semibold text-accent hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:n?(0,U.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,uJ.tr)("common.collapse")," ",(0,U.jsx)(sx.rX,{className:"h-3 w-3","aria-hidden":!0})]}):(0,uJ.tr)("tools.showAllLines",{count:i.length})}):null]}):null,e.truncated?(0,U.jsx)("div",{className:"border-t border-border px-2.5 py-0.5 text-[10.5px] text-muted",children:(0,uJ.tr)("tools.diffTruncated")}):null]})}function me({body:e}){return(0,U.jsxs)("div",{className:"mt-1.5 space-y-1.5",children:[e.files.map((e,t)=>(0,U.jsx)(p9,{file:e},`${e.path}:${t}`)),e.filesTruncated?(0,U.jsx)("div",{className:"text-[11px] text-muted",children:(0,uJ.tr)("tools.moreFiles",{count:e.files.length})}):null]})}function mt({call:e}){return(0,U.jsxs)("div",{className:"flex items-start gap-2 py-0.5 font-mono text-[11.5px] text-secondary",children:[(0,U.jsx)(sx.c9,{name:e.icon,className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-muted"}),(0,U.jsx)("span",{className:"min-w-0 flex-1 [overflow-wrap:anywhere]",children:e.summary})]})}function mn({orchestration:e}){return e.calls.length?(0,U.jsx)("div",{className:"mt-1.5 space-y-1.5",children:(0,U.jsxs)("div",{children:[(0,U.jsx)("div",{className:"mb-0.5 text-[10.5px] font-semibold uppercase tracking-wide text-muted",children:(0,uJ.tr)("tools.nestedCalls")}),e.calls.map((e,t)=>(0,U.jsx)(mt,{call:e},`${e.id}:${t}`))]})}):null}function mr({output:e,truncated:t,lang:n,copyLabel:r,heading:i,tone:a="out",showAllLabel:s}){let[l,o]=(0,Y.useState)(!1),c=i?(0,U.jsx)("div",{className:`mb-0.5 text-[10.5px] font-semibold uppercase tracking-wide ${"err"===a?"text-danger":"text-muted"}`,children:i}):null;if(!e.trim())return null;let d=e.split("\n"),u=d.length>24||e.length>4096,p=l?e:d.slice(0,24).join("\n").slice(0,4096),m=l&&n?n:null,f=r??(0,uJ.tr)("tools.copyOutput");return(0,U.jsxs)("div",{className:"group/out relative mt-1.5",children:[c,m?(0,U.jsx)(u4,{code:e,lang:m,copyLabel:f}):(0,U.jsx)("pre",{className:`max-h-[420px] max-w-full overflow-auto whitespace-pre-wrap [overflow-wrap:anywhere] font-mono text-[12px] text-secondary ${uV} ${"err"===a?"border-l-2 border-danger/50 pl-2":""}`,children:p}),m?null:(0,U.jsx)(uK.i,{text:e,label:f,className:`absolute right-[6px] ${uW} group-hover/out:opacity-100 ${i?"top-5":"top-[6px]"}`}),u?(0,U.jsx)("button",{type:"button",onClick:()=>o(e=>!e),className:"mt-1 inline-flex items-center gap-1 text-[11.5px] font-semibold text-accent hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:l?(0,U.jsxs)(U.Fragment,{children:[(0,uJ.tr)("common.collapse")," ",(0,U.jsx)(sx.rX,{className:"h-3 w-3","aria-hidden":!0})]}):(s??(0,uJ.tr)("tools.showOutput"))+(t?" \xb7 "+(0,uJ.tr)("render.truncated"):"")}):t?(0,U.jsx)("div",{className:"mt-1 text-[11px] text-muted",children:(0,uJ.tr)("render.truncated")}):null]})}function mi(e){return"ok"===e?"text-success":"err"===e?"text-danger":"text-muted"}function ma({chips:e}){return e.length?(0,U.jsx)("div",{className:"mb-1 flex flex-wrap gap-1",children:e.map((e,t)=>(0,U.jsxs)("span",{className:"inline-flex max-w-full items-center gap-1 truncate rounded-md bg-sunken px-1.5 py-0.5 font-mono text-[11px] text-primary",children:[e.label?(0,U.jsx)("span",{className:"text-muted",children:e.label}):null,e.value]},t))}):null}function ms({event:e}){let t=(0,tw.T0)(e.ts),n=void 0!==e.endTs?(0,tw.T0)(e.endTs):"",r=n&&t?(0,uJ.tr)("tools.ranAt",{start:t,end:n}):"",i=void 0!==e.durationMs?p6(e.durationMs):"",a=void 0!==e.exitCode?(0,uJ.tr)("tools.exitCode",{code:e.exitCode}):"err"===e.status?e.statusLabel||(0,uJ.tr)("render.error"):"ok"===e.status&&"shell"===e.family?(0,uJ.tr)("tools.exitOk"):null;return e.cwd||r||i||a?(0,U.jsxs)("div",{className:"mb-1 flex min-w-0 flex-wrap items-center gap-x-3 gap-y-0.5 text-[11px] text-muted",children:[a?(0,U.jsxs)("span",{className:`inline-flex items-center gap-1 font-semibold ${mi(e.status)}`,children:[(0,U.jsx)(uU,{status:e.status,className:"h-3 w-3"}),a]}):null,i?(0,U.jsxs)("span",{className:"inline-flex items-center gap-1 tabular-nums",children:[(0,U.jsx)(sx.qk,{className:"h-3 w-3","aria-hidden":!0}),i]}):null,r?(0,U.jsx)("span",{className:"tabular-nums",children:r}):null,e.cwd?(0,U.jsxs)("span",{className:"inline-flex min-w-0 max-w-full items-center gap-1",children:[(0,U.jsx)("code",{className:"min-w-0 truncate font-mono text-[11px] text-secondary",title:e.cwd,children:e.cwd}),(0,U.jsx)(uK.i,{text:e.cwd,label:(0,uJ.tr)("tools.copyCwd"),className:"shrink-0 p-0.5"})]}):null]}):null}function ml({command:e}){return(0,U.jsxs)("div",{className:"group/cmd relative",children:[(0,U.jsxs)("pre",{className:`max-w-full whitespace-pre-wrap [overflow-wrap:anywhere] py-0.5 font-mono text-ui text-primary ${uV}`,children:[(0,U.jsx)("span",{className:"select-none text-muted",children:"$ "}),e]}),(0,U.jsx)(uK.i,{text:e,label:(0,uJ.tr)("tools.copyCommand"),className:`absolute right-[6px] top-[6px] ${uW} group-hover/cmd:opacity-100`})]})}function mo({event:e}){let t=e.body?.type==="diff",n=!(p3(e)&&!e.outputPreview.trim()&&void 0===e.stderr&&"err"!==e.status)&&(!t||!!e.outputPreview.trim());return(0,U.jsxs)("div",{className:"mb-1 mt-1 rounded-surface bg-sunken px-2.5 py-2",children:[(0,U.jsx)(ma,{chips:e.chips}),(0,U.jsx)(ms,{event:e}),e.command?(0,U.jsx)(ml,{command:e.command}):null,e.orchestration?(0,U.jsx)(mn,{orchestration:e.orchestration,source:e.command}):null,t&&e.body?.type==="diff"?(0,U.jsx)(me,{body:e.body}):null,n?(0,U.jsx)(mr,{output:e.outputPreview,truncated:e.outputTruncated,lang:e.lang,heading:void 0!==e.stderr?(0,uJ.tr)("tools.stdout"):void 0}):null,void 0!==e.stderr?(0,U.jsx)(mr,{output:e.stderr,truncated:!!e.stderrTruncated,heading:(0,uJ.tr)("tools.stderr"),tone:"err",copyLabel:(0,uJ.tr)("tools.copyStderr"),showAllLabel:(0,uJ.tr)("tools.showStderr")}):null]})}function mc({events:e,session:t,elapsedMs:n}){let r=e.length,i="number"==typeof n&&n>0?p6(n):"",a=[(0,uJ.tr)("tools.pollRun",{count:r}),t?`→ ${t}`:"",i].filter(Boolean).join(" \xb7 ");return(0,U.jsxs)("div",{className:"flex items-center gap-2 rounded-control py-0.5 text-ui text-muted/80",children:[(0,U.jsx)("span",{className:"shrink-0 select-none text-muted","aria-hidden":!0,children:"↳"}),(0,U.jsx)(sx.c9,{name:"clock",className:"h-3.5 w-3.5 shrink-0"}),(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate tabular-nums text-caption",children:a})]})}function md({event:e,index:t,nested:n=!1}){let r="err"===e.status;return(0,U.jsxs)("div",{className:"min-w-0",children:[(0,U.jsxs)("div",{className:`flex items-center gap-2 rounded-control py-0.5 text-ui ${r?"border-l-2 border-danger bg-danger-soft pl-2 pr-1 text-danger":n?"text-muted/90":"text-muted"}`,children:[void 0!==t?(0,U.jsxs)("span",{className:"shrink-0 tabular-nums text-caption font-semibold text-muted",children:[t,"."]}):null,n?(0,U.jsx)("span",{className:"shrink-0 select-none text-muted","aria-hidden":!0,children:"↳"}):null,(0,U.jsx)(sx.c9,{name:e.icon,className:"h-3.5 w-3.5 shrink-0"}),(0,U.jsx)("span",{className:`min-w-0 flex-1 truncate ${r?"font-semibold":"text-secondary"}`,title:e.summary,children:e.summary}),"ok"!==e.status?(0,U.jsxs)("span",{className:`inline-flex shrink-0 items-center gap-1 text-caption font-semibold ${mi(e.status)}`,children:[(0,U.jsx)(uU,{status:e.status,className:"h-3 w-3"}),e.statusLabel]}):null]}),(0,U.jsx)(mo,{event:e})]})}function mu({event:e,showTime:t=!0,className:n="",index:r,nested:i=!1}){let[a,s]=(0,Y.useState)(e.open),l=(0,tw.T0)(e.ts),o="err"===e.status;return(0,U.jsxs)("details",{className:`group/tool ${n}`,open:e.open,onToggle:e=>{e.currentTarget.open&&s(!0)},children:[(0,U.jsxs)("summary",{className:`flex cursor-pointer list-none items-center gap-2 rounded-control py-0.5 text-ui hover:bg-sunken [@media(pointer:coarse)]:min-h-11 [&::-webkit-details-marker]:hidden ${o?"border-l-2 border-danger bg-danger-soft pl-2 pr-1 text-danger":i?"text-muted/90":"text-muted"}`,children:[void 0!==r?(0,U.jsxs)("span",{className:"shrink-0 tabular-nums text-caption font-semibold text-muted",children:[r,"."]}):null,i?(0,U.jsx)("span",{className:"shrink-0 select-none text-muted","aria-hidden":!0,children:"↳"}):null,(0,U.jsx)(sx.c9,{name:e.icon,className:"h-3.5 w-3.5 shrink-0"}),(0,U.jsx)("span",{className:`min-w-0 flex-1 truncate ${o?"font-semibold":"text-secondary"}`,title:e.summary,children:e.summary}),"ok"!==e.status?(0,U.jsxs)("span",{className:`inline-flex shrink-0 items-center gap-1 text-caption font-semibold ${mi(e.status)}`,children:[(0,U.jsx)(uU,{status:e.status,className:"h-3 w-3"}),e.statusLabel]}):null,t&&l?(0,U.jsx)("span",{className:"shrink-0 text-caption tabular-nums text-muted",children:l}):null]}),a?(0,U.jsx)(mo,{event:e}):null]})}function mp({event:e}){return(0,U.jsx)(mu,{event:e,className:"ml-9"})}function mm({item:e}){let t=e.active,[n,r]=(0,Y.useState)(null),[i,a]=(0,Y.useState)(t),[s,l]=(0,Y.useState)(!1);i!==t&&(a(t),!i||t||s||(l(!0),r(!1)));let o=!!t||(n??e.hasErr),c=Object.entries(e.byTool).map(([e,t])=>`${e} \xd7${t}`).join(" \xb7 "),d=(0,tw.T0)(e.t0),u=(0,tw.T0)(e.t1),p=d&&u&&d!==u?`${d}–${u}`:d||u,m=function(e){let t=[];for(let n of e){if(p3(n)){let e=function(e,t){if(void 0!==t.session){for(let n=e.length-1;n>=0;n-=1)if((0,uJ.sI)(e[n].parent,t))return e[n];return}return e[e.length-1]}(t,n);if(e){e.children.push(n);continue}}t.push({parent:n,children:[]})}return t}(e.calls);return(0,U.jsxs)("details",{className:"group/grp ml-9",open:o,onToggle:e=>{let n=e.currentTarget.open;if(t){n||(e.currentTarget.open=!0);return}n!==o&&r(n)},children:[(0,U.jsxs)("summary",{className:`flex cursor-pointer list-none items-center gap-2 rounded-control py-0.5 text-ui hover:bg-sunken [@media(pointer:coarse)]:min-h-11 [&::-webkit-details-marker]:hidden ${e.hasErr?"text-danger":"text-muted"}`,children:[(0,U.jsx)(sx.c_,{className:"h-3.5 w-3.5 shrink-0 transition-transform motion-reduce:transition-none group-open/grp:rotate-90","aria-hidden":!0}),(0,U.jsxs)("span",{className:"flex min-w-0 flex-1 items-center gap-1 truncate text-secondary",children:[(0,uJ.tr)("render.actions",{count:e.calls.length}),c?" \xb7 "+c:"",e.errCount?(0,U.jsxs)("span",{className:"ml-1 inline-flex items-center gap-0.5 font-semibold text-danger",children:[(0,U.jsx)(uU,{status:"err",className:"h-3 w-3"}),e.errCount]}):null]}),p?(0,U.jsx)("span",{className:"ml-auto shrink-0 text-caption tabular-nums text-muted",children:p}):null]}),o?(0,U.jsx)("ol",{className:"mb-1 mt-1 space-y-0.5",children:m.map((e,t)=>{let n=function(e){let t=[];for(let n of e){if(!0===n.poll&&"err"!==n.status&&!n.outputPreview.trim()&&void 0===n.stderr){let e=t[t.length-1],r="number"==typeof n.durationMs&&Number.isFinite(n.durationMs)?n.durationMs:0;if(e&&"polls"===e.kind){e.events.push(n),void 0===e.session&&void 0!==n.session&&(e.session=n.session),e.elapsedMs=(e.elapsedMs??0)+r;continue}t.push({kind:"polls",events:[n],session:n.session,elapsedMs:r});continue}t.push({kind:"call",event:n})}return t}(e.children);return(0,U.jsxs)("li",{className:"min-w-0",children:[(0,U.jsx)(md,{event:e.parent,index:t+1}),n.length?(0,U.jsx)("div",{className:"ml-4 border-l border-border pl-2",children:n.map((e,t)=>"polls"===e.kind?(0,U.jsx)(mc,{events:e.events,session:e.session,elapsedMs:e.elapsedMs},`poll:${t}`):(0,U.jsx)(md,{event:e.event,nested:!0},`${e.event.id}:${t}`))}):null]},`${e.parent.id}:${t}`)})}):null]})}function mf({item:e}){let t=[e.trigger?(0,uJ.tr)("auto"===e.trigger?"render.compactAuto":"render.compactManual"):"",e.preTokens?(0,uJ.tr)("render.compactPre",{n:Math.round(e.preTokens/1e3)}):"",(0,tw.T0)(e.ts)||""].filter(Boolean).join(" \xb7 ");return(0,U.jsxs)("div",{className:"my-3.5",children:[(0,U.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,U.jsx)("span",{className:"h-px flex-1 bg-info/30","aria-hidden":!0}),(0,U.jsxs)("span",{className:"inline-flex items-center gap-1.5 rounded-full border border-info/30 bg-info-soft px-2.5 py-1 text-[11px] font-bold text-info",children:[(0,U.jsx)(sx.c9,{name:"compact",className:"h-3.5 w-3.5"}),(0,uJ.tr)("render.compacted"),t?(0,U.jsx)("span",{className:"font-semibold tabular-nums opacity-75",children:t}):null]}),(0,U.jsx)("span",{className:"h-px flex-1 bg-info/30","aria-hidden":!0})]}),e.summary?(0,U.jsxs)("details",{className:"group/cmp mt-1.5 text-center",children:[(0,U.jsxs)("summary",{className:"cursor-pointer list-none text-[11px] font-semibold text-info [&::-webkit-details-marker]:hidden",children:[(0,U.jsxs)("span",{className:"group-open/cmp:hidden",children:[(0,uJ.tr)("render.compactSummary")," \xb7 ",(0,uJ.tr)("common.show")]}),(0,U.jsx)("span",{className:"hidden group-open/cmp:inline",children:(0,uJ.tr)("common.collapse")})]}),(0,U.jsx)("pre",{className:"mt-1 max-h-[320px] overflow-auto whitespace-pre-wrap break-words rounded-[10px] border border-border bg-canvas px-3 py-2 text-left font-mono text-[11px] text-secondary",children:e.summary})]}):null]})}function mh({media:e,data:t,w:n,h:r,bytes:i}){let[a,s]=(0,Y.useState)("thumb"),l=Math.round((i??3*t.length/4)/1024),o=n&&r?`${n}\xd7${r}`:(0,uJ.tr)("render.image");if("chip"===a)return(0,U.jsxs)("button",{type:"button",onClick:()=>s("thumb"),className:"my-2 ml-9 flex items-center gap-2 rounded-[14px] border border-border bg-card px-3.5 py-2 text-[13px] shadow-1",children:[(0,U.jsx)("span",{className:"flex h-6.5 w-6.5 items-center justify-center rounded-lg bg-sunken",children:(0,U.jsx)(sx.c9,{name:"image",className:"h-4 w-4"})}),(0,U.jsx)("span",{className:"font-semibold",children:o}),(0,U.jsxs)("span",{className:"text-muted",children:["\xb7 ",l," ",(0,uJ.tr)("common.kb")]}),(0,U.jsx)("span",{className:"ml-1 text-[12px] font-semibold text-accent",children:(0,uJ.tr)("common.show")})]});let c=`data:${e};base64,${t}`;return(0,U.jsxs)("div",{className:"my-2 ml-9",children:[(0,U.jsx)("img",{src:c,alt:`${(0,uJ.tr)("render.image")} ${o}`,onClick:()=>s("full"),className:"max-h-[240px] cursor-zoom-in rounded-[14px] border border-border"}),(0,U.jsx)("button",{type:"button",onClick:()=>s("chip"),className:"mt-1 block text-[12px] text-muted",children:(0,uJ.tr)("common.collapse")}),"full"===a?(0,U.jsx)(uY,{src:c,alt:`${(0,uJ.tr)("render.image")} ${o}`,caption:`${o} \xb7 ${l} ${(0,uJ.tr)("common.kb")}`,onClose:()=>s("thumb")}):null]})}function mx({item:e}){let t=e.entries.slice(0,8),n=e.rolloutIds.slice(0,6);return(0,U.jsxs)("details",{className:"group my-2 ml-9 overflow-hidden rounded-surface border border-border bg-card text-[12px]",children:[(0,U.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-2 px-3 py-1.5",children:[(0,U.jsx)("span",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-lg bg-sunken",children:(0,U.jsx)(sx.c9,{name:"citation",className:"h-3.5 w-3.5"})}),(0,U.jsx)("span",{className:"text-[13px] font-semibold",children:(0,uJ.tr)("render.memoryCitations",{count:e.entries.length})}),(0,U.jsx)("span",{className:"ml-auto text-[11px] font-semibold text-accent group-open:hidden",children:(0,uJ.tr)("common.show")}),(0,U.jsx)("span",{className:"ml-auto hidden text-[11px] font-semibold text-accent group-open:inline",children:(0,uJ.tr)("common.collapse")})]}),(0,U.jsxs)("div",{className:"border-t border-border px-3 py-2",children:[t.length?(0,U.jsx)("div",{className:"divide-y divide-border",children:t.map((e,t)=>(0,U.jsxs)("div",{className:"min-w-0 py-1.5 first:pt-0 last:pb-0",children:[(0,U.jsx)(uB,{file:e.target,line:e.line?Number(e.line.split("-",1)[0]):void 0}),e.note?(0,U.jsx)("div",{className:"mt-1 whitespace-pre-wrap break-words text-[12px] text-secondary",children:e.note}):null]},t))}):(0,U.jsx)("div",{className:"text-[12px] text-muted",children:(0,uJ.tr)("render.noCitations")}),e.entries.length>t.length?(0,U.jsx)("div",{className:"mt-1.5 text-[12px] text-muted",children:(0,uJ.tr)("render.moreEntries",{count:e.entries.length-t.length})}):null,n.length?(0,U.jsxs)("div",{className:"mt-2 flex flex-wrap items-center gap-1.5",children:[(0,U.jsx)("span",{className:"text-[11px] text-muted",children:"rollout:"}),n.map(e=>(0,U.jsx)("code",{className:"rounded-full bg-sunken px-2 py-0.5 font-mono text-[10.5px] text-muted",title:e,children:e.slice(0,8)},e)),e.rolloutIds.length>n.length?(0,U.jsxs)("span",{className:"text-[11px] text-muted",children:["+",e.rolloutIds.length-n.length]}):null]}):null,(0,U.jsxs)("details",{className:"group/raw mt-2 text-[12px]",children:[(0,U.jsxs)("summary",{className:"inline-flex cursor-pointer list-none items-center gap-1 font-semibold text-muted hover:text-accent [&::-webkit-details-marker]:hidden",children:[(0,U.jsx)(sx.c_,{className:"h-3 w-3 transition-transform group-open/raw:rotate-90","aria-hidden":!0}),"raw citation block",e.truncated?" \xb7 "+(0,uJ.tr)("render.truncated"):""]}),(0,U.jsx)("pre",{className:"mt-1 max-h-[260px] overflow-auto whitespace-pre-wrap [overflow-wrap:anywhere] border-t border-border pt-1.5 font-mono text-[11.5px] text-secondary",children:e.raw})]})]})]})}let mg={shutdown_request:{icon:"shutdown",labelKey:"render.shutdownRequest",tone:"amber"},shutdown_response:{icon:"shutdown",labelKey:"render.shutdownResponse",tone:"amber"},plan_approval_request:{icon:"plan",labelKey:"render.planRequest",tone:"accent"},plan_approval_response:{icon:"plan",labelKey:"render.planVerdict",tone:"accent"}};function mb(e){return"string"==typeof e&&e.length?e:void 0}function mv({approve:e}){return(0,U.jsx)("span",{className:`rounded-full border px-2 py-0.5 text-[10.5px] font-extrabold ${e?"border-success/25 bg-success-soft text-success":"border-danger/25 bg-danger-soft text-danger"}`,children:e?(0,uJ.tr)("render.approved"):(0,uJ.tr)("render.rejected")})}function mw({payload:e}){let t=mb(e.from),n=mb(e.requestId),r=(0,tw.T0)(e.timestamp);return t||n||r?(0,U.jsxs)("div",{className:"mt-1.5 flex flex-wrap items-center gap-x-2.5 gap-y-1 text-[11px] text-muted",children:[t?(0,U.jsx)("span",{children:(0,uJ.tr)("render.from",{from:t})}):null,n?(0,U.jsx)("span",{className:"truncate font-mono",title:n,children:n.length>40?n.slice(0,40)+"…":n}):null,r?(0,U.jsx)("span",{className:"tabular-nums",children:r}):null]}):null}function my({payload:e}){let t=mb(e.type),n=t?mg[t]:void 0;if(!n)return(0,U.jsxs)("div",{className:"text-[13px]",children:[(0,U.jsx)("div",{className:"text-muted",children:(0,uJ.tr)("render.structured")}),(0,U.jsxs)("details",{className:"mt-1 text-[12px]",children:[(0,U.jsx)("summary",{className:"cursor-pointer list-none font-semibold text-accent",children:(0,uJ.tr)("render.showJson")}),(0,U.jsx)("pre",{className:"mt-1 max-h-[280px] overflow-auto whitespace-pre-wrap rounded-md bg-sunken px-2.5 py-2 font-mono text-[11.5px]",children:JSON.stringify(e,null,2)})]})]});let r="boolean"==typeof e.approve?e.approve:void 0,i=mb(e.reason)??mb(e.feedback);return(0,U.jsxs)("div",{className:"text-[13px]",children:[(0,U.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,U.jsxs)("span",{className:`inline-flex items-center gap-1 rounded-full border px-2.5 py-0.5 text-[11.5px] font-bold ${"amber"===n.tone?"border-warning/35 bg-warning-soft text-warning":"border-accent/25 bg-accent/10 text-accent"}`,children:[(0,U.jsx)(sx.c9,{name:n.icon,className:"h-3.5 w-3.5"}),(0,uJ.tr)(n.labelKey)]}),void 0!==r?(0,U.jsx)(mv,{approve:r}):null]}),i?(0,U.jsx)("div",{className:"mt-1.5 whitespace-pre-wrap break-words",children:pl(i)}):null,(0,U.jsx)(mw,{payload:e})]})}function mk({verdict:e}){let t="REQUEST_CHANGES"===e?sx.MA:"APPROVE"===e?sx.rW:sx.oF;return(0,U.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,U.jsx)(t,{className:"h-3.5 w-3.5","aria-hidden":!0}),"REQUEST_CHANGES"===e?"REQUEST_CHANGES":"APPROVE"===e?"APPROVE":"COMMENT"]})}function mj({item:e}){var t;let n=e.findings.length,r=e.findings.slice(0,12);return(0,U.jsxs)("div",{className:"my-3 ml-9 overflow-hidden rounded-surface border border-codex/20 bg-card",children:[(0,U.jsxs)("div",{className:"flex flex-wrap items-center gap-2 border-b border-border px-3 py-2",children:[(0,U.jsx)("span",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-lg bg-codex-soft text-codex",children:(0,U.jsx)(sx.uB,{className:"h-3.5 w-3.5","aria-hidden":!0})}),(0,U.jsx)("span",{className:"text-[13px] font-bold",children:"Codex review"}),e.verdict?(0,U.jsx)("span",{className:`rounded-full border px-2.5 py-0.5 text-[11.5px] font-extrabold ${"REQUEST_CHANGES"===(t=e.verdict)?"bg-danger-soft text-danger border-danger/25":"APPROVE"===t?"bg-success-soft text-success border-success/25":"bg-sunken text-secondary border-border"}`,children:(0,U.jsx)(mk,{verdict:e.verdict})}):null,(0,U.jsx)("span",{className:"text-[11px] text-muted",children:n?`${n} finding${1===n?"":"s"}`:(0,uJ.tr)("render.noFindings")}),(0,tw.T0)(e.ts)?(0,U.jsx)("span",{className:"ml-auto text-label tabular-nums text-muted",children:(0,tw.T0)(e.ts)}):null]}),(0,U.jsxs)("div",{className:"px-3 py-2",children:[e.summary.length?(0,U.jsx)("div",{className:"mb-2 whitespace-pre-wrap break-words text-[13px] text-secondary",children:pl(e.summary.join("\n"))}):null,r.length?(0,U.jsx)("div",{className:"divide-y divide-border",children:r.map((e,t)=>{var n;return(0,U.jsxs)("div",{className:"py-2 first:pt-0 last:pb-0",children:[(0,U.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,U.jsx)("span",{className:`rounded-full border px-2 py-0.5 text-[10.5px] font-extrabold ${"Critical"===(n=e.severity)||"High"===n||"P0"===n||"P1"===n?"border-danger/30 bg-danger-soft text-danger":"Medium"===n||"P2"===n?"border-warning/35 bg-warning-soft text-warning":"Low"===n||"P3"===n?"border-border bg-sunken text-secondary":"border-border bg-card text-muted"}`,children:e.severity}),e.file?(0,U.jsx)(uB,{file:e.file,line:e.line}):null]}),(0,U.jsx)("div",{className:"mt-1.5 whitespace-pre-wrap break-words text-[13px]",children:u9(e.title)}),e.body&&e.body!==e.title?(0,U.jsxs)("details",{className:"mt-1 text-[12px] text-muted",children:[(0,U.jsx)("summary",{className:"cursor-pointer list-none font-semibold text-accent",children:"details"}),(0,U.jsx)("div",{className:"mt-1 whitespace-pre-wrap break-words",children:pl(e.body)})]}):null]},t)})}):null,e.findings.length>r.length?(0,U.jsx)("div",{className:"mt-2 text-[12px] text-muted",children:(0,uJ.tr)("render.moreFindings",{count:e.findings.length-r.length})}):null,(0,U.jsxs)("details",{className:"group/raw mt-2 text-[12px]",children:[(0,U.jsxs)("summary",{className:"inline-flex cursor-pointer list-none items-center gap-1 font-semibold text-muted hover:text-accent [&::-webkit-details-marker]:hidden",children:[(0,U.jsx)(sx.c_,{className:"h-3 w-3 transition-transform group-open/raw:rotate-90","aria-hidden":!0}),"raw review text"]}),(0,U.jsx)("pre",{className:"mt-1 max-h-[320px] overflow-auto whitespace-pre-wrap [overflow-wrap:anywhere] border-t border-border pt-1.5 font-mono text-[11.5px] text-secondary",children:e.raw})]})]})]})}function mN({item:e}){let t=(0,tw.T0)(e.ts);return(0,U.jsxs)("details",{className:"group/record ml-9",children:[(0,U.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-2 rounded-control py-0.5 text-label text-muted hover:bg-sunken [@media(pointer:coarse)]:min-h-11 [&::-webkit-details-marker]:hidden",children:[(0,U.jsx)(sx.c_,{className:"h-3.5 w-3.5 shrink-0 transition-transform group-open/record:rotate-90","aria-hidden":!0}),(0,U.jsx)("span",{className:"shrink-0 text-secondary",children:(0,uJ.tr)("render.transcriptRecord")}),(0,U.jsx)("span",{className:"min-w-0 truncate rounded-md bg-sunken px-1.5 py-0.5 font-mono text-caption text-primary",children:e.recordType}),t?(0,U.jsx)("span",{className:"ml-auto shrink-0 tabular-nums",children:t}):null]}),(0,U.jsxs)("div",{className:"mb-1 mt-1",children:[(0,U.jsxs)("div",{className:"mb-1 flex items-center gap-2 text-caption font-semibold text-muted",children:[(0,U.jsx)("span",{children:(0,uJ.tr)("render.recordDetails")}),e.truncated?(0,U.jsx)("span",{className:"rounded-md bg-sunken px-1.5 py-0.5",children:(0,uJ.tr)("render.truncated")}):null]}),(0,U.jsx)("pre",{className:"max-h-[320px] max-w-full overflow-auto whitespace-pre-wrap break-words border-t border-border pt-1.5 font-mono text-[11px] text-secondary",children:e.body})]})]})}function mS({label:e,text:t}){let n=t.length>=1e3?`${(t.length/1e3).toFixed(1)}k`:String(t.length);return(0,U.jsxs)("details",{className:"group ml-9",children:[(0,U.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-1.5 rounded-control py-0.5 text-label text-muted hover:bg-sunken [@media(pointer:coarse)]:min-h-11 [&::-webkit-details-marker]:hidden",children:[(0,U.jsx)(sx.c_,{className:"h-3.5 w-3.5 shrink-0 transition-transform group-open:rotate-90","aria-hidden":!0}),(0,U.jsxs)("span",{className:"truncate text-secondary",children:[(0,uJ.tr)("render.system")," \xb7 ",n]})]}),(0,U.jsxs)("div",{className:"mb-1 mt-1",children:[(0,U.jsx)("span",{className:"mb-1 inline-flex items-center rounded-control bg-sunken px-1.5 py-0.5 font-mono text-caption text-muted",children:e}),(0,U.jsx)("pre",{className:"mt-1 max-h-[320px] overflow-auto whitespace-pre-wrap break-words border-t border-border pt-1.5 font-mono text-label text-secondary",children:t})]})]})}var mC=n(3550);function mA(e,t){return new Date(e).toLocaleTimeString("uk"===t?"uk-UA":"en-US",{hour:"2-digit",minute:"2-digit",hour12:!1})}function mI(e,t){let n=Math.max(0,Math.round(e/1e3));if(n<60)return t("wakeup.relSec",{count:n});let r=Math.round(n/60);if(r<60)return t("wakeup.relMin",{count:r});let i=Math.round(r/60);return i<24?t("wakeup.relHour",{count:i}):t("wakeup.relDay",{count:Math.round(i/24)})}function mM({event:e,wakeup:t}){let{t:n}=(0,eh.Ym)();return(0,U.jsxs)("div",{className:"mb-1 mt-1 rounded-surface bg-sunken px-2.5 py-2",children:[t.failed&&e.outputPreview.trim()?(0,U.jsx)("div",{className:"mb-2",children:(0,U.jsx)(mr,{output:e.outputPreview,truncated:e.outputTruncated})}):null,t.prompt?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)("div",{className:"mb-1 flex flex-wrap items-center gap-1.5 text-[10.5px] font-semibold text-muted",children:[(0,U.jsx)("span",{className:"uppercase tracking-wide",children:n("wakeup.plan")}),(0,U.jsx)("span",{className:"rounded-md border border-border bg-card px-1.5 py-px font-mono font-normal",children:n("wakeup.planInternal")})]}),(0,U.jsx)("pre",{className:"max-w-full whitespace-pre-wrap [overflow-wrap:anywhere] font-mono text-[11px] leading-snug text-secondary",children:t.prompt})]}):(0,U.jsx)("span",{className:"text-[11px] text-muted",children:n("wakeup.noPlan")})]})}function mT({event:e,wakeup:t}){let n,r,{locale:i,t:a}=(0,eh.Ym)(),{fireAt:s,superseded:l,failed:o,reason:c}=t,[d,u]=(0,Y.useState)(()=>Date.now()),p=o?"failed":l?"superseded":(0,mC.F9)(s,d),m="pending"===p;(0,Y.useEffect)(()=>{if(!m)return;let e=setInterval(()=>u(Date.now()),1e3);return()=>clearInterval(e)},[m]);let f=null!==s?mA(s,i):"",h=o?a("wakeup.failed"):l?f?`${a("wakeup.wasSetFor",{time:f})} \xb7 ${a("wakeup.superseded")}`:a("wakeup.superseded"):m&&null!==s?`${a("wakeup.wakesAt",{time:f})} \xb7 ${r=mI(Math.abs(n=s-d),a),a(n>=0?"wakeup.inRel":"wakeup.agoRel",{rel:r})}`:"fired"===p?f?a("wakeup.firedAt",{time:f}):a("wakeup.fired"):a("wakeup.noTime"),x=o?"border-l-2 border-danger bg-danger-soft pl-2 pr-1 text-danger":"text-muted",g=o?"font-semibold":l?"text-muted":"text-secondary",b=o?"font-semibold text-danger":"text-muted",[v,w]=(0,Y.useState)(o);return(0,U.jsxs)("details",{className:"ml-9",open:o,onToggle:e=>{e.currentTarget.open&&w(!0)},children:[(0,U.jsxs)("summary",{className:`flex cursor-pointer list-none items-start gap-2 rounded-control py-0.5 text-ui hover:bg-sunken [@media(pointer:coarse)]:min-h-11 [&::-webkit-details-marker]:hidden ${x}`,children:[(0,U.jsx)(sx.c9,{name:"clock",className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),(0,U.jsxs)("span",{className:"flex min-w-0 flex-1 flex-wrap items-baseline gap-x-2 gap-y-0.5",children:[(0,U.jsx)("span",{className:`min-w-0 grow shrink basis-40 leading-snug [overflow-wrap:anywhere] ${g}`,children:c||a("wakeup.card")}),(0,U.jsx)("span",{className:`ml-auto whitespace-nowrap text-[11px] tabular-nums ${b}`,children:h})]})]}),v?(0,U.jsx)(mM,{event:e,wakeup:t}):null]})}var mP=n(852),m$=n(1189),mE=n(1691);let mR=/(?:^|\n)(?:(?: {4}|\t)[^\n]*(?:\n|$))+/g,mO=/[.!?…]["'”’)\]]*(?=\s)/g;function mD(e,t,n){let r=t,i=n;for(;r<i&&/\s/.test(e[r]);)r+=1;for(;i>r&&/\s/.test(e[i-1]);)i-=1;return i>r?{start:r,end:i}:null}let mL=Math.ceil(50)+1,m_=16384*Math.ceil(1360),mF=new Map,mq=0,mz=new Set,mH=new Set;function mU(){for(let e of[...mH])e()}function mB(e,t){return`${e.id}\0${e.model}\0${e.voice}\0${t}`}class mK extends Error{constructor(e,t){super(t??`TTS request failed (${e})`),this.status=e,this.provider=t,this.name="TtsRequestError"}}class mY extends Error{constructor(e){super("audio playback failed",{cause:e}),this.name="TtsPlaybackError"}}async function mW(e){try{let t=await e.json();return"string"==typeof t.error&&t.error?t.error:null}catch{return null}}async function mV(e,t,n=e=>new Promise(t=>setTimeout(t,e))){for(let r=0;;r+=1){let i=await fetch("/api/tts",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({text:e}),signal:t});if(429===i.status&&r<3){if(await i.body?.cancel(),await n(400*(r+1)),t.aborted)throw new DOMException("aborted","AbortError");continue}if(!i.ok)throw new mK(i.status,await mW(i));let a=function(e){let t=e.headers.get("x-tts-backend"),n=e.headers.get("x-tts-model"),r=e.headers.get("x-tts-voice");if(!t||!n||!r)return null;try{return{id:t,model:decodeURIComponent(n),voice:decodeURIComponent(r)}}catch{return null}}(i);if((i.headers.get("content-type")??"").includes("application/json")){let e=await i.json();if(!e.audio)throw new mK(i.status,null);return{blob:function(e,t){let n=atob(e),r=new Uint8Array(n.length);for(let e=0;e<n.length;e+=1)r[e]=n.charCodeAt(e);return new Blob([r],{type:t})}(e.audio,e.contentType||"audio/mpeg"),alignment:e.alignment??null,voice:a}}return{blob:await i.blob(),alignment:null,voice:a}}}class mJ{constructor(e){this.options=e,this.pending=new Set,this.controller=new AbortController,this.cursor=0,this.element=0,this.wired=null,this.seekChar=null,this.stopped=!1,this.ready=e.chunks.map(()=>null),this.times=e.chunks.map(()=>null),this.durations=e.chunks.map(()=>null),this.concurrency=Math.max(1,e.concurrency??2)}start(e=0){!this.stopped&&this.options.chunks.length&&(this.cursor=this.chunkIndexForChar(e),this.seekChar=e,this.options.onPhase("loading"),this.pump(),this.playCursor())}seekToChar(e){if(this.stopped||!this.options.chunks.length)return;let t=this.chunkIndexForChar(e);if(this.seekChar=e,t===this.cursor){this.applySeek(),this.emit();return}this.current().pause(),this.cursor=t,this.pump(),this.playCursor()}stop(){if(!this.stopped)for(let e of(this.stopped=!0,this.controller.abort(),this.options.elements))this.unwire(e),e.pause()}current(){return this.options.elements[this.element%this.options.elements.length]}chunkIndexForChar(e){let t=this.options.chunks;for(let n=0;n<t.length;n+=1)if(e<t[n].end)return n;return t.length-1}pump(){if(this.stopped)return;let e=this.options.chunks;this.ready[this.cursor]||this.pending.has(this.cursor)||this.load(this.cursor);for(let t=this.cursor+1;t<e.length;t+=1){if(this.pending.size>=this.concurrency)return;this.ready[t]||this.pending.has(t)||this.load(t)}}load(e){var t;let n,r=this.options.chunks[e],i=(t=this.options.key(r.text,null),(n=mF.get(t))?(mF.delete(t),mF.set(t,n),n):null);i?this.accept(e,i):(this.pending.add(e),this.options.synthesize(r.text,this.controller.signal).then(({blob:t,alignment:n,voice:i})=>{this.pending.delete(e),this.stopped||(i&&this.options.onVoice?.(i),this.accept(e,function(e,t,n){let r=mF.get(e);if(r)return r;let i={url:URL.createObjectURL(t),bytes:t.size,alignment:n};for(mF.set(e,i),mq+=i.bytes;mF.size>mL||mq>m_&&mF.size>1;){let e=mF.entries().next().value;if(!e)break;mF.delete(e[0]),mq-=e[1].bytes,URL.revokeObjectURL(e[1].url)}return mU(),i}(this.options.key(r.text,i),t,n)),this.pump())}).catch(t=>{this.pending.delete(e),this.stopped||this.controller.signal.aborted||(this.options.onError(t),this.stop())}))}accept(e,t){this.ready[e]=t,this.times[e]=function(e,t){if(!(t&&"object"==typeof t&&Array.isArray(t.characters)&&Array.isArray(t.starts)&&Array.isArray(t.ends)&&t.characters.length===t.starts.length&&t.starts.length===t.ends.length&&t.characters.length>0))return null;let n=Array(e.length).fill(-1),r=Array(e.length).fill(-1),i=0,a=0;for(let s=0;s<t.characters.length&&i<e.length;s+=1){let l=t.characters[s],o=-1;for(let t=i;t<Math.min(e.length,i+12);t+=1)if(e[t]===l){o=t;break}o<0||(n[o]=t.starts[s],r[o]=t.ends[s],i=o+1,a+=1)}if(a<.5*e.length)return null;let s=0;for(let t=0;t<e.length;t+=1)n[t]<0?n[t]=s:s=n[t],r[t]<0?r[t]=s:s=Math.max(s,r[t]);return{starts:n,ends:r}}(this.options.chunks[e].text,t.alignment),e===this.cursor&&this.wired!==this.cursor?this.playCursor():e===this.cursor+1&&this.preloadNext()}preloadNext(){let e=this.ready[this.cursor+1];if(!e||this.options.elements.length<2)return;let t=this.options.elements[(this.element+1)%this.options.elements.length];t.src!==e.url&&(this.unwire(t),t.src=e.url,t.load?.())}unwire(e){e.onended=null,e.ontimeupdate=null,e.onerror=null,e.onloadedmetadata=null}playCursor(){if(this.stopped)return;let e=this.ready[this.cursor];if(!e)return void this.options.onPhase("loading");let t=this.current();if(this.wired===this.cursor&&!t.paused)return void this.applySeek();let n=this.cursor;this.wired=n,t.onloadedmetadata=()=>{this.cursor===n&&(this.durations[n]=Number.isFinite(t.duration)?t.duration:null,null!==this.seekChar&&this.applySeek(),this.emit())},t.ontimeupdate=()=>{this.cursor===n&&(Number.isFinite(t.duration)&&t.duration>0&&(this.durations[n]=t.duration),this.emit())},t.onended=()=>{this.cursor===n&&this.advance()},t.onerror=()=>{this.stopped||this.cursor!==n||(this.options.onError(new mY),this.stop())},t.src!==e.url&&(t.src=e.url),t.currentTime=0,t.muted=!1,null===this.durations[n]&&Number.isFinite(t.duration)&&t.duration>0&&(this.durations[n]=t.duration),this.applySeek(),this.options.onPhase("playing"),Promise.resolve(t.play()).catch(e=>{this.stopped||(this.options.onError(new mY(e)),this.stop())}),this.preloadNext(),this.emit()}applySeek(){if(null===this.seekChar)return;let e=this.options.chunks[this.cursor],t=Math.max(0,Math.min(this.seekChar-e.start,e.text.length-1)),n=this.current();if(0===t){n.currentTime=0,this.seekChar=null;return}let r=this.times[this.cursor],i=this.durations[this.cursor]??0;(r||!(i<=0))&&(n.currentTime=function(e,t){if(e.length<=0)return 0;let n=Math.max(0,Math.min(t,e.length-1));return e.times?e.times.starts[n]??0:n/e.length*e.duration}({length:e.text.length,duration:i,times:r},t),this.seekChar=null)}advance(){if(this.stopped)return;let e=this.current();if(Number.isFinite(e.duration)&&e.duration>0&&(this.durations[this.cursor]=e.duration),this.cursor+1>=this.options.chunks.length){this.emit(!0),this.stop(),this.options.onEnd();return}this.cursor+=1,this.element+=1,this.playCursor(),this.pump()}clock(e){let t=0,n=0,r=0;this.options.chunks.forEach((e,i)=>{let a=this.durations[i];a&&a>0?(t+=a,n+=e.text.length):r+=e.text.length});let i=n>0&&t>0?n/t:15,a=t+r/i,s=0;for(let e=0;e<this.cursor;e+=1)s+=this.durations[e]??this.options.chunks[e].text.length/i;return{elapsed:Math.min(s+=e?this.durations[this.cursor]??0:this.current().currentTime,a),total:a}}emit(e=!1){let t=this.options.chunks[this.cursor];if(!t)return;let n=this.current(),r={length:t.text.length,duration:this.durations[this.cursor]??0,times:this.times[this.cursor]},i=e?t.text.length-1:function(e,t){if(e.length<=0)return 0;if(!e.times){if(e.duration<=0)return 0;let n=Math.max(0,Math.min(t/e.duration,1));return Math.min(e.length-1,Math.floor(n*e.length))}let{ends:n}=e.times,r=0,i=e.length-1;for(;r<i;){let e=r+i>>1;(n[e]??0)<t?r=e+1:i=e}return r}(r,n.currentTime),{elapsed:a,total:s}=this.clock(e);this.options.onPosition({chunkIndex:this.cursor,charIndex:t.start+i,elapsed:a,total:s})}}function mG(e,t,n=300){let[r,i]=(0,Y.useState)(null),[a,s]=(0,Y.useState)(!0),l=(0,Y.useCallback)(()=>{let r=e.current;if(!r)return;let a=r.getBoundingClientRect(),l={width:window.innerWidth,height:window.innerHeight};s(a.bottom>=0&&a.top<=l.height&&a.right>=0&&a.left<=l.width);let o=t.current;if(!o)return;let c=function(e,t,n,r=8){let i=Math.max(r,Math.min(e.right-t.width,n.width-t.width-r)),a=n.height-e.bottom-r,s=e.top-r,l=t.height>a&&s>a?e.top-r-t.height:e.bottom+r;return{left:i,top:Math.max(r,Math.min(l,n.height-r-t.height))}}({top:a.top,bottom:a.bottom,right:a.right},{width:o.offsetWidth||n,height:o.offsetHeight},l);i(e=>e&&e.left===c.left&&e.top===c.top?e:c)},[e,t,n]);return(0,Y.useLayoutEffect)(l),(0,Y.useEffect)(()=>(window.addEventListener("scroll",l,!0),window.addEventListener("resize",l),()=>{window.removeEventListener("scroll",l,!0),window.removeEventListener("resize",l)}),[l]),{style:r?{left:r.left,top:r.top}:{left:-9999,top:0,opacity:0},onScreen:a}}function mQ({anchorRef:e,onDismiss:t,children:n}){let r=(0,Y.useRef)(null),{style:i,onScreen:a}=mG(e,r,224);return((0,Y.useEffect)(()=>{let n=n=>{let i=n.target;r.current?.contains(i??null)||e.current?.contains(i??null)||t()},i=e=>{"Escape"===e.key&&(e.preventDefault(),t())};return window.addEventListener("pointerdown",n),window.addEventListener("keydown",i),()=>{window.removeEventListener("pointerdown",n),window.removeEventListener("keydown",i)}},[e,t]),"u"<typeof document||!a)?null:(0,nx.createPortal)((0,U.jsx)("div",{ref:r,role:"alert","data-tts-alert":!0,style:i,className:"fixed z-[80] w-56 max-w-[calc(100vw-16px)] break-all rounded-[10px] border border-border bg-card p-2 text-[11px] text-danger shadow-2",children:n}),document.body)}function mX({anchorRef:e,info:t,option:n,chars:r,notice:i,freeReplay:a,active:s,tooLong:l,onPick:o,onClose:c}){let{t:d}=(0,eh.Ym)(),u=ia(),p=(0,Y.useRef)(null),{style:m}=mG(e,p),[f,h]=(0,Y.useState)(null),[x,g]=(0,Y.useState)(null),[,b]=(0,Y.useState)(0);(0,Y.useEffect)(()=>{var e;return e=()=>b(e=>e+1),mH.add(e),()=>{mH.delete(e)}},[]),(0,Y.useEffect)(()=>{let t=t=>{let n=t.target;p.current?.contains(n??null)||e.current?.contains(n??null)||c(!1)},n=e=>{"Escape"===e.key&&(e.preventDefault(),c(!0))};return window.addEventListener("pointerdown",t),window.addEventListener("keydown",n),()=>{window.removeEventListener("pointerdown",t),window.removeEventListener("keydown",n)}},[e,c]),(0,Y.useEffect)(()=>{let e=p.current,t=Array.from(e?.querySelectorAll("button:not(:disabled)")??[]),n=t.find(e=>"true"===e.getAttribute("aria-checked"));(n??t[0]??e)?.focus()},[]);let v=async e=>{if(t.lockedByEnv||f||e===t.backend)return;h(e),g(null);let n=await o(e);h(null),n?c(!0):g(d("tts.saveFailed"))};return"u"<typeof document?null:(0,nx.createPortal)((0,U.jsxs)("div",{ref:p,role:"menu",tabIndex:-1,"data-tts-menu":!0,"aria-label":d("tts.menuTitle"),style:m,className:"fixed z-[80] max-h-[calc(100vh-16px)] w-[300px] max-w-[calc(100vw-16px)] overflow-y-auto rounded-[12px] border border-border bg-card p-1.5 text-left shadow-2 focus-visible:outline-none",children:[(0,U.jsx)("div",{className:"px-2 pb-1 pt-1.5 text-label font-semibold text-secondary",children:d("tts.menuTitle")}),(0,U.jsx)("div",{className:`px-2 text-[11.5px] font-semibold ${s?"text-secondary":a()?"text-success":"text-primary"}`,children:s?d("tts.nextStop"):a()?d("tts.nextFree"):d("tts.nextPaid")}),(0,U.jsxs)("div",{className:"px-2 pt-1 text-[10.5px] text-muted",children:[n.id," \xb7 ",n.model," \xb7 ",n.voice]}),(0,U.jsx)("div",{className:"px-2 text-[10.5px] text-muted",children:d("tts.characters",{count:r.toLocaleString()})}),(0,U.jsx)("div",{className:"px-2 pt-1 text-[10.5px] text-primary",children:d("tts.billing",{provider:n.id})}),(0,U.jsx)("div",{className:"px-2 text-[10.5px] text-primary",children:d("tts.disclosure")}),(0,U.jsx)("div",{className:"px-2 pb-1 text-[10.5px] text-muted",children:d("tts.seekHint")}),l?(0,U.jsx)("div",{className:"px-2 pb-1 text-[10.5px] font-semibold text-danger",children:d("tts.tooLong",{count:2e4.toLocaleString()})}):null,n.available?null:(0,U.jsx)("div",{className:"break-all px-2 pb-1 text-[10.5px] text-danger",children:d("tts.missingKey",{provider:n.id,path:n.keyPath})}),t.lockedByEnv?(0,U.jsx)("div",{className:"px-2 pb-1 text-[10.5px] text-danger",children:d("tts.menuLocked")}):null,(0,U.jsx)("div",{className:"mt-1 border-t border-border pt-1",children:t.options.map(e=>{let n=e.id===t.backend;return(0,U.jsxs)("button",{type:"button",role:"menuitemradio","aria-checked":n,disabled:t.lockedByEnv||null!==f,onClick:()=>void v(e.id),className:`flex w-full items-start gap-2 rounded-[9px] px-2 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60 ${u?"min-h-11 py-2":"py-1.5"} ${n?"bg-accent/10":"hover:bg-canvas"}`,children:[(0,U.jsx)("span",{className:"mt-[3px] flex h-3.5 w-3.5 shrink-0 items-center justify-center",children:f===e.id?(0,U.jsx)(sx.kr,{className:"h-3.5 w-3.5 animate-spin text-muted","aria-hidden":!0}):n?(0,U.jsx)(sx.Jl,{className:"h-3.5 w-3.5 text-accent","aria-hidden":!0}):(0,U.jsx)("span",{"aria-hidden":!0,className:"h-2 w-2 rounded-full",style:{backgroundColor:e.available?"var(--color-success)":"var(--color-warning)"}})}),(0,U.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,U.jsxs)("span",{className:"flex items-center gap-1.5 text-[12px] font-semibold text-primary",children:[e.id,e.available?null:(0,U.jsx)("span",{className:"rounded-full bg-warning-soft px-1.5 py-px text-[9.5px] font-bold text-warning",children:d("tts.noKey")})]}),(0,U.jsxs)("span",{className:"block text-[10.5px] leading-snug text-muted",children:[e.model," \xb7 ",e.voice]})]})]},e.id)})}),x??i?(0,U.jsx)("div",{className:"break-all px-2 py-1 text-[10.5px] font-semibold text-danger",children:x??i}):null]}),document.body)}let mZ="tts-karaoke",m0=/[\p{L}\p{N}][\p{L}\p{N}'’-]*/gu,m1=new Set(["SCRIPT","STYLE","PRE","CODE","TEXTAREA"]);function m2(e){let t=[];m0.lastIndex=0;for(let n=m0.exec(e);n;n=m0.exec(e))t.push({start:n.index,end:n.index+n[0].length,key:n[0].toLowerCase()});return t}function m5(e,t,n=!1){if(!e.nodes.length)return null;let r=0,i=e.nodes.length-1;for(;r<i;){let n=r+i+1>>1;e.offsets[n]<=t?r=n:i=n-1}n&&r>0&&e.offsets[r]===t&&(r-=1);let a=e.nodes[r];return[a,Math.max(0,Math.min(t-e.offsets[r],a.data.length))]}let m4=null,m3=null,m6=null,m8=new Set;function m7(e=!1){return!e&&m3?Promise.resolve(m3):(e&&(m6=null),m6??=fetch("/api/tts/backend").then(e=>{if(!e.ok)throw Error("TTS configuration unavailable");return e.json()}).then(e=>(m9(e),e)).catch(e=>{throw m6=null,e}))}function m9(e){for(let t of(m3=e,m6=Promise.resolve(e),m8))t(e)}function fe(){let e=m4;m4=null,e?.()}function ft({text:e}){let{locale:t,t:n}=(0,eh.Ym)(),r=ia(),[i,a]=(0,Y.useState)(m3),[s,l]=(0,Y.useState)(!1),[o,c]=(0,Y.useState)(null),[d,u]=(0,Y.useState)("idle"),[p,m]=(0,Y.useState)(""),[f,h]=(0,Y.useState)({elapsed:0,total:0,chunk:0,chunks:0}),[,x]=(0,Y.useState)(0),g=(0,Y.useMemo)(()=>(function(e){let t=mD(e,0,e.length);if(!t)return[];if(t.end-t.start<=800)return[{index:0,text:e.slice(t.start,t.end),start:t.start,end:t.end}];let n=[];for(let t of function(e){let t=[],n=[];mO.lastIndex=0;for(let t=mO.exec(e);t;t=mO.exec(e))n.push(t.index+t[0].length);for(let t of e.matchAll(/\n[ \t]*\n/g))n.push(t.index+t[0].length);n.sort((e,t)=>e-t);let r=0;for(let i of[...n,e.length]){if(i<=r)continue;let n=mD(e,r,i);n&&t.push({...n,paragraph:t.length>0&&/\n[ \t]*\n\s*$/.test(e.slice(0,n.start))}),r=i}return t}(e)){if(t.end-t.start<=800){n.push(t);continue}for(let[r,i]of(function(e,t,n){let r=[],i=t;for(;n-i>800;){let t=-1;for(let n=i+800;n>i;n-=1)if(/\s/.test(e[n])){t=n;break}if(t<0){let r=e.slice(i).search(/\s/);t=r<0?n:i+r}let a=mD(e,i,t);if(a&&r.push(a),i=t,t>=n)break}let a=mD(e,i,n);return a&&r.push(a),r})(e,t.start,t.end).entries()){let e=t.paragraph&&0===r;if(i.end-i.start<=4e3){n.push({...i,paragraph:e});continue}for(let t=i.start;t<i.end;t+=4e3)n.push({start:t,end:Math.min(t+4e3,i.end),paragraph:e&&t===i.start})}}let r=[],i=null,a=()=>{i&&(r.push({index:r.length,text:e.slice(i.start,i.end),start:i.start,end:i.end}),i=null)};for(let e of n){let t=e.end-e.start;i&&(e.end-i.start>800||e.paragraph&&i.end-i.start>=400)&&a(),i=i?{start:i.start,end:e.end}:{start:e.start,end:e.end},t>=800&&a()}return a(),r})(e),[e]),b=(0,Y.useRef)(0),v=(0,Y.useRef)(!0),w=(0,Y.useRef)(null),y=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{v.current=!0;let e=!0,n=t=>{e&&a(t)};return m8.add(n),m7().then(t=>{e&&a(t)}).catch(()=>{e&&c((0,eh.Tl)(t,"tts.configError"))}),()=>{e=!1,m8.delete(n),v.current=!1,b.current+=1,m4===w.current&&fe()}},[t]);let k=(0,Y.useCallback)(e=>{l(!1),e&&queueMicrotask(()=>y.current?.focus())},[]),j=(0,Y.useCallback)(()=>c(null),[]);if(!i||!e)return null;let N=i.options.find(e=>e.id===i.backend);if(!N)return null;let S=mB(i.options.find(e=>e.id===i.backend),e),C=()=>{var e;return mz.has(S)&&(e=g.map(e=>mB(N,e.text))).length>0&&e.every(e=>mF.has(e))},A=C(),I=e.length>2e4,M=e=>{c(e),m(e)},T=async e=>{if(i.lockedByEnv)return!1;try{let t=await fetch("/api/tts/backend",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({backend:e})});if(!t.ok)return!1;let n=await t.json();return m9(n),a(n),!0}catch{return!1}},P="idle"!==d,$=P?mP.A:A?m$.A:cu.A,E=P?n("tts.stop"):I?n("tts.tooLong",{count:2e4.toLocaleString()}):N.available?n("tts.triggerTitle",{action:A?n("tts.replayFree"):n("tts.readPaid")}):n("tts.missingKey",{provider:N.id,path:N.keyPath});return(0,U.jsxs)("span",{className:"relative",children:[(0,U.jsx)("button",{ref:y,"data-tts-trigger":!0,type:"button",onClick:()=>{let t,r;if(k(!1),w.current)return void w.current();if(I)return void M(n("tts.tooLong",{count:2e4.toLocaleString()}));if(!N.available)return void M(n("tts.missingKey",{provider:N.id,path:N.keyPath}));let i=A&&!C(),{elements:a,playbackUnlock:s}=(r=(t=[new Audio,new Audio]).map(e=>(e.muted=!0,e.src="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBAAAAABAAEAQB8AAEAfAAABAAgAZGF0YQQAAACAgICA",e.play())),{elements:t,playbackUnlock:Promise.all(r.map(e=>Promise.resolve(e).catch(()=>void 0)))});c(null),((t,r,i=0)=>{if(!g.length)return;fe();let a=++b.current,s=()=>v.current&&b.current===a,l=y.current?function(e){let t=e.closest("[data-tts-message]"),n=t?.querySelector("[data-tts-body]");if(!n)return[];let r=[n],i=t.getAttribute("data-tts-message");if(!i)return r;let a=t.closest('[data-feed-kind="prose"]')?.nextElementSibling??null;for(;a?.getAttribute("data-feed-kind")==="prose";){let e=a.querySelector("[data-tts-message]");if(e?.getAttribute("data-tts-message")!==i)break;let t=e.querySelector("[data-tts-body]");t&&r.push(t),a=a.nextElementSibling}return r}(y.current):[],o=l.length?function(e,t){let n=function(e,t){let n=function(e){let t=[],n=[],r="",i=e=>{if(3===e.nodeType){let i=e.data;if(!i)return;t.push(e),n.push(r.length),r+=i;return}if(1===e.nodeType&&!m1.has(e.tagName)&&"true"!==e.getAttribute("aria-hidden"))for(let t of Array.from(e.childNodes))i(t)};for(let t of e)i(t);return{text:r,nodes:t,offsets:n}}(e),r=m2(t),i=m2(n.text);if(!r.length||!i.length)return null;let a=Array(r.length).fill(-1),s=new Map,l=0,o=0;for(let e=0;e<r.length;e+=1){let t=r[e].key,n=r[e+1]?.key,c=Math.min(i.length,l+400),d=-1,u=-1;for(let e=l;e<c;e+=1)if(i[e].key===t&&(d<0&&(d=e),!n||i[e+1]?.key===n)){u=e;break}let p=u>=0?u:d;p<0||(a[e]=p,s.set(p,e),l=p+1,o+=1)}return 0===o?null:{spoken:t,rangeFor(e,t){let s=-1,l=-1;for(let n=0;n<r.length;n+=1){let i=r[n];i.end<=e||i.start>=t||a[n]<0||(s<0&&(s=a[n]),l=a[n])}if(s<0)return null;let o=m5(n,i[s].start),c=m5(n,i[l].end,!0);return o&&c?{start:o,end:c}:null},charAtDomPoint(e,t){let a=function(e,t,n){let r=e.nodes.indexOf(t);if(r>=0)return e.offsets[r]+n;for(let n=0;n<e.nodes.length;n+=1)if(t.contains(e.nodes[n]))return e.offsets[n];for(let n=0;n<e.nodes.length;n+=1)if(4&t.compareDocumentPosition(e.nodes[n]))return e.offsets[n];return e.text.length}(n,e,t);if(a<0)return null;let l=(e=>{let t=0,n=i.length-1,r=-1;for(;t<=n;){let a=t+n>>1;i[a].start>e?n=a-1:(r=a,t=a+1)}return r<0?0:i[r].end>e?r:Math.min(r+1,i.length-1)})(a);for(let e=0;e<400;e+=1)for(let t of[l+e,l-e]){let e=s.get(t);if(void 0!==e)return r[e].start}return null}}}(e,t);if(!n)return null;let r="u">typeof CSS?CSS.highlights:void 0,i=r&&"function"==typeof Highlight?new Highlight:null;i&&r&&r.set(mZ,i);let a=()=>{i?.clear()};return{highlight(e,t){if(!i)return;let r=n.rangeFor(e,t);if(i.clear(),!r)return;let a=document.createRange();a.setStart(r.start[0],r.start[1]),a.setEnd(r.end[0],r.end[1]),i.add(a)},clear:a,charAtPoint(e,t){let r=document,i=r.caretPositionFromPoint?.(e,t);if(i)return n.charAtDomPoint(i.offsetNode,i.offset);let a=r.caretRangeFromPoint?.(e,t);return a?n.charAtDomPoint(a.startContainer,a.startOffset):null},destroy(){a(),r?.delete(mZ)}}}(l,e):null,d=null,p=!1,f=(e=!0)=>{if(!p){for(let e of(p=!0,j.stop(),o?.destroy(),l))e.removeEventListener("click",k),delete e.dataset.ttsSeekable;m4===f&&(m4=null),w.current===f&&(w.current=null),s()&&(u("idle"),h({elapsed:0,total:0,chunk:0,chunks:0}),e&&m(n("tts.stopped")))}};function k(e){if(0!==e.button||e.defaultPrevented||e.target?.closest("a, button, input, textarea, select, summary, [role='button'], [contenteditable]"))return;let t=window.getSelection?.();if(t&&!t.isCollapsed)return;let n=o?.charAtPoint(e.clientX,e.clientY);null!=n&&j.seekToChar(n)}let j=new mJ({chunks:g,key:(e,t)=>mB(t??N,e),synthesize:mV,elements:t,onPhase:e=>{s()&&(u(e),m("loading"===e?n("tts.generating"):n("tts.playing")))},onVoice:e=>{if(e.id!==N.id||e.model!==N.model||e.voice!==N.voice){if(d=e,s()){let t=n("tts.backendChanged",{provider:e.id});c(t),m(t)}m7(!0).catch(()=>void 0)}},onPosition:({chunkIndex:t,charIndex:n,elapsed:r,total:i})=>{let a=function(e,t){if(!e)return null;let n=Math.max(0,Math.min(t,e.length-1)),r=t=>t>=0&&t<e.length&&!/\s/.test(e[t]),i=n;if(!r(i)){let t=i;for(;t<e.length&&!r(t);)t+=1;if(t<e.length)i=t;else{let e=i;for(;e>=0&&!r(e);)e-=1;if(e<0)return null;i=e}}let a=i;for(;a>0&&r(a-1);)a-=1;let s=i+1;for(;s<e.length&&r(s);)s+=1;return{start:a,end:s}}(e,n);a&&o?.highlight(a.start,a.end),s()&&h({elapsed:r,total:i,chunk:t+1,chunks:g.length})},onError:e=>{let t=e instanceof mK?e.provider??n("tts.requestError",{status:e.status}):e instanceof mY?n("tts.playError"):n("tts.requestFailed");s()&&(c(t),m(t)),f(!1)},onEnd:()=>{var t=d?mB(d,e):S;for(mz.delete(t),mz.add(t);mz.size>200;){let e=mz.values().next().value;if(void 0===e)break;mz.delete(e)}mU(),s()&&(x(e=>e+1),m(n("tts.finished"))),f(!1)}});for(let e of(w.current=f,m4=f,u("loading"),m(n("tts.generating")),c(null),l))e.addEventListener("click",k),e.dataset.ttsSeekable="";r.then(()=>{s()&&!p&&j.start(i)})})(a,s),i&&c(n("tts.replayExpired"))},onContextMenu:e=>{e.preventDefault(),s?k(!1):(l(!0),m7(!0).then(e=>{v.current&&a(e)}).catch(()=>{v.current&&c(n("tts.configError"))}))},"aria-haspopup":"menu","aria-expanded":s,className:`inline-flex items-center justify-center rounded-md text-muted transition-opacity hover:bg-sunken hover:text-primary focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${r?"h-11 w-11":"p-1"} opacity-70 hover:opacity-100 group-hover/msg:opacity-100`,"aria-label":P?n("tts.stop"):A?n("tts.replay"):n("tts.read"),title:E,children:(0,U.jsx)($,{className:"h-3.5 w-3.5","aria-hidden":!0})}),(0,U.jsx)("span",{role:"status","aria-live":"polite",className:"sr-only",children:p}),"playing"===d&&f.total>0?(0,U.jsxs)("span",{className:"text-[10px] tabular-nums text-muted",children:[Math.floor(f.elapsed)," / ",Math.ceil(f.total),"s",f.chunks>1?(0,U.jsxs)("span",{className:"ml-1",title:n("tts.partOf",{index:f.chunk,count:f.chunks}),children:[f.chunk,"/",f.chunks]}):null]}):null,s?(0,U.jsx)(mX,{anchorRef:y,info:i,option:N,chars:e.length,notice:o,freeReplay:C,active:P,tooLong:I,onPick:T,onClose:k}):null,o&&!s?(0,U.jsx)(mQ,{anchorRef:y,onDismiss:j,children:o}):null]})}var fn=n(9383),fr=n(6420),fi=n(2841),fa=n(8747),fs=n(3769),fl=n(4825),fo=n(4551),fc=n(5484),fd=n(5606);let fu={bot:dE.A,message:fn.A,task:fr.A,pipeline:fi.A,link:fa.A,conversation:fs.A,deploy:fl.A,tool:uu.A};function fp(e){return e&&"object"==typeof e&&!Array.isArray(e)?e:{}}function fm({link:e,conversationAvailability:t}){let n="conversation"===e.kind&&(!t.loaded||!t.ids.has(e.id)),r="inline-flex min-h-6 shrink-0 items-center gap-1 rounded-full border px-2 py-0.5 text-[10.5px] font-semibold transition-colors [@media(pointer:coarse)]:min-h-8";return n?(0,U.jsxs)("span",{"data-testid":`mcp-link-${e.kind}`,"aria-disabled":"true",title:"This conversation will open after the scanner attributes it.",className:`${r} cursor-wait border-border bg-sunken text-muted opacity-60`,children:[(0,U.jsx)(fo.A,{className:"h-3 w-3","aria-hidden":!0}),e.label]}):(0,U.jsxs)("a",{"data-testid":`mcp-link-${e.kind}`,href:e.href,onClick:t=>{"conversation"!==e.kind&&(t.preventDefault(),window.dispatchEvent(new CustomEvent("llv:mcp-navigate",{detail:{kind:e.kind,id:e.id}})))},className:`${r} border-accent/35 bg-accent-soft text-accent hover:border-accent hover:bg-accent/15 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/45`,children:["conversation"===e.kind?(0,U.jsx)(fo.A,{className:"h-3 w-3","aria-hidden":!0}):(0,U.jsx)(an.A,{className:"h-3 w-3","aria-hidden":!0}),e.label]})}function ff({event:e,availableConversationIds:t}){var n;let r,i,a,s=e.mcp,l=s?.result,o=(0,Y.useMemo)(()=>(0,fd.Y)(s?.toolName??e.tool,s?.args??{},l),[e.tool,s?.args,s?.toolName,l]),c=function(e){let[t,n]=(0,Y.useState)(rC);return(0,Y.useEffect)(()=>{if(!e)return rS.add(n),()=>rS.delete(n)},[e]),e?{loaded:!0,ids:e}:t}(t),d="run"===e.status?"pending":"err"===e.status?"error":"success",u=fu[o.icon],p=!0===fp(l).replayed||!0===fp(l).replay,m=!0===fp(l).retryable,f="error"===d?(n=e.outputPreview,i="string"==typeof(r=fp(l)).error?r.error.trim():"",a="string"==typeof fp(r.error).message?String(fp(r.error).message).trim():"",i||a||n.trim()||"MCP call failed"):"",h=(0,Y.useMemo)(()=>(function(e,t){try{return JSON.stringify({arguments:e,...void 0===t?{}:{result:t}},null,2)}catch{return"Payload could not be serialized."}})(s?.args??{},l),[s?.args,l]);return(0,U.jsxs)("article",{"data-testid":"mcp-call-card","data-state":d,className:"group/mcp relative my-1 ml-9",children:["pending"===d?(0,U.jsx)("div",{"data-testid":"mcp-call-progress",className:"absolute inset-x-0 top-0 h-0.5 animate-pulse bg-gradient-to-r from-transparent via-accent to-transparent"}):null,(0,U.jsxs)("details",{className:"min-w-0",children:[(0,U.jsxs)("summary",{className:"flex min-w-0 cursor-pointer list-none flex-wrap items-center gap-x-2 gap-y-0.5 rounded-control py-0.5 text-ui hover:bg-sunken [@media(pointer:coarse)]:min-h-11 [&::-webkit-details-marker]:hidden",children:[(0,U.jsx)(u,{className:`h-3.5 w-3.5 shrink-0 ${"error"===d?"text-danger":"success"===d?"text-success":"text-accent"} ${"pending"===d?"animate-pulse":""}`,"aria-hidden":!0}),(0,U.jsxs)("span",{className:"shrink-0 font-mono text-[9.5px] font-semibold uppercase tracking-[0.08em] text-muted",children:["MCP \xb7 ",s?.serverName??"viewer"]}),(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate font-semibold text-secondary",title:o.title,children:o.title}),p?(0,U.jsx)("span",{"data-testid":"mcp-replay",className:"shrink-0 rounded-full bg-accent-soft px-1.5 py-0.5 text-[10px] font-bold text-accent",children:"Replay"}):null,m?(0,U.jsx)("span",{className:"shrink-0 rounded-full bg-danger-soft px-1.5 py-0.5 text-[10px] font-bold text-danger",children:"Retryable"}):null,o.links.map(e=>(0,U.jsx)(fm,{link:e,conversationAvailability:c},`${e.kind}:${e.id}`)),(0,U.jsx)("span",{className:`inline-flex shrink-0 items-center ${"error"===d?"text-danger":"success"===d?"text-success":"text-accent"}`,role:"pending"===d?"status":void 0,"aria-label":"pending"===d?`${o.verb}…`:d,children:"pending"===d?(0,U.jsx)(dR.A,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):"success"===d?(0,U.jsx)(uL.A,{className:"h-3.5 w-3.5","aria-hidden":!0}):(0,U.jsx)(fc.A,{className:"h-3.5 w-3.5","aria-hidden":!0})}),(0,tw.T0)(e.ts)?(0,U.jsx)("span",{className:"shrink-0 text-caption tabular-nums text-muted",children:(0,tw.T0)(e.ts)}):null]}),(0,U.jsxs)("div",{className:"ml-5 mt-1 text-[10.5px] text-muted",children:[o.subtitle?(0,U.jsx)("div",{className:"mb-1 truncate font-mono",title:o.subtitle,children:o.subtitle}):null,(0,U.jsx)("pre",{className:"max-h-[320px] max-w-full overflow-auto whitespace-pre-wrap [overflow-wrap:anywhere] border-t border-border pt-1.5 font-mono text-[10.5px] text-secondary",children:h})]})]}),"error"===d?(0,U.jsx)("div",{className:"ml-5 border-l-2 border-danger pl-2 text-[11px] font-semibold text-danger",children:f}):null]})}function fh(e,t,n){return{kind:"tmsg",ts:e,dir:"in",peer:n??(0,uJ.tr)("render.agentPeer"),summary:"",text:t,internal:!0}}let fx=(0,Y.memo)(function({item:e,speakText:t}){let n=function(e,t){if("user"===e.kind){if(e.selectedContext)return e;let n=t.forItem(e);return n?.origin==="agent"?fh(e.ts,e.text,n.senderRole):e}if("sysmsg"!==e.kind||!e.deliveredMessage)return e;let n=t.forItem(e);return n?.origin==="operator"?{kind:"user",ts:e.deliveredMessage.ts,text:e.text,...n.selectedContext?{selectedContext:n.selectedContext}:{}}:n?.origin==="agent"?fh(e.deliveredMessage.ts,e.text,n.senderRole):e}(e,(0,Y.useContext)(pW));if("image"===n.kind)return(0,U.jsx)(mh,{media:n.media,data:n.data,w:n.w,h:n.h,bytes:n.bytes});if("inbox-image"===n.kind)return(0,U.jsx)(pD,{name:n.name,path:n.path});if("blob"===n.kind)return(0,U.jsx)(p5,{bytes:n.bytes,text:n.text});if("sysmsg"===n.kind)return(0,U.jsx)(mS,{label:n.label,text:n.text});if("compact"===n.kind)return(0,U.jsx)(mf,{item:n});if("review"===n.kind)return(0,U.jsx)(mj,{item:n});if("record"===n.kind)return(0,U.jsx)(mN,{item:n});if("mem-citation"===n.kind)return(0,U.jsx)(mx,{item:n});if("prose"===n.kind){let e="codex"===n.engine?"bg-codex":"bg-claude",r="codex"===n.engine?sx.uB:sx.RE;return(0,U.jsxs)("div",{className:"group/msg my-3 flex gap-2.5",children:[(0,U.jsx)("div",{className:`mt-1 flex h-6.5 w-6.5 shrink-0 items-center justify-center rounded-full text-white ${e}`,children:(0,U.jsx)(r,{className:"h-3.5 w-3.5","aria-hidden":!0})}),(0,U.jsxs)("div",{className:"min-w-0 flex-1 whitespace-pre-wrap break-words","data-tts-message":`${n.engine}:${n.ts}`,children:[(0,U.jsxs)("div",{className:"mb-0.5 flex min-h-6 items-center gap-1",children:[(0,tw.T0)(n.ts)?(0,U.jsx)("span",{className:"text-label tabular-nums text-muted",children:(0,tw.T0)(n.ts)}):null,(0,U.jsxs)("span",{className:"ml-auto flex shrink-0 items-center gap-0.5",children:[t?(0,U.jsx)(ft,{text:t}):null,(0,U.jsx)(uK.i,{text:n.text,label:(0,uJ.tr)("feed.copyMd"),className:uW})]})]}),(0,U.jsx)("div",{className:"contents","data-tts-body":!0,children:pl(n.text)})]})]})}if("voice"===n.kind)return(0,U.jsxs)("div",{className:"group/msg my-3 flex items-start justify-end gap-1.5",children:[(0,U.jsx)(uK.i,{text:n.input||n.delta,label:(0,uJ.tr)("feed.copyMd"),className:`mt-2 ${uW}`}),(0,U.jsxs)("div",{className:"max-w-[75%] rounded-surface bg-user px-4 py-2.5",children:[(0,U.jsxs)("span",{className:"mb-1 flex items-center gap-1 text-caption uppercase tracking-wide text-muted",children:[(0,U.jsx)(sx.GO,{className:"h-3 w-3","aria-hidden":!0}),(0,uJ.tr)("feed.voiceTurn")]}),n.input?(0,U.jsx)("p",{className:"whitespace-pre-wrap break-words",children:n.input}):null,n.delta?(0,U.jsxs)("details",{className:"mt-1.5",children:[(0,U.jsx)("summary",{className:"cursor-pointer list-none text-caption text-muted [&::-webkit-details-marker]:hidden",children:(0,uJ.tr)("feed.voiceContext")}),(0,U.jsx)("pre",{className:"mt-1 whitespace-pre-wrap break-words text-label text-secondary",children:n.delta})]}):null]})]});if("user"===n.kind){let e=n.text.length>500;return(0,U.jsxs)("div",{className:"group/msg my-3 flex items-start justify-end gap-1.5",children:[(0,U.jsx)(uK.i,{text:n.text,label:(0,uJ.tr)("feed.copyMd"),className:`mt-2 ${uW}`}),(0,U.jsxs)("div",{className:"max-w-[75%] whitespace-pre-wrap break-words rounded-surface bg-user px-4 py-2.5",children:[n.selectedContext?(0,U.jsx)(lI,{reference:n.selectedContext,className:"mb-1.5"}):null,e?(0,U.jsxs)("details",{className:"group/usr",children:[(0,U.jsxs)("summary",{className:"cursor-pointer list-none [&::-webkit-details-marker]:hidden",children:[(0,U.jsxs)("span",{className:"group-open/usr:hidden",children:[n.text.slice(0,180),"… ",(0,U.jsxs)("span",{className:"font-semibold text-accent",children:["(",(0,uJ.tr)("common.chars",{n:n.text.length}),")"]})]}),(0,U.jsxs)("span",{className:"hidden items-center gap-1 text-[11px] font-semibold text-muted group-open/usr:inline-flex",children:[(0,uJ.tr)("common.collapse")," ",(0,U.jsx)(sx.rX,{className:"h-3 w-3","aria-hidden":!0})]})]}),pl(n.text)]}):pl(n.text)]})]})}if("tool"===n.kind&&n.mcp)return(0,U.jsx)(ff,{event:n});if("tool"===n.kind&&n.wakeup)return(0,U.jsx)(mT,{event:n,wakeup:n.wakeup});if("tool"===n.kind)return(0,U.jsx)(mp,{event:n});if("cmd-group"===n.kind)return(0,U.jsx)(mm,{item:n});if("tmsg"===n.kind){let e=function(e){let t=e.trim();if((t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))&&(t=t.slice(1,-1).trim()),!t.startsWith("{"))return null;try{let e=JSON.parse(t);if(null!==e&&"object"==typeof e&&!Array.isArray(e))return e}catch{}return null}(n.text),t=n.text.length>420||n.text.split("\n").length>6;return(0,U.jsxs)("div",{className:"my-3 ml-9 overflow-hidden rounded-surface border border-accent/25 bg-accent-soft shadow-1",children:[(0,U.jsxs)("div",{className:"flex items-center gap-2 px-3.5 pt-2",children:[(0,U.jsx)("span",{className:"flex h-6.5 w-6.5 shrink-0 items-center justify-center rounded-lg bg-accent-soft text-accent",children:(0,U.jsx)(sx.gE,{className:"h-3.5 w-3.5","aria-hidden":!0})}),n.internal?(0,U.jsx)("span",{className:"rounded-full border border-accent/40 px-1.5 py-0.5 text-[10px] font-bold uppercase tracking-wide text-accent",children:(0,uJ.tr)("render.internalTag")}):null,(0,U.jsx)("span",{className:"text-[11px] font-semibold text-muted",children:"out"===n.dir?(0,uJ.tr)("render.toDir"):(0,uJ.tr)("render.fromDir")}),(0,U.jsx)("span",{className:"rounded-full bg-accent/10 px-2 py-0.5 text-[11px] font-bold text-accent",children:n.peer}),n.delivery?(0,U.jsxs)("span",{className:`inline-flex shrink-0 items-center gap-1 text-[10.5px] font-semibold ${"ok"===n.delivery?"text-success":"text-danger"}`,title:n.msgId?`msg_id: ${n.msgId}`:void 0,children:["ok"===n.delivery?(0,U.jsx)(sx.Jl,{className:"h-3 w-3","aria-hidden":!0}):(0,U.jsx)(sx.X,{className:"h-3 w-3","aria-hidden":!0}),"ok"===n.delivery?(0,uJ.tr)("render.delivered"):(0,uJ.tr)("render.notDelivered")]}):null,(0,tw.T0)(n.ts)?(0,U.jsx)("span",{className:"ml-auto shrink-0 text-label tabular-nums text-muted",children:(0,tw.T0)(n.ts)}):null]}),(0,U.jsx)("div",{className:"px-3.5 pb-2.5 pt-1",children:e?(0,U.jsx)(my,{payload:e}):(0,U.jsxs)(U.Fragment,{children:[n.summary?(0,U.jsx)("div",{className:"text-[13px] font-bold",children:u9(n.summary)}):null,t?(0,U.jsxs)("details",{className:"group/tmsg mt-0.5 whitespace-pre-wrap break-words text-[13px]",children:[(0,U.jsxs)("summary",{className:"cursor-pointer list-none text-[12.5px] text-secondary [&::-webkit-details-marker]:hidden",children:[(0,U.jsxs)("span",{className:"group-open/tmsg:hidden",children:[n.text.slice(0,260).trimEnd(),"… ",(0,U.jsx)("span",{className:"font-semibold text-accent",children:(0,uJ.tr)("common.showAll")})]}),(0,U.jsxs)("span",{className:"hidden items-center gap-1 text-[11px] font-semibold text-muted group-open/tmsg:inline-flex",children:[(0,uJ.tr)("common.collapse")," ",(0,U.jsx)(sx.rX,{className:"h-3 w-3","aria-hidden":!0})]})]}),pl(n.text)]}):(0,U.jsx)("div",{className:"mt-0.5 whitespace-pre-wrap break-words text-[13px]",children:pl(n.text)})]})})]})}if("tnote"===n.kind)return(0,U.jsxs)("div",{className:"my-0.5 ml-9 flex items-center gap-1.5 text-label text-muted",children:[(0,U.jsx)(sx.gE,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),n.text]});if("think"===n.kind){let e=n.text.length>150;return(0,U.jsxs)("details",{className:"my-0.5 ml-9 text-label italic text-muted",children:[(0,U.jsxs)("summary",{className:`flex list-none items-center gap-1.5 truncate ${e?"cursor-pointer [@media(pointer:coarse)]:min-h-11":""}`,title:(0,uJ.tr)("render.reasoning"),children:[(0,U.jsx)(sx.jy,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),(0,U.jsxs)("span",{className:"truncate",children:[n.text.slice(0,150),e?"…":""]})]}),e?(0,U.jsx)("div",{className:"whitespace-pre-wrap break-words pt-1 not-italic",children:pl(n.text)}):null]})}return"svc"===n.kind?(0,U.jsx)("div",{className:"my-1 break-words text-[11.5px] text-muted",children:n.text}):"note"===n.kind?(0,U.jsx)("div",{className:"my-2 break-words text-[12.5px] text-muted",children:u9(n.text)}):(0,U.jsx)("div",{className:`my-0.5 break-words text-[12.5px] ${n.err?"text-danger":"text-secondary"}`,children:n.text})}),fg=(0,Y.createContext)(()=>null).Provider;var fb=n(9267),fv=n(9339);function fw(e){return`llvQuestionDismissed:${e.transcriptPath}:${e.toolUseId}`}function fy(){try{return window.localStorage}catch{return null}}function fk(e,t={}){return t.noPane?"question.noPane":400===e?"question.errorRejected":403===e?"question.errorNotRunning":409===e?"question.errorMoved":502===e?t.delivered?"question.errorUnconfirmed":"question.errorNotDelivered":e>=500?"common.serverUnavailable":"common.failedSend"}function fj({file:e}){let{t}=(0,eh.Ym)(),n=ia(),r=n?"min-h-11":"",i=e.pendingQuestion,[a,s]=(0,Y.useState)("pending"),[l,o]=(0,Y.useState)(""),[c,d]=(0,Y.useState)({}),[u,p]=(0,Y.useState)(""),[m,f]=(0,Y.useState)(""),[h,x]=(0,Y.useState)(!1),[g,b]=(0,Y.useState)(null),[v,w]=(0,Y.useState)(null),[y,k]=(0,Y.useState)(null),j=i?null!==i.paneTarget:null!==e.pid&&"running"===e.proc,N=(0,Y.useMemo)(()=>i?.questions?i.questions.map((e,t)=>(c[t]??[]).map(t=>e.options[t]?.label??String(t+1)).join(", ")).filter(Boolean).join(" \xb7 "):"",[c,i]);if(!i){if(!e.waitingInput)return null;let i=e.waitingInput.menu,c="delivering"===a,d=async(n,r)=>{s("delivering"),o("");try{let a=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"dialog-key",path:e.path,key:n,...i?{question:i.question}:{},.../^[1-9]$/.test(n)?{label:r}:{}})}),l=await a.json();if(!a.ok||!l.ok){s("failed"),o(t(fk(a.status)));return}s("answered"),o(r)}catch{s("failed"),o(t("common.serverUnavailable"))}};return"answered"===a?(0,U.jsx)("div",{id:"question",className:"my-4 rounded-[8px] border border-success/25 bg-success-soft px-4 py-3 text-[13px] font-semibold text-success",children:t("question.sentToPane",{text:l})}):(0,U.jsxs)("div",{id:"question",className:"my-4 rounded-[8px] border border-warning/45 bg-warning-soft p-4 shadow-1",children:[(0,U.jsxs)("div",{className:"mb-2 inline-flex items-center gap-1.5 rounded-full bg-warning-soft px-2 py-0.5 text-[11px] font-bold text-warning",children:[(0,U.jsx)(fb.A,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",t("question.waiting")]}),(0,U.jsxs)("div",{className:"text-[13px] font-semibold text-primary",children:[t("question.pane",{target:e.waitingInput.target})," \xb7 ",function(e,t){let n=Math.max(0,Math.floor(Date.now()/1e3-t));if(n<60)return e("question.sec",{n:n});let r=Math.floor(n/60);return r<60?e("question.min",{n:r}):e("question.hour",{n:Math.floor(r/60)})}(t,e.waitingInput.since)]}),i?(0,U.jsxs)(U.Fragment,{children:[i.tabs.length?(0,U.jsx)("div",{className:"mt-2 flex flex-wrap gap-1.5",children:i.tabs.map((e,t)=>(0,U.jsxs)("span",{className:`rounded-full px-2 py-0.5 text-[11px] font-bold ${e.done?"bg-success/15 text-success":"bg-canvas text-muted"}`,children:[e.done?"✓ ":"",e.label]},t))}):null,(0,U.jsx)("div",{className:"mt-2 text-[14px] font-bold text-primary",children:i.question}),(0,U.jsx)("div",{className:"mt-2 space-y-1.5",children:i.options.map(e=>(0,U.jsxs)("button",{className:`flex w-full items-start gap-2 rounded-[8px] border px-3 py-2 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/35 disabled:opacity-60 ${r} ${e.recommended?"border-warning/45 bg-warning-soft":"border-border bg-canvas"}`,disabled:c||e.value>9,onClick:()=>void d(String(e.value),e.label),children:[(0,U.jsx)("span",{className:"mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded border border-border bg-card text-[10px] font-bold",children:e.value}),(0,U.jsxs)("span",{className:"min-w-0",children:[(0,U.jsx)("span",{className:"block text-[13px] font-bold",children:e.label}),e.description?(0,U.jsx)("span",{className:"block text-[12px] text-muted",children:e.description}):null]})]},e.value))})]}):(0,U.jsx)("pre",{className:"mt-2 max-h-[240px] overflow-auto whitespace-pre-wrap break-words rounded-[8px] border border-border bg-canvas px-3 py-2 text-[12px] text-muted",children:e.waitingInput.screenTail}),(0,U.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[["Tab","Enter","Escape"].map(e=>(0,U.jsx)("button",{className:`inline-flex items-center justify-center rounded-[8px] border border-border bg-canvas text-[12px] font-semibold text-muted disabled:opacity-60 ${n?"min-h-11 min-w-11 px-3":"px-2.5 py-1"}`,disabled:c,onClick:()=>void d(e,"Escape"===e?"Esc":e),children:"Escape"===e?"Esc":e},e)),(0,U.jsx)("span",{className:"text-[12px] text-muted",children:t("question.keysHint")})]}),"delivering"===a?(0,U.jsxs)("div",{className:"mt-2 inline-flex items-center gap-1.5 text-[12px] font-semibold text-muted",children:[(0,U.jsx)(dR.A,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0})," ",t("common.sending")]}):null,"failed"===a?(0,U.jsx)("div",{className:"mt-2 text-[12px] font-semibold text-danger",children:l}):null]})}if(y===i.toolUseId||function(e,t){try{return e?.getItem(fw(t))==="1"}catch{return!1}}(fy(),i))return null;let S=(0,U.jsx)("button",{type:"button","aria-label":t("question.dismiss"),className:`ml-auto inline-flex shrink-0 items-center justify-center rounded text-muted hover:text-danger focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${n?"h-11 w-11":"px-0.5"}`,onClick:()=>{var e=fy();try{e?.setItem(fw(i),"1")}catch{}k(i.toolUseId)},children:(0,U.jsx)(K.A,{className:n?"h-4 w-4":"h-3 w-3","aria-hidden":!0})}),C=async(e,n,r=null)=>{s("delivering"),o(""),b({payload:e,optimistic:n,selection:r}),w(null);try{let a=await fetch("/api/answer",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({transcriptPath:i.transcriptPath,toolUseId:i.toolUseId,kind:i.kind,...e})}),l=await a.json();if(!a.ok||!l.ok){if(409===a.status&&(l.superseded||l.answer)){s("superseded"),o(l.answer??t("question.alreadyAnswered"));return}s("failed"),o(t(fk(a.status,l))),w(r);return}s("answered"),o(l.answer??n)}catch{s("failed"),o(t("common.serverUnavailable")),w(r)}},A=(e=c)=>i.questions?.map((t,n)=>e[n]??[])??[],I=i.questions?.length??0,M=I>1||(i.questions?.some(e=>e.multiSelect)??!1),T=i.questions?.every((e,t)=>(c[t]??[]).length>0)??!1,P=async()=>{x(!0),o("");try{let n=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"resume",path:e.path})}),r=await n.json();if(!n.ok||!r.ok)return void o(t("question.openFailed"));o(t("question.opened",{target:r.target??"tmux"}))}catch{o(t("common.serverUnavailable"))}finally{x(!1)}},$="delivering"===a||!j;return"answered"===a?(0,U.jsx)("div",{id:"question",className:"my-4 rounded-[8px] border border-success/25 bg-success-soft px-4 py-3 text-[13px] font-semibold text-success",children:t("question.answered",{text:l||N})}):"superseded"===a?(0,U.jsx)("div",{id:"question",className:"my-4 rounded-[8px] border border-border bg-sunken px-4 py-3 text-[13px] font-semibold text-muted",children:t("question.answeredElsewhere",{text:l})}):i&&!j?(0,U.jsxs)("div",{id:"question",className:"my-4 rounded-[8px] border border-warning/45 bg-warning-soft p-4 shadow-1",children:[(0,U.jsxs)("div",{className:"mb-2 flex items-center gap-2",children:[(0,U.jsxs)("span",{className:"inline-flex items-center gap-1.5 rounded-full bg-warning-soft px-2 py-0.5 text-[11px] font-bold text-warning",children:[(0,U.jsx)(fb.A,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",t("question.waiting")]}),S]}),(0,U.jsx)("div",{className:"text-[13px] font-semibold text-danger",children:t("question.noPane")}),"plan"===i.kind?(0,U.jsx)("pre",{className:"mt-2 max-h-[320px] overflow-auto whitespace-pre-wrap break-words rounded-[8px] border border-border bg-canvas px-3 py-2 text-[13px]",children:i.plan}):i.questions?.map((e,t)=>(0,U.jsxs)("div",{className:"mt-2",children:[(0,U.jsx)("div",{className:"text-[12px] font-bold text-muted",children:e.header}),(0,U.jsx)("div",{className:"text-[13px] font-semibold text-primary",children:e.question})]},t)),(0,U.jsx)("button",{className:"mt-3 rounded-[8px] bg-accent px-3 py-1.5 text-[13px] font-bold text-white disabled:opacity-60",disabled:h,onClick:P,children:t("question.openSession")}),l?(0,U.jsx)("div",{className:"mt-2 text-[12px] font-semibold text-muted",children:l}):null]}):(0,U.jsxs)("div",{id:"question",className:"my-4 rounded-[8px] border border-warning/45 bg-warning-soft p-4 shadow-1",children:[(0,U.jsxs)("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[(0,U.jsxs)("span",{className:"inline-flex items-center gap-1.5 rounded-full bg-warning-soft px-2 py-0.5 text-[11px] font-bold text-warning",children:[(0,U.jsx)(fb.A,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",t("question.waiting")]}),j?null:(0,U.jsx)("span",{className:"text-[12px] font-semibold text-danger",children:t("question.noPane")}),S]}),"plan"===i.kind?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("pre",{className:"max-h-[420px] overflow-auto whitespace-pre-wrap break-words rounded-[8px] border border-border bg-canvas px-3 py-2 text-[13px]",children:i.plan}),(0,U.jsx)("textarea",{className:"mt-3 min-h-20 w-full resize-y rounded-[8px] border border-border bg-canvas px-3 py-2 text-[13px] outline-none focus-visible:ring-2 focus-visible:ring-accent/35",placeholder:t("question.rejectComment"),value:m,onChange:e=>f(e.target.value)}),(0,U.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2",children:[(0,U.jsxs)("button",{className:`inline-flex items-center gap-1.5 rounded-[8px] bg-success px-3 py-1.5 text-[13px] font-bold text-white disabled:opacity-60 ${r}`,disabled:$,onClick:()=>C({approve:!0},t("question.approved")),children:[(0,U.jsx)(fv.A,{className:"h-4 w-4","aria-hidden":!0})," ",t("question.approve")]}),(0,U.jsxs)("button",{className:`inline-flex items-center gap-1.5 rounded-[8px] bg-danger px-3 py-1.5 text-[13px] font-bold text-white disabled:opacity-60 ${r}`,disabled:$,onClick:()=>C({approve:!1,text:m},t("question.rejected")),children:[(0,U.jsx)(K.A,{className:"h-4 w-4","aria-hidden":!0})," ",t("question.reject")]})]})]}):(0,U.jsxs)(U.Fragment,{children:[i.questions?.map((e,n)=>(0,U.jsxs)("section",{className:"mt-3 first:mt-0",children:[(0,U.jsx)("div",{className:"mb-1 inline-flex rounded-full bg-canvas px-2 py-0.5 text-[11px] font-bold text-muted",children:e.header}),(0,U.jsx)("div",{className:"mb-2 text-[14px] font-bold text-primary",children:e.question}),(0,U.jsx)("div",{className:"space-y-1.5",children:e.options.map((i,a)=>{let s=(c[n]??[]).includes(a),l=(v?.[n]??[]).includes(a);return(0,U.jsxs)("button",{"data-choice-state":l?"failed":s?"selected":void 0,className:`flex w-full items-start gap-2 rounded-[8px] border px-3 py-2 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/35 ${r} ${l?"border-danger/45 bg-danger-soft":s?"border-accent/45 bg-accent/10":i.recommended?"border-warning/45 bg-warning-soft":"border-border bg-canvas"}`,disabled:$,onClick:()=>{var t;let r={...c,[n]:[a]};t=e.multiSelect,w(null),d(e=>{let r=e[n]??[],i=t?r.includes(a)?r.filter(e=>e!==a):[...r,a]:[a];return{...e,[n]:i}}),e.multiSelect||1!==I||C({answers:A(r)},i.label,r)},children:[(0,U.jsx)("span",{className:`mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded border bg-card text-[10px] font-bold ${l?"border-danger/45 text-danger":"border-border"}`,children:l?"!":s?"✓":a+1}),(0,U.jsxs)("span",{className:"min-w-0",children:[(0,U.jsxs)("span",{className:"block text-[13px] font-bold",children:[i.label,l?(0,U.jsxs)("span",{className:"ml-1.5 font-semibold text-danger",children:["\xb7 ",t("question.failedChoice")]}):null]}),i.description?(0,U.jsx)("span",{className:"block text-[12px] text-muted",children:i.description}):null]})]},a)})})]},n)),I<=1?(0,U.jsxs)("div",{className:"mt-3 flex gap-2",children:[(0,U.jsx)("input",{className:`min-w-0 flex-1 rounded-[8px] border border-border bg-canvas px-3 py-1.5 text-[13px] outline-none focus-visible:ring-2 focus-visible:ring-accent/35 ${r}`,placeholder:t("question.ownAnswer"),value:u,onChange:e=>p(e.target.value)}),(0,U.jsxs)("button",{className:`inline-flex items-center gap-1.5 rounded-[8px] bg-accent px-3 py-1.5 text-[13px] font-bold text-white disabled:opacity-60 ${r}`,disabled:$||!u.trim(),onClick:()=>C({text:u},u),children:[(0,U.jsx)(fn.A,{className:"h-4 w-4","aria-hidden":!0})," ",t("common.send")]})]}):null,M?(0,U.jsxs)("button",{className:`mt-3 inline-flex items-center gap-1.5 rounded-[8px] bg-accent px-3 py-1.5 text-[13px] font-bold text-white disabled:opacity-60 ${r}`,disabled:$||!T,onClick:()=>C({answers:A()},N,c),children:[(0,U.jsx)(fn.A,{className:"h-4 w-4","aria-hidden":!0})," ",t("common.send")]}):null]}),"delivering"===a?(0,U.jsxs)("div",{className:"mt-3 inline-flex items-center gap-1.5 text-[12px] font-semibold text-muted",children:[(0,U.jsx)(dR.A,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0})," ",t("common.sending")]}):null,"failed"===a?(0,U.jsxs)("div",{role:"alert",className:"mt-3 flex flex-wrap items-center gap-2 rounded-[8px] border border-danger/30 bg-danger-soft px-2.5 py-2",children:[(0,U.jsx)("span",{className:"text-[12px] font-bold text-danger",children:t("question.deliveryFailed")}),(0,U.jsx)("span",{className:"min-w-0 text-[12px] font-semibold text-danger",children:l}),g?(0,U.jsxs)("button",{type:"button",className:`ml-auto inline-flex items-center gap-1.5 rounded-[8px] border border-border bg-card px-3 py-1.5 text-[12px] font-bold text-primary hover:border-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60 ${r}`,disabled:!j,onClick:()=>void C(g.payload,g.optimistic,g.selection),children:[(0,U.jsx)(m$.A,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",t("question.retryAnswer")]}):null]}):null]})}let fN={approval:"runtime.attention.approval",permission:"runtime.attention.permission",question:"runtime.attention.question",waiting_heuristic:"runtime.attention.waiting_heuristic"};function fS({attention:e,onApprove:t,onDeny:n,onAnswerQuestion:r,onAnswerQuestions:i,onDismiss:a,busy:s,archived:l=!1}){let{t:o}=(0,eh.Ym)(),c=ia(),d=(0,Y.useRef)(null),u="waiting_heuristic"===e.kind,p=function(e){let t=null===e?null:Math.max(0,Math.ceil(e/1e3)),[n,r]=(0,Y.useState)(t),[i,a]=(0,Y.useState)(e);return e!==i&&(a(e),r(t)),(0,Y.useEffect)(()=>{if(null===e)return;let t=window.setInterval(()=>r(e=>null===e||e<=0?0:e-1),1e3);return()=>window.clearInterval(t)},[e]),n}(e.autoResolutionMs??null),[m,f]=(0,Y.useState)({}),[h,x]=(0,Y.useState)(e.id);h!==e.id&&(x(e.id),f({})),(0,Y.useEffect)(()=>{if(l)return;let e=d.current;if(!e)return;let r=()=>Array.from(e.querySelectorAll('button,[href],input,select,textarea,[tabindex]:not([tabindex="-1"])')).filter(e=>!e.hasAttribute("disabled")),i=document.activeElement,a=i instanceof HTMLElement&&("TEXTAREA"===i.tagName||"INPUT"===i.tagName||i.isContentEditable),s=r(),o=s.find(e=>!e.hasAttribute("data-attention-dismiss"))??s[0];a||o?.focus({preventScroll:!0});let c=e=>{if("Escape"===e.key&&n){e.preventDefault(),n();return}if("Enter"===e.key&&t&&e.target?.tagName!=="BUTTON"){e.preventDefault(),t();return}if("Tab"!==e.key)return;let i=r();if(0===i.length)return;let a=i[0],s=i[i.length-1];e.shiftKey&&document.activeElement===a?(e.preventDefault(),s.focus({preventScroll:!0})):e.shiftKey||document.activeElement!==s||(e.preventDefault(),a.focus({preventScroll:!0}))};return e.addEventListener("keydown",c),()=>e.removeEventListener("keydown",c)},[e.id,t,n,l]);let g=e.request.questions??(e.request.question?[e.request.question]:[]),b=e.unowned?"border-danger/60 bg-danger/5":u?"border-dashed border-border bg-canvas":"border-warning/45 bg-warning-soft";return(0,U.jsxs)("div",{ref:d,role:"group","aria-label":o("runtime.attention.title"),"data-attention-kind":e.kind,"data-attention-archived":l||void 0,className:`my-3 rounded-[8px] border p-4 shadow-1 ${b} ${l?"opacity-60 saturate-50":""}`,children:[(0,U.jsxs)("div",{className:"mb-2 flex flex-wrap items-center gap-2",children:[e.unowned&&!l?(0,U.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-danger/15 px-2 py-0.5 text-[11px] font-bold text-danger",role:"alert",children:[(0,U.jsx)(i4.A,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",o("runtime.attention.unowned")]}):null,(0,U.jsx)("span",{className:`inline-flex items-center rounded-full px-2 py-0.5 text-[11px] font-bold ${u?"bg-sunken text-muted":"bg-warning-soft text-warning"}`,children:o(fN[e.kind])}),u?(0,U.jsx)("span",{className:"text-[11px] text-muted",children:o("runtime.attention.heuristicNote")}):null,null===p||l?null:(0,U.jsx)("span",{className:"text-[11px] font-semibold text-muted",role:"timer","aria-live":"off",children:o("runtime.attention.expiresIn",{seconds:p})}),a&&!l?(0,U.jsx)("button",{type:"button","data-attention-dismiss":!0,"aria-label":o("question.dismiss"),className:`ml-auto inline-flex shrink-0 items-center justify-center rounded text-muted hover:text-danger focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${c?"h-11 w-11":"px-0.5"}`,onClick:a,children:(0,U.jsx)(K.A,{className:c?"h-4 w-4":"h-3 w-3","aria-hidden":!0})}):null]}),e.request.title?(0,U.jsx)("div",{className:"text-[13px] font-semibold text-primary",children:e.request.title}):null,e.request.command?(0,U.jsxs)("pre",{className:"mt-2 max-h-[220px] overflow-auto whitespace-pre-wrap break-words rounded-[8px] border border-border bg-canvas px-3 py-2 text-[12px]",children:[(0,U.jsx)("span",{className:"mb-1 block text-[10px] font-semibold text-secondary",children:o("runtime.attention.command")}),e.request.command]}):null,e.request.tool?(0,U.jsxs)("div",{className:"mt-2 text-[13px]",children:[(0,U.jsx)("span",{className:"text-[11px] font-semibold text-secondary",children:o("runtime.attention.tool")})," ",(0,U.jsx)("span",{className:"font-semibold text-primary",children:e.request.tool})]}):null,e.request.detail?(0,U.jsx)("div",{className:"mt-2 text-[12px] text-muted",children:e.request.detail}):null,g.length>0&&!l?(0,U.jsxs)("div",{className:"mt-2 space-y-3",children:[g.map((e,t)=>{let n=g.length>1||!0===e.multiSelect,i=m[t]??[];return(0,U.jsxs)("div",{children:[e.header?(0,U.jsx)("div",{className:"text-[11px] font-bold text-muted",children:e.header}):null,(0,U.jsx)("div",{className:"text-[14px] font-bold text-primary",children:e.prompt}),(0,U.jsx)("div",{className:"mt-2 space-y-1.5",children:(e.options??[]).map((a,l)=>(0,U.jsxs)("button",{className:`flex w-full items-start gap-2 rounded-[8px] border px-3 py-2 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/35 disabled:opacity-60 ${i.includes(l)?"border-accent bg-accent/10":a.recommended?"border-warning/45 bg-warning-soft":"border-border bg-canvas"}`,disabled:s,onClick:()=>{n?f(n=>{let r=n[t]??[],i=e.multiSelect?r.includes(l)?r.filter(e=>e!==l):[...r,l]:[l];return{...n,[t]:i}}):r?.(l,t)},children:[(0,U.jsx)("span",{className:"mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded border border-border bg-card text-[10px] font-bold",children:l+1}),(0,U.jsxs)("span",{className:"min-w-0",children:[(0,U.jsx)("span",{className:"block text-[13px] font-bold",children:a.label}),a.description?(0,U.jsx)("span",{className:"block text-[12px] text-muted",children:a.description}):null]})]},l))})]},t)}),g.length>1||g.some(e=>e.multiSelect)?(0,U.jsxs)("button",{className:"inline-flex items-center gap-1.5 rounded-[8px] bg-accent px-3 py-1.5 text-[13px] font-bold text-white disabled:opacity-60",disabled:s||g.some((e,t)=>!m[t]?.length),onClick:()=>i?.(g.map((e,t)=>m[t]??[])),children:[(0,U.jsx)(fv.A,{className:"h-4 w-4","aria-hidden":!0})," ",o("runtime.attention.answer")]}):null]}):null,("approval"===e.kind||"permission"===e.kind)&&(t||n)&&!l?(0,U.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[t?(0,U.jsxs)("button",{className:"inline-flex items-center gap-1.5 rounded-[8px] bg-success px-3 py-1.5 text-[13px] font-bold text-white disabled:opacity-60",disabled:s,onClick:t,children:[(0,U.jsx)(fv.A,{className:"h-4 w-4","aria-hidden":!0})," ",o("runtime.attention.approve")]}):null,n?(0,U.jsxs)("button",{className:"inline-flex items-center gap-1.5 rounded-[8px] bg-danger px-3 py-1.5 text-[13px] font-bold text-white disabled:opacity-60",disabled:s,onClick:n,children:[(0,U.jsx)(K.A,{className:"h-4 w-4","aria-hidden":!0})," ",o("runtime.attention.deny")]}):null,(0,U.jsx)("span",{className:"text-[11px] text-muted",children:o("runtime.attention.keysHint")})]}):null,s&&!l?(0,U.jsxs)("div",{className:"mt-2 inline-flex items-center gap-1.5 text-[12px] font-semibold text-muted",children:[(0,U.jsx)(dR.A,{className:"h-3.5 w-3.5 animate-spin motion-reduce:animate-none","aria-hidden":!0})," ",o("runtime.attention.answering")]}):null,l?(0,U.jsx)("div",{className:"mt-3 text-[12px] font-semibold text-muted",children:o("deadHost.expiredCard")}):null]})}function fC({t:e,sinceLabel:t,onRespawn:n,onAttach:r,onRecheck:i,respawnBusy:a=!1,recheckBusy:s=!1,respawnError:l=null,recheckError:o=null}){return(0,U.jsxs)("div",{role:"status","aria-live":"polite","data-dead-host-banner":!0,className:"shrink-0 border-b border-danger/45 bg-danger-soft px-2.5 py-1",children:[(0,U.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1",children:[(0,U.jsx)(i4.A,{className:"h-3.5 w-3.5 shrink-0 text-danger","aria-hidden":!0}),(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate text-label font-bold text-danger",children:e("deadHost.title",{since:t})}),(0,U.jsxs)("button",{type:"button",onClick:n,disabled:a,className:"inline-flex min-h-7 items-center gap-1 rounded-control border border-accent bg-accent px-2 text-label font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-60 [@media(pointer:coarse)]:min-h-11",children:[a?(0,U.jsx)(sx.kr,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):(0,U.jsx)(sx.jG,{className:"h-3.5 w-3.5","aria-hidden":!0}),e("deadHost.respawn")]}),(0,U.jsx)("button",{type:"button",onClick:r,title:e("deadHost.attach"),"aria-label":e("deadHost.attach"),className:"inline-flex min-h-7 items-center gap-1 rounded-control border border-border bg-canvas px-2 text-label font-semibold text-secondary hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 [@media(pointer:coarse)]:min-h-11",children:(0,U.jsx)(sx.ke,{className:"h-3.5 w-3.5","aria-hidden":!0})}),(0,U.jsx)("button",{type:"button",onClick:i,disabled:s,title:e("deadHost.recheck"),"aria-label":e("deadHost.recheck"),className:"inline-flex min-h-7 items-center rounded-control border border-border bg-canvas px-1.5 text-muted hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60 [@media(pointer:coarse)]:min-h-11",children:s?(0,U.jsx)(sx.kr,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):(0,U.jsx)(sg.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),l?(0,U.jsx)("p",{role:"alert",className:"mt-1 text-caption font-semibold text-danger",children:l}):null,o?(0,U.jsx)("p",{role:"alert",className:"mt-1 text-caption font-semibold text-danger",children:o}):null]})}function fA({file:e}){let{t}=(0,eh.Ym)(),[n,r]=(0,Y.useState)(!1),[i,a]=(0,Y.useState)(!1),[s,l]=(0,Y.useState)(!1),[o,c]=(0,Y.useState)(null),[d,u]=(0,Y.useState)(null),p=async()=>{if(!i){a(!0),c(null),u(null);try{let n=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"resume",path:e.path})});if(n.ok)await s7()||u(t("deadHost.recheckFailed"));else{let e=await n.json().catch(()=>({}));c(e.error??t("deadHost.respawnFailed"))}}catch{c(t("deadHost.respawnFailed"))}finally{a(!1)}}},m=async()=>{s||(l(!0),u(null),await s7()||u(t("deadHost.recheckFailed")),l(!1))};return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(fC,{t:t,sinceLabel:(0,tw.rK)(e.mtime),onRespawn:()=>void p(),onAttach:()=>r(!0),onRecheck:()=>void m(),respawnBusy:i,recheckBusy:s,respawnError:o,recheckError:d}),n?(0,U.jsx)(ur,{file:e,onClose:()=>r(!1)}):null]})}function fI(e){return`llvAttentionDismissed:${e.conversationId}:${e.id}`}function fM(){try{return window.localStorage}catch{return null}}function fT(e,t){let n=e.request.protocol;return n?.engine==="claude"?t?{behavior:"allow"}:{behavior:"deny",message:"Denied in Viewer"}:{decision:t?"accept":"decline"}}function fP(e,t){let n=e.request.questions??(e.request.question?[e.request.question]:[]),r=n.map((e,n)=>(t[n]??[]).map(t=>e.options?.[t]?.label??String(t+1))),i=e.request.protocol;if(i?.engine==="claude"){let e=Object.fromEntries(n.map((e,t)=>[e.prompt,r[t].join(", ")]));return{behavior:"allow",updatedInput:{...i.input??{},answers:e}}}let a=i?.questionIds??(i?.questionId?[i.questionId]:[]);return{answers:Object.fromEntries(r.map((e,t)=>[a[t]??`answer_${t+1}`,{answers:e}]))}}function f$({file:e}){let{t}=(0,eh.Ym)(),n=s4(W(e)),[r,i]=(0,Y.useState)(null),[a,s]=(0,Y.useState)(null),[l,o]=(0,Y.useState)([]);if(!n||n.legacy)return e.pendingQuestion||e.waitingInput?(0,U.jsx)(fj,{file:e}):null;let c=!!n&&!n.legacy&&("dead"===n.session.host||"unhosted"===n.session.host),d=async(e,r)=>{var a,l;i(e.id),s(null);let o=await (a=n.session.conversationId,l=e.id,s8("/api/runtime/answer",{conversationId:a,attentionId:l,resolution:r,operationId:rs()}));o.ok||s(o.error??t("common.failedSend")),i(null)},u=n.attentions.filter(e=>!l.includes(e.id)&&!function(e,t){try{return e?.getItem(fI(t))==="1"}catch{return!1}}(fM(),e));return(0,U.jsxs)(U.Fragment,{children:[u.map(e=>(0,U.jsx)(fS,{attention:e,archived:c,busy:r===e.id,onApprove:c||"approval"!==e.kind&&"permission"!==e.kind?void 0:()=>void d(e,fT(e,!0)),onDeny:c||"approval"!==e.kind&&"permission"!==e.kind?void 0:()=>void d(e,fT(e,!1)),onAnswerQuestion:c||"question"!==e.kind?void 0:t=>{d(e,fP(e,[[t]]))},onAnswerQuestions:c||"question"!==e.kind?void 0:t=>void d(e,fP(e,t)),onDismiss:c||"question"!==e.kind?void 0:()=>(e=>{var t=fM();try{t?.setItem(fI(e),"1")}catch{}o(t=>[...t,e.id])})(e)},e.id)),a?(0,U.jsx)("div",{role:"alert",className:"my-2 text-[12px] font-semibold text-danger",children:a}):null]})}function fE(e,t){return"prose"===e.kind&&"prose"===t.kind&&e.engine===t.engine&&String(e.ts)===String(t.ts)}function fR({file:e}){let{t}=(0,eh.Ym)();return"running"===e.proc?(0,U.jsxs)(sv,{tone:"success","data-capture-volatile":"pid",children:[(0,U.jsx)(sx.jG,{className:"h-3 w-3","aria-hidden":!0})," PID ",e.pid]}):"killed"===e.proc||"stalled"===e.activity?(0,U.jsx)(sv,{tone:"danger",children:t("task.interruptedBadge")}):"done"===e.proc?(0,U.jsx)(sv,{tone:"neutral",children:t("task.finishedBadge")}):null}function fO({file:e,compact:t=!1,hideChip:n=!1}){let{t:r}=(0,eh.Ym)(),i=ia(),[a,s]=(0,Y.useState)(!1),[l,o]=(0,Y.useState)(!1),[c,d]=(0,Y.useState)(""),[u,p]=(0,Y.useState)(!1),{caps:m,structuredSession:f}=cs(e),h=m.controls.kill;(0,Y.useEffect)(()=>{if(!a)return;let e=window.setTimeout(()=>s(!1),5e3);return()=>window.clearTimeout(e)},[a]);let x=(0,U.jsx)(fR,{file:e}),g=async()=>{o(!0),d("");try{if(f){let e=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"kill",conversationId:f.session.conversationId})}),t=await e.json();if(!e.ok||!t.ok)return void d(t.error??r("task.stopFailed"));d(r("task.killRequested")),s(!1);return}let t=await fetch("/api/proc",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:e.path,force:u})}),n=await t.json();if(!t.ok||!n.ok){d(n.error??r("task.stopFailed")),p(!0);return}d(r("task.signalSent",{signal:u?"SIGKILL":"SIGTERM",pid:n.pid??""})),s(!1)}catch{d(r("common.serverUnavailable")),p(!0)}finally{o(!1)}},b="disabled"===h.state,v=b?r(h.reason):"",w=(0,ex.cr)(e.title,48)||r("task.confirmKillUntitled");return(0,U.jsxs)("span",{className:`inline-flex min-w-0 flex-wrap items-center gap-1.5 ${t?"text-[10.5px]":"text-xs"}`,children:[n?null:x,b?(0,U.jsx)(ly,{label:v,children:(0,U.jsx)("button",{type:"button","aria-disabled":!0,disabled:!0,"aria-label":`${r("task.kill")} — ${v}`,className:`inline-flex items-center whitespace-nowrap rounded-full border border-border bg-card text-[11px] font-semibold text-muted opacity-50 ${i?"min-h-11 px-3":"px-2 py-0.5"}`,children:r("task.kill")})}):"enabled"===h.state?a?(0,U.jsxs)("span",{className:"inline-flex min-w-0 max-w-full items-center gap-1 rounded-[8px] border border-danger/30 bg-danger-soft px-1.5 py-0.5",children:[(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate px-1 text-[11px] font-semibold text-danger",title:null===e.pid?void 0:r("task.confirmKill",{pid:e.pid}),children:r("task.confirmKillNamed",{name:w})}),null===e.pid?null:(0,U.jsxs)("span",{className:"hidden shrink-0 text-[10px] tabular-nums text-muted sm:inline",children:["PID ",e.pid]}),(0,U.jsx)("button",{className:`inline-flex shrink-0 items-center whitespace-nowrap rounded-lg bg-danger text-[11px] font-bold tabular-nums text-white disabled:opacity-60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-danger/50 ${i?"min-h-11 px-3":"px-2 py-0.5"}`,disabled:l,onClick:g,children:u?"SIGKILL":t?r("common.yes"):r("task.confirmKillYes")}),(0,U.jsx)("button",{className:`inline-flex items-center whitespace-nowrap rounded-lg border border-border bg-card text-[11px] font-semibold text-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${i?"min-h-11 px-3":"px-2 py-0.5"}`,onClick:()=>s(!1),children:t?r("common.no"):r("common.cancel")})]}):(0,U.jsx)("button",{className:`inline-flex items-center whitespace-nowrap rounded-full border border-border bg-card text-[11px] font-semibold text-muted hover:border-danger/40 hover:text-danger focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${i?"min-h-11 px-3":"px-2 py-0.5"}`,"aria-label":r("task.stopAria",{pid:e.pid??""}),onClick:()=>s(!0),children:r("task.kill")}):null,c?(0,U.jsx)("span",{className:"max-w-[220px] truncate text-[11px] font-semibold text-muted",children:c}):null]})}function fD({file:e}){let{t}=(0,eh.Ym)();return"claude-tasks"!==e.root?null:(0,U.jsxs)("div",{className:"mb-4 mt-1 rounded-[12px] border border-border bg-card px-4 py-3 shadow-1",children:[(0,U.jsx)("div",{className:"mb-2 flex flex-wrap items-center gap-2",children:(0,U.jsx)(fR,{file:e})}),e.cmd?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("div",{className:"mb-1 text-[13px] font-semibold",children:e.cmdDesc||t("task.backgroundCommand")}),(0,U.jsxs)("code",{className:"block whitespace-pre-wrap break-words rounded-lg border border-border bg-sunken px-2.5 py-2 font-mono text-[12px]",children:["$ ",e.cmd]})]}):(0,U.jsx)("div",{className:"text-[13px] text-muted",children:t("task.commandNotFound")})]})}function fL({startedAt:e,label:t}){let n,r,i,a,s,[l,o]=(0,Y.useState)(()=>Date.now());return(0,Y.useEffect)(()=>{let e=setInterval(()=>o(Date.now()),1e3);return()=>clearInterval(e)},[]),(0,U.jsx)("span",{role:"timer","aria-label":t,className:"tabular-nums",children:(r=Math.floor((n=Math.max(0,Math.floor((l-e)/1e3)))/3600),i=Math.floor(n%3600/60),a=n%60,s=e=>String(e).padStart(2,"0"),r>0?`${r}:${s(i)}:${s(a)}`:`${i}:${s(a)}`)})}function f_({file:e,workingLabel:t,workingIcon:n,compact:r=!1}){let{t:i}=(0,eh.Ym)(),a=e.lastTurn??null,s=ua(e),l=r?"px-3 py-1":"px-6 py-1.5";if(s)return(0,U.jsxs)("div",{"data-turn-status":"running",className:`flex shrink-0 items-center justify-center gap-2 border-t border-border ${l} text-[12px] font-semibold text-success`,children:[(0,U.jsxs)("span",{className:"flex items-center gap-0.5","aria-hidden":!0,children:[(0,U.jsx)("span",{className:"h-1.5 w-1.5 animate-bounce rounded-full bg-success"}),(0,U.jsx)("span",{className:"h-1.5 w-1.5 animate-bounce rounded-full bg-success [animation-delay:150ms]"}),(0,U.jsx)("span",{className:"h-1.5 w-1.5 animate-bounce rounded-full bg-success [animation-delay:300ms]"})]}),(0,U.jsx)(n,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),(0,U.jsx)("span",{className:"min-w-0 truncate",children:t}),a?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("span",{"aria-hidden":!0,children:"\xb7"}),(0,U.jsx)(fL,{startedAt:a.startedAt,label:i("turn.timer")})]}):null]});let o=function(e,t=(0,eh.JK)()){let n=us(e);return null===n?null:(0,eh.Tl)(t,"turn.worked",{d:ui(n,t)})}(e);return o?(0,U.jsxs)("div",{role:"note","data-turn-status":"finished",className:`flex shrink-0 items-center gap-2 border-t border-border ${l} text-[11px] font-semibold text-muted`,children:[(0,U.jsx)("span",{className:"h-px flex-1 bg-border","aria-hidden":!0}),(0,U.jsx)("span",{className:"tabular-nums",children:o}),(0,U.jsx)("span",{className:"h-px flex-1 bg-border","aria-hidden":!0})]}):null}let fF=window.matchMedia("(pointer: coarse)").matches?500:2500,fq=window.matchMedia("(pointer: coarse)").matches?1e3:6e3,fz={items:[],hiddenServiceCount:0},fH=new pK(300);function fU(e){return Array.from(e.querySelectorAll("[data-feed-key]"))}function fB({file:e,showSvc:t,lineFilter:n,onStatus:r,paused:i,follow:a,setFollow:s,compact:l=!1,onLaunchRetry:o}){var c,d,u,p,m,f,h;let x,{locale:g,t:b}=(0,eh.Ym)(),v=e?W(e):null,w=od(v??""),y=(c=v??"",(0,Y.useSyncExternalStore)(e=>(pC.add(e),()=>pC.delete(e)),()=>p$(c),()=>pA)),k=e?.launch??e?.spawn??null,j=e?.conversationId??null,N=e?.generation??null,S=(0,Y.useMemo)(()=>j&&N?{conversationId:j,generation:N}:null,[j,N]),C=k?.conversationId??null,A=k?.generation??null,I=(0,Y.useMemo)(()=>C&&A?{conversationId:C,generation:A}:null,[C,A]),M=!!(S&&I&&S.conversationId===I.conversationId&&S.generation===I.generation),T=(d=e?.conversationId??null,u=e?.path??null,sZ(e=>s5(e,d,u),null,s2))?.session??null,P=T?.liveTurn??null,$=T?.turn??null,[E,R]=(0,Y.useState)(()=>v?fH.get(v)?.magnet??a:a),O=e&&X(e)?T?.artifactPath??null:null,D=(0,Y.useMemo)(()=>e&&O?{...e,path:O}:e,[e,O]),L=D?.path??null,_=function(e,t=!1,n=2500){let[r]=(0,Y.useState)(()=>e?uO(e.path,n):null),i=r?.win??{lines:[],start:0},a=(0,Y.useRef)(n),[s,l]=(0,Y.useState)(i),[o,c]=(0,Y.useState)(r?.size??0),[d,u]=(0,Y.useState)(!!(e&&!r)),[p,m]=(0,Y.useState)(null),[f,h]=(0,Y.useState)(r?.tickTime??null),[x,g]=(0,Y.useState)(!1),[b,v]=(0,Y.useState)(r?.hasMore??!1),[w,y]=(0,Y.useState)(!1),[k,j]=(0,Y.useState)(0),N=(0,Y.useRef)(i),S=(0,Y.useRef)(r?.size??0),C=(0,Y.useRef)(r?.tickTime??null),A=(0,Y.useRef)(r?.hasMore??!1),I=(0,Y.useRef)(r?.offset??0),M=(0,Y.useRef)(r?.historyStart??0),T=(0,Y.useRef)(r?.partial??""),P=(0,Y.useRef)(r?.first??!0),$=(0,Y.useRef)(0),E=(0,Y.useRef)(!1);(0,Y.useEffect)(()=>{a.current=n},[n]);let R=e=>{N.current=e,l(e)},O=e=>{A.current=e,v(e)},D=e=>{var t={win:N.current,size:S.current,offset:I.current,historyStart:M.current,partial:T.current,first:P.current,hasMore:A.current,tickTime:C.current};for(uE.delete(e),uE.set(e,uR(t,6e3));uE.size>24;){let e=uE.keys().next().value;if(!e)break;uE.delete(e)}},L=()=>{I.current=0,M.current=0,T.current="",P.current=!0,O(!1)},_=(0,Y.useCallback)(()=>{e&&uE.delete(e.path),R({lines:[],start:0}),L()},[e?.path]);(0,Y.useEffect)(()=>{$.current+=1;let t=e?uO(e.path,a.current):null,n=t?.win??{lines:[],start:0};N.current=n,I.current=t?.offset??0,M.current=t?.historyStart??0,T.current=t?.partial??"",P.current=t?.first??!0,A.current=t?.hasMore??!1,S.current=t?.size??e?.size??0,C.current=t?.tickTime??null,l(n),v(A.current),c(S.current),h(C.current),m(null),u(!!(e&&!t))},[e?.path]),(0,Y.useEffect)(()=>{var n;if(!e||x||t)return;let r=!0,i=$.current,s=(n={path:e.path,getOffset:()=>I.current,onChunk:t=>{if(r&&i===$.current){if("transportError"in t){m((0,eh.Tl)((0,eh.JK)(),"common.serverUnavailable")),u(!1);return}if("error"in t&&t.error){m(t.error),u(!1);return}if(I.current>t.size&&(L(),R({lines:[],start:0})),t.data){let e=T.current+t.data;if(T.current="",P.current){if(M.current=t.start,t.start>0){let n=e.indexOf("\n");M.current=t.start+(n>=0?u$(e.slice(0,n+1)):u$(e)),e=n>=0?e.slice(n+1):""}O(M.current>0)}let n=e.split("\n");T.current=n.pop()??"";let r=n.map(e=>e.trim()).filter(Boolean);if(0===I.current)R({lines:r,start:0});else if(r.length){let e=N.current,t=e.lines.concat(r),n=a.current;R(n>0&&t.length>n?{lines:t.slice(-n),start:e.start+(t.length-n)}:{lines:t,start:e.start})}P.current=!1}I.current=t.offset,S.current=t.size,c(t.size),m(null),t.data&&(C.current=new Date,h(C.current)),D(e.path),u(!1)}}},um.add(n),uy?(null===uf&&(uf=setInterval(()=>void uA(),1200)),uI()):uP(),()=>{(um.delete(n),0===um.size)?(uS(),uC(),uh=uN(uh,clearTimeout),ux=uN(ux,clearTimeout),uy=!1,ub=!1,uv=!1,uw=!1):uy?uI():uP()});return()=>{r=!1,s()}},[e?.path,x,t]);let F=(0,Y.useCallback)(async()=>{if(!e||E.current||M.current<=0)return 0;E.current=!0,y(!0);let t=$.current;try{let n="",r=M.current;for(let i=0;i<4;i+=1){let i=await fetch(`/api/log?path=${encodeURIComponent(e.path)}&before=${r}`),a=await i.json();if(t!==$.current||"error"in a&&a.error)return 0;if(n=a.data+n,r=a.start,0===r||n.slice(0,-1).includes("\n"))break}let i=r;if(r>0){let e=n.indexOf("\n");if(e<0||e===n.length-1)return 0;i=r+u$(n.slice(0,e+1)),n=n.slice(e+1)}let a=n.split("\n");""===a.at(-1)&&a.pop();let s=a.map(e=>e.trim()).filter(Boolean);if(M.current=i,O(i>0),s.length){let e=N.current;R({lines:s.concat(e.lines),start:e.start-s.length}),j(e=>e+1)}return D(e.path),s.length}catch{return 0}finally{E.current=!1,y(!1)}},[e?.path]);return{lines:s.lines,linesStart:s.start,size:o,loading:d,error:p,tickTime:f,paused:x,setPaused:g,clear:_,hasMore:b,loadingOlder:w,loadOlder:F,prependGen:k}}(D,i,E?l?fF:fq:0),F=(0,Y.useRef)(null),q=(0,Y.useRef)(null),z=(0,Y.useRef)(null),H=l?300:1500,B=l?500:1500,[K,V]=(0,Y.useState)(H),[J,G]=(0,Y.useState)(0),[Q,Z]=(0,Y.useState)(!1),[ee,et]=(0,Y.useState)(null),en=(0,Y.useRef)(!1),er=(0,Y.useRef)(E),ei=(0,Y.useRef)(0),ea=(0,Y.useRef)(0),es=(0,Y.useRef)(null),el=(0,Y.useRef)(0),eo=(0,Y.useRef)(null),ec=(0,Y.useRef)(null),ed=(0,Y.useRef)(L),eu=(0,Y.useRef)(a),ep=(e,t=!1)=>{if(ec.current=null,er.current=e,R(e),s(e),e&&G(0),v){var n;let t=fH.get(v);n={magnet:e,fromBottom:t?.fromBottom??0,anchor:e?null:t?.anchor??null},fH.set(v,n)}t&&(Z(!0),es.current&&window.clearTimeout(es.current),es.current=window.setTimeout(()=>Z(!1),450))},em=()=>{let e=F.current;e&&(el.current=Date.now(),e.scrollTop=e.scrollHeight)},ef=()=>{let e=F.current,t=ec.current;if(!e||!t||er.current)return!1;if(t.path!==ed.current)return ec.current=null,!1;let n=t.anchor?.path===t.path?t.anchor:null;if(n){var r;let i=(r=n.key,fU(e).find(e=>e.dataset.feedKey===r)??null);if(i){let r=i.getBoundingClientRect().top-e.getBoundingClientRect().top;return el.current=Date.now(),e.scrollTop+=r-n.offset,t.applied=!0,!0}}let i=Math.max(0,e.scrollHeight-e.clientHeight);return el.current=Date.now(),e.scrollTop=Math.max(0,i-t.fromBottom),!(i<t.fromBottom)&&(t.applied=!0,n||(ec.current=null),!0)};(0,Y.useEffect)(()=>V(H),[L,H]),(0,Y.useEffect)(()=>{if(!v)return;let e=fH.get(v)?.magnet??a;e!==er.current&&(er.current=e,R(e))},[L,v]),(0,Y.useEffect)(()=>{a!==eu.current&&(eu.current=a,ec.current=null,a!==er.current&&(er.current=a,R(a),a&&G(0)))},[a]),(0,Y.useEffect)(()=>()=>{es.current&&window.clearTimeout(es.current)},[]),(0,Y.useEffect)(()=>{en.current=!1,queueMicrotask(()=>et(null))},[e?.path]),(0,Y.useEffect)(()=>{if(e){if(e.pendingQuestion){en.current=!0,queueMicrotask(()=>et(null));return}en.current&&e.proc&&"running"!==e.proc&&(queueMicrotask(()=>et((0,eh.Tl)(g,"feed.agentEnded"))),en.current=!1)}},[e?.pendingQuestion?.toolUseId,e?.proc,e,g]);let ex=n.toLowerCase(),eg=(0,Y.useMemo)(()=>e?(0,uJ.vK)({engine:e.engine,fmt:e.fmt,showSvc:t,lineFilter:ex}):null,[L,e?.engine,e?.fmt,t,ex,g]),eb=(0,Y.useMemo)(()=>e&&eg?eg.feed(_.lines,_.linesStart,"live"===e.activity):fz,[eg,e?.activity,_.lines,_.linesStart]);p=eb.items,m=_.linesStart+_.lines.length,f=!!e&&!_.loading,x=(0,Y.useRef)(null),(0,Y.useEffect)(()=>{if(!v||!L||!f)return;let e=`${v}
|
|
68
|
-
${L}`;if(x.current?.key!==e){let t,n=null!==x.current;if(x.current={key:e,scanner:(t=null,{scan(e,n,r=0){let i=t;t=n;let a=[];var s=e=>{var t,n,s;(null!==i&&e.srcCall>=i||"run"===e.status)&&a.push((t=e,n=v,s=r,{cue:t.mcp?"viewer-mcp":"tool-tick",eventId:`tool:${n}:${t.id}`,pan:s}))};for(let t of e){let e=t.item;if("tool"===e.kind)s(e);else if("cmd-group"===e.kind)for(let t of e.calls)s(t)}for(let e=1;e<a.length;e+=1)a[e]={...a[e],delayMs:220*e};return a}})},n)return}for(let e of x.current.scanner.scan(p,m,tI(v)))ns(e)},[p,v,L,m,f]);let ev=function(e,t){let n=(0,Y.useMemo)(()=>e?function(e){let t=[],n=[];for(let{item:r}of e){let e=pz(r);e&&n.push(r);let i=e?pU(e)[0].slice(0,16):"";"sysmsg"===r.kind&&r.deliveredMessage?t.push({item:r,engineMessageId:r.deliveredMessage.engineMessageId,tsMs:e?.tsMs??NaN,token:i}):"user"===r.kind&&!r.selectedContext&&e&&t.push({item:r,engineMessageId:null,tsMs:e.tsMs,token:i})}return{drivers:t,candidates:n}}(t):{drivers:[],candidates:[]},[e,t]),r=(0,Y.useMemo)(()=>n.drivers.map(e=>e.engineMessageId??e.token).join("\n"),[n]),i=(0,Y.useRef)(n);(0,Y.useEffect)(()=>{i.current=n},[n]);let[a,s]=(0,Y.useState)(()=>e?pJ.get(e)??null:null);(0,Y.useEffect)(()=>{if(!e)return;let t=pJ.get(e)??null;if(s(t),!r)return;let n=i.current;if(!pZ(n,t,!1,Date.now()))return;let a=!0,l=null,o=async t=>{try{let r=await fetch(`/api/log/provenance?path=${encodeURIComponent(e)}`);if(!r.ok)return;let i=await r.json(),c=pJ.get(e),d={messages:{...c?.messages??{},...function(e){if(!e||"object"!=typeof e||Array.isArray(e))return{};let t={};for(let[n,r]of Object.entries(e)){if(!n)continue;let e=pQ(r);e&&(t[n]=e)}return t}(i.messages)},occurrences:function(e,t){let n=new Map;for(let r of[...e,...t])n.set(`${r.textDigest}
|
|
69
|
-
${r.deliveredAt}
|
|
70
|
-
${r.origin}
|
|
71
|
-
${r.senderRole??""}`,r);return[...n.values()]}(c?.occurrences??[],function(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){let e=pQ(n);if(!e)continue;let{textDigest:r,deliveredAt:i}=n;"string"==typeof r&&pX.test(r)&&"string"==typeof i&&Number.isFinite(Date.parse(i))&&t.push({...e,textDigest:r,deliveredAt:i})}return t}(i.occurrences))};if(pJ.set(e,d),!a)return;s(d),t<pG.length&&pZ(n,d,!0,Date.now())&&(l=setTimeout(()=>void o(t+1),pG[t]))}catch{}};return o(0),()=>{a=!1,l&&clearTimeout(l)}},[e,r]);let l=(0,Y.useMemo)(()=>pB(t.map(e=>e.item),a?.occurrences??p2),[a,t]),o=(0,Y.useMemo)(()=>{let e=[];for(let[t,n]of l)e.push(`${function(e){let t=p0.get(e);return void 0===t&&(t=p1,p1+=1,p0.set(e,t)),t}(t)}:${n.origin}:${n.senderRole??""}:${n.selectedContext?"ctx":""}`);return e.join("\n")},[l]);return(0,Y.useMemo)(()=>a?{forItem:e=>{if("sysmsg"===e.kind&&e.deliveredMessage?.engineMessageId){let t=a.messages[e.deliveredMessage.engineMessageId];if(t)return t}return l.get(e)??null}}:pY,[a,o])}(e?.engine==="claude"||e?.engine==="codex"?L:null,eb.items),ew=Math.max(0,eb.items.length-K),ey=ew?eb.items.slice(-K):eb.items,ek=eb.items.length-ey.length,ej=(0,Y.useMemo)(()=>{let e=_.lines,t=_.linesStart;return n=>n>=t&&n<t+e.length?e[n-t]??null:null},[_.lines,_.linesStart]);(0,Y.useEffect)(()=>{let t=_.tickTime?.toLocaleTimeString("uk"===(0,eh.JK)()?"uk-UA":"en-US",{hour12:!1})??"";_.error?r(_.error):e?r(`${(_.size/1024).toFixed(0)} kB${t?" \xb7 "+t:""}`):r("")},[_.error,_.size,_.tickTime,e,r]),(0,Y.useLayoutEffect)(()=>{ed.current=L,eo.current=null,ec.current=null},[L]),(0,Y.useLayoutEffect)(()=>{let e=F.current,t=z.current;e&&t&&(z.current=null,e.scrollTop=t.top+(e.scrollHeight-t.height))},[_.prependGen,K]),(0,Y.useLayoutEffect)(()=>{let e=eb.items.length,t=_.prependGen!==ea.current;ea.current=_.prependGen;let n=e-ei.current;ei.current=e;let r=!1;if(L&&e&&eo.current!==L){eo.current=L;let e=v?fH.get(v):void 0;ec.current=!E&&e&&(e.fromBottom>0||e.anchor)?{path:L,...e,applied:!1}:null,r=!0}(!ec.current||(ef(),!r&&ec.current?.applied))&&(E?em():!t&&n>0&&G(e=>e+n))},[eb.items,E,_.prependGen]),(0,Y.useEffect)(()=>{let e=F.current,t=q.current;if(!e||!t)return;let n=new ResizeObserver(()=>{er.current?em():ef()});return n.observe(t),n.observe(e),()=>n.disconnect()},[]);let eN=()=>{let e=F.current;e&&(z.current={top:e.scrollTop,height:e.scrollHeight}),ew?V(e=>e+B):_.hasMore&&_.loadOlder().then(()=>V(e=>e+B))},eS=ew>0||_.hasMore,eA=eb.items.at(-1)?.item,eI=eA?.kind==="tool"&&"run"===eA.status?{icon:uu.A,label:b("feed.running",{tool:(eA.command??eA.summary).split(/[\s:·]/,1)[0]||b("feed.tool")})}:eA?.kind==="think"?{icon:sx.RE,label:b("feed.thinking")}:{icon:sx.RE,label:b("feed.working")},eM=(0,Y.useMemo)(()=>{let e=new Set;for(let t of w){if(!t.launchOwned)continue;let n=t.echoText?.trim();n&&e.add(n);let r=t.text.trim();r&&e.add(r)}return e},[w]),eT=(0,Y.useMemo)(()=>L?eb.items.flatMap(({anchorKey:e,key:t,item:n})=>{let r="text"in n?n.text:"";if(!r.trim())return[];let i="sysmsg"===n.kind&&!!n.deliveredMessage;return"user"===n.kind||i||eM.has(r.trim())?[{generation:L,id:e??`key:${t}`,text:r}]:[]}):[],[eb.items,L,eM]),eP=(0,Y.useMemo)(()=>{let e=new Map;for(let t of eT){let n=t.text.trim();e.set(n,(e.get(n)??0)+1)}return e},[eT]);(0,Y.useEffect)(()=>{v&&function(e,t){if(!Array.isArray(t)){if(ol(or.get(e),t))return;for(let n of(or.set(e,t),oi))n();return}let n=new Map(lX(e).map(e=>[e.id,e]));for(let e of t){let t=function(e){let t=e.id.trim();return t?e.generation?JSON.stringify([e.generation,t]):t:""}(e),r=on(e.text);t&&r&&n.set(t,{id:t,key:r})}let r=[...n.values()].slice(-512),i=lX(e);(i.length!==r.length||i.some((e,t)=>e.id!==r[t]?.id||e.key!==r[t]?.key))&&lZ(e,r);let a=os(r),s=!ol(or.get(e),a);if(s&&or.set(e,a),oo(e,r),s)for(let e of oi)e()}(v,eT)},[v,eT]),(0,Y.useEffect)(()=>{if(!v||!k?.launchId||!M)return;let e=k.prompt??"",t=k.promptImages??0;if(e.trim()||t){var n;l7(v,{id:k.launchId,text:e,images:t,at:k.promptAt??Date.now(),...k.promptEcho?{echoText:k.promptEcho}:{},owner:I,state:"delivered"===(n=k.initialMessage)?"delivered":"failed"===n?"failed":"delivering",...void 0!==k.deliveredAt?{settledAt:k.deliveredAt}:{},...k.error?{error:k.error}:{}})}},[v,k?.launchId,k?.prompt,k?.promptImages,k?.promptAt,k?.promptEcho,k?.initialMessage,k?.deliveredAt,k?.error,I,M]),(0,Y.useEffect)(()=>{v&&k?.launchId&&M&&I&&("delivered"===k.initialMessage&&void 0!==k.deliveredAt?function(e,t){let n=lK(e);if(n&&n.id!==t.id)return;lV(e,{id:t.id,at:n?.at??t.at,settledAt:t.settledAt});let r=l8(e),i=r.find(e=>e.id===t.id);if(!i||!i.launchOwned)return;let a=t.owner&&!lT(i.owner,t.owner)?{...i,owner:t.owner}:i;if(a.retiredEchoId||void 0!==a.responseStartedAt||"delivered"===a.state){a!==i&&l5(e,r.map(e=>e.id===t.id?a:e)),lQ(e,a);return}let s=r.map(e=>e.id===t.id?{...a,state:"delivered",settledAt:a.settledAt??t.settledAt,error:void 0}:e),l=s.find(e=>e.id===t.id);l&&lQ(e,l),l5(e,s)}(v,{id:k.launchId,at:k.promptAt??k.deliveredAt,settledAt:k.deliveredAt,owner:I}):"failed"===k.initialMessage&&function(e,t){let n=lK(e);if(n&&n.id!==t.id)return;lV(e,{id:t.id,at:n?.at??t.at});let r=l8(e),i=r.find(e=>e.id===t.id);if(!i||!i.launchOwned)return;let a=t.owner&&!lT(i.owner,t.owner)?{...i,owner:t.owner}:i;if(a.retiredEchoId||void 0!==a.responseStartedAt||"delivered"===a.state){a!==i&&l5(e,r.map(e=>e.id===t.id?a:e)),lQ(e,a);return}let s={...a,state:"failed",...t.error?{error:t.error}:{}};lQ(e,s),l5(e,r.map(e=>e.id===t.id?s:e))}(v,{id:k.launchId,at:k.promptAt??Date.now(),...k.error?{error:k.error}:{},owner:I}))},[v,k?.launchId,k?.initialMessage,k?.deliveredAt,k?.promptAt,k?.error,I,M]);let e$=(0,Y.useMemo)(()=>{let e;for(let{item:t}of eb.items){if(!("ts"in t))continue;let n="number"==typeof t.ts?t.ts:Date.parse(String(t.ts??""));Number.isFinite(n)&&(void 0===e||n>e)&&(e=n)}return e},[eb.items]),eE=e?function(e,t,n,r,i){let a=new Map,s=[];for(let l of e){if(void 0!==r&&l.launchOwned&&(!r||!lT(l.owner,r)))continue;let e=on(l.echoText??l.text);if(l.retiredEchoId){let t=Math.max(l.echoBaseline??0,a.get(e)??0);a.set(e,t+1);continue}let o=t.get(e)??0,c=Math.max(l.echoBaseline??0,a.get(e)??0);if(o>c){a.set(e,c+1);continue}if(void 0===l.responseStartedAt){if("delivered"===l.state){let e=l.settledAt??l.at;if(n-e>=6e5||void 0!==i&&i>=e+2e3)continue}s.push(l)}}return s}(w,eP,Date.now(),S,e$):[];(0,Y.useEffect)(()=>{v&&L&&(!function(e,t){if(!e||e===t)return;let n=p$(e);if(!n.size)return;let r=new Set(n);for(let e of p$(t))r.delete(e),r.add(e);for(;r.size>544;){let e=r.values().next().value;if(void 0===e)break;r.delete(e)}for(let n of(pE(t,r),pE(e,pA),pC))n()}(L,v),function(e,t){if(!e)return;let n=p$(e),r=t.flatMap(pP);if(!r.some(e=>!n.has(e)))return;let i=new Set(n);for(let e of r)i.delete(e),i.add(e);for(;i.size>544;){let e=i.values().next().value;if(void 0===e)break;i.delete(e)}for(let t of(pE(e,i),pC))t()}(v,eb.items))},[L,v,eb.items]);let eR=(0,Y.useMemo)(()=>(function(e,t,n=pA,r=null){let i=e?nX(e):[];if(!i.length)return i;let a=t.flatMap(e=>{let{item:t}=e,n=pM(e);return"prose"===t.kind?[{sourceId:n,text:t.text.trim(),at:pR(t.ts)}]:"tool"===t.kind||"cmd-group"===t.kind?pT(e).map(e=>({sourceId:e,text:"",at:null})):n?[{sourceId:n,text:"",at:"review"===t.kind?pR(t.ts):null}]:[]}),s=new Set(a.flatMap(e=>e.sourceId?[e.sourceId]:[])),l=function(e){let t=null;for(let n of e){let e=function(e){let t="cmd-group"===e.kind?e.t1??e.t0:"ts"in e?e.ts:void 0;if("string"!=typeof t||!t)return null;let n=Date.parse(t);return Number.isFinite(n)?n:null}(n.item);null!==e&&(null===t||e>t)&&(t=e)}return t}(t),o=new Set,c=e=>{let t=pR(e.completedAt)??pR(e.startedAt);return null!==l&&null!==t&&t<=l};return i.filter(e=>{if("streaming"===e.phase)return"idle"!==r||!c(e);if(e.itemId&&(n.has(e.itemId)||s.has(e.itemId)))return!1;let t=e.itemId?a.findIndex((t,n)=>!o.has(n)&&t.sourceId===e.itemId):-1,i=e.text.trim();if(t<0&&!e.itemId&&i){let n=pR(e.startedAt);t=a.findIndex((e,t)=>!o.has(t)&&e.text===i&&(null===n||null===e.at||e.at>=n))}return t<0?!c(e):(o.add(t),!1)})})(P,eb.items,y,$),[P,eb.items,y,$]),eO=eR.findLast(e=>e.tool?.status==="run")?.tool,eD=eO?{icon:uu.A,label:b("feed.running",{tool:("string"==typeof eO.args.command?eO.args.command:"string"==typeof eO.args.cmd?eO.args.cmd:eO.name).split(/[\s:·]/,1)[0]||b("feed.tool")})}:eI,eL=eR.length>0||eE.length>0||!!k,e_="left-1/2 -translate-x-1/2";return(0,U.jsx)(fg,{value:ej,children:(0,U.jsx)(pV,{value:ev,children:(0,U.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,U.jsxs)("div",{className:"relative flex min-h-0 flex-1 flex-col",children:[e&&eb.items.length?E?"live"===e.activity?(0,U.jsxs)("div",{"data-live-tail-pill":!0,className:`pointer-events-none absolute bottom-2 ${e_} z-10 inline-flex items-center gap-1 rounded-full bg-success px-2 py-0.5 text-[10px] font-bold text-white shadow-1 transition-transform duration-200 ${Q?"scale-125":"scale-100"}`,children:[(0,U.jsx)(up.A,{className:"h-3 w-3","aria-hidden":!0})," ",b("feed.liveTail")]}):null:(0,U.jsxs)("button",{className:`absolute bottom-2 ${e_} z-10 inline-flex items-center gap-1 whitespace-nowrap rounded-full border border-border bg-raised px-2.5 py-1 text-label font-semibold text-primary shadow-1 [@media(pointer:coarse)]:min-h-11 hover:border-accent/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":b("feed.backToLive"),onClick:()=>{em(),ep(!0,!0)},children:[(0,U.jsx)(sx.yd,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",J?b("feed.newCount",{count:J}):b("feed.down")]}):null,(0,U.jsx)("div",{ref:F,"data-log-feed-scroller":!0,"data-tail-lines-start":_.linesStart,"data-tail-line-count":_.lines.length,className:l?"min-h-0 flex-1 overflow-y-auto py-3":"min-h-0 flex-1 overflow-y-auto py-6",onScroll:t=>{var n,r;let i,a,s,l=t.currentTarget,o=l.scrollTop+l.clientHeight>=l.scrollHeight-50,c=Date.now()-el.current<300;c||(ec.current=null),o&&!er.current?ep(!0,!0):!o&&er.current&&(c?em():ep(!1)),v&&e&&!c&&(r={magnet:er.current,fromBottom:Math.max(0,l.scrollHeight-l.clientHeight-l.scrollTop),anchor:er.current?null:(n=L??e.path,i=l.getBoundingClientRect().top,a=fU(l).find(e=>e.getBoundingClientRect().bottom>i),s=a?.dataset.feedKey,a&&s?{path:n,key:s,offset:a.getBoundingClientRect().top-i}:null)},fH.set(v,r)),l.scrollTop<120&&eS&&!_.loadingOlder&&!_.loading&&eN()},children:(0,U.jsx)("div",{ref:q,className:l?"px-3 pb-3 text-body":"mx-auto w-full max-w-[1060px] px-6 pb-4",children:e?(0,U.jsxs)(U.Fragment,{children:[l&&eS?(0,U.jsx)("button",{className:"mb-2 flex w-full items-center justify-center gap-1.5 rounded-control border border-dashed border-border bg-sunken px-2 py-1 text-label font-semibold text-muted [@media(pointer:coarse)]:min-h-11 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",disabled:_.loadingOlder,onClick:eN,children:_.loadingOlder?b("common.loading"):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(sx.rX,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",b("feed.showEarlier")]})}):null,!l&&eS&&eb.items.length?(0,U.jsx)("button",{className:"mb-3 flex w-full items-center justify-center gap-1.5 rounded-control border border-dashed border-border bg-sunken px-3 py-1.5 text-ui font-semibold text-muted [@media(pointer:coarse)]:min-h-11 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",disabled:_.loadingOlder,onClick:eN,children:_.loadingOlder?b("common.loading"):ew?b("feed.showEarlierHidden",{count:ew}):b("feed.loadEarlier")}):null,l||eS||!eb.items.length?null:(0,U.jsx)("div",{className:"mb-3 text-center text-[11px] text-muted",children:b("feed.startOfConvo")}),l?null:(0,U.jsx)(fD,{file:e}),eb.items.length?ey.map(({anchorKey:e,key:t,item:n},r)=>{let i=function(e,t){let n,r=e[t]?.item;if(r?.kind!=="prose")return null;let i=t,a=t;for(;i>0&&fE(e[i-1].item,r);)i-=1;for(;a+1<e.length&&fE(e[a+1].item,r);)a+=1;let s=(n=(function(e){let t=[],n=null;for(let r of e.split("\n")){if(n){let e=r.match(/^[ \t]*(`{3,}|~{3,})[ \t]*$/)?.[1];e?.[0]===n.char&&e.length>=n.length&&(n=null);continue}let e=r.match(/^[ \t]*(`{3,}|~{3,})/)?.[1];if(e){n={char:e[0],length:e.length},t.push("");continue}t.push(r)}return t.join("\n")})(e.slice(i,a+1).map(e=>"prose"===e.item.kind?e.item.text:"").join("\n\n")).replace(mR,"\n").replace(/<oai-mem-citation>[\s\S]*?<\/oai-mem-citation>/gi,"\n").replace(/<!--[\s\S]*?-->/g," ").replace(/<(script|style|template)\b[^>]*>[\s\S]*?<\/\1>/gi," ").replace(/<([a-z][\w-]*)\b(?=[^>]*(?:\shidden(?=\s|=|>)|aria-hidden\s*=\s*["']?true))[^>]*>[\s\S]*?<\/\1>/gi," ").replace(/`+[^`\n]+`+/g," ").replace(/!\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/\[([^\]]+)\]\([^)]*\)/g,"$1").replace(/^\s*\|.*\|\s*$/gm," table omitted ").replace(/<[^>]+>/g," ").replace(/https?:\/\/\S+/g," ").replace(/^\s{0,3}(?:#{1,6}\s+|[-*+]\s+|\d+[.)]\s+)/gm,"").replace(/[*~]{1,3}/g,"").replace(/\n{3,}/g,"\n\n").trim(),(0,mE.fp)(n));return s?{text:s,firstIndex:i,lastIndex:a}:null}(eb.items,ek+r),a=i?.firstIndex===ek+r?i.text:void 0;return(0,U.jsx)("div",{"data-feed-key":e??void 0,"data-feed-kind":n.kind,"data-feed-source-id":"sourceId"in n?n.sourceId:void 0,className:l?"feed-cv":void 0,children:(0,U.jsx)(fx,{item:n,speakText:a})},t)}):eL?null:(0,U.jsxs)("div",{className:"mt-[14vh] text-center text-muted",children:[_.loading?b("common.loadingCap"):0===_.size?b("feed.noOutput"):eb.hiddenServiceCount?b("feed.onlyService",{count:eb.hiddenServiceCount}):b("feed.empty"),!_.loading&&(e.cmdDesc||e.cmd)?(0,U.jsxs)("div",{className:"mx-auto mt-3 max-w-[560px]",children:[e.cmdDesc?(0,U.jsx)("div",{className:"text-[12.5px] font-semibold text-primary",children:e.cmdDesc}):null,e.cmd?(0,U.jsx)("pre",{className:"mt-1.5 overflow-x-auto whitespace-pre-wrap break-words rounded-[10px] border border-border bg-canvas px-3 py-2 text-left font-mono text-[11.5px] text-primary",children:e.cmd}):null]}):null]}),(h={launch:!!k,outbox:!!(v&&eE.length),delta:eR.length>0},pO.filter(e=>h[e])).map(t=>{if("launch"===t)return(0,U.jsx)(uz,{launch:k,onRetry:o},"launch");if("outbox"===t){let t=lu(e.migration,ll(e.path)),n=lp(lc(t))?{label:ld(t)}:null;return(0,U.jsx)(pN,{cardId:v,entries:eE,switchHold:n},"outbox")}return(0,U.jsx)(pk,{items:eR},"delta")}),(0,U.jsx)(f$,{file:e}),eb.items.length&&!e.pendingQuestion&&!e.waitingInput&&ee?(0,U.jsx)("div",{className:"my-4 rounded-[8px] border border-border bg-sunken px-4 py-3 text-[13px] font-semibold text-muted",children:ee}):null,eb.items.length&&"recent"===e.activity&&tk(e)?(0,U.jsxs)("div",{className:"mt-2 flex items-center gap-1.5 text-[11.5px] font-semibold text-warning",children:[(0,U.jsx)("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-warning","aria-hidden":!0})," ",b("feed.finishedTurn")]}):eb.items.length&&"recent"===e.activity&&eC(e)&&"running"!==e.proc?(0,U.jsxs)("div",{className:"mt-2 flex items-center gap-1 text-[11.5px] font-semibold text-accent",children:[(0,U.jsx)(dZ.A,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",b("feed.returnedResult")]}):null]}):(0,U.jsx)("div",{className:"mt-[20vh] text-center text-muted",children:b("feed.pickLog")})})})]}),e?(0,U.jsx)(f_,{file:e,workingLabel:eD.label,workingIcon:eD.icon,compact:l}):null]})})})}let fK=()=>void 0;function fY({file:e,projectName:t}){let{t:n}=(0,eh.Ym)(),{caps:r}=cs(e),i="dead"===r.surface,a=r.controls.send,s=i||"disabled"!==a.state?null:n(a.reason);return(0,U.jsxs)("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col","data-orchestrator-conversation":e.conversationId??e.path,children:[i?(0,U.jsx)(fA,{file:e}):null,(0,U.jsx)(fB,{file:e,showSvc:!1,lineFilter:"",onStatus:fK,paused:!1,follow:!0,setFollow:fK,compact:!0}),(0,U.jsx)(ud,{file:e}),(0,U.jsx)(dc,{file:e,deadHost:i,sendBlockedReason:s,placeholder:n("composer.placeholderOrchestrator",{project:t}),primaryPlace:!0})]})}let fW=e=>"string"==typeof e&&e?e:null,fV=e=>"number"==typeof e&&Number.isFinite(e)?e:null,fJ=new Map,fG=e=>e?fJ.get(e)??null:null;async function fQ(e,t){let n=await fetch("/api/orchestrator/seat/status?project="+encodeURIComponent(e),t?{signal:t}:void 0);if(!n.ok)throw Error(`orchestrator status read failed: ${n.status}`);var r,i,a=await n.json();if(!a||"object"!=typeof a||Array.isArray(a))return null;let s=fW(a.project);if(!s)return null;let l="claude"===a.engine||"codex"===a.engine?a.engine:null;return{project:s,designated:!0===a.designated,conversationId:fW(a.conversationId),predecessorConversationId:fW(a.predecessorConversationId),engine:l,model:fW(a.model),effort:fW(a.effort),accountId:fW(a.accountId),cwd:fW(a.cwd),context:!(r=a.context)||"object"!=typeof r||Array.isArray(r)?null:{tokens:fV(r.tokens),limit:fV(r.limit),percent:fV(r.percent),estimated:!1!==r.estimated,basis:fW(r.basis)??""},transcriptFacts:!(i=a.transcriptFacts)||"object"!=typeof i||Array.isArray(i)?null:{bytes:fV(i.bytes),messageCount:fV(i.messageCount),toolCount:fV(i.toolCount),compactionCount:fV(i.compactionCount)},rotation:function(e){if(!e||"object"!=typeof e||Array.isArray(e))return null;let t="recommend"===e.level||"strongly_recommend"===e.level?e.level:"none";return{recommended:!0===e.recommended,level:t,reasons:Array.isArray(e.reasons)?e.reasons.filter(e=>"string"==typeof e):[],thresholdUnknown:!0===e.thresholdUnknown}}(a.rotation)}}let fX=new Map,fZ=(e,t)=>`${e}\0${t??""}`;async function f0(e,t,n){var r;let i=new URLSearchParams({project:e});t&&i.set("cwd",t);let a=await fetch("/api/orchestrator/seat?"+i,n?{signal:n}:void 0);if(!a.ok)throw Error(`orchestrator seat read failed: ${a.status}`);return r=await a.json(),{seat:d0(r?.seat),pending:d0(r?.pending),exists:r?.exists!==!1,viewerMcpRegistered:r?.viewerMcpRegistered===!0}}let f1=(e,t)=>e?fX.get(fZ(e,t))??null:null;function f2(e,t){let[n,r]=(0,Y.useState)(()=>f1(e,t)),i=n&&n.project===e&&n.cwd===(t??"")?n:f1(e,t),a=(0,Y.useCallback)((e,t,n,i)=>{let a=fZ(e,t),s={project:e,cwd:t??"",status:n??fX.get(a)?.status??null,failed:i};fX.set(a,s),r(s)},[]),s=(0,Y.useCallback)(async()=>{if(e)try{a(e,t,await f0(e,t),!1)}catch{a(e,t,null,!0)}},[t,e,a]);return(0,Y.useEffect)(()=>{if(!e)return;let n=new AbortController,r=()=>{f0(e,t,n.signal).then(n=>a(e,t,n,!1)).catch(n=>{"AbortError"!==n.name&&a(e,t,null,!0)})};r();let i=setInterval(r,6e3);return()=>{clearInterval(i),n.abort()}},[t,e,a]),{status:i?.status??null,failed:i?.failed??!1,refresh:s}}function f5(e,t,n){return{clientAttemptId:e,at:t,target:"",path:null,conversationId:null,launchId:null,prompt:n.prompt.trim(),hasImages:n.images.length>0,request:n,engine:n.engine,src:n.src,phase:"confirming",error:null}}function f4(e,t,n){if(n?.retrySafe)return{kind:"failed-preflight",message:n.error??null};if(t&&n?.ok){let e="string"==typeof n.path?n.path:null,t="string"==typeof n.conversationId?n.conversationId:null,r="string"==typeof n.launchId?n.launchId:null,i="string"==typeof n.target?n.target:"";if(!1===n.launched&&"string"==typeof n.error&&n.error)return{kind:"failed-launch",message:n.error,target:i,conversationId:t,launchId:r};let a="settled"===n.state&&null!==e;return{kind:"launched",durable:a?"booting":"confirming",target:i,path:a?e:null,conversationId:t,launchId:r,structured:"structured"===n.transport,state:n.state??null,initialMessage:n.initialMessage??null}}return 409===e?{kind:"ambiguous"}:e>=400&&e<500?{kind:"failed-preflight",message:n?.error??null}:{kind:"ambiguous"}}function f3(e,t,n){if(!t.structured||!t.conversationId||!t.launchId||"failed"===t.state||"conflict"===t.state)return null;let r=t.initialMessage??"pending",i="delivered"===r?"recovered":"queued"===r?"queued":"path-pending"===t.state?"binding":"starting",a={launchId:t.launchId,clientAttemptId:e.clientAttemptId,accountId:e.request?.accountId||null,conversationId:t.conversationId,generation:1,state:i,initialMessage:r,retrySafe:!1,error:null,...e.prompt.trim()||e.hasImages?{prompt:e.prompt,promptImages:e.request?.images.length??0,promptAt:e.at}:{}};return{path:`spawn:${t.launchId}`,root:"codex"===e.engine?"codex-sessions":"claude-projects",name:`spawn:${t.launchId}`,project:n,...e.request?.cwd?{cwd:e.request.cwd}:{},title:"codex"===e.engine?"Codex":"Claude",engine:e.engine,kind:"session",fmt:e.engine,spawnOrigin:"viewer",parent:null,mtime:e.at/1e3,size:0,activity:"live",activityReason:`structured_spawn_${i}`,proc:null,pid:null,model:e.request?.model||null,pendingQuestion:null,waitingInput:null,conversationId:t.conversationId,generation:1,spawn:a}}function f6(e){let{url:t,project:n,storage:r,field:i,status:a,refresh:s}=e,{t:l}=(0,eh.Ym)(),[o,c]=(0,Y.useState)(!1),[d,u]=(0,Y.useState)(null),p=(0,Y.useRef)(!1);return(0,Y.useEffect)(()=>{if(p.current)return;let e=r.read(i);e&&d4(a,e)&&r.write(i,"")},[r,i,a]),{submitting:o,failure:d,submit:(0,Y.useCallback)(async(e,a)=>{if(p.current)return;p.current=!0;let o=a||r.read(i)||d3();r.read(i)!==o&&r.write(i,o),c(!0),u(null);let d=Date.now();try{let a=await fetch(t,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({...e.body,clientRequestId:o})}),s=await a.json().catch(()=>null);if(a.ok&&s?.ok!==!1){let t=f4(a.status,a.ok,s);if("launched"===t.kind){let{draft:r,cwd:i,firstMessage:a}=e.launch,s=f3(f5(o,d,{engine:r.engine,model:r.model,cwd:i,effort:r.effort,fast:"codex"===r.engine&&r.speed?"fast"===r.speed:null,accountId:r.launchAccountId,prompt:a,images:[],src:""}),t,n);s&&rk(s)}nF()}else{let e=d6(a.status,s,o);e?.kind==="terminal"&&r.write(i,""),u(e)}}catch{u({kind:"ambiguous",error:l("orchPanel.transportLost"),clientRequestId:o})}finally{p.current=!1,c(!1),await s()}},[t,n,r,i,s,l])}}function f8(e){let t=s1(),n=s4(e?W(e):null);return e?ci(e,n,{runtimeEnabled:t}):null}let f7=(e,t,n)=>`llvOrchestrator${e}:${t}:${n}`;function f9(e,t,n){try{return window.sessionStorage.getItem(f7(e,t,n))??""}catch{return""}}function he(e,t,n,r){try{r?window.sessionStorage.setItem(f7(e,t,n),r):window.sessionStorage.removeItem(f7(e,t,n))}catch{}}let ht=(e,t)=>({read:n=>f9(e,t,n),write:(n,r)=>he(e,t,n,r)});function hn({project:e,projectName:t,projectCwd:n,files:r,onClose:i}){let{t:a}=(0,eh.Ym)(),{status:s,failed:l,refresh:o}=f2(e,n),[c,d]=(0,Y.useState)(null),[u,p]=(0,Y.useState)(()=>f9("Draft",e,"mandate")||dX),[m,f]=(0,Y.useState)(null),[h,x]=(0,Y.useState)(!1),g=dU(),b=(0,Y.useMemo)(()=>ht("Draft",e),[e]),v=(0,Y.useMemo)(()=>ht("Rotate",e),[e]),w=dB({storage:b,catalog:g,initialEngine:dJ,initialModel:dG,initialEffort:"low"}),y=t=>{p(t),he("Draft",e,"mandate",t===dX?"":t)},k=s?.seat?.conversationId??null,j=!!(k&&s?.exists),N=(0,Y.useMemo)(()=>k?r.find(e=>e.conversationId===k)??r.find(e=>e.path===s?.seat?.path)??null:null,[r,k,s?.seat?.path]),S=f8(N),{incumbent:C,refresh:A}=function(e,t){let[n,r]=(0,Y.useState)(()=>fG(e)),i=n&&n.project===e?n.incumbent:fG(e)?.incumbent??null,a=(0,Y.useCallback)((e,t)=>{let n={project:e,incumbent:t};fJ.set(e,n),r(n)},[]),s=(0,Y.useCallback)(async()=>{if(e)try{a(e,await fQ(e))}catch{}},[e,a]);return(0,Y.useEffect)(()=>{if(!e||!t)return;let n=new AbortController,r=()=>{fQ(e,n.signal).then(t=>a(e,t)).catch(()=>{})};r();let i=setInterval(r,6e4);return()=>{clearInterval(i),n.abort()}},[e,t,a]),{incumbent:i,refresh:s}}(e,j),I=C&&C.conversationId===k?C:null;(0,Y.useEffect)(()=>{j&&A()},[k,j,A]);let M=f6({url:"/api/orchestrator/seat",project:e,storage:b,field:"requestId",status:s,refresh:o}),T=f6({url:"/api/orchestrator/rotate",project:e,storage:v,field:"requestId",status:s,refresh:o}),P=d1({status:s,statusFailed:l,submitting:M.submitting||T.submitting,submitFailure:M.failure??T.failure,file:N,surface:S,incumbent:I}),$=T.submitting||null!==T.failure&&!d4(s,T.failure.clientRequestId),E="live"===P.kind&&null!==m&&m===P.conversationId,R="live"!==P.kind&&null!==m&&$&&s?.seat!=null,O=E||R,D=t=>{let r=u.trim();r?(d(null),M.submit({body:{project:e,mandate:r,engine:w.engine,...w.model?{model:w.model}:{},...w.effort?{effort:w.effort}:{},..."codex"===w.engine&&w.speed?{fast:"fast"===w.speed}:{},...w.launchAccountId?{accountId:w.launchAccountId}:{},...n?{cwd:n}:{},...r===dX.trim()?{promptVersion:9}:{},..."draft"===P.kind&&P.vacated?{replaceIncumbent:!0}:{}},launch:{draft:w,cwd:n??"",firstMessage:r}},t)):d(a("orchPanel.mandateRequired"))},L=async e=>{x(!0);try{await A()}finally{x(!1),f(e)}};return(0,U.jsxs)("section",{className:"flex h-full min-h-0 min-w-0 flex-col bg-card","data-orchestrator-panel":e,"data-orchestrator-state":P.kind,"data-orchestrator-mode":O?"rotate":"default","aria-label":a("orchPanel.regionAria",{project:t}),children:[(0,U.jsxs)("header",{className:"flex h-11 shrink-0 items-center gap-2 border-b border-border px-3",children:[(0,U.jsx)("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-control bg-accent-soft text-accent","aria-hidden":!0,children:(0,U.jsx)(dE.A,{className:"h-4 w-4"})}),(0,U.jsxs)("span",{className:"flex min-w-0 flex-1 flex-col",children:[(0,U.jsx)("span",{className:"truncate text-body font-semibold text-primary",children:a("orchPanel.title")}),(0,U.jsx)("span",{className:"truncate text-caption text-muted",title:t,children:t})]}),(0,U.jsx)(ho,{state:P}),(0,U.jsx)("button",{type:"button",onClick:i,"aria-label":a("orchPanel.close"),title:a("orchPanel.close"),className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-control border border-border bg-canvas text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:(0,U.jsx)(K.A,{className:"h-4 w-4","aria-hidden":!0})})]}),"loading"===P.kind?(0,U.jsxs)(hu,{children:[(0,U.jsx)(dR.A,{className:"h-5 w-5 animate-spin text-muted","aria-hidden":!0}),(0,U.jsx)("p",{className:"text-ui text-muted",role:"status",children:a("orchPanel.loading")})]}):"unavailable"===P.kind?(0,U.jsxs)(hu,{children:[(0,U.jsx)(i4.A,{className:"h-6 w-6 text-warning","aria-hidden":!0}),(0,U.jsx)("p",{className:"max-w-[280px] text-body font-semibold text-primary",role:"alert",children:a("orchPanel.unavailable")}),(0,U.jsx)("p",{className:"max-w-[280px] text-ui text-muted",children:a("orchPanel.unavailableHint")}),(0,U.jsx)(hp,{onClick:()=>void o(),children:a("orchPanel.recheck")})]}):R&&s?.seat?(0,U.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,U.jsx)("p",{className:"shrink-0 border-b border-border bg-sunken px-3 py-1.5 text-ui text-secondary",role:"status",children:a("orchPanel.rotateVacated")}),(0,U.jsx)(hr,{project:e,projectName:t,seat:s.seat,incumbent:I,file:N,projectCwd:n,catalog:g,flow:T,status:s,onCancel:()=>f(null)})]}):"creating"===P.kind?(0,U.jsxs)(hu,{children:[(0,U.jsx)(dR.A,{className:"h-5 w-5 animate-spin text-accent","aria-hidden":!0}),(0,U.jsx)("p",{className:"text-body font-semibold text-primary",role:"status",children:a("orchPanel.creating")}),(0,U.jsx)("p",{className:"max-w-[300px] text-ui text-muted",children:a("orchPanel.creatingHint")}),P.launchId?(0,U.jsx)("p",{className:"max-w-full truncate font-mono text-caption text-muted",title:P.launchId,children:a("orchPanel.receipt",{launchId:P.launchId})}):null,!M.submitting&&P.clientRequestId?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("p",{className:"max-w-[300px] text-ui text-muted",children:a("orchPanel.creatingStuck")}),(0,U.jsx)(hp,{onClick:()=>D(P.clientRequestId),children:a("orchPanel.creatingResume")})]}):null]}):"live"===P.kind?(0,U.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,U.jsx)(d8,{incumbent:I,file:N,catalog:g,predecessorConversationId:P.seat.predecessorConversationId,rotating:O,opening:h,onRotate:()=>void L(P.conversationId)}),P.transition&&!O?(0,U.jsx)(hc,{transition:P.transition}):null,P.rotation?(0,U.jsx)(hd,{rotation:P.rotation}):null,O?null:(0,U.jsxs)(U.Fragment,{children:[d2(P,N)?(0,U.jsx)("p",{className:"shrink-0 border-b border-border bg-warning-soft px-3 py-1.5 text-ui text-warning",role:"status",children:a("orchPanel.stalled")}):null,"resumable"===P.liveness?(0,U.jsx)("p",{className:"shrink-0 border-b border-border bg-sunken px-3 py-1.5 text-ui text-secondary",role:"status",children:a("orchPanel.resumable")}):null]}),O?(0,U.jsx)(hr,{project:e,projectName:t,seat:P.seat,incumbent:I,file:N,projectCwd:n,catalog:g,flow:T,status:s,onCancel:()=>f(null)}):N?(0,U.jsx)(fY,{file:N,projectName:t}):(0,U.jsxs)(hu,{children:[(0,U.jsx)(dR.A,{className:"h-5 w-5 animate-spin text-muted","aria-hidden":!0}),(0,U.jsx)("p",{className:"text-body font-semibold text-primary",role:"status",children:a("orchPanel.resolving")}),(0,U.jsx)("p",{className:"max-w-[300px] text-ui text-muted",children:a("orchPanel.resolvingHint")}),(0,U.jsx)("a",{href:"#c="+encodeURIComponent(P.conversationId),className:"text-ui font-semibold text-accent underline-offset-2 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:a("orchPanel.openOnBoard")})]})]}):(0,U.jsx)(hi,{mode:"create",state:P,mandate:u,edited:u!==dX,formError:c,submitting:M.submitting,projectName:t,cwd:n,launch:w,viewerMcpRegistered:s?.viewerMcpRegistered===!0,onMandate:y,onRestore:()=>y(dX),onConfirm:()=>D()})]})}function hr({project:e,projectName:t,seat:n,incumbent:r,file:i,projectCwd:a,catalog:s,flow:l,status:o,onCancel:c}){let{t:d}=(0,eh.Ym)(),[u,p]=(0,Y.useState)(null),[m,f]=(0,Y.useState)(()=>f9("Rotate",e,"mandate")||n.mandate),h={engine:r?.engine??(i?.engine==="codex"?"codex":i?.engine==="claude"?"claude":""),model:r?.model??i?.model??"",effort:r?.effort??"",accountId:r?.accountId??""},x=dB({storage:{read:t=>f9("Rotate",e,t)||(h[t]??""),write:(t,n)=>he("Rotate",e,t,n)},catalog:s,initialEngine:dJ,initialModel:dG,initialEffort:"low"}),g=function(e){let t=e.status?.pending??null,n=t?.designatedAt??"";if(t?.intent.error)return{kind:"intent-error",error:t.intent.error,retry:"fresh",designatedAt:n};let r=d5(e.status,e.submitFailure);return r?{kind:"intent-error",...r,designatedAt:n}:{kind:"draft",vacated:!1}}({status:o,submitFailure:l.failure}),b=r?.cwd??null??a;return(0,U.jsx)(hi,{mode:"rotate",state:g,mandate:m,edited:m!==n.mandate,formError:u,submitting:l.submitting,projectName:t,cwd:b,launch:x,viewerMcpRegistered:o?.viewerMcpRegistered===!0,onMandate:t=>{f(t),he("Rotate",e,"mandate",t===n.mandate?"":t)},onRestore:()=>{f(n.mandate),he("Rotate",e,"mandate","")},onConfirm:()=>{let t=m.trim();t?(p(null),l.submit({body:{project:e,mandate:t,engine:x.engine,...x.model?{model:x.model}:{},...x.effort?{effort:x.effort}:{},..."codex"===x.engine&&x.speed?{fast:"fast"===x.speed}:{},...x.launchAccountId?{accountId:x.launchAccountId}:{}},launch:{draft:x,cwd:b??"",firstMessage:t}})):p(d("orchPanel.mandateRequired"))},onCancel:c})}function hi({mode:e,state:t,mandate:n,edited:r,formError:i,submitting:a,projectName:s,cwd:l,launch:o,viewerMcpRegistered:c,onMandate:d,onRestore:u,onConfirm:p,onCancel:m}){let{t:f}=(0,eh.Ym)(),h="intent-error"===t.kind,x="rotate"===e;return(0,U.jsxs)("form",{className:"flex min-h-0 flex-1 flex-col","data-orchestrator-draft":e,onSubmit:e=>{e.preventDefault(),p()},children:[(0,U.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto px-4 py-4",children:[h?(0,U.jsxs)("div",{className:"shrink-0 rounded-surface border border-danger/40 bg-danger-soft px-3 py-2.5",role:"alert","data-orchestrator-intent-error":!0,children:[(0,U.jsxs)("p",{className:"flex items-center gap-1.5 text-ui font-semibold text-danger",children:[(0,U.jsx)(i4.A,{className:"h-4 w-4 shrink-0","aria-hidden":!0}),f("same"===t.retry?x?"orchPanel.rotateErrorUnknownTitle":"orchPanel.errorUnknownTitle":x?"orchPanel.rotateErrorTitle":"orchPanel.errorTitle")]}),(0,U.jsx)("pre",{className:"mt-1 max-h-24 overflow-y-auto whitespace-pre-wrap break-words font-sans text-ui leading-4 text-secondary",children:t.error}),(0,U.jsx)("p",{className:"mt-1 text-caption text-muted",children:f("same"===t.retry?x?"orchPanel.rotateErrorUnknownHint":"orchPanel.errorUnknownHint":x?"orchPanel.rotateErrorHint":"orchPanel.errorHint")})]}):(0,U.jsxs)("div",{className:"shrink-0",children:[(0,U.jsx)("h2",{className:"text-title font-semibold text-primary",children:f(x?"orchPanel.rotateHeading":"orchPanel.draftTitle")}),(0,U.jsx)("p",{className:"mt-1 text-ui leading-4 text-muted",children:x?f("orchPanel.rotateHint"):f("draft"===t.kind&&t.vacated?"orchPanel.draftHintVacated":"orchPanel.draftHint",{project:s})})]}),(0,U.jsx)("p",{className:"shrink-0 rounded-control border border-border bg-canvas px-3 py-2 font-mono text-caption text-secondary","data-viewer-mcp-status":c?"registered":"missing",role:"status",children:f(c?"orchPanel.viewerMcpRegistered":"orchPanel.viewerMcpMissing")}),(0,U.jsx)("div",{className:"shrink-0",children:(0,U.jsx)(dW,{draft:o,disabled:a,stacked:!0})}),(0,U.jsxs)("div",{className:"flex min-h-[220px] flex-1 flex-col gap-1",children:[(0,U.jsxs)("div",{className:"flex min-h-6 items-center gap-2",children:[(0,U.jsx)("label",{className:"text-label font-semibold text-muted",htmlFor:"orchestrator-mandate",children:f("orchPanel.mandate")}),r?(0,U.jsxs)("button",{type:"button",onClick:u,disabled:a,className:"inline-flex items-center gap-1 rounded-control border border-border bg-canvas px-2 py-0.5 text-caption font-semibold text-muted hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60",children:[(0,U.jsx)(sg.A,{className:"h-3 w-3","aria-hidden":!0})," ",f(x?"orchPanel.restoreIncumbent":"orchPanel.restoreDefault")]}):null,(0,U.jsx)("span",{className:"ml-auto shrink-0 text-caption text-muted",children:f("orchPanel.mandateSent")})]}),(0,U.jsx)("textarea",{id:"orchestrator-mandate","data-orchestrator-mandate":!0,value:n,disabled:a,onChange:e=>d(e.target.value),spellCheck:!1,className:"min-h-[200px] w-full flex-1 resize-none rounded-surface border border-border bg-sunken px-3 py-2.5 text-ui leading-[1.45] text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60"}),l?(0,U.jsx)("p",{className:"truncate font-mono text-caption text-muted",title:l,children:f(x?"orchPanel.cwdInherited":"orchPanel.cwd",{cwd:l})}):null]})]}),(0,U.jsxs)("div",{className:"flex shrink-0 flex-col gap-2 border-t border-border bg-sunken px-4 py-3",children:[i?(0,U.jsx)("p",{className:"text-ui font-semibold text-danger",role:"alert",children:i}):null,(0,U.jsxs)("div",{className:"flex items-center gap-2",children:[m?(0,U.jsx)("button",{type:"button","data-orchestrator-rotate-cancel":!0,onClick:m,disabled:a,className:"inline-flex h-9 shrink-0 items-center justify-center rounded-control border border-border bg-card px-3 text-ui font-semibold text-secondary hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60",children:f("orchPanel.rotateCancel")}):null,(0,U.jsxs)("button",{type:"submit","data-orchestrator-confirm":!0,disabled:a,className:"inline-flex h-9 min-w-0 flex-1 items-center justify-center gap-1.5 rounded-control border border-accent bg-accent px-3 text-body font-semibold text-white shadow-1 hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60",children:[a?(0,U.jsx)(dR.A,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):x?(0,U.jsx)(dO.A,{className:"h-4 w-4","aria-hidden":!0}):(0,U.jsx)(dE.A,{className:"h-4 w-4","aria-hidden":!0}),(0,U.jsx)("span",{className:"truncate",children:f(h?"orchPanel.confirmRetry":x?"orchPanel.rotateConfirm":"orchPanel.confirm")})]})]})]})]})}let ha="border-border bg-canvas text-muted",hs="border-danger/40 bg-danger-soft text-danger",hl={live:{tone:"border-success/45 bg-success-soft text-success",key:"orchPanel.badgeLive"},stalled:{tone:"border-warning/45 bg-warning-soft text-warning",key:"orchPanel.badgeStalled"},resumable:{tone:ha,key:"orchPanel.badgeResumable"},dead:{tone:hs,key:"orchPanel.badgeDead"},resolving:{tone:ha,key:"orchPanel.badgeResolving"}};function ho({state:e}){let{t}=(0,eh.Ym)(),n="live"===e.kind?hl[e.liveness]:null,r=n?n.tone:"intent-error"===e.kind?hs:"creating"===e.kind?"border-accent/45 bg-accent-soft text-accent":ha,i=t(n?n.key:"creating"===e.kind?"orchPanel.badgeCreating":"intent-error"===e.kind?"orchPanel.badgeFailed":"draft"===e.kind?"orchPanel.badgeNone":"orchPanel.badgeReading");return(0,U.jsx)("span",{className:`shrink-0 rounded-full border px-2 py-0.5 text-caption font-semibold ${r}`,children:i})}function hc({transition:e}){let{t}=(0,eh.Ym)();return"creating"===e.kind?(0,U.jsxs)("p",{className:"flex shrink-0 items-center gap-1.5 border-b border-border bg-accent-soft px-3 py-1.5 text-ui text-accent",role:"status",children:[(0,U.jsx)(dR.A,{className:"h-3.5 w-3.5 shrink-0 animate-spin","aria-hidden":!0}),t("orchPanel.transitionPending")]}):(0,U.jsxs)("div",{className:"shrink-0 border-b border-danger/40 bg-danger-soft px-3 py-1.5",role:"alert","data-orchestrator-intent-error":!0,children:[(0,U.jsxs)("p",{className:"flex items-center gap-1.5 text-ui font-semibold text-danger",children:[(0,U.jsx)(i4.A,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),t("orchPanel.transitionFailed")]}),(0,U.jsx)("p",{className:"mt-0.5 whitespace-pre-wrap break-words text-caption leading-4 text-secondary",children:e.error})]})}function hd({rotation:e}){let{t}=(0,eh.Ym)(),n=e.reasons.map(n=>"context"===n?t("orchPanel.rotationContext",{percent:String(e.contextPercent??0)}):t("orchPanel.rotationDead")).join(" \xb7 ");return(0,U.jsxs)("div",{className:"shrink-0 border-b border-warning/45 bg-warning-soft px-3 py-1.5",role:"status","data-orchestrator-rotation":e.level,children:[(0,U.jsx)("p",{className:"text-ui font-semibold text-warning",children:t("strongly_recommend"===e.level?"orchPanel.rotationStrong":"orchPanel.rotation")}),n?(0,U.jsx)("p",{className:"mt-0.5 text-caption leading-4 text-secondary",children:n}):null,e.notes?.length?(0,U.jsx)("ul",{className:"mt-0.5 list-disc pl-3.5 text-caption leading-4 text-muted marker:text-muted/60",children:e.notes.map(e=>(0,U.jsx)("li",{children:e},e))}):null]})}function hu({children:e}){return(0,U.jsx)("div",{className:"flex min-h-0 flex-1 flex-col items-center justify-center gap-2 px-6 py-8 text-center",children:e})}function hp({onClick:e,children:t}){return(0,U.jsx)("button",{type:"button",onClick:e,className:"inline-flex h-8 items-center gap-1.5 rounded-control border border-border bg-card px-3 text-ui font-semibold text-primary hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:t})}let hm="llvOrchestratorPanelWidth",hf=e=>`${hm}:${e}`,hh="llvOrchestratorPanelOpen",hx=e=>`${hh}:${e}`;function hg(e){try{return window.localStorage.getItem(e)}catch{return null}}function hb(e){let t;return Number.isFinite(t=Number(hg(hf(e))??hg(hm)))&&t>=360?t:440}function hv({project:e,projectName:t,projectCwd:n,files:r,onClose:i}){let{t:a}=(0,eh.Ym)(),[s,l]=(0,Y.useState)(()=>hb(e)),[o,c]=(0,Y.useState)(e);o!==e&&(c(e),l(hb(e))),(0,Y.useLayoutEffect)(()=>(ac(248+s),()=>ac(0)),[s]);let d=(0,Y.useRef)(null),u=(0,Y.useCallback)(()=>{let t=null,n=e=>{l(t=Math.min(Math.max(360,e.clientX-248),Math.max(360,window.innerWidth-948)))},r=()=>{if(window.removeEventListener("pointermove",n),window.removeEventListener("pointerup",r),d.current=null,null!==t)try{window.localStorage.setItem(hf(e),String(t))}catch{}};d.current?.(),d.current=r,window.addEventListener("pointermove",n),window.addEventListener("pointerup",r)},[e]);return(0,Y.useLayoutEffect)(()=>()=>d.current?.(),[e]),(0,U.jsxs)("aside",{"data-orchestrator-dock":!0,"data-orchestrator-dock-width":s,className:"relative flex shrink-0 flex-col border-r border-border bg-card",style:{width:`max(360px, min(${s}px, calc(100vw - 948px)))`},children:[(0,U.jsx)(hn,{project:e,projectName:t,projectCwd:n,files:r,onClose:i},e),(0,U.jsx)("div",{role:"separator","aria-orientation":"vertical","aria-label":a("orchPanel.resize"),title:a("orchPanel.resize"),"data-orchestrator-dock-resize":!0,className:"absolute inset-y-0 right-0 z-10 w-1.5 cursor-col-resize hover:bg-accent/30",onPointerDown:e=>{e.preventDefault(),u()}})]})}var hw=n(6304),hy=n(5301);let hk=[[1920,4],[1440,3],[1024,2]];function hj({failures:e,size:t="panel",className:n=""}){let{t:r}=(0,eh.Ym)();if(e<=0)return null;let i="panel"===t;return(0,U.jsxs)("div",{role:"alert","data-catalog-error":"true",className:`flex flex-col items-center gap-2 text-center ${i?"mx-auto max-w-[420px] rounded-[10px] border border-danger/35 bg-danger-soft px-4 py-4":"px-3 py-4"} ${n}`,children:[(0,U.jsxs)("span",{className:`inline-flex items-center gap-1.5 font-bold text-danger ${i?"text-[13px]":"text-[12px]"}`,children:[(0,U.jsx)(i4.A,{className:i?"h-4 w-4 shrink-0":"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),r("catalog.errorTitle")]}),i?(0,U.jsx)("span",{className:"text-[12px] text-secondary",children:r("catalog.errorBody")}):null,(0,U.jsx)("span",{className:"text-[11px] font-semibold tabular-nums text-muted",children:r("catalog.attempts",{count:e})}),(0,U.jsxs)("button",{type:"button",className:`inline-flex min-h-11 items-center gap-1.5 rounded-full border border-border bg-card font-semibold text-primary hover:border-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${i?"px-4 text-[13px]":"px-3 text-[12px]"}`,onClick:()=>nF(),children:[(0,U.jsx)(m$.A,{className:"h-4 w-4","aria-hidden":!0})," ",r("catalog.retry")]})]})}function hN({files:e,projectCatalog:t,projectDisplayNames:n={},pipelines:r,workflows:i,archivedProjects:a,now:s,catalogFailures:l=0,onSelectProject:o,onSelectFile:c,onMenu:d,onOpenSearch:u,attention:p}){let{t:m}=(0,eh.Ym)(),f=ia(),h=l>0,x=function(){let[e,t]=(0,Y.useState)(3);return(0,Y.useEffect)(()=>{let e=()=>t(function(){for(let[e,t]of hk)if(window.innerWidth>=e)return t;return 1}());return window.addEventListener("resize",e),e(),()=>window.removeEventListener("resize",e)},[]),e}(),g=(0,hy.O)()?44:22,b=(0,Y.useMemo)(()=>eE(e,s,i,t,r,n),[e,s,i,t,r,n]),v=(0,Y.useMemo)(()=>b.filter(e=>!a.has(e.project)),[b,a]),w=b.length-v.length,y=(0,Y.useMemo)(()=>v.reduce((e,t)=>e+t.liveCount,0),[v]),k=v.filter(e=>e.liveCount>0).length,j=(0,Y.useMemo)(()=>v.map(t=>{let n=eF(e,t.project).flatMap(e=>e.columns.flatMap(e=>[e.file,...e.tasks])).filter(e=>"live"===e.activity),r=n.slice(0,4),i=e.filter(e=>eM(e)===t.project).sort((e,t)=>t.mtime-e.mtime)[0];return{summary:t,liveBranches:r,moreLive:n.length-r.length,latest:i}}),[e,v]);return(0,U.jsxs)("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[(0,U.jsxs)("div",{className:"flex h-10 shrink-0 items-center gap-2.5 overflow-x-clip border-b border-border bg-card px-4",children:[d?(0,U.jsx)("button",{type:"button",className:"-ml-1.5 flex h-7 w-7 shrink-0 items-center justify-center rounded-[8px] border border-border bg-canvas text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":m("dash.openProjects"),onClick:d,children:(0,U.jsx)(hw.A,{className:"h-4 w-4","aria-hidden":!0})}):null,(0,U.jsx)("h1",{className:"min-w-0 shrink truncate text-[13.5px] font-bold",children:m("rail.overview")}),(0,U.jsxs)("span",{className:`hidden min-w-0 shrink truncate text-[11.5px] min-[360px]:block ${h?"font-semibold text-danger":"text-muted"}`,"data-degraded":h?"true":void 0,children:[h?m("catalog.unreachable"):y?m("overview.branchesLiveIn",{count:y,projects:m("overview.projects",{count:k})}):m("common.nothingRunning"),!h&&w?` ${m("overview.archived",{count:w})}`:""]}),(0,U.jsxs)("span",{className:"ml-auto flex shrink-0 items-center gap-2",children:[u?(0,U.jsx)("button",{type:"button","data-testid":"overview-search",className:`flex shrink-0 items-center justify-center rounded-[8px] border border-border bg-canvas text-muted hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${f?"h-11 w-11":"h-7 w-7"}`,"aria-label":f?m("search.openMobile"):m("search.open"),title:m("search.open"),onClick:u,children:(0,U.jsx)(sx.vj,{className:f?"h-5 w-5":"h-4 w-4","aria-hidden":!0})}):null,p]})]}),(0,U.jsxs)("div",{className:"grid flex-1 auto-rows-min gap-2.5 overflow-y-auto p-3",style:{gridTemplateColumns:`repeat(${x}, minmax(0, 1fr))`},children:[j.map(({summary:e,liveBranches:t,moreLive:n,latest:r})=>{let i=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${e.liveCount?"animate-pulse bg-success":"bg-strong"}`}),(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate text-[13px] font-bold",children:e.displayName}),e.liveCount?(0,U.jsx)("span",{className:"shrink-0 text-caption font-semibold tabular-nums text-muted",children:e.liveCount}):null,(0,U.jsx)("span",{className:"shrink-0 text-[11px] font-semibold text-muted",children:e.conversations})]});return(0,U.jsx)("div",{"data-testid":"overview-card",className:`flex flex-col gap-1.5 rounded-[10px] border border-border bg-card p-3 text-left shadow-1 ${e.catalogOnly?"opacity-70":""}`,children:t.length?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("button",{type:"button","data-testid":"overview-project",style:{minHeight:g},className:"flex items-center gap-2 rounded-[8px] text-left hover:bg-canvas focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>o(e.project),children:i}),(0,U.jsxs)("div",{className:"flex flex-col gap-1","data-testid":"overview-rows",children:[t.map(e=>{let t=(0,tw.yz)(e);return(0,U.jsxs)("button",{type:"button","data-focus-target":e.path,"data-testid":"overview-conversation",style:{minHeight:g},className:"flex items-center gap-1.5 rounded-[8px] px-1 text-left text-[11.5px] hover:bg-canvas focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:(0,tw.cr)(e.title),onClick:()=>c(e),children:[(0,U.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${(0,tw.tz)(e.activity)}`}),(0,U.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px] font-bold",style:t.style,children:t.label}),(0,U.jsx)("span",{className:"truncate font-semibold",children:(0,tw.cr)(e.title,70)})]},e.path)}),n>0?(0,U.jsx)("span",{className:"px-1 text-[10.5px] font-semibold text-muted",children:m("overview.moreLive",{count:n})}):null]})]}):(0,U.jsxs)("button",{type:"button","data-testid":"overview-project",style:{minHeight:g},className:"flex flex-col gap-1.5 rounded-[8px] text-left hover:bg-canvas focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>o(e.project),children:[(0,U.jsx)("span",{className:"flex items-center gap-2",children:i}),(0,U.jsx)("span",{className:"text-[11px] text-muted",children:m("overview.quiet",{age:r?(0,tw.rK)(r.mtime):"—"})})]})},e.project)}),h?(0,U.jsx)(hj,{failures:l,className:`col-span-full ${v.length?"mt-1":"mt-[12vh]"}`}):v.length?null:(0,U.jsx)("div",{className:"col-span-full mt-[20vh] text-center text-muted",children:m("overview.empty")})]})]})}let hS={items:[],nextCursor:null,total:0,stats:null};class hC extends Error{constructor(e){super(`transcript search request failed: ${e}`),this.status=e,this.name="TranscriptSearchRequestError"}}function hA(e,t){return`${e??""}\u0000${t}`}function hI(e){return`${e.transcriptPath}\u0000${e.byteOffset}`}async function hM(e,t,n,r){let i,a=await fetch((i=new URLSearchParams({q:e.trim(),limit:String(20)}),t&&i.set("speaker",t),n&&i.set("cursor",n),`/api/search/transcripts?${i}`),{signal:r});if(!a.ok)throw new hC(a.status);return a.json()}let hT="llv-search-results";function hP(e){return`llv-search-option-${e}`}function h$({messages:e,conversations:t}){let{locale:n,t:r}=(0,eh.Ym)(),i=e=>e.toLocaleString("uk"===n?"uk-UA":"en-US");return(0,U.jsx)("div",{className:"mt-1.5 text-[11.5px] text-muted","data-search-corpus":!0,children:r("search.corpus",{messages:r("search.corpusMessages",{count:e,formatted:i(e)}),conversations:r("search.corpusConversations",{count:t,formatted:i(t)})})})}function hE({snippet:e}){return(0,U.jsx)(U.Fragment,{children:(function(e){let t=[],n="",r=!1;for(let i of e){if("\x01"!==i&&"\x02"!==i){n+=i;continue}n&&t.push({text:n,match:r}),n="",r="\x01"===i}return n&&t.push({text:n,match:r}),t})(e).map((e,t)=>e.match?(0,U.jsx)("mark",{className:"rounded-[3px] bg-accent-soft px-0.5 text-accent","data-search-match":!0,children:e.text},t):(0,U.jsx)("span",{children:e.text},t))})}function hR({mobile:e,onClose:t,onOpen:n}){let{t:r}=(0,eh.Ym)(),i=(0,Y.useRef)(null),a=(0,Y.useRef)(null),s=(0,Y.useRef)(null),[l,o]=(0,Y.useState)(""),[c,d]=(0,Y.useState)(!0),u=function({query:e,speaker:t,enabled:n=!0}){let[r,i]=(0,Y.useState)({query:e,speaker:t});(0,Y.useEffect)(()=>{if(e===r.query&&t===r.speaker)return;let n=250*(r.query!==e),a=window.setTimeout(()=>i({query:e,speaker:t}),n);return()=>window.clearTimeout(a)},[e,t,r.query,r.speaker]);let a=r.query.trim(),s=hA(r.speaker,a),l=n&&!!a,o=e.trim(),c=hA(t,o),d=n&&!!o,[u,p]=(0,Y.useState)({key:"",speaker:void 0,page:hS,error:!1}),[m,f]=(0,Y.useState)(null),[h,x]=(0,Y.useState)(0);(0,Y.useEffect)(()=>{if(!l)return;let e=new AbortController;return hM(r.query,r.speaker,null,e.signal).then(e=>p({key:s,speaker:r.speaker,page:e,error:!1})).catch(e=>{"AbortError"!==e.name&&p({key:s,speaker:r.speaker,page:hS,error:!0})}),()=>e.abort()},[l,r.query,r.speaker,s,h]),(0,Y.useEffect)(()=>{if(!m||m.key!==s)return;let e=new AbortController;return hM(r.query,r.speaker,m.cursor,e.signal).then(e=>{p(t=>{var n;let r;return t.key===m.key?{...t,page:(n=t.page,r=new Set(n.items.map(hI)),{items:[...n.items,...e.items.filter(e=>!r.has(hI(e)))],nextCursor:e.nextCursor,total:e.total,stats:e.stats??n.stats}),error:!1}:t})}).catch(e=>{e instanceof hC&&400===e.status?x(e=>e+1):"AbortError"!==e.name&&p(e=>e.key===m.key?{...e,error:!0}:e)}).finally(()=>{e.signal.aborted||f(e=>e===m?null:e)}),()=>e.abort()},[m,r.query,r.speaker,s]);let g=d&&(e!==r.query||t!==r.speaker),b=l&&u.key===s,v=d&&u.key?u.page:hS,w=b?v:{...v,nextCursor:null},y=d&&(g||l&&(!b||m?.key===s)),k=!!b&&u.error,j=v.items.length>0&&u.key!==c,N=v.items.length?u.speaker:t,S=(0,Y.useCallback)(()=>{b&&!y&&w.nextCursor&&f({key:s,cursor:w.nextCursor})},[b,y,w.nextCursor,s]),C=(0,Y.useCallback)(()=>{f(null),x(e=>e+1)},[]);return{...w,loading:y,error:k,stale:j,answeredSpeaker:N,loadMore:S,retry:C}}({query:l,speaker:c?"user":void 0}),p=`${c} ${l}`,[m,f]=(0,Y.useState)({scope:p,index:0}),h=u.items.length+ +!!u.nextCursor,x=h?Math.min(m.scope===p?m.index:0,h-1):-1,g=e=>f({scope:p,index:e});as({containerRef:i,onClose:t}),(0,Y.useEffect)(()=>{let e=window.setTimeout(()=>a.current?.focus(),0);return()=>window.clearTimeout(e)},[]),(0,Y.useEffect)(()=>{x<0||s.current?.querySelector(`#${hP(x)}`)?.scrollIntoView?.({block:"nearest"})},[x]);let b=(0,Y.useCallback)(e=>{u.stale||(t(),n(e.transcriptPath))},[u.stale,t,n]),v=l.trim(),w=e?"min-h-11":"",y=(0,U.jsx)("div",{role:"radiogroup","aria-label":r("search.speakerAria"),className:"flex shrink-0 items-center gap-0.5 rounded-full border border-border bg-canvas p-0.5",children:[!0,!1].map(t=>(0,U.jsx)("button",{type:"button",role:"radio","aria-checked":c===t,"data-search-scope":t?"mine":"everything",onClick:()=>d(t),className:`rounded-full px-2.5 text-[11.5px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${c===t?"bg-accent/10 text-accent":"text-muted hover:text-primary"} ${e?"min-h-11":"h-7"}`,children:t?r("search.mine"):r("search.everything")},String(t)))});return(0,U.jsx)("div",{className:"fixed inset-0 z-50 flex bg-primary/28",onMouseDown:t,"data-global-search-backdrop":!0,children:(0,U.jsxs)("div",{ref:i,tabIndex:-1,role:"dialog","aria-modal":"true","aria-label":r("search.aria"),"data-global-search":!0,onMouseDown:e=>e.stopPropagation(),className:e?"flex h-full w-full flex-col overflow-hidden bg-canvas outline-none":"mx-auto mt-[10vh] flex max-h-[min(72vh,720px)] w-full max-w-[720px] flex-col self-start overflow-hidden rounded-[8px] border border-border bg-canvas shadow-2 outline-none",children:[(0,U.jsxs)("header",{className:"flex h-14 shrink-0 items-center gap-2 border-b border-border bg-card px-3",children:[(0,U.jsx)(sx.vj,{className:"h-4 w-4 shrink-0 text-muted","aria-hidden":!0}),e?null:(0,U.jsx)("div",{className:"shrink-0 text-[13px] font-bold",children:r("search.title")}),(0,U.jsx)("input",{ref:a,value:l,onChange:e=>o(e.target.value),onKeyDown:e=>{if(!e.metaKey&&!e.ctrlKey&&!e.altKey){if("Enter"===e.key){e.preventDefault();let t=u.items[x];t?b(t):x>=0&&u.loadMore();return}h&&("ArrowDown"===e.key?(e.preventDefault(),g(Math.min(x+1,h-1))):"ArrowUp"===e.key?(e.preventDefault(),g(Math.max(x-1,0))):"Home"===e.key?(e.preventDefault(),g(0)):"End"===e.key&&(e.preventDefault(),g(h-1)))}},placeholder:r("search.placeholder"),"aria-label":r("search.title"),role:"combobox","aria-expanded":!0,"aria-controls":hT,"aria-autocomplete":"list","aria-activedescendant":x>=0?hP(x):void 0,"data-search-input":!0,className:`min-w-0 flex-1 rounded-[8px] border border-border bg-canvas px-3 text-[13px] outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${e?"h-11":"h-9"}`}),e?null:y,(0,U.jsx)("button",{type:"button","aria-label":r("search.close"),onClick:t,"data-search-close":!0,className:`inline-flex shrink-0 items-center justify-center rounded-[8px] border border-border bg-canvas text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${e?"h-11 w-11":"h-8 w-8"}`,children:(0,U.jsx)(sx.X,{className:"h-4 w-4","aria-hidden":!0})})]}),e?(0,U.jsx)("div",{className:"flex shrink-0 items-center border-b border-border bg-card px-3 py-1.5",children:y}):null,(0,U.jsxs)("div",{ref:s,className:"min-h-0 flex-1 overflow-y-auto px-3 py-3",children:[v?null:(0,U.jsxs)("div",{className:"pt-[12vh] text-center","data-search-hint":!0,children:[(0,U.jsx)("div",{className:"text-[13px] font-semibold text-muted",children:r("search.hint")}),e?null:(0,U.jsx)("div",{className:"mt-1.5 text-[11.5px] text-muted",children:r("search.keysHint")})]}),v&&u.loading&&!u.items.length?(0,U.jsxs)("div",{className:"flex items-center justify-center gap-2 pt-[12vh] text-[13px] font-semibold text-muted","data-search-loading":!0,children:[(0,U.jsx)(sx.kr,{className:"h-4 w-4 animate-spin","aria-hidden":!0})," ",r("common.loading")]}):null,v&&u.items.length?(0,U.jsxs)("div",{className:"mb-2 flex items-baseline gap-2",children:[(0,U.jsx)("h2",{className:"text-[13px] font-bold",children:r("search.results")}),(0,U.jsx)("span",{className:"text-[11px] font-semibold text-muted","data-search-total":!0,children:u.total}),u.loading?(0,U.jsx)("span",{className:"text-[11px] font-semibold text-muted","data-search-updating":!0,children:r("search.updating")}):null]}):null,(0,U.jsxs)("div",{id:hT,role:"listbox","aria-label":r("search.title"),"aria-busy":u.stale||void 0,"data-search-stale":u.stale?"":void 0,className:`space-y-1.5 ${u.stale?"opacity-60":""}`,children:[u.items.map((e,t)=>{let n=(0,tw.zZ)(e.engine);return(0,U.jsxs)("button",{id:hP(t),type:"button",role:"option","aria-selected":t===x,"aria-disabled":u.stale||void 0,tabIndex:-1,"data-search-result":e.transcriptPath,onClick:()=>b(e),className:`flex w-full min-w-0 flex-col gap-1 rounded-[8px] border bg-card px-3 py-2 text-left shadow-1 focus-visible:outline-none ${w} ${u.stale?"cursor-default":"hover:border-accent/40 hover:bg-canvas"} ${t===x?"border-accent/40 bg-canvas ring-2 ring-accent/40":"border-border"}`,children:[(0,U.jsxs)("span",{className:"flex min-w-0 items-center gap-2",children:[(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12.5px] font-semibold text-primary",children:e.title??r("search.untitled")}),(0,U.jsx)("span",{className:"max-w-[180px] shrink-0 truncate rounded-full border border-border bg-canvas px-2 py-0.5 text-[10.5px] font-semibold text-muted",title:e.project,children:eb(e.project)}),(0,U.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px] font-bold",style:n.style,children:n.label}),null===e.timestamp?null:(0,U.jsx)("span",{className:"shrink-0 text-[10.5px] text-muted",children:(0,tw.rK)(e.timestamp)})]}),(0,U.jsxs)("span",{className:"line-clamp-2 text-[11.5px] text-muted",children:[u.answeredSpeaker?null:(0,U.jsx)("span",{className:"mr-1 rounded-[3px] border border-border px-1 text-[10px] font-bold text-muted",children:"user"===e.speaker?r("search.speaker.you"):r("search.speaker.agent")}),(0,U.jsx)(hE,{snippet:e.snippet})]})]},hI(e))}),u.nextCursor?(0,U.jsx)("button",{id:hP(u.items.length),type:"button",role:"option","aria-selected":u.items.length===x,tabIndex:-1,disabled:u.loading,onClick:u.loadMore,"data-search-more":!0,className:`flex min-h-11 w-full items-center justify-center rounded-[8px] border bg-card px-4 text-[12.5px] font-bold text-primary hover:border-accent/40 hover:text-accent focus-visible:outline-none disabled:opacity-60 ${u.items.length===x?"border-accent/40 ring-2 ring-accent/40":"border-border"}`,children:u.loading?r("common.loading"):r("search.loadMore")}):null]}),!v||u.loading||u.error||u.items.length?null:(0,U.jsxs)("div",{className:"pt-[12vh] text-center","data-search-empty":!0,children:[(0,U.jsx)("div",{className:"text-[13px] font-semibold text-muted",children:r("search.none",{query:v})}),u.stats?(0,U.jsx)(h$,{messages:u.stats.messagesIndexed,conversations:u.stats.conversationsIndexed}):null,c?(0,U.jsx)("button",{type:"button",onClick:()=>d(!1),"data-search-widen":!0,className:"mt-3 inline-flex min-h-11 items-center rounded-[8px] border border-border bg-card px-4 text-[12.5px] font-bold text-primary hover:border-accent/40 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:r("search.everythingInstead")}):null]}),u.error?(0,U.jsxs)("div",{className:"flex min-h-11 items-center justify-center gap-3 pt-4 text-[13px] font-semibold text-danger","data-search-error":!0,children:[(0,U.jsx)("span",{children:r("search.failed")}),(0,U.jsx)("button",{type:"button",onClick:u.retry,"data-search-retry":!0,className:"min-h-11 rounded-[8px] border border-border bg-card px-4 font-bold text-primary hover:border-accent/40 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:r("search.retry")})]}):null]})]})})}var hO=n(3599),hD=n(8309),hL=n(5377),h_=n(9707),hF=n(2133),hq=n(5330),hz=n(976);function hH(){return{entries:[],cursor:0}}function hU(e){return e.cursor>0}function hB(e){return e.cursor<e.entries.length}function hK(e){return"object"==typeof e&&null!==e&&"close"===e.kind&&"string"==typeof e.path&&"string"==typeof e.title}let hY=e=>`llvBoardHistory:${e}`,hW=(0,Y.createContext)(null),hV=hW.Provider;function hJ(){return(0,Y.useContext)(hW)}let hG=new Map,hQ=()=>0;function hX(e=15e3){let t=function(e){let t=hG.get(e);if(t)return null===t.timer&&Date.now()/1e3-t.now>=e/1e3&&(t.now=Date.now()/1e3),t;let n={now:Date.now()/1e3,listeners:new Set,timer:null};return n.subscribe=t=>(n.listeners.add(t),null===n.timer&&(n.now=Date.now()/1e3,n.timer=setInterval(()=>{for(let e of(n.now=Date.now()/1e3,[...n.listeners]))e()},e)),()=>{n.listeners.delete(t),0===n.listeners.size&&null!==n.timer&&(clearInterval(n.timer),n.timer=null)}),n.read=()=>n.now,hG.set(e,n),n}(e);return(0,Y.useSyncExternalStore)(t.subscribe,t.read,hQ)}function hZ({canUndo:e,canRedo:t,undoEntry:n,redoEntry:r,onUndo:i,onRedo:a}){var s,l;let{t:o}=(0,eh.Ym)(),c=n?.title.trim(),d=r?.title.trim(),u=e?(s=c?o("board.undoReopen",{title:c}):o("board.undo"),`${s} (Ctrl+Z)`):o("board.undoNothing"),p=t?(l=d?o("board.redoReclose",{title:d}):o("board.redo"),`${l} (Ctrl+Shift+Z)`):o("board.redoNothing"),m="h-4 w-4",f="flex items-center justify-center text-primary transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 hover:text-accent disabled:cursor-default disabled:text-muted disabled:opacity-40 disabled:hover:text-muted";return e||t?(0,U.jsxs)("div",{className:"inline-flex shrink-0 items-center rounded-control border border-border bg-card",role:"group","aria-label":o("board.historyGroup"),children:[(0,U.jsx)(ly,{label:u,children:(0,U.jsx)("button",{type:"button",className:`${f} h-7 w-8`,onClick:i,disabled:!e,"aria-label":u,children:(0,U.jsx)(hq.A,{className:m,"aria-hidden":!0})})}),(0,U.jsx)("span",{className:"h-5 w-px shrink-0 bg-border","aria-hidden":!0}),(0,U.jsx)(ly,{label:p,children:(0,U.jsx)("button",{type:"button",className:`${f} h-7 w-8`,onClick:a,disabled:!t,"aria-label":p,children:(0,U.jsx)(hz.A,{className:m,"aria-hidden":!0})})})]}):null}function h0(){let e=null;return{consume:t=>!!t&&e!==t.nonce&&(e=t.nonce,!0),appliedNonce:()=>e}}var h1=n(6957),h2=n(5408),h5=n(5480);let h4=new Set(["starting","awaiting_browser","awaiting_code","verifying","canceling","authenticated","canceled","timed_out","failed","interrupted"]),h3=new Set(["starting","awaiting_browser","awaiting_code","verifying","canceling"]);function h6(e){if("object"!=typeof e||null===e||"string"!=typeof e.operationId||"string"!=typeof e.phase||!h4.has(e.phase)||null!==e.loginUrl&&"string"!=typeof e.loginUrl||"boolean"!=typeof e.acceptsCode||"string"!=typeof e.deadlineAt)return null;let t=null;if(null!==e.result&&void 0!==e.result){let n=e.result;if("success"!==n.status&&"failure"!==n.status&&"canceled"!==n.status||"string"!=typeof n.code||"string"!=typeof n.message)return null;t={status:n.status,code:n.code,message:n.message}}return{operationId:e.operationId,phase:e.phase,loginUrl:e.loginUrl??null,acceptsCode:e.acceptsCode,deadlineAt:e.deadlineAt,result:t}}function h8(e){switch(e){case"timed_out":return"accounts.claudeLogin.err.timed_out";case"interrupted":return"accounts.claudeLogin.err.interrupted";case"verification_failed":return"accounts.claudeLogin.err.verification_failed";case"input_failed":return"accounts.claudeLogin.err.input_failed";case"login_busy":return"accounts.claudeLogin.err.login_busy";default:return"accounts.claudeLogin.err.generic"}}function h7(e){if("object"!=typeof e||null===e||"number"!=typeof e.usedPercent||!Number.isFinite(e.usedPercent))return null;let t="number"==typeof e.resetsAt&&Number.isFinite(e.resetsAt)?e.resetsAt:null,n="number"==typeof e.windowMinutes&&Number.isFinite(e.windowMinutes)?e.windowMinutes:null,r="number"==typeof e.observedAt&&Number.isFinite(e.observedAt)?e.observedAt:null,i="live"===e.source||"transcript"===e.source||"cache"===e.source||"unavailable"===e.source||"account"===e.source?e.source:void 0;return{usedPercent:e.usedPercent,resetsAt:t,windowMinutes:n,observedAt:r,...i?{source:i}:{}}}function h9(e,t){let n=t.target?e(t.messageKey,{target:t.target,label:t.target}):e(t.messageKey);return t.detail?`${n} — ${t.detail}`:n}function xe(e){return e.find(e=>e.loginPending)?.deviceAuth??null}let xt={accounts:[],active:"",identityVersion:0,status:"loading",notice:null,challenge:null,mutation:null,migration:null,autoBalance:null};function xn(e,t){return{kind:"error",operation:"add",messageKey:h8(e),action:{type:"retry",kind:"add",label:t}}}class xr extends Error{constructor(e){super(e??"account selection failed"),this.detail=e,this.name="SwitchRequestError"}}function xi(e){return"string"==typeof e?.detail&&e.detail?e.detail:"string"==typeof e?.error&&e.error&&!/selection failed$/i.test(e.error)?e.error:void 0}function xa(e,{fetcher:t=globalThis.fetch.bind(globalThis),timeoutMs:n=1e4}={}){let r=`/api/accounts/${e}/active`,i=`/api/accounts/${e}`,a=xt,s=0,l=null,o=!1,c=Promise.resolve(),d=null,u=null,p=new Set,m=e=>{for(let t of(a=e,x(),p))t()},f=e=>m({...a,...e}),h=()=>{null!==d&&clearInterval(d),d=null,u=null},x=()=>{let e=0===p.size?null:a.accounts.some(e=>null!=e.login&&h3.has(e.login.phase))?2500:a.accounts.some(e=>e.loginPending)||a.migration?.state==="draining"?1e4:null;e!==u&&(h(),null!==e&&(d=setInterval(()=>void b(),e),u=e))},g=()=>{s+=1,l?.abort(),l=null},b=async()=>{g();let r=s,i=new AbortController;l=i;let o=setTimeout(()=>i.abort(),n);try{let n=await t("/api/accounts",{signal:i.signal});if(!n.ok)throw Error("accounts request failed");let{active:o,accounts:c,migration:d,autoBalance:u}=function(e,t){let n=e?.[t];if("string"!=typeof n?.active||!Array.isArray(n.accounts))throw Error("accounts response invalid");let r=n.accounts.map(e=>{let n="claude"===t?h6(e.login):null,r=n?h3.has(n.phase):!0===e.loginPending,i="object"==typeof e.auth&&null!==e.auth?e.auth.state:null,a="authenticated"===i||"signed_out"===i||"unknown"===i||"error"===i?i:e.authPresent?"unknown":"signed_out";return{...e,authHealth:a,login:n,loginPending:r,limits:function(e){if("object"!=typeof e||null===e)return null;let t="fresh"===e.state?"fresh":"stale"===e.state?"stale":null;if(!t)return null;let n=h7(e.session),r=h7(e.weekly);return n||r?{freshness:t,session:n,weekly:r,checkedAt:"string"==typeof e.checkedAt&&Number.isFinite(Date.parse(e.checkedAt))?e.checkedAt:null}:null}(e.limits)}});return{active:n.active,accounts:r,migration:function(e){let t,n=lm(e);if(!n)return null;let r=lh(n.intentId),i=lh(n.targetId);if(!r||!i)return null;let a=lx.has(n.state)?n.state:"draining";return{intentId:r,targetId:i,targetLabel:lh(n.targetLabel)??i,revision:lf(n.revision),origin:"auto"===n.origin?"auto":"manual",reason:function(e){let t=lm(e);if(!t)return null;let n="weekly"===t.window?"weekly":"session"===t.window?"session":null;return n?{window:n,fromPercent:lf(t.fromPercent),toPercent:lf(t.toPercent)}:null}(n.reason),state:a,counts:(t=lm(n.counts)??{},{done:lf(t.done),waitingTurn:lf(t.waitingTurn),inFlight:lf(t.inFlight),failed:lf(t.failed),total:lf(t.total)}),startedAt:lh(n.startedAt)}}(n.migration),autoBalance:function(e){let t=lm(e);if(!t||"boolean"!=typeof t.enabled)return null;let n=lg.has(t.state)?t.state:"idle";return{enabled:t.enabled,thresholdPercent:lf(t.thresholdPercent,25),state:t.enabled?n:"disabled",cooldownUntil:lh(t.cooldownUntil),lastCheckAt:lh(t.lastCheckAt),lastOutcome:function(e){let t=lm(e);if(!t)return null;let n=lh(t.at);if(!n)return null;let r="failed"===t.kind?"failed":"skipped"===t.kind?"skipped":"switched",i="weekly"===t.window?"weekly":"session"===t.window?"session":null;return{at:n,kind:r,fromId:lh(t.fromId),fromPercent:"number"==typeof t.fromPercent?t.fromPercent:null,toId:lh(t.toId),toPercent:"number"==typeof t.toPercent?t.toPercent:null,window:i,detail:lh(t.detail)}}(t.lastOutcome)}}(n.autoBalance)}}(await n.json(),e);if(r!==s)return!1;return l=null,m({...a,active:o,accounts:c,migration:d,autoBalance:u,challenge:xe(c),status:"ready",notice:a.notice?.operation==="refresh"?null:a.notice}),!0}catch{if(r!==s)return!1;l=null;let e=a.notice&&"refresh"!==a.notice.operation?a.notice:{kind:"error",operation:"refresh",messageKey:"accounts.refreshFailed",action:{type:"retry",kind:"refresh"}};return m({...a,status:"error",notice:e}),!1}finally{clearTimeout(o)}},v=(e,t)=>{if(o||a.mutation)return Promise.resolve(!1);o=!0,f({mutation:e});let n=c.then(t,t);return c=n.then(()=>void 0,()=>void 0),n.finally(()=>{o=!1,f({mutation:null})})},w=n=>{let r=n.trim();return r?v("add",async()=>{try{let n=await t(i,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({label:r})}),s=await n.json().catch(()=>null);if("claude"===e){if(!n.ok){let e;return f({notice:xn((e=s?.code,"string"==typeof e?e:null),r)}),await b(),!1}let e=h6(s?.login);if("string"!=typeof s?.account?.id||"string"!=typeof s.account.label||!e)throw Error("account creation failed");let t={id:s.account.id,label:s.account.label,kind:"managed",authPresent:!0===s.account.authPresent,login:e,loginPending:h3.has(e.phase),loginState:"pending",deviceAuth:null},i=a.accounts.some(e=>e.id===t.id)?a.accounts.map(e=>e.id===t.id?{...e,...t}:e):[...a.accounts,t];f({accounts:i,challenge:xe(i),notice:{kind:"success",operation:"add",messageKey:"accounts.claudeLoginStarted",target:t.label,action:null}})}else{if(!n.ok||"string"!=typeof s?.account?.id||"string"!=typeof s.account.label||"string"!=typeof s.target)throw Error("account creation failed");let e={id:s.account.id,label:s.account.label,authPresent:!0===s.account.authPresent,loginPending:!0===s.account.loginPending,loginState:!0===s.account.loginPending?"pending":"idle",deviceAuth:null,login:null},t=a.accounts.some(t=>t.id===e.id)?a.accounts:[...a.accounts,e];f({accounts:t,challenge:xe(t),notice:{kind:"success",operation:"add",messageKey:"accounts.loginOpened",target:s.target,action:null}})}}catch{return f({notice:"claude"===e?xn(null,r):{kind:"error",operation:"add",messageKey:"accounts.addFailed",action:{type:"retry",kind:"add",label:r}}}),await b(),!1}return await b(),!0}):Promise.resolve(!1)},y=e=>{if(!e)return Promise.resolve(!1);let n=a.accounts.find(t=>t.id===e);return!n?.authPresent||n.loginPending?Promise.resolve(!1):e===a.active?(a.notice?.operation==="switch"&&f({notice:null}),b()):v("switch",async()=>{let n=a.active;f({active:e,identityVersion:a.identityVersion+1});try{let n=await t(r,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({id:e,mode:"select"})});if(!n.ok){let e=xi(await n.json().catch(()=>null));throw new xr(e)}}catch(r){let t=r instanceof xr?r.detail:void 0;if(f({active:n,identityVersion:a.identityVersion+1,notice:{kind:"error",operation:"switch",messageKey:"accounts.switchFailed",...t?{detail:t}:{},action:{type:"retry",kind:"switch",accountId:e}}}),await b()&&a.active===e)return f({identityVersion:a.identityVersion+1,notice:a.notice?.operation==="switch"?null:a.notice}),!0;return!1}return f({identityVersion:a.identityVersion+1,notice:a.notice?.operation==="switch"?null:a.notice}),await b(),!0})},k=(e,t)=>{f({accounts:a.accounts.map(n=>{if(!n.login||n.login.operationId!==e)return n;let r=t(n.login);return{...n,login:r,loginPending:h3.has(r.phase)}})})},j=n=>"claude"!==e?Promise.resolve(!1):v("login",async()=>{try{let e=await t(i,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"retry",id:n})}),r=await e.json().catch(()=>null);if(409===e.status)return await b(),f({notice:{kind:"error",operation:"login",messageKey:"accounts.claudeLogin.err.login_busy",action:null}}),!1;let s=h6(r?.login);if(202!==e.status||!s)throw Error("login retry failed");let l=a.accounts.find(e=>e.id===n)?.label??n,o=a.accounts.map(e=>e.id===n?{...e,login:s,authPresent:!1,loginState:"pending",loginPending:h3.has(s.phase)}:e);f({accounts:o,notice:{kind:"success",operation:"login",messageKey:"accounts.claudeLoginStarted",target:l,action:null}})}catch{return f({notice:{kind:"error",operation:"login",messageKey:"accounts.claudeLogin.err.generic",action:{type:"retry",kind:"loginRetry",accountId:n}}}),await b(),!1}return await b(),!0}),N=(e,n=!1)=>{let r=a.accounts.find(t=>t.id===e)?.label??e;return v("remove",async()=>{try{let s=await t(i,{method:"DELETE",headers:{"content-type":"application/json"},body:JSON.stringify({id:e,force:n})});if(!s.ok){let t=await s.json().catch(()=>null),n=t?.code==="account_removal_blocked",i=n&&Array.isArray(t?.blockers)&&t.blockers.includes("current_conversations");return f({notice:{kind:"error",operation:"remove",messageKey:i?"accounts.removeHistoryBlocked":n?"accounts.removeBlocked":"accounts.removeFailed",target:r,action:n&&!i?{type:"retry",kind:"forceRemove",accountId:e}:null}}),await b(),!1}let l=await s.json().catch(()=>null),o=a.accounts.filter(t=>t.id!==e);f({accounts:o,challenge:xe(o),identityVersion:a.identityVersion+1,notice:l?.cleanupPending===!0?{kind:"error",operation:"remove",messageKey:"accounts.cleanupPending",target:r,action:{type:"retry",kind:"cleanupOrphans"}}:null})}catch{return f({notice:{kind:"error",operation:"remove",messageKey:"accounts.removeFailed",target:r,action:null}}),await b(),!1}return await b(),!0})},S=()=>v("remove",async()=>{try{let e=await t(i,{method:"DELETE",headers:{"content-type":"application/json"},body:JSON.stringify({cleanupOrphans:!0})});if(!e.ok)throw Error("orphan cleanup failed");let n=await e.json().catch(()=>null),r=Array.isArray(n?.unresolved)?n.unresolved.filter(e=>"string"==typeof e):[];f({notice:r.length?{kind:"error",operation:"remove",messageKey:"accounts.cleanupManual",action:null}:null})}catch{return f({notice:{kind:"error",operation:"remove",messageKey:"accounts.cleanupFailed",action:null}}),await b(),!1}return await b(),!0}),C=async()=>{let e=a.notice?.action;if(!e)return!1;switch(e.kind){case"refresh":return b();case"add":return w(e.label);case"loginRetry":return j(e.accountId);case"cleanupOrphans":return S();case"forceRemove":return N(e.accountId,!0);case"switch":return y(e.accountId)}};return{engine:e,subscribe:e=>(p.add(e),x(),"loading"===a.status&&null===l&&b(),()=>{p.delete(e),0===p.size?(h(),g()):x()}),getSnapshot:()=>a,get accounts(){return a.accounts},get active(){return a.active},get identityVersion(){return a.identityVersion},get status(){return a.status},get notice(){return a.notice},get challenge(){return a.challenge},get mutation(){return a.mutation},get migration(){return a.migration},get autoBalance(){return a.autoBalance},refresh:b,add:w,retryNotice:C,select:y,submitLoginCode:(n,r)=>{if("claude"!==e)return Promise.resolve(!1);let i=r.trim();return i?v("login",async()=>{k(n,e=>({...e,phase:"verifying",acceptsCode:!1}));try{if(!(await t(`/api/accounts/claude/login/${encodeURIComponent(n)}/input`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({code:i})})).ok)return f({notice:{kind:"error",operation:"login",messageKey:"accounts.claudeLogin.err.input_failed",action:null}}),await b(),!1}catch{return f({notice:{kind:"error",operation:"login",messageKey:"accounts.claudeLogin.err.input_failed",action:null}}),await b(),!1}return await b(),!0}):Promise.resolve(!1)},cancelLogin:n=>"claude"!==e?Promise.resolve(!1):v("login",async()=>{k(n,e=>({...e,phase:"canceling",acceptsCode:!1}));try{if(!(await t(`/api/accounts/claude/login/${encodeURIComponent(n)}`,{method:"DELETE"})).ok)throw Error("cancel failed")}catch{return await b(),!1}return await b(),!0}),retryLogin:j,remove:N,cleanupOrphans:S,copyTerminalCommand:n=>{let r=a.accounts.find(e=>e.id===n);return!r?.authPresent||r.loginPending?Promise.resolve(!1):v("terminal",async()=>{try{let i=await t(`/api/accounts/${e}/terminal`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({id:n})}),a=await i.json().catch(()=>null);if(!i.ok||"string"!=typeof a?.command)return f({notice:{kind:"error",operation:"terminal",messageKey:"accounts.terminalFailed",target:r.label,...xi(a)?{detail:xi(a)}:{},action:null}}),!1;try{await navigator.clipboard.writeText(a.command)}catch{}return f({notice:{kind:"success",operation:"terminal",messageKey:"accounts.terminalCopied",target:r.label,detail:a.command,action:null}}),!0}catch{return f({notice:{kind:"error",operation:"terminal",messageKey:"accounts.terminalFailed",target:r.label,action:null}}),!1}})}}}let xs={codex:xa("codex"),claude:xa("claude")};function xl(e){let t=xs[e];return{...(0,Y.useSyncExternalStore)(t.subscribe,t.getSnapshot,t.getSnapshot),engine:e,refresh:t.refresh,add:t.add,retryNotice:t.retryNotice,select:t.select,submitLoginCode:t.submitLoginCode,cancelLogin:t.cancelLogin,retryLogin:t.retryLogin,remove:t.remove,cleanupOrphans:t.cleanupOrphans,copyTerminalCommand:t.copyTerminalCommand}}let xo=["deployer"];function xc(e,t){return e.runs.find(e=>e.stageId===t)?.attempts.findLast(e=>!e.historical)??null}let xd=["orchestrator","reviewer","verifier","builder","architect","cleaner","prod-auditor","deployer"].filter(e=>!xo.includes(e));function xu(e,t){return e(`pipelineState.${t}`)}let xp=new Set(["provisioning","running"]),xm=new Set(["needs_decision","paused"]);function xf(e){return!!xp.has(e.state)||"paused"===e.state&&null!==e.pausedState&&xp.has(e.pausedState)}let xh={pending:{color:"var(--color-muted)",soft:"var(--color-sunken)"},running:{color:"var(--color-accent)",soft:"var(--color-accent-soft)"},reviewing:{color:"var(--color-accent)",soft:"var(--color-accent-soft)"},committing:{color:"var(--color-accent)",soft:"var(--color-accent-soft)"},passed:{color:"var(--color-success)",soft:"var(--color-success-soft)"},failed:{color:"var(--color-danger)",soft:"var(--color-danger-soft)"},needs_decision:{color:"var(--color-warning)",soft:"var(--color-warning-soft)"},skipped:{color:"var(--color-muted)",soft:"var(--color-sunken)"}},xx={pending:"○",running:"▸",reviewing:"⟳",committing:"▾",passed:"✓",failed:"✕",needs_decision:"●!",skipped:"↷"};function xg(e,t){return e.runs.find(e=>e.stageId===t)?.attempts??[]}let xb=new Set(["draft","provisioning","running","needs_decision","paused"]),xv=new Set(["pending","spawning","running","reviewing","committing"]);function xw(e,t){let n=new Map(t.map(e=>[e.id,e])),r=new Set;for(let t of e)if(t.cursor&&"completed"!==t.state&&"closed"!==t.state&&"draft"!==t.state)for(let e of t.stages){let i=xc(t,e.id);if(!i)continue;if(i.agentPath){r.add(i.agentPath);continue}if("review-loop"!==e.kind)continue;let a=t.stages.findIndex(t=>t.id===e.id),s=t.stages.slice(0,a).reverse().find(e=>{let n=xc(t,e.id);return"run"===e.kind&&n?.state==="passed"&&n.agentPath}),l=i.flowId?n.get(i.flowId)?.implementerPath:s?xc(t,s.id)?.agentPath:null;l&&r.add(l)}return r}function xy(e,t){return t.size?e.filter(e=>!t.has(e.path)):e}function xk(e,t){let n=new Set;for(let t of e)for(let e of t.runs)for(let t of e.attempts)t.flowId&&n.add(t.flowId);return n.size?t.filter(e=>!n.has(e.id)):[...t]}function xj(e,t=[],n=[]){let r=new Set,i=new Set;e.srcPath&&r.add(e.srcPath),e.srcConversationId&&i.add(e.srcConversationId);let a=new Map(t.map(e=>[e.id,e]));for(let t of e.runs)for(let e of t.attempts){e.agentPath&&r.add(e.agentPath),e.conversationId&&i.add(e.conversationId);let t=e.flowId?a.get(e.flowId):null;if(t)for(let e of(r.add(t.implementerPath),t.implementerConversationId&&i.add(t.implementerConversationId),t.rounds))for(let a of te(t,e,n))r.add(a.path),a.conversationId&&i.add(a.conversationId)}return{paths:r,conversationIds:i}}function xN(e,t,n=[],r=[]){let i=e.taskIds;if(i?.length){let e=new Map(t.map(e=>[e.id,e]));return i.flatMap(t=>{let n=e.get(t);return n?[n]:[]})}let{paths:a,conversationIds:s}=xj(e,n,r);return a.size||s.size?t.filter(e=>!!e.source&&a.has(e.source.path)||e.assignments.some(e=>!!(e.path&&a.has(e.path)||e.conversationId&&s.has(e.conversationId)))):[]}function xS(e,t,n,r,i=[]){let a=n.find(e=>xj(e,r,i).paths.has(t)),s=a?xj(a,r,i).paths:null,l=s?e.filter(e=>!s.has(e)):[...e];return l.includes(t)?l:[...l,t]}function xC(e,t){let n=xc(e,t.id);if(n){if("passed"===n.state)return"passed";if("skipped"===n.state)return"skipped";if("failed"===n.state)return"failed";if("needs_decision"===n.state)return"needs_decision"}return e.cursor?.stageId===t.id&&xf(e)?e.cursor?.state==="committing"||n?.state==="committing"?"committing":"review-loop"===t.kind||e.cursor?.state==="reviewing"||n?.state==="reviewing"?"reviewing":"running":"pending"}function xA(e,t){return new Set(e.filter(e=>("closed"!==e.state||e.restored)&&t.has(e.implementerPath)).map(e=>e.id))}function xI(e){return e&&(e.conversationId||e.agentPath)?{conversationId:e.conversationId,agentPath:e.agentPath}:null}function xM(e,t){if(!e)return null;if(e.conversationId){let n=Z(t,e.conversationId);if(n&&!V(n))return n}if(e.agentPath){let n=et(e.agentPath,null,t);if(n)return t.find(e=>e.path===n)??null}return null}function xT(e,t,n,r,i,a=[]){var s,l,o,c;let d=(s=e,l=t,o=r,c=i,l?"review-loop"===s.kind?l.flowId&&(!o||o.has(l.flowId))?{kind:"flow",flowId:l.flowId}:null:l.agentPath&&(!c||c.has(l.agentPath))?{kind:"path",path:l.agentPath}:null:null);if(d||"review-loop"!==e.kind||!t?.flowId)return d;let u=n.find(e=>e.id===t.flowId);if(!u)return null;for(let e of[...u.rounds].reverse()){let t=[...te(u,e,a)].reverse().find(({path:e})=>!i||i.has(e))?.path;if(t)return{kind:"path",path:t}}return!i||i.has(u.implementerPath)?{kind:"path",path:u.implementerPath}:null}function xP(e,t,n,r,i=[]){for(let a of[...e.stages].reverse()){let s=xT(a,xc(e,a.id),t,n,r,i);if(s)return s}return null}function x$(e,t,n){return!!n&&(!!n.verdict||!!n.error||"needs_decision"===e.state&&e.cursor?.stageId===t.id)}function xE(e,t,n,r=[],i,a=[]){if(!n)return!1;let s=e=>!i||i.has(e),l=xg(e,t.id);if(l.some(e=>e.n!==n.n&&!!(e.agentPath&&s(e.agentPath))))return!0;let o=new Set(l.flatMap(e=>e.flowId?[e.flowId]:[])),c=new Set(l.flatMap(e=>e.agentPath?[e.agentPath]:[]));return r.some(e=>o.has(e.id)&&e.rounds.some(t=>te(e,t,a).some(({path:e})=>!c.has(e)&&s(e))))}function xR(e,t){return e(`pipelineChipState.${t}`)}function xO(e,t){if(t.role?.roleId){var n;return n=t.role.roleId,dL(e,`roleCopy.${n}.name`,n)}return"review-loop"===t.kind?e("pipelineStrip.reviewStage"):t.id}function xD(e,t,n,r){let i=xO(e,t),a=e("pipelineSlot.stageOf",{k:n+1,n:r});return i===t.id?`${i} \xb7 ${a}`:`${i} \xb7 ${t.id} \xb7 ${a}`}function xL(e){let t=new Map;for(let n of e)"closed"!==n.state&&n.stages.forEach((e,r)=>{let i=xc(n,e.id);i?.agentPath&&t.set(i.agentPath,{pipeline:n,stage:e,index:r,total:n.stages.length})});return t}function x_(e,t){return t?xD(e,t.stage,t.index,t.total):void 0}function xF(e,t,n){let r=xC(e,t);return"skipped"===r||"completed"===n&&("passed"===r||"failed"===r)}function xq(e,t=120){let n=(e??"").split("\n").map(e=>e.trim()).find(e=>e.length>0)??"";return n.length>t?`${n.slice(0,t-1)}…`:n}function xz(e){let t,n,r,i=e.stages.length;if(e.cursor){let t=e.stages.findIndex(t=>t.id===e.cursor.stageId);return{k:t>=0?t+1:i,n:i}}let a=(t=-1,n=-1,r="",e.stages.forEach((i,a)=>{let s=xc(e,i.id);if(!s)return;xv.has(s.state)&&(t=a);let l=s.completedAt??s.startedAt??"";(s.completedAt||s.startedAt)&&(-1===n||l>=r)&&(n=a,r=l)}),t>=0?t:n);return{k:a>=0?a+1:i,n:i}}let xH={pass:{color:"var(--color-success)",soft:"var(--color-success-soft)"},fail:{color:"var(--color-danger)",soft:"var(--color-danger-soft)"},needs_decision:{color:"var(--color-warning)",soft:"var(--color-warning-soft)"}};function xU(e,t){return e("pass"===t?"pipelineVerdict.pass":"fail"===t?"pipelineVerdict.fail":"pipelineVerdict.needsDecision")}let xB=[{id:"planBuildReview",labelKey:"pipelineTemplates.planBuildReview",stages:[{kind:"run",roleId:"architect",access:"read-only",prompt:"{{task}}"},{kind:"run",roleId:"builder",access:"read-write",prompt:"{{prev.output}}"},{kind:"review-loop",roleId:"reviewer",access:"read-only",prompt:"{{task}}"}]},{id:"buildReview",labelKey:"pipelineTemplates.buildReview",stages:[{kind:"run",roleId:"builder",access:"read-write",prompt:"{{task}}"},{kind:"review-loop",roleId:"reviewer",access:"read-only",prompt:"{{task}}"}]},{id:"buildVerify",labelKey:"pipelineTemplates.buildVerify",stages:[{kind:"run",roleId:"builder",access:"read-write",prompt:"{{task}}"},{kind:"run",roleId:"verifier",access:"read-only",prompt:"{{prev.output}}"}]},{id:"blank",labelKey:"pipelineTemplates.blank",stages:[{kind:"run",roleId:"",access:"read-write",prompt:"{{task}}"},{kind:"run",roleId:"",access:"read-write",prompt:"{{prev.output}}"}]}],xK=/\{\{(?:task|prev\.output)\}\}/g;function xY(e){return e.replace(xK," ").split("\n").map(e=>e.replace(/[ \t]+/g," ").trim()).join("\n").replace(/\n{3,}/g,"\n\n").trim()}function xW(e){let t=e.indexOf("run"),n=e.indexOf("review-loop");return -1===n||-1!==t&&t<n}async function xV(e,t){try{let n=await fetch("/api/pipelines/preflight",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({repoDir:e}),signal:t}),r=await n.json().catch(()=>null);if(n.ok&&r?.ok)return r;if(r&&!r.ok&&r.code)return{ok:!1,code:r.code,path:r.path};return{ok:!1,code:"missing",path:e,error:(0,eh.Tl)((0,eh.JK)(),"pipelineModel.failed",{status:n.status})}}catch(t){if(t instanceof DOMException&&"AbortError"===t.name)throw t;return{ok:!1,code:"missing",path:e,error:(0,eh.Tl)((0,eh.JK)(),"common.serverUnavailable")}}}async function xJ(e){try{let t=await fetch("/api/pipelines",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)}),n=await t.json().catch(()=>null);if(t.ok&&n?.pipeline)return rw(n.pipeline,!0),!1!==e.autoStart&&window.dispatchEvent(new Event(ng)),{pipeline:n.pipeline};return{error:n?.error??(0,eh.Tl)((0,eh.JK)(),"pipelineModel.failed",{status:t.status}),...n?.code?{code:n.code,field:n.field,path:n.path}:{}}}catch{return{error:(0,eh.Tl)((0,eh.JK)(),"common.serverUnavailable")}}}async function xG(e,t,n,r){var i;let a,s,l=(t??"").trim();return l?xJ({task:(0,eh.Tl)((0,eh.JK)(),"pipelineBuilder.untitledTask"),repoDir:l,stages:n?(i=n.stages.map((e,t)=>({key:`tpl-${t}`,kind:e.kind,roleId:e.roleId,engine:"claude",model:"",effort:"",access:e.access,prompt:e.prompt,roleParams:{}})),a=new Set,s=i.map(e=>(function(e,t,n){let r=(t?t.replace(/[^A-Za-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"").toLowerCase():"")||("review-loop"===e?"review":"stage"),i=r;for(let e=2;n.has(i);e+=1)i=`${r}-${e}`;return n.add(i),i})(e.kind,e.roleId,a)),i.map((e,t)=>{let n=function(e){let t={};for(let[n,r]of Object.entries(e))if("string"==typeof r){let e=r.trim();e&&(t[n]=e)}else null!=r&&(t[n]=r);return t}(e.roleParams);return{id:s[t],kind:e.kind,...e.roleId?{role:{roleId:e.roleId,...Object.keys(n).length?{params:n}:{}}}:{},...e.runtimeOverridden?{engine:e.engine,...e.model.trim()?{model:e.model.trim()}:{},...e.effort?{effort:e.effort}:{}}:{},..."review-loop"===e.kind?{}:{access:e.access},prompt:e.prompt,next:s[t+1]??null}})):[{id:"implement",kind:"run",role:{roleId:"builder"},prompt:"{{task}}",next:null}],...r?{src:r}:{},autoStart:!1}):{error:(0,eh.Tl)((0,eh.JK)(),"common.serverUnavailable")}}function xQ(e,t,n,r){let i=xc(e,t.id);return!!i&&(!!(i.agentPath&&n.has(i.agentPath))||"review-loop"===t.kind&&!!(i.flowId&&r.has(i.flowId)))}let xX=new Set(["passed","failed","needs_decision","skipped"]);function xZ(e,t){if(!t.onFail)return 0;let n=e.runs.find(e=>e.stageId===t.onFail.to);return n?n.attempts.filter(e=>!e.historical&&e.activatedBy?.edge==="fail"&&e.activatedBy.stageId===t.id).length:0}let x0=new Set(["start","retry-stage","skip-stage","resume","pause","close"]),x1={roleId:null,engine:"claude",model:"",effort:"",promptScaffold:null};function x2(e){let t=new Set(e.map(e=>e.id));return e.map(e=>({...e,next:null!=e.next&&e.next!==e.id&&t.has(e.next)?e.next:null,onFail:e.onFail&&t.has(e.onFail.to)?e.onFail:null}))}async function x5(e,t,n,r,i){return x4(e.id,"set-edge",{stageId:t,edge:n,to:r,...void 0!==i?{maxRounds:i}:{}},{...e,stages:e.stages.map(e=>e.id!==t?e:"pass"===n?{...e,next:r}:{...e,onFail:null===r?null:{to:r,maxRounds:i??5}})})}async function x4(e,t,n,r){r&&rw(r,!1);try{let i=await fetch(`/api/pipelines/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({action:t,...n})}),a=await i.json().catch(()=>null);if(i.ok)return a?.pipeline?rw(a.pipeline,!0):r&&ry(e),x0.has(t)&&window.dispatchEvent(new Event(ng)),null;return r&&ry(e),a?.error??(0,eh.Tl)((0,eh.JK)(),"pipelineModel.failed",{status:i.status})}catch{return r&&ry(e),(0,eh.Tl)((0,eh.JK)(),"common.serverUnavailable")}}let x3={dim:"var(--color-strong)",active:"var(--color-accent)",ok:"var(--color-success)",amber:"var(--color-warning)"};function x6(e){return"deck::"+e}function x8(e,t){return`slot::${e}::${t}`}function x7(e){switch(e){case"reviewing":return"awaiting_verdict";case"spawning":case"relaying":case"fixing":return"running";case"spawn_pending":case"relay_pending":case"needs_decision":case"done_comment":return"attention";case"paused":return"paused";case"approved":case"closed":return"done";case"waiting_ready":return"waiting"}}function x9(e){return e.rounds.at(-1)??null}function ge(e,t,n){let r=new Map;for(let e of n)for(let t of e.paths)r.set(t,e.key);for(let e of t)for(let t of(r.set(e.key,e.key),e.flow.rounds))t.reviewerPath&&r.set(t.reviewerPath,e.key);for(let t of e)r.set(t,t);return r}function gt(e){let t=0;for(let n=0;n<e.length;n+=1)t=(31*t+e.charCodeAt(n))%360;return(t%360+360)%360}let gn=new Set(["provisioning","running"]);function gr(e){return!!gn.has(e.state)||"paused"===e.state&&null!==e.pausedState&&gn.has(e.pausedState)}function gi(e,t){let n=xc(e,t);return n?.state==="passed"||n?.state==="skipped"?"ok":n?.state==="failed"||n?.state==="needs_decision"?"amber":e.cursor?.stageId===t&&gr(e)?"active":"dim"}let ga={authenticated:"accounts.auth.authenticated",signed_out:"accounts.auth.signedOut",unknown:"accounts.auth.unknown",error:"accounts.auth.error"},gs={claude:"Claude",codex:"Codex"};function gl(e){return e?[e.intentId,e.revision??"",e.phase,e.targetAccountId,e.failure??""].join("\0"):null}function go({engine:e,accountId:t,file:n,runtimeSession:r}){var i,a,s,l,o;let c,d,{t:u}=(0,eh.Ym)(),p=ia(),m=xl(e),[f,h]=(0,Y.useState)(!1),[x,g]=(0,Y.useState)(!1),[b,v]=(0,Y.useState)(null),w=(0,Y.useRef)(null),y=(0,Y.useRef)(null),k=(0,Y.useRef)(null),j=(0,Y.useRef)(null),N=(0,Y.useRef)(null),S=(d=gt(t),{dot:`color-mix(in srgb, hsl(${d} 60% 50%) 85%, var(--color-card))`,circleBg:`color-mix(in srgb, hsl(${d} 62% 50%) 20%, var(--color-card))`}),C=(i=m.accounts.find(e=>e.id===t))?i.authHealth??(i.authPresent?"unknown":"signed_out"):null,A=(a=u,s=t,l=e,o=C,c=gs[l],o?a("branch.accountTip",{id:s,engine:c,health:a(ga[o])}):a("branch.accountTipPlain",{id:s,engine:c})),I=u("branch.accountAria",{id:t});(0,Y.useEffect)(()=>{let e=k.current;if(!e)return;let t=r?.recentReceipts.find(t=>t.operationId===e&&"reconfigure"===t.kind);t&&("applied"===t.status?(k.current=null,j.current=null,N.current=null,g(!1),oC("ok",u("accounts.conversationApplied"))):("failed"===t.status||"rejected"===t.status)&&(k.current=null,j.current=null,N.current=null,g(!1),oC("err",t.reason??u("accounts.switchFailed"))))},[r,u]),(0,Y.useEffect)(()=>{x&&j.current===t&&(j.current=null,k.current=null,N.current=null,g(!1),oC("ok",u("accounts.conversationApplied")))},[t,x,u]),(0,Y.useEffect)(()=>{if(!x)return;let e=window.setTimeout(()=>{k.current=null,j.current=null,N.current=null,g(!1),oC("err",u("accounts.conversationUnconfirmed"))},6e4);return()=>window.clearTimeout(e)},[x,u]),(0,Y.useEffect)(()=>{if(!f)return;let e=e=>{let t=e.target;w.current?.contains(t)||y.current?.contains(t)||h(!1)};return document.addEventListener("pointerdown",e),()=>document.removeEventListener("pointerdown",e)},[f]),(0,Y.useEffect)(()=>{let e=n?.migration,t=j.current;x&&!k.current&&e?.failure&&e.targetAccountId===t&&gl(e)!==N.current&&(j.current=null,N.current=null,g(!1),oC("err",e.failure))},[n?.migration,x]);let M=async i=>{if(n&&i!==t&&!x){g(!0),h(!1),j.current=i,N.current=gl(n.migration);try{let t=oF(n),a=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"reconfigure",path:n.path,conversationId:r?.conversationId??n.conversationId,accountId:i,model:t.model,effort:t.effort,fast:"codex"===e?t.fast:void 0})}),s=await a.json();if(!a.ok||!s.ok)throw Error(s.error??u("accounts.switchFailed"));j.current===i&&(k.current=s.operationId??s.receipt?.operationId??null)}catch(e){j.current=null,N.current=null,g(!1),oC("err",e instanceof Error?e.message:u("accounts.switchFailed"))}}},T=(0,U.jsx)("button",{type:"button",onClick:()=>n?(()=>{if(!f){let e=w.current?.getBoundingClientRect();v(e?{top:e.bottom+4,right:Math.max(8,window.innerWidth-e.right)}:{top:8,right:8})}h(e=>!e)})():em(e,t),"aria-label":I,"aria-haspopup":n?"menu":void 0,"aria-expanded":n?f:void 0,"aria-busy":x||void 0,"data-conversation-account-chip":!0,className:p?"inline-flex h-11 w-11 shrink-0 items-center justify-center rounded-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40":"inline-flex shrink-0 items-center gap-1 rounded-full border border-border/80 px-1.5 py-0.5 font-mono text-[9.5px] text-muted hover:border-accent/45 hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:p?(0,U.jsx)("span",{className:"flex h-5 w-5 items-center justify-center rounded-full font-mono text-[10px] font-bold uppercase",style:{backgroundColor:S.circleBg,color:S.dot},"aria-hidden":!0,children:x?(0,U.jsx)(sx.kr,{className:"h-3 w-3 animate-spin"}):t.charAt(0)}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full",style:{backgroundColor:S.dot},"aria-hidden":!0}),(0,U.jsxs)("span",{children:["@ ",function(e,t=14){return e.length>t?`${e.slice(0,t-1)}…`:e}(t)]}),x?(0,U.jsx)(sx.kr,{className:"h-2.5 w-2.5 animate-spin","aria-hidden":!0}):n?(0,U.jsx)(sx.yQ,{className:"h-2.5 w-2.5","aria-hidden":!0}):null]})}),P=f&&n&&b?(0,nx.createPortal)((0,U.jsxs)("div",{ref:y,role:"menu","data-conversation-account-menu":!0,onPointerDown:e=>e.stopPropagation(),style:{top:b.top,right:b.right},className:"fixed z-[95] min-w-52 rounded-surface border border-border bg-raised p-1.5 font-sans text-ui shadow-2",children:[(0,U.jsx)("div",{className:"px-2 py-1 text-[10px] font-semibold uppercase tracking-wide text-muted",children:u("accounts.conversationTitle")}),m.accounts.map(e=>{let n=e.authPresent&&!e.loginPending;return(0,U.jsxs)("button",{type:"button",role:"menuitemradio","aria-checked":e.id===t,disabled:!n||x,onClick:()=>void M(e.id),className:"flex min-h-9 w-full items-center gap-2 rounded-control px-2 py-1.5 text-left hover:bg-sunken disabled:opacity-45",children:[(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate",children:e.label}),e.id===t?(0,U.jsx)(sx.Jl,{className:"h-3.5 w-3.5 text-accent","aria-hidden":!0}):null]},e.id)}),(0,U.jsx)("button",{type:"button",role:"menuitem",onClick:()=>{h(!1),em(e,t)},className:"mt-1 w-full border-t border-border px-2 pt-2 text-left text-[11px] font-semibold text-accent",children:u("accounts.manage")})]}),document.body):null;return(0,U.jsxs)("span",{ref:w,className:"relative inline-flex",onPointerDown:e=>e.stopPropagation(),children:[(0,U.jsx)(ly,{label:A,children:T}),P,x?(0,U.jsx)("span",{className:"sr-only",role:"status",children:u("accounts.conversationPending")}):null]})}let gc="var(--color-info)",gd=new Map;function gu(){for(let e of document.querySelectorAll("[data-link-hover]"))e.removeAttribute("data-link-hover")}function gp(e,t,n,r){let i=Math.max(48,.45*Math.abs(n-e));return`M ${e} ${t} C ${e+i} ${t}, ${n-i} ${r}, ${n} ${r}`}function gm(e){let[t,n]=(0,Y.useState)(!1),r=(0,Y.useRef)(e);(0,Y.useEffect)(()=>{r.current=e},[e]);let[i,a]=(0,Y.useState)(null),[s,l]=(0,Y.useState)(null),o=(0,Y.useRef)(null),c=(0,Y.useRef)(!1),d=(0,Y.useRef)(!1),u=(0,Y.useRef)(null),p="link-arrow-"+(0,Y.useId)().replace(/[^a-zA-Z0-9-]/g,"");return(0,Y.useEffect)(()=>()=>{o.current?.detach(),o.current=null,document.body.style.cursor="",gu()},[]),(0,Y.useEffect)(()=>{if(!s)return;let e=window.setTimeout(()=>{gu(),l(null)},1600);return()=>window.clearTimeout(e)},[s]),{onPillPointerDown:e=>{if("mouse"===e.pointerType&&0!==e.button||o.current)return;let t=e.currentTarget.getBoundingClientRect(),i=e=>{let t=o.current;if(!t)return;if(t.lastX=e.clientX,t.lastY=e.clientY,!t.active){if(7>Math.hypot(e.clientX-t.startX,e.clientY-t.startY))return;t.active=!0,c.current=!0,d.current=!0,document.body.style.cursor="crosshair",gu(),l(null),a({x:t.anchorX,y:t.anchorY}),n(!0),r.current.onDragStart?.()}u.current?.setAttribute("d",gp(t.anchorX,t.anchorY,e.clientX,e.clientY));let i=function(e,t,n){let r=document.elementFromPoint(e,t)?.closest("[data-link-path]"),i=r?.getAttribute("data-link-path");if(!r||!i||i===n)return null;let a=gd.get(i);return a&&a.el===r?a:null}(e.clientX,e.clientY,r.current.exclude??null);i?.el!==t.hover?.el&&(t.hover?.el.removeAttribute("data-link-hover"),i?.el.setAttribute("data-link-hover","1"),t.hover=i)},s=e=>{let t=o.current;if(o.current=null,t?.detach(),c.current=!1,document.body.style.cursor="",t?.active)if(n(!1),t.hover){let n=r.current.onDrop(t.hover,{x:e.clientX,y:e.clientY});null!==n?l({label:n,from:{x:t.anchorX,y:t.anchorY},to:{x:e.clientX,y:e.clientY}}):gu()}else gu(),r.current.onMiss?.({x:e.clientX,y:e.clientY})};o.current={startX:e.clientX,startY:e.clientY,anchorX:t.right,anchorY:t.top+t.height/2,lastX:e.clientX,lastY:e.clientY,active:!1,hover:null,detach:()=>{window.removeEventListener("pointermove",i),window.removeEventListener("pointerup",s),window.removeEventListener("pointercancel",s)}},window.addEventListener("pointermove",i),window.addEventListener("pointerup",s),window.addEventListener("pointercancel",s)},consumeClick:()=>{let e=d.current;return d.current=!1,e},draggingRef:c,overlay:t||s?(0,nx.createPortal)((0,U.jsxs)("div",{className:"pointer-events-none fixed inset-0 z-[95]",children:[(0,U.jsxs)("svg",{className:"block h-full w-full",children:[(0,U.jsx)("defs",{children:(0,U.jsx)("marker",{id:p,markerWidth:"9",markerHeight:"9",refX:"7",refY:"4.5",orient:"auto",children:(0,U.jsx)("path",{d:"M0,0 L8,4.5 L0,9 Z",fill:gc})})}),(0,U.jsx)("path",{ref:e=>{u.current=e;let t=o.current;e&&t?.active&&e.setAttribute("d",gp(t.anchorX,t.anchorY,t.lastX,t.lastY))},d:s?gp(s.from.x,s.from.y,s.to.x,s.to.y):void 0,fill:"none",stroke:gc,strokeWidth:2.5,strokeLinecap:"round",markerEnd:`url(#${p})`}),(0,U.jsx)("circle",{cx:s?s.from.x:i?.x??0,cy:s?s.from.y:i?.y??0,r:4,fill:gc})]}),s?(0,U.jsx)(gf,{drop:s}):null]}),document.body):null}}function gf({drop:e}){let t=Math.max(8,Math.min(e.to.x+14,window.innerWidth-288)),n=Math.max(8,Math.min(e.to.y+12,window.innerHeight-44));return(0,U.jsxs)("div",{className:"fixed flex max-w-[280px] items-center gap-1.5 rounded-full px-3 py-1.5 text-[11.5px] font-semibold text-white shadow-1",style:{left:t,top:n,backgroundColor:gc},children:[(0,U.jsx)(fa.A,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),(0,U.jsx)("span",{className:"truncate",children:e.label})]})}let gh={"needs-you":"card-status-attention border-warning/50 bg-warning-soft text-warning",held:"border-accent/45 bg-accent-soft text-accent",running:"border-success/45 bg-success-soft text-success",queued:"border-border bg-canvas text-muted"};function gx({file:e,fontClassName:t="text-caption"}){let{t:n}=(0,eh.Ym)(),r=function(e,t=Date.now()){if(null!==eH(e,t/1e3))return{kind:"needs-you"};let n=lu(e.migration,ll(e.path)),r=n?.heldDeliveries??0;if(r>0)return{kind:"held",count:r};if(ua(e)){let n=e.lastTurn&&null===e.lastTurn.endedAt?e.lastTurn.startedAt:null;return{kind:"running",elapsedSeconds:null===n?null:Math.max(0,(t-n)/1e3)}}return e.pendingWakeup&&e.pendingWakeup.fireAt>t?{kind:"queued"}:null}(e);if(!r)return null;let{word:i,detail:a}="needs-you"===r.kind?{word:n("cardStatus.needsYou"),detail:null}:"held"===r.kind?{word:n("cardStatus.held"),detail:`\xd7${r.count}`}:"running"===r.kind?{word:n("cardStatus.running"),detail:null===r.elapsedSeconds?null:ui(r.elapsedSeconds)}:{word:n("cardStatus.queued"),detail:null},s=a?`${i} ${a}`:i;return(0,U.jsxs)("span",{"data-card-status":r.kind,title:s,className:`inline-flex min-w-0 shrink-0 items-center gap-[0.35em] rounded-full border px-[0.6em] py-[0.15em] font-bold ${t} ${gh[r.kind]}`,children:[(0,U.jsx)("span",{className:"truncate uppercase tracking-wide",children:i}),a?(0,U.jsx)("span",{className:"shrink-0 tabular-nums opacity-90",children:a}):null]})}function gg({file:e,onDeleted:t}){let{t:n}=(0,eh.Ym)(),r=ia(),[i,a]=(0,Y.useState)(!1),[s,l]=(0,Y.useState)(!1),[o,c]=(0,Y.useState)("");if((0,Y.useEffect)(()=>{if(!i)return;let e=window.setTimeout(()=>a(!1),5e3);return()=>window.clearTimeout(e)},[i]),"running"===e.proc)return null;let d=async()=>{l(!0),c("");try{let r=await fetch(`/api/log?path=${encodeURIComponent(e.path)}`,{method:"DELETE"}),i=await r.json();if(!r.ok||!i.ok)return void c(i.error??n("common.failedDelete"));a(!1),t?.()}catch{c(n("common.serverUnavailable"))}finally{l(!1)}};return i?(0,U.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-[10px] border border-danger/30 bg-danger-soft px-1.5 py-0.5 text-[11px]",children:[(0,U.jsx)("span",{className:"px-0.5 font-semibold text-danger",children:n("delFile.confirm")}),(0,U.jsx)("button",{type:"button",className:`inline-flex items-center rounded-lg bg-danger font-bold text-white disabled:opacity-60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-danger/50 ${r?"min-h-11 px-3":"px-2 py-0.5"}`,disabled:s,onClick:d,children:s?"…":n("common.yes")}),(0,U.jsx)("button",{type:"button",className:`inline-flex items-center rounded-lg border border-border bg-card font-semibold text-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${r?"min-h-11 px-3":"px-2 py-0.5"}`,onClick:()=>a(!1),children:n("common.no")})]}):(0,U.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1",children:[(0,U.jsx)("button",{type:"button",className:`inline-flex items-center justify-center rounded-[8px] border border-border bg-canvas text-muted hover:border-danger/40 hover:text-danger focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${r?"h-11 w-11":"px-1.5 py-0.5"}`,"aria-label":n("delFile.aria"),title:n("delFile.aria"),onClick:()=>a(!0),children:(0,U.jsx)(sx.TB,{className:r?"h-4 w-4":"h-3 w-3","aria-hidden":!0})}),o?(0,U.jsx)("span",{className:"max-w-[160px] truncate text-[10.5px] font-semibold text-danger",title:o,children:o}):null]})}let gb=new Set,gv=-1/0,gw=-1/0,gy=0,gk=!1;function gj(){for(let e of(gy=0,gb)){let t=function(e,t,n,r){let i=Math.max(e.left-t,0,t-e.right),a=Math.max(e.top-n,0,n-e.bottom);return i*i+a*a<=r*r}(e.el.getBoundingClientRect(),gv,gw,e.radius);t!==e.near&&(e.near=t,e.notify(t))}}function gN(e){gv=e.clientX,gw=e.clientY,0===gy&&(gy=requestAnimationFrame(gj))}function gS({id:e,cardRef:t,touch:n=!1}){let r=hJ(),{t:i}=(0,eh.Ym)(),a=r?.has(e)??!1,s=function(e,t=!0){let[n,r]=(0,Y.useState)(!1);return(0,Y.useEffect)(()=>{let n=t?e.current:null;if(!n)return void r(!1);let i={el:n,radius:88,near:!1,notify:r};return gb.add(i),gk||(gk=!0,window.addEventListener("pointermove",gN,{passive:!0})),()=>{gb.delete(i),!(gb.size>0)&&gk&&(gk=!1,window.removeEventListener("pointermove",gN),0!==gy&&(cancelAnimationFrame(gy),gy=0))}},[e,88,t]),n}(t,!n&&!a);if(!r||a&&!n)return null;let l=a||n||s,o=i(a?"branch.unfavorite":"branch.favorite");return(0,U.jsx)("button",{type:"button","data-scheme-ui":!0,"data-favorite-crown":a?"on":"off","data-crown-hidden":l?void 0:"true","aria-pressed":a,"aria-label":o,title:o,onClick:t=>{t.stopPropagation(),r.toggle(e)},className:`favorite-crown group/crown inline-flex shrink-0 items-center justify-center rounded-[8px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${n?"h-11 w-11":"h-6 w-6"} ${l?"opacity-100":"pointer-events-none opacity-0"} ${a?"is-favorite":""}`,children:(0,U.jsx)(B.A,{"aria-hidden":!0,className:`${n?"h-5 w-5":"h-4 w-4"} transition-[color,fill,filter,transform] duration-200 ${a?"fill-crown text-crown drop-shadow-[0_0_5px_color-mix(in_srgb,var(--color-crown)_65%,transparent)]":"text-muted [stroke-dasharray:2_3] group-hover/crown:fill-crown group-hover/crown:text-crown group-hover/crown:[stroke-dasharray:0]"}`})})}function gC({id:e,touch:t=!1}){let n=hJ(),{t:r}=(0,eh.Ym)();if(t||!n?.has(e))return null;let i=r("branch.unfavorite");return(0,U.jsx)("button",{type:"button","data-scheme-ui":!0,"data-favorite-marker":"on","aria-pressed":!0,"aria-label":i,title:i,onClick:t=>{t.stopPropagation(),n.toggle(e)},className:"favorite-crown-marker absolute -top-2.5 right-3 z-[3] inline-flex h-6 w-6 items-center justify-center rounded-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:(0,U.jsx)(B.A,{className:"h-4 w-4 fill-crown text-crown drop-shadow-[0_1px_2px_color-mix(in_srgb,var(--color-crown)_55%,transparent)]","aria-hidden":!0})})}function gA({predecessorLabel:e}){let{t}=(0,eh.Ym)();return e?(0,U.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5 border-b border-border bg-sunken px-2.5 py-1 text-[10.5px] font-semibold text-muted",children:[(0,U.jsx)("span",{"aria-hidden":!0,children:"⇄"}),(0,U.jsx)("span",{className:"min-w-0 truncate",children:t("migrate.divider",{label:e})})]}):null}let gI={pending:"border-warning/45 bg-warning-soft text-warning",switching:"border-accent/35 bg-accent/5 text-accent",failed:"border-danger/40 bg-danger-soft text-danger"};function gM({state:e,targetLabel:t,currentLabel:n,error:r,actionError:i,onRetry:a,onKeep:s}){let{t:l}=(0,eh.Ym)();return"pending"!==e&&"switching"!==e&&"failed"!==e?null:(0,U.jsxs)("div",{role:"status","aria-label":l("migrate.ribbonAria"),className:`flex shrink-0 flex-wrap items-center gap-x-2 gap-y-1 border-b px-2.5 py-1 text-[11px] font-semibold ${gI[e]}`,children:["pending"===e?(0,U.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[(0,U.jsx)(i4.A,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),(0,U.jsx)("span",{className:"min-w-0 truncate",children:l("migrate.cardPending")})]}):null,"switching"===e?(0,U.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[(0,U.jsx)(dR.A,{className:"h-3 w-3 shrink-0 animate-spin motion-reduce:animate-none","aria-hidden":!0}),(0,U.jsx)("span",{className:"min-w-0 truncate",children:t.trim()?l("migrate.cardSwitching",{label:t}):l("migrate.cardSwitchingUnnamed")})]}):null,"failed"===e?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[(0,U.jsx)(i4.A,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),(0,U.jsxs)("span",{className:"min-w-0 truncate",title:r??void 0,children:[l("migrate.cardFailed"),r?` — ${r}`:""]})]}),(0,U.jsxs)("span",{className:"ml-auto flex shrink-0 items-center gap-1.5",children:[a?(0,U.jsxs)("button",{type:"button",onClick:a,className:"inline-flex items-center gap-1 rounded-[7px] border border-border bg-canvas px-2 py-0.5 text-[11px] font-semibold text-primary hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:[(0,U.jsx)(sg.A,{className:"h-3 w-3","aria-hidden":!0})," ",l("migrate.cardRetry")]}):null,s&&n?(0,U.jsx)("button",{type:"button",onClick:s,className:"inline-flex items-center rounded-[7px] border border-border bg-canvas px-2 py-0.5 text-[11px] font-semibold text-primary hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:l("migrate.cardKeep",{label:n})}):null]})]}):null,i?(0,U.jsx)("span",{role:"alert","aria-live":"assertive",className:"w-full text-[10.5px] font-semibold text-danger",title:i,children:l("migrate.recoveryFailed",{detail:i})}):null]})}function gT({file:e}){let{level:t,slots:n}=(0,tw.IR)(e);if(!t)return null;let{color:r}=(0,tw.oC)(e),i=(0,tw.$)(e);return(0,U.jsx)("span",{"data-effort-pills":!0,className:"reasoning-slot inline-flex h-[12px] shrink-0 items-end gap-px",role:"img","aria-label":i,title:i,children:Array.from({length:n},(e,n)=>(0,U.jsx)("span",{"aria-hidden":!0,className:"shrink-0 rounded-full",style:{width:"3px",height:`${7+n}px`,backgroundColor:n<t?r:"var(--color-border)"}},n))})}var gP=n(5097),g$=n(467);function gE({t:e,sinceLabel:t,onOpenSuccessor:n,onResumeHere:r,resumeBusy:i=!1,resumeError:a=null}){return(0,U.jsxs)("div",{role:"status","aria-live":"polite","data-superseded-banner":!0,className:"flex shrink-0 flex-col gap-1.5 border-b border-border bg-sunken px-2.5 py-2",children:[(0,U.jsxs)("div",{className:"flex items-center gap-1.5 text-label font-bold text-secondary",children:[(0,U.jsx)(gP.A,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),(0,U.jsx)("span",{className:"min-w-0 truncate",children:e("superseded.title",{since:t})})]}),(0,U.jsx)("p",{className:"text-caption font-semibold text-muted",children:e("superseded.body")}),(0,U.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,U.jsxs)("button",{type:"button",onClick:n,className:"inline-flex min-h-11 items-center gap-1 rounded-control border border-accent bg-accent px-2.5 text-label font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 sm:min-h-8",children:[e("superseded.open")," ",(0,U.jsx)(g$.A,{className:"h-3.5 w-3.5","aria-hidden":!0})]}),(0,U.jsxs)("button",{type:"button",onClick:r,disabled:i,className:"inline-flex min-h-11 items-center gap-1 rounded-control border border-border bg-canvas px-2.5 text-label font-semibold text-muted hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60 sm:min-h-8",children:[i?(0,U.jsx)(sx.kr,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):(0,U.jsx)(sx.jG,{className:"h-3.5 w-3.5","aria-hidden":!0}),e("superseded.resumeHere")]})]}),a?(0,U.jsx)("p",{role:"alert",className:"text-caption font-semibold text-danger",children:a}):null]})}function gR({file:e}){let{t}=(0,eh.Ym)(),[n,r]=(0,Y.useState)(!1),[i,a]=(0,Y.useState)(null),s=e.supersededBy;if(!s)return null;let l=Date.parse(s.at)/1e3,o=(0,tw.rK)(Number.isFinite(l)?l:e.mtime),c=async()=>{if(!n&&window.confirm(t("superseded.resumeConfirm"))){r(!0),a(null);try{let n=await fetch("/api/session/supersedence",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({conversationId:e.conversationId,action:"clear"})});if(!n.ok){let e=await n.json().catch(()=>({}));a(e.error??t("superseded.resumeFailed"))}}catch{a(t("superseded.resumeFailed"))}finally{r(!1)}}};return(0,U.jsx)(gE,{t:t,sinceLabel:o,onOpenSuccessor:()=>{window.location.hash="#c="+encodeURIComponent(s.tailConversationId??s.conversationId)},onResumeHere:()=>void c(),resumeBusy:n,resumeError:i})}function gO({className:e,style:t,enter:n="scale",children:r}){let i=(0,Y.useRef)(null);return!function(e,t="scale"){let n=(0,Y.useRef)(new Map),r=(0,Y.useRef)(new WeakMap),i=(0,Y.useRef)(!0);(0,Y.useLayoutEffect)(()=>{let a=e.current;if(!a)return;let s="u">typeof matchMedia&&matchMedia("(prefers-reduced-motion: reduce)").matches,l=a.getBoundingClientRect(),o=[...a.children].filter(e=>e instanceof HTMLElement&&void 0!==e.dataset.flipKey),c=new Map;for(let e of o){let o=e.dataset.flipKey,d=e.getBoundingClientRect(),u=r.current.get(e);u&&(u.cancel(),r.current.delete(e));let p=e.getBoundingClientRect(),m={x:p.left-l.left+a.scrollLeft,y:p.top-l.top+a.scrollTop},f=n.current.get(o);if(c.set(o,m),s||i.current||void 0!==e.dataset.flipSkip)continue;if(!f){if("none"===t)continue;let n="fade"===t?[{opacity:0},{opacity:1}]:[{opacity:0,transform:"scale(0.96)"},{opacity:1,transform:"scale(1)"}],i=e.animate(n,{duration:"fade"===t?120:240,easing:"ease-out"});r.current.set(e,i),i.addEventListener("finish",()=>r.current.delete(e));continue}let h=f.x-m.x+(d.left-p.left),x=f.y-m.y+(d.top-p.top);if(2>Math.abs(h)&&2>Math.abs(x))continue;let g=e.animate([{transform:`translate(${h}px, ${x}px)`},{transform:"translate(0px, 0px)"}],{duration:280,easing:"cubic-bezier(0.22, 0.72, 0.3, 1)"});r.current.set(e,g),g.addEventListener("finish",()=>r.current.delete(e))}n.current=c,i.current=!1})}(i,n),(0,U.jsx)("div",{ref:i,className:e,style:t,children:r})}let gD=()=>"uk"===(0,eh.JK)()?"uk-UA":"en-US",gL={completed:"✓",in_progress:"▸",pending:"○"};function g_({plan:e}){let t,{t:n}=(0,eh.Ym)(),r=e.total?Math.round(e.done/e.total*100):0;return(0,U.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-full bg-accent-soft px-1.5 py-0.5 font-mono text-[9.5px] font-semibold text-accent",title:(t=e.steps.map(e=>`${gL[e.status]} ${e.text}`),[(0,eh.Tl)((0,eh.JK)(),"plan.agentPlan"),...t].join("\n")),"aria-label":n("plan.stepsAria",{done:e.done,total:e.total})+(e.current?n("plan.nowSuffix",{current:e.current}):""),children:[e.done,"/",e.total,(0,U.jsx)("span",{className:"h-1 w-6 overflow-hidden rounded-full bg-accent/20","aria-hidden":!0,children:(0,U.jsx)("span",{className:"block h-full rounded-full bg-accent",style:{width:`${r}%`}})})]})}let gF={active:{labelKey:"plan.goal",tone:"accent"},complete:{labelKey:"plan.goalDone",tone:"success"},blocked:{labelKey:"plan.goalBlocked",tone:"danger"}};function gq(e){if(e>=1e6){let t=e/1e6;return`${Number.isInteger(t)||t>=10?Math.round(t):Math.round(10*t)/10}M`}return e>=1e3?`${Math.round(e/1e3)}K`:`${e}`}function gz({ctx:e}){var t;let n,r,{t:i}=(0,eh.Ym)(),a=e.usedTokens.toLocaleString(gD());if(null!==e.windowTokens&&null!==e.pct){let t="registry"===e.source?i("plan.ctxSourceRegistry",{version:e.registryVersion??"?"}):i("plan.ctxSourceRuntime");n=`${i("plan.ctxTitle",{pct:e.pct,used:a,window:e.windowTokens.toLocaleString(gD())})}
|
|
72
|
-
${t}`,r=i("plan.ctxAria",{pct:e.pct})}else n=i("plan.ctxTitleUnknown",{used:a}),r=i("plan.ctxAriaUnknown",{used:a});return(0,U.jsxs)(sv,{tone:null===(t=e.pct)?"neutral":t>=90?"danger":t>=70?"warning":"neutral",title:n,"aria-label":r,children:[null===e.pct?null:(0,U.jsxs)("span",{className:"font-bold",children:[e.pct,"%"]}),"ctx ",gq(e.usedTokens),null===e.windowTokens?null:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("span",{className:"opacity-50",children:"/"}),gq(e.windowTokens)]})]})}function gH({goal:e}){let t,n,{t:r}=(0,eh.Ym)(),i=gF[e.status];return(0,U.jsx)(sv,{tone:i.tone,title:(t=(0,eh.JK)(),n=[e.objective??(0,eh.Tl)(t,"plan.noObjective")],null!==e.tokensUsed&&n.push((0,eh.Tl)(t,"plan.tokens",{n:e.tokensUsed.toLocaleString(gD())})),null!==e.timeUsedSeconds&&n.push((0,eh.Tl)(t,"plan.time",{n:Math.round(e.timeUsedSeconds/60)})),n.join("\n")),"aria-label":r("plan.goalAria",{status:r(i.labelKey)})+(e.objective?` — ${e.objective.slice(0,120)}`:""),children:r(i.labelKey)})}function gU(e,t){return e.path===t.path||null!=e.conversationId&&null!=t.conversationId&&e.conversationId===t.conversationId}function gB({file:e,displayMax:t=90,titleClassName:n="",className:r="",alwaysVisible:i=!1,autoEditToken:a}){let{t:s}=(0,eh.Ym)(),l=ia(),[o,c]=(0,Y.useState)(!1),[d,u]=(0,Y.useState)(""),[p,m]=(0,Y.useState)(null),[f,h]=(0,Y.useState)(!1),[x,g]=(0,Y.useState)(""),[b,v]=(0,Y.useState)(void 0),w=(0,Y.useRef)(null),y=(0,Y.useRef)(null),k=(0,Y.useRef)(null),j=(0,Y.useRef)(!1),N=(0,Y.useRef)(!1),[S,C]=(0,Y.useState)({path:e.path,conversationId:e.conversationId});if(S.path!==e.path||S.conversationId!==e.conversationId){let t=!gU(S,e);C({path:e.path,conversationId:e.conversationId}),t&&(c(!1),u(""),m(null),h(!1),g(""),v(void 0))}let A=(0,Y.useRef)({path:e.path,conversationId:e.conversationId});(0,Y.useEffect)(()=>{A.current={path:e.path,conversationId:e.conversationId}});let I=null!==p&&(void 0!==e.titleRevision?e.titleRevision>=p.revision:null===p.title)?null:p,M=e.autoTitle??e.title,T=I?null!==I.title:void 0!==e.autoTitle,P=I?I.title??M:e.title,$=I?I.revision:e.titleRevision??0;(0,Y.useEffect)(()=>{if(o){let e=w.current;e&&(e.focus(),e.select())}else N.current&&(N.current=!1,y.current?.focus())},[o]);let E=()=>{f||(j.current=!1,u(P),v(void 0),c(!0))},R=(0,Y.useRef)(E);(0,Y.useEffect)(()=>{R.current=E}),(0,Y.useEffect)(()=>{void 0!==a&&R.current()},[a]);let O=async(t,n)=>{let r={path:e.path,conversationId:e.conversationId};h(!0),v(void 0);let i=t&&t.trim()?t.trim():null,a=await nw({path:e.path,conversationId:e.conversationId,title:i,baseRevision:$,windowName:i??M});if(gU(r,A.current)){if(a.ok){m({title:a.override?.title??null,revision:a.revision}),g(null===i?s("rename.reset"):s("rename.saved",{title:(0,ex.cr)(i,60)})),h(!1);return}if(409===a.status&&n){let t=a.conflict?.revision??0;m(a.conflict?{title:a.conflict.title,revision:a.conflict.revision}:{title:null,revision:0});let n=await nw({path:e.path,conversationId:e.conversationId,title:i,baseRevision:t,windowName:i??M});if(!gU(r,A.current))return;if(n.ok){m({title:n.override?.title??null,revision:n.revision}),g(null===i?s("rename.reset"):s("rename.saved",{title:(0,ex.cr)(i,60)})),h(!1);return}g(s("rename.conflict")),v(i),h(!1);return}g(s("rename.failed")),v(i),h(!1)}},D=e=>{j.current=!0,N.current=!0,c(!1),O(e,!0)},L=()=>{j.current=!0,N.current=!0,c(!1)},_=e=>e.stopPropagation();return o?(0,U.jsxs)("span",{ref:k,className:`inline-flex min-w-0 flex-1 items-center gap-1 ${r}`,onPointerDown:_,onBlur:e=>{if(j.current){j.current=!1;return}let t=e.relatedTarget;if(t&&k.current?.contains(t))return;let n=w.current?.value??d;c(!1),O(n,!0)},children:[(0,U.jsx)("input",{ref:w,type:"text",value:d,maxLength:120,className:"min-w-0 flex-1 rounded-[6px] border border-accent/50 bg-canvas px-1.5 py-0.5 text-[12px] font-semibold text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":s("rename.inputAria"),onChange:e=>u(e.target.value),onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),D(e.currentTarget.value)):"Escape"===e.key&&(e.preventDefault(),L())}}),(0,U.jsx)("button",{type:"button",className:`inline-flex shrink-0 items-center justify-center rounded-[6px] border border-border bg-canvas text-muted hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${l?"h-11 w-11":"px-1 py-0.5"}`,"aria-label":s("rename.save"),title:s("rename.save"),onClick:()=>D(w.current?.value??d),children:(0,U.jsx)(sx.Jl,{className:l?"h-4 w-4":"h-3 w-3","aria-hidden":!0})}),T?(0,U.jsx)("button",{type:"button",className:`inline-flex shrink-0 items-center justify-center rounded-[6px] border border-border bg-canvas text-muted hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${l?"h-11 w-11":"px-1 py-0.5"}`,"aria-label":s("rename.reset"),title:s("rename.resetHint",{title:(0,ex.cr)(M,60)}),onClick:()=>D(null),children:(0,U.jsx)(sx.kt,{className:l?"h-4 w-4":"h-3 w-3","aria-hidden":!0})}):null,(0,U.jsx)("button",{type:"button",className:`inline-flex shrink-0 items-center justify-center rounded-[6px] border border-border bg-canvas text-muted hover:border-danger/40 hover:text-danger focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${l?"h-11 w-11":"px-1 py-0.5"}`,"aria-label":s("rename.cancel"),title:s("rename.cancel"),onClick:L,children:(0,U.jsx)(sx.X,{className:l?"h-4 w-4":"h-3 w-3","aria-hidden":!0})}),(0,U.jsx)("span",{className:"sr-only",role:"status","aria-live":"polite",children:x})]}):(0,U.jsxs)("span",{className:`group/title inline-flex min-w-0 flex-1 items-center gap-1 ${r}`,children:[(0,U.jsx)("span",{className:`min-w-0 flex-1 truncate ${n}`,title:T?s("rename.autoHint",{title:(0,ex.cr)(M,90)}):(0,ex.cr)(P),tabIndex:0,role:"button","aria-label":s("rename.editAria",{title:(0,ex.cr)(P,60)}),onDoubleClick:E,onKeyDown:e=>{"F2"===e.key&&(e.preventDefault(),E())},children:(0,ex.cr)(P,t)}),(0,U.jsx)("button",{ref:y,type:"button",className:`inline-flex shrink-0 items-center justify-center rounded-[6px] border border-border bg-canvas text-muted hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${i?"h-11 w-11":"px-1 py-0.5 opacity-0 transition-opacity focus-visible:opacity-100 group-hover/title:opacity-100"}`,"aria-label":s("rename.editAria",{title:(0,ex.cr)(P,60)}),title:s("rename.edit"),onPointerDown:_,onClick:E,children:(0,U.jsx)(sx._T,{className:"h-3 w-3","aria-hidden":!0})}),void 0!==b?(0,U.jsx)("button",{type:"button",className:`inline-flex shrink-0 items-center rounded-[6px] border border-danger/40 bg-canvas font-semibold text-danger focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${l?"min-h-11 px-3 text-[12px]":"px-1.5 py-0.5 text-[10px]"}`,onPointerDown:_,onClick:()=>void O(b,!0),children:s("rename.retry")}):null,(0,U.jsx)("span",{className:"sr-only",role:"status","aria-live":"polite",children:x})]})}var gK=n(4914);function gY({rateLimit:e,file:t,shrinkable:n=!1}){let{locale:r,t:i}=(0,eh.Ym)(),[a,s]=(0,Y.useState)("idle"),[l,o]=(0,Y.useState)(null),[c,d]=(0,Y.useState)(null),u=e??t?.rateLimit;if(!u)return null;let p=u.resetAt?i("rateLimit.badgeUntil",{time:eY(u.resetAt,r)}):i("rateLimit.badge"),m=!!(t?.conversationId&&!t.migration),f="pending"===a||"requested"===a,h="already-reseated"===a,x=h?i("rateLimit.reseatAlready"):c??i("requested"===a&&"waiting-turn"===l?"rateLimit.reseatWaitingTurn":"rateLimit.reseatTitle");return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(sv,{tone:"danger","data-rate-limited":"",title:p,shrinkable:n,children:(0,U.jsx)("span",{className:"min-w-0 truncate",children:p})}),m?(0,U.jsxs)("button",{type:"button","data-rate-limit-reseat":"",...h?{"data-rate-limit-reseated":""}:{},disabled:f||h,className:"inline-flex shrink-0 touch-manipulation items-center gap-1 rounded-full border border-danger/40 bg-canvas px-1.5 py-0.5 text-[9.5px] font-bold text-danger hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60",title:x,onClick:async e=>{if(e.stopPropagation(),f||h)return;s("pending"),d(null);let n=await lv(t.conversationId,t.path);n.ok?(s("already-reseated"===n.state?"already-reseated":"requested"),o(n.phase)):(s("failed"),d(n.error))},onKeyDown:e=>e.stopPropagation(),children:[f?(0,U.jsx)(dR.A,{className:"h-2.5 w-2.5 animate-spin motion-reduce:animate-none","aria-hidden":!0}):h?(0,U.jsx)(fv.A,{className:"h-2.5 w-2.5","aria-hidden":!0}):(0,U.jsx)(gK.A,{className:"h-2.5 w-2.5","aria-hidden":!0}),i(h?"rateLimit.reseatAlready":"requested"===a?"rateLimit.reseatRequested":"rateLimit.reseat")]}):null,"failed"===a?(0,U.jsx)("span",{role:"alert","aria-live":"assertive",className:"min-w-0 truncate text-[9.5px] font-semibold text-danger",title:c??void 0,children:c??i("rateLimit.reseatFailed")}):null]})}var gW=n(2879);let gV={inbox:{color:"var(--color-warning)",soft:"var(--color-warning-soft)"},assigned:{color:"var(--color-accent)",soft:"var(--color-accent-soft)"},blocked:{color:"var(--color-danger)",soft:"var(--color-danger-soft)"},done:{color:"var(--color-success)",soft:"var(--color-success-soft)"}},gJ=["inbox","assigned","blocked","done"];function gG(e){return e.split(/\r?\n/,1)[0]?.trim()??""}function gQ({relations:e,onOpenTask:t}){let{t:n}=(0,eh.Ym)();return e.length?(0,U.jsx)("nav",{"data-task-relations":!0,"aria-label":n("tasks.relatedNav"),className:"flex shrink-0 flex-wrap items-center gap-1 border-b border-border bg-sunken/70 px-2 py-1",children:e.map(({task:e,relation:r})=>{let i=gG(e.text)||n("tasks.untitled");return(0,U.jsxs)("button",{type:"button","data-task-relation":e.id,className:"inline-flex min-h-7 min-w-0 max-w-full items-center gap-1.5 rounded-full border border-border bg-card px-2 text-[10.5px] font-semibold text-secondary hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 pointer-coarse:min-h-11 pointer-coarse:px-3","aria-label":n("tasks.openTaskAria",{title:i}),title:`${i} — ${n("assignment"===r?"tasks.relatedAssignedTitle":"tasks.relatedSourceTitle")}`,onClick:()=>t(e),children:[(0,U.jsx)("span",{"aria-hidden":!0,className:"h-2 w-2 shrink-0 rounded-full",style:{backgroundColor:gV[e.status].color}}),"source"===r?(0,U.jsx)(fa.A,{className:"h-3 w-3 shrink-0 text-info","aria-hidden":!0}):(0,U.jsx)(gW.A,{className:"h-3 w-3 shrink-0 text-muted","aria-hidden":!0}),(0,U.jsx)("span",{className:"min-w-0 truncate",children:i})]},`${r}:${e.id}`)})}):null}function gX(e){return e?`wake-${e.fireAt}`:"wake-none"}function gZ({wakeup:e,className:t,interactive:n=!0,shrinkable:r=!1}){let{locale:i,t:a}=(0,eh.Ym)(),[s,l]=(0,Y.useState)(()=>Date.now()),[o,c]=(0,Y.useState)(!1),d=e?.fireAt??0,u=!!e&&d>s;if((0,Y.useEffect)(()=>{if(!u)return;let e=setInterval(()=>l(Date.now()),3e4);return()=>clearInterval(e)},[u]),!e||!u)return null;let p=mA(d,i),m=mI(d-s,a),f=a("wakeup.chipTitle",{time:p,reason:e.reason||a("wakeup.card")}),h=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(sx.qk,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),(0,U.jsx)("span",{className:"min-w-0 truncate",children:m})]}),x=r?"min-w-0 shrink":"shrink-0",g="inline-flex min-w-0 max-w-full items-center gap-1 rounded-full border border-warning/45 bg-warning-soft px-2 py-0.5 text-[10px] font-bold text-warning";return n?(0,U.jsxs)("span",{className:`relative inline-flex ${x} ${t??""}`,children:[(0,U.jsx)("button",{type:"button","data-wakeup":!0,"aria-expanded":o,"aria-label":f,title:f,onClick:e=>{e.stopPropagation(),c(e=>!e)},onKeyDown:e=>e.stopPropagation(),onKeyUp:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),onPointerUp:e=>e.stopPropagation(),onBlur:()=>c(!1),className:`relative ${g} after:absolute after:inset-x-0 after:top-1/2 after:h-11 after:-translate-y-1/2 after:content-[''] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,children:h}),o?(0,U.jsx)("span",{role:"tooltip",className:"absolute left-0 top-full z-20 mt-1 max-w-[240px] whitespace-normal rounded-lg border border-border bg-card px-2.5 py-1.5 text-[11px] font-normal leading-snug text-primary shadow-1",children:f}):null]}):(0,U.jsx)("span",{"data-wakeup":!0,className:`${g} ${x} ${t??""}`,"aria-hidden":!0,children:h})}let g0=()=>void 0,g1={live:{section:"border-success/60 shadow-[0_0_0_3px_color-mix(in_srgb,var(--color-success)_20%,transparent)]",header:"bg-success-soft"},waiting:{section:"border-warning/60 shadow-[0_0_0_3px_color-mix(in_srgb,var(--color-warning)_26%,transparent)]",header:"bg-warning-soft",glow:"var(--color-warning)"},returned:{section:"border-accent/50 shadow-[0_0_0_3px_color-mix(in_srgb,var(--color-accent)_20%,transparent)]",header:"bg-accent-soft",glow:"var(--color-accent)"},stalled:{section:"border-danger/50 shadow-[0_0_0_3px_color-mix(in_srgb,var(--color-danger)_18%,transparent)]",header:"bg-danger-soft",glow:"var(--color-danger)"},done:{section:"border-border",header:"bg-sunken text-muted opacity-80 saturate-50"}},g2={live:"bg-card",waiting:"bg-card",returned:"bg-card",stalled:"bg-card",done:"bg-quiet"};function g5(e,t){return"session"===t?e("kind.session"):"subagent"===t?e("kind.subagent"):"job"===t?e("kind.job"):"background"===t?e("kind.background"):t}function g4(){let{t:e}=(0,eh.Ym)();return(0,U.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-0.5 rounded-full border border-border/80 px-1.5 py-0.5 text-[9.5px] font-semibold text-muted",title:e("lineage.parentRemovedTitle"),children:[(0,U.jsx)(h1.A,{className:"h-2.5 w-2.5","aria-hidden":!0})," ",e("lineage.parentRemoved")]})}function g3({file:e}){let{t}=(0,eh.Ym)(),[n,r]=(0,Y.useState)(()=>Date.now());(0,Y.useEffect)(()=>{let e=setInterval(()=>r(Date.now()),1e4);return()=>clearInterval(e)},[]);let i=n/1e3-e.mtime,a=("live"===e.activity||"recent"===e.activity)&&i>180;return(0,U.jsx)("span",{className:`shrink-0 font-mono text-[9.5px] tabular-nums ${a?"font-semibold text-warning":"text-muted"}`,title:t(a?"branch.lastActivityQuiet":"branch.lastActivity",{age:(0,tw.rK)(e.mtime)}),children:(0,tw.rK)(e.mtime)})}function g6({file:e,tasks:t,isRoot:n,onClose:r,dragHandle:i,noComposer:a,banner:s,headerActions:l,onToggleExpand:o,expanded:c,dormant:d,autoEditToken:u,showFavorite:p,onSpawnRetry:m,relatedTasks:f,onOpenTask:h,titleOverride:x}){let{t:g}=(0,eh.Ym)(),b=ia(),v=(0,Y.useRef)(null),w=(0,tw.yz)(e),y=tC(e),k=g1[y],j=lu(e.migration,ll(e.path)),N=lc(j),S=(0,Y.useRef)(null),[C,A]=(0,Y.useState)(!1),I=(0,Y.useId)(),[M,T]=(0,Y.useState)(!1),P=!b||M,$=(0,Y.useCallback)(()=>{let e=S.current;if(!e)return;let t=e.scrollWidth-e.clientWidth-e.scrollLeft>4;A(e=>e===t?e:t)},[]);(0,Y.useEffect)(()=>{$()},[$,b,e]);let E=W(e),{caps:R,runtime:O}=cs(e),D="dead"===R.surface,L="superseded"===R.surface,_=R.controls.send,F=D||"disabled"!==_.state?null:g(_.reason),[q,z]=(0,Y.useState)(null),H=e.conversationId&&Number.isInteger(e.migration?.revision)?async t=>{z(null);let n=await lb(e.conversationId,t,e.migration.revision);n.ok||z(n.error??g("retry"===t?"migrate.retryFailed":"migrate.keepFailed"))}:void 0,[B,K]=(0,Y.useState)(()=>"u">typeof IntersectionObserver);(0,Y.useEffect)(()=>{let e=v.current;if(!e||"u"<typeof IntersectionObserver)return;let t=new IntersectionObserver(e=>K(!e.some(e=>e.isIntersecting)),{rootMargin:"256px"});return t.observe(e),()=>t.disconnect()},[]);let V=!!d||B;return(0,Y.useEffect)(()=>{if(!c&&v.current){var e;return e=v.current,tA.set(E,e),()=>{tA.get(E)===e&&tA.delete(E)}}},[E,c]),(0,Y.useEffect)(()=>{if(!e.spawn&&!a&&!c&&v.current){var t;return t=v.current,gd.set(e.path,{el:t,file:e}),()=>{gd.get(e.path)?.el===t&&gd.delete(e.path)}}},[e,a,c]),(0,U.jsxs)("div",{className:`relative flex min-h-0 min-w-0 flex-1 ${k.glow?"pane-attention":""}`,style:k.glow?{"--pane-glow":k.glow}:void 0,children:[p?(0,U.jsx)(gC,{id:E,touch:b}):null,(0,U.jsxs)("section",{ref:v,"data-pan-ignore":!0,"data-link-path":e.path,className:`relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden rounded-[10px] border ${g2[y]} shadow-1 ${k.section}`,children:[(0,U.jsx)("span",{"aria-hidden":!0,className:`w-full shrink-0 ${n?"h-1":"h-0.5"}`,style:"done"===y?{backgroundColor:"var(--color-strong)"}:(0,tw.gA)(e)}),(0,U.jsxs)("header",{className:`reasoning-host flex shrink-0 flex-col border-b border-border ${b?"gap-y-0.5 px-2 py-1":"gap-y-1 px-2.5 py-1.5"} ${k.header} ${i?"cursor-grab active:cursor-grabbing":""}`,...i,children:[(0,U.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5",children:[(0,U.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${(0,tw.tz)(e.activity)}`,title:g(`branch.${y}`)}),(0,U.jsx)(gx,{file:e}),x?(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12px] font-semibold","data-pane-title-override":!0,title:`${x} — ${(0,tw.cr)(e.title)}`,children:x}):e.renamable?(0,U.jsx)(gB,{file:e,displayMax:90,titleClassName:"text-[12px] font-semibold",alwaysVisible:b,autoEditToken:u}):(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12px] font-semibold",title:(0,tw.cr)(e.title),children:(0,tw.cr)(e.title,90)}),(0,U.jsx)(fO,{file:e,compact:!0,hideChip:b}),b?(0,U.jsx)("button",{type:"button","data-testid":"mobile-details-toggle","aria-expanded":M,"aria-controls":I,"aria-label":M?g("branch.detailsHide"):g("branch.detailsShow"),title:M?g("branch.detailsHide"):g("branch.detailsShow"),onClick:()=>T(e=>!e),className:"inline-flex h-11 w-11 shrink-0 items-center justify-center rounded-[8px] border border-border bg-canvas text-muted hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:(0,U.jsx)(sx.c_,{className:`h-4 w-4 transition-transform ${M?"rotate-90":""}`,"aria-hidden":!0})}):null,p?(0,U.jsx)(gS,{id:E,cardRef:v,touch:b}):null,o?(0,U.jsx)("button",{className:`inline-flex shrink-0 items-center justify-center rounded-[8px] border border-border bg-canvas text-muted hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${b?"h-11 w-11":"px-1.5 py-0.5"}`,"aria-label":c?g("branch.collapseFull"):g("branch.expandFull",{title:(0,tw.cr)(e.title,60)}),title:c?g("branch.collapseFull"):g("branch.expandFull",{title:(0,tw.cr)(e.title,60)}),onClick:o,children:c?(0,U.jsx)(h2.A,{className:b?"h-4 w-4":"h-3 w-3","aria-hidden":!0}):(0,U.jsx)(ah.A,{className:b?"h-4 w-4":"h-3 w-3","aria-hidden":!0})}):null,l,e.spawn?null:(0,U.jsx)(gg,{file:e,onDeleted:r}),r?(0,U.jsx)("button",{className:`inline-flex shrink-0 items-center justify-center rounded-[8px] border border-border bg-canvas text-muted hover:border-danger/40 hover:text-danger focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${b?"h-11 w-11":"px-1.5 py-0.5"}`,"aria-label":g("branch.removeColumn",{title:(0,tw.cr)(e.title,60)}),onClick:r,children:(0,U.jsx)(sx.X,{className:b?"h-4 w-4":"h-3 w-3","aria-hidden":!0})}):null]}),P?(0,U.jsxs)("div",{id:I,"data-testid":"mobile-conv-meta",className:"relative flex min-w-0 items-center gap-x-1.5",onTouchStart:b?e=>e.stopPropagation():void 0,onTouchEnd:b?e=>e.stopPropagation():void 0,children:[b&&e.ctx?(0,U.jsx)(gz,{ctx:e.ctx}):null,(0,U.jsxs)("div",{ref:S,onScroll:b?$:void 0,style:b&&C?{maskImage:"linear-gradient(to right, #000 calc(100% - 20px), transparent)",WebkitMaskImage:"linear-gradient(to right, #000 calc(100% - 20px), transparent)"}:void 0,className:`flex min-w-0 items-center gap-x-1.5 gap-y-1 ${b?"no-scrollbar flex-nowrap overflow-x-auto":"flex-wrap"}`,children:[(0,U.jsx)(g3,{file:e}),b?e.model?(0,U.jsx)("span",{className:"inline-flex shrink-0 items-center rounded-full px-2 py-0.5 font-mono text-[10px] font-semibold",style:{backgroundColor:(0,tw.oC)(e).soft,color:(0,tw.oC)(e).color},title:[w.label,(0,tw.$)(e)].filter(Boolean).join(" \xb7 "),children:e.effort?`${e.model} \xb7 ${e.effort}`:e.model}):(0,U.jsx)("span",{className:"inline-flex shrink-0 items-center rounded-full px-2 py-0.5 text-[10px] font-bold",style:w.style,title:(0,tw.$)(e),children:w.label}):(0,U.jsxs)(U.Fragment,{children:[e.model?(0,U.jsx)("span",{className:"shrink-0 rounded-full px-1.5 py-0.5 font-mono text-[9.5px] font-semibold",style:{backgroundColor:(0,tw.oC)(e).soft,color:(0,tw.oC)(e).color},title:[w.label,(0,tw.$)(e)].filter(Boolean).join(" \xb7 "),children:e.model}):(0,U.jsx)("span",{className:"inline-flex shrink-0 items-center rounded-full px-2 py-0.5 text-[10px] font-bold",style:w.style,title:(0,tw.$)(e),children:w.label}),(0,U.jsx)(gT,{file:e})]}),(0,U.jsx)(gY,{file:e}),(0,U.jsx)(gZ,{wakeup:e.pendingWakeup},gX(e.pendingWakeup)),e.parentRemoved?(0,U.jsx)(g4,{}):null,e.continues?(0,U.jsxs)("a",{href:"#c="+encodeURIComponent(e.continues.conversationId),"data-continues-chip":!0,className:"inline-flex shrink-0 items-center gap-0.5 truncate rounded-full border border-accent/40 bg-accent-soft px-1.5 py-0.5 text-[9.5px] font-semibold text-accent hover:border-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:g("lineage.continuesTitle",{round:e.continues.round}),children:[(0,U.jsx)(dZ.A,{className:"h-2.5 w-2.5 shrink-0","aria-hidden":!0})," ",g("lineage.continues",{round:e.continues.round})]}):null,!b&&e.ctx?(0,U.jsx)(gz,{ctx:e.ctx}):null,e.worktree&&!b?(0,U.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-0.5 rounded-full border border-border/80 px-1.5 py-0.5 font-mono text-[9.5px] text-muted",title:g("branch.worktree",{name:e.worktree}),children:[(0,U.jsx)(h5.A,{className:"h-2.5 w-2.5","aria-hidden":!0})," ",e.worktree]}):null,"shell"===e.engine?null:(0,U.jsx)(go,{engine:e.engine,accountId:O?.session.accountId??e.spawn?.accountId??ll(e.path),file:e,runtimeSession:O?.session??null}),e.plan?(0,U.jsx)(g_,{plan:e.plan}):null,e.goal?(0,U.jsx)(gH,{goal:e.goal}):null,n||b?null:(0,U.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-0.5 text-[10px] text-muted",title:e.handoff?g("branch.handoffTitle"):g("branch.branchTitle"),children:[(0,U.jsx)(dZ.A,{className:"h-3 w-3","aria-hidden":!0})," ",e.handoff?g("kind.handoff"):g5(g,e.kind)]})]})]}):null]}),N?(0,U.jsx)(gM,{state:N,targetLabel:ld(j)??"",currentLabel:j?.sourceLabel,error:j?.failure??null,actionError:q,onRetry:H?()=>void H("retry"):void 0,onKeep:H?()=>void H("rollback"):void 0}):null,s??null,D?(0,U.jsx)(fA,{file:e}):null,L?(0,U.jsx)(gR,{file:e}):null,f?.length&&h?(0,U.jsx)(gQ,{relations:f,onOpenTask:h}):null,t.length?(0,U.jsx)(gO,{className:"shrink-0 border-b border-border bg-sunken",enter:"fade",children:t.map(e=>(0,U.jsx)("div",{"data-flip-key":e.path,children:(0,U.jsx)(g8,{file:e,paused:V})},e.path))}):null,(0,U.jsx)(gA,{predecessorLabel:e.predecessorLabel}),(0,U.jsx)(fB,{file:e,showSvc:!1,lineFilter:"",onStatus:g0,paused:V,follow:!0,setFollow:g0,compact:!0,onLaunchRetry:m&&e.spawn?()=>m(e):void 0}),d||!P?null:(0,U.jsx)(ud,{file:e}),a||L?null:(0,U.jsx)(dc,{file:e,pollPaused:V,deadHost:D,sendBlockedReason:F})]})]})}function g8({file:e,paused:t=!1}){let{t:n}=(0,eh.Ym)(),[r,i]=(0,Y.useState)(!1),a=(0,tw.cr)(e.cmdDesc||e.title,80);return(0,U.jsxs)("div",{className:"border-t border-border first:border-t-0",children:[(0,U.jsxs)("div",{className:"flex min-h-11 flex-wrap items-center gap-1.5 pl-2 pr-2.5 sm:min-h-7",children:[(0,U.jsxs)("button",{className:"flex min-h-11 min-w-0 flex-1 items-center gap-1.5 rounded-[6px] text-left hover:bg-canvas focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:min-h-7","aria-expanded":r,"aria-label":n("branch.toggleBackground",{action:n(r?"branch.collapse":"branch.expand"),title:a}),onClick:()=>i(e=>!e),children:[(0,U.jsx)(sx.c_,{className:`h-3.5 w-3.5 shrink-0 text-muted transition-transform ${r?"rotate-90":""}`,"aria-hidden":!0}),(0,U.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${(0,tw.tz)(e.activity)}`}),(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11.5px] font-semibold",title:(0,tw.cr)(e.title),children:a})]}),(0,U.jsx)(fO,{file:e,compact:!0})]}),r?(0,U.jsx)("div",{className:"flex h-[220px] flex-col border-t border-dashed border-border bg-canvas/60",children:(0,U.jsx)(fB,{file:e,showSvc:!1,lineFilter:"",onStatus:g0,paused:t,follow:!0,setFollow:g0,compact:!0})}):null]})}let g7={items:[],nextCursor:null,total:0};class g9 extends Error{constructor(e){super(`conversation catalog request failed: ${e}`),this.status=e,this.name="ConversationCatalogRequestError"}}async function be(e,t,n,r){let i,a=await fetch((i=new URLSearchParams({limit:"40"}),e&&i.set("project",e),t.trim()&&i.set("q",t.trim()),n&&i.set("cursor",n),`/api/conversations?${i}`),{signal:r});if(!a.ok)throw new g9(a.status);return a.json()}function bt({project:e,query:t="",enabled:n=!0}){let[r,i]=(0,Y.useState)({project:e,query:t});(0,Y.useEffect)(()=>{if(t===r.query&&e===r.project)return;let n=250*(r.query!==t),a=window.setTimeout(()=>i({project:e,query:t}),n);return()=>window.clearTimeout(a)},[e,t,r.project,r.query]);let a=`${r.project??""}\u0000${r.query}`,[s,l]=(0,Y.useState)({key:"",page:g7,error:!1}),[o,c]=(0,Y.useState)(null),[d,u]=(0,Y.useState)(0);(0,Y.useEffect)(()=>{if(!n)return;let e=new AbortController;return be(r.project,r.query,null,e.signal).then(e=>l({key:a,page:e,error:!1})).catch(e=>{"AbortError"!==e.name&&l({key:a,page:g7,error:!0})}),()=>e.abort()},[r.project,r.query,n,a,d]),(0,Y.useEffect)(()=>{if(!o||o.key!==a)return;let e=new AbortController;return be(r.project,r.query,o.cursor,e.signal).then(e=>{l(t=>{if(t.key!==o.key)return t;let n=new Set(t.page.items.map(e=>e.path));return{key:t.key,page:{items:[...t.page.items,...e.items.filter(e=>!n.has(e.path))],nextCursor:e.nextCursor,total:e.total},error:!1}})}).catch(e=>{e instanceof g9&&409===e.status?u(e=>e+1):"AbortError"!==e.name&&l(e=>e.key===o.key?{...e,error:!0}:e)}).finally(()=>{e.signal.aborted||c(e=>e===o?null:e)}),()=>e.abort()},[o,r.project,r.query,a]);let p=n&&s.key===a?s:null,m=p?.page??g7,f=n&&(null===p||o?.key===a),h=p?.error??!1,x=(0,Y.useCallback)(()=>{!f&&m.nextCursor&&c({key:a,cursor:m.nextCursor})},[f,m.nextCursor,a]),g=(0,Y.useCallback)(()=>{c(null),u(e=>e+1)},[]);return{...m,loading:f,error:h,loadMore:x,retry:g}}function bn(){location.hash="#p="+encodeURIComponent(ew)}async function br(e,t=fetch){let n=[],r=new Set,i=null;do{let a=new URLSearchParams({project:e,limit:"100"});i&&a.set("cursor",i);let s=await t(`/api/conversations?${a}`);if(!s.ok)throw Error(`conversation catalog request failed: ${s.status}`);let l=await s.json();if(!Array.isArray(l.items))throw Error("conversation catalog response is invalid");if(n.push(...l.items),(i="string"==typeof l.nextCursor&&l.nextCursor?l.nextCursor:null)&&r.has(i))throw Error("conversation catalog cursor repeated");i&&r.add(i)}while(i);return n}async function bi(e,t,n=fetch){try{let r=await n("/api/log/project-delete",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({project:e,paths:t.map(e=>e.path)})}),i=await r.json();return r.ok&&i.ok?0:t.length}catch{return t.length}}function ba({file:e,activeSubtree:t,showProject:n=!1,onOpen:r}){let{t:i}=(0,eh.Ym)(),a=ia(),[s,l]=(0,Y.useState)(!1),o=(0,tw.yz)(e);return s?(0,U.jsxs)("div",{className:"flex items-center gap-2 rounded-[8px] border border-border bg-sunken/60 px-3 py-1.5 text-[11.5px] font-semibold text-muted",children:[(0,U.jsx)(sx.TB,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),(0,U.jsx)("span",{className:"min-w-0 truncate",children:(0,ex.cr)(e.title,80)}),(0,U.jsx)("span",{className:"shrink-0",children:i("trash.deletedFromDisk")})]}):(0,U.jsxs)("div",{className:"flex min-w-0 items-center gap-2 rounded-[8px] border border-border bg-card px-3 py-1.5 shadow-1",children:[(0,U.jsxs)("button",{type:"button",className:`flex min-w-0 flex-1 items-center gap-2 rounded-[6px] text-left hover:bg-canvas focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${a?"min-h-11":"h-full"}`,"aria-label":i("trash.open",{title:(0,ex.cr)(e.title,60)}),onClick:()=>r(e),children:[(0,U.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${(0,tw.tz)(e.activity)}`}),(0,U.jsx)("span",{className:"shrink-0 rounded-full px-1.5 py-0.5 text-[9.5px] font-bold",style:o.style,children:o.label}),(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12.5px] font-semibold",title:e.path,children:(0,ex.cr)(e.title,90)}),n?(0,U.jsx)("span",{className:"max-w-[28vw] shrink-0 truncate rounded-full border border-border bg-canvas px-1.5 py-0.5 text-[10px] font-semibold text-muted",children:e.project}):null,t?(0,U.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-full border border-accent/25 bg-accent/10 px-1.5 py-0.5 text-[10px] font-bold text-accent",title:i("trash.activeSubtree"),children:[(0,U.jsx)(sx.Zr,{className:"h-3 w-3","aria-hidden":!0}),i("trash.activeSubtree")]}):null,a?null:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("span",{className:"shrink-0 text-[10.5px] font-semibold text-muted",children:(0,tw.rK)(e.mtime)}),(0,U.jsxs)("span",{className:"shrink-0 text-[10.5px] text-muted",children:[(e.size/1024).toFixed(0)," ",i("common.kb")]})]})]}),(0,U.jsx)(gg,{file:e,onDeleted:()=>l(!0)})]})}function bs({files:e,allowEmpty:t=!1,onArchive:n,compact:r=!1}){let{t:i}=(0,eh.Ym)(),a=ia();return!e.length&&!t||e.some(e=>"running"===e.proc||"live"===e.activity)?null:(0,U.jsxs)("button",{type:"button",className:`inline-flex shrink-0 items-center gap-1.5 rounded-full border border-border bg-canvas font-semibold text-muted hover:border-accent/40 hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${a?"min-h-11 px-3 text-[13px]":r?"p-1 text-[11px]":"px-2 py-0.5 text-[11px]"}`,"aria-label":i("trash.toArchive"),title:i("trash.toArchive"),onClick:()=>{n(),bn()},children:[(0,U.jsx)(sx.Td,{className:a?"h-4 w-4":"h-3 w-3","aria-hidden":!0})," ",r&&!a?null:i("trash.toArchive")]})}function bl({project:e,files:t,available:n}){let{t:r}=(0,eh.Ym)(),i=ia(),[a,s]=(0,Y.useState)(!1),[l,o]=(0,Y.useState)(!1),[c,d]=(0,Y.useState)(""),[u,p]=(0,Y.useState)(null);if((0,Y.useEffect)(()=>{if(!a)return;let e=window.setTimeout(()=>s(!1),6e3);return()=>window.clearTimeout(e)},[a]),!n||t.some(e=>"running"===e.proc||"live"===e.activity))return null;let m=async()=>{o(!0),d("");try{let t=await br(e);if(!t.length)throw Error("project catalog is empty");p(t),s(!0)}catch{d(r("trash.projectLoadFailed"))}finally{o(!1)}},f=async()=>{if(!u)return;o(!0),d("");let t=await bi(e,u);(o(!1),s(!1),t)?d(r("trash.notDeleted",{failed:t,total:u.length})):bn()};return a?(0,U.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-[10px] border border-danger/30 bg-danger-soft px-1.5 py-0.5 text-[11px]",children:[(0,U.jsx)("span",{className:"px-0.5 font-semibold text-danger",children:r("trash.confirmDelete",{count:u?.length??0})}),(0,U.jsx)("button",{type:"button",className:`inline-flex items-center rounded-lg bg-danger font-bold text-white disabled:opacity-60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-danger/50 ${i?"min-h-11 px-3":"px-2 py-0.5"}`,disabled:l,onClick:f,children:l?r("trash.deleting"):r("trash.confirmYes")}),(0,U.jsx)("button",{type:"button",className:`inline-flex items-center rounded-lg border border-border bg-card font-semibold text-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${i?"min-h-11 px-3":"px-2 py-0.5"}`,onClick:()=>{s(!1),p(null)},children:r("common.cancel")})]}):(0,U.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1.5",children:[(0,U.jsx)("button",{type:"button",className:`inline-flex items-center justify-center rounded-full border border-border bg-canvas text-muted hover:border-danger/40 hover:text-danger focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${i?"h-11 w-11":"p-1"}`,"aria-label":r("trash.deleteProject"),title:r("trash.deleteProject"),disabled:l,onClick:()=>void m(),children:l?(0,U.jsx)("span",{className:"text-[10px] font-bold",children:"…"}):(0,U.jsx)(sx.TB,{className:i?"h-4 w-4":"h-3 w-3","aria-hidden":!0})}),c?(0,U.jsx)("span",{className:"max-w-[180px] truncate text-[10.5px] font-semibold text-danger",children:c}):null]})}function bo({project:e,enabled:t,onOpen:n}){let{t:r}=(0,eh.Ym)(),[i,a]=(0,Y.useState)(""),s=!!i.trim(),l=bt({project:s?void 0:e,query:i,enabled:t});return(0,U.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto px-3 py-4 sm:px-4 sm:py-5",children:(0,U.jsxs)("div",{className:"mx-auto w-full max-w-[760px]",children:[(0,U.jsxs)("div",{className:"flex items-baseline gap-2",children:[(0,U.jsx)("div",{className:"text-[13.5px] font-semibold text-muted",children:r(s?"switch.results":"list.title")}),l.total?(0,U.jsx)("span",{className:"text-[11px] font-bold tabular-nums text-muted",children:l.total}):null]}),(0,U.jsx)("div",{className:"mt-0.5 text-[12px] text-muted",children:r(s?"list.searchHint":"list.hint")}),(0,U.jsx)("input",{type:"search",value:i,onChange:e=>a(e.target.value),placeholder:r("switch.search"),"aria-label":r("switch.search"),className:"mb-3 mt-2 h-11 w-full rounded-[8px] border border-border bg-card px-3 text-[13px] text-primary outline-none placeholder:text-muted focus-visible:ring-2 focus-visible:ring-accent/40"}),(0,U.jsx)("div",{className:"space-y-1.5",children:l.items.map(e=>(0,U.jsx)(ba,{file:e,activeSubtree:!1,showProject:s,onOpen:n},e.path))}),l.loading&&!l.items.length?(0,U.jsxs)("div",{className:"flex min-h-32 items-center justify-center gap-2 text-[13px] font-semibold text-muted",children:[(0,U.jsx)(sx.kr,{className:"h-4 w-4 animate-spin","aria-hidden":!0})," ",r("common.loading")]}):null,l.error?(0,U.jsxs)("div",{className:"flex min-h-32 flex-col items-center justify-center gap-2 text-center text-[13px] font-semibold text-danger",children:[(0,U.jsx)("span",{children:r("list.failed")}),(0,U.jsx)("button",{type:"button",className:"min-h-11 rounded-[8px] border border-border bg-card px-4 font-bold text-primary hover:border-accent/40 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:l.retry,children:r("list.retry")})]}):null,l.loading||l.error||l.items.length?null:(0,U.jsx)("div",{className:"min-h-32 pt-10 text-center text-[13px] font-semibold text-muted",children:r("common.nothingFound")}),l.nextCursor&&!l.error?(0,U.jsx)("button",{type:"button",className:"mt-3 flex min-h-11 w-full items-center justify-center rounded-[8px] border border-border bg-card px-4 text-[12.5px] font-bold text-primary hover:border-accent/40 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60",disabled:l.loading,onClick:l.loadMore,children:r(l.loading?"common.loading":"list.loadMore")}):null]})})}function bc(e){return Object.fromEntries(e.parameters.map(e=>[e.key,void 0!==e.default?e.default:"integer"===e.kind?e.min??1:"select"===e.kind?e.options?.[0]??"":""]))}function bd({dir:e,elide:t}){let n,r,{head:i,tail:a}=(r=(n=e.trim().replace(/(.)\/+$/,"$1")).lastIndexOf("/"))<0||r===n.length-1?{head:"",tail:n}:{head:n.slice(0,r+1),tail:n.slice(r+1)};return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("span",{className:"text-muted",children:t?function(e,t){if(e.length<=t)return e;let n=e.split("/").filter(Boolean);if(n.length<3)return e;let r="/"+n[0]+"/",i=n[n.length-1]+"/";for(let e=n.length-2;e>0;e-=1){let a=n[e]+"/"+i;if(r.length+2+a.length>t)break;i=a}return r+"…/"+i}(i,Math.max(96-a.length,12)):i}),(0,U.jsx)("span",{className:"font-semibold text-primary",children:a})]})}function bu({id:e,value:t,dirs:n,disabled:r,ariaLabel:i,onChange:a}){let{t:s}=(0,eh.Ym)(),[l,o]=(0,Y.useState)(!1),[c,d]=(0,Y.useState)(t),[u,p]=(0,Y.useState)(!0),[m,f]=(0,Y.useState)(0),h=(0,Y.useRef)(null),x=(0,Y.useRef)(null),g=(0,Y.useRef)(null),b=l&&!r,v=t.trim(),w=e+"-listbox",y=(0,Y.useMemo)(()=>(function(e,t){let n=new Set,r=[];for(let i of[e,...t]){let e=i?.trim()??"";!e||n.has(e)||(n.add(e),r.push(e))}return r})(t,n),[n,t]),k=(0,Y.useMemo)(()=>{let e,t;return e=(u?[...y]:y.filter(e=>{let t;return t=e.toLowerCase(),c.trim().toLowerCase().split(/\s+/).filter(Boolean).every(e=>t.includes(e))})).map(e=>({key:"known:"+e,value:e,kind:"known"})),t=c.trim(),!u&&t&&(t.startsWith("/")||t.startsWith("~")||t.includes("/"))&&!y.includes(t)&&e.push({key:"typed",value:t,kind:"typed"}),e},[y,u,c]),j=k.length?Math.min(m,k.length-1):0,N=()=>{r||(d(t),p(!0),f(Math.max(y.indexOf(v),0)),o(!0))},S=()=>{o(!1),x.current?.focus()},C=e=>{let t=e.trim();t&&t!==v&&a(t),S()};(0,Y.useEffect)(()=>{b&&(g.current?.focus(),g.current?.select?.())},[b]),(0,Y.useEffect)(()=>{if(!b)return;let e=e=>{let t=e.target;t&&h.current?.contains(t)||o(!1)};return document.addEventListener("pointerdown",e,!0),()=>document.removeEventListener("pointerdown",e,!0)},[b]),(0,Y.useEffect)(()=>{b&&document.getElementById(e+"-option-"+j)?.scrollIntoView?.({block:"nearest"})},[b,j,e]);let A=e=>{k.length&&f(t=>(Math.min(t,k.length-1)+e+k.length)%k.length)};return(0,U.jsxs)("div",{ref:h,"data-scheme-ui":!0,"data-directory-picker":b?"open":"closed",className:"relative flex min-w-0 flex-1 flex-col",children:[(0,U.jsxs)("button",{ref:x,type:"button",disabled:r,"aria-haspopup":"listbox","aria-expanded":b,"aria-label":i+": "+(v||s("dirPicker.empty")),"data-directory-trigger":!0,"data-directory-value":v,title:v||void 0,onClick:()=>b?S():N(),onKeyDown:e=>{"ArrowDown"!==e.key||b||(e.preventDefault(),N())},className:"flex min-h-11 min-w-0 items-center gap-1.5 rounded-[6px] border border-border bg-card px-2 py-1 text-left hover:border-strong focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60 sm:min-h-0",children:[(0,U.jsx)("span",{className:"line-clamp-2 min-w-0 flex-1 break-all font-mono text-[11px] leading-4",children:v?(0,U.jsx)(bd,{dir:v,elide:!0}):(0,U.jsx)("span",{className:"text-muted",children:s("dirPicker.empty")})}),(0,U.jsx)(sx.yQ,{className:"h-3.5 w-3.5 shrink-0 text-muted","aria-hidden":!0})]}),b?(0,U.jsxs)("div",{className:"absolute inset-x-0 top-full z-30 mt-1 flex max-h-[min(60vh,320px)] flex-col overflow-hidden rounded-[10px] border border-border bg-raised shadow-2",children:[(0,U.jsx)("input",{ref:g,value:c,role:"combobox","aria-expanded":"true","aria-controls":w,"aria-autocomplete":"list","aria-activedescendant":k[j]?e+"-option-"+j:void 0,"aria-label":s("dirPicker.searchAria"),placeholder:s("dirPicker.searchPlaceholder"),spellCheck:!1,autoComplete:"off",onChange:e=>{d(e.target.value),p(!1),f(0)},onKeyDown:e=>{if("ArrowDown"===e.key)e.preventDefault(),A(1);else if("ArrowUp"===e.key)e.preventDefault(),A(-1);else if("Home"===e.key)e.preventDefault(),f(0);else if("End"===e.key)e.preventDefault(),f(Math.max(k.length-1,0));else if("Enter"===e.key||"Tab"===e.key){e.preventDefault();let t=k[j];t?C(t.value):S()}else"Escape"===e.key&&(e.preventDefault(),e.stopPropagation(),S())},className:"min-h-11 w-full shrink-0 border-b border-border bg-card px-2 font-mono text-[11px] text-primary placeholder:text-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent/40 sm:min-h-9"}),(0,U.jsxs)("ul",{id:w,role:"listbox","aria-label":s("dirPicker.listAria"),className:"min-h-0 flex-1 overflow-y-auto py-1",children:[k.map((t,n)=>{let r="known"===t.kind&&t.value===v;return(0,U.jsxs)("li",{id:e+"-option-"+n,role:"option","aria-selected":r,"data-directory-option":t.value,"data-directory-active":n===j?"true":void 0,onClick:()=>C(t.value),onMouseEnter:()=>f(n),className:`flex min-h-11 cursor-pointer items-center gap-2 border-l-2 px-2 py-1.5 sm:min-h-9 ${n===j?"bg-accent-soft":""} ${r?"border-accent":"border-transparent"}`,children:[(0,U.jsxs)("span",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[(0,U.jsx)("span",{className:"break-all font-mono text-[11px] leading-4",children:(0,U.jsx)(bd,{dir:t.value})}),"typed"===t.kind?(0,U.jsx)("span",{className:"text-caption font-semibold text-accent",children:s("dirPicker.useTyped")}):null,r?(0,U.jsx)("span",{className:"text-caption font-semibold text-accent",children:s("dirPicker.current")}):null]}),r?(0,U.jsx)(sx.Jl,{className:"h-3.5 w-3.5 shrink-0 text-accent","aria-hidden":!0}):null]},t.key)}),k.length?null:(0,U.jsx)("li",{role:"presentation",className:"px-2 py-2 text-[11px] leading-4 text-muted",children:y.length?s("dirPicker.noMatch"):s("dirPicker.noneKnown")})]}),(0,U.jsx)("p",{"aria-live":"polite",className:"shrink-0 border-t border-border px-2 py-1 text-caption text-muted",children:s("dirPicker.count",{shown:k.filter(e=>"known"===e.kind).length,total:y.length})})]}):null]})}let bp=(0,Y.forwardRef)(function({phase:e,target:t,structured:n=!1,error:r},i){let{t:a}=(0,eh.Ym)(),s="attention"===e,l=s?r||(n?a("draft.attentionStructured"):t?a("draft.attention",{target:t}):a("draft.attentionNoTarget")):"confirming"===e||"confirming-slow"===e?n?a("draft.confirmingStructured"):t?a("draft.confirming",{target:t}):a("draft.confirmingNoTarget"):n?a("draft.launchedStructured"):a("draft.launched",{target:t});return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)("div",{ref:i,tabIndex:s?-1:void 0,role:"status","aria-live":s?"assertive":"polite",className:`flex items-center gap-2 text-[11.5px] font-semibold outline-none ${s?"text-danger":"text-muted"}`,children:[s?(0,U.jsx)(sx.MA,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}):(0,U.jsx)(sx.kr,{className:"h-3.5 w-3.5 shrink-0 animate-spin motion-reduce:animate-none","aria-hidden":!0}),(0,U.jsx)("span",{children:l})]}),"booting-slow"===e?(0,U.jsx)("div",{className:"text-[11px] text-muted",children:n?a("draft.slowStructured"):a("draft.slow",{target:t})}):null,"confirming-slow"===e?(0,U.jsx)("div",{className:"text-[11px] text-muted",children:n||!t?a("draft.confirmingSlowStructured"):a("draft.confirmingSlow",{target:t})}):null]})}),bm=new Set(["image/png","image/jpeg","image/gif","image/webp"]);function bf(e){return!e||"object"!=typeof e||Array.isArray(e)||"boolean"!=typeof e.supported||null!==e.reason&&"string"!=typeof e.reason||!Array.isArray(e.formats)||0===e.formats.length||e.formats.some(e=>"string"!=typeof e||!bm.has(e))||!Number.isSafeInteger(e.maxImages)||0>=Number(e.maxImages)||!Number.isSafeInteger(e.maxRawBytesPerImage)||0>=Number(e.maxRawBytesPerImage)||!Number.isSafeInteger(e.maxEncodedBytesPerRequest)||0>=Number(e.maxEncodedBytesPerRequest)?null:e}let bh=(e,t)=>`llvDraftPane:${e}:${t}`,bx=null,bg=null;function bb(){let[e,t]=(0,Y.useState)(()=>bx??[]);return(0,Y.useEffect)(()=>{if(bx)return;let e=!1;return(bg??=fetch("/api/roles").then(async e=>{if(!e.ok)return null;let t=await e.json();return Array.isArray(t.roles)?t.roles:null}).catch(()=>null).then(e=>(e?bx=e:bg=null,e))).then(n=>{!e&&n&&t(n)}),()=>{e=!0}},[]),e}function bv({idPrefix:e,roles:t,roleId:n,roleParams:r,disabled:i,allowedRoleIds:a,compactPreview:s,onSelectRole:l,onSetParam:o,children:c}){var d,u;let{t:p}=(0,eh.Ym)(),m=a?t.filter(e=>a.has(e.id)):t,f=m.find(e=>e.id===n)??null;return(0,U.jsxs)("div",{className:"flex shrink-0 flex-col gap-1.5 border-b border-border bg-sunken px-2.5 py-1.5",children:[(0,U.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[(0,U.jsx)("label",{className:"shrink-0 text-caption font-semibold text-muted",htmlFor:`draft-role-${e}`,children:p("draft.role")}),(0,U.jsxs)(dF,{id:`draft-role-${e}`,value:n,disabled:i,onChange:e=>l(e.target.value),"aria-label":p("draft.roleAria"),className:"flex-1",children:[(0,U.jsx)("option",{value:"",children:p("draft.noRole")}),m.map(e=>(0,U.jsx)("option",{value:e.id,children:dL(p,`roleCopy.${e.id}.name`,e.name)},e.id))]})]}),f?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("p",{className:"text-caption leading-4 text-muted",children:dL(p,`roleCopy.${f.id}.description`,f.description)}),f.parameters.length?(0,U.jsx)("div",{className:"flex flex-wrap gap-1.5",role:"group","aria-label":p("draft.roleParameters"),children:f.parameters.map(e=>{var t,n;let a=(t=f.id,dL(p,`roleCopy.${t}.param.${e.key}.label`,e.label));return(0,U.jsxs)("label",{className:"flex min-w-28 flex-1 flex-col gap-0.5 text-caption text-muted",children:[(0,U.jsxs)("span",{children:[a,e.required?" *":""]}),"select"===e.kind?(0,U.jsx)(dF,{value:String(r[e.key]??""),disabled:i,onChange:t=>o(e.key,t.target.value),children:e.options?.map(t=>{var n,r;return(0,U.jsx)("option",{value:t,children:(n=f.id,r=e.key,dL(p,`roleCopy.${n}.param.${r}.option.${t}`,t))},t)})}):(0,U.jsx)("input",{type:"integer"===e.kind?"number":"text",min:"integer"===e.kind?e.min:void 0,max:"integer"===e.kind?e.max:void 0,value:String(r[e.key]??""),disabled:i,onChange:t=>o(e.key,"integer"===e.kind&&t.target.value?Number(t.target.value):t.target.value),"aria-label":a,className:"h-7 min-w-0 rounded-control border border-border bg-card px-1.5 text-ui text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60"}),(0,U.jsx)("span",{className:"leading-3",children:(n=f.id,dL(p,`roleCopy.${n}.param.${e.key}.description`,e.description))})]},e.key)})}):null,c,(0,U.jsxs)("details",{className:"rounded-control border border-border bg-card/60",children:[(0,U.jsx)("summary",{className:"min-h-7 cursor-pointer select-none list-item px-2 py-1 text-caption font-semibold text-secondary marker:text-muted hover:text-primary",children:p("draft.rolePromptToggle")}),(0,U.jsxs)("div",{className:"border-t border-border px-2 py-1.5 text-caption leading-4 text-muted",children:[(0,U.jsx)("pre",{className:`whitespace-pre-wrap font-sans ${s?"max-h-24 overflow-y-auto":""}`,children:(d=f.promptPreview,u=r,d.replace(/\{\{([A-Za-z][A-Za-z0-9]*)\}\}/g,(e,t)=>String(u[t]??"")))}),(0,U.jsx)("ul",{className:`mt-1 list-disc pl-4 ${s?"max-h-16 overflow-y-auto":""}`,"aria-label":p("draft.safetyFences"),children:f.safetyFences.map(e=>(0,U.jsx)("li",{children:e},e))})]})]})]}):null]})}function bw(e,t){return sessionStorage.getItem(bh(e,t))??""}function by(e,t,n){n?sessionStorage.setItem(bh(e,t),n):sessionStorage.removeItem(bh(e,t))}function bk(e){return bw(e,"src")}function bj(e,t){let n=t.trim();by(e,"cwd",n),by(e,"cwdSeed",n)}function bN(e){let t=bw(e,"cwd").trim();return!t||t===bw(e,"cwdSeed").trim()}let bS="llv:draft-cwd-resolved";function bC({draftId:e,project:t,files:n,onClose:r,onSpawned:i}){let{t:a}=(0,eh.Ym)(),[s]=(0,Y.useState)(()=>bw(e,"src")),[l]=(0,Y.useState)(()=>bw(e,"parentConversationId")),o=s?n.find(e=>e.path===s)??null:null,[c]=(0,Y.useState)(()=>bw(e,"cwd")),d=(0,Y.useRef)(!!(s&&bN(e))),[u,p]=(0,Y.useState)(()=>c||eT(n,t,s)),m=bb(),[f,h]=(0,Y.useState)(()=>bw(e,"role")),[x,g]=(0,Y.useState)(()=>(function(e){try{let t=JSON.parse(bw(e,"roleParams")||"{}");if(!t||"object"!=typeof t||Array.isArray(t))return{};return Object.fromEntries(Object.entries(t).filter(([,e])=>"string"==typeof e||"number"==typeof e))}catch{return{}}})(e)),[b,v]=(0,Y.useState)(()=>bw(e,"reviews")),[w,y]=(0,Y.useState)(()=>bw(e,"confirm")),[k,j]=(0,Y.useState)([]),[N,S]=(0,Y.useState)({status:"loading",requestKey:""}),C=dB({storage:{read:t=>bw(e,t),write:(t,n)=>by(e,t,n)},initialEngine:o?.engine==="codex"?"codex":"claude",onEngineChange:e=>S({status:"loading",requestKey:`${t}
|
|
73
|
-
${s??""}
|
|
74
|
-
${e}`})}),{engine:A,model:I,effort:M,speed:T}=C,P=`${t}
|
|
75
|
-
${s??""}
|
|
76
|
-
${A}`,[$,E]=(0,Y.useState)(0),R=N.requestKey===P?N:{status:"loading",requestKey:P},[O,D]=(0,Y.useState)(()=>(function(e){try{let t=JSON.parse(bw(e,"boot")||"null");if(!t||"number"!=typeof t.at||"string"!=typeof t.prompt||"string"!=typeof t.clientAttemptId||"booting"!==t.phase&&"confirming"!==t.phase&&"attention"!==t.phase)return null;return{...t,request:t.request&&"object"==typeof t.request?t.request:null}}catch{return null}})(e)),[L,_]=(0,Y.useState)(!1),[F,q]=(0,Y.useState)(null),z=(0,Y.useRef)(null),H=(0,Y.useRef)(new Set);(0,Y.useEffect)(()=>{let t=t=>{let n=t.detail;n?.id===e&&"string"==typeof n.cwd&&(d.current=!1,p(n.cwd))};return window.addEventListener(bS,t),()=>window.removeEventListener(bS,t)},[e]);let{setEngine:B,setModel:K,setEffort:V,setSpeed:J}=C,G=t=>{g(t),by(e,"roleParams",JSON.stringify(t))},Q=t=>{y(t),by(e,"confirm",t)},X=(0,Y.useCallback)(t=>{D(t),by(e,"boot",t?JSON.stringify(t):"")},[e]),Z="ready"===R.status?R.value:null,ee=Z?.spawnTransport==="structured",et=Z?.spawnTransport==="structured"?Z.imageInput[A]:null,er=et&&"codex"===A&&!ov(I)?{...et,supported:!1,reason:a("composer.codexImagesTextOnly")}:et,ei=sV({initialText:()=>bw(e,"text")||(s?a("draft.readPrompt",{src:s}):""),persistText:t=>by(e,"text",t),submit:e=>eg(e),disabled:!!O,imageCapability:er}),{text:ea,setText:es,setStatus:el,busy:eo,setBusy:ec,voiceSending:ed,attachments:eu}=ei;(0,Y.useEffect)(()=>{let n=!1;return fetch("/api/spawn?project="+encodeURIComponent(t)+(s?"&src="+encodeURIComponent(s):"")).then(async e=>{if(!e.ok)throw Error("spawn capability request failed");return await e.json()}).then(t=>{if(n)return;Array.isArray(t.dirs)&&j(t.dirs);let r="string"==typeof t.cwd?t.cwd.trim():"",i=!!(d.current&&r);i&&(d.current=!1),p(n=>{let a=i&&r||n||r||t.dirs?.[0]||"";return a!==n&&bj(e,a),a});let a=function(e){if(!e||"object"!=typeof e||Array.isArray(e)||"tmux"!==e.spawnTransport&&"structured"!==e.spawnTransport||!e.imageInput||"object"!=typeof e.imageInput||Array.isArray(e.imageInput))return null;let t=e.imageInput,n=bf(t.claude),r=bf(t.codex);return n&&r?{spawnTransport:e.spawnTransport,imageInput:{claude:n,codex:r}}:null}(t);if(!a)throw Error("spawn capability response is invalid");S({status:"ready",requestKey:P,value:a})}).catch(()=>{n||S({status:"error",requestKey:P})}),()=>{n=!0}},[t,e,s,A,P,$]),(0,Y.useEffect)(()=>{if(!O)return;let e=function(e,t){if(e.path){let n=t.find(t=>t.path===e.path);if(n)return n}if(e.conversationId){let n=t.find(t=>t.conversationId===e.conversationId);if(n)return n}if(e.clientAttemptId){let n=t.find(t=>t.spawn?.clientAttemptId===e.clientAttemptId);if(n)return n}return null}(O,n);if(!e)return;let t=e.spawn?.launchId??O.launchId;t&&(O.prompt.trim()||O.hasImages)&&l7(W(e),{id:t,text:O.prompt,images:O.request?.images.length??0,at:O.at}),i(e)},[n,O,i]),(0,Y.useEffect)(()=>{if(!O||"attention"===O.phase)return;let e=(O.phase,9e4),t=()=>{"booting"===O.phase||O.conversationId||O.launchId||O.path||O.target?_(!0):X({...O,phase:"attention"})},n=(F??O.at)+e-Date.now();if(n<=0)return void t();let r=window.setTimeout(t,n);return()=>window.clearTimeout(r)},[O,X,F]),(0,Y.useEffect)(()=>{let e=()=>{_(!1),q(Date.now())};return window.addEventListener(ro,e),()=>window.removeEventListener(ro,e)},[]),(0,Y.useEffect)(()=>{O?.phase==="attention"&&z.current?.focus()},[O?.phase]);let ep=(0,Y.useCallback)(async e=>{ec(!0),el(null);try{let n=await fetch("/api/spawn",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(function(e){let{request:t}=e;return{engine:t.engine,...t.model?{model:t.model}:{},cwd:t.cwd,...t.effort?{effort:t.effort}:{},...null===t.fast?{}:{fast:t.fast},...t.accountId?{accountId:t.accountId}:{},prompt:t.prompt,images:t.images,clientAttemptId:e.clientAttemptId,...t.src?{src:t.src}:{},...t.parentConversationId?{parentConversationId:t.parentConversationId}:{},...t.role?{role:t.role,roleParams:t.roleParams??{}}:{},...t.reviews?{reviews:t.reviews}:{},...t.confirm?{confirm:t.confirm}:{}}}(e))}),r=null;try{r=await n.json()}catch{r=null}let s=f4(n.status,n.ok,r),l="launched"===s.kind||"failed-launch"===s.kind?s.launchId??e.clientAttemptId:null;if(l&&ns("launched"===s.kind?{cue:"launch",eventId:`launch:${l}`}:{cue:"failure",eventId:`launch-failed:${l}`}),"string"==typeof r?.launchId&&"string"==typeof r.conversationId&&nF(),"launched"===s.kind){let n=s.conversationId??(s.launchId?`spawn:${s.launchId}`:null);n&&s.launchId&&l7(n,{id:s.launchId,text:e.prompt,images:e.request.images.length,at:e.at}),X({...e,target:s.target,path:s.path,conversationId:s.conversationId,launchId:s.launchId,phase:s.durable,error:null});let r=f3(e,s,t);r&&(rk(r),i(r))}else"failed-launch"===s.kind?X({...e,target:s.target,conversationId:s.conversationId,launchId:s.launchId,phase:"attention",error:s.message}):"failed-preflight"===s.kind&&(X(null),es(e.request.prompt),eu.replace(e.request.images.map(e=>({...e,preview:`data:${e.mime};base64,${e.base64}`})))&&el({kind:"err",text:s.message??a("draft.launchFailed")}))}catch{}finally{ec(!1)}},[eu,i,t,X,ec,el,es,a]);(0,Y.useEffect)(()=>{let e;!O||!((e=O.request)&&("claude"===e.engine||"codex"===e.engine)&&e.engine===O.engine&&"string"==typeof e.model&&"string"==typeof e.cwd&&e.cwd.length>0&&"string"==typeof e.effort&&(null===e.fast||"boolean"==typeof e.fast)&&"string"==typeof e.accountId&&"string"==typeof e.prompt&&"string"==typeof e.src&&e.src===O.src&&(void 0===e.parentConversationId||"string"==typeof e.parentConversationId)&&(void 0===e.role||"string"==typeof e.role)&&(void 0===e.roleParams||"object"==typeof e.roleParams&&null!==e.roleParams&&!Array.isArray(e.roleParams))&&(void 0===e.reviews||"string"==typeof e.reviews)&&("reviewer"===e.role?!!e.reviews?.trim():void 0===e.reviews)&&(void 0===e.confirm||"string"==typeof e.confirm)&&Array.isArray(e.images)&&e.images.every(e=>"string"==typeof e?.base64&&"string"==typeof e?.mime))||H.current.has(O.clientAttemptId)||(H.current.add(O.clientAttemptId),ep(O))},[O,ep]);let em=m.find(e=>e.id===f)??null,ef="ready"!==R.status||Z?.spawnTransport==="structured"&&!er?.supported,ex="loading"===R.status?a("composer.imageCapabilityLoading"):"error"===R.status?a("composer.imageCapabilityError"):Z?.spawnTransport!=="structured"||"codex"!==A||ov(I)?Z?.spawnTransport!=="structured"||er?.supported?void 0:a("composer.structuredImagesProtocol"):a("composer.codexImagesTextOnly"),eg=async e=>{let t=e??ea;if(eo||ed||O)return;if(eu.images.length&&ef)return void el({kind:"err",text:ex??a("composer.structuredImagesUnavailable")});if(eu.images.length&&!eu.validate())return;if(!u.trim())return void el({kind:"err",text:a("draft.needDir")});if(em){if(em.parameters.find(e=>{if(!e.required)return!1;let t=x[e.key];return void 0===t||"string"==typeof t&&!t.trim()}))return void el({kind:"err",text:a("draft.roleNeedsParams")});if("deployer"===em.id&&"deploy"!==w)return void el({kind:"err",text:a("draft.deployConfirm")});if("reviewer"===em.id&&!b)return void el({kind:"err",text:a("draft.reviewerNeedsConversation")})}if(!t.trim()&&!eu.images.length)return;let n=f5(("u">typeof crypto&&"function"==typeof crypto.randomUUID?crypto.randomUUID():Date.now().toString(36)+"-"+Math.random().toString(36).slice(2,12)).replace(/[^A-Za-z0-9_-]/g,"").slice(0,128).padEnd(8,"0"),Date.now(),{engine:A,model:I,cwd:u.trim(),effort:M,fast:"codex"===A&&T?"fast"===T:null,accountId:C.launchAccountId,prompt:t,images:eu.images.map(e=>({base64:e.base64,mime:e.mime})),src:s,...l?{parentConversationId:l}:{},...f?{role:f,roleParams:x,..."reviewer"===f&&b?{reviews:b}:{},...w?{confirm:w}:{}}:{}});H.current.add(n.clientAttemptId),_(!1),q(null),X(n),es(""),eu.clear(),await ep(n)},eb=(0,tw.t7)(A),ev=ei.fieldsDisabled,ew="draft-dirs-"+e,ey=O?"attention"===O.phase?"attention":"confirming"===O.phase?L?"confirming-slow":"confirming":L?"booting-slow":"booting":eo?"launching":"draft",ek=O?.target??"",ej=en(n).filter(e=>("claude"===e.engine||"codex"===e.engine)&&!!(e.conversationId||e.path));return(0,U.jsxs)("section",{"data-pan-ignore":!0,className:"relative flex h-full min-h-0 min-w-0 flex-1 flex-col overflow-hidden rounded-[10px] border border-border bg-card shadow-1","aria-label":a("draft.paneAria"),children:[(0,U.jsx)("span",{"aria-hidden":!0,className:"h-1 w-full shrink-0",style:{backgroundColor:eb.color}}),(0,U.jsxs)("header",{className:"flex h-10 shrink-0 items-center gap-1.5 border-b border-border px-2.5",style:{backgroundColor:eb.soft},children:[(0,U.jsx)(dY,{draft:C,disabled:ev,className:"max-w-28"}),(0,U.jsx)("span",{className:"h-2 w-2 shrink-0 rounded-full bg-strong",title:a("draft.notStarted")}),(0,U.jsx)(dK,{engine:A,disabled:ev,onChange:B}),(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12px] font-semibold text-muted",title:o?(0,tw.cr)(o.title):void 0,children:s?a("draft.handoffLabel",{title:o?(0,tw.cr)(o.title,60):a("draft.conversation")}):a("draft.newConvo")}),(0,U.jsx)("button",{className:"inline-flex shrink-0 items-center rounded-[8px] border border-border bg-canvas px-1.5 py-0.5 text-muted hover:border-danger/40 hover:text-danger focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":a("draft.dismiss"),onClick:r,children:(0,U.jsx)(sx.X,{className:"h-3 w-3","aria-hidden":!0})})]}),(0,U.jsxs)("div",{className:"relative z-20 flex shrink-0 items-center gap-1.5 border-b border-border bg-sunken px-2.5 py-1.5",children:[(0,U.jsx)("span",{className:"shrink-0 text-[10px] font-semibold text-muted",children:a("draft.directory")}),(0,U.jsx)(bu,{id:ew,value:u,dirs:k,disabled:ev,ariaLabel:a("draft.dirAria"),onChange:t=>{d.current=!1,p(t),by(e,"cwd",t)}})]}),(0,U.jsxs)(bv,{idPrefix:e,roles:m,roleId:f,roleParams:x,disabled:ev,onSelectRole:t=>{h(t),by(e,"role",t);let n=m.find(e=>e.id===t);if(!n){G({}),Q("");return}G(bc(n)),Q(""),B(n.config.engine),K(n.config.model),V(n.config.effort),J("")},onSetParam:(e,t)=>{let n={...x,[e]:t};G(n);let r=m.find(e=>e.id===f);if(r?.id==="builder"){if("frontend"===n.domain){B("claude"),K("opus"),V("high"),J("");return}if("apply-fixes"===n.mode){B("codex"),K("gpt-5.6-terra"),V("low");return}B(r.config.engine),K(r.config.model),V(r.config.effort)}},children:[em?.id==="reviewer"?(0,U.jsxs)("label",{className:"flex max-w-full flex-col gap-0.5 text-caption text-muted",children:[(0,U.jsx)("span",{children:a("draft.reviews")}),(0,U.jsxs)(dF,{value:b,disabled:ev,onChange:t=>{var n;v(n=t.target.value),by(e,"reviews",n)},"aria-label":a("draft.reviewsAria"),children:[(0,U.jsx)("option",{value:"",children:a("draft.reviewsPlaceholder")}),b&&!ej.some(e=>(e.conversationId??e.path)===b)?(0,U.jsx)("option",{value:b,children:b}):null,ej.map(e=>{let t=e.conversationId??e.path;return(0,U.jsx)("option",{value:t,children:(0,tw.cr)(e.title,80)},t)})]})]}):null,em?.id==="deployer"?(0,U.jsxs)("label",{className:"flex max-w-52 flex-col gap-0.5 text-[10px] text-muted",children:[(0,U.jsx)("span",{children:a("draft.deployConfirm")}),(0,U.jsx)("input",{value:w,disabled:ev,onChange:e=>Q(e.target.value),"aria-label":a("draft.deployConfirm"),placeholder:"deploy",className:"h-7 rounded-[7px] border border-border bg-card px-1.5 text-[11px] text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60"})]}):null]}),(0,U.jsxs)("div",{className:"flex shrink-0 flex-wrap items-center gap-1.5 border-b border-border bg-sunken px-2.5 py-1.5",children:[(0,U.jsx)("span",{className:"shrink-0 text-[10px] font-semibold text-muted",children:a("draft.reasoning")}),(0,U.jsx)(dq,{engine:A,model:I,effort:M,speed:T,disabled:ev,onModel:K,onEffort:V,onSpeed:J})]}),(0,U.jsx)("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto px-4 py-4",children:O?(0,U.jsxs)("div",{className:"flex flex-1 flex-col justify-end gap-3",children:[(0,U.jsx)("div",{className:"flex justify-end",children:(0,U.jsx)("span",{className:"min-w-0 max-w-[85%] whitespace-pre-wrap rounded-[10px] rounded-br-[3px] bg-accent-soft px-2.5 py-1.5 text-[12px] text-secondary",children:O.prompt||a("draft.imagesOnly")})}),(0,U.jsx)(bp,{ref:z,phase:ey,target:ek,structured:ee,error:O.error??null})]}):(0,U.jsxs)("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 text-center",children:[(0,U.jsx)("span",{className:"rounded-full px-3 py-1 text-[13px] font-bold",style:{backgroundColor:eb.soft,color:eb.color},children:"claude"===A?"Claude":"Codex"}),(0,U.jsx)("div",{className:"max-w-[360px] text-[12px] text-muted",children:s?a("draft.hintRelay"):ee?a("draft.hintNewStructured"):a("draft.hintNew")}),s?(0,U.jsx)("div",{className:"max-w-[420px] truncate font-mono text-[10px] text-muted",title:s,children:s}):null]})}),(0,U.jsxs)("form",{onSubmit:e=>{e.preventDefault(),eg()},className:"flex shrink-0 flex-col gap-1.5 border-t border-border bg-card px-2.5 py-2","aria-label":a("draft.promptAria"),children:["error"===R.status?(0,U.jsxs)("div",{role:"alert",className:"flex items-center justify-between gap-2 rounded-control bg-danger-soft px-2 py-1 text-caption text-danger",children:[(0,U.jsx)("span",{children:a("composer.imageCapabilityError")}),(0,U.jsx)("button",{type:"button",className:"shrink-0 rounded-control border border-danger/30 bg-card px-2 py-1 font-semibold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-danger/30",onClick:()=>{S({status:"loading",requestKey:P}),E(e=>e+1)},children:a("composer.imageCapabilityRetry")})]}):null,(0,U.jsx)(lC,{composer:ei,placeholder:ee?a("draft.placeholderStructured"):a("draft.placeholder"),textareaAriaLabel:a("draft.promptTextAria"),imageAriaLabel:a("draft.addImages"),sendLabelIdle:a("composer.launchAgent"),sendLabelRecording:a("draft.stopAndLaunch"),sendIdleClassName:"hover:opacity-90",sendIdleStyle:{backgroundColor:eb.color,borderColor:eb.color},imageDisabled:ef,imageDisabledReason:ex,leftSlot:(0,U.jsxs)("span",{className:"inline-flex min-w-0 items-center gap-1 rounded-control bg-sunken px-1.5 py-1 text-caption font-semibold text-secondary",title:ee?a("draft.newWindowTitleStructured"):a("draft.newWindowTitle"),children:[(0,U.jsx)(sx.jG,{className:"h-3 w-3 shrink-0","aria-hidden":!0})," ",a("draft.newAgent")]})})]})]})}function bA({open:e,onToggle:t}){let{t:n}=(0,eh.Ym)();return(0,U.jsxs)("button",{type:"button",onClick:t,"aria-pressed":e,"aria-label":n("orchPanel.toggleAria"),title:n("orchPanel.toggleAria"),"data-orchestrator-toggle":!0,className:`flex shrink-0 items-center gap-1 rounded-control border px-2.5 py-1 text-[11.5px] font-bold shadow-1 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${e?"border-accent/45 bg-accent/10 text-accent":"border-border bg-card text-primary hover:border-accent/45 hover:text-accent"}`,children:[(0,U.jsx)(dE.A,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",n("orchPanel.title")]})}function bI(e,t){return{mutation:{kind:"close",path:e},ephemeral:t.filter(t=>t!==e)}}function bM(e){return`llvReviewDeckCollapsed:${e}`}function bT(e){return"approved"===e.state||"done_comment"===e.state||"closed"===e.state}function bP(e){let t=e.rounds[e.rounds.length-1];return t?`r${t.n}:${t.reviewerConversationId??t.reviewerPath??"pending"}:${t.verdict??(t.error?"error":"open")}`:"empty"}function b$(e,t,n,r){e.setItem(bM(t),JSON.stringify({v:n,at:r}))}function bE({repoDir:e,onCreate:t,onCreated:n,onClose:r}){let{t:i}=(0,eh.Ym)(),[a,s]=(0,Y.useState)(e),[l,o]=(0,Y.useState)(0),[c,d]=(0,Y.useState)(()=>e.trim()?{phase:"checking"}:{phase:"blocked",code:"missing",path:""}),u=(0,Y.useRef)(0);(0,Y.useEffect)(()=>{let e=a.trim(),t=++u.current,n=new AbortController;return e&&xV(e,n.signal).then(e=>{t!==u.current||n.signal.aborted||(e.ok?d({phase:"ready",repoDir:e.repoDir}):d({phase:"blocked",code:e.code,path:e.path,error:e.error}))}).catch(n=>{t!==u.current||n instanceof DOMException&&"AbortError"===n.name||d({phase:"blocked",code:"missing",path:e,error:i("common.serverUnavailable")})}),()=>n.abort()},[a,l]);let p="creating"===c.phase,m="ready"===c.phase,f="ready"===c.phase||"creating"===c.phase?c.repoDir:a,h=async e=>{if("ready"!==c.phase)return;let r=c.repoDir;d({phase:"creating",repoDir:r});let i=await t(e,r);i.pipeline?n(i.pipeline):d({phase:"blocked",code:i.code??"missing",path:i.path??r,error:i.code?void 0:i.error})};(0,Y.useEffect)(()=>{let e=e=>{"Escape"!==e.key||p||(e.stopPropagation(),r())};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[p,r]);let x=xB.filter(e=>"blank"!==e.id),g="blocked"===c.phase?(c.path||f).trim():"",b="blocked"===c.phase?c.error??(g?i(`pipelinePreflight.${c.code}`,{path:g}):i("pipelinePreflight.empty")):null;return(0,U.jsx)("div",{"data-pipeline-picker-state":c.phase,className:"fixed inset-0 z-[70] flex items-end justify-center bg-black/40 sm:items-center",role:"presentation",onClick:e=>{e.target!==e.currentTarget||p||r()},children:(0,U.jsxs)("div",{role:"dialog","aria-modal":"true","aria-label":i("pipelineTemplates.title"),className:"w-full max-w-[460px] rounded-t-surface bg-card p-3 pb-[max(0.75rem,env(safe-area-inset-bottom))] shadow-2 sm:rounded-surface sm:pb-3",children:[(0,U.jsxs)("div",{className:"mb-1 flex items-center gap-2",children:[(0,U.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,U.jsx)("div",{className:"text-title font-bold text-primary",children:i("pipelineTemplates.title")}),(0,U.jsx)("div",{className:"text-ui text-muted",children:i("pipelineTemplates.subtitle")})]}),(0,U.jsx)("button",{type:"button",onClick:r,disabled:p,"aria-label":i("common.close"),className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-control border border-border bg-canvas text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:(0,U.jsx)(sx.X,{className:"h-4 w-4","aria-hidden":!0})})]}),(0,U.jsxs)("label",{className:"mb-2 flex flex-col gap-1",children:[(0,U.jsx)("span",{className:"text-label font-semibold text-secondary",children:i("pipelineTemplates.repoDir")}),(0,U.jsx)("input",{value:f,disabled:p,autoFocus:!e.trim(),onInput:e=>{let t=e.currentTarget.value;s(t),d(t.trim()?{phase:"checking"}:{phase:"blocked",code:"missing",path:""})},className:"h-11 w-full rounded-control border border-border bg-canvas px-3 text-ui font-semibold text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60"})]}),(0,U.jsxs)("div",{className:"mb-2 flex min-h-8 items-center gap-2 text-ui font-semibold text-muted","aria-live":"polite",children:["checking"===c.phase?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("span",{className:"h-3 w-3 animate-spin rounded-full border-2 border-accent border-r-transparent","aria-hidden":!0}),i("pipelineTemplates.checking")]}):null,"ready"===c.phase?(0,U.jsx)("span",{className:"text-success",children:i("pipelineTemplates.ready")}):null,"creating"===c.phase?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("span",{className:"h-3 w-3 animate-spin rounded-full border-2 border-accent border-r-transparent","aria-hidden":!0}),i("pipelineTemplates.creating")]}):null,"blocked"===c.phase?(0,U.jsxs)("span",{className:"flex w-full items-start gap-2 rounded-control border border-danger/30 bg-danger-soft px-2 py-1.5 text-danger",role:"alert",children:[(0,U.jsx)("span",{className:"min-w-0 flex-1",children:b}),(0,U.jsx)("button",{type:"button",className:"min-h-8 shrink-0 rounded-control border border-danger/30 px-2 text-label font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-danger/40",onClick:()=>{a.trim()&&d({phase:"checking"}),o(e=>e+1)},children:i("pipelineTemplates.retry")})]}):null]}),(0,U.jsxs)("div",{className:"flex flex-col gap-1",children:[x.map(e=>(0,U.jsxs)("button",{type:"button",disabled:!m,onClick:()=>void h(e),className:"flex min-h-11 w-full flex-col justify-center gap-1 rounded-control px-3 py-2 text-left hover:bg-sunken focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-50",children:[(0,U.jsx)("span",{className:"text-body font-semibold text-primary",children:i(e.labelKey)}),(0,U.jsx)("span",{className:"flex flex-wrap items-center gap-1","aria-hidden":!0,children:e.stages.map((e,t)=>(0,U.jsxs)("span",{className:"flex items-center gap-1",children:[t?(0,U.jsx)("span",{className:"text-label font-bold text-strong",children:"→"}):null,(0,U.jsxs)("span",{className:`rounded-full px-2 py-0.5 text-caption font-semibold ${"review-loop"===e.kind?"bg-accent-soft text-accent":"bg-sunken text-secondary"}`,children:["review-loop"===e.kind?"⟳ ":"",e.roleId||i("pipelineTemplates.noRole")]})]},t))})]},e.id)),(0,U.jsxs)("button",{type:"button",disabled:!m,onClick:()=>void h(null),className:"flex min-h-11 w-full flex-col justify-center gap-0.5 rounded-control border border-dashed border-strong px-3 py-2 text-left hover:bg-sunken focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-50",children:[(0,U.jsx)("span",{className:"text-body font-semibold text-primary",children:i("pipelineTemplates.blank")}),(0,U.jsx)("span",{className:"text-label text-muted",children:i("pipelineTemplates.blankHint")})]})]})]})})}function bR(e){let t=e.durableLineage?.parentConversationId??null;return t||(e.parentRemoved?.conversationId??null)}function bO(e){if(!e.endsWith(".jsonl"))return e;let t=e.lastIndexOf("/");return t<0?e:e.slice(t+1)}function bD(e){if(!e)return 0;let t=Date.parse(e);return Number.isFinite(t)?t/1e3:0}function bL(e,t,n){let r=(e,r)=>n.some(n=>e<n.x+n.w+16&&e+t.w+16>n.x&&r<n.y+n.h+16&&r+t.h+16>n.y),i=Math.round(e.x),a=Math.round(e.y);if(!r(i,a))return{x:i,y:a};for(let e=1;e<=40;e+=1)for(let t=-e;t<=e;t+=1)for(let n=-e;n<=e;n+=1){if(Math.max(Math.abs(t),Math.abs(n))!==e)continue;let s=i+24*t,l=a+24*n;if(!r(s,l))return{x:s,y:l}}return{x:i+984,y:a+984}}function b_(e){return"unplaced"!==e.placement&&void 0!==e.pos}let bF=Math.max(1,Math.floor(236/13));function bq(e){let t=1,n=0;for(let r of e.match(/\s+|\S+/g)??[]){if(/\s/.test(r)){for(let e of r)n+=" "===e?40:5;for(;n>236;)t++,n-=236;continue}let e=13*r.length;if(e<=236)n>0&&n+e>236?(t++,n=e):n+=e;else{n>0&&t++;let e=Math.ceil(r.length/bF);t+=e-1,n=(r.length-(e-1)*bF)*13}}return t}function bz(e){let t=e.split(/\r\n?|\n/),n=bq(t[0]??""),r=0;for(let e=1;e<t.length;e+=1)r+=bq(t[e]);return{title:n,rest:r}}function bH(e,t=!1){let n=bz(e.text),r=n.title>2||n.rest>3,i=t&&r?n.title+n.rest:Math.min(n.title,2)+Math.min(n.rest,3),a=e.assignments.length+ +!!e.source;return Math.max(64,6+(17*i+20)+(a?28*a+8:0)+32*!!r)}function bU(e,t=!1){return bH(e,t)+36}function bB(e,t=!1){return{x:e.pos.x,y:e.pos.y,w:260,h:bU(e,t)}}function bK(e){return{x:e.x+e.w/2,y:e.y+e.h/2}}function bY(e,t){let{x:n,y:r}=bK(e),i=t.x-n,a=t.y-r;if(!i&&!a)return{x:n,y:r};let s=Math.min(i?e.w/2/Math.abs(i):1/0,a?e.h/2/Math.abs(a):1/0,1);return{x:n+i*s,y:r+a*s}}function bW(e,t,n,r,i){let a=1-e;return a*a*a*t+3*a*a*e*n+3*a*e*e*r+e*e*e*i}function bV(e,t,n,r,i,a){let s=i.x-a,l=i.y-a,o=i.x+i.w+a,c=i.y+i.h+a,d=n-e,u=r-t,p=[-d,d,-u,u],m=[e-s,o-e,t-l,c-t],f=0,h=1;for(let e=0;e<4;e++)if(0===p[e]){if(m[e]<0)return!1}else{let t=m[e]/p[e];if(p[e]<0){if(t>h)return!1;t>f&&(f=t)}else{if(t<f)return!1;t<h&&(h=t)}}return f<=h}function bJ(e,t,n,r,i,a,s,l,o){if(!o.length)return!1;let c=Math.min(e,n,i,s)-10,d=Math.max(e,n,i,s)+10,u=Math.min(t,r,a,l)-10,p=Math.max(t,r,a,l)+10,m=[];for(let e of o)e.x<=d&&e.x+e.w>=c&&e.y<=p&&e.y+e.h>=u&&m.push(e);if(!m.length)return!1;let f=Math.max(8,Math.min(128,Math.ceil((Math.hypot(n-e,r-t)+Math.hypot(i-n,a-r)+Math.hypot(s-i,l-a))/24))),h=e,x=t;for(let o=1;o<=f;o++){let c=o/f,d=bW(c,e,n,i,s),u=bW(c,t,r,a,l);for(let e of m)if(bV(h,x,d,u,e,10))return!0;h=d,x=u}return!1}let bG=(e,t,n)=>e+(t-e)*n;function bQ(e,t,n=0){let{x1:r,y1:i,x2:a,y2:s}=e,l=a-r,o=s-i,c=Math.abs(o)>Math.abs(l),d=(r+a)/2,u=(i+s)/2,p=Math.hypot(l,o)||1,m=-o/p,f=l/p,h=26*n,x=c?{c1x:r+m*h,c1y:u+f*h,c2x:a+m*h,c2y:u+f*h}:{c1x:d+m*h,c1y:i+f*h,c2x:d+m*h,c2y:s+f*h},g=e=>({d:`M ${r} ${i} C ${e.c1x} ${e.c1y}, ${e.c2x} ${e.c2y}, ${a} ${s}`,mid:{x:bW(.5,r,e.c1x,e.c2x,a),y:bW(.5,i,e.c1y,e.c2y,s)},crosses:!1});if(!t.length||!bJ(r,i,x.c1x,x.c1y,x.c2x,x.c2y,a,s,t))return g(x);for(let e=40;e<=260;e+=40)for(let n of[1,-1]){let l=e*n,o={c1x:x.c1x+m*l,c1y:x.c1y+f*l,c2x:x.c2x+m*l,c2y:x.c2y+f*l};if(!bJ(r,i,o.c1x,o.c1y,o.c2x,o.c2y,a,s,t))return g(o)}let b=function(e,t,n){let{x1:r,y1:i,x2:a,y2:s}=e,l=t.filter(e=>bV(r,i,a,s,e,10));if(!l.length)return null;let o=1/0,c=1/0,d=-1/0,u=-1/0;for(let e of l)o=Math.min(o,e.x),c=Math.min(c,e.y),d=Math.max(d,e.x+e.w),u=Math.max(u,e.y+e.h);let p={x:o,y:c,w:d-o,h:u-c},m=Math.abs(s-i)>=Math.abs(a-r),f=26*n;for(let n of(m?(r+a)/2:(i+s)/2)<=(m?p.x+p.w/2:p.y+p.h/2)?[-1,1]:[1,-1])for(let r=16;r<=256;r+=40){let i=m?function(e,t,n,r,i){let{x1:a,y1:s,x2:l,y2:o}=e,c=n<0?t.x-r-i:t.x+t.w+r+i,d=t.y-r,u=t.y+t.h+r,p=s<=o?d:u,m=s<=o?u:d;return[{x1:a,y1:s,c1x:c,c1y:s,c2x:c,c2y:p,x2:c,y2:p},{x1:c,y1:p,c1x:c,c1y:bG(p,m,1/3),c2x:c,c2y:bG(p,m,2/3),x2:c,y2:m},{x1:c,y1:m,c1x:c,c1y:o,c2x:l,c2y:o,x2:l,y2:o}]}(e,p,n,r,f):function(e,t,n,r,i){let{x1:a,y1:s,x2:l,y2:o}=e,c=n<0?t.y-r-i:t.y+t.h+r+i,d=t.x-r,u=t.x+t.w+r,p=a<=l?d:u,m=a<=l?u:d;return[{x1:a,y1:s,c1x:a,c1y:c,c2x:p,c2y:c,x2:p,y2:c},{x1:p,y1:c,c1x:bG(p,m,1/3),c1y:c,c2x:bG(p,m,2/3),c2y:c,x2:m,y2:c},{x1:m,y1:c,c1x:l,c1y:c,c2x:l,c2y:o,x2:l,y2:o}]}(e,p,n,r,f);if(!function(e,t){for(let n of e)if(bJ(n.x1,n.y1,n.c1x,n.c1y,n.c2x,n.c2y,n.x2,n.y2,t))return!0;return!1}(i,t)){let e=i[1],t=m?{axis:"v",pos:e.x1,lo:Math.min(e.y1,e.y2),hi:Math.max(e.y1,e.y2)}:{axis:"h",pos:e.y1,lo:Math.min(e.x1,e.x2),hi:Math.max(e.x1,e.x2)};return{d:function(e){let t=e[0],n=`M ${t.x1} ${t.y1}`;for(let t of e)n+=` C ${t.c1x} ${t.c1y}, ${t.c2x} ${t.c2y}, ${t.x2} ${t.y2}`;return n}(i),mid:function(e){let t=e[Math.floor(e.length/2)];return{x:bW(.5,t.x1,t.c1x,t.c2x,t.x2),y:bW(.5,t.y1,t.c1y,t.c2y,t.y2)}}(i),crosses:!1,corridor:t}}}return null}(e,t,n);return b||{...g(x),crosses:!0}}function bX(e,t){let n=(t,n)=>t>=e.x&&t<=e.x+e.w&&n>=e.y&&n<=e.y+e.h;return n(t.x1,t.y1)||n(t.x2,t.y2)}function bZ(e,t,n){let r=[];for(let n of t)n.id===e.taskId||bX(n,e)||r.push({x:n.x,y:n.y,w:n.w,h:n.h});for(let t of n)bX(t,e)||r.push({x:t.x,y:t.y,w:t.w,h:t.h});return r}function b0(e,t,n,r,i,a){return Math.abs((e-n)*a-(t-r)*i)}function b1(e){let t=e.replace(/[MC,]/g," ").trim().split(/\s+/).map(Number),n=[],r=t[0],i=t[1];for(let e=2;e+6<=t.length;e+=6)n.push({x1:r,y1:i,c1x:t[e],c1y:t[e+1],c2x:t[e+2],c2y:t[e+3],x2:t[e+4],y2:t[e+5]}),r=t[e+4],i=t[e+5];return n}function b2(e){return{minX:Math.min(e.x1,e.c1x,e.c2x,e.x2),maxX:Math.max(e.x1,e.c1x,e.c2x,e.x2),minY:Math.min(e.y1,e.c1y,e.c2y,e.y2),maxY:Math.max(e.y1,e.c1y,e.c2y,e.y2)}}function b5(e){let t=1/0,n=1/0,r=-1/0,i=-1/0;for(let a of e){let e=b2(a);e.minX<t&&(t=e.minX),e.maxX>r&&(r=e.maxX),e.minY<n&&(n=e.minY),e.maxY>i&&(i=e.maxY)}return{minX:t,minY:n,maxX:r,maxY:i}}function b4(e,t){return e.minX<=t.maxX&&t.minX<=e.maxX&&e.minY<=t.maxY&&t.minY<=e.maxY}function b3(e,t){let n=e=>[{x:e.x1,y:e.y1},{x:e.x2,y:e.y2}],r=[];for(let i of n(e))for(let e of n(t))Math.round(i.x)===Math.round(e.x)&&Math.round(i.y)===Math.round(e.y)&&r.push(i);return r}function b6(e){let t=(e.x1+e.c1x)/2,n=(e.y1+e.c1y)/2,r=(e.c1x+e.c2x)/2,i=(e.c1y+e.c2y)/2,a=(e.c2x+e.x2)/2,s=(e.c2y+e.y2)/2,l=(t+r)/2,o=(n+i)/2,c=(r+a)/2,d=(i+s)/2,u=(l+c)/2,p=(o+d)/2;return[{x1:e.x1,y1:e.y1,c1x:t,c1y:n,c2x:l,c2y:o,x2:u,y2:p},{x1:u,y1:p,c1x:c,c1y:d,c2x:a,c2y:s,x2:e.x2,y2:e.y2}]}function b8(e){let t=e.x2-e.x1,n=e.y2-e.y1,r=Math.hypot(t,n);if(0===r)return!0;let i=Math.abs((e.c1x-e.x1)*n-(e.c1y-e.y1)*t)/r,a=Math.abs((e.c2x-e.x1)*n-(e.c2y-e.y1)*t)/r;return i<=.1&&a<=.1}function b7(e,t,n){for(let r of e)for(let e of t)if(function e(t,n,r,i){if(!b4(b2(t),b2(n)))return!1;let a=b8(t),s=b8(n);if(a&&s||i<=0){let e=function(e,t,n,r){let i=t.x-e.x,a=t.y-e.y,s=r.x-n.x,l=r.y-n.y,o=i*l-a*s;if(0===o)return null;let c=n.x-e.x,d=n.y-e.y,u=(c*l-d*s)/o,p=(c*a-d*i)/o;return u<0||u>1||p<0||p>1?null:{x:e.x+u*i,y:e.y+u*a}}({x:t.x1,y:t.y1},{x:t.x2,y:t.y2},{x:n.x1,y:n.y1},{x:n.x2,y:n.y2});return!!e&&!r.some(t=>2>=Math.abs(t.x-e.x)&&2>=Math.abs(t.y-e.y))}let l=a?[t]:b6(t),o=s?[n]:b6(n);for(let t of l)for(let n of o)if(e(t,n,r,i-1))return!0;return!1}(r,e,n,26))return!0;return!1}let b9=[1,-1,2,-2,3,-3];function ve(e){let t=new Set,n=new Set;for(let r of(e.srcPath&&t.add(e.srcPath),e.srcConversationId&&n.add(e.srcConversationId),e.runs))for(let e of r.attempts)e.agentPath&&t.add(e.agentPath),e.conversationId&&n.add(e.conversationId);return{paths:t,conversationIds:n}}function vt(e,t,n,r=[],i=[],a=[],s=[],l=new Set,o=new Set,c=[],d=new Set,u={}){let p=new Map(n.map(e=>[e.path,e])),m=function(e){let t=new Map(e.map(e=>[e.path,e])),n=function(e){let t=new Map;for(let n of e){let e=W(n),r=t.get(e);if(!r){t.set(e,n);continue}let i=e=>V(e)?-1:e.generation??0;(i(n)>i(r)||i(n)===i(r)&&n.mtime>r.mtime||i(n)===i(r)&&n.mtime===r.mtime&&n.path<r.path)&&t.set(e,n)}return new Map([...t].map(([e,t])=>[e,t.path]))}(e),r=new Map,i=new Map;for(let a of e){let e=bR(a);if(e){let t=n.get(e)??null;if(t===a.path)continue;null===t?i.set(a.path,e):r.set(a.path,{parentConversationId:e,parentPath:t,source:"durable"});continue}let s=a.parent;if(!s||s===a.path)continue;let l=t.get(s);l&&r.set(a.path,{parentConversationId:W(l),parentPath:l.path,source:"transcript"})}let a=new Map;for(let e of[...r.keys()].sort()){if("done"===a.get(e))continue;let t=[],n=e;for(;n&&"done"!==a.get(n);){if("visiting"===a.get(n)){let e=t.slice(t.indexOf(n));r.delete([...e].sort().at(-1));break}a.set(n,"visiting"),t.push(n),n=r.get(n)?.parentPath??null}for(let e of t)a.set(e,"done")}let s=new Map,l=e=>{let t=s.get(e);if(t)return t;let n=[],i=new Set([e]),a=r.get(e)?.parentPath??null;for(;a&&!i.has(a);)i.add(a),n.push(a),a=r.get(a)?.parentPath??null;return s.set(e,n),n},o=e=>{let t=l(e);return i.get(t.at(-1)??e)??null};return{linkOf:e=>r.get(e)??null,parentPathOf:e=>r.get(e)?.parentPath??null,ancestorsOf:l,depthOf:e=>l(e).length+ +!!o(e),isAncestorOf:(e,t)=>l(t).includes(e),resolveHost:(e,t)=>{let n=[];for(let r of l(e)){if(t.has(r))return{host:r,elided:n,unresolvedParentId:null};n.push(r)}return{host:null,elided:n,unresolvedParentId:o(e)}},orderKey:e=>[...l(e)].reverse().concat(e).join("\x01")}}(n),f=eR(n),h=[],x=[],g=[],b=[],v=[],w=e6(r),y=e8(r,n),k=r.filter(e=>!tv(e)),j=100,N=new Map,S=e=>r.find(t=>t.id===e)?.implementerPath??null;for(let e of a){if("closed"===e.state&&!e.restored)continue;let t="pipe:"+e.id;for(let n of e.runs)for(let e of n.attempts)if(e.agentPath&&N.set(e.agentPath,t),e.flowId){let n=S(e.flowId);n&&N.set(n,t)}}for(let e of k){let t="flow:"+e.id;for(let n of(N.has(e.implementerPath)||N.set(e.implementerPath,t),e.rounds))n.reviewerPath&&!N.has(n.reviewerPath)&&N.set(n.reviewerPath,t)}let C=new Map,A=e=>{let t=C.get(e.path);if(t)return t;let r=new Set,i=N.get(e.path);for(let t of(i&&r.add(i),eq(e,n,()=>!0))){let e=N.get(t.file.path);e&&r.add(e)}return C.set(e.path,r),r},I=(e,t)=>{let n=A(e),r=A(t);if(0===n.size||0===r.size)return!1;if(n.size!==r.size)return!0;for(let e of n)if(!r.has(e))return!0;return!1},M=new Set([...e.flatMap(e=>e.columns.map(e=>e.file.path)),...t.map(e=>e.path)]),T=new Set;for(let e of w.values())M.has(e.implementerPath)&&T.add(e.id);let P=new Map,$=new Map,E=[],R=new Map;{let e=new Set(s.map(e=>e.id)),t=new Set,r=[...s,...a].filter(e=>!("closed"===e.state||t.has(e.id))&&(t.add(e.id),!0)),i=u.now??0,l=u.ageHorizonSeconds??ek(),o=function(e){let t=new Map,n=new Map;for(let r of e){t.set(r.path,r);let e=bO(r.path);if(e===r.path)continue;let i=n.get(e);void 0===i?n.set(e,r):i&&i.path!==r.path&&n.set(e,null)}return e=>t.get(e)??n.get(bO(e))??void 0}(n),m=new Set([...M].map(bO)),f=e=>{if(function(e,t){let{now:n,ageHorizonSeconds:r,fileAt:i}=t;if(n<=0)return!0;let a=0;for(let t of[e.createdAt,e.closedAt,e.pausedAt,e.resumedAt])a=Math.max(a,bD(t));for(let t of e.runs)for(let e of t.attempts){a=Math.max(a,bD(e.startedAt),bD(e.completedAt));let t=e.agentPath?i(e.agentPath):void 0;if(t){if("live"===t.activity||"running"===t.proc||"recent"===t.activity)return!0;a=Math.max(a,t.mtime)}}return 0===a||n-a<=r}(e,{now:i,ageHorizonSeconds:l,fileAt:o}))return!1;for(let t of e.runs)for(let e of t.attempts){if(e.agentPath&&m.has(bO(e.agentPath)))return!1;let t=e.flowId?S(e.flowId):null;if(t&&m.has(bO(t)))return!1}return!0},h=new Set;for(let[t,n]of r.entries()){if(n.stages.forEach((e,r)=>{let i=xc(n,e.id),a="review-loop"===e.kind&&i?.flowId?S(i.flowId):null;for(let e of[i?.agentPath??null,a])e&&!R.has(e)&&R.set(e,1e4*t+r)}),f(n))continue;let r=new Set((function(e,t=new Set,n=new Set){return xb.has(e.state)?e.stages.filter(r=>{let i=xc(e,r.id);return i?!xQ(e,r,t,n)&&("needs_decision"===e.state&&e.cursor?.stageId===r.id||xv.has(i.state)):0===xg(e,r.id).length}):[]})(n,M,T).map(e=>e.id)),i=xb.has(n.state),a=[],s=new Set,l=null;for(let e=0;e<n.stages.length;e+=1){let t=n.stages[e],o=xc(n,t.id),c=o?.agentPath??null;if(c&&M.has(c)){s.add(c),l=c,a.push({kind:"node",index:e,path:c});continue}let d="review-loop"===t.kind&&o?.flowId?S(o.flowId):null;if(d&&M.has(d)){s.add(d),l=d,a.push({kind:"node",index:e,path:d});continue}if(r.has(t.id)){a.push({kind:"slot",index:e,slotStage:{stage:t,index:e,presentation:"placeholder"}});continue}if(!i||t.id===n.cursor?.stageId)continue;let u=xg(n,t.id).findLast(e=>e.agentPath||e.flowId);u&&a.push({kind:"slot",index:e,slotStage:{stage:t,index:e,presentation:"completed",attempt:u}})}if(!e.has(n.id)&&!s.size)continue;let o=a.filter(e=>"slot"===e.kind).length,u=(function(e,t){let n=new Set(e.taskIds??[]),r=ve(e);return t.filter(e=>n.has(e.id)||!!(e.source&&r.paths.has(e.source.path)||e.assignments.some(e=>!!(e.path&&r.paths.has(e.path)||e.conversationId&&r.conversationIds.has(e.conversationId)))))})(n,c).filter(e=>b_(e)&&!h.has(e.id)).map(e=>({task:e,h:bU(e,d.has(e.id))})),m=null;for(let e of a){if("node"!==e.kind)continue;let t=p.get(e.path)?.parent??null;if(t&&M.has(t)){m=t;break}}!m&&!l&&n.srcPath&&M.has(n.srcPath)&&(m=n.srcPath);let x=null!==m&&a.some(e=>"node"===e.kind&&(p.get(e.path)?.parent??null)!==m);if(!o&&!u.length&&!x)continue;for(let{task:e}of u)h.add(e.id);let g={pipeline:n,entries:a,tasks:u,placed:!1};if(E.push(g),m){let e=P.get(m);e?e.push(g):P.set(m,[g])}else if(l){let e=$.get(l);e?e.push(g):$.set(l,[g])}}}let O=[],D=[],L=new Map,_=e=>{let t=L.get(e);if(t)return t;let n=[];return L.set(e,n),n},F=(e,t,n,r,i)=>{let{stage:a,index:s,presentation:l,attempt:o}=t,c=null!==i&&e.pipeline.stages[s-1]?.id===i.stage.id,d=xF(e.pipeline,a,l),u=d?96:620,p=i&&xF(e.pipeline,i.stage,i.presentation)?96:620,m={key:x8(e.pipeline.id,a.id),pipeline:e.pipeline,stage:a,index:s,total:e.pipeline.stages.length,presentation:l,...o?{attempt:o}:{},...c?{incoming:a.kind,incomingAnchorY:Math.min(110,Math.round(Math.min(p,u)/2))}:{},...d?{collapsedRow:!0}:{},x:n,y:r,w:600,h:u};O.push(m),_(e.pipeline.id).push(m.key)},q=(e,t,n,r,i)=>{let a={key:"task::"+t.id,taskId:t.id,pipelineId:e.pipeline.id,x:r,y:i,w:260,h:n};D.push(a),_(e.pipeline.id).push(a.key)},z=(e,t,n)=>{e.placed=!0;let r=t,i=null;for(let t of e.entries)"slot"===t.kind&&(F(e,t.slotStage,r,n,i),i=t.slotStage,r+=672);for(let{task:t,h:i}of e.tasks)q(e,t,i,r,n),r+=332;return r-72},H=new Map,U=new Set,B=[],K=new Map;for(let e of i){let t=bk(e);if(!t)continue;let n=K.get(t);n?n.push(e):K.set(t,[e])}let Y=new Set,J=e=>({file:e,branches:f.get(e.path)?.length??0}),G=(e,t,r,i,a,s)=>{let l=(e,s,o,c)=>{let d=0===c?780:680;h.push({file:e.file,tasks:e.tasks,under:i.get(e.file.path)??[],x:s,y:o,w:600,h:d,isRoot:e.file.path===a});let u=w.get(e.file.path),p=d;if(u){var m;let e,t,r=(m=s+600+170,e=u.rounds.flatMap(e=>{let t=e9(u,e,n);return t.length?t.map(t=>({key:`round:${e.n}:${t.conversationId??t.path}`,round:e,file:t})):[{key:`round:${e.n}:${e.reviewerBindingId??"pending"}`,round:e,file:null}]}),t={key:x6(u.id),flow:u,rounds:e,x:m,y:o,w:600,h:d+30*Math.min(Math.max(e.length-1,0),6)},b.push(t),t);v.push({key:"loop::"+u.id,flow:u,x1:s+600,x2:r.x,y:o}),p=Math.max(p,r.h)}let f=t.get(e.file.path)??[],k=N.get(e.file.path)??null,S=o+p+(null!==k&&f.some(e=>{for(let t of A(e.file))if(t!==k)return!0;return!1})?184:130),C=s+64,M=(t,n)=>(x.push({to:t.file.path,from:e.file.path,sourceConversationId:W(e.file),targetConversationId:W(t.file),x1:s+40,y1:o+d,x2:n+300,y2:S,color:(0,tw.yj)(t.file),live:"live"===t.file.activity}),l(t,n,S,c+1)),T=P.get(e.file.path)??[],E=new Set;for(let e of T)for(let t of e.entries)"node"===t.kind&&E.add(t.path);let R=new Map(f.map(e=>[e.file.path,e]));for(let e of T){e.placed=!0;let t=e.entries[0]?.index??0,n=C,r=C,i=null;for(let a of e.entries){let s=Math.max(n+(a.index-t)*672,r);if("slot"===a.kind)F(e,a.slotStage,s,S,i),i=a.slotStage,r=s+600+72;else{let e=R.get(a.path);if(e){let t=M(e,s);r=s+Math.max(t,600)+72;continue}let t=H.get(a.path);if(!t||U.has(a.path))continue;U.add(a.path);let n=j;j=s,"group"===t.kind?Q(t.group,S):X(t.file,S);let i=j-150-s;j=n,r=s+Math.max(i,600)+72}}for(let{task:t,h:n}of e.tasks)q(e,t,n,r,S),r+=332;C=r-72+140}for(let t of $.get(e.file.path)??[])C=z(t,C,S)+140;let O=f.filter(e=>!E.has(e.file.path));for(let e=0;e<O.length;e+=1){let t=O[e],n=O[e+1],r=n&&I(t.file,n.file)?140:48;C+=M(t,C)+r}let D=r.get(e.file.path)?.filter(e=>!y.has(e.path));for(let t of(D?.length&&(g.push({key:e.file.path+"::stack",parent:e.file.path,items:D.map(J),x:C,y:S,w:360,h:16+58*Math.min(D.length,8)-6}),x.push({to:e.file.path+"::stack",x1:s+40,y1:o+d,x2:C+180,y2:S,color:"var(--color-muted)",live:!1,dashed:!0}),C+=408),K.get(e.file.path)??[]))Y.add(t),B.push({key:"draft::"+t,id:t,src:e.file.path,x:C,y:S,w:600,h:680}),x.push({to:"draft::"+t,x1:s+40,y1:o+d,x2:C+300,y2:S,color:"var(--color-accent)",live:!1,dashed:!0}),C+=648;let L=C-48-(s+64);return Math.max(L>0?Math.max(600,64+L):600,u?1370:600)};return l(e,j,s,0)},Q=(e,t)=>{let n=e.columns;if(!n.length)return;let r=new Set(n.map(e=>e.file.path)),i=e=>m.resolveHost(e.path,r).host,a=new Map,s=[];for(let e of n){let t=i(e.file);if(!t){s.push(e);continue}let n=a.get(t);n?n.push(e):a.set(t,[e])}s.length||s.push(n[0]);let l=s[0].file.path,o=new Map,c=[];for(let t of[...e.returnable,...e.finished])if(!y.has(t.path))if(eA(t)){let e=i(t)??l,n=o.get(e);n?n.push(t):o.set(e,[t])}else c.push(t);let d=new Map([[l,c]]);for(let e of s)j+=G(e,a,o,d,e.file.path,t)+150},X=(e,t)=>{let r=o.has(e.path)?[]:(function(e,t){if(!e)return[];let n=eM(e);return eq(e,t,e=>eM(e)===n)})(e,n).map(e=>e.file).filter(e=>!y.has(e.path)),i=r.filter(e=>eA(e)),a=r.filter(e=>!eA(e));j+=G({file:e,tasks:[]},new Map,new Map(i.length?[[e.path,i]]:[]),new Map([[e.path,a]]),e.parent?"":e.path,t)+150},Z=e=>l.has(W(e)),ee=[],et=[];for(let t of e){let e=t.columns[0]?.file;(e&&Z(e)?ee:et).push(t)}let en=[],er=[];for(let e of t)(Z(e)?en:er).push(e);ee.sort((e,t)=>t.columns[0].file.mtime-e.columns[0].file.mtime),en.sort((e,t)=>t.mtime-e.mtime);let ei=e=>{if(e.pendingQuestion||e.waitingInput)return 5;let t=N.get(e.path);if(t?.startsWith("pipe:")){let e=a.find(e=>e.id===t.slice(5));if(e?.state==="needs_decision"||e?.state==="paused")return 4}if(t?.startsWith("flow:")){let e=k.find(e=>e.id===t.slice(5));if(e?.state==="needs_decision"||e?.state==="paused")return 4}if("live"===e.activity||"stalled"===e.activity||"running"===e.proc)return 3;if(t?.startsWith("pipe:")){let e=a.find(e=>e.id===t.slice(5));if(e&&"closed"!==e.state)return 1}if(t?.startsWith("flow:")){let e=k.find(e=>e.id===t.slice(5));if(e&&"closed"!==e.state)return 1}return 0},ea=e=>Math.max(0,...e.columns.map(e=>ei(e.file)));et.sort((e,t)=>ea(t)-ea(e)||t.columns[0].file.mtime-e.columns[0].file.mtime||e.key.localeCompare(t.key)),er.sort((e,t)=>ei(t)-ei(e)||t.mtime-e.mtime||e.path.localeCompare(t.path));let es=ee.length+en.length>0;{let e=new Map(et.map(e=>[e.key,e])),t=new Map(er.map(e=>[e.path,e])),n=new Map;for(let e of[...ee,...et])for(let t of e.columns)n.set(t.file.path,e.key);for(let e of[...en,...er])n.set(e.path,e.path);for(let[r,i]of P){let a=n.get(r)??r;for(let n of i)for(let r of n.entries){if("node"!==r.kind||r.path===a||H.has(r.path))continue;let n=e.get(r.path);if(n&&n.key!==a){H.set(r.path,{kind:"group",group:n,hostRootKey:a});continue}let i=t.get(r.path);i&&i.path!==a&&H.set(r.path,{kind:"manual",file:i,hostRootKey:a})}}for(let[e,t]of[...H]){let n=new Set([e]),r=t.hostRootKey;for(;r&&H.has(r);){if(n.has(r)){H.delete(e);break}n.add(r),r=H.get(r)?.hostRootKey}}}for(let e of ee)Q(e,100);for(let e of en)X(e,100);let el=100;if(es){for(let e of h)el=Math.max(el,e.y+e.h);for(let e of b)el=Math.max(el,e.y+e.h);for(let e of g)el=Math.max(el,e.y+e.h);for(let e of B)el=Math.max(el,e.y+e.h);for(let e of O)el=Math.max(el,e.y+e.h);for(let e of D)el=Math.max(el,e.y+e.h)}let eo=es?el+220:100,ec=e=>{let t=0;for(let n of h.slice(e.nodes))t=Math.max(t,n.y+n.h);for(let n of g.slice(e.stacks))t=Math.max(t,n.y+n.h);for(let n of b.slice(e.decks))t=Math.max(t,n.y+n.h);for(let n of B.slice(e.drafts))t=Math.max(t,n.y+n.h);for(let n of O.slice(e.slots))t=Math.max(t,n.y+n.h);for(let n of D.slice(e.regionTasks))t=Math.max(t,n.y+n.h);return t},ed=eo,eu=eo,ep=100;j=100;let em=e=>{let t={nodes:h.length,edges:x.length,stacks:g.length,decks:b.length,loops:v.length,drafts:B.length,slots:O.length,regionTasks:D.length},n=j;for(let t of e)t(ed);let r=j;if(n>ep&&r-150>10600){let e=eu+160;var i=100-n,a=e-ed;for(let e of h.slice(t.nodes))e.x+=i,e.y+=a;for(let e of x.slice(t.edges))e.x1+=i,e.x2+=i,e.y1+=a,e.y2+=a;for(let e of g.slice(t.stacks))e.x+=i,e.y+=a;for(let e of b.slice(t.decks))e.x+=i,e.y+=a;for(let e of v.slice(t.loops))e.x1+=i,e.x2+=i,e.y+=a;for(let e of B.slice(t.drafts))e.x+=i,e.y+=a;for(let e of O.slice(t.slots))e.x+=i,e.y+=a;for(let e of D.slice(t.regionTasks))e.x+=i,e.y+=a;j=100+(r-n),ed=e,ep=100,eu=ec(t);return}eu=Math.max(eu,ec(t))},ef=e=>{let t=e.flatMap(e=>{let t=R.get(e);return void 0===t?[]:[t]});return t.length?Math.min(...t):null},eh=[...et.filter(e=>!H.has(e.key)).map(e=>({keys:new Set(e.columns.flatMap(e=>[...A(e.file)])),stageRank:ef(e.columns.map(e=>e.file.path)),place:t=>Q(e,t)})),...er.filter(e=>!H.has(e.path)).map(e=>({keys:A(e),stageRank:ef([e.path]),place:t=>X(e,t)}))],ex=[];for(let e of eh){let t=[];for(let n of ex)for(let r of e.keys)if(n.keys.has(r)){t.push(n);break}let[n]=t;if(!n){ex.push({keys:new Set(e.keys),items:[e]});continue}for(let t of(n.items.push(e),e.keys))n.keys.add(t);for(let e of t.slice(1)){for(let t of(n.items.push(...e.items),e.keys))n.keys.add(t);ex.splice(ex.indexOf(e),1)}}let eg=e=>{let t=e.filter(e=>null!==e.stageRank).sort((e,t)=>e.stageRank-t.stageRank);if(t.length<2)return[...e];let n=0;return e.map(e=>null===e.stageRank?e:t[n++])};for(let e of ex)em(eg(e.items).map(e=>e.place));for(let e of i)Y.has(e)||em([t=>{B.push({key:"draft::"+e,id:e,x:j,y:t,w:600,h:780}),j+=750}]);{let e=0;for(let t of[...h,...g,...b,...B,...O,...D])e=Math.max(e,t.y+t.h);let t=100,n=e>0?e+160:eo;for(let e of E)e.placed||(t=z(e,t,n)+150)}let eb=0,ev=0;for(let e of h)eb=Math.max(eb,e.y+e.h),ev=Math.max(ev,e.x+e.w);for(let e of g)eb=Math.max(eb,e.y+e.h),ev=Math.max(ev,e.x+e.w);for(let e of b)eb=Math.max(eb,e.y+e.h),ev=Math.max(ev,e.x+e.w);for(let e of B)eb=Math.max(eb,e.y+e.h),ev=Math.max(ev,e.x+e.w);for(let e of O)eb=Math.max(eb,e.y+e.h),ev=Math.max(ev,e.x+e.w);for(let e of D)eb=Math.max(eb,e.y+e.h),ev=Math.max(ev,e.x+e.w);let ew=ge(h.map(e=>e.file.path),b.map(e=>({key:e.key,flow:e.flow})),g.map(e=>({key:e.key,paths:e.items.map(e=>e.file.path)})));for(let e of O)ew.set(e.key,e.key);let ey=new Set(h.map(e=>e.file.path)),ej=new Map(h.map(e=>[e.file.path,e]));for(let e of h){let t=m.resolveHost(e.file.path,ey);e.ancestry={hostPath:t.host,elided:t.elided.map(e=>p.get(e)).filter(e=>!!e),unresolvedParentId:t.unresolvedParentId,depth:m.depthOf(e.file.path)},e.lineageOrderKey=m.orderKey(e.file.path)}let eN=new Set,eS=[];for(let e of x){let t=ej.get(e.to);if(!t){eS.push(e);continue}let n=t.ancestry?.hostPath??null;if(!n||e.from!==n||eN.has(e.to))continue;let r=t.ancestry?.elided??[];eS.push(r.length?{...e,via:r,dashed:!0}:e),eN.add(e.to)}for(let e of h){let t=e.ancestry?.hostPath;if(!t||eN.has(e.file.path))continue;let n=ej.get(t);n&&(eS.push({to:e.file.path,from:n.file.path,sourceConversationId:W(n.file),targetConversationId:W(e.file),x1:n.x+40,y1:n.y+n.h,x2:e.x+e.w/2,y2:e.y,color:(0,tw.yj)(e.file),live:"live"===e.file.activity,dashed:!0,via:e.ancestry?.elided??[]}),eN.add(e.file.path))}for(let e of(x.length=0,eS))x.push(e);let eC=new Map([...h.map(e=>[e.file.path,e]),...B.map(e=>[e.key,e]),...g.map(e=>[e.key,e]),...b.map(e=>[e.key,e]),...O.map(e=>[e.key,e]),...D.map(e=>[e.key,e])]),eI=e=>r.find(t=>t.id===e)?.implementerPath??null,eT=new Map(b.map(e=>[e.flow.implementerPath,e.key])),eP=e=>{let t=[],n=eT.get(e);for(let r of(n&&t.push(n),eC.has(e+"::stack")&&t.push(e+"::stack"),K.get(e)??[]))eC.has("draft::"+r)&&t.push("draft::"+r);return t},e$=(e,t)=>{let n=new Set(e),r=new Set,i=e=>{if(!r.has(e))for(let a of(r.add(e),f.get(e)??[])){let e=N.get(a.path);if(!e||e===t){if(ey.has(a.path))for(let e of(n.add(a.path),eP(a.path)))n.add(e);i(a.path)}}};for(let t of e)if(p.get(t)){for(let e of eP(t))n.add(e);i(t)}return[...n]},eE=e=>e.pipeline?(0,tw.cr)(e.pipeline.task,60):e.flow?(0,tw.cr)(p.get(e.flow.implementerPath)?.title??e.flow.project,60):e.key,eO=function(e,t,n,r=()=>null){let i=[],a=new Set;for(let e of t)if("closed"!==e.state||e.restored)for(let t of e.runs)for(let e of t.attempts)e.flowId&&a.add(e.flowId);for(let e of t){if("closed"===e.state&&!e.restored)continue;let t=new Set;for(let i of e.stages)for(let a of e.runs.find(e=>e.stageId===i.id)?.attempts??[])if("review-loop"===i.kind){if(a.agentPath){let e=n(a.agentPath);e&&t.add(e)}let e=a.flowId?r(a.flowId):null,i=e?n(e):null;if(i&&t.add(i),a.flowId){let e=n(x6(a.flowId));e&&t.add(e)}}else if(a.agentPath){let e=n(a.agentPath);e&&t.add(e)}t.size&&i.push({key:`group::pipeline::${e.id}`,kind:"pipeline",id:e.id,hue:gt(e.id),members:[...t],pipeline:e})}for(let t of e6(e).values()){if(a.has(t.id))continue;let e=new Set,r=n(t.implementerPath);r&&e.add(r);let s=n(x6(t.id));s&&e.add(s),e.size&&i.push({key:`group::flow::${t.id}`,kind:"flow",id:t.id,hue:gt(t.id),members:[...e],flow:t})}return i}(k,a,e=>ew.get(e)??null,eI),eD=new Map(eO.filter(e=>e.pipeline).map(e=>[e.pipeline.id,e])),eL=new Map;for(let e of[...s,...a])eL.has(e.id)||eL.set(e.id,e);for(let[e,t]of L){let n=eD.get(e);if(n){n.members=[...n.members,...t];continue}let r=eL.get(e);if(!r)continue;let i={key:`group::pipeline::${r.id}`,kind:"pipeline",id:r.id,hue:gt(r.id),members:t,pipeline:r};eO.push(i),eD.set(e,i)}let e_=[];for(let e of eO){let t=function(e,t){let n=1/0,r=1/0,i=-1/0,a=-1/0,s=!1;for(let l of e){let e=t(l);e&&(s=!0,n=Math.min(n,e.x),r=Math.min(r,e.y),i=Math.max(i,e.x+e.w),a=Math.max(a,e.y+e.h))}return s?{x:n-46,y:r-46,w:i-n+92,h:a-r+92}:null}("pipeline"===e.kind?e$(e.members,"pipe:"+e.id):e.members,e=>eC.get(e)??null);if(!t)continue;let n={x:t.x,y:t.y-44,w:t.w,h:t.h+44};e_.push({...e,...n,label:eE(e)})}return{nodes:h,edges:x,stacks:g,decks:b,loops:v,groups:e_,links:[...function(e,t){let n=[];for(let r of e6(e).values()){let e=t(r.implementerPath);if(!e)continue;let i=x9(r),a=(i?.reviewerPath?t(i.reviewerPath):null)??t(x6(r.id));a&&a!==e&&n.push({key:"flowlink::"+r.id,kind:"flow",from:e,to:a,leg:tl(r),flow:{flow:r,round:i?.n??0,phase:x7(r.state)}})}return n}(k,e=>ew.get(e)??null),...function(e,t,n=()=>null){let r=[];for(let i of e){if("closed"===i.state&&!i.restored)continue;let e=i.stages.length,a=i.cursor?.stageId??i.stages.at(-1)?.id??null,s=gr(i),l=[],o=[],c=!1,d=e=>{let r=xc(i,e.id);if(r?.agentPath){let e=t(r.agentPath);if(e&&!e.startsWith("deck::"))return e}if("review-loop"===e.kind&&r?.flowId){let e=n(r.flowId),i=e?t(e):null;if(i)return i}return t(x8(i.id,e.id))},u=new Map(i.stages.map((e,t)=>[e.id,t]));for(let e=0;e<i.stages.length;e+=1){let t=i.stages[e],n=d(t);n&&o.push({stageId:t.id,index:e,key:n})}let p=new Map(o.map(e=>[e.stageId,e]));for(let t of i.stages){let n=p.get(t.id);if(n)for(let r of[...t.next?[{toStageId:t.next,edge:"pass"}]:[],...t.onFail?[{toStageId:t.onFail.to,edge:"fail"}]:[]]){let a=p.get(r.toStageId);if(!a)continue;let o=n.key,d=a.key;if(o===d){c=!0;continue}l.push({key:`pipelinelink::${i.id}::${t.id}::${r.toStageId}::${r.edge}`,kind:"pipeline",from:o,to:d,leg:"forward",pipeline:{pipeline:i,fromStageId:t.id,toStageId:r.toStageId,tone:"fail"===r.edge?"amber":gi(i,r.toStageId),index:(u.get(r.toStageId)??0)+1,total:e,hub:!1,paused:"paused"===i.state,edge:r.edge,isNext:"pass"===r.edge&&s&&i.cursor?.stageId===t.id}})}}let m=l.find(e=>e.pipeline.toStageId===a&&"fail"!==e.pipeline.edge)??l.at(-1);if(m){m.pipeline.hub=!0,r.push(...l);continue}if(r.push(...l),l.length||!c)continue;let f=o.find(e=>e.stageId===a)??o.at(-1),h=f?f.key:null;f&&h&&r.push({key:`pipelinehub::${i.id}`,kind:"pipeline",from:h,to:h,leg:null,pipeline:{pipeline:i,fromStageId:f.stageId,toStageId:f.stageId,tone:gi(i,a??f.stageId),index:f.index+1,total:e,hub:!0,paused:"paused"===i.state,anchorOnly:!0}})}return r}(a,e=>ew.get(e)??null,eI)],drafts:B,slots:O,regionTasks:D,byPath:eC,width:Math.max(ev+100,800),height:eb+100+140}}function vn(e){if("running"===e.proc)return!0;let t=e.spawn?.state;return"starting"===t||"binding"===t||"queued"===t}function vr(e,t){let n;if(e.path.startsWith("spawn:")||e.spawn?.state==="failed")return"dead";if("done"===e.proc||"killed"===e.proc||e.supersededBy)return"closed";let r=vn(e),i="terminal"===(n=e.authoritativeTurn?.state)||"idle"===n||"jsonl_turn_completed"===e.activityReason;if(!r&&i)return"closed";let a=!Number.isFinite(t)||t<=0?null:Math.max(0,t-e.mtime);return null===a||a<300?r?"running":"live":i?"closed":vn(e)||e.authoritativeTurn?.state==="busy"?"silent":"closed"}function vi(e){return"running"===e||"live"===e?0:"silent"===e?1:"closed"===e?2:3}function va(e){let t=e.durableLineage?.memberships.find(e=>"pipeline"===e.kind&&e.stageId);return t?.stageId&&e.spawn?{pipelineId:t.containerId,stageId:t.stageId,launchId:e.spawn.launchId}:null}async function vs(e,t){let n=va(e);return n?t(n.pipelineId,"retry-stage",{stageId:n.stageId,launchId:n.launchId}):"launch is not owned by a pipeline stage"}function vl({open:e,onToggle:t,label:n,count:r,icon:i,ariaLabel:a,mobile:s}){return(0,U.jsxs)("button",{className:`flex w-full items-center gap-2 px-4 text-label font-semibold text-secondary text-secondary hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${s?"min-h-11":"h-8"}`,"aria-expanded":e,"aria-label":a,onClick:t,children:[(0,U.jsx)(sx.c_,{className:`h-3.5 w-3.5 shrink-0 text-muted transition-transform ${e?"rotate-90":""}`,"aria-hidden":!0}),i,(0,U.jsx)("span",{className:"truncate",children:n}),null!=r?(0,U.jsxs)("span",{className:"text-caption font-normal tabular-nums text-muted",children:["\xb7 ",r]}):null]})}function vo({items:e,onRetry:t}){let{t:n}=(0,eh.Ym)(),r=ia(),[i,a]=(0,Y.useState)(!1);return e.length?(0,U.jsxs)("div",{className:"shrink-0 border-t border-border bg-canvas","data-testid":"launch-history",children:[(0,U.jsx)(vl,{open:i,onToggle:()=>a(e=>!e),label:n("launchHistory.title"),count:e.length,icon:(0,U.jsx)(gP.A,{className:"h-3 w-3 shrink-0 text-muted","aria-hidden":!0}),ariaLabel:n("launchHistory.aria"),mobile:r}),i?(0,U.jsx)("ul",{className:"flex max-h-52 flex-col gap-0.5 overflow-y-auto px-3 pb-2.5",children:e.map(e=>{let i=(0,tw.yz)(e),a=e.spawn,s="failed"===a.state;return(0,U.jsxs)("li",{className:`flex min-w-0 items-center gap-1.5 rounded-[8px] px-2 text-[11px] text-primary ${r?"min-h-11":"h-7"}`,children:[(0,U.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px]",style:i.style,children:i.label}),(0,U.jsx)("span",{className:"min-w-0 shrink truncate font-semibold",title:(0,ex.cr)(e.title),children:(0,ex.cr)(e.title,60)}),(0,U.jsx)("span",{className:`shrink-0 rounded-full px-1.5 text-[10px] font-semibold ${s?"bg-danger-soft text-danger":"bg-success-soft text-success"}`,children:n(s?"launchHistory.failed":"launchHistory.recovered")}),s&&a.error?(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate text-danger",title:a.error,children:a.error}):(0,U.jsx)("span",{className:"min-w-0 flex-1","aria-hidden":!0}),(0,U.jsx)("span",{className:"shrink-0 font-normal text-muted",children:(0,tw.rK)(e.mtime)}),s&&a.retrySafe?(0,U.jsxs)("button",{type:"button","aria-label":n("launchHistory.retry",{title:(0,ex.cr)(e.title,40)}),title:n("launchHistory.retry",{title:(0,ex.cr)(e.title,40)}),className:`inline-flex shrink-0 items-center gap-1 rounded-full border border-border bg-card px-2 text-[10.5px] font-semibold text-primary hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${r?"min-h-9":"h-5"}`,onClick:()=>t(e),children:[(0,U.jsx)(sg.A,{className:"h-3 w-3","aria-hidden":!0})," ",n("launchHistory.retryLabel")]}):null]},e.path)})}):null]}):null}function vc(e){try{let t=JSON.parse(window.localStorage.getItem("llvTaskExpand:"+e)??"[]");return new Set(Array.isArray(t)?t.filter(e=>"string"==typeof e):[])}catch{return new Set}}var vd=n(2550);function vu(e,t){return"failed"===e.state?"failed":"spawning"!==e.state||e.path?t?t.migration?"migrating":"killed"===t.proc?"killed":"running"===t.proc||"live"===t.activity||"recent"===t.activity?"live":"unhosted":"gone":"spawning"}function vp(e){return"live"===e||"killed"===e||"unhosted"===e}let vm=["now","review","blocked","planned","done"],vf={now:{color:"var(--color-accent)",soft:"var(--color-accent-soft)"},review:{color:"var(--color-info)",soft:"var(--color-info-soft)"},blocked:{color:"var(--color-danger)",soft:"var(--color-danger-soft)"},planned:{color:"var(--color-warning)",soft:"var(--color-warning-soft)"},done:{color:"var(--color-success)",soft:"var(--color-success-soft)"}},vh=(e,t)=>t[e]??e;function vx(e,t){let n=new Set,r=new Set,i=t=>{if(t){for(let r of t.pipelines)r.project===e.project&&"paused"!==r.state&&n.add(r);for(let n of t.flows)n.project===e.project&&"paused"!==n.state&&r.add(n)}};for(let n of e.assignments)n.conversationId&&i(t.byConversationId.get(vh(n.conversationId,t.aliases))),n.path&&i(t.byPath.get(n.path));return{pipelines:[...n],flows:[...r]}}function vg(e){return e.cursor?.state==="reviewing"||"completed"===e.state||function(e){let t;for(let n of e.stages){let r=xc(e,n.id);r&&(t=r)}return t?.verdict?.status==="pass"}(e)}let vb=new Set(["reviewing","relay_pending","relaying","fixing","approved","done_comment"]);function vv(e){return vb.has(e.state)||e.rounds.at(-1)?.verdict==="APPROVE"}function vw({task:e,index:t,byPath:n,repository:r,onOpenTask:i,onPlaceOnMap:a,onOpenFile:s}){let{t:l}=(0,eh.Ym)(),o=ia(),c=(0,tw.cr)(gG(e.text),60)||l("tasks.untitled"),d="unplaced"===e.placement||!e.pos,u=gV[e.status],p=function(e,t){let n=!1,r=!1;for(let i of e.assignments){let e=vu(i,i.path?t.get(i.path)??null:null);if("failed"===e)return"failed";"gone"===e&&(n=!0),"live"===e&&(r=!0)}return r?"live":n?"gone":null}(e,n),m=function(e){let t=new Set;for(let n of e.matchAll(/(?<![\w/])#(\d{1,6})\b/g))t.add(Number(n[1]));return[...t].sort((e,t)=>e-t)}(e.text),f=vx(e,t),h=f.pipelines.map(e=>(function(e){if(e.cursor){var t,n;let r=xc(e,e.cursor.stageId);if(r&&("pending"!==e.cursor.state||(t=r.activatedBy,n=e.cursor.activatedBy,null===t||null===n?t===n:t.stageId===n.stageId&&t.attempt===n.attempt&&t.edge===n.edge)))return r}let r=new Map,i=[];for(let t of e.runs)for(let e of t.attempts)e.historical||(r.set(`${t.stageId}:${e.n}`,e),i.push({stageId:t.stageId,attempt:e}));let a=null;for(let e of i){let t=function(e){for(let t of[e.startedAt,e.completedAt]){let e=t?Date.parse(t):NaN;if(Number.isFinite(e))return e}return null}(e.attempt),n=function(e,t,n){let r=new Set([`${t}:${n.n}`]),i=0,a=n.activatedBy;for(;a;){let t=`${a.stageId}:${a.attempt}`;if(r.has(t))break;r.add(t);let n=e.get(t);if(!n)break;i+=1,a=n.activatedBy}return i}(r,e.stageId,e.attempt);(!a||null!==t&&(null===a.timestamp||t>a.timestamp)||t===a.timestamp&&n>a.depth)&&(a={attempt:e.attempt,timestamp:t,depth:n})}return a?.attempt??null})(e)).map(e=>e?.agentPath?n.get(e.agentPath):void 0).filter(e=>void 0!==e).at(-1),x=f.flows.flatMap(e=>[e.implementerPath,...e.rounds.map(e=>e.reviewerPath)]).map(e=>e?n.get(e):void 0).filter(e=>void 0!==e).at(-1),g=e.assignments.map(e=>e.path?n.get(e.path)??null:null).find((t,n)=>{let r=e.assignments[n];return null!==t&&vp(vu(r,t))}),b=o?"min-h-11 px-2":"h-6 px-1.5",v=`inline-flex items-center rounded-full bg-card text-[10px] font-semibold text-secondary hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${b}`;return(0,U.jsxs)("div",{"data-flip-key":e.id,className:"flex min-w-0 max-w-full flex-wrap items-center gap-1 rounded-[10px] border border-transparent px-1 py-0.5",style:{backgroundColor:u.soft},children:[(0,U.jsx)("button",{className:`inline-flex min-w-0 max-w-[300px] items-center gap-1.5 rounded-full text-[11px] font-semibold text-primary hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${b}`,title:l(d&&a?"readiness.place":"readiness.open",{title:c}),"aria-label":l(d&&a?"readiness.place":"readiness.open",{title:c}),onClick:()=>d&&a?a(e):i(e),children:(0,U.jsx)("span",{className:"truncate",children:c})}),(0,U.jsx)("span",{className:"shrink-0 rounded-full bg-card px-1.5 text-[9px] font-bold",style:{color:u.color},children:l(`tasks.status.${e.status}`)}),p?(0,U.jsxs)("span",{className:`shrink-0 rounded-full bg-card px-1.5 text-[9px] font-bold ${"failed"===p?"text-danger":"live"===p?"text-success":"text-muted"}`,title:l(`readiness.state.${p}`),children:["failed"===p?"⚠ ":"",l(`readiness.state.${p}`)]}):null,m.map(e=>r?(0,U.jsxs)("a",{className:v,href:`https://github.com/${r}/issues/${e}`,target:"_blank",rel:"noreferrer","aria-label":l("readiness.issueAria",{issue:e}),children:["#",e]},e):(0,U.jsxs)("span",{className:`inline-flex items-center rounded-full bg-card text-[10px] font-semibold text-secondary ${b}`,children:["#",e]},e)),g?(0,U.jsx)("button",{className:v,"aria-label":l("readiness.agentAria",{title:c}),onClick:()=>s(g),children:l("readiness.agent")}):null,h?(0,U.jsx)("button",{className:v,"aria-label":l("readiness.pipelineAria",{title:c}),onClick:()=>s(h),children:l("readiness.pipeline")}):null,x&&x!==g?(0,U.jsx)("button",{className:v,"aria-label":l("readiness.reviewAria",{title:c}),onClick:()=>s(x),children:l("readiness.review")}):null]})}function vy({section:e,index:t,byPath:n,repository:r,onOpenTask:i,onPlaceOnMap:a,onOpenFile:s}){let{t:l}=(0,eh.Ym)(),o=ia(),[c,d]=(0,Y.useState)(!1),u=vf[e.readiness],p=l(`readiness.section.${e.readiness}`);return(0,U.jsxs)("div",{className:"min-w-0","data-readiness-section":e.readiness,children:[(0,U.jsxs)("button",{className:`flex w-full items-center gap-2 rounded-[8px] px-2 text-left text-[11px] font-semibold text-primary hover:bg-canvas focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${o?"min-h-11":"h-7"}`,"aria-expanded":c,"aria-label":l("readiness.sectionAria",{section:p,count:e.items.length}),onClick:()=>d(e=>!e),children:[(0,U.jsx)("span",{className:"h-2 w-2 shrink-0 rounded-full",style:{backgroundColor:u.color},"aria-hidden":!0}),(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate",children:p}),(0,U.jsx)("span",{className:"shrink-0 text-[10px] font-normal tabular-nums text-muted",children:e.items.length})]}),c&&e.items.length?(0,U.jsx)(gO,{className:"mt-1 flex min-w-0 flex-wrap items-start gap-1.5 pb-1 pl-5",children:e.items.map(e=>(0,U.jsx)(vw,{task:e,index:t,byPath:n,repository:r,onOpenTask:i,onPlaceOnMap:a,onOpenFile:s},e.id))}):null]})}function vk({tasks:e,files:t,pipelines:n,flows:r,conversationAliases:i,repository:a,onOpenTask:s,onPlaceOnMap:l,onOpenFile:o}){let{t:c}=(0,eh.Ym)(),d=ia(),[u,p]=(0,Y.useState)(!1),m=(0,Y.useMemo)(()=>(function(e,t,n={}){let r=new Map,i=new Map,a=(e,t)=>{let n=e.get(t);if(n)return n;let r={pipelines:[],flows:[]};return e.set(t,r),r},s=(e,t)=>{e&&t(a(r,vh(e,n)))},l=(e,t)=>{e&&t(a(i,e))};for(let t of e){let e=e=>{e.pipelines.includes(t)||e.pipelines.push(t)};for(let n of t.runs)for(let t of n.attempts)s(t.conversationId,e),l(t.agentPath,e)}for(let e of t){let t=t=>{t.flows.includes(e)||t.flows.push(e)};for(let n of(s(e.implementerConversationId,t),l(e.implementerPath,t),e.rounds))s(n.reviewerConversationId,t),l(n.reviewerPath,t)}return{byConversationId:r,byPath:i,aliases:n}})(n,r,i),[n,r,i]),f=(0,Y.useMemo)(()=>(function(e,t){let n=new Map(vm.map(e=>[e,[]]));for(let r of e)n.get(function(e,t){if("done"===e.status)return"done";let n=vx(e,t);return"blocked"===e.status||e.assignments.some(e=>"failed"===e.state)||n.pipelines.some(e=>"needs_decision"===e.state)||n.flows.some(e=>"needs_decision"===e.state)?"blocked":n.pipelines.some(vg)||n.flows.some(vv)?"review":"assigned"===e.status?"now":"planned"}(r,t)).push(r);return vm.map(e=>{let t=n.get(e);return t.sort((e,t)=>e.updatedAt<t.updatedAt?1:e.updatedAt>t.updatedAt||e.id<t.id?-1:1),{readiness:e,items:t}})})(e,m),[e,m]),h=(0,Y.useMemo)(()=>new Map(t.map(e=>[e.path,e])),[t]);return e.length?(0,U.jsxs)("div",{className:"shrink-0 border-t border-border bg-canvas","data-testid":"task-readiness",children:[(0,U.jsx)(vl,{open:u,onToggle:()=>p(e=>!e),label:c("readiness.title"),count:e.length,icon:(0,U.jsx)(vd.A,{className:"h-3 w-3 shrink-0 text-muted","aria-hidden":!0}),ariaLabel:c("readiness.aria"),mobile:d}),u?(0,U.jsxs)("div",{className:`flex flex-col gap-0.5 overflow-y-auto px-3 pb-2.5 ${d?"max-h-96":"max-h-64"}`,children:[(0,U.jsx)("p",{role:"note",className:"px-2 pb-1 text-[10px] leading-snug text-muted",children:c("readiness.legend")}),f.map(e=>(0,U.jsx)(vy,{section:e,index:m,byPath:h,repository:a,onOpenTask:s,onPlaceOnMap:l,onOpenFile:o},e.readiness))]}):null]}):null}function vj({stack:e,label:t,flows:n,reviewGroup:r,onSelect:i,onExpandGroup:a}){let{t:s}=(0,eh.Ym)(),l=ia(),[o,c]=(0,Y.useState)(!1),d=r?.rounds[r.rounds.length-1]??null,u=d?tc(d.verdict):null;return(0,U.jsxs)("div",{className:"min-w-0",children:[(0,U.jsxs)("div",{className:"flex w-full items-center gap-1",children:[(0,U.jsxs)("button",{className:`flex min-w-0 flex-1 items-center gap-2 rounded-[8px] px-2 text-left text-[11px] font-semibold text-primary hover:bg-canvas focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${l?"min-h-11":"h-7"}`,"aria-expanded":o,onClick:()=>c(e=>!e),children:[(0,U.jsx)(sx.c_,{className:`h-3.5 w-3.5 shrink-0 text-muted transition-transform ${o?"rotate-90":""}`,"aria-hidden":!0}),(0,U.jsx)(sx.zg,{className:"h-3 w-3 shrink-0 text-muted","aria-hidden":!0}),(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate",children:t}),d&&u?(0,U.jsx)("span",{className:"inline-flex h-4 shrink-0 items-center gap-1 rounded-full px-1.5 text-[9.5px] font-bold",style:{backgroundColor:u.soft,color:u.color},children:d.verdict?`${to[d.verdict]} ${d.verdict}`:s("roundDeck.aborted")}):null,(0,U.jsx)("span",{className:"shrink-0 text-[10px] font-normal tabular-nums text-muted",children:e.items.length})]}),r&&a?(0,U.jsx)("button",{type:"button","data-review-group-expand":!0,className:`inline-flex shrink-0 items-center justify-center rounded-[8px] border border-border bg-card text-muted shadow-1 hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${l?"min-h-11 min-w-11":"h-7 w-7"}`,"aria-label":s("workerStack.expandGroup"),title:s("workerStack.expandGroup"),onClick:()=>a(r),children:(0,U.jsx)(sx.zg,{className:"h-3.5 w-3.5","aria-hidden":!0})}):null]}),o?(0,U.jsx)(gO,{className:"mt-1 flex flex-wrap items-start gap-1.5 pb-1 pl-5",children:e.items.map(e=>{let t=(0,tw.yz)(e),r=function(e,t){for(let n of t){let t=n.rounds.find(t=>t.reviewerPath===e.path);if(t)return t.verdict?to[t.verdict]:null}return null}(e,n);return(0,U.jsxs)("button",{"data-flip-key":e.path,className:`inline-flex max-w-[340px] items-center gap-1.5 rounded-full border border-transparent bg-sunken text-[11px] font-semibold text-primary hover:border-border focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${l?"min-h-11 px-3":"h-7 px-2"}`,title:(0,ex.cr)(e.title),onClick:()=>i(e),children:[(0,U.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${(0,tw.tz)(e.activity)}`}),(0,U.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px]",style:t.style,children:t.label}),r?(0,U.jsx)("span",{className:"shrink-0 text-[10px] text-muted","aria-hidden":!0,children:r}):null,(0,U.jsx)("span",{className:"truncate",children:(0,ex.cr)(e.title,60)}),(0,U.jsx)("span",{className:"shrink-0 font-normal text-muted",children:(0,tw.rK)(e.mtime)})]},e.path)})}):null]})}function vN({stacks:e,files:t,flows:n,pipelines:r=[],onSelect:i,onExpandGroup:a}){let{t:s}=(0,eh.Ym)(),l=ia(),[o,c]=(0,Y.useState)(!1),d=(0,Y.useMemo)(()=>e.reduce((e,t)=>e+t.items.length,0),[e]),u=(0,Y.useMemo)(()=>new Map(t.map(e=>[e.path,e.title])),[t]),p=(0,Y.useMemo)(()=>e.filter(e=>"pipeline"===e.kind).map(e=>e.id).join(" "),[e]);return e.length?(0,U.jsxs)("div",{className:"shrink-0 border-t border-border bg-canvas","data-testid":"worker-stacks","data-worker-stack-pipeline-ids":p,children:[(0,U.jsx)(vl,{open:o,onToggle:()=>c(e=>!e),label:s("workerStack.title"),count:d,ariaLabel:s("workerStack.aria"),mobile:l}),o?(0,U.jsx)("div",{className:"flex max-h-52 flex-col gap-0.5 overflow-y-auto px-3 pb-2.5",children:e.map(e=>(0,U.jsx)(vj,{stack:e,label:(e=>{if("flow"===e.kind){let t=n.find(t=>t.id===e.id),r=t?u.get(t.implementerPath):void 0;return(0,ex.cr)(r??s("workerStack.flow"),60)}if("pipeline"===e.kind){let t=r.find(t=>t.id===e.id);return(0,ex.cr)(t?.task??s("workerStack.pipeline"),60)}return"origin"===e.kind?(0,ex.cr)(u.get(e.id)??s("workerStack.origin"),60):e.id?(0,ex.cr)(e.id,60):s("workerStack.worktree")})(e),flows:n,reviewGroup:(e=>{if("flow"!==e.kind)return null;let t=n.find(t=>t.id===e.id);return t&&tv(t)&&bT(t)?t:null})(e),onSelect:i,onExpandGroup:a},e.key))}):null]}):null}function vS(e){return e.open?(0,U.jsx)(vC,{...e}):null}function vC({onClose:e,total:t,leading:n,children:r}){let{t:i}=(0,eh.Ym)(),a=(0,Y.useRef)(null);return(0,Y.useEffect)(()=>{let e=document.activeElement instanceof HTMLElement?document.activeElement:null;a.current?.focus();let t=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=t,e?.isConnected&&e.focus()}},[]),(0,Y.useEffect)(()=>{let t=t=>{if("Escape"===t.key)return void e();if("Tab"!==t.key)return;let n=a.current;if(!n)return;let r=[...n.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')].filter(e=>!e.hasAttribute("disabled"));if(!r.length){t.preventDefault(),n.focus();return}let i=r[0],s=r[r.length-1],l=document.activeElement,o=l instanceof HTMLElement&&n.contains(l);t.shiftKey?o&&l!==i&&l!==n||(t.preventDefault(),s.focus()):o&&l!==s||(t.preventDefault(),i.focus())};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[e]),(0,U.jsx)("div",{className:"fixed inset-0 z-[60] flex flex-col justify-end bg-black/40",role:"presentation",onClick:t=>{t.target===t.currentTarget&&e()},children:(0,U.jsxs)("div",{ref:a,"data-testid":"mobile-bottom-shelf",role:"dialog","aria-modal":"true","aria-label":i("dash.hiddenShelf"),tabIndex:-1,className:"max-h-[80dvh] overflow-y-auto rounded-t-[16px] border-t border-border bg-card pb-[max(0.5rem,env(safe-area-inset-bottom))] shadow-2 focus-visible:outline-none",children:[(0,U.jsxs)("div",{className:"sticky top-0 z-10 flex items-center gap-2 border-b border-border bg-card px-4 py-2",children:[(0,U.jsx)(sx.zg,{className:"h-4 w-4 shrink-0 text-muted","aria-hidden":!0}),(0,U.jsxs)("span",{className:"min-w-0 flex-1 truncate text-ui font-bold text-primary",children:[i("dash.hiddenShelf"),t>0?(0,U.jsx)("span",{className:"ml-1 tabular-nums text-muted",children:t}):null]}),(0,U.jsx)("button",{type:"button","aria-label":i("common.close"),onClick:e,className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-[8px] border border-border bg-canvas text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:(0,U.jsx)(sx.X,{className:"h-5 w-5","aria-hidden":!0})})]}),n?(0,U.jsx)("div",{className:"border-b border-border px-2 py-1.5",children:n}):null,t>0?(0,U.jsx)("div",{children:r}):null]})})}let vA=(e,t)=>`llvWfDraft:${e}:${t}`;function vI(e,t){return sessionStorage.getItem(vA(e,t))??""}function vM(e,t,n){n?sessionStorage.setItem(vA(e,t),n):sessionStorage.removeItem(vA(e,t))}function vT(e){for(let t of["template","dir","task","mode"])sessionStorage.removeItem(vA(e,t))}function vP({draftId:e,project:t,onClose:n,onLaunched:r}){let{t:i}=(0,eh.Ym)(),[a,s]=(0,Y.useState)([]),[l,o]=(0,Y.useState)(()=>vI(e,"template")),[c,d]=(0,Y.useState)(()=>vI(e,"dir")),[u,p]=(0,Y.useState)(()=>vI(e,"task")),[m,f]=(0,Y.useState)(()=>"manual"===vI(e,"mode")),[h,x]=(0,Y.useState)([]),[g,b]=(0,Y.useState)(!1),[v,w]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{let n=!1;return fetch("/api/workflows").then(e=>e.json()).then(t=>{!n&&Array.isArray(t.templates)&&(s(t.templates),o(n=>{let r=n&&t.templates.some(e=>e.name===n)?n:t.templates[0]?.name??"";return r!==n&&vM(e,"template",r),r}))}).catch(()=>{}),fetch("/api/spawn?project="+encodeURIComponent(t)).then(e=>e.json()).then(t=>{!n&&Array.isArray(t.dirs)&&(x(t.dirs),d(n=>{let r=n||t.dirs?.[0]||"";return r!==n&&vM(e,"dir",r),r}))}).catch(()=>{}),()=>{n=!0}},[t,e]);let y=a.find(e=>e.name===l)??null,k=async()=>{if(!g){if(!c.trim())return void w(i("wfDraft.needDir"));if(!u.trim())return void w(i("wfDraft.needTask"));b(!0),w(null);try{let e=await fetch("/api/workflows",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({template:l,task:u.trim(),repoDir:c.trim(),mode:m?"manual":"auto"})}),t=await e.json();if(!e.ok||!t.ok)return void w(t.error??i("wfDraft.launchFailed"));window.dispatchEvent(new Event(nD)),r()}catch{w(i("common.serverUnavailable"))}finally{b(!1)}}},j="wf-draft-dirs-"+e;return(0,U.jsxs)("section",{"data-pan-ignore":!0,className:"relative flex h-full min-h-0 min-w-0 flex-1 flex-col overflow-hidden rounded-[10px] border border-border bg-card shadow-1","aria-label":i("wfDraft.paneAria"),children:[(0,U.jsx)("span",{"aria-hidden":!0,className:"h-1 w-full shrink-0 bg-accent"}),(0,U.jsxs)("header",{className:"flex h-10 shrink-0 items-center gap-2 border-b border-border bg-accent-soft px-2.5",children:[(0,U.jsx)("span",{className:"h-2 w-2 shrink-0 rounded-full bg-strong",title:i("wfDraft.notStarted")}),(0,U.jsx)("span",{className:"shrink-0 text-[10.5px] font-bold tracking-[0.08em] text-accent",children:i("wfStrip.workflow")}),(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12px] font-semibold text-muted",children:i("wfDraft.newWorkflow")}),(0,U.jsx)("button",{className:"inline-flex shrink-0 items-center rounded-[8px] border border-border bg-canvas px-1.5 py-0.5 text-muted hover:border-danger/40 hover:text-danger focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":i("wfDraft.dismiss"),onClick:n,children:(0,U.jsx)(sx.X,{className:"h-3 w-3","aria-hidden":!0})})]}),(0,U.jsxs)("div",{className:"flex shrink-0 flex-col gap-1.5 border-b border-border bg-sunken px-2.5 py-2",children:[(0,U.jsxs)("label",{className:"flex items-center gap-1.5",children:[(0,U.jsx)("span",{className:"w-[72px] shrink-0 text-[10px] font-semibold text-muted",children:i("wfDraft.template")}),(0,U.jsx)("select",{value:l,disabled:g,onChange:t=>{var n;o(n=t.target.value),vM(e,"template",n)},"aria-label":i("wfDraft.templateAria"),className:"min-w-0 flex-1 rounded-[6px] border border-border bg-card px-2 py-1 text-[11.5px] text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60",children:a.map(e=>(0,U.jsx)("option",{value:e.name,children:e.name},e.name))})]}),(0,U.jsxs)("label",{className:"flex items-center gap-1.5",children:[(0,U.jsx)("span",{className:"w-[72px] shrink-0 text-[10px] font-semibold text-muted",children:i("wfDraft.repo")}),(0,U.jsx)("input",{value:c,disabled:g,onChange:t=>{var n;d(n=t.target.value),vM(e,"dir",n)},list:j,placeholder:"/home/…/Projects/…","aria-label":i("wfDraft.repoAria"),className:"min-w-0 flex-1 rounded-[6px] border border-border bg-card px-2 py-1 font-mono text-[11px] text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60"}),(0,U.jsx)("datalist",{id:j,children:h.map(e=>(0,U.jsx)("option",{value:e},e))})]}),(0,U.jsxs)("label",{className:"flex items-center gap-1.5 text-[10.5px] font-semibold text-muted",children:[(0,U.jsx)("input",{type:"checkbox",checked:m,disabled:g,onChange:t=>{var n;f(n=t.target.checked),vM(e,"mode",n?"manual":"")},className:"accent-accent"}),i("wfDraft.manualMode")]})]}),(0,U.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto px-4 py-3",children:[y?(0,U.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5","aria-label":i("wfStrip.stagesAria"),children:[y.stages.map((e,t)=>(0,U.jsxs)("span",{className:"flex items-center gap-1.5",children:[t>0?(0,U.jsx)("span",{className:"text-[10px] font-bold text-strong","aria-hidden":!0,children:"→"}):null,(0,U.jsx)("span",{className:"inline-flex h-6 max-w-[200px] items-center truncate rounded-full bg-sunken px-2 text-[10.5px] font-bold text-secondary",children:"review-loop"===e.kind?`${i("wfStrip.reviewStage")} \xb7 ${e.reviewer.engine}${e.reviewer.model?" "+e.reviewer.model:""}${e.reviewer.effort?" "+e.reviewer.effort:""}`:`${e.scope.split(/[.:\n]/)[0]} \xb7 ${e.agent.engine}${e.agent.model?" "+e.agent.model:""}${e.agent.effort?" "+e.agent.effort:""}`})]},t)),(0,U.jsxs)("span",{className:"inline-flex h-6 items-center rounded-full bg-sunken px-2 text-[10.5px] font-bold text-secondary",children:["→ ","merge"===y.finish?i("wfDraft.finishMerge"):"PR"]})]}):(0,U.jsx)("div",{className:"text-[12px] text-muted",children:i("wfDraft.hint")}),(0,U.jsx)("textarea",{value:u,disabled:g,onChange:t=>{var n;p(n=t.target.value),vM(e,"task",n)},placeholder:i("wfDraft.taskPlaceholder"),"aria-label":i("wfDraft.taskAria"),className:"min-h-[160px] flex-1 resize-none rounded-[8px] border border-border bg-card px-2.5 py-2 text-[12.5px] leading-snug text-primary placeholder:text-muted/70 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60"})]}),(0,U.jsxs)("div",{className:"flex shrink-0 items-center gap-2 border-t border-border bg-sunken px-2.5 py-2",children:[v?(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11px] font-semibold text-danger",title:v,children:v}):(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate text-[10.5px] text-muted",children:i("wfDraft.footerHint")}),(0,U.jsxs)("button",{className:"inline-flex shrink-0 items-center gap-1.5 rounded-full border border-accent bg-accent px-3.5 py-1.5 text-[11.5px] font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40",disabled:g,onClick:()=>void k(),children:[g?(0,U.jsx)(sx.kr,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):null,g?i("wfDraft.launching"):i("wfDraft.launch")]})]})]})}var v$=n(7033);let vE=new Set(["png","jpg","gif","webp"]);function vR(e){return!(!e||"object"!=typeof e||Array.isArray(e))&&"string"==typeof e.id&&e.id.length>0&&"string"==typeof e.sha256&&/^[0-9a-f]{64}$/.test(e.sha256)&&"string"==typeof e.ext&&vE.has(e.ext)&&"string"==typeof e.mime&&null!==(0,sw.PG)(e.mime)&&"number"==typeof e.bytes&&Number.isFinite(e.bytes)&&e.bytes>0&&"string"==typeof e.createdAt}function vO(e,t){let[n]=(0,Y.useState)(()=>(function(e){try{let t=window.localStorage.getItem("llvTaskDraft:"+e);if(t){let e=JSON.parse(t);if(e&&1===e.v&&"string"==typeof e.text)return{text:e.text,dueAt:"string"==typeof e.dueAt?e.dueAt:void 0,dueTz:"string"==typeof e.dueTz?e.dueTz:void 0,attachments:Array.isArray(e.attachments)?e.attachments.filter(vR):[]}}let n=window.sessionStorage.getItem("llvTaskSheetDraft:"+e);if(n)return window.sessionStorage.removeItem("llvTaskSheetDraft:"+e),{text:n,attachments:[]}}catch{}return{text:"",attachments:[]}})(e)),r=(0,Y.useRef)(nN()),[i,a]=(0,Y.useState)(n.dueAt),[s,l]=(0,Y.useState)(n.dueTz),[o,c]=(0,Y.useState)(n.attachments),d=(0,Y.useRef)({dueAt:n.dueAt,dueTz:n.dueTz,attachments:n.attachments}),u=t=>{try{let{dueAt:n,dueTz:r,attachments:i}=d.current;if(!t&&!n&&0===i.length)return void window.localStorage.removeItem("llvTaskDraft:"+e);let a={v:1,project:e,text:t,dueAt:n,dueTz:r,attachments:i,updatedAt:new Date().toISOString()};window.localStorage.setItem("llvTaskDraft:"+e,JSON.stringify(a))}catch{}},p=sV({initialText:()=>n.text,persistText:u,submit:t}),m=async e=>{let t=[];for(let n of e){if(null===(0,sw.PG)(n.type)){p.setStatus({kind:"err",text:(0,eh.Tl)((0,eh.JK)(),"img.unsupported",{name:n.name||n.type||(0,eh.Tl)((0,eh.JK)(),"img.unknownFile")})});continue}if(n.size>sw.YP){p.setStatus({kind:"err",text:(0,eh.Tl)((0,eh.JK)(),"img.tooLarge",{name:n.name||(0,eh.Tl)((0,eh.JK)(),"img.image")})});continue}t.push(n)}for(let e of t){let t=await nA(e);if("error"in t){p.setStatus({kind:"err",text:t.error});continue}let n=t.attachment;d.current={...d.current,attachments:[...d.current.attachments,n]},c(d.current.attachments),u(p.textRef.current)}},f=()=>{r.current=nN(),d.current={dueAt:void 0,dueTz:void 0,attachments:[]},a(void 0),l(void 0),c([]),p.setText(""),p.attachments.clear();try{window.localStorage.removeItem("llvTaskDraft:"+e)}catch{}};return{composer:p,dueAt:i,dueTz:s,setDue:e=>{d.current={...d.current,dueAt:e.dueAt,dueTz:e.dueTz},a(e.dueAt),l(e.dueTz),u(p.textRef.current)},clearDue:()=>{d.current={...d.current,dueAt:void 0,dueTz:void 0},a(void 0),l(void 0),u(p.textRef.current)},attachments:o,addFiles:m,removeAttachment:e=>{d.current={...d.current,attachments:d.current.attachments.filter(t=>t.id!==e)},c(d.current.attachments),u(p.textRef.current)},stagedAttachments:()=>d.current.attachments,getRequestId:()=>r.current,reset:f,discard:()=>{f(),p.setStatus({kind:"ok",text:(0,eh.Tl)((0,eh.JK)(),"tasks.draftDiscarded")})}}}function vD(e,t=Date.now()){let n=Date.parse(e);return Number.isFinite(n)&&n<t}function vL(e,t,n="en"){let r=new Date(e);if(Number.isNaN(r.getTime()))return"";let i={month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"};try{return new Intl.DateTimeFormat(n,{...i,timeZone:t}).format(r)}catch{return new Intl.DateTimeFormat(n,i).format(r)}}var v_=n(7618);function vF({draft:e}){let{t}=(0,eh.Ym)(),n=ia(),{dueAt:r,dueTz:i,setDue:a,clearDue:s}=e,l=!!r&&vD(r);return(0,U.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,U.jsxs)("label",{className:`inline-flex items-center gap-1 rounded-full font-semibold ${n?"min-h-11 px-3 text-[12px]":"px-1.5 py-1 text-[9.5px]"} ${r?l?"bg-danger-soft text-danger":"bg-sunken text-secondary":"bg-sunken text-secondary hover:text-accent"}`,title:r&&i?t("tasks.dueTitle",{zone:i}):t("tasks.addDue"),children:[(0,U.jsx)(v_.A,{className:n?"h-4 w-4":"h-3 w-3","aria-hidden":!0}),r&&i?vL(r,i,(0,eh.JK)()):t("tasks.addDue"),(0,U.jsx)("input",{type:"datetime-local","aria-label":t("tasks.addDue"),value:r?function(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return"";let n=e=>String(e).padStart(2,"0");return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}T${n(t.getHours())}:${n(t.getMinutes())}`}(r):"",onChange:e=>{let t,n=Number.isFinite(t=Date.parse(e.target.value))?{dueAt:new Date(t).toISOString(),dueTz:Intl.DateTimeFormat().resolvedOptions().timeZone}:null;n?a(n):s()},className:"w-0 opacity-0"})]}),r?(0,U.jsx)("button",{type:"button","aria-label":t("tasks.clearDue"),onClick:s,className:`inline-flex items-center justify-center rounded-full text-muted hover:text-danger focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${n?"h-11 w-11":"h-4 w-4"}`,children:(0,U.jsx)(K.A,{className:n?"h-4 w-4":"h-2.5 w-2.5","aria-hidden":!0})}):null]})}function vq({draft:e}){let{t}=(0,eh.Ym)(),n=ia();return e.attachments.length?n?(0,U.jsx)("div",{className:"flex flex-col gap-1.5",children:e.attachments.map((n,r)=>(0,U.jsxs)("div",{className:"flex items-center gap-2 rounded-[8px] border border-border bg-card p-1.5",children:[(0,U.jsx)("img",{src:nC(n),alt:t("img.previewAlt",{n:r+1}),className:"h-11 w-11 shrink-0 rounded border border-border object-cover"}),(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12px] font-semibold text-muted",children:t("img.previewAlt",{n:r+1})}),(0,U.jsx)("button",{type:"button",onClick:()=>e.removeAttachment(n.id),"aria-label":t("img.removeAria",{n:r+1}),className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-full border border-border bg-canvas text-muted hover:text-danger focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:(0,U.jsx)(K.A,{className:"h-4 w-4","aria-hidden":!0})})]},n.id))}):(0,U.jsx)("div",{className:"flex flex-wrap items-center gap-1.5",children:e.attachments.map((n,r)=>(0,U.jsxs)("div",{className:"group/att relative",children:[(0,U.jsx)("img",{src:nC(n),alt:t("img.previewAlt",{n:r+1}),className:"h-10 w-10 rounded border border-border object-cover"}),(0,U.jsx)("button",{type:"button",onClick:()=>e.removeAttachment(n.id),"aria-label":t("img.removeAria",{n:r+1}),className:"absolute -right-1 -top-1 hidden h-4 w-4 items-center justify-center rounded-full border border-border bg-card text-muted shadow-1 hover:text-danger group-hover/att:flex focus-visible:flex focus-visible:outline-none",children:(0,U.jsx)(K.A,{className:"h-2.5 w-2.5","aria-hidden":!0})})]},n.id))}):null}function vz({draft:e,placeholder:t,createLabel:n,leftSlot:r}){let{t:i}=(0,eh.Ym)();return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(lC,{composer:e.composer,placeholder:t,textareaAriaLabel:i("tasks.editAria"),imageAriaLabel:i("composer.addImages"),sendLabelIdle:n,sendLabelRecording:i("composer.stopAndSend"),sendIdleClassName:"border-accent bg-accent hover:opacity-90",onImageFiles:t=>void e.addFiles(t),leftSlot:(0,U.jsxs)("span",{className:"flex min-w-0 items-center gap-1",children:[(0,U.jsx)(vF,{draft:e}),r]})}),(0,U.jsx)(vq,{draft:e})]})}function vH({rows:e,scopeAll:t,onOpen:n,onToggle:r}){let{t:i}=(0,eh.Ym)();return(0,U.jsxs)("section",{className:"mb-1 flex flex-col gap-0.5","aria-label":i("favorites.sectionTitle"),children:[(0,U.jsxs)("div",{className:"flex items-center gap-1 px-1 pb-0.5 text-label font-semibold text-secondary",children:[(0,U.jsx)(B.A,{className:"h-3 w-3 fill-crown text-crown","aria-hidden":!0}),i("favorites.sectionTitle"),e.length?(0,U.jsxs)("span",{className:"text-caption font-normal tabular-nums text-muted",children:["\xb7 ",e.length]}):null]}),e.length?e.map(({id:e,file:a,project:s})=>(0,U.jsxs)("div",{className:"flex items-center gap-1 rounded-control border border-border bg-card px-2 py-1.5 hover:border-accent/40",children:[(0,U.jsxs)("button",{type:"button",className:"flex min-w-0 flex-1 items-center gap-1.5 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:i("favorites.focusTitle",{title:(0,tw.cr)(a.title,60)}),onClick:()=>n(a),children:[(0,U.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${(0,tw.tz)(a.activity)}`,"aria-hidden":!0}),(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate text-ui font-semibold",children:(0,tw.cr)(a.title,90)||i("tasks.untitled")}),t?(0,U.jsx)("span",{className:"max-w-[90px] shrink-0 truncate text-caption text-muted",children:eb(s,a.projectName)}):null]}),(0,U.jsx)("button",{type:"button",className:"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-control text-crown hover:bg-crown-soft focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":i("branch.unfavorite"),title:i("branch.unfavorite"),onClick:()=>r(e),children:(0,U.jsx)(B.A,{className:"h-3.5 w-3.5 fill-crown","aria-hidden":!0})})]},e)):(0,U.jsx)("div",{className:"px-2 py-1.5 text-caption text-muted",children:i("favorites.empty")})]})}function vU(e,t){return("done"===e.status)-("done"===t.status)||t.updatedAt.localeCompare(e.updatedAt)}function vB({project:e,onDone:t}){let{t:n}=(0,eh.Ym)(),r=(0,Y.useRef)(()=>{}),i=vO(e,e=>r.current(e)),{composer:a}=i,s=async r=>{let s=(r??a.textRef.current).trim();if(!a.busy&&!a.voiceSending){if(!s)return void a.setStatus({kind:"err",text:n("tasks.composerNeedsText")});a.setBusy(!0),a.setStatus(null);try{let n=await nS({project:e,text:s,placement:"unplaced",dueAt:i.dueAt,dueTz:i.dueTz,attachments:i.stagedAttachments(),clientRequestId:i.getRequestId()});if("error"in n)return void a.setStatus({kind:"err",text:n.error});i.reset(),t()}finally{a.setBusy(!1)}}};return(0,Y.useEffect)(()=>{r.current=s}),(0,U.jsxs)("form",{onSubmit:e=>{e.preventDefault(),i.composer.submit()},className:"flex flex-col gap-1.5 rounded-[10px] border border-border bg-card p-1.5",children:[(0,U.jsx)(vz,{draft:i,placeholder:n("tasks.newPlaceholder"),createLabel:n("tasks.panelCreate")}),(0,U.jsx)("button",{type:"button",className:"self-end text-[10px] font-semibold text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:t,children:n("common.close")})]})}function vK({tasks:e,project:t,favorites:n,onOpenFavorite:r,onToggleFavorite:i,onOpenTask:a,onPlaceOnMap:s,onClose:l}){let{t:o}=(0,eh.Ym)(),[c,d]=(0,Y.useState)("project"),[u,p]=(0,Y.useState)(!1),m=(0,Y.useMemo)(()=>("project"===c?e.filter(e=>e.project===t):[...e]).sort(vU),[e,t,c]),f=(0,Y.useMemo)(()=>"project"===c?n.filter(e=>e.project===t):n,[n,t,c]);return(0,U.jsxs)("aside",{className:"flex w-[280px] shrink-0 flex-col border-l border-border bg-card","aria-label":o("tasks.panelTitle"),children:[(0,U.jsxs)("div",{className:"flex h-9 shrink-0 items-center gap-1.5 border-b border-border px-2.5",children:[(0,U.jsx)("span",{className:"text-[12px] font-bold",children:o("tasks.panelTitle")}),(0,U.jsx)("div",{className:"ml-1 flex items-center rounded-full border border-border p-0.5",children:["project","all"].map(e=>(0,U.jsx)("button",{type:"button","aria-pressed":c===e,className:`rounded-full px-2 py-0.5 text-[10px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${c===e?"bg-accent/10 text-accent":"text-muted hover:text-primary"}`,onClick:()=>d(e),children:"project"===e?o("tasks.panelThisProject"):o("tasks.panelAll")},e))}),(0,U.jsx)("button",{type:"button",className:"ml-auto inline-flex shrink-0 items-center rounded-[8px] border border-border bg-canvas px-1.5 py-0.5 text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":o("tasks.panelClose"),onClick:l,children:(0,U.jsx)(sx.X,{className:"h-3 w-3","aria-hidden":!0})})]}),(0,U.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto p-1.5",children:[(0,U.jsx)(vH,{rows:f,scopeAll:"all"===c,onOpen:r,onToggle:i}),u?(0,U.jsx)(vB,{project:t,onDone:()=>p(!1)}):(0,U.jsxs)("button",{type:"button",className:"mb-0.5 flex h-8 shrink-0 items-center justify-center gap-1 rounded-[8px] border border-dashed border-accent/50 text-[11.5px] font-bold text-accent hover:bg-accent/5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>p(!0),children:["+ ",o("tasks.newTask")]}),m.length?m.map(e=>{let t=gV[e.status],n="unplaced"===e.placement||!e.pos,r=!!e.dueAt&&vD(e.dueAt);return(0,U.jsxs)("div",{className:`flex w-full min-w-0 flex-col gap-0.5 rounded-[8px] border border-border bg-card px-2 py-1.5 hover:border-accent/40 ${"done"===e.status?"opacity-60":""}`,children:[(0,U.jsxs)("button",{type:"button",className:"flex min-w-0 flex-col gap-0.5 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:e.text,onClick:()=>a(e),children:[(0,U.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[(0,U.jsx)("span",{className:"shrink-0 rounded-full px-1.5 py-0.5 text-[9px] font-bold",style:{backgroundColor:t.soft,color:t.color},children:o(`tasks.status.${e.status}`)}),(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11.5px] font-semibold",children:gG(e.text)||o("tasks.untitled")})]}),(0,U.jsxs)("span",{className:"flex flex-wrap items-center gap-2 pl-0.5 text-[10px] text-muted",children:["all"===c?(0,U.jsx)("span",{className:"min-w-0 max-w-[110px] truncate",children:e.project}):null,e.dueAt&&e.dueTz?(0,U.jsxs)("span",{className:r?"font-semibold text-danger":"",title:o("tasks.dueTitle",{zone:e.dueTz}),children:["⏰ ",vL(e.dueAt,e.dueTz,(0,eh.JK)())]}):null,e.attachments?.length?(0,U.jsxs)("span",{title:o("tasks.attachCount",{count:e.attachments.length}),children:["\uD83D\uDCCE ",e.attachments.length]}):null,e.source?(0,U.jsxs)("span",{className:"inline-flex items-center gap-0.5 text-info",title:`${o("tasks.sourceTitle")}: ${e.source.text}`,children:[(0,U.jsx)(sx.vv,{className:"h-2.5 w-2.5","aria-hidden":!0}),o("tasks.source")]}):null,e.assignments.length?(0,U.jsxs)("span",{children:["⤷ ",e.assignments.length]}):null,(0,U.jsx)("span",{children:(0,tw.rK)(new Date(e.updatedAt).getTime()/1e3)})]})]}),n?(0,U.jsxs)("div",{className:"flex items-center gap-1.5 pl-0.5",children:[(0,U.jsx)("span",{className:"rounded-full bg-sunken px-1.5 py-0.5 text-[9px] font-bold text-warning",children:o("tasks.unplaced")}),s?(0,U.jsxs)("button",{type:"button",className:"inline-flex items-center gap-0.5 rounded-[6px] border border-border px-1.5 py-0.5 text-[9.5px] font-bold text-accent hover:bg-accent/5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>s(e),children:[(0,U.jsx)(v$.A,{className:"h-2.5 w-2.5","aria-hidden":!0})," ",o("tasks.placeOnMap")]}):null]}):null]},e.id)}):(0,U.jsx)("div",{className:"px-2 py-3 text-center text-[11px] text-muted",children:o("tasks.panelEmpty")})]})]})}var vY=n(6035),vW=n(5738),vV=n(8780);function vJ({files:e,project:t,checked:n,onChange:r,maxHeight:i=240}){let{t:a}=(0,eh.Ym)(),s=(0,Y.useMemo)(()=>e.filter(e=>eM(e)===t&&(eS(e)||eA(e))).sort((e,t)=>t.mtime-e.mtime),[e,t]),l=(0,Y.useMemo)(()=>eR(e),[e]),o=(0,Y.useMemo)(()=>new Set(s.map(e=>e.path)),[s]);return s.length?(0,U.jsx)("div",{className:"flex flex-col gap-0.5 overflow-y-auto",style:{maxHeight:i},children:s.map(e=>{let t=(0,tw.yz)(e),i=eO(e,l).filter(e=>o.has(e.path)).length;return(0,U.jsxs)("div",{className:"flex items-center gap-1",children:[(0,U.jsxs)("label",{className:"flex min-h-11 min-w-0 flex-1 cursor-pointer items-center gap-1.5 rounded-[6px] px-1.5 hover:bg-canvas",children:[(0,U.jsx)("input",{type:"checkbox",checked:n.has(e.path),onChange:()=>{var t;let i;return t=e.path,void((i=new Set(n)).has(t)?i.delete(t):i.add(t),r(i))},className:"h-5 w-5 accent-accent"}),(0,U.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${(0,tw.tz)(e.activity)}`}),(0,U.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px] font-bold",style:t.style,children:t.label}),(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11px] font-semibold",title:(0,tw.cr)(e.title),children:(0,tw.cr)(e.title,46)})]}),i?(0,U.jsxs)("button",{type:"button",className:"inline-flex h-11 min-w-11 shrink-0 items-center justify-center gap-0.5 rounded-[6px] px-1.5 text-[10px] font-semibold text-muted hover:bg-canvas hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:a("tasks.pickerAllChildren"),onClick:()=>(e=>{let t=new Set(n);for(let n of(t.add(e.path),eO(e,l)))o.has(n.path)&&t.add(n.path);r(t)})(e),children:[(0,U.jsx)(dZ.A,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",i]}):null]},e.path)})}):(0,U.jsx)("div",{className:"px-1.5 py-2 text-[11px] text-muted",children:a("tasks.pickerEmpty")})}function vG({value:e,onPick:t}){let{t:n}=(0,eh.Ym)();return(0,U.jsx)("div",{className:"flex flex-wrap items-center gap-1",children:gJ.map(r=>{let i=gV[r],a=r===e;return(0,U.jsx)("button",{type:"button","aria-pressed":a,className:"inline-flex min-h-11 items-center rounded-full border px-3 text-[11px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",style:a?{backgroundColor:i.soft,color:i.color,borderColor:i.color}:{borderColor:"transparent",color:"var(--color-muted)"},onClick:()=>t(r),children:n(`tasks.status.${r}`)},r)})})}function vQ({project:e,files:t,onCreated:n}){let{t:r}=(0,eh.Ym)(),[i,a]=(0,Y.useState)(()=>new Set),s=(0,Y.useRef)(()=>{}),l=vO(e,e=>s.current(e)),{composer:o}=l,c=async a=>{let s=(a??o.textRef.current).trim();if(!o.busy&&!o.voiceSending){if(!s)return void o.setStatus({kind:"err",text:r("tasks.composerNeedsText")});o.setBusy(!0),o.setStatus(null);try{let r=await nS({project:e,text:s,placement:"unplaced",dueAt:l.dueAt,dueTz:l.dueTz,attachments:l.stagedAttachments(),clientRequestId:l.getRequestId()});if("error"in r)return void o.setStatus({kind:"err",text:r.error});let a=[...i];if(a.length){let e=await nR(r.task.id,a);if("error"in e)oC("err",e.error);else{let n=oA(e,t);oC(n.kind,n.text)}}l.reset(),n(r.task)}finally{o.setBusy(!1)}}};return(0,Y.useEffect)(()=>{s.current=c}),(0,U.jsxs)("form",{onSubmit:e=>{e.preventDefault(),l.composer.submit()},className:"flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto p-3",children:[(0,U.jsx)("div",{className:"flex flex-col gap-1.5",children:(0,U.jsx)(vz,{draft:l,placeholder:r("tasks.newPlaceholder"),createLabel:r("tasks.sheetCreate"),leftSlot:(0,U.jsx)("span",{className:"inline-flex min-w-0 items-center gap-1 rounded-full bg-sunken px-1.5 py-1 text-[9.5px] font-semibold text-secondary",children:r("tasks.sheetTargets",{count:i.size})})})}),(0,U.jsxs)("div",{className:"flex flex-col gap-1 rounded-[10px] border border-border bg-card p-1.5",children:[(0,U.jsx)("div",{className:"px-1 text-[10.5px] font-bold text-muted",children:r("tasks.pickerTitle")}),(0,U.jsx)(vJ,{files:t,project:e,checked:i,onChange:a,maxHeight:9999})]})]})}function vX({task:e,files:t,onDeleted:n}){let{t:r}=(0,eh.Ym)(),[i,a]=(0,Y.useState)(e.text),[s,l]=(0,Y.useState)(()=>new Set),[o,c]=(0,Y.useState)(!1),[d,u]=(0,Y.useState)(!1);(0,Y.useEffect)(()=>{if(!d)return;let e=window.setTimeout(()=>u(!1),4e3);return()=>window.clearTimeout(e)},[d]);let p=(0,Y.useRef)(null),m=sK({onError:e=>oC("err",e),onUnclaimedText:e=>a(t=>t?t.trimEnd()+" "+e:e),onLiveCommit:e=>a(t=>t?t.trimEnd()+" "+e:e)}),f=m.liveText?(i?i.trimEnd()+" ":"")+m.liveText:i;sD(p,f,{maxPx:260,minPx:84,pinned:!!m.liveText});let h=async()=>{if(i===e.text)return null;if(!i.trim())return r("tasks.emptyTextBlocked");let t=await nT(e.id,{text:i});return t&&oC("err",t),t},x=async()=>{let n=[...s];if(n.length&&!o){if(!i.trim())return void oC("err",r("tasks.emptyTextBlocked"));c(!0);try{if(await h()!==null)return;let r=await nR(e.id,n);if("error"in r)oC("err",r.error);else{let e=oA(r,t);oC(e.kind,e.text),l(new Set)}}finally{c(!1)}}},g=new Map(t.map(e=>[e.path,e]));return(0,U.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto p-3",children:[(0,U.jsxs)("div",{className:"flex flex-col gap-1.5 rounded-[10px] border border-border bg-card p-2",children:[(0,U.jsx)("textarea",{ref:p,value:f,readOnly:!!m.liveText,onChange:e=>a(e.target.value),onBlur:()=>void h(),rows:4,"aria-label":r("tasks.editAria"),maxLength:6e3,className:"w-full resize-none overflow-y-auto rounded-[8px] border border-border bg-card px-2.5 py-1.5 text-[12.5px] leading-[18px] text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40"}),(0,U.jsxs)("div",{className:"flex items-center justify-between gap-1.5",children:[(0,U.jsx)(vG,{value:e.status,onPick:t=>{t!==e.status&&nT(e.id,{status:t}).then(e=>{e&&oC("err",e)})}}),(0,U.jsx)(lj,{...m,onText:e=>a(t=>t?t.trimEnd()+" "+e:e)})]})]}),e.assignments.length?(0,U.jsxs)("div",{className:"flex flex-col gap-1 rounded-[10px] border border-border bg-card p-2",children:[(0,U.jsx)("div",{className:"text-[10.5px] font-bold text-muted",children:r("tasks.sheetAssignments")}),e.assignments.map((n,a)=>{let s=n.path?g.get(n.path)??null:null,l="failed"===n.state,o=s?(0,tw.yz)(s):null,c=n.path?s?(0,tw.cr)(s.title,44):n.path.split("/").pop()??n.path:l?r("tasks.failedChip"):r("tasks.spawning");return(0,U.jsxs)("div",{className:`flex min-h-11 items-center gap-1.5 rounded-[6px] px-1.5 ${l?"bg-danger-soft text-danger":s?"bg-canvas":"bg-canvas opacity-60"}`,title:l?r("tasks.chipFailedTitle",{error:n.error??""}):void 0,children:[s?(0,U.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${(0,tw.tz)(s.activity)}`}):null,o?(0,U.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px] font-bold",style:o.style,children:o.label}):null,(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11px] font-semibold",children:c}),l?(0,U.jsx)("span",{"aria-hidden":!0,children:"⚠"}):null,n.path&&(l||!s)||l&&n.launchId?(0,U.jsx)("button",{type:"button","data-task-sheet-retry":!0,className:"inline-flex min-h-11 min-w-11 shrink-0 items-center justify-center rounded px-2 text-[11px] font-bold text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>{(async()=>{if(!i.trim())return oC("err",r("tasks.emptyTextBlocked"));if(await h()!==null)return;let a=n.launchId;if(l&&!n.path&&a){let t=await nO(e.id,a);"task"in t?oC("ok",r("tasks.retryLaunched")):oC("err",t.error);return}let s=await nR(e.id,[n.path]);if("error"in s)oC("err",s.error);else{let e=oA(s,t);oC(e.kind,e.text)}})()},children:l&&!n.path?r("tasks.retryLaunch"):r("tasks.retry")}):null]},(n.path??"spawning")+a)})]}):null,(0,U.jsxs)("div",{className:"flex flex-col gap-1 rounded-[10px] border border-border bg-card p-1.5",children:[(0,U.jsx)("div",{className:"px-1 text-[10.5px] font-bold text-muted",children:r("tasks.pickerTitle")}),(0,U.jsx)(vJ,{files:t,project:e.project,checked:s,onChange:l,maxHeight:9999}),(0,U.jsxs)("button",{type:"button",disabled:!s.size||o,className:"mt-1 inline-flex min-h-11 items-center justify-center gap-1.5 rounded-[8px] border border-accent bg-accent text-[12px] font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40",onClick:()=>void x(),children:[o?(0,U.jsx)(dR.A,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):(0,U.jsx)(fn.A,{className:"h-4 w-4","aria-hidden":!0}),r("tasks.pickerSend",{count:s.size})]})]}),(0,U.jsxs)("button",{type:"button",className:`inline-flex min-h-11 items-center justify-center gap-1.5 rounded-[8px] border text-[12px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${d?"border-danger bg-danger text-white":"border-border bg-card text-muted hover:border-danger/40 hover:text-danger"}`,onClick:()=>{d?nP(e.id).then(e=>{e?oC("err",e):n()}):u(!0)},children:[(0,U.jsx)(vW.A,{className:"h-3.5 w-3.5","aria-hidden":!0}),d?r("tasks.deleteConfirm"):r("tasks.delete")]})]})}function vZ({project:e,projectName:t,tasks:n,files:r,initialView:i,onClose:a}){let{t:s}=(0,eh.Ym)(),[l,o]=(0,Y.useState)(i),c=(0,Y.useMemo)(()=>[...n].sort((e,t)=>("done"===e.status)-("done"===t.status)||t.updatedAt.localeCompare(e.updatedAt)),[n]),d="object"==typeof l?n.find(e=>e.id===l.taskId)??null:null;return(0,U.jsxs)("div",{className:"fixed inset-0 z-[60] flex flex-col bg-canvas pb-[env(safe-area-inset-bottom)]",children:[(0,U.jsxs)("div",{className:"flex min-h-[52px] shrink-0 items-center gap-2 border-b border-border bg-card px-2 py-1.5",children:["list"!==l?(0,U.jsx)("button",{type:"button",className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-[8px] border border-border bg-canvas text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":s("tasks.sheetBack"),onClick:()=>o("list"),children:(0,U.jsx)(vV.A,{className:"h-5 w-5","aria-hidden":!0})}):null,(0,U.jsx)("span",{className:"shrink-0 pl-1 text-[13px] font-bold",children:"new"===l?s("tasks.sheetNew"):d?gG(d.text)||s("tasks.untitled"):s("tasks.panelTitle")}),(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11.5px] text-muted",title:t??e,children:eb(e,t)}),(0,U.jsx)("button",{type:"button",className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-[8px] border border-border bg-canvas text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":s("common.close"),onClick:a,children:(0,U.jsx)(sx.X,{className:"h-5 w-5","aria-hidden":!0})})]}),"list"===l?(0,U.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col gap-1 overflow-y-auto p-2",children:[(0,U.jsxs)("button",{type:"button",className:"flex min-h-11 shrink-0 items-center justify-center gap-1 rounded-[10px] border border-dashed border-accent/50 text-[13px] font-bold text-accent hover:bg-accent/5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>o("new"),children:["+ ",s("tasks.sheetNew")]}),c.map(e=>{let t=gV[e.status];return(0,U.jsxs)("button",{type:"button",className:`flex w-full min-w-0 flex-col gap-0.5 rounded-[10px] border border-border bg-card px-2.5 py-2 text-left shadow-1 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${"done"===e.status?"opacity-60":""}`,onClick:()=>o({taskId:e.id}),children:[(0,U.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[(0,U.jsx)("span",{className:"shrink-0 rounded-full px-1.5 py-0.5 text-[9px] font-bold",style:{backgroundColor:t.soft,color:t.color},children:s(`tasks.status.${e.status}`)}),(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12.5px] font-semibold",children:gG(e.text)||s("tasks.untitled")})]}),(0,U.jsxs)("span",{className:"flex items-center gap-2 pl-0.5 text-[10.5px] text-muted",children:[e.assignments.length?(0,U.jsxs)("span",{children:["⤷ ",e.assignments.length]}):null,(0,U.jsx)("span",{children:(0,tw.rK)(new Date(e.updatedAt).getTime()/1e3)})]})]},e.id)}),c.length?null:(0,U.jsx)("div",{className:"px-2 py-4 text-center text-[11.5px] text-muted",children:s("tasks.sheetEmpty")})]}):"new"===l?(0,U.jsx)(vQ,{project:e,files:r,onCreated:e=>o({taskId:e.id})}):d?(0,U.jsx)(vX,{task:d,files:r,onDeleted:()=>o("list")},d.id):(0,U.jsx)("div",{className:"flex flex-1 items-center justify-center text-[12px] text-muted",children:s("tasks.sheetGone")})]})}function v0(e,t){let n=new Map,r=new Set;for(let t of e)r.add(t.path),t.conversationId&&n.set(t.conversationId,t.path);let i=new Map,a=(e,t)=>{let n=i.get(e);n?n.push(t):i.set(e,[t])};for(let e of t){if("done"===e.status)continue;let t=new Set;for(let i of e.assignments){let s=(i.conversationId?n.get(i.conversationId):void 0)??(i.path&&r.has(i.path)?i.path:void 0);!s||t.has(s)||(t.add(s),a(s,{task:e,relation:"assignment"}))}e.source&&r.has(e.source.path)&&!t.has(e.source.path)&&a(e.source.path,{task:e,relation:"source"})}for(let e of i.values())e.sort((e,t)=>e.relation===t.relation?0:"assignment"===e.relation?-1:1);return i}var v1=n(3665),v2=n(715);function v5({verdict:e,error:t,className:n="h-3 w-3"}){return"APPROVE"===e?(0,U.jsx)(fv.A,{className:n,strokeWidth:3,"aria-hidden":!0}):"REQUEST_CHANGES"===e?(0,U.jsx)(K.A,{className:n,strokeWidth:3,"aria-hidden":!0}):"COMMENT"===e?(0,U.jsx)(v1.A,{className:n,strokeWidth:2.5,"aria-hidden":!0}):t?(0,U.jsx)(i4.A,{className:n,"aria-hidden":!0}):(0,U.jsx)(v2.A,{className:n,"aria-hidden":!0})}function v4(e,t){return t.error?e("roundDeck.roundAborted",{n:t.n}):t.verdict?e("roundDeck.roundVerdict",{n:t.n,verdict:`${to[t.verdict]} ${t.verdict}`}):e("roundDeck.roundInProgress",{n:t.n})}function v3({round:e,depth:t,pulse:n,onPull:r}){let{t:i}=(0,eh.Ym)(),a=tc(e.verdict);return(0,U.jsxs)("button",{className:`deck-tab absolute inset-x-0 flex items-center gap-1.5 rounded-[9px] border bg-card px-2.5 text-left shadow-1 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${n?"deck-tab-live border-success/50":"border-border hover:border-accent/45"}`,style:{height:36,bottom:-(30*t)-10,zIndex:10-t,transform:`scale(${1-.035*t}) translateZ(${-(34*t)}px)`,transitionDelay:`${.03*t}s`},title:e.error?`${v4(i,e)}: ${e.error}`:v4(i,e),onClick:r,children:[(0,U.jsxs)("span",{className:"inline-flex h-4 shrink-0 items-center gap-1 rounded-full px-1.5 text-[9.5px] font-bold",style:{backgroundColor:a.soft,color:a.color},children:["R",e.n," ",(0,U.jsx)(v5,{verdict:e.verdict,error:!!e.error,className:"h-2.5 w-2.5"})]}),(0,U.jsxs)("span",{className:"min-w-0 flex-1 truncate text-[10.5px] font-semibold text-muted",children:[e.error?i("roundDeck.aborted"):e.verdict?e.verdict:i("roundDeck.reviewInProgress"),null!=e.findingsCount&&e.findingsCount>0?` \xb7 ${i("roundDeck.findings",{count:e.findingsCount})}`:""]}),n?(0,U.jsx)("span",{className:"h-1.5 w-1.5 shrink-0 animate-pulse rounded-full bg-success","aria-hidden":!0}):null]})}function v6({flow:e,rounds:t,focusRound:n,dormant:r=!1,groupLabel:i}){let{t:a}=(0,eh.Ym)(),s=t.length?t[t.length-1]:null,l=bT(e),o=bP(e),[c,d]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{d(function(e,t){let n=e.getItem(bM(t));if(null===n)return null;if("1"===n)return{v:"collapsed",at:null};try{let e=JSON.parse(n);if("expanded"!==e.v&&"collapsed"!==e.v)return null;return{v:e.v,at:"string"==typeof e.at?e.at:null}}catch{return null}}(window.localStorage,e.id))},[e.id]);let u=c&&(null===c.at||c.at===o)?"collapsed"===c.v:l,p=t=>{let n=t?"collapsed":"expanded";d({v:n,at:o}),b$(window.localStorage,e.id,n,o)},[m,f]=(0,Y.useState)(u),[h,x]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{if(u===m)return;if("function"!=typeof window.matchMedia||window.matchMedia("(prefers-reduced-motion: reduce)").matches){f(u),x(null);return}if(u){x("collapsing");let e=window.setTimeout(()=>{f(!0),x(null)},320);return()=>window.clearTimeout(e)}f(!1),x("expanding");let e=window.setTimeout(()=>x(null),380);return()=>window.clearTimeout(e)},[u,m]);let[g,b]=(0,Y.useState)(null),[v,w]=(0,Y.useState)(null);if(null!=n&&n!==v){w(n);let e=t.findLast(e=>e.round.n===Math.round(n));b(e?.key??null)}let[y,k]=(0,Y.useState)(null);s&&s.key!==y&&(k(s.key),null!=g&&null===s.round.verdict&&b(null));let j=(0,Y.useMemo)(()=>t.find(e=>e.key===g)??s,[t,g,s]);if(!j)return(0,U.jsx)("div",{className:"flex h-full items-center justify-center rounded-[10px] border border-dashed border-strong bg-card/60",children:(0,U.jsx)("span",{className:"text-[12px] font-semibold text-muted",children:a("roundDeck.waitingFirst")})});let N=t.filter(e=>e.key!==j.key).reverse(),S=N.slice(0,5),C=N.length-S.length,A=tc(j.round.verdict),I=null!==j.round.verdict||!!j.round.error,M=s&&j.key!==s.key&&null===s.round.verdict&&!s.round.error?s:null,T=i?a("roundDeck.groupAriaNamed",{name:i,count:t.length}):a("roundDeck.groupAria",{count:t.length}),P=(0,U.jsx)("button",{type:"button","data-review-deck-collapse":!0,className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-[8px] border border-border bg-canvas text-muted shadow-1 hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":a("roundDeck.collapseStack",{count:t.length}),"aria-expanded":"true",title:a("roundDeck.collapseStack",{count:t.length}),onClick:()=>p(!0),children:(0,U.jsx)(sx.O0,{className:"h-3.5 w-3.5","aria-hidden":!0})});if(m){let n=s?.round??j.round,r=tc(n.verdict),i=(0,tw.zZ)(e.roles.reviewer?.engine??"claude"),l=n.terminalAt??n.reviewedAt??n.startedAt,o=l?Date.parse(l):NaN;return(0,U.jsxs)("button",{type:"button","data-review-deck-collapsed":!0,className:"deck-chip-in flex h-12 w-full items-center gap-2 rounded-[10px] border border-border bg-card px-3 text-left shadow-1 hover:border-accent/45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":a("roundDeck.expandStack",{count:t.length}),"aria-expanded":"false",title:a("roundDeck.expandStack",{count:t.length}),onClick:()=>p(!1),children:[(0,U.jsx)("span",{className:"inline-flex h-6 shrink-0 items-center rounded-full px-2 text-[10px] font-bold",style:{backgroundColor:r.soft,color:r.color},children:a("roundDeck.roundsCount",{count:t.length})}),(0,U.jsxs)("span",{className:"min-w-0 flex-1 truncate text-[11px] font-semibold text-muted",children:[n.error?a("roundDeck.aborted"):n.verdict?`${to[n.verdict]} ${n.verdict}`:a("roundDeck.reviewInProgress"),null!=n.findingsCount&&n.findingsCount>0?` \xb7 ${a("roundDeck.findings",{count:n.findingsCount})}`:""]}),(0,U.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px] font-bold",style:i.style,children:i.label}),Number.isFinite(o)?(0,U.jsx)("span",{className:"shrink-0 text-[10px] font-normal tabular-nums text-muted",children:(0,tw.rK)(o/1e3)}):null,(0,U.jsx)(sx.yQ,{className:"h-4 w-4 shrink-0 text-accent","aria-hidden":!0})]})}return(0,U.jsxs)("div",{role:"group","aria-label":T,className:`deck-3d relative h-full ${"collapsing"===h?"deck-collapsing":"expanding"===h?"deck-expanding":""}`,style:{paddingBottom:30*Math.min(N.length,5+ +!!C)},children:[(0,U.jsx)("div",{className:"scheme-enter deck-front relative z-[11] flex h-full flex-col",children:j.file?(0,U.jsx)(g6,{file:j.file,tasks:[],isRoot:!1,dormant:r,noComposer:"headless"===e.reviewerMode||I,headerActions:P,banner:(0,U.jsxs)("div",{className:"flex h-6 shrink-0 items-center gap-1.5 border-b border-border px-2.5 text-[10.5px] font-bold",style:{backgroundColor:A.soft,color:A.color},children:[v4(a,j.round),null!=j.round.findingsCount&&j.round.findingsCount>0?(0,U.jsxs)("span",{className:"font-semibold opacity-80",children:["\xb7 ",a("roundDeck.findings",{count:j.round.findingsCount})]}):null,j.round.readyNote?(0,U.jsxs)("span",{className:"min-w-0 flex-1 truncate font-semibold opacity-70",title:j.round.readyNote,children:["\xb7 ",j.round.readyNote]}):null]})}):(0,U.jsxs)("div",{className:"relative flex h-full flex-col items-center justify-center gap-1 rounded-[10px] border border-border bg-card shadow-1",children:[(0,U.jsx)("div",{className:"absolute right-1.5 top-1.5",children:P}),(0,U.jsx)("span",{className:"text-[12px] font-semibold text-muted",children:v4(a,j.round)}),(0,U.jsx)("span",{className:"text-[11px] text-muted",children:j.round.error?j.round.error:a("roundDeck.spawningReviewer")})]})},j.key),S.map((e,t)=>(0,U.jsx)(v3,{round:e.round,depth:t,pulse:M?.key===e.key,onPull:()=>b(e.key)},e.key)),C>0?(0,U.jsx)("div",{className:"pointer-events-none absolute inset-x-6 flex items-center justify-center rounded-[9px] border border-border bg-card/70 text-[10px] font-semibold text-muted shadow-1",style:{height:26,bottom:-(30*S.length)-8,zIndex:10-S.length},"aria-hidden":!0,children:a("roundDeck.moreRounds",{count:C})}):null]})}function v8({pipeline:e,stage:t,attempt:n,flows:r=[],files:i=[],availablePaths:a,mobile:s=!1,canOpenFlow:l=!0,canOpenPath:o=!0,onClose:c,onOpenPath:d,onOpenFlow:u}){let{t:p}=(0,eh.Ym)(),[m,f]=(0,Y.useState)(!1),[h,x]=(0,Y.useState)(!1),[g,b]=(0,Y.useState)(null),v=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{let e=document.activeElement instanceof HTMLElement?document.activeElement:null;return v.current?.focus(),()=>e?.focus()},[]);let w=xO(p,t),y=n.verdict,k="needs_decision"===e.state&&e.cursor?.stageId===t.id,j=xg(e,t.id).filter(e=>e.n!==n.n),N=new Set(xg(e,t.id).flatMap(e=>e.flowId?[e.flowId]:[])),S=new Set(xg(e,t.id).flatMap(e=>e.agentPath?[e.agentPath]:[])),C=new Set,A=r.filter(e=>N.has(e.id)).flatMap(e=>e.rounds.flatMap(t=>te(e,t,i).flatMap(({path:e})=>S.has(e)||C.has(e)?[]:(C.add(e),[{n:t.n,path:e}])))),I=e=>!a||a.has(e),M=s?"min-h-11 min-w-11":"",T=y?.findings??[],P=m?T:T.slice(0,8),$=y?xH[y.status]:null,E=async t=>{if(h)return;x(!0),b(null);let n=await x4(e.id,t);x(!1),n?b(n):c()};return(0,U.jsxs)("div",{ref:v,"data-scheme-ui":!0,tabIndex:-1,role:"dialog","aria-label":p("pipelineVerdict.title",{label:w}),className:"flex max-h-[80vh] w-[260px] flex-col gap-2 overflow-y-auto rounded-[12px] border border-border bg-card p-2.5 shadow-2 focus-visible:outline-none",onKeyDown:e=>{"Escape"===e.key&&(e.stopPropagation(),c())},children:[(0,U.jsxs)("div",{className:"flex items-center gap-2",children:[y&&$?(0,U.jsx)(sv,{style:{backgroundColor:$.soft,color:$.color},children:xU(p,y.status)}):(0,U.jsx)("span",{className:"text-[11px] font-semibold text-muted",children:n.error??e.stateDetail??p("pipelineVerdict.noFindings")}),h?(0,U.jsx)(dO.A,{className:"ml-auto h-3 w-3 animate-spin text-muted","aria-hidden":!0}):null]}),y&&"number"==typeof y.confidence?(0,U.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,U.jsx)("span",{className:"shrink-0 text-label font-semibold text-secondary",children:p("pipelineVerdict.confidence")}),(0,U.jsx)("span",{className:"h-1.5 min-w-0 flex-1 overflow-hidden rounded-full bg-border","aria-hidden":!0,children:(0,U.jsx)("span",{className:"block h-full rounded-full",style:{width:`${Math.round(100*Math.max(0,Math.min(1,y.confidence)))}%`,backgroundColor:$?.color??"var(--color-accent)"}})}),(0,U.jsx)("span",{className:"shrink-0 font-mono text-[10px] text-primary",children:y.confidence.toFixed(2)})]}):null,n.reviewHeadSha?(0,U.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,U.jsx)("span",{className:"shrink-0 text-label font-semibold text-secondary",children:p("pipelineVerdict.reviewerSha",{sha:n.reviewHeadSha.slice(0,8)})}),(0,U.jsx)("code",{className:"min-w-0 truncate font-mono text-[10px] text-primary",title:n.reviewHeadSha,children:n.reviewHeadSha})]}):null,T.length?(0,U.jsxs)("div",{className:"flex max-h-40 flex-col gap-1 overflow-y-auto",children:[(0,U.jsx)("span",{className:"text-label font-semibold text-secondary",children:p("pipelineVerdict.findings",{count:T.length})}),(0,U.jsx)("ul",{className:"flex flex-col gap-1",children:P.map((e,t)=>(0,U.jsx)("li",{className:"rounded-[7px] bg-canvas px-2 py-1 text-[10.5px] leading-4 text-primary",children:e},t))}),!m&&T.length>8?(0,U.jsx)("button",{type:"button",className:`self-start text-[10px] font-semibold text-accent hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${M}`,onClick:()=>f(!0),children:p("pipelineVerdict.more",{count:T.length-8})}):null]}):null,j.length?(0,U.jsxs)("div",{className:"flex shrink-0 flex-col gap-0.5 border-t border-border pt-1.5",children:[(0,U.jsx)("span",{className:"text-label font-semibold text-secondary",children:p("pipelineVerdict.priorAttempts")}),(0,U.jsx)("div",{className:"flex max-h-24 flex-col gap-0.5 overflow-y-auto",children:j.map(e=>{let t=p("pipelineVerdict.attemptLine",{n:e.n,status:e.verdict?xU(p,e.verdict.status):xR(p,e.state)});return e.agentPath&&d&&I(e.agentPath)?(0,U.jsx)("button",{type:"button","aria-label":p("pipelineVerdict.openAttemptTranscript",{n:e.n}),onClick:()=>d(e.agentPath),className:`rounded-control px-1 text-left font-mono text-[9.5px] text-muted hover:bg-canvas hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${M}`,children:t},e.n):(0,U.jsx)("span",{className:"font-mono text-[9.5px] text-muted",children:t},e.n)})})]}):null,A.length?(0,U.jsxs)("div",{className:"flex shrink-0 flex-col gap-0.5 border-t border-border pt-1.5",children:[(0,U.jsx)("span",{className:"text-label font-semibold text-secondary",children:p("pipelineVerdict.reviewTranscripts")}),(0,U.jsx)("div",{className:"flex max-h-24 flex-col gap-0.5 overflow-y-auto",children:A.map(e=>(0,U.jsx)("button",{type:"button",disabled:!d||!I(e.path),"aria-label":p("pipelineVerdict.openReviewTranscript",{n:e.n}),onClick:()=>d?.(e.path),className:`rounded-control px-1 text-left font-mono text-[9.5px] text-muted hover:bg-canvas hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40 ${M}`,children:p("pipelineVerdict.openReviewTranscript",{n:e.n})},e.path))})]}):null,g?(0,U.jsx)("span",{className:"truncate text-[10px] font-semibold text-danger",title:g,children:g}):null,(0,U.jsxs)("div",{className:"flex shrink-0 flex-wrap items-center gap-1.5 border-t border-border pt-2",children:[n.agentPath&&d&&o&&I(n.agentPath)?(0,U.jsx)("button",{type:"button","aria-label":p("pipelineVerdict.openAttemptTranscript",{n:n.n}),className:`rounded-full border border-border bg-canvas px-2.5 py-1 text-[10px] font-bold text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${M}`,onClick:()=>d(n.agentPath),children:p("pipelineVerdict.openTranscript")}):null,n.flowId&&u&&l?(0,U.jsx)("button",{type:"button",className:`rounded-full border border-border bg-canvas px-2.5 py-1 text-[10px] font-bold text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${M}`,onClick:()=>u(n.flowId),children:p("pipelineVerdict.openFlow")}):null,k?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("button",{type:"button",className:`ml-auto rounded-full border border-accent bg-accent px-2.5 py-1 text-[10px] font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40 ${M}`,disabled:h,onClick:()=>void E("retry-stage"),children:p("pipelineVerdict.retry")}),(0,U.jsx)("button",{type:"button",className:`rounded-full border border-border bg-canvas px-2.5 py-1 text-[10px] font-bold text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40 ${M}`,disabled:h,onClick:()=>void E("skip-stage"),children:p("pipelineVerdict.skip")})]}):null]})]})}let v7=(e,t)=>`llvOrchestratorDraft:${e}:${t}`;function v9(e,t){try{return window.sessionStorage.getItem(v7(e,t))??""}catch{return""}}function we(e,t,n){try{n?window.sessionStorage.setItem(v7(e,t),n):window.sessionStorage.removeItem(v7(e,t))}catch{}}function wt(e,t){if("live"===e.kind){let n=e.transition?.kind??null;return{state:e.liveness,tap:t.conversationReady?"conversation":"sheet",rotation:e.rotation?.level??null,transition:n,attention:"dead"===e.liveness||"error"===n}}let n={tap:"sheet",rotation:null,transition:null};return"intent-error"===e.kind?{...n,state:"intent-error",attention:!0}:"unavailable"===e.kind?{...n,state:"unavailable",attention:!0}:"creating"===e.kind?{...n,state:"creating",attention:!1}:"loading"===e.kind?{...n,state:"loading",attention:!1}:{...n,state:"draft",attention:!1}}let wn={loading:{chip:"border-border bg-canvas text-muted",dot:"bg-strong/60"},unavailable:{chip:"border-warning/45 bg-warning-soft text-warning",dot:"bg-warning"},draft:{chip:"border-dashed border-accent/50 bg-accent/5 text-accent",dot:"bg-accent/60"},creating:{chip:"border-accent/45 bg-accent-soft text-accent",dot:"bg-accent"},"intent-error":{chip:"border-danger/40 bg-danger-soft text-danger",dot:"bg-danger"},live:{chip:"border-success/45 bg-success-soft text-success",dot:"bg-success"},stalled:{chip:"border-warning/45 bg-warning-soft text-warning",dot:"bg-warning"},resumable:{chip:"border-border bg-canvas text-muted",dot:"bg-strong"},dead:{chip:"border-danger/40 bg-danger-soft text-danger",dot:"bg-danger"},resolving:{chip:"border-border bg-canvas text-muted",dot:"bg-strong/60"}},wr={loading:"orchPanel.badgeReading",unavailable:"orchMobile.unreadable",draft:"orchPanel.badgeNone",creating:"orchPanel.badgeCreating","intent-error":"orchPanel.badgeFailed",live:"orchPanel.badgeLive",stalled:"orchPanel.badgeStalled",resumable:"orchPanel.badgeResumable",dead:"orchPanel.badgeDead",resolving:"orchPanel.badgeResolving"};function wi({project:e,projectName:t,projectCwd:n,state:r,file:i,pendingMandate:a,viewerMcpRegistered:s,submitting:l,onConfirm:o,onRecheck:c,onOpenConversation:d,onClose:u}){let{t:p}=(0,eh.Ym)(),m=sW(),f=(0,Y.useRef)(null),h=(0,Y.useRef)(null),x=(0,Y.useRef)(!1),[g,b]=(0,Y.useState)(!1),[v,w]=(0,Y.useState)(()=>v9(e,"mandate")||dX),[y,k]=(0,Y.useState)(null),j=dB({storage:{read:t=>v9(e,t),write:(t,n)=>we(e,t,n)},initialEngine:dJ,initialModel:dG,initialEffort:"low"});as({containerRef:f,onClose:u}),(0,Y.useEffect)(()=>{if(!g||m<=0){x.current=!1;return}x.current||(x.current=!0,h.current?.scrollIntoView({block:"start"}))},[g,m]);let N=t=>{w(t),we(e,"mandate",t===dX?"":t)},S=wt(r,{conversationReady:!!i}),C="draft"===r.kind||"intent-error"===r.kind,A={engine:j.engine,model:j.model,effort:j.effort,speed:j.speed,accountId:j.launchAccountId},I=C?{key:"intent-error"===r.kind?"orchPanel.confirmRetry":"orchPanel.confirm",run:()=>{let e=v.trim();e?(k(null),o({...A,mandate:e})):k(p("orchPanel.mandateRequired"))},busy:l}:"creating"===r.kind?!l&&r.clientRequestId?{key:"orchPanel.creatingResume",run:()=>o({...A,mandate:a||dX,replayRequestId:r.clientRequestId}),busy:!1}:null:"unavailable"===r.kind?{key:"orchPanel.recheck",run:c,busy:!1}:"live"===r.kind&&i?{key:"orchMobile.open",run:d,busy:!1}:null;return(0,U.jsx)("div",{className:"fixed inset-0 z-[60] flex flex-col bg-canvas pb-[env(safe-area-inset-bottom)]",style:m>0?{paddingBottom:m}:void 0,role:"presentation",children:(0,U.jsxs)("form",{ref:f,role:"dialog","aria-modal":"true","aria-label":p("orchMobile.sheetAria",{project:t}),tabIndex:-1,"data-testid":"mobile-orchestrator-sheet","data-orchestrator-sheet-state":S.state,className:"flex min-h-0 flex-1 flex-col focus-visible:outline-none",onSubmit:e=>{e.preventDefault(),I?.run()},children:[(0,U.jsxs)("header",{className:"flex min-h-[52px] shrink-0 items-center gap-2 border-b border-border bg-card px-2 py-1.5",children:[(0,U.jsx)("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-control bg-accent-soft text-accent","aria-hidden":!0,children:(0,U.jsx)(dE.A,{className:"h-4 w-4"})}),(0,U.jsxs)("span",{className:"flex min-w-0 flex-1 flex-col",children:[(0,U.jsx)("span",{className:"truncate text-body font-semibold text-primary",children:p("orchPanel.title")}),(0,U.jsx)("span",{className:"truncate text-caption text-muted",title:t,children:t})]}),(0,U.jsx)("span",{className:`shrink-0 rounded-full border px-2 py-0.5 text-caption font-semibold ${wn[S.state].chip}`,children:p(wr[S.state])}),(0,U.jsx)("button",{type:"button",onClick:u,"aria-label":p("common.close"),className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-control border border-border bg-canvas text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:(0,U.jsx)(sx.X,{className:"h-5 w-5","aria-hidden":!0})})]}),(0,U.jsx)("div",{className:"flex min-h-0 flex-1 flex-col gap-3 overflow-y-auto px-3 py-3",children:"loading"===r.kind?(0,U.jsxs)(wc,{children:[(0,U.jsx)(dR.A,{className:"h-5 w-5 animate-spin text-muted","aria-hidden":!0}),(0,U.jsx)("p",{className:"text-ui text-muted",role:"status",children:p("orchPanel.loading")})]}):"unavailable"===r.kind?(0,U.jsxs)(wc,{children:[(0,U.jsx)(i4.A,{className:"h-6 w-6 text-warning","aria-hidden":!0}),(0,U.jsx)("p",{className:"text-body font-semibold text-primary",role:"alert",children:p("orchPanel.unavailable")}),(0,U.jsx)("p",{className:"text-ui leading-4 text-muted",children:p("orchPanel.unavailableHint")})]}):"creating"===r.kind?(0,U.jsxs)(wc,{children:[(0,U.jsx)(dR.A,{className:"h-5 w-5 animate-spin text-accent","aria-hidden":!0}),(0,U.jsx)("p",{className:"text-body font-semibold text-primary",role:"status",children:p("orchPanel.creating")}),(0,U.jsx)("p",{className:"text-ui leading-4 text-muted",children:p("orchPanel.creatingHint")}),r.launchId?(0,U.jsx)("p",{className:"max-w-full truncate font-mono text-caption text-muted",title:r.launchId,children:p("orchPanel.receipt",{launchId:r.launchId})}):null,!l&&r.clientRequestId?(0,U.jsx)("p",{className:"text-ui leading-4 text-muted",children:p("orchPanel.creatingStuck")}):null]}):"live"===r.kind?(0,U.jsx)(wa,{state:r,file:i}):(0,U.jsxs)(U.Fragment,{children:["intent-error"===r.kind?(0,U.jsxs)("div",{className:"shrink-0 rounded-surface border border-danger/40 bg-danger-soft px-3 py-2.5",role:"alert","data-orchestrator-intent-error":!0,children:[(0,U.jsxs)("p",{className:"flex items-center gap-1.5 text-ui font-semibold text-danger",children:[(0,U.jsx)(i4.A,{className:"h-4 w-4 shrink-0","aria-hidden":!0}),p("same"===r.retry?"orchPanel.errorUnknownTitle":"orchPanel.errorTitle")]}),(0,U.jsx)("pre",{className:"mt-1 max-h-24 overflow-y-auto whitespace-pre-wrap break-words font-sans text-ui leading-4 text-secondary",children:r.error}),(0,U.jsx)("p",{className:"mt-1 text-caption text-muted",children:p("same"===r.retry?"orchPanel.errorUnknownHint":"orchPanel.errorHint")})]}):(0,U.jsxs)("div",{className:"shrink-0",children:[(0,U.jsx)("h2",{className:"text-title font-semibold text-primary",children:p("orchPanel.draftTitle")}),(0,U.jsx)("p",{className:"mt-1 text-ui leading-4 text-muted",children:p(r.vacated?"orchPanel.draftHintVacated":"orchPanel.draftHint",{project:t})})]}),(0,U.jsx)("p",{className:"shrink-0 rounded-control border border-border bg-card px-3 py-2 font-mono text-caption text-secondary","data-viewer-mcp-status":s?"registered":"missing",role:"status",children:p(s?"orchPanel.viewerMcpRegistered":"orchPanel.viewerMcpMissing")}),(0,U.jsx)("div",{className:"shrink-0 [&_button]:min-h-11 [&_select]:min-h-11",children:(0,U.jsx)(dW,{draft:j,disabled:l,stacked:!0})}),(0,U.jsxs)("div",{ref:h,className:"flex min-h-[180px] flex-1 flex-col gap-1",children:[(0,U.jsxs)("div",{className:"flex min-h-11 items-center gap-2",children:[(0,U.jsx)("label",{className:"text-label font-semibold text-muted",htmlFor:"mobile-orchestrator-mandate",children:p("orchPanel.mandate")}),v!==dX?(0,U.jsxs)("button",{type:"button",onClick:()=>N(dX),disabled:l,className:"inline-flex min-h-11 items-center gap-1 rounded-control border border-border bg-card px-3 text-caption font-semibold text-muted hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60",children:[(0,U.jsx)(sg.A,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",p("orchPanel.restoreDefault")]}):null,(0,U.jsx)("span",{className:"ml-auto shrink-0 text-caption text-muted",children:p("orchPanel.mandateSent")})]}),(0,U.jsx)("textarea",{id:"mobile-orchestrator-mandate","data-orchestrator-mandate":!0,value:v,disabled:l,onChange:e=>N(e.target.value),onFocus:()=>b(!0),onBlur:()=>b(!1),spellCheck:!1,className:"min-h-[160px] w-full flex-1 resize-none rounded-surface border border-border bg-sunken px-3 py-2.5 text-ui leading-[1.45] text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60"}),n?(0,U.jsx)("p",{className:"truncate font-mono text-caption text-muted",title:n,children:p("orchPanel.cwd",{cwd:n})}):null]})]})}),I?(0,U.jsxs)("div",{className:"flex shrink-0 flex-col gap-2 border-t border-border bg-sunken px-3 py-2.5",children:[y?(0,U.jsx)("p",{className:"text-ui font-semibold text-danger",role:"alert",children:y}):null,(0,U.jsxs)("button",{type:"submit","data-orchestrator-confirm":!0,disabled:I.busy,className:"inline-flex min-h-11 w-full items-center justify-center gap-1.5 rounded-control border border-accent bg-accent px-3 text-body font-semibold text-white shadow-1 hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60",children:[I.busy?(0,U.jsx)(dR.A,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):(0,U.jsx)(dE.A,{className:"h-4 w-4","aria-hidden":!0}),p(I.key)]})]}):null]})})}function wa({state:e,file:t}){let{t:n}=(0,eh.Ym)(),r=t?(0,tw.yz)(t):null;return(0,U.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col gap-3",children:[(0,U.jsxs)("div",{className:"shrink-0",children:[(0,U.jsx)("h2",{className:"text-title font-semibold text-primary",children:n("orchMobile.liveTitle")}),(0,U.jsxs)("p",{className:"mt-1 flex flex-wrap items-center gap-1.5 text-ui text-muted",children:[r?(0,U.jsx)("span",{className:"rounded-full px-2 py-0.5 text-caption font-semibold",style:r.style,children:r.label}):null,t?.model?(0,U.jsx)("span",{className:"text-ui font-semibold text-secondary",children:t.model}):null,(0,U.jsx)("span",{children:n(wr[e.liveness])})]})]}),e.transition?(0,U.jsx)(ws,{transition:e.transition}):null,e.rotation?(0,U.jsx)(wl,{rotation:e.rotation}):null,d2(e,t)?(0,U.jsx)(wo,{tone:"warning",children:n("orchPanel.stalled")}):null,"resumable"===e.liveness?(0,U.jsx)(wo,{tone:"quiet",children:n("orchPanel.resumable")}):null,t?(0,U.jsx)("p",{className:"text-ui leading-4 text-muted",children:n("orchMobile.liveHint")}):(0,U.jsxs)(wc,{children:[(0,U.jsx)(dR.A,{className:"h-5 w-5 animate-spin text-muted","aria-hidden":!0}),(0,U.jsx)("p",{className:"text-body font-semibold text-primary",role:"status",children:n("orchPanel.resolving")}),(0,U.jsx)("p",{className:"text-ui leading-4 text-muted",children:n("orchPanel.resolvingHint")}),(0,U.jsx)("a",{href:"#c="+encodeURIComponent(e.conversationId),className:"inline-flex min-h-11 items-center text-ui font-semibold text-accent underline-offset-2 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:n("orchPanel.openOnBoard")})]})]})}function ws({transition:e}){let{t}=(0,eh.Ym)();return"creating"===e.kind?(0,U.jsxs)("p",{className:"flex shrink-0 items-center gap-1.5 rounded-surface border border-accent/45 bg-accent-soft px-3 py-2 text-ui text-accent",role:"status",children:[(0,U.jsx)(dR.A,{className:"h-3.5 w-3.5 shrink-0 animate-spin","aria-hidden":!0}),t("orchPanel.transitionPending")]}):(0,U.jsxs)("div",{className:"shrink-0 rounded-surface border border-danger/40 bg-danger-soft px-3 py-2",role:"alert","data-orchestrator-intent-error":!0,children:[(0,U.jsxs)("p",{className:"flex items-center gap-1.5 text-ui font-semibold text-danger",children:[(0,U.jsx)(i4.A,{className:"h-4 w-4 shrink-0","aria-hidden":!0}),t("orchPanel.transitionFailed")]}),(0,U.jsx)("p",{className:"mt-0.5 whitespace-pre-wrap break-words text-caption leading-4 text-secondary",children:e.error})]})}function wl({rotation:e}){let{t}=(0,eh.Ym)();return(0,U.jsxs)("div",{className:"shrink-0 rounded-surface border border-warning/45 bg-warning-soft px-3 py-2",role:"status","data-orchestrator-rotation":e.level,children:[(0,U.jsx)("p",{className:"text-ui font-semibold text-warning",children:t("strongly_recommend"===e.level?"orchPanel.rotationStrong":"orchPanel.rotation")}),(0,U.jsx)("p",{className:"mt-0.5 text-caption leading-4 text-secondary",children:e.reasons.map(n=>"context"===n?t("orchPanel.rotationContext",{percent:String(e.contextPercent??0)}):t("orchPanel.rotationDead")).join(" \xb7 ")})]})}function wo({tone:e,children:t}){return(0,U.jsx)("p",{className:`shrink-0 rounded-surface px-3 py-2 text-ui ${"warning"===e?"bg-warning-soft text-warning":"bg-sunken text-secondary"}`,role:"status",children:t})}function wc({children:e}){return(0,U.jsx)("div",{className:"flex min-h-0 flex-1 flex-col items-center justify-center gap-2 px-4 py-8 text-center",children:e})}function wd({project:e,projectName:t,files:n,onOpenConversation:r}){let{t:i}=(0,eh.Ym)(),a=(0,Y.useMemo)(()=>eT(n,e),[n,e]),{status:s,failed:l,refresh:o}=f2(e,a||void 0),[c,d]=(0,Y.useState)(!1),u=(0,Y.useRef)(!1),[p,m]=(0,Y.useState)(null),[f,h]=(0,Y.useState)(null),x=s?.seat?.conversationId??null,g=(0,Y.useMemo)(()=>x?n.find(e=>e.conversationId===x)??n.find(e=>e.path===s?.seat?.path)??null:null,[n,x,s?.seat?.path]),b=f8(g),v=d1({status:s,statusFailed:l,submitting:c,submitFailure:p,file:g,surface:b}),w=wt(v,{conversationReady:!!g});(0,Y.useEffect)(()=>{if(u.current)return;let t=v9(e,"requestId");t&&d4(s,t)&&we(e,"requestId","")},[e,s]);let y=(0,Y.useCallback)(async t=>{if(u.current)return;u.current=!0;let n=t.replayRequestId||v9(e,"requestId")||d3();v9(e,"requestId")!==n&&we(e,"requestId",n),d(!0),m(null);let r=Date.now(),s=t.mandate.trim();try{let l=await fetch("/api/orchestrator/seat",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({project:e,mandate:s,clientRequestId:n,engine:t.engine,...t.model?{model:t.model}:{},...t.effort?{effort:t.effort}:{},..."codex"===t.engine&&t.speed?{fast:"fast"===t.speed}:{},...t.accountId?{accountId:t.accountId}:{},...a?{cwd:a}:{},...s===dX.trim()?{promptVersion:9}:{}})}),o=await l.json().catch(()=>null);if(l.ok&&o?.ok===!0){we(e,"requestId","");let i=f4(l.status,l.ok,o);if("launched"===i.kind){let l=f3(f5(n,r,{engine:t.engine,model:t.model,cwd:a,effort:t.effort,fast:"codex"===t.engine&&t.speed?"fast"===t.speed:null,accountId:t.accountId,prompt:s,images:[],src:""}),i,e);l&&rk(l)}nF()}else if(l.ok)m({kind:"ambiguous",error:"string"==typeof o?.error&&o.error?o.error:i("orchPanel.transportLost"),clientRequestId:n});else{let t=d6(l.status,o,n);t?.kind==="terminal"&&we(e,"requestId",""),m(t)}}catch{m({kind:"ambiguous",error:i("orchPanel.transportLost"),clientRequestId:n})}finally{u.current=!1,d(!1),await o()}},[e,a,o,i]),k=(0,Y.useCallback)(()=>{g&&r(g)},[g,r]);(0,Y.useEffect)(()=>{f?.handoff&&"live"===v.kind&&g&&(h(null),r(g))},[f,v.kind,g,r]);let j=wn[w.state],N=i(wr[w.state]),S=g?.model?.trim()||(g?(0,tw.yz)(g).label:""),C="draft"===w.state?i("orchMobile.create"):S?"live"===w.state?S:`${S} \xb7 ${N}`:N,A=["draft"===w.state?i("orchMobile.rowCreateAria"):"conversation"===w.tap?i("orchMobile.rowLiveAria",{model:S||i("orchPanel.title"),state:N}):i("orchMobile.rowStatusAria",{state:N}),w.rotation?i("strongly_recommend"===w.rotation?"orchPanel.rotationStrong":"orchPanel.rotation"):""].filter(Boolean).join(" \xb7 ");return(0,U.jsxs)("div",{className:"flex shrink-0 items-center gap-1 border-r border-border px-1.5","data-orchestrator-row":e,"data-orchestrator-row-state":w.state,"data-orchestrator-row-tap":w.tap,...w.rotation?{"data-orchestrator-row-rotation":w.rotation}:{},...w.transition?{"data-orchestrator-row-transition":w.transition}:{},children:[(0,U.jsxs)("button",{type:"button","data-orchestrator-row-open":!0,onClick:()=>{"conversation"===w.tap?k():h({handoff:"live"!==v.kind})},"aria-label":A,title:A,..."sheet"===w.tap?{"aria-haspopup":"dialog"}:{},className:`inline-flex h-11 shrink-0 items-center gap-1.5 rounded-full border px-2.5 text-[11px] font-semibold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${j.chip}`,children:[(0,U.jsx)(dE.A,{className:"h-4 w-4 shrink-0","aria-hidden":!0}),(0,U.jsx)("span",{className:"max-w-[38vw] truncate",children:C}),"draft"===w.state?null:(0,U.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${j.dot} ${"creating"===w.state?"animate-pulse":""}`,"aria-hidden":!0}),w.rotation?(0,U.jsx)(m$.A,{className:"h-3.5 w-3.5 shrink-0 text-warning","aria-hidden":!0}):null]}),w.transition?(0,U.jsx)("button",{type:"button","data-orchestrator-row-transition-open":!0,onClick:()=>h({handoff:!1}),"aria-haspopup":"dialog","aria-label":i("error"===w.transition?"orchMobile.transitionAria":"orchMobile.pendingAria"),title:i("error"===w.transition?"orchMobile.transitionAria":"orchMobile.pendingAria"),className:"inline-flex h-11 w-11 shrink-0 items-center justify-center rounded-control border border-border bg-canvas focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:"error"===w.transition?(0,U.jsx)(i4.A,{className:"h-4 w-4 text-danger","aria-hidden":!0}):(0,U.jsx)(dR.A,{className:"h-4 w-4 animate-spin text-accent","aria-hidden":!0})}):null,f?(0,U.jsx)(wi,{project:e,projectName:t,projectCwd:a||void 0,state:v,file:g,pendingMandate:s?.pending?.mandate??"",viewerMcpRegistered:s?.viewerMcpRegistered===!0,submitting:c,onConfirm:e=>void y(e),onRecheck:()=>void o(),onOpenConversation:()=>{h(null),k()},onClose:()=>h(null)}):null]})}var wu=n(9585),wp=n(6763),wm=n(9314),wf=n(6619);function wh({engine:e,draft:t,state:n,error:r,showSpeed:i=!0,withDefaults:a=!1,disabled:s=!1,onEdit:l,onApply:o}){let{t:c}=(0,eh.Ym)(),d=(0,Y.useMemo)(()=>(0,of.ve)(e,t.model)??[],[e,t.model]),u=i&&"codex"===e;return(0,U.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-1",onPointerDown:e=>e.stopPropagation(),title:r||void 0,children:[(0,U.jsxs)(dF,{"aria-label":c("runtimeConfig.model"),value:t.model,disabled:s,className:"max-md:min-h-11",onChange:t=>{var n;let r;return n=t.target.value,r=(0,of.ve)(e,n)??[],void l(e=>({...e,model:n,effort:r.includes(e.effort)?e.effort:a?"":r[0]}))},children:[a?(0,U.jsx)("option",{value:"",children:c("draft.modelDefault")}):null,ow[e].map(e=>(0,U.jsx)("option",{value:e.id,children:e.label},e.id))]}),(0,U.jsxs)(dF,{"aria-label":c("runtimeConfig.effort"),value:t.effort,disabled:s,className:"max-md:min-h-11",onChange:e=>l(t=>({...t,effort:e.target.value})),children:[a?(0,U.jsx)("option",{value:"",children:c("draft.effortDefault")}):null,d.map(e=>(0,U.jsx)("option",{value:e,children:d_(c,e)},e))]}),u?(0,U.jsxs)("label",{className:"inline-flex h-7 items-center gap-1 rounded-control border border-border bg-card px-1.5 text-ui font-semibold text-secondary max-md:min-h-11 max-md:px-2.5",title:c("runtimeConfig.speedTitle"),children:[(0,U.jsx)("input",{type:"checkbox",checked:t.fast,onChange:e=>l(t=>({...t,fast:e.target.checked}))})," ",c("draft.speedFast")]}):null,(0,U.jsxs)("button",{type:"button",className:"inline-flex h-6 items-center gap-1 rounded-full border border-border bg-canvas px-1.5 text-[9.5px] font-semibold text-muted hover:border-accent/45 hover:text-accent disabled:opacity-60 max-md:min-h-11 max-md:px-2.5 max-md:text-label",disabled:s||"saving"===n,onClick:o,"aria-label":c("runtimeConfig.apply"),children:["saving"===n||"pending"===n||"confirming"===n?(0,U.jsx)(dR.A,{className:"h-3 w-3 animate-spin","aria-hidden":!0}):(0,U.jsx)(fv.A,{className:"h-3 w-3","aria-hidden":!0}),c("runtimeConfig.apply")]})]})}function wx(e,t,n){return e.split(t).join(n)}function wg(e,t,n,r){let i=wx(t.prompt,"{{task}}",e.task);i=wx(i,"{{prev.output}}",r);let a=n.promptScaffold?wx(n.promptScaffold,"{{task}}",e.task):null;a&&(a=wx(a,"{{prev.output}}",r));let s="read-only"===n.access?"Access: read-only. Inspect and validate freely. Avoid edits, staging, commits, pushes, and other repository mutations.":"Access: read-write. Work only inside this pipeline's dedicated worktree and commit-ready scope.",l=n.roleId?[`Role preset: ${n.roleId} (${n.engine}${n.model?`/${n.model}`:""}${n.effort?`, ${n.effort}`:""}).`,...a?["","Role prompt scaffold:",a]:[]]:[];return[i.trim(),"","Pinned task:",e.task,"","Pinned specification and acceptance criteria:",e.spec?.trim()||"No separate pinned specification was supplied.","",...l,s,"Pipeline nesting is forbidden. Never create or start another pipeline from this stage.","","Finish the completed turn with one fenced JSON object as the final block. This block is the only completion authority:","```json",'{"status":"pass","findings":[],"confidence":0.9}',"```","Use pass when the stage contract is complete, fail for a retryable stage failure, and needs_decision when operator judgment is required.","Pass requires findings to be empty or omitted. Use fail or needs_decision when findings describe unresolved work.","Every prose terminal marker must agree with the JSON status: APPROVE=pass, REQUEST_CHANGES=fail, COMMENT=needs_decision. NO FINDINGS agrees with pass.","Human-readable output may appear before the JSON block. Never place text after the block."].join("\n")}function wb({pipeline:e,stage:t,disabled:n=!1}){let{t:r}=(0,eh.Ym)(),[i,a]=(0,Y.useState)(!1),[s,l]=(0,Y.useState)(null),o="completed"===e.state||"closed"===e.state,c=xg(e,t.id).length>0,d=e.cursor?.activatedBy?.edge==="fail"&&e.cursor.activatedBy.stageId===t.id||xZ(e,t)>0,u=e.stages.filter(e=>e.id!==t.id),p=e.stages,m=async(n,r,s)=>{i||(a(!0),l(null),l(await x5(e,t.id,n,r,s)),a(!1))},f="text-caption font-semibold text-muted",h="w-full";return(0,U.jsxs)("div",{"data-stage-edges":!0,className:"flex shrink-0 flex-col gap-1.5 border-b border-border bg-card px-2.5 py-1.5","aria-label":r("pipelineSlot.connectHeading"),children:[(0,U.jsx)("span",{className:"text-caption font-bold uppercase tracking-wide text-muted",children:r("pipelineSlot.connectHeading")}),(0,U.jsxs)("div",{className:"flex flex-wrap items-end gap-2",children:[(0,U.jsxs)("label",{className:"flex min-w-[140px] flex-1 flex-col gap-1",children:[(0,U.jsx)("span",{className:f,children:r("pipelineSlot.passEdgeLabel")}),(0,U.jsxs)(dF,{className:h,value:t.next??"",disabled:n||i||o||c,onChange:e=>void m("pass",e.target.value||null),children:[(0,U.jsx)("option",{value:"",children:r("pipelineSlot.passEdgeEnd")}),u.map(e=>(0,U.jsx)("option",{value:e.id,children:xO(r,e)},e.id))]})]}),(0,U.jsxs)("label",{className:"flex min-w-[140px] flex-1 flex-col gap-1",children:[(0,U.jsx)("span",{className:f,children:r("pipelineSlot.failEdgeLabel")}),(0,U.jsxs)(dF,{className:h,value:t.onFail?.to??"",disabled:n||i||o||d,onChange:e=>void m("fail",e.target.value||null,e.target.value?t.onFail?.maxRounds:void 0),children:[(0,U.jsx)("option",{value:"",children:r("pipelineSlot.failEdgeNone")}),p.map(e=>(0,U.jsx)("option",{value:e.id,children:e.id===t.id?r("pipelineSlot.failEdgeSelf"):xO(r,e)},e.id))]})]}),t.onFail?(0,U.jsxs)("label",{className:"flex w-[92px] flex-col gap-1",children:[(0,U.jsx)("span",{className:f,children:r("pipelineSlot.failEdgeRounds")}),(0,U.jsx)("input",{type:"number",min:1,max:9,value:t.onFail.maxRounds,disabled:n||i||o||d,onChange:e=>{let n=Number.parseInt(e.target.value,10);Number.isInteger(n)&&n>=1&&n<=9&&m("fail",t.onFail.to,n)},className:"h-7 w-full rounded-control border border-border bg-canvas px-2 text-ui font-semibold text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60"})]}):null]}),c&&!o?(0,U.jsx)("span",{className:"text-caption font-medium text-muted",children:r("pipelineSlot.passEdgeFrozen")}):null,d&&!o?(0,U.jsx)("span",{className:"text-caption font-medium text-muted",children:r("pipelineSlot.failEdgeFrozen")}):null,s?(0,U.jsx)("span",{role:"alert",className:"text-caption font-semibold text-danger",children:s}):null]})}let wv=new Set(xd);function ww(e){let t={};for(let[n,r]of Object.entries(e))if("string"==typeof r){let e=r.trim();e&&(t[n]=e)}else null!=r&&(t[n]=r);return t}function wy({slot:e,interactive:t}){let{t:n}=(0,eh.Ym)(),{pipeline:r,stage:i}=e,a=bb(),s=xC(r,i),l=xh[s],o=xO(n,i),c=xD(n,i,e.index,e.total),d="review-loop"===i.kind,u="draft"===r.state,p=t&&0===xg(r,i.id).length&&"completed"!==r.state&&"closed"!==r.state,m=i.effectiveRole.model??"",f=i.effectiveRole.effort??"",[h,x]=(0,Y.useState)(i.effectiveRole.engine),[g,b]=(0,Y.useState)({model:m,effort:f,fast:!1}),[v,w]=(0,Y.useState)("idle"),[y,k]=(0,Y.useState)(i.role?.roleId??""),[j,N]=(0,Y.useState)(i.role?.params??{}),[S,C]=(0,Y.useState)(()=>xY(i.prompt)),[A,I]=(0,Y.useState)(!1),[M,T]=(0,Y.useState)(null),[P,$]=(0,Y.useState)(!1),[E,R]=(0,Y.useState)(!1),O=`${i.effectiveRole.engine}:${i.effectiveRole.model??""}:${i.effectiveRole.effort??""}`,[D,L]=(0,Y.useState)(O);D!==O&&(L(O),x(i.effectiveRole.engine),b({model:m,effort:f,fast:!1}));let _=`${i.role?.roleId??""}:${JSON.stringify(i.role?.params??{})}`,[F,q]=(0,Y.useState)(_);F!==_&&(q(_),k(i.role?.roleId??""),N(i.role?.params??{}));let[z,H]=(0,Y.useState)(i.prompt);if(z!==i.prompt){let e=xY(z);H(i.prompt),C(t=>t===e?xY(i.prompt):t)}let B=async e=>{I(!0),T(null),$(!1);let t=await x4(r.id,"override-stage",{stageId:i.id,...e});t?T(t):$(!0),I(!1)},K=async()=>{if("saving"===v)return;let e={};if(g.model.trim()!==m&&(e.model=g.model.trim()||null),g.effort!==f&&(e.effort=g.effort||null),!Object.keys(e).length)return void w("applied");w("saving"),T(null);let t=await x4(r.id,"override-stage",{stageId:i.id,...e});t?(T(t),w("error")):w("applied")},W=S.trim()!==xY(i.prompt),V=()=>{var t,n,r;let a,s,l;W&&B({prompt:(t=i.prompt,n=S,r=e.index,s=(a=[...new Set(t.match(xK)??[])]).length?a.join("\n"):r>0?"{{prev.output}}":"{{task}}",(l=n.trim())?`${s}
|
|
77
|
-
|
|
78
|
-
${l}`:s)})},J=u&&t&&xW(r.stages.filter(e=>e.id!==i.id).map(e=>e.kind)),G=u&&t&&r.stages.length>1,Q=r.stages.map(e=>e.kind),X=t=>G&&t>=0&&t<r.stages.length&&t!==e.index&&xW((t=>{let n=[...Q],[r]=n.splice(e.index,1);return n.splice(t,0,r),n})(t)),Z=e=>{!A&&X(e)&&(I(!0),T(null),x4(r.id,"reorder-stage",{stageId:i.id,toIndex:e},function(e,t,n){let r=e.stages.findIndex(e=>e.id===t);if(r<0)return e;let i=[...e.stages],[a]=i.splice(r,1),s=Math.max(0,Math.min(n,i.length));i.splice(s,0,a);let l=i[0],o=l&&"review-loop"===l.kind?i.map((e,t)=>0===t?{...e,kind:"run"}:e):i;return{...e,stages:x2(o)}}(r,i.id,e)).then(e=>{e&&T(e),I(!1)}))},ee=(0,tw.t7)(h),et="pending"!==s&&"skipped"!==s,en=("running"===s||"reviewing"===s||"committing"===s)&&"paused"!==r.state,er=d?n("pipelineSlot.reviewHint"):n("running"===s||"reviewing"===s||"committing"===s?"pipelineSlot.starting":"pipelineSlot.waiting",{role:o}),ei=(ow[h].find(e=>e.id===m)?.label??m)||n("draft.modelDefault"),ea=f?d_(n,f):n("groupOverride.effortDefault"),es=g.model!==m||g.effort!==f,el=wg(r,i,i.effectiveRole,"[The previous stage output will be inserted here]");return(0,U.jsxs)("section",{"data-pan-ignore":!0,"data-pipeline-stage-card":`${r.id}::${i.id}`,"data-pipeline-stage-state":s,"aria-label":n("pipelineSlot.paneAria",{title:c}),className:"relative flex h-full min-h-0 min-w-0 flex-1 flex-col overflow-hidden rounded-control border-2 border-dashed bg-card shadow-1",style:{borderColor:et?l.color:"var(--border-strong)"},children:[(0,U.jsx)("span",{"aria-hidden":!0,className:"h-1 w-full shrink-0 opacity-60",style:{backgroundColor:ee.color}}),(0,U.jsxs)("header",{className:"flex h-10 shrink-0 items-center gap-1.5 border-b border-border px-2.5",style:{backgroundColor:ee.soft},children:[(0,U.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${en?"animate-pulse":""}`,style:{backgroundColor:l.color},title:n(`pipelineChipState.${s}`)}),E?(0,U.jsx)(dK,{engine:h,disabled:!p||A,onChange:e=>{if(e===h)return;let t=!!(g.effort&&(0,of.z9)(e,g.effort));x(e),b(e=>({...e,model:"",effort:t?e.effort:""})),B({engine:e,model:null,...t?{}:{effort:null}})}}):(0,U.jsx)("span",{className:"shrink-0 rounded-full border border-border bg-card/70 px-1.5 py-0.5 text-caption font-bold capitalize text-muted",children:h}),(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate text-ui font-semibold text-muted",title:c,children:c}),(0,U.jsx)("span",{className:"shrink-0 rounded-full border border-border bg-card/70 px-1.5 py-0.5 text-caption font-bold uppercase tracking-wide text-muted",children:d?`⟳ ${n("groupOverride.reviewKind")}`:n("groupOverride.runKind")}),G?(0,U.jsxs)("span",{className:"flex shrink-0 items-center gap-0.5",role:"group","aria-label":n("groupOverride.stagesHeading"),children:[(0,U.jsx)("button",{type:"button","data-stage-move":"earlier",className:"inline-flex h-7 w-7 items-center justify-center rounded-control border border-border bg-card/80 text-muted hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-30","aria-label":n("pipelineSlot.moveEarlier",{role:o}),disabled:A||!X(e.index-1),onClick:()=>Z(e.index-1),children:(0,U.jsx)(vV.A,{className:"h-3.5 w-3.5","aria-hidden":!0})}),(0,U.jsx)("button",{type:"button","data-stage-move":"later",className:"inline-flex h-7 w-7 items-center justify-center rounded-control border border-border bg-card/80 text-muted hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-30","aria-label":n("pipelineSlot.moveLater",{role:o}),disabled:A||!X(e.index+1),onClick:()=>Z(e.index+1),children:(0,U.jsx)(i3.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}):null,t?(0,U.jsx)("button",{type:"button",className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-control border border-border bg-card/80 text-muted hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":n("groupOverride.applyStage"),"aria-expanded":E,onClick:()=>R(e=>!e),children:(0,U.jsx)(lw.A,{className:"h-3.5 w-3.5","aria-hidden":!0})}):null,J?(0,U.jsx)("button",{className:"inline-flex shrink-0 items-center rounded-control border border-border bg-canvas px-1.5 py-0.5 text-muted hover:border-danger/40 hover:text-danger focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40","aria-label":n("groupOverride.removeStage"),disabled:A,onClick:()=>{var e;let t,n,a;I(!0),x4(r.id,"remove-stage",{stageId:i.id},(e=i.id,t=r.stages.find(t=>t.id===e),n=t?.next&&t.next!==t.id?t.next:null,a=r.stages.filter(t=>t.id!==e).map(t=>({...t,next:t.next===e?n:t.next,onFail:t.onFail?.to===e?null:t.onFail})),{...r,stages:x2(a)})).then(e=>{e&&T(e),I(!1)})},children:(0,U.jsx)(sx.X,{className:"h-3 w-3","aria-hidden":!0})}):null]}),t&&E?(0,U.jsx)(bv,{idPrefix:e.key,roles:a,roleId:y,roleParams:j,disabled:!p||A,allowedRoleIds:wv,compactPreview:!0,onSelectRole:e=>{k(e);let t=a.find(t=>t.id===e),n=t?bc(t):{};N(n),B({role:e?{roleId:e,...Object.keys(ww(n)).length?{params:ww(n)}:{}}:null})},onSetParam:(e,t)=>{let n={...j,[e]:t};if(N(n),!y)return;let r=ww(n);B({role:{roleId:y,...Object.keys(r).length?{params:r}:{}}})}}):null,(0,U.jsxs)("div",{className:"flex shrink-0 flex-wrap items-center gap-1.5 border-b border-border bg-sunken px-2.5 py-1.5",children:[(0,U.jsx)("span",{className:"shrink-0 text-caption font-semibold text-muted",children:n("draft.reasoning")}),t&&E?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(wh,{engine:h,draft:g,state:v,error:M??"",observedModelLabel:ei,observedEffort:ea,draftPending:es,showSpeed:!1,withDefaults:!0,disabled:!p||A,onEdit:e=>{b(e),w("idle")},onApply:()=>void K()}),A?(0,U.jsx)(dR.A,{className:"h-3.5 w-3.5 shrink-0 animate-spin text-muted","aria-hidden":!0}):P?(0,U.jsx)(fv.A,{className:"h-3.5 w-3.5 shrink-0 text-success",role:"img","aria-label":n("pipelineSlot.saved")}):null]}):(0,U.jsxs)("span",{className:"min-w-0 truncate text-label font-semibold text-muted",children:[ei,f?` \xb7 ${d_(n,f)}`:""]})]}),E&&M?(0,U.jsx)("div",{className:"shrink-0 px-2.5 py-1 text-label font-semibold text-danger",role:"alert",children:M}):null,t&&E&&!p?(0,U.jsx)("div",{className:"shrink-0 px-2.5 py-1 text-label font-semibold text-muted",children:n("pipelineSlot.frozen")}):null,t&&E&&r.stages.length>1?(0,U.jsx)(wb,{pipeline:r,stage:i,disabled:A}):null,(0,U.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden px-4 py-3",children:[(0,U.jsxs)("div",{className:"mb-3 flex items-center justify-between gap-2",children:[(0,U.jsx)("span",{className:"rounded-full px-3 py-1 text-body font-bold",style:{backgroundColor:l.soft,color:l.color},children:n(`pipelineChipState.${s}`)}),(0,U.jsxs)("span",{className:"truncate text-label font-semibold text-muted",children:[ei,f?` \xb7 ${d_(n,f)}`:""]})]}),(0,U.jsxs)("div",{className:"ml-auto max-w-[88%] min-h-0 overflow-hidden rounded-[14px] rounded-br-[4px] bg-accent/10 px-3 py-2.5 text-ui leading-5 text-primary shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--color-accent)_18%,transparent)]",children:[(0,U.jsx)("p",{className:"mb-1 text-caption font-bold uppercase tracking-wide text-accent",children:n("pipelineSlot.promptLabel")}),(0,U.jsx)("p",{className:"line-clamp-[12] whitespace-pre-wrap break-words",children:el})]}),(0,U.jsx)("div",{className:"mt-auto pt-3 text-center text-ui leading-5 text-muted",children:er})]}),t&&E?(0,U.jsxs)("form",{onSubmit:e=>{e.preventDefault(),V()},className:"flex shrink-0 flex-col gap-1 border-t border-border bg-card px-2.5 py-2","aria-label":n("pipelineSlot.promptAria"),children:[d?null:(0,U.jsx)("span",{className:"text-caption font-semibold text-secondary",children:n(e.index>0&&i.prompt.includes("{{prev.output}}")?"pipelineSlot.wiringPrev":"pipelineSlot.wiringTask")}),(0,U.jsx)("label",{className:"text-caption font-semibold text-muted",htmlFor:`slot-prompt-${e.key}`,children:n("pipelineSlot.promptLabel")}),(0,U.jsx)("textarea",{id:`slot-prompt-${e.key}`,value:S,disabled:!p||A,onChange:e=>C(e.target.value),onBlur:V,placeholder:n("pipelineSlot.noPrompt"),className:"min-h-[52px] w-full resize-y rounded-control border border-border bg-canvas px-2 py-1.5 text-ui text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60"}),W?(0,U.jsx)("div",{className:"flex items-center justify-end",children:(0,U.jsx)("button",{type:"submit",disabled:!p||A,className:"inline-flex h-7 items-center gap-1 rounded-control border border-accent bg-accent px-2.5 text-label font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40",children:n("pipelineSlot.savePrompt")})}):null]}):null]})}let wk=new Set;function wj({anchorRef:e,children:t}){let n=(0,Y.useRef)(null),[r,i]=(0,Y.useState)(null);return((0,Y.useLayoutEffect)(()=>{let t=()=>{let t=e.current,r=n.current;if(!t)return;let a=t.getBoundingClientRect();i(function(e,t,n,r=8){let i=e.top-r,a=n.height-e.bottom-r,s=t.height>i&&a>=i,l=t.width/2,o=Math.min(Math.max(e.left+e.width/2,l+r),n.width-l-r);return s?{left:o,top:Math.max(r,Math.min(e.bottom+r,n.height-r-t.height)),below:s}:{left:o,top:Math.min(n.height-r,Math.max(e.top-r,r+t.height)),below:s}}({top:a.top,bottom:a.bottom,left:a.left,width:a.width},{width:r?.offsetWidth??260,height:r?.offsetHeight??0},{width:window.innerWidth,height:window.innerHeight}))};return t(),window.addEventListener("scroll",t,!0),window.addEventListener("resize",t),()=>{window.removeEventListener("scroll",t,!0),window.removeEventListener("resize",t)}},[e]),"u"<typeof document)?null:(0,nx.createPortal)((0,U.jsx)("div",{ref:n,className:"fixed z-[80]",style:r?{left:r.left,top:r.top,transform:r.below?"translate(-50%, 0)":"translate(-50%, -100%)"}:{left:-9999,top:0,visibility:"hidden"},children:t}),document.body)}function wN({anchorRef:e,children:t}){let[n,r]=(0,Y.useState)({left:-9999,top:0,above:!1});return((0,Y.useLayoutEffect)(()=>{let t=()=>{let t=e.current;if(!t)return;let n=t.getBoundingClientRect(),i=window.innerHeight-n.bottom<108;r({left:Math.max(8,Math.min(window.innerWidth-188,n.right-180)),top:i?n.top-6:n.bottom+6,above:i})};return t(),window.addEventListener("scroll",t,!0),window.addEventListener("resize",t),()=>{window.removeEventListener("scroll",t,!0),window.removeEventListener("resize",t)}},[e]),"u"<typeof document)?null:(0,nx.createPortal)((0,U.jsx)("span",{className:"fixed z-[70]",style:{left:n.left,top:n.top,transform:n.above?"translateY(-100%)":void 0},children:t}),document.body)}function wS({label:e,mobile:t,slot:n,onClose:r}){let{t:i}=(0,eh.Ym)(),a=(0,Y.useRef)(null);return as({containerRef:a,onClose:r,lockScroll:!1,manageFocus:!1}),(0,U.jsxs)("div",{ref:a,role:"dialog","aria-modal":"true","aria-label":i("pipelineStrip.configAria",{label:e}),tabIndex:-1,className:`relative h-[min(620px,calc(100vh-24px))] w-[min(600px,calc(100vw-24px))] rounded-surface bg-card shadow-3 focus-visible:outline-none ${t?"[&_button]:min-h-11 [&_button]:min-w-11":""}`,children:[(0,U.jsx)("button",{type:"button",autoFocus:!0,onClick:r,"aria-label":i("pipelineStrip.closeConfig"),className:"absolute right-2 top-2 z-20 inline-flex h-7 w-7 items-center justify-center rounded-control border border-border bg-card text-muted shadow-1 hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:(0,U.jsx)(K.A,{className:"h-3.5 w-3.5","aria-hidden":!0})}),(0,U.jsx)(wy,{slot:n,interactive:!0})]})}function wC({pipeline:e,stage:t,previousStage:n,index:r,flows:i,files:a,renderableFlows:s,renderablePaths:l,materializedPaths:o,materializedFlows:c,mobile:d,open:u,configurationOpen:p,onToggleVerdict:m,onCloseVerdict:f,onToggleConfiguration:h,onCloseConfiguration:x,onOpenPath:g,onOpenFlow:b}){var v;let w,{t:y}=(0,eh.Ym)(),k=xC(e,t),j=xh[k],N=xx[k],S=xc(e,t.id),C=xQ(e,t,o,c)?"materialized":xg(e,t.id).some(e=>xX.has(e.state))?"evidence":e.cursor?.stageId===t.id&&xf(e)?"queued":"waiting",A=xO(y,t),I=(w=xc(e,(v=t).id),w?.effectiveRole.access??v.access??("review-loop"===v.kind?"read-only":"read-write")),M=("running"===k||"reviewing"===k||"committing"===k)&&"paused"!==e.state,T=S?.flowId?i.find(e=>e.id===S.flowId)??null:null,P="review-loop"===t.kind&&T?x9(T)?.n??0:0,$=xg(e,t.id).length,E=y(`pipelineChipState.${k}`),R=[t.role?.roleId??t.id,y("read-only"===I?"pipelineStrip.readOnly":"pipelineStrip.readWrite"),S?.sessionId].filter(Boolean).join(" \xb7 "),O=t=>{let n=xc(e,t.id);return xT(t,n,i,s,l,a)},D=O(t),L=t=>0===xg(e,t.id).length&&"completed"!==e.state&&"closed"!==e.state,_=L(t),F=e=>!!e&&("flow"===e.kind?!!b:!!g),q=e=>{e&&("flow"===e.kind?b?.(e.flowId):g?.(e.path))},z=_||F(D),H=()=>{_?h(t.id):q(D)},B=(0,Y.useRef)(null),K=(0,Y.useRef)(null),W=(0,Y.useRef)(!1);(0,Y.useEffect)(()=>{W.current&&!p&&K.current?.focus(),W.current=p},[p]);let V=x$(e,t,S)||xE(e,t,S,i,l,a),J=!!(S&&["passed","failed","needs_decision","skipped"].includes(S.state)),G=S?function(e){if(!e.startedAt||!e.completedAt)return null;let t=Date.parse(e.completedAt)-Date.parse(e.startedAt);if(!Number.isFinite(t)||t<0)return null;let n=Math.round(t/1e3),r=Math.floor(n/3600),i=Math.floor(n%3600/60),a=n%60;return r?`${r}:${String(i).padStart(2,"0")}:${String(a).padStart(2,"0")}`:`${i}:${String(a).padStart(2,"0")}`}(S):null,Q=S?.effectiveRole.model??y("pipelineStrip.defaultModel"),X=S?.verdict?xU(y,S.verdict.status):E,Z=!!(S?.flowId&&s.has(S.flowId)),ee=!!(S?.agentPath&&(!l||l.has(S.agentPath))),et=d&&"queued"!==C&&"waiting"!==C&&function(e,t,n,r=[],i,a,s=[]){return!x$(e,t,n)&&!xE(e,t,n,r,a,s)&&null===xT(t,n,r,i,a,s)}(e,t,S,i,s,l,a),en=n?O(n):null,er=!!n&&L(n),ei=n?xO(y,n):"",ea=n?y(`pipelineChipState.${xC(e,n)}`):"",es={key:`pipeline-config::${e.id}::${t.id}`,pipeline:e,stage:t,index:r,total:e.stages.length,presentation:"placeholder",x:0,y:0,w:600,h:620},el=!!(n&&n.next===t.id),eo=xf(e),ec=!!(n&&eo&&e.cursor?.stageId===n.id),ed=e.stages[r+1]?.id??null,eu=t.next?e.stages.find(e=>e.id===t.next)??null:null,ep=eu&&t.next!==ed?eu:null,em=!!(ep&&eo&&e.cursor?.stageId===t.id),ef=t.onFail?e.stages.find(e=>e.id===t.onFail.to)??null:null,ex=xZ(e,t);return(0,U.jsxs)("li",{ref:B,className:"relative flex shrink-0 items-center gap-1.5","data-pipeline-stage":t.id,"data-stage-state":k,"data-stage-presentation":C,children:[n&&!d&&el?(0,U.jsxs)("span",{role:"group","aria-label":y("pipelineStrip.lineageAria",{from:ei,to:A}),"data-edge-kind":"pass","data-edge-next":ec?"true":void 0,className:`inline-flex h-7 shrink-0 items-center rounded-full border px-0.5 ${ec?"border-accent/60 bg-accent-soft text-accent":"border-border bg-sunken text-muted"}`,children:[(0,U.jsx)("button",{type:"button",disabled:!er&&!F(en),onClick:()=>{n&&er?h(n.id):q(en)},"aria-label":y("pipelineStrip.previousStage",{label:ei,state:ea}),className:"inline-flex h-6 w-6 items-center justify-center rounded-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-35",children:(0,U.jsx)(wu.A,{className:"h-3 w-3","aria-hidden":!0})}),ec?(0,U.jsx)("span",{className:`text-caption font-bold ${"paused"!==e.state?"animate-pulse":""}`,title:y("pipelineStrip.nextEdgeAria"),children:y("pipelineStrip.nextEdge")}):(0,U.jsx)("span",{className:"h-px w-3 bg-strong","aria-hidden":!0}),(0,U.jsx)("button",{type:"button",disabled:!z,onClick:H,"aria-label":y("pipelineStrip.nextStage",{label:A,state:E}),className:"inline-flex h-6 w-6 items-center justify-center rounded-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-35",children:(0,U.jsx)(g$.A,{className:"h-3 w-3","aria-hidden":!0})})]}):null,et?(0,U.jsx)("button",{ref:K,type:"button","data-stage-compact":"true",disabled:!z,onClick:H,"aria-expanded":_?p:void 0,"aria-label":y("pipelineStrip.compactChipAria",{label:A,state:E}),className:`inline-flex h-11 w-11 items-center justify-center rounded-full text-label font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:cursor-default ${M?"animate-pulse":""}`,style:{backgroundColor:j.soft,color:j.color},title:R,children:(0,U.jsx)("span",{"aria-hidden":!0,children:_?(0,U.jsx)(wp.A,{className:"h-3.5 w-3.5"}):N||("review-loop"===t.kind?"⟳":"▸")})}):(0,U.jsxs)("span",{className:`inline-flex items-stretch rounded-control border ${J?"border-border bg-sunken":"border-transparent"}`,children:[(0,U.jsxs)("button",{ref:K,type:"button",disabled:!z,onClick:H,"aria-expanded":_?p:void 0,className:`inline-flex min-h-7 max-w-[180px] items-center gap-1 truncate rounded-l-control ${V?"":"rounded-r-control"} px-2 text-label font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:cursor-default ${M?"animate-pulse":""}`,style:{backgroundColor:j.soft,color:j.color},title:R,"aria-label":y(_?"pipelineStrip.configureStage":D?"pipelineStrip.openTranscript":"pipelineStrip.chipAria",{label:A,state:E}),children:[(0,U.jsx)("span",{"aria-hidden":!0,children:_?(0,U.jsx)(wp.A,{className:"h-3 w-3"}):"review-loop"===t.kind?"⟳":"▸"}),(0,U.jsx)("span",{className:"min-w-0 truncate",children:A}),N?(0,U.jsx)("span",{"aria-hidden":!0,children:N}):null,(0,U.jsx)("span",{className:"text-caption font-semibold opacity-80",children:"queued"===C||"waiting"===C?y(`pipelinePresentation.${C}`):E}),P>0?(0,U.jsx)("span",{"aria-hidden":!0,children:y("pipelineStrip.roundShort",{n:P})}):null,$>1?(0,U.jsx)("span",{"aria-hidden":!0,children:y("pipelineStrip.attemptSuffix",{n:$})}):null]}),V?(0,U.jsx)("button",{type:"button",onClick:m,"aria-expanded":u,"aria-label":y("pipelineStrip.openVerdict",{label:A,state:E}),className:`inline-flex h-6 items-center rounded-r-full border-l border-card/60 px-1 text-label font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${d?"min-h-11 min-w-11 justify-center":""}`,style:{backgroundColor:j.soft,color:j.color},children:(0,U.jsx)("span",{"aria-hidden":!0,children:S.verdict?"pass"===S.verdict.status?"✓":"fail"===S.verdict.status?"✕":"●":"!"})}):null,!d&&J&&S?(0,U.jsxs)("span",{"data-stage-evidence":S.state,"aria-label":y("pipelineStrip.evidenceAria",{label:A,verdict:X,duration:G??y("pipelineStrip.unknownDuration"),model:Q}),className:"inline-flex min-h-7 max-w-[240px] items-center gap-1.5 border-l border-border px-2 text-caption font-semibold text-secondary",children:[(0,U.jsx)("span",{className:"text-strong",children:X}),(0,U.jsx)("span",{"aria-hidden":!0,children:"\xb7"}),(0,U.jsx)("span",{className:"tabular-nums",children:G??y("pipelineStrip.unknownDuration")}),(0,U.jsx)("span",{"aria-hidden":!0,children:"\xb7"}),(0,U.jsx)("span",{className:"max-w-[100px] truncate",title:Q,children:Q})]}):null]}),ep?(0,U.jsx)("span",{"data-edge-kind":"pass-jump","data-edge-next":em?"true":void 0,role:"img","aria-label":y("pipelineStrip.passEdgeAria",{from:A,to:xO(y,ep)}),title:em?y("pipelineStrip.nextEdgeAria"):void 0,className:`inline-flex h-6 shrink-0 items-center gap-0.5 rounded-full border px-1.5 text-caption font-bold ${em?`border-accent/60 bg-accent-soft text-accent ${"paused"!==e.state?"animate-pulse":""}`:"border-border bg-sunken text-muted"}`,children:(0,U.jsxs)("span",{"aria-hidden":!0,children:["→ ",xO(y,ep)]})}):null,ef&&t.onFail?(0,U.jsx)("span",{"data-edge-kind":"fail",role:"img","aria-label":y("pipelineStrip.failEdgeAria",{from:A,to:xO(y,ef),k:ex,n:t.onFail.maxRounds}),className:"inline-flex h-6 shrink-0 items-center gap-0.5 rounded-full border border-dashed border-warning/70 bg-warning-soft px-1.5 text-caption font-bold text-warning",children:(0,U.jsxs)("span",{"aria-hidden":!0,children:["↩ ",xO(y,ef)," ",ex,"/",t.onFail.maxRounds]})}):null,u&&S?(0,U.jsx)(wj,{anchorRef:B,children:(0,U.jsx)(v8,{pipeline:e,stage:t,attempt:S,flows:i,files:a,availablePaths:l,mobile:d,canOpenFlow:Z,canOpenPath:ee,onClose:f,onOpenPath:g,onOpenFlow:b})}):null,p?(0,U.jsx)(wj,{anchorRef:B,children:(0,U.jsx)(wS,{label:A,mobile:d,slot:es,onClose:x})}):null]})}function wA({pipeline:e,flows:t=[],files:n=[],renderablePaths:r,renderableFlows:i=wk,materializedPaths:a=r??wk,materializedFlows:s=i,compact:l=!1,mobile:o=!1,linkedTasks:c=[],onOpenPath:d,onOpenFlow:u,onOpenTask:p}){var m;let{t:f}=(0,eh.Ym)(),[h,x]=(0,Y.useState)(!1),[g,b]=(0,Y.useState)(null),[v,w]=(0,Y.useState)(null),[y,k]=(0,Y.useState)(null),[j,N]=(0,Y.useState)(!1),[S,C]=(0,Y.useState)("idle"),A=(0,Y.useRef)(null),I=(0,Y.useRef)(null),M=(0,Y.useRef)(!1);(0,Y.useEffect)(()=>{if(!y)return;let e=e=>{"Escape"===e.key&&(e.stopPropagation(),k(null))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[y]),(0,Y.useLayoutEffect)(()=>{j?I.current?.focus():M.current&&A.current?.focus(),M.current=j},[j]),(0,Y.useEffect)(()=>{if(!j)return;let e=e=>{"Escape"===e.key&&(e.stopPropagation(),N(!1),A.current?.focus())};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[j]);let T=async t=>{h||(x(!0),b(null),b(await x4(e.id,t)),x(!1),N(!1))},P=async()=>{try{await navigator.clipboard.writeText(e.baseRef),C("copied")}catch{C("failed")}},$=xm.has(e.state),E=xp.has(e.state),R="draft"===e.state,O="completed"===e.state||"closed"===e.state,D=(m=e,xm.has(m.state)&&m.cursor?xc(m,m.cursor.stageId)?.verdict?.findings?.[0]??m.stateDetail:m.stateDetail),{k:L,n:_}=xz(e),F=E?"bg-accent-soft text-accent":$||R?"bg-warning-soft text-warning":"completed"===e.state?"bg-success-soft text-success":"bg-sunken text-muted",q="inline-flex h-7 shrink-0 items-center justify-center gap-1 rounded-control border px-2.5 text-ui font-semibold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",z=l&&!o?"w-7 px-0":"",H=`${q} border-border bg-card text-secondary hover:text-primary`;return(0,U.jsxs)("div",{"data-scheme-ui":!0,role:"group","aria-label":f("pipelineStrip.groupAria",{task:e.task}),className:`pointer-events-auto relative flex min-h-9 w-full max-w-full items-center gap-x-2.5 gap-y-1 overflow-visible rounded-surface border bg-card/95 py-1 shadow-1 ${l?"flex-nowrap px-2.5":o?"flex-wrap px-2":"flex-nowrap px-3"} ${o?"[&_button]:min-h-11 [&_button]:min-w-11":""} ${R?"border-2 border-dashed border-warning":$?"border-warning/70":"border-border"}`,children:[(0,U.jsxs)("span",{"data-pipeline-header":!0,className:`flex min-w-0 items-center gap-2 ${o?"order-1 flex-1":"max-w-[34%] shrink-0"}`,children:[(0,U.jsx)("span",{className:`h-2.5 w-2.5 shrink-0 rounded-full ${E?"animate-pulse bg-accent":$?"bg-warning":"completed"===e.state?"bg-success":R?"bg-warning":"bg-strong"}`,"aria-hidden":!0}),l?null:(0,U.jsx)("span",{className:"min-w-0 truncate text-ui font-semibold text-primary",title:e.task,children:e.task}),(0,U.jsx)("span",{className:`shrink-0 rounded-full px-1.5 py-0.5 text-caption font-semibold ${F}`,children:xu(f,e.state)}),!R&&_?(0,U.jsx)("span",{className:"shrink-0 text-label font-semibold tabular-nums text-muted",children:f("pipelineStrip.stageOf",{k:L,n:_})}):null,D?(0,U.jsx)("span",{className:`min-w-0 truncate text-ui font-semibold ${$?"text-warning":"text-danger"}`,title:D,children:D}):null]}),e.baseRef?(0,U.jsxs)("button",{type:"button","data-pipeline-base-ref":!0,title:f("pipelineStrip.baseShaFull",{sha:e.baseRef}),"aria-label":f("pipelineStrip.copyBaseSha",{sha:e.baseRef}),onClick:()=>void P(),className:`inline-flex shrink-0 items-center gap-1 rounded-control border border-border bg-sunken px-1.5 py-0.5 font-mono text-caption text-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${o?"order-2":""}`,children:[f("pipelineStrip.baseSha",{sha:e.baseRef.slice(0,8)}),"copied"===S?(0,U.jsx)(fv.A,{className:"h-3 w-3 text-success","aria-hidden":!0}):(0,U.jsx)(wm.A,{className:"h-3 w-3","aria-hidden":!0})]}):null,(0,U.jsx)("span",{className:"sr-only","aria-live":"polite",role:"status",children:"copied"===S?f("pipelineStrip.copiedBaseSha"):"failed"===S?f("pipelineStrip.copyBaseShaFailed"):""}),(0,U.jsx)("ol",{"data-pipeline-stage-rail":!0,className:`no-scrollbar flex min-w-0 flex-1 items-center gap-1.5 overflow-x-auto ${o?"order-4 basis-full justify-start border-t border-border/70 pt-1":"justify-center"}`,"aria-label":f("pipelineStrip.stagesAria"),children:e.stages.map((l,c)=>(0,U.jsx)(wC,{pipeline:e,stage:l,previousStage:e.stages[c-1]??null,index:c,flows:t,files:n,renderableFlows:i,renderablePaths:r,materializedPaths:a,materializedFlows:s,mobile:o,open:v===l.id,configurationOpen:y===l.id,onToggleVerdict:()=>{k(null),w(e=>e===l.id?null:l.id)},onCloseVerdict:()=>w(null),onToggleConfiguration:e=>{w(null),k(t=>t===e?null:e)},onCloseConfiguration:()=>k(null),onOpenPath:d,onOpenFlow:u},l.id))}),c.length?(0,U.jsxs)("span",{className:`no-scrollbar flex max-w-[420px] min-w-0 shrink items-center gap-1 overflow-x-auto ${o?"order-5 basis-full":""}`,"aria-label":f("pipelineStrip.linkedTasks"),children:[(0,U.jsx)("span",{className:"text-caption font-semibold text-muted","aria-hidden":!0,children:"↗"}),c.map(e=>{let t=e.text.split("\n",1)[0]?.trim()||e.id;return(0,U.jsx)("button",{type:"button",disabled:!p,onClick:()=>p?.(e),"aria-label":f("pipelineStrip.openTask",{label:t}),className:"inline-flex h-7 max-w-[150px] items-center truncate rounded-control border border-border bg-sunken px-2 text-caption font-semibold text-secondary hover:border-accent/40 hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",children:t},e.id)})]}):null,(0,U.jsxs)("span",{"data-pipeline-actions":!0,className:`relative flex shrink-0 items-center gap-1.5 ${o?"order-3":""}`,children:[g?(0,U.jsx)("span",{role:"alert",className:"max-w-[220px] truncate text-caption font-semibold text-danger",title:g,children:g}):null,h?(0,U.jsx)(dO.A,{className:"h-3.5 w-3.5 animate-spin text-muted","aria-hidden":!0}):null,R?(0,U.jsxs)("button",{className:`${q} ${z} border-warning bg-warning text-white hover:opacity-90`,"aria-label":f("pipelineStrip.start"),disabled:h||e.stages.length<1,title:e.stages.length<1?f("groupOverride.startNeedsStages"):void 0,onClick:()=>void T("start"),children:[(0,U.jsx)(wf.A,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",l&&!o?null:f("pipelineStrip.start")]}):"needs_decision"===e.state?(0,U.jsxs)("button",{className:`${q} ${z} border-accent bg-accent text-white hover:opacity-90`,"aria-label":f("pipelineStrip.retryStage"),disabled:h,onClick:()=>void T("retry-stage"),children:[(0,U.jsx)(dO.A,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",l&&!o?null:f("pipelineStrip.retryStage")]}):O?(0,U.jsx)("span",{className:o?"h-11 w-11":"h-7 w-7","aria-hidden":!0}):"paused"===e.state?(0,U.jsxs)("button",{className:`${q} ${z} border-success/40 bg-success-soft text-success hover:opacity-90`,"aria-label":f("pipelineStrip.resume"),disabled:h,onClick:()=>void T("resume"),children:[(0,U.jsx)(wf.A,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",l&&!o?null:f("pipelineStrip.resume")]}):(0,U.jsxs)("button",{className:`${H} ${z}`,"aria-label":f("pipelineStrip.pause"),disabled:h,onClick:()=>void T("pause"),children:[(0,U.jsx)(fb.A,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",l&&!o?null:f("pipelineStrip.pause")]}),(0,U.jsx)("button",{ref:A,type:"button","aria-label":f("pipelineStrip.moreActions"),"aria-haspopup":"menu","aria-expanded":j,disabled:h,onClick:()=>N(e=>!e),className:`${q} border-border bg-card px-2 text-secondary hover:text-primary`,children:(0,U.jsx)(d9.A,{className:"h-4 w-4","aria-hidden":!0})}),j?(0,U.jsx)(wN,{anchorRef:A,children:(0,U.jsxs)("span",{role:"menu","aria-label":f("pipelineStrip.moreActions"),className:"flex min-w-[180px] flex-col gap-1 rounded-[10px] border border-border bg-card p-1.5 shadow-3",children:["needs_decision"===e.state?(0,U.jsx)("button",{ref:I,role:"menuitem",type:"button",disabled:h,onClick:()=>void T("skip-stage"),className:"inline-flex min-h-9 items-center rounded-control px-2 text-left text-ui font-semibold text-secondary hover:bg-sunken focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:f("pipelineStrip.skipStage")}):null,(0,U.jsx)("button",{ref:"needs_decision"===e.state?void 0:I,role:"menuitem",type:"button",disabled:h,onClick:()=>void T(R?"delete":"close"),className:"inline-flex min-h-9 items-center rounded-control px-2 text-left text-ui font-semibold text-danger hover:bg-danger-soft focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:f(R?"pipelineStrip.discard":"pipelineStrip.close")})]})}):null]})]})}function wI({pipeline:e,flows:t=[],files:n=[],renderablePaths:r,renderableFlows:i,linkedTasks:a=[],defaultExpanded:s=!0,onOpenPath:l,onOpenFlow:o,onOpenTask:c}){let{t:d}=(0,eh.Ym)(),[u,p]=(0,Y.useState)(s),m="draft"===e.state,f=xm.has(e.state),h=xp.has(e.state),{k:x,n:g}=xz(e),b=h?"bg-accent-soft text-accent":f||m?"bg-warning-soft text-warning":"completed"===e.state?"bg-success-soft text-success":"bg-sunken text-muted";return(0,U.jsxs)("div",{className:"px-2 py-1.5 [&_button]:!h-11 [&_button]:!min-h-11","data-testid":"mobile-pipeline-dock","data-pipeline-draft":m||void 0,children:[(0,U.jsxs)("button",{type:"button","data-testid":"mobile-pipeline-dock-summary","aria-expanded":u,"aria-label":d(u?"pipelineMobile.collapseDock":"pipelineMobile.expandDock",{task:e.task}),onClick:()=>p(e=>!e),className:"flex min-h-11 w-full items-center gap-2 rounded-control px-1 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:[(0,U.jsx)("span",{className:`h-2.5 w-2.5 shrink-0 rounded-full ${h?"animate-pulse bg-accent":f||m?"bg-warning":"completed"===e.state?"bg-success":"bg-strong"}`,"aria-hidden":!0}),(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate text-ui font-semibold text-primary",children:e.task}),(0,U.jsx)("span",{className:`shrink-0 rounded-full px-1.5 py-0.5 text-caption font-semibold ${b}`,children:xu(d,e.state)}),!m&&g?(0,U.jsx)("span",{className:"shrink-0 text-label font-semibold tabular-nums text-muted",children:d("pipelineStrip.stageOf",{k:x,n:g})}):null,u?(0,U.jsx)(ab.A,{className:"h-4 w-4 shrink-0 text-muted","aria-hidden":!0}):(0,U.jsx)(av.A,{className:"h-4 w-4 shrink-0 text-muted","aria-hidden":!0})]}),u?(0,U.jsx)(wA,{pipeline:e,flows:t,files:n,renderablePaths:r,renderableFlows:i,mobile:!0,linkedTasks:a,onOpenPath:l,onOpenFlow:o,onOpenTask:c}):null]})}function wM(e){let t=0,n=0,r=0;for(let i of e)"completed"===i.state?r+=1:"draft"===i.state||xm.has(i.state)?n+=1:t+=1;return{total:e.length,active:t,attention:n,completed:r}}var wT=n(412);function wP({pipelines:e,onOpen:t}){let{t:n}=(0,eh.Ym)();if(!e.length)return null;let r=wM(e),i=[];return r.active&&i.push(n("pipelineMobile.summaryActive",{n:r.active})),r.attention&&i.push(n("pipelineMobile.summaryAttention",{n:r.attention})),r.completed&&i.push(n("pipelineMobile.summaryCompleted",{n:r.completed})),(0,U.jsx)("div",{className:"shrink-0 border-t border-border bg-card",children:(0,U.jsxs)("button",{type:"button","data-testid":"mobile-pipeline-summary",onClick:t,"aria-haspopup":"dialog","aria-label":n("pipelineMobile.summaryOpen",{n:r.total}),className:"flex min-h-11 w-full items-center gap-2 px-3 py-1.5 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent/40",children:[(0,U.jsxs)("span",{className:"flex shrink-0 items-center gap-1","aria-hidden":!0,children:[r.active?(0,U.jsx)("span",{className:"h-2 w-2 rounded-full bg-accent"}):null,r.attention?(0,U.jsx)("span",{className:"h-2 w-2 rounded-full bg-warning"}):null,r.completed?(0,U.jsx)("span",{className:"h-2 w-2 rounded-full bg-success"}):null,r.active||r.attention||r.completed?null:(0,U.jsx)("span",{className:"h-2 w-2 rounded-full bg-strong"})]}),(0,U.jsx)(wT.A,{className:"h-4 w-4 shrink-0 text-muted","aria-hidden":!0}),(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate text-ui font-semibold text-primary",children:n("pipelineMobile.summaryCount",{n:r.total})}),i.length?(0,U.jsx)("span",{className:"shrink-0 truncate text-label font-semibold text-muted",children:i.join(" \xb7 ")}):null,(0,U.jsx)(i3.A,{className:"h-4 w-4 shrink-0 text-muted","aria-hidden":!0})]})})}function w$({pipelines:e,onOpen:t}){let{t:n}=(0,eh.Ym)();if(!e.length)return null;let r=wM(e),i=[];r.active&&i.push(n("pipelineMobile.summaryActive",{n:r.active})),r.attention&&i.push(n("pipelineMobile.summaryAttention",{n:r.attention})),r.completed&&i.push(n("pipelineMobile.summaryCompleted",{n:r.completed}));let a=[n("pipelineMobile.summaryCount",{n:r.total}),...i].join(" \xb7 "),s=r.attention||r.active||r.total,l=r.attention?"bg-warning/10 text-warning":r.active?"bg-accent/10 text-accent":"bg-sunken text-muted";return(0,U.jsxs)("button",{type:"button","data-testid":"mobile-pipeline-summary",onClick:t,"aria-haspopup":"dialog","aria-label":a,className:"inline-flex h-11 min-w-11 items-center justify-center gap-1 rounded-[8px] text-muted hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:[(0,U.jsx)(wT.A,{className:"h-4 w-4 shrink-0","aria-hidden":!0}),(0,U.jsx)("span",{className:`rounded-full px-1 text-[10px] font-bold ${l}`,children:s})]})}function wE({pipelines:e,render:t,onClose:n}){let{t:r}=(0,eh.Ym)(),[i,a]=(0,Y.useState)(!1),s=(0,Y.useRef)(null),l=e.filter(e=>"completed"!==e.state),o=e.filter(e=>"completed"===e.state);as({containerRef:s,onClose:n});let c=e=>(0,U.jsx)(wI,{pipeline:e,flows:t.flows,files:t.files,renderablePaths:t.renderablePaths,renderableFlows:t.renderableFlows,linkedTasks:t.linkedTasksByPipeline.get(e.id)??[],defaultExpanded:!1,onOpenPath:t.onOpenPath,onOpenFlow:t.onOpenFlow,onOpenTask:t.onOpenTask},e.id);return(0,U.jsx)("div",{className:"fixed inset-0 z-[70] flex items-end justify-center bg-black/40",role:"presentation",onClick:e=>{e.target===e.currentTarget&&n()},children:(0,U.jsxs)("div",{ref:s,role:"dialog","aria-modal":"true","aria-label":r("pipelineMobile.sheetTitle"),tabIndex:-1,"data-testid":"mobile-pipeline-sheet",className:"flex max-h-[80vh] w-full max-w-[520px] flex-col rounded-t-[16px] bg-card pb-[max(0.75rem,env(safe-area-inset-bottom))] shadow-2 focus-visible:outline-none",children:[(0,U.jsx)("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-2",children:(0,U.jsx)("div",{className:"mx-auto mb-0 h-1 w-10 rounded-full bg-border","aria-hidden":!0})}),(0,U.jsxs)("div",{className:"flex shrink-0 items-center justify-between px-3 py-2",children:[(0,U.jsx)("span",{className:"text-ui font-bold text-primary",children:r("pipelineMobile.sheetTitle")}),(0,U.jsx)("button",{type:"button",onClick:n,"aria-label":r("pipelineMobile.closeSheet"),className:"flex h-11 w-11 items-center justify-center rounded-[8px] border border-border bg-canvas text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:(0,U.jsx)(sx.X,{className:"h-5 w-5","aria-hidden":!0})})]}),(0,U.jsxs)("div",{className:"min-h-0 flex-1 divide-y divide-border overflow-y-auto",children:[l.map(c),o.length?(0,U.jsxs)("div",{"data-testid":"mobile-pipeline-completed-group",children:[(0,U.jsxs)("button",{type:"button","data-testid":"mobile-pipeline-completed-toggle","aria-expanded":i,onClick:()=>a(e=>!e),className:"flex min-h-11 w-full items-center gap-2 px-3 py-1.5 text-left text-label font-semibold text-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent/40",children:[i?(0,U.jsx)(av.A,{className:"h-4 w-4 shrink-0","aria-hidden":!0}):(0,U.jsx)(i3.A,{className:"h-4 w-4 shrink-0","aria-hidden":!0}),(0,U.jsx)("span",{className:"h-2 w-2 shrink-0 rounded-full bg-success","aria-hidden":!0}),r("pipelineMobile.completedGroup",{n:o.length})]}),i?(0,U.jsx)("div",{className:"divide-y divide-border border-t border-border",children:o.map(c)}):null]}):null]})]})})}function wR(e){return"running"===e||"live"===e?"bg-success":"silent"===e?"bg-warning":"closed"===e?"bg-muted":"bg-danger"}function wO({tray:e,onToggleExpanded:t,onOpenMember:n,onUnfold:r,variant:i="docked"}){let{t:a}=(0,eh.Ym)(),s=(0,Y.useRef)(null);if(0===e.count)return null;let l="inline"===i,o=`subagent-tray-${e.parentConversationId}`;return(0,U.jsxs)("div",{"data-subagent-tray":e.parentConversationId,"data-subagent-tray-variant":i,"data-scheme-ui":!0,className:l?"pointer-events-auto flex w-full min-w-0 flex-col items-stretch":"pointer-events-auto absolute inset-x-2 -bottom-3 z-[7] flex flex-col items-stretch",children:[(0,U.jsxs)("button",{ref:s,type:"button","data-subagent-tray-toggle":!0,"aria-expanded":e.expanded,"aria-controls":o,"aria-label":a(e.expanded?"subagentTray.collapse":"subagentTray.toggle",{count:e.count}),className:l?"inline-flex min-h-11 w-full items-center justify-between gap-1.5 rounded-[10px] border border-border bg-card px-3 text-[12px] font-semibold text-muted shadow-1 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/55":"inline-flex h-6 items-center gap-1.5 self-center rounded-full border border-border bg-card px-2.5 text-[11px] font-semibold text-muted shadow-1 hover:border-accent/40 hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/55",onClick:()=>t(!e.expanded),children:[(0,U.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[(0,U.jsx)("span",{"aria-hidden":!0,className:"text-[12px] leading-none",children:"⑂"}),(0,U.jsx)("span",{className:"tabular-nums truncate",children:a("subagentTray.label",{count:e.count})})]}),(0,U.jsx)("span",{"aria-hidden":!0,className:"flex items-center gap-0.5",children:e.members.slice(0,6).map(e=>(0,U.jsx)("span",{className:`inline-block h-1.5 w-1.5 rounded-full ${wR(e.state)}`},e.id))})]}),e.expanded?(0,U.jsx)("ul",{id:o,"aria-label":a("subagentTray.rows"),className:"mt-1 flex w-full min-w-0 flex-col gap-0.5 rounded-[10px] border border-dashed border-border bg-card/95 p-1 shadow-1",onKeyDown:e=>{"Escape"===e.key&&(e.stopPropagation(),t(!1),requestAnimationFrame(()=>s.current?.focus()))},children:e.members.map(e=>{let t;return(0,U.jsxs)("li",{className:"flex min-w-0 items-center gap-1",children:[(0,U.jsxs)("button",{type:"button","data-subagent-tray-member":e.id,"data-subagent-state":e.state,"aria-label":a("subagentTray.open",{name:e.title}),title:`${e.title} \xb7 ${(t=e.state,a(`subagentTray.state.${t}`))}`,className:`flex min-w-0 flex-1 items-center gap-1.5 rounded-md px-1.5 text-left font-medium text-primary hover:bg-accent/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/55 ${l?"min-h-11 text-[13px]":"py-1 text-[11px]"}`,onClick:()=>n(e.path),children:[(0,U.jsx)("span",{"aria-hidden":!0,className:`inline-block h-1.5 w-1.5 shrink-0 rounded-full ${wR(e.state)}`}),(0,U.jsx)("span",{className:"min-w-0 truncate",children:e.title})]}),(0,U.jsx)("button",{type:"button","data-subagent-tray-unfold":e.id,"aria-label":a("subagentTray.unfold",{name:e.title}),className:`shrink-0 rounded-md text-muted hover:bg-accent/10 hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/55 ${l?"inline-flex min-h-11 min-w-11 items-center justify-center text-[13px]":"px-1 py-1 text-[11px]"}`,onClick:()=>r(e.id,e.path),children:(0,U.jsx)("span",{"aria-hidden":!0,children:"↥"})})]},e.id)})}):null]})}let wD=e=>({x:e.x,y:e.y,w:e.w,h:e.h});function wL(e){let t=new Map;for(let n of e)for(let e of n.runs){let r=[...e.attempts].reverse().find(e=>e.agentPath)?.agentPath;r&&t.set(x8(n.id,e.stageId),r)}return t}function w_(e,t,n={}){let r=new Map(e.groups.map(e=>[e.key,wD(e)])),i=[...e.nodes.map(e=>({key:e.file.path,label:(0,ex.cr)(e.file.title,60),rect:wD(e)})),...e.groups.map(e=>({key:e.key,label:(0,ex.cr)(e.label,60),rect:wD(e)}))].filter(e=>e.label.length>0),a=t=>{let i=e.byPath.get(t);if(i)return wD(i);let a=r.get(t);if(a)return a;let s=n.extraRects?.get(t);return s?wD(s):null},s=ge(e.nodes.map(e=>e.file.path),(e.decks??[]).map(e=>({key:e.key,flow:e.flow})),(e.stacks??[]).map(e=>({key:e.key,paths:e.items.map(e=>e.file.path)}))),l=e=>{if(a(e))return e;let t=n.aliases?.get(e);if(t&&a(t))return t;let r=s.get(t??e);return r&&a(r)?r:null};return{project:t,boardRevision:n.boardRevision??null,named:i,concreteAnchorKey:l,rectFor:e=>{let t=l(e);return t?a(t):null}}}function wF(e){return"running"===e||"live"===e?0:"silent"===e?1:2}function wq(e){let t=e.sessionStartedAt?Date.parse(e.sessionStartedAt):NaN;return Number.isFinite(t)?t:1e3*e.mtime}function wz({conversationId:e,entries:t,cardRect:n,onNavigate:r,onExpandedChange:i,anchorRegistry:a,exclude:s,onFold:l,now:o}){let{t:c}=(0,eh.Ym)(),d=e=>c("subagentTray.fold",{name:e}),[u,p]=(0,Y.useState)(null),m=(0,Y.useRef)(!1),f=hX(),h=o??f,x=(0,Y.useMemo)(()=>(function(e,t,n=new Set,r=0){return(function(e,t,n=()=>!0){let r=new Set(t.filter(t=>W(t)===e).map(e=>e.path)),i=new Map;for(let a of t){if(V(a)||"shell"===a.engine)continue;let t=W(a);if(t===e)continue;let s=bR(a);if(null!==s){if(s!==e)continue}else if(!a.parent||!r.has(a.parent))continue;if(!n(a))continue;let l=i.get(t),o=a.generation??0,c=l?.generation??0;(!l||o>c||o===c&&a.mtime>l.mtime)&&i.set(t,a)}return[...i.values()]})(e,t).filter(e=>!n.has(e.path)&&!n.has(W(e))).map(e=>({entry:e,state:vr(e,r)})).sort((e,t)=>wF(e.state)-wF(t.state)||wq(e.entry)-wq(t.entry)||W(e.entry).localeCompare(W(t.entry))).map(({entry:e,state:t})=>{let n=W(e);return{id:n,path:e.path,title:e.title,engine:e.engine,model:e.model,state:t,avatarSeed:n}})})(e,t,s,h),[e,t,s,h]),g=(0,Y.useMemo)(()=>(function(e,t,n=30,r=6){if(!e.length)return[];let i=Math.max(1,Math.floor((t.h+r)/(n+r))),a=t.y+Math.max(0,t.h-n),s=e.length>12?e.slice(0,11):e,l=s.map((e,s)=>{let l=Math.floor(s/i),o=s%i;return{kind:"badge",child:e,x:t.x+t.w+r+l*(n+r),y:a-o*(n+r),size:n,column:l,row:o}});if(s.length<e.length){let o=s.length,c=Math.floor(o/i),d=o%i;l.push({kind:"overflow",count:e.length-s.length,x:t.x+t.w+r+c*(n+r),y:a-d*(n+r),size:n,column:c,row:d})}return l})(x,n),[x,n]),b=null!==u&&x.some(e=>e.id===u);return((0,Y.useEffect)(()=>{i?.(b)},[b,i]),(0,Y.useEffect)(()=>{if(!a)return;let t=new Map(g.flatMap(e=>"badge"===e.kind?[[e.child.id,{x:e.x+e.size/2,y:e.y+e.size/2}]]:[]));if(t.size)return a.replace(e,t)},[a,e,g]),g.length)?(0,U.jsx)(U.Fragment,{children:g.map(e=>{let t,i={left:e.x-n.x,top:e.y-n.y,height:e.size};if("overflow"===e.kind)return(0,U.jsxs)("span",{"data-subagent-overflow":!0,"data-chip-keepout":!0,"data-scheme-ui":!0,className:"pointer-events-auto absolute z-[6] inline-flex w-[30px] items-center justify-center rounded-full border border-border bg-card text-[10px] font-bold tabular-nums text-muted shadow-1",style:i,title:`${e.count} more subagents`,"aria-label":`${e.count} more subagents`,children:["+",e.count]},"overflow");let a=e.child,s=u===a.id,o="dead"===a.state,f=o||"closed"===a.state,h=function(e){let t=0;for(let n of e)t=31*t+n.charCodeAt(0)>>>0;return t%360}(a.avatarSeed),x="running"===a.state||"live"===a.state,g="silent"===a.state||o?` \xb7 ${c(`subagentTray.state.${a.state}`)}`:"",b=`${a.title} \xb7 ${a.engine}${a.model?` / ${a.model}`:""}${g}`;return(0,U.jsxs)("span",{className:"contents",children:[s&&l&&!o?(0,U.jsx)("button",{type:"button","data-subagent-fold":a.id,"data-scheme-ui":!0,"aria-label":d(a.title),title:d(a.title),className:"pointer-events-auto absolute z-[71] inline-flex h-5 w-5 items-center justify-center rounded-full border border-border bg-card text-[11px] text-muted shadow-1 hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/55",style:{left:e.x-n.x+202,top:e.y-n.y+5},onClick:()=>l(a.id,a.path),children:(0,U.jsx)("span",{"aria-hidden":!0,children:"↧"})}):null,(0,U.jsxs)("button",{type:"button","data-subagent-badge":a.id,"data-subagent-state":a.state,"data-chip-keepout":!0,"data-scheme-ui":!0,"aria-expanded":s,"aria-disabled":o,"aria-label":a.title,title:b,className:`pointer-events-auto absolute flex max-w-[220px] items-center overflow-hidden rounded-full border border-card bg-card text-left shadow-1 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/55 ${s?"z-[70] w-[220px]":"z-[6] w-[30px]"} ${f?"opacity-45 grayscale":""} ${o?"cursor-default":"cursor-pointer hover:shadow-2"}`,style:{...i,transform:s?"scale(var(--inv-z, 1))":void 0,transformOrigin:"15px center"},onMouseEnter:()=>p(a.id),onMouseLeave:()=>p(e=>e===a.id?null:e),onFocus:()=>p(a.id),onBlur:()=>p(e=>e===a.id?null:e),onPointerUp:e=>{"touch"!==e.pointerType||o||(e.preventDefault(),m.current=!0,s?r(a.path):p(a.id))},onClick:()=>{if(m.current){m.current=!1;return}o||r(a.path)},children:[(0,U.jsxs)("span",{className:"relative z-[1] inline-flex h-[30px] w-[30px] shrink-0 items-center justify-center rounded-full text-[9px] font-black tracking-[-0.04em] text-white",style:{background:`linear-gradient(135deg, oklch(72% 0.17 ${h}), oklch(48% 0.2 ${(h+58)%360}))`},"aria-hidden":!0,children:[((t=a.title.trim().split(/\s+/).filter(Boolean)).length>1?t[0][0]+t.at(-1)[0]:t[0]?.slice(0,2)||"AI").toUpperCase(),x?(0,U.jsx)("span",{"data-subagent-ring":"working",className:"absolute inset-[-2px] rounded-full ring-2 ring-success/70 animate-pulse motion-reduce:animate-none"}):null,"silent"===a.state?(0,U.jsx)("span",{"data-subagent-ring":"silent",className:"absolute inset-[-2px] rounded-full ring-2 ring-warning"}):null]}),(0,U.jsx)("span",{className:`min-w-0 truncate px-2.5 text-[11px] font-semibold text-primary ${s?"opacity-100":"opacity-0"}`,children:a.title})]})]},a.id)})}):null}function wH(e){let t=e.split("\n",1)[0]??"";return(0,tw.cr)(t,60)}function wU(e,t,n){let r=Math.max(1,Math.floor((n+16)/148)),i=Math.floor(e/r);return{x:e%r*148,y:t+76*i,w:132,h:60}}let wB={w:390,h:620},wK=[];function wY(e,t,n){return Math.min(n,Math.max(t,e))}function wW(e,t){let n=Math.max(t.w-56-40,1),r=Math.max(t.h-56-40,1),i=Math.min(n/e.w,r/e.h,1.6),a=e.w*i+40,s=e.h*i+40;return{z:i,tx:28+(t.w-56-a)/2-e.x*i,ty:28+(t.h-56-s)/2-e.y*i}}function wV({layout:e,tasks:t,workerStacks:n,pipelineOutlines:r=wK,frame:i,ringKey:a,onPick:s}){let{t:l}=(0,eh.Ym)(),o=(0,Y.useMemo)(()=>(function(e,t,n,r=null,i=[]){var a,s;let l,o,c=[];for(let t of e.nodes)c.push({key:t.file.path,kind:"node",rect:{x:t.x,y:t.y,w:t.w,h:t.h},title:(0,tw.cr)(t.file.title,60),pickKey:t.file.path,isRoot:t.isRoot,file:t.file});for(let t of e.decks)c.push({key:t.key,kind:"deck",rect:{x:t.x,y:t.y,w:t.w,h:t.h},title:wH(t.flow.id),pickKey:t.key,isRoot:!1,count:t.rounds.length});for(let t of e.drafts)c.push({key:t.key,kind:"draft",rect:{x:t.x,y:t.y,w:t.w,h:t.h},title:t.id,pickKey:t.key,isRoot:!0});for(let t of e.stacks){let e=t.items[0]?.file??null;c.push({key:t.key,kind:"stack",rect:{x:t.x,y:t.y,w:t.w,h:t.h},title:e?(0,tw.cr)(e.title,40):"",pickKey:e?e.path:null,isRoot:!1,count:t.items.length})}for(let e of i)c.push({key:"pipeline::"+e.id,kind:"pipeline",rect:e.rect,title:e.title,pickKey:null,isRoot:!0});let d=Math.max(e.width,1),u=Math.max(e.height,0)+48;n.forEach((e,t)=>{let n=e.items[0]??null;c.push({key:"worker::"+e.key,kind:"worker",rect:wU(t,u,d),title:e.id,pickKey:n?n.path:null,isRoot:!1,count:e.items.length})}),n.length&&(u+=(a=n.length,76*Math.ceil(a/Math.max(1,Math.floor((d+16)/148)))+16));let p=[];for(let e of t)e.pos?c.push({key:"task::"+e.id,kind:"task",rect:{x:e.pos.x,y:e.pos.y,w:132,h:60},title:wH(e.text),pickKey:"task::"+e.id,isRoot:!1}):p.push(e);p.forEach((e,t)=>{c.push({key:"task::"+e.id,kind:"task",rect:wU(t,u,d),title:wH(e.text),pickKey:"task::"+e.id,isRoot:!1})});let m=c.slice(0,400),f=c.slice(400);if(r){let e=f.findIndex(e=>e.key===r);if(e>=0){let t=f.splice(e,1)[0],n=m.pop();m.push(t),n&&f.unshift(n)}}let h=function(e){if(!e.length)return[];let t=1/0,n=1/0,r=-1/0,i=-1/0;for(let a of e)t=Math.min(t,a.rect.x),n=Math.min(n,a.rect.y),r=Math.max(r,a.rect.x+a.rect.w),i=Math.max(i,a.rect.y+a.rect.h);let a=Math.max((r-t)/6,1),s=Math.max((i-n)/6,1),l=new Map;for(let r of e){let e=Math.min(5,Math.floor((r.rect.x-t)/a)),i=Math.min(5,Math.floor((r.rect.y-n)/s)),o=e+":"+i,c=l.get(o)??{count:0,x:t+e*a,y:n+i*s};c.count+=1,l.set(o,c)}return[...l.entries()].map(([e,t])=>({key:"cluster::"+e,count:t.count,rect:{x:t.x,y:t.y,w:a,h:s}}))}(f),x=new Set(m.map(e=>e.key)),g=m.filter(e=>"node"===e.kind).map(e=>e.rect),b=[];for(let t of e.edges)if(x.has(t.to)&&g.some(e=>{var n,r,i;return n=e,r=t.x1,i=t.y1,r>=n.x&&r<=n.x+n.w&&i>=n.y&&i<=n.y+n.h})&&(b.push({x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2}),b.length>=400))break;let v=[{x:0,y:0,w:Math.max(e.width,1),h:Math.max(e.height,u,1)},...m.map(e=>e.rect),...h.map(e=>e.rect)],w=Math.min(...v.map(e=>e.x)),y=Math.min(...v.map(e=>e.y)),k=Math.max(...v.map(e=>e.x+e.w)),j=Math.max(...v.map(e=>e.y+e.h)),N=r?c.find(e=>e.key===r)?.rect??null:null,S=[...i.map(e=>e.rect),...N?[N]:[]];return{markers:m,edges:b,clusters:h,world:{x:w,y:y,w:Math.max(k-w,1),h:Math.max(j-y,1)},current:S.length?(l=Math.min(...(s=S).map(e=>e.x)),{x:l,y:o=Math.min(...s.map(e=>e.y)),w:Math.max(...s.map(e=>e.x+e.w))-l,h:Math.max(...s.map(e=>e.y+e.h))-o}):null,total:c.length}})(e,t,n,a,r),[e,t,n,a,r]),c="current"===i?o.current:null,d=(0,Y.useRef)(null),[u,p]=(0,Y.useState)(wB),[m,f]=(0,Y.useState)(!1),[h,x]=(0,Y.useState)(()=>wW(o.world,wB)),{x:g,y:b,w:v,h:w}=o.world,{w:y,h:k}=u,j=c?.x??null,N=c?.y??null,S=c?.w??null,C=c?.h??null,A=(0,Y.useMemo)(()=>wW({x:g,y:b,w:v,h:w},{w:y,h:k}),[g,b,v,w,y,k]),I=(0,Y.useMemo)(()=>{var e,t;let n,r,i,a,s;return null===j||null===N||null===S||null===C?null:(e={x:j,y:N,w:S,h:C},n=Math.max((t={w:y,h:k}).w-56,1),r=Math.max(t.h-56,1),i=Math.min(n/Math.max(e.w,1),r/Math.max(e.h,1),1),a=e.x+e.w/2,s=e.y+e.h/2,{z:i,tx:t.w/2-a*i,ty:t.h/2-s*i})},[j,N,S,C,y,k])??A,M=Math.min(.15,I.z);(0,Y.useEffect)(()=>{let e=d.current;if(!e)return;let t=()=>{let t=e.clientWidth||wB.w,n=e.clientHeight||wB.h;p(e=>e.w===t&&e.h===n?e:{w:t,h:n})};t();let n=globalThis.ResizeObserver;if(!n)return;let r=new n(t);return r.observe(e),()=>r.disconnect()},[]),(0,Y.useEffect)(()=>{let e=requestAnimationFrame(()=>f(!0));return()=>cancelAnimationFrame(e)},[]),(0,Y.useEffect)(()=>{x(I)},[i,I]);let T=(0,Y.useRef)(new Map),P=(0,Y.useRef)(null),$=e=>{T.current.delete(e.pointerId),T.current.size<2&&(P.current=null)};return(0,U.jsx)("div",{ref:d,"data-testid":"mobile-map",className:"relative min-h-0 flex-1 touch-none overflow-hidden bg-canvas",onPointerDown:e=>{e.currentTarget.setPointerCapture?.(e.pointerId),T.current.set(e.pointerId,{x:e.clientX,y:e.clientY})},onPointerMove:e=>{let t=T.current.get(e.pointerId);if(!t)return;let n={x:e.clientX,y:e.clientY};if(T.current.set(e.pointerId,n),T.current.size>=2){let[e,t]=[...T.current.values()],n=Math.hypot(e.x-t.x,e.y-t.y);if(P.current){if(P.current.dist>0){let e=wY(P.current.z*(n/P.current.dist),M,1.6);x(t=>({...t,z:e}))}}else P.current={dist:n,z:h.z};return}x(e=>({...e,tx:e.tx+(n.x-t.x),ty:e.ty+(n.y-t.y)}))},onPointerUp:$,onPointerCancel:$,onWheel:e=>{let t=Math.exp(-(.0015*e.deltaY));x(n=>{let r=wY(n.z*t,M,1.6),i=d.current?.getBoundingClientRect(),a=i?e.clientX-i.left:u.w/2,s=i?e.clientY-i.top:u.h/2,l=(a-n.tx)/n.z,o=(s-n.ty)/n.z;return{z:r,tx:a-l*r,ty:s-o*r}})},role:"application","aria-label":l("mobile.map"),children:m?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("svg",{className:"pointer-events-none absolute inset-0 h-full w-full","aria-hidden":!0,children:(0,U.jsx)("g",{transform:`translate(${h.tx} ${h.ty}) scale(${h.z})`,children:o.edges.map((e,t)=>(0,U.jsx)("line",{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,className:"stroke-border",strokeWidth:2/h.z},t))})}),o.markers.map(e=>(0,U.jsx)(wJ,{marker:e,camera:h,active:e.key===a,onPick:s},e.key)),o.clusters.map(e=>{let t=e.rect.x*h.z+h.tx,n=e.rect.y*h.z+h.ty;return(0,U.jsxs)("span",{"data-testid":"mobile-map-cluster",className:"pointer-events-none absolute flex h-6 min-w-6 items-center justify-center rounded-full border border-border bg-sunken px-1.5 text-[10px] font-bold text-muted",style:{left:t,top:n},children:["+",e.count]},e.key)})]}):(0,U.jsx)("div",{"data-testid":"mobile-map-skeleton",className:"absolute inset-0 flex flex-col gap-2 p-4","aria-label":l("mobile.mapLoading"),children:Array.from({length:5}).map((e,t)=>(0,U.jsx)("span",{className:"h-8 w-2/3 animate-pulse rounded-[8px] bg-sunken",style:{opacity:1-.15*t},"aria-hidden":!0},t))})})}function wJ({marker:e,camera:t,active:n,onPick:r}){let{t:i}=(0,eh.Ym)(),a=e.rect.x*t.z+t.tx,s=e.rect.y*t.z+t.ty,l=Math.max(e.rect.w*t.z,40),o=Math.max(e.rect.h*t.z,40),c=e.file?(0,tw.yz)(e.file):null,d=e.title||i(`mobile.marker.${e.kind}`),u=null===e.pickKey;return(0,U.jsxs)("button",{type:"button","data-testid":"mobile-map-marker","data-map-key":e.pickKey??"","data-map-kind":e.kind,disabled:u,onClick:()=>e.pickKey&&r(e.pickKey),"aria-label":i("mobile.marker.open",{title:d}),className:`absolute flex flex-col justify-center gap-0.5 overflow-hidden rounded-[8px] border px-1.5 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${n?"border-accent bg-accent/10":"draft"===e.kind?"border-dashed border-border bg-canvas":"border-border bg-card"} ${u?"opacity-60":""}`,style:{left:a,top:s,width:l,height:o,minWidth:40,minHeight:40},children:[(0,U.jsxs)("span",{className:"flex items-center gap-1",children:[e.file?(0,U.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${(0,tw.tz)(e.file.activity)}`,"aria-hidden":!0}):null,c?(0,U.jsx)("span",{className:"shrink-0 rounded px-1 text-[8px] font-bold",style:c.style,children:c.label}):null,e.count?(0,U.jsx)("span",{className:"shrink-0 rounded-full bg-sunken px-1 text-[8px] font-bold text-muted",children:e.count}):null]}),(0,U.jsx)("span",{className:"truncate text-[9px] font-semibold text-primary",children:d})]})}let wG={waiting:5,stalled:4,live:3,returned:2,done:1},wQ=new Set;function wX({project:e,projectName:t,groups:n,manual:r,files:i,flows:a,reviewGroups:s=[],pipelines:l,surfacePipelines:o=[],workerStacks:c=[],tasks:d,sheetTasks:u,drafts:p,favorites:m,isolatedManualPaths:f=wQ,loaded:h,focus:x,onSelect:g,onClose:b,onDraftClose:v,onDraftSpawned:w,onActiveChange:y,taskSheetNonce:k=0,trayApi:j}){let N,{t:S}=(0,eh.Ym)(),C=it(e),A=sW(),[I,M]=(0,Y.useState)(null),[T,P]=(0,Y.useState)(!1),[$,E]=(0,Y.useState)(!1),[R,O]=(0,Y.useState)("all"),[D,L]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{k>0&&L("new")},[k]);let _=(0,Y.useRef)(null),F=(0,Y.useRef)(null),q=(0,Y.useRef)(null),[z,H]=(0,Y.useState)({left:!1,right:!1}),B=(0,Y.useCallback)(()=>{let e=q.current;if(!e)return;let t=e.scrollLeft>4,n=e.scrollLeft+e.clientWidth<e.scrollWidth-4;H(e=>e.left===t&&e.right===n?e:{left:t,right:n})},[]),K=(0,Y.useMemo)(()=>s.length?[...a,...s]:a,[a,s]),V=(0,Y.useMemo)(()=>xk(l,K),[l,K]),J=(0,Y.useMemo)(()=>vt(n,r,i,V,p,l,o,m,f),[n,r,i,V,p,l,o,m,f]),G=(0,Y.useMemo)(()=>{let e=o.filter(e=>"completed"!==e.state&&"closed"!==e.state),t=J.nodes.map(e=>({x:e.x,y:e.y,w:e.w,h:e.h,path:e.file.path,conversationId:e.file.conversationId})),n=d.filter(b_).map(e=>bB(e,!1)),r=function(e,t,n,r,i=new Map){let a=[...e].sort((e,t)=>e.createdAt<t.createdAt?-1:e.createdAt>t.createdAt?1:e.id.localeCompare(t.id)),s=new Map,l=new Map,o=[...r],c=new Map;for(let e of a){let t=e.pos;if(!t)continue;let n={...t,w:360,h:76};l.set(e.id,n),o.push(n)}for(let e of a){if(e.pos)continue;let r=function(e,t,n){let r,i=e.taskIds??[],a=new Map(t.map(e=>[e.id,e])),s=i.map(e=>a.get(e)).find(e=>void 0!==e)??null;if(s?.pos)return{x:s.pos.x+260+32,y:s.pos.y};let l=s?null:(r=ve(e),t.find(e=>!!(e.source&&r.paths.has(e.source.path)||e.assignments.some(e=>!!(e.path&&r.paths.has(e.path)||e.conversationId&&r.conversationIds.has(e.conversationId)))))??null);if(l?.pos)return{x:l.pos.x+260+32,y:l.pos.y};let o=ve(e),c=n.filter(e=>o.paths.has(e.path)||!!(e.conversationId&&o.conversationIds.has(e.conversationId)));if(c.length){let e=c.reduce((e,t)=>({x:e.x+t.x+t.w/2,y:e.y+t.y+t.h/2}),{x:0,y:0});return{x:Math.round(e.x/c.length),y:Math.round(e.y/c.length)}}let d=Math.max(0,...t.flatMap(e=>e.pos?[e.pos.x+260]:[]),...n.map(e=>e.x+e.w)),u=function(e){let t=0x811c9dc5;for(let n of e)t^=n.codePointAt(0)??0,t=Math.imul(t,0x1000193);return t>>>0}(e.id),p=Math.floor(u/4)%12;return{x:24*Math.ceil((d+144)/24)+u%4*384,y:120+100*p}}(e,t,n),i=`${r.x}:${r.y}`,a=c.get(i)??0;c.set(i,a+76+24);let s={...bL({x:r.x,y:r.y+a},{w:360,h:76},o),w:360,h:76};l.set(e.id,s),o.push(s)}let d=[...o];for(let e of a){let t=l.get(e.id);if(!((i.get(e.id)??76)>76)){s.set(e.id,{...t,header:t,body:null,bounds:t,direction:"collapsed"});continue}let n=d.filter(e=>e!==t),{body:r,direction:a}=function(e,t){let n={w:360,h:444},r=(t,r)=>"down"===t?{x:e.x,y:e.y+e.h+r,...n}:"up"===t?{x:e.x,y:e.y-n.h-r,...n}:"right"===t?{x:e.x+e.w+r,y:e.y,...n}:{x:e.x-n.w-r,y:e.y,...n},i=["down","up","right","left"];for(let e=0;e<=40;e+=1)for(let n of i){let i=r(n,24*e);if(!function(e,t){return t.some(t=>e.x<t.x+t.w+16&&e.x+e.w+16>t.x&&e.y<t.y+t.h+16&&e.y+e.h+16>t.y)}(i,t))return{body:i,direction:n}}return{body:{...bL(r("right",984),n,t),...n},direction:"free"}}(t,n);d.push(r);let o=function(e){let t=Math.min(...e.map(e=>e.x)),n=Math.min(...e.map(e=>e.y));return{x:t,y:n,w:Math.max(...e.map(e=>e.x+e.w))-t,h:Math.max(...e.map(e=>e.y+e.h))-n}}([t,r]);s.set(e.id,{...o,header:t,body:r,bounds:o,direction:a})}return s}(e,d,t,[...J.nodes,...J.decks,...J.stacks,...J.drafts,...J.slots,...n]);return e.flatMap(e=>{let t=r.get(e.id);return t?[{id:e.id,title:e.task,rect:t.bounds}]:[]})},[o,J,d]),Q=(0,Y.useMemo)(()=>[...J.nodes.map(e=>({key:e.file.path,file:e.file,isRoot:e.isRoot,kind:"node"})),...J.decks.map(e=>({key:e.key,file:null,isRoot:!1,kind:"deck"})),...J.drafts.map(e=>({key:e.key,file:null,isRoot:!0,kind:"draft"}))],[J]),X=(0,Y.useMemo)(()=>new Map(Q.map(e=>[e.key,e])),[Q]),Z=(0,Y.useMemo)(()=>w_(J,e,{aliases:wL(l)}),[J,e,l]);(0,Y.useEffect)(()=>iN.setBoard({project:e,index:Z,moveTo:({anchorKeys:e})=>{let t=e.find(e=>X.has(e));return!!t&&(M(t),P(!1),!0)},restoreCamera:()=>!1}),[e,Z,X]),(0,Y.useEffect)(()=>{M(sessionStorage.getItem("llvFocus:"+e)),P(!1)},[e]),(0,Y.useEffect)(()=>{x&&(M(x),P(!1))},[x]);let ee=(0,Y.useMemo)(()=>{if(I&&X.has(I))return I;let e=null,t=-1;for(let n of Q){if(!n.file)continue;let r=1e12*wG[tC(n.file)]+n.file.mtime;r>t&&(t=r,e=n)}return(e??Q[0])?.key??null},[I,X,Q]);(0,Y.useEffect)(()=>{I&&X.has(I)?sessionStorage.setItem("llvFocus:"+e,I):!I&&ee&&sessionStorage.setItem("llvFocus:"+e,ee)},[I,X,ee,e]),(0,Y.useEffect)(()=>{F.current?.scrollIntoView({block:"nearest",inline:"nearest"}),B()},[ee,Q,B]);let et=(0,Y.useMemo)(()=>J.nodes.find(e=>e.file.path===ee)??null,[J,ee]),en=(0,Y.useMemo)(()=>J.decks.find(e=>e.key===ee)??null,[J,ee]),er=(0,Y.useMemo)(()=>J.drafts.find(e=>e.key===ee)??null,[J,ee]);(0,Y.useEffect)(()=>{y?.(et?.file??null)},[et,y]),(0,Y.useEffect)(()=>()=>y?.(null),[y]);let ei=(0,Y.useMemo)(()=>new Set(J.groups.filter(e=>"pipeline"===e.kind&&e.pipeline).map(e=>e.id)),[J.groups]),ea=(0,Y.useMemo)(()=>{let e,t;return t=new Set([...(e=function(e,t){let n=[],r=[];for(let i of e)("closed"!==i.state||i.restored)&&(t.has(i.id)?n.push(i):r.push(i));return{memberful:n,shelf:r}}(o,ei)).memberful,...e.shelf].map(e=>e.id)),o.filter(e=>t.has(e.id))},[o,ei]);(0,Y.useEffect)(()=>{let e=et?et.file.path:null,t=J.nodes.map(e=>e.file.path),n=T?t.slice(0,128):et?[et.file.path]:[];ip.reportSlice({mode:T?"mobile-map":"mobile-focus",focusedPath:e,selectedPaths:ic(t,C.selection,{includeUnordered:!0}),visiblePaths:n,camera:null})},[et,T,J,C.selection]);let es=function(e,t,n){if(!t&&!n)return null;for(let r of e){if("closed"===r.state)continue;let e=r.stages.findIndex(e=>{let i=xc(r,e.id);return!!i&&(!!t&&i.agentPath===t||!!(n&&i.flowId===n))});if(e>=0)return{pipeline:r,index:e}}return null}(l,et?et.file.path:null,en?en.flow.id:null),el=(0,Y.useMemo)(()=>new Set(i.map(e=>e.path)),[i]),eo=(0,Y.useMemo)(()=>xA(V,new Set(J.nodes.map(e=>e.file.path))),[V,J]),ec=(0,Y.useMemo)(()=>new Map(l.map(e=>[e.id,xN(e,u??d,a,i)])),[l,u,d,a,i]),ed=(0,Y.useMemo)(()=>v0(i,u??d),[i,u,d]),eu=(0,Y.useCallback)(e=>{let t=i.find(t=>t.path===e);t&&g(t)},[i,g]),ep=(0,Y.useCallback)(e=>L({taskId:e.id}),[]),em=(0,Y.useCallback)(e=>{let t=x6(e);X.has(t)&&M(t)},[X]),ef=(0,Y.useCallback)(e=>{if(!Q.length)return;let t=Q.findIndex(e=>e.key===ee),n=Q[Math.min(Q.length-1,Math.max(0,(-1===t?0:t)+e))];n&&n.key!==ee&&M(n.key)},[Q,ee]),ex=(0,Y.useCallback)(e=>{(P(!1),X.has(e.path))?M(e.path):g(e)},[X,g]),eg=(0,Y.useCallback)(e=>{if(P(!1),e.startsWith("task::"))return void L({taskId:e.slice(6)});if(X.has(e))return void M(e);let t=i.find(t=>t.path===e);t&&g(t)},[X,i,g]);return(0,U.jsxs)("div",{"data-testid":"mobile-chat-shell","data-chat-min-share":.6,className:"relative flex h-full max-h-[100dvh] min-h-0 min-w-0 max-w-[100dvw] flex-1 flex-col overflow-hidden overflow-x-clip",style:A>0?{paddingBottom:A}:void 0,children:[(0,U.jsx)(dy,{compact:!0}),(0,U.jsxs)("div",{className:"flex shrink-0 items-stretch border-b border-border bg-card",children:[(0,U.jsx)(wd,{project:e,projectName:eb(e,t),files:i,onOpenConversation:ex}),Q.length>1||es?(0,U.jsxs)("div",{className:"relative min-w-0 flex-1",children:[(0,U.jsxs)("div",{ref:q,onScroll:B,className:"no-scrollbar flex items-center gap-1.5 overflow-x-auto px-2 py-1",children:[es?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(wZ,{pipeline:es.pipeline,index:es.index,flows:a,files:i,renderableFlows:eo,renderablePaths:el,onHop:e=>{if(!es)return;let t=es.pipeline.stages[e];if(!t)return;let n=xT(t,xc(es.pipeline,t.id),a,eo,el,i);if(n){if("flow"===n.kind){let e=x6(n.flowId);X.has(e)&&M(e);return}eu(n.path)}},onOpenPath:eu}),Q.length>1?(0,U.jsx)("span",{"aria-hidden":!0,className:"mx-0.5 h-7 w-px shrink-0 bg-border"}):null]}):null,Q.length>1?Q.map(e=>(0,U.jsx)(w0,{entry:e,active:e.key===ee,chipRef:e.key===ee?F:void 0,onClick:()=>M(e.key)},e.key)):null]}),(0,U.jsx)("span",{"aria-hidden":!0,className:`pointer-events-none absolute inset-y-0 left-0 w-6 bg-gradient-to-r from-card to-transparent transition-opacity ${z.left?"opacity-100":"opacity-0"}`}),(0,U.jsx)("span",{"aria-hidden":!0,className:`pointer-events-none absolute inset-y-0 right-0 w-6 bg-gradient-to-l from-card to-transparent transition-opacity ${z.right?"opacity-100":"opacity-0"}`})]}):(0,U.jsx)("span",{className:"min-w-0 flex-1","aria-hidden":!0}),(0,U.jsxs)("div",{className:"flex shrink-0 items-center gap-1 border-l border-border px-1.5",children:[(et||en||er)&&ea.length?(0,U.jsx)(w$,{pipelines:ea,onOpen:()=>E(!0)}):null,!function(e,t,n=0){return e>1||t>0||n>0}(J.nodes.length,c.length,G.length)?null:(0,U.jsx)("button",{type:"button",className:"inline-flex h-11 min-w-11 items-center justify-center gap-1 rounded-[8px] text-muted hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":S("mobile.openMap"),onClick:()=>{O("all"),P(!0)},children:(0,U.jsx)(vY.A,{className:"h-4 w-4","aria-hidden":!0})}),(0,U.jsxs)("button",{type:"button",className:"inline-flex h-11 min-w-11 items-center justify-center gap-1 rounded-[8px] text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":S("tasks.panelToggleAria"),onClick:()=>L("list"),children:[(0,U.jsx)(fr.A,{className:"h-4 w-4 text-accent","aria-hidden":!0}),(u??d).filter(e=>"done"!==e.status).length?(0,U.jsx)("span",{className:"rounded-full bg-accent/10 px-1 text-[10px] font-bold text-accent",children:(u??d).filter(e=>"done"!==e.status).length}):null]})]})]}),(0,U.jsxs)("div",{className:"relative flex min-h-0 flex-1 flex-col pt-1 pl-[max(0.375rem,env(safe-area-inset-left))] pr-[max(0.375rem,env(safe-area-inset-right))] pb-[max(0.375rem,env(safe-area-inset-bottom))]",children:[et?(0,U.jsxs)("div",{"data-testid":"mobile-focused-pane",className:"flex min-h-0 min-w-0 flex-1 flex-col gap-1",children:[(0,U.jsx)("div",{className:"flex min-h-0 min-w-0 flex-1",children:(0,U.jsx)(g6,{file:et.file,tasks:et.tasks,isRoot:et.isRoot,showFavorite:!0,onClose:()=>b(et.file.path),dragHandle:{onTouchStart:e=>{let t=e.touches[0];t&&(_.current={x:t.clientX,y:t.clientY})},onTouchEnd:e=>{let t=_.current;_.current=null;let n=e.changedTouches[0];if(!t||!n)return;let r=n.clientX-t.x,i=n.clientY-t.y;56>Math.abs(r)||Math.abs(r)<2*Math.abs(i)||ef(r<0?1:-1)}},relatedTasks:ed.get(et.file.path),onOpenTask:ep})}),(N=j?.trays.get(W(et.file)))?(0,U.jsx)(wO,{tray:N,variant:"inline",onToggleExpanded:e=>j.onToggleExpanded(N.parentConversationId,e),onOpenMember:j.onOpenMember,onUnfold:j.onUnfold}):null]},et.file.path):en?(0,U.jsx)("div",{className:"relative min-h-0 flex-1",children:(0,U.jsx)(v6,{flow:en.flow,rounds:en.rounds,focusRound:null,groupLabel:i.find(e=>e.path===en.flow.implementerPath)?.title})},en.key):er?nL(er.id)?(0,U.jsx)(vP,{draftId:er.id,project:e,onClose:()=>v(er.id),onLaunched:()=>v(er.id)},er.key):(0,U.jsx)(bC,{draftId:er.id,project:e,files:i,onClose:()=>v(er.id),onSpawned:e=>w(er.id,e)},er.key):h?ea.length?(0,U.jsx)("div",{className:"flex min-h-0 flex-1 flex-col divide-y divide-border overflow-y-auto",children:ea.map(e=>(0,U.jsx)(wI,{pipeline:e,flows:a,files:i,renderablePaths:el,renderableFlows:eo,linkedTasks:ec.get(e.id)??[],onOpenPath:eu,onOpenFlow:em,onOpenTask:ep},e.id))}):(0,U.jsx)("div",{className:"flex flex-1 items-center justify-center text-center text-[13px] text-muted",children:S("mobile.noConvos")}):(0,U.jsxs)("div",{className:"flex flex-1 items-center justify-center gap-2 text-center text-[13px] text-muted",children:[(0,U.jsx)(sx.kr,{className:"h-4 w-4 animate-spin","aria-hidden":!0}),S("common.loading")]}),et?(0,U.jsx)("div",{"data-testid":"mobile-subagent-rail",className:"pointer-events-none absolute bottom-20 left-2 z-[20]",style:{width:0,height:432},children:(0,U.jsx)(wz,{conversationId:W(et.file),entries:i,cardRect:{x:0,y:0,w:0,h:432},onNavigate:e=>{let t=i.find(t=>t.path===e);t&&g(t)}})}):null]}),T?(0,U.jsxs)("div",{className:"fixed inset-0 z-50 flex flex-col bg-canvas pb-[env(safe-area-inset-bottom)]",children:[(0,U.jsxs)("div",{className:"flex min-h-[52px] shrink-0 items-center gap-2 border-b border-border bg-card px-2 py-1.5",children:[(0,U.jsx)("span",{className:"shrink-0 pl-1 text-[13px] font-bold",children:S("mobile.map")}),(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11.5px] text-muted",children:eb(e,t)}),(0,U.jsx)("div",{role:"group",className:"flex shrink-0 rounded-full border border-border bg-canvas p-0.5","aria-label":S("mobile.mapFrame"),children:["all","current"].map(e=>(0,U.jsx)("button",{type:"button","aria-pressed":R===e,className:`min-h-11 rounded-full px-3 text-[11px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${R===e?"bg-card text-accent shadow-1":"text-muted"}`,onClick:()=>O(e),children:S("all"===e?"mobile.mapAll":"mobile.mapCurrent")},e))}),(0,U.jsx)("button",{type:"button",className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-[8px] border border-border bg-canvas text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":S("mobile.closeMap"),onClick:()=>P(!1),children:(0,U.jsx)(sx.X,{className:"h-5 w-5","aria-hidden":!0})})]}),(0,U.jsx)(wV,{layout:J,tasks:d,workerStacks:c,pipelineOutlines:G,frame:R,ringKey:ee,onPick:eg}),ea.length?(0,U.jsx)(wP,{pipelines:ea,onOpen:()=>E(!0)}):null,(0,U.jsx)("div",{className:"shrink-0 border-t border-border bg-card px-3 py-1.5 text-center text-[11px] text-muted",children:S("mobile.tapNode")})]}):null,$&&ea.length?(0,U.jsx)(wE,{pipelines:ea,render:{flows:a,files:i,renderablePaths:el,renderableFlows:eo,linkedTasksByPipeline:ec,onOpenPath:eu,onOpenFlow:em,onOpenTask:ep},onClose:()=>E(!1)}):null,D?(0,U.jsx)(vZ,{project:e,projectName:t,tasks:u??d,files:i,initialView:D,onClose:()=>L(null)}):null]})}function wZ({pipeline:e,index:t,flows:n,files:r,renderableFlows:i,renderablePaths:a,onHop:s,onOpenPath:l}){let{t:o}=(0,eh.Ym)(),[c,d]=(0,Y.useState)(!1),u=e.stages.length,p=e.stages[t],m=xC(e,p),f=xh[m],h=t>0?e.stages[t-1]:null,x=t<u-1?e.stages[t+1]:null,g=!!h&&!!xT(h,xc(e,h.id),n,i,a,r),b=!!x&&!!xT(x,xc(e,x.id),n,i,a,r),v=xc(e,p.id),w=o(`pipelineChipState.${m}`),y=h?xO(o,h):"",k=h?o(`pipelineChipState.${xC(e,h)}`):"",j=x?xO(o,x):"",N=x?o(`pipelineChipState.${xC(e,x)}`):"",S=x$(e,p,v)||xE(e,p,v,n,a,r),C=!!(v?.flowId&&i.has(v.flowId)),A=!!(v?.agentPath&&a.has(v.agentPath));return(0,U.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5",role:"group","aria-label":o("pipelineMobile.chipAria",{task:e.task}),"data-testid":"mobile-pipeline-focus-row",children:[(0,U.jsxs)("span",{className:"shrink-0 rounded-full bg-sunken px-1.5 py-1 text-[10px] font-bold text-muted","aria-hidden":!0,children:["⇢ ",o("pipelineMobile.position",{k:t+1,n:u})]}),h?(0,U.jsxs)("button",{type:"button",disabled:!g,onClick:()=>s(t-1),"aria-label":o("pipelineMobile.prevStage",{label:y,state:k}),className:"inline-flex h-11 shrink-0 items-center rounded-full border border-border bg-card px-3 text-[11px] font-bold text-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-30",children:["‹ ",xO(o,h)]}):null,(0,U.jsxs)("button",{type:"button",disabled:!S,onClick:()=>d(!0),"aria-haspopup":"dialog","aria-label":o("pipelineMobile.openVerdict",{label:xO(o,p),state:w}),className:"inline-flex h-11 shrink-0 items-center gap-1 rounded-full px-3 text-[11px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:cursor-default",style:{backgroundColor:f.soft,color:f.color},children:[(0,U.jsx)("span",{"aria-hidden":!0,children:"review-loop"===p.kind?"⟳":"▸"}),xO(o,p),xx[m]?(0,U.jsx)("span",{"aria-hidden":!0,children:xx[m]}):null,(0,U.jsx)("span",{className:"text-[9px] font-semibold opacity-80",children:o(`pipelineChipState.${m}`)}),v?.verdict?(0,U.jsx)("span",{"aria-hidden":!0,children:"pass"===v.verdict.status?"✓":"fail"===v.verdict.status?"✕":"●"}):null]}),x?(0,U.jsxs)("button",{type:"button",disabled:!b,onClick:()=>s(t+1),"aria-label":o("pipelineMobile.nextStage",{label:j,state:N}),className:"inline-flex h-11 shrink-0 items-center rounded-full border border-border bg-card px-3 text-[11px] font-bold text-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-30",children:[xO(o,x)," ›"]}):null,c&&v?(0,U.jsx)("div",{className:"fixed inset-0 z-[70] flex items-end justify-center bg-black/40",role:"presentation",onClick:e=>{e.target===e.currentTarget&&d(!1)},children:(0,U.jsxs)("div",{className:"mb-0 w-full max-w-[420px] rounded-t-[16px] bg-card p-3 pb-[max(0.75rem,env(safe-area-inset-bottom))] shadow-2",children:[(0,U.jsx)("div",{className:"mx-auto mb-2 h-1 w-10 rounded-full bg-border","aria-hidden":!0}),(0,U.jsx)(v8,{pipeline:e,stage:p,attempt:v,flows:n,files:r,availablePaths:a,mobile:!0,canOpenFlow:C,canOpenPath:A,onClose:()=>d(!1),onOpenPath:e=>{d(!1),l(e)}})]})}):null]})}function w0({entry:e,active:t,chipRef:n,onClick:r}){let{t:i}=(0,eh.Ym)();if(!e.file){let a="deck"===e.kind;return(0,U.jsxs)("button",{ref:n,type:"button",className:`flex h-11 shrink-0 items-center gap-1 rounded-full border px-3 text-[11px] font-semibold ${t?"border-accent/60 bg-accent/10 text-primary":"border-dashed border-border bg-canvas text-muted"}`,onClick:r,children:[(0,U.jsx)("span",{className:"text-[13px] leading-none text-accent",children:a?"R":"+"})," ",i(a?"scheme.flow":"mobile.agent")]})}let a=e.file,s=tC(a),l="waiting"===s||"stalled"===s,o=(0,tw.yz)(a),c=(0,tw.cr)(a.title,60);return(0,U.jsxs)("button",{ref:n,type:"button",className:`flex h-11 shrink-0 items-center gap-1.5 rounded-full border px-3 text-[11px] font-semibold ${t?"border-accent/60 bg-accent/10 text-primary":l?"border-warning/60 bg-warning-soft text-warning":"border-border bg-canvas text-muted"}`,title:c,onClick:r,children:[(0,U.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${(0,tw.tz)(a.activity)}`}),e.isRoot?null:(0,U.jsx)("span",{"aria-hidden":!0,children:"⤷"}),t?(0,U.jsx)("span",{className:"max-w-[52vw] truncate",children:c}):(0,U.jsxs)("span",{children:[l?"⏸ ":"",o.label]})]})}var w1=n(8617),w2=n(9805);function w5(e){return("claude-projects"===e.root||"codex-sessions"===e.root)&&e.path.endsWith(".jsonl")}function w4({file:e,onHandoff:t,inline:n=!1}){let{t:r}=(0,eh.Ym)(),i=function(e){let{t}=(0,eh.Ym)();return gm({exclude:e.path,onDragStart:void 0,onDrop:n=>(da(W(n.file),t("link.handoffContext",{title:(0,tw.cr)(e.title,80),path:e.path,ask:""}).trimEnd()+"\n\n"),t("link.dropped",{title:(0,tw.cr)(n.file.title,48)}))})}(e);return n?(0,U.jsxs)("span",{"data-scheme-ui":!0,className:"inline-flex shrink-0 pl-1.5",children:[(0,U.jsxs)("button",{type:"button","aria-label":r("handoff.aria"),title:r("handoff.title"),onPointerDown:i.onPillPointerDown,onClick:()=>{i.consumeClick()||t()},className:"flex min-h-11 w-full touch-none items-center justify-center gap-1.5 rounded-[8px] border border-border bg-card text-[12px] font-semibold text-muted shadow-1 hover:border-accent/50 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:[(0,U.jsx)(w1.A,{className:"h-4 w-4 shrink-0","aria-hidden":!0}),r("handoff.label")]}),i.overlay]}):(0,U.jsxs)("div",{"data-scheme-ui":!0,className:"group absolute -bottom-11 left-2 z-[2]",children:[(0,U.jsxs)("button",{type:"button","aria-label":r("handoff.aria"),title:r("handoff.title"),onPointerDown:i.onPillPointerDown,onClick:()=>{i.consumeClick()||t()},className:"flex h-7 touch-none items-center gap-1.5 rounded-full border border-border bg-card px-2 text-muted shadow-1 transition-[border-color,color] duration-150 hover:border-accent/50 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:[(0,U.jsx)(w1.A,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),(0,U.jsx)("span",{className:"max-w-[0px] overflow-hidden whitespace-nowrap text-[11px] font-semibold transition-[max-width] duration-200 group-hover:max-w-[180px] group-focus-within:max-w-[180px]",children:r("handoff.label")}),(0,U.jsx)(w2.A,{className:"hidden h-3.5 w-3.5 shrink-0 group-hover:block group-focus-within:block","aria-hidden":!0})]}),i.overlay]})}var w3=n(1906),w6=n(1285),w8=n(6900),w7=n(5085),w9=n(5367),ye=n(1834);async function yt(e,t,n){let r=[];for(let i of e){try{let e=await t(i);r.push(e.ok?{path:i,ok:!0}:{path:i,ok:!1,error:e.error})}catch(e){r.push({path:i,ok:!1,error:e instanceof Error?e.message:String(e)})}n?.(r,e[r.length]??null)}return r}function yn(e){return null!==e.file.pid}function yr(e){return e.isRoot}let yi={implementer:{engine:"claude",model:null,effort:null},reviewer:{engine:"codex",model:null,effort:"xhigh"}};async function ya(e,t){let n=await fetch(e,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t)});if(n.ok)return{ok:!0};let r=await n.json().catch(()=>null);return{ok:!1,error:r?.error??`HTTP ${n.status}`}}function ys({icon:e,label:t,disabled:n,confirming:r,confirmLabel:i,onClick:a}){return(0,U.jsxs)("button",{className:`inline-flex h-7 items-center gap-1 whitespace-nowrap rounded-full border px-2.5 text-[11px] font-semibold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40 ${r?"border-danger bg-danger text-white":"border-border bg-canvas text-muted hover:border-accent/45 hover:text-accent"}`,disabled:n,onClick:a,children:[e,r?i:t]})}let yl=(0,Y.memo)(function({project:e,nodes:t,flowsByImpl:n,onRemove:r,onFit:i,onExit:a}){let{t:s}=(0,eh.Ym)(),[l,o]=(0,Y.useState)(null),[c,d]=(0,Y.useState)(!0),[u,p]=(0,Y.useState)(null),[m,f]=(0,Y.useState)(null),[h,x]=(0,Y.useState)(!1),g=(0,Y.useRef)(null),b=(0,Y.useRef)(t);(0,Y.useLayoutEffect)(()=>{b.current=t},[t]),(0,Y.useEffect)(()=>{if(!m)return;let e=window.setTimeout(()=>f(null),4e3);return()=>window.clearTimeout(e)},[m]);let v=async(e,n,r)=>{var i,a;if(l||!n.length)return[];o(e),f(null);let c=new Map(u?.titles??[]);for(let e of t)c.set(e.file.path,(0,tw.cr)(e.file.title,60));let d=(i=()=>new Set(b.current.map(e=>e.file.path)),a=s("bulk.nodeGone"),e=>i().has(e)?r(e):Promise.resolve({ok:!1,error:a}));g.current={action:e,runner:d},p({action:e,items:[],current:n[0]??null,titles:c});try{return await yt(n,d,(t,n)=>p({action:e,items:[...t],current:n,titles:c}))}finally{o(null)}},w=sV({initialText:()=>"",persistText:()=>{},submit:async n=>{let r=(n??w.textRef.current).trim(),i=w.attachments.images.map(e=>({base64:e.base64,mime:e.mime}));if((r||i.length)&&!l){w.setBusy(!0);try{let n=new Map(t.map(e=>[e.file.path,e]));if(c){if(!r)return void w.setStatus({kind:"err",text:s("tasks.composerNeedsText")});let t=[];for(let e of w.attachments.images){let n=Uint8Array.from(atob(e.base64),e=>e.charCodeAt(0)),r=await nA(new File([n],"attachment",{type:e.mime}));if("error"in r)return void w.setStatus({kind:"err",text:r.error});t.push(r.attachment)}let i=await nS({project:e,text:r,placement:"pinned",pos:(()=>{let e=b.current;if(!e.length)return{x:120,y:120};let t=0,n=0;for(let r of e)t+=r.x+r.w/2,n+=r.y+r.h/2;return bL({x:Math.round(t/e.length-130),y:Math.round(n/e.length-60)},{w:260,h:140},e)})(),attachments:t,clientRequestId:nN()});if("error"in i)return void w.setStatus({kind:"err",text:i.error});let a=i.task.id,l=await v("message",[...n.keys()],async e=>{let t=await nR(a,[e]);if("error"in t)return{ok:!1,error:t.error};let n=t.results[0];return n?.ok?{ok:!0}:{ok:!1,error:n?.error??s("common.failedSend")}});(!n.size||l.length&&l.every(e=>e.ok))&&(w.setText(""),w.attachments.clear());return}let a=await v("message",[...n.keys()],e=>{let t=n.get(e);return ya("/api/tmux",{pid:t?.file.pid??void 0,path:e,text:r,images:i,origin:{kind:"operator"}})});a.length&&a.every(e=>e.ok)&&(w.setText(""),w.attachments.clear())}finally{w.setBusy(!1)}}},disabled:null!==l}),y=t.filter(yn),k=t.filter(yr),j=t.filter(e=>tn(e.file,n)),N=u?.items.filter(e=>!e.ok).length??0;return(0,U.jsxs)("div",{"data-scheme-ui":!0,className:"absolute bottom-3 left-1/2 z-40 flex w-[640px] max-w-[94%] -translate-x-1/2 flex-col gap-1.5 rounded-[12px] border border-border bg-card/95 p-2.5 shadow-2",children:[h?(0,U.jsx)(yo,{count:j.length,disabled:null!==l,onStart:e=>{x(!1),v("flow",j.map(e=>e.file.path),t=>ya("/api/flows",{implementerPath:t,...e}))},onClose:()=>x(!1)}):null,(0,U.jsx)("form",{onSubmit:e=>{e.preventDefault(),w.submit()},className:"flex flex-col gap-1.5",children:(0,U.jsx)(lC,{composer:w,placeholder:s("bulk.placeholder"),textareaAriaLabel:s("bulk.textAria"),imageAriaLabel:s("composer.addImages"),sendLabelIdle:s("bulk.sendAll",{count:t.length}),sendLabelRecording:s("composer.stopAndSend"),sendTitleRecording:s("composer.stopAndSendTitle"),sendIdleClassName:"border-accent bg-accent hover:opacity-90",leftSlot:(0,U.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5",children:[(0,U.jsx)("span",{className:"inline-flex min-w-0 items-center gap-1 rounded-full bg-sunken px-2 py-1 text-[10px] font-bold text-secondary",children:s("bulk.selectedCount",{count:t.length})}),(0,U.jsxs)("button",{type:"button",role:"switch","aria-checked":c,title:s("tasks.composerToggleTitle"),onClick:()=>d(e=>!e),className:`inline-flex h-6 shrink-0 items-center gap-1 rounded-full border px-2 text-[10px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${c?"border-accent bg-accent/10 text-accent":"border-border bg-card text-muted hover:text-primary"}`,children:[(0,U.jsx)("span",{className:`h-1.5 w-1.5 rounded-full ${c?"bg-accent":"bg-strong"}`,"aria-hidden":!0}),s("tasks.composerToggle")]})]})})}),(0,U.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,U.jsx)(ys,{icon:(0,U.jsx)(w9.A,{className:"h-3.5 w-3.5","aria-hidden":!0}),label:`${s("bulk.interrupt")} ${y.length}/${t.length}`,disabled:null!==l||!y.length,onClick:()=>void v("interrupt",y.map(e=>e.file.path),e=>ya("/api/tmux",{action:"interrupt",path:e}))}),(0,U.jsx)(ys,{icon:(0,U.jsx)(mP.A,{className:"h-3.5 w-3.5","aria-hidden":!0}),label:`${s("bulk.stop")} ${k.length}/${t.length}`,confirming:"kill"===m,confirmLabel:s("bulk.stopConfirm",{count:k.length}),disabled:null!==l||!k.length,onClick:()=>{"kill"!==m?f("kill"):v("kill",k.map(e=>e.file.path),e=>ya("/api/tmux",{action:"kill",path:e}))}}),(0,U.jsx)(ys,{icon:(0,U.jsx)(vW.A,{className:"h-3.5 w-3.5","aria-hidden":!0}),label:`${s("bulk.remove")} ${t.length}`,confirming:"remove"===m,confirmLabel:s("bulk.removeConfirm",{count:t.length}),disabled:null!==l||!t.length,onClick:()=>{if("remove"!==m)return void f("remove");for(let e of t)r(e.file.path);f(null)}}),(0,U.jsx)(ys,{icon:(0,U.jsx)(ye.A,{className:"h-3.5 w-3.5","aria-hidden":!0}),label:`${s("bulk.flow")} ${j.length}/${t.length}`,disabled:null!==l||!j.length,onClick:()=>x(e=>!e)}),(0,U.jsx)(ys,{icon:(0,U.jsx)(w7.A,{className:"h-3.5 w-3.5","aria-hidden":!0}),label:s("bulk.fit"),disabled:!t.length,onClick:i}),(0,U.jsx)("button",{className:"ml-auto inline-flex h-7 w-7 items-center justify-center rounded-full text-muted hover:bg-canvas hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":s("bulk.exit"),title:s("bulk.exit"),onClick:a,children:(0,U.jsx)(K.A,{className:"h-4 w-4","aria-hidden":!0})})]}),u?(0,U.jsxs)("div",{className:"flex max-h-[140px] flex-col gap-0.5 overflow-y-auto rounded-[8px] border border-border bg-canvas/60 p-1.5",children:[u.items.map(e=>(0,U.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5 text-[11px]",children:[e.ok?(0,U.jsx)(uL.A,{className:"h-3.5 w-3.5 shrink-0 text-success","aria-hidden":!0}):(0,U.jsx)(u_.A,{className:"h-3.5 w-3.5 shrink-0 text-danger","aria-hidden":!0}),(0,U.jsx)("span",{className:"min-w-0 shrink-0 truncate font-semibold",style:{maxWidth:"40%"},children:u.titles.get(e.path)??e.path}),e.error?(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate text-danger",children:e.error}):null]},e.path)),u.current?(0,U.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5 text-[11px] text-muted",children:[(0,U.jsx)(dR.A,{className:"h-3.5 w-3.5 shrink-0 animate-spin","aria-hidden":!0}),(0,U.jsx)("span",{className:"min-w-0 truncate font-semibold",children:u.titles.get(u.current)??u.current})]}):null,!l&&N?(0,U.jsxs)("button",{className:"mt-1 inline-flex h-6 items-center gap-1 self-start rounded-full border border-border bg-card px-2 text-[10.5px] font-semibold text-muted hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>{let e=u?.items.filter(e=>!e.ok).map(e=>e.path)??[],t=g.current;e.length&&t&&v(t.action,e,t.runner)},children:[(0,U.jsx)(sg.A,{className:"h-3 w-3","aria-hidden":!0}),s("bulk.retryFailed",{count:N})]}):null]}):null]})});function yo({count:e,disabled:t,onStart:n,onClose:r}){let{t:i}=(0,eh.Ym)(),[a,s]=(0,Y.useState)([]),[l,o]=(0,Y.useState)(null),[c,d]=(0,Y.useState)("auto"),[u,p]=(0,Y.useState)(5);return(0,Y.useEffect)(()=>{let e=!1;return fetch("/api/flows").then(e=>e.json()).then(t=>{!e&&Array.isArray(t.presets)&&t.presets.length&&(s(t.presets),o(e=>e??t.presets[0].name))}).catch(()=>{}),()=>{e=!0}},[]),(0,U.jsxs)("div",{className:"absolute bottom-[calc(100%+8px)] left-1/2 flex w-[420px] max-w-[94%] -translate-x-1/2 flex-col gap-2 rounded-[12px] border border-border bg-card p-2.5 shadow-2",onKeyDown:e=>{"Escape"===e.key&&r()},children:[(0,U.jsx)("span",{className:"text-[12px] font-bold",children:i("bulk.flowTitle",{count:e})}),(0,U.jsxs)("div",{className:"grid grid-cols-3 gap-2",children:[(0,U.jsxs)("label",{className:"col-span-3 flex flex-col gap-1 text-[10.5px] font-semibold text-muted",children:[i("flowDialog.preset"),(0,U.jsx)("select",{value:l??"",className:"h-8 rounded-[8px] border border-border bg-canvas px-2 text-[12px] font-normal text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:e=>o(e.target.value||null),children:a.length?a.map(e=>(0,U.jsx)("option",{value:e.name,children:e.name},e.name)):(0,U.jsx)("option",{value:"",children:i("flowDialog.effortDefault")})})]}),(0,U.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-muted",children:[i("flowDialog.transitions"),(0,U.jsxs)("select",{value:c,className:"h-8 rounded-[8px] border border-border bg-canvas px-2 text-[11.5px] font-normal text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:e=>d(e.target.value),children:[(0,U.jsx)("option",{value:"auto",children:i("flowDialog.auto")}),(0,U.jsx)("option",{value:"manual",children:i("flowDialog.manual")})]})]}),(0,U.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-muted",children:[i("flowDialog.roundLimit"),(0,U.jsx)("input",{type:"number",min:1,max:20,value:u,className:"h-8 rounded-[8px] border border-border bg-canvas px-2 text-[11.5px] font-normal text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:e=>p(Math.max(1,Math.min(20,Number(e.target.value)||5)))})]}),(0,U.jsxs)("div",{className:"flex items-end justify-end gap-1.5",children:[(0,U.jsx)("button",{className:"h-8 rounded-[8px] border border-border bg-canvas px-2 text-[11px] font-semibold text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:r,children:i("common.cancel")}),(0,U.jsx)("button",{className:"h-8 rounded-[8px] border border-accent bg-accent px-2.5 text-[11.5px] font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40",disabled:t||!e,onClick:()=>n({...l?{preset:l}:{roles:yi},baseMode:"head",mode:c,reviewerMode:"headless",roundLimit:u}),children:i("bulk.flowStart",{count:e})})]})]})]})}let yc=new Set;function yd(e){return!e.supersededBy&&("live"===e.activity||"stalled"===e.activity||"running"===e.proc||!!e.pendingQuestion||!!e.waitingInput)}function yu(e){return e.pipeline?"closed"!==e.pipeline.state||!!e.pipeline.restored:!!e.flow&&("closed"!==e.flow.state||!!e.flow.restored)}function yp(e){if(!e.length)return null;let t=1/0,n=1/0,r=-1/0,i=-1/0;for(let a of e)t=Math.min(t,a.x),n=Math.min(n,a.y),r=Math.max(r,a.x+a.w),i=Math.max(i,a.y+a.h);return{x:t,y:n,w:r-t,h:i-n}}function ym(e,t,n,r=yc){let i=[];for(let t of e.nodes)(yd(t.file)||t.isRoot&&n.has(W(t.file)))&&i.push(t);for(let t of e.groups)yu(t)&&i.push(t);for(let n of(i.push(...e.drafts),t))"done"!==n.status&&b_(n)&&i.push(bB(n,r.has(n.id)));return i}let yf=(e,t)=>e.x<t.x+t.w&&e.x+e.w>t.x&&e.y<t.y+t.h&&e.y+e.h>t.y,yh=["top","right","bottom","left"],yx=e=>"right"===e?"translate(-100%, -50%)":"left"===e?"translate(0, -50%)":"bottom"===e?"translate(-50%, -100%)":"translate(-50%, 0)",yg=()=>"function"==typeof window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;function yb({chip:e,onFit:t}){let n,r=(0,Y.useRef)(null),[i,a]=(0,Y.useState)(0),[s,l]=(0,Y.useState)(!1),[o,c]=(0,Y.useState)(!1),d=s||o,u=e.revealWidth;return(0,U.jsxs)("button",{type:"button","data-edge-chip":e.cluster.key,className:"pointer-events-auto absolute inline-flex min-h-11 items-center gap-1.5 rounded-full border border-border bg-card/95 px-3 text-[11px] font-bold text-primary shadow-1 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",style:{left:e.x,top:e.y,transform:yx(e.edge),maxWidth:u},title:e.cluster.label,onClick:()=>t(e.cluster.rect),onPointerEnter:()=>{yg()&&c(!0)},onPointerMove:e=>(e=>{if(d||yg())return;let t=r.current;!t||t.scrollWidth-t.clientWidth>1&&e>=t.getBoundingClientRect().right-18&&a(e=>Math.min(e+1,24))})(e.clientX),onPointerLeave:()=>{a(0),c(!1)},onFocus:()=>l(!0),onBlur:()=>l(!1),children:[(0,U.jsxs)("span",{"data-edge-chip-control":!0,className:"flex shrink-0 items-center gap-1.5","aria-hidden":!0,children:[(0,U.jsx)("span",{className:"h-2 w-2 rounded-full",style:{backgroundColor:e.cluster.color}}),(0,U.jsx)("span",{children:"right"===(n=e.edge)?"→":"left"===n?"←":"bottom"===n?"↓":"↑"})]}),(0,U.jsx)("span",{ref:r,"data-edge-chip-title":!0,"data-reveal":d?"full":String(i),className:"block min-w-0 overflow-hidden text-ellipsis whitespace-nowrap transition-[max-width] duration-150 ease-out motion-reduce:transition-none",style:{maxWidth:d?void 0:`${Math.min(120+72*i,u)}px`},children:e.cluster.label})]})}function yv({edge:e,rows:t,open:n,onToggle:r,onClose:i,onFit:a,anchor:s,vp:l}){let{t:o}=(0,eh.Ym)(),c=(0,Y.useRef)(null),d=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{if(!n)return;let e=e=>{e.target instanceof Node&&c.current?.contains(e.target)||i()};return document.addEventListener("pointerdown",e),()=>document.removeEventListener("pointerdown",e)},[n,i]);let{x:u,y:p}=s,m=`edge-chip-overflow-${e}`,f=function(e,t,n){let{x:r,y:i}=t,a=(e,t,n)=>Math.max(t,Math.min(e,Math.max(t,n)));if("left"===e||"right"===e){let t=Math.min(256,Math.max(0,n.h-16)),s={top:a(i-t/2,8,n.h-8-t)-i,maxHeight:t};return"left"===e?{left:52,width:Math.max(0,Math.min(220,n.w-8-(r+52))),...s}:{right:52,width:Math.max(0,Math.min(220,r-52-8)),...s}}let s=Math.max(0,Math.min(260,n.w-16)),l={left:a(r-s/2,8,n.w-8-s)-r,width:s};return"top"===e?{top:52,maxHeight:Math.max(0,n.h-8-(i+52)),...l}:{bottom:52,maxHeight:Math.max(0,i-52-8),...l}}(e,s,l);return(0,U.jsxs)("div",{ref:c,className:"pointer-events-auto absolute",style:{left:u,top:p},onKeyDown:e=>{"Escape"===e.key&&n&&(e.stopPropagation(),i(),d.current?.focus())},children:[(0,U.jsxs)("button",{ref:d,type:"button",className:"absolute left-0 top-0 flex min-h-11 min-w-11 items-center justify-center rounded-full border border-border bg-card px-2 text-[11px] font-bold text-accent shadow-1 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",style:{transform:yx(e)},"aria-expanded":n,"aria-controls":n?m:void 0,"aria-label":o("scheme.offscreenMore",{count:t.length}),onClick:r,children:["+",t.length]}),n?(0,U.jsx)("div",{id:m,"data-overflow-list":e,className:"absolute z-10 flex flex-col gap-1 overflow-y-auto rounded-[10px] border border-border bg-card p-1 shadow-2",style:{left:f.left,right:f.right,top:f.top,bottom:f.bottom,width:f.width,maxHeight:f.maxHeight},children:t.map(e=>(0,U.jsxs)("button",{type:"button","data-overflow-chip":e.cluster.key,className:"flex min-h-11 items-center gap-2 rounded-[8px] px-2 text-left text-[11px] font-semibold text-primary hover:bg-canvas focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>{a(e.cluster.rect),i()},children:[(0,U.jsx)("span",{className:"h-2 w-2 shrink-0 rounded-full",style:{backgroundColor:e.cluster.color},"aria-hidden":!0}),(0,U.jsx)("span",{className:"truncate",children:e.cluster.label})]},e.cluster.key))}):null]})}function yw({clusters:e,cam:t,vp:n,hidden:r,obstacles:i=[],onFit:a}){let{t:s}=(0,eh.Ym)(),l=(0,hy.O)(),o=ia(),c=(0,Y.useMemo)(()=>{let e=null;if("u">typeof document)try{let t=document.createElement("canvas").getContext("2d");if(t&&"function"==typeof t.measureText){let n=("function"==typeof getComputedStyle&&document.body?getComputedStyle(document.body).fontFamily:"")||"system-ui, sans-serif";t.font=`700 11px ${n}`,t.measureText("MMMMM").width>0&&(e=t)}}catch{e=null}return t=>Math.ceil(e?e.measureText(t).width:7*t.length)+68},[]),d=(0,Y.useMemo)(()=>(function(e,t,n,r=4,i=[],a=()=>520){let s={x:-t.x/t.z,y:-t.y/t.z,w:n.w/t.z,h:n.h/t.z},l=e.filter(e=>!yf(e.rect,s)).sort((e,t)=>t.priority-e.priority||e.key.localeCompare(t.key)),o=[],c=[],d=new Map;for(let e of l){let s=function(e,t,n){let r=(e.x+e.w/2)*t.z+t.x,i=(e.y+e.h/2)*t.z+t.y,a=n.w/2,s=n.h/2,l=r-a,o=i-s,c=0===l?1/0:n.w/2/Math.abs(l),d=0===o?1/0:n.h/2/Math.abs(o);if(c<=d){let e=l>=0?"right":"left";return{edge:e,x:"right"===e?n.w-22:22,y:Math.max(22,Math.min(n.h-22,s+o*c))}}let u=o>=0?"bottom":"top";return{edge:u,x:Math.max(22,Math.min(n.w-22,a+l*d)),y:"bottom"===u?n.h-22:22}}(e.rect,t,n),l=Math.max(0,a(e.label)),u=function(e,t,n,r=520){return Math.max(0,Math.min(Math.max(0,r),"right"===e?t-22:"left"===e?n.w-22-t:2*Math.min(t-22,n.w-22-t)))}(s.edge,s.x,n,l),p={cluster:e,...s,revealWidth:u},m=d.get(p.edge)??0,f=u>=l,h="left"===p.edge?{x:p.x,y:p.y-22,w:l,h:44}:"right"===p.edge?{x:p.x-l,y:p.y-22,w:l,h:44}:"top"===p.edge?{x:p.x-l/2,y:p.y,w:l,h:44}:{x:p.x-l/2,y:p.y-44,w:l,h:44};m<r&&f&&!i.some(e=>yf(h,e))?(o.push(p),d.set(p.edge,m+1)):c.push(p)}return{visible:o,overflow:c}})(e,t,n,4,i,c),[e,t,n,i,c]),u=(0,Y.useMemo)(()=>{let e=new Map;for(let t of d.overflow){let n=e.get(t.edge)??[];n.push(t),e.set(t.edge,n)}let t=new Map;for(let[r,a]of e){let e=function(e,t,n=[]){for(let r of[e,...yh.filter(t=>t!==e)]){let e=function(e,t,n=[]){let r="left"===e||"right"===e,i="left"===e?10:"right"===e?t.w-10:t.w/2,a="top"===e?10:"bottom"===e?t.h-10:t.h/2,s=e=>r?{x:i,y:e}:{x:e,y:a},l=r=>!n.some(n=>yf("left"===e?{x:10,y:r-22,w:44,h:44}:"right"===e?{x:t.w-10-44,y:r-22,w:44,h:44}:"top"===e?{x:r-22,y:10,w:44,h:44}:{x:r-22,y:t.h-10-44,w:44,h:44},n)),o=r?t.h:t.w,c=o/2,d=32,u=o-22-10;if(l(c))return s(c);for(let e=24;e<=o;e+=24)for(let t of[c-e,c+e])if(t>=d&&t<=u&&l(t))return s(t);return null}(r,t,n);if(e)return{edge:r,x:e.x,y:e.y}}return null}(r,n,i);if(!e)continue;let s=t.get(e.edge);s?s.rows.push(...a):t.set(e.edge,{anchor:{x:e.x,y:e.y},rows:[...a]})}return t},[d.overflow,n,i]),[p,m]=(0,Y.useState)(null);return r||l||o||!d.visible.length&&!d.overflow.length?null:(0,U.jsxs)("nav",{"data-scheme-ui":!0,"aria-label":s("scheme.offscreenNav"),className:"pointer-events-none absolute inset-0 z-[39]",children:[d.visible.map(e=>(0,U.jsx)(yb,{chip:e,onFit:a},e.cluster.key)),[...u].map(([e,{anchor:t,rows:r}])=>(0,U.jsx)(yv,{edge:e,rows:r,anchor:t,vp:n,open:p===e,onToggle:()=>m(t=>t===e?null:e),onClose:()=>m(null),onFit:a},e))]})}function yy(e,t){return e.filter(e=>e.x<=t.x+t.w&&e.x+e.w>=t.x&&e.y<=t.y+t.h&&e.y+e.h>=t.y).map(e=>e.file.path)}let yk=new Set,yj={flow:"var(--color-accent)",pipeline:"var(--color-accent)",origin:"var(--color-muted)",worktree:"var(--color-strong)"};function yN({layout:e,world:t,tasks:n=[],textExpandedIds:r=yk,currentWork:i=null,pipelineGroups:a=[],stackDots:s=[],cam:l,vp:o,onJump:c}){let d,u,p,m,f,h,{t:x}=(0,eh.Ym)(),g=(0,Y.useRef)(null),b=(0,Y.useRef)(!1),v=(d=-l.x/l.z,u=-l.y/l.z,p=o.w/l.z,m=o.h/l.z,f=Math.min(t.x,d),h=Math.min(t.y,u),{x:f,y:h,w:Math.max(t.x+t.w,d+p)-f,h:Math.max(t.y+t.h,u+m)-h}),w=Math.min(216/v.w,148/v.h),y=(216-v.w*w)/2,k=(148-v.h*w)/2,j=e=>{let t=g.current?.getBoundingClientRect();t&&c((e.clientX-t.left-y)/w+v.x,(e.clientY-t.top-k)/w+v.y)};return(0,U.jsxs)("div",{ref:g,"data-scheme-ui":!0,className:"absolute bottom-3 right-3 z-40 cursor-pointer overflow-hidden rounded-[10px] border border-border bg-card/95 shadow-1",style:{width:216,height:148},title:x("minimap.title"),onPointerDown:e=>{e.stopPropagation(),b.current=!0,j(e);try{e.currentTarget.setPointerCapture(e.pointerId)}catch{}},onPointerMove:e=>{b.current&&j(e)},onPointerUp:e=>{b.current=!1;try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}},onPointerCancel:()=>{b.current=!1},children:[(0,U.jsx)("svg",{width:216,height:148,"aria-hidden":!0,children:(0,U.jsxs)("g",{transform:`translate(${y-v.x*w} ${k-v.y*w}) scale(${w})`,children:[e.stacks.map(e=>(0,U.jsx)("circle",{cx:e.x+e.w/2,cy:e.y+e.h/2,r:7/w,fill:"var(--color-muted)",opacity:.6},e.key)),e.drafts.map(e=>(0,U.jsx)("rect",{x:e.x,y:e.y,width:e.w,height:e.h,rx:18,fill:"var(--color-muted)",opacity:.3},e.key)),e.decks.map(e=>(0,U.jsx)("rect",{x:e.x,y:e.y,width:e.w,height:e.h,rx:18,fill:"var(--color-accent)",opacity:.3},e.key)),e.groups.filter(e=>"pipeline"===e.kind).map(e=>(0,U.jsx)("rect",{"data-minimap-pipeline":e.id,x:e.x,y:e.y,width:e.w,height:e.h,rx:18,fill:`hsl(${e.hue} 62% 42% / 0.08)`,stroke:`hsl(${e.hue} 62% 42%)`,strokeWidth:2/w,children:(0,U.jsx)("title",{children:e.label})},e.key)),a.map(({pipeline:e,rect:t})=>(0,U.jsx)("rect",{"data-minimap-pipeline":e.id,x:t.x,y:t.y,width:t.w,height:t.h,rx:10,fill:"var(--color-accent-soft)",stroke:"draft"===e.state?"var(--color-warning)":"var(--color-accent)",strokeDasharray:"draft"===e.state?`${6/w} ${4/w}`:void 0,strokeWidth:2/w,opacity:.8,children:(0,U.jsx)("title",{children:e.task})},e.id)),e.nodes.map(e=>(0,U.jsx)("rect",{x:e.x,y:e.y,width:e.w,height:e.h,rx:18,fill:(0,tw.yj)(e.file),opacity:"live"===e.file.activity?.85:.35},e.file.path)),n.map(e=>(0,U.jsx)("circle",{cx:e.pos.x+130,cy:e.pos.y+bH(e,r.has(e.id))/2,r:3/w,fill:gV[e.status].color,opacity:"done"===e.status?.5:.95},e.id)),i?(0,U.jsx)("rect",{"data-minimap-current-work":"true",x:i.x,y:i.y,width:i.w,height:i.h,rx:14,fill:"none",stroke:"var(--color-warning)",strokeDasharray:`${7/w} ${5/w}`,strokeWidth:2/w,opacity:.8}):null,(0,U.jsx)("rect",{x:-l.x/l.z,y:-l.y/l.z,width:o.w/l.z,height:o.h/l.z,fill:"color-mix(in srgb, var(--color-accent) 8%, transparent)",stroke:"var(--color-accent)",strokeWidth:2.5/w})]})}),s.length?(0,U.jsx)("div",{className:"pointer-events-none absolute bottom-1 left-1 flex max-h-[70%] max-w-[150px] flex-wrap content-end items-center gap-[3px]",title:x("minimap.stacks",{count:s.length}),"aria-hidden":!0,children:s.map(e=>(0,U.jsx)("span",{className:`shrink-0 rounded-full ${s.length>24?"h-1 w-1":"h-1.5 w-1.5"}`,style:{backgroundColor:e.color}},e.key))}):null]})}let yS={implementer:{engine:"claude",model:null,effort:null},reviewer:{engine:"codex",model:null,effort:"xhigh"}};function yC({label:e,role:t,onChange:n}){let{t:r}=(0,eh.Ym)(),i=(0,Y.useId)();return(0,U.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,U.jsx)("span",{className:"w-[86px] shrink-0 text-[10.5px] font-semibold text-muted",children:e}),(0,U.jsxs)("select",{value:t.engine,"aria-label":r("flowDialog.engine",{label:e}),className:"h-7 rounded-[8px] border border-border bg-canvas px-1.5 text-[11.5px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:e=>n({...t,engine:e.target.value,effort:null}),children:[(0,U.jsx)("option",{value:"claude",children:"Claude"}),(0,U.jsx)("option",{value:"codex",children:"Codex"})]}),(0,U.jsx)("input",{value:t.model??"",list:i,placeholder:r("flowDialog.modelPlaceholder"),"aria-label":r("flowDialog.model",{label:e}),className:"h-7 w-0 min-w-0 flex-1 rounded-[8px] border border-border bg-canvas px-1.5 font-mono text-[11px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:e=>n({...t,model:e.target.value.trim()||null})}),(0,U.jsx)("datalist",{id:i,children:ow[t.engine].map(e=>(0,U.jsx)("option",{value:e.id,children:e.label},e.id))}),(0,U.jsxs)("select",{value:t.effort??"","aria-label":`Reasoning effort: ${e}`,className:"h-7 rounded-[8px] border border-border bg-canvas px-1.5 text-[11.5px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:e=>n({...t,effort:e.target.value||null}),children:[(0,U.jsx)("option",{value:"",children:r("flowDialog.effortDefault")}),of.Lw[t.engine].map(e=>(0,U.jsx)("option",{value:e,children:e},e))]})]})}function yA({file:e,onClose:t}){let{t:n}=(0,eh.Ym)(),[r,i]=(0,Y.useState)([]),[a,s]=(0,Y.useState)(null),[l,o]=(0,Y.useState)(yS),[c,d]=(0,Y.useState)(!1),[u,p]=(0,Y.useState)("head"),[m,f]=(0,Y.useState)("auto"),[h,x]=(0,Y.useState)("headless"),[g,b]=(0,Y.useState)(5),[v,w]=(0,Y.useState)(""),[y,k]=(0,Y.useState)(!1),[j,N]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{let e=!1;return fetch("/api/flows").then(e=>e.json()).then(t=>{!e&&Array.isArray(t.presets)&&t.presets.length&&(i(t.presets),s(e=>e??t.presets[0].name),o({implementer:t.presets[0].implementer,reviewer:t.presets[0].reviewer}))}).catch(()=>{}),()=>{e=!0}},[]);let S=async()=>{if(!y){k(!0),N(null);try{let r=await fetch("/api/flows",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({implementerPath:e.path,...c||!a?{roles:l}:{preset:a},baseMode:u,mode:m,reviewerMode:h,roundLimit:g,...v.trim()?{spec:v.trim()}:{}})});if(!r.ok){let e=await r.json().catch(()=>null);N(e?.error??n("flowDialog.createFailed",{status:r.status}));return}t()}catch{N(n("common.serverUnavailable"))}finally{k(!1)}}};return(0,U.jsxs)("div",{"data-scheme-ui":!0,className:"flex w-[420px] flex-col gap-2.5 rounded-[12px] border border-border bg-card p-3 shadow-2",onKeyDown:e=>{"Escape"===e.key&&t()},children:[(0,U.jsxs)("div",{className:"flex items-center gap-2",children:[(0,U.jsx)("span",{className:"text-[12.5px] font-bold",children:n("flowDialog.title")}),(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate text-[10.5px] text-muted",children:n("flowDialog.subtitle")})]}),r.length?(0,U.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-muted",children:[n("flowDialog.preset"),(0,U.jsx)("select",{value:a??"",className:"h-8 rounded-[8px] border border-border bg-canvas px-2 text-[12px] font-normal text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:e=>{var t;let n;return s(t=e.target.value),void((n=r.find(e=>e.name===t))&&o({implementer:n.implementer,reviewer:n.reviewer}))},children:r.map(e=>(0,U.jsx)("option",{value:e.name,children:e.name},e.name))})]}):null,(0,U.jsx)("button",{className:"self-start text-[10.5px] font-semibold text-muted hover:text-accent focus-visible:outline-none","aria-expanded":c,onClick:()=>d(e=>!e),children:c?n("flowDialog.rolesManualOpen"):n("flowDialog.rolesManual")}),c?(0,U.jsxs)("div",{className:"flex flex-col gap-1.5 rounded-[10px] border border-dashed border-border bg-canvas/50 p-2",children:[(0,U.jsx)(yC,{label:n("flowDialog.implementer"),role:l.implementer,onChange:e=>o(t=>({...t,implementer:e}))}),(0,U.jsx)(yC,{label:n("flowDialog.reviewer"),role:l.reviewer,onChange:e=>o(t=>({...t,reviewer:e}))})]}):null,(0,U.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-muted",children:[n("flowDialog.spec"),(0,U.jsx)("textarea",{value:v,rows:4,placeholder:n("flowDialog.specPlaceholder"),className:"resize-y rounded-[8px] border border-border bg-canvas px-2 py-1.5 text-[11.5px] font-normal text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:e=>w(e.target.value)})]}),(0,U.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,U.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-muted",children:[n("flowDialog.diffBase"),(0,U.jsxs)("select",{value:u,className:"h-8 rounded-[8px] border border-border bg-canvas px-2 text-[11.5px] font-normal text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:e=>p(e.target.value),children:[(0,U.jsx)("option",{value:"head",children:n("flowDialog.fromHead")}),(0,U.jsx)("option",{value:"merge-base",children:n("flowDialog.fromMergeBase")})]})]}),(0,U.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-muted",children:[n("flowDialog.reviewer"),(0,U.jsxs)("select",{value:h,className:"h-8 rounded-[8px] border border-border bg-canvas px-2 text-[11.5px] font-normal text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:e=>x(e.target.value),children:[(0,U.jsx)("option",{value:"headless",children:n("flowDialog.headless")}),(0,U.jsx)("option",{value:"pane",children:n("flowDialog.tmuxPane")})]})]}),(0,U.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-muted",children:[n("flowDialog.transitions"),(0,U.jsxs)("select",{value:m,className:"h-8 rounded-[8px] border border-border bg-canvas px-2 text-[11.5px] font-normal text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:e=>f(e.target.value),children:[(0,U.jsx)("option",{value:"auto",children:n("flowDialog.auto")}),(0,U.jsx)("option",{value:"manual",children:n("flowDialog.manual")})]})]}),(0,U.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-muted",children:[n("flowDialog.roundLimit"),(0,U.jsx)("input",{type:"number",min:1,max:20,value:g,className:"h-8 rounded-[8px] border border-border bg-canvas px-2 text-[11.5px] font-normal text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:e=>b(Math.max(1,Math.min(20,Number(e.target.value)||5)))})]})]}),(0,U.jsxs)("div",{className:"flex items-center gap-2",children:[j?(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate text-[10.5px] font-semibold text-danger",children:j}):(0,U.jsx)("span",{className:"flex-1"}),(0,U.jsx)("button",{className:"rounded-[8px] border border-border bg-canvas px-2.5 py-1.5 text-[11.5px] font-semibold text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:t,children:n("common.cancel")}),(0,U.jsx)("button",{className:"rounded-[8px] border border-accent bg-accent px-3 py-1.5 text-[12px] font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40",disabled:y,onClick:()=>void S(),children:y?n("flowDialog.creating"):n("flowDialog.start")})]})]})}let yI={waiting:"var(--color-muted)",running:"var(--color-accent)",awaiting_verdict:"var(--color-accent)",attention:"var(--color-warning)",paused:"var(--color-warning)",done:"var(--color-success)"};function yM({flow:e,x:t,y:n,interactive:r,moveTransition:i}){let{locale:a,t:s}=(0,eh.Ym)(),l=s6(e.id),o=l?{...l,block:e.block}:e,[c,d]=(0,Y.useState)(!1),[u,p]=(0,Y.useState)(!1),[m,f]=(0,Y.useState)(null),h=yI[x7(o.state)],x=x9(o)?.n??0,g=ta(s,o,a),b=g.label,v=x>0?s("flowHub.aria",{n:x,state:b}):s("flowHub.ariaNoRound",{state:b}),w=g.pending,y="closed"===o.state||"approved"===o.state,k=async e=>{if(u)return;p(!0),f(null);let t=await td(o.id,{action:e});t?f(t):"close"===e&&d(!1),p(!1)};return(0,U.jsxs)("div",{className:`absolute left-0 top-0 ${c?"z-30":"z-[5]"} ${r?"":"pointer-events-none"}`,style:{transform:`translate(${t}px, ${n}px)`,transition:i},onKeyDown:e=>{"Escape"===e.key&&c&&(e.stopPropagation(),d(!1))},children:[(0,U.jsxs)("button",{"data-scheme-ui":!0,className:"absolute inline-flex h-[34px] -translate-x-1/2 -translate-y-1/2 items-center gap-1 whitespace-nowrap rounded-full border-2 bg-card px-2.5 shadow-1 hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",style:{borderColor:h,color:h},title:v,"aria-label":v,"aria-expanded":c,onClick:()=>d(e=>!e),children:[(0,U.jsx)("span",{className:"text-[15px] font-bold leading-none","aria-hidden":!0,children:"⟳"}),x>0?(0,U.jsxs)("span",{className:"text-[11px] font-bold",children:["R",x]}):null]}),c?(0,U.jsxs)("div",{"data-scheme-ui":!0,"aria-label":s("flowHub.controls"),className:"absolute bottom-[27px] left-0 z-30 flex w-[230px] -translate-x-1/2 flex-col gap-1.5 rounded-[12px] border border-border bg-card p-2.5 shadow-2",children:[(0,U.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[(0,U.jsx)("span",{className:"h-2 w-2 shrink-0 rounded-full",style:{backgroundColor:h},"aria-hidden":!0}),(0,U.jsx)("span",{className:"shrink-0 text-[11.5px] font-bold",children:b}),g.detail?(0,U.jsx)("span",{className:"min-w-0 truncate text-[10.5px] font-semibold text-muted",title:g.detail,children:g.detail}):null,u?(0,U.jsx)(dO.A,{className:"ml-auto h-3 w-3 shrink-0 animate-spin text-muted","aria-hidden":!0}):null]}),m?(0,U.jsx)("span",{className:"truncate text-[10.5px] font-semibold text-danger",title:m,children:m}):null,w?(0,U.jsx)("button",{className:"rounded-full border border-accent bg-accent px-3 py-1 text-[11px] font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40",disabled:u,onClick:()=>void k(w.action),children:s(w.labelKey)}):null,"reviewing"===o.state?(0,U.jsxs)("button",{className:"inline-flex items-center justify-center gap-1 rounded-full border border-danger/40 bg-danger-soft px-3 py-1 text-[11px] font-bold text-danger hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:u,title:s("flowStrip.stopReviewerTitle"),onClick:()=>void k("cancel-round"),children:[(0,U.jsx)(mP.A,{className:"h-3 w-3","aria-hidden":!0})," ",s("flowStrip.stopReviewer")]}):null,(0,U.jsxs)("span",{className:"flex items-center gap-1.5",children:[y?null:"paused"===o.state?(0,U.jsxs)("button",{className:"inline-flex flex-1 items-center justify-center gap-1 rounded-full border border-success/40 bg-success-soft px-3 py-1 text-[11px] font-bold text-success hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:u,onClick:()=>void k("resume"),children:[(0,U.jsx)(wf.A,{className:"h-3 w-3","aria-hidden":!0})," ",s("flowStrip.resume")]}):(0,U.jsxs)("button",{className:"inline-flex flex-1 items-center justify-center gap-1 rounded-full border border-border bg-canvas px-3 py-1 text-[11px] font-bold text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:u,onClick:()=>void k("pause"),children:[(0,U.jsx)(fb.A,{className:"h-3 w-3","aria-hidden":!0})," ",s("flowStrip.pause")]}),(0,U.jsxs)("button",{className:"inline-flex flex-1 items-center justify-center gap-1 rounded-full border border-border bg-canvas px-3 py-1 text-[11px] font-bold text-muted hover:text-danger focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:u,onClick:()=>void k("close"),children:[(0,U.jsx)(K.A,{className:"h-3 w-3","aria-hidden":!0})," ",s("flowStrip.close")]})]})]}):null]})}let yT={draft:"var(--color-warning)",provisioning:"var(--color-accent)",running:"var(--color-accent)",needs_decision:"var(--color-warning)",paused:"var(--color-warning)",completed:"var(--color-success)",closed:"var(--color-muted)"};function yP({pipeline:e,x:t,y:n,interactive:r,moveTransition:i}){let{t:a}=(0,eh.Ym)(),[s,l]=(0,Y.useState)(!1),[o,c]=(0,Y.useState)(!1),[d,u]=(0,Y.useState)(null),p=(0,Y.useRef)(null),m=(0,Y.useRef)(null),f=(0,Y.useRef)(!1);(0,Y.useEffect)(()=>{s?(m.current?.focus(),f.current=!0):f.current&&(p.current?.focus(),f.current=!1)},[s]);let h=yT[e.state],x=e.stages.length,g=e.cursor?.stageId??e.stages.at(-1)?.id??null,b=g?e.stages.findIndex(e=>e.id===g):-1,v=b>=0?e.stages[b]:null,w=v?xO(a,v):e.id,y=b>=0?b+1:x,k=g?xc(e,g):null,j="completed"===e.state||"closed"===e.state,N="needs_decision"===e.state,S=async t=>{if(o)return;c(!0),u(null);let n=await x4(e.id,t);n?u(n):"close"===t&&l(!1),c(!1)};return(0,U.jsxs)("div",{className:`absolute left-0 top-0 ${s?"z-30":"z-[5]"} ${r?"":"pointer-events-none"}`,style:{transform:`translate(${t}px, ${n}px)`,transition:i},onKeyDown:e=>{"Escape"===e.key&&s&&(e.stopPropagation(),l(!1))},children:[(0,U.jsxs)("button",{ref:p,"data-scheme-ui":!0,className:"absolute inline-flex h-[30px] -translate-x-1/2 -translate-y-1/2 items-center gap-1 whitespace-nowrap rounded-full border-2 bg-card px-2.5 text-[10.5px] font-bold shadow-1 hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",style:{borderColor:h,color:h},"aria-label":a("pipelineHub.aria",{task:e.task,stage:w,k:y,n:x}),"aria-expanded":s,"aria-haspopup":"dialog",onClick:()=>l(e=>!e),children:[(0,U.jsx)("span",{"aria-hidden":!0,children:"paused"===e.state?"⏸":"⇢"}),(0,U.jsx)("span",{className:"max-w-[120px] truncate",children:a("pipelineHub.stageOf",{stage:w,k:y,n:x})})]}),s?(0,U.jsxs)("div",{ref:m,"data-scheme-ui":!0,role:"dialog",tabIndex:-1,"aria-label":a("pipelineHub.controls"),className:"absolute bottom-[24px] left-0 z-30 flex w-[224px] -translate-x-1/2 flex-col gap-1.5 rounded-[12px] border border-border bg-card p-2.5 shadow-2 focus-visible:outline-none",children:[(0,U.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[(0,U.jsx)("span",{className:"h-2 w-2 shrink-0 rounded-full",style:{backgroundColor:h},"aria-hidden":!0}),(0,U.jsx)("span",{className:"shrink-0 text-[11.5px] font-bold",children:xu(a,e.state)}),o?(0,U.jsx)(dO.A,{className:"ml-auto h-3 w-3 shrink-0 animate-spin text-muted","aria-hidden":!0}):null]}),(0,U.jsxs)("span",{className:"min-w-0 truncate text-[10.5px] font-semibold text-muted",children:[a("pipelineHub.stageOf",{stage:w,k:y,n:x}),k&&k.n>1?` \xb7 ${a("pipelineHub.attempt",{n:k.n})}`:""]}),e.stateDetail?(0,U.jsx)("span",{className:"truncate text-[10px] font-semibold text-warning",title:e.stateDetail,children:e.stateDetail}):null,d?(0,U.jsx)("span",{className:"truncate text-[10.5px] font-semibold text-danger",title:d,children:d}):null,N?(0,U.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,U.jsx)("button",{className:"flex-1 rounded-full border border-accent bg-accent px-3 py-1 text-[11px] font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40",disabled:o,onClick:()=>void S("retry-stage"),children:a("pipelineStrip.retryStage")}),(0,U.jsx)("button",{className:"rounded-full border border-border bg-canvas px-2.5 py-1 text-[10.5px] font-bold text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:o,onClick:()=>void S("skip-stage"),children:a("pipelineStrip.skipStage")})]}):null,(0,U.jsxs)("span",{className:"flex items-center gap-1.5",children:[j?null:"paused"===e.state?(0,U.jsxs)("button",{className:"inline-flex flex-1 items-center justify-center gap-1 rounded-full border border-success/40 bg-success-soft px-3 py-1 text-[11px] font-bold text-success hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:o,onClick:()=>void S("resume"),children:[(0,U.jsx)(wf.A,{className:"h-3 w-3","aria-hidden":!0})," ",a("pipelineStrip.resume")]}):(0,U.jsxs)("button",{className:"inline-flex flex-1 items-center justify-center gap-1 rounded-full border border-border bg-canvas px-3 py-1 text-[11px] font-bold text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:o,onClick:()=>void S("pause"),children:[(0,U.jsx)(fb.A,{className:"h-3 w-3","aria-hidden":!0})," ",a("pipelineStrip.pause")]}),(0,U.jsxs)("button",{className:"inline-flex flex-1 items-center justify-center gap-1 rounded-full border border-border bg-canvas px-3 py-1 text-[11px] font-bold text-muted hover:text-danger focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:o,onClick:()=>void S("close"),children:[(0,U.jsx)(K.A,{className:"h-3 w-3","aria-hidden":!0})," ",a("pipelineStrip.close")]})]})]}):null]})}var y$=n(9751);function yE({slot:e,onOpen:t}){let{t:n}=(0,eh.Ym)(),{pipeline:r,stage:i,attempt:a}=e,s=xC(r,i),l=xh[s],o=xD(n,i,e.index,e.total),c="review-loop"===i.kind,d=(0,tw.t7)(i.effectiveRole.engine),u=i.effectiveRole.model??"",p=(ow[i.effectiveRole.engine].find(e=>e.id===u)?.label??u)||n("draft.modelDefault"),m=i.effectiveRole.effort?d_(n,i.effectiveRole.effort):"",f=a?.verdict??null,h=wg(r,i,i.effectiveRole,"[The previous stage output was inserted here]");return(0,U.jsxs)("section",{"data-pipeline-stage-card":`${r.id}::${i.id}`,"data-pipeline-stage-state":s,"data-pipeline-stage-completed":"true","aria-label":n("pipelineSlot.completedAria",{title:o}),className:"relative flex h-full min-h-0 min-w-0 flex-1 flex-col overflow-hidden rounded-control border-2 bg-card shadow-1",style:{borderColor:l.color},children:[(0,U.jsx)("span",{"aria-hidden":!0,className:"h-1 w-full shrink-0 opacity-60",style:{backgroundColor:d.color}}),(0,U.jsxs)("header",{className:"flex h-10 shrink-0 items-center gap-1.5 border-b border-border px-2.5",style:{backgroundColor:d.soft},children:[(0,U.jsx)("span",{className:"h-2 w-2 shrink-0 rounded-full",style:{backgroundColor:l.color},title:n(`pipelineChipState.${s}`)}),(0,U.jsx)("span",{className:"shrink-0 rounded-full border border-border bg-card/70 px-1.5 py-0.5 text-caption font-bold capitalize text-muted",children:i.effectiveRole.engine}),(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate text-ui font-semibold text-muted",title:o,children:o}),(0,U.jsx)("span",{className:"shrink-0 rounded-full border border-border bg-card/70 px-1.5 py-0.5 text-caption font-bold uppercase tracking-wide text-muted",children:c?`⟳ ${n("groupOverride.reviewKind")}`:n("groupOverride.runKind")})]}),(0,U.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden px-4 py-3",children:[(0,U.jsxs)("div",{className:"mb-3 flex items-center justify-between gap-2",children:[(0,U.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,U.jsx)("span",{className:"rounded-full px-3 py-1 text-body font-bold",style:{backgroundColor:l.soft,color:l.color},children:a?xR(n,a.state):n(`pipelineChipState.${s}`)}),f?(0,U.jsx)("span",{className:"rounded-full px-2 py-1 text-label font-bold",style:{backgroundColor:xH[f.status].soft,color:xH[f.status].color},children:xU(n,f.status)}):null]}),(0,U.jsxs)("span",{className:"truncate text-label font-semibold text-muted",title:`${p}${m?` \xb7 ${m}`:""}`,children:[p,m?` \xb7 ${m}`:""]})]}),(0,U.jsxs)("div",{className:"ml-auto max-w-[88%] min-h-0 overflow-hidden rounded-[14px] rounded-br-[4px] bg-accent/10 px-3 py-2.5 text-ui leading-5 text-primary shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--color-accent)_18%,transparent)]",children:[(0,U.jsx)("p",{className:"mb-1 text-caption font-bold uppercase tracking-wide text-accent",children:n("pipelineSlot.promptLabel")}),(0,U.jsx)("p",{className:"line-clamp-[12] whitespace-pre-wrap break-words",children:h})]}),(0,U.jsxs)("button",{type:"button","data-scheme-ui":!0,className:"mt-auto inline-flex h-8 items-center justify-center gap-1 self-center rounded-control border border-border bg-canvas px-3 text-label font-bold text-muted hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:!t,onClick:()=>t?.(),children:[(0,U.jsx)(y$.A,{className:"h-3.5 w-3.5","aria-hidden":!0}),n("pipelineSlot.openTranscript")]})]})]})}function yR({slot:e,expanded:t,controls:n,onToggle:r}){let{t:i}=(0,eh.Ym)(),{pipeline:a,stage:s,attempt:l}=e,o=xC(a,s),c=xh[o],d=xD(i,s,e.index,e.total),u=function(e,t,n,r=function(e,t){return xc(e,t)}(t,n.id)){let i=xq(r?.error);if(i)return i;let a=xq(r?.verdict?.findings?.[0]);if(a)return`${xU(e,r.verdict.status)} — ${a}`;if(r?.state==="skipped")return e("pipelineSlot.reasonSkipped");let s=xq(r?.output);return s||(r?.verdict?xU(e,r.verdict.status):r?xR(e,r.state):e(`pipelineChipState.${xC(t,n)}`))}(i,a,s,l??xc(a,s.id));return(0,U.jsxs)("section",{"data-pan-ignore":!0,"data-pipeline-stage-card":t?void 0:`${a.id}::${s.id}`,"data-pipeline-stage-state":o,"data-pipeline-stage-row":"true","aria-label":i("pipelineSlot.rowAria",{title:d}),className:"flex h-full min-h-0 min-w-0 flex-col justify-center gap-1 overflow-hidden rounded-control border bg-card px-3 py-2 shadow-1",style:{borderColor:"var(--border-strong)"},children:[(0,U.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,U.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-full px-2 py-0.5 text-label font-bold",style:{backgroundColor:c.soft,color:c.color},children:[(0,U.jsx)("span",{"aria-hidden":!0,children:xx[o]}),i(`pipelineChipState.${o}`)]}),(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate text-ui font-semibold text-secondary",title:d,children:d}),r?(0,U.jsx)("button",{type:"button","data-scheme-ui":!0,"data-stage-row-toggle":!0,"aria-expanded":t,"aria-controls":n,"aria-label":i(t?"pipelineSlot.rowCollapse":"pipelineSlot.rowExpand"),title:i(t?"pipelineSlot.rowCollapse":"pipelineSlot.rowExpand"),className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-control border border-border bg-canvas text-muted hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:r,children:(0,U.jsx)(i3.A,{className:`h-3.5 w-3.5 transition-transform ${t?"rotate-90":""}`,"aria-hidden":!0})}):null]}),(0,U.jsx)("p",{className:"min-w-0 truncate text-label text-muted",title:u,children:u})]})}var yO=n(529);let yD=new Set(["spawning","reviewing","relaying","fixing"]),yL=[1,2,3,4,5,0];function y_({flow:e,onFocusRound:t}){let{locale:n,t:r}=(0,eh.Ym)(),i=s6(e.id),a=i?{...i,block:e.block}:e,[s,l]=(0,Y.useState)(!1),[o,c]=(0,Y.useState)(null),[d,u]=(0,Y.useState)(""),p=async(e,t)=>{if(s)return;l(!0),c(null);let n=await td(a.id,{action:e,...t});n?c(n):t?.note!==void 0&&u(""),l(!1)},m=ta(r,a,n),f=m.pending,h=m.attention,x="closed"===a.state||"approved"===a.state,g=!!f&&("waiting_ready"===a.state||"needs_decision"===a.state);return(0,U.jsxs)("div",{"data-scheme-ui":!0,className:`pointer-events-auto flex h-11 w-full items-center gap-3 rounded-[14px] border bg-card/95 px-4 shadow-1 ${h?"border-warning/70":"border-border"}`,children:[(0,U.jsxs)("span",{className:"flex min-w-0 max-w-[38%] shrink-0 items-center gap-2",children:[(0,U.jsx)("span",{className:`h-2.5 w-2.5 shrink-0 rounded-full ${a.block?"bg-danger":"approved"===a.state?"bg-success":"needs_decision"===a.state?"bg-danger":"paused"===a.state?"bg-warning":yD.has(a.state)?"bg-success animate-pulse":"bg-muted"}`,"aria-hidden":!0}),(0,U.jsx)("span",{className:"shrink-0 text-label font-semibold text-secondary",children:r("flowStrip.flow")}),(0,U.jsx)("span",{className:"shrink-0 text-[12px] font-bold",children:m.label}),m.detail?(0,U.jsx)("span",{className:"min-w-0 truncate text-[11.5px] font-semibold text-muted",title:m.detail,children:m.detail}):null]}),(0,U.jsx)("span",{className:"no-scrollbar flex min-w-0 flex-1 items-center justify-center gap-1.5 overflow-x-auto","aria-label":r("flowStrip.roundsAria"),children:a.rounds.map((e,n)=>{let i=tc(e.verdict),a=null===e.verdict&&!e.error;return(0,U.jsxs)("span",{className:"flex shrink-0 items-center gap-1.5",children:[n>0?(0,U.jsx)("span",{className:"text-[10px] font-bold text-strong","aria-hidden":!0,children:"→"}):null,(0,U.jsxs)("button",{className:`inline-flex h-6 items-center gap-1 rounded-full px-2 text-[10.5px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${a?"animate-pulse":""}`,style:{backgroundColor:i.soft,color:i.color},title:e.error?r("flowStrip.roundError",{n:e.n,error:e.error}):e.verdict?r("flowStrip.roundVerdict",{n:e.n,verdict:e.verdict})+(null!=e.findingsCount?` \xb7 ${r("roundDeck.findings",{count:e.findingsCount})}`:""):r("flowStrip.roundInProgress",{n:e.n}),onClick:()=>t?.(e.n),children:["R",e.n,(0,U.jsx)(v5,{verdict:e.verdict,error:!!e.error}),null!=e.findingsCount&&e.findingsCount>0?(0,U.jsx)("span",{children:e.findingsCount}):null]})]},e.n)})}),(0,U.jsxs)("span",{className:"flex shrink-0 items-center gap-1.5",children:[o?(0,U.jsx)("span",{className:"max-w-[220px] truncate text-[10.5px] font-semibold text-danger",title:o,children:o}):null,s?(0,U.jsx)(dO.A,{className:"h-3.5 w-3.5 shrink-0 animate-spin text-muted","aria-hidden":!0}):null,g?(0,U.jsx)(ly,{label:r("flowStrip.noteTitle"),children:(0,U.jsx)("input",{className:"w-40 shrink-0 rounded-full border border-border bg-canvas px-2.5 py-1 text-[10.5px] font-medium text-primary placeholder:text-muted/70 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",value:d,placeholder:r("flowStrip.notePlaceholder"),onChange:e=>u(e.target.value),onKeyDown:e=>{"Enter"===e.key&&f&&p(f.action,{note:d})}})}):null,"reviewing"===a.state?(0,U.jsx)(ly,{label:r("flowStrip.stopReviewerTitle"),children:(0,U.jsxs)("button",{className:"inline-flex h-6 shrink-0 items-center gap-1 rounded-full border border-danger/40 bg-danger-soft px-2.5 text-[10.5px] font-bold text-danger hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:s,onClick:()=>void p("cancel-round"),children:[(0,U.jsx)(mP.A,{className:"h-3 w-3","aria-hidden":!0})," ",r("flowStrip.stopReviewer")]})}):null,f?(0,U.jsx)("button",{className:"shrink-0 rounded-full border border-accent bg-accent px-3 py-1 text-[11px] font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40",disabled:s,onClick:()=>void p(f.action,g?{note:d}:void 0),children:r(f.labelKey)}):null,x?null:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(ly,{label:r("flowStrip.limitTitle"),children:(0,U.jsxs)("span",{className:"flex shrink-0 items-center gap-0.5 rounded-full border border-border bg-canvas p-0.5",children:[yL.map(e=>{let t=a.roundLimit===e,n=0!==e&&e<a.rounds.length;return(0,U.jsx)("button",{className:`inline-flex h-5 min-w-5 items-center justify-center rounded-full px-1 text-[10px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-30 ${t?"bg-accent text-white":"text-muted hover:bg-card hover:text-primary"}`,disabled:s||n,"aria-label":0===e?r("flowStrip.limitUnlimitedAria"):r("flowStrip.limitAria",{count:e}),"aria-pressed":t,onClick:()=>void p("set-round-limit",{rounds:e}),children:0===e?(0,U.jsx)(yO.A,{className:"h-3 w-3","aria-hidden":!0}):e},e)}),yL.includes(a.roundLimit)?null:(0,U.jsx)("span",{className:"inline-flex h-5 min-w-5 items-center justify-center rounded-full bg-accent px-1 text-[10px] font-bold text-white",children:a.roundLimit})]})}),(0,U.jsx)(ly,{label:"auto"===a.mode?r("flowStrip.autoTitle"):r("flowStrip.manualTitle"),children:(0,U.jsx)("button",{className:`shrink-0 rounded-full border px-2.5 py-1 text-[10px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40 ${"auto"===a.mode?"border-success/40 bg-success-soft text-success":"border-border bg-canvas text-muted hover:text-primary"}`,disabled:s,onClick:()=>void p("set-mode",{mode:"auto"===a.mode?"manual":"auto"}),children:"auto"===a.mode?r("flowDialog.auto"):r("flowStrip.manualShort")})}),"paused"===a.state?(0,U.jsx)(ly,{label:r("flowStrip.resume"),children:(0,U.jsx)("button",{className:"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-success hover:bg-canvas focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:s,"aria-label":r("flowStrip.resume"),onClick:()=>void p("resume"),children:(0,U.jsx)(wf.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})}):(0,U.jsx)(ly,{label:r("flowStrip.pause"),children:(0,U.jsx)("button",{className:"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-muted hover:bg-canvas hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:s,"aria-label":r("flowStrip.pause"),onClick:()=>void p("pause"),children:(0,U.jsx)(fb.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})})]}),(0,U.jsx)(ly,{label:r("flowStrip.close"),children:(0,U.jsx)("button",{className:"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-muted hover:bg-canvas hover:text-danger focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:s,"aria-label":r("flowStrip.close"),onClick:()=>void p("close"),children:(0,U.jsx)(K.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})})]})]})}function yF({role:e,active:t}){let{t:n}=(0,eh.Ym)();return(0,U.jsxs)("div",{className:`pointer-events-none absolute -top-3 left-4 z-[12] flex h-6 items-center gap-1.5 rounded-full border px-2.5 shadow-1 ${t?"border-success/50 bg-success-soft":"border-border bg-card"}`,children:[(0,U.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${t?"animate-pulse bg-success":"bg-strong"}`,"aria-hidden":!0}),(0,U.jsx)("span",{className:`text-[10px] font-bold tracking-[0.06em] ${t?"text-success":"text-primary"}`,children:n("implementer"===e?"scheme.roleImplementer":"scheme.roleReviewer")}),(0,U.jsx)("span",{className:`text-[10px] font-semibold ${t?"text-success":"text-muted"}`,children:n(t?"scheme.roleWorking":"scheme.roleWaiting")})]})}let yq={pending:"border-warning/45 bg-warning-soft text-warning",switching:"border-accent/45 bg-accent-soft text-accent",failed:"border-danger/40 bg-danger-soft text-danger"};function yz({file:e,showSettled:t=!0,fontClassName:n="text-[9.5px]"}){let{t:r}=(0,eh.Ym)(),i=function(e){if("claude"!==e.engine&&"codex"!==e.engine)return null;let t=ll(e.path),n=lu(e.migration,t),r=lc(n);return"pending"===r||"switching"===r||"failed"===r?{kind:r,target:ld(n),source:n?.sourceLabel?.trim()||t}:{kind:"settled",accountId:t}}(e);if(!i)return null;if("settled"===i.kind){if(!t||i.accountId===la)return null;let e=gt(i.accountId);return(0,U.jsxs)("span",{"data-card-switch":"settled",className:`inline-flex min-w-0 shrink items-center gap-1 rounded-full border border-border/80 px-1.5 py-0.5 font-mono ${n} text-muted`,title:r("branch.accountAria",{id:i.accountId}),children:[(0,U.jsx)("span",{"aria-hidden":!0,className:"h-1.5 w-1.5 shrink-0 rounded-full",style:{backgroundColor:`color-mix(in srgb, hsl(${e} 60% 50%) 85%, var(--color-card))`}}),(0,U.jsxs)("span",{className:"truncate",children:["@ ",function(e,t=14){return e.length>t?`${e.slice(0,t-1)}…`:e}(i.accountId)]})]})}let a="failed"===i.kind?r("cardSwitch.failed"):i.target?r("pending"===i.kind?"cardSwitch.pendingTo":"cardSwitch.switchingTo",{label:i.target}):r("pending"===i.kind?"cardSwitch.pending":"cardSwitch.switching"),s="pending"===i.kind?r("migrate.cardPending"):"failed"===i.kind?r("migrate.cardFailed"):i.target?r("migrate.cardSwitching",{label:i.target}):r("migrate.cardSwitchingUnnamed"),l=i.source&&i.target?`${r("cardSwitch.route",{from:i.source,to:i.target})} — ${s}`:s;return(0,U.jsxs)("span",{"data-card-switch":i.kind,className:`inline-flex min-w-0 shrink items-center gap-1 rounded-full border px-1.5 py-0.5 font-bold ${n} ${yq[i.kind]}`,title:l,"aria-label":l,children:[(0,U.jsx)("span",{"aria-hidden":!0,className:"shrink-0",children:"⇄"}),(0,U.jsx)("span",{className:"truncate",children:a})]})}function yH({file:e,fontClassName:t="text-[9.5px]"}){let n=(0,tw.yz)(e);return e.model?(0,U.jsx)("span",{className:`min-w-0 truncate rounded-full px-1.5 py-0.5 font-mono font-semibold ${t}`,style:{backgroundColor:(0,tw.oC)(e).soft,color:(0,tw.oC)(e).color},title:[n.label,(0,tw.$)(e)].filter(Boolean).join(" \xb7 "),children:e.model}):(0,U.jsx)("span",{className:`shrink-0 rounded-full px-1.5 py-0.5 font-bold ${t}`,style:n.style,title:(0,tw.$)(e),children:n.label})}var yU=n(5618);let yB="text-label font-semibold text-secondary",yK="h-7 w-full rounded-[8px] border border-border bg-canvas px-2 text-[11.5px] font-semibold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",yY="inline-flex items-center justify-center gap-1 rounded-full border border-accent bg-accent px-3 py-1 text-[11px] font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40",yW="inline-flex flex-1 items-center justify-center gap-1 rounded-full border border-border bg-canvas px-3 py-1 text-[11px] font-bold text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40";function yV({pipeline:e,onClose:t,label:n=e.task}){let{t:r}=(0,eh.Ym)(),i="draft"===e.state,[a,s]=(0,Y.useState)(!1),[l,o]=(0,Y.useState)(null),[c,d]=(0,Y.useState)(null),[u,p]=(0,Y.useState)(e.task),[m,f]=(0,Y.useState)(e.spec??""),[h,x]=(0,Y.useState)(e.repoDir),g="completed"===e.state||"closed"===e.state,b="needs_decision"===e.state,v=e.stages.some(t=>(e.runs.find(e=>e.stageId===t.id)?.attempts.length??0)===0),w=async(e,t)=>{if(a)return;s(!0),o(null),d(null);let n=await t();n?o(n):d(e),s(!1)};return(0,U.jsxs)("div",{"data-scheme-ui":!0,"data-group-override":"pipeline","data-pipeline-editor":e.id,role:"dialog","aria-label":n,className:"flex max-h-[calc(100vh-24px)] w-[min(320px,calc(100vw-24px))] flex-col gap-2 overflow-y-auto rounded-[12px] border border-border bg-card p-3 shadow-2",children:[(0,U.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12px] font-bold",children:r(i?"groupOverride.draftTitle":"groupOverride.pipelineTitle",{name:n})}),(0,U.jsx)("button",{className:"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full border border-border bg-canvas text-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":r("groupOverride.closePanel"),onClick:t,children:(0,U.jsx)(K.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),l?(0,U.jsx)("span",{role:"alert",className:"text-[10.5px] font-semibold text-danger",children:l}):null,c?(0,U.jsx)("span",{className:"text-[10.5px] font-semibold text-success",children:c}):null,i?(0,U.jsxs)("div",{className:"flex flex-col gap-1.5 rounded-[9px] border border-dashed border-warning/60 bg-warning-soft p-2",children:[(0,U.jsxs)("label",{className:"flex flex-col gap-1",children:[(0,U.jsx)("span",{className:yB,children:r("groupOverride.task")}),(0,U.jsx)("input",{className:yK,value:u,onChange:e=>p(e.target.value)})]}),(0,U.jsxs)("label",{className:"flex flex-col gap-1",children:[(0,U.jsx)("span",{className:yB,children:r("groupOverride.spec")}),(0,U.jsx)("textarea",{className:"min-h-[52px] w-full resize-y rounded-[8px] border border-border bg-canvas px-2 py-1.5 text-[11.5px] font-semibold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",value:m,onChange:e=>f(e.target.value)})]}),(0,U.jsxs)("label",{className:"flex flex-col gap-1",children:[(0,U.jsx)("span",{className:yB,children:r("groupOverride.repoDir")}),(0,U.jsx)("input",{className:yK,value:h,onChange:e=>x(e.target.value)})]}),(0,U.jsx)("button",{className:yY,disabled:a||!u.trim()||!h.trim(),onClick:()=>void w(r("groupOverride.savedDraft"),()=>x4(e.id,"update-draft",{task:u,spec:m,repoDir:h})),children:r("groupOverride.saveDraft")})]}):null,!g&&v?(0,U.jsxs)("div",{"data-pipeline-editor-canvas-hint":!0,className:"flex items-start gap-1.5 rounded-[9px] border border-border bg-sunken px-2 py-1.5 text-[10.5px] font-semibold text-muted",children:[(0,U.jsx)(yU.A,{className:"mt-[1px] h-3.5 w-3.5 shrink-0 text-accent","aria-hidden":!0}),(0,U.jsx)("span",{children:r("groupOverride.editStagesOnCanvas")})]}):null,b?(0,U.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,U.jsx)("button",{className:yY+" flex-1",disabled:a,onClick:()=>void w(r("pipelineStrip.retryStage"),()=>x4(e.id,"retry-stage")),children:r("pipelineStrip.retryStage")}),(0,U.jsx)("button",{className:yW,disabled:a,onClick:()=>void w(r("pipelineStrip.skipStage"),()=>x4(e.id,"skip-stage")),children:r("pipelineStrip.skipStage")})]}):null,(0,U.jsxs)("div",{className:"flex items-center gap-1.5",children:[i?(0,U.jsxs)("button",{className:"inline-flex min-h-11 flex-1 items-center justify-center gap-1 rounded-full border border-accent bg-accent px-3 text-[11px] font-bold text-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40",disabled:a||e.stages.length<1,title:e.stages.length<1?r("groupOverride.startNeedsStages"):void 0,onClick:()=>void w(r("pipelineStrip.start"),()=>x4(e.id,"start")),children:[(0,U.jsx)(wf.A,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",r("pipelineStrip.start")]}):g?null:"paused"===e.state?(0,U.jsxs)("button",{className:"inline-flex flex-1 items-center justify-center gap-1 rounded-full border border-success/40 bg-success-soft px-3 py-1 text-[11px] font-bold text-success focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:a,onClick:()=>void w(r("pipelineStrip.resume"),()=>x4(e.id,"resume")),children:[(0,U.jsx)(wf.A,{className:"h-3 w-3","aria-hidden":!0})," ",r("pipelineStrip.resume")]}):(0,U.jsxs)("button",{className:yW,disabled:a,onClick:()=>void w(r("pipelineStrip.pause"),()=>x4(e.id,"pause")),children:[(0,U.jsx)(fb.A,{className:"h-3 w-3","aria-hidden":!0})," ",r("pipelineStrip.pause")]}),(0,U.jsxs)("button",{className:"inline-flex flex-1 items-center justify-center gap-1 rounded-full border border-border bg-canvas px-3 py-1 text-[11px] font-bold text-muted hover:text-danger focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:a,onClick:()=>void w(r(i?"pipelineStrip.discard":"pipelineStrip.close"),()=>x4(e.id,i?"delete":"close")),children:[(0,U.jsx)(K.A,{className:"h-3 w-3","aria-hidden":!0})," ",r(i?"pipelineStrip.discard":"pipelineStrip.close")]})]})]})}let yJ=["claude","codex"];function yG({group:e,onClose:t}){return e.pipeline?(0,U.jsx)(yV,{pipeline:e.pipeline,label:e.label,onClose:t}):(0,U.jsx)("div",{"data-scheme-ui":!0,"data-group-override":e.kind,role:"dialog","aria-label":e.label,className:"flex w-[268px] flex-col gap-2 rounded-[12px] border border-border bg-card p-3 shadow-2",children:e.flow?(0,U.jsx)(y4,{group:e,onClose:t}):null})}function yQ({title:e,onClose:t}){let{t:n}=(0,eh.Ym)();return(0,U.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12px] font-bold",children:e}),(0,U.jsx)("button",{className:"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full border border-border bg-canvas text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":n("groupOverride.closePanel"),onClick:t,children:(0,U.jsx)(K.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})]})}let yX="text-label font-semibold text-secondary",yZ="h-7 w-full rounded-[8px] border border-border bg-canvas px-2 text-[11.5px] font-semibold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",y0="inline-flex items-center justify-center gap-1 rounded-full border border-accent bg-accent px-3 py-1 text-[11px] font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40",y1="inline-flex flex-1 items-center justify-center gap-1 rounded-full border border-border bg-canvas px-3 py-1 text-[11px] font-bold text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40";function y2({engine:e,value:t,onChange:n,label:r}){let{t:i}=(0,eh.Ym)(),a=of.Lw[e],s=t&&a.includes(t)?t:"";return(0,U.jsxs)("label",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[(0,U.jsx)("span",{className:yX,children:r}),(0,U.jsxs)(dF,{className:"w-full",value:s,onChange:e=>n(e.target.value),children:[(0,U.jsx)("option",{value:"",children:i("groupOverride.effortDefault")}),a.map(e=>(0,U.jsx)("option",{value:e,children:d_(i,e)},e))]})]})}function y5({value:e,onChange:t}){let{t:n}=(0,eh.Ym)();return(0,U.jsxs)("label",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[(0,U.jsx)("span",{className:yX,children:n("groupOverride.engine")}),(0,U.jsx)(dF,{className:"w-full",value:e,onChange:e=>t(e.target.value),children:yJ.map(e=>(0,U.jsx)("option",{value:e,children:e},e))})]})}function y4({group:e,onClose:t}){let{locale:n,t:r}=(0,eh.Ym)(),i=e.flow,a=i.roles.reviewer,[s,l]=(0,Y.useState)(a.engine),[o,c]=(0,Y.useState)(a.model??""),[d,u]=(0,Y.useState)(a.effort??""),[p,m]=(0,Y.useState)(i.rounds.at(-1)?.readyNote??""),f=i.rounds.at(-1)?.n??0,[h,x]=(0,Y.useState)(f);h!==f&&(x(f),m(i.rounds.at(-1)?.readyNote??""));let[g,b]=(0,Y.useState)(String(i.roundLimit)),[v,w]=(0,Y.useState)(!1),[y,k]=(0,Y.useState)(null),[j,N]=(0,Y.useState)(null),S="closed"===i.state||"approved"===i.state,C=ta(r,i,n).pending,A=C?.action==="advance"&&("waiting_ready"===i.state||"spawn_pending"===i.state)||C?.action==="retry-round",I=async(e,t)=>{if(v)return;w(!0),k(null),N(null);let n=await t();n?k(n):N(e),w(!1)};return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(yQ,{title:r("groupOverride.flowTitle",{name:e.label}),onClose:t}),y?(0,U.jsx)("span",{className:"truncate text-[10.5px] font-semibold text-danger",title:y,children:y}):null,j?(0,U.jsx)("span",{className:"truncate text-[10.5px] font-semibold text-success",children:j}):null,(0,U.jsx)("span",{className:"text-[10.5px] font-bold text-primary",children:r("groupOverride.reviewerRole")}),(0,U.jsxs)("div",{className:"flex items-end gap-1.5",children:[(0,U.jsx)(y5,{value:s,onChange:e=>{var t;(t={setEngine:l,setModel:c,setEffort:u,effort:d}).setEngine(e),t.setModel(""),t.effort&&!of.Lw[e].includes(t.effort)&&t.setEffort("")}}),(0,U.jsx)(y2,{engine:s,value:d,onChange:u,label:r("groupOverride.effort")})]}),(0,U.jsxs)("label",{className:"flex flex-col gap-1",children:[(0,U.jsx)("span",{className:yX,children:r("groupOverride.model")}),(0,U.jsx)("input",{className:yZ,value:o,placeholder:r("groupOverride.modelPlaceholder"),onChange:e=>c(e.target.value)})]}),(0,U.jsx)("button",{className:y0,disabled:v||S,onClick:()=>void I(r("groupOverride.savedReviewer"),()=>td(i.id,{action:"set-roles",roles:{reviewer:{engine:s,model:o.trim()||null,effort:d||null}}})),children:r("groupOverride.applyRole")}),(0,U.jsxs)("label",{className:"flex flex-col gap-1",children:[(0,U.jsx)("span",{className:yX,children:r("groupOverride.nextRoundNote")}),(0,U.jsx)("textarea",{className:"min-h-[52px] w-full resize-y rounded-[8px] border border-border bg-canvas px-2 py-1.5 text-[11.5px] font-semibold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:cursor-not-allowed disabled:opacity-50",value:p,placeholder:r("groupOverride.notePlaceholder"),disabled:!A||v,onChange:e=>m(e.target.value)}),A?null:(0,U.jsx)("span",{className:"text-[10px] font-semibold text-muted",children:r("groupOverride.noteUnavailable")})]}),(0,U.jsxs)("div",{className:"flex items-end gap-1.5",children:[(0,U.jsxs)("label",{className:"flex w-[86px] flex-col gap-1",children:[(0,U.jsx)("span",{className:yX,children:r("groupOverride.roundLimit")}),(0,U.jsx)("input",{className:yZ,type:"number",min:0,max:50,value:g,onChange:e=>b(e.target.value)})]}),(0,U.jsx)("button",{className:y1,disabled:v||S,onClick:()=>void I(r("groupOverride.savedLimit"),()=>td(i.id,{action:"set-round-limit",rounds:Math.max(0,Math.min(50,Number(g)||0))})),children:r("groupOverride.setLimit")}),(0,U.jsx)("button",{className:y1,disabled:v||S,onClick:()=>void I(r("groupOverride.savedExtend"),()=>td(i.id,{action:"extend",rounds:1})),children:r("groupOverride.extend")})]}),(0,U.jsxs)("div",{className:"flex items-center gap-1.5",children:[C?(0,U.jsxs)("button",{className:y0+" flex-1",disabled:v,onClick:()=>void I("retry-round"===C.action?r("groupOverride.savedRetry"):r(C.labelKey),()=>td(i.id,{action:C.action,...A?{note:p.trim()}:{}})),children:[(0,U.jsx)(dO.A,{className:"h-3 w-3","aria-hidden":!0})," ",r(C.labelKey)]}):null,"reviewing"===i.state?(0,U.jsxs)("button",{className:"inline-flex flex-1 items-center justify-center gap-1 rounded-full border border-danger/40 bg-danger-soft px-3 py-1 text-[11px] font-bold text-danger hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:v,onClick:()=>void I(r("groupOverride.savedCancel"),()=>td(i.id,{action:"cancel-round"})),children:[(0,U.jsx)(mP.A,{className:"h-3 w-3","aria-hidden":!0})," ",r("flowStrip.stopReviewer")]}):null]}),(0,U.jsxs)("div",{className:"flex items-center gap-1.5",children:[S?null:"paused"===i.state?(0,U.jsxs)("button",{className:"inline-flex flex-1 items-center justify-center gap-1 rounded-full border border-success/40 bg-success-soft px-3 py-1 text-[11px] font-bold text-success hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:v,onClick:()=>void I(r("flowStrip.resume"),()=>td(i.id,{action:"resume"})),children:[(0,U.jsx)(wf.A,{className:"h-3 w-3","aria-hidden":!0})," ",r("flowStrip.resume")]}):(0,U.jsxs)("button",{className:y1,disabled:v,onClick:()=>void I(r("flowStrip.pause"),()=>td(i.id,{action:"pause"})),children:[(0,U.jsx)(fb.A,{className:"h-3 w-3","aria-hidden":!0})," ",r("flowStrip.pause")]}),(0,U.jsxs)("button",{className:"inline-flex flex-1 items-center justify-center gap-1 rounded-full border border-border bg-canvas px-3 py-1 text-[11px] font-bold text-muted hover:text-danger focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:v,onClick:()=>void I(r("flowStrip.close"),()=>td(i.id,{action:"close"})),children:[(0,U.jsx)(K.A,{className:"h-3 w-3","aria-hidden":!0})," ",r("flowStrip.close")]})]})]})}function y3(e,t){return[...e].sort((e,n)=>t(e).localeCompare(t(n)))}let y6=[],y8=new Map;function y7(e,t){if(e===t)return!0;if(e.size!==t.size)return!1;for(let[n,r]of e)if(t.get(n)!==r)return!1;return!0}let y9="cubic-bezier(.22,.8,.36,1)",ke=`transform 380ms ${y9}`,kt=`left 380ms ${y9}, top 380ms ${y9}, width 380ms ${y9}, height 380ms ${y9}, transform 380ms ${y9}`,kn=1/0,kr=(0,Y.memo)(function({edges:e,badgeAnchors:t,badgeAnchorRevision:n=0,width:r,height:i}){return(0,U.jsx)("svg",{width:r,height:i,className:"absolute left-0 top-0","aria-hidden":!0,children:e.map(e=>{let n=e.sourceConversationId&&e.targetConversationId?t?.anchorFor(e.sourceConversationId,e.targetConversationId)??null:null,r=n?.x??e.x1,i=n?.y??e.y1,a=Math.max(36,(e.y2-i)*.5),s=`M ${r} ${i} C ${r} ${i+a}, ${e.x2} ${e.y2-a}, ${e.x2} ${e.y2-7}`,l=`M ${e.x2-5} ${e.y2-9} L ${e.x2+5} ${e.y2-9} L ${e.x2} ${e.y2-1} Z`,o=e.via?.length??0;return(0,U.jsxs)("g",{opacity:e.live?.9:.5,"data-scheme-edge":e.to,"data-scheme-edge-from":e.from,"data-scheme-edge-elided":o?String(o):void 0,children:[(0,U.jsx)("path",{d:s,style:{d:`path("${s}")`,transition:`d 380ms ${y9}`},fill:"none",stroke:e.color,strokeWidth:2.5,strokeLinecap:"round",strokeDasharray:e.dashed?"5 7":void 0}),(0,U.jsx)("circle",{cx:r,cy:i,r:3.5,fill:e.color,style:{cx:`${r}px`,cy:`${i}px`,transition:`cx 380ms ${y9}, cy 380ms ${y9}`}}),(0,U.jsx)("path",{d:l,style:{d:`path("${l}")`,transition:`d 380ms ${y9}`},fill:e.color}),o?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("circle",{cx:(r+e.x2)/2,cy:(i+e.y2)/2,r:12,fill:"var(--color-canvas)",stroke:e.color,strokeWidth:1.5}),(0,U.jsxs)("text",{x:(r+e.x2)/2,y:(i+e.y2)/2+4,textAnchor:"middle",fontSize:12,fontWeight:700,fill:e.color,children:["⋯",o]})]}):null]},e.to)})})}),ki=Math.atan2(56,45),ka=Math.atan2(-56,-45);function ks(e,t,n){let r=e-9*Math.cos(n),i=t-9*Math.sin(n),a=-Math.sin(n),s=Math.cos(n);return`M ${r+5*a} ${i+5*s} L ${r-5*a} ${i-5*s} L ${e} ${t} Z`}let kl=(0,Y.memo)(function({loops:e,width:t,height:n}){return e.length?(0,U.jsx)("svg",{width:t,height:n,className:"absolute left-0 top-0","aria-hidden":!0,children:e.map(e=>{let t=tl(e.flow),n=e.y+150,r=e.y+330,i=`M ${e.x1} ${n} C ${e.x1+52} ${n-56}, ${e.x2-52} ${n-56}, ${e.x2-7} ${n}`,a=`M ${e.x2} ${r} C ${e.x2-52} ${r+56}, ${e.x1+52} ${r+56}, ${e.x1+7} ${r}`,s=ks(e.x2-7,n,ki),l=ks(e.x1+7,r,ka),o=(e,t)=>({d:e,fill:"none",stroke:t?"var(--color-accent)":"var(--color-strong)",strokeWidth:t?3:2.5,strokeLinecap:"round",className:t?"loop-arc-live":void 0,style:{d:`path("${e}")`,transition:`d 380ms ${y9}`}}),c=e=>({d:`path("${e}")`,transition:`d 380ms ${y9}`});return(0,U.jsxs)("g",{children:[(0,U.jsx)("path",{...o(i,"forward"===t)}),(0,U.jsx)("path",{d:s,style:c(s),fill:"forward"===t?"var(--color-accent)":"var(--color-strong)"}),(0,U.jsx)("path",{...o(a,"back"===t)}),(0,U.jsx)("path",{d:l,style:c(l),fill:"back"===t?"var(--color-accent)":"var(--color-strong)"})]},e.key)})}):null}),ko=(0,Y.memo)(function({links:e,byPath:t,obstacles:n=[],interactive:r,hubInteractive:i=r,width:a,height:s}){if(!e.length)return null;let l=e.filter(e=>e.pipeline&&!e.pipeline.anchorOnly&&t.has(e.from)&&t.has(e.to)),o=new Map(l.map(e=>[e.key,(e=>{let r=t.get(e.from),i=t.get(e.to),a=function(e,t,n=14){let r={x:e.x+e.w/2,y:e.y+e.h/2},i={x:t.x+t.w/2,y:t.y+t.h/2},a=Math.abs(i.x-r.x)>=Math.abs(i.y-r.y),s=r.x,l=r.y,o=i.x,c=i.y;a?(s=i.x>=r.x?e.x+e.w:e.x,o=i.x>=r.x?t.x:t.x+t.w,l+=n,c+=n):(l=i.y>=r.y?e.y+e.h:e.y,c=i.y>=r.y?t.y:t.y+t.h,s+=n,o+=n);let d=o-s,u=c-l,p=Math.hypot(d,u)||1,m=d/p,f=u/p,h=-f,x=[];for(let e=22;e<p-10;e+=22){let t=s+m*e,n=l+f*e,r=t-5*m,i=n-5*f;x.push(`M ${(r+5*h).toFixed(1)} ${(i+5*m).toFixed(1)} L ${t.toFixed(1)} ${n.toFixed(1)} L ${(r-5*h).toFixed(1)} ${(i-5*m).toFixed(1)}`)}return{x1:s,y1:l,x2:o,y2:c,chevrons:x}}(r,i),s=n.filter(e=>e!==r&&e!==i);if(!s.some(e=>bV(a.x1,a.y1,a.x2,a.y2,e,10)))return{d:`M ${a.x1} ${a.y1} L ${a.x2} ${a.y2}`,mid:{x:(a.x1+a.x2)/2,y:(a.y1+a.y2)/2},chevrons:a.chevrons};let l=bQ({x1:a.x1,y1:a.y1,x2:a.x2,y2:a.y2},s);return{d:l.d,mid:l.mid,chevrons:[]}})(e)]));return(0,U.jsxs)(U.Fragment,{children:[l.length?(0,U.jsx)("svg",{width:a,height:s,className:"absolute left-0 top-0","aria-hidden":!0,children:l.map(e=>{let t=o.get(e.key),n=x3[e.pipeline.tone],r=t.d,i=("active"===e.pipeline.tone||!!e.pipeline.isNext)&&!e.pipeline.paused,a="fail"===e.pipeline.edge;return(0,U.jsxs)("g",{"data-pipeline-edge":e.pipeline.edge??"pass","data-edge-next":e.pipeline.isNext?"true":void 0,children:[(0,U.jsx)("path",{d:r,className:i&&!a?"pipeline-rail-live":void 0,style:{d:`path("${r}")`,transition:`d 380ms ${y9}`},fill:"none",stroke:n,strokeWidth:2.5,strokeLinecap:"round",strokeDasharray:a?"6 6":"dim"===e.pipeline.tone?"5 7":void 0}),t.chevrons.map((e,t)=>(0,U.jsx)("path",{d:e,fill:"none",stroke:n,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",opacity:.9},t))]},e.key)})}):null,e.map(e=>{let n=t.get(e.from),a=t.get(e.to);if(!n||!a)return null;if(e.pipeline){let t=o.get(e.key),r=e.pipeline.anchorOnly?n.x+n.w/2:t?.mid.x??n.x+n.w/2,a=e.pipeline.anchorOnly?n.y:t?.mid.y??n.y;return e.pipeline.hub?(0,U.jsx)(yP,{pipeline:e.pipeline.pipeline,x:r,y:a,interactive:i,moveTransition:ke},e.key):(0,U.jsx)(kd,{index:e.pipeline.index,total:e.pipeline.total,color:x3[e.pipeline.tone],x:r,y:a,moveTransition:ke},e.key)}if(!e.flow)return null;let s=(n.x+n.w+a.x)/2,l=Math.min(n.y,a.y)+240;return(0,U.jsx)(yM,{flow:e.flow.flow,x:s,y:l,interactive:r,moveTransition:ke},e.key)})]})}),kc=(0,Y.memo)(function({groups:e,interactive:t}){let{t:n}=(0,eh.Ym)(),[r,i]=(0,Y.useState)(null);if(!e.length)return null;let a=t?e.find(e=>e.id===r)??null:null;return(0,U.jsxs)("div",{"aria-hidden":!1,children:[e.map(e=>{let r,s,l=e.pipeline?.state==="draft",o=l?"var(--color-warning)":`hsl(${e.hue} 62% 42%)`,c=l?"var(--color-warning-soft)":`hsl(${e.hue} 62% 42% / 0.055)`,d=a?.id===e.id;return(0,U.jsxs)("div",{"data-scheme-group":e.kind,"data-pipeline-draft":l||void 0,className:"pointer-events-none absolute",style:{left:e.x,top:e.y,width:e.w,height:e.h,transition:kt},children:[(0,U.jsx)("div",{"aria-hidden":!0,className:`absolute inset-0 rounded-[20px] ${l?"border-2 border-dashed":"border"}`,style:l?{borderColor:o,backgroundColor:c,backgroundImage:"repeating-linear-gradient(135deg, transparent 0 12px, color-mix(in srgb, var(--color-warning) 7%, transparent) 12px 14px)"}:{borderColor:`color-mix(in srgb, ${o} 32%, var(--border-default))`,backgroundColor:`color-mix(in srgb, ${o} 6%, var(--surface-well))`}}),(0,U.jsxs)("button",{"data-scheme-ui":!0,"data-pipeline-group-header":e.pipeline?e.id:void 0,className:`absolute -top-3 left-5 z-[8] inline-flex max-w-[26em] items-center gap-[0.4em] rounded-full bg-card px-[0.7em] py-[0.15em] font-bold shadow-1 hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:cursor-default ${t?"pointer-events-auto":""}`,style:{borderColor:o,color:o,borderWidth:"0.18em",borderStyle:l?"dashed":"solid",fontSize:(r=Number.isFinite(kn)?`min(var(--inv-z, 1), ${kn})`:"var(--inv-z, 1)",`calc(11px * ${r})`)},"aria-expanded":d,"aria-haspopup":"dialog",disabled:!t,onClick:()=>i(t=>t===e.id?null:e.id),children:[(0,U.jsx)("span",{"aria-hidden":!0,children:"pipeline"===e.kind?"⇢":"⟳"}),(0,U.jsx)("span",{className:"truncate",children:e.label}),e.pipeline?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("span",{"data-pipeline-progress":!0,className:"shrink-0 rounded-full px-[0.5em] py-[0.02em] tabular-nums opacity-90",style:{backgroundColor:c},children:(s=xz(e.pipeline),`${s.k}/${s.n}`)}),(0,U.jsx)("span",{"data-pipeline-lifecycle":!0,className:"shrink-0 truncate opacity-80",children:xu(n,e.pipeline.state)})]}):null,(0,U.jsx)("span",{"aria-hidden":!0,className:"shrink-0 opacity-70",children:"▾"})]})]},e.key)}),a?(0,U.jsx)("div",{className:"pointer-events-auto absolute left-0 top-0 z-[45]",style:{transform:`translate(${a.x+20}px, ${a.y+16}px)`,transition:kt},onKeyDown:e=>{"Escape"===e.key&&(e.stopPropagation(),i(null))},children:(0,U.jsx)(yG,{group:a,onClose:()=>i(null)})}):null]})});function kd({index:e,total:t,color:n,x:r,y:i,moveTransition:a}){return(0,U.jsxs)("div",{"data-scheme-ui":!0,className:"pointer-events-none absolute left-0 top-0 z-[4] inline-flex h-[18px] -translate-x-1/2 -translate-y-1/2 items-center gap-0.5 rounded-full border bg-card px-1.5 text-[9.5px] font-bold shadow-1",style:{transform:`translate(${r}px, ${i}px) translate(-50%, -50%)`,transition:a,borderColor:n,color:n},"aria-hidden":!0,children:[(0,U.jsx)("span",{children:"›"}),(0,U.jsxs)("span",{children:[e,"/",t]})]})}function ku({file:e,className:t}){let n=function(e,t=Date.now(),n=(0,eh.JK)()){let r=e.lastTurn;if(r&&null===r.endedAt&&"live"===e.activity){let e=Math.max(0,(t-r.startedAt)/1e3);return{running:(0,eh.Tl)(n,"turn.running",{d:ui(e,n)}),idleTitle:null}}let i=us(e);return null!==i?{running:null,idleTitle:(0,eh.Tl)(n,"turn.lastRun",{d:ui(i,n)})}:{running:null,idleTitle:null}}(e);return n.running?(0,U.jsx)("span",{className:`${t??""} shrink-0 font-semibold tabular-nums text-success`,children:n.running}):(0,U.jsx)("span",{className:`${t??""} shrink-0 tabular-nums text-muted`,title:n.idleTitle??void 0,children:(0,tw.rK)(e.mtime)})}function kp({ancestry:e}){let{t}=(0,eh.Ym)();if(!e)return null;let n=e.elided[0],r=n?t("scheme.ancestorElided",{count:e.elided.length,title:(0,tw.cr)(n.title,60)}):e.unresolvedParentId?t("scheme.ancestorOffBoard"):null;return r?(0,U.jsxs)("span",{"data-scheme-ancestry-chip":!0,className:"pointer-events-none absolute -top-3 left-3 z-[7] inline-flex h-6 max-w-[62%] items-center gap-1 rounded-full border border-border bg-card px-2 text-[10.5px] font-bold text-muted shadow-1",title:r,"aria-label":r,children:[(0,U.jsx)("span",{"aria-hidden":!0,className:"text-[12px] leading-none",children:"↑"}),(0,U.jsx)("span",{className:"truncate",children:n?(0,tw.cr)(n.title,40):r})]}):null}function km({file:e,onSelect:t}){let n=(0,tw.yz)(e);return(0,U.jsxs)("button",{className:"flex h-8 w-full min-w-0 items-center gap-1.5 rounded-[8px] px-2 text-left hover:bg-canvas focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:(0,tw.cr)(e.title),onClick:()=>t(e),children:[(0,U.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${(0,tw.tz)(e.activity)}`}),(0,U.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px] font-bold",style:n.style,children:n.label}),(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11.5px] font-semibold",children:(0,tw.cr)(e.cmdDesc||e.title,80)}),(0,U.jsx)("span",{className:"shrink-0 text-[10.5px] text-muted",children:(0,tw.rK)(e.mtime)})]})}function kf({file:e}){let t=(0,tw.yz)(e);return(0,U.jsx)("div",{className:"pointer-events-none absolute inset-0 z-[3] flex items-center justify-center",style:{opacity:"var(--label-o, 0)",transition:"opacity .25s"},"aria-hidden":!0,children:(0,U.jsxs)("div",{"data-far-label":!0,className:"flex max-w-[94%] items-center gap-[0.5em] rounded-[0.55em] border border-border bg-card/95 px-[0.75em] py-[0.45em] shadow-2",style:{fontSize:"calc(13px * min(var(--inv-z, 1), 2.6))"},children:[(0,U.jsx)("span",{className:`h-[0.6em] w-[0.6em] shrink-0 rounded-full ${(0,tw.tz)(e.activity)}`}),(0,U.jsx)("span",{className:"shrink-0 rounded-full px-[0.45em] font-bold",style:{...t.style,fontSize:"0.72em"},children:t.label}),(0,U.jsx)(gx,{file:e,fontClassName:"text-[0.78em]"}),(0,U.jsx)("span",{className:"line-clamp-2 min-w-0 font-bold",children:(0,tw.cr)(e.title,70)}),(0,U.jsx)(yz,{file:e,showSettled:!1,fontClassName:"text-[0.72em]"}),(0,U.jsx)(gY,{rateLimit:e.rateLimit}),(0,U.jsx)(gZ,{wakeup:e.pendingWakeup,interactive:!1},gX(e.pendingWakeup))]})})}let kh=()=>void 0,kx=e=>e?" opacity-35":"";function kg({node:e,ringed:t,dimmed:n,flow:r}){let{t:i}=(0,eh.Ym)();return(0,U.jsxs)("div",{"data-scheme-node":e.file.path,className:`scheme-enter absolute${kx(n)}`,style:{transform:`translate(${e.x}px, ${e.y}px)`,width:e.w,height:e.h,transition:ke},children:[r?(0,U.jsx)("div",{className:"absolute -top-[60px] left-0 z-[4]",style:{width:1370},children:(0,U.jsx)(y_,{flow:r,onFocusRound:kh})}):null,e.under.length?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("div",{className:"absolute inset-x-4 -bottom-4 h-5 rounded-[10px] border border-border bg-card/70 shadow-1","aria-hidden":!0}),(0,U.jsx)("div",{className:"absolute inset-x-2 -bottom-2 h-5 rounded-[10px] border border-border bg-card/90 shadow-1","aria-hidden":!0})]}):null,(0,U.jsxs)("div",{className:`relative z-[1] flex h-full min-w-0 flex-col overflow-hidden rounded-[10px] border border-border bg-card shadow-1 ${t?"ring-2 ring-accent/60 ring-offset-2 ring-offset-canvas":""}`,children:[(0,U.jsx)("span",{"aria-hidden":!0,className:"h-1 w-full shrink-0",style:(0,tw.gA)(e.file)}),(0,U.jsxs)("div",{"data-card-row":"identity",className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-2.5",children:[(0,U.jsx)("span",{className:`h-2.5 w-2.5 shrink-0 rounded-full ${(0,tw.tz)(e.file.activity)}`}),(0,U.jsx)(yH,{file:e.file,fontClassName:"text-[11px]"}),(0,U.jsx)("span",{className:"ml-auto inline-flex min-w-0 shrink-0",children:(0,U.jsx)(gx,{file:e.file})})]}),(0,U.jsx)("div",{"data-card-row":"content",className:"min-w-0 flex-1 px-3 py-2.5 text-[14px] font-semibold leading-snug",children:(0,U.jsx)("span",{className:"line-clamp-4",children:(0,tw.cr)(e.file.title,180)})}),(0,U.jsxs)("div",{"data-card-row":"ops",className:"flex shrink-0 items-center gap-1.5 overflow-hidden border-t border-border px-3 py-2 text-[11px] font-semibold text-muted",children:[(0,U.jsx)(yz,{file:e.file,fontClassName:"text-[10px]"}),(0,U.jsx)(gY,{file:e.file,shrinkable:!0}),(0,U.jsx)(gZ,{wakeup:e.file.pendingWakeup,className:"pointer-events-auto",shrinkable:!0},gX(e.file.pendingWakeup)),e.under.length?(0,U.jsxs)("span",{className:"shrink-0",children:[e.under.length," ",i("scheme.underneath")]}):null,(0,U.jsx)(ku,{file:e.file,className:"ml-auto text-[11px]"})]})]}),r?(0,U.jsx)(yF,{role:"implementer",active:"implementer"===ts(r)}):null,(0,U.jsx)(kf,{file:e.file})]})}function kb({draft:e,ringed:t,dimmed:n}){let{t:r}=(0,eh.Ym)();return(0,U.jsx)("div",{"data-scheme-node":e.key,className:`scheme-enter absolute${kx(n)}`,style:{transform:`translate(${e.x}px, ${e.y}px)`,width:e.w,height:e.h,transition:ke},children:(0,U.jsx)("div",{className:`flex h-full items-center justify-center rounded-[10px] border border-dashed border-border bg-card/70 ${t?"ring-2 ring-accent/60 ring-offset-2 ring-offset-canvas":""}`,children:(0,U.jsxs)("span",{className:"flex items-center gap-1.5 text-[13px] font-semibold text-muted",children:[(0,U.jsx)("span",{className:"text-[15px] leading-none text-accent",children:"+"})," ",r("mobile.agent")]})})})}function kv({deck:e,dimmed:t}){let{t:n}=(0,eh.Ym)(),r=e.rounds.at(-1)??null,i=r?.round??null,a=tc(i?.verdict??null);return(0,U.jsxs)("div",{"data-scheme-node":e.key,className:`scheme-enter absolute${kx(t)}`,style:{transform:`translate(${e.x}px, ${e.y}px)`,width:e.w,height:e.h,transition:ke},children:[(0,U.jsx)("div",{className:"flex h-full flex-col overflow-hidden rounded-[10px] border border-border bg-card shadow-1",children:i?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5 border-b border-border px-3 py-2.5",style:{backgroundColor:a.soft,color:a.color},children:[(0,U.jsxs)("span",{className:"flex shrink-0 items-center gap-1 text-[12px] font-bold",children:["R",i.n," ",(0,U.jsx)(v5,{verdict:i.verdict,error:!!i.error,className:"h-3.5 w-3.5"})]}),(0,U.jsx)("span",{className:"min-w-0 truncate text-[11px] font-semibold",children:i.error?n("roundDeck.aborted"):i.verdict??n("roundDeck.reviewInProgress")})]}),(0,U.jsx)("div",{className:"min-w-0 flex-1 px-3 py-2.5 text-[13px] font-semibold leading-snug",children:(0,U.jsx)("span",{className:"line-clamp-4",children:r?.file?(0,tw.cr)(r.file.title,140):n("roundDeck.spawningReviewer")})}),e.rounds.length>1?(0,U.jsx)("div",{className:"shrink-0 px-3 pb-2.5 text-[11px] font-semibold text-muted",children:n("roundDeck.moreRounds",{count:e.rounds.length-1})}):null]}):(0,U.jsx)("div",{className:"flex flex-1 items-center justify-center text-[12px] font-semibold text-muted",children:n("roundDeck.waitingFirst")})}),(0,U.jsx)(yF,{role:"reviewer",active:"reviewer"===ts(e.flow)})]})}function kw({stack:e,dimmed:t,onSelect:n}){let{t:r}=(0,eh.Ym)();return(0,U.jsx)("div",{"data-scheme-node":e.key,className:`scheme-enter absolute${kx(t)}`,style:{transform:`translate(${e.x}px, ${e.y}px)`,width:e.w,height:e.h,transition:ke},children:(0,U.jsx)("div",{className:"flex h-full flex-col gap-1.5 overflow-y-auto rounded-[10px] border border-dashed border-strong bg-card/60 p-2",children:e.items.map(({file:e,branches:t})=>{let i=(0,tw.yz)(e);return(0,U.jsxs)("button",{className:"flex min-h-[52px] w-full min-w-0 flex-col justify-center gap-0.5 rounded-[8px] border border-border bg-card px-2 py-1 text-left shadow-1 hover:border-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:(0,tw.cr)(e.title),onClick:()=>n(e),children:[(0,U.jsxs)("span",{"data-card-row":"identity",className:"flex min-w-0 items-center gap-1.5",children:[(0,U.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${(0,tw.tz)(e.activity)}`}),(0,U.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px] font-bold",style:i.style,children:i.label}),(0,U.jsx)(gx,{file:e}),(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11.5px] font-semibold",children:(0,tw.cr)(e.title,70)})]}),(0,U.jsxs)("span",{"data-card-row":"ops",className:"flex items-center gap-2 pl-3 text-[10.5px] text-muted",children:[(0,U.jsx)(yz,{file:e,showSettled:!1}),(0,U.jsx)("span",{children:g5(r,e.kind)}),(0,U.jsx)("span",{children:(0,tw.rK)(e.mtime)}),t?(0,U.jsxs)("span",{children:["⤷ ",t]}):null]})]},e.path)})})})}function ky({path:e,marked:t,session:n,onToggle:r,onHoverChange:i}){let{t:a}=(0,eh.Ym)(),[s,l]=(0,Y.useState)(!1),o=e=>{l(e),i(e)},c=t||s||n;return(0,U.jsx)("div",{"data-scheme-ui":!0,className:"scheme-select-check-zone pointer-events-auto absolute -right-5 -top-5 z-[8] h-7 w-7",onPointerEnter:()=>o(!0),onPointerLeave:()=>o(!1),children:(0,U.jsx)("button",{type:"button","data-select-check":e,"data-select-check-revealed":c?"true":"false","aria-pressed":t,title:a(t?"scheme.selectCheckOff":"scheme.selectCheckOn"),"aria-label":a(t?"scheme.selectCheckOff":"scheme.selectCheckOn"),className:`scheme-select-check absolute bottom-0.5 left-0.5 flex h-6 w-6 items-center justify-center rounded-full border-2 border-canvas focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/60 ${c?"opacity-100":"opacity-0"} ${t?"bg-accent text-white shadow-1":n?"bg-accent/60 text-white shadow-1 hover:bg-accent/80":"bg-accent/35 text-white/85 hover:bg-accent/70"}`,onClick:t=>{t.stopPropagation(),r(e)},children:(0,U.jsx)(fv.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})})}function kk({node:e,ringed:t,marked:n,session:r,onToggleMember:i,dimmed:a,dormant:s,flow:l,pipeline:o,pipelineStage:c,flows:d,files:u,renderablePaths:p,renderableFlows:m,linkedTasks:f,relatedTasks:h,canFlow:x,canPipeline:g,onSelect:b,onOpenPath:v,onOpenFlow:w,onOpenTask:y,onClose:k,onFocusRound:j,onHandoff:N,onSpawnRetry:S,onExpand:C,onPipelineCreated:A,badgeAnchors:I,trayApi:M}){let T,{t:P}=(0,eh.Ym)(),[$,E]=(0,Y.useState)(!1),[R,O]=(0,Y.useState)(!1),[D,L]=(0,Y.useState)(!1),[_,F]=(0,Y.useState)(!1),[q,z]=(0,Y.useState)(!1),H=o&&!l?o:null;return(0,U.jsxs)("div",{"data-scheme-node":e.file.path,"data-scheme-node-host":e.ancestry?.hostPath??void 0,"data-scheme-node-elided":e.ancestry?.elided.length?String(e.ancestry.elided.length):void 0,"data-scheme-node-unresolved-parent":e.ancestry?.unresolvedParentId??void 0,"data-pipeline-stage-card":c?`${c.pipeline.id}::${c.stage.id}`:void 0,"data-pipeline-stage-state":c?xC(c.pipeline,c.stage):void 0,"data-lasso-selected":n?"true":void 0,"data-select-check-hover":q?"true":void 0,className:`scheme-enter absolute ${_?"z-[60]":$||R?"z-20":""}${kx(a)}`,style:{transform:`translate(${e.x}px, ${e.y}px)`,width:e.w,height:e.h,transition:ke},children:[i?(0,U.jsx)(ky,{path:e.file.path,marked:n,session:r,onToggle:i,onHoverChange:z}):null,n?(0,U.jsx)("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 z-[4] rounded-[10px] bg-accent/[0.06]"}):null,(0,U.jsx)(kp,{ancestry:e.ancestry}),c?(0,U.jsxs)("span",{className:"pointer-events-none absolute -top-3 right-3 z-[7] inline-flex h-6 max-w-[78%] items-center gap-1.5 rounded-full border border-accent/35 bg-card px-2 text-[10.5px] font-bold text-accent shadow-1",title:xO(P,c.stage),children:[(0,U.jsx)("span",{className:"truncate",children:xO(P,c.stage)}),(0,U.jsxs)("span",{className:"shrink-0 text-muted",children:[c.index+1,"/",c.total]})]}):null,l?(0,U.jsx)("div",{className:"absolute -top-[60px] left-0 z-[4]",style:{width:1370},children:(0,U.jsx)(y_,{flow:l,onFocusRound:e=>j(l.id,e)})}):null,H?(0,U.jsx)("div",{className:"absolute -top-[60px] left-0 z-[5]",style:{width:e.w},children:(0,U.jsx)(wA,{pipeline:H,flows:d,files:u,renderablePaths:p,renderableFlows:m,linkedTasks:f,compact:!0,onOpenPath:v,onOpenFlow:w,onOpenTask:y})}):null,x||g?(0,U.jsxs)("div",{className:`absolute left-0 z-[4] flex items-center gap-1.5 ${l||H?"-top-[92px]":"-top-11"}`,children:[x?(0,U.jsxs)("button",{"data-scheme-ui":!0,className:"inline-flex h-7 items-center gap-1 rounded-full border border-border bg-card px-2.5 text-[11px] font-semibold text-muted shadow-1 hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-expanded":R,title:P("scheme.flowTitle"),onClick:()=>O(e=>!e),children:[(0,U.jsx)("span",{className:"text-[13px] leading-none text-accent",children:"⟳"})," ",P("scheme.flow")]}):null,g?(0,U.jsxs)("button",{"data-scheme-ui":!0,className:"inline-flex h-7 items-center gap-1 rounded-full border border-border bg-card px-2.5 text-[11px] font-semibold text-muted shadow-1 hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-expanded":D,title:P("scheme.pipelineTitle"),onClick:()=>L(!0),children:[(0,U.jsx)("span",{className:"text-[13px] leading-none text-accent",children:"⇢"})," ",P("scheme.pipeline")]}):null]}):null,R?(0,U.jsx)("div",{className:"absolute left-0 top-[-8px] z-40 -translate-y-full",children:(0,U.jsx)(yA,{file:e.file,onClose:()=>O(!1)})}):null,D?(0,U.jsx)(bE,{repoDir:e.file.projectRoot?.trim()||e.file.cwd?.trim()||"",onClose:()=>L(!1),onCreate:(t,n)=>xG(e.file.project,n,t??void 0,e.file.path),onCreated:e=>{L(!1),A?.(e)}}):null,e.under.length?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("div",{className:"absolute inset-x-4 -bottom-4 h-5 rounded-[10px] border border-border bg-card/70 shadow-1","aria-hidden":!0}),(0,U.jsx)("div",{className:"absolute inset-x-2 -bottom-2 h-5 rounded-[10px] border border-border bg-card/90 shadow-1","aria-hidden":!0})]}):null,(0,U.jsx)("div",{className:`relative z-[1] flex h-full ${t?"rounded-[10px] ring-2 ring-accent/60 ring-offset-2 ring-offset-canvas":""}`,children:(0,U.jsx)(g6,{file:e.file,tasks:e.tasks,isRoot:e.isRoot,dormant:s,showFavorite:!0,titleOverride:x_(P,c),onClose:()=>k(e.file.path),onToggleExpand:()=>C(e.file.path),onSpawnRetry:S,relatedTasks:h,onOpenTask:y})}),(0,U.jsx)(wz,{conversationId:W(e.file),entries:u,cardRect:e,anchorRegistry:I,onExpandedChange:F,exclude:M?.foldedChildPaths,onFold:M?.onFoldChild,onNavigate:e=>{let t=u.find(t=>t.path===e);t&&b(t)}}),(T=M?.trays.get(W(e.file)))?(0,U.jsx)(wO,{tray:T,onToggleExpanded:e=>M.onToggleExpanded(T.parentConversationId,e),onOpenMember:M.onOpenMember,onUnfold:M.onUnfold}):null,l?(0,U.jsx)(yF,{role:"implementer",active:"implementer"===ts(l)}):null,(0,U.jsx)(kf,{file:e.file}),N&&w5(e.file)?(0,U.jsx)(w4,{file:e.file,onHandoff:()=>N(e.file)}):null,e.under.length?(0,U.jsxs)("button",{className:"absolute -bottom-11 left-1/2 z-[2] inline-flex h-7 -translate-x-1/2 items-center gap-1.5 whitespace-nowrap rounded-full border border-border bg-card px-2.5 text-[11px] font-semibold text-muted shadow-1 hover:border-accent/40 hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-expanded":$,title:P("scheme.collapsedTitle"),onClick:()=>E(e=>!e),children:[(0,U.jsx)(h_.A,{className:"h-3.5 w-3.5","aria-hidden":!0}),e.under.length," ",P("scheme.underneath"),(0,U.jsx)(sx.c_,{className:`h-3 w-3 transition-transform ${$?"rotate-90":""}`,"aria-hidden":!0})]}):null,$?(0,U.jsx)("div",{className:"absolute left-0 top-[calc(100%+52px)] z-30 max-h-[280px] w-full overflow-y-auto rounded-[10px] border border-border bg-card p-1.5 shadow-2",children:e.under.map(e=>(0,U.jsx)(km,{file:e,onSelect:b},e.path))}):null]})}function kj({draft:e,project:t,files:n,ringed:r,dimmed:i,onDraftClose:a,onDraftSpawned:s}){return(0,U.jsx)("div",{"data-scheme-node":e.key,className:`scheme-enter absolute${kx(i)}`,style:{transform:`translate(${e.x}px, ${e.y}px)`,width:e.w,height:e.h,transition:ke},children:(0,U.jsx)("div",{className:`flex h-full ${r?"rounded-[10px] ring-2 ring-accent/60 ring-offset-2 ring-offset-canvas":""}`,children:nL(e.id)?(0,U.jsx)(vP,{draftId:e.id,project:t,onClose:()=>a(e.id),onLaunched:()=>a(e.id)}):(0,U.jsx)(bC,{draftId:e.id,project:t,files:n,onClose:()=>a(e.id),onSpawned:t=>s(e.id,t)})})})}function kN({onClose:e}){return(0,Y.useEffect)(()=>{let t=t=>{if("Escape"!==t.key)return;let n=t.target;n&&(["INPUT","TEXTAREA","SELECT"].includes(n.tagName)||n.isContentEditable)||(t.preventDefault(),t.stopPropagation(),e())};return window.addEventListener("keydown",t,!0),()=>window.removeEventListener("keydown",t,!0)},[e]),null}function kS({slot:e,lite:t,dimmed:n,files:r,onSelect:i}){let a,{t:s}=(0,eh.Ym)(),[l,o]=(0,Y.useState)(!1),[c,d]=(0,Y.useState)(!1),u=xh[xC(e.pipeline,e.stage)],{pipeline:p}=e;if(e.collapsedRow){let a=e.attempt?xI(e.attempt):null,s=a?xM(a,r):null,l=`${e.key}::card`;return(0,U.jsxs)("div",{"data-scheme-node":e.key,className:`scheme-enter absolute${kx(n)} ${c?"z-30":""}`,style:{transform:`translate(${e.x}px, ${e.y}px)`,width:e.w,height:e.h,transition:ke},children:[e.incoming?(0,U.jsx)("span",{"aria-hidden":!0,className:"absolute z-[2] inline-flex h-6 -translate-x-1/2 -translate-y-1/2 items-center rounded-full border bg-card px-1.5 text-[12px] font-bold shadow-1",style:{left:-36,top:e.incomingAnchorY??110,borderColor:u.color,color:u.color},children:"review-loop"===e.incoming?"⟳":"→"}):null,(0,U.jsx)(yR,{slot:e,expanded:c,controls:l,onToggle:t?void 0:()=>d(e=>!e)}),c?(0,U.jsxs)("div",{id:l,"data-stage-row-card":!0,className:"absolute left-0 top-[calc(100%+8px)] z-30 flex",style:{width:e.w,height:620},children:[(0,U.jsx)(kN,{onClose:()=>d(!1)}),"completed"===e.presentation?(0,U.jsx)(yE,{slot:e,onOpen:s&&!t?()=>i(s):void 0}):(0,U.jsx)(wy,{slot:e,interactive:!t})]}):null]})}if("completed"===e.presentation){let a=e.attempt?xI(e.attempt):null,s=a?xM(a,r):null;return(0,U.jsxs)("div",{"data-scheme-node":e.key,className:`scheme-enter absolute${kx(n)}`,style:{transform:`translate(${e.x}px, ${e.y}px)`,width:e.w,height:e.h,transition:ke},children:[e.incoming?(0,U.jsx)("span",{"aria-hidden":!0,className:"absolute z-[2] inline-flex h-6 -translate-x-1/2 -translate-y-1/2 items-center rounded-full border bg-card px-1.5 text-[12px] font-bold shadow-1",style:{left:-36,top:e.incomingAnchorY??110,borderColor:u.color,color:u.color},children:"review-loop"===e.incoming?"⟳":"→"}):null,(0,U.jsx)(yE,{slot:e,onOpen:s&&!t?()=>i(s):void 0})]})}let m="draft"===p.state,f=e.index===e.total-1,h=p.stages.map(e=>e.kind),x=m&&!t&&p.stages.length<8,g=x&&xW(((a=[...h]).splice(e.index+1,0,"review-loop"),a)),b=t=>{let n,r,i,a;if(l)return;o(!0);let s=new Set(p.stages.map(e=>e.id)),c=p.stages.length+1;for(;s.has(`stage-${c}`);)c+=1;let d=e.index+1,u={id:`stage-${c}`,kind:t,prompt:d>0?"{{prev.output}}":"{{task}}",next:null};x4(p.id,"add-stage",{index:d,stage:u},(i=(r=Math.max(0,Math.min(d,(n=[...p.stages]).length)))>0?n[r-1]:null,a={...u,next:i?i.next??null:n[r]?.id??null,effectiveRole:{...x1,roleId:u.role?.roleId??null,...u.engine?{engine:u.engine}:{},access:u.access??("review-loop"===u.kind?"read-only":"read-write")}},i&&(n[r-1]={...i,next:a.id}),n.splice(r,0,a),{...p,stages:x2(n)})).then(e=>{e&&oC("err",e),o(!1)})};return(0,U.jsxs)("div",{"data-scheme-node":e.key,className:`scheme-enter absolute${kx(n)}`,style:{transform:`translate(${e.x}px, ${e.y}px)`,width:e.w,height:e.h,transition:ke},children:[e.incoming?(0,U.jsx)("span",{"aria-hidden":!0,className:"absolute z-[2] inline-flex h-6 -translate-x-1/2 -translate-y-1/2 items-center rounded-full border bg-card px-1.5 text-[12px] font-bold shadow-1",style:{left:-36,top:e.incomingAnchorY??110,borderColor:u.color,color:u.color},children:"review-loop"===e.incoming?"⟳":"→"}):null,(0,U.jsx)("div",{className:"flex h-full",children:(0,U.jsx)(wy,{slot:e,interactive:!t})}),x&&f?(0,U.jsxs)("div",{"data-scheme-ui":!0,className:"absolute left-full top-[110px] z-[2] flex -translate-y-1/2 items-center",children:[(0,U.jsx)("span",{"aria-hidden":!0,className:"h-0 w-5 border-t-2 border-dashed border-strong"}),(0,U.jsxs)("button",{"data-scheme-ui":!0,className:"inline-flex h-9 shrink-0 items-center gap-1 whitespace-nowrap rounded-full border-2 border-dashed border-border bg-card px-3 text-[11.5px] font-bold text-secondary shadow-1 hover:border-accent/60 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:l,title:s("pipelineSlot.addAgentTitle"),onClick:()=>b("run"),children:[(0,U.jsx)("span",{className:"text-[14px] leading-none text-accent","aria-hidden":!0,children:"+"})," ",s("pipelineSlot.addAgent")]})]}):null,x&&"run"===e.stage.kind?(0,U.jsx)("div",{className:"absolute -bottom-10 left-0 z-[2] flex items-center gap-1.5",children:(0,U.jsxs)("button",{"data-scheme-ui":!0,className:"inline-flex h-7 items-center gap-1 rounded-full border border-border bg-card px-2.5 text-[11px] font-semibold text-muted shadow-1 hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:l||!g,title:s("pipelineSlot.addReviewTitle"),onClick:()=>b("review-loop"),children:[(0,U.jsx)("span",{className:"text-[13px] leading-none text-accent","aria-hidden":!0,children:"⟳"})," ",s("pipelineSlot.addReview")]})}):null]})}function kC({deck:e,focus:t,dimmed:n,dormant:r,groupLabel:i}){let a=t&&t.flowId===e.flow.id?t.round+t.nonce/1e3:null;return(0,U.jsxs)("div",{"data-scheme-node":e.key,className:`scheme-enter absolute${kx(n)}`,style:{transform:`translate(${e.x}px, ${e.y}px)`,width:e.w,height:e.h,transition:ke},children:[(0,U.jsx)(v6,{flow:e.flow,rounds:e.rounds,focusRound:a,dormant:r,groupLabel:i}),(0,U.jsx)(yF,{role:"reviewer",active:"reviewer"===ts(e.flow)})]})}let kA=(0,Y.memo)(function({layout:e,project:t,files:n,interactive:r,lite:i,dormant:a,selected:s,multi:l,session:o,focus:c,attentionPaths:d,flowsByImpl:u,flows:p,pipelines:m=[],pipelineStrips:f,linkedTasksByPipeline:h,relatedTasksByPath:x,deckFocus:g,badgeAnchors:b,trayApi:v,onSelect:w,onClose:y,onFocusRound:k,onDraftClose:j,onDraftSpawned:N,onHandoff:S,onSpawnRetry:C,onOpenTask:A,onExpand:I,onToggleMember:M,onPipelineCreated:T}){let P=sZ(e=>{let t=new Map;if(!e.enabled)return t;for(let r of Object.values(e.store.sessions))if("tmux-legacy"!==r.hostKind&&r.artifactPath){var n;t.set(r.artifactPath,"working"===(n=re(r,rt(e.store,r)))?"live":"waiting_input"===n||"conflict"===n?"stalled":"idle"===n||"dead"===n?"idle":"recent")}return t},y8,y7),$=e=>{let t=n.find(t=>t.path===e);t&&w(t)},E=(0,Y.useMemo)(()=>new Set(n.map(e=>e.path)),[n]),R=(0,Y.useMemo)(()=>xL(m),[m]),O=(0,Y.useMemo)(()=>y3(e.stacks,e=>e.key),[e.stacks]),D=(0,Y.useMemo)(()=>y3(e.decks,e=>e.key),[e.decks]),L=(0,Y.useMemo)(()=>y3(e.drafts,e=>e.key),[e.drafts]),_=(0,Y.useMemo)(()=>y3(e.slots,e=>e.key),[e.slots]),F=(0,Y.useMemo)(()=>{var t;let n;return t=e.nodes,n=e=>e.lineageOrderKey??e.file.path,[...t].sort((e,t)=>{let r=n(e),i=n(t);return r===i?e.file.path.localeCompare(t.file.path):r<i?-1:1})},[e.nodes]),q=(0,Y.useMemo)(()=>xA(p,new Set(e.nodes.map(e=>e.file.path))),[p,e]),z=e=>{let t=p.find(t=>t.id===e);t&&k(t.id,t.rounds.at(-1)?.n??1)},H=e=>null!==d&&!e.rounds.some(e=>e.file&&d.has(e.file.path));return(0,U.jsxs)("div",{className:`${r?"":"pointer-events-none select-none"} ${o?"scheme-session":""}`.trim()||void 0,children:[O.map(e=>(0,U.jsx)(kw,{stack:e,dimmed:null!==d&&!e.items.some(e=>d.has(e.file.path)),onSelect:w},e.key)),D.map(e=>i?(0,U.jsx)(kv,{deck:e,dimmed:H(e)},e.key):(0,U.jsx)(kC,{deck:e,focus:g,dimmed:H(e),dormant:a,groupLabel:n.find(t=>t.path===e.flow.implementerPath)?.title},e.key)),_.map(e=>(0,U.jsx)(kS,{slot:e,lite:i,dimmed:null!==d,files:n,onSelect:w},e.key)),L.map(e=>i?(0,U.jsx)(kb,{draft:e,ringed:s===e.key||c===e.key,dimmed:null!==d},e.key):(0,U.jsx)(kj,{draft:e,project:t,files:n,ringed:s===e.key||c===e.key,dimmed:null!==d,onDraftClose:j,onDraftSpawned:N},e.key)),F.map(e=>{var t;let r,m=(r=P.get(e.file.path))?{...e,file:{...e.file,activity:r}}:e,g=f.get(m.file.path)??null;return i?(0,U.jsx)(kg,{node:m,ringed:s===m.file.path||c===m.file.path,dimmed:null!==d&&!d.has(m.file.path),flow:u.get(m.file.path)??null},m.file.path):(0,U.jsx)(kk,{node:m,ringed:o?l.has(m.file.path):s===m.file.path||c===m.file.path,marked:o&&l.has(m.file.path),session:o,onToggleMember:M,dimmed:null!==d&&!d.has(m.file.path),dormant:a,flow:u.get(m.file.path)??null,pipeline:g,pipelineStage:R.get(m.file.path)??null,linkedTasks:g?h.get(g.id)??[]:[],relatedTasks:x?.get(m.file.path)??y6,flows:p,files:n,renderablePaths:E,renderableFlows:q,canFlow:tn(m.file,u),canPipeline:("claude"===(t=m.file).engine||"codex"===t.engine)&&("claude-projects"===t.root?"session"===t.kind||"subagent"===t.kind:"codex-sessions"===t.root),onSelect:w,onOpenPath:$,onOpenFlow:z,onOpenTask:A,onClose:y,onFocusRound:k,onHandoff:S,onSpawnRetry:C,onExpand:I,onPipelineCreated:T,badgeAnchors:b,trayApi:v},m.file.path)})]})}),kI="var(--color-danger)",kM=(0,Y.memo)(function({edges:e,world:t,routes:n,onRetry:r}){let i=(0,Y.useMemo)(()=>e.map(e=>({edge:e,route:n.get(e.key)})),[e,n]);return e.length?(0,U.jsx)("svg",{width:t.w,height:t.h,viewBox:`${t.x} ${t.y} ${t.w} ${t.h}`,className:"pointer-events-none absolute z-[2]",style:{left:t.x,top:t.y},children:i.map(({edge:e,route:t})=>{let n="source"===e.relation,i=e.failed?kI:n?"var(--color-info)":gV[e.status].color,a=e.failed?.95:n?.4:.65,s=t.crosses?.4*a:a,l=t.d,o=t.mid.x,c=t.mid.y;return(0,U.jsxs)("g",{opacity:s,children:[(0,U.jsx)("path",{d:l,style:{d:`path("${l}")`,transition:`d 380ms ${y9}`},fill:"none",stroke:i,strokeWidth:n?1.75:2.5,strokeLinecap:"round",strokeDasharray:n?"2 6":"5 7"}),(0,U.jsx)("circle",{cx:e.x2,cy:e.y2,r:n?3:4,fill:i,style:{cx:`${e.x2}px`,cy:`${e.y2}px`,transition:`cx 380ms ${y9}, cy 380ms ${y9}`}}),e.failed&&"assignment"===e.relation?(0,U.jsxs)("g",{className:"pointer-events-auto cursor-pointer",role:"button","aria-label":`retry ${e.path}`,onClick:()=>r(e.taskId,e.path),children:[(0,U.jsx)("title",{children:e.error??""}),(0,U.jsx)("path",{d:l,fill:"none",stroke:"transparent",strokeWidth:22,style:{pointerEvents:"stroke"}}),(0,U.jsx)("circle",{cx:o,cy:c,r:11,fill:"var(--color-card)",stroke:kI,strokeWidth:2,style:{cx:`${o}px`,cy:`${c}px`,transition:`cx 380ms ${y9}, cy 380ms ${y9}`}}),(0,U.jsx)("text",{x:o,y:c+4.5,textAnchor:"middle",fontSize:13,fontWeight:700,fill:kI,style:{x:`${o}px`,y:`${c+4.5}px`,transition:`x 380ms ${y9}, y 380ms ${y9}`},children:"⚠"})]}):null]},e.key)})}):null});var kT=n(6937),kP=n(4885);let k$="linear-gradient(to bottom, #000 calc(100% - 18px), transparent)";function kE({icon:e,ariaLabel:t,title:n,hoverClass:r,disabled:i,onClick:a,dataAttr:s}){return(0,U.jsx)("button",{type:"button",...s?{[s]:""}:{},className:`-my-1 flex h-7 w-7 shrink-0 items-center justify-center rounded-full text-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${i?"cursor-not-allowed opacity-40":r}`,"aria-label":t,title:n,"aria-disabled":i||void 0,onClick:()=>{i||a()},children:e})}function kR({task:e,assignment:t,file:n,onDetach:r,onOpen:i}){let{t:a}=(0,eh.Ym)(),s=vu(t,n),[l,o]=(0,Y.useState)(!1),c=async()=>{let n=t.launchId;if(n&&!l){o(!0);try{let t=await nO(e.id,n);"task"in t?oC("ok",a("tasks.retryLaunched")):oC("err",t.error)}finally{o(!1)}}},d={launchId:t.launchId??null,path:t.path,conversationId:t.conversationId??null,panePid:t.panePid},u=!!d.launchId?.trim()||!!d.path?.trim()||!!d.conversationId?.trim()||null!=d.panePid&&Number.isInteger(d.panePid)&&d.panePid>0;if("spawning"===s)return(0,U.jsxs)("span",{className:"flex h-6 w-full min-w-0 items-center gap-1.5 rounded-[7px] border border-border bg-card/80 px-2 text-[10.5px] font-semibold text-muted",children:[(0,U.jsx)(dR.A,{className:"h-3 w-3 shrink-0 animate-spin","aria-hidden":!0}),(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate",children:a("tasks.spawning")}),u?(0,U.jsx)(kE,{icon:(0,U.jsx)(K.A,{className:"h-3 w-3","aria-hidden":!0}),ariaLabel:a("tasks.detachAria",{title:a("tasks.spawning")}),title:a("tasks.detach"),hoverClass:"hover:bg-black/5 hover:text-danger",onClick:()=>r(e,d)}):null]});let p="failed"===s,m=vp(s),f="handoff"===t.state,h=n?(0,tw.yz)(n):null,x=n?(0,tw.cr)(n.title,40):t.path?t.path.split("/").pop()??t.path:a("tasks.failedChip"),g=p?t.error?a("tasks.chipFailedTitle",{error:t.error}):a("tasks.failedChip"):"gone"===s?a("tasks.deadChip"):"migrating"===s?a("tasks.migratingChip"):"killed"===s?a("tasks.killedChip"):"unhosted"===s?a("tasks.unhostedChip"):f?a("tasks.handoffChip"):n?(0,tw.cr)(n.title):void 0,b=p?"border-danger/25 bg-danger-soft text-danger":"gone"===s||"killed"===s?"border-border bg-sunken text-muted opacity-70":"migrating"===s||"unhosted"===s?"border-border bg-sunken text-muted":"border-border bg-card/80";return(0,U.jsxs)("span",{className:`flex h-6 w-full min-w-0 items-center gap-1.5 rounded-[7px] border px-2 ${b}`,title:g,children:[f?(0,U.jsx)(fa.A,{className:"h-3 w-3 shrink-0 text-info","aria-hidden":!0}):null,n?(0,U.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${(0,tw.tz)(n.activity)}`}):null,h?(0,U.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px] font-bold",style:h.style,children:h.label}):null,(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate text-[10.5px] font-semibold",children:x}),p?(0,U.jsx)("span",{"aria-hidden":!0,children:"⚠"}):null,p&&t.launchId?(0,U.jsx)(kE,{icon:l?(0,U.jsx)(dR.A,{className:"h-3 w-3 animate-spin","aria-hidden":!0}):(0,U.jsx)(sg.A,{className:"h-3 w-3","aria-hidden":!0}),ariaLabel:a("tasks.retryLaunchAria",{title:x}),title:a("tasks.retryLaunch"),hoverClass:"hover:bg-black/5 hover:text-accent",disabled:l,onClick:()=>void c(),dataAttr:"data-task-retry-launch"}):null,(0,U.jsx)(kE,{icon:(0,U.jsx)(kT.A,{className:"h-3 w-3","aria-hidden":!0}),ariaLabel:m?a("tasks.openAgentAria",{title:x}):a("tasks.openAgentUnavailableAria",{title:x,reason:g??a("tasks.unhostedChip")}),title:m?a("tasks.openAgent"):g??a("tasks.openAgent"),hoverClass:"hover:bg-black/5 hover:text-accent",disabled:!m,onClick:()=>{n&&m&&i(n)},dataAttr:"data-task-open-agent"}),u?(0,U.jsx)(kE,{icon:(0,U.jsx)(K.A,{className:"h-3 w-3","aria-hidden":!0}),ariaLabel:a("tasks.detachAria",{title:x}),title:a("tasks.detach"),hoverClass:"hover:bg-black/5 hover:text-danger",onClick:()=>r(e,d)}):null]})}function kO({task:e,file:t,onOpen:n}){let{t:r}=(0,eh.Ym)(),i=e.source;if(!i)return null;let a=t?(0,tw.cr)(t.title,40):i.path.split("/").pop()??i.path,s=(0,tw.zZ)(i.engine);return(0,U.jsxs)("span",{className:"flex h-6 w-full min-w-0 items-center gap-1.5 rounded-[7px] border border-info/20 bg-info-soft px-2 text-info",title:`${r("tasks.sourceTitle")}: ${i.text}`,children:[(0,U.jsx)(fa.A,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),(0,U.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px] font-bold",style:s.style,children:s.label}),(0,U.jsx)("span",{className:"shrink-0 text-[10.5px] font-bold",children:r("tasks.source")}),(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate text-[10.5px] font-semibold",children:a}),(0,U.jsx)(kE,{icon:(0,U.jsx)(kT.A,{className:"h-3 w-3","aria-hidden":!0}),ariaLabel:t?r("tasks.openSourceAria",{title:a}):r("tasks.openSourceUnavailableAria",{title:a,reason:r("tasks.sourceGone")}),title:r(t?"tasks.openSource":"tasks.sourceGone"),hoverClass:"hover:bg-black/5 hover:text-accent",disabled:!t,onClick:()=>{t&&n(t)},dataAttr:"data-task-open-source"})]})}let kD=(0,Y.memo)(function({task:e,files:t,camRef:n,handlers:r,completedPipelines:i=[],onOpenPipelineHistory:a,selected:s=!1,expanded:l=!1}){let o,{t:c}=(0,eh.Ym)(),[d,u]=(0,Y.useState)(null),p=(0,Y.useRef)(null),[m,f]=(0,Y.useState)(null),[h,x]=(0,Y.useState)(!1),[g,b]=(0,Y.useState)(""),[v,w]=(0,Y.useState)(!1),[y,k]=(0,Y.useState)(!1),j=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{if(!y)return;let e=window.setTimeout(()=>k(!1),4e3);return()=>window.clearTimeout(e)},[y]),(0,Y.useEffect)(()=>{if(!h)return;let t=window.setTimeout(()=>{g.trim()&&g!==e.text&&r.patch(e.id,{text:g})},900);return()=>window.clearTimeout(t)},[h,g,e.id,e.text,r]);let N=()=>{if(x(!1),!g.trim()){g!==e.text&&(w(!0),oC("err",c("tasks.emptyTextBlocked")));return}w(!1),g!==e.text&&r.patch(e.id,{text:g})},S=()=>(h?!g.trim():!!v)&&(oC("err",c("tasks.emptyTextBlocked")),!0),C=d??(m&&m.seen===e.updatedAt?m:e.pos),A=gV[e.status],I=gG(e.text)||c("tasks.untitled"),M=e.text.includes("\n")?e.text.slice(e.text.indexOf("\n")+1):"",T=(0,Y.useRef)(null),P=(0,Y.useRef)(null),[$,E]=(0,Y.useState)(null);(0,Y.useLayoutEffect)(()=>{if(l||h)return;let e=()=>{let e=[T.current,P.current].filter(e=>null!==e);e.some(e=>e.clientHeight>0)&&E(e.some(e=>e.scrollHeight-e.clientHeight>1))};e();let t=!1;return document.fonts?.ready.then(()=>{t||e()}),()=>{t=!0}},[e.text,l,h]);let R=l||($??((o=bz(e.text)).title>2||o.rest>3)),O=!l&&R,D=(0,Y.useMemo)(()=>new Map(t.map(e=>[e.path,e])),[t]),L=(0,Y.useMemo)(()=>new Map(t.filter(e=>e.conversationId).map(e=>[e.conversationId,e])),[t]),_=h||null!==d,F=gm({onDrop:t=>S()?null:(r.handoff(e,t.file),c("tasks.linkHanded",{title:(0,tw.cr)(t.file.title,48)})),onMiss:()=>{S()||r.draft(e)}});return(0,U.jsxs)("div",{"data-scheme-task":e.id,className:`group absolute pb-9 ${_?"z-30":"z-[4]"}`,style:{transform:`translate(${C.x}px, ${C.y}px)`,width:260,transition:d?void 0:`transform 380ms ${y9}`},onPointerDown:e=>{if(0===e.button&&!h&&!e.target.closest("button, a, input, textarea, select, [data-task-pop]")){p.current={sx:e.clientX,sy:e.clientY,ox:C.x,oy:C.y,moved:!1};try{e.currentTarget.setPointerCapture(e.pointerId)}catch{}}},onPointerMove:e=>{let t=p.current;if(!t)return;let r=e.clientX-t.sx,i=e.clientY-t.sy;if(!t.moved&&4>Math.hypot(r,i))return;t.moved=!0;let a=n.current?.z??1;u({x:t.ox+r/a,y:t.oy+i/a})},onPointerUp:t=>{let i=p.current;if(p.current=null,i){if(i.moved){let a=n.current?.z??1,s={x:Math.round(i.ox+(t.clientX-i.sx)/a),y:Math.round(i.oy+(t.clientY-i.sy)/a)};u(null),f({...s,seen:e.updatedAt}),r.patch(e.id,{pos:s}).then(e=>{e&&f(null)});return}h||((n.current?.z??1)<.55&&r.center(bB(e,l)),b(e.text),x(!0),requestAnimationFrame(()=>{let e=j.current;e&&(e.focus(),e.setSelectionRange(e.value.length,e.value.length))}))}},children:[(0,U.jsxs)("div",{className:`relative flex flex-col overflow-hidden rounded-[10px] border border-border shadow-1 transition-shadow ${"done"===e.status?"opacity-60 saturate-50":""} ${_?"shadow-2":"group-hover:shadow-2"} ${h?"ring-2 ring-accent/50":s?"ring-2 ring-accent ring-offset-1 ring-offset-canvas":""}`,style:{backgroundColor:A.soft},children:[(0,U.jsx)("div",{"aria-hidden":!0,className:"h-1.5 w-full shrink-0",style:{backgroundColor:A.color}}),!h&&i.length?(0,U.jsx)("div",{className:"absolute right-2 top-2 z-[2] flex max-w-[92px] flex-col items-end gap-1",children:i.map(e=>(0,U.jsx)("button",{type:"button","data-task-pipeline-history":e.id,className:"max-w-full truncate rounded-[5px] bg-card/90 px-1.5 py-1 text-[9.5px] font-semibold text-success shadow-1 hover:bg-card focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":c("pipelineGroup.openHistory",{task:e.task}),title:e.task,onClick:()=>a?.(e),children:"✓ pipeline"},e.id))}):null,h?(0,U.jsx)("textarea",{ref:j,value:g,onChange:e=>b(e.target.value),onBlur:()=>{var e;return e=j.current,void(document.hasFocus()?N():window.addEventListener("focus",()=>e?.focus(),{once:!0}))},onKeyDown:e=>{"Escape"===e.key&&(e.preventDefault(),N())},"aria-label":c("tasks.editAria"),rows:Math.min(16,Math.max(3,g.split("\n").length+1)),className:"w-full resize-none bg-transparent px-3 py-2 text-[12.5px] leading-[17px] text-primary placeholder:text-muted focus-visible:outline-none",maxLength:6e3}):(0,U.jsxs)("div",{"data-task-body":!0,...O?{"data-task-clipped":""}:{},className:`cursor-text py-2 pl-3 ${i.length?"pr-[104px]":"pr-3"}`,style:O?{maskImage:k$,WebkitMaskImage:k$}:void 0,children:[(0,U.jsx)("div",{ref:T,className:`whitespace-pre-wrap break-words text-[12.5px] font-semibold leading-[17px] tracking-[-0.006em] text-primary ${l?"":"line-clamp-2"}`,children:I}),M.trim()?(0,U.jsx)("div",{ref:P,className:`whitespace-pre-wrap break-words text-[12.5px] leading-[17px] text-secondary ${l?"":"line-clamp-3"}`,children:M}):null]}),e.source||e.assignments.length?(0,U.jsxs)("div",{className:"flex flex-col gap-1 px-2 pb-2",children:[(0,U.jsx)(kO,{task:e,file:e.source?D.get(e.source.path)??null:null,onOpen:r.openAgent}),e.assignments.map((t,n)=>(0,U.jsx)(kR,{task:e,assignment:t,file:(e=>{if(e.conversationId){let t=L.get(e.conversationId);if(t)return t}return e.path?D.get(e.path)??null:null})(t),onDetach:(e,t)=>r.unassign(e,t),onOpen:r.openAgent},t.launchId??t.conversationId??t.path??(null!=t.panePid?`pane:${t.panePid}`:`index:${n}`)))]}):null,!h&&R?(0,U.jsx)("div",{className:"px-2 pb-2",children:(0,U.jsxs)("button",{type:"button","data-task-disclosure":!0,"aria-expanded":l,className:"flex h-6 w-full items-center justify-center gap-1 rounded-[7px] border border-border bg-card/60 text-[10.5px] font-semibold text-muted transition-colors hover:bg-card hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>r.toggleExpand(e.id),children:[l?(0,U.jsx)(ab.A,{className:"h-3 w-3","aria-hidden":!0}):(0,U.jsx)(av.A,{className:"h-3 w-3","aria-hidden":!0}),c(l?"tasks.collapse":"tasks.expand")]})}):null]}),(0,U.jsxs)("div",{"data-task-actions":!0,className:`absolute left-0 top-full flex -translate-y-8 items-center gap-1.5 ${_||l?"":"pointer-events-none opacity-0 group-hover:pointer-events-auto group-hover:opacity-100"} transition-opacity`,children:[(0,U.jsxs)("button",{type:"button",className:"inline-flex h-7 touch-none items-center gap-1 rounded-full border border-border bg-card px-2 text-[10.5px] font-semibold text-muted shadow-1 hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:c("tasks.sendTitle"),onPointerDown:F.onPillPointerDown,onClick:()=>{F.consumeClick()||S()||r.draft(e)},children:[(0,U.jsx)(fn.A,{className:"h-3 w-3","aria-hidden":!0})," ",c("tasks.send")]}),(0,U.jsxs)("button",{type:"button",className:"inline-flex h-7 items-center gap-1.5 rounded-full border px-2.5 text-[10.5px] font-bold shadow-1 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",style:{backgroundColor:A.soft,color:A.color,borderColor:A.color},title:c("tasks.statusTitle",{label:c(`tasks.status.${e.status}`)}),onClick:()=>{var t;let n;r.patch(e.id,{status:(t=e.status,n=gJ.indexOf(t),gJ[(n+1)%gJ.length])})},children:[(0,U.jsx)("span",{"aria-hidden":!0,className:"h-1.5 w-1.5 shrink-0 rounded-full",style:{backgroundColor:A.color}}),c(`tasks.status.${e.status}`)]}),r.collapse?(0,U.jsx)("button",{type:"button",className:"inline-flex h-7 items-center rounded-full border border-border bg-card px-2 text-[10.5px] font-semibold text-muted shadow-1 hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":c("taskStacks.collapse"),title:c("taskStacks.collapse"),onClick:()=>r.collapse(e),children:(0,U.jsx)(kP.A,{className:"h-3 w-3","aria-hidden":!0})}):null,(0,U.jsxs)("button",{type:"button",className:`inline-flex h-7 items-center gap-1 rounded-full border px-2 text-[10.5px] font-semibold shadow-1 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${y?"border-danger bg-danger text-white":"border-border bg-card text-muted hover:border-danger/40 hover:text-danger"}`,"aria-label":c("tasks.deleteAria",{title:I}),title:y?c("tasks.deleteConfirm"):c("tasks.delete"),onClick:()=>{y?(k(!1),r.remove(e.id)):k(!0)},children:[(0,U.jsx)(vW.A,{className:"h-3 w-3","aria-hidden":!0}),y?c("tasks.deleteConfirm"):null]})]}),F.overlay]})});function kL({project:e,pos:t,onCreated:n,onCancel:r}){let{t:i}=(0,eh.Ym)(),a=(0,Y.useRef)(()=>{}),s=vO(e,e=>a.current(e)),{composer:l}=s;(0,Y.useEffect)(()=>{l.inputRef.current?.focus()},[l.inputRef]);let o=async r=>{let a=(r??l.textRef.current).trim();if(!l.busy&&!l.voiceSending){if(!a)return void l.setStatus({kind:"err",text:i("tasks.composerNeedsText")});l.setBusy(!0),l.setStatus(null);try{let r=await nS({project:e,text:a,placement:"pinned",pos:t,dueAt:s.dueAt,dueTz:s.dueTz,attachments:s.stagedAttachments(),clientRequestId:s.getRequestId()});if("error"in r)return void l.setStatus({kind:"err",text:r.error});s.reset(),n(r.task)}finally{l.setBusy(!1)}}};return(0,Y.useEffect)(()=>{a.current=o}),(0,U.jsx)("div",{"data-scheme-task":"new","data-chip-keepout":!0,className:"absolute z-30",style:{transform:`translate(${t.x}px, ${t.y}px)`,width:260},children:(0,U.jsxs)("form",{onSubmit:e=>{e.preventDefault(),l.submit()},className:"flex flex-col gap-1.5 overflow-hidden rounded-[8px] border border-border bg-card p-2 shadow-1 ring-2 ring-accent/50",style:{backgroundColor:gV.inbox.soft},children:[(0,U.jsxs)("div",{className:"flex items-center justify-between",children:[(0,U.jsx)("span",{className:"text-[10.5px] font-bold text-muted",children:i("tasks.newTask")}),(0,U.jsx)("button",{type:"button","aria-label":i("common.close"),onClick:r,className:"inline-flex h-5 w-5 items-center justify-center rounded-[6px] text-muted hover:text-danger focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:(0,U.jsx)(K.A,{className:"h-3 w-3","aria-hidden":!0})})]}),(0,U.jsx)(vz,{draft:s,placeholder:i("tasks.newPlaceholder"),createLabel:i("tasks.panelCreate")})]})})}function k_({task:e,expanded:t}){let{t:n}=(0,eh.Ym)(),r=gV[e.status];return(0,U.jsxs)("div",{"data-scheme-task":e.id,className:`absolute overflow-hidden rounded-[8px] border border-border shadow-1 ${"done"===e.status?"opacity-60 saturate-50":""}`,style:{transform:`translate(${e.pos.x}px, ${e.pos.y}px)`,width:260,height:bH(e,t),backgroundColor:r.soft},children:[(0,U.jsx)("div",{"aria-hidden":!0,className:"h-1 w-full",style:{backgroundColor:r.color}}),(0,U.jsx)("div",{className:"px-3 py-2 text-[12.5px] font-bold leading-[17px] text-primary",children:(0,U.jsx)("span",{className:`${t?"":"line-clamp-4"} whitespace-pre-wrap break-words`,children:t?e.text:gG(e.text)||n("tasks.untitled")})})]})}let kF=(0,Y.memo)(function({tasks:e,files:t,project:n,interactive:r,lite:i,camRef:a,handlers:s,selectedTaskId:l,textExpandedIds:o,pending:c,onStickyCreated:d,onCreateCancel:u,completedPipelinesByTask:p,onOpenPipelineHistory:m}){return(0,U.jsxs)("div",{className:r?void 0:"pointer-events-none select-none",children:[e.map(e=>i?(0,U.jsx)(k_,{task:e,expanded:o.has(e.id)},e.id):(0,U.jsx)(kD,{task:e,files:t,camRef:a,handlers:s,completedPipelines:p?.get(e.id),onOpenPipelineHistory:m,selected:l===e.id,expanded:o.has(e.id)},e.id)),c&&!i?(0,U.jsx)(kL,{project:n,pos:c,onCreated:d,onCancel:u}):null]})});function kq(e,t,n){for(let r of t)if(e.x<r.x+r.w+n&&e.x+e.w+n>r.x&&e.y<r.y+r.h+n&&e.y+e.h+n>r.y)return!0;return!1}function kz(e,t,n){if(!kq(e,t,16)&&!kq(e,n,16))return{x:e.x,y:e.y};let r=e.w+16,i=e.h+16,a=null;for(let[s,l]of function(e,t){let n=[],r=Math.floor(1200/e),i=Math.floor(1200/t),a=Math.max(r,i);for(let e=1;e<=a;e++)for(let t=e;t>=-e;t--)for(let a=-e;a<=e;a++)Math.max(Math.abs(a),Math.abs(t))===e&&(Math.abs(a)>r||Math.abs(t)>i||n.push([a,t]));return n}(r,i)){let o=Math.round(e.x+s*r),c=Math.round(e.y+l*i),d={x:o,y:c,w:e.w,h:e.h};if(!kq(d,t,16)){if(!kq(d,n,16))return{x:o,y:c};a||(a={x:o,y:c})}}for(let i=0;i<4096;i+=1){let s=740+i%12*r,l=3200+640*Math.floor(i/12),o={x:s,y:l,w:e.w,h:e.h};if(!kq(o,t,16)){if(!kq(o,n,16))return{x:s,y:l};a||(a={x:s,y:l})}}return a??{x:e.x,y:e.y}}let kH="llvSchemeMode",kU=(e,t)=>Math.hypot(e.x-t.x,e.y-t.y);function kB(e,t,n){return e.nodes.length>0||e.drafts.length>0||(e.groups?.length??0)>0||(t?.size??0)>0||(n?.size??0)>0}function kK(e,t){let n=Math.min(1.6,Math.max(.12,Math.min((t.w-48)/e.w,(t.h-48)/e.h,1)));return{z:n,x:(t.w-e.w*n)/2-e.x*n,y:(t.h-e.h*n)/2-e.y*n}}let kY=(e,t,n,r)=>Math.min(t,r)-Math.max(e,n);function kW(e,t){let n=null;for(let r of e){let e=r.dp+t*r.ds;(!n||e<n.score-1e-9||1e-9>Math.abs(e-n.score)&&(r.ds<n.ds-1e-9||1e-9>Math.abs(r.ds-n.ds)&&r.key<n.key))&&(n={key:r.key,score:e,ds:r.ds})}return n?.key??null}let kV=(e,t)=>({x:(e.x+e.w/2)*t.z+t.x,y:(e.y+e.h/2)*t.z+t.y}),kJ=new Set,kG=new Map;function kQ({active:e,title:t,onClick:n,children:r}){return(0,U.jsx)("button",{className:`inline-flex h-7 w-7 items-center justify-center rounded-[8px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${e?"bg-accent/10 text-accent":"text-muted hover:bg-canvas hover:text-primary"}`,title:t,"aria-label":t,"aria-pressed":e,onClick:n,children:r})}function kX({project:e,groups:t,manual:n,files:r,flows:i,reviewGroups:a=[],pipelines:s=[],tasks:l,allTasks:o=l,workerStacks:c=[],surfacePipelines:d=[],now:u=0,drafts:p,favorites:m,isolatedManualPaths:f=kJ,focus:h,ring:x,attentionPaths:g,trayApi:b,onSelect:v,onNodePick:w,mapFrame:y,onClose:k,onDraftClose:j,onDraftSpawned:N,onHandoff:S,onSpawnRetry:C,onTaskDraft:A,onOpenTask:I,onTaskCollapse:M,placeTaskId:T,onTaskPlaced:P,newTaskNonce:$,builderPipelineId:E,onBuilderOpened:R}){var O,D,L;let _,F,{t:q}=(0,eh.Ym)(),z=!!w,[H,B]=(0,Y.useState)(null),[K,V]=(0,Y.useState)(0),J=(0,Y.useMemo)(()=>(function(e=()=>void 0){let t=new Map;return{anchorFor:(e,n)=>t.get(e)?.get(n)??null,replace(n,r){let i=new Map(r),a=!function(e,t){if(!e||e.size!==t.size)return!1;for(let[n,r]of t){let t=e.get(n);if(!t||t.x!==r.x||t.y!==r.y)return!1}return!0}(t.get(n),i);return t.set(n,i),a&&e(),()=>{t.get(n)===i&&(t.delete(n),e())}}}})(()=>V(e=>e+1)),[]),[G,Q]=(0,Y.useState)(null),X=E??G,Z=(0,Y.useCallback)(()=>{Q(null),R?.()},[R]),ee=(0,Y.useCallback)(e=>{Q(e.id)},[]),et=it(e),en=et.selection,er=et.selectionArmed;(0,Y.useEffect)(()=>{h&&B(h)},[h]);let ei=(0,Y.useMemo)(()=>a.length?[...i,...a]:i,[i,a]),ea=(0,Y.useMemo)(()=>xk(s,ei),[s,ei]),[es,el]=(0,Y.useState)([]),[eo,ec]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{let t=new Set(l.map(e=>e.id));el(n=>{let r=n.filter(n=>!t.has(n.id)&&n.project===e);return r.length===n.length?n:r})},[l,e]);let ed=(0,Y.useMemo)(()=>{let t=new Set(l.map(e=>e.id)),n=es.filter(n=>!t.has(n.id)&&n.project===e);return n.length?[...l,...n]:l},[l,es,e]),[eu,ep]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{let e=new Set(ed.map(e=>e.id));ep(t=>[...t].some(t=>!e.has(t))?new Set([...t].filter(t=>e.has(t))):t)},[ed]);let em=(0,Y.useMemo)(()=>ed.filter(b_),[ed]),ef=(0,Y.useMemo)(()=>vt(t,n,r,ea,p,s,d,m,f,em,eu,{now:u}),[t,n,r,ea,p,s,d,m,f,em,eu,u]),eg=!z&&(er||en.size>0),eb=(0,Y.useRef)(et);(0,Y.useEffect)(()=>{eb.current=et});let ev=(0,Y.useCallback)(()=>eb.current.clearSelection(),[]),ew=(0,Y.useCallback)(e=>eb.current.toggleSelection(e),[]),ey=(0,Y.useRef)(H);(0,Y.useEffect)(()=>{ey.current=H},[H]);let ek=(0,Y.useCallback)((e,t)=>{if(null===e){B(null),ev();return}if(t&&ef.byPath.has(e)&&ef.nodes.some(t=>t.file.path===e)){B(null);let t=ey.current;t&&t!==e&&ef.nodes.some(e=>e.file.path===t)&&eb.current.commitSelection([t],!0),eb.current.toggleSelection(e);return}B(e)},[ef,ev]),ej=(0,Y.useMemo)(()=>e6(i),[i]),eN=(0,Y.useMemo)(()=>(function(e){let t=new Map;for(let n of e){let e=function(e){if("closed"===e.state)return null;let t=e.cursor?.stageId??e.stages.at(-1)?.id??null;if(!t)return null;let n=e.stages.find(e=>e.id===t);return n&&"review-loop"!==n.kind?xc(e,t)?.agentPath??null:null}(n);e&&t.set(e,n)}return t})(s),[s]),eS=(0,Y.useMemo)(()=>xL(s),[s]),[eC,eA]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{eA(null)},[e]);let eI=(O=ef.nodes,eC?O.find(e=>e.file.path===eC)??O.find(e=>e.file.predecessorPath===eC)??null:null),eM=null!==eI;(0,Y.useEffect)(()=>{eI&&eI.file.path!==eC&&eA(eI.file.path)},[eI,eC]),(0,Y.useEffect)(()=>{if(!eM)return;let e=e=>{if("Escape"!==e.key)return;let t=e.target;t&&(["INPUT","TEXTAREA","SELECT"].includes(t.tagName)||t.isContentEditable)||(e.preventDefault(),e.stopPropagation(),eA(null))};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[eM]);let[eT,eP]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{let e=e=>{if("F2"!==e.key)return;let t=e.target;if(t&&(["INPUT","TEXTAREA","SELECT"].includes(t.tagName)||t.isContentEditable))return;let n=ey.current;if(!n)return;let r=ef.nodes.find(e=>e.file.path===n);r?.file.renamable&&(e.preventDefault(),eA(n),eP(e=>({path:n,token:(e?.token??0)+1})))};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[ef]),(0,Y.useEffect)(()=>{eP(e=>e&&e.path!==eC?null:e)},[eC]);let[e$,eE]=(0,Y.useState)(null),eR=(0,Y.useCallback)((e,t)=>{eE(n=>({flowId:e,round:t,nonce:(n?.nonce??0)+1}))},[]),eO=x??h,eD=(0,Y.useRef)(v),eL=(0,Y.useRef)(w),e_=(0,Y.useRef)(k),eF=(0,Y.useRef)(j),eq=(0,Y.useRef)(N),ez=(0,Y.useRef)(S),eH=(0,Y.useRef)(C),eU=(0,Y.useRef)(A),eB=(0,Y.useRef)(I),eK=(0,Y.useRef)(M);(0,Y.useEffect)(()=>{eD.current=v,eL.current=w,e_.current=k,eF.current=j,eq.current=N,ez.current=S,eH.current=C,eU.current=A,eB.current=I,eK.current=M});let eY=(0,Y.useCallback)(e=>{let t=eL.current;t?t(e.path):eD.current(e)},[]),eW=(0,Y.useCallback)(e=>e_.current(e),[]),eV=(0,Y.useCallback)(e=>eF.current(e),[]),eJ=(0,Y.useCallback)((e,t)=>eq.current(e,t),[]),eG=(0,Y.useCallback)(e=>ez.current?.(e),[]),eQ=(0,Y.useCallback)(e=>eH.current?.(e),[]),eX=(0,Y.useCallback)(e=>eB.current?.(e),[]),eZ=(0,Y.useCallback)(e=>eA(e),[]),e0=(0,Y.useCallback)(e=>{let t=r.find(t=>t.path===e);t&&eY(t)},[r,eY]),e1=(0,Y.useCallback)(e=>{let t=i.find(t=>t.id===e);t&&eR(t.id,t.rounds.at(-1)?.n??1)},[i,eR]),e2=(0,Y.useMemo)(()=>new Set(r.map(e=>e.path)),[r]),e5=(0,Y.useMemo)(()=>new Set(ef.nodes.map(e=>e.file.path)),[ef]),e4=(0,Y.useMemo)(()=>xA(ea,e5),[ea,e5]),e3=(0,Y.useMemo)(()=>new Map(s.map(e=>[e.id,xN(e,o,i,r)])),[s,o,i,r]),e8=(0,Y.useMemo)(()=>{let e=new Map;for(let t of s)if(("completed"===t.state||"closed"===t.state)&&xP(t,i,e4,e2,r))for(let n of e3.get(t.id)??[]){let r=e.get(n.id)??[];r.push(t),e.set(n.id,r)}return e},[s,e3,i,e4,e2,r]),e7=(0,Y.useCallback)(e=>{let t=xP(e,i,e4,e2,r);t?.kind==="path"?e0(t.path):t?.kind==="flow"&&e1(t.flowId)},[i,e4,e2,r,e0,e1]),e9=(0,Y.useMemo)(()=>c.map(e=>({key:e.key,color:yj[e.kind]})),[c]),tt=(0,Y.useRef)(eg);(0,Y.useEffect)(()=>{tt.current=eg},[eg]);let tn=(0,Y.useRef)(!1),tr=(0,Y.useCallback)((e,t)=>{if(tn.current)return tn.current=!1,!0;if(!tt.current)return B(null),!0;let n=yy(ef.nodes,{x:e,y:t,w:0,h:0});return n.length?ew(n[0]):ev(),!0},[ef,ew,ev]),ti=(0,Y.useRef)(()=>!1),ta=(0,Y.useMemo)(()=>[...ef.nodes,...ef.decks,...ef.stacks,...ef.drafts,...ef.slots,...ef.regionTasks].map(({x:e,y:t,w:n,h:r})=>({x:e,y:t,w:n,h:r})),[ef]),ts=(0,Y.useMemo)(()=>[...ef.nodes,...ef.decks,...ef.stacks,...ef.drafts,...ef.slots],[ef]),tl=(0,Y.useMemo)(()=>new Map(ef.regionTasks.map(e=>[e.taskId,{x:e.x,y:e.y}])),[ef]),to=(0,Y.useMemo)(()=>(function(e,t,n){let r=e.map(e=>{let t=n?.has(e.id)??!1;return{id:e.id,createdAt:e.createdAt,x:e.pos.x,y:e.pos.y,w:260,h:bU(e,t),auto:!t&&!!e.source&&function(e){let t,n;if(null!==(t=(e.x-740)/300,n=(e.y-120)/120,!Number.isInteger(t)||t<0||!Number.isInteger(n)||n<0||n>=24?null:48*Math.floor(t/2)+2*n+t%2))return!0;let r=740===e.x||1040===e.x,i=e.y-120;return r&&i>=0&&i%120==0}(e.pos),expanded:t}}),i=(e,t)=>e.createdAt<t.createdAt?-1:e.createdAt>t.createdAt?1:e.id.localeCompare(t.id),a=[],s=[],l=new Map,o=(e,t)=>{l.set(e.id,t);let n={x:t.x,y:t.y,w:e.w,h:e.h};a.push(n),e.expanded&&s.push(n)};for(let e of r.filter(e=>e.expanded).sort(i))o(e,kz(e,a,t));for(let e of r.filter(e=>!e.expanded&&!e.auto).sort(i)){let n=kq(e,s,16)?kz(e,a,t):{x:e.x,y:e.y};o(e,n)}for(let e of r.filter(e=>e.auto).sort(i))o(e,kz(e,a,t));return l})(em.filter(e=>!tl.has(e.id)),ta,eu),[em,tl,ta,eu]),tc=(0,Y.useMemo)(()=>em.map(e=>{let t=tl.get(e.id)??to.get(e.id);return t&&(t.x!==e.pos.x||t.y!==e.pos.y)?{...e,pos:t}:e}),[em,tl,to]),td=(0,Y.useMemo)(()=>new Map(tc.map(e=>["task::"+e.id,bB(e,eu.has(e.id))])),[tc,eu]),tu=(0,Y.useMemo)(()=>new Map(tc.map(e=>[`task::${e.id}`,gG(e.text)||q("tasks.untitled")])),[tc,q]),tp=(0,Y.useMemo)(()=>(function(e,t=[],n=[]){let r=new Map,i=new Map(t.map(e=>[e.id,e])),a=({x:e,y:t,w:n,h:r})=>({x:e,y:t,w:n,h:r});for(let t of e.groups??[])if(t.pipeline)for(let e of(t.pipeline.srcPath&&r.set(t.pipeline.srcPath,a(t)),t.pipeline.runs))for(let s of e.attempts){s.agentPath&&r.set(s.agentPath,a(t));let e=s.flowId?i.get(s.flowId):null;if(e)for(let i of(r.set(e.implementerPath,a(t)),e.rounds))for(let{path:s}of te(e,i,n))r.set(s,a(t))}for(let t of e.stacks)for(let e of t.items)r.set(e.file.path,a(t));for(let t of e.decks)for(let e of t.rounds){let n=e.file?.path??e.round.reviewerPath;n&&r.set(n,a(t))}for(let t of e.nodes)for(let e of t.under)r.set(e.path,a(t));for(let t of e.nodes)r.set(t.file.path,a(t));return r})(ef,i,r),[ef,i,r]),tm=(0,Y.useMemo)(()=>(function(e,t,n,r=[]){let i=new Map;for(let e of r)e.conversationId&&i.set(e.conversationId,e.path);let a=[];for(let r of e){let e=bB(r,n?.has(r.id)??!1),s=bK(e);if(r.source){let n=t.get(r.source.path);if(n){let t=bY(e,bK(n)),i=bY(n,s);a.push({key:r.id+"::source::"+r.source.path,taskId:r.id,relation:"source",path:r.source.path,x1:t.x,y1:t.y,x2:i.x,y2:i.y,status:r.status,failed:!1,error:null})}}let l=new Set;for(let n of r.assignments){let o=(n.conversationId?i.get(n.conversationId):void 0)??n.path;if(!o||l.has(o))continue;let c=t.get(o);if(!c)continue;l.add(o);let d=bY(e,bK(c)),u=bY(c,s);a.push({key:r.id+"::"+o,taskId:r.id,relation:"assignment",path:o,x1:d.x,y1:d.y,x2:u.x,y2:u.y,status:r.status,failed:"failed"===n.state,error:n.error})}}return a})(tc,tp,eu,r),[tc,tp,eu,r]),tf=(0,Y.useMemo)(()=>tc.map(e=>({id:e.id,...bB(e,eu.has(e.id))})),[tc,eu]),th=(0,Y.useMemo)(()=>{let e,t,n,r;return e=Math.round,t=tm.map(t=>`${t.key}:${e(t.x1)},${e(t.y1)},${e(t.x2)},${e(t.y2)}`).join(";"),n=tf.map(t=>`${t.id}:${e(t.x)},${e(t.y)},${e(t.w)},${e(t.h)}`).join(";"),r=ta.map(t=>`${e(t.x)},${e(t.y)},${e(t.w)},${e(t.h)}`).join(";"),`${t}|${n}|${r}`},[tm,tf,ta]),tx=(0,Y.useMemo)(()=>(function(e,t,n){let r=new Map,i=new Set;for(let t of function(e){let t=e.map((e,t)=>t),n=e=>{for(;t[e]!==e;)t[e]=t[t[e]],e=t[e];return e};for(let r=0;r<e.length;r++)for(let i=r+1;i<e.length;i++)(function(e,t){let n=e.x2-e.x1,r=e.y2-e.y1,i=Math.hypot(n,r),a=t.x2-t.x1,s=t.y2-t.y1,l=Math.hypot(a,s);if(0===i||0===l)return!1;let o=n/i,c=r/i,d=a/l,u=s/l;if(Math.abs(o*u-c*d)>.02||b0(t.x1,t.y1,e.x1,e.y1,o,c)>1.5||b0(t.x2,t.y2,e.x1,e.y1,o,c)>1.5||b0(e.x1,e.y1,t.x1,t.y1,d,u)>1.5||b0(e.x2,e.y2,t.x1,t.y1,d,u)>1.5)return!1;let p=(t,n)=>(t-e.x1)*o+(n-e.y1)*c,m=Math.min(0,i),f=Math.max(0,i),h=Math.min(p(t.x1,t.y1),p(t.x2,t.y2));return Math.min(f,Math.max(p(t.x1,t.y1),p(t.x2,t.y2)))-Math.max(m,h)>8})(e[r],e[i])&&(t[n(r)]=n(i));let r=new Map;return e.forEach((e,t)=>{let i=n(t),a=r.get(i);a?a.push(e):r.set(i,[e])}),[...r.values()].map(e=>e.sort((e,t)=>e.key<t.key?-1:+(e.key>t.key)))}(e))if(!function(e,t){var n;let r,i,a,s=(a=Math.hypot(r=(n=e[0]).x2-n.x1,i=n.y2-n.y1)||1,(Math.abs(r/=a)>=Math.abs(i/=a)?r<0:i<0)?{x:-r,y:-i}:{x:r,y:i});e.forEach((e,n)=>t.set(e.key,(0===n?0:n%2==1?(n+1)/2:-(n/2))*((e.x2-e.x1)*s.x+(e.y2-e.y1)*s.y>=0?1:-1)))}(t,r),t.length>1)for(let e of t)i.add(e.key);let a=new Map(e.map(e=>[e.key,e])),s=new Map,l=(e,r)=>{let i=bQ(e,bZ(e,t,n),r),a=b1(i.d);s.set(e.key,{route:i,cubics:a,box:b5(a)})};for(let t of e)l(t,r.get(t.key)??0);let o=[...e].sort((e,t)=>e.key<t.key?-1:+(e.key>t.key)),c=(e,t,n)=>{let r=a.get(e),i=0;for(let[l,o]of s)l!==e&&b4(n,o.box)&&b7(t,o.cubics,b3(r,a.get(l)))&&i++;return i};if(e.length<=48)for(let e=0;e<2;e++){let e=!1;for(let a of o){if(i.has(a.key))continue;let l=s.get(a.key),o=c(a.key,l.cubics,l.box);if(0===o||o>4)continue;let d=bZ(a,t,n),u=r.get(a.key)??0,p=l,m=+!!l.route.crosses;for(let e of b9){let t=bQ(a,d,u+e),n=+!!t.crosses;if(n>m)continue;let r=b1(t.d),i=b5(r),s=c(a.key,r,i);(n<m||s<o)&&(p={route:t,cubics:r,box:i},m=n,o=s)}p!==l&&(s.set(a.key,p),e=!0)}if(!e)break}{let e=[],i=t=>e.some(e=>e.axis===t.axis&&25>Math.abs(e.pos-t.pos)&&Math.min(e.hi,t.hi)>Math.max(e.lo,t.lo));for(let a of o){let l=s.get(a.key).route.corridor;if(l&&i(l)){let e=r.get(a.key)??0,o=bZ(a,t,n);for(let t=1;t<=48;t++){let n=bQ(a,o,e+t);if(!n.crosses&&(!n.corridor||!i(n.corridor))){let e=b1(n.d);s.set(a.key,{route:n,cubics:e,box:b5(e)}),l=n.corridor;break}}}l&&e.push(l)}}let d=new Set;for(let e=0;e<o.length;e++)for(let t=e+1;t<o.length;t++){let n=o[e],r=o[t],i=s.get(n.key),a=s.get(r.key);b4(i.box,a.box)&&b7(i.cubics,a.cubics,b3(n,r))&&d.add(n.key<r.key?r.key:n.key)}let u=new Map;for(let[e,t]of s)u.set(e,d.has(e)&&!t.route.crosses?{...t.route,crosses:!0}:t.route);return u})(tm,tf,ta),[th]),tg=(0,Y.useMemo)(()=>{let e=[...td.values()],t=function(e){let t=1/0,n=1/0,r=-1/0,i=-1/0,a=!1,s=(e,a)=>{e<t&&(t=e),e>r&&(r=e),a<n&&(n=a),a>i&&(i=a)};for(let t of e){a=!0;let e=t.d.replace(/[MC,]/g," ").trim().split(/\s+/).map(Number);for(let t=0;t+1<e.length;t+=2)s(e[t],e[t+1]);s(t.mid.x,t.mid.y)}return a?{x:t-14,y:n-14,w:r-t+28,h:i-n+28}:null}(tx.values());return t&&e.push(t),function(e,t,n){let r=0,i=0,a=e,s=t;for(let e of n)r=Math.min(r,e.x-140),i=Math.min(i,e.y-140),a=Math.max(a,e.x+e.w+140),s=Math.max(s,e.y+e.h+140);return{x:r,y:i,w:a-r,h:s-i}}(ef.width,ef.height,e)},[ef.width,ef.height,td,tx]),tb=(0,Y.useMemo)(()=>{let e=function(e,t,n,r=yc){return yp(ym(e,t,n,r))}(ef,tc,m??kJ,eu);return yp([...e?[e]:[]])},[ef,tc,m,eu]),tv=(0,Y.useMemo)(()=>ym(ef,tc,m??kJ,eu).length,[ef,tc,m,eu]),ty=(0,Y.useMemo)(()=>(function(e,t){let n=[];for(let t of e.groups){if(!yu(t))continue;let e=t.pipeline?"needs_decision"===t.pipeline.state||"paused"===t.pipeline.state:t.flow?.state==="needs_decision"||t.flow?.state==="paused";n.push({key:t.key,label:t.label,rect:t,priority:e?5:3,color:`hsl(${t.hue} 62% 42%)`})}for(let r of e.nodes)(r.isRoot&&t.has(W(r.file))||yd(r.file))&&n.push({key:r.file.path,label:(0,tw.cr)(r.file.title),rect:r,priority:yd(r.file)?4:2,color:"codex"===r.file.engine?"var(--color-codex)":"var(--color-claude)"});return n})(ef,m??kJ),[ef,m]),tk=(0,Y.useMemo)(()=>v0(r,o),[r,o]),[tj,tN]=(0,Y.useState)(""),tS=(0,Y.useCallback)(e=>{let t="current"===e?tv:ef.nodes.length+ef.drafts.length+ef.groups.length+ef.stacks.length+ef.decks.length+tc.length;tN(q("current"===e?"scheme.framedCurrent":"scheme.framedAll",{count:t}))},[tv,ef.nodes.length,ef.drafts.length,ef.groups.length,ef.stacks.length,ef.decks.length,tc.length,q]),tC=(0,Y.useRef)(T??null);(0,Y.useEffect)(()=>{tC.current=T??null},[T]);let tA=(0,Y.useCallback)((e,t)=>{let n={x:Math.round(e-130),y:Math.round(t-14)},r=tC.current;if(r){tC.current=null,nT(r,{placement:"pinned",pos:n}).then(e=>{e&&oC("err",e)}),P?.();return}ec(n)},[P]),tI=(0,Y.useRef)(()=>!1),tM=(0,Y.useRef)(()=>!1),{cam:tT,vp:tP,viewportRef:t$,handLike:tE,taskTool:tR,setTaskTool:tO,centerOn:tD,panning:tL,glide:t_,setMode:tF,onPointerDown:tq,onPointerMove:tz,onDoubleClick:tH,onClick:tU,zoomCenter:tB,zoomTo:tK,fit:tY,fitCurrent:tW,fitRect:tV,jump:tJ,manualNonce:tG,glideBy:tQ,glideFrame:tX,glideToCamera:tZ}=function({project:e,layout:t,world:n,currentWork:r=null,mapMode:i,focus:a,onNodePick:s,setSelected:l,onBackgroundDown:o,onWorldTap:c,taskRects:d,pipelineRects:u,onPlaceTask:p,onArrowNav:m,onZoomKey:f,onFit:h}){let x=(0,Y.useRef)(null),g=(0,Y.useRef)(null),[b,v]=(0,Y.useState)({x:0,y:0,z:.5}),[w,y]=(0,Y.useState)("select"),[k,j]=(0,Y.useState)(!1),[N,S]=(0,Y.useState)(!1),[C,A]=(0,Y.useState)(!1),[I,M]=(0,Y.useState)(!1),[T,P]=(0,Y.useState)({w:1,h:1}),[$,E]=(0,Y.useState)(0),R=(0,Y.useRef)(null),O=(0,Y.useRef)(!1),D=(0,Y.useRef)(!1),L=(0,Y.useRef)(null),_=(0,Y.useRef)(new Map),F=(0,Y.useRef)(null),q=(0,Y.useRef)(w),z=(0,Y.useRef)(N),H=(0,Y.useRef)(k),U=(0,Y.useRef)(p),B=(0,Y.useRef)(null),K=(0,Y.useRef)(null),W=(0,Y.useRef)(b);(0,Y.useEffect)(()=>{W.current=b},[b]),(0,Y.useEffect)(()=>{q.current=w},[w]),(0,Y.useEffect)(()=>{z.current=N},[N]),(0,Y.useEffect)(()=>{H.current=k},[k]),(0,Y.useEffect)(()=>{U.current=p}),(0,Y.useEffect)(()=>{let e=localStorage.getItem(kH);"hand"===e||"select"===e?y(e):window.matchMedia("(pointer: coarse)").matches&&y("hand")},[]);let V=(0,Y.useCallback)(e=>{j(!1),y(e),localStorage.setItem(kH,e)},[]);(0,Y.useEffect)(()=>{let e=x.current;if(!e)return;let t=new ResizeObserver(()=>{let t=e.getBoundingClientRect();P({w:Math.max(1,t.width),h:Math.max(1,t.height)})});return t.observe(e),()=>t.disconnect()},[]);let J=(0,Y.useCallback)(e=>{let t=Math.min(Math.max(e.x,120-(n.x+n.w)*e.z),T.w-120-n.x*e.z),r=Math.min(Math.max(e.y,120-(n.y+n.h)*e.z),T.h-120-n.y*e.z);return t===e.x&&r===e.y?e:{...e,x:t,y:r}},[n,T]),G=(0,Y.useRef)([]),Q=(0,Y.useRef)(null),X=(0,Y.useCallback)(e=>{G.current.push(e),null==Q.current&&(Q.current=requestAnimationFrame(()=>{Q.current=null;let e=G.current;G.current=[],v(t=>e.reduce((e,t)=>t(e),t))}))},[]);(0,Y.useEffect)(()=>()=>{null!=Q.current&&cancelAnimationFrame(Q.current)},[]);let Z=(0,Y.useCallback)((e,t,n)=>{X(r=>{let i=Math.min(1.6,Math.max(.12,r.z*n));if(i===r.z)return r;let a=i/r.z;return J({z:i,x:e-(e-r.x)*a,y:t-(t-r.y)*a})})},[J,X]),ee=(0,Y.useCallback)(e=>{let t=x.current?.getBoundingClientRect();t&&Z(t.width/2,t.height/2,e)},[Z]),et=(0,Y.useCallback)(e=>{let t=x.current?.getBoundingClientRect();t&&v(n=>{let r=Math.min(1.6,Math.max(.12,e));if(r===n.z)return n;let i=r/n.z,a=t.width/2,s=t.height/2;return J({z:r,x:a-(a-n.x)*i,y:s-(s-n.y)*i})})},[J]),en=(0,Y.useCallback)(()=>{let e=x.current?.getBoundingClientRect();return e&&kB(t,d,u)?kK(n,{w:e.width,h:e.height}):null},[t.nodes.length,t.drafts.length,t.groups.length,d,u,n]),er=(0,Y.useCallback)(e=>{"u">typeof matchMedia&&matchMedia("(prefers-reduced-motion: reduce)").matches||M(!0),v(e),B.current&&window.clearTimeout(B.current),B.current=window.setTimeout(()=>M(!1),500)},[]);(0,Y.useEffect)(()=>()=>{B.current&&window.clearTimeout(B.current)},[]);let ei=(0,Y.useCallback)(()=>{let e=en();e&&(er(e),h?.("all"))},[en,er,h]),ea=(0,Y.useCallback)(()=>{let e=x.current?.getBoundingClientRect();return e&&kB(t,d,u)?kK(r??n,{w:e.width,h:e.height}):null},[r,n,t,d,u]),es=(0,Y.useCallback)(()=>{let e=ea();e&&(er(J(e)),h?.(r?"current":"all"))},[ea,er,J,h,r]),el=(0,Y.useCallback)(()=>{var e;let t=ea();if(!t)return;let n=J(t);r&&(e=W.current,Math.abs(e.z-n.z)<=.01*n.z&&4>=Math.abs(e.x-n.x)&&4>=Math.abs(e.y-n.y))?ei():(W.current=n,er(n),h?.(r?"current":"all"))},[ea,r,J,ei,er,h]),eo=(0,Y.useCallback)(e=>{let t=x.current?.getBoundingClientRect();!t||e.w<=0||e.h<=0||er(J(kK(e,{w:t.width,h:t.height})))},[er,J]),ec=(0,Y.useCallback)((e,t)=>{let n=x.current?.getBoundingClientRect();n&&er(r=>{let i=Math.min(1.6,Math.max(r.z,t));return{z:i,x:n.width/2-(e.x+e.w/2)*i,y:Math.min(n.height/2-e.y*i,.08*n.height-(e.y-40)*i)}})},[er]),ed=(0,Y.useCallback)((e,t)=>{er(n=>J({...n,x:n.x-e*n.z,y:n.y-t*n.z}))},[er,J]),eu=(0,Y.useCallback)(e=>{er(J({x:e.x,y:e.y,z:e.zoom}))},[er,J]),ep=(0,Y.useCallback)((e,t)=>{let n=x.current?.getBoundingClientRect();if(!n)return;let r=Math.min(1.6,Math.max(.12,t));er(J({z:r,x:n.width/2-(e.x+e.w/2)*r,y:Math.min(n.height/2-e.y*r,.08*n.height-(e.y-40)*r)}))},[er,J]);(0,Y.useEffect)(()=>{if(K.current===e||!kB(t,d,u))return;if(K.current=e,!i)try{let t=sessionStorage.getItem("llvCam:"+e);if(t){let e=JSON.parse(t);if(Number.isFinite(e.x)&&Number.isFinite(e.y)&&Number.isFinite(e.z)&&e.z>=.12&&e.z<=1.6)return void v(e)}}catch{}let n=i?en():ea();n&&v(n)},[e,t,d,u,en,ea,i]),(0,Y.useEffect)(()=>{if(i||K.current!==e)return;let t=window.setTimeout(()=>sessionStorage.setItem("llvCam:"+e,JSON.stringify(b)),300);return()=>window.clearTimeout(t)},[b,e,i]);let em=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{if(!a){em.current=null;return}if(em.current===a)return;let e=t.byPath.get(a)??d?.get(a);e&&(em.current=a,ec(e,.55))},[a,t,d,ec]),(0,Y.useEffect)(()=>{let e=x.current;if(!e)return;let t=()=>{L.current&&window.clearTimeout(L.current),L.current=window.setTimeout(()=>E(e=>e+1),250)},n=n=>{if(n.target.closest("[data-scheme-ui]"))return;let r=e.getBoundingClientRect();if(n.ctrlKey||n.metaKey){n.preventDefault(),Z(n.clientX-r.left,n.clientY-r.top,Math.exp(-(.0022*n.deltaY))),t();return}if("select"===q.current&&!z.current){for(let t=n.target;t&&t!==e;t=t.parentElement)if(t.scrollHeight>t.clientHeight+1){let e=getComputedStyle(t).overflowY;if("auto"===e||"scroll"===e)return}}n.preventDefault();let i=n.shiftKey&&!n.deltaX?n.deltaY:n.deltaX,a=n.shiftKey&&!n.deltaX?0:n.deltaY;X(e=>J({...e,x:e.x-i,y:e.y-a})),t()};return e.addEventListener("wheel",n,{passive:!1}),()=>{e.removeEventListener("wheel",n),L.current&&window.clearTimeout(L.current)}},[Z,J,X]),(0,Y.useEffect)(()=>{let e=e=>{var t;if(e.key.startsWith("Arrow")){if(e.metaKey||e.ctrlKey||e.altKey)return;m?.current?.(e)&&e.preventDefault();return}if(!((t=e.target)&&t.tagName&&(["INPUT","TEXTAREA","SELECT","BUTTON"].includes(t.tagName)||t.isContentEditable))){if(" "===e.key){e.preventDefault(),e.repeat||S(!0);return}!e.metaKey&&!e.ctrlKey&&!e.altKey&&("h"===e.key||"H"===e.key?V("hand"):"v"===e.key||"V"===e.key?V("select"):"t"===e.key||"T"===e.key?U.current&&j(!0):"Escape"===e.key?H.current?j(!1):l(null):"0"===e.key?e.shiftKey?ei():el():"1"===e.key?et(1):"+"===e.key||"="===e.key?f?.current?.(1)||ee(1.25):"-"!==e.key||f?.current?.(-1)||ee(.8))}},t=e=>{" "===e.key&&S(!1)};return window.addEventListener("keydown",e),window.addEventListener("keyup",t),()=>{window.removeEventListener("keydown",e),window.removeEventListener("keyup",t)}},[ei,el,ee,et,V,l,m,f]);let ef=e=>{let t=x.current?.getBoundingClientRect();return t?{x:e.clientX-t.left,y:e.clientY-t.top}:{x:e.clientX,y:e.clientY}},eh=e=>{R.current={sx:e.clientX,sy:e.clientY,cx:b.x,cy:b.y},O.current=!1,A(!0);try{x.current?.setPointerCapture(e.pointerId)}catch{}};(0,Y.useEffect)(()=>{let e=e=>{_.current.delete(e.pointerId),_.current.size<2&&(F.current=null,D.current&&(D.current=!1,E(e=>e+1))),R.current&&O.current&&E(e=>e+1),O.current=!1,R.current=null,A(!1)};return window.addEventListener("pointerup",e),window.addEventListener("pointercancel",e),()=>{window.removeEventListener("pointerup",e),window.removeEventListener("pointercancel",e)}},[]);let ex=i||"hand"===w||N,eg=(0,Y.useCallback)((e,t)=>v(n=>J({...n,x:T.w/2-e*n.z,y:T.h/2-t*n.z})),[T,J]);return{cam:b,vp:T,viewportRef:x,mode:w,setMode:V,handLike:ex,taskTool:k,setTaskTool:j,centerOn:ec,panning:C,glide:I,onPointerDown:e=>{let t=e.target;if(!t.closest("[data-scheme-ui]")){if(i&&e.isPrimary&&(g.current={x:e.clientX,y:e.clientY}),"touch"===e.pointerType&&(_.current.set(e.pointerId,ef(e)),2===_.current.size)){let[e,t]=[..._.current.values()];F.current={d:kU(e,t),cx:(e.x+t.x)/2,cy:(e.y+t.y)/2},D.current=!0,R.current=null,A(!1);return}if(1===e.button){e.preventDefault(),eh(e);return}if(0===e.button){if(k&&!i&&U.current){let t=x.current?.getBoundingClientRect();if(t){e.preventDefault(),U.current((e.clientX-t.left-b.x)/b.z,(e.clientY-t.top-b.y)/b.z),j(!1),V("select");return}}if(!(i||"hand"===w||N)){if(t.closest("[data-scheme-task]"))return;let n=t.closest("[data-scheme-node]");if(n)return void l(n.getAttribute("data-scheme-node"),e.shiftKey||e.ctrlKey||e.metaKey);c&&e.isPrimary&&(g.current={x:e.clientX,y:e.clientY});let r=o?.(e)??!1;if(r&&"touch"!==e.pointerType||!r&&(l(null),t.closest("button, a, input, textarea, select")))return}eh(e)}}},onPointerMove:e=>{if("touch"===e.pointerType&&_.current.has(e.pointerId)){_.current.set(e.pointerId,ef(e));let t=F.current;if(t&&_.current.size>=2){let[e,n]=[..._.current.values()],r=kU(e,n),i=(e.x+n.x)/2,a=(e.y+n.y)/2,s=t.d>0?r/t.d:1;X(e=>{let n=Math.min(1.6,Math.max(.12,e.z*s)),r=n/e.z;return J({z:n,x:i-(t.cx-e.x)*r,y:a-(t.cy-e.y)*r})}),F.current={d:r,cx:i,cy:a};return}}let t=R.current;if(!t)return;let n=e.clientX-t.sx,r=e.clientY-t.sy;Math.hypot(n,r)>9&&(O.current=!0),X(e=>J({...e,x:t.cx+n,y:t.cy+r}))},onDoubleClick:e=>{let n=e.target;if(n.closest("[data-scheme-ui]")||n.closest("[data-scheme-task]"))return;let r=n.closest("[data-scheme-node]");if(!r){if(i||!U.current)return void ei();let t=x.current?.getBoundingClientRect();return void(t&&U.current((e.clientX-t.left-b.x)/b.z,(e.clientY-t.top-b.y)/b.z))}if("hand"!==w&&!N)return;let a=t.byPath.get(r.getAttribute("data-scheme-node")??"");a&&ec(a,.9)},onClick:e=>{if(!s&&!c)return;let n=g.current;if(g.current=null,!n||Math.hypot(e.clientX-n.x,e.clientY-n.y)>9||e.target.closest("[data-scheme-ui]"))return;let r=x.current?.getBoundingClientRect();if(!r)return;let i=(e.clientX-r.left-b.x)/b.z,a=(e.clientY-r.top-b.y)/b.z;if(c?.(i,a)||!s)return;let l=((e,n)=>{let r=t=>e>=t.x&&e<=t.x+t.w&&n>=t.y&&n<=t.y+t.h;if(d){for(let[e,t]of d)if(r(t))return e}for(let e of t.nodes)if(r(e))return e.file.path;for(let e of t.drafts)if(r(e))return e.key;for(let e of t.stacks)if(r(e))return function(e,t){let n=Math.floor((t-e.y-8)/58);return e.items[Math.max(0,Math.min(n,e.items.length-1))]?.file??null}(e,n)?.path??null;for(let e of t.decks)if(r(e))return e.key;return null})(i,a);l&&s(l)},zoomCenter:ee,zoomTo:et,fit:ei,fitCurrent:es,fitRect:eo,jump:eg,manualNonce:$,glideBy:ed,glideFrame:ep,glideToCamera:eu}}({project:e,layout:ef,world:tg,currentWork:tb,mapMode:z,focus:h,onNodePick:w,setSelected:ek,onBackgroundDown:z?void 0:e=>(tn.current=!1,ti.current(e)),onWorldTap:z?void 0:tr,taskRects:td,onPlaceTask:z?void 0:tA,onArrowNav:tI,onZoomKey:tM,onFit:tS}),t0=(0,Y.useMemo)(()=>wL(s),[s]),t1=(0,Y.useMemo)(()=>w_(ef,e,{extraRects:td,aliases:t0}),[ef,e,td,t0]);(0,Y.useEffect)(()=>{if(!z)return iN.setBoard({project:e,index:t1,moveTo:({rect:e,zoom:t})=>("inspect"===t?tX({...e},.9):tV({...e}),!0),restoreCamera:e=>(tZ(e),!0)})},[z,e,t1,tX,tV,tZ]);let[t2,t5]=(0,Y.useState)([]),t4=(0,Y.useCallback)(()=>{let e=t$.current;if(!e)return;let t=e.getBoundingClientRect(),n=function(e,t,n){let r=[];for(let i of t){if(i.width<1||i.height<1)continue;let t={x:i.left-e.left,y:i.top-e.top,w:i.width,h:i.height};t.x+t.w<=0||t.y+t.h<=0||t.x>=n.w||t.y>=n.h||r.push(t)}return r}(t,Array.from(document.querySelectorAll("[data-chip-keepout]"),e=>e.getBoundingClientRect()),{w:t.width,h:t.height});t5(e=>e.length===n.length&&e.every((e,t)=>e.x===n[t].x&&e.y===n[t].y&&e.w===n[t].w&&e.h===n[t].h)?e:n)},[t$]);(0,Y.useEffect)(()=>{t4()},[t4,tT,tP,ef]),(0,Y.useEffect)(()=>{let e=0,t="function"==typeof requestAnimationFrame?requestAnimationFrame:e=>window.setTimeout(()=>e(0),16),n="function"==typeof cancelAnimationFrame?cancelAnimationFrame:e=>window.clearTimeout(e),r=()=>{e||(e=t(()=>{e=0,t4()}))},i="function"==typeof MutationObserver?new MutationObserver(r):null;i?.observe(document.body,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["style","class","data-chip-keepout"]});let a="function"==typeof ResizeObserver?new ResizeObserver(r):null;return a&&t$.current&&a.observe(t$.current),window.addEventListener("resize",r),()=>{e&&n(e),i?.disconnect(),a?.disconnect(),window.removeEventListener("resize",r)}},[t4,t$]);let t3=(0,Y.useMemo)(()=>(function(e,t,n,r,i=[]){return[...[...e,...t,...n].map(e=>({x:e.x*r.z+r.x,y:e.y*r.z+r.y,w:e.w*r.z,h:e.h*r.z})),...i]})(ef.nodes,ef.decks,ef.drafts,tT,t2),[ef,tT,t2]),t6=(0,Y.useRef)({fit:tY,fitCurrent:tW});(0,Y.useEffect)(()=>{t6.current={fit:tY,fitCurrent:tW}});let t8=(0,Y.useRef)(null),t7=ef.nodes.length>0||ef.drafts.length>0||ef.groups.length>0||ef.slots.length>0||td.size>0;(0,Y.useEffect)(()=>{if(!z||!y||!t7){t8.current=null;return}t8.current!==y&&(t8.current=y,"current"===y?t6.current.fitCurrent():t6.current.fit())},[z,y,t7]),(0,Y.useEffect)(()=>{T&&!z&&tO(!0)},[T]),(0,Y.useEffect)(()=>{!$||z||ec(bL({x:Math.round((.25*tP.w-tT.x)/tT.z-130),y:Math.round((.7*tP.h-tT.y)/tT.z)},{w:260,h:140},[...td.values(),...ef.nodes]))},[$]);let t9=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{if(!X||z||t9.current===X)return;let e=ef.groups.find(e=>"pipeline"===e.kind&&e.id===X);e&&(t9.current=X,ev(),tF("select"),tD(e,.75),Z())},[X,ef.groups]);let{onArrow:ne,onZoomKey:nt,announcement:nn}=function({enabled:e,layout:t,taskRects:n,taskLabels:r,cam:i,vp:a,selected:s,setSelected:l,centerOn:o,glideBy:c,glideFrame:d,manualNonce:u}){let{t:p}=(0,eh.Ym)(),m=(0,Y.useRef)(!1),f=(0,Y.useRef)(null),[h,x]=(0,Y.useState)(""),g=(0,Y.useRef)(e),b=(0,Y.useRef)(t),v=(0,Y.useRef)(n),w=(0,Y.useRef)(r),y=(0,Y.useRef)(i),k=(0,Y.useRef)(a),j=(0,Y.useRef)(s),N=(0,Y.useRef)(o),S=(0,Y.useRef)(c),C=(0,Y.useRef)(d),A=(0,Y.useRef)(l),I=(0,Y.useRef)(p);(0,Y.useEffect)(()=>{g.current=e,b.current=t,v.current=n,w.current=r,y.current=i,k.current=a,j.current=s,N.current=o,S.current=c,C.current=d,A.current=l,I.current=p});let M=(0,Y.useCallback)(e=>b.current.byPath.get(e)??v.current?.get(e),[]),T=(0,Y.useCallback)(e=>(function(e,t,n,r){let i=r?.get(t);if(i)return i;let a=e.nodes.find(e=>e.file.path===t);if(a)return(0,ex.cr)(a.file.title,80);let s=e.stacks.find(e=>e.key===t);if(s){let t=e.nodes.find(e=>e.file.path===s.parent),r=t?(0,ex.cr)(t.file.title,60):null;return r?n("scheme.navStack",{count:s.items.length,title:r}):n("scheme.navStackBare",{count:s.items.length})}return t.replace(/^(?:draft|deck)::/,"")})(b.current,e,I.current,w.current),[]),P=(0,Y.useCallback)(e=>{let t=M(e);m.current=!0,t&&(f.current={key:e,x:t.x,y:t.y,w:t.w,h:t.h},N.current(t,0)),A.current(e),x(T(e))},[T,M]),$=(0,Y.useCallback)(e=>{let t=function(e){switch(e){case"ArrowUp":return"up";case"ArrowDown":return"down";case"ArrowLeft":return"left";case"ArrowRight":return"right";default:return null}}(e.key);if(!t||!g.current)return!1;let n=e.target,r="u">typeof document?document.activeElement:null;for(let e of[n,r])if(e&&(function(e){let t=e.tagName;return"INPUT"===t||"TEXTAREA"===t||"SELECT"===t||e.isContentEditable}(e)||e.closest?.('[role="dialog"], [role="menu"], [role="listbox"], [data-scheme-ui]')))return!1;if(function(e,t){if("up"!==t&&"down"!==t)return!1;for(let n=e;n;n=n.parentElement)if(n.scrollHeight>n.clientHeight+1){let e=getComputedStyle(n).overflowY;if("auto"===e||"scroll"===e){let e=n.scrollTop<=0,r=n.scrollTop+n.clientHeight>=n.scrollHeight-1;if("up"===t&&!e||"down"===t&&!r)return!0}}return!1}(n??r,t))return!1;let i=function(e,t){let n=[];for(let[t,r]of e.byPath)n.push({key:t,x:r.x,y:r.y,w:r.w,h:r.h});if(t)for(let[e,r]of t)n.push({key:e,x:r.x,y:r.y,w:r.w,h:r.h});return n}(b.current,v.current);if(!i.length)return!1;let a=j.current;if(!(m.current&&null!=a&&i.some(e=>e.key===a))){let e=function(e,t,n,r){if(r){var i,a,s;let l,o,c,d,u=e.find(e=>e.key===r);if(u&&(i=u,a=t,s=n,l=i.x*a.z+a.x,o=i.y*a.z+a.y,c=i.w*a.z,d=i.h*a.z,(c<=0||d<=0?0:Math.max(0,Math.min(l+c,s.w)-Math.max(l,0))*Math.max(0,Math.min(o+d,s.h)-Math.max(o,0))/(c*d))>=.5))return r}let l=n.w/2,o=n.h/2,c=null;for(let n of e){let e=kV(n,t),r=Math.hypot(e.x-l,e.y-o);(!c||r<c.d-1e-9||1e-9>Math.abs(r-c.d)&&n.key<c.key)&&(c={key:n.key,d:r})}return c?.key??null}(i,y.current,k.current,a);return e&&P(e),!0}let s=function(e,t,n){let r=e.find(e=>e.key===t);if(!r)return null;let i=[];for(let a of e){if(a.key===t)continue;let e=function(e,t,n){let r,i,a,s=e.x+e.w/2,l=e.y+e.h/2,o=t.x+t.w/2,c=t.y+t.h/2;return"right"===n?(r=o-s,i=Math.abs(c-l),a=kY(e.y,e.y+e.h,t.y,t.y+t.h)):"left"===n?(r=s-o,i=Math.abs(c-l),a=kY(e.y,e.y+e.h,t.y,t.y+t.h)):(r="down"===n?c-l:l-c,i=Math.abs(o-s),a=kY(e.x,e.x+e.w,t.x,t.x+t.w)),{key:t.key,dp:r,ds:i,ov:a}}(r,a,n);e.dp>8&&i.push(e)}if(!i.length)return null;let a=i.filter(e=>e.ov>0);if(a.length)return kW(a,.3);let s=i.filter(e=>e.ds<=e.dp);return s.length?kW(s,2):kW(i,4)}(i,a,t);return s&&P(s),!0},[P]),E=(0,Y.useCallback)(e=>{if(!g.current||!m.current)return!1;let t=j.current;if(null==t)return!1;let n=M(t);if(!n)return!1;let r=function(e,t,n){if(n>0){let n=null;for(let r of e)r>1.01*t&&(null===n||r<n)&&(n=r);return n}let r=null;for(let n of e)n<.99*t&&(null===r||n>r)&&(r=n);return r}(function(e,t){let n=t.w-48,r=t.h-48,i=new Set([Math.min(n/e.w,r/e.h,1.6)]);for(let e=2;e<=20;e++){let t=n/(600*e+(e-1)*48);if(t<.45)break;i.add(t)}return[...i].sort((e,t)=>e-t)}(n,k.current),y.current.z,e);return null==r||(C.current(n,r),f.current={key:t,x:n.x,y:n.y,w:n.w,h:n.h},!0)},[M]);(0,Y.useEffect)(()=>{if(!m.current)return;let e=j.current;if(null==e){f.current=null;return}let r=t.byPath.get(e)??n?.get(e)??null,i=f.current,a=function(e,t){if(!t)return{kind:"drop"};if(!e)return{kind:"none"};let n=t.x-e.x,r=t.y-e.y;return .5>Math.abs(n)&&.5>Math.abs(r)?{kind:"none"}:{kind:"translate",dx:n,dy:r}}(i&&i.key===e?i:null,r);if("drop"===a.kind){m.current=!1,f.current=null,A.current(null);return}r&&(f.current={key:e,x:r.x,y:r.y,w:r.w,h:r.h}),"translate"===a.kind&&S.current(a.dx,a.dy)},[t,n]),(0,Y.useEffect)(()=>{if(null==s){m.current=!1,f.current=null;return}if(!g.current)return;let e=M(s)??null;m.current=!0,f.current=e?{key:s,x:e.x,y:e.y,w:e.w,h:e.h}:null},[s,M]);let R=(0,Y.useRef)(!0);return(0,Y.useEffect)(()=>{if(R.current){R.current=!1;return}m.current=!1,f.current=null},[u]),(0,Y.useEffect)(()=>{e||(m.current=!1,f.current=null)},[e]),{onArrow:$,onZoomKey:E,announcement:h}}({enabled:!z&&!eg&&!eM,layout:ef,taskRects:td,taskLabels:tu,cam:tT,vp:tP,selected:H,setSelected:B,centerOn:tD,glideBy:tQ,glideFrame:tX,manualNonce:tG});(0,Y.useEffect)(()=>{tI.current=ne,tM.current=nt},[ne,nt]);let nr=(0,Y.useRef)(null),ni=(0,Y.useRef)(new Map);(0,Y.useEffect)(()=>{let e=new Map,t=[];for(let n of s){let r=`${n.state}:${n.cursor?.stageId??""}:${n.cursor?.state??""}`;e.set(n.id,r);let i=ni.current.get(n.id);void 0!==i&&i!==r&&t.push(function(e,t){let{k:n,n:r}=xz(t),i=t.cursor?t.stages.find(e=>e.id===t.cursor.stageId)??null:null,a=i?xO(e,i):"";return e("pipelineStrip.announce",{task:t.task,state:xu(e,t.state),stage:a,k:n,n:r})}(q,n))}ni.current=e,t.length&&nr.current&&(nr.current.textContent=t.join(". "))},[s,q]);let{marquee:na,onBackgroundDown:ns}=function({viewportRef:e,cam:t,layout:n,enabled:r,session:i,onCommit:a}){let[s,l]=(0,Y.useState)(null),o=(0,Y.useRef)(null),c=(0,Y.useRef)(t),d=(0,Y.useRef)(n),u=(0,Y.useRef)(a);(0,Y.useEffect)(()=>{c.current=t,d.current=n,u.current=a});let p=(0,Y.useCallback)(t=>{let n=e.current?.getBoundingClientRect();return n?{x:t.clientX-n.left,y:t.clientY-n.top}:{x:t.clientX,y:t.clientY}},[e]);return(0,Y.useEffect)(()=>{let e=e=>{var t,n,r,i,a;let s=o.current;if(!s)return;let u=p(e);if(!s.active&&4>Math.hypot(u.x-s.sx,u.y-s.sy))return;s.active=!0;let m=(t=s.sx,n=s.sy,{x:Math.min(t,r=u.x),y:Math.min(n,i=u.y),w:Math.abs(r-t),h:Math.abs(i-n)}),f=yy(d.current.nodes,(a=c.current,{x:(m.x-a.x)/a.z,y:(m.y-a.y)/a.z,w:m.w/a.z,h:m.h/a.z}));l({rect:m,candidates:f,additive:s.additive})},t=e=>{let t=o.current;o.current=null,t?.active&&l(t=>(e&&t&&u.current(t.candidates,t.additive),null))},n=()=>t(!0),r=()=>t(!1),i=e=>{"Escape"===e.key&&o.current?.active&&t(!1)},a=e=>{o.current?.suppressSelection&&e.preventDefault()};return window.addEventListener("pointermove",e),window.addEventListener("pointerup",n),window.addEventListener("pointercancel",r),window.addEventListener("keydown",i),window.addEventListener("selectstart",a),window.addEventListener("dragstart",a),()=>{window.removeEventListener("pointermove",e),window.removeEventListener("pointerup",n),window.removeEventListener("pointercancel",r),window.removeEventListener("keydown",i),window.removeEventListener("selectstart",a),window.removeEventListener("dragstart",a)}},[p]),{marquee:s,onBackgroundDown:(0,Y.useCallback)(t=>{var n;let a=(n={enabled:r,session:i}).enabled?"touch"===t.pointerType?{claim:n.session,track:!1,suppressSelection:!1}:t.isPrimary&&0===t.button?{claim:!0,track:!0,suppressSelection:!0}:rA:rA;if(!a.track)return a.claim;let s=p(t);if(o.current={sx:s.x,sy:s.y,additive:t.shiftKey,active:!1,suppressSelection:a.suppressSelection},a.suppressSelection){let n;t.preventDefault(),(n=window.getSelection?.())&&n.rangeCount>0&&n.removeAllRanges(),e.current?.focus({preventScroll:!0})}return a.claim},[r,i,p,e])}}({viewportRef:t$,cam:tT,layout:ef,enabled:!z,session:eg,onCommit:(0,Y.useCallback)((e,t)=>{tn.current=!0,B(null),eb.current.commitSelection(e,t)},[])});(0,Y.useEffect)(()=>{ti.current=ns},[ns]);let nl=(0,Y.useMemo)(()=>ef.nodes.filter(e=>en.has(e.file.path)),[ef,en]),no=(0,Y.useMemo)(()=>(function(e,t){let n=1/0,r=1/0,i=-1/0,a=-1/0,s=!1;for(let l of e)t.has(l.file.path)&&(s=!0,n=Math.min(n,l.x),r=Math.min(r,l.y),i=Math.max(i,l.x+l.w),a=Math.max(a,l.y+l.h));return s?{x:n,y:r,w:i-n,h:a-r}:null})(ef.nodes,en),[ef,en]),nc=(0,Y.useRef)(no);(0,Y.useEffect)(()=>{nc.current=no},[no]);let nd=(0,Y.useCallback)(()=>{nc.current&&tV(nc.current)},[tV]),nu=(0,Y.useRef)(tT);(0,Y.useEffect)(()=>{nu.current=tT},[tT]);let np=(0,Y.useRef)(()=>{});(0,Y.useEffect)(()=>{np.current=()=>{if(z)return;let e=eC?[eC]:function(e,t,n){let r=io(t,n),i=[];for(let t of e.nodes)if(t.x<r.x+r.width&&t.x+t.w>r.x&&t.y<r.y+r.height&&t.y+t.h>r.y&&i.push(t.file.path),i.length>=128)break;return i}(ef,tT,tP),t=new Set(ef.nodes.map(e=>e.file.path));ip.reportSlice({mode:"scheme",focusedPath:null!==eC?eC:null!==H&&t.has(H)?H:null,selectedPaths:ic(ef.nodes.map(e=>e.file.path),en),visiblePaths:e,camera:{x:tT.x,y:tT.y,zoom:tT.z,worldRect:io(tT,tP)},viewport:{width:tP.w,height:tP.h,dpr:window.devicePixelRatio||1}})}}),(0,Y.useEffect)(()=>{z||np.current()},[z,ef,en,H,eC]),(0,Y.useEffect)(()=>{if(z)return;let e=window.setTimeout(()=>np.current(),300);return()=>window.clearTimeout(e)},[z,tT,tP]);let nm=(0,Y.useCallback)((e,t)=>void nE(e,t),[]),nf=(0,Y.useRef)(tp);(0,Y.useEffect)(()=>{nf.current=tp},[tp]);let nh=(0,Y.useMemo)(()=>({patch:async(e,t)=>{let n=await nT(e,t);return n&&oC("err",n),n},remove:e=>{el(t=>t.some(t=>t.id===e)?t.filter(t=>t.id!==e):t),nP(e).then(e=>{e&&oC("err",e)})},handoff:async(e,t)=>{var n,r;let i=await n$(e.id,t.path);return"error"in i?(oC("err",i.error),i.error):(da(W(t),(n=i.task.id,r=i.task.text,`Task #${n.slice(0,8)}: ${r}`)),null)},draft:e=>eU.current?.(e),collapse:e=>eK.current?.(e),unassign:async(e,t)=>{let n=await nE(e.id,t);n&&oC("err",n)},center:e=>tD(e,.75),toggleExpand:e=>{ep(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},openAgent:e=>{let t=nf.current.get(e.path);t&&tD(t,.75),eY(e)}}),[tD,eY]),nx=(0,Y.useCallback)(e=>{el(t=>[...t,e]),ec(null)},[]),ng=(0,Y.useCallback)(()=>ec(null),[]),[nb,nv]=(0,Y.useState)(!1);(0,Y.useEffect)(()=>{nv(e=>e?tT.z<.49500000000000005:tT.z<.4275)},[tT.z]);let nw=function(e){if(!Number.isFinite(e)||e<=0)return 24;let t=24*e;for(;t<18;)t*=2;return t}(tT.z);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)("div",{ref:t$,className:`relative min-h-0 flex-1 overflow-clip bg-board ${tL?"cursor-grabbing":tR?"cursor-crosshair":tE?"cursor-grab":""} ${tL||na?"select-none":""} ${tE?"touch-none":""}`,tabIndex:z?void 0:0,"aria-label":z?void 0:q("scheme.boardAria"),onPointerDown:tq,onPointerMove:tz,onDoubleClick:tH,onClick:tU,onScroll:e=>{e.currentTarget.scrollLeft=0,e.currentTarget.scrollTop=0},children:[(0,U.jsx)("div",{className:"sr-only","aria-live":"polite",role:"status",children:nn}),(0,U.jsx)("div",{className:"sr-only","aria-live":"polite",role:"status",children:tj}),(0,U.jsx)("div",{ref:nr,className:"sr-only","aria-live":"polite",role:"status"}),(0,U.jsx)("div",{"aria-hidden":!0,"data-scheme-grid":!0,className:"pointer-events-none absolute",style:{inset:-nw,backgroundImage:"radial-gradient(color-mix(in srgb, var(--color-primary) 9%, transparent) 1px, transparent 1px)",backgroundSize:`${nw}px ${nw}px`,transform:`translate(${(tT.x%nw+nw)%nw}px, ${(tT.y%nw+nw)%nw}px)`,willChange:"transform"}}),(0,U.jsxs)("div",{className:`absolute left-0 top-0 ${tL?"scheme-panning":""}`,style:{width:ef.width,height:ef.height,transform:`translate(${tT.x}px, ${tT.y}px) scale(${tT.z})`,transformOrigin:"0 0",transition:t_?`transform .45s ${y9}`:void 0,willChange:"transform","--inv-z":String(1/tT.z),"--label-o":tT.z<.45?"1":"0"},children:[(0,U.jsx)(kc,{groups:ef.groups,interactive:!z&&!tE&&!eg}),(0,U.jsx)(kr,{edges:ef.edges,badgeAnchors:J,badgeAnchorRevision:K,width:ef.width,height:ef.height}),(0,U.jsx)(kl,{loops:ef.loops,width:ef.width,height:ef.height}),(0,U.jsx)(ko,{links:ef.links,byPath:ef.byPath,obstacles:ts,interactive:!z&&!tE&&!eg,hubInteractive:!tE&&!eg,width:ef.width,height:ef.height}),(0,U.jsx)(kA,{layout:ef,project:e,files:r,interactive:!tE&&!eg,lite:z,dormant:nb,selected:H,multi:en,session:eg,focus:eO,attentionPaths:g??null,flowsByImpl:ej,flows:i,pipelines:s,pipelineStrips:z?eN:kG,linkedTasksByPipeline:e3,relatedTasksByPath:tk,deckFocus:e$,badgeAnchors:J,trayApi:z?void 0:b,onSelect:eY,onClose:eW,onFocusRound:eR,onDraftClose:eV,onDraftSpawned:eJ,onHandoff:S?eG:void 0,onSpawnRetry:C?eQ:void 0,onOpenTask:I?eX:void 0,onExpand:eZ,onToggleMember:z?void 0:ew,onPipelineCreated:ee}),(0,U.jsx)(kM,{edges:tm,world:tg,routes:tx,onRetry:nm}),(0,U.jsx)(kF,{tasks:tc,files:r,project:e,interactive:!tE&&!eg,lite:z,camRef:nu,handlers:nh,selectedTaskId:H?.startsWith("task::")?H.slice(6):null,textExpandedIds:eu,pending:eo,onStickyCreated:nx,onCreateCancel:ng,completedPipelinesByTask:e8,onOpenPipelineHistory:e7}),eg&&no?(0,U.jsx)("div",{"aria-hidden":!0,className:"pointer-events-none absolute z-[6] rounded-[14px] border-2 border-dashed border-accent/60",style:{left:no.x-14,top:no.y-14,width:no.w+28,height:no.h+28},children:(0,U.jsx)("span",{className:"absolute -top-3 left-4 rounded-full border border-accent/50 bg-card px-2 py-0.5 font-bold text-accent",style:{fontSize:"calc(11px * min(var(--inv-z, 1), 2.6))"},children:q("bulk.selectedCount",{count:en.size})})}):null]},e),na?(0,U.jsxs)("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 z-30",children:[(0,U.jsx)("div",{className:"absolute rounded-[4px] border border-accent/70 bg-accent/10",style:{left:na.rect.x,top:na.rect.y,width:na.rect.w,height:na.rect.h}}),na.candidates.map(e=>{let t=ef.byPath.get(e);return t?(0,U.jsx)("div",{className:"absolute rounded-[10px] border-2 border-accent/70",style:{left:t.x*tT.z+tT.x,top:t.y*tT.z+tT.y,width:t.w*tT.z,height:t.h*tT.z}},e):null})]}):null,(0,U.jsx)(yw,{clusters:ty,cam:tT,vp:tP,hidden:z||!!na||tL,obstacles:t3,onFit:tV}),(0,U.jsxs)("div",{"data-scheme-ui":!0,className:"absolute left-3 top-3 z-40 flex items-center gap-1 rounded-[10px] border border-border bg-card/95 p-1 shadow-1",children:[z?null:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(kQ,{active:tE&&!tR,title:q("scheme.handTool"),onClick:()=>tF("hand"),children:(0,U.jsx)(w3.A,{className:"h-4 w-4","aria-hidden":!0})}),(0,U.jsx)(kQ,{active:!tE&&!eg&&!tR,title:q("scheme.selectTool"),onClick:()=>tF("select"),children:(0,U.jsx)(w6.A,{className:"h-4 w-4","aria-hidden":!0})}),(0,U.jsx)(kQ,{active:eg,title:q("scheme.lassoTool"),onClick:()=>{eg?ev():(tF("select"),et.setSelectionArmed(!0))},children:(0,U.jsx)(w8.A,{className:"h-4 w-4","aria-hidden":!0})}),(0,U.jsx)(kQ,{active:tR,title:q("tasks.tool"),onClick:()=>tO(!tR),children:(0,U.jsx)(gW.A,{className:"h-4 w-4","aria-hidden":!0})}),(0,U.jsx)("div",{className:"mx-0.5 h-5 w-px bg-border","aria-hidden":!0})]}),(0,U.jsx)(kQ,{title:q("scheme.zoomOut"),onClick:()=>tB(.8),children:(0,U.jsx)(am.A,{className:"h-4 w-4","aria-hidden":!0})}),(0,U.jsxs)("button",{className:"min-w-[46px] rounded-[8px] px-1 text-center text-[11px] font-semibold text-muted hover:bg-canvas hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:q("scheme.zoom100"),onClick:()=>tK(1),children:[Math.round(100*tT.z),"%"]}),(0,U.jsx)(kQ,{title:q("scheme.zoomIn"),onClick:()=>tB(1.25),children:(0,U.jsx)(af.A,{className:"h-4 w-4","aria-hidden":!0})}),(0,U.jsx)(kQ,{title:q("scheme.fitCurrent"),onClick:tW,children:(0,U.jsx)(w7.A,{className:"h-4 w-4","aria-hidden":!0})}),(0,U.jsx)(kQ,{title:q("scheme.fit"),onClick:tY,children:(0,U.jsx)(ah.A,{className:"h-4 w-4","aria-hidden":!0})})]}),eg?(0,U.jsx)(yl,{project:e,nodes:nl,flowsByImpl:ej,onRemove:eW,onFit:nd,onExit:ev}):null,(0,U.jsx)(yN,{layout:ef,world:tg,tasks:tc,textExpandedIds:eu,currentWork:tb,stackDots:e9,cam:tT,vp:tP,onJump:tJ})]}),eI?(D=eI.file.path,_=eT&&null!==D&&eT.path===D?eT.token:void 0,L=x_(q,eS.get(eI.file.path)),F=void 0===_?L:void 0,(0,U.jsx)("div",{className:"fixed inset-0 z-40 flex flex-col bg-canvas p-3",role:"dialog","aria-modal":"true","aria-label":F??(0,tw.cr)(eI.file.title,90),children:(0,U.jsx)(g6,{file:eI.file,tasks:eI.tasks,isRoot:eI.isRoot,expanded:!0,showFavorite:!0,titleOverride:F,onToggleExpand:()=>eA(null),autoEditToken:_,onSpawnRetry:C?eQ:void 0,relatedTasks:tk.get(eI.file.path),onOpenTask:I?e=>{eA(null),eX(e)}:void 0})})):null]})}function kZ(){let{t:e}=(0,eh.Ym)();return(0,U.jsxs)("div",{role:"status","aria-busy":"true","aria-live":"polite",className:"grid flex-1 auto-rows-min content-start gap-2.5 overflow-hidden p-3",style:{gridTemplateColumns:"repeat(auto-fill, minmax(min(100%, 240px), 1fr))"},children:[(0,U.jsx)("span",{className:"sr-only",children:e("dash.loadingBoard")}),Array.from({length:6}).map((e,t)=>(0,U.jsxs)("div",{"aria-hidden":!0,className:"flex animate-pulse flex-col gap-2 rounded-[10px] border border-border bg-card p-3 shadow-1 motion-reduce:animate-none",children:[(0,U.jsxs)("div",{className:"flex items-center gap-2",children:[(0,U.jsx)("span",{className:"h-2 w-2 shrink-0 rounded-full bg-sunken"}),(0,U.jsx)("span",{className:"h-3 w-2/3 rounded bg-sunken"})]}),(0,U.jsx)("span",{className:"h-2.5 w-5/6 rounded bg-sunken"}),(0,U.jsx)("span",{className:"h-2.5 w-1/2 rounded bg-sunken"})]},t))]})}let k0="llvArchived";function k1(e){try{window.localStorage.setItem(k0,JSON.stringify([...e]))}catch{}}function k2({data:e,onOpen:t}){let{t:n}=(0,eh.Ym)(),r=e.waiting.length,i=(0,Y.useRef)(r),[a,s]=(0,Y.useState)(!1);return(0,Y.useEffect)(()=>{if(r>i.current){s(!0);let e=window.setTimeout(()=>s(!1),900);return i.current=r,()=>window.clearTimeout(e)}i.current=r},[r]),(0,U.jsxs)("div",{className:"group absolute bottom-3 right-3 z-20",children:[e.livePreview.length?(0,U.jsx)("div",{className:"pointer-events-none mb-1.5 hidden w-[300px] rounded-[8px] border border-border bg-card/95 px-3 py-2 shadow-1 backdrop-blur group-focus-within:block group-hover:block",children:e.livePreview.map(e=>(0,U.jsxs)("div",{className:"flex min-w-0 gap-1.5 py-0.5 text-[10.5px]",children:[(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate font-semibold",children:e.title}),(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate text-muted",children:e.statusLine||n("status.working")})]},e.file.path))}):null,(0,U.jsxs)("button",{className:`ml-auto flex items-center gap-1.5 rounded-full border border-border bg-card/95 px-2.5 py-1 text-[11.5px] font-bold shadow-1 backdrop-blur transition-transform hover:border-accent/45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 ${a?"scale-110 border-warning/70":""} motion-reduce:transition-none`,"aria-label":n("corner.openSwitchboard"),onClick:t,children:[(0,U.jsx)("span",{className:`h-2 w-2 rounded-full ${e.working.length?"animate-pulse bg-success":"bg-muted"}`}),(0,U.jsx)("span",{children:e.working.length}),(0,U.jsx)("span",{className:r?"text-warning":"text-muted",children:n("corner.waitingCount",{count:r})})]})]})}function k5(e,t){return"Escape"===e.key&&(e.stopPropagation(),t(),!0)}function k4(e){if(!e)return null;let t=e.checkedAt?Date.parse(e.checkedAt)/1e3:NaN,n=Number.isFinite(t)?t:null;return{limits:{session:e.session,weekly:e.weekly,plan:null,capturedAt:n},observedAt:n,stale:"stale"===e.freshness,source:"account"}}function k3(e,t,n){let r=e.limits?.[t];if(!r)return null;let i=r.observedAt??e.observedAt;return{value:r,observedAt:i,stale:e.stale||null!==i&&n-i>1200,source:r.source??e.source}}function k6(e,t,n,r){var i;let a;if(e.value.usedPercent<100)return!1;if(null!==e.value.resetsAt)return e.value.resetsAt>r;if(null===e.observedAt)return!0;let s="number"==typeof e.value.windowMinutes?e.value.windowMinutes:"weekly"===n?10080:300;return!(r-e.observedAt>=60*s)&&(i=e.observedAt,!(a=t?.value)||null===a.resetsAt||"number"!=typeof a.windowMinutes||!(a.resetsAt-60*a.windowMinutes>i))}function k8(e,t,n,r){if(!e)return t;if(!t)return e;let i=k6(e,t,n,r);return i!==k6(t,e,n,r)?i?e:t:null===e.observedAt?null===t.observedAt?e:t:null===t.observedAt?e:t.observedAt>e.observedAt?t:e}function k7(e,t,n){let r=k8(e?k3(e,"session",n):null,t?k3(t,"session",n):null,"session",n),i=k8(e?k3(e,"weekly",n):null,t?k3(t,"weekly",n):null,"weekly",n),a=[e,t].filter(e=>!!e?.limits?.plan).sort((e,t)=>(t.observedAt??-1/0)-(e.observedAt??-1/0));return{session:r,weekly:i,plan:a[0]?.limits?.plan??null}}function k9(e){return["session","weekly"].flatMap(t=>{let n=e[t];return n?[{...n,window:t,percent:Math.max(0,Math.min(100,100-n.value.usedPercent))}]:[]}).sort((e,t)=>e.percent-t.percent||e.window.localeCompare(t.window))[0]??null}let je={authenticated:"accounts.auth.authenticated",signed_out:"accounts.auth.signedOut",unknown:"accounts.auth.unknown",error:"accounts.auth.error"};function jt(e,t){return e<=10?"var(--color-danger)":e<=30?"var(--color-warning)":t}function jn({quota:e,engine:t}){let{t:n}=(0,eh.Ym)(),r=k9(e);if(!r)return null;let i=(0,tw.t7)(t),a=n("weekly"===r.window?"limits.windowWeekly":"limits.windowSession"),s=r.stale,l=jt(r.percent,i.color);return(0,U.jsx)("span",{className:`shrink-0 rounded-full border border-border bg-canvas px-1.5 py-0.5 text-[10px] font-bold tabular-nums ${s?"opacity-55":""}`,style:{color:l},title:n(s?"accounts.effectiveStale":"accounts.effectiveTip",{window:a}),children:n("accounts.effective",{pct:Math.round(r.percent)})})}function jr({account:e,engine:t,quota:n,now:r}){let i,a,{t:s}=(0,eh.Ym)(),l=[{key:"session",label:eV(s,"session",n.session?.value.windowMinutes),window:n.session},{key:"weekly",label:eV(s,"weekly",n.weekly?.value.windowMinutes),window:n.weekly}].filter(e=>null!=e.window);if(0===l.length)return null;let o=l.some(e=>e.window.stale),c=l.map(e=>e.window.observedAt).filter(e=>null!==e),d=c.length?Math.min(...c):null,u=l.filter(e=>e.window.stale).map(e=>e.window.observedAt).filter(e=>null!==e),p=u.length>1&&u.every(e=>e===u[0])?u[0]:null,m=(0,tw.t7)(t);return(0,U.jsxs)("dl",{"aria-label":s("accounts.limitsAria",{label:e.label}),title:o?s("accounts.limitsStaleTip"):void 0,className:`flex flex-col gap-1 px-3.5 pb-1 pl-[30px] ${o?"opacity-70":""}`,children:[null===p&&(o||null===d)?null:(0,U.jsx)("div",{className:"text-[9.5px] font-semibold text-secondary",children:null!==p?eK(p)??s("accounts.limitsStale"):`${s("accounts.limitsChecked")} \xb7 ${a=(i=new Date(new Date(1e3*d).toISOString())).toLocaleTimeString(eB(),{hour:"2-digit",minute:"2-digit",hour12:!1}),Date.now()-i.getTime()<864e5?a:i.toLocaleDateString(eB(),{day:"numeric",month:"short"})+" "+a}`}),l.map(({key:e,label:t,window:n})=>{let i=n.value,a=Math.max(0,Math.min(100,100-i.usedPercent)),l=jt(a,m.color),o=null!==p&&n.observedAt===p,c=n.stale&&!o?eK(n.observedAt)??s("accounts.limitsStale"):null;return(0,U.jsxs)("div",{className:"flex items-center gap-2 text-[10px] leading-snug text-muted",children:[(0,U.jsx)("dt",{className:"w-8 shrink-0 font-semibold",children:t}),(0,U.jsxs)("dd",{className:"flex min-w-0 flex-1 items-center gap-2",children:[(0,U.jsx)("span",{"aria-hidden":!0,className:"h-1.5 w-16 shrink-0 overflow-hidden rounded-full bg-sunken sm:w-20",children:(0,U.jsx)("span",{className:"block h-full rounded-full",style:{width:`${a}%`,backgroundColor:l}})}),(0,U.jsxs)("span",{className:"font-bold tabular-nums text-primary",children:[Math.round(a),"%"]}),(0,U.jsx)("span",{children:s("limits.left")}),i.resetsAt?(0,U.jsxs)("span",{className:"truncate",children:["\xb7 ",s("limits.reset",{eta:eW(i.resetsAt,r),at:eJ(i.resetsAt,r)})]}):null,c?(0,U.jsxs)("span",{className:"truncate",children:[i.resetsAt?"\xb7 ":"",c]}):null]})]},e)})]})}function ji(e){return e.authHealth??(e.authPresent?"unknown":"signed_out")}function ja({state:e}){let{t}=(0,eh.Ym)();return"pending"===e?(0,U.jsxs)("span",{className:"flex shrink-0 items-center gap-1 text-[10px] font-semibold text-muted",children:[(0,U.jsx)(sx.kr,{className:"h-3 w-3 animate-spin motion-reduce:animate-none","aria-hidden":!0}),t("accounts.pendingLogin")]}):"needsLogin"===e?(0,U.jsx)("span",{className:"shrink-0 text-[10px] font-semibold",style:{color:"var(--color-warning)"},children:t("accounts.needsLogin")}):"active"===e?(0,U.jsx)("span",{className:"shrink-0 text-[10px] font-semibold text-muted",children:t("accounts.active")}):null}function js({account:e}){let{t}=(0,eh.Ym)(),n=ji(e);return(0,U.jsxs)("span",{className:"flex min-w-0 items-center gap-1 text-[9.5px] font-medium text-muted",children:[(0,U.jsx)("code",{className:"truncate font-mono",children:e.id}),(0,U.jsx)(sv,{tone:"authenticated"===n?"success":"signed_out"===n||"error"===n?"danger":"neutral",className:"px-1.5 py-0 text-[9px]",children:t(je[n])})]})}function jl({account:e,engine:t,quota:n,activeId:r,onSelect:i,onRemove:a,onCopyCommand:s,disabled:l,focused:o=!1,children:c}){let{t:d}=(0,eh.Ym)(),u=e.loginPending?"pending":e.authPresent&&"signed_out"!==ji(e)?e.id===r?"active":"idle":"needsLogin",p=e.id===r,m=(0,tw.t7)(t),f=e.authPresent&&"signed_out"!==ji(e)&&!e.loginPending,h=l||!f,[x,g]=(0,Y.useState)(!1),b=(0,Y.useRef)(null);return(0,Y.useEffect)(()=>{o&&b.current?.scrollIntoView({block:"nearest"})},[o]),(0,U.jsxs)("div",{className:`relative ${o?"ring-2 ring-inset ring-accent/50":""}`,style:p?{background:`color-mix(in srgb, ${m.color} 7%, transparent)`,boxShadow:`inset 2px 0 0 ${m.color}`}:void 0,children:[(0,U.jsxs)("button",{ref:b,type:"button","aria-current":p?"true":void 0,disabled:h,onClick:i,className:"flex min-h-[44px] w-full items-center gap-2.5 px-3.5 pt-2.5 pb-1 text-left hover:bg-canvas/60 disabled:cursor-wait disabled:opacity-60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:min-h-0",children:[(0,U.jsx)("span",{"aria-hidden":!0,className:"h-2 w-2 shrink-0 rounded-full",style:{backgroundColor:p?m.color:"transparent",boxShadow:p?"none":"inset 0 0 0 1.5px var(--color-border)"}}),(0,U.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,U.jsx)("span",{className:`block truncate text-[13px] leading-tight ${p?"font-bold text-primary":"font-semibold"}`,children:e.label}),(0,U.jsx)(js,{account:e})]}),(0,U.jsx)(jn,{quota:n,engine:t}),(0,U.jsx)(ja,{state:u})]}),c,"pending"===u&&e.deviceAuth?(0,U.jsxs)("div",{className:"flex items-center gap-2 px-3.5 pb-1.5 text-[10px] text-muted",children:[(0,U.jsx)("a",{href:e.deviceAuth.url,target:"_blank",rel:"noreferrer",className:"inline-flex min-h-[44px] items-center truncate underline sm:min-h-0",children:d("accounts.openLogin")}),(0,U.jsx)("code",{className:"select-all font-semibold text-primary",children:e.deviceAuth.code})]}):null,(0,U.jsxs)("div",{className:"flex items-center gap-1 px-3.5 pb-2 pl-[30px]",children:[(0,U.jsxs)("button",{type:"button","aria-label":d("accounts.copyCliAria",{label:e.label}),disabled:l||!f,onClick:s,className:"inline-flex min-h-[44px] shrink-0 items-center gap-1.5 rounded-[6px] px-1.5 py-0.5 text-[10.5px] font-semibold text-secondary hover:bg-canvas hover:text-primary disabled:opacity-40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:min-h-[28px]",children:[(0,U.jsx)(sx.ke,{className:"h-3.5 w-3.5 text-muted","aria-hidden":!0}),d("accounts.copyCli")]}),(0,U.jsx)("span",{className:"min-w-0 flex-1"}),"managed"===e.kind?x?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("span",{className:"min-w-0 flex-1 text-right text-[10.5px] font-semibold text-danger",children:d("accounts.removeConfirm")}),(0,U.jsx)("button",{type:"button",disabled:l,onClick:()=>{g(!1),a()},className:"inline-flex min-h-[44px] shrink-0 items-center rounded-[6px] bg-danger px-2 py-0.5 text-[10.5px] font-semibold text-white hover:opacity-90 disabled:opacity-45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:min-h-[28px]",children:d("accounts.removeConfirmCta")}),(0,U.jsx)("button",{type:"button",disabled:l,onClick:()=>g(!1),className:"inline-flex min-h-[44px] shrink-0 items-center rounded-[6px] px-2 py-0.5 text-[10.5px] font-semibold text-secondary hover:bg-canvas disabled:opacity-45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:min-h-[28px]",children:d("accounts.removeConfirmCancel")})]}):(0,U.jsxs)("button",{type:"button","aria-label":d("accounts.removeAria",{label:e.label}),disabled:l,onClick:()=>g(!0),className:"inline-flex min-h-[44px] shrink-0 items-center gap-1 rounded-[6px] px-1.5 py-0.5 text-[10.5px] font-semibold text-muted hover:bg-danger-soft hover:text-danger disabled:opacity-45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:min-h-[28px]",children:[(0,U.jsx)(sx.TB,{className:"h-3 w-3","aria-hidden":!0}),d("accounts.remove")]}):null]})]})}function jo({account:e,state:t,loginBusy:n}){let{t:r}=(0,eh.Ym)(),i=e.login??null,a=i?.phase,s=null!=i&&h3.has(i.phase),l=null!==t.mutation,o=(0,Y.useRef)(null),c=(0,Y.useRef)(!1),[d,u]=(0,Y.useState)(""),[p,m]=(0,Y.useState)(!1),[f,h]=(0,Y.useState)(a);a!==f&&(h(a),"awaiting_code"!==a&&(u(""),m(!1))),(0,Y.useEffect)(()=>{c.current&&(c.current=!1,o.current?.focus())});let x=e=>{c.current=!0,e()};if(s&&i){let n="canceling"!==a,s=(0,U.jsx)("button",{type:"button",onClick:()=>x(()=>void t.cancelLogin(i.operationId)),disabled:l||!n,className:"inline-flex min-h-[44px] shrink-0 items-center rounded-[7px] border border-border bg-canvas px-2 py-0.5 text-[11px] font-semibold hover:bg-sunken disabled:opacity-45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:min-h-0",children:r("accounts.claudeLogin.cancel")}),c=e=>(0,U.jsxs)("div",{className:"flex items-center gap-2",children:[(0,U.jsx)(sx.kr,{className:"h-3 w-3 shrink-0 animate-spin motion-reduce:animate-none text-muted","aria-hidden":!0}),(0,U.jsx)("span",{className:"min-w-0 flex-1 text-[11px] text-muted",children:r(e)}),n?s:null]}),f=`${i.operationId}-hint`;return(0,U.jsxs)("div",{ref:o,tabIndex:-1,role:"group","aria-label":r("accounts.claudeLogin.groupAria",{label:e.label}),className:"flex flex-col gap-1.5 px-3 pb-2 pl-[26px] focus-visible:outline-none",children:["starting"===a?c("accounts.claudeLogin.starting"):null,"awaiting_browser"===a?c("accounts.claudeLogin.awaitingBrowser"):null,"verifying"===a?c("accounts.claudeLogin.verifying"):null,"canceling"===a?c("accounts.claudeLogin.canceling"):null,"awaiting_code"===a?(0,U.jsxs)(U.Fragment,{children:[i.loginUrl?(0,U.jsx)("a",{href:i.loginUrl,target:"_blank",rel:"noreferrer noopener",className:"inline-flex min-h-[44px] items-center self-start text-[11px] font-semibold text-accent underline sm:min-h-0",children:r("accounts.claudeLogin.openLink")}):null,(0,U.jsxs)("form",{onSubmit:e=>{e.preventDefault(),p||l||""===d.trim()||x(()=>{m(!0),t.submitLoginCode(i.operationId,d)})},className:"flex items-center gap-2",children:[(0,U.jsx)("input",{type:"text",value:d,onChange:e=>u(e.target.value),onFocus:e=>e.currentTarget.scrollIntoView({block:"nearest"}),maxLength:8192,autoComplete:"off",autoCapitalize:"off",spellCheck:!1,"aria-label":r("accounts.claudeLogin.codeLabel"),"aria-describedby":f,placeholder:r("accounts.claudeLogin.codePlaceholder"),className:"h-11 min-w-0 flex-1 rounded-[8px] border border-border bg-canvas px-2 font-mono text-[11.5px] outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:h-8"}),(0,U.jsx)("button",{type:"submit",disabled:l||p||""===d.trim(),className:"h-11 shrink-0 rounded-[8px] border border-border bg-canvas px-2.5 text-[11px] font-semibold hover:bg-sunken disabled:cursor-not-allowed disabled:opacity-45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:h-8",children:r("accounts.claudeLogin.submit")})]}),(0,U.jsx)("p",{id:f,className:"text-[10px] leading-snug text-muted",children:r("accounts.claudeLogin.codeHint")}),(0,U.jsx)("div",{className:"flex justify-end",children:s})]}):null]})}if(i&&i.result?.status==="failure")return(0,U.jsxs)("div",{ref:o,tabIndex:-1,role:"alert",className:"flex items-center gap-2 px-3 pb-2 pl-[26px] focus-visible:outline-none",children:[(0,U.jsx)("span",{className:"min-w-0 flex-1 text-[10.5px] font-semibold text-danger",children:r(h8(i.result.code))}),(0,U.jsx)("button",{type:"button",onClick:()=>x(()=>void t.retryLogin(e.id)),disabled:l||n,className:"inline-flex min-h-[44px] shrink-0 items-center rounded-[7px] border border-border bg-canvas px-2 py-0.5 text-[11px] font-semibold hover:bg-sunken disabled:opacity-45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:min-h-0",children:r("accounts.retry")})]});let g=ji(e);if("signed_out"===g||"error"===g||!e.authPresent){let i="error"===g?r("accounts.retry"):r("accounts.claudeLogin.signIn");return(0,U.jsx)("div",{ref:o,tabIndex:-1,className:"flex items-center gap-2 px-3 pb-2 pl-[26px] focus-visible:outline-none",children:(0,U.jsx)("button",{type:"button",onClick:()=>x(()=>void t.retryLogin(e.id)),disabled:l||n,className:"inline-flex min-h-[44px] shrink-0 items-center rounded-[7px] border border-border bg-canvas px-2.5 py-0.5 text-[11px] font-semibold hover:bg-sunken disabled:opacity-45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:min-h-0",children:i})})}return null}function jc({state:e,onClose:t,placement:n="footer",focusAccountId:r=null,quotaOverride:i}){let{t:a}=(0,eh.Ym)(),{accounts:s,active:l,status:o,notice:c,mutation:d,engine:u}=e,[p,m]=(0,Y.useState)(""),[f,h]=(0,Y.useState)(()=>Math.floor(Date.now()/1e3));(0,Y.useEffect)(()=>{if(i)return;let e=setInterval(()=>h(Math.floor(Date.now()/1e3)),3e4);return()=>clearInterval(e)},[i]);let x=i?.now??f,g="claude"===u&&s.some(e=>null!=e.login&&h3.has(e.login.phase)),b=function(e,t,n){if("claude"!==e)return"";let r=t.find(e=>e.login?.phase==="awaiting_code");if(r)return n("accounts.claudeLogin.announceCodeReady",{label:r.label});let i=t.find(e=>e.login?.phase==="authenticated");return i?n("accounts.claudeLogin.announceDone",{label:i.label}):""}(u,s,a),v=(0,Y.useRef)(null),w="claude"===u?"Claude":"Codex";(0,Y.useEffect)(()=>{v.current?.focus()},[]);let y=async t=>{d||await e.select(t)},k=async t=>{t.preventDefault();let n=p.trim();!n||d||await e.add(n)&&m("")};return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("button",{type:"button","aria-hidden":!0,tabIndex:-1,"aria-label":a("accounts.close"),onClick:e=>{e.stopPropagation(),t()},className:"fixed inset-0 z-40 cursor-default sm:hidden"}),(0,U.jsxs)("div",{role:"dialog","aria-label":a("accounts.titleFor",{engine:w}),"aria-busy":null!==d,onKeyDown:e=>k5(e,t),className:`fixed bottom-3 left-1/2 z-50 flex w-[min(400px,calc(100vw-16px))] -translate-x-1/2 flex-col rounded-[14px] border border-border bg-card shadow-2 ${"header"===n?"sm:absolute sm:top-full sm:left-0 sm:mt-2 sm:bottom-auto sm:translate-x-0":"sm:absolute sm:bottom-1 sm:left-full sm:ml-2 sm:translate-x-0"}`,children:[(0,U.jsxs)("header",{className:"flex items-center gap-2 border-b border-border px-3 py-2",children:[(0,U.jsx)("span",{"aria-hidden":!0,className:"h-2 w-2 shrink-0 rounded-full",style:{backgroundColor:(0,tw.t7)(u).color}}),(0,U.jsx)("span",{className:"text-[12.5px] font-bold",children:a("accounts.titleFor",{engine:w})}),(0,U.jsx)("button",{ref:v,type:"button","aria-label":a("accounts.close"),onClick:t,className:"ml-auto inline-flex min-h-[44px] min-w-[44px] items-center justify-center rounded-[6px] p-1 text-muted hover:bg-canvas hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:min-h-0 sm:min-w-0",children:(0,U.jsx)(sx.X,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),(0,U.jsx)("p",{className:"sr-only",role:"status","aria-live":"polite",children:b}),d?(0,U.jsxs)("div",{role:"status","aria-live":"polite",className:"flex items-center gap-2 border-b border-border bg-accent/5 px-3 py-2 text-[11px] font-semibold text-primary",children:[(0,U.jsx)(sx.kr,{className:"h-3.5 w-3.5 shrink-0 animate-spin motion-reduce:animate-none text-accent","aria-hidden":!0}),function(e,t){switch(e){case"refresh":return t("accounts.operation.refresh");case"add":return t("accounts.operation.add");case"switch":return t("accounts.operation.switch");case"login":return t("accounts.operation.login");case"remove":return t("accounts.operation.remove");case"terminal":return t("accounts.operation.terminal")}}(d,a)]}):null,(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)("div",{className:"max-h-[min(420px,60vh)] divide-y divide-border/40 overflow-y-auto",children:["loading"===o?(0,U.jsx)("div",{className:"px-3.5 py-2 text-[11px] text-muted",children:a("accounts.loading")}):null,"error"===o&&0===s.length?(0,U.jsx)("div",{className:"px-3.5 py-2 text-[11px] text-muted",children:a("accounts.noAccounts")}):null,s.map(t=>{let n=i?.accountId===l&&t.id===l?i.quota:k7(null,k4(t.limits),x);return(0,U.jsxs)(jl,{account:t,engine:u,quota:n,activeId:l,disabled:null!==d,focused:t.id===r,onSelect:()=>void y(t.id),onRemove:()=>void e.remove(t.id),onCopyCommand:()=>void e.copyTerminalCommand(t.id),children:[(0,U.jsx)(jr,{account:t,engine:u,quota:n,now:x}),"claude"===u?(0,U.jsx)(jo,{account:t,state:e,loginBusy:g},t.login?.operationId??t.id):null]},t.id)})]}),(0,U.jsxs)("form",{onSubmit:k,className:"flex items-center gap-2 border-t border-border px-3 py-2",children:[(0,U.jsx)("input",{value:p,onChange:e=>m(e.target.value),placeholder:a("accounts.labelPlaceholder"),className:"h-11 min-w-0 flex-1 rounded-[8px] border border-border bg-canvas px-2 text-[11.5px] outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:h-8"}),(0,U.jsx)("button",{type:"submit",disabled:null!==d||""===p.trim()||g,className:"inline-flex h-11 min-w-[44px] shrink-0 items-center justify-center rounded-[8px] border border-border bg-canvas px-2.5 text-[11px] font-semibold hover:bg-sunken disabled:cursor-not-allowed disabled:opacity-45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:h-8 sm:min-w-0",children:a("accounts.confirmAdd")})]}),(0,U.jsx)("div",{className:"flex justify-end border-t border-border px-3 py-1.5",children:(0,U.jsx)("button",{type:"button",disabled:null!==d,onClick:()=>void e.cleanupOrphans(),className:"inline-flex min-h-[44px] items-center text-[10.5px] font-semibold text-muted underline underline-offset-2 hover:text-primary disabled:opacity-45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:min-h-0",children:a("accounts.cleanupOrphans")})}),c?(0,U.jsxs)("div",{className:"flex items-center gap-2 border-t border-border px-3 py-1.5",children:[(0,U.jsx)("span",{className:`min-w-0 flex-1 text-[11px] leading-snug [display:-webkit-box] [-webkit-box-orient:vertical] [-webkit-line-clamp:2] overflow-hidden ${"error"===c.kind?"text-danger":"text-muted"}`,title:h9(a,c),children:h9(a,c)}),c.action?(0,U.jsx)("button",{type:"button",disabled:null!==d,onClick:()=>void e.retryNotice().then(e=>{e&&"add"===c.operation&&m("")}),className:"inline-flex min-h-[44px] shrink-0 items-center rounded-[7px] border border-border bg-canvas px-2 py-0.5 text-[11px] font-semibold hover:bg-sunken focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:min-h-0",children:a("forceRemove"===c.action.kind?"accounts.forceRemove":"cleanupOrphans"===c.action.kind?"accounts.cleanupOrphans":"accounts.retry")}):null]}):null]})]})]})}let jd={claude:"Claude",codex:"Codex"};function ju({engine:e}){let t=xl(e),{t:n}=(0,eh.Ym)(),[r,i]=(0,Y.useState)(!1),a=(0,Y.useRef)(null),s=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{if(!r)return;let e=e=>{a.current&&!a.current.contains(e.target)&&i(!1)};return window.addEventListener("pointerdown",e),()=>window.removeEventListener("pointerdown",e)},[r]);let l=jd[e],o=(0,tw.t7)(e),c=t.accounts.find(e=>e.id===t.active),d=c?.label??n("accounts.trigger"),u=t.migration?.state==="draining";return(0,U.jsxs)("div",{ref:a,className:"relative",children:[(0,U.jsxs)("button",{ref:s,type:"button","aria-expanded":r,"aria-haspopup":"dialog","aria-label":`${n("accounts.triggerAria",{engine:l})} — ${d}`,title:`${l} \xb7 ${d}`,onClick:()=>i(e=>!e),className:"flex h-8 items-center gap-1 rounded-[7px] border border-border bg-canvas px-2 text-[11px] font-semibold hover:bg-sunken focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:[(0,U.jsx)("span",{className:"shrink-0 font-bold",style:{color:o.color},children:l}),(0,U.jsx)("span",{className:"hidden max-w-32 truncate sm:inline",children:d}),u?(0,U.jsx)(sx.kr,{className:"h-3 w-3 shrink-0 animate-spin motion-reduce:animate-none text-accent","aria-hidden":!0}):(0,U.jsx)(sx.yQ,{className:"h-3 w-3 shrink-0 text-muted","aria-hidden":!0})]}),r?(0,U.jsx)(jc,{state:t,onClose:()=>{i(!1),s.current?.focus()},placement:"header"}):null]})}function jp(e){let t=e.providerThrottle;return t?.reason==="provider_throttled"&&Number.isFinite(Date.parse(t.retryAt))?t:null}function jm({file:e,title:t,project:n,currentProject:r,descendants:i,statusLine:a,size:s,tone:l,onOpen:o,onArchive:c}){let d,{locale:u,t:p}=(0,eh.Ym)(),m="large"===s,f=jp(e),h=(d=jp(e))?(0,eh.Tl)(u,"status.providerThrottled",{time:eY(Date.parse(d.retryAt)/1e3,u)}):null,x=h??a,g=h?"waiting":l,b=h&&f?{...e,rateLimit:null,pendingWakeup:e.pendingWakeup??{fireAt:Date.parse(f.retryAt),reason:h}}:e;return(0,U.jsxs)("article",{className:`reasoning-host group relative flex ${m?"h-[150px] w-[300px]":"h-[128px] w-[220px]"} shrink-0 flex-col rounded-[8px] border p-3 shadow-1 transition-colors hover:border-accent/45 ${"stalled"===g?"border-danger/45 bg-danger-soft shadow-[0_0_0_3px_color-mix(in_srgb,var(--color-danger)_18%,transparent)]":"waiting"===g?"border-warning/55 bg-warning-soft shadow-[0_0_0_3px_color-mix(in_srgb,var(--color-warning)_18%,transparent)]":"working"===g?"border-success/40 bg-success-soft":"border-border bg-card"}`,role:"button",tabIndex:0,"aria-label":p("switchCard.openColumn",{title:(0,tw.cr)(t,80)}),onClick:()=>o(e),onKeyDown:t=>{"Enter"===t.key&&o(e)},children:["live"===e.activity||h?null:(0,U.jsx)("button",{type:"button",className:"absolute right-1.5 top-1.5 z-10 hidden h-5 w-5 items-center justify-center rounded-full border border-border bg-canvas text-muted hover:border-danger/50 hover:text-danger focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 group-hover:flex group-focus-within:flex","aria-label":p("switchCard.remove"),onClick:t=>{t.stopPropagation(),c(e)},onKeyDown:e=>e.stopPropagation(),children:(0,U.jsx)(sx.X,{className:"h-3 w-3","aria-hidden":!0})}),(0,U.jsxs)("div",{"data-card-row":"identity",className:"relative flex min-w-0 items-center gap-1.5",children:[(0,U.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${h?"bg-warning":(0,tw.tz)(e.activity)}`}),(0,U.jsx)(yH,{file:e}),(0,U.jsx)(gT,{file:e}),(0,U.jsx)(gx,{file:b}),(0,U.jsx)("span",{className:`ml-auto min-w-0 truncate rounded-full border border-border bg-canvas px-1.5 py-0.5 text-[9.5px] font-semibold ${n===r?"text-muted":"text-primary"}`,title:n,children:eb(n,e.projectName)})]}),(0,U.jsx)("div",{"data-card-row":"content",className:`relative mt-2 min-w-0 ${m?"text-[14px]":"text-[12.5px]"} font-bold leading-snug`,title:t,children:(0,U.jsx)("span",{className:"line-clamp-2",children:t})}),(0,U.jsxs)("div",{"data-card-row":"ops",className:"relative mt-auto flex min-w-0 items-center gap-1.5 overflow-hidden text-[10.5px] font-semibold text-muted",children:[(0,U.jsx)("span",{className:"shrink-0",children:(0,tw.rK)(e.mtime)}),e.ctx?(0,U.jsx)(gz,{ctx:e.ctx}):null,i?(0,U.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-0.5",children:[(0,U.jsx)(dZ.A,{className:"h-3 w-3","aria-hidden":!0})," ",i]}):null,(0,U.jsx)(yz,{file:e}),(0,U.jsx)(gY,{file:e,shrinkable:!0}),(0,U.jsx)(gZ,{wakeup:e.pendingWakeup,shrinkable:!0},gX(e.pendingWakeup))]}),x?(0,U.jsx)("div",{className:`relative mt-1 min-w-0 truncate font-semibold ${"waiting"===g||"stalled"===g?m?"text-[12.5px]":"text-[11.5px]":m?"text-[11.5px]":"text-[10.5px]"} ${"stalled"===g?"text-danger":"waiting"===g?"text-warning":"text-primary/75"}`,"data-tone":g,children:x}):null,e.pid&&"running"===e.proc?(0,U.jsx)("div",{className:"relative mt-2",onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:(0,U.jsx)(fO,{file:e,compact:!0})}):null]})}function jf({title:e,items:t,size:n,currentProject:r,onOpenFile:i,onArchive:a}){return t.length?(0,U.jsxs)("section",{className:"shrink-0",children:[(0,U.jsxs)("div",{className:"mb-2 flex items-baseline gap-2",children:[(0,U.jsx)("h2",{className:"text-[13px] font-bold",children:e}),(0,U.jsx)("span",{className:"text-[11px] font-semibold text-muted",children:t.length})]}),(0,U.jsx)(gO,{className:"flex flex-wrap gap-2.5",enter:"fade",children:t.map(e=>{let t=W(e.file);return(0,U.jsx)("div",{"data-flip-key":t,children:(0,U.jsx)(jm,{file:e.file,title:e.title,project:e.project,currentProject:r,descendants:e.descendants,statusLine:e.statusLine,size:n,tone:"working"===e.kind?"working":"waiting"===e.kind&&"stalled"===e.file.activity?"stalled":"waiting"===e.kind?"waiting":"quiet",onOpen:i,onArchive:a})},t)})})]}):null}function jh({files:e,flows:t,project:n,loaded:r,catalogFailures:i=0,onOpenFile:a,onOpenCatalogFile:s}){let{t:l}=(0,eh.Ym)(),[o,c]=(0,Y.useState)(!1),[d,u]=(0,Y.useState)(""),[p,m]=(0,Y.useState)(!1),[f,h]=(0,Y.useState)(!1),[x,g]=(0,Y.useState)(0),b=(0,Y.useRef)(null),v=function(e,t){let[n,r]=(0,Y.useState)([]),[i,a]=(0,Y.useState)(!1);return(0,Y.useEffect)(()=>{if(!t||!e)return;let n=!0;a(!0);let i=async()=>{try{let t=await fetch(`/api/timeline?project=${encodeURIComponent(e)}`),i=await t.json();n&&Array.isArray(i.events)&&r(i.events)}catch{}finally{n&&a(!1)}};i();let s=setInterval(i,7e3);return()=>{n=!1,clearInterval(s)}},[e,t]),{events:n,loading:i}}(n,o),{archivedPaths:w,archive:y,unarchive:k}=function(e){let[t,n]=(0,Y.useState)(()=>new Set),r=(0,Y.useRef)(t);return(0,Y.useEffect)(()=>{let e=function(){try{let e=window.localStorage.getItem(k0),t=e?JSON.parse(e):[];return new Set(Array.isArray(t)?t.filter(e=>"string"==typeof e):[])}catch{return new Set}}();r.current=e,n(e)},[]),(0,Y.useEffect)(()=>{let t=r.current;if(!t.size)return;let i=new Set(t);for(let t of e)t.predecessorPath&&i.has(t.predecessorPath)&&(i.delete(t.predecessorPath),i.add(t.path)),("live"===t.activity||"running"===t.proc)&&i.delete(t.path);i.size===t.size&&[...i].every(e=>t.has(e))||(r.current=i,n(i),k1(i))},[e]),{archivedPaths:t,archive:(0,Y.useCallback)(e=>{n(t=>{if(t.has(e))return t;let n=new Set(t);return n.add(e),r.current=n,k1(n),n})},[]),unarchive:(0,Y.useCallback)(e=>{n(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),r.current=n,k1(n),n})},[])}}(e),j=tj(e,v.events,d,x,w,t),N=bt({query:d,enabled:r&&o&&!!d.trim()}),S=tj(e,[],"",x,w,t),C=(0,Y.useMemo)(()=>e.filter(e=>w.has(e.path)).map(e=>({file:e,title:(0,ex.cr)(e.title),project:eM(e)})).sort((e,t)=>t.file.mtime-e.file.mtime),[e,w]);(0,Y.useEffect)(()=>{let e=()=>g(Date.now()/1e3);e();let t=window.setInterval(e,3e4);return()=>window.clearInterval(t)},[]),(0,Y.useEffect)(()=>{if(!o)return;let e=e=>{"Escape"===e.key&&c(!1)};return window.addEventListener("keydown",e),window.setTimeout(()=>b.current?.focus(),0),()=>window.removeEventListener("keydown",e)},[o]);let A=e=>{a(e),c(!1)},I=e=>y(e.path);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(k2,{data:S,onOpen:()=>c(!0)}),o?(0,U.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-primary/28 p-[2.5vh]",onMouseDown:()=>c(!1),children:(0,U.jsxs)("div",{className:"flex h-[95vh] w-[95vw] flex-col overflow-hidden rounded-[8px] border border-border bg-canvas shadow-2",role:"dialog","aria-modal":"true","aria-label":l("switch.aria"),onMouseDown:e=>e.stopPropagation(),children:[(0,U.jsxs)("header",{className:"flex h-14 shrink-0 items-center gap-3 border-b border-border bg-card px-4",children:[(0,U.jsx)("div",{className:"text-[15px] font-bold",children:l("switch.title")}),(0,U.jsx)(ju,{engine:"claude"}),(0,U.jsx)(ju,{engine:"codex"}),(0,U.jsx)("input",{ref:b,value:d,onChange:e=>u(e.target.value),placeholder:l("switch.search"),className:"h-9 min-w-0 flex-1 rounded-[8px] border border-border bg-canvas px-3 text-[13px] outline-none focus-visible:ring-2 focus-visible:ring-accent/40"}),v.loading?(0,U.jsx)("span",{className:"text-[11px] font-semibold text-muted",children:l("switch.updating")}):null,(0,U.jsx)("button",{className:"inline-flex h-8 w-8 items-center justify-center rounded-[8px] border border-border bg-canvas text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":l("switch.close"),onClick:()=>c(!1),children:(0,U.jsx)(sx.X,{className:"h-4 w-4","aria-hidden":!0})})]}),(0,U.jsx)("div",{className:"min-h-0 flex-1 space-y-5 overflow-y-auto px-4 py-4",children:d.trim()?(0,U.jsxs)("section",{className:"mx-auto w-full max-w-[900px]",children:[(0,U.jsxs)("div",{className:"mb-2 flex items-baseline gap-2",children:[(0,U.jsx)("h2",{className:"text-[13px] font-bold",children:l("switch.results")}),(0,U.jsx)("span",{className:"text-[11px] font-semibold text-muted",children:N.total})]}),(0,U.jsx)("div",{className:"space-y-1.5",children:N.items.map(e=>(0,U.jsxs)("button",{type:"button",className:"flex min-h-11 w-full min-w-0 items-center gap-2 rounded-[8px] border border-border bg-card px-3 text-left shadow-1 hover:border-accent/40 hover:bg-canvas focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>{s(e),c(!1)},children:[(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12.5px] font-semibold text-primary",children:(0,ex.cr)(e.title,100)}),(0,U.jsx)("span",{className:"max-w-[240px] shrink-0 truncate rounded-full border border-border bg-canvas px-2 py-0.5 text-[10.5px] font-semibold text-muted",title:e.project,children:eb(e.project,e.projectName)})]},e.path))}),N.loading&&!N.items.length?(0,U.jsxs)("div",{className:"flex items-center justify-center gap-2 pt-[18vh] text-[13px] font-semibold text-muted",children:[(0,U.jsx)(sx.kr,{className:"h-4 w-4 animate-spin","aria-hidden":!0})," ",l("common.loading")]}):null,N.error?(0,U.jsxs)("div",{className:"flex min-h-11 items-center justify-center gap-3 pt-4 text-[13px] font-semibold text-danger",children:[(0,U.jsx)("span",{children:l("list.failed")}),(0,U.jsx)("button",{type:"button",className:"min-h-11 rounded-[8px] border border-border bg-card px-4 font-bold text-primary hover:border-accent/40 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:N.retry,children:l("list.retry")})]}):null,N.loading||N.error||N.items.length?null:(0,U.jsx)("div",{className:"pt-[18vh] text-center text-[13px] font-semibold text-muted",children:l("common.nothingFound")}),N.nextCursor&&!N.error?(0,U.jsx)("button",{type:"button",className:"mt-3 flex min-h-11 w-full items-center justify-center rounded-[8px] border border-border bg-card px-4 text-[12.5px] font-bold text-primary hover:border-accent/40 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60",disabled:N.loading,onClick:N.loadMore,children:N.loading?l("common.loading"):l("list.loadMore")}):null]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(jf,{title:l("switch.waiting"),items:j.waiting,size:"large",currentProject:n,onOpenFile:A,onArchive:I}),(0,U.jsx)(jf,{title:l("switch.working"),items:j.working,size:"large",currentProject:n,onOpenFile:A,onArchive:I}),(0,U.jsx)(jf,{title:l("switch.recent"),items:j.recent,size:"small",currentProject:n,onOpenFile:A,onArchive:I}),(0,U.jsxs)("section",{className:"shrink-0",children:[(0,U.jsxs)("button",{className:"flex h-10 w-full items-center justify-between rounded-[8px] border border-border bg-card px-3 text-left text-[12.5px] font-bold hover:border-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-expanded":p,onClick:()=>m(e=>!e),children:[(0,U.jsx)("span",{children:l("switch.older")}),(0,U.jsx)("span",{className:"text-muted",children:j.older.length})]}),p?(0,U.jsx)("div",{className:"mt-2",children:(0,U.jsx)(jf,{title:"",items:j.older,size:"small",currentProject:n,onOpenFile:A,onArchive:I})}):null]}),j.waiting.length||j.working.length||j.recent.length||j.older.length?null:i>0?(0,U.jsx)(hj,{failures:i,className:"pt-[18vh]"}):r?(0,U.jsx)("div",{className:"pt-[18vh] text-center text-[13px] font-semibold text-muted",children:l("common.nothingFound")}):(0,U.jsxs)("div",{className:"flex items-center justify-center gap-2 pt-[18vh] text-[13px] font-semibold text-muted",children:[(0,U.jsx)(sx.kr,{className:"h-4 w-4 animate-spin","aria-hidden":!0}),l("common.loading")]}),C.length?(0,U.jsxs)("section",{className:"shrink-0",children:[(0,U.jsxs)("button",{className:"flex h-9 w-full items-center justify-between rounded-[8px] border border-border bg-card px-3 text-left text-[12px] font-bold text-muted hover:border-accent/40 hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-expanded":f,onClick:()=>h(e=>!e),children:[(0,U.jsx)("span",{children:l("switch.hidden",{count:C.length})}),(0,U.jsx)("span",{children:f?l("switch.hide"):l("common.show")})]}),f?(0,U.jsx)("div",{className:"mt-2 space-y-1",children:C.map(e=>(0,U.jsxs)("div",{className:"flex min-w-0 items-center gap-2 rounded-[8px] border border-border bg-card/60 px-3 py-1.5 text-[11.5px] text-muted",children:[(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate",children:e.title}),(0,U.jsx)("span",{className:"shrink-0 truncate text-[10.5px]",title:e.project,children:eb(e.project,e.file.projectName)}),(0,U.jsx)("button",{className:"shrink-0 rounded-full border border-border bg-canvas px-2 py-0.5 text-[10.5px] font-semibold text-primary hover:border-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>k(e.file.path),children:l("switch.restore")})]},W(e.file)))}):null]}):null]})})]})}):null]})}function jx({ambientAvailable:e}={}){let{t}=(0,eh.Ym)(),n=ia(),r=(0,Y.useSyncExternalStore)(t5,t1,()=>tW),[i,a]=(0,Y.useState)(!1),s=(0,Y.useRef)(null),l=(0,Y.useRef)(null),o=e??tz();(0,Y.useEffect)(()=>{var e;let t;return e=window,t=()=>{tV=null,tQ()},e.addEventListener("storage",t),()=>e.removeEventListener("storage",t)},[]);let c=n?"h-11 w-11":"h-[26px] w-[26px]",d=n?"h-5 w-5":"h-3.5 w-3.5",u=e=>{t2(e),nl()};return(0,U.jsxs)("span",{className:"ml-auto inline-flex shrink-0 items-center gap-1",children:[(0,U.jsx)("button",{className:`inline-flex shrink-0 items-center justify-center rounded-full border border-border bg-card text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${c}`,title:t(r.cuesEnabled?"sound.on":"sound.off"),"aria-label":t(r.cuesEnabled?"sound.mute":"sound.unmute"),"aria-pressed":r.cuesEnabled,onClick:()=>{let e=!r.cuesEnabled;t2({cuesEnabled:e}),e&&ns({cue:"success",eventId:`preview:${Date.now()}`}),nl()},children:r.cuesEnabled?(0,U.jsx)(cu.A,{className:d,"aria-hidden":!0}):(0,U.jsx)(cd.A,{className:d,"aria-hidden":!0})}),(0,U.jsxs)("span",{className:"relative inline-flex",children:[(0,U.jsx)("button",{ref:l,"data-testid":"sound-settings-trigger",className:`inline-flex shrink-0 items-center justify-center rounded-full border border-border bg-card text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${c}`,title:t("sound.settings"),"aria-label":t("sound.settings"),"aria-expanded":i,onClick:()=>a(e=>!e),children:(0,U.jsx)(lw.A,{className:d,"aria-hidden":!0})}),i?(0,U.jsxs)("div",{ref:s,"data-testid":"sound-settings",role:"dialog","aria-label":t("sound.settings"),onKeyDown:e=>{k5(e,()=>{a(!1),l.current?.focus()})},className:"absolute right-0 top-full z-50 mt-1 w-56 space-y-2 rounded-control border border-border bg-card p-2 shadow-2",children:[(0,U.jsxs)("label",{className:"block space-y-1",children:[(0,U.jsx)("span",{className:"block text-[11px] font-semibold text-secondary",children:t("sound.cueVolume")}),(0,U.jsx)("input",{type:"range","data-testid":"cue-volume",min:0,max:1,step:.05,value:r.cueVolume,"aria-label":t("sound.cueVolume"),onChange:e=>u({cueVolume:Number(e.target.value)}),className:"w-full accent-accent"})]}),o?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)("label",{className:"flex items-center gap-2",children:[(0,U.jsx)("input",{type:"checkbox","data-testid":"ambient-viewer-enabled",checked:r.viewerLoopEnabled,onChange:e=>{t2({viewerLoopEnabled:e.target.checked}),nl()},className:"accent-accent"}),(0,U.jsx)("span",{className:"text-[11px] font-semibold text-secondary",children:t("sound.ambientViewer")})]}),(0,U.jsxs)("label",{className:"flex items-center gap-2",children:[(0,U.jsx)("input",{type:"checkbox","data-testid":"ambient-enabled",checked:r.loopEnabled,onChange:e=>{t2({loopEnabled:e.target.checked}),nl()},className:"accent-accent"}),(0,U.jsx)("span",{className:"text-[11px] font-semibold text-secondary",children:t("sound.ambient")})]}),(0,U.jsxs)("label",{className:"block space-y-1",children:[(0,U.jsx)("span",{className:"block text-[11px] text-muted",children:t("sound.ambientVolume")}),(0,U.jsx)("input",{type:"range","data-testid":"ambient-volume",min:0,max:1,step:.05,value:r.loopVolume,"aria-label":t("sound.ambientVolume"),onChange:e=>u({loopVolume:Number(e.target.value)}),className:"w-full accent-accent"})]}),(0,U.jsx)("p",{className:"text-[10.5px] leading-snug text-muted",children:t("sound.ambientHint")})]}):null]}):null]})]})}function jg({items:e,activeRootPaths:t,onSelect:n}){let{t:r}=(0,eh.Ym)(),i=ia(),[a,s]=(0,Y.useState)(!1);return(0,U.jsxs)("div",{className:"shrink-0 border-t border-border bg-canvas",children:[(0,U.jsx)(vl,{open:a,onToggle:()=>s(e=>!e),label:r("tree.quiet"),count:e.length,mobile:i}),a?(0,U.jsx)(gO,{className:"flex max-h-44 flex-wrap items-start gap-1.5 overflow-y-auto px-3 pb-2.5",children:e.map(e=>{let a=(0,tw.yz)(e),s=(0,tw.cr)(e.cmdDesc||e.title,70),l=t?.has(e.path)??!1;return(0,U.jsxs)("button",{"data-flip-key":e.path,className:`inline-flex max-w-[360px] items-center gap-1.5 rounded-full border border-transparent bg-sunken text-[11px] font-semibold text-primary hover:border-border focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${i?"min-h-11 px-3":"h-7 px-2"}`,title:(0,tw.cr)(e.title),onClick:()=>n(e),children:[(0,U.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${(0,tw.tz)(e.activity)}`}),(0,U.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px]",style:a.style,children:a.label}),(0,U.jsx)("span",{className:"truncate",children:s}),l?(0,U.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-full bg-accent/10 px-1.5 text-[9px] font-bold text-accent",title:r("trash.activeSubtree"),children:[(0,U.jsx)(sx.Zr,{className:"h-2.5 w-2.5","aria-hidden":!0}),r("trash.activeSubtree")]}):null,(0,U.jsx)("span",{className:"shrink-0 font-normal text-muted",children:(0,tw.rK)(e.mtime)})]},e.path)})}):null]})}let jb=e=>`llvDrafts:${e}`;function jv(e,t){return e&&(e.startsWith("draft::")||t.some(t=>t.path===e))?e:null}function jw(e){location.hash="#p="+encodeURIComponent(e)}function jy({value:e,onChange:t,floating:n=!1}){let{t:r}=(0,eh.Ym)();return(0,U.jsx)("div",{className:`z-30 inline-flex shrink-0 items-center gap-0.5 rounded-full border border-border bg-card p-0.5 shadow-1 ${n?"absolute left-3 top-3":"mx-3 mt-3 self-start"}`,children:["scheme","list"].map(n=>(0,U.jsxs)("button",{type:"button","aria-pressed":e===n,onClick:()=>t(n),"aria-label":r("scheme"===n?"dash.viewScheme":"dash.viewList"),className:`inline-flex items-center justify-center gap-1 rounded-full px-2 py-1 text-[11px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${e===n?"bg-accent/10 text-accent":"text-muted hover:text-primary"}`,children:["scheme"===n?(0,U.jsx)(hO.A,{className:"h-3 w-3","aria-hidden":!0}):(0,U.jsx)(hD.A,{className:"h-3 w-3","aria-hidden":!0}),r("scheme"===n?"dash.viewScheme":"dash.viewList")]},n))})}function jk({triggerLabel:e,icon:t,children:n}){let[r,i]=(0,Y.useState)(!1),a=(0,Y.useRef)(null);return(0,Y.useEffect)(()=>{if(!r)return;let e=e=>{a.current?.contains(e.target)||i(!1)},t=e=>{"Escape"===e.key&&i(!1)};return window.addEventListener("pointerdown",e),window.addEventListener("keydown",t),()=>{window.removeEventListener("pointerdown",e),window.removeEventListener("keydown",t)}},[r]),(0,U.jsxs)("div",{ref:a,className:"relative shrink-0",children:[(0,U.jsx)("button",{type:"button","aria-haspopup":"menu","aria-expanded":r,"aria-label":e,title:e,onClick:()=>i(e=>!e),className:"flex h-11 w-11 items-center justify-center rounded-[8px] border border-border bg-card text-primary shadow-1 hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:t}),r?(0,U.jsx)("div",{role:"menu",className:"absolute right-0 top-[calc(100%+6px)] z-50 flex w-[210px] max-w-[calc(100vw-1.5rem)] flex-col gap-0.5 rounded-[12px] border border-border bg-card p-1.5 shadow-2",children:n(()=>i(!1))}):null]})}function jj({icon:e,label:t,onSelect:n,disabled:r=!1,checked:i}){return(0,U.jsxs)("button",{type:"button",role:void 0===i?"menuitem":"menuitemradio","aria-checked":i,onClick:n,disabled:r,className:`flex min-h-11 w-full items-center gap-2 rounded-[9px] px-2.5 text-left text-[13px] font-semibold hover:bg-canvas focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:cursor-not-allowed disabled:opacity-45 ${i?"bg-accent/10 text-accent":"text-primary"}`,children:[(0,U.jsx)("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center text-accent",children:e}),t]})}let jN=(0,Y.memo)(function({files:e,flows:t,pipelines:n,pipelinesError:r,workflows:i,tasks:a,conversationAliases:s,projectCatalog:l=[],projectName:o,projectCwd:c,project:d,loaded:u,catalogFailures:p=0,openNonce:m,focusRequest:f,placeRequest:h,attentionPaths:x,archived:g,catalogKnown:b,catalogConversationCount:v,onArchive:w,onUnarchive:y,onMenu:k,onOpenSearch:j,attention:N,orchestratorPanelOpen:S=!1,onToggleOrchestratorPanel:C,onUserNavigate:A,onOpenCatalogFile:I,onCloseFile:M}){var T;let{t:P}=(0,eh.Ym)(),$=ia(),E=eb(d,o??l.find(e=>e.project===d)?.displayName),R=(0,Y.useMemo)(()=>{let n,r;return n=!1,r=t.map(t=>{let r=et(t.implementerPath,t.implementerConversationId,e)??t.implementerPath,i=!1,a=t.rounds.map(t=>{let n=t.reviewerPath?et(t.reviewerPath,t.reviewerConversationId,e):t.reviewerPath;return n===t.reviewerPath?t:(i=!0,{...t,reviewerPath:n})});return r!==t.implementerPath||i?(n=!0,{...t,implementerPath:r,...i?{rounds:a}:{}}):t}),n?r:t},[t,e]),O=(0,Y.useMemo)(()=>{let t,r;return t=!1,r=n.map(n=>{let r=!1,i=n.runs.map(t=>{let n=!1,i=t.attempts.map(t=>{let r=et(t.agentPath,t.conversationId,e);return r===t.agentPath?t:(n=!0,{...t,agentPath:r})});return n?(r=!0,{...t,attempts:i}):t});return r?(t=!0,{...n,runs:i}):n}),t?r:n},[n,e]),D=(0,Y.useRef)(null),L=(0,Y.useRef)(null),_=(0,Y.useRef)(h0()),F=(0,Y.useRef)(h0()),q=it(d),z=(T=q.loaded,u&&T),H=function(e){let[t,n]=(0,Y.useState)(hH);(0,Y.useEffect)(()=>{n(null===e?hH():function(e){try{let t=window.localStorage.getItem(hY(e));return t?function(e){if("object"!=typeof e||null===e||!Array.isArray(e.entries)||"number"!=typeof e.cursor)return hH();let t=e.entries.filter(hK);if(t.length!==e.entries.length)return hH();let n=Number.isInteger(e.cursor)?Math.min(Math.max(0,e.cursor),t.length):t.length;return{entries:t,cursor:n}}(JSON.parse(t)):hH()}catch{return hH()}}(e))},[e]);let r=t=>{n(t),null!==e&&function(e,t){try{window.localStorage.setItem(hY(e),JSON.stringify(t))}catch{}}(e,t)};return{canUndo:hU(t),canRedo:hB(t),undoEntry:hU(t)?t.entries[t.cursor-1]:null,redoEntry:hB(t)?t.entries[t.cursor]:null,record:n=>{let i,a,s;null!==e&&r({entries:s=(a=Math.max(0,(i=[...t.entries.slice(0,t.cursor),n]).length-50))?i.slice(a):i,cursor:s.length})},undo:()=>{let{history:e,entry:n}=function(e){if(!hU(e))return{history:e,entry:null};let t=e.entries[e.cursor-1];return{history:{entries:e.entries,cursor:e.cursor-1},entry:t}}(t);return null!==n&&r(e),n},redo:()=>{let{history:e,entry:n}=function(e){if(!hB(e))return{history:e,entry:null};let t=e.entries[e.cursor];return{history:{entries:e.entries,cursor:e.cursor+1},entry:t}}(t);return null!==n&&r(e),n}}}(d),B=(0,Y.useMemo)(()=>({manual:q.prefs.manual,hidden:q.prefs.hidden,expanded:q.prefs.expanded}),[q.prefs]),K=q.prefs.taskPanelOpen,J=q.prefs.favorites,G=(0,Y.useMemo)(()=>new Set(J),[J]),X=(0,Y.useMemo)(()=>({has:e=>J.includes(e),toggle:e=>q.setFavorite(e,!J.includes(e))}),[J]),er=(0,Y.useMemo)(()=>dk(e,J),[e,J]),[ei,ea]=(0,Y.useState)([]),[es,el]=(0,Y.useState)(()=>new Set),[eo,ed]=(0,Y.useState)(null),[eu,ep]=(0,Y.useState)(!1),[em,ef]=(0,Y.useState)(0),[ex,eg]=(0,Y.useState)(0),[ev,ew]=(0,Y.useState)(null),[eC,eT]=(0,Y.useState)(!1),[e$,eE]=(0,Y.useState)(null),[eL,eq]=(0,Y.useState)(null),[ez,eU]=(0,Y.useState)([]),[eB,eK]=(0,Y.useState)(null),[eY,eW]=(0,Y.useState)(0),eV=hX(3e4),eJ=(0,Y.useMemo)(()=>[...O.filter(e=>e.project===d).map(e=>e.repoDir),...i.filter(e=>e.project===d).map(e=>e.repoDir),...c?[c]:[]],[O,d,c,i]),eQ=(0,Y.useMemo)(()=>eP(e,d,l,void 0,eJ,""),[e,d,l,eJ]),eZ=eQ||"/",e0=!!eQ;(0,Y.useEffect)(()=>{let e=()=>eW(Date.now());e();let t=window.setInterval(e,3e4);return()=>window.clearInterval(t)},[]),(0,Y.useEffect)(()=>{if(!u)return;let t=!1,n=new Set,r=function(e){try{let t=JSON.parse(sessionStorage.getItem(jb(e))??"[]"),n=Array.isArray(t)?t.filter(e=>"string"==typeof e):[],r=n.filter(e=>!nL(e));if(r.length!==n.length){for(let e of n)nL(e)&&vT(e);sessionStorage.setItem(jb(e),JSON.stringify(r))}return r}catch{return[]}}(d),i=[];for(let t of r)if(!nL(t)){let n=bk(t)||void 0;if(bw(t,"cwd").trim()){!n&&e0&&function(e,t){let n=t.trim();n&&bN(e)&&bw(e,"cwd").trim()!==n&&(bj(e,n),window.dispatchEvent(new window.CustomEvent(bS,{detail:{id:e,cwd:n}})))}(t,eZ);continue}let r=n?e.find(e=>e.path===n)?.cwd?.trim():void 0;r?bj(t,r):n?i.push({id:t,sourcePath:n}):bj(t,eZ)}ea(r),el(new Set(i.map(({id:e})=>e)));let a=(e,r,i=0)=>{fetch("/api/spawn?project="+encodeURIComponent(d)+"&src="+encodeURIComponent(r)).then(async e=>{if(!e.ok)throw Error(`spawn suggestions failed: ${e.status}`);return e.json()}).then(n=>{let r="string"==typeof n.cwd?n.cwd.trim():"";if(!r)throw Error("spawn suggestions omitted the source cwd");t||(bj(e,r),el(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n}))}).catch(()=>{if(t)return;if(i+1>=4){bj(e,eZ),el(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n});return}let s=i<2?0:Math.min(1e3*2**(i-2),3e4),l=window.setTimeout(()=>{n.delete(l),a(e,r,i+1)},s);n.add(l)})};for(let{id:e,sourcePath:t}of i)a(e,t);return()=>{for(let e of(t=!0,n))window.clearTimeout(e)}},[d,m,u,eZ,e0]);let e1=()=>q.setTaskPanelOpen(!K);(0,Y.useEffect)(()=>()=>{D.current&&window.clearTimeout(D.current)},[]);let e2=(0,Y.useMemo)(()=>(function(e){let t=en([...e.files]),n=function(e){var t;let n=e.conversationAliases??{},r=e=>ee(e,n),i=en([...e.files]),a=function(e){let t=new Set;for(let n of e)for(let e of n.rounds)e.reviewerPath&&t.add(e.reviewerPath);return t}(e.flows),s=(t=e.tasks??[],(e,n)=>{if(!e&&!n)return null;let r=null,i="";for(let a of t){let t=function(e,t,n){let r=null;for(let i of e.assignments)(i.conversationId===t||null!==n&&i.path===n)&&(null===r||i.at>r)&&(r=i.at);return r}(a,e??"",n);null!==t&&(null===r||t>i||t===i&&a.updatedAt>r.updatedAt)&&(r=a,i=t)}return r}),l=new Map;for(let e of i){let t=e.durableLineage;if(!t||"reviewer"!==t.role||!t.reviewsConversationId||t.memberships.length||a.has(e.path))continue;let n=r(t.reviewsConversationId),i=e.conversationId?r(e.conversationId):null;if(null!==i&&i===n)continue;let o=s(i,e.path)??s(n,null),c=o?`task::${o.id}`:`subject::${n}`,d={file:e,reviewedId:n},u=l.get(c);u?u.members.push(d):l.set(c,{key:c,task:o,members:[d]})}for(let e of l.values())e.members.sort((e,t)=>e.file.mtime-t.file.mtime||(e.file.path<t.file.path?-1:1));return[...l.values()].sort((e,t)=>e.key<t.key?-1:1)}(e),r=e.nowMs??Date.now(),i=e.idleMs??tp(),a=[];for(let{key:s,members:l}of n){let n=l[l.length-1],o=Z(t,n.reviewedId);if(!o||e.flows.some(e=>e3(e)&&e.implementerPath===o.path))continue;let c=l.map((e,t)=>{let{file:n}=e,r=n.review??null,i=!r&&!("live"===n.activity||"stalled"===n.activity||"running"===n.proc||n.pendingQuestion||n.waitingInput);return{n:t+1,reviewerPath:n.path,reviewerConversationId:n.conversationId??null,findingsPath:null,triggeredBy:"button",readyNote:null,verdict:r?.verdict??null,findingsCount:r?.findingsCount??null,startedAt:new Date(1e3*n.mtime).toISOString(),reviewedAt:r?.observedAt??null,terminalAt:r?.observedAt??null,relayedAt:null,error:i?"no verdict":null}}),d=c[c.length-1],u={engine:"codex"===n.file.engine?"codex":"claude",model:n.file.model,effort:n.file.effort??null};a.push({id:tb+s,template:"implement-review-loop",project:eM(o),cwd:o.cwd??"",implementerPath:o.path,implementerConversationId:o.conversationId??null,roles:{implementer:{engine:"codex"===o.engine?"codex":"claude",model:o.model,effort:o.effort??null},reviewer:u},baseRef:"",baseMode:"head",mode:"manual",reviewerMode:"pane",roundLimit:0,state:null===d.verdict&&(null===d.error||r-1e3*n.file.mtime<i)?"reviewing":"done_comment",stateDetail:null,rounds:c,createdAt:c[0].startedAt,closedAt:null})}return a.sort((e,t)=>e.id<t.id?-1:1)})({files:e,flows:R,tasks:a,conversationAliases:s,nowMs:eY}),[e,R,a,s,eY]),e5=(0,Y.useMemo)(()=>e2.length?[...R,...e2]:R,[R,e2]),e4=(0,Y.useMemo)(()=>{let t=e5.filter(e3),n=function(e,t){let n=e8(t,e);for(let t of e)(t.durableLineage?.role==="reviewer"||t.durableLineage?.memberships.some(e=>"flow"===e.kind&&"reviewer"===e.role))&&n.add(t.path);let r=new Map;for(let t of e){if(!t.parent)continue;let e=r.get(t.parent);e?e.push(t):r.set(t.parent,[t])}let i=new Set,a=[...n],s=new Set(a);for(;a.length;){let e=a.pop();for(let t of r.get(e)??[])s.has(t.path)||(s.add(t.path),i.add(t.path),a.push(t.path))}return i}(e,t);for(let e of t)tv(e)&&"reviewing"!==e.state||n.add(e.implementerPath);return function(e,t){let{flows:n,files:r,now:i,ageHorizonSeconds:a}=t,s=new Set(e),l=new Set;for(let e of n)e.rounds.some(t=>{let n=e7(e,t,r);return!!n&&("live"===n.activity||"running"===n.proc)})&&l.add(e.implementerPath);let o=new Map(r.map(e=>[e.path,e]));for(let t of e){if(l.has(t))continue;let e=o.get(t);e&&!ej(e,i,a)&&s.delete(t)}return s}(n,{flows:t,files:e,now:eV,ageHorizonSeconds:ek()})},[e,e5,eV]),e6=(0,Y.useMemo)(()=>{let e=new Set(e4);for(let t of B.expanded)e.add(t);return e},[e4,B.expanded]),e9=(0,Y.useMemo)(()=>new Set([...q.explicitManual,...B.expanded]),[q.explicitManual,B.expanded]),tn=(0,Y.useMemo)(()=>xw(O,e5),[O,e5]),tr=(0,Y.useMemo)(()=>xk(O,e5),[O,e5]),ti=(0,Y.useMemo)(()=>(function(e,t,n=tt){let r=eX(e),i=function(e,t){if(!e.size||t===eG)return e;let n=new Set;for(let r of e)n.add(r),n.add(t(r));return n.size===e.size?e:n}(n,r),a=new Map;for(let e of t){let t=r(e.implementerPath);for(let n of e.rounds){let e=n.reviewerPath?r(n.reviewerPath):null;e&&!i.has(e)&&a.set(e,t)}}let s=new Map(en(e).flatMap(e=>e.conversationId?[[e.conversationId,e.path]]:[]));for(let n of e){if(i.has(n.path))continue;let e=n.durableLineage?.memberships.find(e=>"flow"===e.kind&&"reviewer"===e.role);if(!e)continue;let l=t.find(t=>t.id===e.containerId),o=(n.durableLineage?.reviewsConversationId?s.get(n.durableLineage.reviewsConversationId):void 0)??n.parent??(l?r(l.implementerPath):void 0);o&&a.set(n.path,o)}if(!a.size)return e;let l=[];for(let t of e){if(a.has(t.path))continue;let e=t.parent?a.get(t.parent):void 0;l.push(e?{...t,parent:e}:t)}return l})(e,tr,tn),[e,tr,tn]),ta=(0,Y.useMemo)(()=>(function(e,t,n=[]){let r=new Map(t.map(e=>[e.id,e])),i=xw(e,t),a=new Set;for(let t of e)for(let e of t.runs)for(let t of e.attempts){t.agentPath&&!i.has(t.agentPath)&&a.add(t.agentPath);let e=t.flowId?r.get(t.flowId):null;if(e)for(let t of(i.has(e.implementerPath)||a.add(e.implementerPath),e.rounds))for(let{path:r}of te(e,t,n))i.has(r)||a.add(r)}return a})(O,e5,e),[O,e5,e]),ts=(0,Y.useMemo)(()=>(function(e){let t,n=(t=eX(e.files),{flows:e.flows,resolveClaimPath:t,pipelineStagePaths:function(e,t=eG){let n=new Set;for(let r of e)for(let e of r.runs)for(let r of e.attempts)r.agentPath&&n.add(t(r.agentPath));return n}(e.pipelines??[],t),nowMs:e.nowMs,idleMs:e.idleMs??tp(),pinnedPaths:e.pinnedPaths,protectedPaths:e.protectedPaths??tx}),r=eR(e.files),i=[];for(let t of e.files)eM(t)===e.project&&function(e,t){if("engine"===e.spawnOrigin)return!1;let n=function(e,t){if(e.handoff)return null;let n=tm(e,t.flows,t.resolveClaimPath);return n?.role==="reviewer"?"flow-reviewer":n?.role==="implementer"?e.parent?"flow-implementer":null:t.pipelineStagePaths.has(e.path)?"pipeline-stage":eA(e)?"spawned-worker":e.parent?"spawned-descendant":null}(e,t);if(!n||tf(e,t))return!1;let r=tm(e,t.flows,t.resolveClaimPath);if("flow-reviewer"===n){var i;return!!(r?.round&&(null!==(i=r.round).verdict||null!==i.reviewedAt||null!==i.error||i.terminalAt))}return("flow-implementer"!==n||!!r&&"closed"===r.flow.state&&!r.flow.restored)&&t.nowMs-1e3*e.mtime>=t.idleMs}(t,n)&&(eO(t,r).some(e=>tf(e,n))||i.push(t));return i})({files:e,project:d,flows:e5,pipelines:O,pinnedPaths:e9,protectedPaths:tn,nowMs:eY}),[e,d,e5,O,e9,tn,eY]),tl=(0,Y.useMemo)(()=>new Set(ts.map(e=>e.path)),[ts]),to=(0,Y.useMemo)(()=>new Map(e.map(e=>[e.path,e])),[e]),tc=(0,Y.useMemo)(()=>(function(e,t=[],n=[]){let r=new Map(t.map(e=>[e.id,e])),i=new Map;for(let t of e)for(let e of t.runs)for(let a of e.attempts)if(a.agentPath&&!i.has(a.agentPath)&&i.set(a.agentPath,t.id),a.flowId){let e=r.get(a.flowId);if(e)for(let r of(i.has(e.implementerPath)||i.set(e.implementerPath,t.id),e.rounds))for(let{path:a}of te(e,r,n))i.has(a)||i.set(a,t.id)}return i})(O,R,e),[O,R,e]),td=(0,Y.useMemo)(()=>e=>{let t=to.get(e);return t?function(e,t,n){let r=e,i=new Set;for(;r&&!i.has(r.path);){let e=n.get(r.path);if(e)return e;i.add(r.path),r=r.parent?t.get(r.parent):void 0}return null}(t,to,tc):null},[to,tc]),tu=(0,Y.useMemo)(()=>e=>{let t=e,n=new Set([e.path]);for(;;){let e=t.parent?to.get(t.parent):void 0;if(!e||n.has(e.path))break;n.add(e.path),t=e}return t.path===e.path?null:t.path},[to]),tw=(0,Y.useMemo)(()=>e.filter(e=>eM(e)===d&&(e.spawn?.state==="failed"||e.spawn?.state==="recovered")&&eY-1e3*e.mtime>=9e5).sort((e,t)=>t.mtime-e.mtime),[e,d,eY]),ty=(0,Y.useMemo)(()=>(function(e){let t=new Set;for(let n of e)n.path.startsWith("spawn:")&&t.add(n.path);return t})(tw),[tw]),tk=(0,Y.useMemo)(()=>tl.size||ty.size||ta.size?xy(ti.filter(e=>!tl.has(e.path)&&!ty.has(e.path)),ta):ti,[ti,tl,ty,ta]),tj=(0,Y.useMemo)(()=>eF(tk,d,{expandedConversationPaths:e6,now:eV}),[tk,d,e6,eV]),tN=(0,Y.useMemo)(()=>{let t=new Set(B.hidden),n=new Set(B.manual);for(let e of tj)for(let t of(n.add(e.key),e.columns))n.add(t.file.path);let r=new Set;for(let e of n){if(t.has(e))continue;let n=to.get(e);n&&eM(n)===d&&r.add(W(n))}let i=new Set([...ta,...tl,...ty]);return function(e){let t=e.ageHorizonSeconds??ek(),n=new Map(e.entries.map(e=>[e.path,e])),r=new Map;for(let t of e.entries){if(V(t))continue;let e=W(t),n=r.get(e),i=t.generation??0,a=n?.generation??0;(!n||i>a||i===a&&t.mtime>n.mtime)&&r.set(e,t)}let i=new Set,a=new Set,s=new Set,l=new Map,o=new Map;for(let c of r.values()){if("shell"===c.engine||"engine"!==c.spawnOrigin||e.hiddenPaths.has(c.path)||e.claimedPaths.has(c.path))continue;let r=function(e,t){let n=e.durableLineage?.parentConversationId;if(n)return n;if(e.parent){let n=t.get(e.parent);if(n)return W(n)}return e.parentRemoved?.conversationId??null}(c,n);if(!r)continue;let d=W(c);if(!e.hostEligibleParentIds.has(r)){(e.pinnedPaths.has(c.path)||ej(c,e.now,t))&&i.add(c.path);continue}if("promoted"===function(e,t){let n,r=!ej(e,t.now,t.ageHorizonSeconds??ek());return r||null===eH(e,t.now)&&e.spawn?.state!=="failed"&&"killed"!==e.proc?t.folded?{presence:"folded",reason:"hand-fold"}:e.userAuthored||e.authorshipUnverified||t.pinned?{presence:"promoted",reason:"owner"}:e.authoritativeTurn?.state==="busy"||"running"===e.proc||"live"===e.activity?{presence:"promoted",reason:"busy"}:"terminal"===(n=e.authoritativeTurn?.state)||"idle"===n||"idle"===e.activity||"done"===e.proc||"killed"===e.proc||e.supersededBy?{presence:"folded",reason:"quiet"}:r?{presence:"folded",reason:"aged"}:{presence:"promoted",reason:"fail-visible"}:{presence:"promoted",reason:"attention"}}(c,{folded:e.foldedEngineChildIds.has(d),pinned:e.pinnedPaths.has(c.path),now:e.now,ageHorizonSeconds:t}).presence){i.add(c.path);continue}a.add(c.path),s.add(d),o.set(d,function(e){let t=e.sessionStartedAt?Date.parse(e.sessionStartedAt):NaN;return Number.isFinite(t)?t:1e3*e.mtime}(c));let u=l.get(r)??[];u.push(function(e,t){let n=W(e);return{id:n,path:e.path,title:e.title,engine:e.engine,model:e.model,state:vr(e,t),avatarSeed:n}}(c,e.now)),l.set(r,u)}let c=new Map;for(let[t,n]of l)n.sort((e,t)=>vi(e.state)-vi(t.state)||(o.get(e.id)??0)-(o.get(t.id)??0)||e.id.localeCompare(t.id)),c.set(t,{parentConversationId:t,members:n,count:n.length,hottest:function(e){let t="dead";for(let n of e)vi(n)<vi(t)&&(t=n);return t}(n.map(e=>e.state)),expanded:e.expandedTrayParentIds.has(t)});return{promotedPaths:i,foldedPaths:a,foldedIds:s,traysByParent:c}}({entries:e,foldedEngineChildIds:new Set(q.prefs.foldedEngineChildIds??[]),expandedTrayParentIds:new Set(q.prefs.expandedEngineTrayParentIds??[]),pinnedPaths:e9,hiddenPaths:t,claimedPaths:i,hostEligibleParentIds:r,now:eV})},[tj,B.hidden,B.manual,q.prefs.foldedEngineChildIds,q.prefs.expandedEngineTrayParentIds,to,d,e,ta,tl,ty,e9,eV]),tS=(0,Y.useMemo)(()=>tN.promotedPaths.size||tN.foldedPaths.size?eF(tk,d,{expandedConversationPaths:e6,enginePlacement:{promotedEnginePaths:tN.promotedPaths,foldedEnginePaths:tN.foldedPaths},now:eV}):tj,[tk,d,e6,tN,tj,eV]),tC=(0,Y.useMemo)(()=>new Set(tS.map(e=>e.key)),[tS]),tA=(0,Y.useMemo)(()=>(function(e,t,n){let r=eR(e),i=[];for(let a of e){if(eM(a)!==t||!eS(a)||n.has(a.path))continue;let e=eO(a,r);if(!e.length)continue;let s=a.mtime,l=eN(a);for(let t of e)s=Math.max(s,t.mtime),l=Math.min(l,eN(t));l<3&&i.push({root:a,branchCount:e.length,smt:s,band:l})}return i.sort((e,t)=>e.band-t.band||t.smt-e.smt)})(tk,d,tC),[tk,d,tC]),tI=(0,Y.useMemo)(()=>(function(e,t,n){let r=eR(e),i=new Set;for(let a of e)eM(a)===t&&eS(a)&&n.has(a.path)&&"idle"===a.activity&&eO(a,r).some(e_)&&i.add(a.path);return i})(tk,d,tC),[tk,d,tC]),tM=(0,Y.useMemo)(()=>(function(e,t,n,r=new Set){let i=eR(e);return e.filter(e=>eM(e)===t&&!e.parent&&(!!r.has(e.path)||!(n.has(e.path)||i.get(e.path)?.length)&&"live"!==e.activity)).sort((e,t)=>eN(e)-eN(t)||t.mtime-e.mtime)})(tk,d,tC,tI),[tk,d,tC,tI]),tT=(0,Y.useMemo)(()=>new Set(tS.flatMap(e=>e.columns.map(e=>e.file.path))),[tS]),tP=(0,Y.useMemo)(()=>new Set(B.hidden),[B.hidden]),t$=(0,Y.useMemo)(()=>a.filter(e=>e.project===d),[a,d]),[tE,tR]=(0,Y.useState)(()=>vc(d));(0,Y.useEffect)(()=>{tR(vc(d))},[d]);let tO=(e,t)=>{tR(n=>{if(n.has(e)===t)return n;let r=new Set(n);t?r.add(e):r.delete(e);try{window.localStorage.setItem("llvTaskExpand:"+d,JSON.stringify([...r]))}catch{}return r})},[tD,tL]=(0,Y.useState)(null),t_=(0,Y.useMemo)(()=>(function(e,t){let n=new Map(t.files.map(e=>[e.path,e])),r=[],i=new Map;for(let a of e){if(!function(e,t,n){var r;let i;return!(t.expandedIds.has(e.id)||t.focusedTaskId===e.id||function(e,t){if(e.assignments.some(e=>"failed"===e.state))return!0;if("done"!==e.status&&e.dueAt){let n=Date.parse(e.dueAt);if(Number.isFinite(n)&&n<=t)return!0}return!1}(e,t.nowMs))&&(r=t.nowMs,(!Number.isFinite(i=Date.parse(e.updatedAt||e.createdAt))||!(r-i<9e5))&&!function(e,t){for(let n of e.assignments){if("spawning"===n.state)return!0;let e=n.path?t.get(n.path):void 0;if(e&&("live"===e.activity||"stalled"===e.activity||"running"===e.proc||e.pendingQuestion||e.waitingInput))return!0}return!1}(e,n??new Map(t.files.map(e=>[e.path,e]))))}(a,t,n)){r.push(a);continue}let e=i.get(a.status)??[];e.push(a),i.set(a.status,e)}let a=[];for(let e of gJ){let t=i.get(e);t?.length&&(t.sort((e,t)=>e.updatedAt<t.updatedAt?1:e.updatedAt>t.updatedAt||e.id<t.id?-1:1),a.push({status:e,items:t}))}return{full:r,stacks:a}})(t$.filter(b_),{files:e,nowMs:eY,focusedTaskId:tD,expandedIds:tE}),[t$,e,eY,tD,tE]),tF=(0,Y.useMemo)(()=>new Set(t_.stacks.flatMap(e=>e.items.map(e=>e.id))),[t_]),tq=(0,Y.useMemo)(()=>tF.size?t$.filter(e=>!tF.has(e.id)):t$,[t$,tF]),tz=(0,Y.useMemo)(()=>{let e=new Map(tk.map(e=>[e.path,e]));return B.manual.map(t=>e.get(t)).filter(e=>void 0!==e&&eM(e)===d&&!tT.has(e.path)&&!tP.has(e.path))},[B.manual,tk,d,tT,tP]),tH=(0,Y.useMemo)(()=>{let t=new Map(ti.map(e=>[e.path,e])),n=new Map(e.filter(e=>ta.has(e.path)).map(e=>[e.path,e])),r=new Set(tz.map(e=>e.path)),i=ez.map(e=>t.get(e)??n.get(e)).filter(e=>void 0!==e&&eM(e)===d&&!r.has(e.path)&&(!tT.has(e.path)||tP.has(e.path))),a=(function(e){let t=new Map(e.files.map(e=>[e.path,e])),n=new Map;for(let t of e.files){let e=t.durableLineage?.memberships.find(e=>"flow"===e.kind&&"reviewer"===e.role);if(!e)continue;let r=n.get(e.containerId)??[];r.push(t.path),n.set(e.containerId,r)}let r=new Set;for(let t of e.flows)if(("closed"!==t.state||t.restored)&&e.renderedNodePaths.has(t.implementerPath)){for(let e of t.rounds)e.reviewerPath&&r.add(e.reviewerPath);for(let e of n.get(t.id)??[])r.add(e)}let i=[],a=new Set;for(let s of e.flows)for(let l of[...s.rounds.map(e=>e.reviewerPath),...n.get(s.id)??[]]){if(!l||a.has(l)||r.has(l)||e.renderedNodePaths.has(l)||e.hiddenPaths.has(l))continue;let n=t.get(l);if(!n)continue;let s=e.pinnedPaths.has(l);(s||ej(n,e.now??0,e.ageHorizonSeconds??ek()))&&(s||n.userAuthored||n.authorshipUnverified)&&(i.push(n),a.add(l))}return i})({files:e,flows:e5,renderedNodePaths:new Set([...[...tT].filter(e=>!tP.has(e)),...r,...i.map(e=>e.path)]),hiddenPaths:tP,pinnedPaths:e9,now:eV}).filter(e=>eM(e)===d&&!ta.has(e.path)),s=[...i,...a];return s.length?[...tz,...s]:tz},[ez,ti,e,ta,e5,d,tT,tP,tz,e9,eV]),tU=(0,Y.useMemo)(()=>tS.reduce((e,t)=>e+t.columns.reduce((e,t)=>e+ +("live"===t.file.activity)+t.tasks.filter(e=>"live"===e.activity).length,0),0),[tS]),tB=tS.filter(e=>!e.orphanTask).length,tK=e=>{A?.(),eq(e),tL(e.startsWith("task::")?e.slice(6):null),D.current&&window.clearTimeout(D.current),D.current=window.setTimeout(()=>eq(null),1800)},tY=e=>{tO(e,!0),tK("task::"+e)};(0,Y.useEffect)(()=>{eU([]),eK(null)},[d]),(0,Y.useEffect)(()=>{if(!f||!(null!==jv(f.path,e)||ta.has(f.path))||!_.current.consume(f))return;let{path:t}=f;f.catalog&&eK(t),L.current=t,eU(n=>ta.has(t)?xS(n,t,O,e5,e):n.includes(t)?n:[...n,t])},[f,ta,O,e5,e]),(0,Y.useEffect)(()=>{if(!h||!(null!==jv(h.path,e)||ta.has(h.path))||!F.current.consume(h))return;let{path:t}=h;eU(n=>ta.has(t)?xS(n,t,O,e5,e):n.includes(t)?n:[...n,t])},[h,ta,O,e5,e]),(0,Y.useEffect)(()=>{let t=jv(L.current,e);t&&(L.current=null,tK(t))}),(0,Y.useEffect)(()=>{let e=sessionStorage.getItem("llvTaskFocus");e&&t$.some(t=>t.id===e)&&(sessionStorage.removeItem("llvTaskFocus"),tY(e))});let tW=e=>{if(e.project!==d){sessionStorage.setItem("llvTaskFocus",e.id),jw(e.project);return}tY(e.id)};(0,Y.useEffect)(()=>{let e=e=>{let t=e.detail,n=t?.id?.trim();if(!n)return;if("task"===t.kind){let e=a.find(e=>e.id===n);e&&tW(e);return}if("pipeline"!==t.kind)return;let r=O.find(e=>e.id===n);if(r){if(r.project!==d){sessionStorage.setItem("llvPipelineFocus",n),jw(r.project);return}A?.(),eE(n)}};return window.addEventListener("llv:mcp-navigate",e),()=>window.removeEventListener("llv:mcp-navigate",e)}),(0,Y.useEffect)(()=>{let e=sessionStorage.getItem("llvPipelineFocus");e&&O.some(t=>t.id===e&&t.project===d)&&(sessionStorage.removeItem("llvPipelineFocus"),eE(e))},[O,d]);let tV=e=>{q.setTaskPanelOpen(!1),ew(e)},tJ=e=>{ea(e),sessionStorage.setItem(jb(d),JSON.stringify(e))},tG=e=>{eK(null),q.setViewMode(e)},tQ=()=>"function"==typeof crypto.randomUUID?crypto.randomUUID():Date.now().toString(36)+Math.random().toString(36).slice(2,10),tX=()=>{if(!u)return;A?.();let e=tQ();bj(e,eZ),tJ([...ei,e]),L.current="draft::"+e},tZ=async(e,t)=>(A?.(),xG(d,t,e??void 0)),t0=t=>{var n,r;A?.();let i=ei.find(e=>t.conversationId&&bw(e,"parentConversationId")===t.conversationId||bk(e)===t.path);if(i)return void tK("draft::"+i);let a=tQ();n=t.path,r=t.conversationId,by(a,"src",n),by(a,"parentConversationId",r??""),bj(a,eP(e,d,l,t.path,eJ,eZ)),tJ([...ei,a]),L.current="draft::"+a},t1=e=>{if(nL(e))vT(e);else for(let t of["engine","model","cwd","cwdSeed","text","boot","src","parentConversationId","effort","speed","accountId","role","roleParams","reviews","confirm"])sessionStorage.removeItem(bh(e,t));tJ(ei.filter(t=>t!==e))},t2=e=>{if(A?.(),va(e))return void vs(e,x4).then(e=>{e&&oC("err",e)});let t=tQ();e.goal?.objective&&by(t,"text",e.goal.objective),bj(t,e.cwd?.trim()||eZ),tJ([...ei,t]),L.current="draft::"+t},t5=(e,t)=>{t1(e),nn(t)},t4=e=>{fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"kill",path:e})}).catch(()=>{}),q.mutate([bI(e,ez).mutation]),eU(t=>bI(e,t).ephemeral),M?.(e)},t3=t=>{t===eB&&eK(null);let n=t8.get(t)?.title??e.find(e=>e.path===t)?.title??"";H.record({kind:"close",path:t,title:n}),t4(t)},t6=(0,Y.useRef)(B);(0,Y.useEffect)(()=>{t6.current=B});let t8=(0,Y.useMemo)(()=>new Map(ti.filter(e=>eM(e)===d).map(e=>[e.path,e])),[ti,d]),t7=(0,Y.useMemo)(()=>e.filter(e=>eM(e)===d&&"claude-tasks"!==e.root).length,[e,d]),t9=b&&t7>=v,ne=(0,Y.useMemo)(()=>tS.map(e=>({key:e.key,orphanTask:e.orphanTask})),[tS]);(0,Y.useEffect)(()=>{if(q.loaded&&"unavailable"!==q.sync&&(!f||jv(f.path,e))){var t,n;let r,i,a,s;q.mutate((t={files:e,groups:ne,manual:t6.current.manual,catalog:t8,catalogComplete:t9,project:d},r=[],(i=function(e,t){let n=[],r=new Set;for(let i of e){let e=i.predecessorPath;e&&eM(i)===t&&e!==i.path&&!r.has(e)&&(r.add(e),n.push({from:e,to:i.path}))}return n.length?{kind:"remap-paths",pairs:n}:null}(t.files,t.project))&&r.push(i),r.push((s=new Set(a=(n={groups:t.groups,manual:t.manual,catalog:t.catalog,catalogComplete:t.catalogComplete}).groups.filter(e=>!e.orphanTask).map(e=>e.key)),{kind:"reconcile-roots",roots:a,removeManual:n.manual.filter(e=>{if(s.has(e))return!1;let t=n.catalog.get(e);return t?eA(t):!1!==n.catalogComplete&&e.endsWith(".jsonl")})})),r))}},[ne,e,t8,t9,d,q.loaded,q.sync,f]);let nt=(0,Y.useRef)(new Set);(0,Y.useEffect)(()=>{if(!q.loaded||"unavailable"===q.sync)return;let t=(function(e){let t=new Set(e.hidden),n=new Set([...e.explicitManual,...e.expanded,...e.manual]),r=new Map;for(let t of e.flows)for(let e of t.rounds)e.reviewerPath&&!r.has(e.reviewerPath)&&r.set(e.reviewerPath,t);let i=[];for(let a of e.files){if(eM(a)!==e.project||!n.has(a.path)||t.has(a.path))continue;let s=r.get(a.path)??null;(a.durableLineage?.role==="reviewer"&&a.durableLineage.reviewsConversationId||s)&&(a.review?.verdict||null!==s&&function(e,t){for(let n of e.rounds)if(n.reviewerPath===t&&(null!==n.verdict||null!=n.terminalAt&&null===n.error))return!0;return!1}(s,a.path))&&!a.userAuthored&&!a.authorshipUnverified&&("live"===a.activity||"stalled"===a.activity||"running"===a.proc||a.pendingQuestion||a.waitingInput||i.push({kind:"close",path:a.path}))}return i})({files:e,flows:e5,project:d,explicitManual:q.explicitManual,manual:t6.current.manual,expanded:t6.current.expanded,hidden:t6.current.hidden}).filter(e=>!nt.current.has(e.path));if(t.length){for(let e of t)nt.current.add(e.path);q.mutate(t)}},[e,e5,d,q.loaded,q.sync,q.explicitManual,q.revision]);let nn=t=>{A?.();let n=eM(t);if(n!==d){r5(n,t.path,eA(t)),location.hash=Q(t);return}if(ec(t,d),ta.has(t.path)){L.current=t.path,eU(n=>xS(n,t.path,O,e5,e));return}tT.has(t.path)&&!tP.has(t.path)||tz.some(e=>e.path===t.path)?tK(t.path):(eA(t)?q.restore(t.path,"expanded"):tT.has(t.path)?q.restore(t.path,"auto"):q.restore(t.path,"manual"),L.current=t.path)},nr=t=>{A?.();let n=e.find(e=>e.path===t);if(n){if(eM(n)!==d)return void nn(n);ec(n,d),L.current=t,eU(e=>e.includes(t)?e:[...e,t])}},ni=(0,Y.useMemo)(()=>({trays:tN.traysByParent,foldedChildPaths:tN.foldedPaths,onToggleExpanded:(e,t)=>q.setEngineTrayExpanded(e,t),onOpenMember:nr,onUnfold:(e,t)=>q.setEngineChildFold(e,t,!1),onFoldChild:(e,t)=>q.setEngineChildFold(e,t,!0)}),[tN,q]),na=I??nn,ns=t=>{b$(window.localStorage,t.id,"expanded",bP(t));let n=e.find(e=>e.path===t.implementerPath);n?nn(n):q.restore(t.implementerPath,"manual")},nl=()=>{let t=H.undo();if(null===t||"close"!==t.kind)return;let n=t8.get(t.path)??e.find(e=>e.path===t.path);n?nn(n):q.restore(t.path,"manual")},no=()=>{let e=H.redo();null!==e&&"close"===e.kind&&t4(e.path)},nc=(0,Y.useRef)({onUndo:nl,onRedo:no});nc.current={onUndo:nl,onRedo:no},(0,Y.useEffect)(()=>{if(null===d)return;let e=e=>{if(!(e.ctrlKey||e.metaKey)||e.altKey||"z"!==e.key.toLowerCase())return;let t=e.target,n=t?.tagName;"INPUT"===n||"TEXTAREA"===n||t?.isContentEditable||(e.preventDefault(),e.shiftKey?nc.current.onRedo():nc.current.onUndo())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[d]);let nd=[];tU?nd.push(`${P("dash.branchesLive",{count:tU})} \xb7 ${P("dash.trees",{count:tB})}`):tB&&nd.push(P("dash.recentConvos",{count:tB})),tA.length&&nd.push(P("dash.quietTrees",{count:tA.length}));let nu=tS.map(e=>({...e,columns:e.columns.filter(e=>!tP.has(e.file.path))})).filter(e=>e.columns.length),np=nu.filter(e=>e.orphanTask).map(e=>e.columns[0].file),nm=nu.filter(e=>!e.orphanTask),nf=(0,Y.useMemo)(()=>{let t;return t=new Set(e.filter(e=>e.project===d).map(e=>e.path)),O.filter(e=>("closed"!==e.state||!!e.restored)&&(e.project===d||e.runs.some(e=>e.attempts.some(e=>!!(e.agentPath&&t.has(e.agentPath))))))},[O,d,e]),nh=ei.filter(e=>!es.has(e)),nx=nm.length>0||tH.length>0||nh.length>0||t$.length>0||nf.length>0,ng=(0,Y.useMemo)(()=>e.filter(e=>eM(e)===d).sort((e,t)=>t.mtime-e.mtime),[e,d]),nb=(0,Y.useMemo)(()=>{let t,n;return(n=(t=e.filter(e=>eM(e)===d).sort((e,t)=>t.mtime-e.mtime||e.path.localeCompare(t.path))).filter(eS)).length?n:t},[e,d]),nv=(0,Y.useMemo)(()=>nx?[]:function(e,t,n=100){let r=new Map(e.map(e=>[e.path,e])),i=eR(e),a=new Set(e.filter(e=>eM(e)===t).sort((e,t)=>t.mtime-e.mtime||e.path.localeCompare(t.path)).slice(0,n).map(e=>e.path)),s=new Set;for(let e of a){let n=r.get(e)??null,i=new Set;for(;n&&eM(n)===t&&!i.has(n.path);)i.add(n.path),s.add(n.path),n=n.parent?r.get(n.parent)??null:null}let l=new Map,o=new Map;for(let e of s){let n=r.get(e);if(!n)continue;let i=function(e,t){let n=new Set,r=e;for(;r.parent&&!n.has(r.path);){n.add(r.path);let i=t.get(r.parent);if(!i||eM(i)!==eM(e))break;r=i}return r}(n,r);eM(i)===t&&(eI(i)?o.set(i.path,i):l.set(i.path,i))}let c=[];for(let e of l.values()){let n=eD(e,i).filter(e=>s.has(e.path)&&eM(e)===t).sort((e,t)=>eN(e)-eN(t)||t.mtime-e.mtime||e.path.localeCompare(t.path)),r=n.filter(e=>!eI(e)&&eA(e)),a=new Set([e.path,...r.map(e=>e.path)]),l=[e,...r].map(e=>({file:e,tasks:[]})),o=n.filter(e=>!a.has(e.path)),d=Math.max(e.mtime,...n.map(e=>e.mtime));c.push({key:e.path,columns:l,returnable:[],finished:o,smt:d,orphanTask:!1})}for(let e of o.values())c.push({key:e.path,columns:[{file:e,tasks:[]}],returnable:[],finished:[],smt:e.mtime,orphanTask:!0});return c.sort((e,t)=>ey(t.smt)-ey(e.smt)||e.key.localeCompare(t.key))}(xy(ti.filter(e=>!tP.has(e.path)&&!tl.has(e.path)&&!ty.has(e.path)),ta),d,100),[nx,ti,tP,tl,ty,ta,d]),nw=nv.length>0,ny=nx||nw,nk=(0,Y.useMemo)(()=>new Set(ez.filter(e=>ta.has(e))),[ez,ta]),nj=vt(nx?nm:nv,nx?tH:[],e,tr,nx?nh:[],O,[],new Set,nk,[],new Set,{now:eV}),nN=new Set;for(let e of nj.decks)for(let t of e.rounds)t.file&&nN.add(t.file.path);let nS=nj.nodes.map(e=>e.file.path).join("\n"),nC=function(e,t,n=new Set,r={}){let i=new Map,a=eX(e);for(let s of e){if(n.has(s.path))continue;let{key:e,kind:l,id:o}=function(e,t,n={},r=eG){let i=n.pipelineIdOf?.(e.path)??null;if(i)return{key:"wstack::pipeline::"+i,kind:"pipeline",id:i};let a=function(e,t,n=eG){return tm(e,t,n)?.flow.id??null}(e,t,r);if(a)return{key:"wstack::flow::"+a,kind:"flow",id:a};let s=n.originOf?.(e)??null;if(s)return{key:"wstack::origin::"+s,kind:"origin",id:s};let l=e.worktree??"";return{key:"wstack::worktree::"+l,kind:"worktree",id:l}}(s,t,r,a),c=i.get(e)??{key:e,kind:l,id:o,items:[]};c.items.push(s),i.set(e,c)}let s=[...i.values()];for(let e of s)e.items.sort((e,t)=>tg(e)-tg(t));return s.sort((e,t)=>e.kind!==t.kind?th[e.kind]-th[t.kind]:tg(e.items[0])-tg(t.items[0]))}(ts,e5,new Set([...nN,...tP,...ty,...ta]),{pipelineIdOf:td,originOf:tu}),nA=b||nb.length>0,nI=null!==eB&&ny?"scheme":function({preferredView:e,hasNodes:t,hasArchiveNodes:n,hasHistoryRows:r}){return"list"===e&&r?"list":"scheme"===e&&(t||n)||t?"scheme":r?"list":"scheme"}({preferredView:q.prefs.viewMode,hasNodes:nx,hasArchiveNodes:nw,hasHistoryRows:nA}),nM=ny&&nA;(0,Y.useEffect)(()=>{let e="unavailable"===q.sync?null:q.revision;ip.reportContext({project:d,board:{renderedRevision:e,durableRevision:e,sync:q.sync}})},[d,q.revision,q.sync]),(0,Y.useEffect)(()=>{u&&ip.reportCards(e.map(e=>({path:e.path,...e.conversationId?{conversationId:e.conversationId}:{},...e.project?{project:e.project}:{},...e.title?{label:e.title}:{}})))},[e,u]),(0,Y.useEffect)(()=>{u&&0!==e.length&&q.pruneSelectionTo(new Set(e.map(e=>e.path)))},[e,u]),(0,Y.useEffect)(()=>{if("scheme"===nI&&ny)return;let e=nA?nb.map(e=>e.path):[],t=e.length>0?e:nS?nS.split("\n"):[],n=t.slice(0,128),r=nA?"list":$?"mobile-focus":"list";ip.reportSlice({mode:r,focusedPath:null,selectedPaths:ic(t,q.selection,{includeUnordered:!0}),visiblePaths:n,camera:null})},[nI,ny,nA,nb,$,nS,q.selection]);let nT=nC.reduce((e,t)=>e+t.items.length,0)+tw.length+t$.length+(nw?0:tM.length),nP=$&&"scheme"===nI&&eo&&w5(eo)?eo:null,n$=$&&z&&(nT>0||!!nP);return(0,U.jsx)(hV,{value:X,children:(0,U.jsxs)("div",{className:"relative flex min-h-0 min-w-0 flex-1 flex-col",children:[(0,U.jsxs)("div",{"data-testid":$?"mobile-project-header":void 0,className:$?"flex min-h-[52px] min-w-0 shrink-0 items-center gap-1 border-b border-border bg-card px-2 py-1.5":"flex h-10 shrink-0 items-center gap-2.5 border-b border-border bg-card px-4",children:[k?(0,U.jsx)("button",{type:"button",className:`flex shrink-0 items-center justify-center rounded-[8px] border border-border bg-canvas text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${$?"h-11 w-11":"-ml-1.5 h-7 w-7"}`,"aria-label":P("dash.openProjects"),onClick:k,children:(0,U.jsx)(hw.A,{className:$?"h-5 w-5":"h-4 w-4","aria-hidden":!0})}):null,(0,U.jsx)("h1",{className:`truncate text-[13.5px] font-bold ${$?"min-w-0 max-w-[45vw]":""}`,title:E,children:E}),$?null:(0,U.jsx)(hZ,{canUndo:H.canUndo,canRedo:H.canRedo,undoEntry:H.undoEntry,redoEntry:H.redoEntry,onUndo:nl,onRedo:no}),$?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("span",{"aria-hidden":!0,className:"min-w-0 flex-1"}),j?(0,U.jsx)("button",{type:"button","data-testid":"dash-search","aria-label":P("search.openMobile"),onClick:j,className:"inline-flex h-11 w-11 shrink-0 items-center justify-center rounded-[8px] border border-border bg-canvas text-muted hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:(0,U.jsx)(hL.A,{className:"h-5 w-5","aria-hidden":!0})}):null,N?(0,U.jsx)("span",{className:"flex shrink-0 items-center",children:N}):null,n$?(0,U.jsxs)("button",{type:"button","data-testid":"mobile-shelf-trigger","aria-haspopup":"dialog","aria-expanded":eu,"aria-label":P("dash.hiddenShelf"),onClick:()=>ep(!0),className:"relative inline-flex h-11 w-11 shrink-0 items-center justify-center rounded-[8px] border border-border bg-canvas text-muted hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:[(0,U.jsx)(h_.A,{className:"h-4 w-4","aria-hidden":!0}),nT>0?(0,U.jsx)("span",{className:"absolute -right-0.5 -top-0.5 rounded-full bg-accent/10 px-1 text-[10px] font-bold tabular-nums text-accent",children:nT}):null]}):null,(0,U.jsx)(jk,{triggerLabel:P("dash.createMenu"),icon:(0,U.jsx)(af.A,{className:"h-5 w-5","aria-hidden":!0}),children:e=>(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(jj,{icon:(0,U.jsx)(hF.A,{className:"h-4 w-4","aria-hidden":!0}),label:P("dash.agent"),disabled:!u,onSelect:()=>{e(),tX()}}),(0,U.jsx)(jj,{icon:(0,U.jsx)(fr.A,{className:"h-4 w-4","aria-hidden":!0}),label:P("dash.task"),onSelect:()=>{e(),A?.(),eg(e=>e+1)}}),(0,U.jsx)(jj,{icon:(0,U.jsx)("span",{className:"text-[15px] font-bold leading-none",children:"≡"}),label:P("dash.pipeline"),onSelect:()=>{e(),eT(!0)}})]})}),(0,U.jsx)(jk,{triggerLabel:P("dash.moreMenu"),icon:(0,U.jsx)(d9.A,{className:"h-5 w-5","aria-hidden":!0}),children:e=>(0,U.jsxs)(U.Fragment,{children:[nM?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)("div",{role:"group","aria-label":P("dash.viewMenuGroup"),className:"flex flex-col gap-0.5",children:[(0,U.jsx)(jj,{icon:(0,U.jsx)(hO.A,{className:"h-4 w-4","aria-hidden":!0}),label:P("dash.viewSchemeMenu"),checked:"scheme"===nI,onSelect:()=>{e(),tG("scheme")}}),(0,U.jsx)(jj,{icon:(0,U.jsx)(hD.A,{className:"h-4 w-4","aria-hidden":!0}),label:P("dash.viewListMenu"),checked:"list"===nI,onSelect:()=>{e(),tG("list")}})]}),(0,U.jsx)("span",{"aria-hidden":!0,className:"my-0.5 h-px shrink-0 bg-border"})]}):null,H.canUndo||H.canRedo?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)("div",{role:"group","aria-label":P("board.historyGroup"),className:"flex flex-col gap-0.5",children:[H.canUndo?(0,U.jsx)(jj,{icon:(0,U.jsx)(hq.A,{className:"h-4 w-4","aria-hidden":!0}),label:P("board.undo"),onSelect:()=>{e(),nl()}}):null,H.canRedo?(0,U.jsx)(jj,{icon:(0,U.jsx)(hz.A,{className:"h-4 w-4","aria-hidden":!0}),label:P("board.redo"),onSelect:()=>{e(),no()}}):null]}),(0,U.jsx)("span",{"aria-hidden":!0,className:"my-0.5 h-px shrink-0 bg-border"})]}):null,(0,U.jsxs)("div",{className:"flex min-h-11 items-center gap-2 px-1.5",children:[(0,U.jsx)("span",{className:"text-[13px] font-semibold text-primary",children:P("dash.soundMenu")}),(0,U.jsx)(jx,{})]}),(0,U.jsx)(d$,{}),(0,U.jsx)("div",{className:"flex min-h-11 items-center px-1.5",children:g?(0,U.jsxs)("button",{type:"button",className:"inline-flex min-h-11 shrink-0 items-center gap-1.5 rounded-full border border-border bg-canvas px-3 text-[13px] font-semibold text-muted hover:border-accent/40 hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>y(d),children:[(0,U.jsx)(sx.$T,{className:"h-4 w-4","aria-hidden":!0})," ",P("dash.unarchive")]}):(0,U.jsx)(bs,{files:ng,allowEmpty:b,onArchive:()=>w(d)})}),(0,U.jsx)("div",{className:"flex min-h-11 items-center px-1.5",children:(0,U.jsx)(bl,{project:d,files:ng,available:b})})]})})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("span",{className:`truncate text-[11.5px] ${p>0?"font-semibold text-danger":"text-muted"}`,children:p>0?P("catalog.unreachable"):nd.length?nd.join(" \xb7 "):P("common.nothingRunning")}),(0,U.jsx)(jx,{}),g?(0,U.jsxs)("button",{type:"button",className:"inline-flex shrink-0 items-center gap-1 rounded-full border border-border bg-canvas px-2 py-0.5 text-[11px] font-semibold text-muted hover:border-accent/40 hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>y(d),children:[(0,U.jsx)(sx.$T,{className:"h-3 w-3","aria-hidden":!0})," ",P("dash.unarchive")]}):(0,U.jsx)(bs,{files:ng,allowEmpty:b,onArchive:()=>w(d)}),(0,U.jsx)(bl,{project:d,files:ng,available:b}),(0,U.jsx)("span",{"aria-hidden":!0,className:"min-w-0 flex-1"}),j?(0,U.jsx)("button",{type:"button","data-testid":"dash-search","aria-label":P("search.open"),title:P("search.open"),onClick:j,className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-[8px] border border-border bg-canvas text-muted hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:(0,U.jsx)(hL.A,{className:"h-4 w-4","aria-hidden":!0})}):null,C?(0,U.jsx)(bA,{open:S,onToggle:C}):null,(0,U.jsxs)("button",{type:"button",onClick:e1,"aria-pressed":K,"aria-label":P("tasks.panelToggleAria"),className:`flex shrink-0 items-center gap-1 rounded-[8px] border px-2.5 py-1 text-[11.5px] font-bold shadow-1 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${K?"border-accent/45 bg-accent/10 text-accent":"border-border bg-card text-primary hover:border-accent/45 hover:text-accent"}`,children:[(0,U.jsx)(fr.A,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",P("tasks.panelTitle"),t$.filter(e=>"done"!==e.status).length?(0,U.jsx)("span",{className:"rounded-full bg-accent/10 px-1.5 text-[10px] font-bold text-accent",children:t$.filter(e=>"done"!==e.status).length}):null]}),(0,U.jsxs)("button",{type:"button",onClick:()=>eT(!0),"aria-label":P("dash.newPipeline"),className:"flex shrink-0 items-center gap-1 rounded-[8px] border border-border bg-card px-2.5 py-1 text-[11.5px] font-bold text-primary shadow-1 hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:[(0,U.jsx)("span",{className:"text-[13px] leading-none text-accent",children:"+"})," ",P("dash.pipeline")]})]})]}),eC?(0,U.jsx)(bE,{repoDir:eQ,onClose:()=>eT(!1),onCreate:tZ,onCreated:e=>{eT(!1),eE(e.id)}}):null,r?(0,U.jsx)("div",{className:"shrink-0 border-b border-border bg-warning-soft px-3 py-1.5 text-[11.5px] text-warning",role:"alert",children:P("dash.pipelinesUnavailable")}):null,z&&np.length?(0,U.jsx)("div",{className:"shrink-0 border-b border-border bg-sunken",children:np.map(e=>(0,U.jsx)("div",{className:`border-l-4 ${"live"===e.activity?"border-l-success bg-success-soft":"border-l-muted"}`,children:(0,U.jsx)(g8,{file:e})},e.path))}):null,$?(0,U.jsx)(U.Fragment,{children:z?"scheme"===nI&&ny?(0,U.jsx)(wX,{project:d,projectName:E,groups:nx?nm:nv,manual:nx?tH:[],files:e,flows:R,reviewGroups:e2,pipelines:O,surfacePipelines:nf,workerStacks:nC,tasks:nx?tq:[],sheetTasks:t$,drafts:nx?nh:[],favorites:G,isolatedManualPaths:nk,loaded:u,focus:eL,onSelect:nn,onClose:t3,onDraftClose:t1,onDraftSpawned:t5,onActiveChange:ed,taskSheetNonce:ex,trayApi:ni}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)("div",{className:"flex shrink-0 items-stretch border-b border-border bg-card","data-testid":"mobile-orchestrator-slot",children:[(0,U.jsx)(wd,{project:d,projectName:E,files:e,onOpenConversation:na}),(0,U.jsx)("span",{"aria-hidden":!0,className:"min-w-0 flex-1"})]}),nA?(0,U.jsx)(bo,{project:d,enabled:u&&"list"===nI,onOpen:na}):(0,U.jsx)("div",{className:"flex flex-1 items-center justify-center px-4 py-5 text-center",children:(0,U.jsxs)("div",{children:[(0,U.jsx)("div",{className:"text-[13.5px] font-semibold text-muted",children:P("dash.emptyTitle")}),(0,U.jsx)("div",{className:"mt-0.5 text-[12px] text-muted",children:P("dash.emptyHint")})]})})]}):p>0?(0,U.jsx)(hj,{failures:p,className:"mt-[12vh]"}):(0,U.jsx)(kZ,{})}):(0,U.jsxs)("div",{className:"flex min-h-0 min-w-0 flex-1",children:[(0,U.jsxs)("div",{className:"relative flex min-h-0 min-w-0 flex-1 flex-col",children:[z&&nM?(0,U.jsx)(jy,{value:nI,onChange:tG,floating:!0}):null,z?"scheme"===nI&&ny?(0,U.jsx)(kX,{project:d,groups:nx?nm:nv,manual:nx?tH:[],files:e,flows:R,reviewGroups:e2,pipelines:O,surfacePipelines:nf,now:eV,tasks:nx?tq:[],allTasks:t$,workerStacks:nC,drafts:nx?nh:[],favorites:G,isolatedManualPaths:nk,focus:eL,attentionPaths:x,trayApi:ni,onSelect:nn,onClose:t3,onDraftClose:t1,onDraftSpawned:t5,onHandoff:t0,onSpawnRetry:t2,onTaskDraft:e=>{A?.();let t=tQ();by(t,"text",e.text),bj(t,eZ),tJ([...ei,t]),L.current="draft::"+t},onOpenTask:tW,placeTaskId:ev?.id??null,onTaskPlaced:()=>ew(null),newTaskNonce:em,onTaskCollapse:e=>tO(e.id,!1),builderPipelineId:e$,onBuilderOpened:()=>eE(null)}):nA?(0,U.jsx)(bo,{project:d,enabled:u&&"list"===nI,onOpen:na}):(0,U.jsx)("div",{className:"flex flex-1 items-center justify-center px-4 py-5 text-center",children:(0,U.jsxs)("div",{children:[(0,U.jsx)("div",{className:"text-[13.5px] font-semibold text-muted",children:P("dash.emptyTitle")}),(0,U.jsx)("div",{className:"mt-0.5 text-[12px] text-muted",children:P("dash.emptyHint")})]})}):p>0?(0,U.jsx)(hj,{failures:p,className:"mt-[12vh]"}):(0,U.jsx)(kZ,{}),(0,U.jsxs)("div",{"data-chip-keepout":!0,className:"pointer-events-none absolute bottom-4 left-4 z-30 flex items-center gap-2",children:[(0,U.jsxs)("button",{type:"button",onClick:tX,disabled:!u,"aria-label":P("dash.newConvo"),className:"pointer-events-auto flex shrink-0 items-center gap-1 rounded-[8px] border border-border bg-card px-3 py-1.5 text-[11.5px] font-bold text-primary shadow-1 hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:cursor-not-allowed disabled:opacity-45",children:[(0,U.jsx)("span",{className:"text-[13px] leading-none text-accent",children:"+"})," ",P("dash.agent")]}),(0,U.jsxs)("button",{type:"button",onClick:()=>{A?.(),ef(e=>e+1)},"aria-label":P("dash.newTask"),className:"pointer-events-auto flex shrink-0 items-center gap-1 rounded-[8px] border border-border bg-card px-3 py-1.5 text-[11.5px] font-bold text-primary shadow-1 hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:[(0,U.jsx)("span",{className:"text-[13px] leading-none text-accent",children:"+"})," ",P("dash.task")]}),(0,U.jsxs)("button",{type:"button",onClick:()=>eT(!0),disabled:!u,"aria-label":P("pipelineBuilder.createDraftAria"),className:"pointer-events-auto flex shrink-0 items-center gap-1 rounded-[8px] border border-border bg-card px-3 py-1.5 text-[11.5px] font-bold text-primary shadow-1 hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-50",children:[(0,U.jsx)("span",{className:"text-[13px] leading-none text-accent",children:"+"})," ",P("board.pipeline")]})]})]}),K?(0,U.jsx)(vK,{tasks:a,project:d,favorites:er,onOpenFavorite:nn,onToggleFavorite:e=>q.setFavorite(e,!1),onOpenTask:tW,onPlaceOnMap:tV,onClose:e1}):null]}),!$&&z?(0,U.jsx)(jh,{files:e,flows:e5,project:d,loaded:u,catalogFailures:p,onOpenFile:nn,onOpenCatalogFile:na}):null,z&&(()=>{let t=nC.reduce((e,t)=>e+t.items.length,0)+tw.length+t$.length,n=nw?0:tM.length,r=e=>$?(...t)=>{ep(!1),e(...t)}:e,i=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(vk,{tasks:t$,files:e,pipelines:O,flows:e5,conversationAliases:s,repository:l.find(e=>e.project===d)?.repository??null,onOpenTask:r(tW),onPlaceOnMap:$?void 0:tV,onOpenFile:r(nn)}),(0,U.jsx)(vo,{items:tw,onRetry:r(t2)}),(0,U.jsx)(vN,{stacks:nC,files:e,flows:e5,pipelines:O,onSelect:r(nn),onExpandGroup:r(ns)}),!nw&&tM.length?(0,U.jsx)(jg,{items:tM,activeRootPaths:tI,onSelect:r(nn)}):null]});if(!$)return i;let a=nP?(0,U.jsx)(w4,{file:nP,onHandoff:()=>{ep(!1),t0(nP)},inline:!0}):null;return(0,U.jsx)(vS,{open:eu,onClose:()=>ep(!1),total:t+n,leading:a,children:i})})(),(0,U.jsx)(oI,{})]})})});var jS=n(908);function jC(){let{t:e}=(0,eh.Ym)(),t=ia(),[r,i]=(0,Y.useState)(!1),[a,s]=(0,Y.useState)({status:"idle"}),[l,o]=(0,Y.useState)(null),[c,d]=(0,Y.useState)(!1),u=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{if(!r||"idle"!==a.status)return;let e=!1;return fetch("/api/access").then(e=>e.json()).then(t=>{e||s(t.tailnetUrl?{status:"ready",url:t.tailnetUrl}:{status:"unavailable"})}).catch(()=>{e||s({status:"error"})}),()=>{e=!0}},[r,a.status]),(0,Y.useEffect)(()=>{if("ready"!==a.status)return;let e=!1,t=a.url;return n.e(768).then(n.t.bind(n,768,19)).then(({toDataURL:e})=>e(t,{margin:1,width:220})).then(n=>{e||o({url:t,dataUrl:n})}).catch(()=>{}),()=>{e=!0}},[a]);let p="ready"===a.status&&l&&l.url===a.url?l.dataUrl:null;(0,Y.useEffect)(()=>{if(!r)return;let e=e=>{"Escape"===e.key&&i(!1)},t=e=>{u.current&&!u.current.contains(e.target)&&i(!1)};return window.addEventListener("keydown",e),window.addEventListener("pointerdown",t),()=>{window.removeEventListener("keydown",e),window.removeEventListener("pointerdown",t)}},[r]);let m=(0,Y.useCallback)(()=>{"ready"===a.status&&navigator.clipboard.writeText(a.url).then(()=>{d(!0),window.setTimeout(()=>d(!1),2e3)}).catch(()=>{})},[a]);return(0,U.jsxs)("div",{ref:u,className:"relative ml-auto shrink-0",children:[(0,U.jsx)("button",{type:"button","aria-expanded":r,"aria-label":e("qr.showAria"),onClick:()=>{r||s({status:"idle"}),i(!r)},className:`flex items-center justify-center rounded-[8px] border border-border bg-card text-muted hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${t?"h-11 w-11":"p-1.5"}`,children:(0,U.jsx)(jS.A,{className:"h-4 w-4","aria-hidden":!0})}),r?(0,U.jsx)("div",{className:"fixed left-1/2 top-12 z-50 flex w-[260px] -translate-x-1/2 flex-col gap-2.5 rounded-[12px] border border-border bg-card p-3 shadow-2 sm:absolute sm:left-0 sm:right-auto sm:top-full sm:mt-1.5 sm:translate-x-0",children:"idle"===a.status?(0,U.jsx)("span",{className:"text-[12px] text-primary",children:e("common.loading")}):"error"===a.status?(0,U.jsx)("span",{className:"text-[12px] font-semibold text-danger",children:e("qr.failed")}):"unavailable"===a.status?(0,U.jsxs)("span",{className:"text-[12px] leading-relaxed text-primary",children:[e("qr.startHint"),(0,U.jsx)("code",{className:"break-all rounded bg-sunken px-1 py-0.5 font-mono text-[11px]",children:"bunx agent-log-viewer --tailscale"})]}):(0,U.jsxs)(U.Fragment,{children:[p?(0,U.jsx)("img",{src:p,alt:e("qr.alt"),className:"mx-auto h-[220px] w-[220px]"}):(0,U.jsx)("span",{className:"text-[12px] text-primary",children:e("qr.generating")}),(0,U.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,U.jsx)("input",{readOnly:!0,value:a.url,"aria-label":e("qr.linkAria"),onFocus:e=>e.currentTarget.select(),className:"min-h-[44px] min-w-0 flex-1 truncate rounded-[8px] border border-border bg-canvas px-2 py-1.5 font-mono text-[10.5px] text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:min-h-0"}),(0,U.jsx)("button",{type:"button","aria-label":e("qr.copy"),onClick:m,className:"flex min-h-[44px] min-w-[44px] shrink-0 items-center justify-center gap-1 rounded-[8px] border border-border bg-card px-2 py-1.5 text-[11px] font-semibold text-muted hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:min-h-0 sm:min-w-0",children:c?(0,U.jsx)(fv.A,{className:"h-3.5 w-3.5","aria-hidden":!0}):(0,U.jsx)(wm.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),(0,U.jsx)("span",{className:"text-[10.5px] text-muted",children:e("qr.scanHint")})]})}):null]})}function jA(){let{locale:e,t,setLocale:n}=(0,eh.Ym)(),r=ia(),i="en"===e?"uk":"en";return(0,U.jsx)("button",{className:`inline-flex shrink-0 items-center justify-center rounded-full border border-border bg-card px-2 text-[10.5px] font-bold text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${r?"min-h-11 min-w-11":"h-[26px]"}`,title:t("lang.aria"),"aria-label":t("lang.aria"),onClick:()=>n(i),children:e.toUpperCase()})}function jI(e){return Math.max(0,Math.min(100,e))}function jM(e,t,n){return t<=e?0:jI((t-n)/(t-e)*100)}let jT=312,jP=138;function j$(){return"uk"===(0,eh.JK)()?"uk-UA":"en-US"}function jE({series:e,tint:t,now:n}){var r;let{windowStart:i,resetsAt:a,windowSeconds:s,samples:l}=e,o=i??l[0]?.t??n-s,c=a??Math.max(n,l[l.length-1]?.t??n),d=c>o?c-o:1,u=e=>4+(Math.max(o,Math.min(c,e))-o)/d*jT,p=e=>8+(100-Math.max(0,Math.min(100,e)))/100*jP,m=null!==i&&null!==a?`M ${u(i).toFixed(2)},${p(jM(i,a,o)).toFixed(2)} L ${u(a).toFixed(2)},${p(jM(i,a,c)).toFixed(2)}`:null,f=l.length?l.map((e,t)=>`${0===t?"M":"L"} ${u(e.t).toFixed(2)},${p(e.remaining).toFixed(2)}`).join(" "):null,h=l[l.length-1]??null,x=h?(r=h.remaining,r<=10?"var(--color-danger)":r<=30?"var(--color-warning)":t):t,g=u(n);return(0,U.jsxs)("svg",{viewBox:"0 0 320 150",preserveAspectRatio:"none",className:"h-[150px] w-full",role:"img",children:[(0,U.jsx)("rect",{x:4,y:8,width:jT,height:jP,className:"fill-none stroke-border",strokeWidth:1,vectorEffect:"non-scaling-stroke"}),(0,U.jsx)("line",{x1:4,y1:p(50),x2:4+jT,y2:p(50),className:"stroke-border",strokeWidth:1,strokeDasharray:"2 3",vectorEffect:"non-scaling-stroke",opacity:.6}),m?(0,U.jsx)("path",{d:m,className:"fill-none stroke-muted",strokeWidth:1.5,strokeDasharray:"4 3",vectorEffect:"non-scaling-stroke",opacity:.7}):null,f?(0,U.jsx)("path",{d:f,fill:"none",stroke:x,strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",vectorEffect:"non-scaling-stroke"}):null,h?(0,U.jsx)("circle",{cx:u(h.t),cy:p(h.remaining),r:2.5,fill:x,vectorEffect:"non-scaling-stroke"}):null,n>o&&n<c?(0,U.jsx)("line",{x1:g,y1:8,x2:g,y2:8+jP,className:"stroke-accent",strokeWidth:1,strokeDasharray:"1 2",vectorEffect:"non-scaling-stroke",opacity:.7}):null]})}function jR({engine:e,label:t,plan:n,activeAccountId:r,onClose:i}){var a;let s,l,{t:o,locale:c}=(0,eh.Ym)(),[d,u]=(0,Y.useState)(null),[p,m]=(0,Y.useState)(!1),[f,h]=(0,Y.useState)("weekly"),[x]=(0,Y.useState)(()=>Math.round(Date.now()/1e3)),g=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{g.current?.focus()},[]),(0,Y.useEffect)(()=>{let e=!0;return fetch("/api/limits/history").then(e=>e.ok?e.json():Promise.reject(Error(String(e.status)))).then(t=>{e&&u(t)}).catch(()=>{e&&m(!0)}),()=>{e=!1}},[]);let b=d&&r&&("claude"===e?d.claudeAccountId:d.codexAccountId)===r?"claude"===e?d.claude:d.codex:null,v=e=>eV(o,e,b?b[e].windowSeconds/60:null),w=!!(d&&!b),y=b?b[f]:null,k=(0,tw.t7)(e).color,j=!!(y&&y.samples.length>0),N=y?function(e,t){let{windowStart:n,resetsAt:r,samples:i}=e;if(null===n||null===r||0===i.length)return null;let a=jI(i[i.length-1].remaining),s=Math.min(Math.max(t,n),r),l=jM(n,r,s);return{ideal:l,actual:a,delta:a-l,zeroCrossing:function(e,t){if(e.length<2)return null;for(let t=1;t<e.length;t++)if(e[t].remaining>e[t-1].remaining+.5)return null;let n=e[0],r=e[e.length-1],i=r.t-n.t,a=n.remaining-r.remaining;return i<=0||a<=0?null:r.t+t/(a/i)}(i,a)}}(y,x):null,S=N?N.delta<-2?o("burndown.fast",{pct:Math.round(-N.delta)}):N.delta>2?o("burndown.slow",{pct:Math.round(N.delta)}):o("burndown.even"):null,C=N?.zeroCrossing?o("burndown.emptyBy",{at:(a=N.zeroCrossing,l=(s=new Date(1e3*a)).toLocaleTimeString(j$(),{hour:"2-digit",minute:"2-digit",hour12:!1}),86400>Math.abs(a-x)?l:s.toLocaleDateString(j$(),{day:"numeric",month:"short"})+" "+l)}):null,A="claude"===e&&!j&&d?.historySince?o("burndown.buildsFrom",{date:new Date(d.historySince).toLocaleDateString("uk"===c?"uk-UA":"en-US",{day:"numeric",month:"short"})}):null;return(0,U.jsxs)("div",{role:"dialog","aria-modal":"true","aria-label":o("burndown.openAria",{engine:t}),tabIndex:-1,onKeyDown:e=>k5(e,i),className:"fixed bottom-3 left-1/2 z-50 flex w-[min(430px,calc(100vw-16px))] -translate-x-1/2 flex-col rounded-[12px] border border-border bg-card shadow-2 sm:absolute sm:bottom-1 sm:left-full sm:ml-2 sm:translate-x-0",children:[(0,U.jsxs)("header",{className:"flex items-center gap-2 border-b border-border px-3 py-2",children:[(0,U.jsx)("span",{className:"text-[12.5px] font-bold",style:{color:k},children:t}),(0,U.jsx)("span",{className:"text-[11px] text-muted",children:o("burndown.title")}),n?(0,U.jsx)("span",{className:"truncate text-[10px] text-muted",children:n}):null,(0,U.jsxs)("div",{className:"ml-auto flex items-center gap-1",children:[(0,U.jsx)("div",{className:"flex rounded-[8px] border border-border p-0.5",role:"tablist","aria-label":o("burndown.windowAria"),children:["weekly","session"].map(e=>(0,U.jsx)("button",{type:"button",role:"tab","aria-selected":f===e,onClick:()=>h(e),className:`rounded-[6px] px-2 py-0.5 text-[10.5px] font-semibold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${f===e?"bg-sunken text-primary":"text-muted hover:text-primary"}`,children:v(e)},e))}),(0,U.jsx)("button",{ref:g,type:"button","aria-label":o("burndown.close"),onClick:i,className:"rounded-[6px] p-1 text-muted hover:bg-canvas hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:(0,U.jsx)(sx.X,{className:"h-3.5 w-3.5","aria-hidden":!0})})]})]}),(0,U.jsx)("div",{className:"px-3 py-2.5",children:p?(0,U.jsx)("div",{className:"py-6 text-center text-[12px] text-muted",children:o("burndown.failed")}):!d||w?(0,U.jsx)("div",{className:"py-6 text-center text-[12px] text-muted",children:o("burndown.loading")}):j&&y?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(jE,{series:y,tint:k,now:x}),(0,U.jsxs)("div",{className:"mt-1.5 flex items-center justify-between text-[10px] text-muted",children:[(0,U.jsxs)("span",{className:"flex items-center gap-1",children:[(0,U.jsx)("span",{className:"inline-block h-0 w-3 border-t-2 border-dashed border-muted","aria-hidden":!0}),o("burndown.ideal")]}),(0,U.jsxs)("span",{className:"flex items-center gap-1",children:[(0,U.jsx)("span",{className:"inline-block h-0 w-3 border-t-2",style:{borderColor:k},"aria-hidden":!0}),o("burndown.actual")]})]}),S?(0,U.jsxs)("div",{className:"mt-2 text-[11.5px] font-semibold text-primary",children:[S,C?(0,U.jsxs)("span",{className:"ml-1 font-normal text-muted",children:["\xb7 ",C]}):null]}):null]}):y?.windowUnreported?(0,U.jsx)("div",{className:"py-6 text-center text-[12px] text-muted",children:o("burndown.windowUnreported",{window:v(f)})}):(0,U.jsxs)("div",{className:"py-6 text-center text-[12px] text-muted",children:[o("burndown.empty"),A?(0,U.jsx)("div",{className:"mt-1 text-[11px]",children:A}):null]})})]})}let jO=new Set(["starting","awaiting_scan","awaiting_password","verifying"]);async function jD(e){let t=await e.json().catch(()=>null);return e.ok&&t?.telegram?{payload:t.telegram}:{payload:null,code:"string"==typeof t?.code&&/^[a-z_]{1,40}$/.test(t.code)?t.code:"action_failed"}}async function jL(e){let t=await e.json().catch(()=>({}));return{ok:e.ok,json:t}}function j_(e){return"string"==typeof e.code&&/^[a-z_-]{1,40}$/.test(e.code)?e.code:"action_failed"}let jF="Europe/Kyiv";function jq(e="neutral"){return`inline-flex min-h-[44px] shrink-0 items-center justify-center rounded-[7px] border border-border px-2.5 py-0.5 text-[11px] font-semibold disabled:opacity-45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:min-h-[28px] ${"accent"===e?"bg-sunken hover:bg-canvas":"bg-canvas hover:bg-sunken"}`}function jz({label:e,onClick:t,disabled:n,tone:r}){return(0,U.jsx)("button",{type:"button",onClick:t,disabled:n,className:jq(r),children:e})}function jH({state:e}){let{t}=(0,eh.Ym)();return e.failure?(0,U.jsx)("p",{role:"alert",className:"rounded-[6px] bg-danger-soft px-2 py-1 text-[10.5px] font-semibold leading-snug text-danger",children:t(jB(e.failure.code))}):null}function jU(e){return"ok"===e?"var(--color-success)":"quiet"===e?"var(--color-muted)":"running"===e?"var(--color-accent)":"account-mismatch"===e?"var(--color-warning)":"var(--color-danger)"}function jB(e){return({not_connected:"telegram.report.err.not_connected",reports_disabled:"telegram.report.err.reports_disabled",run_in_progress:"telegram.report.err.run_in_progress",account_check_failed:"telegram.report.err.account_check_failed",sources_failed:"telegram.report.err.sources_failed",launch_failed:"telegram.report.err.launch_failed",run_ended_without_report:"telegram.report.err.run_ended_without_report",timed_out:"telegram.report.err.timed_out",invalid_report:"telegram.report.err.invalid_report",report_missing:"telegram.report.err.report_missing",transport:"telegram.report.err.transport"})[e??""]??"telegram.report.err.generic"}function jK(e){let t=new Date(e);return Number.isNaN(t.getTime())?"—":t.toLocaleDateString([],{day:"2-digit",month:"short",timeZone:jF})}function jY({row:e,onOpen:t,onLeave:n,busy:r}){var i;let a,{t:s}=(0,eh.Ym)();return(0,U.jsxs)("li",{"data-report-row":!0,className:"flex flex-col gap-0.5 border-t border-border py-1.5 first:border-t-0",children:[(0,U.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5",children:[(0,U.jsx)("span",{"aria-hidden":!0,className:"h-1.5 w-1.5 shrink-0 rounded-full",style:{backgroundColor:jU(e.status)}}),(0,U.jsx)("span",{className:"shrink-0 text-[11px] font-semibold text-primary",children:jK(e.startedAt)}),(0,U.jsx)("span",{className:"shrink-0 text-[10px] text-muted",children:(a=Math.max(1,Math.round((Date.parse(e.windowEnd)-Date.parse(e.windowStart))/36e5)),`${a} h`)}),(0,U.jsx)("span",{className:"truncate text-[10px] font-semibold",style:{color:jU(e.status)},children:s((i=e.status,`telegram.report.status.${i}`))}),(0,U.jsxs)("span",{className:"ml-auto flex shrink-0 items-center gap-1",children:[e.conversationId?(0,U.jsx)("a",{href:"#c="+encodeURIComponent(e.conversationId),onClick:n,title:s("telegram.report.openRunTitle"),className:jq(),children:s("telegram.report.openRun")}):null,e.hasReport?(0,U.jsx)(jz,{label:s("telegram.report.open"),onClick:()=>t(e.id),disabled:r}):null]})]}),"failed"===e.status||"account-mismatch"===e.status?(0,U.jsx)("p",{className:"pl-3 text-[10px] leading-snug text-danger",children:s("account-mismatch"===e.status?"telegram.report.err.account_mismatch":jB(e.errorCode))}):null]})}function jW({state:e,settings:t}){let{t:n}=(0,eh.Ym)(),r=new Map(t.groups.map(e=>[e.id,e])),i=e.groups??t.groups.map(e=>({id:e.id,title:e.title}));return(0,U.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,U.jsx)("p",{className:"text-[10.5px] leading-snug text-muted",children:n("telegram.report.sourcesHint")}),(0,U.jsx)("div",{className:"flex items-center gap-1.5",children:(0,U.jsx)(jz,{label:n("telegram.report.loadGroups"),onClick:()=>void e.loadGroups(),disabled:e.busy})}),0===i.length?(0,U.jsx)("p",{className:"text-[10.5px] text-muted",children:n("telegram.report.noGroups")}):(0,U.jsx)("ul",{className:"flex max-h-[180px] flex-col gap-1 overflow-y-auto",children:i.map(i=>{let a=r.get(i.id)?.mode??null;return(0,U.jsxs)("li",{className:"flex min-w-0 items-center gap-1.5",children:[(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11px] text-primary",children:i.title}),["light","full"].map(r=>(0,U.jsx)("button",{type:"button","aria-pressed":a===r,disabled:e.busy,onClick:()=>{var n,s,l;let o;return n=i.id,s=i.title,l=a===r?null:r,o=t.groups.filter(e=>e.id!==n),void(l&&o.push({id:n,title:s,mode:l}),e.saveSettings({...t,groups:o}))},className:`inline-flex min-h-[44px] shrink-0 items-center rounded-[6px] border px-1.5 text-[10px] font-semibold disabled:opacity-45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:min-h-[26px] ${a===r?"border-accent text-accent":"border-border text-muted hover:bg-canvas"}`,children:n("light"===r?"telegram.report.modeLight":"telegram.report.modeFull")},r))]},i.id)})})]})}function jV({state:e}){let{t}=(0,eh.Ym)(),n=(0,Y.useRef)(null),r=e.prompt;return r?(0,U.jsxs)("div",{className:"flex flex-col gap-1.5 border-t border-border pt-1.5",children:[(0,U.jsxs)("div",{className:"flex items-center gap-2",children:[(0,U.jsx)("span",{className:"text-[11px] font-bold text-primary",children:t("telegram.report.promptTitle")}),(0,U.jsx)("span",{className:"ml-auto",children:(0,U.jsx)(jz,{label:t("telegram.report.back"),onClick:e.closePrompt,disabled:e.busy})})]}),(0,U.jsx)("p",{className:"text-[10.5px] leading-snug text-muted",children:t("telegram.report.promptHint")}),(0,U.jsx)(jH,{state:e}),(0,U.jsx)("textarea",{ref:n,defaultValue:r.prompt,"aria-label":t("telegram.report.promptTitle"),spellCheck:!1,className:"h-[220px] w-full resize-none rounded-[8px] border border-border bg-canvas p-2 font-mono text-[10.5px] leading-snug outline-none focus-visible:ring-2 focus-visible:ring-accent/40"}),(0,U.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,U.jsx)(jz,{label:t("telegram.report.promptSave"),tone:"accent",disabled:e.busy,onClick:()=>{let t=n.current?.value??"";e.savePrompt(t)}}),(0,U.jsx)(jz,{label:t("telegram.report.promptReset"),disabled:e.busy,onClick:()=>{n.current&&(n.current.value=r.defaultPrompt)}})]}),(0,U.jsx)("p",{className:"text-[10px] leading-snug text-secondary",children:t("telegram.report.promptPreamble")})]}):null}function jJ({state:e,onClose:t}){let{t:n}=(0,eh.Ym)(),[r,i]=(0,Y.useState)(!1),a=e.reports,s=a?.settings,l=a?.history.some(e=>"running"===e.status)??!1;if(!s)return(0,U.jsxs)("div",{className:"flex flex-col gap-1 border-t border-border pt-1.5",children:[(0,U.jsx)("span",{className:"text-[11px] font-bold text-primary",children:n("telegram.report.title")}),(0,U.jsx)(jH,{state:e}),(0,U.jsx)("p",{className:"text-[10.5px] text-muted",children:n("telegram.report.loading")})]});if(e.prompt)return(0,U.jsx)(jV,{state:e});if(e.openReport)return(0,U.jsxs)("div",{className:"flex flex-col gap-1.5 border-t border-border pt-1.5",children:[(0,U.jsxs)("div",{className:"flex items-center gap-2",children:[(0,U.jsx)("span",{className:"text-[11px] font-bold text-primary",children:n("telegram.report.title")}),(0,U.jsx)("span",{className:"ml-auto",children:(0,U.jsx)(jz,{label:n("telegram.report.back"),onClick:e.closeReport})})]}),(0,U.jsx)(jH,{state:e}),(0,U.jsx)("div",{className:"max-h-[320px] overflow-auto whitespace-pre-wrap break-words rounded-[8px] bg-canvas p-2 text-[11px] leading-snug text-primary",children:pl(e.openReport.text)})]});let o=t=>void e.saveSettings({...s,...t});return(0,U.jsxs)("div",{className:"flex flex-col gap-1.5 border-t border-border pt-1.5",children:[(0,U.jsxs)("div",{className:"flex items-center gap-2",children:[(0,U.jsx)("span",{className:"text-[11px] font-bold text-primary",children:n("telegram.report.title")}),s.enabled?(0,U.jsx)("span",{className:"ml-auto",children:(0,U.jsx)(jz,{label:n("telegram.report.disable"),onClick:()=>o({enabled:!1}),disabled:e.busy})}):null]}),(0,U.jsx)(jH,{state:e}),s.enabled?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,U.jsx)("label",{className:"text-[10.5px] text-muted",htmlFor:"telegram-report-time",children:n("telegram.report.at")}),(0,U.jsx)("input",{id:"telegram-report-time",type:"time",value:s.time,disabled:e.busy,onChange:e=>o({time:e.target.value}),className:"h-11 w-[116px] rounded-[8px] border border-border bg-canvas px-1.5 text-[11.5px] outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:h-8"}),(0,U.jsx)("span",{className:"text-[9.5px] font-semibold text-secondary",children:n("telegram.report.zone")})]}),(0,U.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5",children:[(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate text-[10.5px] text-muted",children:n("telegram.report.sourcesSummary",{count:s.groups.length})}),(0,U.jsx)(jz,{label:n(r?"telegram.report.sourcesDone":"telegram.report.sourcesEdit"),onClick:()=>i(e=>!e),disabled:e.busy})]}),r?(0,U.jsx)(jW,{state:e,settings:s}):null,(0,U.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5",children:[(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate text-[10.5px] text-muted",children:n(s.promptIsDefault?"telegram.report.promptDefault":"telegram.report.promptEdited")}),(0,U.jsx)(jz,{label:n("telegram.report.promptEdit"),onClick:()=>void e.loadPrompt(),disabled:e.busy})]}),(0,U.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,U.jsx)(jz,{label:n(l?"telegram.report.running":"telegram.report.runNow"),onClick:()=>void e.runNow(),disabled:e.busy||l,tone:"accent"}),a?.nextRunAt?(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate text-[9.5px] font-semibold text-secondary",children:n("telegram.report.nextRun",{time:function(e){if(!e)return null;let t=new Date(e);return Number.isNaN(t.getTime())?null:t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1,timeZone:jF})}(a.nextRunAt)??"",date:jK(a.nextRunAt)})}):null]})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("p",{className:"text-[10.5px] leading-snug text-muted",children:n("telegram.report.disabledHint")}),(0,U.jsx)(jz,{label:n("telegram.report.enable"),onClick:()=>o({enabled:!0}),disabled:e.busy,tone:"accent"})]}),a&&a.history.length>0?(0,U.jsx)("ul",{className:"flex max-h-[220px] flex-col overflow-y-auto",children:a.history.map(n=>(0,U.jsx)(jY,{row:n,onOpen:t=>void e.openReportById(t),onLeave:t,busy:e.busy},n.id))}):s.enabled?(0,U.jsx)("p",{className:"text-[10.5px] text-muted",children:n("telegram.report.noRuns")}):null]})}function jG(e){return`telegram.status.${e}`}function jQ(e){return"connected"===e?"var(--color-success)":"expired"===e?"var(--color-warning)":"error"===e?"var(--color-danger)":"disconnected"===e?"transparent":"var(--color-accent)"}async function jX(e){let{toDataURL:t}=await n.e(768).then(n.t.bind(n,768,19));return t(e,{margin:1,width:200})}function jZ({url:e,renderQr:t=jX}){let{t:n}=(0,eh.Ym)(),[r,i]=(0,Y.useState)(null),[a,s]=(0,Y.useState)(null),[l,o]=(0,Y.useState)(0);return((0,Y.useEffect)(()=>{let n=!1;return Promise.resolve().then(()=>t(e)).then(t=>{n||i({url:e,dataUrl:t})}).catch(()=>{n||s(e)}),()=>{n=!0}},[l,t,e]),a===e)?(0,U.jsxs)("div",{className:"mx-auto flex h-[200px] flex-col items-center justify-center gap-2 text-center",children:[(0,U.jsx)("p",{role:"alert",className:"text-[11px] font-semibold text-danger",children:n("telegram.qrFailed")}),(0,U.jsx)(j0,{label:n("telegram.qrRetry"),onClick:()=>{i(null),s(null),o(e=>e+1)}})]}):r&&r.url===e?(0,U.jsx)("img",{src:r.dataUrl,alt:n("telegram.qrAlt"),className:"mx-auto h-[200px] w-[200px] rounded-[8px] bg-white p-1"}):(0,U.jsx)("span",{className:"mx-auto flex h-[200px] items-center text-[12px] text-primary",children:n("telegram.qrGenerating")})}function j0({label:e,onClick:t,disabled:n,tone:r="neutral"}){return(0,U.jsx)("button",{type:"button",onClick:t,disabled:n,className:`inline-flex min-h-[44px] shrink-0 items-center rounded-[7px] border border-border px-2.5 py-0.5 text-[11px] font-semibold disabled:opacity-45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:min-h-[28px] ${"danger"===r?"bg-canvas text-danger hover:bg-danger-soft":"bg-canvas hover:bg-sunken"}`,children:e})}function j1({label:e,prompt:t,onConfirm:n,disabled:r,icon:i}){let{t:a}=(0,eh.Ym)(),[s,l]=(0,Y.useState)(!1);return s?(0,U.jsxs)("span",{className:"flex min-w-0 flex-1 items-center justify-end gap-1.5",children:[(0,U.jsx)("span",{className:"min-w-0 flex-1 text-right text-[10.5px] font-semibold leading-snug text-danger",children:t}),(0,U.jsx)("button",{type:"button",disabled:r,onClick:()=>{l(!1),n()},className:"inline-flex min-h-[44px] shrink-0 items-center rounded-[6px] bg-danger px-2 py-0.5 text-[10.5px] font-semibold text-white hover:opacity-90 disabled:opacity-45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:min-h-[28px]",children:a("telegram.confirmCta")}),(0,U.jsx)("button",{type:"button",disabled:r,onClick:()=>l(!1),className:"inline-flex min-h-[44px] shrink-0 items-center rounded-[6px] px-2 py-0.5 text-[10.5px] font-semibold text-secondary hover:bg-canvas disabled:opacity-45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:min-h-[28px]",children:a("telegram.confirmCancel")})]}):(0,U.jsxs)("button",{type:"button",disabled:r,onClick:()=>l(!0),className:"inline-flex min-h-[44px] shrink-0 items-center gap-1 rounded-[6px] px-1.5 py-0.5 text-[10.5px] font-semibold text-muted hover:bg-danger-soft hover:text-danger disabled:opacity-45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:min-h-[28px]",children:[i,e]})}function j2({state:e,reports:t,onClose:n}){var r;let{t:i}=(0,eh.Ym)(),{status:a,busy:s,failure:l}=e,o=a?.phase??"disconnected",c=(0,Y.useRef)(null),d=(0,Y.useRef)(null),u=(0,Y.useRef)(null),p=(0,Y.useRef)(null),m=!!a&&!a.credentialsConfigured&&("disconnected"===a.phase||"error"===a.phase&&a.error?.code==="credentials_missing");(0,Y.useEffect)(()=>{c.current?.focus()},[]),(0,Y.useEffect)(()=>{d.current&&(d.current.value="")},[o,a?.login?.passwordError]);let f=(0,U.jsx)(j0,{label:i("telegram.cancel"),onClick:()=>void e.cancel(),disabled:s}),h=e=>(0,U.jsxs)("div",{className:"flex items-center gap-2",children:[(0,U.jsx)(sx.kr,{className:"h-3 w-3 shrink-0 animate-spin motion-reduce:animate-none text-muted","aria-hidden":!0}),(0,U.jsx)("span",{className:"min-w-0 flex-1 text-[11px] text-muted",children:e}),f]}),x=function(e){if(!e)return null;let t=new Date(e);return Number.isNaN(t.getTime())?null:t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1})}(a?.lastHealthCheckAt??null);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("button",{type:"button","aria-hidden":!0,tabIndex:-1,"aria-label":i("telegram.close"),onClick:e=>{e.stopPropagation(),n()},className:"fixed inset-0 z-40 cursor-default sm:hidden"}),(0,U.jsxs)("div",{role:"dialog","aria-label":i("telegram.title"),"aria-busy":s,onKeyDown:e=>k5(e,n),className:"fixed bottom-3 left-1/2 z-50 flex max-h-[min(560px,calc(100vh-24px))] w-[min(320px,calc(100vw-16px))] -translate-x-1/2 flex-col overflow-y-auto overscroll-contain rounded-[14px] border border-border bg-card shadow-2 sm:absolute sm:bottom-1 sm:left-full sm:ml-2 sm:translate-x-0",children:[(0,U.jsxs)("header",{className:"flex items-center gap-2 border-b border-border px-3 py-2",children:[(0,U.jsx)(fn.A,{className:"h-3.5 w-3.5 shrink-0",style:{color:"var(--color-accent)"},"aria-hidden":!0}),(0,U.jsx)("span",{className:"text-[12.5px] font-bold",children:i("telegram.title")}),(0,U.jsx)("span",{className:"truncate text-[9.5px] font-medium text-muted",children:i("telegram.readOnlyNote")}),(0,U.jsx)("button",{ref:c,type:"button","aria-label":i("telegram.close"),onClick:n,className:"ml-auto inline-flex min-h-[44px] min-w-[44px] items-center justify-center rounded-[6px] p-1 text-muted hover:bg-canvas hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:min-h-0 sm:min-w-0",children:(0,U.jsx)(sx.X,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),(0,U.jsx)("p",{className:"sr-only",role:"status","aria-live":"polite",children:a?"awaiting_scan"===a.phase?i("telegram.announceScan"):"awaiting_password"===a.phase?i("telegram.announcePassword"):"connected"===a.phase?i("telegram.announceConnected"):"":""}),(0,U.jsxs)("div",{className:"flex flex-col gap-2 px-3 py-2.5",children:[(0,U.jsxs)("div",{className:"flex items-center gap-2",children:[(0,U.jsx)("span",{"aria-hidden":!0,className:"h-2 w-2 shrink-0 rounded-full",style:{backgroundColor:jQ(o),boxShadow:"disconnected"===o?"inset 0 0 0 1.5px var(--color-border)":"none"}}),(0,U.jsx)("span",{className:"text-[11.5px] font-semibold text-primary",children:i(jG(o))})]}),l?(0,U.jsx)("p",{role:"alert",className:"rounded-[6px] bg-danger-soft px-2 py-1 text-[10.5px] font-semibold leading-snug text-danger",children:i("login_busy"===(r=l.code)?"telegram.err.login_busy":"invalid_credentials"===r?"telegram.credentialsInvalid":"transport"===r?"telegram.actionUnreachable":"telegram.actionFailed")}):null,m?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("p",{className:"text-[10.5px] leading-snug text-muted",children:i("telegram.credentialsHint")}),(0,U.jsxs)("form",{onSubmit:t=>{t.preventDefault();let n=u.current?.value.trim()??"",r=p.current?.value.trim()??"";s||""===n||""===r||e.saveCredentials(n,r)},className:"flex flex-col gap-1.5",children:[(0,U.jsx)("input",{ref:u,type:"text",required:!0,inputMode:"numeric",autoComplete:"off","aria-label":i("telegram.credentialsIdLabel"),placeholder:i("telegram.credentialsIdLabel"),className:"h-11 min-w-0 rounded-[8px] border border-border bg-canvas px-2 text-[11.5px] outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:h-8"}),(0,U.jsx)("input",{ref:p,type:"password",required:!0,autoComplete:"off","aria-label":i("telegram.credentialsHashLabel"),placeholder:i("telegram.credentialsHashLabel"),className:"h-11 min-w-0 rounded-[8px] border border-border bg-canvas px-2 text-[11.5px] outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:h-8"}),(0,U.jsx)("button",{type:"submit",disabled:s,className:"h-11 shrink-0 rounded-[8px] border border-border bg-canvas px-2.5 text-[11px] font-semibold hover:bg-sunken disabled:cursor-not-allowed disabled:opacity-45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:h-8",children:i("telegram.credentialsSave")})]}),(0,U.jsx)("p",{className:"text-[10px] leading-snug text-muted",children:i("telegram.credentialsSource")})]}):null,"disconnected"!==o||m?null:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("p",{className:"text-[10.5px] leading-snug text-muted",children:i("telegram.connectHint")}),(0,U.jsx)(j0,{label:i("telegram.connect"),onClick:()=>void e.connect(),disabled:s})]}),"starting"===o?h(i("telegram.status.starting")):null,"verifying"===o?h(i("telegram.status.verifying")):null,"awaiting_scan"===o&&a?.login?(0,U.jsxs)(U.Fragment,{children:[a.login.qr?(0,U.jsx)(jZ,{url:a.login.qr.url}):(0,U.jsx)("span",{className:"mx-auto text-[12px] text-primary",children:i("telegram.qrGenerating")}),(0,U.jsx)("p",{className:"text-[10.5px] leading-snug text-muted",children:i("telegram.qrHint")}),(0,U.jsx)("div",{className:"flex justify-end",children:f})]}):null,"awaiting_password"===o&&a?.login?(0,U.jsxs)(U.Fragment,{children:[a.login.passwordError?(0,U.jsx)("p",{role:"alert",className:"text-[10.5px] font-semibold text-danger",children:i("telegram.passwordInvalid")}):null,(0,U.jsxs)("form",{onSubmit:t=>{t.preventDefault();let n=d.current;if(s||!n||""===n.value)return;let r=n.value;n.value="",e.submitPassword(r)},className:"flex items-center gap-2",children:[(0,U.jsx)("input",{ref:d,type:"password",required:!0,autoComplete:"off","aria-label":i("telegram.passwordLabel"),placeholder:i("telegram.passwordPlaceholder"),className:"h-11 min-w-0 flex-1 rounded-[8px] border border-border bg-canvas px-2 text-[11.5px] outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:h-8"}),(0,U.jsx)("button",{type:"submit",disabled:s,className:"h-11 shrink-0 rounded-[8px] border border-border bg-canvas px-2.5 text-[11px] font-semibold hover:bg-sunken disabled:cursor-not-allowed disabled:opacity-45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:h-8",children:i("telegram.passwordSubmit")})]}),(0,U.jsx)("p",{className:"text-[10px] leading-snug text-muted",children:i("telegram.passwordHint")}),(0,U.jsx)("div",{className:"flex justify-end",children:f})]}):null,"connected"===o?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)("div",{className:"flex min-w-0 items-baseline gap-1.5 text-[11px]",children:[(0,U.jsx)("span",{className:"shrink-0 text-muted",children:i("telegram.connectedAs")}),(0,U.jsx)("span",{className:"truncate font-semibold text-primary",children:a?.identity?.name}),a?.identity?.username?(0,U.jsxs)("span",{className:"truncate font-mono text-[10px] text-muted",children:["@",a.identity.username]}):null]}),x?(0,U.jsx)("p",{className:"text-[9.5px] font-semibold text-secondary",children:i("telegram.lastCheck",{time:x})}):null]}):null,"expired"===o?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("p",{className:"text-[10.5px] leading-snug text-muted",children:i("telegram.expiredHint")}),(0,U.jsx)(j0,{label:i("telegram.reconnect"),onClick:()=>void e.connect(),disabled:s})]}):null,"error"!==o||m?null:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("p",{role:"alert",className:"text-[10.5px] font-semibold leading-snug text-danger",children:i({credentials_missing:"telegram.err.credentials_missing",start_failed:"telegram.err.start_failed",bridge_failed:"telegram.err.bridge_failed",password_invalid:"telegram.err.password_invalid",network_failed:"telegram.err.network_failed",timed_out:"telegram.err.timed_out",canceled:"telegram.err.canceled",session_unsafe:"telegram.err.session_unsafe",connector_failed:"telegram.err.connector_failed",host_registration_failed:"telegram.err.host_registration_failed",not_read_only:"telegram.err.not_read_only",logout_failed:"telegram.err.logout_failed",health_failed:"telegram.err.health_failed"}[a?.error?.code??"bridge_failed"]??"telegram.err.bridge_failed")}),(0,U.jsx)(j0,{label:i("telegram.retry"),onClick:()=>void(a?.credentialRef?e.refresh(!0):e.connect()),disabled:s})]}),"connected"===o&&t?(0,U.jsx)(jJ,{state:t,onClose:n}):null,"connected"===o||"expired"===o||"error"===o&&(a?.credentialRef||a?.error?.code==="session_unsafe")?(0,U.jsxs)("div",{className:"flex flex-col gap-1 border-t border-border pt-1.5",children:["expired"!==o&&("error"!==o||a?.error?.code!=="session_unsafe")?(0,U.jsx)("div",{className:"flex items-center",children:(0,U.jsx)(j1,{label:i("telegram.logout"),prompt:i("telegram.logoutConfirm"),onConfirm:()=>void e.logout(),disabled:s})}):null,(0,U.jsx)("div",{className:"flex items-center",children:(0,U.jsx)(j1,{label:i("telegram.deleteLocal"),prompt:i("telegram.deleteLocalConfirm"),onConfirm:()=>void e.deleteLocal(),disabled:s,icon:(0,U.jsx)(sx.TB,{className:"h-3 w-3","aria-hidden":!0})})})]}):null]})]})]})}function j5(){let{t:e}=(0,eh.Ym)(),t=function(){let[e,t]=(0,Y.useState)(null),[n,r]=(0,Y.useState)(!1),[i,a]=(0,Y.useState)(null),s=(0,Y.useRef)(null),l=(0,Y.useRef)(0),o=(0,Y.useCallback)(e=>{s.current=e,t(e)},[]),c=(0,Y.useCallback)(async(e,t=!1)=>{let n=++l.current;try{let r=await jD(await fetch(`/api/telegram${e?"?fresh=1":""}`));if(n!==l.current)return null;return r.payload?(o(r.payload),t||a(null)):a({code:r.code}),r.payload}catch{return n===l.current&&a({code:"transport"}),null}},[o]),d=(0,Y.useCallback)(async(e=!1)=>{await c(e)},[c]),u=e?.login!=null&&jO.has(e.phase),p=e?.phase==="connected"||e?.phase==="error"&&null!==e.credentialRef;(0,Y.useEffect)(()=>{let e=!1,t=null,n=async()=>{let r=s.current,i=r?.phase==="connected"||r?.phase==="error"&&null!==r.credentialRef,a=await c(i)??s.current;e||(t=setTimeout(()=>void n(),a?.login!=null&&jO.has(a.phase)?1500:6e4))};return n(),()=>{e=!0,t&&clearTimeout(t)}},[c,u?"login":p?"health":"idle"]);let m=(0,Y.useCallback)(async e=>{l.current+=1,r(!0),a(null);try{let t=await fetch("/api/telegram",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)}),n=await jD(t);n.payload?(l.current+=1,o(n.payload)):(a({code:n.code}),await c(!0,!0))}catch{l.current+=1,a({code:"transport"})}finally{r(!1)}},[o,c]),f=(0,Y.useCallback)(()=>m({action:"start"}),[m]),h=(0,Y.useCallback)((e,t)=>m({action:"credentials",apiId:e,apiHash:t}),[m]);return{status:e,busy:n,failure:i,refresh:d,connect:f,saveCredentials:h,logout:(0,Y.useCallback)(()=>m({action:"logout"}),[m]),deleteLocal:(0,Y.useCallback)(()=>m({action:"delete"}),[m]),submitPassword:e=>{let t=s.current?.login?.operationId;return t?m({action:"password",operationId:t,password:e}):Promise.resolve()},cancel:()=>{let e=s.current?.login?.operationId;return e?m({action:"cancel",operationId:e}):Promise.resolve()}}}(),[n,r]=(0,Y.useState)(!1),i=function(e){let[t,n]=(0,Y.useState)(null),[r,i]=(0,Y.useState)(!1),[a,s]=(0,Y.useState)(null),[l,o]=(0,Y.useState)(null),[c,d]=(0,Y.useState)(null),[u,p]=(0,Y.useState)(null),m=(0,Y.useRef)(0),f=(0,Y.useCallback)(async()=>{let e=++m.current;try{let{ok:t,json:r}=await jL(await fetch("/api/telegram/reports"));if(e!==m.current)return;t&&r.reports?n(r.reports):s({code:j_(r)})}catch{e===m.current&&s({code:"transport"})}},[]);(0,Y.useEffect)(()=>{if(!e)return;let t=!1,n=null,r=async()=>{await f(),t||(n=setTimeout(()=>void r(),2e4))};return r(),()=>{t=!0,n&&clearTimeout(n)}},[e,f]);let h=(0,Y.useCallback)(async e=>{m.current+=1,i(!0),s(null);try{let{ok:t,json:r}=await jL(await fetch("/api/telegram/reports",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)}));return m.current+=1,r.reports&&n(r.reports),t||s({code:j_(r)}),{ok:t,json:r}}catch{return m.current+=1,s({code:"transport"}),{ok:!1,json:{}}}finally{i(!1)}},[]);return{reports:t,busy:r,failure:a,openReport:l,groups:c,prompt:u,refresh:f,saveSettings:async e=>{await h({action:"settings",settings:e})},loadPrompt:async()=>{i(!0),s(null);try{let{ok:e,json:t}=await jL(await fetch("/api/telegram/reports?prompt=1"));e&&"string"==typeof t.prompt&&"string"==typeof t.defaultPrompt?p({prompt:t.prompt,defaultPrompt:t.defaultPrompt}):s({code:j_(t)})}catch{s({code:"transport"})}finally{i(!1)}},savePrompt:async e=>{let n=t?.settings;if(!n)return;let{ok:r}=await h({action:"settings",settings:n,prompt:e});r&&p(null)},closePrompt:()=>p(null),runNow:async()=>{await h({action:"run-now"})},loadGroups:async()=>{let{json:e}=await h({action:"groups"});Array.isArray(e.groups)&&d(e.groups)},openReportById:async e=>{i(!0),s(null);try{let{ok:t,json:n}=await jL(await fetch(`/api/telegram/reports?report=${encodeURIComponent(e)}`));t&&"string"==typeof n.report?o({id:e,text:n.report}):s({code:j_(n)})}catch{s({code:"transport"})}finally{i(!1)}},closeReport:()=>o(null)}}(n&&t.status?.phase==="connected"),a=(0,Y.useRef)(null),s=(0,Y.useRef)(null),l=t.status?.phase??"disconnected";return(0,Y.useEffect)(()=>{if(!n)return;let e=e=>{a.current&&!a.current.contains(e.target)&&r(!1)};return window.addEventListener("pointerdown",e),()=>window.removeEventListener("pointerdown",e)},[n]),(0,Y.useEffect)(()=>{n&&t.refresh("connected"===l||"expired"===l||"error"===l)},[n]),(0,U.jsxs)("div",{ref:a,className:"relative",children:[(0,U.jsxs)("button",{ref:s,type:"button","aria-expanded":n,"aria-haspopup":"dialog","aria-label":e("telegram.rowAria"),onClick:()=>r(e=>!e),className:"flex min-h-[44px] w-full items-center gap-2 px-3.5 py-1.5 text-left hover:bg-canvas focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:min-h-[36px]",children:[(0,U.jsx)(fn.A,{className:"h-3.5 w-3.5 shrink-0 text-muted","aria-hidden":!0}),(0,U.jsx)("span",{className:"text-[11.5px] font-bold text-primary",children:e("telegram.title")}),(0,U.jsxs)("span",{className:"ml-auto flex shrink-0 items-center gap-1.5",children:[t.status?.login?(0,U.jsx)(sx.kr,{className:"h-3 w-3 animate-spin motion-reduce:animate-none text-accent","aria-hidden":!0}):null,(0,U.jsx)("span",{className:"text-[10px] font-semibold text-muted",children:e(jG(l))}),(0,U.jsx)("span",{"aria-hidden":!0,className:"h-2 w-2 rounded-full",style:{backgroundColor:jQ(l),boxShadow:"disconnected"===l?"inset 0 0 0 1.5px var(--color-border)":"none"}})]})]}),n?(0,U.jsx)(j2,{state:t,reports:i,onClose:()=>{r(!1),s.current?.focus()}}):null]})}function j4(e,t,n){return e?eK(t,n)??(0,eh.Tl)(n,"accounts.limitsStale"):null}function j3(e,t){return e<=10?"var(--color-danger)":e<=30?"var(--color-warning)":t}function j6({label:e,window:t,engineColor:n,now:r,staleHint:i}){let{t:a}=(0,eh.Ym)();if(!t)return null;let s=Math.max(0,Math.min(100,100-t.usedPercent)),l=j3(s,n);return(0,U.jsxs)("div",{className:"mt-1.5",children:[(0,U.jsxs)("div",{className:"flex items-baseline justify-between",children:[(0,U.jsx)("span",{className:"text-[11px] font-semibold text-primary",children:e}),(0,U.jsxs)("span",{className:"text-[11px] text-muted",children:[a("limits.left")," ",(0,U.jsxs)("span",{className:`font-bold tabular-nums ${s<=30?"":"text-primary"}`,style:s<=30?{color:l}:void 0,children:[Math.round(s),"%"]})]})]}),(0,U.jsx)("div",{className:"mt-1 h-[4px] overflow-hidden rounded-full bg-sunken",children:(0,U.jsx)("div",{className:"h-full rounded-full transition-[width] duration-700 ease-out",style:{width:Math.max(s,1.5)+"%",backgroundColor:l}})}),t.resetsAt||i?(0,U.jsxs)("div",{className:"mt-[3px] text-[10px] leading-none text-muted",children:[t.resetsAt?a("limits.reset",{eta:eW(t.resetsAt,r),at:eJ(t.resetsAt,r)}):null,t.resetsAt&&i?" \xb7 ":null,i]}):null]})}function j8(e,t,n){if(!e)return!1;let r="claude"===n?e.claudeAccountId??null:e.codexAccountId??null,i="claude"===n?t.claudeAccountId??null:t.codexAccountId??null;return null!==r&&null!==i&&r!==i}function j7({engine:e,label:t,limits:n,payloadAccountId:r,now:i,receivedAt:a,provenance:s,onSwitched:l}){var o;let{locale:c,t:d}=(0,eh.Ym)(),u=xl(e),[p,m]=(0,Y.useState)(!1),[f,h]=(0,Y.useState)(!1),[x,g]=(0,Y.useState)(null),b=(0,Y.useRef)(null),v=(0,Y.useRef)(null),w=(0,Y.useRef)(null),y=(0,Y.useRef)(u.identityVersion);(0,Y.useEffect)(()=>{let t=e=>{h(!1),g(e),m(!0)},n=function(e){if(!ep||ep.engine!==e)return null;if(Date.now()-ep.at>5e3)return ep=null,null;let{accountId:t}=ep;return ep=null,{engine:e,accountId:t}}(e);return n&&t(n.accountId),ef(n=>{n.engine===e&&t(n.accountId)})},[e]),(0,Y.useEffect)(()=>{if(!p)return;let e=e=>{b.current&&!b.current.contains(e.target)&&m(!1)};return window.addEventListener("pointerdown",e),()=>window.removeEventListener("pointerdown",e)},[p]),(0,Y.useEffect)(()=>{if(!f)return;let e=e=>{b.current&&!b.current.contains(e.target)&&h(!1)};return window.addEventListener("pointerdown",e),()=>window.removeEventListener("pointerdown",e)},[f]),(0,Y.useEffect)(()=>{y.current!==u.identityVersion&&(y.current=u.identityVersion,l())},[u.identityVersion,l]),u.status;let k=(0,tw.t7)(e),j=(o=u.active,n&&o&&r===o?n:null),N=!!(n&&null===j),S=u.accounts.find(e=>e.id===u.active),C=k7(function(e,t,n){if(!e)return null;let r=t.staleSince?Date.parse(t.staleSince)/1e3:NaN,i=Number.isFinite(r)?r:null;return{limits:e,observedAt:e.capturedAt??i??n,stale:"cache"===t.source||"unavailable"===t.source,source:t.source}}(j,s,a),k4(S?.limits),i),A=function(e){if(!e.session&&!e.weekly)return null;let t=[e.session?.observedAt,e.weekly?.observedAt].filter(e=>null!=e);return{session:e.session?{...e.session.value,observedAt:e.session.observedAt,source:e.session.source}:null,weekly:e.weekly?{...e.weekly.value,observedAt:e.weekly.observedAt,source:e.weekly.source}:null,plan:e.plan,capturedAt:t.length?Math.min(...t):null}}(C),I=!!(A&&(A.session||A.weekly)),M=A?.capturedAt&&i-A.capturedAt>1200?(0,tw.rK)(A.capturedAt):null,T=S?.label??d("accounts.trigger"),P=k9(C),$=j4(!!P?.stale,P?.observedAt??null,c),E=!!(C.session?.stale||C.weekly?.stale),R=u.migration?.state==="draining",O=function(e,t){if("unavailable"!==e.source&&"cache"!==e.source)return null;if("oauth-reauthentication-required"===e.reason)return(0,eh.Tl)(t,"limits.reauthRequired");if("oauth-rate-limited"!==e.reason||!e.retryAt)return null;let n=new Date(e.retryAt);return Number.isNaN(n.getTime())?(0,eh.Tl)(t,"limits.rateLimited"):(0,eh.Tl)(t,"limits.rateLimitedRetry",{time:n.toLocaleTimeString(eB(t),{hour:"2-digit",minute:"2-digit",hour12:!1})})}(s,c),D="loading"===u.status||N?null:O;return(0,U.jsxs)("div",{ref:b,className:"relative",children:[(0,U.jsxs)("div",{className:E?"opacity-60":"",children:[(0,U.jsx)("button",{ref:v,type:"button","aria-expanded":p,"aria-haspopup":"dialog","aria-label":d("accounts.triggerAria",{engine:t}),onClick:()=>{h(!1),m(e=>!e)},className:"block w-full px-3.5 pb-1.5 pt-2.5 text-left hover:bg-canvas focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:(0,U.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,U.jsx)("span",{className:"text-[11.5px] font-bold",style:{color:k.color},children:t}),A?.plan?(0,U.jsx)("span",{className:"truncate text-[10px] text-muted",children:A.plan}):null,$?(0,U.jsx)("span",{className:"truncate text-[10px] text-muted",children:$}):null,M?(0,U.jsx)("span",{className:"h-1.5 w-1.5 shrink-0 self-center rounded-full bg-warning",title:d("limits.stale",{stale:M})}):null,(0,U.jsxs)("span",{className:"ml-auto flex shrink-0 items-center gap-1",children:[P?(0,U.jsx)("span",{className:`rounded-full border border-border bg-canvas px-1.5 py-0.5 text-[9.5px] font-bold tabular-nums ${P.stale?"opacity-55":""}`,style:{color:j3(P.percent,k.color)},children:d("accounts.effective",{pct:Math.round(P.percent)})}):null,(0,U.jsxs)("span",{className:"flex items-center gap-0.5 rounded-full border border-border bg-canvas px-1.5 py-0.5 text-[10px] font-semibold text-primary",children:[(0,U.jsx)("span",{className:"max-w-24 truncate",children:T}),R?(0,U.jsx)(sx.kr,{className:"h-3 w-3 animate-spin motion-reduce:animate-none text-accent","aria-hidden":!0}):(0,U.jsx)(sx.yQ,{className:"h-3 w-3 text-muted","aria-hidden":!0})]})]})]})}),I?(0,U.jsxs)("button",{ref:w,type:"button","aria-expanded":f,"aria-haspopup":"dialog","aria-label":d("burndown.openAria",{engine:t}),onClick:()=>{m(!1),h(e=>!e)},className:`block w-full px-3.5 pt-0.5 text-left hover:bg-canvas focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${D?"pb-1.5":"pb-3"}`,children:[(0,U.jsx)(j6,{label:eV(d,"session",A.session?.windowMinutes),window:A.session,engineColor:k.color,now:i,staleHint:j4(!!C.session?.stale,C.session?.observedAt??null,c)}),(0,U.jsx)(j6,{label:eV(d,"weekly",A.weekly?.windowMinutes),window:A.weekly,engineColor:k.color,now:i,staleHint:j4(!!C.weekly?.stale,C.weekly?.observedAt??null,c)})]}):D?null:(0,U.jsx)("div",{className:"px-3.5 pb-3 pt-0.5 text-[10px] text-muted",children:d("loading"===u.status||N?"limits.accountLoading":"limits.noDataYet")}),D?(0,U.jsx)("div",{className:"px-3.5 pb-3 pt-0.5 text-[10px] text-muted",children:D}):null]}),p?(0,U.jsx)(jc,{state:u,onClose:()=>{m(!1),g(null),v.current?.focus()},focusAccountId:x,quotaOverride:{accountId:u.active,quota:C,now:i}}):null,f?(0,U.jsx)(jR,{engine:e,label:t,plan:A?.plan??null,activeAccountId:u.active,onClose:()=>{h(!1),w.current?.focus()}},u.active):null]})}function j9(){let[e,t]=(0,Y.useState)(null),[n,r]=(0,Y.useState)(()=>Date.now()/1e3),i=(0,Y.useRef)(async()=>{}),a=(0,Y.useCallback)(()=>void i.current(),[]);return(0,Y.useEffect)(()=>{var e,n;let a,s,l=!0,o=(e=fetch,n=e=>{t(t=>{var n;let r,i;return{data:(r=j8(n=t?.data??null,e,"claude"),i=j8(n,e,"codex"),{claude:r?e.claude:e.claude??n?.claude??null,codex:i?e.codex:e.codex??n?.codex??null,claudeAccountId:e.claudeAccountId??n?.claudeAccountId??null,codexAccountId:e.codexAccountId??n?.codexAccountId??null,provenance:e.provenance,staleSince:e.staleSince??null}),at:Date.now()/1e3}})},a=0,s=null,{async load(){s?.abort();let t=++a;s=new AbortController;try{let r=await e("/api/limits",{signal:s.signal});if(!r.ok)return!1;let i=await r.json();if(t!==a)return!1;return s=null,n(i),!0}catch{return!1}},dispose(){a+=1,s?.abort(),s=null}}),c=async()=>{await o.load(),l&&r(Date.now()/1e3)};i.current=c,c();let d=setInterval(c,6e4);return()=>{l=!1,clearInterval(d),o.dispose(),i.current=async()=>{}}},[]),(0,U.jsxs)("div",{className:"shrink-0 border-t border-border empty:hidden",children:[(0,U.jsx)(j7,{engine:"claude",label:"Claude",limits:e?.data.claude??null,payloadAccountId:e?.data.claudeAccountId??null,now:n,receivedAt:e?.at??n,provenance:e?.data.provenance.claude??{source:"unavailable",reason:null,staleSince:null},onSwitched:a}),(0,U.jsx)(j7,{engine:"codex",label:"Codex",limits:e?.data.codex??null,payloadAccountId:e?.data.codexAccountId??null,now:n,receivedAt:e?.at??n,provenance:e?.data.provenance.codex??{source:"unavailable",reason:null,staleSince:null},onSwitched:a}),(0,U.jsx)(j5,{})]})}var Ne=n(5298),Nt=n(4526);function Nn(){let{t:e}=(0,eh.Ym)(),t=ia(),[n,r]=(0,Y.useState)(!1),[i,a]=(0,Y.useState)(!1);(0,Y.useEffect)(()=>{let e="serviceWorker"in navigator&&"PushManager"in window&&window.isSecureContext;queueMicrotask(()=>a(e)),e&&navigator.serviceWorker.getRegistration("/question-push-sw.js").then(e=>e?.pushManager.getSubscription().then(e=>r(null!==e)))},[]);let s=async()=>{if(!i||"default"===Notification.permission&&"granted"!==await Notification.requestPermission()||"granted"!==Notification.permission)return;let e=await navigator.serviceWorker.register("/question-push-sw.js"),t=await e.pushManager.getSubscription();if(t){await t.unsubscribe(),r(!1);return}let n=await (await fetch("/api/push")).json(),a=await e.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:function(e){let t=atob((e+"=".repeat((4-e.length%4)%4)).replace(/-/g,"+").replace(/_/g,"/")),n=new Uint8Array(t.length);for(let e=0;e<t.length;e+=1)n[e]=t.charCodeAt(e);return n.buffer.slice(0)}(n.publicKey)});await fetch("/api/push",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(a)}),r(!0)};return(0,U.jsx)("button",{className:`inline-flex shrink-0 items-center justify-center rounded-full border border-border bg-card text-muted hover:text-primary disabled:opacity-45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${t?"h-11 w-11":"h-[26px] w-[26px]"}`,title:e(i?n?"push.enabled":"push.enable":"push.needsHttps"),"aria-label":e(i?n?"push.disable":"push.enable":"push.needsHttps"),"aria-pressed":n,disabled:!i,onClick:s,children:n?(0,U.jsx)(Ne.A,{className:"h-3.5 w-3.5","aria-hidden":!0}):(0,U.jsx)(Nt.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})}async function Nr(e,t,n={}){let r,i=n.fetch??fetch,a=n.copy??uK.copyText;try{r=await i(`/api/tmux?attach=1&target=${encodeURIComponent(e)}`,{headers:{accept:"application/json"},cache:"no-store"})}catch{return{ok:!1,reason:"network"}}let s={};try{s=await r.json()}catch{}let l=function(e,t,n){if(200===t){let t,r="string"==typeof(t="readonly"===e?n.attach?.readOnlyCommand:n.attach?.command)&&t.length>0?t:null;return r?{ok:!0,command:r}:{ok:!1,reason:"tmux-unavailable"}}return"stale-pane"===n.reason||"server-restarted"===n.reason||"tmux-unavailable"===n.reason?{ok:!1,reason:n.reason}:{ok:!1,reason:400===t?"bad-request":"tmux-unavailable"}}(t,r.status,s);return l.ok?await a(l.command)?l:{ok:!1,reason:"clipboard"}:l}function Ni({kind:e,label:t,hint:n,status:r,disabled:i,onCopy:a}){let s=r?.kind===e?r:null,l=s?.phase==="loading",o=s?.phase==="copied",c="readonly"===e?sx.kU:sx.BK;return(0,U.jsxs)("button",{type:"button",disabled:i,"aria-label":t,title:n,onClick:()=>a(e),className:["inline-flex min-h-[44px] items-center gap-1.5 rounded-[8px] border px-2.5 text-[11px] font-semibold sm:min-h-0 sm:py-1 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:cursor-wait disabled:opacity-50",o?"border-success/50 text-success":"border-border text-muted hover:bg-canvas hover:text-accent"].join(" "),children:[l?(0,U.jsx)(sx.kr,{className:"h-3.5 w-3.5 animate-spin motion-reduce:animate-none","aria-hidden":!0}):o?(0,U.jsx)(sx.Jl,{className:"h-3.5 w-3.5 text-success","aria-hidden":!0}):(0,U.jsx)(c,{className:"h-3.5 w-3.5","aria-hidden":!0}),(0,U.jsx)("span",{children:t})]})}function Na({status:e,onCopy:t,onRefresh:n}){var r;let{t:i}=(0,eh.Ym)(),a=e?.phase==="loading",s=e?.phase==="error"?e:null,l=e?.phase==="copied"?e:null,o=null!==s&&("stale-pane"===(r=s.reason)||"server-restarted"===r||"tmux-unavailable"===r);return(0,U.jsxs)("div",{className:"mt-1.5",children:[(0,U.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,U.jsx)(Ni,{kind:"attach",label:i("attach.attach"),hint:i("attach.hint"),status:e,disabled:a,onCopy:t}),(0,U.jsx)(Ni,{kind:"readonly",label:i("attach.readonly"),hint:i("attach.readonlyHint"),status:e,disabled:a,onCopy:t}),a?(0,U.jsx)("span",{role:"status",className:"text-[10.5px] text-muted",children:i("attach.loading")}):null,l?(0,U.jsx)("span",{role:"status",className:"text-[10.5px] font-semibold text-success",children:i("readonly"===l.kind?"attach.copiedReadonly":"attach.copied")}):null]}),s?(0,U.jsxs)("div",{role:"alert","aria-live":"assertive",className:"mt-1 flex flex-wrap items-center gap-2 text-[10.5px] text-danger",children:[(0,U.jsx)("span",{className:"min-w-0",children:i(function(e){switch(e){case"stale-pane":return"attach.stale";case"server-restarted":return"attach.restarted";case"tmux-unavailable":return"attach.unavailable";case"bad-request":return"attach.badRequest";case"network":return"attach.network";case"clipboard":return"attach.clipboard"}}(s.reason))}),o?(0,U.jsxs)("button",{type:"button",onClick:n,className:"inline-flex min-h-[44px] items-center gap-1 rounded-[8px] border border-danger/40 px-2 font-semibold text-danger hover:bg-danger/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-danger/40 sm:min-h-0 sm:py-0.5",children:[(0,U.jsx)(sx.kt,{className:"h-3 w-3","aria-hidden":!0}),i("attach.refresh")]}):null]}):null]})}function Ns({target:e,onRefresh:t}){let[n,r]=(0,Y.useState)(null),i=(0,Y.useRef)(!0),a=(0,Y.useRef)(null);return(0,Y.useEffect)(()=>(i.current=!0,()=>{i.current=!1,null!==a.current&&window.clearTimeout(a.current)}),[]),(0,U.jsx)(Na,{status:n,onCopy:t=>{n?.phase!=="loading"&&(null!==a.current&&window.clearTimeout(a.current),r({phase:"loading",kind:t}),Nr(e,t).then(e=>{i.current&&(e.ok?(r({phase:"copied",kind:t}),a.current=window.setTimeout(()=>{i.current&&r(null)},1400)):r({phase:"error",kind:t,reason:e.reason}))}))},onRefresh:()=>{r(null),t()}})}let Nl=[2,6,12];function No(e){return e>=0x280000000?Math.round(e/0x40000000)+" GiB":e>=0x40000000?(e/0x40000000).toFixed(1)+" GiB":Math.max(0,Math.round(e/1048576))+" MiB"}function Nc({label:e,usedPercent:t,color:n,note:r}){let i=Math.max(1.5,Math.min(100,t));return(0,U.jsxs)("div",{className:"mt-1.5 first:mt-0",children:[(0,U.jsxs)("div",{className:"flex items-baseline justify-between",children:[(0,U.jsx)("span",{className:"text-[11px] font-semibold text-primary",children:e}),(0,U.jsx)("span",{className:"text-[11px] tabular-nums text-muted",children:r})]}),(0,U.jsx)("div",{className:"mt-1 h-[4px] overflow-hidden rounded-full bg-sunken",children:(0,U.jsx)("div",{className:"h-full rounded-full transition-[width] duration-700 ease-out",style:{width:i+"%",backgroundColor:n}})})]})}function Nd(){let{t:e}=(0,eh.Ym)(),[t,n]=(0,Y.useState)(null),[r,i]=(0,Y.useState)(!1),a=(0,Y.useRef)(null),s=(0,Y.useRef)(async()=>{});(0,Y.useEffect)(()=>{var e,t,r;let i,a,l,o,c=!1,d=(e=fetch,t=(e,t)=>{(0,Y.startTransition)(()=>{c||n(n=>{let r;return r=null===e.system&&(n?.data.system??null)!==null,{data:{system:e.system??n?.data.system??null,sessions:e.sessions},at:t,staleSince:r?n?.staleSince??t:null}})})},r=e=>{(0,Y.startTransition)(()=>{c||n(t=>t?{...t,staleSince:t.staleSince??e}:t)})},i=null,a={async run(e,t){for(;;){let n=i;if(n){if(!e||n.fresh)return n.promise;try{await n.promise}catch{}i===n&&(i=null);continue}let r=Promise.resolve().then(()=>t(e)),a={fresh:e,promise:r};i=a;try{return await r}finally{i===a&&(i=null)}}}},l=new AbortController,o=!1,{load:(n=!1)=>o?Promise.resolve(!1):a.run(n,async n=>{if(o)return!1;let i=Date.now()/1e3;try{let r=await e("/api/resources"+(n?"?fresh=1":""),{signal:l.signal});if(!r.ok)throw Error(String(r.status));let a=await r.json();return o||t(a,i),!0}catch{return o||r(i),!1}}),dispose(){o=!0,l.abort()}}),u=async(e=!1)=>{await d.load(e)};s.current=u;let p=null,m=async()=>{await u(),c||(p=setTimeout(()=>void m(),3e4))};return p=setTimeout(()=>void m(),1500),()=>{c=!0,p&&clearTimeout(p),d.dispose(),s.current=async()=>{}}},[]),(0,Y.useEffect)(()=>{if(!r)return;let e=e=>{"Escape"===e.key&&i(!1)},t=e=>{a.current&&!a.current.contains(e.target)&&i(!1)};return window.addEventListener("keydown",e),window.addEventListener("pointerdown",t),()=>{window.removeEventListener("keydown",e),window.removeEventListener("pointerdown",t)}},[r]);let l=t?.data.system??null,o=t?.data.sessions??[];if(!t||!l&&0===o.length)return null;let c=l?100*(l.ramTotal-l.ramAvailable)/l.ramTotal:0,d=l?100*l.ramAvailable/l.ramTotal:100,u=l&&l.swapTotal>0?100*l.swapUsed/l.swapTotal:0;return(0,U.jsxs)("div",{ref:a,className:"relative shrink-0 border-t border-border",children:[(0,U.jsxs)("button",{type:"button","aria-expanded":r,"aria-label":e("resources.openAria"),onClick:()=>i(e=>!e),className:"block w-full px-3.5 pb-2.5 pt-2 text-left hover:bg-canvas focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:[t.staleSince?(0,U.jsx)("span",{className:"absolute right-2 top-2 h-1.5 w-1.5 rounded-full bg-warning",title:e("resources.stale",{stale:(0,tw.rK)(t.staleSince)})}):null,l?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Nc,{label:e("resources.ram"),usedPercent:c,color:d<10?"var(--color-danger)":d<30?"var(--color-warning)":"var(--color-muted)",note:e("resources.free",{amount:No(l.ramAvailable)})}),l.swapTotal>0?(0,U.jsx)(Nc,{label:e("resources.swap"),usedPercent:u,color:u>85?"var(--color-danger)":u>60?"var(--color-warning)":"var(--color-muted)",note:e("resources.used",{amount:No(l.swapUsed)})}):null,(0,U.jsx)("span",{className:"mt-1.5 block text-right text-[9.5px] tabular-nums text-muted",children:e("resources.captured",{age:(0,tw.rK)(Date.parse(l.capturedAt)/1e3)})})]}):(0,U.jsx)("span",{className:"text-[11px] font-semibold text-primary",children:e("resources.title")})]}),r?(0,U.jsx)(Np,{sessions:o,now:t.at,onRefresh:()=>s.current(!0),onClose:()=>i(!1)}):null]})}async function Nu(e){let t=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"kill-target",target:e.target})});return t.ok?null:(await t.json().catch(()=>({}))).error??String(t.status)}function Np({sessions:e,now:t,onRefresh:n,onClose:r}){let{t:i}=(0,eh.Ym)(),[a,s]=(0,Y.useState)(new Set),[l,o]=(0,Y.useState)(null),[c,d]=(0,Y.useState)(null),[u,p]=(0,Y.useState)(2),[m,f]=(0,Y.useState)(!1),[h,x]=(0,Y.useState)(!1),[g,b]=(0,Y.useState)(!1),v=(e,t)=>s(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r}),w=async e=>{d(null),x(!1),v(e.target,!0);try{let t=await Nu(e);t&&d(t),await n()}finally{v(e.target,!1),o(null)}},y=n=>{let r=(t-3600*n)*1e3;return e.filter(e=>"live"!==e.activity&&null!==e.lastActiveAt&&Date.parse(e.lastActiveAt)<r)},k=async()=>{let e=y(u);if(0!==e.length&&!m){d(null),x(!1),f(!0);try{for(let t of e){v(t.target,!0);let e=await Nu(t);e&&d(e)}await n()}finally{s(new Set),f(!1)}}},j=async()=>{if(0!==e.length&&!g){d(null),b(!0);try{for(let t of e){v(t.target,!0);let e=await Nu(t);e&&d(e)}await n()}finally{s(new Set),b(!1),x(!1)}}},N=e.reduce((e,t)=>e+t.rssBytes+t.swapBytes,0),S=y(u).length;return(0,U.jsxs)("div",{className:"fixed bottom-3 left-1/2 z-50 flex w-[min(430px,calc(100vw-16px))] -translate-x-1/2 flex-col rounded-[12px] border border-border bg-card shadow-2 sm:absolute sm:bottom-1 sm:left-full sm:ml-2 sm:translate-x-0",children:[(0,U.jsxs)("header",{className:"flex items-center gap-2 border-b border-border px-3 py-2",children:[(0,U.jsx)("span",{className:"text-[12.5px] font-bold",children:i("resources.title")}),e.length?(0,U.jsx)("span",{className:"text-[11px] tabular-nums text-muted",children:i("resources.total",{amount:No(N)})}):null,(0,U.jsx)("button",{type:"button","aria-label":i("resources.close"),onClick:r,className:"ml-auto inline-flex min-h-[44px] min-w-[44px] items-center justify-center rounded-[6px] p-1 text-muted hover:bg-canvas hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:min-h-0 sm:min-w-0",children:(0,U.jsx)(sx.X,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),(0,U.jsx)("div",{className:"max-h-[min(420px,60vh)] overflow-y-auto py-1",children:0===e.length?(0,U.jsx)("div",{className:"px-3 py-4 text-center text-[12px] text-muted",children:i("resources.empty")}):e.map(e=>(0,U.jsx)(Nm,{session:e,busy:a.has(e.target),armed:l===e.target,onArm:()=>o(e.target),onKill:()=>void w(e),onRefresh:n},e.target))}),(0,U.jsxs)("footer",{className:"flex items-center gap-2 border-t border-border px-3 py-2",children:[(0,U.jsx)("span",{className:"text-[11px] text-muted",children:i("resources.bulkLabel")}),(0,U.jsx)("select",{value:u,onChange:e=>p(Number(e.target.value)),className:"min-h-[44px] min-w-[44px] rounded-[8px] border border-border bg-canvas px-1.5 py-1 text-[11px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 sm:min-h-0 sm:min-w-0",children:Nl.map(e=>(0,U.jsx)("option",{value:e,children:i("resources.hoursN",{n:e})},e))}),(0,U.jsxs)("button",{type:"button",disabled:m||0===S,title:0===S?i("resources.bulkNone"):void 0,onClick:()=>void k(),className:"ml-auto inline-flex min-h-[44px] items-center rounded-[8px] border border-danger/40 px-2.5 py-1 text-[11px] font-semibold text-danger hover:bg-danger/10 disabled:cursor-not-allowed disabled:opacity-45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-danger/40 sm:min-h-0",children:[i("resources.bulkKill"),S?` (${S})`:""]})]}),(0,U.jsxs)("div",{className:"flex items-center gap-2 border-t border-border px-3 py-2",children:[(0,U.jsx)("span",{className:"text-[13px] leading-none text-danger","aria-hidden":!0,children:"⚠"}),(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate text-[10.5px] text-muted",title:i("resources.killAllHint"),children:i("resources.killAllHint")}),(0,U.jsx)("button",{type:"button",disabled:g||0===e.length,title:0===e.length?i("resources.killAllNone"):i("resources.killAllHint"),onClick:()=>h?void j():x(!0),className:["inline-flex min-h-[44px] shrink-0 items-center rounded-[8px] border px-2.5 py-1 text-[11px] font-semibold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-danger/40 disabled:cursor-not-allowed disabled:opacity-45 sm:min-h-0",h?"border-danger bg-danger text-white":"border-danger/40 text-danger hover:bg-danger/10"].join(" "),children:h?i("resources.killAllConfirm",{n:e.length}):i("resources.killAll")+(e.length?` (${e.length})`:"")})]}),c?(0,U.jsx)("div",{className:"border-t border-border px-3 py-1.5 text-[11px] font-semibold text-danger",children:c}):null]})}function Nm({session:e,busy:t,armed:n,onArm:r,onKill:i,onRefresh:a}){var s;let{t:l}=(0,eh.Ym)(),o=(0,tw.t7)(e.engine??""),c="live"===e.activity,d=!0===e.hostConflict,u=null!==e.lastActiveAt?Date.parse(e.lastActiveAt)/1e3:null,p=c&&!n;return(0,U.jsxs)("div",{className:"px-3 py-1.5 hover:bg-canvas",children:[(0,U.jsxs)("div",{className:"flex items-center gap-2",children:[(0,U.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${(0,tw.tz)(e.activity??"idle")}`}),(0,U.jsx)("span",{className:"shrink-0 rounded-full px-1.5 py-0.5 text-[10px] font-bold",style:{backgroundColor:o.soft,color:o.color},children:"codex"===e.engine?"Codex":"claude"===e.engine?"Claude":"?"}),(0,U.jsxs)("span",{className:"min-w-0 flex-1",title:[e.cwd,e.target,l("resources.procs",{count:e.procCount})].filter(Boolean).join(" \xb7 "),children:[(0,U.jsx)("span",{className:"block truncate text-[12px] font-semibold",children:d?l("resources.hostConflict"):e.title??(e.cwd?(s=e.cwd).split("/").filter(Boolean).slice(-2).join("/")||s:l("resources.orphan"))}),(0,U.jsxs)("span",{className:"block truncate text-[10.5px] text-muted",children:[d?l("resources.hostConflictHint")+" \xb7 ":null===e.title?l("resources.orphan")+" \xb7 ":e.project?e.project+" \xb7 ":"",null!==u?(0,tw.rK)(u):e.target]})]}),(0,U.jsxs)("span",{className:"shrink-0 text-right",children:[(0,U.jsx)("span",{className:"block text-[11.5px] font-bold tabular-nums",children:No(e.rssBytes)}),e.swapBytes>0?(0,U.jsx)("span",{className:"block text-[10px] tabular-nums text-muted",children:l("resources.swapShare",{amount:No(e.swapBytes)})}):null]}),(0,U.jsx)("button",{type:"button",disabled:t,"aria-disabled":p||t,title:l(c?"resources.killLiveHint":"resources.killHint"),onClick:()=>p?r():i(),className:["inline-flex min-h-[44px] min-w-[44px] shrink-0 items-center justify-center rounded-[8px] border px-2 py-1 text-[11px] font-semibold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-danger/40 sm:min-h-0 sm:min-w-0",t?"cursor-wait opacity-50":"",n?"border-danger bg-danger text-white":p?"border-border text-muted opacity-60 hover:opacity-90":"border-danger/40 text-danger hover:bg-danger/10"].join(" "),children:l(n?"resources.confirm":"resources.kill")})]}),(0,U.jsx)(Ns,{target:e.target,onRefresh:()=>void a()})]})}let Nf=new Set;function Nh({files:e,projectCatalog:t,projectDisplayNames:n={},pipelines:r,workflows:i,archivedProjects:a,crownedProjects:s=Nf,selected:l,loaded:o,catalogFailures:c=0,now:d,onSelect:u,onToggleCrown:p,onCreateProject:m}){let{t:f}=(0,eh.Ym)(),h=ia(),[x,g]=(0,Y.useState)(""),[b,v]=(0,Y.useState)(!1),[w,y]=(0,Y.useState)(!1),k=(0,Y.useMemo)(()=>eE(e,d,i,t,r,n),[e,d,i,t,r,n]),j=(0,Y.useMemo)(()=>k.filter(e=>{var t,n;let r;return t=e.project,n=e.displayName,!(r=x.trim().toLowerCase())||t.toLowerCase().includes(r)||eb(t,n).toLowerCase().includes(r)}),[k,x]),N=(0,Y.useMemo)(()=>j.filter(e=>!a.has(e.project)),[j,a]),S=(0,Y.useMemo)(()=>j.filter(e=>a.has(e.project)),[j,a]),{crowned:C,rest:A}=(0,Y.useMemo)(()=>(function(e,t){let n=[],r=[];for(let i of e)(t.has(i.project)?n:r).push(i);return{crowned:n,rest:r}})(N,s),[N,s]),I=(0,Y.useMemo)(()=>k.reduce((e,t)=>e+t.liveCount,0),[k]),M=(0,Y.useMemo)(()=>k.reduce((e,t)=>e+t.attentionCount,0),[k]),T=e=>{let t=s.has(e.project);return(0,U.jsxs)("div",{"data-flip-key":e.project,className:"group relative",children:[(0,U.jsx)(Nb,{label:e.displayName,live:e.liveCount,attention:e.attentionCount,total:e.conversations,age:(0,tw.rK)(e.smt),active:l===e.project,hasLive:e.liveCount>0,muted:e.catalogOnly,crowned:t,reserveCrownSlot:h,onClick:()=>u(e.project)}),p?(0,U.jsx)("button",{type:"button",className:["group/crown absolute right-1.5 top-1/2 flex h-6 w-6 -translate-y-1/2 items-center justify-center rounded-[7px] border border-border bg-card transition-opacity focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",h?"":"opacity-0 group-hover:opacity-100"].join(" "),title:t?f("rail.uncrown"):f("rail.crown"),"aria-label":t?f("rail.uncrown"):f("rail.crown"),"aria-pressed":t,onClick:()=>p(e.project,!t),children:(0,U.jsx)(sx.Oe,{className:`h-3.5 w-3.5 ${t?"fill-crown text-crown":"text-muted [stroke-dasharray:2_3] group-hover/crown:fill-crown group-hover/crown:text-crown group-hover/crown:[stroke-dasharray:0]"}`,"aria-hidden":!0})}):null]},e.project)};return(0,U.jsxs)("aside",{className:"flex w-[248px] shrink-0 flex-col border-r border-border bg-card",children:[(0,U.jsx)("header",{className:`flex shrink-0 items-center gap-2 border-b border-border text-[13.5px] font-bold ${h?"min-h-[52px] gap-1.5 px-2 py-1.5":"h-10 px-4"}`,children:h?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden",children:[(0,U.jsx)("span",{className:"min-w-0 truncate",children:f("rail.title")}),I?(0,U.jsx)("span",{className:"shrink-0 text-[11px] font-semibold tabular-nums text-muted",children:I>99?"99+":I}):null,M?(0,U.jsxs)(sv,{tone:"warning",children:["⏸",M>99?"99+":M]}):null]}),(0,U.jsxs)("div",{className:"flex shrink-0 items-center gap-1",children:[(0,U.jsx)(jA,{}),(0,U.jsx)(jC,{}),(0,U.jsx)(Nn,{})]})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("span",{children:f("rail.title")}),I?(0,U.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1 text-[11px] font-semibold tabular-nums text-muted",children:[(0,U.jsx)("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-success"}),I]}):null,M?(0,U.jsxs)(sv,{tone:"warning",children:["⏸ ",M]}):null,(0,U.jsx)(jA,{}),(0,U.jsx)(jC,{}),(0,U.jsx)(Nn,{})]})}),(0,U.jsxs)("div",{className:"flex gap-1.5 px-2.5 pb-1 pt-2.5",children:[(0,U.jsx)("input",{className:`w-full min-w-0 flex-1 rounded-[9px] border border-border bg-canvas px-2.5 text-[12px] outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${h?"min-h-11":"py-1.5"}`,placeholder:f("rail.filter"),value:x,onChange:e=>g(e.target.value)}),m?(0,U.jsx)("button",{type:"button",className:`flex shrink-0 items-center justify-center rounded-[9px] border border-border bg-canvas text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${h?"min-h-11 min-w-11":"w-7"} ${w?"text-primary":""}`,title:f("rail.createProject"),"aria-label":f("rail.createProject"),"aria-expanded":w,onClick:()=>y(e=>!e),children:(0,U.jsx)(sx.JU,{className:"h-3.5 w-3.5","aria-hidden":!0})}):null]}),w&&m?(0,U.jsx)(Ng,{onCreate:m,onCreated:e=>{y(!1),u(e)},onCancel:()=>y(!1)}):null,(0,U.jsxs)("nav",{className:"flex-1 overflow-y-auto px-2 pb-3 pt-1","aria-label":f("rail.projects"),children:[(0,U.jsx)(Nb,{label:f("rail.overview"),live:0,attention:0,total:null,age:"",active:l===ew,hasLive:!1,onClick:()=>u(ew)}),(0,U.jsx)("div",{className:"mx-2.5 my-1.5 border-t border-border"}),(0,U.jsxs)(gO,{children:[C.map(T),C.length&&A.length?(0,U.jsx)("div",{"data-flip-key":"__crown-divider__",className:"mx-2.5 my-1.5 border-t border-border"}):null,A.map(T)]}),S.length?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("div",{className:"mx-2.5 my-1.5 border-t border-border"}),(0,U.jsxs)("button",{type:"button",className:`mb-0.5 flex w-full items-center gap-1.5 rounded-[10px] px-2.5 text-left text-[11.5px] font-bold text-muted hover:bg-canvas focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${h?"min-h-11":"py-1.5"}`,"aria-expanded":b,onClick:()=>v(e=>!e),children:[(0,U.jsx)(sx.c_,{className:`h-3 w-3 shrink-0 transition-transform ${b?"rotate-90":""}`,"aria-hidden":!0}),(0,U.jsx)(sx.Td,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),f("rail.archive"),(0,U.jsx)("span",{className:"font-semibold",children:S.length})]}),b?S.map(e=>(0,U.jsx)(Nb,{label:e.displayName,live:e.liveCount,attention:e.attentionCount,total:e.conversations,age:(0,tw.rK)(e.smt),active:l===e.project,hasLive:e.liveCount>0,muted:e.catalogOnly,crowned:s.has(e.project),onClick:()=>u(e.project)},e.project)):null]}):null,N.length||S.length?null:c>0?(0,U.jsx)(hj,{failures:c,size:"inline"}):o?(0,U.jsx)("div",{className:"px-3 py-4 text-center text-[12px] text-muted",children:f("common.nothingFound")}):(0,U.jsxs)("div",{className:"flex items-center justify-center gap-2 px-3 py-4 text-[12px] text-muted",children:[(0,U.jsx)(sx.kr,{className:"h-4 w-4 animate-spin","aria-hidden":!0}),f("common.loading")]})]}),(0,U.jsx)(Nd,{}),(0,U.jsx)(j9,{})]})}let Nx={INVALID_NAME:"rail.invalidName",INVALID_ROOT:"rail.invalidRoot",INVALID_REQUEST:"rail.invalidRoot",DUPLICATE_PROJECT:"rail.duplicateProject"};function Ng({onCreate:e,onCreated:t,onCancel:n}){let{t:r}=(0,eh.Ym)(),i=ia(),[a,s]=(0,Y.useState)(""),[l,o]=(0,Y.useState)(""),[c,d]=(0,Y.useState)(null),[u,p]=(0,Y.useState)(!1),[m,f]=(0,Y.useState)(!1),h=`w-full rounded-[9px] border border-border bg-canvas px-2.5 text-[12px] outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${i?"min-h-11":"py-1.5"}`,x=async(n=!1)=>{if(m)return;if(!a.trim())return void d(r("rail.invalidName"));if(!l.trim())return void d(r("rail.invalidRoot"));f(!0),d(null),p(!1);let i=await e(a.trim(),l.trim(),n?{createRoot:!0}:void 0);if(f(!1),i.ok)return void t(i.project);if("MISSING_DIRECTORY"===i.code){p(!0),d(r("rail.missingRoot"));return}"MKDIR_FAILED"===i.code?d(i.message?`${r("rail.mkdirFailed")} — ${i.message}`:r("rail.mkdirFailed")):d(r(Nx[i.code]??"rail.createFailed"))};return(0,U.jsxs)("form",{className:"mx-2.5 mb-1 flex flex-col gap-1.5 rounded-[10px] border border-border bg-canvas/60 p-2",onSubmit:e=>{e.preventDefault(),x()},children:[(0,U.jsx)("input",{className:h,placeholder:r("rail.newProjectName"),value:a,maxLength:80,autoFocus:!0,onChange:e=>s(e.target.value)}),(0,U.jsx)("input",{className:h,placeholder:r("rail.newProjectRoot"),value:l,spellCheck:!1,onChange:e=>{o(e.target.value),p(!1)}}),c?(0,U.jsx)("div",{className:`px-0.5 text-[11px] font-semibold ${u?"text-warning":"text-danger"}`,children:c}):null,u?(0,U.jsx)("button",{type:"button",disabled:m,className:`w-full rounded-[9px] border border-border bg-card text-[12px] font-semibold hover:bg-canvas focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60 ${i?"min-h-11":"py-1.5"}`,onClick:()=>void x(!0),children:r("rail.createRootAndProject")}):null,(0,U.jsxs)("div",{className:"flex gap-1.5",children:[(0,U.jsx)("button",{type:"submit",disabled:m,className:`flex-1 rounded-[9px] border border-border bg-card text-[12px] font-semibold hover:bg-canvas focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60 ${i?"min-h-11":"py-1.5"}`,children:m?r("rail.creating"):r("rail.create")}),(0,U.jsx)("button",{type:"button",className:`rounded-[9px] px-2.5 text-[12px] font-semibold text-muted hover:bg-canvas focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${i?"min-h-11":"py-1.5"}`,onClick:n,children:r("common.cancel")})]})]})}function Nb({label:e,live:t,attention:n,total:r,age:i,active:a,hasLive:s,muted:l=!1,crowned:o=!1,reserveCrownSlot:c=!1,onClick:d}){let u=ia();return(0,U.jsxs)("button",{className:["mb-0.5 flex w-full items-center gap-2 rounded-[10px] border px-2.5 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",u?"min-h-11":"py-2",c?"pr-9":"",a?"border-border bg-canvas shadow-1":"border-transparent hover:bg-canvas",l?"opacity-65":""].join(" "),"aria-current":a?"page":void 0,onClick:d,children:[(0,U.jsx)("span",{className:["h-2 w-2 shrink-0 rounded-full",s?"animate-pulse bg-success":"bg-strong"].join(" ")}),(0,U.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,U.jsxs)("span",{className:"flex items-center gap-1",children:[o?(0,U.jsx)(sx.Oe,{className:"h-3 w-3 shrink-0 fill-crown text-crown","aria-hidden":!0,"data-testid":"crown-marker"}):null,(0,U.jsx)("span",{className:`min-w-0 truncate text-[13px] ${a?"font-bold":"font-semibold"} ${l?"text-muted":""}`,children:e})]}),i?(0,U.jsx)("span",{className:"block text-[10.5px] text-muted",children:i}):null]}),t>0?(0,U.jsx)("span",{className:"shrink-0 text-[11px] font-semibold tabular-nums text-muted",children:t}):null,n>0?(0,U.jsxs)(sv,{tone:"warning",children:["⏸ ",n]}):null,null!==r?(0,U.jsx)("span",{className:"shrink-0 text-[11px] font-semibold text-muted",children:r}):null]})}var Nv=n(1463);function Nw(){let{enabled:e,store:t}=s0(),n=!ia()&&(void 0!==Nv?Nv.env?.NEXT_PUBLIC_LLV_SHOW_DEPLOY_PILL:void 0)==="1",[r,i]=(0,Y.useState)([]);(0,Y.useEffect)(()=>{if(e||!n)return;let t=!0,r=async()=>{try{let e=await fetch("/api/runtime/snapshot",{headers:{accept:"application/json"}});if(!e.ok)return;let n=await e.json();t&&i(n.deployments)}catch{}};r();let a=window.setInterval(()=>void r(),3e3);return()=>{t=!1,window.clearInterval(a)}},[e,n]);let a=[...e?Object.values(t.deployments):r].sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt))[0];if(!n||!a)return null;let s=a.phase.replaceAll("-"," "),l="succeeded"===a.phase?"border-success/45 text-success":"failed"===a.phase||"rolled-back"===a.phase?"border-danger/45 text-danger":"border-accent/45 text-accent";return(0,U.jsxs)("div",{className:`pointer-events-none fixed bottom-[max(0.75rem,env(safe-area-inset-bottom))] left-1/2 z-40 max-w-[calc(100vw-1.5rem)] -translate-x-1/2 truncate rounded-full border bg-raised px-3 py-1 text-[11px] font-semibold shadow-2 backdrop-blur ${l}`,role:"status",title:a.error??`Revision ${a.revision.slice(0,12)}`,children:["Viewer deploy \xb7 ",s," \xb7 ",a.revision.slice(0,7)]})}function Ny(){let{t:e}=(0,eh.Ym)(),[t,n]=(0,Y.useState)(null);return((0,Y.useEffect)(()=>{let e=!1;return fetch("/api/staging").then(async e=>e.ok?e.json():null).then(t=>{!e&&t&&n(t)}).catch(()=>{}),()=>{e=!0}},[]),t?.staging)?(0,U.jsx)("div",{className:"pointer-events-none fixed left-1/2 top-1.5 z-40 -translate-x-1/2",children:(0,U.jsxs)(sv,{tone:"warning","data-staging-badge":!0,title:e("staging.badgeTitle"),className:"shadow-1 backdrop-blur",children:[(0,U.jsx)("span",{className:"h-2 w-2 rounded-full bg-warning","aria-hidden":!0}),(0,U.jsx)("span",{children:e("staging.badge")}),t.revision?(0,U.jsxs)("span",{className:"font-normal text-muted",children:["\xb7 ",t.revision.slice(0,7)]}):null]})}):null}let Nk="llvProject";function Nj(){return G(location.hash)}function NN(e){return""===e||/^#(?:c|f|p|a)=./.test(e)}function NS(e,t){if("open"===t.kind)return{path:t.path,hydrated:!1,conversationId:t.conversationId??null};if("resolve"===t.kind)return{path:t.path,hydrated:!0,conversationId:t.conversationId??null};if("release"===t.kind)return t.path&&e?.path!==t.path?e:null;if(!e)return e;let n=t.currentPath&&t.currentPath!==e.path?{...e,path:t.currentPath}:e;return!n.hydrated||t.pending||t.paths.has(n.path)?n:null}function NC(e){return e!==ew?"#p="+encodeURIComponent(e):location.pathname}function NA(){var e;let t,n,{t:r}=(0,eh.Ym)();!function(){try{window.sessionStorage.removeItem(i9),window.localStorage.removeItem(i9)}catch{}let e=window.location.hash.startsWith("#")?window.location.hash.slice(1):window.location.hash;if(!e.includes(i7))return;let t=new URLSearchParams(e);if(!t.has(i7))return;t.delete(i7);let n=t.toString();window.history.replaceState(null,"",`${window.location.pathname}${window.location.search}${n?`#${n}`:""}`)}(),(0,Y.useEffect)(()=>{var e,t;let n,r,i=null;try{i=window.localStorage}catch{i=null}let a="function"==typeof window.matchMedia&&window.matchMedia("(pointer: coarse)").matches,s={viewSessionId:ih(),deviceId:ix(i),device:{kind:(e=navigator.userAgent,t=window.innerWidth||1,(n=e.toLowerCase()).includes("ipad")||n.includes("tablet")&&!n.includes("mobi")||a&&t>=768&&t<=1280?"tablet":n.includes("mobi")||n.includes("iphone")||n.includes("android")||a&&t<768?"mobile":"desktop"),browser:(r=navigator.userAgent.toLowerCase()).includes("firefox")||r.includes("fxios")?"firefox":r.includes("edg/")||r.includes("opr/")?"other":r.includes("crios")||r.includes("chrome")||r.includes("chromium")?"chrome":r.includes("safari")?"safari":"other"}},l=function(e){let{identity:t,fetcher:n,scheduler:r,beacon:i,endpoint:a="/api/view/presence"}=e,s=0,l=0,o=!1,c=iu(is,il,{width:1,height:1,dpr:1}),d="visible",u=!1,p=!1,m=!1,f=-1/0,h=null,x=null,g=0,b=0,v=()=>{g=0===g?1e3:Math.min(2*g,3e4),b=r.now()+g,p=!0},w=()=>{g=0,b=0},y=e=>{if(!u)return;let t=r.now(),n=Math.max(500*!e,500-(t-f),b-t,0);null!==h&&r.clearTimer(h),h=r.setTimer(()=>{h=null,j()},n)},k=e=>{p=!0,y(e)},j=async()=>{if(!p||m)return;p=!1;let e=++s;o&&(l+=1,o=!1);let i=ig(c,t,e,l,d);m=!0,f=r.now();try{let e=await n(a,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(i)});await ib(e),e.ok||e.status>=400&&e.status<500?w():v()}catch{v()}finally{m=!1,p&&y(!1)}},N=()=>{null!==x&&r.clearTimer(x),x=r.setTimer(()=>{k(!0),N()},1e4)};return{setView(e){JSON.stringify(e)!==JSON.stringify(c)&&(c=e,k(!1))},setVisibility(e){e!==d&&(d=e,k(!0))},markInteraction(){o=!0,k(!1)},poke(){k(!0)},start(){u||(u=!0,N(),k(!0))},stop(){u=!1,null!==h&&r.clearTimer(h),null!==x&&r.clearTimer(x),h=null,x=null,p=!1,w()},sendBeacon(){if(!i)return;let e=ig(c,t,++s,l,"hidden");try{i(a,JSON.stringify(e))}catch{}}}}({identity:s,fetcher:(e,t)=>fetch(e,t),beacon:"u">typeof navigator&&"function"==typeof navigator.sendBeacon?(e,t)=>navigator.sendBeacon(e,new Blob([t],{type:"application/json"})):void 0,scheduler:{now:()=>Date.now(),setTimer:(e,t)=>setTimeout(e,t),clearTimer:e=>clearTimeout(e)}});ip.reportIdentity({viewSessionId:s.viewSessionId,deviceId:s.deviceId});let o=()=>l.setView(iu(ip.getContext(),ip.getSlice(),{width:window.innerWidth||1,height:window.innerHeight||1,dpr:window.devicePixelRatio||1})),c=ip.subscribe(o),d=()=>l.markInteraction();for(let e of iv)window.addEventListener(e,d,{passive:!0});let u=()=>l.setVisibility("hidden"===document.visibilityState?"hidden":"visible");document.addEventListener("visibilitychange",u);let p=()=>l.poke();window.addEventListener("online",p);let m=()=>o();window.addEventListener("resize",m);let f=()=>l.sendBeacon();return window.addEventListener("pagehide",f),l.setVisibility("hidden"===document.visibilityState?"hidden":"visible"),o(),l.start(),()=>{for(let e of(ip.reportIdentity(null),c(),iv))window.removeEventListener(e,d);document.removeEventListener("visibilitychange",u),window.removeEventListener("online",p),window.removeEventListener("resize",m),window.removeEventListener("pagehide",f),l.stop()}},[]);let[i,a]=(0,Y.useState)(ew),[s,l]=(0,Y.useState)(null),[o,c]=(0,Y.useReducer)(NS,null),{files:d,requestScope:u,projectCatalog:p,projectAliases:m,projectDisplayNames:f,crownedProjects:h,projectCwds:x,flows:g,pipelines:b,pipelinesError:v,workflows:w,tasks:y,conversationAliases:k,launchRoutes:j,loaded:N,catalogFailures:S}=function(e){let[t,n]=(0,Y.useState)(()=>rv.readScope(e)),r=rh(void 0,e);return(0,Y.useEffect)(()=>{let t=!0,r=rv.subscribe((e,r)=>{if("urgent"===r){t&&n(e);return}t&&(0,Y.startTransition)(()=>{t&&n(e)})},e),i=async n=>{if(!t)return!0;try{return await rv.revalidate(e,n),!0}catch{return!1}},a=Promise.resolve(),s=e=>{let t=a.then(()=>i(e));return a=t.then(()=>void 0),t},l=null,o=0,c=async()=>{let e=await s();if(!t)return;if(e){o=0;return}let n=Math.min(3e4,1e3*2**Math.min(o,5));o+=1,l=setTimeout(()=>{l=null,c()},n)};c();let d=null,u=null,p=e=>{e!==u&&(u=e,d&&clearInterval(d),d="poll"===e?setInterval(s,1e4):null)},m=()=>{if(l){clearTimeout(l),l=null,o=0,c();return}s()};window.addEventListener(eZ,m),window.addEventListener(ng,m),window.addEventListener(nD,m),window.addEventListener(ny,m),window.addEventListener(nv,m),window.addEventListener(n_,m);let f=()=>{},h=()=>{},x=null,g=null,b=!1,v=e=>{x&&clearTimeout(x),x=setTimeout(()=>{x=null,w()},e)},w=async()=>{if(b||null===g)return;b=!0;let e=g,n=await s(e);b=!1,t&&(n&&g===e&&(g=null),null!==g&&v(1e3*!n))};if(rd()&&1){let e=rp(),t=()=>p("live"===e.getState().connection?"live":"poll");t(),f=e.subscribe(t),h=e.subscribeFilesRevision(e=>{g=null===g?e:Math.max(g,e),v(400)})}else p("poll");return()=>{t=!1,d&&clearInterval(d),l&&clearTimeout(l),x&&clearTimeout(x),r(),f(),h(),window.removeEventListener(eZ,m),window.removeEventListener(ng,m),window.removeEventListener(nD,m),window.removeEventListener(ny,m),window.removeEventListener(nv,m),window.removeEventListener(n_,m)}},[e]),t.requestScope===r?t:rv.readScope(e)}((e=o?.path??null,s?.filePath??s?.conversationId??e)),{crownedProjects:C,toggleCrown:A,createProject:I,createdCatalog:M}=function(e,t){let[n,r]=(0,Y.useState)(new Map),[i,a]=(0,Y.useState)([]);(0,Y.useEffect)(()=>{r(t=>{if(!t.size)return t;let n=new Map(t);for(let[r,i]of t)e.includes(r)===i&&n.delete(r);return n.size===t.size?t:n})},[e]),(0,Y.useEffect)(()=>{a(e=>{if(!e.length)return e;let n=new Set(t.map(e=>e.project)),r=e.filter(e=>!n.has(e.project));return r.length===e.length?e:r})},[t]);let s=(0,Y.useMemo)(()=>{let t=new Set(e);for(let[e,r]of n)r?t.add(e):t.delete(e);return t},[e,n]);return{crownedProjects:s,toggleCrown:(0,Y.useCallback)((e,t)=>{r(n=>new Map(n).set(e,t)),fetch("/api/projects/crown",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({project:e,crowned:t})}).then(t=>{t.ok||r(t=>{let n=new Map(t);return n.delete(e),n})}).catch(()=>{r(t=>{let n=new Map(t);return n.delete(e),n})})},[]),createProject:(0,Y.useCallback)(async(e,t,n)=>{let r;try{r=await fetch("/api/projects/create",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(n?.createRoot?{name:e,root:t,createRoot:!0}:{name:e,root:t})})}catch{return{ok:!1,code:"NETWORK"}}let i=null;try{i=await r.json()}catch{}let s=i&&"object"==typeof i?i:null;if(!r.ok||"string"!=typeof s?.project)return{ok:!1,code:"string"==typeof s?.error?s.error:"ERROR",message:"string"==typeof s?.message?s.message:void 0};let l={project:s.project,displayName:"string"==typeof s.displayName?s.displayName:s.project,projectRoot:"string"==typeof s.root?s.root:void 0,smt:"number"==typeof s.createdAt?s.createdAt:Math.floor(Date.now()/1e3),conversations:0};return a(e=>[...e.filter(e=>e.project!==l.project),l]),{ok:!0,project:l.project}},[]),createdCatalog:i}}(h,p),T=(0,Y.useMemo)(()=>M.length?[...p,...M]:p,[p,M]),P=(0,Y.useMemo)(()=>{if(!M.length)return f;let e={...f};for(let t of M)t.displayName&&(e[t.project]=t.displayName);return e},[f,M]),$=(0,Y.useMemo)(()=>{let e=en(d),t=o?.path;if(!t||e.some(e=>e.path===t))return e;let n=d.find(e=>e.path===t);return n&&V(n)?n.conversationId&&e.some(e=>e.conversationId===n.conversationId)?e:[...e,n]:e},[d,o]),E=(0,Y.useRef)(null),R=(0,Y.useMemo)(()=>{if(i===ew)return[];let e=$.filter(e=>eM(e)===i),t=E.current,n=t?.project===i&&t.files.length===e.length&&e.every((e,n)=>e===t.files[n])?t.files:e;return E.current={project:i,files:n},n},[$,i]);(0,Y.useEffect)(()=>{for(let e of(rN={loaded:!0,ids:new Set(d.flatMap(e=>e.conversationId?[e.conversationId]:[]))},rS))e(rN)},[d]);let O=(t=(0,Y.useSyncExternalStore)(e5,()=>e1,()=>e4),(0,Y.useMemo)(()=>g.some(e=>t.has(e.id)&&"closed"!==e.state)?g.map(e=>t.has(e.id)&&"closed"!==e.state?{...e,state:"closed",closedAt:e.closedAt??new Date().toISOString()}:e):g,[g,t]));n=(0,Y.useRef)(null),(0,Y.useEffect)(()=>{let e,t,n;return e=()=>{let e=tT();e&&"running"!==e.state&&e.resume().catch(()=>void 0)},window.addEventListener("pointerdown",e,{passive:!0}),window.addEventListener("keydown",e),t=()=>{window.removeEventListener("pointerdown",e),window.removeEventListener("keydown",e)},n=()=>{t3.warm(Object.keys(tR).flatMap(e=>{let t;return t=tR[e],(t.variants?.length?t.variants:[t.file]).map(e=>`${tE}/${e}`)})),t9=0,nl()},window.addEventListener("pointerdown",n,{passive:!0}),window.addEventListener("keydown",n),()=>{t(),window.removeEventListener("pointerdown",n),window.removeEventListener("keydown",n)}},[]),(0,Y.useEffect)(()=>{var e;if(!$.length||!u)return;let t=(e=n.current,{...function(e,t,n,r={}){let i=new Map;for(let t of e){if(eI(t)||V(t))continue;let e=W(t);if(i.size>=4096&&!i.has(e))continue;let n=tC(t),r=t.pendingQuestion||t.waitingInput?"question":np[n];i.set(e,{state:n,kind:r,parent:t.parent})}let a=new Set(n),s=[];if(!t){for(let[e,t]of i)t.parent&&a.add(e);return{tracked:i,linked:a,chimes:s}}for(let[e,n]of i){let i=t.get(e),l=!0===r.suppressUnseen&&void 0===i,o=void 0!==n.kind&&(i?.state==="live"||void 0===i);void 0!==n.kind&&o&&!l&&s.push({kind:n.kind,id:e}),n.parent&&!a.has(e)&&(a.add(e),o||l||s.push({kind:"spawned",id:e}))}let l=new Map(t);for(let[e,t]of i)l.delete(e),l.set(e,t);if(l.size>4096){for(let e of l.keys()){if(l.size<=4096)break;i.has(e)||l.delete(e)}for(let e of a)l.has(e)||a.delete(e)}return{tracked:l,linked:a,chimes:s}}($,e?.tracked??null,e?.linked??new Set,{suppressUnseen:null!==e&&e.scope!==u}),scope:u});if(n.current=t,!t.chimes.length)return;let r=new Map($.map(e=>[W(e),e.mtime]));t.chimes.forEach((e,t)=>{let n=tF[e.kind];ns({cue:n,eventId:`lifecycle:${n}:${e.id}:${r.get(e.id)??0}`,pan:tI(e.id),delayMs:220*t})})},[$,u]);let{archivedProjects:D,archiveProject:L,unarchiveProject:_}=function(e,t={}){let[n,r]=(0,Y.useState)(()=>new Set),i=(0,Y.useRef)(n);return(0,Y.useEffect)(()=>{let e=function(){try{let e=window.localStorage.getItem(nf),t=e?JSON.parse(e):[];return new Set(Array.isArray(t)?t.filter(e=>"string"==typeof e):[])}catch{return new Set}}();i.current=e,r(e)},[]),(0,Y.useEffect)(()=>{let e=i.current;if(!e.size)return;let n=new Set([...e].map(e=>nm(e,t)));n.size===e.size&&[...n].every(t=>e.has(t))||(i.current=n,r(n),nh(n))},[t]),(0,Y.useEffect)(()=>{let t=i.current;if(!t.size)return;let n=new Set(t);for(let t of e)("live"===t.activity||"running"===t.proc)&&n.delete(eM(t));n.size!==t.size&&(i.current=n,r(n),nh(n))},[e]),{archivedProjects:n,archiveProject:(0,Y.useCallback)(e=>{r(t=>{if(t.has(e))return t;let n=new Set(t);return n.add(e),i.current=n,nh(n),n})},[]),unarchiveProject:(0,Y.useCallback)(e=>{r(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),i.current=n,nh(n),n})},[])}}($,m),F=(0,Y.useMemo)(()=>new Set(T.map(e=>e.project)),[T]),q=(0,Y.useMemo)(()=>new Map(T.map(e=>[e.project,e.conversations])),[T]),z=ia(),[H,J]=(0,Y.useState)(!1),[X,et]=(0,Y.useState)(!1),[ei,ea]=(0,Y.useState)(ew);ei!==i&&(ea(i),et((hg(hx(i))??hg(hh))==="1"));let[eo,eu]=(0,Y.useState)(!1),ep=(0,Y.useCallback)(()=>eu(!0),[]),em=(0,Y.useCallback)(()=>eu(!1),[]),[ex,eg]=(0,Y.useState)(null),ev=(0,Y.useRef)(null),[ey,ek]=(0,Y.useState)(0),[ej,eN]=(0,Y.useState)(null),[eS,eC]=(0,Y.useState)(null),[eT,eP]=(0,Y.useState)(!1),[e$,eE]=(0,Y.useState)(!1),eR=(0,Y.useRef)([]),eO=(0,Y.useRef)(null),eD=(0,Y.useRef)(null),eL=(0,Y.useRef)(function(e=e=>{setTimeout(e,0)}){let t=null;return{arm(n){t=n,e(()=>{t===n&&(t=null)})},swallows:e=>null!==t&&t===e}}());(0,Y.useEffect)(()=>{eR.current=$},[$]),(0,Y.useEffect)(()=>{eO.current=s},[s]),(0,Y.useEffect)(()=>{let e=Nj();(e.filePath||e.conversationId)&&l(e);let t=e.project??localStorage.getItem(Nk);t&&a(t),NN(location.hash)||eE(!0)},[]),(0,Y.useEffect)(()=>{let e=nm(i,m);e!==i&&(a(e),localStorage.setItem(Nk,e),function(e,t){let n=el();if(n){let t={...n,project:e};window.history.replaceState({[er]:t},"",window.location.hash||window.location.pathname);return}window.history.replaceState(null,"",t)}(e,NC(e)))},[i,m]),(0,Y.useEffect)(()=>{let e=()=>{if(eL.current.swallows(location.hash))return;eP(!1);let e=Nj();e.filePath||e.conversationId?(c({kind:"release"}),eN(null),l(e)):(l(null),c({kind:"release"}),eN(null),e.project?a(e.project):location.hash||a(ew)),NN(location.hash)||eE(!0)};return window.addEventListener("hashchange",e),()=>window.removeEventListener("hashchange",e)},[]),(0,Y.useEffect)(()=>{let e=e=>{let t=es(e.state);if(!t)return;eL.current.arm(location.hash),eP(!1),c({kind:"release"}),eN(null),a(t.project),localStorage.setItem(Nk,t.project);let n=t.conversationId?{conversationId:t.conversationId,filePath:null,project:t.project}:{conversationId:null,filePath:t.path,project:t.project};l(n),null!==eD.current&&window.clearTimeout(eD.current),eD.current=window.setTimeout(()=>{eD.current=null;let e=eO.current;e&&(e.conversationId??e.filePath)===(n.conversationId??n.filePath)&&(l(null),c({kind:"release"}),eP(!0))},8e3)};return window.addEventListener("popstate",e),()=>{window.removeEventListener("popstate",e),null!==eD.current&&window.clearTimeout(eD.current)}},[]),(0,Y.useEffect)(()=>{if(!e$)return;let e=window.setTimeout(()=>eE(!1),6e3);return()=>window.clearTimeout(e)},[e$]);let e_=(0,Y.useCallback)(e=>{a(e),eP(!1),l(null),c({kind:"release"}),eN(null),localStorage.setItem(Nk,e),J(!1)},[]),eF=(0,Y.useCallback)(e=>{e_(e),ed(NC(e))},[e_]),eq=(0,Y.useCallback)(()=>{et(e=>{let t=!e;try{window.localStorage.setItem(hx(i),t?"1":"0")}catch{}return t})},[i]);(0,Y.useEffect)(()=>{i===ew&&(ip.reportContext(is),ip.reportSlice(il))},[i]),(0,Y.useEffect)(()=>{if(!H)return;let e=e=>{"Escape"===e.key&&J(!1)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[H]),(0,Y.useEffect)(()=>{if(z)return ef(()=>J(!0))},[z]);let eB=(0,Y.useCallback)(e=>{let t=eM(e);r5(t,e.path,eA(e)),e_(t),ec(e,t),ek(e=>e+1)},[e_]),eK=(0,Y.useCallback)((e,t=!1)=>{let n=eM(e);eP(!1),r5(n,e.path,eA(e)),c({kind:t?"resolve":"open",path:e.path,conversationId:e.conversationId}),a(n),localStorage.setItem(Nk,n),J(!1),ek(e=>e+1),eN(t=>({path:e.path,nonce:(t?.nonce??0)+1,catalog:!0})),ec(e,n,{restore:t})},[]),eY=(0,Y.useCallback)(e=>{eK(e),l(G(Q(e)))},[eK]),eW=(0,Y.useCallback)(e=>{let t="#f="+encodeURIComponent(e);if(location.hash!==t){location.hash=t;return}eP(!1),c({kind:"release"}),eN(null),l(G(t))},[]);(0,Y.useEffect)(()=>{if(!s||0===d.length)return;let e=function(e,t,n={},r={}){let i=t.conversationId??t.filePath;if(i&&i.startsWith("spawn:")){let t=r[i];if(t){let r=Z(e,ee(t,n));if(r)return r}let a=e.find(e=>e.path===i)??null;return a?.conversationId?Z(e,ee(a.conversationId,n))??a:a}if(t.conversationId)return Z(e,ee(t.conversationId,n));if(t.filePath){let n=e.find(e=>e.path===t.filePath)??null;return n&&V(n)&&n.conversationId?Z(e,n.conversationId)??n:n}return null}(d,s,k,j);e&&(eK(e,!0),l(null))},[s,d,k,j,eK]),(0,Y.useEffect)(()=>{if(!s||!N)return;let e=window.setTimeout(()=>{l(null),c({kind:"release"}),eP(!0)},8e3);return()=>window.clearTimeout(e)},[s,N]);let eV=(0,Y.useCallback)(e=>{c({kind:"release",path:e}),eN(t=>t?.path===e?null:t),o?.path===e&&ed(NC(i))},[o,i]);(0,Y.useEffect)(()=>{if(!o?.hydrated||s||!N)return;let e=o.conversationId?$.find(e=>e.conversationId===o.conversationId)?.path:void 0;c({kind:"files",paths:new Set(d.map(e=>e.path)),pending:!1,currentPath:e})},[o,s,d,$,N]);let[eJ,eG]=(0,Y.useState)(()=>Date.now()/1e3),eQ=(0,Y.useMemo)(()=>(function(e,t=Date.now()/1e3){let n=[];for(let r of e){let e=eH(r,t);if(null===e)continue;let i=r.pendingQuestion||r.rateLimit||r.waitingInput?"blocked":"stalled",a=r.pendingQuestion?function(e){let t=Date.parse(e);return Number.isFinite(t)?t/1e3:null}(r.pendingQuestion.askedAt)??r.mtime:r.rateLimit?r.mtime:r.waitingInput?r.waitingInput.since:r.mtime;n.push({id:e,file:r,project:eM(r),tier:i,since:a})}return n.sort((e,t)=>ez[e.tier]-ez[t.tier]||e.since-t.since||e.id.localeCompare(t.id))})($,eJ),[$,eJ]);(0,Y.useEffect)(()=>{let e=$.filter(e=>"stalled"===e.activity).map(e=>e.mtime+7200).filter(e=>e>eJ);if(!e.length)return;let t=Math.max(0,(Math.min(...e)-Date.now()/1e3)*1e3)+500,n=window.setTimeout(()=>eG(Date.now()/1e3),t);return()=>window.clearTimeout(n)},[$,eJ]);let[eX,e0]=(0,Y.useState)(!1),e2=(0,Y.useRef)(null),e3=it(i===ew?null:i),e6=(0,Y.useMemo)(()=>i===ew?[]:dk($,e3.prefs.favorites).filter(e=>e.project===i),[$,e3.prefs.favorites,i]);(0,Y.useEffect)(()=>{document.title=eQ.length?`(${eQ.length}) Agent Log Viewer`:"Agent Log Viewer"},[eQ.length]),(0,Y.useEffect)(()=>{if(!eX)return;let e=e=>{e2.current?.contains(e.target)||e0(!1)},t=e=>{"Escape"===e.key&&e0(!1)};return window.addEventListener("pointerdown",e),window.addEventListener("keydown",t),()=>{window.removeEventListener("pointerdown",e),window.removeEventListener("keydown",t)}},[eX]);let[e8,e7]=(0,Y.useState)(!1);(0,Y.useEffect)(()=>{z&&e7(!1)},[z]),(0,Y.useEffect)(()=>{eQ.length||(e0(!1),e7(!1))},[eQ.length]);let e9=(0,Y.useCallback)(()=>l(null),[]),te=(0,Y.useCallback)(e=>{l(null);let t=eR.current.find(t=>t.path===e);t&&ec(t,eM(t)),eN(t=>({path:e,nonce:(t?.nonce??0)+1,catalog:!1}))},[]),tt=(0,Y.useCallback)(e=>{eC(t=>({path:e,nonce:(t?.nonce??0)+1}))},[]),tn=(0,Y.useCallback)(e=>{l(null);let t=eR.current.find(t=>t.path===e);t&&ec(t,eM(t)),eC(t=>({path:e,nonce:(t?.nonce??0)+1}))},[]);(0,Y.useEffect)(()=>iN.setShell({project:i===ew?null:i,openProject:eF,openPath:te,placePath:tt,openPathQuiet:tn,openOverview:()=>eF(ew),openConversation:(e,t)=>{e&&e!==i&&e_(e),t&&te(t)},recordFocusArrival:(e,t)=>{l(null);let n=eR.current.find(t=>t.path===e);n?ec(n,eM(n)):ec({path:e},t)}}),[i,eF,te,tt,tn,e_]);let tr=(0,Y.useRef)(null),ti=(0,Y.useMemo)(()=>eQ.map(e=>e.file.path).sort().join("\n"),[eQ]),ta=(0,Y.useMemo)(()=>e8?new Set(ti.split("\n").filter(Boolean)):null,[e8,ti]),ts=(0,Y.useMemo)(()=>i===ew?[]:eQ.filter(e=>e.project===i),[eQ,i]);(0,Y.useEffect)(()=>{if(z)return;let e=e=>{var t;if(!((t=e.target)&&t.tagName&&(["INPUT","TEXTAREA","SELECT","BUTTON"].includes(t.tagName)||t.isContentEditable))&&!e.metaKey&&!e.ctrlKey&&!e.altKey)if("n"===e.key||"N"===e.key){let t=eU(tr,ts,e.shiftKey?-1:1);if(!t)return;e.preventDefault(),te(t.file.path)}else if("f"===e.key||"F"===e.key){if(!eQ.length)return;e.preventDefault(),e7(e=>!e)}else"/"===e.key&&(e.preventDefault(),ep())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[z,ts,eQ.length,te,ep]);let tl=(0,Y.useCallback)(e=>{e0(!1),e.project!==i&&e_(e.project),tr.current=e.id,te(e.file.path)},[i,e_,te]),to=(0,Y.useCallback)(e=>{let t=eU(tr,eQ,e);t&&(t.project!==i&&e_(t.project),te(t.file.path))},[eQ,i,e_,te]),tc=(0,Y.useCallback)(e=>{e0(!1),e.project!==i&&e_(e.project),te(e.file.path)},[i,e_,te]);(0,Y.useEffect)(()=>{let e=$.map(e=>({file:e,id:e.pendingQuestion||e.rateLimit||e.waitingInput?eH(e):null})).filter(e=>null!==e.id);if(null===ev.current){ev.current=new Set(e.map(e=>e.id));return}let t=e.find(e=>!ev.current.has(e.id));for(let t of e)ev.current.add(t.id);t&&queueMicrotask(()=>eg(t.file.path))},[$]);let td=ex?$.find(e=>e.path===ex):null,tu=(0,U.jsxs)("div",{ref:e2,className:"pointer-events-auto relative",children:[(0,U.jsx)(i8,{count:eQ.length,mobile:z,queueOpen:eX,filterActive:e8,onToggleQueue:()=>e0(e=>!e),onNext:to,onToggleFilter:()=>e7(e=>!e)}),eX?(0,U.jsxs)("div",{className:`${z?"fixed inset-x-3 top-12":"absolute right-0 top-[calc(100%+6px)] w-[340px] max-w-[calc(100vw-2rem)]"} z-50 max-h-[60vh] overflow-y-auto rounded-[10px] border border-border bg-card p-1.5 shadow-1`,children:[e6.length?(0,U.jsxs)("div",{className:"mb-1 border-b border-border pb-1",children:[(0,U.jsxs)("div",{className:"flex items-center gap-1 px-2.5 pb-0.5 pt-1.5 text-label font-semibold text-secondary",children:[(0,U.jsx)(B.A,{className:"h-3 w-3 fill-crown text-crown","aria-hidden":!0}),r("favorites.sectionTitle")]}),e6.map(e=>(0,U.jsxs)("div",{className:"flex items-center gap-1 rounded-[8px] hover:bg-canvas",children:[(0,U.jsxs)("button",{type:"button",className:"flex min-w-0 flex-1 items-center gap-1.5 rounded-[8px] px-2.5 py-2 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:r("favorites.focusTitle",{title:(0,tw.cr)(e.file.title,60)}),onClick:()=>tc(e),children:[(0,U.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${(0,tw.tz)(e.file.activity)}`,"aria-hidden":!0}),(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12px] font-semibold text-primary",children:(0,tw.cr)(e.file.title,90)})]}),(0,U.jsx)("button",{type:"button",className:"mr-1 inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-[6px] text-crown hover:bg-crown-soft focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":r("branch.unfavorite"),title:r("branch.unfavorite"),onClick:()=>e3.setFavorite(e.id,!1),children:(0,U.jsx)(B.A,{className:"h-3.5 w-3.5 fill-crown","aria-hidden":!0})})]},e.id))]}):null,(0,U.jsx)("div",{className:"px-2.5 pb-1 pt-1.5 text-label font-semibold text-secondary",children:r("attention.popoverTitle")}),eQ.map(e=>(0,U.jsxs)("button",{type:"button",className:"flex w-full min-w-0 flex-col gap-0.5 rounded-[8px] px-2.5 py-2 text-left hover:bg-canvas focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>tl(e),children:[(0,U.jsxs)("span",{className:"flex w-full min-w-0 items-center gap-1.5",children:[(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12px] font-semibold text-primary",children:(0,tw.cr)(e.file.title,90)}),(0,U.jsx)("span",{className:"shrink-0 rounded-full border border-border bg-canvas px-1.5 text-[10px] font-semibold text-muted",title:e.project,children:eb(e.project,e.file.projectName)}),(0,U.jsx)("span",{className:"shrink-0 text-[10.5px] text-muted",children:(0,tw.rK)(e.since)})]}),(0,U.jsx)("span",{className:`w-full truncate text-[11px] ${"stalled"===e.tier?"text-warning":"text-muted"}`,children:function(e,t){let n=t.file.pendingQuestion;if(n){if("plan"===n.kind)return e("status.awaitingPlan");let t=n.questions?.[0];return t?.header||t?.question.split("\n")[0]||e("status.awaitingAnswer")}if(t.file.rateLimit)return e("status.rateLimited");let r=t.file.waitingInput;return r?r.menu?.question.split("\n")[0]||r.screenTail||e("status.awaitingTerminal"):e("status.stalled")}(r,e)})]},e.id))]}):null]}),tp=(0,U.jsxs)("div",{className:"flex h-full",children:[z?null:(0,U.jsx)(Nh,{files:$,projectCatalog:T,projectDisplayNames:P,pipelines:b,workflows:w,archivedProjects:D,crownedProjects:C,selected:i,now:eJ,loaded:N,catalogFailures:S,onSelect:eF,onToggleCrown:A,onCreateProject:I}),z&&H?(0,U.jsxs)("div",{className:"fixed inset-0 z-50 flex",children:[(0,U.jsx)(Nh,{files:$,projectCatalog:T,projectDisplayNames:P,pipelines:b,workflows:w,archivedProjects:D,crownedProjects:C,selected:i,now:eJ,loaded:N,catalogFailures:S,onSelect:eF,onToggleCrown:A,onCreateProject:I}),(0,U.jsx)("button",{type:"button",className:"min-w-0 flex-1 bg-primary/35","aria-label":r("viewer.closeProjects"),onClick:()=>J(!1)})]}):null,!z&&X&&i!==ew?(0,U.jsx)(hv,{project:i,projectName:eb(i,P[i]),projectCwd:x[i],files:$,onClose:eq}):null,(0,U.jsxs)("main",{className:"flex min-w-0 flex-1 flex-col",children:[z?null:(0,U.jsxs)("div",{className:"pointer-events-none fixed right-4 top-12 z-50 flex flex-col items-end gap-2",children:[tu,td?(0,U.jsxs)("div",{className:"pointer-events-auto flex max-w-[360px] gap-2 rounded-[8px] border border-warning/45 bg-warning-soft px-4 py-3 text-[13px] font-semibold text-primary shadow-1",children:[(0,U.jsxs)("button",{className:"min-w-0 flex-1 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>{eB(td),eg(null)},children:[(0,U.jsx)("span",{className:"block text-[11px] font-bold text-warning",children:r("viewer.agentWaiting")}),(0,U.jsx)("span",{className:"line-clamp-2",children:td.title})]}),(0,U.jsx)("button",{className:"mt-0.5 flex h-6 w-6 shrink-0 items-center justify-center rounded-full border border-border bg-canvas text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":r("viewer.closeNotification"),onClick:()=>eg(null),children:(0,U.jsx)(K.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}):null]}),z&&td?(0,U.jsxs)("div",{className:"flex shrink-0 items-stretch gap-2 border-b border-warning/45 bg-warning-soft pl-3 pr-1.5 py-1.5",children:[(0,U.jsxs)("button",{className:"flex min-h-11 min-w-0 flex-1 flex-col justify-center text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>{eB(td),eg(null)},children:[(0,U.jsx)("span",{className:"block text-[11px] font-bold text-warning",children:r("viewer.agentWaiting")}),(0,U.jsx)("span",{className:"truncate text-[13px] font-semibold text-primary",children:td.title})]}),(0,U.jsx)("button",{className:"flex h-11 w-11 shrink-0 items-center justify-center self-center rounded-full border border-border bg-canvas text-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":r("viewer.closeNotification"),onClick:()=>eg(null),children:(0,U.jsx)(K.A,{className:"h-5 w-5","aria-hidden":!0})})]}):null,i===ew?(0,U.jsx)(hN,{files:$,projectCatalog:T,projectDisplayNames:P,pipelines:b,workflows:w,archivedProjects:D,now:eJ,catalogFailures:S,onSelectProject:eF,onSelectFile:eB,onMenu:z?()=>J(!0):void 0,onOpenSearch:ep,attention:z?tu:void 0}):(0,U.jsx)(jN,{files:R,flows:O,pipelines:b,pipelinesError:v,workflows:w,tasks:y,conversationAliases:k,projectCatalog:T,projectName:P[i],projectCwd:x[i],project:i,loaded:N,catalogFailures:S,openNonce:ey,focusRequest:ej?.catalog&&o?.path!==ej.path?null:ej,placeRequest:eS,attentionPaths:ta,archived:D.has(i),catalogKnown:F.has(i),catalogConversationCount:q.get(i)??0,onArchive:L,onUnarchive:_,onMenu:z?()=>J(!0):void 0,onOpenSearch:ep,attention:z?tu:void 0,orchestratorPanelOpen:X,onToggleOrchestratorPanel:z?void 0:eq,onUserNavigate:e9,onOpenCatalogFile:eY,onCloseFile:eV})]}),z?null:(0,U.jsx)(dy,{}),(0,U.jsx)(Nw,{}),(0,U.jsx)(i5,{mobile:z}),eo?(0,U.jsx)(hR,{mobile:z,onClose:em,onOpen:eW}):null,(0,U.jsx)(a$,{mobile:z}),(0,U.jsx)(dm,{mobile:z}),(0,U.jsx)(sh,{}),(0,U.jsx)(dp,{}),(0,U.jsx)(Ny,{}),eT?(0,U.jsx)("div",{className:"pointer-events-none fixed left-1/2 top-10 z-40 -translate-x-1/2",role:"status","data-stale-focus-notice":!0,children:(0,U.jsxs)("div",{className:"pointer-events-auto flex items-center gap-2 rounded-full border border-warning/45 bg-warning-soft py-1.5 pl-3.5 pr-2 text-[12px] font-semibold text-warning shadow-1 backdrop-blur",children:[r("viewer.staleFocusEntry"),(0,U.jsx)("button",{type:"button",onClick:()=>eP(!1),"aria-label":r("viewer.closeNotification"),className:"rounded-full p-0.5 hover:bg-warning/15","data-stale-focus-dismiss":!0,children:(0,U.jsx)(K.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})]})}):null,e$?(0,U.jsx)("div",{className:"pointer-events-none fixed left-1/2 top-10 z-40 -translate-x-1/2",role:"status","data-unknown-fragment-notice":!0,children:(0,U.jsx)("div",{className:"rounded-full border border-warning/45 bg-warning-soft px-3.5 py-1.5 text-[12px] font-semibold text-warning shadow-1 backdrop-blur",children:r("viewer.unknownFragment")})}):null]});return(0,U.jsx)(dI,{children:tp})}},1691:(e,t,n)=>{"use strict";n.d(t,{HU:()=>r,ce:()=>m,cl:()=>h,fp:()=>p,wV:()=>b});let r=/^\s*(?:VERDICT:\s*)?(REQUEST_CHANGES|APPROVE|COMMENT)\b/m,i=/^\s*(\d+)[.)]\s+(.*)$/,a=/^\s*#{1,6}\s+finding\s+\d+\b.*$/i,s=/^\s*(?:[-*+]\s+)?(?:\*\*|__)?(severity|file|line|title|explanation)(?:\*\*|__)?\s*:\s*(?:\*\*|__)?\s*(.*)$/i,l=/(?:\[(P[0-3])\]|\b(Critical|High|Medium|Low|Info|P[0-3])\b)/i,o=/((?:\.{1,2}\/|\/|~\/)?[\w@.+-][\w@.+\-/]*\.(?:tsx?|jsx?|mjs|cjs|mts|cts|py|go|rs|md|json|ya?ml|toml|css|scss|html|sql|sh|env|ftl|txt))(?::(\d+))?/i,c=/\[([^\]]+)\]\(([^)\s]+)\)/,d=/(?:api[_-]?key|access[_-]?token|refresh[_-]?token|authorization|bearer|secret|password|passwd|pwd|token)/i,u=/([\w.-]*(?:api[_-]?key|access[_-]?token|refresh[_-]?token|authorization|bearer|secret|password|passwd|pwd|token))\b(\s*[:=]\s*)(["']?)[^\s"',}]+/gi;function p(e){return d.test(e)?e.replace(u,(e,t,n,r)=>`${t}${n}${r}[redacted]`):e}function m(e){let t=p(e);return{raw:t.slice(0,24e3),truncated:t.length>24e3}}function f(e){let t=e.toUpperCase();if("P0"===t||"P1"===t||"P2"===t||"P3"===t)return t;let n=e.toLowerCase();return"critical"===n?"Critical":"high"===n?"High":"medium"===n?"Medium":"low"===n?"Low":"Info"}function h(e){let t=e.match(/^(.*?):(\d+(?:-\d+)?)$/);return t?{target:t[1]??e,line:t[2]}:{target:e}}function x(e){let t=e.match(c);if(t){let e=h((t[2]??"").replace(/^file:\/\//,"")),n=e.line?Number(e.line.split("-",1)[0]):void 0;return{file:e.target||t[1],line:Number.isFinite(n)?n:void 0}}let n=e.match(o);if(!n)return{};let r=n[2]?Number(n[2]):void 0;return{file:n[1],line:Number.isFinite(r)?r:void 0}}function g(e){return e.trim().replace(/^`([^`]*)`$/,"$1")}function b(e,t){let n=e.match(r)?.[1];if(!n)return null;let o=function(e){let t=[],n=null,r=null,i=()=>{if(n?.severity&&n.title&&n.explanation){let e=n.file?x(n.file):{},r=n.line?Number.parseInt(n.line,10):void 0;t.push({severity:f(n.severity),file:e.file??(n.file?g(n.file):void 0),line:Number.isFinite(r)?r:e.line,title:g(n.title).slice(0,200),body:m(n.explanation).raw})}n=null,r=null};for(let t of e.split("\n")){if(a.test(t)){i(),n={};continue}let e=t.match(s);if(e){let t=e[1].toLowerCase();"severity"===t&&n?.severity&&i(),(n??={})[t]=function(e){let t=e.trim(),n=t.match(/^\*\*([\s\S]*)\*\*$/);return n?n[1].trim():t.replace(/\*\*$/,"").trim()}(e[2]??""),r=t;continue}let l=t.trim();n&&"explanation"===r&&l&&(n.explanation=`${n.explanation??""}
|
|
79
|
-
${l}`.trim())}return i(),t}(e),d=o.length>0,u=[],p=null,h=()=>{let e,t,n,r=p?.trim();r&&o.push((e=f(r.match(l)?.[1]??r.match(l)?.[2]??"Info"),t=x(r),n=function(e){let t=e,n=t.match(l);if(n&&void 0!==n.index){let e=t.slice(n.index+n[0].length).replace(/^[\s.:–—-]+/,"");e&&(t=e)}return t.replace(c,"$1").replace(/`([^`]*)`/g,"$1").replace(/\s+/g," ").trim().slice(0,200)}(r)||r.slice(0,200)||"Finding",{severity:e,file:t.file,line:t.line,title:n,body:m(r).raw})),p=null};for(let t of e.split("\n")){let e=t.trimEnd(),n=e.match(i);if(!d&&n){h(),p=n[2]??"";continue}let l=e.trim();if(null!==p){l?p=`${p}
|
|
80
|
-
${l}`:h();continue}!(!l||r.test(e)||a.test(e)||s.test(e)||/^(findings?|summary|open questions?|tests?|residual risk)\s*:?\s*$/i.test(l))&&0===o.length&&u.length<3&&l.length<=240&&u.push(l)}d||h();let b=o.filter(e=>l.test(e.body)).length;return n||/^findings?\s*:?$/im.test(e)||b>=2||b>=1&&/\b(review|request_changes|approve|comment)\b/i.test(e)?{kind:"review",ts:t,verdict:n,findings:o,summary:u,raw:m(e).raw}:null}},3194:(e,t,n)=>{"use strict";n.d(t,{vK:()=>ek,sI:()=>I,tr:()=>C});var r=n(1691);function i(e){return"string"==typeof e?e:""}function a(e){return e&&"object"==typeof e&&!Array.isArray(e)?e:{}}function s(e){return"string"==typeof e?e:(Array.isArray(e)?e.map(a):[]).map(e=>i(e.text)).filter(Boolean).join("\n")}function l(e){return"string"==typeof e.origin?e.origin:i(a(e.origin).kind)}function o(e){return/^\[Request interrupted by user(?: for tool use)?\]$/.test(e)}function c(e){return/^<local-command-caveat>\s*Caveat:[\s\S]*<\/local-command-caveat>$/.test(e)}function d(e){return/^<task-notification\b[^>]*>[\s\S]*<\/task-notification>$/.test(e)}var u=n(4654),p=n(9554),m=n(56),f=n(3719);let h="\x3c!-- llv:structured-user --\x3e\n",x=/^<!-- llv:structured-user((?: [a-z0-9]+=[^ >]+)+) -->\n/,g=/(?:^| )([a-z0-9]+)=([^ >]+)/g,b=/^[a-f0-9]{64}$/;function v(e){let t=e.match(x);if(t){let n,r=null,i=null,a=null;for(let[,e,s]of t[1].matchAll(g))"sha256"===e&&b.test(s)&&(r=s),"ctx"===e&&(i=(0,m.Gp)(s)),"origin"===e&&("operator"===s||"agent"===s)&&(a=s),"sender"===e&&(n=(0,f.S)(s));let s=a?{kind:a,..."agent"===a&&n?{role:n}:{}}:null;return{text:e.slice(t[0].length),structured:!0,contentDigest:r,selectedContext:i,origin:s}}return e.startsWith(h)?{text:e.slice(h.length),structured:!0,contentDigest:null,selectedContext:null,origin:null}:{text:e,structured:!1,contentDigest:null,selectedContext:null,origin:null}}var w=n(5606),y=n(3550),k=n(6505),j=n(538),N=n(98),S=n(7516);let C=(e,t)=>(0,u.Tl)((0,u.JK)(),e,t),A=new WeakMap;function I(e,t){let n=A.get(e),r=A.get(t);return void 0!==n||void 0!==r?void 0!==n&&n===r:void 0!==e.session&&e.session===t.session}function M(e,t){return void 0!==t&&A.set(e,t),e}let T=/<oai-mem-citation>\s*<citation_entries>([\s\S]*?)<\/citation_entries>\s*<rollout_ids>([\s\S]*?)<\/rollout_ids>\s*<\/oai-mem-citation>/g;function P(e){return"number"==typeof e&&Number.isFinite(e)?e:void 0}let $=/<(teammate-message|agent-message)\b([^>]*)>([\s\S]*?)<\/\1>/g,E=/\S*\/(?:agent-log-viewer\/inbox|\.claude\/viewer-inbox)\/([A-Za-z0-9._-]+\.(?:png|jpe?g|gif|webp))/gi;function R(e){if(!e.includes("/.claude/viewer-inbox/")&&!e.includes("/agent-log-viewer/inbox/"))return{cleaned:e,images:[]};let t=[],n=new Set,r=[];for(let i of e.split("\n"))i.replace(E,(e,r)=>(n.has(e)||(n.add(e),t.push({name:r,path:e})),"")).trim()&&r.push(i);return{cleaned:r.join("\n").trim(),images:t}}function O(e,t){let n=e.match(/^\s*<([a-zA-Z][\w:-]*)/)?.[1];return n||(/^\s*# AGENTS\.md/.test(e)?"AGENTS.md":/^\s*Caveat:/.test(e)?"caveat":t||C("render.system"))}function D(e,t){return e.match(RegExp(`${t}="([^"]*)"`))?.[1]??""}function L(e){return"string"==typeof e?e:""}function _(e){return e&&"object"==typeof e&&!Array.isArray(e)?e:{}}function F(e){return Array.isArray(e)?e.filter(e=>e&&"object"==typeof e&&!Array.isArray(e)):[]}function q(e){try{let t=JSON.parse(e);return t&&"object"==typeof t&&!Array.isArray(t)?t:null}catch{return null}}function z(e){let t=_(e),n=L(t.server),r=L(t.tool);return n&&r&&(0,w.I)(n)?{serverName:n,toolName:r,args:_(t.arguments),result:null}:null}function H(e){return"string"==typeof e?e.trim().length>0:"number"==typeof e||"boolean"==typeof e||(Array.isArray(e)?e.some(H):null!==e&&"object"==typeof e&&Object.values(e).some(H))}function U(e){let t=e.trim().replace(/[_-]/g," ");return t?`Attachment: ${t.slice(0,80)}${t.length>80?"…":""}`:"Attachment"}function B(e){let{images:t}=R(e);return t.map(e=>({kind:"inbox-image",...e}))}function K(e){let t=[],n=[];for(let r of F(e)){let e=L(r.type),i=L(r.text)||L(r.input_text)||L(r.output_text);if(i&&t.push(i),"input_image"===e||"image"===e){let t=L(_(r.image_url).path)||L(_(r.source).path),i=t?B(t):[];if(i.length){n.push(...i);continue}let a=function(e){let t=e.match(/^data:([^;,]+);base64,([A-Za-z0-9+/=]+)$/i);if(!t)return null;let n=t[1].toLowerCase();return!(0,p.PG)(n)||function(e){if(!e.length)return 0;let t=e.endsWith("==")?2:+!!e.endsWith("=");return Math.floor(3*e.length/4)-t}(t[2])>p.YP?null:{kind:"image",media:n,data:t[2]}}(L(r.image_url)||L(_(r.image_url).url)||L(r.data));a?n.push(a):H(r)&&n.push({kind:"note",text:U(e)});continue}if("local-image"===e||"local_image"===e||"localImage"===e){let t=B(L(r.path)||L(r.local_path)||L(r.image_url)||L(r.url));t.length?n.push(...t):H(r)&&n.push({kind:"note",text:U(e)});continue}("input_text"!==e&&"text"!==e&&"output_text"!==e||!i)&&!i&&H(r)&&n.push({kind:"note",text:U(e)})}return{...v(t.join(" ").trim()),attachments:n}}function Y(e){return"string"==typeof e?ee(e):Array.isArray(e)?e.map(e=>{if("string"==typeof e)return ee(e);if("number"==typeof e||"boolean"==typeof e)return String(e);if(!e||"object"!=typeof e||Array.isArray(e))return"";let t=_(e),n=L(t.text)||L(t.input_text)||L(t.output_text);if(n)return ee(n);if("input_image"===t.type||"image"===t.type)return`[${C("render.imageOutput")}]`;let r=ee(L(t.type)).slice(0,80);return`[${r?C("render.toolOutputType",{type:r}):C("render.toolOutput")}]`}).filter(Boolean).join("\n"):null==e?"":ee(JSON.stringify(e))}function W(e){let t=e=>e.match(es)?.[1];if("string"==typeof e)return t(e);if(Array.isArray(e))for(let n of e){if("string"==typeof n){let e=t(n);if(void 0!==e)return e;continue}if(!n||"object"!=typeof n||Array.isArray(n))continue;let e=_(n),r=t(L(e.text)||L(e.input_text)||L(e.output_text));if(void 0!==r)return r}}function V(e){return/^Script failed\b/im.test(e)||/\b(?:exit|exited with) code [1-9]\d*\b/i.test(e)}let J=/(?:api.?key|access.?token|refresh.?token|authorization|bearer|secret|password|passwd|pwd|token)/i,G=/(?:api|token|authorization|bearer|secret|password|passwd|pwd)/i,Q=/("(?:api[_-]?key|access[_-]?token|refresh[_-]?token|authorization|bearer|secret|password|passwd|pwd|token)"\s*:\s*")[^"]*/gi,X=/((?:api[_-]?key|access[_-]?token|refresh[_-]?token|authorization|bearer|secret|password|passwd|pwd|token)\s*[:=]\s*["']?)[^\s"',}]+/gi,Z=/(\bbearer\s+)[^\s"',}]+/gi;function ee(e){let t=e.replace(Z,"$1[redacted]");return(0,r.fp)(t).replace(Q,"$1[redacted]").replace(X,"$1[redacted]")}function et(e){let t=24e3,n=(e,r,i)=>{if(J.test(r))return"[redacted]";if(i>8)return"[depth limit]";if("string"==typeof e){if(/^data:image\//i.test(e))return`[image data \xb7 ${e.length} chars]`;let n=ee(e),r=Math.max(0,Math.min(4e3,t));return t-=Math.min(n.length,r),n.length>r?n.slice(0,r)+"…":n}if(null===e||"number"==typeof e||"boolean"==typeof e)return e;if(Array.isArray(e)){let t=e.slice(0,40).map(e=>n(e,"",i+1));return e.length>t.length&&t.push(`[${e.length-t.length} more items]`),t}if(!e||"object"!=typeof e)return String(e??"");let a=Object.entries(e).slice(0,80),s=Object.fromEntries(a.map(([e,t])=>[e,n(t,e,i+1)]));return Object.keys(e).length>a.length&&(s.__truncated__="additional fields hidden"),s};return _(n(e,"",0))}function en(e,t,n){let i=t.split("\n").map(e=>e.trim()).filter(Boolean).map(e=>{let t=e.match(/\|note=\[(.*)\]$/)?.[1],n=e.replace(/\|note=\[.*\]$/,""),i=(0,r.cl)(n);return{target:i.target,line:i.line,note:t,raw:e}}),a=n.split(/\s+/).map(e=>e.trim()).filter(e=>/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)),s=(0,r.ce)(e);return{kind:"mem-citation",entries:i,rolloutIds:a,raw:s.raw,truncated:s.truncated}}let er=/^[ \t]*(?:\[stderr\]|-{2,}\s*stderr\s*-{2,}|stderr:)[ \t]*$/im,ei=/^(?:Chunk ID:|Wall time\b|Original token count:|Output:[ \t]*$|Script completed\b|Script running with (?:cell|session) ID\b|Process running with (?:cell|session) ID\b|Process exited with code\b)/,ea=/\.([A-Za-z0-9]{1,10})$/,es=/\brunning with (?:cell|session) ID\s+(\S+)/i;function el(e){return"tool"===e.kind&&!e.wakeup&&!e.mcp}let eo={exec_command:"Bash",shell:"Bash",bash:"Bash",read_file:"Read",read:"Read",view_image:"Read",write_file:"Write",write:"Write",apply_patch:"apply_patch",edit_file:"Edit",search:"Grep",grep:"Grep",glob:"Glob",fetch:"WebFetch",web_search:"WebSearch"},ec=new Set(["text","image","generatedImage","store","notify"]),ed=/\btools\.([A-Za-z_]\w*)\s*\(/g,eu=/(?:^|[^.\w])(text|image|generatedImage|store|notify)\s*\(/g;function ep(e,t){let n=e[t];for(let r=t+1;r<e.length;r+=1){let t=e[r];if("\\"===t){r+=1;continue}if(t===n)return r}return e.length-1}function em(e,t){for(let n of t){let t=RegExp(`(?:^|[{,([\\s])${n}\\s*:\\s*`).exec(e);if(!t)continue;let r=(t.index??0)+t[0].length,i=e[r];if('"'===i||"'"===i||"`"===i)return e.slice(r+1,ep(e,r))}return""}function ef(e,t){for(let n of t){let t=RegExp(`(?:^|[{,([\\s])${n}\\s*:\\s*`).exec(e);if(!t)continue;let r=(t.index??0)+t[0].length,i=e[r];if('"'===i||"'"===i||"`"===i)return ev(e.slice(r+1,ep(e,r)));let a=e.slice(r).match(/^-?\d+(?:\.\d+)?|^(?:true|false)\b/)?.[0];if(a){if("true"===a||"false"===a)return"true"===a;let e=Number(a);return Number.isFinite(e)?e:void 0}let s=e.slice(r).match(/^([A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*)\b/)?.[1];if(s)return s;return}for(let n of t)if(RegExp(`(?:^|[{,]\\s*)${n}\\s*(?=[,}])`).test(e))return n}function eh(e,t){for(let n of t){let t=RegExp(`(?:^|[{,([\\s])${n}\\s*:\\s*`).exec(e);if(!t)continue;let r=(t.index??0)+t[0].length,i=e[r];if('"'===i||"'"===i||"`"===i)return!0;return/^(?:-?\d+(?:\.\d+)?|true\b|false\b)/.test(e.slice(r))}return!1}function ex(e){for(let t=0;t<e.length;t+=1){let n=e[t];if('"'===n||"'"===n||"`"===n)return e.slice(t+1,ep(e,t))}return""}function eg(e){return/^\s*\{/.test(e)?"":ex(e)}function eb(e,t,n){for(let r of n){let n=em(e,[r]);if(n)return n;let i=RegExp(`(?:^|[{,\\s])${r}\\s*(?::\\s*([A-Za-z_$][\\w$]*)\\s*[,}]|[,}])`).exec(e);if(!i)continue;let a=i[1]??r,s=RegExp(`\\b(?:const|let|var)\\s+${a}\\s*=\\s*`).exec(t);if(!s)continue;let l=s.index+s[0].length,o=t[l];if('"'===o||"'"===o||"`"===o)return t.slice(l+1,ep(t,l))}return""}function ev(e){return e.replace(/\\(u[0-9a-fA-F]{4}|x[0-9a-fA-F]{2}|[\s\S])/g,(e,t)=>{switch(t[0]){case"n":return"\n";case"t":return" ";case"r":return"\r";case"b":return"\b";case"f":return"\f";case"v":return"\v";case"0":return 1===t.length?"\0":e;case"u":case"x":return String.fromCodePoint(parseInt(t.slice(1),16));case"\n":return"";default:return t}})}function ew(e){let t=e.match(/\*\*\* Begin Patch[\s\S]*?\*\*\* End Patch/g);return t?t.map(ev).join("\n"):""}function ey(e,t,n,r){let i=L(t).trim(),a=L(r).trim();if(!i||i!==a)return!1;let s=L(e).trim(),l=L(n).trim();if(!s||!l)return!1;if(s===l)return!0;let o=Date.parse(s),c=Date.parse(l);if(Number.isFinite(o)&&Number.isFinite(c))return 1e3>=Math.abs(o-c);let d=/^(.*?)(\d+)(?:\.(\d+))?$/,u=s.match(d),p=l.match(d);return!!u&&!!p&&u[1]===p[1]&&.01>=Math.abs(Number(u[2]+"."+(u[3]??"0"))-Number(p[2]+"."+(p[3]??"0")))}function ek(e){let{showSvc:t,lineFilter:n}=e,u="claude"===e.fmt||"codex"===e.fmt,p=[],m=new Map,f=new Map,h=e=>{let t=("string"==typeof e?e:"number"==typeof e&&Number.isFinite(e)?String(e):"").trim()||void 0;if(void 0===t)return;let n=f.get(t);return void 0===n&&(n={},f.set(t,n)),{label:(0,r.fp)(t).trim().slice(0,120)||void 0,owner:n}},x=new Map,g=new Map,b=new Map,I=0,E=0,H=0,U=null,B=-1/0,Q=null,X=[],Z=null,ev=null,ek=null,ej=[],eN=new Map,eS=null,eC=null,eA=e=>p.length?e-p[0].seq:-1,eI=e=>(p.push({seq:E,bornSrc:H,src:H,item:e}),eS=null,E++),eM=(e,t)=>!!(!(e.length<=2e4)&&(e.match(/\s/g)?.length??0)/e.length<.02)&&(eI({kind:"blob",bytes:e.length,text:(0,r.fp)(e).slice(0,2e5),...t?{sourceId:t}:{}}),!0),eT=(e,t)=>{let n=_(e.source),r=L(n.data)||L(t.base64);if(!r)return;let i=L(n.media_type)||L(t.type),a=i.startsWith("image/")?i:"image/png",s=_(t.dimensions);eI({kind:"image",media:a,data:r,w:P(s.originalWidth),h:P(s.originalHeight),bytes:P(t.originalSize)})},eP=(e,t,n,i=eI,a)=>{let s=e=>i(a?{...e,sourceId:a}:e);T.lastIndex=0;let l=T.test(t);if(T.lastIndex=0,!l){let n=(0,r.wV)(t.trim(),e);return!!n&&(s(n),!0)}let o=!1,c=0,d=t=>{let i=t.trim();if(!i)return;let a=(0,r.wV)(i,e);a?(s(a),o=!0):n(i)};for(let e of t.matchAll(T)){let n=e[0],r=e.index??0;d(t.slice(c,r)),s(en(n,e[1]??"",e[2]??"")),o=!0,c=r+n.length}return d(t.slice(c)),o},e$=e=>{let t=[];return T.lastIndex=0,{cleaned:e.replace(T,(e,n,r)=>(t.push(en(e,n,r)),"")).trim(),cites:t}},eE=(t,n,r)=>{if(!n.trim())return null;let i=E;if(eM(n,r))return{firstSeq:i,lastSeq:E-1};let a="codex"===e.engine?"codex":"claude";return eP(t,n,e=>eI({kind:"prose",ts:t,text:e,engine:a,...r?{sourceId:r}:{}}),eI,r)||eI({kind:"prose",ts:t,text:n,engine:a,...r?{sourceId:r}:{}}),{firstSeq:i,lastSeq:E-1}},eR=(e,t,n,r)=>{let i=n.trim(),a=Q;if(a&&a.shape!==e&&a.src===H-1&&a.text===i&&ey(a.ts,a.text,t,i)){let n="event-agent"===e?t:"event-agent"===a.shape?a.ts:t;for(let e=a.firstSeq;e<=a.lastSeq;e+=1){let t=eA(e);if(t<0||t>=p.length)continue;let i=p[t],a=i.item;p[t]={...i,src:H,item:"prose"===a.kind||"review"===a.kind?{...a,ts:n,...r?{sourceId:r}:{}}:"mem-citation"===a.kind||"blob"===a.kind?{...a,...r?{sourceId:r}:{}}:a}}Q=null,eS=null;return}let s=eE(t,n,r);Q=s?{shape:e,text:i,ts:t,src:H,firstSeq:s.firstSeq,lastSeq:s.lastSeq}:null},eO=e=>{let t,n=e.args??{},i=(0,S.Ap)(e.tool),a=e.diff??("edit"===i||"write"===i?(0,N.AD)(e.tool,n):void 0),s=(0,S.K8)(e.tool,n,e.engine,a),l=a&&a.files.length?{type:"diff",files:a.files,filesTruncated:a.filesTruncated}:void 0,o=void 0!==e.command?(0,r.fp)(e.command).slice(0,8e3):void 0,c=void 0!==e.summary?(0,r.fp)(e.summary).replace(/\s+/g," ").trim().slice(0,160):s.summary,d="wait"===e.tool||"write_stdin"===e.tool&&!("string"==typeof n.chars&&n.chars.length>0),u="shell"===s.family?h(n.session_id??n.cell_id):void 0;return M({kind:"tool",id:e.id,ts:e.ts,srcCall:H,family:s.family,tool:e.tool,icon:s.icon,summary:c,chips:s.chips,body:l,lang:e.lang,command:o,status:"run",statusLabel:C("render.executing"),outputPreview:"",outputTruncated:!1,..."shell"===s.family?{...(t=function(e,t){let n=e.cwd??e.workdir??e.working_directory??e.cd,i="string"==typeof n&&n.trim()?n.trim():t?.match(/^\s*cd\s+('([^']+)'|"([^"]+)"|(\S+))\s*&&/)?.slice(2).find(Boolean);if(i)return(0,r.fp)(i).trim().slice(0,400)||void 0}(n,o))?{cwd:t}:{},...u?.label!==void 0?{session:u.label}:{}}:{},...d?{poll:!0}:{},open:!!l,...e.wakeup?{wakeup:e.wakeup}:{},...e.mcp?{mcp:{...e.mcp,args:et(e.mcp.args),result:e.mcp.result?et(e.mcp.result):null}}:{}},u?.owner)},eD=e=>{let t=eI(e),n={event:e,seq:t};return m.set(e.id,n),n},eL=(e,t)=>{let n={...e.event,wakeup:t};e.event=n;let r=eA(e.seq);r>=0&&r<p.length&&"tool"===p[r].item.kind&&(p[r]={...p[r],item:n},eS=null)},e_=()=>{let e=null;for(let t=ej.length-1;t>=0;t-=1){let n=ej[t].event.wakeup;if(n&&!n.failed){e=ej[t].seq;break}}for(let t of ej){let n=t.event.wakeup;if(!n)continue;let r=!n.failed&&t.seq!==e;n.superseded!==r&&eL(t,{...n,superseded:r})}},eF=e=>({...e,reason:(0,r.fp)(e.reason).slice(0,300),prompt:(0,r.fp)(e.prompt).slice(0,4e3)}),eq=(e,t,n)=>{let r="string"==typeof e||"number"==typeof e?Date.parse(String(e)):NaN,i=eF((0,y.It)(n,Number.isFinite(r)?r:null)),a=eD(eO({ts:e,id:t,tool:"ScheduleWakeup",args:n,engine:"claude",wakeup:{...i,superseded:!1,failed:!1}}));return ej.push(a),e_(),a},ez=(t,n,r,i="Bash",a)=>{let s=r||"plain-"+E+"-"+String(t??""),l="codex"===e.engine?"codex":"claude",o=eO({ts:t,id:s,tool:i,args:{...a,command:n},engine:l,command:n}),c=eD(o);return r||(ek=c),o},eH=(e,t,n)=>{let r=n||"plain-"+E+"-"+String(e??""),i=eO({ts:e,id:r,tool:"apply_patch",args:{input:t},engine:"codex",diff:(0,N.ag)(t)});return eD(i),i},eU=(e,t,n,i)=>{let a=i||"plain-"+E+"-"+String(e??""),s=function(e){let t,n;if(!e||!/\btools\.[A-Za-z_]\w*\s*\(/.test(e))return null;let i=[];for(ed.lastIndex=0;(n=ed.exec(e))&&i.length<16;){let r=n[1],a=function(e,t){let n=0;for(let r=t;r<e.length;r+=1){let i=e[r];if('"'===i||"'"===i||"`"===i){r=ep(e,r);continue}if("("===i||"["===i||"{"===i)n+=1;else if((")"===i||"]"===i||"}"===i)&&0==(n-=1))return e.slice(t+1,r)}return e.slice(t+1)}(e,n.index+n[0].length-1),s=eo[r]??r,l=function(e,t,n){if("write_stdin"===e)return{session_id:ef(t,["session_id"]),cell_id:ef(t,["cell_id"]),chars:ef(t,["chars"])};if("wait"===e)return{cell_id:ef(t,["cell_id"]),session_id:ef(t,["session_id"])};switch((0,S.Ap)(e)){case"shell":return{command:eb(t,n,["cmd","command"])||eg(t)};case"read":case"write":return{file_path:eb(t,n,["path","file_path","filePath"])||eg(t)};case"search":return{pattern:eb(t,n,["pattern","query","regex","q"])||eg(t),path:em(t,["path","glob","include"])};case"web":return{url:eb(t,n,["url"])||eg(t)};case"edit":return{input:ew(n)};default:return{value:em(t,["cmd","path","url","query","pattern","goal","step","title","name"])||ex(t)}}}(s,a,e),o=(0,S.K8)(s,l,"codex");if(i.push({id:`${r}#${i.length}`,tool:r,family:o.family,icon:o.icon,summary:o.summary}),"wait"===s||"write_stdin"===s){let e=eh(a,["session_id","cell_id"]),n="wait"===s||eh(a,["chars"]);e&&n&&(t={tool:s,args:l})}}for(eu.lastIndex=0;(n=eu.exec(e))&&i.length<16;){let e=n[1];ec.has(e)&&i.push({id:`${e}#${i.length}`,tool:e,family:"other",icon:"note",summary:e})}let a=i.filter(e=>"note"!==e.icon);if(!a.length)return null;let s=(0,r.fp)(e).slice(0,8e3),l=e.length>8e3;if(1===a.length&&t)return{overlay:{},directInteractive:t};let o=ew(e),c=o?(0,N.ag)(o):void 0;if(c&&c.files.length){let e=(0,S.K8)("apply_patch",{input:o},"codex",c),t=a.filter(e=>"edit"!==e.family);if(0===t.length)return{overlay:{summary:e.summary,icon:e.icon,family:"edit",chips:e.chips},diff:c};let n=i.filter(e=>"edit"!==e.family);return{overlay:{summary:`${e.summary} \xb7 ${C("tools.orchestration",{count:t.length})}`.slice(0,160),icon:"cmd-group",family:"edit",chips:e.chips},body:{source:s,sourceTruncated:l,calls:n},diff:c}}let d=i,u=a;if(1===a.length&&"shell"===a[0].family&&!/\s/.test(a[0].summary)){let t=function(e){let t=e.match(/=\s*\[\s*\[[\s\S]*?\]\s*,?\s*\]/)?.[0];if(!t)return[];let n=[];for(let e=0;e<t.length&&n.length<16;e+=1){let r=t[e];if('"'!==r&&"'"!==r&&"`"!==r)continue;let i=ep(t,e),a=t.slice(e+1,i);e=i,/\s/.test(a.trim())&&!/^\s*(?:[/#]|https?:)/.test(a)&&n.push(a)}return n}(e);t.length>=2&&(u=d=t.map((e,t)=>{let n=(0,S.K8)("Bash",{command:e},"codex");return{id:`exec_command#${t}`,tool:"exec_command",family:n.family,icon:n.icon,summary:n.summary}}))}let p=u[0];return{overlay:1===u.length?{summary:p.summary,icon:p.icon,family:p.family,chips:[]}:{summary:`${p.summary} \xb7 ${C("tools.orchestration",{count:u.length})}`.slice(0,160),icon:"cmd-group",chips:[]},body:{source:s,sourceTruncated:l,calls:d}}}(n),l=s?.directInteractive,o=eO({ts:e,id:a,tool:l?.tool??t,args:l?.args??{input:n},engine:"codex",diff:s?.diff}),c=s?M({...o,...s.overlay,...s.body?{orchestration:s.body}:{}},A.get(o)):o;return eD(c),c},eB=(e,t,n,i)=>{if(!e)return null;let a=t.match(/exited with code (\d+)/)?.[1],s=t.match(/Wall time:?\s*([\d.]+)\s*seconds?/i)?.[1],l=(0,j.At)(t).split("\n"),o=0;for(;o<l.length&&ei.test(l[o]);)o+=1;let c=l.slice(o).join("\n").trim(),d="{}"===c?"":c,u=!0===n||void 0!==a&&"0"!==a,m=e.event,f=!d&&("wait"===m.tool||"write_stdin"===m.tool)&&void 0!==s,x=d,g="",b="shell"===m.family?d.match(er):null;b&&void 0!==b.index&&(x=d.slice(0,b.index).replace(/\n+$/,""),g=d.slice(b.index+b[0].length).replace(/^\n+/,""));let v=m.outputPreview,w=m.outputTruncated;if(x){let e=u?6e4:12e3,t=(m.outputPreview+"\n"+(0,r.fp)(x)).trim();w=m.outputTruncated||t.length>e,v=t.slice(-e)}let k=m.stderr,N=m.stderrTruncated;if(g){let e=((m.stderr??"")+"\n"+(0,r.fp)(g)).trim();N=(m.stderrTruncated??!1)||e.length>6e4,k=e.slice(-6e4)}let S=void 0!==a?Number(a):m.exitCode,I=void 0!==s?Math.round(1e3*Number(s)):m.durationMs,T="shell"===m.family?h(i??t.match(es)?.[1]):void 0,P=m.session??T?.label,$=A.get(m)??T?.owner,E="string"==typeof m.ts||"number"==typeof m.ts?Date.parse(String(m.ts)):NaN,R=void 0!==I&&Number.isFinite(E)?new Date(E+I).toISOString():m.endTs,O=m.wakeup,D=q(d),L=m.mcp?{...m.mcp,result:D?et(D):m.mcp.result}:void 0;if(O){if(u)O={...O,failed:!0};else if(d){let e="string"==typeof m.ts||"number"==typeof m.ts?Date.parse(String(m.ts)):NaN;O={...eF((0,y.WQ)(O,Number.isFinite(e)?e:null,d)),superseded:O.superseded,failed:!1}}}let _=M({...m,status:u?"err":"ok",statusLabel:u?a&&"0"!==a?"exit "+a:C("render.error"):f?C("tools.waitingSeconds",{n:Math.round(Number(s))}):"ok",open:m.open||u,srcResult:H,outputPreview:v,outputTruncated:w,...void 0!==S?{exitCode:S}:{},...void 0!==I?{durationMs:I}:{},...void 0!==R?{endTs:R}:{},...void 0!==k?{stderr:k}:{},...void 0!==N?{stderrTruncated:N}:{},...void 0!==P?{session:P}:{},...O?{wakeup:O}:{},...L?{mcp:L}:{}},$);e.event=_;let F=eA(e.seq);return F>=0&&F<p.length&&"tool"===p[F].item.kind&&(p[F]={...p[F],item:_},eS=null),O&&O.failed&&e_(),_},eK=(e,n,i,a)=>{if(!e)return;let s=x.get(e);if(void 0!==s){let e=eA(s);if(e>=0&&e<p.length){let t=p[e].item;if("tmsg"===t.kind){let r=i||/"success"\s*:\s*false/.test(n)?"err":"ok",a=n.match(/"msg_id"\s*:\s*"([^"]+)"/)?.[1];p[e]={...p[e],item:{...t,delivery:r,msgId:a}},eS=null}}return}!eB(m.get(e),n,i,a)&&n&&t&&eI({kind:"svc",text:"output: "+(0,r.fp)(n).slice(0,200)})},eY=e=>{t?eI({kind:"svc",text:e.slice(0,300)}):(I+=1,b.set(H,(b.get(H)??0)+1),eS=null)},eW=e=>{eI({kind:"note",text:e})},eV=(e,t,n)=>{let i,a,s,l=(i=!1,a=JSON.stringify(n,(e,t)=>{if(J.test(e))return"[redacted]";if("encrypted_content"===e)return"[encrypted]";if("string"!=typeof t)return t;if(/^data:image\//i.test(t))return i=!0,`[image data \xb7 ${t.length} chars]`;let n=G.test(t)?ee(t):t;return n.length<=4e3?n:(i=!0,n.slice(0,4e3)+"…")},2)??"{}",{body:(s=(0,r.ce)(a)).raw,truncated:i||s.truncated});eI({kind:"record",ts:e,recordType:ee(t).slice(0,80)||C("render.record"),...l})},eJ=(e,t,n=!1,i)=>{if(n)return void eG(t,C("render.system"),i);let a=t.replace($,(t,n,i,a)=>{let s=D(i,"teammate_id")||D(i,"from")||C("render.teammate"),l=D(i,"summary"),o=a.trim();if(o.startsWith("{"))try{let e=JSON.parse(o);if("idle_notification"===e.type){let t=(0,k.T0)(e.timestamp);return eI({kind:"tnote",text:C("render.left",{peer:s,at:t?" \xb7 "+t:""})}),""}}catch{}let{cleaned:c,cites:d}=e$(o),u=r.HU.test(c)?(0,r.wV)(c,e):null;for(let t of(eI({kind:"tmsg",ts:e,dir:"in",peer:s,summary:l,text:u?"":c}),u&&eI(u),d))eI(t);return""}).replace(/Another Claude session sent a message:\s*/g,"").trim();if(!a||eM(a))return;let{cleaned:s,images:l}=R(a);for(let t of(s&&!eP(e,s,t=>eI({kind:"user",ts:e,text:t}))&&eI({kind:"user",ts:e,text:s}),l))eI({kind:"inbox-image",name:t.name,path:t.path})},eG=(e,t,n)=>{eI({kind:"sysmsg",label:O(e,t),text:e,...n?{deliveredMessage:n}:{}})},eQ=(e,t,n)=>({kind:"tmsg",ts:e,dir:"in",peer:n.role??C("render.agentPeer"),summary:"",text:t,internal:!0}),eX=(e,t)=>{let n=[],r=e=>n.push(eI(e)),{cleaned:i,images:a}=R(t.text),s=i?function(e){if(!/^\s*<realtime_delegation>/.test(e))return null;let t=e.match(/<input>([\s\S]*?)<\/input>/)?.[1]?.trim()??"",n=e.match(/<transcript_delta>([\s\S]*?)(?:<\/transcript_delta>|$)/)?.[1]?.trim()??"";return t||n?{input:t,delta:n}:null}(i):null;for(let n of(s?r({kind:"voice",ts:e,...s}):i&&t.origin?.kind==="agent"?r(eQ(e,i,t.origin)):i&&r({kind:"user",ts:e,text:i,...t.selectedContext?{selectedContext:t.selectedContext}:{}}),a))r({kind:"inbox-image",name:n.name,path:n.path});for(let e of t.attachments)r(e);return{src:H,ts:e,text:t.text,entrySeqs:n,structured:t.structured}},eZ=()=>{let e=X;for(let n of(X=e.filter(e=>e.structured),e)){var t;if(n.structured||(t=n.text,!/^\s*(?:# AGENTS\.md instructions\b|<(?:environment_context|permissions instructions|multi_agent_mode|turn_aborted)\b)/.test(t)))continue;let e=!1;for(let t of n.entrySeqs){let r=eA(t);if(!(r<0)&&!(r>=p.length)&&"user"===p[r].item.kind){p[r]={...p[r],item:{kind:"sysmsg",label:O(n.text),text:n.text}},eS=null,e=!0;break}}if(!e&&n.text){let e=H;H=n.src,eG(n.text),H=e}}},e0=(e,t)=>{eI({kind:"compact",ts:e,trigger:t?.trigger,preTokens:t?.preTokens})},e1=e=>t=>{for(let n of t.split("\n"))n.trim()&&e({kind:"raw",text:(0,r.fp)(n),err:/error|failed|traceback|exception/i.test(n)})},e2=t=>{if(!n||t.toLowerCase().includes(n))if(u)try{let n=JSON.parse(t);n&&"object"==typeof n&&!Array.isArray(n)?"claude"===e.fmt?(e=>{let t=e.timestamp;if("user"===e.type&&e.message){let n=_(e.message).content,r=_(_(e.toolUseResult).file);if(!0===e.isCompactSummary){let e="string"==typeof n?n:F(n).filter(e=>"text"===e.type).map(e=>L(e.text)).join(" ");e.trim()&&((e,t)=>{for(let e=p.length-1;e>=0;e-=1){let n=p[e].item;if("compact"===n.kind){p[e]={...p[e],item:{...n,summary:t}},eS=null;return}if("svc"!==n.kind&&"note"!==n.kind)break}eI({kind:"compact",ts:e,summary:t})})(t,e.trim());return}let u=function(e){if("human"===l(e)||"typed"===i(e.promptSource))return!1;if(!0===e.isMeta||!0===e.isCompactSummary||"interruptedMessageId"in e||"promptSource"in e||"origin"in e)return!0;let t=s(a(e.message).content).trim();return o(t)||c(t)||d(t)||/^This came from another Claude session\b[\s\S]*not typed by your user[\s\S]*$/.test(t)}(e),m=!function(e){if("sdk"!==i(e.promptSource)||!0===e.isMeta||!0===e.isCompactSummary||"interruptedMessageId"in e)return!1;let t=l(e);if(t&&"human"!==t)return!1;let n=s(a(e.message).content).trim();return!!n&&!(o(n)||c(n)||d(n))}(e)?void 0:{engineMessageId:L(e.uuid)||null,ts:t};if("string"==typeof n)eJ(t,n,u,m);else for(let e of F(n))if("text"===e.type)eJ(t,L(e.text),u,m);else if("image"===e.type)eT(e,r);else if("tool_result"===e.type){let t=F(e.content);for(let e of t)"image"===e.type&&eT(e,r);let n="string"==typeof e.content?e.content:t.filter(e=>"image"!==e.type).map(e=>L(e.text)).join(" ");eK(L(e.tool_use_id),n,!0===e.is_error)}return}if("assistant"===e.type&&e.message){for(let i of F(_(e.message).content))if("text"===i.type&&L(i.text).trim())eE(t,L(i.text),L(e.uuid)||void 0);else if("thinking"===i.type&&L(i.thinking).trim())eI({kind:"think",text:L(i.thinking).replace(/\s+/g," ").trim()});else if("tool_use"===i.type&&"SendMessage"===L(i.name)){let e=_(i.input),n=e.message;if("string"==typeof n){let{cleaned:a,cites:s}=e$(n),l=r.HU.test(a)?(0,r.wV)(a,t):null,o=eI({kind:"tmsg",ts:t,dir:"out",peer:String(e.to??""),summary:String(e.summary??""),text:l?"":a});for(let e of(l&&eI(l),s))eI(e);let c=L(i.id);c&&(x.set(c,o),g.set(o,c))}else eY(`SendMessage → ${String(e.to??"")} \xb7 ${L(_(n).type)||C("render.protocol")}`)}else if("tool_use"===i.type){let e=L(i.name)||"tool",r=_(i.input),a=L(i.id)||"plain-"+E+"-"+String(t??"");if("ScheduleWakeup"===e)eq(t,a,r);else{var n;let i="shell"===(0,S.Ap)(e)?L(r.command):void 0,s="read"===(0,S.Ap)(e)?(n=L(r.file_path),n.match(ea)?.[1]?.toLowerCase()??null):void 0,l=function(e){if(!e.startsWith("mcp__"))return null;let t=e.slice(5),n=t.indexOf("__");if(n<=0||n===t.length-2)return null;let r=t.slice(0,n),i=t.slice(n+2);return(0,w.I)(r)?{serverName:r,toolName:i}:null}(e),o=l?{...l,args:r,result:null}:void 0;eD(eO({ts:t,id:a,tool:e,args:r,engine:"claude",command:i,lang:s,mcp:o}))}}return}if("system"===e.type&&"compact_boundary"===e.subtype){let n=_(e.compactMetadata);return e0(t,{trigger:L(n.trigger)||void 0,preTokens:P(n.preTokens)})}eY(L(e.type)||C("render.record"))})(n):(e=>{let t=_(e.payload),n=e.timestamp;if("event_msg"===e.type){if("user_message"===t.type&&t.message)return((e,t)=>{let n=v(t),r=X.findIndex(t=>ey(t.ts,t.text,e,n.text));if(r<0)return eX(e,{...n,attachments:[]});let[i]=X.splice(r,1);if(!i)return;let{cleaned:a,images:s}=R(n.text);if(a){let t=n.origin?.kind==="agent",r=t?eQ(e,a,n.origin):{kind:"user",ts:e,text:a},s=i.entrySeqs.find(e=>{let n=eA(e),r=n>=0?p[n]?.item.kind:void 0;return t?"tmsg"===r:"user"===r});if(void 0!==s){let e=eA(s);p[e]={...p[e],item:r}}else i.entrySeqs.push(eI(r))}for(let e of s)i.entrySeqs.push(eI({kind:"inbox-image",name:e.name,path:e.path}));var l=H;for(let e of i.entrySeqs){let t=eA(e);t>=0&&t<p.length&&(p[t]={...p[t],src:l})}i.src=l,eS=null})(n,L(t.message));if(eZ(),"agent_message"===t.type&&t.message)return eR("event-agent",n,L(t.message));if("task_started"===t.type)return eW(C("render.taskStarted")+(n?" \xb7 "+(0,k.T0)(n):""));if("task_complete"===t.type)return eW(C("render.taskComplete")+(n?" \xb7 "+(0,k.T0)(n):""));if("context_compacted"===t.type)return Z?Z=null:e0(n);if("mcp_tool_call_begin"===t.type){let e=z(t.invocation);if(!e)return eY("mcp_tool_call_begin");let r=L(t.call_id)||"plain-"+E+"-"+String(n??"");return eD(eO({ts:n,id:r,tool:`mcp__${e.serverName}__${e.toolName}`,args:e.args,engine:"codex",mcp:e}))}if("mcp_tool_call_end"===t.type){let e,r,i,a,s=L(t.call_id)||"plain-"+E+"-"+String(n??""),l=m.get(s),o=z(t.invocation)??l?.event.mcp??null;if(!o)return eY("mcp_tool_call_end");let c=(e=_(t.result),r=_(e.Ok),i=void 0!==e.Err||!0===r.isError,{output:a=F(r.content).map(e=>L(e.text)).filter(Boolean).join("\n")||(void 0===e.Err?"":JSON.stringify(e.Err)),result:q(a),error:i}),d=l??eD(eO({ts:n,id:s,tool:`mcp__${o.serverName}__${o.toolName}`,args:o.args,engine:"codex",mcp:o}));if(eB(d,c.output,c.error),d.event.mcp&&c.result){let e={...d.event,mcp:{...d.event.mcp,result:et(c.result)}};d.event=e;let t=eA(d.seq);t>=0&&p[t]?.item.kind==="tool"&&(p[t]={...p[t],item:e}),eS=null}return}return["patch_apply_end","sub_agent_activity","thread_settings_applied","token_count","turn_aborted","web_search_end"].includes(L(t.type))?eY(L(t.type)):eV(n,L(t.type)||"event",t)}if("response_item"===e.type){if("message"===t.type){if("user"===t.role){let e;return(e=eX(n,K(t.content))).entrySeqs.length||e.text||eY("message user"),X.push(e)}eZ();let e=K(t.content).text;return e?"assistant"===t.role?eR("response-assistant",n,e,L(t.id)||void 0):eG(e,L(t.role)):eY("message "+L(t.role))}if(eZ(),"function_call"===t.type){let e={};try{e=JSON.parse(L(t.arguments)||"{}")}catch{e={}}let r=L(t.name);return"exec_command"===r||"shell"===r?ez(n,String(e.cmd??e.command??"").replace(/^\/usr\/bin\/zsh -lc /,""),L(t.call_id),r,e):"apply_patch"===r?eH(n,String(e.input??""),L(t.call_id)):"exec"===r||"functions.exec"===r?eU(n,r,L(e.input),L(t.call_id)):eD(eO({ts:n,id:L(t.call_id)||"plain-"+E+"-"+String(n??""),tool:r,args:e,engine:"codex"}))}if("function_call_output"===t.type){let e=W(t.output),n=Y(t.output);return eK(L(t.call_id),n,V(n),e)}if("custom_tool_call"===t.type&&"apply_patch"===L(t.name))return eH(n,L(t.input),L(t.call_id)||L(t.id));if("custom_tool_call"===t.type){let e=L(t.name)||"tool",r=L(t.input)||L(t.arguments);return eU(n,e,r,L(t.call_id)||L(t.id))}if("custom_tool_call_output"===t.type){let e=W(t.output),n=Y(t.output);return eK(L(t.call_id),n,V(n),e)}return"reasoning"===t.type||"agent_message"===t.type?eY(L(t.type)):eV(n,L(t.type)||"item",t)}return(eZ(),"session_meta"===e.type)?eW(`${C("render.codexSessionCreated")} \xb7 ${L(t.model)} \xb7 ${L(t.cwd)}`):"compacted"===e.type?(Z={src:H},e0(n)):"turn_context"===e.type||"world_state"===e.type||"inter_agent_communication_metadata"===e.type?eY(L(e.type)):eV(n,L(e.type)||C("render.record"),e)})(n):eV(null,"malformed_record",{value:n})}catch{eV(null,"malformed_record",{source:t})}else(e=>{let t=e.replace(/\x1b\][^\x07]*(\x07|\x1b\\)/g,"").replace(/\x1b\[[0-9;?]*[A-Za-z]/g,"");if(ev)if(/^\[codex\]/.test(t))(()=>{if(!ev)return;let e=ev.lines.join("\n").trim();if(ev=null,!e)return;let t=e1(eI);eP(null,e,t)||t(e)})();else{ev.lines.push(t),eS=null;return}if(/Assistant message$/.test(t))return;let n=t.match(/^\[([^\]]+)\]\s*(.*)$/),i=n?.[1]??null,a=n?.[2]??t;if(!(!a||/^Assistant message captured/.test(a))){if(!n&&(r.HU.test(t)||t.startsWith("<oai-mem-citation>"))){ev={lines:[t],src:H},eS=null;return}if(/^Running command: /.test(a))return ez(i,a.replace(/^Running command: /,"").replace(/^\/usr\/bin\/zsh -lc /,""));if(/^Command (completed|failed)/.test(a)){ek&&eB(ek,a,/^Command failed/.test(a));return}return/^Applying \d+ file/.test(a)?eI({...eO({ts:i,id:"plain-"+E+"-"+String(i??""),tool:"apply_patch",engine:"codex",summary:a}),status:"ok",statusLabel:"ok"}):n&&!/^(Running|Command|Applying)/.test(a)?eE(i,a):!eM(t)&&eI({kind:"raw",text:(0,r.fp)(t),err:/error|failed|traceback|exception/i.test(t)})}})(t)},e5=()=>{p.length=0,m.clear(),f.clear(),x.clear(),g.clear(),b.clear(),I=0,Q=null,X=[],Z=null,ev=null,ek=null,ej.length=0,eN=new Map,eS=null};return{feed:(e,t,n)=>{let r=t+e.length;(null===U||r<U||t>U||t<B)&&(e5(),U=t),B=t,(e=>{let t=p.some(t=>t.bornSrc<e&&t.src>=e);for(;p.length&&p[0].src<e;){let e=p.shift();if(eS=null,"tool"===e.item.kind){let t=m.get(e.item.id);t&&t.seq===e.seq&&m.delete(e.item.id)}let t=g.get(e.seq);void 0!==t&&(g.delete(e.seq),x.get(t)===e.seq&&x.delete(t))}for(let[t,n]of b){if(t>=e)break;I-=n,b.delete(t),eS=null}Q&&Q.src<e&&(Q=null),X=X.filter(t=>t.src>=e),Z&&Z.src<e&&(Z=null),ek&&0>eA(ek.seq)&&(ek=null);let n=!1;for(let e=ej.length-1;e>=0;e-=1)0>eA(ej[e].seq)&&(ej.splice(e,1),n=!0);return n&&e_(),t||null!==ev&&ev.src<e})(t)&&(e5(),U=t);for(let n=U-t;n<e.length;n+=1)H=t+n,e2(e[n]);return U=r,eS&&eC===n||(eS=(e=>{let t=[],n=new Map,r=new Map,i=(e,t)=>{let n=`${t}:${e.src}`,i=r.get(n)??0;return r.set(n,i+1),`${n}:${i}`},a=0;for(;a<p.length;){let r=p[a];if(!el(r.item)){t.push({anchorKey:i(r,"row"),key:String(r.seq),item:r.item}),a+=1;continue}let l=a,o=[];for(;l<p.length;){let e=p[l];if(el(e.item))o.push({idx:l,seq:e.seq,item:e.item});else if("think"!==e.item.kind)break;l+=1}let c=e&&l===p.length,d=o.length;if(d>=2){let e,l=o.slice(0,d),u=l[l.length-1].idx+1,p=l[0].seq,m=eN.get(p);if(m&&m.active===c&&m.calls.length===l.length&&l.every((e,t)=>m.calls[t]===e.item))e=m;else{let t={},n=0,r=0;for(let e of l){var s;let i=(s=e.item).tool||s.family;t[i]=(t[i]??0)+1,"ok"===e.item.status?n+=1:"err"===e.item.status&&(r+=1)}e={kind:"cmd-group",ids:l.map(e=>e.item.id),calls:l.map(e=>e.item),t0:l[0]?.item.ts,t1:l.at(-1)?.item.ts,byTool:t,okCount:n,errCount:r,hasErr:r>0,active:c}}n.set(p,e),t.push({anchorKey:i(r,"group"),key:"g"+p,item:e}),a=u}else t.push({anchorKey:i(r,"row"),key:String(r.seq),item:r.item}),a+=1}return eN=n,(()=>{if(!ev)return[];let e=ev.lines.join("\n").trim();if(!e)return[];let t=[],n=e=>t.push(e),r=e1(n);return eP(null,e,r,n)||r(e),t})().forEach((e,n)=>t.push({anchorKey:null,key:"pb"+n,item:e})),{items:t,hiddenServiceCount:I}})(n),eC=n),eS}}}},3550:(e,t,n)=>{"use strict";n.d(t,{$f:()=>i,F9:()=>d,It:()=>o,WQ:()=>c});let r={ScheduleWakeup:"wakeup",CronCreate:"cron",CronDelete:"cron",Monitor:"monitor"};function i(e){return r[e]??null}let a=/scheduled for\s+(\d{1,2}:\d{2}:\d{2})(?:\s*\(in\s+(\d+)\s*s\))?/i,s=/\bin\s+(\d+)\s*s\b/i;function l(e){return"string"==typeof e?e.trim():""}function o(e,t,n){var r;let i=e&&"object"==typeof e&&!Array.isArray(e)?e:{},o=l(i.reason),c=l(i.prompt),d="number"==typeof(r=i.delaySeconds)&&Number.isFinite(r)?r:null,u="string"==typeof n?n.match(a):null,p="string"==typeof n?n.match(s):null,m=u?.[2]??p?.[1],f=m?Number(m):null,h=u?.[1]??null,x=null;return null!==t&&null!==f?x=t+1e3*f:h?x=function(e,t){let n=e.split(":").map(Number);if(3!==n.length||n.some(e=>!Number.isFinite(e)))return null;let[r,i,a]=n,s=null!==t?new Date(t):new Date;s.setUTCHours(r,i,a,0);let l=s.getTime();return null!==t&&l<t-6e4&&(l+=864e5),l}(h,t):null!==t&&null!==d&&(x=t+1e3*d),{fireAt:x,delaySeconds:f??d,reason:o,prompt:c}}function c(e,t,n){let r=o({reason:e.reason,prompt:e.prompt},t,n);return null!==r.fireAt?r:e}function d(e,t){return null===e?"unknown":e>t?"pending":"fired"}},3719:(e,t,n)=>{"use strict";n.d(t,{S:()=>i});let r=/^[A-Za-z0-9_.:-]{1,64}$/;function i(e){return"string"==typeof e&&r.test(e)?e:void 0}},4654:(e,t,n)=>{"use strict";n.d(t,{JK:()=>c,Tl:()=>p,Ym:()=>m});var r=n(2115);let i={en:n(9375).en,uk:{"common.serverUnavailable":"сервер недоступний","common.loading":"завантаження…","common.loadingCap":"Завантаження…","common.cancel":"Скасувати","common.edit":"змінити","common.show":"показати","common.showAll":"показати все","common.collapse":"згорнути","common.copy":"Копіювати","common.copied":"скопійовано","common.clickToCopy":"клік — скопіювати","common.yes":"Так","common.no":"Ні","common.send":"Надіслати","common.sending":"надсилаю…","common.sent":"надіслано","common.close":"Закрити","common.failedSend":"не вдалося надіслати","common.failedDelete":"не вдалося видалити","common.nothingFound":"Нічого не знайдено","common.nothingRunning":"зараз нічого не працює","common.kb":"кБ","common.chars":"{n} симв.","lang.aria":"Мова інтерфейсу","util.effortTitle":"Зусилля міркування: {effort}","runtimeConfig.model":"Модель активного агента","runtimeConfig.effort":"Зусилля міркування активного агента","runtimeConfig.speedTitle":"Fast використовує пріоритетний рівень Codex","runtimeConfig.apply":"Застосувати","runtimeConfig.failed":"Не вдалося змінити конфігурацію активного агента","runtimeConfig.pending":"зміна очікує","runtimeConfig.applied":"Налаштування розмови застосовано","time.agoSec":"{n} с тому","time.agoMin":"{n} хв тому","time.agoHour":"{n} год тому","time.agoDay":"{n} д тому","turn.worked":"Працював {d}","turn.running":"працює {d}","turn.lastRun":"останній прогін: {d}","turn.timer":"час роботи","cardStatus.needsYou":"потребує вас","cardStatus.held":"притримано","cardStatus.running":"працює","cardStatus.queued":"у черзі","cardSwitch.pending":"очікує перемикання","cardSwitch.pendingTo":"\xab{label}\xbb очікує","cardSwitch.switching":"перемикання…","cardSwitch.switchingTo":"→ \xab{label}\xbb","cardSwitch.failed":"збій перемикання","cardSwitch.route":"\xab{from}\xbb → \xab{to}\xbb","kind.session":"сесія","kind.subagent":"субагент","kind.job":"джоба","kind.background":"фон","kind.handoff":"хендофф","rail.title":"Логи агентів","rail.filter":"Фільтр проєктів…","rail.projects":"Проєкти","rail.overview":"Огляд","rail.archive":"Архів","rail.crown":"Коронувати — закріпити зверху","rail.uncrown":"Зняти корону","rail.createProject":"Створити проєкт","rail.newProjectName":"Назва проєкту","rail.newProjectRoot":"Коренева тека (абсолютний шлях)","rail.create":"Створити","rail.creating":"Створення…","rail.invalidName":"Вкажіть назву проєкту","rail.invalidRoot":"Теку не знайдено","rail.missingRoot":"Такої теки ще немає","rail.createRootAndProject":"Створити теку і проєкт","rail.mkdirFailed":"Не вдалося створити теку","rail.duplicateProject":"Такий проєкт уже існує","rail.createFailed":"Не вдалося створити проєкт","dash.branchesLive":{one:"{count} гілка працює",few:"{count} гілки працюють",many:"{count} гілок працюють",other:"{count} гілок працюють"},"dash.trees":{one:"{count} дерево",few:"{count} дерева",many:"{count} дерев",other:"{count} дерев"},"dash.recentConvos":{one:"{count} нещодавня розмова",few:"{count} нещодавні розмови",many:"{count} нещодавніх розмов",other:"{count} нещодавніх розмов"},"dash.quietTrees":{one:"{count} тихе дерево",few:"{count} тихі дерева",many:"{count} тихих дерев",other:"{count} тихих дерев"},"dash.openProjects":"Відкрити список проєктів","dash.createMenu":"Створити","dash.moreMenu":"Більше дій","dash.soundMenu":"Звукові сповіщення","dash.unarchive":"Повернути з архіву","dash.newConvo":"Нова розмова з агентом","dash.agent":"Агент","dash.newWorkflow":"Новий воркфлоу: етапи → ревью → PR","dash.workflow":"Воркфлоу","dash.task":"Задача","dash.newTask":"Нова задача","dash.pipelinesUnavailable":"Пайплайни тимчасово недоступні: файл стану пайплайнів не вдалося прочитати. Решта панелей працює.","dash.loadingBoard":"Завантаження дошки…","dash.emptyTitle":"На схемі поки порожньо","dash.emptyHint":"Відкрий пульт у правому нижньому куті і клікни розмову — вона з'явиться тут","dash.viewScheme":"схема","dash.viewList":"розмови","dash.viewSchemeMenu":"Вигляд: схема","dash.viewListMenu":"Вигляд: розмови","dash.viewMenuGroup":"Вигляд дошки","dash.hiddenShelf":"Приховане","trash.title":"Кореневі розмови","trash.hint":"Клік по рядку відкриває розмову нодою; смітник видаляє її файл з диска назавжди.","trash.deletedFromDisk":"\xb7 видалено з диска","trash.open":"Відкрити {title}","trash.activeSubtree":"має активні гілки","trash.toArchive":"В архів","trash.notDeleted":"не видалено {failed} з {total}","trash.confirmDelete":{one:"Видалити з диска {count} файл проєкту?",few:"Видалити з диска {count} файли проєкту?",many:"Видалити з диска {count} файлів проєкту?",other:"Видалити з диска {count} файлів проєкту?"},"trash.deleting":"видаляю…","trash.confirmYes":"Так, видалити","trash.deleteProject":"Видалити проєкт з диска","trash.projectLoadFailed":"Не вдалося завантажити всі розмови проєкту","list.title":"Усі розмови","list.hint":"Завантажуються сторінками від найновіших з усіх розмов цього проєкту на диску.","list.searchHint":"Пошук у всіх розмовах на диску в усіх проєктах.","list.loadMore":"Завантажити більше розмов","list.failed":"Не вдалося завантажити розмови","list.retry":"Повторити","search.open":"Пошук моїх повідомлень (/)","search.openMobile":"Пошук моїх повідомлень","search.title":"Знайти мої повідомлення","search.aria":"Глобальний пошук повідомлень","search.placeholder":"Шукати серед усього надісланого…","search.mine":"Мої повідомлення","search.everything":"Усе","search.speakerAria":"Обсяг пошуку","search.hint":"Почни вводити, щоб шукати серед усього надісланого — у всіх проєктах, рушіях і акаунтах.","search.keysHint":"↑ ↓ — переміщення \xb7 Enter — відкрити \xb7 Esc — закрити","search.results":"Результати","search.updating":"оновлення…","search.loadMore":"Ще результати","search.none":"Нічого не знайдено за \xab{query}\xbb","search.corpus":"Переглянуто {messages} у {conversations}","search.corpusMessages":{one:"{formatted} повідомлення",few:"{formatted} повідомлення",many:"{formatted} повідомлень",other:"{formatted} повідомлень"},"search.corpusConversations":{one:"{formatted} розмові",few:"{formatted} розмовах",many:"{formatted} розмовах",other:"{formatted} розмовах"},"search.everythingInstead":"Шукати серед усього","search.failed":"Пошук не вдався","search.retry":"Повторити","search.untitled":"(без назви)","search.speaker.you":"ви","search.speaker.agent":"агент","search.close":"Закрити пошук","switch.aria":"Пульт агентів","switch.title":"Пульт","switch.search":"Пошук за назвою, першим промптом або проєктом","switch.results":"Усі знайдені розмови","switch.updating":"оновлення…","switch.close":"Закрити пульт","switch.waiting":"Чекає тебе","switch.working":"Працюють","switch.recent":"Нещодавні","switch.older":"Старіше","switch.hidden":"Приховані ({count})","switch.hide":"сховати","switch.restore":"повернути","accounts.activeAria":"Активний акаунт Codex","accounts.placeholder":"Акаунт Codex","accounts.add":"Додати","accounts.prompt":"Назва акаунта","accounts.login":"вхід","accounts.switchFailed":"Не вдалося змінити акаунт","accounts.conversationTitle":"Запустити цю розмову через","accounts.conversationPending":"Зміна акаунта очікує","accounts.conversationApplied":"Акаунт розмови змінено","accounts.conversationUnconfirmed":"Зміна акаунта без підтвердження — спробуйте ще раз","accounts.manage":"Керувати акаунтами…","accounts.addFailed":"Не вдалося додати акаунт","accounts.loginOpened":"Вхід через пристрій відкрито в {target}","accounts.openLogin":"Відкрити вхід","accounts.refreshFailed":"Не вдалося оновити акаунти. Спробуй ще раз.","accounts.loading":"Завантаження акаунтів…","accounts.noAccounts":"Акаунтів поки немає.","limits.accountLoading":"Завантаження лімітів акаунта…","accounts.retry":"Повторити","accounts.title":"Акаунти Codex","accounts.trigger":"Акаунти","accounts.active":"активний","accounts.needsLogin":"потрібен вхід","accounts.pendingLogin":"вхід…","accounts.auth.authenticated":"Авторизовано","accounts.auth.signedOut":"Вихід виконано","accounts.auth.unknown":"Вхід не перевірено","accounts.auth.error":"Помилка входу","accounts.operation.refresh":"Оновлюємо акаунти…","accounts.operation.add":"Починаємо вхід в акаунт…","accounts.operation.switch":"Змінюємо акаунт для майбутніх запусків…","accounts.operation.login":"Оновлюємо стан входу…","accounts.operation.remove":"Видаляємо акаунт…","accounts.operation.terminal":"Готуємо команду акаунта…","accounts.terminalCopied":"Команду скопійовано для {label}","accounts.terminalFailed":"Не вдалося підготувати команду для {label}","accounts.copyCli":"Копіювати CLI","accounts.copyCliAria":"Скопіювати команду агента для {label}","accounts.labelPlaceholder":"Назва нового акаунта","accounts.confirmAdd":"Додати","accounts.close":"Закрити","accounts.remove":"Видалити","accounts.removeAria":"Видалити {label}","accounts.removeConfirm":"Видалити цей акаунт? Минулі розмови залишаться доступними.","accounts.removeConfirmCta":"Підтвердити","accounts.removeConfirmCancel":"Скасувати","accounts.removeBlocked":"Для {label} ще є активна сесія або вхід.","accounts.removeHistoryBlocked":"{label} має активні розмови. Дочекайтеся їх завершення, а потім видаліть акаунт.","accounts.removeFailed":"Не вдалося видалити цей акаунт.","accounts.cleanupPending":"{label} видалено. Локальні дані ще потрібно очистити.","accounts.cleanupManual":"Частина локальних даних акаунта не пройшла перевірку безпеки. Перевірте й видаліть її вручну.","accounts.cleanupFailed":"Не вдалося очистити покинуті теки.","accounts.forceRemove":"Видалити примусово","accounts.cleanupOrphans":"Очистити покинуті теки","accounts.titleFor":"Акаунти {engine}","accounts.triggerAria":"Акаунти {engine} — змінити або додати","accounts.effective":"{pct}%","accounts.effectiveTip":"{window} обмежує","accounts.effectiveStale":"{window} обмежує \xb7 застаріло","accounts.limitsAria":"Вікна лімітів для {label}","accounts.limitsChecked":"Перевірено","accounts.limitsStale":"Останні відомі значення","accounts.limitsStaleTip":"Останні відомі значення — не наживо","accounts.claudeLoginStarted":"Вхід для {label} розпочато","accounts.claudeLogin.starting":"Починаємо вхід…","accounts.claudeLogin.awaitingBrowser":"Очікуємо посилання для входу…","accounts.claudeLogin.openLink":"Відкрити вхід claude.ai","accounts.claudeLogin.codeLabel":"Код авторизації","accounts.claudeLogin.codePlaceholder":"Встав код із браузера","accounts.claudeLogin.codeHint":"Після входу скопіюй код зі сторінки claude.ai і встав його сюди.","accounts.claudeLogin.submit":"Надіслати код","accounts.claudeLogin.verifying":"Перевіряємо…","accounts.claudeLogin.canceling":"Скасовуємо…","accounts.claudeLogin.cancel":"Скасувати","accounts.claudeLogin.signIn":"Увійти","accounts.claudeLogin.groupAria":"Вхід для {label}","accounts.claudeLogin.err.timed_out":"Час на вхід вичерпано.","accounts.claudeLogin.err.interrupted":"Вхід перервано перезапуском.","accounts.claudeLogin.err.verification_failed":"Не вдалося перевірити код.","accounts.claudeLogin.err.input_failed":"Не вдалося надіслати код.","accounts.claudeLogin.err.login_busy":"Інший вхід уже триває.","accounts.claudeLogin.err.generic":"Не вдалося почати вхід. Спробуй ще раз.","accounts.claudeLogin.announceCodeReady":"Посилання для входу {label} готове. Відкрий його і встав код.","accounts.claudeLogin.announceDone":"{label}: вхід виконано.","migrate.confirmTitle":"Перемкнути {engine} на \xab{label}\xbb?","migrate.confirmBody":"Нові агенти одразу використовують \xab{label}\xbb. {idle} активних сесій перемкнуться зараз; {busy} — після поточного ходу; {deferred} неактивних розмов — під час наступного повідомлення.","migrate.confirmCta":"Перемкнути акаунт","migrate.confirmAllCta":"Мігрувати всі ({total})","migrate.confirmCancel":"Скасувати","migrate.retargetTitle":"Перенаправити міграцію на \xab{label}\xbb?","migrate.retargetBody":"Міграція на \xab{current}\xbb ще триває. Нові агенти одразу використовуватимуть \xab{label}\xbb; активні сесії буде перенаправлено, неактивні розмови перейдуть під час наступного повідомлення. \xabМігрувати всі\xbb одразу охопить відкладену історію та вже перенесені розмови.","migrate.banner":"Міграція на \xab{label}\xbb — {done}/{total} готово","migrate.bannerWaiting":"{n} чекають завершення ходу","migrate.bannerFailed":"{n} з помилкою","migrate.bannerAria":"Хід міграції {engine}","migrate.stop":"Зупинити міграцію","migrate.bannerRetryFailed":"Повторити невдалі ({n})","migrate.stoppedNotice":"Міграцію зупинено. Решта сесій лишається на своєму акаунті; нові агенти й далі використовують \xab{label}\xbb.","migrate.failedNotice":"{n} сесій не вдалося перенести на \xab{label}\xbb.","migrate.completeNotice":"Усі сесії {engine} тепер на \xab{label}\xbb","migrate.announceComplete":"Усі сесії {engine} тепер на {label}","migrate.cardPending":"Очікує зміни акаунта — після поточного ходу","migrate.cardSwitching":"Перемикання на \xab{label}\xbb…","migrate.cardSwitchingUnnamed":"Змінюємо акаунт…","migrate.cardFailed":"Не вдалося змінити акаунт","migrate.cardRetry":"Повторити","migrate.cardKeep":"Лишити на \xab{label}\xbb","migrate.ribbonAria":"Стан міграції акаунта","migrate.divider":"Продовжено з \xab{label}\xbb — попередній запис в архіві","migrate.openPrevious":"Відкрити попередній запис","migrate.heldSend":"Повідомлення утримано — надійде після перемикання","migrate.readOnlyPredecessor":"В архіві — розмову продовжено під \xab{label}\xbb","migrate.retryFailed":"Не вдалося повторити перемикання","migrate.keepFailed":"Не вдалося лишити цю сесію на поточному акаунті","migrate.recoveryFailed":"{detail}","autobalance.title":"Автобаланс","autobalance.desc":"Перемикає сесії цього рушія, коли активний акаунт падає нижче {threshold}%, а інший має більше.","autobalance.toggleAria":"Автобаланс для {engine}","autobalance.idle":"Остання перевірка {time} \xb7 перемикання не потрібне","autobalance.waitingFresh":"Пауза — очікуємо свіжі дані квоти","autobalance.cooldown":"Пауза після перемикання — наступна перевірка за {n} хв","autobalance.draining":"Балансування…","autobalance.switched":"Перемкнуто на \xab{to}\xbb о {time} — \xab{from}\xbb впав до {pct}% ({window})","autobalance.bannerTag":"Авто","autobalance.override":"Автобаланс пропонував \xab{to}\xbb; ваш вибір має пріоритет.","limits.windowSession":"вікно 5 год","limits.windowWeekly":"тижневе вікно","switchCard.openColumn":"Відкрити колонкою {title}","switchCard.remove":"Прибрати з пульта","composer.imagesCount":{one:"{count} картинка",few:"{count} картинки",many:"{count} картинок",other:"{count} картинок"},"composer.spawned":"запущено агента в tmux {target}","composer.sentPaths":"надіслано {count} шлях(и)","composer.failedInterrupt":"не вдалося перервати","composer.escapeSent":"надіслано Escape — агент перервано","composer.escapeSentWaiting":"надіслано Escape — чекаємо, поки агент зупиниться","composer.spawnAria":"Запустити агента з промптом","composer.resolvingAria":"Повідомлення наявному агенту — доставка почнеться після відновлення його хоста","composer.sendAria":"Надіслати повідомлення агенту в tmux {target}","composer.sendStructuredAria":"Надіслати повідомлення через структурований runtime-хост","composer.queueAria":"Черга надісланих повідомлень","composer.removeFromQueue":"Прибрати з черги","composer.deliveryHeld":"Притримано для \xab{label}\xbb — доставиться після зміни акаунта","composer.deliveryHeldUnnamed":"Притримано — доставиться після зміни акаунта","composer.deliveryHeldWaiting":"Притримано — очікує доставки","composer.admissionTimedOut":"Час очікування підтвердження вичерпано. Перевіряємо надійну квитанцію; повідомлення збережено.","composer.deliveryUnconfirmed":"Не вдалося підтвердити доставку. Повідомлення збережено — надішліть ще раз, щоб безпечно повторити; той самий ключ повідомлення буде використано.","composer.runtimePill":"Модель і міркування — застосується до наступного повідомлення","composer.reasoningGroup":"Міркування","composer.modelGroup":"Модель","composer.speedGroup":"Швидкість","composer.speedStandard":"Стандартна","composer.speedFastTier":"Швидка — пріоритетний тариф","composer.backTo":"Назад","composer.nextMessageUses":"Наступне повідомлення: {model} \xb7 {effort}","composer.settingsNextResume":"застосується під час наступного відновлення розмови","composer.structuredImagesUnavailable":"Структуровані розмови поки не підтримують картинки","composer.codexImagesTextOnly":"Обрана модель Codex приймає лише текст.","composer.structuredImagesProtocol":"Цей структурований хост не узгодив підтримку зображень.","composer.imagesBlockedDuringRecovery":"Зображення з чернетки буде надіслано після відновлення хоста; текст можна надіслати вже зараз.","composer.imageCapabilityLoading":"Завантажуємо дані про підтримку зображень.","composer.imageCapabilityError":"Не вдалося завантажити дані про підтримку зображень.","composer.imageCapabilityRetry":"Повторити перевірку зображень","composer.attachTerminal":"Відкрити термінал для перегляду","composer.attachTerminalReady":"термінал для перегляду готовий у tmux {target}","composer.attachTerminalFailed":"не вдалося створити термінал для перегляду","composer.receiptHeld":"притримано","composer.receiptQueued":"у черзі","composer.receiptRecovering":"відновлення","composer.receiptFailed":"не доставлено","composer.deliveredEcho":"Доставлено — зʼявиться у стрічці","composer.retrySend":"Надіслати ще раз","composer.placeholderRelay":"написати — передам через кореневу сесію…","composer.placeholderSpawn":"промпт — агент запуститься…","composer.placeholderResolving":"написати агенту — відновлюємо з'єднання з сесією…","composer.placeholderSend":"написати агенту…","composer.placeholderOrchestrator":"що зробити в {project}?","composer.textAria":"Текст для агента","composer.optionsShow":"Показати параметри повідомлення","composer.optionsHide":"Сховати параметри повідомлення","composer.titleRelay":"передасться через кореневу сесію гілки","composer.titleSpawnResumed":"запустить новий сеанс агента, який продовжить цю розмову","composer.root":"корінь","composer.interruptAria":"Перервати агента (Escape)","composer.interruptTitle":"надіслати Escape у пейн агента","composer.compactAria":"Стиснути контекст агента (/compact)","composer.compactTitle":"надіслати /compact — агент стисне контекст; після завершення у стрічці з'явиться позначка","composer.compactConfirm":"Точно?","composer.compactConfirmTitle":"Натисни ще раз, щоб надіслати /compact","composer.compactSent":"стискання почалось — позначка з'явиться у стрічці, щойно завершиться","composer.failedCompact":"не вдалося запустити стискання","composer.addImages":"Додати картинки","composer.moreTools":"Додаткові дії","composer.stopAndSend":"Зупинити запис і надіслати","composer.launchAgent":"Запустити агента","composer.sendToAgent":"Надіслати агенту","composer.stopAndSendTitle":"зупинити запис і надіслати","composer.sendMenuTitle":"Дії відправки","composer.quickAck":"Так, продовжуй","composer.quickAckLabel":"Продовжити","composer.quickAckAria":"Надіслати агенту швидке \xabТак, продовжуй\xbb","composer.quickAckTitle":"Швидка відповідь — так, продовжуй","spawnCard.starting":"Запуск прийнято. Агент запускається.","spawnCard.binding":"Ідентифікатор агента створено. Під’єднуємо структурований хост.","spawnCard.queued":"Структурований хост готовий. Перше повідомлення в черзі.","spawnCard.reconciling":"Доставка узгоджується зі структурованим хостом.","spawnCard.recoverable-timeout":"Тайм-аут першого повідомлення можна відновити, поки збережена доставка завершується.","spawnCard.live-late-success":"Пізня доставка успішна, активну розмову приєднано.","spawnCard.failed":"Запуск завершився з помилкою.","spawnCard.recovered":"Запуск відновлено за збереженими даними.","spawnCard.initial.pending":"Перше повідомлення: очікує на під’єднання хоста","spawnCard.initial.queued":"Перше повідомлення: у черзі","spawnCard.initial.delivered":"Перше повідомлення: доставлено","spawnCard.initial.failed":"Перше повідомлення: помилка доставки","spawnCard.retrySafe":"Цей запуск завершено. Можна створити нову спробу.","spawnCard.pinUnavailableFallback":"Запущено на іншому акаунті — pin недоступний","spawnCard.pinUnavailableQueued":"Квоту закріпленого акаунта вичерпано — запуск у черзі до {retryAt}","spawnCard.launch":"Запуск {id}","spawnChip.starting":"Запускається","spawnChip.binding":"Під’єднання хоста","spawnChip.queued":"Хост готовий","spawnChip.reconciling":"Узгодження","spawnChip.recoverable-timeout":"Завершується","spawnChip.live-late-success":"Пізня доставка успішна","spawnChip.failed":"Запуск не вдався","spawnChip.recovered":"Запущено","spawnChip.initial.pending":"Перше повідомлення: очікує","spawnChip.initial.queued":"Перше повідомлення: у черзі","spawnChip.initial.delivered":"Перше повідомлення: доставлено","spawnChip.initial.failed":"Перше повідомлення: помилка","outbox.queueAria":"Повідомлення, що очікують доставки","outbox.queued":"У черзі","outbox.delivering":"Доставляється","outbox.heldForSwitch":"Притримано для \xab{label}\xbb — доставиться після перемикання","outbox.heldForSwitchUnnamed":"Притримано — доставиться після зміни акаунта","outbox.delivered":"Доставлено","outbox.failed":"Не доставлено","outbox.cancel":"Скасувати це повідомлення","outbox.retry":"Повторити надсилання цього повідомлення","outbox.reattach":"Не надіслано — додайте зображення знову та надішліть","strip.live":"наживо","strip.resume":"відновити","strip.deadMode":"мертвий хост","strip.moreActions":"Більше дій","strip.stopSubagent":"перериває кореневого агента","strip.compactSubagent":"недоступно для субагентів","strip.structuredUnsupported":"структурований хост поки не підтримує цю дію","strip.compactEngineUnsupported":"цей двигун не має команди стиснення","strip.compactBusyTurn":"недоступно, поки триває хід","strip.resolving":"визначаємо середовище агента…","deadHost.title":"Агент неактивний \xb7 {since} — повідомлення підуть у чергу","deadHost.body":"Текст, надісланий зараз, надійно зберігається і буде доставлений після відновлення хоста. Зображення не можна додати, доки хост не повернеться. Очікувані підтвердження застаріли — відновіть роботу елементами керування нижче.","deadHost.respawn":"Відновити розмову","deadHost.attach":"Відкрити в терміналі","deadHost.recheck":"Перевірити знову","deadHost.recheckFailed":"Не вдалося зʼєднатися зі середовищем — спробуйте ще раз.","strip.recheckHint":"Перевірити хост середовища ще раз","deadHost.respawnFailed":"Не вдалося перезапустити — спробуйте ще раз.","deadHost.sendBlocked":"хост мертвий — відновіть, щоб продовжити","deadHost.expiredCard":"застаріло — хост помер, перш ніж на це відповіли","superseded.title":"Раунд замінено \xb7 {since}","superseded.body":"Відновлення замінило цей раунд живим наступником. Ця розмова лишається як історія раундів.","superseded.open":"Відкрити живий раунд","superseded.resumeHere":"Продовжити тут","superseded.resumeConfirm":"Продовжити цей закритий раунд? Це розгалужить роботу: картка знову стане живою поруч із наступником.","superseded.resumeFailed":"Не вдалося зняти звʼязок заміни — спробуйте ще раз.","superseded.sendBlocked":"раунд замінено — відкрийте живий наступник","lineage.continues":"раунд {round} \xb7 продовжує попередній","lineage.continuesTitle":"Раунд {round}: продовжує замінений попередній раунд — натисніть, щоб відкрити його","attach.dialogTitle":"Підключитися у своєму терміналі","attach.dialogIntro":"Запускає цю розмову у вашому власному терміналі з тим самим акаунтом ({account}) і робочою директорією.","attach.copyCwd":"Скопіювати робочу директорію","attach.copyCommand":"Скопіювати команду","attach.copyFull":"Скопіювати повну команду","attach.copiedFull":"Повну команду скопійовано в буфер","attach.takeoverWarning":"Відновлення тут перебирає розмову у переглядача.","attach.subagentNote":"Субагенти відновлюються через свою кореневу сесію.","attach.secondaryViewer":"Відкрити панель перегляду лише для читання в tmux","attach.secondaryFailed":"Не вдалося відкрити панель перегляду — спробуйте ще раз.","receipt.human.deadHost":"хост агента помер","receipt.human.staleKey":"ключ доставки застарів","receipt.human.duplicate":"вже доставлено","receipt.human.turnActive":"агент посеред ходу","receipt.human.noTurn":"немає активного ходу","receipt.human.unsupportedCapability":"цей двигун не має такої команди","receipt.human.verbatim":"не доставлено: {reason}","draft.readPrompt":"Прочитай розмову агента у файлі {src} і продовж роботу звідти: ","draft.needDir":"вкажи робочу директорію","draft.launchFailed":"не вдалося запустити","draft.paneAria":"Чернетка нової розмови з агентом","draft.notStarted":"агент ще не запущений","draft.engineAria":"Двигун агента","draft.accountAria":"Обліковий запис {engine} для цього запуску","draft.accountDefault":"{label} \xb7 активний","draft.accountNeedsLogin":"{label} \xb7 потрібен вхід","draft.handoffLabel":"хендофф: {title}","draft.newConvo":"нова розмова","draft.conversation":"розмова","draft.dismiss":"Прибрати чернетку розмови","draft.directory":"директорія","draft.dirAria":"Робоча директорія агента","dirPicker.empty":"директорію не вибрано","dirPicker.searchAria":"Відфільтруй відомі директорії або впиши шлях","dirPicker.searchPlaceholder":"фільтр або власний шлях","dirPicker.listAria":"Відомі робочі директорії","dirPicker.current":"поточна","dirPicker.useTyped":"взяти цей шлях","dirPicker.noMatch":"нічого не збігається — впиши шлях, щоб узяти власний","dirPicker.noneKnown":"відомих директорій ще немає — впиши шлях","dirPicker.count":"{shown} з {total} директорій","draft.reasoning":"міркування","draft.role":"роль","draft.roleAria":"Рольовий пресет агента","draft.noRole":"Без ролі","draft.roleParameters":"Параметри ролі","draft.safetyFences":"Запобіжники безпеки","draft.roleNeedsParams":"заповніть обов'язкові параметри ролі","draft.reviews":"розмова для ревʼю","draft.reviewsAria":"Розмова для ревʼю","draft.reviewsPlaceholder":"Оберіть розмову","draft.reviewerNeedsConversation":"оберіть розмову, яку перевірятиме ревʼюер","draft.deployConfirm":"Введіть deploy, щоб підтвердити цей план деплою","draft.modelAria":"Модель агента","draft.modelDefault":"модель: типова","draft.reasoningAria":"Глибина міркувань агента","draft.effortDefault":"міркування: типові","draft.speedAria":"Режим швидкості Codex","draft.speedTitle":"fast = priority tier (1.5x швидкість, більша витрата лімітів)","draft.speedDefault":"швидкість: дефолт","draft.imagesOnly":"(картинки)","draft.launched":"агент запущений у tmux {target} — чекаю, поки розмова з'явиться тут…","draft.launchedStructured":"агент запущений — чекаю, поки розмова з'явиться тут…","draft.slow":"Щось довго. Перевір вікно tmux {target} — щойно транскрипт з'явиться, панель підхопить його сама.","draft.slowStructured":"Щось довго. Щойно транскрипт з'явиться, панель підхопить його сама.","draft.confirming":"Запущено — підтверджую агента в tmux {target}. Не надсилай ще раз; панель підхопить розмову, щойно з'явиться її транскрипт.","draft.confirmingStructured":"Запущено — підтверджую агента. Не надсилай ще раз; панель підхопить розмову, щойно з'явиться її транскрипт.","draft.confirmingNoTarget":"Підтверджую, чи запустився агент. Не надсилай ще раз — панель підхопить розмову, щойно з'явиться її транскрипт.","draft.confirmingSlow":"Запускається повільно — запуск підтверджено в tmux {target}. Панель стежить далі й підхопить розмову сама; не запускай ще раз.","draft.confirmingSlowStructured":"Запускається повільно — запуск підтверджено. Панель стежить далі й підхопить розмову сама; не запускай ще раз.","draft.attention":"Агент, можливо, вже працює в tmux {target}. Не запускай його ще раз. Прибери цю чернетку, коли перевіриш; вона все одно підхопиться автоматично, щойно з'явиться транскрипт.","draft.attentionStructured":"Агент, можливо, вже працює. Не запускай його ще раз. Прибери цю чернетку, коли перевіриш; вона все одно підхопиться автоматично, щойно з'явиться транскрипт.","draft.attentionNoTarget":"Агент, можливо, вже працює — перевір свої вікна tmux. Не запускай його ще раз. Прибери цю чернетку, коли перевіриш; вона все одно підхопиться автоматично, щойно з'явиться транскрипт.","draft.hintRelay":"Новий агент спершу прочитає транскрипт батьківської розмови і продовжить з того місця. Допиши в промпт, що зробити далі, — гілка з'явиться на схемі поруч.","draft.hintNew":"Обери двигун і директорію, напиши перший промпт — агент запуститься в tmux, і розмова продовжиться в цій самій панелі.","draft.hintNewStructured":"Обери двигун і директорію, напиши перший промпт — агент запуститься, і розмова продовжиться в цій самій панелі.","draft.promptAria":"Перший промпт для нового агента","draft.placeholder":"перший промпт — агент запуститься в tmux…","draft.placeholderStructured":"перший промпт — агент запуститься…","draft.promptTextAria":"Текст першого промпта","draft.newWindowTitle":"нове tmux-вікно зі свіжим агентом","draft.newWindowTitleStructured":"нова структурована сесія зі свіжим агентом","draft.newAgent":"новий агент","draft.addImages":"Додати картинки до промпта","draft.stopAndLaunch":"Зупинити запис і запустити агента","draft.rolePromptToggle":"Промпт ролі (EN)","draft.speedFast":"швидкий","draft.speedStandard":"стандартний","effortTier.minimal":"мінімальні","effortTier.low":"низькі","effortTier.medium":"середні","effortTier.high":"високі","effortTier.xhigh":"дуже високі","effortTier.max":"максимальні","effortTier.ultra":"ультра","reasoningTier.minimal":"Мінімальні","reasoningTier.low":"Легкі","reasoningTier.medium":"Середні","reasoningTier.high":"Високі","reasoningTier.xhigh":"Дуже високі","reasoningTier.max":"Максимальні","reasoningTier.ultra":"Ультра","roleCopy.orchestrator.name":"Оркестратор","roleCopy.orchestrator.description":"Координує нових агентів через панель керування Viewer.","roleCopy.orchestrator.param.mode.label":"Режим","roleCopy.orchestrator.param.mode.description":"Режим роботи координаційного запуску.","roleCopy.orchestrator.param.mode.option.standard":"стандартний","roleCopy.orchestrator.param.mode.option.plan-tickets":"план у тікети","roleCopy.orchestrator.param.mode.option.wayfind":"розвідка","roleCopy.orchestrator.param.mode.option.backlog-campaign":"кампанія по беклогу","roleCopy.orchestrator.param.repo.label":"Репозиторій","roleCopy.orchestrator.param.repo.description":"Репозиторій для кампанії по беклогу.","roleCopy.orchestrator.param.issueQuery.label":"Запит задач","roleCopy.orchestrator.param.issueQuery.description":"GitHub-запит задач для кампанії по беклогу.","roleCopy.orchestrator.param.urgent.label":"Термінові","roleCopy.orchestrator.param.urgent.description":"Список термінових задач через кому.","roleCopy.orchestrator.param.maxWorkers.label":"Максимум воркерів","roleCopy.orchestrator.param.maxWorkers.description":"Ліміт воркерів для кампанії по беклогу.","roleCopy.orchestrator.param.mergePolicy.label":"Політика злиття","roleCopy.orchestrator.param.mergePolicy.description":"Спосіб доставлення для кампанії по беклогу.","roleCopy.orchestrator.param.mergePolicy.option.pr":"пул-реквест","roleCopy.orchestrator.param.mergePolicy.option.merge":"мердж","roleCopy.orchestrator.param.completionPolicy.label":"Політика завершення","roleCopy.orchestrator.param.completionPolicy.description":"Умова завершення кампанії по беклогу.","roleCopy.orchestrator.param.completionPolicy.option.pr-opened":"відкрито PR","roleCopy.orchestrator.param.completionPolicy.option.merged":"змерджено","roleCopy.orchestrator.param.completionPolicy.option.released":"зарелізено","roleCopy.reviewer.name":"Рев'юер","roleCopy.reviewer.description":"Перевіряє диф коду й повертає знахідки з доказами, впорядковані за серйозністю.","roleCopy.reviewer.param.diffSource.label":"Джерело дифу","roleCopy.reviewer.param.diffSource.description":"Диф або пул-реквест для перевірки.","roleCopy.reviewer.param.lens.label":"Лінза","roleCopy.reviewer.param.lens.description":"Фокус рев'ю.","roleCopy.reviewer.param.lens.option.correctness":"коректність","roleCopy.reviewer.param.lens.option.over-engineering":"надлишкова інженерія","roleCopy.reviewer.param.lens.option.silent-failure":"тихі збої","roleCopy.reviewer.param.lens.option.test-coverage":"покриття тестами","roleCopy.reviewer.param.lens.option.scope":"межі задачі","roleCopy.reviewer.param.lens.option.prod-ops":"прод-експлуатація","roleCopy.reviewer.param.lens.option.standards+spec":"стандарти + спека","roleCopy.reviewer.param.lens.option.code-smells":"код-смелли","roleCopy.reviewer.param.lens.option.all":"усі лінзи","roleCopy.reviewer.param.mode.label":"Режим","roleCopy.reviewer.param.mode.description":"Контекст рев'юера.","roleCopy.reviewer.param.mode.option.fresh":"свіжий контекст","roleCopy.reviewer.param.parallelN.label":"Паралельні проходи","roleCopy.reviewer.param.parallelN.description":"Кількість незалежних проходів рев'ю.","roleCopy.verifier.name":"Верифікатор","roleCopy.verifier.description":"Перевіряє гіпотези й повертає вердикт із доказами по кожному твердженню.","roleCopy.verifier.param.claims.label":"Твердження","roleCopy.verifier.param.claims.description":"Гіпотези, які треба підтвердити або спростувати.","roleCopy.builder.name":"Білдер","roleCopy.builder.description":"Пише продуктовий код за окресленою задачею.","roleCopy.builder.param.mode.label":"Режим","roleCopy.builder.param.mode.description":"Дисципліна імплементації.","roleCopy.builder.param.mode.option.plain":"звичайний","roleCopy.builder.param.mode.option.apply-fixes":"застосувати фікси","roleCopy.builder.param.mode.option.tdd":"TDD","roleCopy.builder.param.mode.option.diagnose":"діагностика","roleCopy.builder.param.mode.option.prototype":"прототип","roleCopy.builder.param.mode.option.merge-resolve":"розв'язати конфлікти","roleCopy.builder.param.domain.label":"Домен","roleCopy.builder.param.domain.description":"Продуктовий домен імплементації.","roleCopy.builder.param.domain.option.general":"загальний","roleCopy.builder.param.domain.option.frontend":"фронтенд","roleCopy.architect.name":"Архітектор","roleCopy.architect.description":"Готує обґрунтований доказами дизайн без правок продукту.","roleCopy.architect.param.mode.label":"Режим","roleCopy.architect.param.mode.description":"Формат архітектурного результату.","roleCopy.architect.param.mode.option.design":"дизайн","roleCopy.architect.param.mode.option.spec":"спека","roleCopy.architect.param.mode.option.architecture-audit":"аудит архітектури","roleCopy.cleaner.name":"Клінер","roleCopy.cleaner.description":"Безпечно відновлює брудний чекаут за контрактом із бекапами.","roleCopy.prod-auditor.name":"Прод-аудитор","roleCopy.prod-auditor.description":"Проводить розслідування на проді лише в режимі читання, з доказами.","roleCopy.prod-auditor.param.questions.label":"Питання","roleCopy.prod-auditor.param.questions.description":"Питання щодо проду для розслідування.","roleCopy.deployer.name":"Деплоєр","roleCopy.deployer.description":"Планує blue/green-деплой і зупиняється для підтвердження перед змінами.","roleCopy.deployer.param.sha.label":"SHA мерджу","roleCopy.deployer.param.sha.description":"SHA змердженого коміту для деплою.","roleCopy.deployer.param.pr.label":"Пул-реквест","roleCopy.deployer.param.pr.description":"Необов'язкове посилання на пул-реквест.","link.handoffContext":"Тобі передали контекст іншого агента — розмову \xab{title}\xbb. Її транскрипт: {path} — спочатку прочитай цей файл, щоб мати повний контекст, а тоді виконай прохання нижче.\n\n{ask}","link.dropped":"контекст у промпті \xab{title}\xbb — допиши прохання і надішли","handoff.aria":"Перекинути розмову новому агентові — чернетка з'явиться нижче","handoff.title":"клік — чернетка нового агента з цим контекстом \xb7 потягни — звʼязати з наявним","handoff.label":"перекинути агенту","qr.showAria":"Показати QR для входу з телефона","qr.failed":"не вдалося отримати посилання","qr.startHint":"Запустіть viewer з доступом через Tailscale: ","qr.alt":"QR код для входу з телефона","qr.generating":"генерую QR…","qr.linkAria":"Посилання для входу з телефона","qr.copy":"Копіювати посилання","qr.scanHint":"скануй з телефона в тому ж tailnet","telegram.title":"Telegram","telegram.rowAria":"Підключення Telegram","telegram.close":"Закрити","telegram.readOnlyNote":"Лише читання \xb7 тільки сесії оператора","telegram.status.disconnected":"Не підключено","telegram.status.starting":"Запуск…","telegram.status.awaiting_scan":"Скануйте QR-код","telegram.status.awaiting_password":"Потрібен пароль","telegram.status.verifying":"Перевірка…","telegram.status.connected":"Підключено","telegram.status.expired":"Сесія завершилась","telegram.status.error":"Помилка","telegram.connect":"Підключити Telegram","telegram.connectHint":"Увійдіть, скануючи QR-код у застосунку Telegram. Viewer зберігає сесію лише на цій машині.","telegram.credentialsHint":"API-креденшали Telegram ще не налаштовані. Введіть api_id та api_hash з my.telegram.org — вони залишаться на цій машині.","telegram.credentialsIdLabel":"API ID","telegram.credentialsHashLabel":"API hash","telegram.credentialsSave":"Зберегти креденшали","telegram.credentialsSource":"Зберігається у власному конфігу Viewer (telegram.json, доступ лише власнику). Змінні середовища, якщо задані, мають пріоритет.","telegram.credentialsInvalid":"Це не схоже на коректну пару api_id + api_hash. Нічого не збережено.","telegram.reconnect":"Перепідключити","telegram.retry":"Повторити","telegram.cancel":"Скасувати","telegram.qrAlt":"QR-код входу в Telegram","telegram.qrGenerating":"генерую QR…","telegram.qrFailed":"Не вдалося згенерувати QR-код.","telegram.qrRetry":"Спробувати QR ще раз","telegram.qrHint":"У Telegram на телефоні: Налаштування → Пристрої → Підключити пристрій, потім скануйте. Прострочений код оновлюється автоматично.","telegram.passwordLabel":"Пароль двоетапної перевірки","telegram.passwordPlaceholder":"Пароль 2FA Telegram","telegram.passwordSubmit":"Надіслати","telegram.passwordInvalid":"Невірний пароль. Спробуйте ще раз.","telegram.passwordHint":"Telegram запитує пароль двоетапної перевірки. Він передається лише в Telegram.","telegram.connectedAs":"Підключено як","telegram.lastCheck":"Перевірено {time}","telegram.expiredHint":"Telegram завершив цю сесію. Перепідключіться, щоб продовжити.","telegram.logout":"Вийти","telegram.logoutConfirm":"Вийти з Telegram і видалити локальну сесію?","telegram.deleteLocal":"Видалити локальну сесію","telegram.deleteLocalConfirm":"Видалити локальну сесію? Віддалена авторизація Telegram може залишитись — видаліть її в Telegram → Пристрої.","telegram.confirmCta":"Підтвердити","telegram.confirmCancel":"Скасувати","telegram.actionFailed":"Не вдалося виконати дію. Спробуйте ще раз; якщо повторюється — закрийте й відкрийте панель.","telegram.actionUnreachable":"Сервер Viewer не відповів. Перевірте з'єднання і спробуйте ще раз.","telegram.err.login_busy":"Інший вхід у Telegram уже триває.","telegram.err.credentials_missing":"API-облікові дані Telegram не налаштовані на цьому хості.","telegram.err.start_failed":"Не вдалося почати вхід.","telegram.err.bridge_failed":"Вхід завершився несподівано.","telegram.err.password_invalid":"Невірний пароль.","telegram.err.network_failed":"Помилка мережі. Спробуйте ще раз.","telegram.err.timed_out":"Час входу вичерпано.","telegram.err.canceled":"Вхід скасовано.","telegram.err.session_unsafe":"Локальне сховище сесії не пройшло перевірку безпеки.","telegram.err.connector_failed":"Не вдалося запустити конектор Telegram.","telegram.err.host_registration_failed":"Не вдалося зареєструвати Telegram у локальних хостах агентів.","telegram.err.not_read_only":"Відмовлено: конектор оголосив інструменти, що не є лише для читання.","telegram.err.logout_failed":"Віддалений вихід не вдався. Можна видалити локальну сесію.","telegram.err.health_failed":"Не вдалося перевірити підключення.","telegram.announceScan":"QR-код Telegram готовий. Скануйте з телефона.","telegram.announcePassword":"Telegram запитує пароль двоетапної перевірки.","telegram.announceConnected":"Telegram підключено.","telegram.report.title":"Щоденний звіт","telegram.report.loading":"Завантаження…","telegram.report.disabledHint":"Раз на день агент читає ваші особисті діалоги та вибрані групи й пише один звіт, який ви читаєте тут.","telegram.report.enable":"Увімкнути щоденний звіт","telegram.report.disable":"Вимкнути","telegram.report.at":"О","telegram.report.zone":"за Києвом","telegram.report.sourcesSummary":{one:"Джерела: активні особисті діалоги + {count} група",few:"Джерела: активні особисті діалоги + {count} групи",many:"Джерела: активні особисті діалоги + {count} груп",other:"Джерела: активні особисті діалоги + {count} груп"},"telegram.report.sourcesEdit":"Групи","telegram.report.sourcesDone":"Готово","telegram.report.sourcesHint":"Особисті діалоги добираються автоматично за свіжою активністю. Оберіть групи: легкий прохід читає лише те, що стосується вас, повний — усю групу.","telegram.report.loadGroups":"Завантажити мої групи","telegram.report.noGroups":"Групи ще не завантажені.","telegram.report.modeLight":"Легкий","telegram.report.modeFull":"Повний","telegram.report.runNow":"Запустити зараз","telegram.report.running":"Виконується…","telegram.report.nextRun":"Далі {time}, {date}","telegram.report.noRuns":"Запусків ще не було.","telegram.report.open":"Відкрити","telegram.report.openRun":"Запуск","telegram.report.openRunTitle":"Відкрити цей запуск на дошці","telegram.report.promptTitle":"Промпт звіту","telegram.report.promptHint":"Ваше завдання для агента звіту: мова, рядок з тегом, розділи, для якого репозиторію пропонувати issues, тон. Редагуйте тут — без релізу.","telegram.report.promptPreamble":"Viewer завжди додає перед вашим текстом вікно, вибрані джерела, шлях виводу та правила послідовного читання. Підключений акаунт він перевіряє сам, перед запуском.","telegram.report.promptEdit":"Промпт","telegram.report.promptSave":"Зберегти промпт","telegram.report.promptReset":"Повернути типовий","telegram.report.promptDefault":"Промпт: типовий шаблон","telegram.report.promptEdited":"Промпт: змінений вами","telegram.report.back":"Назад","telegram.report.status.running":"виконується","telegram.report.status.ok":"звіт","telegram.report.status.quiet":"тиша","telegram.report.status.failed":"збій","telegram.report.status.account-mismatch":"інший акаунт","telegram.report.err.account_mismatch":"Підключений акаунт не той, для якого налаштовано звіт. Нічого не прочитано.","telegram.report.err.not_connected":"Telegram не підключено, тому запуск не відбувся.","telegram.report.err.reports_disabled":"Щоденні звіти вимкнено.","telegram.report.err.run_in_progress":"Запуск звіту вже триває.","telegram.report.err.account_check_failed":"Не вдалося перевірити підключений акаунт, тому нічого не читалося.","telegram.report.err.sources_failed":"Не вдалося отримати список чатів. Можливо, конектор перезапускається.","telegram.report.err.launch_failed":"Не вдалося запустити звіт.","telegram.report.err.run_ended_without_report":"Запуск завершився, не написавши звіт. Спробуйте ще раз.","telegram.report.err.timed_out":"Запуск тривав надто довго й був зупинений.","telegram.report.err.invalid_report":"Запуск записав те, що Viewer не зміг прочитати як звіт.","telegram.report.err.report_missing":"Цей звіт більше не зберігається.","telegram.report.err.transport":"Сервер Viewer не відповів. Спробуйте ще раз.","telegram.report.err.generic":"Не вдалося. Спробуйте ще раз.","push.enabled":"Push-сповіщення увімкнено","push.enable":"Увімкнути push-сповіщення","push.disable":"Вимкнути push-сповіщення","push.needsHttps":"Push потребує HTTPS","sound.on":"Звукові сповіщення увімкнено","sound.off":"Звукові сповіщення вимкнено","sound.mute":"Вимкнути звукові сповіщення","sound.unmute":"Увімкнути звукові сповіщення","sound.settings":"Рівні звуку","sound.cueVolume":"Звукові сигнали","sound.ambientViewer":"Фонова музика у переглядачі","sound.ambient":"Фонова музика під час дзвінка","sound.ambientVolume":"Рівень музики","sound.ambientHint":"Тихо звучить на цьому рівні й стишується під мову під час дзвінка. Якщо ввімкнено обидва, той самий трек продовжує грати через дзвінок.","keepAwake.label":"Не гасити екран","keepAwake.enableAria":"Не давати екрану гаснути на цьому пристрої","keepAwake.disableAria":"Дозволити екрану гаснути на цьому пристрої","keepAwake.off":"Екран гасне за звичайним таймером цього пристрою.","keepAwake.requesting":"Запитую браузер…","keepAwake.active":"Екран не гасне, поки ця вкладка видима. Витрачає більше заряду.","keepAwake.waiting":"Пауза, поки вкладка прихована. Відновиться, коли ви повернетесь.","keepAwake.interrupted":"Система зняла блокування. Вимкніть і ввімкніть, щоб запитати знову.","keepAwake.blocked":"Браузер відмовив у запиті. Екран не втримується.","keepAwake.failed":"Запит не вдався. Екран не втримується.","keepAwake.insecure":"Потрібна адреса HTTPS. Через звичайний HTTP екран втримати не можна.","keepAwake.unsupported":"Цей браузер не має блокування вимкнення екрана.","mic.stopRecognize":"Зупинити запис і розпізнати","mic.cancel":"Скасувати запис","mic.recognizing":"Розпізнаю…","mic.dictate":"Надиктувати","mic.dictateHint":"надиктувати (до 10 хв) \xb7 правий клік: спосіб розпізнавання","mic.timeLeft":"до автостопу {time}","mic.capStopped":"зупинено на 10:00","mic.connecting":"Під'єдную мікрофон — секунду…","mic.menuTitle":"Спосіб розпізнавання","mic.menuLoading":"перевіряю, що доступно…","mic.menuLocked":"Заблоковано змінною середовища LLV_TRANSCRIBE_BACKEND","mic.noKey":"не налаштовано","mic.saveFailed":"не вдалося зберегти вибір","mic.keyTitle":"{name} не налаштовано","mic.copy":"копіювати","mic.copyPath":"Скопіювати шлях","mic.copied":"скопійовано","mic.back":"Назад","stt.local.name":"Faster Whisper","stt.local.desc":"Безкоштовно, повністю локально — аудіо не покидає цю машину.","stt.local.fix":"Запусти scripts/setup-whisper.sh у теці застосунку один раз; він встановить локальний рушій у:","stt.chatgpt.name":"ChatGPT Voice","stt.chatgpt.desc":"У межах підписки ChatGPT, через логін Codex.","stt.chatgpt.fix":"Залогінься в Codex (команда `codex login`) — токен з'явиться у:","stt.elevenlabs.name":"ElevenLabs Scribe","stt.elevenlabs.desc":"Платний API ElevenLabs — найточніший варіант.","stt.elevenlabs.fix":"Поклади свій API-ключ ElevenLabs (одним рядком) у цей файл:","stt.soniox.name":"Soniox","stt.soniox.desc":"Платний API Soniox — найшвидша жива транскрипція.","stt.soniox.fix":"Поклади свій API-ключ Soniox (одним рядком) у цей файл:","delFile.confirm":"Видалити з диска?","delFile.aria":"Видалити розмову з диска","rename.edit":"Перейменувати","rename.editAria":"Перейменувати \xab{title}\xbb","rename.inputAria":"Назва сесії","rename.save":"Зберегти назву","rename.cancel":"Скасувати","rename.reset":"Повернути автоназву","rename.resetHint":"Повернути автоназву: {title}","rename.autoHint":"Автоназва: {title}","rename.retry":"Повторити","rename.saved":"Перейменовано на {title}","rename.conflict":"Назву змінили деінде — застосовано найновішу та повторено","rename.failed":"Не вдалося зберегти назву","img.readFailed":"не вдалося прочитати картинку","img.readAborted":"читання картинки перервано","img.unsupported":"непідтримуваний формат картинки: {name}","img.unknownFile":"невідомий файл","img.tooLarge":"{name}: завелика (ліміт 10 МБ)","img.structuredTooLarge":"Картинка перевищує ліміт цього хоста — {max} МБ","img.tooManyStructured":"За один раз можна надіслати до {max} картинок","img.structuredAggregateTooLarge":"Картинки перевищують ліміт запиту цього хоста — {max} МБ","img.image":"картинка","img.error":"помилка картинки","img.previewAlt":"прев'ю картинки {n}","img.removeAria":"Прибрати картинку {n}","img.readingAria":"завантаження картинки {n}","img.retry":"Повторити","img.retryAria":"Повторити картинку {n}","img.clearAll":"Очистити все","img.clearAllAria":"Прибрати всі картинки","img.blockedReading":"Зачекайте, поки картинка завантажиться…","img.blockedFailed":"Приберіть або повторіть невдалу картинку, щоб надіслати","img.deliveryHint":"додано до повідомлення","question.sec":"{n} с","question.min":"{n} хв","question.hour":"{n} год","question.waiting":"чекає на відповідь","question.sentToPane":"Надіслано в пейн: {text}","question.keysHint":"клавіші в пейн \xb7 або композер нижче","question.pane":"Пейн {target}","question.alreadyAnswered":"відповідь уже записана","question.openFailed":"не вдалося відкрити сесію","question.opened":"відкрито {target}","question.answered":"Відповідено: {text}","question.answeredElsewhere":"Відповідено в іншому місці: {text}","question.noPane":"tmux-пейн недоступний","question.openSession":"відкрити сесію","question.rejectComment":"Коментар до відхилення…","question.approved":"затверджено","question.rejected":"відхилено","question.approve":"Затвердити","question.reject":"Відхилити","question.ownAnswer":"Своя відповідь…","question.dismiss":"Прибрати картку запитання","question.deliveryFailed":"Доставка не вдалася","question.failedChoice":"не доставлено","question.retryAnswer":"Спробувати ще","question.errorNotRunning":"агент більше не працює, тож нічого не доставлено","question.errorMoved":"агент уже пішов далі від цього питання","question.errorUnconfirmed":"відповідь надіслано, але агент її не підтвердив","question.errorNotDelivered":"екран агента не відреагував як очікувалось, тож відповідь не доставлена","question.errorRejected":"вʼювер не зміг зібрати коректну відповідь","inbox.deleted":"видалено з диска","inbox.fileGone":"файла вже немає на диску","inbox.confirmDelete":"Видалити файл з диска?","inbox.deleteAria":"Видалити {name} з диска","inbox.deleteFromDisk":"видалити з диска","inbox.attachedAlt":"вкладена картинка {name}","lightbox.zoomOut":"Зменшити","lightbox.resetZoom":"Скинути масштаб","lightbox.zoomIn":"Збільшити","preview.dialogTitle":"{name} — перегляд документа","preview.close":"Закрити перегляд","preview.download":"Завантажити файл","preview.openExternal":"Відкрити в новій вкладці","preview.resize":"Змінити ширину перегляду","preview.kindPdf":"PDF-документ","preview.kindImage":"Зображення","preview.kindText":"Текстовий файл","preview.kindUnknown":"Файл","preview.loading":"Завантаження…","preview.missing":"Цього файлу вже не існує.","preview.denied":"Доступ до цього файлу заборонено.","preview.unsupported":"Цей тип файлу не можна переглянути.","preview.oversized":"Файл більший за ліміт перегляду.","preview.changed":"Файл змінився на диску після відкриття перегляду.","preview.aborted":"Завантаження скасовано.","preview.error":"Не вдалося завантажити перегляд.","preview.reload":"Перезавантажити","preview.searchPlaceholder":"Пошук у завантаженому тексті","preview.noMatches":"збігів немає","preview.prevMatch":"Попередній збіг","preview.nextMatch":"Наступний збіг","preview.wrapLines":"Переносити рядки","preview.loadMore":"Завантажити ще","preview.loadedOf":"Завантажено {loaded} із {size}","preview.fit":"Вписати","preview.fitImage":"Вписати в панель","preview.fitWidth":"За шириною","preview.prevPage":"Попередня сторінка","preview.nextPage":"Наступна сторінка","preview.pageOf":"Сторінка {page} з {pages}","feed.agentEnded":"агент завершився","feed.copyCode":"Скопіювати код","feed.copyMd":"Скопіювати повідомлення (Markdown)","feed.voiceTurn":"Голос","selectedContext.stale":"застаріле","selectedContext.ariaSelected":"Вибрана картка: {name} (проєкт {project})","feed.voiceContext":"Стенограма дзвінка","feed.speak":"Прочитати відповідь уголос (голос згенеровано ШІ)","feed.stopSpeaking":"Зупинити озвучення","tts.read":"Прочитати відповідь уголос","tts.readPaid":"Прочитати вголос (платно)","tts.replay":"Повторити аудіо відповіді","tts.replayFree":"Повторити вголос (безкоштовно)","tts.triggerTitle":"{action} \xb7 правий клік: голос і оплата","tts.stop":"Зупинити озвучення","tts.menuTitle":"Голос і оплата","tts.menuLocked":"Заблоковано змінною середовища LLV_TTS_BACKEND","tts.nextPaid":"Наступний клік: платне озвучення цієї відповіді","tts.nextFree":"Наступний клік: безкоштовний повтор із кешу","tts.nextStop":"Наступний клік: зупинити читання цієї відповіді","tts.noKey":"не налаштовано","tts.saveFailed":"Не вдалося змінити провайдера голосу","tts.replayExpired":"Кешоване аудіо застаріло — цей повтор буде платним озвученням.","tts.backendChanged":"Провайдер голосу змінився — це читання оплачує {provider}.","tts.characters":"{count} символів","tts.billing":"Оплата з вашого облікового запису {provider} за кожен символ.","tts.disclosure":"Ви почуєте голос, згенерований ШІ, а не голос людини.","tts.tooLong":"Задовге для озвучення (ліміт {count} символів). Нічого не обрізається — озвучте коротший фрагмент.","tts.seekHint":"Клацніть у тексті під час відтворення, щоб перейти до цього місця.","tts.partOf":"Частина {index} з {count}","tts.finished":"Читання завершено","tts.missingKey":"Додайте API-ключ {provider} у {path}","tts.generating":"Створення аудіо…","tts.playing":"Відтворення аудіо","tts.stopped":"Зупинено","tts.configError":"Конфігурація TTS недоступна","tts.requestError":"Помилка запиту TTS ({status})","tts.requestFailed":"Помилка запиту TTS","tts.playError":"Браузер заблокував відтворення аудіо. Спробуйте ще раз.","feed.running":"виконує {tool}…","feed.tool":"інструмент","feed.thinking":"думає…","feed.working":"працює…","feed.liveTail":"живий хвіст","feed.liveOmittedItems":"… ({count} попередніх живих записів, {chars} символів)","feed.liveToolArgsOmitted":"аргументи пропущено","feed.liveToolOutcomeOmitted":"результат пропущено","feed.liveOmittedChars":"… (+{chars} символів)","feed.backToLive":"Повернутись до живого хвоста","feed.newCount":"{count} нових","feed.down":"вниз","feed.pickLog":"Вибери лог зліва — стрічка оновлюється сама","feed.showEarlier":"показати раніше","feed.showEarlierHidden":"показати раніше (сховано {count})","feed.loadEarlier":"завантажити раніше з файлу","feed.startOfConvo":"початок розмови","feed.finishedTurn":"закінчив хід — чекає відповіді","feed.returnedResult":"повернувся з результатом","feed.noOutput":"Ще без виводу — файл поки порожній","feed.onlyService":"Є лише службові записи ({count}).","feed.empty":"Порожньо (немає рядків для показу)","render.system":"системне","render.executing":"виконується…","render.error":"помилка","render.teammate":"тімейт","render.left":"{peer}: звільнився{at}","render.codexSessionCreated":"Сесія Codex створена","render.taskStarted":"Задача стартувала","render.taskComplete":"Задачу завершено","render.compacted":"контекст стиснуто","render.compactAuto":"авто","render.compactManual":"вручну","render.compactPre":"{n}k токенів до","render.compactSummary":"підсумок розмови","render.stdinSession":"stdin → сесія {id}","render.record":"запис","render.transcriptRecord":"запис транскрипту","render.recordDetails":"деталі запису","render.protocol":"протокол","render.image":"зображення","render.imageOutput":"вивід зображення","render.toolOutput":"вивід інструмента","render.toolOutputType":"вивід інструмента: {type}","render.dataKb":"даних {n} КБ","render.commands":{one:"{count} команда",few:"{count} команди",many:"{count} команд",other:"{count} команд"},"render.actions":{one:"{count} дія",few:"{count} дії",many:"{count} дій",other:"{count} дій"},"render.noFindings":"без findings","render.moreFindings":"ще {count} findings у raw","render.memoryCitations":"цитати пам'яті ({count})","render.noCitations":"без citation entries","render.moreEntries":"ще {count} entries у raw","render.truncated":"обрізано","render.shutdownRequest":"запит на завершення","render.shutdownResponse":"відповідь на завершення","render.planRequest":"запит на затвердження плану","render.planVerdict":"вердикт по плану","render.approved":"схвалено","render.rejected":"відхилено","render.from":"від {from}","render.structured":"структуроване повідомлення","render.showJson":"показати JSON","render.toDir":"до","render.fromDir":"від","render.internalTag":"внутрішнє","render.agentPeer":"агент","render.delivered":"доставлено","render.notDelivered":"не доставлено","render.reasoning":"міркування агента","tools.read":"Читання","tools.write":"Запис","tools.edit":"Редагування","tools.lines":{one:"{count} рядок",few:"{count} рядки",many:"{count} рядків",other:"{count} рядка"},"tools.files":{one:"{count} файл",few:"{count} файли",many:"{count} файлів",other:"{count} файлу"},"tools.items":{one:"{count} пункт",few:"{count} пункти",many:"{count} пунктів",other:"{count} пункту"},"tools.family.shell":"команда оболонки","tools.family.read":"читання файлу","tools.family.write":"запис файлу","tools.family.edit":"редагування","tools.family.search":"пошук","tools.family.web":"веб","tools.family.spawn":"запуск агента","tools.family.plan":"план","tools.family.mcp":"інструмент MCP","tools.family.other":"інструмент","tools.showAllLines":"показати всі ({count} рядків)","tools.showOutput":"показати весь вивід","tools.moreFiles":"…і ще {count} файлів","tools.binaryContent":"бінарний вміст \xb7 {size}","tools.rawRecord":"сирий запис","tools.noRawRecord":"деталі більше не завантажені","tools.noOutput":"вивід не збережено","tools.noOutputTip":"повний вивід зберігається в сесії rollout","tools.stdin":"stdin","tools.stdinPoll":"опитування","tools.pollRun":{one:"{count} опитування",few:"{count} опитування",many:"{count} опитувань",other:"{count} опитувань"},"tools.wait":"очікування","tools.session":"сесія","tools.waitingSeconds":"очікування {n} с","tools.wakeup":"заплановане пробудження","tools.cron":"запланований агент","tools.monitor":"монітор","tools.schedule":"розклад","tools.diffTruncated":"обрізано","tools.orchestration":{one:"{count} виклик інструмента",few:"{count} виклики інструментів",many:"{count} викликів інструментів",other:"{count} викликів інструментів"},"tools.nestedCalls":"вкладені виклики","tools.callId":"виклик {id}","tools.copyId":"копіювати id","tools.copyDiff":"Копіювати diff","tools.copyOutput":"Копіювати вивід","tools.source":"джерело","tools.action":"дія {index}","tools.cwd":"cwd","tools.copyCwd":"копіювати cwd","tools.copyCommand":"Копіювати команду","tools.stdout":"stdout","tools.stderr":"stderr","tools.copyStderr":"Копіювати stderr","tools.showStderr":"показати весь stderr","tools.noStderr":"stderr не збережено","tools.exitOk":"код виходу 0","tools.exitCode":"код виходу {code}","tools.durationSec":"{n} с","tools.durationMin":"{m} хв {s} с","tools.durationMs":"{n} мс","tools.ranAt":"{start}–{end}","tools.nestedWaits":{one:"{count} додатковий",few:"{count} додаткові",many:"{count} додаткових",other:"{count} додаткових"},"wakeup.card":"заплановане пробудження","wakeup.wakesAt":"прокинеться о {time}","wakeup.wasSetFor":"було на {time}","wakeup.firedAt":"спрацював о {time}","wakeup.fired":"спрацював","wakeup.failed":"не заплановано","wakeup.superseded":"замінено","wakeup.noTime":"пробудження заплановано","wakeup.plan":"план пробудження","wakeup.planInternal":"внутрішній промпт","wakeup.noPlan":"план пробудження не задано","wakeup.inRel":"через {rel}","wakeup.agoRel":"{rel} тому","wakeup.relSec":{one:"{count} с",few:"{count} с",many:"{count} с",other:"{count} с"},"wakeup.relMin":{one:"{count} хв",few:"{count} хв",many:"{count} хв",other:"{count} хв"},"wakeup.relHour":{one:"{count} год",few:"{count} год",many:"{count} год",other:"{count} год"},"wakeup.relDay":{one:"{count} дн",few:"{count} дн",many:"{count} дн",other:"{count} дн"},"wakeup.chipTitle":"спить до {time} — {reason}","flowDialog.engine":"Двигун: {label}","flowDialog.modelPlaceholder":"модель (дефолт)","flowDialog.model":"Модель: {label}","flowDialog.effortDefault":"effort: дефолт","flowDialog.createFailed":"не вдалося створити флоу ({status})","flowDialog.title":"Запустити флоу","flowDialog.subtitle":"implement → review \xb7 ця розмова стає виконавцем","flowDialog.preset":"пресет","flowDialog.rolesManualOpen":"▾ ролі вручну","flowDialog.rolesManual":"▸ ролі вручну (модель / effort)","flowDialog.spec":"специфікація та критерії приймання","flowDialog.specPlaceholder":"Опис задачі\nAC1: …\nAC2: …","flowDialog.implementer":"виконавець","flowDialog.reviewer":"ревʼюер","flowDialog.diffBase":"база діфу","flowDialog.fromHead":"від поточного HEAD","flowDialog.fromMergeBase":"від merge-base з main","flowDialog.headless":"headless (без панелі)","flowDialog.tmuxPane":"tmux-панель","flowDialog.transitions":"переходи","flowDialog.auto":"авто","flowDialog.manual":"вручну (гейт на кожен крок)","flowDialog.roundLimit":"ліміт раундів","flowDialog.creating":"створюю…","flowDialog.start":"▶ Запустити","flowStrip.startReview":"Почати ревью","flowStrip.spawnReviewer":"Заспавнити ревʼюера","flowStrip.relayNotes":"Передати зауваження","flowStrip.retryRound":"Повторити раунд","flowStrip.anotherRound":"Ще коло","flowStrip.flow":"Флоу","flowStrip.roundsAria":"Раунди ревью","flowStrip.roundError":"Раунд {n}: {error}","flowStrip.roundVerdict":"Раунд {n}: {verdict}","flowStrip.roundInProgress":"Раунд {n}: триває","flowStrip.addRoundsTitle":"Додати ще раунди до ліміту","flowStrip.plus2":"+2 раунди","flowStrip.limitTitle":"Ліміт раундів: скільки ревью до зупинки (∞ — без ліміту)","flowStrip.limitAria":"Встановити ліміт раундів: {count}","flowStrip.limitUnlimitedAria":"Без ліміту раундів","flowStrip.stopReviewer":"Стоп","flowStrip.stopReviewerTitle":"Зупинити поточного ревʼюера; раунд перейде в \xabпотрібне рішення\xbb","flowStrip.notePlaceholder":"нотатка ревʼюеру…","flowStrip.noteTitle":"Піде наступному ревʼюеру як ready-нотатка раунду","flowStrip.autoTitle":"Авто: переходи самі. Клік — вручну.","flowStrip.manualTitle":"Вручну: кожен перехід чекає кліку. Клік — авто.","flowStrip.manualShort":"вручну","flowStrip.resume":"Продовжити флоу","flowStrip.pause":"Пауза","flowStrip.close":"Закрити флоу","flowHub.aria":"Керування флоу — раунд {n}, {state}","flowHub.ariaNoRound":"Керування флоу — {state}","flowHub.controls":"Керування флоу","groupOverride.closePanel":"Закрити керування","groupOverride.flowTitle":"Змінити \xb7 {name}","groupOverride.pipelineTitle":"Змінити \xb7 {name}","groupOverride.draftTitle":"Редагувати чернетку \xb7 {name}","groupOverride.task":"Завдання","groupOverride.spec":"Специфікація","groupOverride.repoDir":"Репозиторій","groupOverride.saveDraft":"Зберегти деталі чернетки","groupOverride.savedDraft":"Деталі чернетки збережено","groupOverride.reviewerRole":"Наступний рев'юер","groupOverride.engine":"Рушій","groupOverride.effort":"Зусилля","groupOverride.effortDefault":"типове","groupOverride.model":"Модель","groupOverride.modelPlaceholder":"типова для рушія","groupOverride.applyRole":"Оновити рев'юера","groupOverride.nextRoundNote":"Нотатка на наступний раунд","groupOverride.notePlaceholder":"На чому зосередити наступного рев'юера…","groupOverride.noteUnavailable":"Можна редагувати під час старту, запуску або повтору раунду.","groupOverride.roundLimit":"Ліміт раундів","groupOverride.setLimit":"Задати","groupOverride.extend":"+1 раунд","groupOverride.nextStage":"Наступний етап","groupOverride.draftStage":"Етап чернетки","groupOverride.addStage":"Додати етап","groupOverride.removeStage":"Видалити етап","groupOverride.moveStageUp":"Перемістити вгору","groupOverride.moveStageDown":"Перемістити вниз","groupOverride.role":"Роль","groupOverride.noRole":"Без ролі","groupOverride.stagePrompt":"Промпт стадії","groupOverride.applyStage":"Оновити етап","groupOverride.noEditableStage":"Немає майбутнього етапу для змін — усі етапи вже стартували.","groupOverride.editStagesOnCanvas":"Редагуйте етапи на їхніх картках — роль, модель, підказка, порядок і зʼєднання є на картці кожного етапу на полотні.","groupOverride.savedReviewer":"Рев'юера оновлено на наступний раунд","groupOverride.savedLimit":"Ліміт раундів оновлено","groupOverride.savedExtend":"Додано раунд","groupOverride.savedRetry":"Повторюємо раунд","groupOverride.savedCancel":"Рев'юера зупинено","groupOverride.savedStage":"Етап оновлено для наступного запуску","groupOverride.stagesHeading":"Етапи \xb7 порядок виконання","groupOverride.stagesHint":"Перетягуй картки, щоб змінити порядок. Порядок — це ланцюг виконання.","groupOverride.stagesEmpty":"Ще немає етапів — додай етап нижче, щоб почати збірку.","groupOverride.startNeedsStages":"Додай щонайменше 1 етап перед запуском.","groupOverride.addRunStage":"Додати етап","groupOverride.addReviewStage":"Додати цикл ревʼю","groupOverride.dragHandle":"Перетягни, щоб змінити порядок етапу","groupOverride.runKind":"запуск","groupOverride.reviewKind":"цикл ревʼю","groupOverride.reordered":"Порядок етапів змінено","groupOverride.stageAdded":"Етап додано","groupOverride.stageRemoved":"Етап видалено","pipelineBuilder.untitledTask":"Новий пайплайн","pipelineBuilder.createDraft":"Пайплайн","pipelineBuilder.createDraftAria":"Додати чернетку пайплайна на полотно","roundDeck.roundAborted":"Раунд {n} \xb7 перервано","roundDeck.roundVerdict":"Раунд {n} \xb7 {verdict}","roundDeck.roundInProgress":"Раунд {n} \xb7 триває","roundDeck.aborted":"перервано","roundDeck.reviewInProgress":"ревью триває","roundDeck.waitingFirst":"чекаю на перший раунд ревью…","roundDeck.spawningReviewer":"запускаю ревʼюера — транскрипт зʼявиться за мить…","roundDeck.moreRounds":"ще {count} раунд(и) — клікни чипи на стрічці флоу","roundDeck.findings":{one:"{count} знахідка",few:"{count} знахідки",many:"{count} знахідок",other:"{count} знахідок"},"roundDeck.roundsCount":{one:"{count} раунд",few:"{count} раунди",many:"{count} раундів",other:"{count} раундів"},"roundDeck.collapseStack":"Згорнути стек ревʼю ({count} раундів)","roundDeck.expandStack":"Розгорнути стек ревʼю ({count} раундів)","roundDeck.groupAria":{one:"Група ревʼю \xb7 {count} раунд",few:"Група ревʼю \xb7 {count} раунди",many:"Група ревʼю \xb7 {count} раундів",other:"Група ревʼю \xb7 {count} раундів"},"roundDeck.groupAriaNamed":{one:"Група ревʼю для {name} \xb7 {count} раунд",few:"Група ревʼю для {name} \xb7 {count} раунди",many:"Група ревʼю для {name} \xb7 {count} раундів",other:"Група ревʼю для {name} \xb7 {count} раундів"},"subagentTray.label":{one:"{count} підагент",few:"{count} підагенти",many:"{count} підагентів",other:"{count} підагентів"},"subagentTray.toggle":{one:"Розгорнути лоток підагентів ({count} згорнутий)",few:"Розгорнути лоток підагентів ({count} згорнуті)",many:"Розгорнути лоток підагентів ({count} згорнутих)",other:"Розгорнути лоток підагентів ({count} згорнутих)"},"subagentTray.collapse":{one:"Згорнути лоток підагентів ({count} згорнутий)",few:"Згорнути лоток підагентів ({count} згорнуті)",many:"Згорнути лоток підагентів ({count} згорнутих)",other:"Згорнути лоток підагентів ({count} згорнутих)"},"subagentTray.rows":"Згорнуті підагенти","subagentTray.open":"Відкрити транскрипт підагента {name}","subagentTray.fold":"Згорнути {name} у лоток підагентів","subagentTray.unfold":"Повернути {name} як повну картку","subagentTray.state.running":"працює","subagentTray.state.live":"наживо","subagentTray.state.silent":"живий, але мовчить","subagentTray.state.closed":"простій","subagentTray.state.dead":"недоступний","flowState.waiting_ready":"чекає READY","flowState.spawn_pending":"готовий спавнити ревʼюера","flowState.spawning":"запускаю ревʼюера","flowState.reviewing":"ревью","flowState.relay_pending":"вердикт є — передати?","flowState.relaying":"передаю зауваження","flowState.fixing":"фікси","flowState.approved":"затверджено","flowState.done_comment":"готово із зауваженнями","flowState.needs_decision":"потребує рішення","flowState.paused":"пауза","flowState.closed":"закрито","flowState.blocked_rate_limited":"заблоковано: вичерпано ліміт","flowState.rate_limit_until":"скинеться о {time}","flowState.rate_limit_wait":"чекає на скидання ліміту","flowModel.failed":"не вдалося ({status})","wfState.provisioning":"готую worktree","wfState.implementing":"етапи виконуються","wfState.reviewing":"ревью","wfState.finishing":"завершення","wfState.approved":"approved","wfState.needs_decision":"потребує рішення","wfState.paused":"пауза","wfState.closed":"закрито","wfModel.failed":"не вдалося ({status})","wfStrip.workflow":"Воркфлоу","wfStrip.stagesAria":"Етапи воркфлоу","wfStrip.reviewStage":"ревью","wfStrip.advance":"Далі","wfStrip.retryStage":"Повторити етап","wfStrip.skipStage":"Пропустити","wfStrip.resume":"Продовжити воркфлоу","wfStrip.pause":"Пауза","wfStrip.close":"Закрити воркфлоу","pipelineState.draft":"чернетка","pipelineState.provisioning":"готую worktree","pipelineState.running":"етапи виконуються","pipelineState.needs_decision":"потребує рішення","pipelineState.paused":"пауза","pipelineState.completed":"завершено","pipelineState.closed":"закрито","pipelineModel.failed":"не вдалося ({status})","pipelineStrip.pipeline":"Пайплайн","pipelineStrip.start":"Запустити пайплайн","pipelineStrip.discard":"Відкинути чернетку","pipelineStrip.stagesAria":"Етапи пайплайна","pipelineStrip.reviewStage":"цикл ревью","pipelineStrip.retryStage":"Повторити етап","pipelineStrip.skipStage":"Пропустити","pipelineStrip.resume":"Продовжити пайплайн","pipelineStrip.pause":"Пауза","pipelineStrip.close":"Закрити пайплайн","pipelineStrip.readOnly":"лише читання","pipelineStrip.readWrite":"читання й запис","pipelineStrip.groupAria":"Пайплайн {task}","pipelineStrip.baseSha":"База {sha}","pipelineStrip.baseShaFull":"Повний базовий коміт {sha}","pipelineStrip.copyBaseSha":"Скопіювати повний базовий коміт {sha}","pipelineStrip.copiedBaseSha":"Повний базовий коміт скопійовано","pipelineStrip.copyBaseShaFailed":"Не вдалося скопіювати базовий коміт","pipelineStrip.moreActions":"Інші дії пайплайна","pipelineStrip.announce":"Пайплайн {task}: {state}, етап {stage} {k} з {n}","pipelineStrip.openStage":"Відкрити етап {label}","pipelineStrip.openVerdict":"Відкрити вердикт етапу {label}, стан: {state}","pipelineStrip.openTranscript":"Відкрити транскрипт етапу {label}, стан: {state}","pipelineStrip.configureStage":"Налаштувати етап {label}, стан: {state}","pipelineStrip.configAria":"Налаштування етапу {label}","pipelineStrip.closeConfig":"Закрити налаштування етапу","pipelineStrip.lineageAria":"Послідовність етапів від {from} до {to}","pipelineStrip.previousStage":"Відкрити попередній етап {label}, стан: {state}","pipelineStrip.nextStage":"Відкрити наступний етап {label}, стан: {state}","pipelineStrip.evidenceAria":"Свідчення етапу {label}: {verdict}, тривалість {duration}, модель {model}","pipelineStrip.defaultModel":"типова модель","pipelineStrip.unknownDuration":"тривалість недоступна","pipelineStrip.linkedTasks":"Пов’язані завдання","pipelineStrip.openTask":"Відкрити пов’язане завдання {label}","pipelineStrip.roundShort":"Р{n}","pipelineStrip.attemptSuffix":"\xd7{n}","stageGraph.roundProgress":"раунд {round}/{total}","stageGraph.startedNotice":"Етап запустився, поки налаштування були відкриті. Збережену серверну конфігурацію тепер заблоковано.","pipelineStrip.chipAria":"Етап {label}: {state}","pipelineStrip.compactChipAria":"{label}, {state}","pipelineStrip.stageOf":"етап {k}/{n}","pipelineStrip.passEdgeAria":"Ребро проходження від {from} до {to}","pipelineStrip.failEdgeAria":"Ребро невдачі від {from} до {to}, раунд {k} з {n}","pipelineStrip.nextEdge":"далі","pipelineStrip.nextEdgeAria":"Це ребро виконується наступним","pipelinePresentation.queued":"У черзі","pipelinePresentation.waiting":"Очікує","pipelineShelf.aria":"Полиця пайплайнів","pipelineShelf.title":"Пайплайни","pipelineShelf.edit":"Редагувати пайплайн {task}","pipelineGroup.toggle":"Розгорнути або згорнути пайплайн {task}","pipelineGroup.openHistory":"Відкрити історію пайплайна {task}","pipelineSlot.paneAria":"Запланований етап {title}","pipelineSlot.completedAria":"Завершений етап {title} — відкрийте для перегляду","pipelineSlot.openTranscript":"Відкрити розмову","pipelineSlot.stageOf":"етап {k}/{n}","pipelineSlot.promptLabel":"Промпт стадії","pipelineSlot.noPrompt":"Додатковий контекст для агента — все вище підключається автоматично.","pipelineSlot.wiringTask":"Автоматично отримує: текст задачі","pipelineSlot.wiringPrev":"Автоматично отримує: результат попереднього етапу + текст задачі","pipelineSlot.waiting":"Вікно чату {role} з’явиться тут, щойно етап стартує.","pipelineSlot.starting":"Запускаємо агента {role}…","pipelineSlot.reviewHint":"Цикл рев’ю попереднього етапу — його раунди з’являться тут.","pipelineSlot.frozen":"Етап уже виконувався — конфігурацію заморожено.","pipelineSlot.saved":"Збережено","pipelineSlot.rowAria":"Завершений етап {title}","pipelineSlot.reasonSkipped":"Пропущено оператором — ланцюжок пішов далі","pipelineSlot.rowExpand":"Показати повну картку етапу","pipelineSlot.rowCollapse":"Згорнути назад до рядка статусу","pipelineTemplates.planBuildReview":"План → Збірка → Рев’ю","pipelineTemplates.buildReview":"Збірка → Рев’ю","pipelineTemplates.buildVerify":"Збірка → Перевірка","pipelineSlot.addAgent":"Наступний агент","pipelineSlot.addAgentTitle":"Додати наступного агента після цього етапу","pipelineSlot.addReview":"Цикл рев’ю","pipelineSlot.addReviewTitle":"Прикріпити цикл рев’ю (жорстка зв’язка) після цього етапу","pipelineSlot.moveEarlier":"Перемістити {role} раніше в ланцюжку","pipelineSlot.moveLater":"Перемістити {role} пізніше в ланцюжку","pipelineSlot.savePrompt":"Зберегти промпт","pipelineSlot.promptAria":"Редактор промпту етапу","pipelineSlot.connectHeading":"З'єднання","pipelineSlot.passEdgeLabel":"Після проходження — до","pipelineSlot.passEdgeEnd":"— завершує конвеєр","pipelineSlot.failEdgeLabel":"У разі невдачі — назад до","pipelineSlot.failEdgeNone":"— зупинка для оператора","pipelineSlot.failEdgeSelf":"↺ цей етап (повтор себе)","pipelineSlot.failEdgeRounds":"Макс. раундів циклу","pipelineSlot.passEdgeFrozen":"Цей етап уже виконувався — його ребро проходження заморожене як свідчення.","pipelineSlot.failEdgeFrozen":"Це ребро невдачі вже пройдене — воно заморожене як свідчення.","pipelineTemplates.title":"Новий пайплайн","pipelineTemplates.subtitle":"Обери шаблон. Група пайплайна з’явиться на дошці біля пов’язаного завдання. Налаштування етапів доступні за запитом.","pipelineTemplates.blank":"Порожнє полотно","pipelineTemplates.blankHint":"Почни з нуля і збери етапи вручну.","pipelineTemplates.noRole":"без ролі","pipelineTemplates.repoDir":"Каталог репозиторію","pipelineTemplates.checking":"Перевіряємо репозиторій…","pipelineTemplates.ready":"Репозиторій готовий","pipelineTemplates.creating":"Створюємо пайплайн…","pipelineTemplates.retry":"Повторити","pipelinePreflight.empty":"Вкажи каталог репозиторію","pipelinePreflight.missing":"Каталог не існує: {path}","pipelinePreflight.not_directory":"Обери каталог: {path}","pipelinePreflight.repo_unreadable":"Репозиторій недоступний для читання: {path}","pipelinePreflight.repo_untraversable":"Репозиторій неможливо відкрити: {path}","pipelinePreflight.not_git":"Обери Git-репозиторій: {path}","pipelinePreflight.probe_failed":"Перевірку репозиторію не завершено — повтори: {path}","pipelinePreflight.git_metadata_unwritable":"Метадані Git доступні лише для читання: {path}","pipelinePreflight.worktree_parent_unwritable":"Поруч із цим репозиторієм неможливо створити робочу копію пайплайна: {path}","pipelineChipState.pending":"очікує","pipelineChipState.spawning":"запускається","pipelineChipState.running":"виконується","pipelineChipState.reviewing":"рев’ю","pipelineChipState.committing":"коміт","pipelineChipState.passed":"пройдено","pipelineChipState.failed":"провалено","pipelineChipState.needs_decision":"потребує рішення","pipelineChipState.skipped":"пропущено","pipelineVerdict.pass":"успіх","pipelineVerdict.fail":"провал","pipelineVerdict.needsDecision":"рішення","pipelineVerdict.confidence":"впевненість","pipelineVerdict.reviewerSha":"SHA ревʼюера {sha}","pipelineVerdict.findings":{one:"{count} зауваження",few:"{count} зауваження",many:"{count} зауважень",other:"{count} зауважень"},"pipelineVerdict.noFindings":"зауважень немає","pipelineVerdict.more":"+{count} ще","pipelineVerdict.openTranscript":"Відкрити транскрипт","pipelineVerdict.openAttemptTranscript":"Відкрити транскрипт спроби {n}","pipelineVerdict.reviewTranscripts":"Транскрипти рев’ю","pipelineVerdict.openReviewTranscript":"Відкрити транскрипт рев’ю {n}","pipelineVerdict.openFlow":"Відкрити рев’ю","pipelineVerdict.retry":"Повторити","pipelineVerdict.skip":"Пропустити","pipelineVerdict.priorAttempts":"Попередні спроби","pipelineVerdict.attemptLine":"Спроба {n}: {status}","pipelineVerdict.title":"Вердикт етапу {label}","pipelineHub.aria":"Пайплайн {task}: {stage} \xb7 {k}/{n}","pipelineHub.controls":"Керування пайплайном","pipelineHub.stageOf":"{stage} \xb7 {k}/{n}","pipelineHub.openControls":"Відкрити керування пайплайном","pipelineHub.attempt":"спроба {n}","pipelineHub.openDashboard":"Відкрити панель","dash.pipeline":"Пайплайн","dash.newPipeline":"Новий пайплайн","board.historyGroup":"Скасувати та повторити дії на дошці","board.undo":"Скасувати","board.redo":"Повторити","board.undoReopen":"Скасувати — знову відкрити \xab{title}\xbb","board.redoReclose":"Повторити — знову закрити \xab{title}\xbb","board.undoNothing":"Немає що скасовувати","board.redoNothing":"Немає що повторювати","scheme.pipeline":"Пайплайн","scheme.pipelineTitle":"Запустити пайплайн із цієї розмови","board.pipeline":"Пайплайн","board.newPipeline":"Новий пайплайн","pipelineMobile.chipAria":"Пайплайн {task}","pipelineMobile.position":"{k}/{n}","pipelineMobile.prevStage":"Попередній етап {label}, стан: {state}","pipelineMobile.nextStage":"Наступний етап {label}, стан: {state}","pipelineMobile.openVerdict":"Відкрити вердикт для {label}, стан: {state}","pipelineMobile.expandDock":"Розгорнути пайплайн {task}","pipelineMobile.collapseDock":"Згорнути пайплайн {task}","pipelineMobile.summaryOpen":"Відкрити пайплайни ({n})","pipelineMobile.summaryCount":{one:"{n} пайплайн",other:"{n} пайплайнів"},"pipelineMobile.summaryActive":"{n} активних","pipelineMobile.summaryAttention":"{n} потребують вас","pipelineMobile.summaryCompleted":"{n} завершено","pipelineMobile.sheetTitle":"Пайплайни","pipelineMobile.closeSheet":"Закрити пайплайни","pipelineMobile.completedGroup":{one:"{n} завершений",other:"{n} завершено"},"wfDraft.paneAria":"Чернетка нового воркфлоу","wfDraft.notStarted":"воркфлоу ще не запущений","wfDraft.newWorkflow":"новий воркфлоу","wfDraft.dismiss":"Прибрати чернетку воркфлоу","wfDraft.template":"шаблон","wfDraft.templateAria":"Шаблон воркфлоу","wfDraft.repo":"репозиторій","wfDraft.repoAria":"Директорія репозиторію","wfDraft.manualMode":"вручну: гейт на межі кожного етапу","wfDraft.hint":"Обери шаблон і репозиторій, опиши задачу — воркфлоу створить worktree, прожене етапи, ревью і відкриє PR.","wfDraft.taskPlaceholder":"задача для воркфлоу — бриф піде кожному етапу…","wfDraft.taskAria":"Бриф задачі воркфлоу","wfDraft.footerHint":"worktree \xb7 етапи \xb7 ревью \xb7 PR","wfDraft.finishMerge":"merge локально","wfDraft.needDir":"вкажи директорію репозиторію","wfDraft.needTask":"опиши задачу","wfDraft.launchFailed":"не вдалося запустити","wfDraft.launch":"▶ Запустити воркфлоу","wfDraft.launching":"запускаю…","scheme.flowTitle":"Запустити цикл implement → review для цієї розмови","scheme.flow":"Флоу","scheme.collapsedTitle":"Згорнуті гілки й задачі цієї розмови","scheme.ancestorElided":{one:"Батьківську розмову не показано: {title}",few:"{count} предків не показано, найближчий: {title}",many:"{count} предків не показано, найближчий: {title}",other:"{count} предків не показано, найближчий: {title}"},"scheme.ancestorOffBoard":"Батьківської розмови немає на цій дошці","scheme.underneath":"під сподом","scheme.handTool":"Рука — тягнути полотно (H, або тримай Space)","scheme.selectTool":"Виділення — клік і робота з розмовами (V)","scheme.zoomOut":"Віддалити (−)","scheme.zoom100":"Масштаб 100% (1)","scheme.zoomIn":"Наблизити (+)","scheme.fitCurrent":"Вписати поточну роботу (0)","scheme.fit":"Вписати весь вміст (Shift+0, або подвійний клік по фону)","scheme.framedCurrent":"Поточну роботу вписано — {count} елементів","scheme.framedAll":"Весь вміст вписано — {count} елементів","scheme.offscreenNav":"Робота за межами екрана","scheme.offscreenMore":"Показати ще {count} кластерів за межами екрана","mobile.mapFrame":"Рамка мапи","mobile.mapAll":"Усе","mobile.mapCurrent":"Поточне","scheme.roleImplementer":"Імплементер","scheme.roleReviewer":"Ревʼюер","scheme.roleWorking":"працює","scheme.roleWaiting":"чекає","scheme.lassoTool":"Вибірка — обведи агентів рамкою, кліком додавай чи знімай","scheme.selectCheckOn":"Додати цього агента до вибірки","scheme.selectCheckOff":"Прибрати цього агента з вибірки","scheme.boardAria":"Дошка агентів — стрілки переміщують між вікнами агентів","scheme.navStack":{one:"{count} тиха гілка під {title}",few:"{count} тихі гілки під {title}",many:"{count} тихих гілок під {title}",other:"{count} тихих гілок під {title}"},"scheme.navStackBare":{one:"{count} тиха гілка",few:"{count} тихі гілки",many:"{count} тихих гілок",other:"{count} тихих гілок"},"bulk.selectedCount":{one:"Вибрано {count}",few:"Вибрано {count}",many:"Вибрано {count}",other:"Вибрано {count}"},"bulk.placeholder":"одне повідомлення кожному вибраному агенту…","bulk.textAria":"Текст розсилки вибраним агентам","bulk.sendAll":"Надіслати {count} агентам","bulk.interrupt":"Перервати","bulk.stop":"Зупинити","bulk.stopConfirm":"Точно зупинити {count}?","bulk.remove":"Прибрати зі схеми","bulk.removeConfirm":"Закрити {count} карток?","bulk.flow":"Флоу","bulk.fit":"Показати вибірку","bulk.exit":"Вийти з вибірки (Esc)","bulk.retryFailed":"Повторити невдалі ({count})","bulk.nodeGone":"вузол зник зі схеми","bulk.flowTitle":"Запустити ревʼю-флоу для {count} агентів","bulk.flowStart":"Запустити {count} флоу","minimap.title":"Мінімапа — клікни або тягни, щоб перейти","minimap.stacks":{one:"{count} згорнутий стек",few:"{count} згорнуті стеки",many:"{count} згорнутих стеків",other:"{count} згорнутих стеків"},"plan.agentPlan":"План агента:","plan.stepsAria":"План: {done} з {total} кроків","plan.nowSuffix":", зараз: {current}","plan.goal":"ціль","plan.goalDone":"ціль ✓","plan.goalBlocked":"ціль ✖","plan.noObjective":"(objective не записаний у хвості транскрипта)","plan.tokens":"токенів: {n}","plan.time":"часу: {n} хв","plan.ctxTitle":"Контекстне вікно: використано {pct}%\n{used} з {window} токенів","plan.ctxSourceRuntime":"Розмір вікна повідомлений середовищем агента","plan.ctxSourceRegistry":"Розмір вікна з вбудованого реєстру моделей ({version}) — приблизно","plan.ctxTitleUnknown":"Використання контексту: {used} токенів\nРозмір вікна для цієї моделі невідомий — відсоток не показується","plan.ctxAria":"Контекст: використано {pct} відсотків вікна","plan.ctxAriaUnknown":"Контекст: використано {used} токенів, розмір вікна невідомий","plan.goalAria":"Ціль сесії: {status}","limits.now":"зараз","limits.inMin":"через {n} хв","limits.inHour":"через {n} год","limits.inDay":"через {n} д","limits.asOf":"станом на {time}","limits.left":"лишилось","limits.reset":"скид {eta} \xb7 {at}","limits.stale":"дані застарілі: {stale}","limits.5h":"5 год","limits.week":"Тиждень","limits.windowMinutes":"{n} хв","limits.windowHours":"{n} год","limits.windowDays":"{n} д","limits.accountsOpenAria":"Акаунти Codex — змінити або додати","limits.noDataYet":"поки немає даних","limits.rateLimited":"Провайдер обмежує частоту запитів.","limits.rateLimitedRetry":"Провайдер обмежує частоту запитів. Наступна спроба о {time}.","limits.reauthRequired":"Потрібно повторно увійти в Claude.","burndown.title":"витрати","burndown.openAria":"Відкрити графік витрати квоти {engine}","burndown.close":"Закрити графік","burndown.windowAria":"Вікно графіка","burndown.ideal":"рівний темп","burndown.actual":"лишок","burndown.loading":"Завантаження історії…","burndown.failed":"Не вдалося завантажити історію.","burndown.empty":"Історії ще немає — графік заповнюється в міру збору даних.","burndown.windowUnreported":"Цей план не повідомляє вікно \xab{window}\xbb, тож малювати тут нічого.","burndown.buildsFrom":"історія від {date}","burndown.fast":"на {pct}% швидше за рівний темп — витрачаєте зашвидко","burndown.slow":"на {pct}% повільніше за рівний темп — є запас","burndown.even":"рівний темп","burndown.emptyBy":"за таким темпом 0% до {at}","resources.ram":"RAM","resources.swap":"Swap","resources.free":"{amount} вільно","resources.used":"{amount} зайнято","resources.stale":"дані про ресурси застарілі: {stale}","resources.captured":"знято {age}","resources.openAria":"Сесії агентів і пам'ять","resources.title":"Сесії агентів","resources.total":"Σ {amount}","resources.empty":"у tmux немає сесій агентів","resources.orphan":"осиротілий пейн","resources.hostConflict":"дублікат пейна розмови","resources.hostConflictHint":"кілька активних пейнів належать цій розмові","resources.procs":{one:"{count} процес",few:"{count} процеси",many:"{count} процесів",other:"{count} процесу"},"resources.swapShare":"+ {amount} swap","resources.kill":"Убити","resources.confirm":"Точно?","resources.killLiveHint":"агент зараз працює — натисни, щоб розблокувати, і підтверди","resources.killHint":"закрити tmux-пейн разом з усім деревом процесів","resources.bulkLabel":"неактивні довше ніж","resources.bulkKill":"Убити неактивні","resources.bulkNone":"немає сесій, неактивних так довго","resources.hoursN":"{n} год","resources.killAll":"Убити всіх агентів","resources.killAllConfirm":"Підтвердити — убити {n}?","resources.killAllHint":"примусово закрити кожен пейн агента, разом із активними — чистий старт, щоб наступний spawn/повідомлення пішли правильно. Твої шели і в'ювер не чіпає.","resources.killAllNone":"немає сесій агентів для закриття","resources.close":"Закрити","attach.attach":"Приєднатися","attach.readonly":"Лише перегляд","attach.copy":"Скопіювати команду приєднання","attach.copyReadonly":"Скопіювати команду приєднання лише для перегляду","attach.hint":"скопіювати команду tmux attach для цього пейна — встав її в будь-який шел","attach.readonlyHint":"скопіювати команду приєднання лише для перегляду — дивишся, не чіпаючи клавіш","attach.loading":"обчислюю…","attach.copied":"команду приєднання скопійовано","attach.copiedReadonly":"команду лише для перегляду скопійовано","attach.stale":"Цей пейн змінився або закрився. Онови й спробуй ще раз.","attach.restarted":"Сервер tmux перезапустився. Онови й спробуй ще раз.","attach.unavailable":"Ендпоінт tmux недоступний. Онови й спробуй ще раз.","attach.badRequest":"Не вдалося визначити пейн — онови список.","attach.network":"Помилка мережі — спробуй ще раз.","attach.clipboard":"Не вдалося скопіювати — перевір доступ до буфера обміну.","attach.refresh":"Оновити","status.awaitingPlan":"чекає затвердження плану","status.awaitingAnswer":"чекає відповіді на питання","status.awaitingTerminal":"чекає на відповідь у терміналі","status.working":"працює…","status.returnedResult":"повернувся з результатом","status.stalled":"перервано або чекає дозволу","status.finishedTurn":"закінчив хід — чекає відповіді","status.rateLimited":"вичерпано ліміт","status.providerThrottled":"провайдер обмежує частоту — продовжить о {time}","status.flow":"флоу: {label}","rateLimit.badge":"вичерпано ліміт","rateLimit.badgeUntil":"ліміт до {time}","rateLimit.reseat":"продовжити на здоровому акаунті","rateLimit.reseatRequested":"пересадка…","rateLimit.reseatTitle":"Створити наступника цієї розмови на найздоровішому акаунті; вичерпана розмова паркується, прив'язані флоу переходять слідом.","rateLimit.reseatFailed":"не вдалося пересадити","rateLimit.reseatAlready":"вже пересаджено","rateLimit.reseatWaitingTurn":"Пересадку поставлено в чергу: щойно обмежений хід звільнить панель, буде створено наступника.","dictation.capWarn":"залишилось менше хвилини запису","dictation.capStopped":"Запис зупинено на 10-хвилинній межі; текст зʼявиться в полі.","dictation.failed":"не вдалося розпізнати","dictation.silence":"тиша — нічого не розпізналось","dictation.unsupported":"запис не підтримується в цьому браузері","dictation.liveError":"помилка live-транскрипції","dictation.connectionLost":"зʼєднання з транскрипцією обірвалось","dictation.noMic":"немає доступу до мікрофона","overview.branchesLiveIn":{one:"{count} гілка працює у {projects}",few:"{count} гілки працюють у {projects}",many:"{count} гілок працюють у {projects}",other:"{count} гілок працюють у {projects}"},"overview.projects":{one:"{count} проєкті",few:"{count} проєктах",many:"{count} проєктах",other:"{count} проєктах"},"overview.archived":"\xb7 {count} в архіві","overview.moreLive":"ще {count} live","overview.quiet":"тихо \xb7 остання активність {age}","overview.empty":"Логів поки нема","catalog.unreachable":"каталог недоступний","catalog.errorTitle":"Не вдалося завантажити каталог сесій","catalog.errorBody":"Сервер вʼювера не відповів, тож невідомо, що зараз працює.","catalog.retry":"Спробувати ще","catalog.attempts":{one:"{count} невдала спроба",few:"{count} невдалі спроби",many:"{count} невдалих спроб",other:"{count} невдалих спроб"},"launch.account":"Обліковий запис","launch.reasoning":"Міркування","orchPanel.title":"Оркестратор","orchPanel.toggleAria":"Панель оркестратора","orchPanel.regionAria":"Оркестратор проєкту {project}","orchPanel.close":"Закрити панель оркестратора","orchPanel.resize":"Змінити ширину панелі оркестратора","orchPanel.loading":"Читаю оркестратора цього проєкту…","orchPanel.unavailable":"Не вдається прочитати місце оркестратора","orchPanel.unavailableHint":"Нічого не змінено. Поки немає відповіді, створення тут могло б призначити другого оркестратора.","orchPanel.recheck":"Перевірити ще раз","orchPanel.draftTitle":"Створити оркестратора для цього проєкту","orchPanel.draftHint":"Він працює в {project}, володіє цією дошкою і відповідає вам тут. Текст нижче буде доставлено йому як перше повідомлення — редагуйте як завгодно.","orchPanel.draftHintVacated":"Розмова попереднього оркестратора зникла. Створіть нового для {project}; текст нижче буде доставлено як перше повідомлення.","orchPanel.viewerMcpRegistered":"viewer MCP: зареєстровано ✓","orchPanel.viewerMcpMissing":"viewer MCP: виконайте scripts/install-mcp.sh або claude mcp add viewer -- bun ./bin/mcp-server.mjs","orchPanel.mandate":"Мандат","orchPanel.mandateSent":"Надсилається як перше повідомлення","orchPanel.restoreDefault":"Повернути типовий","orchPanel.mandateRequired":"Мандат не може бути порожнім.","orchPanel.cwd":"Робоча тека: {cwd}","orchPanel.confirm":"Створити оркестратора","orchPanel.confirmRetry":"Спробувати ще раз","orchPanel.creating":"Створюю оркестратора…","orchPanel.creatingHint":"Призначення записано. Мандат буде доставлено рівно один раз, навіть якщо сторінку перезавантажити.","orchPanel.receipt":"Запуск {launchId}","orchPanel.creatingStuck":"Це призначення очікує ще від часу до завантаження сторінки — запит, який його почав, не завершився.","orchPanel.creatingResume":"Завершити призначення","orchPanel.errorTitle":"Оркестратора не призначено","orchPanel.errorHint":"Нічого не запущено. Виправте мандат або параметри й спробуйте ще раз.","orchPanel.errorUnknownTitle":"Результат останньої спроби невідомий","orchPanel.errorUnknownHint":"Відповідь загубилася, тож оркестратор уже може існувати. Повторна спроба відтворює той самий запит, а не створює другого.","orchPanel.transportLost":"Відповідь не надійшла — зʼєднання обірвалося.","orchPanel.transitionPending":"Нове призначення завершується…","orchPanel.transitionFailed":"Останнє призначення не вдалося","orchPanel.stalled":"Оркестратор затих. Надішліть повідомлення, щоб він повернувся до роботи.","orchPanel.resumable":"Оркестратор завершив роботу. Надішліть повідомлення, щоб продовжити цю саму розмову.","orchPanel.resolving":"Відкриваю розмову…","orchPanel.resolvingHint":"Оркестратора призначено; його транскрипт ще не дійшов до цього вигляду.","orchPanel.openOnBoard":"Відкрити на дошці","orchPanel.rotation":"Рекомендовано ротацію","orchPanel.rotationStrong":"Наполегливо рекомендовано ротацію","orchPanel.rotationContext":"контекст на {percent}% вікна моделі","orchPanel.rotationDead":"його хост зник","orchPanel.badgeLive":"живий","orchPanel.badgeStalled":"тиша","orchPanel.badgeResumable":"завершив","orchPanel.badgeDead":"хост зник","orchPanel.badgeResolving":"відкриваю","orchPanel.badgeCreating":"створюю","orchPanel.badgeFailed":"помилка","orchPanel.badgeNone":"ще немає","orchPanel.badgeReading":"читаю","orchPanel.incumbentAria":"Оркестратор, який зараз тримає місце цього проєкту","orchPanel.incumbentUnknown":"модель ще не визначено","orchPanel.accountTitle":"Працює на акаунті {account}","orchPanel.ctxTitle":"Контекст: {used} з {window} токенів ({percent}%)","orchPanel.ctxUnknownWindow":"{used} токенів у контексті; для цієї моделі вікно не налаштоване, тому відсоток не вказується","orchPanel.ctxAria":"Вікно контексту заповнене на {percent}%","orchPanel.ctxAriaUnknown":"Використання контексту, вікно невідоме","orchPanel.predecessor":"Замінив попереднього оркестратора","orchPanel.predecessorTitle":"Відкрити розмову попередника на дошці","orchPanel.rotate":"Замінити","orchPanel.rotateTitle":"Замінити цього оркестратора новим. Нічого не заміниться, доки ви не підтвердите.","orchPanel.rotateHeading":"Замінити оркестратора цього проєкту","orchPanel.rotateHint":"Наступник починає з мандата нижче. Транскрипт попередника й відкриті задачі проєкту передає сервер — тут їх повторювати не треба. Розмова попередника лишається на дошці, зв'язана з новою.","orchPanel.rotateConfirm":"Замінити оркестратора","orchPanel.rotateCancel":"Лишити цього","orchPanel.rotateErrorTitle":"Заміна не відбулася","orchPanel.rotateErrorHint":"Поточний оркестратор недоторканий і далі тримає місце. Виправте мандат чи параметри й спробуйте ще раз.","orchPanel.rotateErrorUnknownTitle":"Результат останньої заміни невідомий","orchPanel.rotateErrorUnknownHint":"Відповідь загубилася, тож наступник уже може існувати. Повторна спроба відтворює той самий запит, а не замінює двічі.","orchPanel.rotateVacated":"Розмову того оркестратора закрили, поки ця заміна ще тривала. Завершіть її тут — повторна спроба відтворює той самий запит, а не замінює двічі.","orchPanel.restoreIncumbent":"Повернути поточний мандат","orchPanel.cwdInherited":"Наступник продовжить у {cwd}","orchMobile.create":"Створити оркестратора","orchMobile.unreadable":"не читається","orchMobile.rowCreateAria":"Створити оркестратора для цього проєкту","orchMobile.rowLiveAria":"Оркестратор {model} — {state}. Відкриває його розмову.","orchMobile.rowStatusAria":"Оркестратор — {state}. Відкриває панель оркестратора.","orchMobile.pendingAria":"Нове призначення завершується — відкрити","orchMobile.transitionAria":"Останнє призначення не вдалося — відкрити","orchMobile.sheetAria":"Оркестратор проєкту {project}","orchMobile.liveTitle":"Оркестратор цього проєкту","orchMobile.liveHint":"Він відповідає у власній розмові. Відкрийте її — і ви в ній, разом із полем вводу.","orchMobile.open":"Відкрити розмову","branch.live":"працює","branch.waiting":"закінчив хід — чекає відповіді","branch.returned":"повернувся з результатом","branch.stalled":"перервано або чекає дозволу","branch.done":"завершено — можна прибрати","branch.worktree":"Ворк-дерево {name}","branch.lastActivity":"Остання активність: {age}","branch.lastActivityQuiet":"Позначений активним, але транскрипт мовчить: остання активність {age}","branch.handoffTitle":"агент, породжений хендоффом цієї розмови","branch.branchTitle":"гілка цієї розмови","branch.accountTip":"Акаунт {id} \xb7 {engine} \xb7 {health}","branch.accountTipPlain":"Акаунт {id} \xb7 {engine}","branch.accountAria":"Відкрити акаунти для {id}","lineage.parentRemoved":"батьківську розмову видалено","lineage.parentRemovedTitle":"Транскрипт батьківської розмови видалено","branch.removeColumn":"Прибрати колонку {title}","branch.toggleBackground":"{action} фонову задачу {title}","branch.collapse":"Згорнути","branch.expand":"Розгорнути","branch.expandFull":"Розгорнути розмову {title} на все вікно","branch.collapseFull":"Повернутися до полотна (Esc)","branch.detailsShow":"Показати деталі розмови","branch.detailsHide":"Сховати деталі розмови","branch.favorite":"Додати в обране","branch.unfavorite":"Прибрати з обраного","tree.quiet":"Тихі розмови й задачі","taskStacks.collapse":"Згорнути картку назад у стек статусу","readiness.title":"Готовність задач","readiness.aria":"Секції готовності всіх задач проєкту","readiness.legend":"Зараз — призначено в роботу \xb7 На рев'ю — рев'ю триває або є вердикт \xb7 Заблоковано — потрібне рішення \xb7 Заплановано — інбокс/беклог \xb7 Готово — завершено","readiness.section.now":"Зараз","readiness.section.review":"На рев'ю","readiness.section.blocked":"Заблоковано","readiness.section.planned":"Заплановано","readiness.section.done":"Готово","readiness.sectionAria":"Задачі \xab{section}\xbb \xb7 {count}","readiness.open":"Відкрити задачу на дошці: {title}","readiness.place":"Розмістити задачу на мапі: {title}","readiness.issueAria":"Відкрити issue #{issue} на GitHub","readiness.agent":"агент","readiness.agentAria":"Відкрити призначеного агента: {title}","readiness.pipeline":"пайплайн","readiness.pipelineAria":"Відкрити стадію пайплайна: {title}","readiness.review":"рев'ю","readiness.reviewAria":"Відкрити пов'язане рев'ю: {title}","readiness.state.live":"живий","readiness.state.gone":"зник","readiness.state.failed":"збій","launchHistory.title":"Історія запусків","launchHistory.aria":"Термінальні квитанції запусків","launchHistory.failed":"невдалий","launchHistory.recovered":"відновлений","launchHistory.retryLabel":"Повторити","launchHistory.retry":"Повторити запуск: {title}","workerStack.title":"Згорнуті воркери","workerStack.aria":"Згорнуті розмови воркерів","workerStack.expandGroup":"Розгорнути групу ревʼю на дошці","workerStack.flow":"Потік","workerStack.pipeline":"Пайплайн","workerStack.origin":"Породжені","workerStack.worktree":"Воркери","corner.waitingCount":"\xb7 {count} чекають","corner.openSwitchboard":"Відкрити пульт агентів","task.working":", працює","task.interrupted":", перервано","task.finished":", закінчив","task.interruptedBadge":"перервано","task.finishedBadge":"завершено","task.stopFailed":"помилка зупинки","task.signalSent":"надіслано {signal} PID {pid}","task.killRequested":"запит на зупинку надіслано","task.confirmKill":"Точно вбити PID {pid}?","task.confirmKillNamed":"Зупинити {name}?","task.confirmKillUntitled":"цього агента","task.confirmKillYes":"Так, вбити","task.stopAria":"Зупинити процес PID {pid}","task.kill":"Вбити","task.backgroundCommand":"Фонова команда","task.commandNotFound":"Команду, що запустила цю фонову задачу, не знайдено у транскриптах сесії","viewer.closeProjects":"Закрити список проєктів","viewer.agentWaiting":"Агент чекає відповіді","viewer.staleFocusEntry":"Ця розмова більше недоступна","viewer.unknownFragment":"Це посилання не вказує ні на що відоме переглядачу","viewer.closeNotification":"Закрити сповіщення","attention.badge":{one:"{count} чекає",few:"{count} чекають",many:"{count} чекають",other:"{count} чекають"},"attention.needsYou":"Чекають","attention.next":"Далі","attention.nextHint":"Сфокусувати наступного, хто чекає на тебе (N, Shift-N — назад)","attention.openQueue":"Черга уваги — хто заблокований на тобі (N — наступний)","attention.popoverTitle":"Чекають на тебе","attention.filterOn":"Показати лише тих, хто чекає на тебе (F)","attention.filterOff":"Показати всі вузли (F)","mobile.noConvos":"Розмов поки нема","mobile.map":"Карта","mobile.closeMap":"Закрити карту","mobile.tapNode":"Тапни вузол — розмова відкриється на весь екран","mobile.agent":"агент","mobile.openMap":"Відкрити карту проєкту","mobile.mapLoading":"Завантаження карти…","mobile.marker.open":"Відкрити {title}","mobile.marker.node":"розмова","mobile.marker.deck":"рев'ю","mobile.marker.draft":"чернетка агента","mobile.marker.stack":"історія","mobile.marker.worker":"воркери","mobile.marker.task":"задача","mobile.marker.pipeline":"пайплайн","tasks.failed":"не вдалося ({status})","tasks.tool":"Задача — наступний клік кладе картку на полотно (T)","tasks.untitled":"без назви","tasks.newPlaceholder":"текст задачі… (перший рядок — назва)","tasks.newTask":"нова задача","tasks.panelCreate":"Створити задачу","tasks.unplaced":"без місця","tasks.placeOnMap":"розмістити на дошці","tasks.addDue":"дедлайн","tasks.clearDue":"Прибрати дедлайн","tasks.dueTitle":"Дедлайн (зона: {zone})","tasks.attachCount":{one:"{count} зображення",other:"{count} зображень"},"tasks.draftDiscarded":"чернетку відкинуто","tasks.editAria":"Текст задачі","tasks.spawning":"запускається…","tasks.deadChip":"розмови вже немає у списку","tasks.failedChip":"доставку не виконано","tasks.killedChip":"процес агента зупинено","tasks.unhostedChip":"агент зараз не запущений","tasks.migratingChip":"агент переходить на інший акаунт","tasks.source":"джерело","tasks.sourceTitle":"Взято з","tasks.retry":"повторити доставку","tasks.retryLaunch":"повторити запуск","tasks.retryLaunchAria":"Повторити невдалий запуск для {title}","tasks.retryLaunched":"агента перезапущено","tasks.chipFailedTitle":"не доставлено: {error}","tasks.handoffChip":"закинуто в промпт цього агента — ще не надіслано","tasks.detach":"відв'язати","tasks.detachAria":"Відв'язати {title} від задачі","tasks.expand":"Розгорнути задачу","tasks.collapse":"Згорнути задачу","tasks.openAgent":"відкрити й показати панель агента","tasks.openAgentAria":"Відкрити агента {title}","tasks.openAgentUnavailableAria":"Відкрити агента {title} — недоступно: {reason}","tasks.openSource":"відкрити й показати розмову-джерело","tasks.openSourceAria":"Відкрити розмову-джерело {title}","tasks.openSourceUnavailableAria":"Відкрити розмову-джерело {title} — недоступно: {reason}","tasks.sourceGone":"розмови-джерела немає на дошці","tasks.relatedNav":"Пов'язані задачі","tasks.openTaskAria":"Відкрити задачу {title}","tasks.relatedAssignedTitle":"призначена цій розмові","tasks.relatedSourceTitle":"записана з цієї розмови","tasks.send":"надіслати","tasks.sendTitle":"Потягни стрілку на панель агента — задача ляже в його промпт (нічого не надсилається); клік — створить чернетку нової розмови","tasks.linkHanded":"закинуто в \xab{title}\xbb — перевір і надішли там","tasks.linkSent":"задачу надіслано → \xab{title}\xbb","tasks.spawn":"агент","tasks.spawnTitle":"Запустити нового агента з цією задачею як брифом","tasks.spawnGo":"Запустити","tasks.statusTitle":"Статус: {label} — клік перемикає (інбокс → призначено → заблоковано → готово)","tasks.status.inbox":"інбокс","tasks.status.assigned":"призначено","tasks.status.blocked":"заблоковано","tasks.status.done":"готово","tasks.delete":"видалити","tasks.deleteConfirm":"точно?","tasks.deleteAria":"Видалити задачу {title}","tasks.pickerTitle":"Кому надіслати","tasks.pickerAllChildren":"⤷ всім дітям","tasks.pickerEmpty":"у проєкті немає розмов","tasks.pickerSend":"Надіслати ({count})","tasks.sendOk":"Доставлено {delivered} з {total}","tasks.sendFailPart":"✗ „{title}“: {error}","tasks.spawnOk":"агента запущено в tmux {target}","tasks.composerToggle":"створити задачу","tasks.composerToggleTitle":"Увімкнено — текст стає задачею-карткою з призначеннями на вибір; вимкнено — проста розсилка без сліду","tasks.composerNeedsText":"для задачі потрібен текст","tasks.panelTitle":"Задачі","tasks.panelToggleAria":"Показати або сховати панель задач","tasks.panelThisProject":"цей проєкт","tasks.panelAll":"всі","tasks.panelEmpty":"задач поки нема — кинь картку інструментом \xabзадача\xbb (T)","tasks.panelClose":"Закрити панель задач","favorites.sectionTitle":"Обране","favorites.empty":"обраного поки нема — наведи на картку й тапни корону","favorites.focusTitle":"Показати {title} на дошці","tasks.sheetNew":"нова задача","tasks.sheetCreate":"Створити задачу","tasks.sheetBack":"Назад до списку задач","tasks.sheetTargets":{one:"{count} адресат",few:"{count} адресати",many:"{count} адресатів",other:"{count} адресатів"},"tasks.sheetAssignments":"призначення","tasks.sheetEmpty":"задач поки нема","tasks.sheetGone":"задачі вже немає","tasks.textNotSaved":"текст не зберігся — надсилання скасовано, спробуй ще раз","tasks.emptyTextBlocked":"порожній текст не зберігається — віднови текст задачі перед надсиланням","runtime.live":"наживо","runtime.reconnecting":"перепідключення","runtime.degraded":"деградовано","runtime.offline":"офлайн","runtime.resynced":"пересинхронізовано","runtime.connection":"з'єднання рантайму","runtime.announce.live":"з'єднання рантайму наживо","runtime.announce.reconnecting":"рантайм перепідключається","runtime.announce.degraded":"рантайм деградовано — опитування оновлень","runtime.announce.offline":"рантайм офлайн","runtime.announce.resynced":"рантайм пересинхронізовано зі свіжого знімка","runtime.staleSince":"застаріло {duration}","runtime.lastKnown":"останнє оновлення {duration} тому","runtime.legacyProvenance":"легасі \xb7 похідний стан","staging.badge":"Стейджинг","staging.badgeTitle":"Стейджинг-інстанс — ізольований стан; нічого звідси не торкається проду","runtime.drift":"розбіжність: {evidence}","runtime.driftDismiss":"Сховати","runtime.receipt.pending":"надсилання…","runtime.receipt.busyRetry":"Не вдалося доставити — агент зайнятий, повторимо","runtime.receipt.summary":"Спроб доставки: {count}","runtime.receipt.pendingCount":"очікують: {count}","runtime.receipt.attemptCount":"спроб: {count}","runtime.receipt.problemCount":"проблем: {count}","runtime.receipt.showDetails":"Показати деталі доставки","runtime.receipt.hideDetails":"Сховати деталі доставки","runtime.receipt.statusSummary":"Стан доставки: {pending}, {problems}.","runtime.receipt.statusPending":{one:"{count} повідомлення очікує",few:"{count} повідомлення очікують",many:"{count} повідомлень очікують",other:"{count} повідомлень очікують"},"runtime.receipt.statusProblems":{one:"{count} проблема",few:"{count} проблеми",many:"{count} проблем",other:"{count} проблем"},"runtime.receipt.delivering":"доставляється…","runtime.receipt.applying":"застосовується…","runtime.receipt.turn-started":"хід почато","runtime.receipt.steered":"вкладено в поточний хід","runtime.receipt.queued":"у черзі","runtime.receipt.queuedPos":"у черзі \xb7 #{position}","runtime.receipt.delivered":"доставлено","runtime.receipt.applied":"зміну застосовано","runtime.receipt.interrupted":"перервано","runtime.receipt.answered":"відповіджено","runtime.receipt.rejected":"відхилено: {reason}","runtime.receipt.failed":"збій: {reason}","runtime.receipt.uncertain":"невизначено — відновлення","runtime.receipt.retry":"Повторити","runtime.receipt.edit":"Змінити й надіслати","runtime.receipt.dismiss":"Прибрати","runtime.attention.title":"потрібне твоє рішення","runtime.attention.approval":"підтвердження","runtime.attention.permission":"дозвіл","runtime.attention.question":"питання","runtime.attention.waiting_heuristic":"можливо, чекає","runtime.attention.heuristicNote":"сигнал низької впевненості","runtime.attention.unowned":"немає відповідального","runtime.attention.command":"команда","runtime.attention.tool":"інструмент","runtime.attention.approve":"Схвалити","runtime.attention.deny":"Відхилити","runtime.attention.answer":"Відповісти","runtime.attention.answering":"відповідаю…","runtime.attention.expiresIn":"авторішення через {seconds}с","runtime.attention.keysHint":"Enter схвалює \xb7 Esc відхиляє","voice.start":"Почати безперервну голосову розмову","voice.stop":"Завершити голосову розмову","voice.connecting":"Підключаю голос…","voice.live":"Голосова розмова активна \xb7 говоріть у будь-який момент","voice.stopping":"Завершую голосову розмову…","voice.failed":"Голосове зʼєднання потребує уваги","voice.panel":"Голосова розмова","voice.you":"Ви","voice.agent":"Агент","voice.progress":"Перебіг","voice.retry":"Спробувати ще раз","voice.ended":"Голосову розмову завершено","voice.elapsed":"Тривалість дзвінка","voice.micLevel":"Рівень мікрофона","voice.micMute":"Вимкнути мікрофон","voice.micUnmute":"Увімкнути мікрофон","voice.outputMute":"Приглушити агента","voice.outputUnmute":"Увімкнути звук агента","voice.floatSurface":"Голосова розмова","voice.float":"Відкрити плавуче вікно голосу","voice.dock":"Закрити плавуче вікно, не завершуючи розмову","voice.floatUnsupported":"Плавуче вікно голосу потребує браузера на Chromium; розмова лишається тут.","attention.return":"Назад, де ви були","attention.returnLine":"Повернутися туди, де ви були"}},a="llv_lang",s="en",l=!1,o=new Set;function c(){return l||(l=!0,s=function(){try{let e=window.localStorage.getItem(a);if("en"===e||"uk"===e)return e}catch{}return("u">typeof navigator?navigator.language:"").toLowerCase().startsWith("uk")?"uk":"en"}(),document.documentElement.lang=s),s}function d(e){if(l=!0,e!==s){s=e;try{window.localStorage.setItem(a,e)}catch{}for(let t of("u">typeof document&&(document.documentElement.lang=e),o))t()}}function u(e){return o.add(e),()=>o.delete(e)}function p(e,t,n){var r;let a,s=i[e][t]??i.en[t]??t;if("string"==typeof s)a=s;else{let t="number"==typeof n?.count?n.count:0;a=s[new Intl.PluralRules("uk"===e?"uk-UA":"en-US").select(t)]??s.other??s.one??""}return r=a,n?r.replace(/\{(\w+)\}/g,(e,t)=>t in n?String(n[t]):e):r}function m(){let e=(0,r.useSyncExternalStore)(u,c,()=>"en");return{locale:e,t:(t,n)=>p(e,t,n),setLocale:d}}},5301:(e,t,n)=>{"use strict";n.d(t,{O:()=>s});var r=n(2115);let i="(pointer: coarse)";function a(e){let t=window.matchMedia(i);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)}function s(){return(0,r.useSyncExternalStore)(a,()=>window.matchMedia(i).matches,()=>!1)}},5606:(e,t,n)=>{"use strict";function r(e){return"viewer"===e||e.startsWith("viewer-")||e.startsWith("viewer_")||"agent-log-viewer"===e||e.startsWith("agent-log-viewer-")}function i(e){return e&&"object"==typeof e&&!Array.isArray(e)?e:{}}function a(e){return"string"==typeof e?e.trim():""}function s(e,t=120){let n=e.replace(/\s+/g," ").trim();return n.length>t?n.slice(0,t-1)+"…":n}function l(e){let t=a(e.conversationId);return t?[{kind:"conversation",id:t,label:"Open agent",href:`#c=${encodeURIComponent(t)}`}]:[]}function o(e,t){return a(e[`${t}Id`])||a(i(e[t]).id)}function c(e,t){return t?[{kind:e,id:t,label:"task"===e?"Open task":"Open pipeline",href:`#${e}=${encodeURIComponent(t)}`}]:[]}function d(e,t){return[!0===e.replay||!0===e.replayed?"Replay":"",t].filter(Boolean).join(" \xb7 ")}function u(e,t,n){let r=i(t),u=i(n);if("spawn_agent"===e){let e=[[a(r.model)||a(r.engine),a(r.effort),a(r.role)].filter(Boolean).join(" "),s(a(r.prompt))].filter(Boolean).join(" \xb7 ")||"new worker";return{icon:"bot",verb:"Creating",title:`Creating agent: ${e}`,subtitle:a(u.transcriptPath),links:l(u)}}if("send_message"===e){let e=a(u.conversationId)||a(r.conversationId);return{icon:"message",verb:"Sending",title:`Sending message${e?` to ${e}`:""}: ${s(a(r.text))||"message"}`,subtitle:d(u,a(u.operationId)),links:e?[{kind:"conversation",id:e,label:"Open conversation",href:`#c=${encodeURIComponent(e)}`}]:[]}}if("create_task"===e){let e=o(u,"task");return{icon:"task",verb:"Creating",title:`Creating task: ${s(a(r.text))||"untitled task"}`,subtitle:d(u,a(r.project)),links:c("task",e)}}if("update_task"===e){let e=o(u,"task")||a(r.taskId),t=a(r.status)||s(a(r.text))||"details";return{icon:"task",verb:"Updating",title:`Updating task${e?` ${e}`:""}: ${t}`,subtitle:d(u,""),links:c("task",e)}}if("create_pipeline"===e){let e=o(u,"pipeline");return{icon:"pipeline",verb:"Creating",title:`Creating pipeline: ${s(a(r.task))||"untitled pipeline"}`,subtitle:d(u,a(r.repoDir)),links:c("pipeline",e)}}if("pipeline_action"===e){let e=o(u,"pipeline")||a(r.pipelineId),t=a(r.action)||"update",n={start:"Starting",pause:"Pausing",resume:"Resuming","retry-stage":"Retrying","skip-stage":"Skipping stage in",close:"Closing",delete:"Deleting"};return{icon:"pipeline",verb:n[t]??"Updating",title:`${n[t]??"Updating"} pipeline${e?` ${e}`:""}`,subtitle:d(u,t),links:c("pipeline",e)}}if("link_task_to_pipeline"===e){let e=a(u.taskId)||a(r.taskId),t=a(u.pipelineId)||a(r.pipelineId);return{icon:"link",verb:"Linking",title:`Linking task to pipeline: ${e||"task"} → ${t||"pipeline"}`,subtitle:d(u,""),links:[...c("task",e),...c("pipeline",t)]}}if("list_conversations"===e){let e=a(r.project)||a(r.query);return{icon:"conversation",verb:"Listing",title:`Listing conversations${e?`: ${s(e)}`:""}`,subtitle:d(u,"number"==typeof u.count?`${u.count} found`:""),links:[]}}if("search_transcripts"===e){let e=s(a(r.query)),t="number"==typeof u.total?`${u.total} matches`:"";return{icon:"conversation",verb:"Searching",title:`Searching transcripts${e?`: ${e}`:""}`,subtitle:d(u,t),links:[]}}if("get_conversation"===e){let e=a(u.conversationId)||a(r.conversationId),t=a(u.transcriptPath)||a(r.transcriptPath),n=e?[{kind:"conversation",id:e,label:"Open conversation",href:`#c=${encodeURIComponent(e)}`}]:[];return{icon:"conversation",verb:"Opening",title:`Opening conversation: ${e||t||"conversation"}`,subtitle:d(u,t),links:n}}if("deploy_exact_sha"===e){let e=a(u.revision)||a(r.revision);return{icon:"deploy",verb:"Deploying",title:`Deploying release ${e?e.slice(0,12):"(current HEAD)"}`,subtitle:d(u,a(u.deploymentId)),links:[]}}if("get_pipeline"===e){let e=o(u,"pipeline")||a(r.pipelineId);return{icon:"pipeline",verb:"Opening",title:`Opening pipeline: ${e||"pipeline"}`,subtitle:d(u,a(i(u.pipeline).state)),links:c("pipeline",e)}}if("board_snapshot"===e)return{icon:"conversation",verb:"Reading",title:`Reading board snapshot${a(r.project)?`: ${s(a(r.project))}`:""}`,subtitle:d(u,"number"==typeof u.count?`${u.count} conversations`:""),links:[]};if("list_flows"===e)return{icon:"pipeline",verb:"Listing",title:`Listing flows${a(r.project)?`: ${s(a(r.project))}`:""}`,subtitle:d(u,"number"==typeof u.count?`${u.count} found`:""),links:[]};if("get_flow"===e){let e=a(r.flowId)||a(u.flowId);return{icon:"pipeline",verb:"Opening",title:`Opening flow: ${e||"flow"}`,subtitle:d(u,a(i(u.flow).state)),links:[]}}if("flow_action"===e){let e=a(r.flowId)||a(u.flowId),t=a(r.action),n={pause:"Pausing",resume:"Resuming",advance:"Advancing","retry-round":"Retrying","cancel-round":"Cancelling round in",extend:"Extending","another-round":"Starting another round in",close:"Closing"}[t]??"Updating";return{icon:"pipeline",verb:n,title:`${n} flow${e?` ${e}`:""}`,subtitle:d(u,t),links:[]}}if("list_pipelines"===e)return{icon:"pipeline",verb:"Listing",title:`Listing pipelines${a(r.project)?`: ${s(a(r.project))}`:""}`,subtitle:d(u,"number"==typeof u.count?`${u.count} found`:""),links:[]};if("conversation_action"===e){let e=a(u.conversationId)||a(r.conversationId),t={interrupt:"Interrupting",kill:"Killing",resume:"Resuming",compact:"Compacting","dialog-key":"Answering dialog in",archive:"Archiving",unarchive:"Unarchiving"}[a(r.action)]??"Controlling";return{icon:"message",verb:t,title:`${t} conversation${e?` ${e}`:""}`,subtitle:d(u,a(u.operationId)),links:e?[{kind:"conversation",id:e,label:"Open conversation",href:`#c=${encodeURIComponent(e)}`}]:[]}}if("operator_snapshot"===e)return{icon:"conversation",verb:"Reading",title:"Reading operator snapshot",subtitle:d(u,a(i(u.view).mode)),links:[]};if("list_tasks"===e)return{icon:"task",verb:"Listing",title:`Listing tasks${a(r.project)?`: ${s(a(r.project))}`:""}`,subtitle:d(u,"number"==typeof u.count?`${u.count} found`:""),links:[]};if("get_task"===e){let e=o(u,"task")||a(r.taskId);return{icon:"task",verb:"Opening",title:`Opening task: ${e||"task"}`,subtitle:d(u,a(i(u.task).status)),links:c("task",e)}}if("deployment_status"===e){let e=a(r.deploymentId)||a(u.deploymentId)||a(r.operationId)||a(u.operationId);return{icon:"deploy",verb:"Reading",title:`Reading deployment status${e?`: ${e}`:""}`,subtitle:d(u,a(i(u.deployment).state)||a(i(i(u.operation).receipt).status)),links:[]}}if("resources"===e)return{icon:"tool",verb:"Reading",title:"Reading resources",subtitle:d(u,Array.isArray(u.sessions)?`${u.sessions.length} sessions`:""),links:[]};if("conversation_migration"===e){let e=a(u.conversationId)||a(r.conversationId),t={reseat:"Reseating",retry:"Retrying",rollback:"Rolling back"}[a(r.action)]??"Migrating";return{icon:"conversation",verb:t,title:`${t} conversation migration${e?` for ${e}`:""}`,subtitle:d(u,a(u.operationId)),links:e?[{kind:"conversation",id:e,label:"Open conversation",href:`#c=${encodeURIComponent(e)}`}]:[]}}if("agent_activity"===e){let e=a(r.conversationId)||a(r.project)||"all live agents",t="number"==typeof u.stalledCount?u.stalledCount:null,n="number"==typeof u.count?`${u.count} checked`:"";return{icon:"conversation",verb:"Checking",title:`Checking agent activity: ${s(e)}`,subtitle:d(u,[n,t?`${t} stalled`:""].filter(Boolean).join(" \xb7 ")),links:l(r)}}if("lifecycle_events"===e){let e="digest"===a(r.mode),t=i(u.relay),n=Array.isArray(t.items)?t.items.length:0,l=a(r.pipelineId)||a(r.conversationId)||a(r.project),o=e?u.relay?`${a(t.reason)} relay \xb7 ${n} change(s)`:"nothing due":"number"==typeof u.count?`${u.count} event(s)`:"";return{icon:"pipeline",verb:e?"Polling":"Reading",title:`${e?"Polling lifecycle digest":"Reading lifecycle events"}${l?`: ${s(l)}`:""}`,subtitle:d(u,o),links:c("pipeline",a(r.pipelineId))}}if("request_attention"===e){let e=i(r.target),t=a(e.kind)||"target",n="open"===a(r.intent);return{icon:"conversation",verb:"Asking",title:`Asking to ${n?"open":"show"} a ${t}`,subtitle:d(u,s(a(r.reason))),links:"conversation"===t&&a(e.path)?[]:c("task"===t?"task":"pipeline",a(e.taskId)||a(e.pipelineId))}}return{icon:"tool",verb:"Running",title:`Running MCP tool: ${e||"unknown"}`,subtitle:"",links:[]}}n.d(t,{I:()=>r,Y:()=>u})},5775:(e,t,n)=>{"use strict";n.d(t,{BB:()=>a,BI:()=>l,Fe:()=>i,pB:()=>s,z3:()=>o});var r=n(744);function i(e,t={}){let n=new URLSearchParams({path:(0,r.ez)(e)});return t.download&&n.set("download","1"),`/api/artifact?${n.toString()}`}function a(e){let t=new URLSearchParams({path:(0,r.ez)(e),mode:"meta"});return`/api/artifact?${t.toString()}`}function s(e){return 404===e?"missing":403===e?"denied":415===e?"unsupported":413===e?"oversized":412===e?"changed":"error"}function l(e){return(0,r.ez)(e).split("/").pop()||e}function o(e){if(!Number.isFinite(e)||e<0)return"";if(e<1024)return`${e} B`;let t=["KiB","MiB","GiB","TiB"],n=e,r=-1;do n/=1024,r+=1;while(n>=1024&&r<t.length-1);return`${n>=100?Math.round(n):n.toFixed(1)} ${t[r]}`}},6027:(e,t,n)=>{"use strict";function r(e,t=160){let n=e.replace(/\[([^\]]+)\]\(([^)]+)\)/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/[*_~#>]+/g,"").replace(/\s+/g," ").trim().replace(/(?:\/[^\s)]+){3,}/g,e=>{if(e.length<=40)return e;let t=e.split("/").filter(Boolean);return t.length>=2?".../"+t.slice(-2).join("/"):e}).replace(/\s+/g," ").trim();return n.length>t?n.slice(0,t-1).trimEnd()+"…":n}n.d(t,{cr:()=>r})},6505:(e,t,n)=>{"use strict";n.d(t,{$:()=>v,IR:()=>w,T0:()=>l,cr:()=>a.cr,gA:()=>j,oC:()=>b,rK:()=>s,t7:()=>y,tz:()=>o,yj:()=>k,yz:()=>S,zZ:()=>N});var r=n(7532),i=n(4654),a=n(6027);function s(e){let t=(0,i.JK)(),n=Date.now()/1e3-e;return n<90?(0,i.Tl)(t,"time.agoSec",{n:Math.round(n)}):n<5400?(0,i.Tl)(t,"time.agoMin",{n:Math.round(n/60)}):n<129600?(0,i.Tl)(t,"time.agoHour",{n:Math.round(n/3600)}):(0,i.Tl)(t,"time.agoDay",{n:Math.round(n/86400)})}function l(e){if("string"!=typeof e&&"number"!=typeof e)return"";let t=new Date(e),n="uk"===(0,i.JK)()?"uk-UA":"en-US";return Number.isNaN(t.getTime())?"":t.toLocaleTimeString(n,{hour12:!1})}function o(e){return"live"===e?"animate-pulse bg-success":"recent"===e?"bg-warning":"stalled"===e?"bg-danger":"bg-strong"}let c={codex:"#2f6fd0",claude:"#d97757"},d="#9a9aa4",u=[[/fable|mythos/,"#c2410c"],[/opus/,"#8a5ad6"],[/sonnet/,"#e0913f"],[/haiku/,"#d9a58c"]],p=[[/terra/,"#2b7a62"],[/sol/,"#a55b18"],[/spark/,"#5ea3e4"],[/mini|nano/,"#7fb1e8"],[/codex/,"#1d55ab"]];function m(e,t,n,r){let i=Math.round(e),a=Math.round(t),s=Math.round(n),l=`hsl(${i} ${a}% ${s}%)`,o=`hsl(${i} ${Math.min(a,78)}% ${Math.round(r)}%)`;return{color:`light-dark(${l}, ${o})`,soft:`hsl(${i} ${a}% ${s}% / 0.14)`}}function f(e){let[t,n,r]=g(e);return m(t,n,r,Math.max(r,68))}function h(e){let t=c[e.engine];if(!t)return d;let n=(e.model??"").toLowerCase();for(let[t,r]of"codex"===e.engine?p:u)if(t.test(n))return r;return t}let x={minimal:{dl:20,ds:-32},low:{dl:12,ds:-20},medium:{dl:0,ds:0},high:{dl:-8,ds:12},xhigh:{dl:-14,ds:22},max:{dl:-19,ds:30},ultra:{dl:-24,ds:36}};function g(e){let t=parseInt(e.slice(1),16),n=(t>>16&255)/255,r=(t>>8&255)/255,i=(255&t)/255,a=Math.max(n,r,i),s=Math.min(n,r,i),l=(a+s)/2,o=a-s;if(0===o)return[0,0,100*l];let c=o/(1-Math.abs(2*l-1));return[60*(a===n?((r-i)/o+6)%6:a===r?(i-n)/o+2:(n-r)/o+4),100*c,100*l]}function b(e){let t=h(e),n=x[e.effort??""];if(!n)return f(t);let[r,i,a]=g(t),s=(e,t=0,n=100)=>Math.min(n,Math.max(t,e));return m(r,s(i+n.ds),s(a+n.dl),s(72-n.dl,58,90))}function v(e){return e.effort?(0,i.Tl)((0,i.JK)(),"util.effortTitle",{effort:e.effort}):void 0}function w(e){return(0,r.IR)(e.engine,e.model,e.effort)}function y(e){return f(c[e]??d)}function k(e){return f(h(e)).color}function j(e){return{backgroundColor:f(h(e)).color}}function N(e){let t=f(c[e]??d);return{label:({codex:"Codex",claude:"Claude",shell:"Bash"})[e]??e,style:{backgroundColor:t.soft,color:t.color}}}function S(e){return N(e.engine)}},7516:(e,t,n)=>{"use strict";n.d(t,{Ap:()=>C,K8:()=>A});var r=n(4654),i=n(1691),a=n(3550),s=n(538),l=n(98);let o=(e,t)=>(0,r.Tl)((0,r.JK)(),e,t),c={shell:"shell",read:"file",write:"file",edit:"edit",search:"search",web:"web",spawn:"spawn",plan:"plan",mcp:"tool",other:"tool"};function d(e){return"string"==typeof e?e:""}function u(e){return"number"==typeof e&&Number.isFinite(e)?e:"string"==typeof e&&e.trim()&&Number.isFinite(Number(e))?Number(e):void 0}function p(e){return"string"==typeof e?e.trim():"number"==typeof e&&Number.isFinite(e)?String(e):""}function m(e){let t=e.replace(/[/\\]+$/,"");return(t.split(/[/\\]/).pop()??t)||t}function f(e){for(let t of Object.values(e))if("string"==typeof t&&t.trim())return t;return""}function h(e,t){let n=e.replace(/\s+/g," ").trim();return n.length>t?n.slice(0,t-1)+"…":n}function x(e){return h((0,i.fp)(e),160)}function g(e,t){let n=h((0,i.fp)(e),120);return t?{label:t,value:n}:{value:n}}let b=new Set(["Bash","exec_command","shell","local_shell","run_command"]),v=new Set(["Read"]),w=new Set(["Write"]),y=new Set(["Edit","MultiEdit","NotebookEdit","apply_patch"]),k=new Set(["Grep","Glob"]),j=new Set(["WebFetch","WebSearch"]),N=new Set(["Task","Agent","Workflow","Skill"]),S=new Set(["TodoWrite","TaskCreate","TaskUpdate","EnterPlanMode","ExitPlanMode"]);function C(e){return/^mcp__/.test(e)?"mcp":b.has(e)?"shell":v.has(e)?"read":w.has(e)?"write":y.has(e)?"edit":k.has(e)?"search":j.has(e)?"web":N.has(e)?"spawn":S.has(e)?"plan":"other"}function A(e,t,n,r){let i=C(e),h=c[i],b=(e,t=[])=>({family:i,icon:h,summary:x(e),chips:t.slice(0,4)});if("write_stdin"===e){let e=p(t.session_id??t.cell_id),n=d(t.chars),r=0===n.length?o("tools.stdinPoll"):(0,s.WI)(n),i=e?`${o("tools.stdin")} → ${e} \xb7 ${r}`:`${o("tools.stdin")} \xb7 ${r}`;return{family:"shell",icon:c.shell,summary:x(i),chips:e?[g(e,o("tools.session"))]:[]}}if("wait"===e){let e=p(t.cell_id??t.session_id),n=e?`${o("tools.wait")} \xb7 ${e}`:o("tools.wait");return{family:"shell",icon:c.shell,summary:x(n),chips:e?[g(e,o("tools.session"))]:[]}}let v=(0,a.$f)(e);if(v){if("wakeup"===v){let e=d(t.reason);return{family:"plan",icon:"clock",summary:x(e?`${o("tools.wakeup")} \xb7 ${e}`:o("tools.wakeup")),chips:[]}}if("cron"===v){let e=d(t.schedule??t.cron??t.interval??t.when),n=[e,d(t.name??t.prompt??t.task??t.description)].filter(Boolean).join(" \xb7 "),r=n?`${o("tools.cron")} \xb7 ${n}`:o("tools.cron"),i=[];return e&&i.push(g(e,o("tools.schedule"))),{family:"plan",icon:"clock",summary:x(r),chips:i}}let e=d(t.reason??t.until??t.description??t.target)||f(t);return{family:"plan",icon:"clock",summary:x(e?`${o("tools.monitor")} \xb7 ${e}`:o("tools.monitor")),chips:[]}}switch(i){case"shell":return b(function(e){let t,n=e;do t=n,n=(n=(n=(n=n.replace(/^export PATH=[^;]+;\s*/,"")).replace(/^cd\s+\S+\s*&&\s*/,"")).replace(/^\/usr\/bin\/zsh -lc\s+/,"")).replace(/^(["'])([\s\S]*)\1$/,(e,t,n)=>RegExp(`(?<!\\\\)${t}`).test(n)?e:n);while(n!==t);let r=n.match(/^([\w./-]+(?:\s+-)?)\s*<<\s*['"]?(\w+)['"]?/);return r&&(n=`${r[1].trim()} \xabheredoc\xbb`),n.replace(/\s+/g," ").trim()}("codex"===n?d(t.cmd??t.command):d(t.command??t.cmd))||e,[]);case"read":{let{summary:e,chips:n}=function(e){let t=d(e.file_path??e.path);if(!t)return{summary:o("tools.read"),chips:[]};let n=m(t),r=u(e.offset),i=u(e.limit),a=void 0!==r?void 0!==i?`:${r}–${r+i}`:`:${r}`:"";return{summary:`${o("tools.read")} ${n}${a?` \xb7 ${a}`:""}`,chips:[g(t)]}}(t);return b(e,n)}case"write":{let e=d(t.content??t.new_string),n=d(t.file_path??t.path),r=e?e.split("\n").length:0,i=n?m(n):"";return b(i?`${o("tools.write")} ${i} \xb7 ${o("tools.lines",{count:r})}`:o("tools.write"),n?[g(n)]:[])}case"edit":{let{summary:n,chips:i}=function(e){let{added:t,removed:n}=function(e){let t=0,n=0;for(let r of e.files)t+=r.added,n+=r.removed;return{added:t,removed:n}}(e),r=`+${t} −${n}`,i=e.files;if(0===i.length)return{summary:o("tools.edit"),chips:[]};let a=i.slice(0,4).map(e=>g(e.path));return 1===i.length?{summary:`${o("tools.edit")} ${m(i[0].path)} \xb7 ${r}`,chips:a}:{summary:`${o("tools.edit")} \xb7 ${o("tools.files",{count:i.length})} \xb7 ${r}`,chips:a}}(r??(0,l.AD)(e,t));return b(n,i)}case"search":{let n=d(t.pattern??t.query??t.regex),r=d(t.path??t.glob??t.include),i=n?`"${n}"${r?` \xb7 ${r}`:""}`:e,a=[];return n&&a.push(g(n)),r&&a.push(g(r)),b(i,a)}case"web":{let n=d(t.url);if(n)return b(function(e){try{let t=new URL(e),n=`${t.host}${t.pathname}`.replace(/\/$/,"");return n.length>80?n.slice(0,79)+"…":n}catch{return e.length>80?e.slice(0,79)+"…":e}}(n),[g(n)]);let r=d(t.query);return b(r?`"${r}"`:e,r?[g(r)]:[])}case"spawn":{let n=d(t.subagent_type??t.agentType??t.skill??t.command??t.name??t.type),r=d(t.description??t.prompt??t.task),i=[n,r].filter(Boolean).join(" \xb7 ")||e,a=[];return n&&a.push(g(n)),r&&a.push(g(r)),b(i,a)}case"plan":{let n=Array.isArray(t.todos)?t.todos.length:void 0,r=void 0!==n?o("tools.items",{count:n}):f(t);return b(r?`${e} \xb7 ${r}`:e,r?[g(r)]:[])}case"mcp":{let n=e.replace(/^mcp__/,"").split("__"),r=n[0]??e,i=n.slice(1).join("__")||e,a=f(t);return b(`${r} \xb7 ${i}${a?` \xb7 ${a}`:""}`,a?[g(a)]:[])}default:{let n=f(t);return b(n?`${e}: ${n}`:e,n?[g(n)]:[])}}}},7532:(e,t,n)=>{"use strict";n.d(t,{IR:()=>o,Lw:()=>r,TS:()=>c,ve:()=>l,z9:()=>i});let r={claude:["low","medium","high","xhigh","max"],codex:["low","medium","high","xhigh"]};function i(e,t){return r[e].includes(t)}let a=["minimal","low","medium","high","xhigh","max","ultra"],s=[[/^gpt-5\.6-(sol|terra)\b/,["low","medium","high","xhigh","max","ultra"]],[/^gpt-5\.6\b/,["low","medium","high","xhigh","max"]]];function l(e,t){if("claude"===e)return r.claude;if("codex"!==e)return null;let n=(t??"").trim().toLowerCase();for(let[e,t]of s)if(e.test(n))return t;return r.codex}function o(e,t,n){let r=l(e,t),i=(n??"").trim().toLowerCase();if(!r||!i)return{level:0,slots:0};let s=r.length,o=r.indexOf(i);if(o>=0)return{level:o+1,slots:s};let c=a.indexOf(i);return c<0?{level:0,slots:0}:{level:Math.min(Math.max(r.filter(e=>a.indexOf(e)<c).length,1),s),slots:s}}function c(e,t,n){let r=l(e,t);if(!r||0===r.length)return null;let i=(n??"").trim().toLowerCase();if(r.includes(i))return i;let{level:a}=o(e,t,i);return a>0?r[a-1]:r[0]}},8074:(e,t,n)=>{"use strict";n.d(t,{copyText:()=>o,i:()=>c});var r=n(5155),i=n(2115),a=n(5301),s=n(9992),l=n(3194);async function o(e){try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{let t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();let n=document.execCommand("copy");return t.remove(),n}catch{return!1}}function c({text:e,label:t,className:n=""}){let d=(0,a.O)(),[u,p]=(0,i.useState)(!1),m=(0,i.useRef)(null);(0,i.useEffect)(()=>()=>{null!==m.current&&window.clearTimeout(m.current)},[]);let f=u?(0,l.tr)("common.copied"):t??(0,l.tr)("common.copy");return(0,r.jsx)("button",{type:"button","aria-label":f,title:f,onClick:t=>{t.preventDefault(),t.stopPropagation(),o(e).then(e=>{e&&(p(!0),null!==m.current&&window.clearTimeout(m.current),m.current=window.setTimeout(()=>p(!1),1400))})},className:`inline-flex shrink-0 items-center justify-center rounded-[6px] border border-border bg-card text-muted shadow-1 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${d?"h-11 w-11":"p-1"} ${n}`,children:u?(0,r.jsx)(s.Jl,{className:d?"h-4 w-4 text-success":"h-3 w-3 text-success","aria-hidden":!0}):(0,r.jsx)(s.QR,{className:d?"h-4 w-4":"h-3 w-3","aria-hidden":!0})})}},9097:(e,t,n)=>{Promise.resolve().then(n.bind(n,754))},9375:(e,t,n)=>{"use strict";n.d(t,{en:()=>r});let r={"common.serverUnavailable":"server unavailable","common.loading":"loading…","common.loadingCap":"Loading…","common.cancel":"Cancel","common.edit":"edit","common.show":"show","common.showAll":"show all","common.collapse":"collapse","common.copy":"Copy","common.copied":"copied","common.clickToCopy":"click to copy","common.yes":"Yes","common.no":"No","common.send":"Send","common.sending":"sending…","common.sent":"sent","common.close":"Close","common.failedSend":"couldn't send","common.failedDelete":"couldn't delete","common.nothingFound":"Nothing found","common.nothingRunning":"nothing is running right now","common.kb":"kB","common.chars":"{n} chars","lang.aria":"Interface language","util.effortTitle":"Reasoning effort: {effort}","runtimeConfig.model":"Running agent model","runtimeConfig.effort":"Running agent reasoning effort","runtimeConfig.speedTitle":"Fast uses the Codex priority service tier","runtimeConfig.apply":"Apply","runtimeConfig.failed":"Could not change the running agent configuration","runtimeConfig.pending":"switch pending","runtimeConfig.applied":"Conversation settings applied","time.agoSec":"{n}s ago","time.agoMin":"{n}m ago","time.agoHour":"{n}h ago","time.agoDay":"{n}d ago","turn.worked":"Worked for {d}","turn.running":"working {d}","turn.lastRun":"last run: {d}","turn.timer":"elapsed work time","cardStatus.needsYou":"needs you","cardStatus.held":"held","cardStatus.running":"working","cardStatus.queued":"queued","cardSwitch.pending":"switch pending","cardSwitch.pendingTo":"\xab{label}\xbb pending","cardSwitch.switching":"switching…","cardSwitch.switchingTo":"→ \xab{label}\xbb","cardSwitch.failed":"switch failed","cardSwitch.route":"\xab{from}\xbb → \xab{to}\xbb","kind.session":"session","kind.subagent":"subagent","kind.job":"job","kind.background":"background","kind.handoff":"handoff","rail.title":"Agent logs","rail.filter":"Filter projects…","rail.projects":"Projects","rail.overview":"Overview","rail.archive":"Archive","rail.crown":"Crown — pin to top","rail.uncrown":"Remove crown","rail.createProject":"Create project","rail.newProjectName":"Project name","rail.newProjectRoot":"Root directory (absolute path)","rail.create":"Create","rail.creating":"Creating…","rail.invalidName":"Enter a project name","rail.invalidRoot":"Directory not found","rail.missingRoot":"This directory doesn't exist yet","rail.createRootAndProject":"Create directory and project","rail.mkdirFailed":"Couldn't create the directory","rail.duplicateProject":"This project already exists","rail.createFailed":"Couldn't create the project","dash.branchesLive":{one:"{count} branch running",other:"{count} branches running"},"dash.trees":{one:"{count} tree",other:"{count} trees"},"dash.recentConvos":{one:"{count} recent conversation",other:"{count} recent conversations"},"dash.quietTrees":{one:"{count} quiet tree",other:"{count} quiet trees"},"dash.openProjects":"Open project list","dash.createMenu":"Create","dash.moreMenu":"More actions","dash.soundMenu":"Sound alerts","dash.unarchive":"Restore from archive","dash.newConvo":"New conversation with an agent","dash.agent":"Agent","dash.newWorkflow":"New workflow: stages → review → PR","dash.workflow":"Workflow","dash.task":"Task","dash.newTask":"New task","dash.pipelinesUnavailable":"Pipelines are temporarily unavailable: the pipelines state file could not be read. Other panels stay live.","dash.loadingBoard":"Loading the board…","dash.emptyTitle":"The scheme is empty for now","dash.emptyHint":"Open the switchboard in the bottom-right corner and click a conversation — it will appear here","dash.viewScheme":"scheme","dash.viewList":"conversations","dash.viewSchemeMenu":"View: scheme","dash.viewListMenu":"View: conversations","dash.viewMenuGroup":"Board view","dash.hiddenShelf":"Hidden","trash.title":"Root conversations","trash.hint":"Clicking a row opens the conversation as a node; the trash icon deletes its file from disk permanently.","trash.deletedFromDisk":"\xb7 deleted from disk","trash.open":"Open {title}","trash.activeSubtree":"active branches","trash.toArchive":"Archive","trash.notDeleted":"{failed} of {total} not deleted","trash.confirmDelete":{one:"Delete {count} project file from disk?",other:"Delete {count} project files from disk?"},"trash.deleting":"deleting…","trash.confirmYes":"Yes, delete","trash.deleteProject":"Delete project from disk","trash.projectLoadFailed":"Could not load every project conversation","list.title":"All conversations","list.hint":"Loaded in recent-first pages from every conversation stored for this project.","list.searchHint":"Searching every conversation stored across all projects.","list.loadMore":"Load more conversations","list.failed":"Could not load conversations","list.retry":"Retry","search.open":"Search your messages (/)","search.openMobile":"Search your messages","search.title":"Find my messages","search.aria":"Global message search","search.placeholder":"Search everything you've sent…","search.mine":"My messages","search.everything":"Everything","search.speakerAria":"Search scope","search.hint":"Type to search everything you've sent — every project, engine and account.","search.keysHint":"↑ ↓ to move \xb7 Enter to open \xb7 Esc to close","search.results":"Results","search.updating":"updating…","search.loadMore":"More results","search.none":"Nothing found for \xab{query}\xbb","search.corpus":"Searched {messages} across {conversations}","search.corpusMessages":{one:"{formatted} message",other:"{formatted} messages"},"search.corpusConversations":{one:"{formatted} conversation",other:"{formatted} conversations"},"search.everythingInstead":"Search everything instead","search.failed":"Search failed","search.retry":"Retry","search.untitled":"(no title)","search.speaker.you":"you","search.speaker.agent":"agent","search.close":"Close search","switch.aria":"Agent switchboard","switch.title":"Switchboard","switch.search":"Search title, first prompt, or project","switch.results":"All conversation results","switch.updating":"updating…","switch.close":"Close switchboard","switch.waiting":"Waiting for you","switch.working":"Working","switch.recent":"Recent","switch.older":"Older","switch.hidden":"Hidden ({count})","switch.hide":"hide","switch.restore":"restore","accounts.activeAria":"Active Codex account","accounts.placeholder":"Codex account","accounts.add":"Add","accounts.prompt":"Account label","accounts.login":"login","accounts.switchFailed":"Could not switch account","accounts.conversationTitle":"Run this conversation on","accounts.conversationPending":"Account switch pending","accounts.conversationApplied":"Conversation account switched","accounts.conversationUnconfirmed":"Account switch got no confirmation — try again","accounts.manage":"Manage accounts…","accounts.addFailed":"Could not add account","accounts.loginOpened":"Device login opened in {target}","accounts.openLogin":"Open sign-in","accounts.refreshFailed":"Could not refresh accounts. Try again.","accounts.loading":"Loading accounts…","accounts.noAccounts":"No accounts available yet.","limits.accountLoading":"Loading account limits…","accounts.retry":"Retry","accounts.title":"Codex accounts","accounts.trigger":"Accounts","accounts.active":"active","accounts.needsLogin":"needs sign-in","accounts.pendingLogin":"signing in…","accounts.auth.authenticated":"Authenticated","accounts.auth.signedOut":"Signed out","accounts.auth.unknown":"Auth unchecked","accounts.auth.error":"Auth error","accounts.operation.refresh":"Refreshing accounts…","accounts.operation.add":"Starting account sign-in…","accounts.operation.switch":"Switching the account for future launches…","accounts.operation.login":"Updating sign-in…","accounts.operation.remove":"Removing account…","accounts.operation.terminal":"Preparing the account command…","accounts.terminalCopied":"Command copied for {label}","accounts.terminalFailed":"Could not prepare the command for {label}","accounts.copyCli":"Copy CLI","accounts.copyCliAria":"Copy the agent command for {label}","accounts.labelPlaceholder":"New account label","accounts.confirmAdd":"Add","accounts.close":"Close","accounts.remove":"Remove","accounts.removeAria":"Remove {label}","accounts.removeConfirm":"Remove this account? Its past conversations stay readable.","accounts.removeConfirmCta":"Confirm","accounts.removeConfirmCancel":"Cancel","accounts.removeBlocked":"{label} still has an active session or sign-in.","accounts.removeHistoryBlocked":"{label} still runs live conversations. Wait for them to finish, then remove it.","accounts.removeFailed":"Could not remove this account.","accounts.cleanupPending":"{label} was removed. Its local data still needs cleanup.","accounts.cleanupManual":"Some local account data failed safety checks. Inspect and remove it manually.","accounts.cleanupFailed":"Could not clean up abandoned homes.","accounts.forceRemove":"Force remove","accounts.cleanupOrphans":"Clean up abandoned homes","accounts.titleFor":"{engine} accounts","accounts.triggerAria":"{engine} accounts — switch or add","accounts.effective":"{pct}%","accounts.effectiveTip":"{window} binds","accounts.effectiveStale":"{window} binds \xb7 stale","accounts.limitsAria":"Quota windows for {label}","accounts.limitsChecked":"Checked","accounts.limitsStale":"Last known values","accounts.limitsStaleTip":"Last known values — not a live read","accounts.claudeLoginStarted":"Sign-in started for {label}","accounts.claudeLogin.starting":"Starting sign-in…","accounts.claudeLogin.awaitingBrowser":"Waiting for the sign-in link…","accounts.claudeLogin.openLink":"Open claude.ai sign-in","accounts.claudeLogin.codeLabel":"Authorization code","accounts.claudeLogin.codePlaceholder":"Paste the code from the browser","accounts.claudeLogin.codeHint":"After signing in, copy the code claude.ai shows and paste it here.","accounts.claudeLogin.submit":"Submit code","accounts.claudeLogin.verifying":"Verifying…","accounts.claudeLogin.canceling":"Canceling…","accounts.claudeLogin.cancel":"Cancel","accounts.claudeLogin.signIn":"Sign in","accounts.claudeLogin.groupAria":"{label} sign-in","accounts.claudeLogin.err.timed_out":"Sign-in timed out.","accounts.claudeLogin.err.interrupted":"Sign-in was interrupted by a restart.","accounts.claudeLogin.err.verification_failed":"The code could not be verified.","accounts.claudeLogin.err.input_failed":"The code could not be submitted.","accounts.claudeLogin.err.login_busy":"Another sign-in is already in progress.","accounts.claudeLogin.err.generic":"Sign-in could not start. Try again.","accounts.claudeLogin.announceCodeReady":"Sign-in link ready for {label}. Open it and paste the code.","accounts.claudeLogin.announceDone":"{label} signed in.","migrate.confirmTitle":"Switch {engine} to \xab{label}\xbb?","migrate.confirmBody":"New agents use \xab{label}\xbb immediately. {idle} active sessions switch now; {busy} switch after their current turn; {deferred} inactive conversations switch when you message them again.","migrate.confirmCta":"Switch account","migrate.confirmAllCta":"Migrate all ({total})","migrate.confirmCancel":"Cancel","migrate.retargetTitle":"Redirect migration to \xab{label}\xbb?","migrate.retargetBody":"A migration to \xab{current}\xbb is still running. New agents use \xab{label}\xbb immediately; active sessions redirect there, while inactive conversations move when you message them. Migrate all also moves deferred history and previously moved conversations now.","migrate.banner":"Migrating to \xab{label}\xbb — {done}/{total} done","migrate.bannerWaiting":"{n} waiting on turns","migrate.bannerFailed":"{n} failed","migrate.bannerAria":"{engine} migration progress","migrate.stop":"Stop migration","migrate.bannerRetryFailed":"Retry failed ({n})","migrate.stoppedNotice":"Migration stopped. Remaining sessions stay on their current account; new agents keep using \xab{label}\xbb.","migrate.failedNotice":"{n} sessions couldn't move to \xab{label}\xbb.","migrate.completeNotice":"All {engine} sessions now on \xab{label}\xbb","migrate.announceComplete":"All {engine} sessions now on {label}","migrate.cardPending":"Account switch pending — after current turn","migrate.cardSwitching":"Switching to \xab{label}\xbb…","migrate.cardSwitchingUnnamed":"Switching account…","migrate.cardFailed":"Account switch failed","migrate.cardRetry":"Retry","migrate.cardKeep":"Keep on \xab{label}\xbb","migrate.ribbonAria":"Account migration status","migrate.divider":"Continued from \xab{label}\xbb — previous transcript archived","migrate.openPrevious":"Open previous transcript","migrate.heldSend":"Message held — delivers after the switch","migrate.readOnlyPredecessor":"Archived — this conversation continued under \xab{label}\xbb","migrate.retryFailed":"Couldn't retry the switch","migrate.keepFailed":"Couldn't keep this session on its current account","migrate.recoveryFailed":"{detail}","autobalance.title":"Auto balance","autobalance.desc":"Switches this engine's sessions when the active account drops below {threshold}% and another has more.","autobalance.toggleAria":"Auto balance for {engine}","autobalance.idle":"Last check {time} \xb7 no switch needed","autobalance.waitingFresh":"Paused — waiting for fresh quota data","autobalance.cooldown":"Cooldown — next check in {n} min","autobalance.draining":"Balancing now…","autobalance.switched":"Switched to \xab{to}\xbb at {time} — \xab{from}\xbb fell to {pct}% ({window})","autobalance.bannerTag":"Auto","autobalance.override":"Auto balance suggested \xab{to}\xbb; your choice takes over.","limits.windowSession":"5h window","limits.windowWeekly":"weekly window","switchCard.openColumn":"Open {title} as a column","switchCard.remove":"Remove from switchboard","composer.imagesCount":{one:"{count} image",other:"{count} images"},"composer.spawned":"launched agent in tmux {target}","composer.sentPaths":"sent {count} path(s)","composer.failedInterrupt":"couldn't interrupt","composer.escapeSent":"sent Escape — agent interrupted","composer.escapeSentWaiting":"sent Escape — waiting for the agent to stop","composer.spawnAria":"Launch an agent with a prompt","composer.resolvingAria":"Message the existing agent — delivery starts after its host is resolved","composer.sendAria":"Send a message to the agent in tmux {target}","composer.sendStructuredAria":"Send a message through the structured runtime host","composer.queueAria":"Queue of sent messages","composer.removeFromQueue":"Remove from queue","composer.deliveryHeld":"Held for \xab{label}\xbb — delivers after the account switch","composer.deliveryHeldUnnamed":"Held — delivers after the account switch","composer.deliveryHeldWaiting":"Held — waiting to be delivered","composer.admissionTimedOut":"Delivery confirmation timed out. Checking the durable receipt; your message remains preserved.","composer.deliveryUnconfirmed":"Delivery couldn't be confirmed. Your message is preserved — send again to retry safely; the same message key is reused.","composer.runtimePill":"Model and reasoning — applies to your next message","composer.reasoningGroup":"Reasoning","composer.modelGroup":"Model","composer.speedGroup":"Speed","composer.speedStandard":"Standard","composer.speedFastTier":"Fast — priority tier","composer.backTo":"Back","composer.nextMessageUses":"Next message: {model} \xb7 {effort}","composer.settingsNextResume":"applies when the conversation is next resumed","composer.structuredImagesUnavailable":"Image delivery is unavailable for structured conversations","composer.codexImagesTextOnly":"The selected Codex model accepts text input only.","composer.structuredImagesProtocol":"This structured host has no negotiated image capability.","composer.imagesBlockedDuringRecovery":"Drafted images will be sent after the host recovers; text can be sent right away.","composer.imageCapabilityLoading":"Image capability is loading.","composer.imageCapabilityError":"Image capability could not be loaded.","composer.imageCapabilityRetry":"Retry image check","composer.attachTerminal":"Attach terminal viewer","composer.attachTerminalReady":"terminal viewer ready in tmux {target}","composer.attachTerminalFailed":"couldn't create the terminal viewer","composer.receiptHeld":"held","composer.receiptQueued":"queued","composer.receiptRecovering":"recovering","composer.receiptFailed":"not delivered","composer.deliveredEcho":"Delivered — appearing in the feed","composer.retrySend":"Retry send","composer.placeholderRelay":"type — I'll relay through the root session…","composer.placeholderSpawn":"prompt — the agent will start…","composer.placeholderResolving":"message the agent — reconnecting to its session…","composer.placeholderSend":"message the agent…","composer.placeholderOrchestrator":"what should get done in {project}?","composer.textAria":"Text for the agent","composer.optionsShow":"Show message options","composer.optionsHide":"Hide message options","composer.titleRelay":"relayed through the branch's root session","composer.titleSpawnResumed":"starts a fresh agent session that continues this conversation","composer.root":"root","composer.interruptAria":"Interrupt the agent (Escape)","composer.interruptTitle":"send Escape to the agent pane","composer.compactAria":"Compact the agent's context (/compact)","composer.compactTitle":"send /compact — the agent condenses its context; a band appears in the feed when done","composer.compactConfirm":"Compact?","composer.compactConfirmTitle":"Click again to send /compact","composer.compactSent":"compaction started — the band will appear in the feed once it's done","composer.failedCompact":"couldn't start compaction","composer.addImages":"Add images","composer.moreTools":"More actions","composer.stopAndSend":"Stop recording and send","composer.launchAgent":"Launch the agent","composer.sendToAgent":"Send to the agent","composer.stopAndSendTitle":"stop recording and send","composer.sendMenuTitle":"Send options","composer.quickAck":"Yes, continue","composer.quickAckLabel":"Continue","composer.quickAckAria":"Send a quick “Yes, continue” to the agent","composer.quickAckTitle":"Quick reply — yes, continue","strip.live":"live","strip.resume":"resume","strip.deadMode":"dead host","strip.moreActions":"More actions","strip.stopSubagent":"interrupts the root agent","strip.compactSubagent":"not available for subagents","strip.structuredUnsupported":"the structured host does not support this action yet","strip.compactEngineUnsupported":"this engine has no compact control","strip.compactBusyTurn":"not while a turn is running","strip.resolving":"resolving the agent host…","deadHost.title":"Agent inactive \xb7 {since} — messages will queue","deadHost.body":"Text you send now is saved durably and delivered after the host recovers. Images can't be attached until then. Pending approvals expired — recover with the controls below.","deadHost.respawn":"Respawn conversation","deadHost.attach":"Open in terminal","deadHost.recheck":"Re-check","deadHost.recheckFailed":"Couldn't reach the runtime — try again.","strip.recheckHint":"Re-check the runtime host","deadHost.respawnFailed":"Respawn failed — try again.","deadHost.sendBlocked":"host is dead — respawn to continue","deadHost.expiredCard":"expired — the host died before this was answered","superseded.title":"Round superseded \xb7 {since}","superseded.body":"A recovery replaced this round with a live successor. This transcript stays as round history.","superseded.open":"Open the live round","superseded.resumeHere":"Resume here","superseded.resumeConfirm":"Resume this retired round? It forks the work: this card goes live again beside the successor.","superseded.resumeFailed":"Couldn't clear the supersedence link — try again.","superseded.sendBlocked":"round superseded — open the live successor","lineage.continues":"round {round} \xb7 continues previous","lineage.continuesTitle":"Round {round}: continues a superseded predecessor round — click to open it","attach.dialogTitle":"Attach in your terminal","attach.dialogIntro":"Runs this conversation in your own terminal with the same account ({account}) and working directory.","attach.copyCwd":"Copy working directory","attach.copyCommand":"Copy command","attach.copyFull":"Copy full command","attach.copiedFull":"Full command copied to clipboard","attach.takeoverWarning":"Resuming here takes over the conversation from the viewer.","attach.subagentNote":"Subagents resume through their root session.","attach.secondaryViewer":"Open a read-only viewer pane in tmux","attach.secondaryFailed":"Couldn't open the viewer pane — try again.","receipt.human.deadHost":"the agent's host has died","receipt.human.staleKey":"the delivery key was stale","receipt.human.duplicate":"already delivered","receipt.human.turnActive":"the agent is mid-turn","receipt.human.noTurn":"there is no active turn","receipt.human.unsupportedCapability":"this engine has no such control","receipt.human.verbatim":"not delivered: {reason}","spawnCard.starting":"Launch admitted. Starting the agent.","spawnCard.binding":"Agent identity allocated. Binding the structured host.","spawnCard.queued":"The structured host is ready. The initial message is queued.","spawnCard.reconciling":"Delivery is reconciling with the structured host.","spawnCard.recoverable-timeout":"The initial-message timeout is recoverable while durable delivery settles.","spawnCard.live-late-success":"Late delivery succeeded and the live conversation was adopted.","spawnCard.failed":"The launch ended with an error.","spawnCard.recovered":"Durable evidence recovered this launch.","spawnCard.initial.pending":"Initial message: waiting for host binding","spawnCard.initial.queued":"Initial message: queued","spawnCard.initial.delivered":"Initial message: delivered","spawnCard.initial.failed":"Initial message: failed","spawnCard.retrySafe":"This launch is closed. You can start a new attempt.","spawnCard.pinUnavailableFallback":"Launched on another account — pin unavailable","spawnCard.pinUnavailableQueued":"Pinned account quota is exhausted — queued until {retryAt}","spawnCard.launch":"Launch {id}","spawnChip.starting":"Starting","spawnChip.binding":"Binding host","spawnChip.queued":"Host ready","spawnChip.reconciling":"Reconciling","spawnChip.recoverable-timeout":"Settling","spawnChip.live-late-success":"Late delivery OK","spawnChip.failed":"Launch failed","spawnChip.recovered":"Launched","spawnChip.initial.pending":"First message: waiting","spawnChip.initial.queued":"First message: queued","spawnChip.initial.delivered":"First message: delivered","spawnChip.initial.failed":"First message: failed","outbox.queueAria":"Messages waiting to be delivered","outbox.queued":"Queued","outbox.delivering":"Delivering","outbox.heldForSwitch":"Held for \xab{label}\xbb — delivers after the switch","outbox.heldForSwitchUnnamed":"Held — delivers after the account switch","outbox.delivered":"Delivered","outbox.failed":"Not delivered","outbox.cancel":"Cancel this message","outbox.retry":"Retry sending this message","outbox.reattach":"Not sent — re-attach the images and send again","draft.readPrompt":"Read the agent conversation in file {src} and continue from there: ","draft.needDir":"specify a working directory","draft.launchFailed":"couldn't launch","draft.paneAria":"Draft of a new agent conversation","draft.notStarted":"agent not started yet","draft.engineAria":"Agent engine","draft.accountAria":"{engine} account for this launch","draft.accountDefault":"{label} \xb7 active","draft.accountNeedsLogin":"{label} \xb7 needs sign-in","draft.handoffLabel":"handoff: {title}","draft.newConvo":"new conversation","draft.conversation":"conversation","draft.dismiss":"Dismiss the draft conversation","draft.directory":"directory","draft.dirAria":"Agent working directory","dirPicker.empty":"no directory chosen","dirPicker.searchAria":"Filter the known directories, or type a path","dirPicker.searchPlaceholder":"filter, or type a path","dirPicker.listAria":"Known working directories","dirPicker.current":"current","dirPicker.useTyped":"use this path","dirPicker.noMatch":"nothing matches that filter — type a path to use one anyway","dirPicker.noneKnown":"no directories known yet — type a path","dirPicker.count":"{shown} of {total} directories","draft.reasoning":"reasoning","draft.role":"role","draft.roleAria":"Agent role preset","draft.noRole":"No role","draft.roleParameters":"Role parameters","draft.safetyFences":"Safety fences","draft.roleNeedsParams":"complete the required role parameters","draft.reviews":"reviewed conversation","draft.reviewsAria":"Reviewed conversation","draft.reviewsPlaceholder":"Choose a conversation","draft.reviewerNeedsConversation":"choose the conversation this reviewer will review","draft.deployConfirm":"Type deploy to authorize this deployment plan","draft.modelAria":"Agent model","draft.modelDefault":"model: default","draft.reasoningAria":"Reasoning effort level","draft.effortDefault":"effort: default","draft.speedAria":"Codex speed mode","draft.speedTitle":"fast = priority tier (1.5x speed, higher usage)","draft.speedDefault":"speed: default","draft.imagesOnly":"(images)","draft.launched":"agent launched in tmux {target} — waiting for the conversation to appear here…","draft.launchedStructured":"agent launched — waiting for the conversation to appear here…","draft.slow":"Taking a while. Check tmux window {target} — the panel will pick up the transcript as soon as it appears.","draft.slowStructured":"Taking a while. The panel will pick up the transcript as soon as it appears.","draft.confirming":"Launched — confirming the agent in tmux {target}. Don't send again; the panel attaches the conversation as soon as its transcript appears.","draft.confirmingStructured":"Launched — confirming the agent. Don't send again; the panel attaches the conversation as soon as its transcript appears.","draft.confirmingNoTarget":"Confirming whether the agent started. Don't send again — the panel attaches the conversation as soon as its transcript appears.","draft.confirmingSlow":"Launching slowly — the launch is confirmed in tmux {target}. The panel keeps watching and attaches the conversation itself; don't launch again.","draft.confirmingSlowStructured":"Launching slowly — the launch is confirmed. The panel keeps watching and attaches the conversation itself; don't launch again.","draft.attention":"The agent may already be running in tmux {target}. Don't launch it again. Dismiss this draft once you've checked; it still attaches automatically if the transcript appears.","draft.attentionStructured":"The agent may already be running. Don't launch it again. Dismiss this draft once you've checked; it still attaches automatically if the transcript appears.","draft.attentionNoTarget":"The agent may already be running — check your tmux windows. Don't launch it again. Dismiss this draft once you've checked; it still attaches automatically if the transcript appears.","draft.hintRelay":"The new agent will first read the parent conversation's transcript and pick up from there. Add to the prompt what to do next — the branch will appear on the scheme alongside.","draft.hintNew":"Choose an engine and a directory, write the first prompt — the agent will start in tmux, and the conversation will continue in this same panel.","draft.hintNewStructured":"Choose an engine and a directory, write the first prompt — the agent will start, and the conversation will continue in this same panel.","draft.promptAria":"First prompt for the new agent","draft.placeholder":"first prompt — the agent will start in tmux…","draft.placeholderStructured":"first prompt — the agent will start…","draft.promptTextAria":"First prompt text","draft.newWindowTitle":"new tmux window with a fresh agent","draft.newWindowTitleStructured":"new structured session with a fresh agent","draft.newAgent":"new agent","draft.addImages":"Add images to the prompt","draft.stopAndLaunch":"Stop recording and launch the agent","draft.rolePromptToggle":"Role prompt (EN)","draft.speedFast":"fast","draft.speedStandard":"standard","effortTier.minimal":"minimal","effortTier.low":"low","effortTier.medium":"medium","effortTier.high":"high","effortTier.xhigh":"extra high","effortTier.max":"max","effortTier.ultra":"ultra","reasoningTier.minimal":"Minimal","reasoningTier.low":"Light","reasoningTier.medium":"Medium","reasoningTier.high":"High","reasoningTier.xhigh":"Extra High","reasoningTier.max":"Max","reasoningTier.ultra":"Ultra","roleCopy.orchestrator.name":"Orchestrator","roleCopy.orchestrator.description":"Coordinates fresh agents through the Viewer control plane.","roleCopy.orchestrator.param.mode.label":"Mode","roleCopy.orchestrator.param.mode.description":"Operating mode for the coordination run.","roleCopy.orchestrator.param.mode.option.standard":"Standard","roleCopy.orchestrator.param.mode.option.plan-tickets":"Plan tickets","roleCopy.orchestrator.param.mode.option.wayfind":"Wayfind","roleCopy.orchestrator.param.mode.option.backlog-campaign":"Backlog campaign","roleCopy.orchestrator.param.repo.label":"Repository","roleCopy.orchestrator.param.repo.description":"Repository for backlog-campaign mode.","roleCopy.orchestrator.param.issueQuery.label":"Issue query","roleCopy.orchestrator.param.issueQuery.description":"GitHub issue query for backlog-campaign mode.","roleCopy.orchestrator.param.urgent.label":"Urgent list","roleCopy.orchestrator.param.urgent.description":"Comma-separated urgent issue ids.","roleCopy.orchestrator.param.maxWorkers.label":"Maximum workers","roleCopy.orchestrator.param.maxWorkers.description":"Worker cap for backlog-campaign mode.","roleCopy.orchestrator.param.mergePolicy.label":"Merge policy","roleCopy.orchestrator.param.mergePolicy.description":"Delivery policy for backlog-campaign mode.","roleCopy.orchestrator.param.mergePolicy.option.pr":"Pull request","roleCopy.orchestrator.param.mergePolicy.option.merge":"Merge","roleCopy.orchestrator.param.completionPolicy.label":"Completion policy","roleCopy.orchestrator.param.completionPolicy.description":"Terminal policy for backlog-campaign mode.","roleCopy.orchestrator.param.completionPolicy.option.pr-opened":"PR opened","roleCopy.orchestrator.param.completionPolicy.option.merged":"Merged","roleCopy.orchestrator.param.completionPolicy.option.released":"Released","roleCopy.reviewer.name":"Reviewer","roleCopy.reviewer.description":"Reviews a code diff and returns severity-ranked evidence-backed findings.","roleCopy.reviewer.param.diffSource.label":"Diff source","roleCopy.reviewer.param.diffSource.description":"Diff or pull request reference to inspect.","roleCopy.reviewer.param.lens.label":"Lens","roleCopy.reviewer.param.lens.description":"Review lens.","roleCopy.reviewer.param.lens.option.correctness":"Correctness","roleCopy.reviewer.param.lens.option.over-engineering":"Over-engineering","roleCopy.reviewer.param.lens.option.silent-failure":"Silent failures","roleCopy.reviewer.param.lens.option.test-coverage":"Test coverage","roleCopy.reviewer.param.lens.option.scope":"Scope","roleCopy.reviewer.param.lens.option.prod-ops":"Prod ops","roleCopy.reviewer.param.lens.option.standards+spec":"Standards + spec","roleCopy.reviewer.param.lens.option.code-smells":"Code smells","roleCopy.reviewer.param.lens.option.all":"All lenses","roleCopy.reviewer.param.mode.label":"Mode","roleCopy.reviewer.param.mode.description":"Reviewer context mode.","roleCopy.reviewer.param.mode.option.fresh":"Fresh context","roleCopy.reviewer.param.parallelN.label":"Parallel passes","roleCopy.reviewer.param.parallelN.description":"Independent review passes.","roleCopy.verifier.name":"Verifier","roleCopy.verifier.description":"Tests supplied hypotheses and returns a per-claim evidence verdict.","roleCopy.verifier.param.claims.label":"Claims","roleCopy.verifier.param.claims.description":"Hypotheses to confirm or refute.","roleCopy.builder.name":"Builder","roleCopy.builder.description":"Writes product code for a scoped directive.","roleCopy.builder.param.mode.label":"Mode","roleCopy.builder.param.mode.description":"Implementation discipline.","roleCopy.builder.param.mode.option.plain":"Plain","roleCopy.builder.param.mode.option.apply-fixes":"Apply fixes","roleCopy.builder.param.mode.option.tdd":"TDD","roleCopy.builder.param.mode.option.diagnose":"Diagnose","roleCopy.builder.param.mode.option.prototype":"Prototype","roleCopy.builder.param.mode.option.merge-resolve":"Merge resolve","roleCopy.builder.param.domain.label":"Domain","roleCopy.builder.param.domain.description":"Product domain for the implementation.","roleCopy.builder.param.domain.option.general":"General","roleCopy.builder.param.domain.option.frontend":"Frontend","roleCopy.architect.name":"Architect","roleCopy.architect.description":"Produces an evidence-grounded design without product edits.","roleCopy.architect.param.mode.label":"Mode","roleCopy.architect.param.mode.description":"Architecture output mode.","roleCopy.architect.param.mode.option.design":"Design","roleCopy.architect.param.mode.option.spec":"Spec","roleCopy.architect.param.mode.option.architecture-audit":"Architecture audit","roleCopy.cleaner.name":"Cleaner","roleCopy.cleaner.description":"Safely recovers a dirty checkout under a backup contract.","roleCopy.prod-auditor.name":"Prod auditor","roleCopy.prod-auditor.description":"Performs a read-only evidence-backed production investigation.","roleCopy.prod-auditor.param.questions.label":"Questions","roleCopy.prod-auditor.param.questions.description":"Production questions to investigate.","roleCopy.deployer.name":"Deployer","roleCopy.deployer.description":"Plans a blue/green production deployment and stops for approval before mutation.","roleCopy.deployer.param.sha.label":"Merged SHA","roleCopy.deployer.param.sha.description":"Merged commit SHA to deploy.","roleCopy.deployer.param.pr.label":"Pull request","roleCopy.deployer.param.pr.description":"Optional pull request reference.","link.handoffContext":"You've been handed another agent's context — the conversation \xab{title}\xbb. Its transcript: {path} — read that file first for full context, then carry out the request below.\n\n{ask}","link.dropped":"context is in the composer of \xab{title}\xbb — type the ask and send","handoff.aria":"Hand the conversation to a new agent — a draft appears below","handoff.title":"click — draft a new agent with this context \xb7 drag — link to an existing one","handoff.label":"hand off to agent","qr.showAria":"Show a QR code for phone login","qr.failed":"couldn't get the link","qr.startHint":"Start the viewer with Tailscale access: ","qr.alt":"QR code for phone login","qr.generating":"generating QR…","qr.linkAria":"Phone login link","qr.copy":"Copy link","qr.scanHint":"scan from a phone on the same tailnet","telegram.title":"Telegram","telegram.rowAria":"Telegram connection","telegram.close":"Close","telegram.readOnlyNote":"Read-only \xb7 operator sessions only","telegram.status.disconnected":"Not connected","telegram.status.starting":"Starting…","telegram.status.awaiting_scan":"Scan the QR code","telegram.status.awaiting_password":"Password needed","telegram.status.verifying":"Verifying…","telegram.status.connected":"Connected","telegram.status.expired":"Session expired","telegram.status.error":"Error","telegram.connect":"Connect Telegram","telegram.connectHint":"Sign in by scanning a QR code from the Telegram app. The Viewer stores the session on this machine only.","telegram.credentialsHint":"Telegram API credentials are not configured yet. Enter your api_id and api_hash from my.telegram.org — they stay on this machine.","telegram.credentialsIdLabel":"API ID","telegram.credentialsHashLabel":"API hash","telegram.credentialsSave":"Save credentials","telegram.credentialsSource":"Saved into the Viewer's own config (telegram.json, owner-only). Environment variables, when set, take precedence.","telegram.credentialsInvalid":"That does not look like a valid api_id + api_hash pair. Nothing was saved.","telegram.reconnect":"Reconnect","telegram.retry":"Retry","telegram.cancel":"Cancel","telegram.qrAlt":"Telegram sign-in QR code","telegram.qrGenerating":"generating QR…","telegram.qrFailed":"The QR code could not be generated.","telegram.qrRetry":"Try QR again","telegram.qrHint":"In Telegram on your phone: Settings → Devices → Link Desktop Device, then scan. An expired code refreshes automatically.","telegram.passwordLabel":"Two-step verification password","telegram.passwordPlaceholder":"Telegram 2FA password","telegram.passwordSubmit":"Submit","telegram.passwordInvalid":"Wrong password. Try again.","telegram.passwordHint":"Telegram asked for your two-step verification password. It goes to Telegram only.","telegram.connectedAs":"Connected as","telegram.lastCheck":"Checked {time}","telegram.expiredHint":"Telegram ended this session. Reconnect to continue.","telegram.logout":"Log out","telegram.logoutConfirm":"Log out of Telegram and remove the local session?","telegram.deleteLocal":"Delete local session","telegram.deleteLocalConfirm":"Delete the local session? The remote Telegram authorization may remain — remove it in Telegram → Devices.","telegram.confirmCta":"Confirm","telegram.confirmCancel":"Cancel","telegram.actionFailed":"That didn't go through. Try again; if it keeps failing, close and reopen this panel.","telegram.actionUnreachable":"The Viewer server didn't respond. Check the connection and try again.","telegram.err.login_busy":"Another Telegram sign-in is already in progress.","telegram.err.credentials_missing":"Telegram API credentials are not configured on this host.","telegram.err.start_failed":"Sign-in could not start.","telegram.err.bridge_failed":"Sign-in ended unexpectedly.","telegram.err.password_invalid":"Wrong password.","telegram.err.network_failed":"Network error. Try again.","telegram.err.timed_out":"Sign-in timed out.","telegram.err.canceled":"Sign-in was canceled.","telegram.err.session_unsafe":"Local session storage failed safety checks.","telegram.err.connector_failed":"The Telegram connector could not start.","telegram.err.host_registration_failed":"Telegram could not be registered with the local agent hosts.","telegram.err.not_read_only":"Refused: the connector advertised tools that are not read-only.","telegram.err.logout_failed":"Remote logout failed. You can delete the local session instead.","telegram.err.health_failed":"Could not check the connection.","telegram.announceScan":"Telegram QR code ready. Scan it from your phone.","telegram.announcePassword":"Telegram asks for your two-step verification password.","telegram.announceConnected":"Telegram connected.","telegram.report.title":"Daily report","telegram.report.loading":"Loading…","telegram.report.disabledHint":"Once a day, an agent reads your private dialogs and the groups you pick, then writes one report you read here.","telegram.report.enable":"Enable daily report","telegram.report.disable":"Turn off","telegram.report.at":"At","telegram.report.zone":"Kyiv time","telegram.report.sourcesSummary":{one:"Sources: active private dialogs + {count} group",other:"Sources: active private dialogs + {count} groups"},"telegram.report.sourcesEdit":"Groups","telegram.report.sourcesDone":"Done","telegram.report.sourcesHint":"Private dialogs are picked automatically by recent activity. Choose which groups to include: light reads only what touches you, full reads the whole group.","telegram.report.loadGroups":"Load my groups","telegram.report.noGroups":"No groups loaded yet.","telegram.report.modeLight":"Light","telegram.report.modeFull":"Full","telegram.report.runNow":"Run now","telegram.report.running":"Running…","telegram.report.nextRun":"Next {time}, {date}","telegram.report.noRuns":"No runs yet.","telegram.report.open":"Open","telegram.report.openRun":"Run","telegram.report.openRunTitle":"Open this run on the board","telegram.report.promptTitle":"Report prompt","telegram.report.promptHint":"Your brief for the report agent: language, the tag line, the sections, which repository issue proposals target, tone. Edit it here — no release needed.","telegram.report.promptPreamble":"The Viewer always adds the window, the selected sources, the output path and the sequential-read rules in front of your text. It verifies the connected account itself, before the run starts.","telegram.report.promptEdit":"Prompt","telegram.report.promptSave":"Save prompt","telegram.report.promptReset":"Reset to default","telegram.report.promptDefault":"Prompt: default template","telegram.report.promptEdited":"Prompt: edited by you","telegram.report.back":"Back","telegram.report.status.running":"running","telegram.report.status.ok":"report","telegram.report.status.quiet":"quiet","telegram.report.status.failed":"failed","telegram.report.status.account-mismatch":"wrong account","telegram.report.err.account_mismatch":"The connected account is not the one this report was set up for. Nothing was read.","telegram.report.err.not_connected":"Telegram is not connected, so the run could not start.","telegram.report.err.reports_disabled":"Daily reports are turned off.","telegram.report.err.run_in_progress":"A report run is already going.","telegram.report.err.account_check_failed":"The connected account could not be verified, so nothing was read.","telegram.report.err.sources_failed":"The chats to read could not be listed. The connector may be restarting.","telegram.report.err.launch_failed":"The report run could not be started.","telegram.report.err.run_ended_without_report":"The run ended before it wrote a report. Run it again.","telegram.report.err.timed_out":"The run took too long and was stopped.","telegram.report.err.invalid_report":"The run wrote something the Viewer could not read as a report.","telegram.report.err.report_missing":"That report is no longer stored.","telegram.report.err.transport":"The Viewer server didn't respond. Try again.","telegram.report.err.generic":"That didn't go through. Try again.","push.enabled":"Push notifications enabled","push.enable":"Enable push notifications","push.disable":"Disable push notifications","push.needsHttps":"Push requires HTTPS","sound.on":"Sound notifications on","sound.off":"Sound notifications off","sound.mute":"Mute sound notifications","sound.unmute":"Enable sound notifications","sound.settings":"Sound levels","sound.cueVolume":"Notification cues","sound.ambientViewer":"Background music in the Viewer","sound.ambient":"Background music during a call","sound.ambientVolume":"Music level","sound.ambientHint":"Plays quietly at this level, and ducks under speech during a call. With both on, the same track keeps playing across the call.","keepAwake.label":"Keep screen awake","keepAwake.enableAria":"Keep the screen awake on this device","keepAwake.disableAria":"Let the screen sleep on this device","keepAwake.off":"The screen sleeps on this device's usual timer.","keepAwake.requesting":"Asking the browser…","keepAwake.active":"Screen stays awake while this tab is visible. Uses more battery.","keepAwake.waiting":"Paused while this tab is hidden. Resumes when you come back.","keepAwake.interrupted":"The system released the lock. Turn this off and on to ask again.","keepAwake.blocked":"The browser refused the request. The screen is not held.","keepAwake.failed":"The request failed. The screen is not held.","keepAwake.insecure":"Needs an HTTPS address. Over plain HTTP the screen cannot be held.","keepAwake.unsupported":"This browser has no screen wake lock.","mic.stopRecognize":"Stop recording and transcribe","mic.cancel":"Cancel recording","mic.recognizing":"Transcribing…","mic.dictate":"Dictate","mic.dictateHint":"dictate (up to 10 min) \xb7 right-click: transcription method","mic.timeLeft":"{time} left before auto-stop","mic.capStopped":"stopped at 10:00","mic.connecting":"Connecting the microphone — a moment…","mic.menuTitle":"Transcription method","mic.menuLoading":"checking what's available…","mic.menuLocked":"Locked by the LLV_TRANSCRIBE_BACKEND environment variable","mic.noKey":"not set up","mic.saveFailed":"couldn't save the choice","mic.keyTitle":"{name} is not set up","mic.copy":"copy","mic.copyPath":"Copy path","mic.copied":"copied","mic.back":"Back","stt.local.name":"Faster Whisper","stt.local.desc":"Free, fully local — audio never leaves this machine.","stt.local.fix":"Run scripts/setup-whisper.sh in the app folder once; it installs the local engine at:","stt.chatgpt.name":"ChatGPT Voice","stt.chatgpt.desc":"Covered by your ChatGPT subscription, via the Codex login.","stt.chatgpt.fix":"Log in to Codex (run `codex login`) — the token will appear at:","stt.elevenlabs.name":"ElevenLabs Scribe","stt.elevenlabs.desc":"Paid ElevenLabs API — the most accurate option.","stt.elevenlabs.fix":"Put your ElevenLabs API key (a single line) into this file:","stt.soniox.name":"Soniox","stt.soniox.desc":"Paid Soniox API — the fastest live transcription.","stt.soniox.fix":"Put your Soniox API key (a single line) into this file:","delFile.confirm":"Delete from disk?","delFile.aria":"Delete the conversation from disk","rename.edit":"Rename","rename.editAria":"Rename “{title}”","rename.inputAria":"Session title","rename.save":"Save name","rename.cancel":"Cancel","rename.reset":"Reset to auto title","rename.resetHint":"Reset to the auto title: {title}","rename.autoHint":"Auto title: {title}","rename.retry":"Retry","rename.saved":"Renamed to {title}","rename.conflict":"Name changed elsewhere — adopted the latest and retried","rename.failed":"Couldn't save the name","img.readFailed":"couldn't read the image","img.readAborted":"image reading aborted","img.unsupported":"unsupported image format: {name}","img.unknownFile":"unknown file","img.tooLarge":"{name}: too large (10 MB limit)","img.structuredTooLarge":"Image exceeds this host's {max} MB limit","img.tooManyStructured":"Up to {max} images can be sent at once","img.structuredAggregateTooLarge":"Images exceed this host's {max} MB request limit","img.image":"image","img.error":"image error","img.previewAlt":"image preview {n}","img.removeAria":"Remove image {n}","img.readingAria":"loading image {n}","img.retry":"Retry","img.retryAria":"Retry image {n}","img.clearAll":"Clear all","img.clearAllAria":"Remove all images","img.blockedReading":"Waiting for the image to finish loading…","img.blockedFailed":"Remove or retry the failed image to send","img.deliveryHint":"attached to the message","question.sec":"{n} s","question.min":"{n} min","question.hour":"{n} h","question.waiting":"waiting for a reply","question.sentToPane":"Sent to the pane: {text}","question.keysHint":"keys into the pane \xb7 or the composer below","question.pane":"Pane {target}","question.alreadyAnswered":"answer already recorded","question.openFailed":"couldn't open the session","question.opened":"opened {target}","question.answered":"Answered: {text}","question.answeredElsewhere":"Answered elsewhere: {text}","question.noPane":"tmux pane unavailable","question.openSession":"open session","question.rejectComment":"Rejection comment…","question.approved":"approved","question.rejected":"rejected","question.approve":"Approve","question.reject":"Reject","question.ownAnswer":"Your own answer…","question.dismiss":"Dismiss the question card","question.deliveryFailed":"Delivery failed","question.failedChoice":"not delivered","question.retryAnswer":"Retry","question.errorNotRunning":"the agent is no longer running, so nothing was delivered","question.errorMoved":"the agent has moved on from this question","question.errorUnconfirmed":"the answer was sent, but the agent never confirmed it","question.errorNotDelivered":"the agent's screen did not respond as expected, so the answer was not delivered","question.errorRejected":"the viewer could not build a valid answer","inbox.deleted":"deleted from disk","inbox.fileGone":"the file is no longer on disk","inbox.confirmDelete":"Delete the file from disk?","inbox.deleteAria":"Delete {name} from disk","inbox.deleteFromDisk":"delete from disk","inbox.attachedAlt":"attached image {name}","lightbox.zoomOut":"Zoom out","lightbox.resetZoom":"Reset zoom","lightbox.zoomIn":"Zoom in","preview.dialogTitle":"{name} — document preview","preview.close":"Close preview","preview.download":"Download file","preview.openExternal":"Open in a new tab","preview.resize":"Resize preview","preview.kindPdf":"PDF document","preview.kindImage":"Image","preview.kindText":"Text file","preview.kindUnknown":"File","preview.loading":"Loading…","preview.missing":"This file no longer exists.","preview.denied":"Access to this file was denied.","preview.unsupported":"This file type cannot be previewed.","preview.oversized":"This file is larger than the preview limit.","preview.changed":"The file changed on disk since the preview opened.","preview.aborted":"Loading was cancelled.","preview.error":"The preview could not be loaded.","preview.reload":"Reload","preview.searchPlaceholder":"Search loaded text","preview.noMatches":"no matches","preview.prevMatch":"Previous match","preview.nextMatch":"Next match","preview.wrapLines":"Wrap lines","preview.loadMore":"Load more","preview.loadedOf":"Loaded {loaded} of {size}","preview.fit":"Fit","preview.fitImage":"Fit to pane","preview.fitWidth":"Fit width","preview.prevPage":"Previous page","preview.nextPage":"Next page","preview.pageOf":"Page {page} of {pages}","feed.agentEnded":"agent finished","feed.copyCode":"Copy code","feed.copyMd":"Copy message (Markdown)","feed.voiceTurn":"Voice","selectedContext.stale":"stale","selectedContext.ariaSelected":"Selected card: {name} (project {project})","feed.voiceContext":"Call transcript","feed.speak":"Read answer aloud (AI-generated voice)","feed.stopSpeaking":"Stop reading aloud","tts.read":"Read answer aloud","tts.readPaid":"Read aloud (paid)","tts.replay":"Replay answer audio","tts.replayFree":"Replay aloud (free)","tts.triggerTitle":"{action} \xb7 right-click: voice & billing","tts.stop":"Stop reading aloud","tts.menuTitle":"Voice & billing","tts.menuLocked":"Locked by the LLV_TTS_BACKEND environment variable","tts.nextPaid":"Next click: paid synthesis of this answer","tts.nextFree":"Next click: free replay from the cache","tts.nextStop":"Next click: stop reading this answer","tts.noKey":"not set up","tts.saveFailed":"Could not switch the voice provider","tts.replayExpired":"Cached audio expired — this replay is a paid synthesis.","tts.backendChanged":"The voice provider changed — this read is billed to {provider}.","tts.characters":"{count} characters","tts.billing":"Billed to your {provider} account per character.","tts.disclosure":"You’ll hear an AI-generated voice, not a human voice.","tts.tooLong":"Too long to read aloud ({count} character limit). Nothing is cut short — read a shorter passage.","tts.seekHint":"Click the text while it plays to jump there.","tts.partOf":"Part {index} of {count}","tts.finished":"Finished reading","tts.missingKey":"Add the {provider} API key at {path}","tts.generating":"Generating audio…","tts.playing":"Playing audio","tts.stopped":"Stopped","tts.configError":"TTS configuration unavailable","tts.requestError":"TTS request failed ({status})","tts.requestFailed":"TTS request failed","tts.playError":"The browser blocked audio playback. Try again.","feed.running":"running {tool}…","feed.tool":"tool","feed.thinking":"thinking…","feed.working":"working…","feed.liveTail":"live tail","feed.liveOmittedItems":"… ({count} earlier live items, {chars} characters)","feed.liveToolArgsOmitted":"arguments omitted","feed.liveToolOutcomeOmitted":"outcome omitted","feed.liveOmittedChars":"… (+{chars} characters)","feed.backToLive":"Back to the live tail","feed.newCount":"{count} new","feed.down":"down","feed.pickLog":"Pick a log on the left — the feed updates itself","feed.showEarlier":"show earlier","feed.showEarlierHidden":"show earlier (hidden {count})","feed.loadEarlier":"load earlier from the file","feed.startOfConvo":"start of the conversation","feed.finishedTurn":"finished the turn — waiting for a reply","feed.returnedResult":"returned with a result","feed.noOutput":"No output yet — the file is empty for now","feed.onlyService":"Only service records are present ({count}).","feed.empty":"Empty (no rows to show)","render.system":"system","render.executing":"executing…","render.error":"error","render.teammate":"teammate","render.left":"{peer}: left{at}","render.codexSessionCreated":"Codex session created","render.taskStarted":"Task started","render.taskComplete":"Task completed","render.compacted":"context compacted","render.compactAuto":"auto","render.compactManual":"manual","render.compactPre":"{n}k tokens before","render.compactSummary":"conversation summary","render.stdinSession":"stdin → session {id}","render.record":"record","render.transcriptRecord":"transcript record","render.recordDetails":"record details","render.protocol":"protocol","render.image":"image","render.imageOutput":"image output","render.toolOutput":"tool output","render.toolOutputType":"tool output: {type}","render.dataKb":"{n} kB of data","render.commands":{one:"{count} command",other:"{count} commands"},"render.actions":{one:"{count} action",other:"{count} actions"},"render.noFindings":"no findings","render.moreFindings":"{count} more findings in raw","render.memoryCitations":"memory citations ({count})","render.noCitations":"no citation entries","render.moreEntries":"{count} more entries in raw","render.truncated":"truncated","render.shutdownRequest":"shutdown request","render.shutdownResponse":"shutdown response","render.planRequest":"plan approval request","render.planVerdict":"plan verdict","render.approved":"approved","render.rejected":"rejected","render.from":"from {from}","render.structured":"structured message","render.showJson":"show JSON","render.toDir":"to","render.fromDir":"from","render.internalTag":"internal","render.agentPeer":"agent","render.delivered":"delivered","render.notDelivered":"not delivered","render.reasoning":"agent reasoning","tools.read":"Read","tools.write":"Write","tools.edit":"Edit","tools.lines":{one:"{count} line",other:"{count} lines"},"tools.files":{one:"{count} file",other:"{count} files"},"tools.items":{one:"{count} item",other:"{count} items"},"tools.family.shell":"shell command","tools.family.read":"read file","tools.family.write":"write file","tools.family.edit":"edit","tools.family.search":"search","tools.family.web":"web","tools.family.spawn":"spawn agent","tools.family.plan":"plan","tools.family.mcp":"MCP tool","tools.family.other":"tool","tools.showAllLines":"show all ({count} lines)","tools.showOutput":"show all output","tools.moreFiles":"…and {count} more files","tools.binaryContent":"binary content \xb7 {size}","tools.rawRecord":"raw record","tools.noRawRecord":"detail no longer loaded","tools.noOutput":"no output captured","tools.noOutputTip":"the full output lives in the rollout session","tools.stdin":"stdin","tools.stdinPoll":"poll","tools.pollRun":{one:"{count} poll",other:"{count} polls"},"tools.wait":"wait","tools.session":"session","tools.waitingSeconds":"waiting {n}s","tools.wakeup":"scheduled wakeup","tools.cron":"scheduled agent","tools.monitor":"monitor","tools.schedule":"schedule","tools.diffTruncated":"truncated to fit","tools.orchestration":{one:"{count} tool call",other:"{count} tool calls"},"tools.nestedCalls":"nested calls","tools.callId":"call {id}","tools.copyId":"copy id","tools.copyDiff":"Copy diff","tools.copyOutput":"Copy output","tools.source":"source","tools.action":"action {index}","tools.cwd":"cwd","tools.copyCwd":"copy cwd","tools.copyCommand":"Copy command","tools.stdout":"stdout","tools.stderr":"stderr","tools.copyStderr":"Copy stderr","tools.showStderr":"show all stderr","tools.noStderr":"no stderr captured","tools.exitOk":"exit 0","tools.exitCode":"exit {code}","tools.durationSec":"{n}s","tools.durationMin":"{m}m {s}s","tools.durationMs":"{n}ms","tools.ranAt":"{start}–{end}","tools.nestedWaits":{one:"{count} follow-up",other:"{count} follow-ups"},"wakeup.card":"scheduled wakeup","wakeup.wakesAt":"wakes at {time}","wakeup.wasSetFor":"was set for {time}","wakeup.firedAt":"fired at {time}","wakeup.fired":"fired","wakeup.failed":"scheduling failed","wakeup.superseded":"superseded","wakeup.noTime":"wakeup scheduled","wakeup.plan":"wake plan","wakeup.planInternal":"internal prompt","wakeup.noPlan":"no wake plan given","wakeup.inRel":"in {rel}","wakeup.agoRel":"{rel} ago","wakeup.relSec":{one:"{count}s",other:"{count}s"},"wakeup.relMin":{one:"{count} min",other:"{count} min"},"wakeup.relHour":{one:"{count} h",other:"{count} h"},"wakeup.relDay":{one:"{count} d",other:"{count} d"},"wakeup.chipTitle":"sleeping until {time} — {reason}","flowDialog.engine":"Engine: {label}","flowDialog.modelPlaceholder":"model (default)","flowDialog.model":"Model: {label}","flowDialog.effortDefault":"effort: default","flowDialog.createFailed":"couldn't create the flow ({status})","flowDialog.title":"Start a flow","flowDialog.subtitle":"implement → review \xb7 this conversation becomes the implementer","flowDialog.preset":"preset","flowDialog.rolesManualOpen":"▾ roles manually","flowDialog.rolesManual":"▸ roles manually (model / effort)","flowDialog.spec":"specification and acceptance criteria","flowDialog.specPlaceholder":"Task statement\nAC1: …\nAC2: …","flowDialog.implementer":"implementer","flowDialog.reviewer":"reviewer","flowDialog.diffBase":"diff base","flowDialog.fromHead":"from current HEAD","flowDialog.fromMergeBase":"from merge-base with main","flowDialog.headless":"headless (no pane)","flowDialog.tmuxPane":"tmux pane","flowDialog.transitions":"transitions","flowDialog.auto":"auto","flowDialog.manual":"manual (gate every step)","flowDialog.roundLimit":"round limit","flowDialog.creating":"creating…","flowDialog.start":"▶ Start","flowStrip.startReview":"Start review","flowStrip.spawnReviewer":"Spawn reviewer","flowStrip.relayNotes":"Relay notes","flowStrip.retryRound":"Retry round","flowStrip.anotherRound":"Another round","flowStrip.flow":"Flow","flowStrip.roundsAria":"Review rounds","flowStrip.roundError":"Round {n}: {error}","flowStrip.roundVerdict":"Round {n}: {verdict}","flowStrip.roundInProgress":"Round {n}: in progress","flowStrip.addRoundsTitle":"Add more rounds to the limit","flowStrip.plus2":"+2 rounds","flowStrip.limitTitle":"Round limit: reviews before the loop parks (∞ — unlimited)","flowStrip.limitAria":"Set the round limit to {count}","flowStrip.limitUnlimitedAria":"Unlimited rounds","flowStrip.stopReviewer":"Stop","flowStrip.stopReviewerTitle":"Stop the running reviewer; the round lands in “needs decision”","flowStrip.notePlaceholder":"note for the reviewer…","flowStrip.noteTitle":"Sent to the next reviewer as the round's ready note","flowStrip.autoTitle":"Auto: transitions run themselves. Click — manual.","flowStrip.manualTitle":"Manual: every transition waits for a click. Click — auto.","flowStrip.manualShort":"manual","flowStrip.resume":"Resume flow","flowStrip.pause":"Pause","flowStrip.close":"Close flow","flowHub.aria":"Flow controls — round {n}, {state}","flowHub.ariaNoRound":"Flow controls — {state}","flowHub.controls":"Flow controls","groupOverride.closePanel":"Close controls","groupOverride.flowTitle":"Override \xb7 {name}","groupOverride.pipelineTitle":"Override \xb7 {name}","groupOverride.draftTitle":"Edit draft \xb7 {name}","groupOverride.task":"Task","groupOverride.spec":"Specification","groupOverride.repoDir":"Repository","groupOverride.saveDraft":"Save draft details","groupOverride.savedDraft":"Draft details saved","groupOverride.reviewerRole":"Next reviewer","groupOverride.engine":"Engine","groupOverride.effort":"Effort","groupOverride.effortDefault":"default","groupOverride.model":"Model","groupOverride.modelPlaceholder":"engine default","groupOverride.applyRole":"Update reviewer","groupOverride.nextRoundNote":"Next-round note","groupOverride.notePlaceholder":"What the next reviewer should focus on…","groupOverride.noteUnavailable":"Editable when you start, spawn, or retry a round.","groupOverride.roundLimit":"Round limit","groupOverride.setLimit":"Set","groupOverride.extend":"+1 round","groupOverride.nextStage":"Next stage","groupOverride.draftStage":"Draft stage","groupOverride.addStage":"Add stage","groupOverride.removeStage":"Remove stage","groupOverride.moveStageUp":"Move up","groupOverride.moveStageDown":"Move down","groupOverride.role":"Role","groupOverride.noRole":"No role","groupOverride.stagePrompt":"Stage prompt","groupOverride.applyStage":"Update stage","groupOverride.noEditableStage":"No upcoming stage to edit — every stage has already started.","groupOverride.editStagesOnCanvas":"Edit stages on their cards — role, model, prompt, order, and connections live on each stage's card in the canvas.","groupOverride.savedReviewer":"Reviewer updated for the next round","groupOverride.savedLimit":"Round limit updated","groupOverride.savedExtend":"Added a round","groupOverride.savedRetry":"Retrying the round","groupOverride.savedCancel":"Reviewer stopped","groupOverride.savedStage":"Stage updated for its next run","groupOverride.stagesHeading":"Stages \xb7 execution order","groupOverride.stagesHint":"Drag cards to reorder. The order is the execution chain.","groupOverride.stagesEmpty":"No stages yet — add a stage below to start building.","groupOverride.startNeedsStages":"Add at least 1 stage before starting.","groupOverride.addRunStage":"Add stage","groupOverride.addReviewStage":"Add review loop","groupOverride.dragHandle":"Drag to reorder this stage","groupOverride.runKind":"run","groupOverride.reviewKind":"review loop","groupOverride.reordered":"Stages reordered","groupOverride.stageAdded":"Stage added","groupOverride.stageRemoved":"Stage removed","pipelineBuilder.untitledTask":"New pipeline","pipelineBuilder.createDraft":"Pipeline","pipelineBuilder.createDraftAria":"Add a draft pipeline to the canvas","roundDeck.roundAborted":"Round {n} \xb7 aborted","roundDeck.roundVerdict":"Round {n} \xb7 {verdict}","roundDeck.roundInProgress":"Round {n} \xb7 in progress","roundDeck.aborted":"aborted","roundDeck.reviewInProgress":"review in progress","roundDeck.waitingFirst":"waiting for the first review round…","roundDeck.spawningReviewer":"launching the reviewer — the transcript will appear shortly…","roundDeck.moreRounds":"{count} more round(s) — click the chips on the flow strip","roundDeck.findings":{one:"{count} finding",other:"{count} findings"},"roundDeck.roundsCount":{one:"{count} round",other:"{count} rounds"},"roundDeck.collapseStack":"Collapse review stack ({count} rounds)","roundDeck.expandStack":"Expand review stack ({count} rounds)","roundDeck.groupAria":{one:"Review conversation group \xb7 {count} round",other:"Review conversation group \xb7 {count} rounds"},"roundDeck.groupAriaNamed":{one:"Review group for {name} \xb7 {count} round",other:"Review group for {name} \xb7 {count} rounds"},"subagentTray.label":{one:"{count} subagent",other:"{count} subagents"},"subagentTray.toggle":{one:"Expand the subagent tray ({count} folded subagent)",other:"Expand the subagent tray ({count} folded subagents)"},"subagentTray.collapse":{one:"Collapse the subagent tray ({count} folded subagent)",other:"Collapse the subagent tray ({count} folded subagents)"},"subagentTray.rows":"Folded subagents","subagentTray.open":"Open the {name} subagent transcript","subagentTray.fold":"Fold {name} into the subagent tray","subagentTray.unfold":"Restore {name} to a full card","subagentTray.state.running":"working","subagentTray.state.live":"live","subagentTray.state.silent":"alive but silent","subagentTray.state.closed":"idle","subagentTray.state.dead":"unavailable","flowState.waiting_ready":"waiting for READY","flowState.spawn_pending":"ready to spawn the reviewer","flowState.spawning":"spawning the reviewer","flowState.reviewing":"reviewing","flowState.relay_pending":"verdict ready — relay?","flowState.relaying":"relaying notes","flowState.fixing":"fixing","flowState.approved":"approved","flowState.done_comment":"done with comments","flowState.needs_decision":"needs a decision","flowState.paused":"paused","flowState.closed":"closed","flowState.blocked_rate_limited":"blocked: rate-limited","flowState.rate_limit_until":"resets at {time}","flowState.rate_limit_wait":"waiting for the quota reset","flowModel.failed":"failed ({status})","wfState.provisioning":"provisioning the worktree","wfState.implementing":"stages running","wfState.reviewing":"reviewing","wfState.finishing":"finishing","wfState.approved":"approved","wfState.needs_decision":"needs a decision","wfState.paused":"paused","wfState.closed":"closed","wfModel.failed":"failed ({status})","wfStrip.workflow":"Workflow","wfStrip.stagesAria":"Workflow stages","wfStrip.reviewStage":"review","wfStrip.advance":"Advance","wfStrip.retryStage":"Retry stage","wfStrip.skipStage":"Skip","wfStrip.resume":"Resume workflow","wfStrip.pause":"Pause","wfStrip.close":"Close workflow","pipelineState.draft":"draft","pipelineState.provisioning":"provisioning the worktree","pipelineState.running":"stages running","pipelineState.needs_decision":"needs a decision","pipelineState.paused":"paused","pipelineState.completed":"completed","pipelineState.closed":"closed","pipelineModel.failed":"failed ({status})","pipelineStrip.pipeline":"Pipeline","pipelineStrip.start":"Start pipeline","pipelineStrip.discard":"Discard draft","pipelineStrip.stagesAria":"Pipeline stages","pipelineStrip.reviewStage":"review loop","pipelineStrip.retryStage":"Retry stage","pipelineStrip.skipStage":"Skip","pipelineStrip.resume":"Resume pipeline","pipelineStrip.pause":"Pause pipeline","pipelineStrip.close":"Close pipeline","pipelineStrip.readOnly":"read-only","pipelineStrip.readWrite":"read-write","pipelineStrip.groupAria":"Pipeline {task}","pipelineStrip.baseSha":"Base {sha}","pipelineStrip.baseShaFull":"Full base commit {sha}","pipelineStrip.copyBaseSha":"Copy full base commit {sha}","pipelineStrip.copiedBaseSha":"Full base commit copied","pipelineStrip.copyBaseShaFailed":"Could not copy the base commit","pipelineStrip.moreActions":"More pipeline actions","pipelineStrip.announce":"Pipeline {task}: {state}, stage {stage} {k} of {n}","pipelineStrip.openStage":"Open stage {label}","pipelineStrip.openVerdict":"Open verdict for stage {label}, state {state}","pipelineStrip.openTranscript":"Open transcript for stage {label}, state {state}","pipelineStrip.configureStage":"Configure stage {label}, state {state}","pipelineStrip.configAria":"Configuration for stage {label}","pipelineStrip.closeConfig":"Close stage configuration","pipelineStrip.lineageAria":"Stage lineage from {from} to {to}","pipelineStrip.previousStage":"Open previous stage {label}, state {state}","pipelineStrip.nextStage":"Open next stage {label}, state {state}","pipelineStrip.evidenceAria":"Stage {label} evidence: {verdict}, duration {duration}, model {model}","pipelineStrip.defaultModel":"default model","pipelineStrip.unknownDuration":"duration unavailable","pipelineStrip.linkedTasks":"Linked tasks","pipelineStrip.openTask":"Open linked task {label}","pipelineStrip.roundShort":"R{n}","pipelineStrip.attemptSuffix":"\xd7{n}","stageGraph.roundProgress":"round {round}/{total}","stageGraph.startedNotice":"This stage started while settings were open. Its saved server configuration is now locked.","pipelineStrip.chipAria":"Stage {label}: {state}","pipelineStrip.compactChipAria":"{label}, {state}","pipelineStrip.stageOf":"stage {k}/{n}","pipelineStrip.passEdgeAria":"Pass edge from {from} to {to}","pipelineStrip.failEdgeAria":"Fail edge from {from} to {to}, round {k} of {n}","pipelineStrip.nextEdge":"next","pipelineStrip.nextEdgeAria":"This edge runs next","pipelinePresentation.queued":"Queued","pipelinePresentation.waiting":"Waiting","pipelineShelf.aria":"Pipeline shelf","pipelineShelf.title":"Pipelines","pipelineShelf.edit":"Edit pipeline {task}","pipelineGroup.toggle":"Expand or collapse pipeline {task}","pipelineGroup.openHistory":"Open pipeline history for {task}","pipelineSlot.paneAria":"Planned stage {title}","pipelineSlot.completedAria":"Completed stage {title} — open to review","pipelineSlot.openTranscript":"Open conversation","pipelineSlot.stageOf":"stage {k}/{n}","pipelineSlot.promptLabel":"Stage prompt","pipelineSlot.noPrompt":"Extra context for this agent — the wiring above is automatic.","pipelineSlot.wiringTask":"Automatically receives: the task text","pipelineSlot.wiringPrev":"Automatically receives: the previous stage's output + the task text","pipelineSlot.waiting":"The {role} chat window opens here when this stage starts.","pipelineSlot.starting":"Starting the {role} agent…","pipelineSlot.reviewHint":"Review cycle over the previous stage — its rounds land here.","pipelineSlot.frozen":"This stage already ran — its configuration is locked.","pipelineSlot.saved":"Saved","pipelineSlot.rowAria":"Finished stage {title}","pipelineSlot.reasonSkipped":"Skipped by the operator — the chain moved on","pipelineSlot.rowExpand":"Show the full stage card","pipelineSlot.rowCollapse":"Collapse back to the status row","pipelineTemplates.planBuildReview":"Plan → Build → Review","pipelineTemplates.buildReview":"Build → Review","pipelineTemplates.buildVerify":"Build → Verify","pipelineSlot.addAgent":"Next agent","pipelineSlot.addAgentTitle":"Add the next agent handoff after this stage","pipelineSlot.addReview":"Review cycle","pipelineSlot.addReviewTitle":"Attach a review cycle (hard link) after this stage","pipelineSlot.moveEarlier":"Move {role} earlier in the chain","pipelineSlot.moveLater":"Move {role} later in the chain","pipelineSlot.savePrompt":"Save prompt","pipelineSlot.promptAria":"Stage prompt editor","pipelineSlot.connectHeading":"Connections","pipelineSlot.passEdgeLabel":"On pass, continue to","pipelineSlot.passEdgeEnd":"— completes the pipeline","pipelineSlot.failEdgeLabel":"On fail, loop back to","pipelineSlot.failEdgeNone":"— park for the operator","pipelineSlot.failEdgeSelf":"↺ this stage (retry itself)","pipelineSlot.failEdgeRounds":"Max loop rounds","pipelineSlot.passEdgeFrozen":"This stage already ran — its pass edge is frozen evidence.","pipelineSlot.failEdgeFrozen":"This fail edge was already traversed — it is frozen evidence.","pipelineTemplates.title":"New pipeline","pipelineTemplates.subtitle":"Pick a template. Its pipeline group lands on the board beside the linked task. Stage configuration remains available on demand.","pipelineTemplates.blank":"Blank canvas","pipelineTemplates.blankHint":"Start empty and assemble the stages by hand.","pipelineTemplates.noRole":"no role","pipelineTemplates.repoDir":"Repository directory","pipelineTemplates.checking":"Checking repository…","pipelineTemplates.ready":"Repository ready","pipelineTemplates.creating":"Creating pipeline…","pipelineTemplates.retry":"Retry","pipelinePreflight.empty":"Enter a repository directory","pipelinePreflight.missing":"The directory does not exist: {path}","pipelinePreflight.not_directory":"Choose a directory: {path}","pipelinePreflight.repo_unreadable":"The repository cannot be read: {path}","pipelinePreflight.repo_untraversable":"The repository cannot be opened: {path}","pipelinePreflight.not_git":"Choose a Git repository: {path}","pipelinePreflight.probe_failed":"The repository check could not finish — retry: {path}","pipelinePreflight.git_metadata_unwritable":"Git metadata is read-only: {path}","pipelinePreflight.worktree_parent_unwritable":"Pipeline worktrees cannot be created beside this repository: {path}","pipelineChipState.pending":"pending","pipelineChipState.spawning":"spawning","pipelineChipState.running":"running","pipelineChipState.reviewing":"reviewing","pipelineChipState.committing":"committing","pipelineChipState.passed":"passed","pipelineChipState.failed":"failed","pipelineChipState.needs_decision":"needs a decision","pipelineChipState.skipped":"skipped","pipelineVerdict.pass":"pass","pipelineVerdict.fail":"fail","pipelineVerdict.needsDecision":"needs decision","pipelineVerdict.confidence":"confidence","pipelineVerdict.reviewerSha":"Reviewer SHA {sha}","pipelineVerdict.findings":{one:"{count} finding",other:"{count} findings"},"pipelineVerdict.noFindings":"no findings recorded","pipelineVerdict.more":"+{count} more","pipelineVerdict.openTranscript":"Open transcript","pipelineVerdict.openAttemptTranscript":"Open transcript for attempt {n}","pipelineVerdict.reviewTranscripts":"Review transcripts","pipelineVerdict.openReviewTranscript":"Open review transcript {n}","pipelineVerdict.openFlow":"Open review","pipelineVerdict.retry":"Retry","pipelineVerdict.skip":"Skip","pipelineVerdict.priorAttempts":"Earlier attempts","pipelineVerdict.attemptLine":"Attempt {n}: {status}","pipelineVerdict.title":"Stage {label} verdict","pipelineHub.aria":"Pipeline {task}: {stage} \xb7 {k}/{n}","pipelineHub.controls":"Pipeline controls","pipelineHub.stageOf":"{stage} \xb7 {k}/{n}","pipelineHub.openControls":"Open pipeline controls","pipelineHub.attempt":"attempt {n}","pipelineHub.openDashboard":"Open dashboard strip","dash.pipeline":"Pipeline","dash.newPipeline":"New pipeline","board.historyGroup":"Undo and redo board actions","board.undo":"Undo","board.redo":"Redo","board.undoReopen":"Undo — reopen “{title}”","board.redoReclose":"Redo — close “{title}” again","board.undoNothing":"Nothing to undo","board.redoNothing":"Nothing to redo","scheme.pipeline":"Pipeline","scheme.pipelineTitle":"Start a pipeline from this conversation","board.pipeline":"Pipeline","board.newPipeline":"New pipeline","pipelineMobile.chipAria":"Pipeline {task}","pipelineMobile.position":"{k}/{n}","pipelineMobile.prevStage":"Previous stage {label}, state {state}","pipelineMobile.nextStage":"Next stage {label}, state {state}","pipelineMobile.openVerdict":"Open verdict for {label}, state {state}","pipelineMobile.expandDock":"Expand pipeline {task}","pipelineMobile.collapseDock":"Collapse pipeline {task}","pipelineMobile.summaryOpen":"Open pipelines ({n})","pipelineMobile.summaryCount":{one:"{n} pipeline",other:"{n} pipelines"},"pipelineMobile.summaryActive":"{n} active","pipelineMobile.summaryAttention":"{n} need you","pipelineMobile.summaryCompleted":"{n} done","pipelineMobile.sheetTitle":"Pipelines","pipelineMobile.closeSheet":"Close pipelines","pipelineMobile.completedGroup":{one:"{n} completed",other:"{n} completed"},"wfDraft.paneAria":"Draft of a new workflow","wfDraft.notStarted":"the workflow is not launched yet","wfDraft.newWorkflow":"new workflow","wfDraft.dismiss":"Dismiss the workflow draft","wfDraft.template":"template","wfDraft.templateAria":"Workflow template","wfDraft.repo":"repository","wfDraft.repoAria":"Repository directory","wfDraft.manualMode":"manual: a gate at every stage boundary","wfDraft.hint":"Pick a template and a repository, describe the task — the workflow creates a worktree, runs the stages and the review, then opens a PR.","wfDraft.taskPlaceholder":"the task for the workflow — the brief goes to every stage…","wfDraft.taskAria":"Workflow task brief","wfDraft.footerHint":"worktree \xb7 stages \xb7 review \xb7 PR","wfDraft.finishMerge":"local merge","wfDraft.needDir":"set the repository directory","wfDraft.needTask":"describe the task","wfDraft.launchFailed":"launch failed","wfDraft.launch":"▶ Launch workflow","wfDraft.launching":"launching…","scheme.flowTitle":"Run the implement → review cycle for this conversation","scheme.flow":"Flow","scheme.collapsedTitle":"Collapsed branches and tasks of this conversation","scheme.ancestorElided":{one:"Parent not drawn on this board: {title}",other:"{count} ancestors not drawn on this board, nearest: {title}"},"scheme.ancestorOffBoard":"Parent conversation is not on this board","scheme.underneath":"underneath","scheme.handTool":"Hand — drag the canvas (H, or hold Space)","scheme.selectTool":"Select — click and work with conversations (V)","scheme.zoomOut":"Zoom out (−)","scheme.zoom100":"Zoom 100% (1)","scheme.zoomIn":"Zoom in (+)","scheme.fitCurrent":"Fit current work (0)","scheme.fit":"Fit all content (Shift+0, or double-click the background)","scheme.framedCurrent":"Framed current work — {count} items","scheme.framedAll":"Framed all content — {count} items","scheme.offscreenNav":"Off-screen work","scheme.offscreenMore":"Show {count} more off-screen clusters","mobile.mapFrame":"Map framing","mobile.mapAll":"All","mobile.mapCurrent":"Current","scheme.roleImplementer":"Implementer","scheme.roleReviewer":"Reviewer","scheme.roleWorking":"working","scheme.roleWaiting":"waiting","scheme.lassoTool":"Multi-select — draw a box around agents, click cards to toggle","scheme.selectCheckOn":"Add this agent to the selection","scheme.selectCheckOff":"Remove this agent from the selection","scheme.boardAria":"Agent board — arrow keys move between agent windows","scheme.navStack":{one:"{count} quiet branch under {title}",other:"{count} quiet branches under {title}"},"scheme.navStackBare":{one:"{count} quiet branch",other:"{count} quiet branches"},"bulk.selectedCount":{one:"{count} selected",other:"{count} selected"},"bulk.placeholder":"one message to every selected agent…","bulk.textAria":"Broadcast text for the selected agents","bulk.sendAll":"Send to {count} agents","bulk.interrupt":"Interrupt","bulk.stop":"Stop","bulk.stopConfirm":"Stop {count} agents?","bulk.remove":"Clear from board","bulk.removeConfirm":"Close {count} cards?","bulk.flow":"Flow","bulk.fit":"Show selection","bulk.exit":"Exit selection (Esc)","bulk.retryFailed":"Retry failed ({count})","bulk.nodeGone":"node left the board","bulk.flowTitle":"Start a review flow on {count} agents","bulk.flowStart":"Start {count} flows","minimap.title":"Minimap — click or drag to navigate","minimap.stacks":{one:"{count} collapsed stack",other:"{count} collapsed stacks"},"plan.agentPlan":"Agent plan:","plan.stepsAria":"Plan: {done} of {total} steps","plan.nowSuffix":", now: {current}","plan.goal":"goal","plan.goalDone":"goal ✓","plan.goalBlocked":"goal ✖","plan.noObjective":"(objective not recorded in the transcript tail)","plan.tokens":"tokens: {n}","plan.time":"time: {n} min","plan.ctxTitle":"Context window: {pct}% used\n{used} of {window} tokens","plan.ctxSourceRuntime":"Window reported by the agent runtime","plan.ctxSourceRegistry":"Window from the bundled model registry ({version}) — approximate","plan.ctxTitleUnknown":"Context usage: {used} tokens\nWindow unknown for this model — percentage withheld","plan.ctxAria":"Context: {pct} percent of the window used","plan.ctxAriaUnknown":"Context: {used} tokens used, window size unknown","plan.goalAria":"Session goal: {status}","limits.now":"now","limits.inMin":"in {n}m","limits.inHour":"in {n}h","limits.inDay":"in {n}d","limits.asOf":"as of {time}","limits.left":"left","limits.reset":"reset {eta} \xb7 {at}","limits.stale":"data is stale: {stale}","limits.5h":"5h","limits.week":"Week","limits.windowMinutes":"{n}m","limits.windowHours":"{n}h","limits.windowDays":"{n}d","limits.accountsOpenAria":"Codex accounts — switch or add","limits.noDataYet":"no data yet","limits.rateLimited":"Provider is rate-limiting requests.","limits.rateLimitedRetry":"Provider is rate-limiting requests. Retry at {time}.","limits.reauthRequired":"Re-login to Claude is required.","burndown.title":"burndown","burndown.openAria":"Open {engine} burndown chart","burndown.close":"Close chart","burndown.windowAria":"Chart window","burndown.ideal":"even pace","burndown.actual":"remaining","burndown.loading":"Loading history…","burndown.failed":"Couldn't load history.","burndown.empty":"No history yet — the chart fills in as quota is sampled.","burndown.windowUnreported":"This plan reports no {window} window, so there is nothing to chart here.","burndown.buildsFrom":"history builds from {date}","burndown.fast":"{pct}% ahead of pace — burning fast","burndown.slow":"{pct}% under pace — room to spare","burndown.even":"on even pace","burndown.emptyBy":"at this rate, 0% by {at}","resources.ram":"RAM","resources.swap":"Swap","resources.free":"{amount} free","resources.used":"{amount} used","resources.stale":"resource data is stale: {stale}","resources.captured":"captured {age}","resources.openAria":"Agent sessions and memory","resources.title":"Agent sessions","resources.total":"Σ {amount}","resources.empty":"no agent sessions in tmux","resources.orphan":"orphan pane","resources.hostConflict":"duplicate conversation pane","resources.hostConflictHint":"multiple live panes claim this conversation","resources.procs":{one:"{count} process",other:"{count} processes"},"resources.swapShare":"+ {amount} swap","resources.kill":"Kill","resources.confirm":"Sure?","resources.killLiveHint":"the agent is working right now — click to unlock, then confirm","resources.killHint":"kill the tmux pane with its whole process tree","resources.bulkLabel":"idle longer than","resources.bulkKill":"Kill idle","resources.bulkNone":"nothing has been idle that long","resources.hoursN":"{n} h","resources.killAll":"Kill all agents","resources.killAllConfirm":"Confirm — kill {n}?","resources.killAllHint":"force-kill every agent pane, live ones included — a clean slate so the next spawn/message routes cleanly. Your shells and the viewer are left alone.","resources.killAllNone":"no agent sessions to kill","resources.close":"Close","attach.attach":"Attach","attach.readonly":"Read-only","attach.copy":"Copy attach command","attach.copyReadonly":"Copy read-only attach command","attach.hint":"copy the tmux attach command for this pane — paste it into any shell","attach.readonlyHint":"copy a read-only (view-only) attach command — you watch without touching the keys","attach.loading":"resolving…","attach.copied":"attach command copied","attach.copiedReadonly":"read-only command copied","attach.stale":"This pane changed or closed. Refresh and try again.","attach.restarted":"The tmux server restarted. Refresh and try again.","attach.unavailable":"The tmux endpoint is unavailable. Refresh and try again.","attach.badRequest":"Can’t resolve this pane — refresh the list.","attach.network":"Network error — try again.","attach.clipboard":"Couldn’t copy — check clipboard permissions.","attach.refresh":"Refresh","status.awaitingPlan":"awaiting plan approval","status.awaitingAnswer":"awaiting an answer to a question","status.awaitingTerminal":"awaiting a reply in the terminal","status.working":"working…","status.returnedResult":"returned with a result","status.stalled":"interrupted or awaiting permission","status.finishedTurn":"finished the turn — waiting for a reply","status.rateLimited":"rate-limited","status.providerThrottled":"provider is throttling — resumes at {time}","status.flow":"flow: {label}","rateLimit.badge":"rate-limited","rateLimit.badgeUntil":"rate-limited until {time}","rateLimit.reseat":"continue on a healthy account","rateLimit.reseatRequested":"reseating…","rateLimit.reseatTitle":"Spawn a successor of this conversation on the healthiest signed-in account; the rate-limited one is parked, attached flows follow.","rateLimit.reseatFailed":"reseat failed","rateLimit.reseatAlready":"already reseated","rateLimit.reseatWaitingTurn":"Reseat queued: waiting for the rate-limited turn to release the pane, then the successor spawns.","dictation.capWarn":"less than a minute of recording left","dictation.capStopped":"Recording stopped at the 10-minute limit; the text will appear in the field.","dictation.failed":"couldn't transcribe","dictation.silence":"silence — nothing recognized","dictation.unsupported":"recording is not supported in this browser","dictation.liveError":"live transcription error","dictation.connectionLost":"transcription connection dropped","dictation.noMic":"no microphone access","overview.branchesLiveIn":{one:"{count} branch running in {projects}",other:"{count} branches running in {projects}"},"overview.projects":{one:"{count} project",other:"{count} projects"},"overview.archived":"\xb7 {count} archived","overview.moreLive":"{count} more live","overview.quiet":"quiet \xb7 last activity {age}","overview.empty":"No logs yet","catalog.unreachable":"catalog unavailable","catalog.errorTitle":"Couldn't load the session catalog","catalog.errorBody":"The viewer server did not answer, so what is running is unknown.","catalog.retry":"Retry","catalog.attempts":{one:"{count} failed attempt",other:"{count} failed attempts"},"launch.account":"Account","launch.reasoning":"Reasoning","orchPanel.title":"Orchestrator","orchPanel.toggleAria":"Orchestrator panel","orchPanel.regionAria":"Orchestrator for {project}","orchPanel.close":"Close the orchestrator panel","orchPanel.resize":"Resize the orchestrator panel","orchPanel.loading":"Reading this project's orchestrator…","orchPanel.unavailable":"The orchestrator seat can't be read","orchPanel.unavailableHint":"Nothing was changed. Until this answers, creating one here could designate a second orchestrator.","orchPanel.recheck":"Check again","orchPanel.draftTitle":"Create this project's orchestrator","orchPanel.draftHint":"It runs in {project}, owns this board, and answers you here. The text below is delivered to it as its first message — edit it however you like.","orchPanel.draftHintVacated":"The previous orchestrator's conversation is gone. Create a new one for {project}; the text below is delivered as its first message.","orchPanel.viewerMcpRegistered":"viewer MCP: registered ✓","orchPanel.viewerMcpMissing":"viewer MCP: run scripts/install-mcp.sh or claude mcp add viewer -- bun ./bin/mcp-server.mjs","orchPanel.mandate":"Mandate","orchPanel.mandateSent":"Sent as the first message","orchPanel.restoreDefault":"Restore default","orchPanel.mandateRequired":"The mandate can't be empty.","orchPanel.cwd":"Working directory: {cwd}","orchPanel.confirm":"Create orchestrator","orchPanel.confirmRetry":"Try again","orchPanel.creating":"Creating the orchestrator…","orchPanel.creatingHint":"The designation is recorded. The mandate is delivered exactly once, even if this page reloads.","orchPanel.receipt":"Launch {launchId}","orchPanel.creatingStuck":"This designation has been pending since before this page loaded — the request that started it never finished.","orchPanel.creatingResume":"Finish this designation","orchPanel.errorTitle":"The orchestrator wasn't designated","orchPanel.errorHint":"Nothing is running. Fix the mandate or the parameters and try again.","orchPanel.errorUnknownTitle":"The last attempt's outcome is unknown","orchPanel.errorUnknownHint":"The reply was lost, so an orchestrator may already exist. Trying again replays the same request instead of creating a second one.","orchPanel.transportLost":"The reply never arrived — the connection dropped.","orchPanel.transitionPending":"A new designation is settling…","orchPanel.transitionFailed":"The last designation failed","orchPanel.stalled":"This orchestrator has gone quiet. Send it a message to pick the work back up.","orchPanel.resumable":"This orchestrator has finished its run. Send it a message to resume this same conversation.","orchPanel.resolving":"Opening the conversation…","orchPanel.resolvingHint":"The orchestrator is designated; its transcript hasn't reached this view yet.","orchPanel.openOnBoard":"Open it on the board","orchPanel.rotation":"Rotation recommended","orchPanel.rotationStrong":"Rotation strongly recommended","orchPanel.rotationContext":"context is at {percent}% of the model's window","orchPanel.rotationDead":"its host is gone","orchPanel.badgeLive":"live","orchPanel.badgeStalled":"quiet","orchPanel.badgeResumable":"finished","orchPanel.badgeDead":"host gone","orchPanel.badgeResolving":"opening","orchPanel.badgeCreating":"creating","orchPanel.badgeFailed":"failed","orchPanel.badgeNone":"none yet","orchPanel.badgeReading":"reading","orchPanel.incumbentAria":"The orchestrator holding this project's seat","orchPanel.incumbentUnknown":"model not resolved yet","orchPanel.accountTitle":"Running on the {account} account","orchPanel.ctxTitle":"Context: {used} of {window} tokens ({percent}%)","orchPanel.ctxUnknownWindow":"{used} tokens in context; this model has no configured window, so no percentage is claimed","orchPanel.ctxAria":"Context window {percent}% full","orchPanel.ctxAriaUnknown":"Context usage, window unknown","orchPanel.predecessor":"Replaced an earlier orchestrator","orchPanel.predecessorTitle":"Open the predecessor's conversation on the board","orchPanel.rotate":"Rotate","orchPanel.rotateTitle":"Replace this orchestrator with a fresh one. Nothing rotates until you confirm.","orchPanel.rotateHeading":"Replace this project's orchestrator","orchPanel.rotateHint":"The successor starts with the mandate below. Its predecessor's transcript and this project's open tasks are handed over by the server — you don't have to repeat them here. The predecessor's conversation stays on the board, linked to the new one.","orchPanel.rotateConfirm":"Rotate orchestrator","orchPanel.rotateCancel":"Keep this one","orchPanel.rotateErrorTitle":"The rotation didn't happen","orchPanel.rotateErrorHint":"Your current orchestrator is untouched and still holds the seat. Fix the mandate or the parameters and try again.","orchPanel.rotateErrorUnknownTitle":"The last rotation's outcome is unknown","orchPanel.rotateErrorUnknownHint":"The reply was lost, so a successor may already exist. Trying again replays the same request instead of rotating twice.","orchPanel.rotateVacated":"That orchestrator's conversation was closed while this rotation was still in flight. Finish it here — trying again replays the same request instead of rotating twice.","orchPanel.restoreIncumbent":"Restore current mandate","orchPanel.cwdInherited":"The successor continues in {cwd}","orchMobile.create":"Create orchestrator","orchMobile.unreadable":"unreadable","orchMobile.rowCreateAria":"Create this project's orchestrator","orchMobile.rowLiveAria":"Orchestrator {model} — {state}. Opens its conversation.","orchMobile.rowStatusAria":"Orchestrator — {state}. Opens the orchestrator sheet.","orchMobile.pendingAria":"A new designation is settling — open it","orchMobile.transitionAria":"The last designation failed — open it","orchMobile.sheetAria":"Orchestrator for {project}","orchMobile.liveTitle":"This project's orchestrator","orchMobile.liveHint":"It answers in its own conversation. Opening it lands there, with the composer.","orchMobile.open":"Open the conversation","branch.live":"working","branch.waiting":"finished the turn — waiting for a reply","branch.returned":"returned with a result","branch.stalled":"interrupted or awaiting permission","branch.done":"done — safe to remove","branch.worktree":"Worktree {name}","branch.lastActivity":"Last activity: {age}","branch.lastActivityQuiet":"Marked active, but the transcript is quiet: last activity {age}","branch.handoffTitle":"agent spawned by this conversation's handoff","branch.branchTitle":"branch of this conversation","branch.accountTip":"Account {id} \xb7 {engine} \xb7 {health}","branch.accountTipPlain":"Account {id} \xb7 {engine}","branch.accountAria":"Open accounts for {id}","lineage.parentRemoved":"parent removed","lineage.parentRemovedTitle":"The parent conversation transcript was removed","branch.removeColumn":"Remove column {title}","branch.toggleBackground":"{action} background task {title}","branch.collapse":"Collapse","branch.expand":"Expand","branch.expandFull":"Expand conversation {title} to the full window","branch.collapseFull":"Back to the canvas (Esc)","branch.detailsShow":"Show conversation details","branch.detailsHide":"Hide conversation details","branch.favorite":"Mark as favorite","branch.unfavorite":"Remove from favorites","tree.quiet":"Quiet conversations and tasks","taskStacks.collapse":"Fold the card back into its status stack","readiness.title":"Task readiness","readiness.aria":"Readiness sections for every project task","readiness.legend":"Now — assigned into work \xb7 Review — a review is running or has a verdict \xb7 Blocked — needs a decision \xb7 Planned — inbox/backlog \xb7 Done — finished","readiness.section.now":"Now","readiness.section.review":"In review","readiness.section.blocked":"Blocked","readiness.section.planned":"Planned","readiness.section.done":"Done","readiness.sectionAria":"“{section}” tasks \xb7 {count}","readiness.open":"Open task on the board: {title}","readiness.place":"Place task on the map: {title}","readiness.issueAria":"Open issue #{issue} on GitHub","readiness.agent":"agent","readiness.agentAria":"Open the assigned agent: {title}","readiness.pipeline":"pipeline","readiness.pipelineAria":"Open the linked pipeline stage: {title}","readiness.review":"review","readiness.reviewAria":"Open the linked review: {title}","readiness.state.live":"live","readiness.state.gone":"gone","readiness.state.failed":"failed","launchHistory.title":"Launch history","launchHistory.aria":"Terminal launch receipts","launchHistory.failed":"failed","launchHistory.recovered":"recovered","launchHistory.retryLabel":"Retry","launchHistory.retry":"Retry launch: {title}","workerStack.title":"Collapsed workers","workerStack.aria":"Collapsed worker conversations","workerStack.expandGroup":"Expand review group on the board","workerStack.flow":"Flow","workerStack.pipeline":"Pipeline","workerStack.origin":"Spawned","workerStack.worktree":"Workers","corner.waitingCount":"\xb7 {count} waiting","corner.openSwitchboard":"Open the agent switchboard","task.working":", working","task.interrupted":", interrupted","task.finished":", finished","task.interruptedBadge":"interrupted","task.finishedBadge":"finished","task.stopFailed":"couldn't stop","task.signalSent":"sent {signal} to PID {pid}","task.killRequested":"kill requested","task.confirmKill":"Really kill PID {pid}?","task.confirmKillNamed":"Stop {name}?","task.confirmKillUntitled":"this agent","task.confirmKillYes":"Yes, kill","task.stopAria":"Stop process PID {pid}","task.kill":"Kill","task.backgroundCommand":"Background command","task.commandNotFound":"The command that started this background task wasn't found in the session transcripts","viewer.closeProjects":"Close the project list","viewer.agentWaiting":"Agent is waiting for a reply","viewer.staleFocusEntry":"That conversation is no longer available","viewer.unknownFragment":"This link names nothing the viewer recognizes","viewer.closeNotification":"Close the notification","attention.badge":{one:"{count} waiting",other:"{count} waiting"},"attention.needsYou":"Needs you","attention.next":"Next","attention.nextHint":"Focus the next one waiting on you (N, Shift-N — back)","attention.openQueue":"Attention queue — who is blocked on you (N — next)","attention.popoverTitle":"Waiting on you","attention.filterOn":"Show only those waiting on you (F)","attention.filterOff":"Show all nodes (F)","mobile.noConvos":"No conversations yet","mobile.map":"Map","mobile.closeMap":"Close the map","mobile.tapNode":"Tap a node — the conversation opens full-screen","mobile.agent":"agent","mobile.openMap":"Open the project map","mobile.mapLoading":"Loading the map…","mobile.marker.open":"Open {title}","mobile.marker.node":"conversation","mobile.marker.deck":"review","mobile.marker.draft":"draft agent","mobile.marker.stack":"history","mobile.marker.worker":"workers","mobile.marker.task":"task","mobile.marker.pipeline":"pipeline","tasks.failed":"failed ({status})","tasks.tool":"Task — the next click drops a card on the canvas (T)","tasks.untitled":"untitled","tasks.newPlaceholder":"task text… (the first line is the title)","tasks.newTask":"new task","tasks.panelCreate":"Create the task","tasks.unplaced":"unplaced","tasks.placeOnMap":"place on map","tasks.addDue":"deadline","tasks.clearDue":"Clear the deadline","tasks.dueTitle":"Deadline (zone: {zone})","tasks.attachCount":{one:"{count} image",other:"{count} images"},"tasks.draftDiscarded":"draft discarded","tasks.editAria":"Task text","tasks.spawning":"starting…","tasks.deadChip":"the conversation is gone from the list","tasks.failedChip":"delivery failed","tasks.killedChip":"the agent process was killed","tasks.unhostedChip":"the agent isn't running","tasks.migratingChip":"the agent is moving to another account","tasks.source":"source","tasks.sourceTitle":"Captured from","tasks.retry":"retry delivery","tasks.retryLaunch":"retry launch","tasks.retryLaunchAria":"Retry the failed launch for {title}","tasks.retryLaunched":"agent relaunched","tasks.chipFailedTitle":"not delivered: {error}","tasks.handoffChip":"routed into this agent's prompt — not sent yet","tasks.detach":"detach","tasks.detachAria":"Detach {title} from this task","tasks.expand":"Expand task","tasks.collapse":"Collapse task","tasks.openAgent":"open and center the agent pane","tasks.openAgentAria":"Open agent {title}","tasks.openAgentUnavailableAria":"Open agent {title} — unavailable: {reason}","tasks.openSource":"open and center the source conversation","tasks.openSourceAria":"Open source conversation {title}","tasks.openSourceUnavailableAria":"Open source conversation {title} — unavailable: {reason}","tasks.sourceGone":"the source conversation is not on the board","tasks.relatedNav":"Related tasks","tasks.openTaskAria":"Open task {title}","tasks.relatedAssignedTitle":"assigned to this conversation","tasks.relatedSourceTitle":"captured from this conversation","tasks.send":"send","tasks.sendTitle":"Pull the arrow onto an agent's pane to drop the task into its prompt (nothing is sent); click to seed a fresh draft conversation","tasks.linkHanded":"routed into “{title}” — review and send it there","tasks.linkSent":"task sent → “{title}”","tasks.spawn":"agent","tasks.spawnTitle":"Spawn a fresh agent with this task as the brief","tasks.spawnGo":"Launch","tasks.statusTitle":"Status: {label} — click cycles (inbox → assigned → blocked → done)","tasks.status.inbox":"inbox","tasks.status.assigned":"assigned","tasks.status.blocked":"blocked","tasks.status.done":"done","tasks.delete":"delete","tasks.deleteConfirm":"sure?","tasks.deleteAria":"Delete task {title}","tasks.pickerTitle":"Send to","tasks.pickerAllChildren":"⤷ all children","tasks.pickerEmpty":"no conversations in the project","tasks.pickerSend":"Send ({count})","tasks.sendOk":"Delivered {delivered} of {total}","tasks.sendFailPart":"✗ “{title}”: {error}","tasks.spawnOk":"agent started in tmux {target}","tasks.composerToggle":"create a task","tasks.composerToggleTitle":"On — the text becomes a tracked task card assigned to the selection; off — a plain broadcast with no trace","tasks.composerNeedsText":"a task needs text","tasks.panelTitle":"Tasks","tasks.panelToggleAria":"Toggle the task panel","tasks.panelThisProject":"this project","tasks.panelAll":"all","tasks.panelEmpty":"no tasks yet — drop one with the board's task tool (T)","tasks.panelClose":"Close the task panel","favorites.sectionTitle":"Favorites","favorites.empty":"no favorites yet — hover a card and tap its crown","favorites.focusTitle":"Focus {title} on the board","tasks.sheetNew":"new task","tasks.sheetCreate":"Create the task","tasks.sheetBack":"Back to the task list","tasks.sheetTargets":{one:"{count} target",other:"{count} targets"},"tasks.sheetAssignments":"assignments","tasks.sheetEmpty":"no tasks yet","tasks.sheetGone":"the task is gone","tasks.textNotSaved":"the text didn't save — delivery aborted, try again","tasks.emptyTextBlocked":"empty text isn't saved — restore the task text before sending","runtime.live":"live","runtime.reconnecting":"reconnecting","runtime.degraded":"degraded","runtime.offline":"offline","runtime.resynced":"resynced","runtime.connection":"runtime connection","runtime.announce.live":"runtime connection live","runtime.announce.reconnecting":"runtime reconnecting","runtime.announce.degraded":"runtime degraded — polling for updates","runtime.announce.offline":"runtime offline","runtime.announce.resynced":"runtime resynced from a fresh snapshot","runtime.staleSince":"stale {duration}","runtime.lastKnown":"last update {duration} ago","runtime.legacyProvenance":"legacy \xb7 derived state","staging.badge":"Staging","staging.badgeTitle":"Staging instance — isolated state; nothing here touches prod","runtime.drift":"drift: {evidence}","runtime.driftDismiss":"Dismiss","runtime.receipt.pending":"sending…","runtime.receipt.busyRetry":"Couldn’t deliver — agent is busy, we’ll retry","runtime.receipt.summary":"Delivery attempts: {count}","runtime.receipt.pendingCount":"pending: {count}","runtime.receipt.attemptCount":"attempts: {count}","runtime.receipt.problemCount":"issues: {count}","runtime.receipt.showDetails":"Show delivery details","runtime.receipt.hideDetails":"Hide delivery details","runtime.receipt.statusSummary":"Delivery status: {pending}, {problems}.","runtime.receipt.statusPending":{one:"{count} pending message",other:"{count} pending messages"},"runtime.receipt.statusProblems":{one:"{count} issue",other:"{count} issues"},"runtime.receipt.delivering":"delivering…","runtime.receipt.applying":"applying switch…","runtime.receipt.turn-started":"turn started","runtime.receipt.steered":"steered into current turn","runtime.receipt.queued":"queued","runtime.receipt.queuedPos":"queued \xb7 #{position}","runtime.receipt.delivered":"delivered","runtime.receipt.applied":"switch applied","runtime.receipt.interrupted":"interrupted","runtime.receipt.answered":"answered","runtime.receipt.rejected":"rejected: {reason}","runtime.receipt.failed":"failed: {reason}","runtime.receipt.uncertain":"uncertain — recovering","runtime.receipt.retry":"Retry","runtime.receipt.edit":"Edit & resend","runtime.receipt.dismiss":"Dismiss","runtime.attention.title":"needs your decision","runtime.attention.approval":"approval","runtime.attention.permission":"permission","runtime.attention.question":"question","runtime.attention.waiting_heuristic":"possibly waiting","runtime.attention.heuristicNote":"low-confidence signal","runtime.attention.unowned":"no approver attached","runtime.attention.command":"command","runtime.attention.tool":"tool","runtime.attention.approve":"Approve","runtime.attention.deny":"Deny","runtime.attention.answer":"Answer","runtime.attention.answering":"answering…","runtime.attention.expiresIn":"auto-resolves in {seconds}s","runtime.attention.keysHint":"Enter approves \xb7 Esc denies","voice.start":"Start continuous voice conversation","voice.stop":"End voice conversation","voice.connecting":"Connecting voice…","voice.live":"Voice conversation is live \xb7 speak whenever you’re ready","voice.stopping":"Ending voice conversation…","voice.failed":"Voice connection needs attention","voice.panel":"Voice conversation","voice.you":"You","voice.agent":"Agent","voice.progress":"Progress","voice.retry":"Try again","voice.ended":"Voice conversation ended","voice.elapsed":"Call duration","voice.micLevel":"Microphone level","voice.micMute":"Mute microphone","voice.micUnmute":"Unmute microphone","voice.outputMute":"Silence the agent","voice.outputUnmute":"Unsilence the agent","voice.floatSurface":"Voice conversation","voice.float":"Open the floating voice window","voice.dock":"Close the floating window and keep the call","voice.floatUnsupported":"A floating voice window needs a Chromium browser; the call stays here.","attention.return":"Back to where you were","attention.returnLine":"Go back to where you were"}},9554:(e,t,n)=>{"use strict";n.d(t,{PG:()=>a,YP:()=>i});let r={"image/png":"png","image/jpeg":"jpg","image/jpg":"jpg","image/gif":"gif","image/webp":"webp"},i=0xa00000;function a(e){return r[e]??null}},9992:(e,t,n)=>{"use strict";n.d(t,{$T:()=>s.A,BK:()=>_.A,GO:()=>T.A,JG:()=>f.A,JU:()=>k.A,Jl:()=>p.A,Kq:()=>z.A,M6:()=>D.A,MA:()=>d.A,O0:()=>j.A,Oe:()=>w.A,QR:()=>v.A,Qp:()=>o.A,RE:()=>O.A,TB:()=>F.A,Td:()=>a.A,X:()=>q.A,Zr:()=>N.A,_T:()=>P.A,c9:()=>X,c_:()=>h.A,eW:()=>c.A,gE:()=>I.A,jG:()=>$.A,jy:()=>u.A,kU:()=>y.A,ke:()=>L.A,kr:()=>G.A,kt:()=>E.A,oF:()=>M.A,qk:()=>i.A,rW:()=>g.A,rX:()=>x.A,uB:()=>b.A,vj:()=>R.A,vv:()=>A.A,xf:()=>S.A,yQ:()=>m.A,yd:()=>l.A,zg:()=>C.A});var r=n(5155),i=n(6599),a=n(2159),s=n(7218),l=n(9805),o=n(467),c=n(99),d=n(7381),u=n(5045),p=n(9339),m=n(2363),f=n(8780),h=n(6721),x=n(4088),g=n(4962),b=n(5222),v=n(9314),w=n(9072),y=n(5182),k=n(600),j=n(4885),N=n(5480),S=n(6210),C=n(9707),A=n(8747),I=n(5796),M=n(4551),T=n(5688),P=n(7979),$=n(6619),E=n(1189),R=n(5377),O=n(6851),D=n(852),L=n(4179),_=n(6449),F=n(5738),q=n(9005),z=n(9804),H=n(7990),U=n(8910),B=n(5561),K=n(966),Y=n(2750),W=n(6483),V=n(6455),J=n(626),G=n(2571);let Q={shell:h.A,tool:H.A,"cmd-group":_.A,codex:b.A,claude:O.A,image:S.A,blob:U.A,note:P.A,citation:B.A,message:I.A,shutdown:K.A,plan:Y.A,compact:j.A,file:W.A,edit:V.A,search:R.A,web:J.A,spawn:N.A,clock:i.A};function X({name:e,className:t}){let n=Q[e];return(0,r.jsx)(n,{className:t??"h-3.5 w-3.5","aria-hidden":!0})}}},e=>{e.O(0,[9178,8441,3794,7358],()=>e(e.s=9097)),_N_E=e.O()}]);
|