@alexjbarnes/cockpit 0.4.0 → 0.4.1
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/build-manifest.json +2 -2
- package/.next/prerender-manifest.json +3 -3
- package/.next/server/app/(app)/agents/[name]/page.js +1 -1
- package/.next/server/app/(app)/agents/[name]/page.js.nft.json +1 -1
- package/.next/server/app/(app)/agents/[name]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/agents/page.js +2 -2
- package/.next/server/app/(app)/agents/page.js.nft.json +1 -1
- package/.next/server/app/(app)/agents/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/claude-md/edit/page.js +1 -1
- package/.next/server/app/(app)/claude-md/edit/page.js.nft.json +1 -1
- package/.next/server/app/(app)/claude-md/edit/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/claude-md/page.js +1 -1
- package/.next/server/app/(app)/claude-md/page.js.nft.json +1 -1
- package/.next/server/app/(app)/claude-md/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/commands/[name]/page.js +1 -1
- package/.next/server/app/(app)/commands/[name]/page.js.nft.json +1 -1
- package/.next/server/app/(app)/commands/[name]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/commands/page.js +2 -2
- package/.next/server/app/(app)/commands/page.js.nft.json +1 -1
- package/.next/server/app/(app)/commands/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/hooks/[event]/page.js +1 -1
- package/.next/server/app/(app)/hooks/[event]/page.js.nft.json +1 -1
- package/.next/server/app/(app)/hooks/[event]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/hooks/page.js +2 -2
- package/.next/server/app/(app)/hooks/page.js.nft.json +1 -1
- package/.next/server/app/(app)/hooks/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/inbox/[id]/page.js +1 -1
- package/.next/server/app/(app)/inbox/[id]/page.js.nft.json +1 -1
- package/.next/server/app/(app)/inbox/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/inbox/page.js +2 -2
- package/.next/server/app/(app)/inbox/page.js.nft.json +1 -1
- package/.next/server/app/(app)/inbox/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/jobs/[id]/edit/page.js +2 -2
- package/.next/server/app/(app)/jobs/[id]/edit/page.js.nft.json +1 -1
- package/.next/server/app/(app)/jobs/[id]/edit/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/jobs/[id]/page.js +1 -1
- package/.next/server/app/(app)/jobs/[id]/page.js.nft.json +1 -1
- package/.next/server/app/(app)/jobs/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/jobs/[id]/runs/[runId]/page.js +1 -1
- package/.next/server/app/(app)/jobs/[id]/runs/[runId]/page.js.nft.json +1 -1
- package/.next/server/app/(app)/jobs/[id]/runs/[runId]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/jobs/page.js +2 -2
- package/.next/server/app/(app)/jobs/page.js.nft.json +1 -1
- package/.next/server/app/(app)/jobs/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/mcp-servers/[name]/page.js +1 -1
- package/.next/server/app/(app)/mcp-servers/[name]/page.js.nft.json +1 -1
- package/.next/server/app/(app)/mcp-servers/[name]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/mcp-servers/page.js +2 -2
- package/.next/server/app/(app)/mcp-servers/page.js.nft.json +1 -1
- package/.next/server/app/(app)/mcp-servers/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/page.js +2 -2
- package/.next/server/app/(app)/page.js.nft.json +1 -1
- package/.next/server/app/(app)/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/plugins/page.js +2 -2
- package/.next/server/app/(app)/plugins/page.js.nft.json +1 -1
- package/.next/server/app/(app)/plugins/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/reviews/[owner]/[repo]/[number]/page.js +1 -1
- package/.next/server/app/(app)/reviews/[owner]/[repo]/[number]/page.js.nft.json +1 -1
- package/.next/server/app/(app)/reviews/[owner]/[repo]/[number]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/reviews/[owner]/[repo]/page.js +1 -1
- package/.next/server/app/(app)/reviews/[owner]/[repo]/page.js.nft.json +1 -1
- package/.next/server/app/(app)/reviews/[owner]/[repo]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/reviews/page.js +2 -2
- package/.next/server/app/(app)/reviews/page.js.nft.json +1 -1
- package/.next/server/app/(app)/reviews/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/sessions/[id]/page.js +1 -1
- package/.next/server/app/(app)/sessions/[id]/page.js.nft.json +1 -1
- package/.next/server/app/(app)/sessions/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/settings/appearance/page.js +1 -1
- package/.next/server/app/(app)/settings/appearance/page.js.nft.json +1 -1
- package/.next/server/app/(app)/settings/appearance/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/settings/notifications/page.js +1 -1
- package/.next/server/app/(app)/settings/notifications/page.js.nft.json +1 -1
- package/.next/server/app/(app)/settings/notifications/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/settings/page.js +1 -1
- package/.next/server/app/(app)/settings/page.js.nft.json +1 -1
- package/.next/server/app/(app)/settings/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/settings/providers/[id]/page.js +1 -1
- package/.next/server/app/(app)/settings/providers/[id]/page.js.nft.json +1 -1
- package/.next/server/app/(app)/settings/providers/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/settings/providers/new/page.js +1 -1
- package/.next/server/app/(app)/settings/providers/new/page.js.nft.json +1 -1
- package/.next/server/app/(app)/settings/providers/new/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/settings/providers/page.js +1 -1
- package/.next/server/app/(app)/settings/providers/page.js.nft.json +1 -1
- package/.next/server/app/(app)/settings/providers/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/settings/session/page.js +2 -2
- package/.next/server/app/(app)/settings/session/page.js.nft.json +1 -1
- package/.next/server/app/(app)/settings/session/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/skills/[name]/page.js +1 -1
- package/.next/server/app/(app)/skills/[name]/page.js.nft.json +1 -1
- package/.next/server/app/(app)/skills/[name]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/skills/page.js +2 -2
- package/.next/server/app/(app)/skills/page.js.nft.json +1 -1
- package/.next/server/app/(app)/skills/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +2 -2
- package/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/agents.html +1 -1
- package/.next/server/app/agents.rsc +4 -4
- package/.next/server/app/agents.segments/!KGFwcCk/agents/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/agents.segments/!KGFwcCk/agents.segment.rsc +1 -1
- package/.next/server/app/agents.segments/!KGFwcCk.segment.rsc +2 -2
- package/.next/server/app/agents.segments/_full.segment.rsc +4 -4
- package/.next/server/app/agents.segments/_head.segment.rsc +1 -1
- package/.next/server/app/agents.segments/_index.segment.rsc +2 -2
- package/.next/server/app/agents.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/api/jobs/[id]/runs/[runId]/route.js +1 -1
- package/.next/server/app/api/jobs/[id]/runs/route.js +1 -1
- package/.next/server/app/api/jobs/status/route.js +1 -1
- package/.next/server/app/api/plugins/[id]/route.js +1 -1
- package/.next/server/app/api/plugins/install/route.js +1 -1
- package/.next/server/app/api/plugins/marketplaces/[name]/route.js +1 -1
- package/.next/server/app/api/plugins/marketplaces/route.js +1 -1
- package/.next/server/app/api/plugins/route.js +1 -1
- package/.next/server/app/api/providers/[id]/route.js +1 -1
- package/.next/server/app/api/providers/route.js +1 -1
- package/.next/server/app/api/sessions/[id]/tabs/route.js +1 -1
- package/.next/server/app/claude-md/edit.html +1 -1
- package/.next/server/app/claude-md/edit.rsc +4 -4
- package/.next/server/app/claude-md/edit.segments/!KGFwcCk/claude-md/edit/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/claude-md/edit.segments/!KGFwcCk/claude-md/edit.segment.rsc +1 -1
- package/.next/server/app/claude-md/edit.segments/!KGFwcCk/claude-md.segment.rsc +1 -1
- package/.next/server/app/claude-md/edit.segments/!KGFwcCk.segment.rsc +2 -2
- package/.next/server/app/claude-md/edit.segments/_full.segment.rsc +4 -4
- package/.next/server/app/claude-md/edit.segments/_head.segment.rsc +1 -1
- package/.next/server/app/claude-md/edit.segments/_index.segment.rsc +2 -2
- package/.next/server/app/claude-md/edit.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/claude-md.html +1 -1
- package/.next/server/app/claude-md.rsc +4 -4
- package/.next/server/app/claude-md.segments/!KGFwcCk/claude-md/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/claude-md.segments/!KGFwcCk/claude-md.segment.rsc +1 -1
- package/.next/server/app/claude-md.segments/!KGFwcCk.segment.rsc +2 -2
- package/.next/server/app/claude-md.segments/_full.segment.rsc +4 -4
- package/.next/server/app/claude-md.segments/_head.segment.rsc +1 -1
- package/.next/server/app/claude-md.segments/_index.segment.rsc +2 -2
- package/.next/server/app/claude-md.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/commands.html +1 -1
- package/.next/server/app/commands.rsc +4 -4
- package/.next/server/app/commands.segments/!KGFwcCk/commands/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/commands.segments/!KGFwcCk/commands.segment.rsc +1 -1
- package/.next/server/app/commands.segments/!KGFwcCk.segment.rsc +2 -2
- package/.next/server/app/commands.segments/_full.segment.rsc +4 -4
- package/.next/server/app/commands.segments/_head.segment.rsc +1 -1
- package/.next/server/app/commands.segments/_index.segment.rsc +2 -2
- package/.next/server/app/commands.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/hooks.html +1 -1
- package/.next/server/app/hooks.rsc +4 -4
- package/.next/server/app/hooks.segments/!KGFwcCk/hooks/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/hooks.segments/!KGFwcCk/hooks.segment.rsc +1 -1
- package/.next/server/app/hooks.segments/!KGFwcCk.segment.rsc +2 -2
- package/.next/server/app/hooks.segments/_full.segment.rsc +4 -4
- package/.next/server/app/hooks.segments/_head.segment.rsc +1 -1
- package/.next/server/app/hooks.segments/_index.segment.rsc +2 -2
- package/.next/server/app/hooks.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/inbox.html +1 -1
- package/.next/server/app/inbox.rsc +4 -4
- package/.next/server/app/inbox.segments/!KGFwcCk/inbox/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/inbox.segments/!KGFwcCk/inbox.segment.rsc +1 -1
- package/.next/server/app/inbox.segments/!KGFwcCk.segment.rsc +2 -2
- package/.next/server/app/inbox.segments/_full.segment.rsc +4 -4
- package/.next/server/app/inbox.segments/_head.segment.rsc +1 -1
- package/.next/server/app/inbox.segments/_index.segment.rsc +2 -2
- package/.next/server/app/inbox.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/index.html +1 -1
- package/.next/server/app/index.rsc +4 -4
- package/.next/server/app/index.segments/!KGFwcCk/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/index.segments/!KGFwcCk.segment.rsc +2 -2
- package/.next/server/app/index.segments/_full.segment.rsc +4 -4
- package/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/.next/server/app/index.segments/_index.segment.rsc +2 -2
- package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/jobs.html +1 -1
- package/.next/server/app/jobs.rsc +4 -4
- package/.next/server/app/jobs.segments/!KGFwcCk/jobs/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/jobs.segments/!KGFwcCk/jobs.segment.rsc +1 -1
- package/.next/server/app/jobs.segments/!KGFwcCk.segment.rsc +2 -2
- package/.next/server/app/jobs.segments/_full.segment.rsc +4 -4
- package/.next/server/app/jobs.segments/_head.segment.rsc +1 -1
- package/.next/server/app/jobs.segments/_index.segment.rsc +2 -2
- package/.next/server/app/jobs.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/.next/server/app/login.html +1 -1
- package/.next/server/app/login.rsc +2 -2
- package/.next/server/app/login.segments/_full.segment.rsc +2 -2
- package/.next/server/app/login.segments/_head.segment.rsc +1 -1
- package/.next/server/app/login.segments/_index.segment.rsc +2 -2
- package/.next/server/app/login.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/login.segments/login/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/login.segments/login.segment.rsc +1 -1
- package/.next/server/app/mcp-servers.html +1 -1
- package/.next/server/app/mcp-servers.rsc +4 -4
- package/.next/server/app/mcp-servers.segments/!KGFwcCk/mcp-servers/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/mcp-servers.segments/!KGFwcCk/mcp-servers.segment.rsc +1 -1
- package/.next/server/app/mcp-servers.segments/!KGFwcCk.segment.rsc +2 -2
- package/.next/server/app/mcp-servers.segments/_full.segment.rsc +4 -4
- package/.next/server/app/mcp-servers.segments/_head.segment.rsc +1 -1
- package/.next/server/app/mcp-servers.segments/_index.segment.rsc +2 -2
- package/.next/server/app/mcp-servers.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/plugins.html +1 -1
- package/.next/server/app/plugins.rsc +4 -4
- package/.next/server/app/plugins.segments/!KGFwcCk/plugins/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/plugins.segments/!KGFwcCk/plugins.segment.rsc +1 -1
- package/.next/server/app/plugins.segments/!KGFwcCk.segment.rsc +2 -2
- package/.next/server/app/plugins.segments/_full.segment.rsc +4 -4
- package/.next/server/app/plugins.segments/_head.segment.rsc +1 -1
- package/.next/server/app/plugins.segments/_index.segment.rsc +2 -2
- package/.next/server/app/plugins.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/reviews.html +1 -1
- package/.next/server/app/reviews.rsc +4 -4
- package/.next/server/app/reviews.segments/!KGFwcCk/reviews/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/reviews.segments/!KGFwcCk/reviews.segment.rsc +1 -1
- package/.next/server/app/reviews.segments/!KGFwcCk.segment.rsc +2 -2
- package/.next/server/app/reviews.segments/_full.segment.rsc +4 -4
- package/.next/server/app/reviews.segments/_head.segment.rsc +1 -1
- package/.next/server/app/reviews.segments/_index.segment.rsc +2 -2
- package/.next/server/app/reviews.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/settings/appearance.html +1 -1
- package/.next/server/app/settings/appearance.rsc +4 -4
- package/.next/server/app/settings/appearance.segments/!KGFwcCk/settings/appearance/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/settings/appearance.segments/!KGFwcCk/settings/appearance.segment.rsc +1 -1
- package/.next/server/app/settings/appearance.segments/!KGFwcCk/settings.segment.rsc +1 -1
- package/.next/server/app/settings/appearance.segments/!KGFwcCk.segment.rsc +2 -2
- package/.next/server/app/settings/appearance.segments/_full.segment.rsc +4 -4
- package/.next/server/app/settings/appearance.segments/_head.segment.rsc +1 -1
- package/.next/server/app/settings/appearance.segments/_index.segment.rsc +2 -2
- package/.next/server/app/settings/appearance.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/settings/notifications.html +1 -1
- package/.next/server/app/settings/notifications.rsc +4 -4
- package/.next/server/app/settings/notifications.segments/!KGFwcCk/settings/notifications/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/settings/notifications.segments/!KGFwcCk/settings/notifications.segment.rsc +1 -1
- package/.next/server/app/settings/notifications.segments/!KGFwcCk/settings.segment.rsc +1 -1
- package/.next/server/app/settings/notifications.segments/!KGFwcCk.segment.rsc +2 -2
- package/.next/server/app/settings/notifications.segments/_full.segment.rsc +4 -4
- package/.next/server/app/settings/notifications.segments/_head.segment.rsc +1 -1
- package/.next/server/app/settings/notifications.segments/_index.segment.rsc +2 -2
- package/.next/server/app/settings/notifications.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/settings/providers/new.html +1 -1
- package/.next/server/app/settings/providers/new.rsc +4 -4
- package/.next/server/app/settings/providers/new.segments/!KGFwcCk/settings/providers/new/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/settings/providers/new.segments/!KGFwcCk/settings/providers/new.segment.rsc +1 -1
- package/.next/server/app/settings/providers/new.segments/!KGFwcCk/settings/providers.segment.rsc +1 -1
- package/.next/server/app/settings/providers/new.segments/!KGFwcCk/settings.segment.rsc +1 -1
- package/.next/server/app/settings/providers/new.segments/!KGFwcCk.segment.rsc +2 -2
- package/.next/server/app/settings/providers/new.segments/_full.segment.rsc +4 -4
- package/.next/server/app/settings/providers/new.segments/_head.segment.rsc +1 -1
- package/.next/server/app/settings/providers/new.segments/_index.segment.rsc +2 -2
- package/.next/server/app/settings/providers/new.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/settings/providers.html +1 -1
- package/.next/server/app/settings/providers.rsc +4 -4
- package/.next/server/app/settings/providers.segments/!KGFwcCk/settings/providers/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/settings/providers.segments/!KGFwcCk/settings/providers.segment.rsc +1 -1
- package/.next/server/app/settings/providers.segments/!KGFwcCk/settings.segment.rsc +1 -1
- package/.next/server/app/settings/providers.segments/!KGFwcCk.segment.rsc +2 -2
- package/.next/server/app/settings/providers.segments/_full.segment.rsc +4 -4
- package/.next/server/app/settings/providers.segments/_head.segment.rsc +1 -1
- package/.next/server/app/settings/providers.segments/_index.segment.rsc +2 -2
- package/.next/server/app/settings/providers.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/settings/session.html +1 -1
- package/.next/server/app/settings/session.rsc +4 -4
- package/.next/server/app/settings/session.segments/!KGFwcCk/settings/session/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/settings/session.segments/!KGFwcCk/settings/session.segment.rsc +1 -1
- package/.next/server/app/settings/session.segments/!KGFwcCk/settings.segment.rsc +1 -1
- package/.next/server/app/settings/session.segments/!KGFwcCk.segment.rsc +2 -2
- package/.next/server/app/settings/session.segments/_full.segment.rsc +4 -4
- package/.next/server/app/settings/session.segments/_head.segment.rsc +1 -1
- package/.next/server/app/settings/session.segments/_index.segment.rsc +2 -2
- package/.next/server/app/settings/session.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/settings.html +1 -1
- package/.next/server/app/settings.rsc +4 -4
- package/.next/server/app/settings.segments/!KGFwcCk/settings/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/settings.segments/!KGFwcCk/settings.segment.rsc +1 -1
- package/.next/server/app/settings.segments/!KGFwcCk.segment.rsc +2 -2
- package/.next/server/app/settings.segments/_full.segment.rsc +4 -4
- package/.next/server/app/settings.segments/_head.segment.rsc +1 -1
- package/.next/server/app/settings.segments/_index.segment.rsc +2 -2
- package/.next/server/app/settings.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/skills.html +1 -1
- package/.next/server/app/skills.rsc +4 -4
- package/.next/server/app/skills.segments/!KGFwcCk/skills/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/skills.segments/!KGFwcCk/skills.segment.rsc +1 -1
- package/.next/server/app/skills.segments/!KGFwcCk.segment.rsc +2 -2
- package/.next/server/app/skills.segments/_full.segment.rsc +4 -4
- package/.next/server/app/skills.segments/_head.segment.rsc +1 -1
- package/.next/server/app/skills.segments/_index.segment.rsc +2 -2
- package/.next/server/app/skills.segments/_tree.segment.rsc +2 -2
- package/.next/server/chunks/1011.js +1 -1
- package/.next/server/chunks/1979.js +4 -4
- package/.next/server/chunks/3136.js +3 -3
- package/.next/server/chunks/{5292.js → 4734.js} +2 -2
- package/.next/server/chunks/7891.js +3 -1
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/static/chunks/{25781-c77dc5d11fb85d82.js → 14371-46bd93e838a73082.js} +1 -1
- package/.next/static/chunks/{1550-9a32fa02f6722fc7.js → 1550-2b61396833da3dec.js} +4 -4
- package/.next/static/chunks/86939-ba1fb2321ef9cd80.js +1 -0
- package/.next/static/chunks/app/(app)/agents/[name]/{page-6954a12623e4bdcf.js → page-2b04446e17990f1a.js} +1 -1
- package/.next/static/chunks/app/(app)/agents/page-ba23fc2296a7be83.js +1 -0
- package/.next/static/chunks/app/(app)/claude-md/edit/{page-575c5ccdc585516c.js → page-a281913e0b8add64.js} +1 -1
- package/.next/static/chunks/app/(app)/claude-md/{page-aab6df0c14c657f3.js → page-2d96e3554ef23d18.js} +1 -1
- package/.next/static/chunks/app/(app)/commands/[name]/{page-ea86a4400fd29210.js → page-fb34a46c0c086dab.js} +1 -1
- package/.next/static/chunks/app/(app)/commands/page-3802984c62d8ac69.js +1 -0
- package/.next/static/chunks/app/(app)/hooks/[event]/{page-2c41e810c15a1149.js → page-9481839e736408cb.js} +1 -1
- package/.next/static/chunks/app/(app)/hooks/page-f430735f702c7219.js +1 -0
- package/.next/static/chunks/app/(app)/inbox/[id]/{page-885a258b67e47b00.js → page-aadeab885f4845b0.js} +1 -1
- package/.next/static/chunks/app/(app)/inbox/page-b95594cb0a1a5cac.js +1 -0
- package/.next/static/chunks/app/(app)/jobs/[id]/edit/page-cc5a314765daff0b.js +1 -0
- package/.next/static/chunks/app/(app)/jobs/[id]/{page-ba516fa01db89ea0.js → page-5890d22a832830ae.js} +1 -1
- package/.next/static/chunks/app/(app)/jobs/[id]/runs/[runId]/{page-0650e6f678fae5b8.js → page-0b99d3ca8a0db5a4.js} +1 -1
- package/.next/static/chunks/app/(app)/jobs/page-3112e52c1cf2a1c6.js +1 -0
- package/.next/static/chunks/app/(app)/{layout-3cd80708648e0723.js → layout-62bd7715bd974abb.js} +1 -1
- package/.next/static/chunks/app/(app)/mcp-servers/[name]/{page-9290a7940a32d9ac.js → page-c8586b1dc6f9824d.js} +1 -1
- package/.next/static/chunks/app/(app)/mcp-servers/page-bfc2a6ca8f7968c9.js +1 -0
- package/.next/static/chunks/app/(app)/page-7fa2e1ffac49c78b.js +1 -0
- package/.next/static/chunks/app/(app)/plugins/page-f37a96c5d3bd20a1.js +1 -0
- package/.next/static/chunks/app/(app)/reviews/[owner]/[repo]/[number]/{page-4396e9d6df189336.js → page-9bdb676f496d53bd.js} +1 -1
- package/.next/static/chunks/app/(app)/reviews/[owner]/[repo]/{page-76a072cbfe3d9f0e.js → page-200fefe31b935564.js} +1 -1
- package/.next/static/chunks/app/(app)/reviews/page-2b8118a506454063.js +1 -0
- package/.next/static/chunks/app/(app)/sessions/[id]/{page-95bcce2e0b9f827a.js → page-428e74d62712abe2.js} +1 -1
- package/.next/static/chunks/app/(app)/settings/appearance/{page-433fcfb9b95fb22e.js → page-e2b21c857330b047.js} +1 -1
- package/.next/static/chunks/app/(app)/settings/notifications/{page-e5309337f125a059.js → page-4c4e5802b3993e7f.js} +1 -1
- package/.next/static/chunks/app/(app)/settings/page-3c1d956c719f0160.js +1 -0
- package/.next/static/chunks/app/(app)/settings/providers/[id]/{page-2cacea2e60ba435c.js → page-020f2eab5c3a93ee.js} +1 -1
- package/.next/static/chunks/app/(app)/settings/providers/new/{page-d40acef3abfc7c19.js → page-9010d32aeca78d7f.js} +1 -1
- package/.next/static/chunks/app/(app)/settings/providers/{page-098d8f399c663944.js → page-d86ebcd6d1cb033d.js} +1 -1
- package/.next/static/chunks/app/(app)/settings/session/page-174370077dbb9079.js +1 -0
- package/.next/static/chunks/app/(app)/skills/[name]/{page-7dd7c0f316742c01.js → page-dfea5f58b95c01b6.js} +1 -1
- package/.next/static/chunks/app/(app)/skills/page-c33dbb722dbdf826.js +1 -0
- package/.next/static/css/4cc7360c7e3ca504.css +1 -0
- package/dist/src/lib/models.js +49 -1
- package/dist/src/server/claude-bin.js +14 -3
- package/dist/src/server/claude-settings.js +3 -0
- package/dist/src/server/mcp/cockpit-config-server.js +1 -1
- package/dist/src/server/pty-runtime.js +1 -0
- package/dist/src/server/session-manager.js +65 -25
- package/dist/src/server/transcript.js +26 -5
- package/dist/src/server/ws-handler.js +1 -1
- package/package.json +1 -1
- package/.next/static/chunks/86939-51ae17d3d12c0310.js +0 -1
- package/.next/static/chunks/app/(app)/agents/page-b984c01f39aed22e.js +0 -1
- package/.next/static/chunks/app/(app)/commands/page-3867a45c1378c6fe.js +0 -1
- package/.next/static/chunks/app/(app)/hooks/page-49f9dbb78a3f97df.js +0 -1
- package/.next/static/chunks/app/(app)/inbox/page-592249fc155b9fe4.js +0 -1
- package/.next/static/chunks/app/(app)/jobs/[id]/edit/page-121bf977a839488c.js +0 -1
- package/.next/static/chunks/app/(app)/jobs/page-da3fe23a43277e67.js +0 -1
- package/.next/static/chunks/app/(app)/mcp-servers/page-1e828264f81ee08c.js +0 -1
- package/.next/static/chunks/app/(app)/page-2d171ffc3e1945e1.js +0 -1
- package/.next/static/chunks/app/(app)/plugins/page-7e70e0b3ead44a99.js +0 -1
- package/.next/static/chunks/app/(app)/reviews/page-deaa44f0ce253da8.js +0 -1
- package/.next/static/chunks/app/(app)/settings/page-353ef8c508418af1.js +0 -1
- package/.next/static/chunks/app/(app)/settings/session/page-706118ba33c2b99f.js +0 -1
- package/.next/static/chunks/app/(app)/skills/page-48d0bbe201180fc8.js +0 -1
- package/.next/static/css/483101dd9c42fb97.css +0 -1
- /package/.next/static/{mmHo0MmzQHWjZATtI-VbH → NTa6G91R3HtKCLYuQqdR0}/_buildManifest.js +0 -0
- /package/.next/static/{mmHo0MmzQHWjZATtI-VbH → NTa6G91R3HtKCLYuQqdR0}/_ssgManifest.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[67797],{61239:(e,s,t)=>{Promise.resolve().then(t.bind(t,78357))},74180:(e,s,t)=>{"use strict";t.d(s,{R:()=>a});var n=t(12115);function a(e){let s=(0,n.useRef)(null);return(0,n.useCallback)(t=>{if(s.current?.(),s.current=null,!t)return;let n=sessionStorage.getItem(e),a=null!==n?Number(n):NaN,r=Number.isFinite(a)&&a>0,l=0,c=0,i=()=>{r=!1,l&&cancelAnimationFrame(l),l=0,t.removeEventListener("wheel",i),t.removeEventListener("touchstart",i),t.removeEventListener("keydown",i)};if(r)if(t.scrollTop=a,2>Math.abs(t.scrollTop-a))r=!1;else{let e=0,s=()=>{if(r){if(t.scrollTop=a,e++,2>Math.abs(t.scrollTop-a)||e>120)return void i();l=requestAnimationFrame(s)}};t.addEventListener("wheel",i,{passive:!0}),t.addEventListener("touchstart",i,{passive:!0}),t.addEventListener("keydown",i),l=requestAnimationFrame(s)}let o=()=>{r||c||(c=requestAnimationFrame(()=>{c=0,sessionStorage.setItem(e,String(t.scrollTop))}))};t.addEventListener("scroll",o,{passive:!0}),s.current=()=>{let s=r;i(),c&&cancelAnimationFrame(c),t.removeEventListener("scroll",o),s||sessionStorage.setItem(e,String(t.scrollTop))}},[e])}},78357:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>f});var n=t(95155),a=t(2125),r=t(76721),l=t(92571),c=t(31966),i=t(73321),o=t(12115),d=t(1550),m=t(41158),x=t(45160),u=t(89239),h=t(81477),j=t(42763),p=t(74180);function f(){(0,d.si)("MCP Servers",{hideActions:!0});let e=(0,i.useSearchParams)(),s=(0,i.useRouter)(),t=e.get("mcp"),a=e.get("scope")||"user",r="u">typeof localStorage&&localStorage.getItem("cockpit-agents-cwd")||void 0,{servers:l,loading:c,getServer:m,deleteServer:x}=function(e){let[s,t]=(0,o.useState)([]),[n,a]=(0,o.useState)(!0),r=(0,o.useCallback)(()=>{a(!0);let s=new URLSearchParams;e&&s.set("cwd",e),fetch(`/api/mcp-servers?${s}`).then(e=>e.json()).then(e=>t(e.servers)).catch(()=>t([])).finally(()=>a(!1))},[e]);(0,o.useEffect)(()=>{r()},[r]);let l=(0,o.useCallback)(async(e,s,t)=>{let n=new URLSearchParams({scope:s});"project"===s&&t&&n.set("cwd",t);try{let s=await fetch(`/api/mcp-servers/${encodeURIComponent(e)}?${n}`);if(!s.ok)return null;return s.json()}catch{return null}},[]),c=(0,o.useCallback)(async(s,t)=>{let n=new URLSearchParams({scope:t});"project"===t&&e&&n.set("cwd",e);try{if((await fetch(`/api/mcp-servers/${encodeURIComponent(s)}?${n}`,{method:"DELETE"})).ok)return r(),!0;return!1}catch{return!1}},[e,r]);return{servers:s,loading:n,refresh:r,getServer:l,deleteServer:c}}(r);return t?(0,n.jsx)(g,{name:t,scope:a,cwd:r,onBack:()=>s.push("/mcp-servers"),getServer:m,onDelete:async(e,s)=>await x(e,s)}):(0,n.jsx)(v,{servers:l,loading:c})}function v({servers:e,loading:s}){let t=(0,i.useRouter)(),r=(0,p.R)("mcp-servers-scroll"),[l,c]=(0,o.useState)(!1),[d,x]=(0,o.useState)(!1),f=e.filter(e=>"user"===e.scope),g=e.filter(e=>"project"===e.scope);function w(e,s){c(!1),x(!1);let n=new URLSearchParams({scope:e});"project"===e&&s&&n.set("cwd",s),t.push(`/mcp-servers/new?${n}`)}function b(e,s){t.push(`/mcp-servers?mcp=${encodeURIComponent(e)}&scope=${s}`)}return(0,n.jsxs)("div",{ref:r,className:"flex-1 min-h-0 overflow-y-auto p-4 space-y-4",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("div",{}),(0,n.jsxs)(u.$,{size:"sm",onClick:()=>c(!0),children:[(0,n.jsx)(a.A,{className:"h-4 w-4 mr-1"}),"New Server"]})]}),s&&(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading servers..."}),!s&&0===e.length&&(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"No MCP servers configured. Add one to get started."}),f.length>0&&(0,n.jsxs)(h.Zp,{children:[(0,n.jsx)(h.aR,{children:(0,n.jsx)(h.ZB,{className:"text-base",children:"Global"})}),(0,n.jsx)(h.Wu,{className:"space-y-1",children:f.map(e=>(0,n.jsx)(N,{name:e.name,type:e.type,detail:e.command||e.url,onClick:()=>b(e.name,"user")},e.name))})]}),g.length>0&&(0,n.jsxs)(h.Zp,{children:[(0,n.jsx)(h.aR,{children:(0,n.jsx)(h.ZB,{className:"text-base",children:"Project"})}),(0,n.jsx)(h.Wu,{className:"space-y-1",children:g.map(e=>(0,n.jsx)(N,{name:e.name,type:e.type,detail:e.command||e.url,onClick:()=>b(e.name,"project")},e.name))})]}),(0,n.jsx)(j.lG,{open:l,onOpenChange:e=>{c(e),e||x(!1)},children:(0,n.jsxs)(j.Cf,{children:[(0,n.jsx)(j.c7,{children:(0,n.jsx)(j.L3,{children:"New MCP Server"})}),d?(0,n.jsx)(m.K,{onSelect:e=>w("project",e),onCancel:()=>x(!1)}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"Where should this server be saved?"}),(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)(u.$,{variant:"outline",className:"flex-1",onClick:()=>w("user"),children:"Global"}),(0,n.jsx)(u.$,{variant:"outline",className:"flex-1",onClick:()=>x(!0),children:"Project"})]})]})]})})]})}function N({name:e,type:s,detail:t,onClick:a}){return(0,n.jsxs)("button",{type:"button",onClick:a,className:"flex w-full items-center gap-3 rounded px-2 py-2 hover:bg-muted transition-colors text-left",children:[(0,n.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{className:"font-mono font-bold text-sm truncate",children:e}),(0,n.jsx)(x.E,{variant:"secondary",className:"text-[10px]",children:s})]}),t&&(0,n.jsx)("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:t})]}),(0,n.jsx)(r.A,{className:"h-4 w-4 text-muted-foreground shrink-0"})]})}function g({name:e,scope:s,cwd:t,onBack:a,getServer:r,onDelete:c}){let d=decodeURIComponent(e),m=(0,i.useRouter)(),[p,f]=(0,o.useState)(null),[v,N]=(0,o.useState)(!0),[b,y]=(0,o.useState)(!1),[k,C]=(0,o.useState)(null),[S,R]=(0,o.useState)(null),[$,E]=(0,o.useState)(null),[L,P]=(0,o.useState)(!1);async function A(){C("test"),R(null),E(null);try{let e=new URLSearchParams({scope:s});"project"===s&&t&&e.set("cwd",t);let n=await fetch(`/api/mcp-servers/${encodeURIComponent(d)}/test?${e}`,{method:"POST"}),a=await n.json();E(a)}catch{E({success:!1,logs:"Request failed"})}finally{C(null)}}async function U(){P(!1),C("delete"),R(null),await c(d,s)?a():(R("Failed to delete server"),C(null))}if((0,o.useEffect)(()=>{r(d,s,t).then(e=>{e?.config?f(e.config):y(!0)}).catch(()=>y(!0)).finally(()=>N(!1))},[d,s,t,r]),v)return(0,n.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto p-4 space-y-4",children:[(0,n.jsx)(w,{onClick:a}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading..."})]});if(b||!p)return(0,n.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto p-4 space-y-4",children:[(0,n.jsx)(w,{onClick:a}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"Server not found."})]});let T=p.type||(p.command?"stdio":p.url?"http":"stdio"),I=p.env?Object.keys(p.env):[],F=p.headers?Object.keys(p.headers):[];return(0,n.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto p-4 space-y-6",children:[(0,n.jsx)(w,{onClick:a}),(0,n.jsx)("div",{children:(0,n.jsx)("h1",{className:"font-mono font-bold text-lg",children:d})}),S&&(0,n.jsx)("div",{className:"rounded border border-red-500/30 bg-red-500/5 p-3 text-sm text-red-500",children:S}),(0,n.jsxs)(h.Zp,{children:[(0,n.jsx)(h.aR,{children:(0,n.jsx)(h.ZB,{className:"text-sm",children:"Details"})}),(0,n.jsxs)(h.Wu,{className:"space-y-3 text-sm",children:[(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Scope"}),(0,n.jsx)(x.E,{variant:"secondary",className:"text-[10px]",children:"user"===s?"Global":"Project"})]}),(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Type"}),(0,n.jsx)("span",{className:"font-mono",children:T})]}),p.command&&(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Command"}),(0,n.jsx)("span",{className:"font-mono text-xs truncate ml-4 max-w-[60%] text-right",title:p.command,children:p.command})]}),p.args&&p.args.length>0&&(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Arguments"}),(0,n.jsx)("span",{className:"font-mono text-xs text-right max-w-[60%] break-words",title:p.args.join(" "),children:p.args.join(", ")})]}),p.url&&(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"URL"}),(0,n.jsx)("span",{className:"font-mono text-xs truncate ml-4 max-w-[60%] text-right",title:p.url,children:p.url})]}),I.length>0&&(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Environment"}),(0,n.jsx)("span",{className:"text-xs text-right max-w-[60%] break-words",children:I.map(e=>(0,n.jsxs)("span",{className:"block font-mono",children:[e,"=",p.env[e]]},e))})]}),F.length>0&&(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Headers"}),(0,n.jsx)("span",{className:"text-xs text-right max-w-[60%] break-words",children:F.map(e=>(0,n.jsxs)("span",{className:"block font-mono",children:[e,": ",p.headers[e]]},e))})]})]})]}),(0,n.jsxs)(h.Zp,{children:[(0,n.jsx)(h.aR,{children:(0,n.jsx)(h.ZB,{className:"text-sm",children:"Actions"})}),(0,n.jsxs)(h.Wu,{className:"space-y-3",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("span",{className:"text-sm",children:"Test connection"}),(0,n.jsx)(u.$,{size:"sm",variant:"outline",onClick:A,disabled:null!==k,children:"test"===k?(0,n.jsx)(l.A,{className:"h-4 w-4 animate-spin"}):"Test"})]}),$&&(0,n.jsxs)("div",{className:`rounded border p-2 text-xs ${$.success?"border-green-500/30 bg-green-500/5":"border-red-500/30 bg-red-500/5"}`,children:[(0,n.jsxs)("div",{className:"flex items-center gap-1.5 mb-1",children:[(0,n.jsx)("span",{className:`inline-block h-2 w-2 rounded-full ${$.success?"bg-green-500":"bg-red-500"}`}),(0,n.jsx)("span",{className:"font-medium",children:$.success?"Connected":"Failed"})]}),(0,n.jsx)("pre",{className:"whitespace-pre-wrap text-muted-foreground font-mono leading-relaxed",children:$.logs})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("span",{className:"text-sm",children:"Edit configuration"}),(0,n.jsx)(u.$,{size:"sm",variant:"outline",onClick:function(){let e=new URLSearchParams({scope:s});"project"===s&&t&&e.set("cwd",t),m.push(`/mcp-servers/${encodeURIComponent(d)}?${e}`)},disabled:null!==k,children:"Edit"})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("span",{className:"text-sm",children:"Delete server"}),(0,n.jsx)(u.$,{size:"sm",variant:"destructive",onClick:()=>P(!0),disabled:null!==k,children:"delete"===k?(0,n.jsx)(l.A,{className:"h-4 w-4 animate-spin"}):"Delete"})]})]})]}),(0,n.jsx)(j.lG,{open:L,onOpenChange:P,children:(0,n.jsxs)(j.Cf,{children:[(0,n.jsx)(j.c7,{children:(0,n.jsx)(j.L3,{children:"Delete Server"})}),(0,n.jsxs)("p",{className:"text-sm text-muted-foreground mb-4",children:["Delete ",(0,n.jsx)("span",{className:"font-mono font-bold",children:d}),"? This cannot be undone."]}),(0,n.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,n.jsx)(u.$,{variant:"outline",onClick:()=>P(!1),children:"Cancel"}),(0,n.jsx)(u.$,{variant:"destructive",onClick:U,children:"Delete"})]})]})})]})}function w({onClick:e}){return(0,n.jsxs)("button",{type:"button",onClick:e,className:"inline-flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[(0,n.jsx)(c.A,{className:"h-4 w-4"}),"Back to MCP Servers"]})}}},e=>{e.O(0,[989,14371,1550,28441,93794,77358],()=>e(e.s=61239)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[29415],{14683:(e,t,s)=>{Promise.resolve().then(s.bind(s,49524))},49524:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>P});var n=s(95155),r=s(1550),l=s(76721),a=s(14225),o=s(65738),i=s(2125);let c=(0,s(99537).A)("star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);var d=s(16449),u=s(49804),m=s(73321),x=s(12115),h=s(45160),p=s(89239),f=s(42763),g=s(89323),j=s(64577),w=s(99314),v=s(65377),b=s(92571),N=s(9005),y=s(9751),k=s(81477),S=s(16617);function C({preview:e,matchStart:t,matchLength:s}){let r=e.slice(0,t),l=e.slice(t,t+s),a=e.slice(t+s);return(0,n.jsxs)("span",{className:"text-sm text-muted-foreground whitespace-pre-wrap break-words select-text",children:[r,(0,n.jsx)("mark",{className:"bg-yellow-300/30 text-foreground rounded-sm px-0.5",children:l}),a]})}function E({text:e}){let[t,s]=(0,x.useState)(!1),r=(0,x.useCallback)(t=>{t.stopPropagation(),navigator.clipboard.writeText(e),s(!0),setTimeout(()=>s(!1),1500)},[e]);return(0,n.jsx)(p.$,{variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0",onClick:r,title:"Copy full message",children:t?(0,n.jsx)(j.A,{className:"h-3 w-3"}):(0,n.jsx)(w.A,{className:"h-3 w-3"})})}function $({onClose:e}){let[t,s]=(0,x.useState)(""),[r,l]=(0,x.useState)([]),[o,i]=(0,x.useState)(!1),[c,d]=(0,x.useState)(!1),[u,f]=(0,x.useState)(!1),[g,j]=(0,x.useState)(null),[w,A]=(0,x.useState)(null),L=(0,x.useRef)(null),D=(0,x.useRef)(null),T=(0,m.useRouter)(),I=(0,x.useCallback)(t=>{T.push(`/sessions/${t.sessionId}?cwd=${encodeURIComponent(t.cwd)}&historyView=true`),e()},[T,e]);(0,x.useEffect)(()=>{L.current?.focus()},[]);let R=(0,x.useCallback)((e,t,s)=>fetch(`/api/sessions/search?q=${encodeURIComponent(e)}&offset=${t}`,{signal:s}).then(e=>e.json()),[]);(0,x.useEffect)(()=>{if(t.length<2){l([]),f(!1),j(null);return}let e=setTimeout(()=>{D.current?.abort();let e=new AbortController;D.current=e,i(!0),R(t,0,e.signal).then(t=>{e.signal.aborted||(l(t.results||[]),j({total:t.totalFilesSearched||0,truncated:!!t.truncated}),f(!0),i(!1))}).catch(e=>{"AbortError"!==e.name&&(i(!1),f(!0))})},500);return()=>{clearTimeout(e)}},[t,R]);let F=(0,x.useCallback)(()=>{if(c||!g?.truncated)return;d(!0);let e=new AbortController;R(t,r.length,e.signal).then(e=>{l(t=>[...t,...e.results||[]]),j({total:e.totalFilesSearched||0,truncated:!!e.truncated}),d(!1)}).catch(()=>{d(!1)})},[t,r.length,c,g?.truncated,R]);(0,x.useEffect)(()=>()=>{D.current?.abort()},[]);let O=(0,x.useCallback)(t=>{t.target===t.currentTarget&&e()},[e]);return(0,x.useEffect)(()=>{let t=t=>{"Escape"===t.key&&(t.preventDefault(),t.stopPropagation(),e())};return window.addEventListener("keydown",t,!0),()=>window.removeEventListener("keydown",t,!0)},[e]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"fixed inset-0 z-50 bg-black/50 flex items-center justify-center p-4",onClick:O,children:(0,n.jsxs)(k.Zp,{className:"w-full max-w-2xl flex flex-col",style:{maxHeight:"calc(100dvh - 2rem)"},children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 p-4 border-b",children:[(0,n.jsx)(v.A,{className:"h-4 w-4 text-muted-foreground shrink-0"}),(0,n.jsx)("input",{ref:L,value:t,onChange:e=>s(e.target.value),placeholder:"Search all session messages...",className:"flex-1 bg-transparent outline-none text-sm"}),o&&(0,n.jsx)(b.A,{className:"h-4 w-4 animate-spin text-muted-foreground shrink-0"}),(0,n.jsx)(p.$,{variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0",onClick:e,children:(0,n.jsx)(N.A,{className:"h-4 w-4"})})]}),(0,n.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto",children:[u&&0===r.length&&(0,n.jsx)("div",{className:"p-8 text-center text-sm text-muted-foreground",children:"No results"}),r.map((e,t)=>(0,n.jsxs)("div",{role:"button",tabIndex:0,onClick:()=>A(e),onKeyDown:t=>{("Enter"===t.key||" "===t.key)&&(t.preventDefault(),A(e))},className:"w-full text-left p-4 border-b last:border-b-0 hover:bg-muted/50 transition-colors cursor-pointer",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,n.jsx)(h.E,{variant:"user"===e.role?"default":"secondary",className:"text-[10px] px-1.5 py-0",children:"user"===e.role?"User":"Assistant"}),(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:new Date(e.timestamp).toLocaleString()}),(0,n.jsxs)("div",{className:"ml-auto flex items-center gap-1",children:[(0,n.jsx)(p.$,{variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0",title:"Open session",onClick:t=>{t.stopPropagation(),I(e)},children:(0,n.jsx)(y.A,{className:"h-3 w-3"})}),(0,n.jsx)(E,{text:e.fullContent})]})]}),(0,n.jsxs)("div",{className:"mb-1.5 text-[11px] text-muted-foreground",children:[(0,n.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,n.jsx)(a.A,{className:"h-3 w-3 shrink-0"}),(0,n.jsx)("span",{className:"truncate",children:e.dirName})]}),(0,n.jsx)("div",{className:"truncate pl-[18px]",children:e.sessionName})]}),(0,n.jsx)(C,{preview:e.preview,matchStart:e.matchStart,matchLength:e.matchLength})]},`${e.messageId}-${t}`))]}),g&&u&&r.length>0&&(0,n.jsxs)("div",{className:"px-4 py-2 border-t text-[11px] text-muted-foreground flex items-center justify-between",children:[(0,n.jsxs)("span",{children:[r.length," result",1!==r.length?"s":""," across ",g.total," session",1!==g.total?"s":""]}),g.truncated&&(0,n.jsx)("button",{onClick:F,disabled:c,className:"text-[11px] text-primary hover:underline disabled:opacity-50",children:c?"Loading...":"Load more"})]})]})}),w&&(0,n.jsx)(S.Q,{timestamp:w.timestamp,sessionId:w.sessionId,cwd:w.cwd,onClose:()=>A(null)})]})}function A(){let[e,t]=(0,x.useState)(!1);return(0,x.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.shiftKey&&"f"===e.key&&(e.preventDefault(),t(!0))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("button",{onClick:()=>t(!0),className:"w-full flex items-center gap-2 rounded-lg border bg-card px-3 py-2 text-sm text-muted-foreground hover:bg-accent/50 transition-colors",children:[(0,n.jsx)(v.A,{className:"h-4 w-4"}),(0,n.jsx)("span",{children:"Search all session messages..."}),(0,n.jsx)("kbd",{className:"ml-auto hidden sm:inline text-[10px] border rounded px-1.5 py-0.5",children:"Ctrl+Shift+F"})]}),e&&(0,n.jsx)($,{onClose:()=>t(!1)})]})}var L=s(20108);function D({session:e,onClick:t,onDelete:s}){return(0,n.jsxs)("div",{role:"button",tabIndex:0,onClick:t,onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),t())},className:"w-full flex items-center gap-3 px-3 py-2 text-left rounded-md hover:bg-accent/50 transition-colors cursor-pointer group",children:[(0,n.jsx)("span",{className:"text-sm truncate flex-1",children:e.name}),(0,n.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:["running"===e.status&&(0,n.jsx)(h.E,{variant:"default",className:"text-xs",children:"running"}),(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:function(e){let t=Math.floor((Date.now()-e)/1e3);if(t<60)return"just now";let s=Math.floor(t/60);if(s<60)return`${s}m ago`;let n=Math.floor(s/60);if(n<24)return`${n}h ago`;let r=Math.floor(n/24);return r<30?`${r}d ago`:new Date(e).toLocaleDateString()}(e.lastActiveAt)}),s&&"running"!==e.status&&(0,n.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),s(e)},className:"p-1 rounded hover:bg-destructive/10 opacity-100 sm:opacity-0 sm:group-hover:opacity-100 transition-opacity",title:"Delete session",children:(0,n.jsx)(o.A,{className:"h-3.5 w-3.5 text-muted-foreground hover:text-destructive"})})]})]})}var T=s(23965);let I=null,R="cockpit_fav_dirs";function F({group:e,isFavorite:t,onToggleFavorite:s,onSelectSession:r,onCreateSession:d,onDeleteSession:u,onDeleteAll:m}){let[p,f]=(0,x.useState)(!1),[g,j]=(0,x.useState)(null),[w,v]=(0,x.useState)(!1),b=(0,x.useRef)(!1),N=g||e.sessions,y=N.length<e.totalSessionCount,k=N[0]?.lastActiveAt||0,S=N.filter(e=>"running"===e.status).length,C=(0,x.useCallback)(async()=>{v(!0);try{let t=await fetch(`/api/sessions/group?cwd=${encodeURIComponent(e.cwd)}`);if(t.ok){let e=await t.json();j(e.sessions||[])}}finally{v(!1)}},[e.cwd]);return(0,x.useEffect)(()=>{b.current&&C()},[e.totalSessionCount]),(0,n.jsxs)("div",{className:"rounded-lg border bg-card",children:[(0,n.jsxs)("div",{role:"button",onClick:()=>f(!p),className:"w-full flex items-center gap-2 p-3 text-left hover:bg-accent/50 rounded-lg transition-colors cursor-pointer",children:[(0,n.jsx)(l.A,{className:`h-4 w-4 shrink-0 text-muted-foreground transition-transform ${p?"rotate-90":""}`}),(0,n.jsx)(a.A,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),(0,n.jsx)("span",{className:"font-medium text-sm truncate flex-1",children:e.dirName}),(0,n.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[S>0&&(0,n.jsxs)("span",{className:"text-xs bg-primary text-primary-foreground px-1.5 py-0.5 rounded",children:[S," running"]}),(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:function(e){let t=Math.floor((Date.now()-e)/1e3);if(t<60)return"just now";let s=Math.floor(t/60);if(s<60)return`${s}m ago`;let n=Math.floor(s/60);if(n<24)return`${n}h ago`;let r=Math.floor(n/24);return r<30?`${r}d ago`:new Date(e).toLocaleDateString()}(k)}),(0,n.jsxs)(h.E,{variant:"secondary",className:"text-[10px] px-1.5 py-0",children:[e.totalSessionCount," session",1!==e.totalSessionCount?"s":""]})]})]}),p&&(0,n.jsxs)("div",{className:"px-3 pb-3 space-y-1",children:[(0,n.jsxs)("div",{className:"flex items-center justify-end gap-1 pb-1",children:[(0,n.jsx)("button",{onClick:()=>m(e),className:"p-1 rounded hover:bg-destructive/10",title:"Delete all sessions in this folder",children:(0,n.jsx)(o.A,{className:"h-3.5 w-3.5 text-muted-foreground hover:text-destructive"})}),(0,n.jsx)("button",{onClick:()=>d(e.cwd),className:"p-1 rounded hover:bg-accent",title:"New session in this folder",children:(0,n.jsx)(i.A,{className:"h-3.5 w-3.5 text-muted-foreground"})}),(0,n.jsx)("button",{onClick:()=>s(),className:"p-1 rounded hover:bg-accent",children:(0,n.jsx)(c,{className:`h-3.5 w-3.5 ${t?"fill-yellow-400 text-yellow-400":"text-muted-foreground"}`})})]}),N.map(e=>(0,n.jsx)(D,{session:e,onClick:()=>r(e),onDelete:()=>u(e)},e.id)),y&&(0,n.jsx)("button",{onClick:()=>{b.current=!0,C()},disabled:w,className:"w-full text-xs text-muted-foreground hover:text-foreground py-2 rounded hover:bg-accent/50 transition-colors disabled:opacity-50",children:w?"Loading...":`Load all ${e.totalSessionCount} sessions`})]})]})}function O(){let e=(0,m.useRouter)(),{connected:t}=(0,g.h)(),[s,r]=(0,x.useState)(I||[]),[l,a]=(0,x.useState)(new Set),[o,c]=(0,x.useState)(!1),[h,j]=(0,x.useState)(!!I),w=(0,x.useRef)(!1),[v,b]=(0,x.useState)(null),[N,y]=(0,x.useState)(!1),[k,S]=(0,x.useState)(null);(0,x.useEffect)(()=>{a(function(){try{let e=localStorage.getItem(R);if(e)return new Set(JSON.parse(e))}catch{}return new Set}())},[]);let C=(0,x.useCallback)(async()=>{let e=await fetch("/api/sessions");if(e.ok){let t=((await e.json()).groups||[]).filter(e=>!e.cwd.endsWith(".cockpit/reviews"));I=t,r(t)}j(!0)},[]);(0,x.useEffect)(()=>{w.current||(w.current=!0,C())},[C]),(0,x.useEffect)(()=>{t&&C()},[t,C]);let E=e=>{a(t=>{let s=new Set(t);return s.has(e)?s.delete(e):s.add(e),localStorage.setItem(R,JSON.stringify([...s])),s})},$=async(t,s,n)=>{let r=await fetch("/api/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:t,name:s||void 0,runtime:n})});if(r.ok){let s=await r.json();await (0,T.MN)(s.sessionId),e.push(`/sessions/${s.sessionId}?cwd=${encodeURIComponent(t)}`)}},D=t=>{e.push(`/sessions/${t.id}?cwd=${encodeURIComponent(t.cwd)}&historyView=true`)},O=async()=>{if(v){if(y(!0),"single"===v.type){let{session:e}=v;await fetch(`/api/sessions/${e.id}?cwd=${encodeURIComponent(e.cwd)}`,{method:"DELETE"})}else{let{group:e}=v,t=e.sessions;if(e.totalSessionCount>e.sessions.length){let s=await fetch(`/api/sessions/group?cwd=${encodeURIComponent(e.cwd)}`);s.ok&&(t=(await s.json()).sessions||t)}let s=t.filter(e=>"running"!==e.status).map(e=>({id:e.id,cwd:e.cwd}));s.length>0&&await fetch("/api/sessions/bulk-delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessions:s})})}b(null),y(!1),C()}},M=v?.type==="single"?"Delete Session":"Delete All Sessions",P=v?.type==="single"?"Permanently delete this session and its transcript? This cannot be undone.":(()=>{let e=v?.group;if(!e)return"";let t=e.sessions.filter(e=>"running"===e.status).length,s=e.totalSessionCount-t,n=`Permanently delete ${s} session${1!==s?"s":""} in "${e.dirName}"? This cannot be undone.`;return t>0&&(n+=` ${t} running session${1!==t?"s":""} will be skipped.`),n})(),U=s.filter(e=>l.has(e.cwd)),_=s.filter(e=>!l.has(e.cwd));return(0,n.jsxs)("div",{className:"p-4 pb-24 space-y-3",children:[(0,n.jsx)("h1",{className:"text-2xl font-bold",children:"Sessions"}),(0,n.jsx)(A,{}),0===s.length&&h&&(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"No sessions found. Create one to get started."}),U.map(e=>(0,n.jsx)(F,{group:e,isFavorite:!0,onToggleFavorite:()=>E(e.cwd),onSelectSession:D,onCreateSession:e=>S(e),onDeleteSession:e=>b({type:"single",session:e}),onDeleteAll:e=>b({type:"bulk",group:e})},e.cwd)),U.length>0&&_.length>0&&(0,n.jsx)("div",{className:"border-t"}),_.map(e=>(0,n.jsx)(F,{group:e,isFavorite:!1,onToggleFavorite:()=>E(e.cwd),onSelectSession:D,onCreateSession:e=>S(e),onDeleteSession:e=>b({type:"single",session:e}),onDeleteAll:e=>b({type:"bulk",group:e})},e.cwd)),(0,n.jsx)("div",{className:"fixed bottom-6 right-6",children:(0,n.jsxs)(p.$,{size:"lg",className:"rounded-full shadow-lg",onClick:()=>c(!0),children:[(0,n.jsx)(i.A,{className:"h-5 w-5 mr-1"}),"New Session"]})}),(0,n.jsx)(L.t,{open:o,onOpenChange:c,onSubmit:$}),(0,n.jsx)(f.lG,{open:!!k,onOpenChange:e=>{e||S(null)},children:(0,n.jsxs)(f.Cf,{onClose:()=>S(null),children:[(0,n.jsx)(f.c7,{children:(0,n.jsx)(f.L3,{children:"Choose Backend"})}),(0,n.jsxs)("div",{className:"space-y-3 mt-2",children:[(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"Pick how claude runs for this session."}),(0,n.jsx)("button",{type:"button",onClick:()=>{S(null),$(k,"","pty")},className:"w-full text-left rounded-lg border border-input bg-card px-4 py-3 transition-colors hover:border-foreground hover:bg-accent",children:(0,n.jsxs)("div",{className:"flex items-center gap-3 mb-1",children:[(0,n.jsx)(d.A,{className:"h-5 w-5 text-foreground"}),(0,n.jsxs)("div",{className:"flex-1",children:[(0,n.jsx)("div",{className:"text-sm font-medium",children:"PTY (interactive)"}),(0,n.jsx)("div",{className:"text-xs text-muted-foreground",children:"Pseudo-terminal"})]})]})}),(0,n.jsx)("button",{type:"button",onClick:()=>{S(null),$(k,"","stream")},className:"w-full text-left rounded-lg border border-input bg-card px-4 py-3 transition-colors hover:border-foreground hover:bg-accent",children:(0,n.jsxs)("div",{className:"flex items-center gap-3 mb-1",children:[(0,n.jsx)(u.A,{className:"h-5 w-5 text-foreground"}),(0,n.jsxs)("div",{className:"flex-1",children:[(0,n.jsx)("div",{className:"text-sm font-medium",children:"Stream (headless)"}),(0,n.jsx)("div",{className:"text-xs text-muted-foreground",children:"Structured output"})]})]})})]})]})}),(0,n.jsx)(f.lG,{open:!!v,onOpenChange:()=>b(null),children:(0,n.jsxs)(f.Cf,{children:[(0,n.jsx)(f.c7,{children:(0,n.jsx)(f.L3,{children:M})}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:P}),(0,n.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,n.jsx)(p.$,{variant:"outline",onClick:()=>b(null),disabled:N,children:"Cancel"}),(0,n.jsx)(p.$,{variant:"destructive",onClick:O,disabled:N,children:N?"Deleting...":"Delete"})]})]})})]})}var M=s(74180);function P(){(0,r.si)("Cockpit",{usageOnly:!0});let e=(0,M.R)("sessions-scroll");return(0,n.jsx)("div",{ref:e,className:"flex-1 min-h-0 overflow-y-auto",children:(0,n.jsx)(O,{})})}},74180:(e,t,s)=>{"use strict";s.d(t,{R:()=>r});var n=s(12115);function r(e){let t=(0,n.useRef)(null);return(0,n.useCallback)(s=>{if(t.current?.(),t.current=null,!s)return;let n=sessionStorage.getItem(e),r=null!==n?Number(n):NaN,l=Number.isFinite(r)&&r>0,a=0,o=0,i=()=>{l=!1,a&&cancelAnimationFrame(a),a=0,s.removeEventListener("wheel",i),s.removeEventListener("touchstart",i),s.removeEventListener("keydown",i)};if(l)if(s.scrollTop=r,2>Math.abs(s.scrollTop-r))l=!1;else{let e=0,t=()=>{if(l){if(s.scrollTop=r,e++,2>Math.abs(s.scrollTop-r)||e>120)return void i();a=requestAnimationFrame(t)}};s.addEventListener("wheel",i,{passive:!0}),s.addEventListener("touchstart",i,{passive:!0}),s.addEventListener("keydown",i),a=requestAnimationFrame(t)}let c=()=>{l||o||(o=requestAnimationFrame(()=>{o=0,sessionStorage.setItem(e,String(s.scrollTop))}))};s.addEventListener("scroll",c,{passive:!0}),t.current=()=>{let t=l;i(),o&&cancelAnimationFrame(o),s.removeEventListener("scroll",c),t||sessionStorage.setItem(e,String(s.scrollTop))}},[e])}}},e=>{e.O(0,[989,14371,1550,28441,93794,77358],()=>e(e.s=14683)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[13472],{48792:(e,s,t)=>{Promise.resolve().then(t.bind(t,66747))},66747:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>b});var n=t(95155),a=t(82749),l=t(92571),i=t(31966),r=t(76721),c=t(73321),o=t(12115),d=t(1550),u=t(45160),m=t(89239),x=t(81477),p=t(42763),h=t(60529);async function j(e,s){try{let t=await fetch(e,s);if(t.ok)return{ok:!0};let n=await t.json().catch(()=>({}));return{ok:!1,error:n.error||`Request failed (${t.status})`}}catch{return{ok:!1,error:"Request failed"}}}var f=t(74180);let g="__add__",N="__all__";function b(){(0,d.si)("Plugins",{hideActions:!0});let e=(0,f.R)("plugins-scroll"),s=(0,c.useRouter)(),t=(0,c.useSearchParams)(),l=t.get("detail"),i=t.get("mkt"),{installed:r,available:u,marketplaces:p,loading:h,error:b,refresh:k,install:C,setEnabled:S,uninstall:R,update:$,addMarketplace:U,removeMarketplace:L,updateMarketplace:T}=function(){let[e,s]=(0,o.useState)([]),[t,n]=(0,o.useState)([]),[a,l]=(0,o.useState)([]),[i,r]=(0,o.useState)(!0),[c,d]=(0,o.useState)(null),u=(0,o.useCallback)(()=>{r(!0),d(null),fetch("/api/plugins").then(async e=>{let s=await e.json();if(!e.ok)throw Error(s.error||"Failed to load plugins");return s}).then(e=>{s(e.installed??[]),n(e.available??[]),l(e.marketplaces??[])}).catch(e=>d(e instanceof Error?e.message:"Failed to load plugins")).finally(()=>r(!1))},[]);(0,o.useEffect)(()=>{u()},[u]);let m=(0,o.useCallback)(async(e,s,t)=>{let n=await j(`/api/plugins/${encodeURIComponent(e)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:s?"enable":"disable",scope:t})});return n.ok&&u(),n},[u]),x=(0,o.useCallback)(async(e,s)=>{let t=new URLSearchParams;s&&t.set("scope",s);let n=await j(`/api/plugins/${encodeURIComponent(e)}?${t}`,{method:"DELETE"});return n.ok&&u(),n},[u]),p=(0,o.useCallback)(async e=>{let s=await j(`/api/plugins/${encodeURIComponent(e)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"update"})});return s.ok&&u(),s},[u]),h=(0,o.useCallback)(async(e,s="user")=>{let t=await j("/api/plugins/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin:e,scope:s})});return t.ok&&u(),t},[u]),f=(0,o.useCallback)(async e=>{let s=await j("/api/plugins/marketplaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"add",source:e})});return s.ok&&u(),s},[u]),g=(0,o.useCallback)(async e=>{let s=await j(`/api/plugins/marketplaces/${encodeURIComponent(e)}`,{method:"DELETE"});return s.ok&&u(),s},[u]),N=(0,o.useCallback)(async e=>{let s=e?await j(`/api/plugins/marketplaces/${encodeURIComponent(e)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"update"})}):await j("/api/plugins/marketplaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"update"})});return s.ok&&u(),s},[u]);return{installed:e,available:t,marketplaces:a,loading:i,error:c,refresh:u,setEnabled:m,uninstall:x,update:p,install:h,addMarketplace:f,removeMarketplace:g,updateMarketplace:N}}(),O=l?r.find(e=>e.id===l)??null:null,F=i?p.find(e=>e.name===i)??null:null,[P,_]=(0,o.useState)("installed"),[Z,D]=(0,o.useState)(null),[z,B]=(0,o.useState)(null),[M,W]=(0,o.useState)(null),J=(0,o.useMemo)(()=>new Set(r.map(e=>e.id)),[r]);async function q(e){D(e),B(null);let s=await C(e,"user");s.ok||B(s.error??"Failed to install plugin"),D(null)}async function G(e){W(g),B(null);let s=await U(e);return s.ok||B(s.error??"Failed to add marketplace"),W(null),s.ok}async function H(e){W(e??N),B(null);let s=await T(e);s.ok||B(s.error??"Failed to update marketplace"),W(null)}return l?(0,n.jsx)(w,{plugin:O,onBack:()=>s.push("/plugins"),onSetEnabled:async(e,s,t)=>{let n=await S(e,s,t);return n.ok&&k(),n},onUninstall:async(e,s)=>await R(e,s),onUpdate:async e=>{let s=await $(e);return s.ok&&k(),s}}):i?(0,n.jsx)(A,{marketplace:F,onBack:()=>s.push("/plugins"),onUpdate:async e=>{await T(e),k()},onRemove:async e=>{await L(e),k()}}):(0,n.jsxs)("div",{ref:e,className:"flex-1 min-h-0 overflow-y-auto p-4 space-y-4",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("div",{className:"flex items-center gap-1",children:[(0,n.jsx)(v,{active:"installed"===P,onClick:()=>_("installed"),label:"Installed",count:r.length}),(0,n.jsx)(v,{active:"browse"===P,onClick:()=>_("browse"),label:"Browse",count:u.length}),(0,n.jsx)(v,{active:"marketplaces"===P,onClick:()=>_("marketplaces"),label:"Marketplaces",count:p.length})]}),(0,n.jsx)(m.$,{size:"sm",variant:"ghost",onClick:k,disabled:h,title:"Refresh",children:(0,n.jsx)(a.A,{className:`h-4 w-4 ${h?"animate-spin":""}`})})]}),b&&(0,n.jsx)("div",{className:"rounded border border-red-500/30 bg-red-500/5 p-3 text-sm text-red-500",children:b}),z&&(0,n.jsx)("div",{className:"rounded border border-red-500/30 bg-red-500/5 p-3 text-sm text-red-500",children:z}),h&&0===r.length&&(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading plugins..."}),"installed"===P&&!h&&(0,n.jsx)(x.Zp,{children:(0,n.jsx)(x.Wu,{className:"space-y-1 pt-4",children:0===r.length?(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"No plugins installed. Browse a marketplace to add one."}):r.map(e=>(0,n.jsx)(I,{plugin:e},e.id))})}),"browse"===P&&!h&&(0,n.jsx)(y,{available:u,installedIds:J,busyId:Z,onInstall:q}),"marketplaces"===P&&!h&&(0,n.jsx)(E,{marketplaces:p,busy:M,onAdd:G,onUpdate:H})]})}function v({active:e,onClick:s,label:t,count:a}){return(0,n.jsxs)("button",{type:"button",onClick:s,className:`rounded-md px-3 py-1.5 text-sm transition-colors ${e?"bg-muted font-medium":"text-muted-foreground hover:text-foreground"}`,children:[t,(0,n.jsx)("span",{className:"ml-1.5 text-xs text-muted-foreground",children:a})]})}function y({available:e,installedIds:s,busyId:t,onInstall:a}){let[i,r]=(0,o.useState)(""),[c,d]=(0,o.useState)(null),j=i.trim().toLowerCase(),f=j?e.filter(e=>e.name.toLowerCase().includes(j)||(e.description?.toLowerCase().includes(j)??!1)):e,g=f.slice(0,100);return(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsx)(h.p,{placeholder:"Search plugins...",value:i,onChange:e=>r(e.target.value)}),(0,n.jsx)("p",{className:"text-xs text-muted-foreground",children:"Installs to user scope."}),0===f.length?(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"No plugins match your search."}):(0,n.jsx)(x.Zp,{children:(0,n.jsx)(x.Wu,{className:"space-y-1 pt-4",children:g.map(e=>(0,n.jsx)(k,{plugin:e,installed:s.has(e.pluginId),busy:t===e.pluginId,onInstall:()=>a(e.pluginId),onClick:()=>d(e)},e.pluginId))})}),f.length>g.length&&(0,n.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Showing ",g.length," of ",f.length,". Refine your search to narrow the list."]}),(0,n.jsx)(p.lG,{open:!!c,onOpenChange:()=>d(null),children:(0,n.jsx)(p.Cf,{children:c&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(p.c7,{children:(0,n.jsx)(p.L3,{className:"font-mono font-bold",children:c.name})}),(0,n.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsxs)("span",{className:"text-xs text-muted-foreground",children:["@",c.marketplaceName]}),"number"==typeof c.installCount&&(0,n.jsxs)(u.E,{variant:"secondary",className:"text-[10px]",children:[c.installCount," installs"]})]}),c.description?(0,n.jsx)("p",{className:"text-sm whitespace-pre-wrap",children:c.description}):(0,n.jsx)("p",{className:"text-sm text-muted-foreground italic",children:"No description available."}),(0,n.jsx)("div",{className:"flex justify-end pt-2",children:s.has(c.pluginId)?(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:"Already installed"}):(0,n.jsx)(m.$,{size:"sm",variant:"default",onClick:()=>{a(c.pluginId),d(null)},disabled:t===c.pluginId,children:t===c.pluginId?(0,n.jsx)(l.A,{className:"h-4 w-4 animate-spin"}):"Install"})})]})]})})})]})}function k({plugin:e,installed:s,busy:t,onInstall:a,onClick:i}){let{name:r,marketplace:c}=S(e.pluginId);return(0,n.jsxs)("div",{className:"flex items-center gap-3 rounded px-2 py-2 hover:bg-muted transition-colors",children:[(0,n.jsxs)("button",{type:"button",onClick:i,className:"flex-1 min-w-0 text-left",children:[(0,n.jsx)("span",{className:"block font-mono font-bold text-sm truncate",children:r}),(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5 mt-0.5",children:[c&&(0,n.jsxs)("span",{className:"text-xs text-muted-foreground",children:["@",c]}),"number"==typeof e.installCount&&(0,n.jsxs)(u.E,{variant:"secondary",className:"text-[10px]",children:[e.installCount," installs"]})]}),e.description&&(0,n.jsx)("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:e.description})]}),(0,n.jsx)("div",{className:"shrink-0",children:s?(0,n.jsx)("span",{className:"px-2 text-xs text-muted-foreground",children:"Installed"}):(0,n.jsx)(m.$,{size:"sm",variant:"outline",onClick:a,disabled:t,children:t?(0,n.jsx)(l.A,{className:"h-3.5 w-3.5 animate-spin"}):"Install"})})]})}function w({plugin:e,onBack:s,onSetEnabled:t,onUninstall:a,onUpdate:i}){let[r,c]=(0,o.useState)(null),[d,h]=(0,o.useState)(null),[j,f]=(0,o.useState)(!1);if(!e)return(0,n.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto p-4 space-y-4",children:[(0,n.jsx)(C,{onClick:s}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"Plugin not found."})]});let{name:g,marketplace:N}=S(e.id),b=e.mcpServers?Object.keys(e.mcpServers):[];async function v(s){c("toggle"),h(null);let n=await t(e.id,s,e.scope);n.ok||h(n.error??"Failed to update plugin"),c(null)}async function y(){c("update"),h(null);let s=await i(e.id);s.ok||h(s.error??"Failed to update plugin"),c(null)}async function k(){f(!1),c("uninstall"),h(null);let t=await a(e.id,e.scope);t.ok?s():(h(t.error??"Failed to uninstall plugin"),c(null))}return(0,n.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto p-4 space-y-6",children:[(0,n.jsx)(C,{onClick:s}),(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"font-mono font-bold text-lg",children:g}),N&&(0,n.jsxs)("p",{className:"text-sm text-muted-foreground",children:["@",N]})]}),d&&(0,n.jsx)("div",{className:"rounded border border-red-500/30 bg-red-500/5 p-3 text-sm text-red-500",children:d}),(0,n.jsxs)(x.Zp,{children:[(0,n.jsx)(x.aR,{children:(0,n.jsx)(x.ZB,{className:"text-sm",children:"Details"})}),(0,n.jsxs)(x.Wu,{className:"space-y-3 text-sm",children:[(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Version"}),(0,n.jsx)("span",{className:"font-mono",children:e.version})]}),(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Scope"}),(0,n.jsx)(u.E,{variant:"secondary",className:"text-[10px]",children:e.scope})]}),(0,n.jsxs)("div",{className:"flex justify-between items-center",children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Status"}),(0,n.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,n.jsx)("span",{className:`inline-block h-2 w-2 rounded-full ${e.enabled?"bg-green-500":"bg-muted-foreground/40"}`}),e.enabled?"Enabled":"Disabled"]})]}),(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Install path"}),(0,n.jsx)("span",{className:"font-mono text-xs truncate ml-4 max-w-[60%] text-right",title:e.installPath,children:e.installPath})]}),(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Installed at"}),(0,n.jsx)("span",{children:R(e.installedAt)})]}),(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Last updated"}),(0,n.jsx)("span",{children:R(e.lastUpdated)})]}),(0,n.jsxs)("div",{className:"flex justify-between",children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"MCP servers"}),(0,n.jsx)("span",{className:"text-right max-w-[60%] truncate",title:b.join(", "),children:b.length>0?b.join(", "):"None"})]})]})]}),(0,n.jsxs)(x.Zp,{children:[(0,n.jsx)(x.aR,{children:(0,n.jsx)(x.ZB,{className:"text-sm",children:"Actions"})}),(0,n.jsxs)(x.Wu,{className:"space-y-3",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("span",{className:"text-sm",children:"Update from marketplace source"}),(0,n.jsx)(m.$,{size:"sm",variant:"outline",onClick:y,disabled:null!==r,children:"update"===r?(0,n.jsx)(l.A,{className:"h-4 w-4 animate-spin"}):"Update"})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("span",{className:"text-sm",children:[e.enabled?"Disable":"Enable"," plugin"]}),(0,n.jsx)(m.$,{size:"sm",variant:e.enabled?"outline":"default",onClick:()=>v(!e.enabled),disabled:null!==r,children:"toggle"===r?(0,n.jsx)(l.A,{className:"h-4 w-4 animate-spin"}):e.enabled?"Disable":"Enable"})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("span",{className:"text-sm",children:"Remove from disk"}),(0,n.jsx)(m.$,{size:"sm",variant:"destructive",onClick:()=>f(!0),disabled:null!==r,children:"uninstall"===r?(0,n.jsx)(l.A,{className:"h-4 w-4 animate-spin"}):"Uninstall"})]})]})]}),(0,n.jsx)(p.lG,{open:j,onOpenChange:f,children:(0,n.jsxs)(p.Cf,{children:[(0,n.jsx)(p.c7,{children:(0,n.jsx)(p.L3,{children:"Uninstall Plugin"})}),(0,n.jsxs)("p",{className:"text-sm text-muted-foreground mb-4",children:["Uninstall ",(0,n.jsx)("span",{className:"font-mono font-bold",children:e.id}),"? This removes it from disk."]}),(0,n.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,n.jsx)(m.$,{variant:"outline",onClick:()=>f(!1),children:"Cancel"}),(0,n.jsx)(m.$,{variant:"destructive",onClick:k,children:"Uninstall"})]})]})})]})}function C({onClick:e}){return(0,n.jsxs)("button",{type:"button",onClick:e,className:"inline-flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[(0,n.jsx)(i.A,{className:"h-4 w-4"}),"Back to Installed"]})}function S(e){let s=e.lastIndexOf("@");return s>0?{name:e.slice(0,s),marketplace:e.slice(s+1)}:{name:e,marketplace:""}}function I({plugin:e}){let{name:s,marketplace:t}=S(e.id),a=(0,c.useRouter)();return(0,n.jsxs)("button",{type:"button",onClick:()=>a.push(`/plugins?detail=${encodeURIComponent(e.id)}`),className:"flex w-full items-center gap-3 rounded px-2 py-2 hover:bg-muted transition-colors text-left",children:[(0,n.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,n.jsx)("span",{className:"block font-mono font-bold text-sm truncate",children:s}),(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5 mt-0.5",children:[t&&(0,n.jsxs)("span",{className:"text-xs text-muted-foreground",children:["@",t]}),(0,n.jsxs)(u.E,{variant:"secondary",className:"text-[10px]",children:["v",e.version]}),(0,n.jsx)(u.E,{variant:"secondary",className:"text-[10px]",children:e.scope}),(0,n.jsx)("span",{className:`inline-block h-1.5 w-1.5 rounded-full ${e.enabled?"bg-green-500":"bg-muted-foreground/40"}`})]})]}),(0,n.jsx)(r.A,{className:"h-4 w-4 text-muted-foreground shrink-0"})]})}function R(e){if(!e)return"Unknown";let s=new Date(e);return Number.isNaN(s.getTime())?"Unknown":s.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function E({marketplaces:e,busy:s,onAdd:t,onUpdate:a}){let[i,r]=(0,o.useState)(""),d=(0,c.useRouter)(),u=null!==s;async function p(){let e=i.trim();!e||await t(e)&&r("")}return(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(h.p,{placeholder:"owner/repo, URL, or local path",value:i,onChange:e=>r(e.target.value),onKeyDown:e=>{"Enter"===e.key&&p()}}),(0,n.jsx)(m.$,{onClick:p,disabled:u||!i.trim(),children:s===g?(0,n.jsx)(l.A,{className:"h-4 w-4 animate-spin"}):"Add"})]}),(0,n.jsx)("p",{className:"text-xs text-muted-foreground",children:"Add a GitHub repo, URL, or local path. Adds at user scope."}),(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("span",{className:"text-sm text-muted-foreground",children:[e.length," configured"]}),(0,n.jsx)(m.$,{size:"sm",variant:"outline",onClick:()=>a(),disabled:u||0===e.length,children:s===N?(0,n.jsx)(l.A,{className:"h-3.5 w-3.5 animate-spin"}):"Update all"})]}),0===e.length?(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"No marketplaces configured. Add one above to browse its plugins."}):(0,n.jsx)(x.Zp,{children:(0,n.jsx)(x.Wu,{className:"space-y-1 pt-4",children:e.map(e=>(0,n.jsx)(U,{marketplace:e,disabled:u,onClick:()=>d.push(`/plugins?mkt=${encodeURIComponent(e.name)}`)},e.name))})})]})}function A({marketplace:e,onBack:s,onUpdate:t,onRemove:a}){let[i,r]=(0,o.useState)(null),[c,d]=(0,o.useState)(null),[u,h]=(0,o.useState)(!1);if(!e)return(0,n.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto p-4 space-y-4",children:[(0,n.jsx)(C,{onClick:s}),(0,n.jsx)("p",{className:"text-sm text-muted-foreground",children:"Marketplace not found."})]});async function j(){r("update"),d(null);try{await t(e.name)}catch{d("Failed to update marketplace")}r(null)}async function f(){h(!1),r("remove"),d(null);try{await a(e.name),s()}catch{d("Failed to remove marketplace"),r(null)}}return(0,n.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto p-4 space-y-6",children:[(0,n.jsx)(C,{onClick:s}),(0,n.jsx)("div",{children:(0,n.jsx)("h1",{className:"font-mono font-bold text-lg",children:e.name})}),c&&(0,n.jsx)("div",{className:"rounded border border-red-500/30 bg-red-500/5 p-3 text-sm text-red-500",children:c}),(0,n.jsxs)(x.Zp,{children:[(0,n.jsx)(x.aR,{children:(0,n.jsx)(x.ZB,{className:"text-sm",children:"Details"})}),(0,n.jsxs)(x.Wu,{className:"space-y-3 text-sm",children:[(0,n.jsx)($,{label:"Source",value:e.source,mono:!0}),e.repo&&(0,n.jsx)($,{label:"Repo",value:e.repo,mono:!0}),(0,n.jsx)($,{label:"Install location",value:e.installLocation,mono:!0})]})]}),(0,n.jsxs)(x.Zp,{children:[(0,n.jsx)(x.aR,{children:(0,n.jsx)(x.ZB,{className:"text-sm",children:"Actions"})}),(0,n.jsxs)(x.Wu,{className:"space-y-3",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("span",{className:"text-sm",children:"Update from marketplace source"}),(0,n.jsx)(m.$,{size:"sm",variant:"outline",onClick:j,disabled:null!==i,children:"update"===i?(0,n.jsx)(l.A,{className:"h-4 w-4 animate-spin"}):"Update"})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("span",{className:"text-sm",children:"Remove marketplace configuration"}),(0,n.jsx)(m.$,{size:"sm",variant:"destructive",onClick:()=>h(!0),disabled:null!==i,children:"remove"===i?(0,n.jsx)(l.A,{className:"h-4 w-4 animate-spin"}):"Remove"})]})]})]}),(0,n.jsx)(p.lG,{open:u,onOpenChange:h,children:(0,n.jsxs)(p.Cf,{children:[(0,n.jsx)(p.c7,{children:(0,n.jsx)(p.L3,{children:"Remove Marketplace"})}),(0,n.jsxs)("p",{className:"text-sm text-muted-foreground mb-4",children:["Remove ",(0,n.jsx)("span",{className:"font-mono font-bold",children:e.name}),"? This removes the marketplace from your configuration."]}),(0,n.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,n.jsx)(m.$,{variant:"outline",onClick:()=>h(!1),children:"Cancel"}),(0,n.jsx)(m.$,{variant:"destructive",onClick:f,children:"Remove"})]})]})})]})}function $({label:e,value:s,mono:t}){return(0,n.jsxs)("div",{className:"flex justify-between gap-2",children:[(0,n.jsx)("span",{className:"text-muted-foreground shrink-0",children:e}),(0,n.jsx)("span",{className:`text-right break-all max-w-[70%] ${t?"font-mono text-xs":""}`,children:s})]})}function U({marketplace:e,disabled:s,onClick:t}){return(0,n.jsxs)("button",{type:"button",onClick:t,disabled:s,className:"flex w-full items-center gap-3 rounded px-2 py-2 hover:bg-muted transition-colors text-left disabled:opacity-50",children:[(0,n.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,n.jsx)("span",{className:"font-mono font-bold text-sm truncate",children:e.name}),(0,n.jsx)("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:e.source})]}),(0,n.jsx)(r.A,{className:"h-4 w-4 text-muted-foreground shrink-0"})]})}},74180:(e,s,t)=>{"use strict";t.d(s,{R:()=>a});var n=t(12115);function a(e){let s=(0,n.useRef)(null);return(0,n.useCallback)(t=>{if(s.current?.(),s.current=null,!t)return;let n=sessionStorage.getItem(e),a=null!==n?Number(n):NaN,l=Number.isFinite(a)&&a>0,i=0,r=0,c=()=>{l=!1,i&&cancelAnimationFrame(i),i=0,t.removeEventListener("wheel",c),t.removeEventListener("touchstart",c),t.removeEventListener("keydown",c)};if(l)if(t.scrollTop=a,2>Math.abs(t.scrollTop-a))l=!1;else{let e=0,s=()=>{if(l){if(t.scrollTop=a,e++,2>Math.abs(t.scrollTop-a)||e>120)return void c();i=requestAnimationFrame(s)}};t.addEventListener("wheel",c,{passive:!0}),t.addEventListener("touchstart",c,{passive:!0}),t.addEventListener("keydown",c),i=requestAnimationFrame(s)}let o=()=>{l||r||(r=requestAnimationFrame(()=>{r=0,sessionStorage.setItem(e,String(t.scrollTop))}))};t.addEventListener("scroll",o,{passive:!0}),s.current=()=>{let s=l;c(),r&&cancelAnimationFrame(r),t.removeEventListener("scroll",o),s||sessionStorage.setItem(e,String(t.scrollTop))}},[e])}}},e=>{e.O(0,[989,14371,1550,28441,93794,77358],()=>e(e.s=48792)),_N_E=e.O()}]);
|
|
@@ -10,4 +10,4 @@ Branch: ${j.headRefName} into ${j.baseRefName}
|
|
|
10
10
|
Files changed: ${j.changedFiles} (+${j.additions} -${j.deletions})${j.body?`
|
|
11
11
|
|
|
12
12
|
Description:
|
|
13
|
-
${j.body.slice(0,2e3)}`:""}`,onSendMessage:e=>{eC.current=e}})})]})]})]})}function Q({params:e}){let{owner:t,repo:s,number:a}=(0,r.use)(e);return(0,n.jsx)(q,{owner:t,repo:s,number:parseInt(a,10)})}},56206:(e,t,s)=>{Promise.resolve().then(s.bind(s,43996))},58309:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});let n=(0,s(99537).A)("list",[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]])},94088:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});let n=(0,s(99537).A)("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]])},94890:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});let n=(0,s(99537).A)("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]])}},e=>{e.O(0,[989,
|
|
13
|
+
${j.body.slice(0,2e3)}`:""}`,onSendMessage:e=>{eC.current=e}})})]})]})]})}function Q({params:e}){let{owner:t,repo:s,number:a}=(0,r.use)(e);return(0,n.jsx)(q,{owner:t,repo:s,number:parseInt(a,10)})}},56206:(e,t,s)=>{Promise.resolve().then(s.bind(s,43996))},58309:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});let n=(0,s(99537).A)("list",[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]])},94088:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});let n=(0,s(99537).A)("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]])},94890:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});let n=(0,s(99537).A)("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]])}},e=>{e.O(0,[989,14371,1550,28441,93794,77358],()=>e(e.s=56206)),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[50198],{9181:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>N});var r=t(95155),l=t(35397),n=t(99537);let a=(0,n.A)("git-merge",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]]);var c=t(94890);let i=(0,n.A)("circle-dot",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);var d=t(31966),o=t(65377),u=t(82749),x=t(92571),m=t(73321),h=t(12115),p=t(1550),f=t(89239),g=t(40980);let j=new Map;function N({params:e}){let{owner:s,repo:t}=(0,h.use)(e),n=`${s}/${t}`;(0,p.si)(n);let v=(0,m.useRouter)(),[y,w]=(0,h.useState)("open"),[k,b]=(0,h.useState)(()=>j.get(`${n}:open`)||[]),[C,E]=(0,h.useState)(""),[$,A]=(0,h.useState)(!j.has(`${n}:open`)),[R,S]=(0,h.useState)(null),D=(0,h.useCallback)((e=!1)=>{let s=`${n}:${y}`;if(!e&&j.has(s)){b(j.get(s)),A(!1);return}A(!0),S(null),fetch(`/api/github/prs?repo=${encodeURIComponent(n)}&state=${y}`).then(e=>e.ok?e.json():e.json().then(e=>Promise.reject(e.error))).then(e=>{j.set(s,e),b(e)}).catch(e=>S(String(e))).finally(()=>A(!1))},[n,y]);(0,h.useEffect)(()=>{D()},[D]);let _=C?k.filter(e=>e.title.toLowerCase().includes(C.toLowerCase())):k;return(0,r.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto p-4 space-y-4",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(f.$,{variant:"ghost",size:"icon",className:"shrink-0 h-8 w-8",onClick:()=>v.push("/reviews"),children:(0,r.jsx)(d.A,{className:"h-4 w-4"})}),(0,r.jsxs)("div",{className:"flex gap-1",children:[(0,r.jsx)(f.$,{variant:"open"===y?"default":"outline",size:"sm",onClick:()=>w("open"),children:"Open"}),(0,r.jsx)(f.$,{variant:"closed"===y?"default":"outline",size:"sm",onClick:()=>w("closed"),children:"Closed"})]}),(0,r.jsxs)("div",{className:"relative flex-1",children:[(0,r.jsx)(o.A,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),(0,r.jsx)("input",{type:"text",placeholder:"Filter PRs...",value:C,onChange:e=>E(e.target.value),className:"w-full rounded-md border bg-background px-3 py-2 pl-9 text-sm outline-none focus:ring-1 focus:ring-ring"})]}),(0,r.jsx)(f.$,{variant:"ghost",size:"icon",className:"shrink-0 h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>D(!0),disabled:$,title:"Refresh",children:(0,r.jsx)(u.A,{className:(0,g.cn)("h-4 w-4",$&&"animate-spin")})})]}),$&&(0,r.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,r.jsx)(x.A,{className:"h-5 w-5 animate-spin text-muted-foreground"})}),R&&(0,r.jsx)("div",{className:"rounded-md border border-destructive/50 bg-destructive/10 p-4 text-sm text-destructive",children:R}),!$&&!R&&0===_.length&&(0,r.jsx)("div",{className:"text-center py-12 text-sm text-muted-foreground",children:"No pull requests found."}),!$&&_.length>0&&(0,r.jsx)("div",{className:"space-y-1",children:_.map(e=>(0,r.jsxs)("button",{onClick:()=>v.push(`/reviews/${s}/${t}/${e.number}`),className:"w-full text-left rounded-md border px-4 py-3 hover:bg-muted/50 transition-colors",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[function(e){switch(e){case"OPEN":return(0,r.jsx)(l.A,{className:"h-4 w-4 text-green-500 shrink-0"});case"MERGED":return(0,r.jsx)(a,{className:"h-4 w-4 text-purple-500 shrink-0"});case"CLOSED":return(0,r.jsx)(c.A,{className:"h-4 w-4 text-red-500 shrink-0"});default:return(0,r.jsx)(i,{className:"h-4 w-4 text-muted-foreground shrink-0"})}}(e.state),(0,r.jsx)("span",{className:"font-medium text-sm truncate flex-1 min-w-0",children:e.title}),e.isDraft&&(0,r.jsx)("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded-full bg-muted text-muted-foreground shrink-0",children:"Draft"}),function(e){switch(e){case"APPROVED":return(0,r.jsx)("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded-full bg-green-500/15 text-green-500",children:"Approved"});case"CHANGES_REQUESTED":return(0,r.jsx)("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded-full bg-red-500/15 text-red-500",children:"Changes requested"});case"REVIEW_REQUIRED":return(0,r.jsx)("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded-full bg-yellow-500/15 text-yellow-500",children:"Review required"});default:return null}}(e.reviewDecision)]}),(0,r.jsxs)("div",{className:"flex items-center gap-3 mt-1.5 text-xs text-muted-foreground flex-wrap",children:[(0,r.jsxs)("span",{children:["#",e.number]}),(0,r.jsx)("span",{children:e.author.login}),(0,r.jsx)("span",{className:"truncate max-w-[200px]",children:e.headRefName}),(0,r.jsxs)("span",{className:"text-green-500 shrink-0",children:["+",e.additions]}),(0,r.jsxs)("span",{className:"text-red-500 shrink-0",children:["-",e.deletions]})]}),e.labels.length>0&&(0,r.jsx)("div",{className:"flex gap-1 mt-1.5 flex-wrap",children:e.labels.map(e=>(0,r.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full border",style:{borderColor:`#${e.color}`,color:`#${e.color}`},children:e.name},e.name))})]},e.number))})]})}},37596:(e,s,t)=>{Promise.resolve().then(t.bind(t,9181))},94890:(e,s,t)=>{"use strict";t.d(s,{A:()=>r});let r=(0,t(99537).A)("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]])}},e=>{e.O(0,[989,
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[50198],{9181:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>N});var r=t(95155),l=t(35397),n=t(99537);let a=(0,n.A)("git-merge",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]]);var c=t(94890);let i=(0,n.A)("circle-dot",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);var d=t(31966),o=t(65377),u=t(82749),x=t(92571),m=t(73321),h=t(12115),p=t(1550),f=t(89239),g=t(40980);let j=new Map;function N({params:e}){let{owner:s,repo:t}=(0,h.use)(e),n=`${s}/${t}`;(0,p.si)(n);let v=(0,m.useRouter)(),[y,w]=(0,h.useState)("open"),[k,b]=(0,h.useState)(()=>j.get(`${n}:open`)||[]),[C,E]=(0,h.useState)(""),[$,A]=(0,h.useState)(!j.has(`${n}:open`)),[R,S]=(0,h.useState)(null),D=(0,h.useCallback)((e=!1)=>{let s=`${n}:${y}`;if(!e&&j.has(s)){b(j.get(s)),A(!1);return}A(!0),S(null),fetch(`/api/github/prs?repo=${encodeURIComponent(n)}&state=${y}`).then(e=>e.ok?e.json():e.json().then(e=>Promise.reject(e.error))).then(e=>{j.set(s,e),b(e)}).catch(e=>S(String(e))).finally(()=>A(!1))},[n,y]);(0,h.useEffect)(()=>{D()},[D]);let _=C?k.filter(e=>e.title.toLowerCase().includes(C.toLowerCase())):k;return(0,r.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto p-4 space-y-4",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(f.$,{variant:"ghost",size:"icon",className:"shrink-0 h-8 w-8",onClick:()=>v.push("/reviews"),children:(0,r.jsx)(d.A,{className:"h-4 w-4"})}),(0,r.jsxs)("div",{className:"flex gap-1",children:[(0,r.jsx)(f.$,{variant:"open"===y?"default":"outline",size:"sm",onClick:()=>w("open"),children:"Open"}),(0,r.jsx)(f.$,{variant:"closed"===y?"default":"outline",size:"sm",onClick:()=>w("closed"),children:"Closed"})]}),(0,r.jsxs)("div",{className:"relative flex-1",children:[(0,r.jsx)(o.A,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),(0,r.jsx)("input",{type:"text",placeholder:"Filter PRs...",value:C,onChange:e=>E(e.target.value),className:"w-full rounded-md border bg-background px-3 py-2 pl-9 text-sm outline-none focus:ring-1 focus:ring-ring"})]}),(0,r.jsx)(f.$,{variant:"ghost",size:"icon",className:"shrink-0 h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>D(!0),disabled:$,title:"Refresh",children:(0,r.jsx)(u.A,{className:(0,g.cn)("h-4 w-4",$&&"animate-spin")})})]}),$&&(0,r.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,r.jsx)(x.A,{className:"h-5 w-5 animate-spin text-muted-foreground"})}),R&&(0,r.jsx)("div",{className:"rounded-md border border-destructive/50 bg-destructive/10 p-4 text-sm text-destructive",children:R}),!$&&!R&&0===_.length&&(0,r.jsx)("div",{className:"text-center py-12 text-sm text-muted-foreground",children:"No pull requests found."}),!$&&_.length>0&&(0,r.jsx)("div",{className:"space-y-1",children:_.map(e=>(0,r.jsxs)("button",{onClick:()=>v.push(`/reviews/${s}/${t}/${e.number}`),className:"w-full text-left rounded-md border px-4 py-3 hover:bg-muted/50 transition-colors",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[function(e){switch(e){case"OPEN":return(0,r.jsx)(l.A,{className:"h-4 w-4 text-green-500 shrink-0"});case"MERGED":return(0,r.jsx)(a,{className:"h-4 w-4 text-purple-500 shrink-0"});case"CLOSED":return(0,r.jsx)(c.A,{className:"h-4 w-4 text-red-500 shrink-0"});default:return(0,r.jsx)(i,{className:"h-4 w-4 text-muted-foreground shrink-0"})}}(e.state),(0,r.jsx)("span",{className:"font-medium text-sm truncate flex-1 min-w-0",children:e.title}),e.isDraft&&(0,r.jsx)("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded-full bg-muted text-muted-foreground shrink-0",children:"Draft"}),function(e){switch(e){case"APPROVED":return(0,r.jsx)("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded-full bg-green-500/15 text-green-500",children:"Approved"});case"CHANGES_REQUESTED":return(0,r.jsx)("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded-full bg-red-500/15 text-red-500",children:"Changes requested"});case"REVIEW_REQUIRED":return(0,r.jsx)("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded-full bg-yellow-500/15 text-yellow-500",children:"Review required"});default:return null}}(e.reviewDecision)]}),(0,r.jsxs)("div",{className:"flex items-center gap-3 mt-1.5 text-xs text-muted-foreground flex-wrap",children:[(0,r.jsxs)("span",{children:["#",e.number]}),(0,r.jsx)("span",{children:e.author.login}),(0,r.jsx)("span",{className:"truncate max-w-[200px]",children:e.headRefName}),(0,r.jsxs)("span",{className:"text-green-500 shrink-0",children:["+",e.additions]}),(0,r.jsxs)("span",{className:"text-red-500 shrink-0",children:["-",e.deletions]})]}),e.labels.length>0&&(0,r.jsx)("div",{className:"flex gap-1 mt-1.5 flex-wrap",children:e.labels.map(e=>(0,r.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full border",style:{borderColor:`#${e.color}`,color:`#${e.color}`},children:e.name},e.name))})]},e.number))})]})}},37596:(e,s,t)=>{Promise.resolve().then(t.bind(t,9181))},94890:(e,s,t)=>{"use strict";t.d(s,{A:()=>r});let r=(0,t(99537).A)("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]])}},e=>{e.O(0,[989,14371,1550,28441,93794,77358],()=>e(e.s=37596)),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[66345],{15411:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>N});var s=r(95155),n=r(92571),a=r(99537);let o=(0,a.A)("building-2",[["path",{d:"M10 12h4",key:"a56b0p"}],["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M14 21v-3a2 2 0 0 0-4 0v3",key:"1rgiei"}],["path",{d:"M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2",key:"secmi2"}],["path",{d:"M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16",key:"16ra0t"}]]);var l=r(65377),i=r(82749);let c=(0,a.A)("lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]),d=(0,a.A)("globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);var u=r(73321),m=r(12115),h=r(1550),x=r(89239),p=r(74180),f=r(40980);let g="cockpit_review_org",v=null,j=new Map;function N(){(0,h.si)("Reviews");let e=(0,p.R)("reviews-scroll"),t=(0,u.useRouter)(),[r,a]=(0,m.useState)(v||[]),[N,b]=(0,m.useState)(!v),[w,y]=(0,m.useState)(null),[k,S]=(0,m.useState)(()=>{if(v){let e=localStorage.getItem(g);if(e&&v.includes(e))return e;if(v.length>0)return v[0]}return null}),[M,C]=(0,m.useState)(()=>k&&j.get(k)||[]),[L,A]=(0,m.useState)(!1),[E,I]=(0,m.useState)(null),[R,$]=(0,m.useState)("");(0,m.useEffect)(()=>{v||fetch("/api/github/orgs").then(e=>e.ok?e.json():e.json().then(e=>Promise.reject(e.error))).then(e=>{v=e,a(e);let t=localStorage.getItem(g);t&&e.includes(t)?S(t):e.length>0&&S(e[0])}).catch(e=>y(String(e))).finally(()=>b(!1))},[]);let _=(0,m.useCallback)(e=>{let t=j.get(e);t?C(t):(A(!0),I(null),fetch(`/api/github/repos?owner=${encodeURIComponent(e)}`).then(e=>e.ok?e.json():e.json().then(e=>Promise.reject(e.error))).then(t=>{j.set(e,t),C(t)}).catch(e=>I(String(e))).finally(()=>A(!1)))},[]),F=(0,m.useCallback)(()=>{k&&(j.delete(k),A(!0),I(null),fetch(`/api/github/repos?owner=${encodeURIComponent(k)}`).then(e=>e.ok?e.json():e.json().then(e=>Promise.reject(e.error))).then(e=>{j.set(k,e),C(e)}).catch(e=>I(String(e))).finally(()=>A(!1)))},[k]);(0,m.useEffect)(()=>{k&&(localStorage.setItem(g,k),_(k))},[k,_]);let T=[...M].sort((e,t)=>e.name.localeCompare(t.name)),P=R?T.filter(e=>e.name.toLowerCase().includes(R.toLowerCase())||e.description?.toLowerCase().includes(R.toLowerCase())):T;return N?(0,s.jsx)("div",{className:"flex items-center justify-center flex-1",children:(0,s.jsx)(n.A,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):w?(0,s.jsx)("div",{className:"flex-1 p-4",children:(0,s.jsx)("div",{className:"rounded-md border border-destructive/50 bg-destructive/10 p-4 text-sm text-destructive",children:w})}):0===r.length?(0,s.jsx)("div",{className:"flex-1 p-4",children:(0,s.jsxs)("div",{className:"text-center py-12 text-sm text-muted-foreground",children:["No organizations found. Make sure you have run"," ",(0,s.jsx)("code",{className:"bg-muted px-1.5 py-0.5 rounded text-xs",children:"gh auth refresh -s read:org"}),"."]})}):(0,s.jsxs)("div",{ref:e,className:"flex-1 min-h-0 overflow-y-auto p-4 space-y-4",children:[(0,s.jsx)("div",{className:"flex gap-2 flex-wrap",children:r.map(e=>(0,s.jsxs)("button",{onClick:()=>S(e),className:(0,f.cn)("flex items-center gap-1.5 rounded-md border px-3 py-1.5 text-sm transition-colors",k===e?"border-primary bg-primary/10 text-foreground":"border-border text-muted-foreground hover:text-foreground hover:bg-muted/50"),children:[(0,s.jsx)(o,{className:"h-3.5 w-3.5"}),e]},e))}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsxs)("div",{className:"relative flex-1",children:[(0,s.jsx)(l.A,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),(0,s.jsx)("input",{type:"text",placeholder:"Filter repos...",value:R,onChange:e=>$(e.target.value),className:"w-full rounded-md border bg-background px-3 py-2 pl-9 text-sm outline-none focus:ring-1 focus:ring-ring"})]}),(0,s.jsx)(x.$,{variant:"ghost",size:"icon",className:"shrink-0 h-9 w-9 text-muted-foreground hover:text-foreground",onClick:F,disabled:L,title:"Refresh",children:(0,s.jsx)(i.A,{className:(0,f.cn)("h-4 w-4",L&&"animate-spin")})})]}),L&&(0,s.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,s.jsx)(n.A,{className:"h-5 w-5 animate-spin text-muted-foreground"})}),E&&(0,s.jsx)("div",{className:"rounded-md border border-destructive/50 bg-destructive/10 p-4 text-sm text-destructive",children:E}),!L&&!E&&0===P.length&&(0,s.jsx)("div",{className:"text-center py-12 text-sm text-muted-foreground",children:0===M.length?"No repositories found.":"No matches."}),!L&&P.length>0&&(0,s.jsx)("div",{className:"space-y-1",children:P.map(e=>(0,s.jsxs)("button",{onClick:()=>t.push(`/reviews/${e.nameWithOwner}`),className:"w-full text-left rounded-md border px-4 py-3 hover:bg-muted/50 transition-colors",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[e.isPrivate?(0,s.jsx)(c,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}):(0,s.jsx)(d,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),(0,s.jsx)("span",{className:"font-medium text-sm truncate",children:e.name}),e.primaryLanguage&&(0,s.jsx)("span",{className:"text-xs text-muted-foreground shrink-0",children:e.primaryLanguage.name}),(0,s.jsx)("span",{className:"text-xs text-muted-foreground shrink-0 ml-auto",children:function(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);if(t<60)return"just now";let r=Math.floor(t/60);if(r<60)return`${r}m ago`;let s=Math.floor(r/60);if(s<24)return`${s}h ago`;let n=Math.floor(s/24);if(n<30)return`${n}d ago`;let a=Math.floor(n/30);return`${a}mo ago`}(e.pushedAt)})]}),e.description&&(0,s.jsx)("p",{className:"text-xs text-muted-foreground mt-1 truncate",children:e.description})]},e.nameWithOwner))})]})}},74180:(e,t,r)=>{"use strict";r.d(t,{R:()=>n});var s=r(12115);function n(e){let t=(0,s.useRef)(null);return(0,s.useCallback)(r=>{if(t.current?.(),t.current=null,!r)return;let s=sessionStorage.getItem(e),n=null!==s?Number(s):NaN,a=Number.isFinite(n)&&n>0,o=0,l=0,i=()=>{a=!1,o&&cancelAnimationFrame(o),o=0,r.removeEventListener("wheel",i),r.removeEventListener("touchstart",i),r.removeEventListener("keydown",i)};if(a)if(r.scrollTop=n,2>Math.abs(r.scrollTop-n))a=!1;else{let e=0,t=()=>{if(a){if(r.scrollTop=n,e++,2>Math.abs(r.scrollTop-n)||e>120)return void i();o=requestAnimationFrame(t)}};r.addEventListener("wheel",i,{passive:!0}),r.addEventListener("touchstart",i,{passive:!0}),r.addEventListener("keydown",i),o=requestAnimationFrame(t)}let c=()=>{a||l||(l=requestAnimationFrame(()=>{l=0,sessionStorage.setItem(e,String(r.scrollTop))}))};r.addEventListener("scroll",c,{passive:!0}),t.current=()=>{let t=a;i(),l&&cancelAnimationFrame(l),r.removeEventListener("scroll",c),t||sessionStorage.setItem(e,String(r.scrollTop))}},[e])}},89147:(e,t,r)=>{Promise.resolve().then(r.bind(r,15411))}},e=>{e.O(0,[989,14371,1550,28441,93794,77358],()=>e(e.s=89147)),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[46713],{5214:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"workAsyncStorage",{enumerable:!0,get:function(){return r.workAsyncStorageInstance}});let r=n(17828)},11701:(e,t,n)=>{"use strict";n.d(t,{G:()=>a});var r=n(12115);let l="(min-width: 768px)";function a(){let[e,t]=(0,r.useState)(()=>window.matchMedia(l).matches);return(0,r.useEffect)(()=>{let e=window.matchMedia(l),n=e=>t(e.matches);return e.addEventListener("change",n),()=>e.removeEventListener("change",n)},[]),e}},17828:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"workAsyncStorageInstance",{enumerable:!0,get:function(){return r}});let r=(0,n(64054).createAsyncLocalStorage)()},20660:(e,t,n)=>{"use strict";n.d(t,{Q:()=>c});var r=n(26210),l=n(82627),a=n(70569),s=n(33735),i=n(95155);function c({fileDiff:e,options:t,metrics:n,lineAnnotations:o,selectedLines:d,className:u,style:f,prerenderedHTML:h,renderAnnotation:m,renderCustomHeader:x,renderHeaderPrefix:p,renderHeaderMetadata:b,renderGutterUtility:g,disableWorkerPool:j=!1}){let{ref:y,getHoveredLine:w}=(0,s.S)({fileDiff:e,options:t,metrics:n,lineAnnotations:o,selectedLines:d,prerenderedHTML:h,hasGutterRenderUtility:null!=g,hasCustomHeader:null!=x,disableWorkerPool:j});return(0,i.jsx)(r.mZ,{ref:y,className:u,style:f,children:(0,a.$)((0,l.z)({fileDiff:e,renderCustomHeader:x,renderHeaderPrefix:p,renderHeaderMetadata:b,renderAnnotation:m,renderGutterUtility:g,lineAnnotations:o,getHoveredLine:w}),h)})}},21957:(e,t,n)=>{"use strict";function r({moduleIds:e}){return null}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"PreloadChunks",{enumerable:!0,get:function(){return r}}),n(95155),n(47650),n(5214),n(2451),n(53887)},23668:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>eE});var r=n(95155),l=n(73321),a=n(12115),s=n(1550),i=n(23965),c=n(75707),o=n.n(c),d=n(27417),u=n(53972);let f=(0,a.createContext)(null),h={type:"chat",id:"chat"},m={type:"changes",id:"changes"};function x(e){return"terminal::"+e}let p=new Map,b={tabs:[h],activeTabId:"chat",splitTabId:null,rightPaneTabIds:[]};function g({sessionId:e,children:t}){let[n,l]=(0,a.useState)(()=>p.get(e)||b),s=(0,a.useRef)(p.has(e)?e:null),i=(0,a.useRef)(void 0);(0,a.useEffect)(()=>{if(s.current===e)return;if(p.has(e)){l(p.get(e)),s.current=e;return}let t=!1;return fetch(`/api/sessions/${e}/tabs`).then(e=>e.ok?e.json():null).then(n=>{if(!t){if(n?.openTabs?.length){let t=function(e){let t=[h];for(let n of e)"changes"===n.type?t.push(m):"file"===n.type&&n.filePath?t.push({type:"file",id:"file::"+n.filePath,filePath:n.filePath,label:(0,u.uk)(n.filePath)||n.filePath}):"diff"===n.type&&n.filePath?t.push({type:"diff",id:"diff::"+n.filePath,filePath:n.filePath,label:(0,u.uk)(n.filePath)||n.filePath}):"terminal"===n.type&&n.terminalId&&t.push({type:"terminal",id:x(n.terminalId),terminalId:n.terminalId,label:n.label||"Terminal"});return t}(n.openTabs),r=n.activeTabId&&t.some(e=>e.id===n.activeTabId)?n.activeTabId:"chat",a={tabs:t,activeTabId:r,splitTabId:null,rightPaneTabIds:[]};l(a),p.set(e,a)}s.current=e}}).catch(()=>{s.current=e}),()=>{t=!0}},[e]),(0,a.useEffect)(()=>{if(s.current===e)return p.set(e,n),clearTimeout(i.current),i.current=setTimeout(()=>{fetch(`/api/sessions/${e}/tabs`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({openTabs:function(e){let t=[];for(let n of e)"chat"!==n.type&&("changes"===n.type?t.push({type:"changes"}):"terminal"===n.type?t.push({type:"terminal",terminalId:n.terminalId,label:n.label}):t.push({type:n.type,filePath:n.filePath}));return t}(n.tabs),activeTabId:n.activeTabId})}).catch(()=>{})},300),()=>clearTimeout(i.current)},[e,n.tabs,n.activeTabId]);let c=(0,a.useCallback)(e=>{let t="file::"+e;l(n=>{if(n.tabs.find(e=>e.id===t))return{...n,activeTabId:t};let r={type:"file",id:t,filePath:e,label:(0,u.uk)(e)||e};return{...n,tabs:[...n.tabs,r],activeTabId:t}})},[]),o=(0,a.useCallback)(e=>{let t="diff::"+e;l(n=>{if(n.tabs.find(e=>e.id===t))return{...n,activeTabId:t};let r={type:"diff",id:t,filePath:e,label:(0,u.uk)(e)||e};return{...n,tabs:[...n.tabs,r],activeTabId:t}})},[]),j=(0,a.useCallback)(()=>{l(e=>e.tabs.find(e=>"changes"===e.id)?{...e,activeTabId:"changes"}:{...e,tabs:[...e.tabs,m],activeTabId:"changes"})},[]),y=(0,a.useCallback)((e,t)=>{let n=x(e);l(r=>r.tabs.find(e=>e.id===n)?{...r,activeTabId:n}:{...r,tabs:[...r.tabs,{type:"terminal",id:n,terminalId:e,label:t||"Terminal"}],activeTabId:n})},[]),w=(0,a.useCallback)(e=>{"chat"!==e&&l(t=>{let n=t.tabs.find(t=>t.id===e);n?.type==="terminal"&&((0,d.disposeTerminalInstance)(n.terminalId),fetch(`/api/terminal/${n.terminalId}`,{method:"DELETE"}).catch(()=>{}));let r=t.tabs.findIndex(t=>t.id===e);if(r<0)return t;let l=t.tabs.filter(t=>t.id!==e),a=t.activeTabId;if(a===e){let e=l.filter(e=>!t.rightPaneTabIds.includes(e.id)),n=Math.min(r,e.length-1);a=e[Math.max(0,n)]?.id||"chat"}let s=t.rightPaneTabIds.filter(t=>t!==e),i=t.splitTabId===e?s[0]||null:t.splitTabId;return 0===s.length&&(i=null),{tabs:l,activeTabId:a,splitTabId:i,rightPaneTabIds:s}})},[]),v=(0,a.useCallback)(e=>{l(t=>({...t,activeTabId:e}))},[]),k=(0,a.useCallback)(e=>{l(t=>{if(null===e)return{...t,splitTabId:null,rightPaneTabIds:[]};let n=t.rightPaneTabIds.includes(e)?t.rightPaneTabIds:[...t.rightPaneTabIds,e];return{...t,splitTabId:e,rightPaneTabIds:n}})},[]),N=(0,a.useCallback)((e,t)=>{l(n=>{let r=n.tabs.findIndex(t=>t.id===e);if(r<1||r===t)return n;let l=[...n.tabs],[a]=l.splice(r,1),s=Math.max(1,Math.min(l.length,t>r?t-1:t));return l.splice(s,0,a),{...n,tabs:l}})},[]),C=(0,a.useCallback)((e,t)=>{"chat"!==e&&l(n=>{let r=n.rightPaneTabIds.includes(e);if("right"===t&&!r){let t=[...n.rightPaneTabIds,e],r=n.activeTabId;if(r===e){let e=n.tabs.filter(e=>!t.includes(e.id));r=e[0]?.id||"chat"}return{...n,rightPaneTabIds:t,activeTabId:r,splitTabId:n.splitTabId||e}}if("left"===t&&r){let t=n.rightPaneTabIds.filter(t=>t!==e),r=n.splitTabId;return r===e&&(r=t[0]||null),0===t.length&&(r=null),{...n,rightPaneTabIds:t,splitTabId:r,activeTabId:e}}return n})},[]);return(0,r.jsx)(f.Provider,{value:{tabs:n.tabs,activeTabId:n.activeTabId,splitTabId:n.splitTabId,rightPaneTabIds:n.rightPaneTabIds,openFile:c,openDiff:o,openChanges:j,openTerminal:y,closeTab:w,setActiveTab:v,setSplitTab:k,moveTab:N,moveTabToPane:C},children:t})}function j(){return(0,a.useContext)(f)}var y=n(11701),w=n(40980),v=n(69226),k=n(20660),N=n(64577),C=n(44354),S=n(83212),T=n(19257),I=n(797),E=n(12363),P=n(92571),A=n(94088),M=n(1275),F=n(15480),R=n(19707),D=n(58309),O=n(99537);let z=(0,O.A)("arrow-up-from-line",[["path",{d:"m18 9-6-6-6 6",key:"kcunyi"}],["path",{d:"M12 3v14",key:"7cf3v8"}],["path",{d:"M5 21h14",key:"11awu3"}]]),$=(0,O.A)("sparkles",[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]]);var L=n(9383),_=n(65738),U=n(59184),W=n(57594);function G({onResize:e}){let t=(0,a.useRef)(!1),n=(0,a.useRef)(0),l=(0,a.useCallback)(r=>{r.preventDefault(),t.current=!0,n.current=r.clientX;let l=r=>{if(!t.current)return;let l=n.current-r.clientX;n.current=r.clientX,e(l)},a=()=>{t.current=!1,document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",a),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",l),document.addEventListener("mouseup",a)},[e]);return(0,r.jsx)("div",{onMouseDown:l,className:"w-1 shrink-0 cursor-col-resize bg-border hover:bg-primary/30 transition-colors"})}var B=n(89239),J=n(22317),q=n(89323),V=n(30090);function H({checked:e,onChange:t,onClick:n}){return(0,r.jsx)("button",{type:"button",role:"checkbox","aria-checked":e,onClick:e=>{n?.(e),t()},className:(0,w.cn)("h-4 w-4 shrink-0 rounded border flex items-center justify-center transition-colors",e?"border-primary bg-primary text-primary-foreground":"border-muted-foreground/40 bg-transparent hover:border-muted-foreground/60"),children:e&&(0,r.jsx)(N.A,{className:"h-3 w-3",strokeWidth:3})})}function X(e){switch(e){case"added":case"untracked":return(0,r.jsx)(C.A,{className:"h-3.5 w-3.5 text-green-500 shrink-0"});case"deleted":return(0,r.jsx)(S.A,{className:"h-3.5 w-3.5 text-red-500 shrink-0"});case"renamed":return(0,r.jsx)(T.A,{className:"h-3.5 w-3.5 text-blue-500 shrink-0"});default:return(0,r.jsx)(I.A,{className:"h-3.5 w-3.5 text-yellow-500 shrink-0"})}}function K(){return!("u"<typeof document)&&document.documentElement.classList.contains("dark")}function Y(e,t,n){let r=t.split(/\r?\n/).map(e=>e+"\n"),l=n.split(/\r?\n/).map(e=>e+"\n");for(let t of e.hunks){let e=t.deletionStart-1-t.deletionLineIndex,n=t.additionStart-1-t.additionLineIndex;for(let r of(t.deletionLineIndex=t.deletionStart-1,t.additionLineIndex=t.additionStart-1,t.hunkContent))r.deletionLineIndex+=e,r.additionLineIndex+=n}e.deletionLines=r,e.additionLines=l,e.isPartial=!1}function Q({files:e,selectedFile:t,checkedFiles:n,onFileClick:l,onContextMenu:a,onToggleFile:s,onToggleAll:i}){return 0===e.length?(0,r.jsx)("div",{className:"flex items-center justify-center py-12 text-sm text-muted-foreground",children:"Working tree clean"}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"px-3 py-1.5 border-b flex items-center gap-2",children:[(0,r.jsx)(H,{checked:n.size===e.length,onChange:i}),(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:"Select all"})]}),e.map(e=>(0,r.jsxs)("div",{className:(0,w.cn)("flex items-center gap-2 px-3 py-1.5 text-sm cursor-pointer border-b last:border-b-0 hover:bg-muted/50",t===e.path&&"bg-muted"),onClick:()=>l(e),onContextMenu:t=>a(t,e),children:[(0,r.jsx)(H,{checked:n.has(e.path),onChange:()=>s(e.path),onClick:e=>e.stopPropagation()}),X(e.status),(0,r.jsx)("span",{className:"font-mono text-xs truncate flex-1 min-w-0 text-left",dir:"rtl",title:e.path,children:(0,r.jsx)("bdo",{dir:"ltr",children:e.path})}),(e.additions>0||e.deletions>0)&&(0,r.jsxs)("span",{className:"text-xs font-mono shrink-0 flex items-center gap-1",children:[e.additions>0&&(0,r.jsxs)("span",{className:"text-green-500",children:["+",e.additions]}),e.deletions>0&&(0,r.jsxs)("span",{className:"text-red-500",children:["-",e.deletions]})]}),(0,r.jsx)("span",{className:(0,w.cn)("text-xs font-mono shrink-0","added"===e.status||"untracked"===e.status?"text-green-500":"deleted"===e.status?"text-red-500":"text-yellow-500"),children:function(e){switch(e){case"added":return"A";case"deleted":return"D";case"renamed":return"R";case"untracked":return"?";default:return"M"}}(e.status)})]},e.path))]})}function Z({files:e,cwd:t,diffStyle:n,scrollToFile:l,onScrolled:s,onViewFile:i,checkedFiles:c,onToggleFile:o,refreshKey:d}){let[u,f]=(0,a.useState)(new Map),h=(0,a.useRef)(new Map),m=(0,a.useRef)(new Set),x=(0,a.useRef)(d),[p,b]=(0,a.useState)(new Set),g=(0,a.useCallback)(e=>{f(t=>{let n=new Map(t);return n.set(e,{diff:t.get(e)?.diff||null,fileDiff:t.get(e)?.fileDiff||null,loading:!0}),n}),fetch(`/api/git/diff?cwd=${encodeURIComponent(t)}&file=${encodeURIComponent(e)}`).then(e=>{if(!e.ok)throw Error("Failed");return e.json()}).then(t=>{let n=null;try{let e=(0,v.J2)(t.diff);e.length>0&&e[0].files.length>0&&(n=e[0].files[0],null!=t.oldContent&&null!=t.newContent&&Y(n,t.oldContent,t.newContent))}catch{}f(r=>{let l=new Map(r);return l.set(e,{diff:t.diff,fileDiff:n,loading:!1}),l})}).catch(()=>{f(t=>{let n=new Map(t);return n.set(e,{diff:null,fileDiff:null,loading:!1}),n})})},[t]);(0,a.useEffect)(()=>{let t=d!==x.current;x.current=d,t&&m.current.clear();let n=new Set(e.map(e=>e.path));for(let t of e.filter(e=>!m.current.has(e.path)))m.current.add(t.path),g(t.path);for(let e of m.current)n.has(e)||m.current.delete(e)},[e,g,d]),(0,a.useEffect)(()=>{if(!l)return;let e=h.current.get(l);e&&e.scrollIntoView({behavior:"smooth",block:"start"}),s()},[l,s]);let j=(0,a.useCallback)(e=>{b(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),y=(0,a.useCallback)(e=>{o(e),c.has(e)||b(t=>new Set(t).add(e))},[o,c]);return 0===e.length?(0,r.jsx)("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"No changes"}):(0,r.jsx)("div",{className:"p-4 space-y-3",children:e.map(e=>{let t=u.get(e.path),l=c.has(e.path),a=p.has(e.path);return(0,r.jsx)("div",{ref:t=>{t&&h.current.set(e.path,t)},className:(0,w.cn)("rounded border overflow-clip",l&&!a&&"opacity-60"),children:a?(0,r.jsxs)("div",{className:"flex items-center gap-2 w-full px-4 py-2 text-sm text-muted-foreground",children:[(0,r.jsx)(H,{checked:l,onChange:()=>{o(e.path),l&&b(t=>{let n=new Set(t);return n.delete(e.path),n})},onClick:e=>e.stopPropagation()}),(0,r.jsxs)("button",{onClick:()=>j(e.path),className:"flex items-center gap-2 flex-1 min-w-0 hover:text-foreground transition-colors",children:[(0,r.jsx)(E.A,{className:"h-3.5 w-3.5 shrink-0"}),(0,r.jsx)("span",{className:"font-mono text-xs truncate text-left",dir:"rtl",title:e.path,children:(0,r.jsx)("bdo",{dir:"ltr",children:e.path})})]})]}):t?.loading&&!t.diff?(0,r.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,r.jsx)(P.A,{className:"h-4 w-4 animate-spin text-muted-foreground"})}):t?.diff?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"sticky top-0 z-10 flex items-center gap-2 px-4 py-1.5 text-sm border-b bg-muted/80 backdrop-blur-sm","data-testid":"sticky-diff-header",children:[X(e.status),(0,r.jsx)("span",{className:"font-mono text-xs truncate flex-1 min-w-0 text-left",dir:"rtl",title:e.path,children:(0,r.jsx)("bdo",{dir:"ltr",children:e.path})}),(0,r.jsx)(H,{checked:l,onChange:()=>y(e.path),onClick:e=>e.stopPropagation()}),(0,r.jsx)("button",{onClick:()=>j(e.path),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",title:"Collapse",children:(0,r.jsx)(A.A,{className:"h-3 w-3"})}),(0,r.jsx)("button",{onClick:()=>i(e.path),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:(0,r.jsx)(M.A,{className:"h-3 w-3"})})]}),(0,r.jsx)(W.sU,{fallback:(0,r.jsx)("pre",{className:"p-4 text-xs text-muted-foreground whitespace-pre-wrap",children:t.diff}),children:t.fileDiff?(0,r.jsx)(k.Q,{fileDiff:t.fileDiff,options:{theme:{dark:"pierre-dark",light:"pierre-light"},themeType:K()?"dark":"light",overflow:"wrap",diffStyle:n,disableFileHeader:!0,hunkSeparators:"line-info",expansionLineCount:20,unsafeCSS:W.j8}}):(0,r.jsx)("pre",{className:"p-4 text-xs text-muted-foreground whitespace-pre-wrap",children:t.diff})})]}):(0,r.jsx)("div",{className:"px-4 py-3 text-xs text-muted-foreground",children:"No diff available"})},e.path)})})}let ee=new Map;function et({cwd:e,sessionId:t,embeddedChat:n=!0,manageSidebar:l=!0}){let i,c,o,{settings:d}=(0,J.t)(),{setSidebarSection:u,removeSidebarSection:f,closeSidebar:h,tabActions:m}=(0,s.E2)(),{send:x,subscribe:p}=(0,q.h)(),b=(0,y.G)(),[g,j]=(0,a.useState)(null),[C,S]=(0,a.useState)(!0),[T,I]=(0,a.useState)(null),O=ee.get(e)||{selectedFile:null,commitMsg:"",commitPanelOpen:window.matchMedia("(min-width: 768px)").matches,pushOnCommit:!1,stackedMode:!0,chatRatio:.3},[en,er]=(0,a.useState)(O.selectedFile),[el,ea]=(0,a.useState)(null),[es,ei]=(0,a.useState)(null),[ec,eo]=(0,a.useState)(!1),[ed,eu]=(0,a.useState)(null),[ef,eh]=(0,a.useState)(O.commitMsg),[em,ex]=(0,a.useState)(!1),[ep,eb]=(0,a.useState)(null),{checkedFiles:eg,toggleFile:ej,toggleAll:ey,setCheckedFiles:ew}=(0,V.e)(e),[ev,ek]=(0,a.useState)(O.pushOnCommit),[eN,eC]=(0,a.useState)(O.commitPanelOpen),[eS,eT]=(0,a.useState)(!1),[eI,eE]=(0,a.useState)(!1),[eP,eA]=(0,a.useState)(null),[eM,eF]=(0,a.useState)(O.stackedMode),[eR,eD]=(0,a.useState)(O.chatRatio),[eO,ez]=(0,a.useState)(null),[e$,eL]=(0,a.useState)(0),e_=(0,a.useRef)(null);(0,a.useEffect)(()=>{ee.set(e,{selectedFile:en,commitMsg:ef,commitPanelOpen:eN,pushOnCommit:ev,stackedMode:eM,chatRatio:eR})},[e,en,ef,eN,ev,eM,eR]);let eU=(0,a.useCallback)(t=>{t?.refresh||S(!0),I(null);let n=new URLSearchParams({cwd:e});t?.gitFetch&&n.set("fetch","1"),fetch(`/api/git/status?${n}`).then(e=>{if(!e.ok)throw Error("Failed");return e.json()}).then(e=>{j(e),t?.refresh&&eL(e=>e+1)}).catch(()=>I("Not a git repository")).finally(()=>S(!1))},[e]);(0,a.useEffect)(()=>{eU()},[eU]),(0,a.useEffect)(()=>{x({type:"watch:cwd",cwd:e})},[x,e]);let eW=(0,a.useRef)(null);(0,a.useEffect)(()=>{if(t)return p(e=>{if("session:status"!==e.type||!("sessionId"in e)||e.sessionId!==t)return;let n=eW.current;eW.current=e.status,"running"===n&&"idle"===e.status&&eU({refresh:!0})})},[t,p,eU]),(0,a.useEffect)(()=>p(e=>{"session:fs_changed"===e.type&&eU({refresh:!0})}),[p,eU]);let eG=(0,a.useCallback)(t=>{eo(!0),ea(null),ei(null),fetch(`/api/git/diff?cwd=${encodeURIComponent(e)}&file=${encodeURIComponent(t)}`).then(e=>{if(!e.ok)throw Error("Failed");return e.json()}).then(e=>{ea(e.diff);try{let t=(0,v.J2)(e.diff);if(t.length>0&&t[0].files.length>0){let n=t[0].files[0];null!=e.oldContent&&null!=e.newContent&&Y(n,e.oldContent,e.newContent),ei(n)}}catch{}}).catch(()=>ea(null)).finally(()=>eo(!1))},[e]),eB=(0,a.useRef)(e$);(0,a.useEffect)(()=>{if(!en||eM)return;let t=eB.current!==e$;eB.current=e$,t?fetch(`/api/git/diff?cwd=${encodeURIComponent(e)}&file=${encodeURIComponent(en)}`).then(e=>{if(!e.ok)throw Error("Failed");return e.json()}).then(e=>{ea(e.diff);try{let t=(0,v.J2)(e.diff);if(t.length>0&&t[0].files.length>0){let n=t[0].files[0];null!=e.oldContent&&null!=e.newContent&&Y(n,e.oldContent,e.newContent),ei(n)}}catch{}}).catch(()=>{}):eG(en)},[eM,en,eG,e$,e]),(0,a.useEffect)(()=>{if(!g||0===g.files.length||en||eM)return;let e=g.files[0];er(e.path),eG(e.path)},[g,en,eM,eG]);let eJ=(0,a.useCallback)(e=>{eM?ez(e.path):(er(e.path),eG(e.path),eu(null),h())},[eM,eG,h]),eq=(0,a.useCallback)((e,t)=>{e.preventDefault(),eu({x:e.clientX,y:e.clientY,file:t})},[]),eV=(0,a.useCallback)(async t=>{eu(null);try{if(!(await fetch("/api/git/discard",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:e,file:t.path,status:t.status})})).ok)throw Error("Failed");en===t.path&&(er(null),ea(null)),eU()}catch{}},[e,en,eU]),eH=(0,a.useCallback)(async()=>{if(ef.trim()&&0!==eg.size){ex(!0),eb(null);try{let t=await fetch("/api/git/commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:e,message:ef.trim(),files:Array.from(eg),push:ev})});if(!t.ok){let e=await t.json();throw Error(e.error||"Failed to commit")}eb({ok:!0,message:ev?"Committed and pushed":"Committed"}),eh(""),ew(new Set),er(null),ea(null),eU()}catch(e){eb({ok:!1,message:e instanceof Error?e.message:"Failed"})}finally{ex(!1)}}},[e,ef,eg,ev,eU,ew]),eX=(0,a.useCallback)(async()=>{if(0!==eg.size){eT(!0);try{let t=await fetch("/api/git/generate-message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:e,files:Array.from(eg)})}),n=await t.json();if(!t.ok)throw Error(n.error||"Failed");n.message&&eh(n.message)}catch(e){console.error("[generate-message]",e)}finally{eT(!1)}}},[e,eg]),eK=(0,a.useCallback)(async()=>{eE(!0),eA(null);try{let t=await fetch("/api/git/push",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:e})});if(!t.ok){let e=await t.json();throw Error(e.error||"Failed to push")}eA({ok:!0,message:"Pushed"}),eU()}catch(e){eA({ok:!1,message:e instanceof Error?e.message:"Failed"})}finally{eE(!1)}},[e,eU]),eY=(0,a.useCallback)(()=>{g&&ey(g.files.map(e=>e.path))},[g,ey]),eQ=(0,a.useCallback)(e=>{let t=window.innerWidth||1;eD(n=>Math.max(.15,Math.min(.5,n+e/t)))},[]),eZ=(0,a.useCallback)(()=>{ez(null)},[]),e0=(0,a.useCallback)(t=>{let n=t.startsWith("/")?t:`${e}/${t}`;m?.openFile(n)},[e,m]);if((0,a.useEffect)(()=>{if(l)return g&&0!==g.files.length?(u({id:"git-changes",title:"Changes",order:20,badge:String(g.files.length),content:(0,r.jsx)(Q,{files:g.files,selectedFile:eM?null:en,checkedFiles:eg,onFileClick:eJ,onContextMenu:eq,onToggleFile:ej,onToggleAll:eY})}),()=>f("git-changes")):void f("git-changes")},[l,g,en,eg,eM,eJ,eq,ej,eY,u,f]),(0,a.useEffect)(()=>{if(!ed)return;let e=e=>{e_.current&&!e_.current.contains(e.target)&&eu(null)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[ed]),C)return(0,r.jsx)("div",{className:"flex items-center justify-center flex-1",children:(0,r.jsx)(P.A,{className:"h-6 w-6 animate-spin text-muted-foreground"})});if(T)return(0,r.jsx)("div",{className:"flex items-center justify-center flex-1",children:(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:T})});if(!g)return null;let e1=n&&b&&!!t;return(0,r.jsxs)("div",{className:"flex flex-col flex-1 min-h-0",children:[(0,r.jsxs)("div",{className:"shrink-0 border-b px-4 py-2 flex items-center gap-3",children:[(0,r.jsx)(F.A,{className:"h-4 w-4 text-muted-foreground"}),(0,r.jsx)("span",{className:"font-mono text-sm font-bold",children:g.branch}),(0,r.jsxs)("span",{className:"text-xs text-muted-foreground",children:[g.files.length," file",1!==g.files.length?"s":""," changed"]}),(i=g.files.reduce((e,t)=>e+t.additions,0),c=g.files.reduce((e,t)=>e+t.deletions,0),i>0||c>0?(0,r.jsxs)("span",{className:"text-xs font-mono flex items-center gap-1",children:[i>0&&(0,r.jsxs)("span",{className:"text-green-500",children:["+",i]}),c>0&&(0,r.jsxs)("span",{className:"text-red-500",children:["-",c]})]}):null),g.ahead>0&&(0,r.jsxs)("span",{className:"text-xs text-muted-foreground",children:[g.ahead," unpushed"]}),eP&&(0,r.jsxs)("span",{className:(0,w.cn)("text-xs flex items-center gap-1",eP.ok?"text-green-500":"text-red-500"),children:[eP.ok&&(0,r.jsx)(N.A,{className:"h-3 w-3"}),eP.message]}),(0,r.jsx)("div",{className:"flex-1"}),g.files.length>0&&(0,r.jsxs)("div",{className:"flex items-center gap-0.5 rounded-md border p-0.5",children:[(0,r.jsx)("button",{onClick:()=>eF(!0),className:(0,w.cn)("rounded px-1.5 py-0.5 text-xs transition-colors",eM?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),title:"Stacked view",children:(0,r.jsx)(R.A,{className:"h-3.5 w-3.5"})}),(0,r.jsx)("button",{onClick:()=>eF(!1),className:(0,w.cn)("rounded px-1.5 py-0.5 text-xs transition-colors",eM?"text-muted-foreground hover:text-foreground":"bg-primary text-primary-foreground"),title:"Single file view",children:(0,r.jsx)(D.A,{className:"h-3.5 w-3.5"})})]}),g.ahead>0&&(0,r.jsxs)(B.$,{variant:"outline",size:"sm",onClick:eK,disabled:eI,className:"gap-1.5",children:[eI?(0,r.jsx)(P.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,r.jsx)(z,{className:"h-3.5 w-3.5"}),"Push"]}),(0,r.jsx)(B.$,{variant:"ghost",size:"sm",onClick:()=>eU({gitFetch:!0}),children:"Refresh"})]}),(0,r.jsxs)("div",{className:"flex-1 min-h-0 flex flex-row",children:[(0,r.jsxs)("div",{className:"flex-1 min-w-0 flex flex-col",children:[(0,r.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto",children:eM?(0,r.jsx)(Z,{files:g.files,cwd:e,diffStyle:d.diffStyle,scrollToFile:eO,onScrolled:eZ,onViewFile:e0,checkedFiles:eg,onToggleFile:ej,refreshKey:e$}):ec?(0,r.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,r.jsx)(P.A,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):en&&el?(0,r.jsx)("div",{className:"p-4",children:(0,r.jsxs)("div",{className:"rounded-lg border overflow-hidden",children:[(o=g.files.find(e=>e.path===en))?(0,r.jsxs)("div",{className:"sticky top-0 z-10 flex items-center gap-2 px-4 py-1.5 text-sm border-b bg-muted/80 backdrop-blur-sm",children:[X(o.status),(0,r.jsx)("span",{className:"font-mono text-xs truncate flex-1 min-w-0 text-left",dir:"rtl",title:o.path,children:(0,r.jsx)("bdo",{dir:"ltr",children:o.path})}),(0,r.jsx)(H,{checked:eg.has(o.path),onChange:()=>ej(o.path),onClick:e=>e.stopPropagation()}),(0,r.jsx)("button",{onClick:()=>e0(o.path),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",title:"Open in editor",children:(0,r.jsx)(M.A,{className:"h-3 w-3"})})]}):null,(0,r.jsx)(W.sU,{fallback:(0,r.jsx)("pre",{className:"p-4 text-xs text-muted-foreground whitespace-pre-wrap",children:el}),children:es?(0,r.jsx)(k.Q,{fileDiff:es,options:{theme:{dark:"pierre-dark",light:"pierre-light"},themeType:K()?"dark":"light",overflow:"wrap",diffStyle:d.diffStyle,disableFileHeader:!0,hunkSeparators:"line-info",expansionLineCount:20,unsafeCSS:W.j8}}):(0,r.jsx)("pre",{className:"p-4 text-xs text-muted-foreground whitespace-pre-wrap",children:el})})]})}):(0,r.jsx)("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground text-center px-4",children:g.files.length>0?"Select a file from the sidebar to view changes":"No changes"})}),g.files.length>0&&(0,r.jsxs)("div",{className:"shrink-0 border-t",children:[(0,r.jsxs)("button",{onClick:()=>eC(!eN),className:"w-full px-4 py-2 flex items-center gap-2 text-sm font-medium hover:bg-muted/50",children:[eN?(0,r.jsx)(E.A,{className:"h-3.5 w-3.5"}):(0,r.jsx)(A.A,{className:"h-3.5 w-3.5"}),"Commit (",eg.size," file",1!==eg.size?"s":"",")"]}),eN&&(0,r.jsxs)("div",{className:"px-4 pb-3 space-y-2",children:[(0,r.jsx)("textarea",{value:ef,onChange:e=>eh(e.target.value),placeholder:"Commit message...",className:"w-full rounded border bg-background px-3 py-2 text-sm resize-none focus:outline-none focus:ring-1 focus:ring-ring",rows:3}),(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsxs)(B.$,{size:"sm",variant:"outline",onClick:eX,disabled:eS||0===eg.size,className:"gap-1.5",children:[eS?(0,r.jsx)(P.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,r.jsx)($,{className:"h-3.5 w-3.5"}),eS?"Generating...":"Generate"]}),(0,r.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground cursor-pointer",children:[(0,r.jsx)(H,{checked:ev,onChange:()=>ek(!ev)}),"Push after commit"]}),(0,r.jsx)("div",{className:"flex-1"}),ep&&(0,r.jsxs)("span",{className:(0,w.cn)("text-xs flex items-center gap-1",ep.ok?"text-green-500":"text-red-500"),children:[ep.ok&&(0,r.jsx)(N.A,{className:"h-3 w-3"}),ep.message]}),(0,r.jsxs)(B.$,{size:"sm",onClick:eH,disabled:em||!ef.trim()||0===eg.size,className:"gap-1.5",children:[em?(0,r.jsx)(P.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,r.jsx)(L.A,{className:"h-3.5 w-3.5"}),ev?"Commit & Push":"Commit"]})]})]})]})]}),e1&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(G,{onResize:eQ}),(0,r.jsx)("div",{className:"flex flex-col shrink-0 border-l min-h-0",style:{width:`${100*eR}%`},children:(0,r.jsx)(U.I,{sessionId:t,cwd:e})})]})]}),ed&&(0,r.jsx)("div",{ref:e_,className:"fixed z-50 rounded border bg-background shadow-lg py-1 min-w-[140px]",style:{left:ed.x,top:ed.y},children:(0,r.jsxs)("button",{onClick:()=>eV(ed.file),className:"w-full px-3 py-1.5 text-sm text-left hover:bg-muted flex items-center gap-2 text-red-500",children:[(0,r.jsx)(_.A,{className:"h-3.5 w-3.5"}),"Discard changes"]})})]})}function en(e,t,n){let r=t.split(/\r?\n/).map(e=>e+"\n"),l=n.split(/\r?\n/).map(e=>e+"\n");for(let t of e.hunks){let e=t.deletionStart-1-t.deletionLineIndex,n=t.additionStart-1-t.additionLineIndex;for(let r of(t.deletionLineIndex=t.deletionStart-1,t.additionLineIndex=t.additionStart-1,t.hunkContent))r.deletionLineIndex+=e,r.additionLineIndex+=n}e.deletionLines=r,e.additionLines=l,e.isPartial=!1}function er({cwd:e,filePath:t}){let{settings:n}=(0,J.t)(),{tabActions:l}=(0,s.E2)(),{subscribe:i}=(0,q.h)(),[c,o]=(0,a.useState)(!0),[d,u]=(0,a.useState)(null),[f,h]=(0,a.useState)(null),[m,x]=(0,a.useState)("modified"),{checkedFiles:p,toggleFile:b}=(0,V.e)(e),g=p.has(t),j=(0,a.useRef)(void 0),y=(0,a.useCallback)(()=>{o(!0),u(null),h(null),fetch(`/api/git/diff?cwd=${encodeURIComponent(e)}&file=${encodeURIComponent(t)}`).then(e=>{if(!e.ok)throw Error("Failed");return e.json()}).then(e=>{u(e.diff),e.status&&x(e.status);try{let t=(0,v.J2)(e.diff);if(t.length>0&&t[0].files.length>0){let n=t[0].files[0];null!=e.oldContent&&null!=e.newContent&&en(n,e.oldContent,e.newContent),h(n)}}catch{}}).catch(()=>u(null)).finally(()=>o(!1))},[e,t]);(0,a.useEffect)(()=>{y()},[y]);let E=(0,a.useCallback)(()=>{fetch(`/api/git/diff?cwd=${encodeURIComponent(e)}&file=${encodeURIComponent(t)}`).then(e=>{if(!e.ok)throw Error("Failed");return e.json()}).then(e=>{u(e.diff),e.status&&x(e.status);try{let t=(0,v.J2)(e.diff);if(t.length>0&&t[0].files.length>0){let n=t[0].files[0];null!=e.oldContent&&null!=e.newContent&&en(n,e.oldContent,e.newContent),h(n)}}catch{}}).catch(()=>{})},[e,t]);(0,a.useEffect)(()=>i(e=>{"session:fs_changed"===e.type&&(clearTimeout(j.current),j.current=setTimeout(E,300))}),[i,E]);let A=(0,a.useCallback)(()=>{b(t)},[b,t]),F=(0,a.useCallback)(()=>{let n=t.startsWith("/")?t:`${e}/${t}`;l?.openFile(n)},[e,t,l]);return c?(0,r.jsx)("div",{className:"flex items-center justify-center flex-1",children:(0,r.jsx)(P.A,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):d?(0,r.jsx)("div",{className:"flex flex-col flex-1 min-h-0",children:(0,r.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto",children:(0,r.jsx)("div",{className:"p-4",children:(0,r.jsxs)("div",{className:"rounded-lg border overflow-hidden",children:[(0,r.jsxs)("div",{className:"sticky top-0 z-10 flex items-center gap-2 px-4 py-1.5 text-sm border-b bg-muted/80 backdrop-blur-sm",children:[function(e){switch(e){case"added":case"untracked":return(0,r.jsx)(C.A,{className:"h-3.5 w-3.5 text-green-500 shrink-0"});case"deleted":return(0,r.jsx)(S.A,{className:"h-3.5 w-3.5 text-red-500 shrink-0"});case"renamed":return(0,r.jsx)(T.A,{className:"h-3.5 w-3.5 text-blue-500 shrink-0"});default:return(0,r.jsx)(I.A,{className:"h-3.5 w-3.5 text-yellow-500 shrink-0"})}}(m),(0,r.jsx)("span",{className:"font-mono text-xs truncate flex-1 min-w-0 text-left",dir:"rtl",title:t,children:(0,r.jsx)("bdo",{dir:"ltr",children:t})}),(0,r.jsx)("button",{type:"button",role:"checkbox","aria-checked":g,onClick:A,className:(0,w.cn)("h-4 w-4 shrink-0 rounded border flex items-center justify-center transition-colors",g?"border-primary bg-primary text-primary-foreground":"border-muted-foreground/40 bg-transparent hover:border-muted-foreground/60"),children:g&&(0,r.jsx)(N.A,{className:"h-3 w-3",strokeWidth:3})}),(0,r.jsx)("button",{onClick:F,className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",title:"Open in editor",children:(0,r.jsx)(M.A,{className:"h-3 w-3"})})]}),(0,r.jsx)(W.sU,{fallback:(0,r.jsx)("pre",{className:"p-4 text-xs text-muted-foreground whitespace-pre-wrap",children:d}),children:f?(0,r.jsx)(k.Q,{fileDiff:f,options:{theme:{dark:"pierre-dark",light:"pierre-light"},themeType:!("u"<typeof document)&&document.documentElement.classList.contains("dark")?"dark":"light",overflow:"wrap",diffStyle:n.diffStyle,disableFileHeader:!0,hunkSeparators:"line-info",expansionLineCount:20,unsafeCSS:W.j8}}):(0,r.jsx)("pre",{className:"p-4 text-xs text-muted-foreground whitespace-pre-wrap",children:d})})]})})})}):(0,r.jsx)("div",{className:"flex items-center justify-center flex-1 text-sm text-muted-foreground",children:"No diff available"})}var el=n(2125),ea=n(65377),es=n(25182);let ei=(0,O.A)("text-wrap",[["path",{d:"m16 16-3 3 3 3",key:"117b85"}],["path",{d:"M3 12h14.5a1 1 0 0 1 0 7H13",key:"18xa6z"}],["path",{d:"M3 19h6",key:"1ygdsz"}],["path",{d:"M3 5h18",key:"1u36vt"}]]);var ec=n(9005),eo=n(18189),ed=n(8187),eu=n(96301),ef=n(64233),eh=n(42763);let em=new Map,ex=new Map;function ep(e){for(let t of Array.from(e.querySelectorAll("mark.file-search-match"))){let e=t.parentNode;if(e){for(;t.firstChild;)e.insertBefore(t.firstChild,t);e.removeChild(t),e.normalize()}}}function eb(e,t){let n=e.querySelectorAll("mark.file-search-match");n.forEach(e=>{e.style.backgroundColor="rgba(250, 204, 21, 0.35)"});let r=n[t];r&&(r.style.backgroundColor="rgba(234, 88, 12, 0.5)",r.scrollIntoView({block:"center",behavior:"smooth"}))}function eg({cwd:e,initialFile:t,manageSidebar:n=!0}){let{setSidebarSection:l,removeSidebarSection:i,closeSidebar:c,tabActions:o}=(0,s.E2)(),{subscribe:d}=(0,q.h)(),[f,h]=(0,a.useState)(()=>t||em.get(e)||null),[m,x]=(0,a.useState)(null),[p,b]=(0,a.useState)(!1),[g,j]=(0,a.useState)(!1),[y,w]=(0,a.useState)(!1),[v,k]=(0,a.useState)(!1),[N,C]=(0,a.useState)(!1),S=(0,a.useRef)(0),T=(0,a.useRef)(null),I=(0,a.useRef)(null),M=(0,a.useRef)(null),F=(0,a.useRef)(-1),[R,D]=(0,a.useState)(!1),[O,z]=(0,a.useState)(""),[$,L]=(0,a.useState)(0),[_,U]=(0,a.useState)(-1);(0,a.useEffect)(()=>{"1"===localStorage.getItem("cockpit-files-wrap")&&w(!0),"1"===localStorage.getItem("cockpit-files-preview")&&k(!0)},[]);let W=(0,a.useCallback)(()=>{w(e=>{let t=!e;return localStorage.setItem("cockpit-files-wrap",t?"1":"0"),t})},[]),G=(0,a.useCallback)(()=>{k(e=>{let t=!e;return localStorage.setItem("cockpit-files-preview",t?"1":"0"),t})},[]),B=(0,a.useCallback)(()=>{D(!0),requestAnimationFrame(()=>{M.current?.focus(),M.current?.select()})},[]),J=(0,a.useCallback)(()=>{D(!1),z("")},[]),V=(0,a.useCallback)(e=>{if(0===$||!T.current)return;let t=((_+e)%$+$)%$;F.current=t,U(t),eb(T.current,t)},[$,_]),H=(0,a.useCallback)(e=>{"Escape"===e.key?J():"Enter"===e.key&&(e.preventDefault(),V(e.shiftKey?-1:1))},[J,V]);(0,a.useEffect)(()=>{let e;if(!R||!O||!T.current){T.current&&ep(T.current),L(0),F.current=-1,U(-1);return}let t=T.current,n=e=>{let n,r=function(e,t){if(ep(e),!t)return 0;let n=t.toLowerCase(),r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),l=[];for(;r.nextNode();){let e=r.currentNode.parentNode?.nodeName;"STYLE"!==e&&"SCRIPT"!==e&&l.push(r.currentNode)}let a=0;for(let e of l){let r=e.textContent??"",l=r.toLowerCase(),s=[],i=0;for(;;){let e=l.indexOf(n,i);if(-1===e)break;s.push(e),i=e+1}if(!s.length)continue;let c=document.createDocumentFragment(),o=0;for(let e of s){e>o&&c.appendChild(document.createTextNode(r.slice(o,e)));let n=document.createElement("mark");n.className="file-search-match",n.style.backgroundColor="rgba(250, 204, 21, 0.35)",n.style.color="inherit",n.style.borderRadius="1px",n.textContent=r.slice(e,e+t.length),c.appendChild(n),a++,o=e+t.length}o<r.length&&c.appendChild(document.createTextNode(r.slice(o))),e.parentNode?.replaceChild(c,e)}return a}(t,O);L(r),n=!e&&F.current>=0&&r>0?Math.min(F.current,r-1):r>0?0:-1,F.current=n,U(n),n>=0&&eb(t,n)};e=requestAnimationFrame(()=>n(!0));let r=new MutationObserver(()=>{t.querySelector("mark.file-search-match")||(e=requestAnimationFrame(()=>n(!1)))});return r.observe(t,{childList:!0,subtree:!0}),()=>{cancelAnimationFrame(e),r.disconnect()}},[R,O,m,y,v]);let X=(0,a.useCallback)(t=>{h(t),em.set(e,t),window.innerWidth<768&&c()},[e,c]),K=(0,a.useCallback)(e=>{o?o.openFile(e):X(e),j(!1)},[o,X]);if((0,a.useEffect)(()=>{if(n)return l({id:"file-tree",title:"Files",content:(0,r.jsx)(eu.h,{cwd:e,selectedFile:f,onSelectFile:X}),order:30,actions:(0,r.jsx)("button",{onClick:()=>j(!0),title:"Open file",className:"flex items-center justify-center rounded p-0.5 hover:bg-accent text-muted-foreground",children:(0,r.jsx)(el.A,{className:"h-3.5 w-3.5"})})}),()=>i("file-tree")},[e,f,X,l,i,n]),(0,a.useEffect)(()=>{if(!f)return void x(null);C(!1);let e=ex.get(f);if(e)return void x(e);let t=++S.current;b(!0),fetch(`/api/filesystem/read?path=${encodeURIComponent(f)}`).then(e=>{if(!e.ok)throw Error("Failed to read file");return e.json()}).then(e=>{if(S.current===t){if(ex.size>=50){let e=ex.keys().next().value;void 0!==e&&ex.delete(e)}ex.set(f,e),x(e)}}).catch(()=>{S.current===t&&x(null)}).finally(()=>{S.current===t&&b(!1)})},[f]),(0,a.useEffect)(()=>{if(!f)return;let e=async()=>{let e=ex.get(f);if(e?.mtimeMs)try{let t=await fetch(`/api/filesystem/read?path=${encodeURIComponent(f)}&stat=true`);if(!t.ok)return;if((await t.json()).mtimeMs!==e.mtimeMs){let e=I.current?.scrollTop??0,t=await fetch(`/api/filesystem/read?path=${encodeURIComponent(f)}`);if(!t.ok)return;let n=await t.json();ex.set(f,n),x(n),requestAnimationFrame(()=>{I.current&&(I.current.scrollTop=e)})}}catch{}};return d(t=>{"session:fs_changed"===t.type&&e()})},[f,d]),!f)return(0,r.jsx)("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"Select a file to view"});if(p)return(0,r.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,r.jsx)(P.A,{className:"h-5 w-5 animate-spin text-muted-foreground"})});if(!m)return(0,r.jsx)("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"Failed to read file"});let Y=function(e,t){if(t.startsWith(e)){let n=t.slice(e.length);return n.startsWith("/")?n.slice(1):n}return t}(e,f),Q=(0,u.uk)(f)||f,Z=Y.slice(0,Y.length-Q.length),ee=(0,eo.WG)(f),et="markdown"===ee||"mdx"===ee,en=et&&v,er=!m.binary&&!m.image;return(0,r.jsxs)("div",{className:"flex flex-col h-full min-h-0",children:[(0,r.jsxs)("div",{className:"shrink-0 flex items-center gap-1 border-b px-4 py-2 font-mono text-xs",children:[Z&&(0,r.jsx)("span",{className:"text-muted-foreground",children:Z}),(0,r.jsx)("span",{className:"font-bold",children:Q}),m.truncated&&(0,r.jsx)("span",{className:"ml-2 text-muted-foreground",children:"(truncated to 100KB)"}),(0,r.jsxs)("div",{className:"ml-auto flex items-center gap-1",children:[er&&(0,r.jsx)("button",{type:"button",onClick:R?J:B,"aria-label":"Find in file",title:"Find in file",className:`flex items-center justify-center rounded p-1 hover:bg-accent ${R?"text-foreground":"text-muted-foreground"}`,children:(0,r.jsx)(ea.A,{className:"h-3.5 w-3.5"})}),et&&(0,r.jsx)("button",{type:"button",onClick:G,"aria-label":v?"Show source":"Show preview","aria-pressed":v,title:v?"Show source":"Show preview",className:`flex items-center justify-center rounded p-1 hover:bg-accent ${v?"text-foreground":"text-muted-foreground"}`,children:(0,r.jsx)(es.A,{className:"h-3.5 w-3.5"})}),er&&!en&&(0,r.jsx)("button",{type:"button",onClick:W,"aria-label":y?"Disable line wrap":"Enable line wrap","aria-pressed":y,title:y?"Disable line wrap":"Enable line wrap",className:`flex items-center justify-center rounded p-1 hover:bg-accent ${y?"text-foreground":"text-muted-foreground"}`,children:(0,r.jsx)(ei,{className:"h-3.5 w-3.5"})})]})]}),R&&(0,r.jsxs)("div",{className:"shrink-0 flex items-center gap-1.5 border-b px-4 py-1.5",children:[(0,r.jsx)("input",{ref:M,value:O,onChange:e=>z(e.target.value),onKeyDown:H,placeholder:"Find in file...",className:"flex-1 min-w-0 bg-transparent text-xs outline-none placeholder:text-muted-foreground"}),O&&(0,r.jsx)("span",{className:"text-[10px] text-muted-foreground tabular-nums shrink-0",children:$>0?`${_+1} of ${$}`:"No results"}),(0,r.jsx)("button",{type:"button",onClick:()=>V(-1),disabled:0===$,className:"flex items-center justify-center rounded p-0.5 hover:bg-accent text-muted-foreground disabled:opacity-30",children:(0,r.jsx)(A.A,{className:"h-3.5 w-3.5"})}),(0,r.jsx)("button",{type:"button",onClick:()=>V(1),disabled:0===$,className:"flex items-center justify-center rounded p-0.5 hover:bg-accent text-muted-foreground disabled:opacity-30",children:(0,r.jsx)(E.A,{className:"h-3.5 w-3.5"})}),(0,r.jsx)("button",{type:"button",onClick:J,className:"flex items-center justify-center rounded p-0.5 hover:bg-accent text-muted-foreground",children:(0,r.jsx)(ec.A,{className:"h-3 w-3"})})]}),(0,r.jsx)("div",{ref:T,className:"flex-1 min-h-0 flex flex-col",children:m.image?(0,r.jsx)("div",{ref:I,className:"flex-1 min-h-0 overflow-auto flex items-center justify-center p-4",children:N?(0,r.jsx)("div",{className:"text-sm text-muted-foreground",children:"Could not display image"}):(0,r.jsx)("img",{src:`/api/filesystem/read?path=${encodeURIComponent(f)}&raw=true${m.mtimeMs?`&t=${m.mtimeMs}`:""}`,alt:Q,className:"max-w-full max-h-full object-contain",onError:()=>C(!0)})}):m.binary?(0,r.jsx)("div",{className:"flex items-center justify-center flex-1 text-sm text-muted-foreground",children:"Binary file"}):en?(0,r.jsx)("div",{ref:I,className:"flex-1 min-h-0 overflow-y-auto p-4",children:(0,r.jsx)(ef.Y,{content:m.content})}):(0,r.jsx)("div",{ref:I,className:"flex-1 min-h-0 overflow-auto",children:(0,r.jsx)(eo.NG,{code:m.content,language:ee,dark:!("u"<typeof document)&&document.documentElement.classList.contains("dark"),fullHeight:!0,wrap:y})})}),(0,r.jsx)(eh.lG,{open:g,onOpenChange:j,children:(0,r.jsxs)(eh.Cf,{className:"sm:max-w-lg",children:[(0,r.jsx)(eh.c7,{children:(0,r.jsx)(eh.L3,{children:"Open File"})}),(0,r.jsx)(ed.N,{startPath:e,onSelect:K,onCancel:()=>j(!1)})]})})]})}var ej=n(25494),ey=n(36483);let ew=(0,O.A)("file-diff",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M9 10h6",key:"9gxzsh"}],["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"M9 17h6",key:"r8uit2"}]]);var ev=n(16449);let ek=(0,O.A)("columns-2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]]);function eN(e,t,n,r){let l=Array.from(e.querySelectorAll("[data-tab-id]"));if(0===l.length)return 0;let a=r.indexOf(n);for(let e=0;e<l.length;e++){let n=l[e].getBoundingClientRect();if(t<n.left+n.width/2){if(e===a||e===a+1)return null;return e}}let s=l.length;return s===a||s===a+1?null:s}function eC({splitRatio:e}){let t=j(),n=(0,y.G)(),l=(0,a.useRef)(null),[s,i]=(0,a.useState)(null),[c,o]=(0,a.useState)(null),[d,u]=(0,a.useState)(!1),f=(0,a.useRef)(null),h=(0,a.useRef)(null),m=(0,a.useRef)(null);if(!t||t.tabs.length<=1)return null;let{activeTabId:x,splitTabId:p,rightPaneTabIds:b,setActiveTab:g,closeTab:v,setSplitTab:k,moveTab:N,moveTabToPane:C}=t,S=n&&null!==p,T=t.tabs.filter(e=>"chat"!==e.type),I=T.map(e=>e.id),E=()=>{l.current=null,i(null),o(null),u(!1)},P=()=>{l.current=null,i(null),o(null),u(!1)},A=(e,t)=>(0,r.jsx)("div",{className:(0,w.cn)("self-stretch shrink-0 rounded-full transition-all",s===e&&c===(t??null)?"w-0.5 bg-primary mx-0.5":d?"w-1":"w-0")},`ind-${t||"main"}-${e}`),M=(e,t,n,a)=>{let s;return(0,r.jsxs)("button",{"data-tab-id":"chat"!==e.type?e.id:void 0,draggable:a,onDragStart:a?(s=e.id,e=>{l.current=s,u(!0),e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",s)}):void 0,onDragEnd:a?E:void 0,onClick:n,className:(0,w.cn)("flex items-center gap-1.5 px-3 py-1.5 md:px-4 md:py-2.5 text-xs md:text-sm font-medium whitespace-nowrap border-b-2 transition-colors group",t?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground",a&&"cursor-grab active:cursor-grabbing"),children:[function(e){switch(e.type){case"chat":return(0,r.jsx)(ej.A,{className:"h-3 w-3 md:h-3.5 md:w-3.5 shrink-0"});case"file":return(0,r.jsx)(ey.A,{className:"h-3 w-3 md:h-3.5 md:w-3.5 shrink-0"});case"diff":return(0,r.jsx)(ew,{className:"h-3 w-3 md:h-3.5 md:w-3.5 shrink-0"});case"changes":return(0,r.jsx)(F.A,{className:"h-3 w-3 md:h-3.5 md:w-3.5 shrink-0"});case"terminal":return(0,r.jsx)(ev.A,{className:"h-3 w-3 md:h-3.5 md:w-3.5 shrink-0"})}}(e),(0,r.jsx)("span",{className:"truncate max-w-[120px]",children:function(e){switch(e.type){case"chat":return"Chat";case"file":case"diff":case"terminal":return e.label;case"changes":return"Changes"}}(e)}),"chat"!==e.type&&(0,r.jsx)("span",{role:"button",tabIndex:0,onClick:t=>{t.stopPropagation(),v(e.id)},onKeyDown:t=>{("Enter"===t.key||" "===t.key)&&(t.stopPropagation(),v(e.id))},className:"ml-0.5 rounded p-0.5 hover:bg-muted cursor-default",children:(0,r.jsx)(ec.A,{className:"h-2.5 w-2.5 md:h-3 md:w-3"})})]})},R=n&&T.length>0?(0,r.jsx)("button",{onClick:()=>{if(p)k(null);else{let e=t.tabs.find(e=>e.id===x&&"chat"!==e.type)||t.tabs.find(e=>"chat"!==e.type);e&&(k(e.id),"chat"!==x&&g("chat"))}},title:p?"Close split view":"Split view",className:(0,w.cn)("ml-auto shrink-0 flex items-center justify-center px-2 py-1.5 md:px-3 md:py-2.5 text-muted-foreground hover:text-foreground transition-colors",p&&"text-primary"),children:(0,r.jsx)(ek,{className:"h-3.5 w-3.5 md:h-4 md:w-4"})}):null;if(S){let n=e??.5,a=t.tabs.filter(e=>!b.includes(e.id)),d=a.filter(e=>"chat"!==e.type),u=d.map(e=>e.id),f=t.tabs.filter(e=>b.includes(e.id)),j=f.map(e=>e.id),y=e=>{e.preventDefault();let n=l.current;if(!n)return void P();let r=b.includes(n);"left"===c&&r?C(n,"left"):"right"!==c||r?null!==s&&c&&N(n,function(e,t,n){if(0===e.length||t>=e.length){let t=e[e.length-1];return t?n.findIndex(e=>e.id===t.id)+1:n.length}return n.findIndex(n=>n.id===e[t].id)}("left"===c?d:f,s,t.tabs)):C(n,"right"),P()};return(0,r.jsxs)("div",{className:"shrink-0 border-b flex items-center bg-background",children:[(0,r.jsxs)("div",{ref:h,className:"flex items-center overflow-x-auto scrollbar-none min-w-0",style:{width:`${(1-n)*100}%`},onDragOver:e=>{if(l.current){if(e.preventDefault(),e.dataTransfer.dropEffect="move",!h.current){i(0),o("left");return}i(eN(h.current,e.clientX,l.current,u)??0),o("left")}},onDrop:y,children:[M(a[0],x===a[0].id,()=>g(a[0].id),!1),d.map((e,t)=>(0,r.jsxs)("div",{className:"flex items-center",children:[A(t,"left"),M(e,e.id===x,()=>g(e.id),!0)]},e.id)),A(d.length,"left")]}),(0,r.jsx)("div",{className:"w-1 shrink-0 bg-border"}),(0,r.jsxs)("div",{ref:m,className:"flex items-center overflow-x-auto scrollbar-none min-w-0",style:{width:`${100*n}%`},onDragOver:e=>{if(l.current){if(e.preventDefault(),e.dataTransfer.dropEffect="move",!m.current){i(0),o("right");return}i(eN(m.current,e.clientX,l.current,j)??0),o("right")}},onDrop:y,children:[f.map((e,t)=>(0,r.jsxs)("div",{className:"flex items-center",children:[A(t,"right"),M(e,e.id===p,()=>k(e.id),!0)]},e.id)),A(f.length,"right"),R]})]})}return(0,r.jsxs)("div",{ref:f,className:"shrink-0 border-b flex items-center overflow-x-auto scrollbar-none bg-background",onDragOver:e=>{!l.current||(e.preventDefault(),e.dataTransfer.dropEffect="move",f.current&&(i(eN(f.current,e.clientX,l.current,I)),o(null)))},onDrop:e=>{e.preventDefault(),l.current&&null!==s&&N(l.current,s+1),P()},children:[M(t.tabs[0],"chat"===x,()=>g("chat"),!1),T.map((e,t)=>(0,r.jsxs)("div",{className:"flex items-center",children:[A(t),M(e,e.id===x,()=>g(e.id),!0)]},e.id)),A(T.length),R]})}let eS=o()(()=>Promise.resolve().then(n.bind(n,27417)).then(e=>e.TerminalPanel),{loadableGenerated:{webpack:()=>[27417]},ssr:!1});function eT(e){return(0,r.jsx)(g,{sessionId:e.sessionId,children:(0,r.jsx)(eI,{...e})})}function eI({sessionId:e,cwd:t,initialName:n,historyView:l}){let i=j(),{setTabActions:c}=(0,s.E2)(),o=(0,y.G)(),d=(0,a.useRef)(null),[u,f]=(0,a.useState)(.5);(0,a.useEffect)(()=>(c({openFile:i.openFile,openDiff:i.openDiff,openChanges:i.openChanges,openTerminal:i.openTerminal}),()=>c(null)),[i.openFile,i.openDiff,i.openChanges,i.openTerminal,c]);let{activeTabId:h,splitTabId:m,rightPaneTabIds:x,tabs:p}=i,b=o&&null!==m,g=(0,a.useCallback)(e=>{let t=d.current;if(!t)return;let n=t.offsetWidth;0!==n&&f(t=>Math.max(.25,Math.min(.75,t+e/n)))},[]);(0,a.useEffect)(()=>{let e=async e=>{let n=e.metaKey||e.ctrlKey;if(n&&"w"===e.key&&"chat"!==i.activeTabId&&(e.preventDefault(),i.closeTab(i.activeTabId)),n&&"`"===e.key){e.preventDefault();try{let e=await fetch("/api/terminal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:t})});if(e.ok){let{terminalId:t}=await e.json();i.openTerminal(t)}}catch{}}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[i,t]);let v=p.filter(e=>"file"===e.type),k=p.filter(e=>"diff"===e.type),N=p.filter(e=>"terminal"===e.type),C=p.some(e=>"changes"===e.type),S=(0,a.useCallback)(e=>{e.preventDefault(),e.dataTransfer.dropEffect="move"},[]),T=(0,a.useCallback)(e=>{e.preventDefault();let t=e.dataTransfer.getData("text/plain");t&&"chat"!==t&&x.includes(t)&&i.moveTabToPane(t,"left")},[i,x]),I=(0,a.useCallback)(e=>{e.preventDefault();let t=e.dataTransfer.getData("text/plain");t&&"chat"!==t&&(x.includes(t)?i.setSplitTab(t):i.moveTabToPane(t,"right"))},[i,x]);if(b){let a=v.filter(e=>!x.includes(e.id)),s=k.filter(e=>!x.includes(e.id)),i=N.filter(e=>!x.includes(e.id)),c=C&&!x.includes("changes"),o=v.filter(e=>x.includes(e.id)),f=k.filter(e=>x.includes(e.id)),p=N.filter(e=>x.includes(e.id)),j=C&&x.includes("changes");return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(eC,{splitRatio:b?u:void 0}),(0,r.jsxs)("div",{ref:d,className:"flex-1 min-h-0 flex flex-row",children:[(0,r.jsxs)("div",{className:"flex flex-col min-w-0 min-h-0",style:{width:`${(1-u)*100}%`},onDragOver:S,onDrop:T,children:[(0,r.jsx)(U.I,{sessionId:e,cwd:t,initialName:n,historyView:l,className:(0,w.cn)("chat"!==h&&"hidden")}),a.map(e=>(0,r.jsx)("div",{className:(0,w.cn)("flex flex-col flex-1 min-h-0",h!==e.id&&"hidden"),children:(0,r.jsx)(eg,{cwd:t,initialFile:e.filePath,manageSidebar:!1})},e.id)),s.map(e=>(0,r.jsx)("div",{className:(0,w.cn)("flex flex-col flex-1 min-h-0",h!==e.id&&"hidden"),children:(0,r.jsx)(er,{cwd:t,filePath:e.filePath})},e.id)),c&&(0,r.jsx)("div",{className:(0,w.cn)("flex flex-col flex-1 min-h-0","changes"!==h&&"hidden"),children:(0,r.jsx)(et,{cwd:t,sessionId:e,embeddedChat:!1,manageSidebar:!1})}),i.map(e=>(0,r.jsx)("div",{className:(0,w.cn)("flex flex-col flex-1 min-h-0 min-w-0",h!==e.id&&"hidden"),children:(0,r.jsx)(eS,{terminalId:e.terminalId,cwd:t,active:h===e.id})},e.id))]}),(0,r.jsx)(G,{onResize:g}),(0,r.jsxs)("div",{className:"flex flex-col min-w-0 min-h-0",style:{width:`${100*u}%`},onDragOver:S,onDrop:I,children:[o.map(e=>(0,r.jsx)("div",{className:(0,w.cn)("flex flex-col flex-1 min-h-0",m!==e.id&&"hidden"),children:(0,r.jsx)(eg,{cwd:t,initialFile:e.filePath,manageSidebar:!1})},e.id)),f.map(e=>(0,r.jsx)("div",{className:(0,w.cn)("flex flex-col flex-1 min-h-0",m!==e.id&&"hidden"),children:(0,r.jsx)(er,{cwd:t,filePath:e.filePath})},e.id)),j&&(0,r.jsx)("div",{className:(0,w.cn)("flex flex-col flex-1 min-h-0","changes"!==m&&"hidden"),children:(0,r.jsx)(et,{cwd:t,sessionId:e,embeddedChat:!1,manageSidebar:!1})}),p.map(e=>(0,r.jsx)("div",{className:(0,w.cn)("flex flex-col flex-1 min-h-0 min-w-0",m!==e.id&&"hidden"),children:(0,r.jsx)(eS,{terminalId:e.terminalId,cwd:t,active:m===e.id})},e.id))]})]})]})}return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(eC,{splitRatio:b?u:void 0}),(0,r.jsx)(U.I,{sessionId:e,cwd:t,initialName:n,historyView:l,className:(0,w.cn)("chat"!==h&&"hidden")}),v.map(e=>(0,r.jsx)("div",{className:(0,w.cn)("flex flex-col flex-1 min-h-0",h!==e.id&&"hidden"),children:(0,r.jsx)(eg,{cwd:t,initialFile:e.filePath,manageSidebar:!1})},e.id)),k.map(e=>(0,r.jsx)("div",{className:(0,w.cn)("flex flex-col flex-1 min-h-0",h!==e.id&&"hidden"),children:(0,r.jsx)(er,{cwd:t,filePath:e.filePath})},e.id)),C&&(0,r.jsx)("div",{className:(0,w.cn)("flex flex-col flex-1 min-h-0","changes"!==h&&"hidden"),children:(0,r.jsx)(et,{cwd:t,sessionId:e,embeddedChat:!1,manageSidebar:!1})}),N.map(e=>(0,r.jsx)("div",{className:(0,w.cn)("flex flex-col flex-1 min-h-0 min-w-0",h!==e.id&&"hidden"),children:(0,r.jsx)(eS,{terminalId:e.terminalId,cwd:t,active:h===e.id})},e.id))]})}function eE({params:e}){let{id:t}=(0,a.use)(e),n=(0,l.useSearchParams)(),c=n.get("cwd")||"",o=n.get("name")||void 0,d="true"===n.get("historyView");return(0,a.useEffect)(()=>{console.log(`[session-page] mounted ${t.slice(0,8)} at ${performance.now().toFixed(0)}ms`)},[t]),(0,s.mq)(c||void 0),(0,s.tB)(t),(0,a.useEffect)(()=>{(0,i.MN)(t),(0,i.HC)(t)},[t]),(0,r.jsx)(eT,{sessionId:t,cwd:c||"",initialName:o,historyView:d})}},27417:(e,t,n)=>{"use strict";n.r(t),n.d(t,{TerminalPanel:()=>g,disposeTerminalInstance:()=>p});var r=n(95155),l=n(66763),a=n(9005),s=n(99537);let i=(0,s.A)("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);var c=n(2125);let o=(0,s.A)("palette",[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]]);var d=n(12115),u=n(11701),f=n(22317),h=n(40980);let m={cockpit:{label:"Cockpit",bg:"#111111",fg:"#e8e8e8",cursor:"#e8e8e8",selection:"rgba(255, 255, 255, 0.15)"},dark:{label:"Dark",bg:"#1e1e1e",fg:"#d4d4d4",cursor:"#aeafad",selection:"rgba(86, 156, 214, 0.3)"},dracula:{label:"Dracula",bg:"#282a36",fg:"#f8f8f2",cursor:"#f8f8f2",selection:"rgba(68, 71, 90, 0.5)"},catppuccin:{label:"Catppuccin",bg:"#1e1e2e",fg:"#cdd6f4",cursor:"#f5e0dc",selection:"rgba(88, 91, 112, 0.4)"},tokyoNight:{label:"Tokyo Night",bg:"#1a1b26",fg:"#a9b1d6",cursor:"#c0caf5",selection:"rgba(41, 46, 66, 0.5)"},nord:{label:"Nord",bg:"#2e3440",fg:"#d8dee9",cursor:"#d8dee9",selection:"rgba(67, 76, 94, 0.5)"},gruvbox:{label:"Gruvbox",bg:"#282828",fg:"#ebdbb2",cursor:"#ebdbb2",selection:"rgba(168, 153, 132, 0.3)"},solarized:{label:"Solarized",bg:"#002b36",fg:"#839496",cursor:"#93a1a1",selection:"rgba(38, 139, 210, 0.3)"},monokai:{label:"Monokai",bg:"#272822",fg:"#f8f8f2",cursor:"#f8f8f0",selection:"rgba(73, 72, 62, 0.5)"},oneDark:{label:"One Dark",bg:"#282c34",fg:"#abb2bf",cursor:"#528bff",selection:"rgba(62, 68, 81, 0.5)"}},x=new Map;function p(e){let t=x.get(e);t&&(t.term.dispose(),t.wrapper.remove(),x.delete(e))}let b=[{label:"Esc",data:"\x1b"},{label:"Ctrl",modifier:!0},{label:"Tab",data:" "},{label:"|",data:"|",separator:!0},{label:"←",data:"\x1b[D"},{label:"↑",data:"\x1b[A"},{label:"↓",data:"\x1b[B"},{label:"→",data:"\x1b[C"}];function g({terminalId:e,cwd:t,active:n=!0}){let[l,a]=(0,d.useState)(e),[s,i]=(0,d.useState)(0),[c,o]=(0,d.useState)(!1),u=(0,d.useCallback)(async()=>{o(!0);try{let e=await fetch("/api/terminal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:t})});if(!e.ok)return;let{terminalId:n}=await e.json();a(n),i(e=>e+1)}finally{o(!1)}},[t]);return(0,r.jsx)(j,{terminalId:l,cwd:t,active:n,onReconnect:u,reconnecting:c},`${l}-${s}`)}function j({terminalId:e,cwd:t,active:s=!0,onReconnect:p,reconnecting:g}){let y=(0,d.useRef)(null),w=(0,d.useRef)(null),v=(0,d.useRef)(null),k=(0,d.useRef)(null),[N,C]=(0,d.useState)(null),[S,T]=(0,d.useState)(!1),I=(0,d.useRef)(!1),E=(0,d.useRef)(s);E.current=s;let P=(0,u.G)(),A=(0,d.useRef)(0),M=(0,d.useRef)(void 0),F=(0,d.useRef)(void 0),R=(0,d.useRef)(!1),[D,O]=(0,d.useState)(!1),z=(0,d.useRef)(0),[$,L]=(0,d.useState)(!1),{settings:_,updateSetting:U}=(0,f.t)();(0,d.useEffect)(()=>{let e=window.visualViewport,t=()=>e?e.height:window.innerHeight;z.current=Math.max(z.current,t());let n=()=>{let e=t();z.current=Math.max(z.current,e),O(e<.75*z.current),E.current&&v.current&&v.current.fit()},r=e??window;return r.addEventListener("resize",n),()=>r.removeEventListener("resize",n)},[]),(0,d.useEffect)(()=>{s&&v.current&&v.current.fit()},[s]),(0,d.useEffect)(()=>{let e=w.current;if(!e)return;let t=m[_.terminalTheme]??m.dark;e.options.theme={background:t.bg,foreground:t.fg,cursor:t.cursor,selectionBackground:t.selection},y.current&&(y.current.parentElement.style.backgroundColor=t.bg)},[_.terminalTheme]),(0,d.useEffect)(()=>{let e=w.current;e&&(e.options.fontSize=_.terminalFontSize,v.current?.fit())},[_.terminalFontSize]),(0,d.useEffect)(()=>{let e=w.current;e&&(e.options.scrollback=_.terminalScrollback)},[_.terminalScrollback]),(0,d.useEffect)(()=>{let t=!1,r=null,l=null,a=[];function s(e){let t=k.current;t?.readyState===WebSocket.OPEN&&t.send(e)}async function i(){k.current&&(k.current.onclose=null,k.current.close(),k.current=null);try{let n=await fetch("/api/auth/ws-token");if(!n.ok||t)return;let{token:l}=await n.json();if(t)return;let a=R.current?"0":"1",s="https:"===window.location.protocol?"wss:":"ws:",c=`${s}//${window.location.host}/ws/terminal?token=${l}&terminalId=${e}&replay=${a}`,o=new WebSocket(c);k.current=o,o.onopen=()=>{A.current=0,C(null),R.current=!0,r&&r.cols>1&&r.rows>1&&o.send(`\x01R${r.cols};${r.rows}`)},o.onmessage=e=>{r?.write(e.data)},o.onclose=n=>{if(k.current=null,t)return;if(1008===n.code){x.delete(e),C("Terminal disconnected");return}let r=Math.min(1e3*2**A.current,1e4);A.current++,M.current=setTimeout(()=>{t||i()},r)},o.onerror=()=>{}}catch{if(t)return;let e=Math.min(1e3*2**A.current,1e4);A.current++,M.current=setTimeout(()=>{t||i()},e)}}function c(){"visible"!==document.visibilityState||t||k.current&&k.current.readyState===WebSocket.OPEN||(clearTimeout(M.current),A.current=0,i())}return async function(){let c=y.current;if(!c||t)return;let o=x.get(e);if(o){r=o.term,l=o.fit,w.current=r,v.current=l,R.current=!0,c.appendChild(o.wrapper);let e=m[_.terminalTheme]??m.dark;r.options.theme={background:e.bg,foreground:e.fg,cursor:e.cursor,selectionBackground:e.selection},r.options.fontSize=_.terminalFontSize,r.options.scrollback=_.terminalScrollback,l.fit()}else{let[{Terminal:a},{FitAddon:s}]=await Promise.all([n.e(23888).then(n.bind(n,8422)),n.e(63606).then(n.bind(n,63606))]);if(t)return;let i=m[_.terminalTheme]??m.dark;w.current=r=new a({cursorBlink:!0,fontSize:_.terminalFontSize,scrollback:_.terminalScrollback,fontFamily:"'Menlo', 'Consolas', 'DejaVu Sans Mono', 'Courier New', 'Symbols Nerd Font Mono', monospace",theme:{background:i.bg,foreground:i.fg,cursor:i.cursor,selectionBackground:i.selection}}),v.current=l=new s,r.loadAddon(l);let o=document.createElement("div");o.style.width="100%",o.style.height="100%",c.appendChild(o),r.open(o),l.fit(),x.set(e,{term:r,fit:l,wrapper:o})}a.push(r.onData(e=>{if(I.current&&1===e.length){let t=e.toUpperCase().charCodeAt(0);if(t>=64&&t<96){s(String.fromCharCode(t-64)),I.current=!1,T(!1);return}}s(e)})),a.push(r.onResize(({cols:e,rows:t})=>{e<2||t<2||E.current&&(clearTimeout(F.current),F.current=setTimeout(()=>{if(!E.current)return;let n=k.current;n?.readyState===WebSocket.OPEN&&n.send(`\x01R${e};${t}`)},150))}));let d=0,u=0;c.addEventListener("touchstart",e=>{d=e.touches[0].clientY,u=0},{passive:!0}),c.addEventListener("touchmove",e=>{let t=d-e.touches[0].clientY;d=e.touches[0].clientY;let n=Math.trunc((u+=t)/8);0!==n&&(u-=8*n,r?.scrollLines(n))},{passive:!0}),i()}(),document.addEventListener("visibilitychange",c),()=>{for(let e of(t=!0,a))e.dispose();clearTimeout(M.current),clearTimeout(F.current),document.removeEventListener("visibilitychange",c),k.current&&(k.current.onclose=null,k.current.close(),k.current=null),w.current=null,v.current=null}},[e]);let W=(0,d.useCallback)(e=>{let t=k.current;t?.readyState===WebSocket.OPEN&&t.send(e)},[]),G=(0,d.useCallback)(e=>{if("modifier"in e&&e.modifier){let e=!I.current;I.current=e,T(e);return}"data"in e&&W(e.data)},[W]);if(N)return(0,r.jsxs)("div",{className:"flex-1 min-h-0 flex flex-col items-center justify-center gap-3 text-sm text-muted-foreground",children:[(0,r.jsx)("span",{children:N}),(0,r.jsx)("button",{type:"button",onClick:p,disabled:g,className:"px-3 py-1.5 text-xs font-medium rounded-md bg-muted hover:bg-muted/80 transition-colors disabled:opacity-50",children:g?"Reconnecting...":"Reconnect"})]});let B=m[_.terminalTheme]??m.dark;return(0,r.jsxs)("div",{className:"flex flex-col flex-1 min-h-0",style:{backgroundColor:B.bg},children:[(0,r.jsxs)("div",{className:"flex-1 min-h-0 relative overflow-hidden",children:[(0,r.jsx)("div",{ref:y,className:"absolute inset-0 px-3 pt-2"}),(0,r.jsx)("button",{type:"button",onClick:()=>L(!0),className:"absolute top-2 right-2 z-10 rounded p-1.5 text-white/70 hover:text-white hover:bg-white/10 transition-colors",children:(0,r.jsx)(l.A,{className:"h-4.5 w-4.5"})})]}),!P&&D&&(0,r.jsxs)("div",{className:"shrink-0 relative z-10 flex items-center gap-1.5 px-2 py-1.5 border-t border-border/50",style:{backgroundColor:B.bg},children:[(0,r.jsx)("div",{role:"button",tabIndex:-1,onPointerDown:e=>{e.preventDefault(),L(!0)},className:"px-2 py-1.5 text-xs font-medium rounded-md transition-colors select-none bg-muted text-muted-foreground active:bg-primary active:text-primary-foreground",children:(0,r.jsx)(l.A,{className:"h-3.5 w-3.5"})}),(0,r.jsx)("div",{className:"w-px h-5 bg-border/50"}),b.map(e=>(0,r.jsxs)("div",{className:"flex items-center gap-1.5",children:["separator"in e&&e.separator&&(0,r.jsx)("div",{className:"w-px h-5 bg-border/50"}),(0,r.jsx)("div",{role:"button",tabIndex:-1,onPointerDown:t=>{t.preventDefault(),G(e)},className:(0,h.cn)("px-3 py-1.5 text-xs font-medium rounded-md transition-colors select-none","active:bg-primary active:text-primary-foreground","modifier"in e&&e.modifier&&S?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground"),children:e.label})]},e.label))]}),$&&(0,r.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onMouseDown:e=>{e.target===e.currentTarget&&L(!1)},children:(0,r.jsxs)("div",{className:"w-full max-w-md mx-4 rounded-lg border bg-background shadow-lg overflow-hidden flex flex-col max-h-[85vh]",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-5 py-3 border-b shrink-0",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(l.A,{className:"h-4 w-4"}),(0,r.jsx)("h2",{className:"text-sm font-semibold",children:"Terminal settings"})]}),(0,r.jsx)("button",{onClick:()=>L(!1),className:"rounded p-1 text-muted-foreground hover:text-foreground hover:bg-muted",children:(0,r.jsx)(a.A,{className:"h-4 w-4"})})]}),(0,r.jsxs)("div",{className:"p-4 space-y-5 overflow-y-auto",children:[(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)("div",{className:"flex items-center gap-2",children:(0,r.jsx)("span",{className:"text-xs font-medium text-foreground",children:"Font size"})}),(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("button",{onClick:()=>U("terminalFontSize",Math.max(1,_.terminalFontSize-1)),className:"rounded p-1.5 border border-input hover:bg-muted transition-colors",children:(0,r.jsx)(i,{className:"h-3.5 w-3.5"})}),(0,r.jsx)("span",{className:"text-sm font-mono w-8 text-center",children:_.terminalFontSize}),(0,r.jsx)("button",{onClick:()=>U("terminalFontSize",Math.min(32,_.terminalFontSize+1)),className:"rounded p-1.5 border border-input hover:bg-muted transition-colors",children:(0,r.jsx)(c.A,{className:"h-3.5 w-3.5"})})]})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)("span",{className:"text-xs font-medium text-foreground",children:"Scrollback lines"}),(0,r.jsx)("div",{className:"flex items-center gap-2",children:[500,1e3,5e3,1e4].map(e=>(0,r.jsx)("button",{onClick:()=>U("terminalScrollback",e),className:(0,h.cn)("rounded-md border px-3 py-1.5 text-xs transition-colors",_.terminalScrollback===e?"border-primary bg-primary/10 text-foreground":"border-input hover:bg-muted text-muted-foreground"),children:e>=1e3?`${e/1e3}k`:e},e))})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(o,{className:"h-3.5 w-3.5 text-muted-foreground"}),(0,r.jsx)("span",{className:"text-xs font-medium text-foreground",children:"Theme"})]}),(0,r.jsx)("div",{className:"grid grid-cols-2 gap-2",children:Object.entries(m).map(([e,t])=>(0,r.jsxs)("button",{onClick:()=>U("terminalTheme",e),className:(0,h.cn)("flex items-center gap-2 rounded-md border px-3 py-2 text-xs transition-colors",_.terminalTheme===e?"border-primary bg-primary/10 text-foreground":"border-input hover:bg-muted text-muted-foreground"),children:[(0,r.jsx)("div",{className:"h-4 w-4 rounded-sm border border-border/50",style:{backgroundColor:t.bg}}),t.label]},e))})]})]})]})})]})}},41112:(e,t,n)=>{"use strict";function r({reason:e,children:t}){return t}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"BailoutToCSR",{enumerable:!0,get:function(){return r}}),n(1980)},58309:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});let r=(0,n(99537).A)("list",[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]])},64054:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={bindSnapshot:function(){return c},createAsyncLocalStorage:function(){return i},createSnapshot:function(){return o}};for(var r in n)Object.defineProperty(t,r,{enumerable:!0,get:n[r]});let l=Object.defineProperty(Error("Invariant: AsyncLocalStorage accessed in runtime where it is not available"),"__NEXT_ERROR_CODE",{value:"E504",enumerable:!1,configurable:!0});class a{disable(){throw l}getStore(){}run(){throw l}exit(){throw l}enterWith(){throw l}static bind(e){return e}}let s="u">typeof globalThis&&globalThis.AsyncLocalStorage;function i(){return s?new s:new a}function c(e){return s?s.bind(e):a.bind(e)}function o(){return s?s.snapshot():function(e,...t){return e(...t)}}},68635:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return c}});let r=n(95155),l=n(12115),a=n(41112);function s(e){return{default:e&&"default"in e?e.default:e}}n(21957);let i={loader:()=>Promise.resolve(s(()=>null)),loading:null,ssr:!0},c=function(e){let t={...i,...e},n=(0,l.lazy)(()=>t.loader().then(s)),c=t.loading;function o(e){let s=c?(0,r.jsx)(c,{isLoading:!0,pastDelay:!0,error:null}):null,i=!t.ssr||!!t.loading,o=i?l.Suspense:l.Fragment,d=t.ssr?(0,r.jsxs)(r.Fragment,{children:[null,(0,r.jsx)(n,{...e})]}):(0,r.jsx)(a.BailoutToCSR,{reason:"next/dynamic",children:(0,r.jsx)(n,{...e})});return(0,r.jsx)(o,{...i?{fallback:s}:{},children:d})}return o.displayName="LoadableComponent",o}},75707:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return l}});let r=n(73623)._(n(68635));function l(e,t){let n={};"function"==typeof e&&(n.loader=e);let l={...n,...t};return(0,r.default)({...l,modules:l.loadableGenerated?.modules})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},89419:(e,t,n)=>{Promise.resolve().then(n.bind(n,23668))},94088:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});let r=(0,n(99537).A)("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]])}},e=>{e.O(0,[989,25781,1550,28441,93794,77358],()=>e(e.s=89419)),_N_E=e.O()}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[46713],{5214:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"workAsyncStorage",{enumerable:!0,get:function(){return r.workAsyncStorageInstance}});let r=n(17828)},11701:(e,t,n)=>{"use strict";n.d(t,{G:()=>a});var r=n(12115);let l="(min-width: 768px)";function a(){let[e,t]=(0,r.useState)(()=>window.matchMedia(l).matches);return(0,r.useEffect)(()=>{let e=window.matchMedia(l),n=e=>t(e.matches);return e.addEventListener("change",n),()=>e.removeEventListener("change",n)},[]),e}},17828:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"workAsyncStorageInstance",{enumerable:!0,get:function(){return r}});let r=(0,n(64054).createAsyncLocalStorage)()},20660:(e,t,n)=>{"use strict";n.d(t,{Q:()=>c});var r=n(26210),l=n(82627),a=n(70569),s=n(33735),i=n(95155);function c({fileDiff:e,options:t,metrics:n,lineAnnotations:o,selectedLines:d,className:u,style:f,prerenderedHTML:h,renderAnnotation:m,renderCustomHeader:x,renderHeaderPrefix:p,renderHeaderMetadata:b,renderGutterUtility:g,disableWorkerPool:j=!1}){let{ref:y,getHoveredLine:w}=(0,s.S)({fileDiff:e,options:t,metrics:n,lineAnnotations:o,selectedLines:d,prerenderedHTML:h,hasGutterRenderUtility:null!=g,hasCustomHeader:null!=x,disableWorkerPool:j});return(0,i.jsx)(r.mZ,{ref:y,className:u,style:f,children:(0,a.$)((0,l.z)({fileDiff:e,renderCustomHeader:x,renderHeaderPrefix:p,renderHeaderMetadata:b,renderAnnotation:m,renderGutterUtility:g,lineAnnotations:o,getHoveredLine:w}),h)})}},21957:(e,t,n)=>{"use strict";function r({moduleIds:e}){return null}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"PreloadChunks",{enumerable:!0,get:function(){return r}}),n(95155),n(47650),n(5214),n(2451),n(53887)},23668:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>eE});var r=n(95155),l=n(73321),a=n(12115),s=n(1550),i=n(23965),c=n(75707),o=n.n(c),d=n(27417),u=n(53972);let f=(0,a.createContext)(null),h={type:"chat",id:"chat"},m={type:"changes",id:"changes"};function x(e){return"terminal::"+e}let p=new Map,b={tabs:[h],activeTabId:"chat",splitTabId:null,rightPaneTabIds:[]};function g({sessionId:e,children:t}){let[n,l]=(0,a.useState)(()=>p.get(e)||b),s=(0,a.useRef)(p.has(e)?e:null),i=(0,a.useRef)(void 0);(0,a.useEffect)(()=>{if(s.current===e)return;if(p.has(e)){l(p.get(e)),s.current=e;return}let t=!1;return fetch(`/api/sessions/${e}/tabs`).then(e=>e.ok?e.json():null).then(n=>{if(!t){if(n?.openTabs?.length){let t=function(e){let t=[h];for(let n of e)"changes"===n.type?t.push(m):"file"===n.type&&n.filePath?t.push({type:"file",id:"file::"+n.filePath,filePath:n.filePath,label:(0,u.uk)(n.filePath)||n.filePath}):"diff"===n.type&&n.filePath?t.push({type:"diff",id:"diff::"+n.filePath,filePath:n.filePath,label:(0,u.uk)(n.filePath)||n.filePath}):"terminal"===n.type&&n.terminalId&&t.push({type:"terminal",id:x(n.terminalId),terminalId:n.terminalId,label:n.label||"Terminal"});return t}(n.openTabs),r=n.activeTabId&&t.some(e=>e.id===n.activeTabId)?n.activeTabId:"chat",a={tabs:t,activeTabId:r,splitTabId:null,rightPaneTabIds:[]};l(a),p.set(e,a)}s.current=e}}).catch(()=>{s.current=e}),()=>{t=!0}},[e]),(0,a.useEffect)(()=>{if(s.current===e)return p.set(e,n),clearTimeout(i.current),i.current=setTimeout(()=>{fetch(`/api/sessions/${e}/tabs`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({openTabs:function(e){let t=[];for(let n of e)"chat"!==n.type&&("changes"===n.type?t.push({type:"changes"}):"terminal"===n.type?t.push({type:"terminal",terminalId:n.terminalId,label:n.label}):t.push({type:n.type,filePath:n.filePath}));return t}(n.tabs),activeTabId:n.activeTabId})}).catch(()=>{})},300),()=>clearTimeout(i.current)},[e,n.tabs,n.activeTabId]);let c=(0,a.useCallback)(e=>{let t="file::"+e;l(n=>{if(n.tabs.find(e=>e.id===t))return{...n,activeTabId:t};let r={type:"file",id:t,filePath:e,label:(0,u.uk)(e)||e};return{...n,tabs:[...n.tabs,r],activeTabId:t}})},[]),o=(0,a.useCallback)(e=>{let t="diff::"+e;l(n=>{if(n.tabs.find(e=>e.id===t))return{...n,activeTabId:t};let r={type:"diff",id:t,filePath:e,label:(0,u.uk)(e)||e};return{...n,tabs:[...n.tabs,r],activeTabId:t}})},[]),j=(0,a.useCallback)(()=>{l(e=>e.tabs.find(e=>"changes"===e.id)?{...e,activeTabId:"changes"}:{...e,tabs:[...e.tabs,m],activeTabId:"changes"})},[]),y=(0,a.useCallback)((e,t)=>{let n=x(e);l(r=>r.tabs.find(e=>e.id===n)?{...r,activeTabId:n}:{...r,tabs:[...r.tabs,{type:"terminal",id:n,terminalId:e,label:t||"Terminal"}],activeTabId:n})},[]),w=(0,a.useCallback)(e=>{"chat"!==e&&l(t=>{let n=t.tabs.find(t=>t.id===e);n?.type==="terminal"&&((0,d.disposeTerminalInstance)(n.terminalId),fetch(`/api/terminal/${n.terminalId}`,{method:"DELETE"}).catch(()=>{}));let r=t.tabs.findIndex(t=>t.id===e);if(r<0)return t;let l=t.tabs.filter(t=>t.id!==e),a=t.activeTabId;if(a===e){let e=l.filter(e=>!t.rightPaneTabIds.includes(e.id)),n=Math.min(r,e.length-1);a=e[Math.max(0,n)]?.id||"chat"}let s=t.rightPaneTabIds.filter(t=>t!==e),i=t.splitTabId===e?s[0]||null:t.splitTabId;return 0===s.length&&(i=null),{tabs:l,activeTabId:a,splitTabId:i,rightPaneTabIds:s}})},[]),v=(0,a.useCallback)(e=>{l(t=>({...t,activeTabId:e}))},[]),k=(0,a.useCallback)(e=>{l(t=>{if(null===e)return{...t,splitTabId:null,rightPaneTabIds:[]};let n=t.rightPaneTabIds.includes(e)?t.rightPaneTabIds:[...t.rightPaneTabIds,e];return{...t,splitTabId:e,rightPaneTabIds:n}})},[]),N=(0,a.useCallback)((e,t)=>{l(n=>{let r=n.tabs.findIndex(t=>t.id===e);if(r<1||r===t)return n;let l=[...n.tabs],[a]=l.splice(r,1),s=Math.max(1,Math.min(l.length,t>r?t-1:t));return l.splice(s,0,a),{...n,tabs:l}})},[]),C=(0,a.useCallback)((e,t)=>{"chat"!==e&&l(n=>{let r=n.rightPaneTabIds.includes(e);if("right"===t&&!r){let t=[...n.rightPaneTabIds,e],r=n.activeTabId;if(r===e){let e=n.tabs.filter(e=>!t.includes(e.id));r=e[0]?.id||"chat"}return{...n,rightPaneTabIds:t,activeTabId:r,splitTabId:n.splitTabId||e}}if("left"===t&&r){let t=n.rightPaneTabIds.filter(t=>t!==e),r=n.splitTabId;return r===e&&(r=t[0]||null),0===t.length&&(r=null),{...n,rightPaneTabIds:t,splitTabId:r,activeTabId:e}}return n})},[]);return(0,r.jsx)(f.Provider,{value:{tabs:n.tabs,activeTabId:n.activeTabId,splitTabId:n.splitTabId,rightPaneTabIds:n.rightPaneTabIds,openFile:c,openDiff:o,openChanges:j,openTerminal:y,closeTab:w,setActiveTab:v,setSplitTab:k,moveTab:N,moveTabToPane:C},children:t})}function j(){return(0,a.useContext)(f)}var y=n(11701),w=n(40980),v=n(69226),k=n(20660),N=n(64577),C=n(44354),S=n(83212),T=n(19257),I=n(797),E=n(12363),P=n(92571),A=n(94088),M=n(1275),F=n(15480),R=n(19707),D=n(58309),O=n(99537);let z=(0,O.A)("arrow-up-from-line",[["path",{d:"m18 9-6-6-6 6",key:"kcunyi"}],["path",{d:"M12 3v14",key:"7cf3v8"}],["path",{d:"M5 21h14",key:"11awu3"}]]),$=(0,O.A)("sparkles",[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]]);var L=n(9383),_=n(65738),U=n(59184),W=n(57594);function G({onResize:e}){let t=(0,a.useRef)(!1),n=(0,a.useRef)(0),l=(0,a.useCallback)(r=>{r.preventDefault(),t.current=!0,n.current=r.clientX;let l=r=>{if(!t.current)return;let l=n.current-r.clientX;n.current=r.clientX,e(l)},a=()=>{t.current=!1,document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",a),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",l),document.addEventListener("mouseup",a)},[e]);return(0,r.jsx)("div",{onMouseDown:l,className:"w-1 shrink-0 cursor-col-resize bg-border hover:bg-primary/30 transition-colors"})}var B=n(89239),J=n(22317),q=n(89323),V=n(30090);function H({checked:e,onChange:t,onClick:n}){return(0,r.jsx)("button",{type:"button",role:"checkbox","aria-checked":e,onClick:e=>{n?.(e),t()},className:(0,w.cn)("h-4 w-4 shrink-0 rounded border flex items-center justify-center transition-colors",e?"border-primary bg-primary text-primary-foreground":"border-muted-foreground/40 bg-transparent hover:border-muted-foreground/60"),children:e&&(0,r.jsx)(N.A,{className:"h-3 w-3",strokeWidth:3})})}function X(e){switch(e){case"added":case"untracked":return(0,r.jsx)(C.A,{className:"h-3.5 w-3.5 text-green-500 shrink-0"});case"deleted":return(0,r.jsx)(S.A,{className:"h-3.5 w-3.5 text-red-500 shrink-0"});case"renamed":return(0,r.jsx)(T.A,{className:"h-3.5 w-3.5 text-blue-500 shrink-0"});default:return(0,r.jsx)(I.A,{className:"h-3.5 w-3.5 text-yellow-500 shrink-0"})}}function K(){return!("u"<typeof document)&&document.documentElement.classList.contains("dark")}function Y(e,t,n){let r=t.split(/\r?\n/).map(e=>e+"\n"),l=n.split(/\r?\n/).map(e=>e+"\n");for(let t of e.hunks){let e=t.deletionStart-1-t.deletionLineIndex,n=t.additionStart-1-t.additionLineIndex;for(let r of(t.deletionLineIndex=t.deletionStart-1,t.additionLineIndex=t.additionStart-1,t.hunkContent))r.deletionLineIndex+=e,r.additionLineIndex+=n}e.deletionLines=r,e.additionLines=l,e.isPartial=!1}function Q({files:e,selectedFile:t,checkedFiles:n,onFileClick:l,onContextMenu:a,onToggleFile:s,onToggleAll:i}){return 0===e.length?(0,r.jsx)("div",{className:"flex items-center justify-center py-12 text-sm text-muted-foreground",children:"Working tree clean"}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"px-3 py-1.5 border-b flex items-center gap-2",children:[(0,r.jsx)(H,{checked:n.size===e.length,onChange:i}),(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:"Select all"})]}),e.map(e=>(0,r.jsxs)("div",{className:(0,w.cn)("flex items-center gap-2 px-3 py-1.5 text-sm cursor-pointer border-b last:border-b-0 hover:bg-muted/50",t===e.path&&"bg-muted"),onClick:()=>l(e),onContextMenu:t=>a(t,e),children:[(0,r.jsx)(H,{checked:n.has(e.path),onChange:()=>s(e.path),onClick:e=>e.stopPropagation()}),X(e.status),(0,r.jsx)("span",{className:"font-mono text-xs truncate flex-1 min-w-0 text-left",dir:"rtl",title:e.path,children:(0,r.jsx)("bdo",{dir:"ltr",children:e.path})}),(e.additions>0||e.deletions>0)&&(0,r.jsxs)("span",{className:"text-xs font-mono shrink-0 flex items-center gap-1",children:[e.additions>0&&(0,r.jsxs)("span",{className:"text-green-500",children:["+",e.additions]}),e.deletions>0&&(0,r.jsxs)("span",{className:"text-red-500",children:["-",e.deletions]})]}),(0,r.jsx)("span",{className:(0,w.cn)("text-xs font-mono shrink-0","added"===e.status||"untracked"===e.status?"text-green-500":"deleted"===e.status?"text-red-500":"text-yellow-500"),children:function(e){switch(e){case"added":return"A";case"deleted":return"D";case"renamed":return"R";case"untracked":return"?";default:return"M"}}(e.status)})]},e.path))]})}function Z({files:e,cwd:t,diffStyle:n,scrollToFile:l,onScrolled:s,onViewFile:i,checkedFiles:c,onToggleFile:o,refreshKey:d}){let[u,f]=(0,a.useState)(new Map),h=(0,a.useRef)(new Map),m=(0,a.useRef)(new Set),x=(0,a.useRef)(d),[p,b]=(0,a.useState)(new Set),g=(0,a.useCallback)(e=>{f(t=>{let n=new Map(t);return n.set(e,{diff:t.get(e)?.diff||null,fileDiff:t.get(e)?.fileDiff||null,loading:!0}),n}),fetch(`/api/git/diff?cwd=${encodeURIComponent(t)}&file=${encodeURIComponent(e)}`).then(e=>{if(!e.ok)throw Error("Failed");return e.json()}).then(t=>{let n=null;try{let e=(0,v.J2)(t.diff);e.length>0&&e[0].files.length>0&&(n=e[0].files[0],null!=t.oldContent&&null!=t.newContent&&Y(n,t.oldContent,t.newContent))}catch{}f(r=>{let l=new Map(r);return l.set(e,{diff:t.diff,fileDiff:n,loading:!1}),l})}).catch(()=>{f(t=>{let n=new Map(t);return n.set(e,{diff:null,fileDiff:null,loading:!1}),n})})},[t]);(0,a.useEffect)(()=>{let t=d!==x.current;x.current=d,t&&m.current.clear();let n=new Set(e.map(e=>e.path));for(let t of e.filter(e=>!m.current.has(e.path)))m.current.add(t.path),g(t.path);for(let e of m.current)n.has(e)||m.current.delete(e)},[e,g,d]),(0,a.useEffect)(()=>{if(!l)return;let e=h.current.get(l);e&&e.scrollIntoView({behavior:"smooth",block:"start"}),s()},[l,s]);let j=(0,a.useCallback)(e=>{b(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),y=(0,a.useCallback)(e=>{o(e),c.has(e)||b(t=>new Set(t).add(e))},[o,c]);return 0===e.length?(0,r.jsx)("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"No changes"}):(0,r.jsx)("div",{className:"p-4 space-y-3",children:e.map(e=>{let t=u.get(e.path),l=c.has(e.path),a=p.has(e.path);return(0,r.jsx)("div",{ref:t=>{t&&h.current.set(e.path,t)},className:(0,w.cn)("rounded border overflow-clip",l&&!a&&"opacity-60"),children:a?(0,r.jsxs)("div",{className:"flex items-center gap-2 w-full px-4 py-2 text-sm text-muted-foreground",children:[(0,r.jsx)(H,{checked:l,onChange:()=>{o(e.path),l&&b(t=>{let n=new Set(t);return n.delete(e.path),n})},onClick:e=>e.stopPropagation()}),(0,r.jsxs)("button",{onClick:()=>j(e.path),className:"flex items-center gap-2 flex-1 min-w-0 hover:text-foreground transition-colors",children:[(0,r.jsx)(E.A,{className:"h-3.5 w-3.5 shrink-0"}),(0,r.jsx)("span",{className:"font-mono text-xs truncate text-left",dir:"rtl",title:e.path,children:(0,r.jsx)("bdo",{dir:"ltr",children:e.path})})]})]}):t?.loading&&!t.diff?(0,r.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,r.jsx)(P.A,{className:"h-4 w-4 animate-spin text-muted-foreground"})}):t?.diff?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"sticky top-0 z-10 flex items-center gap-2 px-4 py-1.5 text-sm border-b bg-muted/80 backdrop-blur-sm","data-testid":"sticky-diff-header",children:[X(e.status),(0,r.jsx)("span",{className:"font-mono text-xs truncate flex-1 min-w-0 text-left",dir:"rtl",title:e.path,children:(0,r.jsx)("bdo",{dir:"ltr",children:e.path})}),(0,r.jsx)(H,{checked:l,onChange:()=>y(e.path),onClick:e=>e.stopPropagation()}),(0,r.jsx)("button",{onClick:()=>j(e.path),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",title:"Collapse",children:(0,r.jsx)(A.A,{className:"h-3 w-3"})}),(0,r.jsx)("button",{onClick:()=>i(e.path),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:(0,r.jsx)(M.A,{className:"h-3 w-3"})})]}),(0,r.jsx)(W.sU,{fallback:(0,r.jsx)("pre",{className:"p-4 text-xs text-muted-foreground whitespace-pre-wrap",children:t.diff}),children:t.fileDiff?(0,r.jsx)(k.Q,{fileDiff:t.fileDiff,options:{theme:{dark:"pierre-dark",light:"pierre-light"},themeType:K()?"dark":"light",overflow:"wrap",diffStyle:n,disableFileHeader:!0,hunkSeparators:"line-info",expansionLineCount:20,unsafeCSS:W.j8}}):(0,r.jsx)("pre",{className:"p-4 text-xs text-muted-foreground whitespace-pre-wrap",children:t.diff})})]}):(0,r.jsx)("div",{className:"px-4 py-3 text-xs text-muted-foreground",children:"No diff available"})},e.path)})})}let ee=new Map;function et({cwd:e,sessionId:t,embeddedChat:n=!0,manageSidebar:l=!0}){let i,c,o,{settings:d}=(0,J.t)(),{setSidebarSection:u,removeSidebarSection:f,closeSidebar:h,tabActions:m}=(0,s.E2)(),{send:x,subscribe:p}=(0,q.h)(),b=(0,y.G)(),[g,j]=(0,a.useState)(null),[C,S]=(0,a.useState)(!0),[T,I]=(0,a.useState)(null),O=ee.get(e)||{selectedFile:null,commitMsg:"",commitPanelOpen:window.matchMedia("(min-width: 768px)").matches,pushOnCommit:!1,stackedMode:!0,chatRatio:.3},[en,er]=(0,a.useState)(O.selectedFile),[el,ea]=(0,a.useState)(null),[es,ei]=(0,a.useState)(null),[ec,eo]=(0,a.useState)(!1),[ed,eu]=(0,a.useState)(null),[ef,eh]=(0,a.useState)(O.commitMsg),[em,ex]=(0,a.useState)(!1),[ep,eb]=(0,a.useState)(null),{checkedFiles:eg,toggleFile:ej,toggleAll:ey,setCheckedFiles:ew}=(0,V.e)(e),[ev,ek]=(0,a.useState)(O.pushOnCommit),[eN,eC]=(0,a.useState)(O.commitPanelOpen),[eS,eT]=(0,a.useState)(!1),[eI,eE]=(0,a.useState)(!1),[eP,eA]=(0,a.useState)(null),[eM,eF]=(0,a.useState)(O.stackedMode),[eR,eD]=(0,a.useState)(O.chatRatio),[eO,ez]=(0,a.useState)(null),[e$,eL]=(0,a.useState)(0),e_=(0,a.useRef)(null);(0,a.useEffect)(()=>{ee.set(e,{selectedFile:en,commitMsg:ef,commitPanelOpen:eN,pushOnCommit:ev,stackedMode:eM,chatRatio:eR})},[e,en,ef,eN,ev,eM,eR]);let eU=(0,a.useCallback)(t=>{t?.refresh||S(!0),I(null);let n=new URLSearchParams({cwd:e});t?.gitFetch&&n.set("fetch","1"),fetch(`/api/git/status?${n}`).then(e=>{if(!e.ok)throw Error("Failed");return e.json()}).then(e=>{j(e),t?.refresh&&eL(e=>e+1)}).catch(()=>I("Not a git repository")).finally(()=>S(!1))},[e]);(0,a.useEffect)(()=>{eU()},[eU]),(0,a.useEffect)(()=>{x({type:"watch:cwd",cwd:e})},[x,e]);let eW=(0,a.useRef)(null);(0,a.useEffect)(()=>{if(t)return p(e=>{if("session:status"!==e.type||!("sessionId"in e)||e.sessionId!==t)return;let n=eW.current;eW.current=e.status,"running"===n&&"idle"===e.status&&eU({refresh:!0})})},[t,p,eU]),(0,a.useEffect)(()=>p(e=>{"session:fs_changed"===e.type&&eU({refresh:!0})}),[p,eU]);let eG=(0,a.useCallback)(t=>{eo(!0),ea(null),ei(null),fetch(`/api/git/diff?cwd=${encodeURIComponent(e)}&file=${encodeURIComponent(t)}`).then(e=>{if(!e.ok)throw Error("Failed");return e.json()}).then(e=>{ea(e.diff);try{let t=(0,v.J2)(e.diff);if(t.length>0&&t[0].files.length>0){let n=t[0].files[0];null!=e.oldContent&&null!=e.newContent&&Y(n,e.oldContent,e.newContent),ei(n)}}catch{}}).catch(()=>ea(null)).finally(()=>eo(!1))},[e]),eB=(0,a.useRef)(e$);(0,a.useEffect)(()=>{if(!en||eM)return;let t=eB.current!==e$;eB.current=e$,t?fetch(`/api/git/diff?cwd=${encodeURIComponent(e)}&file=${encodeURIComponent(en)}`).then(e=>{if(!e.ok)throw Error("Failed");return e.json()}).then(e=>{ea(e.diff);try{let t=(0,v.J2)(e.diff);if(t.length>0&&t[0].files.length>0){let n=t[0].files[0];null!=e.oldContent&&null!=e.newContent&&Y(n,e.oldContent,e.newContent),ei(n)}}catch{}}).catch(()=>{}):eG(en)},[eM,en,eG,e$,e]),(0,a.useEffect)(()=>{if(!g||0===g.files.length||en||eM)return;let e=g.files[0];er(e.path),eG(e.path)},[g,en,eM,eG]);let eJ=(0,a.useCallback)(e=>{eM?ez(e.path):(er(e.path),eG(e.path),eu(null),h())},[eM,eG,h]),eq=(0,a.useCallback)((e,t)=>{e.preventDefault(),eu({x:e.clientX,y:e.clientY,file:t})},[]),eV=(0,a.useCallback)(async t=>{eu(null);try{if(!(await fetch("/api/git/discard",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:e,file:t.path,status:t.status})})).ok)throw Error("Failed");en===t.path&&(er(null),ea(null)),eU()}catch{}},[e,en,eU]),eH=(0,a.useCallback)(async()=>{if(ef.trim()&&0!==eg.size){ex(!0),eb(null);try{let t=await fetch("/api/git/commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:e,message:ef.trim(),files:Array.from(eg),push:ev})});if(!t.ok){let e=await t.json();throw Error(e.error||"Failed to commit")}eb({ok:!0,message:ev?"Committed and pushed":"Committed"}),eh(""),ew(new Set),er(null),ea(null),eU()}catch(e){eb({ok:!1,message:e instanceof Error?e.message:"Failed"})}finally{ex(!1)}}},[e,ef,eg,ev,eU,ew]),eX=(0,a.useCallback)(async()=>{if(0!==eg.size){eT(!0);try{let t=await fetch("/api/git/generate-message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:e,files:Array.from(eg)})}),n=await t.json();if(!t.ok)throw Error(n.error||"Failed");n.message&&eh(n.message)}catch(e){console.error("[generate-message]",e)}finally{eT(!1)}}},[e,eg]),eK=(0,a.useCallback)(async()=>{eE(!0),eA(null);try{let t=await fetch("/api/git/push",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:e})});if(!t.ok){let e=await t.json();throw Error(e.error||"Failed to push")}eA({ok:!0,message:"Pushed"}),eU()}catch(e){eA({ok:!1,message:e instanceof Error?e.message:"Failed"})}finally{eE(!1)}},[e,eU]),eY=(0,a.useCallback)(()=>{g&&ey(g.files.map(e=>e.path))},[g,ey]),eQ=(0,a.useCallback)(e=>{let t=window.innerWidth||1;eD(n=>Math.max(.15,Math.min(.5,n+e/t)))},[]),eZ=(0,a.useCallback)(()=>{ez(null)},[]),e0=(0,a.useCallback)(t=>{let n=t.startsWith("/")?t:`${e}/${t}`;m?.openFile(n)},[e,m]);if((0,a.useEffect)(()=>{if(l)return g&&0!==g.files.length?(u({id:"git-changes",title:"Changes",order:20,badge:String(g.files.length),content:(0,r.jsx)(Q,{files:g.files,selectedFile:eM?null:en,checkedFiles:eg,onFileClick:eJ,onContextMenu:eq,onToggleFile:ej,onToggleAll:eY})}),()=>f("git-changes")):void f("git-changes")},[l,g,en,eg,eM,eJ,eq,ej,eY,u,f]),(0,a.useEffect)(()=>{if(!ed)return;let e=e=>{e_.current&&!e_.current.contains(e.target)&&eu(null)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[ed]),C)return(0,r.jsx)("div",{className:"flex items-center justify-center flex-1",children:(0,r.jsx)(P.A,{className:"h-6 w-6 animate-spin text-muted-foreground"})});if(T)return(0,r.jsx)("div",{className:"flex items-center justify-center flex-1",children:(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:T})});if(!g)return null;let e1=n&&b&&!!t;return(0,r.jsxs)("div",{className:"flex flex-col flex-1 min-h-0",children:[(0,r.jsxs)("div",{className:"shrink-0 border-b px-4 py-2 flex items-center gap-3",children:[(0,r.jsx)(F.A,{className:"h-4 w-4 text-muted-foreground"}),(0,r.jsx)("span",{className:"font-mono text-sm font-bold",children:g.branch}),(0,r.jsxs)("span",{className:"text-xs text-muted-foreground",children:[g.files.length," file",1!==g.files.length?"s":""," changed"]}),(i=g.files.reduce((e,t)=>e+t.additions,0),c=g.files.reduce((e,t)=>e+t.deletions,0),i>0||c>0?(0,r.jsxs)("span",{className:"text-xs font-mono flex items-center gap-1",children:[i>0&&(0,r.jsxs)("span",{className:"text-green-500",children:["+",i]}),c>0&&(0,r.jsxs)("span",{className:"text-red-500",children:["-",c]})]}):null),g.ahead>0&&(0,r.jsxs)("span",{className:"text-xs text-muted-foreground",children:[g.ahead," unpushed"]}),eP&&(0,r.jsxs)("span",{className:(0,w.cn)("text-xs flex items-center gap-1",eP.ok?"text-green-500":"text-red-500"),children:[eP.ok&&(0,r.jsx)(N.A,{className:"h-3 w-3"}),eP.message]}),(0,r.jsx)("div",{className:"flex-1"}),g.files.length>0&&(0,r.jsxs)("div",{className:"flex items-center gap-0.5 rounded-md border p-0.5",children:[(0,r.jsx)("button",{onClick:()=>eF(!0),className:(0,w.cn)("rounded px-1.5 py-0.5 text-xs transition-colors",eM?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),title:"Stacked view",children:(0,r.jsx)(R.A,{className:"h-3.5 w-3.5"})}),(0,r.jsx)("button",{onClick:()=>eF(!1),className:(0,w.cn)("rounded px-1.5 py-0.5 text-xs transition-colors",eM?"text-muted-foreground hover:text-foreground":"bg-primary text-primary-foreground"),title:"Single file view",children:(0,r.jsx)(D.A,{className:"h-3.5 w-3.5"})})]}),g.ahead>0&&(0,r.jsxs)(B.$,{variant:"outline",size:"sm",onClick:eK,disabled:eI,className:"gap-1.5",children:[eI?(0,r.jsx)(P.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,r.jsx)(z,{className:"h-3.5 w-3.5"}),"Push"]}),(0,r.jsx)(B.$,{variant:"ghost",size:"sm",onClick:()=>eU({gitFetch:!0}),children:"Refresh"})]}),(0,r.jsxs)("div",{className:"flex-1 min-h-0 flex flex-row",children:[(0,r.jsxs)("div",{className:"flex-1 min-w-0 flex flex-col",children:[(0,r.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto",children:eM?(0,r.jsx)(Z,{files:g.files,cwd:e,diffStyle:d.diffStyle,scrollToFile:eO,onScrolled:eZ,onViewFile:e0,checkedFiles:eg,onToggleFile:ej,refreshKey:e$}):ec?(0,r.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,r.jsx)(P.A,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):en&&el?(0,r.jsx)("div",{className:"p-4",children:(0,r.jsxs)("div",{className:"rounded-lg border overflow-hidden",children:[(o=g.files.find(e=>e.path===en))?(0,r.jsxs)("div",{className:"sticky top-0 z-10 flex items-center gap-2 px-4 py-1.5 text-sm border-b bg-muted/80 backdrop-blur-sm",children:[X(o.status),(0,r.jsx)("span",{className:"font-mono text-xs truncate flex-1 min-w-0 text-left",dir:"rtl",title:o.path,children:(0,r.jsx)("bdo",{dir:"ltr",children:o.path})}),(0,r.jsx)(H,{checked:eg.has(o.path),onChange:()=>ej(o.path),onClick:e=>e.stopPropagation()}),(0,r.jsx)("button",{onClick:()=>e0(o.path),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",title:"Open in editor",children:(0,r.jsx)(M.A,{className:"h-3 w-3"})})]}):null,(0,r.jsx)(W.sU,{fallback:(0,r.jsx)("pre",{className:"p-4 text-xs text-muted-foreground whitespace-pre-wrap",children:el}),children:es?(0,r.jsx)(k.Q,{fileDiff:es,options:{theme:{dark:"pierre-dark",light:"pierre-light"},themeType:K()?"dark":"light",overflow:"wrap",diffStyle:d.diffStyle,disableFileHeader:!0,hunkSeparators:"line-info",expansionLineCount:20,unsafeCSS:W.j8}}):(0,r.jsx)("pre",{className:"p-4 text-xs text-muted-foreground whitespace-pre-wrap",children:el})})]})}):(0,r.jsx)("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground text-center px-4",children:g.files.length>0?"Select a file from the sidebar to view changes":"No changes"})}),g.files.length>0&&(0,r.jsxs)("div",{className:"shrink-0 border-t",children:[(0,r.jsxs)("button",{onClick:()=>eC(!eN),className:"w-full px-4 py-2 flex items-center gap-2 text-sm font-medium hover:bg-muted/50",children:[eN?(0,r.jsx)(E.A,{className:"h-3.5 w-3.5"}):(0,r.jsx)(A.A,{className:"h-3.5 w-3.5"}),"Commit (",eg.size," file",1!==eg.size?"s":"",")"]}),eN&&(0,r.jsxs)("div",{className:"px-4 pb-3 space-y-2",children:[(0,r.jsx)("textarea",{value:ef,onChange:e=>eh(e.target.value),placeholder:"Commit message...",className:"w-full rounded border bg-background px-3 py-2 text-sm resize-none focus:outline-none focus:ring-1 focus:ring-ring",rows:3}),(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsxs)(B.$,{size:"sm",variant:"outline",onClick:eX,disabled:eS||0===eg.size,className:"gap-1.5",children:[eS?(0,r.jsx)(P.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,r.jsx)($,{className:"h-3.5 w-3.5"}),eS?"Generating...":"Generate"]}),(0,r.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground cursor-pointer",children:[(0,r.jsx)(H,{checked:ev,onChange:()=>ek(!ev)}),"Push after commit"]}),(0,r.jsx)("div",{className:"flex-1"}),ep&&(0,r.jsxs)("span",{className:(0,w.cn)("text-xs flex items-center gap-1",ep.ok?"text-green-500":"text-red-500"),children:[ep.ok&&(0,r.jsx)(N.A,{className:"h-3 w-3"}),ep.message]}),(0,r.jsxs)(B.$,{size:"sm",onClick:eH,disabled:em||!ef.trim()||0===eg.size,className:"gap-1.5",children:[em?(0,r.jsx)(P.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,r.jsx)(L.A,{className:"h-3.5 w-3.5"}),ev?"Commit & Push":"Commit"]})]})]})]})]}),e1&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(G,{onResize:eQ}),(0,r.jsx)("div",{className:"flex flex-col shrink-0 border-l min-h-0",style:{width:`${100*eR}%`},children:(0,r.jsx)(U.I,{sessionId:t,cwd:e})})]})]}),ed&&(0,r.jsx)("div",{ref:e_,className:"fixed z-50 rounded border bg-background shadow-lg py-1 min-w-[140px]",style:{left:ed.x,top:ed.y},children:(0,r.jsxs)("button",{onClick:()=>eV(ed.file),className:"w-full px-3 py-1.5 text-sm text-left hover:bg-muted flex items-center gap-2 text-red-500",children:[(0,r.jsx)(_.A,{className:"h-3.5 w-3.5"}),"Discard changes"]})})]})}function en(e,t,n){let r=t.split(/\r?\n/).map(e=>e+"\n"),l=n.split(/\r?\n/).map(e=>e+"\n");for(let t of e.hunks){let e=t.deletionStart-1-t.deletionLineIndex,n=t.additionStart-1-t.additionLineIndex;for(let r of(t.deletionLineIndex=t.deletionStart-1,t.additionLineIndex=t.additionStart-1,t.hunkContent))r.deletionLineIndex+=e,r.additionLineIndex+=n}e.deletionLines=r,e.additionLines=l,e.isPartial=!1}function er({cwd:e,filePath:t}){let{settings:n}=(0,J.t)(),{tabActions:l}=(0,s.E2)(),{subscribe:i}=(0,q.h)(),[c,o]=(0,a.useState)(!0),[d,u]=(0,a.useState)(null),[f,h]=(0,a.useState)(null),[m,x]=(0,a.useState)("modified"),{checkedFiles:p,toggleFile:b}=(0,V.e)(e),g=p.has(t),j=(0,a.useRef)(void 0),y=(0,a.useCallback)(()=>{o(!0),u(null),h(null),fetch(`/api/git/diff?cwd=${encodeURIComponent(e)}&file=${encodeURIComponent(t)}`).then(e=>{if(!e.ok)throw Error("Failed");return e.json()}).then(e=>{u(e.diff),e.status&&x(e.status);try{let t=(0,v.J2)(e.diff);if(t.length>0&&t[0].files.length>0){let n=t[0].files[0];null!=e.oldContent&&null!=e.newContent&&en(n,e.oldContent,e.newContent),h(n)}}catch{}}).catch(()=>u(null)).finally(()=>o(!1))},[e,t]);(0,a.useEffect)(()=>{y()},[y]);let E=(0,a.useCallback)(()=>{fetch(`/api/git/diff?cwd=${encodeURIComponent(e)}&file=${encodeURIComponent(t)}`).then(e=>{if(!e.ok)throw Error("Failed");return e.json()}).then(e=>{u(e.diff),e.status&&x(e.status);try{let t=(0,v.J2)(e.diff);if(t.length>0&&t[0].files.length>0){let n=t[0].files[0];null!=e.oldContent&&null!=e.newContent&&en(n,e.oldContent,e.newContent),h(n)}}catch{}}).catch(()=>{})},[e,t]);(0,a.useEffect)(()=>i(e=>{"session:fs_changed"===e.type&&(clearTimeout(j.current),j.current=setTimeout(E,300))}),[i,E]);let A=(0,a.useCallback)(()=>{b(t)},[b,t]),F=(0,a.useCallback)(()=>{let n=t.startsWith("/")?t:`${e}/${t}`;l?.openFile(n)},[e,t,l]);return c?(0,r.jsx)("div",{className:"flex items-center justify-center flex-1",children:(0,r.jsx)(P.A,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):d?(0,r.jsx)("div",{className:"flex flex-col flex-1 min-h-0",children:(0,r.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto",children:(0,r.jsx)("div",{className:"p-4",children:(0,r.jsxs)("div",{className:"rounded-lg border overflow-hidden",children:[(0,r.jsxs)("div",{className:"sticky top-0 z-10 flex items-center gap-2 px-4 py-1.5 text-sm border-b bg-muted/80 backdrop-blur-sm",children:[function(e){switch(e){case"added":case"untracked":return(0,r.jsx)(C.A,{className:"h-3.5 w-3.5 text-green-500 shrink-0"});case"deleted":return(0,r.jsx)(S.A,{className:"h-3.5 w-3.5 text-red-500 shrink-0"});case"renamed":return(0,r.jsx)(T.A,{className:"h-3.5 w-3.5 text-blue-500 shrink-0"});default:return(0,r.jsx)(I.A,{className:"h-3.5 w-3.5 text-yellow-500 shrink-0"})}}(m),(0,r.jsx)("span",{className:"font-mono text-xs truncate flex-1 min-w-0 text-left",dir:"rtl",title:t,children:(0,r.jsx)("bdo",{dir:"ltr",children:t})}),(0,r.jsx)("button",{type:"button",role:"checkbox","aria-checked":g,onClick:A,className:(0,w.cn)("h-4 w-4 shrink-0 rounded border flex items-center justify-center transition-colors",g?"border-primary bg-primary text-primary-foreground":"border-muted-foreground/40 bg-transparent hover:border-muted-foreground/60"),children:g&&(0,r.jsx)(N.A,{className:"h-3 w-3",strokeWidth:3})}),(0,r.jsx)("button",{onClick:F,className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",title:"Open in editor",children:(0,r.jsx)(M.A,{className:"h-3 w-3"})})]}),(0,r.jsx)(W.sU,{fallback:(0,r.jsx)("pre",{className:"p-4 text-xs text-muted-foreground whitespace-pre-wrap",children:d}),children:f?(0,r.jsx)(k.Q,{fileDiff:f,options:{theme:{dark:"pierre-dark",light:"pierre-light"},themeType:!("u"<typeof document)&&document.documentElement.classList.contains("dark")?"dark":"light",overflow:"wrap",diffStyle:n.diffStyle,disableFileHeader:!0,hunkSeparators:"line-info",expansionLineCount:20,unsafeCSS:W.j8}}):(0,r.jsx)("pre",{className:"p-4 text-xs text-muted-foreground whitespace-pre-wrap",children:d})})]})})})}):(0,r.jsx)("div",{className:"flex items-center justify-center flex-1 text-sm text-muted-foreground",children:"No diff available"})}var el=n(2125),ea=n(65377),es=n(25182);let ei=(0,O.A)("text-wrap",[["path",{d:"m16 16-3 3 3 3",key:"117b85"}],["path",{d:"M3 12h14.5a1 1 0 0 1 0 7H13",key:"18xa6z"}],["path",{d:"M3 19h6",key:"1ygdsz"}],["path",{d:"M3 5h18",key:"1u36vt"}]]);var ec=n(9005),eo=n(18189),ed=n(8187),eu=n(96301),ef=n(64233),eh=n(42763);let em=new Map,ex=new Map;function ep(e){for(let t of Array.from(e.querySelectorAll("mark.file-search-match"))){let e=t.parentNode;if(e){for(;t.firstChild;)e.insertBefore(t.firstChild,t);e.removeChild(t),e.normalize()}}}function eb(e,t){let n=e.querySelectorAll("mark.file-search-match");n.forEach(e=>{e.style.backgroundColor="rgba(250, 204, 21, 0.35)"});let r=n[t];r&&(r.style.backgroundColor="rgba(234, 88, 12, 0.5)",r.scrollIntoView({block:"center",behavior:"smooth"}))}function eg({cwd:e,initialFile:t,manageSidebar:n=!0}){let{setSidebarSection:l,removeSidebarSection:i,closeSidebar:c,tabActions:o}=(0,s.E2)(),{subscribe:d}=(0,q.h)(),[f,h]=(0,a.useState)(()=>t||em.get(e)||null),[m,x]=(0,a.useState)(null),[p,b]=(0,a.useState)(!1),[g,j]=(0,a.useState)(!1),[y,w]=(0,a.useState)(!1),[v,k]=(0,a.useState)(!1),[N,C]=(0,a.useState)(!1),S=(0,a.useRef)(0),T=(0,a.useRef)(null),I=(0,a.useRef)(null),M=(0,a.useRef)(null),F=(0,a.useRef)(-1),[R,D]=(0,a.useState)(!1),[O,z]=(0,a.useState)(""),[$,L]=(0,a.useState)(0),[_,U]=(0,a.useState)(-1);(0,a.useEffect)(()=>{"1"===localStorage.getItem("cockpit-files-wrap")&&w(!0),"1"===localStorage.getItem("cockpit-files-preview")&&k(!0)},[]);let W=(0,a.useCallback)(()=>{w(e=>{let t=!e;return localStorage.setItem("cockpit-files-wrap",t?"1":"0"),t})},[]),G=(0,a.useCallback)(()=>{k(e=>{let t=!e;return localStorage.setItem("cockpit-files-preview",t?"1":"0"),t})},[]),B=(0,a.useCallback)(()=>{D(!0),requestAnimationFrame(()=>{M.current?.focus(),M.current?.select()})},[]),J=(0,a.useCallback)(()=>{D(!1),z("")},[]),V=(0,a.useCallback)(e=>{if(0===$||!T.current)return;let t=((_+e)%$+$)%$;F.current=t,U(t),eb(T.current,t)},[$,_]),H=(0,a.useCallback)(e=>{"Escape"===e.key?J():"Enter"===e.key&&(e.preventDefault(),V(e.shiftKey?-1:1))},[J,V]);(0,a.useEffect)(()=>{let e;if(!R||!O||!T.current){T.current&&ep(T.current),L(0),F.current=-1,U(-1);return}let t=T.current,n=e=>{let n,r=function(e,t){if(ep(e),!t)return 0;let n=t.toLowerCase(),r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),l=[];for(;r.nextNode();){let e=r.currentNode.parentNode?.nodeName;"STYLE"!==e&&"SCRIPT"!==e&&l.push(r.currentNode)}let a=0;for(let e of l){let r=e.textContent??"",l=r.toLowerCase(),s=[],i=0;for(;;){let e=l.indexOf(n,i);if(-1===e)break;s.push(e),i=e+1}if(!s.length)continue;let c=document.createDocumentFragment(),o=0;for(let e of s){e>o&&c.appendChild(document.createTextNode(r.slice(o,e)));let n=document.createElement("mark");n.className="file-search-match",n.style.backgroundColor="rgba(250, 204, 21, 0.35)",n.style.color="inherit",n.style.borderRadius="1px",n.textContent=r.slice(e,e+t.length),c.appendChild(n),a++,o=e+t.length}o<r.length&&c.appendChild(document.createTextNode(r.slice(o))),e.parentNode?.replaceChild(c,e)}return a}(t,O);L(r),n=!e&&F.current>=0&&r>0?Math.min(F.current,r-1):r>0?0:-1,F.current=n,U(n),n>=0&&eb(t,n)};e=requestAnimationFrame(()=>n(!0));let r=new MutationObserver(()=>{t.querySelector("mark.file-search-match")||(e=requestAnimationFrame(()=>n(!1)))});return r.observe(t,{childList:!0,subtree:!0}),()=>{cancelAnimationFrame(e),r.disconnect()}},[R,O,m,y,v]);let X=(0,a.useCallback)(t=>{h(t),em.set(e,t),window.innerWidth<768&&c()},[e,c]),K=(0,a.useCallback)(e=>{o?o.openFile(e):X(e),j(!1)},[o,X]);if((0,a.useEffect)(()=>{if(n)return l({id:"file-tree",title:"Files",content:(0,r.jsx)(eu.h,{cwd:e,selectedFile:f,onSelectFile:X}),order:30,actions:(0,r.jsx)("button",{onClick:()=>j(!0),title:"Open file",className:"flex items-center justify-center rounded p-0.5 hover:bg-accent text-muted-foreground",children:(0,r.jsx)(el.A,{className:"h-3.5 w-3.5"})})}),()=>i("file-tree")},[e,f,X,l,i,n]),(0,a.useEffect)(()=>{if(!f)return void x(null);C(!1);let e=ex.get(f);if(e)return void x(e);let t=++S.current;b(!0),fetch(`/api/filesystem/read?path=${encodeURIComponent(f)}`).then(e=>{if(!e.ok)throw Error("Failed to read file");return e.json()}).then(e=>{if(S.current===t){if(ex.size>=50){let e=ex.keys().next().value;void 0!==e&&ex.delete(e)}ex.set(f,e),x(e)}}).catch(()=>{S.current===t&&x(null)}).finally(()=>{S.current===t&&b(!1)})},[f]),(0,a.useEffect)(()=>{if(!f)return;let e=async()=>{let e=ex.get(f);if(e?.mtimeMs)try{let t=await fetch(`/api/filesystem/read?path=${encodeURIComponent(f)}&stat=true`);if(!t.ok)return;if((await t.json()).mtimeMs!==e.mtimeMs){let e=I.current?.scrollTop??0,t=await fetch(`/api/filesystem/read?path=${encodeURIComponent(f)}`);if(!t.ok)return;let n=await t.json();ex.set(f,n),x(n),requestAnimationFrame(()=>{I.current&&(I.current.scrollTop=e)})}}catch{}};return d(t=>{"session:fs_changed"===t.type&&e()})},[f,d]),!f)return(0,r.jsx)("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"Select a file to view"});if(p)return(0,r.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,r.jsx)(P.A,{className:"h-5 w-5 animate-spin text-muted-foreground"})});if(!m)return(0,r.jsx)("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"Failed to read file"});let Y=function(e,t){if(t.startsWith(e)){let n=t.slice(e.length);return n.startsWith("/")?n.slice(1):n}return t}(e,f),Q=(0,u.uk)(f)||f,Z=Y.slice(0,Y.length-Q.length),ee=(0,eo.WG)(f),et="markdown"===ee||"mdx"===ee,en=et&&v,er=!m.binary&&!m.image;return(0,r.jsxs)("div",{className:"flex flex-col h-full min-h-0",children:[(0,r.jsxs)("div",{className:"shrink-0 flex items-center gap-1 border-b px-4 py-2 font-mono text-xs",children:[Z&&(0,r.jsx)("span",{className:"text-muted-foreground",children:Z}),(0,r.jsx)("span",{className:"font-bold",children:Q}),m.truncated&&(0,r.jsx)("span",{className:"ml-2 text-muted-foreground",children:"(truncated to 100KB)"}),(0,r.jsxs)("div",{className:"ml-auto flex items-center gap-1",children:[er&&(0,r.jsx)("button",{type:"button",onClick:R?J:B,"aria-label":"Find in file",title:"Find in file",className:`flex items-center justify-center rounded p-1 hover:bg-accent ${R?"text-foreground":"text-muted-foreground"}`,children:(0,r.jsx)(ea.A,{className:"h-3.5 w-3.5"})}),et&&(0,r.jsx)("button",{type:"button",onClick:G,"aria-label":v?"Show source":"Show preview","aria-pressed":v,title:v?"Show source":"Show preview",className:`flex items-center justify-center rounded p-1 hover:bg-accent ${v?"text-foreground":"text-muted-foreground"}`,children:(0,r.jsx)(es.A,{className:"h-3.5 w-3.5"})}),er&&!en&&(0,r.jsx)("button",{type:"button",onClick:W,"aria-label":y?"Disable line wrap":"Enable line wrap","aria-pressed":y,title:y?"Disable line wrap":"Enable line wrap",className:`flex items-center justify-center rounded p-1 hover:bg-accent ${y?"text-foreground":"text-muted-foreground"}`,children:(0,r.jsx)(ei,{className:"h-3.5 w-3.5"})})]})]}),R&&(0,r.jsxs)("div",{className:"shrink-0 flex items-center gap-1.5 border-b px-4 py-1.5",children:[(0,r.jsx)("input",{ref:M,value:O,onChange:e=>z(e.target.value),onKeyDown:H,placeholder:"Find in file...",className:"flex-1 min-w-0 bg-transparent text-xs outline-none placeholder:text-muted-foreground"}),O&&(0,r.jsx)("span",{className:"text-[10px] text-muted-foreground tabular-nums shrink-0",children:$>0?`${_+1} of ${$}`:"No results"}),(0,r.jsx)("button",{type:"button",onClick:()=>V(-1),disabled:0===$,className:"flex items-center justify-center rounded p-0.5 hover:bg-accent text-muted-foreground disabled:opacity-30",children:(0,r.jsx)(A.A,{className:"h-3.5 w-3.5"})}),(0,r.jsx)("button",{type:"button",onClick:()=>V(1),disabled:0===$,className:"flex items-center justify-center rounded p-0.5 hover:bg-accent text-muted-foreground disabled:opacity-30",children:(0,r.jsx)(E.A,{className:"h-3.5 w-3.5"})}),(0,r.jsx)("button",{type:"button",onClick:J,className:"flex items-center justify-center rounded p-0.5 hover:bg-accent text-muted-foreground",children:(0,r.jsx)(ec.A,{className:"h-3 w-3"})})]}),(0,r.jsx)("div",{ref:T,className:"flex-1 min-h-0 flex flex-col",children:m.image?(0,r.jsx)("div",{ref:I,className:"flex-1 min-h-0 overflow-auto flex items-center justify-center p-4",children:N?(0,r.jsx)("div",{className:"text-sm text-muted-foreground",children:"Could not display image"}):(0,r.jsx)("img",{src:`/api/filesystem/read?path=${encodeURIComponent(f)}&raw=true${m.mtimeMs?`&t=${m.mtimeMs}`:""}`,alt:Q,className:"max-w-full max-h-full object-contain",onError:()=>C(!0)})}):m.binary?(0,r.jsx)("div",{className:"flex items-center justify-center flex-1 text-sm text-muted-foreground",children:"Binary file"}):en?(0,r.jsx)("div",{ref:I,className:"flex-1 min-h-0 overflow-y-auto p-4",children:(0,r.jsx)(ef.Y,{content:m.content})}):(0,r.jsx)("div",{ref:I,className:"flex-1 min-h-0 overflow-auto",children:(0,r.jsx)(eo.NG,{code:m.content,language:ee,dark:!("u"<typeof document)&&document.documentElement.classList.contains("dark"),fullHeight:!0,wrap:y})})}),(0,r.jsx)(eh.lG,{open:g,onOpenChange:j,children:(0,r.jsxs)(eh.Cf,{className:"sm:max-w-lg",children:[(0,r.jsx)(eh.c7,{children:(0,r.jsx)(eh.L3,{children:"Open File"})}),(0,r.jsx)(ed.N,{startPath:e,onSelect:K,onCancel:()=>j(!1)})]})})]})}var ej=n(25494),ey=n(36483);let ew=(0,O.A)("file-diff",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M9 10h6",key:"9gxzsh"}],["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"M9 17h6",key:"r8uit2"}]]);var ev=n(16449);let ek=(0,O.A)("columns-2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]]);function eN(e,t,n,r){let l=Array.from(e.querySelectorAll("[data-tab-id]"));if(0===l.length)return 0;let a=r.indexOf(n);for(let e=0;e<l.length;e++){let n=l[e].getBoundingClientRect();if(t<n.left+n.width/2){if(e===a||e===a+1)return null;return e}}let s=l.length;return s===a||s===a+1?null:s}function eC({splitRatio:e}){let t=j(),n=(0,y.G)(),l=(0,a.useRef)(null),[s,i]=(0,a.useState)(null),[c,o]=(0,a.useState)(null),[d,u]=(0,a.useState)(!1),f=(0,a.useRef)(null),h=(0,a.useRef)(null),m=(0,a.useRef)(null);if(!t||t.tabs.length<=1)return null;let{activeTabId:x,splitTabId:p,rightPaneTabIds:b,setActiveTab:g,closeTab:v,setSplitTab:k,moveTab:N,moveTabToPane:C}=t,S=n&&null!==p,T=t.tabs.filter(e=>"chat"!==e.type),I=T.map(e=>e.id),E=()=>{l.current=null,i(null),o(null),u(!1)},P=()=>{l.current=null,i(null),o(null),u(!1)},A=(e,t)=>(0,r.jsx)("div",{className:(0,w.cn)("self-stretch shrink-0 rounded-full transition-all",s===e&&c===(t??null)?"w-0.5 bg-primary mx-0.5":d?"w-1":"w-0")},`ind-${t||"main"}-${e}`),M=(e,t,n,a)=>{let s;return(0,r.jsxs)("button",{"data-tab-id":"chat"!==e.type?e.id:void 0,draggable:a,onDragStart:a?(s=e.id,e=>{l.current=s,u(!0),e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",s)}):void 0,onDragEnd:a?E:void 0,onClick:n,className:(0,w.cn)("flex items-center gap-1.5 px-3 py-1.5 md:px-4 md:py-2.5 text-xs md:text-sm font-medium whitespace-nowrap border-b-2 transition-colors group",t?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground",a&&"cursor-grab active:cursor-grabbing"),children:[function(e){switch(e.type){case"chat":return(0,r.jsx)(ej.A,{className:"h-3 w-3 md:h-3.5 md:w-3.5 shrink-0"});case"file":return(0,r.jsx)(ey.A,{className:"h-3 w-3 md:h-3.5 md:w-3.5 shrink-0"});case"diff":return(0,r.jsx)(ew,{className:"h-3 w-3 md:h-3.5 md:w-3.5 shrink-0"});case"changes":return(0,r.jsx)(F.A,{className:"h-3 w-3 md:h-3.5 md:w-3.5 shrink-0"});case"terminal":return(0,r.jsx)(ev.A,{className:"h-3 w-3 md:h-3.5 md:w-3.5 shrink-0"})}}(e),(0,r.jsx)("span",{className:"truncate max-w-[120px]",children:function(e){switch(e.type){case"chat":return"Chat";case"file":case"diff":case"terminal":return e.label;case"changes":return"Changes"}}(e)}),"chat"!==e.type&&(0,r.jsx)("span",{role:"button",tabIndex:0,onClick:t=>{t.stopPropagation(),v(e.id)},onKeyDown:t=>{("Enter"===t.key||" "===t.key)&&(t.stopPropagation(),v(e.id))},className:"ml-0.5 rounded p-0.5 hover:bg-muted cursor-default",children:(0,r.jsx)(ec.A,{className:"h-2.5 w-2.5 md:h-3 md:w-3"})})]})},R=n&&T.length>0?(0,r.jsx)("button",{onClick:()=>{if(p)k(null);else{let e=t.tabs.find(e=>e.id===x&&"chat"!==e.type)||t.tabs.find(e=>"chat"!==e.type);e&&(k(e.id),"chat"!==x&&g("chat"))}},title:p?"Close split view":"Split view",className:(0,w.cn)("ml-auto shrink-0 flex items-center justify-center px-2 py-1.5 md:px-3 md:py-2.5 text-muted-foreground hover:text-foreground transition-colors",p&&"text-primary"),children:(0,r.jsx)(ek,{className:"h-3.5 w-3.5 md:h-4 md:w-4"})}):null;if(S){let n=e??.5,a=t.tabs.filter(e=>!b.includes(e.id)),d=a.filter(e=>"chat"!==e.type),u=d.map(e=>e.id),f=t.tabs.filter(e=>b.includes(e.id)),j=f.map(e=>e.id),y=e=>{e.preventDefault();let n=l.current;if(!n)return void P();let r=b.includes(n);"left"===c&&r?C(n,"left"):"right"!==c||r?null!==s&&c&&N(n,function(e,t,n){if(0===e.length||t>=e.length){let t=e[e.length-1];return t?n.findIndex(e=>e.id===t.id)+1:n.length}return n.findIndex(n=>n.id===e[t].id)}("left"===c?d:f,s,t.tabs)):C(n,"right"),P()};return(0,r.jsxs)("div",{className:"shrink-0 border-b flex items-center bg-background",children:[(0,r.jsxs)("div",{ref:h,className:"flex items-center overflow-x-auto scrollbar-none min-w-0",style:{width:`${(1-n)*100}%`},onDragOver:e=>{if(l.current){if(e.preventDefault(),e.dataTransfer.dropEffect="move",!h.current){i(0),o("left");return}i(eN(h.current,e.clientX,l.current,u)??0),o("left")}},onDrop:y,children:[M(a[0],x===a[0].id,()=>g(a[0].id),!1),d.map((e,t)=>(0,r.jsxs)("div",{className:"flex items-center",children:[A(t,"left"),M(e,e.id===x,()=>g(e.id),!0)]},e.id)),A(d.length,"left")]}),(0,r.jsx)("div",{className:"w-1 shrink-0 bg-border"}),(0,r.jsxs)("div",{ref:m,className:"flex items-center overflow-x-auto scrollbar-none min-w-0",style:{width:`${100*n}%`},onDragOver:e=>{if(l.current){if(e.preventDefault(),e.dataTransfer.dropEffect="move",!m.current){i(0),o("right");return}i(eN(m.current,e.clientX,l.current,j)??0),o("right")}},onDrop:y,children:[f.map((e,t)=>(0,r.jsxs)("div",{className:"flex items-center",children:[A(t,"right"),M(e,e.id===p,()=>k(e.id),!0)]},e.id)),A(f.length,"right"),R]})]})}return(0,r.jsxs)("div",{ref:f,className:"shrink-0 border-b flex items-center overflow-x-auto scrollbar-none bg-background",onDragOver:e=>{!l.current||(e.preventDefault(),e.dataTransfer.dropEffect="move",f.current&&(i(eN(f.current,e.clientX,l.current,I)),o(null)))},onDrop:e=>{e.preventDefault(),l.current&&null!==s&&N(l.current,s+1),P()},children:[M(t.tabs[0],"chat"===x,()=>g("chat"),!1),T.map((e,t)=>(0,r.jsxs)("div",{className:"flex items-center",children:[A(t),M(e,e.id===x,()=>g(e.id),!0)]},e.id)),A(T.length),R]})}let eS=o()(()=>Promise.resolve().then(n.bind(n,27417)).then(e=>e.TerminalPanel),{loadableGenerated:{webpack:()=>[27417]},ssr:!1});function eT(e){return(0,r.jsx)(g,{sessionId:e.sessionId,children:(0,r.jsx)(eI,{...e})})}function eI({sessionId:e,cwd:t,initialName:n,historyView:l}){let i=j(),{setTabActions:c}=(0,s.E2)(),o=(0,y.G)(),d=(0,a.useRef)(null),[u,f]=(0,a.useState)(.5);(0,a.useEffect)(()=>(c({openFile:i.openFile,openDiff:i.openDiff,openChanges:i.openChanges,openTerminal:i.openTerminal}),()=>c(null)),[i.openFile,i.openDiff,i.openChanges,i.openTerminal,c]);let{activeTabId:h,splitTabId:m,rightPaneTabIds:x,tabs:p}=i,b=o&&null!==m,g=(0,a.useCallback)(e=>{let t=d.current;if(!t)return;let n=t.offsetWidth;0!==n&&f(t=>Math.max(.25,Math.min(.75,t+e/n)))},[]);(0,a.useEffect)(()=>{let e=async e=>{let n=e.metaKey||e.ctrlKey;if(n&&"w"===e.key&&"chat"!==i.activeTabId&&(e.preventDefault(),i.closeTab(i.activeTabId)),n&&"`"===e.key){e.preventDefault();try{let e=await fetch("/api/terminal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:t})});if(e.ok){let{terminalId:t}=await e.json();i.openTerminal(t)}}catch{}}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[i,t]);let v=p.filter(e=>"file"===e.type),k=p.filter(e=>"diff"===e.type),N=p.filter(e=>"terminal"===e.type),C=p.some(e=>"changes"===e.type),S=(0,a.useCallback)(e=>{e.preventDefault(),e.dataTransfer.dropEffect="move"},[]),T=(0,a.useCallback)(e=>{e.preventDefault();let t=e.dataTransfer.getData("text/plain");t&&"chat"!==t&&x.includes(t)&&i.moveTabToPane(t,"left")},[i,x]),I=(0,a.useCallback)(e=>{e.preventDefault();let t=e.dataTransfer.getData("text/plain");t&&"chat"!==t&&(x.includes(t)?i.setSplitTab(t):i.moveTabToPane(t,"right"))},[i,x]);if(b){let a=v.filter(e=>!x.includes(e.id)),s=k.filter(e=>!x.includes(e.id)),i=N.filter(e=>!x.includes(e.id)),c=C&&!x.includes("changes"),o=v.filter(e=>x.includes(e.id)),f=k.filter(e=>x.includes(e.id)),p=N.filter(e=>x.includes(e.id)),j=C&&x.includes("changes");return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(eC,{splitRatio:b?u:void 0}),(0,r.jsxs)("div",{ref:d,className:"flex-1 min-h-0 flex flex-row",children:[(0,r.jsxs)("div",{className:"flex flex-col min-w-0 min-h-0",style:{width:`${(1-u)*100}%`},onDragOver:S,onDrop:T,children:[(0,r.jsx)(U.I,{sessionId:e,cwd:t,initialName:n,historyView:l,className:(0,w.cn)("chat"!==h&&"hidden")}),a.map(e=>(0,r.jsx)("div",{className:(0,w.cn)("flex flex-col flex-1 min-h-0",h!==e.id&&"hidden"),children:(0,r.jsx)(eg,{cwd:t,initialFile:e.filePath,manageSidebar:!1})},e.id)),s.map(e=>(0,r.jsx)("div",{className:(0,w.cn)("flex flex-col flex-1 min-h-0",h!==e.id&&"hidden"),children:(0,r.jsx)(er,{cwd:t,filePath:e.filePath})},e.id)),c&&(0,r.jsx)("div",{className:(0,w.cn)("flex flex-col flex-1 min-h-0","changes"!==h&&"hidden"),children:(0,r.jsx)(et,{cwd:t,sessionId:e,embeddedChat:!1,manageSidebar:!1})}),i.map(e=>(0,r.jsx)("div",{className:(0,w.cn)("flex flex-col flex-1 min-h-0 min-w-0",h!==e.id&&"hidden"),children:(0,r.jsx)(eS,{terminalId:e.terminalId,cwd:t,active:h===e.id})},e.id))]}),(0,r.jsx)(G,{onResize:g}),(0,r.jsxs)("div",{className:"flex flex-col min-w-0 min-h-0",style:{width:`${100*u}%`},onDragOver:S,onDrop:I,children:[o.map(e=>(0,r.jsx)("div",{className:(0,w.cn)("flex flex-col flex-1 min-h-0",m!==e.id&&"hidden"),children:(0,r.jsx)(eg,{cwd:t,initialFile:e.filePath,manageSidebar:!1})},e.id)),f.map(e=>(0,r.jsx)("div",{className:(0,w.cn)("flex flex-col flex-1 min-h-0",m!==e.id&&"hidden"),children:(0,r.jsx)(er,{cwd:t,filePath:e.filePath})},e.id)),j&&(0,r.jsx)("div",{className:(0,w.cn)("flex flex-col flex-1 min-h-0","changes"!==m&&"hidden"),children:(0,r.jsx)(et,{cwd:t,sessionId:e,embeddedChat:!1,manageSidebar:!1})}),p.map(e=>(0,r.jsx)("div",{className:(0,w.cn)("flex flex-col flex-1 min-h-0 min-w-0",m!==e.id&&"hidden"),children:(0,r.jsx)(eS,{terminalId:e.terminalId,cwd:t,active:m===e.id})},e.id))]})]})]})}return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(eC,{splitRatio:b?u:void 0}),(0,r.jsx)(U.I,{sessionId:e,cwd:t,initialName:n,historyView:l,className:(0,w.cn)("chat"!==h&&"hidden")}),v.map(e=>(0,r.jsx)("div",{className:(0,w.cn)("flex flex-col flex-1 min-h-0",h!==e.id&&"hidden"),children:(0,r.jsx)(eg,{cwd:t,initialFile:e.filePath,manageSidebar:!1})},e.id)),k.map(e=>(0,r.jsx)("div",{className:(0,w.cn)("flex flex-col flex-1 min-h-0",h!==e.id&&"hidden"),children:(0,r.jsx)(er,{cwd:t,filePath:e.filePath})},e.id)),C&&(0,r.jsx)("div",{className:(0,w.cn)("flex flex-col flex-1 min-h-0","changes"!==h&&"hidden"),children:(0,r.jsx)(et,{cwd:t,sessionId:e,embeddedChat:!1,manageSidebar:!1})}),N.map(e=>(0,r.jsx)("div",{className:(0,w.cn)("flex flex-col flex-1 min-h-0 min-w-0",h!==e.id&&"hidden"),children:(0,r.jsx)(eS,{terminalId:e.terminalId,cwd:t,active:h===e.id})},e.id))]})}function eE({params:e}){let{id:t}=(0,a.use)(e),n=(0,l.useSearchParams)(),c=n.get("cwd")||"",o=n.get("name")||void 0,d="true"===n.get("historyView");return(0,a.useEffect)(()=>{console.log(`[session-page] mounted ${t.slice(0,8)} at ${performance.now().toFixed(0)}ms`)},[t]),(0,s.mq)(c||void 0),(0,s.tB)(t),(0,a.useEffect)(()=>{(0,i.MN)(t),(0,i.HC)(t)},[t]),(0,r.jsx)(eT,{sessionId:t,cwd:c||"",initialName:o,historyView:d})}},27417:(e,t,n)=>{"use strict";n.r(t),n.d(t,{TerminalPanel:()=>g,disposeTerminalInstance:()=>p});var r=n(95155),l=n(66763),a=n(9005),s=n(99537);let i=(0,s.A)("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);var c=n(2125);let o=(0,s.A)("palette",[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]]);var d=n(12115),u=n(11701),f=n(22317),h=n(40980);let m={cockpit:{label:"Cockpit",bg:"#111111",fg:"#e8e8e8",cursor:"#e8e8e8",selection:"rgba(255, 255, 255, 0.15)"},dark:{label:"Dark",bg:"#1e1e1e",fg:"#d4d4d4",cursor:"#aeafad",selection:"rgba(86, 156, 214, 0.3)"},dracula:{label:"Dracula",bg:"#282a36",fg:"#f8f8f2",cursor:"#f8f8f2",selection:"rgba(68, 71, 90, 0.5)"},catppuccin:{label:"Catppuccin",bg:"#1e1e2e",fg:"#cdd6f4",cursor:"#f5e0dc",selection:"rgba(88, 91, 112, 0.4)"},tokyoNight:{label:"Tokyo Night",bg:"#1a1b26",fg:"#a9b1d6",cursor:"#c0caf5",selection:"rgba(41, 46, 66, 0.5)"},nord:{label:"Nord",bg:"#2e3440",fg:"#d8dee9",cursor:"#d8dee9",selection:"rgba(67, 76, 94, 0.5)"},gruvbox:{label:"Gruvbox",bg:"#282828",fg:"#ebdbb2",cursor:"#ebdbb2",selection:"rgba(168, 153, 132, 0.3)"},solarized:{label:"Solarized",bg:"#002b36",fg:"#839496",cursor:"#93a1a1",selection:"rgba(38, 139, 210, 0.3)"},monokai:{label:"Monokai",bg:"#272822",fg:"#f8f8f2",cursor:"#f8f8f0",selection:"rgba(73, 72, 62, 0.5)"},oneDark:{label:"One Dark",bg:"#282c34",fg:"#abb2bf",cursor:"#528bff",selection:"rgba(62, 68, 81, 0.5)"}},x=new Map;function p(e){let t=x.get(e);t&&(t.term.dispose(),t.wrapper.remove(),x.delete(e))}let b=[{label:"Esc",data:"\x1b"},{label:"Ctrl",modifier:!0},{label:"Tab",data:" "},{label:"|",data:"|",separator:!0},{label:"←",data:"\x1b[D"},{label:"↑",data:"\x1b[A"},{label:"↓",data:"\x1b[B"},{label:"→",data:"\x1b[C"}];function g({terminalId:e,cwd:t,active:n=!0}){let[l,a]=(0,d.useState)(e),[s,i]=(0,d.useState)(0),[c,o]=(0,d.useState)(!1),u=(0,d.useCallback)(async()=>{o(!0);try{let e=await fetch("/api/terminal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:t})});if(!e.ok)return;let{terminalId:n}=await e.json();a(n),i(e=>e+1)}finally{o(!1)}},[t]);return(0,r.jsx)(j,{terminalId:l,cwd:t,active:n,onReconnect:u,reconnecting:c},`${l}-${s}`)}function j({terminalId:e,cwd:t,active:s=!0,onReconnect:p,reconnecting:g}){let y=(0,d.useRef)(null),w=(0,d.useRef)(null),v=(0,d.useRef)(null),k=(0,d.useRef)(null),[N,C]=(0,d.useState)(null),[S,T]=(0,d.useState)(!1),I=(0,d.useRef)(!1),E=(0,d.useRef)(s);E.current=s;let P=(0,u.G)(),A=(0,d.useRef)(0),M=(0,d.useRef)(void 0),F=(0,d.useRef)(void 0),R=(0,d.useRef)(!1),[D,O]=(0,d.useState)(!1),z=(0,d.useRef)(0),[$,L]=(0,d.useState)(!1),{settings:_,updateSetting:U}=(0,f.t)();(0,d.useEffect)(()=>{let e=window.visualViewport,t=()=>e?e.height:window.innerHeight;z.current=Math.max(z.current,t());let n=()=>{let e=t();z.current=Math.max(z.current,e),O(e<.75*z.current),E.current&&v.current&&v.current.fit()},r=e??window;return r.addEventListener("resize",n),()=>r.removeEventListener("resize",n)},[]),(0,d.useEffect)(()=>{s&&v.current&&v.current.fit()},[s]),(0,d.useEffect)(()=>{let e=w.current;if(!e)return;let t=m[_.terminalTheme]??m.dark;e.options.theme={background:t.bg,foreground:t.fg,cursor:t.cursor,selectionBackground:t.selection},y.current&&(y.current.parentElement.style.backgroundColor=t.bg)},[_.terminalTheme]),(0,d.useEffect)(()=>{let e=w.current;e&&(e.options.fontSize=_.terminalFontSize,v.current?.fit())},[_.terminalFontSize]),(0,d.useEffect)(()=>{let e=w.current;e&&(e.options.scrollback=_.terminalScrollback)},[_.terminalScrollback]),(0,d.useEffect)(()=>{let t=!1,r=null,l=null,a=[];function s(e){let t=k.current;t?.readyState===WebSocket.OPEN&&t.send(e)}async function i(){k.current&&(k.current.onclose=null,k.current.close(),k.current=null);try{let n=await fetch("/api/auth/ws-token");if(!n.ok||t)return;let{token:l}=await n.json();if(t)return;let a=R.current?"0":"1",s="https:"===window.location.protocol?"wss:":"ws:",c=`${s}//${window.location.host}/ws/terminal?token=${l}&terminalId=${e}&replay=${a}`,o=new WebSocket(c);k.current=o,o.onopen=()=>{A.current=0,C(null),R.current=!0,r&&r.cols>1&&r.rows>1&&o.send(`\x01R${r.cols};${r.rows}`)},o.onmessage=e=>{r?.write(e.data)},o.onclose=n=>{if(k.current=null,t)return;if(1008===n.code){x.delete(e),C("Terminal disconnected");return}let r=Math.min(1e3*2**A.current,1e4);A.current++,M.current=setTimeout(()=>{t||i()},r)},o.onerror=()=>{}}catch{if(t)return;let e=Math.min(1e3*2**A.current,1e4);A.current++,M.current=setTimeout(()=>{t||i()},e)}}function c(){"visible"!==document.visibilityState||t||k.current&&k.current.readyState===WebSocket.OPEN||(clearTimeout(M.current),A.current=0,i())}return async function(){let c=y.current;if(!c||t)return;let o=x.get(e);if(o){r=o.term,l=o.fit,w.current=r,v.current=l,R.current=!0,c.appendChild(o.wrapper);let e=m[_.terminalTheme]??m.dark;r.options.theme={background:e.bg,foreground:e.fg,cursor:e.cursor,selectionBackground:e.selection},r.options.fontSize=_.terminalFontSize,r.options.scrollback=_.terminalScrollback,l.fit()}else{let[{Terminal:a},{FitAddon:s}]=await Promise.all([n.e(23888).then(n.bind(n,8422)),n.e(63606).then(n.bind(n,63606))]);if(t)return;let i=m[_.terminalTheme]??m.dark;w.current=r=new a({cursorBlink:!0,fontSize:_.terminalFontSize,scrollback:_.terminalScrollback,fontFamily:"'Menlo', 'Consolas', 'DejaVu Sans Mono', 'Courier New', 'Symbols Nerd Font Mono', monospace",theme:{background:i.bg,foreground:i.fg,cursor:i.cursor,selectionBackground:i.selection}}),v.current=l=new s,r.loadAddon(l);let o=document.createElement("div");o.style.width="100%",o.style.height="100%",c.appendChild(o),r.open(o),l.fit(),x.set(e,{term:r,fit:l,wrapper:o})}a.push(r.onData(e=>{if(I.current&&1===e.length){let t=e.toUpperCase().charCodeAt(0);if(t>=64&&t<96){s(String.fromCharCode(t-64)),I.current=!1,T(!1);return}}s(e)})),a.push(r.onResize(({cols:e,rows:t})=>{e<2||t<2||E.current&&(clearTimeout(F.current),F.current=setTimeout(()=>{if(!E.current)return;let n=k.current;n?.readyState===WebSocket.OPEN&&n.send(`\x01R${e};${t}`)},150))}));let d=0,u=0;c.addEventListener("touchstart",e=>{d=e.touches[0].clientY,u=0},{passive:!0}),c.addEventListener("touchmove",e=>{let t=d-e.touches[0].clientY;d=e.touches[0].clientY;let n=Math.trunc((u+=t)/8);0!==n&&(u-=8*n,r?.scrollLines(n))},{passive:!0}),i()}(),document.addEventListener("visibilitychange",c),()=>{for(let e of(t=!0,a))e.dispose();clearTimeout(M.current),clearTimeout(F.current),document.removeEventListener("visibilitychange",c),k.current&&(k.current.onclose=null,k.current.close(),k.current=null),w.current=null,v.current=null}},[e]);let W=(0,d.useCallback)(e=>{let t=k.current;t?.readyState===WebSocket.OPEN&&t.send(e)},[]),G=(0,d.useCallback)(e=>{if("modifier"in e&&e.modifier){let e=!I.current;I.current=e,T(e);return}"data"in e&&W(e.data)},[W]);if(N)return(0,r.jsxs)("div",{className:"flex-1 min-h-0 flex flex-col items-center justify-center gap-3 text-sm text-muted-foreground",children:[(0,r.jsx)("span",{children:N}),(0,r.jsx)("button",{type:"button",onClick:p,disabled:g,className:"px-3 py-1.5 text-xs font-medium rounded-md bg-muted hover:bg-muted/80 transition-colors disabled:opacity-50",children:g?"Reconnecting...":"Reconnect"})]});let B=m[_.terminalTheme]??m.dark;return(0,r.jsxs)("div",{className:"flex flex-col flex-1 min-h-0",style:{backgroundColor:B.bg},children:[(0,r.jsxs)("div",{className:"flex-1 min-h-0 relative overflow-hidden",children:[(0,r.jsx)("div",{ref:y,className:"absolute inset-0 px-3 pt-2"}),(0,r.jsx)("button",{type:"button",onClick:()=>L(!0),className:"absolute top-2 right-2 z-10 rounded p-1.5 text-white/70 hover:text-white hover:bg-white/10 transition-colors",children:(0,r.jsx)(l.A,{className:"h-4.5 w-4.5"})})]}),!P&&D&&(0,r.jsxs)("div",{className:"shrink-0 relative z-10 flex items-center gap-1.5 px-2 py-1.5 border-t border-border/50",style:{backgroundColor:B.bg},children:[(0,r.jsx)("div",{role:"button",tabIndex:-1,onPointerDown:e=>{e.preventDefault(),L(!0)},className:"px-2 py-1.5 text-xs font-medium rounded-md transition-colors select-none bg-muted text-muted-foreground active:bg-primary active:text-primary-foreground",children:(0,r.jsx)(l.A,{className:"h-3.5 w-3.5"})}),(0,r.jsx)("div",{className:"w-px h-5 bg-border/50"}),b.map(e=>(0,r.jsxs)("div",{className:"flex items-center gap-1.5",children:["separator"in e&&e.separator&&(0,r.jsx)("div",{className:"w-px h-5 bg-border/50"}),(0,r.jsx)("div",{role:"button",tabIndex:-1,onPointerDown:t=>{t.preventDefault(),G(e)},className:(0,h.cn)("px-3 py-1.5 text-xs font-medium rounded-md transition-colors select-none","active:bg-primary active:text-primary-foreground","modifier"in e&&e.modifier&&S?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground"),children:e.label})]},e.label))]}),$&&(0,r.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onMouseDown:e=>{e.target===e.currentTarget&&L(!1)},children:(0,r.jsxs)("div",{className:"w-full max-w-md mx-4 rounded-lg border bg-background shadow-lg overflow-hidden flex flex-col max-h-[85vh]",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-5 py-3 border-b shrink-0",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(l.A,{className:"h-4 w-4"}),(0,r.jsx)("h2",{className:"text-sm font-semibold",children:"Terminal settings"})]}),(0,r.jsx)("button",{onClick:()=>L(!1),className:"rounded p-1 text-muted-foreground hover:text-foreground hover:bg-muted",children:(0,r.jsx)(a.A,{className:"h-4 w-4"})})]}),(0,r.jsxs)("div",{className:"p-4 space-y-5 overflow-y-auto",children:[(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)("div",{className:"flex items-center gap-2",children:(0,r.jsx)("span",{className:"text-xs font-medium text-foreground",children:"Font size"})}),(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("button",{onClick:()=>U("terminalFontSize",Math.max(1,_.terminalFontSize-1)),className:"rounded p-1.5 border border-input hover:bg-muted transition-colors",children:(0,r.jsx)(i,{className:"h-3.5 w-3.5"})}),(0,r.jsx)("span",{className:"text-sm font-mono w-8 text-center",children:_.terminalFontSize}),(0,r.jsx)("button",{onClick:()=>U("terminalFontSize",Math.min(32,_.terminalFontSize+1)),className:"rounded p-1.5 border border-input hover:bg-muted transition-colors",children:(0,r.jsx)(c.A,{className:"h-3.5 w-3.5"})})]})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)("span",{className:"text-xs font-medium text-foreground",children:"Scrollback lines"}),(0,r.jsx)("div",{className:"flex items-center gap-2",children:[500,1e3,5e3,1e4].map(e=>(0,r.jsx)("button",{onClick:()=>U("terminalScrollback",e),className:(0,h.cn)("rounded-md border px-3 py-1.5 text-xs transition-colors",_.terminalScrollback===e?"border-primary bg-primary/10 text-foreground":"border-input hover:bg-muted text-muted-foreground"),children:e>=1e3?`${e/1e3}k`:e},e))})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(o,{className:"h-3.5 w-3.5 text-muted-foreground"}),(0,r.jsx)("span",{className:"text-xs font-medium text-foreground",children:"Theme"})]}),(0,r.jsx)("div",{className:"grid grid-cols-2 gap-2",children:Object.entries(m).map(([e,t])=>(0,r.jsxs)("button",{onClick:()=>U("terminalTheme",e),className:(0,h.cn)("flex items-center gap-2 rounded-md border px-3 py-2 text-xs transition-colors",_.terminalTheme===e?"border-primary bg-primary/10 text-foreground":"border-input hover:bg-muted text-muted-foreground"),children:[(0,r.jsx)("div",{className:"h-4 w-4 rounded-sm border border-border/50",style:{backgroundColor:t.bg}}),t.label]},e))})]})]})]})})]})}},41112:(e,t,n)=>{"use strict";function r({reason:e,children:t}){return t}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"BailoutToCSR",{enumerable:!0,get:function(){return r}}),n(1980)},58309:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});let r=(0,n(99537).A)("list",[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]])},64054:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={bindSnapshot:function(){return c},createAsyncLocalStorage:function(){return i},createSnapshot:function(){return o}};for(var r in n)Object.defineProperty(t,r,{enumerable:!0,get:n[r]});let l=Object.defineProperty(Error("Invariant: AsyncLocalStorage accessed in runtime where it is not available"),"__NEXT_ERROR_CODE",{value:"E504",enumerable:!1,configurable:!0});class a{disable(){throw l}getStore(){}run(){throw l}exit(){throw l}enterWith(){throw l}static bind(e){return e}}let s="u">typeof globalThis&&globalThis.AsyncLocalStorage;function i(){return s?new s:new a}function c(e){return s?s.bind(e):a.bind(e)}function o(){return s?s.snapshot():function(e,...t){return e(...t)}}},68635:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return c}});let r=n(95155),l=n(12115),a=n(41112);function s(e){return{default:e&&"default"in e?e.default:e}}n(21957);let i={loader:()=>Promise.resolve(s(()=>null)),loading:null,ssr:!0},c=function(e){let t={...i,...e},n=(0,l.lazy)(()=>t.loader().then(s)),c=t.loading;function o(e){let s=c?(0,r.jsx)(c,{isLoading:!0,pastDelay:!0,error:null}):null,i=!t.ssr||!!t.loading,o=i?l.Suspense:l.Fragment,d=t.ssr?(0,r.jsxs)(r.Fragment,{children:[null,(0,r.jsx)(n,{...e})]}):(0,r.jsx)(a.BailoutToCSR,{reason:"next/dynamic",children:(0,r.jsx)(n,{...e})});return(0,r.jsx)(o,{...i?{fallback:s}:{},children:d})}return o.displayName="LoadableComponent",o}},75707:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return l}});let r=n(73623)._(n(68635));function l(e,t){let n={};"function"==typeof e&&(n.loader=e);let l={...n,...t};return(0,r.default)({...l,modules:l.loadableGenerated?.modules})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},89419:(e,t,n)=>{Promise.resolve().then(n.bind(n,23668))},94088:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});let r=(0,n(99537).A)("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]])}},e=>{e.O(0,[989,14371,1550,28441,93794,77358],()=>e(e.s=89419)),_N_E=e.O()}]);
|