mongo-my-admin 0.0.0-stage → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/BUILD_ID +1 -0
- package/.next/app-build-manifest.json +513 -0
- package/.next/app-path-routes-manifest.json +60 -0
- package/.next/build-manifest.json +33 -0
- package/.next/diagnostics/build-diagnostics.json +6 -0
- package/.next/diagnostics/framework.json +1 -0
- package/.next/export-marker.json +6 -0
- package/.next/images-manifest.json +58 -0
- package/.next/next-minimal-server.js.nft.json +1 -0
- package/.next/next-server.js.nft.json +1 -0
- package/.next/package.json +1 -0
- package/.next/prerender-manifest.json +90 -0
- package/.next/react-loadable-manifest.json +8 -0
- package/.next/required-server-files.json +323 -0
- package/.next/routes-manifest.json +410 -0
- package/.next/server/app/(app)/admin/audit/page.js +2 -0
- package/.next/server/app/(app)/admin/audit/page.js.nft.json +1 -0
- package/.next/server/app/(app)/admin/audit/page_client-reference-manifest.js +1 -0
- package/.next/server/app/(app)/admin/connections/page.js +2 -0
- package/.next/server/app/(app)/admin/connections/page.js.nft.json +1 -0
- package/.next/server/app/(app)/admin/connections/page_client-reference-manifest.js +1 -0
- package/.next/server/app/(app)/admin/security/page.js +2 -0
- package/.next/server/app/(app)/admin/security/page.js.nft.json +1 -0
- package/.next/server/app/(app)/admin/security/page_client-reference-manifest.js +1 -0
- package/.next/server/app/(app)/admin/users/page.js +2 -0
- package/.next/server/app/(app)/admin/users/page.js.nft.json +1 -0
- package/.next/server/app/(app)/admin/users/page_client-reference-manifest.js +1 -0
- package/.next/server/app/(app)/ai/page.js +12 -0
- package/.next/server/app/(app)/ai/page.js.nft.json +1 -0
- package/.next/server/app/(app)/ai/page_client-reference-manifest.js +1 -0
- package/.next/server/app/(app)/c/[cid]/[db]/[coll]/page.js +2 -0
- package/.next/server/app/(app)/c/[cid]/[db]/[coll]/page.js.nft.json +1 -0
- package/.next/server/app/(app)/c/[cid]/[db]/[coll]/page_client-reference-manifest.js +1 -0
- package/.next/server/app/(app)/c/[cid]/[db]/page.js +2 -0
- package/.next/server/app/(app)/c/[cid]/[db]/page.js.nft.json +1 -0
- package/.next/server/app/(app)/c/[cid]/[db]/page_client-reference-manifest.js +1 -0
- package/.next/server/app/(app)/c/[cid]/page.js +2 -0
- package/.next/server/app/(app)/c/[cid]/page.js.nft.json +1 -0
- package/.next/server/app/(app)/c/[cid]/page_client-reference-manifest.js +1 -0
- package/.next/server/app/(app)/c/[cid]/performance/page.js +2 -0
- package/.next/server/app/(app)/c/[cid]/performance/page.js.nft.json +1 -0
- package/.next/server/app/(app)/c/[cid]/performance/page_client-reference-manifest.js +1 -0
- package/.next/server/app/(app)/c/[cid]/shell/page.js +2 -0
- package/.next/server/app/(app)/c/[cid]/shell/page.js.nft.json +1 -0
- package/.next/server/app/(app)/c/[cid]/shell/page_client-reference-manifest.js +1 -0
- package/.next/server/app/(app)/page.js +2 -0
- package/.next/server/app/(app)/page.js.nft.json +1 -0
- package/.next/server/app/(app)/page_client-reference-manifest.js +1 -0
- package/.next/server/app/(app)/queries/page.js +2 -0
- package/.next/server/app/(app)/queries/page.js.nft.json +1 -0
- package/.next/server/app/(app)/queries/page_client-reference-manifest.js +1 -0
- package/.next/server/app/_not-found/page.js +2 -0
- package/.next/server/app/_not-found/page.js.nft.json +1 -0
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -0
- package/.next/server/app/_not-found.html +1 -0
- package/.next/server/app/_not-found.meta +16 -0
- package/.next/server/app/_not-found.rsc +19 -0
- package/.next/server/app/api/admin/approvals/[id]/route.js +1 -0
- package/.next/server/app/api/admin/approvals/[id]/route.js.nft.json +1 -0
- package/.next/server/app/api/admin/approvals/[id]/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/admin/approvals/route.js +1 -0
- package/.next/server/app/api/admin/approvals/route.js.nft.json +1 -0
- package/.next/server/app/api/admin/approvals/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/admin/audit/route.js +1 -0
- package/.next/server/app/api/admin/audit/route.js.nft.json +1 -0
- package/.next/server/app/api/admin/audit/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/admin/security/route.js +1 -0
- package/.next/server/app/api/admin/security/route.js.nft.json +1 -0
- package/.next/server/app/api/admin/security/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/admin/users/[uid]/route.js +1 -0
- package/.next/server/app/api/admin/users/[uid]/route.js.nft.json +1 -0
- package/.next/server/app/api/admin/users/[uid]/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/admin/users/route.js +1 -0
- package/.next/server/app/api/admin/users/route.js.nft.json +1 -0
- package/.next/server/app/api/admin/users/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/ai/chat/route.js +2 -0
- package/.next/server/app/api/ai/chat/route.js.nft.json +1 -0
- package/.next/server/app/api/ai/chat/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/ai/confirm/route.js +2 -0
- package/.next/server/app/api/ai/confirm/route.js.nft.json +1 -0
- package/.next/server/app/api/ai/confirm/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/ai/policy/route.js +2 -0
- package/.next/server/app/api/ai/policy/route.js.nft.json +1 -0
- package/.next/server/app/api/ai/policy/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/ai/providers/[id]/route.js +2 -0
- package/.next/server/app/api/ai/providers/[id]/route.js.nft.json +1 -0
- package/.next/server/app/api/ai/providers/[id]/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/ai/providers/[id]/test/route.js +2 -0
- package/.next/server/app/api/ai/providers/[id]/test/route.js.nft.json +1 -0
- package/.next/server/app/api/ai/providers/[id]/test/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/ai/providers/route.js +2 -0
- package/.next/server/app/api/ai/providers/route.js.nft.json +1 -0
- package/.next/server/app/api/ai/providers/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/ai/tokens/[id]/route.js +2 -0
- package/.next/server/app/api/ai/tokens/[id]/route.js.nft.json +1 -0
- package/.next/server/app/api/ai/tokens/[id]/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/ai/tokens/route.js +2 -0
- package/.next/server/app/api/ai/tokens/route.js.nft.json +1 -0
- package/.next/server/app/api/ai/tokens/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/auth/login/route.js +1 -0
- package/.next/server/app/api/auth/login/route.js.nft.json +1 -0
- package/.next/server/app/api/auth/login/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/auth/logout/route.js +1 -0
- package/.next/server/app/api/auth/logout/route.js.nft.json +1 -0
- package/.next/server/app/api/auth/logout/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/c/[cid]/[db]/[coll]/aggregate/route.js +1 -0
- package/.next/server/app/api/c/[cid]/[db]/[coll]/aggregate/route.js.nft.json +1 -0
- package/.next/server/app/api/c/[cid]/[db]/[coll]/aggregate/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/c/[cid]/[db]/[coll]/bulk/route.js +1 -0
- package/.next/server/app/api/c/[cid]/[db]/[coll]/bulk/route.js.nft.json +1 -0
- package/.next/server/app/api/c/[cid]/[db]/[coll]/bulk/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/c/[cid]/[db]/[coll]/count/route.js +1 -0
- package/.next/server/app/api/c/[cid]/[db]/[coll]/count/route.js.nft.json +1 -0
- package/.next/server/app/api/c/[cid]/[db]/[coll]/count/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/c/[cid]/[db]/[coll]/danger/route.js +1 -0
- package/.next/server/app/api/c/[cid]/[db]/[coll]/danger/route.js.nft.json +1 -0
- package/.next/server/app/api/c/[cid]/[db]/[coll]/danger/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/c/[cid]/[db]/[coll]/docs/route.js +1 -0
- package/.next/server/app/api/c/[cid]/[db]/[coll]/docs/route.js.nft.json +1 -0
- package/.next/server/app/api/c/[cid]/[db]/[coll]/docs/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/c/[cid]/[db]/[coll]/explain/route.js +1 -0
- package/.next/server/app/api/c/[cid]/[db]/[coll]/explain/route.js.nft.json +1 -0
- package/.next/server/app/api/c/[cid]/[db]/[coll]/explain/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/c/[cid]/[db]/[coll]/export/route.js +1 -0
- package/.next/server/app/api/c/[cid]/[db]/[coll]/export/route.js.nft.json +1 -0
- package/.next/server/app/api/c/[cid]/[db]/[coll]/export/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/c/[cid]/[db]/[coll]/find/route.js +1 -0
- package/.next/server/app/api/c/[cid]/[db]/[coll]/find/route.js.nft.json +1 -0
- package/.next/server/app/api/c/[cid]/[db]/[coll]/find/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/c/[cid]/[db]/[coll]/import/route.js +1 -0
- package/.next/server/app/api/c/[cid]/[db]/[coll]/import/route.js.nft.json +1 -0
- package/.next/server/app/api/c/[cid]/[db]/[coll]/import/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/c/[cid]/[db]/[coll]/indexes/route.js +1 -0
- package/.next/server/app/api/c/[cid]/[db]/[coll]/indexes/route.js.nft.json +1 -0
- package/.next/server/app/api/c/[cid]/[db]/[coll]/indexes/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/c/[cid]/[db]/[coll]/schema/route.js +1 -0
- package/.next/server/app/api/c/[cid]/[db]/[coll]/schema/route.js.nft.json +1 -0
- package/.next/server/app/api/c/[cid]/[db]/[coll]/schema/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/c/[cid]/[db]/[coll]/stats/route.js +1 -0
- package/.next/server/app/api/c/[cid]/[db]/[coll]/stats/route.js.nft.json +1 -0
- package/.next/server/app/api/c/[cid]/[db]/[coll]/stats/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/c/[cid]/[db]/[coll]/validation/route.js +1 -0
- package/.next/server/app/api/c/[cid]/[db]/[coll]/validation/route.js.nft.json +1 -0
- package/.next/server/app/api/c/[cid]/[db]/[coll]/validation/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/c/[cid]/[db]/collections/route.js +1 -0
- package/.next/server/app/api/c/[cid]/[db]/collections/route.js.nft.json +1 -0
- package/.next/server/app/api/c/[cid]/[db]/collections/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/c/[cid]/[db]/collstats/route.js +1 -0
- package/.next/server/app/api/c/[cid]/[db]/collstats/route.js.nft.json +1 -0
- package/.next/server/app/api/c/[cid]/[db]/collstats/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/c/[cid]/[db]/danger/route.js +1 -0
- package/.next/server/app/api/c/[cid]/[db]/danger/route.js.nft.json +1 -0
- package/.next/server/app/api/c/[cid]/[db]/danger/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/c/[cid]/[db]/stats/route.js +1 -0
- package/.next/server/app/api/c/[cid]/[db]/stats/route.js.nft.json +1 -0
- package/.next/server/app/api/c/[cid]/[db]/stats/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/c/[cid]/databases/route.js +1 -0
- package/.next/server/app/api/c/[cid]/databases/route.js.nft.json +1 -0
- package/.next/server/app/api/c/[cid]/databases/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/c/[cid]/server/route.js +1 -0
- package/.next/server/app/api/c/[cid]/server/route.js.nft.json +1 -0
- package/.next/server/app/api/c/[cid]/server/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/c/[cid]/shell/route.js +1 -0
- package/.next/server/app/api/c/[cid]/shell/route.js.nft.json +1 -0
- package/.next/server/app/api/c/[cid]/shell/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/c/[cid]/tree/route.js +1 -0
- package/.next/server/app/api/c/[cid]/tree/route.js.nft.json +1 -0
- package/.next/server/app/api/c/[cid]/tree/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/connections/[cid]/route.js +1 -0
- package/.next/server/app/api/connections/[cid]/route.js.nft.json +1 -0
- package/.next/server/app/api/connections/[cid]/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/connections/route.js +1 -0
- package/.next/server/app/api/connections/route.js.nft.json +1 -0
- package/.next/server/app/api/connections/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/connections/test/route.js +1 -0
- package/.next/server/app/api/connections/test/route.js.nft.json +1 -0
- package/.next/server/app/api/connections/test/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/mcp/route.js +31 -0
- package/.next/server/app/api/mcp/route.js.nft.json +1 -0
- package/.next/server/app/api/mcp/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/me/route.js +1 -0
- package/.next/server/app/api/me/route.js.nft.json +1 -0
- package/.next/server/app/api/me/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/me/totp/route.js +1 -0
- package/.next/server/app/api/me/totp/route.js.nft.json +1 -0
- package/.next/server/app/api/me/totp/route_client-reference-manifest.js +1 -0
- package/.next/server/app/favicon.ico/route.js +1 -0
- package/.next/server/app/favicon.ico/route.js.nft.json +1 -0
- package/.next/server/app/favicon.ico.body +0 -0
- package/.next/server/app/favicon.ico.meta +1 -0
- package/.next/server/app/login/page.js +2 -0
- package/.next/server/app/login/page.js.nft.json +1 -0
- package/.next/server/app/login/page_client-reference-manifest.js +1 -0
- package/.next/server/app/login.html +1 -0
- package/.next/server/app/login.meta +15 -0
- package/.next/server/app/login.rsc +23 -0
- package/.next/server/app-paths-manifest.json +60 -0
- package/.next/server/chunks/1005.js +13 -0
- package/.next/server/chunks/1671.js +3 -0
- package/.next/server/chunks/3249.js +55 -0
- package/.next/server/chunks/3336.js +1 -0
- package/.next/server/chunks/3565.js +1 -0
- package/.next/server/chunks/4357.js +128 -0
- package/.next/server/chunks/4811.js +15 -0
- package/.next/server/chunks/5207.js +1 -0
- package/.next/server/chunks/5611.js +6 -0
- package/.next/server/chunks/641.js +1 -0
- package/.next/server/chunks/7090.js +1 -0
- package/.next/server/chunks/7900.js +4 -0
- package/.next/server/chunks/890.js +22 -0
- package/.next/server/functions-config-manifest.json +4 -0
- package/.next/server/interception-route-rewrite-manifest.js +1 -0
- package/.next/server/middleware-build-manifest.js +1 -0
- package/.next/server/middleware-manifest.json +6 -0
- package/.next/server/middleware-react-loadable-manifest.js +1 -0
- package/.next/server/next-font-manifest.js +1 -0
- package/.next/server/next-font-manifest.json +1 -0
- package/.next/server/pages/404.html +1 -0
- package/.next/server/pages/500.html +1 -0
- package/.next/server/pages/_app.js +1 -0
- package/.next/server/pages/_app.js.nft.json +1 -0
- package/.next/server/pages/_document.js +1 -0
- package/.next/server/pages/_document.js.nft.json +1 -0
- package/.next/server/pages/_error.js +19 -0
- package/.next/server/pages/_error.js.nft.json +1 -0
- package/.next/server/pages-manifest.json +6 -0
- package/.next/server/server-reference-manifest.js +1 -0
- package/.next/server/server-reference-manifest.json +1 -0
- package/.next/server/webpack-runtime.js +1 -0
- package/.next/static/G4cngSmGFZg9r2ZjPR60A/_buildManifest.js +1 -0
- package/.next/static/G4cngSmGFZg9r2ZjPR60A/_ssgManifest.js +1 -0
- package/.next/static/chunks/1255-b84741b894bb9354.js +1 -0
- package/.next/static/chunks/3510-eb016c974975272c.js +1 -0
- package/.next/static/chunks/363642f4-b76d1a643b93556c.js +1 -0
- package/.next/static/chunks/4bd1b696-f785427dddbba9fb.js +1 -0
- package/.next/static/chunks/5376-9379c07669d2c28f.js +1 -0
- package/.next/static/chunks/5483-41e5f4776321671b.js +1 -0
- package/.next/static/chunks/559-bb0824aa49e1e88f.js +1 -0
- package/.next/static/chunks/5854-e53d093ab3d47bac.js +1 -0
- package/.next/static/chunks/6094-2acc6d932aabc2c5.js +1 -0
- package/.next/static/chunks/6545-2920df06f8188678.js +1 -0
- package/.next/static/chunks/6569.dd7c980e8da3a8f9.js +1 -0
- package/.next/static/chunks/7064-2c9c3ef8e8802efe.js +1 -0
- package/.next/static/chunks/8166-ebfa3185c20f6afa.js +1 -0
- package/.next/static/chunks/8720-bddd249d42ab6b16.js +1 -0
- package/.next/static/chunks/app/(app)/admin/audit/page-37753625bab57838.js +1 -0
- package/.next/static/chunks/app/(app)/admin/connections/page-820cf63eafd1599a.js +1 -0
- package/.next/static/chunks/app/(app)/admin/security/page-eac00bd22a1d165c.js +1 -0
- package/.next/static/chunks/app/(app)/admin/users/page-0b5011243a0fec97.js +1 -0
- package/.next/static/chunks/app/(app)/ai/page-df132e69b1d649f8.js +1 -0
- package/.next/static/chunks/app/(app)/c/[cid]/[db]/[coll]/page-0c7d71c115a02eb6.js +1 -0
- package/.next/static/chunks/app/(app)/c/[cid]/[db]/page-e700371c72058bc1.js +1 -0
- package/.next/static/chunks/app/(app)/c/[cid]/page-65d8810975a53cf0.js +1 -0
- package/.next/static/chunks/app/(app)/c/[cid]/performance/page-c6ae1521644ca6f1.js +1 -0
- package/.next/static/chunks/app/(app)/c/[cid]/shell/page-7900bef5bb856829.js +1 -0
- package/.next/static/chunks/app/(app)/layout-51a850b461498da4.js +1 -0
- package/.next/static/chunks/app/(app)/page-1c4d519e29aa2713.js +1 -0
- package/.next/static/chunks/app/(app)/queries/page-5c17ba95a116f5fa.js +1 -0
- package/.next/static/chunks/app/_not-found/page-1b209d37768dae8e.js +1 -0
- package/.next/static/chunks/app/api/admin/approvals/[id]/route-92dc981ff2fa6cf3.js +1 -0
- package/.next/static/chunks/app/api/admin/approvals/route-92dc981ff2fa6cf3.js +1 -0
- package/.next/static/chunks/app/api/admin/audit/route-92dc981ff2fa6cf3.js +1 -0
- package/.next/static/chunks/app/api/admin/security/route-92dc981ff2fa6cf3.js +1 -0
- package/.next/static/chunks/app/api/admin/users/[uid]/route-92dc981ff2fa6cf3.js +1 -0
- package/.next/static/chunks/app/api/admin/users/route-92dc981ff2fa6cf3.js +1 -0
- package/.next/static/chunks/app/api/ai/chat/route-92dc981ff2fa6cf3.js +1 -0
- package/.next/static/chunks/app/api/ai/confirm/route-92dc981ff2fa6cf3.js +1 -0
- package/.next/static/chunks/app/api/ai/policy/route-92dc981ff2fa6cf3.js +1 -0
- package/.next/static/chunks/app/api/ai/providers/[id]/route-92dc981ff2fa6cf3.js +1 -0
- package/.next/static/chunks/app/api/ai/providers/[id]/test/route-92dc981ff2fa6cf3.js +1 -0
- package/.next/static/chunks/app/api/ai/providers/route-92dc981ff2fa6cf3.js +1 -0
- package/.next/static/chunks/app/api/ai/tokens/[id]/route-92dc981ff2fa6cf3.js +1 -0
- package/.next/static/chunks/app/api/ai/tokens/route-92dc981ff2fa6cf3.js +1 -0
- package/.next/static/chunks/app/api/auth/login/route-92dc981ff2fa6cf3.js +1 -0
- package/.next/static/chunks/app/api/auth/logout/route-92dc981ff2fa6cf3.js +1 -0
- package/.next/static/chunks/app/api/c/[cid]/[db]/[coll]/aggregate/route-92dc981ff2fa6cf3.js +1 -0
- package/.next/static/chunks/app/api/c/[cid]/[db]/[coll]/bulk/route-92dc981ff2fa6cf3.js +1 -0
- package/.next/static/chunks/app/api/c/[cid]/[db]/[coll]/count/route-92dc981ff2fa6cf3.js +1 -0
- package/.next/static/chunks/app/api/c/[cid]/[db]/[coll]/danger/route-92dc981ff2fa6cf3.js +1 -0
- package/.next/static/chunks/app/api/c/[cid]/[db]/[coll]/docs/route-92dc981ff2fa6cf3.js +1 -0
- package/.next/static/chunks/app/api/c/[cid]/[db]/[coll]/explain/route-92dc981ff2fa6cf3.js +1 -0
- package/.next/static/chunks/app/api/c/[cid]/[db]/[coll]/export/route-92dc981ff2fa6cf3.js +1 -0
- package/.next/static/chunks/app/api/c/[cid]/[db]/[coll]/find/route-92dc981ff2fa6cf3.js +1 -0
- package/.next/static/chunks/app/api/c/[cid]/[db]/[coll]/import/route-92dc981ff2fa6cf3.js +1 -0
- package/.next/static/chunks/app/api/c/[cid]/[db]/[coll]/indexes/route-92dc981ff2fa6cf3.js +1 -0
- package/.next/static/chunks/app/api/c/[cid]/[db]/[coll]/schema/route-92dc981ff2fa6cf3.js +1 -0
- package/.next/static/chunks/app/api/c/[cid]/[db]/[coll]/stats/route-92dc981ff2fa6cf3.js +1 -0
- package/.next/static/chunks/app/api/c/[cid]/[db]/[coll]/validation/route-92dc981ff2fa6cf3.js +1 -0
- package/.next/static/chunks/app/api/c/[cid]/[db]/collections/route-92dc981ff2fa6cf3.js +1 -0
- package/.next/static/chunks/app/api/c/[cid]/[db]/collstats/route-92dc981ff2fa6cf3.js +1 -0
- package/.next/static/chunks/app/api/c/[cid]/[db]/danger/route-92dc981ff2fa6cf3.js +1 -0
- package/.next/static/chunks/app/api/c/[cid]/[db]/stats/route-92dc981ff2fa6cf3.js +1 -0
- package/.next/static/chunks/app/api/c/[cid]/databases/route-92dc981ff2fa6cf3.js +1 -0
- package/.next/static/chunks/app/api/c/[cid]/server/route-92dc981ff2fa6cf3.js +1 -0
- package/.next/static/chunks/app/api/c/[cid]/shell/route-92dc981ff2fa6cf3.js +1 -0
- package/.next/static/chunks/app/api/c/[cid]/tree/route-92dc981ff2fa6cf3.js +1 -0
- package/.next/static/chunks/app/api/connections/[cid]/route-92dc981ff2fa6cf3.js +1 -0
- package/.next/static/chunks/app/api/connections/route-92dc981ff2fa6cf3.js +1 -0
- package/.next/static/chunks/app/api/connections/test/route-92dc981ff2fa6cf3.js +1 -0
- package/.next/static/chunks/app/api/mcp/route-92dc981ff2fa6cf3.js +1 -0
- package/.next/static/chunks/app/api/me/route-92dc981ff2fa6cf3.js +1 -0
- package/.next/static/chunks/app/api/me/totp/route-92dc981ff2fa6cf3.js +1 -0
- package/.next/static/chunks/app/layout-e8f9794c3ac6a87d.js +1 -0
- package/.next/static/chunks/app/login/page-40fc4571688a5fe4.js +1 -0
- package/.next/static/chunks/bb55d925-1f4f527ca293a78d.js +3 -0
- package/.next/static/chunks/framework-c58965a13b4aab6d.js +1 -0
- package/.next/static/chunks/main-app-804a108971cfb50b.js +1 -0
- package/.next/static/chunks/main-b95b5f7f62b64ae7.js +1 -0
- package/.next/static/chunks/pages/_app-6c8c2371b16a04b8.js +1 -0
- package/.next/static/chunks/pages/_error-94812ad32cad7365.js +1 -0
- package/.next/static/chunks/polyfills-42372ed130431b0a.js +1 -0
- package/.next/static/chunks/webpack-0ce8f621312b1eec.js +1 -0
- package/.next/static/css/d9c6fe72e33886b3.css +3 -0
- package/.next/static/media/0aa834ed78bf6d07-s.woff2 +0 -0
- package/.next/static/media/19cfc7226ec3afaa-s.woff2 +0 -0
- package/.next/static/media/21350d82a1f187e9-s.woff2 +0 -0
- package/.next/static/media/67957d42bae0796d-s.woff2 +0 -0
- package/.next/static/media/886030b0b59bc5a7-s.woff2 +0 -0
- package/.next/static/media/8e9860b6e62d6359-s.woff2 +0 -0
- package/.next/static/media/939c4f875ee75fbb-s.woff2 +0 -0
- package/.next/static/media/ba9851c3c22cd980-s.woff2 +0 -0
- package/.next/static/media/bb3ef058b751a6ad-s.p.woff2 +0 -0
- package/.next/static/media/c5fe6dc8356a8c31-s.woff2 +0 -0
- package/.next/static/media/df0a9ae256c0569c-s.woff2 +0 -0
- package/.next/static/media/e4af272ccee01ff0-s.p.woff2 +0 -0
- package/.next/static/media/f911b923c6adde36-s.woff2 +0 -0
- package/.next/trace +6 -0
- package/.next/types/app/(app)/admin/audit/page.ts +84 -0
- package/.next/types/app/(app)/admin/connections/page.ts +84 -0
- package/.next/types/app/(app)/admin/security/page.ts +84 -0
- package/.next/types/app/(app)/admin/users/page.ts +84 -0
- package/.next/types/app/(app)/ai/page.ts +84 -0
- package/.next/types/app/(app)/c/[cid]/[db]/[coll]/page.ts +84 -0
- package/.next/types/app/(app)/c/[cid]/[db]/page.ts +84 -0
- package/.next/types/app/(app)/c/[cid]/page.ts +84 -0
- package/.next/types/app/(app)/c/[cid]/performance/page.ts +84 -0
- package/.next/types/app/(app)/c/[cid]/shell/page.ts +84 -0
- package/.next/types/app/(app)/page.ts +84 -0
- package/.next/types/app/(app)/queries/page.ts +84 -0
- package/.next/types/app/api/admin/approvals/[id]/route.ts +347 -0
- package/.next/types/app/api/admin/approvals/route.ts +347 -0
- package/.next/types/app/api/admin/audit/route.ts +347 -0
- package/.next/types/app/api/admin/security/route.ts +347 -0
- package/.next/types/app/api/admin/users/[uid]/route.ts +347 -0
- package/.next/types/app/api/admin/users/route.ts +347 -0
- package/.next/types/app/api/ai/chat/route.ts +347 -0
- package/.next/types/app/api/ai/confirm/route.ts +347 -0
- package/.next/types/app/api/ai/policy/route.ts +347 -0
- package/.next/types/app/api/ai/providers/[id]/route.ts +347 -0
- package/.next/types/app/api/ai/providers/[id]/test/route.ts +347 -0
- package/.next/types/app/api/ai/providers/route.ts +347 -0
- package/.next/types/app/api/ai/tokens/[id]/route.ts +347 -0
- package/.next/types/app/api/ai/tokens/route.ts +347 -0
- package/.next/types/app/api/auth/login/route.ts +347 -0
- package/.next/types/app/api/auth/logout/route.ts +347 -0
- package/.next/types/app/api/c/[cid]/[db]/[coll]/aggregate/route.ts +347 -0
- package/.next/types/app/api/c/[cid]/[db]/[coll]/bulk/route.ts +347 -0
- package/.next/types/app/api/c/[cid]/[db]/[coll]/count/route.ts +347 -0
- package/.next/types/app/api/c/[cid]/[db]/[coll]/danger/route.ts +347 -0
- package/.next/types/app/api/c/[cid]/[db]/[coll]/docs/route.ts +347 -0
- package/.next/types/app/api/c/[cid]/[db]/[coll]/explain/route.ts +347 -0
- package/.next/types/app/api/c/[cid]/[db]/[coll]/export/route.ts +347 -0
- package/.next/types/app/api/c/[cid]/[db]/[coll]/find/route.ts +347 -0
- package/.next/types/app/api/c/[cid]/[db]/[coll]/import/route.ts +347 -0
- package/.next/types/app/api/c/[cid]/[db]/[coll]/indexes/route.ts +347 -0
- package/.next/types/app/api/c/[cid]/[db]/[coll]/schema/route.ts +347 -0
- package/.next/types/app/api/c/[cid]/[db]/[coll]/stats/route.ts +347 -0
- package/.next/types/app/api/c/[cid]/[db]/[coll]/validation/route.ts +347 -0
- package/.next/types/app/api/c/[cid]/[db]/collections/route.ts +347 -0
- package/.next/types/app/api/c/[cid]/[db]/collstats/route.ts +347 -0
- package/.next/types/app/api/c/[cid]/[db]/danger/route.ts +347 -0
- package/.next/types/app/api/c/[cid]/[db]/stats/route.ts +347 -0
- package/.next/types/app/api/c/[cid]/databases/route.ts +347 -0
- package/.next/types/app/api/c/[cid]/server/route.ts +347 -0
- package/.next/types/app/api/c/[cid]/shell/route.ts +347 -0
- package/.next/types/app/api/c/[cid]/tree/route.ts +347 -0
- package/.next/types/app/api/connections/[cid]/route.ts +347 -0
- package/.next/types/app/api/connections/route.ts +347 -0
- package/.next/types/app/api/connections/test/route.ts +347 -0
- package/.next/types/app/api/mcp/route.ts +347 -0
- package/.next/types/app/api/me/route.ts +347 -0
- package/.next/types/app/api/me/totp/route.ts +347 -0
- package/.next/types/app/layout.ts +84 -0
- package/.next/types/app/login/page.ts +84 -0
- package/.next/types/cache-life.d.ts +141 -0
- package/.next/types/package.json +1 -0
- package/.next/types/routes.d.ts +127 -0
- package/.next/types/validator.ts +574 -0
- package/LICENSE +21 -0
- package/NOTICE +17 -0
- package/README.md +212 -2
- package/bin/mongoadmin.mjs +118 -0
- package/next.config.mjs +23 -0
- package/package.json +93 -4
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
exports.id=4811,exports.ids=[4811],exports.modules={2744:(a,b,c)=>{Promise.resolve().then(c.bind(c,6737)),Promise.resolve().then(c.bind(c,83831)),Promise.resolve().then(c.bind(c,97513)),Promise.resolve().then(c.bind(c,77591)),Promise.resolve().then(c.bind(c,41843))},2803:(a,b,c)=>{"use strict";function d(a){if(null===a)return"Null";if(void 0===a)return"Undefined";if("string"==typeof a)return"String";if("boolean"==typeof a)return"Boolean";if("number"==typeof a)return Number.isInteger(a)?"Int32":"Double";if(a instanceof Date)return"Date";if(a instanceof RegExp)return"RegExp";if(Array.isArray(a))return"Array";let b=a._bsontype;return"ObjectId"===b||"ObjectID"===b?"ObjectId":"Int32"===b?"Int32":"Double"===b?"Double":"Long"===b?"Long":"Decimal128"===b?"Decimal128":"Binary"===b?4===a.sub_type?"UUID":"Binary":"BSONRegExp"===b?"RegExp":"Timestamp"===b?"Timestamp":"MinKey"===b?"MinKey":"MaxKey"===b?"MaxKey":"Code"===b?"Code":"BSONSymbol"===b||"Symbol"===b?"Symbol":"Object"}c.d(b,{CM:()=>j,I:()=>d,VH:()=>h,aB:()=>function a(b,c=0){let e=" ".repeat(c+1),h=" ".repeat(c);switch(d(b)){case"String":return JSON.stringify(b);case"Int32":{let a=f(b);return Number.isInteger(a)&&0x7fffffff>=Math.abs(a)?String(a):`NumberInt(${a})`}case"Double":{let a=f(b);return Number.isInteger(a)?`Double(${a})`:String(a)}case"Long":return`NumberLong('${b.toString()}')`;case"Decimal128":return`NumberDecimal('${b.toString()}')`;case"Boolean":return String(b);case"Null":return"null";case"Undefined":return"undefined";case"Date":return`ISODate('${g(b)}')`;case"ObjectId":return`ObjectId('${b.toHexString()}')`;case"UUID":return`UUID('${b.toUUID().toString()}')`;case"Binary":return`BinData(${b.sub_type}, '${b.toString("base64")}')`;case"RegExp":return b instanceof RegExp?String(b):`/${b.pattern}/${b.options}`;case"Timestamp":return`Timestamp({ t: ${b.high}, i: ${b.low} })`;case"MinKey":return"MinKey()";case"MaxKey":return"MaxKey()";case"Array":if(0===b.length)return"[]";return`[
|
|
2
|
+
${b.map(b=>e+a(b,c+1)).join(",\n")}
|
|
3
|
+
${h}]`;case"Object":{let d=Object.entries(b);if(0===d.length)return"{}";return`{
|
|
4
|
+
${d.map(([b,d])=>`${e}${/^[A-Za-z_$][\w$]*$/.test(b)?b:JSON.stringify(b)}: ${a(d,c+1)}`).join(",\n")}
|
|
5
|
+
${h}}`}default:return JSON.stringify(String(b))}},sq:()=>e,u_:()=>i});let e={String:"t-string",Int32:"t-number",Double:"t-number",Long:"t-number",Decimal128:"t-number",Boolean:"t-bool",Date:"t-date",Timestamp:"t-date",ObjectId:"t-oid",UUID:"t-oid",Binary:"t-oid",Null:"t-null",Undefined:"t-null",RegExp:"t-string",MinKey:"t-null",MaxKey:"t-null"},f=a=>a.valueOf();function g(a){return Number.isNaN(a.getTime())?"Invalid Date":a.toISOString()}function h(a){let b=d(a);switch(b){case"String":return JSON.stringify(a);case"Int32":case"Double":return String(f(a));case"Long":case"Decimal128":return a.toString();case"Boolean":return String(a);case"Null":return"null";case"Undefined":return"undefined";case"Date":return g(a);case"ObjectId":return`ObjectId('${a.toHexString()}')`;case"UUID":return`UUID('${a.toUUID().toString()}')`;case"Binary":return`Binary(${a.sub_type}, '${a.toString("base64").slice(0,24)}…')`;case"RegExp":return a instanceof RegExp?String(a):`/${a.pattern}/${a.options}`;case"Timestamp":return`Timestamp({ t: ${a.high}, i: ${a.low} })`;case"Array":return`Array (${a.length})`;case"Object":return`Object (${Object.keys(a).length})`;default:return b}}let i=a=>{let b=d(a);return"Object"===b||"Array"===b};function j(a,b=60){let c,e=d(a);return(c="Array"===e?`[${a.map(a=>i(a)?"Array"===d(a)?"[…]":"{…}":h(a)).join(", ")}]`:"Object"===e?`{ ${Object.entries(a).map(([a,b])=>`${a}: ${i(b)?"Array"===d(b)?"[…]":"{…}":h(b)}`).join(", ")} }`:h(a)).length>b?c.slice(0,b-1)+"…":c}},3416:(a,b,c)=>{Promise.resolve().then(c.bind(c,31119)),Promise.resolve().then(c.bind(c,57093)),Promise.resolve().then(c.bind(c,18255)),Promise.resolve().then(c.bind(c,52945)),Promise.resolve().then(c.bind(c,47933))},4439:(a,b,c)=>{"use strict";c.d(b,{i:()=>j});var d=c(21124),e=c(38301),f=c(7144),g=c(81922),h=c(44943),i=c(2803);let j=(0,e.memo)(function({value:a,depth:b=0,expandAll:c=!1}){let f=Array.isArray(a)?a.map((a,b)=>[String(b),a]):Object.entries(a),[g,i]=(0,e.useState)(25),j=f.slice(0,g);return(0,d.jsxs)("div",{className:(0,h.cn)("font-mono text-[12px] leading-[19px]",b>0&&"ml-[18px] border-l pl-1.5"),children:[j.map(([e,f])=>(0,d.jsx)(k,{name:e,value:f,depth:b,isIndex:Array.isArray(a),expandAll:c},e)),f.length>j.length&&(0,d.jsxs)("button",{onClick:()=>i(a=>a+500),className:"text-[11px] text-accent hover:underline",children:["Show ",Math.min(500,f.length-j.length)," more of ",f.length-j.length]})]})});function k({name:a,value:b,depth:c,isIndex:k,expandAll:l}){let[m,n]=(0,e.useState)(l&&c<3),o=(0,i.I)(b),p=(0,i.u_)(b);return(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{className:"group/field flex min-w-0 items-start gap-1 rounded px-0.5 hover:bg-bg-muted/70",children:[p?(0,d.jsx)("button",{onClick:()=>n(a=>!a),className:"mt-[2.5px] text-fg-subtle hover:text-fg",children:m?(0,d.jsx)(f.A,{className:"h-3.5 w-3.5"}):(0,d.jsx)(g.A,{className:"h-3.5 w-3.5"})}):(0,d.jsx)("span",{className:"w-3.5 shrink-0"}),(0,d.jsx)("span",{className:(0,h.cn)("shrink-0",k?"text-fg-subtle":"t-key font-semibold"),children:a}),(0,d.jsx)("span",{className:"shrink-0 text-fg-subtle",children:":"}),(0,d.jsx)("span",{className:(0,h.cn)("min-w-0 break-all",i.sq[o]??"text-fg-muted"),title:o,children:p?(0,d.jsx)("button",{onClick:()=>n(a=>!a),className:"text-fg-muted hover:text-fg",children:(0,i.VH)(b)}):(0,i.VH)(b)}),(0,d.jsx)("span",{className:"ml-1 hidden shrink-0 text-[10px] text-fg-subtle group-hover/field:inline",children:o})]}),p&&m&&(0,d.jsx)(j,{value:b,depth:c+1,expandAll:l})]})}},5726:(a,b,c)=>{"use strict";c.d(b,{z:()=>h});var d=c(21124),e=c(3991),f=c.n(e),g=c(81922);function h({crumbs:a,actions:b}){return(0,d.jsxs)("header",{className:"flex h-10 shrink-0 items-center gap-2 border-b px-4",children:[(0,d.jsx)("nav",{className:"flex min-w-0 items-center gap-1 text-[12.5px]",children:a.map((a,b)=>(0,d.jsxs)("span",{className:"flex min-w-0 items-center gap-1",children:[b>0&&(0,d.jsx)(g.A,{className:"h-3.5 w-3.5 shrink-0 text-fg-subtle"}),a.href?(0,d.jsx)(f(),{href:a.href,className:"truncate text-fg-muted hover:text-fg",children:a.label}):(0,d.jsx)("span",{className:"truncate font-semibold",children:a.label})]},b))}),(0,d.jsx)("div",{className:"ml-auto flex items-center gap-1.5",children:b})]})}},6737:(a,b,c)=>{"use strict";c.d(b,{WorkspaceTabs:()=>d});let d=(0,c(97954).registerClientReference)(function(){throw Error("Attempted to call WorkspaceTabs() from the server but WorkspaceTabs is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Volumes/BOHR@HD/Pankaj/Project/WeAreTeam/MongoAdmin/src/features/shell/workspace-tabs.tsx","WorkspaceTabs")},11502:(a,b,c)=>{"use strict";c.d(b,{A:()=>e});var d=c(21124);function e({className:a}){return(0,d.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,className:a,children:[(0,d.jsx)("path",{d:"M12 2.5C8.2 6.3 7 9.8 7 13c0 3.4 2.2 6 5 7.3 2.8-1.3 5-3.9 5-7.3 0-3.2-1.2-6.7-5-10.5Z",fill:"currentColor"}),(0,d.jsx)("path",{d:"M12 5.5v16",stroke:"var(--panel)",strokeOpacity:".55",strokeWidth:"1.3",strokeLinecap:"round"})]})}},13133:(a,b,c)=>{"use strict";c.d(b,{$3:()=>g,TM:()=>j,Wc:()=>i,yj:()=>h});var d=c(21393),e=c(45478);let f={viewer:1,editor:2,admin:3},g=(a,b)=>!!a&&f[a]>=f[b];function h(){return(0,d.I)({queryKey:["me"],queryFn:()=>(0,e.FH)("/api/me"),staleTime:6e4})}function i(a){return(0,d.I)({queryKey:["tree",a],queryFn:()=>(0,e.FH)(`/api/c/${a}/tree`),enabled:!!a,staleTime:3e4})}function j(a,b,c=!0){return(0,d.I)({queryKey:["collstats",a,b,"*all"],queryFn:()=>(0,e.FH)(`/api/c/${a}/${encodeURIComponent(b)}/collstats`),enabled:c,staleTime:6e4})}},16128:(a,b,c)=>{"use strict";c.d(b,{U:()=>n});var d=c(21124),e=c(38301),f=c(42378),g=c(96610),h=c(42830),i=c(45478),j=c(40068),k=c(35284),l=c(93758),m=c(48028);function n({cid:a,db:b,coll:c,action:n,onClose:o}){let[p,q]=(0,e.useState)(""),[r,s]=(0,e.useState)("confirm"),[t,u]=(0,e.useState)("email"),[v,w]=(0,e.useState)(),[x,y]=(0,e.useState)(""),[z,A]=(0,e.useState)(null),[B,C]=(0,e.useState)(null),[D,E]=(0,e.useState)(!1),F=(0,g.jE)(),G=(0,f.useRouter)(),H=function(a,b,c){let e=(0,d.jsx)("b",{className:"font-mono",children:c??b});return"wipe"===a?{title:"Wipe data",button:"Wipe data",body:c?(0,d.jsxs)(d.Fragment,{children:["Deletes ",(0,d.jsx)("b",{children:"every document"})," in the collection ",e,". The collection, its indexes and validation rules stay. This cannot be undone."]}):(0,d.jsxs)(d.Fragment,{children:["Deletes ",(0,d.jsx)("b",{children:"every document"})," in every collection of ",e,". Collections, indexes and validation rules stay. This cannot be undone."]})}:c?{title:"Delete collection",button:"Delete collection",body:(0,d.jsxs)(d.Fragment,{children:["Permanently deletes the collection ",e," with its indexes and data. This cannot be undone."]})}:{title:"Delete database",button:"Delete database",body:(0,d.jsxs)(d.Fragment,{children:["Permanently deletes the database ",e," with all its collections, indexes and data. This cannot be undone."]})}}(n,b,c),I=c??b,J=c?`/api/c/${a}/${(0,i.fk)(b)}/${(0,i.fk)(c)}/danger`:`/api/c/${a}/${(0,i.fk)(b)}/danger`;async function K(d){E(!0),C(null);try{let e=await (0,i.FH)(J,{body:{action:n,confirm:p,code:d||void 0}});if("need_code"===e.status){u(e.method),w(e.sentTo),y(""),s("code");return}if("pending"===e.status){h.oR.success("Sent to an admin for approval. It runs once they approve it."),o();return}await F.invalidateQueries({queryKey:["tree",a]}),F.invalidateQueries({queryKey:["dbstats",a,b]}),F.invalidateQueries({queryKey:["collstats",a,b]}),c&&(F.invalidateQueries({queryKey:["docs",a,b,c]}),F.invalidateQueries({queryKey:["count",a,b,c]})),h.oR.success("drop"===n?`Deleted ${c?"collection":"database"} ${I}`:`Wiped ${I} \xb7 ${e.deleted??0} documents deleted`),o(),"drop"===n&&G.push(c?`/c/${a}/${(0,i.fk)(b)}`:`/c/${a}`)}catch(a){if(a instanceof i.hD&&"totp_setup"===a.code)return void await L();C(a)}finally{E(!1)}}async function L(){try{A(await (0,i.FH)("/api/me/totp",{body:{step:"setup"}})),y(""),s("setup")}catch(a){C(a)}}async function M(){E(!0),C(null);try{await (0,i.FH)("/api/me/totp",{body:{step:"verify",code:x}}),h.oR.success("Authenticator app is set up"),y(""),u("totp"),s("code")}catch(a){C(a)}finally{E(!1)}}let N="confirm"===r?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(k.$,{onClick:o,children:"Cancel"}),(0,d.jsx)(k.$,{variant:"danger",loading:D,disabled:p!==I,onClick:()=>K(),children:H.button})]}):"code"===r?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(k.$,{onClick:o,children:"Cancel"}),(0,d.jsx)(k.$,{variant:"danger",loading:D,disabled:x.length<6,onClick:()=>K(x),children:"Confirm"})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(k.$,{onClick:o,children:"Cancel"}),(0,d.jsx)(k.$,{variant:"primary",loading:D,disabled:x.length<6,onClick:M,children:"Turn on"})]});return(0,d.jsx)(j.l,{open:!0,onClose:o,title:H.title,width:"max-w-md",footer:N,children:(0,d.jsxs)("div",{className:"space-y-3 text-xs",children:["confirm"===r&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("p",{className:"rounded-md bg-danger-soft px-3 py-2 leading-relaxed text-danger",children:H.body}),(0,d.jsxs)("p",{children:["Type ",(0,d.jsx)("b",{className:"font-mono",children:I})," to confirm:"]}),(0,d.jsx)(l.pd,{value:p,onChange:a=>q(a.target.value),autoFocus:!0,autoComplete:"off",spellCheck:!1,onKeyDown:a=>"Enter"===a.key&&p===I&&K()})]}),"code"===r&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("p",{children:"email"===t?(0,d.jsxs)(d.Fragment,{children:["We emailed a 6-digit code to ",(0,d.jsx)("b",{children:v}),". It expires in 10 minutes."]}):"Enter the 6-digit code from your authenticator app."}),(0,d.jsx)(l.pd,{value:x,onChange:a=>y(a.target.value.replace(/\D/g,"").slice(0,6)),autoFocus:!0,inputMode:"numeric",autoComplete:"one-time-code",placeholder:"123456",className:"text-center font-mono text-base tracking-[0.4em]",onKeyDown:a=>"Enter"===a.key&&6===x.length&&K(x)}),"email"===t&&(0,d.jsx)("button",{className:"text-accent hover:underline",disabled:D,onClick:()=>K(),children:"Send a new code"})]}),"setup"===r&&z&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("p",{children:"Your admin requires an authenticator app (Google Authenticator, Authy, 1Password…). Scan this once, then enter the code it shows."}),(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("img",{src:z.qr,alt:"Authenticator QR code",width:140,height:140,className:"rounded border bg-white p-1"}),(0,d.jsxs)("div",{className:"min-w-0 text-[11px] text-fg-muted",children:["Can't scan? Enter this key:",(0,d.jsx)("p",{className:"mt-1 break-all font-mono text-[11.5px] text-fg",children:z.secret})]})]}),(0,d.jsx)(l.pd,{value:x,onChange:a=>y(a.target.value.replace(/\D/g,"").slice(0,6)),autoFocus:!0,inputMode:"numeric",placeholder:"123456",className:"text-center font-mono text-base tracking-[0.4em]",onKeyDown:a=>"Enter"===a.key&&6===x.length&&M()})]}),(0,d.jsx)(m.aV,{error:B})]})})}},18255:(a,b,c)=>{"use strict";c.d(b,{SplitArea:()=>n});var d=c(21124),e=c(38301),f=c(3991),g=c.n(f),h=c(17089),i=c(90386),j=c(45478),k=c(44943),l=c(20222),m=c(52945);function n({children:a}){let{panes:b,mainAt:c,reorder:f}=(0,m.OI)(),g=[...b.map(a=>a.id)];g.splice(c,0,"main");let h=g.length,i=Math.min(h,3),[j,l]=(0,e.useState)({}),n=g.join(","),[p,q]=(0,e.useState)(n);n!==p&&(q(n),Object.keys(j).length&&l({}));let r=(0,e.useRef)(null),[s,t]=(0,e.useState)(null),[u,v]=(0,e.useState)(null);return 0===b.length?(0,d.jsx)(d.Fragment,{children:a}):(0,d.jsx)("div",{className:"flex min-h-0 flex-1 flex-col",children:(0,d.jsx)("div",{ref:r,className:"scrollbar-thin flex min-h-0 flex-1 overflow-x-auto overflow-y-hidden",children:g.map((c,m)=>{let n,p,q=b.find(a=>a.id===c);return(0,d.jsxs)(e.Fragment,{children:[m>0&&(0,d.jsxs)("div",{role:"separator","aria-orientation":"vertical","aria-label":"Resize panes",onPointerDown:a=>(function(a,b){b.preventDefault();let c=Array.from(r.current?.querySelectorAll(":scope > section")??[]),d=c[a],e=c[a+1],f=r.current?.clientWidth??0;if(!d||!e||!f)return;let j=f/i,k=g[a],m=g[a+1],n=b.clientX,o=d.offsetWidth,p=e.offsetWidth;document.body.style.cursor="col-resize",document.body.style.userSelect="none";let q=0,s=0,t=a=>`calc(${a/j} * 100% / ${i})`,u=a=>{q=h<=3?Math.max(320-o,Math.min(p-320,a.clientX-n)):Math.max(320-o,a.clientX-n),s||(s=requestAnimationFrame(()=>{s=0,d.style.flexBasis=t(o+q),h<=3&&(e.style.flexBasis=t(p-q))}))},v=()=>{window.removeEventListener("pointermove",u),window.removeEventListener("pointerup",v),cancelAnimationFrame(s),l(a=>({...a,[k]:(o+q)/j,...h<=3?{[m]:(p-q)/j}:{}})),document.body.style.cursor="",document.body.style.userSelect=""};window.addEventListener("pointermove",u),window.addEventListener("pointerup",v)})(m-1,a),onDoubleClick:()=>l({}),className:"group relative z-10 -mx-[3.5px] w-[7px] shrink-0 cursor-col-resize",children:[(0,d.jsx)("span",{className:"absolute inset-y-0 left-[3px] w-px bg-border transition-colors delay-75 group-hover:bg-accent group-active:bg-accent"}),(0,d.jsx)("span",{className:"absolute left-1/2 top-1/2 h-8 w-1 -translate-x-1/2 -translate-y-1/2 rounded-full opacity-0 transition-opacity group-hover:bg-accent group-hover:opacity-100 group-active:opacity-100"})]}),(n=c,p="main"===c?a:q?(0,d.jsx)(o,{pane:q}):null,(0,d.jsxs)("section",{onPointerDown:a=>{let b=a.target;a.currentTarget.draggable=!!b.closest("header")&&!b.closest("button, a, input")},onDragStart:a=>{t(n),a.dataTransfer.effectAllowed="move",a.dataTransfer.setData("text/plain",n);let b=function(a){let b=getComputedStyle(document.documentElement),c=(a,c)=>b.getPropertyValue(a).trim()||c,d=document.createElement("div");return d.innerHTML='<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 3v18"/><rect width="18" height="18" x="3" y="3" rx="2"/><path d="M3 9h18"/><path d="M3 15h18"/></svg><span></span>',d.querySelector("span").textContent=a,d.firstElementChild.style.color=c("--accent","#115e59"),Object.assign(d.style,{position:"fixed",top:"-200px",left:"-200px",display:"flex",alignItems:"center",gap:"6px",padding:"6px 12px",borderRadius:"7px",whiteSpace:"nowrap",font:"500 12.5px system-ui, sans-serif",background:c("--panel","#fff"),color:c("--fg","#0f172a"),border:`1px solid ${c("--border-strong","#cbd5e1")}`,boxShadow:"0 8px 24px rgba(0,0,0,.16)"}),document.body.appendChild(d),d}(a.currentTarget.querySelector("header nav > span:last-child")?.textContent??"Pane");a.dataTransfer.setDragImage(b,14,14),setTimeout(()=>b.remove(),0)},onDragEnd:()=>{t(null),v(null)},onDragOver:a=>{s&&(a.preventDefault(),u!==n&&v(n))},onDragLeave:a=>{a.currentTarget.contains(a.relatedTarget)||v(a=>a===n?null:a)},onDrop:a=>{a.preventDefault(),u&&function(a){if(!s||s===a)return;let b=[...g],c=b.indexOf(s),d=b.indexOf(a);[b[c],b[d]]=[b[d],b[c]],f(b)}(u),t(null),v(null)},className:(0,k.cn)("relative flex shrink-0 flex-col overflow-hidden transition-opacity [&>header]:cursor-grab",s===n&&"opacity-50 grayscale"),style:{flexBasis:`calc(${j[n]??1} * 100% / ${i})`,minWidth:320},children:[p,u===n&&s!==n&&(0,d.jsx)("span",{className:"pointer-events-none absolute inset-1 z-20 rounded-md border-2 border-accent/60 bg-accent/10"})]},n))]},c)})})})}let o=(0,e.memo)(function({pane:a}){let{close:b}=(0,m.h9)(),[c,f]=(0,e.useState)("documents"),k=`/c/${a.cid}/${(0,j.fk)(a.db)}/${(0,j.fk)(a.coll)}`;return(0,d.jsx)(l.i,{cid:a.cid,db:a.db,coll:a.coll,tab:c,onTab:f,compact:!0,headerExtra:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(g(),{href:k,onClick:()=>b(a.id),title:"Open as main page",className:"rounded p-1 text-fg-muted hover:bg-bg-muted hover:text-fg",children:(0,d.jsx)(h.A,{className:"h-3.5 w-3.5"})}),(0,d.jsx)("button",{onClick:()=>b(a.id),title:"Close pane",className:"rounded p-1 text-fg-muted hover:bg-danger-soft hover:text-danger",children:(0,d.jsx)(i.A,{className:"h-3.5 w-3.5"})})]})})})},18304:(a,b,c)=>{"use strict";c.d(b,{DP:()=>k,KO:()=>f,NP:()=>j,qR:()=>g});var d=c(21124),e=c(38301);let f={teal:{label:"Deep Teal",light:"#115e59",dark:"#2dd4bf"},navy:{label:"Navy",light:"#1e3a8a",dark:"#93c5fd"},indigo:{label:"Indigo",light:"#3730a3",dark:"#a5b4fc"},aubergine:{label:"Aubergine",light:"#581c87",dark:"#d8b4fe"},burgundy:{label:"Burgundy",light:"#881337",dark:"#fda4af"},rust:{label:"Rust",light:"#9a3412",dark:"#fdba74"},bronze:{label:"Bronze",light:"#854d0e",dark:"#fcd34d"},espresso:{label:"Espresso",light:"#5b3a24",dark:"#d6b28c"},graphite:{label:"Graphite",light:"#1f2937",dark:"#cbd5e1"}},g=/^#[0-9a-f]{6}$/i,h=(0,e.createContext)({dark:!1,toggle:()=>{},setDark:()=>{},accent:"teal",setAccent:()=>{}}),i=(a,b)=>{try{localStorage.setItem(a,b)}catch{}};function j({children:a}){let[b,c]=(0,e.useState)(!1),[j,k]=(0,e.useState)("teal"),l=(0,e.useCallback)(a=>{c(a),i("ma-theme",a?"dark":"light")},[]),m=(0,e.useCallback)(()=>c(a=>(i("ma-theme",a?"light":"dark"),!a)),[]),n=(0,e.useCallback)(a=>{a&&(a in f||g.test(a))&&(k(a),i("ma-accent",a))},[]);return(0,d.jsx)(h.Provider,{value:{dark:b,toggle:m,setDark:l,accent:j,setAccent:n},children:a})}let k=()=>(0,e.useContext)(h)},20222:(a,b,c)=>{"use strict";c.d(b,{i:()=>bg,x:()=>bf});var d=c(21124),e=c(52945),f=c(21393),g=c(45478),h=c(13133),i=c(5726),j=c(48028),k=c(44943),l=c(38301),m=c(31800),n=c(96610),o=c(44394),p=c(11853),q=c(21738),r=c(38644),s=c(15856),t=c(76870),u=c(35087),v=c(81922),w=c(43993),x=c(15903),y=c(92914),z=c(49330),A=c(99907),B=c(35284),C=c(40068),D=c(2803);function E({scope:a,kind:b,query:c,pipeline:e,onClose:h}){let[i,m]=(0,l.useState)("visual"),n=(0,f.I)({queryKey:["explain",a,b,c,e],queryFn:()=>(0,g.FH)(`${(0,g.wV)(a.cid,a.db,a.coll)}/explain`,{body:"find"===b?{kind:b,filter:c?.filter,project:c?.project,sort:c?.sort,collation:c?.collation,skip:c?.skip,limit:c?.limit}:{kind:b,pipeline:e}})}),o=n.data?.explain,p=o?.executionStats??o?.stages?.[0]?.$cursor?.executionStats,q=o?.queryPlanner?.winningPlan??o?.stages?.[0]?.$cursor?.queryPlanner?.winningPlan,r=p?.executionStages??q?.queryPlan??q,s=r?function a(b){let c=b.indexName?[b.indexName]:[];for(let d of b.inputStages??(b.inputStage?[b.inputStage]:[]))c.push(...a(d));return c}(r):[],t=!!r&&function a(b,c){return b.stage===c||(b.inputStages??(b.inputStage?[b.inputStage]:[])).some(b=>a(b,c))}(r,"COLLSCAN");return(0,d.jsxs)(C.l,{open:!0,onClose:h,title:"Explain plan",width:"max-w-3xl",children:[n.isLoading&&(0,d.jsx)(j.y$,{}),(0,d.jsx)(j.aV,{error:n.error}),o&&(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)(j.I2,{value:i,onChange:m,items:[{value:"visual",label:"Visual tree"},{value:"raw",label:"Raw output"}]}),t?(0,d.jsx)(j.Ex,{tone:"warn",children:"No index used (collection scan)"}):s.length>0?(0,d.jsxs)(j.Ex,{tone:"accent",children:["Index: ",s.join(", ")]}):null]}),p&&(0,d.jsxs)("div",{className:"grid grid-cols-4 gap-3 rounded-lg border p-3 text-xs",children:[(0,d.jsx)(F,{label:"Documents returned",value:(0,k.ZV)((0,k.bu)(p.nReturned))}),(0,d.jsx)(F,{label:"Documents examined",value:(0,k.ZV)((0,k.bu)(p.totalDocsExamined))}),(0,d.jsx)(F,{label:"Index keys examined",value:(0,k.ZV)((0,k.bu)(p.totalKeysExamined))}),(0,d.jsx)(F,{label:"Execution time",value:`${(0,k.bu)(p.executionTimeMillis)} ms`})]}),"visual"===i?r?(0,d.jsx)(G,{s:r}):(0,d.jsx)("p",{className:"text-xs text-fg-muted",children:"No plan tree in this output — see Raw output."}):(0,d.jsx)("pre",{className:"scrollbar-thin max-h-[50vh] overflow-auto rounded-md border bg-bg-subtle p-3 font-mono text-[11px]",children:(0,D.aB)(o)})]})]})}function F({label:a,value:b}){return(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-fg-subtle",children:a}),(0,d.jsx)("p",{className:"text-sm font-semibold",children:b})]})}function G({s:a}){let b=a.inputStages??(a.inputStage?[a.inputStage]:[]);return(0,d.jsxs)("div",{className:"flex flex-col items-center gap-2",children:[(0,d.jsxs)("div",{className:`min-w-56 rounded-lg border px-3 py-2 text-xs ${"COLLSCAN"===a.stage?"border-warn bg-warn-soft":"IXSCAN"===a.stage?"border-accent bg-accent-soft":"bg-panel"}`,children:[(0,d.jsx)("p",{className:"font-semibold",children:a.stage}),a.indexName&&(0,d.jsxs)("p",{className:"font-mono text-[11px]",children:[a.indexName," ",a.keyPattern?(0,D.aB)(a.keyPattern).replace(/\s+/g," "):""]}),(0,d.jsxs)("div",{className:"mt-1 grid grid-cols-2 gap-x-3 text-[11px] text-fg-muted",children:[void 0!==a.nReturned&&(0,d.jsxs)("span",{children:["returned: ",(0,k.ZV)((0,k.bu)(a.nReturned))]}),void 0!==a.executionTimeMillisEstimate&&(0,d.jsxs)("span",{children:["time: ",(0,k.bu)(a.executionTimeMillisEstimate)," ms"]}),void 0!==a.docsExamined&&(0,d.jsxs)("span",{children:["docs: ",(0,k.ZV)((0,k.bu)(a.docsExamined))]}),void 0!==a.keysExamined&&(0,d.jsxs)("span",{children:["keys: ",(0,k.ZV)((0,k.bu)(a.keysExamined))]})]})]}),b.length>0&&(0,d.jsx)("div",{className:"flex gap-4 border-t pt-2",children:b.map((a,b)=>(0,d.jsx)(G,{s:a},b))})]})}var H=c(42830),I=c(54788),J=c(93758);function K({scope:a,query:b,total:c,onClose:e}){let[f,h]=(0,l.useState)(!!(b.filter||b.project||b.sort)),[i,j]=(0,l.useState)("json"),[m,n]=(0,l.useState)(""),[o,p]=(0,l.useState)("");return(0,d.jsx)(C.l,{open:!0,onClose:e,title:`Export ${a.coll}`,footer:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(B.$,{onClick:e,children:"Cancel"}),(0,d.jsx)(B.$,{variant:"primary",onClick:function(){let c=new URL(`${(0,g.wV)(a.cid,a.db,a.coll)}/export`,window.location.origin);c.searchParams.set("format",i),f&&(b.filter&&c.searchParams.set("filter",b.filter),b.project&&c.searchParams.set("project",b.project),b.sort&&c.searchParams.set("sort",b.sort)),m&&"csv"===i&&c.searchParams.set("fields",m),o&&c.searchParams.set("limit",o);let d=document.createElement("a");d.href=c.toString(),d.click(),H.oR.success("Export started — your browser is downloading the file"),e()},children:"Export"})]}),children:(0,d.jsxs)("div",{className:"space-y-3 text-xs",children:[(0,d.jsxs)("label",{className:"flex items-center gap-2",children:[(0,d.jsx)("input",{type:"radio",checked:f,onChange:()=>h(!0),disabled:!(b.filter||b.project||b.sort)}),"Export the current query result"]}),(0,d.jsxs)("label",{className:"flex items-center gap-2",children:[(0,d.jsx)("input",{type:"radio",checked:!f,onChange:()=>h(!1)}),"Export the full collection",null!==c?` (${(0,k.ZV)(c)} documents)`:""]}),(0,d.jsx)(J.D0,{label:"File type",children:(0,d.jsxs)(J.l6,{value:i,onChange:a=>j(a.target.value),children:[(0,d.jsx)("option",{value:"json",children:"JSON (Extended JSON — keeps types)"}),(0,d.jsx)("option",{value:"csv",children:"CSV"})]})}),"csv"===i&&(0,d.jsx)(J.D0,{label:"Fields (optional, comma separated)",hint:"Empty = all fields found in the data. Nested fields use dots, e.g. profile.city",children:(0,d.jsx)(J.pd,{value:m,onChange:a=>n(a.target.value),placeholder:"name,email,profile.city"})}),(0,d.jsx)(J.D0,{label:"Max documents (optional)",children:(0,d.jsx)(J.pd,{value:o,onChange:a=>p(a.target.value.replace(/\D/g,"")),placeholder:"All"})})]})})}function L({scope:a,onClose:b,onDone:c}){let[e,f]=(0,l.useState)(null),[h,i]=(0,l.useState)(!0),[m,n]=(0,l.useState)(!1),[o,p]=(0,l.useState)(null),[q,r]=(0,l.useState)(null);async function s(){if(e){n(!0),p(null);try{let b=new FormData;b.set("file",e),b.set("format",e.name.toLowerCase().endsWith(".csv")?"csv":"json"),b.set("stopOnError",String(h));let d=await fetch(`${(0,g.wV)(a.cid,a.db,a.coll)}/import`,{method:"POST",body:b,credentials:"same-origin"}),f=I.On.parse(await d.text(),{relaxed:!1});if(!d.ok)throw Error(f.error??"Import failed");let i={total:(0,k.bu)(f.total),inserted:(0,k.bu)(f.inserted),errors:f.errors??[]};r(i),H.oR.success(`Imported ${(0,k.ZV)(i.inserted)} of ${(0,k.ZV)(i.total)} documents`),c()}catch(a){p(a)}finally{n(!1)}}}return(0,d.jsx)(C.l,{open:!0,onClose:b,title:`Import into ${a.coll}`,footer:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(B.$,{onClick:b,children:q?"Done":"Cancel"}),!q&&(0,d.jsx)(B.$,{variant:"primary",loading:m,disabled:!e,onClick:s,children:"Import"})]}),children:(0,d.jsxs)("div",{className:"space-y-3 text-xs",children:[(0,d.jsx)(J.D0,{label:"File",hint:"JSON array, newline-delimited JSON, or CSV with a header row. Max 200 MB.",children:(0,d.jsx)("input",{type:"file",accept:".json,.ndjson,.jsonl,.csv",onChange:a=>f(a.target.files?.[0]??null),className:"block w-full text-xs"})}),(0,d.jsxs)("label",{className:"flex items-center gap-2",children:[(0,d.jsx)("input",{type:"checkbox",checked:h,onChange:a=>i(a.target.checked)}),"Stop on first error"]}),q&&(0,d.jsxs)("div",{className:"rounded-md border bg-bg-subtle p-3",children:[(0,d.jsxs)("p",{className:"font-medium",children:["Inserted ",(0,k.ZV)(q.inserted)," of ",(0,k.ZV)(q.total)," documents."]}),q.errors.map((a,b)=>(0,d.jsx)("p",{className:"mt-1 text-danger",children:a},b))]}),(0,d.jsx)(j.aV,{error:o})]})})}var M=c(54608),N=c(87423),O=c(7144),P=c(66202),Q=c(13973),R=c(26949),S=c(20387),T=c(47192),U=c(66128),V=c(65703),W=c(18304);let X=(0,Q.default)(async()=>{},{loadableGenerated:{modules:["components/code-editor.tsx -> @uiw/react-codemirror"]},ssr:!1,loading:()=>(0,d.jsx)("div",{className:"h-full min-h-8 rounded-md border bg-bg-subtle"})});function Y({value:a,onChange:b,onRun:c,lang:e="js",minHeight:f="32px",maxHeight:g,readOnly:h,placeholder:i,oneLine:j,className:k,onReady:m}){let{dark:n}=(0,W.DP)(),o=(0,l.useMemo)(()=>["json"===e?(0,R.Pq)():(0,S.Q2)(),U.Lz.lineWrapping,V.Nb.highest(U.w4.of([{key:"Mod-Enter",run:()=>(c?.(),!0)},...j?[{key:"Enter",run:()=>(c?.(),!0)}]:[]]))],[e,c,j]);return(0,d.jsx)(X,{className:k,value:a,onChange:b,extensions:o,theme:n?T.bM:"light",readOnly:h,placeholder:i,minHeight:f,onCreateEditor:m,maxHeight:g,basicSetup:{lineNumbers:!j,foldGutter:!j,highlightActiveLine:!j,autocompletion:!0,bracketMatching:!0,closeBrackets:!0}})}var Z=c(86385);let $={filter:"",project:"",sort:"",collation:"",skip:0,limit:20},_=a=>!a.trim()||"{}"===a.trim(),aa=(a,b,c)=>`ma-hist:${a}:${b}:${c}`;function ab(a,b,c){try{return JSON.parse(localStorage.getItem(aa(a,b,c))??"[]")}catch{return[]}}function ac({value:a,onRun:b,onExplain:c,scope:e}){let[f,g]=(0,l.useState)(a),[h,i]=(0,l.useState)(!!(a.project||a.sort||a.collation||a.skip)),[j,m]=(0,l.useState)(!1),n=(a,b)=>g(c=>({...c,[a]:b})),o=(0,l.useCallback)(()=>b(f),[f,b]),p=JSON.stringify(f)!==JSON.stringify(a);return(0,d.jsxs)("div",{className:"border-b bg-bg px-3 py-2",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5 @[720px]:flex-nowrap",children:[(0,d.jsx)("button",{onClick:()=>m(!0),className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-bg-muted hover:text-fg",title:"Query history & favourites",children:(0,d.jsx)(M.A,{className:"h-4 w-4"})}),(0,d.jsxs)("div",{className:"flex h-8 min-w-0 flex-1 basis-[calc(100%-2.5rem)] items-stretch overflow-hidden rounded-md border border-border-strong bg-panel transition-shadow focus-within:border-accent focus-within:ring-2 focus-within:ring-accent/15 @[720px]:basis-0",children:[(0,d.jsx)("span",{className:"flex select-none items-center border-r bg-bg-subtle px-2.5 text-[10.5px] font-semibold uppercase tracking-wide text-fg-subtle",children:"Filter"}),(0,d.jsx)(Y,{className:"ma-oneline min-w-0 flex-1",value:f.filter,onChange:a=>n("filter",a),onRun:o,oneLine:!0,placeholder:"{ field: 'value' } \xb7 Enter to run"})]}),(0,d.jsxs)("div",{className:"ml-auto flex shrink-0 items-center gap-1.5 pl-[38px] @[720px]:pl-0",children:[(0,d.jsxs)(B.$,{size:"md",variant:"ghost",onClick:()=>i(a=>!a),children:["Options ",h?(0,d.jsx)(N.A,{className:"h-3 w-3"}):(0,d.jsx)(O.A,{className:"h-3 w-3"})]}),c&&(0,d.jsx)(B.$,{size:"md",onClick:()=>c(f),children:"Explain"}),(0,d.jsx)(B.$,{size:"md",onClick:()=>b({...a,filter:"",project:"",sort:"",collation:"",skip:0}),children:"Reset"}),(0,d.jsx)(B.$,{size:"md",variant:"primary",className:(0,k.cn)("px-4",p&&"ring-2 ring-accent/30"),onClick:o,children:"Find"})]})]}),h&&(0,d.jsxs)("div",{className:"mt-1.5 grid grid-cols-2 gap-1.5 pl-[38px] @[900px]:grid-cols-[minmax(0,1.3fr)_minmax(0,1fr)_minmax(0,1fr)_100px_100px]",children:[(0,d.jsx)(ad,{label:"Project",children:(0,d.jsx)(Y,{value:f.project,onChange:a=>n("project",a),onRun:o,oneLine:!0,placeholder:"{ field: 1 }"})}),(0,d.jsx)(ad,{label:"Sort",children:(0,d.jsx)(Y,{value:f.sort,onChange:a=>n("sort",a),onRun:o,oneLine:!0,placeholder:"{ field: -1 }"})}),(0,d.jsx)(ad,{label:"Collation",children:(0,d.jsx)(Y,{value:f.collation,onChange:a=>n("collation",a),onRun:o,oneLine:!0,placeholder:"{ locale: 'en' }"})}),(0,d.jsx)(ad,{label:"Skip",children:(0,d.jsx)("input",{className:"h-full w-full bg-transparent px-2 font-mono text-[12px] outline-none",inputMode:"numeric",value:f.skip||"",placeholder:"0",onChange:a=>n("skip",Number(a.target.value.replace(/\D/g,""))||0),onKeyDown:a=>"Enter"===a.key&&o()})}),(0,d.jsx)(ad,{label:"Limit",children:(0,d.jsx)("input",{className:"h-full w-full bg-transparent px-2 font-mono text-[12px] outline-none",inputMode:"numeric",value:f.limit,onChange:a=>n("limit",Math.min(Number(a.target.value.replace(/\D/g,""))||20,1e3)),onKeyDown:a=>"Enter"===a.key&&o()})})]}),(0,d.jsx)(ae,{open:j,onClose:()=>m(!1),scope:e,current:f,onPick:c=>{m(!1),b({...a,...c,skip:0})}})]})}function ad({label:a,children:b}){return(0,d.jsxs)("div",{className:"flex h-8 min-w-0 items-stretch overflow-hidden rounded-md border border-border-strong bg-panel transition-shadow focus-within:border-accent focus-within:ring-2 focus-within:ring-accent/15",children:[(0,d.jsx)("span",{className:"flex select-none items-center border-r bg-bg-subtle px-2.5 text-[10.5px] font-semibold uppercase tracking-wide text-fg-subtle",children:a}),(0,d.jsx)("div",{className:"ma-oneline min-w-0 flex-1",children:b})]})}function ae({open:a,onClose:b,scope:c,current:e,onPick:f}){let[g,h]=(0,l.useState)([]),[i,j]=(0,l.useState)(""),k=g.filter(a=>a.fav),m=g.filter(a=>!a.fav),n=({h:a})=>(0,d.jsxs)("button",{onClick:()=>f(a),className:"block w-full rounded border px-3 py-2 text-left font-mono text-[11px] hover:border-accent",children:[a.fav&&(0,d.jsx)("p",{className:"mb-1 font-sans text-xs font-semibold",children:a.fav}),a.filter&&(0,d.jsxs)("p",{children:[(0,d.jsx)("span",{className:"text-fg-subtle",children:"filter "}),a.filter]}),a.sort&&(0,d.jsxs)("p",{children:[(0,d.jsx)("span",{className:"text-fg-subtle",children:"sort "}),a.sort]}),a.project&&(0,d.jsxs)("p",{children:[(0,d.jsx)("span",{className:"text-fg-subtle",children:"project "}),a.project]}),(0,d.jsx)("p",{className:"mt-1 font-sans text-[10px] text-fg-subtle",children:new Date(a.at).toLocaleString()})]});return(0,d.jsxs)(C.l,{open:a,onClose:b,title:"Queries",width:"max-w-xl",children:[(0,d.jsxs)("div",{className:"mb-4 flex gap-2",children:[(0,d.jsx)(J.pd,{placeholder:"Save current query as…",value:i,onChange:a=>j(a.target.value)}),(0,d.jsxs)(B.$,{disabled:!i,onClick:()=>{!function(a,b,c,d,e){let f=ab(a,b,c);try{localStorage.setItem(aa(a,b,c),JSON.stringify([{...d,at:Date.now(),fav:e},...f].slice(0,80)))}catch{}}(c.cid,c.db,c.coll,e,i),j(""),h(ab(c.cid,c.db,c.coll))},children:[(0,d.jsx)(P.A,{className:"h-3.5 w-3.5"}),"Save"]})]}),k.length>0&&(0,d.jsx)("h3",{className:"mb-2 text-xs font-semibold",children:"Favourites"}),(0,d.jsx)("div",{className:"mb-4 space-y-1.5",children:k.map((a,b)=>(0,d.jsx)(n,{h:a},`f${b}`))}),(0,d.jsx)("h3",{className:"mb-2 text-xs font-semibold",children:"Recent"}),(0,d.jsx)("div",{className:"space-y-1.5",children:m.length?m.map((a,b)=>(0,d.jsx)(n,{h:a},b)):(0,d.jsx)("p",{className:"text-xs text-fg-muted",children:"No queries yet."})})]})}var af=c(59715),ag=c(86737),ah=c(14681),ai=c(53562),aj=c(4439);let ak=(0,l.memo)(function({doc:a,partial:b=!1,scope:c,canEdit:e,mode:f,onChanged:h,onClone:i}){let[m,n]=(0,l.useState)(null),[o,p]=(0,l.useState)(!1),q=m??a,[r,t]=(0,l.useState)(!1),[u,v]=(0,l.useState)(""),[y,z]=(0,l.useState)(null),[A,C]=(0,l.useState)(!1),[E,F]=(0,l.useState)(!1),G=(0,af.YL)(),[J,K]=(0,l.useState)({mode:"expand",n:0}),L=J.n>G.n?J:G,M=(0,g.wV)(c.cid,c.db,c.coll);async function N(){C(!0),z(null);try{await (0,g.FH)(`${M}/docs`,{method:"PUT",ejson:!0,body:{_id:q._id,text:u}}),H.oR.success("Document updated"),t(!1),h()}catch(a){z(a)}finally{C(!1)}}async function O(){C(!0);try{await (0,g.FH)(`${M}/docs`,{method:"DELETE",ejson:!0,body:{_id:q._id}}),H.oR.success("Document deleted"),h()}catch(a){z(a),F(!1)}finally{C(!1)}}async function P(){if(!b||m)return q;p(!0);try{let b=await (0,g.FH)(`${M}/docs`,{query:{id:I.On.stringify({id:a._id},{relaxed:!1})}});return n(b.doc),b.doc}finally{p(!1)}}let Q=a=>()=>{P().then(a,a=>H.oR.error(a instanceof Error?a.message:"Could not load the document"))};return(0,d.jsxs)("div",{className:(0,k.cn)("group relative rounded-md border bg-panel transition-shadow hover:shadow-[0_1px_4px_rgba(0,0,0,0.06)]",r&&"border-accent ring-2 ring-accent/20",E&&"border-danger"),children:[!r&&!E&&(0,d.jsxs)("div",{className:"absolute right-1.5 top-1.5 z-10 hidden gap-0.5 rounded-md border bg-panel p-0.5 shadow-sm group-hover:flex",children:[e&&(0,d.jsx)(al,{title:"Edit",onClick:Q(a=>{v((0,D.aB)(a)),t(!0)}),children:(0,d.jsx)(ag.A,{className:"h-3.5 w-3.5"})}),"json"===f&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(al,{title:"Expand all",onClick:()=>K({mode:"expand",n:Date.now()}),children:(0,d.jsx)(w.A,{className:"h-3.5 w-3.5"})}),(0,d.jsx)(al,{title:"Collapse all",onClick:()=>K({mode:"collapse",n:Date.now()}),children:(0,d.jsx)(x.A,{className:"h-3.5 w-3.5"})}),(0,d.jsx)("span",{className:"mx-0.5 w-px self-stretch bg-border"})]}),(0,d.jsx)(al,{title:"Copy",onClick:Q(a=>{navigator.clipboard.writeText((0,D.aB)(a)),H.oR.success("Copied")}),children:(0,d.jsx)(ah.A,{className:"h-3.5 w-3.5"})}),e&&(0,d.jsx)(al,{title:"Clone",onClick:Q(a=>{let{_id:b,...c}=a;i((0,D.aB)(c))}),children:(0,d.jsx)(ai.A,{className:"h-3.5 w-3.5"})}),e&&(0,d.jsx)(al,{title:"Delete",danger:!0,onClick:()=>F(!0),children:(0,d.jsx)(s.A,{className:"h-3.5 w-3.5"})})]}),b&&!m&&!r&&(0,d.jsxs)("div",{className:"flex items-center gap-2 border-b bg-bg-subtle px-3 py-1 text-[11px] text-fg-muted",children:[(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate",children:"Large document: long arrays and texts are shortened here."}),(0,d.jsx)("button",{onClick:Q(()=>{}),disabled:o,className:"shrink-0 font-medium text-accent hover:underline disabled:opacity-50",children:o?"Loading…":"Load full"})]}),(0,d.jsx)("div",{className:"py-1.5 pl-2 pr-3",children:r?(0,d.jsx)(Y,{value:u,onChange:v,onRun:N,minHeight:"120px",maxHeight:"60vh"}):"json"===f?(0,d.jsx)("div",{className:"scrollbar-thin overflow-auto py-0.5 pl-1",children:(0,d.jsx)(af.xn,{command:L,children:(0,d.jsx)(af.UU,{value:q})})}):(0,d.jsx)(aj.i,{value:q})}),(r||E||!!y)&&(0,d.jsxs)("div",{className:(0,k.cn)("flex items-center gap-2 border-t px-3 py-2",E?"bg-danger-soft":"bg-bg-subtle"),children:[(0,d.jsx)("div",{className:"min-w-0 flex-1",children:y?(0,d.jsx)(j.aV,{error:y}):E?(0,d.jsx)("span",{className:"text-xs font-medium text-danger",children:"Delete this document?"}):(0,d.jsx)("span",{className:"text-[11px] text-fg-muted",children:"Cmd/Ctrl+Enter to save \xb7 types are kept (Int32, Long, Date…)"})}),r&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(B.$,{onClick:()=>{t(!1),z(null)},children:"Cancel"}),(0,d.jsx)(B.$,{variant:"primary",loading:A,onClick:N,children:"Update"})]}),E&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(B.$,{onClick:()=>F(!1),children:"Cancel"}),(0,d.jsx)(B.$,{variant:"danger",loading:A,onClick:O,children:"Delete"})]}),!r&&!E&&null!=y&&(0,d.jsx)(B.$,{onClick:()=>z(null),children:"Dismiss"})]})]})});function al({children:a,title:b,onClick:c,danger:e}){return(0,d.jsx)("button",{title:b,onClick:c,className:(0,k.cn)("rounded p-1 text-fg-muted hover:bg-bg-muted",e?"hover:text-danger":"hover:text-fg"),children:a})}var am=c(60853),an=c(43563),ao=c(90386),ap=c(23312),aq=c(54794);function ar({peek:a}){var b,c;let e=(0,D.I)(a.value),f=(0,D.u_)(a.value),g=a.rect.top-90>8,h=Math.max(8,Math.min(a.rect.left,window.innerWidth-420-8)),i=g?{bottom:window.innerHeight-a.rect.top+6,left:h,maxWidth:420,maxHeight:a.rect.top-14}:{top:a.rect.bottom+6,left:h,maxWidth:420};return(0,ap.createPortal)((0,d.jsxs)("div",{style:i,className:"pointer-events-none fixed z-[60] min-w-[160px] rounded-lg border bg-panel shadow-xl ma-pop",children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5 border-b bg-bg-subtle px-2.5 py-1 text-[11px]",children:[(0,d.jsx)("span",{className:"truncate font-semibold",children:a.field}),(0,d.jsx)("span",{className:"text-fg-subtle",children:e})]}),(0,d.jsx)("div",{className:"max-h-[200px] overflow-hidden px-2.5 py-1.5 font-mono text-[12px] leading-[18px]",children:f?(0,d.jsx)("pre",{className:"whitespace-pre-wrap break-all",children:(0,d.jsx)(aq.d,{text:as((0,D.aB)(a.value))})}):(0,d.jsx)("span",{className:(0,k.cn)("whitespace-pre-wrap break-all",D.sq[e]??"text-fg"),children:as((b=a.value,"String"===(c=e)?JSON.stringify(b):"Date"===c?Number.isNaN(b.getTime())?"Invalid Date":b.toISOString():"ObjectId"===c?`ObjectId('${b.toHexString()}')`:(0,D.aB)(b)))})})]}),document.body)}let as=a=>a.length>2e3?`${a.slice(0,2e3)}…`:a,at=["Int32","Double","Long","Decimal128"];function au({docs:a,onOpen:b,storageKey:c}){let[e,f]=(0,l.useState)(()=>{try{return c?JSON.parse(localStorage.getItem(c)??"{}"):{}}catch{return{}}}),g=a=>{f(b=>{let d=a(b);try{c&&localStorage.setItem(c,JSON.stringify(d))}catch{}return d})},h=(0,l.useMemo)(()=>{let b=["_id"],c=new Map;for(let d of a)for(let[a,e]of Object.entries(d)){c.has(a)||(c.set(a,new Map),"_id"!==a&&b.push(a));let d=c.get(a),f=(0,D.I)(e);d.set(f,(d.get(f)??0)+1)}return b.map(a=>{let b=[...(c.get(a)??new Map).entries()].sort((a,b)=>b[1]-a[1]);return{name:a,type:b.length>1?"Mixed":b[0]?.[0]??"—",numeric:1===b.length&&at.includes(b[0][0])}})},[a]),[i,j]=(0,l.useState)(null),[n,o]=(0,l.useState)({mode:"expand",n:0}),[p,q]=(0,l.useState)(()=>{try{return"raw"===localStorage.getItem("ma-panel-mode")?"raw":"tree"}catch{return"tree"}}),r={ObjectId:210,UUID:290,Date:200,Timestamp:200,Int32:100,Double:110,Long:130,Decimal128:130,Boolean:90},s=(0,l.useMemo)(()=>new Map(h.map(a=>[a.name,a.type])),[h]),t=a=>(void 0!==e[a]?Math.max(72,e[a]):void 0)??r[s.get(a)??""]??160,u=40+h.reduce((a,b)=>a+t(b.name),0),v=function(){let[a,b]=(0,l.useState)(null),c=(0,l.useRef)(null),e=(0,l.useCallback)(()=>{c.current&&clearTimeout(c.current),c.current=null,b(null)},[]);return{bind:(0,l.useCallback)((a,d)=>({onMouseEnter:e=>{let f=e.currentTarget;c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{f.scrollWidth>f.clientWidth+1&&b({field:a,value:d,rect:f.getBoundingClientRect()})},350)},onMouseLeave:e}),[e]),node:a?(0,d.jsx)(ar,{peek:a}):null,clear:e}}(),y=(0,l.useRef)(null),[A,B]=(0,l.useState)(()=>{try{return Math.max(360,Number(localStorage.getItem("ma-panel-w"))||360)}catch{return 360}}),C=a=>{B(a);try{localStorage.setItem("ma-panel-w",String(a))}catch{}},E=(0,l.useRef)(null),F=(0,m.Te)({count:a.length,getScrollElement:()=>E.current,estimateSize:()=>28,overscan:20}),G=F.getVirtualItems(),I=h.length>30,J=(0,m.Te)({horizontal:!0,count:h.length,getScrollElement:()=>E.current,estimateSize:a=>t(h[a].name),paddingStart:40,overscan:4,enabled:I}).getVirtualItems(),K=I&&J.length?J[0].index:0,L=I&&J.length?J.at(-1).index:h.length-1;return(0,d.jsxs)("div",{ref:y,className:"flex h-full min-w-0",children:[(0,d.jsxs)("div",{ref:E,className:"scrollbar-thin h-full min-w-0 flex-1 overflow-auto bg-panel",children:[(0,d.jsxs)("table",{className:"min-w-full table-fixed border-separate border-spacing-0 text-[12px]",style:{width:u},children:[(0,d.jsxs)("colgroup",{children:[(0,d.jsx)("col",{style:{width:40}}),h.map((a,b)=>(0,d.jsx)("col",{style:{width:b===h.length-1?void 0:t(a.name)}},a.name))]}),(0,d.jsx)("thead",{className:"sticky top-0 z-10",children:(0,d.jsxs)("tr",{className:"bg-bg-subtle",children:[(0,d.jsx)("th",{className:"group/reset sticky left-0 z-30 h-8 w-10 border-b border-r bg-bg-subtle px-0 text-[10.5px] font-medium text-fg-subtle",children:Object.keys(e).length>0?(0,d.jsxs)("button",{onClick:()=>g(()=>({})),title:"Reset all column widths",className:"flex h-full w-full items-center justify-center hover:text-accent",children:[(0,d.jsx)("span",{className:"group-hover/reset:hidden",children:"#"}),(0,d.jsx)(am.A,{className:"hidden h-3.5 w-3.5 group-hover/reset:block"})]}):(0,d.jsx)("span",{className:"block pr-2 text-right",children:"#"})}),h.map(a=>(0,d.jsxs)("th",{className:"relative h-8 border-b border-r px-3 text-left font-normal",children:[(0,d.jsxs)("span",{className:"flex h-[18px] flex-wrap items-baseline gap-x-1.5 overflow-hidden leading-[18px]",title:`${a.name} \xb7 ${a.type}`,children:[(0,d.jsx)("span",{className:"max-w-full truncate text-[12px] font-semibold text-fg",children:a.name}),(0,d.jsx)("span",{className:"whitespace-nowrap text-[10px] font-medium text-fg-subtle",children:a.type})]}),(0,d.jsx)("span",{role:"separator","aria-orientation":"vertical",title:"Drag to resize \xb7 double-click to reset",onPointerDown:b=>(function(a,b){a.preventDefault(),a.stopPropagation();let c=a.currentTarget.parentElement,d=c.closest("table"),e=d.querySelectorAll("col")[c.cellIndex],f=a.clientX,h=c.getBoundingClientRect().width,i=d.getBoundingClientRect().width,j=h,k=0,l=a=>{j=Math.max(72,Math.round(h+a.clientX-f)),k||(k=requestAnimationFrame(()=>{k=0,e&&(e.style.width=`${j}px`),d.style.width=`${i+j-h}px`}))},m=()=>{window.removeEventListener("pointermove",l),window.removeEventListener("pointerup",m),cancelAnimationFrame(k),document.body.style.cursor="",document.body.style.userSelect="",g(a=>({...a,[b]:j}))};document.body.style.cursor="col-resize",document.body.style.userSelect="none",window.addEventListener("pointermove",l),window.addEventListener("pointerup",m)})(b,a.name),onDoubleClick:()=>{let b;return b=a.name,g(a=>{let c={...a};return delete c[b],c})},className:"absolute -right-[5px] top-0 z-20 h-full w-[10px] cursor-col-resize after:absolute after:left-[4px] after:top-1.5 after:h-[calc(100%-12px)] after:w-px after:bg-transparent hover:after:w-[2px] hover:after:bg-accent"})]},a.name))]})}),(0,d.jsxs)("tbody",{className:"font-mono",children:[G.length>0&&(0,d.jsx)("tr",{style:{height:G[0].start}}),G.map(c=>{let e=a[c.index];return(0,d.jsxs)("tr",{className:"group h-7 cursor-default",onDoubleClick:()=>b(e),children:[(0,d.jsx)("td",{className:"sticky left-0 border-b border-r bg-panel px-2 text-right text-[11px] text-fg-subtle group-hover:bg-bg-muted",children:c.index+1}),K>0&&(0,d.jsx)("td",{colSpan:K,className:"border-b"}),h.slice(K,L+1).map(a=>{let b=a.name in e,f=e[a.name],g=b?(0,D.I)(f):null;return(0,d.jsx)("td",{...g?v.bind(a.name,f):{},onClick:g?()=>{v.clear(),o({mode:"expand",n:Date.now()}),j({row:c.index,field:a.name,value:f})}:void 0,className:(0,k.cn)("truncate overflow-hidden border-b px-3",g&&"cursor-pointer",i?.row===c.index&&i.field===a.name?"bg-accent-soft shadow-[inset_0_0_0_1.5px_var(--accent)]":"group-hover:bg-bg-muted hover:!bg-accent-soft/60",a.numeric&&"tabular-nums",g?"ObjectId"===g||"Array"===g||"Object"===g?"text-fg-muted":D.sq[g]:""),children:g?(0,D.u_)(f)?(0,D.CM)(f,400):"ObjectId"===g?f.toHexString():(0,D.VH)(f):(0,d.jsx)("span",{className:"text-border-strong",children:"\xb7"})},a.name)}),L<h.length-1&&(0,d.jsx)("td",{colSpan:h.length-1-L,className:"border-b"})]},c.key)}),G.length>0&&(0,d.jsx)("tr",{style:{height:F.getTotalSize()-G.at(-1).end}})]})]}),v.node]}),i&&(0,d.jsxs)("aside",{style:{width:A},className:"relative flex shrink-0 flex-col border-l bg-panel",children:[(0,d.jsx)("span",{role:"separator","aria-orientation":"vertical",title:"Drag to resize \xb7 double-click to reset",onPointerDown:function(a){a.preventDefault();let b=a.clientX,c=Math.max(360,(y.current?.clientWidth??1200)*.75),d=a.currentTarget.parentElement,e=A,f=0,g=a=>{e=Math.round(Math.min(c,Math.max(360,A+(b-a.clientX)))),f||(f=requestAnimationFrame(()=>{f=0,d.style.width=`${e}px`}))},h=()=>{window.removeEventListener("pointermove",g),window.removeEventListener("pointerup",h),cancelAnimationFrame(f),document.body.style.cursor="",document.body.style.userSelect="",C(e)};document.body.style.cursor="col-resize",document.body.style.userSelect="none",window.addEventListener("pointermove",g),window.addEventListener("pointerup",h)},onDoubleClick:()=>C(360),className:"absolute -left-[5px] top-0 z-20 h-full w-[10px] cursor-col-resize after:absolute after:left-[4px] after:top-0 after:h-full after:w-[2px] after:bg-transparent hover:after:bg-accent"}),(0,d.jsxs)("div",{className:"flex h-10 items-center gap-1 border-b bg-bg-subtle px-3",children:[(0,d.jsxs)("span",{className:"min-w-0 flex-1 truncate text-[12px]",children:[(0,d.jsxs)("span",{className:"text-fg-subtle",children:["Row ",i.row+1," › "]}),(0,d.jsx)("b",{className:"font-mono",children:i.field}),(0,d.jsx)("span",{className:"ml-1.5 text-[11px] text-fg-subtle",children:(0,D.I)(i.value)})]}),(0,D.u_)(i.value)&&(0,d.jsx)("div",{className:"flex items-center rounded-md bg-bg-muted p-0.5",children:[["tree","Tree view",(0,d.jsx)(an.A,{className:"h-3.5 w-3.5"},"t")],["raw","Raw JSON",(0,d.jsx)(z.A,{className:"h-3.5 w-3.5"},"r")]].map(([a,b,c])=>(0,d.jsx)("button",{title:b,"aria-label":b,onClick:()=>(a=>{q(a);try{localStorage.setItem("ma-panel-mode",a)}catch{}})(a),className:(0,k.cn)("flex h-6 w-6 items-center justify-center rounded transition-colors",p===a?"bg-panel text-fg shadow-sm":"text-fg-subtle hover:text-fg"),children:c},a))}),"raw"===p&&(0,D.u_)(i.value)&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("button",{title:"Expand all",onClick:()=>o({mode:"expand",n:Date.now()}),className:"flex h-6 w-6 items-center justify-center rounded text-fg-muted hover:bg-bg-muted hover:text-fg",children:(0,d.jsx)(w.A,{className:"h-3.5 w-3.5"})}),(0,d.jsx)("button",{title:"Collapse all",onClick:()=>o({mode:"collapse",n:Date.now()}),className:"flex h-6 w-6 items-center justify-center rounded text-fg-muted hover:bg-bg-muted hover:text-fg",children:(0,d.jsx)(x.A,{className:"h-3.5 w-3.5"})})]}),(0,d.jsx)("button",{title:"Copy value",onClick:()=>{navigator.clipboard.writeText((0,D.aB)(i.value)),H.oR.success("Copied")},className:"flex h-6 w-6 items-center justify-center rounded text-fg-muted hover:bg-bg-muted hover:text-fg",children:(0,d.jsx)(ah.A,{className:"h-3.5 w-3.5"})}),(0,d.jsx)("button",{title:"Close",onClick:()=>j(null),className:"flex h-6 w-6 items-center justify-center rounded text-fg-muted hover:bg-bg-muted hover:text-fg",children:(0,d.jsx)(ao.A,{className:"h-3.5 w-3.5"})})]}),(0,d.jsx)("div",{className:"scrollbar-thin flex-1 overflow-auto p-3",children:(0,D.u_)(i.value)?"tree"===p?(0,d.jsx)(aj.i,{value:i.value,expandAll:!0}):(0,d.jsx)(af.xn,{command:n,children:(0,d.jsx)(af.UU,{value:i.value,collapseRoot:!0})}):(0,d.jsx)("div",{className:(0,k.cn)("whitespace-pre-wrap break-all font-mono text-[13px] leading-5",D.sq[(0,D.I)(i.value)]??"text-fg"),children:"String"===(0,D.I)(i.value)?JSON.stringify(i.value):(0,D.aB)(i.value)})})]})]})}let av=[{label:"ObjectId()",text:"ObjectId()"},{label:"ISODate()",text:"ISODate()"},{label:"NumberLong()",text:"NumberLong('0')"},{label:"NumberDecimal()",text:"NumberDecimal('0.00')"},{label:"UUID()",text:"UUID()"}];function aw({scope:a,initial:b,onClose:c,onDone:e}){let[f,h]=(0,l.useState)(b),[i,m]=(0,l.useState)(null),[n,o]=(0,l.useState)(!1),p=(0,l.useRef)(null),q=f.trim().startsWith("[");async function r(){o(!0),m(null);try{let b=await (0,g.FH)(`${(0,g.wV)(a.cid,a.db,a.coll)}/docs`,{body:{text:f}});H.oR.success(`Inserted ${(0,k.bu)(b.insertedCount)} document(s)`),e(),c()}catch(a){m(a)}finally{o(!1)}}return(0,d.jsxs)(C.l,{open:!0,onClose:c,width:"max-w-2xl",title:(0,d.jsxs)("span",{className:"flex items-center gap-2",children:["Insert ",q?"documents":"document",(0,d.jsxs)("span",{className:"rounded bg-bg-muted px-1.5 py-0.5 font-mono text-[11px] font-normal text-fg-muted",children:[a.db,".",a.coll]})]}),footer:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("span",{className:"mr-auto flex items-center gap-1 text-[11px] text-fg-subtle",children:[(0,d.jsx)("kbd",{className:"rounded border bg-bg-subtle px-1 font-sans",children:"⌘"}),(0,d.jsx)("kbd",{className:"rounded border bg-bg-subtle px-1 font-sans",children:"Enter"})," to insert"]}),(0,d.jsx)(B.$,{onClick:c,children:"Cancel"}),(0,d.jsx)(B.$,{variant:"primary",loading:n,onClick:r,children:"Insert"})]}),children:[(0,d.jsxs)("div",{className:"mb-2 flex flex-wrap items-center gap-1.5",children:[(0,d.jsx)("span",{className:"mr-0.5 text-[11px] text-fg-muted",title:"Type one document { } or an array [{ }, { }] to insert many",children:"Insert type"}),av.map(a=>(0,d.jsx)("button",{type:"button",onClick:()=>(function(a){let b=p.current;b&&(b.dispatch(b.state.replaceSelection(a)),b.focus())})(a.text),className:"rounded border bg-bg-subtle px-1.5 py-0.5 font-mono text-[10.5px] text-fg-muted transition-colors hover:border-accent hover:text-accent",children:a.label},a.label))]}),(0,d.jsx)("div",{className:"ma-editor overflow-hidden rounded-md border border-border-strong focus-within:border-accent focus-within:ring-2 focus-within:ring-accent/15",children:(0,d.jsx)(Y,{value:f,onChange:h,onRun:r,minHeight:"260px",maxHeight:"55vh",onReady:a=>{p.current=a;let b=a.state.doc.toString(),c=b.match(/^\{\n(\s*)\n\}$/),d=c?2+c[1].length:Math.max(0,b.lastIndexOf("}")-1);a.dispatch({selection:{anchor:d}}),a.focus()}})}),null!=i&&(0,d.jsx)("div",{className:"mt-3",children:(0,d.jsx)(j.aV,{error:i})})]})}function ax({scope:a,op:b,filter:c,onClose:e,onDone:f}){let[h,i]=(0,l.useState)(c||"{}"),[m,n]=(0,l.useState)("{ $set: { } }"),[o,p]=(0,l.useState)(null),[q,r]=(0,l.useState)(null),[s,t]=(0,l.useState)(!1),[u,v]=(0,l.useState)(""),w=(0,g.wV)(a.cid,a.db,a.coll),x="delete"===b||(o?.matched??0)>1e3;async function y(){t(!0);try{let a=await (0,g.FH)(`${w}/bulk`,{body:{op:b,filter:h,update:m,dryRun:!1}});H.oR.success("delete"===b?`Deleted ${(0,k.bu)(a.deleted)} document(s)`:`Updated ${(0,k.bu)(a.modified)} of ${(0,k.bu)(a.matched)} matched`),f(),e()}catch(a){r(a)}finally{t(!1)}}return(0,d.jsx)(C.l,{open:!0,onClose:e,width:"max-w-2xl",title:"delete"===b?"Delete documents":"Update documents",footer:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(B.$,{onClick:e,children:"Cancel"}),(0,d.jsx)(B.$,{variant:"delete"===b?"danger":"primary",loading:s,disabled:!o||0===o.matched||x&&u!==String(o.matched),onClick:y,children:"delete"===b?`Delete ${o?(0,k.ZV)(o.matched):""} documents`:`Update ${o?(0,k.ZV)(o.matched):""} documents`})]}),children:(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"mb-1 text-xs font-medium text-fg-muted",children:"Filter"}),(0,d.jsx)("div",{className:"rounded-md border",children:(0,d.jsx)(Y,{value:h,onChange:i,minHeight:"40px"})})]}),"update"===b&&(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"mb-1 text-xs font-medium text-fg-muted",children:"Update (operators like $set, $unset, $inc, or a pipeline)"}),(0,d.jsx)("div",{className:"rounded-md border",children:(0,d.jsx)(Y,{value:m,onChange:n,minHeight:"80px"})})]}),(0,d.jsxs)("div",{className:"rounded-md border bg-bg-subtle px-3 py-2 text-xs",children:[o?(0,d.jsxs)("b",{children:[(0,k.ZV)(o.matched)," document(s) match this filter."]}):q?null:(0,d.jsx)(j.y$,{className:"h-3.5 w-3.5"}),o?.sample?.slice(0,2).map((a,b)=>(0,d.jsx)("pre",{className:"mt-2 max-h-32 overflow-auto font-mono text-[11px] text-fg-muted",children:(0,D.aB)(a)},b))]}),x&&o&&o.matched>0&&(0,d.jsxs)("div",{className:"space-y-1 text-xs",children:[(0,d.jsxs)("p",{children:["Type ",(0,d.jsx)("b",{children:o.matched})," to confirm:"]}),(0,d.jsx)(J.pd,{value:u,onChange:a=>v(a.target.value)})]}),(0,d.jsx)(j.aV,{error:q})]})})}function ay({cid:a,db:b,coll:c,role:e,readonly:i}){let m=(0,l.useMemo)(()=>({cid:a,db:b,coll:c}),[a,b,c]),[C,D]=(0,l.useState)($),[F,G]=(0,l.useState)(0),[H,J]=(0,l.useState)("list"),[M,N]=(0,l.useState)({mode:"expand",n:0}),O=(0,l.useCallback)(a=>{J(a);try{localStorage.setItem("ma-doc-view",a)}catch{}},[]),[P,Q]=(0,l.useState)(null),[R,S]=(0,l.useState)(null),[T,U]=(0,l.useState)(null),[V,W]=(0,l.useState)(!1),[X,Y]=(0,l.useState)(!1),ad=(0,n.jE)(),[ae,ag]=(0,l.useState)(!1),{docs:ah,count:ai,skip:aj}=function(a,b,c,d,e,h=!1){let i=d.skip+e*d.limit,j=(0,g.wV)(a,b,c),l=(0,n.jE)();return{docs:(0,f.I)({queryKey:["docs",a,b,c,d,e],queryFn:()=>{let f=e>0&&_(d.filter)&&_(d.sort)?l.getQueryData(["docs",a,b,c,d,e-1]):void 0,h=f?.docs.at(-1),k=h&&void 0!==h._id?I.On.stringify({id:h._id},{relaxed:!1}):void 0;return(0,g.FH)(`${j}/find`,{query:{filter:d.filter,project:d.project,sort:d.sort,collation:d.collation,skip:i,limit:d.limit,after:k}})},placeholderData:Z.rX,staleTime:0}),count:(0,f.I)({queryKey:["count",a,b,c,d.filter,h],queryFn:async()=>{let a=await (0,g.FH)(`${j}/count`,{query:{filter:d.filter,exact:h?1:void 0}});return{count:null===a.count?null:(0,k.bu)(a.count),estimated:a.estimated,timedOut:!!a.timedOut,capped:!!a.capped}},placeholderData:Z.rX,staleTime:1e4}),skip:i}}(a,b,c,C,F,ae),al=(0,h.$3)(e,"editor")&&!i,am=(0,l.useCallback)(d=>{let e=JSON.stringify(d)===JSON.stringify(C)&&0===F;D(d),G(0),function(a,b,c,d){if(!d.filter&&!d.project&&!d.sort)return;let e={filter:d.filter,project:d.project,sort:d.sort,collation:d.collation,at:Date.now()},f=ab(a,b,c).filter(a=>a.fav||a.filter!==e.filter||a.sort!==e.sort||a.project!==e.project);try{localStorage.setItem(aa(a,b,c),JSON.stringify([e,...f].slice(0,50)))}catch{}}(a,b,c,d),e&&ad.invalidateQueries({queryKey:["docs",a,b,c,d,0]})},[a,b,c,ad,C,F]),an=(0,l.useCallback)(a=>Q(a),[]),ao=(0,l.useCallback)(()=>{ad.invalidateQueries({queryKey:["docs",a,b,c]}),ad.invalidateQueries({queryKey:["count",a,b,c]}),ad.invalidateQueries({queryKey:["collstats",a,b,c]})},[a,b,c,ad]),ap=ah.data?.docs??[],aq=(0,l.useMemo)(()=>new Set(ah.data?.partial??[]),[ah.data]),ar=ai.data?.count??null,as=ap.length?aj+1:0,at=aj+ap.length,av=!!ai.data?.capped,ay=null===ar||av?ap.length===C.limit:at<ar;return(0,d.jsxs)("div",{className:"@container flex min-h-0 flex-1 flex-col",children:[(0,d.jsx)(ac,{value:C,onRun:am,onExplain:U,scope:m}),(0,d.jsxs)("div",{className:"ma-scroll-x flex h-10 shrink-0 items-center gap-1.5 overflow-x-auto overflow-y-hidden border-b bg-bg px-3 [&>*]:shrink-0",children:[al&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(B.$,{variant:"primary",title:"Add data",onClick:()=>Q("{\n \n}"),children:[(0,d.jsx)(o.A,{className:"h-3.5 w-3.5"}),(0,d.jsx)("span",{className:"hidden @[760px]:inline",children:"Add data"})]}),(0,d.jsxs)(B.$,{title:"Import",onClick:()=>Y(!0),children:[(0,d.jsx)(p.A,{className:"h-3.5 w-3.5"}),(0,d.jsx)("span",{className:"hidden @[760px]:inline",children:"Import"})]})]}),(0,d.jsxs)(B.$,{title:"Export",onClick:()=>W(!0),children:[(0,d.jsx)(q.A,{className:"h-3.5 w-3.5"}),(0,d.jsx)("span",{className:"hidden @[760px]:inline",children:"Export"})]}),al&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(B.$,{title:"Update many",onClick:()=>S("update"),children:[(0,d.jsx)(r.A,{className:"h-3.5 w-3.5"}),(0,d.jsx)("span",{className:"hidden @[760px]:inline",children:"Update"})]}),(0,d.jsxs)(B.$,{variant:"danger-outline",title:"Delete many",onClick:()=>S("delete"),children:[(0,d.jsx)(s.A,{className:"h-3.5 w-3.5"}),(0,d.jsx)("span",{className:"hidden @[760px]:inline",children:"Delete"})]})]}),(0,d.jsxs)("div",{className:"ml-auto flex shrink-0 items-center gap-1.5 text-xs text-fg-muted",children:[ah.data&&(0,d.jsxs)("span",{className:"hidden whitespace-nowrap text-[11px] tabular-nums text-fg-subtle @[600px]:inline",children:[(0,k.bu)(ah.data.ms)," ms"]}),(0,d.jsx)(B.$,{size:"icon",variant:"ghost",title:"Refresh",onClick:ao,children:(0,d.jsx)(t.A,{className:(0,k.cn)("h-3.5 w-3.5",ah.isFetching&&"animate-spin")})}),(0,d.jsxs)("div",{className:"flex h-7 items-center rounded-md border border-border-strong",children:[(0,d.jsxs)("span",{className:"whitespace-nowrap px-2.5 text-[12px] tabular-nums text-fg",children:[(0,k.ZV)(as),"–",(0,k.ZV)(at)," ",(0,d.jsx)("span",{className:"text-fg-subtle",children:"of"})," ",ai.isLoading?"…":null===ar?ai.data?.timedOut?"many":"?":av?(0,d.jsxs)("button",{onClick:()=>ag(!0),title:"More than 10,000 match. Click to count them all (can be slow on big collections).",className:"underline decoration-dotted underline-offset-2 hover:text-accent",children:[(0,k.ZV)(ar),"+"]}):`${ai.data?.estimated?"~":""}${(0,k.ZV)(ar)}`,ae&&ai.isFetching&&" …"]}),(0,d.jsx)("button",{disabled:0===F,onClick:()=>G(a=>a-1),title:"Previous page",className:"flex h-full w-7 items-center justify-center border-l text-fg-muted hover:bg-bg-muted disabled:opacity-40",children:(0,d.jsx)(u.A,{className:"h-4 w-4"})}),(0,d.jsx)("button",{disabled:!ay,onClick:()=>G(a=>a+1),title:"Next page",className:"flex h-full w-7 items-center justify-center border-l text-fg-muted hover:bg-bg-muted disabled:opacity-40",children:(0,d.jsx)(v.A,{className:"h-4 w-4"})})]}),"json"===H&&(0,d.jsxs)("div",{className:"flex h-7 items-center rounded-md border border-border-strong",children:[(0,d.jsx)("button",{title:"Expand all documents",onClick:()=>N({mode:"expand",n:Date.now()}),className:"flex h-full w-7 items-center justify-center text-fg-muted hover:bg-bg-muted hover:text-fg",children:(0,d.jsx)(w.A,{className:"h-3.5 w-3.5"})}),(0,d.jsx)("button",{title:"Collapse all documents",onClick:()=>N({mode:"collapse",n:Date.now()}),className:"flex h-full w-7 items-center justify-center border-l text-fg-muted hover:bg-bg-muted hover:text-fg",children:(0,d.jsx)(x.A,{className:"h-3.5 w-3.5"})})]}),(0,d.jsx)(j.I2,{value:H,onChange:O,items:[{value:"list",label:(0,d.jsx)(y.A,{className:"h-3.5 w-3.5"})},{value:"json",label:(0,d.jsx)(z.A,{className:"h-3.5 w-3.5"})},{value:"table",label:(0,d.jsx)(A.A,{className:"h-3.5 w-3.5"})}]})]})]}),(0,d.jsx)("div",{className:"min-h-0 flex-1 bg-bg-subtle",children:ah.error?(0,d.jsx)("div",{className:"p-4",children:(0,d.jsx)(j.aV,{error:ah.error})}):ah.isLoading?(0,d.jsx)("div",{className:"flex justify-center p-10",children:(0,d.jsx)(j.y$,{})}):0===ap.length?(0,d.jsx)(j.Sv,{title:C.filter?"No documents match this filter":"This collection has no documents",children:al&&!C.filter&&(0,d.jsxs)(B.$,{className:"mt-2",variant:"primary",onClick:()=>Q("{\n \n}"),children:[(0,d.jsx)(o.A,{className:"h-3.5 w-3.5"}),"Insert document"]})}):"table"===H?(0,d.jsx)(au,{docs:ap,onOpen:()=>O("list"),storageKey:`ma-colw:${a}:${b}:${c}`}):(0,d.jsx)(af.xn,{command:M,children:(0,d.jsx)(az,{docs:ap,render:(a,b)=>(0,d.jsx)(ak,{doc:a,partial:aq.has(b),scope:m,canEdit:al,mode:H,onChanged:ao,onClone:an})})})}),null!==P&&(0,d.jsx)(aw,{scope:m,initial:P,onClose:()=>Q(null),onDone:ao}),R&&(0,d.jsx)(ax,{scope:m,op:R,filter:C.filter,onClose:()=>S(null),onDone:ao}),T&&(0,d.jsx)(E,{scope:m,kind:"find",query:T,onClose:()=>U(null)}),V&&(0,d.jsx)(K,{scope:m,query:C,total:ar,onClose:()=>W(!1)}),X&&(0,d.jsx)(L,{scope:m,onClose:()=>Y(!1),onDone:ao})]})}function az({docs:a,render:b}){let c=(0,l.useRef)(null),e=(0,m.Te)({count:a.length,getScrollElement:()=>c.current,estimateSize:()=>150,overscan:4,gap:6});return(0,d.jsx)("div",{ref:c,className:"scrollbar-thin h-full overflow-auto px-3 py-2.5",children:(0,d.jsx)("div",{style:{height:e.getTotalSize(),position:"relative"},children:e.getVirtualItems().map(c=>(0,d.jsx)("div",{"data-index":c.index,ref:e.measureElement,style:{position:"absolute",top:0,left:0,right:0,transform:`translateY(${c.start}px)`},children:b(a[c.index],c.index)},c.key))})})}var aA=c(72009),aB=c(98141),aC=c(97657),aD=c(95864),aE=c(12893),aF=c(22738);let aG={$match:"{\n field: 'value'\n}",$project:"{\n field: 1\n}",$group:"{\n _id: '$field',\n count: { $sum: 1 }\n}",$sort:"{\n field: -1\n}",$limit:"10",$skip:"0",$unwind:"'$arrayField'",$lookup:"{\n from: 'otherCollection',\n localField: 'field',\n foreignField: '_id',\n as: 'joined'\n}",$addFields:"{\n newField: '$field'\n}",$set:"{\n newField: '$field'\n}",$unset:"'field'",$count:"'total'",$facet:"{\n byField: [{ $sortByCount: '$field' }]\n}",$bucket:"{\n groupBy: '$field',\n boundaries: [0, 10, 100],\n default: 'other'\n}",$sortByCount:"'$field'",$sample:"{\n size: 10\n}",$replaceRoot:"{\n newRoot: '$field'\n}",$geoNear:"{\n near: { type: 'Point', coordinates: [0, 0] },\n distanceField: 'dist'\n}",$out:"'outputCollection'",$merge:"{\n into: 'outputCollection'\n}"},aH={$match:"Filter documents",$project:"Pick or reshape fields",$group:"Group and aggregate",$sort:"Sort documents",$limit:"Keep the first N",$skip:"Skip the first N",$unwind:"One document per array item",$lookup:"Join another collection",$addFields:"Add computed fields",$set:"Add computed fields",$unset:"Remove fields",$count:"Count documents",$facet:"Run several pipelines at once",$bucket:"Group into ranges",$sortByCount:"Group, count and sort",$sample:"Random sample",$replaceRoot:"Promote a sub-document",$geoNear:"Sort by distance",$out:"Write results to a collection",$merge:"Merge results into a collection"},aI={mode:"collapse",n:1};function aJ({doc:a}){return(0,d.jsx)("div",{className:"rounded-md border bg-panel py-1 pl-1 pr-2",children:(0,d.jsx)(af.xn,{command:aI,children:(0,d.jsx)(af.UU,{value:a,bare:!0})})})}let aK=1,aL=(a="$match")=>({id:aK++,op:a,body:aG[a]??"{}",enabled:!0});function aM(a,b){return`[
|
|
6
|
+
${a.filter((a,c)=>a.enabled&&(void 0===b||c<=b)).map(a=>` { ${a.op}: ${a.body.replace(/\n/g,"\n ")} }`).join(",\n")}
|
|
7
|
+
]`}function aN({cid:a,db:b,coll:c,role:e}){let f=`ma-pipe:${a}:${b}:${c}`,[i,m]=(0,l.useState)("builder"),[n,p]=(0,l.useState)(()=>[aL("$match")]),[q,r]=(0,l.useState)("[\n { $match: {} }\n]"),[s,t]=(0,l.useState)(null),[u,v]=(0,l.useState)(null),[w,x]=(0,l.useState)(!1),[y,z]=(0,l.useState)(!1),[A,C]=(0,l.useState)([]),D=(0,g.wV)(a,b,c),F="builder"===i?aM(n):q,G=/\$(out|merge)\b/.test(F),I=(0,l.useCallback)(async()=>{x(!0),v(null);try{let a=await (0,g.FH)(`${D}/aggregate`,{body:{pipeline:F,limit:100}});t({docs:a.docs,ms:(0,k.bu)(a.ms),wrote:a.wrote}),a.wrote&&H.oR.success("Pipeline ran and wrote its output")}catch(a){v(a)}finally{x(!1)}},[D,F]),[K,L]=(0,l.useState)(null);return(0,d.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,d.jsxs)("div",{className:"flex h-10 shrink-0 items-center gap-2 border-b px-3",children:[(0,d.jsx)("div",{className:"flex rounded-md bg-bg-muted p-0.5",children:[["builder","Stages",(0,d.jsx)(aA.A,{className:"h-3.5 w-3.5"},"s")],["text","Text",(0,d.jsx)(aB.A,{className:"h-3.5 w-3.5"},"t")]].map(([a,b,c])=>(0,d.jsxs)("button",{onClick:()=>{"text"===a&&r(aM(n)),m(a)},className:(0,k.cn)("flex h-6 items-center gap-1.5 rounded px-2.5 text-[12px] transition-colors",i===a?"bg-panel font-medium text-fg shadow-sm":"text-fg-muted hover:text-fg"),children:[c,b]},a))}),"builder"===i&&(0,d.jsxs)("span",{className:"text-[12px] text-fg-muted",children:[(0,d.jsx)("b",{className:"text-fg",children:n.length})," ",1===n.length?"stage":"stages",n.some(a=>!a.enabled)&&` \xb7 ${n.filter(a=>!a.enabled).length} disabled`]}),A.length>0&&(0,d.jsxs)(J.l6,{className:"h-7 w-48 text-xs",value:"",onChange:a=>{let b=A.find(b=>b.name===a.target.value);b&&(r(b.text),m("text"))},children:[(0,d.jsx)("option",{value:"",children:"Open saved pipeline…"}),A.map(a=>(0,d.jsx)("option",{children:a.name},a.name))]}),(0,d.jsxs)("div",{className:"ml-auto flex items-center gap-1.5",children:[(0,d.jsxs)(B.$,{onClick:()=>{navigator.clipboard.writeText(`db.getCollection(${JSON.stringify(c)}).aggregate(${F});`),H.oR.success("Copied as mongosh code")},children:[(0,d.jsx)(ah.A,{className:"h-3.5 w-3.5"}),"Export to code"]}),null===K?(0,d.jsxs)(B.$,{onClick:()=>L(""),children:[(0,d.jsx)(aC.A,{className:"h-3.5 w-3.5"}),"Save"]}):(0,d.jsxs)("form",{className:"flex gap-1",onSubmit:a=>{a.preventDefault(),function(){let a=K?.trim();if(!a)return;let b=[{name:a,text:F},...A.filter(b=>b.name!==a)];C(b);try{localStorage.setItem(f,JSON.stringify(b))}catch{}L(null),H.oR.success("Pipeline saved")}()},children:[(0,d.jsx)("input",{autoFocus:!0,value:K,onChange:a=>L(a.target.value),onKeyDown:a=>"Escape"===a.key&&L(null),placeholder:"Pipeline name",className:"h-7 w-40 rounded-md border border-border-strong bg-panel px-2 text-xs outline-none focus:border-accent"}),(0,d.jsx)(B.$,{type:"submit",variant:"primary",disabled:!K.trim(),children:"Save"})]}),(0,d.jsx)(B.$,{onClick:()=>z(!0),children:"Explain"}),(0,d.jsxs)(B.$,{variant:"primary",loading:w,onClick:I,disabled:G&&!(0,h.$3)(e,"editor"),title:G&&!(0,h.$3)(e,"editor")?"$out/$merge need the editor role":void 0,children:[(0,d.jsx)(aD.A,{className:"h-3.5 w-3.5"}),"Run"]})]})]}),(0,d.jsxs)("div",{className:"flex min-h-0 flex-1",children:[(0,d.jsx)("div",{className:"scrollbar-thin min-w-0 flex-1 overflow-auto bg-bg-subtle p-3",children:"text"===i?(0,d.jsx)("div",{className:"ma-editor overflow-hidden rounded-md border border-border-strong bg-panel focus-within:border-accent",children:(0,d.jsx)(Y,{value:q,onChange:r,onRun:I,minHeight:"300px"})}):(0,d.jsxs)("div",{className:"space-y-2.5",children:[n.map((e,f)=>(0,d.jsx)(aO,{cid:a,db:b,coll:c,stages:n,index:f,stage:e,onChange:a=>p(b=>b.map(b=>b.id===e.id?{...b,...a}:b)),onRemove:()=>p(a=>a.filter(a=>a.id!==e.id)),onMove:a=>p(b=>{let c=[...b];return[c[f],c[f+a]]=[c[f+a],c[f]],c})},e.id)),(0,d.jsxs)("button",{onClick:()=>p(a=>[...a,aL("$project")]),className:"flex h-9 w-full items-center justify-center gap-1.5 rounded-md border border-dashed border-border-strong text-[12.5px] text-fg-muted transition-colors hover:border-accent hover:bg-accent-soft/40 hover:text-accent",children:[(0,d.jsx)(o.A,{className:"h-3.5 w-3.5"}),"Add stage"]})]})}),(0,d.jsxs)("div",{className:"flex w-[40%] min-w-80 flex-col border-l bg-panel",children:[(0,d.jsxs)("div",{className:"flex h-9 shrink-0 items-center gap-2 border-b bg-bg-subtle px-3 text-[12px]",children:[(0,d.jsx)("span",{className:"font-semibold",children:"Output"}),s&&(0,d.jsxs)("span",{className:"text-fg-muted",children:[(0,d.jsx)("b",{className:"text-fg",children:s.docs.length})," ",1===s.docs.length?"document":"documents",100===s.docs.length?" (first 100)":""," \xb7 ",s.ms," ms"]})]}),(0,d.jsxs)("div",{className:"scrollbar-thin flex-1 space-y-1.5 overflow-auto bg-bg-subtle p-3",children:[(0,d.jsx)(j.aV,{error:u}),w&&(0,d.jsx)(j.y$,{}),!s&&!w&&!u&&(0,d.jsx)(j.Sv,{title:"Run the pipeline to see results",children:"Each stage also shows a live preview of its output."}),s&&0===s.docs.length&&(0,d.jsx)(j.Sv,{title:"The pipeline returned no documents"}),s?.docs.map((a,b)=>(0,d.jsx)(aJ,{doc:a},b))]})]})]}),y&&(0,d.jsx)(E,{scope:{cid:a,db:b,coll:c},kind:"aggregate",pipeline:F,onClose:()=>z(!1)})]})}function aO({cid:a,db:b,coll:c,stages:e,index:f,stage:g,onChange:h,onRemove:i,onMove:m}){let[n,o]=(0,l.useState)(null),[p,q]=(0,l.useState)(null),[r,t]=(0,l.useState)(!1);(0,l.useMemo)(()=>aM(e,f),[e,f]);let u="$out"===g.op||"$merge"===g.op;return(0,d.jsxs)("div",{className:(0,k.cn)("group overflow-hidden rounded-md border bg-panel",!g.enabled&&"opacity-55"),children:[(0,d.jsxs)("div",{className:"flex h-9 items-center gap-2 border-b px-2.5",children:[(0,d.jsx)("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-accent-soft text-[10.5px] font-semibold text-accent",children:f+1}),(0,d.jsx)("select",{value:g.op,onChange:a=>h({op:a.target.value,body:aG[a.target.value]??"{}"}),className:"h-6 cursor-pointer rounded bg-bg-muted px-1.5 font-mono text-[12px] font-semibold text-fg outline-none hover:bg-border focus:ring-2 focus:ring-accent/20",children:Object.keys(aG).map(a=>(0,d.jsx)("option",{children:a},a))}),(0,d.jsx)("span",{className:"hidden truncate text-[11px] text-fg-subtle md:inline",children:aH[g.op]??""}),(0,d.jsxs)("div",{className:"ml-auto flex items-center gap-0.5",children:[(0,d.jsxs)("div",{className:"flex gap-0.5 opacity-0 transition-opacity group-hover:opacity-100",children:[(0,d.jsx)(B.$,{size:"icon-xs",variant:"ghost",title:"Move up",onClick:()=>m(-1),disabled:0===f,children:(0,d.jsx)(aE.A,{className:"h-3 w-3"})}),(0,d.jsx)(B.$,{size:"icon-xs",variant:"ghost",title:"Move down",onClick:()=>m(1),disabled:f===e.length-1,children:(0,d.jsx)(aF.A,{className:"h-3 w-3"})}),(0,d.jsx)(B.$,{size:"icon-xs",variant:"ghost",title:"Delete stage",onClick:i,children:(0,d.jsx)(s.A,{className:"h-3 w-3"})})]}),(0,d.jsx)("label",{className:"ml-1.5 flex cursor-pointer items-center gap-1.5 text-[11px] text-fg-muted",title:g.enabled?"Disable this stage":"Enable this stage",children:(0,d.jsxs)("span",{className:(0,k.cn)("relative h-4 w-7 rounded-full transition-colors",g.enabled?"bg-accent":"bg-border-strong"),children:[(0,d.jsx)("span",{className:(0,k.cn)("absolute top-0.5 h-3 w-3 rounded-full bg-white shadow transition-all",g.enabled?"left-3.5":"left-0.5")}),(0,d.jsx)("input",{type:"checkbox",className:"sr-only",checked:g.enabled,onChange:a=>h({enabled:a.target.checked})})]})})]})]}),(0,d.jsxs)("div",{className:"grid grid-cols-2",children:[(0,d.jsx)("div",{className:"ma-editor border-r",children:(0,d.jsx)(Y,{value:g.body,onChange:a=>h({body:a}),minHeight:"120px",maxHeight:"280px"})}),(0,d.jsxs)("div",{className:"flex max-h-[280px] min-h-[120px] flex-col bg-bg-subtle",children:[(0,d.jsxs)("div",{className:"flex h-7 shrink-0 items-center gap-1.5 border-b px-2.5 text-[11px] text-fg-muted",children:[(0,d.jsx)("span",{className:"font-medium text-fg",children:"Output"}),n&&!u&&(0,d.jsxs)("span",{children:["\xb7 ",n.docs.length," ",1===n.docs.length?"doc":"docs"," (sample) \xb7 ",n.ms," ms"]}),r&&(0,d.jsx)(j.y$,{className:"ml-auto h-3 w-3"})]}),(0,d.jsx)("div",{className:"scrollbar-thin flex-1 space-y-1.5 overflow-auto p-2",children:u?(0,d.jsxs)("p",{className:"text-[11px] text-fg-muted",children:[g.op," writes data, so it has no preview. It runs only when you press Run."]}):g.enabled?p?(0,d.jsx)(j.aV,{error:p}):n&&0===n.docs.length?(0,d.jsxs)("p",{className:"pt-6 text-center text-[11.5px] text-fg-muted",children:["No documents after this stage.",(0,d.jsx)("br",{}),(0,d.jsx)("span",{className:"text-fg-subtle",children:"Check the filter above."})]}):n?.docs.map((a,b)=>(0,d.jsx)(aJ,{doc:a},b)):(0,d.jsx)("p",{className:"text-[11px] text-fg-muted",children:"Stage is disabled — it is skipped when the pipeline runs."})})]})]})]})}let aP={String:"bg-emerald-500",Number:"bg-blue-500",Int32:"bg-blue-500",Double:"bg-sky-500",Long:"bg-indigo-500",Decimal128:"bg-indigo-400",Date:"bg-amber-500",ObjectId:"bg-purple-500",Boolean:"bg-fuchsia-500",Document:"bg-teal-500",Array:"bg-cyan-600",Null:"bg-gray-400",Undefined:"bg-gray-300",Binary:"bg-violet-400",UUID:"bg-violet-500"};function aQ({cid:a,db:b,coll:c}){let[e,h]=(0,l.useState)(""),[i,m]=(0,l.useState)(1e3),[n,o]=(0,l.useState)(null),p=(0,f.I)({queryKey:["schema",a,b,c,n],queryFn:()=>(0,g.FH)(`${(0,g.wV)(a,b,c)}/schema`,{query:{filter:n.filter,size:n.size}}),enabled:!!n,staleTime:1/0}),q=()=>o({filter:e,size:i});return(0,d.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5 border-b bg-bg px-3 py-2",children:[(0,d.jsxs)("div",{className:"flex h-8 min-w-0 flex-1 items-stretch overflow-hidden rounded-md border border-border-strong bg-panel focus-within:border-accent focus-within:ring-2 focus-within:ring-accent/15",children:[(0,d.jsx)("span",{className:"flex select-none items-center border-r bg-bg-subtle px-2.5 text-[10.5px] font-semibold uppercase tracking-wide text-fg-subtle",children:"Filter"}),(0,d.jsx)(Y,{className:"ma-oneline min-w-0 flex-1",value:e,onChange:h,onRun:q,oneLine:!0,placeholder:"{ } \xb7 empty = whole collection \xb7 Enter to analyze"})]}),(0,d.jsxs)("div",{className:"flex h-8 items-center rounded-md border border-border-strong bg-panel p-0.5",title:"How many random documents to sample",children:[(0,d.jsx)("span",{className:"px-2 text-[10.5px] font-semibold uppercase tracking-wide text-fg-subtle",children:"Sample"}),[100,1e3,5e3,1e4].map(a=>(0,d.jsx)("button",{onClick:()=>m(a),className:(0,k.cn)("h-6 rounded px-2 text-[12px] tabular-nums transition-colors",i===a?"bg-accent-soft font-medium text-accent":"text-fg-muted hover:text-fg"),children:a>=1e3?`${a/1e3}k`:a},a))]}),(0,d.jsxs)(B.$,{size:"md",variant:"primary",onClick:q,loading:p.isFetching,children:[(0,d.jsx)(aD.A,{className:"h-3.5 w-3.5"}),"Analyze"]})]}),(0,d.jsxs)("div",{className:"scrollbar-thin flex-1 overflow-auto p-4",children:[(0,d.jsx)(j.aV,{error:p.error}),!n&&(0,d.jsx)(j.Sv,{title:"Analyze the schema",children:"See every field, its types and how often it appears — from a random sample, so it is fast on any size."}),p.isFetching&&(0,d.jsx)("div",{className:"flex justify-center p-10",children:(0,d.jsx)(j.y$,{})}),p.data&&!p.isFetching&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("p",{className:"mb-3 text-xs text-fg-muted",children:["Analyzed ",(0,d.jsx)("b",{className:"text-fg",children:(0,k.ZV)((0,k.bu)(p.data.schema.count))})," documents \xb7 ",p.data.schema.fields.length," top-level fields \xb7 ",(0,k.bu)(p.data.ms)," ms"]}),(0,d.jsx)("div",{className:"space-y-2",children:p.data.schema.fields.map(a=>(0,d.jsx)(aR,{f:a,total:(0,k.bu)(p.data.schema.count)},a.name))})]})]})]})}function aR({f:a,total:b,depth:c=0}){let[e,f]=(0,l.useState)(!1),g=[...a.types].sort((a,b)=>(0,k.bu)(b.probability)-(0,k.bu)(a.probability)),h=g.flatMap(a=>"Document"===a.name?a.fields??[]:"Array"===a.name?(a.types??[]).flatMap(a=>"Document"===a.name?a.fields??[]:[]):[]),[i,j]=(0,l.useState)(g[0]?.name),m=g.find(a=>a.name===i)??g[0],n=(0,k.bu)(a.probability);return(0,d.jsxs)("div",{className:(0,k.cn)("rounded-lg border bg-panel",c>0&&"ml-6"),children:[(0,d.jsxs)("div",{className:"grid grid-cols-[minmax(180px,260px)_1fr] gap-4 p-3",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-1",children:[h.length>0?(0,d.jsx)("button",{onClick:()=>f(a=>!a),className:"text-fg-subtle",children:e?(0,d.jsx)(O.A,{className:"h-3.5 w-3.5"}):(0,d.jsx)(v.A,{className:"h-3.5 w-3.5"})}):(0,d.jsx)("span",{className:"w-3.5"}),(0,d.jsx)("span",{className:"truncate font-mono text-[13px] font-semibold",title:a.path.join("."),children:a.name})]}),(0,d.jsxs)("p",{className:"mt-1 pl-[18px] text-[11px] text-fg-muted",children:["In ",(0,d.jsxs)("b",{className:(0,k.cn)(n<1?"text-warn":"text-fg"),children:[(100*n).toFixed(+(n<1&&n>.99)),"%"]})," of documents"]})]}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("div",{className:"flex h-2.5 overflow-hidden rounded-full bg-bg-muted",children:g.map(a=>(0,d.jsx)("button",{onClick:()=>j(a.name),title:`${a.name}: ${(100*(0,k.bu)(a.probability)).toFixed(1)}%`,style:{width:`${100*(0,k.bu)(a.probability)}%`},className:(0,k.cn)(aP[a.name]??"bg-gray-500",i===a.name?"":"opacity-60")},a.name))}),(0,d.jsx)("div",{className:"mt-1.5 flex flex-wrap gap-x-3 text-[11px]",children:g.map(a=>(0,d.jsxs)("button",{onClick:()=>j(a.name),className:(0,k.cn)("flex items-center gap-1",i===a.name?"font-semibold text-fg":"text-fg-muted"),children:[(0,d.jsx)("span",{className:(0,k.cn)("h-2 w-2 rounded-full",aP[a.name]??"bg-gray-500")}),a.name," ",(100*(0,k.bu)(a.probability)).toFixed(0),"%"]},a.name))}),m&&(0,d.jsx)(aS,{t:m,total:b})]})]}),e&&(0,d.jsx)("div",{className:"space-y-2 border-t p-2",children:(function(a){let b=new Map;for(let c of a)b.has(c.name)||b.set(c.name,c);return[...b.values()]})(h).map(a=>(0,d.jsx)(aR,{f:a,total:b,depth:c+1},a.name))})]})}function aS({t:a}){let b=(a.values??[]).slice(0,50);if("Array"===a.name)return(0,d.jsxs)("p",{className:"mt-2 text-[11px] text-fg-muted",children:["Array lengths: min ",Math.min(...(a.lengths??[0]).map(k.bu)),", max ",Math.max(...(a.lengths??[0]).map(k.bu))]});if("Document"===a.name||0===b.length)return null;if(["Number","Int32","Double","Long","Decimal128"].includes(a.name)){let a=b.map(k.bu).filter(a=>Number.isFinite(a));if(!a.length)return null;let c=Math.min(...a),e=Math.max(...a),f=Array(12).fill(0);for(let b of a)f[Math.min(11,Math.floor((b-c)/(e-c||1)*12))]++;let g=Math.max(...f);return(0,d.jsxs)("div",{className:"mt-2",children:[(0,d.jsx)("div",{className:"flex h-12 items-end gap-0.5",children:f.map((a,b)=>(0,d.jsx)("div",{className:"flex-1 rounded-t bg-accent/70",style:{height:`${a/g*100}%`},title:`${a}`},b))}),(0,d.jsxs)("p",{className:"mt-1 flex justify-between text-[10px] text-fg-subtle",children:[(0,d.jsxs)("span",{children:["min ",(0,k.ZV)(c)]}),(0,d.jsxs)("span",{children:["max ",(0,k.ZV)(e)]})]})]})}let c=new Map;for(let a of b){let b=(0,D.VH)(a);c.set(b,(c.get(b)??0)+1)}let e=[...c.entries()].sort((a,b)=>b[1]-a[1]).slice(0,8);return(0,d.jsx)("div",{className:"mt-2 flex flex-wrap gap-1",children:e.map(([a,b])=>(0,d.jsxs)("span",{className:"max-w-[240px] truncate rounded bg-bg-muted px-1.5 py-0.5 font-mono text-[10.5px]",title:`${a} (${b})`,children:[a,b>1&&(0,d.jsxs)("span",{className:"text-fg-subtle",children:[" \xd7",b]})]},a))})}var aT=c(92415),aU=c(51553),aV=c(88489);function aW({cid:a,db:b,coll:c,role:e}){let i=(0,g.wV)(a,b,c),m=(0,n.jE)(),p=(0,f.I)({queryKey:["indexes",a,b,c],queryFn:()=>(0,g.FH)(`${i}/indexes`)}),[q,r]=(0,l.useState)(!1),[u,v]=(0,l.useState)(null),w=(0,h.$3)(e,"admin"),x=()=>{m.invalidateQueries({queryKey:["indexes",a,b,c]}),m.invalidateQueries({queryKey:["collstats",a,b,c]})};async function y(a){try{await (0,g.FH)(`${i}/indexes`,{method:"PATCH",body:{name:a.name,hidden:!a.hidden}}),H.oR.success(a.hidden?"Index unhidden":"Index hidden"),x()}catch(a){H.oR.error(a.message)}}let z=p.data?.indexes??[],A=z.reduce((a,b)=>a+(null===b.size?0:(0,k.bu)(b.size)),0),C=Math.max(1,...z.map(a=>a.usage?(0,k.bu)(a.usage.ops):0));return(0,d.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,d.jsxs)("div",{className:"flex h-10 shrink-0 items-center gap-3 border-b px-3",children:[w&&(0,d.jsxs)(B.$,{variant:"primary",onClick:()=>r(!0),children:[(0,d.jsx)(o.A,{className:"h-3.5 w-3.5"}),"Create index"]}),p.data&&(0,d.jsxs)("span",{className:"text-[12px] text-fg-muted",children:[(0,d.jsx)("b",{className:"text-fg",children:z.length})," ",1===z.length?"index":"indexes"," \xb7 ",(0,d.jsx)("b",{className:"text-fg",children:(0,k.z3)(A)})," total"]}),(0,d.jsx)(B.$,{size:"icon",variant:"ghost",className:"ml-auto",onClick:x,title:"Refresh",children:(0,d.jsx)(t.A,{className:(0,k.cn)("h-3.5 w-3.5",p.isFetching&&"animate-spin")})})]}),(0,d.jsxs)("div",{className:"scrollbar-thin flex-1 overflow-auto bg-panel",children:[p.isLoading&&(0,d.jsx)("div",{className:"p-4",children:(0,d.jsx)(j.y$,{})}),null!=p.error&&(0,d.jsx)("div",{className:"p-4",children:(0,d.jsx)(j.aV,{error:p.error})}),p.data&&(0,d.jsxs)("table",{className:"w-full border-separate border-spacing-0 text-[12px]",children:[(0,d.jsx)("thead",{className:"sticky top-0 z-10 bg-bg-subtle",children:(0,d.jsxs)("tr",{className:"text-left text-[11px] text-fg-muted",children:[(0,d.jsx)("th",{className:"h-8 border-b px-4 font-semibold",children:"Index"}),(0,d.jsx)("th",{className:"h-8 w-[110px] border-b px-3 font-semibold",children:"Type"}),(0,d.jsx)("th",{className:"h-8 w-[90px] border-b px-3 font-semibold",children:"Size"}),(0,d.jsx)("th",{className:"h-8 w-[170px] border-b px-3 font-semibold",children:"Usage"}),(0,d.jsx)("th",{className:"h-8 w-[200px] border-b px-3 font-semibold",children:"Properties"}),(0,d.jsx)("th",{className:"h-8 w-[84px] border-b px-3"})]})}),(0,d.jsx)("tbody",{children:z.map(a=>{let b=a.usage?(0,k.bu)(a.usage.ops):null;return(0,d.jsxs)("tr",{className:(0,k.cn)("group hover:bg-bg-subtle",a.hidden&&"opacity-60"),children:[(0,d.jsx)("td",{className:"h-9 border-b px-4",children:(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,d.jsx)("span",{className:"shrink-0 font-mono text-[12px] font-semibold",children:a.name}),(0,d.jsx)("span",{className:"flex min-w-0 flex-wrap gap-1",children:Object.entries(a.key).map(([a,b])=>(0,d.jsx)(aX,{field:a,dir:b},a))})]})}),(0,d.jsx)("td",{className:"border-b px-3",children:(0,d.jsx)(aZ,{type:function(a){let b=Object.values(a.key).map(String);return b.includes("text")?"Text":b.includes("2dsphere")?"Geospatial":b.includes("hashed")?"Hashed":Object.keys(a.key).some(a=>a.includes("$**"))?"Wildcard":Object.keys(a.key).length>1?"Compound":"Regular"}(a)})}),(0,d.jsx)("td",{className:"border-b px-3 tabular-nums",children:(0,k.z3)(null===a.size?null:(0,k.bu)(a.size))}),(0,d.jsx)("td",{className:"border-b px-3",children:null===b?(0,d.jsx)("span",{className:"text-fg-subtle",children:"—"}):0===b?(0,d.jsx)("span",{className:"inline-flex h-[18px] items-center rounded bg-warn-soft px-1.5 text-[10.5px] font-medium text-warn",title:"No queries have used this index since the server started",children:"Never used"}):(0,d.jsxs)("div",{className:"flex items-center gap-2",title:a.usage?.since?`Counted since ${new Date(a.usage.since).toLocaleString()}`:void 0,children:[(0,d.jsxs)("span",{className:"w-16 shrink-0 tabular-nums",children:[(0,k.ZV)(b)," ops"]}),(0,d.jsx)("div",{className:"h-1 w-16 overflow-hidden rounded-full bg-bg-muted",children:(0,d.jsx)("div",{className:"h-full rounded-full bg-accent/80",style:{width:`${Math.max(4,b/C*100)}%`}})})]})}),(0,d.jsx)("td",{className:"border-b px-3",children:(0,d.jsxs)("div",{className:"flex flex-wrap gap-1",children:[a.unique&&(0,d.jsx)(j.Ex,{tone:"accent",children:"unique"}),a.sparse&&(0,d.jsx)(j.Ex,{children:"sparse"}),void 0!==a.expireAfterSeconds&&(0,d.jsxs)(j.Ex,{tone:"warn",children:["TTL ",(0,k.bu)(a.expireAfterSeconds),"s"]}),a.partialFilterExpression&&(0,d.jsx)("span",{title:(0,D.aB)(a.partialFilterExpression).replace(/\s+/g," "),children:(0,d.jsx)(j.Ex,{children:"partial"})}),a.hidden&&(0,d.jsx)(j.Ex,{tone:"warn",children:"hidden"}),!a.unique&&!a.sparse&&void 0===a.expireAfterSeconds&&!a.partialFilterExpression&&!a.hidden&&(0,d.jsx)("span",{className:"text-fg-subtle",children:"—"})]})}),(0,d.jsx)("td",{className:"border-b px-3 text-right",children:"_id_"===a.name?(0,d.jsx)("span",{title:"The _id index is required and cannot be dropped",className:"inline-flex text-fg-subtle",children:(0,d.jsx)(aT.A,{className:"h-3.5 w-3.5"})}):w?(0,d.jsxs)("div",{className:"flex justify-end gap-0.5 opacity-0 transition-opacity group-hover:opacity-100",children:[(0,d.jsx)(B.$,{size:"icon-xs",variant:"ghost",title:a.hidden?"Unhide":"Hide (test dropping safely)",onClick:()=>y(a),children:a.hidden?(0,d.jsx)(aU.A,{className:"h-3.5 w-3.5"}):(0,d.jsx)(aV.A,{className:"h-3.5 w-3.5"})}),(0,d.jsx)(B.$,{size:"icon-xs",variant:"ghost",title:"Drop index",onClick:()=>v(a.name),children:(0,d.jsx)(s.A,{className:"h-3.5 w-3.5"})})]}):null})]},a.name)})})]})]}),q&&(0,d.jsx)(a_,{base:i,onClose:()=>r(!1),onDone:x}),u&&(0,d.jsx)(a1,{base:i,name:u,onClose:()=>v(null),onDone:x})]})}function aX({field:a,dir:b}){let c="object"==typeof b&&null!==b&&"valueOf"in b?b.valueOf():b,e=1===c?"↑":-1===c?"↓":String(c);return(0,d.jsxs)("span",{className:"inline-flex h-[18px] items-center gap-1 rounded bg-bg-muted px-1.5 font-mono text-[11px]",title:`${a}: ${String(c)}`,children:[(0,d.jsx)("span",{className:"text-fg",children:a}),(0,d.jsx)("span",{className:(0,k.cn)("text-[10.5px]",1===c||-1===c?"text-accent":"text-fg-muted"),children:e})]})}let aY={Regular:"bg-bg-muted text-fg-muted",Compound:"bg-sky-100 text-sky-700 dark:bg-sky-500/15 dark:text-sky-300",Text:"bg-violet-100 text-violet-700 dark:bg-violet-500/15 dark:text-violet-300",Geospatial:"bg-emerald-100 text-emerald-700 dark:bg-emerald-500/15 dark:text-emerald-300",Hashed:"bg-amber-100 text-amber-700 dark:bg-amber-500/15 dark:text-amber-300",Wildcard:"bg-pink-100 text-pink-700 dark:bg-pink-500/15 dark:text-pink-300"};function aZ({type:a}){return(0,d.jsx)("span",{className:(0,k.cn)("inline-flex h-[18px] items-center rounded px-1.5 text-[10.5px] font-medium",aY[a]??aY.Regular),children:a})}let a$=[{v:"1",label:"Ascending ↑"},{v:"-1",label:"Descending ↓"},{v:"text",label:"Text"},{v:"2dsphere",label:"2dsphere (geo)"},{v:"hashed",label:"Hashed"}];function a_({base:a,onClose:b,onDone:c}){let[e,h]=(0,l.useState)([{field:"",type:"1"}]),[i,k]=(0,l.useState)(""),[m,n]=(0,l.useState)({unique:!1,sparse:!1,hidden:!1,ttl:!1,partial:!1,collation:!1,name:!1}),[p,q]=(0,l.useState)("3600"),[r,s]=(0,l.useState)("{ status: 'active' }"),[t,u]=(0,l.useState)("{ locale: 'en', strength: 2 }"),[v,w]=(0,l.useState)(null),[x,y]=(0,l.useState)(!1),z=(0,f.I)({queryKey:["index-field-suggest",a],queryFn:()=>(0,g.FH)(`${a}/find`,{query:{limit:50}}),staleTime:6e4}),A=(0,l.useMemo)(()=>{let a=new Set,b=(c,d="")=>{for(let[e,f]of Object.entries(c)){let c=d?`${d}.${e}`:e;a.add(c),!f||"object"!=typeof f||Array.isArray(f)||"_bsontype"in f||f instanceof Date||!(d.split(".").length<3)||b(f,c)}};for(let a of z.data?.docs??[])b(a);return[...a].sort()},[z.data]),D=`{ ${e.filter(a=>a.field.trim()).map(a=>`${/^[A-Za-z_$][\w$.]*$/.test(a.field.trim())&&!a.field.includes(".")?a.field.trim():JSON.stringify(a.field.trim())}: ${"1"===a.type||"-1"===a.type?a.type:`'${a.type}'`}`).join(", ")} }`,E=e.every(a=>a.field.trim()),F=m.ttl&&e.length>1,G=E&&!F&&(!m.ttl||/^\d+$/.test(p)),I=(a,b)=>h(c=>c.map((c,d)=>d===a?{...c,...b}:c)),K=a=>n(b=>({...b,[a]:!b[a]}));async function L(){let d=[];m.name&&i.trim()&&d.push(`name: ${JSON.stringify(i.trim())}`),m.unique&&d.push("unique: true"),m.sparse&&d.push("sparse: true"),m.hidden&&d.push("hidden: true"),m.ttl&&d.push(`expireAfterSeconds: ${Number(p)}`),m.partial&&r.trim()&&d.push(`partialFilterExpression: ${r}`),m.collation&&t.trim()&&d.push(`collation: ${t}`),y(!0),w(null);try{let e=await (0,g.FH)(`${a}/indexes`,{body:{keys:D,options:`{ ${d.join(", ")} }`}});H.oR.success(`Index ${e.name} created`),c(),b()}catch(a){w(a)}finally{y(!1)}}return(0,d.jsx)(C.l,{open:!0,onClose:b,title:"Create index",width:"max-w-xl",footer:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("code",{className:"mr-auto max-w-[60%] truncate rounded bg-bg-muted px-2 py-1 font-mono text-[11px] text-fg-muted",title:D,children:D}),(0,d.jsx)(B.$,{onClick:b,children:"Cancel"}),(0,d.jsx)(B.$,{variant:"primary",loading:x,disabled:!G,onClick:L,children:"Create index"})]}),children:(0,d.jsxs)("div",{className:"space-y-4 text-[12.5px]",children:[(0,d.jsxs)("section",{children:[(0,d.jsx)("p",{className:"mb-1.5 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle",children:"Index fields"}),(0,d.jsx)("datalist",{id:"ma-index-fields",children:A.map(a=>(0,d.jsx)("option",{value:a},a))}),(0,d.jsx)("div",{className:"space-y-1.5",children:e.map((a,b)=>(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,d.jsx)(J.pd,{list:"ma-index-fields",placeholder:"field name, e.g. email or profile.city",value:a.field,onChange:a=>I(b,{field:a.target.value}),autoFocus:0===b,className:"flex-1 font-mono text-[12px]"}),(0,d.jsx)(J.l6,{value:a.type,onChange:a=>I(b,{type:a.target.value}),className:"w-40",children:a$.map(a=>(0,d.jsx)("option",{value:a.v,children:a.label},a.v))}),(0,d.jsx)(B.$,{size:"icon",variant:"ghost",title:"Remove field",disabled:1===e.length,onClick:()=>h(a=>a.filter((a,c)=>c!==b)),children:(0,d.jsx)(ao.A,{className:"h-3.5 w-3.5"})})]},b))}),(0,d.jsxs)(B.$,{variant:"ghost",className:"mt-1.5 text-accent",onClick:()=>h(a=>[...a,{field:"",type:"1"}]),children:[(0,d.jsx)(o.A,{className:"h-3.5 w-3.5"}),"Add field"]})]}),(0,d.jsxs)("section",{children:[(0,d.jsx)("p",{className:"mb-1.5 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle",children:"Options"}),(0,d.jsxs)("div",{className:"divide-y rounded-md border",children:[(0,d.jsx)(a0,{on:m.unique,onToggle:()=>K("unique"),title:"Unique",hint:"Reject documents with a duplicate value"}),(0,d.jsx)(a0,{on:m.sparse,onToggle:()=>K("sparse"),title:"Sparse",hint:"Only index documents that have the field"}),(0,d.jsx)(a0,{on:m.hidden,onToggle:()=>K("hidden"),title:"Create hidden",hint:"Build it now, let queries use it later"}),(0,d.jsx)(a0,{on:m.ttl,onToggle:()=>K("ttl"),title:"TTL (auto-delete)",hint:"Delete documents N seconds after the date in this field",children:(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)(J.pd,{value:p,onChange:a=>q(a.target.value.replace(/\D/g,"")),className:"w-32 tabular-nums",inputMode:"numeric"}),(0,d.jsx)("span",{className:"text-fg-muted",children:"seconds"}),F&&(0,d.jsx)("span",{className:"text-[11px] text-danger",children:"TTL works on a single date field only"})]})}),(0,d.jsx)(a0,{on:m.partial,onToggle:()=>K("partial"),title:"Partial filter",hint:"Only index documents matching a filter",children:(0,d.jsx)("div",{className:"ma-editor overflow-hidden rounded-md border border-border-strong",children:(0,d.jsx)(Y,{value:r,onChange:s,oneLine:!0})})}),(0,d.jsx)(a0,{on:m.collation,onToggle:()=>K("collation"),title:"Collation",hint:"Language rules, e.g. case-insensitive matching",children:(0,d.jsx)("div",{className:"ma-editor overflow-hidden rounded-md border border-border-strong",children:(0,d.jsx)(Y,{value:t,onChange:u,oneLine:!0})})}),(0,d.jsx)(a0,{on:m.name,onToggle:()=>K("name"),title:"Custom name",hint:"Otherwise named automatically, e.g. email_1",children:(0,d.jsx)(J.pd,{value:i,onChange:a=>k(a.target.value),placeholder:"my_index",className:"font-mono text-[12px]"})})]})]}),null!=v&&(0,d.jsx)(j.aV,{error:v})]})})}function a0({on:a,onToggle:b,title:c,hint:e,children:f}){return(0,d.jsxs)("div",{className:"px-3 py-2",children:[(0,d.jsxs)("label",{className:"flex cursor-pointer items-center gap-3",children:[(0,d.jsxs)("span",{className:(0,k.cn)("relative h-4 w-7 shrink-0 rounded-full transition-colors",a?"bg-accent":"bg-border-strong"),children:[(0,d.jsx)("span",{className:(0,k.cn)("absolute top-0.5 h-3 w-3 rounded-full bg-white shadow transition-all",a?"left-3.5":"left-0.5")}),(0,d.jsx)("input",{type:"checkbox",checked:a,onChange:b,className:"sr-only"})]}),(0,d.jsx)("span",{className:"font-medium",children:c}),(0,d.jsx)("span",{className:"truncate text-[11.5px] text-fg-subtle",children:e})]}),a&&f&&(0,d.jsx)("div",{className:"mt-2 pl-10",children:f})]})}function a1({base:a,name:b,onClose:c,onDone:e}){let[f,h]=(0,l.useState)(""),[i,k]=(0,l.useState)(!1),[m,n]=(0,l.useState)(null);async function o(){k(!0);try{await (0,g.FH)(`${a}/indexes`,{method:"DELETE",body:{name:b}}),H.oR.success(`Index ${b} dropped`),e(),c()}catch(a){n(a)}finally{k(!1)}}return(0,d.jsx)(C.l,{open:!0,onClose:c,title:"Drop index",footer:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(B.$,{onClick:c,children:"Cancel"}),(0,d.jsx)(B.$,{variant:"danger",loading:i,disabled:f!==b,onClick:o,children:"Drop index"})]}),children:(0,d.jsxs)("div",{className:"space-y-2 text-xs",children:[(0,d.jsxs)("p",{children:["Queries that use ",(0,d.jsx)("b",{className:"font-mono",children:b})," may become slow. Tip: hide the index first to test."]}),(0,d.jsxs)("p",{children:["Type ",(0,d.jsx)("b",{className:"font-mono",children:b})," to confirm:"]}),(0,d.jsx)(J.pd,{value:f,onChange:a=>h(a.target.value),autoFocus:!0}),(0,d.jsx)(j.aV,{error:m})]})})}var a2=c(33198),a3=c(7533),a4=c(16437),a5=c(41737);let a6=`{
|
|
8
|
+
$jsonSchema: {
|
|
9
|
+
bsonType: 'object',
|
|
10
|
+
required: ['name'],
|
|
11
|
+
properties: {
|
|
12
|
+
name: { bsonType: 'string', description: 'must be a string' }
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}`,a7={error:"Invalid writes are rejected",warn:"Invalid writes are allowed but logged"},a8={off:"Rules are not checked",moderate:"Only checks documents that already pass",strict:"Checks every insert and update"};function a9({cid:a,db:b,coll:c,role:e}){let i=(0,g.wV)(a,b,c),m=(0,n.jE)(),o=(0,f.I)({queryKey:["validation",a,b,c],queryFn:()=>(0,g.FH)(`${i}/validation`)}),[p,q]=(0,l.useState)(""),[r,s]=(0,l.useState)("strict"),[t,u]=(0,l.useState)("error"),[v,w]=(0,l.useState)(null),[x,y]=(0,l.useState)(!1),[z,A]=(0,l.useState)(null),[C,E]=(0,l.useState)(!1),[F,G]=(0,l.useState)("failed"),I=(0,l.useRef)(!1),J=a=>{I.current=!0,G(a)},K=(0,h.$3)(e,"admin"),L=!!o.data&&Object.keys(o.data.validator).length>0,M=(0,l.useMemo)(()=>L&&o.data?(0,D.aB)(o.data.validator):a6,[o.data,L]),N=!!o.data&&(!L||p!==M||r!==o.data.validationLevel||t!==o.data.validationAction);async function O(){E(!0);try{await (0,g.FH)(`${i}/validation`,{method:"PUT",body:{validator:p,validationLevel:r,validationAction:t}}),H.oR.success("Validation rules applied"),await m.invalidateQueries({queryKey:["validation",a,b,c]})}catch(a){A(a)}finally{E(!1)}}if(o.isLoading)return(0,d.jsx)("div",{className:"p-6",children:(0,d.jsx)(j.y$,{})});let P=(0,k.bu)(v?.passedCount??0),Q=(0,k.bu)(v?.failedCount??0),R=(0,k.bu)(v?.sampled??0),S=L&&o.data?.validationLevel!=="off";return(0,d.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,d.jsxs)("div",{className:"flex h-11 shrink-0 items-center gap-4 border-b px-3",children:[(0,d.jsxs)("span",{className:(0,k.cn)("inline-flex h-6 items-center gap-1 rounded-md px-2 text-[11px] font-medium",S?"bg-accent-soft text-accent":"bg-bg-muted text-fg-muted"),children:[S?(0,d.jsx)(a2.A,{className:"h-3.5 w-3.5"}):(0,d.jsx)(a3.A,{className:"h-3.5 w-3.5"}),S?"Rules active":L?"Rules off":"No rules yet"]}),(0,d.jsx)(bd,{label:"Action",value:t,onChange:u,disabled:!K,hint:a7[t],options:[["error","Error"],["warn","Warn"]]}),(0,d.jsx)(bd,{label:"Level",value:r,onChange:s,disabled:!K,hint:a8[r],options:[["off","Off"],["moderate","Moderate"],["strict","Strict"]]}),K&&(0,d.jsxs)("div",{className:"ml-auto flex items-center gap-1.5",children:[N&&L&&(0,d.jsx)("span",{className:"text-[11px] text-warn",children:"Unsaved changes"}),(0,d.jsxs)(B.$,{onClick:function(){o.data&&(q(M),s(o.data.validationLevel),u(o.data.validationAction))},disabled:!N||!L&&p===M,children:[(0,d.jsx)(am.A,{className:"h-3.5 w-3.5"}),"Revert"]}),(0,d.jsxs)(B.$,{variant:"primary",loading:C,disabled:!N,onClick:O,children:[(0,d.jsx)(aC.A,{className:"h-3.5 w-3.5"}),"Apply rules"]})]})]}),(0,d.jsxs)("div",{className:"flex min-h-0 flex-1",children:[(0,d.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-2 p-3",children:[(0,d.jsx)("div",{className:"ma-editor ma-editor-fill min-h-0 flex-1 overflow-hidden rounded-md border border-border-strong focus-within:border-accent focus-within:ring-2 focus-within:ring-accent/15",children:(0,d.jsx)(Y,{value:p,onChange:q,readOnly:!K,className:"h-full"})}),null!=z&&(0,d.jsx)(j.aV,{error:z}),!K&&(0,d.jsx)("p",{className:"text-[11px] text-fg-subtle",children:"Read-only: changing validation rules needs the admin role."})]}),(0,d.jsxs)("aside",{className:"flex w-[42%] min-w-[320px] max-w-[560px] flex-col border-l bg-bg-subtle",children:[(0,d.jsxs)("div",{className:"border-b bg-panel px-3 py-2.5",children:[(0,d.jsx)("p",{className:"text-[12px] font-semibold",children:"Preview on sample data"}),(0,d.jsx)("p",{className:"mt-0.5 text-[11px] text-fg-muted",children:x&&!v?"Checking…":0===R?"This collection has no documents to test.":(0,d.jsxs)(d.Fragment,{children:["Of ",(0,d.jsx)("b",{className:"text-fg",children:R})," random documents: ",(0,d.jsxs)("b",{className:"text-accent",children:[P," pass"]}),", ",(0,d.jsxs)("b",{className:Q?"text-danger":"text-fg",children:[Q," fail"]}),x&&" \xb7 updating…"]})}),R>0&&(0,d.jsxs)("div",{className:"mt-2 flex h-1.5 overflow-hidden rounded-full bg-bg-muted",children:[(0,d.jsx)("div",{className:"bg-accent",style:{width:`${P/R*100}%`}}),(0,d.jsx)("div",{className:"bg-danger",style:{width:`${Q/R*100}%`}})]}),(0,d.jsxs)("div",{className:"mt-2.5 flex gap-1",children:[(0,d.jsx)(bc,{active:"failed"===F,onClick:()=>J("failed"),icon:(0,d.jsx)(a4.A,{className:"h-3.5 w-3.5 text-danger"}),label:"Failed",count:Q}),(0,d.jsx)(bc,{active:"passed"===F,onClick:()=>J("passed"),icon:(0,d.jsx)(a5.A,{className:"h-3.5 w-3.5 text-accent"}),label:"Passed",count:P})]})]}),(0,d.jsx)("div",{className:"scrollbar-thin flex-1 space-y-2 overflow-auto p-3",children:v?0===("passed"===F?v.passed:v.failed).length?(0,d.jsx)(j.Sv,{title:"failed"===F?"No sampled document breaks these rules":"No sampled document passes these rules"}):("passed"===F?v.passed:v.failed).map((a,b)=>(0,d.jsx)(bb,{doc:a,ok:"passed"===F},b)):x?(0,d.jsx)(j.y$,{}):null})]})]})]})}let ba={mode:"collapse",n:1};function bb({doc:a,ok:b}){let c=a._id,e=c?.toHexString?c.toHexString():String(a._id??"");return(0,d.jsxs)("div",{className:"overflow-hidden rounded-md border bg-panel",children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5 border-b bg-bg-subtle px-2.5 py-1 text-[11px]",children:[b?(0,d.jsx)(a5.A,{className:"h-3.5 w-3.5 text-accent"}):(0,d.jsx)(a4.A,{className:"h-3.5 w-3.5 text-danger"}),(0,d.jsx)("span",{className:(0,k.cn)("font-medium",b?"text-accent":"text-danger"),children:b?"Passes":"Fails"}),(0,d.jsx)("span",{className:"ml-auto truncate font-mono text-fg-subtle",title:e,children:e})]}),(0,d.jsx)("div",{className:"py-1.5 pl-1 pr-2.5",children:(0,d.jsx)(af.xn,{command:ba,children:(0,d.jsx)(af.UU,{value:a,bare:!0})})})]})}function bc({active:a,onClick:b,icon:c,label:e,count:f}){return(0,d.jsxs)("button",{onClick:b,className:(0,k.cn)("flex h-7 items-center gap-1.5 rounded-md px-2.5 text-[12px] transition-colors",a?"bg-bg-muted font-medium text-fg":"text-fg-muted hover:bg-bg-muted/60 hover:text-fg"),children:[c,e,(0,d.jsx)("span",{className:"rounded bg-panel px-1 text-[10.5px] tabular-nums text-fg-muted",children:f})]})}function bd({label:a,value:b,onChange:c,options:e,disabled:f,hint:g}){return(0,d.jsxs)("div",{className:"flex items-center gap-2",title:g,children:[(0,d.jsx)("span",{className:"text-[11px] font-medium text-fg-subtle",children:a}),(0,d.jsx)("div",{className:"flex rounded-md bg-bg-muted p-0.5",children:e.map(([a,e])=>(0,d.jsx)("button",{disabled:f,onClick:()=>c(a),className:(0,k.cn)("h-6 rounded px-2.5 text-[12px] transition-colors disabled:cursor-not-allowed",b===a?"bg-panel font-medium text-fg shadow-sm":"text-fg-muted hover:text-fg"),children:e},a))})]})}let be=[{id:"documents",label:"Documents"},{id:"aggregations",label:"Aggregations"},{id:"schema",label:"Schema"},{id:"indexes",label:"Indexes"},{id:"validation",label:"Validation"}],bf=a=>be.find(b=>b.id===a)?.id??"documents";function bg({cid:a,db:b,coll:c,tab:l,onTab:m,compact:n,headerExtra:o}){let p=(0,e.qw)(),q=n||p,r=(0,h.yj)(),s=r.data?.connections.find(b=>b.id===a),t=(0,h.Wc)(a),u=t.data?.databases.find(a=>a.name===b),v=u?.collections.find(a=>a.name===c),w=v?.type==="view",x=u?.role??null,y=(0,f.I)({queryKey:["collstats",a,b,c],queryFn:()=>(0,g.FH)(`${(0,g.wV)(a,b,c)}/stats`),enabled:!!v&&!w,staleTime:3e4}),z=be.filter(a=>!(w&&("indexes"===a.id||"validation"===a.id)));return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(i.z,{crumbs:[{label:s?.name??"…",href:`/c/${a}`},{label:b,href:`/c/${a}/${(0,g.fk)(b)}`},{label:c}],actions:(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5 whitespace-nowrap text-[11px] text-fg-muted",children:[w&&(0,d.jsx)(j.Ex,{children:"View"}),x&&(0,d.jsx)(j.Ex,{tone:"viewer"===x?"neutral":"accent",children:x}),y.data&&!q&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(bh,{label:"Documents",value:(0,k.ZV)((0,k.bu)(y.data.count))}),(0,d.jsx)(bh,{label:"Storage",value:(0,k.z3)((0,k.bu)(y.data.storageSize))}),(0,d.jsx)(bh,{label:"Indexes",value:`${(0,k.bu)(y.data.nindexes)} \xb7 ${(0,k.z3)((0,k.bu)(y.data.totalIndexSize))}`})]}),q&&y.data&&(0,d.jsxs)("span",{className:"tabular-nums",children:[(0,k.ZV)((0,k.bu)(y.data.count))," docs"]}),o]})}),(0,d.jsx)("div",{className:"scrollbar-thin flex h-9 shrink-0 items-end gap-0.5 overflow-x-auto border-b px-3",children:z.map(a=>(0,d.jsx)("button",{onClick:()=>m(a.id),className:(0,k.cn)("-mb-px h-9 shrink-0 border-b-2 px-2.5 text-[12.5px] transition-colors",l===a.id?"border-accent font-semibold text-fg":"border-transparent text-fg-muted hover:text-fg"),children:a.label},a.id))}),"documents"===l&&(0,d.jsx)(ay,{cid:a,db:b,coll:c,role:x,readonly:w},`${b}.${c}`),"aggregations"===l&&(0,d.jsx)(aN,{cid:a,db:b,coll:c,role:x},`${b}.${c}`),"schema"===l&&(0,d.jsx)(aQ,{cid:a,db:b,coll:c},`${b}.${c}`),"indexes"===l&&(0,d.jsx)(aW,{cid:a,db:b,coll:c,role:x},`${b}.${c}`),"validation"===l&&(0,d.jsx)(a9,{cid:a,db:b,coll:c,role:x},`${b}.${c}`)]})}function bh({label:a,value:b}){return(0,d.jsxs)("span",{className:"inline-flex h-6 shrink-0 items-center gap-1 whitespace-nowrap rounded-md border bg-bg-subtle px-2",children:[(0,d.jsx)("span",{className:"text-fg-subtle",children:a}),(0,d.jsx)("b",{className:"font-semibold text-fg",children:b})]})}},20279:(a,b,c)=>{Promise.resolve().then(c.bind(c,24437))},24437:(a,b,c)=>{"use strict";c.d(b,{Providers:()=>l});var d=c(21124),e=c(5590),f=c(96610),g=c(38301),h=c(42830),i=c(18304),j=c(45478);function k(){let{dark:a}=(0,i.DP)();return(0,d.jsx)(h.l$,{theme:a?"dark":"light",position:"bottom-right",richColors:!0,closeButton:!0})}function l({children:a}){let[b]=(0,g.useState)(()=>new e.E({defaultOptions:{queries:{staleTime:15e3,refetchOnWindowFocus:!1,retry:(a,b)=>!(b instanceof j.hD&&b.status<500)&&a<1}}}));return(0,d.jsx)(i.NP,{children:(0,d.jsxs)(f.Ht,{client:b,children:[a,(0,d.jsx)(k,{})]})})}},31119:(a,b,c)=>{"use strict";c.d(b,{WorkspaceTabs:()=>z});var d=c(21124),e=c(3991),f=c.n(e),g=c(42378),h=c(38301),i=c(13614),j=c(78595),k=c(61129),l=c(99907),m=c(37129),n=c(4434),o=c(94741),p=c(49330),q=c(63722),r=c(90386),s=c(44394),t=c(99691),u=c(47933),v=c(44943),w=c(13133),x=c(52945);let y={welcome:(0,d.jsx)(i.A,{className:"h-3.5 w-3.5"}),conn:(0,d.jsx)(j.A,{className:"h-3.5 w-3.5"}),db:(0,d.jsx)(k.A,{className:"h-3.5 w-3.5"}),coll:(0,d.jsx)(l.A,{className:"h-3.5 w-3.5"}),perf:(0,d.jsx)(m.A,{className:"h-3.5 w-3.5"}),shell:(0,d.jsx)(n.A,{className:"h-3.5 w-3.5"}),admin:(0,d.jsx)(o.A,{className:"h-3.5 w-3.5"}),queries:(0,d.jsx)(p.A,{className:"h-3.5 w-3.5"})};function z(){let a=(0,g.usePathname)(),b=(0,g.useSearchParams)(),c=(0,g.useRouter)();(0,w.yj)();let[e,i]=(0,h.useState)([]),j=(0,x.OI)(),k=b.toString();return(0,d.jsxs)("div",{className:"flex h-10 shrink-0 items-stretch border-b bg-bg-subtle",children:[(0,d.jsxs)("div",{className:"scrollbar-thin flex min-w-0 flex-1 items-stretch overflow-x-auto pl-1",children:[e.map(b=>{let g=b.path===a;return(0,d.jsxs)(f(),{href:g&&k?`${b.path}?${k}`:b.path,title:b.subtitle?`${b.subtitle} › ${b.title}`:b.title,className:(0,v.cn)("group relative -mb-px flex min-w-0 max-w-[220px] shrink-0 items-center gap-1.5 border-x border-transparent pl-3 pr-1.5 text-[12.5px] transition-colors",g?"border-border bg-bg text-fg":"text-fg-muted hover:bg-bg-muted hover:text-fg"),children:[g&&(0,d.jsx)("span",{className:"absolute inset-x-0 top-0 h-[2px] bg-accent"}),(0,d.jsx)("span",{className:(0,v.cn)("shrink-0",g?"text-accent":"text-fg-subtle"),children:y[b.kind]}),(0,d.jsx)("span",{className:(0,v.cn)("truncate",g&&"font-medium"),children:b.title}),b.subtitle&&(0,d.jsx)("span",{className:"hidden truncate text-[11px] text-fg-subtle xl:inline",children:b.subtitle.split(" \xb7 ").at(-1)}),j.countFor(b.path)>0&&(0,d.jsxs)("span",{title:`${j.countFor(b.path)} more side by side`,className:"flex h-4 shrink-0 items-center gap-0.5 rounded bg-bg-muted px-1 text-[10px] tabular-nums text-fg-muted",children:[(0,d.jsx)(q.A,{className:"h-2.5 w-2.5"}),"+",j.countFor(b.path)]}),(0,d.jsx)("button",{onClick:d=>(function(b,d){d.preventDefault(),d.stopPropagation();let f=e.findIndex(a=>a.path===b),g=e.filter(a=>a.path!==b);j.forget(b),0===g.length&&(g=[{path:"/",title:"Welcome",kind:"welcome"}]),i(g);try{sessionStorage.setItem("ma-tabs",JSON.stringify(g))}catch{}b!==a&&g.some(b=>b.path===a)||c.push(g[Math.min(f,g.length-1)]?.path??"/")})(b.path,d),className:(0,v.cn)("ml-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded text-fg-subtle hover:bg-bg-muted hover:text-fg",g?"opacity-100":"opacity-0 group-hover:opacity-100"),"aria-label":"Close tab",children:(0,d.jsx)(r.A,{className:"h-3 w-3"})})]},b.path)}),(0,d.jsx)(f(),{href:"/",className:"my-auto ml-1 flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-bg-muted hover:text-fg",title:"New tab",children:(0,d.jsx)(s.A,{className:"h-4 w-4"})})]}),(0,d.jsx)(A,{})]})}function A(){let[a,b]=(0,h.useState)(!1),[c,e]=(0,h.useState)(!0);return(0,d.jsx)("div",{className:"flex shrink-0 items-center border-l px-2",children:(0,d.jsxs)("button",{onClick:()=>window.dispatchEvent(new Event(u.Q)),"aria-pressed":a,title:`${a?"Close":"Ask AI about your data"} (${c?"⌘":"Ctrl+"}I)`,className:(0,v.cn)("flex h-7 items-center gap-1.5 rounded-md px-2.5 text-[12.5px] font-medium transition-colors",a?"bg-accent text-accent-fg":"text-accent hover:bg-accent-soft"),children:[(0,d.jsx)(t.A,{className:"h-3.5 w-3.5"}),(0,d.jsx)("span",{className:"hidden sm:inline",children:"Ask AI"}),(0,d.jsx)("kbd",{className:(0,v.cn)("hidden rounded px-1 font-sans text-[10px] lg:inline",a?"bg-white/20":"bg-bg-muted text-fg-subtle"),children:c?"⌘I":"Ctrl I"})]})})}},31679:(a,b,c)=>{"use strict";c.d(b,{Providers:()=>d});let d=(0,c(97954).registerClientReference)(function(){throw Error("Attempted to call Providers() from the server but Providers is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Volumes/BOHR@HD/Pankaj/Project/WeAreTeam/MongoAdmin/src/features/shell/providers.tsx","Providers")},33747:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,54160,23)),Promise.resolve().then(c.t.bind(c,31603,23)),Promise.resolve().then(c.t.bind(c,68495,23)),Promise.resolve().then(c.t.bind(c,75170,23)),Promise.resolve().then(c.t.bind(c,77526,23)),Promise.resolve().then(c.t.bind(c,78922,23)),Promise.resolve().then(c.t.bind(c,29234,23)),Promise.resolve().then(c.t.bind(c,12263,23)),Promise.resolve().then(c.bind(c,82146))},35284:(a,b,c)=>{"use strict";c.d(b,{$:()=>j});var d=c(21124),e=c(38301),f=c(26691),g=c(16816),h=c(44943);let i=(0,f.F)("inline-flex items-center justify-center gap-1.5 rounded-md font-medium whitespace-nowrap transition-colors disabled:opacity-50 disabled:pointer-events-none focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",{variants:{variant:{primary:"bg-accent text-accent-fg hover:bg-accent-hover",secondary:"border border-border-strong bg-panel text-fg hover:bg-bg-muted",ghost:"text-fg-muted hover:bg-bg-muted hover:text-fg",danger:"bg-danger text-white hover:opacity-90","danger-outline":"border border-danger/50 text-danger hover:bg-danger-soft"},size:{xs:"h-6 px-2 text-xs",sm:"h-7 px-2.5 text-xs",md:"h-8 px-3 text-[13px]",icon:"h-7 w-7","icon-xs":"h-6 w-6"}},defaultVariants:{variant:"secondary",size:"sm"}}),j=(0,e.forwardRef)(({className:a,variant:b,size:c,loading:e,children:f,disabled:j,...k},l)=>(0,d.jsxs)("button",{ref:l,className:(0,h.cn)(i({variant:b,size:c}),a),disabled:j||e,...k,children:[e&&(0,d.jsx)(g.A,{className:"h-3.5 w-3.5 animate-spin"}),f]}));j.displayName="Button"},39866:(a,b,c)=>{"use strict";c.d(b,{L:()=>j});var d=c(21124),e=c(38301),f=c(23312),g=c(7144),h=c(13330),i=c(44943);function j({value:a,options:b,onChange:c,className:j,placeholder:k="Select…"}){let[l,m]=(0,e.useState)(!1),n=(0,e.useRef)(null),[o,p]=(0,e.useState)(null),q=b.find(b=>b.value===a);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("button",{ref:n,type:"button","aria-haspopup":"listbox","aria-expanded":l,onClick:()=>m(a=>!a),onKeyDown:d=>{if("ArrowDown"!==d.key&&"ArrowUp"!==d.key)return;d.preventDefault();let e=b.findIndex(b=>b.value===a),f=b[(e+("ArrowDown"===d.key?1:-1)+b.length)%b.length];f&&c(f.value)},className:(0,i.cn)("flex h-8 w-full min-w-0 items-center gap-2 rounded-md border bg-panel px-2.5 text-left text-[12.5px] outline-none transition-colors hover:border-border-strong focus-visible:border-accent",l&&"border-accent",j),children:[q?.icon,(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate",children:q?q.label:(0,d.jsx)("span",{className:"text-fg-subtle",children:k})}),q?.hint&&(0,d.jsx)("span",{className:"shrink-0 text-[10.5px] text-fg-subtle",children:q.hint}),(0,d.jsx)(g.A,{className:(0,i.cn)("h-3.5 w-3.5 shrink-0 text-fg-subtle transition-transform",l&&"rotate-180")})]}),l&&o&&(0,f.createPortal)((0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"fixed inset-0 z-[60]",onMouseDown:()=>m(!1)}),(0,d.jsxs)("div",{role:"listbox",className:"ma-pop scrollbar-thin fixed z-[61] max-h-60 overflow-auto rounded-md border bg-panel py-1 shadow-xl",style:{left:o.left,width:o.width,...o.up?{bottom:window.innerHeight-o.top}:{top:o.top}},children:[b.map(b=>(0,d.jsxs)("button",{role:"option","aria-selected":b.value===a,onClick:()=>{c(b.value),m(!1)},className:(0,i.cn)("flex w-full items-center gap-2 px-2.5 py-1.5 text-left text-[12.5px] hover:bg-bg-muted",b.value===a&&"bg-accent-soft"),children:[b.icon,(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate",children:b.label}),b.hint&&(0,d.jsx)("span",{className:"shrink-0 text-[10.5px] text-fg-subtle",children:b.hint}),(0,d.jsx)(h.A,{className:(0,i.cn)("h-3.5 w-3.5 shrink-0 text-accent",b.value!==a&&"invisible")})]},b.value)),0===b.length&&(0,d.jsx)("p",{className:"px-2.5 py-2 text-[12px] text-fg-subtle",children:"Nothing to pick"})]})]}),document.body)]})}},40068:(a,b,c)=>{"use strict";c.d(b,{T:()=>i,l:()=>h});var d=c(21124);c(38301);var e=c(23312),f=c(90386),g=c(44943);function h({open:a,onClose:b,title:c,children:h,footer:i,width:j="max-w-lg"}){return a?(0,e.createPortal)((0,d.jsx)("div",{className:"fixed inset-0 z-50 flex items-start justify-center bg-black/40 p-4 pt-[10vh]",onMouseDown:a=>a.target===a.currentTarget&&b(),children:(0,d.jsxs)("div",{role:"dialog","aria-modal":!0,className:(0,g.cn)("flex max-h-[80vh] w-full flex-col rounded-lg border bg-panel shadow-2xl",j),children:[(0,d.jsxs)("div",{className:"flex items-center justify-between border-b px-4 py-3",children:[(0,d.jsx)("h2",{className:"text-sm font-semibold",children:c}),(0,d.jsx)("button",{onClick:b,className:"rounded p-1 text-fg-muted hover:bg-bg-muted","aria-label":"Close",children:(0,d.jsx)(f.A,{className:"h-4 w-4"})})]}),(0,d.jsx)("div",{className:"scrollbar-thin flex-1 overflow-auto p-4",children:h}),i&&(0,d.jsx)("div",{className:"flex justify-end gap-2 border-t px-4 py-3",children:i})]})}),document.body):null}function i({open:a,onClose:b,onConfirm:c,icon:f,title:g,message:h,confirmLabel:i="Confirm",busy:j}){return a?(0,e.createPortal)((0,d.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4 backdrop-blur-[2px]",onMouseDown:a=>a.target===a.currentTarget&&b(),children:(0,d.jsxs)("div",{role:"alertdialog","aria-modal":!0,className:"ma-pop w-full max-w-[320px] rounded-xl border bg-panel p-5 text-center shadow-2xl",children:[f&&(0,d.jsx)("div",{className:"mx-auto mb-3 flex h-10 w-10 items-center justify-center rounded-full bg-accent-soft text-accent",children:f}),(0,d.jsx)("h2",{className:"text-[15px] font-semibold",children:g}),h&&(0,d.jsx)("p",{className:"mt-1 text-[12.5px] leading-relaxed text-fg-muted",children:h}),(0,d.jsxs)("div",{className:"mt-5 grid grid-cols-2 gap-2",children:[(0,d.jsx)("button",{onClick:b,className:"h-8 rounded-md border bg-panel text-[13px] font-medium hover:bg-bg-muted",children:"Cancel"}),(0,d.jsx)("button",{autoFocus:!0,disabled:j,onClick:c,className:"h-8 rounded-md bg-accent text-[13px] font-medium text-accent-fg hover:bg-accent-hover disabled:opacity-60",children:i})]})]})}),document.body):null}},41843:(a,b,c)=>{"use strict";c.d(b,{ChatPanel:()=>e});var d=c(97954);(0,d.registerClientReference)(function(){throw Error("Attempted to call AI_TOGGLE() from the server but AI_TOGGLE is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Volumes/BOHR@HD/Pankaj/Project/WeAreTeam/MongoAdmin/src/mcp/ui/chat-panel.tsx","AI_TOGGLE"),(0,d.registerClientReference)(function(){throw Error("Attempted to call AI_STATE() from the server but AI_STATE is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Volumes/BOHR@HD/Pankaj/Project/WeAreTeam/MongoAdmin/src/mcp/ui/chat-panel.tsx","AI_STATE");let e=(0,d.registerClientReference)(function(){throw Error("Attempted to call ChatPanel() from the server but ChatPanel is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Volumes/BOHR@HD/Pankaj/Project/WeAreTeam/MongoAdmin/src/mcp/ui/chat-panel.tsx","ChatPanel")},44943:(a,b,c)=>{"use strict";c.d(b,{ZV:()=>h,bu:()=>i,cn:()=>f,z3:()=>g});var d=c(43249),e=c(58829);function f(...a){return(0,e.QP)((0,d.$)(a))}function g(a){if(null==a||Number.isNaN(Number(a)))return"—";let b=Number(a);if(b<1024)return`${Math.round(b)} B`;let c=["KB","MB","GB","TB"],d=b/1024,e=0;for(;d>=1024&&e<c.length-1;)d/=1024,e++;return`${d.toFixed(d<10?2:1)} ${c[e]}`}function h(a){return null==a?"—":new Intl.NumberFormat().format(Number(a))}function i(a){return"number"==typeof a?a:a&&"object"==typeof a&&"valueOf"in a?Number(a.valueOf()):Number(a)}},45478:(a,b,c)=>{"use strict";c.d(b,{FH:()=>f,fk:()=>g,hD:()=>e,wV:()=>h});var d=c(54788);class e extends Error{constructor(a,b,c){super(b),this.status=a,this.code=c}}async function f(a,b={}){let c=new URL(a.startsWith("/")?a:`/${a}`,window.location.origin);for(let[a,d]of Object.entries(b.query??{}))void 0!==d&&""!==d&&c.searchParams.set(a,String(d));let g=await fetch(c,{method:b.method??(void 0!==b.body?"POST":"GET"),headers:void 0!==b.body?{"content-type":"application/json"}:void 0,body:void 0===b.body?void 0:b.ejson?d.On.stringify(b.body,{relaxed:!1}):JSON.stringify(b.body),credentials:"same-origin"}),h=await g.text(),i=h?g.headers.get("content-type")?.includes("json")?d.On.parse(h,{relaxed:!1}):h:null;if(!g.ok)throw 401!==g.status||a.startsWith("/api/auth")||(window.location.href="/login"),new e(g.status,i?.error??`Request failed (${g.status})`,i?.code);return i}let g=encodeURIComponent,h=(a,b,c)=>`/api/c/${g(a)}/${g(b)}/${g(c)}`},46553:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>o,dynamic:()=>n});var d=c(75338),e=c(74515),f=c(82161),g=c(14357),h=c(74097),i=c(83831),j=c(6737),k=c(77591),l=c(97513),m=c(41843);let n="force-dynamic";async function o({children:a}){return await (0,h.H3)(),await (0,g.Ny)()||(0,f.redirect)("/login"),(0,d.jsx)(k.SplitProvider,{children:(0,d.jsxs)("div",{className:"flex h-screen overflow-hidden",children:[(0,d.jsx)(i.Sidebar,{}),(0,d.jsxs)("main",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[(0,d.jsx)(e.Suspense,{fallback:(0,d.jsx)("div",{className:"h-10 border-b bg-bg-subtle"}),children:(0,d.jsx)(j.WorkspaceTabs,{})}),(0,d.jsx)(l.SplitArea,{children:a})]}),(0,d.jsx)(m.ChatPanel,{})]})})}},47933:(a,b,c)=>{"use strict";c.d(b,{ChatPanel:()=>z,Q:()=>w,p:()=>x});var d=c(21124),e=c(38301),f=c(3991),g=c.n(f),h=c(42378),i=c(21393),j=c(99691),k=c(90386),l=c(44394),m=c(61129),n=c(38231),o=c(12893),p=c(81922),q=c(66277),r=c(13330),s=c(45478),t=c(44943),u=c(13133),v=c(39866);let w="ma-ai-toggle",x="ma-ai-state",y=()=>({id:Math.random().toString(36).slice(2,10),title:"New chat",msgs:[],ctx:null,busy:!1,input:""});function z(){let[a,b]=(0,e.useState)(!1),[c,f]=(0,e.useState)(!1);return c?(0,d.jsx)(A,{hidden:!a,onClose:()=>window.dispatchEvent(new Event(w))}):null}function A({hidden:a,onClose:b}){let c,f=(0,u.yj)(),p=function(){let a=(0,h.usePathname)().split("/").filter(Boolean).map(decodeURIComponent);return(0,e.useMemo)(()=>"c"===a[0]&&a[1]&&!["shell","performance"].includes(a[2]??"")?{connectionId:a[1],db:a[2],coll:a[3]}:"c"===a[0]&&a[1]?{connectionId:a[1]}:{},[a[0],a[1],a[2],a[3]])}(),q=(0,i.I)({queryKey:["ai-providers"],queryFn:()=>(0,s.FH)("/api/ai/providers")}),r=(0,i.I)({queryKey:["ai-policy"],queryFn:()=>(0,s.FH)("/api/ai/policy")}),[w,x]=(0,e.useState)(()=>{try{let a=JSON.parse(sessionStorage.getItem("ma-ai-tabs")??"null");if(a?.length)return a.map(a=>({...a,busy:!1}))}catch{}return[y()]}),[z,A]=(0,e.useState)(()=>w[0].id),C=w.find(a=>a.id===z)??w[0],D=(a,b)=>x(c=>c.map(c=>c.id===a?b(c):c)),E=(0,e.useRef)(new Map),F=C.ctx??p,G=F.connectionId?r.data?.policies[F.connectionId]??"off":"any",H=(0,e.useMemo)(()=>(q.data?.providers??[]).filter(a=>"any"===G||"local"===G&&a.local),[q.data,G]),I=H.find(a=>a.id===(C.pid??(()=>{try{return localStorage.getItem("ma-ai-model")??""}catch{return""}})()))??H[0],J=(0,e.useRef)(null);async function K(a,b){let c=w.find(b=>b.id===a);if(!c||!b.trim()||!I||c.busy)return;let d=c.ctx??p,e=[...c.msgs.map(a=>({role:a.role,content:a.text||a.events.map(a=>"text"===a.type?a.text:"").join("\n").trim()||"(done)"})),{role:"user",content:b.trim()}].slice(-30);D(a,a=>({...a,ctx:d,busy:!0,input:"",pid:I.id,title:a.msgs.length?a.title:b.trim().slice(0,28)+(b.trim().length>28?"…":""),msgs:[...a.msgs,{role:"user",text:b.trim(),events:[]},{role:"assistant",text:"",events:[]}]}));let f=new AbortController;E.current.set(a,f);let g=b=>D(a,a=>{let c=[...a.msgs],d=c.at(-1);return c[c.length-1]={...d,events:[...d.events,b]},{...a,msgs:c}});try{let a=await fetch("/api/ai/chat",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({providerId:I.id,messages:e,context:d}),signal:f.signal});if(!a.ok||!a.body){let b=await a.json().catch(()=>({}));g({type:"error",message:b.error??`Request failed (${a.status})`});return}let b=a.body.getReader(),c=new TextDecoder,h="";for(;;){let a,{done:d,value:e}=await b.read();if(d)break;for(h+=c.decode(e,{stream:!0});(a=h.indexOf("\n"))>=0;){let b=h.slice(0,a);if(h=h.slice(a+1),!b.trim())continue;let c=JSON.parse(b);"done"!==c.type&&g(c)}}}catch(a){"AbortError"!==a.name&&g({type:"error",message:a.message})}finally{D(a,a=>({...a,busy:!1})),E.current.delete(a)}}async function L(a,b){let c=b=>x(c=>c.map(c=>({...c,msgs:c.msgs.map(c=>({...c,events:c.events.map(c=>"confirm"===c.type&&c.id===a?{...c,...b}:c)}))})));try{let d=await (0,s.FH)("/api/ai/confirm",{body:{id:a,run:b}});c({state:b?"done":"cancelled",result:b?JSON.stringify(d.result):void 0})}catch(a){c({state:"error",result:a.message})}}let M=a=>{let b;return a.coll?`${a.db} › ${a.coll}`:a.db??((b=a.connectionId)?f.data?.connections.find(a=>a.id===b)?.name??"…":void 0)??"All connections"},N=!!f.data?.user.isAdmin,O=!!C.ctx&&(c=C.ctx,c.connectionId!==p.connectionId||c.db!==p.db||c.coll!==p.coll),[P,Q]=(0,e.useState)(()=>{try{return Number(localStorage.getItem("ma-ai-w"))||400}catch{return 400}}),R=a=>{Q(a);try{localStorage.setItem("ma-ai-w",String(a))}catch{}};return(0,d.jsxs)("aside",{style:{width:Math.max(320,P)},className:(0,t.cn)("relative max-w-[70vw] shrink-0 flex-col border-l bg-panel",a?"hidden":"flex"),children:[(0,d.jsx)("div",{role:"separator","aria-orientation":"vertical","aria-label":"Resize chat",title:"Drag to resize \xb7 double-click to reset",onPointerDown:function(a){a.preventDefault();let b=a.currentTarget.parentElement,c=a.clientX,d=b.offsetWidth,e=Math.max(320,.7*window.innerWidth),f=d,g=0,h=a=>{f=Math.round(Math.min(e,Math.max(320,d+c-a.clientX))),g||(g=requestAnimationFrame(()=>{g=0,b.style.width=`${f}px`}))},i=()=>{window.removeEventListener("pointermove",h),window.removeEventListener("pointerup",i),cancelAnimationFrame(g),document.body.style.cursor="",document.body.style.userSelect="",R(f)};document.body.style.cursor="col-resize",document.body.style.userSelect="none",window.addEventListener("pointermove",h),window.addEventListener("pointerup",i)},onDoubleClick:()=>R(400),className:"group absolute -left-[4px] top-0 z-20 h-full w-[8px] cursor-col-resize",children:(0,d.jsx)("span",{className:"absolute inset-y-0 left-[3px] w-[2px] bg-transparent transition-colors delay-75 group-hover:bg-accent group-active:bg-accent"})}),(0,d.jsxs)("div",{className:"flex h-10 shrink-0 items-stretch border-b bg-bg-subtle",children:[(0,d.jsx)("div",{className:"scrollbar-thin flex min-w-0 flex-1 items-stretch overflow-x-auto",children:w.map(a=>{let b=a.id===C.id;return(0,d.jsxs)("div",{onClick:()=>A(a.id),title:a.ctx?M(a.ctx):"Follows the page you are on",className:(0,t.cn)("group relative flex max-w-[180px] shrink-0 cursor-pointer items-center gap-1.5 border-r pl-3 pr-1.5 text-[12.5px]",b?"bg-panel text-fg":"text-fg-muted hover:bg-bg-muted hover:text-fg"),children:[a.busy?(0,d.jsx)("span",{className:"h-1.5 w-1.5 shrink-0 animate-pulse rounded-full bg-accent"}):(0,d.jsx)(j.A,{className:(0,t.cn)("h-3.5 w-3.5 shrink-0",b?"text-accent":"text-fg-subtle")}),(0,d.jsx)("span",{className:(0,t.cn)("truncate",b&&"font-medium"),children:a.title}),(0,d.jsx)("button",{"aria-label":"Close chat",onClick:b=>{var c;b.stopPropagation(),c=a.id,E.current.get(c)?.abort(),x(a=>{let b=a.findIndex(a=>a.id===c),d=a.filter(a=>a.id!==c),e=d.length?d:[y()];return c===z&&A(e[Math.min(b,e.length-1)].id),e})},className:(0,t.cn)("flex h-5 w-5 shrink-0 items-center justify-center rounded hover:bg-bg-muted",b?"opacity-100":"opacity-0 group-hover:opacity-100"),children:(0,d.jsx)(k.A,{className:"h-3 w-3"})})]},a.id)})}),(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-0.5 px-1.5",children:[(0,d.jsx)("button",{title:"New chat",onClick:function(){let a=y();x(b=>[...b,a]),A(a.id)},className:"rounded p-1.5 text-fg-muted hover:bg-bg-muted hover:text-fg",children:(0,d.jsx)(l.A,{className:"h-4 w-4"})}),(0,d.jsx)("button",{title:"Close (⌘I)",onClick:b,className:"rounded p-1.5 text-fg-muted hover:bg-bg-muted hover:text-fg",children:(0,d.jsx)(k.A,{className:"h-4 w-4"})})]})]}),(0,d.jsxs)("div",{className:"scrollbar-thin flex-1 overflow-auto px-3 py-3",children:[0===C.msgs.length&&(0,d.jsxs)("div",{className:"mt-6 text-center",children:[(0,d.jsx)(j.A,{className:"mx-auto h-7 w-7 text-accent"}),(0,d.jsx)("p",{className:"mt-2 text-[13.5px] font-medium",children:"Ask anything about your data"}),(0,d.jsx)("p",{className:"mx-auto mt-1 max-w-[280px] text-[12px] text-fg-muted",children:"It reads with your permissions. Changes wait for your Confirm. Open more tabs to ask about other databases."}),H.length>0&&(0,d.jsx)("div",{className:"mt-4 space-y-1.5",children:(F.coll?["Describe this collection's fields","How many documents were added in the last 7 days?","Why could queries on this collection be slow?"]:["What databases and collections do I have?","Which collections are the biggest?"]).map(a=>(0,d.jsx)("button",{onClick:()=>K(C.id,a),className:"block w-full rounded-md border px-3 py-2 text-left text-[12.5px] text-fg-muted hover:border-accent/50 hover:text-fg",children:a},a))})]}),C.msgs.map((a,b)=>(0,d.jsx)("div",{className:(0,t.cn)("mb-3","user"===a.role&&"flex justify-end"),children:"user"===a.role?(0,d.jsx)("div",{className:"max-w-[85%] whitespace-pre-wrap rounded-lg bg-accent-soft px-3 py-2 text-[13px]",children:a.text}):(0,d.jsxs)("div",{className:"space-y-2 text-[13px]",children:[a.events.map((a,b)=>(0,d.jsx)(B,{e:a,onDecide:L},b)),C.busy&&b===C.msgs.length-1&&(0,d.jsxs)("p",{className:"flex items-center gap-1.5 text-[12px] text-fg-subtle",children:[(0,d.jsx)("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-accent"}),"Working…"]})]})},b)),(0,d.jsx)("div",{ref:J})]}),(0,d.jsx)("div",{className:"border-t p-2.5",children:q.data&&0===H.length?(0,d.jsxs)("p",{className:"rounded-md bg-bg-subtle px-3 py-2.5 text-[12px] text-fg-muted",children:["off"===G?"AI is turned off for this connection.":"local"===G?"This connection allows only local / self-hosted models, and none is set up.":"No AI model is set up yet."," ",N?(0,d.jsx)(g(),{href:"/ai",className:"text-accent underline",children:"any"===G?"Set up a model":"Change in AI settings"}):"Ask an admin."]}):(0,d.jsxs)("div",{className:"rounded-lg border bg-bg focus-within:border-accent focus-within:ring-2 focus-within:ring-accent/15",children:[(0,d.jsxs)("div",{className:"flex items-center gap-1 px-2 pt-2 text-[11px]",children:[(0,d.jsxs)("span",{title:C.ctx?"This chat is about":"Follows the page you are on",className:"flex min-w-0 items-center gap-1 rounded bg-bg-muted px-1.5 py-0.5 text-fg-muted",children:[(0,d.jsx)(m.A,{className:"h-3 w-3 shrink-0"}),(0,d.jsx)("span",{className:"truncate",children:M(F)})]}),O&&(0,d.jsx)("button",{onClick:()=>D(C.id,a=>({...a,ctx:p})),title:`Switch this chat to ${M(p)}`,className:"shrink-0 rounded px-1.5 py-0.5 text-accent hover:bg-accent-soft",children:"Use this page"})]}),(0,d.jsx)("textarea",{autoFocus:!0,value:C.input,onChange:a=>{let b=a.target.value;D(C.id,a=>({...a,input:b}))},onKeyDown:a=>{"Enter"!==a.key||a.shiftKey||(a.preventDefault(),K(C.id,C.input))},rows:2,placeholder:"Ask about your data…",className:"block w-full resize-none bg-transparent px-3 pt-2 text-[13px] outline-none placeholder:text-fg-subtle"},C.id),(0,d.jsxs)("div",{className:"flex items-center gap-2 px-2 pb-2",children:[(0,d.jsx)("div",{className:"w-[190px]",children:I&&(0,d.jsx)(v.L,{value:I.id,onChange:a=>{D(C.id,b=>({...b,pid:a}));try{localStorage.setItem("ma-ai-model",a)}catch{}},options:H.map(a=>({value:a.id,label:a.name,hint:a.local?"local":void 0})),className:"h-7"})}),"local"===G&&(0,d.jsx)("span",{className:"text-[10.5px] text-fg-subtle",title:"Admin rule for this connection",children:"local only"}),C.busy?(0,d.jsx)("button",{title:"Stop",onClick:()=>E.current.get(C.id)?.abort(),className:"ml-auto flex h-7 w-7 items-center justify-center rounded-md bg-fg text-bg",children:(0,d.jsx)(n.A,{className:"h-3 w-3"})}):(0,d.jsx)("button",{title:"Send (Enter)",disabled:!C.input.trim()||!I,onClick:()=>K(C.id,C.input),className:"ml-auto flex h-7 w-7 items-center justify-center rounded-md bg-accent text-accent-fg disabled:opacity-40",children:(0,d.jsx)(o.A,{className:"h-4 w-4"})})]})]})})]})}function B({e:a,onDecide:b}){let[c,f]=(0,e.useState)(!1);return"text"===a.type?(0,d.jsx)(C,{text:a.text}):"error"===a.type?(0,d.jsx)("p",{className:"rounded-md bg-danger-soft px-3 py-2 text-[12.5px] text-danger",children:a.message}):"tool"===a.type?(0,d.jsxs)("div",{className:"rounded-md border bg-bg-subtle text-[12px]",children:[(0,d.jsxs)("button",{onClick:()=>f(a=>!a),className:"flex w-full items-center gap-1.5 px-2.5 py-1.5 text-left text-fg-muted hover:text-fg",children:[(0,d.jsx)(p.A,{className:(0,t.cn)("h-3.5 w-3.5 transition-transform",c&&"rotate-90")}),(0,d.jsx)(q.A,{className:"h-3 w-3"}),(0,d.jsx)("span",{className:"font-mono",children:a.name}),!a.ok&&(0,d.jsx)("span",{className:"ml-auto text-danger",children:"failed"})]}),c&&(0,d.jsxs)("div",{className:"space-y-1.5 border-t px-2.5 py-2 font-mono text-[11px]",children:[(0,d.jsx)("pre",{className:"scrollbar-thin max-h-40 overflow-auto whitespace-pre-wrap break-all text-fg-muted",children:JSON.stringify(a.input,null,2)}),(0,d.jsx)("pre",{className:(0,t.cn)("scrollbar-thin max-h-56 overflow-auto whitespace-pre-wrap break-all",a.ok?"text-fg":"text-danger"),children:a.output})]})]}):(0,d.jsxs)("div",{className:"rounded-lg border border-[#d97706]/40 bg-[color-mix(in_srgb,#d97706_8%,var(--panel))] p-3",children:[(0,d.jsx)("p",{className:"text-[12.5px] font-medium",children:a.summary}),a.state?(0,d.jsxs)("p",{className:(0,t.cn)("mt-1.5 flex items-center gap-1 text-[12px]","error"===a.state?"text-danger":"text-fg-muted"),children:["done"===a.state&&(0,d.jsx)(r.A,{className:"h-3.5 w-3.5 text-accent"}),"done"===a.state?`Done ${a.result??""}`:"cancelled"===a.state?"Cancelled, nothing changed.":a.result]}):(0,d.jsxs)("div",{className:"mt-2 flex gap-2",children:[(0,d.jsx)("button",{onClick:()=>b(a.id,!0),className:"rounded-md bg-accent px-3 py-1 text-[12px] font-medium text-accent-fg",children:"Confirm"}),(0,d.jsx)("button",{onClick:()=>b(a.id,!1),className:"rounded-md border px-3 py-1 text-[12px]",children:"Cancel"})]})]})}function C({text:a}){let b=[],c=a.split("\n");for(let a=0;a<c.length;){let f=c[a];if(f.startsWith("```")){let e=[];for(a++;a<c.length&&!c[a].startsWith("```");a++)e.push(c[a]);a++,b.push((0,d.jsx)("pre",{className:"scrollbar-thin overflow-x-auto rounded-md bg-bg-subtle p-2.5 font-mono text-[11.5px]",children:e.join("\n")},a))}else if(f.trim().startsWith("|")){let e=[];for(;a<c.length&&c[a].trim().startsWith("|");a++)/^\s*\|[\s:|-]+\|\s*$/.test(c[a])||e.push(c[a].trim().replace(/^\||\|$/g,"").split("|").map(a=>a.trim()));b.push((0,d.jsx)("div",{className:"scrollbar-thin overflow-x-auto rounded-md border",children:(0,d.jsx)("table",{className:"w-full text-[12px]",children:(0,d.jsx)("tbody",{children:e.map((a,b)=>(0,d.jsx)("tr",{className:(0,t.cn)("border-b last:border-b-0",0===b&&"bg-bg-subtle font-medium"),children:a.map((a,b)=>(0,d.jsx)("td",{className:"px-2.5 py-1.5",children:D(a)},b))},b))})})},a))}else if(/^\s*([-*]|\d+\.)\s/.test(f)){let e=[];for(;a<c.length&&/^\s*([-*]|\d+\.)\s/.test(c[a]);a++)e.push(c[a].replace(/^\s*([-*]|\d+\.)\s/,""));b.push((0,d.jsx)("ul",{className:"list-disc space-y-0.5 pl-5",children:e.map((a,b)=>(0,d.jsx)("li",{children:D(a)},b))},a))}else if(f.trim()){let f=[];for(;a<c.length&&c[a].trim()&&!c[a].trim().startsWith("|")&&!c[a].startsWith("```")&&!/^\s*([-*]|\d+\.)\s/.test(c[a]);a++)f.push(c[a].replace(/^#+\s*/,""));b.push((0,d.jsx)("p",{className:"leading-[1.55]",children:f.map((a,b)=>(0,d.jsxs)(e.Fragment,{children:[b>0&&(0,d.jsx)("br",{}),D(a)]},b))},a))}else a++}return(0,d.jsx)("div",{className:"space-y-2",children:b})}function D(a){return a.split(/(\*\*[^*]+\*\*|`[^`]+`)/g).map((a,b)=>a.startsWith("**")&&a.endsWith("**")?(0,d.jsx)("b",{className:"font-semibold",children:a.slice(2,-2)},b):a.startsWith("`")&&a.endsWith("`")?(0,d.jsx)("code",{className:"rounded bg-bg-muted px-1 font-mono text-[12px]",children:a.slice(1,-1)},b):a)}},48028:(a,b,c)=>{"use strict";c.d(b,{Ex:()=>h,I2:()=>l,Sv:()=>k,aV:()=>j,y$:()=>i});var d=c(21124),e=c(16816),f=c(37387),g=c(44943);function h({children:a,tone:b="neutral",className:c}){return(0,d.jsx)("span",{className:(0,g.cn)("inline-flex items-center rounded px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide",{neutral:"bg-bg-muted text-fg-muted",accent:"bg-accent-soft text-accent",danger:"bg-danger-soft text-danger",warn:"bg-warn-soft text-warn"}[b],c),children:a})}function i({className:a}){return(0,d.jsx)(e.A,{className:(0,g.cn)("h-4 w-4 animate-spin text-fg-subtle",a)})}function j({error:a}){return a?(0,d.jsxs)("div",{className:"flex items-start gap-2 rounded-md border border-danger/30 bg-danger-soft px-3 py-2 text-xs text-danger",children:[(0,d.jsx)(f.A,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),(0,d.jsx)("span",{className:"break-words",children:a instanceof Error?a.message:String(a)})]}):null}function k({title:a,children:b}){return(0,d.jsxs)("div",{className:"flex flex-col items-center justify-center gap-1 py-16 text-center",children:[(0,d.jsx)("p",{className:"text-sm font-medium text-fg",children:a}),b&&(0,d.jsx)("div",{className:"text-xs text-fg-muted",children:b})]})}function l({value:a,onChange:b,items:c}){return(0,d.jsx)("div",{className:"inline-flex rounded-md border border-border-strong p-0.5",children:c.map(c=>(0,d.jsx)("button",{onClick:()=>b(c.value),className:(0,g.cn)("flex h-6 items-center gap-1 rounded px-2 text-xs",a===c.value?"bg-bg-muted font-medium text-fg":"text-fg-muted hover:text-fg"),children:c.label},c.value))})}},51472:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>k,metadata:()=>j});var d=c(75338),e=c(76555),f=c.n(e),g=c(84418),h=c.n(g);c(61135);var i=c(31679);let j={title:"MongoAdmin",description:"Self-hosted MongoDB admin with roles",robots:{index:!1,follow:!1}};function k({children:a}){return(0,d.jsx)("html",{lang:"en",suppressHydrationWarning:!0,children:(0,d.jsx)("body",{className:`${f().variable} ${h().variable} font-sans`,children:(0,d.jsx)(i.Providers,{children:a})})})}},51609:(a,b,c)=>{"use strict";c.d(b,{G:()=>n,X:()=>o});var d=c(21124),e=c(38301),f=c(42378),g=c(96610),h=c(42830),i=c(45478),j=c(40068),k=c(35284),l=c(93758),m=c(48028);function n({open:a,onClose:b,cid:c}){let[n,o]=(0,e.useState)(""),[p,q]=(0,e.useState)(""),[r,s]=(0,e.useState)(null),[t,u]=(0,e.useState)(!1),v=(0,g.jE)(),w=(0,f.useRouter)();async function x(){u(!0),s(null);try{await (0,i.FH)(`/api/c/${c}/databases`,{body:{db:n,collection:p}}),await v.invalidateQueries({queryKey:["tree",c]}),h.oR.success(`Database ${n} created`),b(),w.push(`/c/${c}/${(0,i.fk)(n)}/${(0,i.fk)(p)}`)}catch(a){s(a)}finally{u(!1)}}return(0,d.jsx)(j.l,{open:a,onClose:b,title:"Create database",footer:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(k.$,{onClick:b,children:"Cancel"}),(0,d.jsx)(k.$,{variant:"primary",loading:t,disabled:!n||!p,onClick:x,children:"Create database"})]}),children:(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsx)(l.D0,{label:"Database name",children:(0,d.jsx)(l.pd,{value:n,onChange:a=>o(a.target.value),autoFocus:!0})}),(0,d.jsx)(l.D0,{label:"First collection name",hint:"MongoDB creates a database together with its first collection.",children:(0,d.jsx)(l.pd,{value:p,onChange:a=>q(a.target.value)})}),(0,d.jsx)(m.aV,{error:r})]})})}function o({open:a,onClose:b,cid:c,db:n}){let[o,p]=(0,e.useState)(""),[q,r]=(0,e.useState)("normal"),[s,t]=(0,e.useState)("10485760"),[u,v]=(0,e.useState)("timestamp"),[w,x]=(0,e.useState)(""),[y,z]=(0,e.useState)("seconds"),[A,B]=(0,e.useState)(""),[C,D]=(0,e.useState)(null),[E,F]=(0,e.useState)(!1),G=(0,g.jE)(),H=(0,f.useRouter)();async function I(){F(!0),D(null);try{let a={name:o};"capped"===q&&(a.capped={size:Number(s)}),"timeseries"===q&&(a.timeseries={timeField:u,metaField:w||void 0,granularity:y}),"clustered"===q&&(a.clusteredIndex=!0),A&&("timeseries"===q||"clustered"===q)&&(a.expireAfterSeconds=Number(A)),await (0,i.FH)(`/api/c/${c}/${(0,i.fk)(n)}/collections`,{body:a}),await G.invalidateQueries({queryKey:["tree",c]}),h.oR.success(`Collection ${o} created`),b(),H.push(`/c/${c}/${(0,i.fk)(n)}/${(0,i.fk)(o)}`)}catch(a){D(a)}finally{F(!1)}}return(0,d.jsx)(j.l,{open:a,onClose:b,title:`Create collection in ${n}`,footer:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(k.$,{onClick:b,children:"Cancel"}),(0,d.jsx)(k.$,{variant:"primary",loading:E,disabled:!o,onClick:I,children:"Create collection"})]}),children:(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsx)(l.D0,{label:"Collection name",children:(0,d.jsx)(l.pd,{value:o,onChange:a=>p(a.target.value),autoFocus:!0})}),(0,d.jsx)(l.D0,{label:"Type",children:(0,d.jsxs)(l.l6,{value:q,onChange:a=>r(a.target.value),children:[(0,d.jsx)("option",{value:"normal",children:"Standard"}),(0,d.jsx)("option",{value:"capped",children:"Capped"}),(0,d.jsx)("option",{value:"timeseries",children:"Time series"}),(0,d.jsx)("option",{value:"clustered",children:"Clustered index"})]})}),"capped"===q&&(0,d.jsx)(l.D0,{label:"Max size (bytes)",children:(0,d.jsx)(l.pd,{value:s,onChange:a=>t(a.target.value),inputMode:"numeric"})}),"timeseries"===q&&(0,d.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,d.jsx)(l.D0,{label:"Time field",children:(0,d.jsx)(l.pd,{value:u,onChange:a=>v(a.target.value)})}),(0,d.jsx)(l.D0,{label:"Meta field (optional)",children:(0,d.jsx)(l.pd,{value:w,onChange:a=>x(a.target.value)})}),(0,d.jsx)(l.D0,{label:"Granularity",children:(0,d.jsxs)(l.l6,{value:y,onChange:a=>z(a.target.value),children:[(0,d.jsx)("option",{children:"seconds"}),(0,d.jsx)("option",{children:"minutes"}),(0,d.jsx)("option",{children:"hours"})]})})]}),("timeseries"===q||"clustered"===q)&&(0,d.jsx)(l.D0,{label:"Expire after seconds (optional)",children:(0,d.jsx)(l.pd,{value:A,onChange:a=>B(a.target.value),inputMode:"numeric"})}),(0,d.jsx)(m.aV,{error:C})]})})}},52945:(a,b,c)=>{"use strict";c.d(b,{OI:()=>k,SplitProvider:()=>j,h9:()=>l,qw:()=>m});var d=c(21124),e=c(38301),f=c(42378);let g=(0,e.createContext)({panes:[],open:()=>{},close:()=>{},closeAll:()=>{},countFor:()=>0,forget:()=>{},mainAt:0,reorder:()=>{}}),h=(0,e.createContext)({open:()=>{},close:()=>{},closeAll:()=>{},forget:()=>{},reorder:()=>{}}),i="ma-split-tabs";function j({children:a}){let b=(0,f.usePathname)(),c=(0,e.useRef)(b);c.current=b;let[j,k]=(0,e.useState)({}),[l,m]=(0,e.useState)({}),n=(0,e.useCallback)((a,b)=>m(c=>{let d={...c,[a]:b};b||delete d[a];try{sessionStorage.setItem(`${i}-main`,JSON.stringify(d))}catch{}return d}),[]),o=(0,e.useCallback)(a=>k(b=>{let c=a(b);for(let a of Object.keys(c))c[a].length||delete c[a];try{sessionStorage.setItem(i,JSON.stringify(c))}catch{}return c}),[]),p=(0,e.useCallback)(a=>o(b=>{let d=c.current,e=b[d]??[];return e.some(b=>b.cid===a.cid&&b.db===a.db&&b.coll===a.coll)?b:{...b,[d]:[...e,{...a,id:`${Date.now().toString(36)}${Math.random().toString(36).slice(2,6)}`}].slice(-6)}}),[o]),q=(0,e.useCallback)(a=>o(b=>({...b,[c.current]:(b[c.current]??[]).filter(b=>b.id!==a)})),[o]),r=(0,e.useCallback)(()=>{let a=c.current;o(b=>({...b,[a]:[]})),n(a,0)},[o,n]),s=(0,e.useCallback)(a=>{o(b=>({...b,[a]:[]})),n(a,0)},[o,n]),t=(0,e.useCallback)(a=>{let b=c.current;o(c=>{let d=new Map((c[b]??[]).map(a=>[a.id,a]));return{...c,[b]:a.filter(a=>"main"!==a).map(a=>d.get(a)).filter(Boolean)}}),n(b,Math.max(0,a.indexOf("main")))},[o,n]),u=(0,e.useCallback)(a=>j[a]?.length??0,[j]),v=(0,e.useMemo)(()=>j[b]??[],[j,b]),w=Math.min(l[b]??0,v.length),x=(0,e.useMemo)(()=>({open:p,close:q,closeAll:r,forget:s,reorder:t}),[p,q,r,s,t]),y=(0,e.useMemo)(()=>({panes:v,countFor:u,mainAt:w,...x}),[v,u,w,x]);return(0,d.jsx)(h.Provider,{value:x,children:(0,d.jsx)(g.Provider,{value:y,children:a})})}let k=()=>(0,e.useContext)(g),l=()=>(0,e.useContext)(h);function m(){return(0,e.useContext)(g).panes.length>0}},54794:(a,b,c)=>{"use strict";c.d(b,{d:()=>h});var d=c(21124),e=c(38301);let f=/("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*')|\b(ObjectId|ISODate|NumberLong|NumberDecimal|NumberInt|Double|UUID|BinData|Timestamp|MinKey|MaxKey)\b|(-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b)|\b(true|false)\b|\b(null|undefined)\b|([A-Za-z_$][\w$]*)(?=\s*:)|([{}[\](),:])/g,g=/^\s*:/,h=(0,e.memo)(function({text:a}){let b,c=[],e=0,h=0;for(f.lastIndex=0;b=f.exec(a);){b.index>e&&c.push(a.slice(e,b.index));let[f,i,j,k,l,m,n,o]=b,p="";void 0!==i?p=g.test(a.slice(b.index+f.length))?"t-key font-semibold":"t-string":j?p="ISODate"===j||"Timestamp"===j?"t-date":j.startsWith("Number")||"Double"===j?"t-number":"t-oid":k?p="t-number":l?p="t-bool":m?p="t-null":n?p="t-key font-semibold":o&&(p="text-fg-subtle"),c.push((0,d.jsx)("span",{className:p,children:f},h++)),e=b.index+f.length}return e<a.length&&c.push(a.slice(e)),(0,d.jsx)(d.Fragment,{children:c})})},57093:(a,b,c)=>{"use strict";c.d(b,{Sidebar:()=>Z});var d=c(21124),e=c(11502),f=c(3991),g=c.n(f),h=c(42378),i=c(38301),j=c(67384),k=c(15903),l=c(44394),m=c(11691),n=c(80207),o=c(23062),p=c(78276),q=c(3821),r=c(99691),s=c(49330),t=c(14921),u=c(94741),v=c(72572),w=c(12708),x=c(79401),y=c(43993),z=c(13330),A=c(76870),B=c(50042),C=c(15856),D=c(81922),E=c(78595),F=c(4434),G=c(37129),H=c(61129),I=c(51553),J=c(99907),K=c(63722),L=c(21393),M=c(96610),N=c(44943),O=c(45478),P=c(13133),Q=c(18304),R=c(48028),S=c(51609),T=c(16128),U=c(52945),V=c(47933),W=c(40068),X=c(60028);let Y={production:"bg-red-500",staging:"bg-amber-500",development:"bg-emerald-500"};function Z(){let a=(0,P.yj)(),b=(0,h.useRouter)(),c=(0,h.usePathname)(),[f,p]=(0,i.useState)(""),[q,r]=(0,i.useState)(0),[s,t]=(0,i.useState)(!1),[u,v]=(0,i.useState)(!1),w=!!a.data?.user.isAdmin,x=a.data?.connections.length??0,y=(0,i.useDeferredValue)(f.trim().toLowerCase()),z=(0,i.useRef)(null);async function A(){await (0,O.FH)("/api/auth/logout",{body:{}}).catch(()=>void 0),b.replace("/login")}return(0,d.jsxs)("aside",{className:"flex w-[260px] shrink-0 flex-col border-r bg-sidebar",children:[(0,d.jsx)("div",{className:"flex h-10 shrink-0 items-center gap-0.5 border-b px-3",children:(0,d.jsxs)(g(),{href:"/",className:"mr-auto flex items-center gap-1.5",children:[(0,d.jsx)(e.A,{className:"h-[18px] w-[18px] text-accent"}),(0,d.jsx)("span",{className:"text-[13.5px] font-semibold tracking-tight",children:"Mongo Admin"})]})}),(0,d.jsxs)("div",{className:"px-3 pt-2.5",children:[(0,d.jsxs)("div",{className:"flex items-center gap-1",children:[(0,d.jsx)("span",{className:"text-[11px] font-bold uppercase tracking-wider text-fg-muted",children:"Connections"}),(0,d.jsx)("span",{className:"text-[11px] text-fg-subtle",children:x}),(0,d.jsxs)("div",{className:"relative ml-auto flex items-center gap-0.5",children:[(0,d.jsx)(ab,{title:"Show current item in the sidebar",onClick:function(){p(""),Date.now(),window.dispatchEvent(new Event("ma-reveal"));let a=0,b=()=>{let c=z.current,d=c?.querySelector("[data-current='deep']");if(!d&&a++<80)return void setTimeout(b,100);let e=d??c?.querySelector("[data-current]");e&&(e.scrollIntoView({block:"center",behavior:"smooth"}),e.classList.remove("ma-flash"),e.offsetWidth,e.classList.add("ma-flash"))};requestAnimationFrame(b)},children:(0,d.jsx)(j.A,{className:"h-3.5 w-3.5"})}),(0,d.jsx)(ab,{title:"Collapse all",onClick:()=>r(a=>a+1),children:(0,d.jsx)(k.A,{className:"h-3.5 w-3.5"})}),w&&(0,d.jsx)(ab,{title:"Add new connection",onClick:()=>b.push("/admin/connections?new=1"),children:(0,d.jsx)(l.A,{className:"h-4 w-4"})}),(0,d.jsx)(ab,{title:"More",onClick:()=>t(a=>!a),children:(0,d.jsx)(m.A,{className:"h-4 w-4"})}),s&&(0,d.jsxs)("div",{className:"absolute right-0 top-7 z-20 w-44 rounded-md border bg-panel py-1 text-xs shadow-lg",onMouseLeave:()=>t(!1),children:[w&&(0,d.jsx)(g(),{href:"/admin/connections",className:"block px-3 py-1.5 hover:bg-bg-muted",children:"Manage connections"}),(0,d.jsxs)("button",{onClick:()=>{t(!1),v(!0)},className:"flex w-full items-center gap-2 px-3 py-1.5 text-left hover:bg-bg-muted",children:[(0,d.jsx)(n.A,{className:"h-3.5 w-3.5"}),"Sign out"]})]})]})]}),(0,d.jsxs)("div",{className:"relative mt-1.5",children:[(0,d.jsx)(o.A,{className:"absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-fg-subtle"}),(0,d.jsx)("input",{value:f,onChange:a=>p(a.target.value),placeholder:"Search connections",className:"h-7 w-full rounded-md border bg-panel pl-7 pr-2 text-[12.5px] placeholder:text-fg-subtle focus:border-accent focus:outline-none focus:ring-2 focus:ring-accent/20"})]})]}),(0,d.jsxs)("div",{ref:z,className:"scrollbar-thin mt-1.5 flex-1 overflow-auto pb-2",children:[a.isLoading&&(0,d.jsx)(R.y$,{className:"m-3"}),0===x&&a.data&&(0,d.jsxs)("p",{className:"px-4 py-3 text-xs text-fg-muted",children:["No connections yet. ",w?(0,d.jsx)(g(),{className:"text-accent underline",href:"/admin/connections?new=1",children:"Add one"}):"Ask an admin for access."]}),a.data?.connections.map(a=>(0,d.jsx)(ad,{conn:a,filter:y},`${a.id}-${q}`))]}),(0,d.jsx)($,{me:a.data,isAdmin:w,pathname:c,onSignOut:()=>v(!0)}),(0,d.jsx)(W.T,{open:u,onClose:()=>v(!1),onConfirm:A,title:"Sign out?",message:"You will need to sign in again to use MongoAdmin.",confirmLabel:"Sign out"})]})}function $({me:a,isAdmin:b,pathname:c,onSignOut:e}){let[f,h]=(0,i.useState)(!1),j=(0,i.useRef)(null),{dark:k,setDark:l}=(0,Q.DP)(),m=(0,L.I)({queryKey:["security"],queryFn:()=>(0,O.FH)("/api/admin/security"),refetchInterval:3e4,enabled:b}).data?.pending??0,o=a?.user.name||a?.user.email||"…",z=a?.user.isSuperAdmin?"Super admin":a?.user.isAdmin?"Admin":"Member",A=a=>(0,d.jsx)("span",{className:(0,N.cn)("flex shrink-0 items-center justify-center rounded-full bg-accent font-semibold uppercase text-accent-fg",a),children:o.slice(0,1)}),B=(a,b,e,f,i)=>{let j=null!==a&&("/"===a?"/"===c:c.startsWith(a)),k=(0,N.cn)("flex w-full items-center gap-2.5 rounded-md px-2 py-1.5 text-left text-[12.5px] transition-colors",j?"bg-accent-soft font-medium text-accent":"text-fg-muted hover:bg-bg-muted hover:text-fg");return a?(0,d.jsxs)(g(),{href:a,className:k,children:[b,(0,d.jsx)("span",{className:"flex-1",children:e}),f]},e):(0,d.jsxs)("button",{onClick:()=>{h(!1),i?.()},className:k,children:[b,(0,d.jsx)("span",{className:"flex-1",children:e}),f]},e)},C="h-3.5 w-3.5 shrink-0";return(0,d.jsxs)("div",{ref:j,className:"relative border-t p-2",children:[f&&(0,d.jsxs)("div",{className:"ma-pop absolute bottom-full left-2 right-2 z-50 mb-1.5 overflow-hidden rounded-lg border bg-panel shadow-[0_8px_30px_rgba(0,0,0,0.12)]",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2.5 px-3 py-2.5",children:[A("h-8 w-8 text-[12px]"),(0,d.jsxs)("div",{className:"min-w-0 flex-1 leading-tight",children:[(0,d.jsx)("p",{className:"truncate text-[13px] font-medium",children:a?.user.name||z}),(0,d.jsxs)("p",{className:"truncate text-[11.5px] text-fg-subtle",children:[a?.user.email," \xb7 ",z]})]})]}),(0,d.jsxs)("div",{className:"space-y-2.5 border-t px-3 py-2.5",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,d.jsx)("span",{className:"text-[12px] text-fg-muted",children:"Theme"}),(0,d.jsx)("div",{className:"flex items-center rounded-md bg-bg-muted p-0.5",role:"radiogroup","aria-label":"Theme",children:[[!1,"Light",p.A],[!0,"Dark",q.A]].map(([a,b,c])=>(0,d.jsxs)("button",{role:"radio","aria-checked":k===a,onClick:()=>l(a),className:(0,N.cn)("flex h-6 items-center gap-1 rounded px-2 text-[11.5px] transition-colors",k===a?"bg-panel text-fg shadow-sm":"text-fg-subtle hover:text-fg"),children:[(0,d.jsx)(c,{className:"h-3 w-3"}),b]},b))})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{className:"mb-1.5 block text-[12px] text-fg-muted",children:"Colour"}),(0,d.jsx)(_,{})]})]}),(0,d.jsxs)("div",{className:"border-t p-1",children:[B(null,(0,d.jsx)(r.A,{className:C}),"Ask AI",(0,d.jsx)("kbd",{className:"text-[10px] text-fg-subtle",children:"chat"}),()=>window.dispatchEvent(new Event(V.Q))),B("/queries",(0,d.jsx)(s.A,{className:C}),"My Queries"),B("/ai",(0,d.jsx)(t.A,{className:C}),"AI models & MCP")]}),b&&(0,d.jsxs)("div",{className:"border-t p-1",children:[B("/admin/users",(0,d.jsx)(u.A,{className:C}),"Users & roles"),B("/admin/audit",(0,d.jsx)(v.A,{className:C}),"Audit log"),B("/admin/security",(0,d.jsx)(w.A,{className:C}),"Security & approvals",m>0?(0,d.jsx)("span",{className:"rounded-full bg-danger px-1.5 text-[10px] font-bold text-white",children:m>9?"9+":m}):void 0),B("/admin/connections",(0,d.jsx)(x.A,{className:C}),"Connections")]}),(0,d.jsx)("div",{className:"border-t p-1",children:(0,d.jsxs)("button",{onClick:()=>{h(!1),e()},className:"flex w-full items-center gap-2.5 rounded-md px-2 py-1.5 text-[12.5px] text-fg-muted transition-colors hover:bg-danger-soft hover:text-danger",children:[(0,d.jsx)(n.A,{className:C}),"Sign out"]})})]}),(0,d.jsxs)("button",{onClick:()=>h(a=>!a),"aria-expanded":f,className:(0,N.cn)("flex w-full items-center gap-2.5 rounded-lg px-2 py-1.5 text-left transition-colors hover:bg-bg-muted",f&&"bg-bg-muted"),children:[(0,d.jsxs)("span",{className:"relative",children:[A("h-7 w-7 text-[11px]"),b&&m>0&&(0,d.jsx)("span",{className:"absolute -right-0.5 -top-0.5 h-2.5 w-2.5 rounded-full border-2 border-sidebar bg-danger",title:`${m} waiting for approval`})]}),(0,d.jsxs)("span",{className:"min-w-0 flex-1 leading-tight",children:[(0,d.jsx)("span",{className:"block truncate text-[13px] font-medium",children:o}),(0,d.jsx)("span",{className:"block truncate text-[11px] text-fg-subtle",children:z})]}),(0,d.jsx)(y.A,{className:"h-4 w-4 shrink-0 text-fg-subtle"})]})]})}function _(){let{dark:a,accent:b,setAccent:c}=(0,Q.DP)(),e=b.startsWith("#"),[f,g]=(0,i.useState)(!1),[h,j]=(0,i.useState)(e?b:"");return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"grid grid-cols-5 gap-2",children:[Object.entries(Q.KO).map(([e,f])=>(0,d.jsx)("button",{title:f.label,"aria-label":f.label,"aria-pressed":b===e,onClick:()=>{c(e),g(!1)},style:{backgroundColor:a?f.dark:f.light},className:(0,N.cn)("flex h-7 w-7 items-center justify-center rounded-full transition-transform hover:scale-110",b===e&&"ring-2 ring-fg/70 ring-offset-2 ring-offset-panel"),children:b===e&&(0,d.jsx)(z.A,{className:(0,N.cn)("h-3.5 w-3.5",a?"text-[#0b1220]":"text-white"),strokeWidth:3})},e)),(0,d.jsx)("button",{title:"Custom colour","aria-label":"Custom colour","aria-pressed":e,onClick:()=>g(a=>!a),style:e?{backgroundColor:b}:{background:"conic-gradient(#ef4444,#f59e0b,#22c55e,#06b6d4,#6366f1,#d946ef,#ef4444)"},className:(0,N.cn)("flex h-7 w-7 items-center justify-center rounded-full transition-transform hover:scale-110",(e||f)&&"ring-2 ring-fg/70 ring-offset-2 ring-offset-panel"),children:e?(0,d.jsx)(z.A,{className:"h-3.5 w-3.5 text-white",strokeWidth:3}):(0,d.jsx)(l.A,{className:"h-3.5 w-3.5 text-white drop-shadow",strokeWidth:3})})]}),f&&(0,d.jsxs)("div",{className:"mt-3 flex items-center gap-2 rounded-md border bg-bg-subtle p-1.5",children:[(0,d.jsx)("label",{className:"relative h-7 w-7 shrink-0 cursor-pointer overflow-hidden rounded-md border",style:{backgroundColor:Q.qR.test(h)?h:"transparent"},title:"Pick a colour",children:(0,d.jsx)("input",{type:"color",value:Q.qR.test(h)?h:"#115e59",onChange:a=>{j(a.target.value),c(a.target.value)},className:"absolute inset-0 h-full w-full cursor-pointer opacity-0"})}),(0,d.jsx)("input",{value:h,onChange:a=>{let b=a.target.value.trim();b&&!b.startsWith("#")&&(b="#"+b),j(b),Q.qR.test(b)&&c(b)},placeholder:"#115e59",maxLength:7,spellCheck:!1,"aria-label":"Hex colour",className:(0,N.cn)("h-7 min-w-0 flex-1 rounded border bg-panel px-2 font-mono text-[12px] uppercase outline-none focus:border-accent",h&&!Q.qR.test(h)&&"border-danger")})]})]})}function aa({label:a,kind:b,canDestroy:c,onRefresh:e,onDanger:f}){let[g,h]=(0,i.useState)(!1),j=a=>()=>{h(!1),a()};return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("button",{"aria-label":`${a} actions`,onClick:()=>h(a=>!a),className:(0,N.cn)("shrink-0 rounded p-0.5 text-fg-muted hover:bg-bg-muted hover:text-fg",g?"visible bg-bg-muted":"invisible group-hover/db:visible"),children:(0,d.jsx)(m.A,{className:"h-3.5 w-3.5"})}),g&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"fixed inset-0 z-40",onClick:()=>h(!1)}),(0,d.jsxs)("div",{className:"ma-pop absolute right-1 top-full z-50 mt-0.5 w-44 overflow-hidden rounded-md border bg-panel py-1 text-[12.5px] font-normal text-fg shadow-lg",children:[(0,d.jsxs)("button",{onClick:j(e),className:"flex w-full items-center gap-2 px-3 py-1.5 text-left hover:bg-bg-muted",children:[(0,d.jsx)(A.A,{className:"h-3.5 w-3.5 text-fg-muted"}),"Refresh"]}),c&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"my-1 border-t"}),"view"!==b&&(0,d.jsxs)("button",{onClick:j(()=>f("wipe")),className:"flex w-full items-center gap-2 px-3 py-1.5 text-left text-danger hover:bg-danger-soft",children:[(0,d.jsx)(B.A,{className:"h-3.5 w-3.5"}),"Wipe data"]}),(0,d.jsxs)("button",{onClick:j(()=>f("drop")),className:"flex w-full items-center gap-2 px-3 py-1.5 text-left text-danger hover:bg-danger-soft",children:[(0,d.jsx)(C.A,{className:"h-3.5 w-3.5"}),"Delete ",b]})]})]})]})]})}function ab({children:a,title:b,onClick:c}){return(0,d.jsx)("button",{title:b,onClick:c,className:"rounded p-1 text-fg-muted hover:bg-bg-muted hover:text-fg",children:a})}function ac({open:a}){return(0,d.jsx)(D.A,{className:(0,N.cn)("h-3.5 w-3.5 shrink-0 text-fg-subtle transition-transform duration-150",a&&"rotate-90")})}function ad({conn:a,filter:b}){let c=(0,h.useParams)(),e=c.cid===a.id,[f,j]=(0,i.useState)(e),k=(0,P.Wc)(f?a.id:void 0),m=(0,M.jE)(),[n,o]=(0,i.useState)(!1),p=(0,X.H)(a.color),q=a.name.toLowerCase().includes(b),r=(0,i.useMemo)(()=>{let a=k.data?.databases??[];return!b||q?a:a.map(a=>a.name.toLowerCase().includes(b)?a:{...a,collections:a.collections.filter(a=>a.name.toLowerCase().includes(b))}).filter(a=>a.name.toLowerCase().includes(b)||a.collections.length>0)},[k.data,b,q]);return(!b||q||!f||0!==r.length||k.isLoading)&&(!b||q||f)?(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{"data-current":e?c.db?"conn":"deep":void 0,style:p.rowStyle,className:(0,N.cn)("group flex h-7 items-center gap-1 pl-1.5 pr-1.5",e&&!c.db&&!p.hex&&"bg-accent-soft"),children:[(0,d.jsx)("button",{onClick:()=>j(a=>!a),className:"flex h-5 w-4 items-center justify-center","aria-label":f?"Collapse":"Expand",children:(0,d.jsx)(ac,{open:f})}),(0,d.jsxs)(g(),{href:`/c/${a.id}`,onClick:()=>j(!0),className:"flex min-w-0 flex-1 items-center gap-1.5",title:`${a.hostLabel} \xb7 ${a.environment} \xb7 role: ${a.role}`,children:[(0,d.jsx)(E.A,{className:"h-3.5 w-3.5 shrink-0 text-fg-muted"}),(0,d.jsx)("span",{className:"truncate text-[13px] font-medium",children:a.name}),(0,d.jsx)("span",{className:(0,N.cn)("h-1.5 w-1.5 shrink-0 rounded-full",Y[a.environment]),title:a.environment})]}),(0,d.jsxs)("div",{className:"hidden items-center gap-0.5 group-hover:flex",children:[(0,d.jsx)(g(),{href:`/c/${a.id}/shell`,title:"Open shell",className:"rounded p-1 text-fg-muted hover:bg-bg-muted hover:text-fg",children:(0,d.jsx)(F.A,{className:"h-3.5 w-3.5"})}),(0,d.jsx)(g(),{href:`/c/${a.id}/performance`,title:"Performance",className:"rounded p-1 text-fg-muted hover:bg-bg-muted hover:text-fg",children:(0,d.jsx)(G.A,{className:"h-3.5 w-3.5"})}),(0,d.jsx)("button",{title:"Refresh",onClick:()=>{j(!0),m.invalidateQueries({queryKey:["tree",a.id]})},className:"rounded p-1 text-fg-muted hover:bg-bg-muted hover:text-fg",children:(0,d.jsx)(A.A,{className:(0,N.cn)("h-3.5 w-3.5",k.isFetching&&"animate-spin")})}),(0,P.$3)(a.role,"admin")&&(0,d.jsx)("button",{title:"Create database",onClick:()=>o(!0),className:"rounded p-1 text-fg-muted hover:bg-bg-muted hover:text-fg",children:(0,d.jsx)(l.A,{className:"h-3.5 w-3.5"})})]})]}),f&&(0,d.jsxs)("div",{className:"pb-1",children:[k.isLoading&&(0,d.jsx)(R.y$,{className:"my-1 ml-8 h-3.5 w-3.5"}),k.error&&(0,d.jsx)("p",{className:"px-8 py-1 text-[11px] text-danger",children:k.error.message}),r.map(f=>(0,d.jsx)(ae,{cid:a.id,db:f,forceOpen:!!b&&!q,activeDb:e?c.db:void 0,activeColl:c.coll},f.name))]}),(0,d.jsx)(S.G,{open:n,onClose:()=>o(!1),cid:a.id})]}):null}let ae=(0,i.memo)(function({cid:a,db:b,forceOpen:c,activeDb:e,activeColl:f}){let j=void 0!==e&&decodeURIComponent(e)===b.name,[k,l]=(0,i.useState)(j),m=k||c,n=encodeURIComponent,o=(0,M.jE)(),[p,q]=(0,i.useState)(null),r=(0,U.h9)(),[s,t]=(0,i.useState)(200),u=j&&void 0!==f?decodeURIComponent(f):void 0,v=(0,i.useMemo)(()=>{let a=b.collections.slice(0,s),c=void 0===u||a.some(a=>a.name===u)?void 0:b.collections.find(a=>a.name===u);return c?[...a,c]:a},[b.collections,s,u]),w=(0,h.useRouter)();return(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{"data-current":j?f?"db":"deep":void 0,className:(0,N.cn)("group/db relative flex h-7 items-center gap-1 pl-5 pr-1",j&&!f?"bg-accent-soft text-accent":"hover:bg-bg-muted"),children:[(0,d.jsx)("button",{onClick:()=>l(a=>!a),className:"flex h-5 w-4 items-center justify-center",children:(0,d.jsx)(ac,{open:m})}),(0,d.jsxs)(g(),{href:`/c/${a}/${n(b.name)}`,onClick:()=>l(!0),className:"flex min-w-0 flex-1 items-center gap-1.5",title:`${b.name} \xb7 ${(0,N.z3)(b.sizeOnDisk)}`,children:[(0,d.jsx)(H.A,{className:"h-3.5 w-3.5 shrink-0 text-fg-muted"}),(0,d.jsx)("span",{className:"truncate text-[13px]",children:b.name})]}),(0,d.jsx)(aa,{label:b.name,kind:"database",canDestroy:!!b.canDestroy,onRefresh:()=>{o.invalidateQueries({queryKey:["tree",a]}),o.invalidateQueries({queryKey:["dbstats",a,b.name]}),o.invalidateQueries({queryKey:["collstats",a,b.name]})},onDanger:a=>q({action:a})})]}),p&&(0,d.jsx)(T.U,{cid:a,db:b.name,coll:p.coll,action:p.action,onClose:()=>q(null)}),m&&(0,d.jsxs)("div",{children:[v.map(c=>{let e=j&&void 0!==f&&decodeURIComponent(f)===c.name;return(0,d.jsxs)("div",{"data-current":e?"deep":void 0,className:(0,N.cn)("group/db relative flex h-7 items-center pr-1 text-[13px]",e?"bg-accent-soft font-medium text-accent":"text-fg hover:bg-bg-muted"),children:[(0,d.jsxs)(g(),{href:`/c/${a}/${n(b.name)}/${n(c.name)}`,className:"flex h-full min-w-0 flex-1 items-center gap-1.5 pl-[50px]",children:["view"===c.type?(0,d.jsx)(I.A,{className:"h-3.5 w-3.5 shrink-0 text-fg-muted"}):(0,d.jsx)(J.A,{className:"h-3.5 w-3.5 shrink-0 text-fg-muted"}),(0,d.jsx)("span",{className:"truncate",children:c.name})]}),(0,d.jsx)("button",{title:void 0!==f?"Open side by side in this tab":"Open (then use this button on others to compare side by side)","aria-label":`Open ${c.name} side by side`,onClick:()=>void 0!==f?r.open({cid:a,db:b.name,coll:c.name}):w.push(`/c/${a}/${n(b.name)}/${n(c.name)}`),className:"invisible shrink-0 rounded p-0.5 text-fg-muted hover:bg-bg-muted hover:text-fg group-hover/db:visible",children:(0,d.jsx)(K.A,{className:"h-3.5 w-3.5"})}),(0,d.jsx)(aa,{label:c.name,kind:"view"===c.type?"view":"collection",canDestroy:!!b.canDestroy&&!c.name.startsWith("system."),onRefresh:()=>{for(let d of(o.invalidateQueries({queryKey:["tree",a]}),["docs","count","collstats","schema","indexes"]))o.invalidateQueries({queryKey:[d,a,b.name,c.name]})},onDanger:a=>q({action:a,coll:c.name})})]},c.name)}),b.collections.length>s&&(0,d.jsxs)("button",{onClick:()=>t(a=>a+400),className:"h-7 pl-[50px] text-[11.5px] text-accent hover:underline",children:["Show ",Math.min(400,b.collections.length-s)," more of ",b.collections.length-s]}),0===b.collections.length&&(0,d.jsx)("p",{className:"py-1 pl-[50px] text-[11px] text-fg-subtle",children:"No collections"})]})]})})},59715:(a,b,c)=>{"use strict";c.d(b,{UU:()=>m,YL:()=>k,xn:()=>l});var d=c(21124),e=c(38301),f=c(81922),g=c(44943),h=c(2803),i=c(54794);let j=(0,e.createContext)({mode:"expand",n:0}),k=()=>(0,e.useContext)(j);function l({command:a,children:b}){return(0,d.jsx)(j.Provider,{value:a,children:b})}let m=(0,e.memo)(function({value:a,collapseRoot:b=!1,bare:c=!1}){if(c&&a&&"object"==typeof a&&!Array.isArray(a)&&"Object"===(0,h.I)(a)){let b=Object.entries(a);return(0,d.jsx)("div",{className:"font-mono text-[12px] leading-[18px] text-fg",children:b.map(([a,c],e)=>(0,d.jsx)(n,{name:a,value:c,depth:1,last:e===b.length-1},a))})}return(0,d.jsx)("div",{className:"font-mono text-[12px] leading-[18px] text-fg",children:(0,d.jsx)(n,{value:a,depth:0,last:!0,keepOpen:!b})})});function n({name:a,value:b,depth:c,last:k,keepOpen:l=!1}){let m=(0,e.useContext)(j),o=(0,h.I)(b),[p,q]=(0,e.useState)("expand"===m.mode||l),[r,s]=(0,e.useState)(100),t=k?"":(0,d.jsx)("span",{className:"text-fg-subtle",children:","}),u=void 0!==a&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"t-key font-semibold",children:/^[A-Za-z_$][\w$]*$/.test(a)?a:JSON.stringify(a)}),(0,d.jsx)("span",{className:"text-fg-subtle",children:": "})]});if("Object"!==o&&"Array"!==o)return(0,d.jsxs)("div",{className:"pl-4",children:[u,(0,d.jsx)(i.d,{text:(0,h.aB)(b)}),t]});let v="Array"===o,w=v?b.map(a=>[void 0,a]):Object.entries(b),[x,y]=v?["[","]"]:["{","}"],z=w.length,A=(0,d.jsx)("button",{onClick:()=>q(a=>!a),"aria-label":p?"Collapse":"Expand",className:"absolute left-0 top-[2px] flex h-3.5 w-3.5 items-center justify-center rounded text-fg-subtle hover:bg-bg-muted hover:text-fg",children:(0,d.jsx)(f.A,{className:(0,g.cn)("h-3 w-3 transition-transform duration-100",p&&"rotate-90")})});return 0===z?(0,d.jsxs)("div",{className:"pl-4",children:[u,(0,d.jsxs)("span",{className:"text-fg-subtle",children:[x,y]}),t]}):p?(0,d.jsxs)("div",{className:"relative pl-4",children:[A,u,(0,d.jsx)("span",{className:"text-fg-subtle",children:x}),(0,d.jsxs)("div",{className:"border-l border-transparent hover:border-border",children:[w.slice(0,r).map(([a,b],e)=>(0,d.jsx)(n,{name:a,value:b,depth:c+1,last:e===z-1},a??e)),z>r&&(0,d.jsxs)("button",{onClick:()=>s(a=>a+1e3),className:"pl-4 font-sans text-[11px] text-accent hover:underline",children:["Show ",Math.min(1e3,z-r)," more of ",z-r]})]}),(0,d.jsx)("span",{className:"text-fg-subtle",children:y}),t]}):(0,d.jsxs)("div",{className:"relative pl-4",children:[A,u,(0,d.jsxs)("button",{onClick:()=>q(!0),className:"rounded px-0.5 text-fg-subtle hover:bg-bg-muted hover:text-fg",children:[x," … ",y]}),(0,d.jsxs)("span",{className:"ml-1.5 font-sans text-[10.5px] text-fg-subtle",children:[z," ",v?1===z?"item":"items":1===z?"field":"fields"]}),t]})}},60028:(a,b,c)=>{"use strict";c.d(b,{H:()=>e,I:()=>d});let d={none:{label:"No colour",hex:null},green:{label:"Emerald",hex:"#047857"},teal:{label:"Teal",hex:"#0f766e"},blue:{label:"Ocean",hex:"#0369a1"},indigo:{label:"Indigo",hex:"#4338ca"},purple:{label:"Plum",hex:"#7e22ce"},pink:{label:"Rose",hex:"#be123c"},orange:{label:"Copper",hex:"#c2410c"},yellow:{label:"Gold",hex:"#a16207"},red:{label:"Crimson",hex:"#b91c1c"},graphite:{label:"Graphite",hex:"#334155"}};function e(a){let b=d[a??"none"]??d.none,c=b.hex?{backgroundColor:`color-mix(in srgb, ${b.hex} 13%, var(--sidebar))`,boxShadow:`inset 3px 0 0 ${b.hex}`}:void 0;return{...b,rowStyle:c}}},61135:()=>{},70440:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>e});var d=c(97523);let e=async a=>[{type:"image/x-icon",sizes:"16x16",url:(0,d.fillMetadataSegment)(".",await a.params,"favicon.ico")+""}]},77591:(a,b,c)=>{"use strict";c.d(b,{SplitProvider:()=>e});var d=c(97954);let e=(0,d.registerClientReference)(function(){throw Error("Attempted to call SplitProvider() from the server but SplitProvider is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Volumes/BOHR@HD/Pankaj/Project/WeAreTeam/MongoAdmin/src/features/split/split-store.tsx","SplitProvider");(0,d.registerClientReference)(function(){throw Error("Attempted to call useSplit() from the server but useSplit is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Volumes/BOHR@HD/Pankaj/Project/WeAreTeam/MongoAdmin/src/features/split/split-store.tsx","useSplit"),(0,d.registerClientReference)(function(){throw Error("Attempted to call useSplitActions() from the server but useSplitActions is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Volumes/BOHR@HD/Pankaj/Project/WeAreTeam/MongoAdmin/src/features/split/split-store.tsx","useSplitActions"),(0,d.registerClientReference)(function(){throw Error("Attempted to call useSplitOpen() from the server but useSplitOpen is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Volumes/BOHR@HD/Pankaj/Project/WeAreTeam/MongoAdmin/src/features/split/split-store.tsx","useSplitOpen")},80603:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,81170,23)),Promise.resolve().then(c.t.bind(c,23597,23)),Promise.resolve().then(c.t.bind(c,36893,23)),Promise.resolve().then(c.t.bind(c,89748,23)),Promise.resolve().then(c.t.bind(c,6060,23)),Promise.resolve().then(c.t.bind(c,7184,23)),Promise.resolve().then(c.t.bind(c,69576,23)),Promise.resolve().then(c.t.bind(c,73041,23)),Promise.resolve().then(c.t.bind(c,51384,23))},83327:(a,b,c)=>{Promise.resolve().then(c.bind(c,31679))},83831:(a,b,c)=>{"use strict";c.d(b,{Sidebar:()=>d});let d=(0,c(97954).registerClientReference)(function(){throw Error("Attempted to call Sidebar() from the server but Sidebar is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Volumes/BOHR@HD/Pankaj/Project/WeAreTeam/MongoAdmin/src/features/sidebar/sidebar.tsx","Sidebar")},93758:(a,b,c)=>{"use strict";c.d(b,{D0:()=>k,l6:()=>i,pd:()=>h});var d=c(21124),e=c(38301),f=c(44943);let g="w-full rounded-md border border-border-strong bg-panel px-2.5 text-[13px] text-fg placeholder:text-fg-subtle focus:outline-none focus:ring-2 focus:ring-accent/30 focus:border-accent disabled:opacity-60",h=(0,e.forwardRef)(({className:a,...b},c)=>(0,d.jsx)("input",{ref:c,className:(0,f.cn)(g,"h-8",a),...b}));h.displayName="Input",(0,e.forwardRef)(({className:a,...b},c)=>(0,d.jsx)("textarea",{ref:c,className:(0,f.cn)(g,"py-1.5 font-mono text-xs",a),...b})).displayName="Textarea";let i=(0,e.forwardRef)(({className:a,...b},c)=>(0,d.jsx)("select",{ref:c,className:(0,f.cn)(g,"h-8 pr-6",a),...b}));function j({className:a,...b}){return(0,d.jsx)("label",{className:(0,f.cn)("mb-1 block text-xs font-medium text-fg-muted",a),...b})}function k({label:a,hint:b,children:c}){return(0,d.jsxs)("div",{className:"space-y-1",children:[(0,d.jsx)(j,{children:a}),c,b&&(0,d.jsx)("p",{className:"text-[11px] text-fg-subtle",children:b})]})}i.displayName="Select"},97513:(a,b,c)=>{"use strict";c.d(b,{SplitArea:()=>d});let d=(0,c(97954).registerClientReference)(function(){throw Error("Attempted to call SplitArea() from the server but SplitArea is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Volumes/BOHR@HD/Pankaj/Project/WeAreTeam/MongoAdmin/src/features/split/split-area.tsx","SplitArea")}};
|