@jlongo78/agent-spaces 0.9.8 → 0.9.10
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/standalone/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/app-path-routes-manifest.json +3 -0
- package/.next/standalone/.next/build-manifest.json +2 -2
- package/.next/standalone/.next/prerender-manifest.json +3 -3
- package/.next/standalone/.next/routes-manifest.json +23 -0
- package/.next/standalone/.next/server/app/(desktop)/admin/analytics/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/(desktop)/admin/analytics/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/(desktop)/admin/users/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/(desktop)/analytics/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/(desktop)/cortex/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/(desktop)/network/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/(desktop)/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/(desktop)/projects/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/(desktop)/sessions/[id]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/(desktop)/sessions/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/(desktop)/settings/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/(desktop)/terminal/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/(desktop)/terminal/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/(desktop)/terminal/pane/[id]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/(desktop)/terminal/remote/[nodeId]/[workspaceId]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/(desktop)/workspaces/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_global-error.html +2 -2
- package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_not-found.html +1 -1
- package/.next/standalone/.next/server/app/_not-found.rsc +2 -2
- package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/admin/analytics.html +1 -1
- package/.next/standalone/.next/server/app/admin/analytics.rsc +3 -3
- package/.next/standalone/.next/server/app/admin/analytics.segments/!KGRlc2t0b3Ap/admin/analytics/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/admin/analytics.segments/!KGRlc2t0b3Ap/admin/analytics.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/admin/analytics.segments/!KGRlc2t0b3Ap/admin.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/admin/analytics.segments/!KGRlc2t0b3Ap.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/admin/analytics.segments/_full.segment.rsc +3 -3
- package/.next/standalone/.next/server/app/admin/analytics.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/admin/analytics.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/admin/analytics.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/admin/users.html +1 -1
- package/.next/standalone/.next/server/app/admin/users.rsc +2 -2
- package/.next/standalone/.next/server/app/admin/users.segments/!KGRlc2t0b3Ap/admin/users/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/admin/users.segments/!KGRlc2t0b3Ap/admin/users.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/admin/users.segments/!KGRlc2t0b3Ap/admin.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/admin/users.segments/!KGRlc2t0b3Ap.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/admin/users.segments/_full.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/admin/users.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/admin/users.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/admin/users.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/analytics.html +1 -1
- package/.next/standalone/.next/server/app/analytics.rsc +2 -2
- package/.next/standalone/.next/server/app/analytics.segments/!KGRlc2t0b3Ap/analytics/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/analytics.segments/!KGRlc2t0b3Ap/analytics.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/analytics.segments/!KGRlc2t0b3Ap.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/analytics.segments/_full.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/analytics.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/analytics.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/analytics.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/api/chat/route.js +1 -1
- package/.next/standalone/.next/server/app/api/chat/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/claude/usage/route/app-paths-manifest.json +3 -0
- package/.next/standalone/.next/server/app/api/claude/usage/route/build-manifest.json +11 -0
- package/.next/standalone/.next/server/app/api/claude/usage/route/server-reference-manifest.json +4 -0
- package/.next/standalone/.next/server/app/api/claude/usage/route.js +8 -0
- package/.next/standalone/.next/server/app/api/claude/usage/route.js.map +5 -0
- package/.next/standalone/.next/server/app/api/claude/usage/route.js.nft.json +1 -0
- package/.next/standalone/.next/server/app/api/claude/usage/route_client-reference-manifest.js +2 -0
- package/.next/standalone/.next/server/app/api/cortex/status/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/sessions/[id]/chat/route.js +1 -1
- package/.next/standalone/.next/server/app/api/sessions/[id]/chat/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/whisper/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/workspaces/[id]/todos/[todoId]/route/app-paths-manifest.json +3 -0
- package/.next/standalone/.next/server/app/api/workspaces/[id]/todos/[todoId]/route/build-manifest.json +11 -0
- package/.next/standalone/.next/server/app/api/workspaces/[id]/todos/[todoId]/route/server-reference-manifest.json +4 -0
- package/.next/standalone/.next/server/app/api/workspaces/[id]/todos/[todoId]/route.js +8 -0
- package/.next/standalone/.next/server/app/api/workspaces/[id]/todos/[todoId]/route.js.map +5 -0
- package/.next/standalone/.next/server/app/api/workspaces/[id]/todos/[todoId]/route.js.nft.json +1 -0
- package/.next/standalone/.next/server/app/api/workspaces/[id]/todos/[todoId]/route_client-reference-manifest.js +2 -0
- package/.next/standalone/.next/server/app/api/workspaces/[id]/todos/route/app-paths-manifest.json +3 -0
- package/.next/standalone/.next/server/app/api/workspaces/[id]/todos/route/build-manifest.json +11 -0
- package/.next/standalone/.next/server/app/api/workspaces/[id]/todos/route/server-reference-manifest.json +4 -0
- package/.next/standalone/.next/server/app/api/workspaces/[id]/todos/route.js +8 -0
- package/.next/standalone/.next/server/app/api/workspaces/[id]/todos/route.js.map +5 -0
- package/.next/standalone/.next/server/app/api/workspaces/[id]/todos/route.js.nft.json +1 -0
- package/.next/standalone/.next/server/app/api/workspaces/[id]/todos/route_client-reference-manifest.js +2 -0
- package/.next/standalone/.next/server/app/cortex.html +1 -1
- package/.next/standalone/.next/server/app/cortex.rsc +2 -2
- package/.next/standalone/.next/server/app/cortex.segments/!KGRlc2t0b3Ap/cortex/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/cortex.segments/!KGRlc2t0b3Ap/cortex.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/cortex.segments/!KGRlc2t0b3Ap.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/cortex.segments/_full.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/cortex.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/cortex.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/cortex.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/login.html +1 -1
- package/.next/standalone/.next/server/app/login.rsc +2 -2
- package/.next/standalone/.next/server/app/login.segments/_full.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/login.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/login.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/login.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/login.segments/login/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/login.segments/login.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/m/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/m/projects/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/m/projects.html +1 -1
- package/.next/standalone/.next/server/app/m/projects.rsc +2 -2
- package/.next/standalone/.next/server/app/m/projects.segments/_full.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/m/projects.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/m/projects.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/m/projects.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/m/projects.segments/m/projects/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/m/projects.segments/m/projects.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/m/projects.segments/m.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/m/sessions/[id]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/m/sessions/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/m/sessions.html +1 -1
- package/.next/standalone/.next/server/app/m/sessions.rsc +2 -2
- package/.next/standalone/.next/server/app/m/sessions.segments/_full.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/m/sessions.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/m/sessions.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/m/sessions.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/m/sessions.segments/m/sessions/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/m/sessions.segments/m/sessions.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/m/sessions.segments/m.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/m/settings/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/m/settings.html +1 -1
- package/.next/standalone/.next/server/app/m/settings.rsc +2 -2
- package/.next/standalone/.next/server/app/m/settings.segments/_full.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/m/settings.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/m/settings.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/m/settings.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/m/settings.segments/m/settings/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/m/settings.segments/m/settings.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/m/settings.segments/m.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/m/terminal/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/m/terminal.html +1 -1
- package/.next/standalone/.next/server/app/m/terminal.rsc +2 -2
- package/.next/standalone/.next/server/app/m/terminal.segments/_full.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/m/terminal.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/m/terminal.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/m/terminal.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/m/terminal.segments/m/terminal/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/m/terminal.segments/m/terminal.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/m/terminal.segments/m.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/m.html +1 -1
- package/.next/standalone/.next/server/app/m.rsc +2 -2
- package/.next/standalone/.next/server/app/m.segments/_full.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/m.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/m.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/m.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/m.segments/m/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/m.segments/m.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/network.html +1 -1
- package/.next/standalone/.next/server/app/network.rsc +2 -2
- package/.next/standalone/.next/server/app/network.segments/!KGRlc2t0b3Ap/network/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/network.segments/!KGRlc2t0b3Ap/network.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/network.segments/!KGRlc2t0b3Ap.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/network.segments/_full.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/network.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/network.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/network.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/projects.html +1 -1
- package/.next/standalone/.next/server/app/projects.rsc +2 -2
- package/.next/standalone/.next/server/app/projects.segments/!KGRlc2t0b3Ap/projects/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/projects.segments/!KGRlc2t0b3Ap/projects.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/projects.segments/!KGRlc2t0b3Ap.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/projects.segments/_full.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/projects.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/projects.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/projects.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/sessions.html +1 -1
- package/.next/standalone/.next/server/app/sessions.rsc +2 -2
- package/.next/standalone/.next/server/app/sessions.segments/!KGRlc2t0b3Ap/sessions/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/sessions.segments/!KGRlc2t0b3Ap/sessions.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/sessions.segments/!KGRlc2t0b3Ap.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/sessions.segments/_full.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/sessions.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/sessions.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/sessions.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/settings.html +1 -1
- package/.next/standalone/.next/server/app/settings.rsc +3 -3
- package/.next/standalone/.next/server/app/settings.segments/!KGRlc2t0b3Ap/settings/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/settings.segments/!KGRlc2t0b3Ap/settings.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/settings.segments/!KGRlc2t0b3Ap.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/settings.segments/_full.segment.rsc +3 -3
- package/.next/standalone/.next/server/app/settings.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/settings.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/settings.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/terminal.html +1 -1
- package/.next/standalone/.next/server/app/terminal.rsc +3 -3
- package/.next/standalone/.next/server/app/terminal.segments/!KGRlc2t0b3Ap/terminal/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/terminal.segments/!KGRlc2t0b3Ap/terminal.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/terminal.segments/!KGRlc2t0b3Ap.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/terminal.segments/_full.segment.rsc +3 -3
- package/.next/standalone/.next/server/app/terminal.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/terminal.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/terminal.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/vr/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/vr.html +1 -1
- package/.next/standalone/.next/server/app/vr.rsc +2 -2
- package/.next/standalone/.next/server/app/vr.segments/_full.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/vr.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/vr.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/vr.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/vr.segments/vr/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/vr.segments/vr.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/workspaces.html +1 -1
- package/.next/standalone/.next/server/app/workspaces.rsc +2 -2
- package/.next/standalone/.next/server/app/workspaces.segments/!KGRlc2t0b3Ap/workspaces/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/workspaces.segments/!KGRlc2t0b3Ap/workspaces.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/workspaces.segments/!KGRlc2t0b3Ap.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/workspaces.segments/_full.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/workspaces.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/workspaces.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/workspaces.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app-paths-manifest.json +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__00e90fc6._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__01ab8675._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__03974f05._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__046c9b91._.js +16 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__04ae6bf0._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__056fa416._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0ac4ea3f._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0b8e64cb._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0facd39e._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__10bc76a3._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__115f3934._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__11f155f1._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__160e7c73._.js +52 -24
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__17a3b966._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__17d3a2b2._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1a86c055._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__1fe0f452._.js +127 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__20b5e9c4._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__28d6fbd8._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__2a3f866b._.js +16 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__316617e7._.js +3 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__32ad8f71._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__35457394._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__35de78e6._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__3685ffcb._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__38954988._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__3a32b624._.js +111 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__426ad936._.js +17 -4
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__4985c034._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__5c6ce9ed._.js +16 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__5cebe58a._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__5d5e4789._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__65676930._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__67cab326._.js +2 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__698c6f01._.js +16 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__6c64af29._.js +22 -9
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__73aed9f5._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__79b6a9bb._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__7db704c6._.js +17 -4
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__812ca02b._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__821f50fa._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__8716b86e._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__884ef754._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__88cdbd68._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__89d9aba9._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__8c2e1260._.js +111 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__8d536cb5._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__8df8c5d1._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__8f2ccc41._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__95c9d682._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__9e5d7774._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__9edcff87._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__a049dfc2._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__a5b4bb9a._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__a83262a1._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__a9cd1240._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__a9d7f822._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__ad08c221._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__ad585f2f._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__afcb8f7d._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__bc250d43._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__bce2a6e7._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__bfcd7fd4._.js +13 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__c011bf91._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__c37d6380._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__cae392eb._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__cc2616bb._.js +16 -3
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__d501fa9b._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__d59c6c15._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__d5c1db32._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__dba60c86._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__de14b9ae._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__e10643d1._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__e3477417._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__e4db362e._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__e4e70b86._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__e54925af._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__e8cbeaca._.js +111 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__e8edc5b0._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__eab4d83b._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__f056fd83._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__f0e99572._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__fe1e16d0._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__ff9cd277._.js +15 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__ffaea2ce._.js +15 -2
- package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_claude_usage_route_actions_fe002ec1.js +3 -0
- package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_workspaces_[id]_todos_route_actions_0d4ffac5.js +3 -0
- package/.next/standalone/.next/server/chunks/ce889_server_app_api_workspaces_[id]_todos_[todoId]_route_actions_754fe6b9.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__66aca5d4._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{_17b946fd._.js → _20c2cf3a._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/_5f55bf8f._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/src_app_(desktop)_settings_page_tsx_f74824b3._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_app_(desktop)_terminal_page_tsx_de5e8d85._.js +1 -1
- package/.next/standalone/.next/server/edge/chunks/[root-of-the-server]__90eeddae._.js +1 -1
- package/.next/standalone/.next/server/edge/chunks/[root-of-the-server]__ca3f649e._.js +2 -2
- package/.next/standalone/.next/server/middleware-manifest.json +5 -5
- package/.next/standalone/.next/server/pages/404.html +1 -1
- package/.next/standalone/.next/server/pages/500.html +2 -2
- package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/static/chunks/14216197f9dcbe5b.css +3 -0
- package/.next/standalone/.next/static/chunks/{0852575eb90c1e8d.js → 4c9fb0a38f041a3d.js} +2 -2
- package/.next/standalone/.next/static/chunks/8f6f93ab45a5ff5b.js +1 -0
- package/.next/standalone/.next/static/chunks/{e62bb488d02db247.js → d2566c2dcf53fef3.js} +1 -1
- package/.next/standalone/.next/static/chunks/{7f6a14f1849fa94d.js → ff7d85dade44d1f3.js} +1 -1
- package/.next/standalone/bin/cortex-hook.js +8 -3
- package/.next/standalone/bin/cortex-learn-hook.js +7 -2
- package/.next/standalone/bin/scrub-standalone.js +89 -0
- package/.next/standalone/bin/terminal-server.js +44 -16
- package/.next/standalone/docs/features/claude-usage.md +105 -0
- package/.next/standalone/docs/features/workspace-todos.md +127 -0
- package/.next/standalone/docs/superpowers/plans/2026-04-21-workspace-todos.md +1097 -0
- package/.next/standalone/docs/superpowers/plans/2026-04-22-claude-usage-display.md +749 -0
- package/.next/standalone/docs/superpowers/specs/2026-04-21-workspace-todos-design.md +180 -0
- package/.next/standalone/docs/superpowers/specs/2026-04-22-claude-usage-display-design.md +183 -0
- package/.next/standalone/package-lock.json +2 -2
- package/.next/standalone/package.json +2 -2
- package/.next/standalone/src/app/(desktop)/settings/page.tsx +40 -1
- package/.next/standalone/src/app/(desktop)/terminal/page.tsx +54 -2
- package/.next/standalone/src/app/api/chat/route.ts +56 -53
- package/.next/standalone/src/app/api/claude/usage/route.ts +33 -0
- package/.next/standalone/src/app/api/config/route.ts +3 -0
- package/.next/standalone/src/app/api/sessions/[id]/chat/route.ts +2 -1
- package/.next/standalone/src/app/api/workspaces/[id]/todos/[todoId]/route.ts +55 -0
- package/.next/standalone/src/app/api/workspaces/[id]/todos/route.ts +43 -0
- package/.next/standalone/src/components/claude/claude-usage-strip.tsx +175 -0
- package/.next/standalone/src/components/workspace/workspace-todos.tsx +265 -0
- package/.next/standalone/src/hooks/use-claude-usage.ts +66 -0
- package/.next/standalone/src/lib/claude/credentials.ts +36 -0
- package/.next/standalone/src/lib/claude/usage.ts +69 -0
- package/.next/standalone/src/lib/config.ts +3 -0
- package/.next/standalone/src/lib/db/queries.ts +103 -1
- package/.next/standalone/src/lib/db/schema.ts +18 -0
- package/.next/standalone/src/lib/spawn-env.ts +32 -0
- package/.next/standalone/src/lib/terminal/server.ts +3 -3
- package/.next/standalone/src/middleware.ts +23 -5
- package/.next/standalone/src/types/claude.ts +39 -0
- package/.next/standalone/tests/db/workspace-todos.test.ts +156 -0
- package/bin/cortex-hook.js +8 -3
- package/bin/cortex-learn-hook.js +7 -2
- package/bin/scrub-standalone.js +89 -0
- package/bin/terminal-server.js +44 -16
- package/package.json +2 -2
- package/.next/standalone/.claude/settings.local.json +0 -68
- package/.next/standalone/.claude/spaces-env.json +0 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__e2a996e5._.js +0 -114
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__ead29015._.js +0 -13
- package/.next/standalone/.next/server/chunks/ssr/_3ba93bdd._.js +0 -3
- package/.next/standalone/.next/static/chunks/074df89a63b6a854.js +0 -1
- package/.next/standalone/.next/static/chunks/2b769d1597e4fc1c.css +0 -3
- package/.next/standalone/.spaces/cortex-context.md +0 -51
- package/.next/standalone/cortex-hook-debug.log +0 -57
- package/.next/standalone/docs/plans/2026-03-02-security-audit.md +0 -229
- /package/.next/standalone/.next/static/{u1pHON3drz1mBi7owkbBP → HNrWymrkgOP9Z4WIaYeOj}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{u1pHON3drz1mBi7owkbBP → HNrWymrkgOP9Z4WIaYeOj}/_clientMiddlewareManifest.json +0 -0
- /package/.next/standalone/.next/static/{u1pHON3drz1mBi7owkbBP → HNrWymrkgOP9Z4WIaYeOj}/_ssgManifest.js +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,609799,e=>{"use strict";let t,n,r;var a,i,s,l,o,c,d,u,p,h,x,f,m,g,b,v,y,w,j,z=e.i(843476),N=e.i(271645),k=e.i(107233),C=e.i(531278),S=e.i(868054),E=e.i(555436),D=e.i(686311),P=e.i(75505),M=e.i(503116),T=e.i(664659),R=e.i(463059),L=e.i(475254);let I=(0,L.default)("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);var O=e.i(727612),$=e.i(788699),A=e.i(643531),F=e.i(37727),B=e.i(174886),U=e.i(694351);let H=(0,L.default)("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"}]]),W=(0,L.default)("arrow-left-to-line",[["path",{d:"M3 19V5",key:"rwsyhb"}],["path",{d:"m13 6-6 6 6 6",key:"1yhaz7"}],["path",{d:"M7 12h14",key:"uoisry"}]]);var K=e.i(248256),G=e.i(63209),X=e.i(761911),q=e.i(455711),Y=e.i(398361);let J=(0,L.default)("wand-sparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);var V=e.i(618566),_=e.i(424134),Q=e.i(174080);let Z="u">typeof window&&void 0!==window.document&&void 0!==window.document.createElement;function ee(e){let t=Object.prototype.toString.call(e);return"[object Window]"===t||"[object global]"===t}function et(e){return"nodeType"in e}function en(e){var t,n;return e?ee(e)?e:et(e)&&null!=(t=null==(n=e.ownerDocument)?void 0:n.defaultView)?t:window:window}function er(e){let{Document:t}=en(e);return e instanceof t}function ea(e){return!ee(e)&&e instanceof en(e).HTMLElement}function ei(e){return e instanceof en(e).SVGElement}function es(e){return e?ee(e)?e.document:et(e)?er(e)?e:ea(e)||ei(e)?e.ownerDocument:document:document:document}let el=Z?N.useLayoutEffect:N.useEffect;function eo(e){let t=(0,N.useRef)(e);return el(()=>{t.current=e}),(0,N.useCallback)(function(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];return null==t.current?void 0:t.current(...n)},[])}function ec(e,t){void 0===t&&(t=[e]);let n=(0,N.useRef)(e);return el(()=>{n.current!==e&&(n.current=e)},t),n}function ed(e,t){let n=(0,N.useRef)();return(0,N.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function eu(e){let t=eo(e),n=(0,N.useRef)(null),r=(0,N.useCallback)(e=>{e!==n.current&&(null==t||t(e,n.current)),n.current=e},[]);return[n,r]}function ep(e){let t=(0,N.useRef)();return(0,N.useEffect)(()=>{t.current=e},[e]),t.current}let eh={};function ex(e,t){return(0,N.useMemo)(()=>{if(t)return t;let n=null==eh[e]?0:eh[e]+1;return eh[e]=n,e+"-"+n},[e,t])}function ef(e){return function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return r.reduce((t,n)=>{for(let[r,a]of Object.entries(n)){let n=t[r];null!=n&&(t[r]=n+e*a)}return t},{...t})}}let em=ef(1),eg=ef(-1);function eb(e){if(!e)return!1;let{KeyboardEvent:t}=en(e.target);return t&&e instanceof t}function ev(e){if(function(e){if(!e)return!1;let{TouchEvent:t}=en(e.target);return t&&e instanceof t}(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return"clientX"in e&&"clientY"in e?{x:e.clientX,y:e.clientY}:null}let ey=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[ey.Translate.toString(e),ey.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),ew="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]",ej={display:"none"};function ez(e){let{id:t,value:n}=e;return N.default.createElement("div",{id:t,style:ej},n)}function eN(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;return N.default.createElement("div",{id:t,style:{position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"},role:"status","aria-live":r,"aria-atomic":!0},n)}let ek=(0,N.createContext)(null),eC={draggable:"\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n "},eS={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function eE(e){var t;let n,{announcements:r=eS,container:a,hiddenTextDescribedById:i,screenReaderInstructions:s=eC}=e,{announce:l,announcement:o}=function(){let[e,t]=(0,N.useState)("");return{announce:(0,N.useCallback)(e=>{null!=e&&t(e)},[]),announcement:e}}(),c=ex("DndLiveRegion"),[d,u]=(0,N.useState)(!1);if((0,N.useEffect)(()=>{u(!0)},[]),t=(0,N.useMemo)(()=>({onDragStart(e){let{active:t}=e;l(r.onDragStart({active:t}))},onDragMove(e){let{active:t,over:n}=e;r.onDragMove&&l(r.onDragMove({active:t,over:n}))},onDragOver(e){let{active:t,over:n}=e;l(r.onDragOver({active:t,over:n}))},onDragEnd(e){let{active:t,over:n}=e;l(r.onDragEnd({active:t,over:n}))},onDragCancel(e){let{active:t,over:n}=e;l(r.onDragCancel({active:t,over:n}))}}),[l,r]),n=(0,N.useContext)(ek),(0,N.useEffect)(()=>{if(!n)throw Error("useDndMonitor must be used within a children of <DndContext>");return n(t)},[t,n]),!d)return null;let p=N.default.createElement(N.default.Fragment,null,N.default.createElement(ez,{id:i,value:s.draggable}),N.default.createElement(eN,{id:c,announcement:o}));return a?(0,Q.createPortal)(p,a):p}function eD(){}function eP(e,t){return(0,N.useMemo)(()=>({sensor:e,options:null!=t?t:{}}),[e,t])}(a=h||(h={})).DragStart="dragStart",a.DragMove="dragMove",a.DragEnd="dragEnd",a.DragCancel="dragCancel",a.DragOver="dragOver",a.RegisterDroppable="registerDroppable",a.SetDroppableDisabled="setDroppableDisabled",a.UnregisterDroppable="unregisterDroppable";let eM=Object.freeze({x:0,y:0});function eT(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function eR(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function eL(e,t,n){return void 0===t&&(t=e.left),void 0===n&&(n=e.top),{x:t+.5*e.width,y:n+.5*e.height}}let eI=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,a=eL(t,t.left,t.top),i=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){var s;let n=(s=eL(r),Math.sqrt(Math.pow(s.x-a.x,2)+Math.pow(s.y-a.y,2)));i.push({id:t,data:{droppableContainer:e,value:n}})}}return i.sort(eT)},eO=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,a=[];for(let e of r){let{id:r}=e,i=n.get(r);if(i){let n=function(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),a=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height);if(r<a&&n<i){let s=t.width*t.height,l=e.width*e.height,o=(a-r)*(i-n);return Number((o/(s+l-o)).toFixed(4))}return 0}(i,t);n>0&&a.push({id:r,data:{droppableContainer:e,value:n}})}}return a.sort(eR)};function e$(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:eM}let eA=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return n.reduce((e,t)=>({...e,top:e.top+ +t.y,bottom:e.bottom+ +t.y,left:e.left+ +t.x,right:e.right+ +t.x}),{...e})},eF={ignoreTransform:!1};function eB(e,t){void 0===t&&(t=eF);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=en(e).getComputedStyle(e);t&&(n=function(e,t,n){let r=function(e){if(e.startsWith("matrix3d(")){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}if(e.startsWith("matrix(")){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}(t);if(!r)return e;let{scaleX:a,scaleY:i,x:s,y:l}=r,o=e.left-s-(1-a)*parseFloat(n),c=e.top-l-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),d=a?e.width/a:e.width,u=i?e.height/i:e.height;return{width:d,height:u,top:c,right:o+d,bottom:c+u,left:o}}(n,t,r))}let{top:r,left:a,width:i,height:s,bottom:l,right:o}=n;return{top:r,left:a,width:i,height:s,bottom:l,right:o}}function eU(e){return eB(e,{ignoreTransform:!0})}function eH(e,t){let n=[];return e?function r(a){var i,s;let l;if(null!=t&&n.length>=t||!a)return n;if(er(a)&&null!=a.scrollingElement&&!n.includes(a.scrollingElement))return n.push(a.scrollingElement),n;if(!ea(a)||ei(a)||n.includes(a))return n;let o=en(e).getComputedStyle(a);return(a!==e&&(void 0===(i=o)&&(i=en(a).getComputedStyle(a)),l=/(auto|scroll|overlay)/,["overflow","overflowX","overflowY"].some(e=>{let t=i[e];return"string"==typeof t&&l.test(t)}))&&n.push(a),void 0===(s=o)&&(s=en(a).getComputedStyle(a)),"fixed"===s.position)?n:r(a.parentNode)}(e):n}function eW(e){let[t]=eH(e,1);return null!=t?t:null}function eK(e){return Z&&e?ee(e)?e:et(e)?er(e)||e===es(e).scrollingElement?window:ea(e)?e:null:null:null}function eG(e){return ee(e)?e.scrollX:e.scrollLeft}function eX(e){return ee(e)?e.scrollY:e.scrollTop}function eq(e){return{x:eG(e),y:eX(e)}}function eY(e){return!!Z&&!!e&&e===document.scrollingElement}function eJ(e){let t={x:0,y:0},n=eY(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},a=e.scrollTop<=t.y,i=e.scrollLeft<=t.x;return{isTop:a,isLeft:i,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}(i=x||(x={}))[i.Forward=1]="Forward",i[i.Backward=-1]="Backward";let eV={x:.2,y:.2};function e_(e){return e.reduce((e,t)=>em(e,eq(t)),eM)}let eQ=[["x",["left","right"],function(e){return e.reduce((e,t)=>e+eG(t),0)}],["y",["top","bottom"],function(e){return e.reduce((e,t)=>e+eX(t),0)}]];class eZ{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const n=eH(t),r=e_(n);for(const[t,a,i]of(this.rect={...e},this.width=e.width,this.height=e.height,eQ))for(const e of a)Object.defineProperty(this,e,{get:()=>{let a=i(n),s=r[t]-a;return this.rect[e]+s},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class e0{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>{var t;return null==(t=this.target)?void 0:t.removeEventListener(...e)})},this.target=e}add(e,t,n){var r;null==(r=this.target)||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}}function e1(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return"number"==typeof t?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t&&r>t.y}function e5(e){e.preventDefault()}function e2(e){e.stopPropagation()}(s=f||(f={})).Click="click",s.DragStart="dragstart",s.Keydown="keydown",s.ContextMenu="contextmenu",s.Resize="resize",s.SelectionChange="selectionchange",s.VisibilityChange="visibilitychange",(l=m||(m={})).Space="Space",l.Down="ArrowDown",l.Right="ArrowRight",l.Left="ArrowLeft",l.Up="ArrowUp",l.Esc="Escape",l.Enter="Enter",l.Tab="Tab";let e3={start:[m.Space,m.Enter],cancel:[m.Esc],end:[m.Space,m.Enter,m.Tab]},e4=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case m.Right:return{...n,x:n.x+25};case m.Left:return{...n,x:n.x-25};case m.Down:return{...n,y:n.y+25};case m.Up:return{...n,y:n.y-25}}};class e6{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:t}}=e;this.props=e,this.listeners=new e0(es(t)),this.windowListeners=new e0(en(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(f.Resize,this.handleCancel),this.windowListeners.add(f.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(f.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&function(e,t){if(void 0===t&&(t=eB),!e)return;let{top:n,left:r,bottom:a,right:i}=t(e);eW(e)&&(a<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}(n),t(eM)}handleKeyDown(e){if(eb(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:a=e3,coordinateGetter:i=e4,scrollBehavior:s="smooth"}=r,{code:l}=e;if(a.end.includes(l))return void this.handleEnd(e);if(a.cancel.includes(l))return void this.handleCancel(e);let{collisionRect:o}=n.current,c=o?{x:o.left,y:o.top}:eM;this.referenceCoordinates||(this.referenceCoordinates=c);let d=i(e,{active:t,context:n.current,currentCoordinates:c});if(d){let t=eg(d,c),r={x:0,y:0},{scrollableAncestors:a}=n.current;for(let n of a){let a=e.code,{isTop:i,isRight:l,isLeft:o,isBottom:c,maxScroll:u,minScroll:p}=eJ(n),h=function(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:a}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:a,width:e.clientWidth,height:e.clientHeight}}(n),x={x:Math.min(a===m.Right?h.right-h.width/2:h.right,Math.max(a===m.Right?h.left:h.left+h.width/2,d.x)),y:Math.min(a===m.Down?h.bottom-h.height/2:h.bottom,Math.max(a===m.Down?h.top:h.top+h.height/2,d.y))},f=a===m.Right&&!l||a===m.Left&&!o,g=a===m.Down&&!c||a===m.Up&&!i;if(f&&x.x!==d.x){let e=n.scrollLeft+t.x,i=a===m.Right&&e<=u.x||a===m.Left&&e>=p.x;if(i&&!t.y)return void n.scrollTo({left:e,behavior:s});i?r.x=n.scrollLeft-e:r.x=a===m.Right?n.scrollLeft-u.x:n.scrollLeft-p.x,r.x&&n.scrollBy({left:-r.x,behavior:s});break}if(g&&x.y!==d.y){let e=n.scrollTop+t.y,i=a===m.Down&&e<=u.y||a===m.Up&&e>=p.y;if(i&&!t.x)return void n.scrollTo({top:e,behavior:s});i?r.y=n.scrollTop-e:r.y=a===m.Down?n.scrollTop-u.y:n.scrollTop-p.y,r.y&&n.scrollBy({top:-r.y,behavior:s});break}}this.handleMove(e,em(eg(d,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}function e8(e){return!!(e&&"distance"in e)}function e7(e){return!!(e&&"delay"in e)}e6.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=e3,onActivation:a}=t,{active:i}=n,{code:s}=e.nativeEvent;if(r.start.includes(s)){let t=i.activatorNode.current;return(!t||e.target===t)&&(e.preventDefault(),null==a||a({event:e.nativeEvent}),!0)}return!1}}];class e9{constructor(e,t,n){var r;void 0===n&&(n=function(e){let{EventTarget:t}=en(e);return e instanceof t?e:es(e)}(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;const{event:a}=e,{target:i}=a;this.props=e,this.events=t,this.document=es(i),this.documentListeners=new e0(this.document),this.listeners=new e0(n),this.windowListeners=new e0(en(i)),this.initialCoordinates=null!=(r=ev(a))?r:eM,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(f.Resize,this.handleCancel),this.windowListeners.add(f.DragStart,e5),this.windowListeners.add(f.VisibilityChange,this.handleCancel),this.windowListeners.add(f.ContextMenu,e5),this.documentListeners.add(f.Keydown,this.handleKeydown),t){if(null!=n&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(e7(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(e8(t))return void this.handlePending(t)}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(f.Click,e2,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(f.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){var t;let{activated:n,initialCoordinates:r,props:a}=this,{onMove:i,options:{activationConstraint:s}}=a;if(!r)return;let l=null!=(t=ev(e))?t:eM,o=eg(r,l);if(!n&&s){if(e8(s)){if(null!=s.tolerance&&e1(o,s.tolerance))return this.handleCancel();if(e1(o,s.distance))return this.handleStart()}return e7(s)&&e1(o,s.tolerance)?this.handleCancel():void this.handlePending(s,o)}e.cancelable&&e.preventDefault(),i(l)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===m.Esc&&this.handleCancel()}removeTextSelection(){var e;null==(e=this.document.getSelection())||e.removeAllRanges()}}let te={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class tt extends e9{constructor(e){const{event:t}=e;super(e,te,es(t.target))}}tt.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!!n.isPrimary&&0===n.button&&(null==r||r({event:n}),!0)}}];(o=g||(g={}))[o.RightClick=2]="RightClick";(c=b||(b={}))[c.Pointer=0]="Pointer",c[c.DraggableRect=1]="DraggableRect",(d=v||(v={}))[d.TreeOrder=0]="TreeOrder",d[d.ReversedTreeOrder=1]="ReversedTreeOrder";let tn={x:{[x.Backward]:!1,[x.Forward]:!1},y:{[x.Backward]:!1,[x.Forward]:!1}};(u=y||(y={}))[u.Always=0]="Always",u[u.BeforeDragging=1]="BeforeDragging",u[u.WhileDragging=2]="WhileDragging",(w||(w={})).Optimized="optimized";let tr=new Map;function ta(e,t){return ed(n=>e?n||("function"==typeof t?t(e):e):null,[t,e])}function ti(e){let{callback:t,disabled:n}=e,r=eo(t),a=(0,N.useMemo)(()=>{if(n||"u"<typeof window||void 0===window.ResizeObserver)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,N.useEffect)(()=>()=>null==a?void 0:a.disconnect(),[a]),a}function ts(e){return new eZ(eB(e),e)}function tl(e,t,n){void 0===t&&(t=ts);let[r,a]=(0,N.useState)(null);function i(){a(r=>{if(!e)return null;if(!1===e.isConnected){var a;return null!=(a=null!=r?r:n)?a:null}let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let s=function(e){let{callback:t,disabled:n}=e,r=eo(t),a=(0,N.useMemo)(()=>{if(n||"u"<typeof window||void 0===window.MutationObserver)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,N.useEffect)(()=>()=>null==a?void 0:a.disconnect(),[a]),a}({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if("childList"===t&&r instanceof HTMLElement&&r.contains(e)){i();break}}}}),l=ti({callback:i});return el(()=>{i(),e?(null==l||l.observe(e),null==s||s.observe(document.body,{childList:!0,subtree:!0})):(null==l||l.disconnect(),null==s||s.disconnect())},[e]),r}let to=[];function tc(e,t){void 0===t&&(t=[]);let n=(0,N.useRef)(null);return(0,N.useEffect)(()=>{n.current=null},t),(0,N.useEffect)(()=>{let t=e!==eM;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?eg(e,n.current):eM}function td(e){return(0,N.useMemo)(()=>{let t,n;return e?(t=e.innerWidth,{top:0,left:0,right:t,bottom:n=e.innerHeight,width:t,height:n}):null},[e])}let tu=[],tp=[{sensor:tt,options:{}},{sensor:e6,options:{}}],th={current:{}},tx={draggable:{measure:eU},droppable:{measure:eU,strategy:y.WhileDragging,frequency:w.Optimized},dragOverlay:{measure:eB}};class tf extends Map{get(e){var t;return null!=e&&null!=(t=super.get(e))?t:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){var t,n;return null!=(t=null==(n=this.get(e))?void 0:n.node.current)?t:void 0}}let tm={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new tf,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:eD},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:tx,measureDroppableContainers:eD,windowRect:null,measuringScheduled:!1},tg={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:eD,draggableNodes:new Map,over:null,measureDroppableContainers:eD},tb=(0,N.createContext)(tg),tv=(0,N.createContext)(tm);function ty(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new tf}}}function tw(e,t){switch(t.type){case h.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case h.DragMove:if(null==e.draggable.active)return e;return{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case h.DragEnd:case h.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case h.RegisterDroppable:{let{element:n}=t,{id:r}=n,a=new tf(e.droppable.containers);return a.set(r,n),{...e,droppable:{...e.droppable,containers:a}}}case h.SetDroppableDisabled:{let{id:n,key:r,disabled:a}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let s=new tf(e.droppable.containers);return s.set(n,{...i,disabled:a}),{...e,droppable:{...e.droppable,containers:s}}}case h.UnregisterDroppable:{let{id:n,key:r}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let i=new tf(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function tj(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:a}=(0,N.useContext)(tb),i=ep(r),s=ep(null==n?void 0:n.id);return(0,N.useEffect)(()=>{if(!t&&!r&&i&&null!=s){if(!eb(i)||document.activeElement===i.target)return;let e=a.get(s);if(!e)return;let{activatorNode:t,node:n}=e;(t.current||n.current)&&requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=e.matches(ew)?e:e.querySelector(ew);if(t){t.focus();break}}})}},[r,t,a,s,i]),null}let tz=(0,N.createContext)({...eM,scaleX:1,scaleY:1});(p=j||(j={}))[p.Uninitialized=0]="Uninitialized",p[p.Initializing=1]="Initializing",p[p.Initialized=2]="Initialized";let tN=(0,N.memo)(function(e){var t,n,r,a,i,s,l,o;let c,d,u,p,f,m,g,w,{id:z,accessibility:k,autoScroll:C=!0,children:S,sensors:E=tp,collisionDetection:D=eO,measuring:P,modifiers:M,...T}=e,[R,L]=(0,N.useReducer)(tw,void 0,ty),[I,O]=function(){let[e]=(0,N.useState)(()=>new Set),t=(0,N.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,N.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>{var t;return null==(t=e[n])?void 0:t.call(e,r)})},[e]),t]}(),[$,A]=(0,N.useState)(j.Uninitialized),F=$===j.Initialized,{draggable:{active:B,nodes:U,translate:H},droppable:{containers:W}}=R,K=null!=B?U.get(B):null,G=(0,N.useRef)({initial:null,translated:null}),X=(0,N.useMemo)(()=>{var e;return null!=B?{id:B,data:null!=(e=null==K?void 0:K.data)?e:th,rect:G}:null},[B,K]),q=(0,N.useRef)(null),[Y,J]=(0,N.useState)(null),[V,_]=(0,N.useState)(null),ee=ec(T,Object.values(T)),et=ex("DndDescribedBy",z),er=(0,N.useMemo)(()=>W.getEnabled(),[W]),ei=(0,N.useMemo)(()=>({draggable:{...tx.draggable,...null==P?void 0:P.draggable},droppable:{...tx.droppable,...null==P?void 0:P.droppable},dragOverlay:{...tx.dragOverlay,...null==P?void 0:P.dragOverlay}}),[null==P?void 0:P.draggable,null==P?void 0:P.droppable,null==P?void 0:P.dragOverlay]),{droppableRects:es,measureDroppableContainers:eo,measuringScheduled:eh}=function(e,t){let{dragging:n,dependencies:r,config:a}=t,[i,s]=(0,N.useState)(null),{frequency:l,measure:o,strategy:c}=a,d=(0,N.useRef)(e),u=function(){switch(c){case y.Always:return!1;case y.BeforeDragging:return n;default:return!n}}(),p=ec(u),h=(0,N.useCallback)(function(e){void 0===e&&(e=[]),p.current||s(t=>null===t?e:t.concat(e.filter(e=>!t.includes(e))))},[p]),x=(0,N.useRef)(null),f=ed(t=>{if(u&&!n)return tr;if(!t||t===tr||d.current!==e||null!=i){let t=new Map;for(let n of e){if(!n)continue;if(i&&i.length>0&&!i.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new eZ(o(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,i,n,u,o]);return(0,N.useEffect)(()=>{d.current=e},[e]),(0,N.useEffect)(()=>{u||h()},[n,u]),(0,N.useEffect)(()=>{i&&i.length>0&&s(null)},[JSON.stringify(i)]),(0,N.useEffect)(()=>{u||"number"!=typeof l||null!==x.current||(x.current=setTimeout(()=>{h(),x.current=null},l))},[l,u,h,...r]),{droppableRects:f,measureDroppableContainers:h,measuringScheduled:null!=i}}(er,{dragging:F,dependencies:[H.x,H.y],config:ei.droppable}),ef=ed(e=>{var t;return null==B?null:null!=(t=null!=f?f:e)?t:null},[f=(p=null!=B?U.get(B):void 0)?p.node.current:null,B]),eg=(0,N.useMemo)(()=>V?ev(V):null,[V]),eb=(c=(null==Y?void 0:Y.autoScrollEnabled)===!1,d="object"==typeof C?!1===C.enabled:!1===C,u=F&&!c&&!d,"object"==typeof C?{...C,enabled:u}:{enabled:u}),ey=ta(ef,ei.draggable.measure);!function(e){let{activeNode:t,measure:n,initialRect:r,config:a=!0}=e,i=(0,N.useRef)(!1),{x:s,y:l}="boolean"==typeof a?{x:a,y:a}:a;el(()=>{if(!s&&!l||!t){i.current=!1;return}if(i.current||!r)return;let e=null==t?void 0:t.node.current;if(!e||!1===e.isConnected)return;let a=e$(n(e),r);if(s||(a.x=0),l||(a.y=0),i.current=!0,Math.abs(a.x)>0||Math.abs(a.y)>0){let t=eW(e);t&&t.scrollBy({top:a.y,left:a.x})}},[t,s,l,r,n])}({activeNode:null!=B?U.get(B):null,config:eb.layoutShiftCompensation,initialRect:ey,measure:ei.draggable.measure});let ew=tl(ef,ei.draggable.measure,ey),ej=tl(ef?ef.parentElement:null),ez=(0,N.useRef)({activatorEvent:null,active:null,activeNode:ef,collisionRect:null,collisions:null,droppableRects:es,draggableNodes:U,draggingNode:null,draggingNodeRect:null,droppableContainers:W,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),eN=W.getNodeFor(null==(t=ez.current.over)?void 0:t.id),eC=function(e){let{measure:t}=e,[n,r]=(0,N.useState)(null),a=ti({callback:(0,N.useCallback)(e=>{for(let{target:n}of e)if(ea(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[i,s]=eu((0,N.useCallback)(e=>{let n=function(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return ea(t)?t:e}(e);null==a||a.disconnect(),n&&(null==a||a.observe(n)),r(n?t(n):null)},[t,a]));return(0,N.useMemo)(()=>({nodeRef:i,rect:n,setRef:s}),[n,i,s])}({measure:ei.dragOverlay.measure}),eS=null!=(n=eC.nodeRef.current)?n:ef,eD=F?null!=(r=eC.rect)?r:ew:null,eP=!!(eC.nodeRef.current&&eC.rect),eT=(m=ta(i=eP?null:ew),e$(i,m)),eR=td(eS?en(eS):null),eL=(s=F?null!=eN?eN:ef:null,g=(0,N.useRef)(s),w=ed(e=>s?e&&e!==to&&s&&g.current&&s.parentNode===g.current.parentNode?e:eH(s):to,[s]),(0,N.useEffect)(()=>{g.current=s},[s]),w),eI=function(e,t){void 0===t&&(t=eB);let[n]=e,r=td(n?en(n):null),[a,i]=(0,N.useState)(tu);function s(){i(()=>e.length?e.map(e=>eY(e)?r:new eZ(t(e),e)):tu)}let l=ti({callback:s});return el(()=>{null==l||l.disconnect(),s(),e.forEach(e=>null==l?void 0:l.observe(e))},[e]),a}(eL),eF=function(e,t){let{transform:n,...r}=t;return null!=e&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}(M,{transform:{x:H.x-eT.x,y:H.y-eT.y,scaleX:1,scaleY:1},activatorEvent:V,active:X,activeNodeRect:ew,containerNodeRect:ej,draggingNodeRect:eD,over:ez.current.over,overlayNodeRect:eC.rect,scrollableAncestors:eL,scrollableAncestorRects:eI,windowRect:eR}),eU=eg?em(eg,H):null,eG=function(e){let[t,n]=(0,N.useState)(null),r=(0,N.useRef)(e),a=(0,N.useCallback)(e=>{let t=eK(e.target);t&&n(e=>e?(e.set(t,eq(t)),new Map(e)):null)},[]);return(0,N.useEffect)(()=>{let t=r.current;if(e!==t){i(t);let s=e.map(e=>{let t=eK(e);return t?(t.addEventListener("scroll",a,{passive:!0}),[t,eq(t)]):null}).filter(e=>null!=e);n(s.length?new Map(s):null),r.current=e}return()=>{i(e),i(t)};function i(e){e.forEach(e=>{let t=eK(e);null==t||t.removeEventListener("scroll",a)})}},[a,e]),(0,N.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>em(e,t),eM):e_(e):eM,[e,t])}(eL),eX=tc(eG),eQ=tc(eG,[ew]),e0=em(eF,eX),e1=eD?eA(eD,eF):null,e5=X&&e1?D({active:X,collisionRect:e1,droppableRects:es,droppableContainers:er,pointerCoordinates:eU}):null,e2=function(e,t){if(!e||0===e.length)return null;let[n]=e;return n.id}(e5,0),[e3,e4]=(0,N.useState)(null),e6=(l=eP?eF:em(eF,eQ),o=null!=(a=null==e3?void 0:e3.rect)?a:null,{...l,scaleX:o&&ew?o.width/ew.width:1,scaleY:o&&ew?o.height/ew.height:1}),e8=(0,N.useRef)(null),e7=(0,N.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(null==q.current)return;let a=U.get(q.current);if(!a)return;let i=e.nativeEvent,s=new n({active:q.current,activeNode:a,event:i,options:r,context:ez,onAbort(e){if(!U.get(e))return;let{onDragAbort:t}=ee.current,n={id:e};null==t||t(n),I({type:"onDragAbort",event:n})},onPending(e,t,n,r){if(!U.get(e))return;let{onDragPending:a}=ee.current,i={id:e,constraint:t,initialCoordinates:n,offset:r};null==a||a(i),I({type:"onDragPending",event:i})},onStart(e){let t=q.current;if(null==t)return;let n=U.get(t);if(!n)return;let{onDragStart:r}=ee.current,a={activatorEvent:i,active:{id:t,data:n.data,rect:G}};(0,Q.unstable_batchedUpdates)(()=>{null==r||r(a),A(j.Initializing),L({type:h.DragStart,initialCoordinates:e,active:t}),I({type:"onDragStart",event:a}),J(e8.current),_(i)})},onMove(e){L({type:h.DragMove,coordinates:e})},onEnd:l(h.DragEnd),onCancel:l(h.DragCancel)});function l(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:a}=ez.current,s=null;if(t&&a){let{cancelDrop:l}=ee.current;s={activatorEvent:i,active:t,collisions:n,delta:a,over:r},e===h.DragEnd&&"function"==typeof l&&await Promise.resolve(l(s))&&(e=h.DragCancel)}q.current=null,(0,Q.unstable_batchedUpdates)(()=>{L({type:e}),A(j.Uninitialized),e4(null),J(null),_(null),e8.current=null;let t=e===h.DragEnd?"onDragEnd":"onDragCancel";if(s){let e=ee.current[t];null==e||e(s),I({type:t,event:s})}})}}e8.current=s},[U]),e9=(0,N.useCallback)((e,t)=>(n,r)=>{let a=n.nativeEvent,i=U.get(r);null!==q.current||!i||a.dndKit||a.defaultPrevented||!0===e(n,t.options,{active:i})&&(a.dndKit={capturedBy:t.sensor},q.current=r,e7(n,t))},[U,e7]),te=(0,N.useMemo)(()=>E.reduce((e,t)=>{let{sensor:n}=t;return[...e,...n.activators.map(e=>({eventName:e.eventName,handler:e9(e.handler,t)}))]},[]),[E,e9]);(0,N.useEffect)(()=>{if(!Z)return;let e=E.map(e=>{let{sensor:t}=e;return null==t.setup?void 0:t.setup()});return()=>{for(let t of e)null==t||t()}},E.map(e=>{let{sensor:t}=e;return t})),el(()=>{ew&&$===j.Initializing&&A(j.Initialized)},[ew,$]),(0,N.useEffect)(()=>{let{onDragMove:e}=ee.current,{active:t,activatorEvent:n,collisions:r,over:a}=ez.current;if(!t||!n)return;let i={active:t,activatorEvent:n,collisions:r,delta:{x:e0.x,y:e0.y},over:a};(0,Q.unstable_batchedUpdates)(()=>{null==e||e(i),I({type:"onDragMove",event:i})})},[e0.x,e0.y]),(0,N.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:a}=ez.current;if(!e||null==q.current||!t||!a)return;let{onDragOver:i}=ee.current,s=r.get(e2),l=s&&s.rect.current?{id:s.id,rect:s.rect.current,data:s.data,disabled:s.disabled}:null,o={active:e,activatorEvent:t,collisions:n,delta:{x:a.x,y:a.y},over:l};(0,Q.unstable_batchedUpdates)(()=>{e4(l),null==i||i(o),I({type:"onDragOver",event:o})})},[e2]),el(()=>{ez.current={activatorEvent:V,active:X,activeNode:ef,collisionRect:e1,collisions:e5,droppableRects:es,draggableNodes:U,draggingNode:eS,draggingNodeRect:eD,droppableContainers:W,over:e3,scrollableAncestors:eL,scrollAdjustedTranslate:e0},G.current={initial:eD,translated:e1}},[X,ef,e5,e1,U,eS,eD,es,W,e3,eL,e0]),function(e){let t,{acceleration:n,activator:r=b.Pointer,canScroll:a,draggingRect:i,enabled:s,interval:l=5,order:o=v.TreeOrder,pointerCoordinates:c,scrollableAncestors:d,scrollableAncestorRects:u,delta:p,threshold:h}=e,f=function(e){let{delta:t,disabled:n}=e,r=ep(t);return ed(e=>{if(n||!r||!e)return tn;let a={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[x.Backward]:e.x[x.Backward]||-1===a.x,[x.Forward]:e.x[x.Forward]||1===a.x},y:{[x.Backward]:e.y[x.Backward]||-1===a.y,[x.Forward]:e.y[x.Forward]||1===a.y}}},[n,t,r])}({delta:p,disabled:!s}),[m,g]=(t=(0,N.useRef)(null),[(0,N.useCallback)((e,n)=>{t.current=setInterval(e,n)},[]),(0,N.useCallback)(()=>{null!==t.current&&(clearInterval(t.current),t.current=null)},[])]),y=(0,N.useRef)({x:0,y:0}),w=(0,N.useRef)({x:0,y:0}),j=(0,N.useMemo)(()=>{switch(r){case b.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case b.DraggableRect:return i}},[r,i,c]),z=(0,N.useRef)(null),k=(0,N.useCallback)(()=>{let e=z.current;if(!e)return;let t=y.current.x*w.current.x,n=y.current.y*w.current.y;e.scrollBy(t,n)},[]),C=(0,N.useMemo)(()=>o===v.TreeOrder?[...d].reverse():d,[o,d]);(0,N.useEffect)(()=>{if(!s||!d.length||!j)return void g();for(let e of C){if((null==a?void 0:a(e))===!1)continue;let t=u[d.indexOf(e)];if(!t)continue;let{direction:r,speed:i}=function(e,t,n,r,a){let{top:i,left:s,right:l,bottom:o}=n;void 0===r&&(r=10),void 0===a&&(a=eV);let{isTop:c,isBottom:d,isLeft:u,isRight:p}=eJ(e),h={x:0,y:0},f={x:0,y:0},m={height:t.height*a.y,width:t.width*a.x};return!c&&i<=t.top+m.height?(h.y=x.Backward,f.y=r*Math.abs((t.top+m.height-i)/m.height)):!d&&o>=t.bottom-m.height&&(h.y=x.Forward,f.y=r*Math.abs((t.bottom-m.height-o)/m.height)),!p&&l>=t.right-m.width?(h.x=x.Forward,f.x=r*Math.abs((t.right-m.width-l)/m.width)):!u&&s<=t.left+m.width&&(h.x=x.Backward,f.x=r*Math.abs((t.left+m.width-s)/m.width)),{direction:h,speed:f}}(e,t,j,n,h);for(let e of["x","y"])f[e][r[e]]||(i[e]=0,r[e]=0);if(i.x>0||i.y>0){g(),z.current=e,m(k,l),y.current=i,w.current=r;return}}y.current={x:0,y:0},w.current={x:0,y:0},g()},[n,k,a,g,s,l,JSON.stringify(j),JSON.stringify(f),m,d,C,u,JSON.stringify(h)])}({...eb,delta:H,draggingRect:e1,pointerCoordinates:eU,scrollableAncestors:eL,scrollableAncestorRects:eI});let tt=(0,N.useMemo)(()=>({active:X,activeNode:ef,activeNodeRect:ew,activatorEvent:V,collisions:e5,containerNodeRect:ej,dragOverlay:eC,draggableNodes:U,droppableContainers:W,droppableRects:es,over:e3,measureDroppableContainers:eo,scrollableAncestors:eL,scrollableAncestorRects:eI,measuringConfiguration:ei,measuringScheduled:eh,windowRect:eR}),[X,ef,ew,V,e5,ej,eC,U,W,es,e3,eo,eL,eI,ei,eh,eR]),ts=(0,N.useMemo)(()=>({activatorEvent:V,activators:te,active:X,activeNodeRect:ew,ariaDescribedById:{draggable:et},dispatch:L,draggableNodes:U,over:e3,measureDroppableContainers:eo}),[V,te,X,ew,L,et,U,e3,eo]);return N.default.createElement(ek.Provider,{value:O},N.default.createElement(tb.Provider,{value:ts},N.default.createElement(tv.Provider,{value:tt},N.default.createElement(tz.Provider,{value:e6},S)),N.default.createElement(tj,{disabled:(null==k?void 0:k.restoreFocus)===!1})),N.default.createElement(eE,{...k,hiddenTextDescribedById:et}))}),tk=(0,N.createContext)(null),tC="button",tS={timeout:25},tE={position:"fixed",touchAction:"none"},tD=e=>eb(e)?"transform 250ms ease":void 0;function tP(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function tM(e){return null!==e&&e>=0}(e,t)=>{let{as:n,activatorEvent:r,adjustScale:a,children:i,className:s,rect:l,style:o,transform:c,transition:d=tD}=e;if(!l)return null;let u=a?c:{...c,scaleX:1,scaleY:1},p={...tE,width:l.width,height:l.height,top:l.top,left:l.left,transform:ey.Transform.toString(u),transformOrigin:a&&r?function(e,t){let n=ev(e);if(!n)return"0 0";let r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+"% "+r.y+"%"}(r,l):void 0,transition:"function"==typeof d?d(r):d,...o};return N.default.createElement(n,{className:s,style:p,ref:t},i)},r={styles:{active:{opacity:"0"}}};let tT=e=>{let{rects:t,activeIndex:n,overIndex:r,index:a}=e,i=tP(t,r,n),s=t[a],l=i[a];return l&&s?{x:l.left-s.left,y:l.top-s.top,scaleX:l.width/s.width,scaleY:l.height/s.height}:null},tR={scaleX:1,scaleY:1},tL=e=>{var t,n,r,a;let i,s,l,{activeIndex:o,activeNodeRect:c,index:d,rects:u,overIndex:p}=e,h=null!=(t=u[o])?t:c;if(!h)return null;if(d===o){let e=u[p];return e?{x:0,y:o<p?e.top+e.height-(h.top+h.height):e.top-h.top,...tR}:null}let x=(n=u,r=d,a=o,i=n[r],s=n[r-1],l=n[r+1],i?a<r?s?i.top-(s.top+s.height):l?l.top-(i.top+i.height):0:l?l.top-(i.top+i.height):s?i.top-(s.top+s.height):0:0);return d>o&&d<=p?{x:0,y:-h.height-x,...tR}:d<o&&d>=p?{x:0,y:h.height+x,...tR}:{x:0,y:0,...tR}},tI="Sortable",tO=N.default.createContext({activeIndex:-1,containerId:tI,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:tT,disabled:{draggable:!1,droppable:!1}});function t$(e){let{children:t,id:n,items:r,strategy:a=tT,disabled:i=!1}=e,{active:s,dragOverlay:l,droppableRects:o,over:c,measureDroppableContainers:d}=(0,N.useContext)(tv),u=ex(tI,n),p=null!==l.rect,h=(0,N.useMemo)(()=>r.map(e=>"object"==typeof e&&"id"in e?e.id:e),[r]),x=null!=s,f=s?h.indexOf(s.id):-1,m=c?h.indexOf(c.id):-1,g=(0,N.useRef)(h),b=!function(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}(h,g.current),v=-1!==m&&-1===f||b,y="boolean"==typeof i?{draggable:i,droppable:i}:i;el(()=>{b&&x&&d(h)},[b,h,x,d]),(0,N.useEffect)(()=>{g.current=h},[h]);let w=(0,N.useMemo)(()=>({activeIndex:f,containerId:u,disabled:y,disableTransforms:v,items:h,overIndex:m,useDragOverlay:p,sortedRects:h.reduce((e,t,n)=>{let r=o.get(t);return r&&(e[n]=r),e},Array(h.length)),strategy:a}),[f,u,y.draggable,y.droppable,v,h,m,o,p,a]);return N.default.createElement(tO.Provider,{value:w},t)}let tA=e=>{let{id:t,items:n,activeIndex:r,overIndex:a}=e;return tP(n,r,a).indexOf(t)},tF=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:a,items:i,newIndex:s,previousItems:l,previousContainerId:o,transition:c}=e;return!!c&&!!r&&(l===i||a!==s)&&(!!n||s!==a&&t===o)},tB={duration:200,easing:"ease"},tU="transform",tH=ey.Transition.toString({property:tU,duration:0,easing:"linear"}),tW={roleDescription:"sortable"};function tK({groupSize:e,panelElement:t,styleProp:n}){let r,[a,i]=function(e){switch(typeof e){case"number":return[e,"px"];case"string":{let t=parseFloat(e);return e.endsWith("%")?[t,"%"]:e.endsWith("px")?[t,"px"]:e.endsWith("rem")?[t,"rem"]:e.endsWith("em")?[t,"em"]:e.endsWith("vh")?[t,"vh"]:e.endsWith("vw")?[t,"vw"]:[t,"%"]}}}(n);switch(i){case"%":r=a/100*e;break;case"px":r=a;break;case"rem":r=a*parseFloat(getComputedStyle(t.ownerDocument.body).fontSize);break;case"em":r=a*parseFloat(getComputedStyle(t).fontSize);break;case"vh":r=a/100*window.innerHeight;break;case"vw":r=a/100*window.innerWidth}return r}function tG(e){return parseFloat(e.toFixed(3))}function tX({group:e}){let{orientation:t,panels:n}=e;return n.reduce((e,n)=>e+="horizontal"===t?n.element.offsetWidth:n.element.offsetHeight,0)}function tq(e){let{panels:t}=e,n=tX({group:e});return 0===n?t.map(e=>({groupResizeBehavior:e.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:!0===e.panelConstraints.collapsible,defaultSize:void 0,disabled:e.panelConstraints.disabled,minSize:0,maxSize:100,panelId:e.id})):t.map(e=>{let t,{element:r,panelConstraints:a}=e,i=0;void 0!==a.collapsedSize&&(i=tG(tK({groupSize:n,panelElement:r,styleProp:a.collapsedSize})/n*100)),void 0!==a.defaultSize&&(t=tG(tK({groupSize:n,panelElement:r,styleProp:a.defaultSize})/n*100));let s=0;void 0!==a.minSize&&(s=tG(tK({groupSize:n,panelElement:r,styleProp:a.minSize})/n*100));let l=100;return void 0!==a.maxSize&&(l=tG(tK({groupSize:n,panelElement:r,styleProp:a.maxSize})/n*100)),{groupResizeBehavior:a.groupResizeBehavior,collapsedSize:i,collapsible:!0===a.collapsible,defaultSize:t,disabled:a.disabled,minSize:s,maxSize:l,panelId:e.id}})}function tY(e,t="Assertion error"){if(!e)throw Error(t)}function tJ(e,t){return Array.from(t).sort("horizontal"===e?tV:t_)}function tV(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return 0!==n?n:e.element.offsetWidth-t.element.offsetWidth}function t_(e,t){let n=e.element.offsetTop-t.element.offsetTop;return 0!==n?n:e.element.offsetHeight-t.element.offsetHeight}function tQ(e){return null!==e&&"object"==typeof e&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function tZ(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function t0(e){let{element:n,orientation:r,panels:a,separators:i}=e,s=tJ(r,Array.from(n.children).filter(tQ).map(e=>({element:e}))).map(({element:e})=>e),l=[],o=!1,c=!1,d=-1,u=-1,p=0,h,x=[];{let e=-1;for(let t of s)t.hasAttribute("data-panel")&&(e++,t.hasAttribute("data-disabled")||(p++,-1===d&&(d=e),u=e))}if(p>1){let n=-1;for(let p of s)if(p.hasAttribute("data-panel")){n++;let i=a.find(e=>e.element===p);if(i){if(h){let a,s=h.element.getBoundingClientRect(),f=p.getBoundingClientRect();if(c){let e="horizontal"===r?new DOMRect(s.right,s.top,0,s.height):new DOMRect(s.left,s.bottom,s.width,0),t="horizontal"===r?new DOMRect(f.left,f.top,0,f.height):new DOMRect(f.left,f.top,f.width,0);switch(x.length){case 0:a=[e,t];break;case 1:{let n=x[0],i=function({orientation:e,rects:t,targetRect:n}){let r={x:n.x+n.width/2,y:n.y+n.height/2},a,i=Number.MAX_VALUE;for(let n of t){let{x:t,y:s}=tZ(r,n),l="horizontal"===e?t:s;l<i&&(i=l,a=n)}return tY(a,"No rect found"),a}({orientation:r,rects:[s,f],targetRect:n.element.getBoundingClientRect()});a=[n,i===s?t:e];break}default:a=x}}else a=x.length?x:["horizontal"===r?new DOMRect(s.right,f.top,f.left-s.right,f.height):new DOMRect(f.left,s.bottom,f.width,f.top-s.bottom)];for(let r of a){let a="width"in r?r:r.element.getBoundingClientRect(),s=(void 0===t&&(t="function"==typeof matchMedia&&!!matchMedia("(pointer:coarse)").matches),t)?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(a.width<s){let e=s-a.width;a=new DOMRect(a.x-e/2,a.y,a.width+e,a.height)}if(a.height<s){let e=s-a.height;a=new DOMRect(a.x,a.y-e/2,a.width,a.height+e)}let c=n<=d||n>u;o||c||l.push({group:e,groupSize:tX({group:e}),panels:[h,i],separator:"width"in r?void 0:r,rect:a}),o=!1}}c=!1,h=i,x=[]}}else if(p.hasAttribute("data-separator")){null!==p.ariaDisabled&&(o=!0);let e=i.find(e=>e.element===p);e?x.push(e):(h=void 0,x=[])}else c=!0}return l}m.Down,m.Right,m.Up,m.Left;class t1{#e={};addListener(e,t){let n=this.#e[e];return void 0===n?this.#e[e]=[t]:n.includes(t)||n.push(t),()=>{this.removeListener(e,t)}}emit(e,t){let n=this.#e[e];if(void 0!==n)if(1===n.length)n[0].call(null,t);else{let e=!1,r=null,a=Array.from(n);for(let n=0;n<a.length;n++){let i=a[n];try{i.call(null,t)}catch(t){null===r&&(e=!0,r=t)}}if(e)throw r}}removeAllListeners(){this.#e={}}removeListener(e,t){let n=this.#e[e];if(void 0!==n){let e=n.indexOf(t);e>=0&&n.splice(e,1)}}}let t5=new Map,t2=new t1;function t3(e,t){for(let[t]of t5)if(t.id===e)return t}function t4(e,t){for(let[t,n]of t5)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function t6(e,t){return t2.addListener("groupChange",n=>{n.group.id===e&&t(n)})}function t8(e,t){let n=t5.get(e);(t5=new Map(t5)).set(e,t),t2.emit("groupChange",{group:e,prev:n,next:t})}let t7=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function t9(e){let t=e.length;for(;t--;){let n=e[t];if(tY(n,"Missing node"),function(e){let t,n=getComputedStyle(e);return!!("fixed"===n.position||"auto"!==n.zIndex&&("static"!==n.position||"flex"===(t=getComputedStyle(nn(e)??e).display)||"inline-flex"===t)||1>+n.opacity||"transform"in n&&"none"!==n.transform||"webkitTransform"in n&&"none"!==n.webkitTransform||"mixBlendMode"in n&&"normal"!==n.mixBlendMode||"filter"in n&&"none"!==n.filter||"webkitFilter"in n&&"none"!==n.webkitFilter||"isolation"in n&&"isolate"===n.isolation||t7.test(n.willChange)||"touch"===n.webkitOverflowScrolling)}(n))return n}return null}function ne(e){return e&&Number(getComputedStyle(e).zIndex)||0}function nt(e){let t=[];for(;e;)t.push(e),e=nn(e);return t}function nn(e){let{parentNode:t}=e;return null!==t&&"object"==typeof t&&"nodeType"in t&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE?t.host:t}function nr(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let a=t0(r),i=function(e,t,n){let r,a={x:1/0,y:1/0};for(let i of t){let t=tZ(n,i.rect);switch(e){case"horizontal":t.x<=a.x&&(r=i,a=t);break;case"vertical":t.y<=a.y&&(r=i,a=t)}}return r?{distance:a,hitRegion:r}:void 0}(r.orientation,a,{x:e.clientX,y:e.clientY});i&&i.distance.x<=0&&i.distance.y<=0&&function({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!tQ(n)||n.contains(e)||e.contains(n))return!0;if(function(e,t){let n;if(e===t)throw Error("Cannot compare node with itself");let r={a:nt(e),b:nt(t)};for(;r.a.at(-1)===r.b.at(-1);)n=r.a.pop(),r.b.pop();tY(n,"Stacking order can only be calculated for elements with a common ancestor");let a={a:ne(t9(r.a)),b:ne(t9(r.b))};if(a.a===a.b){let e=n.childNodes,t={a:r.a.at(-1),b:r.b.at(-1)},a=e.length;for(;a--;){let n=e[a];if(n===t.a)return 1;if(n===t.b)return -1}}return Math.sign(a.a-a.b)}(n,e)>0){let a=n;for(;a;){var r;if(a.contains(e))break;if(r=a.getBoundingClientRect(),r.x<t.x+t.width&&r.x+r.width>t.x&&r.y<t.y+t.height&&r.y+r.height>t.y)return!1;a=a.parentElement}}return!0}({groupElement:r.element,hitRegion:i.hitRegion.rect,pointerEventTarget:e.target})&&n.push(i.hitRegion)}),n}function na(e,t,n=0){return Math.abs(tG(e)-tG(t))<=n}function ni(e,t){return na(e,t)?0:e>t?1:-1}function ns({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:r}){let{collapsedSize:a=0,collapsible:i,disabled:s,maxSize:l=100,minSize:o=0}=t;return s&&!e?n:(0>ni(r,o)&&(r=i&&0>ni(r,(a+o)/2)?a:o),tG(r=Math.min(l,r)))}function nl({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:a,trigger:i}){if(na(e,0))return t;let s="imperative-api"===i,l=Object.values(t),o=Object.values(a),c=[...l],[d,u]=r;tY(null!=d,"Invalid first pivot index"),tY(null!=u,"Invalid second pivot index");let p=0;if("keyboard"===i){{let t=e<0?u:d,r=n[t];tY(r,`Panel constraints not found for index ${t}`);let{collapsedSize:a=0,collapsible:i,minSize:s=0}=r;if(i){let n=l[t];if(tY(null!=n,`Previous layout not found for panel index ${t}`),na(n,a)){let t=s-n;ni(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?d:u,r=n[t];tY(r,`No panel constraints found for index ${t}`);let{collapsedSize:a=0,collapsible:i,minSize:s=0}=r;if(i){let n=l[t];if(tY(null!=n,`Previous layout not found for panel index ${t}`),na(n,s)){let t=n-a;ni(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}}else{let t=e<0?u:d,r=n[t];tY(r,`Panel constraints not found for index ${t}`);let a=l[t],{collapsible:i,collapsedSize:s,minSize:o}=r;if(i&&0>ni(a,o))if(e>0){let t=o-s;0>ni(a+e,o)&&(e=0>=ni(e,t/2)?0:t)}else{let t=o-s;0>ni(a-e,o)&&(e=ni(100+e,100-t/2)>0?0:-t)}}{let t=e<0?1:-1,r=e<0?u:d,a=0;for(;;){let e=l[r];if(tY(null!=e,`Previous layout not found for panel index ${r}`),a+=ns({overrideDisabledPanels:s,panelConstraints:n[r],prevSize:e,size:100})-e,(r+=t)<0||r>=n.length)break}let i=Math.min(Math.abs(e),Math.abs(a));e=e<0?0-i:i}{let t=e<0?d:u;for(;t>=0&&t<n.length;){let r=Math.abs(e)-Math.abs(p),a=l[t];tY(null!=a,`Previous layout not found for panel index ${t}`);let i=a-r,o=ns({overrideDisabledPanels:s,panelConstraints:n[t],prevSize:a,size:i});if(!na(a,o)&&(p+=a-o,c[t]=o,p.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?t--:t++}}if(function(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}(o,c))return a;{let t=e<0?u:d,r=l[t];tY(null!=r,`Previous layout not found for panel index ${t}`);let a=r+p,i=ns({overrideDisabledPanels:s,panelConstraints:n[t],prevSize:r,size:a});if(c[t]=i,!na(i,a)){let t=a-i,r=e<0?u:d;for(;r>=0&&r<n.length;){let a=c[r];tY(null!=a,`Previous layout not found for panel index ${r}`);let i=a+t,l=ns({overrideDisabledPanels:s,panelConstraints:n[r],prevSize:a,size:i});if(na(a,l)||(t-=l-a,c[r]=l),na(t,0))break;e>0?r--:r++}}}if(!na(Object.values(c).reduce((e,t)=>t+e,0),100,.1))return a;let h=Object.keys(a);return c.reduce((e,t,n)=>(e[h[n]]=t,e),{})}function no(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(void 0===t[n]||0!==ni(e[n],t[n]))return!1;return!0}function nc({layout:e,panelConstraints:t}){let n=Object.values(e),r=[...n],a=r.reduce((e,t)=>e+t,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(e=>`${e}%`).join(", ")}`);if(!na(a,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];tY(null!=t,`No layout data found for index ${e}`);let n=100/a*t;r[e]=n}let i=0;for(let e=0;e<t.length;e++){let a=n[e];tY(null!=a,`No layout data found for index ${e}`);let s=r[e];tY(null!=s,`No layout data found for index ${e}`);let l=ns({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:a,size:s});s!=l&&(i+=s-l,r[e]=l)}if(!na(i,0))for(let e=0;e<t.length;e++){let n=r[e];tY(null!=n,`No layout data found for index ${e}`);let a=n+i,s=ns({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:a});if(n!==s&&(i-=s-n,r[e]=s,na(i,0)))break}let s=Object.keys(e);return r.reduce((e,t,n)=>(e[s[n]]=t,e),{})}function nd({groupId:e,panelId:t}){let n=()=>{for(let[t,{defaultLayoutDeferred:n,derivedPanelConstraints:r,layout:a,groupSize:i,separatorToPanels:s}]of t5)if(t.id===e)return{defaultLayoutDeferred:n,derivedPanelConstraints:r,group:t,groupSize:i,layout:a,separatorToPanels:s};throw Error(`Group ${e} not found`)},r=()=>{let e=n().derivedPanelConstraints.find(e=>e.panelId===t);if(void 0!==e)return e;throw Error(`Panel constraints not found for Panel ${t}`)},a=()=>{let e=n().group.panels.find(e=>e.id===t);if(void 0!==e)return e;throw Error(`Layout not found for Panel ${t}`)},i=()=>{let e=n().layout[t];if(void 0!==e)return e;throw Error(`Layout not found for Panel ${t}`)},s=e=>{let r=i();if(e===r)return;let{defaultLayoutDeferred:a,derivedPanelConstraints:s,group:l,groupSize:o,layout:c,separatorToPanels:d}=n(),u=l.panels.findIndex(e=>e.id===t),p=u===l.panels.length-1,h=nc({layout:nl({delta:p?r-e:e-r,initialLayout:c,panelConstraints:s,pivotIndices:p?[u-1,u]:[u,u+1],prevLayout:c,trigger:"imperative-api"}),panelConstraints:s});no(c,h)||t8(l,{defaultLayoutDeferred:a,derivedPanelConstraints:s,groupSize:o,layout:h,separatorToPanels:d})};return{collapse:()=>{let{collapsible:e,collapsedSize:t}=r(),{mutableValues:n}=a(),l=i();e&&l!==t&&(n.expandToSize=l,s(t))},expand:()=>{let{collapsible:e,collapsedSize:t,minSize:n}=r(),{mutableValues:l}=a(),o=i();if(e&&o===t){let e=l.expandToSize??n;0===e&&(e=1),s(e)}},getSize:()=>{let{group:e}=n(),t=i(),{element:r}=a();return{asPercentage:t,inPixels:"horizontal"===e.orientation?r.offsetWidth:r.offsetHeight}},isCollapsed:()=>{let{collapsible:e,collapsedSize:t}=r(),n=i();return e&&na(t,n)},resize:e=>{let{group:t}=n(),{element:r}=a(),i=tX({group:t});s(tG(tK({groupSize:i,panelElement:r,styleProp:e})/i*100))}}}function nu(e){e.defaultPrevented||nr(e,t5).forEach(t=>{if(t.separator){let n=t.panels.find(e=>void 0!==e.panelConstraints.defaultSize);if(n){let r=n.panelConstraints.defaultSize,a=nd({groupId:t.group.id,panelId:n.id});a&&void 0!==r&&(a.resize(r),e.preventDefault())}}})}function np(e){for(let[t]of t5)if(t.separators.some(t=>t.element===e))return t;throw Error("Could not find parent Group for separator element")}function nh({groupId:e}){let t=()=>{for(let[t,n]of t5)if(t.id===e)return{group:t,...n};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){let{defaultLayoutDeferred:e,layout:n}=t();return e?{}:n},setLayout(e){let{defaultLayoutDeferred:n,derivedPanelConstraints:r,group:a,groupSize:i,layout:s,separatorToPanels:l}=t(),o=nc({layout:e,panelConstraints:r});return n?s:(no(s,o)||t8(a,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:i,layout:o,separatorToPanels:l}),o)}}}function nx(e,t){let n=np(e),r=t4(n.id,!0),a=n.separators.find(t=>t.element===e);tY(a,"Matching separator not found");let i=r.separatorToPanels.get(a);tY(i,"Matching panels not found");let s=i.map(e=>n.panels.indexOf(e)),l=nh({groupId:n.id}).getLayout(),o=nc({layout:nl({delta:t,initialLayout:l,panelConstraints:r.derivedPanelConstraints,pivotIndices:s,prevLayout:l,trigger:"keyboard"}),panelConstraints:r.derivedPanelConstraints});no(l,o)||t8(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:o,separatorToPanels:r.separatorToPanels})}function nf(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=np(t);if(!n.disabled)switch(e.key){case"ArrowDown":e.preventDefault(),"vertical"===n.orientation&&nx(t,5);break;case"ArrowLeft":e.preventDefault(),"horizontal"===n.orientation&&nx(t,-5);break;case"ArrowRight":e.preventDefault(),"horizontal"===n.orientation&&nx(t,5);break;case"ArrowUp":e.preventDefault(),"vertical"===n.orientation&&nx(t,-5);break;case"End":e.preventDefault(),nx(t,100);break;case"Enter":{e.preventDefault();let n=np(t),{derivedPanelConstraints:r,layout:a,separatorToPanels:i}=t4(n.id,!0),s=n.separators.find(e=>e.element===t);tY(s,"Matching separator not found");let l=i.get(s);tY(l,"Matching panels not found");let o=l[0],c=r.find(e=>e.panelId===o.id);if(tY(c,"Panel metadata not found"),c.collapsible){let e=a[o.id];nx(t,(c.collapsedSize===e?n.mutableState.expandedPanelSizes[o.id]??c.minSize:c.collapsedSize)-e)}break}case"F6":{e.preventDefault();let n=np(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);tY(null!==r,"Index not found");let a=e.shiftKey?r>0?r-1:n.length-1:r+1<n.length?r+1:0;n[a].focus({preventScroll:!0});break}case"Home":e.preventDefault(),nx(t,-100)}}let nm={cursorFlags:0,state:"inactive"},ng=new t1;function nb(e){let t=nm;nm=e,ng.emit("change",{prev:t,next:e})}function nv(e){if(e.defaultPrevented||"mouse"===e.pointerType&&e.button>0)return;let t=t5,n=nr(e,t),r=new Map,a=!1;n.forEach(e=>{e.separator&&(a||(a=!0,e.separator.element.focus({preventScroll:!0})));let n=t.get(e.group);n&&r.set(e.group,n.layout)}),nb({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}),n.length&&e.preventDefault()}let ny=e=>e,nw=()=>{};function nj(){return void 0===n&&(n=!1,"u">typeof window&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(n=!0)),n}let nz=new WeakMap;function nN(e){if(null===e.defaultView||void 0===e.defaultView)return;let{prevStyle:t,styleSheet:n}=nz.get(e)??{};void 0===n&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(n));let r=nm;switch(r.state){case"active":case"hover":{let e=function({cursorFlags:e,groups:t,state:n}){let r=0,a=0;switch(n){case"active":case"hover":t.forEach(e=>{if(!e.mutableState.disableCursor)switch(e.orientation){case"horizontal":r++;break;case"vertical":a++}})}if(0!==r||0!==a){if("active"===n&&e&&nj()){let t=(4&e)!=0,n=(8&e)!=0;if((1&e)!=0)return t?"se-resize":n?"ne-resize":"e-resize";if((2&e)!=0)return t?"sw-resize":n?"nw-resize":"w-resize";if(t)return"s-resize";if(n)return"n-resize"}return nj()?r>0&&a>0?"move":r>0?"ew-resize":"ns-resize":r>0&&a>0?"grab":r>0?"col-resize":"row-resize"}}({cursorFlags:r.cursorFlags,groups:r.hitRegions.map(e=>e.group),state:r.state}),a=`*, *:hover {cursor: ${e} !important; }`;if(t===a)return;t=a,e?0===n.cssRules.length?n.insertRule(a):n.replaceSync(a):1===n.cssRules.length&&n.deleteRule(0);break}case"inactive":t=void 0,1===n.cssRules.length&&n.deleteRule(0)}nz.set(e,{prevStyle:t,styleSheet:n})}function nk({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:a,pointerDownAtPoint:i,prevCursorFlags:s}){var l;let o,c,d=0;n.forEach(e=>{let{group:n,groupSize:s}=e,{orientation:l,panels:o}=n,{disableCursor:c}=n.mutableState,u=0;u=i?"horizontal"===l?(t.clientX-i.x)/s*100:(t.clientY-i.y)/s*100:"horizontal"===l?t.clientX<0?-100:100:t.clientY<0?-100:100;let p=r.get(n),h=a.get(n);if(!p||!h)return;let{defaultLayoutDeferred:x,derivedPanelConstraints:f,groupSize:m,layout:g,separatorToPanels:b}=h;if(f&&g&&b){let t=nl({delta:u,initialLayout:p,panelConstraints:f,pivotIndices:e.panels.map(e=>o.indexOf(e)),prevLayout:g,trigger:"mouse-or-touch"});if(no(t,g)){if(0!==u&&!c)switch(l){case"horizontal":d|=u<0?1:2;break;case"vertical":d|=u<0?4:8}}else t8(e.group,{defaultLayoutDeferred:x,derivedPanelConstraints:f,groupSize:m,layout:t,separatorToPanels:b})}});let u=0;0===t.movementX?u|=3&s:u|=3&d,0===t.movementY?u|=12&s:u|=12&d,l=u,o=nm,(c={...nm}).cursorFlags=l,nm=c,ng.emit("change",{prev:o,next:c}),nN(e)}function nC(e){let t=t5,n=nm;"active"===n.state&&nk({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}function nS(e){if(e.defaultPrevented)return;let t=nm,n=t5;if("active"===t.state){if(0===e.buttons){nb({cursorFlags:0,state:"inactive"}),t.hitRegions.forEach(e=>{let t=t4(e.group.id,!0);t8(e.group,t)});return}for(let n of t.hitRegions)if(n.separator){let{element:t}=n.separator;t.hasPointerCapture?.(e.pointerId)||t.setPointerCapture?.(e.pointerId)}nk({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags})}else{let r=nr(e,n);0===r.length?"inactive"!==t.state&&nb({cursorFlags:0,state:"inactive"}):nb({cursorFlags:0,hitRegions:r,state:"hover"}),nN(e.currentTarget)}}function nE(e){e.relatedTarget instanceof HTMLIFrameElement&&"hover"===nm.state&&nb({cursorFlags:0,state:"inactive"})}function nD(e){if(e.defaultPrevented||"mouse"===e.pointerType&&e.button>0)return;let t=nm;"active"===t.state&&(nb({cursorFlags:0,state:"inactive"}),t.hitRegions.length>0&&(nN(e.currentTarget),t.hitRegions.forEach(e=>{let t=t4(e.group.id,!0);t8(e.group,t)}),e.preventDefault()))}function nP(e){let t=0,n=0,r={};for(let a of e)if(void 0!==a.defaultSize){t++;let e=tG(a.defaultSize);n+=e,r[a.panelId]=e}else r[a.panelId]=void 0;let a=e.length-t;if(0!==a){let t=tG((100-n)/a);for(let n of e)void 0===n.defaultSize&&(r[n.panelId]=t)}return r}let nM=new Map;function nT(e){let t=(0,N.useId)();return`${e??t}`}let nR="u">typeof window?N.useLayoutEffect:N.useEffect;function nL(e){let t=(0,N.useRef)(e);return nR(()=>{t.current=e},[e]),(0,N.useCallback)((...e)=>t.current?.(...e),[t])}function nI(...e){return nL(t=>{e.forEach(e=>{if(e)switch(typeof e){case"function":e(t);break;case"object":e.current=t}})})}function nO(e){let t=(0,N.useRef)({...e});return nR(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}let n$=(0,N.createContext)(null);function nA({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:a,elementRef:i,groupRef:s,id:l,onLayoutChange:o,onLayoutChanged:c,orientation:d="horizontal",resizeTargetMinimumSize:u={coarse:20,fine:10},style:p,...h}){let x,f=(0,N.useRef)({onLayoutChange:{},onLayoutChanged:{}}),m=nL(e=>{no(f.current.onLayoutChange,e)||(f.current.onLayoutChange=e,o?.(e))}),g=nL(e=>{no(f.current.onLayoutChanged,e)||(f.current.onLayoutChanged=e,c?.(e))}),b=nT(l),v=(0,N.useRef)(null),[y,w]=function(){let[e,t]=(0,N.useState)({});return[e,(0,N.useCallback)(()=>t({}),[])]}(),j=(0,N.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:u,separators:[]}),k=nI(v,i);x=(0,N.useRef)({getLayout:()=>({}),setLayout:ny}),(0,N.useImperativeHandle)(s,()=>x.current,[]),nR(()=>{Object.assign(x.current,nh({groupId:b}))});let C=nL((e,t)=>{let r=nm,a=t3(e),i=t4(e);if(i){let e=!1;return"active"===r.state&&(e=r.hitRegions.some(e=>e.group===a)),{flexGrow:i.layout[t]??1,pointerEvents:e?"none":void 0}}if(n?.[t])return{flexGrow:n?.[t]}}),S=nO({defaultLayout:n,disableCursor:r}),E=(0,N.useMemo)(()=>({get disableCursor(){return!!S.disableCursor},getPanelStyles:C,id:b,orientation:d,registerPanel:e=>{let t=j.current;return t.panels=tJ(d,[...t.panels,e]),w(),()=>{t.panels=t.panels.filter(t=>t!==e),w()}},registerSeparator:e=>{let t=j.current;return t.separators=tJ(d,[...t.separators,e]),w(),()=>{t.separators=t.separators.filter(t=>t!==e),w()}},togglePanelDisabled:(e,t)=>{let n=j.current.panels.find(t=>t.id===e);n&&(n.panelConstraints.disabled=t);let r=t3(b),a=t4(b);r&&a&&t8(r,{...a,derivedPanelConstraints:tq(r)})},toggleSeparatorDisabled:(e,t)=>{let n=j.current.separators.find(t=>t.id===e);n&&(n.disabled=t)}}),[C,b,w,d,S]),D=(0,N.useRef)(null);return nR(()=>{let e,t,n,r,i,s,l,o,c,u,p,h,x,f=v.current;if(null===f)return;let y=j.current;if(void 0!==S.defaultLayout&&Object.keys(S.defaultLayout).length===y.panels.length)for(let t of(e={},y.panels)){let n=S.defaultLayout[t.id];void 0!==n&&(e[t.id]=n)}let w={disabled:!!a,element:f,id:b,mutableState:{defaultLayout:e,disableCursor:!!S.disableCursor,expandedPanelSizes:j.current.lastExpandedPanelSizes,layouts:j.current.layouts},orientation:d,panels:y.panels,resizeTargetMinimumSize:y.resizeTargetMinimumSize,separators:y.separators};D.current=w;let z=(t=!0,tY(w.element.ownerDocument.defaultView,"Cannot register an unmounted Group"),n=w.element.ownerDocument.defaultView.ResizeObserver,r=new Set,i=new Set,(s=new n(e=>{for(let n of e){let{borderBoxSize:e,target:r}=n;if(r===w.element){if(t){let e=tX({group:w});if(0===e)return;let t=t4(w.id);if(!t)return;let n=tq(w),r=t.defaultLayoutDeferred?nP(n):t.layout,a=nc({layout:function({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:r}){if(n<=0||t<=0||n===t)return r;let a=0,i=0,s=!1,l=new Map,o=[];for(let c of e.panels){let e=r[c.id]??0;if("preserve-pixel-size"===c.panelConstraints.groupResizeBehavior){s=!0;let r=tG(e/100*n/t*100);l.set(c.id,r),a+=r}else o.push(c.id),i+=e}if(!s||0===o.length)return r;let c=100-a,d={...r};if(l.forEach((e,t)=>{d[t]=e}),i>0)for(let e of o){let t=r[e]??0;d[e]=tG(t/i*c)}else{let e=tG(c/o.length);for(let t of o)d[t]=e}return d}({group:w,nextGroupSize:e,prevGroupSize:t.groupSize,prevLayout:r}),panelConstraints:n});if(!t.defaultLayoutDeferred&&no(t.layout,a)&&function(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}(t.derivedPanelConstraints,n)&&t.groupSize===e)return;t8(w,{defaultLayoutDeferred:!1,derivedPanelConstraints:n,groupSize:e,layout:a,separatorToPanels:t.separatorToPanels})}}else!function(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let a=tX({group:e}),i="horizontal"===e.orientation?r.element.offsetWidth:r.element.offsetHeight,s=r.mutableValues.prevSize,l={asPercentage:tG(i/a*100),inPixels:i};r.mutableValues.prevSize=l,r.onResize(l,r.id,s)}(w,r,e)}})).observe(w.element),w.panels.forEach(e=>{tY(!r.has(e.id),`Panel ids must be unique; id "${e.id}" was used more than once`),r.add(e.id),e.onResize&&s.observe(e.element)}),l=tX({group:w}),o=tq(w),c=w.panels.map(({id:e})=>e).join(","),(u=w.mutableState.defaultLayout)&&(function(e,t){let n=e.map(e=>e.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(let e of n)if(!r.includes(e))return!1;return!0}(w.panels,u)||(u=void 0)),p=nc({layout:w.mutableState.layouts[c]??u??nP(o),panelConstraints:o}),h=w.element.ownerDocument,nM.set(h,(nM.get(h)??0)+1),x=new Map,t0(w).forEach(e=>{e.separator&&x.set(e.separator,e.panels)}),t8(w,{defaultLayoutDeferred:0===l,derivedPanelConstraints:o,groupSize:l,layout:p,separatorToPanels:x}),w.separators.forEach(e=>{tY(!i.has(e.id),`Separator ids must be unique; id "${e.id}" was used more than once`),i.add(e.id),e.element.addEventListener("keydown",nf)}),1===nM.get(h)&&(h.addEventListener("dblclick",nu,!0),h.addEventListener("pointerdown",nv,!0),h.addEventListener("pointerleave",nC),h.addEventListener("pointermove",nS),h.addEventListener("pointerout",nE),h.addEventListener("pointerup",nD,!0)),function(){t=!1,nM.set(h,Math.max(0,(nM.get(h)??0)-1)),(t5=new Map(t5)).delete(w),w.separators.forEach(e=>{e.element.removeEventListener("keydown",nf)}),nM.get(h)||(h.removeEventListener("dblclick",nu,!0),h.removeEventListener("pointerdown",nv,!0),h.removeEventListener("pointerleave",nC),h.removeEventListener("pointermove",nS),h.removeEventListener("pointerout",nE),h.removeEventListener("pointerup",nD,!0)),s.disconnect()}),{defaultLayoutDeferred:N,derivedPanelConstraints:k,layout:C}=t4(w.id,!0);!N&&k.length>0&&(m(C),g(C));let E=t6(b,e=>{let{defaultLayoutDeferred:t,derivedPanelConstraints:n,layout:r}=e.next;if(t||0===n.length)return;let a=w.panels.map(({id:e})=>e).join(",");w.mutableState.layouts[a]=r,n.forEach(t=>{if(t.collapsible){let{layout:n}=e.prev??{};if(n){let e=na(t.collapsedSize,r[t.panelId]),a=na(t.collapsedSize,n[t.panelId]);e&&!a&&(w.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let i="active"!==nm.state;m(r),i&&g(r)});return()=>{D.current=null,z(),E()}},[a,b,g,m,d,y,S]),(0,N.useEffect)(()=>{let e=D.current;e&&(e.mutableState.defaultLayout=n,e.mutableState.disableCursor=!!r)}),(0,z.jsx)(n$.Provider,{value:E,children:(0,z.jsx)("div",{...h,className:t,"data-group":!0,"data-testid":b,id:b,ref:k,style:{height:"100%",width:"100%",overflow:"hidden",...p,display:"flex",flexDirection:"horizontal"===d?"row":"column",flexWrap:"nowrap",touchAction:"horizontal"===d?"pan-y":"pan-x"},children:e})})}function nF(){let e=(0,N.useContext)(n$);return tY(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function nB({children:e,className:t,collapsedSize:n="0%",collapsible:r=!1,defaultSize:a,disabled:i,elementRef:s,groupResizeBehavior:l="preserve-relative-size",id:o,maxSize:c="100%",minSize:d="0%",onResize:u,panelRef:p,style:h,...x}){let f,m=!!o,g=nT(o),b=nO({disabled:i}),v=(0,N.useRef)(null),y=nI(v,s),{getPanelStyles:w,id:j,orientation:k,registerPanel:C,togglePanelDisabled:S}=nF(),E=null!==u,D=nL((e,t,n)=>{u?.(e,o,n)});nR(()=>{let e=v.current;if(null!==e)return C({element:e,id:g,idIsStable:m,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:E?D:void 0,panelConstraints:{groupResizeBehavior:l,collapsedSize:n,collapsible:r,defaultSize:a,disabled:b.disabled,maxSize:c,minSize:d}})},[l,n,r,a,E,g,m,c,d,D,C,b]),(0,N.useEffect)(()=>{S(g,!!i)},[i,g,S]),function(e,t){let{id:n}=nF(),r=(0,N.useRef)({collapse:nw,expand:nw,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:nw});(0,N.useImperativeHandle)(t,()=>r.current,[]),nR(()=>{Object.assign(r.current,nd({groupId:n,panelId:e}))})}(g,p);let P=()=>{let e=w(j,g);if(e)return JSON.stringify(e)},M=(0,N.useSyncExternalStore)(e=>t6(j,e),P,P);return f=M?JSON.parse(M):a?{flexGrow:void 0,flexShrink:void 0,flexBasis:a}:{flexGrow:1},(0,z.jsx)("div",{...x,"data-disabled":i||void 0,"data-panel":!0,"data-testid":g,id:g,ref:y,style:{...nU,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...f},children:(0,z.jsx)("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...h,touchAction:"horizontal"===k?"pan-y":"pan-x"},children:e})})}nA.displayName="Group",nB.displayName="Panel";let nU={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function nH({children:e,className:t,disabled:n,elementRef:r,id:a,style:i,...s}){let l,o=nT(a),c=nO({disabled:n}),[d,u]=(0,N.useState)({}),[p,h]=(0,N.useState)("inactive"),x=(0,N.useRef)(null),f=nI(x,r),{disableCursor:m,id:g,orientation:b,registerSeparator:v,toggleSeparatorDisabled:y}=nF();return nR(()=>{let e=x.current;if(null!==e){var t;let n={disabled:c.disabled,element:e,id:o},r=v(n),a=(t=e=>{h("inactive"!==e.next.state&&e.next.hitRegions.some(e=>e.separator===n)?e.next.state:"inactive")},ng.addListener("change",t)),i=t6(g,e=>{let{derivedPanelConstraints:t,layout:r,separatorToPanels:a}=e.next,i=a.get(n);if(i){let e=i[0],n=i.indexOf(e);u(function({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let a,i,s=e[n],l=t.find(e=>e.panelId===n);if(l){let o=l.maxSize,c=l.collapsible?l.collapsedSize:l.minSize,d=[r,r+1];i=nc({layout:nl({delta:c-s,initialLayout:e,panelConstraints:t,pivotIndices:d,prevLayout:e}),panelConstraints:t})[n],a=nc({layout:nl({delta:o-s,initialLayout:e,panelConstraints:t,pivotIndices:d,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:a,valueMin:i,valueNow:s}}({layout:r,panelConstraints:t,panelId:e.id,panelIndex:n}))}});return()=>{a(),i(),r()}}},[g,o,v,c]),(0,N.useEffect)(()=>{y(o,!!n)},[n,o,y]),n&&!m&&(l="not-allowed"),(0,z.jsx)("div",{...s,"aria-controls":d.valueControls,"aria-disabled":n||void 0,"aria-orientation":"horizontal"===b?"vertical":"horizontal","aria-valuemax":d.valueMax,"aria-valuemin":d.valueMin,"aria-valuenow":d.valueNow,children:e,className:t,"data-separator":n?"disabled":p,"data-testid":o,id:o,ref:f,role:"separator",style:{flexBasis:"auto",cursor:l,...i,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:n?void 0:0})}nH.displayName="Separator";var nW=e.i(398003);let nK=(0,L.default)("folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]),nG=(0,L.default)("folder-plus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);var nX=e.i(655900),nq=e.i(239616),nY=e.i(209165);function nJ({value:e,onChange:t}){let[n,r]=(0,N.useState)(!1),[a,i]=(0,N.useState)([]),[s,l]=(0,N.useState)(!1),[o,c]=(0,N.useState)(""),[d,u]=(0,N.useState)(null),[p,h]=(0,N.useState)(!1),[x,f]=(0,N.useState)("list"),[m,g]=(0,N.useState)(!1),[b,v]=(0,N.useState)(""),[y,w]=(0,N.useState)(""),[j,k]=(0,N.useState)(!1),S=(0,N.useRef)(null);(0,N.useEffect)(()=>{fetch((0,nY.api)("/api/config")).then(e=>e.json()).then(e=>{i(e.devDirectories||[]),l(!0)}).catch(()=>l(!0))},[]),(0,N.useEffect)(()=>{n&&"browse"===x&&o&&(h(!0),fetch((0,nY.api)(`/api/folders?path=${encodeURIComponent(o)}`)).then(e=>e.json()).then(e=>{u(e),h(!1)}).catch(()=>h(!1)))},[n,x,o]),(0,N.useEffect)(()=>{let e=e=>{S.current&&!S.current.contains(e.target)&&r(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);let E=()=>{n?r(!1):(1===a.length?(f("browse"),c(a[0])):f("list"),r(!0))},D=e=>{t(e),r(!1)},M=e=>{c(e)},T=async()=>{if(b.trim()&&d?.current){k(!0),w("");try{let e=await fetch((0,nY.api)("/api/folders"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({parent:d.current,name:b.trim()})});if(e.ok){let{path:t}=await e.json();g(!1),v(""),D(t)}else{let t=await e.json();w(t.error||"Failed to create folder")}}catch{w("Failed to create folder")}k(!1)}},L=a.find(e=>d?.current===e||d?.current?.startsWith(e+"/")),I=L?.split("/").pop()||"",O=L&&d?.current?d.current.slice(L.length):"",$=O?O.split("/").filter(Boolean):[];return(0,z.jsxs)("div",{ref:S,className:"relative",children:[(0,z.jsxs)("div",{className:"flex items-center gap-0",children:[(0,z.jsx)("input",{type:"text",placeholder:"Working directory",value:e,onChange:e=>t(e.target.value),onFocus:()=>{n||E()},className:"flex-1 px-3 py-2 text-sm bg-zinc-800 border border-zinc-700 rounded-l-md focus:outline-none focus:border-indigo-500 text-white font-mono"}),(0,z.jsx)("button",{type:"button",onClick:E,className:"px-3 py-2 text-sm bg-zinc-700 border border-zinc-700 border-l-0 rounded-r-md hover:bg-zinc-600 text-zinc-300 hover:text-white transition-colors",title:"Browse folders",children:(0,z.jsx)(P.FolderOpen,{className:"w-4 h-4"})})]}),n&&(0,z.jsxs)("div",{className:"absolute z-50 top-full left-0 right-0 mt-1 bg-zinc-800 border border-zinc-700 rounded-md shadow-xl overflow-hidden",children:[s?0===a.length&&"list"===x?(0,z.jsxs)("div",{className:"py-6 px-4 text-center",children:[(0,z.jsx)(nq.Settings,{className:"w-5 h-5 text-zinc-500 mx-auto mb-2"}),(0,z.jsx)("p",{className:"text-xs text-zinc-400 mb-1",children:"No development directories configured"}),(0,z.jsx)("p",{className:"text-[11px] text-zinc-500",children:"Add them in Settings to browse project folders here."})]}):"list"===x?(0,z.jsxs)("div",{children:[(0,z.jsx)("div",{className:"px-3 py-1.5 border-b border-zinc-700/50 text-[11px] text-zinc-500 font-medium",children:"Development Directories"}),(0,z.jsx)("div",{className:"max-h-[250px] overflow-y-auto",children:a.map(e=>(0,z.jsxs)("button",{className:"w-full flex items-center gap-2 px-3 py-2 text-xs hover:bg-zinc-700 transition-colors group",onClick:()=>{f("browse"),c(e)},onDoubleClick:()=>D(e),title:"Click to browse, double-click to select",children:[(0,z.jsx)(nK,{className:"w-3.5 h-3.5 text-amber-500/70"}),(0,z.jsx)("span",{className:"font-mono text-white truncate flex-1 text-left",children:e}),(0,z.jsx)(R.ChevronRight,{className:"w-3 h-3 text-zinc-600 group-hover:text-zinc-400"})]},e))})]}):(0,z.jsxs)("div",{children:[(0,z.jsxs)("div",{className:"flex items-center gap-0.5 px-2 py-1.5 border-b border-zinc-700/50 overflow-x-auto text-[11px] flex-nowrap",children:[a.length>1&&(0,z.jsx)("button",{onClick:()=>{f("list"),u(null),g(!1)},className:"text-zinc-400 hover:text-white flex-shrink-0 p-0.5 mr-0.5",title:"Back to dev directories",children:(0,z.jsx)(nX.ChevronUp,{className:"w-3 h-3"})}),(0,z.jsx)("button",{onClick:()=>L&&M(L),className:"text-zinc-400 hover:text-white flex-shrink-0",children:I}),$.map((e,t)=>{let n=L+"/"+$.slice(0,t+1).join("/");return(0,z.jsxs)("span",{className:"flex items-center gap-0.5 flex-shrink-0",children:[(0,z.jsx)(R.ChevronRight,{className:"w-2.5 h-2.5 text-zinc-600"}),(0,z.jsx)("button",{onClick:()=>M(n),className:"text-zinc-400 hover:text-white hover:underline",children:e})]},t)})]}),(0,z.jsx)("div",{className:"max-h-[250px] overflow-y-auto",children:p||!d?(0,z.jsx)("div",{className:"flex items-center justify-center py-6",children:(0,z.jsx)(C.Loader2,{className:"w-4 h-4 animate-spin text-zinc-400"})}):d.error?(0,z.jsx)("div",{className:"py-4 px-3 text-xs text-red-400 text-center",children:d.error}):(0,z.jsxs)(z.Fragment,{children:[d?.parent&&(0,z.jsxs)("button",{onClick:()=>M(d.parent),className:"w-full flex items-center gap-2 px-3 py-1.5 text-xs text-zinc-400 hover:text-white hover:bg-zinc-700/50 transition-colors border-b border-zinc-700/30",children:[(0,z.jsx)(nX.ChevronUp,{className:"w-3.5 h-3.5"}),(0,z.jsx)("span",{children:".."})]}),(0,z.jsxs)("button",{onClick:()=>D(d.current),className:"w-full flex items-center gap-2 px-3 py-2 text-xs text-indigo-400 hover:bg-indigo-500/10 transition-colors border-b border-zinc-700/30 font-medium",children:[(0,z.jsx)(P.FolderOpen,{className:"w-3.5 h-3.5"}),(0,z.jsx)("span",{children:"Select this folder"}),(0,z.jsx)("span",{className:"ml-auto text-[10px] text-zinc-500 font-mono truncate max-w-[200px]",children:d.current.split("/").pop()})]}),m?(0,z.jsxs)("div",{className:"px-3 py-2 border-b border-zinc-700/30 space-y-1.5",children:[(0,z.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,z.jsx)("input",{autoFocus:!0,value:b,onChange:e=>{v(e.target.value),w("")},onKeyDown:e=>{"Enter"===e.key&&T(),"Escape"===e.key&&g(!1)},placeholder:"Folder name",className:"flex-1 px-2 py-1 text-xs bg-zinc-900 border border-zinc-600 rounded text-white focus:outline-none focus:border-green-500"}),(0,z.jsx)("button",{onClick:T,disabled:j||!b.trim(),className:"px-2.5 py-1 text-xs bg-green-600 hover:bg-green-500 text-white rounded disabled:opacity-40",children:j?"...":"Create"}),(0,z.jsx)("button",{onClick:()=>g(!1),className:"px-1.5 py-1 text-xs text-zinc-500 hover:text-white",children:"✕"})]}),y&&(0,z.jsx)("div",{className:"text-[10px] text-red-400",children:y})]}):(0,z.jsxs)("button",{onClick:()=>{g(!0),w("")},className:"w-full flex items-center gap-2 px-3 py-2 text-xs text-green-400 hover:bg-green-500/10 transition-colors border-b border-zinc-700/30",children:[(0,z.jsx)(nG,{className:"w-3.5 h-3.5"}),(0,z.jsx)("span",{children:"New folder"})]}),d?.folders.length===0?(0,z.jsx)("div",{className:"py-3 px-3 text-[11px] text-zinc-500 text-center",children:"No subfolders"}):d?.folders.map(e=>(0,z.jsxs)("button",{onClick:()=>M(e.path),onDoubleClick:()=>D(e.path),className:"w-full flex items-center gap-2 px-3 py-1.5 text-xs text-white hover:bg-zinc-700 transition-colors",title:"Click to open, double-click to select",children:[(0,z.jsx)(nK,{className:"w-3.5 h-3.5 text-amber-500/70"}),(0,z.jsx)("span",{className:"truncate",children:e.name})]},e.path))]})})]}):(0,z.jsx)("div",{className:"flex items-center justify-center py-6",children:(0,z.jsx)(C.Loader2,{className:"w-4 h-4 animate-spin text-zinc-400"})}),(0,z.jsx)("div",{className:"border-t border-zinc-700/50 px-2 py-1 flex justify-end",children:(0,z.jsx)("button",{onClick:()=>r(!1),className:"text-[11px] text-zinc-500 hover:text-white px-2 py-0.5",children:"Close"})})]})]})}var nV=e.i(768407),n_=e.i(28916);function nQ({value:e,onChange:t}){let{hasNetwork:n}=(0,n_.useTier)(),{data:r}=(0,nV.useNodes)(n);return Array.isArray(r)&&0!==r.length?(0,z.jsxs)("div",{children:[(0,z.jsx)("label",{className:"text-[11px] text-zinc-400 mb-1.5 block",children:"Node"}),(0,z.jsxs)("div",{className:"relative",children:[(0,z.jsx)(K.Globe,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-zinc-500"}),(0,z.jsxs)("select",{value:e,onChange:e=>t(e.target.value),className:"w-full pl-8 pr-3 py-2 text-sm bg-zinc-800 border border-zinc-700 rounded-md focus:outline-none focus:border-indigo-500 text-white appearance-none",children:[(0,z.jsx)("option",{value:"",children:"Local (this machine)"}),r.map(e=>(0,z.jsx)("option",{value:e.id,disabled:"offline"===e.status,children:"offline"===e.status?`${e.name} (offline)`:e.name},e.id))]})]})]}):null}var nZ=e.i(534623),n0=e.i(73359),n1=e.i(203999),n5=e.i(514764);let n2=(0,L.default)("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);var n3=e.i(266027),n4=e.i(954616),n6=e.i(912598);function n8({workspaceId:e,panes:t,collapsed:n,onToggle:r}){let a,i,s,l,[o,c]=(0,N.useState)("messages"),[d,u]=(0,N.useState)(""),p=(0,N.useRef)(null),{data:h=[]}=(0,n3.useQuery)({queryKey:["workspace-messages",e,void 0],queryFn:async()=>{let t=new URLSearchParams;return(await fetch((0,nY.api)(`/api/workspaces/${e}/messages?${t}`))).json()},enabled:!!e,refetchInterval:3e3}),{data:x=[]}=(0,n3.useQuery)({queryKey:["workspace-context",e],queryFn:async()=>(await fetch((0,nY.api)(`/api/workspaces/${e}/context`))).json(),enabled:!!e}),f=(a=(0,n6.useQueryClient)(),(0,n4.useMutation)({mutationFn:async t=>(await fetch((0,nY.api)(`/api/workspaces/${e}/messages`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...t,senderName:t.senderName||"User",type:t.type||"message"})})).json(),onSuccess:()=>{a.invalidateQueries({queryKey:["workspace-messages",e]})}})),m=(i=(0,n6.useQueryClient)(),(0,n4.useMutation)({mutationFn:async({messageId:t,status:n})=>(await fetch((0,nY.api)(`/api/workspaces/${e}/messages/${t}`),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:n})})).json(),onSuccess:()=>{i.invalidateQueries({queryKey:["workspace-messages",e]})}})),g=(s=(0,n6.useQueryClient)(),(0,n4.useMutation)({mutationFn:async()=>{await fetch((0,nY.api)(`/api/workspaces/${e}/messages`),{method:"DELETE"})},onSuccess:()=>{s.invalidateQueries({queryKey:["workspace-messages",e]})}})),b=(l=(0,n6.useQueryClient)(),(0,n4.useMutation)({mutationFn:async()=>{await fetch((0,nY.api)(`/api/workspaces/${e}/context`),{method:"DELETE"})},onSuccess:()=>{l.invalidateQueries({queryKey:["workspace-context",e]})}})),v=h.filter(e=>"pending_approval"===e.status).length;(0,N.useEffect)(()=>{p.current&&(p.current.scrollTop=p.current.scrollHeight)},[h]);let y=()=>{d.trim()&&e&&(f.mutate({content:d.trim()}),u(""))};return n?(0,z.jsxs)("button",{onClick:r,className:"flex-shrink-0 w-10 border-l border-zinc-800 bg-zinc-900 flex flex-col items-center pt-3 gap-2",children:[(0,z.jsx)(n2,{className:"w-4 h-4 text-zinc-400"}),(0,z.jsx)(D.MessageSquare,{className:"w-4 h-4 text-zinc-400"}),v>0&&(0,z.jsx)("span",{className:"bg-amber-500 text-black text-xs font-bold rounded-full w-5 h-5 flex items-center justify-center",children:v})]}):(0,z.jsxs)("div",{className:"flex-shrink-0 w-80 border-l border-zinc-800 bg-zinc-900 flex flex-col",children:[(0,z.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 border-b border-zinc-800",children:[(0,z.jsxs)("div",{className:"flex gap-1",children:[(0,z.jsxs)("button",{onClick:()=>c("messages"),className:`px-2 py-1 text-xs rounded ${"messages"===o?"bg-zinc-700 text-white":"text-zinc-400 hover:text-zinc-300"}`,children:["Messages",v>0&&(0,z.jsx)("span",{className:"ml-1 bg-amber-500 text-black text-xs font-bold rounded-full px-1.5",children:v})]}),(0,z.jsx)("button",{onClick:()=>c("context"),className:`px-2 py-1 text-xs rounded ${"context"===o?"bg-zinc-700 text-white":"text-zinc-400 hover:text-zinc-300"}`,children:"Context"})]}),(0,z.jsxs)("div",{className:"flex items-center gap-1",children:[(0,z.jsx)("button",{onClick:()=>"messages"===o?g.mutate():b.mutate(),className:"text-zinc-500 hover:text-red-400",title:"messages"===o?"Clear all messages":"Clear all context",children:(0,z.jsx)(O.Trash2,{className:"w-3.5 h-3.5"})}),(0,z.jsx)("button",{onClick:r,className:"text-zinc-400 hover:text-zinc-300",children:(0,z.jsx)(R.ChevronRight,{className:"w-4 h-4"})})]})]}),"messages"===o&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)("div",{ref:p,className:"flex-1 overflow-y-auto p-2 space-y-2",children:[[...h].reverse().map(e=>(0,z.jsx)(n7,{message:e,panes:t,onApprove:()=>m.mutate({messageId:e.id,status:"approved"}),onReject:()=>m.mutate({messageId:e.id,status:"rejected"})},e.id)),0===h.length&&(0,z.jsx)("p",{className:"text-zinc-500 text-xs text-center py-8",children:"No messages yet. Agents will appear here."})]}),(0,z.jsx)("div",{className:"border-t border-zinc-800 p-2",children:(0,z.jsxs)("div",{className:"flex gap-1",children:[(0,z.jsx)("input",{value:d,onChange:e=>u(e.target.value),onKeyDown:e=>"Enter"===e.key&&!e.shiftKey&&y(),placeholder:"Message workspace...",className:"flex-1 bg-zinc-800 border border-zinc-700 rounded px-2 py-1 text-sm text-zinc-200 placeholder-zinc-500 focus:outline-none focus:border-zinc-600"}),(0,z.jsx)("button",{onClick:y,disabled:!d.trim(),className:"px-2 py-1 bg-indigo-600 hover:bg-indigo-500 disabled:bg-zinc-700 disabled:text-zinc-500 rounded text-sm",children:(0,z.jsx)(n5.Send,{className:"w-3.5 h-3.5"})})]})})]}),"context"===o&&(0,z.jsx)(n9,{workspaceId:e,context:x})]})}function n7({message:e,panes:t,onApprove:n,onReject:r}){let a=t.find(t=>t.id===e.paneId),i="pending_approval"===e.status,s="rejected"===e.status;return(0,z.jsxs)("div",{className:`rounded p-2 text-xs ${i?"bg-amber-950/50 border border-amber-800/50":s?"bg-zinc-800/50 opacity-50":"bg-zinc-800/50"}`,children:[(0,z.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,z.jsxs)("span",{className:"font-medium text-zinc-300",children:[a&&(0,z.jsx)("span",{className:"inline-block w-2 h-2 rounded-full mr-1",style:{backgroundColor:a.color||"#6366f1"}}),e.senderName]}),(0,z.jsx)("span",{className:"text-zinc-500",children:new Date(e.created).toLocaleTimeString()})]}),(0,z.jsx)("p",{className:"text-zinc-300 whitespace-pre-wrap",children:e.content}),i&&(0,z.jsxs)("div",{className:"flex gap-1 mt-2",children:[(0,z.jsxs)("button",{onClick:n,className:"flex items-center gap-1 px-2 py-0.5 bg-green-700 hover:bg-green-600 rounded text-white text-xs",children:[(0,z.jsx)(A.Check,{className:"w-3 h-3"})," Approve"]}),(0,z.jsxs)("button",{onClick:r,className:"flex items-center gap-1 px-2 py-0.5 bg-zinc-700 hover:bg-zinc-600 rounded text-zinc-300 text-xs",children:[(0,z.jsx)(F.X,{className:"w-3 h-3"})," Reject"]})]}),"rejected"===e.status&&(0,z.jsx)("span",{className:"text-red-400 text-xs mt-1 block",children:"Rejected"})]})}function n9({workspaceId:e,context:t}){let n,r,[a,i]=(0,N.useState)(""),[s,l]=(0,N.useState)(""),o=(n=(0,n6.useQueryClient)(),(0,n4.useMutation)({mutationFn:async({key:t,value:n})=>(await fetch((0,nY.api)(`/api/workspaces/${e}/context/${encodeURIComponent(t)}`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:n})})).json(),onSuccess:()=>{n.invalidateQueries({queryKey:["workspace-context",e]})}})),c=(r=(0,n6.useQueryClient)(),(0,n4.useMutation)({mutationFn:async t=>{await fetch((0,nY.api)(`/api/workspaces/${e}/context/${encodeURIComponent(t)}`),{method:"DELETE"})},onSuccess:()=>{r.invalidateQueries({queryKey:["workspace-context",e]})}})),d=()=>{a.trim()&&s.trim()&&(o.mutate({key:a.trim(),value:s.trim()}),i(""),l(""))};return(0,z.jsxs)("div",{className:"flex-1 overflow-y-auto p-2 space-y-2",children:[t.map(e=>(0,z.jsxs)("div",{className:"bg-zinc-800/50 rounded p-2 text-xs",children:[(0,z.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,z.jsx)("span",{className:"font-mono font-medium text-indigo-300",children:e.key}),(0,z.jsx)("button",{onClick:()=>c.mutate(e.key),className:"text-zinc-500 hover:text-red-400",children:(0,z.jsx)(F.X,{className:"w-3 h-3"})})]}),(0,z.jsx)("p",{className:"text-zinc-300 whitespace-pre-wrap font-mono text-xs",children:e.value}),(0,z.jsxs)("span",{className:"text-zinc-500 text-xs",children:["by ",e.updatedBy]})]},e.key)),(0,z.jsxs)("div",{className:"border-t border-zinc-800 pt-2 space-y-1",children:[(0,z.jsx)("input",{value:a,onChange:e=>i(e.target.value),placeholder:"Key",className:"w-full bg-zinc-800 border border-zinc-700 rounded px-2 py-1 text-xs text-zinc-200 placeholder-zinc-500 focus:outline-none"}),(0,z.jsx)("input",{value:s,onChange:e=>l(e.target.value),placeholder:"Value",onKeyDown:e=>"Enter"===e.key&&d(),className:"w-full bg-zinc-800 border border-zinc-700 rounded px-2 py-1 text-xs text-zinc-200 placeholder-zinc-500 focus:outline-none"}),(0,z.jsx)("button",{onClick:d,disabled:!a.trim()||!s.trim(),className:"w-full px-2 py-1 bg-indigo-600 hover:bg-indigo-500 disabled:bg-zinc-700 disabled:text-zinc-500 rounded text-xs",children:"Add Entry"})]})]})}var re=e.i(209593),rt=e.i(286536),rn=e.i(77705),rr=e.i(751975);function ra({workspaceId:e,workspaceName:t}){let[n,r]=(0,N.useState)(null),[a,i]=(0,N.useState)([]),[s,l]=(0,N.useState)(!1),[o,c]=(0,N.useState)(""),[d,u]=(0,N.useState)(null);(0,N.useEffect)(()=>{Promise.all([fetch((0,nY.api)(`/api/cortex/lobes/${e}`)).then(e=>{if(!e.ok)throw Error(`${e.status} ${e.statusText}`);return e.json()}),fetch((0,nY.api)("/api/cortex/lobes")).then(e=>e.json()).catch(()=>({lobes:[]}))]).then(([t,n])=>{r(t.config??null),i((n.lobes||[]).filter(t=>t.workspaceId!==e))}).catch(e=>u(e.message||"Failed to load"))},[e]);let p=async t=>{if(n){r({...n,...t}),l(!0);try{let n=await fetch((0,nY.api)(`/api/cortex/lobes/${e}`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),a=await n.json();a.config&&r(a.config)}catch{}finally{l(!1)}}},h=()=>{if(!n||!o.trim())return;let e=o.trim();n.tags.includes(e)||p({tags:[...n.tags,e]}),c("")};return d?(0,z.jsx)("div",{className:"text-[11px] text-red-400/80",children:d}):n?(0,z.jsxs)("div",{className:"space-y-3",children:[(0,z.jsx)("div",{className:"text-[10px] text-zinc-500 uppercase tracking-wider font-medium",children:"Knowledge Lobe"}),(0,z.jsxs)("button",{onClick:()=>p({isPrivate:!n.isPrivate}),disabled:s,className:"flex items-center gap-2 w-full text-left group disabled:opacity-50",children:[(0,z.jsx)("span",{className:`flex items-center justify-center w-4 h-4 rounded border transition-colors ${n.isPrivate?"bg-amber-500/20 border-amber-500/40 text-amber-400":"bg-zinc-800 border-zinc-700 text-zinc-500 group-hover:border-zinc-500"}`,children:n.isPrivate?(0,z.jsx)(rn.EyeOff,{className:"w-2.5 h-2.5"}):(0,z.jsx)(rt.Eye,{className:"w-2.5 h-2.5"})}),(0,z.jsx)("span",{className:"text-xs text-zinc-400 group-hover:text-zinc-300 transition-colors",children:n.isPrivate?"Private — hidden from other workspaces":"Visible to other workspaces"})]}),(0,z.jsxs)("div",{className:"space-y-1.5",children:[(0,z.jsxs)("div",{className:"flex items-center gap-1 text-[10px] text-zinc-500",children:[(0,z.jsx)(rr.Tag,{className:"w-3 h-3"}),(0,z.jsx)("span",{children:"Topics"}),(0,z.jsx)("span",{className:"text-zinc-700 ml-1",children:"— Cortex uses these to scope knowledge retrieval"})]}),(0,z.jsxs)("div",{className:"flex flex-wrap gap-1",children:[n.tags.map(e=>(0,z.jsxs)("span",{className:"flex items-center gap-1 px-1.5 py-0.5 bg-purple-500/10 border border-purple-500/20 rounded text-[11px] text-purple-300",children:[e,(0,z.jsx)("button",{onClick:()=>{n&&p({tags:n.tags.filter(t=>t!==e)})},className:"hover:text-red-400 transition-colors",children:(0,z.jsx)(F.X,{className:"w-2.5 h-2.5"})})]},e)),(0,z.jsxs)("span",{className:"flex items-center gap-0.5",children:[(0,z.jsx)("input",{type:"text",value:o,onChange:e=>c(e.target.value),onKeyDown:e=>{"Enter"===e.key&&h()},placeholder:"add topic...",className:"w-20 px-1.5 py-0.5 bg-zinc-800 border border-zinc-700 rounded text-[11px] text-zinc-300 placeholder-zinc-600 focus:outline-none focus:border-purple-500/50"}),o.trim()&&(0,z.jsx)("button",{onClick:h,className:"text-purple-400 hover:text-purple-300 transition-colors",children:(0,z.jsx)(k.Plus,{className:"w-3 h-3"})})]})]})]}),(0,z.jsxs)("div",{className:"space-y-1.5",children:[(0,z.jsxs)("div",{className:"text-[10px] text-zinc-500",children:["Domain Context",(0,z.jsx)("span",{className:"text-zinc-700 ml-1",children:"— injected into distillation prompts for better extraction"})]}),(0,z.jsx)("textarea",{value:n.domain_context||"",onChange:e=>p({domain_context:e.target.value}),placeholder:"Describe the domain expertise this lobe should focus on. E.g. 'This workspace covers CFB power plant engineering.'",rows:3,disabled:s,className:"w-full px-2 py-1.5 bg-zinc-800 border border-zinc-700 rounded text-[11px] text-zinc-300 placeholder-zinc-600 focus:outline-none focus:border-purple-500/50 resize-y disabled:opacity-50"})]}),a.length>0&&!n.isPrivate&&(0,z.jsxs)("div",{className:"space-y-1.5",children:[(0,z.jsx)("div",{className:"text-[10px] text-zinc-500",children:"Sibling access — uncheck to block a workspace from this lobe"}),(0,z.jsx)("div",{className:"space-y-0.5",children:a.map(e=>{let t=n.excludedFrom.includes(e.workspaceId);return(0,z.jsxs)("button",{onClick:()=>{var t;return t=e.workspaceId,void(!n||p({excludedFrom:n.excludedFrom.includes(t)?n.excludedFrom.filter(e=>e!==t):[...n.excludedFrom,t]}))},disabled:s,className:"flex items-center gap-2 w-full px-2 py-1 rounded text-left hover:bg-zinc-800/50 transition-colors disabled:opacity-50",children:[(0,z.jsx)("span",{className:`w-3 h-3 rounded-sm border flex items-center justify-center transition-colors ${t?"border-zinc-700 bg-zinc-800":"border-purple-500/50 bg-purple-500/20"}`,children:!t&&(0,z.jsx)("svg",{className:"w-2 h-2 text-purple-400",viewBox:"0 0 12 12",fill:"none",children:(0,z.jsx)("path",{d:"M2 6l3 3 5-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),(0,z.jsx)("span",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{backgroundColor:e.color}}),(0,z.jsx)("span",{className:`text-xs ${t?"text-zinc-600 line-through":"text-zinc-300"}`,children:e.name})]},e.workspaceId)})})]})]}):(0,z.jsx)("div",{className:"text-[11px] text-zinc-600",children:"Loading..."})}let ri=(0,L.default)("file",[["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:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]]);var rs=e.i(178583);let rl=(0,L.default)("file-code",[["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:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]]),ro=(0,L.default)("file-braces",[["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:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]]),rc=(0,L.default)("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]),rd=(0,L.default)("arrow-up",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);var ru=e.i(778917);let rp=(0,L.default)("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]);var rh=e.i(569074);let rx="spaces-file-viewer",rf="spaces-file-viewer-state";function rm(){try{let e=localStorage.getItem(rf);if(e)return JSON.parse(e)}catch{}return{x:0,y:0,w:800,h:600,wasPoppedOut:!1}}function rg(e){try{let t=rm();localStorage.setItem(rf,JSON.stringify({...t,...e}))}catch{}}function rb(e){return e?({".ts":"text-blue-300",".tsx":"text-blue-300",".js":"text-yellow-300",".jsx":"text-yellow-300",".json":"text-green-300",".md":"text-zinc-300",".css":"text-pink-300",".scss":"text-pink-300",".html":"text-orange-300",".xml":"text-orange-300",".py":"text-emerald-300",".rb":"text-red-300",".go":"text-cyan-300",".rs":"text-orange-300",".sh":"text-green-300",".bash":"text-green-300",".yml":"text-purple-300",".yaml":"text-purple-300",".sql":"text-blue-200",".graphql":"text-pink-200"})[e]||"text-zinc-300":""}function rv({item:e}){if(e.isDir)return(0,z.jsx)(nK,{className:"w-3.5 h-3.5 text-amber-500/70 flex-shrink-0"});let t=e.ext||"";return[".png",".jpg",".jpeg",".gif",".webp",".svg",".ico",".bmp"].includes(t)?(0,z.jsx)(rc,{className:"w-3.5 h-3.5 text-emerald-400/70 flex-shrink-0"}):[".ts",".tsx",".js",".jsx",".py",".rb",".go",".rs"].includes(t)?(0,z.jsx)(rl,{className:"w-3.5 h-3.5 text-blue-400/70 flex-shrink-0"}):".json"===t?(0,z.jsx)(ro,{className:"w-3.5 h-3.5 text-green-400/70 flex-shrink-0"}):[".md",".txt",".yml",".yaml"].includes(t)?(0,z.jsx)(rs.FileText,{className:"w-3.5 h-3.5 text-zinc-400/70 flex-shrink-0"}):(0,z.jsx)(ri,{className:"w-3.5 h-3.5 text-zinc-500/70 flex-shrink-0"})}function ry(e){return e<1024?`${e}B`:e<1048576?`${(e/1024).toFixed(1)}KB`:`${(e/1048576).toFixed(1)}MB`}function rw({onClose:e,navigateTo:t}){let[n,r]=(0,N.useState)([]),[a,i]=(0,N.useState)(""),[s,l]=(0,N.useState)(""),[o,c]=(0,N.useState)([]),[d,u]=(0,N.useState)(null),[p,h]=(0,N.useState)(new Set),[x,f]=(0,N.useState)(null),[m,g]=(0,N.useState)(!1),[b,v]=(0,N.useState)(!1),y=(0,N.useRef)(null),w=(0,N.useRef)(null),j=(0,N.useRef)(null),k=(0,N.useRef)(!0);(0,N.useEffect)(()=>(k.current=!0,w.current=new BroadcastChannel(rx),w.current.onmessage=e=>{e.data?.type==="pop-in"&&(rg({wasPoppedOut:!1}),v(!1),y.current=null,j.current&&(clearInterval(j.current),j.current=null))},()=>{k.current=!1,w.current?.close(),j.current&&clearInterval(j.current)}),[]),(0,N.useEffect)(()=>{fetch((0,nY.api)("/api/config")).then(e=>e.json()).then(e=>{let t=e.devDirectories||[];r(t),t.length>0&&!a&&(i(t[0]),l(t[0]))}).catch(()=>{})},[]),(0,N.useEffect)(()=>{if(!t)return;let e=n.find(e=>t===e||t.startsWith(e+"/")||t.startsWith(e+"\\"));e?i(e):i(t),l(t),h(new Set)},[t,n]),(0,N.useEffect)(()=>{if(b&&x&&w.current)try{w.current.postMessage({type:"file-update",file:x})}catch{}},[x,b]);let C=(0,N.useRef)(!1);(0,N.useEffect)(()=>{C.current=!1;let e=rm();e.wasPoppedOut&&e.lastFilePath&&fetch((0,nY.api)(`/api/files?file=${encodeURIComponent(e.lastFilePath)}`)).then(e=>e.json()).then(e=>{e&&!e.error&&(f(e),C.current||(C.current=!0,setTimeout(()=>D(e),50)))}).catch(()=>{})},[]),(0,N.useEffect)(()=>()=>{if(y.current&&!y.current.closed){rg({wasPoppedOut:!0});try{y.current.close()}catch{}}j.current&&(clearInterval(j.current),j.current=null)},[]);let S=(0,N.useCallback)(async e=>{try{let t=await fetch((0,nY.api)(`/api/files?path=${encodeURIComponent(e)}`)),n=await t.json();return{items:n.items||[],parent:n.parent||null}}catch{return{items:[],parent:null}}},[]);(0,N.useEffect)(()=>{s&&(g(!0),S(s).then(e=>{c(e.items),u(e.parent),g(!1)}))},[s,S]);let E=async e=>{if(e.isDir)h(t=>{let n=new Set(t);return n.has(e.path)?n.delete(e.path):n.add(e.path),n});else try{let t=await fetch((0,nY.api)(`/api/files?file=${encodeURIComponent(e.path)}`)),n=await t.json();f(n),rg({lastFilePath:e.path})}catch{f({name:e.name,path:e.path,size:0,ext:e.ext||"",error:"Failed to load"})}},D=e=>{let t=rm(),n=t.w||800,r=t.h||600,a=t.x||window.screenX+(window.outerWidth-n)/2,i=t.y||window.screenY+(window.outerHeight-r)/2,s=window.open("about:blank","spaces-file-viewer",`width=${n},height=${r},left=${a},top=${i}`);if(s){var l;y.current=s,v(!0),rg({wasPoppedOut:!0}),l=e.name,s.document.write(`<!DOCTYPE html><html><head><title>${l} — Spaces</title>
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,609799,e=>{"use strict";let t,n,r;var a,i,s,l,o,c,d,u,p,h,x,f,m,g,b,v,y,w,j,z=e.i(843476),N=e.i(271645),k=e.i(107233),C=e.i(531278),S=e.i(868054),E=e.i(555436),D=e.i(686311),M=e.i(75505),P=e.i(503116),T=e.i(664659),R=e.i(463059),L=e.i(475254);let I=(0,L.default)("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);var O=e.i(727612),$=e.i(788699),A=e.i(643531),F=e.i(37727),B=e.i(174886),U=e.i(694351);let _=(0,L.default)("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"}]]),H=(0,L.default)("arrow-left-to-line",[["path",{d:"M3 19V5",key:"rwsyhb"}],["path",{d:"m13 6-6 6 6 6",key:"1yhaz7"}],["path",{d:"M7 12h14",key:"uoisry"}]]);var W=e.i(248256),K=e.i(63209),G=e.i(761911),X=e.i(455711),J=e.i(398361);let q=(0,L.default)("wand-sparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);var Y=e.i(618566),V=e.i(424134),Q=e.i(174080);let Z="u">typeof window&&void 0!==window.document&&void 0!==window.document.createElement;function ee(e){let t=Object.prototype.toString.call(e);return"[object Window]"===t||"[object global]"===t}function et(e){return"nodeType"in e}function en(e){var t,n;return e?ee(e)?e:et(e)&&null!=(t=null==(n=e.ownerDocument)?void 0:n.defaultView)?t:window:window}function er(e){let{Document:t}=en(e);return e instanceof t}function ea(e){return!ee(e)&&e instanceof en(e).HTMLElement}function ei(e){return e instanceof en(e).SVGElement}function es(e){return e?ee(e)?e.document:et(e)?er(e)?e:ea(e)||ei(e)?e.ownerDocument:document:document:document}let el=Z?N.useLayoutEffect:N.useEffect;function eo(e){let t=(0,N.useRef)(e);return el(()=>{t.current=e}),(0,N.useCallback)(function(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];return null==t.current?void 0:t.current(...n)},[])}function ec(e,t){void 0===t&&(t=[e]);let n=(0,N.useRef)(e);return el(()=>{n.current!==e&&(n.current=e)},t),n}function ed(e,t){let n=(0,N.useRef)();return(0,N.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function eu(e){let t=eo(e),n=(0,N.useRef)(null),r=(0,N.useCallback)(e=>{e!==n.current&&(null==t||t(e,n.current)),n.current=e},[]);return[n,r]}function ep(e){let t=(0,N.useRef)();return(0,N.useEffect)(()=>{t.current=e},[e]),t.current}let eh={};function ex(e,t){return(0,N.useMemo)(()=>{if(t)return t;let n=null==eh[e]?0:eh[e]+1;return eh[e]=n,e+"-"+n},[e,t])}function ef(e){return function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return r.reduce((t,n)=>{for(let[r,a]of Object.entries(n)){let n=t[r];null!=n&&(t[r]=n+e*a)}return t},{...t})}}let em=ef(1),eg=ef(-1);function eb(e){if(!e)return!1;let{KeyboardEvent:t}=en(e.target);return t&&e instanceof t}function ev(e){if(function(e){if(!e)return!1;let{TouchEvent:t}=en(e.target);return t&&e instanceof t}(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return"clientX"in e&&"clientY"in e?{x:e.clientX,y:e.clientY}:null}let ey=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[ey.Translate.toString(e),ey.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),ew="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]",ej={display:"none"};function ez(e){let{id:t,value:n}=e;return N.default.createElement("div",{id:t,style:ej},n)}function eN(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;return N.default.createElement("div",{id:t,style:{position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"},role:"status","aria-live":r,"aria-atomic":!0},n)}let ek=(0,N.createContext)(null),eC={draggable:"\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n "},eS={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function eE(e){var t;let n,{announcements:r=eS,container:a,hiddenTextDescribedById:i,screenReaderInstructions:s=eC}=e,{announce:l,announcement:o}=function(){let[e,t]=(0,N.useState)("");return{announce:(0,N.useCallback)(e=>{null!=e&&t(e)},[]),announcement:e}}(),c=ex("DndLiveRegion"),[d,u]=(0,N.useState)(!1);if((0,N.useEffect)(()=>{u(!0)},[]),t=(0,N.useMemo)(()=>({onDragStart(e){let{active:t}=e;l(r.onDragStart({active:t}))},onDragMove(e){let{active:t,over:n}=e;r.onDragMove&&l(r.onDragMove({active:t,over:n}))},onDragOver(e){let{active:t,over:n}=e;l(r.onDragOver({active:t,over:n}))},onDragEnd(e){let{active:t,over:n}=e;l(r.onDragEnd({active:t,over:n}))},onDragCancel(e){let{active:t,over:n}=e;l(r.onDragCancel({active:t,over:n}))}}),[l,r]),n=(0,N.useContext)(ek),(0,N.useEffect)(()=>{if(!n)throw Error("useDndMonitor must be used within a children of <DndContext>");return n(t)},[t,n]),!d)return null;let p=N.default.createElement(N.default.Fragment,null,N.default.createElement(ez,{id:i,value:s.draggable}),N.default.createElement(eN,{id:c,announcement:o}));return a?(0,Q.createPortal)(p,a):p}function eD(){}function eM(e,t){return(0,N.useMemo)(()=>({sensor:e,options:null!=t?t:{}}),[e,t])}(a=h||(h={})).DragStart="dragStart",a.DragMove="dragMove",a.DragEnd="dragEnd",a.DragCancel="dragCancel",a.DragOver="dragOver",a.RegisterDroppable="registerDroppable",a.SetDroppableDisabled="setDroppableDisabled",a.UnregisterDroppable="unregisterDroppable";let eP=Object.freeze({x:0,y:0});function eT(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function eR(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function eL(e,t,n){return void 0===t&&(t=e.left),void 0===n&&(n=e.top),{x:t+.5*e.width,y:n+.5*e.height}}let eI=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,a=eL(t,t.left,t.top),i=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){var s;let n=(s=eL(r),Math.sqrt(Math.pow(s.x-a.x,2)+Math.pow(s.y-a.y,2)));i.push({id:t,data:{droppableContainer:e,value:n}})}}return i.sort(eT)},eO=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,a=[];for(let e of r){let{id:r}=e,i=n.get(r);if(i){let n=function(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),a=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height);if(r<a&&n<i){let s=t.width*t.height,l=e.width*e.height,o=(a-r)*(i-n);return Number((o/(s+l-o)).toFixed(4))}return 0}(i,t);n>0&&a.push({id:r,data:{droppableContainer:e,value:n}})}}return a.sort(eR)};function e$(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:eP}let eA=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return n.reduce((e,t)=>({...e,top:e.top+ +t.y,bottom:e.bottom+ +t.y,left:e.left+ +t.x,right:e.right+ +t.x}),{...e})},eF={ignoreTransform:!1};function eB(e,t){void 0===t&&(t=eF);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=en(e).getComputedStyle(e);t&&(n=function(e,t,n){let r=function(e){if(e.startsWith("matrix3d(")){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}if(e.startsWith("matrix(")){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}(t);if(!r)return e;let{scaleX:a,scaleY:i,x:s,y:l}=r,o=e.left-s-(1-a)*parseFloat(n),c=e.top-l-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),d=a?e.width/a:e.width,u=i?e.height/i:e.height;return{width:d,height:u,top:c,right:o+d,bottom:c+u,left:o}}(n,t,r))}let{top:r,left:a,width:i,height:s,bottom:l,right:o}=n;return{top:r,left:a,width:i,height:s,bottom:l,right:o}}function eU(e){return eB(e,{ignoreTransform:!0})}function e_(e,t){let n=[];return e?function r(a){var i,s;let l;if(null!=t&&n.length>=t||!a)return n;if(er(a)&&null!=a.scrollingElement&&!n.includes(a.scrollingElement))return n.push(a.scrollingElement),n;if(!ea(a)||ei(a)||n.includes(a))return n;let o=en(e).getComputedStyle(a);return(a!==e&&(void 0===(i=o)&&(i=en(a).getComputedStyle(a)),l=/(auto|scroll|overlay)/,["overflow","overflowX","overflowY"].some(e=>{let t=i[e];return"string"==typeof t&&l.test(t)}))&&n.push(a),void 0===(s=o)&&(s=en(a).getComputedStyle(a)),"fixed"===s.position)?n:r(a.parentNode)}(e):n}function eH(e){let[t]=e_(e,1);return null!=t?t:null}function eW(e){return Z&&e?ee(e)?e:et(e)?er(e)||e===es(e).scrollingElement?window:ea(e)?e:null:null:null}function eK(e){return ee(e)?e.scrollX:e.scrollLeft}function eG(e){return ee(e)?e.scrollY:e.scrollTop}function eX(e){return{x:eK(e),y:eG(e)}}function eJ(e){return!!Z&&!!e&&e===document.scrollingElement}function eq(e){let t={x:0,y:0},n=eJ(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},a=e.scrollTop<=t.y,i=e.scrollLeft<=t.x;return{isTop:a,isLeft:i,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}(i=x||(x={}))[i.Forward=1]="Forward",i[i.Backward=-1]="Backward";let eY={x:.2,y:.2};function eV(e){return e.reduce((e,t)=>em(e,eX(t)),eP)}let eQ=[["x",["left","right"],function(e){return e.reduce((e,t)=>e+eK(t),0)}],["y",["top","bottom"],function(e){return e.reduce((e,t)=>e+eG(t),0)}]];class eZ{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const n=e_(t),r=eV(n);for(const[t,a,i]of(this.rect={...e},this.width=e.width,this.height=e.height,eQ))for(const e of a)Object.defineProperty(this,e,{get:()=>{let a=i(n),s=r[t]-a;return this.rect[e]+s},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class e0{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>{var t;return null==(t=this.target)?void 0:t.removeEventListener(...e)})},this.target=e}add(e,t,n){var r;null==(r=this.target)||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}}function e1(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return"number"==typeof t?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t&&r>t.y}function e5(e){e.preventDefault()}function e2(e){e.stopPropagation()}(s=f||(f={})).Click="click",s.DragStart="dragstart",s.Keydown="keydown",s.ContextMenu="contextmenu",s.Resize="resize",s.SelectionChange="selectionchange",s.VisibilityChange="visibilitychange",(l=m||(m={})).Space="Space",l.Down="ArrowDown",l.Right="ArrowRight",l.Left="ArrowLeft",l.Up="ArrowUp",l.Esc="Escape",l.Enter="Enter",l.Tab="Tab";let e3={start:[m.Space,m.Enter],cancel:[m.Esc],end:[m.Space,m.Enter,m.Tab]},e4=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case m.Right:return{...n,x:n.x+25};case m.Left:return{...n,x:n.x-25};case m.Down:return{...n,y:n.y+25};case m.Up:return{...n,y:n.y-25}}};class e6{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:t}}=e;this.props=e,this.listeners=new e0(es(t)),this.windowListeners=new e0(en(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(f.Resize,this.handleCancel),this.windowListeners.add(f.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(f.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&function(e,t){if(void 0===t&&(t=eB),!e)return;let{top:n,left:r,bottom:a,right:i}=t(e);eH(e)&&(a<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}(n),t(eP)}handleKeyDown(e){if(eb(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:a=e3,coordinateGetter:i=e4,scrollBehavior:s="smooth"}=r,{code:l}=e;if(a.end.includes(l))return void this.handleEnd(e);if(a.cancel.includes(l))return void this.handleCancel(e);let{collisionRect:o}=n.current,c=o?{x:o.left,y:o.top}:eP;this.referenceCoordinates||(this.referenceCoordinates=c);let d=i(e,{active:t,context:n.current,currentCoordinates:c});if(d){let t=eg(d,c),r={x:0,y:0},{scrollableAncestors:a}=n.current;for(let n of a){let a=e.code,{isTop:i,isRight:l,isLeft:o,isBottom:c,maxScroll:u,minScroll:p}=eq(n),h=function(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:a}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:a,width:e.clientWidth,height:e.clientHeight}}(n),x={x:Math.min(a===m.Right?h.right-h.width/2:h.right,Math.max(a===m.Right?h.left:h.left+h.width/2,d.x)),y:Math.min(a===m.Down?h.bottom-h.height/2:h.bottom,Math.max(a===m.Down?h.top:h.top+h.height/2,d.y))},f=a===m.Right&&!l||a===m.Left&&!o,g=a===m.Down&&!c||a===m.Up&&!i;if(f&&x.x!==d.x){let e=n.scrollLeft+t.x,i=a===m.Right&&e<=u.x||a===m.Left&&e>=p.x;if(i&&!t.y)return void n.scrollTo({left:e,behavior:s});i?r.x=n.scrollLeft-e:r.x=a===m.Right?n.scrollLeft-u.x:n.scrollLeft-p.x,r.x&&n.scrollBy({left:-r.x,behavior:s});break}if(g&&x.y!==d.y){let e=n.scrollTop+t.y,i=a===m.Down&&e<=u.y||a===m.Up&&e>=p.y;if(i&&!t.x)return void n.scrollTo({top:e,behavior:s});i?r.y=n.scrollTop-e:r.y=a===m.Down?n.scrollTop-u.y:n.scrollTop-p.y,r.y&&n.scrollBy({top:-r.y,behavior:s});break}}this.handleMove(e,em(eg(d,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}function e8(e){return!!(e&&"distance"in e)}function e7(e){return!!(e&&"delay"in e)}e6.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=e3,onActivation:a}=t,{active:i}=n,{code:s}=e.nativeEvent;if(r.start.includes(s)){let t=i.activatorNode.current;return(!t||e.target===t)&&(e.preventDefault(),null==a||a({event:e.nativeEvent}),!0)}return!1}}];class e9{constructor(e,t,n){var r;void 0===n&&(n=function(e){let{EventTarget:t}=en(e);return e instanceof t?e:es(e)}(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;const{event:a}=e,{target:i}=a;this.props=e,this.events=t,this.document=es(i),this.documentListeners=new e0(this.document),this.listeners=new e0(n),this.windowListeners=new e0(en(i)),this.initialCoordinates=null!=(r=ev(a))?r:eP,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(f.Resize,this.handleCancel),this.windowListeners.add(f.DragStart,e5),this.windowListeners.add(f.VisibilityChange,this.handleCancel),this.windowListeners.add(f.ContextMenu,e5),this.documentListeners.add(f.Keydown,this.handleKeydown),t){if(null!=n&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(e7(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(e8(t))return void this.handlePending(t)}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(f.Click,e2,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(f.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){var t;let{activated:n,initialCoordinates:r,props:a}=this,{onMove:i,options:{activationConstraint:s}}=a;if(!r)return;let l=null!=(t=ev(e))?t:eP,o=eg(r,l);if(!n&&s){if(e8(s)){if(null!=s.tolerance&&e1(o,s.tolerance))return this.handleCancel();if(e1(o,s.distance))return this.handleStart()}return e7(s)&&e1(o,s.tolerance)?this.handleCancel():void this.handlePending(s,o)}e.cancelable&&e.preventDefault(),i(l)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===m.Esc&&this.handleCancel()}removeTextSelection(){var e;null==(e=this.document.getSelection())||e.removeAllRanges()}}let te={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class tt extends e9{constructor(e){const{event:t}=e;super(e,te,es(t.target))}}tt.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!!n.isPrimary&&0===n.button&&(null==r||r({event:n}),!0)}}];(o=g||(g={}))[o.RightClick=2]="RightClick";(c=b||(b={}))[c.Pointer=0]="Pointer",c[c.DraggableRect=1]="DraggableRect",(d=v||(v={}))[d.TreeOrder=0]="TreeOrder",d[d.ReversedTreeOrder=1]="ReversedTreeOrder";let tn={x:{[x.Backward]:!1,[x.Forward]:!1},y:{[x.Backward]:!1,[x.Forward]:!1}};(u=y||(y={}))[u.Always=0]="Always",u[u.BeforeDragging=1]="BeforeDragging",u[u.WhileDragging=2]="WhileDragging",(w||(w={})).Optimized="optimized";let tr=new Map;function ta(e,t){return ed(n=>e?n||("function"==typeof t?t(e):e):null,[t,e])}function ti(e){let{callback:t,disabled:n}=e,r=eo(t),a=(0,N.useMemo)(()=>{if(n||"u"<typeof window||void 0===window.ResizeObserver)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,N.useEffect)(()=>()=>null==a?void 0:a.disconnect(),[a]),a}function ts(e){return new eZ(eB(e),e)}function tl(e,t,n){void 0===t&&(t=ts);let[r,a]=(0,N.useState)(null);function i(){a(r=>{if(!e)return null;if(!1===e.isConnected){var a;return null!=(a=null!=r?r:n)?a:null}let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let s=function(e){let{callback:t,disabled:n}=e,r=eo(t),a=(0,N.useMemo)(()=>{if(n||"u"<typeof window||void 0===window.MutationObserver)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,N.useEffect)(()=>()=>null==a?void 0:a.disconnect(),[a]),a}({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if("childList"===t&&r instanceof HTMLElement&&r.contains(e)){i();break}}}}),l=ti({callback:i});return el(()=>{i(),e?(null==l||l.observe(e),null==s||s.observe(document.body,{childList:!0,subtree:!0})):(null==l||l.disconnect(),null==s||s.disconnect())},[e]),r}let to=[];function tc(e,t){void 0===t&&(t=[]);let n=(0,N.useRef)(null);return(0,N.useEffect)(()=>{n.current=null},t),(0,N.useEffect)(()=>{let t=e!==eP;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?eg(e,n.current):eP}function td(e){return(0,N.useMemo)(()=>{let t,n;return e?(t=e.innerWidth,{top:0,left:0,right:t,bottom:n=e.innerHeight,width:t,height:n}):null},[e])}let tu=[],tp=[{sensor:tt,options:{}},{sensor:e6,options:{}}],th={current:{}},tx={draggable:{measure:eU},droppable:{measure:eU,strategy:y.WhileDragging,frequency:w.Optimized},dragOverlay:{measure:eB}};class tf extends Map{get(e){var t;return null!=e&&null!=(t=super.get(e))?t:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){var t,n;return null!=(t=null==(n=this.get(e))?void 0:n.node.current)?t:void 0}}let tm={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new tf,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:eD},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:tx,measureDroppableContainers:eD,windowRect:null,measuringScheduled:!1},tg={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:eD,draggableNodes:new Map,over:null,measureDroppableContainers:eD},tb=(0,N.createContext)(tg),tv=(0,N.createContext)(tm);function ty(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new tf}}}function tw(e,t){switch(t.type){case h.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case h.DragMove:if(null==e.draggable.active)return e;return{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case h.DragEnd:case h.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case h.RegisterDroppable:{let{element:n}=t,{id:r}=n,a=new tf(e.droppable.containers);return a.set(r,n),{...e,droppable:{...e.droppable,containers:a}}}case h.SetDroppableDisabled:{let{id:n,key:r,disabled:a}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let s=new tf(e.droppable.containers);return s.set(n,{...i,disabled:a}),{...e,droppable:{...e.droppable,containers:s}}}case h.UnregisterDroppable:{let{id:n,key:r}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let i=new tf(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function tj(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:a}=(0,N.useContext)(tb),i=ep(r),s=ep(null==n?void 0:n.id);return(0,N.useEffect)(()=>{if(!t&&!r&&i&&null!=s){if(!eb(i)||document.activeElement===i.target)return;let e=a.get(s);if(!e)return;let{activatorNode:t,node:n}=e;(t.current||n.current)&&requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=e.matches(ew)?e:e.querySelector(ew);if(t){t.focus();break}}})}},[r,t,a,s,i]),null}let tz=(0,N.createContext)({...eP,scaleX:1,scaleY:1});(p=j||(j={}))[p.Uninitialized=0]="Uninitialized",p[p.Initializing=1]="Initializing",p[p.Initialized=2]="Initialized";let tN=(0,N.memo)(function(e){var t,n,r,a,i,s,l,o;let c,d,u,p,f,m,g,w,{id:z,accessibility:k,autoScroll:C=!0,children:S,sensors:E=tp,collisionDetection:D=eO,measuring:M,modifiers:P,...T}=e,[R,L]=(0,N.useReducer)(tw,void 0,ty),[I,O]=function(){let[e]=(0,N.useState)(()=>new Set),t=(0,N.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,N.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>{var t;return null==(t=e[n])?void 0:t.call(e,r)})},[e]),t]}(),[$,A]=(0,N.useState)(j.Uninitialized),F=$===j.Initialized,{draggable:{active:B,nodes:U,translate:_},droppable:{containers:H}}=R,W=null!=B?U.get(B):null,K=(0,N.useRef)({initial:null,translated:null}),G=(0,N.useMemo)(()=>{var e;return null!=B?{id:B,data:null!=(e=null==W?void 0:W.data)?e:th,rect:K}:null},[B,W]),X=(0,N.useRef)(null),[J,q]=(0,N.useState)(null),[Y,V]=(0,N.useState)(null),ee=ec(T,Object.values(T)),et=ex("DndDescribedBy",z),er=(0,N.useMemo)(()=>H.getEnabled(),[H]),ei=(0,N.useMemo)(()=>({draggable:{...tx.draggable,...null==M?void 0:M.draggable},droppable:{...tx.droppable,...null==M?void 0:M.droppable},dragOverlay:{...tx.dragOverlay,...null==M?void 0:M.dragOverlay}}),[null==M?void 0:M.draggable,null==M?void 0:M.droppable,null==M?void 0:M.dragOverlay]),{droppableRects:es,measureDroppableContainers:eo,measuringScheduled:eh}=function(e,t){let{dragging:n,dependencies:r,config:a}=t,[i,s]=(0,N.useState)(null),{frequency:l,measure:o,strategy:c}=a,d=(0,N.useRef)(e),u=function(){switch(c){case y.Always:return!1;case y.BeforeDragging:return n;default:return!n}}(),p=ec(u),h=(0,N.useCallback)(function(e){void 0===e&&(e=[]),p.current||s(t=>null===t?e:t.concat(e.filter(e=>!t.includes(e))))},[p]),x=(0,N.useRef)(null),f=ed(t=>{if(u&&!n)return tr;if(!t||t===tr||d.current!==e||null!=i){let t=new Map;for(let n of e){if(!n)continue;if(i&&i.length>0&&!i.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new eZ(o(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,i,n,u,o]);return(0,N.useEffect)(()=>{d.current=e},[e]),(0,N.useEffect)(()=>{u||h()},[n,u]),(0,N.useEffect)(()=>{i&&i.length>0&&s(null)},[JSON.stringify(i)]),(0,N.useEffect)(()=>{u||"number"!=typeof l||null!==x.current||(x.current=setTimeout(()=>{h(),x.current=null},l))},[l,u,h,...r]),{droppableRects:f,measureDroppableContainers:h,measuringScheduled:null!=i}}(er,{dragging:F,dependencies:[_.x,_.y],config:ei.droppable}),ef=ed(e=>{var t;return null==B?null:null!=(t=null!=f?f:e)?t:null},[f=(p=null!=B?U.get(B):void 0)?p.node.current:null,B]),eg=(0,N.useMemo)(()=>Y?ev(Y):null,[Y]),eb=(c=(null==J?void 0:J.autoScrollEnabled)===!1,d="object"==typeof C?!1===C.enabled:!1===C,u=F&&!c&&!d,"object"==typeof C?{...C,enabled:u}:{enabled:u}),ey=ta(ef,ei.draggable.measure);!function(e){let{activeNode:t,measure:n,initialRect:r,config:a=!0}=e,i=(0,N.useRef)(!1),{x:s,y:l}="boolean"==typeof a?{x:a,y:a}:a;el(()=>{if(!s&&!l||!t){i.current=!1;return}if(i.current||!r)return;let e=null==t?void 0:t.node.current;if(!e||!1===e.isConnected)return;let a=e$(n(e),r);if(s||(a.x=0),l||(a.y=0),i.current=!0,Math.abs(a.x)>0||Math.abs(a.y)>0){let t=eH(e);t&&t.scrollBy({top:a.y,left:a.x})}},[t,s,l,r,n])}({activeNode:null!=B?U.get(B):null,config:eb.layoutShiftCompensation,initialRect:ey,measure:ei.draggable.measure});let ew=tl(ef,ei.draggable.measure,ey),ej=tl(ef?ef.parentElement:null),ez=(0,N.useRef)({activatorEvent:null,active:null,activeNode:ef,collisionRect:null,collisions:null,droppableRects:es,draggableNodes:U,draggingNode:null,draggingNodeRect:null,droppableContainers:H,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),eN=H.getNodeFor(null==(t=ez.current.over)?void 0:t.id),eC=function(e){let{measure:t}=e,[n,r]=(0,N.useState)(null),a=ti({callback:(0,N.useCallback)(e=>{for(let{target:n}of e)if(ea(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[i,s]=eu((0,N.useCallback)(e=>{let n=function(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return ea(t)?t:e}(e);null==a||a.disconnect(),n&&(null==a||a.observe(n)),r(n?t(n):null)},[t,a]));return(0,N.useMemo)(()=>({nodeRef:i,rect:n,setRef:s}),[n,i,s])}({measure:ei.dragOverlay.measure}),eS=null!=(n=eC.nodeRef.current)?n:ef,eD=F?null!=(r=eC.rect)?r:ew:null,eM=!!(eC.nodeRef.current&&eC.rect),eT=(m=ta(i=eM?null:ew),e$(i,m)),eR=td(eS?en(eS):null),eL=(s=F?null!=eN?eN:ef:null,g=(0,N.useRef)(s),w=ed(e=>s?e&&e!==to&&s&&g.current&&s.parentNode===g.current.parentNode?e:e_(s):to,[s]),(0,N.useEffect)(()=>{g.current=s},[s]),w),eI=function(e,t){void 0===t&&(t=eB);let[n]=e,r=td(n?en(n):null),[a,i]=(0,N.useState)(tu);function s(){i(()=>e.length?e.map(e=>eJ(e)?r:new eZ(t(e),e)):tu)}let l=ti({callback:s});return el(()=>{null==l||l.disconnect(),s(),e.forEach(e=>null==l?void 0:l.observe(e))},[e]),a}(eL),eF=function(e,t){let{transform:n,...r}=t;return null!=e&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}(P,{transform:{x:_.x-eT.x,y:_.y-eT.y,scaleX:1,scaleY:1},activatorEvent:Y,active:G,activeNodeRect:ew,containerNodeRect:ej,draggingNodeRect:eD,over:ez.current.over,overlayNodeRect:eC.rect,scrollableAncestors:eL,scrollableAncestorRects:eI,windowRect:eR}),eU=eg?em(eg,_):null,eK=function(e){let[t,n]=(0,N.useState)(null),r=(0,N.useRef)(e),a=(0,N.useCallback)(e=>{let t=eW(e.target);t&&n(e=>e?(e.set(t,eX(t)),new Map(e)):null)},[]);return(0,N.useEffect)(()=>{let t=r.current;if(e!==t){i(t);let s=e.map(e=>{let t=eW(e);return t?(t.addEventListener("scroll",a,{passive:!0}),[t,eX(t)]):null}).filter(e=>null!=e);n(s.length?new Map(s):null),r.current=e}return()=>{i(e),i(t)};function i(e){e.forEach(e=>{let t=eW(e);null==t||t.removeEventListener("scroll",a)})}},[a,e]),(0,N.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>em(e,t),eP):eV(e):eP,[e,t])}(eL),eG=tc(eK),eQ=tc(eK,[ew]),e0=em(eF,eG),e1=eD?eA(eD,eF):null,e5=G&&e1?D({active:G,collisionRect:e1,droppableRects:es,droppableContainers:er,pointerCoordinates:eU}):null,e2=function(e,t){if(!e||0===e.length)return null;let[n]=e;return n.id}(e5,0),[e3,e4]=(0,N.useState)(null),e6=(l=eM?eF:em(eF,eQ),o=null!=(a=null==e3?void 0:e3.rect)?a:null,{...l,scaleX:o&&ew?o.width/ew.width:1,scaleY:o&&ew?o.height/ew.height:1}),e8=(0,N.useRef)(null),e7=(0,N.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(null==X.current)return;let a=U.get(X.current);if(!a)return;let i=e.nativeEvent,s=new n({active:X.current,activeNode:a,event:i,options:r,context:ez,onAbort(e){if(!U.get(e))return;let{onDragAbort:t}=ee.current,n={id:e};null==t||t(n),I({type:"onDragAbort",event:n})},onPending(e,t,n,r){if(!U.get(e))return;let{onDragPending:a}=ee.current,i={id:e,constraint:t,initialCoordinates:n,offset:r};null==a||a(i),I({type:"onDragPending",event:i})},onStart(e){let t=X.current;if(null==t)return;let n=U.get(t);if(!n)return;let{onDragStart:r}=ee.current,a={activatorEvent:i,active:{id:t,data:n.data,rect:K}};(0,Q.unstable_batchedUpdates)(()=>{null==r||r(a),A(j.Initializing),L({type:h.DragStart,initialCoordinates:e,active:t}),I({type:"onDragStart",event:a}),q(e8.current),V(i)})},onMove(e){L({type:h.DragMove,coordinates:e})},onEnd:l(h.DragEnd),onCancel:l(h.DragCancel)});function l(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:a}=ez.current,s=null;if(t&&a){let{cancelDrop:l}=ee.current;s={activatorEvent:i,active:t,collisions:n,delta:a,over:r},e===h.DragEnd&&"function"==typeof l&&await Promise.resolve(l(s))&&(e=h.DragCancel)}X.current=null,(0,Q.unstable_batchedUpdates)(()=>{L({type:e}),A(j.Uninitialized),e4(null),q(null),V(null),e8.current=null;let t=e===h.DragEnd?"onDragEnd":"onDragCancel";if(s){let e=ee.current[t];null==e||e(s),I({type:t,event:s})}})}}e8.current=s},[U]),e9=(0,N.useCallback)((e,t)=>(n,r)=>{let a=n.nativeEvent,i=U.get(r);null!==X.current||!i||a.dndKit||a.defaultPrevented||!0===e(n,t.options,{active:i})&&(a.dndKit={capturedBy:t.sensor},X.current=r,e7(n,t))},[U,e7]),te=(0,N.useMemo)(()=>E.reduce((e,t)=>{let{sensor:n}=t;return[...e,...n.activators.map(e=>({eventName:e.eventName,handler:e9(e.handler,t)}))]},[]),[E,e9]);(0,N.useEffect)(()=>{if(!Z)return;let e=E.map(e=>{let{sensor:t}=e;return null==t.setup?void 0:t.setup()});return()=>{for(let t of e)null==t||t()}},E.map(e=>{let{sensor:t}=e;return t})),el(()=>{ew&&$===j.Initializing&&A(j.Initialized)},[ew,$]),(0,N.useEffect)(()=>{let{onDragMove:e}=ee.current,{active:t,activatorEvent:n,collisions:r,over:a}=ez.current;if(!t||!n)return;let i={active:t,activatorEvent:n,collisions:r,delta:{x:e0.x,y:e0.y},over:a};(0,Q.unstable_batchedUpdates)(()=>{null==e||e(i),I({type:"onDragMove",event:i})})},[e0.x,e0.y]),(0,N.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:a}=ez.current;if(!e||null==X.current||!t||!a)return;let{onDragOver:i}=ee.current,s=r.get(e2),l=s&&s.rect.current?{id:s.id,rect:s.rect.current,data:s.data,disabled:s.disabled}:null,o={active:e,activatorEvent:t,collisions:n,delta:{x:a.x,y:a.y},over:l};(0,Q.unstable_batchedUpdates)(()=>{e4(l),null==i||i(o),I({type:"onDragOver",event:o})})},[e2]),el(()=>{ez.current={activatorEvent:Y,active:G,activeNode:ef,collisionRect:e1,collisions:e5,droppableRects:es,draggableNodes:U,draggingNode:eS,draggingNodeRect:eD,droppableContainers:H,over:e3,scrollableAncestors:eL,scrollAdjustedTranslate:e0},K.current={initial:eD,translated:e1}},[G,ef,e5,e1,U,eS,eD,es,H,e3,eL,e0]),function(e){let t,{acceleration:n,activator:r=b.Pointer,canScroll:a,draggingRect:i,enabled:s,interval:l=5,order:o=v.TreeOrder,pointerCoordinates:c,scrollableAncestors:d,scrollableAncestorRects:u,delta:p,threshold:h}=e,f=function(e){let{delta:t,disabled:n}=e,r=ep(t);return ed(e=>{if(n||!r||!e)return tn;let a={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[x.Backward]:e.x[x.Backward]||-1===a.x,[x.Forward]:e.x[x.Forward]||1===a.x},y:{[x.Backward]:e.y[x.Backward]||-1===a.y,[x.Forward]:e.y[x.Forward]||1===a.y}}},[n,t,r])}({delta:p,disabled:!s}),[m,g]=(t=(0,N.useRef)(null),[(0,N.useCallback)((e,n)=>{t.current=setInterval(e,n)},[]),(0,N.useCallback)(()=>{null!==t.current&&(clearInterval(t.current),t.current=null)},[])]),y=(0,N.useRef)({x:0,y:0}),w=(0,N.useRef)({x:0,y:0}),j=(0,N.useMemo)(()=>{switch(r){case b.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case b.DraggableRect:return i}},[r,i,c]),z=(0,N.useRef)(null),k=(0,N.useCallback)(()=>{let e=z.current;if(!e)return;let t=y.current.x*w.current.x,n=y.current.y*w.current.y;e.scrollBy(t,n)},[]),C=(0,N.useMemo)(()=>o===v.TreeOrder?[...d].reverse():d,[o,d]);(0,N.useEffect)(()=>{if(!s||!d.length||!j)return void g();for(let e of C){if((null==a?void 0:a(e))===!1)continue;let t=u[d.indexOf(e)];if(!t)continue;let{direction:r,speed:i}=function(e,t,n,r,a){let{top:i,left:s,right:l,bottom:o}=n;void 0===r&&(r=10),void 0===a&&(a=eY);let{isTop:c,isBottom:d,isLeft:u,isRight:p}=eq(e),h={x:0,y:0},f={x:0,y:0},m={height:t.height*a.y,width:t.width*a.x};return!c&&i<=t.top+m.height?(h.y=x.Backward,f.y=r*Math.abs((t.top+m.height-i)/m.height)):!d&&o>=t.bottom-m.height&&(h.y=x.Forward,f.y=r*Math.abs((t.bottom-m.height-o)/m.height)),!p&&l>=t.right-m.width?(h.x=x.Forward,f.x=r*Math.abs((t.right-m.width-l)/m.width)):!u&&s<=t.left+m.width&&(h.x=x.Backward,f.x=r*Math.abs((t.left+m.width-s)/m.width)),{direction:h,speed:f}}(e,t,j,n,h);for(let e of["x","y"])f[e][r[e]]||(i[e]=0,r[e]=0);if(i.x>0||i.y>0){g(),z.current=e,m(k,l),y.current=i,w.current=r;return}}y.current={x:0,y:0},w.current={x:0,y:0},g()},[n,k,a,g,s,l,JSON.stringify(j),JSON.stringify(f),m,d,C,u,JSON.stringify(h)])}({...eb,delta:_,draggingRect:e1,pointerCoordinates:eU,scrollableAncestors:eL,scrollableAncestorRects:eI});let tt=(0,N.useMemo)(()=>({active:G,activeNode:ef,activeNodeRect:ew,activatorEvent:Y,collisions:e5,containerNodeRect:ej,dragOverlay:eC,draggableNodes:U,droppableContainers:H,droppableRects:es,over:e3,measureDroppableContainers:eo,scrollableAncestors:eL,scrollableAncestorRects:eI,measuringConfiguration:ei,measuringScheduled:eh,windowRect:eR}),[G,ef,ew,Y,e5,ej,eC,U,H,es,e3,eo,eL,eI,ei,eh,eR]),ts=(0,N.useMemo)(()=>({activatorEvent:Y,activators:te,active:G,activeNodeRect:ew,ariaDescribedById:{draggable:et},dispatch:L,draggableNodes:U,over:e3,measureDroppableContainers:eo}),[Y,te,G,ew,L,et,U,e3,eo]);return N.default.createElement(ek.Provider,{value:O},N.default.createElement(tb.Provider,{value:ts},N.default.createElement(tv.Provider,{value:tt},N.default.createElement(tz.Provider,{value:e6},S)),N.default.createElement(tj,{disabled:(null==k?void 0:k.restoreFocus)===!1})),N.default.createElement(eE,{...k,hiddenTextDescribedById:et}))}),tk=(0,N.createContext)(null),tC="button",tS={timeout:25},tE={position:"fixed",touchAction:"none"},tD=e=>eb(e)?"transform 250ms ease":void 0;function tM(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function tP(e){return null!==e&&e>=0}(e,t)=>{let{as:n,activatorEvent:r,adjustScale:a,children:i,className:s,rect:l,style:o,transform:c,transition:d=tD}=e;if(!l)return null;let u=a?c:{...c,scaleX:1,scaleY:1},p={...tE,width:l.width,height:l.height,top:l.top,left:l.left,transform:ey.Transform.toString(u),transformOrigin:a&&r?function(e,t){let n=ev(e);if(!n)return"0 0";let r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+"% "+r.y+"%"}(r,l):void 0,transition:"function"==typeof d?d(r):d,...o};return N.default.createElement(n,{className:s,style:p,ref:t},i)},r={styles:{active:{opacity:"0"}}};let tT=e=>{let{rects:t,activeIndex:n,overIndex:r,index:a}=e,i=tM(t,r,n),s=t[a],l=i[a];return l&&s?{x:l.left-s.left,y:l.top-s.top,scaleX:l.width/s.width,scaleY:l.height/s.height}:null},tR={scaleX:1,scaleY:1},tL=e=>{var t,n,r,a;let i,s,l,{activeIndex:o,activeNodeRect:c,index:d,rects:u,overIndex:p}=e,h=null!=(t=u[o])?t:c;if(!h)return null;if(d===o){let e=u[p];return e?{x:0,y:o<p?e.top+e.height-(h.top+h.height):e.top-h.top,...tR}:null}let x=(n=u,r=d,a=o,i=n[r],s=n[r-1],l=n[r+1],i?a<r?s?i.top-(s.top+s.height):l?l.top-(i.top+i.height):0:l?l.top-(i.top+i.height):s?i.top-(s.top+s.height):0:0);return d>o&&d<=p?{x:0,y:-h.height-x,...tR}:d<o&&d>=p?{x:0,y:h.height+x,...tR}:{x:0,y:0,...tR}},tI="Sortable",tO=N.default.createContext({activeIndex:-1,containerId:tI,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:tT,disabled:{draggable:!1,droppable:!1}});function t$(e){let{children:t,id:n,items:r,strategy:a=tT,disabled:i=!1}=e,{active:s,dragOverlay:l,droppableRects:o,over:c,measureDroppableContainers:d}=(0,N.useContext)(tv),u=ex(tI,n),p=null!==l.rect,h=(0,N.useMemo)(()=>r.map(e=>"object"==typeof e&&"id"in e?e.id:e),[r]),x=null!=s,f=s?h.indexOf(s.id):-1,m=c?h.indexOf(c.id):-1,g=(0,N.useRef)(h),b=!function(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}(h,g.current),v=-1!==m&&-1===f||b,y="boolean"==typeof i?{draggable:i,droppable:i}:i;el(()=>{b&&x&&d(h)},[b,h,x,d]),(0,N.useEffect)(()=>{g.current=h},[h]);let w=(0,N.useMemo)(()=>({activeIndex:f,containerId:u,disabled:y,disableTransforms:v,items:h,overIndex:m,useDragOverlay:p,sortedRects:h.reduce((e,t,n)=>{let r=o.get(t);return r&&(e[n]=r),e},Array(h.length)),strategy:a}),[f,u,y.draggable,y.droppable,v,h,m,o,p,a]);return N.default.createElement(tO.Provider,{value:w},t)}let tA=e=>{let{id:t,items:n,activeIndex:r,overIndex:a}=e;return tM(n,r,a).indexOf(t)},tF=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:a,items:i,newIndex:s,previousItems:l,previousContainerId:o,transition:c}=e;return!!c&&!!r&&(l===i||a!==s)&&(!!n||s!==a&&t===o)},tB={duration:200,easing:"ease"},tU="transform",t_=ey.Transition.toString({property:tU,duration:0,easing:"linear"}),tH={roleDescription:"sortable"};function tW({groupSize:e,panelElement:t,styleProp:n}){let r,[a,i]=function(e){switch(typeof e){case"number":return[e,"px"];case"string":{let t=parseFloat(e);return e.endsWith("%")?[t,"%"]:e.endsWith("px")?[t,"px"]:e.endsWith("rem")?[t,"rem"]:e.endsWith("em")?[t,"em"]:e.endsWith("vh")?[t,"vh"]:e.endsWith("vw")?[t,"vw"]:[t,"%"]}}}(n);switch(i){case"%":r=a/100*e;break;case"px":r=a;break;case"rem":r=a*parseFloat(getComputedStyle(t.ownerDocument.body).fontSize);break;case"em":r=a*parseFloat(getComputedStyle(t).fontSize);break;case"vh":r=a/100*window.innerHeight;break;case"vw":r=a/100*window.innerWidth}return r}function tK(e){return parseFloat(e.toFixed(3))}function tG({group:e}){let{orientation:t,panels:n}=e;return n.reduce((e,n)=>e+="horizontal"===t?n.element.offsetWidth:n.element.offsetHeight,0)}function tX(e){let{panels:t}=e,n=tG({group:e});return 0===n?t.map(e=>({groupResizeBehavior:e.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:!0===e.panelConstraints.collapsible,defaultSize:void 0,disabled:e.panelConstraints.disabled,minSize:0,maxSize:100,panelId:e.id})):t.map(e=>{let t,{element:r,panelConstraints:a}=e,i=0;void 0!==a.collapsedSize&&(i=tK(tW({groupSize:n,panelElement:r,styleProp:a.collapsedSize})/n*100)),void 0!==a.defaultSize&&(t=tK(tW({groupSize:n,panelElement:r,styleProp:a.defaultSize})/n*100));let s=0;void 0!==a.minSize&&(s=tK(tW({groupSize:n,panelElement:r,styleProp:a.minSize})/n*100));let l=100;return void 0!==a.maxSize&&(l=tK(tW({groupSize:n,panelElement:r,styleProp:a.maxSize})/n*100)),{groupResizeBehavior:a.groupResizeBehavior,collapsedSize:i,collapsible:!0===a.collapsible,defaultSize:t,disabled:a.disabled,minSize:s,maxSize:l,panelId:e.id}})}function tJ(e,t="Assertion error"){if(!e)throw Error(t)}function tq(e,t){return Array.from(t).sort("horizontal"===e?tY:tV)}function tY(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return 0!==n?n:e.element.offsetWidth-t.element.offsetWidth}function tV(e,t){let n=e.element.offsetTop-t.element.offsetTop;return 0!==n?n:e.element.offsetHeight-t.element.offsetHeight}function tQ(e){return null!==e&&"object"==typeof e&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function tZ(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function t0(e){let{element:n,orientation:r,panels:a,separators:i}=e,s=tq(r,Array.from(n.children).filter(tQ).map(e=>({element:e}))).map(({element:e})=>e),l=[],o=!1,c=!1,d=-1,u=-1,p=0,h,x=[];{let e=-1;for(let t of s)t.hasAttribute("data-panel")&&(e++,t.hasAttribute("data-disabled")||(p++,-1===d&&(d=e),u=e))}if(p>1){let n=-1;for(let p of s)if(p.hasAttribute("data-panel")){n++;let i=a.find(e=>e.element===p);if(i){if(h){let a,s=h.element.getBoundingClientRect(),f=p.getBoundingClientRect();if(c){let e="horizontal"===r?new DOMRect(s.right,s.top,0,s.height):new DOMRect(s.left,s.bottom,s.width,0),t="horizontal"===r?new DOMRect(f.left,f.top,0,f.height):new DOMRect(f.left,f.top,f.width,0);switch(x.length){case 0:a=[e,t];break;case 1:{let n=x[0],i=function({orientation:e,rects:t,targetRect:n}){let r={x:n.x+n.width/2,y:n.y+n.height/2},a,i=Number.MAX_VALUE;for(let n of t){let{x:t,y:s}=tZ(r,n),l="horizontal"===e?t:s;l<i&&(i=l,a=n)}return tJ(a,"No rect found"),a}({orientation:r,rects:[s,f],targetRect:n.element.getBoundingClientRect()});a=[n,i===s?t:e];break}default:a=x}}else a=x.length?x:["horizontal"===r?new DOMRect(s.right,f.top,f.left-s.right,f.height):new DOMRect(f.left,s.bottom,f.width,f.top-s.bottom)];for(let r of a){let a="width"in r?r:r.element.getBoundingClientRect(),s=(void 0===t&&(t="function"==typeof matchMedia&&!!matchMedia("(pointer:coarse)").matches),t)?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(a.width<s){let e=s-a.width;a=new DOMRect(a.x-e/2,a.y,a.width+e,a.height)}if(a.height<s){let e=s-a.height;a=new DOMRect(a.x,a.y-e/2,a.width,a.height+e)}let c=n<=d||n>u;o||c||l.push({group:e,groupSize:tG({group:e}),panels:[h,i],separator:"width"in r?void 0:r,rect:a}),o=!1}}c=!1,h=i,x=[]}}else if(p.hasAttribute("data-separator")){null!==p.ariaDisabled&&(o=!0);let e=i.find(e=>e.element===p);e?x.push(e):(h=void 0,x=[])}else c=!0}return l}m.Down,m.Right,m.Up,m.Left;class t1{#e={};addListener(e,t){let n=this.#e[e];return void 0===n?this.#e[e]=[t]:n.includes(t)||n.push(t),()=>{this.removeListener(e,t)}}emit(e,t){let n=this.#e[e];if(void 0!==n)if(1===n.length)n[0].call(null,t);else{let e=!1,r=null,a=Array.from(n);for(let n=0;n<a.length;n++){let i=a[n];try{i.call(null,t)}catch(t){null===r&&(e=!0,r=t)}}if(e)throw r}}removeAllListeners(){this.#e={}}removeListener(e,t){let n=this.#e[e];if(void 0!==n){let e=n.indexOf(t);e>=0&&n.splice(e,1)}}}let t5=new Map,t2=new t1;function t3(e,t){for(let[t]of t5)if(t.id===e)return t}function t4(e,t){for(let[t,n]of t5)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function t6(e,t){return t2.addListener("groupChange",n=>{n.group.id===e&&t(n)})}function t8(e,t){let n=t5.get(e);(t5=new Map(t5)).set(e,t),t2.emit("groupChange",{group:e,prev:n,next:t})}let t7=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function t9(e){let t=e.length;for(;t--;){let n=e[t];if(tJ(n,"Missing node"),function(e){let t,n=getComputedStyle(e);return!!("fixed"===n.position||"auto"!==n.zIndex&&("static"!==n.position||"flex"===(t=getComputedStyle(nn(e)??e).display)||"inline-flex"===t)||1>+n.opacity||"transform"in n&&"none"!==n.transform||"webkitTransform"in n&&"none"!==n.webkitTransform||"mixBlendMode"in n&&"normal"!==n.mixBlendMode||"filter"in n&&"none"!==n.filter||"webkitFilter"in n&&"none"!==n.webkitFilter||"isolation"in n&&"isolate"===n.isolation||t7.test(n.willChange)||"touch"===n.webkitOverflowScrolling)}(n))return n}return null}function ne(e){return e&&Number(getComputedStyle(e).zIndex)||0}function nt(e){let t=[];for(;e;)t.push(e),e=nn(e);return t}function nn(e){let{parentNode:t}=e;return null!==t&&"object"==typeof t&&"nodeType"in t&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE?t.host:t}function nr(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let a=t0(r),i=function(e,t,n){let r,a={x:1/0,y:1/0};for(let i of t){let t=tZ(n,i.rect);switch(e){case"horizontal":t.x<=a.x&&(r=i,a=t);break;case"vertical":t.y<=a.y&&(r=i,a=t)}}return r?{distance:a,hitRegion:r}:void 0}(r.orientation,a,{x:e.clientX,y:e.clientY});i&&i.distance.x<=0&&i.distance.y<=0&&function({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!tQ(n)||n.contains(e)||e.contains(n))return!0;if(function(e,t){let n;if(e===t)throw Error("Cannot compare node with itself");let r={a:nt(e),b:nt(t)};for(;r.a.at(-1)===r.b.at(-1);)n=r.a.pop(),r.b.pop();tJ(n,"Stacking order can only be calculated for elements with a common ancestor");let a={a:ne(t9(r.a)),b:ne(t9(r.b))};if(a.a===a.b){let e=n.childNodes,t={a:r.a.at(-1),b:r.b.at(-1)},a=e.length;for(;a--;){let n=e[a];if(n===t.a)return 1;if(n===t.b)return -1}}return Math.sign(a.a-a.b)}(n,e)>0){let a=n;for(;a;){var r;if(a.contains(e))break;if(r=a.getBoundingClientRect(),r.x<t.x+t.width&&r.x+r.width>t.x&&r.y<t.y+t.height&&r.y+r.height>t.y)return!1;a=a.parentElement}}return!0}({groupElement:r.element,hitRegion:i.hitRegion.rect,pointerEventTarget:e.target})&&n.push(i.hitRegion)}),n}function na(e,t,n=0){return Math.abs(tK(e)-tK(t))<=n}function ni(e,t){return na(e,t)?0:e>t?1:-1}function ns({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:r}){let{collapsedSize:a=0,collapsible:i,disabled:s,maxSize:l=100,minSize:o=0}=t;return s&&!e?n:(0>ni(r,o)&&(r=i&&0>ni(r,(a+o)/2)?a:o),tK(r=Math.min(l,r)))}function nl({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:a,trigger:i}){if(na(e,0))return t;let s="imperative-api"===i,l=Object.values(t),o=Object.values(a),c=[...l],[d,u]=r;tJ(null!=d,"Invalid first pivot index"),tJ(null!=u,"Invalid second pivot index");let p=0;if("keyboard"===i){{let t=e<0?u:d,r=n[t];tJ(r,`Panel constraints not found for index ${t}`);let{collapsedSize:a=0,collapsible:i,minSize:s=0}=r;if(i){let n=l[t];if(tJ(null!=n,`Previous layout not found for panel index ${t}`),na(n,a)){let t=s-n;ni(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?d:u,r=n[t];tJ(r,`No panel constraints found for index ${t}`);let{collapsedSize:a=0,collapsible:i,minSize:s=0}=r;if(i){let n=l[t];if(tJ(null!=n,`Previous layout not found for panel index ${t}`),na(n,s)){let t=n-a;ni(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}}else{let t=e<0?u:d,r=n[t];tJ(r,`Panel constraints not found for index ${t}`);let a=l[t],{collapsible:i,collapsedSize:s,minSize:o}=r;if(i&&0>ni(a,o))if(e>0){let t=o-s;0>ni(a+e,o)&&(e=0>=ni(e,t/2)?0:t)}else{let t=o-s;0>ni(a-e,o)&&(e=ni(100+e,100-t/2)>0?0:-t)}}{let t=e<0?1:-1,r=e<0?u:d,a=0;for(;;){let e=l[r];if(tJ(null!=e,`Previous layout not found for panel index ${r}`),a+=ns({overrideDisabledPanels:s,panelConstraints:n[r],prevSize:e,size:100})-e,(r+=t)<0||r>=n.length)break}let i=Math.min(Math.abs(e),Math.abs(a));e=e<0?0-i:i}{let t=e<0?d:u;for(;t>=0&&t<n.length;){let r=Math.abs(e)-Math.abs(p),a=l[t];tJ(null!=a,`Previous layout not found for panel index ${t}`);let i=a-r,o=ns({overrideDisabledPanels:s,panelConstraints:n[t],prevSize:a,size:i});if(!na(a,o)&&(p+=a-o,c[t]=o,p.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?t--:t++}}if(function(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}(o,c))return a;{let t=e<0?u:d,r=l[t];tJ(null!=r,`Previous layout not found for panel index ${t}`);let a=r+p,i=ns({overrideDisabledPanels:s,panelConstraints:n[t],prevSize:r,size:a});if(c[t]=i,!na(i,a)){let t=a-i,r=e<0?u:d;for(;r>=0&&r<n.length;){let a=c[r];tJ(null!=a,`Previous layout not found for panel index ${r}`);let i=a+t,l=ns({overrideDisabledPanels:s,panelConstraints:n[r],prevSize:a,size:i});if(na(a,l)||(t-=l-a,c[r]=l),na(t,0))break;e>0?r--:r++}}}if(!na(Object.values(c).reduce((e,t)=>t+e,0),100,.1))return a;let h=Object.keys(a);return c.reduce((e,t,n)=>(e[h[n]]=t,e),{})}function no(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(void 0===t[n]||0!==ni(e[n],t[n]))return!1;return!0}function nc({layout:e,panelConstraints:t}){let n=Object.values(e),r=[...n],a=r.reduce((e,t)=>e+t,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(e=>`${e}%`).join(", ")}`);if(!na(a,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];tJ(null!=t,`No layout data found for index ${e}`);let n=100/a*t;r[e]=n}let i=0;for(let e=0;e<t.length;e++){let a=n[e];tJ(null!=a,`No layout data found for index ${e}`);let s=r[e];tJ(null!=s,`No layout data found for index ${e}`);let l=ns({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:a,size:s});s!=l&&(i+=s-l,r[e]=l)}if(!na(i,0))for(let e=0;e<t.length;e++){let n=r[e];tJ(null!=n,`No layout data found for index ${e}`);let a=n+i,s=ns({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:a});if(n!==s&&(i-=s-n,r[e]=s,na(i,0)))break}let s=Object.keys(e);return r.reduce((e,t,n)=>(e[s[n]]=t,e),{})}function nd({groupId:e,panelId:t}){let n=()=>{for(let[t,{defaultLayoutDeferred:n,derivedPanelConstraints:r,layout:a,groupSize:i,separatorToPanels:s}]of t5)if(t.id===e)return{defaultLayoutDeferred:n,derivedPanelConstraints:r,group:t,groupSize:i,layout:a,separatorToPanels:s};throw Error(`Group ${e} not found`)},r=()=>{let e=n().derivedPanelConstraints.find(e=>e.panelId===t);if(void 0!==e)return e;throw Error(`Panel constraints not found for Panel ${t}`)},a=()=>{let e=n().group.panels.find(e=>e.id===t);if(void 0!==e)return e;throw Error(`Layout not found for Panel ${t}`)},i=()=>{let e=n().layout[t];if(void 0!==e)return e;throw Error(`Layout not found for Panel ${t}`)},s=e=>{let r=i();if(e===r)return;let{defaultLayoutDeferred:a,derivedPanelConstraints:s,group:l,groupSize:o,layout:c,separatorToPanels:d}=n(),u=l.panels.findIndex(e=>e.id===t),p=u===l.panels.length-1,h=nc({layout:nl({delta:p?r-e:e-r,initialLayout:c,panelConstraints:s,pivotIndices:p?[u-1,u]:[u,u+1],prevLayout:c,trigger:"imperative-api"}),panelConstraints:s});no(c,h)||t8(l,{defaultLayoutDeferred:a,derivedPanelConstraints:s,groupSize:o,layout:h,separatorToPanels:d})};return{collapse:()=>{let{collapsible:e,collapsedSize:t}=r(),{mutableValues:n}=a(),l=i();e&&l!==t&&(n.expandToSize=l,s(t))},expand:()=>{let{collapsible:e,collapsedSize:t,minSize:n}=r(),{mutableValues:l}=a(),o=i();if(e&&o===t){let e=l.expandToSize??n;0===e&&(e=1),s(e)}},getSize:()=>{let{group:e}=n(),t=i(),{element:r}=a();return{asPercentage:t,inPixels:"horizontal"===e.orientation?r.offsetWidth:r.offsetHeight}},isCollapsed:()=>{let{collapsible:e,collapsedSize:t}=r(),n=i();return e&&na(t,n)},resize:e=>{let{group:t}=n(),{element:r}=a(),i=tG({group:t});s(tK(tW({groupSize:i,panelElement:r,styleProp:e})/i*100))}}}function nu(e){e.defaultPrevented||nr(e,t5).forEach(t=>{if(t.separator){let n=t.panels.find(e=>void 0!==e.panelConstraints.defaultSize);if(n){let r=n.panelConstraints.defaultSize,a=nd({groupId:t.group.id,panelId:n.id});a&&void 0!==r&&(a.resize(r),e.preventDefault())}}})}function np(e){for(let[t]of t5)if(t.separators.some(t=>t.element===e))return t;throw Error("Could not find parent Group for separator element")}function nh({groupId:e}){let t=()=>{for(let[t,n]of t5)if(t.id===e)return{group:t,...n};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){let{defaultLayoutDeferred:e,layout:n}=t();return e?{}:n},setLayout(e){let{defaultLayoutDeferred:n,derivedPanelConstraints:r,group:a,groupSize:i,layout:s,separatorToPanels:l}=t(),o=nc({layout:e,panelConstraints:r});return n?s:(no(s,o)||t8(a,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:i,layout:o,separatorToPanels:l}),o)}}}function nx(e,t){let n=np(e),r=t4(n.id,!0),a=n.separators.find(t=>t.element===e);tJ(a,"Matching separator not found");let i=r.separatorToPanels.get(a);tJ(i,"Matching panels not found");let s=i.map(e=>n.panels.indexOf(e)),l=nh({groupId:n.id}).getLayout(),o=nc({layout:nl({delta:t,initialLayout:l,panelConstraints:r.derivedPanelConstraints,pivotIndices:s,prevLayout:l,trigger:"keyboard"}),panelConstraints:r.derivedPanelConstraints});no(l,o)||t8(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:o,separatorToPanels:r.separatorToPanels})}function nf(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=np(t);if(!n.disabled)switch(e.key){case"ArrowDown":e.preventDefault(),"vertical"===n.orientation&&nx(t,5);break;case"ArrowLeft":e.preventDefault(),"horizontal"===n.orientation&&nx(t,-5);break;case"ArrowRight":e.preventDefault(),"horizontal"===n.orientation&&nx(t,5);break;case"ArrowUp":e.preventDefault(),"vertical"===n.orientation&&nx(t,-5);break;case"End":e.preventDefault(),nx(t,100);break;case"Enter":{e.preventDefault();let n=np(t),{derivedPanelConstraints:r,layout:a,separatorToPanels:i}=t4(n.id,!0),s=n.separators.find(e=>e.element===t);tJ(s,"Matching separator not found");let l=i.get(s);tJ(l,"Matching panels not found");let o=l[0],c=r.find(e=>e.panelId===o.id);if(tJ(c,"Panel metadata not found"),c.collapsible){let e=a[o.id];nx(t,(c.collapsedSize===e?n.mutableState.expandedPanelSizes[o.id]??c.minSize:c.collapsedSize)-e)}break}case"F6":{e.preventDefault();let n=np(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);tJ(null!==r,"Index not found");let a=e.shiftKey?r>0?r-1:n.length-1:r+1<n.length?r+1:0;n[a].focus({preventScroll:!0});break}case"Home":e.preventDefault(),nx(t,-100)}}let nm={cursorFlags:0,state:"inactive"},ng=new t1;function nb(e){let t=nm;nm=e,ng.emit("change",{prev:t,next:e})}function nv(e){if(e.defaultPrevented||"mouse"===e.pointerType&&e.button>0)return;let t=t5,n=nr(e,t),r=new Map,a=!1;n.forEach(e=>{e.separator&&(a||(a=!0,e.separator.element.focus({preventScroll:!0})));let n=t.get(e.group);n&&r.set(e.group,n.layout)}),nb({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}),n.length&&e.preventDefault()}let ny=e=>e,nw=()=>{};function nj(){return void 0===n&&(n=!1,"u">typeof window&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(n=!0)),n}let nz=new WeakMap;function nN(e){if(null===e.defaultView||void 0===e.defaultView)return;let{prevStyle:t,styleSheet:n}=nz.get(e)??{};void 0===n&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(n));let r=nm;switch(r.state){case"active":case"hover":{let e=function({cursorFlags:e,groups:t,state:n}){let r=0,a=0;switch(n){case"active":case"hover":t.forEach(e=>{if(!e.mutableState.disableCursor)switch(e.orientation){case"horizontal":r++;break;case"vertical":a++}})}if(0!==r||0!==a){if("active"===n&&e&&nj()){let t=(4&e)!=0,n=(8&e)!=0;if((1&e)!=0)return t?"se-resize":n?"ne-resize":"e-resize";if((2&e)!=0)return t?"sw-resize":n?"nw-resize":"w-resize";if(t)return"s-resize";if(n)return"n-resize"}return nj()?r>0&&a>0?"move":r>0?"ew-resize":"ns-resize":r>0&&a>0?"grab":r>0?"col-resize":"row-resize"}}({cursorFlags:r.cursorFlags,groups:r.hitRegions.map(e=>e.group),state:r.state}),a=`*, *:hover {cursor: ${e} !important; }`;if(t===a)return;t=a,e?0===n.cssRules.length?n.insertRule(a):n.replaceSync(a):1===n.cssRules.length&&n.deleteRule(0);break}case"inactive":t=void 0,1===n.cssRules.length&&n.deleteRule(0)}nz.set(e,{prevStyle:t,styleSheet:n})}function nk({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:a,pointerDownAtPoint:i,prevCursorFlags:s}){var l;let o,c,d=0;n.forEach(e=>{let{group:n,groupSize:s}=e,{orientation:l,panels:o}=n,{disableCursor:c}=n.mutableState,u=0;u=i?"horizontal"===l?(t.clientX-i.x)/s*100:(t.clientY-i.y)/s*100:"horizontal"===l?t.clientX<0?-100:100:t.clientY<0?-100:100;let p=r.get(n),h=a.get(n);if(!p||!h)return;let{defaultLayoutDeferred:x,derivedPanelConstraints:f,groupSize:m,layout:g,separatorToPanels:b}=h;if(f&&g&&b){let t=nl({delta:u,initialLayout:p,panelConstraints:f,pivotIndices:e.panels.map(e=>o.indexOf(e)),prevLayout:g,trigger:"mouse-or-touch"});if(no(t,g)){if(0!==u&&!c)switch(l){case"horizontal":d|=u<0?1:2;break;case"vertical":d|=u<0?4:8}}else t8(e.group,{defaultLayoutDeferred:x,derivedPanelConstraints:f,groupSize:m,layout:t,separatorToPanels:b})}});let u=0;0===t.movementX?u|=3&s:u|=3&d,0===t.movementY?u|=12&s:u|=12&d,l=u,o=nm,(c={...nm}).cursorFlags=l,nm=c,ng.emit("change",{prev:o,next:c}),nN(e)}function nC(e){let t=t5,n=nm;"active"===n.state&&nk({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}function nS(e){if(e.defaultPrevented)return;let t=nm,n=t5;if("active"===t.state){if(0===e.buttons){nb({cursorFlags:0,state:"inactive"}),t.hitRegions.forEach(e=>{let t=t4(e.group.id,!0);t8(e.group,t)});return}for(let n of t.hitRegions)if(n.separator){let{element:t}=n.separator;t.hasPointerCapture?.(e.pointerId)||t.setPointerCapture?.(e.pointerId)}nk({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags})}else{let r=nr(e,n);0===r.length?"inactive"!==t.state&&nb({cursorFlags:0,state:"inactive"}):nb({cursorFlags:0,hitRegions:r,state:"hover"}),nN(e.currentTarget)}}function nE(e){e.relatedTarget instanceof HTMLIFrameElement&&"hover"===nm.state&&nb({cursorFlags:0,state:"inactive"})}function nD(e){if(e.defaultPrevented||"mouse"===e.pointerType&&e.button>0)return;let t=nm;"active"===t.state&&(nb({cursorFlags:0,state:"inactive"}),t.hitRegions.length>0&&(nN(e.currentTarget),t.hitRegions.forEach(e=>{let t=t4(e.group.id,!0);t8(e.group,t)}),e.preventDefault()))}function nM(e){let t=0,n=0,r={};for(let a of e)if(void 0!==a.defaultSize){t++;let e=tK(a.defaultSize);n+=e,r[a.panelId]=e}else r[a.panelId]=void 0;let a=e.length-t;if(0!==a){let t=tK((100-n)/a);for(let n of e)void 0===n.defaultSize&&(r[n.panelId]=t)}return r}let nP=new Map;function nT(e){let t=(0,N.useId)();return`${e??t}`}let nR="u">typeof window?N.useLayoutEffect:N.useEffect;function nL(e){let t=(0,N.useRef)(e);return nR(()=>{t.current=e},[e]),(0,N.useCallback)((...e)=>t.current?.(...e),[t])}function nI(...e){return nL(t=>{e.forEach(e=>{if(e)switch(typeof e){case"function":e(t);break;case"object":e.current=t}})})}function nO(e){let t=(0,N.useRef)({...e});return nR(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}let n$=(0,N.createContext)(null);function nA({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:a,elementRef:i,groupRef:s,id:l,onLayoutChange:o,onLayoutChanged:c,orientation:d="horizontal",resizeTargetMinimumSize:u={coarse:20,fine:10},style:p,...h}){let x,f=(0,N.useRef)({onLayoutChange:{},onLayoutChanged:{}}),m=nL(e=>{no(f.current.onLayoutChange,e)||(f.current.onLayoutChange=e,o?.(e))}),g=nL(e=>{no(f.current.onLayoutChanged,e)||(f.current.onLayoutChanged=e,c?.(e))}),b=nT(l),v=(0,N.useRef)(null),[y,w]=function(){let[e,t]=(0,N.useState)({});return[e,(0,N.useCallback)(()=>t({}),[])]}(),j=(0,N.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:u,separators:[]}),k=nI(v,i);x=(0,N.useRef)({getLayout:()=>({}),setLayout:ny}),(0,N.useImperativeHandle)(s,()=>x.current,[]),nR(()=>{Object.assign(x.current,nh({groupId:b}))});let C=nL((e,t)=>{let r=nm,a=t3(e),i=t4(e);if(i){let e=!1;return"active"===r.state&&(e=r.hitRegions.some(e=>e.group===a)),{flexGrow:i.layout[t]??1,pointerEvents:e?"none":void 0}}if(n?.[t])return{flexGrow:n?.[t]}}),S=nO({defaultLayout:n,disableCursor:r}),E=(0,N.useMemo)(()=>({get disableCursor(){return!!S.disableCursor},getPanelStyles:C,id:b,orientation:d,registerPanel:e=>{let t=j.current;return t.panels=tq(d,[...t.panels,e]),w(),()=>{t.panels=t.panels.filter(t=>t!==e),w()}},registerSeparator:e=>{let t=j.current;return t.separators=tq(d,[...t.separators,e]),w(),()=>{t.separators=t.separators.filter(t=>t!==e),w()}},togglePanelDisabled:(e,t)=>{let n=j.current.panels.find(t=>t.id===e);n&&(n.panelConstraints.disabled=t);let r=t3(b),a=t4(b);r&&a&&t8(r,{...a,derivedPanelConstraints:tX(r)})},toggleSeparatorDisabled:(e,t)=>{let n=j.current.separators.find(t=>t.id===e);n&&(n.disabled=t)}}),[C,b,w,d,S]),D=(0,N.useRef)(null);return nR(()=>{let e,t,n,r,i,s,l,o,c,u,p,h,x,f=v.current;if(null===f)return;let y=j.current;if(void 0!==S.defaultLayout&&Object.keys(S.defaultLayout).length===y.panels.length)for(let t of(e={},y.panels)){let n=S.defaultLayout[t.id];void 0!==n&&(e[t.id]=n)}let w={disabled:!!a,element:f,id:b,mutableState:{defaultLayout:e,disableCursor:!!S.disableCursor,expandedPanelSizes:j.current.lastExpandedPanelSizes,layouts:j.current.layouts},orientation:d,panels:y.panels,resizeTargetMinimumSize:y.resizeTargetMinimumSize,separators:y.separators};D.current=w;let z=(t=!0,tJ(w.element.ownerDocument.defaultView,"Cannot register an unmounted Group"),n=w.element.ownerDocument.defaultView.ResizeObserver,r=new Set,i=new Set,(s=new n(e=>{for(let n of e){let{borderBoxSize:e,target:r}=n;if(r===w.element){if(t){let e=tG({group:w});if(0===e)return;let t=t4(w.id);if(!t)return;let n=tX(w),r=t.defaultLayoutDeferred?nM(n):t.layout,a=nc({layout:function({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:r}){if(n<=0||t<=0||n===t)return r;let a=0,i=0,s=!1,l=new Map,o=[];for(let c of e.panels){let e=r[c.id]??0;if("preserve-pixel-size"===c.panelConstraints.groupResizeBehavior){s=!0;let r=tK(e/100*n/t*100);l.set(c.id,r),a+=r}else o.push(c.id),i+=e}if(!s||0===o.length)return r;let c=100-a,d={...r};if(l.forEach((e,t)=>{d[t]=e}),i>0)for(let e of o){let t=r[e]??0;d[e]=tK(t/i*c)}else{let e=tK(c/o.length);for(let t of o)d[t]=e}return d}({group:w,nextGroupSize:e,prevGroupSize:t.groupSize,prevLayout:r}),panelConstraints:n});if(!t.defaultLayoutDeferred&&no(t.layout,a)&&function(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}(t.derivedPanelConstraints,n)&&t.groupSize===e)return;t8(w,{defaultLayoutDeferred:!1,derivedPanelConstraints:n,groupSize:e,layout:a,separatorToPanels:t.separatorToPanels})}}else!function(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let a=tG({group:e}),i="horizontal"===e.orientation?r.element.offsetWidth:r.element.offsetHeight,s=r.mutableValues.prevSize,l={asPercentage:tK(i/a*100),inPixels:i};r.mutableValues.prevSize=l,r.onResize(l,r.id,s)}(w,r,e)}})).observe(w.element),w.panels.forEach(e=>{tJ(!r.has(e.id),`Panel ids must be unique; id "${e.id}" was used more than once`),r.add(e.id),e.onResize&&s.observe(e.element)}),l=tG({group:w}),o=tX(w),c=w.panels.map(({id:e})=>e).join(","),(u=w.mutableState.defaultLayout)&&(function(e,t){let n=e.map(e=>e.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(let e of n)if(!r.includes(e))return!1;return!0}(w.panels,u)||(u=void 0)),p=nc({layout:w.mutableState.layouts[c]??u??nM(o),panelConstraints:o}),h=w.element.ownerDocument,nP.set(h,(nP.get(h)??0)+1),x=new Map,t0(w).forEach(e=>{e.separator&&x.set(e.separator,e.panels)}),t8(w,{defaultLayoutDeferred:0===l,derivedPanelConstraints:o,groupSize:l,layout:p,separatorToPanels:x}),w.separators.forEach(e=>{tJ(!i.has(e.id),`Separator ids must be unique; id "${e.id}" was used more than once`),i.add(e.id),e.element.addEventListener("keydown",nf)}),1===nP.get(h)&&(h.addEventListener("dblclick",nu,!0),h.addEventListener("pointerdown",nv,!0),h.addEventListener("pointerleave",nC),h.addEventListener("pointermove",nS),h.addEventListener("pointerout",nE),h.addEventListener("pointerup",nD,!0)),function(){t=!1,nP.set(h,Math.max(0,(nP.get(h)??0)-1)),(t5=new Map(t5)).delete(w),w.separators.forEach(e=>{e.element.removeEventListener("keydown",nf)}),nP.get(h)||(h.removeEventListener("dblclick",nu,!0),h.removeEventListener("pointerdown",nv,!0),h.removeEventListener("pointerleave",nC),h.removeEventListener("pointermove",nS),h.removeEventListener("pointerout",nE),h.removeEventListener("pointerup",nD,!0)),s.disconnect()}),{defaultLayoutDeferred:N,derivedPanelConstraints:k,layout:C}=t4(w.id,!0);!N&&k.length>0&&(m(C),g(C));let E=t6(b,e=>{let{defaultLayoutDeferred:t,derivedPanelConstraints:n,layout:r}=e.next;if(t||0===n.length)return;let a=w.panels.map(({id:e})=>e).join(",");w.mutableState.layouts[a]=r,n.forEach(t=>{if(t.collapsible){let{layout:n}=e.prev??{};if(n){let e=na(t.collapsedSize,r[t.panelId]),a=na(t.collapsedSize,n[t.panelId]);e&&!a&&(w.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let i="active"!==nm.state;m(r),i&&g(r)});return()=>{D.current=null,z(),E()}},[a,b,g,m,d,y,S]),(0,N.useEffect)(()=>{let e=D.current;e&&(e.mutableState.defaultLayout=n,e.mutableState.disableCursor=!!r)}),(0,z.jsx)(n$.Provider,{value:E,children:(0,z.jsx)("div",{...h,className:t,"data-group":!0,"data-testid":b,id:b,ref:k,style:{height:"100%",width:"100%",overflow:"hidden",...p,display:"flex",flexDirection:"horizontal"===d?"row":"column",flexWrap:"nowrap",touchAction:"horizontal"===d?"pan-y":"pan-x"},children:e})})}function nF(){let e=(0,N.useContext)(n$);return tJ(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function nB({children:e,className:t,collapsedSize:n="0%",collapsible:r=!1,defaultSize:a,disabled:i,elementRef:s,groupResizeBehavior:l="preserve-relative-size",id:o,maxSize:c="100%",minSize:d="0%",onResize:u,panelRef:p,style:h,...x}){let f,m=!!o,g=nT(o),b=nO({disabled:i}),v=(0,N.useRef)(null),y=nI(v,s),{getPanelStyles:w,id:j,orientation:k,registerPanel:C,togglePanelDisabled:S}=nF(),E=null!==u,D=nL((e,t,n)=>{u?.(e,o,n)});nR(()=>{let e=v.current;if(null!==e)return C({element:e,id:g,idIsStable:m,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:E?D:void 0,panelConstraints:{groupResizeBehavior:l,collapsedSize:n,collapsible:r,defaultSize:a,disabled:b.disabled,maxSize:c,minSize:d}})},[l,n,r,a,E,g,m,c,d,D,C,b]),(0,N.useEffect)(()=>{S(g,!!i)},[i,g,S]),function(e,t){let{id:n}=nF(),r=(0,N.useRef)({collapse:nw,expand:nw,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:nw});(0,N.useImperativeHandle)(t,()=>r.current,[]),nR(()=>{Object.assign(r.current,nd({groupId:n,panelId:e}))})}(g,p);let M=()=>{let e=w(j,g);if(e)return JSON.stringify(e)},P=(0,N.useSyncExternalStore)(e=>t6(j,e),M,M);return f=P?JSON.parse(P):a?{flexGrow:void 0,flexShrink:void 0,flexBasis:a}:{flexGrow:1},(0,z.jsx)("div",{...x,"data-disabled":i||void 0,"data-panel":!0,"data-testid":g,id:g,ref:y,style:{...nU,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...f},children:(0,z.jsx)("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...h,touchAction:"horizontal"===k?"pan-y":"pan-x"},children:e})})}nA.displayName="Group",nB.displayName="Panel";let nU={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function n_({children:e,className:t,disabled:n,elementRef:r,id:a,style:i,...s}){let l,o=nT(a),c=nO({disabled:n}),[d,u]=(0,N.useState)({}),[p,h]=(0,N.useState)("inactive"),x=(0,N.useRef)(null),f=nI(x,r),{disableCursor:m,id:g,orientation:b,registerSeparator:v,toggleSeparatorDisabled:y}=nF();return nR(()=>{let e=x.current;if(null!==e){var t;let n={disabled:c.disabled,element:e,id:o},r=v(n),a=(t=e=>{h("inactive"!==e.next.state&&e.next.hitRegions.some(e=>e.separator===n)?e.next.state:"inactive")},ng.addListener("change",t)),i=t6(g,e=>{let{derivedPanelConstraints:t,layout:r,separatorToPanels:a}=e.next,i=a.get(n);if(i){let e=i[0],n=i.indexOf(e);u(function({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let a,i,s=e[n],l=t.find(e=>e.panelId===n);if(l){let o=l.maxSize,c=l.collapsible?l.collapsedSize:l.minSize,d=[r,r+1];i=nc({layout:nl({delta:c-s,initialLayout:e,panelConstraints:t,pivotIndices:d,prevLayout:e}),panelConstraints:t})[n],a=nc({layout:nl({delta:o-s,initialLayout:e,panelConstraints:t,pivotIndices:d,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:a,valueMin:i,valueNow:s}}({layout:r,panelConstraints:t,panelId:e.id,panelIndex:n}))}});return()=>{a(),i(),r()}}},[g,o,v,c]),(0,N.useEffect)(()=>{y(o,!!n)},[n,o,y]),n&&!m&&(l="not-allowed"),(0,z.jsx)("div",{...s,"aria-controls":d.valueControls,"aria-disabled":n||void 0,"aria-orientation":"horizontal"===b?"vertical":"horizontal","aria-valuemax":d.valueMax,"aria-valuemin":d.valueMin,"aria-valuenow":d.valueNow,children:e,className:t,"data-separator":n?"disabled":p,"data-testid":o,id:o,ref:f,role:"separator",style:{flexBasis:"auto",cursor:l,...i,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:n?void 0:0})}n_.displayName="Separator";var nH=e.i(398003);let nW=(0,L.default)("folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]),nK=(0,L.default)("folder-plus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);var nG=e.i(655900),nX=e.i(239616),nJ=e.i(209165);function nq({value:e,onChange:t}){let[n,r]=(0,N.useState)(!1),[a,i]=(0,N.useState)([]),[s,l]=(0,N.useState)(!1),[o,c]=(0,N.useState)(""),[d,u]=(0,N.useState)(null),[p,h]=(0,N.useState)(!1),[x,f]=(0,N.useState)("list"),[m,g]=(0,N.useState)(!1),[b,v]=(0,N.useState)(""),[y,w]=(0,N.useState)(""),[j,k]=(0,N.useState)(!1),S=(0,N.useRef)(null);(0,N.useEffect)(()=>{fetch((0,nJ.api)("/api/config")).then(e=>e.json()).then(e=>{i(e.devDirectories||[]),l(!0)}).catch(()=>l(!0))},[]),(0,N.useEffect)(()=>{n&&"browse"===x&&o&&(h(!0),fetch((0,nJ.api)(`/api/folders?path=${encodeURIComponent(o)}`)).then(e=>e.json()).then(e=>{u(e),h(!1)}).catch(()=>h(!1)))},[n,x,o]),(0,N.useEffect)(()=>{let e=e=>{S.current&&!S.current.contains(e.target)&&r(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);let E=()=>{n?r(!1):(1===a.length?(f("browse"),c(a[0])):f("list"),r(!0))},D=e=>{t(e),r(!1)},P=e=>{c(e)},T=async()=>{if(b.trim()&&d?.current){k(!0),w("");try{let e=await fetch((0,nJ.api)("/api/folders"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({parent:d.current,name:b.trim()})});if(e.ok){let{path:t}=await e.json();g(!1),v(""),D(t)}else{let t=await e.json();w(t.error||"Failed to create folder")}}catch{w("Failed to create folder")}k(!1)}},L=a.find(e=>d?.current===e||d?.current?.startsWith(e+"/")),I=L?.split("/").pop()||"",O=L&&d?.current?d.current.slice(L.length):"",$=O?O.split("/").filter(Boolean):[];return(0,z.jsxs)("div",{ref:S,className:"relative",children:[(0,z.jsxs)("div",{className:"flex items-center gap-0",children:[(0,z.jsx)("input",{type:"text",placeholder:"Working directory",value:e,onChange:e=>t(e.target.value),onFocus:()=>{n||E()},className:"flex-1 px-3 py-2 text-sm bg-zinc-800 border border-zinc-700 rounded-l-md focus:outline-none focus:border-indigo-500 text-white font-mono"}),(0,z.jsx)("button",{type:"button",onClick:E,className:"px-3 py-2 text-sm bg-zinc-700 border border-zinc-700 border-l-0 rounded-r-md hover:bg-zinc-600 text-zinc-300 hover:text-white transition-colors",title:"Browse folders",children:(0,z.jsx)(M.FolderOpen,{className:"w-4 h-4"})})]}),n&&(0,z.jsxs)("div",{className:"absolute z-50 top-full left-0 right-0 mt-1 bg-zinc-800 border border-zinc-700 rounded-md shadow-xl overflow-hidden",children:[s?0===a.length&&"list"===x?(0,z.jsxs)("div",{className:"py-6 px-4 text-center",children:[(0,z.jsx)(nX.Settings,{className:"w-5 h-5 text-zinc-500 mx-auto mb-2"}),(0,z.jsx)("p",{className:"text-xs text-zinc-400 mb-1",children:"No development directories configured"}),(0,z.jsx)("p",{className:"text-[11px] text-zinc-500",children:"Add them in Settings to browse project folders here."})]}):"list"===x?(0,z.jsxs)("div",{children:[(0,z.jsx)("div",{className:"px-3 py-1.5 border-b border-zinc-700/50 text-[11px] text-zinc-500 font-medium",children:"Development Directories"}),(0,z.jsx)("div",{className:"max-h-[250px] overflow-y-auto",children:a.map(e=>(0,z.jsxs)("button",{className:"w-full flex items-center gap-2 px-3 py-2 text-xs hover:bg-zinc-700 transition-colors group",onClick:()=>{f("browse"),c(e)},onDoubleClick:()=>D(e),title:"Click to browse, double-click to select",children:[(0,z.jsx)(nW,{className:"w-3.5 h-3.5 text-amber-500/70"}),(0,z.jsx)("span",{className:"font-mono text-white truncate flex-1 text-left",children:e}),(0,z.jsx)(R.ChevronRight,{className:"w-3 h-3 text-zinc-600 group-hover:text-zinc-400"})]},e))})]}):(0,z.jsxs)("div",{children:[(0,z.jsxs)("div",{className:"flex items-center gap-0.5 px-2 py-1.5 border-b border-zinc-700/50 overflow-x-auto text-[11px] flex-nowrap",children:[a.length>1&&(0,z.jsx)("button",{onClick:()=>{f("list"),u(null),g(!1)},className:"text-zinc-400 hover:text-white flex-shrink-0 p-0.5 mr-0.5",title:"Back to dev directories",children:(0,z.jsx)(nG.ChevronUp,{className:"w-3 h-3"})}),(0,z.jsx)("button",{onClick:()=>L&&P(L),className:"text-zinc-400 hover:text-white flex-shrink-0",children:I}),$.map((e,t)=>{let n=L+"/"+$.slice(0,t+1).join("/");return(0,z.jsxs)("span",{className:"flex items-center gap-0.5 flex-shrink-0",children:[(0,z.jsx)(R.ChevronRight,{className:"w-2.5 h-2.5 text-zinc-600"}),(0,z.jsx)("button",{onClick:()=>P(n),className:"text-zinc-400 hover:text-white hover:underline",children:e})]},t)})]}),(0,z.jsx)("div",{className:"max-h-[250px] overflow-y-auto",children:p||!d?(0,z.jsx)("div",{className:"flex items-center justify-center py-6",children:(0,z.jsx)(C.Loader2,{className:"w-4 h-4 animate-spin text-zinc-400"})}):d.error?(0,z.jsx)("div",{className:"py-4 px-3 text-xs text-red-400 text-center",children:d.error}):(0,z.jsxs)(z.Fragment,{children:[d?.parent&&(0,z.jsxs)("button",{onClick:()=>P(d.parent),className:"w-full flex items-center gap-2 px-3 py-1.5 text-xs text-zinc-400 hover:text-white hover:bg-zinc-700/50 transition-colors border-b border-zinc-700/30",children:[(0,z.jsx)(nG.ChevronUp,{className:"w-3.5 h-3.5"}),(0,z.jsx)("span",{children:".."})]}),(0,z.jsxs)("button",{onClick:()=>D(d.current),className:"w-full flex items-center gap-2 px-3 py-2 text-xs text-indigo-400 hover:bg-indigo-500/10 transition-colors border-b border-zinc-700/30 font-medium",children:[(0,z.jsx)(M.FolderOpen,{className:"w-3.5 h-3.5"}),(0,z.jsx)("span",{children:"Select this folder"}),(0,z.jsx)("span",{className:"ml-auto text-[10px] text-zinc-500 font-mono truncate max-w-[200px]",children:d.current.split("/").pop()})]}),m?(0,z.jsxs)("div",{className:"px-3 py-2 border-b border-zinc-700/30 space-y-1.5",children:[(0,z.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,z.jsx)("input",{autoFocus:!0,value:b,onChange:e=>{v(e.target.value),w("")},onKeyDown:e=>{"Enter"===e.key&&T(),"Escape"===e.key&&g(!1)},placeholder:"Folder name",className:"flex-1 px-2 py-1 text-xs bg-zinc-900 border border-zinc-600 rounded text-white focus:outline-none focus:border-green-500"}),(0,z.jsx)("button",{onClick:T,disabled:j||!b.trim(),className:"px-2.5 py-1 text-xs bg-green-600 hover:bg-green-500 text-white rounded disabled:opacity-40",children:j?"...":"Create"}),(0,z.jsx)("button",{onClick:()=>g(!1),className:"px-1.5 py-1 text-xs text-zinc-500 hover:text-white",children:"✕"})]}),y&&(0,z.jsx)("div",{className:"text-[10px] text-red-400",children:y})]}):(0,z.jsxs)("button",{onClick:()=>{g(!0),w("")},className:"w-full flex items-center gap-2 px-3 py-2 text-xs text-green-400 hover:bg-green-500/10 transition-colors border-b border-zinc-700/30",children:[(0,z.jsx)(nK,{className:"w-3.5 h-3.5"}),(0,z.jsx)("span",{children:"New folder"})]}),d?.folders.length===0?(0,z.jsx)("div",{className:"py-3 px-3 text-[11px] text-zinc-500 text-center",children:"No subfolders"}):d?.folders.map(e=>(0,z.jsxs)("button",{onClick:()=>P(e.path),onDoubleClick:()=>D(e.path),className:"w-full flex items-center gap-2 px-3 py-1.5 text-xs text-white hover:bg-zinc-700 transition-colors",title:"Click to open, double-click to select",children:[(0,z.jsx)(nW,{className:"w-3.5 h-3.5 text-amber-500/70"}),(0,z.jsx)("span",{className:"truncate",children:e.name})]},e.path))]})})]}):(0,z.jsx)("div",{className:"flex items-center justify-center py-6",children:(0,z.jsx)(C.Loader2,{className:"w-4 h-4 animate-spin text-zinc-400"})}),(0,z.jsx)("div",{className:"border-t border-zinc-700/50 px-2 py-1 flex justify-end",children:(0,z.jsx)("button",{onClick:()=>r(!1),className:"text-[11px] text-zinc-500 hover:text-white px-2 py-0.5",children:"Close"})})]})]})}var nY=e.i(768407),nV=e.i(28916);function nQ({value:e,onChange:t}){let{hasNetwork:n}=(0,nV.useTier)(),{data:r}=(0,nY.useNodes)(n);return Array.isArray(r)&&0!==r.length?(0,z.jsxs)("div",{children:[(0,z.jsx)("label",{className:"text-[11px] text-zinc-400 mb-1.5 block",children:"Node"}),(0,z.jsxs)("div",{className:"relative",children:[(0,z.jsx)(W.Globe,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-zinc-500"}),(0,z.jsxs)("select",{value:e,onChange:e=>t(e.target.value),className:"w-full pl-8 pr-3 py-2 text-sm bg-zinc-800 border border-zinc-700 rounded-md focus:outline-none focus:border-indigo-500 text-white appearance-none",children:[(0,z.jsx)("option",{value:"",children:"Local (this machine)"}),r.map(e=>(0,z.jsx)("option",{value:e.id,disabled:"offline"===e.status,children:"offline"===e.status?`${e.name} (offline)`:e.name},e.id))]})]})]}):null}var nZ=e.i(534623),n0=e.i(73359),n1=e.i(203999),n5=e.i(514764);let n2=(0,L.default)("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);var n3=e.i(266027),n4=e.i(954616),n6=e.i(912598);function n8({workspaceId:e,panes:t,collapsed:n,onToggle:r}){let a,i,s,l,[o,c]=(0,N.useState)("messages"),[d,u]=(0,N.useState)(""),p=(0,N.useRef)(null),{data:h=[]}=(0,n3.useQuery)({queryKey:["workspace-messages",e,void 0],queryFn:async()=>{let t=new URLSearchParams;return(await fetch((0,nJ.api)(`/api/workspaces/${e}/messages?${t}`))).json()},enabled:!!e,refetchInterval:3e3}),{data:x=[]}=(0,n3.useQuery)({queryKey:["workspace-context",e],queryFn:async()=>(await fetch((0,nJ.api)(`/api/workspaces/${e}/context`))).json(),enabled:!!e}),f=(a=(0,n6.useQueryClient)(),(0,n4.useMutation)({mutationFn:async t=>(await fetch((0,nJ.api)(`/api/workspaces/${e}/messages`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...t,senderName:t.senderName||"User",type:t.type||"message"})})).json(),onSuccess:()=>{a.invalidateQueries({queryKey:["workspace-messages",e]})}})),m=(i=(0,n6.useQueryClient)(),(0,n4.useMutation)({mutationFn:async({messageId:t,status:n})=>(await fetch((0,nJ.api)(`/api/workspaces/${e}/messages/${t}`),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:n})})).json(),onSuccess:()=>{i.invalidateQueries({queryKey:["workspace-messages",e]})}})),g=(s=(0,n6.useQueryClient)(),(0,n4.useMutation)({mutationFn:async()=>{await fetch((0,nJ.api)(`/api/workspaces/${e}/messages`),{method:"DELETE"})},onSuccess:()=>{s.invalidateQueries({queryKey:["workspace-messages",e]})}})),b=(l=(0,n6.useQueryClient)(),(0,n4.useMutation)({mutationFn:async()=>{await fetch((0,nJ.api)(`/api/workspaces/${e}/context`),{method:"DELETE"})},onSuccess:()=>{l.invalidateQueries({queryKey:["workspace-context",e]})}})),v=h.filter(e=>"pending_approval"===e.status).length;(0,N.useEffect)(()=>{p.current&&(p.current.scrollTop=p.current.scrollHeight)},[h]);let y=()=>{d.trim()&&e&&(f.mutate({content:d.trim()}),u(""))};return n?(0,z.jsxs)("button",{onClick:r,className:"flex-shrink-0 w-10 border-l border-zinc-800 bg-zinc-900 flex flex-col items-center pt-3 gap-2",children:[(0,z.jsx)(n2,{className:"w-4 h-4 text-zinc-400"}),(0,z.jsx)(D.MessageSquare,{className:"w-4 h-4 text-zinc-400"}),v>0&&(0,z.jsx)("span",{className:"bg-amber-500 text-black text-xs font-bold rounded-full w-5 h-5 flex items-center justify-center",children:v})]}):(0,z.jsxs)("div",{className:"flex-shrink-0 w-80 border-l border-zinc-800 bg-zinc-900 flex flex-col",children:[(0,z.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 border-b border-zinc-800",children:[(0,z.jsxs)("div",{className:"flex gap-1",children:[(0,z.jsxs)("button",{onClick:()=>c("messages"),className:`px-2 py-1 text-xs rounded ${"messages"===o?"bg-zinc-700 text-white":"text-zinc-400 hover:text-zinc-300"}`,children:["Messages",v>0&&(0,z.jsx)("span",{className:"ml-1 bg-amber-500 text-black text-xs font-bold rounded-full px-1.5",children:v})]}),(0,z.jsx)("button",{onClick:()=>c("context"),className:`px-2 py-1 text-xs rounded ${"context"===o?"bg-zinc-700 text-white":"text-zinc-400 hover:text-zinc-300"}`,children:"Context"})]}),(0,z.jsxs)("div",{className:"flex items-center gap-1",children:[(0,z.jsx)("button",{onClick:()=>"messages"===o?g.mutate():b.mutate(),className:"text-zinc-500 hover:text-red-400",title:"messages"===o?"Clear all messages":"Clear all context",children:(0,z.jsx)(O.Trash2,{className:"w-3.5 h-3.5"})}),(0,z.jsx)("button",{onClick:r,className:"text-zinc-400 hover:text-zinc-300",children:(0,z.jsx)(R.ChevronRight,{className:"w-4 h-4"})})]})]}),"messages"===o&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)("div",{ref:p,className:"flex-1 overflow-y-auto p-2 space-y-2",children:[[...h].reverse().map(e=>(0,z.jsx)(n7,{message:e,panes:t,onApprove:()=>m.mutate({messageId:e.id,status:"approved"}),onReject:()=>m.mutate({messageId:e.id,status:"rejected"})},e.id)),0===h.length&&(0,z.jsx)("p",{className:"text-zinc-500 text-xs text-center py-8",children:"No messages yet. Agents will appear here."})]}),(0,z.jsx)("div",{className:"border-t border-zinc-800 p-2",children:(0,z.jsxs)("div",{className:"flex gap-1",children:[(0,z.jsx)("input",{value:d,onChange:e=>u(e.target.value),onKeyDown:e=>"Enter"===e.key&&!e.shiftKey&&y(),placeholder:"Message workspace...",className:"flex-1 bg-zinc-800 border border-zinc-700 rounded px-2 py-1 text-sm text-zinc-200 placeholder-zinc-500 focus:outline-none focus:border-zinc-600"}),(0,z.jsx)("button",{onClick:y,disabled:!d.trim(),className:"px-2 py-1 bg-indigo-600 hover:bg-indigo-500 disabled:bg-zinc-700 disabled:text-zinc-500 rounded text-sm",children:(0,z.jsx)(n5.Send,{className:"w-3.5 h-3.5"})})]})})]}),"context"===o&&(0,z.jsx)(n9,{workspaceId:e,context:x})]})}function n7({message:e,panes:t,onApprove:n,onReject:r}){let a=t.find(t=>t.id===e.paneId),i="pending_approval"===e.status,s="rejected"===e.status;return(0,z.jsxs)("div",{className:`rounded p-2 text-xs ${i?"bg-amber-950/50 border border-amber-800/50":s?"bg-zinc-800/50 opacity-50":"bg-zinc-800/50"}`,children:[(0,z.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,z.jsxs)("span",{className:"font-medium text-zinc-300",children:[a&&(0,z.jsx)("span",{className:"inline-block w-2 h-2 rounded-full mr-1",style:{backgroundColor:a.color||"#6366f1"}}),e.senderName]}),(0,z.jsx)("span",{className:"text-zinc-500",children:new Date(e.created).toLocaleTimeString()})]}),(0,z.jsx)("p",{className:"text-zinc-300 whitespace-pre-wrap",children:e.content}),i&&(0,z.jsxs)("div",{className:"flex gap-1 mt-2",children:[(0,z.jsxs)("button",{onClick:n,className:"flex items-center gap-1 px-2 py-0.5 bg-green-700 hover:bg-green-600 rounded text-white text-xs",children:[(0,z.jsx)(A.Check,{className:"w-3 h-3"})," Approve"]}),(0,z.jsxs)("button",{onClick:r,className:"flex items-center gap-1 px-2 py-0.5 bg-zinc-700 hover:bg-zinc-600 rounded text-zinc-300 text-xs",children:[(0,z.jsx)(F.X,{className:"w-3 h-3"})," Reject"]})]}),"rejected"===e.status&&(0,z.jsx)("span",{className:"text-red-400 text-xs mt-1 block",children:"Rejected"})]})}function n9({workspaceId:e,context:t}){let n,r,[a,i]=(0,N.useState)(""),[s,l]=(0,N.useState)(""),o=(n=(0,n6.useQueryClient)(),(0,n4.useMutation)({mutationFn:async({key:t,value:n})=>(await fetch((0,nJ.api)(`/api/workspaces/${e}/context/${encodeURIComponent(t)}`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:n})})).json(),onSuccess:()=>{n.invalidateQueries({queryKey:["workspace-context",e]})}})),c=(r=(0,n6.useQueryClient)(),(0,n4.useMutation)({mutationFn:async t=>{await fetch((0,nJ.api)(`/api/workspaces/${e}/context/${encodeURIComponent(t)}`),{method:"DELETE"})},onSuccess:()=>{r.invalidateQueries({queryKey:["workspace-context",e]})}})),d=()=>{a.trim()&&s.trim()&&(o.mutate({key:a.trim(),value:s.trim()}),i(""),l(""))};return(0,z.jsxs)("div",{className:"flex-1 overflow-y-auto p-2 space-y-2",children:[t.map(e=>(0,z.jsxs)("div",{className:"bg-zinc-800/50 rounded p-2 text-xs",children:[(0,z.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,z.jsx)("span",{className:"font-mono font-medium text-indigo-300",children:e.key}),(0,z.jsx)("button",{onClick:()=>c.mutate(e.key),className:"text-zinc-500 hover:text-red-400",children:(0,z.jsx)(F.X,{className:"w-3 h-3"})})]}),(0,z.jsx)("p",{className:"text-zinc-300 whitespace-pre-wrap font-mono text-xs",children:e.value}),(0,z.jsxs)("span",{className:"text-zinc-500 text-xs",children:["by ",e.updatedBy]})]},e.key)),(0,z.jsxs)("div",{className:"border-t border-zinc-800 pt-2 space-y-1",children:[(0,z.jsx)("input",{value:a,onChange:e=>i(e.target.value),placeholder:"Key",className:"w-full bg-zinc-800 border border-zinc-700 rounded px-2 py-1 text-xs text-zinc-200 placeholder-zinc-500 focus:outline-none"}),(0,z.jsx)("input",{value:s,onChange:e=>l(e.target.value),placeholder:"Value",onKeyDown:e=>"Enter"===e.key&&d(),className:"w-full bg-zinc-800 border border-zinc-700 rounded px-2 py-1 text-xs text-zinc-200 placeholder-zinc-500 focus:outline-none"}),(0,z.jsx)("button",{onClick:d,disabled:!a.trim()||!s.trim(),className:"w-full px-2 py-1 bg-indigo-600 hover:bg-indigo-500 disabled:bg-zinc-700 disabled:text-zinc-500 rounded text-xs",children:"Add Entry"})]})]})}var re=e.i(209593),rt=e.i(286536),rn=e.i(77705),rr=e.i(751975);function ra({workspaceId:e,workspaceName:t}){let[n,r]=(0,N.useState)(null),[a,i]=(0,N.useState)([]),[s,l]=(0,N.useState)(!1),[o,c]=(0,N.useState)(""),[d,u]=(0,N.useState)(null);(0,N.useEffect)(()=>{Promise.all([fetch((0,nJ.api)(`/api/cortex/lobes/${e}`)).then(e=>{if(!e.ok)throw Error(`${e.status} ${e.statusText}`);return e.json()}),fetch((0,nJ.api)("/api/cortex/lobes")).then(e=>e.json()).catch(()=>({lobes:[]}))]).then(([t,n])=>{r(t.config??null),i((n.lobes||[]).filter(t=>t.workspaceId!==e))}).catch(e=>u(e.message||"Failed to load"))},[e]);let p=async t=>{if(n){r({...n,...t}),l(!0);try{let n=await fetch((0,nJ.api)(`/api/cortex/lobes/${e}`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),a=await n.json();a.config&&r(a.config)}catch{}finally{l(!1)}}},h=()=>{if(!n||!o.trim())return;let e=o.trim();n.tags.includes(e)||p({tags:[...n.tags,e]}),c("")};return d?(0,z.jsx)("div",{className:"text-[11px] text-red-400/80",children:d}):n?(0,z.jsxs)("div",{className:"space-y-3",children:[(0,z.jsx)("div",{className:"text-[10px] text-zinc-500 uppercase tracking-wider font-medium",children:"Knowledge Lobe"}),(0,z.jsxs)("button",{onClick:()=>p({isPrivate:!n.isPrivate}),disabled:s,className:"flex items-center gap-2 w-full text-left group disabled:opacity-50",children:[(0,z.jsx)("span",{className:`flex items-center justify-center w-4 h-4 rounded border transition-colors ${n.isPrivate?"bg-amber-500/20 border-amber-500/40 text-amber-400":"bg-zinc-800 border-zinc-700 text-zinc-500 group-hover:border-zinc-500"}`,children:n.isPrivate?(0,z.jsx)(rn.EyeOff,{className:"w-2.5 h-2.5"}):(0,z.jsx)(rt.Eye,{className:"w-2.5 h-2.5"})}),(0,z.jsx)("span",{className:"text-xs text-zinc-400 group-hover:text-zinc-300 transition-colors",children:n.isPrivate?"Private — hidden from other workspaces":"Visible to other workspaces"})]}),(0,z.jsxs)("div",{className:"space-y-1.5",children:[(0,z.jsxs)("div",{className:"flex items-center gap-1 text-[10px] text-zinc-500",children:[(0,z.jsx)(rr.Tag,{className:"w-3 h-3"}),(0,z.jsx)("span",{children:"Topics"}),(0,z.jsx)("span",{className:"text-zinc-700 ml-1",children:"— Cortex uses these to scope knowledge retrieval"})]}),(0,z.jsxs)("div",{className:"flex flex-wrap gap-1",children:[n.tags.map(e=>(0,z.jsxs)("span",{className:"flex items-center gap-1 px-1.5 py-0.5 bg-purple-500/10 border border-purple-500/20 rounded text-[11px] text-purple-300",children:[e,(0,z.jsx)("button",{onClick:()=>{n&&p({tags:n.tags.filter(t=>t!==e)})},className:"hover:text-red-400 transition-colors",children:(0,z.jsx)(F.X,{className:"w-2.5 h-2.5"})})]},e)),(0,z.jsxs)("span",{className:"flex items-center gap-0.5",children:[(0,z.jsx)("input",{type:"text",value:o,onChange:e=>c(e.target.value),onKeyDown:e=>{"Enter"===e.key&&h()},placeholder:"add topic...",className:"w-20 px-1.5 py-0.5 bg-zinc-800 border border-zinc-700 rounded text-[11px] text-zinc-300 placeholder-zinc-600 focus:outline-none focus:border-purple-500/50"}),o.trim()&&(0,z.jsx)("button",{onClick:h,className:"text-purple-400 hover:text-purple-300 transition-colors",children:(0,z.jsx)(k.Plus,{className:"w-3 h-3"})})]})]})]}),(0,z.jsxs)("div",{className:"space-y-1.5",children:[(0,z.jsxs)("div",{className:"text-[10px] text-zinc-500",children:["Domain Context",(0,z.jsx)("span",{className:"text-zinc-700 ml-1",children:"— injected into distillation prompts for better extraction"})]}),(0,z.jsx)("textarea",{value:n.domain_context||"",onChange:e=>p({domain_context:e.target.value}),placeholder:"Describe the domain expertise this lobe should focus on. E.g. 'This workspace covers CFB power plant engineering.'",rows:3,disabled:s,className:"w-full px-2 py-1.5 bg-zinc-800 border border-zinc-700 rounded text-[11px] text-zinc-300 placeholder-zinc-600 focus:outline-none focus:border-purple-500/50 resize-y disabled:opacity-50"})]}),a.length>0&&!n.isPrivate&&(0,z.jsxs)("div",{className:"space-y-1.5",children:[(0,z.jsx)("div",{className:"text-[10px] text-zinc-500",children:"Sibling access — uncheck to block a workspace from this lobe"}),(0,z.jsx)("div",{className:"space-y-0.5",children:a.map(e=>{let t=n.excludedFrom.includes(e.workspaceId);return(0,z.jsxs)("button",{onClick:()=>{var t;return t=e.workspaceId,void(!n||p({excludedFrom:n.excludedFrom.includes(t)?n.excludedFrom.filter(e=>e!==t):[...n.excludedFrom,t]}))},disabled:s,className:"flex items-center gap-2 w-full px-2 py-1 rounded text-left hover:bg-zinc-800/50 transition-colors disabled:opacity-50",children:[(0,z.jsx)("span",{className:`w-3 h-3 rounded-sm border flex items-center justify-center transition-colors ${t?"border-zinc-700 bg-zinc-800":"border-purple-500/50 bg-purple-500/20"}`,children:!t&&(0,z.jsx)("svg",{className:"w-2 h-2 text-purple-400",viewBox:"0 0 12 12",fill:"none",children:(0,z.jsx)("path",{d:"M2 6l3 3 5-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),(0,z.jsx)("span",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{backgroundColor:e.color}}),(0,z.jsx)("span",{className:`text-xs ${t?"text-zinc-600 line-through":"text-zinc-300"}`,children:e.name})]},e.workspaceId)})})]})]}):(0,z.jsx)("div",{className:"text-[11px] text-zinc-600",children:"Loading..."})}let ri=(0,L.default)("file",[["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:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]]);var rs=e.i(178583);let rl=(0,L.default)("file-code",[["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:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]]),ro=(0,L.default)("file-braces",[["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:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]]),rc=(0,L.default)("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]),rd=(0,L.default)("arrow-up",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);var ru=e.i(778917);let rp=(0,L.default)("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]);var rh=e.i(569074);let rx="spaces-file-viewer",rf="spaces-file-viewer-state";function rm(){try{let e=localStorage.getItem(rf);if(e)return JSON.parse(e)}catch{}return{x:0,y:0,w:800,h:600,wasPoppedOut:!1}}function rg(e){try{let t=rm();localStorage.setItem(rf,JSON.stringify({...t,...e}))}catch{}}function rb(e){return e?({".ts":"text-blue-300",".tsx":"text-blue-300",".js":"text-yellow-300",".jsx":"text-yellow-300",".json":"text-green-300",".md":"text-zinc-300",".css":"text-pink-300",".scss":"text-pink-300",".html":"text-orange-300",".xml":"text-orange-300",".py":"text-emerald-300",".rb":"text-red-300",".go":"text-cyan-300",".rs":"text-orange-300",".sh":"text-green-300",".bash":"text-green-300",".yml":"text-purple-300",".yaml":"text-purple-300",".sql":"text-blue-200",".graphql":"text-pink-200"})[e]||"text-zinc-300":""}function rv({item:e}){if(e.isDir)return(0,z.jsx)(nW,{className:"w-3.5 h-3.5 text-amber-500/70 flex-shrink-0"});let t=e.ext||"";return[".png",".jpg",".jpeg",".gif",".webp",".svg",".ico",".bmp"].includes(t)?(0,z.jsx)(rc,{className:"w-3.5 h-3.5 text-emerald-400/70 flex-shrink-0"}):[".ts",".tsx",".js",".jsx",".py",".rb",".go",".rs"].includes(t)?(0,z.jsx)(rl,{className:"w-3.5 h-3.5 text-blue-400/70 flex-shrink-0"}):".json"===t?(0,z.jsx)(ro,{className:"w-3.5 h-3.5 text-green-400/70 flex-shrink-0"}):[".md",".txt",".yml",".yaml"].includes(t)?(0,z.jsx)(rs.FileText,{className:"w-3.5 h-3.5 text-zinc-400/70 flex-shrink-0"}):(0,z.jsx)(ri,{className:"w-3.5 h-3.5 text-zinc-500/70 flex-shrink-0"})}function ry(e){return e<1024?`${e}B`:e<1048576?`${(e/1024).toFixed(1)}KB`:`${(e/1048576).toFixed(1)}MB`}function rw({onClose:e,navigateTo:t}){let[n,r]=(0,N.useState)([]),[a,i]=(0,N.useState)(""),[s,l]=(0,N.useState)(""),[o,c]=(0,N.useState)([]),[d,u]=(0,N.useState)(null),[p,h]=(0,N.useState)(new Set),[x,f]=(0,N.useState)(null),[m,g]=(0,N.useState)(!1),[b,v]=(0,N.useState)(!1),y=(0,N.useRef)(null),w=(0,N.useRef)(null),j=(0,N.useRef)(null),k=(0,N.useRef)(!0);(0,N.useEffect)(()=>(k.current=!0,w.current=new BroadcastChannel(rx),w.current.onmessage=e=>{e.data?.type==="pop-in"&&(rg({wasPoppedOut:!1}),v(!1),y.current=null,j.current&&(clearInterval(j.current),j.current=null))},()=>{k.current=!1,w.current?.close(),j.current&&clearInterval(j.current)}),[]),(0,N.useEffect)(()=>{fetch((0,nJ.api)("/api/config")).then(e=>e.json()).then(e=>{let t=e.devDirectories||[];r(t),t.length>0&&!a&&(i(t[0]),l(t[0]))}).catch(()=>{})},[]),(0,N.useEffect)(()=>{if(!t)return;let e=n.find(e=>t===e||t.startsWith(e+"/")||t.startsWith(e+"\\"));e?i(e):i(t),l(t),h(new Set)},[t,n]),(0,N.useEffect)(()=>{if(b&&x&&w.current)try{w.current.postMessage({type:"file-update",file:x})}catch{}},[x,b]);let C=(0,N.useRef)(!1);(0,N.useEffect)(()=>{C.current=!1;let e=rm();e.wasPoppedOut&&e.lastFilePath&&fetch((0,nJ.api)(`/api/files?file=${encodeURIComponent(e.lastFilePath)}`)).then(e=>e.json()).then(e=>{e&&!e.error&&(f(e),C.current||(C.current=!0,setTimeout(()=>D(e),50)))}).catch(()=>{})},[]),(0,N.useEffect)(()=>()=>{if(y.current&&!y.current.closed){rg({wasPoppedOut:!0});try{y.current.close()}catch{}}j.current&&(clearInterval(j.current),j.current=null)},[]);let S=(0,N.useCallback)(async e=>{try{let t=await fetch((0,nJ.api)(`/api/files?path=${encodeURIComponent(e)}`)),n=await t.json();return{items:n.items||[],parent:n.parent||null}}catch{return{items:[],parent:null}}},[]);(0,N.useEffect)(()=>{s&&(g(!0),S(s).then(e=>{c(e.items),u(e.parent),g(!1)}))},[s,S]);let E=async e=>{if(e.isDir)h(t=>{let n=new Set(t);return n.has(e.path)?n.delete(e.path):n.add(e.path),n});else try{let t=await fetch((0,nJ.api)(`/api/files?file=${encodeURIComponent(e.path)}`)),n=await t.json();f(n),rg({lastFilePath:e.path})}catch{f({name:e.name,path:e.path,size:0,ext:e.ext||"",error:"Failed to load"})}},D=e=>{let t=rm(),n=t.w||800,r=t.h||600,a=t.x||window.screenX+(window.outerWidth-n)/2,i=t.y||window.screenY+(window.outerHeight-r)/2,s=window.open("about:blank","spaces-file-viewer",`width=${n},height=${r},left=${a},top=${i}`);if(s){var l;y.current=s,v(!0),rg({wasPoppedOut:!0}),l=e.name,s.document.write(`<!DOCTYPE html><html><head><title>${l} — Spaces</title>
|
|
2
2
|
<style>
|
|
3
3
|
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
4
4
|
body { background: #0a0a0a; color: #e4e4e7; font-family: system-ui, sans-serif; overflow: auto; }
|
|
@@ -82,4 +82,4 @@
|
|
|
82
82
|
if (e.data?.type === 'file-update') renderFile(e.data.file);
|
|
83
83
|
if (e.data?.type === 'close-popup') { savePos(); window.close(); }
|
|
84
84
|
};
|
|
85
|
-
</script></body></html>`),s.document.close(),setTimeout(()=>{w.current?.postMessage({type:"file-update",file:e})},100),j.current&&clearInterval(j.current),j.current=setInterval(()=>{y.current?.closed&&(rg({wasPoppedOut:!1}),k.current&&v(!1),y.current=null,j.current&&(clearInterval(j.current),j.current=null))},500)}},P=(0,N.useRef)(null),[M,T]=(0,N.useState)(!1),[R,L]=(0,N.useState)(!1),I=async e=>{if(s&&0!==e.length){T(!0);try{let t=new FormData;for(let n of(t.append("dir",s),Array.from(e)))t.append("files",n);await fetch((0,nY.api)("/api/files"),{method:"POST",body:t});let n=await S(s);c(n.items)}catch{}finally{T(!1)}}},O=a?s.replace(a,"").replace(/^[/\\]/,""):"",$=O?O.split(/[/\\]/):[],A=x&&!b,B=d&&s!==a;return a?(0,z.jsxs)("div",{className:"h-full flex flex-col bg-zinc-950 border-r border-zinc-800",children:[(0,z.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 border-b border-zinc-800/50 flex-shrink-0",children:[(0,z.jsx)("span",{className:"text-[10px] text-zinc-500 uppercase tracking-wider font-medium",children:"Files"}),(0,z.jsx)("button",{onClick:e,className:"p-0.5 text-zinc-600 hover:text-zinc-300 transition-colors",children:(0,z.jsx)(F.X,{className:"w-3.5 h-3.5"})})]}),n.length>1&&(0,z.jsx)("div",{className:"flex items-center gap-1 px-3 py-1.5 border-b border-zinc-800/30 flex-shrink-0 overflow-x-auto",children:n.map(e=>{let t=e.split(/[/\\]/).pop()||e,n=e===a;return(0,z.jsx)("button",{onClick:()=>{i(e),l(e),h(new Set),f(null)},className:`px-2 py-0.5 text-[10px] rounded transition-colors flex-shrink-0 ${n?"bg-amber-500/15 text-amber-400 border border-amber-500/30":"text-zinc-500 hover:text-zinc-300 border border-transparent"}`,title:e,children:t},e)})}),(0,z.jsxs)("div",{className:"flex items-center gap-1 px-3 py-1.5 border-b border-zinc-800/30 overflow-x-auto text-[10px] flex-shrink-0",children:[B&&(0,z.jsx)("button",{onClick:()=>{d&&s!==a&&l(d)},className:"text-zinc-500 hover:text-zinc-300 flex-shrink-0",children:(0,z.jsx)(rd,{className:"w-3 h-3"})}),(0,z.jsx)("input",{ref:P,type:"file",multiple:!0,className:"hidden",onChange:e=>{e.target.files&&I(e.target.files),e.target.value=""}}),(0,z.jsx)("button",{onClick:()=>P.current?.click(),className:"text-zinc-600 hover:text-zinc-300 flex-shrink-0 ml-auto",title:"Upload files to current directory",children:(0,z.jsx)(rh.Upload,{className:"w-3 h-3"})}),(0,z.jsx)("button",{onClick:()=>l(a),className:"text-zinc-500 hover:text-zinc-300 truncate flex-shrink-0",children:a.split(/[/\\]/).pop()}),$.map((e,t)=>(0,z.jsxs)("span",{className:"flex items-center gap-1 flex-shrink-0",children:[(0,z.jsx)("span",{className:"text-zinc-700",children:"/"}),(0,z.jsx)("button",{onClick:()=>{l(a+"/"+$.slice(0,t+1).join("/"))},className:"text-zinc-500 hover:text-zinc-300",children:e})]},t))]}),b&&x&&(0,z.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 border-b border-zinc-800/30 bg-zinc-900/50 flex-shrink-0",children:[(0,z.jsx)("span",{className:"text-[10px] text-zinc-500",children:"Viewing:"}),(0,z.jsx)("span",{className:"text-[10px] text-zinc-400 font-mono truncate flex-1",children:x.name}),(0,z.jsx)("button",{onClick:()=>{rg({wasPoppedOut:!1}),y.current&&!y.current.closed&&y.current.close(),y.current=null,v(!1),j.current&&(clearInterval(j.current),j.current=null)},className:"text-zinc-500 hover:text-zinc-300 transition-colors",title:"Pop back into panel",children:(0,z.jsx)(W,{className:"w-3 h-3"})})]}),(0,z.jsxs)("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:[(0,z.jsx)("div",{className:`overflow-y-auto ${A?"max-h-[40%] border-b border-zinc-800/30":"flex-1"} ${R?"ring-2 ring-inset ring-amber-500/50 bg-amber-500/5":""}`,onDragOver:e=>{e.preventDefault(),L(!0)},onDragLeave:()=>L(!1),onDrop:e=>{e.preventDefault(),L(!1),e.dataTransfer.files.length>0&&I(e.dataTransfer.files)},children:M?(0,z.jsx)("div",{className:"p-3 text-xs text-amber-400",children:"Uploading..."}):m?(0,z.jsx)("div",{className:"p-3 text-xs text-zinc-600",children:"Loading..."}):0===o.length?(0,z.jsx)("div",{className:"p-3 text-xs text-zinc-600",children:"Empty directory"}):(0,z.jsx)("div",{className:"py-1",children:o.map(e=>(0,z.jsx)(rz,{item:e,depth:0,expanded:p.has(e.path),expandedDirs:p,onClick:E,loadDir:S,activeFile:x?.path},e.path))})}),A&&(0,z.jsxs)("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:[(0,z.jsxs)("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-zinc-800/30 flex-shrink-0",children:[(0,z.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0",children:[(0,z.jsx)("span",{className:`text-xs font-mono truncate ${rb(x.ext)}`,children:x.name}),(0,z.jsx)("span",{className:"text-[9px] text-zinc-600",children:x.lines?`${x.lines} lines`:ry(x.size)}),x.truncated&&(0,z.jsx)("span",{className:"text-[9px] text-amber-500",children:"(truncated)"})]}),(0,z.jsxs)("div",{className:"flex items-center gap-1",children:[(0,z.jsx)("button",{onClick:()=>{var e,t;let n;return x&&(e=x.path,t=x.name,void((n=document.createElement("a")).href=(0,nY.api)(`/api/files?raw=${encodeURIComponent(e)}`),n.download=t,n.click()))},className:"p-0.5 text-zinc-600 hover:text-zinc-300 transition-colors",title:"Download file",children:(0,z.jsx)(rp,{className:"w-3 h-3"})}),(0,z.jsx)("button",{onClick:()=>{x&&D(x)},className:"p-0.5 text-zinc-600 hover:text-zinc-300 transition-colors",title:"Open in new window",children:(0,z.jsx)(ru.ExternalLink,{className:"w-3 h-3"})}),(0,z.jsx)("button",{onClick:()=>f(null),className:"p-0.5 text-zinc-600 hover:text-zinc-300 transition-colors",children:(0,z.jsx)(F.X,{className:"w-3 h-3"})})]})]}),(0,z.jsx)("div",{className:"flex-1 overflow-auto",children:(0,z.jsx)(rj,{file:x})})]})]})]}):(0,z.jsxs)("div",{className:"h-full flex flex-col bg-zinc-950 border-r border-zinc-800",children:[(0,z.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 border-b border-zinc-800/50 flex-shrink-0",children:[(0,z.jsx)("span",{className:"text-[10px] text-zinc-500 uppercase tracking-wider font-medium",children:"Files"}),(0,z.jsx)("button",{onClick:e,className:"p-0.5 text-zinc-600 hover:text-zinc-300 transition-colors",children:(0,z.jsx)(F.X,{className:"w-3.5 h-3.5"})})]}),(0,z.jsx)("div",{className:"p-3 text-xs text-zinc-500",children:0===n.length?"No development directories configured. Add them in Settings.":"Loading..."})]})}function rj({file:e}){return e.error?(0,z.jsx)("div",{className:"p-3 text-xs text-red-400",children:e.error}):e.image&&e.rawUrl?(0,z.jsx)("div",{className:"flex items-center justify-center p-4 min-h-[200px]",children:(0,z.jsx)("img",{src:(0,nY.api)(e.rawUrl),alt:e.name,className:"max-w-full max-h-[60vh] object-contain rounded"})}):e.image&&e.tooLarge?(0,z.jsxs)("div",{className:"p-3 text-xs text-zinc-500",children:["Image too large (",ry(e.size),")"]}):e.pdf&&e.rawUrl?(0,z.jsx)("iframe",{src:(0,nY.api)(e.rawUrl),className:"w-full h-full border-none",title:e.name}):e.binary?(0,z.jsxs)("div",{className:"p-3 text-xs text-zinc-500",children:["Binary file (",e.ext,", ",ry(e.size),")"]}):void 0!==e.content?(0,z.jsx)("pre",{className:"text-[11px] leading-4 font-mono p-0 m-0",children:(0,z.jsx)("table",{className:"border-collapse w-full",children:(0,z.jsx)("tbody",{children:e.content.split("\n").map((t,n)=>(0,z.jsxs)("tr",{className:"hover:bg-zinc-800/30",children:[(0,z.jsx)("td",{className:"text-right pr-3 pl-3 text-zinc-700 select-none w-[1%] whitespace-nowrap",children:n+1}),(0,z.jsx)("td",{className:`pr-3 whitespace-pre ${rb(e.ext)}`,children:t||" "})]},n))})})}):null}function rz({item:e,depth:t,expanded:n,expandedDirs:r,onClick:a,loadDir:i,activeFile:s}){let[l,o]=(0,N.useState)(null);(0,N.useEffect)(()=>{n&&e.isDir&&!l&&i(e.path).then(e=>o(e.items))},[n,e.isDir,e.path,l,i]);let c=s===e.path;return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)("button",{onClick:()=>a(e),className:`flex items-center gap-1.5 w-full text-left px-2 py-[3px] text-[11px] transition-colors ${c?"bg-indigo-500/10 text-indigo-300":"text-zinc-400 hover:bg-zinc-800/50 hover:text-zinc-200"}`,style:{paddingLeft:`${8+14*t}px`},children:[e.isDir?n?(0,z.jsx)(T.ChevronDown,{className:"w-3 h-3 text-zinc-600 flex-shrink-0"}):(0,z.jsx)(R.ChevronRight,{className:"w-3 h-3 text-zinc-600 flex-shrink-0"}):(0,z.jsx)("span",{className:"w-3 flex-shrink-0"}),(0,z.jsx)(rv,{item:e}),(0,z.jsx)("span",{className:"truncate",children:e.name})]}),n&&e.isDir&&l&&l.map(e=>(0,z.jsx)(rz,{item:e,depth:t+1,expanded:r.has(e.path),expandedDirs:r,onClick:a,loadDir:i,activeFile:s},e.path))]})}function rN({messages:e,onSend:t,loading:n}){let[r,a]=(0,N.useState)(""),i=(0,N.useRef)(null);(0,N.useEffect)(()=>{i.current&&(i.current.scrollTop=i.current.scrollHeight)},[e,n]);let s=()=>{let e=r.trim();e&&!n&&(a(""),t(e))};return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)("div",{ref:i,className:"flex-1 overflow-y-auto px-6 py-4 space-y-4",children:[0===e.length&&!n&&(0,z.jsxs)("div",{className:"text-center py-12",children:[(0,z.jsx)("p",{className:"text-zinc-400 text-sm mb-1",children:"Describe the project you want to build."}),(0,z.jsx)("p",{className:"text-zinc-600 text-xs",children:"I'll help you plan the workspace, agents, and initial tasks."})]}),e.map((e,t)=>(0,z.jsx)("div",{className:`flex ${"user"===e.role?"justify-end":"justify-start"}`,children:(0,z.jsx)("div",{className:`max-w-[80%] rounded-lg px-3 py-2 text-sm ${"user"===e.role?"bg-indigo-600 text-white":"bg-zinc-800 text-zinc-200"}`,children:(0,z.jsx)("p",{className:"whitespace-pre-wrap",children:e.content})})},t)),n&&(0,z.jsx)("div",{className:"flex justify-start",children:(0,z.jsx)("div",{className:"bg-zinc-800 rounded-lg px-4 py-3",children:(0,z.jsxs)("div",{className:"flex gap-1",children:[(0,z.jsx)("span",{className:"w-2 h-2 bg-zinc-500 rounded-full animate-bounce",style:{animationDelay:"0ms"}}),(0,z.jsx)("span",{className:"w-2 h-2 bg-zinc-500 rounded-full animate-bounce",style:{animationDelay:"150ms"}}),(0,z.jsx)("span",{className:"w-2 h-2 bg-zinc-500 rounded-full animate-bounce",style:{animationDelay:"300ms"}})]})})})]}),(0,z.jsx)("div",{className:"px-6 py-3 border-t border-zinc-800 flex-shrink-0",children:(0,z.jsxs)("div",{className:"flex gap-2",children:[(0,z.jsx)("textarea",{value:r,onChange:e=>a(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),s())},placeholder:"Describe your project...",rows:2,className:"flex-1 bg-zinc-900 border border-zinc-700 rounded-lg px-3 py-2 text-sm text-zinc-200 placeholder:text-zinc-600 focus:outline-none focus:border-zinc-500 resize-none"}),(0,z.jsx)("button",{onClick:s,disabled:!r.trim()||n,className:"px-4 bg-indigo-600 hover:bg-indigo-500 disabled:bg-zinc-800 disabled:text-zinc-600 text-white rounded-lg flex items-center gap-1.5 text-sm self-end",children:(0,z.jsx)(n5.Send,{className:"w-3.5 h-3.5"})})]})})]})}let rk=(0,L.default)("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"}]]),rC={claude:"#6366f1",codex:"#22c55e",gemini:"#3b82f6",aider:"#f59e0b",shell:"#78716c",custom:"#a855f7"};function rS({plan:e,onReview:t}){return e?(0,z.jsxs)("div",{className:"flex flex-col h-full",children:[(0,z.jsxs)("div",{className:"flex-1 overflow-y-auto px-5 py-4 space-y-4",children:[(0,z.jsxs)("div",{children:[(0,z.jsx)("div",{className:"text-[10px] uppercase tracking-wider text-zinc-500 mb-1.5",children:"Workspace"}),(0,z.jsxs)("div",{className:"bg-zinc-800/50 rounded-lg p-3 border border-zinc-700/50",children:[(0,z.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,z.jsx)("span",{className:"w-3 h-3 rounded-full",style:{backgroundColor:e.workspace.color}}),(0,z.jsx)("span",{className:"text-sm font-medium text-zinc-200",children:e.workspace.name})]}),e.workspace.description&&(0,z.jsx)("p",{className:"text-xs text-zinc-400 mt-1",children:e.workspace.description})]})]}),e.panes.length>0&&(0,z.jsxs)("div",{children:[(0,z.jsxs)("div",{className:"text-[10px] uppercase tracking-wider text-zinc-500 mb-1.5",children:["Panes (",e.panes.length,")"]}),(0,z.jsx)("div",{className:"space-y-2",children:e.panes.map((e,t)=>(0,z.jsxs)("div",{className:"bg-zinc-800/50 rounded-lg p-3 border border-zinc-700/50",children:[(0,z.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,z.jsx)(S.Terminal,{className:"w-3 h-3 text-zinc-500"}),(0,z.jsx)("span",{className:"text-xs font-medium text-zinc-200",children:e.title}),(0,z.jsx)("span",{className:"text-[9px] px-1.5 py-0.5 rounded font-medium",style:{backgroundColor:`${rC[e.agentType]||"#6366f1"}20`,color:rC[e.agentType]||"#6366f1"},children:e.agentType})]}),e.description&&(0,z.jsx)("p",{className:"text-[11px] text-zinc-500 mt-1",children:e.description}),e.cwd&&(0,z.jsx)("p",{className:"text-[10px] text-zinc-600 font-mono mt-1",children:e.cwd})]},t))})]}),e.summary&&(0,z.jsxs)("div",{children:[(0,z.jsx)("div",{className:"text-[10px] uppercase tracking-wider text-zinc-500 mb-1.5",children:"Summary"}),(0,z.jsx)("p",{className:"text-xs text-zinc-400",children:e.summary})]})]}),(0,z.jsx)("div",{className:"px-5 py-3 border-t border-zinc-800 flex-shrink-0",children:(0,z.jsx)("button",{onClick:t,disabled:!e.panes.length,className:"w-full py-2 text-sm font-medium bg-indigo-600 hover:bg-indigo-500 disabled:bg-zinc-800 disabled:text-zinc-600 text-white rounded-lg transition-colors",children:"Review Plan"})})]}):(0,z.jsxs)("div",{className:"flex flex-col items-center justify-center h-full px-6 text-center",children:[(0,z.jsx)(rk,{className:"w-8 h-8 text-zinc-700 mb-3"}),(0,z.jsx)("p",{className:"text-zinc-500 text-sm",children:"Your project plan will appear here as you chat."})]})}var rE=e.i(871689);let rD=(0,L.default)("rocket",[["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}],["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09",key:"u4xsad"}],["path",{d:"M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z",key:"676m9"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05",key:"92ym6u"}]]),rP=[{value:"claude",label:"Claude Code"},{value:"codex",label:"Codex"},{value:"gemini",label:"Gemini"},{value:"aider",label:"Aider"},{value:"forge",label:"Forge"},{value:"shell",label:"Shell"},{value:"custom",label:"Custom"}],rM=["#ef4444","#f97316","#f59e0b","#eab308","#84cc16","#22c55e","#14b8a6","#06b6d4","#3b82f6","#6366f1","#8b5cf6","#a855f7","#d946ef","#ec4899","#f43f5e","#78716c"];function rT({plan:e,onUpdate:t,onBack:n,onLaunch:r}){let[a,i]=(0,N.useState)([]);(0,N.useEffect)(()=>{fetch((0,nY.api)("/api/config")).then(e=>e.json()).then(e=>{e.customModels&&i(e.customModels)}).catch(()=>{})},[]);let s=(n,r)=>{t({...e,workspace:{...e.workspace,[n]:r}})},l=(n,r,a)=>{let i=[...e.panes];i[n]={...i[n],[r]:a},t({...e,panes:i})},o=e.workspace.name.trim()&&e.panes.length>0&&e.panes.every(e=>e.cwd.trim());return(0,z.jsxs)("div",{className:"max-w-3xl mx-auto px-6 py-6 space-y-6",children:[(0,z.jsxs)("div",{className:"flex items-center justify-between",children:[(0,z.jsxs)("button",{onClick:n,className:"flex items-center gap-1.5 text-xs text-zinc-400 hover:text-white",children:[(0,z.jsx)(rE.ArrowLeft,{className:"w-3.5 h-3.5"}),"Back to Chat"]}),(0,z.jsxs)("button",{onClick:r,disabled:!o,className:"flex items-center gap-1.5 px-4 py-2 text-sm font-medium bg-green-600 hover:bg-green-500 disabled:bg-zinc-800 disabled:text-zinc-600 text-white rounded-lg transition-colors",children:[(0,z.jsx)(rD,{className:"w-3.5 h-3.5"}),"Launch Space"]})]}),(0,z.jsxs)("div",{className:"bg-zinc-900 rounded-lg border border-zinc-700 p-4 space-y-3",children:[(0,z.jsx)("div",{className:"text-[10px] uppercase tracking-wider text-zinc-500",children:"Workspace"}),(0,z.jsxs)("div",{className:"flex gap-3",children:[(0,z.jsxs)("div",{className:"flex-1",children:[(0,z.jsx)("label",{className:"text-[10px] text-zinc-500 block mb-1",children:"Name"}),(0,z.jsx)("input",{value:e.workspace.name,onChange:e=>s("name",e.target.value),className:"w-full bg-zinc-800 border border-zinc-700 rounded px-3 py-1.5 text-sm text-zinc-200 focus:outline-none focus:border-zinc-500"})]}),(0,z.jsxs)("div",{children:[(0,z.jsx)("label",{className:"text-[10px] text-zinc-500 block mb-1",children:"Color"}),(0,z.jsx)("div",{className:"flex gap-1 flex-wrap",style:{width:128},children:rM.map(t=>(0,z.jsx)("button",{onClick:()=>s("color",t),className:`w-5 h-5 rounded-full ${e.workspace.color===t?"ring-2 ring-white ring-offset-1 ring-offset-zinc-900":"hover:ring-1 hover:ring-zinc-500"}`,style:{backgroundColor:t}},t))})]})]}),(0,z.jsxs)("div",{children:[(0,z.jsx)("label",{className:"text-[10px] text-zinc-500 block mb-1",children:"Description"}),(0,z.jsx)("textarea",{value:e.workspace.description,onChange:e=>s("description",e.target.value),rows:2,className:"w-full bg-zinc-800 border border-zinc-700 rounded px-3 py-1.5 text-sm text-zinc-200 focus:outline-none focus:border-zinc-500 resize-none"})]})]}),(0,z.jsxs)("div",{className:"space-y-3",children:[(0,z.jsxs)("div",{className:"flex items-center justify-between",children:[(0,z.jsxs)("div",{className:"text-[10px] uppercase tracking-wider text-zinc-500",children:["Panes (",e.panes.length,")"]}),(0,z.jsxs)("button",{onClick:()=>{t({...e,panes:[...e.panes,{title:"New Pane",agentType:"claude",cwd:"~",description:""}]})},className:"flex items-center gap-1 text-xs text-zinc-400 hover:text-white",children:[(0,z.jsx)(k.Plus,{className:"w-3 h-3"})," Add Pane"]})]}),e.panes.map((n,r)=>(0,z.jsx)("div",{className:"bg-zinc-900 rounded-lg border border-zinc-700 p-4 space-y-2.5",children:(0,z.jsxs)("div",{className:"flex items-start gap-3",children:[(0,z.jsxs)("div",{className:"flex-1 space-y-2.5",children:[(0,z.jsxs)("div",{className:"flex gap-3",children:[(0,z.jsxs)("div",{className:"flex-1",children:[(0,z.jsx)("label",{className:"text-[10px] text-zinc-500 block mb-1",children:"Title"}),(0,z.jsx)("input",{value:n.title,onChange:e=>l(r,"title",e.target.value),className:"w-full bg-zinc-800 border border-zinc-700 rounded px-2 py-1 text-xs text-zinc-200 focus:outline-none focus:border-zinc-500"})]}),(0,z.jsxs)("div",{className:"w-32",children:[(0,z.jsx)("label",{className:"text-[10px] text-zinc-500 block mb-1",children:"Agent"}),(0,z.jsx)("select",{value:n.agentType,onChange:e=>l(r,"agentType",e.target.value),className:"w-full bg-zinc-800 border border-zinc-700 rounded px-2 py-1 text-xs text-zinc-200",children:rP.map(e=>(0,z.jsx)("option",{value:e.value,children:e.label},e.value))})]}),"forge"===n.agentType&&a.length>0&&(0,z.jsxs)("div",{className:"w-40",children:[(0,z.jsx)("label",{className:"text-[10px] text-zinc-500 block mb-1",children:"Custom Model"}),(0,z.jsxs)("select",{value:n.customModelId||"",onChange:e=>l(r,"customModelId",e.target.value),className:"w-full bg-zinc-800 border border-zinc-700 rounded px-2 py-1 text-xs text-zinc-200",children:[(0,z.jsx)("option",{value:"",children:"Default"}),a.map(e=>(0,z.jsx)("option",{value:e.id,children:e.name},e.id))]})]})]}),(0,z.jsxs)("div",{children:[(0,z.jsx)("label",{className:"text-[10px] text-zinc-500 block mb-1",children:"Working Directory"}),(0,z.jsx)("input",{value:n.cwd,onChange:e=>l(r,"cwd",e.target.value),className:"w-full bg-zinc-800 border border-zinc-700 rounded px-2 py-1 text-xs font-mono text-zinc-200 focus:outline-none focus:border-zinc-500",placeholder:"/path/to/project"})]}),(0,z.jsxs)("div",{children:[(0,z.jsx)("label",{className:"text-[10px] text-zinc-500 block mb-1",children:"Initial Prompt (optional)"}),(0,z.jsx)("textarea",{value:n.initialPrompt||"",onChange:e=>l(r,"initialPrompt",e.target.value),rows:2,className:"w-full bg-zinc-800 border border-zinc-700 rounded px-2 py-1 text-xs text-zinc-200 focus:outline-none focus:border-zinc-500 resize-none",placeholder:"What should this agent start working on?"})]})]}),(0,z.jsx)("button",{onClick:()=>{t({...e,panes:e.panes.filter((e,t)=>t!==r)})},className:"text-zinc-600 hover:text-red-400 mt-4",title:"Remove pane",children:(0,z.jsx)(O.Trash2,{className:"w-3.5 h-3.5"})})]})},r))]}),(0,z.jsx)("div",{className:"flex justify-end pt-2",children:(0,z.jsxs)("button",{onClick:r,disabled:!o,className:"flex items-center gap-1.5 px-6 py-2.5 text-sm font-medium bg-green-600 hover:bg-green-500 disabled:bg-zinc-800 disabled:text-zinc-600 text-white rounded-lg transition-colors",children:[(0,z.jsx)(rD,{className:"w-4 h-4"}),"Launch Space"]})})]})}function rR({isOpen:e,onClose:t,onLaunch:n}){let[r,a]=(0,N.useState)([]),[i,s]=(0,N.useState)(null),[l,o]=(0,N.useState)(!1),[c,d]=(0,N.useState)("chat"),[u,p]=(0,N.useState)(null),h=(0,N.useCallback)(async e=>{let t=[...r,{role:"user",content:e}];a(t),o(!0),p(null);try{let e=await fetch((0,nY.api)("/api/wizard/chat"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({messages:t,currentPlan:i})}),n=await e.json();if(!e.ok)throw Error(n.error);a([...t,{role:"assistant",content:n.reply}]),n.plan&&s(n.plan)}catch(e){p(e.message)}o(!1)},[r,i]),x=(0,N.useCallback)(async()=>{if(i)try{let e=await fetch((0,nY.api)("/api/workspaces"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:i.workspace.name,description:i.workspace.description,color:i.workspace.color})}),r=(await e.json()).id;for(let e of i.panes)await fetch((0,nY.api)("/api/panes"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:e.title,agentType:e.agentType,cwd:e.cwd,customCommand:e.customCommand,workspaceId:r,customModelId:e.customModelId})});n(r),t()}catch(e){p(e.message)}},[i,n,t]);return e?(0,z.jsxs)("div",{className:"fixed inset-0 z-50 bg-zinc-950/95 flex flex-col",children:[(0,z.jsxs)("div",{className:"flex items-center justify-between px-6 py-3 border-b border-zinc-800 flex-shrink-0",children:[(0,z.jsx)("h2",{className:"text-sm font-semibold text-zinc-100",children:"Plan a Project"}),(0,z.jsx)("button",{onClick:t,className:"text-zinc-500 hover:text-white",children:(0,z.jsx)(F.X,{className:"w-4 h-4"})})]}),u&&(0,z.jsx)("div",{className:"px-6 py-2 bg-red-500/10 border-b border-red-500/20 text-xs text-red-400",children:u}),(0,z.jsx)("div",{className:"flex-1 flex overflow-hidden min-h-0",children:"chat"===c?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)("div",{className:"flex-1 flex flex-col border-r border-zinc-800 min-w-0",children:(0,z.jsx)(rN,{messages:r,onSend:h,loading:l})}),(0,z.jsx)("div",{className:"w-[380px] flex-shrink-0 overflow-y-auto",children:(0,z.jsx)(rS,{plan:i,onReview:()=>d("review")})})]}):(0,z.jsx)("div",{className:"flex-1 overflow-y-auto",children:(0,z.jsx)(rT,{plan:i,onUpdate:s,onBack:()=>d("chat"),onLaunch:x})})})]}):null}function rL({panes:e,renderPane:t}){if(0===e.length)return null;if(1===e.length)return(0,z.jsx)("div",{className:"flex-1 p-1 overflow-hidden",children:(0,z.jsx)(rI,{id:e[0].id,children:n=>t(e[0],n)})});let n=e.length<=4?2:3,r=[];for(let t=0;t<e.length;t+=n)r.push(e.slice(t,t+n));return(0,z.jsx)(nA,{orientation:"vertical",className:"flex-1 p-1",children:r.map((e,n)=>(0,z.jsxs)(N.default.Fragment,{children:[n>0&&(0,z.jsx)(nH,{className:"h-1.5 flex items-center justify-center group cursor-row-resize",children:(0,z.jsx)("div",{className:"w-8 h-0.5 rounded-full bg-zinc-700 group-hover:bg-zinc-500 group-active:bg-indigo-500 transition-colors"})}),(0,z.jsx)(nB,{minSize:15,children:1===e.length?(0,z.jsx)("div",{className:"h-full p-0.5",children:(0,z.jsx)(rI,{id:e[0].id,children:n=>t(e[0],n)})}):(0,z.jsx)(nA,{orientation:"horizontal",className:"h-full",children:e.map((e,n)=>(0,z.jsxs)(N.default.Fragment,{children:[n>0&&(0,z.jsx)(nH,{className:"w-1.5 flex items-center justify-center group cursor-col-resize",children:(0,z.jsx)("div",{className:"h-8 w-0.5 rounded-full bg-zinc-700 group-hover:bg-zinc-500 group-active:bg-indigo-500 transition-colors"})}),(0,z.jsx)(nB,{minSize:15,children:(0,z.jsx)("div",{className:"h-full p-0.5",children:(0,z.jsx)(rI,{id:e.id,children:n=>t(e,n)})})})]},e.id))})})]},`row-${n}`))})}function rI({id:e,children:t}){let{attributes:n,listeners:r,setNodeRef:a,transform:i,transition:s,isDragging:l}=function(e){var t,n,r,a;let{animateLayoutChanges:i=tF,attributes:s,disabled:l,data:o,getNewIndex:c=tA,id:d,strategy:u,resizeObserverConfig:p,transition:x=tB}=e,{items:f,containerId:m,activeIndex:g,disabled:b,disableTransforms:v,sortedRects:y,overIndex:w,useDragOverlay:j,strategy:z}=(0,N.useContext)(tO),k=(t=l,n=b,"boolean"==typeof t?{draggable:t,droppable:!1}:{draggable:null!=(r=null==t?void 0:t.draggable)?r:n.draggable,droppable:null!=(a=null==t?void 0:t.droppable)?a:n.droppable}),C=f.indexOf(d),S=(0,N.useMemo)(()=>({sortable:{containerId:m,index:C,items:f},...o}),[m,o,C,f]),E=(0,N.useMemo)(()=>f.slice(f.indexOf(d)),[f,d]),{rect:D,node:P,isOver:M,setNodeRef:T}=function(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:a}=e,i=ex("Droppable"),{active:s,dispatch:l,over:o,measureDroppableContainers:c}=(0,N.useContext)(tb),d=(0,N.useRef)({disabled:n}),u=(0,N.useRef)(!1),p=(0,N.useRef)(null),x=(0,N.useRef)(null),{disabled:f,updateMeasurementsFor:m,timeout:g}={...tS,...a},b=ec(null!=m?m:r),v=ti({callback:(0,N.useCallback)(()=>{if(!u.current){u.current=!0;return}null!=x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{c(Array.isArray(b.current)?b.current:[b.current]),x.current=null},g)},[g]),disabled:f||!s}),[y,w]=eu((0,N.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),u.current=!1),e&&v.observe(e))},[v])),j=ec(t);return(0,N.useEffect)(()=>{v&&y.current&&(v.disconnect(),u.current=!1,v.observe(y.current))},[y,v]),(0,N.useEffect)(()=>(l({type:h.RegisterDroppable,element:{id:r,key:i,disabled:n,node:y,rect:p,data:j}}),()=>l({type:h.UnregisterDroppable,key:i,id:r})),[r]),(0,N.useEffect)(()=>{n!==d.current.disabled&&(l({type:h.SetDroppableDisabled,id:r,key:i,disabled:n}),d.current.disabled=n)},[r,i,n,l]),{active:s,rect:p,isOver:(null==o?void 0:o.id)===r,node:y,over:o,setNodeRef:w}}({id:d,data:S,disabled:k.droppable,resizeObserverConfig:{updateMeasurementsFor:E,...p}}),{active:R,activatorEvent:L,activeNodeRect:I,attributes:O,setNodeRef:$,listeners:A,isDragging:F,over:B,setActivatorNodeRef:U,transform:H}=function(e){let{id:t,data:n,disabled:r=!1,attributes:a}=e,i=ex("Draggable"),{activators:s,activatorEvent:l,active:o,activeNodeRect:c,ariaDescribedById:d,draggableNodes:u,over:p}=(0,N.useContext)(tb),{role:h=tC,roleDescription:x="draggable",tabIndex:f=0}=null!=a?a:{},m=(null==o?void 0:o.id)===t,g=(0,N.useContext)(m?tz:tk),[b,v]=eu(),[y,w]=eu(),j=(0,N.useMemo)(()=>s.reduce((e,n)=>{let{eventName:r,handler:a}=n;return e[r]=e=>{a(e,t)},e},{}),[s,t]),z=ec(n);return el(()=>(u.set(t,{id:t,key:i,node:b,activatorNode:y,data:z}),()=>{let e=u.get(t);e&&e.key===i&&u.delete(t)}),[u,t]),{active:o,activatorEvent:l,activeNodeRect:c,attributes:(0,N.useMemo)(()=>({role:h,tabIndex:f,"aria-disabled":r,"aria-pressed":!!m&&h===tC||void 0,"aria-roledescription":x,"aria-describedby":d.draggable}),[r,h,f,m,x,d.draggable]),isDragging:m,listeners:r?void 0:j,node:b,over:p,setNodeRef:v,setActivatorNodeRef:w,transform:g}}({id:d,data:S,attributes:{...tW,...s},disabled:k.draggable}),W=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return(0,N.useMemo)(()=>e=>{t.forEach(t=>t(e))},t)}(T,$),K=!!R,G=K&&!v&&tM(g)&&tM(w),X=!j&&F,q=X&&G?H:null,Y=G?null!=q?q:(null!=u?u:z)({rects:y,activeNodeRect:I,activeIndex:g,overIndex:w,index:C}):null,J=tM(g)&&tM(w)?c({id:d,items:f,activeIndex:g,overIndex:w}):C,V=null==R?void 0:R.id,_=(0,N.useRef)({activeId:V,items:f,newIndex:J,containerId:m}),Q=f!==_.current.items,Z=i({active:R,containerId:m,isDragging:F,isSorting:K,id:d,index:C,items:f,newIndex:_.current.newIndex,previousItems:_.current.items,previousContainerId:_.current.containerId,transition:x,wasDragging:null!=_.current.activeId}),ee=function(e){let{disabled:t,index:n,node:r,rect:a}=e,[i,s]=(0,N.useState)(null),l=(0,N.useRef)(n);return el(()=>{if(!t&&n!==l.current&&r.current){let e=a.current;if(e){let t=eB(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&s(n)}}n!==l.current&&(l.current=n)},[t,n,r,a]),(0,N.useEffect)(()=>{i&&s(null)},[i]),i}({disabled:!Z,index:C,node:P,rect:D});return(0,N.useEffect)(()=>{K&&_.current.newIndex!==J&&(_.current.newIndex=J),m!==_.current.containerId&&(_.current.containerId=m),f!==_.current.items&&(_.current.items=f)},[K,J,m,f]),(0,N.useEffect)(()=>{if(V===_.current.activeId)return;if(null!=V&&null==_.current.activeId){_.current.activeId=V;return}let e=setTimeout(()=>{_.current.activeId=V},50);return()=>clearTimeout(e)},[V]),{active:R,activeIndex:g,attributes:O,data:S,rect:D,index:C,newIndex:J,items:f,isOver:M,isSorting:K,isDragging:F,listeners:A,node:P,overIndex:w,over:B,setNodeRef:W,setActivatorNodeRef:U,setDroppableNodeRef:T,setDraggableNodeRef:$,transform:null!=ee?ee:Y,transition:ee||Q&&_.current.newIndex===C?tH:(!X||eb(L))&&x&&(K||Z)?ey.Transition.toString({...x,property:tU}):void 0}}({id:e}),o={transform:ey.Transform.toString(i),transition:s,opacity:l?.5:1,zIndex:l?50:"auto"};return(0,z.jsx)("div",{ref:a,style:o,className:"h-full",children:t({...n,...r})})}function rO(){return(0,z.jsx)(nZ.TotpGate,{children:e=>(0,z.jsx)(r$,{terminalToken:e})})}function r$({terminalToken:e}){let t=(0,V.useRouter)(),{basePath:n,hasNetwork:r,hasCollaboration:a,hasCortex:i}=(0,n_.useTier)(),[s,l]=(0,N.useState)([]),[o,c]=(0,N.useState)(!0),[d,u]=(0,N.useState)(!0),[p,h]=(0,N.useState)(!1),[x,f]=(0,N.useState)(null),[m,g]=(0,N.useState)(new Set),[b,v]=(0,N.useState)(new Set),[y,w]=(0,N.useState)(!1),[j,L]=(0,N.useState)(!0);!function(){let e=(0,n6.useQueryClient)(),{hasCollaboration:t}=(0,n_.useTier)();(0,N.useEffect)(()=>{if(!t)return;let n=new EventSource((0,nY.api)("/api/events")),r=()=>{e.invalidateQueries({queryKey:["workspace-messages"]})},a=()=>{e.invalidateQueries({queryKey:["workspace-context"]})};return n.addEventListener("workspace:message",r),n.addEventListener("workspace:request",r),n.addEventListener("workspace:context_updated",a),()=>{n.removeEventListener("workspace:message",r),n.removeEventListener("workspace:request",r),n.removeEventListener("workspace:context_updated",a),n.close()}},[e,t])}();let[Q,Z]=(0,N.useState)([]),[ee,et]=(0,N.useState)(null),[en,er]=(0,N.useState)(!1),[ea,ei]=(0,N.useState)(!1),[es,el]=(0,N.useState)(!1),[eo,ec]=(0,N.useState)(""),[ed,eu]=(0,N.useState)("#6366f1"),[ep,eh]=(0,N.useState)(null),[ex,ef]=(0,N.useState)(""),[em,eg]=(0,N.useState)(null),[eb,ev]=(0,N.useState)(!1),[ey,ew]=(0,N.useState)(null),ej=(0,N.useCallback)(e=>{ew(e),ev(!0)},[]),[ez,eN]=(0,N.useState)(""),[ek,eC]=(0,N.useState)(""),[eS,eE]=(0,N.useState)("#6366f1"),[eD,eM]=(0,N.useState)(""),[eT,eR]=(0,N.useState)("claude"),[eL,eO]=(0,N.useState)("new"),[e$,eA]=(0,N.useState)(""),[eF,eB]=(0,N.useState)(""),eU=(0,n1.useRemoteWorkspaces)(),[eH,eW]=(0,N.useState)(new Set),eK=(0,N.useCallback)(e=>{eW(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),[eG,eX]=(0,N.useState)(""),[eq,eY]=(0,N.useState)([]),[eJ,eV]=(0,N.useState)(!1),[e_,eQ]=(0,N.useState)(!1),[eZ,e0]=(0,N.useState)(null),[e1,e5]=(0,N.useState)(!0),e2=(0,N.useRef)(null),e3=(0,N.useRef)(null),e4=(0,N.useRef)(null),e8=(0,N.useCallback)(async()=>{let e=await fetch((0,nY.api)("/api/workspaces")),t=await e.json();Z(t);let n=t.find(e=>e.isActive);return et(n||null),u(!1),n||null},[]),e7=(0,N.useCallback)(async()=>{let e=await fetch((0,nY.api)("/api/panes")),t=await e.json();l(t);let n=new Set;for(let e of t)e.isPopout&&n.add(e.id);v(n),c(!1)},[]);(0,N.useEffect)(()=>{e8()},[e8]),(0,N.useEffect)(()=>{y&&e7()},[y,e7]),(0,N.useEffect)(()=>{let e=new BroadcastChannel("spaces-panes");return e4.current=e,e.onmessage=e=>{let t=e.data;"popout-opened"===t.type?v(e=>new Set(e).add(t.paneId)):"popout-closed"===t.type?(v(e=>{let n=new Set(e);return n.delete(t.paneId),n}),l(e=>e.map(e=>e.id===t.paneId?{...e,isPopout:!1}:e))):"pane-updated"===t.type&&l(e=>e.map(e=>e.id===t.paneId?{...e,...t.data}:e))},()=>e.close()},[e7]);let[e9,te]=(0,N.useState)(0);(0,N.useEffect)(()=>{if(!o)for(let e of s)e.isPopout&&td(e)},[o,e9]),(0,N.useEffect)(()=>{if(!(n0.AGENT_TYPES[eT]?.supportsResume&&"resume"===eL))return;eV(!0);let e=setTimeout(()=>{let e=new URLSearchParams({sortBy:"modified",sortDir:"DESC",limit:"200"});eG&&e.set("search",eG),e1&&ek&&e.set("projectPath",ek),e.set("agentType",eT),fetch((0,nY.api)(`/api/sessions?${e}`)).then(e=>e.json()).then(e=>{eY(e.sessions||[]),eV(!1)}).catch(()=>eV(!1))},300*!!eG);return()=>clearTimeout(e)},[eT,eL,eG,e1,ek]),(0,N.useEffect)(()=>{function e(e){e2.current&&!e2.current.contains(e.target)&&eQ(!1),e3.current&&!e3.current.contains(e.target)&&er(!1)}return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);let tn=(0,N.useCallback)(async()=>{let e,t=n0.AGENT_TYPES[eT],n=ek||eZ?.projectPath||"/";"shell"!==eT&&(e="resume"===eL&&t?.supportsResume?eZ?.sessionId||eD:"new");let r=ez||(eZ?eZ.customName||eZ.firstPrompt?.slice(0,50)||t?.name||"Agent":"")||("shell"===eT?"Terminal":t?.name||"Agent"),a=ee?.collaboration&&"shell"!==eT,i=await fetch((0,nY.api)("/api/panes"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:r,color:eS,cwd:n,claudeSessionId:e,agentType:eT,customCommand:"custom"===eT?e$:void 0,nodeId:eF||void 0,isCollaborating:a||void 0})}),s=await i.json();l(e=>[...e,s]),(0,re.track)("pane_created",{agentType:eT}),h(!1),eN(""),eC(""),eE("#6366f1"),eM(""),eR("shell"),eO("new"),eA(""),eB(""),e0(null),eX("")},[ez,ek,eS,eD,eT,eL,e$,eF,eZ]),tr=(0,N.useCallback)(async e=>{let t=s.find(t=>t.id===e);await fetch((0,nY.api)(`/api/panes/${e}`),{method:"DELETE"}),l(t=>t.filter(t=>t.id!==e)),t&&(0,re.track)("pane_closed",{agentType:t.agentType}),x===e&&f(null),v(t=>{let n=new Set(t);return n.delete(e),n})},[x,s]),ta=(0,N.useCallback)(async(e,t)=>{await fetch((0,nY.api)(`/api/panes/${e}`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),l(n=>n.map(n=>n.id===e?{...n,...t}:n))},[]),ti=(0,N.useCallback)(e=>{f(t=>t===e?null:e)},[]),ts=(0,N.useCallback)(e=>{g(t=>new Set(t).add(e)),x===e&&f(null)},[x]),tl=(0,N.useCallback)(e=>{g(t=>{let n=new Set(t);return n.delete(e),n})},[]),to=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return(0,N.useMemo)(()=>[...t].filter(e=>null!=e),[...t])}(eP(tt,{activationConstraint:{distance:8}}),eP(e6)),tc=(0,N.useCallback)(e=>{let{active:t,over:n}=e;n&&t.id!==n.id&&l(e=>{let r=e.findIndex(e=>e.id===t.id),a=e.findIndex(e=>e.id===n.id);if(-1===r||-1===a)return e;let i=tP(e,r,a);return i.forEach((e,t)=>{e.sortOrder!==t&&fetch((0,nY.api)(`/api/panes/${e.id}`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({sortOrder:t})}).catch(()=>{})}),i.map((e,t)=>({...e,sortOrder:t}))})},[]),td=(0,N.useCallback)(e=>{let t=e.winWidth||900,n=e.winHeight||600,r=e.winX??Math.round(screen.width/2-t/2),a=e.winY??Math.round(screen.height/2-n/2),i=`left=${r},top=${a},width=${t},height=${n},menubar=no,toolbar=no,location=no,status=no`;window.open((0,nY.api)(`/terminal/pane/${e.id}`),`spaces-pane-${e.id}`,i),v(t=>new Set(t).add(e.id)),fetch((0,nY.api)(`/api/panes/${e.id}`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isPopout:!0,winX:r,winY:a,winWidth:t,winHeight:n})})},[]),tu=(0,N.useCallback)(e=>{let t=s.find(t=>t.id===e);t&&td(t)},[s,td]),tp=(0,N.useCallback)(async e=>{e4.current?.postMessage({type:"close-popouts"}),await fetch((0,nY.api)(`/api/panes/${e}`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isPopout:!1})}),v(t=>{let n=new Set(t);return n.delete(e),n})},[]),th=(0,N.useCallback)(()=>{b.size>0&&(e4.current?.postMessage({type:"close-popouts"}),v(new Set))},[b]),tx=(0,N.useCallback)(async e=>{th(),await fetch((0,nY.api)("/api/workspaces"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"switch",workspaceId:e})}),f(null),await e8(),await e7(),er(!1),y?(0,re.track)("workspace_switched"):(0,re.track)("workspace_entered"),w(!0),te(e=>e+1)},[e8,e7,th,y]),tf=(0,N.useCallback)(async()=>{eo.trim()&&ee&&(await fetch((0,nY.api)("/api/workspaces"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"duplicate",sourceId:ee.id,name:eo.trim(),color:ed})}),ec(""),eu("#6366f1"),ei(!1),await e8())},[eo,ed,ee,e8]),tm=(0,N.useCallback)(async()=>{let e=await fetch((0,nY.api)("/api/workspaces"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:"New Space",color:"#6366f1"})}),t=await e.json();(0,re.track)("workspace_created"),await tx(t.id)},[tx]),tg=(0,N.useCallback)(async e=>{th(),await fetch((0,nY.api)(`/api/workspaces/${e}`),{method:"DELETE"}),(0,re.track)("workspace_deleted"),await e8(),await e7(),er(!1)},[e8,e7,th]),tb=(0,N.useCallback)(()=>{th(),l([]),w(!1)},[th]),tv=(0,N.useCallback)(async(e,t)=>{await fetch((0,nY.api)(`/api/workspaces/${e}`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t})}),eh(null),await e8()},[e8]),ty=s.filter(e=>!b.has(e.id)&&!m.has(e.id)),tw=s.filter(e=>m.has(e.id));return y?o?(0,z.jsx)("div",{className:"flex items-center justify-center h-screen bg-zinc-950",children:(0,z.jsx)(C.Loader2,{className:"w-6 h-6 animate-spin text-indigo-500"})}):(0,z.jsxs)("div",{className:"h-screen flex flex-col bg-zinc-950 text-zinc-100",children:[(0,z.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 border-b border-zinc-800 flex-shrink-0",children:[(0,z.jsxs)("div",{className:"flex items-center gap-3",children:[(0,z.jsx)("button",{onClick:tb,className:"p-1.5 -ml-1 text-zinc-500 hover:text-white hover:bg-zinc-800 rounded-md transition-colors",title:"Close space and go home",children:(0,z.jsx)(U.Home,{className:"w-4 h-4"})}),(0,z.jsx)("div",{className:"w-px h-4 bg-zinc-800"}),(0,z.jsx)("h1",{className:"text-sm font-semibold",children:"Spaces"}),(0,z.jsxs)("div",{ref:e3,className:"relative",children:[(0,z.jsxs)("button",{onClick:()=>er(!en),className:"flex items-center gap-1.5 px-2.5 py-1 text-xs bg-zinc-800 border border-zinc-700 rounded-md hover:border-zinc-600 transition-colors",children:[ee&&(0,z.jsx)("span",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{backgroundColor:ee.color}}),(0,z.jsx)("span",{className:"max-w-[150px] truncate",children:ee?.name||"No space"}),(0,z.jsx)(T.ChevronDown,{className:"w-3 h-3 text-zinc-500"})]}),en&&(0,z.jsxs)("div",{className:"absolute z-50 top-full left-0 mt-1 w-72 bg-zinc-800 border border-zinc-700 rounded-md shadow-xl overflow-hidden",children:[(0,z.jsx)("div",{className:"p-2 border-b border-zinc-700/50 text-[10px] text-zinc-500 uppercase tracking-wider font-medium",children:"Switch Space"}),(0,z.jsx)("div",{className:"max-h-[300px] overflow-y-auto",children:Q.map(e=>(0,z.jsx)("div",{className:"flex items-center gap-2 hover:bg-zinc-700/50 transition-colors group",children:ep===e.id?(0,z.jsxs)("div",{className:"flex items-center gap-1 flex-1 px-3 py-2",children:[(0,z.jsx)("input",{autoFocus:!0,value:ex,onChange:e=>ef(e.target.value),onKeyDown:t=>{"Enter"===t.key&&tv(e.id,ex),"Escape"===t.key&&eh(null)},className:"flex-1 bg-transparent border border-zinc-600 rounded px-1.5 py-0.5 text-xs focus:outline-none focus:border-indigo-400"}),(0,z.jsx)("button",{onClick:()=>tv(e.id,ex),className:"text-green-400 hover:text-green-300",children:(0,z.jsx)(A.Check,{className:"w-3 h-3"})})]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)("button",{onClick:()=>tx(e.id),className:"flex items-center gap-2 flex-1 px-3 py-2 text-left",children:[(0,z.jsx)("span",{className:"w-2.5 h-2.5 rounded-full flex-shrink-0",style:{backgroundColor:e.color}}),(0,z.jsx)("span",{className:"text-xs text-white truncate flex-1",children:e.name}),(0,z.jsxs)("span",{className:"text-[10px] text-zinc-500",children:[e.paneCount||0," panes"]}),e.isActive&&(0,z.jsx)("span",{className:"text-[10px] text-indigo-400",children:"active"})]}),(0,z.jsxs)("div",{className:"flex items-center gap-0.5 pr-2 opacity-0 group-hover:opacity-100",children:[(0,z.jsx)("button",{onClick:t=>{t.stopPropagation(),eh(e.id),ef(e.name)},className:"p-1 text-zinc-500 hover:text-white rounded",title:"Rename",children:(0,z.jsx)($.Pencil,{className:"w-2.5 h-2.5"})}),!e.isActive&&Q.length>1&&(0,z.jsx)("button",{onClick:t=>{t.stopPropagation(),confirm(`Delete space "${e.name}" and all its panes?`)&&tg(e.id)},className:"p-1 text-zinc-500 hover:text-red-400 rounded",title:"Delete",children:(0,z.jsx)(O.Trash2,{className:"w-2.5 h-2.5"})})]})]})},e.id))}),(0,z.jsxs)("div",{className:"border-t border-zinc-700/50 p-1.5 flex gap-1",children:[(0,z.jsxs)("button",{onClick:tm,className:"flex items-center gap-1.5 px-2.5 py-1.5 text-[11px] text-zinc-400 hover:text-white hover:bg-zinc-700 rounded transition-colors flex-1",children:[(0,z.jsx)(k.Plus,{className:"w-3 h-3"})," New Empty"]}),(0,z.jsxs)("button",{onClick:()=>{el(!0),er(!1)},className:"flex items-center gap-1.5 px-2.5 py-1.5 text-[11px] text-indigo-400 hover:text-indigo-300 hover:bg-indigo-500/10 rounded transition-colors flex-1",children:[(0,z.jsx)(J,{className:"w-3 h-3"})," Plan Project"]}),(0,z.jsxs)("button",{onClick:()=>{ei(!0),er(!1)},className:"flex items-center gap-1.5 px-2.5 py-1.5 text-[11px] text-zinc-400 hover:text-white hover:bg-zinc-700 rounded transition-colors flex-1",children:[(0,z.jsx)(B.Copy,{className:"w-3 h-3"})," Duplicate"]})]})]})]}),(0,z.jsxs)("span",{className:"text-[11px] text-zinc-500",children:[ty.length," pane",1!==ty.length?"s":"",b.size>0&&` + ${b.size} popped out`]})]}),(0,z.jsxs)("div",{className:"flex items-center gap-2",children:[(0,z.jsxs)("button",{onClick:()=>ev(!eb),className:`flex items-center gap-1.5 px-2.5 py-1.5 text-xs rounded-md border transition-colors ${eb?"border-amber-500/50 bg-amber-600/20 text-amber-400":"border-zinc-700 text-zinc-500 hover:text-zinc-300 hover:border-zinc-600"}`,title:eb?"Hide file explorer":"Show file explorer",children:[(0,z.jsx)(P.FolderOpen,{className:"w-3.5 h-3.5"}),"Files"]}),a&&ee&&(0,z.jsxs)("button",{onClick:async()=>{let e=!ee.collaboration;for(let t of(await fetch((0,nY.api)(`/api/workspaces/${ee.id}`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({collaboration:e})}),et(t=>t?{...t,collaboration:e}:t),Z(t=>t.map(t=>t.id===ee.id?{...t,collaboration:e}:t)),s.filter(e=>e.workspaceId===ee.id&&"shell"!==e.agentType)))t.isCollaborating!==e&&await ta(t.id,{isCollaborating:e})},className:`flex items-center gap-1.5 px-2.5 py-1.5 text-xs rounded-md border transition-colors ${ee.collaboration?"border-indigo-500/50 bg-indigo-600/20 text-indigo-400":"border-zinc-700 text-zinc-500 hover:text-zinc-300 hover:border-zinc-600"}`,title:ee.collaboration?"Collaboration enabled — click to disable":"Enable collaboration for this workspace",children:[(0,z.jsx)(X.Users,{className:"w-3.5 h-3.5"}),"Collab"]}),(0,z.jsxs)("button",{onClick:tb,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs border border-zinc-700 text-zinc-400 rounded-md hover:text-white hover:border-zinc-600 transition-colors",title:"Close space and return home",children:[(0,z.jsx)(H,{className:"w-3.5 h-3.5"}),"Close"]}),(0,z.jsxs)("button",{onClick:()=>h(!0),className:"flex items-center gap-1.5 px-3 py-1.5 text-xs bg-indigo-600 text-white rounded-md hover:bg-indigo-500 transition-colors",children:[(0,z.jsx)(k.Plus,{className:"w-3.5 h-3.5"}),"Add Pane"]})]})]}),ea&&(0,z.jsx)("div",{className:"border-b border-zinc-800 bg-zinc-900 px-4 py-3",children:(0,z.jsxs)("div",{className:"max-w-md flex items-center gap-2",children:[(0,z.jsx)(I,{className:"w-4 h-4 text-indigo-400 flex-shrink-0"}),(0,z.jsx)("input",{autoFocus:!0,type:"text",placeholder:"New space name...",value:eo,onChange:e=>ec(e.target.value),onKeyDown:e=>"Enter"===e.key&&tf(),className:"flex-1 px-3 py-1.5 text-sm bg-zinc-800 border border-zinc-700 rounded-md focus:outline-none focus:border-indigo-500 text-white"}),(0,z.jsx)(nW.ColorPicker,{value:ed,onChange:eu}),(0,z.jsx)("button",{onClick:tf,disabled:!eo.trim(),className:"px-3 py-1.5 text-xs bg-indigo-600 text-white rounded-md hover:bg-indigo-500 disabled:opacity-50",children:"Save"}),(0,z.jsx)("button",{onClick:()=>ei(!1),className:"p-1.5 text-zinc-400 hover:text-white",children:(0,z.jsx)(F.X,{className:"w-4 h-4"})})]})}),p&&(0,z.jsx)("div",{className:"border-b border-zinc-800 bg-zinc-900 px-4 py-4",children:(0,z.jsxs)("div",{className:"max-w-lg space-y-3",children:[(0,z.jsx)("h3",{className:"text-sm font-semibold",children:"Add Pane"}),(0,z.jsxs)("div",{children:[(0,z.jsx)("label",{className:"text-[11px] text-zinc-400 mb-1.5 block",children:"Agent"}),(0,z.jsx)("div",{className:"grid grid-cols-3 gap-1.5",children:n0.AGENT_LIST.map(e=>(0,z.jsxs)("button",{onClick:()=>{eR(e.id),eO("new"),e0(null),eM("")},className:`flex items-center gap-2 px-3 py-2 rounded-md border text-left transition-colors ${eT===e.id?"border-indigo-500 bg-indigo-600/20 text-white":"border-zinc-700 text-zinc-400 hover:text-white hover:border-zinc-600"}`,children:[(0,z.jsx)("span",{className:"w-2.5 h-2.5 rounded-full flex-shrink-0",style:{backgroundColor:e.color}}),(0,z.jsxs)("div",{className:"min-w-0",children:[(0,z.jsx)("div",{className:"text-xs font-medium truncate",children:e.name}),(0,z.jsx)("div",{className:"text-[10px] text-zinc-500 truncate",children:e.description})]})]},e.id))})]}),n0.AGENT_TYPES[eT]?.supportsResume&&(0,z.jsxs)("div",{className:"flex gap-2",children:[(0,z.jsx)("button",{onClick:()=>{eO("new"),e0(null),eM("")},className:`px-3 py-1.5 text-xs rounded-md border transition-colors ${"new"===eL?"bg-indigo-600 border-indigo-500 text-white":"border-zinc-700 text-zinc-400 hover:text-white hover:border-zinc-600"}`,children:"New Session"}),(0,z.jsx)("button",{onClick:()=>eO("resume"),className:`px-3 py-1.5 text-xs rounded-md border transition-colors ${"resume"===eL?"bg-indigo-600 border-indigo-500 text-white":"border-zinc-700 text-zinc-400 hover:text-white hover:border-zinc-600"}`,children:"Resume Session"})]}),"custom"===eT&&(0,z.jsx)("input",{type:"text",placeholder:"Command to run (e.g. python agent.py)",value:e$,onChange:e=>eA(e.target.value),className:"w-full px-3 py-2 text-sm bg-zinc-800 border border-zinc-700 rounded-md focus:outline-none focus:border-indigo-500 text-white font-mono"}),(0,z.jsx)(nQ,{value:eF,onChange:eB}),(0,z.jsx)("input",{type:"text",placeholder:"Title (optional)",value:ez,onChange:e=>eN(e.target.value),className:"w-full px-3 py-2 text-sm bg-zinc-800 border border-zinc-700 rounded-md focus:outline-none focus:border-indigo-500 text-white"}),eF?(0,z.jsxs)("div",{children:[(0,z.jsx)("label",{className:"text-[11px] text-zinc-400 mb-1.5 block",children:"Working directory (on remote node)"}),(0,z.jsx)("input",{type:"text",placeholder:"e.g. /home/user/project or ~ for home",value:ek,onChange:e=>eC(e.target.value),className:"w-full px-3 py-2 text-sm bg-zinc-800 border border-zinc-700 rounded-md focus:outline-none focus:border-indigo-500 text-white font-mono"})]}):(0,z.jsx)(nJ,{value:ek,onChange:eC}),n0.AGENT_TYPES[eT]?.supportsResume&&"resume"===eL&&(0,z.jsxs)("div",{ref:e2,className:"relative",children:[eZ?(0,z.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 text-sm bg-zinc-800 border border-zinc-700 rounded-md",children:[(0,z.jsx)(D.MessageSquare,{className:"w-3.5 h-3.5 text-indigo-400 flex-shrink-0"}),(0,z.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,z.jsx)("div",{className:"text-white truncate",children:eZ.customName||eZ.firstPrompt?.slice(0,60)||"Untitled"}),(0,z.jsxs)("div",{className:"text-[10px] text-zinc-500 flex items-center gap-2",children:[(0,z.jsx)("span",{children:eZ.projectName}),(0,z.jsxs)("span",{children:[eZ.messageCount," msgs"]}),(0,z.jsxs)("span",{className:"font-mono",children:[eZ.sessionId.slice(0,8),"..."]})]})]}),(0,z.jsx)("button",{onClick:()=>{e0(null),eQ(!0)},className:"text-zinc-400 hover:text-white text-xs",children:"Change"})]}):(0,z.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 text-sm bg-zinc-800 border border-zinc-700 rounded-md cursor-text",onClick:()=>eQ(!0),children:[(0,z.jsx)(E.Search,{className:"w-3.5 h-3.5 text-zinc-500"}),(0,z.jsx)("input",{type:"text",placeholder:"Search sessions by name, prompt, or project...",value:eG,onChange:e=>{eX(e.target.value),eQ(!0)},onFocus:()=>eQ(!0),className:"flex-1 bg-transparent focus:outline-none text-white placeholder:text-zinc-500"}),ek&&(0,z.jsx)("button",{onClick:e=>{e.stopPropagation(),e5(!e1)},className:`flex-shrink-0 px-1.5 py-0.5 text-[10px] rounded border transition-colors ${e1?"border-indigo-500/50 bg-indigo-600/20 text-indigo-400":"border-zinc-600 text-zinc-500 hover:text-zinc-400"}`,title:e1?"Showing sessions for this directory — click to show all":"Showing all sessions — click to filter by directory",children:e1?ek.split("/").pop():"All"}),(0,z.jsx)(T.ChevronDown,{className:"w-3.5 h-3.5 text-zinc-500"})]}),e_&&!eZ&&(0,z.jsx)("div",{className:"absolute z-50 top-full left-0 right-0 mt-1 max-h-[300px] overflow-y-auto bg-zinc-800 border border-zinc-700 rounded-md shadow-xl",children:eJ?(0,z.jsxs)("div",{className:"flex items-center justify-center py-6",children:[(0,z.jsx)(C.Loader2,{className:"w-4 h-4 animate-spin text-zinc-400"}),(0,z.jsx)("span",{className:"text-xs text-zinc-400 ml-2",children:"Loading sessions..."})]}):0===eq.length?(0,z.jsx)("div",{className:"py-4 px-3 text-xs text-zinc-500 text-center",children:eG?"No sessions match your search":"No sessions found"}):eq.map(e=>(0,z.jsx)("button",{onClick:()=>{e0(e),eM(e.sessionId),!ek&&e.projectPath&&eC(e.projectPath),ez||eN(e.customName||""),eQ(!1)},className:"w-full text-left px-3 py-2.5 hover:bg-zinc-700 border-b border-zinc-700/50 last:border-0 transition-colors",children:(0,z.jsxs)("div",{className:"flex items-start gap-2",children:[(0,z.jsx)(D.MessageSquare,{className:"w-3.5 h-3.5 text-indigo-400 mt-0.5 flex-shrink-0"}),(0,z.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,z.jsx)("div",{className:"text-xs text-white truncate",children:e.customName||e.firstPrompt?.slice(0,70)||"Untitled session"}),(0,z.jsxs)("div",{className:"flex items-center gap-2 mt-0.5",children:[(0,z.jsxs)("span",{className:"text-[10px] text-indigo-400/70 flex items-center gap-0.5",children:[(0,z.jsx)(P.FolderOpen,{className:"w-2.5 h-2.5"}),e.projectName]}),(0,z.jsxs)("span",{className:"text-[10px] text-zinc-500",children:[e.messageCount," msgs"]}),(0,z.jsxs)("span",{className:"text-[10px] text-zinc-500 flex items-center gap-0.5",children:[(0,z.jsx)(M.Clock,{className:"w-2.5 h-2.5"}),new Date(e.modified).toLocaleDateString()]}),e.starred&&(0,z.jsx)("span",{className:"text-[10px]",children:"★"})]}),e.tags?.length>0&&(0,z.jsx)("div",{className:"flex gap-1 mt-1",children:e.tags.map(e=>(0,z.jsx)("span",{className:"text-[9px] px-1.5 py-0.5 bg-zinc-700 rounded text-zinc-400",children:e},e))})]})]})},e.sessionId))})]}),(0,z.jsxs)("div",{children:[(0,z.jsx)("label",{className:"text-[11px] text-zinc-400 mb-1.5 block",children:"Color"}),(0,z.jsx)(nW.ColorPicker,{value:eS,onChange:eE})]}),(0,z.jsxs)("div",{className:"flex gap-2 pt-1",children:[(0,z.jsx)("button",{onClick:tn,disabled:"custom"===eT&&!e$.trim(),className:"px-4 py-2 text-sm bg-indigo-600 text-white rounded-md hover:bg-indigo-500 disabled:opacity-50 disabled:cursor-not-allowed",children:"Create"}),(0,z.jsx)("button",{onClick:()=>h(!1),className:"px-4 py-2 text-sm border border-zinc-700 text-zinc-400 rounded-md hover:text-white hover:border-zinc-600",children:"Cancel"})]})]})}),b.size>0&&(0,z.jsxs)("div",{className:"flex items-center gap-2 px-4 py-1.5 border-b border-zinc-800 bg-zinc-900/50",children:[(0,z.jsx)("span",{className:"text-[10px] text-zinc-500",children:"Popped out:"}),s.filter(e=>b.has(e.id)).map(e=>(0,z.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,z.jsxs)("button",{onClick:()=>td(e),className:"flex items-center gap-1 px-2 py-0.5 text-[10px] bg-zinc-800 border border-zinc-700 rounded-l text-zinc-400 hover:text-white hover:border-zinc-600",title:"Focus popout window",children:[(0,z.jsx)("span",{className:"w-1.5 h-1.5 rounded-full",style:{backgroundColor:e.color}}),e.title]}),(0,z.jsx)("button",{onClick:()=>tp(e.id),className:"px-1 py-0.5 text-[10px] bg-zinc-800 border border-zinc-700 border-l-0 rounded-r text-zinc-500 hover:text-white hover:border-zinc-600",title:"Pop back into grid",children:(0,z.jsx)(W,{className:"w-2.5 h-2.5"})})]},e.id))]}),(0,z.jsxs)("div",{className:"flex-1 flex overflow-hidden min-h-0",children:[eb&&(0,z.jsx)("div",{className:"w-64 flex-shrink-0",children:(0,z.jsx)(rw,{onClose:()=>ev(!1),navigateTo:ey})}),0===ty.length&&0===b.size&&0===m.size?(0,z.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,z.jsxs)("div",{className:"text-center space-y-3",children:[(0,z.jsx)("img",{src:`${n}/spaces_icon.png`,alt:"Spaces",className:"w-16 h-16 mx-auto opacity-30"}),(0,z.jsx)("p",{className:"text-zinc-500",children:"No panes yet."}),(0,z.jsx)("p",{className:"text-zinc-600 text-xs",children:"Add a pane to start a shell, Claude, Codex, Gemini, or any agent."}),(0,z.jsxs)("button",{onClick:()=>h(!0),className:"px-4 py-2 text-sm bg-indigo-600 text-white rounded-md hover:bg-indigo-500 inline-flex items-center gap-2",children:[(0,z.jsx)(k.Plus,{className:"w-4 h-4"}),"Add your first pane"]})]})}):0===ty.length?(0,z.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,z.jsxs)("div",{className:"text-center space-y-2",children:[(0,z.jsx)("p",{className:"text-zinc-500 text-sm",children:m.size>0&&b.size>0?"All panes are minimized or popped out.":m.size>0?"All panes are minimized. Use the toolbar to restore them.":"All panes are popped out to separate windows."}),(0,z.jsxs)("button",{onClick:()=>h(!0),className:"px-3 py-1.5 text-xs text-zinc-400 hover:text-white border border-zinc-700 rounded-md hover:border-zinc-600 inline-flex items-center gap-1.5",children:[(0,z.jsx)(k.Plus,{className:"w-3.5 h-3.5"}),"Add another pane"]})]})}):(0,z.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden min-h-0",children:[(0,z.jsx)(tN,{sensors:to,collisionDetection:eI,onDragEnd:tc,children:(0,z.jsx)(t$,{items:ty.map(e=>e.id),strategy:tL,children:(0,z.jsx)(rL,{panes:x?ty.filter(e=>e.id===x):ty,renderPane:(t,n)=>(0,z.jsx)(_.TerminalPane,{pane:t,onClose:tr,onUpdate:ta,isMaximized:x===t.id,onToggleMaximize:ti,onMinimize:ts,onPopout:tu,onBrowse:ej,terminalToken:e,workspaceCollaboration:ee?.collaboration,dragHandleProps:n})})})}),tw.length>0&&(0,z.jsx)("div",{className:"flex items-center gap-1.5 px-2 py-1.5 border-t border-zinc-800 flex-shrink-0 overflow-x-auto bg-zinc-950",children:tw.map(e=>(0,z.jsxs)("button",{onClick:()=>tl(e.id),className:"flex items-center gap-1.5 px-2.5 py-1 text-[11px] rounded-md border border-zinc-700 hover:border-zinc-500 bg-zinc-800/50 hover:bg-zinc-700/50 text-zinc-400 hover:text-white transition-colors flex-shrink-0",title:`Restore ${e.title}`,children:[(0,z.jsx)("span",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{backgroundColor:e.color}}),(0,z.jsx)("span",{className:"truncate max-w-[100px]",children:e.title}),(0,z.jsx)(Y.Maximize2,{className:"w-2.5 h-2.5 text-zinc-500"})]},e.id))})]}),ee?.collaboration&&(0,z.jsx)(n8,{workspaceId:ee?.id??null,panes:ty.map(e=>({id:e.id,title:e.title,agentType:e.agentType,color:e.color})),collapsed:j,onToggle:()=>L(!j)})]}),(0,z.jsx)(rR,{isOpen:es,onClose:()=>el(!1),onLaunch:e=>{el(!1),tx(e)}})]}):(0,z.jsxs)("div",{className:"h-screen flex flex-col bg-zinc-950 text-zinc-100",children:[(0,z.jsx)("div",{className:"absolute top-4 left-4",children:(0,z.jsxs)("button",{onClick:()=>t.push("/"),className:"flex items-center gap-2 px-3 py-1.5 text-xs text-zinc-500 hover:text-white hover:bg-zinc-800 rounded-md transition-colors",children:[(0,z.jsx)(U.Home,{className:"w-3.5 h-3.5"}),"Home"]})}),(0,z.jsx)("div",{className:"flex-1 flex items-center justify-center p-8 overflow-y-auto min-h-0",children:(0,z.jsxs)("div",{className:"w-full max-w-2xl my-auto",children:[(0,z.jsxs)("div",{className:"text-center mb-10",children:[(0,z.jsx)("img",{src:`${n}/spaces_icon.png`,alt:"Spaces",className:"w-16 h-16 mx-auto mb-4"}),(0,z.jsx)("h1",{className:"text-2xl font-bold mb-2",children:"Spaces"}),(0,z.jsx)("p",{className:"text-zinc-400 text-sm",children:"Choose a workspace to open, or create a new one."})]}),d?(0,z.jsx)("div",{className:"flex justify-center py-12",children:(0,z.jsx)(C.Loader2,{className:"w-6 h-6 animate-spin text-indigo-500"})}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)("div",{className:"grid grid-cols-2 gap-3 mb-6",children:Q.map(e=>(0,z.jsxs)("div",{className:`relative bg-zinc-900 border rounded-lg transition-all ${em===e.id?"border-zinc-600":"border-zinc-800 hover:border-zinc-600 hover:bg-zinc-800/50"}`,children:[(0,z.jsxs)("button",{onClick:()=>tx(e.id),className:"flex items-center gap-3 p-4 text-left w-full group",children:[(0,z.jsx)("span",{className:"w-3.5 h-3.5 rounded-full flex-shrink-0",style:{backgroundColor:e.color}}),(0,z.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,z.jsx)("div",{className:"text-sm font-medium text-white truncate",children:e.name}),(0,z.jsxs)("div",{className:"text-xs text-zinc-500 mt-0.5",children:[e.paneCount||0," pane",1!==(e.paneCount||0)?"s":"",e.isActive&&(0,z.jsx)("span",{className:"text-indigo-400 ml-2",children:"last active"})]})]}),(0,z.jsx)(S.Terminal,{className:"w-4 h-4 text-zinc-600 group-hover:text-zinc-400 transition-colors"})]}),i&&(0,z.jsx)("button",{onClick:()=>eg(em===e.id?null:e.id),className:`absolute top-2 right-2 p-1 rounded transition-colors ${em===e.id?"text-purple-400 bg-purple-500/10":"text-zinc-700 hover:text-zinc-400"}`,title:"Knowledge lobe settings",children:(0,z.jsx)(q.Brain,{className:"w-3.5 h-3.5"})}),em===e.id&&(0,z.jsx)("div",{className:"px-4 pb-4 border-t border-zinc-800/50 pt-3",children:(0,z.jsx)(ra,{workspaceId:e.id,workspaceName:e.name})})]},e.id))}),(0,z.jsxs)("div",{className:"flex justify-center gap-3",children:[(0,z.jsxs)("button",{onClick:tm,className:"flex items-center gap-2 px-4 py-2.5 text-sm border border-zinc-700 text-zinc-400 rounded-lg hover:text-white hover:border-zinc-500 transition-colors",children:[(0,z.jsx)(k.Plus,{className:"w-4 h-4"}),"New Workspace"]}),(0,z.jsxs)("button",{onClick:()=>el(!0),className:"flex items-center gap-2 px-4 py-2.5 text-sm border border-dashed border-indigo-500/50 text-indigo-400 rounded-lg hover:text-indigo-300 hover:border-indigo-400 hover:bg-indigo-500/10 transition-colors",children:[(0,z.jsx)(J,{className:"w-4 h-4"}),"Plan a Project"]})]}),r&&eU.isLoading&&(0,z.jsxs)("div",{className:"flex items-center justify-center gap-2 py-4 mt-6 border-t border-zinc-800",children:[(0,z.jsx)(C.Loader2,{className:"w-4 h-4 animate-spin text-zinc-500"}),(0,z.jsx)("span",{className:"text-xs text-zinc-500",children:"Loading network spaces..."})]}),r&&eU.data?.remote&&eU.data.remote.length>0&&(0,z.jsxs)("div",{className:"mt-6 border-t border-zinc-800 pt-6",children:[(0,z.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,z.jsx)(K.Globe,{className:"w-4 h-4 text-zinc-500"}),(0,z.jsx)("h2",{className:"text-sm font-medium text-zinc-400",children:"Network Spaces"})]}),eU.data.remote.map(e=>(0,z.jsxs)("div",{className:"mb-3",children:[(0,z.jsxs)("button",{onClick:()=>eK(e.nodeId),className:"flex items-center gap-2 w-full px-2 py-1.5 text-left text-xs text-zinc-400 hover:text-white rounded-md hover:bg-zinc-800/50 transition-colors",children:[eH.has(e.nodeId)?(0,z.jsx)(R.ChevronRight,{className:"w-3.5 h-3.5 text-zinc-600"}):(0,z.jsx)(T.ChevronDown,{className:"w-3.5 h-3.5 text-zinc-600"}),(0,z.jsx)(K.Globe,{className:"w-3 h-3 text-zinc-600"}),(0,z.jsx)("span",{className:"font-medium",children:e.nodeName}),(0,z.jsxs)("span",{className:"text-zinc-600",children:[e.workspaces.length," space",1!==e.workspaces.length?"s":""]})]}),!eH.has(e.nodeId)&&(0,z.jsx)("div",{className:"grid grid-cols-2 gap-2 mt-2 ml-5",children:e.workspaces.map(n=>(0,z.jsxs)("button",{onClick:()=>{t.push(`/terminal/remote/${e.nodeId}/${n.id}`)},className:"flex items-center gap-3 p-3 bg-zinc-900/50 border border-zinc-800/50 rounded-lg hover:border-zinc-600 hover:bg-zinc-800/30 transition-colors text-left group",children:[(0,z.jsx)("span",{className:"w-3 h-3 rounded-full flex-shrink-0 ring-1 ring-zinc-700",style:{backgroundColor:n.color}}),(0,z.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,z.jsx)("div",{className:"text-xs font-medium text-zinc-300 truncate",children:n.name}),(0,z.jsxs)("div",{className:"text-[10px] text-zinc-600 mt-0.5",children:[n.paneCount||0," pane",1!==(n.paneCount||0)?"s":""]})]}),(0,z.jsx)(K.Globe,{className:"w-3 h-3 text-zinc-700 group-hover:text-zinc-500 transition-colors"})]},`${e.nodeId}-${n.id}`))})]},e.nodeId)),eU.data.errors&&eU.data.errors.length>0&&(0,z.jsx)("div",{className:"mt-3 space-y-1",children:eU.data.errors.map(e=>(0,z.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 text-[10px] text-zinc-600",children:[(0,z.jsx)(G.AlertCircle,{className:"w-3 h-3 text-red-500/50"}),(0,z.jsxs)("span",{children:[e.nodeName,": ",e.error]})]},e.nodeId))})]})]})]})}),(0,z.jsx)(rR,{isOpen:es,onClose:()=>el(!1),onLaunch:e=>{el(!1),tx(e)}})]})}e.s(["default",()=>rO],609799)}]);
|
|
85
|
+
</script></body></html>`),s.document.close(),setTimeout(()=>{w.current?.postMessage({type:"file-update",file:e})},100),j.current&&clearInterval(j.current),j.current=setInterval(()=>{y.current?.closed&&(rg({wasPoppedOut:!1}),k.current&&v(!1),y.current=null,j.current&&(clearInterval(j.current),j.current=null))},500)}},M=(0,N.useRef)(null),[P,T]=(0,N.useState)(!1),[R,L]=(0,N.useState)(!1),I=async e=>{if(s&&0!==e.length){T(!0);try{let t=new FormData;for(let n of(t.append("dir",s),Array.from(e)))t.append("files",n);await fetch((0,nJ.api)("/api/files"),{method:"POST",body:t});let n=await S(s);c(n.items)}catch{}finally{T(!1)}}},O=a?s.replace(a,"").replace(/^[/\\]/,""):"",$=O?O.split(/[/\\]/):[],A=x&&!b,B=d&&s!==a;return a?(0,z.jsxs)("div",{className:"h-full flex flex-col bg-zinc-950 border-r border-zinc-800",children:[(0,z.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 border-b border-zinc-800/50 flex-shrink-0",children:[(0,z.jsx)("span",{className:"text-[10px] text-zinc-500 uppercase tracking-wider font-medium",children:"Files"}),(0,z.jsx)("button",{onClick:e,className:"p-0.5 text-zinc-600 hover:text-zinc-300 transition-colors",children:(0,z.jsx)(F.X,{className:"w-3.5 h-3.5"})})]}),n.length>1&&(0,z.jsx)("div",{className:"flex items-center gap-1 px-3 py-1.5 border-b border-zinc-800/30 flex-shrink-0 overflow-x-auto",children:n.map(e=>{let t=e.split(/[/\\]/).pop()||e,n=e===a;return(0,z.jsx)("button",{onClick:()=>{i(e),l(e),h(new Set),f(null)},className:`px-2 py-0.5 text-[10px] rounded transition-colors flex-shrink-0 ${n?"bg-amber-500/15 text-amber-400 border border-amber-500/30":"text-zinc-500 hover:text-zinc-300 border border-transparent"}`,title:e,children:t},e)})}),(0,z.jsxs)("div",{className:"flex items-center gap-1 px-3 py-1.5 border-b border-zinc-800/30 overflow-x-auto text-[10px] flex-shrink-0",children:[B&&(0,z.jsx)("button",{onClick:()=>{d&&s!==a&&l(d)},className:"text-zinc-500 hover:text-zinc-300 flex-shrink-0",children:(0,z.jsx)(rd,{className:"w-3 h-3"})}),(0,z.jsx)("input",{ref:M,type:"file",multiple:!0,className:"hidden",onChange:e=>{e.target.files&&I(e.target.files),e.target.value=""}}),(0,z.jsx)("button",{onClick:()=>M.current?.click(),className:"text-zinc-600 hover:text-zinc-300 flex-shrink-0 ml-auto",title:"Upload files to current directory",children:(0,z.jsx)(rh.Upload,{className:"w-3 h-3"})}),(0,z.jsx)("button",{onClick:()=>l(a),className:"text-zinc-500 hover:text-zinc-300 truncate flex-shrink-0",children:a.split(/[/\\]/).pop()}),$.map((e,t)=>(0,z.jsxs)("span",{className:"flex items-center gap-1 flex-shrink-0",children:[(0,z.jsx)("span",{className:"text-zinc-700",children:"/"}),(0,z.jsx)("button",{onClick:()=>{l(a+"/"+$.slice(0,t+1).join("/"))},className:"text-zinc-500 hover:text-zinc-300",children:e})]},t))]}),b&&x&&(0,z.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 border-b border-zinc-800/30 bg-zinc-900/50 flex-shrink-0",children:[(0,z.jsx)("span",{className:"text-[10px] text-zinc-500",children:"Viewing:"}),(0,z.jsx)("span",{className:"text-[10px] text-zinc-400 font-mono truncate flex-1",children:x.name}),(0,z.jsx)("button",{onClick:()=>{rg({wasPoppedOut:!1}),y.current&&!y.current.closed&&y.current.close(),y.current=null,v(!1),j.current&&(clearInterval(j.current),j.current=null)},className:"text-zinc-500 hover:text-zinc-300 transition-colors",title:"Pop back into panel",children:(0,z.jsx)(H,{className:"w-3 h-3"})})]}),(0,z.jsxs)("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:[(0,z.jsx)("div",{className:`overflow-y-auto ${A?"max-h-[40%] border-b border-zinc-800/30":"flex-1"} ${R?"ring-2 ring-inset ring-amber-500/50 bg-amber-500/5":""}`,onDragOver:e=>{e.preventDefault(),L(!0)},onDragLeave:()=>L(!1),onDrop:e=>{e.preventDefault(),L(!1),e.dataTransfer.files.length>0&&I(e.dataTransfer.files)},children:P?(0,z.jsx)("div",{className:"p-3 text-xs text-amber-400",children:"Uploading..."}):m?(0,z.jsx)("div",{className:"p-3 text-xs text-zinc-600",children:"Loading..."}):0===o.length?(0,z.jsx)("div",{className:"p-3 text-xs text-zinc-600",children:"Empty directory"}):(0,z.jsx)("div",{className:"py-1",children:o.map(e=>(0,z.jsx)(rz,{item:e,depth:0,expanded:p.has(e.path),expandedDirs:p,onClick:E,loadDir:S,activeFile:x?.path},e.path))})}),A&&(0,z.jsxs)("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:[(0,z.jsxs)("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-zinc-800/30 flex-shrink-0",children:[(0,z.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0",children:[(0,z.jsx)("span",{className:`text-xs font-mono truncate ${rb(x.ext)}`,children:x.name}),(0,z.jsx)("span",{className:"text-[9px] text-zinc-600",children:x.lines?`${x.lines} lines`:ry(x.size)}),x.truncated&&(0,z.jsx)("span",{className:"text-[9px] text-amber-500",children:"(truncated)"})]}),(0,z.jsxs)("div",{className:"flex items-center gap-1",children:[(0,z.jsx)("button",{onClick:()=>{var e,t;let n;return x&&(e=x.path,t=x.name,void((n=document.createElement("a")).href=(0,nJ.api)(`/api/files?raw=${encodeURIComponent(e)}`),n.download=t,n.click()))},className:"p-0.5 text-zinc-600 hover:text-zinc-300 transition-colors",title:"Download file",children:(0,z.jsx)(rp,{className:"w-3 h-3"})}),(0,z.jsx)("button",{onClick:()=>{x&&D(x)},className:"p-0.5 text-zinc-600 hover:text-zinc-300 transition-colors",title:"Open in new window",children:(0,z.jsx)(ru.ExternalLink,{className:"w-3 h-3"})}),(0,z.jsx)("button",{onClick:()=>f(null),className:"p-0.5 text-zinc-600 hover:text-zinc-300 transition-colors",children:(0,z.jsx)(F.X,{className:"w-3 h-3"})})]})]}),(0,z.jsx)("div",{className:"flex-1 overflow-auto",children:(0,z.jsx)(rj,{file:x})})]})]})]}):(0,z.jsxs)("div",{className:"h-full flex flex-col bg-zinc-950 border-r border-zinc-800",children:[(0,z.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 border-b border-zinc-800/50 flex-shrink-0",children:[(0,z.jsx)("span",{className:"text-[10px] text-zinc-500 uppercase tracking-wider font-medium",children:"Files"}),(0,z.jsx)("button",{onClick:e,className:"p-0.5 text-zinc-600 hover:text-zinc-300 transition-colors",children:(0,z.jsx)(F.X,{className:"w-3.5 h-3.5"})})]}),(0,z.jsx)("div",{className:"p-3 text-xs text-zinc-500",children:0===n.length?"No development directories configured. Add them in Settings.":"Loading..."})]})}function rj({file:e}){return e.error?(0,z.jsx)("div",{className:"p-3 text-xs text-red-400",children:e.error}):e.image&&e.rawUrl?(0,z.jsx)("div",{className:"flex items-center justify-center p-4 min-h-[200px]",children:(0,z.jsx)("img",{src:(0,nJ.api)(e.rawUrl),alt:e.name,className:"max-w-full max-h-[60vh] object-contain rounded"})}):e.image&&e.tooLarge?(0,z.jsxs)("div",{className:"p-3 text-xs text-zinc-500",children:["Image too large (",ry(e.size),")"]}):e.pdf&&e.rawUrl?(0,z.jsx)("iframe",{src:(0,nJ.api)(e.rawUrl),className:"w-full h-full border-none",title:e.name}):e.binary?(0,z.jsxs)("div",{className:"p-3 text-xs text-zinc-500",children:["Binary file (",e.ext,", ",ry(e.size),")"]}):void 0!==e.content?(0,z.jsx)("pre",{className:"text-[11px] leading-4 font-mono p-0 m-0",children:(0,z.jsx)("table",{className:"border-collapse w-full",children:(0,z.jsx)("tbody",{children:e.content.split("\n").map((t,n)=>(0,z.jsxs)("tr",{className:"hover:bg-zinc-800/30",children:[(0,z.jsx)("td",{className:"text-right pr-3 pl-3 text-zinc-700 select-none w-[1%] whitespace-nowrap",children:n+1}),(0,z.jsx)("td",{className:`pr-3 whitespace-pre ${rb(e.ext)}`,children:t||" "})]},n))})})}):null}function rz({item:e,depth:t,expanded:n,expandedDirs:r,onClick:a,loadDir:i,activeFile:s}){let[l,o]=(0,N.useState)(null);(0,N.useEffect)(()=>{n&&e.isDir&&!l&&i(e.path).then(e=>o(e.items))},[n,e.isDir,e.path,l,i]);let c=s===e.path;return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)("button",{onClick:()=>a(e),className:`flex items-center gap-1.5 w-full text-left px-2 py-[3px] text-[11px] transition-colors ${c?"bg-indigo-500/10 text-indigo-300":"text-zinc-400 hover:bg-zinc-800/50 hover:text-zinc-200"}`,style:{paddingLeft:`${8+14*t}px`},children:[e.isDir?n?(0,z.jsx)(T.ChevronDown,{className:"w-3 h-3 text-zinc-600 flex-shrink-0"}):(0,z.jsx)(R.ChevronRight,{className:"w-3 h-3 text-zinc-600 flex-shrink-0"}):(0,z.jsx)("span",{className:"w-3 flex-shrink-0"}),(0,z.jsx)(rv,{item:e}),(0,z.jsx)("span",{className:"truncate",children:e.name})]}),n&&e.isDir&&l&&l.map(e=>(0,z.jsx)(rz,{item:e,depth:t+1,expanded:r.has(e.path),expandedDirs:r,onClick:a,loadDir:i,activeFile:s},e.path))]})}function rN({messages:e,onSend:t,loading:n}){let[r,a]=(0,N.useState)(""),i=(0,N.useRef)(null);(0,N.useEffect)(()=>{i.current&&(i.current.scrollTop=i.current.scrollHeight)},[e,n]);let s=()=>{let e=r.trim();e&&!n&&(a(""),t(e))};return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)("div",{ref:i,className:"flex-1 overflow-y-auto px-6 py-4 space-y-4",children:[0===e.length&&!n&&(0,z.jsxs)("div",{className:"text-center py-12",children:[(0,z.jsx)("p",{className:"text-zinc-400 text-sm mb-1",children:"Describe the project you want to build."}),(0,z.jsx)("p",{className:"text-zinc-600 text-xs",children:"I'll help you plan the workspace, agents, and initial tasks."})]}),e.map((e,t)=>(0,z.jsx)("div",{className:`flex ${"user"===e.role?"justify-end":"justify-start"}`,children:(0,z.jsx)("div",{className:`max-w-[80%] rounded-lg px-3 py-2 text-sm ${"user"===e.role?"bg-indigo-600 text-white":"bg-zinc-800 text-zinc-200"}`,children:(0,z.jsx)("p",{className:"whitespace-pre-wrap",children:e.content})})},t)),n&&(0,z.jsx)("div",{className:"flex justify-start",children:(0,z.jsx)("div",{className:"bg-zinc-800 rounded-lg px-4 py-3",children:(0,z.jsxs)("div",{className:"flex gap-1",children:[(0,z.jsx)("span",{className:"w-2 h-2 bg-zinc-500 rounded-full animate-bounce",style:{animationDelay:"0ms"}}),(0,z.jsx)("span",{className:"w-2 h-2 bg-zinc-500 rounded-full animate-bounce",style:{animationDelay:"150ms"}}),(0,z.jsx)("span",{className:"w-2 h-2 bg-zinc-500 rounded-full animate-bounce",style:{animationDelay:"300ms"}})]})})})]}),(0,z.jsx)("div",{className:"px-6 py-3 border-t border-zinc-800 flex-shrink-0",children:(0,z.jsxs)("div",{className:"flex gap-2",children:[(0,z.jsx)("textarea",{value:r,onChange:e=>a(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),s())},placeholder:"Describe your project...",rows:2,className:"flex-1 bg-zinc-900 border border-zinc-700 rounded-lg px-3 py-2 text-sm text-zinc-200 placeholder:text-zinc-600 focus:outline-none focus:border-zinc-500 resize-none"}),(0,z.jsx)("button",{onClick:s,disabled:!r.trim()||n,className:"px-4 bg-indigo-600 hover:bg-indigo-500 disabled:bg-zinc-800 disabled:text-zinc-600 text-white rounded-lg flex items-center gap-1.5 text-sm self-end",children:(0,z.jsx)(n5.Send,{className:"w-3.5 h-3.5"})})]})})]})}let rk=(0,L.default)("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"}]]),rC={claude:"#6366f1",codex:"#22c55e",gemini:"#3b82f6",aider:"#f59e0b",shell:"#78716c",custom:"#a855f7"};function rS({plan:e,onReview:t}){return e?(0,z.jsxs)("div",{className:"flex flex-col h-full",children:[(0,z.jsxs)("div",{className:"flex-1 overflow-y-auto px-5 py-4 space-y-4",children:[(0,z.jsxs)("div",{children:[(0,z.jsx)("div",{className:"text-[10px] uppercase tracking-wider text-zinc-500 mb-1.5",children:"Workspace"}),(0,z.jsxs)("div",{className:"bg-zinc-800/50 rounded-lg p-3 border border-zinc-700/50",children:[(0,z.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,z.jsx)("span",{className:"w-3 h-3 rounded-full",style:{backgroundColor:e.workspace.color}}),(0,z.jsx)("span",{className:"text-sm font-medium text-zinc-200",children:e.workspace.name})]}),e.workspace.description&&(0,z.jsx)("p",{className:"text-xs text-zinc-400 mt-1",children:e.workspace.description})]})]}),e.panes.length>0&&(0,z.jsxs)("div",{children:[(0,z.jsxs)("div",{className:"text-[10px] uppercase tracking-wider text-zinc-500 mb-1.5",children:["Panes (",e.panes.length,")"]}),(0,z.jsx)("div",{className:"space-y-2",children:e.panes.map((e,t)=>(0,z.jsxs)("div",{className:"bg-zinc-800/50 rounded-lg p-3 border border-zinc-700/50",children:[(0,z.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,z.jsx)(S.Terminal,{className:"w-3 h-3 text-zinc-500"}),(0,z.jsx)("span",{className:"text-xs font-medium text-zinc-200",children:e.title}),(0,z.jsx)("span",{className:"text-[9px] px-1.5 py-0.5 rounded font-medium",style:{backgroundColor:`${rC[e.agentType]||"#6366f1"}20`,color:rC[e.agentType]||"#6366f1"},children:e.agentType})]}),e.description&&(0,z.jsx)("p",{className:"text-[11px] text-zinc-500 mt-1",children:e.description}),e.cwd&&(0,z.jsx)("p",{className:"text-[10px] text-zinc-600 font-mono mt-1",children:e.cwd})]},t))})]}),e.summary&&(0,z.jsxs)("div",{children:[(0,z.jsx)("div",{className:"text-[10px] uppercase tracking-wider text-zinc-500 mb-1.5",children:"Summary"}),(0,z.jsx)("p",{className:"text-xs text-zinc-400",children:e.summary})]})]}),(0,z.jsx)("div",{className:"px-5 py-3 border-t border-zinc-800 flex-shrink-0",children:(0,z.jsx)("button",{onClick:t,disabled:!e.panes.length,className:"w-full py-2 text-sm font-medium bg-indigo-600 hover:bg-indigo-500 disabled:bg-zinc-800 disabled:text-zinc-600 text-white rounded-lg transition-colors",children:"Review Plan"})})]}):(0,z.jsxs)("div",{className:"flex flex-col items-center justify-center h-full px-6 text-center",children:[(0,z.jsx)(rk,{className:"w-8 h-8 text-zinc-700 mb-3"}),(0,z.jsx)("p",{className:"text-zinc-500 text-sm",children:"Your project plan will appear here as you chat."})]})}var rE=e.i(871689);let rD=(0,L.default)("rocket",[["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}],["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09",key:"u4xsad"}],["path",{d:"M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z",key:"676m9"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05",key:"92ym6u"}]]),rM=[{value:"claude",label:"Claude Code"},{value:"codex",label:"Codex"},{value:"gemini",label:"Gemini"},{value:"aider",label:"Aider"},{value:"forge",label:"Forge"},{value:"shell",label:"Shell"},{value:"custom",label:"Custom"}],rP=["#ef4444","#f97316","#f59e0b","#eab308","#84cc16","#22c55e","#14b8a6","#06b6d4","#3b82f6","#6366f1","#8b5cf6","#a855f7","#d946ef","#ec4899","#f43f5e","#78716c"];function rT({plan:e,onUpdate:t,onBack:n,onLaunch:r}){let[a,i]=(0,N.useState)([]);(0,N.useEffect)(()=>{fetch((0,nJ.api)("/api/config")).then(e=>e.json()).then(e=>{e.customModels&&i(e.customModels)}).catch(()=>{})},[]);let s=(n,r)=>{t({...e,workspace:{...e.workspace,[n]:r}})},l=(n,r,a)=>{let i=[...e.panes];i[n]={...i[n],[r]:a},t({...e,panes:i})},o=e.workspace.name.trim()&&e.panes.length>0&&e.panes.every(e=>e.cwd.trim());return(0,z.jsxs)("div",{className:"max-w-3xl mx-auto px-6 py-6 space-y-6",children:[(0,z.jsxs)("div",{className:"flex items-center justify-between",children:[(0,z.jsxs)("button",{onClick:n,className:"flex items-center gap-1.5 text-xs text-zinc-400 hover:text-white",children:[(0,z.jsx)(rE.ArrowLeft,{className:"w-3.5 h-3.5"}),"Back to Chat"]}),(0,z.jsxs)("button",{onClick:r,disabled:!o,className:"flex items-center gap-1.5 px-4 py-2 text-sm font-medium bg-green-600 hover:bg-green-500 disabled:bg-zinc-800 disabled:text-zinc-600 text-white rounded-lg transition-colors",children:[(0,z.jsx)(rD,{className:"w-3.5 h-3.5"}),"Launch Space"]})]}),(0,z.jsxs)("div",{className:"bg-zinc-900 rounded-lg border border-zinc-700 p-4 space-y-3",children:[(0,z.jsx)("div",{className:"text-[10px] uppercase tracking-wider text-zinc-500",children:"Workspace"}),(0,z.jsxs)("div",{className:"flex gap-3",children:[(0,z.jsxs)("div",{className:"flex-1",children:[(0,z.jsx)("label",{className:"text-[10px] text-zinc-500 block mb-1",children:"Name"}),(0,z.jsx)("input",{value:e.workspace.name,onChange:e=>s("name",e.target.value),className:"w-full bg-zinc-800 border border-zinc-700 rounded px-3 py-1.5 text-sm text-zinc-200 focus:outline-none focus:border-zinc-500"})]}),(0,z.jsxs)("div",{children:[(0,z.jsx)("label",{className:"text-[10px] text-zinc-500 block mb-1",children:"Color"}),(0,z.jsx)("div",{className:"flex gap-1 flex-wrap",style:{width:128},children:rP.map(t=>(0,z.jsx)("button",{onClick:()=>s("color",t),className:`w-5 h-5 rounded-full ${e.workspace.color===t?"ring-2 ring-white ring-offset-1 ring-offset-zinc-900":"hover:ring-1 hover:ring-zinc-500"}`,style:{backgroundColor:t}},t))})]})]}),(0,z.jsxs)("div",{children:[(0,z.jsx)("label",{className:"text-[10px] text-zinc-500 block mb-1",children:"Description"}),(0,z.jsx)("textarea",{value:e.workspace.description,onChange:e=>s("description",e.target.value),rows:2,className:"w-full bg-zinc-800 border border-zinc-700 rounded px-3 py-1.5 text-sm text-zinc-200 focus:outline-none focus:border-zinc-500 resize-none"})]})]}),(0,z.jsxs)("div",{className:"space-y-3",children:[(0,z.jsxs)("div",{className:"flex items-center justify-between",children:[(0,z.jsxs)("div",{className:"text-[10px] uppercase tracking-wider text-zinc-500",children:["Panes (",e.panes.length,")"]}),(0,z.jsxs)("button",{onClick:()=>{t({...e,panes:[...e.panes,{title:"New Pane",agentType:"claude",cwd:"~",description:""}]})},className:"flex items-center gap-1 text-xs text-zinc-400 hover:text-white",children:[(0,z.jsx)(k.Plus,{className:"w-3 h-3"})," Add Pane"]})]}),e.panes.map((n,r)=>(0,z.jsx)("div",{className:"bg-zinc-900 rounded-lg border border-zinc-700 p-4 space-y-2.5",children:(0,z.jsxs)("div",{className:"flex items-start gap-3",children:[(0,z.jsxs)("div",{className:"flex-1 space-y-2.5",children:[(0,z.jsxs)("div",{className:"flex gap-3",children:[(0,z.jsxs)("div",{className:"flex-1",children:[(0,z.jsx)("label",{className:"text-[10px] text-zinc-500 block mb-1",children:"Title"}),(0,z.jsx)("input",{value:n.title,onChange:e=>l(r,"title",e.target.value),className:"w-full bg-zinc-800 border border-zinc-700 rounded px-2 py-1 text-xs text-zinc-200 focus:outline-none focus:border-zinc-500"})]}),(0,z.jsxs)("div",{className:"w-32",children:[(0,z.jsx)("label",{className:"text-[10px] text-zinc-500 block mb-1",children:"Agent"}),(0,z.jsx)("select",{value:n.agentType,onChange:e=>l(r,"agentType",e.target.value),className:"w-full bg-zinc-800 border border-zinc-700 rounded px-2 py-1 text-xs text-zinc-200",children:rM.map(e=>(0,z.jsx)("option",{value:e.value,children:e.label},e.value))})]}),"forge"===n.agentType&&a.length>0&&(0,z.jsxs)("div",{className:"w-40",children:[(0,z.jsx)("label",{className:"text-[10px] text-zinc-500 block mb-1",children:"Custom Model"}),(0,z.jsxs)("select",{value:n.customModelId||"",onChange:e=>l(r,"customModelId",e.target.value),className:"w-full bg-zinc-800 border border-zinc-700 rounded px-2 py-1 text-xs text-zinc-200",children:[(0,z.jsx)("option",{value:"",children:"Default"}),a.map(e=>(0,z.jsx)("option",{value:e.id,children:e.name},e.id))]})]})]}),(0,z.jsxs)("div",{children:[(0,z.jsx)("label",{className:"text-[10px] text-zinc-500 block mb-1",children:"Working Directory"}),(0,z.jsx)("input",{value:n.cwd,onChange:e=>l(r,"cwd",e.target.value),className:"w-full bg-zinc-800 border border-zinc-700 rounded px-2 py-1 text-xs font-mono text-zinc-200 focus:outline-none focus:border-zinc-500",placeholder:"/path/to/project"})]}),(0,z.jsxs)("div",{children:[(0,z.jsx)("label",{className:"text-[10px] text-zinc-500 block mb-1",children:"Initial Prompt (optional)"}),(0,z.jsx)("textarea",{value:n.initialPrompt||"",onChange:e=>l(r,"initialPrompt",e.target.value),rows:2,className:"w-full bg-zinc-800 border border-zinc-700 rounded px-2 py-1 text-xs text-zinc-200 focus:outline-none focus:border-zinc-500 resize-none",placeholder:"What should this agent start working on?"})]})]}),(0,z.jsx)("button",{onClick:()=>{t({...e,panes:e.panes.filter((e,t)=>t!==r)})},className:"text-zinc-600 hover:text-red-400 mt-4",title:"Remove pane",children:(0,z.jsx)(O.Trash2,{className:"w-3.5 h-3.5"})})]})},r))]}),(0,z.jsx)("div",{className:"flex justify-end pt-2",children:(0,z.jsxs)("button",{onClick:r,disabled:!o,className:"flex items-center gap-1.5 px-6 py-2.5 text-sm font-medium bg-green-600 hover:bg-green-500 disabled:bg-zinc-800 disabled:text-zinc-600 text-white rounded-lg transition-colors",children:[(0,z.jsx)(rD,{className:"w-4 h-4"}),"Launch Space"]})})]})}function rR({isOpen:e,onClose:t,onLaunch:n}){let[r,a]=(0,N.useState)([]),[i,s]=(0,N.useState)(null),[l,o]=(0,N.useState)(!1),[c,d]=(0,N.useState)("chat"),[u,p]=(0,N.useState)(null),h=(0,N.useCallback)(async e=>{let t=[...r,{role:"user",content:e}];a(t),o(!0),p(null);try{let e=await fetch((0,nJ.api)("/api/wizard/chat"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({messages:t,currentPlan:i})}),n=await e.json();if(!e.ok)throw Error(n.error);a([...t,{role:"assistant",content:n.reply}]),n.plan&&s(n.plan)}catch(e){p(e.message)}o(!1)},[r,i]),x=(0,N.useCallback)(async()=>{if(i)try{let e=await fetch((0,nJ.api)("/api/workspaces"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:i.workspace.name,description:i.workspace.description,color:i.workspace.color})}),r=(await e.json()).id;for(let e of i.panes)await fetch((0,nJ.api)("/api/panes"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:e.title,agentType:e.agentType,cwd:e.cwd,customCommand:e.customCommand,workspaceId:r,customModelId:e.customModelId})});n(r),t()}catch(e){p(e.message)}},[i,n,t]);return e?(0,z.jsxs)("div",{className:"fixed inset-0 z-50 bg-zinc-950/95 flex flex-col",children:[(0,z.jsxs)("div",{className:"flex items-center justify-between px-6 py-3 border-b border-zinc-800 flex-shrink-0",children:[(0,z.jsx)("h2",{className:"text-sm font-semibold text-zinc-100",children:"Plan a Project"}),(0,z.jsx)("button",{onClick:t,className:"text-zinc-500 hover:text-white",children:(0,z.jsx)(F.X,{className:"w-4 h-4"})})]}),u&&(0,z.jsx)("div",{className:"px-6 py-2 bg-red-500/10 border-b border-red-500/20 text-xs text-red-400",children:u}),(0,z.jsx)("div",{className:"flex-1 flex overflow-hidden min-h-0",children:"chat"===c?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)("div",{className:"flex-1 flex flex-col border-r border-zinc-800 min-w-0",children:(0,z.jsx)(rN,{messages:r,onSend:h,loading:l})}),(0,z.jsx)("div",{className:"w-[380px] flex-shrink-0 overflow-y-auto",children:(0,z.jsx)(rS,{plan:i,onReview:()=>d("review")})})]}):(0,z.jsx)("div",{className:"flex-1 overflow-y-auto",children:(0,z.jsx)(rT,{plan:i,onUpdate:s,onBack:()=>d("chat"),onLaunch:x})})})]}):null}function rL({workspace:e}){let t=e?.id??null,n=e?.color??"#6366f1",[r,a]=(0,N.useState)([]),[i,s]=(0,N.useState)(!1),[l,o]=(0,N.useState)(""),[c,d]=(0,N.useState)(null),[u,p]=(0,N.useState)(""),h=(0,N.useRef)(null);(0,N.useEffect)(()=>{if(null==t)return void a([]);let e=!1;return fetch((0,nJ.api)(`/api/workspaces/${t}/todos`)).then(e=>e.json()).then(t=>{e||a(Array.isArray(t)?t:[])}).catch(()=>{e||a([])}),()=>{e=!0}},[t]);let x=(0,N.useCallback)(async()=>{let e=l.trim();if(!e||null==t){o(""),s(!1);return}let n=-Date.now(),r={id:n,workspaceId:t,text:e,completed:!1,sortOrder:Number.MAX_SAFE_INTEGER,created:new Date().toISOString(),completedAt:null};a(e=>[...e,r]),o(""),h.current?.focus();try{let r=await fetch((0,nJ.api)(`/api/workspaces/${t}/todos`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:e})});if(!r.ok)throw Error(await r.text());let i=await r.json();a(e=>e.map(e=>e.id===n?i:e))}catch(e){console.error("failed to add todo",e),a(e=>e.filter(e=>e.id!==n))}},[l,t]),f=(0,N.useCallback)(async e=>{if(null==t)return;let n=!e.completed;a(t=>t.map(t=>t.id===e.id?{...t,completed:n,completedAt:n?new Date().toISOString():null}:t));try{let r=await fetch((0,nJ.api)(`/api/workspaces/${t}/todos/${e.id}`),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({completed:n})});if(!r.ok)throw Error();let i=await r.json();a(t=>t.map(t=>t.id===e.id?i:t))}catch{a(t=>t.map(t=>t.id===e.id?e:t))}},[t]),m=(0,N.useCallback)(async e=>{if(null==t)return;let n=-1;a(t=>(n=t.findIndex(t=>t.id===e.id),t.filter(t=>t.id!==e.id)));try{if(!(await fetch((0,nJ.api)(`/api/workspaces/${t}/todos/${e.id}`),{method:"DELETE"})).ok)throw Error()}catch{a(t=>{if(n<0||t.some(t=>t.id===e.id))return t;let r=[...t];return r.splice(Math.min(n,r.length),0,e),r})}},[t]),g=(0,N.useCallback)(async e=>{let n=u.trim();if(d(null),n&&n!==e.text&&null!=t){a(t=>t.map(t=>t.id===e.id?{...t,text:n}:t));try{if(!(await fetch((0,nJ.api)(`/api/workspaces/${t}/todos/${e.id}`),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:n})})).ok)throw Error()}catch{a(t=>t.map(t=>t.id===e.id?{...t,text:e.text}:t))}}},[u,t]),b=(0,N.useCallback)(async()=>{if(null==t)return;let e=r.filter(e=>e.completed);0===e.length||(a(e=>e.filter(e=>!e.completed)),(await Promise.allSettled(e.map(e=>fetch((0,nJ.api)(`/api/workspaces/${t}/todos/${e.id}`),{method:"DELETE"})))).some(e=>"rejected"===e.status||"fulfilled"===e.status&&!e.value.ok)&&fetch((0,nJ.api)(`/api/workspaces/${t}/todos`)).then(e=>e.json()).then(e=>a(Array.isArray(e)?e:[])).catch(()=>{}))},[r,t]),v=[...r].sort((e,t)=>{if(e.completed!==t.completed)return e.completed?1:-1;if(!e.completed)return e.sortOrder-t.sortOrder;let n=e.completedAt??"";return(t.completedAt??"").localeCompare(n)}),y=v.filter(e=>e.completed).length,w="h-7 rounded-full inline-flex items-center gap-1.5 pl-2 pr-1 py-1 text-xs border whitespace-nowrap";return(0,z.jsx)("div",{className:"border-b border-zinc-800 bg-zinc-900/40 px-4 py-2 flex-shrink-0",children:(0,z.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5 max-h-[30vh] overflow-y-auto",children:[v.map(e=>{let t=c===e.id,r={backgroundColor:`${n}22`,borderColor:`${n}66`,color:n},a=e.completed?{backgroundColor:"rgba(39, 39, 42, 0.5)",borderColor:"rgba(63, 63, 70, 0.5)",color:"rgb(113, 113, 122)"}:r;return(0,z.jsxs)("div",{className:`group ${w}`,style:a,children:[(0,z.jsx)("button",{onClick:()=>f(e),className:"w-3.5 h-3.5 rounded-full border-2 flex items-center justify-center flex-shrink-0 transition-colors",style:{borderColor:e.completed?n:`${n}aa`,backgroundColor:e.completed?n:"transparent"},"aria-label":e.completed?"Mark incomplete":"Mark complete",children:e.completed&&(0,z.jsx)(A.Check,{className:"w-2.5 h-2.5 text-white"})}),t?(0,z.jsx)("input",{autoFocus:!0,value:u,onChange:e=>p(e.target.value),onBlur:()=>g(e),onKeyDown:t=>{"Enter"===t.key&&g(e),"Escape"===t.key&&d(null)},className:"bg-transparent focus:outline-none max-w-[240px]",style:{color:"inherit"}}):(0,z.jsx)("button",{onClick:()=>{d(e.id),p(e.text)},className:`text-left truncate max-w-[200px] ${e.completed?"line-through":""}`,style:{color:"inherit"},children:e.text}),(0,z.jsx)("button",{onClick:()=>m(e),className:"opacity-0 group-hover:opacity-100 transition-opacity rounded-full p-0.5 hover:bg-black/20 flex-shrink-0",style:{color:"inherit"},"aria-label":"Delete todo",children:(0,z.jsx)(F.X,{className:"w-3 h-3"})})]},e.id)}),i?(0,z.jsxs)("div",{className:`${w} border-dashed border-zinc-600 text-zinc-300`,children:[(0,z.jsx)(k.Plus,{className:"w-3 h-3 text-zinc-500 flex-shrink-0"}),(0,z.jsx)("input",{ref:h,autoFocus:!0,value:l,onChange:e=>o(e.target.value),onKeyDown:e=>{"Enter"===e.key&&x(),"Escape"===e.key&&(o(""),s(!1))},onBlur:()=>{l.trim()?x():s(!1)},placeholder:"todo…",className:"bg-transparent focus:outline-none text-xs placeholder:text-zinc-600 max-w-[200px]"})]}):(0,z.jsxs)("button",{onClick:()=>{null!=t&&s(!0)},disabled:null==t,className:"h-7 rounded-full inline-flex items-center gap-1 px-3 py-1 text-xs border border-dashed border-zinc-700 text-zinc-500 hover:text-zinc-300 hover:border-zinc-500 transition-colors disabled:opacity-50 disabled:cursor-not-allowed whitespace-nowrap",children:[(0,z.jsx)(k.Plus,{className:"w-3 h-3"}),null==t?"Select a workspace":"add todo"]}),y>0&&(0,z.jsxs)("button",{onClick:b,className:"ml-auto text-[10px] text-zinc-500 hover:text-zinc-300 px-2 py-1 transition-colors whitespace-nowrap",children:["clear ",y," done"]})]})})}var rI=e.i(39312),rO=e.i(204997);function r$(e){return null==e?"#52525b":e<=70?"#22c55e":e<=90?"#f59e0b":"#ef4444"}function rA(e){if(!e)return"";let t=new Date(e).getTime()-Date.now();if(t<=0)return"now";let n=Math.floor(t/36e5),r=Math.floor(t%36e5/6e4);if(n>=24){let e=Math.floor(n/24);return`${e}d ${n-24*e}h`}return n>0?`${n}h ${r}m`:`${r}m`}function rF({label:e,limit:t}){if(!t||null==t.utilization)return null;let n=Math.min(100,Math.max(0,t.utilization)),r=r$(n),a=rA(t.resets_at);return(0,z.jsxs)("div",{className:"flex items-center gap-1.5 text-[10px]",title:a?`${e}: ${Math.floor(n)}% used \xb7 resets in ${a}`:`${e}: ${Math.floor(n)}% used`,children:[(0,z.jsx)("span",{className:"text-zinc-400 font-medium",children:e}),(0,z.jsx)("div",{className:"w-12 h-1 bg-zinc-800 rounded-full overflow-hidden",children:(0,z.jsx)("div",{className:"h-full transition-all",style:{width:`${n}%`,backgroundColor:r}})}),(0,z.jsxs)("span",{className:"text-zinc-500 tabular-nums w-7 text-right",children:[Math.floor(n),"%"]})]})}function rB({enabled:e}){let t=function(e){let[t,n]=(0,N.useState)(null),r=(0,N.useRef)(0);return(0,N.useEffect)(()=>{if(!e){r.current=0;return}let t=!1;async function a(){try{let e=await fetch((0,nJ.api)("/api/claude/usage"));if(!e.ok||t)return;let a=await e.json();if(t)return;"upstream_error"===a.status||"expired"===a.status?(r.current+=1,n(e=>e?.status==="ok"&&r.current<2?e:a)):(r.current=0,n(a))}catch{if(t)return;r.current+=1,n(e=>e?.status==="ok"&&r.current<2?e:{status:"upstream_error"})}}a();let i=setInterval(a,6e4);return()=>{t=!0,clearInterval(i)}},[e]),t}(e),[n,r]=(0,N.useState)(!1),a=(0,N.useRef)(null);if((0,N.useEffect)(()=>{if(n)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e);function e(e){a.current&&!a.current.contains(e.target)&&r(!1)}},[n]),!e||!t)return null;if("unauthenticated"===t.status||"expired"===t.status)return(0,z.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-1 text-[10px] text-zinc-500 border border-zinc-800 rounded-md",title:"expired"===t.status?"OAuth token expired — run any Claude Code command to refresh":"No Claude.ai credentials found",children:[(0,z.jsx)(rO.LogIn,{className:"w-3 h-3"}),"sign in via Claude Code"]});if("upstream_error"===t.status)return null;let{data:i}=t,s=i.extra_usage,l=!!(s?.is_enabled&&s?.used_credits&&s.used_credits>0);return(0,z.jsxs)("div",{className:"relative",children:[(0,z.jsxs)("button",{onClick:()=>r(e=>!e),className:"flex items-center gap-2.5 px-2.5 py-1 border border-zinc-800 rounded-md hover:border-zinc-700 transition-colors",title:"Click for full usage detail",children:[(0,z.jsx)(rI.Zap,{className:"w-3 h-3 text-amber-400"}),(0,z.jsx)(rF,{label:"5h",limit:i.five_hour}),(0,z.jsx)(rF,{label:"7d",limit:i.seven_day}),(0,z.jsx)(rF,{label:"Opus",limit:i.seven_day_opus}),(0,z.jsx)(rF,{label:"Sonnet",limit:i.seven_day_sonnet}),l&&s?.used_credits!=null&&(0,z.jsxs)("span",{className:"text-[10px] text-amber-400 border-l border-zinc-800 pl-2",children:["+$",s.used_credits.toFixed(2)," overage"]})]}),n&&(0,z.jsxs)("div",{ref:a,className:"absolute top-full right-0 mt-1.5 z-50 w-80 p-3 bg-zinc-900 border border-zinc-700 rounded-md shadow-xl",children:[(0,z.jsx)("div",{className:"text-[10px] uppercase tracking-wider text-zinc-500 font-medium mb-2",children:"Plan Usage"}),(0,z.jsxs)("div",{className:"space-y-2",children:[(0,z.jsx)(rU,{label:"5-hour window",limit:i.five_hour}),(0,z.jsx)(rU,{label:"7-day (overall)",limit:i.seven_day}),(0,z.jsx)(rU,{label:"7-day · Opus",limit:i.seven_day_opus}),(0,z.jsx)(rU,{label:"7-day · Sonnet",limit:i.seven_day_sonnet}),(0,z.jsx)(rU,{label:"7-day · OAuth apps",limit:i.seven_day_oauth_apps})]}),s?.is_enabled&&(0,z.jsxs)("div",{className:"mt-3 pt-3 border-t border-zinc-800",children:[(0,z.jsx)("div",{className:"text-[10px] uppercase tracking-wider text-zinc-500 font-medium mb-1.5",children:"Overage credits"}),(0,z.jsxs)("div",{className:"text-xs text-zinc-300",children:[null!=s.used_credits?`$${s.used_credits.toFixed(2)}`:"—",null!=s.monthly_limit&&(0,z.jsxs)("span",{className:"text-zinc-500",children:[" / $",s.monthly_limit.toFixed(2)," monthly"]})]})]})]})]})}function rU({label:e,limit:t}){if(!t||null==t.utilization)return(0,z.jsxs)("div",{className:"flex items-center justify-between text-xs",children:[(0,z.jsx)("span",{className:"text-zinc-400",children:e}),(0,z.jsx)("span",{className:"text-zinc-600",children:"—"})]});let n=Math.min(100,Math.max(0,t.utilization)),r=r$(n),a=rA(t.resets_at);return(0,z.jsxs)("div",{children:[(0,z.jsxs)("div",{className:"flex items-center justify-between text-xs mb-1",children:[(0,z.jsx)("span",{className:"text-zinc-300",children:e}),(0,z.jsxs)("span",{className:"text-zinc-500 tabular-nums",children:[Math.floor(n),"%",a&&(0,z.jsxs)("span",{className:"ml-1.5 text-zinc-600",children:["· ",a]})]})]}),(0,z.jsx)("div",{className:"h-1.5 bg-zinc-800 rounded-full overflow-hidden",children:(0,z.jsx)("div",{className:"h-full transition-all",style:{width:`${n}%`,backgroundColor:r}})})]})}function r_({panes:e,renderPane:t}){if(0===e.length)return null;if(1===e.length)return(0,z.jsx)("div",{className:"flex-1 p-1 overflow-hidden",children:(0,z.jsx)(rH,{id:e[0].id,children:n=>t(e[0],n)})});let n=e.length<=4?2:3,r=[];for(let t=0;t<e.length;t+=n)r.push(e.slice(t,t+n));return(0,z.jsx)(nA,{orientation:"vertical",className:"flex-1 p-1",children:r.map((e,n)=>(0,z.jsxs)(N.default.Fragment,{children:[n>0&&(0,z.jsx)(n_,{className:"h-1.5 flex items-center justify-center group cursor-row-resize",children:(0,z.jsx)("div",{className:"w-8 h-0.5 rounded-full bg-zinc-700 group-hover:bg-zinc-500 group-active:bg-indigo-500 transition-colors"})}),(0,z.jsx)(nB,{minSize:15,children:1===e.length?(0,z.jsx)("div",{className:"h-full p-0.5",children:(0,z.jsx)(rH,{id:e[0].id,children:n=>t(e[0],n)})}):(0,z.jsx)(nA,{orientation:"horizontal",className:"h-full",children:e.map((e,n)=>(0,z.jsxs)(N.default.Fragment,{children:[n>0&&(0,z.jsx)(n_,{className:"w-1.5 flex items-center justify-center group cursor-col-resize",children:(0,z.jsx)("div",{className:"h-8 w-0.5 rounded-full bg-zinc-700 group-hover:bg-zinc-500 group-active:bg-indigo-500 transition-colors"})}),(0,z.jsx)(nB,{minSize:15,children:(0,z.jsx)("div",{className:"h-full p-0.5",children:(0,z.jsx)(rH,{id:e.id,children:n=>t(e,n)})})})]},e.id))})})]},`row-${n}`))})}function rH({id:e,children:t}){let{attributes:n,listeners:r,setNodeRef:a,transform:i,transition:s,isDragging:l}=function(e){var t,n,r,a;let{animateLayoutChanges:i=tF,attributes:s,disabled:l,data:o,getNewIndex:c=tA,id:d,strategy:u,resizeObserverConfig:p,transition:x=tB}=e,{items:f,containerId:m,activeIndex:g,disabled:b,disableTransforms:v,sortedRects:y,overIndex:w,useDragOverlay:j,strategy:z}=(0,N.useContext)(tO),k=(t=l,n=b,"boolean"==typeof t?{draggable:t,droppable:!1}:{draggable:null!=(r=null==t?void 0:t.draggable)?r:n.draggable,droppable:null!=(a=null==t?void 0:t.droppable)?a:n.droppable}),C=f.indexOf(d),S=(0,N.useMemo)(()=>({sortable:{containerId:m,index:C,items:f},...o}),[m,o,C,f]),E=(0,N.useMemo)(()=>f.slice(f.indexOf(d)),[f,d]),{rect:D,node:M,isOver:P,setNodeRef:T}=function(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:a}=e,i=ex("Droppable"),{active:s,dispatch:l,over:o,measureDroppableContainers:c}=(0,N.useContext)(tb),d=(0,N.useRef)({disabled:n}),u=(0,N.useRef)(!1),p=(0,N.useRef)(null),x=(0,N.useRef)(null),{disabled:f,updateMeasurementsFor:m,timeout:g}={...tS,...a},b=ec(null!=m?m:r),v=ti({callback:(0,N.useCallback)(()=>{if(!u.current){u.current=!0;return}null!=x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{c(Array.isArray(b.current)?b.current:[b.current]),x.current=null},g)},[g]),disabled:f||!s}),[y,w]=eu((0,N.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),u.current=!1),e&&v.observe(e))},[v])),j=ec(t);return(0,N.useEffect)(()=>{v&&y.current&&(v.disconnect(),u.current=!1,v.observe(y.current))},[y,v]),(0,N.useEffect)(()=>(l({type:h.RegisterDroppable,element:{id:r,key:i,disabled:n,node:y,rect:p,data:j}}),()=>l({type:h.UnregisterDroppable,key:i,id:r})),[r]),(0,N.useEffect)(()=>{n!==d.current.disabled&&(l({type:h.SetDroppableDisabled,id:r,key:i,disabled:n}),d.current.disabled=n)},[r,i,n,l]),{active:s,rect:p,isOver:(null==o?void 0:o.id)===r,node:y,over:o,setNodeRef:w}}({id:d,data:S,disabled:k.droppable,resizeObserverConfig:{updateMeasurementsFor:E,...p}}),{active:R,activatorEvent:L,activeNodeRect:I,attributes:O,setNodeRef:$,listeners:A,isDragging:F,over:B,setActivatorNodeRef:U,transform:_}=function(e){let{id:t,data:n,disabled:r=!1,attributes:a}=e,i=ex("Draggable"),{activators:s,activatorEvent:l,active:o,activeNodeRect:c,ariaDescribedById:d,draggableNodes:u,over:p}=(0,N.useContext)(tb),{role:h=tC,roleDescription:x="draggable",tabIndex:f=0}=null!=a?a:{},m=(null==o?void 0:o.id)===t,g=(0,N.useContext)(m?tz:tk),[b,v]=eu(),[y,w]=eu(),j=(0,N.useMemo)(()=>s.reduce((e,n)=>{let{eventName:r,handler:a}=n;return e[r]=e=>{a(e,t)},e},{}),[s,t]),z=ec(n);return el(()=>(u.set(t,{id:t,key:i,node:b,activatorNode:y,data:z}),()=>{let e=u.get(t);e&&e.key===i&&u.delete(t)}),[u,t]),{active:o,activatorEvent:l,activeNodeRect:c,attributes:(0,N.useMemo)(()=>({role:h,tabIndex:f,"aria-disabled":r,"aria-pressed":!!m&&h===tC||void 0,"aria-roledescription":x,"aria-describedby":d.draggable}),[r,h,f,m,x,d.draggable]),isDragging:m,listeners:r?void 0:j,node:b,over:p,setNodeRef:v,setActivatorNodeRef:w,transform:g}}({id:d,data:S,attributes:{...tH,...s},disabled:k.draggable}),H=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return(0,N.useMemo)(()=>e=>{t.forEach(t=>t(e))},t)}(T,$),W=!!R,K=W&&!v&&tP(g)&&tP(w),G=!j&&F,X=G&&K?_:null,J=K?null!=X?X:(null!=u?u:z)({rects:y,activeNodeRect:I,activeIndex:g,overIndex:w,index:C}):null,q=tP(g)&&tP(w)?c({id:d,items:f,activeIndex:g,overIndex:w}):C,Y=null==R?void 0:R.id,V=(0,N.useRef)({activeId:Y,items:f,newIndex:q,containerId:m}),Q=f!==V.current.items,Z=i({active:R,containerId:m,isDragging:F,isSorting:W,id:d,index:C,items:f,newIndex:V.current.newIndex,previousItems:V.current.items,previousContainerId:V.current.containerId,transition:x,wasDragging:null!=V.current.activeId}),ee=function(e){let{disabled:t,index:n,node:r,rect:a}=e,[i,s]=(0,N.useState)(null),l=(0,N.useRef)(n);return el(()=>{if(!t&&n!==l.current&&r.current){let e=a.current;if(e){let t=eB(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&s(n)}}n!==l.current&&(l.current=n)},[t,n,r,a]),(0,N.useEffect)(()=>{i&&s(null)},[i]),i}({disabled:!Z,index:C,node:M,rect:D});return(0,N.useEffect)(()=>{W&&V.current.newIndex!==q&&(V.current.newIndex=q),m!==V.current.containerId&&(V.current.containerId=m),f!==V.current.items&&(V.current.items=f)},[W,q,m,f]),(0,N.useEffect)(()=>{if(Y===V.current.activeId)return;if(null!=Y&&null==V.current.activeId){V.current.activeId=Y;return}let e=setTimeout(()=>{V.current.activeId=Y},50);return()=>clearTimeout(e)},[Y]),{active:R,activeIndex:g,attributes:O,data:S,rect:D,index:C,newIndex:q,items:f,isOver:P,isSorting:W,isDragging:F,listeners:A,node:M,overIndex:w,over:B,setNodeRef:H,setActivatorNodeRef:U,setDroppableNodeRef:T,setDraggableNodeRef:$,transform:null!=ee?ee:J,transition:ee||Q&&V.current.newIndex===C?t_:(!G||eb(L))&&x&&(W||Z)?ey.Transition.toString({...x,property:tU}):void 0}}({id:e}),o={transform:ey.Transform.toString(i),transition:s,opacity:l?.5:1,zIndex:l?50:"auto"};return(0,z.jsx)("div",{ref:a,style:o,className:"h-full",children:t({...n,...r})})}function rW(){return(0,z.jsx)(nZ.TotpGate,{children:e=>(0,z.jsx)(rK,{terminalToken:e})})}function rK({terminalToken:e}){let t=(0,Y.useRouter)(),{basePath:n,hasNetwork:r,hasCollaboration:a,hasCortex:i}=(0,nV.useTier)(),[s,l]=(0,N.useState)([]),[o,c]=(0,N.useState)(!0),[d,u]=(0,N.useState)(!0),[p,h]=(0,N.useState)(!1),[x,f]=(0,N.useState)(null),[m,g]=(0,N.useState)(new Set),[b,v]=(0,N.useState)(new Set),[y,w]=(0,N.useState)(!1),[j,L]=(0,N.useState)(!0);!function(){let e=(0,n6.useQueryClient)(),{hasCollaboration:t}=(0,nV.useTier)();(0,N.useEffect)(()=>{if(!t)return;let n=new EventSource((0,nJ.api)("/api/events")),r=()=>{e.invalidateQueries({queryKey:["workspace-messages"]})},a=()=>{e.invalidateQueries({queryKey:["workspace-context"]})};return n.addEventListener("workspace:message",r),n.addEventListener("workspace:request",r),n.addEventListener("workspace:context_updated",a),()=>{n.removeEventListener("workspace:message",r),n.removeEventListener("workspace:request",r),n.removeEventListener("workspace:context_updated",a),n.close()}},[e,t])}();let[Q,Z]=(0,N.useState)(!1);(0,N.useEffect)(()=>{fetch((0,nJ.api)("/api/config")).then(e=>e.json()).then(e=>Z(!!e.todosEnabled)).catch(()=>{})},[]);let[ee,et]=(0,N.useState)([]),[en,er]=(0,N.useState)(null),[ea,ei]=(0,N.useState)(!1),[es,el]=(0,N.useState)(!1),[eo,ec]=(0,N.useState)(!1),[ed,eu]=(0,N.useState)(""),[ep,eh]=(0,N.useState)("#6366f1"),[ex,ef]=(0,N.useState)(null),[em,eg]=(0,N.useState)(""),[eb,ev]=(0,N.useState)(null),ey=(0,N.useRef)(null),[ew,ej]=(0,N.useState)(null),[ez,eN]=(0,N.useState)(!1),[ek,eC]=(0,N.useState)(null),eS=(0,N.useCallback)(e=>{eC(e),eN(!0)},[]),[eE,eD]=(0,N.useState)(""),[eP,eT]=(0,N.useState)(""),[eR,eL]=(0,N.useState)("#6366f1"),[eO,e$]=(0,N.useState)(""),[eA,eF]=(0,N.useState)("claude"),[eB,eU]=(0,N.useState)("new"),[e_,eH]=(0,N.useState)(""),[eW,eK]=(0,N.useState)(""),eG=(0,n1.useRemoteWorkspaces)(),[eX,eJ]=(0,N.useState)(new Set),eq=(0,N.useCallback)(e=>{eJ(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),[eY,eV]=(0,N.useState)(""),[eQ,eZ]=(0,N.useState)([]),[e0,e1]=(0,N.useState)(!1),[e5,e2]=(0,N.useState)(!1),[e3,e4]=(0,N.useState)(null),[e8,e7]=(0,N.useState)(!0),e9=(0,N.useRef)(null),te=(0,N.useRef)(null),tn=(0,N.useRef)(null),tr=(0,N.useCallback)(async()=>{let e=await fetch((0,nJ.api)("/api/workspaces")),t=await e.json();et(t);let n=t.find(e=>e.isActive);return er(n||null),u(!1),n||null},[]),ta=(0,N.useCallback)(async()=>{let e=await fetch((0,nJ.api)("/api/panes")),t=await e.json();l(t);let n=new Set;for(let e of t)e.isPopout&&n.add(e.id);v(n),c(!1)},[]);(0,N.useEffect)(()=>{tr()},[tr]),(0,N.useEffect)(()=>{y&&ta()},[y,ta]),(0,N.useEffect)(()=>{let e=new BroadcastChannel("spaces-panes");return tn.current=e,e.onmessage=e=>{let t=e.data;"popout-opened"===t.type?v(e=>new Set(e).add(t.paneId)):"popout-closed"===t.type?(v(e=>{let n=new Set(e);return n.delete(t.paneId),n}),l(e=>e.map(e=>e.id===t.paneId?{...e,isPopout:!1}:e))):"pane-updated"===t.type&&l(e=>e.map(e=>e.id===t.paneId?{...e,...t.data}:e))},()=>e.close()},[ta]);let[ti,ts]=(0,N.useState)(0);(0,N.useEffect)(()=>{if(!o)for(let e of s)e.isPopout&&tf(e)},[o,ti]),(0,N.useEffect)(()=>{if(!(n0.AGENT_TYPES[eA]?.supportsResume&&"resume"===eB))return;e1(!0);let e=setTimeout(()=>{let e=new URLSearchParams({sortBy:"modified",sortDir:"DESC",limit:"200"});eY&&e.set("search",eY),e8&&eP&&e.set("projectPath",eP),e.set("agentType",eA),fetch((0,nJ.api)(`/api/sessions?${e}`)).then(e=>e.json()).then(e=>{eZ(e.sessions||[]),e1(!1)}).catch(()=>e1(!1))},300*!!eY);return()=>clearTimeout(e)},[eA,eB,eY,e8,eP]),(0,N.useEffect)(()=>{function e(e){e9.current&&!e9.current.contains(e.target)&&e2(!1),te.current&&!te.current.contains(e.target)&&ei(!1),ey.current&&!ey.current.contains(e.target)&&ev(null)}return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);let tl=(0,N.useCallback)(async()=>{let e,t=n0.AGENT_TYPES[eA],n=eP||e3?.projectPath||"/";"shell"!==eA&&(e="resume"===eB&&t?.supportsResume?e3?.sessionId||eO:"new");let r=eE||(e3?e3.customName||e3.firstPrompt?.slice(0,50)||t?.name||"Agent":"")||("shell"===eA?"Terminal":t?.name||"Agent"),a=en?.collaboration&&"shell"!==eA,i=await fetch((0,nJ.api)("/api/panes"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:r,color:eR,cwd:n,claudeSessionId:e,agentType:eA,customCommand:"custom"===eA?e_:void 0,nodeId:eW||void 0,isCollaborating:a||void 0})}),s=await i.json();l(e=>[...e,s]),(0,re.track)("pane_created",{agentType:eA}),h(!1),eD(""),eT(""),eL("#6366f1"),e$(""),eF("shell"),eU("new"),eH(""),eK(""),e4(null),eV("")},[eE,eP,eR,eO,eA,eB,e_,eW,e3]),to=(0,N.useCallback)(async e=>{let t=s.find(t=>t.id===e);await fetch((0,nJ.api)(`/api/panes/${e}`),{method:"DELETE"}),l(t=>t.filter(t=>t.id!==e)),t&&(0,re.track)("pane_closed",{agentType:t.agentType}),x===e&&f(null),v(t=>{let n=new Set(t);return n.delete(e),n})},[x,s]),tc=(0,N.useCallback)(async(e,t)=>{await fetch((0,nJ.api)(`/api/panes/${e}`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),l(n=>n.map(n=>n.id===e?{...n,...t}:n))},[]),td=(0,N.useCallback)(e=>{f(t=>t===e?null:e)},[]),tu=(0,N.useCallback)(e=>{g(t=>new Set(t).add(e)),x===e&&f(null)},[x]),tp=(0,N.useCallback)(e=>{g(t=>{let n=new Set(t);return n.delete(e),n})},[]),th=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return(0,N.useMemo)(()=>[...t].filter(e=>null!=e),[...t])}(eM(tt,{activationConstraint:{distance:8}}),eM(e6)),tx=(0,N.useCallback)(e=>{let{active:t,over:n}=e;n&&t.id!==n.id&&l(e=>{let r=e.findIndex(e=>e.id===t.id),a=e.findIndex(e=>e.id===n.id);if(-1===r||-1===a)return e;let i=tM(e,r,a);return i.forEach((e,t)=>{e.sortOrder!==t&&fetch((0,nJ.api)(`/api/panes/${e.id}`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({sortOrder:t})}).catch(()=>{})}),i.map((e,t)=>({...e,sortOrder:t}))})},[]),tf=(0,N.useCallback)(e=>{let t=e.winWidth||900,n=e.winHeight||600,r=e.winX??Math.round(screen.width/2-t/2),a=e.winY??Math.round(screen.height/2-n/2),i=`left=${r},top=${a},width=${t},height=${n},menubar=no,toolbar=no,location=no,status=no`;window.open((0,nJ.api)(`/terminal/pane/${e.id}`),`spaces-pane-${e.id}`,i),v(t=>new Set(t).add(e.id)),fetch((0,nJ.api)(`/api/panes/${e.id}`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isPopout:!0,winX:r,winY:a,winWidth:t,winHeight:n})})},[]),tm=(0,N.useCallback)(e=>{let t=s.find(t=>t.id===e);t&&tf(t)},[s,tf]),tg=(0,N.useCallback)(async e=>{tn.current?.postMessage({type:"close-popouts"}),await fetch((0,nJ.api)(`/api/panes/${e}`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isPopout:!1})}),v(t=>{let n=new Set(t);return n.delete(e),n})},[]),tb=(0,N.useCallback)(()=>{b.size>0&&(tn.current?.postMessage({type:"close-popouts"}),v(new Set))},[b]),tv=(0,N.useCallback)(async e=>{tb(),await fetch((0,nJ.api)("/api/workspaces"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"switch",workspaceId:e})}),f(null),await tr(),await ta(),ei(!1),y?(0,re.track)("workspace_switched"):(0,re.track)("workspace_entered"),w(!0),ts(e=>e+1)},[tr,ta,tb,y]),ty=(0,N.useCallback)(async()=>{ed.trim()&&en&&(await fetch((0,nJ.api)("/api/workspaces"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"duplicate",sourceId:en.id,name:ed.trim(),color:ep})}),eu(""),eh("#6366f1"),el(!1),await tr())},[ed,ep,en,tr]),tw=(0,N.useCallback)(async()=>{let e=await fetch((0,nJ.api)("/api/workspaces"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:"New Space",color:"#6366f1"})}),t=await e.json();(0,re.track)("workspace_created"),await tv(t.id)},[tv]),tj=(0,N.useCallback)(async e=>{tb(),await fetch((0,nJ.api)(`/api/workspaces/${e}`),{method:"DELETE"}),(0,re.track)("workspace_deleted"),await tr(),await ta(),ei(!1)},[tr,ta,tb]),tz=(0,N.useCallback)(()=>{tb(),l([]),w(!1)},[tb]),tk=(0,N.useCallback)(async(e,t)=>{await fetch((0,nJ.api)(`/api/workspaces/${e}`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t})}),ef(null),await tr()},[tr]),tC=(0,N.useCallback)(async(e,t)=>{await fetch((0,nJ.api)(`/api/workspaces/${e}`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({color:t})}),ev(null),await tr()},[tr]),tS=s.filter(e=>!b.has(e.id)&&!m.has(e.id)),tE=s.filter(e=>m.has(e.id));return y?o?(0,z.jsx)("div",{className:"flex items-center justify-center h-screen bg-zinc-950",children:(0,z.jsx)(C.Loader2,{className:"w-6 h-6 animate-spin text-indigo-500"})}):(0,z.jsxs)("div",{className:"h-screen flex flex-col bg-zinc-950 text-zinc-100",children:[(0,z.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 border-b border-zinc-800 flex-shrink-0",children:[(0,z.jsxs)("div",{className:"flex items-center gap-3",children:[(0,z.jsx)("button",{onClick:tz,className:"p-1.5 -ml-1 text-zinc-500 hover:text-white hover:bg-zinc-800 rounded-md transition-colors",title:"Close space and go home",children:(0,z.jsx)(U.Home,{className:"w-4 h-4"})}),(0,z.jsx)("div",{className:"w-px h-4 bg-zinc-800"}),(0,z.jsx)("h1",{className:"text-sm font-semibold",children:"Spaces"}),(0,z.jsxs)("div",{ref:te,className:"relative",children:[(0,z.jsxs)("button",{onClick:()=>ei(!ea),className:"flex items-center gap-1.5 px-2.5 py-1 text-xs bg-zinc-800 border border-zinc-700 rounded-md hover:border-zinc-600 transition-colors",children:[en&&(0,z.jsx)("span",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{backgroundColor:en.color}}),(0,z.jsx)("span",{className:"max-w-[150px] truncate",children:en?.name||"No space"}),(0,z.jsx)(T.ChevronDown,{className:"w-3 h-3 text-zinc-500"})]}),ea&&(0,z.jsxs)("div",{className:"absolute z-50 top-full left-0 mt-1 w-72 bg-zinc-800 border border-zinc-700 rounded-md shadow-xl overflow-hidden",children:[(0,z.jsx)("div",{className:"p-2 border-b border-zinc-700/50 text-[10px] text-zinc-500 uppercase tracking-wider font-medium",children:"Switch Space"}),(0,z.jsx)("div",{className:"max-h-[300px] overflow-y-auto",children:ee.map(e=>(0,z.jsx)("div",{className:"flex items-center gap-2 hover:bg-zinc-700/50 transition-colors group",children:ex===e.id?(0,z.jsxs)("div",{className:"flex items-center gap-1 flex-1 px-3 py-2",children:[(0,z.jsx)("input",{autoFocus:!0,value:em,onChange:e=>eg(e.target.value),onKeyDown:t=>{"Enter"===t.key&&tk(e.id,em),"Escape"===t.key&&ef(null)},className:"flex-1 bg-transparent border border-zinc-600 rounded px-1.5 py-0.5 text-xs focus:outline-none focus:border-indigo-400"}),(0,z.jsx)("button",{onClick:()=>tk(e.id,em),className:"text-green-400 hover:text-green-300",children:(0,z.jsx)(A.Check,{className:"w-3 h-3"})})]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)("div",{className:"relative pl-3",children:[(0,z.jsx)("button",{onClick:t=>{t.stopPropagation(),ev(eb===e.id?null:e.id)},className:"w-2.5 h-2.5 rounded-full flex-shrink-0 hover:ring-2 hover:ring-zinc-500/50 transition-all",style:{backgroundColor:e.color},title:"Change color"}),eb===e.id&&(0,z.jsx)("div",{ref:ey,className:"absolute z-50 top-full left-0 mt-1.5 p-2 bg-zinc-800 border border-zinc-700 rounded-md shadow-xl",onClick:e=>e.stopPropagation(),children:(0,z.jsx)(nH.ColorPicker,{value:e.color,onChange:t=>tC(e.id,t)})})]}),(0,z.jsxs)("button",{onClick:()=>tv(e.id),className:"flex items-center gap-2 flex-1 py-2 pr-3 text-left",children:[(0,z.jsx)("span",{className:"text-xs text-white truncate flex-1",children:e.name}),(0,z.jsxs)("span",{className:"text-[10px] text-zinc-500",children:[e.paneCount||0," panes"]}),e.isActive&&(0,z.jsx)("span",{className:"text-[10px] text-indigo-400",children:"active"})]}),(0,z.jsxs)("div",{className:"flex items-center gap-0.5 pr-2 opacity-0 group-hover:opacity-100",children:[(0,z.jsx)("button",{onClick:t=>{t.stopPropagation(),ef(e.id),eg(e.name)},className:"p-1 text-zinc-500 hover:text-white rounded",title:"Rename",children:(0,z.jsx)($.Pencil,{className:"w-2.5 h-2.5"})}),!e.isActive&&ee.length>1&&(0,z.jsx)("button",{onClick:t=>{t.stopPropagation(),confirm(`Delete space "${e.name}" and all its panes?`)&&tj(e.id)},className:"p-1 text-zinc-500 hover:text-red-400 rounded",title:"Delete",children:(0,z.jsx)(O.Trash2,{className:"w-2.5 h-2.5"})})]})]})},e.id))}),(0,z.jsxs)("div",{className:"border-t border-zinc-700/50 p-1.5 flex gap-1",children:[(0,z.jsxs)("button",{onClick:tw,className:"flex items-center gap-1.5 px-2.5 py-1.5 text-[11px] text-zinc-400 hover:text-white hover:bg-zinc-700 rounded transition-colors flex-1",children:[(0,z.jsx)(k.Plus,{className:"w-3 h-3"})," New Empty"]}),(0,z.jsxs)("button",{onClick:()=>{ec(!0),ei(!1)},className:"flex items-center gap-1.5 px-2.5 py-1.5 text-[11px] text-indigo-400 hover:text-indigo-300 hover:bg-indigo-500/10 rounded transition-colors flex-1",children:[(0,z.jsx)(q,{className:"w-3 h-3"})," Plan Project"]}),(0,z.jsxs)("button",{onClick:()=>{el(!0),ei(!1)},className:"flex items-center gap-1.5 px-2.5 py-1.5 text-[11px] text-zinc-400 hover:text-white hover:bg-zinc-700 rounded transition-colors flex-1",children:[(0,z.jsx)(B.Copy,{className:"w-3 h-3"})," Duplicate"]})]})]})]}),(0,z.jsxs)("span",{className:"text-[11px] text-zinc-500",children:[tS.length," pane",1!==tS.length?"s":"",b.size>0&&` + ${b.size} popped out`]})]}),(0,z.jsxs)("div",{className:"flex items-center gap-2",children:[(0,z.jsx)(rB,{enabled:s.some(e=>"claude"===e.agentType&&!b.has(e.id))}),(0,z.jsxs)("button",{onClick:()=>eN(!ez),className:`flex items-center gap-1.5 px-2.5 py-1.5 text-xs rounded-md border transition-colors ${ez?"border-amber-500/50 bg-amber-600/20 text-amber-400":"border-zinc-700 text-zinc-500 hover:text-zinc-300 hover:border-zinc-600"}`,title:ez?"Hide file explorer":"Show file explorer",children:[(0,z.jsx)(M.FolderOpen,{className:"w-3.5 h-3.5"}),"Files"]}),a&&en&&(0,z.jsxs)("button",{onClick:async()=>{let e=!en.collaboration;for(let t of(await fetch((0,nJ.api)(`/api/workspaces/${en.id}`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({collaboration:e})}),er(t=>t?{...t,collaboration:e}:t),et(t=>t.map(t=>t.id===en.id?{...t,collaboration:e}:t)),s.filter(e=>e.workspaceId===en.id&&"shell"!==e.agentType)))t.isCollaborating!==e&&await tc(t.id,{isCollaborating:e})},className:`flex items-center gap-1.5 px-2.5 py-1.5 text-xs rounded-md border transition-colors ${en.collaboration?"border-indigo-500/50 bg-indigo-600/20 text-indigo-400":"border-zinc-700 text-zinc-500 hover:text-zinc-300 hover:border-zinc-600"}`,title:en.collaboration?"Collaboration enabled — click to disable":"Enable collaboration for this workspace",children:[(0,z.jsx)(G.Users,{className:"w-3.5 h-3.5"}),"Collab"]}),(0,z.jsxs)("button",{onClick:tz,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs border border-zinc-700 text-zinc-400 rounded-md hover:text-white hover:border-zinc-600 transition-colors",title:"Close space and return home",children:[(0,z.jsx)(_,{className:"w-3.5 h-3.5"}),"Close"]}),(0,z.jsxs)("button",{onClick:()=>h(!0),className:"flex items-center gap-1.5 px-3 py-1.5 text-xs bg-indigo-600 text-white rounded-md hover:bg-indigo-500 transition-colors",children:[(0,z.jsx)(k.Plus,{className:"w-3.5 h-3.5"}),"Add Pane"]})]})]}),es&&(0,z.jsx)("div",{className:"border-b border-zinc-800 bg-zinc-900 px-4 py-3",children:(0,z.jsxs)("div",{className:"max-w-md flex items-center gap-2",children:[(0,z.jsx)(I,{className:"w-4 h-4 text-indigo-400 flex-shrink-0"}),(0,z.jsx)("input",{autoFocus:!0,type:"text",placeholder:"New space name...",value:ed,onChange:e=>eu(e.target.value),onKeyDown:e=>"Enter"===e.key&&ty(),className:"flex-1 px-3 py-1.5 text-sm bg-zinc-800 border border-zinc-700 rounded-md focus:outline-none focus:border-indigo-500 text-white"}),(0,z.jsx)(nH.ColorPicker,{value:ep,onChange:eh}),(0,z.jsx)("button",{onClick:ty,disabled:!ed.trim(),className:"px-3 py-1.5 text-xs bg-indigo-600 text-white rounded-md hover:bg-indigo-500 disabled:opacity-50",children:"Save"}),(0,z.jsx)("button",{onClick:()=>el(!1),className:"p-1.5 text-zinc-400 hover:text-white",children:(0,z.jsx)(F.X,{className:"w-4 h-4"})})]})}),p&&(0,z.jsx)("div",{className:"border-b border-zinc-800 bg-zinc-900 px-4 py-4",children:(0,z.jsxs)("div",{className:"max-w-lg space-y-3",children:[(0,z.jsx)("h3",{className:"text-sm font-semibold",children:"Add Pane"}),(0,z.jsxs)("div",{children:[(0,z.jsx)("label",{className:"text-[11px] text-zinc-400 mb-1.5 block",children:"Agent"}),(0,z.jsx)("div",{className:"grid grid-cols-3 gap-1.5",children:n0.AGENT_LIST.map(e=>(0,z.jsxs)("button",{onClick:()=>{eF(e.id),eU("new"),e4(null),e$("")},className:`flex items-center gap-2 px-3 py-2 rounded-md border text-left transition-colors ${eA===e.id?"border-indigo-500 bg-indigo-600/20 text-white":"border-zinc-700 text-zinc-400 hover:text-white hover:border-zinc-600"}`,children:[(0,z.jsx)("span",{className:"w-2.5 h-2.5 rounded-full flex-shrink-0",style:{backgroundColor:e.color}}),(0,z.jsxs)("div",{className:"min-w-0",children:[(0,z.jsx)("div",{className:"text-xs font-medium truncate",children:e.name}),(0,z.jsx)("div",{className:"text-[10px] text-zinc-500 truncate",children:e.description})]})]},e.id))})]}),n0.AGENT_TYPES[eA]?.supportsResume&&(0,z.jsxs)("div",{className:"flex gap-2",children:[(0,z.jsx)("button",{onClick:()=>{eU("new"),e4(null),e$("")},className:`px-3 py-1.5 text-xs rounded-md border transition-colors ${"new"===eB?"bg-indigo-600 border-indigo-500 text-white":"border-zinc-700 text-zinc-400 hover:text-white hover:border-zinc-600"}`,children:"New Session"}),(0,z.jsx)("button",{onClick:()=>eU("resume"),className:`px-3 py-1.5 text-xs rounded-md border transition-colors ${"resume"===eB?"bg-indigo-600 border-indigo-500 text-white":"border-zinc-700 text-zinc-400 hover:text-white hover:border-zinc-600"}`,children:"Resume Session"})]}),"custom"===eA&&(0,z.jsx)("input",{type:"text",placeholder:"Command to run (e.g. python agent.py)",value:e_,onChange:e=>eH(e.target.value),className:"w-full px-3 py-2 text-sm bg-zinc-800 border border-zinc-700 rounded-md focus:outline-none focus:border-indigo-500 text-white font-mono"}),(0,z.jsx)(nQ,{value:eW,onChange:eK}),(0,z.jsx)("input",{type:"text",placeholder:"Title (optional)",value:eE,onChange:e=>eD(e.target.value),className:"w-full px-3 py-2 text-sm bg-zinc-800 border border-zinc-700 rounded-md focus:outline-none focus:border-indigo-500 text-white"}),eW?(0,z.jsxs)("div",{children:[(0,z.jsx)("label",{className:"text-[11px] text-zinc-400 mb-1.5 block",children:"Working directory (on remote node)"}),(0,z.jsx)("input",{type:"text",placeholder:"e.g. /home/user/project or ~ for home",value:eP,onChange:e=>eT(e.target.value),className:"w-full px-3 py-2 text-sm bg-zinc-800 border border-zinc-700 rounded-md focus:outline-none focus:border-indigo-500 text-white font-mono"})]}):(0,z.jsx)(nq,{value:eP,onChange:eT}),n0.AGENT_TYPES[eA]?.supportsResume&&"resume"===eB&&(0,z.jsxs)("div",{ref:e9,className:"relative",children:[e3?(0,z.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 text-sm bg-zinc-800 border border-zinc-700 rounded-md",children:[(0,z.jsx)(D.MessageSquare,{className:"w-3.5 h-3.5 text-indigo-400 flex-shrink-0"}),(0,z.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,z.jsx)("div",{className:"text-white truncate",children:e3.customName||e3.firstPrompt?.slice(0,60)||"Untitled"}),(0,z.jsxs)("div",{className:"text-[10px] text-zinc-500 flex items-center gap-2",children:[(0,z.jsx)("span",{children:e3.projectName}),(0,z.jsxs)("span",{children:[e3.messageCount," msgs"]}),(0,z.jsxs)("span",{className:"font-mono",children:[e3.sessionId.slice(0,8),"..."]})]})]}),(0,z.jsx)("button",{onClick:()=>{e4(null),e2(!0)},className:"text-zinc-400 hover:text-white text-xs",children:"Change"})]}):(0,z.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 text-sm bg-zinc-800 border border-zinc-700 rounded-md cursor-text",onClick:()=>e2(!0),children:[(0,z.jsx)(E.Search,{className:"w-3.5 h-3.5 text-zinc-500"}),(0,z.jsx)("input",{type:"text",placeholder:"Search sessions by name, prompt, or project...",value:eY,onChange:e=>{eV(e.target.value),e2(!0)},onFocus:()=>e2(!0),className:"flex-1 bg-transparent focus:outline-none text-white placeholder:text-zinc-500"}),eP&&(0,z.jsx)("button",{onClick:e=>{e.stopPropagation(),e7(!e8)},className:`flex-shrink-0 px-1.5 py-0.5 text-[10px] rounded border transition-colors ${e8?"border-indigo-500/50 bg-indigo-600/20 text-indigo-400":"border-zinc-600 text-zinc-500 hover:text-zinc-400"}`,title:e8?"Showing sessions for this directory — click to show all":"Showing all sessions — click to filter by directory",children:e8?eP.split("/").pop():"All"}),(0,z.jsx)(T.ChevronDown,{className:"w-3.5 h-3.5 text-zinc-500"})]}),e5&&!e3&&(0,z.jsx)("div",{className:"absolute z-50 top-full left-0 right-0 mt-1 max-h-[300px] overflow-y-auto bg-zinc-800 border border-zinc-700 rounded-md shadow-xl",children:e0?(0,z.jsxs)("div",{className:"flex items-center justify-center py-6",children:[(0,z.jsx)(C.Loader2,{className:"w-4 h-4 animate-spin text-zinc-400"}),(0,z.jsx)("span",{className:"text-xs text-zinc-400 ml-2",children:"Loading sessions..."})]}):0===eQ.length?(0,z.jsx)("div",{className:"py-4 px-3 text-xs text-zinc-500 text-center",children:eY?"No sessions match your search":"No sessions found"}):eQ.map(e=>(0,z.jsx)("button",{onClick:()=>{e4(e),e$(e.sessionId),!eP&&e.projectPath&&eT(e.projectPath),eE||eD(e.customName||""),e2(!1)},className:"w-full text-left px-3 py-2.5 hover:bg-zinc-700 border-b border-zinc-700/50 last:border-0 transition-colors",children:(0,z.jsxs)("div",{className:"flex items-start gap-2",children:[(0,z.jsx)(D.MessageSquare,{className:"w-3.5 h-3.5 text-indigo-400 mt-0.5 flex-shrink-0"}),(0,z.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,z.jsx)("div",{className:"text-xs text-white truncate",children:e.customName||e.firstPrompt?.slice(0,70)||"Untitled session"}),(0,z.jsxs)("div",{className:"flex items-center gap-2 mt-0.5",children:[(0,z.jsxs)("span",{className:"text-[10px] text-indigo-400/70 flex items-center gap-0.5",children:[(0,z.jsx)(M.FolderOpen,{className:"w-2.5 h-2.5"}),e.projectName]}),(0,z.jsxs)("span",{className:"text-[10px] text-zinc-500",children:[e.messageCount," msgs"]}),(0,z.jsxs)("span",{className:"text-[10px] text-zinc-500 flex items-center gap-0.5",children:[(0,z.jsx)(P.Clock,{className:"w-2.5 h-2.5"}),new Date(e.modified).toLocaleDateString()]}),e.starred&&(0,z.jsx)("span",{className:"text-[10px]",children:"★"})]}),e.tags?.length>0&&(0,z.jsx)("div",{className:"flex gap-1 mt-1",children:e.tags.map(e=>(0,z.jsx)("span",{className:"text-[9px] px-1.5 py-0.5 bg-zinc-700 rounded text-zinc-400",children:e},e))})]})]})},e.sessionId))})]}),(0,z.jsxs)("div",{children:[(0,z.jsx)("label",{className:"text-[11px] text-zinc-400 mb-1.5 block",children:"Color"}),(0,z.jsx)(nH.ColorPicker,{value:eR,onChange:eL})]}),(0,z.jsxs)("div",{className:"flex gap-2 pt-1",children:[(0,z.jsx)("button",{onClick:tl,disabled:"custom"===eA&&!e_.trim(),className:"px-4 py-2 text-sm bg-indigo-600 text-white rounded-md hover:bg-indigo-500 disabled:opacity-50 disabled:cursor-not-allowed",children:"Create"}),(0,z.jsx)("button",{onClick:()=>h(!1),className:"px-4 py-2 text-sm border border-zinc-700 text-zinc-400 rounded-md hover:text-white hover:border-zinc-600",children:"Cancel"})]})]})}),b.size>0&&(0,z.jsxs)("div",{className:"flex items-center gap-2 px-4 py-1.5 border-b border-zinc-800 bg-zinc-900/50",children:[(0,z.jsx)("span",{className:"text-[10px] text-zinc-500",children:"Popped out:"}),s.filter(e=>b.has(e.id)).map(e=>(0,z.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,z.jsxs)("button",{onClick:()=>tf(e),className:"flex items-center gap-1 px-2 py-0.5 text-[10px] bg-zinc-800 border border-zinc-700 rounded-l text-zinc-400 hover:text-white hover:border-zinc-600",title:"Focus popout window",children:[(0,z.jsx)("span",{className:"w-1.5 h-1.5 rounded-full",style:{backgroundColor:e.color}}),e.title]}),(0,z.jsx)("button",{onClick:()=>tg(e.id),className:"px-1 py-0.5 text-[10px] bg-zinc-800 border border-zinc-700 border-l-0 rounded-r text-zinc-500 hover:text-white hover:border-zinc-600",title:"Pop back into grid",children:(0,z.jsx)(H,{className:"w-2.5 h-2.5"})})]},e.id))]}),Q&&(0,z.jsx)(rL,{workspace:en}),(0,z.jsxs)("div",{className:"flex-1 flex overflow-hidden min-h-0",children:[ez&&(0,z.jsx)("div",{className:"w-64 flex-shrink-0",children:(0,z.jsx)(rw,{onClose:()=>eN(!1),navigateTo:ek})}),0===tS.length&&0===b.size&&0===m.size?(0,z.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,z.jsxs)("div",{className:"text-center space-y-3",children:[(0,z.jsx)("img",{src:`${n}/spaces_icon.png`,alt:"Spaces",className:"w-16 h-16 mx-auto opacity-30"}),(0,z.jsx)("p",{className:"text-zinc-500",children:"No panes yet."}),(0,z.jsx)("p",{className:"text-zinc-600 text-xs",children:"Add a pane to start a shell, Claude, Codex, Gemini, or any agent."}),(0,z.jsxs)("button",{onClick:()=>h(!0),className:"px-4 py-2 text-sm bg-indigo-600 text-white rounded-md hover:bg-indigo-500 inline-flex items-center gap-2",children:[(0,z.jsx)(k.Plus,{className:"w-4 h-4"}),"Add your first pane"]})]})}):0===tS.length?(0,z.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,z.jsxs)("div",{className:"text-center space-y-2",children:[(0,z.jsx)("p",{className:"text-zinc-500 text-sm",children:m.size>0&&b.size>0?"All panes are minimized or popped out.":m.size>0?"All panes are minimized. Use the toolbar to restore them.":"All panes are popped out to separate windows."}),(0,z.jsxs)("button",{onClick:()=>h(!0),className:"px-3 py-1.5 text-xs text-zinc-400 hover:text-white border border-zinc-700 rounded-md hover:border-zinc-600 inline-flex items-center gap-1.5",children:[(0,z.jsx)(k.Plus,{className:"w-3.5 h-3.5"}),"Add another pane"]})]})}):(0,z.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden min-h-0",children:[(0,z.jsx)(tN,{sensors:th,collisionDetection:eI,onDragEnd:tx,children:(0,z.jsx)(t$,{items:tS.map(e=>e.id),strategy:tL,children:(0,z.jsx)(r_,{panes:x?tS.filter(e=>e.id===x):tS,renderPane:(t,n)=>(0,z.jsx)(V.TerminalPane,{pane:t,onClose:to,onUpdate:tc,isMaximized:x===t.id,onToggleMaximize:td,onMinimize:tu,onPopout:tm,onBrowse:eS,terminalToken:e,workspaceCollaboration:en?.collaboration,dragHandleProps:n})})})}),tE.length>0&&(0,z.jsx)("div",{className:"flex items-center gap-1.5 px-2 py-1.5 border-t border-zinc-800 flex-shrink-0 overflow-x-auto bg-zinc-950",children:tE.map(e=>(0,z.jsxs)("button",{onClick:()=>tp(e.id),className:"flex items-center gap-1.5 px-2.5 py-1 text-[11px] rounded-md border border-zinc-700 hover:border-zinc-500 bg-zinc-800/50 hover:bg-zinc-700/50 text-zinc-400 hover:text-white transition-colors flex-shrink-0",title:`Restore ${e.title}`,children:[(0,z.jsx)("span",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{backgroundColor:e.color}}),(0,z.jsx)("span",{className:"truncate max-w-[100px]",children:e.title}),(0,z.jsx)(J.Maximize2,{className:"w-2.5 h-2.5 text-zinc-500"})]},e.id))})]}),en?.collaboration&&(0,z.jsx)(n8,{workspaceId:en?.id??null,panes:tS.map(e=>({id:e.id,title:e.title,agentType:e.agentType,color:e.color})),collapsed:j,onToggle:()=>L(!j)})]}),(0,z.jsx)(rR,{isOpen:eo,onClose:()=>ec(!1),onLaunch:e=>{ec(!1),tv(e)}})]}):(0,z.jsxs)("div",{className:"h-screen flex flex-col bg-zinc-950 text-zinc-100",children:[(0,z.jsx)("div",{className:"absolute top-4 left-4",children:(0,z.jsxs)("button",{onClick:()=>t.push("/"),className:"flex items-center gap-2 px-3 py-1.5 text-xs text-zinc-500 hover:text-white hover:bg-zinc-800 rounded-md transition-colors",children:[(0,z.jsx)(U.Home,{className:"w-3.5 h-3.5"}),"Home"]})}),(0,z.jsx)("div",{className:"flex-1 flex items-center justify-center p-8 overflow-y-auto min-h-0",children:(0,z.jsxs)("div",{className:"w-full max-w-2xl my-auto",children:[(0,z.jsxs)("div",{className:"text-center mb-10",children:[(0,z.jsx)("img",{src:`${n}/spaces_icon.png`,alt:"Spaces",className:"w-16 h-16 mx-auto mb-4"}),(0,z.jsx)("h1",{className:"text-2xl font-bold mb-2",children:"Spaces"}),(0,z.jsx)("p",{className:"text-zinc-400 text-sm",children:"Choose a workspace to open, or create a new one."})]}),d?(0,z.jsx)("div",{className:"flex justify-center py-12",children:(0,z.jsx)(C.Loader2,{className:"w-6 h-6 animate-spin text-indigo-500"})}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)("div",{className:"grid grid-cols-2 gap-3 mb-6",children:ee.map(e=>(0,z.jsxs)("div",{className:`relative bg-zinc-900 border rounded-lg transition-all ${ew===e.id?"border-zinc-600":"border-zinc-800 hover:border-zinc-600 hover:bg-zinc-800/50"}`,children:[(0,z.jsxs)("button",{onClick:()=>tv(e.id),className:"flex items-center gap-3 p-4 text-left w-full group",children:[(0,z.jsx)("span",{className:"w-3.5 h-3.5 rounded-full flex-shrink-0",style:{backgroundColor:e.color}}),(0,z.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,z.jsx)("div",{className:"text-sm font-medium text-white truncate",children:e.name}),(0,z.jsxs)("div",{className:"text-xs text-zinc-500 mt-0.5",children:[e.paneCount||0," pane",1!==(e.paneCount||0)?"s":"",e.isActive&&(0,z.jsx)("span",{className:"text-indigo-400 ml-2",children:"last active"})]})]}),(0,z.jsx)(S.Terminal,{className:"w-4 h-4 text-zinc-600 group-hover:text-zinc-400 transition-colors"})]}),i&&(0,z.jsx)("button",{onClick:()=>ej(ew===e.id?null:e.id),className:`absolute top-2 right-2 p-1 rounded transition-colors ${ew===e.id?"text-purple-400 bg-purple-500/10":"text-zinc-700 hover:text-zinc-400"}`,title:"Knowledge lobe settings",children:(0,z.jsx)(X.Brain,{className:"w-3.5 h-3.5"})}),ew===e.id&&(0,z.jsx)("div",{className:"px-4 pb-4 border-t border-zinc-800/50 pt-3",children:(0,z.jsx)(ra,{workspaceId:e.id,workspaceName:e.name})})]},e.id))}),(0,z.jsxs)("div",{className:"flex justify-center gap-3",children:[(0,z.jsxs)("button",{onClick:tw,className:"flex items-center gap-2 px-4 py-2.5 text-sm border border-zinc-700 text-zinc-400 rounded-lg hover:text-white hover:border-zinc-500 transition-colors",children:[(0,z.jsx)(k.Plus,{className:"w-4 h-4"}),"New Workspace"]}),(0,z.jsxs)("button",{onClick:()=>ec(!0),className:"flex items-center gap-2 px-4 py-2.5 text-sm border border-dashed border-indigo-500/50 text-indigo-400 rounded-lg hover:text-indigo-300 hover:border-indigo-400 hover:bg-indigo-500/10 transition-colors",children:[(0,z.jsx)(q,{className:"w-4 h-4"}),"Plan a Project"]})]}),r&&eG.isLoading&&(0,z.jsxs)("div",{className:"flex items-center justify-center gap-2 py-4 mt-6 border-t border-zinc-800",children:[(0,z.jsx)(C.Loader2,{className:"w-4 h-4 animate-spin text-zinc-500"}),(0,z.jsx)("span",{className:"text-xs text-zinc-500",children:"Loading network spaces..."})]}),r&&eG.data?.remote&&eG.data.remote.length>0&&(0,z.jsxs)("div",{className:"mt-6 border-t border-zinc-800 pt-6",children:[(0,z.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,z.jsx)(W.Globe,{className:"w-4 h-4 text-zinc-500"}),(0,z.jsx)("h2",{className:"text-sm font-medium text-zinc-400",children:"Network Spaces"})]}),eG.data.remote.map(e=>(0,z.jsxs)("div",{className:"mb-3",children:[(0,z.jsxs)("button",{onClick:()=>eq(e.nodeId),className:"flex items-center gap-2 w-full px-2 py-1.5 text-left text-xs text-zinc-400 hover:text-white rounded-md hover:bg-zinc-800/50 transition-colors",children:[eX.has(e.nodeId)?(0,z.jsx)(R.ChevronRight,{className:"w-3.5 h-3.5 text-zinc-600"}):(0,z.jsx)(T.ChevronDown,{className:"w-3.5 h-3.5 text-zinc-600"}),(0,z.jsx)(W.Globe,{className:"w-3 h-3 text-zinc-600"}),(0,z.jsx)("span",{className:"font-medium",children:e.nodeName}),(0,z.jsxs)("span",{className:"text-zinc-600",children:[e.workspaces.length," space",1!==e.workspaces.length?"s":""]})]}),!eX.has(e.nodeId)&&(0,z.jsx)("div",{className:"grid grid-cols-2 gap-2 mt-2 ml-5",children:e.workspaces.map(n=>(0,z.jsxs)("button",{onClick:()=>{t.push(`/terminal/remote/${e.nodeId}/${n.id}`)},className:"flex items-center gap-3 p-3 bg-zinc-900/50 border border-zinc-800/50 rounded-lg hover:border-zinc-600 hover:bg-zinc-800/30 transition-colors text-left group",children:[(0,z.jsx)("span",{className:"w-3 h-3 rounded-full flex-shrink-0 ring-1 ring-zinc-700",style:{backgroundColor:n.color}}),(0,z.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,z.jsx)("div",{className:"text-xs font-medium text-zinc-300 truncate",children:n.name}),(0,z.jsxs)("div",{className:"text-[10px] text-zinc-600 mt-0.5",children:[n.paneCount||0," pane",1!==(n.paneCount||0)?"s":""]})]}),(0,z.jsx)(W.Globe,{className:"w-3 h-3 text-zinc-700 group-hover:text-zinc-500 transition-colors"})]},`${e.nodeId}-${n.id}`))})]},e.nodeId)),eG.data.errors&&eG.data.errors.length>0&&(0,z.jsx)("div",{className:"mt-3 space-y-1",children:eG.data.errors.map(e=>(0,z.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 text-[10px] text-zinc-600",children:[(0,z.jsx)(K.AlertCircle,{className:"w-3 h-3 text-red-500/50"}),(0,z.jsxs)("span",{children:[e.nodeName,": ",e.error]})]},e.nodeId))})]})]})]})}),(0,z.jsx)(rR,{isOpen:eo,onClose:()=>ec(!1),onLaunch:e=>{ec(!1),tv(e)}})]})}e.s(["default",()=>rW],609799)}]);
|