commandmate 0.42.2 → 0.43.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/BUILD_ID +1 -1
- package/.next/app-build-manifest.json +148 -148
- package/.next/app-path-routes-manifest.json +25 -25
- package/.next/build-manifest.json +2 -2
- package/.next/prerender-manifest.json +9 -9
- 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.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.js +1 -1
- package/.next/server/app/api/daily-summary/route.js.nft.json +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.js +1 -1
- package/.next/server/app/api/daily-summary/status/route.js.nft.json +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 +103 -1
- 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_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.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.js +1 -1
- package/.next/server/app/api/skills/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/slash-commands/route.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.js +3 -1
- package/.next/server/app/api/worktrees/[id]/cmate/schedules/route.js.nft.json +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.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.js +3 -1
- package/.next/server/app/api/worktrees/[id]/execution-logs/route.js.nft.json +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 -1
- 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 -1
- 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 -103
- 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.js +3 -1
- package/.next/server/app/api/worktrees/[id]/schedules/[scheduleId]/route.js.nft.json +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.js +3 -1
- package/.next/server/app/api/worktrees/[id]/schedules/active/route.js.nft.json +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.js +3 -1
- package/.next/server/app/api/worktrees/[id]/schedules/route.js.nft.json +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 -103
- 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 +104 -2
- 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.js +1 -1
- package/.next/server/app/api/worktrees/[id]/slash-commands/route.js.nft.json +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_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/terminal/route.js +1 -1
- 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_client-reference-manifest.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_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_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 +9 -9
- 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 +25 -25
- package/.next/server/chunks/1068.js +1 -1
- package/.next/server/chunks/1210.js +1 -1
- package/.next/server/chunks/1501.js +3 -3
- package/.next/server/chunks/1990.js +1 -1
- package/.next/server/chunks/2119.js +1 -1
- package/.next/server/chunks/22.js +1 -1
- package/.next/server/chunks/2328.js +1 -1
- package/.next/server/chunks/2404.js +4 -3
- package/.next/server/chunks/2445.js +1 -1
- package/.next/server/chunks/252.js +1 -1
- package/.next/server/chunks/2816.js +1 -1
- package/.next/server/chunks/3543.js +1 -1
- package/.next/server/chunks/3730.js +1 -1
- package/.next/server/chunks/3945.js +1 -1
- package/.next/server/chunks/4207.js +3 -3
- package/.next/server/chunks/5064.js +1 -1
- package/.next/server/chunks/5571.js +1 -1
- package/.next/server/chunks/5742.js +1 -1
- package/.next/server/chunks/5775.js +1 -1
- package/.next/server/chunks/611.js +1 -1
- package/.next/server/chunks/6130.js +1 -1
- package/.next/server/chunks/6285.js +1 -1
- package/.next/server/chunks/6491.js +103 -0
- package/.next/server/chunks/6661.js +1 -1
- package/.next/server/chunks/6781.js +1 -1
- package/.next/server/chunks/6793.js +1 -1
- package/.next/server/chunks/7491.js +3 -0
- package/.next/server/chunks/7685.js +1 -1
- package/.next/server/chunks/7905.js +1 -1
- package/.next/server/chunks/8581.js +2 -2
- package/.next/server/chunks/8673.js +6 -6
- package/.next/server/chunks/8728.js +2 -2
- package/.next/server/chunks/8791.js +1 -1
- package/.next/server/chunks/8800.js +4 -3
- package/.next/server/chunks/8918.js +5 -5
- package/.next/server/chunks/9130.js +3 -3
- package/.next/server/chunks/{8052.js → 9353.js} +4 -2
- package/.next/server/chunks/9390.js +3 -0
- package/.next/server/chunks/9627.js +3 -3
- package/.next/server/chunks/967.js +1 -0
- package/.next/server/chunks/9731.js +3 -3
- package/.next/server/chunks/9882.js +3 -3
- package/.next/server/middleware-manifest.json +5 -5
- package/.next/server/pages/500.html +1 -1
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/static/chunks/{1642-fb2e176aaadbd137.js → 1642-767aed8e7c61ef7f.js} +1 -1
- package/.next/static/chunks/{2407-6b9e12c099fa598c.js → 2407-940df9b11fadafc6.js} +1 -1
- package/.next/static/chunks/{2619-04bc32f026a0d946.js → 2619-a305ad4810f1393a.js} +1 -1
- package/.next/static/chunks/5449-6cb80bab2bd06b79.js +1 -0
- package/.next/static/chunks/7705-1f58d4c03d991fcf.js +1 -0
- package/.next/static/chunks/8165-3525fb42f1b4976e.js +1 -0
- package/.next/static/chunks/app/{layout-5b95e1236dcd9ef6.js → layout-057c850cd0df978e.js} +1 -1
- package/.next/static/chunks/app/review/page-ff9efae3f86eb840.js +1 -0
- package/.next/static/chunks/app/skills/[skillId]/page-74aac15286504ef4.js +1 -0
- package/.next/static/chunks/app/skills/page-182e16168b2fc098.js +1 -0
- package/.next/static/chunks/app/worktrees/[id]/page-eab0bf7564d3f9e2.js +1 -0
- package/.next/static/chunks/app/worktrees/[id]/terminal/{page-373ea37b16d930c7.js → page-c601f3b3ece6557e.js} +1 -1
- package/.next/trace +13 -13
- package/README.md +3 -3
- package/dist/cli/commands/ask.d.ts.map +1 -1
- package/dist/cli/commands/ask.js +23 -149
- package/dist/cli/commands/reply.d.ts +40 -0
- package/dist/cli/commands/reply.d.ts.map +1 -0
- package/dist/cli/commands/reply.js +133 -0
- package/dist/cli/commands/wait.d.ts +5 -0
- package/dist/cli/commands/wait.d.ts.map +1 -1
- package/dist/cli/commands/wait.js +10 -1
- package/dist/cli/docs/agent-operations.d.ts +2 -2
- package/dist/cli/docs/agent-operations.d.ts.map +1 -1
- package/dist/cli/docs/agent-operations.js +13 -0
- package/dist/cli/program.d.ts.map +1 -1
- package/dist/cli/program.js +4 -0
- package/dist/cli/utils/reply-ledger.d.ts +95 -0
- package/dist/cli/utils/reply-ledger.d.ts.map +1 -0
- package/dist/cli/utils/reply-ledger.js +187 -0
- package/dist/lib/cli-tools/copilot-executable.d.ts +9 -0
- package/dist/lib/cli-tools/copilot-executable.d.ts.map +1 -1
- package/dist/lib/cli-tools/copilot-executable.js +21 -5
- package/dist/lib/cli-tools/opencode-executable.d.ts +103 -0
- package/dist/lib/cli-tools/opencode-executable.d.ts.map +1 -0
- package/dist/lib/cli-tools/opencode-executable.js +179 -0
- package/dist/lib/cli-tools/types.d.ts +1 -1
- package/dist/lib/cli-tools/types.d.ts.map +1 -1
- package/dist/lib/cli-tools/types.js +5 -1
- package/dist/lib/detection/tools/verified-against.d.ts +15 -0
- package/dist/lib/detection/tools/verified-against.d.ts.map +1 -1
- package/dist/lib/detection/tools/verified-against.js +17 -1
- package/dist/lib/detection/version-probes.d.ts.map +1 -1
- package/dist/lib/detection/version-probes.js +14 -1
- package/dist/lib/session/tmux-session-surface.d.ts.map +1 -1
- package/dist/lib/session/tmux-session-surface.js +1 -1
- package/dist/server/locales/en/worktree.json +44 -14
- package/dist/server/locales/ja/worktree.json +44 -14
- package/dist/server/server.js +23 -0
- package/dist/server/src/config/cli-tool-timing-config.js +19 -1
- package/dist/server/src/config/detection-evidence-config.js +3 -0
- package/dist/server/src/config/schedule-config.js +55 -1
- package/dist/server/src/lib/auto-yes-poller.js +47 -4
- package/dist/server/src/lib/cli-tools/agent-mode-spec.js +54 -2
- package/dist/server/src/lib/cli-tools/base.js +6 -2
- package/dist/server/src/lib/cli-tools/command-code.js +55 -1
- package/dist/server/src/lib/cli-tools/composer-spec.js +10 -0
- package/dist/server/src/lib/cli-tools/copilot-executable.js +21 -5
- package/dist/server/src/lib/cli-tools/graceful-exit.js +15 -1
- package/dist/server/src/lib/cli-tools/index.js +3 -1
- package/dist/server/src/lib/cli-tools/install-hints.js +9 -3
- package/dist/server/src/lib/cli-tools/liveness-spec.js +19 -0
- package/dist/server/src/lib/cli-tools/manager.js +2 -0
- package/dist/server/src/lib/cli-tools/opencode-executable.js +179 -0
- package/dist/server/src/lib/cli-tools/opencode-v2.js +369 -0
- package/dist/server/src/lib/cli-tools/opencode.js +29 -5
- package/dist/server/src/lib/cli-tools/types.js +5 -1
- package/dist/server/src/lib/cmate-cli-tool-parser.js +65 -7
- package/dist/server/src/lib/cmate-parser.js +12 -0
- package/dist/server/src/lib/cmate-validator.js +13 -1
- package/dist/server/src/lib/detection/cli-patterns.js +78 -2
- package/dist/server/src/lib/detection/model-info-extractor.js +79 -7
- package/dist/server/src/lib/detection/status-detector.js +10 -1
- package/dist/server/src/lib/detection/tools/codex/cli-patterns.js +2 -1
- package/dist/server/src/lib/detection/tools/opencode-v2/detect.js +253 -0
- package/dist/server/src/lib/detection/tools/opencode-v2/dialog-title.js +48 -0
- package/dist/server/src/lib/detection/tools/registry.js +2 -0
- package/dist/server/src/lib/detection/tools/run-detection.js +9 -0
- package/dist/server/src/lib/detection/tools/verified-against.js +17 -1
- package/dist/server/src/lib/detection/upstream-faults.js +8 -0
- package/dist/server/src/lib/detection/version-probes.js +14 -1
- package/dist/server/src/lib/hooks/agent-session-telemetry.js +36 -1
- package/dist/server/src/lib/hooks/sources/opencode/log-diagnosis.js +105 -0
- package/dist/server/src/lib/hooks/sources/opencode/source.js +7 -1
- package/dist/server/src/lib/hooks/sources/opencode-v2/client.js +422 -0
- package/dist/server/src/lib/hooks/sources/opencode-v2/decision-labels.js +24 -0
- package/dist/server/src/lib/hooks/sources/opencode-v2/history.js +421 -0
- package/dist/server/src/lib/hooks/sources/opencode-v2/ingest.js +271 -0
- package/dist/server/src/lib/hooks/sources/opencode-v2/mappers.js +165 -0
- package/dist/server/src/lib/hooks/sources/opencode-v2/payloads.js +351 -0
- package/dist/server/src/lib/hooks/sources/opencode-v2/ports.js +230 -0
- package/dist/server/src/lib/hooks/sources/opencode-v2/reattach.js +149 -0
- package/dist/server/src/lib/hooks/sources/opencode-v2/runtime.js +180 -0
- package/dist/server/src/lib/hooks/sources/opencode-v2/secrets.js +182 -0
- package/dist/server/src/lib/hooks/sources/opencode-v2/source.js +295 -0
- package/dist/server/src/lib/hooks/sources/opencode-v2/subscription.js +455 -0
- package/dist/server/src/lib/hooks/sources/opencode-v2/tool-id.js +18 -0
- package/dist/server/src/lib/hooks/sources/opencode-v2/usage.js +214 -0
- package/dist/server/src/lib/hooks/sources/registry.js +2 -0
- package/dist/server/src/lib/hooks/structured-decision-response.js +14 -5
- package/dist/server/src/lib/job-executor.js +2 -1
- package/dist/server/src/lib/polling/auto-yes-dialog-gate.js +15 -1
- package/dist/server/src/lib/polling/structured-history-gate.js +19 -5
- package/dist/server/src/lib/relay/relay-delivery.js +4 -1
- package/dist/server/src/lib/session/agent-event-state.js +24 -0
- package/dist/server/src/lib/session/claude-executor.js +184 -10
- package/dist/server/src/lib/session/current-output-builder.js +27 -3
- package/dist/server/src/lib/session/send-user-message.js +4 -0
- package/dist/server/src/lib/session/structured-prompt.js +54 -0
- package/dist/server/src/lib/session/tmux-session-surface.js +1 -1
- package/dist/server/src/lib/skills/compatibility-matrix.js +65 -0
- package/dist/server/src/lib/tmux/tmux.js +48 -2
- package/dist/server/src/lib/verification/env-clean-gate.js +87 -5
- package/dist/server/src/types/cli-tool-contracts.js +10 -2
- package/dist/types/cli-tool-contracts.d.ts +16 -5
- package/dist/types/cli-tool-contracts.d.ts.map +1 -1
- package/dist/types/cli-tool-contracts.js +10 -2
- package/package.json +2 -1
- package/release-notes/0.43.0.json +130 -0
- package/scripts/hooks/cmate-agent-event.sh +14 -0
- package/scripts/opencode-v2/launch.sh +226 -0
- package/.next/server/chunks/4443.js +0 -3
- package/.next/server/chunks/5164.js +0 -1
- package/.next/server/chunks/650.js +0 -1
- package/.next/static/chunks/5449-550bd273dccc3ae4.js +0 -1
- package/.next/static/chunks/7705-2a2936551b0cf9a3.js +0 -1
- package/.next/static/chunks/8165-934ee7ff3b4ddfd4.js +0 -1
- package/.next/static/chunks/app/review/page-30616daa1dc595c2.js +0 -1
- package/.next/static/chunks/app/skills/[skillId]/page-ab7e432b69fccb3b.js +0 -1
- package/.next/static/chunks/app/skills/page-56b4fa11223e0cbd.js +0 -1
- package/.next/static/chunks/app/worktrees/[id]/page-59f5337e031518c6.js +0 -1
- /package/.next/static/{MXZXkcFAnpELZnxxHB4iJ → BVkBYdceLRvMROqQIqeBx}/_buildManifest.js +0 -0
- /package/.next/static/{MXZXkcFAnpELZnxxHB4iJ → BVkBYdceLRvMROqQIqeBx}/_ssgManifest.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8165],{17683:(e,t,a)=>{a.d(t,{$2:()=>o,B1:()=>h,CO:()=>f,If:()=>u,NP:()=>d,TR:()=>m,wp:()=>l});var n=a(75676);let s="commandmate.worktree.surfaceMode-",r="commandmate.settings.defaultSurfaceMode",l="/api/settings/default-surface-mode",i="view";function o(e,t){return"".concat(s).concat(e,"-split-").concat(t)}function d(e){return"".concat(s).concat(e,"-mobile")}function c(e){try{let t=window.localStorage.getItem(e);return(0,n.jg)(t)?t:null}catch(e){return null}}function u(e,t){try{window.localStorage.setItem(e,t)}catch(e){}}function f(){try{let{location:e,history:t}=window,a=new URLSearchParams(e.search);if(!a.has(i))return;a.delete(i);let n=a.toString(),s="".concat(e.pathname).concat(n?"?".concat(n):"").concat(e.hash);t.replaceState(t.state,"",s)}catch(e){}}function m(e,t){var a;let s=void 0===t?function(){try{var e=window.location.search;if(!e)return null;try{let t=new URLSearchParams(e).get(i);return(0,n.jg)(t)?t:null}catch(e){return null}}catch(e){return null}}():t;return s?(u(e,s),s):(j||(j=!0,y()),null!=(a=c(e))?a:g())}let x=n.wf,p=new Set;function g(){var e;return null!=(e=c(r))?e:x}function h(e){if(!(0,n.jg)(e))return!1;let t=g()!==e;if(x=e,u(r,e),t)for(let e of p)e();return t}let b=null,v=!1,j=!1;async function y(){return v?g():b||("function"!=typeof fetch?g():b=(async()=>{try{let e=await fetch(l);if(e.ok){let t=await e.json();h(null==t?void 0:t.defaultSurfaceMode),v=!0}}catch(e){}finally{b=null}return g()})())}},24373:(e,t,a)=>{a.d(t,{Lv:()=>r});var n=a(12115),s=a(66966);function r(){let e=(0,s.rC)(),t=null==e?void 0:e.worktrees;return(0,n.useMemo)(()=>{let e=t?t.filter(e=>!0===e.isWaitingForResponse):[];return{count:e.length,worktrees:e}},[t])}a(44308)},40823:(e,t,a)=>{a.d(t,{NS:()=>i,V0:()=>o});var n=a(95155),s=a(12115);let r=()=>{},l=(0,s.createContext)({isOpen:!1,open:r,close:r});function i(e){let{children:t}=e,[a,r]=(0,s.useState)(!1),i=(0,s.useCallback)(()=>r(!0),[]),o=(0,s.useCallback)(()=>r(!1),[]),d=(0,s.useMemo)(()=>({isOpen:a,open:i,close:o}),[a,i,o]);return(0,n.jsx)(l.Provider,{value:d,children:t})}function o(){return(0,s.useContext)(l)}},44308:(e,t,a)=>{a.d(t,{$h:()=>u,DR:()=>s,IH:()=>d,Iu:()=>n,Nb:()=>f,SD:()=>r,_d:()=>o,bm:()=>m,ks:()=>i,t7:()=>c,z7:()=>l});let n=7e3,s=["in_review","approval","stalled"],r="in_review",l="filter",i="/review?".concat(l,"=approval");function o(e){return e&&s.includes(e)?e:null}let d=["claude","codex","copilot","antigravity","opencode"],c=1e3,u=5,f=100,m=1e3},58165:(e,t,a)=>{a.d(t,{uN:()=>k,gZ:()=>ea,O3:()=>G});var n=a(95155),s=a(12115),r=a(18955),l=a(5917),i=a(20562),o=a(8803),d=a(65229),c=a(6191),u=a(48407),f=a(54014),m=a(55449);function x(e){return!!e&&"object"==typeof e&&Array.isArray(e.defaultSelectedAgents)&&e.defaultSelectedAgents.length>0&&Array.isArray(e.available)&&e.available.length>0&&"number"==typeof e.minAgents&&"number"==typeof e.maxAgents}function p(){var e;let t=(0,r.c)("common"),[a,p]=(0,s.useState)(null),[g,h]=(0,s.useState)([]),[b,v]=(0,s.useState)(!0),[j,y]=(0,s.useState)("idle"),[N,w]=(0,s.useState)(null),k=(0,s.useCallback)(async()=>{try{let e=await fetch("".concat(m.zk,"?include=installed"));if(!e.ok)throw Error(String(e.status));let t=await e.json();if(!x(t))throw Error("unexpected body");p(t),h(t.defaultSelectedAgents),(0,m.IK)(t.defaultSelectedAgents)}catch(e){w(t("settings.defaultAgents.loadError"))}finally{v(!1)}},[t]);(0,s.useEffect)(()=>{k()},[k]);let C=(0,s.useCallback)(e=>{h(e),y("idle"),w(null)},[]),S=(0,s.useCallback)((e,t)=>{let a=e+t;if(a<0||a>=g.length)return;let n=[...g];[n[e],n[a]]=[n[a],n[e]],C(n)},[g,C]),A=(0,s.useCallback)(async e=>{y("saving"),w(null);try{let n=await fetch(m.zk,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({agents:e})}),s=await n.json().catch(()=>null);if(!n.ok||!x(s)){var a;y("error"),w(null!=(a=null==s?void 0:s.error)?a:t("settings.defaultAgents.saveError"));return}p(e=>({...s,installed:null==e?void 0:e.installed})),h(s.defaultSelectedAgents),(0,m.IK)(s.defaultSelectedAgents),y("saved")}catch(e){y("error"),w(t("settings.defaultAgents.saveError"))}},[t]);if(b)return(0,n.jsx)(u.Zp,{children:(0,n.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,n.jsx)(u.y$,{size:"sm"}),t("loadingPage")]})});if(!a)return(0,n.jsx)(u.Zp,{children:(0,n.jsx)("div",{className:"text-sm text-danger-foreground","data-testid":"default-agents-load-error",children:null!=N?N:t("settings.defaultAgents.loadError")})});let E=null!=(e=a.installed)?e:[],P=a.available.filter(e=>!g.includes(e)),T=g.length<a.minAgents,M=g.length>a.maxAgents,I=!T&&!M&&"saving"!==j,O=e=>E.includes(e)?(0,n.jsxs)("span",{className:"inline-flex items-center gap-1 rounded bg-success-subtle px-1.5 py-0.5 text-xs text-success-foreground","data-testid":"default-agents-installed-".concat(e),children:[(0,n.jsx)(l.A,{className:"h-3 w-3","aria-hidden":"true"}),t("settings.defaultAgents.installed")]}):(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:t("settings.defaultAgents.notInstalled")});return(0,n.jsx)(u.Zp,{children:(0,n.jsxs)("div",{className:"space-y-4","data-testid":"default-agents-settings",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"text-sm font-medium text-foreground",children:t("settings.defaultAgents.title")}),(0,n.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:t("settings.defaultAgents.description")}),(0,n.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:t("settings.defaultAgents.appliesToNew")}),E.includes("opencode")&&E.includes("opencode-v2")&&(0,n.jsx)("p",{className:"mt-1 text-xs text-warning-foreground","data-testid":"default-agents-opencode-shared-data",children:t("settings.defaultAgents.opencodeSharedData")})]}),(0,n.jsx)("ul",{className:"space-y-2","data-testid":"default-agents-selected",children:g.map((e,s)=>(0,n.jsxs)("li",{className:"flex items-center gap-2 rounded-md border border-border bg-surface px-3 py-2","data-testid":"default-agents-row-".concat(e),children:[(0,n.jsx)("span",{className:"w-6 text-xs text-muted-foreground",children:s+1}),(0,n.jsx)("span",{className:"text-sm text-foreground",children:(0,f.oo)(e)}),0===s&&(0,n.jsx)("span",{className:"rounded bg-info-subtle px-1.5 py-0.5 text-xs text-info-foreground","data-testid":"default-agents-primary-badge",children:t("settings.defaultAgents.primary")}),(0,n.jsx)("span",{className:"ml-auto",children:O(e)}),(0,n.jsx)("button",{type:"button",className:"rounded p-1 text-muted-foreground hover:bg-muted disabled:opacity-40",onClick:()=>S(s,-1),disabled:0===s,"aria-label":t("settings.defaultAgents.moveUp"),"data-testid":"default-agents-up-".concat(e),children:(0,n.jsx)(i.A,{className:"h-4 w-4","aria-hidden":"true"})}),(0,n.jsx)("button",{type:"button",className:"rounded p-1 text-muted-foreground hover:bg-muted disabled:opacity-40",onClick:()=>S(s,1),disabled:s===g.length-1,"aria-label":t("settings.defaultAgents.moveDown"),"data-testid":"default-agents-down-".concat(e),children:(0,n.jsx)(o.A,{className:"h-4 w-4","aria-hidden":"true"})}),(0,n.jsx)("button",{type:"button",className:"rounded p-1 text-muted-foreground hover:bg-muted disabled:opacity-40",onClick:()=>C(g.filter(t=>t!==e)),disabled:g.length<=a.minAgents,"aria-label":t("settings.defaultAgents.remove"),"data-testid":"default-agents-remove-".concat(e),children:(0,n.jsx)(d.A,{className:"h-4 w-4","aria-hidden":"true"})})]},e))}),P.length>0&&(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"mb-2 text-xs text-muted-foreground",children:t("settings.defaultAgents.addLabel")}),(0,n.jsx)("ul",{className:"space-y-2","data-testid":"default-agents-available",children:P.map(e=>(0,n.jsxs)("li",{className:"flex items-center gap-2 rounded-md border border-border px-3 py-2",children:[(0,n.jsx)("span",{className:"text-sm text-foreground",children:(0,f.oo)(e)}),(0,n.jsx)("span",{className:"ml-auto",children:O(e)}),(0,n.jsx)("button",{type:"button",className:"rounded p-1 text-muted-foreground hover:bg-muted disabled:opacity-40",onClick:()=>C([...g,e]),disabled:g.length>=a.maxAgents,"aria-label":t("settings.defaultAgents.add"),"data-testid":"default-agents-add-".concat(e),children:(0,n.jsx)(c.A,{className:"h-4 w-4","aria-hidden":"true"})})]},e))})]}),(T||M)&&(0,n.jsx)("div",{className:"text-xs text-danger-foreground","data-testid":"default-agents-range-error",children:t("settings.defaultAgents.range",{min:a.minAgents,max:a.maxAgents})}),N&&(0,n.jsx)("div",{className:"text-xs text-danger-foreground","data-testid":"default-agents-error",children:N}),(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(u.$n,{size:"sm",onClick:()=>void A(g),disabled:!I,"data-testid":"default-agents-save",children:"saving"===j?t("settings.defaultAgents.saving"):t("settings.defaultAgents.save")}),(0,n.jsx)(u.$n,{size:"sm",variant:"ghost",onClick:()=>void A(null),disabled:!a.configured||"saving"===j,"data-testid":"default-agents-reset",children:t("settings.defaultAgents.reset")}),(0,n.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":"default-agents-state",children:"saved"===j?t("settings.defaultAgents.saved"):a.configured?t("settings.defaultAgents.configured"):t("settings.defaultAgents.usingBuiltIn")})]}),a.configured&&(0,n.jsx)("div",{className:"text-xs text-muted-foreground","data-testid":"default-agents-builtin",children:t("settings.defaultAgents.builtIn",{agents:a.constantDefault.map(f.oo).join(", ")})})]})})}var g=a(17683),h=a(75676);function b(e){return!!e&&"object"==typeof e&&(0,h.jg)(e.defaultSurfaceMode)&&(0,h.jg)(e.constantDefault)&&Array.isArray(e.available)&&e.available.length>0&&e.available.every(h.jg)}function v(){var e;let t=(0,r.c)("common"),[a,l]=(0,s.useState)(null),[i,o]=(0,s.useState)(!0),[d,c]=(0,s.useState)("idle"),[f,m]=(0,s.useState)(null),x=(0,s.useCallback)(async()=>{try{let e=await fetch(g.wp);if(!e.ok)throw Error(String(e.status));let t=await e.json();if(!b(t))throw Error("unexpected body");l(t),(0,g.B1)(t.defaultSurfaceMode)}catch(e){m({kind:"load"})}finally{o(!1)}},[]);(0,s.useEffect)(()=>{x()},[x]);let p=(0,s.useCallback)(async e=>{c("saving"),m(null),l(t=>t?{...t,defaultSurfaceMode:e}:t);try{let t=await fetch(g.wp,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:e})}),a=await t.json().catch(()=>null);if(!t.ok||!b(a)){c("error"),m({kind:"save",detail:null==a?void 0:a.error}),x();return}l(a),(0,g.B1)(a.defaultSurfaceMode),c("saved")}catch(e){c("error"),m({kind:"save"}),x()}},[x]),h=f?null!=(e=f.detail)?e:t("load"===f.kind?"settings.defaultSurfaceMode.loadError":"settings.defaultSurfaceMode.saveError"):null;return i?(0,n.jsx)(u.Zp,{children:(0,n.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,n.jsx)(u.y$,{size:"sm"}),t("loadingPage")]})}):a?(0,n.jsx)(u.Zp,{children:(0,n.jsxs)("div",{className:"space-y-4","data-testid":"default-surface-mode-settings",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"text-sm font-medium text-foreground",children:t("settings.defaultSurfaceMode.title")}),(0,n.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:t("settings.defaultSurfaceMode.description")}),(0,n.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:t("settings.defaultSurfaceMode.appliesToNew")})]}),(0,n.jsx)("div",{role:"radiogroup","aria-label":t("settings.defaultSurfaceMode.title"),className:"space-y-2","data-selected":a.defaultSurfaceMode,children:a.available.map(e=>(0,n.jsxs)("label",{className:"flex cursor-pointer items-start gap-2 rounded-md border border-border bg-surface px-3 py-2","data-testid":"default-surface-mode-option-".concat(e),children:[(0,n.jsx)("input",{type:"radio",name:"default-surface-mode",value:e,className:"mt-0.5",checked:a.defaultSurfaceMode===e,disabled:"saving"===d,onChange:()=>void p(e),"data-testid":"default-surface-mode-radio-".concat(e)}),(0,n.jsxs)("span",{children:[(0,n.jsx)("span",{className:"block text-sm text-foreground",children:t("settings.defaultSurfaceMode.mode.".concat(e))}),(0,n.jsx)("span",{className:"block text-xs text-muted-foreground",children:t("settings.defaultSurfaceMode.hint.".concat(e))})]})]},e))}),h&&(0,n.jsx)("div",{className:"text-xs text-danger-foreground","data-testid":"default-surface-mode-error",children:h}),(0,n.jsx)("div",{className:"text-xs text-muted-foreground","data-testid":"default-surface-mode-state",children:"saving"===d?t("settings.defaultSurfaceMode.saving"):"saved"===d?t("settings.defaultSurfaceMode.saved"):a.configured?t("settings.defaultSurfaceMode.configured"):t("settings.defaultSurfaceMode.usingBuiltIn")})]})}):(0,n.jsx)(u.Zp,{children:(0,n.jsx)("div",{className:"text-sm text-danger-foreground","data-testid":"default-surface-mode-load-error",children:null!=h?h:t("settings.defaultSurfaceMode.loadError")})})}var j=a(68695),y=a(52056),N=a(48314);function w(e){let t=e.trim();if(!t)return null;try{let e=JSON.parse(t);if(!e||"object"!=typeof e)return null;let a=e.type;if("plan"!==a&&"output"!==a&&"done"!==a)return null;return e}catch(e){return null}}function k(e){var t,a,l;let{worktreeId:i,instances:o,variant:d="card"}=e,c=(0,r.c)("common"),{versions:m,isLoading:x,loadError:p,run:g,isUpdating:h,update:b}=function(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0],[t,a]=(0,s.useState)(null),[n,r]=(0,s.useState)(!1),[l,i]=(0,s.useState)(e),[o,d]=(0,s.useState)(null),[c,u]=(0,s.useState)(!1),f=(0,s.useRef)(!0);(0,s.useEffect)(()=>(f.current=!0,()=>{f.current=!1}),[]);let m=(0,s.useCallback)(async function(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(e){i(!0);try{let e=await fetch("/api/agents/versions".concat(t?"?refresh=1":""));if(!e.ok)throw Error(String(e.status));let n=await e.json();if(!(n&&"object"==typeof n&&Array.isArray(n.tools)&&Array.isArray(n.updatable)))throw Error("unexpected body");if(!f.current)return;a(n.tools),r(!1)}catch(e){if(!f.current)return;r(!0)}finally{f.current&&i(!1)}}},[e]);(0,s.useEffect)(()=>{m(!1)},[m]);let x=(0,s.useCallback)(async e=>{if(c)return;u(!0),d({tool:e,command:null,output:"",ok:null,previousVersion:null,installed:null,error:null});let t=e=>{f.current&&d(t=>t?{...t,ok:!1,error:e}:t)};try{var a,n;let s=await fetch("/api/agents/update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tool:e})});if(!s.ok||!s.body){let e=await s.json().catch(()=>null);t(null!=(a=null==e?void 0:e.error)?a:"Request failed (".concat(s.status,")"));return}let r=s.body.getReader(),l=new TextDecoder,i="",o=e=>{f.current&&d(t=>{var a;return t?"plan"===e.type?{...t,command:e.command}:"output"===e.type?{...t,output:t.output+e.text}:{...t,ok:e.ok,previousVersion:e.previousVersion,installed:e.installed,error:null!=(a=e.error)?a:null}:t})};for(;;){let{done:e,value:t}=await r.read();if(e)break;let a=(i+=l.decode(t,{stream:!0})).split("\n");for(let e of(i=null!=(n=a.pop())?n:"",a)){let t=w(e);t&&o(t)}}let c=w(i);c&&o(c)}catch(e){t(e instanceof Error?e.message:String(e))}finally{f.current&&u(!1),await m(!0)}},[c,m]);return{versions:t,isLoading:l,loadError:n,run:o,isUpdating:c,reload:m,update:x}}(!0),[v,k]=(0,s.useState)(0),C=function(e,t,a){let[n,r]=(0,s.useState)({});return(0,s.useEffect)(()=>{if(!e||!t||0===t.length)return void r({});let a=!1;return(async()=>{try{let t=await fetch("/api/worktrees/".concat(e));if(!t.ok)return;let n=await t.json();if(a)return;let s=n.sessionStatusByInstance,l={};for(let[e,t]of Object.entries(null!=s?s:{}))(null==t?void 0:t.isRunning)&&(l[e]=!0);r(l)}catch(e){}})(),()=>{a=!0}},[e,t,a]),n}(i,o,v),[S,A]=(0,s.useState)({}),[E,P]=(0,s.useState)(null),T=(0,s.useRef)(null);(0,s.useEffect)(()=>{T.current&&(T.current.scrollTop=T.current.scrollHeight)},[null==g?void 0:g.output]);let M=(null==g?void 0:g.ok)===!0;(0,s.useEffect)(()=>{M&&k(e=>e+1)},[M]);let I=(0,s.useCallback)(e=>(null!=o?o:[]).filter(t=>t.cliTool===e&&C[t.id]),[o,C]),O=(0,s.useCallback)(async e=>{if(i){P(null);try{let t=new URLSearchParams({cliTool:e.cliTool,instance:e.id}),a=await fetch("/api/worktrees/".concat(i,"/kill-session?").concat(t.toString()),{method:"POST"});if(!a.ok&&404!==a.status)throw Error(String(a.status));A(t=>({...t,[e.id]:!0})),k(e=>e+1)}catch(e){P(c("agentUpdates.restartError"))}}},[i,c]),R=x&&!m?(0,n.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,n.jsx)(u.y$,{size:"sm"}),c("loadingPage")]}):p&&!m?(0,n.jsx)("div",{className:"text-sm text-danger-foreground","data-testid":"agent-updates-load-error",children:c("agentUpdates.loadError")}):(0,n.jsxs)("div",{className:"space-y-3","data-testid":"agent-updates",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"text-sm font-medium text-foreground",children:c("agentUpdates.title")}),(0,n.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:c("agentUpdates.description")})]}),(0,n.jsx)("ul",{className:"space-y-2","data-testid":"agent-updates-rows",children:(null!=m?m:[]).map(e=>{var t,a;let s=I(e.tool),r=e.updatable&&null!==e.installed;return(0,n.jsxs)("li",{className:"rounded-md border border-border bg-surface px-3 py-2","data-testid":"agent-updates-row-".concat(e.tool),children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,n.jsx)("span",{className:"text-sm text-foreground",children:(a=e.tool,(0,f.oo)(a)||a)}),(0,n.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":"agent-updates-installed-".concat(e.tool),children:e.installed?c("agentUpdates.installed",{version:e.installed}):c("agentUpdates.notInstalled")}),e.updateAvailable&&(0,n.jsx)("span",{className:"rounded bg-info-subtle px-1.5 py-0.5 text-xs text-info-foreground","data-testid":"agent-updates-available-".concat(e.tool),children:c("agentUpdates.available",{version:null!=(t=e.latestVersion)?t:""})}),e.dismissedInCodex&&(0,n.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":"agent-updates-dismissed-".concat(e.tool),children:c("agentUpdates.dismissed")}),r&&(0,n.jsxs)(u.$n,{size:"sm",className:"ml-auto",disabled:h,onClick:()=>void b(e.tool),"data-testid":"agent-updates-update-".concat(e.tool),children:[(0,n.jsx)(j.A,{className:"h-4 w-4","aria-hidden":"true"}),h&&(null==g?void 0:g.tool)===e.tool?c("agentUpdates.updating"):c("agentUpdates.update")]})]}),r&&s.length>0&&(0,n.jsxs)("div",{className:"mt-2 flex items-start gap-1 text-xs text-warning-foreground","data-testid":"agent-updates-restart-warning-".concat(e.tool),children:[(0,n.jsx)(y.A,{className:"mt-0.5 h-3 w-3 shrink-0","aria-hidden":"true"}),(0,n.jsx)("span",{children:c("agentUpdates.restartWarning",{sessions:s.map(e=>e.alias).join(", ")})})]}),r&&0===s.length&&void 0===i&&(0,n.jsx)("p",{className:"mt-2 text-xs text-muted-foreground","data-testid":"agent-updates-restart-notice-".concat(e.tool),children:c("agentUpdates.restartNotice")}),M&&(null==g?void 0:g.tool)===e.tool&&s.map(e=>(0,n.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,n.jsxs)(u.$n,{size:"sm",variant:"ghost",disabled:S[e.id],onClick:()=>void O(e),"data-testid":"agent-updates-restart-".concat(e.id),children:[(0,n.jsx)(N.A,{className:"h-4 w-4","aria-hidden":"true"}),c("agentUpdates.restart",{alias:e.alias})]}),S[e.id]&&(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:c("agentUpdates.restarted")})]},e.id))]},e.tool)})}),g&&(0,n.jsxs)("div",{className:"space-y-2","data-testid":"agent-updates-run",children:[g.command&&(0,n.jsx)("div",{className:"text-xs text-muted-foreground","data-testid":"agent-updates-command",children:c("agentUpdates.running",{command:g.command})}),g.output&&(0,n.jsx)("pre",{ref:T,"data-testid":"agent-updates-output",className:"max-h-48 overflow-auto whitespace-pre-wrap rounded-md bg-terminal-surface p-2 text-xs text-terminal-foreground",children:g.output}),!0===g.ok&&(0,n.jsx)("div",{className:"text-xs text-success-foreground","data-testid":"agent-updates-success",children:c("agentUpdates.succeeded",{from:null!=(t=g.previousVersion)?t:"?",to:null!=(a=g.installed)?a:"?"})}),!1===g.ok&&(0,n.jsx)("div",{className:"text-xs text-danger-foreground","data-testid":"agent-updates-failure",children:c("agentUpdates.failed",{error:null!=(l=g.error)?l:""})})]}),E&&(0,n.jsx)("div",{className:"text-xs text-danger-foreground","data-testid":"agent-updates-restart-error",children:E})]});return"plain"===d?R:(0,n.jsx)(u.Zp,{children:R})}var C=a(52619),S=a.n(C);function A(e){var t;let{appId:a,pollInterval:l=3e4,showResponseTime:i=!1,compact:o=!1}=e,d=(0,r.c)("externalApps"),[c,u]=(0,s.useState)(null),[f,m]=(0,s.useState)(!0),x=(0,s.useCallback)(async()=>{try{let e=await fetch("/api/external-apps/".concat(a,"/health"));if(e.ok){let t=await e.json();u(t)}else u({id:a,healthy:!1,lastChecked:Date.now(),error:"Failed to check health"})}catch(e){u({id:a,healthy:!1,lastChecked:Date.now(),error:"Network error"})}finally{m(!1)}},[a]);if((0,s.useEffect)(()=>{x();let e=setInterval(x,l);return()=>clearInterval(e)},[x,l]),f)return(0,n.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,n.jsx)("span",{className:"inline-block h-2.5 w-2.5 rounded-full bg-muted-foreground animate-pulse"}),!o&&(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:d("status.checking")})]});let p=null!=(t=null==c?void 0:c.healthy)&&t,g=p?"bg-success":"bg-muted-foreground",h=d(p?"status.running":"status.stopped");return o?(0,n.jsx)("span",{className:"inline-block h-2.5 w-2.5 rounded-full ".concat(g),title:h}):(0,n.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,n.jsx)("span",{className:"inline-block h-2.5 w-2.5 rounded-full ".concat(g)}),(0,n.jsx)("span",{className:"text-xs ".concat(p?"text-success-foreground":"text-muted-foreground"),children:h}),i&&(null==c?void 0:c.responseTime)!==void 0&&(0,n.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",c.responseTime,"ms)"]})]})}function E(e){var t;let{app:a,onEdit:l,onDelete:i}=e,o=(0,r.c)("externalApps"),d=(0,r.c)("common"),[c,f]=(0,s.useState)(!1),[m,x]=(0,s.useState)(!1),p=async()=>{x(!0);try{await i(a.id)}finally{x(!1),f(!1)}},g="/proxy/".concat(a.pathPrefix,"/");return(0,n.jsxs)(u.Zp,{padding:"md",className:"relative",children:[(0,n.jsxs)("div",{className:"flex items-start justify-between mb-3",children:[(0,n.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,n.jsx)("h4",{className:"text-base font-semibold text-foreground truncate",children:a.displayName}),(0,n.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 font-mono truncate",children:a.name})]}),(0,n.jsx)(u.Ex,{variant:{sveltekit:"warning",streamlit:"error",nextjs:"info",other:"gray"}[a.appType]||"gray",children:{sveltekit:"SvelteKit",streamlit:"Streamlit",nextjs:"Next.js",other:"Other"}[t=a.appType]||t})]}),(0,n.jsxs)("div",{className:"space-y-2 mb-4",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("span",{className:"text-sm text-muted-foreground",children:o("card.status")}),(0,n.jsx)(A,{appId:a.id,pollInterval:3e4})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("span",{className:"text-sm text-muted-foreground",children:o("card.port")}),(0,n.jsxs)("span",{className:"text-sm font-mono text-foreground",children:[":",a.targetPort]})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("span",{className:"text-sm text-muted-foreground",children:o("card.path")}),(0,n.jsxs)("span",{className:"text-sm font-mono text-foreground truncate max-w-[150px]",children:["/proxy/",a.pathPrefix,"/"]})]}),a.websocketEnabled&&(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("span",{className:"text-sm text-muted-foreground",children:o("card.websocket")}),(0,n.jsx)(u.Ex,{variant:"info",children:o("card.enabled")})]}),!a.enabled&&(0,n.jsx)("div",{className:"mt-2 py-1 px-2 bg-warning-subtle border border-warning-border rounded text-xs text-warning-foreground",children:o("card.disabledNotice")})]}),c?(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:o("card.deleteConfirm",{name:a.displayName})}),(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)(u.$n,{variant:"danger",size:"sm",onClick:p,disabled:m,loading:m,children:o("card.delete")}),(0,n.jsx)(u.$n,{variant:"ghost",size:"sm",onClick:()=>f(!1),disabled:m,children:d("cancel")})]})]}):(0,n.jsxs)("div",{className:"flex gap-2 flex-wrap",children:[(0,n.jsx)(u.$n,{variant:"primary",size:"sm",onClick:()=>window.open(g,"_blank"),disabled:!a.enabled,children:o("card.open")}),(0,n.jsx)(u.$n,{variant:"secondary",size:"sm",onClick:()=>l(a),children:o("card.settings")}),(0,n.jsx)(u.$n,{variant:"ghost",size:"sm",onClick:()=>f(!0),className:"text-danger-foreground hover:bg-danger-subtle",children:o("card.delete")})]})]})}var P=a(87531);let T={MIN:1024,MAX:65535},M=/^[a-zA-Z0-9-]+$/,I={sveltekit:"SvelteKit",streamlit:"Streamlit",nextjs:"Next.js",other:"Other"},O=["sveltekit","streamlit","nextjs","other"].map(e=>({value:e,label:I[e]}));function R(e){let{isOpen:t,onClose:a,editApp:l,onSave:i}=e,o=(0,r.c)("externalApps"),d=(0,r.c)("common"),c=!!l,[f,m]=(0,s.useState)(""),[x,p]=(0,s.useState)(""),[g,h]=(0,s.useState)(""),[b,v]=(0,s.useState)(""),[j,y]=(0,s.useState)(""),[N,w]=(0,s.useState)(!1),[k,C]=(0,s.useState)(""),[S,A]=(0,s.useState)(!0),[E,I]=(0,s.useState)({}),[R,U]=(0,s.useState)(!1),[L,z]=(0,s.useState)(null);(0,s.useEffect)(()=>{t&&(l?(m(l.displayName),p(l.name),h(l.pathPrefix),v(l.targetPort),y(l.appType),w(l.websocketEnabled),C(l.description||""),A(l.enabled)):(m(""),p(""),h(""),v(""),y(""),w(!1),C(""),A(!0)),I({}),z(null))},[t,l]);let $=async e=>{e.preventDefault(),z(null);let t=function(e,t){var a,n,s,r;let l={};return((null==(a=e.displayName)?void 0:a.trim())||(l.displayName="Display name is required"),!t&&((null==(n=e.name)?void 0:n.trim())?M.test(e.name)||(l.name="Only alphanumeric characters and hyphens are allowed"):l.name="Identifier name is required",(null==(s=e.pathPrefix)?void 0:s.trim())?M.test(e.pathPrefix)||(l.pathPrefix="Only alphanumeric characters and hyphens are allowed"):l.pathPrefix="Path prefix is required"),e.targetPort)?"number"!=typeof e.targetPort||Number.isInteger(r=e.targetPort)&&r>=T.MIN&&r<=T.MAX||(l.targetPort="Port must be between ".concat(T.MIN," and ").concat(T.MAX)):l.targetPort="Port number is required",t||e.appType||(l.appType="App type is required"),l}({displayName:f,name:x,pathPrefix:g,targetPort:b,appType:j},c);if(Object.keys(t).length>0)return void I(t);I({}),U(!0);try{if(c&&l){let e=await fetch("/api/external-apps/".concat(l.id),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({displayName:f,description:k||void 0,targetPort:b||void 0,websocketEnabled:N,enabled:S})});if(!e.ok){let t=await e.json();throw Error(t.error||o("form.updateFailed"))}}else{let e=await fetch("/api/external-apps",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({displayName:f,name:x,pathPrefix:g,targetPort:b,appType:j,websocketEnabled:N,description:k||void 0})});if(!e.ok){let t=await e.json();throw Error(t.error||o("form.createFailed"))}}i(),a()}catch(e){z(e instanceof Error?e.message:o("form.genericError"))}finally{U(!1)}};return(0,n.jsx)(u.Jh,{isOpen:t,onClose:a,title:c?o("form.editTitle"):o("form.addTitle"),size:"md",children:(0,n.jsxs)("form",{onSubmit:$,className:"space-y-4",children:[(0,n.jsx)("div",{className:"rounded-md bg-warning-subtle p-3 mb-4 border border-warning-border",children:(0,n.jsx)("p",{className:"text-sm text-warning-foreground",children:o("form.securityWarning")})}),(0,n.jsxs)("div",{children:[(0,n.jsxs)("label",{htmlFor:"displayName",className:"block text-sm font-medium text-foreground mb-1",children:[o("form.displayName")," ",(0,n.jsx)("span",{className:"text-danger",children:"*"})]}),(0,n.jsx)(u.pd,{id:"displayName",type:"text",value:f,onChange:e=>m(e.target.value),className:E.displayName?"border-danger":"",placeholder:o("form.displayNamePlaceholder"),disabled:R}),E.displayName&&(0,n.jsx)("p",{className:"mt-1 text-xs text-danger",children:E.displayName})]}),!c&&(0,n.jsxs)("div",{children:[(0,n.jsxs)("label",{htmlFor:"name",className:"block text-sm font-medium text-foreground mb-1",children:[o("form.identifierName")," ",(0,n.jsx)("span",{className:"text-danger",children:"*"})]}),(0,n.jsx)(u.pd,{id:"name",type:"text",value:x,onChange:e=>p(e.target.value),className:"font-mono ".concat(E.name?"border-danger":""),placeholder:o("form.identifierNamePlaceholder"),disabled:R}),(0,n.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:o("form.identifierNameHelp")}),E.name&&(0,n.jsx)("p",{className:"mt-1 text-xs text-danger",children:E.name})]}),!c&&(0,n.jsxs)("div",{children:[(0,n.jsxs)("label",{htmlFor:"pathPrefix",className:"block text-sm font-medium text-foreground mb-1",children:[o("form.pathPrefix")," ",(0,n.jsx)("span",{className:"text-danger",children:"*"})]}),(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)("span",{className:"text-sm text-muted-foreground mr-1",children:"/proxy/"}),(0,n.jsx)(u.pd,{id:"pathPrefix",type:"text",value:g,onChange:e=>h(e.target.value),className:"w-auto flex-1 font-mono ".concat(E.pathPrefix?"border-danger":""),placeholder:o("form.pathPrefixPlaceholder"),disabled:R}),(0,n.jsx)("span",{className:"text-sm text-muted-foreground ml-1",children:"/"})]}),(0,n.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:o("form.pathPrefixHelp")}),E.pathPrefix&&(0,n.jsx)("p",{className:"mt-1 text-xs text-danger",children:E.pathPrefix})]}),(0,n.jsxs)("div",{children:[(0,n.jsxs)("label",{htmlFor:"targetPort",className:"block text-sm font-medium text-foreground mb-1",children:[o("form.portNumber")," ",(0,n.jsx)("span",{className:"text-danger",children:"*"})]}),(0,n.jsx)(u.pd,{id:"targetPort",type:"number",value:b,onChange:e=>v(e.target.value?parseInt(e.target.value,10):""),className:"font-mono ".concat(E.targetPort?"border-danger":""),placeholder:o("form.portNumberPlaceholder"),min:T.MIN,max:T.MAX,disabled:R}),(0,n.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:o("form.portNumberHelp",{min:T.MIN,max:T.MAX})}),E.targetPort&&(0,n.jsx)("p",{className:"mt-1 text-xs text-danger",children:E.targetPort})]}),!c&&(0,n.jsxs)("div",{children:[(0,n.jsxs)("label",{htmlFor:"appType",className:"block text-sm font-medium text-foreground mb-1",children:[o("form.appType")," ",(0,n.jsx)("span",{className:"text-danger",children:"*"})]}),(0,n.jsxs)("select",{id:"appType",value:j,onChange:e=>y(e.target.value),className:(0,P.cn)((0,u.j1)(),E.appType&&"border-danger"),disabled:R,children:[(0,n.jsx)("option",{value:"",children:o("form.appTypePlaceholder")}),O.map(e=>(0,n.jsx)("option",{value:e.value,children:e.label},e.value))]}),E.appType&&(0,n.jsx)("p",{className:"mt-1 text-xs text-danger",children:E.appType})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{htmlFor:"description",className:"block text-sm font-medium text-foreground mb-1",children:o("form.description")}),(0,n.jsx)(u.k_,{id:"description",value:k,onChange:e=>C(e.target.value),placeholder:o("form.descriptionPlaceholder"),rows:2,disabled:R})]}),(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(u.dO,{id:"websocketEnabled",checked:N,onCheckedChange:w,disabled:R}),(0,n.jsx)("label",{htmlFor:"websocketEnabled",className:"text-sm text-foreground",children:o("form.websocketLabel")})]}),c&&(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(u.dO,{id:"enabled",checked:S,onCheckedChange:A,disabled:R}),(0,n.jsx)("label",{htmlFor:"enabled",className:"text-sm text-foreground",children:o("form.enabledLabel")})]}),L&&(0,n.jsx)("div",{className:"p-3 bg-danger-subtle border border-danger-border rounded text-sm text-danger-foreground",children:L}),(0,n.jsxs)("div",{className:"flex justify-end gap-2 pt-4 border-t border-border",children:[(0,n.jsx)(u.$n,{type:"button",variant:"ghost",onClick:a,disabled:R,children:d("cancel")}),(0,n.jsx)(u.$n,{type:"submit",variant:"primary",loading:R,children:c?o("form.save"):o("form.add")})]})]})})}function U(){let e=(0,r.c)("externalApps"),t=(0,r.c)("common"),[a,l]=(0,s.useState)([]),[i,o]=(0,s.useState)(!0),[d,c]=(0,s.useState)(null),[f,m]=(0,s.useState)(!1),[x,p]=(0,s.useState)(null),g=(0,s.useCallback)(async()=>{try{c(null);let e=await fetch("/api/external-apps");if(!e.ok)throw Error("Failed to fetch external apps");let t=await e.json();l(t.apps||[])}catch(e){c(e instanceof Error?e.message:"An error occurred")}finally{o(!1)}},[]);(0,s.useEffect)(()=>{g();let e=setInterval(g,6e4);return()=>clearInterval(e)},[g]);let h=(0,s.useCallback)(e=>{p(e),m(!0)},[]),b=(0,s.useCallback)(()=>{p(null),m(!0)},[]),v=(0,s.useCallback)(async e=>{try{let t=await fetch("/api/external-apps/".concat(e),{method:"DELETE"});if(!t.ok){let e=await t.json();throw Error(e.error||"Failed to delete app")}g()}catch(e){console.error("Failed to delete app:",e)}},[g]),j=(0,s.useCallback)(()=>{g()},[g]),y=(0,s.useCallback)(()=>{m(!1),p(null)},[]);return(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsx)("div",{className:"flex items-center justify-end",children:(0,n.jsx)(u.$n,{variant:"primary",size:"sm",onClick:b,children:e("manager.addApp")})}),i?(0,n.jsx)(u.Zp,{padding:"lg",children:(0,n.jsxs)("div",{className:"flex items-center justify-center py-8",children:[(0,n.jsx)(u.y$,{size:"xl",variant:"accent"}),(0,n.jsx)("span",{className:"ml-3 text-muted-foreground",children:e("manager.loading")})]})}):d?(0,n.jsx)(u.Zp,{padding:"lg",children:(0,n.jsxs)("div",{className:"text-center py-8",children:[(0,n.jsx)("p",{className:"text-danger-foreground mb-4",children:e("manager.loadError")}),(0,n.jsx)(u.$n,{variant:"secondary",size:"sm",onClick:g,children:t("retry")})]})}):0===a.length?(0,n.jsx)(u.Zp,{padding:"lg",children:(0,n.jsxs)("div",{className:"text-center py-8",children:[(0,n.jsx)("p",{className:"text-muted-foreground mb-4",children:e("manager.empty")}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:e("manager.emptyHelp")}),(0,n.jsx)(u.$n,{variant:"primary",size:"sm",onClick:b,children:e("manager.addFirst")})]})}):(0,n.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:a.map(e=>(0,n.jsx)(E,{app:e,onEdit:h,onDelete:v},e.id))}),(0,n.jsx)(R,{isOpen:f,onClose:y,editApp:x,onSave:j})]})}var L=a(85998),z=a(94442),$=a(59597);function D(){return"undefined"!=typeof navigator&&"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window}let F={enabled:!0,thresholdMinutes:10},Z=[5,10,30,60];function H(){let e=(0,r.c)("notifications"),{showToast:t}=(0,z.dj)(),[a,l]=(0,s.useState)(!0),[i,o]=(0,s.useState)(!1),[d,c]=(0,s.useState)(!0),[f,m]=(0,s.useState)(!1),[x,p]=(0,s.useState)(null),[g,h]=(0,s.useState)(null),[b,v]=(0,s.useState)(!1),[j,y]=(0,s.useState)(null),[N,w]=(0,s.useState)({prompt:!0,completion:!1}),[k,C]=(0,s.useState)(!1),[S,A]=(0,s.useState)(null),[E,P]=(0,s.useState)(null),T=null!==j&&!1!==E;(0,s.useEffect)(()=>{let e=!1;return(async()=>{let t=function(){var e,t;let a=D(),n="undefined"!=typeof navigator&&(!!/iPad|iPhone|iPod/.test(navigator.userAgent)||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1)&&!(null!=(e=(t=window).matchMedia)&&e.call(t,"(display-mode: standalone)").matches||!0===navigator.standalone);return{supported:a&&!n,iosNeedsInstall:n}}();e||(c(D()),m(t.iosNeedsInstall),"undefined"!=typeof Notification&&"denied"===Notification.permission&&v(!0));try{let t=await fetch("/api/push/vapid"),a=await t.json();e||(p(a.configured),h(a.publicKey))}catch(t){e||p(!1)}if(D())try{let t=await navigator.serviceWorker.getRegistration(),n=t?await t.pushManager.getSubscription():null;if(n&&!e){y(n.endpoint);let t=await fetch("/api/push/subscriptions?endpoint=".concat(encodeURIComponent(n.endpoint))),s=await t.json();if(!e){var a;P(!0===s.subscribed),A(null!=(a=s.delivery)?a:null)}s.subscribed&&s.subscription&&!e&&(w(s.subscription.preferences),C(!0===s.subscription.defaultsNoticePending))}}catch(e){}e||l(!1)})(),()=>{e=!0}},[]);let M=(0,s.useCallback)(async()=>{if(g){o(!0);try{var a,n;let s=await Notification.requestPermission();if("granted"!==s){v("denied"===s),t(e("toast.error"),"error");return}if(!await navigator.serviceWorker.getRegistration())return void t(e("toast.error"),"error");let r=await navigator.serviceWorker.ready,l=await r.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:function(e){let t="=".repeat((4-e.length%4)%4),a=atob((e+t).replace(/-/g,"+").replace(/_/g,"/")),n=new Uint8Array(new ArrayBuffer(a.length));for(let e=0;e<a.length;e++)n[e]=a.charCodeAt(e);return n}(g)}),i=await fetch("/api/push/subscriptions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({subscription:l.toJSON(),deviceLabel:navigator.userAgent.slice(0,120)})});if(!i.ok)throw Error("subscribe request failed");let o=await i.json();y(l.endpoint),P(!0),A(null),(null==(a=o.subscription)?void 0:a.preferences)&&w(o.subscription.preferences),C((null==(n=o.subscription)?void 0:n.defaultsNoticePending)===!0),v(!1),t(e("toast.enabled"),"success")}catch(a){t(e("toast.error"),"error")}finally{o(!1)}}},[g,t,e]),I=(0,s.useCallback)(async()=>{o(!0);try{var a;let n=await navigator.serviceWorker.getRegistration(),s=n?await n.pushManager.getSubscription():null,r=null!=(a=null==s?void 0:s.endpoint)?a:j;s&&await s.unsubscribe(),r&&await fetch("/api/push/subscriptions",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({endpoint:r})}),y(null),P(null),A(null),t(e("toast.disabled"),"info")}catch(a){t(e("toast.error"),"error")}finally{o(!1)}},[j,t,e]),O=(0,s.useCallback)(async(a,n)=>{if(!j)return;let s={...N,[a]:n};w(s);try{if(!(await fetch("/api/push/subscriptions",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({endpoint:j,preferences:s})})).ok)throw Error("update failed");t(e("toast.updated"),"success")}catch(a){w(N),t(e("toast.error"),"error")}},[j,N,t,e]),R=(0,s.useCallback)(async a=>{if(!j)return;let n=a?{...N,completion:!1}:N;C(!1),a&&w(n),o(!0);try{if(!(await fetch("/api/push/subscriptions",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({endpoint:j,...a?{preferences:n}:{},acknowledgeDefaultsNotice:!0})})).ok)throw Error("acknowledge failed");t(e(a?"defaultsNotice.adopted":"defaultsNotice.kept"),"success")}catch(a){w(N),C(!0),t(e("toast.error"),"error")}finally{o(!1)}},[j,N,t,e]);return(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsx)(u.Zp,{children:(0,n.jsx)(q,{})}),(0,n.jsx)(u.Zp,{children:a?(0,n.jsx)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:(0,n.jsx)(u.y$,{size:"sm"})}):d?f?(0,n.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"notifications-ios-guidance",children:e("ios.guidance")}):!1===x?(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:e("notConfigured")}):(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:e("description")}),b&&(0,n.jsx)("p",{className:"text-sm text-danger-foreground","data-testid":"notifications-permission-denied",children:e("permission.denied")}),(()=>{if(null===S)return null;let t="removed"===S.state,a=S.statusCode,s=t?null===a?e("delivery.removedUnknownStatus"):e("delivery.removed",{status:String(a)}):null===a?e("delivery.failingUnknownStatus",{count:S.failureCount}):e("delivery.failing",{count:S.failureCount,status:String(a)});return(0,n.jsxs)("div",{className:t?"space-y-2 rounded-lg border border-danger-border bg-danger-subtle p-3":"space-y-2 rounded-lg border border-warning-border bg-warning-subtle p-3","data-testid":"notifications-delivery-health","data-delivery-state":S.state,children:[(0,n.jsx)("p",{className:t?"text-sm font-semibold text-danger-foreground":"text-sm font-semibold text-warning-foreground",children:e(t?"delivery.headingRemoved":"delivery.headingFailing")}),(0,n.jsx)("p",{className:"text-xs text-foreground",children:s}),403===a&&(0,n.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"notifications-delivery-apns-hint",children:e("delivery.apnsHint")}),(0,n.jsx)("p",{className:"text-xs text-muted-foreground",children:e("delivery.since",{timestamp:new Date(S.firstFailureAt).toLocaleString()})})]})})(),T?(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsx)("p",{className:"text-sm font-medium text-foreground",children:e("enabledOnThisDevice")}),k&&(0,n.jsxs)("div",{className:"space-y-3 rounded-lg border border-info-border bg-info-subtle p-3","data-testid":"notifications-defaults-notice",children:[(0,n.jsx)("p",{className:"text-sm font-semibold text-info-foreground",children:e("defaultsNotice.heading")}),(0,n.jsx)("p",{className:"text-xs text-foreground",children:e("defaultsNotice.completionChanged")}),(0,n.jsx)("p",{className:"text-xs text-foreground",children:e("defaultsNotice.failuresAdded")}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,n.jsx)(u.$n,{variant:"primary",onClick:()=>R(!0),disabled:i,"data-testid":"notifications-defaults-notice-adopt",children:e("defaultsNotice.adopt")}),(0,n.jsx)(u.$n,{variant:"secondary",onClick:()=>R(!1),disabled:i,"data-testid":"notifications-defaults-notice-keep",children:e("defaultsNotice.keep")})]})]}),(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsx)("div",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:e("types.heading")}),(0,n.jsxs)("label",{className:"flex items-center justify-between gap-4",children:[(0,n.jsxs)("span",{children:[(0,n.jsx)("span",{className:"block text-sm font-medium text-foreground",children:e("types.promptWaiting")}),(0,n.jsx)("span",{className:"block text-xs text-muted-foreground",children:e("types.promptWaitingDesc")})]}),(0,n.jsx)(u.dO,{checked:N.prompt,onCheckedChange:e=>O("prompt",e),disabled:i,"aria-label":e("types.promptWaiting"),"data-testid":"notifications-toggle-prompt"})]}),(0,n.jsxs)("label",{className:"flex items-center justify-between gap-4",children:[(0,n.jsxs)("span",{children:[(0,n.jsx)("span",{className:"block text-sm font-medium text-foreground",children:e("types.completion")}),(0,n.jsx)("span",{className:"block text-xs text-muted-foreground",children:e("types.completionDesc")})]}),(0,n.jsx)(u.dO,{checked:N.completion,onCheckedChange:e=>O("completion",e),disabled:i,"aria-label":e("types.completion"),"data-testid":"notifications-toggle-completion"})]})]}),(0,n.jsx)(u.$n,{variant:"secondary",onClick:I,disabled:i,"data-testid":"notifications-unsubscribe",children:e("unsubscribe")})]}):(0,n.jsxs)(u.$n,{variant:"primary",onClick:M,disabled:i||b||!g,"data-testid":"notifications-enable",children:[(0,n.jsx)(L.A,{className:"h-4 w-4"}),i?e("enabling"):e("enable")]})]}):(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:e("unsupported")})}),(0,n.jsx)(u.Zp,{children:(0,n.jsx)(W,{})})]})}function W(){let e=(0,r.c)("notifications"),{showToast:t}=(0,z.dj)(),[a,l]=(0,s.useState)(!0),[i,o]=(0,s.useState)(!1),[d,c]=(0,s.useState)(F),[f,m]=(0,s.useState)([...Z]);(0,s.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await fetch("/api/push/escalation"),a=await t.json();!e&&(a.settings&&c(a.settings),Array.isArray(a.choices)&&a.choices.length>0&&m(a.choices))}catch(e){}finally{e||l(!1)}})(),()=>{e=!0}},[]);let x=(0,s.useCallback)(async a=>{c(a),o(!0);try{if(!(await fetch("/api/push/escalation",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({settings:a})})).ok)throw Error("update failed");t(e("toast.updated"),"success")}catch(a){c(d),t(e("toast.error"),"error")}finally{o(!1)}},[d,t,e]);return(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsx)("div",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:e("escalation.heading")}),(0,n.jsxs)("label",{className:"flex items-center justify-between gap-4",children:[(0,n.jsxs)("span",{children:[(0,n.jsx)("span",{className:"block text-sm font-medium text-foreground",children:e("escalation.toggle")}),(0,n.jsx)("span",{className:"block text-xs text-muted-foreground",children:e("escalation.toggleDesc")})]}),(0,n.jsx)(u.dO,{checked:d.enabled,onCheckedChange:e=>x({...d,enabled:e}),disabled:a||i,"aria-label":e("escalation.toggle"),"data-testid":"notifications-toggle-escalation"})]}),(0,n.jsxs)("label",{className:"flex items-center justify-between gap-4",children:[(0,n.jsx)("span",{className:"text-sm text-foreground",children:e("escalation.threshold")}),(0,n.jsx)("select",{className:"rounded-md border border-border bg-background px-2 py-1 text-sm text-foreground",value:String(d.thresholdMinutes),disabled:a||i||!d.enabled,"aria-label":e("escalation.threshold"),"data-testid":"notifications-escalation-threshold",onChange:e=>x({...d,thresholdMinutes:Number(e.target.value)}),children:f.map(t=>(0,n.jsx)("option",{value:String(t),children:e("escalation.minutes",{count:t})},t))})]})]})}function q(){let e=(0,r.c)("notifications"),{enabled:t,setEnabled:a}=(0,$.qG)(),{enabled:s,setEnabled:l}=(0,$.Ql)();return(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsx)("div",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:e("inApp.heading")}),(0,n.jsxs)("label",{className:"flex items-center justify-between gap-4",children:[(0,n.jsxs)("span",{children:[(0,n.jsx)("span",{className:"block text-sm font-medium text-foreground",children:e("inApp.waitingToggle")}),(0,n.jsx)("span",{className:"block text-xs text-muted-foreground",children:e("inApp.waitingToggleDesc")})]}),(0,n.jsx)(u.dO,{checked:t,onCheckedChange:a,"aria-label":e("inApp.waitingToggle"),"data-testid":"notifications-toggle-inapp-waiting"})]}),(0,n.jsxs)("label",{className:"flex items-center justify-between gap-4",children:[(0,n.jsxs)("span",{children:[(0,n.jsx)("span",{className:"block text-sm font-medium text-foreground",children:e("inApp.soundToggle")}),(0,n.jsx)("span",{className:"block text-xs text-muted-foreground",children:e("inApp.soundToggleDesc")})]}),(0,n.jsx)(u.dO,{checked:s,onCheckedChange:l,"aria-label":e("inApp.soundToggle"),"data-testid":"notifications-toggle-inapp-sound"})]})]})}function _(e){let{heading:t,children:a}=e;return(0,n.jsxs)("div",{className:"mb-8",children:[(0,n.jsx)("h2",{className:"text-lg font-semibold mb-4 text-foreground",children:t}),a]})}function B(e){let{onNavigate:t}=e,a=(0,r.c)("common"),s=(0,r.c)("skills");return(0,n.jsx)(_,{heading:a("settings.sections.quickLinks"),children:(0,n.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[(0,n.jsx)(S(),{href:"/repositories",className:"block","data-testid":"more-link-repositories",onClick:t,children:(0,n.jsxs)(u.Zp,{hover:!0,className:"transition-colors hover:border-accent-300 dark:hover:border-accent-700",children:[(0,n.jsx)("div",{className:"text-sm font-medium text-foreground",children:"Repositories"}),(0,n.jsx)("div",{className:"text-xs text-muted-foreground",children:"Manage repositories and worktrees"})]})}),(0,n.jsx)(S(),{href:"/skills",className:"block","data-testid":"more-link-skills",onClick:t,children:(0,n.jsxs)(u.Zp,{hover:!0,className:"transition-colors hover:border-accent-300 dark:hover:border-accent-700",children:[(0,n.jsx)("div",{className:"text-sm font-medium text-foreground",children:a("nav.skills")}),(0,n.jsx)("div",{className:"text-xs text-muted-foreground",children:s("page.description")})]})}),(0,n.jsx)(S(),{href:"/skills/installed",className:"block","data-testid":"more-link-skills-installed",onClick:t,children:(0,n.jsxs)(u.Zp,{hover:!0,className:"transition-colors hover:border-accent-300 dark:hover:border-accent-700",children:[(0,n.jsx)("div",{className:"text-sm font-medium text-foreground",children:s("dashboard.title")}),(0,n.jsx)("div",{className:"text-xs text-muted-foreground",children:s("dashboard.description")})]})})]})})}function J(){let e=(0,r.c)("common");return(0,n.jsx)(_,{heading:e("settings.sections.general"),children:(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsx)(p,{}),(0,n.jsx)(v,{}),(0,n.jsx)(k,{})]})})}function V(){let e=(0,r.c)("common");return(0,n.jsx)(_,{heading:e("settings.sections.notifications"),children:(0,n.jsx)(H,{})})}function K(){let e=(0,r.c)("common");return(0,n.jsx)(_,{heading:e("settings.sections.externalApps"),children:(0,n.jsx)(U,{})})}function X(){let e=(0,r.c)("common");return(0,n.jsx)(_,{heading:e("settings.sections.about"),children:(0,n.jsx)(u.Zp,{children:(0,n.jsx)("div",{className:"text-sm text-muted-foreground",children:"CommandMate - A local control plane for agent CLIs."})})})}function G(){return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(B,{}),(0,n.jsx)(J,{}),(0,n.jsx)(V,{}),(0,n.jsx)(K,{}),(0,n.jsx)(X,{})]})}a(72604),a(95275),a(79832);var Q=a(94465),Y=a(23838),ee=a(40823);let et=[{id:"general",labelKey:"settings.sections.general"},{id:"notifications",labelKey:"settings.sections.notifications"},{id:"externalApps",labelKey:"settings.sections.externalApps"},{id:"about",labelKey:"settings.sections.about"}];function ea(){let e=(0,r.c)("common"),{isOpen:t,close:a}=(0,ee.V0)();return(0,n.jsx)(Q.a,{isOpen:t,onClose:a,title:e("settings.title"),size:"lg",children:(0,n.jsxs)(Y.tU,{defaultValue:"general",orientation:"vertical",variant:"pill",className:"flex gap-6 min-h-[60vh]","data-testid":"settings-dialog",children:[(0,n.jsx)(Y.j7,{"aria-label":e("settings.categoriesLabel"),className:"sticky top-0 w-40 shrink-0 flex-col items-stretch self-start",children:et.map(t=>(0,n.jsx)(Y.Xi,{value:t.id,"data-testid":"settings-dialog-tab-".concat(t.id),className:"justify-start",children:e(t.labelKey)},t.id))}),(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsx)(Y.av,{value:"general",className:"mt-0",children:(0,n.jsx)(J,{})}),(0,n.jsx)(Y.av,{value:"notifications",className:"mt-0",children:(0,n.jsx)(V,{})}),(0,n.jsx)(Y.av,{value:"externalApps",className:"mt-0",children:(0,n.jsx)(K,{})}),(0,n.jsxs)(Y.av,{value:"about",className:"mt-0",children:[(0,n.jsx)(B,{onNavigate:a}),(0,n.jsx)(X,{})]})]})]})})}},59597:(e,t,a)=>{a.d(t,{Ql:()=>o,qG:()=>l});var n=a(12115);let s="mcbd-inapp-waiting-toast",r="mcbd:inapp-notification-prefs-changed";function l(){let[e,t]=(0,n.useState)(!0);return(0,n.useEffect)(()=>{let e=()=>t(function(){try{let e=window.localStorage.getItem(s);if(null===e)return!0;return"false"!==e}catch(e){return!0}}());return e(),window.addEventListener(r,e),window.addEventListener("storage",e),()=>{window.removeEventListener(r,e),window.removeEventListener("storage",e)}},[]),{enabled:e,setEnabled:(0,n.useCallback)(e=>{t(e);try{window.localStorage.setItem(s,e?"true":"false")}catch(e){}window.dispatchEvent(new CustomEvent(r))},[])}}let i="mcbd-inapp-waiting-sound";function o(){let[e,t]=(0,n.useState)(!1);return(0,n.useEffect)(()=>{let e=()=>t(function(){try{let e=window.localStorage.getItem(i);if(null===e)return!1;return"true"===e}catch(e){return!1}}());return e(),window.addEventListener(r,e),window.addEventListener("storage",e),()=>{window.removeEventListener(r,e),window.removeEventListener("storage",e)}},[]),{enabled:e,setEnabled:(0,n.useCallback)(e=>{t(e);try{window.localStorage.setItem(i,e?"true":"false")}catch(e){}window.dispatchEvent(new CustomEvent(r))},[])}}},72604:(e,t,a)=>{a.d(t,{dS:()=>c,rM:()=>u});var n=a(12115),s=a(20063),r=a(18955),l=a(94442),i=a(66966),o=a(60199),d=a(59597);function c(e,t,a){return"".concat(e,"|").concat(null!=t?t:"-","|").concat(null!=a?a:"no-since")}function u(){let e=(0,r.c)("notifications"),{showToast:t}=(0,l.dj)(),{addListener:a}=(0,o.xM)(),{enabled:u}=(0,d.qG)(),f=(0,s.usePathname)(),m=(0,s.useRouter)(),x=(0,i.rC)(),p=(0,n.useRef)({enabled:u,pathname:f,worktrees:null==x?void 0:x.worktrees,showToast:t,t:e,router:m});p.current={enabled:u,pathname:f,worktrees:null==x?void 0:x.worktrees,showToast:t,t:e,router:m};let g=(0,n.useRef)(new Set);return(0,n.useEffect)(()=>a(e=>{var t,a,n,s,r;if("session_status_changed"!==e.type)return;let l=e.worktreeId;if("string"!=typeof l||0===l.length)return;let i=e.isWaitingForResponse;if("boolean"!=typeof i)return;let o=null!=(n=e.instance)?n:null,d=null!=(s=e.waitingSince)?s:null;if(!i){let e="".concat(l,"|").concat(null!=o?o:"-","|");for(let t of g.current)t.startsWith(e)&&g.current.delete(t);return}let u=p.current;if(!u.enabled||function(e){if(!e)return null;let t=/^\/worktrees\/([^/]+)/.exec(e);if(!t)return null;try{return decodeURIComponent(t[1])}catch(e){return t[1]}}(u.pathname)===l)return;let f=c(l,o,d);if(g.current.has(f))return;g.current.size>=500&&g.current.clear(),g.current.add(f);let m=null!=(r=null==(a=u.worktrees)||null==(t=a.find(e=>e.id===l))?void 0:t.name)?r:l;u.showToast(u.t("inApp.waitingToast",{name:m}),"warning",8e3,{onClick:()=>u.router.push("/worktrees/".concat(encodeURIComponent(l)))})}),[a]),null}},75676:(e,t,a)=>{a.d(t,{jg:()=>r,kQ:()=>l,mR:()=>d,mS:()=>o,wf:()=>n});let n="terminal",s=new Set(["terminal","chat"]);function r(e){return"string"==typeof e&&s.has(e)}let l={data:null,messageId:null,visible:!1,answering:!1},i={mode:"split",mobileActivePane:"terminal",leftPaneTab:"history",splitRatio:.5,leftPaneCollapsed:!1,activityBar:{active:"files"},historyPane:{visible:!0,width:25,collapsed:!1}},o={type:null,message:null,retryable:!1,retryCount:0};function d(){return{phase:"idle",prompt:{...l},layout:{...i},error:{...o},messages:[],wsConnected:!1}}},79832:(e,t,a)=>{a.d(t,{o:()=>o});var n=a(12115),s=a(24373);let r=/^\(\d+\+?\)(?:\s+|$)/;function l(e){return e.replace(r,"").trim()}function i(e){return Array.from(e.querySelectorAll('link[rel~="icon"]'))}function o(){return!function(){let{count:e}=(0,s.Lv)(),t=(0,n.useRef)([]),a=(0,n.useRef)(null);(0,n.useEffect)(()=>{if("undefined"==typeof document)return;let t=()=>{let t=function(e,t){let a=l(e);if(!Number.isFinite(t)||t<=0)return a;let n="(".concat(Math.floor(t),")");return a?"".concat(n," ").concat(a):n}(document.title,e);t!==document.title&&(document.title=t)};t();let a=null;return"undefined"!=typeof MutationObserver&&document.head&&(a=new MutationObserver(t)).observe(document.head,{childList:!0,subtree:!0,characterData:!0}),()=>{null==a||a.disconnect();let e=l(document.title);e!==document.title&&(document.title=e)}},[e]),(0,n.useEffect)(()=>{if("undefined"==typeof document||e<=0)return;let n=t.current,s=()=>{let t=a.current,s=function(e){var t,a;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Number.isFinite(e)||e<=0)return null;let s=null!=(t=n.document)?t:"undefined"!=typeof document?document:null;if(!s)return null;let r=null!=(a=n.size)?a:64;try{let t=s.createElement("canvas");t.width=r,t.height=r;let a=t.getContext("2d");if(!a)return null;a.clearRect(0,0,r,r),n.base?a.drawImage(n.base,0,0,r,r):(a.fillStyle="#111827",a.fillRect(0,0,r,r));let l=Math.floor(e)>9,i=.34*r,o=r-i-.03*r;a.beginPath(),a.arc(o,o,i,0,2*Math.PI),a.fillStyle=l?"#ef4444":"#f59e0b",a.fill(),a.lineWidth=.05*r,a.strokeStyle="rgba(0, 0, 0, 0.55)",a.stroke();let d=function(e){if(!Number.isFinite(e)||e<=0)return"";let t=Math.floor(e);return t>9?"".concat(9,"+"):String(t)}(e);return a.fillStyle=l?"#ffffff":"#1c1300",a.font="bold ".concat(Math.round(r*(d.length>1?.38:.48)),"px sans-serif"),a.textAlign="center",a.textBaseline="middle",a.fillText(d,o,o+.02*r),t.toDataURL("image/png")}catch(e){return null}}(e,{base:t&&t.complete&&t.naturalWidth>0?t:null,document});s&&function(e,t,a){let n=i(e);if(0===n.length){let t=e.createElement("link");t.setAttribute("rel","icon"),t.setAttribute("type","image/png"),e.head.appendChild(t),a.push({link:t,originalHref:null,created:!0}),n=[t]}for(let e of n)a.some(t=>t.link===e)||a.push({link:e,originalHref:e.getAttribute("href"),created:!1}),e.setAttribute("href",t)}(document,s,n)};s();let r=a.current;if(!r&&"undefined"!=typeof Image){let e=function(e,t){var a;for(let e of t)if(!e.created&&e.originalHref)return e.originalHref;let n=i(e).find(e=>e.getAttribute("href"));return null!=(a=null==n?void 0:n.getAttribute("href"))?a:null}(document,n);e&&(a.current=r=new Image,r.src=e)}let l=null;return r&&!(r.complete&&r.naturalWidth>0)?(l=()=>s(),r.addEventListener("load",l)):r&&s(),()=>{r&&l&&r.removeEventListener("load",l);for(let e of n){if(e.created){e.link.remove();continue}null===e.originalHref?e.link.removeAttribute("href"):e.link.setAttribute("href",e.originalHref)}n.length=0}},[e]),(0,n.useEffect)(()=>{!function(e,t){let a="undefined"!=typeof navigator?navigator:null;if(!a)return;let n=e=>{e&&"function"==typeof e.catch&&e.catch(()=>{})};try{if(Number.isFinite(e)&&e>0){if("function"!=typeof a.setAppBadge)return!1;return n(a.setAppBadge(Math.floor(e))),!0}if("function"!=typeof a.clearAppBadge)return!1;n(a.clearAppBadge())}catch(e){return!1}}(e)},[e])}(),null}},94442:(e,t,a)=>{a.d(t,{dj:()=>y,tE:()=>j});var n=a(95155),s=a(12115),r=a(47650),l=a(18955),i=a(42529),o=a(78874),d=a(52056),c=a(23327),u=a(65229),f=a(59854),m=a(9900),x=a(9286);function p(e){let{type:t,iconColor:a}=e,s="h-5 w-5 ".concat(a);switch(t){case"success":return(0,n.jsx)(i.A,{className:s,"data-testid":"toast-icon-success"});case"error":return(0,n.jsx)(o.A,{className:s,"data-testid":"toast-icon-error"});case"warning":return(0,n.jsx)(d.A,{className:s,"data-testid":"toast-icon-warning"});default:return(0,n.jsx)(c.A,{className:s,"data-testid":"toast-icon-info"})}}function g(e){let{id:t,message:a,type:r,onClose:i,duration:o=3e3,onClick:d}=e,c=(0,l.c)("common"),f=(0,s.useRef)(null),g=function(e){switch(e){case"success":return{bgColor:"bg-success-subtle",borderColor:"border-success-border",textColor:"text-success-foreground",iconColor:"text-success-foreground"};case"error":return{bgColor:"bg-danger-subtle",borderColor:"border-danger-border",textColor:"text-danger-foreground",iconColor:"text-danger-foreground"};case"warning":return{bgColor:"bg-warning-subtle",borderColor:"border-warning-border",textColor:"text-warning-foreground",iconColor:"text-warning-foreground"};default:return{bgColor:"bg-info-subtle",borderColor:"border-info-border",textColor:"text-info-foreground",iconColor:"text-info-foreground"}}}(r),[h,b]=(0,s.useState)(!0),{shouldRender:v,isExiting:j}=(0,x.O)(h,m.Ys),y=(0,s.useRef)(i);y.current=i,(0,s.useEffect)(()=>{v||y.current(t)},[v,t]),(0,s.useEffect)(()=>(o>0&&(f.current=setTimeout(()=>{b(!1)},o)),()=>{f.current&&clearTimeout(f.current)}),[o]);let N=(0,s.useCallback)(()=>{f.current&&clearTimeout(f.current),b(!1)},[]);return(0,n.jsxs)("div",{"data-testid":"toast-".concat(t),role:"alert",className:"\n ".concat(g.bgColor,"\n ").concat(g.borderColor,"\n ").concat(g.textColor,"\n border rounded-lg shadow-lg p-4 min-w-[300px] max-w-[400px]\n flex items-start gap-3\n ").concat(j?"animate-out fade-out-0 slide-out-to-right-full duration-200 fill-mode-forwards pointer-events-none":"animate-slide-in","\n "),children:[(0,n.jsx)(p,{type:r,iconColor:g.iconColor}),d?(0,n.jsx)("button",{type:"button","data-testid":"toast-action-button",onClick:()=>{d(),N()},className:"flex-1 text-left text-sm font-medium underline-offset-2 hover:underline focus:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded-sm",children:a}):(0,n.jsx)("p",{className:"flex-1 text-sm font-medium",children:a}),(0,n.jsx)("button",{"data-testid":"toast-close-button",onClick:N,"aria-label":c("closeNotification"),className:"\n ".concat(g.textColor,"\n hover:opacity-70\n focus:outline-none focus:ring-2 focus:ring-offset-2\n transition-opacity\n "),children:(0,n.jsx)(u.A,{className:"h-4 w-4"})})]})}function h(e){let{toasts:t,onClose:a}=e,[l,i]=(0,s.useState)(!1);(0,s.useEffect)(()=>{i(!0)},[]);let o=(0,n.jsx)("div",{"data-testid":"toast-container","aria-live":"polite",className:"fixed bottom-4 right-4 flex flex-col gap-2",style:{zIndex:f.M.TOAST},children:t.map(e=>(0,n.jsx)(g,{id:e.id,message:e.message,type:e.type,onClose:a,duration:e.duration,onClick:e.onClick},e.id))});return l?(0,r.createPortal)(o,document.body):null}function b(){let[e,t]=(0,s.useState)([]),a=(0,s.useRef)(0),n=(0,s.useCallback)(function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"info",s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3e3,r=arguments.length>3?arguments[3]:void 0,l="toast-".concat(++a.current,"-").concat(Date.now()),i={id:l,message:e,type:n,duration:s,...(null==r?void 0:r.onClick)?{onClick:r.onClick}:{}};return t(e=>[...e,i]),l},[]),r=(0,s.useCallback)(e=>{t(t=>t.filter(t=>t.id!==e))},[]),l=(0,s.useCallback)(()=>{t([])},[]);return(0,s.useMemo)(()=>({toasts:e,showToast:n,removeToast:r,clearToasts:l}),[e,n,r,l])}let v=(0,s.createContext)(null);function j(e){let{children:t}=e,a=b();return(0,n.jsxs)(v.Provider,{value:a,children:[t,(0,n.jsx)(h,{toasts:a.toasts,onClose:a.removeToast})]})}function y(){let e=(0,s.useContext)(v),t=b();return null!=e?e:t}},95275:(e,t,a)=>{a.d(t,{H:()=>f});var n=a(12115),s=a(60199),r=a(59597),l=a(72604);let i=[{frequency:880,offset:0,duration:.12},{frequency:1318.5,offset:.13,duration:.18}],o=null;function d(){if(o)return o;let e=function(){var e,t;let a=window;return null!=(t=null!=(e=a.AudioContext)?e:a.webkitAudioContext)?t:null}();if(!e)return null;try{o=new e}catch(e){return null}return o}function c(e){e&&"function"==typeof e.catch&&e.catch(()=>{})}let u=["pointerdown","touchstart","keydown"];function f(){let{addListener:e}=(0,s.xM)(),{enabled:t}=(0,r.Ql)(),a=(0,n.useRef)({enabled:t});a.current={enabled:t};let o=(0,n.useRef)(new Set);return(0,n.useEffect)(()=>{let e=()=>(function(){let e=d();if(e)try{var t;"suspended"===e.state&&c(null==(t=e.resume)?void 0:t.call(e))}catch(e){}})();for(let t of u)window.addEventListener(t,e,{once:!0,passive:!0});return()=>{for(let t of u)window.removeEventListener(t,e)}},[]),(0,n.useEffect)(()=>e(e=>{var t,n;if("session_status_changed"!==e.type)return;let s=e.worktreeId;if("string"!=typeof s||0===s.length)return;let r=e.isWaitingForResponse;if("boolean"!=typeof r)return;let u=null!=(t=e.instance)?t:null,f=null!=(n=e.waitingSince)?n:null;if(!r){let e="".concat(s,"|").concat(null!=u?u:"-","|");for(let t of o.current)t.startsWith(e)&&o.current.delete(t);return}if(!a.current.enabled)return;let m=(0,l.dS)(s,u,f);o.current.has(m)||(o.current.size>=500&&o.current.clear(),o.current.add(m),function(){let e=d();if(e)try{var t,a;"suspended"===e.state&&c(null==(t=e.resume)?void 0:t.call(e));let n=null!=(a=e.currentTime)?a:0;for(let t of i){let a=e.createOscillator(),s=e.createGain();a.type="sine",a.frequency.value=t.frequency;let r=n+t.offset,l=r+t.duration;s.gain.setValueAtTime(0,r),s.gain.linearRampToValueAtTime(.12,r+.015),s.gain.linearRampToValueAtTime(1e-4,l),a.connect(s),s.connect(e.destination),a.start(r),a.stop(l+.02)}}catch(e){return!1}}())}),[e]),null}}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7177],{13673:()=>{},25772:(e,t,r)=>{"use strict";r.d(t,{AppProviders:()=>E});var n=r(95155),s=r(3809),a=r(5379),o=r(32916),i=r(65380),l=r(22592),c=r(92614),d=r(70628),u=r(66966),m=r(89275),f=r(60199),h=r(36402),x=r(63470),b=r(40823),p=r(58165),g=r(94442),v=r(72604),y=r(95275),w=r(79832),j=r(12115),N=r(18955),k=r(89559),C=r(59854),M=r(77016);function S(){let e=(0,N.c)("pwa"),[t,r]=(0,j.useState)(null),s=(0,j.useRef)(!1),a=(0,M.W)();return((0,j.useEffect)(()=>{if("undefined"==typeof navigator||!("serviceWorker"in navigator))return;let e=!1,t=t=>{e||r(t)};navigator.serviceWorker.register("/sw.js").then(e=>{e.waiting&&navigator.serviceWorker.controller&&t(e.waiting),e.addEventListener("updatefound",()=>{let r=e.installing;r&&r.addEventListener("statechange",()=>{"installed"===r.state&&navigator.serviceWorker.controller&&t(r)})})}).catch(()=>{});let n=()=>{s.current||(s.current=!0,window.location.reload())};return navigator.serviceWorker.addEventListener("controllerchange",n),()=>{e=!0,navigator.serviceWorker.removeEventListener("controllerchange",n)}},[]),!t||a)?null:(0,n.jsx)("div",{"data-testid":"pwa-update-toast",role:"status","aria-live":"polite",className:"pointer-events-none fixed bottom-0 right-0 flex max-w-full justify-end px-4 pb-safe",style:{zIndex:C.M.TOAST},children:(0,n.jsxs)("div",{"data-testid":"pwa-update-toast-card",className:"pointer-events-auto mb-4 flex items-center gap-3 rounded-lg border border-border bg-surface px-4 py-3 shadow-lg",children:[(0,n.jsx)("span",{className:"text-sm font-medium text-foreground",children:e("update.available")}),(0,n.jsxs)("button",{type:"button",onClick:()=>{t.postMessage({type:"SKIP_WAITING"})},className:"inline-flex items-center gap-1.5 rounded-md bg-accent-600 px-3 py-1.5 text-sm font-medium text-white transition-colors hover:bg-accent-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 ring-offset-background dark:bg-accent-500 dark:hover:bg-accent-600",children:[(0,n.jsx)(k.A,{className:"h-4 w-4"}),e("update.reload")]})]})})}function E(e){let{children:t,locale:r,messages:j,timeZone:N,authEnabled:k=!1}=e;return(0,n.jsx)(s.default,{locale:r,messages:j,timeZone:N,children:(0,n.jsx)(g.tE,{children:(0,n.jsx)(a.N,{attribute:"class",defaultTheme:"system",enableSystem:!0,children:(0,n.jsx)(i.O,{authEnabled:k,children:(0,n.jsx)(l.W5,{children:(0,n.jsx)(o.GB,{children:(0,n.jsx)(f.tS,{children:(0,n.jsxs)(u.g7,{children:[(0,n.jsx)(v.rM,{}),(0,n.jsx)(w.o,{}),(0,n.jsx)(y.H,{}),(0,n.jsx)(c.E,{children:(0,n.jsx)(d.S,{children:(0,n.jsx)(h.aF,{children:(0,n.jsx)(x.y2,{children:(0,n.jsxs)(b.NS,{children:[(0,n.jsx)(m.Bo,{children:t}),(0,n.jsx)(S,{}),(0,n.jsx)(p.gZ,{})]})})})})})]})})})})})})})})}},38218:(e,t,r)=>{"use strict";r.d(t,{D:()=>a,a:()=>o});var n=r(12115);let s=n.useLayoutEffect,a=768;function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{breakpoint:t=a}=e,[r,o]=(0,n.useState)(!1);return s(()=>{let e=window.matchMedia("(max-width: ".concat(t-1,"px)"));o(e.matches);let r=e=>{o(e.matches)};return e.addEventListener("change",r),()=>{e.removeEventListener("change",r)}},[t]),r}},62295:(e,t,r)=>{"use strict";r.d(t,{AppShellGate:()=>to});var n=r(95155),s=r(20063),a=r(12115),o=r(32916),i=r(38218);let l={showSidebar:!0,showGlobalNav:!0,showLocalNav:!1,autoCollapseSidebar:!1},c=[{prefix:"/worktrees/",config:{showGlobalNav:!1,showLocalNav:!0}},{prefix:"/sessions",config:{autoCollapseSidebar:!0}}];var d=r(22592),u=r(52619),m=r.n(u),f=r(89275);let h=(0,a.forwardRef)(function(e,t){let{href:r,onClick:a,target:o,...i}=e,l=(0,s.usePathname)(),c=(0,f.Hq)();return(0,n.jsx)(m(),{ref:t,href:r,target:o,onClick:e=>{var t;null==a||a(e),e.defaultPrevented||0!==(t=e).button||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||void 0!==o&&"_self"!==o||/^([a-z][a-z0-9+.-]*:)?\/\//i.test(r)||/^(mailto:|tel:)/i.test(r)||(e.preventDefault(),r!==l&&c.push(r))},...i})});var x=r(18955),b=r(85710),p=r(66685),g=r(61362),v=r(15870),y=r(17787),w=r(49027),j=r(27587),N=r(39649),k=r(47650),C=r(38606),M=r(76471);function S(e,t,r){let n=r-8-t;return n<=8?8:Math.min(Math.max(e,8),n)}function E(e){let{id:t,branch:r,isVisible:s,anchorRef:o,nextActionLabel:i,unclassified:l}=e,[c,d]=(0,a.useState)({top:-9999,left:-9999}),u=(0,a.useRef)(null);if((0,a.useEffect)(()=>{var e,t,r;if(!s||!o.current)return;let n=o.current.getBoundingClientRect(),a=null==(e=u.current)?void 0:e.getBoundingClientRect(),i=null!=(t=null==a?void 0:a.width)?t:0,l=null!=(r=null==a?void 0:a.height)?r:0,c=window.innerWidth,m=window.innerHeight,f=n.right+8;if(f+i>c-8){let e=n.left-8-i;e>=8&&(f=e)}d({top:S(n.top,l,m),left:S(f,i,c)})},[s,o]),"undefined"==typeof document||!s)return null;let m=Math.min(384,Math.max(0,window.innerWidth-16));return k.createPortal((0,n.jsxs)("div",{ref:u,id:t,role:"tooltip",className:" fixed z-[9999] px-3 py-2 rounded-md shadow-lg bg-sidebar text-xs text-sidebar-foreground border border-sidebar-border pointer-events-none max-w-sm transition-opacity duration-150 ",style:{top:c.top,left:c.left,maxWidth:m},children:[(0,n.jsx)("p",{className:"font-medium text-sidebar-foreground whitespace-nowrap",children:r.name}),(0,n.jsx)("p",{className:"text-sidebar-muted whitespace-nowrap",children:r.repositoryName}),(0,n.jsxs)("p",{className:"text-sidebar-muted whitespace-nowrap",children:["Status: ",l?C.pu:r.status]}),r.worktreePath&&(0,n.jsx)("p",{className:"text-sidebar-muted truncate",children:r.worktreePath}),i&&(0,n.jsxs)("p",{className:"text-sidebar-muted whitespace-nowrap",children:["Next: ",i]}),r.description&&(0,n.jsx)("p",{className:"text-sidebar-muted mt-1 border-t border-sidebar-border pt-1 whitespace-pre-wrap break-words",children:r.description})]}),document.body)}let A=0,L=(0,a.memo)(function(e){let{branch:t,isSelected:r,onClick:s,showRepositoryName:o=!0}=e,i=(0,x.c)("common"),l=(0,x.c)("worktree"),c="tooltip-".concat(t.id),d=(0,a.useRef)(null),[u,m]=(0,a.useState)(!1),f=(0,a.useRef)(null),h=(0,a.useCallback)(()=>{null!==f.current&&(clearTimeout(f.current),f.current=null)},[]);(0,a.useEffect)(()=>()=>h(),[h]);let b=(0,C.A7)(t.cliStatus),p="waiting"===b,g=!0===t.awaitingInstruction,v=t.nextActionKey?l(t.nextActionKey):null,y=(0,a.useMemo)(()=>{var e;return new Set(null!=(e=t.exitedInstanceIds)?e:[])},[t.exitedInstanceIds]),w=(0,a.useMemo)(()=>{var e;return new Set(null!=(e=t.unclassifiedInstanceIds)?e:[])},[t.unclassifiedInstanceIds]),j=(0,C.Pn)(t.cliStatus,t.unclassifiedInstanceIds),N=(p||g)&&null!==v,k=u&&!r;return(0,a.useEffect)(()=>{r&&m(!1)},[r]),(0,a.useEffect)(()=>{if(!u)return;let e=()=>m(!1);return document.addEventListener("click",e),()=>document.removeEventListener("click",e)},[u]),(0,n.jsxs)("button",{ref:d,"data-testid":"branch-list-item",onClick:()=>{h(),A=Date.now()+400,m(!1),s()},onMouseEnter:()=>{h(),Date.now()>=A&&(f.current=setTimeout(()=>{m(!0)},150))},onMouseLeave:()=>{h(),m(!1)},onFocus:e=>{h(),e.target.matches(":focus-visible")&&(f.current=setTimeout(()=>{m(!0)},150))},onBlur:()=>{h(),m(!1)},"aria-current":r?"true":void 0,"aria-describedby":k?c:void 0,"aria-label":o?void 0:"".concat(t.name," - ").concat(t.repositoryName),className:"\n group relative w-full px-4 py-3 flex flex-col gap-1\n hover:bg-sidebar-hover transition-colors\n focus:outline-none focus:ring-2 focus:ring-inset focus:ring-ring\n ".concat(r?"bg-sidebar-hover border-l-2 border-accent-500":"border-l-2 border-transparent","\n "),children:[(0,n.jsxs)("div",{className:"flex items-center gap-3 w-full",children:[t.cliStatus&&Object.keys(t.cliStatus).length>0&&(0,n.jsx)("div",{className:"flex items-center justify-center flex-shrink-0 w-4","aria-label":i("branchItem.cliToolStatus"),children:(0,n.jsx)(M.Ej,{status:b,label:(0,C.dw)(t.cliStatus,t.cliStatusLabels,y.size>0?e=>y.has(e)?i("branchItem.agentExited"):null:void 0,w),waitingKind:t.waitingKind,unclassified:j})}),(0,n.jsxs)("div",{className:"flex-1 min-w-0 text-left",children:[(0,n.jsx)("p",{className:"text-sm font-medium text-sidebar-foreground truncate",children:t.name}),o&&(0,n.jsx)("p",{className:"text-xs text-sidebar-muted truncate",children:t.repositoryName}),N&&(0,n.jsx)("p",{"data-testid":"branch-next-action",className:"text-xs font-medium truncate ".concat(p?"text-warning-foreground":"text-success-foreground"),children:v})]}),g&&(0,n.jsx)("span",{"data-testid":"awaiting-instruction-badge",className:"flex-shrink-0 rounded-full bg-success-subtle px-1.5 py-0.5 text-[10px] font-medium leading-4 text-success-foreground",title:l("awaitingInstruction.label"),children:l("awaitingInstruction.badge")}),t.hasUnread&&(0,n.jsx)("span",{"data-testid":"unread-indicator",className:"w-2 h-2 rounded-full bg-accent-500 flex-shrink-0","aria-label":i("branchItem.hasUnread")})]}),t.description&&(0,n.jsx)("div",{"data-testid":"branch-description",className:"pl-6 pr-2 mt-1 text-left",children:(0,n.jsx)("p",{className:"text-xs text-sidebar-muted line-clamp-2",children:t.description})}),(0,n.jsx)(E,{id:c,branch:t,isVisible:k,anchorRef:d,nextActionLabel:v,unclassified:j})]})});var K=r(24033),T=r(41898);function I(e,t,r){if(t<=0||r<=0)return 0;let n=e+t+8-r;return n>0?-Math.min(n,Math.max(0,e-8)):e<8?8-e:0}let R=(0,a.memo)(function(e){var t,r;let{sortKey:s,sortDirection:o,onSortKeyChange:i,onSortDirectionChange:l,options:c,defaultDirections:d,compact:u,showLabel:m=!1,directionLabels:f,tooltip:h,iconClassName:b="w-3 h-3"}=e,p=(0,x.c)("common"),[g,v]=(0,a.useState)(!1),y=(0,a.useRef)(null),w=(0,a.useRef)(null),j=(0,a.useRef)({x:0,y:0}),[N,k]=(0,a.useState)({x:0,y:0});(0,a.useEffect)(()=>{function e(e){y.current&&!y.current.contains(e.target)&&v(!1)}if(g)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[g]),(0,a.useEffect)(()=>{function e(e){"Escape"===e.key&&v(!1)}if(g)return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[g]),(0,a.useLayoutEffect)(()=>{let e=e=>{j.current=e,k(t=>t.x===e.x&&t.y===e.y?t:e)};if(!g)return void e({x:0,y:0});let t=w.current;if(!t)return;let r=t.getBoundingClientRect();e({x:I(r.left-j.current.x,r.width,window.innerWidth),y:I(r.top-j.current.y,r.height,window.innerHeight)})},[g]);let C=(0,a.useCallback)(()=>{v(e=>!e)},[]),M=(0,a.useCallback)(e=>{if(e===s)l("asc"===o?"desc":"asc");else{var t;i(e),l(null!=(t=null==d?void 0:d[e])?t:"asc")}v(!1)},[s,o,i,l,d]),S=(0,a.useCallback)(()=>{l("asc"===o?"desc":"asc")},[o,l]),E=(null==(t=c.find(e=>e.key===s))?void 0:t.label)||p("sort.label"),A=null==f||null==(r=f[s])?void 0:r[o],L=p("asc"===o?"sort.ascShort":"sort.descShort"),R=(0,n.jsx)("button",{type:"button",onClick:C,"aria-expanded":g,"aria-haspopup":"listbox","aria-label":p("sort.sortBy",{label:E}),className:m?"flex min-w-0 max-w-full items-center gap-1 rounded border border-sidebar-border px-2 py-1 text-xs text-sidebar-foreground hover:bg-sidebar-hover focus:outline-none focus:ring-2 focus:ring-ring transition-colors":"flex items-center gap-1 px-2 py-1 rounded text-xs text-sidebar-muted hover:text-sidebar-foreground hover:bg-sidebar-hover focus:outline-none focus:ring-2 focus:ring-ring transition-colors",children:m?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:"min-w-0 truncate",children:E}),(0,n.jsx)(K.A,{className:"h-3 w-3 flex-shrink-0","aria-hidden":"true"})]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(W,{className:b}),(0,n.jsx)("span",{className:u?"hidden":"hidden sm:inline",children:E})]})});return(0,n.jsxs)("div",{ref:y,className:m?"relative min-w-0":"relative","data-testid":"sort-selector-base",children:[(0,n.jsxs)("div",{className:m?"flex min-w-0 flex-wrap items-center gap-1":"flex items-center gap-1",children:[h?(0,n.jsx)(T.m_,{content:h,placement:"bottom",children:R}):R,(0,n.jsx)("button",{type:"button",onClick:S,"aria-label":null!=A?A:p("asc"===o?"sort.ascending":"sort.descending"),className:A?"min-w-0 max-w-full truncate rounded px-2 py-1 text-xs text-sidebar-muted hover:text-sidebar-foreground hover:bg-sidebar-hover focus:outline-none focus:ring-2 focus:ring-ring transition-colors":"p-1 rounded text-sidebar-muted hover:text-sidebar-foreground hover:bg-sidebar-hover focus:outline-none focus:ring-2 focus:ring-ring transition-colors",children:null!=A?A:"asc"===o?(0,n.jsx)(z,{className:b}):(0,n.jsx)(P,{className:b})})]}),g&&(0,n.jsx)("div",{ref:w,role:"listbox","aria-label":p("sort.options"),className:" absolute right-0 top-full mt-1 z-50 min-w-[140px] py-1 rounded-md shadow-lg bg-sidebar border border-sidebar-border ",style:0!==N.x||0!==N.y?{transform:"translate(".concat(N.x,"px, ").concat(N.y,"px)")}:void 0,children:c.map(e=>{var t,r;return(0,n.jsxs)("button",{type:"button",role:"option","aria-selected":s===e.key,onClick:()=>M(e.key),className:"\n w-full px-3 py-2 text-left text-sm whitespace-nowrap\n flex items-center justify-between gap-3\n hover:bg-sidebar-hover transition-colors\n ".concat(s===e.key?"text-accent-700 dark:text-accent-400":"text-sidebar-muted","\n "),children:[(0,n.jsx)("span",{children:e.label}),s===e.key&&(0,n.jsx)("span",{className:"text-xs",children:null!=(r=null==f||null==(t=f[e.key])?void 0:t[o])?r:L})]},e.key)})})]})});function W(e){let{className:t}=e;return(0,n.jsx)("svg",{className:t,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 4h13M3 8h9m-9 4h6m4 0l4-4m0 0l4 4m-4-4v12"})})}function z(e){let{className:t}=e;return(0,n.jsx)("svg",{className:t,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"})})}function P(e){let{className:t}=e;return(0,n.jsx)("svg",{className:t,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})}let B=[{key:"updatedAt",labelKey:"sort.updatedAt"},{key:"repositoryName",labelKey:"sort.repositoryName"},{key:"branchName",labelKey:"sort.branchName"},{key:"status",labelKey:"sort.status"}],D={updatedAt:"desc"},O=(0,a.memo)(function(){let{sortKey:e,sortDirection:t,setSortKey:r,setSortDirection:s}=(0,o.VF)(),i=(0,x.c)("common"),l=(0,a.useMemo)(()=>B.map(e=>{let{key:t,labelKey:r}=e;return{key:t,label:i(r)}}),[i]),c=(0,a.useMemo)(()=>({updatedAt:{asc:i("sort.direction.oldestFirst"),desc:i("sort.direction.newestFirst")},repositoryName:{asc:i("sort.direction.aToZ"),desc:i("sort.direction.zToA")},branchName:{asc:i("sort.direction.aToZ"),desc:i("sort.direction.zToA")},status:{asc:i("sort.direction.attentionFirst"),desc:i("sort.direction.attentionLast")}}),[i]);return(0,n.jsx)(R,{sortKey:e,sortDirection:t,onSortKeyChange:r,onSortDirectionChange:s,options:l,defaultDirections:D,showLabel:!0,directionLabels:c,iconClassName:"w-4 h-4"})});var F=r(48407),H=r(30061),V=r(45195),_=r(26020);function q(){let{currentLocale:e,switchLocale:t}=(0,V.g)(),r=(0,x.c)("common");return(0,n.jsx)("select",{value:e,onChange:e=>t(e.target.value),"data-testid":"locale-switcher","aria-label":r("language"),className:" w-full px-3 py-2 rounded-md bg-sidebar text-sidebar-foreground border border-sidebar-border focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent text-sm ",children:_.dI.map(e=>(0,n.jsx)("option",{value:e,children:_.vK[e]},e))})}var G=r(5379),J=r(59427),U=r(37494);function $(){let{theme:e,setTheme:t}=(0,G.D)(),[r,s]=(0,a.useState)(!1);if((0,a.useEffect)(()=>{s(!0)},[]),!r)return(0,n.jsx)("div",{"data-testid":"theme-toggle-placeholder",className:"w-8 h-8","aria-hidden":"true"});let o="dark"===e;return(0,n.jsx)("button",{"data-testid":"theme-toggle",onClick:()=>t(o?"light":"dark"),className:"p-1.5 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted transition-colors focus:outline-none focus:ring-2 focus:ring-ring","aria-label":o?"Switch to light mode":"Switch to dark mode",title:o?"Switch to light mode":"Switch to dark mode",children:o?(0,n.jsx)(J.A,{className:"w-5 h-5","data-testid":"theme-icon-sun"}):(0,n.jsx)(U.A,{className:"w-5 h-5","data-testid":"theme-icon-moon"})})}var X=r(65380);function Y(){let e=(0,x.c)("auth"),t=(0,X.H)(),[r,s]=(0,a.useState)(!1);if(!t)return null;async function o(){s(!0);try{await fetch("/api/auth/logout",{method:"POST"}),window.location.href="/login"}catch(e){window.location.href="/login"}}return(0,n.jsx)("button",{type:"button",onClick:o,disabled:r,"data-testid":"logout-button",className:" w-full px-3 py-2 text-sm text-left rounded-md text-muted-foreground hover:text-foreground hover:bg-muted focus:outline-none focus:ring-2 focus:ring-ring disabled:opacity-50 transition-colors ",children:r?"...":e("logout.button")})}var Z=r(94442),Q=r(44308),ee=r(24373),et=r(40823),er=r(80344),en=r(7636);function es(e){let{items:t,sortKey:r,sortDirection:n,viewMode:s,filterText:o}=e,i=(0,a.useMemo)(()=>{if(!o)return t;let e=o.toLowerCase();return t.filter(t=>t.name.toLowerCase().includes(e)||t.repositoryName.toLowerCase().includes(e))},[t,o]);return{sortedItems:(0,a.useMemo)(()=>(0,en.Xn)(i,r,n),[i,r,n]),groupedItems:(0,a.useMemo)(()=>"grouped"===s?(0,en._s)(i,r,n):[],[i,r,n,s])}}let ea="mcbd-sidebar-group-collapsed",eo="mcbd-sidebar-scroll-top",ei=0,el=(0,a.memo)(function(){var e,t,r;let i=(0,f.Hq)(),{worktrees:l,repositories:c,selectedWorktreeId:d,selectWorktree:u,refreshWorktrees:m,isLoading:h,error:v}=(0,N.$f)(),{closeMobileDrawer:j,sortKey:k,sortDirection:M,viewMode:S,setViewMode:E,repositoryOrder:A,setRepositoryOrder:K}=(0,o.VF)(),T=(0,x.c)("common"),I=null!=(e=(0,s.usePathname)())?e:"",{count:R}=(0,ee.Lv)(),[W,z]=(0,a.useState)(""),P=(0,a.useRef)(null),[B,D]=(0,a.useState)(()=>{try{let e=localStorage.getItem(ea);return e?function(e){try{let t=JSON.parse(e);if("object"!=typeof t||null===t||Array.isArray(t))return{};let r={},n=0;for(let[e,s]of Object.entries(t))if(!eu.has(e)&&"boolean"==typeof s){if(++n>100)break;r[e]=s}return r}catch(e){return{}}}(e):{}}catch(e){return{}}}),H=(0,a.useRef)(!1);(0,a.useEffect)(()=>{H.current||(H.current=!0,fetch("/api/sidebar/group-order").then(e=>e.json()).then(e=>{e.success&&Array.isArray(e.order)&&K(e.order)}).catch(()=>{}))},[K]);let V=(0,a.useMemo)(()=>(0,en.UZ)(c),[c]),_=(0,a.useMemo)(()=>(0,en.s6)(l,V),[l,V]),G=(0,a.useMemo)(()=>_.map(C.XK),[_]),J=(0,a.useDeferredValue)(G),U=(0,a.useRef)(null),X=(0,a.useRef)(null),[Z,et]=(0,a.useState)(0);(0,a.useEffect)(()=>()=>{null!==X.current&&clearTimeout(X.current)},[]);let er=(0,a.useCallback)(()=>{null!==X.current&&(clearTimeout(X.current),X.current=null),U.current=null},[]),el=(0,a.useMemo)(()=>{let e=U.current;return!e||0===e.items.length||Date.now()>=e.expiresAt?J:e.items},[J,Z]),em=(0,a.useRef)(el);(0,a.useLayoutEffect)(()=>{em.current=el;let e=U.current;e&&0===e.items.length&&J.length>0&&er()});let eb=(0,a.useCallback)(()=>{if(0===em.current.length)return;null!==X.current&&(clearTimeout(X.current),X.current=null);let e=U.current;if(e&&Date.now()<e.expiresAt){U.current={...e,expiresAt:1/0};return}U.current={items:em.current,expiresAt:1/0}},[]),ep=(0,a.useCallback)(()=>{U.current&&(U.current={...U.current,expiresAt:Date.now()+1e3},null!==X.current&&clearTimeout(X.current),X.current=setTimeout(()=>{er(),et(e=>e+1)},1e3))},[er]),{sortedItems:eg,groupedItems:ew}=es({items:el,sortKey:k,sortDirection:M,viewMode:S,filterText:W}),ej=(0,a.useMemo)(()=>"grouped"===S&&ew?W.trim()?ew:(0,en.BN)(ew,A):null,[S,ew,A,W]),eN="grouped"===S?ej:null,ek=(0,a.useMemo)(()=>"sessions"===S?(0,en.EY)((0,en.UB)(eg),k,M):[],[S,eg,k,M]);(0,a.useEffect)(()=>{try{localStorage.setItem(ea,JSON.stringify(B))}catch(e){}},[B]);let eC=(0,a.useCallback)(e=>{D(t=>({...t,[e]:!t[e]}))},[]),eM=(0,a.useCallback)(()=>{var e,t,r=null!=(t=null==(e=P.current)?void 0:e.scrollTop)?t:0;let n=Number.isFinite(r)&&r>0?r:0;ei=n;try{localStorage.setItem(eo,String(n))}catch(e){}},[]),eS=eg.length>0||(null!=(t=null==eN?void 0:eN.length)?t:0)>0||ek.length>0;(0,a.useEffect)(()=>{let e=P.current;if(!e)return;let t=window.requestAnimationFrame(()=>{e.scrollTop=function(){try{let e=localStorage.getItem(eo);if(!e)return ei=0,0;let t=Number(e);Number.isFinite(t)&&t>=0&&(ei=t)}catch(e){}return ei}()});return()=>{window.cancelAnimationFrame(t)}},[eS,S]);let eE=(0,a.useCallback)(e=>{eM(),u(e),i.push("/worktrees/".concat(e)),j()},[eM,u,i,j]),eA=(0,a.useCallback)(e=>{eM(),u(e.worktreeId),i.push((0,en.Ii)(e)),j()},[eM,u,i,j]),eL=(0,y.FR)((0,y.MS)(y.AN,{activationConstraint:{distance:8}})),eK=(0,a.useCallback)(e=>{let{active:t,over:r}=e;if(!r||t.id===r.id||!eN)return;let n=eN.map(e=>e.repositoryName),s=n.indexOf(String(t.id)),a=n.indexOf(String(r.id));if(-1===s||-1===a)return;let o=(0,w.be)(n,s,a);K(o),fetch("/api/sidebar/group-order",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({order:o})}).catch(()=>{K(n)})},[eN,K]),eT="grouped"===S?(null!=(r=null==eN?void 0:eN.length)?r:0)===0:"sessions"===S?0===ek.length:0===eg.length,eI=h&&0===l.length,eR=!eI&&!!v&&0===l.length,eW=(0,a.useCallback)(()=>{m()},[m]);return(0,n.jsxs)("nav",{"data-testid":"sidebar","aria-label":T("sidebar.branchNavigation"),className:"h-full flex flex-col bg-sidebar text-sidebar-foreground",role:"navigation",children:[(0,n.jsxs)("div",{"data-testid":"sidebar-header",className:"flex-shrink-0 space-y-2 border-b border-sidebar-border px-2 py-2",children:[(0,n.jsxs)("ul",{"data-testid":"sidebar-nav",className:"space-y-0.5",children:[(0,n.jsxs)("li",{className:"flex min-w-0 items-center gap-1",children:[(0,n.jsx)(ef,{href:"/repositories",icon:b.A,label:T("nav.repositories"),testId:"sidebar-nav-repositories",isActive:I.startsWith("/repositories"),onNavigate:j}),(0,n.jsx)(ev,{refreshWorktrees:m})]}),(0,n.jsx)("li",{className:"flex min-w-0",children:(0,n.jsx)(ef,{href:"/sessions",icon:p.A,label:T("nav.sessions"),testId:"sidebar-nav-sessions",isActive:I.startsWith("/sessions"),onNavigate:j})}),(0,n.jsx)("li",{className:"flex min-w-0",children:(0,n.jsx)(ef,{href:R>0?Q.ks:"/review",icon:g.A,label:T("nav.review"),testId:"sidebar-nav-review",isActive:I.startsWith("/review"),onNavigate:j,trailing:R>0?(0,n.jsx)("span",{"data-testid":"sidebar-nav-review-count",role:"status","aria-label":T("attention.badgeLabel",{count:R}),className:"flex-shrink-0 rounded-full bg-warning-subtle px-1.5 text-xs font-semibold leading-5 tabular-nums text-warning-foreground",children:R>99?"99+":R}):null})})]}),(0,n.jsxs)("div",{"data-testid":"sidebar-list-controls",className:"grid grid-cols-[auto_minmax(0,1fr)] items-center gap-x-2 gap-y-1.5 px-2",children:[(0,n.jsx)(eh,{viewMode:S,onChange:E}),(0,n.jsx)("span",{className:"whitespace-nowrap text-xs text-sidebar-muted",children:T("sort.label")}),(0,n.jsx)(O,{})]})]}),(0,n.jsx)("div",{className:"flex-shrink-0 px-4 py-3 border-b border-sidebar-border",children:(0,n.jsx)(F.pd,{type:"text",placeholder:T("sidebar.searchBranches"),value:W,onChange:e=>z(e.target.value),className:"bg-background shadow-none"})}),(0,n.jsx)("div",{ref:P,"data-testid":"branch-list",onScroll:eM,onMouseEnter:eb,onMouseLeave:ep,className:"flex-1 overflow-y-auto overflow-x-hidden",children:eI?(0,n.jsx)(ec,{label:T("sidebar.loadingBranches")}):eR?(0,n.jsxs)("div",{"data-testid":"branch-list-error",role:"alert",className:"px-4 py-8 text-center text-sidebar-muted",children:[(0,n.jsx)("p",{className:"text-sm",children:T("sidebar.branchesLoadFailed")}),(0,n.jsx)(F.$n,{type:"button",variant:"secondary",size:"sm",className:"mt-3","data-testid":"branch-list-retry",onClick:eW,children:T("sidebar.retryLoadBranches")})]}):eT?(0,n.jsx)("div",{className:"px-4 py-8 text-center text-sidebar-muted",children:T(W?"sidebar.noBranchesFound":"sidebar.noBranchesAvailable")}):"sessions"===S?ek.map(e=>(0,n.jsx)(ex,{row:e,isSelected:e.worktreeId===d,onClick:eA},e.key)):"grouped"===S&&eN?(0,n.jsx)(y.Mp,{sensors:eL,collisionDetection:y.fp,onDragEnd:eK,children:(0,n.jsx)(w.gB,{items:eN.map(e=>e.repositoryName),strategy:w._G,children:eN.map(e=>{let t=!B[e.repositoryName]||!!W.trim();return(0,n.jsx)(ed,{group:e,isExpanded:t,selectedWorktreeId:d,onToggle:()=>eC(e.repositoryName),onBranchClick:eE,isDragDisabled:!!W.trim()},e.repositoryName)})})}):eg.map(e=>(0,n.jsx)(L,{branch:e,isSelected:e.id===d,onClick:()=>eE(e.id)},e.id))}),(0,n.jsxs)("div",{className:"flex-shrink-0 px-4 py-3 border-t border-sidebar-border space-y-2",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(ey,{onNavigate:j}),(0,n.jsx)("div",{className:"flex-1 min-w-0",children:(0,n.jsx)(q,{})}),(0,n.jsx)($,{})]}),(0,n.jsx)(Y,{})]})]})}),ec=(0,a.memo)(function(e){let{label:t}=e;return(0,n.jsxs)("div",{"data-testid":"branch-list-skeleton",role:"status","aria-live":"polite",className:"px-4 py-3 space-y-3",children:[(0,n.jsx)("span",{className:"sr-only",children:t}),[0,1,2,3,4].map(e=>(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(F.EA,{className:"h-2 w-2 rounded-full"}),(0,n.jsx)(F.EA,{className:"h-3 flex-1"})]},e))]})});function ed(e){let{group:t,isExpanded:r,selectedWorktreeId:s,onToggle:a,onBranchClick:o,isDragDisabled:i}=e,{attributes:l,listeners:c,setNodeRef:d,setActivatorNodeRef:u,transform:m,transition:f,isDragging:h}=(0,w.gl)({id:t.repositoryName,disabled:i}),x={transform:j.Ks.Transform.toString(m),transition:f,opacity:h?.5:1};return(0,n.jsxs)("div",{ref:d,style:x,className:"w-full min-w-0",children:[(0,n.jsx)(em,{repositoryName:t.repositoryName,branchCount:t.branches.length,isExpanded:r,onClick:a,dragHandleRef:u,dragHandleListeners:i?void 0:c,dragHandleAttributes:i?void 0:l}),r&&t.branches.map(e=>(0,n.jsx)(L,{branch:e,isSelected:e.id===s,onClick:()=>o(e.id),showRepositoryName:!1},e.id))]})}let eu=new Set(["__proto__","constructor","prototype"]);function em(e){let{repositoryName:t,branchCount:r,isExpanded:s,onClick:a,dragHandleRef:o,dragHandleListeners:i,dragHandleAttributes:l}=e,c=(0,x.c)("common");return(0,n.jsxs)("div",{className:"flex items-center w-full",children:[i&&(0,n.jsx)("div",{ref:o,...i,...l,"aria-label":c("sidebar.dragToReorderGroup"),className:" flex-shrink-0 flex items-center justify-center w-6 h-full pl-2 cursor-grab active:cursor-grabbing text-sidebar-muted hover:text-sidebar-foreground transition-colors ",children:(0,n.jsx)(ep,{})}),(0,n.jsxs)("button",{"data-testid":"group-header",type:"button",onClick:a,"aria-expanded":s,className:" flex-1 min-w-0 flex items-center gap-2 px-2 py-2 text-xs font-semibold text-sidebar-muted uppercase tracking-wider focus:outline-none focus:ring-2 focus:ring-inset focus:ring-ring transition-colors ",children:[(0,n.jsx)(eb,{isExpanded:s}),(0,n.jsx)(F.nF,{color:(0,en.LV)(t)}),(0,n.jsx)(H.nR,{content:t,className:"flex-1 min-w-0 text-left truncate",children:t}),(0,n.jsx)("span",{className:"text-sidebar-muted font-normal tabular-nums pr-2",children:r})]})]})}function ef(e){let{href:t,icon:r,label:s,testId:a,isActive:o,onNavigate:i,trailing:l}=e;return(0,n.jsxs)(h,{href:t,"data-testid":a,"aria-current":o?"page":void 0,onClick:i,className:"flex min-w-0 flex-1 items-center gap-2 rounded-md px-2 py-1.5 text-sm transition-colors hover:bg-sidebar-hover hover:text-sidebar-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-ring ".concat(o?"bg-sidebar-hover font-medium text-sidebar-foreground":"text-sidebar-muted"),children:[(0,n.jsx)(r,{className:"h-4 w-4 flex-shrink-0","aria-hidden":"true"}),(0,n.jsx)("span",{className:"min-w-0 flex-1 truncate",children:s}),l]})}function eh(e){let{viewMode:t,onChange:r}=e,s=(0,x.c)("common"),o=(0,a.useId)();return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("label",{htmlFor:o,className:"whitespace-nowrap text-xs text-sidebar-muted",children:s("sidebar.viewLabel")}),(0,n.jsxs)("select",{id:o,"data-testid":"view-mode-select",value:t,onChange:e=>{let t=e.target.value;(0,en.$m)(t)&&r(t)},className:"w-full min-w-0 truncate rounded border border-sidebar-border bg-sidebar px-1.5 py-1 text-xs text-sidebar-foreground hover:bg-sidebar-hover focus:outline-none focus:ring-2 focus:ring-ring",children:[(0,n.jsx)("option",{value:"grouped",children:s("sidebar.viewMode.grouped")}),(0,n.jsx)("option",{value:"flat",children:s("sidebar.viewMode.flat")}),(0,n.jsx)("option",{value:"sessions",children:s("sidebar.viewMode.sessions")})]})]})}let ex=(0,a.memo)(function(e){let{row:t,isSelected:r,onClick:s}=e,a=(0,x.c)("common"),o=(0,M.Mq)(t.status,t.unclassified),i=a(o?M.rH:"status.".concat(t.status));return(0,n.jsxs)("button",{type:"button","data-testid":"session-list-item","data-session-key":t.key,onClick:()=>s(t),"aria-current":r?"true":void 0,className:"w-full min-w-0 px-4 py-2 flex items-center gap-3 text-left hover:bg-sidebar-hover transition-colors focus:outline-none focus:ring-2 focus:ring-inset focus:ring-ring ".concat(r?"bg-sidebar-hover border-l-2 border-accent-500":"border-l-2 border-transparent"),children:[(0,n.jsx)(F.md,{status:t.status,size:"lg",label:t.exited?"".concat(i," (").concat(a("branchItem.agentExited"),")"):i,className:o?M.Jd:void 0}),(0,n.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,n.jsx)("span",{className:"block truncate text-sm font-semibold text-sidebar-foreground",children:t.label}),(0,n.jsxs)("span",{className:"block truncate text-xs text-sidebar-muted",children:[t.branchName," \xb7 ",t.repositoryName]})]})]})});function eb(e){let{isExpanded:t}=e;return(0,n.jsx)("svg",{className:"w-3 h-3 flex-shrink-0 transition-transform ".concat(t?"rotate-90":""),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})}function ep(){return(0,n.jsxs)("svg",{className:"w-3 h-3",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,n.jsx)("circle",{cx:"9",cy:"5",r:"1.5"}),(0,n.jsx)("circle",{cx:"15",cy:"5",r:"1.5"}),(0,n.jsx)("circle",{cx:"9",cy:"12",r:"1.5"}),(0,n.jsx)("circle",{cx:"15",cy:"12",r:"1.5"}),(0,n.jsx)("circle",{cx:"9",cy:"19",r:"1.5"}),(0,n.jsx)("circle",{cx:"15",cy:"19",r:"1.5"})]})}function eg(e){let{className:t=""}=e;return(0,n.jsx)("svg",{className:"".concat("w-4 h-4"," ").concat(t),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h5M20 20v-5h-5M20.49 9A9 9 0 005.64 5.64L4 4m16 16l-1.64-1.64A9 9 0 014.51 15"})})}let ev=(0,a.memo)(function(e){let{refreshWorktrees:t}=e,[r,s]=(0,a.useState)(!1),o=(0,a.useRef)(!1),{showToast:i}=(0,Z.dj)(),l=(0,x.c)("common"),c=(0,a.useCallback)(async()=>{if(!o.current){o.current=!0,s(!0);try{let e=await er.Rx.sync();await t(),i(l("syncSuccess",{count:e.worktreeCount}),"success",3e3)}catch(e){e instanceof er.hD&&401===e.status?i(l("syncAuthError"),"error",5e3):i(l("syncError"),"error",5e3)}finally{o.current=!1,s(!1)}}},[t,i,l]);return(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(T.m_,{content:l("tooltips.sync"),placement:"bottom",children:(0,n.jsx)("button",{type:"button",onClick:c,disabled:r,"aria-label":l("syncButtonLabel"),className:"p-1 rounded-md text-sidebar-muted hover:text-sidebar-foreground hover:bg-sidebar-hover focus:outline-none focus:ring-2 focus:ring-ring disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:(0,n.jsx)(eg,{className:r?"animate-spin":""})})})})});function ey(e){let{onNavigate:t}=e,r=(0,x.c)("common"),s=(0,i.a)(),{open:o}=(0,et.V0)(),l=r("settings.title"),c=(0,a.useCallback)(e=>{t(),!s&&(0!==e.button||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),o()))},[s,t,o]);return(0,n.jsx)(T.m_,{content:l,placement:"top",className:"flex-shrink-0",children:(0,n.jsx)(h,{href:"/more","data-testid":"sidebar-settings","aria-label":l,"aria-haspopup":s?void 0:"dialog",onClick:c,className:"p-1.5 rounded-md text-sidebar-muted hover:text-sidebar-foreground hover:bg-sidebar-hover focus:outline-none focus:ring-2 focus:ring-ring transition-colors",children:(0,n.jsx)(v.A,{size:20,"aria-hidden":"true"})})})}var ew=r(59847),ej=r(86651),eN=r(94684),ek=r(34681);function eC(){let e=(0,o.pT)(),t=(0,x.c)("common");if(!e)return null;let{repoTabBarMode:r,setRepoTabBarMode:s}=e;return(0,n.jsxs)("div",{className:"hidden md:flex items-center",children:[(0,n.jsx)("label",{htmlFor:"repo-tab-bar-mode",className:"sr-only",children:t("repoTabBar.settingLabel")}),(0,n.jsx)("select",{id:"repo-tab-bar-mode","data-testid":"repo-tab-bar-mode-select","aria-label":t("repoTabBar.settingLabel"),title:t("repoTabBar.settingLabel"),value:r,onChange:e=>{let t=e.target.value;(0,en.m3)(t)&&s(t)},className:"rounded-md border border-border bg-surface px-2 py-1 text-sm text-muted-foreground transition-colors hover:text-foreground focus:outline-none focus:ring-2 focus:ring-ring",children:en.EN.map(e=>(0,n.jsx)("option",{value:e,children:t("repoTabBar.mode.".concat(e))},e))})]})}var eM=r(52407);function eS(){let{shouldSurface:e,isReconnecting:t}=(0,eM.Fx)(),r=(0,x.c)("common");if(!e)return null;let s=r(t?"connection.reconnecting":"connection.offline");return(0,n.jsxs)("span",{"data-testid":"connection-status-indicator","data-connection-state":t?"reconnecting":"offline",role:"status","aria-live":"polite",title:r(t?"connection.reconnectingTooltip":"connection.offlineTooltip"),className:"hidden sm:inline-flex items-center gap-1.5 rounded-full border border-border bg-surface px-2 py-0.5 text-xs text-muted-foreground",children:[(0,n.jsx)("span",{"aria-hidden":"true",className:["w-1.5 h-1.5 rounded-full",t?"bg-warning motion-safe:animate-pulse":"bg-muted-foreground"].join(" ")}),s]})}var eE=r(72137),eA=r(79651),eL=r(92614);let eK=[{labelKey:"nav.sessions",href:"/sessions",isActive:e=>e.startsWith("/sessions")},{labelKey:"nav.repositoriesShort",href:"/repositories",isActive:e=>e.startsWith("/repositories")},{labelKey:"nav.reviewReport",href:"/review",isActive:e=>e.startsWith("/review")},{labelKey:"nav.more",href:"/more",isActive:e=>e.startsWith("/more"),opensSettings:!0}];function eT(e){let{title:t="CommandMate"}=e,r=(0,s.usePathname)(),o=(0,x.c)("commandPalette"),i=(0,x.c)("common"),{setOpen:l}=(0,eL.C)(),[c,d]=a.useState(null);a.useEffect(()=>{d("undefined"!=typeof navigator&&/Mac|iPhone|iPad|iPod/i.test(navigator.platform||"")?"⌘":"Ctrl")},[]);let{open:u}=(0,et.V0)(),m=a.useCallback(e=>{0!==e.button||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),u())},[u]);return(0,n.jsx)("header",{className:"sticky top-0 z-50 border-b border-border bg-background supports-[backdrop-filter]:bg-background/80 backdrop-blur-md",children:(0,n.jsx)("div",{className:"container-custom",children:(0,n.jsxs)("div",{className:"flex items-center justify-between h-16",children:[(0,n.jsx)("div",{className:"flex items-center space-x-4",children:(0,n.jsxs)(h,{href:"/",className:"flex items-center space-x-2 hover:opacity-80 transition-opacity",children:[(0,n.jsx)("div",{className:"w-8 h-8 bg-accent-600 rounded-lg flex items-center justify-center",children:(0,n.jsx)(ew.A,{size:20,strokeWidth:2,className:"text-white","aria-hidden":"true"})}),(0,n.jsx)("h1",{className:"text-xl font-bold text-foreground",children:t})]})}),(0,n.jsxs)("nav",{className:"flex items-center space-x-6",role:"navigation",children:[eK.map(e=>{let t=e.isActive(r);return(0,n.jsx)(h,{href:e.href,"aria-current":t?"page":void 0,"aria-haspopup":e.opensSettings?"dialog":void 0,onClick:e.opensSettings?m:void 0,className:"relative py-1 text-sm font-medium transition-colors after:absolute after:inset-x-0 after:bottom-0 after:h-0.5 after:rounded-full after:bg-accent-600 dark:after:bg-accent-400 after:origin-center motion-safe:after:transition-transform after:duration-200 after:ease-[var(--motion-ease-out)] ".concat(t?"text-accent-600 dark:text-accent-400 after:scale-x-100":"text-muted-foreground hover:text-foreground after:scale-x-0"),children:i(e.labelKey)},e.href)}),(0,n.jsxs)("button",{type:"button","data-testid":"header-command-palette-trigger",onClick:()=>l(!0),"aria-label":o("mobileTrigger"),className:"hidden md:inline-flex items-center gap-2 rounded-md border border-border bg-surface px-2.5 py-1.5 text-sm text-muted-foreground hover:bg-surface-2 transition-colors",children:[(0,n.jsx)(ej.A,{size:16,strokeWidth:2,"aria-hidden":"true",className:"shrink-0"}),(0,n.jsx)("span",{children:o("searchAction")}),c&&(0,n.jsxs)("span",{className:"flex items-center gap-0.5",children:[(0,n.jsx)(eA.u,{children:c}),(0,n.jsx)(eA.u,{children:"K"})]})]}),(0,n.jsx)(eS,{}),(0,n.jsx)(ek.g,{}),(0,n.jsx)(eC,{}),(0,n.jsx)(eE.H,{}),(0,n.jsx)($,{}),(0,n.jsxs)("a",{href:"https://github.com/kewton/MyCodeBranchDesk",target:"_blank",rel:"noopener noreferrer",className:"text-sm font-medium text-muted-foreground hover:text-foreground transition-colors flex items-center space-x-1",children:[(0,n.jsx)(eN.A,{size:20,strokeWidth:2,"aria-hidden":"true"}),(0,n.jsx)("span",{children:"GitHub"})]})]})]})})})}var eI=r(37772),eR=r(17848),eW=r(48481),ez=r(46892),eP=r(59854);let eB=/^\/worktrees\/([^/]+)/;function eD(e,t,r){let n=r-8-t;return n<=8?8:Math.min(Math.max(e.left+t>r-8?e.right-t:e.left,8),n)}function eO(e){var t;null==e||null==(t=e.scrollIntoView)||t.call(e,{block:"nearest",inline:"nearest"})}let eF=(0,a.memo)(function(){var e;let t=(0,x.c)("common"),r=(0,s.usePathname)(),i=(0,f.Hq)(),{sortKey:l,sortDirection:c,repositoryOrder:u}=(0,o.VF)(),{worktrees:m,repositories:h,selectedWorktreeId:b,selectWorktree:p}=(0,N.$f)(),{factor:g}=(0,d.Ps)(),v=(0,a.useMemo)(()=>(0,en.UZ)(null!=h?h:[]),[h]),y=(0,a.useMemo)(()=>(0,en.s6)(null!=m?m:[],v),[m,v]),{groupedItems:w}=es({items:(0,a.useMemo)(()=>y.map(C.XK),[y]),sortKey:l,sortDirection:c,viewMode:"grouped"}),j=(0,a.useMemo)(()=>(0,en.BN)(w,u),[w,u]),k=function(e,t){let r=eB.exec(e);if(!r)return t;try{return decodeURIComponent(r[1])}catch(e){return r[1]}}(r,b),M=(0,a.useMemo)(()=>{var e,t;return null!=(t=null==(e=j.find(e=>e.branches.some(e=>e.id===k)))?void 0:e.repositoryName)?t:null},[j,k]),[S,E]=(0,a.useState)(null),[A,L]=(0,a.useState)(null),[K,T]=(0,a.useState)(!1),I=(0,a.useRef)(null),R=(0,a.useRef)(null),W=(0,a.useRef)(new Map),z=(0,a.useCallback)((e,t)=>{t?W.current.set(e,t):W.current.delete(e)},[]),P=(0,a.useCallback)(()=>{E(null),L(null),T(!1)},[]),B=(0,a.useCallback)(e=>{let t=W.current.get(e);if(!t)return;let r=t.getBoundingClientRect();L({left:r.left,right:r.right,bottom:r.bottom}),E(e),T(!1)},[]),D=(0,a.useCallback)(e=>{if(S===e)return void P();B(e)},[S,P,B]),[O,F]=(0,a.useState)(!1),H=(0,a.useCallback)(()=>{let e=I.current;e&&F(e.scrollWidth>e.clientWidth+1)},[]);(0,a.useLayoutEffect)(()=>{H()},[H,j.length,g]),(0,a.useEffect)(()=>{window.addEventListener("resize",H);let e="undefined"!=typeof ResizeObserver?new ResizeObserver(()=>H()):null;return e&&I.current&&e.observe(I.current),()=>{window.removeEventListener("resize",H),null==e||e.disconnect()}},[H]);let V=null!==S||K;(0,a.useEffect)(()=>{if(!V)return;let e=e=>{var t,r,n;let s=e.target;!(!s||(null==(t=I.current)?void 0:t.contains(s))||(null==(r=R.current)?void 0:r.contains(s)))&&((null==(n=s.closest)?void 0:n.call(s,"[data-repository-tab-panel]"))||P())},t=e=>{if("Escape"!==e.key)return;let t=S?W.current.get(S):R.current;P(),null==t||t.focus()};return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)}},[V,S,P]),(0,a.useEffect)(()=>{P()},[r,P]),(0,a.useLayoutEffect)(()=>{M&&eO(W.current.get(M))},[M,r,O]);let _=(0,a.useCallback)(e=>{P(),p(e),i.push("/worktrees/".concat(e))},[P,p,i]),q=(0,a.useCallback)(e=>{let t=W.current.get(e);eO(t),B(e),null==t||t.focus()},[B]),G=(0,a.useCallback)(e=>{var t;let r=e.currentTarget,n=(t=r.clientWidth,e.ctrlKey||e.shiftKey||Math.abs(e.deltaY)<=Math.abs(e.deltaX)?0:1===e.deltaMode?40*e.deltaY:2===e.deltaMode?e.deltaY*t:e.deltaY);0!==n&&(r.scrollLeft+=n)},[]);if(0===j.length)return null;let J=Math.round(32*g),U=null!=(e=j.find(e=>e.repositoryName===S))?e:null;return(0,n.jsxs)("div",{"data-testid":"repository-tab-bar",className:"relative flex-shrink-0 flex items-stretch border-b border-border bg-surface",style:{height:"".concat(J,"px")},children:[(0,n.jsx)("nav",{ref:I,"data-testid":"repository-tab-strip","aria-label":t("nav.repositories"),onWheel:G,className:"flex min-w-0 flex-1 flex-nowrap items-stretch overflow-x-auto overflow-y-hidden scrollbar-hide",children:j.map(e=>(0,n.jsx)(eH,{group:e,isActive:e.repositoryName===M,isOpen:e.repositoryName===S,registerTab:z,onToggle:D},e.repositoryName))}),O&&(0,n.jsx)("button",{ref:R,type:"button","data-testid":"repository-tab-overflow","aria-haspopup":"menu","aria-expanded":K,"aria-label":t("repoTabBar.overflow"),title:t("repoTabBar.overflow"),onClick:()=>{E(null),L(null),T(e=>!e)},className:"flex-shrink-0 flex items-center border-l border-border px-2 text-muted-foreground transition-colors hover:bg-surface-2 hover:text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",children:(0,n.jsx)(eI.A,{size:16,strokeWidth:2,"aria-hidden":"true"})}),U&&A&&(0,n.jsx)(eV,{group:U,anchor:A,factor:g,activeWorktreeId:k,onBranchClick:_}),K&&(0,n.jsx)(e_,{groups:j,anchorRef:R,activeRepositoryName:M,onSelect:q})]})}),eH=(0,a.memo)(function(e){let{group:t,isActive:r,isOpen:s,registerTab:a,onToggle:o}=e,i=(0,x.c)("common"),l=(0,en.zD)(t.branches),c=(0,M.Mq)(l,(0,en.El)(t.branches)),d=(0,en.j)(t.branches),u=i(c?M.rH:ez.PL[l].labelKey);return(0,n.jsxs)("button",{ref:e=>a(t.repositoryName,e),type:"button","data-testid":"repository-tab","data-repository":t.repositoryName,"aria-haspopup":"menu","aria-expanded":s,"aria-current":r?"true":void 0,title:"".concat(t.repositoryName," — ").concat(u),onClick:()=>o(t.repositoryName),onKeyDown:e=>{"ArrowDown"===e.key&&(e.preventDefault(),s||o(t.repositoryName))},className:"\n group/tab flex-shrink-0 flex max-w-[14rem] items-center gap-1.5 px-2.5\n border-b-2 text-xs font-medium transition-colors\n focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring\n ".concat(r?"border-accent-500 bg-surface-2 text-foreground":"border-transparent text-muted-foreground hover:bg-surface-2 hover:text-foreground","\n "),children:[(0,n.jsx)(eR.n,{className:"h-3.5 w-3.5",color:(0,en.LV)(t.repositoryName)}),(0,n.jsx)("span",{className:"min-w-0 truncate",children:t.repositoryName}),(0,n.jsx)(eW.m,{status:l,size:"sm",label:u,className:c?M.Jd:void 0,"data-testid":"repository-tab-status"}),d>0&&(0,n.jsx)("span",{"data-testid":"repository-tab-attention-count","aria-label":i("attention.badgeLabel",{count:d}),className:"flex-shrink-0 rounded-full bg-warning-subtle px-1.5 text-[10px] font-semibold leading-4 tabular-nums text-warning-foreground",children:d})]})});function eV(e){let{group:t,anchor:r,factor:s,activeWorktreeId:o,onBranchClick:i}=e,l=(0,x.c)("common"),c=(0,a.useRef)(null);if((0,a.useEffect)(()=>{var e;let t=null==(e=c.current)?void 0:e.querySelector("button");null==t||t.focus()},[t.repositoryName]),"undefined"==typeof document)return null;let d=Math.round(300*s),u=window.innerWidth;return k.createPortal((0,n.jsx)("div",{ref:c,"data-repository-tab-panel":"","data-testid":"repository-tab-popover","data-repository":t.repositoryName,role:"menu","aria-label":l("sidebar.branchNavigation"),className:"fixed rounded-md border border-sidebar-border bg-sidebar text-sidebar-foreground shadow-lg",style:{top:r.bottom+4,left:eD(r,d,u),width:d,zIndex:eP.M.POPOVER},children:(0,n.jsx)("div",{"data-testid":"repository-tab-popover-list",className:"overflow-y-auto overflow-x-hidden py-1",style:{maxHeight:"".concat(Math.round(520*s),"px")},children:0===t.branches.length?(0,n.jsx)("p",{className:"px-4 py-6 text-center text-sm text-sidebar-muted",children:l("sidebar.noBranchesAvailable")}):t.branches.map(e=>(0,n.jsx)(L,{branch:e,isSelected:e.id===o,onClick:()=>i(e.id),showRepositoryName:!1},e.id))})}),document.body)}function e_(e){var t;let{groups:r,anchorRef:s,activeRepositoryName:a,onSelect:o}=e,i=(0,x.c)("common"),l=null==(t=s.current)?void 0:t.getBoundingClientRect();if("undefined"==typeof document||!l)return null;let c=window.innerWidth;return k.createPortal((0,n.jsx)("div",{"data-repository-tab-panel":"","data-testid":"repository-tab-overflow-menu",role:"menu","aria-label":i("nav.repositories"),className:"fixed rounded-md border border-sidebar-border bg-sidebar text-sidebar-foreground shadow-lg",style:{top:l.bottom+4,left:eD({left:l.left,right:l.right,bottom:l.bottom},300,c),width:300,maxHeight:"".concat(520,"px"),zIndex:eP.M.POPOVER},children:(0,n.jsx)("div",{className:"overflow-y-auto py-1",style:{maxHeight:"inherit"},children:r.map(e=>{let t=(0,en.zD)(e.branches),r=(0,M.Mq)(t,(0,en.El)(e.branches));return(0,n.jsxs)("button",{type:"button",role:"menuitem","data-testid":"repository-tab-overflow-item","data-repository":e.repositoryName,"aria-current":e.repositoryName===a?"true":void 0,onClick:()=>o(e.repositoryName),className:"flex w-full items-center gap-2 px-3 py-2 text-left text-sm transition-colors hover:bg-sidebar-hover focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",children:[(0,n.jsx)(eR.n,{className:"h-3.5 w-3.5",color:(0,en.LV)(e.repositoryName)}),(0,n.jsx)("span",{className:"min-w-0 flex-1 truncate",children:e.repositoryName}),(0,n.jsx)(eW.m,{status:t,size:"sm",label:i(r?M.rH:ez.PL[t].labelKey),className:r?M.Jd:void 0}),(0,n.jsx)("span",{className:"tabular-nums text-xs text-sidebar-muted",children:e.branches.length})]},e.repositoryName)})})}),document.body)}var eq=r(9540);function eG(e){let{count:t}=e,r=(0,x.c)("common");return 0===t?null:(0,n.jsx)("span",{"data-testid":"attention-badge-bubble",role:"status","aria-label":r("attention.badgeLabel",{count:t}),className:"absolute -top-1.5 -right-2.5 min-w-[1.05rem] rounded-full bg-warning-foreground px-1 text-[0.625rem] font-bold leading-[1.05rem] text-warning-subtle tabular-nums text-center",children:t>99?"99+":t})}let eJ=[{labelKey:"nav.sessions",href:"/sessions",isActive:e=>e.startsWith("/sessions"),icon:(0,n.jsx)(p.A,{size:20,"aria-hidden":"true"})},{labelKey:"nav.review",href:"/review",isActive:e=>e.startsWith("/review"),icon:(0,n.jsx)(g.A,{size:20,"aria-hidden":"true"}),showsAttentionBadge:!0},{labelKey:"nav.more",href:"/more",isActive:e=>e.startsWith("/more"),icon:(0,n.jsx)(eI.A,{size:20,"aria-hidden":"true"})}];function eU(){let e=(0,s.usePathname)(),{setOpen:t}=(0,eL.C)(),r=(0,x.c)("commandPalette"),a=(0,x.c)("common"),{count:i}=(0,ee.Lv)(),l=(0,o.pT)();return(null==l?void 0:l.isMobileDrawerOpen)?null:(0,n.jsx)("nav",{"data-testid":"global-mobile-nav",className:"fixed bottom-0 left-0 right-0 z-50 border-t border-border bg-background supports-[backdrop-filter]:bg-background/80 backdrop-blur-md pb-safe",children:(0,n.jsxs)("div",{className:"flex items-center justify-around h-14",children:[l&&(0,n.jsxs)("button",{type:"button","data-testid":"mobile-nav-open-sidebar",onClick:l.openMobileDrawer,className:"flex flex-col items-center justify-center flex-1 h-full text-xs text-muted-foreground hover:text-foreground transition-colors",children:[(0,n.jsx)(eq.A,{size:20,"aria-hidden":"true"}),(0,n.jsx)("span",{className:"mt-1 whitespace-nowrap",children:a("sidebar.branches")})]}),eJ.map(t=>{let r=t.isActive(e),s=!0===t.showsAttentionBadge&&i>0;return(0,n.jsxs)(h,{href:s?Q.ks:t.href,className:"flex flex-col items-center justify-center flex-1 h-full text-xs transition-colors ".concat(r?"text-accent-600 dark:text-accent-400":"text-muted-foreground hover:text-foreground"),children:[(0,n.jsxs)("span",{className:"relative inline-flex",children:[t.icon,!0===t.showsAttentionBadge&&(0,n.jsx)(eG,{count:i})]}),(0,n.jsx)("span",{className:"mt-1 whitespace-nowrap",children:a(t.labelKey)})]},t.href)}),(0,n.jsxs)("button",{type:"button","data-testid":"mobile-command-palette-trigger",onClick:()=>t(!0),"aria-label":r("mobileTrigger"),className:"flex flex-col items-center justify-center flex-1 h-full text-xs text-muted-foreground hover:text-foreground transition-colors",children:[(0,n.jsx)(ej.A,{size:20,"aria-hidden":"true"}),(0,n.jsx)("span",{className:"mt-1 whitespace-nowrap",children:r("mobileLabel")})]})]})})}function e$(){let{shouldSurface:e,isReconnecting:t}=(0,eM.Fx)(),r=(0,x.c)("common");if(!e)return null;let s=r(t?"connection.reconnecting":"connection.offline"),a=r(t?"connection.reconnectingTooltip":"connection.offlineTooltip");return(0,n.jsx)("div",{"data-testid":"mobile-connection-banner","data-connection-state":t?"reconnecting":"offline",role:"status","aria-live":"polite",title:a,className:"shrink-0 pt-safe border-b ".concat(t?"bg-warning-subtle border-warning-border text-warning-foreground":"bg-danger-subtle border-danger-border text-danger-foreground"),children:(0,n.jsxs)("div",{className:"flex items-center justify-center gap-1.5 px-3 py-1 text-xs",children:[(0,n.jsx)("span",{"aria-hidden":"true",className:"w-1.5 h-1.5 rounded-full ".concat(t?"bg-warning motion-safe:animate-pulse":"bg-danger")}),s]})})}var eX=r(45573),eY=r(94465),eZ=r(70628);let eQ=["global","terminal","composer","editor"],e0=[{id:"commandPalette",keys:["MOD","K"],scope:"global"},{id:"keyboardHelp",keys:["?"],scope:"global"},{id:"closeOverlay",keys:["Esc"],scope:"global"},{id:"navigateList",keys:["↑","↓"],scope:"global"},{id:"terminalSearch",keys:["MOD","F"],scope:"terminal"},{id:"toggleSurfaceMode",keys:["MOD","Shift","M"],scope:"terminal"},{id:"sendMessage",keys:["↵"],scope:"composer"},{id:"composerNewline",keys:["Shift","↵"],scope:"composer"},{id:"editorIndent",keys:["Tab"],scope:"editor"},{id:"editorOutdent",keys:["Shift","Tab"],scope:"editor"},{id:"editorTabFocus",keys:["Ctrl","M"],scope:"editor"},{id:"editorSave",keys:["MOD","S"],scope:"editor"},{id:"editorFullscreen",keys:["MOD","Shift","F"],scope:"editor"}];function e1(){let{open:e,setOpen:t}=(0,eZ.K)(),{open:r}=(0,eL.C)(),s=(0,x.c)("keyboardShortcuts"),[o,i]=(0,a.useState)(!1);(0,a.useEffect)(()=>i(function(){if("undefined"==typeof navigator)return!1;let e=navigator.platform||navigator.userAgent||"";return/Mac|iPhone|iPad|iPod/.test(e)}()),[]);let l=(0,a.useRef)(e);(0,a.useEffect)(()=>{l.current=e},[e]);let c=(0,a.useRef)(r);(0,a.useEffect)(()=>{c.current=r},[r]),(0,a.useEffect)(()=>{function e(e){"?"!==e.key||e.isComposing||229===e.keyCode||(0,eX.tJ)(e.target)||c.current||l.current||(e.preventDefault(),t(!0))}return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t]);let d=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e0;return eQ.map(t=>({scope:t,shortcuts:e.filter(e=>e.scope===t)})).filter(e=>e.shortcuts.length>0)}();return(0,n.jsx)(eY.a,{isOpen:e,onClose:()=>t(!1),title:s("title"),size:"md",children:(0,n.jsx)("div",{"data-testid":"keyboard-shortcuts-overlay",className:"space-y-6",children:d.map(e=>{let{scope:t,shortcuts:r}=e;return(0,n.jsxs)("section",{"data-testid":"keyboard-shortcuts-scope-".concat(t),children:[(0,n.jsx)("h4",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:s("scopes.".concat(t))}),(0,n.jsx)("ul",{className:"divide-y divide-border",children:r.map(e=>(0,n.jsxs)("li",{"data-testid":"keyboard-shortcut-".concat(e.id),className:"flex items-center justify-between gap-4 py-2",children:[(0,n.jsx)("span",{className:"text-sm text-foreground",children:s("shortcuts.".concat(e.id))}),(0,n.jsx)("span",{className:"flex flex-shrink-0 items-center gap-1",children:e.keys.map((e,t)=>(0,n.jsx)(eA.u,{children:"MOD"===e?o?"⌘":"Ctrl":e},t))})]},e.id))})]},t)})})})}var e2=r(77016),e5=r(36809),e4=r(31166);let e3=/^v?\d+\.\d+\.\d+$/;function e9(e){return e.replace(/^v/,"").split(".").map(Number)}let e6="commandmate.lastSeenAppVersion";function e8(e){try{window.localStorage.setItem(e6,e)}catch(e){}}let e7=[{key:"added",labelKey:"whatsNew.added"},{key:"improved",labelKey:"whatsNew.improved"},{key:"fixed",labelKey:"whatsNew.fixed"}];function te(){let e=(0,x.c)("common"),t=(0,e5.Ym)(),[r,s]=(0,a.useState)(null),[o,i]=(0,a.useState)(!1);(0,a.useEffect)(()=>{let e,t="0.42.2";try{e=window.localStorage.getItem(e6)}catch(e){return}let r=function(e,t){if(!e3.test(t))return{kind:"none"};if(null===e||!e3.test(e))return{kind:"remember"};let r=function(e,t){let r=e9(e),n=e9(t),s=Math.max(r.length,n.length);for(let e=0;e<s;e++){let t=r[e]||0,s=n[e]||0;if(t>s)return 1;if(t<s)return -1}return 0}(t,e);return 0===r?{kind:"none"}:r<0?{kind:"remember"}:{kind:"show",from:e}}(e,t);if("none"===r.kind)return;if("remember"===r.kind)return void e8(t);let n=!1;return er.GQ.getReleaseNotes(r.from,t).then(e=>{n||(s({from:r.from,to:t,notes:e.notes}),i(!0))},()=>{}),()=>{n=!0}},[]);let l=(0,a.useCallback)(()=>{r&&e8(r.to),i(!1)},[r]);if(!r)return null;let c="ja"===t?"ja":"en";return(0,n.jsx)(eY.a,{isOpen:o,onClose:l,title:e("whatsNew.title",{from:r.from,to:r.to}),size:"md",children:(0,n.jsxs)("div",{className:"space-y-4","data-testid":"whats-new-dialog",children:[0===r.notes.length?(0,n.jsx)("p",{className:"text-sm text-foreground","data-testid":"whats-new-empty",children:e("whatsNew.empty")}):r.notes.map(t=>(0,n.jsxs)("section",{className:"space-y-3","data-testid":"whats-new-version-".concat(t.version),children:[(0,n.jsxs)("h4",{className:"text-sm font-semibold text-foreground",children:["v",t.version,(0,n.jsx)("span",{className:"ml-2 text-xs font-normal text-muted-foreground",children:t.date})]}),t.highlight&&(0,n.jsxs)("div",{"data-testid":"whats-new-highlight",children:[(0,n.jsx)("h5",{className:"text-xs font-medium text-muted-foreground",children:e("whatsNew.highlight")}),(0,n.jsx)("p",{className:"mt-1 text-sm text-foreground",children:t.highlight[c]})]}),e7.map(r=>{let{key:s,labelKey:a}=r;return t[s].length>0?(0,n.jsxs)("div",{"data-testid":"whats-new-".concat(s),children:[(0,n.jsx)("h5",{className:"text-xs font-medium text-muted-foreground",children:e(a)}),(0,n.jsx)("ul",{className:"mt-1 list-disc space-y-1 pl-5 text-sm text-foreground",children:t[s].map((e,t)=>(0,n.jsx)("li",{children:e[c]},t))})]},s):null})]},t.version)),(0,n.jsxs)("div",{className:"flex items-center justify-between gap-3 border-t border-border pt-3",children:[(0,n.jsx)("a",{href:"".concat("https://github.com/Kewton/CommandMate/releases/tag/v").concat(r.to),target:"_blank",rel:"noopener noreferrer",className:"text-sm text-accent-600 dark:text-accent-400 hover:underline","data-testid":"whats-new-release-link",children:e("whatsNew.releaseLink")}),(0,n.jsx)(e4.$,{type:"button",variant:"primary",size:"sm",onClick:l,"data-testid":"whats-new-close",children:e("whatsNew.close")})]})]})})}let tt="transform transition-transform duration-300 ease-out",tr=(0,a.memo)(function(e){let{children:t}=e,{isOpen:r,isMobileDrawerOpen:u,closeMobileDrawer:m,width:f,setWidth:h,repoTabBarMode:x}=(0,o.VF)(),b=(0,i.a)(),{showSidebar:p,showGlobalNav:g}=function(){var e=(0,s.usePathname)();for(let t of c)if(e.startsWith(t.prefix))return{...l,...t.config};return{...l}}(),{factor:v}=(0,d.Ps)(),y=Math.round(160*v),w=Math.round(480*v),j=Math.round(Math.min(w,Math.max(y,f*v))),N=(0,en.fs)(null!=x?x:en.PB,r),k=Math.round(32*v)+64*!!g,C=(0,a.useRef)(null),M=(0,a.useRef)(null),S=(0,a.useCallback)(e=>{h(Math.round(e/v))},[h,v]);return b?(0,n.jsxs)("div",{"data-testid":"app-shell",className:"h-screen flex flex-col",children:[(0,n.jsx)(e$,{}),u&&(0,n.jsx)("div",{"data-testid":"drawer-overlay",className:"fixed inset-0 bg-black/50 z-40",onClick:m,"aria-hidden":"true"}),p&&(0,n.jsx)("aside",{"data-testid":"sidebar-container",className:"\n fixed left-0 top-0 h-full w-72 z-50\n ".concat(tt,"\n ").concat(u?"translate-x-0":"-translate-x-full","\n "),role:"complementary",children:(0,n.jsx)(el,{})}),(0,n.jsx)("main",{className:"flex-1 min-h-0 overflow-hidden ".concat(g?"pb-nav-safe":""),role:"main","data-view-transition":"content",children:t}),g&&(0,n.jsx)(eU,{}),(0,n.jsx)(eX.xq,{}),(0,n.jsx)(e1,{}),(0,n.jsx)(e2.n,{}),(0,n.jsx)(te,{})]}):(0,n.jsxs)("div",{"data-testid":"app-shell",className:"h-screen flex flex-col",children:[N&&(0,n.jsx)(eF,{}),g&&(0,n.jsx)(eT,{}),(0,n.jsxs)("div",{className:"flex flex-1 min-h-0",children:[p&&(0,n.jsxs)("aside",{ref:C,"data-testid":"sidebar-container",className:"\n fixed left-0\n ".concat(g?"top-16 h-[calc(100vh-4rem)]":"top-0 h-full","\n border-r border-border\n ").concat(tt,"\n ").concat(r?"translate-x-0":"-translate-x-full","\n "),style:{width:"".concat(j,"px"),zIndex:eP.M.SIDEBAR,...N?{top:"".concat(k,"px"),height:"calc(100vh - ".concat(k,"px)")}:{}},role:"complementary","aria-hidden":!r,children:[(0,n.jsx)(el,{}),(0,n.jsx)(tn,{currentWidth:j,minWidth:y,maxWidth:w,sidebarRef:C,mainRef:M,onWidthChange:S})]}),(0,n.jsx)("main",{ref:M,className:"flex-1 min-w-0 h-full overflow-hidden transition-[padding] duration-300 ease-out",style:{paddingLeft:p&&r?"".concat(j,"px"):0},role:"main","data-view-transition":"content",children:t})]}),(0,n.jsx)(eX.xq,{}),(0,n.jsx)(e1,{}),(0,n.jsx)(e2.n,{}),(0,n.jsx)(te,{})]})});function tn(e){let{currentWidth:t,minWidth:r,maxWidth:s,sidebarRef:a,mainRef:o,onWidthChange:i}=e;return(0,n.jsx)("div",{"data-testid":"sidebar-resize-handle","aria-hidden":"true",onMouseDown:e=>{e.preventDefault();let n=e.clientX,l=t;o.current&&(o.current.style.transition="none");let c=e=>{l=Math.max(r,Math.min(s,t+(e.clientX-n))),a.current&&(a.current.style.width="".concat(l,"px")),o.current&&(o.current.style.paddingLeft="".concat(l,"px"))},d=()=>{document.body.style.cursor="",document.body.style.userSelect="",o.current&&(o.current.style.transition=""),document.removeEventListener("mousemove",c),document.removeEventListener("mouseup",d),i(l)};document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",c),document.addEventListener("mouseup",d)},className:"absolute top-0 right-0 w-1 h-full cursor-col-resize hover:bg-accent-500/40 transition-colors"})}let ts=["/login","/offline","/proxy"],ta=/^\/worktrees\/[^/]+\/(terminal|files)(\/|$)/;function to(e){var t;let{children:r}=e,a=(0,s.usePathname)();return(t=null!=a?a:"",ts.some(e=>t===e||t.startsWith("".concat(e,"/")))||ta.test(t)||0)?(0,n.jsx)(n.Fragment,{children:r}):(0,n.jsx)(tr,{children:r})}},76471:(e,t,r)=>{"use strict";r.d(t,{Ej:()=>d,Jd:()=>i,Mq:()=>c,rH:()=>l});var n=r(95155),s=r(12115),a=r(18955),o=r(48481);let i="bg-transparent border-2 border-muted-foreground",l="status.unknown";function c(e,t){return!0===t&&"ready"===e}let d=(0,s.memo)(function(e){let{status:t,label:r,waitingKind:s,unclassified:d}=e,u=(0,a.c)("common"),m=c(t,d);return(0,n.jsx)(o.m,{"data-testid":"status-indicator",status:t,label:m?null!=r?r:u(l):r,waitingKind:s,size:"lg",className:m?i:void 0,"data-unclassified":m?"true":void 0})})},77016:(e,t,r)=>{"use strict";r.d(t,{W:()=>g,n:()=>v});var n=r(95155),s=r(12115),a=r(18955),o=r(52056),i=r(89559),l=r(65229),c=r(59854),d=r(60199),u=r(52703);let m=0,f=new Set;function h(){for(let e of f)e()}function x(e){return f.add(e),()=>{f.delete(e)}}function b(){return m>0}function p(){return!1}function g(){return(0,s.useSyncExternalStore)(x,b,p)}function v(){let e=(0,a.c)("common"),[t,r]=(0,s.useState)(null),[f,x]=(0,s.useState)(null),b=(0,s.useCallback)(e=>{if(e.type!==u.Oo)return;let{serverVersion:t,clientVersion:n}=e;"string"==typeof t&&"string"==typeof n&&t&&n&&t!==f&&r({serverVersion:t,clientVersion:n})},[f]);(0,d.T3)(b);let p=null!==t;(0,s.useEffect)(()=>{if(p)return m+=1,h(),()=>{m-=1,h()}},[p]);let g=(0,s.useCallback)(()=>{window.location.reload()},[]),v=(0,s.useCallback)(()=>{r(e=>(e&&x(e.serverVersion),null))},[]);return t?(0,n.jsxs)("div",{"data-testid":"version-mismatch-banner",role:"alert","aria-live":"assertive",className:"fixed top-3 left-1/2 -translate-x-1/2 flex items-start gap-3 max-w-[92vw] rounded-lg border border-warning-border bg-warning-subtle px-4 py-3 text-warning-foreground shadow-lg",style:{zIndex:c.M.TOAST},children:[(0,n.jsx)(o.A,{className:"h-5 w-5 shrink-0 mt-0.5","aria-hidden":"true"}),(0,n.jsxs)("div",{className:"flex flex-col gap-0.5 text-sm",children:[(0,n.jsx)("span",{className:"font-semibold",children:e("versionMismatch.title")}),(0,n.jsx)("span",{children:e("versionMismatch.description",{serverVersion:t.serverVersion,clientVersion:t.clientVersion})})]}),(0,n.jsxs)("button",{type:"button","data-testid":"version-mismatch-reload",onClick:g,className:"shrink-0 inline-flex items-center gap-1.5 rounded-md border border-warning-border px-3 py-1.5 text-sm font-medium hover:opacity-80 focus:outline-none focus:ring-2 focus:ring-offset-2",children:[(0,n.jsx)(i.A,{className:"h-4 w-4","aria-hidden":"true"}),e("versionMismatch.reload")]}),(0,n.jsx)("button",{type:"button","data-testid":"version-mismatch-dismiss",onClick:v,"aria-label":e("versionMismatch.dismiss"),className:"shrink-0 hover:opacity-70 focus:outline-none focus:ring-2 focus:ring-offset-2",children:(0,n.jsx)(l.A,{className:"h-4 w-4","aria-hidden":"true"})})]}):null}},80903:(e,t,r)=>{Promise.resolve().then(r.t.bind(r,22311,23)),Promise.resolve().then(r.t.bind(r,7183,23)),Promise.resolve().then(r.t.bind(r,13673,23)),Promise.resolve().then(r.bind(r,62295)),Promise.resolve().then(r.bind(r,25772))}},e=>{e.O(0,[5373,2978,6809,4909,2770,2619,6192,8318,8407,2407,344,5449,6966,8606,4768,8165,9619,8441,1255,7358],()=>e(e.s=80903)),_N_E=e.O()}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7177],{13673:()=>{},25772:(e,t,r)=>{"use strict";r.d(t,{AppProviders:()=>E});var n=r(95155),s=r(3809),a=r(5379),o=r(32916),i=r(65380),l=r(22592),c=r(92614),d=r(70628),u=r(66966),m=r(89275),f=r(60199),h=r(36402),x=r(63470),b=r(40823),p=r(58165),g=r(94442),v=r(72604),y=r(95275),w=r(79832),j=r(12115),N=r(18955),k=r(89559),C=r(59854),M=r(77016);function S(){let e=(0,N.c)("pwa"),[t,r]=(0,j.useState)(null),s=(0,j.useRef)(!1),a=(0,M.W)();return((0,j.useEffect)(()=>{if("undefined"==typeof navigator||!("serviceWorker"in navigator))return;let e=!1,t=t=>{e||r(t)};navigator.serviceWorker.register("/sw.js").then(e=>{e.waiting&&navigator.serviceWorker.controller&&t(e.waiting),e.addEventListener("updatefound",()=>{let r=e.installing;r&&r.addEventListener("statechange",()=>{"installed"===r.state&&navigator.serviceWorker.controller&&t(r)})})}).catch(()=>{});let n=()=>{s.current||(s.current=!0,window.location.reload())};return navigator.serviceWorker.addEventListener("controllerchange",n),()=>{e=!0,navigator.serviceWorker.removeEventListener("controllerchange",n)}},[]),!t||a)?null:(0,n.jsx)("div",{"data-testid":"pwa-update-toast",role:"status","aria-live":"polite",className:"pointer-events-none fixed bottom-0 right-0 flex max-w-full justify-end px-4 pb-safe",style:{zIndex:C.M.TOAST},children:(0,n.jsxs)("div",{"data-testid":"pwa-update-toast-card",className:"pointer-events-auto mb-4 flex items-center gap-3 rounded-lg border border-border bg-surface px-4 py-3 shadow-lg",children:[(0,n.jsx)("span",{className:"text-sm font-medium text-foreground",children:e("update.available")}),(0,n.jsxs)("button",{type:"button",onClick:()=>{t.postMessage({type:"SKIP_WAITING"})},className:"inline-flex items-center gap-1.5 rounded-md bg-accent-600 px-3 py-1.5 text-sm font-medium text-white transition-colors hover:bg-accent-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 ring-offset-background dark:bg-accent-500 dark:hover:bg-accent-600",children:[(0,n.jsx)(k.A,{className:"h-4 w-4"}),e("update.reload")]})]})})}function E(e){let{children:t,locale:r,messages:j,timeZone:N,authEnabled:k=!1}=e;return(0,n.jsx)(s.default,{locale:r,messages:j,timeZone:N,children:(0,n.jsx)(g.tE,{children:(0,n.jsx)(a.N,{attribute:"class",defaultTheme:"system",enableSystem:!0,children:(0,n.jsx)(i.O,{authEnabled:k,children:(0,n.jsx)(l.W5,{children:(0,n.jsx)(o.GB,{children:(0,n.jsx)(f.tS,{children:(0,n.jsxs)(u.g7,{children:[(0,n.jsx)(v.rM,{}),(0,n.jsx)(w.o,{}),(0,n.jsx)(y.H,{}),(0,n.jsx)(c.E,{children:(0,n.jsx)(d.S,{children:(0,n.jsx)(h.aF,{children:(0,n.jsx)(x.y2,{children:(0,n.jsxs)(b.NS,{children:[(0,n.jsx)(m.Bo,{children:t}),(0,n.jsx)(S,{}),(0,n.jsx)(p.gZ,{})]})})})})})]})})})})})})})})}},38218:(e,t,r)=>{"use strict";r.d(t,{D:()=>a,a:()=>o});var n=r(12115);let s=n.useLayoutEffect,a=768;function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{breakpoint:t=a}=e,[r,o]=(0,n.useState)(!1);return s(()=>{let e=window.matchMedia("(max-width: ".concat(t-1,"px)"));o(e.matches);let r=e=>{o(e.matches)};return e.addEventListener("change",r),()=>{e.removeEventListener("change",r)}},[t]),r}},62295:(e,t,r)=>{"use strict";r.d(t,{AppShellGate:()=>to});var n=r(95155),s=r(20063),a=r(12115),o=r(32916),i=r(38218);let l={showSidebar:!0,showGlobalNav:!0,showLocalNav:!1,autoCollapseSidebar:!1},c=[{prefix:"/worktrees/",config:{showGlobalNav:!1,showLocalNav:!0}},{prefix:"/sessions",config:{autoCollapseSidebar:!0}}];var d=r(22592),u=r(52619),m=r.n(u),f=r(89275);let h=(0,a.forwardRef)(function(e,t){let{href:r,onClick:a,target:o,...i}=e,l=(0,s.usePathname)(),c=(0,f.Hq)();return(0,n.jsx)(m(),{ref:t,href:r,target:o,onClick:e=>{var t;null==a||a(e),e.defaultPrevented||0!==(t=e).button||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||void 0!==o&&"_self"!==o||/^([a-z][a-z0-9+.-]*:)?\/\//i.test(r)||/^(mailto:|tel:)/i.test(r)||(e.preventDefault(),r!==l&&c.push(r))},...i})});var x=r(18955),b=r(85710),p=r(66685),g=r(61362),v=r(15870),y=r(17787),w=r(49027),j=r(27587),N=r(39649),k=r(47650),C=r(38606),M=r(76471);function S(e,t,r){let n=r-8-t;return n<=8?8:Math.min(Math.max(e,8),n)}function E(e){let{id:t,branch:r,isVisible:s,anchorRef:o,nextActionLabel:i,unclassified:l}=e,[c,d]=(0,a.useState)({top:-9999,left:-9999}),u=(0,a.useRef)(null);if((0,a.useEffect)(()=>{var e,t,r;if(!s||!o.current)return;let n=o.current.getBoundingClientRect(),a=null==(e=u.current)?void 0:e.getBoundingClientRect(),i=null!=(t=null==a?void 0:a.width)?t:0,l=null!=(r=null==a?void 0:a.height)?r:0,c=window.innerWidth,m=window.innerHeight,f=n.right+8;if(f+i>c-8){let e=n.left-8-i;e>=8&&(f=e)}d({top:S(n.top,l,m),left:S(f,i,c)})},[s,o]),"undefined"==typeof document||!s)return null;let m=Math.min(384,Math.max(0,window.innerWidth-16));return k.createPortal((0,n.jsxs)("div",{ref:u,id:t,role:"tooltip",className:" fixed z-[9999] px-3 py-2 rounded-md shadow-lg bg-sidebar text-xs text-sidebar-foreground border border-sidebar-border pointer-events-none max-w-sm transition-opacity duration-150 ",style:{top:c.top,left:c.left,maxWidth:m},children:[(0,n.jsx)("p",{className:"font-medium text-sidebar-foreground whitespace-nowrap",children:r.name}),(0,n.jsx)("p",{className:"text-sidebar-muted whitespace-nowrap",children:r.repositoryName}),(0,n.jsxs)("p",{className:"text-sidebar-muted whitespace-nowrap",children:["Status: ",l?C.pu:r.status]}),r.worktreePath&&(0,n.jsx)("p",{className:"text-sidebar-muted truncate",children:r.worktreePath}),i&&(0,n.jsxs)("p",{className:"text-sidebar-muted whitespace-nowrap",children:["Next: ",i]}),r.description&&(0,n.jsx)("p",{className:"text-sidebar-muted mt-1 border-t border-sidebar-border pt-1 whitespace-pre-wrap break-words",children:r.description})]}),document.body)}let A=0,L=(0,a.memo)(function(e){let{branch:t,isSelected:r,onClick:s,showRepositoryName:o=!0}=e,i=(0,x.c)("common"),l=(0,x.c)("worktree"),c="tooltip-".concat(t.id),d=(0,a.useRef)(null),[u,m]=(0,a.useState)(!1),f=(0,a.useRef)(null),h=(0,a.useCallback)(()=>{null!==f.current&&(clearTimeout(f.current),f.current=null)},[]);(0,a.useEffect)(()=>()=>h(),[h]);let b=(0,C.A7)(t.cliStatus),p="waiting"===b,g=!0===t.awaitingInstruction,v=t.nextActionKey?l(t.nextActionKey):null,y=(0,a.useMemo)(()=>{var e;return new Set(null!=(e=t.exitedInstanceIds)?e:[])},[t.exitedInstanceIds]),w=(0,a.useMemo)(()=>{var e;return new Set(null!=(e=t.unclassifiedInstanceIds)?e:[])},[t.unclassifiedInstanceIds]),j=(0,C.Pn)(t.cliStatus,t.unclassifiedInstanceIds),N=(p||g)&&null!==v,k=u&&!r;return(0,a.useEffect)(()=>{r&&m(!1)},[r]),(0,a.useEffect)(()=>{if(!u)return;let e=()=>m(!1);return document.addEventListener("click",e),()=>document.removeEventListener("click",e)},[u]),(0,n.jsxs)("button",{ref:d,"data-testid":"branch-list-item",onClick:()=>{h(),A=Date.now()+400,m(!1),s()},onMouseEnter:()=>{h(),Date.now()>=A&&(f.current=setTimeout(()=>{m(!0)},150))},onMouseLeave:()=>{h(),m(!1)},onFocus:e=>{h(),e.target.matches(":focus-visible")&&(f.current=setTimeout(()=>{m(!0)},150))},onBlur:()=>{h(),m(!1)},"aria-current":r?"true":void 0,"aria-describedby":k?c:void 0,"aria-label":o?void 0:"".concat(t.name," - ").concat(t.repositoryName),className:"\n group relative w-full px-4 py-3 flex flex-col gap-1\n hover:bg-sidebar-hover transition-colors\n focus:outline-none focus:ring-2 focus:ring-inset focus:ring-ring\n ".concat(r?"bg-sidebar-hover border-l-2 border-accent-500":"border-l-2 border-transparent","\n "),children:[(0,n.jsxs)("div",{className:"flex items-center gap-3 w-full",children:[t.cliStatus&&Object.keys(t.cliStatus).length>0&&(0,n.jsx)("div",{className:"flex items-center justify-center flex-shrink-0 w-4","aria-label":i("branchItem.cliToolStatus"),children:(0,n.jsx)(M.Ej,{status:b,label:(0,C.dw)(t.cliStatus,t.cliStatusLabels,y.size>0?e=>y.has(e)?i("branchItem.agentExited"):null:void 0,w),waitingKind:t.waitingKind,unclassified:j})}),(0,n.jsxs)("div",{className:"flex-1 min-w-0 text-left",children:[(0,n.jsx)("p",{className:"text-sm font-medium text-sidebar-foreground truncate",children:t.name}),o&&(0,n.jsx)("p",{className:"text-xs text-sidebar-muted truncate",children:t.repositoryName}),N&&(0,n.jsx)("p",{"data-testid":"branch-next-action",className:"text-xs font-medium truncate ".concat(p?"text-warning-foreground":"text-success-foreground"),children:v})]}),g&&(0,n.jsx)("span",{"data-testid":"awaiting-instruction-badge",className:"flex-shrink-0 rounded-full bg-success-subtle px-1.5 py-0.5 text-[10px] font-medium leading-4 text-success-foreground",title:l("awaitingInstruction.label"),children:l("awaitingInstruction.badge")}),t.hasUnread&&(0,n.jsx)("span",{"data-testid":"unread-indicator",className:"w-2 h-2 rounded-full bg-accent-500 flex-shrink-0","aria-label":i("branchItem.hasUnread")})]}),t.description&&(0,n.jsx)("div",{"data-testid":"branch-description",className:"pl-6 pr-2 mt-1 text-left",children:(0,n.jsx)("p",{className:"text-xs text-sidebar-muted line-clamp-2",children:t.description})}),(0,n.jsx)(E,{id:c,branch:t,isVisible:k,anchorRef:d,nextActionLabel:v,unclassified:j})]})});var K=r(24033),T=r(41898);function I(e,t,r){if(t<=0||r<=0)return 0;let n=e+t+8-r;return n>0?-Math.min(n,Math.max(0,e-8)):e<8?8-e:0}let R=(0,a.memo)(function(e){var t,r;let{sortKey:s,sortDirection:o,onSortKeyChange:i,onSortDirectionChange:l,options:c,defaultDirections:d,compact:u,showLabel:m=!1,directionLabels:f,tooltip:h,iconClassName:b="w-3 h-3"}=e,p=(0,x.c)("common"),[g,v]=(0,a.useState)(!1),y=(0,a.useRef)(null),w=(0,a.useRef)(null),j=(0,a.useRef)({x:0,y:0}),[N,k]=(0,a.useState)({x:0,y:0});(0,a.useEffect)(()=>{function e(e){y.current&&!y.current.contains(e.target)&&v(!1)}if(g)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[g]),(0,a.useEffect)(()=>{function e(e){"Escape"===e.key&&v(!1)}if(g)return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[g]),(0,a.useLayoutEffect)(()=>{let e=e=>{j.current=e,k(t=>t.x===e.x&&t.y===e.y?t:e)};if(!g)return void e({x:0,y:0});let t=w.current;if(!t)return;let r=t.getBoundingClientRect();e({x:I(r.left-j.current.x,r.width,window.innerWidth),y:I(r.top-j.current.y,r.height,window.innerHeight)})},[g]);let C=(0,a.useCallback)(()=>{v(e=>!e)},[]),M=(0,a.useCallback)(e=>{if(e===s)l("asc"===o?"desc":"asc");else{var t;i(e),l(null!=(t=null==d?void 0:d[e])?t:"asc")}v(!1)},[s,o,i,l,d]),S=(0,a.useCallback)(()=>{l("asc"===o?"desc":"asc")},[o,l]),E=(null==(t=c.find(e=>e.key===s))?void 0:t.label)||p("sort.label"),A=null==f||null==(r=f[s])?void 0:r[o],L=p("asc"===o?"sort.ascShort":"sort.descShort"),R=(0,n.jsx)("button",{type:"button",onClick:C,"aria-expanded":g,"aria-haspopup":"listbox","aria-label":p("sort.sortBy",{label:E}),className:m?"flex min-w-0 max-w-full items-center gap-1 rounded border border-sidebar-border px-2 py-1 text-xs text-sidebar-foreground hover:bg-sidebar-hover focus:outline-none focus:ring-2 focus:ring-ring transition-colors":"flex items-center gap-1 px-2 py-1 rounded text-xs text-sidebar-muted hover:text-sidebar-foreground hover:bg-sidebar-hover focus:outline-none focus:ring-2 focus:ring-ring transition-colors",children:m?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:"min-w-0 truncate",children:E}),(0,n.jsx)(K.A,{className:"h-3 w-3 flex-shrink-0","aria-hidden":"true"})]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(W,{className:b}),(0,n.jsx)("span",{className:u?"hidden":"hidden sm:inline",children:E})]})});return(0,n.jsxs)("div",{ref:y,className:m?"relative min-w-0":"relative","data-testid":"sort-selector-base",children:[(0,n.jsxs)("div",{className:m?"flex min-w-0 flex-wrap items-center gap-1":"flex items-center gap-1",children:[h?(0,n.jsx)(T.m_,{content:h,placement:"bottom",children:R}):R,(0,n.jsx)("button",{type:"button",onClick:S,"aria-label":null!=A?A:p("asc"===o?"sort.ascending":"sort.descending"),className:A?"min-w-0 max-w-full truncate rounded px-2 py-1 text-xs text-sidebar-muted hover:text-sidebar-foreground hover:bg-sidebar-hover focus:outline-none focus:ring-2 focus:ring-ring transition-colors":"p-1 rounded text-sidebar-muted hover:text-sidebar-foreground hover:bg-sidebar-hover focus:outline-none focus:ring-2 focus:ring-ring transition-colors",children:null!=A?A:"asc"===o?(0,n.jsx)(z,{className:b}):(0,n.jsx)(P,{className:b})})]}),g&&(0,n.jsx)("div",{ref:w,role:"listbox","aria-label":p("sort.options"),className:" absolute right-0 top-full mt-1 z-50 min-w-[140px] py-1 rounded-md shadow-lg bg-sidebar border border-sidebar-border ",style:0!==N.x||0!==N.y?{transform:"translate(".concat(N.x,"px, ").concat(N.y,"px)")}:void 0,children:c.map(e=>{var t,r;return(0,n.jsxs)("button",{type:"button",role:"option","aria-selected":s===e.key,onClick:()=>M(e.key),className:"\n w-full px-3 py-2 text-left text-sm whitespace-nowrap\n flex items-center justify-between gap-3\n hover:bg-sidebar-hover transition-colors\n ".concat(s===e.key?"text-accent-700 dark:text-accent-400":"text-sidebar-muted","\n "),children:[(0,n.jsx)("span",{children:e.label}),s===e.key&&(0,n.jsx)("span",{className:"text-xs",children:null!=(r=null==f||null==(t=f[e.key])?void 0:t[o])?r:L})]},e.key)})})]})});function W(e){let{className:t}=e;return(0,n.jsx)("svg",{className:t,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 4h13M3 8h9m-9 4h6m4 0l4-4m0 0l4 4m-4-4v12"})})}function z(e){let{className:t}=e;return(0,n.jsx)("svg",{className:t,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"})})}function P(e){let{className:t}=e;return(0,n.jsx)("svg",{className:t,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})}let B=[{key:"updatedAt",labelKey:"sort.updatedAt"},{key:"repositoryName",labelKey:"sort.repositoryName"},{key:"branchName",labelKey:"sort.branchName"},{key:"status",labelKey:"sort.status"}],D={updatedAt:"desc"},O=(0,a.memo)(function(){let{sortKey:e,sortDirection:t,setSortKey:r,setSortDirection:s}=(0,o.VF)(),i=(0,x.c)("common"),l=(0,a.useMemo)(()=>B.map(e=>{let{key:t,labelKey:r}=e;return{key:t,label:i(r)}}),[i]),c=(0,a.useMemo)(()=>({updatedAt:{asc:i("sort.direction.oldestFirst"),desc:i("sort.direction.newestFirst")},repositoryName:{asc:i("sort.direction.aToZ"),desc:i("sort.direction.zToA")},branchName:{asc:i("sort.direction.aToZ"),desc:i("sort.direction.zToA")},status:{asc:i("sort.direction.attentionFirst"),desc:i("sort.direction.attentionLast")}}),[i]);return(0,n.jsx)(R,{sortKey:e,sortDirection:t,onSortKeyChange:r,onSortDirectionChange:s,options:l,defaultDirections:D,showLabel:!0,directionLabels:c,iconClassName:"w-4 h-4"})});var F=r(48407),H=r(30061),V=r(45195),_=r(26020);function q(){let{currentLocale:e,switchLocale:t}=(0,V.g)(),r=(0,x.c)("common");return(0,n.jsx)("select",{value:e,onChange:e=>t(e.target.value),"data-testid":"locale-switcher","aria-label":r("language"),className:" w-full px-3 py-2 rounded-md bg-sidebar text-sidebar-foreground border border-sidebar-border focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent text-sm ",children:_.dI.map(e=>(0,n.jsx)("option",{value:e,children:_.vK[e]},e))})}var G=r(5379),J=r(59427),U=r(37494);function $(){let{theme:e,setTheme:t}=(0,G.D)(),[r,s]=(0,a.useState)(!1);if((0,a.useEffect)(()=>{s(!0)},[]),!r)return(0,n.jsx)("div",{"data-testid":"theme-toggle-placeholder",className:"w-8 h-8","aria-hidden":"true"});let o="dark"===e;return(0,n.jsx)("button",{"data-testid":"theme-toggle",onClick:()=>t(o?"light":"dark"),className:"p-1.5 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted transition-colors focus:outline-none focus:ring-2 focus:ring-ring","aria-label":o?"Switch to light mode":"Switch to dark mode",title:o?"Switch to light mode":"Switch to dark mode",children:o?(0,n.jsx)(J.A,{className:"w-5 h-5","data-testid":"theme-icon-sun"}):(0,n.jsx)(U.A,{className:"w-5 h-5","data-testid":"theme-icon-moon"})})}var X=r(65380);function Y(){let e=(0,x.c)("auth"),t=(0,X.H)(),[r,s]=(0,a.useState)(!1);if(!t)return null;async function o(){s(!0);try{await fetch("/api/auth/logout",{method:"POST"}),window.location.href="/login"}catch(e){window.location.href="/login"}}return(0,n.jsx)("button",{type:"button",onClick:o,disabled:r,"data-testid":"logout-button",className:" w-full px-3 py-2 text-sm text-left rounded-md text-muted-foreground hover:text-foreground hover:bg-muted focus:outline-none focus:ring-2 focus:ring-ring disabled:opacity-50 transition-colors ",children:r?"...":e("logout.button")})}var Z=r(94442),Q=r(44308),ee=r(24373),et=r(40823),er=r(80344),en=r(7636);function es(e){let{items:t,sortKey:r,sortDirection:n,viewMode:s,filterText:o}=e,i=(0,a.useMemo)(()=>{if(!o)return t;let e=o.toLowerCase();return t.filter(t=>t.name.toLowerCase().includes(e)||t.repositoryName.toLowerCase().includes(e))},[t,o]);return{sortedItems:(0,a.useMemo)(()=>(0,en.Xn)(i,r,n),[i,r,n]),groupedItems:(0,a.useMemo)(()=>"grouped"===s?(0,en._s)(i,r,n):[],[i,r,n,s])}}let ea="mcbd-sidebar-group-collapsed",eo="mcbd-sidebar-scroll-top",ei=0,el=(0,a.memo)(function(){var e,t,r;let i=(0,f.Hq)(),{worktrees:l,repositories:c,selectedWorktreeId:d,selectWorktree:u,refreshWorktrees:m,isLoading:h,error:v}=(0,N.$f)(),{closeMobileDrawer:j,sortKey:k,sortDirection:M,viewMode:S,setViewMode:E,repositoryOrder:A,setRepositoryOrder:K}=(0,o.VF)(),T=(0,x.c)("common"),I=null!=(e=(0,s.usePathname)())?e:"",{count:R}=(0,ee.Lv)(),[W,z]=(0,a.useState)(""),P=(0,a.useRef)(null),[B,D]=(0,a.useState)(()=>{try{let e=localStorage.getItem(ea);return e?function(e){try{let t=JSON.parse(e);if("object"!=typeof t||null===t||Array.isArray(t))return{};let r={},n=0;for(let[e,s]of Object.entries(t))if(!eu.has(e)&&"boolean"==typeof s){if(++n>100)break;r[e]=s}return r}catch(e){return{}}}(e):{}}catch(e){return{}}}),H=(0,a.useRef)(!1);(0,a.useEffect)(()=>{H.current||(H.current=!0,fetch("/api/sidebar/group-order").then(e=>e.json()).then(e=>{e.success&&Array.isArray(e.order)&&K(e.order)}).catch(()=>{}))},[K]);let V=(0,a.useMemo)(()=>(0,en.UZ)(c),[c]),_=(0,a.useMemo)(()=>(0,en.s6)(l,V),[l,V]),G=(0,a.useMemo)(()=>_.map(C.XK),[_]),J=(0,a.useDeferredValue)(G),U=(0,a.useRef)(null),X=(0,a.useRef)(null),[Z,et]=(0,a.useState)(0);(0,a.useEffect)(()=>()=>{null!==X.current&&clearTimeout(X.current)},[]);let er=(0,a.useCallback)(()=>{null!==X.current&&(clearTimeout(X.current),X.current=null),U.current=null},[]),el=(0,a.useMemo)(()=>{let e=U.current;return!e||0===e.items.length||Date.now()>=e.expiresAt?J:e.items},[J,Z]),em=(0,a.useRef)(el);(0,a.useLayoutEffect)(()=>{em.current=el;let e=U.current;e&&0===e.items.length&&J.length>0&&er()});let eb=(0,a.useCallback)(()=>{if(0===em.current.length)return;null!==X.current&&(clearTimeout(X.current),X.current=null);let e=U.current;if(e&&Date.now()<e.expiresAt){U.current={...e,expiresAt:1/0};return}U.current={items:em.current,expiresAt:1/0}},[]),ep=(0,a.useCallback)(()=>{U.current&&(U.current={...U.current,expiresAt:Date.now()+1e3},null!==X.current&&clearTimeout(X.current),X.current=setTimeout(()=>{er(),et(e=>e+1)},1e3))},[er]),{sortedItems:eg,groupedItems:ew}=es({items:el,sortKey:k,sortDirection:M,viewMode:S,filterText:W}),ej=(0,a.useMemo)(()=>"grouped"===S&&ew?W.trim()?ew:(0,en.BN)(ew,A):null,[S,ew,A,W]),eN="grouped"===S?ej:null,ek=(0,a.useMemo)(()=>"sessions"===S?(0,en.EY)((0,en.UB)(eg),k,M):[],[S,eg,k,M]);(0,a.useEffect)(()=>{try{localStorage.setItem(ea,JSON.stringify(B))}catch(e){}},[B]);let eC=(0,a.useCallback)(e=>{D(t=>({...t,[e]:!t[e]}))},[]),eM=(0,a.useCallback)(()=>{var e,t,r=null!=(t=null==(e=P.current)?void 0:e.scrollTop)?t:0;let n=Number.isFinite(r)&&r>0?r:0;ei=n;try{localStorage.setItem(eo,String(n))}catch(e){}},[]),eS=eg.length>0||(null!=(t=null==eN?void 0:eN.length)?t:0)>0||ek.length>0;(0,a.useEffect)(()=>{let e=P.current;if(!e)return;let t=window.requestAnimationFrame(()=>{e.scrollTop=function(){try{let e=localStorage.getItem(eo);if(!e)return ei=0,0;let t=Number(e);Number.isFinite(t)&&t>=0&&(ei=t)}catch(e){}return ei}()});return()=>{window.cancelAnimationFrame(t)}},[eS,S]);let eE=(0,a.useCallback)(e=>{eM(),u(e),i.push("/worktrees/".concat(e)),j()},[eM,u,i,j]),eA=(0,a.useCallback)(e=>{eM(),u(e.worktreeId),i.push((0,en.Ii)(e)),j()},[eM,u,i,j]),eL=(0,y.FR)((0,y.MS)(y.AN,{activationConstraint:{distance:8}})),eK=(0,a.useCallback)(e=>{let{active:t,over:r}=e;if(!r||t.id===r.id||!eN)return;let n=eN.map(e=>e.repositoryName),s=n.indexOf(String(t.id)),a=n.indexOf(String(r.id));if(-1===s||-1===a)return;let o=(0,w.be)(n,s,a);K(o),fetch("/api/sidebar/group-order",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({order:o})}).catch(()=>{K(n)})},[eN,K]),eT="grouped"===S?(null!=(r=null==eN?void 0:eN.length)?r:0)===0:"sessions"===S?0===ek.length:0===eg.length,eI=h&&0===l.length,eR=!eI&&!!v&&0===l.length,eW=(0,a.useCallback)(()=>{m()},[m]);return(0,n.jsxs)("nav",{"data-testid":"sidebar","aria-label":T("sidebar.branchNavigation"),className:"h-full flex flex-col bg-sidebar text-sidebar-foreground",role:"navigation",children:[(0,n.jsxs)("div",{"data-testid":"sidebar-header",className:"flex-shrink-0 space-y-2 border-b border-sidebar-border px-2 py-2",children:[(0,n.jsxs)("ul",{"data-testid":"sidebar-nav",className:"space-y-0.5",children:[(0,n.jsxs)("li",{className:"flex min-w-0 items-center gap-1",children:[(0,n.jsx)(ef,{href:"/repositories",icon:b.A,label:T("nav.repositories"),testId:"sidebar-nav-repositories",isActive:I.startsWith("/repositories"),onNavigate:j}),(0,n.jsx)(ev,{refreshWorktrees:m})]}),(0,n.jsx)("li",{className:"flex min-w-0",children:(0,n.jsx)(ef,{href:"/sessions",icon:p.A,label:T("nav.sessions"),testId:"sidebar-nav-sessions",isActive:I.startsWith("/sessions"),onNavigate:j})}),(0,n.jsx)("li",{className:"flex min-w-0",children:(0,n.jsx)(ef,{href:R>0?Q.ks:"/review",icon:g.A,label:T("nav.review"),testId:"sidebar-nav-review",isActive:I.startsWith("/review"),onNavigate:j,trailing:R>0?(0,n.jsx)("span",{"data-testid":"sidebar-nav-review-count",role:"status","aria-label":T("attention.badgeLabel",{count:R}),className:"flex-shrink-0 rounded-full bg-warning-subtle px-1.5 text-xs font-semibold leading-5 tabular-nums text-warning-foreground",children:R>99?"99+":R}):null})})]}),(0,n.jsxs)("div",{"data-testid":"sidebar-list-controls",className:"grid grid-cols-[auto_minmax(0,1fr)] items-center gap-x-2 gap-y-1.5 px-2",children:[(0,n.jsx)(eh,{viewMode:S,onChange:E}),(0,n.jsx)("span",{className:"whitespace-nowrap text-xs text-sidebar-muted",children:T("sort.label")}),(0,n.jsx)(O,{})]})]}),(0,n.jsx)("div",{className:"flex-shrink-0 px-4 py-3 border-b border-sidebar-border",children:(0,n.jsx)(F.pd,{type:"text",placeholder:T("sidebar.searchBranches"),value:W,onChange:e=>z(e.target.value),className:"bg-background shadow-none"})}),(0,n.jsx)("div",{ref:P,"data-testid":"branch-list",onScroll:eM,onMouseEnter:eb,onMouseLeave:ep,className:"flex-1 overflow-y-auto overflow-x-hidden",children:eI?(0,n.jsx)(ec,{label:T("sidebar.loadingBranches")}):eR?(0,n.jsxs)("div",{"data-testid":"branch-list-error",role:"alert",className:"px-4 py-8 text-center text-sidebar-muted",children:[(0,n.jsx)("p",{className:"text-sm",children:T("sidebar.branchesLoadFailed")}),(0,n.jsx)(F.$n,{type:"button",variant:"secondary",size:"sm",className:"mt-3","data-testid":"branch-list-retry",onClick:eW,children:T("sidebar.retryLoadBranches")})]}):eT?(0,n.jsx)("div",{className:"px-4 py-8 text-center text-sidebar-muted",children:T(W?"sidebar.noBranchesFound":"sidebar.noBranchesAvailable")}):"sessions"===S?ek.map(e=>(0,n.jsx)(ex,{row:e,isSelected:e.worktreeId===d,onClick:eA},e.key)):"grouped"===S&&eN?(0,n.jsx)(y.Mp,{sensors:eL,collisionDetection:y.fp,onDragEnd:eK,children:(0,n.jsx)(w.gB,{items:eN.map(e=>e.repositoryName),strategy:w._G,children:eN.map(e=>{let t=!B[e.repositoryName]||!!W.trim();return(0,n.jsx)(ed,{group:e,isExpanded:t,selectedWorktreeId:d,onToggle:()=>eC(e.repositoryName),onBranchClick:eE,isDragDisabled:!!W.trim()},e.repositoryName)})})}):eg.map(e=>(0,n.jsx)(L,{branch:e,isSelected:e.id===d,onClick:()=>eE(e.id)},e.id))}),(0,n.jsxs)("div",{className:"flex-shrink-0 px-4 py-3 border-t border-sidebar-border space-y-2",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(ey,{onNavigate:j}),(0,n.jsx)("div",{className:"flex-1 min-w-0",children:(0,n.jsx)(q,{})}),(0,n.jsx)($,{})]}),(0,n.jsx)(Y,{})]})]})}),ec=(0,a.memo)(function(e){let{label:t}=e;return(0,n.jsxs)("div",{"data-testid":"branch-list-skeleton",role:"status","aria-live":"polite",className:"px-4 py-3 space-y-3",children:[(0,n.jsx)("span",{className:"sr-only",children:t}),[0,1,2,3,4].map(e=>(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(F.EA,{className:"h-2 w-2 rounded-full"}),(0,n.jsx)(F.EA,{className:"h-3 flex-1"})]},e))]})});function ed(e){let{group:t,isExpanded:r,selectedWorktreeId:s,onToggle:a,onBranchClick:o,isDragDisabled:i}=e,{attributes:l,listeners:c,setNodeRef:d,setActivatorNodeRef:u,transform:m,transition:f,isDragging:h}=(0,w.gl)({id:t.repositoryName,disabled:i}),x={transform:j.Ks.Transform.toString(m),transition:f,opacity:h?.5:1};return(0,n.jsxs)("div",{ref:d,style:x,className:"w-full min-w-0",children:[(0,n.jsx)(em,{repositoryName:t.repositoryName,branchCount:t.branches.length,isExpanded:r,onClick:a,dragHandleRef:u,dragHandleListeners:i?void 0:c,dragHandleAttributes:i?void 0:l}),r&&t.branches.map(e=>(0,n.jsx)(L,{branch:e,isSelected:e.id===s,onClick:()=>o(e.id),showRepositoryName:!1},e.id))]})}let eu=new Set(["__proto__","constructor","prototype"]);function em(e){let{repositoryName:t,branchCount:r,isExpanded:s,onClick:a,dragHandleRef:o,dragHandleListeners:i,dragHandleAttributes:l}=e,c=(0,x.c)("common");return(0,n.jsxs)("div",{className:"flex items-center w-full",children:[i&&(0,n.jsx)("div",{ref:o,...i,...l,"aria-label":c("sidebar.dragToReorderGroup"),className:" flex-shrink-0 flex items-center justify-center w-6 h-full pl-2 cursor-grab active:cursor-grabbing text-sidebar-muted hover:text-sidebar-foreground transition-colors ",children:(0,n.jsx)(ep,{})}),(0,n.jsxs)("button",{"data-testid":"group-header",type:"button",onClick:a,"aria-expanded":s,className:" flex-1 min-w-0 flex items-center gap-2 px-2 py-2 text-xs font-semibold text-sidebar-muted uppercase tracking-wider focus:outline-none focus:ring-2 focus:ring-inset focus:ring-ring transition-colors ",children:[(0,n.jsx)(eb,{isExpanded:s}),(0,n.jsx)(F.nF,{color:(0,en.LV)(t)}),(0,n.jsx)(H.nR,{content:t,className:"flex-1 min-w-0 text-left truncate",children:t}),(0,n.jsx)("span",{className:"text-sidebar-muted font-normal tabular-nums pr-2",children:r})]})]})}function ef(e){let{href:t,icon:r,label:s,testId:a,isActive:o,onNavigate:i,trailing:l}=e;return(0,n.jsxs)(h,{href:t,"data-testid":a,"aria-current":o?"page":void 0,onClick:i,className:"flex min-w-0 flex-1 items-center gap-2 rounded-md px-2 py-1.5 text-sm transition-colors hover:bg-sidebar-hover hover:text-sidebar-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-ring ".concat(o?"bg-sidebar-hover font-medium text-sidebar-foreground":"text-sidebar-muted"),children:[(0,n.jsx)(r,{className:"h-4 w-4 flex-shrink-0","aria-hidden":"true"}),(0,n.jsx)("span",{className:"min-w-0 flex-1 truncate",children:s}),l]})}function eh(e){let{viewMode:t,onChange:r}=e,s=(0,x.c)("common"),o=(0,a.useId)();return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("label",{htmlFor:o,className:"whitespace-nowrap text-xs text-sidebar-muted",children:s("sidebar.viewLabel")}),(0,n.jsxs)("select",{id:o,"data-testid":"view-mode-select",value:t,onChange:e=>{let t=e.target.value;(0,en.$m)(t)&&r(t)},className:"w-full min-w-0 truncate rounded border border-sidebar-border bg-sidebar px-1.5 py-1 text-xs text-sidebar-foreground hover:bg-sidebar-hover focus:outline-none focus:ring-2 focus:ring-ring",children:[(0,n.jsx)("option",{value:"grouped",children:s("sidebar.viewMode.grouped")}),(0,n.jsx)("option",{value:"flat",children:s("sidebar.viewMode.flat")}),(0,n.jsx)("option",{value:"sessions",children:s("sidebar.viewMode.sessions")})]})]})}let ex=(0,a.memo)(function(e){let{row:t,isSelected:r,onClick:s}=e,a=(0,x.c)("common"),o=(0,M.Mq)(t.status,t.unclassified),i=a(o?M.rH:"status.".concat(t.status));return(0,n.jsxs)("button",{type:"button","data-testid":"session-list-item","data-session-key":t.key,onClick:()=>s(t),"aria-current":r?"true":void 0,className:"w-full min-w-0 px-4 py-2 flex items-center gap-3 text-left hover:bg-sidebar-hover transition-colors focus:outline-none focus:ring-2 focus:ring-inset focus:ring-ring ".concat(r?"bg-sidebar-hover border-l-2 border-accent-500":"border-l-2 border-transparent"),children:[(0,n.jsx)(F.md,{status:t.status,size:"lg",label:t.exited?"".concat(i," (").concat(a("branchItem.agentExited"),")"):i,className:o?M.Jd:void 0}),(0,n.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,n.jsx)("span",{className:"block truncate text-sm font-semibold text-sidebar-foreground",children:t.label}),(0,n.jsxs)("span",{className:"block truncate text-xs text-sidebar-muted",children:[t.branchName," \xb7 ",t.repositoryName]})]})]})});function eb(e){let{isExpanded:t}=e;return(0,n.jsx)("svg",{className:"w-3 h-3 flex-shrink-0 transition-transform ".concat(t?"rotate-90":""),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})}function ep(){return(0,n.jsxs)("svg",{className:"w-3 h-3",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,n.jsx)("circle",{cx:"9",cy:"5",r:"1.5"}),(0,n.jsx)("circle",{cx:"15",cy:"5",r:"1.5"}),(0,n.jsx)("circle",{cx:"9",cy:"12",r:"1.5"}),(0,n.jsx)("circle",{cx:"15",cy:"12",r:"1.5"}),(0,n.jsx)("circle",{cx:"9",cy:"19",r:"1.5"}),(0,n.jsx)("circle",{cx:"15",cy:"19",r:"1.5"})]})}function eg(e){let{className:t=""}=e;return(0,n.jsx)("svg",{className:"".concat("w-4 h-4"," ").concat(t),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h5M20 20v-5h-5M20.49 9A9 9 0 005.64 5.64L4 4m16 16l-1.64-1.64A9 9 0 014.51 15"})})}let ev=(0,a.memo)(function(e){let{refreshWorktrees:t}=e,[r,s]=(0,a.useState)(!1),o=(0,a.useRef)(!1),{showToast:i}=(0,Z.dj)(),l=(0,x.c)("common"),c=(0,a.useCallback)(async()=>{if(!o.current){o.current=!0,s(!0);try{let e=await er.Rx.sync();await t(),i(l("syncSuccess",{count:e.worktreeCount}),"success",3e3)}catch(e){e instanceof er.hD&&401===e.status?i(l("syncAuthError"),"error",5e3):i(l("syncError"),"error",5e3)}finally{o.current=!1,s(!1)}}},[t,i,l]);return(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(T.m_,{content:l("tooltips.sync"),placement:"bottom",children:(0,n.jsx)("button",{type:"button",onClick:c,disabled:r,"aria-label":l("syncButtonLabel"),className:"p-1 rounded-md text-sidebar-muted hover:text-sidebar-foreground hover:bg-sidebar-hover focus:outline-none focus:ring-2 focus:ring-ring disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:(0,n.jsx)(eg,{className:r?"animate-spin":""})})})})});function ey(e){let{onNavigate:t}=e,r=(0,x.c)("common"),s=(0,i.a)(),{open:o}=(0,et.V0)(),l=r("settings.title"),c=(0,a.useCallback)(e=>{t(),!s&&(0!==e.button||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),o()))},[s,t,o]);return(0,n.jsx)(T.m_,{content:l,placement:"top",className:"flex-shrink-0",children:(0,n.jsx)(h,{href:"/more","data-testid":"sidebar-settings","aria-label":l,"aria-haspopup":s?void 0:"dialog",onClick:c,className:"p-1.5 rounded-md text-sidebar-muted hover:text-sidebar-foreground hover:bg-sidebar-hover focus:outline-none focus:ring-2 focus:ring-ring transition-colors",children:(0,n.jsx)(v.A,{size:20,"aria-hidden":"true"})})})}var ew=r(59847),ej=r(86651),eN=r(94684),ek=r(34681);function eC(){let e=(0,o.pT)(),t=(0,x.c)("common");if(!e)return null;let{repoTabBarMode:r,setRepoTabBarMode:s}=e;return(0,n.jsxs)("div",{className:"hidden md:flex items-center",children:[(0,n.jsx)("label",{htmlFor:"repo-tab-bar-mode",className:"sr-only",children:t("repoTabBar.settingLabel")}),(0,n.jsx)("select",{id:"repo-tab-bar-mode","data-testid":"repo-tab-bar-mode-select","aria-label":t("repoTabBar.settingLabel"),title:t("repoTabBar.settingLabel"),value:r,onChange:e=>{let t=e.target.value;(0,en.m3)(t)&&s(t)},className:"rounded-md border border-border bg-surface px-2 py-1 text-sm text-muted-foreground transition-colors hover:text-foreground focus:outline-none focus:ring-2 focus:ring-ring",children:en.EN.map(e=>(0,n.jsx)("option",{value:e,children:t("repoTabBar.mode.".concat(e))},e))})]})}var eM=r(52407);function eS(){let{shouldSurface:e,isReconnecting:t}=(0,eM.Fx)(),r=(0,x.c)("common");if(!e)return null;let s=r(t?"connection.reconnecting":"connection.offline");return(0,n.jsxs)("span",{"data-testid":"connection-status-indicator","data-connection-state":t?"reconnecting":"offline",role:"status","aria-live":"polite",title:r(t?"connection.reconnectingTooltip":"connection.offlineTooltip"),className:"hidden sm:inline-flex items-center gap-1.5 rounded-full border border-border bg-surface px-2 py-0.5 text-xs text-muted-foreground",children:[(0,n.jsx)("span",{"aria-hidden":"true",className:["w-1.5 h-1.5 rounded-full",t?"bg-warning motion-safe:animate-pulse":"bg-muted-foreground"].join(" ")}),s]})}var eE=r(72137),eA=r(79651),eL=r(92614);let eK=[{labelKey:"nav.sessions",href:"/sessions",isActive:e=>e.startsWith("/sessions")},{labelKey:"nav.repositoriesShort",href:"/repositories",isActive:e=>e.startsWith("/repositories")},{labelKey:"nav.reviewReport",href:"/review",isActive:e=>e.startsWith("/review")},{labelKey:"nav.more",href:"/more",isActive:e=>e.startsWith("/more"),opensSettings:!0}];function eT(e){let{title:t="CommandMate"}=e,r=(0,s.usePathname)(),o=(0,x.c)("commandPalette"),i=(0,x.c)("common"),{setOpen:l}=(0,eL.C)(),[c,d]=a.useState(null);a.useEffect(()=>{d("undefined"!=typeof navigator&&/Mac|iPhone|iPad|iPod/i.test(navigator.platform||"")?"⌘":"Ctrl")},[]);let{open:u}=(0,et.V0)(),m=a.useCallback(e=>{0!==e.button||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),u())},[u]);return(0,n.jsx)("header",{className:"sticky top-0 z-50 border-b border-border bg-background supports-[backdrop-filter]:bg-background/80 backdrop-blur-md",children:(0,n.jsx)("div",{className:"container-custom",children:(0,n.jsxs)("div",{className:"flex items-center justify-between h-16",children:[(0,n.jsx)("div",{className:"flex items-center space-x-4",children:(0,n.jsxs)(h,{href:"/",className:"flex items-center space-x-2 hover:opacity-80 transition-opacity",children:[(0,n.jsx)("div",{className:"w-8 h-8 bg-accent-600 rounded-lg flex items-center justify-center",children:(0,n.jsx)(ew.A,{size:20,strokeWidth:2,className:"text-white","aria-hidden":"true"})}),(0,n.jsx)("h1",{className:"text-xl font-bold text-foreground",children:t})]})}),(0,n.jsxs)("nav",{className:"flex items-center space-x-6",role:"navigation",children:[eK.map(e=>{let t=e.isActive(r);return(0,n.jsx)(h,{href:e.href,"aria-current":t?"page":void 0,"aria-haspopup":e.opensSettings?"dialog":void 0,onClick:e.opensSettings?m:void 0,className:"relative py-1 text-sm font-medium transition-colors after:absolute after:inset-x-0 after:bottom-0 after:h-0.5 after:rounded-full after:bg-accent-600 dark:after:bg-accent-400 after:origin-center motion-safe:after:transition-transform after:duration-200 after:ease-[var(--motion-ease-out)] ".concat(t?"text-accent-600 dark:text-accent-400 after:scale-x-100":"text-muted-foreground hover:text-foreground after:scale-x-0"),children:i(e.labelKey)},e.href)}),(0,n.jsxs)("button",{type:"button","data-testid":"header-command-palette-trigger",onClick:()=>l(!0),"aria-label":o("mobileTrigger"),className:"hidden md:inline-flex items-center gap-2 rounded-md border border-border bg-surface px-2.5 py-1.5 text-sm text-muted-foreground hover:bg-surface-2 transition-colors",children:[(0,n.jsx)(ej.A,{size:16,strokeWidth:2,"aria-hidden":"true",className:"shrink-0"}),(0,n.jsx)("span",{children:o("searchAction")}),c&&(0,n.jsxs)("span",{className:"flex items-center gap-0.5",children:[(0,n.jsx)(eA.u,{children:c}),(0,n.jsx)(eA.u,{children:"K"})]})]}),(0,n.jsx)(eS,{}),(0,n.jsx)(ek.g,{}),(0,n.jsx)(eC,{}),(0,n.jsx)(eE.H,{}),(0,n.jsx)($,{}),(0,n.jsxs)("a",{href:"https://github.com/kewton/MyCodeBranchDesk",target:"_blank",rel:"noopener noreferrer",className:"text-sm font-medium text-muted-foreground hover:text-foreground transition-colors flex items-center space-x-1",children:[(0,n.jsx)(eN.A,{size:20,strokeWidth:2,"aria-hidden":"true"}),(0,n.jsx)("span",{children:"GitHub"})]})]})]})})})}var eI=r(37772),eR=r(17848),eW=r(48481),ez=r(46892),eP=r(59854);let eB=/^\/worktrees\/([^/]+)/;function eD(e,t,r){let n=r-8-t;return n<=8?8:Math.min(Math.max(e.left+t>r-8?e.right-t:e.left,8),n)}function eO(e){var t;null==e||null==(t=e.scrollIntoView)||t.call(e,{block:"nearest",inline:"nearest"})}let eF=(0,a.memo)(function(){var e;let t=(0,x.c)("common"),r=(0,s.usePathname)(),i=(0,f.Hq)(),{sortKey:l,sortDirection:c,repositoryOrder:u}=(0,o.VF)(),{worktrees:m,repositories:h,selectedWorktreeId:b,selectWorktree:p}=(0,N.$f)(),{factor:g}=(0,d.Ps)(),v=(0,a.useMemo)(()=>(0,en.UZ)(null!=h?h:[]),[h]),y=(0,a.useMemo)(()=>(0,en.s6)(null!=m?m:[],v),[m,v]),{groupedItems:w}=es({items:(0,a.useMemo)(()=>y.map(C.XK),[y]),sortKey:l,sortDirection:c,viewMode:"grouped"}),j=(0,a.useMemo)(()=>(0,en.BN)(w,u),[w,u]),k=function(e,t){let r=eB.exec(e);if(!r)return t;try{return decodeURIComponent(r[1])}catch(e){return r[1]}}(r,b),M=(0,a.useMemo)(()=>{var e,t;return null!=(t=null==(e=j.find(e=>e.branches.some(e=>e.id===k)))?void 0:e.repositoryName)?t:null},[j,k]),[S,E]=(0,a.useState)(null),[A,L]=(0,a.useState)(null),[K,T]=(0,a.useState)(!1),I=(0,a.useRef)(null),R=(0,a.useRef)(null),W=(0,a.useRef)(new Map),z=(0,a.useCallback)((e,t)=>{t?W.current.set(e,t):W.current.delete(e)},[]),P=(0,a.useCallback)(()=>{E(null),L(null),T(!1)},[]),B=(0,a.useCallback)(e=>{let t=W.current.get(e);if(!t)return;let r=t.getBoundingClientRect();L({left:r.left,right:r.right,bottom:r.bottom}),E(e),T(!1)},[]),D=(0,a.useCallback)(e=>{if(S===e)return void P();B(e)},[S,P,B]),[O,F]=(0,a.useState)(!1),H=(0,a.useCallback)(()=>{let e=I.current;e&&F(e.scrollWidth>e.clientWidth+1)},[]);(0,a.useLayoutEffect)(()=>{H()},[H,j.length,g]),(0,a.useEffect)(()=>{window.addEventListener("resize",H);let e="undefined"!=typeof ResizeObserver?new ResizeObserver(()=>H()):null;return e&&I.current&&e.observe(I.current),()=>{window.removeEventListener("resize",H),null==e||e.disconnect()}},[H]);let V=null!==S||K;(0,a.useEffect)(()=>{if(!V)return;let e=e=>{var t,r,n;let s=e.target;!(!s||(null==(t=I.current)?void 0:t.contains(s))||(null==(r=R.current)?void 0:r.contains(s)))&&((null==(n=s.closest)?void 0:n.call(s,"[data-repository-tab-panel]"))||P())},t=e=>{if("Escape"!==e.key)return;let t=S?W.current.get(S):R.current;P(),null==t||t.focus()};return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)}},[V,S,P]),(0,a.useEffect)(()=>{P()},[r,P]),(0,a.useLayoutEffect)(()=>{M&&eO(W.current.get(M))},[M,r,O]);let _=(0,a.useCallback)(e=>{P(),p(e),i.push("/worktrees/".concat(e))},[P,p,i]),q=(0,a.useCallback)(e=>{let t=W.current.get(e);eO(t),B(e),null==t||t.focus()},[B]),G=(0,a.useCallback)(e=>{var t;let r=e.currentTarget,n=(t=r.clientWidth,e.ctrlKey||e.shiftKey||Math.abs(e.deltaY)<=Math.abs(e.deltaX)?0:1===e.deltaMode?40*e.deltaY:2===e.deltaMode?e.deltaY*t:e.deltaY);0!==n&&(r.scrollLeft+=n)},[]);if(0===j.length)return null;let J=Math.round(32*g),U=null!=(e=j.find(e=>e.repositoryName===S))?e:null;return(0,n.jsxs)("div",{"data-testid":"repository-tab-bar",className:"relative flex-shrink-0 flex items-stretch border-b border-border bg-surface",style:{height:"".concat(J,"px")},children:[(0,n.jsx)("nav",{ref:I,"data-testid":"repository-tab-strip","aria-label":t("nav.repositories"),onWheel:G,className:"flex min-w-0 flex-1 flex-nowrap items-stretch overflow-x-auto overflow-y-hidden scrollbar-hide",children:j.map(e=>(0,n.jsx)(eH,{group:e,isActive:e.repositoryName===M,isOpen:e.repositoryName===S,registerTab:z,onToggle:D},e.repositoryName))}),O&&(0,n.jsx)("button",{ref:R,type:"button","data-testid":"repository-tab-overflow","aria-haspopup":"menu","aria-expanded":K,"aria-label":t("repoTabBar.overflow"),title:t("repoTabBar.overflow"),onClick:()=>{E(null),L(null),T(e=>!e)},className:"flex-shrink-0 flex items-center border-l border-border px-2 text-muted-foreground transition-colors hover:bg-surface-2 hover:text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",children:(0,n.jsx)(eI.A,{size:16,strokeWidth:2,"aria-hidden":"true"})}),U&&A&&(0,n.jsx)(eV,{group:U,anchor:A,factor:g,activeWorktreeId:k,onBranchClick:_}),K&&(0,n.jsx)(e_,{groups:j,anchorRef:R,activeRepositoryName:M,onSelect:q})]})}),eH=(0,a.memo)(function(e){let{group:t,isActive:r,isOpen:s,registerTab:a,onToggle:o}=e,i=(0,x.c)("common"),l=(0,en.zD)(t.branches),c=(0,M.Mq)(l,(0,en.El)(t.branches)),d=(0,en.j)(t.branches),u=i(c?M.rH:ez.PL[l].labelKey);return(0,n.jsxs)("button",{ref:e=>a(t.repositoryName,e),type:"button","data-testid":"repository-tab","data-repository":t.repositoryName,"aria-haspopup":"menu","aria-expanded":s,"aria-current":r?"true":void 0,title:"".concat(t.repositoryName," — ").concat(u),onClick:()=>o(t.repositoryName),onKeyDown:e=>{"ArrowDown"===e.key&&(e.preventDefault(),s||o(t.repositoryName))},className:"\n group/tab flex-shrink-0 flex max-w-[14rem] items-center gap-1.5 px-2.5\n border-b-2 text-xs font-medium transition-colors\n focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring\n ".concat(r?"border-accent-500 bg-surface-2 text-foreground":"border-transparent text-muted-foreground hover:bg-surface-2 hover:text-foreground","\n "),children:[(0,n.jsx)(eR.n,{className:"h-3.5 w-3.5",color:(0,en.LV)(t.repositoryName)}),(0,n.jsx)("span",{className:"min-w-0 truncate",children:t.repositoryName}),(0,n.jsx)(eW.m,{status:l,size:"sm",label:u,className:c?M.Jd:void 0,"data-testid":"repository-tab-status"}),d>0&&(0,n.jsx)("span",{"data-testid":"repository-tab-attention-count","aria-label":i("attention.badgeLabel",{count:d}),className:"flex-shrink-0 rounded-full bg-warning-subtle px-1.5 text-[10px] font-semibold leading-4 tabular-nums text-warning-foreground",children:d})]})});function eV(e){let{group:t,anchor:r,factor:s,activeWorktreeId:o,onBranchClick:i}=e,l=(0,x.c)("common"),c=(0,a.useRef)(null);if((0,a.useEffect)(()=>{var e;let t=null==(e=c.current)?void 0:e.querySelector("button");null==t||t.focus()},[t.repositoryName]),"undefined"==typeof document)return null;let d=Math.round(300*s),u=window.innerWidth;return k.createPortal((0,n.jsx)("div",{ref:c,"data-repository-tab-panel":"","data-testid":"repository-tab-popover","data-repository":t.repositoryName,role:"menu","aria-label":l("sidebar.branchNavigation"),className:"fixed rounded-md border border-sidebar-border bg-sidebar text-sidebar-foreground shadow-lg",style:{top:r.bottom+4,left:eD(r,d,u),width:d,zIndex:eP.M.POPOVER},children:(0,n.jsx)("div",{"data-testid":"repository-tab-popover-list",className:"overflow-y-auto overflow-x-hidden py-1",style:{maxHeight:"".concat(Math.round(520*s),"px")},children:0===t.branches.length?(0,n.jsx)("p",{className:"px-4 py-6 text-center text-sm text-sidebar-muted",children:l("sidebar.noBranchesAvailable")}):t.branches.map(e=>(0,n.jsx)(L,{branch:e,isSelected:e.id===o,onClick:()=>i(e.id),showRepositoryName:!1},e.id))})}),document.body)}function e_(e){var t;let{groups:r,anchorRef:s,activeRepositoryName:a,onSelect:o}=e,i=(0,x.c)("common"),l=null==(t=s.current)?void 0:t.getBoundingClientRect();if("undefined"==typeof document||!l)return null;let c=window.innerWidth;return k.createPortal((0,n.jsx)("div",{"data-repository-tab-panel":"","data-testid":"repository-tab-overflow-menu",role:"menu","aria-label":i("nav.repositories"),className:"fixed rounded-md border border-sidebar-border bg-sidebar text-sidebar-foreground shadow-lg",style:{top:l.bottom+4,left:eD({left:l.left,right:l.right,bottom:l.bottom},300,c),width:300,maxHeight:"".concat(520,"px"),zIndex:eP.M.POPOVER},children:(0,n.jsx)("div",{className:"overflow-y-auto py-1",style:{maxHeight:"inherit"},children:r.map(e=>{let t=(0,en.zD)(e.branches),r=(0,M.Mq)(t,(0,en.El)(e.branches));return(0,n.jsxs)("button",{type:"button",role:"menuitem","data-testid":"repository-tab-overflow-item","data-repository":e.repositoryName,"aria-current":e.repositoryName===a?"true":void 0,onClick:()=>o(e.repositoryName),className:"flex w-full items-center gap-2 px-3 py-2 text-left text-sm transition-colors hover:bg-sidebar-hover focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",children:[(0,n.jsx)(eR.n,{className:"h-3.5 w-3.5",color:(0,en.LV)(e.repositoryName)}),(0,n.jsx)("span",{className:"min-w-0 flex-1 truncate",children:e.repositoryName}),(0,n.jsx)(eW.m,{status:t,size:"sm",label:i(r?M.rH:ez.PL[t].labelKey),className:r?M.Jd:void 0}),(0,n.jsx)("span",{className:"tabular-nums text-xs text-sidebar-muted",children:e.branches.length})]},e.repositoryName)})})}),document.body)}var eq=r(9540);function eG(e){let{count:t}=e,r=(0,x.c)("common");return 0===t?null:(0,n.jsx)("span",{"data-testid":"attention-badge-bubble",role:"status","aria-label":r("attention.badgeLabel",{count:t}),className:"absolute -top-1.5 -right-2.5 min-w-[1.05rem] rounded-full bg-warning-foreground px-1 text-[0.625rem] font-bold leading-[1.05rem] text-warning-subtle tabular-nums text-center",children:t>99?"99+":t})}let eJ=[{labelKey:"nav.sessions",href:"/sessions",isActive:e=>e.startsWith("/sessions"),icon:(0,n.jsx)(p.A,{size:20,"aria-hidden":"true"})},{labelKey:"nav.review",href:"/review",isActive:e=>e.startsWith("/review"),icon:(0,n.jsx)(g.A,{size:20,"aria-hidden":"true"}),showsAttentionBadge:!0},{labelKey:"nav.more",href:"/more",isActive:e=>e.startsWith("/more"),icon:(0,n.jsx)(eI.A,{size:20,"aria-hidden":"true"})}];function eU(){let e=(0,s.usePathname)(),{setOpen:t}=(0,eL.C)(),r=(0,x.c)("commandPalette"),a=(0,x.c)("common"),{count:i}=(0,ee.Lv)(),l=(0,o.pT)();return(null==l?void 0:l.isMobileDrawerOpen)?null:(0,n.jsx)("nav",{"data-testid":"global-mobile-nav",className:"fixed bottom-0 left-0 right-0 z-50 border-t border-border bg-background supports-[backdrop-filter]:bg-background/80 backdrop-blur-md pb-safe",children:(0,n.jsxs)("div",{className:"flex items-center justify-around h-14",children:[l&&(0,n.jsxs)("button",{type:"button","data-testid":"mobile-nav-open-sidebar",onClick:l.openMobileDrawer,className:"flex flex-col items-center justify-center flex-1 h-full text-xs text-muted-foreground hover:text-foreground transition-colors",children:[(0,n.jsx)(eq.A,{size:20,"aria-hidden":"true"}),(0,n.jsx)("span",{className:"mt-1 whitespace-nowrap",children:a("sidebar.branches")})]}),eJ.map(t=>{let r=t.isActive(e),s=!0===t.showsAttentionBadge&&i>0;return(0,n.jsxs)(h,{href:s?Q.ks:t.href,className:"flex flex-col items-center justify-center flex-1 h-full text-xs transition-colors ".concat(r?"text-accent-600 dark:text-accent-400":"text-muted-foreground hover:text-foreground"),children:[(0,n.jsxs)("span",{className:"relative inline-flex",children:[t.icon,!0===t.showsAttentionBadge&&(0,n.jsx)(eG,{count:i})]}),(0,n.jsx)("span",{className:"mt-1 whitespace-nowrap",children:a(t.labelKey)})]},t.href)}),(0,n.jsxs)("button",{type:"button","data-testid":"mobile-command-palette-trigger",onClick:()=>t(!0),"aria-label":r("mobileTrigger"),className:"flex flex-col items-center justify-center flex-1 h-full text-xs text-muted-foreground hover:text-foreground transition-colors",children:[(0,n.jsx)(ej.A,{size:20,"aria-hidden":"true"}),(0,n.jsx)("span",{className:"mt-1 whitespace-nowrap",children:r("mobileLabel")})]})]})})}function e$(){let{shouldSurface:e,isReconnecting:t}=(0,eM.Fx)(),r=(0,x.c)("common");if(!e)return null;let s=r(t?"connection.reconnecting":"connection.offline"),a=r(t?"connection.reconnectingTooltip":"connection.offlineTooltip");return(0,n.jsx)("div",{"data-testid":"mobile-connection-banner","data-connection-state":t?"reconnecting":"offline",role:"status","aria-live":"polite",title:a,className:"shrink-0 pt-safe border-b ".concat(t?"bg-warning-subtle border-warning-border text-warning-foreground":"bg-danger-subtle border-danger-border text-danger-foreground"),children:(0,n.jsxs)("div",{className:"flex items-center justify-center gap-1.5 px-3 py-1 text-xs",children:[(0,n.jsx)("span",{"aria-hidden":"true",className:"w-1.5 h-1.5 rounded-full ".concat(t?"bg-warning motion-safe:animate-pulse":"bg-danger")}),s]})})}var eX=r(45573),eY=r(94465),eZ=r(70628);let eQ=["global","terminal","composer","editor"],e0=[{id:"commandPalette",keys:["MOD","K"],scope:"global"},{id:"keyboardHelp",keys:["?"],scope:"global"},{id:"closeOverlay",keys:["Esc"],scope:"global"},{id:"navigateList",keys:["↑","↓"],scope:"global"},{id:"terminalSearch",keys:["MOD","F"],scope:"terminal"},{id:"toggleSurfaceMode",keys:["MOD","Shift","M"],scope:"terminal"},{id:"sendMessage",keys:["↵"],scope:"composer"},{id:"composerNewline",keys:["Shift","↵"],scope:"composer"},{id:"editorIndent",keys:["Tab"],scope:"editor"},{id:"editorOutdent",keys:["Shift","Tab"],scope:"editor"},{id:"editorTabFocus",keys:["Ctrl","M"],scope:"editor"},{id:"editorSave",keys:["MOD","S"],scope:"editor"},{id:"editorFullscreen",keys:["MOD","Shift","F"],scope:"editor"}];function e1(){let{open:e,setOpen:t}=(0,eZ.K)(),{open:r}=(0,eL.C)(),s=(0,x.c)("keyboardShortcuts"),[o,i]=(0,a.useState)(!1);(0,a.useEffect)(()=>i(function(){if("undefined"==typeof navigator)return!1;let e=navigator.platform||navigator.userAgent||"";return/Mac|iPhone|iPad|iPod/.test(e)}()),[]);let l=(0,a.useRef)(e);(0,a.useEffect)(()=>{l.current=e},[e]);let c=(0,a.useRef)(r);(0,a.useEffect)(()=>{c.current=r},[r]),(0,a.useEffect)(()=>{function e(e){"?"!==e.key||e.isComposing||229===e.keyCode||(0,eX.tJ)(e.target)||c.current||l.current||(e.preventDefault(),t(!0))}return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t]);let d=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e0;return eQ.map(t=>({scope:t,shortcuts:e.filter(e=>e.scope===t)})).filter(e=>e.shortcuts.length>0)}();return(0,n.jsx)(eY.a,{isOpen:e,onClose:()=>t(!1),title:s("title"),size:"md",children:(0,n.jsx)("div",{"data-testid":"keyboard-shortcuts-overlay",className:"space-y-6",children:d.map(e=>{let{scope:t,shortcuts:r}=e;return(0,n.jsxs)("section",{"data-testid":"keyboard-shortcuts-scope-".concat(t),children:[(0,n.jsx)("h4",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:s("scopes.".concat(t))}),(0,n.jsx)("ul",{className:"divide-y divide-border",children:r.map(e=>(0,n.jsxs)("li",{"data-testid":"keyboard-shortcut-".concat(e.id),className:"flex items-center justify-between gap-4 py-2",children:[(0,n.jsx)("span",{className:"text-sm text-foreground",children:s("shortcuts.".concat(e.id))}),(0,n.jsx)("span",{className:"flex flex-shrink-0 items-center gap-1",children:e.keys.map((e,t)=>(0,n.jsx)(eA.u,{children:"MOD"===e?o?"⌘":"Ctrl":e},t))})]},e.id))})]},t)})})})}var e2=r(77016),e5=r(36809),e4=r(31166);let e3=/^v?\d+\.\d+\.\d+$/;function e9(e){return e.replace(/^v/,"").split(".").map(Number)}let e6="commandmate.lastSeenAppVersion";function e8(e){try{window.localStorage.setItem(e6,e)}catch(e){}}let e7=[{key:"added",labelKey:"whatsNew.added"},{key:"improved",labelKey:"whatsNew.improved"},{key:"fixed",labelKey:"whatsNew.fixed"}];function te(){let e=(0,x.c)("common"),t=(0,e5.Ym)(),[r,s]=(0,a.useState)(null),[o,i]=(0,a.useState)(!1);(0,a.useEffect)(()=>{let e,t="0.43.0";try{e=window.localStorage.getItem(e6)}catch(e){return}let r=function(e,t){if(!e3.test(t))return{kind:"none"};if(null===e||!e3.test(e))return{kind:"remember"};let r=function(e,t){let r=e9(e),n=e9(t),s=Math.max(r.length,n.length);for(let e=0;e<s;e++){let t=r[e]||0,s=n[e]||0;if(t>s)return 1;if(t<s)return -1}return 0}(t,e);return 0===r?{kind:"none"}:r<0?{kind:"remember"}:{kind:"show",from:e}}(e,t);if("none"===r.kind)return;if("remember"===r.kind)return void e8(t);let n=!1;return er.GQ.getReleaseNotes(r.from,t).then(e=>{n||(s({from:r.from,to:t,notes:e.notes}),i(!0))},()=>{}),()=>{n=!0}},[]);let l=(0,a.useCallback)(()=>{r&&e8(r.to),i(!1)},[r]);if(!r)return null;let c="ja"===t?"ja":"en";return(0,n.jsx)(eY.a,{isOpen:o,onClose:l,title:e("whatsNew.title",{from:r.from,to:r.to}),size:"md",children:(0,n.jsxs)("div",{className:"space-y-4","data-testid":"whats-new-dialog",children:[0===r.notes.length?(0,n.jsx)("p",{className:"text-sm text-foreground","data-testid":"whats-new-empty",children:e("whatsNew.empty")}):r.notes.map(t=>(0,n.jsxs)("section",{className:"space-y-3","data-testid":"whats-new-version-".concat(t.version),children:[(0,n.jsxs)("h4",{className:"text-sm font-semibold text-foreground",children:["v",t.version,(0,n.jsx)("span",{className:"ml-2 text-xs font-normal text-muted-foreground",children:t.date})]}),t.highlight&&(0,n.jsxs)("div",{"data-testid":"whats-new-highlight",children:[(0,n.jsx)("h5",{className:"text-xs font-medium text-muted-foreground",children:e("whatsNew.highlight")}),(0,n.jsx)("p",{className:"mt-1 text-sm text-foreground",children:t.highlight[c]})]}),e7.map(r=>{let{key:s,labelKey:a}=r;return t[s].length>0?(0,n.jsxs)("div",{"data-testid":"whats-new-".concat(s),children:[(0,n.jsx)("h5",{className:"text-xs font-medium text-muted-foreground",children:e(a)}),(0,n.jsx)("ul",{className:"mt-1 list-disc space-y-1 pl-5 text-sm text-foreground",children:t[s].map((e,t)=>(0,n.jsx)("li",{children:e[c]},t))})]},s):null})]},t.version)),(0,n.jsxs)("div",{className:"flex items-center justify-between gap-3 border-t border-border pt-3",children:[(0,n.jsx)("a",{href:"".concat("https://github.com/Kewton/CommandMate/releases/tag/v").concat(r.to),target:"_blank",rel:"noopener noreferrer",className:"text-sm text-accent-600 dark:text-accent-400 hover:underline","data-testid":"whats-new-release-link",children:e("whatsNew.releaseLink")}),(0,n.jsx)(e4.$,{type:"button",variant:"primary",size:"sm",onClick:l,"data-testid":"whats-new-close",children:e("whatsNew.close")})]})]})})}let tt="transform transition-transform duration-300 ease-out",tr=(0,a.memo)(function(e){let{children:t}=e,{isOpen:r,isMobileDrawerOpen:u,closeMobileDrawer:m,width:f,setWidth:h,repoTabBarMode:x}=(0,o.VF)(),b=(0,i.a)(),{showSidebar:p,showGlobalNav:g}=function(){var e=(0,s.usePathname)();for(let t of c)if(e.startsWith(t.prefix))return{...l,...t.config};return{...l}}(),{factor:v}=(0,d.Ps)(),y=Math.round(160*v),w=Math.round(480*v),j=Math.round(Math.min(w,Math.max(y,f*v))),N=(0,en.fs)(null!=x?x:en.PB,r),k=Math.round(32*v)+64*!!g,C=(0,a.useRef)(null),M=(0,a.useRef)(null),S=(0,a.useCallback)(e=>{h(Math.round(e/v))},[h,v]);return b?(0,n.jsxs)("div",{"data-testid":"app-shell",className:"h-screen flex flex-col",children:[(0,n.jsx)(e$,{}),u&&(0,n.jsx)("div",{"data-testid":"drawer-overlay",className:"fixed inset-0 bg-black/50 z-40",onClick:m,"aria-hidden":"true"}),p&&(0,n.jsx)("aside",{"data-testid":"sidebar-container",className:"\n fixed left-0 top-0 h-full w-72 z-50\n ".concat(tt,"\n ").concat(u?"translate-x-0":"-translate-x-full","\n "),role:"complementary",children:(0,n.jsx)(el,{})}),(0,n.jsx)("main",{className:"flex-1 min-h-0 overflow-hidden ".concat(g?"pb-nav-safe":""),role:"main","data-view-transition":"content",children:t}),g&&(0,n.jsx)(eU,{}),(0,n.jsx)(eX.xq,{}),(0,n.jsx)(e1,{}),(0,n.jsx)(e2.n,{}),(0,n.jsx)(te,{})]}):(0,n.jsxs)("div",{"data-testid":"app-shell",className:"h-screen flex flex-col",children:[N&&(0,n.jsx)(eF,{}),g&&(0,n.jsx)(eT,{}),(0,n.jsxs)("div",{className:"flex flex-1 min-h-0",children:[p&&(0,n.jsxs)("aside",{ref:C,"data-testid":"sidebar-container",className:"\n fixed left-0\n ".concat(g?"top-16 h-[calc(100vh-4rem)]":"top-0 h-full","\n border-r border-border\n ").concat(tt,"\n ").concat(r?"translate-x-0":"-translate-x-full","\n "),style:{width:"".concat(j,"px"),zIndex:eP.M.SIDEBAR,...N?{top:"".concat(k,"px"),height:"calc(100vh - ".concat(k,"px)")}:{}},role:"complementary","aria-hidden":!r,children:[(0,n.jsx)(el,{}),(0,n.jsx)(tn,{currentWidth:j,minWidth:y,maxWidth:w,sidebarRef:C,mainRef:M,onWidthChange:S})]}),(0,n.jsx)("main",{ref:M,className:"flex-1 min-w-0 h-full overflow-hidden transition-[padding] duration-300 ease-out",style:{paddingLeft:p&&r?"".concat(j,"px"):0},role:"main","data-view-transition":"content",children:t})]}),(0,n.jsx)(eX.xq,{}),(0,n.jsx)(e1,{}),(0,n.jsx)(e2.n,{}),(0,n.jsx)(te,{})]})});function tn(e){let{currentWidth:t,minWidth:r,maxWidth:s,sidebarRef:a,mainRef:o,onWidthChange:i}=e;return(0,n.jsx)("div",{"data-testid":"sidebar-resize-handle","aria-hidden":"true",onMouseDown:e=>{e.preventDefault();let n=e.clientX,l=t;o.current&&(o.current.style.transition="none");let c=e=>{l=Math.max(r,Math.min(s,t+(e.clientX-n))),a.current&&(a.current.style.width="".concat(l,"px")),o.current&&(o.current.style.paddingLeft="".concat(l,"px"))},d=()=>{document.body.style.cursor="",document.body.style.userSelect="",o.current&&(o.current.style.transition=""),document.removeEventListener("mousemove",c),document.removeEventListener("mouseup",d),i(l)};document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",c),document.addEventListener("mouseup",d)},className:"absolute top-0 right-0 w-1 h-full cursor-col-resize hover:bg-accent-500/40 transition-colors"})}let ts=["/login","/offline","/proxy"],ta=/^\/worktrees\/[^/]+\/(terminal|files)(\/|$)/;function to(e){var t;let{children:r}=e,a=(0,s.usePathname)();return(t=null!=a?a:"",ts.some(e=>t===e||t.startsWith("".concat(e,"/")))||ta.test(t)||0)?(0,n.jsx)(n.Fragment,{children:r}):(0,n.jsx)(tr,{children:r})}},76471:(e,t,r)=>{"use strict";r.d(t,{Ej:()=>d,Jd:()=>i,Mq:()=>c,rH:()=>l});var n=r(95155),s=r(12115),a=r(18955),o=r(48481);let i="bg-transparent border-2 border-muted-foreground",l="status.unknown";function c(e,t){return!0===t&&"ready"===e}let d=(0,s.memo)(function(e){let{status:t,label:r,waitingKind:s,unclassified:d}=e,u=(0,a.c)("common"),m=c(t,d);return(0,n.jsx)(o.m,{"data-testid":"status-indicator",status:t,label:m?null!=r?r:u(l):r,waitingKind:s,size:"lg",className:m?i:void 0,"data-unclassified":m?"true":void 0})})},77016:(e,t,r)=>{"use strict";r.d(t,{W:()=>g,n:()=>v});var n=r(95155),s=r(12115),a=r(18955),o=r(52056),i=r(89559),l=r(65229),c=r(59854),d=r(60199),u=r(52703);let m=0,f=new Set;function h(){for(let e of f)e()}function x(e){return f.add(e),()=>{f.delete(e)}}function b(){return m>0}function p(){return!1}function g(){return(0,s.useSyncExternalStore)(x,b,p)}function v(){let e=(0,a.c)("common"),[t,r]=(0,s.useState)(null),[f,x]=(0,s.useState)(null),b=(0,s.useCallback)(e=>{if(e.type!==u.Oo)return;let{serverVersion:t,clientVersion:n}=e;"string"==typeof t&&"string"==typeof n&&t&&n&&t!==f&&r({serverVersion:t,clientVersion:n})},[f]);(0,d.T3)(b);let p=null!==t;(0,s.useEffect)(()=>{if(p)return m+=1,h(),()=>{m-=1,h()}},[p]);let g=(0,s.useCallback)(()=>{window.location.reload()},[]),v=(0,s.useCallback)(()=>{r(e=>(e&&x(e.serverVersion),null))},[]);return t?(0,n.jsxs)("div",{"data-testid":"version-mismatch-banner",role:"alert","aria-live":"assertive",className:"fixed top-3 left-1/2 -translate-x-1/2 flex items-start gap-3 max-w-[92vw] rounded-lg border border-warning-border bg-warning-subtle px-4 py-3 text-warning-foreground shadow-lg",style:{zIndex:c.M.TOAST},children:[(0,n.jsx)(o.A,{className:"h-5 w-5 shrink-0 mt-0.5","aria-hidden":"true"}),(0,n.jsxs)("div",{className:"flex flex-col gap-0.5 text-sm",children:[(0,n.jsx)("span",{className:"font-semibold",children:e("versionMismatch.title")}),(0,n.jsx)("span",{children:e("versionMismatch.description",{serverVersion:t.serverVersion,clientVersion:t.clientVersion})})]}),(0,n.jsxs)("button",{type:"button","data-testid":"version-mismatch-reload",onClick:g,className:"shrink-0 inline-flex items-center gap-1.5 rounded-md border border-warning-border px-3 py-1.5 text-sm font-medium hover:opacity-80 focus:outline-none focus:ring-2 focus:ring-offset-2",children:[(0,n.jsx)(i.A,{className:"h-4 w-4","aria-hidden":"true"}),e("versionMismatch.reload")]}),(0,n.jsx)("button",{type:"button","data-testid":"version-mismatch-dismiss",onClick:v,"aria-label":e("versionMismatch.dismiss"),className:"shrink-0 hover:opacity-70 focus:outline-none focus:ring-2 focus:ring-offset-2",children:(0,n.jsx)(l.A,{className:"h-4 w-4","aria-hidden":"true"})})]}):null}},80903:(e,t,r)=>{Promise.resolve().then(r.t.bind(r,22311,23)),Promise.resolve().then(r.t.bind(r,7183,23)),Promise.resolve().then(r.t.bind(r,13673,23)),Promise.resolve().then(r.bind(r,62295)),Promise.resolve().then(r.bind(r,25772))}},e=>{e.O(0,[5373,2978,6809,4909,2770,2619,6192,8318,8407,2407,344,5449,6966,8606,4768,8165,9619,8441,1255,7358],()=>e(e.s=80903)),_N_E=e.O()}]);
|