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
|
@@ -0,0 +1,85 @@
|
|
|
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}},975:(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:()=>Sy});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||"openclaw-sessions"===e.root)&&!e.parent}function eC(e){return"claude-projects"===e.root&&"subagent"===e.kind}function eA(e){return!!(eC(e)||e.durableLineage?.parentConversationId||e.durableLineage?.memberships.some(e=>e.parentConversationId))||"viewer"===e.spawnOrigin&&!!e.parent||!!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!==eB(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,r){return!n?.foldedEnginePaths?.has(e.path)&&(!r||!!r.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,keepExpandedPaths:c}=n,d=n.now??0,u=n.ageHorizonSeconds??ek(),p=e=>"recent"===e.activity||d>0&&d-e.mtime<=u,m=e=>ej(e,d,u),f=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,m(a)&&(!c||c.has(a.path))&&(t=a)}return t};for(let n of e){if(eM(n)!==t)continue;let e=!c||c.has(n.path);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)&&e&&(0===d||"live"===n.activity||"running"===n.proc||p(n))){a.set(n.path,n);continue}let i=l?.has(n.path)===!0;if(e&&("live"===n.activity||"running"===n.proc||p(n)&&eA(n)||o?.promotedEnginePaths?.has(n.path)===!0||i&&(eS(n)||eA(n)))){let e=f(n);eI(e)?s.set(e.path,e):a.set(e.path,e);continue}e&&p(n)&&eS(n)&&a.set(n.path,n)}let h=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,a){let s=eD(e,t),l="live"===e.activity||"running"===e.proc,o=s.filter(e=>l&&eA(e)&&i(e)&&(!a||a.has(e.path))&&!r?.foldedEnginePaths?.has(e.path)||eL(e,n,r,a)).sort((e,t)=>("live"!==e.activity)-("live"!==t.activity)||ey(t.mtime)-ey(e.mtime)||e.path.localeCompare(t.path)),c=s.filter(e=>eI(e)&&"live"===e.activity).sort((e,t)=>ey(t.mtime)-ey(e.mtime)||e.path.localeCompare(t.path)),d=[e,...o].map(e=>({file:e,tasks:[]})),u=new Map(d.map(e=>[e.file.path,e]));for(let e of c)(e.parent&&u.get(e.parent)||d[0]).tasks.push(e);let p=new Set([...u.keys(),...c.map(e=>e.path)]),m=s.filter(e=>!p.has(e.path)).sort((e,t)=>t.mtime-e.mtime),f=Math.max(...d.map(e=>e.file.mtime),...c.map(e=>e.mtime));return{key:e.path,columns:d,returnable:[],finished:m,smt:f,orphanTask:!1}})(e,i,l,o,m,c)),r);for(let e of s.values())h.push({key:e.path,columns:[{file:e,tasks:[]}],returnable:[],finished:[],smt:e.mtime,orphanTask:!0});return h.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){let t=Date.parse(e);return Number.isFinite(t)?t/1e3:null}function eU(e,t){let n=e.bridgeAsk;if(!n)return null;let r=eH(n.at);return null===r?null:t-r<=7200?n:null}function eB(e,t=Date.now()/1e3){let n=eU(e,t);return n?n.id: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 eK(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 eY=(e=(0,eh.JK)())=>"uk"===e?"uk-UA":"en-US";function eW(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(eY(t),{hour:"2-digit",minute:"2-digit",hour12:!1})})}function eV(e,t){return new Date(1e3*e).toLocaleTimeString(eY(t),{hour:"2-digit",minute:"2-digit",hour12:!1})}function eJ(e,t,n){return n.resetAt?e("rateLimit.badgeUntil",{time:eV(n.resetAt,t)}):e("rateLimit.badge")}function eG(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 eQ(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 eX(e,t){let n=new Date(1e3*e),r=n.toLocaleTimeString(eY(),{hour:"2-digit",minute:"2-digit",hour12:!1});return e-t<86400?r:n.toLocaleDateString(eY(),{day:"numeric",month:"short"})+" "+r}let eZ=e=>e;function e0(e){return e.split("/").slice(-2).join("/")}function e1(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=e0(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(e0(e))??e}let e2="llv:flows-changed",e5=new Set,e4=e5,e3=new Set;function e6(e){return e3.add(e),()=>e3.delete(e)}let e8=new Set;function e7(e){return"closed"!==e.state||!0===e.restored}function e9(e){let t=new Map;for(let n of e){if(!e7(n))continue;let e=t.get(n.implementerPath);(!e||n.createdAt>e.createdAt)&&t.set(n.implementerPath,n)}return t}function te(e,t=[]){let n=new Set;for(let r of e)for(let e of r.rounds)for(let{path:i}of tr(r,e,t))n.add(i);return n}function tt(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 tn(e,t,n){let r=en([...n]),i=tt(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 tr(e,t,n=[]){let r=tn(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=tt(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 ti=new Set;function ta(e,t){return!t.has(e.path)&&("claude"===e.engine||"codex"===e.engine)&&eS(e)}let ts=new Set(["spawn_pending","relay_pending","needs_decision","paused","approved"]),tl={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 to(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:eV(t.block.resetAt,n)}):e("flowState.rate_limit_wait"),attention:!0,pending:null}:{label:(r=t.state,e(`flowState.${r}`)),detail:t.stateDetail,attention:ts.has(t.state),pending:tl[t.state]??null}}function tc(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 td(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 tu={APPROVE:"✓",REQUEST_CHANGES:"✖",COMMENT:"◆"};function tp(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 tm(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(!e5.has(e))for(let t of(e5.add(e),e4=new Set(e5),e3))t()}(e),window.dispatchEvent(new Event(e2)),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 tf=n(1463);let th=["passed","failed","skipped"];function tx(e,t,n=eZ){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}let tg=new Set(["approved","done_comment"]);function tb(e){return e.conversationId??e.path}function tv(e,t){var n;if("killed"===e.proc||"done"===e.proc||e.authoritativeTurn?.state==="terminal"||e.supersededBy||e.spawn?.state==="failed"||e.spawn?.state==="recovered"||e.review?.verdict||t.settledStagePaths?.has(e.path))return!0;let r=e.durableLineage?.memberships.find(e=>"pipeline"===e.kind);if(r&&void 0!==t.pipelines){let e=t.pipelines.find(e=>e.id===r.containerId);if(!e||"completed"===e.state||"closed"===e.state)return!0}let i=tx(e,t.flows,t.resolveClaimPath);return!!i&&("reviewer"===i.role&&!!i.round&&(null!==(n=i.round).verdict||null!==n.reviewedAt||null!==n.error||!!n.terminalAt)||"closed"===i.flow.state||tg.has(i.flow.state))}function tw(e,t){return!!("live"===e.activity||"running"===e.proc||e.pendingQuestion||e.waitingInput||e.rateLimit||(e.migration?.heldDeliveries??0)>0||e.conversationId&&t.activeDeliveryConversationIds?.has(e.conversationId)||t.protectedPaths?.has(e.path))||t.pinnedPaths.has(e.path)}let ty=["provisioning","running","needs_decision","paused"];function tk(e){if(!e)return 0;let t=Date.parse(e);return Number.isNaN(t)?0:t}let tj={flow:0,pipeline:1,origin:2,worktree:3},tN=new Set,tS=new Map;function tC(e){let t=e1(e.files);return{flows:e.flows,pipelines:e.pipelines,resolveClaimPath:t,pipelineStagePaths:function(e,t=eZ){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),settledStagePaths:function(e,t=eZ){let n=new Set;for(let r of e)for(let e of r.runs)for(let r of e.attempts)r.agentPath&&th.includes(r.state)&&n.add(t(r.agentPath));return n}(e.pipelines??[],t),pinnedPaths:e.pinnedPaths,protectedPaths:e.protectedPaths??tN,activeDeliveryConversationIds:e.activeDeliveryConversationIds??tN,outcomePaths:e.outcomePaths??tN,seenAt:e.seenAt??tS}}let tA=e=>1e13*eN(e)-e.mtime,tI="direct-review::";function tM(e){return e.id.startsWith(tI)}let tT=new Set;var tP=n(6505);function t$(e,t){return Math.floor(t.smt/300)-Math.floor(e.smt/300)||e.file.path.localeCompare(t.file.path)}function tE(e,t=Date.now()/1e3){return!!e.pendingQuestion||!!e.rateLimit||!!e.waitingInput||("stalled"===e.activity?null!==eB(e,t):"recent"===e.activity&&("claude"===e.engine||"codex"===e.engine||"openclaw"===e.engine)&&eS(e)&&!eC(e))}function tR(e,t,n,r,i=tO,a=tD){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=e9(a.filter(e=>!tM(e))),u=te(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":tE(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,tP.rK)(i.ts)}`:"live"===t.activity?e("status.working"):eC(r=t)&&"running"!==r.proc?e("status.returnedResult"):"stalled"===t.activity?e("status.stalled"):tE(t)?e("status.finishedTurn"):""}(l,e,c);if(a){let e=to(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(t$),older:m.filter(e=>"older"===e.kind).sort(t$),livePreview:x.slice(0,3)}},[e,t,n,r,i,a,s])}let tO=new Set,tD=[];function tL(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":tE(e,t)?"stalled"===e.activity?"stalled":"waiting":"done"}let t_=new Map;function tF(e){let t=t_.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 tq=null;function tz(){if(!tq){let e=window.AudioContext??window.webkitAudioContext;if(!e)return null;tq=new e}return tq}let tH={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 tU(e,t,n=0){if(!function(){try{return"off"!==localStorage.getItem("llvSound")}catch{return!0}}())return;let r=tz();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 tH[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 tB="/audio/cues",tK={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"}},tY={priority:1,salient:.75,routine:.5},tW={priority:3,salient:2,routine:1};function tV(e){return tK[e].tier}function tJ(e){return"priority"===tV(e)}let tG={waiting:"attention",question:"attention",returned:"success",stalled:"failure",spawned:"launch"},tQ="/audio/ambient/voice-call-loop.wav";function tX(e=tQ){return"string"==typeof e&&e.length>0}let tZ="llvSound",t0="llvAudioCueVolume",t1="llvAudioLoopEnabled",t2="llvAudioViewerLoopEnabled",t5="llvAudioLoopVolume",t4={cuesEnabled:!0,cueVolume:.4,loopEnabled:!1,viewerLoopEnabled:!1,loopVolume:.05},t3=null,t6=new Set;function t8(){if(void 0!==r)return r;try{return window.localStorage}catch{return null}}function t7(){for(let e of t6)e()}function t9(e,t){if(!e)return null;try{return e.getItem(t)}catch{return null}}function ne(e,t,n){let r=t9(e,t);return"on"===r||"off"!==r&&n}function nt(e,t,n){let r=Number.parseFloat(t9(e,t)??"");return Number.isFinite(r)?Math.max(0,Math.min(1,r)):n}function nn(){return t3??=function(e=t8()){return{cuesEnabled:ne(e,tZ,t4.cuesEnabled),cueVolume:nt(e,t0,t4.cueVolume),loopEnabled:ne(e,t1,t4.loopEnabled),viewerLoopEnabled:ne(e,t2,t4.viewerLoopEnabled),loopVolume:nt(e,t5,t4.loopVolume)}}()}function nr(e){let t={...nn(),...e},n=t8();if(n)try{void 0!==e.cuesEnabled&&n.setItem(tZ,t.cuesEnabled?"on":"off"),void 0!==e.cueVolume&&n.setItem(t0,String(t.cueVolume)),void 0!==e.loopEnabled&&n.setItem(t1,t.loopEnabled?"on":"off"),void 0!==e.viewerLoopEnabled&&n.setItem(t2,t.viewerLoopEnabled?"on":"off"),void 0!==e.loopVolume&&n.setItem(t5,String(t.loopVolume))}catch{}return t3={...t,cueVolume:Math.max(0,Math.min(1,t.cueVolume)),loopVolume:Math.max(0,Math.min(1,t.loopVolume))},t7(),t3}function ni(e){return t6.add(e),()=>{t6.delete(e)}}let na={schedule:(e,t)=>setTimeout(e,t),cancel:e=>clearTimeout(e)},ns=function(e,t="function"==typeof fetch?fetch:null,n=na){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()}}}(()=>tz()),nl=null,no=null,nc=null,nd=0,nu=!1,np=!1,nm=new Set,nf=new Map;function nh(){nu||(nu=!0,ni(()=>{nd=0,nb()}))}function nx(){var e;let t,n,r,i,a,s,l,o,c,d,u,p,m;return no??=(t=(e={asset:tQ,transport:ns.loop,prefs:nn}).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!!tX(e.asset)&&!!t&&(s?n:r)},p=()=>{let{cuesEnabled:t,loopEnabled:n,viewerLoopEnabled:r}=e.prefs();return tX(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:()=>tX(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){tJ(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})}),nh(),no}function ng(e){var t;let n,r,i,a,s;return(nl??=(n=(t={transport:ns.cues,prefs:nn}).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||tW[tV(n.cue)]<tW[tV(e.cue)])&&(e={key:t,cue:n.cue,handle:n.handle});return e})();if(!t||tW[tV(e)]<=tW[tV(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=tK[e],r=n.variants?.length?n.variants[Math.min(n.variants.length-1,Math.floor(t()*n.variants.length))]:n.file;return`${tB}/${r}`}(e),gain:(d=Math.max(0,Math.min(1,p)),tY[tV(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}),tJ(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()}}),nh(),nl).play(e)}function nb(){let e=nx();if(e.refresh(),null!==nc&&(clearTimeout(nc),nc=null),!e.wanted()||e.state().playing){nd=0;return}nd>=30||(nd+=1,nc=setTimeout(()=>{nc=null,nb()},700))}function nv(e,t){if(t?nm.add(e):(nm.delete(e),nf.delete(e)),nd=0,nm.size>0)return void ny();if(!np){var n;np=!0,n=()=>{np=!1,ny()},"function"==typeof queueMicrotask?queueMicrotask(n):setTimeout(n,0)}}function nw(){let e=null;for(let t of nf.values())e=t;return e}function ny(){let e=nx();e.setVoiceConnected(nm.size>0),e.setSpeaking(nm.size>0?nw():null),nb()}function nk(e,t){nf.delete(e),t&&nf.set(e,t),nx().setSpeaking(nm.size>0?nw():null)}let nj={waiting:"waiting",returned:"returned",stalled:"stalled"};function nN(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 nS="llvArchivedProjects";function nC(e){try{window.localStorage.setItem(nS,JSON.stringify([...e]))}catch{}}var nA=n(7650);let nI="llv:pipelines-changed",nM="llv:pipelines-patched",nT="llv:session-titles-changed";async function nP(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(nT)),{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 n$="llv:tasks-changed";function nE(){window.dispatchEvent(new Event(n$))}async function nR(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 nE(),{ok:!0,data:i}}catch{return{ok:!1,status:0,error:(0,eh.Tl)((0,eh.JK)(),"common.serverUnavailable")}}}function nO(){return"function"==typeof crypto?.randomUUID?crypto.randomUUID():Date.now().toString(36)+Math.random().toString(36).slice(2,10)}async function nD(e){let t=await nR("/api/tasks","POST",e);return t.ok?{task:t.data.task}:{error:t.error}}function nL(e){return`/api/task-attachments?sha=${encodeURIComponent(e.sha256)}&ext=${encodeURIComponent(e.ext)}`}async function n_(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 nF=new Map;async function nq(e){let t=nF.get(e);return t&&await t!==null?(0,eh.Tl)((0,eh.JK)(),"tasks.textNotSaved"):null}function nz(e,t){let n=void 0!==t.text?nF.get(e):void 0,r=(async()=>{n&&await n;let r=await nR(`/api/tasks/${encodeURIComponent(e)}`,"PATCH",t);return r.ok||404!==r.status?r.ok?null:r.error:(nE(),null)})();return void 0!==t.text&&(nF.set(e,r),r.finally(()=>{nF.get(e)===r&&nF.delete(e)})),r}async function nH(e){let t=await nR(`/api/tasks/${encodeURIComponent(e)}`,"DELETE");return t.ok||404!==t.status?t.ok?null:t.error:(nE(),null)}async function nU(e,t){let n=await nq(e);if(n)return{error:n};let r=await nR(`/api/tasks/${encodeURIComponent(e)}/assignment`,"POST",{path:t});return r.ok?{task:r.data.task}:{error:r.error}}async function nB(e,t){let n=await nR(`/api/tasks/${encodeURIComponent(e)}/assignment`,"DELETE","string"==typeof t?{path:t}:t);return n.ok||404!==n.status?n.ok?null:n.error:(nE(),null)}async function nK(e,t,n){let r=await nq(e);if(r)return{error:r};let i=await nR(`/api/tasks/${encodeURIComponent(e)}/send`,"POST",{paths:t,...n?{clientRequestId:n}:{}});return i.ok?i.data:{error:i.error}}async function nY(e,t){let n=await nq(e);if(n)return{error:n};let r=await nR(`/api/tasks/${encodeURIComponent(e)}/spawn`,"POST",{retryOfLaunchId:t});return r.ok?r.data:{error:r.error}}let nW="llv:workflows-changed";function nV(e){return e.startsWith("wf-")}let nJ="llv:files-changed";function nG(){window.dispatchEvent(new Event(nJ))}let nQ=new TextEncoder,nX=new TextDecoder,nZ=e=>nQ.encode(e).length;function n0(e){return e&&"object"==typeof e&&!Array.isArray(e)?e:null}function n1(e){return"string"==typeof e?e:""}function n2(e,t){let n=[...e];return n.length>t?n.slice(0,t-1).join("")+"…":e}function n5(e){return"string"==typeof e?e:Array.isArray(e)?e.map(e=>{let t=n0(e);if(!t)return"";let n=n1(t.type);return"text"===n||"input_text"===n||"output_text"===n?n1(t.text):""}).filter(Boolean).join("\n"):""}function n4(e){let t=n0(e);if(!t)return null==e||""===e?{}:n4({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=n2(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=n2(e,256)}n[e]=t,r+=1}let i=Object.entries(n);for(;i.length&&nZ(JSON.stringify(Object.fromEntries(i)))>2048;)i=i.slice(0,-1);return Object.fromEntries(i)}let n3=new Set(["commandExecution","fileChange","mcpToolCall","dynamicToolCall","collabAgentToolCall","webSearch","imageView","imageGeneration"]);function n6(e,t){let n=n0(e),r=n0(n?.message),i=r?.[t];return"number"==typeof i&&Number.isFinite(i)&&i>0?Math.floor(i):0}function n8(e){let t=n0(e);return t?{name:n2(n1(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:n4(t.args),...!0===t.argsOmitted?{argsOmitted:!0}:{}}:null}function n7(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!==n8(e.tool))).map(e=>{let t=n8(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 n9(e){return Array.isArray(e.items)||Array.isArray(e.overflow)?[...n7(e.overflow),...n7(e.items)]:e.text?[{itemId:null,text:e.text,phase:"streaming",startedAt:null,completedAt:null}]:[]}function re(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+nZ(t.text),0)-65536;a>0&&(i=i.map(e=>{if(a<=0)return e;let t=nZ(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:[...nX.decode(n.subarray(0,r))].length,text:nX.decode(n.subarray(r))}}(e.text,a);return a-=t-nZ(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 nZ(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 rt(e,t,n){if(!e)return[];let r=n9(e);return e.turnId===t?r:r.map(e=>"streaming"===e.phase?{...e,phase:"awaiting-echo",completedAt:e.completedAt??n}:e)}function rn(e){return e&&"object"==typeof e&&!Array.isArray(e)?e:null}function rr(e){return"string"==typeof e?e:""}function ri(e,t){return`voice:${JSON.stringify([e,t.map(e=>e.responseId)])}`}function ra(e){return Array.isArray(e)?e.flatMap(e=>{let t=rn(e),n=rr(t?.turnId),r=Array.isArray(t?.responses)?t.responses.flatMap(e=>{let t=rn(e),n=rr(t?.responseId);return n&&"string"==typeof t?.text?[{responseId:n,text:t.text}]:[]}):[];if(!n||0===r.length)return[];let i=rr(t?.sourceTurnId),a=rn(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:ri(n,r),turnId:n,responses:r,ready:t?.ready===!0,...c?{sourceTurnId:i,streamChunk:{index:s,startOffset:l,endOffset:o}}:{}}]}):[]}function rs(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 rl(){return{cursor:0,retentionFloorSeq:0,filesRevision:0,hostEpoch:0,health:"unknown",scopeHeads:{},sessions:{},attentions:{},operations:{},edges:{},flows:{},workflows:{},tasks:{},deployments:{}}}function ro(e){let t={},n={};for(let r of e.sessions)n[r.conversationId]={...r,attentionIds:[...r.attentionIds],recentReceipts:[...r.recentReceipts],...r.voiceDeliveries?{voiceDeliveries:ra(r.voiceDeliveries)}:{},...r.acknowledgedVoiceDeliveryIds?{acknowledgedVoiceDeliveryIds:rs(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 rc(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 rd(e,t,n,r){let i=e.sessions[t]??rc(t,{}),a=n>i.revision?n:i.revision;e.sessions={...e.sessions,[t]:{...r(i),revision:a}}}function ru(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 rp(e,t){return t.attentionIds.some(t=>e.attentions[t]?.state==="open")}function rm(e){return"delivered"===e||"applied"===e||"answered"===e||"rejected"===e||"failed"===e||"interrupted"===e}let rf={"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","compact-sent-unobserved":"receipt.human.compactSentUnobserved","compact-declined":"receipt.human.compactDeclined"};function rh(e){return e?rf[e.trim().toLowerCase()]??null:null}function rx(e){return"queued"===e||"delivering"===e||"turn-started"===e||"steered"===e||"delivered"===e||"answered"===e}function rg(){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 rb=n(1463);let rv="llv:stream-reconnected";class rw extends Error{}function ry(){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}}(rb.env.NEXT_PUBLIC_RUNTIME_UI))return!0;try{return"1"===window.localStorage.getItem("llv_runtime_ui")}catch{return!1}}let rk=null;function rj(){return rk||(rk=function(e){let t={store:rl(),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(rv)),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 rw("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:rl(),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:ro(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 rw)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??rc(i,r),...r,conversationId:i,revision:n,attentionIds:r.attentionIds??a?.attentionIds??[],recentReceipts:a?.recentReceipts??[],acknowledgedVoiceDeliveryIds:rs(r.acknowledgedVoiceDeliveryIds??a?.acknowledgedVoiceDeliveryIds)};e.sessions={...e.sessions,[i]:s};break}case"turn-started":{let r=t.payload;rd(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;rd(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=rt(e,t,r),a=i.at(-1);return re(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;rd(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=n0(e);if(!t)return null;let n=n1(t.type),r=n0(t.message),i=n1(t.role)||n1(r?.role);return"agentMessage"!==n&&"agent_message"!==n&&"assistant"!==n&&("message"!==n||"assistant"!==i)?null:{itemId:n1(t.id)||n1(t.uuid)||n1(r?.id)||null,text:n1(t.text)||n5(t.content)||n5(r?.content)}}(n):null,o=function(e,t){let n=n0(e);if(!n)return[];let r=n1(n.type),i=n0(n.message),a=n1(n.role)||n1(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=n0(e);if(!t||"tool_use"!==n1(t.type))return[];let n=n1(t.id);return n?[{callId:n,name:n1(t.name)||"tool",engine:"claude",status:"run",args:n0(t.input)??{},...!0===t.inputOmitted?{argsOmitted:!0}:{},finished:!1}]:[]});if(("user"===r||"user"===a)&&s)return s.flatMap(e=>{let t=n0(e);if(!t||"tool_result"!==n1(t.type))return[];let n=n1(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=n1(e.id)||n1(e.call_id)||n1(e.callId);if(!i||!n3.has(t))return null;let a="started"===n?"run":"inprogress"===(r=n1(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=n1(e.command),n=n1(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(n0).filter(Boolean):[]).slice(0,8).flatMap(e=>{let t=n1(e?.path);if(!t)return[];let n=n1(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=n1(e.server),n=n1(e.tool)||"tool";return{callId:i,name:t?`mcp__${t}__${n}`:n,engine:"codex",status:a,args:n0(e.arguments)??{},finished:s}}return"dynamicToolCall"===t?{callId:i,name:n1(e.tool)||"tool",engine:"codex",status:a,args:n0(e.arguments)??{},finished:s}:"collabAgentToolCall"===t?{callId:i,name:n1(e.tool)||"Agent",engine:"codex",status:a,args:{...n1(e.prompt)?{prompt:n1(e.prompt)}:{},...n1(e.model)?{model:n1(e.model)}:{}},finished:s}:"webSearch"===t?{callId:i,name:"WebSearch",engine:"codex",status:a,args:{...n1(e.query)?{query:n1(e.query)}:{}},finished:s}:"imageView"===t?{callId:i,name:"view_image",engine:"codex",status:a,args:{...n1(e.path)?{path:n1(e.path)}:{}},finished:s}:{callId:i,name:"imagegen",engine:"codex",status:a,args:{...n1(e.revisedPrompt)?{prompt:n1(e.revisedPrompt)}:{}},finished:s}}(n,r,t);return l?[l]:[]}(n,r),c="completed"===r?n6(n,"omittedToolCalls"):0,d="completed"===r?n6(n,"omittedToolResults"):0;if(!l&&!o.length&&!c&&!d)return e??null;let u=rt(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?n2(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:n4(t.args)}:{}}},s}return[...e,{itemId:t.callId,text:"",phase:"awaiting-echo",startedAt:n,completedAt:t.finished?n:null,tool:{name:n2(t.name||"tool",128),engine:t.engine,status:t.status,args:n4(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=n0(n),s=n0(a?.message),n1(a?.id)||n1(a?.uuid)||n1(s?.id)||null),i),d,new Set(o.filter(e=>e.finished).map(e=>e.callId)),i))===u?e??null:re(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=ra(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:ri(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=ra([r.voiceDelivery])[0];rd(e,r.conversationId??t.scope.id,n,e=>({...e,voiceDeliveries:i?function(e,t){let n=ra(e),r=ra([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;rd(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=ra(t)).findIndex(e=>e.turnId===n),"completed"!==i?s.filter(e=>e.turnId!==n&&e.sourceTurnId!==n):l<0||s[l].ready?s:rs(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;rd(e,r.conversationId??t.scope.id,n,e=>{var t,n;let i=r.deliveryId??"";return{...e,voiceDeliveries:(t=e.voiceDeliveries,ra(t).filter(e=>e.deliveryId!==i)),acknowledgedVoiceDeliveryIds:(n=e.acknowledgedVoiceDeliveryIds,rs([...rs(n),i]))}});break}case"voice-delivery-progress":rd(e,t.payload.conversationId??t.scope.id,n,e=>e);break;case"attention":{let r=t.payload;e.attentions={...e.attentions,[r.id]:r},rd(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&&rd(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},rd(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;rd(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 rw)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:ro(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 rw)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:ro(r),lastEventAt:e.now(),structuredHostsEnabled:!0===r.structuredHostsEnabled}),!0}catch(e){return e instanceof rw&&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)})),rk}let rN={tmux:{status:"healthy"}},rS={files:[],pinOverlayPaths:[],requestScope:null,projectCatalog:[],projectAliases:{},projectDisplayNames:{},crownedProjects:[],projectCwds:{},flows:[],pipelines:[],workflows:[],tasks:[],systemHealth:rN,conversationAliases:{},launchRoutes:{},loaded:!1,catalogFailures:0};function rC(e,t){let n=[];return t&&n.push("path="+encodeURIComponent(t)),n.length?"/api/files?"+n.join("&"):"/api/files"}function rA(e,t){return JSON.stringify(e)===JSON.stringify(t)}function rI(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&&rA(t,e)?t:e});return i.length===e.length&&i.every((t,n)=>t===e[n])?e:i}function rM(e,t){return{...t,files:rI(e.files,t.files,e=>e.path),projectCatalog:rI(e.projectCatalog,t.projectCatalog,e=>e.project),projectAliases:rA(e.projectAliases,t.projectAliases)?e.projectAliases:t.projectAliases,projectDisplayNames:rA(e.projectDisplayNames,t.projectDisplayNames)?e.projectDisplayNames:t.projectDisplayNames,crownedProjects:rA(e.crownedProjects,t.crownedProjects)?e.crownedProjects:t.crownedProjects,projectCwds:rA(e.projectCwds,t.projectCwds)?e.projectCwds:t.projectCwds,flows:rI(e.flows,t.flows,e=>e.id),pipelines:rI(e.pipelines,t.pipelines,e=>e.id),workflows:rI(e.workflows,t.workflows,e=>e.id),tasks:rI(e.tasks,t.tasks,e=>e.id),systemHealth:rA(e.systemHealth,t.systemHealth)?e.systemHealth:t.systemHealth,conversationAliases:rA(e.conversationAliases,t.conversationAliases)?e.conversationAliases:t.conversationAliases,launchRoutes:rA(e.launchRoutes,t.launchRoutes)?e.launchRoutes:t.launchRoutes}}let rT=(H=(e,t)=>fetch(e,t),i=rS,a=!1,s=new Map,l=new Map,o=new Map,c=0,d=0,u=Promise.resolve(),p=new Map,m=rS.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:{...rS,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=rC(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=rR(g,"x-llv-files-generation"),T=rR(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=rM(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:rN,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??rN,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=rM(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(rC(void 0,e)),revalidate:(e,t)=>P(e,t),subscribe:(e,t)=>{if(a)return()=>{};let n=rC(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 rP(e,t){(0,nA.flushSync)(()=>rT.applyPipeline(e,t)),window.dispatchEvent(new Event(nM))}function r$(e){(0,nA.flushSync)(()=>rT.revertPipeline(e)),window.dispatchEvent(new Event(nM))}function rE(e){(0,nA.flushSync)(()=>rT.applySpawnedConversation(e))}function rR(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 rO={loaded:!1,ids:new Set},rD=new Set;function rL(){return rO}let r_={claim:!1,track:!1,suppressSelection:!1},rF="viewMode",rq="taskPanelOpen",rz="idleCollapseMinutes",rH="path:",rU=e=>`${rH}${e}`,rB=e=>`favorite:${e}`,rK=e=>`fold:${e}`,rY=e=>`tray:${e}`;function rW(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 rV(e,t){return e.startsWith(rH)?rU(rW(e.slice(rH.length),t)):e}let rJ={absent:0,manual:1,pinned:2,expanded:3,hidden:4};function rG(e,t){let n=new Map,r=(e,r)=>{let i=rW(e,t),a=n.get(i);(void 0===a||(rJ[r]??0)>(rJ[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 rQ(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 rX(e,t={}){let n=e=>rU(rW(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[rB(e.id)];case"set-engine-child-fold":return[rK(e.id),n(e.path)];case"set-engine-tray-expanded":return[rY(e.parentId)];case"mark-seen":return[];case"set-presentation":return[...void 0===e.viewMode?[]:[rF],...void 0===e.taskPanelOpen?[]:[rq],...void 0===e.idleCollapseMinutes?[]:[rz]]}}function rZ(e,t){let n=rV(t,e.pathAliases??{});return e.keyRevisions?.[n]??e.keyRevisionFloor??0}function r0(e){return[...new Set(e)]}function r1(e){return e.pathAliases??{}}function r2(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 r5(e,t=r1(e)){let n=function(e){let t={};for(let n of Object.keys(e)){let r=r2(n,e);n!==r&&(t[n]=r)}return t}(t),r=r0(e.prefs.hidden.map(e=>r2(e,n))),i=new Set(r),a=e=>r0(e.map(e=>r2(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:r0(e.prefs.favorites??[]),foldedEngineChildIds:r0(e.prefs.foldedEngineChildIds??[]),expandedEngineTrayParentIds:r0(e.prefs.expandedEngineTrayParentIds??[]),seenAt:Object.fromEntries(Object.entries(e.prefs.seenAt??{}).sort((e,t)=>t[1]-e[1]).slice(0,512)),idleCollapseMinutes:void 0===e.prefs.idleCollapseMinutes?120:e.prefs.idleCollapseMinutes}}}function r4(e,t){var n;let r,i,a,s=r5(e);for(let e of t){if("remap-paths"===e.kind){s=function(e,t,n=!1){let r=r1(e),i=t.filter(({from:e,to:t})=>r2(e,r)!==r2(t,r));if(0===i.length)return r5(e);let a=new Set(t.map(({from:e})=>r2(e,r))),s=new Set(i.map(({to:e})=>r2(e,r))),l=e=>{if(n)return!0;let t=r2(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 r5({...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=r1(e),i=new Set(n.map(e=>r2(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=>r2(e,r))]);for(let e of t.map(e=>r2(e,r)))l.has(e)||(a.push(e),l.add(e));return r5({...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 r5({...e,explicitManual:i,prefs:r});let a={...r,manual:r.manual.filter(e=>e!==t),expanded:r.expanded.filter(e=>e!==t)};return r5({...e,explicitManual:"manual"===n?[...i,t]:i,prefs:"manual"===n?{...a,manual:[...a.manual,t]}:{...a,expanded:[...a.expanded,t]}})}(s,r2(e.path,r1(s)),e.placement);continue}if("set-favorite"===e.kind){let t=e.favorite?r0([...s.prefs.favorites,e.id]):s.prefs.favorites.filter(t=>t!==e.id);s=r5({...s,prefs:{...s.prefs,favorites:t}});continue}if("mark-seen"===e.kind){let t=s.prefs.seenAt??{},n=Math.max(t[e.id]??0,Math.floor(e.at));s=r5({...s,prefs:{...s.prefs,seenAt:{...t,[e.id]:n}}});continue}if("set-engine-child-fold"===e.kind){let t=s.prefs.foldedEngineChildIds??[],n=e.folded?r0([...t,e.id]):t.filter(t=>t!==e.id),r=r2(e.path,r1(s));s=r5({...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?r0([...t,e.parentId]):t.filter(t=>t!==e.parentId);s=r5({...s,prefs:{...s.prefs,expandedEngineTrayParentIds:n}});continue}if("set-presentation"===e.kind){s=r5({...s,prefs:{...s.prefs,...void 0===e.viewMode?{}:{viewMode:e.viewMode},...void 0===e.taskPanelOpen?{}:{taskPanelOpen:e.taskPanelOpen},...void 0===e.idleCollapseMinutes?{}:{idleCollapseMinutes:e.idleCollapseMinutes}}});continue}let t=r2(e.path,r1(s));s=r5({...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:r0([...s.prefs.hidden,t])}})}return r=r1(n=s),i=new Set(n.prefs.hidden.map(e=>r2(e,r))),a=e.prefs.hidden.filter(e=>i.has(r2(e,r))),{...n,prefs:{...n.prefs,hidden:r0([...a,...n.prefs.hidden])}}}let r3={manual:[],hidden:[],expanded:[],favorites:[],foldedEngineChildIds:[],expandedEngineTrayParentIds:[],seenAt:{},idleCollapseMinutes:120,viewMode:null,taskPanelOpen:!1};function r6(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&&(void 0===e.idleCollapseMinutes?120:e.idleCollapseMinutes)===120&&null===e.viewMode&&!e.taskPanelOpen}function r8(e){return Array.isArray(e)?e.filter(e=>"string"==typeof e):[]}let r7=new Map,r9=new Map,ie=new Map,it={paths:new Set,armed:!1},ir=new Map,ii=e=>ir.get(e)??it,ia=new Map;function is(e,t,n=!1){let r=r7.get(e)??{manual:[],expanded:[]};n?r.expanded.includes(t)||r.expanded.push(t):r.manual.includes(t)||r.manual.push(t),r7.set(e,r),r9.get(e)?.()}let il=new Set(["INVALID_REQUEST","PAYLOAD_TOO_LARGE"]),io=new Set(["UNSUPPORTED_SCHEMA_VERSION"]);function ic(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 id(e,t){if(0===t.length)return e;try{return r4(e,t)}catch{return e}}let iu=e=>e.map(e=>e.mutation),ip={prefs:r3,explicitManual:[],revision:0,sync:"unavailable",loaded:!1,selection:it.paths,selectionArmed:!1},im=new Map;function ih(e){let t=(0,Y.useRef)(null),[n,r]=(0,Y.useState)(()=>({project:e,snapshot:function(e){if(null===e)return ip;let t=ii(e),n=ie.get(e);return n?{prefs:n.prefs,explicitManual:n.explicitManual??[],revision:n.revision,sync:"current",loaded:!0,selection:t.paths,selectionArmed:t.armed}:{...ip,selection:t.paths,selectionArmed:t.armed}}(e)}));return(0,Y.useEffect)(()=>{if(null===e){t.current=null,r({project:e,snapshot:ip});return}let n=function(e){let t=im.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=ie.get(r),c=o??{schemaVersion:1,revision:0,updatedAt:new Date(0).toISOString(),pathAliases:{},explicitManual:[],keyRevisions:{},keyRevisionFloor:0,prefs:r3},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:ii(r).paths,selectionArmed:ii(r).armed}:{prefs:r3,explicitManual:[],revision:0,sync:"unavailable",loaded:!1,selection:ii(r).paths,selectionArmed:ii(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=id(c,iu(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:ii(r).paths,selectionArmed:ii(r).armed},p&&!m&&ie.set(r,c),k))t()},N=e=>{let t=ii(r);if(e.paths!==t.paths||e.armed!==t.armed){0!==e.paths.size||e.armed?ir.set(r,e):ir.delete(r);for(let e of[...ia.get(r)??[]])e()}},S=(t=()=>j(),(n=ia.get(r)??new Set).add(t),ia.set(r,n),()=>{n.delete(t),0===n.size&&ia.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(rV(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&&il.has(e.error))return{status:"rejected"};if(e?.error!==void 0&&io.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=id(c,iu(d)),r=[...d,...e.map(e=>(function(e,t){let n={};for(let r of rX(e,t.pathAliases??{}))n[r]=rZ(t,r);return{mutation:e,observed:n}})(e,c))];try{t=r4(c,iu(r))}catch{t=null}null!==t&&ic(n,t)||(d=r,j(),E())},T=()=>{if(!p||h)return;let e=r7.get(r);e&&(0!==e.manual.length||0!==e.expanded.length)&&(r7.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}(iu(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??ic(id(c,e),t.board)?new Set(e.flatMap(e=>rX(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&&r6(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:r8(e.manual),hidden:r8(e.hidden),expanded:r8(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:[],idleCollapseMinutes:120,viewMode:a,taskPanelOpen:s}:null}(r,a);if(t&&!r6(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=rG(e,r),a=rG(t,r);for(let e of new Set([...i.keys(),...a.keys()]))(i.get(e)??"absent")!==(a.get(e)??"absent")&&n.add(rU(e));for(let r of rQ(e.prefs.favorites,t.prefs.favorites))n.add(rB(r));for(let r of rQ(e.prefs.foldedEngineChildIds,t.prefs.foldedEngineChildIds))n.add(rK(r));for(let r of rQ(e.prefs.expandedEngineTrayParentIds,t.prefs.expandedEngineTrayParentIds))n.add(rY(r));return e.prefs.viewMode!==t.prefs.viewMode&&n.add(rF),e.prefs.taskPanelOpen!==t.prefs.taskPanelOpen&&n.add(rq),(void 0===e.prefs.idleCollapseMinutes?120:e.prefs.idleCollapseMinutes)!==(void 0===t.prefs.idleCollapseMinutes?120:t.prefs.idleCollapseMinutes)&&n.add(rz),n}(e,n.board):null),d.length&&E();return}}C(e)}};r9.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=ii(r).paths,(n=new Set(t)).delete(e)||n.add(e),n),armed:ii(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}(ii(r).paths,e,t),armed:ii(r).armed})},clearSelection(){N(it)},setSelectionArmed(e){N({paths:ii(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}(ii(r).paths,e),armed:ii(r).armed})},dispose(){h=!0,S(),P(),r9.get(r)===T&&r9.delete(r),s.clearInterval(O),k.clear()}}}({project:e,fetcher:(e,t)=>fetch(e,t),storage:n});return im.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=im.get(e))&&(n.refs-=1,n.refs>0||(im.delete(e),n.store.dispose())),t.current=null}},[e]),{...n.project===e?n.snapshot:ip,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}])},markSeen(e){t.current?.mutate([{kind:"mark-seen",id:e,at:Math.floor(Date.now()/1e3)}])},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 ix="(max-width: 767px)";function ig(e){let t=window.matchMedia(ix);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)}function ib(){return(0,Y.useSyncExternalStore)(ig,()=>window.matchMedia(ix).matches,()=>!1)}let iv={project:null,board:{renderedRevision:null,durableRevision:null,sync:"unavailable"}},iw={mode:"overview",focusedPath:null,selectedPaths:[],visiblePaths:[],camera:null};function iy(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 ik(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 ij(e,t){return JSON.stringify(e)===JSON.stringify(t)}function iN(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 iS=(E=iv,R=iw,O=null,D=[],L=0,_=new Set,F=()=>{for(let e of _)e()},{reportContext(e){ij(E,e)||(E=e,F())},reportSlice(e){if(ij(R,e))return;let t=R.focusedPath!==e.focusedPath||!ij(R.selectedPaths,e.selectedPaths);R=e,t&&(L+=1),F()},reportIdentity(e){ij(O,e)||(O=e,F())},reportCards(e){ij(D,e)||(D=e,F())},getContext:()=>E,getSlice:()=>R,getIdentity:()=>O,getCards:()=>D,getSelectionRevision:()=>L,subscribe:e=>(_.add(e),()=>_.delete(e))}),iC="llvDeviceId";function iA(){return"u">typeof crypto&&"function"==typeof crypto.randomUUID?crypto.randomUUID():"vs-"+Math.random().toString(36).slice(2)+Date.now().toString(36)}function iI(e){try{let t=e?.getItem(iC);if(t)return t}catch{}let t=iA();try{e?.setItem(iC,t)}catch{}return t}function iM(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 iT(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 iP=["pointerdown","keydown","touchstart","wheel"],i$={"content-type":"application/json"};function iE(){return"u"<typeof document||"hidden"!==document.visibilityState}var iR=n(4577);function iO({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)(iR.A,{className:"h-4 w-4","aria-hidden":!0})})})}let iD=(q=null,z=null,{setBoard:e=>(q=e,()=>{q===e&&(q=null)}),board:()=>q,setShell:e=>(z=e,()=>{z===e&&(z=null)}),shell:()=>z}),iL="llvAttentionHandoff:";function i_(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 iF(e,t,n){let r=iL+t;try{let t=i_(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 iq(e,t){try{e?.removeItem(iL+t)}catch{}}function iz(e){return"region"===e.kind||"point"===e.kind}function iH(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 iU=e=>({x:e.x+e.w/2,y:e.y+e.h/2});function iB(e,t,n=[]){let r=iU(t),i=null;for(let t of e.named??[]){if(n.includes(t.key))continue;let e=iU(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 iK(e,t){return{project:e.project,rect:t,boardRevision:e.boardRevision}}let iY=()=>({resolution:"lost",frame:null,target:null,nearestAnchor:null,degraded:!1});function iW(e,t,n){if(!n)return iY();if(iz(e)){if(e.project!==n.project)return iY();let t="region"===e.kind?e.rect:{x:e.x-300,y:e.y-300,w:600,h:600};return{resolution:"exact",frame:iK(n,t),target:e,nearestAnchor:iB(n,t),degraded:!1}}let r=iH(e);for(let t of r){let r=n.rectFor(t);if(r)return{resolution:"exact",frame:iK(n,r),target:e,nearestAnchor:null,degraded:!1}}if(t&&t.project===n.project){let e=iU(t.rect);return{resolution:"approximate",frame:iK(n,t.rect),target:{kind:"point",project:n.project,x:e.x,y:e.y},nearestAnchor:iB(n,t.rect,r),degraded:!0}}return iY()}let iV=e=>new Promise(t=>{setTimeout(t,e)});function iJ(e){return iz(e.target)?e.target.project:e.frameAtCreation.project}function iG(e){return e&&e.project.length>0&&e.rect.w>0&&e.rect.h>0?e:null}async function iQ(e,t,n){return iX(e,n,e=>e.project===t)}async function iX(e,t,n){let r=t.timeoutMs??4e3,i=t.pollMs??40,a=t.sleep??iV,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=iJ(e),i=t.shell(),a="conversation"===e.target.kind;i&&i.project!==r&&(a?i.openConversation(r,null):i.openProject(r));let s=await iQ(t,r,n),l=iW(e.target,iG(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 iX(t,n,e=>e.project===r&&null!==e.index.rectFor(a))??s,l=iW(e.target,iG(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||iz(e))return[];var n=iH(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 i0(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 i1(e,t,n={}){let r=await i2(e,t,n);return r.moved&&!0!==r.aborted&&"conversation"===e.target.kind&&t.shell()?.recordFocusArrival?.(e.target.path,iJ(e)),r}async function i2(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===iJ(e)){let t=iW(e.target,iG(e.frameAtCreation),r.index);if(t.frame&&"lost"!==t.resolution&&i0(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??iV,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(i0(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 i5(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 iQ(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 i4(e){return`llv.attention.return-project.${e}`}function i3(e,t){if(!e||!t)return{};try{let n=e.getItem(i4(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 i6(e,t,n){if(e&&t)try{e.setItem(i4(t),JSON.stringify(n))}catch{}}function i8(e,t,n,r){let i=i3(e,t);delete i[n],i6(e,t,Object.fromEntries([...Object.entries(i),[n,r]].slice(-8)))}function i7(e,t,n){let r=i3(e,t);n in r&&(delete r[n],i6(e,t,r))}let i9=new Map;function ae(){let e=iS.getSlice(),t=e.camera;return{mode:e.mode,camera:t?{x:t.x,y:t.y,zoom:t.zoom}:null,focusedPath:e.focusedPath,project:iS.getContext().project}}function at(e){return e.ok||null!==e.refusal}function an(){try{return window.localStorage}catch{return null}}function ar(){let e=iS.getSlice();return{camera:e.camera,focusedPath:e.focusedPath}}let ai=e=>iS.subscribe(e);function aa({mobile:e,bus:t=iD,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(iI(an()))},[n]);let p=e?null:n??d,m=(0,Y.useSyncExternalStore)(ai,()=>iS.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??ar,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 i_(e?.getItem(iL+t)??null)?.viewport??null}catch{return null}}(h,e)??ae();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)(iE);(0,Y.useEffect)(()=>{m.current=a??iE},[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:i$,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()?(ng({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(i9.has(e.id))return;let r=new AbortController;i9.set(e.id,r),g.current.add(r);let i=!1;try{let a=await i1(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:at(s)||"lost"===a.resolution?iq(h,e.id):(i=!0,w.current.set(e.id,a.resolution))}finally{i9.get(e.id)===r&&i9.delete(e.id),g.current.delete(r),w.current.has(e.id)||b.current.delete(e.id),i||i7(an(),p,e.id)}},[y,t,p,l,h,x]),j=(0,Y.useCallback)(async e=>{let t=ae();(b.current.set(e.id,t),(await y.accept(e,"auto-follow")).ok)?(i8(an(),p,e.id,t.project),iF(h,e.id,()=>t),await k(e)):b.current.delete(e.id)},[y,p,k,h]),N=(0,Y.useCallback)(async e=>{if(ng({cue:"attention",eventId:`attention:${e.id}`}),i9.has(e.id))return;let t=iF(h,e.id,ae);b.current.set(e.id,t.viewport),i8(an(),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 i5(n,(r=an(),i=e.id,i3(r,p)[i]??null),t,l??{}))return}at(await y.goBack(e,"control"))&&(i7(an(),p,e.id),iq(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),iq(h,e.request.id);continue}C.current.add(e.request.id),(async()=>{try{let n=await y.arrive(e.request,t);if(!at(n))return;w.current.delete(e.request.id),b.current.delete(e.request.id),iq(h,e.request.id),n.ok||i7(an(),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)(iO,{onReturn:D,precise:P.returnAvailable,t:c}):null}var as=n(1012),al=n(6721),ao=n(233),ac=n(9375);function ad(e,t,n){return t in ac.en?e(t):n}function au(e,t){return ad(e,`roleCopy.${t}.name`,t)}function ap(e,t){return ad(e,`effortTier.${t}`,t)}function am(e,t,n,r=Date.now()/1e3){let i,a,s;if(null===eB(n,r))return null;let l=function(e,t,n,r){if(eU(n,r))return e("status.awaitingDecision");let i=n.pendingQuestion;return i?"plan"===i.kind?e("attention.decisionPlan"):i.questions?.[0]?.header?.trim()||e("attention.decisionQuestion"):n.rateLimit?eJ(e,t,n.rateLimit):e(n.waitingInput?"attention.decisionPermission":"status.stalled")}(e,t,n,r),o=(i=n.durableLineage,a=i?.memberships.findLast(e=>{let t=e.role.trim();return""!==t&&"agent"!==t}),(s=i?.role?.trim()||a?.role.trim())?au(e,s):null);return o?`${l} \xb7 ${o}`:l}function af({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)(as.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)(as.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)(al.A,{className:"h-4 w-4","aria-hidden":!0}):(0,U.jsxs)(U.Fragment,{children:[l("attention.next"),(0,U.jsx)(al.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)(ao.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})]})]})}function ah({item:e,onOpen:t}){let{t:n,locale:r}=(0,eh.Ym)();return(0,U.jsxs)("button",{type:"button","data-attention-row":e.id,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:t,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,tP.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,tP.rK)(e.since)})]}),(0,U.jsx)("span",{"data-attention-decision":!0,className:`w-full truncate text-[11px] ${"stalled"===e.tier?"text-warning":"text-muted"}`,children:am(n,r,e.file)??n("status.stalled")})]})}function ax({file:e,mobile:t,onOpen:n,onDismiss:r}){let{t:i,locale:a}=(0,eh.Ym)(),s=am(i,a,e)??i("viewer.agentWaiting");return t?(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","data-attention-toast":!0,children:[(0,U.jsxs)("button",{"data-attention-toast-open":!0,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:n,children:[(0,U.jsx)("span",{"data-attention-toast-title":!0,className:"block text-[11px] font-bold text-warning",children:s}),(0,U.jsx)("span",{className:"truncate text-[13px] font-semibold text-primary",children:e.title})]}),(0,U.jsx)("button",{"data-attention-toast-dismiss":!0,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":i("viewer.closeNotification"),onClick:r,children:(0,U.jsx)(K.A,{className:"h-5 w-5","aria-hidden":!0})})]}):(0,U.jsxs)("div",{"data-attention-toast":!0,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",{"data-attention-toast-open":!0,className:"min-w-0 flex-1 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:n,children:[(0,U.jsx)("span",{"data-attention-toast-title":!0,className:"block text-[11px] font-bold text-warning",children:s}),(0,U.jsx)("span",{className:"line-clamp-2",children:e.title})]}),(0,U.jsx)("button",{"data-attention-toast-dismiss":!0,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":i("viewer.closeNotification"),onClick:r,children:(0,U.jsx)(K.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})]})}let ag="llv-operator",ab="llv.operator.capability";var av=n(7542),aw=n(825),ay=n(1275),ak=n(744);function aj(e){let t=e.match(/^#a=(.+)$/);if(!t)return null;try{return decodeURIComponent(t[1])}catch{return t[1]}}let aN=[];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"),aN.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"),()=>{aN=aN.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||!(aN.length>0)||aN[aN.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 aC=0,aA=new Set;function aI(e){let t=Number.isFinite(e)&&e>0?e:0;if(t!==aC)for(let e of(aC=t,[...aA]))e()}function aM(){return aC}function aT(e){return aA.add(e),()=>{aA.delete(e)}}var aP=n(5775),a$=n(6565),aE=n(2125),aR=n(8962);function aO({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)(a$.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)(aE.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)(aR.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 aD=new Set;var aL=n(4088),a_=n(2363),aF=n(8135);let aq={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"},az=null;async function aH(){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 aU(e,t){let[n,r]=(0,Y.useState)(null);return(0,Y.useEffect)(()=>{let n=t?aq[t.toLowerCase()]??null:null;if(!n||e.length>5e4)return;let i=!1;return(!az&&(az=aH()),az).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 aB=/<span[^>]*>|<\/span>/g;function aK(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 aY({line:e,query:t}){let n=aK(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 aW({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=aU(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(aB))"</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 aK(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)(aL.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)(a_.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)(aF.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)(aY,{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 aV=(0,Y.lazy)(()=>n.e(8293).then(n.bind(n,8293))),aJ="llvPreviewWidth";function aG(){try{let e=window.localStorage.getItem(aJ),t=Number(e);if(Number.isFinite(t)&&t>=380)return t}catch{}return 560}function aQ({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}))},aD.add(e),()=>{aD.delete(e)}},[]),(0,Y.useEffect)(()=>{let e=()=>{let e=aj(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!==aj(window.location.hash)&&window.history.replaceState(window.history.state,"",window.location.pathname+window.location.search)},[]);return t?(0,U.jsx)(aX,{open:t,mobile:e,onClose:r,onReload:n},"sheet"):null}function aX({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)(aG),p=(0,Y.useSyncExternalStore)(aT,aM,()=>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,aM()))))},n=()=>{window.removeEventListener("pointermove",t),window.removeEventListener("pointerup",n),u(e=>{try{window.localStorage.setItem(aJ,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,ak.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)(av.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)(aW,{path:e.path,meta:s,mobile:t,onFailure:b},`${e.nonce}`):"image"===s.kind?(0,U.jsx)(aO,{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)(aV,{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,nA.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)(aw.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)(ay.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 aZ="llv.bridge.pendingAcks",a0=[],a1=!1;function a2(){if(!a1){a1=!0;try{let e=window.sessionStorage.getItem(aZ),t=e?JSON.parse(e):null;if(!Array.isArray(t))return;a0=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 a5(){try{window.sessionStorage.setItem(aZ,JSON.stringify(a0))}catch{}}function a4(e,t,n={}){if(!e||!t)return;a2();let r={waitingOn:e,ackToken:t,at:n.now??Date.now(),sessionId:n.sessionId??null};a0=[...a0.filter(t=>t.waitingOn!==e),r].slice(-32),a5()}function a3(e){return a2(),a0.find(t=>t.waitingOn===e)?.ackToken??null}function a6(){return a2(),a0.map(({waitingOn:e,ackToken:t,sessionId:n})=>({waitingOn:e,ackToken:t,sessionId:n}))}function a8(e){a2();let t=a0.filter(t=>t.waitingOn!==e);t.length!==a0.length&&(a0=t,a5())}let a7={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>{clearTimeout(e)}};class a9 extends Error{constructor(e,t){super(e),this.name="DeadlineExceededError",this.timeoutMs=t}}function se(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 st=Math.floor(1e4),sn=globalThis;function sr(){return sn.__llvRetiredBridgeSessions??=[]}function si(e){return sr().find(t=>t.sessionId===e)??null}function sa(e){return 401===e||403===e}async function ss(e,t,n,r){let i=function(e,t={}){let n,r=t.scheduler??a7,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 a9(t.reason??"deadline exceeded",e))},e))),{signal:i.signal,release:l}}(r.timeoutMs??8e3,{signal:r.signal??null,scheduler:r.scheduler??a7,reason:"bridge request deadline exceeded"});try{return await e(t,{...n,signal:i.signal})}finally{i.release()}}let sl={text:"",ackToken:"",commit:()=>void 0};async function so(e,t=fetch,n={}){if(!e)return;let r=await ss(t,"/api/bridge",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({ackToken:e})},n);if(!r.ok)throw new sc(r.status)}class sc extends Error{constructor(e){super(`bridge acknowledgement refused with ${e}`),this.name="BridgeAcknowledgementRefused",this.status=e}}function sd(e){return e instanceof sc&&409===e.status}async function su(e=fetch,t=()=>!0,n={}){for(let r of a6())if(t(r.waitingOn))try{await so(r.ackToken,e,n),a8(r.waitingOn)}catch(e){sd(e)&&a8(r.waitingOn)}}let sp=new Set,sm=new Map,sf=null,sh=null,sx=null;function sg(e,t){return e?.conversationId===t?.conversationId&&e?.phase===t?.phase}function sb(e){return sp.add(e),()=>sp.delete(e)}function sv(){return sh}function sw(){return sx}function sy(){return null}function sk(){return null}var sj=n(56);function sN(e=Date.now()){return(0,sj.ln)({context:iS.getContext(),slice:iS.getSlice(),cards:iS.getCards(),identity:iS.getIdentity(),revision:iS.getSelectionRevision(),now:e})}let sS=[];function sC(e){return e&&"object"==typeof e&&!Array.isArray(e)?e:null}function sA(e,t){let n=sC(e);return n&&"string"==typeof n[t]?n[t]:null}function sI(e){let t=sC(e.turn),n=sC(e.item),r=(Array.isArray(e.content)?e.content:Array.isArray(n?.content)?n.content:[]).map(e=>"string"==typeof e?e:sA(e,"text")??sA(e,"transcript")??"").join("");return(sA(e,"transcript")??sA(e,"text")??sA(e,"delta")??sA(t,"transcript")??sA(t,"text")??sA(n,"transcript")??sA(n,"text")??r).slice(0,12e3)}async function sM(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 sT(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 sT(n),e!==this.epoch)return;let a=n.localDescription?.sdp;if(!a)throw Error("The browser produced no WebRTC offer");let s=await sM(await fetch("/api/runtime/realtime",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"start",conversationId:this.conversationId,sdp:a,...iS.getIdentity()?{view:iS.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 sM(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=ra(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 sM(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)}}publishOperatorActivity(){let e;if(!this.realtimeSessionId)return;let t=JSON.stringify({action:"operatorActivity",conversationId:this.conversationId,realtimeSessionId:this.realtimeSessionId,operatorEventId:(e=new Uint8Array(32),crypto.getRandomValues(e),[...e].map(e=>e.toString(16).padStart(2,"0")).join(""))}),n=async e=>{try{await sM(await fetch("/api/runtime/realtime",{method:"POST",headers:{"content-type":"application/json"},body:t}))}catch{e>0&&await n(e-1)}};n(1)}publishSelectedContext(){if(!this.realtimeSessionId)return;let e=JSON.stringify({action:"selectedContext",conversationId:this.conversationId,realtimeSessionId:this.realtimeSessionId,selectedContext:sN()}),t=async n=>{try{!(await fetch("/api/runtime/realtime",{method:"POST",headers:{"content-type":"application/json"},body:e})).ok&&n&&await t(!1)}catch{n&&await t(!1)}};try{t(!0)}catch{}}acceptWireMessage(e){let t;if("string"!=typeof e)return;try{t=JSON.parse(e)}catch{return}let n=function(e){let t=sC(e);if(!t)return{kind:"ignored"};let n=sA(t,"type")??sA(t,"method")??"";if("input_transcript.added"===n){let e=sI(t);return e?{kind:"transcript",role:"user",text:e,final:!1}:{kind:"ignored"}}if("output_transcript.added"===n){let e=sI(t);return e?{kind:"transcript",role:"assistant",text:e,final:!1}:{kind:"ignored"}}if("turn.done"===n){let e,n=sI(t);return n?{kind:"transcript",role:"user"===(e=sA(t,"role")??sA(t.turn,"role")??sA(t.item,"role"))||"input"===e?"user":("assistant"===e,"assistant"),text:n,final:!0}:{kind:"ignored"}}if("delegation.created"===n){let e=sA(t.item,"id")??sA(t.delegation,"id")??sA(t,"delegation_item_id")??"";return e?{kind:"delegation",id:e}:{kind:"ignored"}}return"error"===n?{kind:"error",message:(sA(t,"message")??sA(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.publishOperatorActivity(),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 sM(await fetch("/api/runtime/realtime",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"status",conversationId:this.conversationId})})),n=sA(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(sm.get(e)!==t){sm.set(e,t),"idle"!==t&&(sf=e);let n=null;for(let[e,t]of sm)"idle"!==t&&(n={conversationId:e,phase:t});let r=n;if(!r&&sf&&(r={conversationId:sf,phase:sm.get(sf)??"idle"}),!(sg(r,sh)&&sg(n,sx)))for(let e of(sh=r,sx=n,sp))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 s$=new Map;function sE(e){let t=s$.get(e);if(t)return t;let n=new sP(e);return s$.set(e,n),n}function sR({resolveClient:e=sE}){let t=(0,Y.useSyncExternalStore)(sb,sv,sk),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??st,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??a7,m=s??Date.now,f=new AbortController,h=!1,x=!1,g=0,b=[],v=e=>{x||p.current.onState?.(e)},w=(e,t)=>ss(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 sc(n.status)},k=async e=>{let t=[...b.flatMap(e=>{let t=a3(e);return t?[{waitingOn:e,ackToken:t}]:[]}),...a6().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),a8(i.waitingOn),b=b.filter(e=>e!==i.waitingOn)}catch(e){if(e instanceof sc&&sa(e.status))return e.status;sd(e)&&(a8(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=si(e),s={sessionId:e,status:t,attempts:a=(i?.attempts??0)+1,nextAttemptAt:n+se(a,{baseMs:6e4,maxMs:9e5,jitter:.2,...r?{random:r}:{}})},(l=sr().filter(t=>t.sessionId!==e)).push(s),sn.__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=si(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(sa(c.status))return j(a,c.status);if(429===(t=c.status)||t>=500)return{kind:"retryable"};if(!c.ok)return{kind:"settled"};(n=sr().filter(e=>e.sessionId!==a)).length!==sr().length&&(sn.__llvRetiredBridgeSessions=n);let d=(await c.json()).plan;if(!d||x||e.realtimeSession()!==a)return{kind:"settled"};if("deliver"===d.kind)return a4(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 sc&&sa(e.status))return j(a,e.status);if(!sd(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 a9||"object"==typeof e&&null!==e&&"AbortError"===e.name)&&x?{kind:"idle"}:{kind:"retryable"}}finally{h=!1}if(!x){if("retryable"===t.kind){let t=se(g+=1,{baseMs:st,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||a3(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 sO=n(9992),sD=n(2298);let sL={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 s_({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?"":sL[e]} ${t}`,style:r,...a,children:i})}function sF(e){return String(Math.round(e/1048576*10)/10)}var sq=n(9554);function sz(e,t){return e.name||(0,eh.Tl)((0,eh.JK)(),"image"===t?"img.image":"attach.file")}function sH(e,t){let n=t.imageCapability??null,r=[],i=[],a=(e,t)=>{i.push({name:e,reason:t})},s=t.staged?.files??0,l=t.staged?.bytes??0,o=0,c=0;for(let i of e){let e=null!==(0,sq.PG)(i.type??"")?"image":"file",d=sz(i,e);if(0===i.size){a(d,(0,eh.Tl)((0,eh.JK)(),"attach.empty"));continue}if("image"===e){if(n&&!n.supported){a(d,n.reason??(0,eh.Tl)((0,eh.JK)(),"composer.structuredImagesUnavailable"));continue}let t=n?.maxRawBytesPerImage??sq.YP;if(i.size>t){a(d,n?(0,eh.Tl)((0,eh.JK)(),"img.structuredTooLarge",{max:sF(t)}):(0,eh.Tl)((0,eh.JK)(),"attach.tooLarge",{max:sF(t)}));continue}r.push({file:i,kind:e});continue}if(!t.acceptFiles){a(d,(0,eh.Tl)((0,eh.JK)(),"attach.imagesOnlyHere"));continue}if(i.size>0x1400000){a(d,(0,eh.Tl)((0,eh.JK)(),"attach.tooLarge",{max:sF(0x1400000)}));continue}if(s+o+1>5){a(d,(0,eh.Tl)((0,eh.JK)(),"attach.tooMany",{max:5}));continue}if(l+c+i.size>0x2800000){a(d,(0,eh.Tl)((0,eh.JK)(),"attach.aggregateTooLarge",{max:sF(0x2800000)}));continue}o+=1,c+=i.size,r.push({file:i,kind:e})}return{accepted:r,refusals:i}}function sU(e){let t=new Map;for(let{name:n,reason:r}of e){let e=t.get(r);e?e.push(n):t.set(r,[n])}return[...t].map(([e,t])=>(0,eh.Tl)((0,eh.JK)(),"attach.refused",{names:t.join(", "),reason:e})).join("\n")}let sB=0;function sK(){return sB+=1,`att-${Date.now().toString(36)}-${sB}`}function sY(e){if(e.ownsPreview&&e.preview)try{URL.revokeObjectURL?.(e.preview)}catch{}}function sW(e){return 4*Math.ceil(e/3)}function sV(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:sF(t.maxRawBytesPerImage)}):e.reduce((e,t)=>e+t.base64.length,0)>t.maxEncodedBytesPerRequest?(0,eh.Tl)((0,eh.JK)(),"img.structuredAggregateTooLarge",{max:sF(t.maxEncodedBytesPerRequest)}):null:t.reason??(0,eh.Tl)((0,eh.JK)(),"composer.structuredImagesUnavailable"):null}function sJ(e){let t=[];for(let n of e)"image"===n.kind&&"ready"===n.status&&n.base64&&t.push({id:n.id,base64:n.base64,mime:n.mime,preview:n.preview});return t}function sG(e){let t=[];for(let n of e)"file"===n.kind&&"ready"===n.status&&n.base64&&t.push({id:n.id,name:n.name,mime:n.mime,base64:n.base64});return t}function sQ({attachments:e,onRemove:t,onRetry:n,onClearAll:r}){let{t:i}=(0,eh.Ym)(),a=ib();if(!e.length)return null;let s=e.filter(e=>"ready"===e.status).length,l=e.some(e=>"file"===e.kind),o=i(l?"composer.attachmentsCount":"composer.imagesCount",{count:s||e.length}),c=e.length>=2?(0,U.jsxs)("button",{type:"button",onClick:r,"aria-label":i(l?"attach.clearAllAria":"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)(sO.TB,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",i("img.clearAll")]}):null,d=(0,U.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1 text-[10.5px] font-semibold text-muted",children:[o," ",(0,U.jsx)(sO.Qp,{className:"h-3 w-3","aria-hidden":!0})," ",i("img.deliveryHint")]});return a?(0,U.jsxs)("div",{"data-testid":"attachment-tray","aria-label":o,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)(s1,{attachment:e,index:r,onRemove:t,onRetry:n},e.id)),c]}):(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)(s2,{attachment:e,index:r,onRemove:t,onRetry:n},e.id)),d,c]})}function sX(e,t,n){return"file"===e.kind?{reading:t("attach.readingAria",{name:e.name}),remove:t("attach.removeAria",{name:e.name}),retry:t("attach.retryAria",{name:e.name})}:{reading:t("img.readingAria",{n:n+1}),remove:t("img.removeAria",{n:n+1}),retry:t("img.retryAria",{n:n+1})}}function sZ(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":sX(e,t,n).reading,children:(0,U.jsx)(sO.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 s0({attachment:e,index:t}){let{t:n}=(0,eh.Ym)();return"file"===e.kind?(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)(sO.iU,{className:"h-4 w-4"})}):"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)(sO.xf,{className:"h-4 w-4"})})}function s1({attachment:e,index:t,onRemove:n,onRetry:r}){let{t:i}=(0,eh.Ym)(),a=sX(e,i,t);return(0,U.jsxs)("div",{className:`relative flex h-12 shrink-0 flex-col ${"file"===e.kind?"w-auto max-w-[10rem]":"w-12"}`,"data-testid":"attachment-tile","data-status":e.status,"data-kind":e.kind,children:[(0,U.jsxs)("span",{className:`relative flex h-12 items-center gap-1.5 ${"file"===e.kind?"min-w-0 rounded border border-border bg-sunken pl-1.5 pr-7":"w-12"}`,children:[(0,U.jsxs)("span",{className:`relative shrink-0 ${"file"===e.kind?"h-8 w-8":"h-12 w-12"}`,children:[(0,U.jsx)(s0,{attachment:e,index:t}),sZ(e,i,t)]}),"file"===e.kind?(0,U.jsx)("span",{className:"min-w-0 truncate text-[11px] font-semibold text-secondary",title:e.name,children:e.name}):null]}),(0,U.jsx)("button",{type:"button",onClick:()=>n(e.id),"aria-label":a.remove,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)(sO.X,{className:"h-3 w-3","aria-hidden":!0})}),"error"===e.status?(0,U.jsxs)("button",{type:"button",onClick:()=>r(e.id),"aria-label":a.retry,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)(sO.kt,{className:"h-3 w-3","aria-hidden":!0})," ",i("img.retry")]}):null]})}function s2({attachment:e,index:t,onRemove:n,onRetry:r}){let{t:i}=(0,eh.Ym)(),a=sX(e,i,t);return"file"===e.kind?(0,U.jsxs)("div",{className:"group/img relative flex h-10 max-w-[12rem] items-center gap-1.5 rounded border border-border bg-sunken pl-1.5 pr-2","data-testid":"attachment-tile","data-status":e.status,"data-kind":"file",children:[(0,U.jsxs)("span",{className:"relative h-6 w-6 shrink-0",children:[(0,U.jsx)(s0,{attachment:e,index:t}),sZ(e,i,t)]}),(0,U.jsx)("span",{className:"min-w-0 truncate text-[10.5px] font-semibold text-secondary",title:e.name,children:e.name}),"error"===e.status?(0,U.jsx)("button",{type:"button",onClick:()=>r(e.id),"aria-label":a.retry,className:"shrink-0 text-warning focus-visible:outline-none",children:(0,U.jsx)(sO.kt,{className:"h-3 w-3","aria-hidden":!0})}):null,(0,U.jsx)("button",{type:"button",onClick:()=>n(e.id),"aria-label":a.remove,className:"shrink-0 text-muted hover:text-danger focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:(0,U.jsx)(sO.X,{className:"h-3 w-3","aria-hidden":!0})})]}):(0,U.jsxs)("div",{className:"group/img relative h-10 w-10","data-testid":"attachment-tile","data-status":e.status,"data-kind":"image",children:[(0,U.jsx)(s0,{attachment:e,index:t}),sZ(e,i,t),(0,U.jsx)("button",{type:"button",onClick:()=>n(e.id),"aria-label":a.remove,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)(sO.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":a.retry,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)(sO.kt,{className:"h-2.5 w-2.5","aria-hidden":!0})}):null]})}function s5({onFiles:e,ariaLabel:t,className:n,disabled:r=!1,disabledReason:i,acceptFiles:a=!1}){let s=(0,Y.useRef)(null);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("input",{ref:s,type:"file",...a?{}:{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:()=>s.current?.click(),className:n,children:a?(0,U.jsx)(sO.xv,{className:"h-4 w-4","aria-hidden":!0}):(0,U.jsx)(sO.xf,{className:"h-4 w-4","aria-hidden":!0})})]})}async function s4(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 s3(e,t){return t?Math.min(e,Math.round(t.height*t.scale)):e}function s6(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 s8(e){return`${Math.floor(e/60)}:${String(e%60).padStart(2,"0")}`}function s7(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 s9(e){return Math.min(60,Math.floor(e/2))}let le=null,lt=null,ln=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 lr(){lt||le&&le.expiresAt>Date.now()||(lt=ln().then(e=>(lt=null,le={token:e,expiresAt:Date.now()+(e?45e3:15e3)},e)))}let li=async()=>{let e=lt;if(e){let t=await e;return t&&(le=null),t}let t=le;return t&&t.expiresAt>Date.now()?(t.token&&(le=null),t.token):(le=null,ln())};function la({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}}),li()]);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=s7(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(s7(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-s9(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&&tU("dictWarn",0),o.capped&&(A(),u(!0),m(r("dictation.capStopped")),tU("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 ls(e){window.addEventListener("resize",e);let t=window.visualViewport;return t?.addEventListener("resize",e),()=>{window.removeEventListener("resize",e),t?.removeEventListener("resize",e)}}function ll(){return(0,Y.useSyncExternalStore)(ls,()=>{var e;return Math.max(0,(e=window.innerHeight)-s3(e,window.visualViewport))},()=>0)}function lo({initialText:e,persistText:t,submit:n,disabled:r=!1,imageCapability:i=null,acceptFiles:a=!1,holdInputWhileBusy:s=!0}){let[l,o]=(0,Y.useState)(e),c=(0,Y.useRef)(l),d=e=>{let n="function"==typeof e?e(c.current):e;c.current=n,o(n),t(n)},[u,p]=(0,Y.useState)(!1),[m,f]=(0,Y.useState)(!1),[h,x]=(0,Y.useState)(null),g=(0,Y.useRef)(null),b=(0,Y.useRef)(d);(0,Y.useLayoutEffect)(()=>{b.current=d});let v=(0,Y.useRef)(null),w=(0,Y.useCallback)(e=>{if(v.current?.(),v.current=null,g.current=e,!e)return;let t=!1,n=()=>{t=!0},r=()=>{t&&b.current(e.value)},i=()=>{t=!1,b.current(e.value)};e.addEventListener("compositionstart",n),e.addEventListener("input",r),e.addEventListener("compositionend",i),v.current=()=>{e.removeEventListener("compositionstart",n),e.removeEventListener("input",r),e.removeEventListener("compositionend",i)}},[]),y=ib(),k=(0,Y.useSyncExternalStore)(ls,()=>s3(window.innerHeight,window.visualViewport),()=>800),j=y?Math.max(44,Math.min(Math.max(160,Math.round(.4*k)),k-156)):160,N=function(e){let[t,n]=(0,Y.useState)([]),r=(0,Y.useRef)([]),i=(0,Y.useRef)([]),a=(0,Y.useRef)([]),s=(0,Y.useRef)(!1),l=e.imageCapability??null,o=!0===e.acceptFiles;(0,Y.useEffect)(()=>(s.current=!1,()=>{for(let e of(s.current=!0,r.current))sY(e);r.current=[],i.current=[],a.current=[]}),[]);let c=e=>{s.current||(r.current=e,i.current=sJ(e),a.current=sG(e),n(e))},d=(e,t)=>{c(r.current.map(n=>n.id===e?t(n):n))},u=(0,Y.useMemo)(()=>sJ(t),[t]),p=(0,Y.useMemo)(()=>sG(t),[t]),m=t=>{let n=sV(t,l);return!n||(e.onError(n),!1)},f=(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;if(!n.base64){let n=sU([{name:i.name||sz(i.file,i.kind),reason:(0,eh.Tl)((0,eh.JK)(),"attach.empty")}]);e.onError(n),d(t,e=>({...e,status:"error",base64:void 0,error:n}));return}if("file"===i.kind)return void d(t,e=>({...e,status:"ready",base64:n.base64}));let a=[...sJ(r.current.filter(e=>e.id!==t)),{id:t,base64:n.base64,mime:n.mime,preview:i.preview||n.dataUrl}];if(sV(a,l)){e.onError(sV(a,l)),d(t,e=>({...e,status:"error",error:(0,eh.Tl)((0,eh.JK)(),"img.error")}));return}d(t,e=>({...e,status:"ready",base64:n.base64,mime:n.mime,preview:e.preview||n.dataUrl}))},e=>{let n=r.current.find(e=>e.id===t);n&&d(t,t=>({...t,status:"error",error:e instanceof Error?e.message:(0,eh.Tl)((0,eh.JK)(),"file"===n.kind?"attach.error":"img.error")}))})},h=()=>{for(let e of r.current)sY(e);c([])},x=t.some(e=>"reading"===e.status),g=t.some(e=>"error"===e.status),b=t.some(e=>"file"===e.kind);return{attachments:t,images:u,files:p,hasFiles:b,acceptsFiles:o,imagesRef:i,filesRef:a,hasReading:x,hasError:g,addFiles:t=>{if(!t.length)return;let n=r.current.filter(e=>"file"===e.kind&&"error"!==e.status),i=sH(t,{acceptFiles:o,imageCapability:l,staged:{files:n.length,bytes:n.reduce((e,t)=>e+t.file.size,0)}}),a=i.accepted,s=[...i.refusals],d=()=>!!s.length&&(e.onError(sU(s)),!0),u=a.filter(e=>"image"===e.kind);if(l&&u.length){let e=r.current.filter(e=>"image"===e.kind&&"error"!==e.status),t=e.reduce((e,t)=>e+(t.base64?.length??sW(t.file.size)),0)+u.reduce((e,t)=>e+sW(t.file.size),0),n=e.length+u.length>l.maxImages?(0,eh.Tl)((0,eh.JK)(),"img.tooManyStructured",{max:l.maxImages}):t>l.maxEncodedBytesPerRequest?(0,eh.Tl)((0,eh.JK)(),"img.structuredAggregateTooLarge",{max:sF(l.maxEncodedBytesPerRequest)}):null;if(n){for(let e of u)s.push({name:sz(e.file,"image"),reason:n});a=a.filter(e=>"image"!==e.kind)}}if(!a.length)return void d();let p=a.map(({file:e,kind:t})=>{let{preview:n,ownsPreview:r}="image"===t?function(e){try{let t=URL.createObjectURL;if("function"==typeof t)return{preview:t(e),ownsPreview:!0}}catch{}return{preview:"",ownsPreview:!1}}(e):{preview:"",ownsPreview:!1};return{id:sK(),kind:t,status:"reading",name:sz(e,t),mime:e.type||("image"===t?"image/png":"application/octet-stream"),preview:n,file:e,ownsPreview:r}});for(let t of(c([...r.current,...p]),d()||e.onAdded?.(),p))f(t.id,t.file)},remove:e=>{let t=r.current.find(t=>t.id===e);t&&sY(t),c(r.current.filter(t=>t.id!==e))},retry:e=>{let t=r.current.find(t=>t.id===e);t&&"error"===t.status&&(d(e,e=>({...e,status:"reading",error:void 0})),f(e,t.file))},clearAll:h,settleDelivered:(e,t=[])=>{let n=[...r.current],i=!1;for(let t of e){let e=t.id?n.findIndex(e=>e.id===t.id):n.findIndex(e=>"image"===e.kind&&"ready"===e.status&&e.base64===t.base64&&e.mime===t.mime);if(e<0)continue;let[r]=n.splice(e,1);r&&sY(r),i=!0}for(let e of t){let t=n.findIndex(t=>"file"===t.kind&&t.id===e.id);t<0||(n.splice(t,1),i=!0)}i&&c(n)},clear:h,replace:(e,t=[])=>{if(!m(e))return!1;for(let e of r.current)sY(e);return c([...e.map(e=>({id:e.id??sK(),kind:"image",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})),...t.map(e=>{let t=e.name||(0,eh.Tl)((0,eh.JK)(),"attach.file");return{id:e.id??sK(),kind:"file",status:"error",name:t,mime:e.mime||"application/octet-stream",preview:"",error:sU([{name:t,reason:(0,eh.Tl)((0,eh.JK)(),"attach.notRestored")}]),file:new File([],t,{type:e.mime||"application/octet-stream"}),ownsPreview:!1}})]),!0},validate:()=>m(i.current)}}({onError:e=>x({kind:"err",text:e}),onAdded:()=>x(null),imageCapability:i,acceptFiles:a}),S=e=>{d(t=>t?t.trimEnd()+" "+e:e),x(null),requestAnimationFrame(()=>{let e=g.current;if(!e)return;e.focus();let t=e.value.length;e.setSelectionRange(t,t),e.scrollTop=e.scrollHeight})},C=la({onError:e=>x({kind:"err",text:e}),onUnclaimedText:S,onLiveCommit:S}),A=C.liveText?(l?l.trimEnd()+" ":"")+C.liveText:l;s6(g,A,{maxPx:j,pinned:!!C.liveText});let I="rec"===C.phase,M="busy"===C.phase,T=s&&u||m||r,P=N.hasReading||N.hasError,$=!T&&!M&&!P&&(I||!!l.trim()||N.images.length>0||N.files.length>0);return{text:l,textRef:c,setText:d,setTextState:o,displayText:A,inputRef:g,attachInput:w,status:h,setStatus:x,busy:u,setBusy:p,voiceSending:m,dictation:C,attachments:N,insertSpoken:S,stopAndSend:()=>s4({busy:u,voiceSending:m,setVoiceSending:f,stop:C.stop,currentText:()=>c.current,setText:d,submit:n}),submit:n,dictationRecording:I,dictationBusy:M,fieldsDisabled:T,canSend:$,attachmentsBlocked:P}}let lc={phase:"idle",lines:[],error:null,startedAt:null,micMuted:!1,outputMuted:!1},ld=new Set,lu={store:rl(),connection:"offline",resyncedAt:null,lastEventAt:null,enabled:!1,structuredHostsEnabled:!1},lp=[];function lm(e,t,n=Object.is){let r=ry()&&1?rj():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 lf(){let e,t,n,r=(e=ry()&&1?rj():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():lu,[e]),(0,Y.useSyncExternalStore)(t,n,()=>lu));return{enabled:r.enabled,structuredHostsEnabled:r.structuredHostsEnabled,connection:r.connection,resyncedAt:r.resyncedAt,store:r.store}}function lh(){return lm(e=>e.enabled,!1)}function lx(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 lg(e,t,n){var r,i;let a=lv(e.store.sessions,t,n);return a?(r=e.store,i=e.structuredHostsEnabled,{session:a,uiState:ru(a,rp(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 lb(e){return lm(t=>lg(t,e,null),null,lx)}function lv(e,t,n){return t&&e[t]?e[t]:n?Object.values(e).find(e=>e.artifactPath===n)??null:null}function lw(e){return lm(t=>t.enabled&&e?t.store.flows[e]??null:null,null)}async function ly(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 lk(){return ry()?rj().refresh():Promise.resolve(!1)}let lj=new Set,lN=null,lS=!1,lC=!1,lA=!1;async function lI(){if(0!==lj.size){if(lS){lC=!0;return}lS=!0;try{let e=[...lj];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];lj.has(t)&&(a?t.onTarget({transportError:!0}):Object.prototype.hasOwnProperty.call(i,String(e))&&t.onTarget(i[String(e)]??null))}}}finally{lS=!1,lC&&(lC=!1,lI())}}}let lM="default",lT=/[/\\]accounts[/\\](?:claude|codex)[/\\]([^/\\]+)[/\\]/;function lP(e){if(!e)return lM;let t=lT.exec(e);return t?t[1]:lM}let l$={requested:"switching","waiting-turn":"pending",preparing:"switching","successor-starting":"switching",verifying:"switching",committed:"done","failed-recoverable":"failed","rolled-back":"rolled-back"};function lE(e){return e?l$[e.phase]??null:null}function lR(e){let t=e?.targetLabel?.trim();return t?t:e?.targetAccountId?.trim()||null}function lO(e,t){if(!e)return null;let n=lE(e);if("pending"!==n&&"switching"!==n)return e;let r=e.targetAccountId?.trim();return r&&t&&r===t?null:e}function lD(e){return"pending"===e||"switching"===e}function lL(e){return e&&"object"==typeof e&&!Array.isArray(e)?e:null}function l_(e,t=0){return"number"==typeof e&&Number.isFinite(e)?e:t}function lF(e){return"string"==typeof e?e:null}let lq=new Set(["draining","stopped","complete"]),lz=new Set(["disabled","idle","waiting-fresh","cooldown","draining"]);async function lH(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:lF(i?.error)}}catch{return{ok:!1,error:null}}}async function lU(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=lF(r?.reseat),a=lF(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:lF(r?.error)}}catch{return{ok:!1,state:"failed",phase:null,error:null}}}var lB=n(846);function lK({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 lY({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)(sO.Jl,{className:"h-3 w-3 text-success","aria-hidden":!0}):(0,U.jsx)(sO.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)(sO.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)(sO.kr,{className:"h-3.5 w-3.5 animate-spin text-muted","aria-hidden":!0}):t?(0,U.jsx)(sO.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 lW({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=ib(),[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-s9(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:s8(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?`−${s8(r)}`:s8(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)(sO.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)(sO.kr,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):(0,U.jsx)(sO.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:lr,onFocus:lr,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)(sO.kr,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):"starting"===e?(0,U.jsx)(sO.GO,{className:"h-4 w-4 animate-pulse motion-reduce:animate-none","aria-hidden":!0}):(0,U.jsx)(sO.GO,{className:"h-4 w-4","aria-hidden":!0})}),h?(0,U.jsx)(lY,{onClose:()=>x(!1)}):null]})}let lV=[];function lJ({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)(sO.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 lG({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,onAttachFiles:m,imageDisabled:f=!1,imageDisabledReason:h,sendDisabledReason:x,onSendBlockedRecover:g,sendPayloadAvailable:b=!1,receipts:v,history:w=lV,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=ib(),[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(I.hasFiles?"attach.blockedReading":"img.blockedReading"):I.hasError?q(I.hasFiles?"attach.blockedFailed":"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)(lK,{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)(lB.A,{className:"h-4 w-4","aria-hidden":!0})})}):null,y,(0,U.jsx)(lW,{...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)(lK,{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)(sO.kr,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):(0,U.jsx)(sO.jG,{className:"h-4 w-4","aria-hidden":!0})})}),H&&Z&&d?(0,U.jsx)(lJ,{label:d,actions:u,onClose:()=>B(!1)}):null]})]});return(0,U.jsxs)(U.Fragment,{children:[k,z&&!m?(0,U.jsx)(sQ,{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:lr,onPaste:e=>{let t=Array.from(e.clipboardData.items).filter(e=>"string"!==e.kind).map(e=>e.getAsFile()).filter(e=>null!==e);t.length&&(e.preventDefault(),(m??I.addFiles)(t))},onDragOver:e=>{Array.from(e.dataTransfer.items).filter(e=>"file"===e.kind).length&&(e.preventDefault(),e.dataTransfer.dropEffect="copy")},onDrop:e=>{let t=Array.from(e.dataTransfer.files);t.length&&(e.preventDefault(),e.stopPropagation(),(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)(lK,{label:r,children:(0,U.jsx)(s5,{acceptFiles:I.acceptsFiles,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&&!I.acceptsFiles,disabledReason:h})}):null]}):null,z||m?null:(0,U.jsx)(sQ,{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",{"data-testid":"composer-status",role:"status","aria-live":"err"===L.kind?"assertive":"polite",className:`block max-h-24 overflow-y-auto whitespace-pre-line break-words 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 lQ=(e,t)=>(0,eh.Tl)((0,eh.JK)(),e,t);function lX({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=lQ("selectedContext.ariaSelected",{name:r,project:e.project??"—"}),a=t?`${i} — ${lQ("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)(sO.kU,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),(0,U.jsx)("span",{className:"min-w-0 truncate",children:r})]})}function lZ(e){return!(!e||"object"!=typeof e||Array.isArray(e))&&"string"==typeof e.conversationId&&Number.isInteger(e.generation)&&e.generation>0}function l0(e,t){return lZ(e)&&e.conversationId===t.conversationId&&e.generation===t.generation}function l1(e){return"queued"===e||void 0}function l2(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 l5=new Map,l4=new Set,l3=[],l6=new Map,l8=[],l7=new Map,l9=[],oe=new Map;function ot(e,t){return e.at!==t.at?e.at-t.at:e.id<t.id?-1:+(e.id>t.id)}function on(e,t){return(e.retiredAt??e.at)-(t.retiredAt??t.at)||ot(e,t)}function or(e){return[...e.filter(e=>!e.retiredEchoId).sort(ot).slice(0,512),...e.filter(e=>!!e.retiredEchoId).sort(on).slice(-512)].sort(ot)}function oi(e){return!(!e||"object"!=typeof e||Array.isArray(e))&&"string"==typeof e.id&&"string"==typeof e.text&&"number"==typeof e.at}function oa(e){return!(!e||"object"!=typeof e||Array.isArray(e))&&"string"==typeof e.id&&"string"==typeof e.key}function os(e){if(oe.has(e))return oe.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 oe.set(e,n),n}catch{return oe.set(e,null),null}}function ol(e,t){oe.set(e,t);try{if(t)sessionStorage.setItem("llvOutboxCurrentLaunch:"+e,JSON.stringify(t));else sessionStorage.removeItem("llvOutboxCurrentLaunch:"+e)}catch{}}function oo(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 oc(e,t){ol(e,oo(os(e),t))}function od(e,t){let n=os(e);n&&n.id!==t.id||oc(e,t)}function ou(e,t){return e.terminalReason?e.terminalReason:void 0!==e.settledAt&&t-e.settledAt>=6e5?"delivered-ttl":void 0}function op(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":ou({settledAt:r},n),a={id:t.id,at:t.at,...void 0!==r?{settledAt:r}:{}};i?od(e,{...a,terminalReason:i,retiredAt:"response-started"===i?t.responseStartedAt:(r??t.at)+6e5}):oc(e,a)}function om(e){let t=l6.get(e);if(t)return t;try{let t=JSON.parse(sessionStorage.getItem("llvOutboxEchoes:"+e)??"[]"),n=Array.isArray(t)?t.filter(oa).slice(-512):l8;return l6.set(e,n),n}catch{return l6.set(e,l8),l8}}function of(e,t){l6.set(e,t);try{if(t.length)sessionStorage.setItem("llvOutboxEchoes:"+e,JSON.stringify(t));else sessionStorage.removeItem("llvOutboxEchoes:"+e)}catch{}}function oh(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 ox(e){let t=l7.get(e);if(t)return t;try{let t=JSON.parse(sessionStorage.getItem("llvOutboxOccurrences:"+e)??"[]"),n=Array.isArray(t)?or(t.filter(oh)):l9;return l7.set(e,n),n}catch{return l7.set(e,l9),l9}}function og(e,t){let n=or(t);l7.set(e,n);try{if(n.length)sessionStorage.setItem("llvOutboxOccurrences:"+e,JSON.stringify(n));else sessionStorage.removeItem("llvOutboxOccurrences:"+e)}catch{}}function ob(e,t){l5.set(e,t);try{if(t.length)sessionStorage.setItem("llvOutbox:"+e,JSON.stringify(t));else sessionStorage.removeItem("llvOutbox:"+e)}catch{}for(let e of l4)e()}function ov(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 or([...n.values()])}function ow(e){if("delivered"!==e.state&&void 0===e.responseStartedAt&&!e.retiredEchoId)return null;let t=oA(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 oy(e,t){let n=Math.max(0,t.length-32);if(n>0){for(let r of t.slice(0,n))op(e,r);let r=t.slice(0,n).map(ow).filter(e=>null!==e);r.length&&og(e,ov(ox(e),r))}ob(e,t.slice(-32))}function ok(e){let t=l5.get(e);if(t)return t;let n=function(e){try{let t=JSON.parse(sessionStorage.getItem("llvOutbox:"+e)??"[]");if(!Array.isArray(t))return l3;return t.filter(oi).slice(-32).map(e=>{let t=function(e){let t=e.owner;if(void 0===t||lZ(t))return e;let n={...e};return delete n.owner,n}(e),n="number"==typeof t.images?t.images:0,r="number"==typeof t.files?t.files:0,i={...t,images:n};if(r?i.files=r:delete i.files,t.launchOwned)return i;let a="delivering"===t.state||"queued"===t.state;return a&&n+r>0?{...i,state:"failed",needsReattach:!0}:{...i,state:a?"queued":t.state}})}catch{return l3}}(e);return l5.set(e,n),n}function oj(e,t){if(!t.text.trim()&&!t.images)return;let n=os(e);if(n?.id===t.id){let t=ou(n,Date.now());if(t&&!n.terminalReason&&od(e,{...n,terminalReason:t,retiredAt:(n.settledAt??n.at)+6e5}),n.retiredEchoId||t)return}let r=ok(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&&!l0(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)&&ob(e,r.map(e=>e.id===t.id?l:e)),op(e,l),l.retiredEchoId&&od(e,{id:t.id,at:t.at,retiredEchoId:l.retiredEchoId,...void 0!==l.retiredAt?{retiredAt:l.retiredAt}:{}}),l.echoText!==i.echoText&&oE(e,om(e));return}let s=ox(e).find(e=>e.id===t.id&&e.retiredEchoId);if(s?.retiredEchoId)return void oc(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;oc(e,{id:t.id,at:t.at,..."delivered"===c?{settledAt:o??t.at}:{}}),oy(e,[...r,{...t,state:c,..."delivered"===c?{settledAt:o??t.at}:{},launchOwned:!0}]),oE(e,om(e))}function oN(e,t,n){let r=ok(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&&op(e,a),ob(e,i)}function oS(e,t){let n=ok(e),r=n.filter(e=>e.id!==t);r.length!==n.length&&ob(e,r)}function oC(e,t){if(e===t)return;let n=os(e);n&&(ol(t,oo(os(t),n)),ol(e,null));let r=ox(e);r.length&&(og(t,ov(ox(t),r)),og(e,l9));let i=om(e);if(i.length){let n=om(t),r=new Map(i.map(e=>[e.id,e]));for(let e of n)r.delete(e.id),r.set(e.id,e);of(t,[...r.values()].slice(-512)),of(e,l8)}let a=ok(e);if(a.length){let n=new Map(ok(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})}oy(t,[...n.values()].sort((e,t)=>e.at-t.at)),ob(e,l3)}oE(t,om(t))}function oA(e){return e.trim()}let oI=new Map,oM=new Set,oT=new Map;function oP(e){let t=new Map;for(let n of e)t.set(n.key,(t.get(n.key)??0)+1);return t}function o$(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 oE(e,t){let n=ok(e),r=ox(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:oA(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&&og(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=oA(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&&od(e,{id:t.id,at:t.at,retiredEchoId:t.retiredEchoId,retiredAt:t.retiredAt});for(let t of u)t.launchOwned&&t.retiredEchoId&&od(e,{id:t.id,at:t.at,retiredEchoId:t.retiredEchoId,retiredAt:t.retiredAt});d&&ob(e,u)}function oR(e){return l4.add(e),()=>{l4.delete(e)}}function oO(e){return(0,Y.useSyncExternalStore)(oR,()=>ok(e),()=>l3)}function oD({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 oL extends Error{constructor(){super("composer admission timed out"),this.name="ComposerAdmissionTimeoutError"}}async function o_({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 oq="gpt-5.6-sol",oz="gpt-5.6-terra",oH="gpt-5.6-luna",oU=new Set([oq,oz,oH,"gpt-5.5","gpt-5.4","gpt-5.4-mini"]);function oB(e){return!e?.trim()||oU.has(e.trim())}let oK={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:oq,label:"GPT-5.6-Sol",shortLabel:"5.6-Sol",use:"review"},{id:oz,label:"GPT-5.6-Terra",shortLabel:"5.6-Terra",use:"implement"},{id:oH,label:"GPT-5.6-Luna",shortLabel:"5.6-Luna",use:"general"}]};function oY(e){return"codex"===e?oq:"opus"}let oW=["fable","opus","sonnet","haiku"];function oV(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 oW)if(t===e||RegExp(`(?:^|[-_.])${e}(?:[-_.]|$)`).test(t))return e;return null}let oJ=0,oG=new Set;function oQ(e,t){let n={id:++oJ,kind:e,text:t};for(let e of oG)e(n)}function oX(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,tP.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 oZ(){let e=ib(),[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 oG.add(e),()=>{oG.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)(sO.X,{className:e?"h-4 w-4":"h-3 w-3","aria-hidden":!0})})]},t.id))}):null}function o0(e){return`llvAgentRuntime:${W(e)}`}function o1(e){return o0(e)+":phase"}function o2(e){return o1(e)+":operation"}function o5(e){return o1(e)+":rollback"}function o4(e){return o0(e)+":resume"}function o3(e){return o0(e)+":profile"}function o6(e){let t=e.engine,n=oK[t],r="claude"===e.engine?oV(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 o8(e){return function(e,t){let n=o6(e);try{let r=JSON.parse(localStorage.getItem(t)??"null");if(!r)return null;let i=e.engine,a=oK[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,o4(e))}function o7(e){try{var t,n;let r=JSON.parse(localStorage.getItem(o3(e))??"null");if(!r||"object"!=typeof r)return null;let i=e.engine,a={};oK[i].some(e=>e.id===r.model)&&(a.model=r.model);let s=(0,oF.ve)(i,a.model??(t=e,n=r,oK[t.engine].some(e=>e.id===n.model)?n.model:o6(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 o9(e,t){let n={...o7(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(o3(e),JSON.stringify(n))}catch{}return n}function ce(e){let t=o6(e),n=o7(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 ct(e){try{let t=JSON.parse(localStorage.getItem(o5(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 cn(e,t){try{localStorage.setItem(o5(e),JSON.stringify(t))}catch{}}let cr={minimal:"reasoningTier.minimal",low:"reasoningTier.low",medium:"reasoningTier.medium",high:"reasoningTier.high",xhigh:"reasoningTier.xhigh",max:"reasoningTier.max",ultra:"reasoningTier.ultra"};function ci(e,t){let n=cr[t];return n?e(n):t}function ca(e,t){return oK[e].find(e=>e.id===t)?.label??t}function cs({file:e,surface:t,runtimeSettings:n,runtimeSession:r}){var i;let{t:a}=(0,eh.Ym)(),s=ib(),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?o6(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=o6(e);try{let n=JSON.parse(localStorage.getItem(o0(e))??"null"),r=e.engine,i=oK[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(o1(e));g.current=localStorage.getItem(o2(e)),b.current=ct(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??ct(e);t&&n?.operationId!==t||(b.current=null,localStorage.removeItem(o5(e)))},[e]),$=(0,Y.useCallback)(t=>{u.current=t.draft,d(t.draft);try{localStorage.setItem(o0(e),JSON.stringify(t.draft)),t.profile?localStorage.setItem(o3(e),JSON.stringify(t.profile)):localStorage.removeItem(o3(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},cn(e,b.current));let c="structured"===o||"pending"===i.outcome?"pending":"confirming";localStorage.setItem(o1(e),c),g.current?localStorage.setItem(o2(e),g.current):localStorage.removeItem(o2(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)},cn(e,b.current)),localStorage.setItem(o1(e),"pending"),localStorage.setItem(o2(e),t.operationId),m("pending");return}let n=g.current,i=localStorage.getItem(o1(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(o1(e)),localStorage.removeItem(o2(e)),"applied"===l.status)P(l.operationId),g.current=null,m("applied"),n&&oQ("ok",a("runtimeConfig.applied"));else if("failed"===l.status||"rejected"===l.status){let t=b.current??ct(e);t?.operationId===l.operationId&&$(t),g.current=null,m("error"),h(l.reason??a("runtimeConfig.failed")),n&&oQ("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?oV(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(o1(e)),localStorage.removeItem(o2(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?o6(e):c;if("resume"===o)return o8(e)??o6(e);return ce(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?ca(l,e.model):e.model,effort:ci(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(o1(e)),localStorage.removeItem(o2(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:o7(e)};b.current=c,cn(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(o0(e),JSON.stringify(m))}catch{}F(m),"structured"===o&&o9(e,t),E(m);return}"resume"===o?F(function(e,t){let n=e.engine,r={...o8(e)??o6(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(o4(e),JSON.stringify(r))}catch{}return r}(e,t)):(o9(e,t),F(ce(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,oK[l].find(e=>e.id===i)?.shortLabel??i),J=ci(a,O.effort),G=`${a("composer.runtimePill")} — ${ca(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)(sO.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)(sO.kr,{className:"h-3 w-3 shrink-0 animate-spin motion-reduce:animate-none","aria-hidden":!0}):(0,U.jsx)(sO.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)(cl,{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)(cd,{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 cl({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")),...oK[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:ci(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:oK[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)(co,{label:e("composer.reasoningGroup"),children:v.filter(e=>"tier"===e.kind).map(e=>(0,U.jsx)(cc,{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)(cc,{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)(cc,{row:e,active:t===g,refFor:e=>{x.current[t]=e}},e.key))})})}function co({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 cc({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)(sO.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)(sO.Jl,{className:"h-3.5 w-3.5 shrink-0 text-accent","aria-hidden":!0}):null,i?(0,U.jsx)(sO.c_,{className:"h-3.5 w-3.5 shrink-0 text-muted","aria-hidden":!0}):null]})}function cd({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)(cu,{label:e("composer.reasoningGroup"),children:r.map(t=>(0,U.jsx)(cp,{label:ci(e,t),checked:n.effort===t,disabled:a,reason:a?o:void 0,onSelect:()=>c(t)},t))}),(0,U.jsx)(cu,{label:e("composer.modelGroup"),children:oK[t].map(e=>(0,U.jsx)(cp,{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)(cu,{label:e("composer.speedGroup"),children:[(0,U.jsx)(cp,{label:e("composer.speedStandard"),checked:!n.fast,disabled:l,reason:l?o:void 0,onSelect:()=>u(!1)}),(0,U.jsx)(cp,{label:e("composer.speedFastTier"),checked:n.fast,disabled:l,reason:l?o:void 0,onSelect:()=>u(!0)})]}):null]})})}function cu({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 cp({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)(sO.Jl,{className:"h-4 w-4 shrink-0 text-accent","aria-hidden":!0}):null]})}function cm(e){return"rejected"===e||"failed"===e}function cf(e){return"turn-started"===e||"steered"===e||rm(e)&&!cm(e)}function ch(e){return"send"===e.kind||"steer"===e.kind}let cx=(e,t)=>Date.parse(t.at)-Date.parse(e.at),cg=new Map,cb=new Set,cv=e=>"llvReceiptsDismissed:"+e;function cw(e){return!rm(e)&&!cf(e)}function cy(e){var t,n;if(!cw(e.status))return null;let r=Date.parse(e.admittedAt),i=Number.isFinite(r)?Math.max(0,e.nowMs-r):0,a=(n=e).host?"dead"===n.host||"unhosted"===n.host?"host":"running"===n.turn||"interrupt_requested"===n.turn?"turn":"unknown":"unknown",s=e=>({phase:e,waitedMs:i,cause:a});return"uncertain"===e.status?s("unconfirmed-admission"):s("pending"!==(t=e.status)&&"queued"!==t?"handing-over":i>=18e5?"uncertain":"queued"!==e.status?"transmitting":"host"===a?"awaiting-host":"turn"===a?"awaiting-turn":"awaiting-handover")}function ck(e,t,n){let r=function(e,t){let n=Math.max(0,Math.round(t/1e3));if(n<60)return e("runtime.receipt.waitedSec",{n:Math.max(1,n)});let r=Math.round(n/60);return r<60?e("runtime.receipt.waitedMin",{n:r}):e("runtime.receipt.waitedHour",{n:Math.round(r/60)})}(e,t.waitedMs);return"uncertain"===t.phase?e("runtime.receipt.unconfirmed",{waited:r}):"unconfirmed-admission"===t.phase?e("runtime.receipt.admissionUnconfirmed",{waited:r}):"awaiting-host"===t.phase?e("runtime.receipt.awaitingHostFor",{waited:r}):"awaiting-handover"===t.phase?e("runtime.receipt.awaitingHandoverFor",{waited:r}):"handing-over"===t.phase?t.waitedMs>=18e5?e("runtime.receipt.handingOverFor",{waited:r}):null:"awaiting-turn"!==t.phase?null:"number"==typeof n?e("runtime.receipt.awaitingTurnPos",{position:n,waited:r}):e("runtime.receipt.awaitingTurnFor",{waited:r})}var cj=n(9103);function cN(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=rh(n=t.reason))?e(r):n?e("receipt.human.verbatim",{reason:n}):e("composer.receiptFailed");default:return e(`runtime.receipt.${t.status}`)}}function cS({receipt:e,wait:t=null,actionsDisabled:n=!1,onRetry:r,onEdit:i}){var a;let{t:s}=(0,eh.Ym)(),l="rejected"===e.status||"failed"===e.status,o=t?.phase==="uncertain",c=o||t?.phase==="awaiting-turn"||t?.phase==="awaiting-host"||t?.phase==="awaiting-handover"||t?.phase==="unconfirmed-admission",d=t?ck(s,t,e.queuePosition):null;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.jsxs)(s_,{tone:o||t?.phase==="awaiting-host"?"danger":c?"warning":"rejected"===(a=e.status)||"failed"===a?"danger":"delivered"===a||"applied"===a||"answered"===a?"success":"uncertain"===a?"warning":"neutral","data-receipt-status":e.status,...t?{"data-receipt-wait":t.phase}:{},...l||o?{role:"status","aria-live":"polite"}:{},children:[c?(0,U.jsx)(cj.A,{className:"mr-1 h-3 w-3","aria-hidden":!0}):null,d??cN(s,e)]}),l&&r?(0,U.jsx)("button",{type:"button",disabled:n,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:s("runtime.receipt.retry")}):null,l&&i?(0,U.jsx)("button",{type:"button",disabled:n,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:i,children:s("runtime.receipt.edit")}):null,rm(e.status)||"pending"===e.status||t&&"transmitting"!==t.phase&&"handing-over"!==t.phase?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})]})}let cC={state:"enabled"},cA={state:"hidden"},cI=e=>({state:"disabled",reason:e}),cM=e=>({state:"enabled",note:e}),cT=e=>e?.supported?cC:cI("composer.structuredImagesProtocol");function cP(e){if(!e||e.legacy||!e.structuredControlsEnabled)return!1;let t=e.session.hostKind;return"codex-app-server"===t||"claude-broker"===t}function c$(e){return"claude-projects"===e.root?"session"===e.kind:"codex-sessions"===e.root}function cE(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"}:cP(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":c$(e)?"resume":"inert":"unresolved"===i.kind?"running"===e.proc?"unresolved":c$(e)?"resume":"inert":"running"===e.proc?"subagent"===e.kind||e.parent?"live-subagent":"live-root":c$(e)?"resume":"inert"}let cR=["stop","compact","terminal"];function cO(e){var t;let n=lh(),r=lb(W(e)),i="claude-projects"===e.root&&"subagent"===e.kind,a=(t=i?e.parent:null,lm(e=>lg(e,null,t),null,lx)),s={runtimeEnabled:n,...n&&i?{root:function(e){if(!e)return{liveness:"unknown",structured:!1};let t=cP(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=cE(e,t,n);switch(r){case"live-root":return{surface:r,controls:{stop:cC,compact:cC,runtime:cC,kill:cC,terminal:cC,images:cC,send:cC}};case"live-subagent":return{surface:r,controls:{stop:cM("strip.stopSubagent"),compact:cI("strip.compactSubagent"),runtime:cA,kill:cC,terminal:cC,images:cC,send:cC}};case"structured-subagent":return{surface:r,controls:{stop:cM("strip.stopSubagent"),compact:cI("strip.compactSubagent"),runtime:cA,kill:cC,terminal:cC,images:cT(n.root?.imageInput),send:cC}};case"structured":var i;let a;return{surface:r,controls:{stop:cC,compact:(i=t?.session,(a=i?.hostKind==="codex-app-server"&&i.sessionKey?.engine==="codex"?"control":i?.hostKind==="claude-broker"&&i.sessionKey?.engine!=="codex"?"message":null)?"running"===i.turn||"interrupt_requested"===i.turn||i.activeTurnId?cI("strip.compactBusyTurn"):"message"===a?cM("strip.compactClaudeMessage"):cC:cI("strip.compactHostUnsupported")),runtime:cC,kill:cC,terminal:cC,images:cT(t?.session.capabilities?.imageInput),send:cC}};case"resume":return{surface:r,controls:{stop:cA,compact:cA,runtime:cC,kill:cA,terminal:cC,images:cC,send:cC}};case"dead":return{surface:r,controls:{stop:cA,compact:cA,runtime:cA,kill:cA,terminal:cC,images:cI("composer.imagesBlockedDuringRecovery"),send:cC}};case"superseded":return{surface:r,controls:{stop:cA,compact:cA,runtime:cA,kill:cA,terminal:cC,images:cA,send:cI("superseded.sendBlocked")}};case"shell":return{surface:r,controls:{stop:cA,compact:cA,runtime:cA,kill:"running"===e.proc?cC:cA,terminal:cA,images:cA,send:cA}};case"unresolved":return{surface:r,controls:{stop:cA,compact:cA,runtime:cA,kill:cA,terminal:cA,images:cA,send:cI("strip.resolving")}};default:return{surface:"inert",controls:{stop:cA,compact:cA,runtime:cA,kill:cA,terminal:c$(e)?cC:cA,images:cA,send:cA}}}}(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=cE(e,t,n);return"live-root"===r||"live-subagent"===r?"live":"resume"}(e,r,s)}}var cD=n(2437),cL=n(8272),c_=n(5688),cF=n(8980),cq=n(4614);function cz({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)(lK,{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)(sO.kr,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):i?(0,U.jsx)(sO.M6,{className:"h-3.5 w-3.5 fill-current","aria-hidden":!0}):(0,U.jsx)(cD.A,{className:"h-4 w-4","aria-hidden":!0})})})}function cH({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 cU=[0,1,2,3];function cB({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:cU.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 cK({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 cY({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)(cH,{startedAt:r,t:d}):null,h&&!a?(0,U.jsx)(cB,{stream:i,t:d}):null,h&&l?(0,U.jsx)(cK,{on:a,onClick:l,testId:"voice-mic-toggle",label:a?d("voice.micUnmute"):d("voice.micMute"),OnIcon:cL.A,OffIcon:c_.A}):null,h&&o?(0,U.jsx)(cK,{on:s,onClick:o,testId:"voice-output-toggle",label:s?d("voice.outputUnmute"):d("voice.outputMute"),OnIcon:cF.A,OffIcon:cq.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)(sO.kt,{className:"h-3 w-3","aria-hidden":!0}),d("voice.retry")]}):null]}):null]})}var cW=n(2359);let cV=new Set,cJ=0;function cG(e){return cV.add(e),()=>cV.delete(e)}function cQ(){return cJ}function cX(){return 0}let cZ={width:380,height:560};function c0(){let e=window.documentPictureInPicture;return e&&"function"==typeof e.requestWindow?e:null}function c1(){return null!==c0()}let c2="data-llv-adopted-style";function c5(e){for(let t of Array.from(e.document.head.querySelectorAll(`[${c2}]`)))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(c2,""),r.textContent=n,e.document.head.appendChild(r)}catch{let n=t.href;if(!n)continue;let r=e.document.createElement("link");r.setAttribute(c2,""),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 c4({phase:e,t}){return("connecting"===e||"live"===e)&&c1()?(0,U.jsx)(lK,{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(cJ+=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)(cW.A,{className:"h-4 w-4","aria-hidden":!0})})}):null}let c3=new Map,c6=new Map;async function c8(e,t=fetch,n=Date.now){let r=e.trim();if(!r)return null;let i=c3.get(r);if(i&&n()-i.cachedAt<3e4)return i.conversationId;let a=c6.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 c3.set(r,{conversationId:a,cachedAt:n()}),a}catch{return null}finally{c6.delete(r)}})();return c6.set(r,s),s}async function c7(e,t,n=fetch,r=Date.now){return!!e.startsWith("conversation_")&&await c8(t,n,r)===e}let c9=new Map,de=new Map,dt=new Set,dn=0;function dr(){for(let e of(dn+=1,dt))e()}function di(e,t,n){return e.set(t,n),dr(),()=>{e.get(t)===n&&(e.delete(t),dr())}}function da(e){return dt.add(e),()=>dt.delete(e)}function ds(){return null}let dl=new Map,dc=new Map,dd=new Map,du=0;function dp(e){let t=dl.get(e),n=t?.findLast(e=>e.primary)??t?.[t.length-1],r=n?dd.get(e)?.get(n.id):void 0;return!!r&&dc.get(e)!==r&&(dc.set(e,r),!0)}function dm(){return du>0}function df(){return!1}function dh(){return dn}function dx(){return 0}let dg=new Set(["delivery-auto-retry","interrupt-auto-retry"]),db=e=>"llvSent:"+e,dv=e=>e.retryOfOperationId??null,dw=new Set;function dy({receipts:e,actionsDisabled:t=!1,dismissed:n=dw,nowMs:r,session:i=null,onRetry:a,onEdit:s,onDismiss:l}){let{t:o}=(0,eh.Ym)(),c=(0,Y.useId)(),[d,u]=(0,Y.useState)(!1),p=function(e,t=new Set){let n=e.filter(e=>ch(e)&&!!e.text).sort(cx),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(cf(n[0].status))continue;let r=n.filter(e=>!cf(e.status)&&!(rm(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,h]=(0,Y.useState)(()=>r??Date.now()),x=void 0!==r,g=m.some(e=>cw(e.status));(0,Y.useEffect)(()=>{if(x||!g)return;let e=setInterval(()=>h(Date.now()),15e3);return()=>clearInterval(e)},[x,g]);let b=r??f,v=e=>"send"===e.kind||"steer"===e.kind,w=e=>v(e)&&("failed"===e.status||"rejected"===e.status)&&"string"==typeof e.text&&e.text.length>0&&e.text.length<240,y=e=>cy({status:e.current.status,host:i?.host??null,turn:i?.turn??null,admittedAt:e.current.admittedAt??e.current.at,nowMs:b}),k=e=>{let t=new Map;for(let n of e.slice(1)){let e=cN(o,n);t.set(e,(t.get(e)??0)+1)}return[...t].map(([e,t])=>t>1?`${e} \xd7${t}`:e)},j=function(e,t=new Set){return e.filter(e=>(!ch(e)||!e.text)&&!cf(e.status)&&!(rm(e.status)&&t.has(e.operationId)))}(e,n),N=p.filter(e=>y(e)?.phase==="uncertain").map(e=>e.current),S=new Set(N.map(e=>e.operationId)),C=m.filter(e=>!rm(e.status)&&!S.has(e.operationId)),A=[...m.filter(e=>cm(e.status)),...N],I=C.some(e=>"string"==typeof e.reason&&dg.has(e.reason)),M=o("runtime.receipt.summary",{count:m.length}),T=o(d?"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:d,onToggle:e=>u(e.currentTarget.open),children:[(0,U.jsxs)("summary",{"aria-describedby":c,"aria-label":`${T}. ${M}`,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)(sO.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:M}),(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:[C.length?(0,U.jsxs)(s_,{tone:"warning","data-receipt-pending-count":!0,"aria-label":`${o("runtime.receipt.pendingCount",{count:C.length})}${I?` \xb7 ${o("runtime.receipt.busyRetry")}`:""}`,title:I?o("runtime.receipt.busyRetry"):o("runtime.receipt.pendingCount",{count:C.length}),children:[I?(0,U.jsx)(sO.kr,{className:"h-3 w-3 animate-spin motion-reduce:animate-none","aria-hidden":!0}):null,(0,U.jsxs)("span",{className:"sr-only",children:[o("runtime.receipt.pendingCount",{count:C.length}),I?` \xb7 ${o("runtime.receipt.busyRetry")}`:null]}),(0,U.jsx)("span",{"aria-hidden":!0,"data-receipt-count-value":!0,children:C.length})]}):null,A.length?(0,U.jsxs)(s_,{tone:"danger","data-receipt-problem-count":!0,"aria-label":o("runtime.receipt.problemCount",{count:A.length}),title:o("runtime.receipt.problemCount",{count:A.length}),children:[(0,U.jsx)("span",{"aria-hidden":!0,children:"!"}),(0,U.jsx)("span",{className:"sr-only",children:o("runtime.receipt.problemCount",{count:A.length})}),(0,U.jsx)("span",{"aria-hidden":!0,"data-receipt-count-value":!0,children:A.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,r=k(e.attempts),i="failed"===n.status,c=!rm(n.status),d=y(e),u=d?.phase==="uncertain",p=c&&!u&&"string"==typeof n.reason&&dg.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)(s_,{tone:"neutral","data-receipt-attempt-count":!0,"aria-label":o("runtime.receipt.attemptCount",{count:e.attempts.length}),title:o("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:o("runtime.receipt.attemptCount",{count:e.attempts.length})})]}):null,(0,U.jsx)(cS,{receipt:n,wait:d,actionsDisabled:t,onRetry:i?()=>a(n):void 0,onEdit:w(n)?()=>s(n):void 0}),l&&cm(n.status)?(0,U.jsx)("button",{type:"button","aria-label":o("runtime.receipt.dismiss"),title:o("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:()=>l(e.attempts.filter(e=>rm(e.status)).map(e=>e.operationId)),children:(0,U.jsx)(sO.X,{className:"h-3 w-3","aria-hidden":!0})}):null,"pending"!==n.status||u?null:(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}),p?(0,U.jsx)("span",{className:"min-w-0 max-w-[52%] truncate text-caption text-muted","data-runtime-receipt-busy":!0,title:o("runtime.receipt.busyRetry"),children:o("runtime.receipt.busyRetry")}):null]}),u?(0,U.jsx)("span",{className:"min-w-0 max-w-full text-right text-caption text-muted","data-receipt-uncertain-why":!0,children:"host"===d.cause?o("runtime.receipt.unconfirmedWhyHost"):"turn"===d.cause?o("runtime.receipt.unconfirmedWhy"):o("runtime.receipt.unconfirmedWhyUnknown")}):null,r.length?(0,U.jsx)("span",{className:"min-w-0 max-w-full truncate text-caption text-muted","data-receipt-history":!0,title:r.join(" \xb7 "),children:r.join(" \xb7 ")}):null]},n.operationId)})})]}),(0,U.jsxs)("span",{id:c,className:"sr-only",role:"status","aria-live":"polite","data-runtime-receipt-status":!0,children:[o("runtime.receipt.statusSummary",{pending:o("runtime.receipt.statusPending",{count:C.length}),problems:o("runtime.receipt.statusProblems",{count:A.length})}),` ${p.map(e=>{let t=y(e);return[(t&&ck(o,t,e.current.queuePosition))??cN(o,e.current),...k(e.attempts)].join(" \xb7 ")}).join(". ")}.`,I?` ${o("runtime.receipt.busyRetry")}`:null]})]}):null,j.map(e=>{let n="failed"===e.status;return(0,U.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,U.jsx)(cS,{receipt:e,actionsDisabled:t,onRetry:v(e)&&n?()=>a(e):void 0,onEdit:w(e)?()=>s(e):void 0}),l&&cm(e.status)?(0,U.jsx)("button",{type:"button","aria-label":o("runtime.receipt.dismiss"),title:o("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:()=>l([e.operationId]),children:(0,U.jsx)(sO.X,{className:"h-3 w-3","aria-hidden":!0})}):null]},e.operationId)})]})}function dk(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 dj=e=>"llvPendingSend:"+e,dN=e=>"llvDraftImages:"+e,dS=e=>"llvDraftFiles:"+e;function dC(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 dA(e){try{let t=JSON.parse(sessionStorage.getItem(dj(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=dC(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 dI(e){let t={...e};return delete t.reconciling,t}function dM(e){return"composer-unconfirmed:"+e}function dT(e){return"claude-projects"===e.root?"session"===e.kind||"subagent"===e.kind:"codex-sessions"===e.root}let dP=e=>"llvDraft:"+e,d$="llv-compose-draft";function dE(e,t){try{for(let n of[sessionStorage.getItem("llvComposerOwner:"+e),e])if(n&&n!==t)for(let e of[dP,dN,dS,dj,db,cv]){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 dO({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)&&d_()-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=d_();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 dD(e,t){let n=dP(e),r=sessionStorage.getItem(n)??"";sessionStorage.setItem(n,r.trim()?r.replace(/\s*$/,"")+"\n\n"+t:t),window.dispatchEvent(new CustomEvent(d$,{detail:{path:e}}))}let dL=e=>new Date(e).toLocaleTimeString("uk"===(0,eh.JK)()?"uk-UA":"en-US",{hour12:!1,hour:"2-digit",minute:"2-digit"});function d_(){return Date.now()}function dF(e){let t=(0,Y.useSyncExternalStore)(da,dm,df),n=W(e.file);return t&&n.startsWith("conversation_")?(0,U.jsx)(dq,{cardId:n,composerProps:e,primary:!0===e.primaryPlace}):(0,U.jsx)(dz,{...e})}function dq({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 dl.set(e,[...dl.get(e)??[],a]),dp(e),dr(),()=>{let t=dl.get(e);if(!t)return;let n=t.filter(e=>e!==a);if(n.length===t.length)return;let r=dd.get(e);r?.delete(i),r?.size===0&&dd.delete(e),n.length?dl.set(e,n):dl.delete(e),dp(e),dr()}}(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=dd.get(e)??new Map).set(r,n),dd.set(e,i),dp(e)&&dr()},[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 dz({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}=cO(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_")?sE(v):null,[v,k]),m=(0,Y.useSyncExternalStore)(p?.subscribe??(()=>()=>void 0),p?.getSnapshot??(()=>lc),()=>lc),(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)(da,()=>{var e;return k&&(e=v)?de.get(e)??null:null},ds),C=(0,Y.useCallback)(e=>{if(e)return di(c9,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=lO(e.migration,lP(e.path)),$="switching"===lE(P),E=lD(lE(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)}},lj.add(r),null===lN&&(lN=setInterval(()=>void lI(),5e3)),lA||(lA=!0,setTimeout(()=>{lA=!1,lI()},0)),()=>{lj.delete(r),0===lj.size&&null!==lN&&(clearInterval(lN),lN=null)}},[e,t,n]),null!==e||t?r:null}(e.pid,dT(e)?e.path:void 0,!t),O=lo({initialText:()=>(dE(e.path,v),oC(e.path,v),sessionStorage.getItem(dP(v))??""),persistText:e=>{e?sessionStorage.setItem(dP(v),e):sessionStorage.removeItem(dP(v))},submit:e=>eH(e),imageCapability:y?A??null:null,acceptFiles:!0,holdInputWhileBusy:!1}),D=function(e,t={}){let n=t.fetchFn,r=t.conversationId?.trim()??"";return(0,Y.useCallback)(async()=>{if(!e)return sl;let t=n??fetch;await su(t,e=>!e.startsWith("voice:"));try{let e=new URLSearchParams({mode:"turn-start"});r&&e.set("conversationId",r);let n=await ss(t,`/api/bridge?${e.toString()}`,{cache:"no-store"},{});if(!n.ok)return sl;let i=(await n.json()).prelude;if(!i?.text)return sl;return{text:i.text,ackToken:i.ackToken,commit:()=>{so(i.ackToken,t).catch(()=>void 0)}}}catch{return sl}},[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=ib(),[X,Z]=(0,Y.useState)([]),ee=oO(v),et=(0,Y.useSyncExternalStore)(e=>(oM.add(e),()=>oM.delete(e)),()=>oI.get(v)??oT,()=>oT),en=(0,Y.useRef)(new Map),er=(0,Y.useRef)(new Map),ei=(0,Y.useRef)(new Set),[ea,es]=(0,Y.useState)([]),[el,eo]=(0,Y.useState)(()=>dA(v).some(e=>e.reconciling)),[ec,ed]=(0,Y.useState)(()=>dA(v).some(e=>!1!==e.payloadComplete)),[eu,ep]=(0,Y.useState)([]),em=(0,Y.useRef)(rg()),ef=(0,Y.useRef)([]),ex=(0,Y.useRef)(new Set),eg=e=>{let t=a3(e);t&&so(t).then(()=>a8(e)).catch(()=>{})},eb=(0,Y.useRef)(eg);(0,Y.useEffect)(()=>{eb.current=eg});let ev=(0,Y.useRef)(new Map),ew=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=dv(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=dv(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,lm(e=>{if(!e.enabled||!d&&!v)return lp;let t=lv(e.store.sessions,v,d);return t?.recentReceipts??lp},lp)),ea);(0,Y.useEffect)(()=>{for(let e of ew)rx(e.status)&&eb.current(e.idempotencyKey)},[ew]);let ey=(u=y?.session.liveTurn?.turnId)?[...ew].sort(cx).find(e=>ch(e)&&(e.turnId===u||e.operationId===u))??null:null,ek=ey?.idempotencyKey;(0,Y.useEffect)(()=>{ek&&function(e,t,n){let r=ok(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&&op(e,s,n),ob(e,a)}(v,ek,d_())},[v,ek]);let ej=(0,Y.useRef)(ew);(0,Y.useLayoutEffect)(()=>{ej.current=ew},[ew]);let eN=(0,Y.useRef)(new Map),eS=(0,Y.useRef)({cardId:v,active:!0});(0,Y.useLayoutEffect)(()=>{let e={cardId:v,active:!0};return eS.current=e,()=>{e.active=!1}},[v]);let eC=new Set(eu),eA=e=>{let t;if(!e.length)return;let n=(t=new Set(e),[...eu.filter(e=>!t.has(e)),...e].slice(-64));ep(n);try{n.length?sessionStorage.setItem(cv(v),JSON.stringify(n)):sessionStorage.removeItem(cv(v))}catch{}},eI=new Set(ee.filter(e=>void 0!==e.responseStartedAt).map(e=>e.id));ek&&eI.add(ek);let eM=function(e,t,n,r,i=cg,a=cb){let s=new Set,l=[];for(let t of e.filter(e=>ch(e)&&!!e.text).sort(cx))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(!cf(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(!cf(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}(ew,1e3*e.mtime,eC,d_(),et,eI),eT=e=>{ef.current=e,ed(e.some(e=>!1!==e.payloadComplete));try{e.length?sessionStorage.setItem(dj(v),JSON.stringify(e.map(({key:e,text:t,images:n,files:r,runtime:i,runtimeCaptured:a,reconciling:s,payloadComplete:l,operationId:o})=>({key:e,text:t,images:n.map(({id:e,base64:t,mime:n})=>({...e?{id:e}:{},base64:t,mime:n})),...i?{runtime:i}:{},...a?{runtimeCaptured:!0}:{},...s?{reconciling:!0}:{},...!1===l||r?.length?{payloadComplete:!1}:{},...o?{operationId:o}:{}})))):sessionStorage.removeItem(dj(v))}catch{try{sessionStorage.setItem(dj(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{}}},eP=e=>{let t=ex.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)}},e$=(e,t)=>{let n=eN.current.get(e);n&&(n.abort(),eN.current.delete(e),H(null),rm(t.status)&&!rx(t.status)&&(eT(ef.current.map(t=>t.key===e?dI(t):t)),em.current===e&&(em.current=rg())),eo(eN.current.size>0))},eE=(e,t)=>{if(eN.current.has(e))return;let n=new AbortController;eN.current.set(e,n),eo(!0),o_({read:()=>ej.current.find(t=>t.idempotencyKey===e&&(rx(t.status)||rm(t.status)))??null,refresh:lk,late:t,timeoutMs:3e4,pollIntervalMs:1e3,signal:n.signal}).then(t=>{if(!n.signal.aborted){if(null===t){let t;return void(eN.current.delete(e),eT(ef.current.map(t=>t.key===e?dI(t):t)),(t=ef.current.find(t=>t.key===e))&&(eo(eN.current.size>0||!1===t.payloadComplete),H({kind:"err",text:b("composer.deliveryUnconfirmed")}),ei.current.has(e)&&oN(v,e,{state:"failed",settledAt:d_(),error:b("composer.deliveryUnconfirmed")}),es(n=>{var r;return[(r=t.text,{operationId:dM(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!==dM(e))].slice(0,8)})))}es(e=>[t,...e.filter(e=>e.operationId!==t.operationId)].slice(0,8))}})};(0,Y.useEffect)(()=>()=>{for(let e of eN.current.values())e.abort();eN.current.clear()},[]),(0,Y.useEffect)(()=>{for(let t of(dE(e.path,v),oC(e.path,v),Z(function(e){try{let t=JSON.parse(sessionStorage.getItem(db(e))??"[]");return Array.isArray(t)?t:[]}catch{return[]}}(v)),es([]),ep(function(e){try{let t=JSON.parse(sessionStorage.getItem(cv(e))??"[]");if(!Array.isArray(t))return[];return t.filter(e=>"string"==typeof e).slice(-64)}catch{return[]}}(v)),eN.current.values()))t.abort();eN.current.clear();let t=dA(v);ef.current=t,ed(t.some(e=>!1!==e.payloadComplete)),ev.current=new Map;let n=sessionStorage.getItem(dP(v))??"",r=t.find(e=>!1!==e.payloadComplete),i=function(e){try{let t=sessionStorage.getItem(dN(e));return null===t?null:dC(JSON.parse(t))}catch{return null}}(v);G.current=!1;let a=i??(r?.text===n?r.images:[]),s=function(e){try{let t=sessionStorage.getItem(dS(e));return(null===t?null:function(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.name||!n.name)return null;t.push({..."string"==typeof n.id?{id:n.id}:{},name:n.name,..."string"==typeof n.mime?{mime:n.mime}:{}})}return t}(JSON.parse(t)))??[]}catch{return[]}}(v),l=J.replace(a.map(e=>({...e})),s);queueMicrotask(()=>{G.current=!0}),r&&l&&r.runtimeCaptured&&ev.current.set(r.key,r.runtime);let o=t.filter(e=>e.reconciling).map(e=>e.key),c=t.some(e=>!1===e.payloadComplete);for(let e of(eo(o.length>0||c),o.length||c?H({kind:"err",text:b("composer.admissionTimedOut")}):s.length&&H({kind:"err",text:b("attach.refused",{names:s.map(e=>e.name).join(", "),reason:b("attach.notRestored")})}),o))eE(e);ex.current=new Set},[v]),(0,Y.useEffect)(()=>{G.current&&function(e,t,n){try{if(!t.length&&!n)return void sessionStorage.removeItem(dN(e));sessionStorage.setItem(dN(e),JSON.stringify(t.map(({id:e,base64:t,mime:n})=>({...e?{id:e}:{},base64:t,mime:n}))))}catch{}}(v,J.images,ef.current.length>0)},[J.images,v]),(0,Y.useEffect)(()=>{if(G.current){var e=J.attachments;try{let t=e.filter(e=>"file"===e.kind).map(e=>({id:e.id,name:e.name,mime:e.mime}));t.length?sessionStorage.setItem(dS(v),JSON.stringify(t)):sessionStorage.removeItem(dS(v))}catch{}}},[J.attachments,v]),(0,Y.useEffect)(()=>{var e;for(let[e]of eN.current){let t=ew.find(t=>t.idempotencyKey===e&&(rx(t.status)||rm(t.status)));t&&e$(e,t)}for(let e of ef.current)!eN.current.has(e.key)&&em.current===e.key&&ew.find(t=>t.idempotencyKey===e.key&&rm(t.status)&&!rx(t.status))&&(em.current=rg());if(!ef.current.length)return;let t=(e=ef.current,e.map(e=>{let t=ew.find(t=>!!e.operationId&&dv(t)===e.operationId)??ew.find(t=>t.operationId===e.operationId)??ew.find(t=>t.idempotencyKey===e.key);return t&&t.operationId!==e.operationId?{...e,operationId:t.operationId}:e}));t.some((e,t)=>e!==ef.current[t])&&eT(t);let{settled:n,remaining:r}=function(e,t){let n=new Map,r=new Map;for(let e of t){if(!rx(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}}(ef.current,ew),i=r.some(e=>!1===e.payloadComplete&&!ew.some(t=>(t.idempotencyKey===e.key||t.operationId===e.operationId)&&rm(t.status)));if(eo(eN.current.size>0||i),n.length)for(let e of(eT(r),n)){if(eP(e.entry.key),ei.current.has(e.entry.key)){let t=ew.find(t=>t.idempotencyKey===e.entry.key&&rx(t.status)),n=t?l2(t.status):"delivered";oN(v,e.entry.key,{state:n,settledAt:d_(),awaitingTurn:t?l1(t.status):void 0})}else{let t=dk(_.current,e.text);t!==_.current&&F(t)}J.settleDelivered(e.entry.images,e.entry.files??[]),e.entry.key===em.current&&(em.current=rg())}},[ew,v]),(0,Y.useEffect)(()=>{for(let e of ee){if(e.launchOwned||"delivered"===e.state)continue;let t=ew.find(t=>t.idempotencyKey===e.id&&(rx(t.status)||rm(t.status)));if(!t)continue;let n=function(e,t){if(!rx(t)&&!rm(t))return null;let n=l2(t),r=l1(t);return n===e.state&&r===e.awaitingTurn||"failed"===e.state&&"failed"===n?null:{state:n,awaitingTurn:r}}(e,t.status);n&&oN(v,e.id,{...n,settledAt:d_()})}},[ew,ee,v]);let eR=(0,Y.useRef)({card:v,ids:new Set});(0,Y.useEffect)(()=>{var e;let t,n,r;if(eR.current.card!==v&&(eR.current={card:v,ids:new Set}),E)return void eR.current.ids.clear();for(let i of(e=eR.current.ids,t=ok(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&&ob(v,r),n))eR.current.ids.add(i),ex.current.delete(i)},[E,v,ee]),(0,Y.useEffect)(()=>{let e=e=>{if(e.detail?.path!==v)return;let t=sessionStorage.getItem(dP(v))??"";_.current=t,q(t),requestAnimationFrame(()=>{let e=z.current;e&&(e.focus(),e.setSelectionRange(e.value.length,e.value.length))})};return window.addEventListener(d$,e),()=>window.removeEventListener(d$,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(db(v),JSON.stringify(n)),n.length!==t.length?n:t});t();let n=setInterval(t,5e3);return()=>clearInterval(n)},[e.mtime,v]);let eO=(f=(0,Y.useSyncExternalStore)(iS.subscribe,iS.getContext,()=>iv),h=(0,Y.useSyncExternalStore)(iS.subscribe,iS.getSlice,()=>iw),x=(0,Y.useSyncExternalStore)(iS.subscribe,iS.getCards,()=>sS),(0,Y.useMemo)(()=>(0,sj.P3)({context:f,slice:h,cards:x}),[f,h,x]));if("hidden"===w.controls.send.state)return null;let eD=dT(e);if(null===R&&!eD)return null;let eL="unresolved"===w.surface,e_=r??(eL?b("strip.resolving"):null),eF=null===R&&!y&&!eL,eq=eF&&"claude-projects"===e.root&&"subagent"===e.kind,ez=e=>{Z(e),sessionStorage.setItem(db(v),JSON.stringify(e))},eH=(e,t)=>{var r;let i,a,s,l,o=t?.preserveDraft??!1,c=e??_.current,d=o?[]:J.imagesRef.current.map(e=>({...e})),u=o?[]:J.filesRef.current.map(e=>({...e}));if(V||el||!c.trim()&&!d.length&&!u.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(e_)return void H({kind:"err",text:e_});if(y&&d.length&&!J.validate())return;let p=rg();en.current.set(p,d),u.length&&er.current.set(p,u),ei.current.add(p),r={id:p,text:c,images:d.length,...u.length?{files:u.length}:{},at:d_(),echoBaseline:((i=oI.get(v))||(i=oP(om(v)),oI.set(v,i)),i.get(oA(c))??0)},a=oA(r.echoText??r.text),s=r.echoBaselineIds??om(v).filter(e=>e.key===a).map(e=>e.id),l={...r,echoBaseline:r.echoBaseline??s.length,...s.length?{echoBaselineIds:s}:{},state:"queued"},oy(v,[...ok(v).filter(e=>e.id!==r.id),l]),o||(F(""),J.clearAll()),H(null),z.current?.focus()},eU=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=(i?er.current.get(i)??[]:J.filesRef.current).map(e=>({...e})),u=(e,t,n,r)=>{i&&(oN(v,i,{state:e,settledAt:d_(),awaitingTurn:r,...t?{error:t}:{},...n?{heldForSwitch:!0}:{}}),"delivered"===e&&(en.current.delete(i),er.current.delete(i)))},p=e=>(rx(e.status)&&eg(m),u(l2(e.status),void 0,"queued"===e.status,l1(e.status))),m=(a=em.current,r?.clientMessageId||a),f=ef.current.find(e=>e.key===m),h=f?.selectedContext??sN(),x=f?null:await D(),g=f||!await c7(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("; ")}]`}(iS.getContext(),iS.getSlice(),s)),w=g?`${g}
|
|
3
|
+
${o}`:o,k=f?.text??(x?.text?`${x.text}
|
|
4
|
+
|
|
5
|
+
${w}`:w),j=f?f.images.map(e=>({...e})):c,N=f?(f.files??[]).map(e=>({...e})):d;if(!k.trim()&&!j.length&&!N.length){i&&oS(v,i);return}if(B||V||el){i&&oN(v,i,{state:"queued"});return}if(i&&k!==o&&function(e,t,n){let r=ok(e),i=r.find(e=>e.id===t);if(!i||i.retiredEchoId)return;let a=oA(n);if(!a||oA(i.echoText??i.text)===a)return;let s=om(e).filter(e=>e.key===a).map(e=>e.id);ob(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,k),n&&!y){H({kind:"err",text:b("deadHost.sendBlocked")}),u("failed",b("deadHost.sendBlocked"));return}if(y&&M&&j.length){H({kind:"err",text:T}),u("failed",T);return}if(e_){H({kind:"err",text:e_}),u("failed",e_);return}if(y&&j.length&&!J.validate())return;K(!0),H(n?{kind:"info",text:b("composer.receiptRecovering")}:null);let S=eF&&!eq,C=!!y||S;if(C&&!ev.current.has(m)){let t;for(ev.current.set(m,f?.runtimeCaptured?f.runtime:y?function(e){let t=o7(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=o8(e))?{...t.model?{model:t.model}:{},...t.effort?{effort:t.effort}:{},..."codex"===e.engine?{fast:t.fast}:{}}:{});ev.current.size>32;){let e=ev.current.keys().next().value;if(void 0===e)break;ev.current.delete(e)}}let A=ev.current.get(m),I=!(y&&M&&j.length>0),$=I&&!ex.current.has(m)&&!ef.current.some(e=>e.key===m);$&&eT([{key:m,text:k,images:j,...N.length?{files:N}:{},...A?{runtime:A}:{},selectedContext:h,...C?{runtimeCaptured:!0}:{}},...ef.current].slice(0,8));let E=(e,t,n=[])=>{ex.current.has(m)||(eP(m),i||F(dk(_.current,e)),J.settleDelivered(t,n))},R=e=>{if(ex.current.has(m))return;let t=j.length,n="held"===e.outcome||"queued"===e.outcome||"recovering"===e.outcome,a=d_(),s={id:a,text:k.trim()||(N.length?b("composer.attachmentsCount",{count:N.length+t}):"")||(t?b("composer.imagesCount",{count:t}):""),at:a,via:"resumed"===e.outcome||e.spawned?"spawn":"pane",state:n?e.outcome:"sent",clientMessageId:m},l=!i||!n;l&&ez([...r?X.filter(e=>e.id!==r.receiptId):X,s].slice(-8));let o=ef.current.find(e=>e.key===m);if(eT(ef.current.filter(e=>e.key!==m)),es(e=>e.filter(e=>e.idempotencyKey!==m&&e.operationId!==dM(m))),em.current===m&&(em.current=rg()),E(k,o?.images??j,o?.files??N),u(n?"delivering":"delivered",void 0,n),l){let t=lD(lE(P)),r=lR(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??0)+(e.filePaths?.length??0)?b("composer.sentPaths",{count:(e.imagePaths?.length??0)+(e.filePaths?.length??0)}):b("common.sent")})}i||z.current?.focus()},O=eS.current,q=null;try{q=Promise.resolve(y?I?(l={conversationId:y.session.conversationId,text:k.trim(),images:j.map(e=>({base64:e.base64,mime:e.mime})),...N.length?{files:N.map(e=>({name:e.name,base64:e.base64}))}:{},idempotencyKey:m,policy:"interrupt-active",...A?{runtime:A}:{},selectedContext:h},ly("/api/runtime/send",{conversationId:l.conversationId,text:l.text,images:l.images,...l.files?.length?{files:l.files}:{},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:k,idempotencyKey:m,clientMessageId:m,images:j.map(e=>({base64:e.base64,mime:e.mime})),...N.length?{files:N.map(e=>({name:e.name,base64:e.base64}))}:{},origin:{kind:"operator"},...S?A??{}:{}})}).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 oL),t)})]).finally(()=>{void 0!==n&&clearTimeout(n)})}(q,15e3);if(x?.ackToken&&a4(m,x.ackToken),t.ok&&(!t.structured||t.receipt&&rx(t.receipt.status))?eg(m):t.ok||a8(m),!t.ok){if(t.structured&&t.receipt){let e=("send"===t.receipt.kind||"steer"===t.receipt.kind)&&!t.receipt.text&&k.trim()?{...t.receipt,text:k.trim()}:t.receipt;if(es(t=>[e,...t.filter(t=>t.operationId!==e.operationId)].slice(0,8)),rx(e.status)){let n=ef.current.find(e=>e.key===m);eT(ef.current.filter(e=>e.key!==m));let r="delivered"===e.status&&"string"==typeof t.receipt.text&&t.receipt.text?t.receipt.text:n?.text??k;E(r,n?.images??j,n?.files??N),p(e),em.current===m&&(em.current=rg()),"delivered"===e.status&&H({kind:"ok",text:b("common.sent")}),i||z.current?.focus();return}rm(e.status)&&em.current===m&&(em.current=rg())}if(ex.current.has(m))return;!(!rm(t.receipt?.status??"pending")&&(void 0===t.status||t.status>=500))&&$&&eT(ef.current.filter(e=>e.key!==m)),u("failed",t.error??b("common.failedSend")),H({kind:"err",text:t.error??b("common.failedSend")});return}if(t.structured&&t.receipt){es(e=>[t.receipt,...e.filter(e=>e.operationId!==t.receipt.operationId)].slice(0,8));let e=ef.current.find(e=>e.key===m);eT(ef.current.filter(e=>e.key!==m)),em.current===m&&(em.current=rg()),E(k,e?.images??j,e?.files??N),p(t.receipt),i||z.current?.focus();return}R(t)}catch(e){if(!ex.current.has(m)&&(H({kind:"err",text:e instanceof oL?b("composer.admissionTimedOut"):b("common.serverUnavailable")}),e instanceof oL||u("failed",b("common.serverUnavailable")),e instanceof oL)){eT(ef.current.map(e=>e.key===m?{...e,reconciling:!0}:e));let e=q?.then(e=>{let t=e.receipt;if(t&&(rx(t.status)||rm(t.status)))return("send"===t.kind||"steer"===t.kind)&&!t.text&&k.trim()?{...t,text:k.trim()}:t;if(!e.ok||e.structured||!O.active||eS.current!==O)return null;let n=eN.current.get(m);return R(e),n?.abort(),eN.current.delete(m),eo(eN.current.size>0),null});eE(m,e)}}finally{K(!1)}},eB=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")});es(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)}}},eK=e=>{e.preventDefault(),eH()},eY=n&&!y,eW=eY||el||!!e_,eV=(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]),eJ=B||V||J.images.length>0,eG=y?b("composer.sendStructuredAria"):eL?b("composer.resolvingAria"):eF?b("composer.spawnAria"):b("composer.sendAria",{target:R??""}),eQ=(0,U.jsx)(lG,{composer:O,placeholder:i??(eL?b("composer.placeholderResolving"):eq?b("composer.placeholderRelay"):eF?b("composer.placeholderSpawn"):b("composer.placeholderSend")),textareaAriaLabel:b("composer.textAria"),imageAriaLabel:b("composer.addAttachments"),sendLabelIdle:eF?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:eV,voiceControl:k?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(cz,{phase:N.phase,start:N.start,stop:N.stop,t:b}),(0,U.jsx)(c4,{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:eF&&!eq||eW?[]:[{id:"quick-ack",label:b("composer.quickAckLabel"),description:b("composer.quickAck"),disabled:eJ,tone:"ok",onSelect:()=>eH(b("composer.quickAck"),{preserveDraft:!0})}],showImage:!eY,imageDisabled:M,imageDisabledReason:T,sendPayloadAvailable:ec,sendDisabledReason:eY?b("deadHost.sendBlocked"):el?b("composer.admissionTimedOut"):e_??void 0,onSendBlockedRecover:()=>void lk(),receipts:ew.length?(0,U.jsx)(dy,{receipts:ew,actionsDisabled:B||V||eY,dismissed:eC,session:y?{host:y.session.host,turn:y.session.turn}:null,onRetry:e=>void eB(e),onEdit:e=>{B||V||!e.text||(em.current=rg(),F(e.text),H(null),requestAnimationFrame(()=>{z.current?.focus(),z.current?.setSelectionRange(e.text.length,e.text.length)}))},onDismiss:eA}):void 0,leftSlot:"hidden"!==w.controls.runtime.state?(0,U.jsx)(cs,{file:e,surface:w.surface,runtimeSettings:y?.session.capabilities?.runtimeSettings??null,runtimeSession:y?.session??null}):null}),eX=(0,U.jsxs)("form",{onSubmit:eK,"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":eG,children:[(0,U.jsx)(dO,{claimKeys:[v,e.path]}),(0,U.jsx)(oD,{entries:ee,ready:!B&&!V&&!el,onDispatch:e=>{oN(v,e.id,{state:"delivering"}),ei.current.add(e.id),eU(e.text,{clientMessageId:e.id},e.id)}}),"selected"===eO.state?(0,U.jsx)("div",{className:"flex justify-end",children:(0,U.jsx)(lX,{reference:eO})}):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)(sO.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||eM.length?(0,U.jsxs)("div",{className:"flex flex-col gap-0.5","aria-label":b("composer.queueAria"),children:[eM.map(e=>(0,U.jsxs)("div",{"data-delivery-echo":!0,className:"flex items-center justify-end gap-1.5",children:[(0,U.jsx)(sO.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:dL(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:()=>eA([e.operationId]),children:(0,U.jsx)(sO.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)(s_,{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:()=>{eU(e.text,{receiptId:e.id,clientMessageId:e.clientMessageId})},children:(0,U.jsx)(sD.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)(sO.jG,{className:"h-2.5 w-2.5","aria-hidden":!0}):(0,U.jsx)(sO.Qp,{className:"h-2.5 w-2.5","aria-hidden":!0}),dL(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:()=>ez(X.filter(t=>t.id!==e.id)),children:(0,U.jsx)(sO.X,{className:Q?"h-4 w-4":"h-3 w-3","aria-hidden":!0})})]},e.id)})]}):null,S?(0,nA.createPortal)((0,U.jsx)("form",{onSubmit:eK,"aria-label":eG,className:"flex flex-col gap-1.5",children:eQ}),S):eQ]});return void 0===a?eX:a?(0,nA.createPortal)(eX,a):(0,U.jsx)("div",{hidden:!0,"data-testid":"voice-composer-parked",children:eX})}function dH(){(0,Y.useSyncExternalStore)(da,dh,dx);let e=(0,Y.useSyncExternalStore)(sb,sw,sy);(0,Y.useEffect)(()=>(du+=1,dr(),()=>{du-=1,dr()}),[]);let t=new Set([...dl.keys()]);return e&&t.add(e.conversationId),(0,Y.useEffect)(()=>{for(let e of[...dc.keys()])!t.has(e)&&(dc.delete(e)||dd.delete(e))&&dr()}),(0,U.jsx)(U.Fragment,{children:[...t].map(e=>{let t,n=dc.get(e)??null;return n?(0,U.jsx)(dz,{file:n.file,pollPaused:n.pollPaused,deadHost:n.deadHost,sendBlockedReason:n.sendBlockedReason,placeholder:n.placeholder,dockNode:(t=dl.get(e),t?.length?(t.findLast(e=>e.primary)??t[t.length-1]).node:null)},e):null})})}function dU({mobile:e,resolveClient:t=sE}){var n;let{t:r}=(0,eh.Ym)(),i=(0,Y.useSyncExternalStore)(sb,sv,sk),{supported:a,pipWindow:s,open:l,close:o}=function(){let[e,t]=(0,Y.useState)(null),n=c1(),r=(0,Y.useCallback)(async()=>{let n,r=c0();if(r&&!e){try{n=await r.requestWindow({...cZ})}catch{return}c5(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||c5(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??dB,d?.getSnapshot??dY,dY);!function(e,t=null){let n=(0,Y.useRef)(Symbol("realtime-ambient-owner"));(0,Y.useEffect)(()=>{let t=n.current;return nv(t,e),()=>nv(t,!1)},[e]),(0,Y.useEffect)(()=>{let r=n.current;return nk(r,e?t:null),()=>nk(r,null)},[e,t])}(n="live"===u.phase,function(e,t){let[n,r]=(0,Y.useState)(e),[i,a]=(0,Y.useState)(ld);return n!==e&&(r(e),a(e?new Set(t.map(e=>e.id)):ld)),(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)(cG,cQ,cX),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)(da,()=>c?c9.get(c)??null:null,ds),g=(0,Y.useCallback)(e=>{if(e&&c)return di(de,c,e)},[c]);if(!d||!c)return null;let b=(0,U.jsx)(cY,{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,nA.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)(cW.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,nA.createPortal)(b,x):null}let dB=()=>()=>void 0,dK={phase:"idle",lines:[],error:null,startedAt:null,micMuted:!1,outputMuted:!1},dY=()=>dK,dW={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}},dV={live:"runtime.announce.live",reconnecting:"runtime.announce.reconnecting",degraded:"runtime.announce.degraded",offline:"runtime.announce.offline"};function dJ({connection:e,resynced:t,legacy:n,compact:r,announce:i,t:a}){let s=dW[e];return(0,U.jsxs)(s_,{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 dG({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)(dJ,{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 dQ({legacy:e,compact:t}){let{t:n}=(0,eh.Ym)(),{enabled:r,connection:i,resyncedAt:a}=lf(),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":dV[i]));return r?(0,U.jsx)(dG,{connection:i,resynced:s,legacy:e,compact:t,announce:l,t:n}):null}function dX(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 dZ=n(4e3),d0=n(8744);let d1="llvKeepAwake",d2=(0,Y.createContext)(null);function d5({children:e,environment:t}){return(0,U.jsx)(d2.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(d1)==="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(d1,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 d4({children:e,environment:t}){let n=(0,Y.useContext)(d2),r=ib();return n||!r?(0,U.jsx)(U.Fragment,{children:e}):(0,U.jsx)(d5,{environment:t,children:e})}let d3={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"},d6=new Set(["unsupported","insecure"]),d8="keep-awake-caption";function d7(){let{t:e}=(0,eh.Ym)(),t=(0,Y.useContext)(d2);if(!t)return null;let{enabled:n,status:r,setEnabled:i}=t,a=d6.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":d8,title:e(d3[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)(dZ.A,{className:"h-5 w-5","aria-hidden":!0}):(0,U.jsx)(d0.A,{className:"h-5 w-5","aria-hidden":!0})})]}),(0,U.jsx)("span",{id:d8,role:"status",className:`text-[11px] leading-snug ${s?"text-warning":"text-muted"}`,children:e(d3[r])})]})}var d9=n(710),ue=n(2571),ut=n(2749);function un({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 ur({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)(un,{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")}),oK[e].map(e=>(0,U.jsx)("option",{value:e.id,children:e.label},e.id))]}),(0,U.jsxs)(un,{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:ap(c,e)},e))]}),"codex"===e?(0,U.jsxs)(un,{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 ui=[{key:"claude",label:"Claude"},{key:"codex",label:"Codex"}];function ua(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 us(){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:ua(r?.claude),codex:ua(r?.codex)}))}}).catch(()=>{}),()=>{e=!0}},[]),e}function ul(e={}){let t,{storage:n,onEngineChange:r}=e,i=e=>n?.read(e)??"",a=(e,t)=>n?.write(e,t),s=us(),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 uo({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:ui.map(({key:i,label:a})=>{let s=e===i,l=(0,tP.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 uc({draft:e,disabled:t,roomy:n,className:r}){let{t:i}=(0,eh.Ym)();return e.accounts.length?(0,U.jsx)(un,{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 ud({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)(uu,{label:r("draft.engineAria"),children:(0,U.jsx)(uo,{engine:e.engine,disabled:t,roomy:!0,onChange:e.setEngine})}),e.accounts.length?(0,U.jsx)(uu,{label:r("launch.account"),children:(0,U.jsx)(uc,{draft:e,disabled:t,roomy:!0,className:"w-full"})}):null,(0,U.jsx)(uu,{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)(ur,{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)(uo,{engine:e.engine,disabled:t,onChange:e.setEngine}),(0,U.jsx)(uc,{draft:e,disabled:t}),(0,U.jsx)(ur,{engine:e.engine,model:e.model,effort:e.effort,speed:e.speed,disabled:t,onModel:e.setModel,onEffort:e.setEffort,onSpeed:e.setSpeed})]})}function uu({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 up="claude",um="opus",uf=`## 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.`,uh=`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
|
+
${uf}
|
|
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
|
+
## Reply drafts (suggest_replies)
|
|
41
|
+
Call suggest_replies after EVERY message of yours that asks the operator something or proposes a course of action — a question, a choice between options, a plan you want a yes to, a status that ends in "shall I". Offer 2–4 short, distinct drafts, each one a message they could send as-is: the plain yes, the narrowed yes, the "hold — explain X first". Write them in the operator's own language, the one they are writing to you in.
|
|
42
|
+
They render as pills under your message and land in their composer on a tap, editable before sending — the viewer never sends one, so a draft is an offer and never a decision, and never a substitute for asking clearly in the message itself. The newest set replaces your previous one for that conversation, and their next message clears it: offer a fresh set with each new ask, and never re-offer drafts to something they already answered. A message that asks nothing needs no drafts.
|
|
43
|
+
|
|
44
|
+
## Conveyor rules
|
|
45
|
+
Drive every accepted piece of work through: GitHub issue -> worktree lane -> implementer agent -> review flow -> merge bar -> batched deploy -> cleanup.
|
|
46
|
+
- One lane (worktree + branch) per issue; one owner per file across active worktrees.
|
|
47
|
+
- Spawn implementers via POST /api/spawn with title = a semantic task name, src = YOUR transcript path (lineage draws the diagram edges), and role per the role table; workers end with "REVIEW_READY: <PR url>".
|
|
48
|
+
- 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".
|
|
49
|
+
- Merge bar: merge only on an APPROVE verdict with green gates (tsc + tests). Never merge red.
|
|
50
|
+
- Keep task cards updated via /api/tasks. Report state changes as bridge reports.
|
|
51
|
+
|
|
52
|
+
## Pipeline stage contract
|
|
53
|
+
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.
|
|
54
|
+
|
|
55
|
+
## Start-by-default pipeline contract
|
|
56
|
+
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.
|
|
57
|
+
|
|
58
|
+
## Deploys
|
|
59
|
+
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.
|
|
60
|
+
1. Prepare: merges landed on origin/main, gates green. Never deploy red.
|
|
61
|
+
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.
|
|
62
|
+
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.
|
|
63
|
+
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.
|
|
64
|
+
|
|
65
|
+
## Fences
|
|
66
|
+
- Operate exclusively through the viewer API and MCP tools (spawn, flows, pipelines, tasks, files, agent/snapshot, tmux). No direct process or runtime manipulation.
|
|
67
|
+
- If this checkout carries an llv-conveyor skill, it is your playbook; otherwise the conveyor rules above are the playbook.
|
|
68
|
+
- Replacing manual spawns is a non-goal: the user's own agents keep working; you coordinate, you do not take over.
|
|
69
|
+
- Re-derive board state per turn from bounded snapshots rather than accumulating it in context.`;var ux=n(6408);function ug(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 ub(e){let{status:t}=e,n=t?.seat&&t.exists?t.seat:null,r=t?.pending??null,i=uw(t,e.submitFailure),a=r?.intent.error??null;if(n?.conversationId){var s;let t=uy(e.file,e.surface);return{kind:"live",seat:n,conversationId:n.conversationId,liveness:t,attention:e.file?eB(e.file,e.now):null,bindFailure:"resolving"!==(s={liveness:t,hostLive:!0===e.hostLive,file:e.file,unboundForMs:e.unboundForMs??null}).liveness||!s.hostLive||null===s.unboundForMs||s.unboundForMs<1e4?null:s.file?"surface":"catalog",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 uv(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 uw(e,t){return!t||uk(e,t.clientRequestId)?null:{error:t.error,retry:"ambiguous"===t.kind?"same":"fresh"}}function uy(e,t){return"resume"===t?"resumable":"dead"===t||"superseded"===t||"inert"===t||"shell"===t?"dead":e&&null!==t&&"unresolved"!==t?"stalled"===e.activity?"stalled":"live":"resolving"}function uk(e,t){return!!e&&!!t&&(e.seat?.intent.clientRequestId===t||e.pending?.intent.clientRequestId===t&&null!==e.pending.intent.error)}function uj(){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 uN(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 uS({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,tP.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)(s_,{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)(s_,{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)(uC,{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)(ue.A,{className:"h-3 w-3 animate-spin","aria-hidden":!0}):(0,U.jsx)(ut.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)(ux.A,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),(0,U.jsx)("span",{className:"truncate",children:c("orchPanel.predecessor")})]}):null]})}function uC({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)}%`}})})]})}let uA=e=>"string"==typeof e&&e?e:null,uI=e=>"number"==typeof e&&Number.isFinite(e)?e:null;var uM=n(9680);async function uT(e){try{if("u">typeof navigator&&navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}return!1}function uP({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 uT(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)(sO.Jl,{className:"h-3.5 w-3.5 text-success","aria-hidden":!0}):(0,U.jsx)(sO.QR,{className:"h-3.5 w-3.5","aria-hidden":!0}),e(r?"attach.copied":"attach.copy")]})]})}function u$({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)(sO.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)(sO.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)(sO.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)(sO.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)(uP,{t:e,label:e("attach.copy"),value:i.command}),(0,U.jsx)(uP,{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)(sO.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 uT(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)(sO.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)(uP,{t:e,label:e("attach.copyCwd"),value:r.cdCommand}),(0,U.jsx)(uP,{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)(as.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 uT(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)(sO.QR,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",e("attach.copyFull")]}),c,d]})]}):null]})})}function uE({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)(u$,{t:r,loading:d,error:o,command:i,live:s,onClose:t,onSecondary:()=>void x(),secondaryBusy:p,secondaryError:f})}function uR(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 uO(e){return"live"===e.activity&&(!e.lastTurn||null===e.lastTurn.endedAt)}function uD(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)(lK,{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)(sO.kr,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):s})})}function u_({t:e,surface:t}){let n=(()=>{switch(t){case"structured":return null;case"live-subagent":return{icon:(0,U.jsx)(sO.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)(sO.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)(sO.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)(sO.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 uF(e,t,n,r){let i=rh(t);return i?e(i):"unsupported-capability"===r?e("receipt.human.unsupportedCapability"):n??e("composer.failedCompact")}function uq({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)(sO.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)(sO.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)(sO.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)(sO.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)(sO.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)(u_,{t:e,surface:x}),v,w,g?null:y,g?null:k,b?(0,U.jsx)(lK,{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)(uM.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 uz({file:e}){var t;let{t:r}=(0,eh.Ym)(),i=ib(),{caps:a,attachMode:s,structuredSession:l}=cO(e),o=(0,Y.useRef)(null),[c,d]=(0,Y.useState)("full"),[u,p]=(0,Y.useState)(!1),[m,f]=(0,Y.useState)(!1),[h,x]=(0,Y.useState)(!1),[g,b]=(0,Y.useState)(!1),[v,w]=(0,Y.useState)(!1),y=(0,Y.useRef)(null),[k,j]=(0,Y.useState)(null),[N,S]=(0,Y.useState)(!1),[C,A]=(0,Y.useState)(null),I=()=>{A(null),j(null)},M=async()=>{if("live"===s)return void S(!0);I();try{let t=await fetch(`/api/attach-command?path=${encodeURIComponent(e.path)}`),i=await t.json();if(t.ok&&i.fullCommand){let{copyText:e}=await Promise.resolve().then(n.bind(n,8074));if(await e(i.fullCommand))return void A({kind:"ok",text:r("attach.copiedFull")})}}catch{}S(!0)},T=(0,Y.useCallback)(e=>{if(o.current?.disconnect(),o.current=null,!e||"u"<typeof ResizeObserver)return;let t=new ResizeObserver(e=>{let t=e[0]?.contentRect.width??999;d(t>=430?"full":t>=300?"narrow":"mini")});t.observe(e),o.current=t},[]);(0,Y.useEffect)(()=>{if(!v)return;let e=window.setTimeout(()=>w(!1),4e3);return()=>window.clearTimeout(e)},[v]);let P=l?.session.hostKind==="claude-broker",$=(t=k?l?.receipts.find(e=>"compact"===e.kind&&e.operationId===k):void 0)?"delivered"===t.status?{kind:"ok",text:r("composer.compactObserved")}:"uncertain"===t.status?{kind:"info",text:r(rh(t.reason)?rh(t.reason):"receipt.human.compactSentUnobserved")}:"rejected"===t.status||"failed"===t.status?{kind:"err",text:uF(r,t.reason,void 0,void 0)}:null:null;if(!cR.some(e=>"hidden"!==a.controls[e].state))return null;let E=async()=>{if(!m){f(!0),I();try{var t,n;let i=l?await (t=l.session.conversationId,n=rg(),ly("/api/runtime/interrupt",{conversationId:t,operationId:n})):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}});A(i.ok?{kind:"interrupt",turnStartedAt:e.lastTurn?.startedAt??null}:{kind:"err",text:i.error??r("composer.failedInterrupt")})}catch{A({kind:"err",text:r("common.serverUnavailable")})}finally{f(!1)}}},R=async()=>{if(!g){b(!0),I();try{await lk()||A({kind:"err",text:r("deadHost.recheckFailed")})}finally{b(!1)}}},O=async()=>{if(!v)return void w(!0);if(w(!1),h)return;x(!0),I();let t=y.current??rg();y.current=t;try{let n=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"compact",path:e.path,operationId:t})}),i=await n.json(),a=i.receipt?.status==="rejected"||i.receipt?.status==="failed",s=n.ok&&!!i.ok&&!a;(s||a)&&(y.current=null),j(s?t:null),A(s?{kind:"ok",text:r(P?"composer.compactSentClaude":"composer.compactSent")}:{kind:"err",text:uF(r,i.receipt?.reason,i.error,i.code)})}catch{A({kind:"err",text:r("common.serverUnavailable")})}finally{x(!1)}};return(0,U.jsxs)("div",{ref:T,children:[(0,U.jsx)(uq,{t:r,isMobile:i,caps:a,layout:c,compactArmed:v,stopBusy:m,compactBusy:h,recheckBusy:g,overflowOpen:u,onStop:()=>void E(),onCompact:()=>void O(),onRecheck:()=>void R(),onTerminal:()=>void M(),onToggleOverflow:()=>p(e=>!e),status:$??(C&&"interrupt"===C.kind?(e.lastTurn?.startedAt??null)!==C.turnStartedAt?null:uO(e)?{kind:"ok",text:r("composer.escapeSentWaiting")}:{kind:"ok",text:r("composer.escapeSent")}:C)}),N?(0,U.jsx)(uE,{file:e,mode:s,onClose:()=>S(!1)}):null]})}var uH=n(7990),uU=n(4760);let uB=new Set,uK=null,uY=null,uW=null,uV=null,uJ=!1,uG=!1,uQ=!1,uX=!1,uZ=0,u0=new Map;function u1(e,t){return e&&t(e),null}function u2(){uZ+=1,uV?.close(),uV=null,u0=new Map}function u5(){uK=u1(uK,clearInterval)}async function u4(){if(0!==uB.size){if(uJ){uG=!0;return}uJ=!0;try{let e=[...uB];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(uB.has(t))if(a)t.onChunk({transportError:!0});else{let n=i[String(e)];n&&t.onChunk(n)}}}}finally{uJ=!1,uG&&(uG=!1,u4())}}}function u3(){uQ||(uQ=!0,setTimeout(()=>{uQ=!1,uX&&u4()},0))}function u6(){0!==uB.size&&(u2(),uX=!0,null===uK&&(uK=setInterval(()=>void u4(),1200)),u3(),uY=u1(uY,clearTimeout),uY=setTimeout(()=>{uY=null,0!==uB.size&&(uX=!1,u5(),u7(0))},6e4))}function u8(){if(uW=u1(uW,clearTimeout),0===uB.size)return;if("u"<typeof EventSource||uB.size>64)return void u6();uX=!1,u5(),uY=u1(uY,clearTimeout),u2();let e=uZ,t=[...uB],n=t.map((e,t)=>({id:String(t),path:e.path,offset:e.getOffset()}));u0=new Map(n.map((e,n)=>[e.id,t[n]]));let r=new EventSource(`/api/logs/stream?subs=${encodeURIComponent(JSON.stringify(n))}`);uV=r,r.addEventListener("chunk",t=>{let n;if(e===uZ&&r===uV){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=u0.get(i))&&uB.has(e)&&e.onChunk(a)}}}),r.onerror=()=>{if(e===uZ&&r===uV){for(let e of uB)e.onChunk({transportError:!0});u6()}}}function u7(e=300){uX?u3():(uW=u1(uW,clearTimeout),uW=setTimeout(u8,e))}let u9=e=>new TextEncoder().encode(e).length,pe=new Map;function pt(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+u9(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 pn(e,t){let n=pe.get(e);if(!n)return null;pe.delete(e);let r=pt(n,t);return pe.set(e,r),r}var pr=n(4962),pi=n(4890);let pa={starting:ue.A,binding:ue.A,queued:cj.A,reconciling:ue.A,"recoverable-timeout":cj.A,"live-late-success":pr.A,failed:pi.A,recovered:pr.A};function ps({launch:e,t,onRetry:n}){var r,i;let a=pa[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)(sD.A,{className:"h-3 w-3","aria-hidden":!0})," ",t("launchHistory.retryLabel")]}):null]})}function pl({launch:e,onRetry:t}){let{t:n}=(0,eh.Ym)();return(0,U.jsx)(ps,{launch:e,t:n,onRetry:t})}let po=/(?:\/\.codex\/sessions\/|\/\.claude\/projects\/|\/\.claude\/plugins\/data\/codex-openai-codex\/state\/|^\/tmp\/claude-\d+\/)/;function pc({status:e,className:t}){let n=t??"h-3.5 w-3.5";return"ok"===e?(0,U.jsx)(sO.Jl,{className:n,"aria-hidden":!0}):"err"===e?(0,U.jsx)(sO.X,{className:n,"aria-hidden":!0}):(0,U.jsx)(sO.kr,{className:`${n} animate-spin motion-reduce:animate-none`,"aria-hidden":!0})}function pd({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 po.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 pu=n(8074);function pp({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,nA.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)(a$.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)(aE.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)(sO.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 pm="opacity-70 transition-opacity motion-reduce:transition-none hover:opacity-100 focus-visible:opacity-100 group-hover/msg:opacity-100",pf="pr-[28px] [@media(pointer:coarse)]:pr-[50px]";var ph=n(3194);let px=String.raw`(?:\\.|[^)\s\\])+`,pg=String.raw`!\[[^\]]*\]\(${px}\)`,pb=String.raw`\[[^\]]+\]\(${px}\)`,pv=RegExp(`(${pg}|\`[^\`]+\`|\\*\\*[^*]+\\*\\*|${pb}|https?://[^\\s<>"')\\]]+)`,"g"),pw=new RegExp(String.raw`^\s*!\[([^\]]*)\]\((${px})\)\s*$`),py=new RegExp(String.raw`^!\[([^\]]*)\]\((${px})\)$`),pk=new RegExp(String.raw`^\[([^\]]+)\]\((${px})\)$`);function pj({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,ph.tr)("common.copied"):(0,ph.tr)("common.clickToCopy"),onClick:t=>{t.preventDefault(),t.stopPropagation(),(0,pu.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 pN({code:e,lang:t,copyLabel:n}){let r=aU(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] ${pf}`,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] ${pf}`,children:e}),(0,U.jsx)(pu.i,{text:e,label:n??(0,ph.tr)("feed.copyCode"),className:`absolute right-[6px] top-[6px] ${pm} group-hover/code:opacity-100`})]})}let pS="break-all text-accent underline decoration-accent/40 underline-offset-2 hover:decoration-accent";function pC({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,ak.fn)(s))return(0,U.jsx)("a",{href:(0,aP.Fe)(s),title:a,className:pS,onClick:e=>{e.preventDefault();for(let e of[...aD])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:pS,children:t})}function pA({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)(pC,{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)(pp,{src:s,alt:e,caption:e||void 0,onClose:()=>r(!1)}):null]})}function pI({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)(pA,{alt:e.alt,src:e.src},t))})}function pM(e){return e.split(pv).map((e,t)=>{if(!e)return null;if(e.startsWith("`")&&e.endsWith("`"))return(0,U.jsx)(pj,{text:e.slice(1,-1)},t);if(e.startsWith("**")&&e.endsWith("**"))return(0,U.jsx)("b",{children:pM(e.slice(2,-2))},t);let n=e.match(py);if(n)return(0,U.jsx)(pA,{alt:n[1],src:n[2]},t);let r=e.match(pk);if(r)return(0,U.jsx)(pC,{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)(pC,{href:n,label:i}),r]},t)}return e})}let pT=/^\s*\|.*\|\s*$/,pP=/^:?-{1,}:?$/;function p$({rows:e}){let t=e.map(e=>e.trim().replace(/^\|/,"").replace(/\|$/,"").split("|").map(e=>e.trim())),n=t.length>1&&t[1].every(e=>pP.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:pM(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:pM(e)},t))},t))})]})})}let pE=/^\s*```/,pR=/^\s*```\s*$/;function pO(e){return e.match(/^\s*```+\s*([A-Za-z0-9+#_-]+)/)?.[1]??null}function pD(e,t){let n=e.match(/^#{1,6}\s+(.*)$/);if(n)return(0,U.jsx)("span",{className:"text-[14px] font-bold",children:pM(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:pM(r[1])},t):(0,U.jsx)(Y.Fragment,{children:pM(e)},t)}function pL(e){let t=e.split("\n"),n=[],r=0;for(;r<t.length;){if(pE.test(t[r])){let e=r,i=pO(t[r]);for(r++;r<t.length&&!pR.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)(pN,{code:a,lang:i},`c${e}`));continue}if(pT.test(t[r])){let e=r;for(;r<t.length&&pT.test(t[r]);)r++;"\n"===n[n.length-1]&&n.pop(),n.push((0,U.jsx)(p$,{rows:t.slice(e,r)},`t${e}`));continue}if(pw.test(t[r])){let e=r,i=[];for(;r<t.length;){let e=t[r].match(pw);if(!e)break;i.push({alt:e[1],src:e[2]}),r++}"\n"===n[n.length-1]&&n.pop(),n.push((0,U.jsx)(pI,{images:i},`i${e}`));continue}n.push(pD(t[r],r)),++r<t.length&&n.push("\n")}return n}function p_({nodes:e}){return e}function pF(){return{chunks:[],keys:0}}function pq(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 pz(e){let t=e.chunks[e.chunks.length-1];t.element=(0,U.jsx)(p_,{nodes:t.nodes},t.key)}function pH(e){return e.chunks.map(e=>e.element)}function pU(){return{stableChars:0,stableLines:0,lineStart:!0,region:pF(),run:null,sep:!1,provisional:!1,anchor:"",source:"",streaming:!1,rendered:null,keys:0}}function pB(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)(pI,{images:n.images},`i${n.key}`),block:!0}:"table"===n.kind?!r&&n.rows.length<2?{node:pD(n.rows[0],`p${n.key}`),block:!1}:{node:(0,U.jsx)(p$,{rows:n.rows},`t${n.key}`),block:!0}:r?(n.joined??=n.code.join("\n"),{node:(0,U.jsx)(pN,{code:n.joined,lang:n.lang},`c${n.key}`),block:!0}):{node:(0,U.jsx)(p_,{nodes:pH(n.body)},`f${n.key}`),block:!1});!l&&i.sep&&a.nodes.push("\n"),a.nodes.push(s),e.sep=!l,pz(e.region)}function pK(e){pB(e,!0),e.run=null,e.provisional=!1}function pY(e,t,n){let r=pq(e.body,0,!1);e.shown++>0&&r.nodes.push("\n"),r.nodes.push((0,U.jsx)(Y.Fragment,{children:t},n)),pz(e.body)}function pW(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++,pR.test(t))?void pK(e):(a.code.push(t),a.joined=null,pY(a,t,e.keys++),void pB(e,!1));if("table"===a.kind&&pT.test(t)){n.lines++,a.rows.push(t),pB(e,!1);return}if("images"===a.kind){let r=t.match(pw);if(r){n.lines++,a.images.push({alt:r[1],src:r[2]}),pB(e,!1);return}}pK(e)}let s=pq(e.region,n,e.sep);if(s.lines++,pE.test(t)){e.run={kind:"fence",slot:s.nodes.length,sep:e.sep,key:e.keys++,lang:pO(t),code:[],joined:null,body:pF(),shown:0},pY(e.run,t,e.keys++),pB(e,!1);return}if(pT.test(t)){e.run={kind:"table",slot:s.nodes.length,sep:e.sep,key:e.keys++,rows:[t]},pB(e,!1);return}let l=t.match(pw);if(l){e.run={kind:"images",slot:s.nodes.length,sep:e.sep,key:e.keys++,images:[{alt:l[1],src:l[2]}]},pB(e,!1);return}r=pD(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,pz(e.region)}function pV({text:e,streaming:t}){let[n]=(0,Y.useState)(pU);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=pU(),d=o[0].from,u=t.slice(0,d).split("\n"),p=0;for(let e=0;e<u.length-1;e++)pW(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)(p_,{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=pF(),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++)pW(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&&pK(e);let s=null;if(n){let t=r[r.length-1],n=e.run?.kind==="fence"&&pR.test(t);if(n!==e.provisional&&(pB(e,n),e.provisional=n),!n){let n=[];e.sep&&n.push("\n");let r=e.run?.kind==="fence"||pw.test(t);n.push((0,U.jsx)(Y.Fragment,{children:r?t:pM(t)},"v")),s=n}}let l=(0,U.jsxs)(U.Fragment,{children:[pH(e.region),s]});return e.source=t,e.streaming=n,e.rendered=l,l}(n,e,t)}var pJ=n(7516);let pG=/^\*{0,3}\s*(?:Add|Update|Delete) File:\s*(.+)$/;function pQ({item:e,tool:t}){let{t:n}=(0,eh.Ym)(),r=(0,Y.useMemo)(()=>(0,pJ.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(pG);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,tP.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)(sO.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)(pc,{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 pX({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)(pQ,{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})}
|
|
70
|
+
`}):n.omittedChars?(0,U.jsx)("span",{"data-live-turn-omitted-chars":!0,className:"text-muted",children:`${t("feed.liveOmittedChars",{chars:n.omittedChars})}
|
|
71
|
+
`}):null,(0,U.jsx)(pV,{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 pZ({entries:e,t,nowMs:n=0,onCancel:r,onRetry:i,switchHold:a=null,session:s=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 l=function(e,t,n,r,i){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)(cj.A,{className:"h-3 w-3","aria-hidden":!0}),className:"text-warning"};if("delivering"===t.state){let n=cy({status:t.awaitingTurn?"queued":"delivering",host:i?.host??null,turn:i?.turn??null,admittedAt:new Date(t.at).toISOString(),nowMs:r}),a=n?ck(e,n):null;return n?.phase==="uncertain"?{label:a,icon:(0,U.jsx)(as.A,{className:"h-3 w-3","aria-hidden":!0}),className:"text-danger",wait:n.phase}:a?{label:a,icon:(0,U.jsx)(cj.A,{className:"h-3 w-3","aria-hidden":!0}),className:"awaiting-host"===n.phase?"text-danger":"text-warning",wait:n.phase}:{label:e("outbox.delivering"),icon:(0,U.jsx)(sO.kr,{className:"h-3 w-3 animate-spin motion-reduce:animate-none","aria-hidden":!0}),className:"text-warning",wait:n?.phase??"transmitting"}}switch(t.state){case"failed":return{label:t.needsReattach?e("outbox.reattach"):t.error??e("outbox.failed"),icon:(0,U.jsx)(as.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)(cj.A,{className:"h-3 w-3","aria-hidden":!0}),className:"text-warning"}}}(t,e,a,n,s);return(0,U.jsx)("div",{"data-outbox-entry":e.id,"data-outbox-state":e.state,...l.wait?{"data-outbox-wait":l.wait}:{},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+(e.files??0)?(0,U.jsx)("span",{className:"mt-1 block text-caption font-semibold text-muted",children:t(e.files?"composer.attachmentsCount":"composer.imagesCount",{count:e.images+(e.files??0)})}):null]}),(0,U.jsxs)("div",{className:`flex items-center gap-1 text-caption font-semibold ${l.className}`,children:[l.icon,(0,U.jsx)("span",{"data-outbox-status":!0,className:"min-w-0 truncate",children:l.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:()=>i(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)(sD.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:()=>r(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)(sO.X,{className:"h-3 w-3","aria-hidden":!0})}):null]})]})},e.id)})}):null}function p0({cardId:e,entries:t,switchHold:n=null,session:r=null}){let{t:i}=(0,eh.Ym)(),[a,s]=(0,Y.useState)(()=>Date.now());return(0,Y.useEffect)(()=>{let e=setInterval(()=>s(Date.now()),15e3);return()=>clearInterval(e)},[]),(0,U.jsx)(pZ,{entries:t,t:i,nowMs:a,onCancel:t=>oS(e,t),onRetry:t=>{let n,r;(r=(n=ok(e)).find(e=>e.id===t))&&"failed"===r.state&&!r.needsReattach&&ob(e,n.map(e=>e.id===t?{...e,state:"queued",error:void 0}:e))},switchHold:n,session:r})}let p1=new Map,p2=new Set,p5=new Set,p4=e=>`llvAssistantClaims:${e}`;function p3({item:e}){return"sourceId"in e&&"string"==typeof e.sourceId&&e.sourceId?e.sourceId:null}function p6({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 p8(e){let t=p3(e);return[...t?[t]:[],...p6(e)]}function p7(e){let t=p1.get(e);if(t)return t;try{let t=JSON.parse(sessionStorage.getItem(p4(e))??"[]"),n=new Set(Array.isArray(t)?t.filter(e=>"string"==typeof e&&e.length>0).slice(-544):[]);return p1.set(e,n),n}catch{return p1.set(e,p5),p5}}function p9(e,t){p1.set(e,t);try{t.size?sessionStorage.setItem(p4(e),JSON.stringify([...t])):sessionStorage.removeItem(p4(e))}catch{}}function me(e){if("string"!=typeof e&&"number"!=typeof e)return null;let t=Date.parse(String(e));return Number.isFinite(t)?t:null}let mt=["launch","outbox","delta"];function mn({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)(sO.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)(sO.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)(sO.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)(pp,{src:m,alt:n("inbox.attachedAlt",{name:e}),caption:t,onClose:()=>i("thumb")}):null]})}var mr=n(3719);let mi=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]),ma=(e,t)=>e>>>t|e<<32-t;function ms(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=ma(t,7)^ma(t,18)^t>>>3,i=ma(n,17)^ma(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+(ma(o,6)^ma(o,11)^ma(o,25))+(o&c^~o&d)+mi[e]+a[e]>>>0,r=(ma(n,2)^ma(n,13)^ma(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 ml(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 mo=new WeakMap;function mc(e){let t=mo.get(e.item);if(t)return t;let n=e.text.trim(),r=[ms(n)];return n!==e.text&&r.push(ms(e.text)),mo.set(e.item,r),r}function md(e,t){let n=new Map;if(0===t.length)return n;let r=new Map;for(let t of e){let e=ml(t);if(e)for(let t of mc(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}:{},...e.mandate?{mandate:e.mandate}:{}})}return n}class mu{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 mp={forItem:()=>null},mm=(0,Y.createContext)(mp),mf=mm.Provider,mh=new mu(48),mx=[1500,4e3,1e4];function mg(e){if(!e||"object"!=typeof e||Array.isArray(e)||"operator"!==e.origin&&"agent"!==e.origin)return null;let t=(0,mr.S)(e.senderRole),n=(0,sj.po)(e.selectedContext),r=function(e){if(!e||"object"!=typeof e||Array.isArray(e))return null;let{kind:t,version:n}=e;return"custom"===t?{kind:"custom"}:"version"!==t&&"unqualified"!==t?null:"version"===t&&"number"==typeof n&&Number.isInteger(n)?{kind:"version",version:n}:{kind:"unqualified"}}(e.mandate);return{origin:e.origin,...t?{senderRole:t}:{},...n?{selectedContext:n}:{},...r?{mandate:r}:{}}}let mb=/^[a-f0-9]{64}$/;function mv(e,t,n,r){if(0===e.drivers.length)return!1;if(!t)return!0;let i=md(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 mw=new WeakMap,my=1,mk=[];function mj({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,ph.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)(sO.c9,{name:"blob",className:"h-3.5 w-3.5"})}),(0,U.jsx)("span",{className:"font-semibold",children:(0,ph.tr)("render.dataKb",{n:i})}),(0,U.jsx)("span",{className:"ml-1 text-[12px] font-semibold text-accent",children:(0,ph.tr)("common.show")})]})}let mN=new Set(["wait","write_stdin"]);function mS(e){return mN.has(e.tool)}function mC(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 mA={add:"text-diff-add",update:"text-accent",delete:"text-diff-del",move:"text-accent"};function mI({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 mM({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 ${mA[e.op]}`,children:e.op}),(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate",children:(0,U.jsx)(pd,{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)(pu.i,{text:l,label:(0,ph.tr)("tools.copyDiff"),className:`shrink-0 ${pm} 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,ph.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)(mI,{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,ph.tr)("common.collapse")," ",(0,U.jsx)(sO.rX,{className:"h-3 w-3","aria-hidden":!0})]}):(0,ph.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,ph.tr)("tools.diffTruncated")}):null]})}function mT({body:e}){return(0,U.jsxs)("div",{className:"mt-1.5 space-y-1.5",children:[e.files.map((e,t)=>(0,U.jsx)(mM,{file:e},`${e.path}:${t}`)),e.filesTruncated?(0,U.jsx)("div",{className:"text-[11px] text-muted",children:(0,ph.tr)("tools.moreFiles",{count:e.files.length})}):null]})}function mP({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)(sO.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 m$({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,ph.tr)("tools.nestedCalls")}),e.calls.map((e,t)=>(0,U.jsx)(mP,{call:e},`${e.id}:${t}`))]})}):null}function mE({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,ph.tr)("tools.copyOutput");return(0,U.jsxs)("div",{className:"group/out relative mt-1.5",children:[c,m?(0,U.jsx)(pN,{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 ${pf} ${"err"===a?"border-l-2 border-danger/50 pl-2":""}`,children:p}),m?null:(0,U.jsx)(pu.i,{text:e,label:f,className:`absolute right-[6px] ${pm} 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,ph.tr)("common.collapse")," ",(0,U.jsx)(sO.rX,{className:"h-3 w-3","aria-hidden":!0})]}):(s??(0,ph.tr)("tools.showOutput"))+(t?" \xb7 "+(0,ph.tr)("render.truncated"):"")}):t?(0,U.jsx)("div",{className:"mt-1 text-[11px] text-muted",children:(0,ph.tr)("render.truncated")}):null]})}function mR(e){return"ok"===e?"text-success":"err"===e?"text-danger":"text-muted"}function mO({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 mD({event:e}){let t=(0,tP.T0)(e.ts),n=void 0!==e.endTs?(0,tP.T0)(e.endTs):"",r=n&&t?(0,ph.tr)("tools.ranAt",{start:t,end:n}):"",i=void 0!==e.durationMs?mC(e.durationMs):"",a=void 0!==e.exitCode?(0,ph.tr)("tools.exitCode",{code:e.exitCode}):"err"===e.status?e.statusLabel||(0,ph.tr)("render.error"):"ok"===e.status&&"shell"===e.family?(0,ph.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 ${mR(e.status)}`,children:[(0,U.jsx)(pc,{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)(sO.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)(pu.i,{text:e.cwd,label:(0,ph.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 ${pf}`,children:[(0,U.jsx)("span",{className:"select-none text-muted",children:"$ "}),e]}),(0,U.jsx)(pu.i,{text:e,label:(0,ph.tr)("tools.copyCommand"),className:`absolute right-[6px] top-[6px] ${pm} group-hover/cmd:opacity-100`})]})}function m_({event:e}){let t=e.body?.type==="diff",n=!(mS(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)(mO,{chips:e.chips}),(0,U.jsx)(mD,{event:e}),e.command?(0,U.jsx)(mL,{command:e.command}):null,e.orchestration?(0,U.jsx)(m$,{orchestration:e.orchestration,source:e.command}):null,t&&e.body?.type==="diff"?(0,U.jsx)(mT,{body:e.body}):null,n?(0,U.jsx)(mE,{output:e.outputPreview,truncated:e.outputTruncated,lang:e.lang,heading:void 0!==e.stderr?(0,ph.tr)("tools.stdout"):void 0}):null,void 0!==e.stderr?(0,U.jsx)(mE,{output:e.stderr,truncated:!!e.stderrTruncated,heading:(0,ph.tr)("tools.stderr"),tone:"err",copyLabel:(0,ph.tr)("tools.copyStderr"),showAllLabel:(0,ph.tr)("tools.showStderr")}):null]})}function mF({events:e,session:t,elapsedMs:n}){let r=e.length,i="number"==typeof n&&n>0?mC(n):"",a=[(0,ph.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)(sO.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 mq({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)(sO.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 ${mR(e.status)}`,children:[(0,U.jsx)(pc,{status:e.status,className:"h-3 w-3"}),e.statusLabel]}):null]}),(0,U.jsx)(m_,{event:e})]})}function mz({event:e,showTime:t=!0,className:n="",index:r,nested:i=!1}){let[a,s]=(0,Y.useState)(e.open),l=(0,tP.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)(sO.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 ${mR(e.status)}`,children:[(0,U.jsx)(pc,{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)(m_,{event:e}):null]})}function mH({event:e}){return(0,U.jsx)(mz,{event:e,className:"ml-9"})}function mU({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,tP.T0)(e.t0),u=(0,tP.T0)(e.t1),p=d&&u&&d!==u?`${d}–${u}`:d||u,m=function(e){let t=[];for(let n of e){if(mS(n)){let e=function(e,t){if(void 0!==t.session){for(let n=e.length-1;n>=0;n-=1)if((0,ph.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)(sO.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,ph.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)(pc,{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)(mq,{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)(mF,{events:e.events,session:e.session,elapsedMs:e.elapsedMs},`poll:${t}`):(0,U.jsx)(mq,{event:e.event,nested:!0},`${e.event.id}:${t}`))}):null]},`${e.parent.id}:${t}`)})}):null]})}function mB({item:e}){let t=[e.trigger?(0,ph.tr)("auto"===e.trigger?"render.compactAuto":"render.compactManual"):"",e.preTokens?(0,ph.tr)("render.compactPre",{n:Math.round(e.preTokens/1e3)}):"",(0,tP.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)(sO.c9,{name:"compact",className:"h-3.5 w-3.5"}),(0,ph.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,ph.tr)("render.compactSummary")," \xb7 ",(0,ph.tr)("common.show")]}),(0,U.jsx)("span",{className:"hidden group-open/cmp:inline",children:(0,ph.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 mK({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,ph.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)(sO.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,ph.tr)("common.kb")]}),(0,U.jsx)("span",{className:"ml-1 text-[12px] font-semibold text-accent",children:(0,ph.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,ph.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,ph.tr)("common.collapse")}),"full"===a?(0,U.jsx)(pp,{src:c,alt:`${(0,ph.tr)("render.image")} ${o}`,caption:`${o} \xb7 ${l} ${(0,ph.tr)("common.kb")}`,onClose:()=>s("thumb")}):null]})}let mY=["## Handoff from your predecessor","## Rotation history"],mW=/^#{1,2} /;function mV({item:e}){var t;let n,r,i=(n=(t=e.text).split("\n").length,(r=function(e){let t=0,n=-1;for(let r of e.split("\n")){let e=mY.some(e=>r.startsWith(e));if(n<0)e&&(n=t);else if(!e&&mW.test(r))return{start:n,end:t};t+=r.length+1}return n<0?null:{start:n,end:e.length}}(t))?{lines:n,mandate:[t.slice(0,r.start).trim(),t.slice(r.end).trim()].filter(Boolean).join("\n\n"),handoff:t.slice(r.start,r.end).trim()}:{lines:n,mandate:t.trim(),handoff:null}),a=(0,ph.tr)("mandateCard.title"),s="version"===e.mandate.kind?(0,ph.tr)("mandateCard.version",{version:e.mandate.version}):"custom"===e.mandate.kind?(0,ph.tr)("mandateCard.custom"):null;return(0,U.jsxs)("div",{className:"my-3 ml-9 overflow-hidden rounded-surface border border-border bg-card shadow-1","data-mandate-card":!0,children:[(0,U.jsxs)("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-0.5 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-sunken text-muted",children:(0,U.jsx)(sO.c9,{name:"plan",className:"h-3.5 w-3.5"})}),(0,U.jsx)("span",{className:"text-[13px] font-semibold",children:s?`${a} ${s}`:a}),(0,U.jsxs)("span",{className:"text-[11px] text-muted",children:["\xb7 ",(0,ph.tr)("mandateCard.lines",{count:i.lines})," \xb7 ",(0,ph.tr)("mandateCard.sent")]}),(0,U.jsxs)("span",{className:"ml-auto flex shrink-0 items-center gap-1",children:[(0,U.jsx)(pu.i,{text:e.text,label:(0,ph.tr)("feed.copyMd"),className:pm}),(0,tP.T0)(e.ts)?(0,U.jsx)("span",{className:"text-label tabular-nums text-muted",children:(0,tP.T0)(e.ts)}):null]})]}),(0,U.jsxs)("div",{className:"px-3.5 pb-2.5 pt-1",children:[(0,U.jsx)(mJ,{label:(0,ph.tr)("mandateCard.readMandate"),text:i.mandate}),i.handoff?(0,U.jsx)(mJ,{label:(0,ph.tr)("mandateCard.handoff"),text:i.handoff,icon:(0,U.jsx)(sO.kt,{className:"h-3 w-3 shrink-0 text-muted","aria-hidden":!0}),className:"mt-1.5 border-t border-border pt-1.5"}):null]})]})}function mJ({label:e,text:t,icon:n,className:r=""}){let[i,a]=(0,Y.useState)(!1);return(0,U.jsxs)("details",{className:`group/section text-[13px] ${r}`,onToggle:e=>{e.currentTarget.open&&a(!0)},children:[(0,U.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-1 rounded-control py-0.5 text-[12.5px] font-semibold text-secondary hover:text-accent [@media(pointer:coarse)]:min-h-11 [&::-webkit-details-marker]:hidden",children:[(0,U.jsx)(sO.c_,{className:"h-3 w-3 shrink-0 transition-transform group-open/section:rotate-90","aria-hidden":!0}),n,(0,U.jsx)("span",{children:e})]}),i?(0,U.jsx)("div",{className:"mt-1 whitespace-pre-wrap break-words border-t border-border pt-1.5",children:pL(t)}):null]})}function mG({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)(sO.c9,{name:"citation",className:"h-3.5 w-3.5"})}),(0,U.jsx)("span",{className:"text-[13px] font-semibold",children:(0,ph.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,ph.tr)("common.show")}),(0,U.jsx)("span",{className:"ml-auto hidden text-[11px] font-semibold text-accent group-open:inline",children:(0,ph.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)(pd,{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,ph.tr)("render.noCitations")}),e.entries.length>t.length?(0,U.jsx)("div",{className:"mt-1.5 text-[12px] text-muted",children:(0,ph.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)(sO.c_,{className:"h-3 w-3 transition-transform group-open/raw:rotate-90","aria-hidden":!0}),"raw citation block",e.truncated?" \xb7 "+(0,ph.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 mQ={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 mX(e){return"string"==typeof e&&e.length?e:void 0}function mZ({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,ph.tr)("render.approved"):(0,ph.tr)("render.rejected")})}function m0({payload:e}){let t=mX(e.from),n=mX(e.requestId),r=(0,tP.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,ph.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 m1({payload:e}){let t=mX(e.type),n=t?mQ[t]:void 0;if(!n)return(0,U.jsxs)("div",{className:"text-[13px]",children:[(0,U.jsx)("div",{className:"text-muted",children:(0,ph.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,ph.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=mX(e.reason)??mX(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)(sO.c9,{name:n.icon,className:"h-3.5 w-3.5"}),(0,ph.tr)(n.labelKey)]}),void 0!==r?(0,U.jsx)(mZ,{approve:r}):null]}),i?(0,U.jsx)("div",{className:"mt-1.5 whitespace-pre-wrap break-words",children:pL(i)}):null,(0,U.jsx)(m0,{payload:e})]})}function m2({verdict:e}){let t="REQUEST_CHANGES"===e?sO.MA:"APPROVE"===e?sO.rW:sO.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 m5({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)(sO.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)(m2,{verdict:e.verdict})}):null,(0,U.jsx)("span",{className:"text-[11px] text-muted",children:n?`${n} finding${1===n?"":"s"}`:(0,ph.tr)("render.noFindings")}),(0,tP.T0)(e.ts)?(0,U.jsx)("span",{className:"ml-auto text-label tabular-nums text-muted",children:(0,tP.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)(pd,{file:e.file,line:e.line}):null]}),(0,U.jsx)("div",{className:"mt-1.5 whitespace-pre-wrap break-words text-[13px]",children:pM(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,ph.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)(sO.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 m4({item:e}){let t=(0,tP.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)(sO.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,ph.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,ph.tr)("render.recordDetails")}),e.truncated?(0,U.jsx)("span",{className:"rounded-md bg-sunken px-1.5 py-0.5",children:(0,ph.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 m3({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)(sO.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,ph.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 m6=n(3550);function m8(e,t){return new Date(e).toLocaleTimeString("uk"===t?"uk-UA":"en-US",{hour:"2-digit",minute:"2-digit",hour12:!1})}function m7(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 m9({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)(mE,{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 fe({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,m6.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?m8(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=m7(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)(sO.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)(m9,{event:e,wakeup:t}):null]})}var ft=n(852),fn=n(1189),fr=n(1691);let fi=/(?:^|\n)(?:(?: {4}|\t)[^\n]*(?:\n|$))+/g,fa=/[.!?…]["'”’)\]]*(?=\s)/g;function fs(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 fl=Math.ceil(50)+1,fo=16384*Math.ceil(1360),fc=new Map,fd=0,fu=new Set,fp=new Set;function fm(){for(let e of[...fp])e()}function ff(e,t){return`${e.id}\0${e.model}\0${e.voice}\0${t}`}class fh extends Error{constructor(e,t){super(t??`TTS request failed (${e})`),this.status=e,this.provider=t,this.name="TtsRequestError"}}class fx extends Error{constructor(e){super("audio playback failed",{cause:e}),this.name="TtsPlaybackError"}}async function fg(e){try{let t=await e.json();return"string"==typeof t.error&&t.error?t.error:null}catch{return null}}async function fb(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 fh(i.status,await fg(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 fh(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 fv{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=fc.get(t))?(fc.delete(t),fc.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=fc.get(e);if(r)return r;let i={url:URL.createObjectURL(t),bytes:t.size,alignment:n};for(fc.set(e,i),fd+=i.bytes;fc.size>fl||fd>fo&&fc.size>1;){let e=fc.entries().next().value;if(!e)break;fc.delete(e[0]),fd-=e[1].bytes,URL.revokeObjectURL(e[1].url)}return fm(),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 fx),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 fx(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 fw(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 fy({anchorRef:e,onDismiss:t,children:n}){let r=(0,Y.useRef)(null),{style:i,onScreen:a}=fw(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,nA.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 fk({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=ib(),p=(0,Y.useRef)(null),{style:m}=fw(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),fp.add(e),()=>{fp.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,nA.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)(sO.kr,{className:"h-3.5 w-3.5 animate-spin text-muted","aria-hidden":!0}):n?(0,U.jsx)(sO.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 fj="tts-karaoke",fN=/[\p{L}\p{N}][\p{L}\p{N}'’-]*/gu,fS=new Set(["SCRIPT","STYLE","PRE","CODE","TEXTAREA"]);function fC(e){let t=[];fN.lastIndex=0;for(let n=fN.exec(e);n;n=fN.exec(e))t.push({start:n.index,end:n.index+n[0].length,key:n[0].toLowerCase()});return t}function fA(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 fI=null,fM=null,fT=null,fP=new Set;function f$(e=!1){return!e&&fM?Promise.resolve(fM):(e&&(fT=null),fT??=fetch("/api/tts/backend").then(e=>{if(!e.ok)throw Error("TTS configuration unavailable");return e.json()}).then(e=>(fE(e),e)).catch(e=>{throw fT=null,e}))}function fE(e){for(let t of(fM=e,fT=Promise.resolve(e),fP))t(e)}function fR(){let e=fI;fI=null,e?.()}function fO({text:e}){let{locale:t,t:n}=(0,eh.Ym)(),r=ib(),[i,a]=(0,Y.useState)(fM),[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=fs(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=[];fa.lastIndex=0;for(let t=fa.exec(e);t;t=fa.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=fs(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=fs(e,i,t);if(a&&r.push(a),i=t,t>=n)break}let a=fs(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 fP.add(n),f$().then(t=>{e&&a(t)}).catch(()=>{e&&c((0,eh.Tl)(t,"tts.configError"))}),()=>{e=!1,fP.delete(n),v.current=!1,b.current+=1,fI===w.current&&fR()}},[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=ff(i.options.find(e=>e.id===i.backend),e),C=()=>{var e;return fu.has(S)&&(e=g.map(e=>ff(N,e.text))).length>0&&e.every(e=>fc.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 fE(n),a(n),!0}catch{return!1}},P="idle"!==d,$=P?ft.A:A?fn.A:cq.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;fR();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&&!fS.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=fC(t),i=fC(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=fA(n,i[s].start),c=fA(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(fj,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(fj)}}}(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;fI===f&&(fI=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 fv({chunks:g,key:(e,t)=>ff(t??N,e),synthesize:fb,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)}f$(!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 fh?e.provider??n("tts.requestError",{status:e.status}):e instanceof fx?n("tts.playError"):n("tts.requestFailed");s()&&(c(t),m(t)),f(!1)},onEnd:()=>{var t=d?ff(d,e):S;for(fu.delete(t),fu.add(t);fu.size>200;){let e=fu.values().next().value;if(void 0===e)break;fu.delete(e)}fm(),s()&&(x(e=>e+1),m(n("tts.finished"))),f(!1)}});for(let e of(w.current=f,fI=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),f$(!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)(fk,{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)(fy,{anchorRef:y,onDismiss:j,children:o}):null]})}var fD=n(9383),fL=n(6420),f_=n(2841),fF=n(8747),fq=n(3769),fz=n(4825),fH=n(4551),fU=n(5484),fB=n(5606);let fK={bot:d9.A,message:fD.A,task:fL.A,pipeline:f_.A,link:fF.A,conversation:fq.A,deploy:fz.A,tool:uH.A};function fY(e){return e&&"object"==typeof e&&!Array.isArray(e)?e:{}}function fW({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)(fH.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)(fH.A,{className:"h-3 w-3","aria-hidden":!0}):(0,U.jsx)(ay.A,{className:"h-3 w-3","aria-hidden":!0}),e.label]})}function fV({event:e,availableConversationIds:t}){var n;let r,i,a,s=e.mcp,l=s?.result,o=(0,Y.useMemo)(()=>(0,fB.Y)(s?.toolName??e.tool,s?.args??{},l),[e.tool,s?.args,s?.toolName,l]),c=function(e){let[t,n]=(0,Y.useState)(rL);return(0,Y.useEffect)(()=>{if(!e)return rD.add(n),()=>rD.delete(n)},[e]),e?{loaded:!0,ids:e}:t}(t),d="run"===e.status?"pending":"err"===e.status?"error":"success",u=fK[o.icon],p=!0===fY(l).replayed||!0===fY(l).replay,m=!0===fY(l).retryable,f="error"===d?(n=e.outputPreview,i="string"==typeof(r=fY(l)).error?r.error.trim():"",a="string"==typeof fY(r.error).message?String(fY(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)(fW,{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)(ue.A,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):"success"===d?(0,U.jsx)(pr.A,{className:"h-3.5 w-3.5","aria-hidden":!0}):(0,U.jsx)(fU.A,{className:"h-3.5 w-3.5","aria-hidden":!0})}),(0,tP.T0)(e.ts)?(0,U.jsx)("span",{className:"shrink-0 text-caption tabular-nums text-muted",children:(0,tP.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 fJ(e,t,n){return{kind:"mandate",ts:e,text:t,mandate:n}}function fG(e,t,n){return{kind:"tmsg",ts:e,dir:"in",peer:n??(0,ph.tr)("render.agentPeer"),summary:"",text:t,internal:!0}}let fQ=(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?.mandate?fJ(e.ts,e.text,n.mandate):n?.origin==="agent"?fG(e.ts,e.text,n.senderRole):e}if("sysmsg"!==e.kind||!e.deliveredMessage)return e;let n=t.forItem(e);return n?.mandate?fJ(e.deliveredMessage.ts,e.text,n.mandate):n?.origin==="agent"?fG(e.deliveredMessage.ts,e.text,n.senderRole):n?.origin==="operator"?{kind:"user",ts:e.deliveredMessage.ts,text:e.text,...n.selectedContext?{selectedContext:n.selectedContext}:{}}:e}(e,(0,Y.useContext)(mm));if("image"===n.kind)return(0,U.jsx)(mK,{media:n.media,data:n.data,w:n.w,h:n.h,bytes:n.bytes});if("inbox-image"===n.kind)return(0,U.jsx)(mn,{name:n.name,path:n.path});if("blob"===n.kind)return(0,U.jsx)(mj,{bytes:n.bytes,text:n.text});if("sysmsg"===n.kind)return(0,U.jsx)(m3,{label:n.label,text:n.text});if("mandate"===n.kind)return(0,U.jsx)(mV,{item:n});if("compact"===n.kind)return(0,U.jsx)(mB,{item:n});if("review"===n.kind)return(0,U.jsx)(m5,{item:n});if("record"===n.kind)return(0,U.jsx)(m4,{item:n});if("mem-citation"===n.kind)return(0,U.jsx)(mG,{item:n});if("prose"===n.kind){let e="codex"===n.engine?"bg-codex":"openclaw"===n.engine?"bg-openclaw":"bg-claude",r="codex"===n.engine?sO.uB:"openclaw"===n.engine?sO.oF:sO.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,tP.T0)(n.ts)?(0,U.jsx)("span",{className:"text-label tabular-nums text-muted",children:(0,tP.T0)(n.ts)}):null,(0,U.jsxs)("span",{className:"ml-auto flex shrink-0 items-center gap-0.5",children:[t?(0,U.jsx)(fO,{text:t}):null,(0,U.jsx)(pu.i,{text:n.text,label:(0,ph.tr)("feed.copyMd"),className:pm})]})]}),(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)(pu.i,{text:n.input||n.delta,label:(0,ph.tr)("feed.copyMd"),className:`mt-2 ${pm}`}),(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)(sO.GO,{className:"h-3 w-3","aria-hidden":!0}),(0,ph.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,ph.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)(pu.i,{text:n.text,label:(0,ph.tr)("feed.copyMd"),className:`mt-2 ${pm}`}),(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)(lX,{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,ph.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,ph.tr)("common.collapse")," ",(0,U.jsx)(sO.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)(fV,{event:n});if("tool"===n.kind&&n.wakeup)return(0,U.jsx)(fe,{event:n,wakeup:n.wakeup});if("tool"===n.kind)return(0,U.jsx)(mH,{event:n});if("cmd-group"===n.kind)return(0,U.jsx)(mU,{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)(sO.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,ph.tr)("render.internalTag")}):null,(0,U.jsx)("span",{className:"text-[11px] font-semibold text-muted",children:"out"===n.dir?(0,ph.tr)("render.toDir"):(0,ph.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)(sO.Jl,{className:"h-3 w-3","aria-hidden":!0}):(0,U.jsx)(sO.X,{className:"h-3 w-3","aria-hidden":!0}),"ok"===n.delivery?(0,ph.tr)("render.delivered"):(0,ph.tr)("render.notDelivered")]}):null,(0,tP.T0)(n.ts)?(0,U.jsx)("span",{className:"ml-auto shrink-0 text-label tabular-nums text-muted",children:(0,tP.T0)(n.ts)}):null]}),(0,U.jsx)("div",{className:"px-3.5 pb-2.5 pt-1",children:e?(0,U.jsx)(m1,{payload:e}):(0,U.jsxs)(U.Fragment,{children:[n.summary?(0,U.jsx)("div",{className:"text-[13px] font-bold",children:pM(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,ph.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,ph.tr)("common.collapse")," ",(0,U.jsx)(sO.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)(sO.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,ph.tr)("render.reasoning"),children:[(0,U.jsx)(sO.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:pM(n.text)}):(0,U.jsx)("div",{className:`my-0.5 break-words text-[12.5px] ${n.err?"text-danger":"text-secondary"}`,children:n.text})}),fX=(0,Y.createContext)(()=>null).Provider,fZ=new Map,f0=new Map,f1=new Map,f2=new Map;function f5(e){if(!e||"object"!=typeof e||Array.isArray(e))return null;let{label:t,text:n}=e;return"string"==typeof t&&t.trim()&&"string"==typeof n&&n.trim()?{label:t,text:n}:null}function f4(e,t){return f1.get(e)!==t?fZ.get(e)??null:(fZ.set(e,null),f1.delete(e),null)}async function f3(e,t){let n=`${e}
|
|
72
|
+
${t}`,r=f0.get(n);if(r)return r;if(f1.get(e)===t)return fZ.get(e)??null;f1.set(e,t),f2.set(e,Date.now());let i=(async()=>{try{let n=await fetch(`/api/log/suggestions?conversationId=${encodeURIComponent(e)}`);if(!n.ok)return f4(e,t);let r=await n.json(),i=function(e){let t,n;if(!e||"object"!=typeof e||Array.isArray(e)||"string"!=typeof e.conversationId||"string"!=typeof e.setId||"string"!=typeof e.at||!Number.isFinite(Date.parse(e.at))||!Array.isArray(e.replies))return null;let r=e.replies.map(f5).filter(e=>null!==e);return 0===r.length?null:{conversationId:e.conversationId,setId:e.setId,at:e.at,origin:(n=(t=e.origin??{}).kind,{kind:"manager"===n||"gateway"===n||"agent"===n?n:"unidentified",conversationId:"string"==typeof t.conversationId?t.conversationId:null,role:"string"==typeof t.role?t.role:null}),replies:r.slice(0,6)}}(r.set);if(f1.get(e)!==t)return fZ.get(e)??null;return fZ.set(e,i),i}catch{return f4(e,t)}finally{f0.delete(n)}})();return f0.set(n,i),i}function f6({file:e,revision:t,items:n,outbox:r,floating:i=!1}){let{t:a}=(0,eh.Ym)(),s=e.conversationId??null,l=function(e,t){let[n,r]=(0,Y.useState)(()=>e?fZ.get(e)??null:null);return(0,Y.useEffect)(()=>{if(!e)return;let n=!0,i=()=>{f3(e,t).then(e=>{n&&r(e)})},a=Date.now()-(f2.get(e)??0);if(a>=1500)return i(),()=>{n=!1};let s=setTimeout(i,1500-a);return()=>{n=!1,clearTimeout(s)}},[e,t]),e&&n?.conversationId===e?n:null}(s,t),o=function(e=[],t=[]){let n=null;for(let{item:t}of e){if("user"!==t.kind)continue;let e=function(e){if("string"!=typeof e&&"number"!=typeof e)return null;let t=new Date(e).getTime();return Number.isFinite(t)?t:null}(t.ts);null!==e&&(null===n||e>n)&&(n=e)}for(let e of t)"number"==typeof e.at&&(null===n||e.at>n)&&(n=e.at);return n}(n,r),c=l?Date.parse(l.at):NaN,d=!!l&&Number.isFinite(c)&&null!==o&&o>c;if((0,Y.useEffect)(()=>{d&&l&&s&&fZ.get(s)?.setId===l.setId&&fZ.set(s,null)},[d,l,s]),!l||d)return null;let u=W(e);return(0,U.jsx)("div",{"data-reply-suggestions":i?"floating":"inline",role:"group","aria-label":a("composer.suggestedReplies"),className:`flex min-w-0 flex-wrap items-center gap-1.5 overflow-x-auto ${i?"rounded-surface border border-border bg-raised/95 p-1.5 shadow-2 backdrop-blur-sm":"mt-2"}`,children:l.replies.map((e,t)=>(0,U.jsx)("button",{type:"button","data-reply-suggestion":!0,title:e.text,onClick:()=>dD(u,e.text),className:"inline-flex max-w-full shrink-0 items-center rounded-full border border-border bg-raised px-2.5 py-1 text-label font-semibold text-primary [@media(pointer:coarse)]:min-h-11 hover:border-accent/50 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:(0,U.jsx)("span",{className:"truncate",children:e.label})},`${l.setId}:${t}`))})}var f8=n(9267),f7=n(9339);function f9(e){return`llvQuestionDismissed:${e.transcriptPath}:${e.toolUseId}`}function he(){try{return window.localStorage}catch{return null}}function ht(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 hn({file:e}){let{t}=(0,eh.Ym)(),n=ib(),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(ht(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)(f8.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)(ue.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(f9(t))==="1"}catch{return!1}}(he(),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=he();try{e?.setItem(f9(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(ht(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)(f8.A,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",t("question.waiting")]}),S]}),"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)("p",{role:"note","data-question-transport":"unavailable",className:"mt-3 text-[12px] font-semibold text-muted",children:t("question.noPane")}),(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)(f8.A,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",t("question.waiting")]}),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)(f7.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)(fD.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)(fD.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)(ue.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)(fn.A,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",t("question.retryAnswer")]}):null]}):null]})}let hr={approval:"runtime.attention.approval",permission:"runtime.attention.permission",question:"runtime.attention.question",waiting_heuristic:"runtime.attention.waiting_heuristic"};function hi({attention:e,onApprove:t,onDeny:n,onAnswerQuestion:r,onAnswerQuestions:i,onDismiss:a,busy:s,archived:l=!1}){let{t:o}=(0,eh.Ym)(),c=ib(),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)(as.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(hr[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)(f7.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)(f7.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)(ue.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 ha({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)(as.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)(sO.kr,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):(0,U.jsx)(sO.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)(sO.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)(sO.kr,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):(0,U.jsx)(sD.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 hs({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 lk()||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 lk()||u(t("deadHost.recheckFailed")),l(!1))};return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(ha,{t:t,sinceLabel:(0,tP.rK)(e.mtime),onRespawn:()=>void p(),onAttach:()=>r(!0),onRecheck:()=>void m(),respawnBusy:i,recheckBusy:s,respawnError:o,recheckError:d}),n?(0,U.jsx)(uE,{file:e,onClose:()=>r(!1)}):null]})}function hl(e){return`llvAttentionDismissed:${e.conversationId}:${e.id}`}function ho(){try{return window.localStorage}catch{return null}}function hc(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 hd(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 hu({file:e}){let{t}=(0,eh.Ym)(),n=lb(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)(hn,{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,ly("/api/runtime/answer",{conversationId:a,attentionId:l,resolution:r,operationId:rg()}));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(hl(t))==="1"}catch{return!1}}(ho(),e));return(0,U.jsxs)(U.Fragment,{children:[u.map(e=>(0,U.jsx)(hi,{attention:e,archived:c,busy:r===e.id,onApprove:c||"approval"!==e.kind&&"permission"!==e.kind?void 0:()=>void d(e,hc(e,!0)),onDeny:c||"approval"!==e.kind&&"permission"!==e.kind?void 0:()=>void d(e,hc(e,!1)),onAnswerQuestion:c||"question"!==e.kind?void 0:t=>{d(e,hd(e,[[t]]))},onAnswerQuestions:c||"question"!==e.kind?void 0:t=>void d(e,hd(e,t)),onDismiss:c||"question"!==e.kind?void 0:()=>(e=>{var t=ho();try{t?.setItem(hl(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 hp(e,t){return"prose"===e.kind&&"prose"===t.kind&&e.engine===t.engine&&String(e.ts)===String(t.ts)}function hm({file:e}){let{t}=(0,eh.Ym)();return"running"===e.proc?(0,U.jsxs)(s_,{tone:"success","data-capture-volatile":"pid",children:[(0,U.jsx)(sO.jG,{className:"h-3 w-3","aria-hidden":!0})," PID ",e.pid]}):"killed"===e.proc||"stalled"===e.activity?(0,U.jsx)(s_,{tone:"danger",children:t("task.interruptedBadge")}):"done"===e.proc?(0,U.jsx)(s_,{tone:"neutral",children:t("task.finishedBadge")}):null}function hf({file:e,compact:t=!1,hideChip:n=!1}){let{t:r}=(0,eh.Ym)(),i=ib(),[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}=cO(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)(hm,{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)(lK,{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 hh({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)(hm,{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 hx({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 hg({file:e,workingLabel:t,workingIcon:n,compact:r=!1}){let{t:i}=(0,eh.Ym)(),a=e.lastTurn??null,s=!!(e.pendingQuestion||e.rateLimit||e.waitingInput),l=uO(e),o=r?"px-3 py-1":"px-6 py-1.5";if(s){let t=function(e){if(e.pendingQuestion){let t=Date.parse(e.pendingQuestion.askedAt);return Number.isFinite(t)?t:null}return e.rateLimit?e.lastTurn?.startedAt??(void 0===e.mtime?null:1e3*e.mtime):e.waitingInput?1e3*e.waitingInput.since:null}(e);return(0,U.jsxs)("div",{"data-turn-status":"waiting",className:`flex shrink-0 items-center justify-center gap-2 border-t border-border ${o} text-[12px] font-semibold text-warning`,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-warning"}),(0,U.jsx)("span",{className:"h-1.5 w-1.5 animate-bounce rounded-full bg-warning [animation-delay:150ms]"}),(0,U.jsx)("span",{className:"h-1.5 w-1.5 animate-bounce rounded-full bg-warning [animation-delay:300ms]"})]}),(0,U.jsx)("span",{className:"min-w-0 truncate",children:i("turn.waiting")}),null!==t?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("span",{"aria-hidden":!0,children:"\xb7"}),(0,U.jsx)(hx,{startedAt:t,label:i("turn.timer")})]}):null]})}if(l)return(0,U.jsxs)("div",{"data-turn-status":"running",className:`flex shrink-0 items-center justify-center gap-2 border-t border-border ${o} 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)(hx,{startedAt:a.startedAt,label:i("turn.timer")})]}):null]});let c=function(e,t=(0,eh.JK)()){let n=uD(e);return null===n?null:(0,eh.Tl)(t,"turn.worked",{d:uR(n,t)})}(e);return c?(0,U.jsxs)("div",{role:"note","data-turn-status":"finished",className:`flex shrink-0 items-center gap-2 border-t border-border ${o} 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:c}),(0,U.jsx)("span",{className:"h-px flex-1 bg-border","aria-hidden":!0})]}):null}let hb=window.matchMedia("(pointer: coarse)").matches?500:2500,hv=window.matchMedia("(pointer: coarse)").matches?1e3:6e3,hw={items:[],hiddenServiceCount:0},hy=new mu(300);function hk(e){return Array.from(e.querySelectorAll("[data-feed-key]"))}function hj({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=oO(v??""),y=(c=v??"",(0,Y.useSyncExternalStore)(e=>(p2.add(e),()=>p2.delete(e)),()=>p7(c),()=>p5)),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,lm(e=>lg(e,d,u),null,lx))?.session??null,P=T?.liveTurn??null,$=T?.turn??null,[E,R]=(0,Y.useState)(()=>v?hy.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?pn(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(pe.delete(e),pe.set(e,pt(t,6e3));pe.size>24;){let e=pe.keys().next().value;if(!e)break;pe.delete(e)}},L=()=>{I.current=0,M.current=0,T.current="",P.current=!0,O(!1)},_=(0,Y.useCallback)(()=>{e&&pe.delete(e.path),R({lines:[],start:0}),L()},[e?.path]);(0,Y.useEffect)(()=>{$.current+=1;let t=e?pn(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?u9(e.slice(0,n+1)):u9(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)}}},uB.add(n),uX?(null===uK&&(uK=setInterval(()=>void u4(),1200)),u3()):u7(),()=>{(uB.delete(n),0===uB.size)?(u2(),u5(),uY=u1(uY,clearTimeout),uW=u1(uW,clearTimeout),uX=!1,uJ=!1,uG=!1,uQ=!1):uX?u3():u7()});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+u9(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?hb:hv: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=hy.get(v);n={magnet:e,fromBottom:t?.fromBottom??0,anchor:e?null:t?.anchor??null},hy.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,hk(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=hy.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,ph.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):hw,[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}
|
|
73
|
+
${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,tF(v)))ng(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=ml(r);e&&n.push(r);let i=e?mc(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?mh.get(e)??null:null);(0,Y.useEffect)(()=>{if(!e)return;let t=mh.get(e)??null;if(s(t),!r)return;let n=i.current;if(!mv(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=mh.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=mg(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}
|
|
74
|
+
${r.deliveredAt}
|
|
75
|
+
${r.origin}
|
|
76
|
+
${r.senderRole??""}`,r);return[...n.values()]}(c?.occurrences??[],function(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){let e=mg(n);if(!e)continue;let{textDigest:r,deliveredAt:i}=n;"string"==typeof r&&mb.test(r)&&"string"==typeof i&&Number.isFinite(Date.parse(i))&&t.push({...e,textDigest:r,deliveredAt:i})}return t}(i.occurrences))};if(mh.set(e,d),!a)return;s(d),t<mx.length&&mv(n,d,!0,Date.now())&&(l=setTimeout(()=>void o(t+1),mx[t]))}catch{}};return o(0),()=>{a=!1,l&&clearTimeout(l)}},[e,r]);let l=(0,Y.useMemo)(()=>md(t.map(e=>e.item),a?.occurrences??mk),[a,t]),o=(0,Y.useMemo)(()=>{let e=[];for(let[t,n]of l){let r=n.mandate?`mandate:${"version"===n.mandate.kind?n.mandate.version:n.mandate.kind}`:"";e.push(`${function(e){let t=mw.get(e);return void 0===t&&(t=my,my+=1,mw.set(e,t)),t}(t)}:${n.origin}:${n.senderRole??""}:${n.selectedContext?"ctx":""}:${r}`)}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}}:mp,[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?hy.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:uH.A,label:b("feed.running",{tool:(eA.command??eA.summary).split(/[\s:·]/,1)[0]||b("feed.tool")})}:eA?.kind==="think"?{icon:sO.RE,label:b("feed.thinking")}:{icon:sO.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(o$(oI.get(e),t))return;for(let n of(oI.set(e,t),oM))n();return}let n=new Map(om(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=oA(e.text);t&&r&&n.set(t,{id:t,key:r})}let r=[...n.values()].slice(-512),i=om(e);(i.length!==r.length||i.some((e,t)=>e.id!==r[t]?.id||e.key!==r[t]?.key))&&of(e,r);let a=oP(r),s=!o$(oI.get(e),a);if(s&&oI.set(e,a),oE(e,r),s)for(let e of oM)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;oj(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=os(e);if(n&&n.id!==t.id)return;oc(e,{id:t.id,at:n?.at??t.at,settledAt:t.settledAt});let r=ok(e),i=r.find(e=>e.id===t.id);if(!i||!i.launchOwned)return;let a=t.owner&&!l0(i.owner,t.owner)?{...i,owner:t.owner}:i;if(a.retiredEchoId||void 0!==a.responseStartedAt||"delivered"===a.state){a!==i&&ob(e,r.map(e=>e.id===t.id?a:e)),op(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&&op(e,l),ob(e,s)}(v,{id:k.launchId,at:k.promptAt??k.deliveredAt,settledAt:k.deliveredAt,owner:I}):"failed"===k.initialMessage&&function(e,t){let n=os(e);if(n&&n.id!==t.id)return;oc(e,{id:t.id,at:n?.at??t.at});let r=ok(e),i=r.find(e=>e.id===t.id);if(!i||!i.launchOwned)return;let a=t.owner&&!l0(i.owner,t.owner)?{...i,owner:t.owner}:i;if(a.retiredEchoId||void 0!==a.responseStartedAt||"delivered"===a.state){a!==i&&ob(e,r.map(e=>e.id===t.id?a:e)),op(e,a);return}let s={...a,state:"failed",...t.error?{error:t.error}:{}};op(e,s),ob(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||!l0(l.owner,r)))continue;let e=oA(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=p7(e);if(!n.size)return;let r=new Set(n);for(let e of p7(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(p9(t,r),p9(e,p5),p2))n()}(L,v),function(e,t){if(!e)return;let n=p7(e),r=t.flatMap(p8);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(p9(e,i),p2))t()}(v,eb.items))},[L,v,eb.items]);let eR=(0,Y.useMemo)(()=>(function(e,t,n=p5,r=null){let i=e?n9(e):[];if(!i.length)return i;let a=t.flatMap(e=>{let{item:t}=e,n=p3(e);return"prose"===t.kind?[{sourceId:n,text:t.text.trim(),at:me(t.ts)}]:"tool"===t.kind||"cmd-group"===t.kind?p6(e).map(e=>({sourceId:e,text:"",at:null})):n?[{sourceId:n,text:"",at:"review"===t.kind?me(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=me(e.completedAt)??me(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=me(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:uH.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_=`${_.size}:${eb.items.length}`,eF="left-1/2 -translate-x-1/2";return(0,U.jsx)(fX,{value:ej,children:(0,U.jsx)(mf,{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 ${eF} 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)(uU.A,{className:"h-3 w-3","aria-hidden":!0})," ",b("feed.liveTail")]}):null:(0,U.jsxs)("button",{className:`absolute bottom-2 ${eF} 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)(sO.yd,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",J?b("feed.newCount",{count:J}):b("feed.down")]}):null,e&&!E?(0,U.jsx)("div",{className:"absolute inset-x-2 bottom-11 z-10 flex justify-center",children:(0,U.jsx)(f6,{file:e,revision:e_,items:eb.items,outbox:eE,floating:!0})}):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=hk(l).find(e=>e.getBoundingClientRect().bottom>i),s=a?.dataset.feedKey,a&&s?{path:n,key:s,offset:a.getBoundingClientRect().top-i}:null)},hy.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)(sO.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)(hh,{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&&hp(e[i-1].item,r);)i-=1;for(;a+1<e.length&&hp(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(fi,"\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,fr.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)(fQ,{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},mt.filter(e=>h[e])).map(t=>{if("launch"===t)return(0,U.jsx)(pl,{launch:k,onRetry:o},"launch");if("outbox"===t){let t=lO(e.migration,lP(e.path)),n=lD(lE(t))?{label:lR(t)}:null;return(0,U.jsx)(p0,{cardId:v,entries:eE,switchHold:n,session:T?{host:T.host,turn:T.turn}:null},"outbox")}return(0,U.jsx)(pX,{items:eR},"delta")}),(0,U.jsx)(hu,{file:e}),E?(0,U.jsx)(f6,{file:e,revision:e_,items:eb.items,outbox:eE}):null,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&&tE(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)(ux.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)(hg,{file:e,workingLabel:eD.label,workingIcon:eD.icon,compact:l}):null]})})})}let hN=()=>void 0;function hS({file:e,projectName:t}){let{t:n}=(0,eh.Ym)(),{caps:r}=cO(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)(hs,{file:e}):null,(0,U.jsx)(hj,{file:e,showSvc:!1,lineFilter:"",onStatus:hN,paused:!1,follow:!0,setFollow:hN,compact:!0}),(0,U.jsx)(uz,{file:e}),(0,U.jsx)(dF,{file:e,deadHost:i,sendBlockedReason:s,placeholder:n("composer.placeholderOrchestrator",{project:t}),primaryPlace:!0})]})}let hC=new Map,hA=e=>e?hC.get(e)??null:null,hI=e=>e?{...e,stale:!0}:null;async function hM(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,s=await n.json();if(!s||"object"!=typeof s||Array.isArray(s))return null;let l=uA(s.project);if(!l)return null;let o="claude"===s.engine||"codex"===s.engine?s.engine:null;return{project:l,designated:!0===s.designated,conversationId:uA(s.conversationId),predecessorConversationId:uA(s.predecessorConversationId),engine:o,model:uA(s.model),effort:uA(s.effort),accountId:uA(s.accountId),cwd:uA(s.cwd),transcriptPath:uA(s.transcriptPath),liveness:!(r=s.liveness)||"object"!=typeof r||Array.isArray(r)?null:{lifecycle:uA(r.lifecycle)??"",hostState:uA(r.hostState)??"",silentForMs:uI(r.silentForMs)},context:!(i=s.context)||"object"!=typeof i||Array.isArray(i)?null:{tokens:uI(i.tokens),limit:uI(i.limit),percent:uI(i.percent),estimated:!1!==i.estimated,basis:uA(i.basis)??""},transcriptFacts:!(a=s.transcriptFacts)||"object"!=typeof a||Array.isArray(a)?null:{bytes:uI(a.bytes),messageCount:uI(a.messageCount),toolCount:uI(a.toolCount),compactionCount:uI(a.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}}(s.rotation)}}let hT=new Map,hP=(e,t)=>`${e}\0${t??""}`;async function h$(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:ug(r?.seat),pending:ug(r?.pending),exists:r?.exists!==!1,viewerMcpRegistered:r?.viewerMcpRegistered===!0}}let hE=(e,t)=>e?hT.get(hP(e,t))??null:null;function hR(e,t){let[n,r]=(0,Y.useState)(()=>hE(e,t)),i=n&&n.project===e&&n.cwd===(t??"")?n:hE(e,t),a=(0,Y.useCallback)((e,t,n,i)=>{let a=hP(e,t),s={project:e,cwd:t??"",status:n??hT.get(a)?.status??null,failed:i};hT.set(a,s),r(s)},[]),s=(0,Y.useCallback)(async()=>{if(e)try{a(e,t,await h$(e,t),!1)}catch{a(e,t,null,!0)}},[t,e,a]);return(0,Y.useEffect)(()=>{if(!e)return;let n=new AbortController,r=()=>{h$(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 hO(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 hD(e,t,n,r){return(0,ex.bF)(t||e,n,1===r?"Analyze attached image":"Analyze attached images")}function hL(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 h_(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 hF(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&&uk(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)||uj();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=hL(a.status,a.ok,s);if("launched"===t.kind){let{draft:r,cwd:i,firstMessage:a}=e.launch,s=h_(hO(o,d,{title:(0,ex.bF)("orchestrator",a,n),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&&rE(s)}nG()}else{let e=uN(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 hq(e){let t=lh(),n=lb(e?W(e):null);return e?cE(e,n,{runtimeEnabled:t}):null}let hz=(e,t,n)=>`llvOrchestrator${e}:${t}:${n}`;function hH(e,t,n){try{return window.sessionStorage.getItem(hz(e,t,n))??""}catch{return""}}function hU(e,t,n,r){try{r?window.sessionStorage.setItem(hz(e,t,n),r):window.sessionStorage.removeItem(hz(e,t,n))}catch{}}let hB=(e,t)=>({read:n=>hH(e,t,n),write:(n,r)=>hU(e,t,n,r)});function hK({project:e,projectName:t,projectCwd:n,files:r,onClose:i}){let{t:a}=(0,eh.Ym)(),{status:s,failed:l,refresh:o}=hR(e,n),[c,d]=(0,Y.useState)(null),[u,p]=(0,Y.useState)(()=>hH("Draft",e,"mandate")||uh),[m,f]=(0,Y.useState)(null),[h,x]=(0,Y.useState)(!1),g=us(),b=(0,Y.useMemo)(()=>hB("Draft",e),[e]),v=(0,Y.useMemo)(()=>hB("Rotate",e),[e]),w=ul({storage:b,catalog:g,initialEngine:up,initialModel:um,initialEffort:"low"}),y=t=>{p(t),hU("Draft",e,"mandate",t===uh?"":t)},k=s?.seat?.conversationId??null,j=!!(k&&s?.exists),{incumbent:N,stale:S,refresh:C}=function(e,t){let[n,r]=(0,Y.useState)(()=>hI(hA(e))),i=n&&n.project===e?n:hI(hA(e)),a=(0,Y.useCallback)((e,t)=>{let n={project:e,incumbent:t,stale:!1};hC.set(e,n),r(n)},[]),s=(0,Y.useCallback)(e=>{r(t=>t&&t.project===e&&!t.stale?{...t,stale:!0}:t)},[]),l=(0,Y.useCallback)(async()=>{if(e)try{a(e,await hM(e))}catch{s(e)}},[e,a,s]);return(0,Y.useEffect)(()=>{if(!e||!t)return;let n=new AbortController,r=()=>{hM(e,n.signal).then(t=>a(e,t)).catch(()=>{n.signal.aborted||s(e)})};r();let i=setInterval(r,6e4);return()=>{clearInterval(i),n.abort()}},[e,t,a,s]),{incumbent:i?.incumbent??null,stale:i?.stale!==!1,refresh:l}}(e,j),A=N&&N.conversationId===k?N:null,I=s?.seat?.path??null,M=A?.transcriptPath??null,T=(0,Y.useMemo)(()=>(function(e){if(!e.conversationId)return null;let t=Z(e.files,e.conversationId);if(t)return t;for(let t of[e.currentPath,e.seatPath]){if(!t)continue;let n=e.files.find(e=>e.path===t);if(n)return(n.conversationId?Z(e.files,n.conversationId):null)??n}return null})({files:r,conversationId:k,seatPath:I,currentPath:M}),[r,k,I,M]),P=hq(T),$=j&&"resolving"===uy(T,P),E=function(e,t){let[n,r]=(0,Y.useState)(null);return(0,Y.useEffect)(()=>{if(!e)return;let n=setTimeout(()=>r(t),1e4);return()=>{clearTimeout(n),r(null)}},[e,t]),e&&n===t?1e4:null}($,k??"");(0,Y.useEffect)(()=>{j&&C()},[k,j,C]);let R=$&&null!==A;(0,Y.useEffect)(()=>{R&&C()},[R,C]);let O=$&&S;(0,Y.useEffect)(()=>{if(!O)return;let e=setInterval(()=>void C(),2e3);return()=>clearInterval(e)},[O,C]);let D=!S&&!!A?.designated&&A?.liveness?.hostState==="alive",L=()=>{o(),C(),nG(),lk()},_=hF({url:"/api/orchestrator/seat",project:e,storage:b,field:"requestId",status:s,refresh:o}),F=hF({url:"/api/orchestrator/rotate",project:e,storage:v,field:"requestId",status:s,refresh:o}),q=ub({status:s,statusFailed:l,submitting:_.submitting||F.submitting,submitFailure:_.failure??F.failure,file:T,surface:P,incumbent:A,hostLive:D,unboundForMs:E}),z=F.submitting||null!==F.failure&&!uk(s,F.failure.clientRequestId),H="live"===q.kind&&null!==m&&m===q.conversationId,B="live"!==q.kind&&null!==m&&z&&s?.seat!=null,W=H||B,V=t=>{u.trim()?(d(null),_.submit({body:{project:e,mandate:u,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}:{},...u===uh?{promptVersion:10}:{},..."draft"===q.kind&&q.vacated?{replaceIncumbent:!0}:{}},launch:{draft:w,cwd:n??"",firstMessage:u}},t)):d(a("orchPanel.mandateRequired"))},J=async e=>{x(!0);try{await C()}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":q.kind,"data-orchestrator-mode":W?"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)(d9.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)(hX,{state:q,file:T}),(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"===q.kind?(0,U.jsxs)(h1,{children:[(0,U.jsx)(ue.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"===q.kind?(0,U.jsxs)(h1,{children:[(0,U.jsx)(as.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)(h5,{onClick:()=>void o(),children:a("orchPanel.recheck")})]}):B&&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)(hY,{project:e,projectName:t,seat:s.seat,incumbent:A,file:T,projectCwd:n,catalog:g,flow:F,status:s,onCancel:()=>f(null)})]}):"creating"===q.kind?(0,U.jsxs)(h1,{children:[(0,U.jsx)(ue.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")}),q.launchId?(0,U.jsx)("p",{className:"max-w-full truncate font-mono text-caption text-muted",title:q.launchId,children:a("orchPanel.receipt",{launchId:q.launchId})}):null,!_.submitting&&q.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)(h5,{onClick:()=>V(q.clientRequestId),children:a("orchPanel.creatingResume")})]}):null]}):"live"===q.kind?(0,U.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,U.jsx)(uS,{incumbent:A,file:T,catalog:g,predecessorConversationId:q.seat.predecessorConversationId,rotating:W,opening:h,onRotate:()=>void J(q.conversationId)}),q.transition&&!W?(0,U.jsx)(hZ,{transition:q.transition}):null,q.rotation?(0,U.jsx)(h0,{rotation:q.rotation}):null,W?null:(0,U.jsxs)(U.Fragment,{children:[uv(q,T)?(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"===q.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,"surface"===q.bindFailure?(0,U.jsxs)("p",{"data-orchestrator-bind":"surface",className:"flex shrink-0 flex-wrap items-center gap-2 border-b border-border bg-sunken px-3 py-1.5 text-ui text-secondary",role:"status",children:[a("orchPanel.bindStalledSurface"),(0,U.jsx)(h3,{onRebind:L}),(0,U.jsx)(h4,{conversationId:q.conversationId})]}):null]}),W?(0,U.jsx)(hY,{project:e,projectName:t,seat:q.seat,incumbent:A,file:T,projectCwd:n,catalog:g,flow:F,status:s,onCancel:()=>f(null)}):T?(0,U.jsx)(hS,{file:T,projectName:t}):(0,U.jsxs)(h1,{children:[q.bindFailure?(0,U.jsx)(h6,{reason:q.bindFailure,onRebind:L}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(ue.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)(h4,{conversationId:q.conversationId})]})]}):(0,U.jsx)(hW,{mode:"create",state:q,mandate:u,edited:u!==uh,baseVersion:10,formError:c,submitting:_.submitting,projectName:t,cwd:n,launch:w,viewerMcpRegistered:s?.viewerMcpRegistered===!0,onMandate:y,onRestore:()=>y(uh),onConfirm:()=>V()})]})}function hY({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)(()=>hH("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=ul({storage:{read:t=>hH("Rotate",e,t)||(h[t]??""),write:(t,n)=>hU("Rotate",e,t,n)},catalog:s,initialEngine:up,initialModel:um,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=uw(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)(hW,{mode:"rotate",state:g,mandate:m,edited:m!==n.mandate,baseVersion:n.promptVersion,formError:u,submitting:l.submitting,projectName:t,cwd:b,launch:x,viewerMcpRegistered:o?.viewerMcpRegistered===!0,onMandate:t=>{f(t),hU("Rotate",e,"mandate",t===n.mandate?"":t)},onRestore:()=>{f(n.mandate),hU("Rotate",e,"mandate","")},onConfirm:()=>{m.trim()?(p(null),l.submit({body:{project:e,mandate:m,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:m}})):p(d("orchPanel.mandateRequired"))},onCancel:c})}function hW({mode:e,state:t,mandate:n,edited:r,baseVersion:i,formError:a,submitting:s,projectName:l,cwd:o,launch:c,viewerMcpRegistered:d,onMandate:u,onRestore:p,onConfirm:m,onCancel:f}){let{t:h}=(0,eh.Ym)(),x="intent-error"===t.kind,g="rotate"===e,b=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{r&&b.current&&(b.current.open=!0)},[r]),(0,Y.useEffect)(()=>{x&&b.current&&(b.current.open=!0)},[x]);let v=r?null:i;return(0,U.jsxs)("form",{className:"flex min-h-0 flex-1 flex-col","data-orchestrator-draft":e,onSubmit:e=>{e.preventDefault(),m()},children:[(0,U.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto px-4 py-4",children:[x?(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)(as.A,{className:"h-4 w-4 shrink-0","aria-hidden":!0}),h("same"===t.retry?g?"orchPanel.rotateErrorUnknownTitle":"orchPanel.errorUnknownTitle":g?"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:h("same"===t.retry?g?"orchPanel.rotateErrorUnknownHint":"orchPanel.errorUnknownHint":g?"orchPanel.rotateErrorHint":"orchPanel.errorHint")})]}):(0,U.jsxs)("div",{className:"shrink-0",children:[(0,U.jsx)("h2",{className:"text-title font-semibold text-primary",children:h(g?"orchPanel.rotateHeading":"orchPanel.draftTitle")}),g?(0,U.jsx)("p",{className:"mt-1 text-ui leading-4 text-muted",children:h("orchPanel.rotateHint")}):"draft"===t.kind&&t.vacated?(0,U.jsx)("p",{className:"mt-1 text-ui leading-4 text-muted",children:h("orchPanel.draftHintVacated",{project:l})}):null]}),g?null:(0,U.jsxs)("p",{className:"shrink-0 text-ui leading-5 text-secondary","data-orchestrator-intro":!0,children:[h("orchPanel.introTalk")," ",h("orchPanel.introRuns")," ",h("orchPanel.introReports")]}),(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":d?"registered":"missing",role:"status",children:h(d?"orchPanel.viewerMcpRegistered":"orchPanel.viewerMcpMissing")}),(0,U.jsx)("div",{className:"shrink-0",children:(0,U.jsx)(ud,{draft:c,disabled:s,stacked:!0})}),(0,U.jsxs)("details",{ref:b,className:"shrink-0 rounded-control border border-border bg-card/60","data-orchestrator-mandate-details":!0,children:[(0,U.jsx)("summary",{className:"min-h-7 cursor-pointer select-none list-item px-3 py-1.5 text-label font-semibold text-secondary marker:text-muted hover:text-primary",children:null===v?h("orchPanel.mandateSummaryCustom"):h("orchPanel.mandateSummary",{version:v})}),(0,U.jsxs)("div",{className:"flex flex-col gap-1 border-t border-border px-3 py-2",children:[(0,U.jsxs)("div",{className:"flex min-h-6 items-center gap-2",children:[r?(0,U.jsxs)("button",{type:"button",onClick:p,disabled:s,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)(sD.A,{className:"h-3 w-3","aria-hidden":!0})," ",h(g?"orchPanel.restoreIncumbent":"orchPanel.restoreDefault")]}):null,(0,U.jsx)("span",{className:"ml-auto shrink-0 text-caption text-muted",children:h("orchPanel.mandateSent")})]}),(0,U.jsx)("textarea",{id:"orchestrator-mandate","data-orchestrator-mandate":!0,"aria-label":h("orchPanel.mandate"),value:n,disabled:s,onChange:e=>u(e.target.value),spellCheck:!1,className:"min-h-[220px] w-full 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"})]})]}),o?(0,U.jsx)("p",{className:"shrink-0 truncate font-mono text-caption text-muted",title:o,children:h(g?"orchPanel.cwdInherited":"orchPanel.cwd",{cwd:o})}):null]}),(0,U.jsxs)("div",{className:"flex shrink-0 flex-col gap-2 border-t border-border bg-sunken px-4 py-3",children:[g||x?null:(0,U.jsx)("p",{className:"text-ui leading-4 text-muted","data-orchestrator-one-task":!0,children:h("orchPanel.oneTask")}),a?(0,U.jsx)("p",{className:"text-ui font-semibold text-danger",role:"alert",children:a}):null,(0,U.jsxs)("div",{className:"flex items-center gap-2",children:[f?(0,U.jsx)("button",{type:"button","data-orchestrator-rotate-cancel":!0,onClick:f,disabled:s,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:h("orchPanel.rotateCancel")}):null,(0,U.jsxs)("button",{type:"submit","data-orchestrator-confirm":!0,disabled:s,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:[s?(0,U.jsx)(ue.A,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):g?(0,U.jsx)(ut.A,{className:"h-4 w-4","aria-hidden":!0}):(0,U.jsx)(d9.A,{className:"h-4 w-4","aria-hidden":!0}),(0,U.jsx)("span",{className:"truncate",children:h(x?"orchPanel.confirmRetry":g?"orchPanel.rotateConfirm":"orchPanel.confirm")})]})]})]})]})}let hV="border-border bg-canvas text-muted",hJ="border-danger/40 bg-danger-soft text-danger",hG="border-warning/45 bg-warning-soft text-warning",hQ={"needs-you":{tone:hG,key:"orchPanel.badgeNeedsYou"},live:{tone:"border-success/45 bg-success-soft text-success",key:"orchPanel.badgeLive"},stalled:{tone:hG,key:"orchPanel.badgeStalled"},resumable:{tone:hV,key:"orchPanel.badgeResumable"},dead:{tone:hJ,key:"orchPanel.badgeDead"},resolving:{tone:hV,key:"orchPanel.badgeResolving"}};function hX({state:e,file:t}){let{t:n,locale:r}=(0,eh.Ym)(),i="live"===e.kind?e.attention?"needs-you":e.liveness:null,a=i?hQ[i]:null,s=a?a.tone:"intent-error"===e.kind?hJ:"creating"===e.kind?"border-accent/45 bg-accent-soft text-accent":hV,l=n(a?a.key:"creating"===e.kind?"orchPanel.badgeCreating":"intent-error"===e.kind?"orchPanel.badgeFailed":"draft"===e.kind?"orchPanel.badgeNone":"orchPanel.badgeReading"),o="needs-you"===i&&t?am(n,r,t):null;return(0,U.jsx)("span",{"data-orchestrator-badge":i??e.kind,title:o??void 0,className:`shrink-0 rounded-full border px-2 py-0.5 text-caption font-semibold ${s}`,children:l})}function hZ({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)(ue.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)(as.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 h0({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 h1({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})}let h2="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";function h5({onClick:e,children:t}){return(0,U.jsx)("button",{type:"button",onClick:e,className:h2,children:t})}function h4({conversationId:e}){let{t}=(0,eh.Ym)();return(0,U.jsx)("a",{href:"#c="+encodeURIComponent(e),"data-orchestrator-open-board":!0,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:t("orchPanel.openOnBoard")})}function h3({onRebind:e}){let{t}=(0,eh.Ym)();return(0,U.jsxs)("button",{type:"button","data-orchestrator-rebind":!0,onClick:e,title:t("orchPanel.rebindTitle"),className:h2,children:[(0,U.jsx)(ut.A,{className:"h-3.5 w-3.5","aria-hidden":!0}),t("orchPanel.rebind")]})}function h6({reason:e,onRebind:t}){let{t:n}=(0,eh.Ym)();return(0,U.jsxs)("div",{"data-orchestrator-bind":e,className:"flex flex-col items-center gap-2",children:[(0,U.jsx)(as.A,{className:"h-6 w-6 text-warning","aria-hidden":!0}),(0,U.jsx)("p",{className:"max-w-[300px] text-body font-semibold text-primary",role:"status",children:n("orchPanel.bindStalled")}),(0,U.jsx)("p",{className:"max-w-[300px] text-ui text-muted",children:n("surface"===e?"orchPanel.bindStalledSurface":"orchPanel.bindStalledCatalog")}),(0,U.jsx)(h3,{onRebind:t})]})}let h8="llvOrchestratorPanelWidth",h7=e=>`${h8}:${e}`,h9="llvOrchestratorPanelOpen",xe=e=>`${h9}:${e}`;function xt(e){try{return window.localStorage.getItem(e)}catch{return null}}function xn(e){let t;return Number.isFinite(t=Number(xt(h7(e))??xt(h8)))&&t>=360?t:440}function xr({project:e,projectName:t,projectCwd:n,files:r,onClose:i}){let{t:a}=(0,eh.Ym)(),[s,l]=(0,Y.useState)(()=>xn(e)),[o,c]=(0,Y.useState)(e);o!==e&&(c(e),l(xn(e))),(0,Y.useLayoutEffect)(()=>(aI(248+s),()=>aI(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(h7(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)(hK,{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 xi=n(6304),xa=n(5301);let xs=[[1920,4],[1440,3],[1024,2]];function xl({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)(as.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:()=>nG(),children:[(0,U.jsx)(fn.A,{className:"h-4 w-4","aria-hidden":!0})," ",r("catalog.retry")]})]})}var xo=n(908),xc=n(9314);function xd(){let{t:e}=(0,eh.Ym)(),t=ib(),[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)(xo.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)(f7.A,{className:"h-3.5 w-3.5","aria-hidden":!0}):(0,U.jsx)(xc.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 xu(e){let t=e.trim().replace(/(.)\/+$/,"$1"),n=t.lastIndexOf("/");return n<0||n===t.length-1?{head:"",tail:t}:{head:t.slice(0,n+1),tail:t.slice(n+1)}}function xp(e){let t=e.trim();return t.startsWith("/")||"~"===t||t.startsWith("~/")}function xm({dir:e,elide:t}){let{head:n,tail:r}=xu(e);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}(n,Math.max(96-r.length,12)):n}),(0,U.jsx)("span",{className:"font-semibold text-primary",children:r})]})}function xf({id:e,value:t,dirs:n,disabled:r,ariaLabel:i,onQueryChange:a,openSignal:s,onChange:l}){let{t:o}=(0,eh.Ym)(),[c,d]=(0,Y.useState)(!1),[u,p]=(0,Y.useState)(t),[m,f]=(0,Y.useState)(!0),[h,x]=(0,Y.useState)(0),[g,b]=(0,Y.useState)(s);s!==g&&(b(s),r||c||(p(t),f(!0),x(0),d(!0)));let v=(0,Y.useRef)(null),w=(0,Y.useRef)(null),y=(0,Y.useRef)(null),k=c&&!r,j=t.trim(),N=e+"-listbox",S=(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]),C=(0,Y.useMemo)(()=>{let e,t;return e=(m?[...S]:S.filter(e=>{let t;return t=e.toLowerCase(),u.trim().toLowerCase().split(/\s+/).filter(Boolean).every(e=>t.includes(e))})).map(e=>({key:"known:"+e,value:e,kind:"known"})),t=u.trim(),!m&&t&&xp(t)&&!S.includes(t)&&e.unshift({key:"typed",value:t,kind:"typed"}),e},[S,m,u]),A=C.length?Math.min(h,C.length-1):0,I=()=>{r||(p(t),f(!0),x(Math.max(S.indexOf(j),0)),d(!0),a?.(t,!1))},M=(e=!0)=>{d(!1),e&&w.current?.focus()},T=(e,t=!0)=>{let n=e.trim();n&&n!==j&&l(n),M(t)},P=e=>{let t=u.trim();!m&&t&&xp(t)?T(t,e):M(e)},$=(0,Y.useRef)(P);(0,Y.useEffect)(()=>{$.current=P}),(0,Y.useEffect)(()=>{k&&(y.current?.focus(),y.current?.select?.())},[k]),(0,Y.useEffect)(()=>{if(!k)return;let e=e=>{let t=e.target;t&&v.current?.contains(t)||$.current(!1)};return document.addEventListener("pointerdown",e,!0),()=>document.removeEventListener("pointerdown",e,!0)},[k]),(0,Y.useEffect)(()=>{k&&document.getElementById(e+"-option-"+A)?.scrollIntoView?.({block:"nearest"})},[k,A,e]);let E=e=>{C.length&&x(t=>(Math.min(t,C.length-1)+e+C.length)%C.length)};return(0,U.jsxs)("div",{ref:v,"data-scheme-ui":!0,"data-directory-picker":k?"open":"closed",className:"relative flex min-w-0 flex-1 flex-col",children:[(0,U.jsxs)("button",{ref:w,type:"button",disabled:r,"aria-haspopup":"listbox","aria-expanded":k,"aria-label":i+": "+(j||o("dirPicker.empty")),"data-directory-trigger":!0,"data-directory-value":j,title:j||void 0,onClick:()=>k?P(!0):I(),onKeyDown:e=>{"ArrowDown"!==e.key||k||(e.preventDefault(),I())},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:j?(0,U.jsx)(xm,{dir:j,elide:!0}):(0,U.jsx)("span",{className:"text-muted",children:o("dirPicker.empty")})}),(0,U.jsx)(sO.yQ,{className:"h-3.5 w-3.5 shrink-0 text-muted","aria-hidden":!0})]}),k?(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:y,value:u,role:"combobox","aria-expanded":"true","aria-controls":N,"aria-autocomplete":"list","aria-activedescendant":C[A]?e+"-option-"+A:void 0,"aria-label":o("dirPicker.searchAria"),placeholder:o("dirPicker.searchPlaceholder"),spellCheck:!1,autoComplete:"off",onChange:e=>{p(e.target.value),f(!1),x(0),a?.(e.target.value,!0)},onKeyDown:e=>{if("ArrowDown"===e.key)e.preventDefault(),E(1);else if("ArrowUp"===e.key)e.preventDefault(),E(-1);else if("Home"===e.key)e.preventDefault(),x(0);else if("End"===e.key)e.preventDefault(),x(Math.max(C.length-1,0));else if("Enter"===e.key||"Tab"===e.key){e.preventDefault();let t=C[A];t?T(t.value):M()}else"Escape"===e.key&&(e.preventDefault(),e.stopPropagation(),M())},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:N,role:"listbox","aria-label":o("dirPicker.listAria"),className:"min-h-0 flex-1 overflow-y-auto py-1",children:[C.map((t,n)=>{let r="known"===t.kind&&t.value===j;return(0,U.jsxs)("li",{id:e+"-option-"+n,role:"option","aria-selected":r,"data-directory-option":t.value,"data-directory-active":n===A?"true":void 0,onClick:()=>T(t.value),onMouseEnter:()=>x(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===A?"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)(xm,{dir:t.value})}),"typed"===t.kind?(0,U.jsx)("span",{className:"text-caption font-semibold text-accent",children:o("dirPicker.useTyped")}):null,r?(0,U.jsx)("span",{className:"text-caption font-semibold text-accent",children:o("dirPicker.current")}):null]}),r?(0,U.jsx)(sO.Jl,{className:"h-3.5 w-3.5 shrink-0 text-accent","aria-hidden":!0}):null]},t.key)}),C.length?null:(0,U.jsx)("li",{role:"presentation",className:"px-2 py-2 text-[11px] leading-4 text-muted",children:S.length?o("dirPicker.noMatch"):o("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:o("dirPicker.count",{shown:C.filter(e=>"known"===e.kind).length,total:S.length})})]}):null]})}function xh({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})}function xx(){let{locale:e,t,setLocale:n}=(0,eh.Ym)(),r=ib(),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()})}let xg=new Set(["starting","awaiting_browser","awaiting_code","verifying","canceling","authenticated","canceled","timed_out","failed","interrupted"]),xb=new Set(["starting","awaiting_browser","awaiting_code","verifying","canceling"]);function xv(e){if("object"!=typeof e||null===e||"string"!=typeof e.operationId||"string"!=typeof e.phase||!xg.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 xw(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 xy(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 xk(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 xj(e){return e.find(e=>e.loginPending)?.deviceAuth??null}let xN={accounts:[],active:"",identityVersion:0,status:"loading",notice:null,challenge:null,mutation:null,migration:null,autoBalance:null};function xS(e,t){return{kind:"error",operation:"add",messageKey:xw(e),action:{type:"retry",kind:"add",label:t}}}class xC extends Error{constructor(e){super(e??"account selection failed"),this.detail=e,this.name="SwitchRequestError"}}function xA(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 xI(e,{fetcher:t=globalThis.fetch.bind(globalThis),timeoutMs:n=1e4}={}){let r=`/api/accounts/${e}/active`,i=`/api/accounts/${e}`,a=xN,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&&xb.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?xv(e.login):null,r=n?xb.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=xy(e.session),r=xy(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=lL(e);if(!n)return null;let r=lF(n.intentId),i=lF(n.targetId);if(!r||!i)return null;let a=lq.has(n.state)?n.state:"draining";return{intentId:r,targetId:i,targetLabel:lF(n.targetLabel)??i,revision:l_(n.revision),origin:"auto"===n.origin?"auto":"manual",reason:function(e){let t=lL(e);if(!t)return null;let n="weekly"===t.window?"weekly":"session"===t.window?"session":null;return n?{window:n,fromPercent:l_(t.fromPercent),toPercent:l_(t.toPercent)}:null}(n.reason),state:a,counts:(t=lL(n.counts)??{},{done:l_(t.done),waitingTurn:l_(t.waitingTurn),inFlight:l_(t.inFlight),failed:l_(t.failed),total:l_(t.total)}),startedAt:lF(n.startedAt)}}(n.migration),autoBalance:function(e){let t=lL(e);if(!t||"boolean"!=typeof t.enabled)return null;let n=lz.has(t.state)?t.state:"idle";return{enabled:t.enabled,thresholdPercent:l_(t.thresholdPercent,25),state:t.enabled?n:"disabled",cooldownUntil:lF(t.cooldownUntil),lastCheckAt:lF(t.lastCheckAt),lastOutcome:function(e){let t=lL(e);if(!t)return null;let n=lF(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:lF(t.fromId),fromPercent:"number"==typeof t.fromPercent?t.fromPercent:null,toId:lF(t.toId),toPercent:"number"==typeof t.toPercent?t.toPercent:null,window:i,detail:lF(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:xj(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:xS((e=s?.code,"string"==typeof e?e:null),r)}),await b(),!1}let e=xv(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:xb.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:xj(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:xj(t),notice:{kind:"success",operation:"add",messageKey:"accounts.loginOpened",target:s.target,action:null}})}}catch{return f({notice:"claude"===e?xS(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=xA(await n.json().catch(()=>null));throw new xC(e)}}catch(r){let t=r instanceof xC?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:xb.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=xv(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:xb.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:xj(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,...xA(a)?{detail:xA(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 xM={codex:xI("codex"),claude:xI("claude")};function xT(e){let t=xM[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}}function xP(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 x$(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 xE(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 xR(e,t,n,r){if(!e)return t;if(!t)return e;let i=xE(e,t,n,r);return i!==xE(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 xO(e,t,n){let r=xR(e?x$(e,"session",n):null,t?x$(t,"session",n):null,"session",n),i=xR(e?x$(e,"weekly",n):null,t?x$(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 xD(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}function xL(e,t){return"Escape"===e.key&&(e.stopPropagation(),t(),!0)}let x_={authenticated:"accounts.auth.authenticated",signed_out:"accounts.auth.signedOut",unknown:"accounts.auth.unknown",error:"accounts.auth.error"};function xF(e,t){return e<=10?"var(--color-danger)":e<=30?"var(--color-warning)":t}function xq({quota:e,engine:t}){let{t:n}=(0,eh.Ym)(),r=xD(e);if(!r)return null;let i=(0,tP.t7)(t),a=n("weekly"===r.window?"limits.windowWeekly":"limits.windowSession"),s=r.stale,l=xF(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 xz({account:e,engine:t,quota:n,now:r}){let i,a,{t:s}=(0,eh.Ym)(),l=[{key:"session",label:eQ(s,"session",n.session?.value.windowMinutes),window:n.session},{key:"weekly",label:eQ(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,tP.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?eW(p)??s("accounts.limitsStale"):`${s("accounts.limitsChecked")} \xb7 ${a=(i=new Date(new Date(1e3*d).toISOString())).toLocaleTimeString(eY(),{hour:"2-digit",minute:"2-digit",hour12:!1}),Date.now()-i.getTime()<864e5?a:i.toLocaleDateString(eY(),{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=xF(a,m.color),o=null!==p&&n.observedAt===p,c=n.stale&&!o?eW(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:eG(i.resetsAt,r),at:eX(i.resetsAt,r)})]}):null,c?(0,U.jsxs)("span",{className:"truncate",children:[i.resetsAt?"\xb7 ":"",c]}):null]})]},e)})]})}function xH(e){return e.authHealth??(e.authPresent?"unknown":"signed_out")}function xU({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)(sO.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 xB({account:e}){let{t}=(0,eh.Ym)(),n=xH(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)(s_,{tone:"authenticated"===n?"success":"signed_out"===n||"error"===n?"danger":"neutral",className:"px-1.5 py-0 text-[9px]",children:t(x_[n])})]})}function xK({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"!==xH(e)?e.id===r?"active":"idle":"needsLogin",p=e.id===r,m=(0,tP.t7)(t),f=e.authPresent&&"signed_out"!==xH(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)(xB,{account:e})]}),(0,U.jsx)(xq,{quota:n,engine:t}),(0,U.jsx)(xU,{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)(sO.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)(sO.TB,{className:"h-3 w-3","aria-hidden":!0}),d("accounts.remove")]}):null]})]})}function xY({account:e,state:t,loginBusy:n}){let{t:r}=(0,eh.Ym)(),i=e.login??null,a=i?.phase,s=null!=i&&xb.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)(sO.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(xw(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=xH(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 xW({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&&xb.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=>xL(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,tP.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)(sO.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)(sO.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:xO(null,xP(t.limits),x);return(0,U.jsxs)(xK,{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)(xz,{account:t,engine:u,quota:n,now:x}),"claude"===u?(0,U.jsx)(xY,{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:xk(a,c),children:xk(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]})]})]})}function xV(e){return Math.max(0,Math.min(100,e))}function xJ(e,t,n){return t<=e?0:xV((t-n)/(t-e)*100)}let xG=312,xQ=138;function xX(){return"uk"===(0,eh.JK)()?"uk-UA":"en-US"}function xZ({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*xG,p=e=>8+(100-Math.max(0,Math.min(100,e)))/100*xQ,m=null!==i&&null!==a?`M ${u(i).toFixed(2)},${p(xJ(i,a,o)).toFixed(2)} L ${u(a).toFixed(2)},${p(xJ(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:xG,height:xQ,className:"fill-none stroke-border",strokeWidth:1,vectorEffect:"non-scaling-stroke"}),(0,U.jsx)("line",{x1:4,y1:p(50),x2:4+xG,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+xQ,className:"stroke-accent",strokeWidth:1,strokeDasharray:"1 2",vectorEffect:"non-scaling-stroke",opacity:.7}):null]})}function x0({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=>eQ(o,e,b?b[e].windowSeconds/60:null),w=!!(d&&!b),y=b?b[f]:null,k=(0,tP.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=xV(i[i.length-1].remaining),s=Math.min(Math.max(t,n),r),l=xJ(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(xX(),{hour:"2-digit",minute:"2-digit",hour12:!1}),86400>Math.abs(a-x)?l:s.toLocaleDateString(xX(),{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=>xL(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)(sO.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)(xZ,{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 x1=new Set(["starting","awaiting_scan","awaiting_password","verifying"]);async function x2(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 x5(e){let t=await e.json().catch(()=>({}));return{ok:e.ok,json:t}}function x4(e){return"string"==typeof e.code&&/^[a-z_-]{1,40}$/.test(e.code)?e.code:"action_failed"}let x3="Europe/Kyiv";function x6(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 x8({label:e,onClick:t,disabled:n,tone:r}){return(0,U.jsx)("button",{type:"button",onClick:t,disabled:n,className:x6(r),children:e})}function x7({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(ge(e.failure.code))}):null}function x9(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 ge(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",connector_unavailable:"telegram.report.err.connector_unavailable",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 gt(e){let t=new Date(e);return Number.isNaN(t.getTime())?"—":t.toLocaleDateString([],{day:"2-digit",month:"short",timeZone:x3})}function gn({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:x9(e.status)}}),(0,U.jsx)("span",{className:"shrink-0 text-[11px] font-semibold text-primary",children:gt(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:x9(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:x6(),children:s("telegram.report.openRun")}):null,e.hasReport?(0,U.jsx)(x8,{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":ge(e.errorCode))}):null]})}function gr({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)(x8,{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 gi({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)(x8,{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)(x7,{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)(x8,{label:t("telegram.report.promptSave"),tone:"accent",disabled:e.busy,onClick:()=>{let t=n.current?.value??"";e.savePrompt(t)}}),(0,U.jsx)(x8,{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 ga({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)(x7,{state:e}),(0,U.jsx)("p",{className:"text-[10.5px] text-muted",children:n("telegram.report.loading")})]});if(e.prompt)return(0,U.jsx)(gi,{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)(x8,{label:n("telegram.report.back"),onClick:e.closeReport})})]}),(0,U.jsx)(x7,{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)(x8,{label:n("telegram.report.disable"),onClick:()=>o({enabled:!1}),disabled:e.busy})}):null]}),(0,U.jsx)(x7,{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)(x8,{label:n(r?"telegram.report.sourcesDone":"telegram.report.sourcesEdit"),onClick:()=>i(e=>!e),disabled:e.busy})]}),r?(0,U.jsx)(gr,{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)(x8,{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)(x8,{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:x3})}(a.nextRunAt)??"",date:gt(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)(x8,{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)(gn,{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 gs(e){return`telegram.status.${e}`}function gl(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 go(e){let{toDataURL:t}=await n.e(768).then(n.t.bind(n,768,19));return t(e,{margin:1,width:200})}function gc({url:e,renderQr:t=go}){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)(gd,{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 gd({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 gu({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 gp({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)(gd,{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)(sO.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=>xL(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)(fD.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)(sO.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:gl(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(gs(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)(gd,{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)(gc,{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)(gd,{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)(gd,{label:i("telegram.retry"),onClick:()=>void(a?.credentialRef?e.refresh(!0):e.connect()),disabled:s})]}),"connected"===o&&t?(0,U.jsx)(ga,{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)(gu,{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)(gu,{label:i("telegram.deleteLocal"),prompt:i("telegram.deleteLocalConfirm"),onConfirm:()=>void e.deleteLocal(),disabled:s,icon:(0,U.jsx)(sO.TB,{className:"h-3 w-3","aria-hidden":!0})})})]}):null]})]})]})}function gm(){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 x2(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&&x1.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&&x1.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 x2(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 x5(await fetch("/api/telegram/reports"));if(e!==m.current)return;t&&r.reports?n(r.reports):s({code:x4(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 x5(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:x4(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 x5(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:x4(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 x5(await fetch(`/api/telegram/reports?report=${encodeURIComponent(e)}`));t&&"string"==typeof n.report?o({id:e,text:n.report}):s({code:x4(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)(fD.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)(sO.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(gs(l))}),(0,U.jsx)("span",{"aria-hidden":!0,className:"h-2 w-2 rounded-full",style:{backgroundColor:gl(l),boxShadow:"disconnected"===l?"inset 0 0 0 1.5px var(--color-border)":"none"}})]})]}),n?(0,U.jsx)(gp,{state:t,reports:i,onClose:()=>{r(!1),s.current?.focus()}}):null]})}function gf(e,t,n){return e?eW(t,n)??(0,eh.Tl)(n,"accounts.limitsStale"):null}function gh(e,t){return e<=10?"var(--color-danger)":e<=30?"var(--color-warning)":t}function gx({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=gh(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:eG(t.resetsAt,r),at:eX(t.resetsAt,r)}):null,t.resetsAt&&i?" \xb7 ":null,i]}):null]})}function gg(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 gb({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=xT(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,tP.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=xO(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),xP(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,tP.rK)(A.capturedAt):null,T=S?.label??d("accounts.trigger"),P=xD(C),$=gf(!!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(eY(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:gh(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)(sO.kr,{className:"h-3 w-3 animate-spin motion-reduce:animate-none text-accent","aria-hidden":!0}):(0,U.jsx)(sO.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)(gx,{label:eQ(d,"session",A.session?.windowMinutes),window:A.session,engineColor:k.color,now:i,staleHint:gf(!!C.session?.stale,C.session?.observedAt??null,c)}),(0,U.jsx)(gx,{label:eQ(d,"weekly",A.weekly?.windowMinutes),window:A.weekly,engineColor:k.color,now:i,staleHint:gf(!!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)(xW,{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)(x0,{engine:e,label:t,plan:A?.plan??null,activeAccountId:u.active,onClose:()=>{h(!1),w.current?.focus()}},u.active):null]})}function gv(){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=gg(n=t?.data??null,e,"claude"),i=gg(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)(gb,{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)(gb,{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)(gm,{})]})}var gw=n(5298),gy=n(4526);function gk(){let{t:e}=(0,eh.Ym)(),t=ib(),[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)(gw.A,{className:"h-3.5 w-3.5","aria-hidden":!0}):(0,U.jsx)(gy.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})}async function gj(e,t,n={}){let r,i=n.fetch??fetch,a=n.copy??pu.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 gN({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?sO.kU:sO.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)(sO.kr,{className:"h-3.5 w-3.5 animate-spin motion-reduce:animate-none","aria-hidden":!0}):o?(0,U.jsx)(sO.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 gS({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)(gN,{kind:"attach",label:i("attach.attach"),hint:i("attach.hint"),status:e,disabled:a,onCopy:t}),(0,U.jsx)(gN,{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)(sO.kt,{className:"h-3 w-3","aria-hidden":!0}),i("attach.refresh")]}):null]}):null]})}function gC({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)(gS,{status:n,onCopy:t=>{n?.phase!=="loading"&&(null!==a.current&&window.clearTimeout(a.current),r({phase:"loading",kind:t}),gj(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()}})}function gA(e){return"structured"===e.kind}function gI(e,t){return!gA(e)||null!==e.seat&&void 0!==e.seat&&(!1===e.seat||t.has(e.target))}function gM(e,t,n,r){let i=(n-3600*t)*1e3;return e.filter(e=>gI(e,r)&&"live"!==e.activity&&(!gA(e)||!1===e.turnBusy)&&null!==e.lastActiveAt&&Date.parse(e.lastActiveAt)<i)}function gT(e,t){return e.filter(e=>gI(e,t))}let gP=[2,6,12];function g$(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 gE({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 gR(){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,tP.rK)(t.staleSince)})}):null,l?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(gE,{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:g$(l.ramAvailable)})}),l.swapTotal>0?(0,U.jsx)(gE,{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:g$(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,tP.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)(gD,{sessions:o,now:t.at,onRefresh:()=>s.current(!0),onClose:()=>i(!1)}):null]})}async function gO(e,t){let n=gA(e)?await fetch("/api/runtime/hosts",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"kill",target:e.target,intent:t.intent,includeSeat:t.includeSeat,..."idle"===t.intent?{idleHours:t.idleHours}:{}})}):await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"kill-target",target:e.target})});return n.ok?null:(await n.json().catch(()=>({}))).error??String(n.status)}function gD({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,w]=(0,Y.useState)(new Set),y=(e,t)=>s(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r}),k=async e=>{d(null),x(!1),y(e.target,!0);try{let t=await gO(e,{intent:"row",includeSeat:!0});t&&d(t),await n()}finally{y(e.target,!1),o(null)}},j=async(e,t,r)=>{for(let n of e){y(n.target,!0);let e=await gO(n,{intent:t,includeSeat:v.has(n.target),...void 0===r?{}:{idleHours:r}});e&&d(e)}await n()},N=async()=>{let n=gM(e,u,t,v);if(0!==n.length&&!m){d(null),x(!1),f(!0);try{await j(n,"idle",u)}finally{s(new Set),f(!1)}}},S=async()=>{let t=gT(e,v);if(0!==t.length&&!g){d(null),b(!0);try{await j(t,"all")}finally{s(new Set),b(!1),x(!1)}}},C={hosts:e.length,idle:gM(e,u,t,new Set).length,bytes:e.reduce((e,t)=>e+t.rssBytes,0)},A=gM(e,u,t,v).length,I=gT(e,v).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.jsxs)("span",{className:"text-[11px] tabular-nums text-muted","data-testid":"resources-counts",children:[i("resources.hostsN",{count:C.hosts})," \xb7 ",i("resources.idleN",{n:C.idle})," \xb7 ",i("resources.total",{amount:g$(C.bytes)})]}):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)(sO.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)(g_,{session:e,busy:a.has(e.target),armed:l===e.target,seatTicked:v.has(e.target),onToggleSeat:()=>{let t;return t=e.target,w(e=>{let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n})},onArm:()=>o(e.target),onKill:()=>void k(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:gP.map(e=>(0,U.jsx)("option",{value:e,children:i("resources.hoursN",{n:e})},e))}),(0,U.jsxs)("button",{type:"button",disabled:m||0===A,title:0===A?i("resources.bulkNone"):void 0,onClick:()=>void N(),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"),A?` (${A})`:""]})]}),(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===I,title:0===I?i("resources.killAllNone"):i("resources.killAllHint"),onClick:()=>h?void S():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:I}):i("resources.killAll")+(I?` (${I})`:"")})]}),c?(0,U.jsx)("div",{className:"border-t border-border px-3 py-1.5 text-[11px] font-semibold text-danger",children:c}):null]})}let gL={owned:{label:"resources.hostOwned",hint:"resources.hostOwnedHint",tone:"border-border text-muted"},released:{label:"resources.hostReleased",hint:"resources.hostReleasedHint",tone:"border-warning/50 text-warning"},orphaned:{label:"resources.hostOrphaned",hint:"resources.hostOrphanedHint",tone:"border-danger/50 text-danger"}};function g_({session:e,busy:t,armed:n,seatTicked:r,onToggleSeat:i,onArm:a,onKill:s,onRefresh:l}){var o;let{t:c}=(0,eh.Ym)(),d=(0,tP.t7)(e.engine??""),u=gA(e),p="live"===e.activity||!0===e.turnBusy,m=!0===e.hostConflict,f=null!==e.lastActiveAt?Date.parse(e.lastActiveAt)/1e3:null,h=e.ownership?gL[e.ownership]:null,x=[e.role,e.stage,e.model,e.project].filter(e=>!!e),g=p&&!n;return(0,U.jsxs)("div",{className:"px-3 py-1.5 hover:bg-canvas","data-testid":u?"resource-host-row":"resource-pane-row","data-target":e.target,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,tP.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:d.soft,color:d.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,c("resources.procs",{count:e.procCount})].filter(Boolean).join(" \xb7 "),children:[(0,U.jsx)("span",{className:"block truncate text-[12px] font-semibold",children:m?c("resources.hostConflict"):e.title??(e.cwd?(o=e.cwd).split("/").filter(Boolean).slice(-2).join("/")||o:c(u?"resources.hostUntitled":"resources.orphan"))}),(0,U.jsxs)("span",{className:"block truncate text-[10.5px] text-muted",children:[m?c("resources.hostConflictHint")+" \xb7 ":u?x.length?x.join(" \xb7 ")+" \xb7 ":"":null===e.title?c("resources.orphan")+" \xb7 ":e.project?e.project+" \xb7 ":"",null!==f?(0,tP.rK)(f):e.target,!0===e.turnBusy?" \xb7 "+c("resources.hostBusy"):""]})]}),h?(0,U.jsx)("span",{className:`shrink-0 rounded-full border px-1.5 py-0.5 text-[9.5px] font-semibold ${h.tone}`,title:c(h.hint),children:c(h.label)}):null,!0===e.seat?(0,U.jsxs)("label",{className:"flex shrink-0 items-center gap-1 text-[9.5px] font-semibold text-muted",title:c("resources.hostSeatTick"),children:[(0,U.jsx)("input",{type:"checkbox",checked:r,onChange:i,"aria-label":c("resources.hostSeatTick"),className:"h-3 w-3 accent-[var(--color-danger)]"}),c("resources.hostSeat")]}):u&&(null===e.seat||void 0===e.seat)?(0,U.jsx)("span",{className:"shrink-0 rounded-full border border-warning/50 px-1.5 py-0.5 text-[9.5px] font-semibold text-warning",title:c("resources.hostSeatUnknownHint"),children:c("resources.hostSeatUnknown")}):null,(0,U.jsxs)("span",{className:"shrink-0 text-right",children:[(0,U.jsx)("span",{className:"block text-[11.5px] font-bold tabular-nums",children:g$(e.rssBytes)}),e.swapBytes>0?(0,U.jsx)("span",{className:"block text-[10px] tabular-nums text-muted",children:c("resources.swapShare",{amount:g$(e.swapBytes)})}):null]}),(0,U.jsx)("button",{type:"button",disabled:t,"aria-disabled":g||t,title:c(p?"resources.killLiveHint":u?"resources.killHostHint":"resources.killHint"),onClick:()=>g?a():s(),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":g?"border-border text-muted opacity-60 hover:opacity-90":"border-danger/40 text-danger hover:bg-danger/10"].join(" "),children:c(n?"resources.confirm":"resources.kill")})]}),u?null:(0,U.jsx)(gC,{target:e.target,onRefresh:()=>void l()})]})}let gF="llv:create-project-form",gq=new Set;function gz({files:e,projectCatalog:t,projectDisplayNames:n={},pipelines:r,workflows:i,archivedProjects:a,crownedProjects:s=gq,selected:l,loaded:o,catalogFailures:c=0,now:d,onSelect:u,onToggleCrown:p,onCreateProject:m}){let{t:f}=(0,eh.Ym)(),h=ib(),[x,g]=(0,Y.useState)(""),[b,v]=(0,Y.useState)(!1),w=(0,Y.useMemo)(()=>eE(e,d,i,t,r,n),[e,d,i,t,r,n]),y=(0,Y.useMemo)(()=>w.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)}),[w,x]),k=(0,Y.useMemo)(()=>y.filter(e=>!a.has(e.project)),[y,a]),j=(0,Y.useMemo)(()=>y.filter(e=>a.has(e.project)),[y,a]),{crowned:N,rest:S}=(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}})(k,s),[k,s]),C=(0,Y.useMemo)(()=>w.reduce((e,t)=>e+t.liveCount,0),[w]),A=(0,Y.useMemo)(()=>w.reduce((e,t)=>e+t.attentionCount,0),[w]),I=o&&0===c&&!w.length,M=h&&I&&!!m,[T,P]=(0,Y.useState)(M),[$,E]=(0,Y.useState)(M);M!==$&&(E(M),M&&P(!0)),(0,Y.useEffect)(()=>{if(!m)return;let e=()=>P(!0);return window.addEventListener(gF,e),()=>window.removeEventListener(gF,e)},[m]);let R=e=>{let t=s.has(e.project);return(0,U.jsxs)("div",{"data-flip-key":e.project,className:"group relative",children:[(0,U.jsx)(gB,{label:e.displayName,live:e.liveCount,attention:e.attentionCount,total:e.conversations,age:(0,tP.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)(sO.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")}),C?(0,U.jsx)("span",{className:"shrink-0 text-[11px] font-semibold tabular-nums text-muted",children:C>99?"99+":C}):null,A?(0,U.jsxs)(s_,{tone:"warning",children:["⏸",A>99?"99+":A]}):null]}),(0,U.jsxs)("div",{className:"flex shrink-0 items-center gap-1",children:[(0,U.jsx)(xx,{}),(0,U.jsx)(xd,{}),(0,U.jsx)(gk,{})]})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("span",{children:f("rail.title")}),C?(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"}),C]}):null,A?(0,U.jsxs)(s_,{tone:"warning",children:["⏸ ",A]}):null,(0,U.jsx)(xx,{}),(0,U.jsx)(xd,{}),(0,U.jsx)(gk,{})]})}),(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.jsxs)("button",{type:"button","data-testid":"rail-create-project",className:["flex shrink-0 items-center justify-center gap-1.5 rounded-[9px] border bg-canvas focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",h?"min-h-11":"",I?"border-accent/45 px-2.5 text-[12px] font-semibold text-accent hover:bg-accent/10":["border-border text-muted hover:text-primary",h?"min-w-11":"w-7",T?"text-primary":""].join(" ")].join(" "),title:f("rail.createProject"),"aria-label":f("rail.createProject"),"aria-expanded":T,onClick:()=>P(e=>!e),children:[(0,U.jsx)(sO.JU,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),I?(0,U.jsx)("span",{className:"truncate",children:f("rail.createProject")}):null]}):null]}),T&&m?(0,U.jsx)(gU,{onCreate:m,onCreated:e=>{P(!1),u(e)},onCancel:()=>P(!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)(gB,{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)(xh,{children:[N.map(R),N.length&&S.length?(0,U.jsx)("div",{"data-flip-key":"__crown-divider__",className:"mx-2.5 my-1.5 border-t border-border"}):null,S.map(R)]}),j.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)(sO.c_,{className:`h-3 w-3 shrink-0 transition-transform ${b?"rotate-90":""}`,"aria-hidden":!0}),(0,U.jsx)(sO.Td,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),f("rail.archive"),(0,U.jsx)("span",{className:"font-semibold",children:j.length})]}),b?j.map(e=>(0,U.jsx)(gB,{label:e.displayName,live:e.liveCount,attention:e.attentionCount,total:e.conversations,age:(0,tP.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,k.length||j.length?null:c>0?(0,U.jsx)(xl,{failures:c,size:"inline"}):o?x.trim()?(0,U.jsx)("div",{className:"px-3 py-4 text-center text-[12px] text-muted",children:f("common.nothingFound")}):null:(0,U.jsxs)("div",{className:"flex items-center justify-center gap-2 px-3 py-4 text-[12px] text-muted",children:[(0,U.jsx)(sO.kr,{className:"h-4 w-4 animate-spin","aria-hidden":!0}),f("common.loading")]})]}),(0,U.jsx)(gR,{}),(0,U.jsx)(gv,{})]})}let gH={INVALID_NAME:"rail.invalidName",INVALID_ROOT:"rail.invalidRoot",OUTSIDE_ROOTS:"rail.outsideRoots",DUPLICATE_PROJECT:"rail.duplicateProject"};function gU({onCreate:e,onCreated:t,onCancel:n}){let{t:r}=(0,eh.Ym)(),i=ib(),[a,s]=(0,Y.useState)(""),[l,o]=(0,Y.useState)(!1),[c,d]=(0,Y.useState)(""),[u,p]=(0,Y.useState)([]),[m,f]=(0,Y.useState)(""),[h,x]=(0,Y.useState)(0),[g,b]=(0,Y.useState)(null),[v,w]=(0,Y.useState)(!1),[y,k]=(0,Y.useState)(!1);(0,Y.useEffect)(()=>{let e=!1;return fetch("/api/projects/directories?q="+encodeURIComponent(m)).then(async e=>e.ok?await e.json():null).then(t=>{!e&&Array.isArray(t?.dirs)&&p(t.dirs.filter(e=>"string"==typeof e))}).catch(()=>{}),()=>{e=!0}},[m]);let j=e=>{d(""),w(!1),b(r(e)),f(""),x(e=>e+1)},N=`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"}`,S=async(n=!1)=>{if(y)return;if(!a.trim())return void b(r("rail.invalidName"));let i=c.trim();if(!i)return void j("rail.invalidRoot");k(!0),b(null),w(!1);let s=await e(a.trim(),i,n?{createRoot:!0}:void 0);if(k(!1),s.ok)return void t(s.project);if("MISSING_DIRECTORY"===s.code){w(!0),b(r("rail.missingRoot",{path:i}));return}"RELATIVE_ROOT"===s.code?j("rail.relativeRoot"):"MKDIR_FAILED"===s.code?b(s.message?`${r("rail.mkdirFailed")} — ${s.message}`:r("rail.mkdirFailed")):b(r(gH[s.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(),S()},children:[(0,U.jsx)("input",{className:N,placeholder:r("rail.newProjectName"),value:a,maxLength:80,autoFocus:!0,onChange:e=>{s(e.target.value),o(!!e.target.value.trim())}}),g?(0,U.jsx)("div",{className:`px-0.5 text-[11px] font-semibold ${v?"text-warning":"text-danger"}`,children:g}):null,(0,U.jsx)(xf,{id:"rail-create-root",value:c,dirs:u,disabled:y,ariaLabel:r("rail.newProjectRoot"),openSignal:h,onQueryChange:(e,t)=>{let n;return f(t?e.trim():xp(n=e.trim())?n.slice(0,n.lastIndexOf("/")+1):"")},onChange:e=>{if(d(e),w(!1),b(null),l)return;let{tail:t}=xu(e);t&&"/"!==t&&s(t)}}),v?(0,U.jsx)("button",{type:"button",disabled:y,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 S(!0),children:r("rail.createRootAndProject")}):null,(0,U.jsxs)("div",{className:"flex gap-1.5",children:[(0,U.jsx)("button",{type:"submit",disabled:y,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:y?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 gB({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=ib();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)(sO.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)(s_,{tone:"warning",children:["⏸ ",n]}):null,null!==r?(0,U.jsx)("span",{className:"shrink-0 text-[11px] font-semibold text-muted",children:r}):null]})}function gK({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=ib(),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 xs)if(window.innerWidth>=e)return t;return 1}());return window.addEventListener("resize",e),e(),()=>window.removeEventListener("resize",e)},[]),e}(),g=(0,xa.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)(xi.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)(sO.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,tP.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,tP.cr)(e.title),onClick:()=>c(e),children:[(0,U.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${(0,tP.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,tP.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,tP.rK)(r.mtime):"—"})})]})},e.project)}),h?(0,U.jsx)(xl,{failures:l,className:`col-span-full ${v.length?"mt-1":"mt-[12vh]"}`}):b.length?null:(0,U.jsxs)("div",{"data-testid":"overview-first-run",className:"col-span-full mt-[14vh] flex flex-col items-center gap-2.5 px-4 text-center",children:[(0,U.jsx)("span",{className:"text-[15px] font-bold text-primary",children:m("overview.firstRunTitle")}),(0,U.jsx)("span",{className:"max-w-[440px] text-[12px] text-secondary",children:m("overview.firstRunBody")}),(0,U.jsxs)("button",{type:"button","data-testid":"overview-create-project",className:"inline-flex min-h-11 items-center gap-1.5 rounded-[10px] border border-accent/45 bg-card px-4 text-[13px] font-bold text-accent shadow-1 hover:bg-accent/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>{f?d?.():window.dispatchEvent(new Event(gF))},children:[(0,U.jsx)(sO.JU,{className:"h-4 w-4","aria-hidden":!0})," ",m("overview.firstRunCreate")]}),(0,U.jsx)("span",{className:"max-w-[440px] text-[11.5px] text-muted",children:m("overview.firstRunElsewhere")})]})]})]})}let gY={items:[],nextCursor:null,total:0,stats:null};class gW extends Error{constructor(e){super(`transcript search request failed: ${e}`),this.status=e,this.name="TranscriptSearchRequestError"}}function gV(e,t){return`${e??""}\u0000${t}`}function gJ(e){return`${e.transcriptPath}\u0000${e.byteOffset}`}async function gG(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 gW(a.status);return a.json()}let gQ="llv-search-results";function gX(e){return`llv-search-option-${e}`}function gZ({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 g0({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 g1({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=gV(r.speaker,a),l=n&&!!a,o=e.trim(),c=gV(t,o),d=n&&!!o,[u,p]=(0,Y.useState)({key:"",speaker:void 0,page:gY,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 gG(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:gY,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 gG(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(gJ)),{items:[...n.items,...e.items.filter(e=>!r.has(gJ(e)))],nextCursor:e.nextCursor,total:e.total,stats:e.stats??n.stats}),error:!1}:t})}).catch(e=>{e instanceof gW&&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:gY,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(`#${gX(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)(sO.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":gQ,"aria-autocomplete":"list","aria-activedescendant":x>=0?gX(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)(sO.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)(sO.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:gQ,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,tP.zZ)(e.engine);return(0,U.jsxs)("button",{id:gX(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,tP.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)(g0,{snippet:e.snippet})]})]},gJ(e))}),u.nextCursor?(0,U.jsx)("button",{id:gX(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)(gZ,{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 g2=n(3599),g5=n(8309),g4=n(2133),g3=n(5377),g6=n(9707),g8=n(5330),g7=n(976);function g9(){return{entries:[],cursor:0}}function be(e){return e.cursor>0}function bt(e){return e.cursor<e.entries.length}function bn(e){return"object"==typeof e&&null!==e&&"close"===e.kind&&"string"==typeof e.path&&"string"==typeof e.title}let br=e=>`llvBoardHistory:${e}`,bi=(0,Y.createContext)(null),ba=bi.Provider;function bs(){return(0,Y.useContext)(bi)}let bl=new Map,bo=()=>0;function bc(e=15e3){let t=function(e){let t=bl.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,bl.set(e,n),n}(e);return(0,Y.useSyncExternalStore)(t.subscribe,t.read,bo)}function bd({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)(lK,{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)(g8.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)(lK,{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)(g7.A,{className:m,"aria-hidden":!0})})})]}):null}function bu(){let e=null;return{consume:t=>!!t&&e!==t.nonce&&(e=t.nonce,!0),appliedNonce:()=>e}}var bp=n(6957),bm=n(5408),bf=n(5480);let bh=["deployer"];function bx(e,t){return e.runs.find(e=>e.stageId===t)?.attempts.findLast(e=>!e.historical)??null}let bg=["orchestrator","reviewer","verifier","builder","architect","cleaner","prod-auditor","deployer"].filter(e=>!bh.includes(e));function bb(e,t){return e(`pipelineState.${t}`)}let bv=new Set(["provisioning","running"]),bw=new Set(["needs_decision","paused"]);function by(e){return!!bv.has(e.state)||"paused"===e.state&&null!==e.pausedState&&bv.has(e.pausedState)}let bk={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)"}},bj={pending:"○",running:"▸",reviewing:"⟳",committing:"▾",passed:"✓",failed:"✕",needs_decision:"●!",skipped:"↷"};function bN(e,t){return e.runs.find(e=>e.stageId===t)?.attempts??[]}let bS=new Set(["draft","provisioning","running","needs_decision","paused"]),bC=new Set(["pending","spawning","running","reviewing","committing"]);function bA(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=bx(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=bx(t,e.id);return"run"===e.kind&&n?.state==="passed"&&n.agentPath}),l=i.flowId?n.get(i.flowId)?.implementerPath:s?bx(t,s.id)?.agentPath:null;l&&r.add(l)}return r}function bI(e,t){return t.size?e.filter(e=>!t.has(e.path)):e}function bM(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 bT(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 tr(t,e,n))r.add(a.path),a.conversationId&&i.add(a.conversationId)}return{paths:r,conversationIds:i}}function bP(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}=bT(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 b$(e,t,n,r,i=[]){let a=n.find(e=>bT(e,r,i).paths.has(t)),s=a?bT(a,r,i).paths:null,l=s?e.filter(e=>!s.has(e)):[...e];return l.includes(t)?l:[...l,t]}function bE(e,t){let n=bx(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&&by(e)?e.cursor?.state==="committing"||n?.state==="committing"?"committing":"review-loop"===t.kind||e.cursor?.state==="reviewing"||n?.state==="reviewing"?"reviewing":"running":"pending"}function bR(e,t){return new Set(e.filter(e=>("closed"!==e.state||e.restored)&&t.has(e.implementerPath)).map(e=>e.id))}function bO(e){return e&&(e.conversationId||e.agentPath)?{conversationId:e.conversationId,agentPath:e.agentPath}:null}function bD(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 bL(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=[...tr(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 b_(e,t,n,r,i=[]){for(let a of[...e.stages].reverse()){let s=bL(a,bx(e,a.id),t,n,r,i);if(s)return s}return null}function bF(e,t,n){return!!n&&(!!n.verdict||!!n.error||"needs_decision"===e.state&&e.cursor?.stageId===t.id)}function bq(e,t,n,r=[],i,a=[]){if(!n)return!1;let s=e=>!i||i.has(e),l=bN(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=>tr(e,t,a).some(({path:e})=>!c.has(e)&&s(e))))}function bz(e,t){return e(`pipelineChipState.${t}`)}function bH(e,t){return t.role?.roleId?au(e,t.role.roleId):"review-loop"===t.kind?e("pipelineStrip.reviewStage"):t.id}function bU(e,t,n,r){let i=bH(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 bB(e){let t=new Map;for(let n of e)"closed"!==n.state&&n.stages.forEach((e,r)=>{let i=bx(n,e.id);i?.agentPath&&t.set(i.agentPath,{pipeline:n,stage:e,index:r,total:n.stages.length})});return t}function bK(e,t){return t?bU(e,t.stage,t.index,t.total):void 0}function bY(e,t,n){let r=bE(e,t);return"skipped"===r||"completed"===n&&("passed"===r||"failed"===r)}function bW(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 bV(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=bx(e,i.id);if(!s)return;bC.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 bJ={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 bG(e,t){return e("pass"===t?"pipelineVerdict.pass":"fail"===t?"pipelineVerdict.fail":"pipelineVerdict.needsDecision")}let bQ=[{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}}"}]}],bX=/\{\{(?:task|prev\.output)\}\}/g;function bZ(e){return e.replace(bX," ").split("\n").map(e=>e.replace(/[ \t]+/g," ").trim()).join("\n").replace(/\n{3,}/g,"\n\n").trim()}function b0(e){let t=e.indexOf("run"),n=e.indexOf("review-loop");return -1===n||-1!==t&&t<n}async function b1(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 b2(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 rP(n.pipeline,!0),!1!==e.autoStart&&window.dispatchEvent(new Event(nI)),{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 b5(e,t,n,r){var i;let a,s,l=(t??"").trim();return l?b2({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 b4(e,t,n,r){let i=bx(e,t.id);return!!i&&(!!(i.agentPath&&n.has(i.agentPath))||"review-loop"===t.kind&&!!(i.flowId&&r.has(i.flowId)))}let b3=new Set(["passed","failed","needs_decision","skipped"]);function b6(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 b8=new Set(["start","retry-stage","skip-stage","resume","pause","close"]),b7={roleId:null,engine:"claude",model:"",effort:"",promptScaffold:null};function b9(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 ve(e,t,n,r,i){return vt(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 vt(e,t,n,r){r&&rP(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?rP(a.pipeline,!0):r&&r$(e),b8.has(t)&&window.dispatchEvent(new Event(nI)),null;return r&&r$(e),a?.error??(0,eh.Tl)((0,eh.JK)(),"pipelineModel.failed",{status:i.status})}catch{return r&&r$(e),(0,eh.Tl)((0,eh.JK)(),"common.serverUnavailable")}}let vn={dim:"var(--color-strong)",active:"var(--color-accent)",ok:"var(--color-success)",amber:"var(--color-warning)"};function vr(e){return"deck::"+e}function vi(e,t){return`slot::${e}::${t}`}function va(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 vs(e){return e.rounds.at(-1)??null}function vl(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 vo(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 vc=new Set(["provisioning","running"]);function vd(e){return!!vc.has(e.state)||"paused"===e.state&&null!==e.pausedState&&vc.has(e.pausedState)}function vu(e,t){let n=bx(e,t);return n?.state==="passed"||n?.state==="skipped"?"ok":n?.state==="failed"||n?.state==="needs_decision"?"amber":e.cursor?.stageId===t&&vd(e)?"active":"dim"}let vp={authenticated:"accounts.auth.authenticated",signed_out:"accounts.auth.signedOut",unknown:"accounts.auth.unknown",error:"accounts.auth.error"},vm={claude:"Claude",codex:"Codex"};function vf(e){return e?[e.intentId,e.revision??"",e.phase,e.targetAccountId,e.failure??""].join("\0"):null}function vh({engine:e,accountId:t,file:n,runtimeSession:r}){var i,a,s,l,o;let c,d,{t:u}=(0,eh.Ym)(),p=ib(),m=xT(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=vo(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=vm[l],o?a("branch.accountTip",{id:s,engine:c,health:a(vp[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),oQ("ok",u("accounts.conversationApplied"))):("failed"===t.status||"rejected"===t.status)&&(k.current=null,j.current=null,N.current=null,g(!1),oQ("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),oQ("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),oQ("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&&vf(e)!==N.current&&(j.current=null,N.current=null,g(!1),oQ("err",e.failure))},[n?.migration,x]);let M=async i=>{if(n&&i!==t&&!x){g(!0),h(!1),j.current=i,N.current=vf(n.migration);try{let t=ce(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),oQ("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)(sO.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)(sO.kr,{className:"h-2.5 w-2.5 animate-spin","aria-hidden":!0}):n?(0,U.jsx)(sO.yQ,{className:"h-2.5 w-2.5","aria-hidden":!0}):null]})}),P=f&&n&&b?(0,nA.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)(sO.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)(lK,{label:A,children:T}),P,x?(0,U.jsx)("span",{className:"sr-only",role:"status",children:u("accounts.conversationPending")}):null]})}let vx="var(--color-info)",vg=new Map;function vb(){for(let e of document.querySelectorAll("[data-link-hover]"))e.removeAttribute("data-link-hover")}function vv(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 vw(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="",vb()},[]),(0,Y.useEffect)(()=>{if(!s)return;let e=window.setTimeout(()=>{vb(),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",vb(),l(null),a({x:t.anchorX,y:t.anchorY}),n(!0),r.current.onDragStart?.()}u.current?.setAttribute("d",vv(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=vg.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}}):vb()}else vb(),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,nA.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:vx})})}),(0,U.jsx)("path",{ref:e=>{u.current=e;let t=o.current;e&&t?.active&&e.setAttribute("d",vv(t.anchorX,t.anchorY,t.lastX,t.lastY))},d:s?vv(s.from.x,s.from.y,s.to.x,s.to.y):void 0,fill:"none",stroke:vx,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:vx})]}),s?(0,U.jsx)(vy,{drop:s}):null]}),document.body):null}}function vy({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:vx},children:[(0,U.jsx)(fF.A,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),(0,U.jsx)("span",{className:"truncate",children:e.label})]})}let vk={"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 vj({file:e,fontClassName:t="text-caption"}){let{t:n}=(0,eh.Ym)(),r=function(e,t=Date.now()){if(null!==eB(e,t/1e3))return{kind:"needs-you"};let n=lO(e.migration,lP(e.path)),r=n?.heldDeliveries??0;if(r>0)return{kind:"held",count:r};if(uO(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:uR(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} ${vk[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 vN({file:e,onDeleted:t}){let{t:n}=(0,eh.Ym)(),r=ib(),[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)(sO.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 vS=new Set,vC=-1/0,vA=-1/0,vI=0,vM=!1;function vT(){for(let e of(vI=0,vS)){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(),vC,vA,e.radius);t!==e.near&&(e.near=t,e.notify(t))}}function vP(e){vC=e.clientX,vA=e.clientY,0===vI&&(vI=requestAnimationFrame(vT))}function v$({id:e,cardRef:t,touch:n=!1}){let r=bs(),{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 vS.add(i),vM||(vM=!0,window.addEventListener("pointermove",vP,{passive:!0})),()=>{vS.delete(i),!(vS.size>0)&&vM&&(vM=!1,window.removeEventListener("pointermove",vP),0!==vI&&(cancelAnimationFrame(vI),vI=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 vE({id:e,touch:t=!1}){let n=bs(),{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 vR({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 vO={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 vD({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 ${vO[e]}`,children:["pending"===e?(0,U.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[(0,U.jsx)(as.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)(ue.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)(as.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)(sD.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 vL({file:e}){let{level:t,slots:n}=(0,tP.IR)(e);if(!t)return null;let{color:r}=(0,tP.oC)(e),i=(0,tP.$)(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 v_=n(5097),vF=n(467);function vq({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)(v_.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)(vF.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)(sO.kr,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):(0,U.jsx)(sO.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 vz({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,tP.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)(vq,{t:t,sinceLabel:o,onOpenSuccessor:()=>{window.location.hash="#c="+encodeURIComponent(s.tailConversationId??s.conversationId)},onResumeHere:()=>void c(),resumeBusy:n,resumeError:i})}let vH=()=>"uk"===(0,eh.JK)()?"uk-UA":"en-US",vU={completed:"✓",in_progress:"▸",pending:"○"};function vB({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=>`${vU[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 vK={active:{labelKey:"plan.goal",tone:"accent"},complete:{labelKey:"plan.goalDone",tone:"success"},blocked:{labelKey:"plan.goalBlocked",tone:"danger"}};function vY(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 vW({ctx:e}){var t;let n,r,{t:i}=(0,eh.Ym)(),a=e.usedTokens.toLocaleString(vH());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(vH())})}
|
|
77
|
+
${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)(s_,{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 ",vY(e.usedTokens),null===e.windowTokens?null:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("span",{className:"opacity-50",children:"/"}),vY(e.windowTokens)]})]})}function vV({goal:e}){let t,n,{t:r}=(0,eh.Ym)(),i=vK[e.status];return(0,U.jsx)(s_,{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(vH())})),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 vJ(e,t){return e.path===t.path||null!=e.conversationId&&null!=t.conversationId&&e.conversationId===t.conversationId}function vG({file:e,displayMax:t=90,titleClassName:n="",className:r="",alwaysVisible:i=!1,autoEditToken:a}){let{t:s}=(0,eh.Ym)(),l=ib(),[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=!vJ(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 nP({path:e.path,conversationId:e.conversationId,title:i,baseRevision:$,windowName:i??M});if(vJ(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 nP({path:e.path,conversationId:e.conversationId,title:i,baseRevision:t,windowName:i??M});if(!vJ(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)(sO.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)(sO.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)(sO.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)(sO._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 vQ=n(4914);function vX({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=eJ(i,r,u),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)(s_,{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 lU(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)(ue.A,{className:"h-2.5 w-2.5 animate-spin motion-reduce:animate-none","aria-hidden":!0}):h?(0,U.jsx)(f7.A,{className:"h-2.5 w-2.5","aria-hidden":!0}):(0,U.jsx)(vQ.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 vZ=n(2879);let v0={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)"}},v1=["inbox","assigned","blocked","done"];function v2(e){return e.split(/\r?\n/,1)[0]?.trim()??""}function v5({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=v2(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:v0[e.status].color}}),"source"===r?(0,U.jsx)(fF.A,{className:"h-3 w-3 shrink-0 text-info","aria-hidden":!0}):(0,U.jsx)(vZ.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 v4(e){return e?`wake-${e.fireAt}`:"wake-none"}function v3({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=m8(d,i),m=m7(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)(sO.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 v6=()=>void 0,v8={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"}},v7={live:"bg-card",waiting:"bg-card",returned:"bg-card",stalled:"bg-card",done:"bg-quiet"};function v9(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 we(){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)(bp.A,{className:"h-2.5 w-2.5","aria-hidden":!0})," ",e("lineage.parentRemoved")]})}function wt({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,tP.rK)(e.mtime)}),children:(0,tP.rK)(e.mtime)})}function wn({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=ib(),v=(0,Y.useRef)(null),w=(0,tP.yz)(e),y=tL(e),k=v8[y],j=lO(e.migration,lP(e.path)),N=lE(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}=cO(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 lH(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,t_.set(E,e),()=>{t_.get(E)===e&&t_.delete(E)}}},[E,c]),(0,Y.useEffect)(()=>{if(!e.spawn&&!a&&!c&&v.current){var t;return t=v.current,vg.set(e.path,{el:t,file:e}),()=>{vg.get(e.path)?.el===t&&vg.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)(vE,{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 ${v7[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,tP.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,tP.tz)(e.activity)}`,title:g(`branch.${y}`)}),(0,U.jsx)(vj,{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,tP.cr)(e.title)}`,children:x}):e.renamable?(0,U.jsx)(vG,{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,tP.cr)(e.title),children:(0,tP.cr)(e.title,90)}),(0,U.jsx)(hf,{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)(sO.c_,{className:`h-4 w-4 transition-transform ${M?"rotate-90":""}`,"aria-hidden":!0})}):null,p?(0,U.jsx)(v$,{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,tP.cr)(e.title,60)}),title:c?g("branch.collapseFull"):g("branch.expandFull",{title:(0,tP.cr)(e.title,60)}),onClick:o,children:c?(0,U.jsx)(bm.A,{className:b?"h-4 w-4":"h-3 w-3","aria-hidden":!0}):(0,U.jsx)(aR.A,{className:b?"h-4 w-4":"h-3 w-3","aria-hidden":!0})}):null,l,e.spawn?null:(0,U.jsx)(vN,{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,tP.cr)(e.title,60)}),onClick:r,children:(0,U.jsx)(sO.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)(vW,{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)(wt,{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,tP.oC)(e).soft,color:(0,tP.oC)(e).color},title:[w.label,(0,tP.$)(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,tP.$)(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,tP.oC)(e).soft,color:(0,tP.oC)(e).color},title:[w.label,(0,tP.$)(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,tP.$)(e),children:w.label}),(0,U.jsx)(vL,{file:e})]}),(0,U.jsx)(vX,{file:e}),(0,U.jsx)(v3,{wakeup:e.pendingWakeup},v4(e.pendingWakeup)),e.parentRemoved?(0,U.jsx)(we,{}):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)(ux.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)(vW,{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)(bf.A,{className:"h-2.5 w-2.5","aria-hidden":!0})," ",e.worktree]}):null,"shell"===e.engine||"openclaw"===e.engine?null:(0,U.jsx)(vh,{engine:e.engine,accountId:O?.session.accountId??e.spawn?.accountId??lP(e.path),file:e,runtimeSession:O?.session??null}),e.plan?(0,U.jsx)(vB,{plan:e.plan}):null,e.goal?(0,U.jsx)(vV,{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)(ux.A,{className:"h-3 w-3","aria-hidden":!0})," ",e.handoff?g("kind.handoff"):v9(g,e.kind)]})]})]}):null]}),N?(0,U.jsx)(vD,{state:N,targetLabel:lR(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)(hs,{file:e}):null,L?(0,U.jsx)(vz,{file:e}):null,f?.length&&h?(0,U.jsx)(v5,{relations:f,onOpenTask:h}):null,t.length?(0,U.jsx)(xh,{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)(wr,{file:e,paused:V})},e.path))}):null,(0,U.jsx)(vR,{predecessorLabel:e.predecessorLabel}),(0,U.jsx)(hj,{file:e,showSvc:!1,lineFilter:"",onStatus:v6,paused:V,follow:!0,setFollow:v6,compact:!0,onLaunchRetry:m&&e.spawn?()=>m(e):void 0}),d||!P?null:(0,U.jsx)(uz,{file:e}),a||L?null:(0,U.jsx)(dF,{file:e,pollPaused:V,deadHost:D,sendBlockedReason:F})]})]})}function wr({file:e,paused:t=!1}){let{t:n}=(0,eh.Ym)(),[r,i]=(0,Y.useState)(!1),a=(0,tP.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)(sO.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,tP.tz)(e.activity)}`}),(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11.5px] font-semibold",title:(0,tP.cr)(e.title),children:a})]}),(0,U.jsx)(hf,{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)(hj,{file:e,showSvc:!1,lineFilter:"",onStatus:v6,paused:t,follow:!0,setFollow:v6,compact:!0})}):null]})}let wi={items:[],nextCursor:null,total:0};class wa extends Error{constructor(e){super(`conversation catalog request failed: ${e}`),this.status=e,this.name="ConversationCatalogRequestError"}}async function ws(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 wa(a.status);return a.json()}function wl({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:wi,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 ws(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:wi,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 ws(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 wa&&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??wi,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 wo(){location.hash="#p="+encodeURIComponent(ew)}async function wc(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 wd(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 wu({file:e,activeSubtree:t,showProject:n=!1,onOpen:r}){let{t:i}=(0,eh.Ym)(),a=ib(),[s,l]=(0,Y.useState)(!1),o=(0,tP.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)(sO.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,tP.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)(sO.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,tP.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)(vN,{file:e,onDeleted:()=>l(!0)})]})}function wp({files:e,allowEmpty:t=!1,onArchive:n,compact:r=!1}){let{t:i}=(0,eh.Ym)(),a=ib();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(),wo()},children:[(0,U.jsx)(sO.Td,{className:a?"h-4 w-4":"h-3 w-3","aria-hidden":!0})," ",r&&!a?null:i("trash.toArchive")]})}function wm({project:e,files:t,available:n}){let{t:r}=(0,eh.Ym)(),i=ib(),[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 wc(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 wd(e,u);(o(!1),s(!1),t)?d(r("trash.notDeleted",{failed:t,total:u.length})):wo()};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)(sO.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 wf({project:e,enabled:t,onOpen:n}){let{t:r}=(0,eh.Ym)(),[i,a]=(0,Y.useState)(""),s=!!i.trim(),l=wl({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)(wu,{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)(sO.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 wh(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]??"":""]))}let wx=(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)(sO.MA,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}):(0,U.jsx)(sO.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]})}),wg=new Set(["image/png","image/jpeg","image/gif","image/webp"]);function wb(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||!wg.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 wv=(e,t)=>`llvDraftPane:${e}:${t}`,ww=null,wy=null;function wk(){let[e,t]=(0,Y.useState)(()=>ww??[]);return(0,Y.useEffect)(()=>{if(ww)return;let e=!1;return(wy??=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?ww=e:wy=null,e))).then(n=>{!e&&n&&t(n)}),()=>{e=!0}},[]),e}function wj({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)(un,{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:ad(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:ad(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,ad(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)(un,{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,ad(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,ad(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 wN(e,t){return sessionStorage.getItem(wv(e,t))??""}function wS(e,t,n){n?sessionStorage.setItem(wv(e,t),n):sessionStorage.removeItem(wv(e,t))}function wC(e){return wN(e,"src")}function wA(e,t){let n=t.trim();wS(e,"cwd",n),wS(e,"cwdSeed",n)}function wI(e){let t=wN(e,"cwd").trim();return!t||t===wN(e,"cwdSeed").trim()}let wM="llv:draft-cwd-resolved";function wT({draftId:e,project:t,files:n,onClose:r,onSpawned:i}){let{t:a}=(0,eh.Ym)(),[s]=(0,Y.useState)(()=>wN(e,"src")),[l]=(0,Y.useState)(()=>wN(e,"parentConversationId")),o=s?n.find(e=>e.path===s)??null:null,[c]=(0,Y.useState)(()=>wN(e,"cwd")),d=(0,Y.useRef)(!!(s&&wI(e))),[u,p]=(0,Y.useState)(()=>c||eT(n,t,s)),m=wk(),[f,h]=(0,Y.useState)(()=>wN(e,"role")),[x,g]=(0,Y.useState)(()=>(function(e){try{let t=JSON.parse(wN(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)(()=>wN(e,"reviews")),[w,y]=(0,Y.useState)(()=>wN(e,"confirm")),[k,j]=(0,Y.useState)([]),[N,S]=(0,Y.useState)({status:"loading",requestKey:""}),C=ul({storage:{read:t=>wN(e,t),write:(t,n)=>wS(e,t,n)},initialEngine:o?.engine==="codex"?"codex":"claude",onEngineChange:e=>S({status:"loading",requestKey:`${t}
|
|
78
|
+
${s??""}
|
|
79
|
+
${e}`})}),{engine:A,model:I,effort:M,speed:T}=C,P=`${t}
|
|
80
|
+
${s??""}
|
|
81
|
+
${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(wN(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(wM,t),()=>window.removeEventListener(wM,t)},[e]);let{setEngine:B,setModel:K,setEffort:V,setSpeed:J}=C,G=t=>{g(t),wS(e,"roleParams",JSON.stringify(t))},Q=t=>{y(t),wS(e,"confirm",t)},X=(0,Y.useCallback)(t=>{D(t),wS(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&&!oB(I)?{...et,supported:!1,reason:a("composer.codexImagesTextOnly")}:et,ei=lo({initialText:()=>wN(e,"text")||(s?a("draft.readPrompt",{src:s}):""),persistText:t=>wS(e,"text",t),submit:e=>eb(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&&wA(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=wb(t.claude),r=wb(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)&&oj(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(rv,e),()=>window.removeEventListener(rv,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{...t.title?{title:t.title}:{},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=hL(n.status,n.ok,r),l="launched"===s.kind||"failed-launch"===s.kind?s.launchId??e.clientAttemptId:null;if(l&&ng("launched"===s.kind?{cue:"launch",eventId:`launch:${l}`}:{cue:"failure",eventId:`launch-failed:${l}`}),"string"==typeof r?.launchId&&"string"==typeof r.conversationId&&nG(),"launched"===s.kind){let n=s.conversationId??(s.launchId?`spawn:${s.launchId}`:null);n&&s.launchId&&oj(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=h_(e,s,t);r&&(rE(r),i(r))}else if("failed-launch"===s.kind)X({...e,target:s.target,conversationId:s.conversationId,launchId:s.launchId,phase:"attention",error:s.message});else if("failed-preflight"===s.kind){let t=void 0!==e.request.title||s.message!==ex.QE?null:{...e,request:{...e.request,title:hD(e.request.engine,e.request.role,e.request.prompt,e.request.images.length)}};if(t){H.current.delete(e.clientAttemptId),X(t);return}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&&(void 0===e.title||"string"==typeof e.title&&null!==(0,ex.St)(e.title,120))&&"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,eg="loading"===R.status?a("composer.imageCapabilityLoading"):"error"===R.status?a("composer.imageCapabilityError"):Z?.spawnTransport!=="structured"||"codex"!==A||oB(I)?Z?.spawnTransport!=="structured"||er?.supported?void 0:a("composer.structuredImagesProtocol"):a("composer.codexImagesTextOnly"),eb=async e=>{let t=e??ea;if(eo||ed||O)return;if(eu.images.length&&ef)return void el({kind:"err",text:eg??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=hO(("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(),{title:hD(A,f,t,eu.images.length),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)},ev=(0,tP.t7)(A),ew=ei.fieldsDisabled,ey="draft-dirs-"+e,ek=O?"attention"===O.phase?"attention":"confirming"===O.phase?L?"confirming-slow":"confirming":L?"booting-slow":"booting":eo?"launching":"draft",ej=O?.target??"",eN=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:ev.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:ev.soft},children:[(0,U.jsx)(uc,{draft:C,disabled:ew,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)(uo,{engine:A,disabled:ew,onChange:B}),(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12px] font-semibold text-muted",title:o?(0,tP.cr)(o.title):void 0,children:s?a("draft.handoffLabel",{title:o?(0,tP.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)(sO.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)(xf,{id:ey,value:u,dirs:k,disabled:ew,ariaLabel:a("draft.dirAria"),onChange:t=>{d.current=!1,p(t),wS(e,"cwd",t)}})]}),(0,U.jsxs)(wj,{idPrefix:e,roles:m,roleId:f,roleParams:x,disabled:ew,onSelectRole:t=>{h(t),wS(e,"role",t);let n=m.find(e=>e.id===t);if(!n){G({}),Q("");return}G(wh(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)(un,{value:b,disabled:ew,onChange:t=>{var n;v(n=t.target.value),wS(e,"reviews",n)},"aria-label":a("draft.reviewsAria"),children:[(0,U.jsx)("option",{value:"",children:a("draft.reviewsPlaceholder")}),b&&!eN.some(e=>(e.conversationId??e.path)===b)?(0,U.jsx)("option",{value:b,children:b}):null,eN.map(e=>{let t=e.conversationId??e.path;return(0,U.jsx)("option",{value:t,children:(0,tP.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:ew,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)(ur,{engine:A,model:I,effort:M,speed:T,disabled:ew,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)(wx,{ref:z,phase:ek,target:ej,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:ev.soft,color:ev.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(),eb()},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)(lG,{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:ev.color,borderColor:ev.color},imageDisabled:ef,imageDisabledReason:eg,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)(sO.jG,{className:"h-3 w-3 shrink-0","aria-hidden":!0})," ",a("draft.newAgent")]})})]})]})}function wP({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)(d9.A,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",n("orchPanel.title")]})}function w$(e,t){return{mutation:{kind:"close",path:e},ephemeral:t.filter(t=>t!==e)}}function wE(e){return`llvReviewDeckCollapsed:${e}`}function wR(e){return"approved"===e.state||"done_comment"===e.state||"closed"===e.state}function wO(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 wD(e,t,n,r){e.setItem(wE(t),JSON.stringify({v:n,at:r}))}function wL({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&&b1(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=bQ.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)(sO.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 w_(e){let t=e.durableLineage?.parentConversationId??null;return t||(e.parentRemoved?.conversationId??null)}function wF(e){if(!e.endsWith(".jsonl"))return e;let t=e.lastIndexOf("/");return t<0?e:e.slice(t+1)}function wq(e){if(!e)return 0;let t=Date.parse(e);return Number.isFinite(t)?t/1e3:0}function wz(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 wH(e){return"unplaced"!==e.placement&&void 0!==e.pos}let wU=Math.max(1,Math.floor(236/13));function wB(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/wU);t+=e-1,n=(r.length-(e-1)*wU)*13}}return t}function wK(e){let t=e.split(/\r\n?|\n/),n=wB(t[0]??""),r=0;for(let e=1;e<t.length;e+=1)r+=wB(t[e]);return{title:n,rest:r}}function wY(e,t=!1){let n=wK(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 wW(e,t=!1){return wY(e,t)+36}function wV(e,t=!1){return{x:e.pos.x,y:e.pos.y,w:260,h:wW(e,t)}}function wJ(e){return{x:e.x+e.w/2,y:e.y+e.h/2}}function wG(e,t){let{x:n,y:r}=wJ(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 wQ(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 wX(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 wZ(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=wQ(c,e,n,i,s),u=wQ(c,t,r,a,l);for(let e of m)if(wX(h,x,d,u,e,10))return!0;h=d,x=u}return!1}let w0=(e,t,n)=>e+(t-e)*n;function w1(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:wQ(.5,r,e.c1x,e.c2x,a),y:wQ(.5,i,e.c1y,e.c2y,s)},crosses:!1});if(!t.length||!wZ(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(!wZ(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=>wX(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:w0(p,m,1/3),c2x:c,c2y:w0(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:w0(p,m,1/3),c1y:c,c2x:w0(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(wZ(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:wQ(.5,t.x1,t.c1x,t.c2x,t.x2),y:wQ(.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 w2(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 w5(e,t,n){let r=[];for(let n of t)n.id===e.taskId||w2(n,e)||r.push({x:n.x,y:n.y,w:n.w,h:n.h});for(let t of n)w2(t,e)||r.push({x:t.x,y:t.y,w:t.w,h:t.h});return r}function w4(e,t,n,r,i,a){return Math.abs((e-n)*a-(t-r)*i)}function w3(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 w6(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 w8(e){let t=1/0,n=1/0,r=-1/0,i=-1/0;for(let a of e){let e=w6(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 w7(e,t){return e.minX<=t.maxX&&t.minX<=e.maxX&&e.minY<=t.maxY&&t.minY<=e.maxY}function w9(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 ye(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 yt(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 yn(e,t,n){for(let r of e)for(let e of t)if(function e(t,n,r,i){if(!w7(w6(t),w6(n)))return!1;let a=yt(t),s=yt(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]:ye(t),o=s?[n]:ye(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 yr=[1,-1,2,-2,3,-3];function yi(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 ya(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=w_(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=e9(r),y=te(r,n),k=r.filter(e=>!tM(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=wF(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(wF(e))??void 0}(n),m=new Set([...M].map(wF)),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,wq(t));for(let t of e.runs)for(let e of t.attempts){a=Math.max(a,wq(e.startedAt),wq(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(wF(e.agentPath)))return!1;let t=e.flowId?S(e.flowId):null;if(t&&m.has(wF(t)))return!1}return!0},h=new Set;for(let[t,n]of r.entries()){if(n.stages.forEach((e,r)=>{let i=bx(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 bS.has(e.state)?e.stages.filter(r=>{let i=bx(e,r.id);return i?!b4(e,r,t,n)&&("needs_decision"===e.state&&e.cursor?.stageId===r.id||bC.has(i.state)):0===bN(e,r.id).length}):[]})(n,M,T).map(e=>e.id)),i=bS.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=bx(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=bN(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=yi(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=>wH(e)&&!h.has(e.id)).map(e=>({task:e,h:wW(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=bY(e.pipeline,a,l),u=d?96:620,p=i&&bY(e.pipeline,i.stage,i.presentation)?96:620,m={key:vi(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=wC(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=tn(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:vr(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,tP.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=vl(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,tP.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,tP.cr)(e.pipeline.task,60):e.flow?(0,tP.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(vr(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:vo(e.id),members:[...t],pipeline:e})}for(let t of e9(e).values()){if(a.has(t.id))continue;let e=new Set,r=n(t.implementerPath);r&&e.add(r);let s=n(vr(t.id));s&&e.add(s),e.size&&i.push({key:`group::flow::${t.id}`,kind:"flow",id:t.id,hue:vo(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:vo(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 e9(e).values()){let e=t(r.implementerPath);if(!e)continue;let i=vs(r),a=(i?.reviewerPath?t(i.reviewerPath):null)??t(vr(r.id));a&&a!==e&&n.push({key:"flowlink::"+r.id,kind:"flow",from:e,to:a,leg:td(r),flow:{flow:r,round:i?.n??0,phase:va(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=vd(i),l=[],o=[],c=!1,d=e=>{let r=bx(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(vi(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":vu(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:vu(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 ys(e){if("running"===e.proc)return!0;let t=e.spawn?.state;return"starting"===t||"binding"===t||"queued"===t}function yl(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=ys(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":ys(e)||e.authoritativeTurn?.state==="busy"?"silent":"closed"}function yo(e){return"running"===e||"live"===e?0:"silent"===e?1:"closed"===e?2:3}function yc(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 yd(e,t){let n=yc(e);return n?t(n.pipelineId,"retry-stage",{stageId:n.stageId,launchId:n.launchId}):"launch is not owned by a pipeline stage"}function yu({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)(sO.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 yp({items:e,onRetry:t}){let{t:n}=(0,eh.Ym)(),r=ib(),[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)(yu,{open:i,onToggle:()=>a(e=>!e),label:n("launchHistory.title"),count:e.length,icon:(0,U.jsx)(v_.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,tP.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,tP.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)(sD.A,{className:"h-3 w-3","aria-hidden":!0})," ",n("launchHistory.retryLabel")]}):null]},e.path)})}):null]}):null}function ym(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 yf=n(2550);function yh(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 yx(e){return"live"===e||"killed"===e||"unhosted"===e}let yg=["now","review","blocked","planned","done"],yb={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)"}},yv=(e,t)=>t[e]??e;function yw(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(yv(n.conversationId,t.aliases))),n.path&&i(t.byPath.get(n.path));return{pipelines:[...n],flows:[...r]}}function yy(e){return e.cursor?.state==="reviewing"||"completed"===e.state||function(e){let t;for(let n of e.stages){let r=bx(e,n.id);r&&(t=r)}return t?.verdict?.status==="pass"}(e)}let yk=new Set(["reviewing","relay_pending","relaying","fixing","approved","done_comment"]);function yj(e){return yk.has(e.state)||e.rounds.at(-1)?.verdict==="APPROVE"}function yN({task:e,index:t,byPath:n,repository:r,onOpenTask:i,onPlaceOnMap:a,onOpenFile:s}){let{t:l}=(0,eh.Ym)(),o=ib(),c=(0,tP.cr)(v2(e.text),60)||l("tasks.untitled"),d="unplaced"===e.placement||!e.pos,u=v0[e.status],p=function(e,t){let n=!1,r=!1;for(let i of e.assignments){let e=yh(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=yw(e,t),h=f.pipelines.map(e=>(function(e){if(e.cursor){var t,n;let r=bx(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&&yx(yh(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 yS({section:e,index:t,byPath:n,repository:r,onOpenTask:i,onPlaceOnMap:a,onOpenFile:s}){let{t:l}=(0,eh.Ym)(),o=ib(),[c,d]=(0,Y.useState)(!1),u=yb[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)(xh,{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)(yN,{task:e,index:t,byPath:n,repository:r,onOpenTask:i,onPlaceOnMap:a,onOpenFile:s},e.id))}):null]})}function yC({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=ib(),[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,yv(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(yg.map(e=>[e,[]]));for(let r of e)n.get(function(e,t){if("done"===e.status)return"done";let n=yw(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(yy)||n.flows.some(yj)?"review":"assigned"===e.status?"now":"planned"}(r,t)).push(r);return yg.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)(yu,{open:u,onToggle:()=>p(e=>!e),label:c("readiness.title"),count:e.length,icon:(0,U.jsx)(yf.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)(yS,{section:e,index:m,byPath:h,repository:a,onOpenTask:s,onPlaceOnMap:l,onOpenFile:o},e.readiness))]}):null]}):null}function yA({stack:e,label:t,flows:n,reviewGroup:r,onSelect:i,onExpandGroup:a}){let{t:s}=(0,eh.Ym)(),l=ib(),[o,c]=(0,Y.useState)(!1),d=r?.rounds[r.rounds.length-1]??null,u=d?tp(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)(sO.c_,{className:`h-3.5 w-3.5 shrink-0 text-muted transition-transform ${o?"rotate-90":""}`,"aria-hidden":!0}),(0,U.jsx)(sO.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?`${tu[d.verdict]} ${d.verdict}`:s("roundDeck.aborted")}):d?(0,U.jsx)("span",{className:"inline-flex h-4 shrink-0 items-center rounded-full bg-sunken px-1.5 text-[9.5px] font-bold text-muted",children:s("workerStack.noVerdict")}):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)(sO.zg,{className:"h-3.5 w-3.5","aria-hidden":!0})}):null]}),o?(0,U.jsx)(xh,{className:"mt-1 flex flex-wrap items-start gap-1.5 pb-1 pl-5",children:e.items.map(e=>{let t=(0,tP.yz)(e),r=function(e,t){for(let n of t){let t=n.rounds.find(t=>t.reviewerPath===e.path);if(t)return{verdict:t.verdict?tu[t.verdict]:null,reviewer:!0}}let n=e.durableLineage?.role==="reviewer"||e.durableLineage?.memberships.some(e=>"reviewer"===e.role)===!0;return{verdict:e.review?.verdict?tu[e.review.verdict]:null,reviewer:n}}(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,tP.tz)(e.activity)}`}),(0,U.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px]",style:t.style,children:t.label}),r.verdict?(0,U.jsx)("span",{className:"shrink-0 text-[10px] text-muted","aria-hidden":!0,children:r.verdict}):null,!r.verdict&&r.reviewer?(0,U.jsx)("span",{"data-reviewer-no-verdict":!0,className:"shrink-0 rounded-full bg-card px-1.5 text-[9px] font-bold text-muted",children:s("workerStack.noVerdict")}):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,tP.rK)(e.mtime)})]},e.path)})}):null]})}function yI({stacks:e,files:t,flows:n,pipelines:r=[],onSelect:i,onExpandGroup:a}){let{t:s}=(0,eh.Ym)(),l=ib(),[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)(yu,{open:o,onToggle:()=>c(e=>!e),label:s("workerStack.idle",{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)(yA,{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&&tM(t)&&wR(t)?t:null})(e),onSelect:i,onExpandGroup:a},e.key))}):null]}):null}function yM(e){return e.open?(0,U.jsx)(yT,{...e}):null}function yT({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)(sO.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)(sO.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 yP=(e,t)=>`llvWfDraft:${e}:${t}`;function y$(e,t){return sessionStorage.getItem(yP(e,t))??""}function yE(e,t,n){n?sessionStorage.setItem(yP(e,t),n):sessionStorage.removeItem(yP(e,t))}function yR(e){for(let t of["template","dir","task","mode"])sessionStorage.removeItem(yP(e,t))}function yO({draftId:e,project:t,onClose:n,onLaunched:r}){let{t:i}=(0,eh.Ym)(),[a,s]=(0,Y.useState)([]),[l,o]=(0,Y.useState)(()=>y$(e,"template")),[c,d]=(0,Y.useState)(()=>y$(e,"dir")),[u,p]=(0,Y.useState)(()=>y$(e,"task")),[m,f]=(0,Y.useState)(()=>"manual"===y$(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&&yE(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&&yE(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(nW)),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)(sO.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),yE(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),yE(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),yE(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),yE(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)(sO.kr,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):null,g?i("wfDraft.launching"):i("wfDraft.launch")]})]})]})}var yD=n(7033);let yL=new Set(["png","jpg","gif","webp"]);function y_(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&&yL.has(e.ext)&&"string"==typeof e.mime&&null!==(0,sq.PG)(e.mime)&&"number"==typeof e.bytes&&Number.isFinite(e.bytes)&&e.bytes>0&&"string"==typeof e.createdAt}function yF(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(y_):[]}}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)(nO()),[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=lo({initialText:()=>n.text,persistText:u,submit:t}),m=async e=>{let{accepted:t,refusals:n}=sH(e,{acceptFiles:!1}),r=[...n];for(let{file:e,kind:n}of t){let t=await n_(e);if("error"in t){r.push({name:sz(e,n),reason:t.error});continue}let i=t.attachment;d.current={...d.current,attachments:[...d.current.attachments,i]},c(d.current.attachments),u(p.textRef.current)}r.length&&p.setStatus({kind:"err",text:sU(r)})},f=()=>{r.current=nO(),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 yq(e,t=Date.now()){let n=Date.parse(e);return Number.isFinite(n)&&n<t}function yz(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 yH=n(7618);function yU({draft:e}){let{t}=(0,eh.Ym)(),n=ib(),{dueAt:r,dueTz:i,setDue:a,clearDue:s}=e,l=!!r&&yq(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)(yH.A,{className:n?"h-4 w-4":"h-3 w-3","aria-hidden":!0}),r&&i?yz(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 yB({draft:e}){let{t}=(0,eh.Ym)(),n=ib();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:nL(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:nL(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 yK({draft:e,placeholder:t,createLabel:n,leftSlot:r}){let{t:i}=(0,eh.Ym)();return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(lG,{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",onAttachFiles:t=>void e.addFiles(t),leftSlot:(0,U.jsxs)("span",{className:"flex min-w-0 items-center gap-1",children:[(0,U.jsx)(yU,{draft:e}),r]})}),(0,U.jsx)(yB,{draft:e})]})}function yY({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,tP.cr)(a.title,60)}),onClick:()=>n(a),children:[(0,U.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${(0,tP.tz)(a.activity)}`,"aria-hidden":!0}),(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate text-ui font-semibold",children:(0,tP.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 yW(e,t){return("done"===e.status)-("done"===t.status)||t.updatedAt.localeCompare(e.updatedAt)}function yV({project:e,onDone:t}){let{t:n}=(0,eh.Ym)(),r=(0,Y.useRef)(()=>{}),i=yF(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 nD({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)(yK,{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 yJ({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(yW),[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)(sO.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)(yY,{rows:f,scopeAll:"all"===c,onOpen:r,onToggle:i}),u?(0,U.jsx)(yV,{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=v0[e.status],n="unplaced"===e.placement||!e.pos,r=!!e.dueAt&&yq(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:v2(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:["⏰ ",yz(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)(sO.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,tP.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)(yD.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 yG=n(6035),yQ=n(5738),yX=n(8780);function yZ({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,tP.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,tP.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,tP.cr)(e.title),children:(0,tP.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)(ux.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 y0({value:e,onPick:t}){let{t:n}=(0,eh.Ym)();return(0,U.jsx)("div",{className:"flex flex-wrap items-center gap-1",children:v1.map(r=>{let i=v0[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 y1({project:e,files:t,onCreated:n}){let{t:r}=(0,eh.Ym)(),[i,a]=(0,Y.useState)(()=>new Set),s=(0,Y.useRef)(()=>{}),l=yF(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 nD({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 nK(r.task.id,a);if("error"in e)oQ("err",e.error);else{let n=oX(e,t);oQ(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)(yK,{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)(yZ,{files:t,project:e,checked:i,onChange:a,maxHeight:9999})]})]})}function y2({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=la({onError:e=>oQ("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;s6(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 nz(e.id,{text:i});return t&&oQ("err",t),t},x=async()=>{let n=[...s];if(n.length&&!o){if(!i.trim())return void oQ("err",r("tasks.emptyTextBlocked"));c(!0);try{if(await h()!==null)return;let r=await nK(e.id,n);if("error"in r)oQ("err",r.error);else{let e=oX(r,t);oQ(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)(y0,{value:e.status,onPick:t=>{t!==e.status&&nz(e.id,{status:t}).then(e=>{e&&oQ("err",e)})}}),(0,U.jsx)(lW,{...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,tP.yz)(s):null,c=n.path?s?(0,tP.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,tP.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 oQ("err",r("tasks.emptyTextBlocked"));if(await h()!==null)return;let a=n.launchId;if(l&&!n.path&&a){let t=await nY(e.id,a);"task"in t?oQ("ok",r("tasks.retryLaunched")):oQ("err",t.error);return}let s=await nK(e.id,[n.path]);if("error"in s)oQ("err",s.error);else{let e=oX(s,t);oQ(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)(yZ,{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)(ue.A,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):(0,U.jsx)(fD.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?nH(e.id).then(e=>{e?oQ("err",e):n()}):u(!0)},children:[(0,U.jsx)(yQ.A,{className:"h-3.5 w-3.5","aria-hidden":!0}),d?r("tasks.deleteConfirm"):r("tasks.delete")]})]})}function y5({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)(yX.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?v2(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)(sO.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=v0[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:v2(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,tP.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)(y1,{project:e,files:r,onCreated:e=>o({taskId:e.id})}):d?(0,U.jsx)(y2,{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 y4(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 y3=n(3665),y6=n(715);function y8({verdict:e,error:t,className:n="h-3 w-3"}){return"APPROVE"===e?(0,U.jsx)(f7.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)(y3.A,{className:n,strokeWidth:2.5,"aria-hidden":!0}):t?(0,U.jsx)(as.A,{className:n,"aria-hidden":!0}):(0,U.jsx)(y6.A,{className:n,"aria-hidden":!0})}function y7(e,t){return t.error?e("roundDeck.roundAborted",{n:t.n}):t.verdict?e("roundDeck.roundVerdict",{n:t.n,verdict:`${tu[t.verdict]} ${t.verdict}`}):e("roundDeck.roundInProgress",{n:t.n})}function y9({round:e,depth:t,pulse:n,onPull:r}){let{t:i}=(0,eh.Ym)(),a=tp(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?`${y7(i,e)}: ${e.error}`:y7(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)(y8,{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 ke({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=wR(e),o=wO(e),[c,d]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{d(function(e,t){let n=e.getItem(wE(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}),wD(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=tp(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)(sO.O0,{className:"h-3.5 w-3.5","aria-hidden":!0})});if(m){let n=s?.round??j.round,r=tp(n.verdict),i=(0,tP.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?`${tu[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,tP.rK)(o/1e3)}):null,(0,U.jsx)(sO.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)(wn,{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:[y7(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:y7(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)(y9,{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 kt({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=bH(p,t),y=n.verdict,k="needs_decision"===e.state&&e.cursor?.stageId===t.id,j=bN(e,t.id).filter(e=>e.n!==n.n),N=new Set(bN(e,t.id).flatMap(e=>e.flowId?[e.flowId]:[])),S=new Set(bN(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=>tr(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?bJ[y.status]:null,E=async t=>{if(h)return;x(!0),b(null);let n=await vt(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)(s_,{style:{backgroundColor:$.soft,color:$.color},children:bG(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)(ut.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?bG(p,e.verdict.status):bz(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 kn=(e,t)=>`llvOrchestratorDraft:${e}:${t}`;function kr(e,t){try{return window.sessionStorage.getItem(kn(e,t))??""}catch{return""}}function ki(e,t,n){try{n?window.sessionStorage.setItem(kn(e,t),n):window.sessionStorage.removeItem(kn(e,t))}catch{}}function ka(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 ks={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"}},kl={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 ko({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=ll(),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)(()=>kr(e,"mandate")||uh),[y,k]=(0,Y.useState)(null),j=ul({storage:{read:t=>kr(e,t),write:(t,n)=>ki(e,t,n)},initialEngine:up,initialModel:um,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),ki(e,"mandate",t===uh?"":t)},S=ka(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||uh,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)(d9.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 ${ks[S.state].chip}`,children:p(kl[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)(sO.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)(km,{children:[(0,U.jsx)(ue.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)(km,{children:[(0,U.jsx)(as.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)(km,{children:[(0,U.jsx)(ue.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)(kc,{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)(as.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")}),r.vacated?(0,U.jsx)("p",{className:"mt-1 text-ui leading-4 text-muted",children:p("orchPanel.draftHintVacated",{project:t})}):null]}),(0,U.jsxs)("p",{className:"shrink-0 text-ui leading-5 text-secondary","data-orchestrator-intro":!0,children:[p("orchPanel.introTalk")," ",p("orchPanel.introRuns")," ",p("orchPanel.introReports")]}),(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)(ud,{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!==uh?(0,U.jsxs)("button",{type:"button",onClick:()=>N(uh),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)(sD.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)(ue.A,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):(0,U.jsx)(d9.A,{className:"h-4 w-4","aria-hidden":!0}),p(I.key)]})]}):null]})})}function kc({state:e,file:t}){let{t:n}=(0,eh.Ym)(),r=t?(0,tP.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(kl[e.liveness])})]})]}),e.transition?(0,U.jsx)(kd,{transition:e.transition}):null,e.rotation?(0,U.jsx)(ku,{rotation:e.rotation}):null,uv(e,t)?(0,U.jsx)(kp,{tone:"warning",children:n("orchPanel.stalled")}):null,"resumable"===e.liveness?(0,U.jsx)(kp,{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)(km,{children:[(0,U.jsx)(ue.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 kd({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)(ue.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)(as.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 ku({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 kp({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 km({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 kf({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}=hR(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=hq(g),v=ub({status:s,statusFailed:l,submitting:c,submitFailure:p,file:g,surface:b}),w=ka(v,{conversationReady:!!g});(0,Y.useEffect)(()=>{if(u.current)return;let t=kr(e,"requestId");t&&uk(s,t)&&ki(e,"requestId","")},[e,s]);let y=(0,Y.useCallback)(async t=>{if(u.current)return;u.current=!0;let n=t.replayRequestId||kr(e,"requestId")||uj();kr(e,"requestId")!==n&&ki(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===uh.trim()?{promptVersion:10}:{}})}),o=await l.json().catch(()=>null);if(l.ok&&o?.ok===!0){ki(e,"requestId","");let i=hL(l.status,l.ok,o);if("launched"===i.kind){let l=h_(hO(n,r,{title:(0,ex.bF)("orchestrator",s,e),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&&rE(l)}nG()}else if(l.ok)m({kind:"ambiguous",error:"string"==typeof o?.error&&o.error?o.error:i("orchPanel.transportLost"),clientRequestId:n});else{let t=uN(l.status,o,n);t?.kind==="terminal"&&ki(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=ks[w.state],N=i(kl[w.state]),S=g?.model?.trim()||(g?(0,tP.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)(d9.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)(fn.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)(as.A,{className:"h-4 w-4 text-danger","aria-hidden":!0}):(0,U.jsx)(ue.A,{className:"h-4 w-4 animate-spin text-accent","aria-hidden":!0})}):null,f?(0,U.jsx)(ko,{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 kh=n(9585),kx=n(6763),kg=n(6619);function kb({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)(un,{"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,oK[e].map(e=>(0,U.jsx)("option",{value:e.id,children:e.label},e.id))]}),(0,U.jsxs)(un,{"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:ap(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)(ue.A,{className:"h-3 w-3 animate-spin","aria-hidden":!0}):(0,U.jsx)(f7.A,{className:"h-3 w-3","aria-hidden":!0}),c("runtimeConfig.apply")]})]})}function kv(e,t,n){return e.split(t).join(n)}function kw(e,t,n,r){let i=kv(t.prompt,"{{task}}",e.task);i=kv(i,"{{prev.output}}",r);let a=n.promptScaffold?kv(n.promptScaffold,"{{task}}",e.task):null;a&&(a=kv(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 ky({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=bN(e,t.id).length>0,d=e.cursor?.activatedBy?.edge==="fail"&&e.cursor.activatedBy.stageId===t.id||b6(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 ve(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)(un,{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:bH(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)(un,{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"):bH(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 kk=new Set(bg);function kj(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 kN({slot:e,interactive:t}){let{t:n}=(0,eh.Ym)(),{pipeline:r,stage:i}=e,a=wk(),s=bE(r,i),l=bk[s],o=bH(n,i),c=bU(n,i,e.index,e.total),d="review-loop"===i.kind,u="draft"===r.state,p=t&&0===bN(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)(()=>bZ(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=bZ(z);H(i.prompt),C(t=>t===e?bZ(i.prompt):t)}let B=async e=>{I(!0),T(null),$(!1);let t=await vt(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 vt(r.id,"override-stage",{stageId:i.id,...e});t?(T(t),w("error")):w("applied")},W=S.trim()!==bZ(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(bX)??[])]).length?a.join("\n"):r>0?"{{prev.output}}":"{{task}}",(l=n.trim())?`${s}
|
|
82
|
+
|
|
83
|
+
${l}`:s)})},J=u&&t&&b0(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&&b0((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),vt(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:b9(o)}}(r,i.id,e)).then(e=>{e&&T(e),I(!1)}))},ee=(0,tP.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=(oK[h].find(e=>e.id===m)?.label??m)||n("draft.modelDefault"),ea=f?ap(n,f):n("groupOverride.effortDefault"),es=g.model!==m||g.effort!==f,el=kw(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)(uo,{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)(yX.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)(al.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)(lB.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),vt(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:b9(a)})).then(e=>{e&&T(e),I(!1)})},children:(0,U.jsx)(sO.X,{className:"h-3 w-3","aria-hidden":!0})}):null]}),t&&E?(0,U.jsx)(wj,{idPrefix:e.key,roles:a,roleId:y,roleParams:j,disabled:!p||A,allowedRoleIds:kk,compactPreview:!0,onSelectRole:e=>{k(e);let t=a.find(t=>t.id===e),n=t?wh(t):{};N(n),B({role:e?{roleId:e,...Object.keys(kj(n)).length?{params:kj(n)}:{}}:null})},onSetParam:(e,t)=>{let n={...j,[e]:t};if(N(n),!y)return;let r=kj(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)(kb,{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)(ue.A,{className:"h-3.5 w-3.5 shrink-0 animate-spin text-muted","aria-hidden":!0}):P?(0,U.jsx)(f7.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 ${ap(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)(ky,{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 ${ap(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 kS=new Set;function kC({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,nA.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 kA({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,nA.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 kI({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)(kN,{slot:n,interactive:!0})]})}function kM({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=bE(e,t),j=bk[k],N=bj[k],S=bx(e,t.id),C=b4(e,t,o,c)?"materialized":bN(e,t.id).some(e=>b3.has(e.state))?"evidence":e.cursor?.stageId===t.id&&by(e)?"queued":"waiting",A=bH(y,t),I=(w=bx(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?vs(T)?.n??0:0,$=bN(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=bx(e,t.id);return bL(t,n,i,s,l,a)},D=O(t),L=t=>0===bN(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=bF(e,t,S)||bq(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?bG(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!bF(e,t,n)&&!bq(e,t,n,r,a,s)&&null===bL(t,n,r,i,a,s)}(e,t,S,i,s,l,a),en=n?O(n):null,er=!!n&&L(n),ei=n?bH(y,n):"",ea=n?y(`pipelineChipState.${bE(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=by(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=b6(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)(kh.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)(vF.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)(kx.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)(kx.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:bH(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:["→ ",bH(y,ep)]})}):null,ef&&t.onFail?(0,U.jsx)("span",{"data-edge-kind":"fail",role:"img","aria-label":y("pipelineStrip.failEdgeAria",{from:A,to:bH(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:["↩ ",bH(y,ef)," ",ex,"/",t.onFail.maxRounds]})}):null,u&&S?(0,U.jsx)(kC,{anchorRef:B,children:(0,U.jsx)(kt,{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)(kC,{anchorRef:B,children:(0,U.jsx)(kI,{label:A,mobile:d,slot:es,onClose:x})}):null]})}function kT({pipeline:e,flows:t=[],files:n=[],renderablePaths:r,renderableFlows:i=kS,materializedPaths:a=r??kS,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 vt(e.id,t)),x(!1),N(!1))},P=async()=>{try{await navigator.clipboard.writeText(e.baseRef),C("copied")}catch{C("failed")}},$=bw.has(e.state),E=bv.has(e.state),R="draft"===e.state,O="completed"===e.state||"closed"===e.state,D=(m=e,bw.has(m.state)&&m.cursor?bx(m,m.cursor.stageId)?.verdict?.findings?.[0]??m.stateDetail:m.stateDetail),{k:L,n:_}=bV(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:bb(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)(f7.A,{className:"h-3 w-3 text-success","aria-hidden":!0}):(0,U.jsx)(xc.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)(kM,{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)(ut.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)(kg.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)(ut.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)(kg.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)(f8.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)(uM.A,{className:"h-4 w-4","aria-hidden":!0})}),j?(0,U.jsx)(kA,{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 kP({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=bw.has(e.state),h=bv.has(e.state),{k:x,n:g}=bV(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:bb(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)(aL.A,{className:"h-4 w-4 shrink-0 text-muted","aria-hidden":!0}):(0,U.jsx)(a_.A,{className:"h-4 w-4 shrink-0 text-muted","aria-hidden":!0})]}),u?(0,U.jsx)(kT,{pipeline:e,flows:t,files:n,renderablePaths:r,renderableFlows:i,mobile:!0,linkedTasks:a,onOpenPath:l,onOpenFlow:o,onOpenTask:c}):null]})}function k$(e){let t=0,n=0,r=0;for(let i of e)"completed"===i.state?r+=1:"draft"===i.state||bw.has(i.state)?n+=1:t+=1;return{total:e.length,active:t,attention:n,completed:r}}var kE=n(412);function kR({pipelines:e,onOpen:t}){let{t:n}=(0,eh.Ym)();if(!e.length)return null;let r=k$(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)(kE.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)(al.A,{className:"h-4 w-4 shrink-0 text-muted","aria-hidden":!0})]})})}function kO({pipelines:e,onOpen:t}){let{t:n}=(0,eh.Ym)();if(!e.length)return null;let r=k$(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)(kE.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 kD({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)(kP,{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)(sO.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)(a_.A,{className:"h-4 w-4 shrink-0","aria-hidden":!0}):(0,U.jsx)(al.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 kL(e){return"running"===e||"live"===e?"bg-success":"silent"===e?"bg-warning":"closed"===e?"bg-muted":"bg-danger"}function k_({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 ${kL(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 ${kL(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 kF=e=>({x:e.x,y:e.y,w:e.w,h:e.h});function kq(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(vi(n.id,e.stageId),r)}return t}function kz(e,t,n={}){let r=new Map(e.groups.map(e=>[e.key,kF(e)])),i=[...e.nodes.map(e=>({key:e.file.path,label:(0,ex.cr)(e.file.title,60),rect:kF(e)})),...e.groups.map(e=>({key:e.key,label:(0,ex.cr)(e.label,60),rect:kF(e)}))].filter(e=>e.label.length>0),a=t=>{let i=e.byPath.get(t);if(i)return kF(i);let a=r.get(t);if(a)return a;let s=n.extraRects?.get(t);return s?kF(s):null},s=vl(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 kH(e){return"running"===e||"live"===e?0:"silent"===e?1:2}function kU(e){let t=e.sessionStartedAt?Date.parse(e.sessionStartedAt):NaN;return Number.isFinite(t)?t:1e3*e.mtime}function kB({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=bc(),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=w_(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:yl(e,r)})).sort((e,t)=>kH(e.state)-kH(t.state)||kU(e.entry)-kU(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 kK(e){let t=e.split("\n",1)[0]??"";return(0,tP.cr)(t,60)}function kY(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 kW={w:390,h:620},kV=[];function kJ(e,t,n){return Math.min(n,Math.max(t,e))}function kG(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 kQ({layout:e,tasks:t,workerStacks:n,pipelineOutlines:r=kV,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,tP.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:kK(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,tP.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:kY(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:kK(e.text),pickKey:"task::"+e.id,isRoot:!1}):p.push(e);p.forEach((e,t)=>{c.push({key:"task::"+e.id,kind:"task",rect:kY(t,u,d),title:kK(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)(kW),[m,f]=(0,Y.useState)(!1),[h,x]=(0,Y.useState)(()=>kG(o.world,kW)),{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)(()=>kG({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||kW.w,n=e.clientHeight||kW.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=kJ(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=kJ(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)(kX,{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 kX({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,tP.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,tP.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 kZ={waiting:5,stalled:4,live:3,returned:2,done:1},k0=new Set;function k1({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=k0,loaded:h,focus:x,onSelect:g,onClose:b,onDraftClose:v,onDraftSpawned:w,onConversationOpened:y,onActiveChange:k,taskSheetNonce:j=0,trayApi:N}){let S,{t:C}=(0,eh.Ym)(),A=ih(e),I=ll(),[M,T]=(0,Y.useState)(null),[P,$]=(0,Y.useState)(!1),[E,R]=(0,Y.useState)(!1),[O,D]=(0,Y.useState)("all"),[L,_]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{j>0&&_("new")},[j]);let F=(0,Y.useRef)(null),q=(0,Y.useRef)(null),z=(0,Y.useRef)(null),[H,B]=(0,Y.useState)({left:!1,right:!1}),K=(0,Y.useCallback)(()=>{let e=z.current;if(!e)return;let t=e.scrollLeft>4,n=e.scrollLeft+e.clientWidth<e.scrollWidth-4;B(e=>e.left===t&&e.right===n?e:{left:t,right:n})},[]),V=(0,Y.useMemo)(()=>s.length?[...a,...s]:a,[a,s]),J=(0,Y.useMemo)(()=>bM(l,V),[l,V]),G=(0,Y.useMemo)(()=>ya(n,r,i,J,p,l,o,m,f),[n,r,i,J,p,l,o,m,f]),Q=(0,Y.useMemo)(()=>{let e=o.filter(e=>"completed"!==e.state&&"closed"!==e.state),t=G.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(wH).map(e=>wV(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=yi(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=yi(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={...wz({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:{...wz(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,[...G.nodes,...G.decks,...G.stacks,...G.drafts,...G.slots,...n]);return e.flatMap(e=>{let t=r.get(e.id);return t?[{id:e.id,title:e.task,rect:t.bounds}]:[]})},[o,G,d]),X=(0,Y.useMemo)(()=>[...G.nodes.map(e=>({key:e.file.path,file:e.file,isRoot:e.isRoot,kind:"node"})),...G.decks.map(e=>({key:e.key,file:null,isRoot:!1,kind:"deck"})),...G.drafts.map(e=>({key:e.key,file:null,isRoot:!0,kind:"draft"}))],[G]),Z=(0,Y.useMemo)(()=>new Map(X.map(e=>[e.key,e])),[X]),ee=(0,Y.useMemo)(()=>kz(G,e,{aliases:kq(l)}),[G,e,l]);(0,Y.useEffect)(()=>iD.setBoard({project:e,index:ee,moveTo:({anchorKeys:e})=>{let t=e.find(e=>Z.has(e));return!!t&&(T(t),$(!1),!0)},restoreCamera:()=>!1}),[e,ee,Z]),(0,Y.useEffect)(()=>{T(sessionStorage.getItem("llvFocus:"+e)),$(!1)},[e]),(0,Y.useEffect)(()=>{x&&(T(x),$(!1))},[x]);let et=(0,Y.useMemo)(()=>{if(M&&Z.has(M))return M;let e=null,t=-1;for(let n of X){if(!n.file)continue;let r=1e12*kZ[tL(n.file)]+n.file.mtime;r>t&&(t=r,e=n)}return(e??X[0])?.key??null},[M,Z,X]);(0,Y.useEffect)(()=>{M&&Z.has(M)?sessionStorage.setItem("llvFocus:"+e,M):!M&&et&&sessionStorage.setItem("llvFocus:"+e,et)},[M,Z,et,e]),(0,Y.useEffect)(()=>{q.current?.scrollIntoView({block:"nearest",inline:"nearest"}),K()},[et,X,K]);let en=(0,Y.useMemo)(()=>G.nodes.find(e=>e.file.path===et)??null,[G,et]),er=(0,Y.useMemo)(()=>G.decks.find(e=>e.key===et)??null,[G,et]),ei=(0,Y.useMemo)(()=>G.drafts.find(e=>e.key===et)??null,[G,et]);(0,Y.useEffect)(()=>{k?.(en?.file??null)},[en,k]),(0,Y.useEffect)(()=>()=>k?.(null),[k]);let ea=(0,Y.useMemo)(()=>new Set(G.groups.filter(e=>"pipeline"===e.kind&&e.pipeline).map(e=>e.id)),[G.groups]),es=(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,ea)).memberful,...e.shelf].map(e=>e.id)),o.filter(e=>t.has(e.id))},[o,ea]);(0,Y.useEffect)(()=>{let e=en?en.file.path:null,t=G.nodes.map(e=>e.file.path),n=P?t.slice(0,128):en?[en.file.path]:[];iS.reportSlice({mode:P?"mobile-map":"mobile-focus",focusedPath:e,selectedPaths:ik(t,A.selection,{includeUnordered:!0}),visiblePaths:n,camera:null})},[en,P,G,A.selection]);let el=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=bx(r,e.id);return!!i&&(!!t&&i.agentPath===t||!!(n&&i.flowId===n))});if(e>=0)return{pipeline:r,index:e}}return null}(l,en?en.file.path:null,er?er.flow.id:null),eo=(0,Y.useMemo)(()=>new Set(i.map(e=>e.path)),[i]),ec=(0,Y.useMemo)(()=>bR(J,new Set(G.nodes.map(e=>e.file.path))),[J,G]),ed=(0,Y.useMemo)(()=>new Map(l.map(e=>[e.id,bP(e,u??d,a,i)])),[l,u,d,a,i]),eu=(0,Y.useMemo)(()=>y4(i,u??d),[i,u,d]),ep=(0,Y.useCallback)(e=>{let t=i.find(t=>t.path===e);t&&g(t)},[i,g]),em=(0,Y.useCallback)(e=>_({taskId:e.id}),[]),ef=(0,Y.useCallback)(e=>{let t=vr(e);Z.has(t)&&T(t)},[Z]),ex=(0,Y.useCallback)(e=>{if(!X.length)return;let t=X.findIndex(e=>e.key===et),n=X[Math.min(X.length-1,Math.max(0,(-1===t?0:t)+e))];n&&n.key!==et&&T(n.key)},[X,et]),eg=(0,Y.useCallback)(e=>{T(e);let t=Z.get(e)?.file;t&&y?.(t.path)},[Z,y]),ev=(0,Y.useCallback)(e=>{($(!1),Z.has(e.path))?eg(e.path):g(e)},[Z,eg,g]),ew=(0,Y.useCallback)(e=>{if($(!1),e.startsWith("task::"))return void _({taskId:e.slice(6)});if(Z.has(e))return void eg(e);let t=i.find(t=>t.path===e);t&&g(t)},[Z,eg,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:I>0?{paddingBottom:I}:void 0,children:[(0,U.jsx)(dQ,{compact:!0}),(0,U.jsxs)("div",{className:"flex shrink-0 items-stretch border-b border-border bg-card",children:[(0,U.jsx)(kf,{project:e,projectName:eb(e,t),files:i,onOpenConversation:ev}),X.length>1||el?(0,U.jsxs)("div",{className:"relative min-w-0 flex-1",children:[(0,U.jsxs)("div",{ref:z,onScroll:K,className:"no-scrollbar flex items-center gap-1.5 overflow-x-auto px-2 py-1",children:[el?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(k2,{pipeline:el.pipeline,index:el.index,flows:a,files:i,renderableFlows:ec,renderablePaths:eo,onHop:e=>{if(!el)return;let t=el.pipeline.stages[e];if(!t)return;let n=bL(t,bx(el.pipeline,t.id),a,ec,eo,i);if(n){if("flow"===n.kind){let e=vr(n.flowId);Z.has(e)&&T(e);return}ep(n.path)}},onOpenPath:ep}),X.length>1?(0,U.jsx)("span",{"aria-hidden":!0,className:"mx-0.5 h-7 w-px shrink-0 bg-border"}):null]}):null,X.length>1?X.map(e=>(0,U.jsx)(k5,{entry:e,active:e.key===et,chipRef:e.key===et?q:void 0,onClick:()=>eg(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 ${H.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 ${H.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:[(en||er||ei)&&es.length?(0,U.jsx)(kO,{pipelines:es,onOpen:()=>R(!0)}):null,!function(e,t,n=0){return e>1||t>0||n>0}(G.nodes.length,c.length,Q.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":C("mobile.openMap"),onClick:()=>{D("all"),$(!0)},children:(0,U.jsx)(yG.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":C("tasks.panelToggleAria"),onClick:()=>_("list"),children:[(0,U.jsx)(fL.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:[en?(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)(wn,{file:en.file,tasks:en.tasks,isRoot:en.isRoot,showFavorite:!0,onClose:()=>b(en.file.path),dragHandle:{onTouchStart:e=>{let t=e.touches[0];t&&(F.current={x:t.clientX,y:t.clientY})},onTouchEnd:e=>{let t=F.current;F.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)||ex(r<0?1:-1)}},relatedTasks:eu.get(en.file.path),onOpenTask:em})}),(S=N?.trays.get(W(en.file)))?(0,U.jsx)(k_,{tray:S,variant:"inline",onToggleExpanded:e=>N.onToggleExpanded(S.parentConversationId,e),onOpenMember:N.onOpenMember,onUnfold:N.onUnfold}):null]},en.file.path):er?(0,U.jsx)("div",{className:"relative min-h-0 flex-1",children:(0,U.jsx)(ke,{flow:er.flow,rounds:er.rounds,focusRound:null,groupLabel:i.find(e=>e.path===er.flow.implementerPath)?.title})},er.key):ei?nV(ei.id)?(0,U.jsx)(yO,{draftId:ei.id,project:e,onClose:()=>v(ei.id),onLaunched:()=>v(ei.id)},ei.key):(0,U.jsx)(wT,{draftId:ei.id,project:e,files:i,onClose:()=>v(ei.id),onSpawned:e=>w(ei.id,e)},ei.key):h?es.length?(0,U.jsx)("div",{className:"flex min-h-0 flex-1 flex-col divide-y divide-border overflow-y-auto",children:es.map(e=>(0,U.jsx)(kP,{pipeline:e,flows:a,files:i,renderablePaths:eo,renderableFlows:ec,linkedTasks:ed.get(e.id)??[],onOpenPath:ep,onOpenFlow:ef,onOpenTask:em},e.id))}):(0,U.jsx)("div",{className:"flex flex-1 items-center justify-center text-center text-[13px] text-muted",children:C("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)(sO.kr,{className:"h-4 w-4 animate-spin","aria-hidden":!0}),C("common.loading")]}),en?(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)(kB,{conversationId:W(en.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]}),P?(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:C("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":C("mobile.mapFrame"),children:["all","current"].map(e=>(0,U.jsx)("button",{type:"button","aria-pressed":O===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 ${O===e?"bg-card text-accent shadow-1":"text-muted"}`,onClick:()=>D(e),children:C("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":C("mobile.closeMap"),onClick:()=>$(!1),children:(0,U.jsx)(sO.X,{className:"h-5 w-5","aria-hidden":!0})})]}),(0,U.jsx)(kQ,{layout:G,tasks:d,workerStacks:c,pipelineOutlines:Q,frame:O,ringKey:et,onPick:ew}),es.length?(0,U.jsx)(kR,{pipelines:es,onOpen:()=>R(!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:C("mobile.tapNode")})]}):null,E&&es.length?(0,U.jsx)(kD,{pipelines:es,render:{flows:a,files:i,renderablePaths:eo,renderableFlows:ec,linkedTasksByPipeline:ed,onOpenPath:ep,onOpenFlow:ef,onOpenTask:em},onClose:()=>R(!1)}):null,L?(0,U.jsx)(y5,{project:e,projectName:t,tasks:u??d,files:i,initialView:L,onClose:()=>_(null)}):null]})}function k2({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=bE(e,p),f=bk[m],h=t>0?e.stages[t-1]:null,x=t<u-1?e.stages[t+1]:null,g=!!h&&!!bL(h,bx(e,h.id),n,i,a,r),b=!!x&&!!bL(x,bx(e,x.id),n,i,a,r),v=bx(e,p.id),w=o(`pipelineChipState.${m}`),y=h?bH(o,h):"",k=h?o(`pipelineChipState.${bE(e,h)}`):"",j=x?bH(o,x):"",N=x?o(`pipelineChipState.${bE(e,x)}`):"",S=bF(e,p,v)||bq(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:["‹ ",bH(o,h)]}):null,(0,U.jsxs)("button",{type:"button",disabled:!S,onClick:()=>d(!0),"aria-haspopup":"dialog","aria-label":o("pipelineMobile.openVerdict",{label:bH(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?"⟳":"▸"}),bH(o,p),bj[m]?(0,U.jsx)("span",{"aria-hidden":!0,children:bj[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:[bH(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)(kt,{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 k5({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=tL(a),l="waiting"===s||"stalled"===s,o=(0,tP.yz)(a),c=(0,tP.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,tP.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 k4=n(8617),k3=n(9805);function k6(e){return("claude-projects"===e.root||"codex-sessions"===e.root)&&e.path.endsWith(".jsonl")}function k8({file:e,onHandoff:t,inline:n=!1}){let{t:r}=(0,eh.Ym)(),i=function(e){let{t}=(0,eh.Ym)();return vw({exclude:e.path,onDragStart:void 0,onDrop:n=>(dD(W(n.file),t("link.handoffContext",{title:(0,tP.cr)(e.title,80),path:e.path,ask:""}).trimEnd()+"\n\n"),t("link.dropped",{title:(0,tP.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)(k4.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)(k4.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)(k3.A,{className:"hidden h-3.5 w-3.5 shrink-0 group-hover:block group-focus-within:block","aria-hidden":!0})]}),i.overlay]})}var k7=n(1906),k9=n(1285),je=n(6900),jt=n(5085),jn=n(5367),jr=n(1834);async function ji(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 ja(e){return null!==e.file.pid}function js(e){return e.isRoot}let jl={implementer:{engine:"claude",model:null,effort:null},reviewer:{engine:"codex",model:null,effort:"xhigh"}};async function jo(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 jc({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 jd=(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,tP.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 ji(n,d,(t,n)=>p({action:e,items:[...t],current:n,titles:c}))}finally{o(null)}},w=lo({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 n_(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 nD({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 wz({x:Math.round(t/e.length-130),y:Math.round(n/e.length-60)},{w:260,h:140},e)})(),attachments:t,clientRequestId:nO()});if("error"in i)return void w.setStatus({kind:"err",text:i.error});let a=i.task.id,l=nO(),o=await v("message",[...n.keys()],async e=>{let t=await nK(a,[e],l);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||o.length&&o.every(e=>e.ok))&&(w.setText(""),w.attachments.clear());return}let a=await v("message",[...n.keys()],e=>{let t=n.get(e);return jo("/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(ja),k=t.filter(js),j=t.filter(e=>ta(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)(ju,{count:j.length,disabled:null!==l,onStart:e=>{x(!1),v("flow",j.map(e=>e.file.path),t=>jo("/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)(lG,{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)(jc,{icon:(0,U.jsx)(jn.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=>jo("/api/tmux",{action:"interrupt",path:e}))}),(0,U.jsx)(jc,{icon:(0,U.jsx)(ft.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=>jo("/api/tmux",{action:"kill",path:e}))}}),(0,U.jsx)(jc,{icon:(0,U.jsx)(yQ.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)(jc,{icon:(0,U.jsx)(jr.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)(jc,{icon:(0,U.jsx)(jt.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)(pr.A,{className:"h-3.5 w-3.5 shrink-0 text-success","aria-hidden":!0}):(0,U.jsx)(pi.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)(ue.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)(sD.A,{className:"h-3 w-3","aria-hidden":!0}),s("bulk.retryFailed",{count:N})]}):null]}):null]})});function ju({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:jl},baseMode:"head",mode:c,reviewerMode:"headless",roundLimit:u}),children:i("bulk.flowStart",{count:e})})]})]})]})}let jp=new Set;function jm(e){return!e.supersededBy&&("live"===e.activity||"stalled"===e.activity||"running"===e.proc||!!e.pendingQuestion||!!e.waitingInput)}function jf(e){return e.pipeline?"closed"!==e.pipeline.state||!!e.pipeline.restored:!!e.flow&&("closed"!==e.flow.state||!!e.flow.restored)}function jh(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 jx(e,t,n,r=jp){let i=[];for(let t of e.nodes)(jm(t.file)||t.isRoot&&n.has(W(t.file)))&&i.push(t);for(let t of e.groups)jf(t)&&i.push(t);for(let n of(i.push(...e.drafts),t))"done"!==n.status&&wH(n)&&i.push(wV(n,r.has(n.id)));return i}let jg=(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,jb=["top","right","bottom","left"],jv=e=>"right"===e?"translate(-100%, -50%)":"left"===e?"translate(0, -50%)":"bottom"===e?"translate(-50%, -100%)":"translate(-50%, 0)",jw=()=>"function"==typeof window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;function jy({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:jv(e.edge),maxWidth:u},title:e.cluster.label,onClick:()=>t(e.cluster.rect),onPointerEnter:()=>{jw()&&c(!0)},onPointerMove:e=>(e=>{if(d||jw())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 jk({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:jv(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 jj({clusters:e,cam:t,vp:n,hidden:r,obstacles:i=[],onFit:a}){let{t:s}=(0,eh.Ym)(),l=(0,xa.O)(),o=ib(),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=>!jg(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=>jg(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,...jb.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=>jg("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)(jy,{chip:e,onFit:a},e.cluster.key)),[...u].map(([e,{anchor:t,rows:r}])=>(0,U.jsx)(jk,{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 jN(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 jS=new Set,jC={flow:"var(--color-accent)",pipeline:"var(--color-accent)",origin:"var(--color-muted)",worktree:"var(--color-strong)"};function jA({layout:e,world:t,tasks:n=[],textExpandedIds:r=jS,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,tP.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+wY(e,r.has(e.id))/2,r:3/w,fill:v0[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 jI={implementer:{engine:"claude",model:null,effort:null},reviewer:{engine:"codex",model:null,effort:"xhigh"}};function jM({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:oK[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 jT({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)(jI),[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)(jM,{label:n("flowDialog.implementer"),role:l.implementer,onChange:e=>o(t=>({...t,implementer:e}))}),(0,U.jsx)(jM,{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 jP={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 j$({flow:e,x:t,y:n,interactive:r,moveTransition:i}){let{locale:a,t:s}=(0,eh.Ym)(),l=lw(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=jP[va(o.state)],x=vs(o)?.n??0,g=to(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 tm(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)(ut.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)(ft.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)(kg.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)(f8.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 jE={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 jR({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=jE[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?bH(a,v):e.id,y=b>=0?b+1:x,k=g?bx(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 vt(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:bb(a,e.state)}),o?(0,U.jsx)(ut.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)(kg.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)(f8.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 jO=n(9751);function jD({slot:e,onOpen:t}){let{t:n}=(0,eh.Ym)(),{pipeline:r,stage:i,attempt:a}=e,s=bE(r,i),l=bk[s],o=bU(n,i,e.index,e.total),c="review-loop"===i.kind,d=(0,tP.t7)(i.effectiveRole.engine),u=i.effectiveRole.model??"",p=(oK[i.effectiveRole.engine].find(e=>e.id===u)?.label??u)||n("draft.modelDefault"),m=i.effectiveRole.effort?ap(n,i.effectiveRole.effort):"",f=a?.verdict??null,h=kw(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?bz(n,a.state):n(`pipelineChipState.${s}`)}),f?(0,U.jsx)("span",{className:"rounded-full px-2 py-1 text-label font-bold",style:{backgroundColor:bJ[f.status].soft,color:bJ[f.status].color},children:bG(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)(jO.A,{className:"h-3.5 w-3.5","aria-hidden":!0}),n("pipelineSlot.openTranscript")]})]})]})}function jL({slot:e,expanded:t,controls:n,onToggle:r}){let{t:i}=(0,eh.Ym)(),{pipeline:a,stage:s,attempt:l}=e,o=bE(a,s),c=bk[o],d=bU(i,s,e.index,e.total),u=function(e,t,n,r=function(e,t){return bx(e,t)}(t,n.id)){let i=bW(r?.error);if(i)return i;let a=bW(r?.verdict?.findings?.[0]);if(a)return`${bG(e,r.verdict.status)} — ${a}`;if(r?.state==="skipped")return e("pipelineSlot.reasonSkipped");let s=bW(r?.output);return s||(r?.verdict?bG(e,r.verdict.status):r?bz(e,r.state):e(`pipelineChipState.${bE(t,n)}`))}(i,a,s,l??bx(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:bj[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)(al.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 j_=n(529);let jF=new Set(["spawning","reviewing","relaying","fixing"]),jq=[1,2,3,4,5,0];function jz({flow:e,onFocusRound:t}){let{locale:n,t:r}=(0,eh.Ym)(),i=lw(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 tm(a.id,{action:e,...t});n?c(n):t?.note!==void 0&&u(""),l(!1)},m=to(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":jF.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=tp(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)(y8,{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)(ut.A,{className:"h-3.5 w-3.5 shrink-0 animate-spin text-muted","aria-hidden":!0}):null,g?(0,U.jsx)(lK,{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)(lK,{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)(ft.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)(lK,{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:[jq.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)(j_.A,{className:"h-3 w-3","aria-hidden":!0}):e},e)}),jq.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)(lK,{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)(lK,{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)(kg.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})}):(0,U.jsx)(lK,{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)(f8.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})})]}),(0,U.jsx)(lK,{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 jH({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 jU={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 jB({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=lP(e.path),n=lO(e.migration,t),r=lE(n);return"pending"===r||"switching"===r||"failed"===r?{kind:r,target:lR(n),source:n?.sourceLabel?.trim()||t}:{kind:"settled",accountId:t}}(e);if(!i)return null;if("settled"===i.kind){if(!t||i.accountId===lM)return null;let e=vo(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} ${jU[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 jK({file:e,fontClassName:t="text-[9.5px]"}){let n=(0,tP.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,tP.oC)(e).soft,color:(0,tP.oC)(e).color},title:[n.label,(0,tP.$)(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,tP.$)(e),children:n.label})}var jY=n(5618);let jW="text-label font-semibold text-secondary",jV="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",jJ="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",jG="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 jQ({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:jW,children:r("groupOverride.task")}),(0,U.jsx)("input",{className:jV,value:u,onChange:e=>p(e.target.value)})]}),(0,U.jsxs)("label",{className:"flex flex-col gap-1",children:[(0,U.jsx)("span",{className:jW,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:jW,children:r("groupOverride.repoDir")}),(0,U.jsx)("input",{className:jV,value:h,onChange:e=>x(e.target.value)})]}),(0,U.jsx)("button",{className:jJ,disabled:a||!u.trim()||!h.trim(),onClick:()=>void w(r("groupOverride.savedDraft"),()=>vt(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)(jY.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:jJ+" flex-1",disabled:a,onClick:()=>void w(r("pipelineStrip.retryStage"),()=>vt(e.id,"retry-stage")),children:r("pipelineStrip.retryStage")}),(0,U.jsx)("button",{className:jG,disabled:a,onClick:()=>void w(r("pipelineStrip.skipStage"),()=>vt(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"),()=>vt(e.id,"start")),children:[(0,U.jsx)(kg.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"),()=>vt(e.id,"resume")),children:[(0,U.jsx)(kg.A,{className:"h-3 w-3","aria-hidden":!0})," ",r("pipelineStrip.resume")]}):(0,U.jsxs)("button",{className:jG,disabled:a,onClick:()=>void w(r("pipelineStrip.pause"),()=>vt(e.id,"pause")),children:[(0,U.jsx)(f8.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"),()=>vt(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 jX=["claude","codex"];function jZ({group:e,onClose:t}){return e.pipeline?(0,U.jsx)(jQ,{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)(j8,{group:e,onClose:t}):null})}function j0({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 j1="text-label font-semibold text-secondary",j2="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",j5="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",j4="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 j3({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:j1,children:r}),(0,U.jsxs)(un,{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:ap(i,e)},e))]})]})}function j6({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:j1,children:n("groupOverride.engine")}),(0,U.jsx)(un,{className:"w-full",value:e,onChange:e=>t(e.target.value),children:jX.map(e=>(0,U.jsx)("option",{value:e,children:e},e))})]})}function j8({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=to(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)(j0,{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)(j6,{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)(j3,{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:j1,children:r("groupOverride.model")}),(0,U.jsx)("input",{className:j2,value:o,placeholder:r("groupOverride.modelPlaceholder"),onChange:e=>c(e.target.value)})]}),(0,U.jsx)("button",{className:j5,disabled:v||S,onClick:()=>void I(r("groupOverride.savedReviewer"),()=>tm(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:j1,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:j1,children:r("groupOverride.roundLimit")}),(0,U.jsx)("input",{className:j2,type:"number",min:0,max:50,value:g,onChange:e=>b(e.target.value)})]}),(0,U.jsx)("button",{className:j4,disabled:v||S,onClick:()=>void I(r("groupOverride.savedLimit"),()=>tm(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:j4,disabled:v||S,onClick:()=>void I(r("groupOverride.savedExtend"),()=>tm(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:j5+" flex-1",disabled:v,onClick:()=>void I("retry-round"===C.action?r("groupOverride.savedRetry"):r(C.labelKey),()=>tm(i.id,{action:C.action,...A?{note:p.trim()}:{}})),children:[(0,U.jsx)(ut.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"),()=>tm(i.id,{action:"cancel-round"})),children:[(0,U.jsx)(ft.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"),()=>tm(i.id,{action:"resume"})),children:[(0,U.jsx)(kg.A,{className:"h-3 w-3","aria-hidden":!0})," ",r("flowStrip.resume")]}):(0,U.jsxs)("button",{className:j4,disabled:v,onClick:()=>void I(r("flowStrip.pause"),()=>tm(i.id,{action:"pause"})),children:[(0,U.jsx)(f8.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"),()=>tm(i.id,{action:"close"})),children:[(0,U.jsx)(K.A,{className:"h-3 w-3","aria-hidden":!0})," ",r("flowStrip.close")]})]})]})}function j7(e,t){return[...e].sort((e,n)=>t(e).localeCompare(t(n)))}let j9=[],Ne=new Map;function Nt(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 Nn="cubic-bezier(.22,.8,.36,1)",Nr=`transform 380ms ${Nn}`,Ni=`left 380ms ${Nn}, top 380ms ${Nn}, width 380ms ${Nn}, height 380ms ${Nn}, transform 380ms ${Nn}`,Na=1/0,Ns=(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 ${Nn}`},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 ${Nn}, cy 380ms ${Nn}`}}),(0,U.jsx)("path",{d:l,style:{d:`path("${l}")`,transition:`d 380ms ${Nn}`},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)})})}),Nl=Math.atan2(56,45),No=Math.atan2(-56,-45);function Nc(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 Nd=(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=td(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=Nc(e.x2-7,n,Nl),l=Nc(e.x1+7,r,No),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 ${Nn}`}}),c=e=>({d:`path("${e}")`,transition:`d 380ms ${Nn}`});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}),Nu=(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=>wX(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=w1({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=vn[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 ${Nn}`},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)(jR,{pipeline:e.pipeline.pipeline,x:r,y:a,interactive:i,moveTransition:Nr},e.key):(0,U.jsx)(Nm,{index:e.pipeline.index,total:e.pipeline.total,color:vn[e.pipeline.tone],x:r,y:a,moveTransition:Nr},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)(j$,{flow:e.flow.flow,x:s,y:l,interactive:r,moveTransition:Nr},e.key)})]})}),Np=(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:Ni},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(Na)?`min(var(--inv-z, 1), ${Na})`:"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=bV(e.pipeline),`${s.k}/${s.n}`)}),(0,U.jsx)("span",{"data-pipeline-lifecycle":!0,className:"shrink-0 truncate opacity-80",children:bb(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:Ni},onKeyDown:e=>{"Escape"===e.key&&(e.stopPropagation(),i(null))},children:(0,U.jsx)(jZ,{group:a,onClose:()=>i(null)})}):null]})});function Nm({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 Nf({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:uR(e,n)}),idleTitle:null}}let i=uD(e);return null!==i?{running:null,idleTitle:(0,eh.Tl)(n,"turn.lastRun",{d:uR(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,tP.rK)(e.mtime)})}function Nh({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,tP.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,tP.cr)(n.title,40):r})]}):null}function Nx({file:e,onSelect:t}){let n=(0,tP.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,tP.cr)(e.title),onClick:()=>t(e),children:[(0,U.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${(0,tP.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,tP.cr)(e.cmdDesc||e.title,80)}),(0,U.jsx)("span",{className:"shrink-0 text-[10.5px] text-muted",children:(0,tP.rK)(e.mtime)})]})}function Ng({file:e}){let t=(0,tP.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,tP.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)(vj,{file:e,fontClassName:"text-[0.78em]"}),(0,U.jsx)("span",{className:"line-clamp-2 min-w-0 font-bold",children:(0,tP.cr)(e.title,70)}),(0,U.jsx)(jB,{file:e,showSettled:!1,fontClassName:"text-[0.72em]"}),(0,U.jsx)(vX,{rateLimit:e.rateLimit}),(0,U.jsx)(v3,{wakeup:e.pendingWakeup,interactive:!1},v4(e.pendingWakeup))]})})}let Nb=()=>void 0,Nv=e=>e?" opacity-35":"";function Nw({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${Nv(n)}`,style:{transform:`translate(${e.x}px, ${e.y}px)`,width:e.w,height:e.h,transition:Nr},children:[r?(0,U.jsx)("div",{className:"absolute -top-[60px] left-0 z-[4]",style:{width:1370},children:(0,U.jsx)(jz,{flow:r,onFocusRound:Nb})}):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,tP.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,tP.tz)(e.file.activity)}`}),(0,U.jsx)(jK,{file:e.file,fontClassName:"text-[11px]"}),(0,U.jsx)("span",{className:"ml-auto inline-flex min-w-0 shrink-0",children:(0,U.jsx)(vj,{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,tP.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)(jB,{file:e.file,fontClassName:"text-[10px]"}),(0,U.jsx)(vX,{file:e.file,shrinkable:!0}),(0,U.jsx)(v3,{wakeup:e.file.pendingWakeup,className:"pointer-events-auto",shrinkable:!0},v4(e.file.pendingWakeup)),e.under.length?(0,U.jsxs)("span",{className:"shrink-0",children:[e.under.length," ",i("scheme.underneath")]}):null,(0,U.jsx)(Nf,{file:e.file,className:"ml-auto text-[11px]"})]})]}),r?(0,U.jsx)(jH,{role:"implementer",active:"implementer"===tc(r)}):null,(0,U.jsx)(Ng,{file:e.file})]})}function Ny({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${Nv(n)}`,style:{transform:`translate(${e.x}px, ${e.y}px)`,width:e.w,height:e.h,transition:Nr},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 Nk({deck:e,dimmed:t}){let{t:n}=(0,eh.Ym)(),r=e.rounds.at(-1)??null,i=r?.round??null,a=tp(i?.verdict??null);return(0,U.jsxs)("div",{"data-scheme-node":e.key,className:`scheme-enter absolute${Nv(t)}`,style:{transform:`translate(${e.x}px, ${e.y}px)`,width:e.w,height:e.h,transition:Nr},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)(y8,{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,tP.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)(jH,{role:"reviewer",active:"reviewer"===tc(e.flow)})]})}function Nj({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${Nv(t)}`,style:{transform:`translate(${e.x}px, ${e.y}px)`,width:e.w,height:e.h,transition:Nr},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,tP.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,tP.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,tP.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)(vj,{file:e}),(0,U.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11.5px] font-semibold",children:(0,tP.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)(jB,{file:e,showSettled:!1}),(0,U.jsx)("span",{children:v9(r,e.kind)}),(0,U.jsx)("span",{children:(0,tP.rK)(e.mtime)}),t?(0,U.jsxs)("span",{children:["⤷ ",t]}):null]})]},e.path)})})})}function NN({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)(f7.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})})}function NS({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?bE(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":""}${Nv(a)}`,style:{transform:`translate(${e.x}px, ${e.y}px)`,width:e.w,height:e.h,transition:Nr},children:[i?(0,U.jsx)(NN,{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)(Nh,{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:bH(P,c.stage),children:[(0,U.jsx)("span",{className:"truncate",children:bH(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)(jz,{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)(kT,{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)(jT,{file:e.file,onClose:()=>O(!1)})}):null,D?(0,U.jsx)(wL,{repoDir:e.file.projectRoot?.trim()||e.file.cwd?.trim()||"",onClose:()=>L(!1),onCreate:(t,n)=>b5(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)(wn,{file:e.file,tasks:e.tasks,isRoot:e.isRoot,dormant:s,showFavorite:!0,titleOverride:bK(P,c),onClose:()=>k(e.file.path),onToggleExpand:()=>C(e.file.path),onSpawnRetry:S,relatedTasks:h,onOpenTask:y})}),(0,U.jsx)(kB,{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)(k_,{tray:T,onToggleExpanded:e=>M.onToggleExpanded(T.parentConversationId,e),onOpenMember:M.onOpenMember,onUnfold:M.onUnfold}):null,l?(0,U.jsx)(jH,{role:"implementer",active:"implementer"===tc(l)}):null,(0,U.jsx)(Ng,{file:e.file}),N&&k6(e.file)?(0,U.jsx)(k8,{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)(g6.A,{className:"h-3.5 w-3.5","aria-hidden":!0}),e.under.length," ",P("scheme.underneath"),(0,U.jsx)(sO.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)(Nx,{file:e,onSelect:b},e.path))}):null]})}function NC({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${Nv(i)}`,style:{transform:`translate(${e.x}px, ${e.y}px)`,width:e.w,height:e.h,transition:Nr},children:(0,U.jsx)("div",{className:`flex h-full ${r?"rounded-[10px] ring-2 ring-accent/60 ring-offset-2 ring-offset-canvas":""}`,children:nV(e.id)?(0,U.jsx)(yO,{draftId:e.id,project:t,onClose:()=>a(e.id),onLaunched:()=>a(e.id)}):(0,U.jsx)(wT,{draftId:e.id,project:t,files:n,onClose:()=>a(e.id),onSpawned:t=>s(e.id,t)})})})}function NA({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 NI({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=bk[bE(e.pipeline,e.stage)],{pipeline:p}=e;if(e.collapsedRow){let a=e.attempt?bO(e.attempt):null,s=a?bD(a,r):null,l=`${e.key}::card`;return(0,U.jsxs)("div",{"data-scheme-node":e.key,className:`scheme-enter absolute${Nv(n)} ${c?"z-30":""}`,style:{transform:`translate(${e.x}px, ${e.y}px)`,width:e.w,height:e.h,transition:Nr},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)(jL,{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)(NA,{onClose:()=>d(!1)}),"completed"===e.presentation?(0,U.jsx)(jD,{slot:e,onOpen:s&&!t?()=>i(s):void 0}):(0,U.jsx)(kN,{slot:e,interactive:!t})]}):null]})}if("completed"===e.presentation){let a=e.attempt?bO(e.attempt):null,s=a?bD(a,r):null;return(0,U.jsxs)("div",{"data-scheme-node":e.key,className:`scheme-enter absolute${Nv(n)}`,style:{transform:`translate(${e.x}px, ${e.y}px)`,width:e.w,height:e.h,transition:Nr},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)(jD,{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&&b0(((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};vt(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:{...b7,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:b9(n)})).then(e=>{e&&oQ("err",e),o(!1)})};return(0,U.jsxs)("div",{"data-scheme-node":e.key,className:`scheme-enter absolute${Nv(n)}`,style:{transform:`translate(${e.x}px, ${e.y}px)`,width:e.w,height:e.h,transition:Nr},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)(kN,{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 NM({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${Nv(n)}`,style:{transform:`translate(${e.x}px, ${e.y}px)`,width:e.w,height:e.h,transition:Nr},children:[(0,U.jsx)(ke,{flow:e.flow,rounds:e.rounds,focusRound:a,dormant:r,groupLabel:i}),(0,U.jsx)(jH,{role:"reviewer",active:"reviewer"===tc(e.flow)})]})}let NT=(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=lm(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=ru(r,rp(e.store,r)))?"live":"waiting_input"===n||"conflict"===n?"stalled":"idle"===n||"dead"===n?"idle":"recent")}return t},Ne,Nt),$=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)(()=>bB(m),[m]),O=(0,Y.useMemo)(()=>j7(e.stacks,e=>e.key),[e.stacks]),D=(0,Y.useMemo)(()=>j7(e.decks,e=>e.key),[e.decks]),L=(0,Y.useMemo)(()=>j7(e.drafts,e=>e.key),[e.drafts]),_=(0,Y.useMemo)(()=>j7(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)(()=>bR(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)(Nj,{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)(Nk,{deck:e,dimmed:H(e)},e.key):(0,U.jsx)(NM,{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)(NI,{slot:e,lite:i,dimmed:null!==d,files:n,onSelect:w},e.key)),L.map(e=>i?(0,U.jsx)(Ny,{draft:e,ringed:s===e.key||c===e.key,dimmed:null!==d},e.key):(0,U.jsx)(NC,{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)(Nw,{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)(NS,{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)??j9,flows:p,files:n,renderablePaths:E,renderableFlows:q,canFlow:ta(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)})]})}),NP="var(--color-danger)",N$=(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?NP:n?"var(--color-info)":v0[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 ${Nn}`},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 ${Nn}, cy 380ms ${Nn}`}}),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:NP,strokeWidth:2,style:{cx:`${o}px`,cy:`${c}px`,transition:`cx 380ms ${Nn}, cy 380ms ${Nn}`}}),(0,U.jsx)("text",{x:o,y:c+4.5,textAnchor:"middle",fontSize:13,fontWeight:700,fill:NP,style:{x:`${o}px`,y:`${c+4.5}px`,transition:`x 380ms ${Nn}, y 380ms ${Nn}`},children:"⚠"})]}):null]},e.key)})}):null});var NE=n(6937),NR=n(4885);let NO="linear-gradient(to bottom, #000 calc(100% - 18px), transparent)";function ND({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 NL({task:e,assignment:t,file:n,onDetach:r,onOpen:i}){let{t:a}=(0,eh.Ym)(),s=yh(t,n),[l,o]=(0,Y.useState)(!1),c=async()=>{let n=t.launchId;if(n&&!l){o(!0);try{let t=await nY(e.id,n);"task"in t?oQ("ok",a("tasks.retryLaunched")):oQ("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)(ue.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)(ND,{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=yx(s),f="handoff"===t.state,h=n?(0,tP.yz)(n):null,x=n?(0,tP.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,tP.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)(fF.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,tP.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)(ND,{icon:l?(0,U.jsx)(ue.A,{className:"h-3 w-3 animate-spin","aria-hidden":!0}):(0,U.jsx)(sD.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)(ND,{icon:(0,U.jsx)(NE.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)(ND,{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 N_({task:e,file:t,onOpen:n}){let{t:r}=(0,eh.Ym)(),i=e.source;if(!i)return null;let a=t?(0,tP.cr)(t.title,40):i.path.split("/").pop()??i.path,s=(0,tP.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)(fF.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)(ND,{icon:(0,U.jsx)(NE.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 NF=(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),oQ("err",c("tasks.emptyTextBlocked")));return}w(!1),g!==e.text&&r.patch(e.id,{text:g})},S=()=>(h?!g.trim():!!v)&&(oQ("err",c("tasks.emptyTextBlocked")),!0),C=d??(m&&m.seen===e.updatedAt?m:e.pos),A=v0[e.status],I=v2(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=wK(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=vw({onDrop:t=>S()?null:(r.handoff(e,t.file),c("tasks.linkHanded",{title:(0,tP.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 ${Nn}`},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(wV(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:NO,WebkitMaskImage:NO}: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)(N_,{task:e,file:e.source?D.get(e.source.path)??null:null,onOpen:r.openAgent}),e.assignments.map((t,n)=>(0,U.jsx)(NL,{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)(aL.A,{className:"h-3 w-3","aria-hidden":!0}):(0,U.jsx)(a_.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)(fD.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=v1.indexOf(t),v1[(n+1)%v1.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)(NR.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)(yQ.A,{className:"h-3 w-3","aria-hidden":!0}),y?c("tasks.deleteConfirm"):null]})]}),F.overlay]})});function Nq({project:e,pos:t,onCreated:n,onCancel:r}){let{t:i}=(0,eh.Ym)(),a=(0,Y.useRef)(()=>{}),s=yF(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 nD({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:v0.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)(yK,{draft:s,placeholder:i("tasks.newPlaceholder"),createLabel:i("tasks.panelCreate")})]})})}function Nz({task:e,expanded:t}){let{t:n}=(0,eh.Ym)(),r=v0[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:wY(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:v2(e.text)||n("tasks.untitled")})})]})}let NH=(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)(Nz,{task:e,expanded:o.has(e.id)},e.id):(0,U.jsx)(NF,{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)(Nq,{project:n,pos:c,onCreated:d,onCancel:u}):null]})});function NU(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 NB(e,t,n){if(!NU(e,t,16)&&!NU(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(!NU(d,t,16)){if(!NU(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(!NU(o,t,16)){if(!NU(o,n,16))return{x:s,y:l};a||(a={x:s,y:l})}}return a??{x:e.x,y:e.y}}let NK="llvSchemeMode",NY=(e,t)=>Math.hypot(e.x-t.x,e.y-t.y);function NW(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 NV(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 NJ=(e,t,n,r)=>Math.min(t,r)-Math.max(e,n);function NG(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 NQ=(e,t)=>({x:(e.x+e.w/2)*t.z+t.x,y:(e.y+e.h/2)*t.z+t.y}),NX=new Set,NZ=new Map;function N0({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 N1({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=NX,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,onConversationOpened:M,onTaskCollapse:T,placeTaskId:P,onTaskPlaced:$,newTaskNonce:E,builderPipelineId:R,onBuilderOpened:O}){var D,L,_;let F,q,{t:z}=(0,eh.Ym)(),H=!!w,[B,K]=(0,Y.useState)(null),[V,J]=(0,Y.useState)(0),G=(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())}}}})(()=>J(e=>e+1)),[]),[Q,X]=(0,Y.useState)(null),Z=R??Q,ee=(0,Y.useCallback)(()=>{X(null),O?.()},[O]),et=(0,Y.useCallback)(e=>{X(e.id)},[]),en=ih(e),er=en.selection,ei=en.selectionArmed;(0,Y.useEffect)(()=>{h&&K(h)},[h]);let ea=(0,Y.useMemo)(()=>a.length?[...i,...a]:i,[i,a]),es=(0,Y.useMemo)(()=>bM(s,ea),[s,ea]),[el,eo]=(0,Y.useState)([]),[ec,ed]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{let t=new Set(l.map(e=>e.id));eo(n=>{let r=n.filter(n=>!t.has(n.id)&&n.project===e);return r.length===n.length?n:r})},[l,e]);let eu=(0,Y.useMemo)(()=>{let t=new Set(l.map(e=>e.id)),n=el.filter(n=>!t.has(n.id)&&n.project===e);return n.length?[...l,...n]:l},[l,el,e]),[ep,em]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{let e=new Set(eu.map(e=>e.id));em(t=>[...t].some(t=>!e.has(t))?new Set([...t].filter(t=>e.has(t))):t)},[eu]);let ef=(0,Y.useMemo)(()=>eu.filter(wH),[eu]),eg=(0,Y.useMemo)(()=>ya(t,n,r,es,p,s,d,m,f,ef,ep,{now:u}),[t,n,r,es,p,s,d,m,f,ef,ep,u]),eb=!H&&(ei||er.size>0),ev=(0,Y.useRef)(en);(0,Y.useEffect)(()=>{ev.current=en});let ew=(0,Y.useCallback)(()=>ev.current.clearSelection(),[]),ey=(0,Y.useCallback)(e=>ev.current.toggleSelection(e),[]),ek=(0,Y.useRef)(B);(0,Y.useEffect)(()=>{ek.current=B},[B]);let ej=(0,Y.useCallback)((e,t)=>{if(null===e){K(null),ew();return}if(t&&eg.byPath.has(e)&&eg.nodes.some(t=>t.file.path===e)){K(null);let t=ek.current;t&&t!==e&&eg.nodes.some(e=>e.file.path===t)&&ev.current.commitSelection([t],!0),ev.current.toggleSelection(e);return}K(e)},[eg,ew]),eN=(0,Y.useMemo)(()=>e9(i),[i]),eS=(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?bx(e,t)?.agentPath??null:null}(n);e&&t.set(e,n)}return t})(s),[s]),eC=(0,Y.useMemo)(()=>bB(s),[s]),[eA,eI]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{eI(null)},[e]);let eM=(D=eg.nodes,eA?D.find(e=>e.file.path===eA)??D.find(e=>e.file.predecessorPath===eA)??null:null),eT=null!==eM;(0,Y.useEffect)(()=>{eM&&eM.file.path!==eA&&eI(eM.file.path)},[eM,eA]),(0,Y.useEffect)(()=>{if(!eT)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(),eI(null))};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[eT]);let[eP,e$]=(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=ek.current;if(!n)return;let r=eg.nodes.find(e=>e.file.path===n);r?.file.renamable&&(e.preventDefault(),eI(n),eH.current?.(n),e$(e=>({path:n,token:(e?.token??0)+1})))};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[eg]),(0,Y.useEffect)(()=>{e$(e=>e&&e.path!==eA?null:e)},[eA]);let[eE,eR]=(0,Y.useState)(null),eO=(0,Y.useCallback)((e,t)=>{eR(n=>({flowId:e,round:t,nonce:(n?.nonce??0)+1}))},[]),eD=x??h,eL=(0,Y.useRef)(v),e_=(0,Y.useRef)(w),eF=(0,Y.useRef)(k),eq=(0,Y.useRef)(j),ez=(0,Y.useRef)(N),eH=(0,Y.useRef)(M),eU=(0,Y.useRef)(S),eB=(0,Y.useRef)(C),eK=(0,Y.useRef)(A),eY=(0,Y.useRef)(I),eW=(0,Y.useRef)(T);(0,Y.useEffect)(()=>{eL.current=v,e_.current=w,eF.current=k,eq.current=j,ez.current=N,eH.current=M,eU.current=S,eB.current=C,eK.current=A,eY.current=I,eW.current=T});let eV=(0,Y.useCallback)(e=>{let t=e_.current;t?t(e.path):eL.current(e)},[]),eJ=(0,Y.useCallback)(e=>eF.current(e),[]),eG=(0,Y.useCallback)(e=>eq.current(e),[]),eQ=(0,Y.useCallback)((e,t)=>ez.current(e,t),[]),eX=(0,Y.useCallback)(e=>eU.current?.(e),[]),eZ=(0,Y.useCallback)(e=>eB.current?.(e),[]),e0=(0,Y.useCallback)(e=>eY.current?.(e),[]),e1=(0,Y.useCallback)(e=>{eI(e),eH.current?.(e)},[]),e2=(0,Y.useCallback)(e=>{let t=r.find(t=>t.path===e);t&&eV(t)},[r,eV]),e5=(0,Y.useCallback)(e=>{let t=i.find(t=>t.id===e);t&&eO(t.id,t.rounds.at(-1)?.n??1)},[i,eO]),e4=(0,Y.useMemo)(()=>new Set(r.map(e=>e.path)),[r]),e3=(0,Y.useMemo)(()=>new Set(eg.nodes.map(e=>e.file.path)),[eg]),e6=(0,Y.useMemo)(()=>bR(es,e3),[es,e3]),e8=(0,Y.useMemo)(()=>new Map(s.map(e=>[e.id,bP(e,o,i,r)])),[s,o,i,r]),e7=(0,Y.useMemo)(()=>{let e=new Map;for(let t of s)if(("completed"===t.state||"closed"===t.state)&&b_(t,i,e6,e4,r))for(let n of e8.get(t.id)??[]){let r=e.get(n.id)??[];r.push(t),e.set(n.id,r)}return e},[s,e8,i,e6,e4,r]),te=(0,Y.useCallback)(e=>{let t=b_(e,i,e6,e4,r);t?.kind==="path"?e2(t.path):t?.kind==="flow"&&e5(t.flowId)},[i,e6,e4,r,e2,e5]),tt=(0,Y.useMemo)(()=>c.map(e=>({key:e.key,color:jC[e.kind]})),[c]),tn=(0,Y.useRef)(eb);(0,Y.useEffect)(()=>{tn.current=eb},[eb]);let ti=(0,Y.useRef)(!1),ta=(0,Y.useCallback)((e,t)=>{if(ti.current)return ti.current=!1,!0;if(!tn.current)return K(null),!0;let n=jN(eg.nodes,{x:e,y:t,w:0,h:0});return n.length?ey(n[0]):ew(),!0},[eg,ey,ew]),ts=(0,Y.useRef)(()=>!1),tl=(0,Y.useMemo)(()=>[...eg.nodes,...eg.decks,...eg.stacks,...eg.drafts,...eg.slots,...eg.regionTasks].map(({x:e,y:t,w:n,h:r})=>({x:e,y:t,w:n,h:r})),[eg]),to=(0,Y.useMemo)(()=>[...eg.nodes,...eg.decks,...eg.stacks,...eg.drafts,...eg.slots],[eg]),tc=(0,Y.useMemo)(()=>new Map(eg.regionTasks.map(e=>[e.taskId,{x:e.x,y:e.y}])),[eg]),td=(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:wW(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,NB(e,a,t));for(let e of r.filter(e=>!e.expanded&&!e.auto).sort(i)){let n=NU(e,s,16)?NB(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,NB(e,a,t));return l})(ef.filter(e=>!tc.has(e.id)),tl,ep),[ef,tc,tl,ep]),tu=(0,Y.useMemo)(()=>ef.map(e=>{let t=tc.get(e.id)??td.get(e.id);return t&&(t.x!==e.pos.x||t.y!==e.pos.y)?{...e,pos:t}:e}),[ef,tc,td]),tp=(0,Y.useMemo)(()=>new Map(tu.map(e=>["task::"+e.id,wV(e,ep.has(e.id))])),[tu,ep]),tm=(0,Y.useMemo)(()=>new Map(tu.map(e=>[`task::${e.id}`,v2(e.text)||z("tasks.untitled")])),[tu,z]),tf=(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 tr(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})(eg,i,r),[eg,i,r]),th=(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=wV(r,n?.has(r.id)??!1),s=wJ(e);if(r.source){let n=t.get(r.source.path);if(n){let t=wG(e,wJ(n)),i=wG(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=wG(e,wJ(c)),u=wG(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})(tu,tf,ep,r),[tu,tf,ep,r]),tx=(0,Y.useMemo)(()=>tu.map(e=>({id:e.id,...wV(e,ep.has(e.id))})),[tu,ep]),tg=(0,Y.useMemo)(()=>{let e,t,n,r;return e=Math.round,t=th.map(t=>`${t.key}:${e(t.x1)},${e(t.y1)},${e(t.x2)},${e(t.y2)}`).join(";"),n=tx.map(t=>`${t.id}:${e(t.x)},${e(t.y)},${e(t.w)},${e(t.h)}`).join(";"),r=tl.map(t=>`${e(t.x)},${e(t.y)},${e(t.w)},${e(t.h)}`).join(";"),`${t}|${n}|${r}`},[th,tx,tl]),tb=(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||w4(t.x1,t.y1,e.x1,e.y1,o,c)>1.5||w4(t.x2,t.y2,e.x1,e.y1,o,c)>1.5||w4(e.x1,e.y1,t.x1,t.y1,d,u)>1.5||w4(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=w1(e,w5(e,t,n),r),a=w3(i.d);s.set(e.key,{route:i,cubics:a,box:w8(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&&w7(n,o.box)&&yn(t,o.cubics,w9(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=w5(a,t,n),u=r.get(a.key)??0,p=l,m=+!!l.route.crosses;for(let e of yr){let t=w1(a,d,u+e),n=+!!t.crosses;if(n>m)continue;let r=w3(t.d),i=w8(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=w5(a,t,n);for(let t=1;t<=48;t++){let n=w1(a,o,e+t);if(!n.crosses&&(!n.corridor||!i(n.corridor))){let e=w3(n.d);s.set(a.key,{route:n,cubics:e,box:w8(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);w7(i.box,a.box)&&yn(i.cubics,a.cubics,w9(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})(th,tx,tl),[tg]),tv=(0,Y.useMemo)(()=>{let e=[...tp.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}(tb.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}}(eg.width,eg.height,e)},[eg.width,eg.height,tp,tb]),tw=(0,Y.useMemo)(()=>{let e=function(e,t,n,r=jp){return jh(jx(e,t,n,r))}(eg,tu,m??NX,ep);return jh([...e?[e]:[]])},[eg,tu,m,ep]),ty=(0,Y.useMemo)(()=>jx(eg,tu,m??NX,ep).length,[eg,tu,m,ep]),tk=(0,Y.useMemo)(()=>(function(e,t){let n=[];for(let t of e.groups){if(!jf(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))||jm(r.file))&&n.push({key:r.file.path,label:(0,tP.cr)(r.file.title),rect:r,priority:jm(r.file)?4:2,color:`var(--color-${"codex"===r.file.engine?"codex":"openclaw"===r.file.engine?"openclaw":"claude"})`});return n})(eg,m??NX),[eg,m]),tj=(0,Y.useMemo)(()=>y4(r,o),[r,o]),[tN,tS]=(0,Y.useState)(""),tC=(0,Y.useCallback)(e=>{let t="current"===e?ty:eg.nodes.length+eg.drafts.length+eg.groups.length+eg.stacks.length+eg.decks.length+tu.length;tS(z("current"===e?"scheme.framedCurrent":"scheme.framedAll",{count:t}))},[ty,eg.nodes.length,eg.drafts.length,eg.groups.length,eg.stacks.length,eg.decks.length,tu.length,z]),tA=(0,Y.useRef)(P??null);(0,Y.useEffect)(()=>{tA.current=P??null},[P]);let tI=(0,Y.useCallback)((e,t)=>{let n={x:Math.round(e-130),y:Math.round(t-14)},r=tA.current;if(r){tA.current=null,nz(r,{placement:"pinned",pos:n}).then(e=>{e&&oQ("err",e)}),$?.();return}ed(n)},[$]),tM=(0,Y.useRef)(()=>!1),tT=(0,Y.useRef)(()=>!1),{cam:t$,vp:tE,viewportRef:tR,handLike:tO,taskTool:tD,setTaskTool:tL,centerOn:t_,panning:tF,glide:tq,setMode:tz,onPointerDown:tH,onPointerMove:tU,onDoubleClick:tB,onClick:tK,zoomCenter:tY,zoomTo:tW,fit:tV,fitCurrent:tJ,fitRect:tG,jump:tQ,manualNonce:tX,glideBy:tZ,glideFrame:t0,glideToCamera:t1}=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(NK);"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(NK,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&&NW(t,d,u)?NV(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&&NW(t,d,u)?NV(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(NV(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||!NW(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:NY(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=NY(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:eg,world:tv,currentWork:tw,mapMode:H,focus:h,onNodePick:w,setSelected:ej,onBackgroundDown:H?void 0:e=>(ti.current=!1,ts.current(e)),onWorldTap:H?void 0:ta,taskRects:tp,onPlaceTask:H?void 0:tI,onArrowNav:tM,onZoomKey:tT,onFit:tC}),t2=(0,Y.useMemo)(()=>kq(s),[s]),t5=(0,Y.useMemo)(()=>kz(eg,e,{extraRects:tp,aliases:t2}),[eg,e,tp,t2]);(0,Y.useEffect)(()=>{if(!H)return iD.setBoard({project:e,index:t5,moveTo:({rect:e,zoom:t})=>("inspect"===t?t0({...e},.9):tG({...e}),!0),restoreCamera:e=>(t1(e),!0)})},[H,e,t5,t0,tG,t1]);let[t4,t3]=(0,Y.useState)([]),t6=(0,Y.useCallback)(()=>{let e=tR.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});t3(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)},[tR]);(0,Y.useEffect)(()=>{t6()},[t6,t$,tE,eg]),(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,t6()}))},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&&tR.current&&a.observe(tR.current),window.addEventListener("resize",r),()=>{e&&n(e),i?.disconnect(),a?.disconnect(),window.removeEventListener("resize",r)}},[t6,tR]);let t8=(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]})(eg.nodes,eg.decks,eg.drafts,t$,t4),[eg,t$,t4]),t7=(0,Y.useRef)({fit:tV,fitCurrent:tJ});(0,Y.useEffect)(()=>{t7.current={fit:tV,fitCurrent:tJ}});let t9=(0,Y.useRef)(null),ne=eg.nodes.length>0||eg.drafts.length>0||eg.groups.length>0||eg.slots.length>0||tp.size>0;(0,Y.useEffect)(()=>{if(!H||!y||!ne){t9.current=null;return}t9.current!==y&&(t9.current=y,"current"===y?t7.current.fitCurrent():t7.current.fit())},[H,y,ne]),(0,Y.useEffect)(()=>{P&&!H&&tL(!0)},[P]),(0,Y.useEffect)(()=>{!E||H||ed(wz({x:Math.round((.25*tE.w-t$.x)/t$.z-130),y:Math.round((.7*tE.h-t$.y)/t$.z)},{w:260,h:140},[...tp.values(),...eg.nodes]))},[E]);let nt=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{if(!Z||H||nt.current===Z)return;let e=eg.groups.find(e=>"pipeline"===e.kind&&e.id===Z);e&&(nt.current=Z,ew(),tz("select"),t_(e,.75),ee())},[Z,eg.groups]);let{onArrow:nn,onZoomKey:nr,announcement:ni}=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=NQ(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=NJ(e.y,e.y+e.h,t.y,t.y+t.h)):"left"===n?(r=s-o,i=Math.abs(c-l),a=NJ(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=NJ(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 NG(a,.3);let s=i.filter(e=>e.ds<=e.dp);return s.length?NG(s,2):NG(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:!H&&!eb&&!eT,layout:eg,taskRects:tp,taskLabels:tm,cam:t$,vp:tE,selected:B,setSelected:K,centerOn:t_,glideBy:tZ,glideFrame:t0,manualNonce:tX});(0,Y.useEffect)(()=>{tM.current=nn,tT.current=nr},[nn,nr]);let na=(0,Y.useRef)(null),ns=(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=ns.current.get(n.id);void 0!==i&&i!==r&&t.push(function(e,t){let{k:n,n:r}=bV(t),i=t.cursor?t.stages.find(e=>e.id===t.cursor.stageId)??null:null,a=i?bH(e,i):"";return e("pipelineStrip.announce",{task:t.task,state:bb(e,t.state),stage:a,k:n,n:r})}(z,n))}ns.current=e,t.length&&na.current&&(na.current.textContent=t.join(". "))},[s,z]);let{marquee:nl,onBackgroundDown:no}=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=jN(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}:r_:r_;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:tR,cam:t$,layout:eg,enabled:!H,session:eb,onCommit:(0,Y.useCallback)((e,t)=>{ti.current=!0,K(null),ev.current.commitSelection(e,t)},[])});(0,Y.useEffect)(()=>{ts.current=no},[no]);let nc=(0,Y.useMemo)(()=>eg.nodes.filter(e=>er.has(e.file.path)),[eg,er]),nd=(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})(eg.nodes,er),[eg,er]),nu=(0,Y.useRef)(nd);(0,Y.useEffect)(()=>{nu.current=nd},[nd]);let np=(0,Y.useCallback)(()=>{nu.current&&tG(nu.current)},[tG]),nm=(0,Y.useRef)(t$);(0,Y.useEffect)(()=>{nm.current=t$},[t$]);let nf=(0,Y.useRef)(()=>{});(0,Y.useEffect)(()=>{nf.current=()=>{if(H)return;let e=eA?[eA]:function(e,t,n){let r=iy(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}(eg,t$,tE),t=new Set(eg.nodes.map(e=>e.file.path));iS.reportSlice({mode:"scheme",focusedPath:null!==eA?eA:null!==B&&t.has(B)?B:null,selectedPaths:ik(eg.nodes.map(e=>e.file.path),er),visiblePaths:e,camera:{x:t$.x,y:t$.y,zoom:t$.z,worldRect:iy(t$,tE)},viewport:{width:tE.w,height:tE.h,dpr:window.devicePixelRatio||1}})}}),(0,Y.useEffect)(()=>{H||nf.current()},[H,eg,er,B,eA]),(0,Y.useEffect)(()=>{if(H)return;let e=window.setTimeout(()=>nf.current(),300);return()=>window.clearTimeout(e)},[H,t$,tE]);let nh=(0,Y.useCallback)((e,t)=>void nB(e,t),[]),nx=(0,Y.useRef)(tf);(0,Y.useEffect)(()=>{nx.current=tf},[tf]);let ng=(0,Y.useMemo)(()=>({patch:async(e,t)=>{let n=await nz(e,t);return n&&oQ("err",n),n},remove:e=>{eo(t=>t.some(t=>t.id===e)?t.filter(t=>t.id!==e):t),nH(e).then(e=>{e&&oQ("err",e)})},handoff:async(e,t)=>{var n,r;let i=await nU(e.id,t.path);return"error"in i?(oQ("err",i.error),i.error):(dD(W(t),(n=i.task.id,r=i.task.text,`Task #${n.slice(0,8)}: ${r}`)),null)},draft:e=>eK.current?.(e),collapse:e=>eW.current?.(e),unassign:async(e,t)=>{let n=await nB(e.id,t);n&&oQ("err",n)},center:e=>t_(e,.75),toggleExpand:e=>{em(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},openAgent:e=>{let t=nx.current.get(e.path);t&&t_(t,.75),eV(e)}}),[t_,eV]),nb=(0,Y.useCallback)(e=>{eo(t=>[...t,e]),ed(null)},[]),nv=(0,Y.useCallback)(()=>ed(null),[]),[nw,ny]=(0,Y.useState)(!1);(0,Y.useEffect)(()=>{ny(e=>e?t$.z<.49500000000000005:t$.z<.4275)},[t$.z]);let nk=function(e){if(!Number.isFinite(e)||e<=0)return 24;let t=24*e;for(;t<18;)t*=2;return t}(t$.z);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)("div",{ref:tR,className:`relative min-h-0 flex-1 overflow-clip bg-board ${tF?"cursor-grabbing":tD?"cursor-crosshair":tO?"cursor-grab":""} ${tF||nl?"select-none":""} ${tO?"touch-none":""}`,tabIndex:H?void 0:0,"aria-label":H?void 0:z("scheme.boardAria"),onPointerDown:tH,onPointerMove:tU,onDoubleClick:tB,onClick:tK,onScroll:e=>{e.currentTarget.scrollLeft=0,e.currentTarget.scrollTop=0},children:[(0,U.jsx)("div",{className:"sr-only","aria-live":"polite",role:"status",children:ni}),(0,U.jsx)("div",{className:"sr-only","aria-live":"polite",role:"status",children:tN}),(0,U.jsx)("div",{ref:na,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:-nk,backgroundImage:"radial-gradient(color-mix(in srgb, var(--color-primary) 9%, transparent) 1px, transparent 1px)",backgroundSize:`${nk}px ${nk}px`,transform:`translate(${(t$.x%nk+nk)%nk}px, ${(t$.y%nk+nk)%nk}px)`,willChange:"transform"}}),(0,U.jsxs)("div",{className:`absolute left-0 top-0 ${tF?"scheme-panning":""}`,style:{width:eg.width,height:eg.height,transform:`translate(${t$.x}px, ${t$.y}px) scale(${t$.z})`,transformOrigin:"0 0",transition:tq?`transform .45s ${Nn}`:void 0,willChange:"transform","--inv-z":String(1/t$.z),"--label-o":t$.z<.45?"1":"0"},children:[(0,U.jsx)(Np,{groups:eg.groups,interactive:!H&&!tO&&!eb}),(0,U.jsx)(Ns,{edges:eg.edges,badgeAnchors:G,badgeAnchorRevision:V,width:eg.width,height:eg.height}),(0,U.jsx)(Nd,{loops:eg.loops,width:eg.width,height:eg.height}),(0,U.jsx)(Nu,{links:eg.links,byPath:eg.byPath,obstacles:to,interactive:!H&&!tO&&!eb,hubInteractive:!tO&&!eb,width:eg.width,height:eg.height}),(0,U.jsx)(NT,{layout:eg,project:e,files:r,interactive:!tO&&!eb,lite:H,dormant:nw,selected:B,multi:er,session:eb,focus:eD,attentionPaths:g??null,flowsByImpl:eN,flows:i,pipelines:s,pipelineStrips:H?eS:NZ,linkedTasksByPipeline:e8,relatedTasksByPath:tj,deckFocus:eE,badgeAnchors:G,trayApi:H?void 0:b,onSelect:eV,onClose:eJ,onFocusRound:eO,onDraftClose:eG,onDraftSpawned:eQ,onHandoff:S?eX:void 0,onSpawnRetry:C?eZ:void 0,onOpenTask:I?e0:void 0,onExpand:e1,onToggleMember:H?void 0:ey,onPipelineCreated:et}),(0,U.jsx)(N$,{edges:th,world:tv,routes:tb,onRetry:nh}),(0,U.jsx)(NH,{tasks:tu,files:r,project:e,interactive:!tO&&!eb,lite:H,camRef:nm,handlers:ng,selectedTaskId:B?.startsWith("task::")?B.slice(6):null,textExpandedIds:ep,pending:ec,onStickyCreated:nb,onCreateCancel:nv,completedPipelinesByTask:e7,onOpenPipelineHistory:te}),eb&&nd?(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:nd.x-14,top:nd.y-14,width:nd.w+28,height:nd.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:z("bulk.selectedCount",{count:er.size})})}):null]},e),nl?(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:nl.rect.x,top:nl.rect.y,width:nl.rect.w,height:nl.rect.h}}),nl.candidates.map(e=>{let t=eg.byPath.get(e);return t?(0,U.jsx)("div",{className:"absolute rounded-[10px] border-2 border-accent/70",style:{left:t.x*t$.z+t$.x,top:t.y*t$.z+t$.y,width:t.w*t$.z,height:t.h*t$.z}},e):null})]}):null,(0,U.jsx)(jj,{clusters:tk,cam:t$,vp:tE,hidden:H||!!nl||tF,obstacles:t8,onFit:tG}),(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:[H?null:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(N0,{active:tO&&!tD,title:z("scheme.handTool"),onClick:()=>tz("hand"),children:(0,U.jsx)(k7.A,{className:"h-4 w-4","aria-hidden":!0})}),(0,U.jsx)(N0,{active:!tO&&!eb&&!tD,title:z("scheme.selectTool"),onClick:()=>tz("select"),children:(0,U.jsx)(k9.A,{className:"h-4 w-4","aria-hidden":!0})}),(0,U.jsx)(N0,{active:eb,title:z("scheme.lassoTool"),onClick:()=>{eb?ew():(tz("select"),en.setSelectionArmed(!0))},children:(0,U.jsx)(je.A,{className:"h-4 w-4","aria-hidden":!0})}),(0,U.jsx)(N0,{active:tD,title:z("tasks.tool"),onClick:()=>tL(!tD),children:(0,U.jsx)(vZ.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)(N0,{title:z("scheme.zoomOut"),onClick:()=>tY(.8),children:(0,U.jsx)(a$.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:z("scheme.zoom100"),onClick:()=>tW(1),children:[Math.round(100*t$.z),"%"]}),(0,U.jsx)(N0,{title:z("scheme.zoomIn"),onClick:()=>tY(1.25),children:(0,U.jsx)(aE.A,{className:"h-4 w-4","aria-hidden":!0})}),(0,U.jsx)(N0,{title:z("scheme.fitCurrent"),onClick:tJ,children:(0,U.jsx)(jt.A,{className:"h-4 w-4","aria-hidden":!0})}),(0,U.jsx)(N0,{title:z("scheme.fit"),onClick:tV,children:(0,U.jsx)(aR.A,{className:"h-4 w-4","aria-hidden":!0})})]}),eb?(0,U.jsx)(jd,{project:e,nodes:nc,flowsByImpl:eN,onRemove:eJ,onFit:np,onExit:ew}):null,(0,U.jsx)(jA,{layout:eg,world:tv,tasks:tu,textExpandedIds:ep,currentWork:tw,stackDots:tt,cam:t$,vp:tE,onJump:tQ})]}),eM?(L=eM.file.path,F=eP&&null!==L&&eP.path===L?eP.token:void 0,_=bK(z,eC.get(eM.file.path)),q=void 0===F?_: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":q??(0,tP.cr)(eM.file.title,90),children:(0,U.jsx)(wn,{file:eM.file,tasks:eM.tasks,isRoot:eM.isRoot,expanded:!0,showFavorite:!0,titleOverride:q,onToggleExpand:()=>eI(null),autoEditToken:F,onSpawnRetry:C?eZ:void 0,relatedTasks:tj.get(eM.file.path),onOpenTask:I?e=>{eI(null),e0(e)}:void 0})})):null]})}function N2(){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 N5="llvArchived";function N4(e){try{window.localStorage.setItem(N5,JSON.stringify([...e]))}catch{}}function N3({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})})]})]})}let N6={claude:"Claude",codex:"Codex"};function N8({engine:e}){let t=xT(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=N6[e],o=(0,tP.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)(sO.kr,{className:"h-3 w-3 shrink-0 animate-spin motion-reduce:animate-none text-accent","aria-hidden":!0}):(0,U.jsx)(sO.yQ,{className:"h-3 w-3 shrink-0 text-muted","aria-hidden":!0})]}),r?(0,U.jsx)(xW,{state:t,onClose:()=>{i(!1),s.current?.focus()},placement:"header"}):null]})}function N7(e){let t=e.providerThrottle;return t?.reason==="provider_throttled"&&Number.isFinite(Date.parse(t.retryAt))?t:null}function N9({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=N7(e),h=(d=N7(e))?(0,eh.Tl)(u,"status.providerThrottled",{time:eV(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,tP.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)(sO.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,tP.tz)(e.activity)}`}),(0,U.jsx)(jK,{file:e}),(0,U.jsx)(vL,{file:e}),(0,U.jsx)(vj,{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,tP.rK)(e.mtime)}),e.ctx?(0,U.jsx)(vW,{ctx:e.ctx}):null,i?(0,U.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-0.5",children:[(0,U.jsx)(ux.A,{className:"h-3 w-3","aria-hidden":!0})," ",i]}):null,(0,U.jsx)(jB,{file:e}),(0,U.jsx)(vX,{file:e,shrinkable:!0}),(0,U.jsx)(v3,{wakeup:e.pendingWakeup,shrinkable:!0},v4(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)(hf,{file:e,compact:!0})}):null]})}function Se({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)(xh,{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)(N9,{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 St({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(N5),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),N4(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,N4(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,N4(n),n})},[])}}(e),j=tR(e,v.events,d,x,w,t),N=wl({query:d,enabled:r&&o&&!!d.trim()}),S=tR(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)(N3,{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)(N8,{engine:"claude"}),(0,U.jsx)(N8,{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)(sO.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)(sO.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)(Se,{title:l("switch.waiting"),items:j.waiting,size:"large",currentProject:n,onOpenFile:A,onArchive:I}),(0,U.jsx)(Se,{title:l("switch.working"),items:j.working,size:"large",currentProject:n,onOpenFile:A,onArchive:I}),(0,U.jsx)(Se,{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)(Se,{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)(xl,{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)(sO.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 Sn({ambientAvailable:e}={}){let{t}=(0,eh.Ym)(),n=ib(),r=(0,Y.useSyncExternalStore)(ni,nn,()=>t4),[i,a]=(0,Y.useState)(!1),s=(0,Y.useRef)(null),l=(0,Y.useRef)(null),o=e??tX();(0,Y.useEffect)(()=>{var e;let t;return e=window,t=()=>{t3=null,t7()},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=>{nr(e),nb()};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;nr({cuesEnabled:e}),e&&ng({cue:"success",eventId:`preview:${Date.now()}`}),nb()},children:r.cuesEnabled?(0,U.jsx)(cq.A,{className:d,"aria-hidden":!0}):(0,U.jsx)(cF.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)(lB.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=>{xL(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=>{nr({viewerLoopEnabled:e.target.checked}),nb()},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=>{nr({loopEnabled:e.target.checked}),nb()},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 Sr({items:e,activeRootPaths:t,onSelect:n}){let{t:r}=(0,eh.Ym)(),i=ib(),[a,s]=(0,Y.useState)(!1);return(0,U.jsxs)("div",{className:"shrink-0 border-t border-border bg-canvas",children:[(0,U.jsx)(yu,{open:a,onToggle:()=>s(e=>!e),label:r("tree.quiet"),count:e.length,mobile:i}),a?(0,U.jsx)(xh,{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,tP.yz)(e),s=(0,tP.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,tP.cr)(e.title),onClick:()=>n(e),children:[(0,U.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${(0,tP.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)(sO.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,tP.rK)(e.mtime)})]},e.path)})}):null]})}let Si=new Set(["pending","delivering","applying","queued","uncertain"]),Sa=e=>`llvDrafts:${e}`;function Ss(e,t){return e&&(e.startsWith("draft::")||t.some(t=>t.path===e))?e:null}function Sl(e){location.hash="#p="+encodeURIComponent(e)}function So({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)(g2.A,{className:"h-3 w-3","aria-hidden":!0}):(0,U.jsx)(g5.A,{className:"h-3 w-3","aria-hidden":!0}),r("scheme"===n?"dash.viewScheme":"dash.viewList")]},n))})}function Sc({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 Sd({projectName:e,onOrchestrator:t,onAgent:n,agentDisabled:r=!1}){let{t:i}=(0,eh.Ym)();return(0,U.jsx)("div",{className:"flex flex-1 items-center justify-center px-4 py-5 text-center","data-testid":"project-empty",children:(0,U.jsxs)("div",{className:"flex max-w-[440px] flex-col items-center gap-2",children:[(0,U.jsx)("div",{className:"text-[13.5px] font-semibold text-primary",children:i("dash.emptyTitle")}),(0,U.jsx)("div",{className:"text-[12px] text-secondary",children:i("dash.emptyStartHere",{project:e})}),(0,U.jsx)("div",{className:"text-[12px] text-secondary",children:i("dash.emptyOneAgent")}),t||n?(0,U.jsxs)("div",{className:"mt-1 flex flex-wrap items-center justify-center gap-2",children:[t?(0,U.jsxs)("button",{type:"button","data-testid":"project-empty-orchestrator",onClick:t,className:"flex min-h-11 shrink-0 items-center gap-1.5 rounded-[10px] border border-accent/45 bg-card px-4 text-[13px] font-bold text-accent shadow-1 hover:bg-accent/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:[(0,U.jsx)(d9.A,{className:"h-4 w-4","aria-hidden":!0})," ",i("orchPanel.title")]}):null,n?(0,U.jsxs)("button",{type:"button","data-testid":"project-empty-agent",onClick:n,disabled:r,title:i("dash.newConvo"),className:"flex min-h-11 shrink-0 items-center gap-1.5 rounded-[10px] border border-border bg-card px-4 text-[13px] 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)(g4.A,{className:"h-4 w-4 shrink-0 text-accent","aria-hidden":!0})," ",i("dash.emptyAgentCta")]}):null]}):null]})})}function Su({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 Sp=(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)(),$=ib(),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)(bu()),F=(0,Y.useRef)(bu()),q=ih(d),z=(T=q.loaded,u&&T),H=function(e){let[t,n]=(0,Y.useState)(g9);(0,Y.useEffect)(()=>{n(null===e?g9():function(e){try{let t=window.localStorage.getItem(br(e));return t?function(e){if("object"!=typeof e||null===e||!Array.isArray(e.entries)||"number"!=typeof e.cursor)return g9();let t=e.entries.filter(bn);if(t.length!==e.entries.length)return g9();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)):g9()}catch{return g9()}}(e))},[e]);let r=t=>{n(t),null!==e&&function(e,t){try{window.localStorage.setItem(br(e),JSON.stringify(t))}catch{}}(e,t)};return{canUndo:be(t),canRedo:bt(t),undoEntry:be(t)?t.entries[t.cursor-1]:null,redoEntry:bt(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(!be(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(!bt(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)(()=>dX(e,J),[e,J]),ei=(0,Y.useMemo)(()=>new Set([...q.explicitManual,...B.expanded,...er.map(e=>e.file.path)]),[q.explicitManual,B.expanded,er]),ea=(0,Y.useMemo)(()=>new Map(Object.entries(q.prefs.seenAt??{})),[q.prefs.seenAt]),es=e=>q.markSeen(tb(e)),el=t=>{let n=e.find(e=>e.path===t);n&&es(n)},[eo,ed]=(0,Y.useState)([]),[eu,ep]=(0,Y.useState)(()=>new Set),[em,ef]=(0,Y.useState)(null),[ex,eg]=(0,Y.useState)(!1),[ev,ew]=(0,Y.useState)(0),[eC,eT]=(0,Y.useState)(0),[e$,eE]=(0,Y.useState)(null),[eL,eq]=(0,Y.useState)(!1),[ez,eH]=(0,Y.useState)(null),[eU,eK]=(0,Y.useState)(null),[eY,eW]=(0,Y.useState)([]),[eV,eJ]=(0,Y.useState)(null),[eG,eQ]=(0,Y.useState)(0),eX=lm(e=>{let t=new Set(Object.values(e.store.operations).filter(e=>("send"===e.kind||"steer"===e.kind)&&Si.has(e.status)).map(e=>e.conversationId));for(let n of Object.values(e.store.sessions))("running"===n.turn||"interrupt_requested"===n.turn)&&t.add(n.conversationId);return[...t].sort().join("\n")},""),e0=(0,Y.useMemo)(()=>new Set(eX?eX.split("\n"):[]),[eX]),e2=(0,Y.useMemo)(()=>(function(e,t=[]){let n=e1(t),r=new Set;for(let t of e){if(!t.cursor||!ty.includes(t.state))continue;let e=t.runs.find(e=>e.stageId===t.cursor.stageId),i=e?.attempts.filter(e=>!e.historical).at(-1);i?.agentPath&&r.add(n(i.agentPath))}return r})(O,e),[O,e]),e5=bc(3e4),e4=(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]),e3=(0,Y.useMemo)(()=>eP(e,d,l,void 0,e4,""),[e,d,l,e4]),e6=e3||"/",e8=!!e3;(0,Y.useEffect)(()=>{let e=()=>eQ(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(Sa(e))??"[]"),n=Array.isArray(t)?t.filter(e=>"string"==typeof e):[],r=n.filter(e=>!nV(e));if(r.length!==n.length){for(let e of n)nV(e)&&yR(e);sessionStorage.setItem(Sa(e),JSON.stringify(r))}return r}catch{return[]}}(d),i=[];for(let t of r)if(!nV(t)){let n=wC(t)||void 0;if(wN(t,"cwd").trim()){!n&&e8&&function(e,t){let n=t.trim();n&&wI(e)&&wN(e,"cwd").trim()!==n&&(wA(e,n),window.dispatchEvent(new window.CustomEvent(wM,{detail:{id:e,cwd:n}})))}(t,e6);continue}let r=n?e.find(e=>e.path===n)?.cwd?.trim():void 0;r?wA(t,r):n?i.push({id:t,sourcePath:n}):wA(t,e6)}ed(r),ep(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||(wA(e,r),ep(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){wA(e,e6),ep(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,e6,e8]);let e9=()=>q.setTaskPanelOpen(!K);(0,Y.useEffect)(()=>()=>{D.current&&window.clearTimeout(D.current)},[]);let tn=(0,Y.useMemo)(()=>(function(e){let t,n,r=en([...e.files]),i=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),a=e.nowMs??Date.now(),s=void 0===e.idleMs?Number.isFinite(n=(t=void 0!==tf?tf.env?.NEXT_PUBLIC_LLV_WORKER_COLLAPSE_MINUTES:void 0)?Number(t):NaN)&&n>0?6e4*n:72e5:e.idleMs,l=tC({files:r,flows:e.flows,pipelines:e.pipelines,pinnedPaths:e.pinnedPaths??tT,protectedPaths:e.protectedPaths,activeDeliveryConversationIds:e.activeDeliveryConversationIds,seenAt:e.seenAt}),o=[];for(let{key:t,members:n}of i){let i=n[n.length-1],c=Z(r,i.reviewedId);if(!c||e.flows.some(e=>e7(e)&&e.implementerPath===c.path))continue;let d=n.map((e,t)=>{let{file:n}=e,r=n.review??null,i=null!==s&&a-1e3*n.mtime>=s,o=!r&&!tw(n,l)&&(tv(n,l)||i);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:o?"no verdict":null}}),u=d[d.length-1],p={engine:"codex"===i.file.engine?"codex":"claude",model:i.file.model,effort:i.file.effort??null};o.push({id:tI+t,template:"implement-review-loop",project:eM(c),cwd:c.cwd??"",implementerPath:c.path,implementerConversationId:c.conversationId??null,roles:{implementer:{engine:"codex"===c.engine?"codex":"claude",model:c.model,effort:c.effort??null},reviewer:p},baseRef:"",baseMode:"head",mode:"manual",reviewerMode:"pane",roundLimit:0,state:null===u.verdict&&null===u.error?"reviewing":"done_comment",stateDetail:null,rounds:d,createdAt:d[0].startedAt,closedAt:null})}return o.sort((e,t)=>e.id<t.id?-1:1)})({files:e,flows:R,tasks:a,conversationAliases:s,nowMs:eG,pipelines:r?void 0:O,pinnedPaths:ei,protectedPaths:e2,activeDeliveryConversationIds:e0,seenAt:ea}),[e,R,a,s,eG,O,r,ei,e2,e0,ea]),ta=(0,Y.useMemo)(()=>tn.length?[...R,...tn]:R,[R,tn]),ts=(0,Y.useMemo)(()=>{let t=ta.filter(e7),n=function(e,t){let n=te(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)tM(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=tt(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:e5,ageHorizonSeconds:ek()})},[e,ta,e5]),tl=(0,Y.useMemo)(()=>{let e=new Set(ts);for(let t of B.expanded)e.add(t);return e},[ts,B.expanded]),to=(0,Y.useMemo)(()=>bA(O,ta),[O,ta]),tc=(0,Y.useMemo)(()=>bM(O,ta),[O,ta]),td=(0,Y.useMemo)(()=>(function(e,t,n=ti){let r=e1(e),i=function(e,t){if(!e.size||t===eZ)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,tc,to),[e,tc,to]),tu=(0,Y.useMemo)(()=>(function(e,t,n=[]){let r=new Map(t.map(e=>[e.id,e])),i=bA(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 tr(e,t,n))i.has(r)||a.add(r)}return a})(O,ta,e),[O,ta,e]),tp=(0,Y.useMemo)(()=>(function(e,t,n=[]){let r=e1(n),i=new Set;for(let t of e){if("completed"!==t.state||t.hiddenAt)continue;let e=function(e){let t=null,n=[-1,-1];for(let r of e.runs)for(let e of r.attempts){if(e.historical||!e.agentPath)continue;let r=[tk(e.startedAt),tk(e.completedAt)];(null===t||r[0]>n[0]||r[0]===n[0]&&r[1]>=n[1])&&(t=e,n=r)}return t}(t);e?.agentPath&&i.add(r(e.agentPath))}for(let e of t)tg.has(e.state)&&i.add(r(e.implementerPath));return i})(r?[]:O,ta,e),[O,r,ta,e]),tm=(0,Y.useMemo)(()=>(function(e){let t=tC(e),n=[];for(let r of e.files)eM(r)===e.project&&(r.spawn&&"failed"!==r.spawn.state&&"recovered"!==r.spawn.state||r.migratedTo||"claude"!==r.engine&&"codex"!==r.engine||function(e,t){if(tw(e,t))return!0;if(tv(e,t)){let n;return!!t.outcomePaths?.has(e.path)&&(void 0===(n=t.seenAt?.get(tb(e)))||!(n>=e.mtime))}return!0}(r,t)||n.push(r));return n})({files:e,project:d,flows:ta,pipelines:r?void 0:O,pinnedPaths:ei,protectedPaths:e2,activeDeliveryConversationIds:e0,outcomePaths:tp,seenAt:ea}),[e,d,ta,O,r,ei,e2,e0,tp,ea]),th=(0,Y.useMemo)(()=>new Set(tm.map(e=>e.path)),[tm]),tN=(0,Y.useMemo)(()=>new Set(e.filter(e=>!th.has(e.path)).map(e=>e.path)),[e,th]),tS=(0,Y.useMemo)(()=>new Map(e.map(e=>[e.path,e])),[e]),tP=(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 tr(e,r,n))i.has(a)||i.set(a,t.id)}return i})(O,R,e),[O,R,e]),t$=(0,Y.useMemo)(()=>e=>{let t=tS.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,tS,tP):null},[tS,tP]),tE=(0,Y.useMemo)(()=>e=>{let t=e,n=new Set([e.path]);for(;;){let e=t.parent?tS.get(t.parent):void 0;if(!e||n.has(e.path))break;n.add(e.path),t=e}return t.path},[tS]),tR=(0,Y.useMemo)(()=>e.filter(e=>eM(e)===d&&(e.spawn?.state==="failed"||e.spawn?.state==="recovered")&&eG-1e3*e.mtime>=9e5).sort((e,t)=>t.mtime-e.mtime),[e,d,eG]),tO=(0,Y.useMemo)(()=>(function(e){let t=new Set;for(let n of e)n.path.startsWith("spawn:")&&t.add(n.path);return t})(tR),[tR]),tD=(0,Y.useMemo)(()=>th.size||tO.size||tu.size?bI(td.filter(e=>!th.has(e.path)&&!tO.has(e.path)),tu):td,[td,th,tO,tu]),tL=(0,Y.useMemo)(()=>eF(tD,d,{expandedConversationPaths:tl,keepExpandedPaths:tN,now:e5}),[tD,d,tl,tN,e5]),t_=(0,Y.useMemo)(()=>{let t=new Set(B.hidden),n=new Set(B.manual);for(let e of tL)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=tS.get(e);n&&eM(n)===d&&r.add(W(n))}let i=new Set([...tu,...th,...tO]);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===eB(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:yl(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)=>yo(e.state)-yo(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)yo(n)<yo(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:ei,hiddenPaths:t,claimedPaths:i,hostEligibleParentIds:r,now:e5})},[tL,B.hidden,B.manual,q.prefs.foldedEngineChildIds,q.prefs.expandedEngineTrayParentIds,tS,d,e,tu,th,tO,ei,e5]),tF=(0,Y.useMemo)(()=>t_.promotedPaths.size||t_.foldedPaths.size?eF(tD,d,{expandedConversationPaths:tl,enginePlacement:{promotedEnginePaths:t_.promotedPaths,foldedEnginePaths:t_.foldedPaths},keepExpandedPaths:tN,now:e5}):tL,[tD,d,tl,t_,tN,tL,e5]),tq=(0,Y.useMemo)(()=>new Set(tF.map(e=>e.key)),[tF]),tz=(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)})(tD,d,tq),[tD,d,tq]),tH=(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})(tD,d,tq),[tD,d,tq]),tU=(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)})(tD,d,tq,tH),[tD,d,tq,tH]),tB=(0,Y.useMemo)(()=>new Set(tF.flatMap(e=>e.columns.map(e=>e.file.path))),[tF]),tK=(0,Y.useMemo)(()=>new Set(B.hidden),[B.hidden]),tY=(0,Y.useMemo)(()=>a.filter(e=>e.project===d),[a,d]),[tW,tV]=(0,Y.useState)(()=>ym(d));(0,Y.useEffect)(()=>{tV(ym(d))},[d]);let tJ=(e,t)=>{tV(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})},[tG,tQ]=(0,Y.useState)(null),tX=(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 v1){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}})(tY.filter(wH),{files:e,nowMs:eG,focusedTaskId:tG,expandedIds:tW}),[tY,e,eG,tG,tW]),tZ=(0,Y.useMemo)(()=>new Set(tX.stacks.flatMap(e=>e.items.map(e=>e.id))),[tX]),t0=(0,Y.useMemo)(()=>tZ.size?tY.filter(e=>!tZ.has(e.id)):tY,[tY,tZ]),t1=(0,Y.useMemo)(()=>{let e=new Map(tD.map(e=>[e.path,e]));return B.manual.map(t=>e.get(t)).filter(e=>void 0!==e&&eM(e)===d&&!tB.has(e.path)&&!tK.has(e.path))},[B.manual,tD,d,tB,tK]),t2=(0,Y.useMemo)(()=>{let t=new Map(td.map(e=>[e.path,e])),n=new Map(e.filter(e=>tu.has(e.path)).map(e=>[e.path,e])),r=new Set(t1.map(e=>e.path)),i=eY.map(e=>t.get(e)??n.get(e)).filter(e=>void 0!==e&&eM(e)===d&&!r.has(e.path)&&(!tB.has(e.path)||tK.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.keepExpandedPaths?.has(l)??!1;if(e.keepExpandedPaths&&!s)continue;let o=e.pinnedPaths.has(l);(o||ej(n,e.now??0,e.ageHorizonSeconds??ek()))&&(s||o||n.userAuthored||n.authorshipUnverified)&&(i.push(n),a.add(l))}return i})({files:e,flows:ta,renderedNodePaths:new Set([...[...tB].filter(e=>!tK.has(e)),...r,...i.map(e=>e.path)]),hiddenPaths:tK,pinnedPaths:ei,keepExpandedPaths:tN,now:e5}).filter(e=>eM(e)===d&&!tu.has(e.path)),s=[...i,...a];return s.length?[...t1,...s]:t1},[eY,td,e,tu,ta,d,tB,tK,t1,ei,tN,e5]),t5=(0,Y.useMemo)(()=>tF.reduce((e,t)=>e+t.columns.reduce((e,t)=>e+ +("live"===t.file.activity)+t.tasks.filter(e=>"live"===e.activity).length,0),0),[tF]),t4=tF.filter(e=>!e.orphanTask).length,t3=e=>{A?.(),eK(e),tQ(e.startsWith("task::")?e.slice(6):null),D.current&&window.clearTimeout(D.current),D.current=window.setTimeout(()=>eK(null),1800)},t6=e=>{tJ(e,!0),t3("task::"+e)};(0,Y.useEffect)(()=>{eW([]),eJ(null)},[d]),(0,Y.useEffect)(()=>{if(!f||!(null!==Ss(f.path,e)||tu.has(f.path))||!_.current.consume(f))return;let{path:t}=f;f.catalog&&eJ(t),L.current=t,eW(n=>tu.has(t)?b$(n,t,O,ta,e):n.includes(t)?n:[...n,t])},[f,tu,O,ta,e]),(0,Y.useEffect)(()=>{if(!h||!(null!==Ss(h.path,e)||tu.has(h.path))||!F.current.consume(h))return;let{path:t}=h;eW(n=>tu.has(t)?b$(n,t,O,ta,e):n.includes(t)?n:[...n,t])},[h,tu,O,ta,e]),(0,Y.useEffect)(()=>{let t=Ss(L.current,e);t&&(L.current=null,t3(t))}),(0,Y.useEffect)(()=>{let e=sessionStorage.getItem("llvTaskFocus");e&&tY.some(t=>t.id===e)&&(sessionStorage.removeItem("llvTaskFocus"),t6(e))});let t8=e=>{if(e.project!==d){sessionStorage.setItem("llvTaskFocus",e.id),Sl(e.project);return}t6(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&&t8(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),Sl(r.project);return}A?.(),eH(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"),eH(e))},[O,d]);let t7=e=>{q.setTaskPanelOpen(!1),eE(e)},t9=e=>{ed(e),sessionStorage.setItem(Sa(d),JSON.stringify(e))},ne=e=>{eJ(null),q.setViewMode(e)},nt=()=>"function"==typeof crypto.randomUUID?crypto.randomUUID():Date.now().toString(36)+Math.random().toString(36).slice(2,10),nn=()=>{if(!u)return;A?.();let e=nt();wA(e,e6),t9([...eo,e]),L.current="draft::"+e},nr=async(e,t)=>(A?.(),b5(d,t,e??void 0)),ni=t=>{var n,r;A?.();let i=eo.find(e=>t.conversationId&&wN(e,"parentConversationId")===t.conversationId||wC(e)===t.path);if(i)return void t3("draft::"+i);let a=nt();n=t.path,r=t.conversationId,wS(a,"src",n),wS(a,"parentConversationId",r??""),wA(a,eP(e,d,l,t.path,e4,e6)),t9([...eo,a]),L.current="draft::"+a},na=e=>{if(nV(e))yR(e);else for(let t of["engine","model","cwd","cwdSeed","text","boot","src","parentConversationId","effort","speed","accountId","role","roleParams","reviews","confirm"])sessionStorage.removeItem(wv(e,t));t9(eo.filter(t=>t!==e))},ns=e=>{if(A?.(),yc(e))return void yd(e,vt).then(e=>{e&&oQ("err",e)});let t=nt();e.goal?.objective&&wS(t,"text",e.goal.objective),wA(t,e.cwd?.trim()||e6),t9([...eo,t]),L.current="draft::"+t},nl=(e,t)=>{na(e),nx(t)},no=e=>{fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"kill",path:e})}).catch(()=>{}),q.mutate([w$(e,eY).mutation]),eW(t=>w$(e,t).ephemeral),M?.(e)},nc=t=>{t===eV&&eJ(null);let n=nu.get(t)?.title??e.find(e=>e.path===t)?.title??"";H.record({kind:"close",path:t,title:n});let r=e.find(e=>e.path===t);r&&es(r),no(t)},nd=(0,Y.useRef)(B);(0,Y.useEffect)(()=>{nd.current=B});let nu=(0,Y.useMemo)(()=>new Map(td.filter(e=>eM(e)===d).map(e=>[e.path,e])),[td,d]),np=(0,Y.useMemo)(()=>e.filter(e=>eM(e)===d&&"claude-tasks"!==e.root).length,[e,d]),nm=b&&np>=v,nf=(0,Y.useMemo)(()=>tF.map(e=>({key:e.key,orphanTask:e.orphanTask})),[tF]);(0,Y.useEffect)(()=>{if(q.loaded&&"unavailable"!==q.sync&&(!f||Ss(f.path,e))){var t,n;let r,i,a,s;q.mutate((t={files:e,groups:nf,manual:nd.current.manual,catalog:nu,catalogComplete:nm,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))}},[nf,e,nu,nm,d,q.loaded,q.sync,f]);let nh=(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:ta,project:d,explicitManual:q.explicitManual,manual:nd.current.manual,expanded:nd.current.expanded,hidden:nd.current.hidden}).filter(e=>!nh.current.has(e.path));if(t.length){for(let e of t)nh.current.add(e.path);q.mutate(t)}},[e,ta,d,q.loaded,q.sync,q.explicitManual,q.revision]);let nx=t=>{A?.();let n=eM(t);if(n!==d){is(n,t.path,eA(t)),location.hash=Q(t);return}if(ec(t,d),es(t),tu.has(t.path)){L.current=t.path,eW(n=>b$(n,t.path,O,ta,e));return}tB.has(t.path)&&!tK.has(t.path)||t1.some(e=>e.path===t.path)?t3(t.path):(eA(t)?q.restore(t.path,"expanded"):tB.has(t.path)?q.restore(t.path,"auto"):q.restore(t.path,"manual"),L.current=t.path)},ng=t=>{A?.();let n=e.find(e=>e.path===t);if(n){if(eM(n)!==d)return void nx(n);ec(n,d),es(n),L.current=t,eW(e=>e.includes(t)?e:[...e,t])}},nb=(0,Y.useMemo)(()=>({trays:t_.traysByParent,foldedChildPaths:t_.foldedPaths,onToggleExpanded:(e,t)=>q.setEngineTrayExpanded(e,t),onOpenMember:ng,onUnfold:(e,t)=>q.setEngineChildFold(e,t,!1),onFoldChild:(e,t)=>q.setEngineChildFold(e,t,!0)}),[t_,q]),nv=I??nx,nw=t=>{wD(window.localStorage,t.id,"expanded",wO(t));let n=e.find(e=>e.path===t.implementerPath);n?nx(n):q.restore(t.implementerPath,"manual")},ny=()=>{let t=H.undo();if(null===t||"close"!==t.kind)return;let n=nu.get(t.path)??e.find(e=>e.path===t.path);n?nx(n):q.restore(t.path,"manual")},nk=()=>{let e=H.redo();null!==e&&"close"===e.kind&&no(e.path)},nj=(0,Y.useRef)({onUndo:ny,onRedo:nk});nj.current={onUndo:ny,onRedo:nk},(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?nj.current.onRedo():nj.current.onUndo())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[d]);let nN=[];t5?nN.push(`${P("dash.branchesLive",{count:t5})} \xb7 ${P("dash.trees",{count:t4})}`):t4&&nN.push(P("dash.recentConvos",{count:t4})),tz.length&&nN.push(P("dash.quietTrees",{count:tz.length}));let nS=tF.map(e=>({...e,columns:e.columns.filter(e=>!tK.has(e.file.path))})).filter(e=>e.columns.length),nC=nS.filter(e=>e.orphanTask).map(e=>e.columns[0].file),nA=nS.filter(e=>!e.orphanTask),nI=(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]),nM=eo.filter(e=>!eu.has(e)),nT=nA.length>0||t2.length>0||nM.length>0||tY.length>0||nI.length>0,nP=(0,Y.useMemo)(()=>e.filter(e=>eM(e)===d).sort((e,t)=>t.mtime-e.mtime),[e,d]),n$=(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]),nE=(0,Y.useMemo)(()=>nT?[]: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))}(bI(td.filter(e=>!tK.has(e.path)&&!th.has(e.path)&&!tO.has(e.path)),tu),d,100),[nT,td,tK,th,tO,tu,d]),nR=nE.length>0,nO=nT||nR,nD=(0,Y.useMemo)(()=>new Set(eY.filter(e=>tu.has(e))),[eY,tu]),nL=ya(nT?nA:nE,nT?t2:[],e,tc,nT?nM:[],O,[],new Set,nD,[],new Set,{now:e5}),n_=new Set;for(let e of nL.decks)for(let t of e.rounds)t.file&&n_.add(t.file.path);let nF=nL.nodes.map(e=>e.file.path).join("\n"),nq=function(e,t,n=new Set,r={}){let i=new Map,a=e1(e);for(let s of e){if(n.has(s.path))continue;let{key:e,kind:l,id:o}=function(e,t,n={},r=eZ){let i=n.pipelineIdOf?.(e.path)??null;if(i)return{key:"wstack::pipeline::"+i,kind:"pipeline",id:i};let a=function(e,t,n=eZ){return tx(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)=>tA(e)-tA(t));return s.sort((e,t)=>e.kind!==t.kind?tj[e.kind]-tj[t.kind]:tA(e.items[0])-tA(t.items[0]))}(tm,ta,new Set([...n_,...tK,...tO,...tu]),{pipelineIdOf:t$,originOf:tE}),nz=b||n$.length>0,nH=null!==eV&&nO?"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:nT,hasArchiveNodes:nR,hasHistoryRows:nz}),nU=nO&&nz;(0,Y.useEffect)(()=>{let e="unavailable"===q.sync?null:q.revision;iS.reportContext({project:d,board:{renderedRevision:e,durableRevision:e,sync:q.sync}})},[d,q.revision,q.sync]),(0,Y.useEffect)(()=>{u&&iS.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"===nH&&nO)return;let e=nz?n$.map(e=>e.path):[],t=e.length>0?e:nF?nF.split("\n"):[],n=t.slice(0,128),r=nz?"list":$?"mobile-focus":"list";iS.reportSlice({mode:r,focusedPath:null,selectedPaths:ik(t,q.selection,{includeUnordered:!0}),visiblePaths:n,camera:null})},[nH,nO,nz,n$,$,nF,q.selection]);let nB=nq.reduce((e,t)=>e+t.items.length,0)+tR.length+tY.length+(nR?0:tU.length),nK=$&&"scheme"===nH&&em&&k6(em)?em:null,nY=$&&z&&(nB>0||!!nK);return(0,U.jsx)(ba,{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)(xi.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)(bd,{canUndo:H.canUndo,canRedo:H.canRedo,undoEntry:H.undoEntry,redoEntry:H.redoEntry,onUndo:ny,onRedo:nk}),$?(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)(g3.A,{className:"h-5 w-5","aria-hidden":!0})}):null,N?(0,U.jsx)("span",{className:"flex shrink-0 items-center",children:N}):null,nY?(0,U.jsxs)("button",{type:"button","data-testid":"mobile-shelf-trigger","aria-haspopup":"dialog","aria-expanded":ex,"aria-label":P("dash.hiddenShelf"),onClick:()=>eg(!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)(g6.A,{className:"h-4 w-4","aria-hidden":!0}),nB>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:nB}):null]}):null,(0,U.jsx)(Sc,{triggerLabel:P("dash.createMenu"),icon:(0,U.jsx)(aE.A,{className:"h-5 w-5","aria-hidden":!0}),children:e=>(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Su,{icon:(0,U.jsx)(g4.A,{className:"h-4 w-4","aria-hidden":!0}),label:P("dash.agent"),disabled:!u,onSelect:()=>{e(),nn()}}),(0,U.jsx)(Su,{icon:(0,U.jsx)(fL.A,{className:"h-4 w-4","aria-hidden":!0}),label:P("dash.task"),onSelect:()=>{e(),A?.(),eT(e=>e+1)}}),(0,U.jsx)(Su,{icon:(0,U.jsx)("span",{className:"text-[15px] font-bold leading-none",children:"≡"}),label:P("dash.pipeline"),onSelect:()=>{e(),eq(!0)}})]})}),(0,U.jsx)(Sc,{triggerLabel:P("dash.moreMenu"),icon:(0,U.jsx)(uM.A,{className:"h-5 w-5","aria-hidden":!0}),children:e=>(0,U.jsxs)(U.Fragment,{children:[nU?(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)(Su,{icon:(0,U.jsx)(g2.A,{className:"h-4 w-4","aria-hidden":!0}),label:P("dash.viewSchemeMenu"),checked:"scheme"===nH,onSelect:()=>{e(),ne("scheme")}}),(0,U.jsx)(Su,{icon:(0,U.jsx)(g5.A,{className:"h-4 w-4","aria-hidden":!0}),label:P("dash.viewListMenu"),checked:"list"===nH,onSelect:()=>{e(),ne("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)(Su,{icon:(0,U.jsx)(g8.A,{className:"h-4 w-4","aria-hidden":!0}),label:P("board.undo"),onSelect:()=>{e(),ny()}}):null,H.canRedo?(0,U.jsx)(Su,{icon:(0,U.jsx)(g7.A,{className:"h-4 w-4","aria-hidden":!0}),label:P("board.redo"),onSelect:()=>{e(),nk()}}):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)(Sn,{})]}),(0,U.jsx)(d7,{}),(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)(sO.$T,{className:"h-4 w-4","aria-hidden":!0})," ",P("dash.unarchive")]}):(0,U.jsx)(wp,{files:nP,allowEmpty:b,onArchive:()=>w(d)})}),(0,U.jsx)("div",{className:"flex min-h-11 items-center px-1.5",children:(0,U.jsx)(wm,{project:d,files:nP,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"):nN.length?nN.join(" \xb7 "):P("common.nothingRunning")}),(0,U.jsx)(Sn,{}),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)(sO.$T,{className:"h-3 w-3","aria-hidden":!0})," ",P("dash.unarchive")]}):(0,U.jsx)(wp,{files:nP,allowEmpty:b,onArchive:()=>w(d)}),(0,U.jsx)(wm,{project:d,files:nP,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)(g3.A,{className:"h-4 w-4","aria-hidden":!0})}):null,C?(0,U.jsx)(wP,{open:S,onToggle:C}):null,(0,U.jsxs)("button",{type:"button",onClick:e9,"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)(fL.A,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",P("tasks.panelTitle"),tY.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:tY.filter(e=>"done"!==e.status).length}):null]}),(0,U.jsxs)("button",{type:"button",onClick:()=>eq(!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")]})]})]}),eL?(0,U.jsx)(wL,{repoDir:e3,onClose:()=>eq(!1),onCreate:nr,onCreated:e=>{eq(!1),eH(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&&nC.length?(0,U.jsx)("div",{className:"shrink-0 border-b border-border bg-sunken",children:nC.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)(wr,{file:e})},e.path))}):null,$?(0,U.jsx)(U.Fragment,{children:z?"scheme"===nH&&nO?(0,U.jsx)(k1,{project:d,projectName:E,groups:nT?nA:nE,manual:nT?t2:[],files:e,flows:R,reviewGroups:tn,pipelines:O,surfacePipelines:nI,workerStacks:nq,tasks:nT?t0:[],sheetTasks:tY,drafts:nT?nM:[],favorites:G,isolatedManualPaths:nD,loaded:u,focus:eU,onSelect:nx,onClose:nc,onDraftClose:na,onDraftSpawned:nl,onConversationOpened:el,onActiveChange:ef,taskSheetNonce:eC,trayApi:nb}):(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)(kf,{project:d,projectName:E,files:e,onOpenConversation:nv}),(0,U.jsx)("span",{"aria-hidden":!0,className:"min-w-0 flex-1"})]}),nz?(0,U.jsx)(wf,{project:d,enabled:u&&"list"===nH,onOpen:nv}):(0,U.jsx)(Sd,{projectName:E})]}):p>0?(0,U.jsx)(xl,{failures:p,className:"mt-[12vh]"}):(0,U.jsx)(N2,{})}):(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&&nU?(0,U.jsx)(So,{value:nH,onChange:ne,floating:!0}):null,z?"scheme"===nH&&nO?(0,U.jsx)(N1,{project:d,groups:nT?nA:nE,manual:nT?t2:[],files:e,flows:R,reviewGroups:tn,pipelines:O,surfacePipelines:nI,now:e5,tasks:nT?t0:[],allTasks:tY,workerStacks:nq,drafts:nT?nM:[],favorites:G,isolatedManualPaths:nD,focus:eU,attentionPaths:x,trayApi:nb,onSelect:nx,onClose:nc,onDraftClose:na,onDraftSpawned:nl,onHandoff:ni,onSpawnRetry:ns,onTaskDraft:e=>{A?.();let t=nt();wS(t,"text",e.text),wA(t,e6),t9([...eo,t]),L.current="draft::"+t},onOpenTask:t8,onConversationOpened:el,placeTaskId:e$?.id??null,onTaskPlaced:()=>eE(null),newTaskNonce:ev,onTaskCollapse:e=>tJ(e.id,!1),builderPipelineId:ez,onBuilderOpened:()=>eH(null)}):nz?(0,U.jsx)(wf,{project:d,enabled:u&&"list"===nH,onOpen:nv}):(0,U.jsx)(Sd,{projectName:E,onOrchestrator:C,onAgent:nn,agentDisabled:!u}):p>0?(0,U.jsx)(xl,{failures:p,className:"mt-[12vh]"}):(0,U.jsx)(N2,{}),(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:nn,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?.(),ew(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:()=>eq(!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)(yJ,{tasks:a,project:d,favorites:er,onOpenFavorite:nx,onToggleFavorite:e=>q.setFavorite(e,!1),onOpenTask:t8,onPlaceOnMap:t7,onClose:e9}):null]}),!$&&z?(0,U.jsx)(St,{files:e,flows:ta,project:d,loaded:u,catalogFailures:p,onOpenFile:nx,onOpenCatalogFile:nv}):null,z&&(()=>{let t=nq.reduce((e,t)=>e+t.items.length,0)+tR.length+tY.length,n=nR?0:tU.length,r=e=>$?(...t)=>{eg(!1),e(...t)}:e,i=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(yC,{tasks:tY,files:e,pipelines:O,flows:ta,conversationAliases:s,repository:l.find(e=>e.project===d)?.repository??null,onOpenTask:r(t8),onPlaceOnMap:$?void 0:t7,onOpenFile:r(nx)}),(0,U.jsx)(yp,{items:tR,onRetry:r(ns)}),(0,U.jsx)(yI,{stacks:nq,files:e,flows:ta,pipelines:O,onSelect:r(nx),onExpandGroup:r(nw)}),!nR&&tU.length?(0,U.jsx)(Sr,{items:tU,activeRootPaths:tH,onSelect:r(nx)}):null]});if(!$)return i;let a=nK?(0,U.jsx)(k8,{file:nK,onHandoff:()=>{eg(!1),ni(nK)},inline:!0}):null;return(0,U.jsx)(yM,{open:ex,onClose:()=>eg(!1),total:t+n,leading:a,children:i})})(),(0,U.jsx)(oZ,{})]})})});var Sm=n(1463);function Sf(){let{enabled:e,store:t}=lf(),n=!ib()&&(void 0!==Sm?Sm.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 Sh(){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)(s_,{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 Sx="llvProject";function Sg(){return G(location.hash)}function Sb(e){return""===e||/^#(?:c|f|p|a)=./.test(e)}function Sv(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 Sw(e){return e!==ew?"#p="+encodeURIComponent(e):location.pathname}function Sy(){var e;let t,n,{t:r}=(0,eh.Ym)();!function(){try{window.sessionStorage.removeItem(ab),window.localStorage.removeItem(ab)}catch{}let e=window.location.hash.startsWith("#")?window.location.hash.slice(1):window.location.hash;if(!e.includes(ag))return;let t=new URLSearchParams(e);if(!t.has(ag))return;t.delete(ag);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:iA(),deviceId:iI(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=iN(iv,iw,{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=iM(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 iT(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=iM(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)}});iS.reportIdentity({viewSessionId:s.viewSessionId,deviceId:s.deviceId});let o=()=>l.setView(iN(iS.getContext(),iS.getSlice(),{width:window.innerWidth||1,height:window.innerHeight||1,dpr:window.devicePixelRatio||1})),c=iS.subscribe(o),d=()=>l.markInteraction();for(let e of iP)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(iS.reportIdentity(null),c(),iP))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)(Sv,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)(()=>rT.readScope(e)),r=rC(void 0,e);return(0,Y.useEffect)(()=>{let t=!0,r=rT.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 rT.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(e2,m),window.addEventListener(nI,m),window.addEventListener(nW,m),window.addEventListener(n$,m),window.addEventListener(nT,m),window.addEventListener(nJ,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(ry()&&1){let e=rj(),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(e2,m),window.removeEventListener(nI,m),window.removeEventListener(nW,m),window.removeEventListener(n$,m),window.removeEventListener(nT,m),window.removeEventListener(nJ,m)}},[e]),t.requestScope===r?t:rT.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(rO={loaded:!0,ids:new Set(d.flatMap(e=>e.conversationId?[e.conversationId]:[]))},rD))e(rO)},[d]);let O=(t=(0,Y.useSyncExternalStore)(e6,()=>e4,()=>e8),(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=tz();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=()=>{ns.warm(Object.keys(tK).flatMap(e=>{let t;return t=tK[e],(t.variants?.length?t.variants:[t.file]).map(e=>`${tB}/${e}`)})),nd=0,nb()},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=tL(t),r=t.pendingQuestion||t.waitingInput?"question":nj[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=tG[e.kind];ng({cue:n,eventId:`lifecycle:${n}:${e.id}:${r.get(e.id)??0}`,pan:tF(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(nS),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=>nN(e,t)));n.size===e.size&&[...n].every(t=>e.has(t))||(i.current=n,r(n),nC(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),nC(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,nC(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,nC(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=ib(),[H,J]=(0,Y.useState)(!1),[X,et]=(0,Y.useState)(!1),[ei,ea]=(0,Y.useState)(ew);ei!==i&&(ea(i),et((xt(xe(i))??xt(h9))==="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=Sg();(e.filePath||e.conversationId)&&l(e);let t=e.project??localStorage.getItem(Sx);t&&a(t),Sb(location.hash)||eE(!0)},[]),(0,Y.useEffect)(()=>{let e=nN(i,m);e!==i&&(a(e),localStorage.setItem(Sx,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,Sw(e)))},[i,m]),(0,Y.useEffect)(()=>{let e=()=>{if(eL.current.swallows(location.hash))return;eP(!1);let e=Sg();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)),Sb(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(Sx,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(Sx,e),J(!1)},[]),eF=(0,Y.useCallback)(e=>{e_(e),ed(Sw(e))},[e_]),eq=(0,Y.useCallback)(()=>{et(e=>{let t=!e;try{window.localStorage.setItem(xe(i),t?"1":"0")}catch{}return t})},[i]);(0,Y.useEffect)(()=>{i===ew&&(iS.reportContext(iv),iS.reportSlice(iw))},[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 eY=(0,Y.useCallback)(e=>{let t=eM(e);is(t,e.path,eA(e)),e_(t),ec(e,t),ek(e=>e+1)},[e_]),eW=(0,Y.useCallback)((e,t=!1)=>{let n=eM(e);eP(!1),is(n,e.path,eA(e)),c({kind:t?"resolve":"open",path:e.path,conversationId:e.conversationId}),a(n),localStorage.setItem(Sx,n),J(!1),ek(e=>e+1),eN(t=>({path:e.path,nonce:(t?.nonce??0)+1,catalog:!0})),ec(e,n,{restore:t})},[]),eV=(0,Y.useCallback)(e=>{eW(e),l(G(Q(e)))},[eW]),eJ=(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&&(eW(e,!0),l(null))},[s,d,k,j,eW]),(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 eG=(0,Y.useCallback)(e=>{c({kind:"release",path:e}),eN(t=>t?.path===e?null:t),o?.path===e&&ed(Sw(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[eQ,eX]=(0,Y.useState)(()=>Date.now()/1e3),eZ=(0,Y.useMemo)(()=>(function(e,t=Date.now()/1e3){let n=[];for(let r of e){let e=eB(r,t);if(null===e)continue;let i=eU(r,t),a=i||r.pendingQuestion||r.rateLimit||r.waitingInput?"blocked":"stalled",s=i?eH(i.at):null,l=null!==s?s:r.pendingQuestion?eH(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:a,since:l})}return n.sort((e,t)=>ez[e.tier]-ez[t.tier]||e.since-t.since||e.id.localeCompare(t.id))})($,eQ),[$,eQ]);(0,Y.useEffect)(()=>{let e=(function(e){let t=[];for(let n of e){"stalled"===n.activity&&t.push(n.mtime+7200);let e=n.bridgeAsk?eH(n.bridgeAsk.at):null;null!==e&&t.push(e+7200)}return t})($).filter(e=>e>eQ);if(!e.length)return;let t=Math.max(0,(Math.min(...e)-Date.now()/1e3)*1e3)+500,n=window.setTimeout(()=>eX(Date.now()/1e3),t);return()=>window.clearTimeout(n)},[$,eQ]);let[e0,e1]=(0,Y.useState)(!1),e5=(0,Y.useRef)(null),e3=ih(i===ew?null:i),e7=(0,Y.useMemo)(()=>i===ew?[]:dX($,e3.prefs.favorites).filter(e=>e.project===i),[$,e3.prefs.favorites,i]);(0,Y.useEffect)(()=>{document.title=eZ.length?`(${eZ.length}) Agent Log Viewer`:"Agent Log Viewer"},[eZ.length]),(0,Y.useEffect)(()=>{if(!e0)return;let e=e=>{e5.current?.contains(e.target)||e1(!1)},t=e=>{"Escape"===e.key&&e1(!1)};return window.addEventListener("pointerdown",e),window.addEventListener("keydown",t),()=>{window.removeEventListener("pointerdown",e),window.removeEventListener("keydown",t)}},[e0]);let[e9,te]=(0,Y.useState)(!1);(0,Y.useEffect)(()=>{z&&te(!1)},[z]),(0,Y.useEffect)(()=>{eZ.length||(e1(!1),te(!1))},[eZ.length]);let tt=(0,Y.useCallback)(()=>l(null),[]),tn=(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}))},[]),tr=(0,Y.useCallback)(e=>{eC(t=>({path:e,nonce:(t?.nonce??0)+1}))},[]),ti=(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)(()=>iD.setShell({project:i===ew?null:i,openProject:eF,openPath:tn,placePath:tr,openPathQuiet:ti,openOverview:()=>eF(ew),openConversation:(e,t)=>{e&&e!==i&&e_(e),t&&tn(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,tn,tr,ti,e_]);let ta=(0,Y.useRef)(null),ts=(0,Y.useMemo)(()=>eZ.map(e=>e.file.path).sort().join("\n"),[eZ]),tl=(0,Y.useMemo)(()=>e9?new Set(ts.split("\n").filter(Boolean)):null,[e9,ts]),to=(0,Y.useMemo)(()=>i===ew?[]:eZ.filter(e=>e.project===i),[eZ,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=eK(ta,to,e.shiftKey?-1:1);if(!t)return;e.preventDefault(),tn(t.file.path)}else if("f"===e.key||"F"===e.key){if(!eZ.length)return;e.preventDefault(),te(e=>!e)}else"/"===e.key&&(e.preventDefault(),ep())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[z,to,eZ.length,tn,ep]);let tc=(0,Y.useCallback)(e=>{e1(!1),e.project!==i&&e_(e.project),ta.current=e.id,tn(e.file.path)},[i,e_,tn]),td=(0,Y.useCallback)(e=>{let t=eK(ta,eZ,e);t&&(t.project!==i&&e_(t.project),tn(t.file.path))},[eZ,i,e_,tn]),tu=(0,Y.useCallback)(e=>{e1(!1),e.project!==i&&e_(e.project),tn(e.file.path)},[i,e_,tn]);(0,Y.useEffect)(()=>{let e=$.map(e=>({file:e,id:e.pendingQuestion||e.rateLimit||e.waitingInput?eB(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 tp=ex?$.find(e=>e.path===ex):null,tm=(0,U.jsxs)("div",{ref:e5,className:"pointer-events-auto relative",children:[(0,U.jsx)(af,{count:eZ.length,mobile:z,queueOpen:e0,filterActive:e9,onToggleQueue:()=>e1(e=>!e),onNext:td,onToggleFilter:()=>te(e=>!e)}),e0?(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:[e7.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")]}),e7.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,tP.cr)(e.file.title,60)}),onClick:()=>tu(e),children:[(0,U.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${(0,tP.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,tP.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")}),eZ.map(e=>(0,U.jsx)(ah,{item:e,onOpen:()=>tc(e)},e.id))]}):null]}),tf=(0,U.jsxs)("div",{className:"flex h-full",children:[z?null:(0,U.jsx)(gz,{files:$,projectCatalog:T,projectDisplayNames:P,pipelines:b,workflows:w,archivedProjects:D,crownedProjects:C,selected:i,now:eQ,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)(gz,{files:$,projectCatalog:T,projectDisplayNames:P,pipelines:b,workflows:w,archivedProjects:D,crownedProjects:C,selected:i,now:eQ,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)(xr,{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:[tm,tp?(0,U.jsx)(ax,{file:tp,mobile:!1,onOpen:()=>{eY(tp),eg(null)},onDismiss:()=>eg(null)}):null]}),z&&tp?(0,U.jsx)(ax,{file:tp,mobile:!0,onOpen:()=>{eY(tp),eg(null)},onDismiss:()=>eg(null)}):null,i===ew?(0,U.jsx)(gK,{files:$,projectCatalog:T,projectDisplayNames:P,pipelines:b,workflows:w,archivedProjects:D,now:eQ,catalogFailures:S,onSelectProject:eF,onSelectFile:eY,onMenu:z?()=>J(!0):void 0,onOpenSearch:ep,attention:z?tm:void 0}):(0,U.jsx)(Sp,{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:tl,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?tm:void 0,orchestratorPanelOpen:X,onToggleOrchestratorPanel:z?void 0:eq,onUserNavigate:tt,onOpenCatalogFile:eV,onCloseFile:eG})]}),z?null:(0,U.jsx)(dQ,{}),(0,U.jsx)(Sf,{}),(0,U.jsx)(aa,{mobile:z}),eo?(0,U.jsx)(g1,{mobile:z,onClose:em,onOpen:eJ}):null,(0,U.jsx)(aQ,{mobile:z}),(0,U.jsx)(dU,{mobile:z}),(0,U.jsx)(sR,{}),(0,U.jsx)(dH,{}),(0,U.jsx)(Sh,{}),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)(d4,{children:tf})}},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??""}
|
|
84
|
+
${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}
|
|
85
|
+
${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:()=>eN,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"codex"===e?"codex":"openclaw"===e?"openclaw":"claude"}function F(e){return e&&"object"==typeof e&&!Array.isArray(e)?e:{}}function q(e){return Array.isArray(e)?e.filter(e=>e&&"object"==typeof e&&!Array.isArray(e)):[]}function z(e){try{let t=JSON.parse(e);return t&&"object"==typeof t&&!Array.isArray(t)?t:null}catch{return null}}function H(e){let t=F(e),n=L(t.server),r=L(t.tool);return n&&r&&(0,w.I)(n)?{serverName:n,toolName:r,args:F(t.arguments),result:null}:null}function U(e){return"string"==typeof e?e.trim().length>0:"number"==typeof e||"boolean"==typeof e||(Array.isArray(e)?e.some(U):null!==e&&"object"==typeof e&&Object.values(e).some(U))}function B(e){let t=e.trim().replace(/[_-]/g," ");return t?`Attachment: ${t.slice(0,80)}${t.length>80?"…":""}`:"Attachment"}function K(e){let{images:t}=R(e);return t.map(e=>({kind:"inbox-image",...e}))}function Y(e){let t=[],n=[];for(let r of q(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(F(r.image_url).path)||L(F(r.source).path),i=t?K(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(F(r.image_url).url)||L(r.data));a?n.push(a):U(r)&&n.push({kind:"note",text:B(e)});continue}if("local-image"===e||"local_image"===e||"localImage"===e){let t=K(L(r.path)||L(r.local_path)||L(r.image_url)||L(r.url));t.length?n.push(...t):U(r)&&n.push({kind:"note",text:B(e)});continue}("input_text"!==e&&"text"!==e&&"output_text"!==e||!i)&&!i&&U(r)&&n.push({kind:"note",text:B(e)})}return{...v(t.join(" ").trim()),attachments:n}}function W(e){return"string"==typeof e?et(e):Array.isArray(e)?e.map(e=>{if("string"==typeof e)return et(e);if("number"==typeof e||"boolean"==typeof e)return String(e);if(!e||"object"!=typeof e||Array.isArray(e))return"";let t=F(e),n=L(t.text)||L(t.input_text)||L(t.output_text);if(n)return et(n);if("input_image"===t.type||"image"===t.type)return`[${C("render.imageOutput")}]`;let r=et(L(t.type)).slice(0,80);return`[${r?C("render.toolOutputType",{type:r}):C("render.toolOutput")}]`}).filter(Boolean).join("\n"):null==e?"":et(JSON.stringify(e))}function V(e){let t=e=>e.match(eo)?.[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=F(n),r=t(L(e.text)||L(e.input_text)||L(e.output_text));if(void 0!==r)return r}}function J(e){return/^Script failed\b/im.test(e)||/\b(?:exit|exited with) code [1-9]\d*\b/i.test(e)}let G=/(?:api.?key|access.?token|refresh.?token|authorization|bearer|secret|password|passwd|pwd|token)/i,Q=/(?:api|token|authorization|bearer|secret|password|passwd|pwd)/i,X=/("(?:api[_-]?key|access[_-]?token|refresh[_-]?token|authorization|bearer|secret|password|passwd|pwd|token)"\s*:\s*")[^"]*/gi,Z=/((?:api[_-]?key|access[_-]?token|refresh[_-]?token|authorization|bearer|secret|password|passwd|pwd|token)\s*[:=]\s*["']?)[^\s"',}]+/gi,ee=/(\bbearer\s+)[^\s"',}]+/gi;function et(e){let t=e.replace(ee,"$1[redacted]");return(0,r.fp)(t).replace(X,"$1[redacted]").replace(Z,"$1[redacted]")}function en(e){let t=24e3,n=(e,r,i)=>{if(G.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=et(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 F(n(e,"",0))}function er(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 ei=/^[ \t]*(?:\[stderr\]|-{2,}\s*stderr\s*-{2,}|stderr:)[ \t]*$/im,ea=/^(?: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)/,es=/\.([A-Za-z0-9]{1,10})$/;function el(e){return e.match(es)?.[1]?.toLowerCase()??null}let eo=/\brunning with (?:cell|session) ID\s+(\S+)/i;function ec(e){return"tool"===e.kind&&!e.wakeup&&!e.mcp}let ed={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"},eu=new Set(["text","image","generatedImage","store","notify"]),ep=/\btools\.([A-Za-z_]\w*)\s*\(/g,em=/(?:^|[^.\w])(text|image|generatedImage|store|notify)\s*\(/g;function ef(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 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 e.slice(r+1,ef(e,r))}return""}function ex(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 ey(e.slice(r+1,ef(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 eg(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 eb(e){for(let t=0;t<e.length;t+=1){let n=e[t];if('"'===n||"'"===n||"`"===n)return e.slice(t+1,ef(e,t))}return""}function ev(e){return/^\s*\{/.test(e)?"":eb(e)}function ew(e,t,n){for(let r of n){let n=eh(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,ef(t,l))}return""}function ey(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 ek(e){let t=e.match(/\*\*\* Begin Patch[\s\S]*?\*\*\* End Patch/g);return t?t.map(ey).join("\n"):""}function ej(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 eN(e){let{showSvc:t,lineFilter:n}=e,u="claude"===e.fmt||"codex"===e.fmt||"openclaw"===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,U=0,B=null,K=-1/0,X=null,Z=[],ee=null,es=null,ey=[],eN=null,eS=null,eC=[],eA=new Map,eI=null,eM=null,eT=e=>p.length?e-p[0].seq:-1,eP=e=>(p.push({seq:E,bornSrc:U,src:U,item:e}),eI=null,E++),e$=(e,t)=>!!(!(e.length<=2e4)&&(e.match(/\s/g)?.length??0)/e.length<.02)&&(eP({kind:"blob",bytes:e.length,text:(0,r.fp)(e).slice(0,2e5),...t?{sourceId:t}:{}}),!0),eE=(e,t)=>{let n=F(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=F(t.dimensions);eP({kind:"image",media:a,data:r,w:P(s.originalWidth),h:P(s.originalHeight),bytes:P(t.originalSize)})},eR=(e,t,n,i=eP,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(er(n,e[1]??"",e[2]??"")),o=!0,c=r+n.length}return d(t.slice(c)),o},eO=e=>{let t=[];return T.lastIndex=0,{cleaned:e.replace(T,(e,n,r)=>(t.push(er(e,n,r)),"")).trim(),cites:t}},eD=(t,n,r)=>{if(!n.trim())return null;let i=E;if(e$(n,r))return{firstSeq:i,lastSeq:E-1};let a=_(e.engine);return eR(t,n,e=>eP({kind:"prose",ts:t,text:e,engine:a,...r?{sourceId:r}:{}}),eP,r)||eP({kind:"prose",ts:t,text:n,engine:a,...r?{sourceId:r}:{}}),{firstSeq:i,lastSeq:E-1}},eL=(e,t,n,r)=>{let i=n.trim(),a=X;if(a&&a.shape!==e&&a.src===U-1&&a.text===i&&ej(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=eT(e);if(t<0||t>=p.length)continue;let i=p[t],a=i.item;p[t]={...i,src:U,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}}X=null,eI=null;return}let s=eD(t,n,r);X=s?{shape:e,text:i,ts:t,src:U,firstSeq:s.firstSeq,lastSeq:s.lastSeq}:null},e_=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:U,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:en(e.mcp.args),result:e.mcp.result?en(e.mcp.result):null}}:{}},u?.owner)},eF=e=>{let t=eP(e),n={event:e,seq:t};return m.set(e.id,n),n},eq=(e,t)=>{let n={...e.event,wakeup:t};e.event=n;let r=eT(e.seq);r>=0&&r<p.length&&"tool"===p[r].item.kind&&(p[r]={...p[r],item:n},eI=null)},ez=()=>{let e=null;for(let t=eC.length-1;t>=0;t-=1){let n=eC[t].event.wakeup;if(n&&!n.failed){e=eC[t].seq;break}}for(let t of eC){let n=t.event.wakeup;if(!n)continue;let r=!n.failed&&t.seq!==e;n.superseded!==r&&eq(t,{...n,superseded:r})}},eH=e=>({...e,reason:(0,r.fp)(e.reason).slice(0,300),prompt:(0,r.fp)(e.prompt).slice(0,4e3)}),eU=(e,t,n)=>{let r="string"==typeof e||"number"==typeof e?Date.parse(String(e)):NaN,i=eH((0,y.It)(n,Number.isFinite(r)?r:null)),a=eF(e_({ts:e,id:t,tool:"ScheduleWakeup",args:n,engine:"claude",wakeup:{...i,superseded:!1,failed:!1}}));return eC.push(a),ez(),a},eB=(t,n,r,i="Bash",a)=>{let s=r||"plain-"+E+"-"+String(t??""),l=_(e.engine),o=e_({ts:t,id:s,tool:i,args:{...a,command:n},engine:l,command:n}),c=eF(o);return r||(eS=c),o},eK=(e,t,n)=>{let r=n||"plain-"+E+"-"+String(e??""),i=e_({ts:e,id:r,tool:"apply_patch",args:{input:t},engine:"codex",diff:(0,N.ag)(t)});return eF(i),i},eY=(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(ep.lastIndex=0;(n=ep.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=ef(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=ed[r]??r,l=function(e,t,n){if("write_stdin"===e)return{session_id:ex(t,["session_id"]),cell_id:ex(t,["cell_id"]),chars:ex(t,["chars"])};if("wait"===e)return{cell_id:ex(t,["cell_id"]),session_id:ex(t,["session_id"])};switch((0,S.Ap)(e)){case"shell":return{command:ew(t,n,["cmd","command"])||ev(t)};case"read":case"write":return{file_path:ew(t,n,["path","file_path","filePath"])||ev(t)};case"search":return{pattern:ew(t,n,["pattern","query","regex","q"])||ev(t),path:eh(t,["path","glob","include"])};case"web":return{url:ew(t,n,["url"])||ev(t)};case"edit":return{input:ek(n)};default:return{value:eh(t,["cmd","path","url","query","pattern","goal","step","title","name"])||eb(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=eg(a,["session_id","cell_id"]),n="wait"===s||eg(a,["chars"]);e&&n&&(t={tool:s,args:l})}}for(em.lastIndex=0;(n=em.exec(e))&&i.length<16;){let e=n[1];eu.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=ek(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=ef(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=e_({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 eF(c),c},eW=(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&&ea.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(ei):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(eo)?.[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=z(d),L=m.mcp?{...m.mcp,result:D?en(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={...eH((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:U,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=eT(e.seq);return F>=0&&F<p.length&&"tool"===p[F].item.kind&&(p[F]={...p[F],item:_},eI=null),O&&O.failed&&ez(),_},eV=(e,n,i,a)=>{if(!e)return;let s=x.get(e);if(void 0!==s){let e=eT(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}},eI=null}}return}!eW(m.get(e),n,i,a)&&n&&t&&eP({kind:"svc",text:"output: "+(0,r.fp)(n).slice(0,200)})},eJ=e=>{t?eP({kind:"svc",text:e.slice(0,300)}):(I+=1,b.set(U,(b.get(U)??0)+1),eI=null)},eG=e=>{eP({kind:"note",text:e})},eQ=(e,t,n)=>{let i,a,s,l=(i=!1,a=JSON.stringify(n,(e,t)=>{if(G.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=Q.test(t)?et(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});eP({kind:"record",ts:e,recordType:et(t).slice(0,80)||C("render.record"),...l})},eX=(e,t,n=!1,i)=>{if(n)return void eZ(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 eP({kind:"tnote",text:C("render.left",{peer:s,at:t?" \xb7 "+t:""})}),""}}catch{}let{cleaned:c,cites:d}=eO(o),u=r.HU.test(c)?(0,r.wV)(c,e):null;for(let t of(eP({kind:"tmsg",ts:e,dir:"in",peer:s,summary:l,text:u?"":c}),u&&eP(u),d))eP(t);return""}).replace(/Another Claude session sent a message:\s*/g,"").trim();if(!a||e$(a))return;let{cleaned:s,images:l}=R(a);for(let t of(s&&!eR(e,s,t=>eP({kind:"user",ts:e,text:t}))&&eP({kind:"user",ts:e,text:s}),l))eP({kind:"inbox-image",name:t.name,path:t.path})},eZ=(e,t,n)=>{eP({kind:"sysmsg",label:O(e,t),text:e,...n?{deliveredMessage:n}:{}})},e0=(e,t,n)=>({kind:"tmsg",ts:e,dir:"in",peer:n.role??C("render.agentPeer"),summary:"",text:t,internal:!0}),e1=(e,t)=>{let n=[],r=e=>n.push(eP(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(e0(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:U,ts:e,text:t.text,entrySeqs:n,structured:t.structured}},e2=()=>{let e=Z;for(let n of(Z=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=eT(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}},eI=null,e=!0;break}}if(!e&&n.text){let e=U;U=n.src,eZ(n.text),U=e}}},e5=(e,t)=>{eP({kind:"compact",ts:e,trigger:t?.trigger,preTokens:t?.preTokens})},e4=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)})},e3=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=F(e.message).content,r=F(F(e.toolUseResult).file);if(!0===e.isCompactSummary){let e="string"==typeof n?n:q(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}},eI=null;return}if("svc"!==n.kind&&"note"!==n.kind)break}eP({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)eX(t,n,u,m);else for(let e of q(n))if("text"===e.type)eX(t,L(e.text),u,m);else if("image"===e.type)eE(e,r);else if("tool_result"===e.type){let t=q(e.content);for(let e of t)"image"===e.type&&eE(e,r);let n="string"==typeof e.content?e.content:t.filter(e=>"image"!==e.type).map(e=>L(e.text)).join(" ");eV(L(e.tool_use_id),n,!0===e.is_error)}return}if("assistant"===e.type&&e.message){for(let n of q(F(e.message).content))if("text"===n.type&&L(n.text).trim())eD(t,L(n.text),L(e.uuid)||void 0);else if("thinking"===n.type&&L(n.thinking).trim())eP({kind:"think",text:L(n.thinking).replace(/\s+/g," ").trim()});else if("tool_use"===n.type&&"SendMessage"===L(n.name)){let e=F(n.input),i=e.message;if("string"==typeof i){let{cleaned:a,cites:s}=eO(i),l=r.HU.test(a)?(0,r.wV)(a,t):null,o=eP({kind:"tmsg",ts:t,dir:"out",peer:String(e.to??""),summary:String(e.summary??""),text:l?"":a});for(let e of(l&&eP(l),s))eP(e);let c=L(n.id);c&&(x.set(c,o),g.set(o,c))}else eJ(`SendMessage → ${String(e.to??"")} \xb7 ${L(F(i).type)||C("render.protocol")}`)}else if("tool_use"===n.type){let e=L(n.name)||"tool",r=F(n.input),i=L(n.id)||"plain-"+E+"-"+String(t??"");if("ScheduleWakeup"===e)eU(t,i,r);else{let n="shell"===(0,S.Ap)(e)?L(r.command):void 0,a="read"===(0,S.Ap)(e)?el(L(r.file_path)):void 0,s=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),l=s?{...s,args:r,result:null}:void 0;eF(e_({ts:t,id:i,tool:e,args:r,engine:"claude",command:n,lang:a,mcp:l}))}}return}if("system"===e.type&&"compact_boundary"===e.subtype){let n=F(e.compactMetadata);return e5(t,{trigger:L(n.trigger)||void 0,preTokens:P(n.preTokens)})}eJ(L(e.type)||C("render.record"))})(n):"openclaw"===e.fmt?(e=>{let t=e.timestamp;if("message"!==e.type)return"model_change"===e.type?eJ([L(e.provider),L(e.modelId)].filter(Boolean).join(" \xb7 ")||"model_change"):"thinking_level_change"===e.type?eJ(`thinking \xb7 ${L(e.thinkingLevel)||C("render.record")}`):"custom"===e.type?eJ(L(e.customType)||"custom"):eJ(L(e.type)||C("render.record"));let n=F(e.message),r=n.content,i=L(n.role);if("user"===i){if("string"==typeof r)return eX(t,r);for(let e of q(r))"text"===e.type&&eX(t,L(e.text));return}if("toolResult"===i){let e=L(n.toolCallId),t=!0===n.isError;return eV(e,q(r).map(e=>"toolResult"===e.type&&L(e.content)||L(e.text)).filter(Boolean).join("\n"),t)}if("assistant"!==i)return eJ(i||C("render.record"));if("openclaw"!==L(n.provider)){let e=`${L(n.provider)} \xb7 ${L(n.model)}`;e!==es?.pair&&(null!==es&&(ey.push(es.src),eJ(e)),es={pair:e,src:U})}let a=L(e.id)||void 0;for(let e of q(r))if("text"===e.type&&L(e.text).trim())eD(t,L(e.text),a);else if("thinking"===e.type&&L(e.thinking).trim())eP({kind:"think",text:L(e.thinking).replace(/\s+/g," ").trim()});else if("toolCall"===e.type){let n=L(e.name)||"tool",r=F(e.arguments??e.input),i=L(e.id)||"plain-"+E+"-"+String(t??""),a="shell"===(0,S.Ap)(n)?L(r.command??r.cmd):void 0,s="read"===(0,S.Ap)(n)?el(L(r.file_path??r.path)):void 0;eF(e_({ts:t,id:i,tool:n,args:r,engine:"openclaw",command:a,lang:s}))}})(n):(e=>{let t=F(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=Z.findIndex(t=>ej(t.ts,t.text,e,n.text));if(r<0)return e1(e,{...n,attachments:[]});let[i]=Z.splice(r,1);if(!i)return;let{cleaned:a,images:s}=R(n.text);if(a){let t=n.origin?.kind==="agent",r=t?e0(e,a,n.origin):{kind:"user",ts:e,text:a},s=i.entrySeqs.find(e=>{let n=eT(e),r=n>=0?p[n]?.item.kind:void 0;return t?"tmsg"===r:"user"===r});if(void 0!==s){let e=eT(s);p[e]={...p[e],item:r}}else i.entrySeqs.push(eP(r))}for(let e of s)i.entrySeqs.push(eP({kind:"inbox-image",name:e.name,path:e.path}));var l=U;for(let e of i.entrySeqs){let t=eT(e);t>=0&&t<p.length&&(p[t]={...p[t],src:l})}i.src=l,eI=null})(n,L(t.message));if(e2(),"agent_message"===t.type&&t.message)return eL("event-agent",n,L(t.message));if("task_started"===t.type)return eG(C("render.taskStarted")+(n?" \xb7 "+(0,k.T0)(n):""));if("task_complete"===t.type)return eG(C("render.taskComplete")+(n?" \xb7 "+(0,k.T0)(n):""));if("context_compacted"===t.type)return ee?ee=null:e5(n);if("mcp_tool_call_begin"===t.type){let e=H(t.invocation);if(!e)return eJ("mcp_tool_call_begin");let r=L(t.call_id)||"plain-"+E+"-"+String(n??"");return eF(e_({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=H(t.invocation)??l?.event.mcp??null;if(!o)return eJ("mcp_tool_call_end");let c=(e=F(t.result),r=F(e.Ok),i=void 0!==e.Err||!0===r.isError,{output:a=q(r.content).map(e=>L(e.text)).filter(Boolean).join("\n")||(void 0===e.Err?"":JSON.stringify(e.Err)),result:z(a),error:i}),d=l??eF(e_({ts:n,id:s,tool:`mcp__${o.serverName}__${o.toolName}`,args:o.args,engine:"codex",mcp:o}));if(eW(d,c.output,c.error),d.event.mcp&&c.result){let e={...d.event,mcp:{...d.event.mcp,result:en(c.result)}};d.event=e;let t=eT(d.seq);t>=0&&p[t]?.item.kind==="tool"&&(p[t]={...p[t],item:e}),eI=null}return}return["patch_apply_end","sub_agent_activity","thread_settings_applied","token_count","turn_aborted","web_search_end"].includes(L(t.type))?eJ(L(t.type)):eQ(n,L(t.type)||"event",t)}if("response_item"===e.type){if("message"===t.type){if("user"===t.role){let e;return(e=e1(n,Y(t.content))).entrySeqs.length||e.text||eJ("message user"),Z.push(e)}e2();let e=Y(t.content).text;return e?"assistant"===t.role?eL("response-assistant",n,e,L(t.id)||void 0):eZ(e,L(t.role)):eJ("message "+L(t.role))}if(e2(),"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?eB(n,String(e.cmd??e.command??"").replace(/^\/usr\/bin\/zsh -lc /,""),L(t.call_id),r,e):"apply_patch"===r?eK(n,String(e.input??""),L(t.call_id)):"exec"===r||"functions.exec"===r?eY(n,r,L(e.input),L(t.call_id)):eF(e_({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=V(t.output),n=W(t.output);return eV(L(t.call_id),n,J(n),e)}if("custom_tool_call"===t.type&&"apply_patch"===L(t.name))return eK(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 eY(n,e,r,L(t.call_id)||L(t.id))}if("custom_tool_call_output"===t.type){let e=V(t.output),n=W(t.output);return eV(L(t.call_id),n,J(n),e)}return"reasoning"===t.type||"agent_message"===t.type?eJ(L(t.type)):eQ(n,L(t.type)||"item",t)}return(e2(),"session_meta"===e.type)?eG(`${C("render.codexSessionCreated")} \xb7 ${L(t.model)} \xb7 ${L(t.cwd)}`):"compacted"===e.type?(ee={src:U},e5(n)):"turn_context"===e.type||"world_state"===e.type||"inter_agent_communication_metadata"===e.type?eJ(L(e.type)):eQ(n,L(e.type)||C("render.record"),e)})(n):eQ(null,"malformed_record",{value:n})}catch{eQ(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(eN)if(/^\[codex\]/.test(t))(()=>{if(!eN)return;let e=eN.lines.join("\n").trim();if(eN=null,!e)return;let t=e4(eP);eR(null,e,t)||t(e)})();else{eN.lines.push(t),eI=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>"))){eN={lines:[t],src:U},eI=null;return}if(/^Running command: /.test(a))return eB(i,a.replace(/^Running command: /,"").replace(/^\/usr\/bin\/zsh -lc /,""));if(/^Command (completed|failed)/.test(a)){eS&&eW(eS,a,/^Command failed/.test(a));return}return/^Applying \d+ file/.test(a)?eP({...e_({ts:i,id:"plain-"+E+"-"+String(i??""),tool:"apply_patch",engine:"codex",summary:a}),status:"ok",statusLabel:"ok"}):n&&!/^(Running|Command|Applying)/.test(a)?eD(i,a):!e$(t)&&eP({kind:"raw",text:(0,r.fp)(t),err:/error|failed|traceback|exception/i.test(t)})}})(t)},e6=()=>{p.length=0,m.clear(),f.clear(),x.clear(),g.clear(),b.clear(),I=0,X=null,Z=[],ee=null,es=null,ey=[],eN=null,eS=null,eC.length=0,eA=new Map,eI=null};return{feed:(e,t,n)=>{let r=t+e.length;(null===B||r<B||t>B||t<K)&&(e6(),B=t),K=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(eI=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),eI=null}X&&X.src<e&&(X=null),Z=Z.filter(t=>t.src>=e),ee&&ee.src<e&&(ee=null),es&&es.src<e&&(es=null);let n=ey.some(t=>t<e);ey=ey.filter(t=>t>=e),eS&&0>eT(eS.seq)&&(eS=null);let r=!1;for(let e=eC.length-1;e>=0;e-=1)0>eT(eC[e].seq)&&(eC.splice(e,1),r=!0);return r&&ez(),t||n||null!==eN&&eN.src<e})(t)&&(e6(),B=t);for(let n=B-t;n<e.length;n+=1)U=t+n,e3(e[n]);return B=r,eI&&eM===n||(eI=(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(!ec(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(ec(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=eA.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 eA=n,(()=>{if(!eN)return[];let e=eN.lines.join("\n").trim();if(!e)return[];let t=[],n=e=>t.push(e),r=e4(n);return eR(null,e,r,n)||r(e),t})().forEach((e,n)=>t.push({anchorKey:null,key:"pb"+n,item:e})),{items:t,hiddenServiceCount:I}})(n),eM=n),eI}}}},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":"час роботи","turn.waiting":"чекає на вашу відповідь","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.relativeRoot":"Потрібен повний шлях — оберіть теку нижче або впишіть шлях, що починається з /","rail.outsideRoots":"Цей шлях поза відомими теками проєктів — оберіть щось зі списку","rail.missingRoot":"Каталог не існує: {path}","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.emptyStartHere":"Почни звідси: Оркестратор — скажи йому, що треба зробити в {project}.","dash.emptyOneAgent":"Або запусти одного агента на одну задачу (Створити → Агент).","dash.emptyAgentCta":"Створити → Агент","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.attachmentsCount":{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.suggestedReplies":"Підказані відповіді — торкніться, щоб підставити в поле вводу","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.compactSentClaude":"/compact надіслано — позначка з'явиться у стрічці, якщо агент стисне контекст","composer.compactObserved":"контекст стиснуто","composer.failedCompact":"не вдалося запустити стискання","composer.addImages":"Додати картинки","composer.addAttachments":"Додати файли або картинки","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.compactHostUnsupported":"Viewer не має каналу стиснення до цього хоста","strip.compactClaudeMessage":"надсилає /compact у розмову; Viewer підтвердить, лише якщо з'явиться позначка стискання","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":"Viewer не має каналу для цієї команди тут","receipt.human.compactSentUnobserved":"надіслано — Viewer не зміг підтвердити завершення стискання","receipt.human.compactDeclined":"надіслано — агент завершив /compact, нічого не стиснувши","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.connector_unavailable":"Конектор Telegram був недоступний, тому нічого не прочитано.","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":"Не вдалося зберегти назву","attach.file":"файл","attach.error":"помилка вкладення","attach.refused":"{names}: {reason}","attach.imagesOnlyHere":"цей композер приймає лише картинки PNG, JPEG, GIF або WebP","attach.empty":"порожній — немає чого додавати","attach.tooLarge":"завеликий (ліміт {max} МБ)","attach.tooMany":"за один раз можна додати до {max} файлів","attach.notRestored":"не відновлено — додайте його знову, щоб надіслати","attach.aggregateTooLarge":"перевищує ліміт запиту — {max} МБ","attach.readingAria":"завантаження {name}","attach.removeAria":"Прибрати {name}","attach.retryAria":"Повторити {name}","attach.clearAllAria":"Прибрати всі вкладення","attach.blockedReading":"Зачекайте, поки вкладення завантажиться…","attach.blockedFailed":"Приберіть або повторіть невдале вкладення, щоб надіслати","img.readFailed":"не вдалося прочитати картинку","img.readAborted":"читання картинки перервано","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})","mandateCard.title":"Мандат","mandateCard.version":"v{version}","mandateCard.custom":"власний","mandateCard.lines":{one:"{count} рядок",few:"{count} рядки",many:"{count} рядків",other:"{count} рядків"},"mandateCard.sent":"надіслано при створенні місця","mandateCard.readMandate":"Читати мандат","mandateCard.handoff":"Передача при ротації","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":"немає активних сесій агентів","resources.hostsN":{one:"{count} хост",few:"{count} хости",many:"{count} хостів",other:"{count} хоста"},"resources.idleN":"{n} без роботи","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.killHostHint":"закрити цей хост разом з усім деревом процесів","resources.hostOwned":"утримується","resources.hostOwnedHint":"рантайм ще тримає цей хост і завершує його своїм життєвим циклом","resources.hostReleased":"відпущений","resources.hostReleasedHint":"рантайм відпустив цей хост — лишився тільки процес","resources.hostOrphaned":"осиротілий","resources.hostOrphanedHint":"робочої копії вже немає і власника теж — лишилося саме дерево процесів","resources.hostSeat":"місце оркестратора","resources.hostSeatTick":"включити це місце оркестратора в масове закриття","resources.hostSeatUnknown":"статус місця невідомий","resources.hostSeatUnknownHint":"реєстр не може встановити статус місця оркестратора для цього хоста; масове закриття його пропускає","resources.hostBusy":"хід триває","resources.hostUntitled":"хост без назви","resources.bulkLabel":"неактивні довше ніж","resources.bulkKill":"Убити неактивні","resources.bulkNone":"немає сесій, неактивних так довго","resources.hoursN":"{n} год","resources.killAll":"Убити всіх агентів","resources.killAllConfirm":"Підтвердити — убити {n}?","resources.killAllHint":"примусово закрити кожен хост агента зі списку, разом із активними — чистий старт, щоб наступний spawn/повідомлення пішли правильно. Твої шели, в'ювер, runtime-хост, воркери міграції акаунтів і невідмічені місця оркестратора не чіпає.","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.awaitingDecision":"оркестратор чекає на ваше рішення","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.firstRunTitle":"Проєктів поки нема","overview.firstRunBody":"Сесії з ~/.claude/projects і ~/.codex/sessions з'являються тут одразу, як тільки стартують","overview.firstRunCreate":"Створити проєкт","overview.firstRunElsewhere":"…або просто запусти claude чи codex у будь-якому репозиторії.","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.draftHintVacated":"Розмова попереднього оркестратора зникла. Створіть нового для {project}.","orchPanel.introTalk":"Ви говорите з ним як з колегою: \xabполагодь нестабільний тест у X\xbb, \xabвізьми задачі 12 і 14\xbb, \xabпереглянь PR 30\xbb.","orchPanel.introRuns":"Він відкриває лінії роботи, запускає виконавців і свіжих ревʼюерів та зливає на APPROVE.","orchPanel.introReports":"Він звітує вам тут; а деплоїть сам, якщо ви не приберете це нижче.","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.mandateSummary":"Мандат v{version} — вбудовані правила роботи (редагувати)","orchPanel.mandateSummaryCustom":"Мандат — ваші власні правила роботи (редагувати)","orchPanel.restoreDefault":"Повернути типовий","orchPanel.mandateRequired":"Мандат не може бути порожнім.","orchPanel.cwd":"Робоча тека: {cwd}","orchPanel.oneTask":"Одна задача? Запустіть одного агента й говоріть з ним напряму (Створити → Агент). Оркестратор окупається, коли кілька справ ідуть одночасно, поки вас немає.","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.bindStalled":"Досі не вдається відкрити цю розмову","orchPanel.bindStalledCatalog":"Транскрипта, записаного в місці, немає в каталозі файлів цього вигляду. Хост живий, тож розмова майже напевно триває в транскрипті, який замінив записаний.","orchPanel.bindStalledSurface":"Транскрипт видно, але рантайм ще не визначив для нього хост.","orchPanel.rebind":"Прив'язати знову","orchPanel.rebindTitle":"Знайти розмову цього місця знову за її власним id. Нічого не призначається, не ротується і не запускається.","orchPanel.rotation":"Рекомендовано ротацію","orchPanel.rotationStrong":"Наполегливо рекомендовано ротацію","orchPanel.rotationContext":"контекст на {percent}% вікна моделі","orchPanel.rotationDead":"його хост зник","orchPanel.badgeNeedsYou":"потребує тебе","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.idle":{one:"{count} у простої",few:"{count} у простої",many:"{count} у простої",other:"{count} у простої"},"workerStack.noVerdict":"без вердикту","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)","attention.decisionQuestion":"питання","attention.decisionPlan":"затвердження плану","attention.decisionPermission":"запит дозволу","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.awaitingTurnFor":"чекає, поки агент завершить хід \xb7 {waited}","runtime.receipt.awaitingTurnPos":"чекає, поки агент завершить хід \xb7 #{position} \xb7 {waited}","runtime.receipt.awaitingHostFor":"чекає на повернення вікна агента \xb7 {waited}","runtime.receipt.awaitingHandoverFor":"чекає на передачу агентові \xb7 {waited}","runtime.receipt.handingOverFor":"усе ще передає це агентові \xb7 {waited}","runtime.receipt.admissionUnconfirmed":"надсилання не підтверджено \xb7 {waited}","runtime.receipt.unconfirmed":"не доставлено — підтвердження немає вже {waited}","runtime.receipt.unconfirmedWhy":"Агент не виходив із ходу, тому це повідомлення так і не передали. Ніхто більше не повторить спробу: надішліть ще раз, якщо воно досі потрібне.","runtime.receipt.unconfirmedWhyHost":"Вікно агента зникло до того, як повідомлення передали, і розмову ніхто не перебрав. Ніхто більше не повторить спробу: надішліть ще раз, якщо воно досі потрібне.","runtime.receipt.unconfirmedWhyUnknown":"Повідомлення прийняли, але так і не передали, і тут ніхто не може сказати чому. Ніхто більше не повторить спробу: надішліть ще раз, якщо воно досі потрібне.","runtime.receipt.waitedSec":"{n} с","runtime.receipt.waitedMin":"{n} хв","runtime.receipt.waitedHour":"{n} год","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))}}if("suggest_replies"===e){let e=Array.isArray(r.replies)?r.replies:[],t=e.map(e=>a(i(e).label)).filter(Boolean);return{icon:"message",verb:"Offering",title:`Offering ${t.length||e.length} reply draft${1===(t.length||e.length)?"":"s"}`,subtitle:d(u,s(t.join(" \xb7 "))),links:l({conversationId:a(r.conversationId)||a(u.conversationId)})}}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,{QE:()=>a,St:()=>s,bF:()=>o,cr:()=>r});let i=new Set(["codex session","claude session","codex","claude"]),a="title is required for every new spawn";function s(e,t=160){var n;if("string"!=typeof e)return null;let a=e.trim(),l=r(a,t);return!a||!/[\p{L}\p{N}]/u.test(l)||"string"==typeof(n=a)&&i.has(n.toLocaleLowerCase().replace(/[\p{P}\p{S}\s]+/gu," ").trim())?null:a.length>t?a.slice(0,t-1).trimEnd()+"…":a}function l(e,t=160){let n=s(e,t);return n?r(n,t):null}function o(e,t,n="New task"){let i="string"==typeof e&&r(e,40)||"agent",a=function(e,t=60){return l(e?.split(/\r?\n/,1)[0]??"",t)}(t,60)??l(n,60)??"New task";return r(`${i} \xb7 ${a}`,120)}},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",openclaw:"#b3407a"},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();if("openclaw"===e.engine)return t;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",openclaw:"OpenClaw"})[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:()=>c,Lw:()=>r,TS:()=>d,ve:()=>o,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"]]],l=["off","minimal","low","medium","high","xhigh","max"];function o(e,t){if("claude"===e)return r.claude;if("openclaw"===e)return l;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 c(e,t,n){let r=o(e,t),i=(n??"").trim().toLowerCase();if(!r||!i)return{level:0,slots:0};let s=r.length,l=r.indexOf(i);if(l>=0)return{level:l+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 d(e,t,n){let r=o(e,t);if(!r||0===r.length)return null;let i=(n??"").trim().toLowerCase();if(r.includes(i))return i;let{level:a}=c(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,975))},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","turn.waiting":"waiting for your answer","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","rail.create":"Create","rail.creating":"Creating…","rail.invalidName":"Enter a project name","rail.invalidRoot":"Choose a directory","rail.relativeRoot":"A full path is required — choose a directory below, or type one starting with /","rail.outsideRoots":"This path is outside the known project directories — choose one from the list","rail.missingRoot":"The directory does not exist: {path}","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.emptyStartHere":"Start here: Orchestrator — tell it what you want done in {project}.","dash.emptyOneAgent":"Or spawn one agent for one task (Create → Agent).","dash.emptyAgentCta":"Create → Agent","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.attachmentsCount":{one:"{count} attachment",other:"{count} attachments"},"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.suggestedReplies":"Suggested replies — tap one to put it in the composer","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.compactSentClaude":"/compact sent — the band appears in the feed if the agent compacts","composer.compactObserved":"context compacted","composer.failedCompact":"couldn't start compaction","composer.addImages":"Add images","composer.addAttachments":"Add files or 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.compactHostUnsupported":"the Viewer has no compact channel to this host","strip.compactClaudeMessage":"sends /compact into the conversation; the Viewer confirms it only if the compaction band appears","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":"the Viewer has no channel for this control here","receipt.human.compactSentUnobserved":"sent — the Viewer couldn’t confirm the compaction finished","receipt.human.compactDeclined":"sent — the agent finished /compact without compacting","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 — attach the files again and send","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.connector_unavailable":"The Telegram connector was not available, 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","attach.file":"file","attach.error":"attachment error","attach.refused":"{names}: {reason}","attach.imagesOnlyHere":"this composer takes PNG, JPEG, GIF or WebP images only","attach.empty":"empty — there is nothing to attach","attach.tooLarge":"too large ({max} MB limit)","attach.tooMany":"up to {max} files can be attached at once","attach.notRestored":"not restored — attach it again to send it","attach.aggregateTooLarge":"over the {max} MB request limit","attach.readingAria":"loading {name}","attach.removeAria":"Remove {name}","attach.retryAria":"Retry {name}","attach.clearAllAria":"Remove all attachments","attach.blockedReading":"Waiting for the attachment to finish loading…","attach.blockedFailed":"Remove or retry the failed attachment to send","img.readFailed":"couldn't read the image","img.readAborted":"image reading aborted","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})","mandateCard.title":"Mandate","mandateCard.version":"v{version}","mandateCard.custom":"custom","mandateCard.lines":{one:"{count} line",other:"{count} lines"},"mandateCard.sent":"sent at seat creation","mandateCard.readMandate":"Read the mandate","mandateCard.handoff":"Rotation handoff","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 running","resources.hostsN":{one:"{count} host",other:"{count} hosts"},"resources.idleN":"{n} idle","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.killHostHint":"kill this host and its whole process tree","resources.hostOwned":"owned","resources.hostOwnedHint":"the runtime still holds this host and ends it through its own lifecycle","resources.hostReleased":"released","resources.hostReleasedHint":"the runtime let this host go — only the process is left to end","resources.hostOrphaned":"orphaned","resources.hostOrphanedHint":"no worktree and no owner left — nothing but the process tree remains","resources.hostSeat":"orchestrator seat","resources.hostSeatTick":"include this orchestrator seat in the bulk kills","resources.hostSeatUnknown":"seat unknown","resources.hostSeatUnknownHint":"the registry cannot establish this host's orchestrator-seat status; bulk kills leave it alone","resources.hostBusy":"mid-turn","resources.hostUntitled":"untitled host","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 host listed here, live ones included — a clean slate so the next spawn/message routes cleanly. Your shells, the viewer, the runtime host, account-migration workers and unticked orchestrator seats 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.awaitingDecision":"the orchestrator is waiting on your decision","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.firstRunTitle":"No projects yet","overview.firstRunBody":"Sessions from ~/.claude/projects and ~/.codex/sessions appear here as they happen","overview.firstRunCreate":"Create a project","overview.firstRunElsewhere":"…or run any claude / codex session inside a repo.","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.draftHintVacated":"The previous orchestrator's conversation is gone. Create a new one for {project}.","orchPanel.introTalk":"You talk to it like a colleague: \xabfix the flaky test in X\xbb, \xabtake issues 12 and 14\xbb, \xabreview PR 30\xbb.","orchPanel.introRuns":"It opens lanes, spawns implementers and fresh reviewers, and merges on APPROVE.","orchPanel.introReports":"It reports back here; it deploys on its own unless you edit that out below.","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.mandateSummary":"Mandate v{version} — built-in operating rules (edit)","orchPanel.mandateSummaryCustom":"Mandate — your own operating rules (edit)","orchPanel.restoreDefault":"Restore default","orchPanel.mandateRequired":"The mandate can't be empty.","orchPanel.cwd":"Working directory: {cwd}","orchPanel.oneTask":"One task? Spawn one agent and talk to it directly (Create → Agent). The orchestrator pays off when several things run at once while you are elsewhere.","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.bindStalled":"Still can't open this conversation","orchPanel.bindStalledCatalog":"The seat's recorded transcript isn't in this view's file catalog. Its host is alive, so the conversation is most likely running under a transcript that replaced the recorded one.","orchPanel.bindStalledSurface":"This transcript is in view, but the runtime plane hasn't resolved a host for it yet.","orchPanel.rebind":"Re-bind","orchPanel.rebindTitle":"Look this seat's conversation up again by its own id. Nothing is designated, rotated or spawned.","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.badgeNeedsYou":"needs you","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.idle":"{count} idle","workerStack.noVerdict":"no verdict","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)","attention.decisionQuestion":"a question","attention.decisionPlan":"plan approval","attention.decisionPermission":"permission prompt","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.awaitingTurnFor":"waiting for the agent to finish its turn \xb7 {waited}","runtime.receipt.awaitingTurnPos":"waiting for the agent to finish its turn \xb7 #{position} \xb7 {waited}","runtime.receipt.awaitingHostFor":"waiting for the agent’s window to come back \xb7 {waited}","runtime.receipt.awaitingHandoverFor":"waiting to be handed to the agent \xb7 {waited}","runtime.receipt.handingOverFor":"still handing this over to the agent \xb7 {waited}","runtime.receipt.admissionUnconfirmed":"never confirmed as sent \xb7 {waited}","runtime.receipt.unconfirmed":"not delivered — no confirmation after {waited}","runtime.receipt.unconfirmedWhy":"The agent stayed inside a turn, so this message was never handed over. Nothing else will retry it: send it again if you still need it.","runtime.receipt.unconfirmedWhyHost":"The agent’s window went away before this message was handed over, and nothing has taken the conversation back. Nothing else will retry it: send it again if you still need it.","runtime.receipt.unconfirmedWhyUnknown":"This message was accepted but never handed over, and nothing here can say why. Nothing else will retry it: send it again if you still need it.","runtime.receipt.waitedSec":"{n}s","runtime.receipt.waitedMin":"{n} min","runtime.receipt.waitedHour":"{n} h","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:()=>q.A,GO:()=>P.A,JG:()=>f.A,JU:()=>j.A,Jl:()=>p.A,Kq:()=>U.A,M6:()=>_.A,MA:()=>d.A,O0:()=>N.A,Oe:()=>w.A,QR:()=>v.A,Qp:()=>o.A,RE:()=>L.A,TB:()=>z.A,Td:()=>a.A,X:()=>H.A,Zr:()=>S.A,_T:()=>E.A,c9:()=>X,c_:()=>h.A,eW:()=>c.A,gE:()=>M.A,iU:()=>k.A,jG:()=>R.A,jy:()=>u.A,kU:()=>y.A,ke:()=>F.A,kr:()=>G.A,kt:()=>O.A,oF:()=>T.A,qk:()=>i.A,rW:()=>g.A,rX:()=>x.A,uB:()=>b.A,vj:()=>D.A,vv:()=>I.A,xf:()=>C.A,xv:()=>$.A,yQ:()=>m.A,yd:()=>l.A,zg:()=>A.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(6483),j=n(600),N=n(4885),S=n(5480),C=n(6210),A=n(9707),I=n(8747),M=n(5796),T=n(4551),P=n(5688),$=n(5561),E=n(7979),R=n(6619),O=n(1189),D=n(5377),L=n(6851),_=n(852),F=n(4179),q=n(6449),z=n(5738),H=n(9005),U=n(9804),B=n(7990),K=n(8910),Y=n(966),W=n(2750),V=n(6455),J=n(626),G=n(2571);let Q={shell:h.A,tool:B.A,"cmd-group":q.A,codex:b.A,claude:L.A,image:C.A,blob:K.A,note:E.A,citation:$.A,message:M.A,shutdown:Y.A,plan:W.A,compact:N.A,file:k.A,edit:V.A,search:D.A,web:J.A,spawn:S.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()}]);
|