commandmate 0.44.0 → 0.44.2
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/.next/BUILD_ID +1 -1
- package/.next/app-build-manifest.json +331 -335
- package/.next/app-path-routes-manifest.json +35 -35
- package/.next/build-manifest.json +5 -5
- package/.next/prerender-manifest.json +15 -15
- package/.next/react-loadable-manifest.json +3 -3
- package/.next/required-server-files.json +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/api/agents/update/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/agents/versions/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/app/release-notes/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/app/update/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/app/update-check/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/auth/login/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/auth/logout/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/auth/status/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/capabilities/route.js +1 -1
- package/.next/server/app/api/capabilities/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/daily-summary/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/daily-summary/status/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/external-apps/[id]/health/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/external-apps/[id]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/external-apps/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/fs/browse/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/fs/recent-paths/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/hooks/agent-event/route.js +2 -2
- package/.next/server/app/api/hooks/agent-event/route.js.nft.json +1 -1
- package/.next/server/app/api/hooks/agent-event/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/hooks/claude-done/route.js +2 -2
- package/.next/server/app/api/hooks/claude-done/route.js.nft.json +1 -1
- package/.next/server/app/api/hooks/claude-done/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/hooks/permission-request/route.js +1 -1
- package/.next/server/app/api/hooks/permission-request/route.js.nft.json +1 -1
- package/.next/server/app/api/hooks/permission-request/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/metrics/vibe/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/ollama/models/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/push/escalation/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/push/subscriptions/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/push/vapid/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/relays/[relayId]/cancel/route.js +1 -1
- package/.next/server/app/api/relays/[relayId]/cancel/route.js.nft.json +1 -1
- package/.next/server/app/api/relays/[relayId]/cancel/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/relays/route.js +1 -1
- package/.next/server/app/api/relays/route.js.nft.json +1 -1
- package/.next/server/app/api/relays/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/remote/pair/route.js +2 -2
- package/.next/server/app/api/remote/pair/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/repositories/[id]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/repositories/clone/[jobId]/route.js +1 -1
- package/.next/server/app/api/repositories/clone/[jobId]/route.js.nft.json +1 -1
- package/.next/server/app/api/repositories/clone/[jobId]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/repositories/clone/route.js +1 -1
- package/.next/server/app/api/repositories/clone/route.js.nft.json +1 -1
- package/.next/server/app/api/repositories/clone/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/repositories/excluded/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/repositories/restore/route.js +1 -1
- package/.next/server/app/api/repositories/restore/route.js.nft.json +1 -1
- package/.next/server/app/api/repositories/restore/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/repositories/route.js +1 -1
- package/.next/server/app/api/repositories/route.js.nft.json +1 -1
- package/.next/server/app/api/repositories/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/repositories/scan/route.js +1 -1
- package/.next/server/app/api/repositories/scan/route.js.nft.json +1 -1
- package/.next/server/app/api/repositories/scan/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/repositories/sync/route.js +1 -1
- package/.next/server/app/api/repositories/sync/route.js.nft.json +1 -1
- package/.next/server/app/api/repositories/sync/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/repositories/validate-path/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/settings/default-agents/route.js +1 -1
- package/.next/server/app/api/settings/default-agents/route.js.nft.json +1 -1
- package/.next/server/app/api/settings/default-agents/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/settings/default-surface-mode/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/sidebar/group-order/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/skills/[id]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/skills/installations/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/skills/operations/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/skills/reindex/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/skills/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/slash-commands/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/tasks/[taskId]/cancel/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/tasks/[taskId]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/templates/[id]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/templates/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/verification/runs/[runId]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/verification/runs/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/auto-yes/route.js +1 -1
- package/.next/server/app/api/worktrees/[id]/auto-yes/route.js.nft.json +1 -1
- package/.next/server/app/api/worktrees/[id]/auto-yes/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/capture/route.js +1 -1
- package/.next/server/app/api/worktrees/[id]/capture/route.js.nft.json +1 -1
- package/.next/server/app/api/worktrees/[id]/capture/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/clear-composer/route.js +1 -1
- package/.next/server/app/api/worktrees/[id]/clear-composer/route.js.nft.json +1 -1
- package/.next/server/app/api/worktrees/[id]/clear-composer/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/cli-reference/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/cli-tool/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/cmate/schedules/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/current-output/route.js +1 -1
- package/.next/server/app/api/worktrees/[id]/current-output/route.js.nft.json +1 -1
- package/.next/server/app/api/worktrees/[id]/current-output/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/direct-input/route.js +1 -1
- package/.next/server/app/api/worktrees/[id]/direct-input/route.js.nft.json +1 -1
- package/.next/server/app/api/worktrees/[id]/direct-input/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/env/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/execution-logs/[logId]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/execution-logs/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/files/[...path]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/branch/create/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/branch/delete/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/branches/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/checkout/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/commit/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/diff/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/fetch/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/log/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/pull/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/push/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/reset/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/revert/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/show/[commitHash]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/stage/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/staged/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/stash/[index]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/stash/apply/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/stash/pop/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/stash/push/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/stash/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/status/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/unstage/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/working-diff/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/instances/notes/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/instances/opencode/route.js +1 -1
- package/.next/server/app/api/worktrees/[id]/instances/opencode/route.js.nft.json +1 -1
- package/.next/server/app/api/worktrees/[id]/instances/opencode/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/interrupt/route.js +1 -1
- package/.next/server/app/api/worktrees/[id]/interrupt/route.js.nft.json +1 -1
- package/.next/server/app/api/worktrees/[id]/interrupt/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/kill-session/route.js +1 -1
- package/.next/server/app/api/worktrees/[id]/kill-session/route.js.nft.json +1 -1
- package/.next/server/app/api/worktrees/[id]/kill-session/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/logs/[filename]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/logs/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/marp-render/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/memos/[memoId]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/memos/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/messages/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/opencode/diff/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/opencode/session/route.js +1 -2
- package/.next/server/app/api/worktrees/[id]/opencode/session/route.js.nft.json +1 -1
- package/.next/server/app/api/worktrees/[id]/opencode/session/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/opencode/share/route.js +1 -2
- package/.next/server/app/api/worktrees/[id]/opencode/share/route.js.nft.json +1 -1
- package/.next/server/app/api/worktrees/[id]/opencode/share/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/prompt-response/route.js +1 -1
- package/.next/server/app/api/worktrees/[id]/prompt-response/route.js.nft.json +1 -1
- package/.next/server/app/api/worktrees/[id]/prompt-response/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/resolve-target/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/respond/route.js +1 -1
- package/.next/server/app/api/worktrees/[id]/respond/route.js.nft.json +1 -1
- package/.next/server/app/api/worktrees/[id]/respond/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/route.js +1 -1
- package/.next/server/app/api/worktrees/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/worktrees/[id]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/schedules/[scheduleId]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/schedules/active/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/schedules/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/search/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/send/route.js +1 -1
- package/.next/server/app/api/worktrees/[id]/send/route.js.nft.json +1 -1
- package/.next/server/app/api/worktrees/[id]/send/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/skills/[skillId]/git-workflow/route.js +3 -3
- package/.next/server/app/api/worktrees/[id]/skills/[skillId]/git-workflow/route.js.nft.json +1 -1
- package/.next/server/app/api/worktrees/[id]/skills/[skillId]/git-workflow/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/skills/[skillId]/install/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/skills/[skillId]/plan/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/skills/[skillId]/uninstall/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/skills/[skillId]/uninstall-plan/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/skills/[skillId]/update/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/skills/[skillId]/update-plan/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/skills/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/slash-commands/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/special-keys/route.js +1 -1
- package/.next/server/app/api/worktrees/[id]/special-keys/route.js.nft.json +1 -1
- package/.next/server/app/api/worktrees/[id]/special-keys/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/tasks/route.js +1 -1
- package/.next/server/app/api/worktrees/[id]/tasks/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/terminal/route.js +2 -2
- package/.next/server/app/api/worktrees/[id]/terminal/route.js.nft.json +1 -1
- package/.next/server/app/api/worktrees/[id]/terminal/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/timers/history/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/timers/route.js +1 -1
- package/.next/server/app/api/worktrees/[id]/timers/route.js.nft.json +1 -1
- package/.next/server/app/api/worktrees/[id]/timers/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/todos/[todoId]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/todos/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/tree/[...path]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/tree/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/upload/[...path]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/verify/config/route.js +1 -1
- package/.next/server/app/api/worktrees/[id]/verify/config/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/verify/route.js +1 -1
- package/.next/server/app/api/worktrees/[id]/verify/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/verify/runs/[runId]/cancel/route.js +1 -1
- package/.next/server/app/api/worktrees/[id]/verify/runs/[runId]/cancel/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/verify/runs/[runId]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/verify/runs/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/viewed/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/apply-default-agents/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/route.js +1 -1
- package/.next/server/app/api/worktrees/route.js.nft.json +1 -1
- package/.next/server/app/api/worktrees/route_client-reference-manifest.js +1 -1
- package/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/.next/server/app/manifest.webmanifest/route_client-reference-manifest.js +1 -1
- package/.next/server/app/more/page_client-reference-manifest.js +1 -1
- package/.next/server/app/offline/page_client-reference-manifest.js +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app/proxy/[...path]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/repositories/page_client-reference-manifest.js +1 -1
- package/.next/server/app/review/page_client-reference-manifest.js +1 -1
- package/.next/server/app/sessions/page.js +1 -1
- package/.next/server/app/sessions/page_client-reference-manifest.js +1 -1
- package/.next/server/app/skills/[skillId]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/skills/installed/page_client-reference-manifest.js +1 -1
- package/.next/server/app/skills/page_client-reference-manifest.js +1 -1
- package/.next/server/app/worktrees/[id]/files/[...path]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/worktrees/[id]/page.js +7 -7
- package/.next/server/app/worktrees/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/worktrees/[id]/terminal/page_client-reference-manifest.js +1 -1
- package/.next/server/app-paths-manifest.json +35 -35
- package/.next/server/chunks/1068.js +1 -1
- package/.next/server/chunks/1210.js +1 -1
- package/.next/server/chunks/2119.js +1 -1
- package/.next/server/chunks/2404.js +1 -1
- package/.next/server/chunks/2445.js +1 -1
- package/.next/server/chunks/2460.js +1 -0
- package/.next/server/chunks/2816.js +1 -1
- package/.next/server/chunks/2908.js +1 -0
- package/.next/server/chunks/4372.js +5 -0
- package/.next/server/chunks/5595.js +1 -0
- package/.next/server/chunks/5845.js +1 -0
- package/.next/server/chunks/6130.js +1 -1
- package/.next/server/chunks/6401.js +1 -1
- package/.next/server/chunks/6474.js +3 -3
- package/.next/server/chunks/7685.js +1 -1
- package/.next/server/chunks/7905.js +1 -1
- package/.next/server/chunks/850.js +1 -0
- package/.next/server/chunks/8543.js +1 -1
- package/.next/server/chunks/8581.js +2 -2
- package/.next/server/chunks/8728.js +2 -2
- package/.next/server/chunks/9130.js +1 -5
- package/.next/server/chunks/9390.js +1 -2
- package/.next/server/chunks/9627.js +1 -1
- package/.next/server/chunks/967.js +1 -1
- package/.next/server/chunks/9731.js +3 -3
- package/.next/server/chunks/9798.js +2 -0
- package/.next/server/chunks/9882.js +3 -3
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/middleware-manifest.json +5 -5
- package/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/pages-manifest.json +1 -1
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/static/chunks/{2407-340774f1a24f2b45.js → 2407-051f6f84226a9f2c.js} +1 -1
- package/.next/static/chunks/344-e1cefd00787060e4.js +1 -0
- package/.next/static/chunks/3922.f45dcfc1e7da552a.js +1 -0
- package/.next/static/chunks/591-539fec878c9dec5e.js +1 -0
- package/.next/static/chunks/6654-ac431270fac1a283.js +1 -0
- package/.next/static/chunks/{9619-84aced0846cbe3ac.js → 9619-6c17a271f7f98fbb.js} +1 -1
- package/.next/static/chunks/998-2eb5883186abd0bd.js +1 -0
- package/.next/static/chunks/app/layout-9da1ab602bcb3051.js +1 -0
- package/.next/static/chunks/app/more/{page-30057cf1e0762ad2.js → page-87c84987b2765213.js} +1 -1
- package/.next/static/chunks/app/{page-8483ba400af011f5.js → page-1b820c421db48c2c.js} +1 -1
- package/.next/static/chunks/app/review/page-95f749caae382f46.js +1 -0
- package/.next/static/chunks/app/sessions/page-049e06335187aa91.js +1 -0
- package/.next/static/chunks/app/worktrees/[id]/page-2a81397e60f17e63.js +1 -0
- package/.next/static/chunks/{webpack-49ade0526854dd4e.js → webpack-021f0741f22dd16a.js} +1 -1
- package/.next/trace +13 -13
- package/README.md +72 -25
- package/dist/cli/commands/capture.d.ts.map +1 -1
- package/dist/cli/commands/capture.js +7 -8
- package/dist/cli/commands/remote.d.ts +10 -0
- package/dist/cli/commands/remote.d.ts.map +1 -1
- package/dist/cli/commands/remote.js +17 -1
- package/dist/cli/commands/wait.d.ts.map +1 -1
- package/dist/cli/commands/wait.js +47 -2
- package/dist/cli/docs/setup-guide.d.ts +1 -1
- package/dist/cli/docs/setup-guide.d.ts.map +1 -1
- package/dist/cli/docs/setup-guide.js +2 -0
- package/dist/cli/types/api-responses.d.ts +25 -0
- package/dist/cli/types/api-responses.d.ts.map +1 -1
- package/dist/lib/detection/status-reason.d.ts +17 -0
- package/dist/lib/detection/status-reason.d.ts.map +1 -1
- package/dist/lib/detection/status-reason.js +17 -0
- package/dist/lib/session/prompt-view.d.ts +205 -0
- package/dist/lib/session/prompt-view.d.ts.map +1 -0
- package/dist/lib/session/prompt-view.js +267 -0
- package/dist/server/locales/en/worktree.json +13 -1
- package/dist/server/locales/ja/worktree.json +13 -1
- package/dist/server/server.js +5 -3
- package/dist/server/src/config/session-starting-config.js +75 -0
- package/dist/server/src/lib/auto-yes-lifecycle.js +133 -0
- package/dist/server/src/lib/auto-yes-poller.js +19 -4
- package/dist/server/src/lib/cli-tools/antigravity.js +3 -2
- package/dist/server/src/lib/cli-tools/base.js +15 -1
- package/dist/server/src/lib/cli-tools/codex.js +3 -2
- package/dist/server/src/lib/cli-tools/command-code.js +3 -2
- package/dist/server/src/lib/cli-tools/copilot.js +2 -1
- package/dist/server/src/lib/cli-tools/gemini.js +2 -1
- package/dist/server/src/lib/cli-tools/liveness-spec.js +27 -9
- package/dist/server/src/lib/cli-tools/opencode-v2.js +2 -1
- package/dist/server/src/lib/cli-tools/opencode.js +2 -1
- package/dist/server/src/lib/cli-tools/vibe-local.js +2 -1
- package/dist/server/src/lib/detection/cli-patterns.js +38 -20
- package/dist/server/src/lib/detection/status-detector.js +1 -1
- package/dist/server/src/lib/detection/status-reason.js +17 -0
- package/dist/server/src/lib/detection/tool-liveness.js +3 -1
- package/dist/server/src/lib/detection/tools/antigravity/detect.js +7 -31
- package/dist/server/src/lib/detection/tools/antigravity/live-region.js +39 -0
- package/dist/server/src/lib/detection/tools/claude/detect.js +8 -3
- package/dist/server/src/lib/detection/tools/claude/live-region.js +26 -0
- package/dist/server/src/lib/detection/tools/codex/cli-patterns.js +1 -1
- package/dist/server/src/lib/detection/tools/codex/detect.js +26 -46
- package/dist/server/src/lib/detection/tools/codex/live-region.js +73 -0
- package/dist/server/src/lib/detection/tools/command-code/detect.js +11 -0
- package/dist/server/src/lib/detection/tools/command-code/live-region.js +36 -0
- package/dist/server/src/lib/detection/tools/copilot/detect.js +3 -0
- package/dist/server/src/lib/detection/tools/copilot/live-region.js +52 -0
- package/dist/server/src/lib/detection/tools/frame.js +36 -2
- package/dist/server/src/lib/detection/tools/live-region-specs.js +31 -0
- package/dist/server/src/lib/detection/tools/live-region.js +204 -0
- package/dist/server/src/lib/detection/tools/opencode/detect.js +3 -0
- package/dist/server/src/lib/detection/tools/opencode/live-region.js +24 -0
- package/dist/server/src/lib/detection/tools/opencode-gutter-live-region.js +72 -0
- package/dist/server/src/lib/detection/tools/opencode-v2/detect.js +3 -0
- package/dist/server/src/lib/detection/tools/opencode-v2/live-region.js +24 -0
- package/dist/server/src/lib/detection/tools/run-detection.js +25 -3
- package/dist/server/src/lib/polling/auto-yes-dialog-gate.js +16 -4
- package/dist/server/src/lib/polling/response-checker.js +25 -20
- package/dist/server/src/lib/prompt-answer-sender.js +1 -1
- package/dist/server/src/lib/realtime/terminal-broadcast.js +8 -0
- package/dist/server/src/lib/relay/relay-delivery.js +3 -0
- package/dist/server/src/lib/relay/relay-triggers.js +9 -0
- package/dist/server/src/lib/resource-cleanup.js +6 -4
- package/dist/server/src/lib/session/agent-session-lifecycle.js +11 -0
- package/dist/server/src/lib/session/claude-session.js +7 -1
- package/dist/server/src/lib/session/current-output-builder.js +53 -21
- package/dist/server/src/lib/session/launch-screen.js +57 -0
- package/dist/server/src/lib/session/prompt-view.js +267 -0
- package/dist/server/src/lib/session/prompt-waiting-composition.js +34 -0
- package/dist/server/src/lib/session/session-starting-state.js +236 -0
- package/dist/server/src/lib/session/waiting-kind.js +3 -0
- package/dist/server/src/lib/session-cleanup.js +5 -3
- package/package.json +1 -1
- package/release-notes/0.44.1.json +54 -0
- package/release-notes/0.44.2.json +33 -0
- package/.next/server/chunks/434.js +0 -1
- package/.next/server/chunks/5775.js +0 -1
- package/.next/server/chunks/650.js +0 -1
- package/.next/server/chunks/6661.js +0 -1
- package/.next/server/chunks/8583.js +0 -1
- package/.next/server/chunks/964.js +0 -1
- package/.next/static/chunks/344-6f9fc1f38f01a839.js +0 -1
- package/.next/static/chunks/3922.8e79fc89f593280b.js +0 -1
- package/.next/static/chunks/5449-6cb80bab2bd06b79.js +0 -1
- package/.next/static/chunks/591-0a45801e83f26f24.js +0 -1
- package/.next/static/chunks/6966-bb854d1145783a64.js +0 -1
- package/.next/static/chunks/app/layout-0fc249fb7de75a27.js +0 -1
- package/.next/static/chunks/app/review/page-ff9efae3f86eb840.js +0 -1
- package/.next/static/chunks/app/sessions/page-55297155e7bf01b9.js +0 -1
- package/.next/static/chunks/app/worktrees/[id]/page-d2103e0c25be83c8.js +0 -1
- /package/.next/static/{wu7SUiHTirFcrpo5teyZ3 → QlCqLjorauDDBXPa-C7TK}/_buildManifest.js +0 -0
- /package/.next/static/{wu7SUiHTirFcrpo5teyZ3 → QlCqLjorauDDBXPa-C7TK}/_ssgManifest.js +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[591],{308:(e,t,n)=>{n.d(t,{Md:()=>c});var r=n(12115),a=n(60199),l=n(52703),s=n(67149);s.tC.pollMs,s.tC.wsFallbackMs;let o="claude";function i(e,t,n){let r=e.findIndex(e=>e.id===t.id),a=[...e];r>=0?a[r]=t:a.push(t);var l=[...a].sort((e,t)=>e.timestamp.getTime()-t.timestamp.getTime());if(void 0===n||n<1)return l;let s=l.filter(e=>"user"===e.role).map(e=>e.timestamp.getTime()).sort((e,t)=>t-e);if(s.length<=n)return l;let o=s[n-1];return l.filter(e=>e.timestamp.getTime()>=o)}function c(e){let{worktreeId:t,cliToolId:n,instanceId:c,limit:u,includeArchived:d=!1,enabled:m=!0,cadence:f=s.tC}=e,[p,h]=(0,r.useState)([]),[g,x]=(0,r.useState)(!0),{connected:b,subscribe:v,unsubscribe:y,addListener:w}=(0,a.xM)(),k=null!=c?c:n,j=(0,r.useRef)(0),N=(0,r.useRef)(n);N.current=n;let C=(0,r.useRef)(k);C.current=k;let S=(0,r.useRef)(u);S.current=u;let T=(0,r.useRef)(d);T.current=d;let M=(0,r.useRef)(new Map),I=(0,r.useRef)(!1);(0,r.useEffect)(()=>(I.current=!0,()=>{I.current=!1}),[]);let E=(0,r.useCallback)(async()=>{let e=++j.current,r=new Map;M.current=r;let a=()=>!I.current||j.current!==e||N.current!==n||C.current!==k;try{let e=new URLSearchParams({cliTool:n,instance:k,unit:"pairs"});void 0!==u&&e.set("limit",String(u)),d&&e.set("includeArchived","true");let l=await fetch("/api/worktrees/".concat(t,"/messages?").concat(e.toString()));if(!l.ok)return;let s=await l.json();if(a())return;let o=s.map(e=>({...e,timestamp:new Date(e.timestamp)}));for(let e of r.values())o=i(o,e,u);M.current===r&&(M.current=new Map),h(o),x(!1)}catch(e){if(a())return;console.error("[useSplitMessages] fetch error:",e),x(!1)}},[t,n,k,u,d]),A="".concat(t,"::").concat(n,"::").concat(k),L=(0,r.useRef)(A);return(0,r.useEffect)(()=>{L.current!==A&&(L.current=A,j.current+=1,M.current=new Map,h([]),x(!0))},[A]),(0,r.useEffect)(()=>{if(!m)return;let e=!1,t=setInterval(()=>{"hidden"!==document.visibilityState&&E()},(0,s.z1)(f,{connected:b}));"undefined"!=typeof document&&"hidden"!==document.visibilityState&&E();let n=()=>{"visible"!==document.visibilityState||e||E()};return document.addEventListener("visibilitychange",n),()=>{e=!0,clearInterval(t),document.removeEventListener("visibilitychange",n)}},[m,f,b,E]),(0,r.useEffect)(()=>{if(m)return v(t),()=>y(t)},[m,t,v,y]),(0,r.useEffect)(()=>{if(m)return w(e=>{var n,r,a,s;if("message"===e.type||"message_updated"===e.type){if(e.worktreeId!==t)return;let a=e.message;if(!a||"string"!=typeof a.id)return;let l=null!=(n=a.cliToolId)?n:o,s=null!=(r=a.instanceId)?r:l;if(l!==N.current||s!==C.current||!a.content||""===a.content.trim()||a.archived&&!T.current)return;let c={...a,timestamp:new Date(a.timestamp),cliToolId:l,instanceId:s};M.current.set(c.id,c),h(e=>i(e,c,S.current));return}if(e.type===l.dz){if(e.worktreeId!==t)return;let n=null!=(a=e.cliToolId)?a:o,r=null!=(s=e.instanceId)?s:n;if(n!==N.current||r!==C.current)return;E();return}if("session_status_changed"===e.type)e.worktreeId===t&&!1===e.isRunning&&(null==e.instance||e.instance===C.current)&&(null==e.cliTool||e.cliTool===N.current)&&E()})},[m,t,w,E]),{messages:p,isLoading:g,refresh:(0,r.useCallback)(()=>E(),[E])}}},813:(e,t,n)=>{n.d(t,{D:()=>r});function r(e,t,n){let r=new TextEncoder;if(r.encode(e).length<=t)return e;let a=t-r.encode(n).length,l=0,s="";for(let t of e){let e=r.encode(t).length;if(l+e>a)break;l+=e,s+=t}return"".concat(s).concat(n)}},1962:(e,t,n)=>{n.d(t,{Cb:()=>s,l6:()=>l});var r=n(12115);function a(e){if("string"==typeof e)return e.trim();if(null!==e&&"object"==typeof e&&"label"in e){let t=e.label;return"string"==typeof t?t.trim():null}return null}function l(e){if(null===e||"object"!=typeof e||!Array.isArray(e.options)||0===e.options.length)return null;let t=e.options.map(a);return JSON.stringify(["string"==typeof e.type?e.type.trim():"","string"==typeof e.question?e.question.trim():"",...t])}function s(e){let{promptData:t,targetKey:n}=e,[a,s]=(0,r.useState)(0),o=(0,r.useRef)(null),i=(0,r.useRef)(null),c=(0,r.useRef)(null),u=(0,r.useCallback)(()=>{null!==c.current&&(clearTimeout(c.current),c.current=null)},[]),d=(0,r.useCallback)(()=>{u(),o.current=null,i.current=null,s(0)},[u]),m=(0,r.useRef)(n);(0,r.useEffect)(()=>{m.current!==n&&(m.current=n,d())},[n,d]),(0,r.useEffect)(()=>{let e=l(t);if(null===e){null!==o.current&&null===c.current&&(c.current=setTimeout(()=>{c.current=null,o.current=null,i.current=null,s(0)},1e4));return}u();let n=i.current;if(null!==n){i.current=null,o.current=e,s(t=>e===n?t+1:1);return}e!==o.current&&(o.current=e,s(1))},[t,u]),(0,r.useEffect)(()=>u,[u]);let f=(0,r.useRef)(t);return f.current=t,{displayCount:a,showStuckHint:a>=3,markSubmitted:(0,r.useCallback)(()=>{var e;i.current=null!=(e=l(f.current))?e:o.current},[])}}},2954:(e,t,n)=>{n.d(t,{T:()=>m});var r=n(95155),a=n(12115),l=n(18955),s=n(91758),o=n(94465),i=n(76351);function c(e){let{isOpen:t,onConfirm:n,onCancel:s,cliToolName:c}=e,u=(0,l.c)("autoYes"),d=(0,l.c)("common"),[m,f]=(0,a.useState)(i.t6),[p,h]=(0,a.useState)(""),[g,x]=(0,a.useState)(null),[b,v]=(0,a.useState)(!1),y=(0,a.useRef)(null),w=e=>u(i.Ni[e].replace("autoYes.",""));return(0,a.useEffect)(()=>{t&&(h(""),x(null),v(!1))},[t]),(0,a.useEffect)(()=>{if(!b)return;let e=e=>{y.current&&!y.current.contains(e.target)&&v(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[b]),(0,a.useEffect)(()=>{if(!p.trim())return void x(null);let e=(0,i.P0)(p.trim());if(e.valid)x(null);else{var t;x(null!=(t=e.error)?t:u("invalidRegexPattern"))}},[p,u]),(0,r.jsx)(o.a,{isOpen:t,onClose:s,title:c?u("enableTitleWithTool",{toolName:c}):u("enableTitle"),size:"sm",showCloseButton:!0,children:(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{className:"text-sm text-foreground",children:[(0,r.jsx)("p",{className:"font-medium mb-2",children:u("featureDescription")}),(0,r.jsxs)("ul",{className:"list-disc list-inside space-y-1",children:[(0,r.jsx)("li",{children:u("yesNoAutoResponse")}),(0,r.jsx)("li",{children:u("multipleChoiceAutoSelect")})]}),(0,r.jsx)("p",{className:"mt-1",children:u("autoDisableAfter",{duration:w(m)})}),c&&(0,r.jsx)("p",{className:"mt-2 text-muted-foreground",children:u("appliesOnlyToCurrent",{toolName:c})})]}),(0,r.jsxs)("div",{className:"text-sm text-foreground",children:[(0,r.jsx)("p",{className:"font-medium mb-2",children:u("duration")}),(0,r.jsx)("div",{className:"flex gap-2",children:i.z9.map(e=>(0,r.jsx)("button",{type:"button",onClick:()=>f(e),className:"flex-1 py-2 px-3 text-sm font-medium rounded-md border-2 transition-colors ".concat(m===e?"border-accent-600 bg-accent-50 dark:bg-accent-900/30 text-accent-700 dark:text-accent-400":"border-border bg-surface dark:bg-surface-2 text-foreground hover:border-muted-foreground"),style:{minHeight:"44px"},children:w(e)},e))})]}),(0,r.jsxs)("div",{className:"text-sm text-foreground",children:[(0,r.jsxs)("div",{className:"flex items-center gap-1.5 mb-1",children:[(0,r.jsx)("label",{htmlFor:"stop-pattern-input",className:"font-medium",children:u("stopPatternLabel")}),(0,r.jsxs)("div",{className:"relative",ref:y,children:[(0,r.jsx)("button",{type:"button",onClick:()=>v(!b),className:"inline-flex items-center justify-center w-4 h-4 rounded-full bg-muted text-muted-foreground text-[10px] font-bold hover:bg-muted/80 focus:outline-none","aria-label":u("regexTipsLabel"),"data-testid":"regex-tips-button",children:"?"}),b&&(0,r.jsxs)("div",{className:"absolute left-0 top-6 z-50 w-72 rounded-md border border-border bg-surface p-3 shadow-lg text-xs text-foreground","data-testid":"regex-tips-tooltip",children:[(0,r.jsx)("p",{className:"font-medium mb-1.5",children:u("regexTipsTitle")}),(0,r.jsxs)("ul",{className:"space-y-1",children:[(0,r.jsxs)("li",{children:[(0,r.jsx)("code",{className:"bg-muted px-1 rounded",children:"\\bcat\\b"})," ",u("regexTipWordBoundary")]}),(0,r.jsxs)("li",{children:[(0,r.jsx)("code",{className:"bg-muted px-1 rounded",children:"error|fatal"})," ",u("regexTipOr")]}),(0,r.jsxs)("li",{children:[(0,r.jsx)("code",{className:"bg-muted px-1 rounded",children:"(?i)error"})," ",u("regexTipCaseNote")]})]})]})]})]}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground mb-2",children:u("stopPatternDescription")}),(0,r.jsx)("input",{id:"stop-pattern-input",type:"text",value:p,onChange:e=>h(e.target.value),placeholder:u("stopPatternPlaceholder"),className:"w-full px-3 py-2 border rounded-md text-sm font-mono bg-surface dark:bg-surface-2 text-foreground ".concat(g?"border-danger focus:ring-danger focus:border-danger":"border-input focus:ring-ring focus:border-accent-500"," focus:outline-none focus:ring-1"),"data-testid":"stop-pattern-input"}),g&&(0,r.jsx)("p",{className:"mt-1 text-xs text-danger","data-testid":"stop-pattern-error",children:g})]}),(0,r.jsxs)("div",{className:"text-sm text-foreground",children:[(0,r.jsx)("p",{className:"font-medium mb-2",children:u("aboutRisks")}),(0,r.jsx)("p",{children:u("riskWarning")})]}),(0,r.jsx)("div",{className:"bg-warning-subtle border-l-4 border-warning p-3",children:(0,r.jsxs)("p",{className:"text-sm text-warning-foreground",children:[(0,r.jsx)("span",{className:"font-medium",children:u("disclaimer")}),u("disclaimerText")]})}),(0,r.jsxs)("div",{className:"flex justify-end gap-3 pt-2",children:[(0,r.jsx)("button",{type:"button",onClick:s,className:"px-4 py-2 text-sm font-medium rounded-md bg-muted hover:bg-muted/80 text-foreground",children:d("cancel")}),(0,r.jsx)("button",{type:"button",onClick:()=>{n(m,p.trim()||void 0)},disabled:!!g,className:"px-4 py-2 text-sm font-medium rounded-md text-white ".concat(g?"bg-muted-foreground cursor-not-allowed":"bg-warning hover:bg-warning/90"),"data-testid":"confirm-button",children:u("agreeAndEnable")})]})]})})}var u=n(9900),d=n(54014);let m=(0,a.memo)(function(e){let{enabled:t,expiresAt:n,onToggle:o,lastAutoResponse:m,cliToolName:f,inline:p=!1,showToolName:h=!0,onExpire:g}=e,x=(0,l.c)("autoYes"),[b,v]=(0,a.useState)(""),[y,w]=(0,a.useState)(null),[k,j]=(0,a.useState)(!1),[N,C]=(0,a.useState)(!1),[S,T]=(0,a.useState)(!1);(0,a.useEffect)(()=>{if(!t||!n){v(""),T(!1);return}T(!1);let e=!1,r=()=>(v((0,i.$B)(n)),n-Date.now()<=0&&!e&&(e=!0,T(!0),null==g||g(),!0));if(r())return;let a=setInterval(()=>{r()&&clearInterval(a)},i.$s);return()=>clearInterval(a)},[t,n,g]),(0,a.useEffect)(()=>{if(!m)return;w('Auto responded: "'.concat(m,'"'));let e=setTimeout(()=>w(null),u.I2);return()=>clearTimeout(e)},[m]);let M=t&&!S,I=(0,a.useCallback)(()=>{M?(j(!0),o({enabled:!1}).finally(()=>j(!1))):C(!0)},[M,o]),E=(0,a.useCallback)((e,t)=>{C(!1),j(!0),o({enabled:!0,duration:e,stopPattern:t}).finally(()=>j(!1))},[o]),A=(0,a.useCallback)(()=>{C(!1)},[]);return(0,r.jsxs)("div",{className:p?"flex items-center gap-2":"flex items-center gap-3 px-4 py-2 bg-surface-2 border-b border-border",children:[(0,r.jsx)(s.d,{checked:M,onCheckedChange:I,disabled:k,"aria-label":x("toggleLabel")}),(0,r.jsx)("span",{className:"text-sm font-medium text-foreground",children:x("label")}),h&&f&&(0,r.jsxs)("span",{className:"text-xs text-accent-600 dark:text-accent-400 font-medium","aria-label":x("targetLabel"),children:["(",(0,d.f_)(f,""),")"]}),M&&b&&(0,r.jsx)("span",{className:"text-sm text-muted-foreground","aria-label":x("timeRemaining"),children:b}),y&&(0,r.jsx)("span",{className:"text-sm text-success animate-pulse",children:y}),(0,r.jsx)(c,{isOpen:N,onConfirm:E,onCancel:A,cliToolName:(0,d.f_)(f,"")})]})})},4300:(e,t,n)=>{n.d(t,{QN:()=>u,Qu:()=>c,bx:()=>o});let r="claude-turn:",a="antigravity-turn:",l="command-code-turn:",s=["oc-turn:",r,"codex-turn:",a,l];function o(e){return"string"==typeof e&&s.some(t=>e.startsWith(t))}let i=[[r,"claude-prompt:"],[a,"antigravity-prompt:"],[l,"command-code-prompt:"]];function c(e){if("string"!=typeof e)return null;for(let t of s)if(e.startsWith(t))return 0===e.slice(t.length).trim().length?null:e;return null}function u(e){for(let[t,n]of i){if(!e.startsWith(t))continue;let r=e.slice(t.length);return 0===r.trim().length?null:"".concat(n).concat(r)}return null}},8355:(e,t,n)=>{n.d(t,{CM:()=>i,LA:()=>c,S5:()=>s,bS:()=>l,bw:()=>r,h0:()=>o,vF:()=>a});let r=36,a=160,l=4096,s="commandmate:composer-height:";function o(e){return"split:".concat(e)}let i="session-tile",c=160},8714:(e,t,n)=>{n.d(t,{wY:()=>eL});var r=n(95155),a=n(12115),l=n(18955),s=n(7620),o=n(35299),i=n(8803),c=n(22479),u=n(41108),d=n(95342),m=n(96195),f=n(24033),p=n(27937),h=n(54485),g=n(37586),x=n(20562),b=n(53842),v=n(86651),y=n(48407),w=n(35252),k=n(60322),j=n(70738),N=n(64653),C=n(9708),S=n(41253),T=n(20877),M=n(96802),I=n(89568),E=n(92147);let A={highlightName:"chat-search",currentHighlightName:"chat-search-current",fallbackOverlayId:"chat-search-fallback-overlay",fallbackOverlayBgColor:"rgba(59, 130, 246, 0.6)"};var L=n(26788),R=n(32293);let P="chat-live-turn",O=(0,a.memo)(function(e){let{turnKey:t,version:n,body:a,partial:s=!1,isThinking:i=!1,showHeader:c=!1,onFilePathClick:u}=e,d=(0,l.c)("worktree"),m="string"==typeof a&&a.length>0;return(0,r.jsxs)("div",{"data-testid":P,"data-role":"assistant","data-turn-key":t,"data-version":void 0===n?void 0:String(n),"data-has-body":m?"true":"false",role:"group","aria-label":d("chatSurface.progressLabel"),className:R.UI,children:[c&&(0,r.jsx)("div",{className:"flex items-center gap-2 px-1 text-xs text-muted-foreground",children:(0,r.jsx)("span",{className:"font-medium",children:d("conversation.assistant")})}),(0,r.jsxs)("div",{"data-testid":R.a3,className:R.CL,children:[m&&(0,r.jsx)("div",{"data-testid":"chat-live-turn-body","data-markdown":"true",className:R.Et,children:(0,r.jsx)(R.Gn,{content:a,onFilePathClick:u})}),(0,r.jsxs)("div",{"data-testid":"chat-live-turn-indicator",role:"status","aria-live":"polite",className:["flex flex-wrap items-center gap-2 text-xs text-muted-foreground",m?"mt-1.5":""].filter(Boolean).join(" "),children:[(0,r.jsx)(o.A,{size:14,className:"animate-spin","aria-hidden":"true"}),(0,r.jsx)("span",{children:d(i?"chatSurface.thinking":"chatSurface.generating")}),s&&(0,r.jsx)("span",{"data-testid":"chat-live-turn-partial",className:"rounded border border-warning-border bg-warning-subtle px-1 py-0.5 text-warning-foreground",children:d("chatSurface.progressPartial")})]})]})]})});var z=n(92710);let F="chat-transcript-scroll-container",D="chat-transcript-jump-fab",H="absolute bottom-3 right-3 z-10 flex h-9 w-9 items-center justify-center rounded-full border border-border bg-surface-2/80 text-muted-foreground shadow-lg backdrop-blur transition-colors hover:bg-muted hover:text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-ring touch-manipulation";function B(){let e=(0,l.c)("worktree");return(0,r.jsx)("div",{"data-testid":"chat-transcript-loading",role:"status","aria-label":e("chatTranscript.loading"),children:[0,1,2].map(e=>(0,r.jsxs)("div",{className:"mb-4 flex flex-col gap-1 ".concat(e%2==0?"items-end":"items-start"),children:[(0,r.jsx)(y.EA,{className:"h-3 w-24"}),(0,r.jsx)(y.EA,{className:"h-14 rounded-2xl ".concat(e%2==0?"w-2/3":"w-11/12")})]},e))})}function q(e){let{turnKey:t,version:n,body:a,partial:s=!1,showHeader:o=!1,onFilePathClick:i}=e,c=(0,l.c)("worktree"),u="string"==typeof a&&a.length>0;return(0,r.jsxs)("div",{"data-testid":P,"data-role":"assistant","data-settling":"true","data-turn-key":t,"data-version":void 0===n?void 0:String(n),"data-has-body":u?"true":"false",role:"group","aria-label":c("chatSurface.settlingLabel"),className:R.UI,children:[o&&(0,r.jsx)("div",{className:"flex items-center gap-2 px-1 text-xs text-muted-foreground",children:(0,r.jsx)("span",{className:"font-medium",children:c("conversation.assistant")})}),(0,r.jsxs)("div",{"data-testid":R.a3,className:R.CL,children:[u&&(0,r.jsx)("div",{"data-testid":"chat-live-turn-body","data-markdown":"true",className:R.Et,children:(0,r.jsx)(R.Gn,{content:a,onFilePathClick:i})}),(0,r.jsxs)("div",{"data-testid":"chat-settling-turn-note",className:["flex flex-wrap items-center gap-2 text-xs text-muted-foreground",u?"mt-1.5":""].filter(Boolean).join(" "),children:[(0,r.jsx)("span",{children:c("chatSurface.settling")}),s&&(0,r.jsx)("span",{"data-testid":"chat-live-turn-partial",className:"rounded border border-warning-border bg-warning-subtle px-1 py-0.5 text-warning-foreground",children:c("chatSurface.progressPartial")})]})]})]})}function K(e){let{count:t,isOpen:n,regionId:a,onToggle:s}=e,o=(0,l.c)("worktree"),i=n?f.A:p.A;return(0,r.jsx)("div",{className:"mb-2 flex w-full items-center",children:(0,r.jsxs)("button",{type:"button","data-testid":"chat-previous-session-toggle","data-count":String(t),onClick:s,"aria-expanded":n,"aria-controls":a,"aria-label":o(n?"chatTranscript.previousSession.collapse":"chatTranscript.previousSession.expand"),className:"flex min-h-[32px] items-center gap-1.5 rounded-full border border-border bg-surface-2 px-3 py-1 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-ring touch-manipulation",children:[(0,r.jsx)(h.A,{size:12,"aria-hidden":"true"}),(0,r.jsx)("span",{children:o("chatTranscript.previousSession.summary",{count:t})}),(0,r.jsx)(i,{size:12,"aria-hidden":"true"})]})})}function U(){let e=(0,l.c)("worktree");return(0,r.jsxs)("div",{"data-testid":"chat-session-ended-banner",role:"status",className:"mt-2 flex flex-col gap-0.5 rounded-lg border border-border bg-surface-2 px-3 py-2 text-xs text-muted-foreground",children:[(0,r.jsx)("span",{children:e("terminal.sessionEnded")}),(0,r.jsx)("span",{children:e("chatTranscript.previousSession.hint")})]})}function _(){let e=(0,l.c)("worktree");return(0,r.jsxs)("div",{"data-testid":"chat-transcript-empty",className:"flex flex-col items-center justify-center gap-1 py-10 text-center text-muted-foreground",children:[(0,r.jsx)(g.A,{className:"mb-1 h-10 w-10 opacity-50","aria-hidden":"true"}),(0,r.jsx)("p",{className:"text-sm",children:e("chatTranscript.empty")}),(0,r.jsx)("p",{className:"text-xs",children:e("chatTranscript.emptyHint")})]})}let W=(0,a.memo)(function(e){let{messages:t,worktreeId:n,worktreePath:s,cliToolId:c,instanceId:u,isLoading:d=!1,className:f="",onFilePathClick:p,showToast:h,onInsertToMessage:g,onRetryPending:y,onDiscardPending:P,splitIndex:W,liveTurn:$=null,sessionEnded:J=!1,onScrollControlsChange:Q,hideCornerControls:Y=!1,openSearchOnWindowEvent:G=!1,searchBarTopClassName:V="top-2"}=e,Z=(0,l.c)("worktree"),X=(0,a.useRef)(null),ee=(0,a.useMemo)(()=>void 0===W?A:{highlightName:"chat-search-".concat(W),currentHighlightName:"chat-search-current-".concat(W),fallbackOverlayId:"chat-search-fallback-overlay-".concat(W),fallbackOverlayBgColor:A.fallbackOverlayBgColor},[W]),et=(0,a.useMemo)(()=>{let e=t.filter(e=>!e.archived);return e.length===t.length?t:e},[t]),en=J&&!d,er="".concat(n,"|").concat(null!=c?c:"","|").concat(null!=u?u:""),ea=(0,a.useRef)(null),el=(0,a.useRef)(er);el.current!==er&&(el.current=er,ea.current=null),en?null===ea.current&&(ea.current=new Set(et.filter(e=>!e.optimisticState).map(e=>e.id))):ea.current=null;let es=ea.current,{previousMessages:eo,currentMessages:ei}=(0,a.useMemo)(()=>{if(null===es||0===es.size)return{previousMessages:[],currentMessages:et};let e=[],t=[];for(let n of et)!n.optimisticState&&es.has(n.id)?e.push(n):t.push(n);return{previousMessages:e,currentMessages:t}},[es,et]),ec=eo.length,eu=en&&ec>0,[ed,em]=(0,a.useState)(!1),ef=(0,a.useCallback)(()=>{em(e=>!e)},[]);(0,a.useEffect)(()=>{eu||em(!1)},[eu]),(0,a.useEffect)(()=>{em(!1)},[er]);let ep=(0,a.useMemo)(()=>void 0===W?"chat-previous-session-region":"chat-previous-session-region-".concat(W),[W]),eh=(0,a.useRef)(!0),eg=(0,a.useRef)(-1),ex=(0,a.useRef)(d),eb=(0,a.useRef)(0),[ev,ey]=(0,a.useState)(!0),ew=(0,a.useMemo)(()=>(ed?et:ei).filter(e=>!e.archived&&!(0,E.nY)(e)&&"string"==typeof e.content&&e.content.length>0),[et,ei,ed]),{isOpen:ek,query:ej,matchCount:eN,currentIndex:eC,isAtMaxMatches:eS,matchPositions:eT,currentMatch:eM,openSearch:eI,closeSearch:eE,setQuery:eA,onCompositionStart:eL,onCompositionEnd:eR,nextMatch:eP,prevMatch:eO}=(0,w.w)({messages:ew}),ez=ek&&eT.length>0,[eF,eD]=(0,L.Af)(),eH=(0,a.useMemo)(()=>({showAll:eF}),[eF]),eB=(0,a.useMemo)(()=>ek&&0!==eT.length?new Set(eT.map(e=>e.messageId)):null,[ek,eT]);(0,a.useEffect)(()=>{eE()},[n]);let eq=(0,a.useRef)(null),[eK,eU]=(0,a.useState)(0);(0,a.useEffect)(()=>{if(!G)return;let e=()=>{eI(),eU(e=>e+1)};return window.addEventListener("chat-search-open",e),()=>window.removeEventListener("chat-search-open",e)},[G,eI]),(0,a.useEffect)(()=>{var e,t;0!==eK&&(null==(t=eq.current)||null==(e=t.querySelector("input"))||e.focus())},[eK]);let e_=(0,a.useMemo)(()=>eu?[{kind:"previousSessionHeader",key:"previous-session-header",count:ec},...ed?(0,I.UY)(eo).map(e=>({...e,previousSession:!0})):[],...(0,I.UY)(ei)]:(0,I.UY)(et),[eu,ed,et,eo,ei,ec]);eb.current=e_.length;let eW=null!==$,e$=(0,a.useMemo)(()=>(function(e,t){let n=e.length-1;if(n<0)return null;let r={index:n,align:"end"};if(t)return r;for(let t=n;t>=0;t-=1){let n=e[t];if("approvals"===n.kind)continue;let a="message"===n.kind?n.message:void 0;if(!a)break;if(!(0,R.t_)(a))return"assistant"===a.role&&"normal"===a.messageType?{index:t,align:"start"}:r}return r})(e_,eW),[e_,eW]),eJ=(0,a.useRef)(e$);eJ.current=e$;let eQ=(0,m.Te)({count:e_.length,getScrollElement:()=>X.current,estimateSize:()=>I.hM,overscan:I.B7,getItemKey:e=>{var t,n;return null!=(n=null==(t=e_[e])?void 0:t.key)?n:e}}),eY=eQ.getVirtualItems(),eG=eY.length>0?"".concat(eY[0].index,"-").concat(eY[eY.length-1].index):"",eV=(0,a.useMemo)(()=>{let e=new Map;return e_.forEach((t,n)=>{if("previousSessionHeader"!==t.kind)if("message"===t.kind)e.set(t.message.id,n);else for(let r of t.entries)for(let t of r.messageIds)e.set(t,n)}),e},[e_]),eZ=(0,a.useRef)(null),eX=(0,a.useCallback)(()=>{let e=eZ.current;eZ.current=null,e&&null!==e.frame&&cancelAnimationFrame(e.frame)},[]),e0=(0,a.useCallback)(e=>{var t;let n=X.current,r=null==(t=eQ.getOffsetForIndex(e.index,e.align))?void 0:t[0];return n&&void 0!==r?Math.abs(n.scrollTop-r):1/0},[eQ]),e1=(0,a.useCallback)(()=>{eX();let e=eJ.current;if(null===e||(eQ.scrollToIndex(e.index,{align:e.align}),"function"!=typeof requestAnimationFrame))return;let t={frame:null,frames:0,stableFrames:0,totalSize:eQ.getTotalSize(),target:e,deadline:Date.now()+600},n=()=>{if(t.frame=null,eZ.current!==t)return;t.frames+=1;let e=eJ.current;if(null===e||!eh.current||t.frames>12||Date.now()>t.deadline){eZ.current=null;return}let r=eQ.getTotalSize();if(r===t.totalSize&&e.index===t.target.index&&e.align===t.target.align&&(t.frames>1||1>=e0(e))){if(t.stableFrames+=1,t.stableFrames>=3){eZ.current=null;return}}else t.stableFrames=0,t.totalSize=r,t.target=e,eQ.scrollToIndex(e.index,{align:e.align});t.frame=requestAnimationFrame(n)};eZ.current=t,t.frame=requestAnimationFrame(n)},[eQ,eX,e0]);(0,a.useEffect)(()=>eX,[eX]);let e2=(0,a.useCallback)(()=>{eh.current=!0,ey(!0),e1()},[e1]),e5=(0,a.useCallback)(()=>{eX(),eh.current=!1,ey(!1),eb.current>0&&eQ.scrollToIndex(0,{align:"start"})},[eQ,eX]),e4=(0,a.useCallback)(()=>{let e=X.current;if(!e)return;let t=eJ.current,n=(0,M.Mp)({scrollTop:e.scrollTop,scrollHeight:e.scrollHeight,clientHeight:e.clientHeight})||null!==t&&"start"===t.align&&e0(t)<=M.r4;(n||null===eZ.current)&&(eh.current=n,ey(n))},[e0]),e3=(0,a.useRef)(eW),e8=(0,a.useRef)(eF);(0,a.useLayoutEffect)(()=>{let e=eg.current,t=ex.current,n=e3.current,r=e8.current,a=et.length;if(eg.current=a,ex.current=d,e3.current=eW,e8.current=eF,d||ez||0===e_.length||!eh.current)return;let l=n!==eW||r!==eF;(-1===e||t||l||!(a<=e))&&e1()},[et.length,e_.length,d,ez,eW,eF,e1]),(0,a.useEffect)(()=>{if(Q)return Q({scrollToLatest:e2,scrollToTop:e5}),()=>Q(null)},[Q,e2,e5]);let e6=(0,a.useCallback)(e=>{if("Home"!==e.key&&"End"!==e.key)return;let t=e.target;t&&("INPUT"===t.tagName||"TEXTAREA"===t.tagName||t.isContentEditable)||0!==eb.current&&(e.preventDefault(),"End"===e.key?e2():e5())},[e2,e5]);(0,a.useEffect)(()=>{if(!ek||!eM)return;let e=eV.get(eM.messageId);void 0!==e&&eQ.scrollToIndex(e,{align:"center"})},[ek,eM,eV,eQ]),(0,a.useLayoutEffect)(()=>{let e=X.current;if(!e)return;if(!ek||0===eT.length)return void(0,T.fq)(ee);let t=null;for(let n of eT){let r=e.querySelector('[data-message-id="'.concat(CSS.escape(n.messageId),'"]'));if(!r)continue;let a=(null==eM?void 0:eM.messageId)===n.messageId;(0,T.Gg)(r,n.ranges,a?eM.localIndex:-1,ee),a&&r instanceof HTMLElement&&(t=r)}return t&&"function"==typeof t.scrollIntoView&&t.scrollIntoView({block:"center",behavior:"smooth"}),()=>{(0,T.fq)(ee)}},[ek,eT,eM,ee,eG]);let e9=(0,a.useRef)(Z);e9.current=Z;let e7=(0,C.O)(),te=null!=s?s:e7.worktreePath,tt=(0,a.useMemo)(()=>({worktreeId:n,worktreePath:te}),[n,te]),tn=(0,a.useCallback)(e=>{if(!p)return;let t=(0,j.h)(e,te);null!==t&&(async()=>{if("missing"===await (0,N.o4)(n,t)){null==h||h(e9.current("conversation.filePathMissing"),"error");return}p(t)})()},[p,n,te,h]),tr=(0,a.useCallback)(async e=>{try{await (0,k.l)(e),null==h||h(e9.current("history.copied"),"success")}catch(e){null==h||h(e9.current("history.copyFailed"),"error")}},[h]),ta=(0,a.useCallback)(e=>{let t=e_[e];if(!t)return null;if("previousSessionHeader"===t.kind)return(0,r.jsx)(K,{count:t.count,isOpen:ed,regionId:ep,onToggle:ef});let n=e=>t.previousSession?(0,r.jsx)("div",{"data-previous-session":"true",className:"opacity-60",children:e}):e;if("approvals"===t.kind)return n((0,r.jsx)(R.ZK,{entries:t.entries}));let a=(0,r.jsx)(R.qI,{message:t.message,showHeader:t.showHeader,header:t.header,onFilePathClick:tn,onCopy:tr,onInsertToMessage:g,onRetryPending:y,onDiscardPending:P});return n((null==eB?void 0:eB.has(t.message.id))?(0,r.jsx)(R.PZ,{value:R.vY,children:a}):a)},[e_,tn,tr,g,y,P,eB,ed,ep,ef]),tl=null!==$&&!0!==$.settling;return(0,r.jsxs)("div",{"data-testid":"chat-transcript","data-tool-activity":eF?"shown":"folded",role:"log","aria-label":Z("chatTranscript.regionLabel"),className:["relative flex h-full min-h-0 w-full flex-col overflow-hidden bg-surface",f].filter(Boolean).join(" "),children:[(0,r.jsx)("div",{ref:X,"data-testid":F,onScroll:e4,onKeyDown:e6,tabIndex:0,className:"min-h-0 flex-1 overflow-y-auto overflow-x-hidden px-3 py-3",children:(0,r.jsx)(R.PZ,{value:eH,children:(0,r.jsxs)(S.lK,{value:tt,children:[d?(0,r.jsx)(B,{}):0===e_.length?$?null:(0,r.jsx)(_,{}):0===eY.length?(0,r.jsx)("div",{"data-testid":"chat-transcript-fallback-list",id:eu?ep:void 0,children:e_.slice(0,I.JD).map((e,t)=>(0,r.jsx)("div",{children:ta(t)},e.key))}):(0,r.jsx)("div",{id:eu?ep:void 0,style:{height:eQ.getTotalSize(),width:"100%",position:"relative"},children:eY.map(e=>(0,r.jsx)("div",{"data-index":e.index,ref:eQ.measureElement,className:"absolute left-0 top-0 w-full",style:{transform:"translateY(".concat(e.start,"px)")},children:ta(e.index)},e.key))}),$&&($.settling?(0,r.jsx)(q,{turnKey:$.turnKey,version:$.version,body:$.body,partial:$.partial,showHeader:(0,I.CK)(et[et.length-1]),onFilePathClick:tn}):(0,r.jsx)(O,{turnKey:$.turnKey,version:$.version,body:$.body,partial:$.partial,isThinking:$.isThinking,showHeader:(0,I.CK)(et[et.length-1]),onFilePathClick:tn})),eu&&(0,r.jsx)(U,{})]})})}),e_.length>0&&(ev?(0,r.jsx)("button",{type:"button","data-testid":D,"data-direction":"top",onClick:e5,"aria-label":Z("chatTranscript.jumpToTop"),title:Z("chatTranscript.jumpToTop"),className:H,children:(0,r.jsx)(x.A,{size:16,"aria-hidden":"true"})}):(0,r.jsx)("button",{type:"button","data-testid":D,"data-direction":"latest","data-generating":tl?"true":void 0,onClick:e2,"aria-label":Z(tl?"chatSurface.jumpToLatestGenerating":"chatSurface.jumpToLatest"),title:Z(tl?"chatSurface.jumpToLatestGenerating":"chatSurface.jumpToLatest"),className:H,children:tl?(0,r.jsx)(o.A,{size:16,className:"animate-spin","aria-hidden":"true"}):(0,r.jsx)(i.A,{size:16,"aria-hidden":"true"})})),(0,r.jsxs)("div",{ref:eq,className:"pointer-events-none absolute right-2 ".concat(V," z-10 flex items-start justify-end gap-1"),children:[!ek&&!Y&&(0,r.jsx)("div",{className:"pointer-events-auto",children:(0,r.jsx)("button",{type:"button","data-testid":"chat-transcript-tool-activity-toggle",onClick:eD,"aria-pressed":eF,"aria-label":Z(eF?"chatTranscript.toolActivity.hide":"chatTranscript.toolActivity.show"),title:Z(eF?"chatTranscript.toolActivity.hide":"chatTranscript.toolActivity.show"),className:["rounded-full border border-border p-1.5 shadow-sm backdrop-blur transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-ring touch-manipulation",eF?"bg-accent-500/15 text-accent-700 hover:bg-accent-500/25 dark:text-accent-400":"bg-surface-2/80 text-muted-foreground hover:bg-muted hover:text-foreground"].join(" "),children:(0,r.jsx)(b.A,{size:14,"aria-hidden":"true"})})}),(ek||!Y)&&(0,r.jsx)("div",{className:"pointer-events-auto",children:ek?(0,r.jsx)(z.Y,{query:ej,onQueryChange:eA,matchCount:eN,currentIndex:eC,onNext:eP,onPrev:eO,onClose:eE,isAtMaxMatches:eS,onCompositionStart:eL,onCompositionEnd:eR}):(0,r.jsx)("button",{type:"button","data-testid":"chat-transcript-search-toggle",onClick:eI,"aria-label":Z("chatTranscript.openSearch"),title:Z("chatTranscript.openSearch"),className:"rounded-full border border-border bg-surface-2/80 p-1.5 text-muted-foreground shadow-sm backdrop-blur transition-colors hover:bg-muted hover:text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-ring touch-manipulation",children:(0,r.jsx)(v.A,{size:14,"aria-hidden":"true"})})})]})]})});var $=n(78596),J=n(51515),Q=n(16342);let Y=/\x1b\[[0-9;]*[a-zA-Z]|\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)|\[[0-9;]*m/g,G=/^(?:\x1b\[|\[)([0-9;]*)m$/,V=new Set([38,48,58]);function Z(e){let t;Y.lastIndex=0;let n=[],r="",a=null,l=0,s=0,o=0;for(;null!==(t=Y.exec(e));){let i=e.slice(o,t.index);r+=i,l+=(0,Q.LQ)(i),o=t.index+t[0].length;let c=G.exec(t[0]);if(null===c)continue;let u=function(e,t){let n=(""===t?"0":t).split(";"),r=e;for(let e=0;e<n.length;e++){let t=Number(""===n[e]?"0":n[e]);if(Number.isFinite(t)){if(V.has(t)){let a="2"===n[e+1]?4:2*("5"===n[e+1]);a>0&&48===t&&(r=n.slice(e,e+1+a).join(";")),e+=a;continue}0===t||49===t?r=null:(t>=40&&t<=47||t>=100&&t<=107)&&(r=n[e])}}return r}(a,c[1]);u!==a&&(l>s&&n.push({bg:a,start:s,end:l}),a=u,s=l)}let i=e.slice(o);r+=i,(l+=(0,Q.LQ)(i))>s&&n.push({bg:a,start:s,end:l});let c=new Set(n.map(e=>e.start));return n.length>0&&c.add(n[n.length-1].end),{text:r,segments:n,edges:c,width:l}}function X(e,t){for(let n of e.segments)if(n.start<=t&&t<n.end)return n.bg;return null}function ee(e){let t=new Set;for(let n of e.segments)null!==n.bg&&t.add(n.bg);return t}function et(e){let t=new Map;for(let r of e.segments){var n;null!==r.bg&&t.set(r.bg,(null!=(n=t.get(r.bg))?n:0)+(r.end-r.start))}let r=null,a=0;for(let[e,n]of t)n>a&&(r=e,a=n);return{bg:r,columns:a}}var en=n(18341),er=n(813);let ea=/\S[^\S\n]{2,}esc[^\S\n]*$/,el=/^[│┃╹]/;function es(e,t,n){if(!e.edges.has(t)||!e.edges.has(n))return!1;for(let r of e.segments)if(!(r.end<=t)&&!(r.start>=n)&&null===r.bg)return!1;return!(X(e,t-1)===X(e,t)||n<e.width&&X(e,n)===X(e,n-1)||el.test((0,Q.Ml)(e.text,t-1,t)))&&!el.test((0,Q.Ml)(e.text,t,n))}var eo=n(42278);let ei=[function(e){let t=function(e){let t=e.split("\n").map(Z),n=new Set,r=null;for(let e of t){if(!e.text.includes("esc"))continue;let a=[...e.edges].sort((e,t)=>e-t);for(let l of a)if(!(l<1))for(let s of a){if(s-l<16)continue;let a="".concat(l,":").concat(s);if(n.has(a)||!es(e,l,s))continue;let o=(0,Q.Ml)(e.text,l,s);if(!ea.test(o))continue;n.add(a);let i=t.filter(e=>es(e,l,s));if(i.length<3)continue;let c=i.indexOf(e);c<0||c>=3||(null===r||i.length>r.rows)&&(r={id:"opencode_modal_overlay",headerText:(0,er.D)(o.trim(),200,"…[truncated]"),left:l,right:s,rows:i.length,headerRow:c,frameRowStart:t.indexOf(i[0]),frameRowEnd:t.indexOf(i[i.length-1])})}}return r}(e);return null===t?null:e.split("\n").slice(t.frameRowStart,t.frameRowEnd+1).join("\n")},eo.VC];function ec(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e)return"";let n=e.replace(/\r\n/g,"\n");if(t.selectionList)for(let e of ei){let t=e(n);if(null===t)continue;let r=(0,en.Uw)(t,{isStructuralRow:en.CG});if(""!==r)return r}let r=(0,en.Uw)(n,{isStructuralRow:en.CG});if(""===r)return"";if(t.selectionList)return r;let a=r.split("\n"),l=function(e){if(void 0===e||!Number.isFinite(e))return 16;let t=Math.trunc(e);return t<12?12:t>20?20:t}(t.maxLines);return a.slice(-l).join("\n")}let eu=/^[^\S\n]*[❯›●][^\S\n]/;function ed(e){let{frame:t,maxLines:n=16,maxHeightClassName:s="max-h-64",actions:o,reason:i,className:c=""}=e,u=(0,l.c)("worktree"),d="selectionList"===i,m=(0,a.useMemo)(()=>ec(t,{maxLines:n,selectionList:d}),[t,n,d]),f=(0,a.useMemo)(()=>m?(0,$.l5)(m):"",[m]),p=(0,a.useRef)(null),h=(0,a.useMemo)(()=>d&&m?function(e){let t=e.split("\n"),n=-1;for(let e=t.length-1;e>=0;e-=1)if(eu.test((0,J.aJ)(t[e]))){n=e;break}return Math.max(n,function(e){let t=e.map(Z),n=t.map(et),r=t.map(ee);for(let e=t.length-1;e>=0;e-=1){let{bg:a,columns:l}=n[e];if(!(null===a||l<8||e>0&&r[e-1].has(a))&&!(e+1<t.length&&r[e+1].has(a)))return e}return -1}(t))}(m):-1,[d,m]);return((0,a.useLayoutEffect)(()=>{if(h<0)return;let e=p.current;if(!e)return;let t=(0,J.aJ)(m).split("\n").length;if(t<=1)return;let n=e.scrollHeight-e.clientHeight;if(n<=0)return;let r=window.getComputedStyle(e),a=Number.parseFloat(r.paddingTop)||0,l=Number.parseFloat(r.paddingBottom)||0,s=Math.max(0,e.scrollHeight-a-l)/t,o=a+h*s-(e.clientHeight-s)/2;e.scrollTop=Math.min(n,Math.max(0,o))},[h,m]),m)?(0,r.jsxs)("div",{"data-testid":"chat-dialog-card","data-reason":i,role:"group","aria-label":u("chatSurface.dialogCardLabel"),className:["flex min-w-0 flex-col gap-2",c].filter(Boolean).join(" "),children:[(0,r.jsx)("div",{ref:p,"data-testid":"chat-dialog-card-frame",className:"overflow-auto rounded-lg border border-border bg-terminal-surface p-2 font-mono text-[11px] leading-snug text-terminal-foreground ".concat(s),children:(0,r.jsx)("div",{className:"whitespace-pre w-max",dangerouslySetInnerHTML:{__html:f}})}),o?(0,r.jsx)("div",{"data-testid":"chat-dialog-card-actions",className:"min-w-0",children:o}):null]}):null}var em=n(60734),ef=n(73190),ep=n(51021),eh=n(56827),eg=n(49509);let ex=[{key:"1",label:"1",ariaLabel:"Send 1"},{key:"2",label:"2",ariaLabel:"Send 2"},{key:"3",label:"3",ariaLabel:"Send 3"},{key:"4",label:"4",ariaLabel:"Send 4"},{key:"5",label:"5",ariaLabel:"Send 5"},{key:"6",label:"6",ariaLabel:"Send 6"},{key:"7",label:"7",ariaLabel:"Send 7"},{key:"8",label:"8",ariaLabel:"Send 8"},{key:"9",label:"9",ariaLabel:"Send 9"}],eb=[{key:"y",label:"y",ariaLabel:"Send y"},{key:"n",label:"n",ariaLabel:"Send n"},{key:"Enter",label:"↵",ariaLabel:"Send Enter"}],ev="Escape";function ey(e){let{worktreeId:t,cliToolId:n,instanceId:s,onKeysSent:o}=e,i=(0,l.c)("worktree"),{activeKey:c,markPressed:u}=(0,eg.t)(),d=(0,eh.B)(t,n,s,o),m=(0,a.useCallback)(e=>{u(e),d([e])},[u,d]);return(0,r.jsxs)("div",{"data-testid":"prompt-answer-keys",role:"toolbar","aria-label":i("promptAnswerKeys.toolbarLabel"),className:"flex flex-wrap items-center gap-1.5 rounded-lg bg-muted px-2 py-1.5",children:[(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:i("promptAnswerKeys.caption")}),[...ex,...eb].map(e=>{let{key:t,label:n,ariaLabel:a}=e;return(0,r.jsx)("button",{type:"button","data-testid":"prompt-answer-key-".concat(t),"aria-label":a,onClick:()=>m(t),className:"min-h-[44px] min-w-[44px] rounded-md border border-border px-3 py-2 text-sm font-medium transition-colors duration-75 touch-manipulation focus:outline-none focus:ring-2 focus:ring-ring ".concat(c===t?"border-accent-500 bg-accent-500 text-white scale-95":"bg-surface hover:bg-muted active:bg-muted dark:bg-surface-2"),children:n},t)})]})}function ew(e){let{worktreeId:t,cliToolId:n,instanceId:s,onKeysSent:o,optionCount:i}=e,c=(0,l.c)("worktree"),{activeKey:u,markPressed:d}=(0,eg.t)(),m=(0,eh.B)(t,n,s,o),f=(0,a.useMemo)(()=>{let e=Math.min(Math.trunc(i),eo.$H);return!Number.isFinite(e)||e<1?[]:ex.slice(0,e)},[i]),p=(0,a.useCallback)(e=>{d(e),m([e])},[d,m]);return 0===f.length?null:(0,r.jsxs)("div",{"data-testid":"selection-number-keys","data-option-count":String(f.length),role:"toolbar","aria-label":c("selectionKeys.numbersToolbarLabel"),className:"flex flex-wrap items-center gap-1.5 rounded-lg bg-muted px-2 py-1.5",children:[(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:c("selectionKeys.numbersCaption")}),f.map(e=>{let{key:t,label:n,ariaLabel:a}=e;return(0,r.jsx)("button",{type:"button","data-testid":"selection-number-key-".concat(t),"aria-label":a,onClick:()=>p(t),className:"min-h-[44px] min-w-[44px] rounded-md border border-border px-3 py-2 text-sm font-medium transition-colors duration-75 touch-manipulation focus:outline-none focus:ring-2 focus:ring-ring ".concat(u===t?"border-accent-500 bg-accent-500 text-white scale-95":"bg-surface hover:bg-muted active:bg-muted dark:bg-surface-2"),children:n},t)})]})}function ek(e){let{worktreeId:t,cliToolId:n,instanceId:s,onKeysSent:o,commitsDefaultOnEnter:i}=e,c=(0,l.c)("worktree"),{activeKey:u,markPressed:d}=(0,eg.t)(),m=(0,eh.B)(t,n,s,o),f=(0,a.useCallback)(e=>{d(e),m([e])},[d,m]);return(0,r.jsxs)("div",{"data-testid":"selection-commit-keys",role:"toolbar","aria-label":c("selectionKeys.commitToolbarLabel"),className:"flex flex-wrap items-center gap-1.5 rounded-lg bg-muted px-2 py-1.5",children:[(0,r.jsx)("button",{type:"button","data-testid":"selection-commit-session","aria-label":c("selectionKeys.sessionOnlyAria"),title:c("selectionKeys.sessionOnlyAria"),onClick:()=>f(ep.mE),className:"min-h-[44px] rounded-md border px-3 py-2 text-sm font-medium transition-colors duration-75 touch-manipulation focus:outline-none focus:ring-2 focus:ring-ring ".concat(u===ep.mE?"border-accent-500 bg-accent-500 text-white scale-95":"border-accent-500 bg-surface text-accent-600 hover:bg-muted active:bg-muted dark:bg-surface-2 dark:text-accent-400"),children:c("selectionKeys.sessionOnly")}),(0,r.jsx)("button",{type:"button","data-testid":"selection-commit-default","aria-label":c("selectionKeys.setDefaultAria"),title:c("selectionKeys.setDefaultAria"),onClick:()=>f("Enter"),className:"min-h-[44px] rounded-md border border-border px-3 py-2 text-sm font-medium transition-colors duration-75 touch-manipulation focus:outline-none focus:ring-2 focus:ring-ring ".concat("Enter"===u?"border-accent-500 bg-accent-500 text-white scale-95":"bg-surface hover:bg-muted active:bg-muted dark:bg-surface-2"),children:c("selectionKeys.setDefault")}),i?(0,r.jsx)("p",{"data-testid":"selection-commit-warning",className:"w-full text-xs text-muted-foreground",children:c("selectionKeys.defaultWarning")}):null]})}function ej(e){let{worktreeId:t,cliToolId:n,instanceId:s,onKeysSent:o}=e,i=(0,l.c)("worktree"),{activeKey:c,markPressed:u}=(0,eg.t)(),d=(0,eh.B)(t,n,s,o),m=(0,a.useCallback)(()=>{u(ev),d([ev])},[u,d]);return(0,r.jsx)("div",{"data-testid":"dismiss-panel-keys",role:"toolbar","aria-label":i("dismissPanelKeys.toolbarLabel"),className:"flex flex-wrap items-center gap-1.5 rounded-lg bg-muted px-2 py-1.5",children:(0,r.jsx)("button",{type:"button","data-testid":"dismiss-panel-key-Escape","aria-label":i("dismissPanelKeys.closeAria"),title:i("dismissPanelKeys.closeAria"),onClick:m,className:"min-h-[44px] rounded-md border px-3 py-2 text-sm font-medium transition-colors duration-75 touch-manipulation focus:outline-none focus:ring-2 focus:ring-ring ".concat(c===ev?"border-accent-500 bg-accent-500 text-white scale-95":"border-accent-500 bg-surface text-accent-600 hover:bg-muted active:bg-muted dark:bg-surface-2 dark:text-accent-400"),children:i("dismissPanelKeys.close")})})}[...ex.map(e=>e.key),...eb.map(e=>e.key)];var eN=n(92833);let eC={plan_review_ambiguous_answer:"planReview.refusal.ambiguousAnswer",plan_review_busy:"planReview.refusal.busy",plan_review_nothing_to_submit:"planReview.refusal.nothingToSubmit",plan_review_invalid_request:"planReview.refusal.invalidRequest",plan_review_not_active:"planReview.refusal.notActive"};function eS(e){let{worktreeId:t,cliToolId:n,instanceId:s,onKeysSent:o}=e,i=(0,l.c)("worktree"),[c,u]=(0,a.useState)(""),[d,m]=(0,a.useState)(!1),[f,p]=(0,a.useState)(null),[h,g]=(0,a.useState)(null),x=(0,a.useCallback)(async e=>{p(e),g(null);try{let i=await fetch("/api/worktrees/".concat(encodeURIComponent(t),"/prompt-response"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(function(e,t,n,r){let a={planReviewAction:e,cliTool:t},l=n.trim();return("comment"===e||"submit"===e)&&l&&(a.answer=l),r&&r!==t&&(a.instanceId=r),a}(e,n,c,s))}),d={};try{d=await i.json()}catch(e){d={}}if(!i.ok||!0!==d.success){var r,a,l;g({reason:null!=(r=d.reason)?r:null,message:null!=(l=null!=(a=d.message)?a:d.error)?l:null});return}("comment"===e||"submit"===e)&&u(""),null==o||o()}catch(e){g({reason:null,message:null})}finally{p(null)}},[t,n,c,s,o]),b=c.trim().length>0,v=null!==f,y=(null==h?void 0:h.reason)?eC[h.reason]:void 0,w="min-h-[44px] rounded-md border px-3 py-2 text-sm font-medium transition-colors touch-manipulation focus:outline-none focus:ring-2 focus:ring-ring disabled:opacity-50";return(0,r.jsxs)("div",{"data-testid":"plan-review-controls",role:"group","aria-label":i("planReview.groupLabel"),className:"space-y-2 rounded-lg bg-muted px-2 py-1.5",children:[(0,r.jsx)("label",{className:"block text-xs text-muted-foreground",htmlFor:"plan-review-comment-".concat(t),children:i("planReview.commentLabel")}),(0,r.jsx)("textarea",{id:"plan-review-comment-".concat(t),"data-testid":"plan-review-comment-input",value:c,onChange:e=>u(e.target.value),placeholder:i("planReview.commentPlaceholder"),rows:2,className:"w-full resize-y rounded-md border border-border bg-surface px-2 py-1.5 text-sm text-foreground focus:outline-none focus:ring-2 focus:ring-ring dark:bg-surface-2"}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,r.jsx)("button",{type:"button","data-testid":"plan-review-comment",disabled:v||!b,onClick:()=>void x("comment"),className:"".concat(w," border-border bg-surface text-foreground hover:bg-muted dark:bg-surface-2"),children:i("planReview.comment")}),(0,r.jsx)("button",{type:"button","data-testid":"plan-review-submit",disabled:v,onClick:()=>void x("submit"),className:"".concat(w," border-border bg-surface text-foreground hover:bg-muted dark:bg-surface-2"),children:i("planReview.submit")}),(0,r.jsx)("button",{type:"button","data-testid":"plan-review-approve",disabled:v||d,onClick:()=>m(!0),className:"".concat(w," border-accent-500 bg-surface text-accent-600 hover:bg-muted dark:bg-surface-2 dark:text-accent-400"),children:i("planReview.approve")}),(0,r.jsx)("button",{type:"button","data-testid":"plan-review-cancel",disabled:v,onClick:()=>void x("cancel"),className:"".concat(w," border-border bg-surface text-foreground hover:bg-muted dark:bg-surface-2"),children:i("planReview.cancel")})]}),d?(0,r.jsxs)("div",{"data-testid":"plan-review-approve-confirm",role:"alertdialog","aria-label":i("planReview.approveConfirmLabel"),className:"space-y-1.5 rounded-md border border-warning-border bg-warning-subtle px-2 py-1.5",children:[(0,r.jsx)("p",{className:"text-xs text-foreground",children:i("planReview.approveConfirmText")}),(0,r.jsxs)("div",{className:"flex flex-wrap gap-1.5",children:[(0,r.jsx)("button",{type:"button","data-testid":"plan-review-approve-confirm-yes",disabled:v,onClick:()=>{m(!1),x("approve")},className:"".concat(w," border-accent-500 bg-accent-500 text-white"),children:i("planReview.approveConfirmYes")}),(0,r.jsx)("button",{type:"button","data-testid":"plan-review-approve-confirm-no",onClick:()=>m(!1),className:"".concat(w," border-border bg-surface text-foreground hover:bg-muted dark:bg-surface-2"),children:i("planReview.approveConfirmNo")})]})]}):null,h?(0,r.jsxs)("div",{"data-testid":"plan-review-error",role:"alert",className:"space-y-0.5 text-xs text-danger-foreground",children:[(0,r.jsx)("p",{children:i(y||"planReview.refusal.generic")}),h.message?(0,r.jsx)("p",{"data-testid":"plan-review-error-detail",children:h.message}):null]}):null]})}var eT=n(68276),eM=n(60199),eI=n(52703);let eE='[data-testid="'.concat(F,'"]'),eA={pager:"chatSurface.reasonPager",selectionList:"chatSurface.reasonSelectionList",dismissablePanel:"chatSurface.reasonDismissablePanel",unclassified:"chatSurface.reasonUnclassified",promptUnreadable:"chatSurface.reasonPromptUnreadable"},eL=(0,a.memo)(function(e){var t,n;let{messages:m,worktreeId:f,worktreePath:p,cliToolId:h,instanceId:g,live:x,onSurfaceModeChange:b,frame:v,onKeysSent:y,compact:w=!1,history:k,className:j=""}=e,N=(0,l.c)("worktree"),C=(0,a.useRef)(null),S=(0,a.useMemo)(()=>(function(e){let t=new Map;for(let n of e)t.set(n.id,n);return t.size===e.length?e:Array.from(t.values())})(m),[m]),T=!1===x.attaching&&!1===x.isRunning,I=(0,a.useRef)(!0),E=(0,a.useRef)(-1),[A,L]=(0,a.useState)(!1),[R,P]=(0,a.useState)(!0),O=(0,a.useCallback)(()=>{var e,t;return null!=(t=null==(e=C.current)?void 0:e.querySelector(eE))?t:null},[]),[z,F]=(0,a.useState)(!1),D=(0,a.useCallback)(e=>{F(null!==e)},[]),H=(0,a.useCallback)(()=>{let e=O();e&&(e.scrollTop=e.scrollHeight),I.current=!0,P(!0),L(!1)},[O]);(0,a.useEffect)(()=>{let e=O();if(!e)return;let t=()=>{let t=(0,M.Mp)({scrollTop:e.scrollTop,scrollHeight:e.scrollHeight,clientHeight:e.clientHeight});I.current=t,P(t),t&&L(!1)};return e.addEventListener("scroll",t),()=>e.removeEventListener("scroll",t)},[O,null==k?void 0:k.isLoading]),(0,a.useLayoutEffect)(()=>{let e=E.current,t=S.length;if(E.current=t,-1!==e&&!(t<=e)){if(I.current){let e=O();e&&(e.scrollTop=e.scrollHeight);return}L(!0)}},[S.length,O]);let B="running"===x.sessionStatus,q=function(e){let{worktreeId:t,cliToolId:n,instanceId:r,enabled:l=!0}=e,{addListener:s,connected:o}=(0,eM.xM)(),[i,c]=(0,a.useState)(null),u=(0,a.useRef)(0),d=null!=r?r:n;(0,a.useEffect)(()=>{u.current=0,c(null)},[t,n,d]),(0,a.useEffect)(()=>{l&&(u.current=0,c(null))},[l]),(0,a.useEffect)(()=>{!o&&l&&(u.current=0,c(null))},[o,l]),(0,a.useEffect)(()=>{if(l||null===i)return;let e=setTimeout(()=>c(null),6e5);return()=>clearTimeout(e)},[l,i]),(0,a.useEffect)(()=>{if(l&&void 0!==n)return s(e=>{e.type===eI.rz&&void 0!==n&&void 0!==d&&e.worktreeId===t&&e.cliToolId===n&&e.instanceId===d&&"string"==typeof e.turnKey&&0!==e.turnKey.length&&"string"==typeof e.body&&"number"==typeof e.version&&Number.isFinite(e.version)&&(e.version<=u.current||(u.current=e.version,c({turnKey:e.turnKey,body:e.body,partial:!0===e.partial,version:e.version,settling:!1})))})},[s,l,t,n,d]);let m=(0,a.useMemo)(()=>null===i?null:{...i,settling:!0},[i]);return l?o?i:null:m}({worktreeId:f,cliToolId:h,instanceId:g,enabled:B}),K=S.length?S[S.length-1].id:null,U=(null==q?void 0:q.settling)===!0,_=(0,a.useRef)(null),[$,J]=(0,a.useState)(!1);(0,a.useEffect)(()=>{if(!U){_.current=null,J(!1);return}if(null===_.current){_.current={id:K};return}_.current.id!==K&&J(!0)},[U,K]);let[Q,Y]=(0,a.useState)(null);(0,a.useEffect)(()=>{T&&null!==q&&Y(q.turnKey)},[T,q]);let G=null===q||q.turnKey===Q||function(e,t){for(let n=e.length-1;n>=0;n-=1)if(e[n].requestId===t)return!0;return!1}(S,q.turnKey)||q.settling&&$?null:q,V=(0,a.useMemo)(()=>T?null:null!==G?{turnKey:G.turnKey,version:G.version,body:G.body,partial:G.partial,isThinking:!G.settling&&!0===x.isThinking,settling:G.settling}:B?{isThinking:!0===x.isThinking}:null,[G,B,x.isThinking,T]),Z=null!==V,X=Z&&!0!==V.settling,ee=(0,a.useRef)(!1);(0,a.useLayoutEffect)(()=>{if(!ee.current){ee.current=!0;return}if(!I.current)return;let e=O();e&&(e.scrollTop=e.scrollHeight)},[null==G?void 0:G.body,Z,O]);let et=x.isPagerActive?"pager":x.isSelectionListActive?"selectionList":(null!=(n=x.isDismissablePanelActive)?n:(0,eo.gg)(v))?"dismissablePanel":x.isUnclassifiedActive?"unclassified":x.isPromptWaiting&&!(0,eT.XF)(x.promptData)?"promptUnreadable":null,en=(0,a.useCallback)(()=>{b("terminal")},[b]),er=(0,a.useRef)(null);(0,a.useEffect)(()=>()=>{null!==er.current&&clearTimeout(er.current)},[]);let ea=(0,a.useCallback)(()=>{null==y||y(),null!==er.current&&clearTimeout(er.current),er.current=setTimeout(()=>{er.current=null,null==y||y()},400)},[y]),el=(0,a.useMemo)(()=>"selectionList"===et?(0,eo.S$)(v):null,[et,v]),es=(0,a.useMemo)(()=>"selectionList"===et&&null!==(0,eo.Dk)(v),[et,v]),ei=(0,a.useMemo)(()=>"selectionList"===et&&v?ec(v,{selectionList:!0}).split("\n").length:0,[et,v]),eu=(0,a.useMemo)(()=>{if(null===et||!h)return null;let e={worktreeId:f,cliToolId:h,instanceId:g,onKeysSent:ea};switch(et){case"pager":return(0,r.jsx)(em.y,{...e,showPagerKeys:!0});case"selectionList":{let t=(null==el?void 0:el.offersSessionScope)===!0&&ep.qL.includes(h),n=(null==el?void 0:el.offersPlanApprove)===!0&&ep.oO.includes(h),a=(null==el?void 0:el.offersPlanApprove)===!0;return(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(em.y,{...e,hideEnterKey:a}),el&&!es&&(0,eo.xw)(el)?(0,r.jsx)(ew,{...e,optionCount:el.optionCount}):null,t&&el?(0,r.jsx)(ek,{...e,commitsDefaultOnEnter:el.commitsDefaultOnEnter}):null,n?(0,r.jsx)(eS,{...e}):null,(0,r.jsx)(eN.tY,{worktreeId:f,cliToolId:h,frame:v,instanceId:g,onKeysSent:ea})]})}case"dismissablePanel":return(0,r.jsx)(ej,{...e});case"unclassified":return(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(ef.U,{...e}),(0,r.jsx)(ey,{...e})]});case"promptUnreadable":return(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)("p",{"data-testid":"chat-surface-unreadable-hint",className:"text-xs text-muted-foreground",children:N("chatSurface.unreadableHint")}),(0,r.jsx)(ey,{...e})]})}},[et,h,f,g,ea,el,es,v,N]),eh=null!=k?k:{},eg=(0,u.UI)(f),ex=null!=(t=null!=g?g:h)?t:null,eb=(0,a.useMemo)(()=>ex?(0,d.y)((0,d.g)({owed:eg.owedBy(ex),awaiting:eg.awaitedBy(ex),aliasOf:e=>e.worktreeId===f?e.instanceId:"".concat(e.instanceId," @ ").concat(e.worktreeId)})):null,[eg,ex,f]);return(0,r.jsxs)("div",{ref:C,"data-testid":"chat-surface","data-instance-id":null!=g?g:h,className:["flex h-full min-h-0 w-full flex-col overflow-hidden bg-surface text-surface-foreground",j].filter(Boolean).join(" "),children:[eb&&(0,r.jsxs)("div",{"data-testid":"chat-surface-relay","data-relay-tone":eb.tone,role:"status",className:"flex shrink-0 items-center gap-1.5 border-b border-border px-3 py-1 text-xs ".concat("prompt"===eb.tone?"bg-warning-subtle text-warning-foreground":"bg-surface-2 text-muted-foreground"),children:[(0,r.jsx)(s.A,{size:12,className:"shrink-0","aria-hidden":"true"}),(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate",children:N("relay.".concat(eb.key),eb.params)})]}),(0,r.jsxs)("div",{className:"relative min-h-0 flex-1 overflow-hidden",children:[(0,r.jsx)(W,{...eh,messages:S,worktreeId:f,worktreePath:p,cliToolId:h,liveTurn:V,instanceId:g,sessionEnded:T,onScrollControlsChange:D,className:"h-full"}),!z&&(A||Z&&!R)&&(0,r.jsxs)("button",{type:"button","data-testid":"chat-surface-new-messages","data-generating":X?"true":void 0,onClick:H,"aria-label":X?N("chatSurface.jumpToLatestGenerating"):void 0,className:"absolute bottom-3 left-1/2 z-10 flex min-h-[36px] -translate-x-1/2 items-center gap-1.5 rounded-full border border-border bg-surface-2 px-3 py-1.5 text-xs font-medium text-foreground shadow-lg transition-colors hover:bg-muted focus:outline-none focus-visible:ring-2 focus-visible:ring-ring touch-manipulation",children:[X?(0,r.jsx)(o.A,{size:14,className:"animate-spin","aria-hidden":"true"}):(0,r.jsx)(i.A,{size:14,"aria-hidden":"true"}),N("chatSurface.jumpToLatest")]})]}),null!==et&&(0,r.jsxs)("div",{"data-testid":"chat-surface-live",role:"group","aria-label":N("chatSurface.liveRegionLabel"),className:"flex shrink-0 flex-col gap-2 border-t border-border bg-surface px-3 py-2",children:[(0,r.jsxs)("div",{"data-testid":"chat-surface-terminal-banner","data-reason":et,role:"status","aria-label":N("chatSurface.bannerLabel"),className:"flex flex-wrap items-center gap-2 rounded-lg border border-warning-border bg-warning-subtle px-2 py-1.5",children:[(0,r.jsx)("span",{className:"min-w-0 flex-1 text-xs text-foreground",children:N(eA[et])}),(0,r.jsxs)("button",{type:"button","data-testid":"chat-surface-open-terminal",onClick:en,className:"flex min-h-[32px] shrink-0 items-center gap-1 rounded-md border border-warning-border bg-surface px-2 py-1 text-xs font-medium text-warning-foreground transition-colors hover:bg-muted focus:outline-none focus-visible:ring-2 focus-visible:ring-ring touch-manipulation",children:[(0,r.jsx)(c.A,{size:14,"aria-hidden":"true"}),N("chatSurface.openTerminal")]})]}),v?(0,r.jsx)(ed,{frame:v,reason:et,maxLines:w?12:void 0,maxHeightClassName:ei>24?"max-h-[35vh]":w?"max-h-32":"max-h-64",actions:eu}):null]})]})})},9708:(e,t,n)=>{n.d(t,{O:()=>o,k:()=>s});var r=n(12115);let a=Object.freeze({}),l=(0,r.createContext)(a),s=l.Provider;function o(){return(0,r.useContext)(l)}},14006:(e,t,n)=>{n.d(t,{D:()=>b});var r=n(95155),a=n(12115),l=n(18955),s=n(20562),o=n(8803),i=n(78596),c=n(68872);let u=/\x1b(?:\[[0-9;?]*)?$/;var d=n(51515);function m(e){return""===(0,d.aJ)(e).trim()}var f=n(18341),p=n(78660);function h(e){let{query:t,onQueryChange:n,matchCount:l,currentIndex:s,onNext:o,onPrev:i,onClose:c,isAtMaxMatches:u=!1}=e,d=(0,a.useRef)(null);(0,a.useEffect)(()=>{var e;null==(e=d.current)||e.focus()},[]);let m=(0,a.useCallback)(e=>{"Escape"===e.key&&c()},[c]),f=(0,a.useCallback)(e=>{n(e.target.value)},[n]),h=0===l?"0/0":u?"".concat(s+1,"/").concat(p.F0,"以上"):"".concat(s+1,"/").concat(l);return(0,r.jsxs)("div",{className:"flex items-center gap-1 px-2 py-1 bg-gray-800 border border-gray-600 rounded shadow-lg",role:"search","aria-label":"ターミナル内テキスト検索",children:[(0,r.jsx)("input",{ref:d,type:"text",value:t,onChange:f,onKeyDown:m,placeholder:"検索...",className:"bg-transparent text-gray-200 text-sm outline-none w-32 sm:w-40 placeholder-gray-500","aria-label":"検索キーワード",autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1}),(0,r.jsx)("span",{role:"status","aria-live":"polite","aria-atomic":"true",className:"text-gray-400 text-xs min-w-[3rem] text-right",children:h}),(0,r.jsx)("button",{onClick:i,disabled:0===l,"aria-label":"前の結果",className:"text-gray-300 hover:text-white disabled:text-gray-600 min-w-[36px] min-h-[36px] flex items-center justify-center text-base",children:"▲"}),(0,r.jsx)("button",{onClick:o,disabled:0===l,"aria-label":"次の結果",className:"text-gray-300 hover:text-white disabled:text-gray-600 min-w-[36px] min-h-[36px] flex items-center justify-center text-base",children:"▼"}),(0,r.jsx)("button",{onClick:c,"aria-label":"検索を閉じる",className:"text-gray-400 hover:text-white min-w-[36px] min-h-[36px] flex items-center justify-center text-base ml-1",children:"✕"})]})}var g=n(68394);function x(){return(0,r.jsxs)("div",{"data-testid":"thinking-indicator",className:"flex items-center gap-2 py-2 px-1 text-gray-400",children:[(0,r.jsxs)("span",{className:"flex gap-1",children:[(0,r.jsx)("span",{className:"animate-pulse delay-0",children:"."}),(0,r.jsx)("span",{className:"animate-pulse delay-150",children:"."}),(0,r.jsx)("span",{className:"animate-pulse delay-300",children:"."})]}),(0,r.jsx)("span",{className:"text-sm",children:"Thinking"})]})}let b=(0,a.memo)(function(e){let{output:t,isActive:n,attaching:b=!1,isThinking:v=!1,autoScroll:y=!0,onScrollChange:w,disableAutoFollow:k=!1,compactTuiLayoutPadding:j=!1,preservePaintedPanelRows:N=!1,wrapMode:C="viewport",density:S="regular",searchBarTopClassName:T="top-2",className:M=""}=e,I=(0,l.c)("worktree"),{scrollRef:E,autoScroll:A,handleScroll:L,scrollToBottom:R,scrollToTop:P}=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{initialAutoScroll:t=!0,onAutoScrollChange:n}=e,r=(0,a.useRef)(null),[l,s]=(0,a.useState)(t),o=(0,a.useRef)(!1),i=(0,a.useRef)(null);(0,a.useEffect)(()=>()=>{i.current&&clearTimeout(i.current)},[]);let c=(0,a.useCallback)(e=>{s(e),null==n||n(e)},[n]),u=(0,a.useCallback)(()=>{let e=r.current;if(!e)return!0;let{scrollTop:t,scrollHeight:n,clientHeight:a}=e;return n-a-t<=50},[]),d=(0,a.useCallback)(()=>{if(o.current)return;let e=u();e&&!l?c(!0):!e&&l&&c(!1)},[l,u,c]),m=(0,a.useCallback)(()=>{let e=r.current;e&&(o.current=!0,e.scrollTo({top:e.scrollHeight,behavior:"smooth"}),l||c(!0),i.current=setTimeout(()=>{o.current=!1,i.current=null},500))},[l,c]),f=(0,a.useCallback)(()=>{let e=r.current;e&&(o.current=!0,e.scrollTo({top:0,behavior:"smooth"}),l&&c(!1),i.current=setTimeout(()=>{o.current=!1,i.current=null},500))},[l,c]);return{scrollRef:r,autoScroll:l,setAutoScroll:c,scrollToBottom:m,scrollToTop:f,handleScroll:d}}({initialAutoScroll:y,onAutoScrollChange:w}),O=null!=t?t:"",z=(0,a.useMemo)(()=>j?N?(0,f.Dk)(O):function(e){if(""===e)return"";let t=e.split("\n"),n=[],r=!1,a=0;for(;a<t.length;){if(!m(t[a])){n.push(t[a]),r=!0,a++;continue}let e=a;for(;e<t.length&&m(t[e]);)e++;let l=e-a,s=!r,o=e>=t.length;if(!s&&!o)if(l<=2)for(let r=a;r<e;r++)n.push(t[r]);else n.push((0,d.x6)(t.slice(a,e).join("")));a=e}return n.join("\n")}(O):O,[j,N,O]),F=(0,a.useMemo)(()=>{if("frame"===C)return{minWidth:"".concat((0,g.pN)(z),"ch")}},[C,z]),{isOpen:D,query:H,matchCount:B,currentIndex:q,isAtMaxMatches:K,openSearch:U,closeSearch:_,setQuery:W,nextMatch:$,prevMatch:J}=(0,p.Yr)({output:z,containerRef:E}),Q=(0,a.useCallback)(e=>{(e.ctrlKey||e.metaKey)&&"f"===e.key&&(e.preventDefault(),U())},[U]);(0,a.useEffect)(()=>{let e=()=>U();return window.addEventListener("terminal-search-open",e),()=>window.removeEventListener("terminal-search-open",e)},[U]);let[Y,G]=(0,a.useState)(()=>z?[{key:0,html:(0,i.l5)(z)}]:[]),V=(0,a.useRef)(z),Z=(0,a.useRef)(0);(0,a.useEffect)(()=>{let e=function(e,t){if(e===t)return{mode:"noop",text:t,appended:"",retainedLength:e.length};if(0===e.length||t.length<=e.length||!t.startsWith(e))return{mode:"replace",text:t,appended:"",retainedLength:0};let n=e.match(u),r=n?e.length-n[0].length:e.length;return{mode:"append",text:t,appended:t.slice(r),retainedLength:r}}(V.current,z);if(V.current=z,"noop"===e.mode)return;let t="append"===e.mode&&e.appended.length>c.ZJ;if("append"===e.mode&&!t)return void G(t=>(Z.current+=1,t.length>=400)?[{key:Z.current,html:(0,i.l5)(z)}]:[...t,{key:Z.current,html:(0,i.l5)(e.appended)}]);Z.current+=1,G(z?[{key:Z.current,html:(0,i.l5)(z)}]:[])},[z]);let[X,ee]=(0,a.useState)(!1);(0,a.useEffect)(()=>{b?ee(!1):n&&ee(!0)},[b,n]);let et=!t,en=et&&b,er=et&&!b&&!n&&X,ea=(0,a.useRef)(!1);(0,a.useEffect)(()=>{k&&(ea.current=!0)},[k]),(0,a.useEffect)(()=>{if(E.current){if(ea.current&&k&&z){E.current.scrollTo({top:0,behavior:"instant"}),ea.current=!1;return}!k&&A&&E.current.scrollTo({top:E.current.scrollHeight,behavior:"instant"})}},[Y,z,A,k,E]);let el=(0,a.useMemo)(()=>["terminal","font-mono","compact"===S?"text-xs":"text-sm","compact"===S?"p-2":"p-4","rounded-lg","overflow-y-auto","frame"===C?"overflow-x-auto":"overflow-x-hidden","bg-gray-900","text-gray-300","border","border-gray-700","h-full",n?"active":"",M].filter(Boolean).join(" "),[n,M,C,S]),[es,eo]=(0,a.useState)(!1),ei=(0,a.useRef)(null),ec=(0,a.useCallback)(()=>{eo(!0),ei.current&&clearTimeout(ei.current),ei.current=setTimeout(()=>eo(!1),1500)},[]);(0,a.useEffect)(()=>()=>{ei.current&&clearTimeout(ei.current)},[]);let eu=(0,a.useCallback)(()=>{L(),ec()},[L,ec]),ed=["absolute bottom-4 right-4 flex items-center justify-center h-9 w-9 rounded-full bg-surface/80 backdrop-blur border border-border text-muted-foreground shadow-lg transition-opacity hover:text-surface-foreground hover:opacity-100 focus-visible:opacity-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",es?"opacity-100":"opacity-60"].join(" ");return(0,r.jsxs)("div",{className:"relative h-full flex flex-col",children:[D&&(0,r.jsx)("div",{className:"absolute ".concat(T," right-2 z-10"),children:(0,r.jsx)(h,{query:H,onQueryChange:W,matchCount:B,currentIndex:q,onNext:$,onPrev:J,onClose:_,isAtMaxMatches:K})}),(0,r.jsxs)("div",{ref:E,role:"log","aria-live":"polite","aria-label":"Terminal output",className:el,onScroll:eu,onKeyDown:Q,tabIndex:0,children:[(0,r.jsx)("div",{className:"frame"===C?"whitespace-pre w-max":"whitespace-pre-wrap break-words",style:F,children:Y.map(e=>(0,r.jsx)("span",{dangerouslySetInnerHTML:{__html:e.html}},e.key))}),en&&(0,r.jsx)("div",{"data-testid":"terminal-loading-placeholder",className:"flex h-full items-center justify-center px-4 text-center text-sm text-gray-500 select-none",children:I("terminal.loading")}),er&&(0,r.jsx)("div",{"data-testid":"terminal-ended-placeholder",className:"flex h-full items-center justify-center px-4 text-center text-sm text-gray-500 select-none",children:I("terminal.sessionEnded")}),n&&v&&(0,r.jsx)(x,{})]}),A?(0,r.jsx)("button",{type:"button",onClick:P,className:ed,"aria-label":"Scroll to top",children:(0,r.jsx)(s.A,{size:16,"aria-hidden":"true"})}):(0,r.jsx)("button",{type:"button",onClick:R,className:ed,"aria-label":"Scroll to bottom",children:(0,r.jsx)(o.A,{size:16,"aria-hidden":"true"})})]})})},16342:(e,t,n)=>{n.d(t,{LQ:()=>s,Ml:()=>l,sh:()=>a});let r=RegExp("^\\p{M}$","u");function a(e,t){if(e.length<=t)return e.length;let n=0,a=0;for(let l of e){let e=+!r.test(l);if(1===e&&n>=t)break;n+=e,a+=l.length}return a}function l(e,t,n){return e.slice(a(e,t),a(e,n))}function s(e){let t=0;for(let n of e)r.test(n)||(t+=1);return t}},18341:(e,t,n)=>{n.d(t,{CG:()=>s,Dk:()=>i,Uw:()=>o});var r=n(51515);let a=/\x1b\[([0-9;]*)m/g;function l(e){return""===(0,r.aJ)(e).trim()}function s(e){return l(e)&&""!==(0,r.aJ)(e)&&function(e){let t;for(a.lastIndex=0;null!==(t=a.exec(e));)if(function(e){let t=0;for(;t<e.length;){let n=e[t];if(38===n||48===n||58===n){if(48===n)return!0;let r=e[t+1];t+=5===r?3:2===r?5:2;continue}if(n>=40&&n<=47||n>=100&&n<=107)return!0;t+=1}return!1}(t[1].split(";").filter(e=>""!==e).map(e=>Number(e)).filter(e=>Number.isInteger(e))))return!0;return!1}(e)}function o(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(""===e)return"";let{isStructuralRow:n}=t,a=e.split("\n"),s=[],o=!1,i=0,c=e=>{var t;return l(e)&&!(null!=(t=null==n?void 0:n(e))&&t)};for(;i<a.length;){if(!c(a[i])){s.push(a[i]),o=!0,i++;continue}let e=i;for(;e<a.length&&c(a[e]);)e++;let t=e-i,n=!o,l=e>=a.length;if(!n&&!l)if(t<=2)for(let t=i;t<e;t++)s.push(a[t]);else s.push((0,r.x6)(a.slice(i,e).join("")));i=e}return s.join("\n")}function i(e){return o(e,{isStructuralRow:s})}},19985:(e,t,n)=>{n.d(t,{F5:()=>c,Fg:()=>a,HB:()=>s,Hv:()=>i,df:()=>o});let r=[".png",".jpg",".jpeg",".gif",".webp",".svg"],a=0x1400000,l=[{extension:".png",mimeType:"image/png",magicBytes:[137,80,78,71]},{extension:".jpg",mimeType:"image/jpeg",magicBytes:[255,216,255]},{extension:".jpeg",mimeType:"image/jpeg",magicBytes:[255,216,255]},{extension:".gif",mimeType:"image/gif",magicBytes:[71,73,70,56]},{extension:".webp",mimeType:"image/webp",magicBytes:[82,73,70,70]},{extension:".svg",mimeType:"image/svg+xml"}];function s(e){return e?e.startsWith(".")?e.toLowerCase():"."+e.toLowerCase():""}function o(e){if(!e)return!1;let t=s(e);return r.includes(t)}let i=r.filter(e=>".svg"!==e),c=i.map(e=>(function(e){let t=s(e),n=l.find(e=>e.extension===t);return(null==n?void 0:n.mimeType)||"application/octet-stream"})(e)).filter(e=>"application/octet-stream"!==e).join(",")},20877:(e,t,n)=>{n.d(t,{Gg:()=>f,Gw:()=>a,HI:()=>u,aX:()=>d,eu:()=>l,fq:()=>m});let r={highlightName:"terminal-search",currentHighlightName:"terminal-search-current",fallbackOverlayId:"terminal-search-fallback-overlay",fallbackOverlayBgColor:"rgba(255, 165, 0, 0.6)"},a={highlightName:"history-search",currentHighlightName:"history-search-current",fallbackOverlayId:"history-search-fallback-overlay",fallbackOverlayBgColor:"rgba(59, 130, 246, 0.6)"};function l(e){return{highlightName:"history-search-".concat(e),currentHighlightName:"history-search-current-".concat(e),fallbackOverlayId:"history-search-fallback-overlay-".concat(e),fallbackOverlayBgColor:a.fallbackOverlayBgColor}}function s(){return"undefined"!=typeof CSS&&null!==CSS&&"highlights"in CSS}function o(e,t,n){let r=document.createRange(),a=!1;for(let{node:l,start:s,end:o}of e)if(!a&&t<o&&t>=s&&(r.setStart(l,t-s),a=!0),a&&n<=o)return r.setEnd(l,n-s),r;return a?r:null}function i(e){var t;s()&&(CSS.highlights.delete(e.highlightName),CSS.highlights.delete(e.currentHighlightName)),null==(t=document.getElementById(e.fallbackOverlayId))||t.remove()}function c(e,t,n,r){if(0===t.length)return void i(r);let a=function(e){let t,n=[],r=0,a=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(;t=a.nextNode();){var l,s;let e=null!=(s=null==(l=t.nodeValue)?void 0:l.length)?s:0;n.push({node:t,start:r,end:r+e}),r+=e}return n}(e),l=t[n],c=l?o(a,l.start,l.end):null;if(s()){let e=[];t.forEach((t,r)=>{if(r===n)return;let l=o(a,t.start,t.end);l&&e.push(l)}),CSS.highlights.set(r.highlightName,new Highlight(...e)),CSS.highlights.delete(r.currentHighlightName)}if(function(e,t,n){let r=document.getElementById(n.fallbackOverlayId);if(!t||"function"!=typeof t.getBoundingClientRect){null==r||r.remove();return}let a=t.getBoundingClientRect(),l=e.getBoundingClientRect();r?r.style.backgroundColor=n.fallbackOverlayBgColor:((r=document.createElement("div")).id=n.fallbackOverlayId,r.style.position="absolute",r.style.backgroundColor=n.fallbackOverlayBgColor,r.style.borderRadius="2px",r.style.pointerEvents="none",r.style.zIndex="5",e instanceof HTMLElement&&(e.style.position="relative"),e.appendChild(r)),r.style.top="".concat(a.top-l.top+e.scrollTop,"px"),r.style.left="".concat(a.left-l.left+e.scrollLeft,"px"),r.style.width="".concat(a.width,"px"),r.style.height="".concat(a.height,"px")}(e,c,r),c){let e=c.startContainer,t=e.nodeType===Node.TEXT_NODE?e.parentElement:e;t&&"function"==typeof t.scrollIntoView&&t.scrollIntoView({block:"center",behavior:"smooth"})}}function u(){i(r)}function d(e,t,n){c(e,t,n,r)}function m(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:a;i(e)}function f(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:a;c(e,t,n,r)}},23570:(e,t,n)=>{n.d(t,{cV:()=>c,g6:()=>i});var r=n(95155),a=n(12115),l=n(87364),s=n(81507),o=n(72115);let i="worktree-history-pane",c=(0,a.memo)(function(e){let{history:t,terminal:n}=e,{visible:c,width:u,setWidth:d}=(0,s.TG)(),m=(0,a.useRef)(null),f=(0,a.useCallback)(e=>{let t=m.current;if(!t)return;let n=t.offsetWidth;0!==n&&d(u+e/n*100)},[u,d]);return(0,r.jsxs)("div",{ref:m,className:"flex h-full min-h-0 w-full",children:[null!=t&&(c?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{id:i,"data-testid":"terminal-container-history-slot","aria-label":"History pane",style:{width:"".concat(u,"%")},className:"flex-shrink-0 overflow-hidden transition-[width] duration-200 ease-in-out",children:(0,r.jsx)(l.t,{componentName:"HistoryPane",children:t})}),(0,r.jsx)(o.f,{onResize:f,orientation:"horizontal",ariaValueNow:u})]}):null),(0,r.jsx)("div",{"data-testid":"terminal-container-terminal-slot","aria-label":"Terminal pane",className:"flex-grow overflow-hidden min-w-0",children:(0,r.jsx)(l.t,{componentName:"TerminalAndFilePanel",children:n})})]})})},26788:(e,t,n)=>{n.d(t,{Af:()=>p});var r=n(12115);let a="commandmate:chatShowToolActivity";function l(){try{return"true"===window.localStorage.getItem(a)}catch(e){return!1}}let s=null,o=new Set;function i(){for(let e of Array.from(o))e()}function c(){return null===s&&(s=l()),s}function u(){return!1}function d(e){(null===e.key||e.key===a)&&(s=l(),i())}function m(e){return o.add(e),1===o.size&&window.addEventListener("storage",d),()=>{o.delete(e),0===o.size&&(window.removeEventListener("storage",d),s=null)}}function f(){let e=!c();s=e;try{window.localStorage.setItem(a,String(e))}catch(e){}i()}function p(){return[(0,r.useSyncExternalStore)(m,c,u),f]}},32293:(e,t,n)=>{n.d(t,{CL:()=>J,Et:()=>X,UI:()=>V,a3:()=>Q,vY:()=>en,ZS:()=>eu,Gn:()=>eg,qI:()=>ey,PZ:()=>et,ZK:()=>ev,t_:()=>ei});var r,a,l=n(95155),s=n(12115),o=n(18955),i=n(24033),c=n(27937),u=n(1473),d=n(53842),m=n(22479),f=n(76907),p=n(49502),h=n(35299),g=n(6132),x=n(48314),b=n(65229),v=n(75426),y=n(82437),w=n(54916),k=n(51238),j=n(9567),N=n(10934),C=n(5225),S=n(4300),T=n(83012),M=n(51515),I=n(89568),E=n(99112),A=n(70738),L=n(41253),R=n(42196),P=n(38021);function O(e){let{src:t,alt:n,kind:r,onFilePathClick:a}=e,s=(0,o.c)("worktree"),i=n||s("conversation.imageUnavailable"),c=null;return"external"===r?c=(0,l.jsx)("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"break-all underline",children:t}):"file"===r?c=(0,l.jsx)(eu,{href:t,onFilePathClick:a,children:t}):t&&(c=(0,l.jsx)("span",{className:"break-all font-mono text-xs",children:t})),(0,l.jsxs)("span",{"data-testid":"chat-image-fallback",className:"inline-flex max-w-full flex-wrap items-center gap-1 align-middle text-muted-foreground",children:[(0,l.jsx)(R.A,{size:14,"aria-hidden":"true",className:"shrink-0"}),(0,l.jsx)("span",{children:i}),c]})}let z=(0,s.memo)(function(e){var t;let{src:n,alt:r,onFilePathClick:a}=e,i=(0,o.c)("worktree"),{worktreeId:c,worktreePath:u}=(0,L.hu)(),d=(0,L.HA)(n,u),m=null!=r?r:"",f=null!=(t=null==n?void 0:n.trim())?t:"",p=(0,s.useCallback)(()=>a(f),[a,f]);if("worktree"!==d.kind||!c){let e="worktree"===d.kind?"file":d.kind;return(0,l.jsx)(O,{src:f,alt:m,kind:e,onFilePathClick:a})}return(0,l.jsx)(P.n,{apiUrl:(0,L.Fo)(c,d.path),alt:m,lazy:!0,loadingFallback:(0,l.jsx)("span",{"data-testid":"chat-image-loading",className:"flex h-40 w-full max-w-sm items-center justify-center rounded-md border border-border bg-muted text-xs text-muted-foreground",children:i("conversation.imageLoading")}),errorFallback:(0,l.jsx)(O,{src:f,alt:m,kind:"file",onFilePathClick:a}),className:"block h-auto max-w-full rounded-md border border-border object-contain",style:{maxHeight:320},wrap:e=>(0,l.jsx)("button",{type:"button","data-testid":"chat-image",onClick:p,className:"block max-w-full cursor-pointer","aria-label":i("conversation.openImage",{path:d.path}),children:e})},d.path)});var F=n(19985);let D=[".mp4"],H=(0,s.memo)(function(e){let{target:t,label:n,fallback:r,onFilePathClick:a}=e,i=(0,o.c)("worktree"),{worktreeId:c,worktreePath:u}=(0,L.hu)(),[d,m]=(0,s.useState)(!1),f=function(e,t){if("string"!=typeof e||!e.trim()||"file"!==(0,A.z)(e))return null;let n=(0,A.h)(e,t);return null===n||n.startsWith("/")||!function(e){if(!e)return!1;let t=(0,F.HB)(e);return D.includes(t)}(function(e){let t=e.slice(e.lastIndexOf("/")+1),n=t.lastIndexOf(".");return n>0?t.slice(n):""}(n))?null:n}(t,u);if(!f||!c||!t)return(0,l.jsx)(l.Fragment,{children:r});let p=t.trim(),h=(0,l.jsx)(eu,{href:p,onFilePathClick:a,children:n});return d?h:(0,l.jsxs)("span",{className:"my-1 block w-full",children:[(0,l.jsx)("video",{"data-testid":"chat-video",controls:!0,preload:"none",src:"".concat((0,L.Fo)(c,f),"?raw=1"),"aria-label":i("conversation.videoLabel",{path:f}),onError:()=>m(!0),className:"block w-full rounded-md border border-border bg-black",style:{maxHeight:360}},f),(0,l.jsx)("span",{className:"mt-1 block break-all text-xs",children:h})]})}),B=/^>[ \t]*\*\*Thinking(?:[ \t]*\((\d+)\))?\*\*[ \t]*$/,q="Tool calls",K=new RegExp("^>[ \\t]*\\*\\*".concat(q,"(?:[ \\t]*\\((\\d+)\\))?\\*\\*[ \\t]*$")),U=/^- `[^`\n]+`(?: — .*)?$/;function _(e){return{prose:e,toolLog:"",toolCalls:0}}function W(e){let t=function(e){if("string"!=typeof e||0===e.length)return _(null!=e?e:"");if(!e.includes(q)&&!e.startsWith("- `"))return _(e);let t=e.split("\n"),n=t.length;for(;n>0&&0===t[n-1].trim().length;)n-=1;for(let e=n-1;e>=0;e-=1){let r=K.exec(t[e]);if(!r){if(!t[e].startsWith(">"))break;continue}if(e>0&&t[e-1].startsWith(">"))break;let a=t.slice(e+1,n).map(e=>e.replace(/^>[ \t]?/,"")).join("\n").replace(/^\n+/,"").replace(/\n+$/,""),l=r[1]?Number.parseInt(r[1],10):0;return{prose:t.slice(0,e).join("\n").replace(/\n+$/,""),toolLog:a,toolCalls:Number.isFinite(l)&&l>0?l:a.split("\n").filter(e=>e.trim().length>0).length}}let r=0;for(;r<t.length&&U.test(t[r]);)r+=1;return 0===r?_(e):{prose:t.slice(r).join("\n").replace(/^\n+/,""),toolLog:t.slice(0,r).join("\n"),toolCalls:r}}(e),n=function(e){if(!e.includes("Thinking"))return{body:e,reasoning:null,blocks:0};let t=e.split("\n"),n=[],r=[],a=0,l=0;for(;l<t.length;){let e=B.exec(t[l]),s=0===l||!t[l-1].startsWith(">");if(!e||!s){n.push(t[l]),l+=1;continue}let o=l+1;for(;o<t.length&&t[o].startsWith(">");)o+=1;let i=e[1]?Number.parseInt(e[1],10):1;a+=Number.isFinite(i)&&i>0?i:1,r.push(t.slice(l+1,o).map(e=>e.replace(/^>[ \t]?/,"")).join("\n").replace(/^\n+/,"").replace(/\n+$/,"")),l=o}return 0===a?{body:e,reasoning:null,blocks:0}:{body:n.join("\n").replace(/\n{3,}/g,"\n\n").trim(),reasoning:r.join("\n\n").replace(/^\n+/,"").replace(/\n+$/,""),blocks:a}}(t.prose);return{body:n.body,reasoning:n.reasoning,reasoningBlocks:n.blocks,toolLog:t.toolLog,toolCalls:t.toolCalls,folded:t.prose!==e||null!==n.reasoning}}var $=n(92147);let J="mr-auto w-full max-w-full px-1 text-sm text-foreground",Q="chat-bubble",Y="chat-turn-header",G="chat-turn-time",V="flex w-full flex-col gap-1 pb-3",Z="max-w-full overflow-x-hidden break-words [word-break:break-word]",X="".concat(Z," chat-md"),ee=s.createContext({showAll:!1}),et=ee.Provider,en={showAll:!0},er="mr-auto flex w-fit max-w-full items-center gap-1.5 rounded-full border border-border bg-surface-2 px-2.5 py-1 text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-ring";function ea(){let{showAll:e}=s.useContext(ee),[t,n]=(0,s.useState)(null),r=null!==t&&t.against===e?t.isOpen:e,a=(0,s.useCallback)(()=>n({against:e,isOpen:!r}),[e,r]);return{isOpen:r,toggle:a}}let el=(0,s.memo)(function(e){let{blocks:t,children:n}=e,r=(0,o.c)("worktree"),{isOpen:a,toggle:s}=ea(),d=a?i.A:c.A;return(0,l.jsxs)("div",{"data-testid":"chat-thinking-group","data-thinking-blocks":t,className:"mt-2 flex w-full flex-col gap-1",children:[(0,l.jsxs)("button",{type:"button","data-testid":"chat-thinking-toggle",onClick:s,"aria-expanded":a,"aria-label":r(a?"chatTranscript.thinking.collapse":"chatTranscript.thinking.expand"),className:er,children:[(0,l.jsx)(u.A,{size:12,"aria-hidden":"true"}),(0,l.jsx)("span",{children:r("chatTranscript.thinking.summary",{count:t})}),(0,l.jsx)(d,{size:12,"aria-hidden":"true"})]}),a&&(0,l.jsx)("div",{"data-testid":"chat-thinking-body",className:"max-w-full border-l-2 border-border pl-2 text-muted-foreground",children:n})]})}),es=(0,s.memo)(function(e){let{toolCalls:t,children:n}=e,r=(0,o.c)("worktree"),{isOpen:a,toggle:s}=ea(),u=a?i.A:c.A;return(0,l.jsxs)("div",{"data-testid":"chat-tool-log-group","data-tool-calls":t,className:"mt-2 flex w-full flex-col gap-1",children:[(0,l.jsxs)("button",{type:"button","data-testid":"chat-tool-log-toggle",onClick:s,"aria-expanded":a,"aria-label":r(a?"chatTranscript.toolLog.collapse":"chatTranscript.toolLog.expand"),className:er,children:[(0,l.jsx)(d.A,{size:12,"aria-hidden":"true"}),(0,l.jsx)("span",{children:r("chatTranscript.toolLog.summary",{count:t})}),(0,l.jsx)(u,{size:12,"aria-hidden":"true"})]}),a&&(0,l.jsx)("div",{"data-testid":"chat-tool-log-body",className:"max-w-full border-l-2 border-border pl-2 text-muted-foreground",children:n})]})}),eo={claude:!0,codex:!0,antigravity:!0,"command-code":!0,opencode:!0,copilot:!1,gemini:!1,"vibe-local":!1,"opencode-v2":!0};function ei(e){var t;return"assistant"===e.role&&"normal"===e.messageType&&("string"!=typeof e.requestId||!(e.requestId.length>0))&&!0===eo[null!=(t=e.cliToolId)?t:"claude"]}let ec=(0,s.memo)(function(e){let{children:t}=e,n=(0,o.c)("worktree"),{isOpen:r,toggle:a}=ea(),s=r?i.A:c.A;return(0,l.jsxs)("div",{"data-testid":"chat-pane-scrape-group",className:"flex w-full flex-col gap-1",children:[(0,l.jsxs)("button",{type:"button","data-testid":"chat-pane-scrape-toggle",onClick:a,"aria-expanded":r,className:er,children:[(0,l.jsx)(m.A,{size:12,"aria-hidden":"true"}),(0,l.jsx)("span",{children:n("agentSource.kindScraper")}),(0,l.jsx)(s,{size:12,"aria-hidden":"true"})]}),r&&(0,l.jsx)("div",{"data-testid":"chat-pane-scrape-body",className:"max-w-full border-l-2 border-border pl-2 text-muted-foreground",children:t})]})}),eu=(0,s.memo)(function(e){var t;let{href:n,children:r,onFilePathClick:a,...i}=e,c=(0,o.c)("worktree"),u=n?(0,A.z)(n):null,d=(0,s.useCallback)(e=>{n&&(e.preventDefault(),a(n))},[n,a]);return n&&null!==u&&"anchor"!==u?"external"===u?(0,l.jsx)("a",{...i,href:n,target:"_blank",rel:"noopener noreferrer",children:r}):(0,l.jsx)("a",{...i,href:n,"data-testid":"chat-file-link",onClick:d,className:"cursor-pointer font-mono text-sm text-accent-700 underline-offset-2 hover:underline dark:text-accent-400","aria-label":c("conversation.openFile",{path:null!=(t=(0,A.h)(n))?t:n}),children:r}):(0,l.jsx)("a",{...i,href:n,children:r})}),ed=(0,s.memo)(function(e){let{content:t,onFilePathClick:n}=e,r=(0,o.c)("worktree"),a=(0,s.useMemo)(()=>(0,I.ML)(t),[t]),i=(0,s.useCallback)(e=>()=>n(e),[n]);return(0,l.jsx)("span",{children:a.map((e,t)=>"path"===e.type?(0,l.jsx)("button",{type:"button",onClick:i(e.content),className:"cursor-pointer font-mono text-sm text-accent-700 underline-offset-2 hover:underline dark:text-accent-400","aria-label":r("conversation.openFile",{path:e.content}),children:e.content},t):(0,l.jsx)("span",{children:e.content},t))})}),em=(0,s.memo)(function(e){let{content:t,onFilePathClick:n}=e,{worktreePath:r}=(0,L.hu)(),a=(0,s.useMemo)(()=>(0,L.AW)(t,r),[t,r]);return a.every(e=>"text"===e.type)?(0,l.jsx)(ed,{content:t,onFilePathClick:n}):(0,l.jsx)("span",{children:a.map((e,t)=>"image"===e.type?(0,l.jsx)("span",{className:"my-1 block",children:(0,l.jsx)(z,{src:e.src,alt:e.alt,onFilePathClick:n})},t):(0,l.jsx)(ed,{content:e.content,onFilePathClick:n},t))})}),ef=/^file:\/\//i,ep=(e,t)=>"src"===t&&ef.test(e)?e:(0,k.Lv)(e),eh={...j.j,protocols:{...j.j.protocols,src:[...null!=(a=null==(r=j.j.protocols)?void 0:r.src)?a:[],"file"]}},eg=(0,s.memo)(function(e){let{content:t,onFilePathClick:n}=e,r=(0,s.useMemo)(()=>{let e=e=>s.Children.map(e,e=>"string"==typeof e?(0,l.jsx)(ed,{content:e,onFilePathClick:n}):e);return{p:t=>{let{children:n}=t;return(0,l.jsx)("p",{children:e(n)})},li:t=>{let{children:n}=t;return(0,l.jsx)("li",{children:e(n)})},td:t=>{let{children:n}=t;return(0,l.jsx)("td",{children:e(n)})},th:t=>{let{children:n}=t;return(0,l.jsx)("th",{children:e(n)})},strong:t=>{let{children:n}=t;return(0,l.jsx)("strong",{children:e(n)})},em:t=>{let{children:n}=t;return(0,l.jsx)("em",{children:e(n)})},a:e=>{let{href:t,children:r,node:a,...s}=e,o=(0,l.jsx)(eu,{...s,href:t,onFilePathClick:n,children:r});return(0,l.jsx)(H,{target:t,label:r,fallback:o,onFilePathClick:n})},img:e=>{let{src:t,alt:r}=e,a="string"==typeof t?t:void 0;return(0,l.jsx)(H,{target:a,label:r||a,fallback:(0,l.jsx)(z,{src:a,alt:r,onFilePathClick:n}),onFilePathClick:n})}}},[n]),a=(0,s.useMemo)(()=>[[N.A,eh],C.A],[]),o=(0,s.useMemo)(()=>W(t),[t]);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(k.oz,{remarkPlugins:E.eT,rehypePlugins:a,urlTransform:ep,components:r,children:o.body}),null!==o.reasoning&&(0,l.jsx)(el,{blocks:o.reasoningBlocks,children:(0,l.jsx)(k.oz,{remarkPlugins:E.eT,rehypePlugins:a,urlTransform:ep,components:r,children:o.reasoning})}),o.toolCalls>0&&(0,l.jsx)(es,{toolCalls:o.toolCalls,children:(0,l.jsx)(k.oz,{remarkPlugins:E.eT,rehypePlugins:a,urlTransform:ep,components:r,children:o.toolLog})})]})}),ex={human:"chatTranscript.toolApproval.answeredByHuman",auto:"chatTranscript.toolApproval.autoApproved",terminal:"chatTranscript.toolApproval.answeredInTerminal",pending:"chatTranscript.toolApproval.awaitingAnswer",unclassified:"chatTranscript.toolApproval.unclassified",unknown:"chatTranscript.toolApproval.resolved"},eb={...ex,auto:"chatTranscript.toolApproval.autoAnswered"},ev=(0,s.memo)(function(e){let{entries:t}=e,n=(0,o.c)("worktree"),{isOpen:r,toggle:a}=ea();if(0===t.length)return null;let s=r?i.A:c.A,u=(0,$.rS)(t),d=u.questions+u.confirmations>0,m=u.approvals>0,h=[];m&&h.push(n("chatTranscript.toolApproval.summary",{count:u.approvals})),u.questions>0&&h.push(n("chatTranscript.toolApproval.summaryQuestions",{count:u.questions})),u.confirmations>0&&h.push(n(m||u.questions>0?"chatTranscript.toolApproval.summaryConfirmations":"chatTranscript.toolApproval.summaryConfirmationsOnly",{count:u.confirmations}));let g=m?f.A:p.A;return(0,l.jsxs)("div",{"data-testid":"chat-tool-approval-group","data-approval-count":t.length,"data-approvals":u.approvals,"data-questions":u.questions,"data-confirmations":u.confirmations,className:"".concat(V," items-start"),children:[(0,l.jsxs)("button",{type:"button","data-testid":"chat-tool-approval-toggle",onClick:a,"aria-expanded":r,"aria-label":n("chatTranscript.toolApproval.".concat(r?"collapse":"expand").concat(d&&m?"Mixed":d?"Questions":"")),className:er,children:[(0,l.jsx)(g,{size:12,"aria-hidden":"true"}),(0,l.jsx)("span",{children:h.join(n("chatTranscript.toolApproval.summarySeparator"))}),(0,l.jsx)(s,{size:12,"aria-hidden":"true"})]}),r&&(0,l.jsx)("ul",{"data-testid":"chat-tool-approval-list",className:"mr-auto flex w-full max-w-full flex-col gap-1 pl-1",children:t.map(e=>{let t="question"===e.kind,r=t?eb:ex,a=t?"confirmation"===e.phase?"chatTranscript.toolApproval.submitConfirmation":"chatTranscript.toolApproval.unlabeledQuestion":"chatTranscript.toolApproval.unlabeled";return(0,l.jsxs)("li",{"data-testid":"chat-tool-approval-entry","data-approval-outcome":e.outcome,"data-approval-kind":e.kind,"data-approval-phase":e.phase,"data-approval-confirmation":e.confirmationOutcome,"data-approval-audit":e.isPermissionAudit?"true":void 0,"data-approval-merged":e.messageIds.length,className:"flex max-w-full flex-wrap items-baseline gap-x-2 gap-y-0.5 text-xs text-muted-foreground",children:["confirmation"===e.phase&&e.label&&(0,l.jsx)("span",{"data-testid":"chat-tool-approval-phase",children:n("chatTranscript.toolApproval.submitConfirmation")}),(0,l.jsx)("span",{className:"min-w-0 break-words [word-break:break-word] font-mono text-foreground",children:e.label||n(a)}),(0,l.jsx)("span",{"data-testid":"chat-tool-approval-outcome",children:n(r[e.outcome])}),e.confirmationOutcome&&(0,l.jsx)("span",{"data-testid":"chat-tool-approval-confirmation",children:n("chatTranscript.toolApproval.confirmation",{outcome:n(eb[e.confirmationOutcome])})})]},e.id)})})]})}),ey=(0,s.memo)(function(e){var t;let{message:n,showHeader:r,header:a,onFilePathClick:i,onCopy:c,onInsertToMessage:u,onRetryPending:d,onDiscardPending:m}=e,f=(0,o.c)("worktree"),p=(0,o.c)("common"),k="user"===n.role,j=n.optimisticState,N=(0,S.bx)(n.requestId),C=ei(n),I=(0,s.useMemo)(()=>"number"==typeof(null==a?void 0:a.startedAtMs)?new Date(a.startedAtMs):null,[null==a?void 0:a.startedAtMs]),E=(0,T.g8)(n.timestamp,I),A=r?"role":(null==a?void 0:a.variant)==="time"?"time":"none",L=(0,s.useMemo)(()=>{var e;return"string"==typeof(e=n.content)?(0,M.aJ)(e):""},[n.content]),R=N?n.content:L,P=(0,s.useMemo)(()=>N?W(n.content):null,[N,n.content]),O=P?P.body.trim().length>0?P.body:null:L,z=P?(t=n.content,P.folded?t:null):null,F=[k?"".concat("w-fit rounded-2xl border px-3 py-2 text-sm text-foreground"," ").concat("ml-auto"," ").concat("max-w-[85%] sm:max-w-[75%]"," rounded-br-md"):J,k&&"error"===j?"border-danger-border bg-danger-subtle":"",k&&"error"!==j?"border-accent-500/30 bg-accent-500/10":"","sending"===j?"opacity-70":""].filter(Boolean).join(" "),D=N?X:"".concat(Z," whitespace-pre-wrap");return(0,l.jsxs)("div",{"data-testid":"chat-message-row","data-role":n.role,"data-row-message-id":n.id,className:[V,n.archived?"opacity-60":""].filter(Boolean).join(" "),children:["role"===A&&(0,l.jsxs)("div",{"data-testid":Y,"data-header-variant":"role",className:["flex flex-wrap items-center gap-x-2 px-1 text-xs text-muted-foreground",k?"justify-end":""].filter(Boolean).join(" "),children:[(0,l.jsx)("span",{className:k?"font-medium text-accent-700 dark:text-accent-400":"font-medium",children:f(k?"conversation.you":"conversation.assistant")}),E&&(0,l.jsx)("span",{"data-testid":G,children:E})]}),"time"===A&&E&&(0,l.jsxs)("div",{"data-testid":Y,"data-header-variant":"time",role:"separator","aria-label":f("chatTranscript.turnBoundary"),className:"flex w-full items-center gap-2 px-1 pt-2 text-xs text-muted-foreground",children:[(0,l.jsx)("span",{className:"h-px min-w-[1rem] flex-1 bg-border","aria-hidden":"true"}),(0,l.jsx)("span",{"data-testid":G,className:"shrink-0 whitespace-nowrap",children:E}),(0,l.jsx)("span",{className:"h-px min-w-[1rem] flex-1 bg-border","aria-hidden":"true"})]}),(0,l.jsx)("div",{"data-testid":Q,className:F,children:C?(0,l.jsx)(ec,{children:(0,l.jsx)("div",{"data-message-id":n.id,className:D,children:(0,l.jsx)(ed,{content:L,onFilePathClick:i})})}):(0,l.jsx)("div",{"data-message-id":n.id,"data-markdown":N?"true":void 0,className:D,children:N?(0,l.jsx)(eg,{content:n.content,onFilePathClick:i}):k?(0,l.jsx)(em,{content:L,onFilePathClick:i}):(0,l.jsx)(ed,{content:L,onFilePathClick:i})})}),(0,l.jsxs)("div",{"data-testid":"chat-message-actions",className:["flex items-center gap-1 px-1",k?"justify-end":""].filter(Boolean).join(" "),children:["sending"===j&&(0,l.jsxs)("span",{"data-testid":"chat-optimistic-sending",className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,l.jsx)(h.A,{size:12,className:"animate-spin","aria-hidden":"true"}),(0,l.jsx)("span",{children:f("conversation.sending")})]}),"error"===j&&(0,l.jsxs)("span",{"data-testid":"chat-optimistic-error",className:"flex items-center gap-1 text-xs text-danger-foreground",children:[(0,l.jsx)(g.A,{size:12,"aria-hidden":"true"}),(0,l.jsx)("span",{children:f("conversation.failedToSend")})]}),"error"===j?(0,l.jsxs)(l.Fragment,{children:[d&&(0,l.jsxs)("button",{type:"button","data-testid":"chat-pending-retry",onClick:()=>d(n.id),className:"flex items-center gap-1 rounded px-1.5 py-0.5 text-xs text-accent-700 transition-colors hover:bg-muted dark:text-accent-400","aria-label":f("conversation.retrySending"),title:p("retry"),children:[(0,l.jsx)(x.A,{size:12,"aria-hidden":"true"}),p("retry")]}),m&&(0,l.jsxs)("button",{type:"button","data-testid":"chat-pending-discard",onClick:()=>m(n.id),className:"flex items-center gap-1 rounded px-1.5 py-0.5 text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-danger-foreground","aria-label":f("conversation.discardMessage"),title:f("conversation.discard"),children:[(0,l.jsx)(b.A,{size:12,"aria-hidden":"true"}),f("conversation.discard")]})]}):(0,l.jsxs)(l.Fragment,{children:[c&&null!==O&&(0,l.jsx)("button",{type:"button","data-testid":"chat-copy-message",onClick:()=>c(O),className:"rounded p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground","aria-label":f("conversation.copyMessage"),title:f("conversation.copy"),children:(0,l.jsx)(v.A,{size:14,"aria-hidden":"true"})}),c&&null!==z&&(0,l.jsxs)("button",{type:"button","data-testid":"chat-copy-full-message",onClick:()=>c(z),className:"flex items-center gap-1 rounded px-1.5 py-1 text-xs leading-none text-muted-foreground transition-colors hover:bg-muted hover:text-foreground","aria-label":f("chatTranscript.copyFull.action"),title:f("chatTranscript.copyFull.title"),children:[(0,l.jsx)(y.A,{size:14,"aria-hidden":"true"}),(0,l.jsx)("span",{children:f("chatTranscript.copyFull.label")})]}),k&&u&&(0,l.jsx)("button",{type:"button","data-testid":"chat-insert-user-message",onClick:()=>u(R),className:"rounded p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-accent-600 dark:hover:text-accent-400","aria-label":f("conversation.insertToMessage"),title:f("conversation.insertToMessage"),children:(0,l.jsx)(w.A,{size:14,"aria-hidden":"true"})})]})]})]})})},32771:(e,t,n)=>{n.d(t,{NK:()=>y});var r=n(12115),a=n(60199),l=n(51515);let s=/^[>❯]/,o=/^\u203A/;function i(e){return void 0===e||""===(0,l.aJ)(e).trim()}function c(e){let t=[],n={dim:!1,bold:!1},r=0;for(;r<e.length;){let a=e[r];if("\x1b"!==a){t.push({ch:a,dim:n.dim,bold:n.bold}),r++;continue}let l=e[r+1];if("["===l){let t=r+2;for(;t<e.length&&!/[A-Za-z]/.test(e[t]);)t++;if(t>=e.length)break;"m"===e[t]&&(n=function(e,t){let n=""===e?["0"]:e.split(";"),{dim:r,bold:a}=t;for(let e=0;e<n.length;e++){let t=""===n[e]?0:Number(n[e]);if(!Number.isNaN(t)){if(38===t||48===t||58===t){let t=""===n[e+1]||void 0===n[e+1]?-1:Number(n[e+1]);5===t?e+=2:2===t?e+=4:e+=1;continue}0===t||22===t?(r=!1,a=!1):1===t?a=!0:2===t&&(r=!0)}}return{dim:r,bold:a}}(e.slice(r+2,t),n)),r=t+1;continue}if("]"===l){let t=r+2;for(;t<e.length;){if("\x07"===e[t]){t++;break}if("\x1b"===e[t]&&"\\"===e[t+1]){t+=2;break}t++}r=t;continue}r+=2}return t}let u=new Set(["claude","codex"]);function d(e){let t=e.length;for(;t>0&&""===e[t-1].trim();)t--;return e.slice(0,t)}function m(e){return""===(0,l.aJ)(e).trim()}var f=n(52771),p=n(1962),h=n(68955),g=n(67149);g.$C.activeMs,g.$C.idleMs,g.$C.wsFallbackMs;let x={session:null,context:null,diff:null};function b(e){var t,n,r,a,l,s,o,i,c,u,d,m;let f=e.session,p=e.context,h=e.diff;return JSON.stringify([null!=(t=null==f?void 0:f.title)?t:null,null!=(n=null==f?void 0:f.agent)?n:null,null!=(r=null==f?void 0:f.model)?r:null,null!=(a=null==f?void 0:f.cost)?a:null,null!=(l=null==f?void 0:f.tokens)?l:null,null!=(s=null==p?void 0:p.tokens)?s:null,null!=(o=null==p?void 0:p.limit)?o:null,null!=(i=null==p?void 0:p.percent)?i:null,null!=(c=null==h?void 0:h.turnMessageId)?c:null,null!=(u=null==h?void 0:h.revertedMessageId)?u:null,null!=(d=null==h?void 0:h.files.map(v))?d:null,null!=(m=null==h?void 0:h.revertedFiles.map(v))?m:null])}function v(e){var t,n;return"".concat(null!=(t=e.file)?t:"",":").concat(null!=(n=e.status)?n:"",":").concat(e.additions,":").concat(e.deletions)}function y(e){let{worktreeId:t,cliToolId:n,instanceId:v,enabled:y=!0,cadence:w=g.$C}=e,k=null!=v?v:n,[j,N]=(0,r.useState)(()=>({output:"",realtimeSnippet:"",isRunning:!1,isThinking:!1,sessionStatus:"",isSelectionListActive:!1,isPagerActive:!1,isDismissablePanelActive:!1,isUnclassifiedActive:!1,composerText:"",agentMode:h.J_,attaching:!0,autoScroll:!0})),[C,S]=(0,r.useState)(()=>({visible:!1,data:null,messageId:null,answering:!1})),[T,M]=(0,r.useState)(x),I=(0,r.useRef)(0),E=(0,r.useRef)(n);E.current=n;let A=(0,r.useRef)(k);A.current=k;let L=(0,r.useRef)(!1);(0,r.useEffect)(()=>(L.current=!0,()=>{L.current=!1}),[]);let R=(0,r.useRef)(C.visible);R.current=C.visible;let{connected:P,subscribe:O,unsubscribe:z,addListener:F}=(0,a.xM)(),D=(0,r.useRef)(0),H=(0,r.useRef)(0),B=(0,r.useRef)(null),q=(0,r.useRef)(null),[K,U]=(0,r.useState)(!1),_=(0,r.useCallback)(()=>{U(!0),null!==q.current&&clearTimeout(q.current),q.current=setTimeout(()=>{q.current=null,U(!1)},5e3)},[]),W=(0,r.useCallback)(function(e){var t,n;let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],a=null!=(n=null!=(t=e.fullOutput)?t:e.realtimeSnippet)?n:"";!0===e.isUnclassifiedActive&&!0!==e.isPromptWaiting&&!0!==e.isSelectionListActive&&!0!==e.isPagerActive&&!0!==e.isDismissablePanelActive?(H.current+=1,null!=B.current||(B.current=Date.now())):(H.current=0,B.current=null);let m=H.current>=2&&null!==B.current&&Date.now()-B.current>=500,g=e.isRunning?function(e,t){if(!u.has(t))return{text:"",state:"unsupported_tool"};let n=e.split("\n"),r=function(e,t){if("claude"===t){let t=function(e){var t;let n=e=>/^─{10,}$/.test((0,l.aJ)(e).trimEnd()),r=e.length-1;for(;r>=0&&""===e[r].trim();)r--;if(r<0)return null;let a=-1;for(let t=r;t>=Math.max(0,r-4);t--)if(n(e[t])){a=t;break}if(a<0)return null;let o=-1;for(let t=a-1;t>=Math.max(0,a-40);t--)if(n(e[t])){o=t;break}return o<0||!s.test((0,l.aJ)(null!=(t=e[o+1])?t:""))?null:{openingSeparator:o,closingSeparator:a}}(e);return null===t?null:{firstRow:t.openingSeparator+1,lastRow:t.closingSeparator-1,glyph:s}}let n=function(e){let t=e.length-1;for(;t>=0&&i(e[t]);)t--;if(t<0)return null;for(let n=0;n<4&&t>=0;n++){let n=t,r=t;for(;r>0&&!i(e[r-1]);)r--;if(function(e){if(void 0===e)return!1;let t=c(e);if(0===t.length||"›"!==t[0].ch||t[0].dim||t.length>1&&" "!==t[1].ch)return!1;let n=t.slice(2).find(e=>" "!==e.ch);return void 0===n||!n.bold}(e[r]))return{firstRow:r,lastRow:Math.min(n,r+40-1)};for(t=r-1;t>=0&&i(e[t]);)t--}return null}(e);return null===n?null:{firstRow:n.firstRow,lastRow:n.lastRow,glyph:o}}(n,t);if(null===r)return{text:"",state:"no_composer"};let a=[],m=[];for(let e=r.firstRow;e<=r.lastRow;e++){var f;let t=function(e,t,n){if(t){let t=e.findIndex(e=>n.test(e.ch));if(t<0)return e;let r=t+1;return r<e.length&&/\s/.test(e[r].ch)&&r++,e.slice(r)}let r=0;for(;r<2&&r<e.length&&" "===e[r].ch;)r++;return e.slice(r)}(c(null!=(f=n[e])?f:""),e===r.firstRow,r.glyph);a.push(t.filter(e=>!e.dim).map(e=>e.ch).join("").trimEnd()),m.push(t.map(e=>e.ch).join("").trimEnd())}let p=d(a).join("\n");return""!==p.trim()?{text:p.slice(0,2e3),state:"content"}:{text:"",state:""===d(m).join("\n").trim()?"empty":"ghost"}}(a,E.current).text:"",x=e.isRunning?(0,f.OS)(E.current,a):h.J_;N(t=>{var n,r,l,s,o,i,c;let u=!1===e.isRunning,d=!!a||!!e.isRunning||u;return{...t,output:d?a:t.output,realtimeSnippet:null!=(n=e.realtimeSnippet)?n:"",isRunning:null!=(r=e.isRunning)&&r,isThinking:null!=(l=e.thinking)&&l,sessionStatus:null!=(s=e.sessionStatus)?s:t.sessionStatus,isSelectionListActive:null!=(o=e.isSelectionListActive)&&o,isPagerActive:null!=(i=e.isPagerActive)&&i,isDismissablePanelActive:null!=(c=e.isDismissablePanelActive)&&c,isUnclassifiedActive:m,composerText:g,agentMode:x,attaching:!1}}),e.isPromptWaiting&&e.promptData?S(t=>{var n,a;let l=null!=(n=e.promptData)?n:t.data,s=null!==(0,p.l6)(t.data)&&(0,p.l6)(t.data)===(0,p.l6)(l);return{...t,visible:!0,data:l,messageId:null!=(a=t.messageId)?a:"prompt-".concat(Date.now()),answerable:r?e.promptAnswerable:s?t.answerable:void 0}}):!e.isPromptWaiting&&R.current&&S({visible:!1,data:null,messageId:null,answering:!1})},[]),$=(0,r.useCallback)(async()=>{let e=++I.current,r=()=>!L.current||I.current!==e||E.current!==n||A.current!==k;try{var a,l,s,o,i,c;let e=await fetch("/api/worktrees/".concat(t,"/current-output?cliTool=").concat(n,"&instance=").concat(encodeURIComponent(k)));if(!e.ok)return;let u=await e.json();if(r()||u.cliToolId&&u.cliToolId!==n)return;W(u,!0);let d={session:null!=(o=null==(a=u.structuredEvents)?void 0:a.session)?o:null,context:null!=(i=null==(l=u.structuredEvents)?void 0:l.sessionContext)?i:null,diff:null!=(c=null==(s=u.structuredEvents)?void 0:s.sessionDiff)?c:null};M(e=>b(e)===b(d)?e:d)}catch(e){if(r())return;console.error("[useTerminalPanePolling] fetch error:",e)}},[t,n,k,W]),J="".concat(t,"::").concat(n,"::").concat(k),Q=(0,r.useRef)(J);(0,r.useEffect)(()=>{Q.current!==J&&(Q.current=J,I.current+=1,D.current=0,H.current=0,B.current=null,U(!1),null!==q.current&&(clearTimeout(q.current),q.current=null),N(e=>({...e,output:"",realtimeSnippet:"",isRunning:!1,isThinking:!1,sessionStatus:"",isSelectionListActive:!1,isPagerActive:!1,isDismissablePanelActive:!1,isUnclassifiedActive:!1,composerText:"",agentMode:h.J_,attaching:!0})),S({visible:!1,data:null,messageId:null,answering:!1}),M(x))},[J]),(0,r.useEffect)(()=>{if(y)return O(t),()=>z(t)},[y,t,O,z]),(0,r.useEffect)(()=>{D.current=0,U(!1),null!==q.current&&(clearTimeout(q.current),q.current=null)},[P]),(0,r.useEffect)(()=>()=>{null!==q.current&&clearTimeout(q.current)},[]),(0,r.useEffect)(()=>{if(y)return F(e=>{var n;if("terminal_snapshot"!==e.type||e.worktreeId!==t||e.cliToolId!==E.current||e.instanceId!==A.current||e.version<=D.current)return;D.current=e.version,_();let r=(function(e){let t=e.slice(-100);if(t.some(e=>!m(e)))return t;let n=e.length-1;for(;n>=0&&m(e[n]);)n-=1;return n<0?t:e.slice(Math.max(0,n+1-100),n+1)})(e.output.split("\n")).join("\n");W({fullOutput:e.output,realtimeSnippet:r,isRunning:e.isRunning,sessionStatus:e.sessionStatus,thinking:e.thinking,isSelectionListActive:e.isSelectionListActive,isPagerActive:e.isPagerActive,isDismissablePanelActive:e.isDismissablePanelActive,isUnclassifiedActive:e.isUnclassifiedActive,isPromptWaiting:e.isPromptWaiting,promptData:null!=(n=e.promptData)?n:null,promptAnswerable:e.promptAnswerable},"promptAnswerable"in e)})},[y,t,F,W,_]),(0,r.useEffect)(()=>{if(y)return F(e=>{if("session_status_changed"===e.type)e.worktreeId===t&&!1===e.isRunning&&(null==e.instance||e.instance===A.current)&&(null==e.cliTool||e.cliTool===E.current)&&(D.current=0,W({fullOutput:"",realtimeSnippet:"",isRunning:!1,sessionStatus:"idle",thinking:!1,isSelectionListActive:!1,isPagerActive:!1,isDismissablePanelActive:!1,isUnclassifiedActive:!1,isPromptWaiting:!1,promptData:null}))})},[y,t,F,W]),(0,r.useEffect)(()=>{if(!y)return;let e=!1,t=C.visible||j.isSelectionListActive||j.isPagerActive||j.isDismissablePanelActive||j.isUnclassifiedActive,n=setInterval(()=>{"hidden"!==document.visibilityState&&$()},(0,g.lN)(w,{connected:P,pushHealthy:K,interactionActive:t,sessionAlive:j.isRunning,generating:(0,g.f8)(j.sessionStatus)}));"undefined"!=typeof document&&"hidden"!==document.visibilityState&&$();let r=()=>{"visible"!==document.visibilityState||e||$()};return document.addEventListener("visibilitychange",r),()=>{e=!0,null!==n&&(clearInterval(n),n=null),document.removeEventListener("visibilitychange",r)}},[y,w,P,K,j.isRunning,j.sessionStatus,j.isSelectionListActive,j.isPagerActive,j.isDismissablePanelActive,j.isUnclassifiedActive,C.visible,$]);let Y=(0,r.useCallback)(e=>{N(t=>t.autoScroll===e?t:{...t,autoScroll:e})},[]),G=(0,r.useCallback)(e=>{S(t=>({...t,answering:e}))},[]);return{terminal:j,prompt:C,agentSession:T,setAutoScroll:Y,setPromptAnswering:G,clearPrompt:(0,r.useCallback)(()=>{S({visible:!1,data:null,messageId:null,answering:!1})},[]),refresh:(0,r.useCallback)(()=>$(),[$])}}},35252:(e,t,n)=>{n.d(t,{w:()=>s});var r=n(12115),a=n(78660);function l(e){if(0===e.length)return"0";let t=e[e.length-1],n=t.timestamp instanceof Date?t.timestamp.getTime():String(t.timestamp);return"".concat(e.length,"|").concat(t.id,"|").concat(n)}function s(e){let{messages:t}=e,[n,s]=(0,r.useState)(!1),[o,i]=(0,r.useState)(""),[c,u]=(0,r.useState)([]),[d,m]=(0,r.useState)(0),[f,p]=(0,r.useState)(!1),h=(0,r.useRef)(null),g=(0,r.useRef)(""),x=(0,r.useRef)(!1),b=(0,r.useRef)(l(t)),v=(0,r.useRef)(t);v.current=t;let y=c.reduce((e,t)=>e+t.ranges.length,0),w=(0,r.useMemo)(()=>(function(e,t){if(0===e.length||t<0)return null;let n=0;for(let r of e){if(t<n+r.ranges.length)return{messageId:r.messageId,localIndex:t-n};n+=r.ranges.length}return null})(c,d),[c,d]),k=(0,r.useCallback)(()=>{h.current&&(clearTimeout(h.current),h.current=null)},[]),j=(0,r.useCallback)(e=>{let{positions:t,capped:n}=function(e,t){if(t.length<a.E2||0===e.length)return{positions:[],capped:!1};let n=t.toLowerCase(),r=t.length,l=[],s=0,o=!1;for(let t of e){if(o)break;let i=t.content;if(!i)continue;let c=i.toLowerCase(),u=[],d=0;for(;;){let l=c.indexOf(n,d);if(-1===l)break;if(u.push({start:l,end:l+r}),d=l+1,(s+=1)>=a.F0){if(-1!==c.indexOf(n,d))o=!0;else{let r=e.indexOf(t)+1;for(let t=r;t<e.length;t++){let r=e[t].content;if(r&&-1!==r.toLowerCase().indexOf(n)){o=!0;break}}}break}}u.length>0&&l.push({messageId:t.id,ranges:u})}return{positions:l,capped:o}}(v.current,e);u(t),m(0),p(n)},[]),N=(0,r.useCallback)(e=>{k(),g.current=e,x.current||(h.current=setTimeout(()=>{j(e)},a.e1))},[k,j]),C=(0,r.useCallback)(e=>{i(e),N(e)},[N]),S=(0,r.useCallback)(()=>{s(!0)},[]),T=(0,r.useCallback)(()=>{s(!1),i(""),g.current="",u([]),m(0),p(!1),k()},[k]),M=(0,r.useCallback)(()=>{m(e=>0===y?0:(e+1)%y)},[y]),I=(0,r.useCallback)(()=>{m(e=>0===y?0:(e-1+y)%y)},[y]),E=(0,r.useCallback)(()=>{x.current=!0,k()},[k]),A=(0,r.useCallback)(()=>{x.current=!1;let e=g.current;e.length>=a.E2&&(k(),h.current=setTimeout(()=>{j(e)},a.e1))},[k,j]);return(0,r.useEffect)(()=>{let e=l(t);if(e===b.current)return;b.current=e;let n=g.current;n.length>=a.E2&&j(n)},[t,j]),(0,r.useEffect)(()=>()=>{k(),g.current=""},[k]),{isOpen:n,query:o,matchCount:y,currentIndex:d,isAtMaxMatches:f,matchPositions:c,currentMatch:w,openSearch:S,closeSearch:T,setQuery:C,onCompositionStart:E,onCompositionEnd:A,nextMatch:M,prevMatch:I}}},38218:(e,t,n)=>{n.d(t,{D:()=>l,a:()=>s});var r=n(12115);let a=r.useLayoutEffect,l=768;function s(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{breakpoint:t=l}=e,[n,s]=(0,r.useState)(!1);return a(()=>{let e=window.matchMedia("(max-width: ".concat(t-1,"px)"));s(e.matches);let n=e=>{s(e.matches)};return e.addEventListener("change",n),()=>{e.removeEventListener("change",n)}},[t]),n}},41108:(e,t,n)=>{n.d(t,{UI:()=>c});var r=n(12115);function a(){return{pending:0,delivered:0,prompt:0,expired:0,cancelled:0}}let l=[],s=new Map;function o(){return{open:l,counts:a()}}async function i(e,t){try{var n;let r=await fetch("/api/relays?worktree=".concat(encodeURIComponent(e)));if(!r.ok)return;let o=await r.json();if(s.get(e)!==t)return;for(let e of(t.snapshot={open:Array.isArray(o.open)?o.open:l,counts:null!=(n=o.counts)?n:a()},t.listeners))e()}catch(e){}}function c(e){let[t]=(0,r.useState)(o),n=(0,r.useCallback)(t=>{let n;if(!e)return()=>{};let r=((n=s.get(e))||(n={snapshot:o(),listeners:new Set,timer:null,refs:0},s.set(e,n)),n.refs+=1,null===n.timer&&(i(e,n),n.timer=setInterval(()=>void i(e,n),2e4)),n);return r.listeners.add(t),()=>{r.listeners.delete(t),function(e){let t=s.get(e);t&&(t.refs-=1,t.refs>0||(t.timer&&clearInterval(t.timer),s.delete(e)))}(e)}},[e]),a=(0,r.useCallback)(()=>{var n,r;return e&&null!=(r=null==(n=s.get(e))?void 0:n.snapshot)?r:t},[e,t]),{open:l,counts:c}=(0,r.useSyncExternalStore)(n,a,a),u=(0,r.useCallback)(()=>{let t=e?s.get(e):void 0;e&&t&&i(e,t)},[e]);return(0,r.useMemo)(()=>({open:l,counts:c,owedBy:t=>l.filter(n=>n.to.worktreeId===e&&n.to.instanceId===t),awaitedBy:t=>l.filter(n=>n.from.worktreeId===e&&n.from.instanceId===t),refresh:u}),[l,c,e,u])}},41253:(e,t,n)=>{n.d(t,{AW:()=>u,Fo:()=>i,HA:()=>o,hu:()=>p,lK:()=>f});var r=n(12115),a=n(19985),l=n(70738),s=n(76246);function o(e,t){if("string"!=typeof e||!e.trim())return{kind:"none"};let n=(0,l.z)(e);if("external"===n)return{kind:"external",href:e.trim()};if("file"!==n)return{kind:"none"};let r=(0,l.h)(e,t);return null===r?{kind:"none"}:!r.startsWith("/")&&(0,a.df)(function(e){let t=e.slice(e.lastIndexOf("/")+1),n=t.lastIndexOf(".");return n>0?t.slice(n):""}(r))?{kind:"worktree",path:r}:{kind:"file",href:e.trim()}}function i(e,t){return"/api/worktrees/".concat(e,"/files/").concat((0,s.o)(t))}let c=/!\[([^\]\n]*)\]\(([^()\s]+)\)/g;function u(e,t){let n=[],r=0;for(let l of e.matchAll(c)){var a;let[s,i,c]=l,u=o(c,t);if("worktree"!==u.kind||!u.path.startsWith(".commandmate/attachments/"))continue;let d=null!=(a=l.index)?a:0;d>r&&n.push({type:"text",content:e.slice(r,d)}),n.push({type:"image",src:c,alt:i,path:u.path}),r=d+s.length}return r<e.length&&n.push({type:"text",content:e.slice(r)}),n}let d=Object.freeze({}),m=(0,r.createContext)(d),f=m.Provider;function p(){return(0,r.useContext)(m)}},42278:(e,t,n)=>{n.d(t,{$H:()=>a,Dk:()=>x,S$:()=>y,VC:()=>b,gg:()=>m,xw:()=>w});var r=n(51515);let a=9,l=/^[^0-9A-Za-z]*([1-9])[.)]\s+\S/,s=/\bs\s+to\s+use\s+this\s+session\s+only\b/i,o=/\bEnter\s+to\s+set\s+as\s+default\b/i,i=/\btype\s+to\s+search\b|\bsearch\s+\w+\s*(?:…|\.\.\.)|(?:^|·)\s*\/\s+search\b/im,c=/\benter\s+to\s+select\b\s*[·•]\s*esc\s+to\s+cancel\b/i,u=/^\s*(?:press|hit|type)?\s*(?:<)?esc(?:ape)?(?:>)?\s+to\s+(?:close|dismiss|exit)\b[\s.·•]*$/im,d=/^\s*(?:❯ +)?Approve\s+ctrl\+a\b[^\n]*\n\s*(?:❯ +)?Cancel\s+esc\s*$/im;function m(e){if(!e)return!1;let t=(0,r.aJ)(e.replace(/\r\n/g,"\n")).split("\n"),n=t.length-1;for(;n>=0&&""===t[n].trim();)n-=1;return!(n<0)&&t.slice(Math.max(0,n+1-15),n+1).some(e=>u.test(e))}let f=/^\u2500+$/,p="●◉⦿",h=new RegExp("^\\s*([".concat(p).concat("◯○◌⚪").concat("✔","])\\s+\\S")),g=/\besc\s+to\s+interrupt\b|^[^\S\n]*✻[^\S\n]+\S/im;function x(e){let t=function(e){if(!e)return null;let t=e.replace(/\r\n/g,"\n").split("\n").map(r.aJ),n=t.length-1;for(;n>=0&&""===t[n].trim();)n-=1;if(n<1)return null;let a=-1;for(let e=n-1;e>=0;e-=1){let n=t[e].trim();if(!(n.length<40)&&f.test(n)){a=e;break}}if(a<0)return null;let s=t.slice(a+1,n+1),o=s.join("\n");if(i.test(o)||c.test(o)||u.test(o)||g.test(o))return null;let d=s.findIndex(e=>""!==e.trim());if(d<0||!function(e){let t=e.split("|");if(t.length<2)return!1;let n=0,r=0;for(let e of t){let t=h.exec(e);if(null===t)return!1;p.includes(t[1])?n+=1:r+=1}return n>0&&r>0}(s[d]))return null;let m=[],x=-1;for(let e=d+1;e<s.length;e+=1){let t=l.exec(s[e]);null!==t&&(x<0&&(x=e),m.push(Number(t[1])))}if(m.length<2||!s.slice(d+1,x).some(e=>""!==e.trim()))return null;let b=0,v=-1,y=!1;for(let e=0;e<s.length;e+=1){let t=s[e].split("❯").length-1;0!==t&&(b+=t,v=e,y=l.test(s[e]))}return 0===b?null:{ruleLineIndex:a,firstLineIndex:a+1,lastLineIndex:n,tabLineIndex:a+1+d,numbers:m,cursorCount:b,cursorLineIndex:a+1+v,cursorOnOptionRow:y}}(e);return null!==t&&t.numbers.every((e,t)=>e===t+1)&&1===t.cursorCount?{ruleLineIndex:t.ruleLineIndex,firstLineIndex:t.firstLineIndex,lastLineIndex:t.lastLineIndex,tabLineIndex:t.tabLineIndex,cursorLineIndex:t.cursorLineIndex,cursorOnOptionRow:t.cursorOnOptionRow,optionCount:t.numbers.length}:null}function b(e){let t=e.replace(/\r\n/g,"\n").split("\n"),n=-1;for(let e=t.length-1;e>=0;e-=1)if(c.test((0,r.aJ)(t[e]))){n=e;break}if(n<0){let n=x(e);return null===n?null:t.slice(n.firstLineIndex,n.lastLineIndex+1).join("\n")}for(let e=n-1;e>=0;e-=1){let a=(0,r.aJ)(t[e]).trim();if(!(a.length<40)&&f.test(a))return t.slice(e+1,n+1).join("\n")}return null}let v={optionCount:0,offersSessionScope:!1,commitsDefaultOnEnter:!1,hasFilterInput:!1,offersPlanApprove:!1};function y(e){if(!e)return v;let t=function(e){let t=(0,r.aJ)(e.replace(/\r\n/g,"\n")).split("\n"),n=t.length-1;for(;n>=0&&""===t[n].trim();)n-=1;return n<0?[]:t.slice(Math.max(0,n+1-40),n+1)}(e);if(0===t.length)return v;let n=t.join("\n");return{optionCount:function(e){let t=0,n=0;for(let r of e){let e=l.exec(r);if(null===e)continue;let a=Number(e[1]);a===n+1?(n=a,t=a):1===a?(n=1,t=1):n=0}return Math.min(t,a)}(t),offersSessionScope:s.test(n),commitsDefaultOnEnter:o.test(n),hasFilterInput:i.test(n),offersPlanApprove:d.test(n)}}function w(e){return e.optionCount>0&&!e.offersSessionScope&&!e.hasFilterInput&&!e.offersPlanApprove}},49509:(e,t,n)=>{n.d(t,{t:()=>l});var r=n(12115),a=n(9900);function l(){let[e,t]=(0,r.useState)(null),n=(0,r.useRef)(null);return(0,r.useEffect)(()=>()=>{null!==n.current&&(clearTimeout(n.current),n.current=null)},[]),{activeKey:e,markPressed:(0,r.useCallback)(e=>{t(e),null!==n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{n.current=null,t(null)},a.tX)},[])}}},50857:(e,t,n)=>{function r(e){return"running"===e||"generating"===e||"waiting"===e}function a(e){return e.isActive||r(e.status)}function l(e,t){let n=e.map((e,t)=>({it:e,index:t})).filter(e=>{let{it:t}=e;return a(t)}),r=new Set;return t>0&&n.length>0&&[...n].sort((e,t)=>Number(t.it.isActive)-Number(e.it.isActive)||e.index-t.index).slice(0,t).forEach(e=>{let{index:t}=e;return r.add(t)}),e.map((e,t)=>a(e)?{...e,slot:r.has(t)?"pill":"overflow"}:{...e,slot:"dot"})}n.d(t,{Lm:()=>a,Qo:()=>r,Uw:()=>l})},51021:(e,t,n)=>{n.d(t,{Mx:()=>o,mE:()=>r,oO:()=>s,qL:()=>l});let r="s",a=["Up","Down","Left","Right","Enter","Escape","Tab","BTab","PageUp","PageDown","Home","End","q","1","2","3","4","5","6","7","8","9","y","n"],l=["claude","command-code"];[...a];let s=["command-code"],o="C-x",i=["C-p","C-t"],c=["a","l","t","m","g","u","r","c"];[...a,...i,...c],[...a,...i,...c]},51515:(e,t,n)=>{n.d(t,{aJ:()=>s,wJ:()=>o,x6:()=>i});let r="\\x1b\\][^\\x07\\x1b]*(?:\\x07|\\x1b\\\\)",a=RegExp(r,"g"),l=RegExp("\\x1b\\[[0-9;]*[a-zA-Z]|".concat(r,"|\\[[0-9;]*m"),"g");function s(e){return e.replace(l,"")}function o(e){return e.replace(a,"")}function i(e){let t=e.match(l);return t?t.join(""):""}},52771:(e,t,n)=>{n.d(t,{AO:()=>a.A,OS:()=>s,PD:()=>o});var r=n(68955),a=n(88894),l=n(51515);function s(e,t){let n=(0,a.h)(e);if(null===n)return r.J_;var s=null!=t?t:"";if(""===s)return r.J_;let o=function(e,t){let n=e.split("\n"),r=[];for(let e=n.length-1;e>=0&&r.length<t;e--){var a;let t=(0,l.aJ)(null!=(a=n[e])?a:"");""!==t.trim()&&r.push(t)}return r.reverse()}(s,n.tailRows);if(0===o.length)return r.J_;for(let e of n.indicators)if(o.some(t=>e.pattern.test(t)))return e.mode;return r.J_}function o(e){return"string"==typeof e&&(0,r.WK)(e)}},55813:(e,t,n)=>{n.d(t,{M:()=>s});var r=n(55041),a=n(8574);let l={en:a.c,ja:r.ja};function s(e){var t;return null!=(t=l[e])?t:a.c}},56827:(e,t,n)=>{n.d(t,{B:()=>l});var r=n(12115),a=n(9900);function l(e,t,n,l){return(0,r.useCallback)(r=>{let s=n&&n!==t?{cliToolId:t,keys:r,instanceId:n}:{cliToolId:t,keys:r};fetch("/api/worktrees/".concat(encodeURIComponent(e),"/special-keys"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)}).then(()=>{l&&setTimeout(l,a.LK)}).catch(e=>{console.error("Failed to send special keys:",e)})},[e,t,n,l])}},60734:(e,t,n)=>{n.d(t,{y:()=>u});var r=n(95155),a=n(12115),l=n(18955),s=n(56827),o=n(49509);let i=[{key:"Left",label:"◀",ariaLabel:"Left"},{key:"Up",label:"▲",ariaLabel:"Up"},{key:"Down",label:"▼",ariaLabel:"Down"},{key:"Right",label:"▶",ariaLabel:"Right"},{key:"Enter",label:"↵",ariaLabel:"Enter"},{key:"Escape",label:"Esc",ariaLabel:"Escape"}],c=[{key:"PageUp",label:"PgUp",ariaLabel:"Page Up"},{key:"PageDown",label:"PgDn",ariaLabel:"Page Down"},{key:"Home",label:"Home",ariaLabel:"Home"},{key:"End",label:"End",ariaLabel:"End"},{key:"q",label:"q",ariaLabelKey:"navigation.quitPager"}];function u(e){let{worktreeId:t,cliToolId:n,instanceId:u,onKeysSent:d,showPagerKeys:m=!1,hideEnterKey:f=!1}=e,p=(0,l.c)("worktree"),{activeKey:h,markPressed:g}=(0,o.t)(),x=(0,s.B)(t,n,u,d),b=(0,a.useCallback)(e=>{g(e[0]),x(e)},[g,x]),v=(0,a.useMemo)(()=>{let e=f?i.filter(e=>{let{key:t}=e;return"Enter"!==t}):i;return m?[...e,...c]:e},[m,f]),y=(0,a.useCallback)(e=>{if(f&&"Enter"===e.key)return;let t={ArrowLeft:"Left",ArrowUp:"Up",ArrowDown:"Down",ArrowRight:"Right",Enter:"Enter",Escape:"Escape"}[e.key];t&&(e.preventDefault(),b([t]))},[b,f]);return(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5 py-1.5 bg-muted rounded-lg",onKeyDown:y,role:"toolbar","aria-label":p("navigation.toolbarLabel"),children:[(0,r.jsx)("span",{className:"text-xs text-muted-foreground mx-2",children:p("navigation.caption")}),v.map(e=>{let{key:t,label:n,ariaLabel:a,ariaLabelKey:l}=e;return(0,r.jsx)("button",{type:"button",className:"min-w-[44px] min-h-[44px] px-3 py-2 text-sm font-medium rounded-md\n border border-border\n focus:outline-none focus:ring-2 focus:ring-ring\n transition-colors duration-75\n ".concat(h===t?"bg-accent-500 text-white border-accent-500 scale-95":"bg-surface dark:bg-surface-2 hover:bg-muted active:bg-muted"),"aria-label":l?p(l):a,onClick:()=>b([t]),children:n},t)})]})}},63881:(e,t,n)=>{n.d(t,{b4:()=>c,lo:()=>i});var r=n(12115),a=n(8355);let l=r.useLayoutEffect;function s(e,t){return"".concat(a.S5).concat(e,":").concat(t)}function o(e,t){let n=null!=t&&Number.isFinite(t)?Math.min(t,a.bS):a.bS;return Math.max(a.bw,Math.min(Math.round(e),n))}function i(e){let{worktreeId:t,scope:n,maxHeight:i,enabled:c=!0}=e,u=c&&!!n,[d,m]=(0,r.useState)(null),f=(0,r.useRef)(null),p=(0,r.useRef)(i);l(()=>{let e=u&&n?function(e,t){try{return function(e){if(null===e)return null;let t=e.trim();if(""===t)return null;let n=Number(t);if(!Number.isFinite(n))return null;let r=Math.round(n);return r<a.bw||r>a.bS?null:r}(window.localStorage.getItem(s(e,t)))}catch(e){return null}}(t,n):null;f.current=e,m(e)},[u,t,n]),l(()=>{p.current=i},[i]);let h=(0,r.useCallback)((e,r)=>{if(!u||!n||!Number.isFinite(e))return;let a=p.current,l=null===f.current?o(r,a):o(f.current,a),i=o(l+e,a);f.current=i,m(i);try{window.localStorage.setItem(s(t,n),String(o(i)))}catch(e){}},[u,t,n]),g=(0,r.useCallback)(()=>{if(u&&n){f.current=null,m(null);try{window.localStorage.removeItem(s(t,n))}catch(e){}}},[u,t,n]),x=u?d:null,b=null===x?null:o(x,i);return{storedHeight:x,height:b,resizeBy:h,reset:g}}function c(e,t,n){let[a,s]=(0,r.useState)(null),o=(0,r.useRef)(null);return l(()=>{if(!e||!t||"undefined"==typeof ResizeObserver)return;let r=t.querySelector('[data-testid="message-input-textarea"]');if(!r)return;let a=()=>{let t=function(e,t,n){let r=e.parentElement;if(!r)return null;let a=t.getBoundingClientRect().height;if(a<=0)return null;let l=0;for(let t of Array.from(r.children)){if(t===e||!(t instanceof HTMLElement))continue;let{display:n,position:r}=window.getComputedStyle(t);"none"!==n&&"absolute"!==r&&"fixed"!==r&&(l+=t.getBoundingClientRect().height)}return Math.floor(a+(function(e){let t=window.getComputedStyle(e),n=e=>parseFloat(e)||0;return e.getBoundingClientRect().height-n(t.borderTopWidth)-n(t.borderBottomWidth)-n(t.paddingTop)-n(t.paddingBottom)}(r)-l)-n)}(e,r,n);null!==t&&t!==o.current&&(o.current=t,s(t))},l=new ResizeObserver(a),i=e.parentElement;return i&&l.observe(i),l.observe(e),l.observe(t),l.observe(r),a(),()=>l.disconnect()},[e,t,n]),a}},64653:(e,t,n)=>{n.d(t,{o4:()=>s});var r=n(76246);let a={method:"HEAD",cache:"no-store"},l=(e,t)=>fetch(e,t);async function s(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:l;try{var s;return(s=await n("/api/worktrees/".concat(encodeURIComponent(e),"/files/").concat((0,r.o)(t)),a)).ok?"present":404===s.status||400===s.status||403===s.status?"missing":"unknown"}catch(e){return"unknown"}}},67149:(e,t,n)=>{n.d(t,{$C:()=>r,WT:()=>s,f8:()=>i,lN:()=>c,sD:()=>a,tC:()=>l,z1:()=>u});let r={activeMs:2e3,idleMs:5e3,wsFallbackMs:15e3,activeRequiresGenerating:!1,idleTrustsConnection:!1},a={activeMs:4e3,idleMs:1e4,wsFallbackMs:15e3,activeRequiresGenerating:!0,idleTrustsConnection:!0},l={pollMs:5e3,wsFallbackMs:15e3},s={pollMs:15e3,wsFallbackMs:3e4},o=new Set(["running","waiting"]);function i(e){return o.has(e)}function c(e,t){if(t.interactionActive)return e.activeMs;let n=e.activeRequiresGenerating?t.generating:t.sessionAlive;return t.connected&&t.pushHealthy||t.connected&&!n&&e.idleTrustsConnection?e.wsFallbackMs:n?e.activeMs:e.idleMs}function u(e,t){return t.connected?e.wsFallbackMs:e.pollMs}},68276:(e,t,n)=>{n.d(t,{LT:()=>r,XF:()=>a});let r="unclassified";function a(e){return null!=e&&e.type!==r}},68394:(e,t,n)=>{n.d(t,{EK:()=>c,Wq:()=>o,pN:()=>u});var r=n(51515);let a=new Set(["claude","codex","opencode"]),l=new Set(["opencode"]),s=new Set(["opencode"]),o={wrapMode:"frame",density:"compact"},i=/\x1b\[[0-9;]*m/g;function c(e){return{compactTuiLayoutPadding:a.has(e),preservePaintedPanelRows:l.has(e),mobileWrapMode:s.has(e)?"frame":"viewport"}}function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:400,n=1;for(let a of e.split("\n")){let e=(0,r.wJ)(a).replace(i,"").trimEnd().length;if(e>n&&(n=e),n>=t)return t}return n}},68872:(e,t,n)=>{n.d(t,{ED:()=>a,ZJ:()=>r,yi:()=>l});let r=1048576,a="[... 古い出力を省略しました / older output truncated ...]",l=65536},68955:(e,t,n)=>{n.d(t,{J_:()=>a,WK:()=>l});let r=["default","manual","accept-edits","plan","auto","autopilot","bypass","dont-ask","build"],a="unknown";function l(e){return r.includes(e)}},70738:(e,t,n)=>{n.d(t,{h:()=>u,z:()=>i});var r=n(69352);let a=/^(https?|mailto|tel|file):/i,l=/^[a-zA-Z][a-zA-Z0-9+.-]*:/,s=/^file:\/\/(localhost)?/i,o=/:\d+(?::\d+)?$/;function i(e){let t=(0,r.d3)(e.trim());return t?t.startsWith("#")?"anchor":s.test(t)?"file":l.test(t)&&!a.test(t)?null:"external"===(0,r.dj)(t)?"external":"file":null}function c(e){let t=[];for(let n of e.split("/"))if(""!==n&&"."!==n){if(".."===n){t.pop();continue}t.push(n)}return t.join("/")}function u(e,t){var n;if("file"!==i(e))return null;let r=(function(e){try{return decodeURIComponent(e)}catch(t){return e}})((function(e){let t=e.indexOf("#");return -1===t?e:e.slice(0,t)})(e.trim().replace(s,"")).replace(o,"")).trim();if(!r)return null;if(!r.startsWith("/"))return c(r)||null;let a=t?(n=t.trim()).length>1&&n.endsWith("/")?n.replace(/\/+$/,""):n:"";return a&&a.startsWith("/")?r===a?null:r.startsWith("".concat(a,"/"))?c(r.slice(a.length+1))||null:r:r}},72115:(e,t,n)=>{n.d(t,{f:()=>u});var r=n(95155),a=n(12115),l=n(18955);let s=["relative","flex-shrink-0","bg-border","transition-colors","duration-150","hover:bg-accent-500","dark:hover:bg-accent-500","focus:outline-none","focus:ring-2","focus:ring-ring","focus:ring-offset-2","focus:ring-offset-background"],o=["w-1","h-full","cursor-col-resize","before:content-['']","before:absolute","before:inset-y-0","before:-inset-x-1"],i=["h-1","w-full","cursor-row-resize","before:content-['']","before:absolute","before:inset-x-0","before:-inset-y-1"];function c(e,t){return"touches"in e&&e.touches.length>0?t?e.touches[0].clientX:e.touches[0].clientY:"clientX"in e?t?e.clientX:e.clientY:0}let u=(0,a.memo)(function(e){let{onResize:t,orientation:n="horizontal",ariaValueNow:u=50,onDoubleClick:d,minRatio:m=.1,ariaLabel:f}=e,p=(0,l.c)("worktree"),[h,g]=(0,a.useState)(!1),x=(0,a.useRef)(0),b=(0,a.useRef)(null),v="horizontal"===n,y=(0,a.useCallback)(e=>{e.preventDefault(),g(!0),x.current=c(e,v)},[v]),w=(0,a.useCallback)(e=>{1===e.touches.length&&(g(!0),x.current=c(e,v))},[v]),k=(0,a.useCallback)(e=>{if(!h)return;let n=c(e,v);t(n-x.current),x.current=n},[h,v,t]),j=(0,a.useCallback)(e=>{if(!h||1!==e.touches.length)return;let n=c(e,v);t(n-x.current),x.current=n},[h,v,t]),N=(0,a.useCallback)(()=>{g(!1)},[]),C=(0,a.useCallback)(()=>{d&&d()},[d]),S=(0,a.useCallback)(e=>{let n=0;v?"ArrowRight"===e.key?n=10:"ArrowLeft"===e.key&&(n=-10):"ArrowDown"===e.key?n=10:"ArrowUp"===e.key&&(n=-10),0!==n&&(e.preventDefault(),t(n))},[v,t]);(0,a.useEffect)(()=>(h&&(document.addEventListener("mousemove",k),document.addEventListener("mouseup",N),document.addEventListener("touchmove",j),document.addEventListener("touchend",N),document.body.style.userSelect="none",document.body.style.cursor=v?"col-resize":"row-resize"),()=>{document.removeEventListener("mousemove",k),document.removeEventListener("mouseup",N),document.removeEventListener("touchmove",j),document.removeEventListener("touchend",N),document.body.style.userSelect="",document.body.style.cursor=""}),[h,k,N,j,v]);let T=(0,a.useMemo)(()=>[...s,...v?o:i,...h?["bg-accent-500","dark:bg-accent-500","dragging",v?"w-2":"h-2"]:[]].join(" "),[v,h]);return(0,r.jsx)("div",{ref:b,role:"separator","aria-orientation":n,"aria-valuenow":u,"aria-valuemin":0,"aria-valuemax":100,"aria-label":null!=f?f:p("paneResizer.label",{arrows:p(v?"paneResizer.arrowsHorizontal":"paneResizer.arrowsVertical")}),tabIndex:0,className:T,onMouseDown:y,onTouchStart:w,onKeyDown:S,onDoubleClick:C})})},73190:(e,t,n)=>{n.d(t,{U:()=>u});var r=n(95155),a=n(12115),l=n(56827),s=n(49509);let o=[{key:"Left",label:"◀",ariaLabel:"Send Left"},{key:"Up",label:"▲",ariaLabel:"Send Up"},{key:"Down",label:"▼",ariaLabel:"Send Down"},{key:"Right",label:"▶",ariaLabel:"Send Right"},{key:"Enter",label:"↵",ariaLabel:"Send Enter"}],i={key:"Escape",label:"Esc",ariaLabel:"Send Escape"},c={key:"q",label:"q",ariaLabel:"Send q (quit)"};function u(e){let{worktreeId:t,cliToolId:n,instanceId:u,onKeysSent:d}=e,{activeKey:m,markPressed:f}=(0,s.t)(),p=(0,l.B)(t,n,u,d),h="codex"===n?[...o,i,c]:[...o,i],g=(0,a.useCallback)(e=>{f(e),p([e])},[f,p]);return(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5 py-1.5 bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800/50 rounded-lg",role:"toolbar","aria-label":"Terminal navigation keys",children:[(0,r.jsx)("span",{className:"text-xs text-amber-700 dark:text-amber-400 mx-2",title:"Send navigation / escape keys when the terminal is stuck in a TUI overlay",children:"Navigate"}),h.map(e=>{let{key:t,label:n,ariaLabel:a}=e;return(0,r.jsx)("button",{type:"button",className:"min-w-[44px] min-h-[44px] px-3 py-2 text-sm font-medium rounded-md\n border border-amber-300 dark:border-amber-700\n focus:outline-none focus:ring-2 focus:ring-amber-500\n transition-colors duration-75\n ".concat(m===t?"bg-amber-500 text-white border-amber-500 scale-95":"bg-white dark:bg-gray-700 hover:bg-amber-50 dark:hover:bg-gray-600 active:bg-amber-100 dark:active:bg-gray-500"),"aria-label":a,onClick:()=>g(t),children:n},t)})]})}},73333:(e,t,n)=>{n.d(t,{E:()=>z});var r=n(95155),a=n(12115),l=n(18955),s=n(80344),o=n(79651),i=n(48407);function c(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e=>{var t;return null!=(t=e.description)?t:""};if(!t.trim())return e;let r=t.toLowerCase();return e.map(e=>({...e,commands:e.commands.filter(e=>{let t=e.name.toLowerCase().includes(r),a=n(e).toLowerCase().includes(r);return t||a})})).filter(e=>e.commands.length>0)}function u(e,t){return"codex-skill"===e.source?"antigravity"===t?"/".concat(e.name):"$".concat(e.name):"/".concat(e.name)}function d(e,t){var n;return e.descriptionKey?t(e.descriptionKey):null!=(n=e.description)?n:""}function m(e){let{groups:t,onSelect:n,highlightedIndex:a=-1,className:s="",cliToolId:o}=e,i=(0,l.c)("worktree"),c=0;return 0===t.length?(0,r.jsx)("div",{className:"text-sm text-muted-foreground p-4 text-center ".concat(s),children:i("slashCommands.empty")}):(0,r.jsx)("div",{className:"overflow-y-auto ".concat(s),children:t.map(e=>(0,r.jsxs)("div",{className:"mb-2",children:[(0,r.jsx)("div",{className:"px-3 py-1.5 text-xs font-semibold text-muted-foreground uppercase tracking-wider bg-muted",children:e.label}),(0,r.jsx)("div",{children:e.commands.map(e=>{var t;let l=c;c++;let s=l===a;return(0,r.jsxs)("button",{type:"button","data-command-item":!0,"data-highlighted":s,onClick:()=>n(e),className:"w-full px-3 py-2 text-left flex items-start gap-2 hover:bg-accent-50 dark:hover:bg-accent-900/30 transition-colors ".concat(s?"bg-accent-100 dark:bg-accent-900/40":""),children:[(0,r.jsx)("span",{className:"text-accent-600 dark:text-accent-400 font-mono text-sm flex-shrink-0",children:u(e,o)}),(null==(t=e.cliTools)?void 0:t.length)===1&&"codex"===e.cliTools[0]&&(0,r.jsx)("span",{className:"mt-0.5 rounded border border-accent-200 bg-accent-50 px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-accent-700 dark:border-accent-800 dark:bg-accent-950/40 dark:text-accent-300",children:"Codex"}),"user-catalog"===e.source&&(0,r.jsx)("span",{"data-testid":"user-catalog-badge",className:"mt-0.5 rounded border border-border bg-muted px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:i("slashCommands.sourceBadge.userCatalog")}),(0,r.jsx)("span",{className:"text-muted-foreground text-sm truncate",children:d(e,i)})]},e.name)})})]},e.category))})}function f(e,t,n){if(t<=0||n<=0)return 0;let r=e+t+8-n;return r>0?-Math.min(r,Math.max(0,e-8)):e<8?8-e:0}let p=(0,a.memo)(function(e){let{isOpen:t,groups:n,onSelect:s,onClose:o,isMobile:i=!1,position:u,onFreeInput:p,isCatalogStale:h=!1,cliToolId:g}=e,[x,b]=(0,a.useState)(""),[v,y]=(0,a.useState)(0),w=(0,a.useRef)(null),k=(0,a.useRef)(null),j=(0,a.useRef)({x:0,y:0}),[N,C]=(0,a.useState)({x:0,y:0}),S=(0,l.c)("worktree"),T=(0,l.c)("common"),M=(0,a.useMemo)(()=>c(n,x,e=>d(e,S)),[n,x,S]),I=(0,a.useMemo)(()=>M.flatMap(e=>e.commands),[M]);(0,a.useEffect)(()=>{t&&(b(""),y(0),setTimeout(()=>{var e;null==(e=w.current)||e.focus()},50))},[t]);let E=(0,a.useCallback)(e=>{s(e),o()},[s,o]),A=(0,a.useCallback)(e=>{if(t)switch(e.key){case"Escape":e.preventDefault(),o();break;case"ArrowDown":e.preventDefault(),y(e=>Math.min(e+1,I.length-1));break;case"ArrowUp":e.preventDefault(),y(e=>Math.max(e-1,0));break;case"Enter":e.preventDefault(),I[v]&&E(I[v])}},[t,I,v,o,E]);if((0,a.useEffect)(()=>{if(t)return document.addEventListener("keydown",A),()=>{document.removeEventListener("keydown",A)}},[t,A]),(0,a.useLayoutEffect)(()=>{let e=e=>{j.current=e,C(t=>t.x===e.x&&t.y===e.y?t:e)};if(!t||i)return void e({x:0,y:0});let n=k.current;if(!n)return;let r=n.getBoundingClientRect();e({x:f(r.left-j.current.x,r.width,window.innerWidth),y:f(r.top-j.current.y,r.height,window.innerHeight)})},[t,i,M,null==u?void 0:u.top,null==u?void 0:u.left]),!t)return null;let L=h?(0,r.jsx)("div",{"data-testid":"slash-command-stale-note",className:"px-3 py-2 border-t border-border text-xs text-muted-foreground",children:S("slashCommands.catalogStale.hint")}):null;if(i)return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"fixed inset-0 bg-black/50 z-40",onClick:o,"aria-hidden":"true"}),(0,r.jsxs)("div",{"data-testid":"slash-command-bottom-sheet",className:"fixed bottom-0 left-0 right-0 bg-surface rounded-t-xl z-50 max-h-[70vh] flex flex-col shadow-xl",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[(0,r.jsx)("h2",{className:"text-lg font-semibold text-foreground",children:S("slashCommands.title")}),(0,r.jsx)("button",{type:"button",onClick:o,"aria-label":T("close"),className:"p-2 rounded-full hover:bg-muted",children:(0,r.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,r.jsx)("div",{className:"px-4 py-2 border-b border-border",children:(0,r.jsx)("input",{ref:w,type:"text",value:x,onChange:e=>b(e.target.value),placeholder:S("slashCommands.searchPlaceholder"),className:"w-full px-3 py-2 border border-input bg-surface dark:bg-surface-2 text-foreground rounded-lg focus:outline-none focus:ring-2 focus:ring-ring"})}),p&&(0,r.jsxs)("button",{type:"button","data-testid":"free-input-button",onClick:()=>p(x),className:"w-full px-4 py-3 text-left border-b border-border flex items-center gap-2 hover:bg-accent-50 dark:hover:bg-accent-900/30 transition-colors",children:[(0,r.jsx)("span",{className:"text-accent-600 dark:text-accent-400",children:(0,r.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})}),(0,r.jsx)("span",{className:"text-muted-foreground",children:S("slashCommands.enterCustomCommand")})]}),(0,r.jsx)(m,{groups:M,onSelect:E,highlightedIndex:v,className:"flex-1 overflow-y-auto pb-20",cliToolId:g}),L]})]});let R=u?{top:u.top,left:u.left}:{bottom:"100%",left:0,marginBottom:"4px"};return(0,r.jsxs)("div",{ref:k,role:"listbox","data-testid":"slash-command-dropdown",className:"absolute bg-surface border border-border rounded-lg shadow-lg z-50 w-80 max-h-96 flex flex-col",style:0!==N.x||0!==N.y?{...R,transform:"translate(".concat(N.x,"px, ").concat(N.y,"px)")}:R,children:[(0,r.jsx)("div",{className:"px-3 py-2 border-b border-border",children:(0,r.jsx)("input",{ref:w,type:"text",value:x,onChange:e=>b(e.target.value),placeholder:S("slashCommands.searchPlaceholder"),className:"w-full px-3 py-1.5 text-sm border border-input bg-surface dark:bg-surface-2 text-foreground rounded focus:outline-none focus:ring-1 focus:ring-ring"})}),p&&(0,r.jsxs)("button",{type:"button","data-testid":"free-input-button",onClick:()=>p(x),className:"w-full px-3 py-2 text-left border-b border-border flex items-center gap-2 hover:bg-accent-50 dark:hover:bg-accent-900/30 transition-colors text-sm",children:[(0,r.jsx)("span",{className:"text-accent-600 dark:text-accent-400",children:(0,r.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})}),(0,r.jsx)("span",{className:"text-muted-foreground",children:S("slashCommands.enterCustomCommand")})]}),(0,r.jsx)(m,{groups:M,onSelect:E,highlightedIndex:v,className:"flex-1 overflow-y-auto",cliToolId:g}),L,(0,r.jsxs)("div",{className:"px-3 py-1.5 border-t border-border text-xs text-muted-foreground flex gap-3",children:[(0,r.jsxs)("span",{children:[(0,r.jsx)("kbd",{className:"px-1 py-0.5 bg-muted rounded",children:"Enter"})," ",S("slashCommands.selectHint")]}),(0,r.jsxs)("span",{children:[(0,r.jsx)("kbd",{className:"px-1 py-0.5 bg-muted rounded",children:"Esc"})," ",S("slashCommands.closeHint")]})]})]})});var h=n(3005);let g=(0,a.memo)(function(e){let{worktreeId:t,cliToolId:n,instanceId:s,disabled:o=!1,onInterrupt:i}=e,c=(0,l.c)("worktree"),[u,d]=(0,a.useState)(!1),m=(0,a.useRef)(0),f=(0,a.useCallback)(async()=>{let e=Date.now();if(!(e-m.current<1e3)){m.current=e,d(!0);try{let e=s&&s!==n?{cliToolId:n,instanceId:s}:{cliToolId:n},r=await fetch("/api/worktrees/".concat(t,"/interrupt"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(r.ok)null==i||i();else{let e=await r.json().catch(()=>({}));console.error("[InterruptButton] Failed to send interrupt:",e.error||r.statusText)}}catch(e){console.error("[InterruptButton] Error sending interrupt:",e)}finally{d(!1)}}},[t,n,s,i]);return(0,r.jsx)("button",{type:"button",onClick:f,disabled:o||u,className:"flex-shrink-0 p-2 text-danger hover:bg-danger/10 rounded-full transition-colors disabled:text-muted-foreground/40 disabled:hover:bg-transparent","aria-label":c("interrupt.stopProcessing"),"data-testid":"interrupt-button",children:u?(0,r.jsx)(h.y,{size:"md"}):(0,r.jsx)(x,{})})});function x(){return(0,r.jsx)("svg",{className:"h-5 w-5",fill:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})})}var b=n(44309),v=n(50386),y=n(62512),w=n(4788),k=n(5917),j=n(75426),N=n(77588);let C=(0,a.memo)(function(e){let{worktreeId:t,cliToolId:n,instanceId:s,disabled:o=!1,onActionComplete:c,showToast:u}=e,d=(0,l.c)("worktree.opencodeSession"),m=(0,i.SC)(),[f,p]=(0,a.useState)(null),[h,g]=(0,a.useState)(null),[x,C]=(0,a.useState)(null),[S,T]=(0,a.useState)(!1),[M,I]=(0,a.useState)(null),E="opencode"===n,A=null!=s?s:n,L=(0,a.useCallback)(e=>{if(u){I(null),u(e,"error");return}I(e)},[u]),R=(0,a.useCallback)((e,t,n)=>"NO_OPENCODE_PORT"===e.code?d("errorNoPort"):"NO_OPENCODE_SESSION"===e.code?d(n):e.error||t||d("errorUnknown"),[d]),P=(0,a.useCallback)(async()=>{if(E)try{let e=await fetch("/api/worktrees/".concat(t,"/opencode/share?instance=").concat(encodeURIComponent(A)));if(!e.ok)return void g(null);g(await e.json())}catch(e){g(null)}},[E,t,A]);(0,a.useEffect)(()=>{P()},[P]);let O=(0,a.useCallback)(async e=>{p(e),I(null);try{let n=await fetch("/api/worktrees/".concat(t,"/opencode/session"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:e,instanceId:A})});if(!n.ok){let t=await n.json().catch(()=>({}));console.error("[OpencodeSessionControls] action failed:",e,t.error||n.statusText),L(R(t,n.statusText,"errorNoSessionFork"));return}null==c||c(e),"list"!==e&&(C(null),P())}catch(e){console.error("[OpencodeSessionControls] request error:",e),L(d("errorRequestFailed"))}finally{p(null)}},[t,A,c,P,L,R,d]),z=(0,a.useCallback)(async()=>{if(await m({title:d("shareConfirmTitle"),description:d("shareConfirmBody"),confirmLabel:d("shareConfirmLabel"),variant:"danger"})){p("share"),I(null);try{let e=await fetch("/api/worktrees/".concat(t,"/opencode/share"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({instanceId:A})}),n=await e.json().catch(()=>({}));if(!e.ok||"string"!=typeof n.url){console.error("[OpencodeSessionControls] share failed:",n.error||e.statusText),L(R(n,e.statusText,"errorNoSessionShare")),P();return}C(n.url),T(!1),P()}catch(e){console.error("[OpencodeSessionControls] share request error:",e),L(d("errorRequestFailed"))}finally{p(null)}}},[m,d,t,A,P,L,R]),F=(0,a.useCallback)(async()=>{p("unshare"),I(null);try{let e=await fetch("/api/worktrees/".concat(t,"/opencode/share?instance=").concat(encodeURIComponent(A)),{method:"DELETE"});if(!e.ok){let t=await e.json().catch(()=>({}));console.error("[OpencodeSessionControls] unshare failed:",t.error||e.statusText),L(R(t,e.statusText,"errorNoSessionShare"));return}C(null),T(!1),P()}catch(e){console.error("[OpencodeSessionControls] unshare request error:",e),L(d("errorRequestFailed"))}finally{p(null)}},[t,A,P,L,R,d]),D=(0,a.useCallback)(async()=>{if(null!==x)try{await navigator.clipboard.writeText(x),T(!0),I(null)}catch(e){console.error("[OpencodeSessionControls] clipboard write failed:",e),L(d("errorCopyFailed"))}},[x,L,d]);if(!E)return null;let H=[{action:"new",icon:(0,r.jsx)(b.A,{className:"h-5 w-5","aria-hidden":"true"})},{action:"list",icon:(0,r.jsx)(v.A,{className:"h-5 w-5","aria-hidden":"true"})},{action:"fork",icon:(0,r.jsx)(y.A,{className:"h-5 w-5","aria-hidden":"true"})}],B="flex-shrink-0 p-2 text-muted-foreground hover:text-accent-600 hover:bg-accent-50 dark:hover:text-accent-400 dark:hover:bg-accent-900/30 rounded-full transition-colors disabled:text-muted-foreground/50 disabled:hover:bg-transparent";return(0,r.jsxs)("div",{className:"flex items-center gap-1","data-testid":"opencode-session-controls",children:[H.map(e=>{let{action:t,icon:n}=e;return(0,r.jsx)(i.$n,{variant:"ghost",type:"button",onClick:()=>void O(t),disabled:o||null!==f,className:B,"aria-label":d(t),title:d(t),"data-testid":"opencode-session-".concat(t),children:f===t?(0,r.jsx)(i.y$,{size:"md"}):n},t)}),(null==h?void 0:h.canShare)?(0,r.jsx)(i.$n,{variant:"ghost",type:"button",onClick:()=>void z(),disabled:o||null!==f,className:B,"aria-label":d("share"),title:d("share"),"data-testid":"opencode-session-share",children:"share"===f?(0,r.jsx)(i.y$,{size:"md"}):(0,r.jsx)(w.A,{className:"h-5 w-5","aria-hidden":"true"})}):null,null!==x?(0,r.jsxs)("span",{className:"flex min-w-0 items-center gap-1 rounded-full border border-warning-border bg-warning-subtle px-2 py-0.5 text-xs text-warning-foreground","data-testid":"opencode-share-result",children:[(0,r.jsx)("span",{className:"sr-only",children:d("sharePublicNotice")}),(0,r.jsx)("a",{href:x,target:"_blank",rel:"noopener noreferrer",className:"truncate text-accent-600 underline dark:text-accent-400",title:x,"data-testid":"opencode-share-url",children:x}),(0,r.jsx)(i.$n,{variant:"ghost",type:"button",onClick:()=>void D(),className:"flex-shrink-0 rounded-full p-1 text-muted-foreground hover:text-accent-600","aria-label":d("shareCopy"),title:d("shareCopy"),"data-testid":"opencode-share-copy",children:S?(0,r.jsx)(k.A,{className:"h-3.5 w-3.5","aria-hidden":"true"}):(0,r.jsx)(j.A,{className:"h-3.5 w-3.5","aria-hidden":"true"})}),(0,r.jsx)(i.$n,{variant:"ghost",type:"button",onClick:()=>void F(),disabled:null!==f,className:"flex-shrink-0 rounded-full p-1 text-muted-foreground hover:text-danger-foreground","aria-label":d("unshare"),title:d("unshare"),"data-testid":"opencode-session-unshare",children:"unshare"===f?(0,r.jsx)(i.y$,{size:"sm"}):(0,r.jsx)(N.A,{className:"h-3.5 w-3.5","aria-hidden":"true"})})]}):null,null!==M?(0,r.jsx)("span",{role:"alert",className:"flex min-w-0 items-center rounded-full border border-danger-border bg-danger-subtle px-2 py-0.5 text-xs text-danger-foreground",title:M,"data-testid":"opencode-session-error",children:(0,r.jsx)("span",{className:"truncate",children:M})}):null]})});var S=n(72115),T=n(74385),M=n(38218),I=n(19985),E=n(63881),A=n(8355);let L="commandmate:draft-message:",R="Queued (session busy) — your message will run after the current task finishes.",P=a.useLayoutEffect;function O(e,t){return"".concat(L).concat(e,":").concat(t)}let z=(0,a.memo)(function(e){let{worktreeId:t,onMessageSent:n,cliToolId:d,instanceId:m,isSessionRunning:f=!1,pendingInsertText:h,onInsertConsumed:x,splitIndex:b=0,onFocus:v,isProcessing:y=!1,showToast:w,autoYesSlot:k,agentModeSlot:j,directInputSlot:N,onOptimisticSend:z,heightScope:F,maxHeight:D}=e,H=(0,l.c)("worktree"),[B,q]=(0,a.useState)(""),[K,U]=(0,a.useState)(!1),[_,W]=(0,a.useState)(null),[$,J]=(0,a.useState)(!1),[Q,Y]=(0,a.useState)(!1),[G,V]=(0,a.useState)(!1),Z=(0,a.useRef)(null),X=(0,a.useRef)(null),ee=(0,a.useRef)(!1),et=(0,a.useRef)(null),en=(0,a.useRef)(null),er=(0,M.a)(),{groups:ea,isCatalogStale:el}=function(e,t){let[n,r]=(0,a.useState)([]),[l,o]=(0,a.useState)(!0),[i,u]=(0,a.useState)(null),[d,m]=(0,a.useState)(""),[f,p]=(0,a.useState)(t||"claude"),[h,g]=(0,a.useState)({}),x=(0,a.useCallback)(async()=>{try{var n;o(!0),u(null);let a=e?"/api/worktrees/".concat(e,"/slash-commands"):"/api/slash-commands";t&&(a+="?cliTool=".concat(t));let l=await fetch(a,{cache:"no-store"});if(!l.ok)throw Error("HTTP error ".concat(l.status));let s=await l.json();r(s.groups),p(s.cliTool||t||"claude"),g(null!=(n=s.catalogStaleness)?n:{})}catch(e){u((0,s.hS)(e)),r([]),g({})}finally{o(!1)}},[e,t]);(0,a.useEffect)(()=>{x()},[x]),(0,a.useEffect)(()=>{if(!e)return;let t=t=>{let n=t.detail;(null==n?void 0:n.worktreeId)===e&&x()};return window.addEventListener(T.I,t),()=>window.removeEventListener(T.I,t)},[e,x]);let b=(0,a.useMemo)(()=>n.flatMap(e=>e.commands),[n]),v=(0,a.useMemo)(()=>c(n,d),[n,d]),y=(0,a.useMemo)(()=>Object.values(h).some(e=>e.stale),[h]);return{groups:n,filteredGroups:v,allCommands:b,loading:l,error:i,filter:d,setFilter:m,refresh:(0,a.useCallback)(()=>{x()},[x]),cliTool:f,isCatalogStale:y}}(t,d),es=!er&&!!F,{height:eo,resizeBy:ei,reset:ec}=(0,E.lo)({worktreeId:t,scope:F,maxHeight:D,enabled:es}),eu="number"==typeof D&&Number.isFinite(D)?D:1/0,ed=(0,a.useCallback)(e=>{var t,n;ei(-e,null!=(n=null==(t=Z.current)?void 0:t.getBoundingClientRect().height)?n:A.bw)},[ei]),{attachedImage:em,fileInputRef:ef,isUploading:ep,error:eh,acceptAttribute:eg,openFileDialog:ex,handleFileSelect:eb,removeAttachment:ev,resetAfterSend:ey}=function(e,t){let[n,r]=(0,a.useState)(null),[l,s]=(0,a.useState)(!1),[o,i]=(0,a.useState)(null),c=(0,a.useRef)(null),u=(0,a.useCallback)(()=>{var e;null==(e=c.current)||e.click()},[]),d=(0,a.useCallback)(async n=>{var a;let l=null==(a=n.target.files)?void 0:a[0];if(!l)return;i(null);let o=function(e){let t=e.name.lastIndexOf(".");if(-1===t)return"Unsupported file format";let n=(0,I.HB)(e.name.substring(t));if(!I.Hv.includes(n))return"Unsupported file format: ".concat(n);if(e.size>I.Fg){let e=I.Fg/1024/1024;return"File size exceeds ".concat(e,"MB limit")}return null}(l);if(o){i(o),c.current&&(c.current.value="");return}s(!0);try{let n=await t(e,l);r({file:l,path:n.path})}catch(e){i(e instanceof Error?e.message:"Upload failed")}finally{s(!1),c.current&&(c.current.value="")}},[e,t]),m=(0,a.useCallback)(()=>{r(null),i(null)},[]),f=(0,a.useCallback)(()=>{r(null)},[]);return{attachedImage:n,fileInputRef:c,isUploading:l,error:o,acceptAttribute:I.F5,openFileDialog:u,handleFileSelect:d,removeAttachment:m,resetAfterSend:f}}(t,(0,a.useCallback)((e,t)=>s.y.uploadImageFile(e,t),[]));(0,a.useEffect)(()=>{try{0===b&&function(e){try{let t="".concat(L).concat(e),n=window.localStorage.getItem(t);if(null===n)return;let r=O(e,0);null===window.localStorage.getItem(r)&&window.localStorage.setItem(r,n),window.localStorage.removeItem(t)}catch(e){}}(t);let e=window.localStorage.getItem(O(t,b));e?q(e):q("")}catch(e){}return()=>{en.current&&clearTimeout(en.current)}},[t,b]),(0,a.useEffect)(()=>{en.current&&clearTimeout(en.current),en.current=setTimeout(()=>{try{let e=O(t,b);B?window.localStorage.setItem(e,B):window.localStorage.removeItem(e)}catch(e){}},500)},[B,t,b]),P(()=>{let e=Z.current;if(!e)return;let t="number"==typeof D&&Number.isFinite(D)?D:1/0,n=Math.min(null!=eo?eo:A.bw,t);if(!B){e.style.height="".concat(n,"px");return}e.style.height="auto";let r=Math.min(e.scrollHeight,A.vF);e.style.height="".concat(Math.min(Math.max(n,r),t),"px")},[B,eo,D]),(0,a.useEffect)(()=>{h&&(q(e=>""===e.trim()?h:e+"\n\n"+h),null==x||x())},[h,x]);let ew=(0,a.useCallback)(async()=>{if($||!B.trim()&&!em||K)return;let e=B.trim(),r=d||"claude",a={cliToolId:r};if(m&&m!==r&&(a.instanceId=m),em&&(a.imagePath=em.path),z){W(null),z(e,a),q(""),V(!1),ey();try{window.localStorage.removeItem(O(t,b))}catch(e){}y&&(null==w||w(R,"warning")),null==n||n(r);return}try{U(!0),W(null);let l=await s.y.sendMessage(t,e,a);q(""),V(!1),ey();try{window.localStorage.removeItem(O(t,b))}catch(e){}y&&(null==w||w(R,"warning")),null==n||n(r,l)}catch(e){W((0,s.hS)(e))}finally{U(!1)}},[$,B,em,K,t,d,m,n,ey,b,y,w,z]),ek=(0,a.useCallback)(async e=>{e.preventDefault(),await ew()},[ew]),ej=(0,a.useCallback)(()=>{J(!0),ee.current=!1,X.current&&clearTimeout(X.current)},[]),eN=(0,a.useCallback)(()=>{J(!1),ee.current=!0,X.current&&clearTimeout(X.current),X.current=setTimeout(()=>{ee.current=!1},300)},[]),eC=(0,a.useCallback)(e=>{var t;q("".concat(u(e,d)," ")),Y(!1),null==(t=Z.current)||t.focus()},[d]),eS=(0,a.useCallback)(()=>{var e;Y(!1),V(!1),null==(e=Z.current)||e.focus()},[]),eT=(0,a.useCallback)(e=>{Y(!1),V(!0),q(e?"/".concat(e):"/"),setTimeout(()=>{var e;null==(e=Z.current)||e.focus()},50)},[]),eM=(0,a.useCallback)(e=>{let t=e.target.value;if(q(t),""===t){V(!1),Y(!1);return}if(G)return;let n="/"===t||t.startsWith("/")&&!t.includes(" "),r="codex"===d&&("$"===t||t.startsWith("$")&&!t.includes(" "));n||r?Y(!0):Y(!1)},[G,d]),eI=(0,a.useCallback)(e=>{let{keyCode:t}=e.nativeEvent;if(229!==t){if("Escape"===e.key&&Q){e.preventDefault(),eS();return}if(ee.current&&"Enter"===e.key){ee.current=!1;return}if("Enter"===e.key&&!$&&(!Q||G)){if(er)return;e.shiftKey||(e.preventDefault(),ew())}}},[Q,G,$,er,ew,eS]),eE=(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.$n,{variant:"ghost",type:"button",onClick:ex,disabled:ep||K,className:"flex-shrink-0 p-2 text-muted-foreground hover:text-accent-600 hover:bg-accent-50 dark:hover:text-accent-400 dark:hover:bg-accent-900/30 rounded-full transition-colors disabled:text-muted-foreground/50 disabled:hover:bg-transparent","aria-label":H("composer.attachImage"),"data-testid":"attach-image-button",children:ep?(0,r.jsx)(i.y$,{size:"md"}):(0,r.jsx)("svg",{className:"h-5 w-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.172 7l-6.586 6.586a2 2 0 102.828 2.828l6.414-6.586a4 4 0 00-5.656-5.656l-6.415 6.585a6 6 0 108.486 8.486L20.5 13"})})}),(0,r.jsx)(C,{worktreeId:t,cliToolId:d||"claude",instanceId:m,disabled:!f,showToast:w}),j]}),eA=(0,r.jsx)(g,{worktreeId:t,cliToolId:d||"claude",instanceId:m,disabled:!f});return(0,r.jsxs)("div",{ref:et,className:"space-y-2 relative","data-testid":"message-input-container",children:[(_||eh)&&(0,r.jsx)("div",{className:"p-2 bg-danger-subtle border border-danger-border rounded text-sm text-danger-foreground",children:_||eh}),em&&(0,r.jsxs)("div",{className:"flex items-center gap-2 px-4 py-1.5 bg-accent-50 dark:bg-accent-900/20 border border-accent-200 dark:border-accent-800 rounded-lg text-sm","data-testid":"image-attachment-preview",children:[(0,r.jsx)("svg",{className:"h-4 w-4 flex-shrink-0 text-accent-600 dark:text-accent-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})}),(0,r.jsx)("span",{className:"truncate text-accent-800 dark:text-accent-300",children:em.file.name}),(0,r.jsx)("button",{type:"button",onClick:ev,className:"flex-shrink-0 p-0.5 text-accent-600 hover:text-danger-foreground dark:text-accent-400 rounded transition-colors","aria-label":H("composer.removeAttachment"),"data-testid":"remove-attachment-button",children:(0,r.jsx)("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,r.jsx)("input",{ref:ef,type:"file",accept:eg,onChange:eb,className:"hidden","data-testid":"image-file-input"}),(0,r.jsxs)("form",{onSubmit:ek,className:"relative rounded-xl bg-surface border border-border shadow-sm px-3 py-2 focus-within:ring-2 focus-within:ring-accent-500/40 transition-shadow flex flex-col gap-1.5",children:[es&&(0,r.jsx)("div",{className:"absolute inset-x-3 top-0 -translate-y-1/2","data-testid":"composer-resize-handle","data-height-mode":null===eo?"auto":"floor",children:(0,r.jsx)(S.f,{orientation:"vertical",onResize:ed,onDoubleClick:ec,ariaLabel:H("composer.resizeHandle"),ariaValueNow:function(e,t){if(null===e||null==t)return 0;let n=t-A.bw;return n<=0?100:Math.round(Math.min(100,Math.max(0,(e-A.bw)/n*100)))}(eo,D)})}),(0,r.jsxs)("div",{className:"@container flex flex-col gap-1","data-testid":"composer-input-row",children:[(0,r.jsx)("div",{className:"flex items-center gap-1","data-testid":"composer-toolbar",children:er?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.$n,{variant:"ghost",type:"button",onClick:()=>{G&&V(!1),Y(!0)},className:"flex-shrink-0 p-2 text-muted-foreground hover:text-accent-600 hover:bg-accent-50 dark:hover:text-accent-400 dark:hover:bg-accent-900/30 rounded-full transition-colors","aria-label":H("composer.showSlashCommands"),"data-testid":"mobile-command-button",children:(0,r.jsx)("svg",{className:"h-5 w-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 20l4-16m2 16l4-16M6 9h14M4 15h14"})})}),eE,N,eA]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"flex min-w-0 flex-1 items-center gap-1 overflow-x-auto scrollbar-hide","data-testid":"composer-toolbar-start",children:eE}),(0,r.jsxs)("div",{className:"flex flex-shrink-0 items-center gap-1","data-testid":"composer-toolbar-end",children:[N,eA]})]})}),(0,r.jsxs)("div",{className:"flex ".concat(er?"items-center":"items-end"," gap-2 flex-1 min-w-0"),"data-testid":"composer-textarea-row",children:[(0,r.jsx)("textarea",{ref:Z,"data-testid":"message-input-textarea",value:B,onChange:eM,onKeyDown:eI,onCompositionStart:ej,onCompositionEnd:eN,onFocus:v,placeholder:H("composer.placeholder"),disabled:K,rows:1,inputMode:"text",enterKeyHint:"send",className:"flex-1 outline-none bg-transparent resize-none overflow-y-auto scrollbar-thin",style:{minHeight:"".concat(Math.min(null!=eo?eo:A.bw,eu),"px"),maxHeight:"".concat(Math.min(Math.max(null!=eo?eo:0,A.vF),eu),"px"),paddingTop:"8px",paddingBottom:"8px",lineHeight:"20px"}}),(0,r.jsx)(i.$n,{variant:"ghost",type:"submit","data-testid":"send-message-button","data-can-send":String((!!B.trim()||!!em)&&!K),disabled:!B.trim()&&!em||K,className:"flex-shrink-0 p-2 rounded-full transition-colors disabled:hover:bg-transparent ".concat((B.trim()||em)&&!K?"bg-accent-600 text-white hover:bg-accent-700 shadow-sm":"text-muted-foreground/50"),"aria-label":H("composer.sendMessage"),children:K?(0,r.jsx)(i.y$,{size:"md"}):(0,r.jsx)("svg",{className:"h-5 w-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 19l9 2-9-18-9 18 9-2zm0 0v-8"})})})]})]}),(k||!er)&&(0,r.jsxs)("div",{className:"".concat(er?"":"@container ","flex items-center justify-between gap-2 min-w-0"),"data-testid":"composer-meta-row",children:[(0,r.jsx)("div",{className:"flex items-center gap-2 min-w-0 overflow-x-auto scrollbar-hide".concat(er?"":" whitespace-nowrap"),"data-testid":"composer-auto-yes",children:k}),!er&&(0,r.jsxs)("div",{className:"hidden @min-[420px]:flex flex-shrink-0 items-center gap-1.5 whitespace-nowrap text-[11px] text-muted-foreground select-none","data-testid":"composer-hints",children:[(0,r.jsx)(o.u,{children:"/"}),(0,r.jsx)("span",{children:H("composer.commandsHint")}),(0,r.jsx)("span",{"aria-hidden":"true",className:"opacity-50",children:"\xb7"}),(0,r.jsx)(o.u,{children:"⇧"}),(0,r.jsx)(o.u,{children:"↵"}),(0,r.jsx)("span",{children:H("composer.newlineHint")})]})]})]}),(0,r.jsx)(p,{isOpen:Q,groups:ea,onSelect:eC,onClose:eS,isMobile:er,onFreeInput:eT,isCatalogStale:el,cliToolId:d})]})})},76351:(e,t,n)=>{n.d(t,{z9:()=>l,$s:()=>i,t6:()=>s,Ni:()=>o,eJ:()=>u,$B:()=>d,P0:()=>c});var r=n(82912),a=n.n(r);n(95704);let l=[36e5,108e5,288e5],s=36e5,o={36e5:"autoYes.durations.1h",108e5:"autoYes.durations.3h",288e5:"autoYes.durations.8h"},i=1e3;function c(e){if(e.length>500)return{valid:!1,error:"Pattern must be ".concat(500," characters or less")};if(!a()(e))return{valid:!1,error:"Pattern may cause performance issues (catastrophic backtracking detected)"};try{return new RegExp(e),{valid:!0}}catch(e){return{valid:!1,error:"Invalid regular expression syntax"}}}function u(e,t){arguments.length>2&&void 0!==arguments[2]&&arguments[2];try{return e.test(t)}catch(e){return null}}function d(e){let t=Math.max(0,e-Date.now()),n=Math.floor(t/36e5),r=Math.floor(t%36e5/6e4),a=Math.floor(t%6e4/1e3);return n>0?"".concat(n,":").concat(r.toString().padStart(2,"0"),":").concat(a.toString().padStart(2,"0")):"".concat(r.toString().padStart(2,"0"),":").concat(a.toString().padStart(2,"0"))}},76471:(e,t,n)=>{n.d(t,{Ej:()=>u,Jd:()=>o,Mq:()=>c,rH:()=>i});var r=n(95155),a=n(12115),l=n(18955),s=n(48481);let o="bg-transparent border-2 border-muted-foreground",i="status.unknown";function c(e,t){return!0===t&&"ready"===e}let u=(0,a.memo)(function(e){let{status:t,label:n,waitingKind:a,unclassified:u}=e,d=(0,l.c)("common"),m=c(t,u);return(0,r.jsx)(s.m,{"data-testid":"status-indicator",status:t,label:m?null!=n?n:d(i):n,waitingKind:a,size:"lg",className:m?o:void 0,"data-unclassified":m?"true":void 0})})},78596:(e,t,n)=>{n.d(t,{l5:()=>d});var r=n(46980),a=n.n(r),l=n(62459),s=n.n(l),o=n(68872),i=n(51515);let c=new(s())({fg:"#d1d5db",bg:"#1f2937",newline:!0,escapeXML:!0}),u=/[\x40-\x7e]/;function d(e){let t=function(e){if(e.length<=o.ZJ)return e;let t=o.ED+"\n",n=o.ZJ-t.length;if(n<=0)return o.ED.slice(0,o.ZJ);let r=e.length-n,a=e.indexOf("\n",r);if(-1!==a&&a-r<=o.yi)return t+e.slice(a+1);let l=function(e,t){let n=e.lastIndexOf("\x1b",t-1);if(-1===n)return t;let r=e.slice(n+1,t);if(u.test(r.slice(1)))return t;for(let n=t;n<e.length;n++)if(u.test(e[n]))return n+1;return e.length}(e,r),s=e.charCodeAt(l);return s>=56320&&s<=57343&&(l+=1),t+e.slice(l)}(e.replace(/\0/g,"")),n=(0,i.wJ)(t),r=c.toHtml(n);return a().sanitize(r,{ALLOWED_TAGS:["span","br"],ALLOWED_ATTR:["style"],ALLOW_DATA_ATTR:!1})}},78660:(e,t,n)=>{n.d(t,{E2:()=>o,F0:()=>l,Yr:()=>i,e1:()=>s});var r=n(12115),a=n(20877);let l=500,s=300,o=2;function i(e){let{output:t,containerRef:n}=e,[i,c]=(0,r.useState)(!1),[u,d]=(0,r.useState)(""),[m,f]=(0,r.useState)([]),[p,h]=(0,r.useState)(0),[g,x]=(0,r.useState)(!1),b=(0,r.useRef)(null),v=(0,r.useRef)(""),y=m.length,w=(0,r.useCallback)(e=>{var t;if(e.length<o||!n.current)return{positions:[],capped:!1};let r=(null!=(t=n.current.textContent)?t:"").toLowerCase(),a=e.toLowerCase(),s=[],i=0;for(;s.length<l;){let t=r.indexOf(a,i);if(-1===t)break;s.push({start:t,end:t+e.length}),i=t+1}let c=s.length>=l&&-1!==r.indexOf(a,i);return{positions:s,capped:c}},[n]),k=(0,r.useCallback)(e=>{let{positions:t,capped:r}=w(e);f(t),h(0),x(r),n.current&&(t.length>0?(0,a.aX)(n.current,t,0):(0,a.HI)())},[w,n]),j=(0,r.useCallback)(e=>{d(e),b.current&&clearTimeout(b.current),v.current=e,b.current=setTimeout(()=>{k(e)},s)},[k]),N=(0,r.useCallback)(()=>{c(!0)},[]),C=(0,r.useCallback)(()=>{c(!1),d(""),v.current="",f([]),h(0),x(!1),b.current&&clearTimeout(b.current),(0,a.HI)()},[]),S=(0,r.useCallback)(()=>{0!==y&&h(e=>{let t=(e+1)%y;return n.current&&m.length>0&&(0,a.aX)(n.current,m,t),t})},[y,m,n]),T=(0,r.useCallback)(()=>{0!==y&&h(e=>{let t=(e-1+y)%y;return n.current&&m.length>0&&(0,a.aX)(n.current,m,t),t})},[y,m,n]);return(0,r.useEffect)(()=>{v.current.length<o||k(v.current)},[t,k]),(0,r.useEffect)(()=>()=>{b.current&&clearTimeout(b.current),(0,a.HI)()},[]),{isOpen:i,query:u,matchCount:y,currentIndex:p,isAtMaxMatches:g,openSearch:N,closeSearch:C,setQuery:j,nextMatch:S,prevMatch:T}}},80635:(e,t,n)=>{n.d(t,{v4:()=>s});var r=n(12115);function a(e){let t=new Set;for(let n of e)"user"===n.role&&t.add(n.id);return t}function l(e,t,n){let r=new Set,a=new Set,l=e.filter(e=>"sending"===e.status);if(0===l.length)return{reconciledTempIds:r,consumedServerIds:a};let s=t.filter(e=>"user"===e.role&&!n.has(e.id)).sort((e,t)=>e.timestamp.getTime()-t.timestamp.getTime()),o=new Set;for(let e of[...l].sort((e,t)=>e.timestamp.getTime()-t.timestamp.getTime())){let t=s.find(t=>!o.has(t.id)&&!e.baselineUserIds.has(t.id)&&t.content===e.content);t&&(o.add(t.id),r.add(e.tempId),a.add(t.id))}return{reconciledTempIds:r,consumedServerIds:a}}function s(e){var t,n;let{worktreeId:s,serverMessages:o,sendFn:i,onSent:c,timeoutMs:u=3e4,connectivity:d,resendGraceMs:m=250}=e,[f,p]=(0,r.useState)([]),h=null!=(t=null==d?void 0:d.offline)&&t,g=null==(n=null==d?void 0:d.reachable)||n,x=(0,r.useRef)(o);x.current=o;let b=(0,r.useRef)(f);b.current=f;let v=(0,r.useRef)(c);v.current=c;let y=(0,r.useRef)(i);y.current=i;let w=(0,r.useRef)(h);w.current=h;let k=(0,r.useRef)(0),j=(0,r.useRef)(new Map),N=(0,r.useRef)(new Set),C=(0,r.useRef)(new Set),S=(0,r.useRef)(new Set),T=(0,r.useCallback)(e=>{let t=j.current.get(e);void 0!==t&&(clearTimeout(t),j.current.delete(e))},[]),M=(0,r.useCallback)(e=>{T(e),p(t=>t.map(t=>t.tempId!==e||"sending"!==t.status?t:w.current&&!t.autoResendAttempted?t.queued?t:{...t,queued:!0}:{...t,status:"error",queued:!1}))},[T]),I=(0,r.useCallback)(e=>{T(e);let t=setTimeout(()=>{j.current.delete(e),M(e)},u);j.current.set(e,t)},[T,M,u]),E=(0,r.useCallback)(async e=>{I(e.tempId),N.current.add(e.tempId);try{var t;await y.current(e.content,e.options),p(t=>t.map(t=>t.tempId!==e.tempId||t.accepted?t:{...t,accepted:!0})),null==(t=v.current)||t.call(v)}catch(t){M(e.tempId)}finally{N.current.delete(e.tempId)}},[I,M]),A=(0,r.useCallback)((e,t)=>{let n={tempId:"pending-".concat(k.current++),content:e,options:t,timestamp:new Date,status:"sending",baselineUserIds:a(x.current),queued:!1,accepted:!1,autoResendAttempted:!1};p(e=>[...e,n]),E(n)},[E]),L=(0,r.useCallback)(e=>{let t=b.current.find(t=>t.tempId===e);if(!t)return;let n={...t,status:"sending",timestamp:new Date,baselineUserIds:a(x.current),queued:!1,accepted:!1,autoResendAttempted:!1};p(t=>t.map(t=>t.tempId===e?n:t)),E(n)},[E]),R=(0,r.useCallback)(e=>{let t=b.current.find(t=>t.tempId===e);return T(e),N.current.delete(e),p(t=>t.filter(t=>t.tempId!==e)),null==t?void 0:t.content},[T]);(0,r.useEffect)(()=>{let{reconciledTempIds:e,consumedServerIds:t}=l(b.current,o,C.current),n=new Set(o.map(e=>e.id)),r=new Set;C.current.forEach(e=>{n.has(e)&&r.add(e)}),t.forEach(e=>r.add(e)),C.current=r,0!==e.size&&(e.forEach(e=>S.current.add(e)),e.forEach(T),p(t=>t.filter(t=>!e.has(t.tempId))))},[o,T]),(0,r.useEffect)(()=>{if(!h)return;let e=f.filter(e=>"sending"===e.status&&!e.queued&&!e.autoResendAttempted);if(0===e.length)return;let t=new Set(e.map(e=>e.tempId));t.forEach(T),p(e=>e.map(e=>t.has(e.tempId)?{...e,queued:!0}:e))},[h,f,T]);let P=(0,r.useRef)(!1),[O,z]=(0,r.useState)(0),[F,D]=(0,r.useState)(0),H=(0,r.useRef)(m);H.current=m;let B=f.reduce((e,t)=>t.queued&&"sending"===t.status?e+1:e,0);return(0,r.useEffect)(()=>{(!g||B>0)&&(P.current=!0),g&&P.current&&(P.current=!1,b.current.some(e=>"sending"===e.status)&&z(e=>e+1))},[g,B]),(0,r.useEffect)(()=>{let e;if(0===O)return;let t=!1;return(async()=>{try{var n;await (null==(n=v.current)?void 0:n.call(v))}catch(e){}t||(e=setTimeout(()=>D(e=>e+1),H.current))})(),()=>{t=!0,void 0!==e&&clearTimeout(e)}},[O]),(0,r.useEffect)(()=>{if(0===F)return;let e=b.current,t=e.filter(e=>"sending"===e.status);if(0===t.length)return;let{reconciledTempIds:n}=l(e,x.current,C.current),r=[],a=[];for(let e of t)!(n.has(e.tempId)||S.current.has(e.tempId))&&(e.accepted||N.current.has(e.tempId)?a.push(e.tempId):e.queued?r.push(e):j.current.has(e.tempId)||a.push(e.tempId));if(a.forEach(I),0===r.length)return;let s=new Set(r.map(e=>e.tempId));p(e=>e.map(e=>s.has(e.tempId)?{...e,queued:!1,autoResendAttempted:!0}:e)),r.forEach(e=>{E({...e,queued:!1,autoResendAttempted:!0})})},[F,I,E]),(0,r.useEffect)(()=>{let e=j.current;return()=>{e.forEach(e=>clearTimeout(e)),e.clear()}},[]),{messages:(0,r.useMemo)(()=>{if(0===f.length)return o;let{reconciledTempIds:e}=l(f,o,C.current),t=f.filter(t=>!e.has(t.tempId)).map(e=>({id:e.tempId,worktreeId:s,role:"user",content:e.content,timestamp:e.timestamp,messageType:"normal",archived:!1,cliToolId:e.options.cliToolId,instanceId:e.options.instanceId,optimisticState:e.status}));return 0===t.length?o:[...o,...t]},[o,f,s]),pending:f,sendOptimistic:A,retry:L,discard:R}}},81507:(e,t,n)=>{n.d(t,{Ce:()=>d,TG:()=>u,jt:()=>l,sg:()=>s});var r=n(12115);let a={visible:"commandmate.worktree.historyVisible",width:"commandmate.worktree.historyWidth"},l={visible:"commandmate.sessions.tileHistoryVisible",width:"commandmate.sessions.tileHistoryWidth"},s=40;function o(e){return Number.isFinite(e)?Math.min(60,Math.max(10,e)):s}let i="commandmate:historyPaneStateChange";function c(e){try{window.dispatchEvent(new CustomEvent(i,{detail:e}))}catch(e){}}function u(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:a,{visible:t,width:n}=e,[l,u]=(0,r.useState)(!0),[d,m]=(0,r.useState)(s),f=(0,r.useRef)(l);f.current=l;let p=(0,r.useRef)(d);return p.current=d,(0,r.useEffect)(()=>{let e=function(e){try{let t=window.localStorage.getItem(e);if("true"===t)return!0;if("false"===t)return!1}catch(e){}return!0}(t),r=function(e){try{let t=window.localStorage.getItem(e);if(null===t)return s;let n=Number(t);if(Number.isFinite(n))return o(n)}catch(e){}return s}(n);u(e),m(r)},[t,n]),(0,r.useEffect)(()=>{let e=e=>{e.detail&&e.detail.scope===t&&(e.detail.visible!==f.current&&u(e.detail.visible),e.detail.width!==p.current&&m(e.detail.width))};return window.addEventListener(i,e),()=>window.removeEventListener(i,e)},[t]),{visible:l,width:d,toggle:(0,r.useCallback)(()=>{let e=!f.current;u(e);try{window.localStorage.setItem(t,String(e))}catch(e){}c({scope:t,visible:e,width:p.current})},[t]),setWidth:(0,r.useCallback)(e=>{let r=o(e);m(r);try{window.localStorage.setItem(n,String(r))}catch(e){}c({scope:t,visible:f.current,width:r})},[t,n])}}function d(e){return"split-history-slot-".concat(e)}},83012:(e,t,n)=>{n.d(t,{Fx:()=>s,Uq:()=>i,bg:()=>o,fw:()=>l,g8:()=>c});var r=n(53298),a=n(73683);function l(e,t){let n=new Date(e);return isNaN(n.getTime())?"":(0,r.m)(n,{addSuffix:!0,...t?{locale:t}:{}})}function s(e){let t=new Date(e);if(isNaN(t.getTime()))return"";let n=Math.round((Date.now()-t.getTime())/1e3);if(n<45)return"now";let r=Math.round(n/60);if(r<60)return"".concat(r,"m ago");let a=Math.round(r/60);if(a<24)return"".concat(a,"h ago");let l=Math.round(a/24);return l<7?"".concat(l,"d ago"):l<30?"".concat(Math.round(l/7),"w ago"):l<365?"".concat(Math.round(l/30),"mo ago"):"".concat(Math.round(l/365),"y ago")}function o(e,t){return!(e instanceof Date)||isNaN(e.getTime())?"":(0,a.GP)(e,"PPp",t?{locale:t}:void 0)}function i(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Date;if(!(e instanceof Date)||isNaN(e.getTime()))return"";let n=t instanceof Date&&!isNaN(t.getTime())?t:new Date,r=e.getFullYear()===n.getFullYear()&&e.getMonth()===n.getMonth()&&e.getDate()===n.getDate();return(0,a.GP)(e,r?"HH:mm":"M/d HH:mm")}function c(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Date;if(!d(e))return"";let r=d(n)?n:new Date,l=d(t)?t:null,s=m(e,r)&&(null===l||m(l,r)&&m(l,e))?"HH:mm":"M/d HH:mm",o=(0,a.GP)(e,s);if(null===l)return o;let i=(0,a.GP)(l,s);return i===o?o:"".concat(i).concat(u).concat(o)}let u=" → ";function d(e){return e instanceof Date&&!isNaN(e.getTime())}function m(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}},83051:(e,t,n)=>{n.d(t,{bl:()=>X,Ce:()=>f.Ce});var r=n(95155),a=n(12115),l=n(18955),s=n(96195),o=n(7620),i=n(12181),c=n(20508),u=n(86651),d=n(90368),m=n(48407),f=n(81507),p=n(35252),h=n(35299),g=n(6132),x=n(48314),b=n(65229),v=n(54916),y=n(75426),w=n(24033),k=n(36809),j=n(51238),N=n(10934),C=n(5225),S=n(4300),T=n(55813),M=n(83012),I=n(89568),E=n(99112),A=n(32293);function L(e){let t=e.split("\n");if(t.length<=2&&e.length<=100)return{text:e,isTruncated:!1};let n=t.slice(0,2).join("\n");return n.length>100&&(n=n.slice(0,100)),{text:n,isTruncated:!0}}let R=(0,a.memo)(function(e){let{content:t,onFilePathClick:n}=e,s=(0,l.c)("worktree"),o=(0,a.useMemo)(()=>(0,I.ML)(t),[t]),i=(0,a.useCallback)(e=>()=>n(e),[n]);return(0,r.jsx)("span",{children:o.map((e,t)=>"path"===e.type?(0,r.jsx)("button",{type:"button",onClick:i(e.content),className:"text-accent-700 dark:text-accent-400 hover:text-accent-600 dark:hover:text-accent-300 hover:underline cursor-pointer font-mono text-sm","aria-label":s("conversation.openFile",{path:e.content}),children:e.content},t):(0,r.jsx)("span",{children:e.content},t))})}),P=(0,a.memo)(function(e){let{content:t,onFilePathClick:n}=e,l=(0,a.useMemo)(()=>{let e=e=>a.Children.map(e,e=>"string"==typeof e?(0,r.jsx)(R,{content:e,onFilePathClick:n}):e);return{p:t=>{let{children:n}=t;return(0,r.jsx)("p",{children:e(n)})},li:t=>{let{children:n}=t;return(0,r.jsx)("li",{children:e(n)})},td:t=>{let{children:n}=t;return(0,r.jsx)("td",{children:e(n)})},th:t=>{let{children:n}=t;return(0,r.jsx)("th",{children:e(n)})},strong:t=>{let{children:n}=t;return(0,r.jsx)("strong",{children:e(n)})},em:t=>{let{children:n}=t;return(0,r.jsx)("em",{children:e(n)})},a:e=>{let{href:t,children:a,node:l,...s}=e;return(0,r.jsx)(A.ZS,{...s,href:t,onFilePathClick:n,children:a})}}},[n]),s=(0,a.useMemo)(()=>[N.A,C.A],[]);return(0,r.jsx)(j.oz,{remarkPlugins:E.eT,rehypePlugins:s,components:l,children:t})});function O(){let e=(0,l.c)("worktree");return(0,r.jsxs)("div",{"data-testid":"pending-indicator",className:"flex items-center gap-2 text-muted-foreground py-2",children:[(0,r.jsxs)("div",{className:"flex gap-1","aria-hidden":"true",children:[(0,r.jsx)("span",{className:"w-2 h-2 bg-muted-foreground rounded-full animate-pulse"}),(0,r.jsx)("span",{className:"w-2 h-2 bg-muted-foreground rounded-full animate-pulse",style:{animationDelay:"150ms"}}),(0,r.jsx)("span",{className:"w-2 h-2 bg-muted-foreground rounded-full animate-pulse",style:{animationDelay:"300ms"}})]}),(0,r.jsx)("span",{className:"text-sm",children:e("conversation.waitingForResponse")})]})}let z=(0,a.memo)(function(e){let{message:t,onFilePathClick:n,onCopy:a,onInsertToMessage:s,onRetryPending:o,onDiscardPending:i}=e,c=(0,k.Ym)(),u=(0,l.c)("worktree"),d=(0,l.c)("common"),m=(0,T.M)(c),f=(0,M.bg)(t.timestamp,m),p=t.optimisticState,w=["group relative border-l-2 p-3 transition-opacity","error"===p?"border-danger-border bg-danger-subtle":"border-accent-500 bg-accent-500/10","sending"===p?"opacity-70":""].filter(Boolean).join(" ");return(0,r.jsxs)("div",{className:w,children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,r.jsx)("span",{className:"text-xs font-medium text-accent-700 dark:text-accent-400",children:u("conversation.you")}),(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:f}),"sending"===p&&(0,r.jsxs)("span",{"data-testid":"optimistic-sending",className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,r.jsx)(h.A,{size:12,className:"animate-spin","aria-hidden":"true"}),(0,r.jsx)("span",{children:u("conversation.sending")})]}),"error"===p&&(0,r.jsxs)("span",{"data-testid":"optimistic-error",className:"flex items-center gap-1 text-xs text-danger-foreground",children:[(0,r.jsx)(g.A,{size:12,"aria-hidden":"true"}),(0,r.jsx)("span",{children:u("conversation.failedToSend")})]}),"error"===p?(0,r.jsxs)("div",{className:"ml-auto flex items-center gap-1",children:[o&&(0,r.jsxs)("button",{type:"button","data-testid":"pending-retry",onClick:()=>o(t.id),className:"flex items-center gap-1 rounded px-1.5 py-0.5 text-xs text-accent-700 dark:text-accent-400 hover:bg-muted transition-colors","aria-label":u("conversation.retrySending"),title:d("retry"),children:[(0,r.jsx)(x.A,{size:12,"aria-hidden":"true"}),d("retry")]}),i&&(0,r.jsxs)("button",{type:"button","data-testid":"pending-discard",onClick:()=>i(t.id),className:"flex items-center gap-1 rounded px-1.5 py-0.5 text-xs text-muted-foreground hover:text-danger-foreground hover:bg-muted transition-colors","aria-label":u("conversation.discardMessage"),title:u("conversation.discard"),children:[(0,r.jsx)(b.A,{size:12,"aria-hidden":"true"}),u("conversation.discard")]})]}):(0,r.jsxs)("div",{className:"ml-auto flex items-center gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100 [@media(hover:none)]:opacity-100",children:[s&&(0,r.jsx)("button",{type:"button","data-testid":"insert-user-message",onClick:()=>s(t.content),className:"p-1 text-muted-foreground hover:text-accent-600 dark:hover:text-accent-400 hover:bg-muted rounded transition-colors","aria-label":u("conversation.insertToMessage"),title:u("conversation.insertToMessage"),children:(0,r.jsx)(v.A,{size:14,"aria-hidden":"true"})}),a&&(0,r.jsx)("button",{type:"button","data-testid":"copy-user-message",onClick:()=>a(t.content),className:"p-1 text-muted-foreground hover:text-foreground hover:bg-muted rounded transition-colors","aria-label":u("conversation.copyMessage"),title:u("conversation.copy"),children:(0,r.jsx)(y.A,{size:14,"aria-hidden":"true"})})]})]}),(0,r.jsx)("div",{"data-message-id":t.id,className:"text-sm text-foreground whitespace-pre-wrap break-words [word-break:break-word] max-w-full overflow-x-hidden",children:(0,r.jsx)(R,{content:t.content,onFilePathClick:n})})]})}),F=(0,a.memo)(function(e){let{message:t,index:n,total:s,isExpanded:o,onFilePathClick:i,onCopy:c,hasLongContent:u=!1,onToggleExpand:d}=e,m=(0,k.Ym)(),f=(0,l.c)("worktree"),p=(0,T.M)(m),h=(0,M.bg)(t.timestamp,p),{text:g,isTruncated:x}=(0,a.useMemo)(()=>L(t.content),[t.content]),b=o||!x?t.content:g,v=(0,S.bx)(t.requestId),j=v&&x&&!o;return(0,r.jsxs)("div",{className:"assistant-message-item group relative",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,r.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:f("conversation.assistant")}),(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:h}),s>1&&(0,r.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",n+1,"/",s,")"]}),(0,r.jsxs)("div",{className:"ml-auto flex items-center gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100 [@media(hover:none)]:opacity-100",children:[0===n&&u&&!!d&&(0,r.jsxs)("button",{type:"button",onClick:d,className:"flex items-center gap-1 rounded px-1.5 py-0.5 text-xs text-accent-700 dark:text-accent-400 hover:text-accent-600 dark:hover:text-accent-300 hover:bg-muted transition-colors","aria-expanded":o,"aria-label":f(o?"conversation.collapseMessage":"conversation.expandMessage"),children:[(0,r.jsx)(w.A,{size:12,className:"transition-transform ".concat(o?"rotate-180":""),"aria-hidden":"true"}),f(o?"conversation.collapse":"conversation.expand")]}),c&&(0,r.jsx)("button",{type:"button","data-testid":"copy-assistant-message",onClick:()=>c(t.content),className:"p-1 text-muted-foreground hover:text-foreground hover:bg-muted rounded transition-colors","aria-label":f("conversation.copyMessage"),title:f("conversation.copy"),children:(0,r.jsx)(y.A,{size:14,"aria-hidden":"true"})})]})]}),v?(0,r.jsx)("div",{"data-message-id":t.id,"data-markdown":"true",className:["assistant-md text-xs text-foreground break-words [word-break:break-word] max-w-full overflow-x-hidden",j?"".concat("max-h-[3.25rem]"," overflow-y-hidden"):""].filter(Boolean).join(" "),children:(0,r.jsx)(P,{content:t.content,onFilePathClick:i})}):(0,r.jsxs)("div",{"data-message-id":t.id,className:"text-xs text-foreground whitespace-pre-wrap break-words [word-break:break-word] max-w-full overflow-x-hidden",children:[(0,r.jsx)(R,{content:b,onFilePathClick:i}),!o&&x&&(0,r.jsx)("span",{className:"text-muted-foreground",children:"..."})]})]})}),D=(0,a.memo)(function(e){let{messages:t,isExpanded:n,onFilePathClick:l,onCopy:s,hasLongContent:o=!1,onToggleExpand:i}=e;return(0,r.jsx)("div",{className:"bg-surface-2/50 border-l-2 border-border p-2 border-t border-border space-y-2",children:t.map((e,c)=>(0,r.jsxs)(a.Fragment,{children:[c>0&&(0,r.jsx)("div",{"data-testid":"assistant-message-divider",className:"border-t border-dashed border-border"}),(0,r.jsx)(F,{message:e,index:c,total:t.length,isExpanded:n,onFilePathClick:l,onCopy:s,hasLongContent:o,onToggleExpand:i})]},e.id))})});function H(){let e=(0,l.c)("worktree");return(0,r.jsxs)("div",{"data-testid":"orphan-indicator",className:"bg-warning/10 text-warning-foreground text-xs px-3 py-1 flex items-center gap-2",children:[(0,r.jsx)("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,r.jsx)("span",{children:e("conversation.systemMessage")})]})}let B=(0,a.memo)(function(e){var t;let{pair:n,onFilePathClick:s,isExpanded:o=!1,onToggleExpand:i,onCopy:c,onInsertToMessage:u,showAssistant:d=!0,onRetryPending:m,onDiscardPending:f}=e,p=(0,l.c)("worktree"),h=(null==(t=n.userMessage)?void 0:t.optimisticState)!==void 0,g=(0,a.useMemo)(()=>n.assistantMessages.some(e=>{let{isTruncated:t}=L(e.content);return t}),[n.assistantMessages]),x=(0,a.useCallback)(()=>{i&&i()},[i]),b=(0,a.useMemo)(()=>{let e="pending"===n.status?"pending":"orphan"===n.status?"orphan border-l-4 border-warning":"";return"".concat("border border-border rounded-lg overflow-hidden mb-4 transition-colors"," ").concat(e).trim()},[n.status]),v=n.userMessage?p("conversation.conversationLabel",{preview:"".concat(n.userMessage.content.substring(0,50)).concat(n.userMessage.content.length>50?"...":"")}):p("conversation.systemMessageLabel");return(0,r.jsxs)("div",{"data-testid":"conversation-pair-card",role:"article","aria-label":v,className:b,children:["orphan"===n.status&&(0,r.jsx)(H,{}),n.userMessage&&(0,r.jsx)(z,{message:n.userMessage,onFilePathClick:s,onCopy:c,onInsertToMessage:u,onRetryPending:m,onDiscardPending:f}),"pending"!==n.status||h?d&&n.assistantMessages.length>0?(0,r.jsx)(D,{messages:n.assistantMessages,isExpanded:o,onFilePathClick:s,onCopy:c,hasLongContent:g,onToggleExpand:x}):null:(0,r.jsx)("div",{className:"bg-muted/40 border-l-2 border-border p-3 border-t border-border",children:(0,r.jsx)(O,{})})]})});var q=n(92710),K=n(23570),U=n(60322),_=n(70738),W=n(64653),$=n(9708),J=n(20877),Q=n(88731),Y=n(96802);function G(){let e=(0,l.c)("worktree");return(0,r.jsx)("div",{"data-testid":"loading-indicator",role:"status","aria-label":e("history.loading"),children:[0,1,2].map(e=>(0,r.jsxs)("div",{className:"mb-4 overflow-hidden rounded-lg border border-border",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 p-3",children:[(0,r.jsx)(m.EA,{className:"h-4 w-4 rounded-full"}),(0,r.jsx)(m.EA,{className:"h-4 w-1/3"})]}),(0,r.jsxs)("div",{className:"space-y-2 px-3 pb-3",children:[(0,r.jsx)(m.EA,{className:"h-3 w-full"}),(0,r.jsx)(m.EA,{className:"h-3 w-5/6"}),(0,r.jsx)(m.EA,{className:"h-3 w-2/3"})]})]},e))})}function V(){let e=(0,l.c)("worktree");return(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center py-8 text-muted-foreground",children:[(0,r.jsx)("svg",{className:"w-12 h-12 mb-2 opacity-50",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),(0,r.jsx)("p",{className:"text-sm",children:e("history.empty")})]})}let Z=["h-full","flex","flex-col","overflow-hidden","bg-surface-2","rounded-lg","border","border-border"],X=(0,a.memo)(function(e){let{messages:t,worktreeId:n,worktreePath:h,onFilePathClick:g,isLoading:x=!1,className:b="",showToast:v,onInsertToMessage:y,onRetryPending:w,onDiscardPending:k,showArchived:j=!1,onShowArchivedChange:N,historyDisplayLimit:C,onHistoryDisplayLimitChange:S,historyUserOnly:T=!1,onHistoryUserOnlyChange:M,onCollapse:I,splitIndex:E,cliToolId:A}=e,L=(0,l.c)("worktree"),R=(0,a.useRef)(null),P=(0,$.O)(),O=null!=h?h:P.worktreePath,z=(0,a.useMemo)(()=>void 0===E?J.Gw:(0,J.eu)(E),[E]),F=void 0===E?"history-pane-collapse-button":"history-pane-collapse-button-".concat(E),D=void 0===E?K.g6:(0,f.Ce)(E),H=(0,a.useRef)(!0),X=(0,a.useRef)(-1),ee=(0,a.useRef)(null),{pairs:et,isExpanded:en,toggleExpand:er}=function(e){let t=(0,a.useMemo)(()=>(function(e){if(0===e.length)return[];let t=[...e].sort((e,t)=>e.timestamp.getTime()-t.timestamp.getTime()),n=[],r=null;for(let e of t)if("user"===e.role)r={id:e.id,userMessage:e,assistantMessages:[],status:"pending"},n.push(r);else if("assistant"===e.role)if(r&&null!==r.userMessage)r.assistantMessages.push(e),r.status="completed";else if(r&&null===r.userMessage)r.assistantMessages.push(e);else{let t={id:"orphan-".concat(e.id),userMessage:null,assistantMessages:[e],status:"orphan"};n.push(t),r=t}return n})(e),[e]),[n,r]=(0,a.useState)(new Set),l=(0,a.useCallback)(e=>{r(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),s=(0,a.useCallback)(e=>n.has(e),[n]),o=(0,a.useCallback)(()=>{r(new Set(t.map(e=>e.id)))},[t]);return{pairs:t,expandedPairs:n,toggleExpand:l,isExpanded:s,expandAll:o,collapseAll:(0,a.useCallback)(()=>{r(new Set)},[])}}(t),ea=(0,a.useMemo)(()=>t.filter(e=>!e.archived&&"string"==typeof e.content&&e.content.length>0&&(!T||"user"===e.role)),[t,T]),{isOpen:el,query:es,matchCount:eo,currentIndex:ei,isAtMaxMatches:ec,matchPositions:eu,currentMatch:ed,openSearch:em,closeSearch:ef,setQuery:ep,onCompositionStart:eh,onCompositionEnd:eg,nextMatch:ex,prevMatch:eb}=(0,p.w)({messages:ea}),ev=el&&eu.length>0,ey=(0,a.useMemo)(()=>t.filter(e=>"relay"===e.messageType).length,[t]),[ew,ek]=(0,a.useState)(new Set);(0,a.useEffect)(()=>{ef()},[n]);let ej=(0,a.useMemo)(()=>T?et.filter(e=>e.userMessage):et,[et,T]),eN=(0,a.useMemo)(()=>{let e=new Map;for(let t of ej)for(let n of(t.userMessage&&e.set(t.userMessage.id,t.id),t.assistantMessages))e.set(n.id,t.id);return e},[ej]),eC=(0,a.useMemo)(()=>{let e=new Map;return ej.forEach((t,n)=>e.set(t.id,n)),e},[ej]),eS=(0,s.Te)({count:ej.length,getScrollElement:()=>R.current,estimateSize:()=>Y.__,overscan:Y.b,getItemKey:e=>{var t,n;return null!=(n=null==(t=ej[e])?void 0:t.id)?n:e}}),eT=eS.getVirtualItems(),eM=eT.length>0?"".concat(eT[0].index,"-").concat(eT[eT.length-1].index):"",eI=(0,a.useCallback)(()=>{let e=R.current;e&&(H.current=(0,Y.Mp)({scrollTop:e.scrollTop,scrollHeight:e.scrollHeight,clientHeight:e.clientHeight}))},[]);(0,a.useLayoutEffect)(()=>{let e=X.current,t=ej.length;X.current=t,-1!==e&&t>e&&t>0&&H.current&&!ev&&eS.scrollToIndex(t-1,{align:"end"})},[ej.length,ev,eS]),(0,a.useLayoutEffect)(()=>{if(!el||0===eu.length)return void ek(e=>0===e.size?e:new Set);ek(function(e,t){let n=new Map;for(let e of t)for(let t of(e.userMessage&&n.set(e.userMessage.id,e.id),e.assistantMessages))n.set(t.id,e.id);let r=new Set;for(let t of e){let e=n.get(t.messageId);e&&r.add(e)}return r}(eu,et))},[el,eu,et]),(0,a.useEffect)(()=>{if(!el||!ed)return;let e=eN.get(ed.messageId);if(void 0===e)return;let t=eC.get(e);void 0!==t&&eS.scrollToIndex(t,{align:"center"})},[el,ed,eN,eC,eS]),(0,a.useLayoutEffect)(()=>{let e=R.current;if(!e)return;if(!el||0===eu.length)return void(0,J.fq)(z);let t=null;for(let r of eu){var n;let a=(n=r.messageId,e.querySelector('[data-message-id="'.concat(CSS.escape(n),'"]')));if(!a)continue;let l=(null==ed?void 0:ed.messageId)===r.messageId,s=l?ed.localIndex:-1;(0,J.Gg)(a,r.ranges,s,z),l&&a instanceof HTMLElement&&(t=a)}return t&&"function"==typeof t.scrollIntoView&&t.scrollIntoView({block:"center",behavior:"smooth"}),()=>{(0,J.fq)(z)}},[el,eu,ed,ew,z,eM]),(0,a.useEffect)(()=>{let e=R.current;if(el)null===ee.current&&e&&(ee.current=e.scrollTop);else{if(null!==ee.current&&e){let t=ee.current;requestAnimationFrame(()=>{e.scrollTop=t})}ee.current=null}},[el]);let eE=(0,a.useMemo)(()=>[...Z,b].filter(Boolean).join(" "),[b]),eA=(0,a.useRef)(L);eA.current=L;let eL=(0,a.useCallback)(e=>{let t=(0,_.h)(e,O);null!==t&&(async()=>{if("missing"===await (0,W.o4)(n,t)){null==v||v(eA.current("conversation.filePathMissing"),"error");return}g(t)})()},[g,n,O,v]),eR=(0,a.useCallback)(e=>()=>er(e),[er]),eP=(0,a.useCallback)(async e=>{try{await (0,U.l)(e),null==v||v(eA.current("history.copied"),"success")}catch(e){console.error("[HistoryPane] Failed to copy to clipboard"),null==v||v(eA.current("history.copyFailed"),"error")}},[v]),eO=e=>{var t,n;let a=(null==(t=e.userMessage)?void 0:t.archived)===!0||(null==(n=e.assistantMessages)?void 0:n.some(e=>!0===e.archived)),l=en(e.id)||ew.has(e.id);return(0,r.jsx)("div",{className:a?"opacity-60":"",children:(0,r.jsx)(B,{pair:e,onFilePathClick:eL,isExpanded:l,onToggleExpand:eR(e.id),onCopy:eP,onInsertToMessage:y,onRetryPending:w,onDiscardPending:k,showAssistant:!T})})},ez=(0,a.useCallback)(e=>{let t=parseInt(e.target.value,10);(0,Q.UK)(t)&&(null==S||S(t))},[S]),eF=(0,a.useCallback)(()=>{el?ef():em()},[el,em,ef]);return(0,r.jsxs)("div",{role:"region","aria-label":L("history.regionLabel"),className:eE,children:[(0,r.jsxs)("div",{className:"flex-shrink-0 bg-surface-2 border-b border-border px-4 py-2 flex items-center justify-between flex-wrap gap-1",children:[(0,r.jsx)("h3",{className:"text-sm font-medium text-foreground",children:L("history.title")}),ey>0&&(0,r.jsxs)("span",{"data-testid":"history-relay-count",title:L("relay.historyBadgeTitle"),className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,r.jsx)(o.A,{size:12,className:"shrink-0","aria-hidden":"true"}),L("relay.historyCount",{count:ey})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[S&&void 0!==C&&(0,r.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground cursor-pointer",children:[(0,r.jsx)("span",{children:L("history.show")}),(0,r.jsx)("select",{value:C,onChange:ez,"aria-label":L("history.displayLimit"),className:"rounded border border-input bg-surface text-foreground text-xs px-1.5 py-0.5 focus:outline-none focus:ring-1 focus:ring-ring",children:Q.dl.map(e=>(0,r.jsx)("option",{value:e,children:e},e))})]}),N&&(0,r.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground cursor-pointer",children:[(0,r.jsx)(m.Sc,{checked:j,onCheckedChange:e=>N(!0===e),className:"h-3.5 w-3.5"}),L("history.showArchived")]}),M&&(0,r.jsx)("button",{type:"button",onClick:()=>M(!T),"aria-label":L("history.showUserOnly"),"aria-pressed":T,className:"p-1 rounded transition-colors ".concat(T?"bg-accent-500/15 text-accent-700 dark:text-accent-300":"text-muted-foreground hover:text-foreground"),title:L(T?"history.showAllMessages":"history.showUserOnly"),children:T?(0,r.jsx)(i.A,{size:14,"aria-hidden":"true"}):(0,r.jsx)(c.A,{size:14,"aria-hidden":"true"})}),(0,r.jsx)("button",{type:"button",onClick:eF,"aria-label":L(el?"history.closeSearch":"history.openSearch"),"aria-pressed":el,className:"p-1 text-muted-foreground hover:text-foreground rounded transition-colors",title:L(el?"history.closeSearch":"history.openSearch"),children:(0,r.jsx)(u.A,{size:14,"aria-hidden":"true"})}),I&&(0,r.jsx)("button",{type:"button",onClick:I,"aria-label":L("terminal.hideHistory"),"aria-expanded":"true","aria-controls":D,className:"p-1 text-muted-foreground hover:text-foreground rounded transition-colors",title:L("terminal.hideHistory"),"data-testid":F,children:(0,r.jsx)(d.A,{size:14,"aria-hidden":"true"})})]})]}),el&&(0,r.jsx)("div",{className:"flex-shrink-0 px-3 py-2 bg-surface-2 border-b border-border",children:(0,r.jsx)(q.Y,{query:es,onQueryChange:ep,matchCount:eo,currentIndex:ei,onNext:ex,onPrev:eb,onClose:ef,isAtMaxMatches:ec,onCompositionStart:eh,onCompositionEnd:eg})}),(0,r.jsx)("div",{ref:R,"data-testid":"history-scroll-container",onScroll:eI,className:"flex-1 min-h-0 overflow-y-auto overflow-x-hidden p-4",children:x?(0,r.jsx)(G,{}):0===ej.length?(0,r.jsx)(V,{}):0===eT.length?(0,r.jsx)("div",{"data-testid":"history-fallback-list",children:ej.slice(0,Y.vC).map(e=>(0,r.jsx)("div",{children:eO(e)},e.id))}):(0,r.jsx)("div",{style:{height:eS.getTotalSize(),width:"100%",position:"relative"},children:eT.map(e=>{let t=ej[e.index];return t?(0,r.jsx)("div",{"data-index":e.index,ref:eS.measureElement,className:"absolute left-0 top-0 w-full",style:{transform:"translateY(".concat(e.start,"px)")},children:eO(t)},e.key):null})})})]})})},87364:(e,t,n)=>{n.d(t,{t:()=>s});var r=n(95155),a=n(12115),l=n(18955);class s extends a.Component{static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){var n,r;console.error("[ErrorBoundary:".concat(this.props.componentName||"unknown","]"),e,t),null==(n=(r=this.props).onError)||n.call(r,e,t)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:(0,r.jsx)(o,{componentName:this.props.componentName,error:this.state.error,onRetry:this.handleRetry}):this.props.children}constructor(e){super(e),this.handleRetry=()=>{this.setState({hasError:!1,error:null})},this.state={hasError:!1,error:null}}}function o(e){let{componentName:t,error:n,onRetry:a}=e,s=(0,l.c)("error"),o=(0,l.c)("common");return(0,r.jsxs)("div",{className:"p-4 bg-danger-subtle border border-danger-border rounded-lg",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 text-danger-foreground mb-2",children:[(0,r.jsx)("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 20 20",children:(0,r.jsx)("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}),(0,r.jsx)("span",{className:"font-medium",children:t?s("boundary.errorOccurredIn",{componentName:t}):s("boundary.errorOccurred")})]}),n&&(0,r.jsx)("p",{className:"text-sm text-danger-foreground/80 mb-3",children:n.message}),a&&(0,r.jsx)("button",{onClick:a,className:"px-4 py-2 bg-danger-foreground text-danger-subtle rounded hover:opacity-90 transition-opacity text-sm",children:o("retry")})]})}},88731:(e,t,n)=>{n.d(t,{UK:()=>s,dl:()=>r,gP:()=>o,v8:()=>a,wP:()=>l});let r=[50,100,150,200,250,500,1e3],a=50,l="commandmate:historyDisplayLimit";function s(e){return r.includes(e)}let o="commandmate:historyUserOnly"},88894:(e,t,n)=>{function r(e){let t="[^\\S\\n]";return RegExp("(?:^".concat(t,"*|\xb7").concat(t,"*|").concat(t,"{2})").concat(e)+"(?:".concat(t,"\\([^()\\n]{1,32}\\))?")+"(?:".concat(t,"*\xb7|").concat(t,"{2}|").concat(t,"*$)"),"i")}n.d(t,{A:()=>o,h:()=>s});let a={key:"BTab",cycle:["default","plan","autopilot"],indicators:[{mode:"autopilot",pattern:r("autopilot")},{mode:"plan",pattern:r("plan(?:[^\\S\\n]mode)?")}],tailRows:2,noteId:null},l={claude:{key:"BTab",cycle:["auto","manual","accept-edits","plan"],indicators:[{mode:"accept-edits",pattern:/⏵⏵\s*accept edits on\b/},{mode:"auto",pattern:/⏵⏵\s*auto mode on\b/},{mode:"plan",pattern:/⏸\s*plan mode on\b/},{mode:"manual",pattern:/⏸\s*manual mode on\b/}],tailRows:3,noteId:null},"command-code":{key:"BTab",cycle:["default","accept-edits","plan"],indicators:[{mode:"accept-edits",pattern:/»\s*accept edits on\b/},{mode:"bypass",pattern:/»\s*permission bypass on\b/},{mode:"dont-ask",pattern:/»\s*don't-ask on\b/},{mode:"plan",pattern:/^[^\S\n]*plan mode\b/},{mode:"default",pattern:/\?\s+for\s+shortcuts\b/}],tailRows:4,noteId:null},codex:{key:"BTab",cycle:["default","plan"],indicators:[{mode:"plan",pattern:/\bPlan mode\s*\(shift\+tab to cycle\)/i}],tailRows:3,noteId:"codexModelCoupled"},copilot:a,antigravity:{key:"BTab",cycle:["default","accept-edits","plan"],indicators:[{mode:"accept-edits",pattern:r("accept-edits")},{mode:"plan",pattern:r("plan(?:[^\\S\\n]mode)?")}],tailRows:2,noteId:null},"opencode-v2":{key:"BTab",cycle:["build","plan"],indicators:[{mode:"build",pattern:/^[^\S\n]*┃[^\S\n]+Build[^\S\n]·[^\S\n]/},{mode:"plan",pattern:/^[^\S\n]*┃[^\S\n]+Plan[^\S\n]·[^\S\n]/}],tailRows:4,noteId:"opencodeAgentSwitch"}};function s(e){var t;return null!=(t=l[e])?t:null}let o=Object.keys(l)},89568:(e,t,n)=>{n.d(t,{B7:()=>l,CK:()=>f,JD:()=>o,ML:()=>m,UY:()=>u,hM:()=>s});var r=n(4300),a=n(92147);let l=8,s=120,o=40,i={variant:"none",startedAtMs:null};function c(e){var t,n;return"".concat(null!=(t=e.cliToolId)?t:"","|").concat(null!=(n=e.instanceId)?n:"")}function u(e){let t,n=function(e){let t=[],n=[],r=[],l=!1,s=()=>{t.push(...n,...r),n=[],r=[]};for(let o of e){if("user"===o.role&&!(0,a.nY)(o)){s(),t.push(o);continue}if(!(0,a.nY)(o)){r.push(o);continue}r.length>0&&(l=!0),n.push(o)}return s(),l?t:e}(e),l=function(e){let t=new Map;for(let n of e){if("user"!==n.role||(0,a.nY)(n)||n.optimisticState||n.archived)continue;let e=n.requestId;if("string"!=typeof e||0===e.length)continue;if(t.has(e)){t.set(e,null);continue}let r=n.timestamp instanceof Date?n.timestamp.getTime():NaN;t.set(e,Number.isFinite(r)?{atMs:r,scope:c(n)}:null)}return t}(n),s=[],o=function(e){let t=new Map,n=0,r=!1;for(let l of e){if(!(0,a.nY)(l)){r=!1;continue}r||(n+=1,r=!0),t.has(l.id)||t.set(l.id,n)}return t}(e),u=[],d=null,m=null,f=()=>{0!==u.length&&(s.push({kind:"approvals",key:"approvals:".concat(u[0].id),entries:(0,a.GV)(u,{runIds:o})}),u=[])};for(let e of n){var p;if((0,a.nY)(e)){u.push(e);continue}f();let n=!(p=t)||p.role!==e.role,o=i;if("assistant"!==e.role)d=null,m=null,n&&(o={variant:"role",startedAtMs:null});else{let t=c(e);(n||m!==t)&&(d=null),m=t;let a=(0,r.Qu)(e.requestId),s=function(e,t,n){if(null===t)return null;let a=(0,r.QN)(t);if(null===a)return null;let l=n.get(a);if(!l||l.scope!==c(e))return null;let s=e.timestamp instanceof Date?e.timestamp.getTime():NaN;return!Number.isFinite(s)||l.atMs>s?null:l.atMs}(e,a,l);n?o={variant:"role",startedAtMs:s}:null!==a&&null!==d&&a!==d&&(o={variant:"time",startedAtMs:s}),null!==a&&(d=a)}s.push({kind:"message",key:e.id,message:e,showHeader:n,header:o}),t=e}return f(),s}let d=/(^|[\s`"'(\[<(「『【])(\/[^\s\n<>"']+\.[a-zA-Z0-9]+)/g;function m(e){if("string"!=typeof e||0===e.length)return[{type:"text",content:""}];let t=[],n=0;for(let l of e.matchAll(d)){var r,a;let s=null!=(r=l[1])?r:"",o=l[2];if(!o)continue;let i=(null!=(a=l.index)?a:0)+s.length;i>n&&t.push({type:"text",content:e.slice(n,i)}),t.push({type:"path",content:o}),n=i+o.length}return 0===t.length?[{type:"text",content:e}]:(n<e.length&&t.push({type:"text",content:e.slice(n)}),t)}function f(e){return!e||"assistant"!==e.role}},92147:(e,t,n)=>{n.d(t,{GV:()=>N,rS:()=>C,nY:()=>y});var r=n(68276),a=n(3648);function l(){let e=(0,a._)(["←s*(?:[☐☒☑][^←→☐☒☑✔]*)+✔s*Submits*→"],["←\\s*(?:[☐☒☑][^←→☐☒☑✔]*)+✔\\s*Submit\\s*→"]);return l=function(){return e},e}let s=String.raw(l()),o=new RegExp("^".concat(s,"\\s*"));new RegExp("^\\s?".concat(s,"$"));let i=/\s*Ready to submit your answers\?\s*$/,c=/^Review your answers\s*/,u=/●\s*([^●→]+)/g,d=/^submit answers$/i,m=/^cancel$/i,f={human:5,auto:4,terminal:3,pending:2,unclassified:1,unknown:0};function p(e){return"object"==typeof e&&null!==e?e:null}function h(e,t){let n=null==e?void 0:e[t];return"string"==typeof n?n:""}function g(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if("string"==typeof n){t.push(n);continue}let e=h(p(n),"label");e&&t.push(e)}return t}function x(e){return e.replace(/\s+/g," ").trim()}function b(e){return e.length<=160?e:"".concat(e.slice(0,159).trimEnd(),"…")}function v(e){return x(e).replace(o,"").trim()}function y(e){return(null==e?void 0:e.messageType)==="prompt"}function w(e){let t=null==e?void 0:e.summary;return"string"==typeof t&&t.startsWith("PermissionRequest allow")}function k(e){return{...e,messageIds:[...e.messageIds],reviewQuestions:[...e.reviewQuestions]}}function j(e,t,n){if(e<=0||t<=0)return!1;let r=t-e;return r>=0&&r<=n}function N(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{windowMs:n=5e3,runIds:a}=t;return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5e3,n=[];for(let r of e){if("question"===r.kind){let e=n[n.length-1];if("confirmation"===r.phase){if(e&&"question"===e.kind&&"question"===e.phase&&e.scopeKey===r.scopeKey&&e.runId===r.runId&&""!==e.questionText&&r.reviewQuestions.includes(e.questionText)&&j(e.timestampMs,r.timestampMs,t)){e.messageIds.push(...r.messageIds),e.confirmationOutcome=r.outcome;continue}n.push(k(r));continue}if(e&&"question"===e.kind&&"question"===e.phase&&""!==r.mergeKey&&e.mergeKey===r.mergeKey&&e.runId===r.runId&&j(e.timestampMs,r.timestampMs,t)){e.messageIds.push(...r.messageIds),e.label||(e.label=r.label),f[r.outcome]>f[e.outcome]&&(e.outcome=r.outcome);continue}n.push(k(r));continue}let e=r.mergeKey?n.find(e=>"approval"===e.kind&&e.mergeKey===r.mergeKey&&Math.abs(r.timestampMs-e.timestampMs)<=t):void 0;if(!e){n.push(k(r));continue}e.messageIds.push(...r.messageIds),e.isPermissionAudit=e.isPermissionAudit||r.isPermissionAudit,e.label||(e.label=r.label),f[r.outcome]>f[e.outcome]&&(e.outcome=r.outcome)}return n}(e.map(e=>{var t;return function(e){let t,n,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,l=p(e.promptData),s=w(e),o=h(l,"question"),f=h(l,"approvalTarget"),y=h(l,"answeredBy"),k=h(l,"status"),j=h(l,"type"),N="string"==typeof e.summary?e.summary:"",C=function(e,t){let n=v(e),r=i.test(n),a=g(t),l=n.replace(i,"").replace(c,"").trim();return{hasTail:r,hasSubmitOptions:a.some(e=>d.test(e.trim()))&&a.some(e=>m.test(e.trim())),reviewQuestions:[...l.matchAll(u)].map(e=>{var t;return(null!=(t=e[1])?t:"").trim()}).filter(e=>e.length>0)}}(o,null==l?void 0:l.options),{kind:S,phase:T}=w(e)?{kind:"approval"}:(null==l?void 0:l.isAskUserQuestion)===!0?{kind:"question",phase:C.hasTail||C.hasSubmitOptions?"confirmation":"question"}:C.hasTail&&(C.hasSubmitOptions||C.reviewQuestions.length>0)?{kind:"question",phase:"confirmation"}:{kind:"approval"};t=s?"auto":"auto"===y||"human"===y||"terminal"===y?y:j===r.LT||"unclassified"===k?"unclassified":"pending"===k?"pending":"unknown";let M=function(e){let t="string"==typeof e.cliToolId&&e.cliToolId?e.cliToolId:"claude",n="string"==typeof e.instanceId&&e.instanceId?e.instanceId:t;return JSON.stringify(["string"==typeof e.worktreeId?e.worktreeId:"",t,n])}(e),I="question"===S&&"question"===T,E=I?v(o):"",A="question"===S&&"confirmation"===T&&1===C.reviewQuestions.length?C.reviewQuestions[0]:"";n="question"===S?b(I?E:A):b(x(o||N));let L="";if(I){let e=p(null==l?void 0:l.askUserQuestion),t="number"==typeof(null==e?void 0:e.questionIndex)?e.questionIndex:null;L=E?JSON.stringify(["question",M,E,t,g(null==l?void 0:l.options)]):""}else"approval"===S&&(L=o?JSON.stringify([o,f]):"");return{id:e.id,messageIds:[e.id],label:n,outcome:t,isPermissionAudit:s,timestampMs:function(e){if(e instanceof Date){let t=e.getTime();return Number.isFinite(t)?t:0}if("string"==typeof e||"number"==typeof e){let t=new Date(e).getTime();return Number.isFinite(t)?t:0}return 0}(e.timestamp),mergeKey:L,kind:S,...T?{phase:T}:{},questionText:E,reviewQuestions:C.reviewQuestions,scopeKey:M,runId:a}}(e,null!=(t=null==a?void 0:a.get(e.id))?t:0)}),n)}function C(e){let t=0,n=0,r=0;for(let a of e)"question"!==a.kind?t+=1:"confirmation"===a.phase?r+=1:n+=1;return{approvals:t,questions:n,confirmations:r,total:e.length}}},92710:(e,t,n)=>{n.d(t,{Y:()=>o});var r=n(95155),a=n(12115),l=n(18955),s=n(78660);function o(e){let{query:t,onQueryChange:n,matchCount:o,currentIndex:i,onNext:c,onPrev:u,onClose:d,isAtMaxMatches:m,onCompositionStart:f,onCompositionEnd:p}=e,h=(0,a.useRef)(null),g=(0,l.c)("worktree");(0,a.useEffect)(()=>{var e;null==(e=h.current)||e.focus()},[]);let x=(0,a.useCallback)(e=>{"Escape"===e.key&&d()},[d]),b=(0,a.useCallback)(e=>{n(e.target.value)},[n]),v=0===o?"0/0":m?g("history.search.countAtMax",{current:i+1,max:s.F0}):"".concat(i+1,"/").concat(o);return(0,r.jsxs)("div",{className:"flex items-center gap-1 px-2 py-1 bg-surface border border-border rounded shadow-lg",role:"search","aria-label":g("history.search.regionLabel"),children:[(0,r.jsx)("input",{ref:h,type:"text",value:t,onChange:b,onKeyDown:x,onCompositionStart:f,onCompositionEnd:p,placeholder:g("history.search.placeholder"),className:"bg-transparent text-foreground text-sm outline-none w-32 sm:w-40 placeholder-muted-foreground","aria-label":g("history.search.keywordLabel"),autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1}),(0,r.jsx)("span",{role:"status","aria-live":"polite","aria-atomic":"true",className:"text-muted-foreground text-xs min-w-[3rem] text-right",children:v}),(0,r.jsx)("button",{type:"button",onClick:u,disabled:0===o,"aria-label":g("history.search.prev"),className:"text-muted-foreground hover:text-foreground disabled:opacity-40 min-w-[36px] min-h-[36px] flex items-center justify-center text-base",children:"▲"}),(0,r.jsx)("button",{type:"button",onClick:c,disabled:0===o,"aria-label":g("history.search.next"),className:"text-muted-foreground hover:text-foreground disabled:opacity-40 min-w-[36px] min-h-[36px] flex items-center justify-center text-base",children:"▼"}),(0,r.jsx)("button",{type:"button",onClick:d,"aria-label":g("history.search.close"),className:"text-muted-foreground hover:text-foreground min-w-[36px] min-h-[36px] flex items-center justify-center text-base ml-1",children:"✕"})]})}},92833:(e,t,n)=>{n.d(t,{tY:()=>S,XU:()=>k});var r=n(95155),a=n(12115),l=n(18955),s=n(24033),o=n(51021),i=n(56827),c=n(49509),u=n(51515);let d=/^[^\S\n]*[^\s\u2502\u2503\u2579\u2580][^\n]*?[^\S\n]{8,}esc[^\S\n]*$/m;var m=n(2317);let f={mobile:{storageKey:"commandmate:mobile:opencodeQuickKeysOpen",defaultOpen:!1},desktop:{storageKey:"commandmate:desktop:opencodeQuickKeysOpen",defaultOpen:!0}},p=e=>"boolean"==typeof e;function h(e){return[o.Mx,e]}let g=[{id:"agents",keys:h("a"),notation:"ctrl+x a"},{id:"sessions",keys:h("l"),notation:"ctrl+x l"},{id:"newSession",keys:h("n"),notation:"ctrl+x n"},{id:"models",keys:h("m"),notation:"ctrl+x m"},{id:"themes",keys:h("t"),notation:"ctrl+x t"}],x=[{id:"timeline",keys:h("g"),notation:"ctrl+x g",sessionScoped:!0},{id:"undo",keys:h("u"),notation:"ctrl+x u",sessionScoped:!0},{id:"redo",keys:h("r"),notation:"ctrl+x r",sessionScoped:!0},{id:"compact",keys:h("c"),notation:"ctrl+x c",sessionScoped:!0}],b=[{id:"pageUp",keys:["PageUp"],notation:"pgup"},{id:"pageDown",keys:["PageDown"],notation:"pgdn"},{id:"first",keys:["Home"],notation:"home"},{id:"last",keys:["End"],notation:"end"}],v=[[{id:"agentNext",keys:["Tab"],notation:"tab"},{id:"agentPrev",keys:["BTab"],notation:"shift+tab"},{id:"commands",keys:["C-p"],notation:"ctrl+p"},{id:"variant",keys:["C-t"],notation:"ctrl+t"}],g,x,b],y=[[{id:"commands",keys:["C-p"],notation:"ctrl+p"},{id:"variant",keys:["C-t"],notation:"ctrl+t"}],[{id:"agents",keys:h("a"),notation:"ctrl+x a"},{id:"sessions",keys:h("l"),notation:"ctrl+x l"},{id:"newSession",keys:h("n"),notation:"ctrl+x n"},{id:"models",keys:h("m"),notation:"ctrl+x m"}],b],w={opencode:v,"opencode-v2":y},k=(0,a.memo)(function(e){let{worktreeId:t,cliToolId:n,instanceId:o,hasAgentSession:u,onKeysSent:d,compact:h=!1,collapsible:g=!1,layout:x="mobile"}=e,b=(0,l.c)("worktree"),{activeKey:v,markPressed:y}=(0,c.t)(),k=(0,i.B)(t,n,o,d),{open:j,toggle:N}=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"mobile",{storageKey:t,defaultOpen:n}=f[e],{value:r,setValue:l,isAvailable:s}=(0,m.V)({key:t,defaultValue:n,validate:p});return{open:r,toggle:(0,a.useCallback)(()=>l(e=>!e),[l]),isPersistent:s}}(x),C=(0,a.useId)(),S=(0,a.useCallback)(e=>{y(e.id),k([...e.keys])},[y,k]),T=w[n];if(!T)return null;let M=(0,r.jsxs)("div",{className:"@container flex flex-wrap items-center gap-1.5 ".concat(g?"px-1.5 pb-1.5":"py-1.5 bg-muted rounded-lg"),id:g?C:void 0,role:"toolbar","aria-label":b("opencodeQuickKeys.toolbarLabel"),"data-testid":"opencode-quick-keys",children:[g?null:(0,r.jsx)("span",{className:"text-xs text-muted-foreground mx-2",children:b("opencodeQuickKeys.caption")}),T.map((e,t)=>(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[t>0?(0,r.jsx)("span",{className:"w-px h-6 bg-border mx-0.5","aria-hidden":"true"}):null,e.map(e=>{let t=b("opencodeQuickKeys.keys.".concat(e.id)),n=!0===e.sessionScoped&&!u;return(0,r.jsxs)("button",{type:"button",disabled:n,className:"min-h-[44px] px-3 py-2 text-sm font-medium rounded-md\n border border-border\n focus:outline-none focus:ring-2 focus:ring-ring\n transition-colors duration-75\n disabled:opacity-50 disabled:cursor-not-allowed\n ".concat(v===e.id?"bg-accent-500 text-white border-accent-500 scale-95":"bg-surface dark:bg-surface-2 hover:bg-muted active:bg-muted disabled:hover:bg-surface"),"aria-label":"".concat(t," (").concat(e.notation,")"),title:n?b("opencodeQuickKeys.needsSession",{notation:e.notation}):"".concat(t," — ").concat(e.notation),"data-testid":"opencode-quick-key-".concat(e.id),onClick:()=>S(e),children:[t,h?null:(0,r.jsx)("span",{className:"ml-1.5 text-xs text-muted-foreground hidden @min-[640px]:inline",children:e.notation})]},e.id)})]},e[0].id))]});return g?(0,r.jsxs)("div",{className:"bg-muted rounded-lg","data-testid":"opencode-quick-keys-disclosure",children:[(0,r.jsxs)("button",{type:"button",className:"w-full min-h-[44px] flex items-center gap-2 px-3 py-2 text-sm font-medium rounded-lg touch-manipulation transition-colors hover:bg-surface-2 active:bg-surface-2 focus:outline-none focus:ring-2 focus:ring-ring","aria-expanded":j,"aria-controls":C,"aria-label":j?b("opencodeQuickKeys.hideKeys"):b("opencodeQuickKeys.showKeys"),"data-testid":"opencode-quick-keys-toggle",onClick:N,children:[(0,r.jsx)(s.A,{className:"w-4 h-4 shrink-0 transition-transform duration-150 ".concat(j?"":"-rotate-90"),"aria-hidden":"true"}),(0,r.jsx)("span",{children:b("opencodeQuickKeys.toolbarLabel")}),(0,r.jsx)("span",{className:"ml-auto text-xs text-muted-foreground",children:T.reduce((e,t)=>e+t.length,0)})]}),j?M:null]}):M}),j=["variant","models","commands"];function N(e){return j.map(t=>{let n=e.flat().find(e=>e.id===t);if(!n)throw Error("OpencodeQuickKeys: unknown model key id ".concat(t));return n})}let C={opencode:N(v),"opencode-v2":N(y).map(function(e){return{...e,keys:["Escape",...e.keys]}})},S=(0,a.memo)(function(e){let{worktreeId:t,cliToolId:n,frame:s,instanceId:o,onKeysSent:m}=e,f=(0,l.c)("worktree"),{activeKey:p,markPressed:h}=(0,c.t)(),g=(0,i.B)(t,n,o,m),x=(0,a.useCallback)(e=>{h(e.id),g([...e.keys])},[h,g]),b=C[n];return b&&("opencode-v2"===n?null!=s&&null!==function(e){let t=d.exec(e);return null===t?null:t[0].trim().replace(/\s+esc$/,"")}((0,u.aJ)(s)):void 0!==C[n])?(0,r.jsxs)("div",{"data-testid":"opencode-model-keys",role:"toolbar","aria-label":f("selectionKeys.opencodeToolbarLabel"),className:"flex flex-wrap items-center gap-1.5 rounded-lg bg-muted px-2 py-1.5",children:[(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:f("selectionKeys.opencodeCaption")}),b.map(e=>{let t=f("opencodeQuickKeys.keys.".concat(e.id));return(0,r.jsxs)("button",{type:"button","data-testid":"opencode-model-key-".concat(e.id),"aria-label":"".concat(t," (").concat(e.notation,")"),title:"".concat(t," — ").concat(e.notation),onClick:()=>x(e),className:"min-h-[44px] rounded-md border border-border px-3 py-2 text-sm font-medium transition-colors duration-75 touch-manipulation focus:outline-none focus:ring-2 focus:ring-ring ".concat(p===e.id?"border-accent-500 bg-accent-500 text-white scale-95":"bg-surface hover:bg-muted active:bg-muted dark:bg-surface-2"),children:[t,(0,r.jsx)("span",{className:"ml-1.5 text-xs text-muted-foreground",children:e.notation})]},e.id)})]}):null})},95342:(e,t,n)=>{function r(e){let t=[],n=e.awaiting.filter(e=>"prompt"===e.state);n.length>0&&t.push({tone:"prompt",key:"badgePrompt",params:{count:n.length,alias:e.aliasOf(n[0].to)},titleKey:"promptTitle",count:n.length});let r=e.awaiting.filter(e=>"prompt"!==e.state);return 1===r.length?t.push({tone:"awaiting",key:"badgeAwaiting",params:{alias:e.aliasOf(r[0].to)},titleKey:"awaitingTitle",count:1}):r.length>1&&t.push({tone:"awaiting",key:"badgeAwaitingMany",params:{count:r.length},titleKey:"awaitingTitle",count:r.length}),1===e.owed.length?t.push({tone:"owed",key:"badgeOwed",params:{alias:e.aliasOf(e.owed[0].from)},titleKey:"owedTitle",count:1}):e.owed.length>1&&t.push({tone:"owed",key:"badgeOwedMany",params:{count:e.owed.length},titleKey:"owedTitle",count:e.owed.length}),t}function a(e){if(0===e.length)return null;let[t]=e,n="prompt"===t.tone?"stripPrompt":"owed"===t.tone?"stripOwed":t.count>1?"stripAwaitingMany":"stripAwaiting";return{...t,key:n}}n.d(t,{g:()=>r,y:()=>a})},96802:(e,t,n)=>{n.d(t,{Mp:()=>o,__:()=>a,b:()=>r,r4:()=>l,vC:()=>s});let r=6,a=160,l=80,s=30;function o(e){let{scrollTop:t,scrollHeight:n,clientHeight:r}=e,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l,s=n-t-r;return!!Number.isFinite(s)&&s<=a}}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6966],{39649:(e,t,r)=>{r.d(t,{$f:()=>d,H8:()=>c});var n=r(95155),s=r(12115),i=r(80344);let l={PROCESSING:2e3,SESSION_RUNNING:5e3,IDLE:1e4},o=(0,s.createContext)(null),u={selectedWorktreeId:null,worktrees:[],repositories:[],selectedWorktreeDetail:null,isLoading:!0,isLoadingDetail:!1,error:null};function a(e,t){switch(t.type){case"SET_WORKTREES":return{...e,worktrees:t.worktrees,isLoading:!1};case"SET_REPOSITORIES":return{...e,repositories:t.repositories};case"SELECT_WORKTREE":{var r;let n=null!=(r=e.worktrees.find(e=>e.id===t.id))?r:null;return{...e,selectedWorktreeId:t.id,selectedWorktreeDetail:null!=n?n:e.selectedWorktreeDetail,isLoadingDetail:null===n}}case"SET_WORKTREE_DETAIL":return{...e,selectedWorktreeDetail:t.detail};case"SET_LOADING":return{...e,isLoading:t.isLoading};case"SET_LOADING_DETAIL":return{...e,isLoadingDetail:t.isLoadingDetail};case"SET_ERROR":return{...e,error:t.error,isLoading:!1};default:return e}}function c(e){let{children:t,externalWorktrees:r,externalRepositories:c,externalIsLoading:d,externalError:E,externalRefresh:f}=e,R=void 0!==r,[S,g]=(0,s.useReducer)(a,u);(0,s.useEffect)(()=>{R&&r&&g({type:"SET_WORKTREES",worktrees:r})},[R,r]),(0,s.useEffect)(()=>{R&&c&&g({type:"SET_REPOSITORIES",repositories:c})},[R,c]);let k=(0,s.useCallback)(async()=>{if(!R){g({type:"SET_LOADING",isLoading:!0}),g({type:"SET_ERROR",error:null});try{var e;let t=await i.y.getAll();g({type:"SET_WORKTREES",worktrees:t.worktrees}),g({type:"SET_REPOSITORIES",repositories:null!=(e=t.repositories)?e:[]})}catch(e){g({type:"SET_ERROR",error:e instanceof Error?e.message:"Failed to fetch worktrees"})}}},[R]),p=(0,s.useCallback)(async e=>{g({type:"SELECT_WORKTREE",id:e}),g({type:"SET_ERROR",error:null});try{i.y.markAsViewed(e).catch(e=>{console.warn("[WorktreeSelectionContext] Failed to mark as viewed:",e)});let t=await i.y.getById(e);g({type:"SET_WORKTREE_DETAIL",detail:t})}catch(e){g({type:"SET_ERROR",error:e instanceof Error?e.message:"Failed to fetch worktree detail"})}finally{g({type:"SET_LOADING_DETAIL",isLoadingDetail:!1})}},[]),T=(0,s.useCallback)(async()=>{if(R&&f)return void await f();await k()},[R,f,k]);(0,s.useEffect)(()=>{R||k()},[k,R]),(0,s.useEffect)(()=>{if(R)return;let e=null,t=!0,r=async()=>{if(t)try{var n,s;let o=await i.y.getAll();g({type:"SET_WORKTREES",worktrees:o.worktrees}),g({type:"SET_REPOSITORIES",repositories:null!=(n=o.repositories)?n:[]});let u=(s=o.worktrees).some(e=>e.isProcessing||e.isWaitingForResponse)?l.PROCESSING:s.some(e=>e.isSessionRunning)?l.SESSION_RUNNING:l.IDLE;t&&(e=setTimeout(r,u))}catch(n){if(n instanceof i.hD&&401===n.status)return;console.error("[WorktreeSelectionContext] Polling error:",n),t&&(e=setTimeout(r,l.SESSION_RUNNING))}};return r(),()=>{t=!1,e&&clearTimeout(e)}},[R]);let w=R&&void 0!==d?d:S.isLoading,y=R&&E?E.message:null,h={selectedWorktreeId:S.selectedWorktreeId,worktrees:S.worktrees,repositories:S.repositories,selectedWorktreeDetail:S.selectedWorktreeDetail,isLoading:w,isLoadingDetail:S.isLoadingDetail,error:null!=y?y:S.error,selectWorktree:p,refreshWorktrees:T};return(0,n.jsx)(o.Provider,{value:h,children:t})}function d(){let e=(0,s.useContext)(o);if(!e)throw Error("useWorktreeSelection must be used within a WorktreeSelectionProvider");return e}},66966:(e,t,r)=>{r.d(t,{g7:()=>c,rC:()=>E,Fn:()=>d});var n=r(95155),s=r(12115),i=r(80344),l=r(60199);let o=[2e3,5e3,1e4];var u=r(39649);let a=(0,s.createContext)(null);function c(e){let{children:t}=e,{worktrees:r,repositories:c,isLoading:d,error:E,refresh:f}=function(){let[e,t]=(0,s.useState)([]),[r,n]=(0,s.useState)([]),[u,a]=(0,s.useState)(!0),[c,d]=(0,s.useState)(null),E=(0,s.useRef)(null),f=(0,s.useRef)([]),R=(0,s.useRef)(null),S=(0,s.useRef)(0),g=(0,s.useRef)(null),k=(0,s.useRef)(!1),p=(0,s.useRef)(async()=>{}),T=(0,s.useCallback)(()=>{null!==g.current&&(clearTimeout(g.current),g.current=null)},[]),{connected:w,subscribe:y,unsubscribe:h,addListener:I}=(0,l.xM)(),_=(0,s.useRef)(w);_.current=w;let O=(0,s.useCallback)(async()=>{try{var e,r;d(null),k.current&&0===f.current.length&&a(!0);let l=await fetch("/api/worktrees"),o=(0,i.O0)(l);if(o)throw o;if(!l.ok)throw Error("Failed to fetch worktrees: ".concat(l.status));let u=(0,i.xd)(l);if(u)throw u;let c=await l.json(),E=null!=(e=c.worktrees)?e:[],R=null!=(r=c.repositories)?r:[];(0,s.startTransition)(()=>{t(E),n(R),a(!1)}),f.current=E,k.current=!1,S.current=0,T()}catch(r){let e=r instanceof Error?r:Error(String(r));console.error("[useWorktreesCache] Failed to fetch worktrees:",e),k.current=!0,d(e),a(!1);let t=S.current;0===f.current.length&&t<o.length&&(S.current=t+1,T(),g.current=setTimeout(()=>{g.current=null,p.current()},o[t]))}},[T]);p.current=O,(0,s.useEffect)(()=>{O()},[O]),(0,s.useEffect)(()=>T,[T]);let W=(0,s.useCallback)(()=>f.current.some(e=>!0===e.isSessionRunning),[]),v=(0,s.useCallback)(()=>{let e=W();return _.current?e?2e4:6e4:e?5e3:3e4},[W]),m=(0,s.useCallback)(()=>{null!==E.current&&(clearInterval(E.current),E.current=null),R.current=null},[]),L=(0,s.useCallback)(()=>{m();let e=v();R.current=e,E.current=setInterval(()=>{O()},e)},[v,O,m]);(0,s.useEffect)(()=>{let e=()=>{document.hidden?m():(O(),L())},t=setTimeout(()=>{L()},0);return document.addEventListener("visibilitychange",e),()=>{clearTimeout(t),m(),document.removeEventListener("visibilitychange",e)}},[O,L,m]),(0,s.useEffect)(()=>{if(f.current=e,"undefined"!=typeof document&&document.hidden||null===R.current)return;let t=v();R.current!==t&&L()},[e,w,v,L]);let C=e.map(e=>e.id).sort().join(" ");return(0,s.useEffect)(()=>{let e=C.length>0?C.split(" "):[];return e.forEach(e=>y(e)),()=>{e.forEach(e=>h(e))}},[C,y,h]),(0,s.useEffect)(()=>I(e=>{if("session_status_changed"===e.type&&"string"==typeof e.worktreeId){let i=e.worktreeId,l=e.isWaitingForResponse;if("boolean"==typeof l){var r,n;let o=null!=(r=e.instance)?r:null,u=null!=(n=e.waitingKind)?n:null;(0,s.startTransition)(()=>{t(e=>{let t=!1,r=e.map(e=>{if(e.id!==i)return e;let r=function(e,t){var r,n,s;let i,l=null!=(n=t.instance)?n:null,o=l?null==(r=e.sessionStatusByInstance)?void 0:r[l]:void 0,u=e.sessionStatusByInstance;if(l&&o&&o.isWaitingForResponse!==t.waiting&&(u={...e.sessionStatusByInstance,[l]:{...o,isWaitingForResponse:t.waiting,waitingKind:null!=(s=t.waitingKind)?s:null}}),t.waiting)i=!0;else{let e=u?Object.values(u):[];i=e.length>0&&e.some(e=>(null==e?void 0:e.isWaitingForResponse)===!0)}return u===e.sessionStatusByInstance&&i===e.isWaitingForResponse?e:{...e,sessionStatusByInstance:u,isWaitingForResponse:i}}(e,{waiting:l,instance:o,waitingKind:u});return r!==e&&(t=!0),r});return t?r:e})});return}let o=e.isRunning;if("boolean"==typeof o){if((null!=e.cliTool||null!=e.instance)&&!1===o)return void O();(0,s.startTransition)(()=>{t(e=>{let t=!1,r=e.map(e=>e.id===i&&e.isSessionRunning!==o?(t=!0,{...e,isSessionRunning:o}):e);return t?r:e})})}}else("message"===e.type||"message_updated"===e.type)&&O()}),[I,O]),{worktrees:e,repositories:r,isLoading:u,error:c,refresh:O}}(),R=(0,s.useMemo)(()=>({worktrees:r,repositories:c,isLoading:d,error:E,refresh:f}),[r,c,d,E,f]);return(0,n.jsx)(a.Provider,{value:R,children:(0,n.jsx)(u.H8,{externalWorktrees:r,externalRepositories:c,externalIsLoading:d,externalError:E,externalRefresh:f,children:t})})}function d(){let e=(0,s.useContext)(a);if(null===e)throw Error("useWorktreesCacheContext must be used within a WorktreesCacheProvider");return e}function E(){return(0,s.useContext)(a)}}}]);
|