@geminilight/mindos 0.6.67 → 0.6.70
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/_standalone/.mindos-build-version +1 -1
- package/_standalone/.next/BUILD_ID +1 -1
- package/_standalone/.next/app-path-routes-manifest.json +26 -25
- package/_standalone/.next/build-manifest.json +3 -3
- package/_standalone/.next/cache/.previewinfo +1 -1
- package/_standalone/.next/cache/.rscinfo +1 -1
- package/_standalone/.next/cache/config.json +3 -3
- package/_standalone/.next/prerender-manifest.json +3 -3
- package/_standalone/.next/react-loadable-manifest.json +7 -7
- package/_standalone/.next/routes-manifest.json +6 -0
- package/_standalone/.next/server/app/.well-known/agent-card.json/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/_global-error.html +2 -2
- package/_standalone/.next/server/app/_global-error.rsc +1 -1
- package/_standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/_standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/_standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/_standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/_standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/_standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/_standalone/.next/server/app/_not-found/page.js +1 -1
- package/_standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/agents/[agentKey]/page.js +1 -1
- package/_standalone/.next/server/app/agents/[agentKey]/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/agents/[agentKey]/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/agents/page.js +1 -1
- package/_standalone/.next/server/app/agents/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/agents/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/a2a/agents/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/a2a/delegations/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/a2a/discover/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/a2a/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/acp/config/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/acp/detect/route.js +1 -1
- package/_standalone/.next/server/app/api/acp/detect/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/acp/install/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/acp/registry/route.js +1 -1
- package/_standalone/.next/server/app/api/acp/registry/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/acp/session/route.js +1 -1
- package/_standalone/.next/server/app/api/acp/session/route.js.nft.json +1 -1
- package/_standalone/.next/server/app/api/acp/session/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/agent-activity/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/agents/copy-skill/route.js.nft.json +1 -1
- package/_standalone/.next/server/app/api/agents/copy-skill/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/agents/custom/detect/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/agents/custom/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/ask/route.js +17 -17
- package/_standalone/.next/server/app/api/ask/route.js.nft.json +1 -1
- package/_standalone/.next/server/app/api/ask/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/ask-sessions/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/auth/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/backlinks/route.js.nft.json +1 -1
- package/_standalone/.next/server/app/api/backlinks/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/bootstrap/route.js.nft.json +1 -1
- package/_standalone/.next/server/app/api/bootstrap/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/changes/route.js.nft.json +1 -1
- package/_standalone/.next/server/app/api/changes/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/channels/verify/route.js +1 -0
- package/_standalone/.next/server/app/api/channels/verify/route.js.nft.json +1 -0
- package/_standalone/.next/server/app/api/channels/verify/route_client-reference-manifest.js +1 -0
- package/_standalone/.next/server/app/api/connect/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/export/route.js.nft.json +1 -1
- package/_standalone/.next/server/app/api/export/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/extract-pdf/route.js +2 -2
- package/_standalone/.next/server/app/api/extract-pdf/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/file/import/route.js +1 -1
- package/_standalone/.next/server/app/api/file/import/route.js.nft.json +1 -1
- package/_standalone/.next/server/app/api/file/import/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/file/raw/route.js.nft.json +1 -1
- package/_standalone/.next/server/app/api/file/raw/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/file/route.js.nft.json +1 -1
- package/_standalone/.next/server/app/api/file/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/files/route.js.nft.json +1 -1
- package/_standalone/.next/server/app/api/files/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/git/route.js.nft.json +1 -1
- package/_standalone/.next/server/app/api/git/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/graph/route.js.nft.json +1 -1
- package/_standalone/.next/server/app/api/graph/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/health/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/im/config/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/im/status/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/im/test/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/inbox/clip/route.js.nft.json +1 -1
- package/_standalone/.next/server/app/api/inbox/clip/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/inbox/route.js.nft.json +1 -1
- package/_standalone/.next/server/app/api/inbox/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/init/route.js.nft.json +1 -1
- package/_standalone/.next/server/app/api/init/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/lint/route.js.nft.json +1 -1
- package/_standalone/.next/server/app/api/lint/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/mcp/agents/route.js.nft.json +1 -1
- package/_standalone/.next/server/app/api/mcp/agents/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/mcp/direct-tools/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/mcp/install/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/mcp/install-skill/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/mcp/restart/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/mcp/status/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/mcp/tools/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/mcp/uninstall/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/monitoring/route.js.nft.json +1 -1
- package/_standalone/.next/server/app/api/monitoring/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/recent-files/route.js.nft.json +1 -1
- package/_standalone/.next/server/app/api/recent-files/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/restart/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/search/route.js.nft.json +1 -1
- package/_standalone/.next/server/app/api/search/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/settings/list-models/route.js +1 -1
- package/_standalone/.next/server/app/api/settings/list-models/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/settings/reset-token/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/settings/route.js +1 -1
- package/_standalone/.next/server/app/api/settings/route.js.nft.json +1 -1
- package/_standalone/.next/server/app/api/settings/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/settings/test-key/route.js +1 -1
- package/_standalone/.next/server/app/api/settings/test-key/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/setup/check-path/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/setup/check-port/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/setup/generate-token/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/setup/ls/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/setup/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/skills/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/space-overview/route.js +2 -2
- package/_standalone/.next/server/app/api/space-overview/route.js.nft.json +1 -1
- package/_standalone/.next/server/app/api/space-overview/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/sync/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/tree-version/route.js.nft.json +1 -1
- package/_standalone/.next/server/app/api/tree-version/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/uninstall/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/update/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/update-check/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/update-status/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/workflows/route.js.nft.json +1 -1
- package/_standalone/.next/server/app/api/workflows/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/changelog/page.js +1 -1
- package/_standalone/.next/server/app/changelog/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/changelog/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/changes/page.js +1 -1
- package/_standalone/.next/server/app/changes/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/changes/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/echo/[segment]/page.js +1 -1
- package/_standalone/.next/server/app/echo/[segment]/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/echo/[segment]/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/echo/page.js +1 -1
- package/_standalone/.next/server/app/echo/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/echo/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/explore/page.js +1 -1
- package/_standalone/.next/server/app/explore/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/explore/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/help/page.js +1 -1
- package/_standalone/.next/server/app/help/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/help/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/inbox/history/page.js +1 -1
- package/_standalone/.next/server/app/inbox/history/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/inbox/history/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/login/page.js +1 -1
- package/_standalone/.next/server/app/login/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/page.js +1 -1
- package/_standalone/.next/server/app/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/setup/page.js +1 -1
- package/_standalone/.next/server/app/setup/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/setup/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/trash/page.js +3 -3
- package/_standalone/.next/server/app/trash/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/trash/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/view/[...path]/page.js +3 -3
- package/_standalone/.next/server/app/view/[...path]/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/view/[...path]/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/wiki/page.js +1 -1
- package/_standalone/.next/server/app/wiki/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/wiki/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app-paths-manifest.json +26 -25
- package/_standalone/.next/server/chunks/3437.js +2 -2
- package/_standalone/.next/server/chunks/5299.js +1 -0
- package/_standalone/.next/server/chunks/6022.js +39 -39
- package/_standalone/.next/server/chunks/6133.js +54 -0
- package/_standalone/.next/server/chunks/6539.js +1 -1
- package/_standalone/.next/server/chunks/8326.js +1 -0
- package/_standalone/.next/server/chunks/8388.js +5 -3
- package/_standalone/.next/server/chunks/953.js +6 -4
- package/_standalone/.next/server/chunks/9938.js +24 -0
- package/_standalone/.next/server/middleware-build-manifest.js +1 -1
- package/_standalone/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/_standalone/.next/server/pages/500.html +2 -2
- package/_standalone/.next/server/server-reference-manifest.js +1 -1
- package/_standalone/.next/server/server-reference-manifest.json +1 -1
- package/_standalone/.next/static/chunks/1814.8a1fef15856dce84.js +1 -0
- package/_standalone/.next/static/chunks/2654-e07c692d6c99f25b.js +1 -0
- package/_standalone/.next/static/chunks/{2935.7d75923daaf448d3.js → 2935.9b08eeade3644806.js} +1 -1
- package/_standalone/.next/static/chunks/3269.a7343771e3f0ff58.js +48 -0
- package/_standalone/.next/static/chunks/3637.2b2697198968d83f.js +1 -0
- package/_standalone/.next/static/chunks/{5550-b7c97fc13628db15.js → 4327-d70a8d457e2d03fe.js} +1 -1
- package/_standalone/.next/static/chunks/48-c88ea6a2a45f15b4.js +28 -0
- package/_standalone/.next/static/chunks/5581-6d403608b5dfb20b.js +29 -0
- package/_standalone/.next/static/chunks/6902-edc5c487c696bd0b.js +3 -0
- package/_standalone/.next/static/chunks/808.72eb7bdd399e9a24.js +1 -0
- package/_standalone/.next/static/chunks/app/.well-known/agent-card.json/{route-e0c1e2c67572781c.js → route-930dfa67e2789df5.js} +1 -1
- package/_standalone/.next/static/chunks/app/_global-error/{page-e0c1e2c67572781c.js → page-930dfa67e2789df5.js} +1 -1
- package/_standalone/.next/static/chunks/app/agents/page-3dc2bf2f6bc7334c.js +1 -0
- package/_standalone/.next/static/chunks/app/api/a2a/agents/{route-e0c1e2c67572781c.js → route-930dfa67e2789df5.js} +1 -1
- package/_standalone/.next/static/chunks/app/api/a2a/delegations/{route-e0c1e2c67572781c.js → route-930dfa67e2789df5.js} +1 -1
- package/_standalone/.next/static/chunks/app/api/a2a/discover/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/a2a/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/acp/config/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/acp/detect/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/acp/install/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/acp/registry/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/acp/session/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/agent-activity/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/agents/copy-skill/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/agents/custom/detect/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/agents/custom/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/ask/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/ask-sessions/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/auth/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/backlinks/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/bootstrap/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/changes/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/channels/verify/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/connect/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/export/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/extract-pdf/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/file/import/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/file/raw/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/file/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/files/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/git/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/graph/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/health/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/im/config/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/im/status/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/im/test/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/inbox/clip/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/inbox/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/init/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/lint/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/mcp/agents/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/mcp/direct-tools/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/mcp/install/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/mcp/install-skill/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/mcp/restart/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/mcp/status/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/mcp/tools/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/mcp/uninstall/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/monitoring/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/recent-files/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/restart/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/search/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/settings/list-models/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/settings/reset-token/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/settings/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/settings/test-key/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/setup/check-path/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/setup/check-port/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/setup/generate-token/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/setup/ls/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/setup/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/skills/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/space-overview/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/sync/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/tree-version/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/uninstall/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/update/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/update-check/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/update-status/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/api/workflows/route-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/changes/page-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/echo/[segment]/page-75a6330292613587.js +157 -0
- package/_standalone/.next/static/chunks/app/echo/page-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/{layout-9bb19a959ffb87ac.js → layout-8aa53b34ef34a246.js} +28 -28
- package/_standalone/.next/static/chunks/app/loading-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/{page-c3be6477dbcf182d.js → page-318332501426ef5b.js} +1 -1
- package/_standalone/.next/static/chunks/app/trash/page-17bd5aedcfea9b65.js +1 -0
- package/_standalone/.next/static/chunks/app/view/[...path]/loading-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/app/view/[...path]/page-d5c37c41c556013d.js +12 -0
- package/_standalone/.next/static/chunks/next/dist/client/components/builtin/app-error-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/next/dist/client/components/builtin/forbidden-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/next/dist/client/components/builtin/not-found-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/next/dist/client/components/builtin/unauthorized-930dfa67e2789df5.js +1 -0
- package/_standalone/.next/static/chunks/webpack-1c2d44f6d86f3986.js +1 -0
- package/_standalone/.next/static/css/a8cadde78aea8585.css +1 -0
- package/_standalone/.next/static/ixCTELNH6V05Z00pC6ZMO/_buildManifest.js +1 -0
- package/_standalone/.next/trace +72 -71
- package/_standalone/.next/types/routes.d.ts +2 -1
- package/_standalone/.next/types/validator.ts +9 -0
- package/_standalone/MINDOS_ARCHITECTURE_DIAGRAM.md +488 -0
- package/_standalone/MINDOS_EXPLORATION_SUMMARY.md +229 -0
- package/_standalone/MINDOS_INFRASTRUCTURE_ANALYSIS.md +732 -0
- package/_standalone/__tests__/acp/agent-descriptors.test.ts +101 -3
- package/_standalone/__tests__/acp/registry.test.ts +34 -5
- package/_standalone/__tests__/acp/session.test.ts +346 -167
- package/_standalone/__tests__/agent/provider-endpoints.test.ts +70 -0
- package/_standalone/__tests__/api/channels-verify.test.ts +75 -0
- package/_standalone/__tests__/api/extract-pdf.test.ts +265 -0
- package/_standalone/__tests__/api/test-key.test.ts +15 -3
- package/_standalone/__tests__/channel-mgmt.test.js +11 -0
- package/_standalone/__tests__/components/breadcrumb-header-ux.test.ts +14 -0
- package/_standalone/__tests__/components/header-toc-vertical-alignment.test.ts +23 -0
- package/_standalone/__tests__/components/table-of-contents-header-layout.test.ts +15 -0
- package/_standalone/__tests__/components/view-page-header-layout.test.ts +13 -0
- package/_standalone/__tests__/components/view-page-header-scroll-stability.test.ts +34 -0
- package/_standalone/__tests__/core/hybrid-search.test.ts +109 -0
- package/_standalone/components/Breadcrumb.tsx +10 -10
- package/_standalone/components/FindInPage.tsx +1 -1
- package/_standalone/components/MarkdownView.tsx +4 -0
- package/_standalone/components/Panel.tsx +17 -10
- package/_standalone/components/TableOfContents.tsx +9 -9
- package/_standalone/components/agents/AgentsContentChannelDetail.tsx +168 -54
- package/_standalone/components/agents/AgentsContentChannels.tsx +22 -22
- package/_standalone/components/ask/AskContent.tsx +68 -28
- package/_standalone/components/ask/AskHeader.tsx +6 -2
- package/_standalone/components/ask/ProviderModelCapsule.tsx +11 -9
- package/_standalone/components/ask/SessionHistoryPanel.tsx +398 -0
- package/_standalone/components/panels/AgentsPanel.tsx +8 -1
- package/_standalone/components/settings/AiTab.tsx +5 -1
- package/_standalone/components/settings/KnowledgeTab.tsx +92 -1
- package/_standalone/components/settings/McpConnectGuides.tsx +4 -0
- package/_standalone/components/settings/McpPortSection.tsx +207 -0
- package/_standalone/components/settings/McpTab.tsx +1 -5
- package/_standalone/components/settings/TestButton.tsx +1 -0
- package/_standalone/components/settings/{ServerPortsCard.tsx → WebPortSection.tsx} +66 -151
- package/_standalone/components/settings/types.ts +12 -0
- package/_standalone/components/settings/useCustomProviderForm.ts +2 -2
- package/_standalone/data/skills/mindos/SKILL.md +45 -1
- package/_standalone/hooks/useAcpDetection.ts +1 -1
- package/_standalone/hooks/useAcpRegistry.ts +1 -1
- package/_standalone/hooks/useFileImport.ts +7 -2
- package/_standalone/hooks/useFileUpload.ts +17 -10
- package/_standalone/lib/acp/index.ts +4 -6
- package/_standalone/lib/acp/types.ts +0 -29
- package/_standalone/lib/im/platforms.ts +6 -2
- package/_standalone/lib/pdf-extract.ts +6 -2
- package/_standalone/package-lock.json +12 -2
- package/_standalone/package.json +2 -1
- package/_standalone/tsconfig.tsbuildinfo +1 -1
- package/app/MINDOS_ARCHITECTURE_DIAGRAM.md +488 -0
- package/app/MINDOS_EXPLORATION_SUMMARY.md +229 -0
- package/app/MINDOS_INFRASTRUCTURE_ANALYSIS.md +732 -0
- package/app/app/api/acp/detect/route.ts +9 -15
- package/app/app/api/channels/verify/route.ts +54 -0
- package/app/app/api/extract-pdf/route.ts +17 -3
- package/app/app/api/settings/list-models/route.ts +40 -44
- package/app/app/api/settings/route.ts +16 -0
- package/app/app/api/settings/test-key/route.ts +5 -2
- package/app/app/view/[...path]/ViewPageClient.tsx +1 -1
- package/app/components/Breadcrumb.tsx +10 -10
- package/app/components/DirView.tsx +1 -1
- package/app/components/FindInPage.tsx +1 -1
- package/app/components/InboxView.tsx +2 -2
- package/app/components/MarkdownView.tsx +4 -0
- package/app/components/Panel.tsx +17 -10
- package/app/components/TableOfContents.tsx +9 -9
- package/app/components/agents/AgentsContentChannelDetail.tsx +168 -54
- package/app/components/agents/AgentsContentChannels.tsx +22 -22
- package/app/components/ask/AskContent.tsx +68 -28
- package/app/components/ask/AskHeader.tsx +6 -2
- package/app/components/ask/ProviderModelCapsule.tsx +11 -9
- package/app/components/ask/SessionHistoryPanel.tsx +398 -0
- package/app/components/panels/AgentsPanel.tsx +8 -1
- package/app/components/settings/AiTab.tsx +5 -1
- package/app/components/settings/KnowledgeTab.tsx +92 -1
- package/app/components/settings/McpConnectGuides.tsx +4 -0
- package/app/components/settings/McpPortSection.tsx +207 -0
- package/app/components/settings/McpTab.tsx +1 -5
- package/app/components/settings/TestButton.tsx +1 -0
- package/app/components/settings/{ServerPortsCard.tsx → WebPortSection.tsx} +66 -151
- package/app/components/settings/types.ts +12 -0
- package/app/components/settings/useCustomProviderForm.ts +2 -2
- package/app/data/skills/mindos/SKILL.md +45 -1
- package/app/hooks/useAcpDetection.ts +1 -1
- package/app/hooks/useAcpRegistry.ts +1 -1
- package/app/hooks/useFileImport.ts +7 -2
- package/app/hooks/useFileUpload.ts +17 -10
- package/app/lib/acp/agent-descriptors.ts +69 -29
- package/app/lib/acp/index.ts +4 -6
- package/app/lib/acp/registry.ts +43 -47
- package/app/lib/acp/session.ts +253 -517
- package/app/lib/acp/subprocess.ts +249 -414
- package/app/lib/acp/types.ts +0 -29
- package/app/lib/agent/model.ts +20 -4
- package/app/lib/agent/non-streaming.ts +37 -20
- package/app/lib/agent/providers.ts +31 -0
- package/app/lib/agent/tools.ts +5 -3
- package/app/lib/core/embedding-index.ts +285 -0
- package/app/lib/core/embedding-provider.ts +164 -0
- package/app/lib/core/hybrid-search.ts +160 -0
- package/app/lib/core/search.ts +11 -21
- package/app/lib/i18n/modules/ai-chat.ts +26 -0
- package/app/lib/i18n/modules/panels.ts +14 -0
- package/app/lib/i18n/modules/settings.ts +2 -0
- package/app/lib/im/platforms.ts +6 -2
- package/app/lib/im/verify.ts +94 -0
- package/app/lib/pdf-extract.ts +6 -2
- package/app/lib/settings.ts +23 -0
- package/app/package.json +2 -1
- package/bin/cli.js +3 -1
- package/bin/commands/channel.js +342 -0
- package/bin/commands/update.js +11 -4
- package/bin/lib/build.js +34 -16
- package/bin/lib/channel-config.js +168 -0
- package/bin/lib/channel-constants.js +88 -0
- package/bin/lib/channel-mgmt.js +244 -0
- package/bin/lib/channel-prompts.js +72 -0
- package/bin/lib/channel-validate.js +57 -0
- package/bin/lib/safe-rm.js +165 -0
- package/package.json +1 -1
- package/skills/mindos/SKILL.md +45 -1
- package/_standalone/.next/server/chunks/1750.js +0 -1
- package/_standalone/.next/server/chunks/8947.js +0 -52
- package/_standalone/.next/static/0JtsgqDZLSJ6MrIZIV6gC/_buildManifest.js +0 -1
- package/_standalone/.next/static/chunks/1814.a79b84d37df75c43.js +0 -1
- package/_standalone/.next/static/chunks/3637.38c4f28d8f698e0e.js +0 -1
- package/_standalone/.next/static/chunks/4351-9ab695985bb808ad.js +0 -1
- package/_standalone/.next/static/chunks/476.463546c195b89cce.js +0 -48
- package/_standalone/.next/static/chunks/5133-3779d65f4fdfb041.js +0 -30
- package/_standalone/.next/static/chunks/5581-4dd3d32f6e8606ec.js +0 -29
- package/_standalone/.next/static/chunks/5998.7bd28de9747440b5.js +0 -1
- package/_standalone/.next/static/chunks/app/agents/page-4c0637183e46c8d3.js +0 -1
- package/_standalone/.next/static/chunks/app/api/a2a/discover/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/a2a/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/acp/config/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/acp/detect/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/acp/install/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/acp/registry/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/acp/session/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/agent-activity/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/agents/copy-skill/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/agents/custom/detect/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/agents/custom/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/ask/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/ask-sessions/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/auth/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/backlinks/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/bootstrap/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/changes/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/connect/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/export/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/extract-pdf/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/file/import/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/file/raw/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/file/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/files/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/git/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/graph/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/health/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/im/config/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/im/status/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/im/test/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/inbox/clip/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/inbox/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/init/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/lint/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/mcp/agents/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/mcp/direct-tools/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/mcp/install/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/mcp/install-skill/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/mcp/restart/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/mcp/status/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/mcp/tools/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/mcp/uninstall/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/monitoring/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/recent-files/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/restart/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/search/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/settings/list-models/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/settings/reset-token/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/settings/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/settings/test-key/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/setup/check-path/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/setup/check-port/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/setup/generate-token/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/setup/ls/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/setup/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/skills/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/space-overview/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/sync/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/tree-version/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/uninstall/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/update/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/update-check/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/update-status/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/api/workflows/route-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/changes/page-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/echo/[segment]/page-5333ab47257fab7f.js +0 -159
- package/_standalone/.next/static/chunks/app/echo/page-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/loading-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/trash/page-bebb28bf472cf691.js +0 -1
- package/_standalone/.next/static/chunks/app/view/[...path]/loading-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/app/view/[...path]/page-dd5698f3df138835.js +0 -12
- package/_standalone/.next/static/chunks/next/dist/client/components/builtin/app-error-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/next/dist/client/components/builtin/forbidden-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/next/dist/client/components/builtin/not-found-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/next/dist/client/components/builtin/unauthorized-e0c1e2c67572781c.js +0 -1
- package/_standalone/.next/static/chunks/webpack-043f40ef7816d8c4.js +0 -1
- package/_standalone/.next/static/css/8b1f248d6540e52f.css +0 -1
- package/_standalone/lib/core/__tests__/synonym-dict.test.ts +0 -82
- package/app/lib/core/__tests__/synonym-dict.test.ts +0 -82
- package/app/lib/core/synonym-dict.ts +0 -139
- /package/_standalone/.next/static/{0JtsgqDZLSJ6MrIZIV6gC → ixCTELNH6V05Z00pC6ZMO}/_ssgManifest.js +0 -0
|
@@ -1,15 +1,6 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7177],{402:(e,t,r)=>{"use strict";r.d(t,{vP:()=>w,$_:()=>v,fF:()=>b});var s=r(95155),n=r(12115),a=r(13545),i=r(21362),o=r(6296),l=r(8765),d=r(94514),c=r(31025),u=r(91958),m=r(12651),x=r(20171),p=r(22356),
|
|
2
|
-
${t}`:e),S(-1)}finally{z.current&&clearTimeout(z.current),clearTimeout(r)}},R=[i?.stepConnecting??"Connecting to remote...",i?.stepAuthenticating??"Authenticating...",i?.stepSyncing??"Syncing data...",i?.stepAlmostDone??"Almost done..."];return(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)(x.L7,{icon:(0,s.jsx)(c.A,{size:15}),title:i?.emptyTitle??"Cross-device Sync",description:i?.emptyDesc??"Automatically sync your knowledge base across devices via Git.",children:[(0,s.jsxs)(x.D0,{label:i?.remoteUrl??"Git Remote URL",hint:"ssh"===$?i?.sshHint??"Requires SSH key on this machine. Verify with: ssh -T git@github.com":void 0,children:[(0,s.jsx)(x.pd,{type:"text",value:l,onChange:e=>{u(e.target.value),A("")},placeholder:"git@github.com:user/repo.git",className:`font-mono ${l.trim()&&!T?"border-destructive":""}`}),!l.trim()&&(0,s.jsxs)("div",{className:"flex flex-wrap gap-x-4 gap-y-1 text-xs text-muted-foreground mt-1.5",children:[(0,s.jsxs)("span",{children:[(0,s.jsx)("code",{className:"text-foreground/60 bg-muted/60 px-1 py-0.5 rounded text-2xs",children:"SSH"})," ",i?.sshBrief??"one-time key setup, no token needed"]}),(0,s.jsxs)("span",{children:[(0,s.jsx)("code",{className:"text-foreground/60 bg-muted/60 px-1 py-0.5 rounded text-2xs",children:"HTTPS"})," ",i?.httpsBrief??"works anywhere, token recommended"]})]}),l.trim()&&!T&&(0,s.jsx)("p",{className:"text-xs text-destructive mt-1",children:i?.invalidUrl??"Invalid Git URL — use HTTPS (https://...) or SSH (git@...)"})]}),"https"===$&&(0,s.jsxs)(x.D0,{label:(0,s.jsxs)(s.Fragment,{children:[i?.accessToken??"Access Token"," ",(0,s.jsx)("span",{className:"text-muted-foreground font-normal",children:i?.optional??"(optional, for private repos)"})]}),hint:void 0,children:[(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)(x.pd,{type:w?"text":"password",value:g,onChange:e=>b(e.target.value),placeholder:"ghp_xxxxxxxxxxxx",className:"pr-9 font-mono"}),(0,s.jsx)("button",{type:"button",onClick:()=>N(!w),className:"absolute right-2 top-1/2 -translate-y-1/2 p-0.5 rounded hover:bg-muted text-muted-foreground transition-colors",children:w?(0,s.jsx)(f.A,{size:14}):(0,s.jsx)(h.A,{size:14})})]}),(0,s.jsxs)("p",{className:"text-xs text-muted-foreground mt-1",children:[i?.tokenHint??"GitHub:"," ",(0,s.jsx)("a",{href:"https://github.com/settings/tokens/new?scopes=repo&description=MindOS+Sync",target:"_blank",rel:"noopener noreferrer",className:"underline hover:text-foreground transition-colors",children:i?.tokenLink??"Create a token (repo scope)"})]})]}),(0,s.jsx)(x.D0,{label:i?.branchLabel??"Branch",children:(0,s.jsx)(x.pd,{type:"text",value:y,onChange:e=>j(e.target.value),placeholder:"main",className:"max-w-[200px] font-mono"})}),!E&&4!==k&&(0,s.jsx)(x.jn,{onClick:D,disabled:!T,className:"flex items-center gap-2",children:i?.connectButton??"Connect & Start Sync"}),(E||4===k)&&(0,s.jsxs)("div",{className:"space-y-2 py-1",children:[R.map((e,t)=>{let r=k>t||4===k,n=k===t&&k<4;return k<t&&k<4?null:(0,s.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[r?(0,s.jsx)(d.A,{size:13,className:"text-success shrink-0"}):(0,s.jsx)(o.A,{size:13,className:"animate-spin text-muted-foreground shrink-0"}),(0,s.jsx)("span",{className:r?"text-success":n?"text-foreground":"text-muted-foreground",children:e})]},t)}),4===k&&(0,s.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,s.jsx)(m.A,{size:13,className:"text-success shrink-0"}),(0,s.jsx)("span",{className:"text-success font-medium",children:i?.stepDone??"Sync configured successfully!"})]})]}),C&&(0,s.jsxs)("div",{className:"flex items-start gap-2 text-xs p-3 rounded-lg bg-destructive/10 text-destructive",role:"alert","aria-live":"polite",children:[(0,s.jsx)(a.A,{size:13,className:"shrink-0 mt-0.5"}),(0,s.jsx)("div",{className:"space-y-1",children:C.split("\n").map((e,t)=>(0,s.jsx)("span",{className:`block ${t>0?"text-destructive/70":""}`,children:e},t))})]})]}),(0,s.jsx)("div",{className:"grid grid-cols-2 gap-2 text-xs text-muted-foreground px-5",children:[i?.featureAutoCommit??"Auto-commit on save",i?.featureAutoPull??"Auto-pull from remote",i?.featureConflict??"Conflict detection",i?.featureMultiDevice??"Works across devices"].map((e,t)=>(0,s.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,s.jsx)(m.A,{size:11,className:"text-success/60 shrink-0"}),(0,s.jsx)("span",{children:e})]},t))})]})}function b(e,t){if(!e)return t?.timeNever??"never";let r=Date.now()-new Date(e).getTime();if(r<6e4)return t?.timeJustNow??"just now";let s=Math.floor(r/6e4);if(r<36e5)return t?.timeMinAgo?.(s)??`${s}m ago`;let n=Math.floor(r/36e5);if(r<864e5)return t?.timeHourAgo?.(n)??`${n}h ago`;let a=Math.floor(r/864e5);return t?.timeDayAgo?.(a)??`${a}d ago`}function v(e,t,r){let s=e.toLowerCase();return s.includes("permission denied")||s.includes("publickey")?r?.hintSshAuth??"SSH key may not be configured. Run: ssh-keygen -t ed25519 && ssh -T git@github.com":s.includes("host key")||s.includes("known_hosts")||s.includes("fingerprint")?r?.hintSshHost??"Run: ssh-keyscan github.com >> ~/.ssh/known_hosts":s.includes("authentication failed")||s.includes("invalid credentials")||s.includes("401")||s.includes("403")?r?.hintHttpsAuth??"Access token may be expired or missing. Check Settings → Developer settings → Personal access tokens.":s.includes("timed out")||s.includes("timeout")||s.includes("could not resolve")?r?.hintNetwork??"Check your network connection and try again.":s.includes("not found")||s.includes("does not exist")||s.includes("repository not found")?r?.hintNotFound??"Repository not found. Check the URL and ensure the repo exists.":s.includes("non-fast-forward")||s.includes("rejected")||s.includes("fetch first")?r?.hintPushRejected??'Remote has changes. Click "Sync Now" to pull and retry.':s.includes("conflict")||s.includes("merge")?r?.hintConflict??"Merge conflict detected. Check the Conflicts section below.":""}function y({file:e,time:t,syncT:r,onResolved:l}){let[d,c]=(0,n.useState)(null),[u,m]=(0,n.useState)(!1),[x,f]=(0,n.useState)(null),[h,g]=(0,n.useState)(!1),v=async()=>{if(u)return void m(!1);if(!x){g(!0);try{let t=await (0,p.n)("/api/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"conflict-preview",remote:e})});f(t)}catch{}g(!1)}m(!0)},y=async t=>{c("keep-local"===t?"local":"remote");try{await (0,p.n)("/api/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"resolve-conflict",remote:e,branch:t})}),l()}catch{c(null)}};return(0,s.jsxs)("div",{className:"rounded-lg border border-border/50 overflow-hidden",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 p-2 text-xs bg-muted/20",children:[(0,s.jsx)(a.A,{size:12,className:"text-error shrink-0"}),(0,s.jsxs)("button",{type:"button",onClick:v,className:"font-mono truncate hover:text-foreground hover:underline transition-colors flex-1 min-w-0 text-left",title:r?.viewDiff??"View differences",children:[(0,s.jsx)(i.A,{size:11,className:`inline mr-1 transition-transform ${u?"rotate-90":""}`}),e]}),(0,s.jsx)("span",{className:"text-muted-foreground shrink-0",children:b(t,r)}),(0,s.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,s.jsx)("button",{type:"button",onClick:()=>y("keep-local"),disabled:!!d,className:"px-2 py-0.5 rounded border border-border text-2xs hover:bg-muted transition-colors disabled:opacity-40",title:r?.keepLocalHint??"Keep this device's version",children:"local"===d?(0,s.jsx)(o.A,{size:10,className:"animate-spin"}):r?.keepLocal??"Keep local"}),(0,s.jsx)("button",{type:"button",onClick:()=>y("keep-remote"),disabled:!!d,className:"px-2 py-0.5 rounded border border-border text-2xs hover:bg-muted transition-colors disabled:opacity-40",title:r?.keepRemoteHint??"Replace with remote version",children:"remote"===d?(0,s.jsx)(o.A,{size:10,className:"animate-spin"}):r?.keepRemote??"Keep remote"})]})]}),u&&(0,s.jsx)("div",{className:"border-t border-border/50",children:h?(0,s.jsx)("div",{className:"flex justify-center py-3",children:(0,s.jsx)(o.A,{size:13,className:"animate-spin text-muted-foreground"})}):x?(0,s.jsxs)("div",{className:"grid grid-cols-2 divide-x divide-border/50 text-2xs font-mono max-h-60 overflow-auto",children:[(0,s.jsxs)("div",{className:"p-2",children:[(0,s.jsx)("div",{className:"text-muted-foreground mb-1 font-sans text-xs font-medium",children:r?.localVersion??"Local (this device)"}),(0,s.jsx)("pre",{className:"whitespace-pre-wrap text-foreground/80 leading-relaxed",children:x.local||(r?.emptyFile??"(empty)")})]}),(0,s.jsxs)("div",{className:"p-2",children:[(0,s.jsx)("div",{className:"text-muted-foreground mb-1 font-sans text-xs font-medium",children:r?.remoteVersion??"Remote"}),(0,s.jsx)("pre",{className:"whitespace-pre-wrap text-foreground/80 leading-relaxed",children:x.remote||(r?.emptyFile??"(empty)")})]})]}):null})]})}function j({syncT:e}){let[t,r]=(0,n.useState)(!1),[a,c]=(0,n.useState)(""),[u,m]=(0,n.useState)(""),[x,f]=(0,n.useState)(!1),[h,g]=(0,n.useState)(!1),b=(0,n.useRef)(!1),v=a!==u;(0,n.useEffect)(()=>{t&&!b.current&&(b.current=!0,f(!0),(0,p.n)("/api/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"gitignore-get"})}).then(e=>{c(e.content),m(e.content)}).catch(()=>{}).finally(()=>f(!1)))},[t]);let y=async()=>{try{await (0,p.n)("/api/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"gitignore-save",content:a})}),m(a),g(!0),setTimeout(()=>g(!1),2e3)}catch{}};return(0,s.jsxs)("div",{className:"pt-2 border-t border-border/50",children:[(0,s.jsxs)("button",{type:"button",onClick:()=>r(!t),className:"flex items-center gap-2 w-full text-left text-sm text-muted-foreground hover:text-foreground transition-colors py-1",children:[(0,s.jsx)(i.A,{size:14,className:`shrink-0 transition-transform ${t?"rotate-90":""}`}),(0,s.jsx)(l.A,{size:13,className:"shrink-0"}),(0,s.jsx)("span",{children:e?.gitignoreTitle??"Excluded files"}),(0,s.jsx)("span",{className:"text-2xs opacity-50",children:".gitignore"})]}),t&&(0,s.jsx)("div",{className:"mt-2 space-y-2",children:x?(0,s.jsx)("div",{className:"flex justify-center py-4",children:(0,s.jsx)(o.A,{size:14,className:"animate-spin text-muted-foreground"})}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("textarea",{value:a,onChange:e=>c(e.target.value),rows:8,className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-xs font-mono leading-relaxed text-foreground placeholder:text-muted-foreground focus:outline-none focus-visible:ring-1 focus-visible:ring-ring resize-y",placeholder:e?.gitignorePlaceholder??"# Files to exclude from sync\n*.tmp\nsecret/",spellCheck:!1}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[v&&(0,s.jsx)("button",{type:"button",onClick:y,className:"flex items-center gap-1.5 px-3 py-1 text-xs rounded-lg bg-[var(--amber)] text-[var(--amber-foreground)] hover:opacity-90 transition-opacity",children:e?.gitignoreSave??"Save"}),h&&(0,s.jsxs)("span",{className:"flex items-center gap-1 text-xs text-success",children:[(0,s.jsx)(d.A,{size:12})," ",e?.gitignoreSaved??"Saved"]})]})]})})]})}function w({t:e,visible:t}){let r=e.settings?.sync,[i,l]=(0,n.useState)(null),[d,f]=(0,n.useState)(!0),[h,w]=(0,n.useState)(!1),[N,k]=(0,n.useState)(!1),[S,C]=(0,n.useState)(null),A=(0,n.useCallback)(async()=>{try{let e=await (0,p.n)("/api/sync",{timeout:1e4});l(e)}catch{l(e=>e??null)}finally{f(!1)}},[]);(0,n.useEffect)(()=>{A()},[A]);let z=(0,n.useRef)(t);(0,n.useEffect)(()=>{t&&!z.current&&null!==i&&A(),z.current=t},[t,i,A]);let E=async()=>{w(!0),C(null);try{await (0,p.n)("/api/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"now"}),timeout:12e4}),C({type:"success",text:r?.syncComplete??"Sync complete"}),await A()}catch(s){var e;let t;C({type:"error",text:(t=v(e=s instanceof Error?s.message:"Sync failed",void 0,r))?`${e}
|
|
3
|
-
${t}`:e})}finally{w(!1),setTimeout(()=>C(null),3e3)}},$=async()=>{if(!i)return;k(!0),C(null);let e=i.enabled?"off":"on";try{await (0,p.n)("/api/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:e})}),await A(),C({type:"success",text:i.enabled?r?.autoSyncDisabled??"Auto-sync disabled":r?.autoSyncEnabled??"Auto-sync enabled"})}catch{C({type:"error",text:r?.toggleFailed??"Failed to toggle sync"})}finally{k(!1),setTimeout(()=>C(null),3e3)}},T=async()=>{k(!0);try{await (0,p.n)("/api/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"reset"})}),await A()}catch{C({type:"error",text:r?.resetFailed??"Failed to reset sync configuration"})}finally{k(!1),setTimeout(()=>C(null),3e3)}};if(d)return(0,s.jsx)("div",{className:"flex justify-center py-8",children:(0,s.jsx)(o.A,{size:18,className:"animate-spin text-muted-foreground"})});if(!i||!i.enabled)return(0,s.jsx)(g,{t:e,onInitComplete:A});if(i.needsSetup)return(0,s.jsx)("div",{className:"space-y-6",children:(0,s.jsxs)("div",{className:"flex items-start gap-3 p-4 rounded-lg bg-destructive/10",children:[(0,s.jsx)(a.A,{size:18,className:"text-destructive shrink-0 mt-0.5"}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("h3",{className:"text-sm font-medium text-destructive",children:r?.brokenTitle??"Sync configuration is broken"}),(0,s.jsx)("p",{className:"text-xs text-destructive/80",children:i.lastError||(r?.brokenDesc??"The git repository or remote is missing. Reset to re-configure.")}),(0,s.jsxs)(x.jn,{onClick:T,disabled:N,className:"flex items-center gap-2 mt-2",children:[N&&(0,s.jsx)(o.A,{size:14,className:"animate-spin"}),r?.resetButton??"Reset & Re-configure"]})]})]})});let D=i.conflicts||[];return(0,s.jsx)("div",{className:"space-y-4",children:(0,s.jsxs)(x.L7,{icon:(0,s.jsx)(c.A,{size:15}),title:r?.sectionTitle??"Sync",description:i.remote,badge:(0,s.jsx)("span",{className:"text-2xs px-1.5 py-0.5 rounded bg-success/15 text-success font-medium",children:r?.labelEnabled??"Active"}),children:[(0,s.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("span",{className:"text-muted-foreground",children:r?.labelBranch??"Branch"}),(0,s.jsx)("span",{className:"font-mono text-xs",children:i.branch})]}),(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("span",{className:"text-muted-foreground",children:r?.labelLastSync??"Last sync"}),(0,s.jsx)("span",{className:"text-xs",children:b(i.lastSync,r)})]}),(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("span",{className:"text-muted-foreground",children:r?.labelUnpushed??"Unpushed"}),(0,s.jsx)("span",{className:"text-xs",children:"string"==typeof i.unpushed&&/^\d+$/.test(i.unpushed)?r?.unpushedCommits?.(parseInt(i.unpushed,10))??`${i.unpushed} commits`:`${i.unpushed??"?"} commits`})]}),(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("span",{className:"text-muted-foreground",children:r?.labelAutoSync??"Auto-sync"}),(0,s.jsxs)("span",{className:"flex items-center gap-1 text-xs",children:["commit"," ",(0,s.jsxs)("select",{className:"bg-muted rounded px-1.5 py-0.5 text-xs border border-border cursor-pointer",value:i.autoCommitInterval,onChange:async e=>{let t=parseInt(e.target.value,10);try{(await fetch("/api/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"update-intervals",autoCommitInterval:t})})).ok&&A()}catch{}},children:[(0,s.jsx)("option",{value:10,children:"10s"}),(0,s.jsx)("option",{value:15,children:"15s"}),(0,s.jsx)("option",{value:30,children:"30s"}),(0,s.jsx)("option",{value:60,children:"60s"}),(0,s.jsx)("option",{value:120,children:"120s"})]})," \xb7 pull ",(0,s.jsxs)("select",{className:"bg-muted rounded px-1.5 py-0.5 text-xs border border-border cursor-pointer",value:i.autoPullInterval,onChange:async e=>{let t=parseInt(e.target.value,10);try{(await fetch("/api/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"update-intervals",autoPullInterval:t})})).ok&&A()}catch{}},children:[(0,s.jsx)("option",{value:60,children:"1min"}),(0,s.jsx)("option",{value:120,children:"2min"}),(0,s.jsx)("option",{value:300,children:"5min"}),(0,s.jsx)("option",{value:600,children:"10min"}),(0,s.jsx)("option",{value:1800,children:"30min"}),(0,s.jsx)("option",{value:3600,children:"60min"})]})]})]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2 pt-1",children:[(0,s.jsxs)("button",{type:"button",onClick:E,disabled:h,className:"flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-lg border border-border text-muted-foreground hover:text-foreground hover:bg-muted disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:[(0,s.jsx)(u.A,{size:12,className:h?"animate-spin":""}),r?.syncNow??"Sync Now"]}),(0,s.jsx)("button",{type:"button",onClick:$,disabled:N,className:"flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-lg border border-border text-muted-foreground hover:text-destructive hover:border-destructive/50 disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:r?.disableAutoSync??"Disable Auto-sync"})]}),S&&(0,s.jsx)("div",{className:"flex items-start gap-1.5 text-xs",role:"status","aria-live":"polite",children:"success"===S.type?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(m.A,{size:13,className:"text-success shrink-0 mt-0.5"}),(0,s.jsx)("span",{className:"text-success",children:S.text})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(a.A,{size:13,className:"text-destructive shrink-0 mt-0.5"}),(0,s.jsx)("div",{className:"space-y-0.5",children:S.text.split("\n").map((e,t)=>(0,s.jsx)("span",{className:`block ${t>0?"text-destructive/70":"text-destructive"}`,children:e},t))})]})}),D.length>0&&(0,s.jsxs)("div",{className:"pt-2 border-t border-border/50 space-y-3",children:[(0,s.jsx)("p",{className:"text-xs font-medium text-foreground",children:r?.conflictsTitle?.(D.length)??`Conflicts (${D.length})`}),(0,s.jsx)("p",{className:"text-2xs text-muted-foreground",children:r?.conflictExplain??"These files were changed on both this device and the remote. Choose which version to keep for each file."}),(0,s.jsx)("div",{className:"space-y-2",children:D.map((e,t)=>(0,s.jsx)(y,{file:e.file,time:e.time,syncT:r,onResolved:A},t))})]}),i.lastError&&0===D.length&&(0,s.jsxs)("div",{className:"flex items-start gap-2 text-xs p-2.5 rounded-lg bg-destructive/10 text-destructive",children:[(0,s.jsx)(a.A,{size:12,className:"shrink-0 mt-0.5"}),(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("span",{className:"block",children:i.lastError}),v(i.lastError,i.remote,r)&&(0,s.jsx)("span",{className:"block text-destructive/70",children:v(i.lastError,i.remote,r)})]})]}),(0,s.jsx)(j,{syncT:r})]})})}},3799:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>er,Fo:()=>F,gL:()=>I});var s=r(95155),n=r(12115),a=r(73321),i=r(82125),o=r(91337),l=r(33078),d=r(48368),c=r(6296),u=r(66088),m=r(15282),x=r(33024),p=r(42129),f=r(38798),h=r(60285),g=r(94290),b=r(67635),v=r(49387),y=r(68459),j=r(9339);let w=(0,j.createServerReference)("6033f372c099a531dd7b1088555bc38103f0b0aac3",j.callServer,void 0,j.findSourceMapURL,"createFileAction"),N=(0,j.createServerReference)("609489ac80fb1cac8a5e8004e17593cc6da71c55ce",j.callServer,void 0,j.findSourceMapURL,"renameSpaceAction");var k=r(20886);let S=(0,j.createServerReference)("40d85bd7f4d22a7d8b6ea936d03de07c40db66b547",j.callServer,void 0,j.findSourceMapURL,"deleteSpaceAction"),C=(0,j.createServerReference)("404443f2951a5098846dcec602bd9d4092b0cd6d77",j.callServer,void 0,j.findSourceMapURL,"deleteFolderAction");var A=r(54583),z=r(28465),E=r(4235),$=r(35581),T=r(39498),D=r(10377);let R="show-hidden-files";function P(e){let t=t=>{t.key===R&&e()},r=()=>e();return window.addEventListener("storage",t),window.addEventListener("mindos:hidden-files-changed",r),()=>{window.removeEventListener("storage",t),window.removeEventListener("mindos:hidden-files-changed",r)}}function M(){return"true"===localStorage.getItem(R)}function F(e){localStorage.setItem(R,String(e)),window.dispatchEvent(new Event("mindos:hidden-files-changed"))}function I(){return(0,n.useSyncExternalStore)(P,M,()=>!1)}var L=r(51914),O=r(997),W=r(59511);let B=(0,j.createServerReference)("4021699aa4c620cdab94352e1adbe9f385615ad8c3",j.callServer,void 0,j.findSourceMapURL,"convertToSpaceAction");var U=r(5292);async function _(e){try{await navigator.clipboard.writeText(e)}catch{}}let H="w-full flex items-center gap-2 px-3 py-2 text-sm text-foreground hover:bg-muted transition-colors text-left",K="w-full flex items-center gap-2 px-3 py-2 text-sm text-error hover:bg-error/10 transition-colors text-left",Y="my-1 border-t border-border/50";function J({x:e,y:t,onClose:r,menuHeight:a,children:i}){let o=(0,n.useRef)(null);(0,n.useEffect)(()=>{let e=e=>{o.current&&!o.current.contains(e.target)&&r()},t=e=>{"Escape"===e.key&&r()};return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)}},[r]);let l=Math.min(t,window.innerHeight-(a??160)),d=Math.min(e,window.innerWidth-200);return(0,s.jsx)("div",{ref:o,className:"fixed z-50 min-w-[180px] bg-card border border-border rounded-lg shadow-lg py-1",style:{top:l,left:d},children:i})}function G({x:e,y:t,node:r,onClose:n,onRename:i,onNewFile:l,onImport:d,onDelete:c}){let u=(0,a.useRouter)(),{t:m}=(0,$.Y)(),{isPinned:x,togglePin:p}=(0,D.Z)(),f=x(r.path);return(0,s.jsxs)(J,{x:e,y:t,onClose:n,children:[(0,s.jsxs)("button",{className:H,onClick:()=>{l(),n()},children:[(0,s.jsx)(L.A,{size:14,className:"shrink-0"})," ",m.fileTree.newFile]}),(0,s.jsxs)("button",{className:H,onClick:()=>{u.push(`/view/${(0,o.O0)(`${r.path}/INSTRUCTION.md`)}`),n()},children:[(0,s.jsx)(O.A,{size:14,className:"shrink-0"})," ",m.fileTree.viewRules]}),d&&(0,s.jsxs)("button",{className:H,onClick:()=>{d(r.path),n()},children:[(0,s.jsx)(W.A,{size:14,className:"shrink-0"})," ",m.fileTree.importFile]}),(0,s.jsx)("div",{className:Y}),(0,s.jsxs)("button",{className:H,onClick:()=>{p(r.path),n()},children:[(0,s.jsx)(g.A,{size:14,className:`shrink-0 ${f?"fill-[var(--amber)] text-[var(--amber)]":""}`}),f?m.fileTree.removeFromFavorites:m.fileTree.pinToFavorites]}),(0,s.jsxs)("button",{className:H,onClick:()=>{_(r.path),n()},children:[(0,s.jsx)(b.A,{size:14,className:"shrink-0"})," ",m.fileTree.copyPath]}),(0,s.jsxs)("button",{className:H,onClick:()=>{i(),n()},children:[(0,s.jsx)(v.A,{size:14,className:"shrink-0"})," ",m.fileTree.renameSpace]}),(0,s.jsx)("div",{className:Y}),(0,s.jsxs)("button",{className:K,onClick:()=>{n(),c()},children:[(0,s.jsx)(y.A,{size:14,className:"shrink-0"}),m.fileTree.deleteSpace]})]})}function V({x:e,y:t,node:r,onClose:i,onRename:o,onNewFile:l,onDelete:d}){let c=(0,a.useRouter)(),{t:u}=(0,$.Y)(),[m,p]=(0,n.useTransition)(),{isPinned:f,togglePin:h}=(0,D.Z)(),j=f(r.path);return(0,s.jsxs)(J,{x:e,y:t,onClose:i,menuHeight:220,children:[(0,s.jsxs)("button",{className:H,onClick:()=>{l(),i()},children:[(0,s.jsx)(L.A,{size:14,className:"shrink-0"})," ",u.fileTree.newFile]}),(0,s.jsx)("div",{className:Y}),(0,s.jsxs)("button",{className:H,onClick:()=>{h(r.path),i()},children:[(0,s.jsx)(g.A,{size:14,className:`shrink-0 ${j?"fill-[var(--amber)] text-[var(--amber)]":""}`}),j?u.fileTree.removeFromFavorites:u.fileTree.pinToFavorites]}),(0,s.jsxs)("button",{className:H,disabled:m,onClick:()=>{p(async()=>{if((await B(r.path)).success){c.refresh(),window.dispatchEvent(new Event("mindos:files-changed"));let e=r.name.replace(/^[\p{Emoji_Presentation}\p{Extended_Pictographic}\s]+/u,"")||r.name;(0,U.w)().then(t=>{t&&(0,U.V)(e,r.path)})}i()})},children:[(0,s.jsx)(x.A,{size:14,className:"shrink-0 text-[var(--amber)]"})," ",u.fileTree.convertToSpace]}),(0,s.jsxs)("button",{className:H,onClick:()=>{_(r.path),i()},children:[(0,s.jsx)(b.A,{size:14,className:"shrink-0"})," ",u.fileTree.copyPath]}),(0,s.jsxs)("button",{className:H,onClick:()=>{o(),i()},children:[(0,s.jsx)(v.A,{size:14,className:"shrink-0"})," ",u.fileTree.rename]}),(0,s.jsx)("div",{className:Y}),(0,s.jsxs)("button",{className:K,onClick:()=>{i(),d()},children:[(0,s.jsx)(y.A,{size:14,className:"shrink-0"}),u.fileTree.deleteFolder]})]})}var q=r(29494);function X(){window.dispatchEvent(new Event("mindos:files-changed"))}async function Z(e){try{await navigator.clipboard.writeText(e)}catch{}}function Q({dirPath:e,depth:t,onDone:r}){let[i,l]=(0,n.useState)(""),[d,u]=(0,n.useTransition)(),[m,x]=(0,n.useState)(""),p=(0,a.useRouter)(),{t:f}=(0,$.Y)(),h=(0,n.useRef)(null),g=(0,n.useCallback)(()=>{let t=i.trim();t?u(async()=>{let s=await w(e,t);s.success&&s.filePath?(r(),p.push(`/view/${(0,o.O0)(s.filePath)}`),p.refresh(),X()):x(s.error||f.fileTree.failed)}):x(f.fileTree.enterFileName)},[i,e,r,p,f]);return(0,n.useEffect)(()=>{let e=e=>{h.current&&!h.current.contains(e.target)&&r()},t=setTimeout(()=>document.addEventListener("mousedown",e),0);return()=>{clearTimeout(t),document.removeEventListener("mousedown",e)}},[r]),(0,s.jsxs)("div",{ref:h,className:"px-2 pb-1",style:{paddingLeft:`${12*t+20}px`},children:[(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[(0,s.jsx)("input",{autoFocus:!0,type:"text",value:i,onChange:e=>{l(e.target.value),x("")},onKeyDown:e=>{"Enter"===e.key&&g(),"Escape"===e.key&&r()},placeholder:"filename.md",className:" flex-1 bg-muted border border-border rounded px-2 py-1 text-xs text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring "}),d?(0,s.jsx)(c.A,{size:13,className:"text-muted-foreground animate-spin shrink-0"}):(0,s.jsx)("button",{onClick:g,className:"text-xs text-[var(--amber)] hover:text-foreground shrink-0 px-1",children:f.fileTree.create})]}),m&&(0,s.jsx)("p",{className:"text-xs text-error mt-0.5 px-1",children:m})]})}function ee({node:e,depth:t,currentPath:r,onNavigate:l,maxOpenDepth:d,onImport:g}){let b=(0,a.useRouter)(),v=r.startsWith(e.path+"/")||r===e.path,y=!!e.isSpace,[j,w]=(0,n.useState)(0===t||v),[z,D]=(0,n.useState)(!1),[R,P]=(0,n.useState)(!1),[M,F]=(0,n.useState)(e.name),[I,L]=(0,n.useTransition)(),O=(0,n.useRef)(null),W=(0,n.useRef)(null),[B,U]=(0,n.useState)(null),{t:_}=(0,$.Y)(),[H,K]=(0,n.useState)(null),[Y,J]=(0,n.useTransition)(),{isDragTarget:Z,handleRowDragOver:ee,handleRowDragEnter:et,handleRowDragLeave:es,handleRowDrop:en}=function(e,t,r,s){let[a,i]=(0,n.useState)(!1),o=(0,n.useRef)(null),l=(0,n.useRef)(null),d=(0,n.useCallback)(()=>{o.current&&(clearTimeout(o.current),o.current=null)},[]),c=(0,n.useCallback)(e=>{e.dataTransfer.types.includes("Files")&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="copy",l.current&&(clearTimeout(l.current),l.current=null),a||i(!0))},[a]),u=(0,n.useCallback)(e=>{e.dataTransfer.types.includes("Files")&&(e.preventDefault(),e.stopPropagation(),i(!0),d(),t||(o.current=setTimeout(()=>{r(!0),o.current=null},500)))},[t,d,r]),m=(0,n.useCallback)(e=>{e.dataTransfer.types.includes("Files")&&(e.stopPropagation(),l.current=setTimeout(()=>{i(!1),d(),l.current=null},50))},[d]),x=(0,n.useCallback)(t=>{t.preventDefault(),t.stopPropagation(),i(!1),d(),l.current&&(clearTimeout(l.current),l.current=null);let r=t.dataTransfer.files;r.length>0&&(0,q.Nh)(Array.from(r),e.path,s)},[e.path,s,d]);return(0,n.useEffect)(()=>()=>{o.current&&clearTimeout(o.current),l.current&&clearTimeout(l.current)},[]),{isDragTarget:a,handleRowDragOver:c,handleRowDragEnter:u,handleRowDragLeave:m,handleRowDrop:x}}(e,j,w,_),ea=(0,n.useCallback)(()=>w(e=>!e),[]),ei=(0,n.useRef)(void 0);(0,n.useEffect)(()=>{if(null==d){ei.current=d;return}ei.current!==d&&(null===ei.current||void 0===ei.current?t>d&&w(!1):w(t<=d),ei.current=d)},[d,t]),(0,n.useEffect)(()=>()=>{W.current&&clearTimeout(W.current)},[]);let eo=(0,n.useCallback)(t=>{t?.preventDefault(),t?.stopPropagation(),W.current&&(clearTimeout(W.current),W.current=null),F(e.name),P(!0),setTimeout(()=>O.current?.select(),0)},[e.name]),el=(0,n.useCallback)(()=>{let t=M.trim();t&&t!==e.name?L(async()=>{let r=y?N:k.f,s=await r(e.path,t);s.success&&s.newPath?(P(!1),b.push(`/view/${(0,o.O0)(s.newPath)}`),b.refresh(),X()):P(!1)}):P(!1)},[M,e.name,e.path,b,y]),ed=(0,n.useCallback)(()=>{R||(W.current&&clearTimeout(W.current),W.current=setTimeout(()=>{b.push(`/view/${(0,o.O0)(e.path)}`),l?.(),W.current=null},180))},[R,b,e.path,l]);(0,n.useCallback)(e=>{e.stopPropagation(),ea()},[ea]);let ec=(0,n.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),U({x:e.clientX,y:e.clientY})},[]),eu=y?function e(t){return"file"===t.type?+!i.C.has(t.name):(t.children??[]).reduce((t,r)=>t+e(r),0)}(e):0;if(R)return(0,s.jsxs)("div",{className:"relative px-2 py-0.5",style:{paddingLeft:`${12*t+8}px`},children:[(0,s.jsx)("input",{ref:O,autoFocus:!0,value:M,onChange:e=>F(e.target.value),onKeyDown:e=>{"Enter"===e.key&&el(),"Escape"===e.key&&P(!1)},onBlur:el,className:"w-full bg-muted border border-border rounded px-2 py-0.5 text-xs text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"}),I&&(0,s.jsx)(c.A,{size:12,className:"absolute right-3 top-1/2 -translate-y-1/2 animate-spin text-muted-foreground"})]});let em=y&&0===t;return(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:`relative group/dir flex items-center transition-colors duration-100 ${Z?"bg-[var(--amber)]/10 rounded-md":""}`,onContextMenu:ec,onDragEnter:et,onDragOver:ee,onDragLeave:es,onDrop:en,children:[(0,s.jsx)("button",{onClick:ea,className:"shrink-0 p-1 rounded hover:bg-muted text-muted-foreground transition-colors",style:{marginLeft:`${12*t+4}px`},"aria-label":j?`Collapse ${e.name}`:`Expand ${e.name}`,"aria-expanded":j,children:(0,s.jsx)("span",{className:"block transition-transform duration-150",style:{transform:j?"rotate(0deg)":"rotate(-90deg)"},children:(0,s.jsx)(u.A,{size:10})})}),(0,s.jsxs)("button",{type:"button",onClick:ed,draggable:!0,onDragStart:t=>{t.dataTransfer.setData("text/mindos-path",e.path),t.dataTransfer.setData("text/mindos-type","directory"),t.dataTransfer.effectAllowed="copy"},className:`
|
|
4
|
-
flex-1 flex items-center gap-1.5 px-1 py-1 rounded text-left min-w-0 pr-16
|
|
5
|
-
text-sm transition-colors duration-100
|
|
6
|
-
hover:bg-muted cursor-default
|
|
7
|
-
${v?"text-foreground":"text-muted-foreground hover:text-foreground"}
|
|
8
|
-
`,children:[y?"Inbox"===e.name?(0,s.jsx)(m.A,{size:14,className:"shrink-0 text-[var(--amber)]"}):(0,s.jsx)(x.A,{size:14,className:"shrink-0 text-[var(--amber)]"}):j?(0,s.jsx)(p.A,{size:14,className:"text-yellow-400 shrink-0"}):(0,s.jsx)(f.A,{size:14,className:"text-yellow-400 shrink-0"}),(0,s.jsx)("span",{className:"truncate leading-5",suppressHydrationWarning:!0,children:e.name}),y&&!j&&(0,s.jsx)("span",{className:"ml-auto text-xs text-muted-foreground shrink-0 tabular-nums pr-1",children:eu})]}),(0,s.jsx)("div",{className:"absolute right-1 top-1/2 -translate-y-1/2 hidden group-hover/dir:flex items-center gap-0.5 z-10",children:(0,s.jsx)("button",{type:"button",onClick:e=>{e.preventDefault(),e.stopPropagation();let t=e.currentTarget.getBoundingClientRect();U({x:t.left,y:t.bottom+4})},className:"p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",title:"More",children:(0,s.jsx)(h.A,{size:14})})})]}),(0,s.jsx)("div",{className:`grid transition-[grid-template-rows] duration-200 ease-out ${j?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,children:(0,s.jsxs)("div",{className:`overflow-hidden ${em?"border-l-2 ml-[18px]":""}`,style:em?{borderColor:"color-mix(in srgb, var(--amber) 30%, transparent)"}:void 0,...!j&&{inert:!0},children:[e.children&&(0,s.jsx)(er,{nodes:e.children,depth:em?1:t+1,onNavigate:l,maxOpenDepth:d,parentIsSpace:y,onImport:g}),z&&(0,s.jsx)(Q,{dirPath:e.path,depth:em?0:t,onDone:()=>D(!1)})]})}),B&&(y?(0,s.jsx)(G,{x:B.x,y:B.y,node:e,onClose:()=>U(null),onRename:()=>eo(),onNewFile:()=>{w(!0),D(!0)},onImport:g,onDelete:()=>K("space")}):(0,s.jsx)(V,{x:B.x,y:B.y,node:e,onClose:()=>U(null),onRename:()=>eo(),onNewFile:()=>{w(!0),D(!0)},onDelete:()=>K("folder")})),(0,s.jsx)(T.TM,{open:null!==H,title:"space"===H?_.fileTree.deleteSpace:_.fileTree.deleteFolder,message:"space"===H?_.fileTree.confirmDeleteSpace(e.name):_.fileTree.confirmDeleteFolder(e.name),confirmLabel:"space"===H?_.fileTree.deleteSpace:_.fileTree.deleteFolder,cancelLabel:_.view?.cancel??"Cancel",variant:"destructive",onCancel:()=>K(null),onConfirm:()=>{K(null),J(async()=>{let t="space"===H?await S(e.path):await C(e.path);if(t.success&&t.trashId){let r=t.trashId,s=e.path.split("/").pop()??e.path;E.oR.undo(`${_.trash?.movedToTrash??"Deleted"} ${s}`,async()=>{let e=await (0,A.Y)(r);e.success?(b.refresh(),X()):E.oR.error(e.error??"Undo failed")},{label:_.trash?.undo??"Undo"}),b.push("/"),b.refresh(),X()}})}})]})}function et({node:e,depth:t,currentPath:r,onNavigate:u}){let m=(0,a.useRouter)(),x=r===e.path,[p,f]=(0,n.useState)(!1),[j,w]=(0,n.useState)(e.name),[N,S]=(0,n.useTransition)(),[,C]=(0,n.useTransition)(),R=(0,n.useRef)(null),{t:P}=(0,$.Y)(),{isPinned:M,togglePin:F}=(0,D.Z)(),I=M(e.path),L=!e.path.includes("/")&&i.A.has(e.name),[O,W]=(0,n.useState)(!1),[B,U]=(0,n.useState)(null),_=(0,n.useCallback)(()=>{p||(m.push(`/view/${(0,o.O0)(e.path)}`),u?.())},[m,e.path,u,p]),G=(0,n.useCallback)(t=>{t.stopPropagation(),w(e.name),f(!0),setTimeout(()=>R.current?.select(),0)},[e.name]),V=(0,n.useCallback)(()=>{let t=j.trim();t&&t!==e.name?S(async()=>{let r=await (0,k.f)(e.path,t);r.success&&r.newPath?(f(!1),m.push(`/view/${(0,o.O0)(r.newPath)}`),m.refresh(),X()):f(!1)}):f(!1)},[j,e.name,e.path,m]),q=(0,n.useCallback)(e=>{e.stopPropagation(),W(!0)},[]),Q=(0,n.useCallback)(t=>{t.dataTransfer.setData("text/mindos-path",e.path),t.dataTransfer.effectAllowed="copy"},[e.path]),ee=(0,n.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),U({x:e.clientX,y:e.clientY})},[]);return p?(0,s.jsxs)("div",{className:"relative px-2 py-0.5",style:{paddingLeft:`${12*t+8}px`},children:[(0,s.jsx)("input",{ref:R,autoFocus:!0,value:j,onChange:e=>w(e.target.value),onKeyDown:e=>{"Enter"===e.key&&V(),"Escape"===e.key&&f(!1)},onBlur:V,className:"w-full bg-muted border border-border rounded px-2 py-0.5 text-xs text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"}),N&&(0,s.jsx)(c.A,{size:12,className:"absolute right-3 top-1/2 -translate-y-1/2 animate-spin text-muted-foreground"})]}):(0,s.jsxs)("div",{className:"relative group/file",children:[(0,s.jsxs)("button",{onClick:_,onContextMenu:ee,draggable:!0,onDragStart:Q,"data-filepath":e.path,className:`
|
|
9
|
-
w-full flex items-center gap-1.5 px-2 py-1 rounded text-left
|
|
10
|
-
text-sm transition-colors duration-100 cursor-default pr-16
|
|
11
|
-
${x?"bg-accent text-foreground":"hover:bg-muted text-muted-foreground hover:text-foreground"}
|
|
12
|
-
`,style:{paddingLeft:`${12*t+8}px`},children:["directory"===e.type?null:".csv"===e.extension?(0,s.jsx)(l.A,{size:14,className:"text-success shrink-0"}):(0,s.jsx)(d.A,{size:14,className:"text-muted-foreground shrink-0"}),(0,s.jsx)("span",{className:"truncate leading-5",suppressHydrationWarning:!0,children:e.name}),I&&(0,s.jsx)(g.A,{size:10,className:"shrink-0 fill-[var(--amber)] text-[var(--amber)] opacity-60"})]}),(0,s.jsx)("div",{className:"absolute right-1 top-1/2 -translate-y-1/2 hidden group-hover/file:flex items-center gap-0.5",children:(0,s.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation();let t=e.currentTarget.getBoundingClientRect();U({x:t.left,y:t.bottom+4})},className:"p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",title:"More",children:(0,s.jsx)(h.A,{size:14})})}),B&&(0,s.jsxs)(J,{x:B.x,y:B.y,onClose:()=>U(null),menuHeight:140,children:[(0,s.jsxs)("button",{className:H,onClick:()=>{Z(e.path),U(null)},children:[(0,s.jsx)(b.A,{size:14,className:"shrink-0"})," ",P.fileTree.copyPath]}),(0,s.jsxs)("button",{className:H,onClick:()=>{F(e.path),U(null)},children:[(0,s.jsx)(g.A,{size:14,className:`shrink-0 ${I?"fill-[var(--amber)] text-[var(--amber)]":""}`}),I?P.fileTree.removeFromFavorites:P.fileTree.pinToFavorites]}),!L&&(0,s.jsxs)("button",{className:H,onClick:e=>{U(null),G(e)},children:[(0,s.jsx)(v.A,{size:14,className:"shrink-0"})," ",P.fileTree.rename]}),!L&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:Y}),(0,s.jsxs)("button",{className:K,onClick:e=>{U(null),q(e)},children:[(0,s.jsx)(y.A,{size:14,className:"shrink-0"})," ",P.fileTree.delete]})]})]}),(0,s.jsx)(T.TM,{open:O,title:P.fileTree.delete,message:P.fileTree.confirmDelete(e.name),confirmLabel:P.fileTree.delete,cancelLabel:P.view?.cancel??"Cancel",variant:"destructive",onCancel:()=>W(!1),onConfirm:()=>{W(!1),C(async()=>{let t=await (0,z.i)(e.path);if(t.success){if(t.trashId){let r=t.trashId,s=e.path.split("/").pop()??e.path;E.oR.undo(`${P.trash?.movedToTrash??"Deleted"} ${s}`,async()=>{let e=await (0,A.Y)(r);e.success?(m.refresh(),X()):E.oR.error(e.error??"Undo failed")},{label:P.trash?.undo??"Undo"})}m.refresh(),X()}})}})]})}function er({nodes:e,depth:t=0,onNavigate:r,maxOpenDepth:o,parentIsSpace:l,onImport:d}){var c;let u,m=(u="/view/",(c=(0,a.usePathname)()).startsWith(u)?c.slice(u.length).split("/").map(decodeURIComponent).join("/"):""),x=I(),p=0===t,f=x?e:e.filter(e=>!(p&&e.name.startsWith(".")||"file"===e.type&&i.C.has(e.name)||"directory"===e.type&&e.name.startsWith("."))),h=p?f.filter(e=>"directory"!==e.type||"Inbox"!==e.name):f;return(0,n.useEffect)(()=>{if(!m||0!==t)return;let e=setTimeout(()=>{let e=document.querySelector(`[data-filepath="${CSS.escape(m)}"]`);e?.scrollIntoView({block:"nearest",behavior:"smooth"})},120);return()=>clearTimeout(e)},[m,t]),(0,s.jsx)("div",{className:"flex flex-col gap-0.5",children:h.map(e=>"directory"===e.type?(0,s.jsx)(ee,{node:e,depth:t,currentPath:m,onNavigate:r,maxOpenDepth:o,onImport:d},e.path):(0,s.jsx)(et,{node:e,depth:t,currentPath:m,onNavigate:r},e.path))})}},5292:(e,t,r)=>{"use strict";r.d(t,{V:()=>a,w:()=>n});var s=r(22356);async function n(){try{let e=await (0,s.n)("/api/settings"),t=e.ai?.provider??"",r=(e.ai?.providers??{})[t];return!!r?.apiKey}catch{return!1}}function a(e,t,r=""){let s="u">typeof document&&"zh"===document.documentElement.lang?`初始化新建的心智空间「${e}」,路径为「${t}/」。${r?`描述:「${r}」。`:""}两个文件均已存在模板,用 write_file 覆盖:
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7177],{402:(e,t,r)=>{"use strict";r.d(t,{vP:()=>w,$_:()=>v,fF:()=>b});var s=r(95155),n=r(12115),a=r(13545),i=r(21362),o=r(6296),l=r(8765),d=r(94514),c=r(31025),u=r(91958),m=r(12651),x=r(20171),p=r(22356),h=r(15411),f=r(7915);function g({t:e,onInitComplete:t}){var r;let i=e.settings?.sync,[l,u]=(0,n.useState)(""),[g,b]=(0,n.useState)(""),[y,j]=(0,n.useState)("main"),[w,N]=(0,n.useState)(!1),[k,S]=(0,n.useState)(-1),[C,A]=(0,n.useState)(""),z=(0,n.useRef)(null),E=k>=0&&k<4,$=l.trim()?(r=l.trim(),/^https:\/\/.+/.test(r)?"https":!!/^git@[\w.-]+:.+/.test(r)&&"ssh"):null,T="https"===$||"ssh"===$,D=async()=>{S(0),A("");let e=(e,t)=>setTimeout(()=>S(t=>t>=0&&t<4?e:t),t);z.current=e(1,2e3);let r=e(2,5e3);try{await (0,p.n)("/api/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"init",remote:l.trim(),token:g.trim()||void 0,branch:y.trim()||"main"}),timeout:12e4}),S(4),setTimeout(()=>t(),600)}catch(r){let e=r instanceof Error?r.message:"Connection failed";e.includes("timed out")&&(e=i?.timeoutError??"Connection timed out. The remote repository may be large or the network is slow. Please try again.");let t=v(e,l,i);A(t?`${e}
|
|
2
|
+
${t}`:e),S(-1)}finally{z.current&&clearTimeout(z.current),clearTimeout(r)}},R=[i?.stepConnecting??"Connecting to remote...",i?.stepAuthenticating??"Authenticating...",i?.stepSyncing??"Syncing data...",i?.stepAlmostDone??"Almost done..."];return(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)(x.L7,{icon:(0,s.jsx)(c.A,{size:15}),title:i?.emptyTitle??"Cross-device Sync",description:i?.emptyDesc??"Automatically sync your knowledge base across devices via Git.",children:[(0,s.jsxs)(x.D0,{label:i?.remoteUrl??"Git Remote URL",hint:"ssh"===$?i?.sshHint??"Requires SSH key on this machine. Verify with: ssh -T git@github.com":void 0,children:[(0,s.jsx)(x.pd,{type:"text",value:l,onChange:e=>{u(e.target.value),A("")},placeholder:"git@github.com:user/repo.git",className:`font-mono ${l.trim()&&!T?"border-destructive":""}`}),!l.trim()&&(0,s.jsxs)("div",{className:"flex flex-wrap gap-x-4 gap-y-1 text-xs text-muted-foreground mt-1.5",children:[(0,s.jsxs)("span",{children:[(0,s.jsx)("code",{className:"text-foreground/60 bg-muted/60 px-1 py-0.5 rounded text-2xs",children:"SSH"})," ",i?.sshBrief??"one-time key setup, no token needed"]}),(0,s.jsxs)("span",{children:[(0,s.jsx)("code",{className:"text-foreground/60 bg-muted/60 px-1 py-0.5 rounded text-2xs",children:"HTTPS"})," ",i?.httpsBrief??"works anywhere, token recommended"]})]}),l.trim()&&!T&&(0,s.jsx)("p",{className:"text-xs text-destructive mt-1",children:i?.invalidUrl??"Invalid Git URL — use HTTPS (https://...) or SSH (git@...)"})]}),"https"===$&&(0,s.jsxs)(x.D0,{label:(0,s.jsxs)(s.Fragment,{children:[i?.accessToken??"Access Token"," ",(0,s.jsx)("span",{className:"text-muted-foreground font-normal",children:i?.optional??"(optional, for private repos)"})]}),hint:void 0,children:[(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)(x.pd,{type:w?"text":"password",value:g,onChange:e=>b(e.target.value),placeholder:"ghp_xxxxxxxxxxxx",className:"pr-9 font-mono"}),(0,s.jsx)("button",{type:"button",onClick:()=>N(!w),className:"absolute right-2 top-1/2 -translate-y-1/2 p-0.5 rounded hover:bg-muted text-muted-foreground transition-colors",children:w?(0,s.jsx)(h.A,{size:14}):(0,s.jsx)(f.A,{size:14})})]}),(0,s.jsxs)("p",{className:"text-xs text-muted-foreground mt-1",children:[i?.tokenHint??"GitHub:"," ",(0,s.jsx)("a",{href:"https://github.com/settings/tokens/new?scopes=repo&description=MindOS+Sync",target:"_blank",rel:"noopener noreferrer",className:"underline hover:text-foreground transition-colors",children:i?.tokenLink??"Create a token (repo scope)"})]})]}),(0,s.jsx)(x.D0,{label:i?.branchLabel??"Branch",children:(0,s.jsx)(x.pd,{type:"text",value:y,onChange:e=>j(e.target.value),placeholder:"main",className:"max-w-[200px] font-mono"})}),!E&&4!==k&&(0,s.jsx)(x.jn,{onClick:D,disabled:!T,className:"flex items-center gap-2",children:i?.connectButton??"Connect & Start Sync"}),(E||4===k)&&(0,s.jsxs)("div",{className:"space-y-2 py-1",children:[R.map((e,t)=>{let r=k>t||4===k,n=k===t&&k<4;return k<t&&k<4?null:(0,s.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[r?(0,s.jsx)(d.A,{size:13,className:"text-success shrink-0"}):(0,s.jsx)(o.A,{size:13,className:"animate-spin text-muted-foreground shrink-0"}),(0,s.jsx)("span",{className:r?"text-success":n?"text-foreground":"text-muted-foreground",children:e})]},t)}),4===k&&(0,s.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,s.jsx)(m.A,{size:13,className:"text-success shrink-0"}),(0,s.jsx)("span",{className:"text-success font-medium",children:i?.stepDone??"Sync configured successfully!"})]})]}),C&&(0,s.jsxs)("div",{className:"flex items-start gap-2 text-xs p-3 rounded-lg bg-destructive/10 text-destructive",role:"alert","aria-live":"polite",children:[(0,s.jsx)(a.A,{size:13,className:"shrink-0 mt-0.5"}),(0,s.jsx)("div",{className:"space-y-1",children:C.split("\n").map((e,t)=>(0,s.jsx)("span",{className:`block ${t>0?"text-destructive/70":""}`,children:e},t))})]})]}),(0,s.jsx)("div",{className:"grid grid-cols-2 gap-2 text-xs text-muted-foreground px-5",children:[i?.featureAutoCommit??"Auto-commit on save",i?.featureAutoPull??"Auto-pull from remote",i?.featureConflict??"Conflict detection",i?.featureMultiDevice??"Works across devices"].map((e,t)=>(0,s.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,s.jsx)(m.A,{size:11,className:"text-success/60 shrink-0"}),(0,s.jsx)("span",{children:e})]},t))})]})}function b(e,t){if(!e)return t?.timeNever??"never";let r=Date.now()-new Date(e).getTime();if(r<6e4)return t?.timeJustNow??"just now";let s=Math.floor(r/6e4);if(r<36e5)return t?.timeMinAgo?.(s)??`${s}m ago`;let n=Math.floor(r/36e5);if(r<864e5)return t?.timeHourAgo?.(n)??`${n}h ago`;let a=Math.floor(r/864e5);return t?.timeDayAgo?.(a)??`${a}d ago`}function v(e,t,r){let s=e.toLowerCase();return s.includes("permission denied")||s.includes("publickey")?r?.hintSshAuth??"SSH key may not be configured. Run: ssh-keygen -t ed25519 && ssh -T git@github.com":s.includes("host key")||s.includes("known_hosts")||s.includes("fingerprint")?r?.hintSshHost??"Run: ssh-keyscan github.com >> ~/.ssh/known_hosts":s.includes("authentication failed")||s.includes("invalid credentials")||s.includes("401")||s.includes("403")?r?.hintHttpsAuth??"Access token may be expired or missing. Check Settings → Developer settings → Personal access tokens.":s.includes("timed out")||s.includes("timeout")||s.includes("could not resolve")?r?.hintNetwork??"Check your network connection and try again.":s.includes("not found")||s.includes("does not exist")||s.includes("repository not found")?r?.hintNotFound??"Repository not found. Check the URL and ensure the repo exists.":s.includes("non-fast-forward")||s.includes("rejected")||s.includes("fetch first")?r?.hintPushRejected??'Remote has changes. Click "Sync Now" to pull and retry.':s.includes("conflict")||s.includes("merge")?r?.hintConflict??"Merge conflict detected. Check the Conflicts section below.":""}function y({file:e,time:t,syncT:r,onResolved:l}){let[d,c]=(0,n.useState)(null),[u,m]=(0,n.useState)(!1),[x,h]=(0,n.useState)(null),[f,g]=(0,n.useState)(!1),v=async()=>{if(u)return void m(!1);if(!x){g(!0);try{let t=await (0,p.n)("/api/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"conflict-preview",remote:e})});h(t)}catch{}g(!1)}m(!0)},y=async t=>{c("keep-local"===t?"local":"remote");try{await (0,p.n)("/api/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"resolve-conflict",remote:e,branch:t})}),l()}catch{c(null)}};return(0,s.jsxs)("div",{className:"rounded-lg border border-border/50 overflow-hidden",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 p-2 text-xs bg-muted/20",children:[(0,s.jsx)(a.A,{size:12,className:"text-error shrink-0"}),(0,s.jsxs)("button",{type:"button",onClick:v,className:"font-mono truncate hover:text-foreground hover:underline transition-colors flex-1 min-w-0 text-left",title:r?.viewDiff??"View differences",children:[(0,s.jsx)(i.A,{size:11,className:`inline mr-1 transition-transform ${u?"rotate-90":""}`}),e]}),(0,s.jsx)("span",{className:"text-muted-foreground shrink-0",children:b(t,r)}),(0,s.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,s.jsx)("button",{type:"button",onClick:()=>y("keep-local"),disabled:!!d,className:"px-2 py-0.5 rounded border border-border text-2xs hover:bg-muted transition-colors disabled:opacity-40",title:r?.keepLocalHint??"Keep this device's version",children:"local"===d?(0,s.jsx)(o.A,{size:10,className:"animate-spin"}):r?.keepLocal??"Keep local"}),(0,s.jsx)("button",{type:"button",onClick:()=>y("keep-remote"),disabled:!!d,className:"px-2 py-0.5 rounded border border-border text-2xs hover:bg-muted transition-colors disabled:opacity-40",title:r?.keepRemoteHint??"Replace with remote version",children:"remote"===d?(0,s.jsx)(o.A,{size:10,className:"animate-spin"}):r?.keepRemote??"Keep remote"})]})]}),u&&(0,s.jsx)("div",{className:"border-t border-border/50",children:f?(0,s.jsx)("div",{className:"flex justify-center py-3",children:(0,s.jsx)(o.A,{size:13,className:"animate-spin text-muted-foreground"})}):x?(0,s.jsxs)("div",{className:"grid grid-cols-2 divide-x divide-border/50 text-2xs font-mono max-h-60 overflow-auto",children:[(0,s.jsxs)("div",{className:"p-2",children:[(0,s.jsx)("div",{className:"text-muted-foreground mb-1 font-sans text-xs font-medium",children:r?.localVersion??"Local (this device)"}),(0,s.jsx)("pre",{className:"whitespace-pre-wrap text-foreground/80 leading-relaxed",children:x.local||(r?.emptyFile??"(empty)")})]}),(0,s.jsxs)("div",{className:"p-2",children:[(0,s.jsx)("div",{className:"text-muted-foreground mb-1 font-sans text-xs font-medium",children:r?.remoteVersion??"Remote"}),(0,s.jsx)("pre",{className:"whitespace-pre-wrap text-foreground/80 leading-relaxed",children:x.remote||(r?.emptyFile??"(empty)")})]})]}):null})]})}function j({syncT:e}){let[t,r]=(0,n.useState)(!1),[a,c]=(0,n.useState)(""),[u,m]=(0,n.useState)(""),[x,h]=(0,n.useState)(!1),[f,g]=(0,n.useState)(!1),b=(0,n.useRef)(!1),v=a!==u;(0,n.useEffect)(()=>{t&&!b.current&&(b.current=!0,h(!0),(0,p.n)("/api/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"gitignore-get"})}).then(e=>{c(e.content),m(e.content)}).catch(()=>{}).finally(()=>h(!1)))},[t]);let y=async()=>{try{await (0,p.n)("/api/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"gitignore-save",content:a})}),m(a),g(!0),setTimeout(()=>g(!1),2e3)}catch{}};return(0,s.jsxs)("div",{className:"pt-2 border-t border-border/50",children:[(0,s.jsxs)("button",{type:"button",onClick:()=>r(!t),className:"flex items-center gap-2 w-full text-left text-sm text-muted-foreground hover:text-foreground transition-colors py-1",children:[(0,s.jsx)(i.A,{size:14,className:`shrink-0 transition-transform ${t?"rotate-90":""}`}),(0,s.jsx)(l.A,{size:13,className:"shrink-0"}),(0,s.jsx)("span",{children:e?.gitignoreTitle??"Excluded files"}),(0,s.jsx)("span",{className:"text-2xs opacity-50",children:".gitignore"})]}),t&&(0,s.jsx)("div",{className:"mt-2 space-y-2",children:x?(0,s.jsx)("div",{className:"flex justify-center py-4",children:(0,s.jsx)(o.A,{size:14,className:"animate-spin text-muted-foreground"})}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("textarea",{value:a,onChange:e=>c(e.target.value),rows:8,className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-xs font-mono leading-relaxed text-foreground placeholder:text-muted-foreground focus:outline-none focus-visible:ring-1 focus-visible:ring-ring resize-y",placeholder:e?.gitignorePlaceholder??"# Files to exclude from sync\n*.tmp\nsecret/",spellCheck:!1}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[v&&(0,s.jsx)("button",{type:"button",onClick:y,className:"flex items-center gap-1.5 px-3 py-1 text-xs rounded-lg bg-[var(--amber)] text-[var(--amber-foreground)] hover:opacity-90 transition-opacity",children:e?.gitignoreSave??"Save"}),f&&(0,s.jsxs)("span",{className:"flex items-center gap-1 text-xs text-success",children:[(0,s.jsx)(d.A,{size:12})," ",e?.gitignoreSaved??"Saved"]})]})]})})]})}function w({t:e,visible:t}){let r=e.settings?.sync,[i,l]=(0,n.useState)(null),[d,h]=(0,n.useState)(!0),[f,w]=(0,n.useState)(!1),[N,k]=(0,n.useState)(!1),[S,C]=(0,n.useState)(null),A=(0,n.useCallback)(async()=>{try{let e=await (0,p.n)("/api/sync",{timeout:1e4});l(e)}catch{l(e=>e??null)}finally{h(!1)}},[]);(0,n.useEffect)(()=>{A()},[A]);let z=(0,n.useRef)(t);(0,n.useEffect)(()=>{t&&!z.current&&null!==i&&A(),z.current=t},[t,i,A]);let E=async()=>{w(!0),C(null);try{await (0,p.n)("/api/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"now"}),timeout:12e4}),C({type:"success",text:r?.syncComplete??"Sync complete"}),await A()}catch(s){var e;let t;C({type:"error",text:(t=v(e=s instanceof Error?s.message:"Sync failed",void 0,r))?`${e}
|
|
3
|
+
${t}`:e})}finally{w(!1),setTimeout(()=>C(null),3e3)}},$=async()=>{if(!i)return;k(!0),C(null);let e=i.enabled?"off":"on";try{await (0,p.n)("/api/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:e})}),await A(),C({type:"success",text:i.enabled?r?.autoSyncDisabled??"Auto-sync disabled":r?.autoSyncEnabled??"Auto-sync enabled"})}catch{C({type:"error",text:r?.toggleFailed??"Failed to toggle sync"})}finally{k(!1),setTimeout(()=>C(null),3e3)}},T=async()=>{k(!0);try{await (0,p.n)("/api/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"reset"})}),await A()}catch{C({type:"error",text:r?.resetFailed??"Failed to reset sync configuration"})}finally{k(!1),setTimeout(()=>C(null),3e3)}};if(d)return(0,s.jsx)("div",{className:"flex justify-center py-8",children:(0,s.jsx)(o.A,{size:18,className:"animate-spin text-muted-foreground"})});if(!i||!i.enabled)return(0,s.jsx)(g,{t:e,onInitComplete:A});if(i.needsSetup)return(0,s.jsx)("div",{className:"space-y-6",children:(0,s.jsxs)("div",{className:"flex items-start gap-3 p-4 rounded-lg bg-destructive/10",children:[(0,s.jsx)(a.A,{size:18,className:"text-destructive shrink-0 mt-0.5"}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("h3",{className:"text-sm font-medium text-destructive",children:r?.brokenTitle??"Sync configuration is broken"}),(0,s.jsx)("p",{className:"text-xs text-destructive/80",children:i.lastError||(r?.brokenDesc??"The git repository or remote is missing. Reset to re-configure.")}),(0,s.jsxs)(x.jn,{onClick:T,disabled:N,className:"flex items-center gap-2 mt-2",children:[N&&(0,s.jsx)(o.A,{size:14,className:"animate-spin"}),r?.resetButton??"Reset & Re-configure"]})]})]})});let D=i.conflicts||[];return(0,s.jsx)("div",{className:"space-y-4",children:(0,s.jsxs)(x.L7,{icon:(0,s.jsx)(c.A,{size:15}),title:r?.sectionTitle??"Sync",description:i.remote,badge:(0,s.jsx)("span",{className:"text-2xs px-1.5 py-0.5 rounded bg-success/15 text-success font-medium",children:r?.labelEnabled??"Active"}),children:[(0,s.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("span",{className:"text-muted-foreground",children:r?.labelBranch??"Branch"}),(0,s.jsx)("span",{className:"font-mono text-xs",children:i.branch})]}),(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("span",{className:"text-muted-foreground",children:r?.labelLastSync??"Last sync"}),(0,s.jsx)("span",{className:"text-xs",children:b(i.lastSync,r)})]}),(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("span",{className:"text-muted-foreground",children:r?.labelUnpushed??"Unpushed"}),(0,s.jsx)("span",{className:"text-xs",children:"string"==typeof i.unpushed&&/^\d+$/.test(i.unpushed)?r?.unpushedCommits?.(parseInt(i.unpushed,10))??`${i.unpushed} commits`:`${i.unpushed??"?"} commits`})]}),(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("span",{className:"text-muted-foreground",children:r?.labelAutoSync??"Auto-sync"}),(0,s.jsxs)("span",{className:"flex items-center gap-1 text-xs",children:["commit"," ",(0,s.jsxs)("select",{className:"bg-muted rounded px-1.5 py-0.5 text-xs border border-border cursor-pointer",value:i.autoCommitInterval,onChange:async e=>{let t=parseInt(e.target.value,10);try{(await fetch("/api/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"update-intervals",autoCommitInterval:t})})).ok&&A()}catch{}},children:[(0,s.jsx)("option",{value:10,children:"10s"}),(0,s.jsx)("option",{value:15,children:"15s"}),(0,s.jsx)("option",{value:30,children:"30s"}),(0,s.jsx)("option",{value:60,children:"60s"}),(0,s.jsx)("option",{value:120,children:"120s"})]})," \xb7 pull ",(0,s.jsxs)("select",{className:"bg-muted rounded px-1.5 py-0.5 text-xs border border-border cursor-pointer",value:i.autoPullInterval,onChange:async e=>{let t=parseInt(e.target.value,10);try{(await fetch("/api/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"update-intervals",autoPullInterval:t})})).ok&&A()}catch{}},children:[(0,s.jsx)("option",{value:60,children:"1min"}),(0,s.jsx)("option",{value:120,children:"2min"}),(0,s.jsx)("option",{value:300,children:"5min"}),(0,s.jsx)("option",{value:600,children:"10min"}),(0,s.jsx)("option",{value:1800,children:"30min"}),(0,s.jsx)("option",{value:3600,children:"60min"})]})]})]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2 pt-1",children:[(0,s.jsxs)("button",{type:"button",onClick:E,disabled:f,className:"flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-lg border border-border text-muted-foreground hover:text-foreground hover:bg-muted disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:[(0,s.jsx)(u.A,{size:12,className:f?"animate-spin":""}),r?.syncNow??"Sync Now"]}),(0,s.jsx)("button",{type:"button",onClick:$,disabled:N,className:"flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-lg border border-border text-muted-foreground hover:text-destructive hover:border-destructive/50 disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:r?.disableAutoSync??"Disable Auto-sync"})]}),S&&(0,s.jsx)("div",{className:"flex items-start gap-1.5 text-xs",role:"status","aria-live":"polite",children:"success"===S.type?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(m.A,{size:13,className:"text-success shrink-0 mt-0.5"}),(0,s.jsx)("span",{className:"text-success",children:S.text})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(a.A,{size:13,className:"text-destructive shrink-0 mt-0.5"}),(0,s.jsx)("div",{className:"space-y-0.5",children:S.text.split("\n").map((e,t)=>(0,s.jsx)("span",{className:`block ${t>0?"text-destructive/70":"text-destructive"}`,children:e},t))})]})}),D.length>0&&(0,s.jsxs)("div",{className:"pt-2 border-t border-border/50 space-y-3",children:[(0,s.jsx)("p",{className:"text-xs font-medium text-foreground",children:r?.conflictsTitle?.(D.length)??`Conflicts (${D.length})`}),(0,s.jsx)("p",{className:"text-2xs text-muted-foreground",children:r?.conflictExplain??"These files were changed on both this device and the remote. Choose which version to keep for each file."}),(0,s.jsx)("div",{className:"space-y-2",children:D.map((e,t)=>(0,s.jsx)(y,{file:e.file,time:e.time,syncT:r,onResolved:A},t))})]}),i.lastError&&0===D.length&&(0,s.jsxs)("div",{className:"flex items-start gap-2 text-xs p-2.5 rounded-lg bg-destructive/10 text-destructive",children:[(0,s.jsx)(a.A,{size:12,className:"shrink-0 mt-0.5"}),(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("span",{className:"block",children:i.lastError}),v(i.lastError,i.remote,r)&&(0,s.jsx)("span",{className:"block text-destructive/70",children:v(i.lastError,i.remote,r)})]})]}),(0,s.jsx)(j,{syncT:r})]})})}},5292:(e,t,r)=>{"use strict";r.d(t,{V:()=>a,w:()=>n});var s=r(22356);async function n(){try{let e=await (0,s.n)("/api/settings"),t=e.ai?.provider??"",r=(e.ai?.providers??{})[t];return!!r?.apiKey}catch{return!1}}function a(e,t,r=""){let s="u">typeof document&&"zh"===document.documentElement.lang?`初始化新建的心智空间「${e}」,路径为「${t}/」。${r?`描述:「${r}」。`:""}两个文件均已存在模板,用 write_file 覆盖:
|
|
13
4
|
1. 「${t}/README.md」— 写入空间用途、结构概览、使用指南
|
|
14
5
|
2. 「${t}/INSTRUCTION.md」— 写入 AI Agent 在此空间中的行为规则和操作约定
|
|
15
6
|
|
|
@@ -17,8 +8,17 @@ ${t}`:e})}finally{w(!1),setTimeout(()=>C(null),3e3)}},$=async()=>{if(!i)return;k
|
|
|
17
8
|
1. "${t}/README.md" — write purpose, structure overview, usage guidelines
|
|
18
9
|
2. "${t}/INSTRUCTION.md" — write rules for AI agents operating in this space
|
|
19
10
|
|
|
20
|
-
Keep content concise and actionable. Write files directly using tools.`;window.dispatchEvent(new CustomEvent("mindos:ai-init",{detail:{spaceName:e,spacePath:t,description:r,state:"working"}})),fetch("/api/ask",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({messages:[{role:"user",content:s}],currentFile:t+"/INSTRUCTION.md"})}).then(async e=>{if(!e.ok||!e.body)throw Error(`HTTP ${e.status}`);let r=e.body.getReader();try{for(;;){let{done:e}=await r.read();if(e)break}}finally{r.releaseLock()}window.dispatchEvent(new CustomEvent("mindos:ai-init",{detail:{spacePath:t,state:"done"}})),window.dispatchEvent(new Event("mindos:files-changed"))}).catch(()=>{window.dispatchEvent(new CustomEvent("mindos:ai-init",{detail:{spacePath:t,state:"error"}}))})}},10377:(e,t,r)=>{"use strict";r.d(t,{Z:()=>f});var s=r(12115);let n="mindos-pinned-files",a="mindos:pins-changed";function i(){try{let e=localStorage.getItem(n);return e?JSON.parse(e):[]}catch{return[]}}function o(){return c}let l=[];function d(){return l}let c=[],u=!1;function m(){u||(c=i(),u=!0)}function x(e){m();let t=t=>{t.key===n&&(c=i(),e())},r=()=>{c=i(),e()};return window.addEventListener("storage",t),window.addEventListener(a,r),()=>{window.removeEventListener("storage",t),window.removeEventListener(a,r)}}function p(e){c=e;try{localStorage.setItem(n,JSON.stringify(e))}catch{}window.dispatchEvent(new Event(a))}function f(){m();let e=(0,s.useSyncExternalStore)(x,o,d),t=(0,s.useCallback)(t=>e.includes(t),[e]),r=(0,s.useCallback)(e=>{let t=i(),r=t.indexOf(e);r>=0?t.splice(r,1):t.unshift(e),p(t)},[]);return{pinnedFiles:e,isPinned:t,togglePin:r,reorderPins:(0,s.useCallback)(e=>{p(e)},[]),removePin:(0,s.useCallback)(e=>{p(i().filter(t=>t!==e))},[])}}},12413:(e,t,r)=>{"use strict";r.d(t,{P:()=>s,u:()=>n});let s=[{id:"telegram",name:"Telegram",icon:"\uD83D\uDCF1",guide:"1. Open Telegram → search @BotFather\n2. Send /newbot → follow prompts\n3. Copy the token below",fields:[{key:"bot_token",label:"Bot Token",placeholder:"123456789:AABBccDD-EeFfGgHh...",hint:"Format: number:alphanumeric"}]},{id:"feishu",name:"Feishu",icon:"\uD83D\uDC26",guide:"1. open.feishu.cn → Create App\n2. Credentials page → copy App ID & Secret\n3. Enable Bot capability + add permissions",fields:[{key:"app_id",label:"App ID",placeholder:"cli_a5xxxxxxxxxxxxx"},{key:"app_secret",label:"App Secret",placeholder:"xxxxxxxxxxxxxxxxxxxxxxxx"}]},{id:"discord",name:"Discord",icon:"\uD83D\uDCAC",guide:"1. discord.com/developers → New Application\n2. Bot tab → Reset Token → copy\n3. Enable Message Content Intent",fields:[{key:"bot_token",label:"Bot Token",placeholder:"MTIxNzM..."}]},{id:"slack",name:"Slack",icon:"\uD83D\uDCBC",guide:"1. api.slack.com/apps → Create New App\n2. OAuth & Permissions → add chat:write scope\n3. Install to Workspace → copy Bot Token",fields:[{key:"bot_token",label:"Bot Token",placeholder:"xoxb-xxxx-xxxx-xxxx",hint:"Starts with xoxb-"}]},{id:"wecom",name:"WeCom",icon:"\uD83C\uDFE2",guide:"1. Group chat → Add Robot → Custom\n2. Copy Webhook URL\n3. Extract the key parameter from URL",fields:[{key:"webhook_key",label:"Webhook Key",placeholder:"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",hint:"The key= value from webhook URL"}]},{id:"dingtalk",name:"DingTalk",icon:"\uD83D\uDD14",guide:"1. Group → Settings → Smart Assistant → Add Robot\n2. Select Custom (Webhook)\n3. Copy the full Webhook URL",fields:[{key:"webhook_url",label:"Webhook URL",placeholder:"https://oapi.dingtalk.com/robot/send?access_token=...",hint:"Full URL including access_token"}]},{id:"wechat",name:"WeChat",icon:"\uD83D\uDC9A",guide:"1. Visit ilinkai.weixin.qq.com\n2. Register & create a bot application\n3. QR login in the console → copy Bot Token from dashboard",fields:[{key:"bot_token",label:"Bot Token",placeholder:"wx_xxxxxxxxxxxxxxxx",hint:"From iLink Bot console after QR login"}]},{id:"qq",name:"QQ",icon:"\uD83D\uDC27",guide:"1. q.qq.com → Create Bot\n2. Development tab → copy App ID & Secret\n3. Add group/C2C intents as needed",fields:[{key:"app_id",label:"App ID",placeholder:"102xxxxxx"},{key:"app_secret",label:"App Secret",placeholder:"xxxxxxxxxxxxxxxxxxxxxxxx"}]}];function n(e){return s.find(t=>t.id===e)}},14446:(e,t,r)=>{"use strict";r.r(t),r.d(t,{AudioRenderer:()=>a});var s=r(95155),n=r(12115);function a({filePath:e}){let t=`/api/file/raw?path=${encodeURIComponent(e)}`,r=e.split("/").pop()??"audio",a=r.split(".").pop()?.toLowerCase()??"",[i,o]=(0,n.useState)(!1),[l,d]=(0,n.useState)(0),[c,u]=(0,n.useState)(null);(0,n.useEffect)(()=>{fetch(t,{method:"HEAD"}).then(e=>{let t=e.headers.get("Content-Length");t&&u(parseInt(t,10))}).catch(()=>{})},[t]);let m=(0,n.useCallback)(()=>{o(!1),d(e=>e+1)},[]);return(0,s.jsxs)("div",{className:"w-full flex flex-col items-center gap-6 py-12 px-4",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3 text-xs text-[var(--text-secondary)]",children:[(0,s.jsx)("span",{className:"text-4xl opacity-40",children:"\uD83C\uDFB5"}),(0,s.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,s.jsx)("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:r}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{className:"uppercase opacity-60",children:a}),null!==c&&(0,s.jsx)("span",{children:c<1024?`${c} B`:c<1048576?`${(c/1024).toFixed(1)} KB`:`${(c/1048576).toFixed(1)} MB`})]})]})]}),i?(0,s.jsxs)("div",{className:"flex flex-col items-center gap-2",children:[(0,s.jsx)("span",{className:"text-sm text-[var(--text-secondary)]",children:"Failed to load audio"}),(0,s.jsx)("button",{onClick:m,className:"text-xs px-3 py-1.5 rounded-md bg-[var(--bg-tertiary)] hover:bg-[var(--bg-hover)] transition-colors",children:"Retry"})]}):(0,s.jsx)("audio",{controls:!0,preload:"metadata",className:"w-full max-w-lg",onError:()=>o(!0),children:(0,s.jsx)("source",{src:t})},l)]})}},16518:(e,t,r)=>{"use strict";r.d(t,{AI:()=>n,RS:()=>s});let s=["imprint","growth","self"],n={imprint:"/echo/imprint",growth:"/echo/growth",self:"/echo/self"}},18847:(e,t,r)=>{"use strict";r.r(t),r.d(t,{AgentInspectorRenderer:()=>j});var s=r(95155),n=r(12115),a=r(73321),i=r(84980),o=r(3926),l=r(93631),d=r(68459),c=r(61878),u=r(10762),m=r(12651),x=r(13545),p=r(66088);function f(e){return/read|list|get|search/.test(e)?/search/.test(e)?"search":"read":/create/.test(e)?"create":/delete/.test(e)?"delete":/write|update|insert|append/.test(e)?"write":"other"}let h={read:{bg:"rgba(138,180,216,0.10)",text:"var(--tool-read)",border:"rgba(138,180,216,0.25)"},write:{bg:"rgba(200,135,58,0.10)",text:"var(--amber)",border:"rgba(200,135,58,0.25)"},create:{bg:"rgba(122,173,128,0.10)",text:"var(--success)",border:"rgba(122,173,128,0.25)"},delete:{bg:"rgba(200,80,80,0.10)",text:"var(--error)",border:"rgba(200,80,80,0.25)"},search:{bg:"rgba(200,160,216,0.10)",text:"var(--tool-search)",border:"rgba(200,160,216,0.25)"},other:{bg:"var(--muted)",text:"var(--muted-foreground)",border:"var(--border)"}};function g({kind:e,size:t=13}){return"read"===e?(0,s.jsx)(i.A,{size:t}):"write"===e?(0,s.jsx)(o.A,{size:t}):"create"===e?(0,s.jsx)(l.A,{size:t}):"delete"===e?(0,s.jsx)(d.A,{size:t}):"search"===e?(0,s.jsx)(c.A,{size:t}):(0,s.jsx)(u.A,{size:t})}function b(e){try{return new Date(e).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return e}}function v({op:e}){var t,r;let i,o,l,d,c=(0,a.useRouter)(),[u,v]=(0,n.useState)(!1),y=f(e.tool),j=h[y],w="string"==typeof(t=e.params).path?t.path:null,N=e.tool.replace("mindos_","");return(0,s.jsxs)("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:10,overflow:"hidden",marginBottom:8},children:[(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"10px 14px",cursor:"pointer",userSelect:"none"},onClick:()=>v(e=>!e),children:[(0,s.jsxs)("span",{className:"font-display",style:{display:"inline-flex",alignItems:"center",gap:4,padding:"2px 8px",borderRadius:999,fontSize:"0.68rem",fontWeight:600,background:j.bg,color:j.text,border:`1px solid ${j.border}`,flexShrink:0},children:[(0,s.jsx)(g,{kind:y,size:10}),y]}),(0,s.jsx)("span",{className:"font-display",style:{fontSize:"0.78rem",color:"var(--foreground)",fontWeight:600,flexShrink:0},children:N}),w&&(0,s.jsx)("span",{style:{fontSize:"0.72rem",color:"var(--amber)",flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",cursor:"pointer"},onClick:e=>{e.stopPropagation(),c.push("/view/"+w.split("/").map(encodeURIComponent).join("/"))},title:w,className:"font-display",children:w}),(0,s.jsxs)("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[e.agentName&&(0,s.jsx)("span",{className:"font-display",style:{fontSize:"0.62rem",fontWeight:500,padding:"1px 6px",borderRadius:999,background:"var(--muted)",color:"var(--muted-foreground)",whiteSpace:"nowrap",maxWidth:120,overflow:"hidden",textOverflow:"ellipsis"},title:e.agentName,children:e.agentName.length>30?e.agentName.slice(0,30)+"...":e.agentName}),"ok"===e.result?(0,s.jsx)(m.A,{size:13,style:{color:"var(--success)"}}):(0,s.jsx)(x.A,{size:13,style:{color:"var(--error)"}}),(0,s.jsx)("span",{className:"font-display",style:{fontSize:"0.68rem",color:"var(--muted-foreground)",opacity:.6},title:b(e.ts),children:(r=e.ts,o=Math.floor((i=Date.now()-new Date(r).getTime())/6e4),l=Math.floor(i/36e5),d=Math.floor(i/864e5),o<1?"just now":o<60?`${o}m ago`:l<24?`${l}h ago`:`${d}d ago`)}),(0,s.jsx)(p.A,{size:12,style:{color:"var(--muted-foreground)",transform:u?"rotate(180deg)":"none",transition:"transform .15s"}})]})]}),u&&(0,s.jsxs)("div",{style:{borderTop:"1px solid var(--border)",padding:"10px 14px",background:"var(--background)"},children:[(0,s.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:4,marginBottom:8*!!e.message},children:Object.entries(e.params).map(([e,t])=>(0,s.jsxs)("div",{style:{display:"flex",gap:8,alignItems:"flex-start"},children:[(0,s.jsx)("span",{className:"font-display",style:{fontSize:"0.68rem",color:"var(--muted-foreground)",opacity:.7,flexShrink:0,minWidth:80},children:e}),(0,s.jsx)("span",{className:"font-display",style:{fontSize:"0.72rem",color:"var(--foreground)",wordBreak:"break-all",lineHeight:1.5},children:function(e,t=120){let r="string"==typeof e?e:JSON.stringify(e);return r.length>t?r.slice(0,t)+"…":r}(t)})]},e))}),e.message&&(0,s.jsx)("div",{className:"font-display",style:{marginTop:6,padding:"5px 9px",borderRadius:5,fontSize:"0.72rem",background:"error"===e.result?"rgba(200,80,80,0.08)":"rgba(122,173,128,0.08)",color:"error"===e.result?"var(--error)":"var(--success)",border:`1px solid ${"error"===e.result?"rgba(200,80,80,0.2)":"rgba(122,173,128,0.2)"}`},children:e.message}),e.agentName&&(0,s.jsxs)("div",{className:"font-display",style:{marginTop:6,fontSize:"0.68rem",color:"var(--muted-foreground)"},children:["Agent: ",(0,s.jsx)("span",{style:{color:"var(--foreground)",fontWeight:500},children:e.agentName})]}),(0,s.jsx)("div",{className:"font-display",style:{marginTop:6,fontSize:"0.65rem",color:"var(--muted-foreground)",opacity:.5},children:b(e.ts)})]})]})}let y=["all","write","create","delete","read","search"];function j({content:e}){let[t,r]=(0,n.useState)("all"),a=(0,n.useMemo)(()=>(function(e){try{let t=JSON.parse(e);if(Array.isArray(t.events))return t.events.filter(e=>!!e?.tool&&!!e?.ts).sort((e,t)=>new Date(t.ts).getTime()-new Date(e.ts).getTime())}catch{}return(function(e){let t=[];for(let r of e.split("\n")){let e=r.trim();if(!(!e||e.startsWith("#")||e.startsWith("//")))try{let r=JSON.parse(e);r.tool&&r.ts&&t.push(r)}catch{}}return t})(e).sort((e,t)=>new Date(t.ts).getTime()-new Date(e.ts).getTime())})(e),[e]),i=(0,n.useMemo)(()=>"all"===t?a:a.filter(e=>f(e.tool)===t),[a,t]),o=(0,n.useMemo)(()=>{let e={all:a.length};for(let t of a){let r=f(t.tool);e[r]=(e[r]??0)+1}return e},[a]);return 0===a.length?(0,s.jsxs)("div",{className:"font-display",style:{padding:"3rem 1rem",textAlign:"center",color:"var(--muted-foreground)",fontSize:12},children:[(0,s.jsx)(u.A,{size:28,style:{margin:"0 auto 10px",opacity:.3}}),(0,s.jsx)("p",{children:"No agent operations logged yet."}),(0,s.jsxs)("p",{style:{marginTop:6,opacity:.6,fontSize:11},children:["Agent writes appear here from ",(0,s.jsx)("code",{style:{background:"var(--muted)",padding:"1px 5px",borderRadius:4},children:".mindos/agent-audit-log.json"}),"."]})]}):(0,s.jsxs)("div",{style:{maxWidth:760,margin:"0 auto",padding:"1.5rem 0"},children:[(0,s.jsx)("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:"1.2rem",flexWrap:"wrap"},children:y.map(e=>{let n=o[e]??0;if("all"!==e&&!n)return null;let a="all"!==e?h[e]:void 0,i=t===e;return(0,s.jsxs)("button",{onClick:()=>r(e),className:"font-display",style:{display:"inline-flex",alignItems:"center",gap:4,padding:"3px 10px",borderRadius:999,fontSize:"0.7rem",cursor:"pointer",border:"none",background:i?a?.bg??"var(--accent)":"var(--muted)",color:i?a?.text??"var(--foreground)":"var(--muted-foreground)",outline:i?`1px solid ${a?.border??"var(--border)"}`:"none",transition:"all .1s"},children:["all"!==e&&(0,s.jsx)(g,{kind:e,size:10}),e," ",(0,s.jsxs)("span",{style:{opacity:.6},children:["(",n,")"]})]},e)})}),(0,s.jsx)("div",{children:i.map((e,t)=>(0,s.jsx)(v,{op:e},t))})]})}},20555:(e,t,r)=>{"use strict";r.d(t,{LD:()=>s,LZ:()=>n,qQ:()=>a});let s=[{id:"c1",icon:"\uD83D\uDC64",category:"memory-sync",scenario:"first-day"},{id:"c2",icon:"\uD83D\uDCE5",category:"knowledge-management",scenario:"daily"},{id:"c3",icon:"\uD83D\uDD04",category:"memory-sync",scenario:"project"},{id:"c4",icon:"\uD83D\uDD01",category:"experience-evolution",scenario:"daily"},{id:"c5",icon:"\uD83D\uDCA1",category:"auto-execute",scenario:"daily"},{id:"c6",icon:"\uD83D\uDE80",category:"auto-execute",scenario:"project"},{id:"c7",icon:"\uD83D\uDD0D",category:"knowledge-management",scenario:"project"},{id:"c8",icon:"\uD83E\uDD1D",category:"human-insights",scenario:"daily"},{id:"c9",icon:"\uD83D\uDEE1️",category:"audit-control",scenario:"advanced"}],n=["knowledge-management","memory-sync","auto-execute","experience-evolution","human-insights","audit-control"],a=["first-day","daily","project","advanced"]},20814:(e,t,r)=>{"use strict";r.r(t),r.d(t,{ImageRenderer:()=>i});var s=r(95155),n=r(12115);let a=[.25,.5,.75,1,1.5,2,3,4];function i({filePath:e}){let t=`/api/file/raw?path=${encodeURIComponent(e)}`,r=e.split("/").pop()??"image",i=r.split(".").pop()?.toLowerCase()??"",o=["png","svg","webp","ico","gif"].includes(i),[l,d]=(0,n.useState)(!0),[c,u]=(0,n.useState)(!1),[m,x]=(0,n.useState)(0),[p,f]=(0,n.useState)("fit"),[h,g]=(0,n.useState)(null),[b,v]=(0,n.useState)(null),y=(0,n.useRef)(null),j=(0,n.useRef)(null),w=(0,n.useCallback)(()=>{d(!1);let e=y.current;e&&g({w:e.naturalWidth,h:e.naturalHeight})},[]),N=(0,n.useCallback)(()=>{d(!1),u(!0)},[]),k=(0,n.useCallback)(()=>{u(!1),d(!0),x(e=>e+1)},[]);(0,n.useEffect)(()=>{l||c||null!==b||fetch(t,{method:"HEAD"}).then(e=>{let t=e.headers.get("Content-Length");t&&v(parseInt(t,10))}).catch(()=>{})},[t,l,c,b]);let S=(0,n.useCallback)(()=>{f(e=>{let t="fit"===e?1:e;return a.find(e=>e>t)??t})},[]),C=(0,n.useCallback)(()=>{f(e=>{let t="fit"===e?1:e;return[...a].reverse().find(e=>e<t)??t})},[]),A=(0,n.useCallback)(()=>{f(e=>"fit"===e?1:"fit")},[]);(0,n.useEffect)(()=>{let e=j.current;if(!e)return;let t=t=>{t.target instanceof HTMLInputElement||t.target instanceof HTMLTextAreaElement||(document.activeElement===document.body||e.contains(document.activeElement))&&(("+"===t.key||"="===t.key)&&(t.preventDefault(),S()),"-"===t.key&&(t.preventDefault(),C()),"0"===t.key&&(t.preventDefault(),f("fit")),"1"===t.key&&(t.preventDefault(),f(1)))};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[S,C]);let z="fit"===p?"Fit":`${Math.round(100*p)}%`,E="fit"===p?{maxWidth:"100%",maxHeight:"70vh",objectFit:"contain"}:h?{width:h.w*p,height:"auto"}:{maxWidth:"100%",maxHeight:"70vh",objectFit:"contain"};return(0,s.jsxs)("div",{className:"w-full flex flex-col gap-0",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border text-xs text-[var(--text-secondary)]",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[h&&(0,s.jsxs)("span",{children:[h.w," x ",h.h]}),null!==b&&(0,s.jsx)("span",{children:b<1024?`${b} B`:b<1048576?`${(b/1024).toFixed(1)} KB`:`${(b/1048576).toFixed(1)} MB`}),(0,s.jsx)("span",{className:"uppercase opacity-60",children:i})]}),(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[(0,s.jsx)("button",{onClick:C,disabled:!h,className:"px-2 py-1 rounded hover:bg-[var(--bg-hover)] transition-colors disabled:opacity-30",title:"Zoom out (-)",children:"-"}),(0,s.jsx)("button",{onClick:A,disabled:!h,className:"px-2 py-1 rounded hover:bg-[var(--bg-hover)] transition-colors min-w-[48px] text-center disabled:opacity-30",title:"fit"===p?"Actual size (1)":"Fit to view (0)",children:z}),(0,s.jsx)("button",{onClick:S,disabled:!h,className:"px-2 py-1 rounded hover:bg-[var(--bg-hover)] transition-colors disabled:opacity-30",title:"Zoom in (+)",children:"+"})]})]}),(0,s.jsxs)("div",{ref:j,tabIndex:-1,className:`relative flex-1 min-h-[70vh] overflow-auto flex items-center justify-center outline-none ${o?"bg-checkerboard":"bg-[var(--bg-secondary)]"}`,children:[l&&!c&&(0,s.jsx)("div",{className:"absolute inset-0 flex items-center justify-center z-10",children:(0,s.jsx)("span",{className:"text-sm text-[var(--text-tertiary)] animate-pulse",children:"Loading..."})}),c&&(0,s.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center z-10 gap-2",children:[(0,s.jsx)("span",{className:"text-sm text-[var(--text-secondary)]",children:"Failed to load image"}),(0,s.jsx)("button",{onClick:k,className:"text-xs px-3 py-1.5 rounded-md bg-[var(--bg-tertiary)] hover:bg-[var(--bg-hover)] transition-colors",children:"Retry"})]}),(0,s.jsx)("img",{ref:y,src:t,alt:r,onLoad:w,onError:N,draggable:!1,className:"select-none",style:{display:c?"none":"block",...E}},m)]})]})}},20870:(e,t,r)=>{"use strict";r.r(t),r.d(t,{PdfRenderer:()=>a});var s=r(95155),n=r(12115);function a({filePath:e}){let t=`/api/file/raw?path=${encodeURIComponent(e)}`,[r,a]=(0,n.useState)(!0),[i,o]=(0,n.useState)(!1),[l,d]=(0,n.useState)(0),c=(0,n.useCallback)(()=>{o(!1),a(!0),d(e=>e+1)},[]);return(0,s.jsxs)("div",{className:"w-full h-full min-h-[80vh] flex flex-col relative",children:[r&&!i&&(0,s.jsx)("div",{className:"absolute inset-0 flex items-center justify-center bg-[var(--bg-secondary)] rounded-lg z-10",children:(0,s.jsx)("span",{className:"text-sm text-[var(--text-tertiary)] animate-pulse",children:"Loading PDF..."})}),i&&(0,s.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center bg-[var(--bg-secondary)] rounded-lg z-10 gap-2",children:[(0,s.jsx)("span",{className:"text-sm text-[var(--text-secondary)]",children:"Failed to load PDF"}),(0,s.jsx)("button",{onClick:c,className:"text-xs px-3 py-1.5 rounded-md bg-[var(--bg-tertiary)] hover:bg-[var(--bg-hover)] transition-colors",children:"Retry"})]}),(0,s.jsx)("iframe",{src:t,className:"w-full flex-1 min-h-[80vh] border-0 rounded-lg bg-[var(--bg-secondary)]",title:e.split("/").pop()??"PDF",onLoad:()=>a(!1),onError:()=>{a(!1),o(!0)},style:{display:i?"none":"block"}},l)]})}},20886:(e,t,r)=>{"use strict";r.d(t,{f:()=>n});var s=r(9339);let n=(0,s.createServerReference)("60bf170c04cd444d406077c299673aaa9fb397a3c3",s.callServer,void 0,s.findSourceMapURL,"renameFileAction")},26490:(e,t,r)=>{"use strict";r.d(t,{default:()=>u});var s=r(95155),n=r(12115),a=r(94514),i=r(13545),o=r(68822),l=r(33210),d=r(4235);let c={success:(0,s.jsx)(a.A,{size:15,className:"text-success shrink-0"}),error:(0,s.jsx)(i.A,{size:15,className:"text-error shrink-0"}),info:(0,s.jsx)(o.A,{size:15,className:"text-muted-foreground shrink-0"})};function u(){let e=(0,n.useSyncExternalStore)(d.B1,d.dV,d.dV);return 0===e.length?null:(0,s.jsx)("div",{className:"fixed bottom-4 right-4 z-50 flex flex-col-reverse gap-2 pointer-events-none",role:"status","aria-live":"polite","aria-atomic":"false",children:e.map(e=>(0,s.jsxs)("div",{className:"pointer-events-auto flex items-center gap-2.5 bg-card border border-border rounded-lg shadow-lg px-4 py-2.5 min-w-[180px] max-w-[320px] animate-in slide-in-from-right-4 fade-in duration-200",children:[c[e.type],(0,s.jsx)("span",{className:"text-sm text-foreground flex-1 truncate",children:e.message}),e.action&&(0,s.jsx)("button",{type:"button",onClick:()=>{e.action.onClick(),(0,d.X8)(e.id)},className:"shrink-0 px-2.5 py-1 rounded text-xs font-medium text-[var(--amber)] hover:bg-[var(--amber-dim)] transition-colors min-h-[28px] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:e.action.label}),(0,s.jsx)("button",{type:"button",onClick:()=>(0,d.X8)(e.id),className:"shrink-0 p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring","aria-label":e.action?.label?"Close":"Dismiss",children:(0,s.jsx)(l.A,{size:13})})]},e.id))})}},28465:(e,t,r)=>{"use strict";r.d(t,{i:()=>n});var s=r(9339);let n=(0,s.createServerReference)("4007b1c8b714660fe965749fe7697369df70e9ec4a",s.callServer,void 0,s.findSourceMapURL,"deleteFileAction")},29494:(e,t,r)=>{"use strict";r.d(t,{Aw:()=>l,Nh:()=>c,QL:()=>a,TM:()=>i,h0:()=>o,lL:()=>d});var s=r(4235);function n(e){let t=new Uint8Array(e),r=[];for(let e=0;e<t.length;e+=8192)r.push(String.fromCharCode(...t.subarray(e,e+8192)));return btoa(r.join(""))}async function a(e,t){let r=[],a=0;for(let t of e){if(t.size>0xa00000){a++;continue}try{if(t.name.toLowerCase().endsWith(".pdf")){let e=await t.arrayBuffer();r.push({name:t.name,content:n(e),encoding:"base64"})}else{let e=await t.text();r.push({name:t.name,content:e})}}catch{}}if(0===r.length)return void(a>0?s.oR.error(t.inbox.tooLarge(a),4e3):e.length>0&&s.oR.error(t.inbox.saveFailed,4e3));try{var i;let e=await fetch("/api/inbox",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:r})});if(!e.ok){let r=await e.json().catch(()=>({}));console.error("[QuickDrop] Save failed:",r.error),s.oR.error(t.inbox.saveFailed,4e3);return}let n=await e.json(),o=n.saved?.length??0,l=n.skipped?.length??0;i=a,o>0&&i>0&&0===l?s.oR.success(t.inbox.savedWithOversized(o,i),4e3):o>0&&l+i>0?s.oR.success(t.inbox.savedWithSkipped(o,l+i),4e3):o>0?s.oR.success(t.inbox.savedToast(o),3e3):(i>0&&s.oR.error(t.inbox.tooLarge(i),4e3),l>0&&s.oR.error(t.inbox.savedWithSkipped(0,l),4e3),0===i&&0===l&&s.oR.error(t.inbox.saveFailed,4e3)),window.dispatchEvent(new Event("mindos:files-changed")),window.dispatchEvent(new Event("mindos:inbox-updated"))}catch(e){console.error("[QuickDrop] Network error:",e),s.oR.error(t.inbox.saveFailed,4e3)}}async function i(e,t){try{let r=await fetch("/api/inbox/clip",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:e})}),n=await r.json();if(!r.ok){let e=n.error||t.inbox.clipFailed;return s.oR.error(e,4e3),{ok:!1}}return s.oR.success(t.inbox.clipSuccess(n.title||e),3e3),window.dispatchEvent(new Event("mindos:files-changed")),window.dispatchEvent(new Event("mindos:inbox-updated")),{ok:!0,title:n.title}}catch(e){return console.error("[ClipURL] Network error:",e),s.oR.error(t.inbox.clipFailed,4e3),{ok:!1}}}function o(e){let t=e.trim();if(!t.startsWith("http://")&&!t.startsWith("https://"))return!1;try{return new URL(t),!0}catch{return!1}}function l(e){if(e.dataTransfer?.files&&e.dataTransfer.files.length>0)return null;let t=e.dataTransfer?.getData("text/uri-list");if(t){let e=t.split(/[\r\n]+/).find(e=>!e.startsWith("#")&&e.trim().length>0);if(e&&o(e))return e.trim()}let r=e.dataTransfer?.getData("text/plain");return r&&o(r)?r.trim():null}function d(e){let t=e.dataTransfer?.types??[];return!t.includes("Files")&&(t.includes("text/uri-list")||t.includes("text/plain"))}async function c(e,t,r){let a=[],i=0,o=new Set(["pdf","png","jpg","jpeg","gif","webp","bmp","ico","mp3","wav","m4a","ogg","flac","aac","mp4","webm","mov","mkv"]);for(let t of e){if(t.size>0xa00000){i++;continue}try{let e=(t.name.split(".").pop()??"").toLowerCase();if(o.has(e)){let e=await t.arrayBuffer();a.push({name:t.name,content:n(e),encoding:"base64"})}else{let e=await t.text();a.push({name:t.name,content:e})}}catch{}}if(0===a.length)return void(i>0?s.oR.error(r.inbox.tooLarge(i),4e3):e.length>0&&s.oR.error(r.inbox.saveFailed,4e3));let l=t.split("/").pop()||t;try{let e=await fetch("/api/file/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:a,targetSpace:t,organize:!1,conflict:"rename"})});if(!e.ok){let t=await e.json().catch(()=>({}));console.error("[TreeDrop] Save failed:",t.error),s.oR.error(r.inbox.saveFailed,4e3);return}let n=await e.json(),o=n.created?.length??0,d=n.skipped?.length??0;o>0&&d+i>0?s.oR.success(r.inbox.savedWithSkipped(o,d+i),4e3):o>0?s.oR.success(r.inbox.savedToDir(o,l),3e3):(i>0&&s.oR.error(r.inbox.tooLarge(i),4e3),d>0&&s.oR.error(r.inbox.savedWithSkipped(0,d),4e3)),window.dispatchEvent(new Event("mindos:files-changed"))}catch(e){console.error("[TreeDrop] Network error:",e),s.oR.error(r.inbox.saveFailed,4e3)}}},30266:(e,t,r)=>{Promise.resolve().then(r.t.bind(r,66872,23)),Promise.resolve().then(r.bind(r,92524)),Promise.resolve().then(r.bind(r,86343)),Promise.resolve().then(r.bind(r,18847)),Promise.resolve().then(r.bind(r,14446)),Promise.resolve().then(r.bind(r,88946)),Promise.resolve().then(r.bind(r,57025)),Promise.resolve().then(r.bind(r,35504)),Promise.resolve().then(r.bind(r,92306)),Promise.resolve().then(r.bind(r,92950)),Promise.resolve().then(r.bind(r,20814)),Promise.resolve().then(r.bind(r,20870)),Promise.resolve().then(r.bind(r,56406)),Promise.resolve().then(r.bind(r,39594)),Promise.resolve().then(r.bind(r,78660)),Promise.resolve().then(r.bind(r,87986)),Promise.resolve().then(r.bind(r,48133)),Promise.resolve().then(r.bind(r,58616)),Promise.resolve().then(r.bind(r,26490)),Promise.resolve().then(r.bind(r,91459)),Promise.resolve().then(r.bind(r,40430)),Promise.resolve().then(r.bind(r,98959)),Promise.resolve().then(r.bind(r,93042)),Promise.resolve().then(r.t.bind(r,16719,23)),Promise.resolve().then(r.t.bind(r,377,23)),Promise.resolve().then(r.t.bind(r,98663,23)),Promise.resolve().then(r.t.bind(r,75282,23))},35504:(e,t,r)=>{"use strict";r.r(t),r.d(t,{ConfigRenderer:()=>d});var s=r(95155),n=r(12115),a=r(6296),i=r(94514),o=r(33210),l=r(51914);function d({content:e,saveAction:t}){let r=(0,n.useMemo)(()=>{try{return JSON.parse(e)}catch{return null}},[e]),[d,c]=(0,n.useState)(r),[u,m]=(0,n.useState)(!1),[x,p]=(0,n.useState)(!1),[f,h]=(0,n.useState)(""),[g,b]=(0,n.useState)({});(0,n.useEffect)(()=>{c(r),h("")},[r]);let v=d??{},y=v.uiSchema?.sections??[],j=v.keySpecs??{},w=(0,n.useCallback)(async e=>{m(!0),p(!1),h("");try{await t(`${JSON.stringify(e,null,2)}
|
|
21
|
-
`),p(!0),setTimeout(()=>p(!1),1200)}catch(e){h(e instanceof Error?e.message:"Failed to save")}finally{m(!1)}},[t]),N=(0,n.useCallback)(async(e,t)=>{if(!d)return;let r=function(e,t,r){let s=t.split("."),n=structuredClone(e),a=n;for(let e=0;e<s.length-1;e++){let t=s[e],r=a[t];(!r||"object"!=typeof r||Array.isArray(r))&&(a[t]={}),a=a[t]}return a[s[s.length-1]]=r,n}(d,e,t);c(r),await w(r)},[d,w]);return r&&d?(0,s.jsxs)("div",{className:"max-w-3xl mx-auto flex flex-col gap-3",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between rounded-xl border border-border bg-card px-4 py-2.5",children:[(0,s.jsx)("div",{className:"text-xs text-muted-foreground",children:"CONFIG Control Panel"}),(0,s.jsxs)("div",{className:"text-xs flex items-center gap-2",children:[u&&(0,s.jsxs)("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:[(0,s.jsx)(a.A,{size:12,className:"animate-spin"}),"Saving"]}),!u&&x&&(0,s.jsxs)("span",{className:"inline-flex items-center gap-1",style:{color:"var(--success)"},children:[(0,s.jsx)(i.A,{size:12}),"Saved"]})]})]}),f&&(0,s.jsx)("div",{className:"rounded-lg border border-error/30 bg-error/10 px-3 py-2 text-xs text-error",children:f}),y.map(e=>(0,s.jsxs)("div",{className:"rounded-xl border border-border bg-card p-4",children:[(0,s.jsxs)("div",{className:"mb-3",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:e.title}),e.description&&(0,s.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:e.description})]}),(0,s.jsx)("div",{className:"space-y-3",children:e.fields.map(e=>{let t=j[e]??{},r=function(e,t){let r=t.split("."),s=e;for(let e of r){if(!s||"object"!=typeof s||!(e in s))return null;s=s[e]}return s}(d,e),n=t.label||e;return(0,s.jsxs)("div",{className:"rounded-lg border border-border/80 bg-background px-3 py-2.5",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3 mb-1.5",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-sm text-foreground",children:n}),t.description&&(0,s.jsx)("div",{className:"text-xs text-muted-foreground mt-0.5",children:t.description})]}),"switch"===t.control&&"boolean"==typeof r&&(0,s.jsx)("button",{type:"button",onClick:()=>N(e,!r),className:"px-2.5 py-1 rounded-md text-xs font-medium",style:{background:r?"var(--amber)":"var(--muted)",color:r?"var(--amber-foreground)":"var(--muted-foreground)"},children:r?"ON":"OFF"})]}),"text"===t.control&&"string"==typeof r&&(0,s.jsx)("input",{defaultValue:r,onBlur:t=>N(e,t.target.value),className:"w-full px-2 py-1.5 text-sm bg-card border border-border rounded text-foreground"}),"number"===t.control&&"number"==typeof r&&(0,s.jsx)("input",{type:"number",defaultValue:r,min:t.constraints?.min,max:t.constraints?.max,onBlur:s=>{let n=Number(s.target.value),a=t.constraints?.min,i=t.constraints?.max,o=Number.isFinite(n)?n:r;"number"==typeof a&&o<a&&(o=a),"number"==typeof i&&o>i&&(o=i),N(e,o)},className:"w-full px-2 py-1.5 text-sm bg-card border border-border rounded text-foreground"}),"tag-list"===t.control&&Array.isArray(r)&&(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,s.jsx)("div",{className:"flex flex-wrap gap-1.5",children:r.map((t,n)=>(0,s.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded border border-border text-xs bg-muted text-foreground",children:[String(t),(0,s.jsx)("button",{type:"button",onClick:()=>N(e,r.filter((e,t)=>t!==n)),className:"text-muted-foreground hover:text-foreground",children:(0,s.jsx)(o.A,{size:11})})]},`${String(t)}-${n}`))}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("input",{value:g[e]??"",onChange:t=>b(r=>({...r,[e]:t.target.value})),onKeyDown:t=>{if("Enter"!==t.key)return;t.preventDefault();let s=(g[e]??"").trim();s&&(N(e,[...r,s]),b(t=>({...t,[e]:""})))},className:"flex-1 px-2 py-1.5 text-sm bg-card border border-border rounded text-foreground",placeholder:"Add item"}),(0,s.jsxs)("button",{type:"button",onClick:()=>{let t=(g[e]??"").trim();t&&(N(e,[...r,t]),b(t=>({...t,[e]:""})))},className:"px-2.5 py-1.5 rounded-md text-xs bg-muted text-foreground inline-flex items-center gap-1",children:[(0,s.jsx)(l.A,{size:12})," Add"]})]})]})]},e)})})]},e.id))]}):(0,s.jsx)("div",{className:"rounded-xl border border-border p-4 text-sm text-error",children:"CONFIG.json parse failed. Please check JSON format."})}},39594:(e,t,r)=>{"use strict";r.r(t),r.d(t,{TimelineRenderer:()=>l});var s=r(95155),n=r(12115);let a=/(\d{4}[-/]\d{1,2}(?:[-/]\d{1,2})?|[A-Za-z]+ \d{4}|\d{4}年\d{1,2}月(?:\d{1,2}日)?)/;function i(e){return e.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/`(.+?)`/g,'<code class="font-display" style="font-size:0.85em;padding:1px 5px;border-radius:4px;background:var(--muted)">$1</code>').replace(/\[\[([^\]|]+)(?:\|([^\]]+))?\]\]/g,(e,t,r)=>`<span style="color:var(--amber);cursor:pointer" title="${t}">${r??t}</span>`).replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" style="color:var(--amber)">$1</a>')}let o=[{bg:"rgba(200,135,58,0.12)",text:"var(--amber)"},{bg:"rgba(122,173,128,0.12)",text:"var(--success)"},{bg:"rgba(138,180,216,0.12)",text:"var(--tool-read)"},{bg:"rgba(200,160,216,0.12)",text:"var(--tool-search)"}];function l({content:e}){let t=(0,n.useMemo)(()=>(function(e){let t=e.split("\n"),r=[],s=null,n=[],i=()=>{let e,t;if(!s)return;let a=n.join("\n").trim();s.body=a,s.tags=(e=[],(t=a.match(/#([\w\u4e00-\u9fff]+)/g))&&e.push(...t.map(e=>e.slice(1))),[...new Set(e)]),r.push(s),s=null,n=[]};for(let e of t)if(!/^# /.test(e)){if(/^## /.test(e)){i();let t=e.slice(3).trim();s={heading:t,date:function(e){let t=a.exec(e);if(!t)return null;let r=new Date(t[1].replace(/[/年月]/g,"-").replace("日",""));return isNaN(r.getTime())?null:r}(t),body:"",tags:[]};continue}s&&n.push(e)}return i(),r})(e),[e]);return 0===t.length?(0,s.jsxs)("div",{className:"font-display",style:{padding:"3rem 1rem",textAlign:"center",color:"var(--muted-foreground)",fontSize:13},children:["No timeline entries found. Add ",(0,s.jsx)("code",{style:{background:"var(--muted)",padding:"1px 6px",borderRadius:4},children:"## 2025-01-15"})," headings to create entries."]}):(0,s.jsxs)("div",{style:{maxWidth:720,margin:"0 auto",padding:"1.5rem 0"},children:[(0,s.jsx)("div",{style:{marginBottom:"1.5rem",display:"flex",alignItems:"center",gap:8},children:(0,s.jsxs)("span",{className:"font-display",style:{fontSize:11,color:"var(--muted-foreground)"},children:[t.length," ",1===t.length?"entry":"entries"]})}),(0,s.jsxs)("div",{style:{position:"relative",paddingLeft:28},children:[(0,s.jsx)("div",{style:{position:"absolute",left:6,top:8,bottom:8,width:1,background:"var(--border)"}}),t.map((e,t)=>(0,s.jsxs)("div",{style:{position:"relative",marginBottom:"1.5rem"},children:[(0,s.jsx)("div",{style:{position:"absolute",left:-22,top:10,width:9,height:9,borderRadius:"50%",background:e.date?"var(--amber)":"var(--border)",outline:e.date?"2px solid var(--amber-dim)":"none",zIndex:1}}),(0,s.jsxs)("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:10,padding:"14px 18px",transition:"border-color .15s"},children:[(0,s.jsxs)("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:12,flexWrap:"wrap",marginBottom:8},children:[(0,s.jsx)("span",{style:{fontWeight:600,fontSize:"0.9rem",color:"var(--foreground)"},children:e.heading}),e.date&&(0,s.jsx)("span",{className:"font-display",style:{fontSize:"0.7rem",color:"var(--muted-foreground)",opacity:.7,flexShrink:0},children:e.date.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})})]}),e.body&&(0,s.jsx)("div",{dangerouslySetInnerHTML:{__html:function(e){let t=e.split("\n"),r=[],s=!1,n=()=>{s&&(r.push("</ul>"),s=!1)};for(let e of t){let t=e.trimEnd();if(!t){n(),r.push("<br/>");continue}if(/^### /.test(t)){n(),r.push(`<h3 style="font-size:0.8rem;font-weight:600;color:var(--muted-foreground);text-transform:uppercase;letter-spacing:.06em;margin:.9em 0 .3em">${i(t.slice(4))}</h3>`);continue}if(/^- /.test(t)||/^\* /.test(t)){s||(r.push('<ul style="margin:.3em 0;padding-left:1.2em;list-style:disc">'),s=!0),r.push(`<li style="margin:.15em 0;font-size:.82rem;color:var(--foreground)">${i(t.slice(2))}</li>`);continue}if(/^\d+\. /.test(t)){s||(r.push('<ol style="margin:.3em 0;padding-left:1.2em">'),s=!0),r.push(`<li style="margin:.15em 0;font-size:.82rem;color:var(--foreground)">${i(t.replace(/^\d+\. /,""))}</li>`);continue}n(),r.push(`<p style="margin:.25em 0;font-size:.82rem;line-height:1.6;color:var(--foreground)">${i(t)}</p>`)}return n(),r.join("")}(e.body)}}),e.tags.length>0&&(0,s.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:5,marginTop:10},children:e.tags.map(e=>{let t=function(e){let t=0;for(let r=0;r<e.length;r++)t=31*t+e.charCodeAt(r)&65535;return o[t%o.length]}(e);return(0,s.jsxs)("span",{className:"font-display",style:{fontSize:"0.68rem",padding:"1px 8px",borderRadius:999,background:t.bg,color:t.text},children:["#",e]},e)})})]})]},t))]})]})}},40430:(e,t,r)=>{"use strict";r.d(t,{default:()=>d});var s=r(95155),n=r(12115),a=r(12651),i=r(6296),o=r(35581);let l="mindos_update_in_progress";function d(){let[e,t]=(0,n.useState)(!1),[r,d]=(0,n.useState)(!1),c=(0,n.useRef)(void 0),{locale:u}=(0,o.Y)(),m="zh"===u,x=(0,n.useCallback)(()=>{c.current=setInterval(async()=>{try{if((await fetch("/api/health",{signal:AbortSignal.timeout(3e3)})).ok){clearInterval(c.current),c.current=void 0;try{let e=localStorage.getItem(l);if(e){let{originalVer:t}=JSON.parse(e),r=await fetch("/api/update-check",{signal:AbortSignal.timeout(5e3)}).then(e=>e.json());if(r.current&&r.current!==t){d(!0),localStorage.removeItem(l),localStorage.removeItem("mindos_update_latest"),localStorage.removeItem("mindos_update_dismissed"),setTimeout(()=>window.location.reload(),1500);return}}}catch{}localStorage.removeItem(l),window.location.reload()}}catch{}},3e3)},[]);return((0,n.useEffect)(()=>{let e=()=>{localStorage.getItem(l)&&(t(!0),c.current||x())};e();let r=()=>e();return window.addEventListener("mindos:update-started",r),window.addEventListener("storage",r),()=>{clearInterval(c.current),c.current=void 0,window.removeEventListener("mindos:update-started",r),window.removeEventListener("storage",r)}},[x]),e)?(0,s.jsxs)("div",{style:{position:"fixed",inset:0,zIndex:99999,background:"rgba(0,0,0,0.7)",backdropFilter:"blur(8px)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",fontFamily:"'IBM Plex Sans', system-ui, sans-serif"},children:[r?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(a.A,{size:32,style:{color:"var(--success)",marginBottom:12}}),(0,s.jsx)("div",{style:{color:"var(--foreground)",fontSize:18,fontWeight:600},children:m?"更新成功!":"Update Complete!"}),(0,s.jsx)("div",{style:{color:"var(--muted-foreground)",fontSize:13,marginTop:6},children:m?"正在刷新页面...":"Reloading..."})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(i.A,{size:32,style:{color:"var(--amber)",marginBottom:12,animation:"spin 1s linear infinite"}}),(0,s.jsx)("div",{style:{color:"var(--foreground)",fontSize:18,fontWeight:600},children:m?"MindOS 正在更新...":"MindOS is Updating..."}),(0,s.jsx)("div",{style:{color:"var(--muted-foreground)",fontSize:13,marginTop:6,textAlign:"center",maxWidth:300,lineHeight:1.5},children:m?"服务正在重启,请勿关闭此页面。完成后将自动刷新。":"The server is restarting. Please do not close this page. It will auto-reload when ready."})]}),(0,s.jsx)("style",{children:"@keyframes spin { to { transform: rotate(360deg) } }"})]}):null}},46838:(e,t,r)=>{"use strict";r.d(t,{$7:()=>i,MZ:()=>c,TS:()=>l,UG:()=>a,YB:()=>d,pl:()=>o});let s=[],n=new Set;function a(){try{let e=localStorage.getItem("mindos-disabled-renderers");n=new Set(e?JSON.parse(e):[])}catch{n=new Set}}function i(e,t){let r=s.find(t=>t.id===e);r?.core||(t?n.delete(e):n.add(e),localStorage.setItem("mindos-disabled-renderers",JSON.stringify([...n])))}function o(e){let t=s.find(t=>t.id===e);return!!t?.core||!n.has(e)}function l(e){s.find(t=>t.id===e.id)||s.push(e)}function d(e,t,r){if(r){let e=s.find(e=>e.id===r);return e&&o(e.id)?e:void 0}return s.find(r=>o(r.id)&&r.match({filePath:e,extension:t}))}function c(){return s.filter(e=>!e.appBuiltinFeature)}},48133:(e,t,r)=>{"use strict";r.r(t),r.d(t,{WorkflowYamlRenderer:()=>Q});var s=r(95155),n=r(12115),a=r(49387),i=r(20232),o=r(53961),l=r(13545),d=r(73620),c=r(42129),u=r(51914),m=r(6296),x=r(55243),p=r(12651),f=r(66088),h=r(9921),g=r(68459),b=r(1164),v=r(61878),y=r(33210),j=r(48368),w=r(38798),N=r(21362);function k({trigger:e,children:t,open:r,onClose:a}){let i=(0,n.useRef)(null);return(0,n.useEffect)(()=>{if(!r)return;let e=e=>{i.current&&!i.current.contains(e.target)&&a()};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[r,a]),(0,s.jsxs)("div",{ref:i,className:"relative",children:[e,r&&(0,s.jsx)("div",{className:"absolute top-full left-0 mt-1 w-full min-w-[220px] max-h-[260px] overflow-y-auto bg-card border border-border rounded-lg shadow-lg z-50",children:t})]})}let S=null,C=!1,A=[];function z({value:e,onChange:t}){let[r,a]=(0,n.useState)(!1),[i,o]=(0,n.useState)(""),[l,d]=(0,n.useState)(S??[]),[c,u]=(0,n.useState)("");(0,n.useEffect)(()=>{S?d(S):(A.push(d),C||(C=!0,fetch("/api/acp/registry").then(e=>e.json()).then(e=>{let t=(e.registry?.agents??[]).map(e=>({id:e.id,name:e.name||e.id}));S=t,A.forEach(e=>e(t)),A.length=0}).catch(()=>{S=[],A.forEach(e=>e([])),A.length=0})))},[]);let m=c?l.filter(e=>e.id.toLowerCase().includes(c.toLowerCase())||e.name.toLowerCase().includes(c.toLowerCase())):l,x=e=>{t(e),a(!1),u("")},p=e?l.find(t=>t.id===e)?.name||e:void 0;return(0,s.jsxs)(k,{open:r,onClose:()=>{a(!1),u("")},trigger:(0,s.jsxs)("button",{type:"button",onClick:()=>a(e=>!e),className:"w-full flex items-center justify-between px-2.5 py-1.5 text-xs rounded-md border border-border bg-background text-foreground hover:bg-muted transition-colors",children:[(0,s.jsx)("span",{className:e?"text-foreground truncate":"text-muted-foreground",children:p||"MindOS"}),(0,s.jsx)(f.A,{size:12,className:"text-muted-foreground shrink-0"})]}),children:[(0,s.jsx)("div",{className:"sticky top-0 bg-card border-b border-border px-2.5 py-1.5",children:(0,s.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-1 rounded border border-border bg-background",children:[(0,s.jsx)(v.A,{size:11,className:"text-muted-foreground shrink-0"}),(0,s.jsx)("input",{type:"text",value:c,onChange:e=>u(e.target.value),autoFocus:!0,placeholder:"Search agents...",className:"flex-1 text-xs bg-transparent text-foreground placeholder:text-muted-foreground focus:outline-none"})]})}),(0,s.jsxs)("button",{onClick:()=>x(void 0),className:`w-full text-left px-3 py-1.5 text-xs hover:bg-muted transition-colors ${!e?"text-[var(--amber)] font-medium":"text-foreground"}`,children:["MindOS ",(0,s.jsx)("span",{className:"text-muted-foreground/50 ml-1",children:"(default)"})]}),m.slice(0,30).map(t=>(0,s.jsxs)("button",{onClick:()=>x(t.id),className:`w-full text-left px-3 py-1.5 text-xs hover:bg-muted transition-colors ${e===t.id?"text-[var(--amber)] font-medium":"text-foreground"}`,children:[t.name," ",t.name!==t.id&&(0,s.jsxs)("span",{className:"text-muted-foreground/50 ml-1",children:["(",t.id,")"]})]},t.id)),0===l.length&&(0,s.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:"Loading..."}),l.length>0&&0===m.length&&!c&&(0,s.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:"No ACP agents found"}),(0,s.jsx)("div",{className:"border-t border-border px-2.5 py-1.5",children:(0,s.jsx)("input",{type:"text",value:i,onChange:e=>o(e.target.value),onKeyDown:e=>{"Enter"===e.key&&i.trim()&&(x(i.trim()),o(""))},placeholder:"Custom agent ID...",className:"w-full px-2 py-1 text-xs rounded border border-border bg-background text-foreground placeholder:text-muted-foreground focus:outline-none focus-visible:ring-1 focus-visible:ring-ring"})})]})}let E=[{group:"Anthropic",models:["claude-sonnet-4-6","claude-opus-4","claude-3.5-sonnet","claude-3.5-haiku"]},{group:"OpenAI",models:["gpt-4o","gpt-4o-mini","o3","o4-mini"]},{group:"Google",models:["gemini-2.5-pro","gemini-2.5-flash"]}];function $({value:e,onChange:t}){let[r,a]=(0,n.useState)(!1),[i,o]=(0,n.useState)(""),l=e=>{t(e),a(!1)};return(0,s.jsxs)(k,{open:r,onClose:()=>a(!1),trigger:(0,s.jsxs)("button",{type:"button",onClick:()=>a(e=>!e),className:"w-full flex items-center justify-between px-2.5 py-1.5 text-xs rounded-md border border-border bg-background text-foreground hover:bg-muted transition-colors",children:[(0,s.jsx)("span",{className:e?"text-foreground truncate":"text-muted-foreground",children:e||"Default model"}),e?(0,s.jsx)(y.A,{size:12,className:"text-muted-foreground shrink-0 hover:text-foreground cursor-pointer",onClick:e=>{e.stopPropagation(),l(void 0)}}):(0,s.jsx)(f.A,{size:12,className:"text-muted-foreground shrink-0"})]}),children:[(0,s.jsx)("button",{onClick:()=>l(void 0),className:`w-full text-left px-3 py-1.5 text-xs hover:bg-muted transition-colors ${!e?"text-[var(--amber)] font-medium":"text-muted-foreground"}`,children:"(default)"}),E.map(t=>(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"px-3 py-1 text-2xs font-semibold text-muted-foreground/60 uppercase tracking-wide bg-muted/30",children:t.group}),t.models.map(t=>(0,s.jsx)("button",{onClick:()=>l(t),className:`w-full text-left px-3 py-1.5 text-xs hover:bg-muted transition-colors ${e===t?"text-[var(--amber)] font-medium":"text-foreground"}`,children:t},t))]},t.group)),(0,s.jsx)("div",{className:"border-t border-border px-2.5 py-1.5",children:(0,s.jsx)("input",{type:"text",value:i,onChange:e=>o(e.target.value),onKeyDown:e=>{"Enter"===e.key&&i.trim()&&(l(i.trim()),o(""))},placeholder:"Custom model ID...",className:"w-full px-2 py-1 text-xs rounded border border-border bg-background text-foreground placeholder:text-muted-foreground focus:outline-none focus-visible:ring-1 focus-visible:ring-ring"})})]})}let T=null,D=!1,R=[];function P({value:e,onChange:t}){let[r,a]=(0,n.useState)(!1),[i,o]=(0,n.useState)(T??[]),[l,d]=(0,n.useState)("");(0,n.useEffect)(()=>{T?o(T):(R.push(o),D||(D=!0,fetch("/api/skills").then(e=>e.json()).then(e=>{T=(e.skills??[]).map(e=>({name:e.name,description:e.description})),R.forEach(e=>e(T)),R.length=0}).catch(()=>{T=[],R.forEach(e=>e([])),R.length=0})))},[]);let c=l?i.filter(e=>e.name.toLowerCase().includes(l.toLowerCase())):i;return(0,s.jsxs)("div",{children:[e.length>0&&(0,s.jsx)("div",{className:"flex flex-wrap gap-1 mb-1.5",children:e.map(r=>(0,s.jsxs)("span",{className:"inline-flex items-center gap-1 pl-2 pr-1 py-0.5 rounded-md text-2xs bg-[var(--amber)]/10 text-[var(--amber)] border border-[var(--amber)]/20",children:[r,(0,s.jsx)("button",{onClick:()=>t(e.filter(e=>e!==r)),className:"p-0.5 rounded hover:bg-[var(--amber)]/20 transition-colors",children:(0,s.jsx)(y.A,{size:10})})]},r))}),(0,s.jsxs)(k,{open:r,onClose:()=>{a(!1),d("")},trigger:(0,s.jsxs)("button",{type:"button",onClick:()=>a(e=>!e),className:"w-full flex items-center justify-between px-2.5 py-1.5 text-xs rounded-md border border-border bg-background text-foreground hover:bg-muted transition-colors",children:[(0,s.jsx)("span",{className:"text-muted-foreground",children:0===e.length?"Add skills...":`${e.length} selected`}),(0,s.jsx)(f.A,{size:12,className:"text-muted-foreground"})]}),children:[(0,s.jsx)("div",{className:"sticky top-0 bg-card border-b border-border px-2.5 py-1.5",children:(0,s.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-1 rounded border border-border bg-background",children:[(0,s.jsx)(v.A,{size:11,className:"text-muted-foreground shrink-0"}),(0,s.jsx)("input",{type:"text",value:l,onChange:e=>d(e.target.value),autoFocus:!0,placeholder:"Search skills...",className:"flex-1 text-xs bg-transparent text-foreground placeholder:text-muted-foreground focus:outline-none"})]})}),c.slice(0,60).map(r=>{let n=e.includes(r.name);return(0,s.jsxs)("button",{onClick:()=>{var s;return s=r.name,void(e.includes(s)?t(e.filter(e=>e!==s)):t([...e,s]))},className:`w-full text-left px-3 py-1.5 text-xs hover:bg-muted transition-colors flex items-center gap-2 ${n?"bg-[var(--amber)]/5":""}`,children:[(0,s.jsx)("span",{className:`w-3.5 h-3.5 rounded border flex items-center justify-center shrink-0 transition-colors ${n?"bg-[var(--amber)] border-[var(--amber)] text-[var(--amber-foreground)]":"border-border"}`,children:n&&(0,s.jsx)("span",{className:"text-[9px]",children:"✓"})}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("span",{className:"block truncate",children:r.name}),r.description&&(0,s.jsx)("span",{className:"block text-2xs text-muted-foreground truncate mt-0.5",children:r.description})]})]},r.name)}),0===i.length&&(0,s.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:"Loading..."}),i.length>0&&0===c.length&&(0,s.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:"No skills found"})]})]})}function M({value:e,onChange:t}){let[r,a]=(0,n.useState)(!1),[i,o]=(0,n.useState)(""),l=(0,n.useCallback)(r=>{let s=r.trim();s&&!e.includes(s)&&t([...e,s])},[e,t]),d=(0,n.useCallback)(e=>{e.preventDefault(),a(!1);let t=e.dataTransfer.getData("text/mindos-path");if(t)return void l(t);let r=e.dataTransfer.getData("text/plain");r&&l(r)},[l]),u=(0,n.useCallback)(e=>{e.preventDefault(),e.dataTransfer.dropEffect="copy",a(!0)},[]),m=(0,n.useCallback)(()=>a(!1),[]);return(0,s.jsxs)("div",{children:[e.length>0&&(0,s.jsx)("div",{className:"flex flex-col gap-1 mb-1.5",children:e.map(r=>(0,s.jsxs)("div",{className:"flex items-center gap-1.5 pl-2 pr-1 py-1 rounded-md text-2xs bg-muted/60 border border-border group",children:[(0,s.jsx)(j.A,{size:11,className:"text-muted-foreground shrink-0"}),(0,s.jsx)("span",{className:"text-foreground truncate flex-1",title:r,children:r}),(0,s.jsx)("button",{onClick:()=>t(e.filter(e=>e!==r)),className:"p-0.5 rounded hover:bg-[var(--error)]/10 text-muted-foreground hover:text-[var(--error)] opacity-0 group-hover:opacity-100 transition-all",children:(0,s.jsx)(y.A,{size:10})})]},r))}),(0,s.jsxs)("div",{onDrop:d,onDragOver:u,onDragLeave:m,className:`flex items-center gap-2 px-3 py-2.5 rounded-lg border-2 border-dashed transition-colors ${r?"border-[var(--amber)] bg-[var(--amber)]/5":"border-border hover:border-muted-foreground/30"}`,children:[(0,s.jsx)(c.A,{size:14,className:`shrink-0 ${r?"text-[var(--amber)]":"text-muted-foreground/40"}`}),(0,s.jsx)("span",{className:"text-2xs text-muted-foreground",children:"Drag files here from the sidebar"})]}),(0,s.jsx)("div",{className:"mt-1.5",children:(0,s.jsx)("input",{type:"text",value:i,onChange:e=>o(e.target.value),onKeyDown:e=>{"Enter"===e.key&&i.trim()&&(l(i.trim()),o(""))},placeholder:"Or type a file path...",className:"w-full px-2.5 py-1 text-2xs rounded-md border border-border bg-background text-foreground placeholder:text-muted-foreground focus:outline-none focus-visible:ring-1 focus-visible:ring-ring"})})]})}async function F(e){try{let t=await fetch("/api/setup/ls",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e||"~"})});if(!t.ok)return[];return(await t.json()).dirs??[]}catch{return[]}}function I({value:e,onChange:t}){let[r,a]=(0,n.useState)([]),[i,o]=(0,n.useState)(!1),[l,d]=(0,n.useState)(-1),u=(0,n.useRef)(!1),m=(0,n.useRef)(null),[x,p]=(0,n.useState)(!1),[f,h]=(0,n.useState)(e||"~"),[g,b]=(0,n.useState)([]),[v,y]=(0,n.useState)(!1);(0,n.useEffect)(()=>{if(u.current){u.current=!1;return}if(!e.trim()){a([]),o(!1);return}let t=setTimeout(async()=>{let t=function(e){let t=e.trim();if(!t)return"";if(t.endsWith("/")||t.endsWith("\\"))return t;let r=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return r>=0?t.slice(0,r+1):""}(e)||"~",r=await F(t);if(!r.length){a([]),o(!1);return}let s=t.includes("\\")?"\\":"/",n=t.endsWith("/")||t.endsWith("\\")?t:t+s,i=r.map(e=>n+e),l=e.endsWith("/")||e.endsWith("\\")?i:i.filter(t=>t.startsWith(e.trim()));a(l.slice(0,15)),o(l.length>0),d(-1)},300);return()=>clearTimeout(t)},[e]);let j=()=>{a([]),o(!1),d(-1)},S=e=>{u.current=!0,t(e),j(),m.current?.focus()},C=(0,n.useCallback)(async e=>{y(!0),b(await F(e)),y(!1)},[]);return(0,n.useEffect)(()=>{x&&C(f)},[x,f,C]),(0,s.jsxs)("div",{className:"relative flex gap-1.5",children:[(0,s.jsxs)("div",{className:"relative flex-1",children:[(0,s.jsx)("input",{ref:m,type:"text",value:e,onChange:e=>{t(e.target.value),o(!0)},onKeyDown:e=>{i&&0!==r.length&&("ArrowDown"===e.key?(e.preventDefault(),d(e=>Math.min(e+1,r.length-1))):"ArrowUp"===e.key?(e.preventDefault(),d(e=>Math.max(e-1,-1))):"Enter"===e.key&&l>=0?(e.preventDefault(),S(r[l])):"Escape"===e.key?j():"Tab"===e.key&&l>=0&&(e.preventDefault(),S(r[l])))},onBlur:()=>setTimeout(j,150),onFocus:()=>r.length>0&&o(!0),placeholder:"~/projects/my-app",className:"w-full px-2.5 py-1.5 text-xs rounded-lg border border-border bg-background text-foreground font-mono placeholder:text-muted-foreground focus:outline-none focus-visible:ring-1 focus-visible:ring-ring"}),i&&r.length>0&&(0,s.jsx)("div",{role:"listbox",className:"absolute z-50 left-0 right-0 top-full mt-1 rounded-lg border border-border bg-card shadow-lg overflow-auto max-h-[200px]",children:r.map((e,t)=>(0,s.jsxs)("button",{type:"button",role:"option","aria-selected":t===l,onMouseDown:()=>S(e),className:`w-full text-left px-3 py-1.5 text-xs font-mono transition-colors flex items-center gap-1.5 ${t===l?"bg-muted text-foreground":"text-foreground hover:bg-muted/50"}`,children:[(0,s.jsx)(w.A,{size:11,className:"text-[var(--amber)] shrink-0"}),(0,s.jsx)("span",{className:"truncate",children:e})]},e))})]}),(0,s.jsxs)(k,{open:x,onClose:()=>p(!1),trigger:(0,s.jsx)("button",{type:"button",onClick:()=>{h(e||"~"),p(e=>!e)},className:"px-2 py-1.5 rounded-lg border border-border bg-background text-muted-foreground hover:bg-muted hover:text-foreground transition-colors",title:"Browse directories",children:(0,s.jsx)(c.A,{size:13})}),children:[(0,s.jsxs)("div",{className:"sticky top-0 bg-card border-b border-border px-2.5 py-2 flex items-center gap-1.5",children:[(0,s.jsx)("span",{className:"text-2xs font-mono text-muted-foreground truncate flex-1",title:f,children:f}),(0,s.jsx)("button",{onClick:()=>{t(f),p(!1)},className:"px-2 py-0.5 text-2xs rounded font-medium bg-[var(--amber)] text-[var(--amber-foreground)] shrink-0",children:"Select"})]}),"~"!==f&&(0,s.jsxs)("button",{onClick:()=>{let e=f.split("/");e.length<=1||(e.pop(),h(e.join("/")||"~"))},className:"w-full text-left px-3 py-1.5 text-xs hover:bg-muted transition-colors text-muted-foreground flex items-center gap-1.5",children:[(0,s.jsx)(w.A,{size:12,className:"shrink-0"})," .."]}),v&&(0,s.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:"Loading..."}),!v&&0===g.length&&(0,s.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:"No subdirectories"}),g.map(e=>(0,s.jsxs)("button",{onClick:()=>{h("~"===f?`~/${e}`:`${f.replace(/\/+$/,"")}/${e}`)},className:"w-full text-left px-3 py-1.5 text-xs hover:bg-muted transition-colors text-foreground flex items-center gap-1.5",children:[(0,s.jsx)(w.A,{size:12,className:"text-[var(--amber)] shrink-0"}),(0,s.jsx)("span",{className:"truncate flex-1",children:e}),(0,s.jsx)(N.A,{size:10,className:"text-muted-foreground/40 shrink-0"})]},e))]})]})}function L({step:e,index:t,onChange:r,onDelete:a,onMoveUp:i,onMoveDown:o}){let[l,d]=(0,n.useState)(!e.prompt),[c,u]=(0,n.useState)(!1),m=t=>r({...e,...t}),x=e.skills?.length?e.skills:e.skill?[e.skill]:[],p=!!(e.agent||e.model||x.length||e.context?.length||e.description||e.timeout);return l?(0,s.jsxs)("div",{className:"rounded-lg border border-[var(--amber)]/20 bg-card overflow-hidden shadow-sm",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-muted/20",children:[(0,s.jsx)("span",{className:`text-xs font-medium flex-1 truncate ${e.name?"text-foreground":"text-muted-foreground/50 italic"}`,children:e.name||"Untitled step"}),(0,s.jsxs)("div",{className:"flex items-center gap-0.5",children:[i&&(0,s.jsx)("button",{onClick:i,className:"p-1 rounded hover:bg-muted text-muted-foreground/50 hover:text-foreground transition-colors",title:"Move up",children:(0,s.jsx)(h.A,{size:12})}),o&&(0,s.jsx)("button",{onClick:o,className:"p-1 rounded hover:bg-muted text-muted-foreground/50 hover:text-foreground transition-colors",title:"Move down",children:(0,s.jsx)(f.A,{size:12})}),(0,s.jsx)("button",{onClick:a,className:"p-1 rounded hover:bg-[var(--error)]/10 text-muted-foreground/50 hover:text-[var(--error)] transition-colors",title:"Delete",children:(0,s.jsx)(g.A,{size:11})}),(0,s.jsx)("button",{onClick:()=>d(!1),className:"p-1 rounded hover:bg-muted text-muted-foreground/50 transition-colors",title:"Collapse",children:(0,s.jsx)(h.A,{size:12})})]})]}),(0,s.jsxs)("div",{className:"px-3 py-3 space-y-3",children:[(0,s.jsx)("input",{type:"text",value:e.name,onChange:e=>m({name:e.target.value}),placeholder:"Step name...",autoFocus:!e.name,className:"w-full text-sm font-medium bg-transparent text-foreground placeholder:text-muted-foreground/30 focus:outline-none border-none p-0"}),(0,s.jsx)("textarea",{value:e.prompt,onChange:e=>m({prompt:e.target.value}),placeholder:"What should the AI do?",rows:3,className:"w-full px-3 py-2.5 text-sm rounded-lg border border-border bg-background text-foreground placeholder:text-muted-foreground/40 focus:outline-none focus-visible:ring-1 focus-visible:ring-ring resize-y leading-relaxed"}),(0,s.jsxs)("div",{className:`grid ${e.agent?"grid-cols-2":"grid-cols-1"} gap-2`,children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-2xs text-muted-foreground/60 mb-1",children:"Agent"}),(0,s.jsx)(z,{value:e.agent,onChange:t=>m({agent:t,model:t?e.model:void 0})})]}),e.agent&&(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-2xs text-muted-foreground/60 mb-1",children:"Model"}),(0,s.jsx)($,{value:e.model,onChange:e=>m({model:e})})]})]}),(0,s.jsxs)("button",{onClick:()=>u(e=>!e),className:`flex items-center gap-1.5 text-2xs transition-colors ${c||p?"text-muted-foreground":"text-muted-foreground/40 hover:text-muted-foreground"}`,children:[(0,s.jsx)(b.A,{size:11}),c?"Less options":"More options",!c&&p&&(0,s.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-[var(--amber)]"})]}),c&&(0,s.jsxs)("div",{className:"space-y-3 pt-1",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-2xs text-muted-foreground/60 mb-1",children:"Skills"}),(0,s.jsx)(P,{value:x,onChange:e=>m({skills:e,skill:void 0})})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-2xs text-muted-foreground/60 mb-1",children:"Context files"}),(0,s.jsx)(M,{value:e.context??[],onChange:e=>m({context:e.length?e:void 0})})]}),(0,s.jsxs)("div",{className:"grid grid-cols-[1fr,auto] gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-2xs text-muted-foreground/60 mb-1",children:"Description"}),(0,s.jsx)("input",{type:"text",value:e.description||"",onChange:e=>m({description:e.target.value||void 0}),placeholder:"Optional note...",className:"w-full px-2.5 py-1.5 text-xs rounded-md border border-border bg-background text-foreground placeholder:text-muted-foreground/30 focus:outline-none focus-visible:ring-1 focus-visible:ring-ring"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-2xs text-muted-foreground/60 mb-1",children:"Timeout"}),(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[(0,s.jsx)("input",{type:"number",min:0,value:e.timeout||"",onChange:e=>m({timeout:e.target.value?Number(e.target.value):void 0}),placeholder:"120",className:"w-16 px-2 py-1.5 text-xs rounded-md border border-border bg-background text-foreground placeholder:text-muted-foreground/30 focus:outline-none focus-visible:ring-1 focus-visible:ring-ring"}),(0,s.jsx)("span",{className:"text-2xs text-muted-foreground/40",children:"s"})]})]})]})]})]})]}):(0,s.jsxs)("div",{className:"group flex items-start gap-2 px-3 py-2 rounded-lg hover:bg-muted/40 transition-colors cursor-pointer -ml-1",onClick:()=>d(!0),children:[(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("span",{className:`text-sm leading-tight block ${e.name?"text-foreground font-medium":"text-muted-foreground/50 italic"}`,children:e.name||"Untitled step"}),p&&(0,s.jsxs)("div",{className:"flex items-center gap-1 mt-1 flex-wrap",children:[e.agent&&(0,s.jsx)("span",{className:"text-2xs px-1.5 py-0.5 rounded-full bg-muted text-muted-foreground",children:e.agent}),x.slice(0,2).map(e=>(0,s.jsx)("span",{className:"text-2xs px-1.5 py-0.5 rounded-full bg-[var(--amber)]/8 text-[var(--amber)]",children:e},e)),x.length>2&&(0,s.jsxs)("span",{className:"text-2xs text-muted-foreground/50",children:["+",x.length-2]}),e.context?.length?(0,s.jsxs)("span",{className:"text-2xs text-muted-foreground/50",children:[e.context.length," files"]}):null]}),e.prompt&&(0,s.jsx)("p",{className:"text-2xs text-muted-foreground/50 mt-1 line-clamp-1 leading-relaxed",children:e.prompt})]}),(0,s.jsx)(f.A,{size:12,className:"text-muted-foreground/30 mt-1 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity"})]})}function O({workflow:e,filePath:t,onChange:r,onSaved:a}){let[i,l]=(0,n.useState)(!1),[f,h]=(0,n.useState)(""),[g,b]=(0,n.useState)(!1);(0,n.useEffect)(()=>{if(!g)return;let e=setTimeout(()=>b(!1),3e3);return()=>clearTimeout(e)},[g]);let v=t=>r({...e,...t}),y=(0,n.useCallback)((t,s)=>{let n=[...e.steps];n[t]=s,r({...e,steps:n})},[e,r]),j=(0,n.useCallback)(t=>{let s=e.steps[t];(!(s.name||s.prompt)||window.confirm(`Delete step "${s.name||"Untitled"}"?`))&&r({...e,steps:e.steps.filter((e,r)=>r!==t)})},[e,r]),w=(0,n.useCallback)(()=>{let t=e.steps.map(e=>e.id),s=e.steps.length+1,n={id:function(e,t){let r=e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"step",s=r,n=2;for(;t.includes(s);)s=`${r}-${n}`,n++;return s}(`step-${s}`,t),name:`Step ${s}`,prompt:""};r({...e,steps:[...e.steps,n]})},[e,r]),N=(0,n.useCallback)((t,s)=>{if(s<0||s>=e.steps.length)return;let n=[...e.steps],[a]=n.splice(t,1);n.splice(s,0,a),r({...e,steps:n})},[e,r]),k=async()=>{l(!0),h(""),b(!1);try{let r,s=(r={title:e.title},e.description&&(r.description=e.description),e.workDir&&(r.workDir=e.workDir),e.skills?.length&&(r.skills=e.skills),e.tools?.length&&(r.tools=e.tools),r.steps=e.steps.map(e=>{let t={id:e.id,name:e.name};return e.description&&(t.description=e.description),e.agent&&(t.agent=e.agent),e.model&&(t.model=e.model),e.skill&&(t.skill=e.skill),e.skills?.length&&(t.skills=e.skills),e.tools?.length&&(t.tools=e.tools),e.context?.length&&(t.context=e.context),t.prompt=e.prompt,e.timeout&&(t.timeout=e.timeout),t}),d.Ay.dump(r,{lineWidth:-1,noRefs:!0,quotingType:'"',forceQuotes:!1})),n=await fetch("/api/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t,op:"save_file",content:s})});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.error||`Save failed (HTTP ${n.status})`)}b(!0),a?.()}catch(e){h(e instanceof Error?e.message:"Save failed")}finally{l(!1)}};(0,n.useEffect)(()=>{let t=t=>{(t.metaKey||t.ctrlKey)&&"s"===t.key&&(t.preventDefault(),!i&&e.title.trim()&&e.steps.length>0&&k())};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)});let S=!i&&!!e.title.trim()&&e.steps.length>0;return(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"space-y-3 mb-8",children:[(0,s.jsx)("input",{type:"text",value:e.title,onChange:e=>v({title:e.target.value}),placeholder:"Flow title...",className:"w-full text-lg font-semibold bg-transparent text-foreground placeholder:text-muted-foreground/40 focus:outline-none border-none p-0 leading-tight"}),(0,s.jsx)("input",{type:"text",value:e.description||"",onChange:e=>v({description:e.target.value||void 0}),placeholder:"Add a description...",className:"w-full text-sm bg-transparent text-muted-foreground placeholder:text-muted-foreground/30 focus:outline-none border-none p-0"}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(c.A,{size:12,className:"text-muted-foreground/40 shrink-0"}),(0,s.jsx)(I,{value:e.workDir||"",onChange:e=>v({workDir:e||void 0})})]})]}),e.steps.length>0?(0,s.jsxs)("div",{className:"relative",children:[e.steps.length>1&&(0,s.jsx)("div",{className:"absolute left-[19px] top-6 bottom-16 w-px bg-border"}),(0,s.jsx)("div",{className:"flex flex-col gap-3 mb-5 relative",children:e.steps.map((t,r)=>(0,s.jsxs)("div",{className:"relative pl-11",children:[(0,s.jsx)("div",{className:"absolute left-[7px] top-3 w-[22px] h-[22px] rounded-full border-2 border-border bg-background z-10 flex items-center justify-center",children:(0,s.jsx)("span",{className:"text-[10px] font-bold text-muted-foreground/60",children:r+1})}),(0,s.jsx)(L,{step:t,index:r,onChange:e=>y(r,e),onDelete:()=>j(r),onMoveUp:r>0?()=>N(r,r-1):void 0,onMoveDown:r<e.steps.length-1?()=>N(r,r+1):void 0})]},t.id))}),(0,s.jsxs)("div",{className:"relative pl-11",children:[(0,s.jsx)("div",{className:"absolute left-[7px] top-2.5 w-[22px] h-[22px] rounded-full border-2 border-dashed border-border bg-background z-10 flex items-center justify-center",children:(0,s.jsx)(u.A,{size:9,className:"text-muted-foreground/40"})}),(0,s.jsx)("button",{onClick:w,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-muted-foreground/60 hover:text-muted-foreground hover:bg-muted/40 transition-colors",children:"Add step..."})]})]}):(0,s.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[(0,s.jsx)("div",{className:"w-12 h-12 rounded-2xl bg-[var(--amber)]/8 flex items-center justify-center mb-4",children:(0,s.jsx)(o.A,{size:22,className:"text-[var(--amber)]/60"})}),(0,s.jsx)("p",{className:"text-sm font-medium text-foreground mb-1",children:"Build your flow"}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground/60 mb-5 max-w-[240px]",children:"Each step is a task for an AI agent. Chain them together to automate complex workflows."}),(0,s.jsxs)("button",{onClick:w,className:"inline-flex items-center gap-1.5 px-4 py-2 rounded-lg text-xs font-medium bg-[var(--amber)] text-[var(--amber-foreground)] hover:opacity-90 transition-opacity",children:[(0,s.jsx)(u.A,{size:12}),"Add first step"]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-3 mt-8 pt-4 border-t border-border/50",children:[(0,s.jsxs)("button",{onClick:k,disabled:!S,title:e.title.trim()?0===e.steps.length?"Add at least one step":void 0:"Title is required",className:`flex items-center gap-1.5 px-4 py-2 rounded-lg text-xs font-medium transition-all disabled:opacity-40 disabled:cursor-not-allowed ${S?"bg-[var(--amber)] text-[var(--amber-foreground)] hover:opacity-90":"bg-muted text-muted-foreground"}`,children:[i?(0,s.jsx)(m.A,{size:12,className:"animate-spin"}):(0,s.jsx)(x.A,{size:12}),i?"Saving...":"Save"]}),f&&(0,s.jsx)("span",{className:"text-xs text-[var(--error)]",children:f}),g&&!f&&(0,s.jsxs)("span",{className:"flex items-center gap-1 text-2xs text-[var(--success)]",children:[(0,s.jsx)(p.A,{size:11}),"Saved"]}),(0,s.jsx)("kbd",{className:"text-2xs text-muted-foreground/30 ml-auto font-mono",children:"Ctrl+S"})]})]})}var W=r(30125),B=r(62791),U=r(86901),_=r(21628),H=r(9199);let K=new Map;async function Y(e,t){if(K.has(e))return K.get(e);try{let r=await fetch("/api/skills",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"read",name:e}),signal:t});if(!r.ok)return K.set(e,null),null;let s=(await r.json()).content;return K.set(e,s??null),s??null}catch{return null}}async function J(e,t){try{let r=await fetch(`/api/acp/registry?agent=${encodeURIComponent(e)}`,{signal:t});if(!r.ok)return null;let s=await r.json();if(s.agent?.id)return{id:s.agent.id,name:s.agent.name||e};return null}catch{return null}}async function G(e,t,r,s,n){let a=function(e,t){let r=[];if(e.skills?.length)for(let t of e.skills)r.includes(t)||r.push(t);else e.skill&&r.push(e.skill);for(let e of t.skills??[])r.includes(e)||r.push(e);return r}(e,t),i=new Map;if(a.length>0)for(let[e,t]of(await Promise.all(a.map(async e=>{let t=await Y(e,n);return[e,t]}))))t&&i.set(e,t);let o=null;e.agent&&(o=await J(e.agent,n));let l={messages:[{role:"user",content:function(e,t,r){let s=t.steps.map((e,t)=>`${t+1}. ${e.name}`).join("\n"),n=e.skills?.length?e.skills[0]:e.skill,a="";if(r.size>0){let e=[];for(let[t,s]of r){let r=t===n;e.push(`### ${r?"[Primary] ":""}Skill: ${t}
|
|
11
|
+
Keep content concise and actionable. Write files directly using tools.`;window.dispatchEvent(new CustomEvent("mindos:ai-init",{detail:{spaceName:e,spacePath:t,description:r,state:"working"}})),fetch("/api/ask",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({messages:[{role:"user",content:s}],currentFile:t+"/INSTRUCTION.md"})}).then(async e=>{if(!e.ok||!e.body)throw Error(`HTTP ${e.status}`);let r=e.body.getReader();try{for(;;){let{done:e}=await r.read();if(e)break}}finally{r.releaseLock()}window.dispatchEvent(new CustomEvent("mindos:ai-init",{detail:{spacePath:t,state:"done"}})),window.dispatchEvent(new Event("mindos:files-changed"))}).catch(()=>{window.dispatchEvent(new CustomEvent("mindos:ai-init",{detail:{spacePath:t,state:"error"}}))})}},10377:(e,t,r)=>{"use strict";r.d(t,{Z:()=>h});var s=r(12115);let n="mindos-pinned-files",a="mindos:pins-changed";function i(){try{let e=localStorage.getItem(n);return e?JSON.parse(e):[]}catch{return[]}}function o(){return c}let l=[];function d(){return l}let c=[],u=!1;function m(){u||(c=i(),u=!0)}function x(e){m();let t=t=>{t.key===n&&(c=i(),e())},r=()=>{c=i(),e()};return window.addEventListener("storage",t),window.addEventListener(a,r),()=>{window.removeEventListener("storage",t),window.removeEventListener(a,r)}}function p(e){c=e;try{localStorage.setItem(n,JSON.stringify(e))}catch{}window.dispatchEvent(new Event(a))}function h(){m();let e=(0,s.useSyncExternalStore)(x,o,d),t=(0,s.useCallback)(t=>e.includes(t),[e]),r=(0,s.useCallback)(e=>{let t=i(),r=t.indexOf(e);r>=0?t.splice(r,1):t.unshift(e),p(t)},[]);return{pinnedFiles:e,isPinned:t,togglePin:r,reorderPins:(0,s.useCallback)(e=>{p(e)},[]),removePin:(0,s.useCallback)(e=>{p(i().filter(t=>t!==e))},[])}}},12413:(e,t,r)=>{"use strict";r.d(t,{P:()=>s,u:()=>n});let s=[{id:"telegram",name:"Telegram",icon:"\uD83D\uDCF1",guide:"1. Open Telegram → search @BotFather\n2. Send /newbot → follow prompts\n3. Copy the token below",fields:[{key:"bot_token",label:"Bot Token",placeholder:"123456789:AABBccDD-EeFfGgHh...",hint:"Format: number:alphanumeric"}]},{id:"feishu",name:"Feishu",icon:"\uD83D\uDC26",guide:"1. open.feishu.cn → Create App\n2. Credentials page → copy App ID & Secret\n3. Enable Bot capability + add permissions",guideUrl:"https://open.feishu.cn/",editHint:"Need to update credentials? Edit and save below — MindOS will reconnect automatically.",fields:[{key:"app_id",label:"App ID",placeholder:"CLI_XXXXXXXXXXXXXXXXX",hint:"From Credentials page on open.feishu.cn"},{key:"app_secret",label:"App Secret",placeholder:"XXXXXXXXXXXXXXXXXXXXXXXX",hint:"Keep this secret — do not share"}]},{id:"discord",name:"Discord",icon:"\uD83D\uDCAC",guide:"1. discord.com/developers → New Application\n2. Bot tab → Reset Token → copy\n3. Enable Message Content Intent",fields:[{key:"bot_token",label:"Bot Token",placeholder:"MTIxNzM..."}]},{id:"slack",name:"Slack",icon:"\uD83D\uDCBC",guide:"1. api.slack.com/apps → Create New App\n2. OAuth & Permissions → add chat:write scope\n3. Install to Workspace → copy Bot Token",fields:[{key:"bot_token",label:"Bot Token",placeholder:"xoxb-xxxx-xxxx-xxxx",hint:"Starts with xoxb-"}]},{id:"wecom",name:"WeCom",icon:"\uD83C\uDFE2",guide:"1. Group chat → Add Robot → Custom\n2. Copy Webhook URL\n3. Extract the key parameter from URL",fields:[{key:"webhook_key",label:"Webhook Key",placeholder:"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",hint:"The key= value from webhook URL"}]},{id:"dingtalk",name:"DingTalk",icon:"\uD83D\uDD14",guide:"1. Group → Settings → Smart Assistant → Add Robot\n2. Select Custom (Webhook)\n3. Copy the full Webhook URL",fields:[{key:"webhook_url",label:"Webhook URL",placeholder:"https://oapi.dingtalk.com/robot/send?access_token=...",hint:"Full URL including access_token"}]},{id:"wechat",name:"WeChat",icon:"\uD83D\uDC9A",guide:"1. Visit ilinkai.weixin.qq.com\n2. Register & create a bot application\n3. QR login in the console → copy Bot Token from dashboard",fields:[{key:"bot_token",label:"Bot Token",placeholder:"wx_xxxxxxxxxxxxxxxx",hint:"From iLink Bot console after QR login"}]},{id:"qq",name:"QQ",icon:"\uD83D\uDC27",guide:"1. q.qq.com → Create Bot\n2. Development tab → copy App ID & Secret\n3. Add group/C2C intents as needed",fields:[{key:"app_id",label:"App ID",placeholder:"102xxxxxx"},{key:"app_secret",label:"App Secret",placeholder:"xxxxxxxxxxxxxxxxxxxxxxxx"}]}];function n(e){return s.find(t=>t.id===e)}},13123:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>er,Fo:()=>F,gL:()=>I});var s=r(95155),n=r(12115),a=r(73321),i=r(82125),o=r(91337),l=r(33078),d=r(48368),c=r(6296),u=r(66088),m=r(15282),x=r(33024),p=r(42129),h=r(38798),f=r(60285),g=r(94290),b=r(67635),v=r(49387),y=r(68459),j=r(9339);let w=(0,j.createServerReference)("609a1a4af284a14a279cf05ad632c206d42bf70924",j.callServer,void 0,j.findSourceMapURL,"createFileAction"),N=(0,j.createServerReference)("6001dda00a6004f84f6bc310d9625323f22a913ac0",j.callServer,void 0,j.findSourceMapURL,"renameSpaceAction");var k=r(54235);let S=(0,j.createServerReference)("409f0bbd50bdbe9e87140386fc9d03835fcd221a99",j.callServer,void 0,j.findSourceMapURL,"deleteSpaceAction"),C=(0,j.createServerReference)("401e45feafdc73ae6b918bff9e873f2726d537b3d3",j.callServer,void 0,j.findSourceMapURL,"deleteFolderAction");var A=r(82681),z=r(32881),E=r(4235),$=r(35581),T=r(39498),D=r(10377);let R="show-hidden-files";function P(e){let t=t=>{t.key===R&&e()},r=()=>e();return window.addEventListener("storage",t),window.addEventListener("mindos:hidden-files-changed",r),()=>{window.removeEventListener("storage",t),window.removeEventListener("mindos:hidden-files-changed",r)}}function M(){return"true"===localStorage.getItem(R)}function F(e){localStorage.setItem(R,String(e)),window.dispatchEvent(new Event("mindos:hidden-files-changed"))}function I(){return(0,n.useSyncExternalStore)(P,M,()=>!1)}var L=r(51914),O=r(997),W=r(59511);let B=(0,j.createServerReference)("4075db6b35389dc4133d02ae7d6bfe11dffefa9b77",j.callServer,void 0,j.findSourceMapURL,"convertToSpaceAction");var U=r(5292);async function _(e){try{await navigator.clipboard.writeText(e)}catch{}}let H="w-full flex items-center gap-2 px-3 py-2 text-sm text-foreground hover:bg-muted transition-colors text-left",X="w-full flex items-center gap-2 px-3 py-2 text-sm text-error hover:bg-error/10 transition-colors text-left",K="my-1 border-t border-border/50";function Y({x:e,y:t,onClose:r,menuHeight:a,children:i}){let o=(0,n.useRef)(null);(0,n.useEffect)(()=>{let e=e=>{o.current&&!o.current.contains(e.target)&&r()},t=e=>{"Escape"===e.key&&r()};return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)}},[r]);let l=Math.min(t,window.innerHeight-(a??160)),d=Math.min(e,window.innerWidth-200);return(0,s.jsx)("div",{ref:o,className:"fixed z-50 min-w-[180px] bg-card border border-border rounded-lg shadow-lg py-1",style:{top:l,left:d},children:i})}function J({x:e,y:t,node:r,onClose:n,onRename:i,onNewFile:l,onImport:d,onDelete:c}){let u=(0,a.useRouter)(),{t:m}=(0,$.Y)(),{isPinned:x,togglePin:p}=(0,D.Z)(),h=x(r.path);return(0,s.jsxs)(Y,{x:e,y:t,onClose:n,children:[(0,s.jsxs)("button",{className:H,onClick:()=>{l(),n()},children:[(0,s.jsx)(L.A,{size:14,className:"shrink-0"})," ",m.fileTree.newFile]}),(0,s.jsxs)("button",{className:H,onClick:()=>{u.push(`/view/${(0,o.O0)(`${r.path}/INSTRUCTION.md`)}`),n()},children:[(0,s.jsx)(O.A,{size:14,className:"shrink-0"})," ",m.fileTree.viewRules]}),d&&(0,s.jsxs)("button",{className:H,onClick:()=>{d(r.path),n()},children:[(0,s.jsx)(W.A,{size:14,className:"shrink-0"})," ",m.fileTree.importFile]}),(0,s.jsx)("div",{className:K}),(0,s.jsxs)("button",{className:H,onClick:()=>{p(r.path),n()},children:[(0,s.jsx)(g.A,{size:14,className:`shrink-0 ${h?"fill-[var(--amber)] text-[var(--amber)]":""}`}),h?m.fileTree.removeFromFavorites:m.fileTree.pinToFavorites]}),(0,s.jsxs)("button",{className:H,onClick:()=>{_(r.path),n()},children:[(0,s.jsx)(b.A,{size:14,className:"shrink-0"})," ",m.fileTree.copyPath]}),(0,s.jsxs)("button",{className:H,onClick:()=>{i(),n()},children:[(0,s.jsx)(v.A,{size:14,className:"shrink-0"})," ",m.fileTree.renameSpace]}),(0,s.jsx)("div",{className:K}),(0,s.jsxs)("button",{className:X,onClick:()=>{n(),c()},children:[(0,s.jsx)(y.A,{size:14,className:"shrink-0"}),m.fileTree.deleteSpace]})]})}function G({x:e,y:t,node:r,onClose:i,onRename:o,onNewFile:l,onDelete:d}){let c=(0,a.useRouter)(),{t:u}=(0,$.Y)(),[m,p]=(0,n.useTransition)(),{isPinned:h,togglePin:f}=(0,D.Z)(),j=h(r.path);return(0,s.jsxs)(Y,{x:e,y:t,onClose:i,menuHeight:220,children:[(0,s.jsxs)("button",{className:H,onClick:()=>{l(),i()},children:[(0,s.jsx)(L.A,{size:14,className:"shrink-0"})," ",u.fileTree.newFile]}),(0,s.jsx)("div",{className:K}),(0,s.jsxs)("button",{className:H,onClick:()=>{f(r.path),i()},children:[(0,s.jsx)(g.A,{size:14,className:`shrink-0 ${j?"fill-[var(--amber)] text-[var(--amber)]":""}`}),j?u.fileTree.removeFromFavorites:u.fileTree.pinToFavorites]}),(0,s.jsxs)("button",{className:H,disabled:m,onClick:()=>{p(async()=>{if((await B(r.path)).success){c.refresh(),window.dispatchEvent(new Event("mindos:files-changed"));let e=r.name.replace(/^[\p{Emoji_Presentation}\p{Extended_Pictographic}\s]+/u,"")||r.name;(0,U.w)().then(t=>{t&&(0,U.V)(e,r.path)})}i()})},children:[(0,s.jsx)(x.A,{size:14,className:"shrink-0 text-[var(--amber)]"})," ",u.fileTree.convertToSpace]}),(0,s.jsxs)("button",{className:H,onClick:()=>{_(r.path),i()},children:[(0,s.jsx)(b.A,{size:14,className:"shrink-0"})," ",u.fileTree.copyPath]}),(0,s.jsxs)("button",{className:H,onClick:()=>{o(),i()},children:[(0,s.jsx)(v.A,{size:14,className:"shrink-0"})," ",u.fileTree.rename]}),(0,s.jsx)("div",{className:K}),(0,s.jsxs)("button",{className:X,onClick:()=>{i(),d()},children:[(0,s.jsx)(y.A,{size:14,className:"shrink-0"}),u.fileTree.deleteFolder]})]})}var V=r(29494);function q(){window.dispatchEvent(new Event("mindos:files-changed"))}async function Z(e){try{await navigator.clipboard.writeText(e)}catch{}}function Q({dirPath:e,depth:t,onDone:r}){let[i,l]=(0,n.useState)(""),[d,u]=(0,n.useTransition)(),[m,x]=(0,n.useState)(""),p=(0,a.useRouter)(),{t:h}=(0,$.Y)(),f=(0,n.useRef)(null),g=(0,n.useCallback)(()=>{let t=i.trim();t?u(async()=>{let s=await w(e,t);s.success&&s.filePath?(r(),p.push(`/view/${(0,o.O0)(s.filePath)}`),p.refresh(),q()):x(s.error||h.fileTree.failed)}):x(h.fileTree.enterFileName)},[i,e,r,p,h]);return(0,n.useEffect)(()=>{let e=e=>{f.current&&!f.current.contains(e.target)&&r()},t=setTimeout(()=>document.addEventListener("mousedown",e),0);return()=>{clearTimeout(t),document.removeEventListener("mousedown",e)}},[r]),(0,s.jsxs)("div",{ref:f,className:"px-2 pb-1",style:{paddingLeft:`${12*t+20}px`},children:[(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[(0,s.jsx)("input",{autoFocus:!0,type:"text",value:i,onChange:e=>{l(e.target.value),x("")},onKeyDown:e=>{"Enter"===e.key&&g(),"Escape"===e.key&&r()},placeholder:"filename.md",className:" flex-1 bg-muted border border-border rounded px-2 py-1 text-xs text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring "}),d?(0,s.jsx)(c.A,{size:13,className:"text-muted-foreground animate-spin shrink-0"}):(0,s.jsx)("button",{onClick:g,className:"text-xs text-[var(--amber)] hover:text-foreground shrink-0 px-1",children:h.fileTree.create})]}),m&&(0,s.jsx)("p",{className:"text-xs text-error mt-0.5 px-1",children:m})]})}function ee({node:e,depth:t,currentPath:r,onNavigate:l,maxOpenDepth:d,onImport:g}){let b=(0,a.useRouter)(),v=r.startsWith(e.path+"/")||r===e.path,y=!!e.isSpace,[j,w]=(0,n.useState)(0===t||v),[z,D]=(0,n.useState)(!1),[R,P]=(0,n.useState)(!1),[M,F]=(0,n.useState)(e.name),[I,L]=(0,n.useTransition)(),O=(0,n.useRef)(null),W=(0,n.useRef)(null),[B,U]=(0,n.useState)(null),{t:_}=(0,$.Y)(),[H,X]=(0,n.useState)(null),[K,Y]=(0,n.useTransition)(),{isDragTarget:Z,handleRowDragOver:ee,handleRowDragEnter:et,handleRowDragLeave:es,handleRowDrop:en}=function(e,t,r,s){let[a,i]=(0,n.useState)(!1),o=(0,n.useRef)(null),l=(0,n.useRef)(null),d=(0,n.useCallback)(()=>{o.current&&(clearTimeout(o.current),o.current=null)},[]),c=(0,n.useCallback)(e=>{e.dataTransfer.types.includes("Files")&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="copy",l.current&&(clearTimeout(l.current),l.current=null),a||i(!0))},[a]),u=(0,n.useCallback)(e=>{e.dataTransfer.types.includes("Files")&&(e.preventDefault(),e.stopPropagation(),i(!0),d(),t||(o.current=setTimeout(()=>{r(!0),o.current=null},500)))},[t,d,r]),m=(0,n.useCallback)(e=>{e.dataTransfer.types.includes("Files")&&(e.stopPropagation(),l.current=setTimeout(()=>{i(!1),d(),l.current=null},50))},[d]),x=(0,n.useCallback)(t=>{t.preventDefault(),t.stopPropagation(),i(!1),d(),l.current&&(clearTimeout(l.current),l.current=null);let r=t.dataTransfer.files;r.length>0&&(0,V.Nh)(Array.from(r),e.path,s)},[e.path,s,d]);return(0,n.useEffect)(()=>()=>{o.current&&clearTimeout(o.current),l.current&&clearTimeout(l.current)},[]),{isDragTarget:a,handleRowDragOver:c,handleRowDragEnter:u,handleRowDragLeave:m,handleRowDrop:x}}(e,j,w,_),ea=(0,n.useCallback)(()=>w(e=>!e),[]),ei=(0,n.useRef)(void 0);(0,n.useEffect)(()=>{if(null==d){ei.current=d;return}ei.current!==d&&(null===ei.current||void 0===ei.current?t>d&&w(!1):w(t<=d),ei.current=d)},[d,t]),(0,n.useEffect)(()=>()=>{W.current&&clearTimeout(W.current)},[]);let eo=(0,n.useCallback)(t=>{t?.preventDefault(),t?.stopPropagation(),W.current&&(clearTimeout(W.current),W.current=null),F(e.name),P(!0),setTimeout(()=>O.current?.select(),0)},[e.name]),el=(0,n.useCallback)(()=>{let t=M.trim();t&&t!==e.name?L(async()=>{let r=y?N:k.f,s=await r(e.path,t);s.success&&s.newPath?(P(!1),b.push(`/view/${(0,o.O0)(s.newPath)}`),b.refresh(),q()):P(!1)}):P(!1)},[M,e.name,e.path,b,y]),ed=(0,n.useCallback)(()=>{R||(W.current&&clearTimeout(W.current),W.current=setTimeout(()=>{b.push(`/view/${(0,o.O0)(e.path)}`),l?.(),W.current=null},180))},[R,b,e.path,l]);(0,n.useCallback)(e=>{e.stopPropagation(),ea()},[ea]);let ec=(0,n.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),U({x:e.clientX,y:e.clientY})},[]),eu=y?function e(t){return"file"===t.type?+!i.C.has(t.name):(t.children??[]).reduce((t,r)=>t+e(r),0)}(e):0;if(R)return(0,s.jsxs)("div",{className:"relative px-2 py-0.5",style:{paddingLeft:`${12*t+8}px`},children:[(0,s.jsx)("input",{ref:O,autoFocus:!0,value:M,onChange:e=>F(e.target.value),onKeyDown:e=>{"Enter"===e.key&&el(),"Escape"===e.key&&P(!1)},onBlur:el,className:"w-full bg-muted border border-border rounded px-2 py-0.5 text-xs text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"}),I&&(0,s.jsx)(c.A,{size:12,className:"absolute right-3 top-1/2 -translate-y-1/2 animate-spin text-muted-foreground"})]});let em=y&&0===t;return(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:`relative group/dir flex items-center transition-colors duration-100 ${Z?"bg-[var(--amber)]/10 rounded-md":""}`,onContextMenu:ec,onDragEnter:et,onDragOver:ee,onDragLeave:es,onDrop:en,children:[(0,s.jsx)("button",{onClick:ea,className:"shrink-0 p-1 rounded hover:bg-muted text-muted-foreground transition-colors",style:{marginLeft:`${12*t+4}px`},"aria-label":j?`Collapse ${e.name}`:`Expand ${e.name}`,"aria-expanded":j,children:(0,s.jsx)("span",{className:"block transition-transform duration-150",style:{transform:j?"rotate(0deg)":"rotate(-90deg)"},children:(0,s.jsx)(u.A,{size:10})})}),(0,s.jsxs)("button",{type:"button",onClick:ed,draggable:!0,onDragStart:t=>{t.dataTransfer.setData("text/mindos-path",e.path),t.dataTransfer.setData("text/mindos-type","directory"),t.dataTransfer.effectAllowed="copy"},className:`
|
|
12
|
+
flex-1 flex items-center gap-1.5 px-1 py-1 rounded text-left min-w-0 pr-16
|
|
13
|
+
text-sm transition-colors duration-100
|
|
14
|
+
hover:bg-muted cursor-default
|
|
15
|
+
${v?"text-foreground":"text-muted-foreground hover:text-foreground"}
|
|
16
|
+
`,children:[y?"Inbox"===e.name?(0,s.jsx)(m.A,{size:14,className:"shrink-0 text-[var(--amber)]"}):(0,s.jsx)(x.A,{size:14,className:"shrink-0 text-[var(--amber)]"}):j?(0,s.jsx)(p.A,{size:14,className:"text-yellow-400 shrink-0"}):(0,s.jsx)(h.A,{size:14,className:"text-yellow-400 shrink-0"}),(0,s.jsx)("span",{className:"truncate leading-5",suppressHydrationWarning:!0,children:e.name}),y&&!j&&(0,s.jsx)("span",{className:"ml-auto text-xs text-muted-foreground shrink-0 tabular-nums pr-1",children:eu})]}),(0,s.jsx)("div",{className:"absolute right-1 top-1/2 -translate-y-1/2 hidden group-hover/dir:flex items-center gap-0.5 z-10",children:(0,s.jsx)("button",{type:"button",onClick:e=>{e.preventDefault(),e.stopPropagation();let t=e.currentTarget.getBoundingClientRect();U({x:t.left,y:t.bottom+4})},className:"p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",title:"More",children:(0,s.jsx)(f.A,{size:14})})})]}),(0,s.jsx)("div",{className:`grid transition-[grid-template-rows] duration-200 ease-out ${j?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,children:(0,s.jsxs)("div",{className:`overflow-hidden ${em?"border-l-2 ml-[18px]":""}`,style:em?{borderColor:"color-mix(in srgb, var(--amber) 30%, transparent)"}:void 0,...!j&&{inert:!0},children:[e.children&&(0,s.jsx)(er,{nodes:e.children,depth:em?1:t+1,onNavigate:l,maxOpenDepth:d,parentIsSpace:y,onImport:g}),z&&(0,s.jsx)(Q,{dirPath:e.path,depth:em?0:t,onDone:()=>D(!1)})]})}),B&&(y?(0,s.jsx)(J,{x:B.x,y:B.y,node:e,onClose:()=>U(null),onRename:()=>eo(),onNewFile:()=>{w(!0),D(!0)},onImport:g,onDelete:()=>X("space")}):(0,s.jsx)(G,{x:B.x,y:B.y,node:e,onClose:()=>U(null),onRename:()=>eo(),onNewFile:()=>{w(!0),D(!0)},onDelete:()=>X("folder")})),(0,s.jsx)(T.TM,{open:null!==H,title:"space"===H?_.fileTree.deleteSpace:_.fileTree.deleteFolder,message:"space"===H?_.fileTree.confirmDeleteSpace(e.name):_.fileTree.confirmDeleteFolder(e.name),confirmLabel:"space"===H?_.fileTree.deleteSpace:_.fileTree.deleteFolder,cancelLabel:_.view?.cancel??"Cancel",variant:"destructive",onCancel:()=>X(null),onConfirm:()=>{X(null),Y(async()=>{let t="space"===H?await S(e.path):await C(e.path);if(t.success&&t.trashId){let r=t.trashId,s=e.path.split("/").pop()??e.path;E.oR.undo(`${_.trash?.movedToTrash??"Deleted"} ${s}`,async()=>{let e=await (0,A.Y)(r);e.success?(b.refresh(),q()):E.oR.error(e.error??"Undo failed")},{label:_.trash?.undo??"Undo"}),b.push("/"),b.refresh(),q()}})}})]})}function et({node:e,depth:t,currentPath:r,onNavigate:u}){let m=(0,a.useRouter)(),x=r===e.path,[p,h]=(0,n.useState)(!1),[j,w]=(0,n.useState)(e.name),[N,S]=(0,n.useTransition)(),[,C]=(0,n.useTransition)(),R=(0,n.useRef)(null),{t:P}=(0,$.Y)(),{isPinned:M,togglePin:F}=(0,D.Z)(),I=M(e.path),L=!e.path.includes("/")&&i.A.has(e.name),[O,W]=(0,n.useState)(!1),[B,U]=(0,n.useState)(null),_=(0,n.useCallback)(()=>{p||(m.push(`/view/${(0,o.O0)(e.path)}`),u?.())},[m,e.path,u,p]),J=(0,n.useCallback)(t=>{t.stopPropagation(),w(e.name),h(!0),setTimeout(()=>R.current?.select(),0)},[e.name]),G=(0,n.useCallback)(()=>{let t=j.trim();t&&t!==e.name?S(async()=>{let r=await (0,k.f)(e.path,t);r.success&&r.newPath?(h(!1),m.push(`/view/${(0,o.O0)(r.newPath)}`),m.refresh(),q()):h(!1)}):h(!1)},[j,e.name,e.path,m]),V=(0,n.useCallback)(e=>{e.stopPropagation(),W(!0)},[]),Q=(0,n.useCallback)(t=>{t.dataTransfer.setData("text/mindos-path",e.path),t.dataTransfer.effectAllowed="copy"},[e.path]),ee=(0,n.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),U({x:e.clientX,y:e.clientY})},[]);return p?(0,s.jsxs)("div",{className:"relative px-2 py-0.5",style:{paddingLeft:`${12*t+8}px`},children:[(0,s.jsx)("input",{ref:R,autoFocus:!0,value:j,onChange:e=>w(e.target.value),onKeyDown:e=>{"Enter"===e.key&&G(),"Escape"===e.key&&h(!1)},onBlur:G,className:"w-full bg-muted border border-border rounded px-2 py-0.5 text-xs text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"}),N&&(0,s.jsx)(c.A,{size:12,className:"absolute right-3 top-1/2 -translate-y-1/2 animate-spin text-muted-foreground"})]}):(0,s.jsxs)("div",{className:"relative group/file",children:[(0,s.jsxs)("button",{onClick:_,onContextMenu:ee,draggable:!0,onDragStart:Q,"data-filepath":e.path,className:`
|
|
17
|
+
w-full flex items-center gap-1.5 px-2 py-1 rounded text-left
|
|
18
|
+
text-sm transition-colors duration-100 cursor-default pr-16
|
|
19
|
+
${x?"bg-accent text-foreground":"hover:bg-muted text-muted-foreground hover:text-foreground"}
|
|
20
|
+
`,style:{paddingLeft:`${12*t+8}px`},children:["directory"===e.type?null:".csv"===e.extension?(0,s.jsx)(l.A,{size:14,className:"text-success shrink-0"}):(0,s.jsx)(d.A,{size:14,className:"text-muted-foreground shrink-0"}),(0,s.jsx)("span",{className:"truncate leading-5",suppressHydrationWarning:!0,children:e.name}),I&&(0,s.jsx)(g.A,{size:10,className:"shrink-0 fill-[var(--amber)] text-[var(--amber)] opacity-60"})]}),(0,s.jsx)("div",{className:"absolute right-1 top-1/2 -translate-y-1/2 hidden group-hover/file:flex items-center gap-0.5",children:(0,s.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation();let t=e.currentTarget.getBoundingClientRect();U({x:t.left,y:t.bottom+4})},className:"p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",title:"More",children:(0,s.jsx)(f.A,{size:14})})}),B&&(0,s.jsxs)(Y,{x:B.x,y:B.y,onClose:()=>U(null),menuHeight:140,children:[(0,s.jsxs)("button",{className:H,onClick:()=>{Z(e.path),U(null)},children:[(0,s.jsx)(b.A,{size:14,className:"shrink-0"})," ",P.fileTree.copyPath]}),(0,s.jsxs)("button",{className:H,onClick:()=>{F(e.path),U(null)},children:[(0,s.jsx)(g.A,{size:14,className:`shrink-0 ${I?"fill-[var(--amber)] text-[var(--amber)]":""}`}),I?P.fileTree.removeFromFavorites:P.fileTree.pinToFavorites]}),!L&&(0,s.jsxs)("button",{className:H,onClick:e=>{U(null),J(e)},children:[(0,s.jsx)(v.A,{size:14,className:"shrink-0"})," ",P.fileTree.rename]}),!L&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:K}),(0,s.jsxs)("button",{className:X,onClick:e=>{U(null),V(e)},children:[(0,s.jsx)(y.A,{size:14,className:"shrink-0"})," ",P.fileTree.delete]})]})]}),(0,s.jsx)(T.TM,{open:O,title:P.fileTree.delete,message:P.fileTree.confirmDelete(e.name),confirmLabel:P.fileTree.delete,cancelLabel:P.view?.cancel??"Cancel",variant:"destructive",onCancel:()=>W(!1),onConfirm:()=>{W(!1),C(async()=>{let t=await (0,z.i)(e.path);if(t.success){if(t.trashId){let r=t.trashId,s=e.path.split("/").pop()??e.path;E.oR.undo(`${P.trash?.movedToTrash??"Deleted"} ${s}`,async()=>{let e=await (0,A.Y)(r);e.success?(m.refresh(),q()):E.oR.error(e.error??"Undo failed")},{label:P.trash?.undo??"Undo"})}m.refresh(),q()}})}})]})}function er({nodes:e,depth:t=0,onNavigate:r,maxOpenDepth:o,parentIsSpace:l,onImport:d}){var c;let u,m=(u="/view/",(c=(0,a.usePathname)()).startsWith(u)?c.slice(u.length).split("/").map(decodeURIComponent).join("/"):""),x=I(),p=0===t,h=x?e:e.filter(e=>!(p&&e.name.startsWith(".")||"file"===e.type&&i.C.has(e.name)||"directory"===e.type&&e.name.startsWith("."))),f=p?h.filter(e=>"directory"!==e.type||"Inbox"!==e.name):h;return(0,n.useEffect)(()=>{if(!m||0!==t)return;let e=setTimeout(()=>{let e=document.querySelector(`[data-filepath="${CSS.escape(m)}"]`);e?.scrollIntoView({block:"nearest",behavior:"smooth"})},120);return()=>clearTimeout(e)},[m,t]),(0,s.jsx)("div",{className:"flex flex-col gap-0.5",children:f.map(e=>"directory"===e.type?(0,s.jsx)(ee,{node:e,depth:t,currentPath:m,onNavigate:r,maxOpenDepth:o,onImport:d},e.path):(0,s.jsx)(et,{node:e,depth:t,currentPath:m,onNavigate:r},e.path))})}},14446:(e,t,r)=>{"use strict";r.r(t),r.d(t,{AudioRenderer:()=>a});var s=r(95155),n=r(12115);function a({filePath:e}){let t=`/api/file/raw?path=${encodeURIComponent(e)}`,r=e.split("/").pop()??"audio",a=r.split(".").pop()?.toLowerCase()??"",[i,o]=(0,n.useState)(!1),[l,d]=(0,n.useState)(0),[c,u]=(0,n.useState)(null);(0,n.useEffect)(()=>{fetch(t,{method:"HEAD"}).then(e=>{let t=e.headers.get("Content-Length");t&&u(parseInt(t,10))}).catch(()=>{})},[t]);let m=(0,n.useCallback)(()=>{o(!1),d(e=>e+1)},[]);return(0,s.jsxs)("div",{className:"w-full flex flex-col items-center gap-6 py-12 px-4",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3 text-xs text-[var(--text-secondary)]",children:[(0,s.jsx)("span",{className:"text-4xl opacity-40",children:"\uD83C\uDFB5"}),(0,s.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,s.jsx)("span",{className:"text-sm font-medium text-[var(--text-primary)]",children:r}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{className:"uppercase opacity-60",children:a}),null!==c&&(0,s.jsx)("span",{children:c<1024?`${c} B`:c<1048576?`${(c/1024).toFixed(1)} KB`:`${(c/1048576).toFixed(1)} MB`})]})]})]}),i?(0,s.jsxs)("div",{className:"flex flex-col items-center gap-2",children:[(0,s.jsx)("span",{className:"text-sm text-[var(--text-secondary)]",children:"Failed to load audio"}),(0,s.jsx)("button",{onClick:m,className:"text-xs px-3 py-1.5 rounded-md bg-[var(--bg-tertiary)] hover:bg-[var(--bg-hover)] transition-colors",children:"Retry"})]}):(0,s.jsx)("audio",{controls:!0,preload:"metadata",className:"w-full max-w-lg",onError:()=>o(!0),children:(0,s.jsx)("source",{src:t})},l)]})}},16518:(e,t,r)=>{"use strict";r.d(t,{AI:()=>n,RS:()=>s});let s=["imprint","growth","self"],n={imprint:"/echo/imprint",growth:"/echo/growth",self:"/echo/self"}},18847:(e,t,r)=>{"use strict";r.r(t),r.d(t,{AgentInspectorRenderer:()=>j});var s=r(95155),n=r(12115),a=r(73321),i=r(84980),o=r(3926),l=r(93631),d=r(68459),c=r(61878),u=r(10762),m=r(12651),x=r(13545),p=r(66088);function h(e){return/read|list|get|search/.test(e)?/search/.test(e)?"search":"read":/create/.test(e)?"create":/delete/.test(e)?"delete":/write|update|insert|append/.test(e)?"write":"other"}let f={read:{bg:"rgba(138,180,216,0.10)",text:"var(--tool-read)",border:"rgba(138,180,216,0.25)"},write:{bg:"rgba(200,135,58,0.10)",text:"var(--amber)",border:"rgba(200,135,58,0.25)"},create:{bg:"rgba(122,173,128,0.10)",text:"var(--success)",border:"rgba(122,173,128,0.25)"},delete:{bg:"rgba(200,80,80,0.10)",text:"var(--error)",border:"rgba(200,80,80,0.25)"},search:{bg:"rgba(200,160,216,0.10)",text:"var(--tool-search)",border:"rgba(200,160,216,0.25)"},other:{bg:"var(--muted)",text:"var(--muted-foreground)",border:"var(--border)"}};function g({kind:e,size:t=13}){return"read"===e?(0,s.jsx)(i.A,{size:t}):"write"===e?(0,s.jsx)(o.A,{size:t}):"create"===e?(0,s.jsx)(l.A,{size:t}):"delete"===e?(0,s.jsx)(d.A,{size:t}):"search"===e?(0,s.jsx)(c.A,{size:t}):(0,s.jsx)(u.A,{size:t})}function b(e){try{return new Date(e).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return e}}function v({op:e}){var t,r;let i,o,l,d,c=(0,a.useRouter)(),[u,v]=(0,n.useState)(!1),y=h(e.tool),j=f[y],w="string"==typeof(t=e.params).path?t.path:null,N=e.tool.replace("mindos_","");return(0,s.jsxs)("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:10,overflow:"hidden",marginBottom:8},children:[(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"10px 14px",cursor:"pointer",userSelect:"none"},onClick:()=>v(e=>!e),children:[(0,s.jsxs)("span",{className:"font-display",style:{display:"inline-flex",alignItems:"center",gap:4,padding:"2px 8px",borderRadius:999,fontSize:"0.68rem",fontWeight:600,background:j.bg,color:j.text,border:`1px solid ${j.border}`,flexShrink:0},children:[(0,s.jsx)(g,{kind:y,size:10}),y]}),(0,s.jsx)("span",{className:"font-display",style:{fontSize:"0.78rem",color:"var(--foreground)",fontWeight:600,flexShrink:0},children:N}),w&&(0,s.jsx)("span",{style:{fontSize:"0.72rem",color:"var(--amber)",flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",cursor:"pointer"},onClick:e=>{e.stopPropagation(),c.push("/view/"+w.split("/").map(encodeURIComponent).join("/"))},title:w,className:"font-display",children:w}),(0,s.jsxs)("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[e.agentName&&(0,s.jsx)("span",{className:"font-display",style:{fontSize:"0.62rem",fontWeight:500,padding:"1px 6px",borderRadius:999,background:"var(--muted)",color:"var(--muted-foreground)",whiteSpace:"nowrap",maxWidth:120,overflow:"hidden",textOverflow:"ellipsis"},title:e.agentName,children:e.agentName.length>30?e.agentName.slice(0,30)+"...":e.agentName}),"ok"===e.result?(0,s.jsx)(m.A,{size:13,style:{color:"var(--success)"}}):(0,s.jsx)(x.A,{size:13,style:{color:"var(--error)"}}),(0,s.jsx)("span",{className:"font-display",style:{fontSize:"0.68rem",color:"var(--muted-foreground)",opacity:.6},title:b(e.ts),children:(r=e.ts,o=Math.floor((i=Date.now()-new Date(r).getTime())/6e4),l=Math.floor(i/36e5),d=Math.floor(i/864e5),o<1?"just now":o<60?`${o}m ago`:l<24?`${l}h ago`:`${d}d ago`)}),(0,s.jsx)(p.A,{size:12,style:{color:"var(--muted-foreground)",transform:u?"rotate(180deg)":"none",transition:"transform .15s"}})]})]}),u&&(0,s.jsxs)("div",{style:{borderTop:"1px solid var(--border)",padding:"10px 14px",background:"var(--background)"},children:[(0,s.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:4,marginBottom:8*!!e.message},children:Object.entries(e.params).map(([e,t])=>(0,s.jsxs)("div",{style:{display:"flex",gap:8,alignItems:"flex-start"},children:[(0,s.jsx)("span",{className:"font-display",style:{fontSize:"0.68rem",color:"var(--muted-foreground)",opacity:.7,flexShrink:0,minWidth:80},children:e}),(0,s.jsx)("span",{className:"font-display",style:{fontSize:"0.72rem",color:"var(--foreground)",wordBreak:"break-all",lineHeight:1.5},children:function(e,t=120){let r="string"==typeof e?e:JSON.stringify(e);return r.length>t?r.slice(0,t)+"…":r}(t)})]},e))}),e.message&&(0,s.jsx)("div",{className:"font-display",style:{marginTop:6,padding:"5px 9px",borderRadius:5,fontSize:"0.72rem",background:"error"===e.result?"rgba(200,80,80,0.08)":"rgba(122,173,128,0.08)",color:"error"===e.result?"var(--error)":"var(--success)",border:`1px solid ${"error"===e.result?"rgba(200,80,80,0.2)":"rgba(122,173,128,0.2)"}`},children:e.message}),e.agentName&&(0,s.jsxs)("div",{className:"font-display",style:{marginTop:6,fontSize:"0.68rem",color:"var(--muted-foreground)"},children:["Agent: ",(0,s.jsx)("span",{style:{color:"var(--foreground)",fontWeight:500},children:e.agentName})]}),(0,s.jsx)("div",{className:"font-display",style:{marginTop:6,fontSize:"0.65rem",color:"var(--muted-foreground)",opacity:.5},children:b(e.ts)})]})]})}let y=["all","write","create","delete","read","search"];function j({content:e}){let[t,r]=(0,n.useState)("all"),a=(0,n.useMemo)(()=>(function(e){try{let t=JSON.parse(e);if(Array.isArray(t.events))return t.events.filter(e=>!!e?.tool&&!!e?.ts).sort((e,t)=>new Date(t.ts).getTime()-new Date(e.ts).getTime())}catch{}return(function(e){let t=[];for(let r of e.split("\n")){let e=r.trim();if(!(!e||e.startsWith("#")||e.startsWith("//")))try{let r=JSON.parse(e);r.tool&&r.ts&&t.push(r)}catch{}}return t})(e).sort((e,t)=>new Date(t.ts).getTime()-new Date(e.ts).getTime())})(e),[e]),i=(0,n.useMemo)(()=>"all"===t?a:a.filter(e=>h(e.tool)===t),[a,t]),o=(0,n.useMemo)(()=>{let e={all:a.length};for(let t of a){let r=h(t.tool);e[r]=(e[r]??0)+1}return e},[a]);return 0===a.length?(0,s.jsxs)("div",{className:"font-display",style:{padding:"3rem 1rem",textAlign:"center",color:"var(--muted-foreground)",fontSize:12},children:[(0,s.jsx)(u.A,{size:28,style:{margin:"0 auto 10px",opacity:.3}}),(0,s.jsx)("p",{children:"No agent operations logged yet."}),(0,s.jsxs)("p",{style:{marginTop:6,opacity:.6,fontSize:11},children:["Agent writes appear here from ",(0,s.jsx)("code",{style:{background:"var(--muted)",padding:"1px 5px",borderRadius:4},children:".mindos/agent-audit-log.json"}),"."]})]}):(0,s.jsxs)("div",{style:{maxWidth:760,margin:"0 auto",padding:"1.5rem 0"},children:[(0,s.jsx)("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:"1.2rem",flexWrap:"wrap"},children:y.map(e=>{let n=o[e]??0;if("all"!==e&&!n)return null;let a="all"!==e?f[e]:void 0,i=t===e;return(0,s.jsxs)("button",{onClick:()=>r(e),className:"font-display",style:{display:"inline-flex",alignItems:"center",gap:4,padding:"3px 10px",borderRadius:999,fontSize:"0.7rem",cursor:"pointer",border:"none",background:i?a?.bg??"var(--accent)":"var(--muted)",color:i?a?.text??"var(--foreground)":"var(--muted-foreground)",outline:i?`1px solid ${a?.border??"var(--border)"}`:"none",transition:"all .1s"},children:["all"!==e&&(0,s.jsx)(g,{kind:e,size:10}),e," ",(0,s.jsxs)("span",{style:{opacity:.6},children:["(",n,")"]})]},e)})}),(0,s.jsx)("div",{children:i.map((e,t)=>(0,s.jsx)(v,{op:e},t))})]})}},20555:(e,t,r)=>{"use strict";r.d(t,{LD:()=>s,LZ:()=>n,qQ:()=>a});let s=[{id:"c1",icon:"\uD83D\uDC64",category:"memory-sync",scenario:"first-day"},{id:"c2",icon:"\uD83D\uDCE5",category:"knowledge-management",scenario:"daily"},{id:"c3",icon:"\uD83D\uDD04",category:"memory-sync",scenario:"project"},{id:"c4",icon:"\uD83D\uDD01",category:"experience-evolution",scenario:"daily"},{id:"c5",icon:"\uD83D\uDCA1",category:"auto-execute",scenario:"daily"},{id:"c6",icon:"\uD83D\uDE80",category:"auto-execute",scenario:"project"},{id:"c7",icon:"\uD83D\uDD0D",category:"knowledge-management",scenario:"project"},{id:"c8",icon:"\uD83E\uDD1D",category:"human-insights",scenario:"daily"},{id:"c9",icon:"\uD83D\uDEE1️",category:"audit-control",scenario:"advanced"}],n=["knowledge-management","memory-sync","auto-execute","experience-evolution","human-insights","audit-control"],a=["first-day","daily","project","advanced"]},20814:(e,t,r)=>{"use strict";r.r(t),r.d(t,{ImageRenderer:()=>i});var s=r(95155),n=r(12115);let a=[.25,.5,.75,1,1.5,2,3,4];function i({filePath:e}){let t=`/api/file/raw?path=${encodeURIComponent(e)}`,r=e.split("/").pop()??"image",i=r.split(".").pop()?.toLowerCase()??"",o=["png","svg","webp","ico","gif"].includes(i),[l,d]=(0,n.useState)(!0),[c,u]=(0,n.useState)(!1),[m,x]=(0,n.useState)(0),[p,h]=(0,n.useState)("fit"),[f,g]=(0,n.useState)(null),[b,v]=(0,n.useState)(null),y=(0,n.useRef)(null),j=(0,n.useRef)(null),w=(0,n.useCallback)(()=>{d(!1);let e=y.current;e&&g({w:e.naturalWidth,h:e.naturalHeight})},[]),N=(0,n.useCallback)(()=>{d(!1),u(!0)},[]),k=(0,n.useCallback)(()=>{u(!1),d(!0),x(e=>e+1)},[]);(0,n.useEffect)(()=>{l||c||null!==b||fetch(t,{method:"HEAD"}).then(e=>{let t=e.headers.get("Content-Length");t&&v(parseInt(t,10))}).catch(()=>{})},[t,l,c,b]);let S=(0,n.useCallback)(()=>{h(e=>{let t="fit"===e?1:e;return a.find(e=>e>t)??t})},[]),C=(0,n.useCallback)(()=>{h(e=>{let t="fit"===e?1:e;return[...a].reverse().find(e=>e<t)??t})},[]),A=(0,n.useCallback)(()=>{h(e=>"fit"===e?1:"fit")},[]);(0,n.useEffect)(()=>{let e=j.current;if(!e)return;let t=t=>{t.target instanceof HTMLInputElement||t.target instanceof HTMLTextAreaElement||(document.activeElement===document.body||e.contains(document.activeElement))&&(("+"===t.key||"="===t.key)&&(t.preventDefault(),S()),"-"===t.key&&(t.preventDefault(),C()),"0"===t.key&&(t.preventDefault(),h("fit")),"1"===t.key&&(t.preventDefault(),h(1)))};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[S,C]);let z="fit"===p?"Fit":`${Math.round(100*p)}%`,E="fit"===p?{maxWidth:"100%",maxHeight:"70vh",objectFit:"contain"}:f?{width:f.w*p,height:"auto"}:{maxWidth:"100%",maxHeight:"70vh",objectFit:"contain"};return(0,s.jsxs)("div",{className:"w-full flex flex-col gap-0",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border text-xs text-[var(--text-secondary)]",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[f&&(0,s.jsxs)("span",{children:[f.w," x ",f.h]}),null!==b&&(0,s.jsx)("span",{children:b<1024?`${b} B`:b<1048576?`${(b/1024).toFixed(1)} KB`:`${(b/1048576).toFixed(1)} MB`}),(0,s.jsx)("span",{className:"uppercase opacity-60",children:i})]}),(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[(0,s.jsx)("button",{onClick:C,disabled:!f,className:"px-2 py-1 rounded hover:bg-[var(--bg-hover)] transition-colors disabled:opacity-30",title:"Zoom out (-)",children:"-"}),(0,s.jsx)("button",{onClick:A,disabled:!f,className:"px-2 py-1 rounded hover:bg-[var(--bg-hover)] transition-colors min-w-[48px] text-center disabled:opacity-30",title:"fit"===p?"Actual size (1)":"Fit to view (0)",children:z}),(0,s.jsx)("button",{onClick:S,disabled:!f,className:"px-2 py-1 rounded hover:bg-[var(--bg-hover)] transition-colors disabled:opacity-30",title:"Zoom in (+)",children:"+"})]})]}),(0,s.jsxs)("div",{ref:j,tabIndex:-1,className:`relative flex-1 min-h-[70vh] overflow-auto flex items-center justify-center outline-none ${o?"bg-checkerboard":"bg-[var(--bg-secondary)]"}`,children:[l&&!c&&(0,s.jsx)("div",{className:"absolute inset-0 flex items-center justify-center z-10",children:(0,s.jsx)("span",{className:"text-sm text-[var(--text-tertiary)] animate-pulse",children:"Loading..."})}),c&&(0,s.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center z-10 gap-2",children:[(0,s.jsx)("span",{className:"text-sm text-[var(--text-secondary)]",children:"Failed to load image"}),(0,s.jsx)("button",{onClick:k,className:"text-xs px-3 py-1.5 rounded-md bg-[var(--bg-tertiary)] hover:bg-[var(--bg-hover)] transition-colors",children:"Retry"})]}),(0,s.jsx)("img",{ref:y,src:t,alt:r,onLoad:w,onError:N,draggable:!1,className:"select-none",style:{display:c?"none":"block",...E}},m)]})]})}},20870:(e,t,r)=>{"use strict";r.r(t),r.d(t,{PdfRenderer:()=>a});var s=r(95155),n=r(12115);function a({filePath:e}){let t=`/api/file/raw?path=${encodeURIComponent(e)}`,[r,a]=(0,n.useState)(!0),[i,o]=(0,n.useState)(!1),[l,d]=(0,n.useState)(0),c=(0,n.useCallback)(()=>{o(!1),a(!0),d(e=>e+1)},[]);return(0,s.jsxs)("div",{className:"w-full h-full min-h-[80vh] flex flex-col relative",children:[r&&!i&&(0,s.jsx)("div",{className:"absolute inset-0 flex items-center justify-center bg-[var(--bg-secondary)] rounded-lg z-10",children:(0,s.jsx)("span",{className:"text-sm text-[var(--text-tertiary)] animate-pulse",children:"Loading PDF..."})}),i&&(0,s.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center bg-[var(--bg-secondary)] rounded-lg z-10 gap-2",children:[(0,s.jsx)("span",{className:"text-sm text-[var(--text-secondary)]",children:"Failed to load PDF"}),(0,s.jsx)("button",{onClick:c,className:"text-xs px-3 py-1.5 rounded-md bg-[var(--bg-tertiary)] hover:bg-[var(--bg-hover)] transition-colors",children:"Retry"})]}),(0,s.jsx)("iframe",{src:t,className:"w-full flex-1 min-h-[80vh] border-0 rounded-lg bg-[var(--bg-secondary)]",title:e.split("/").pop()??"PDF",onLoad:()=>a(!1),onError:()=>{a(!1),o(!0)},style:{display:i?"none":"block"}},l)]})}},26490:(e,t,r)=>{"use strict";r.d(t,{default:()=>u});var s=r(95155),n=r(12115),a=r(94514),i=r(13545),o=r(68822),l=r(33210),d=r(4235);let c={success:(0,s.jsx)(a.A,{size:15,className:"text-success shrink-0"}),error:(0,s.jsx)(i.A,{size:15,className:"text-error shrink-0"}),info:(0,s.jsx)(o.A,{size:15,className:"text-muted-foreground shrink-0"})};function u(){let e=(0,n.useSyncExternalStore)(d.B1,d.dV,d.dV);return 0===e.length?null:(0,s.jsx)("div",{className:"fixed bottom-4 right-4 z-50 flex flex-col-reverse gap-2 pointer-events-none",role:"status","aria-live":"polite","aria-atomic":"false",children:e.map(e=>(0,s.jsxs)("div",{className:"pointer-events-auto flex items-center gap-2.5 bg-card border border-border rounded-lg shadow-lg px-4 py-2.5 min-w-[180px] max-w-[320px] animate-in slide-in-from-right-4 fade-in duration-200",children:[c[e.type],(0,s.jsx)("span",{className:"text-sm text-foreground flex-1 truncate",children:e.message}),e.action&&(0,s.jsx)("button",{type:"button",onClick:()=>{e.action.onClick(),(0,d.X8)(e.id)},className:"shrink-0 px-2.5 py-1 rounded text-xs font-medium text-[var(--amber)] hover:bg-[var(--amber-dim)] transition-colors min-h-[28px] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:e.action.label}),(0,s.jsx)("button",{type:"button",onClick:()=>(0,d.X8)(e.id),className:"shrink-0 p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring","aria-label":e.action?.label?"Close":"Dismiss",children:(0,s.jsx)(l.A,{size:13})})]},e.id))})}},29494:(e,t,r)=>{"use strict";r.d(t,{Aw:()=>l,Nh:()=>c,QL:()=>a,TM:()=>i,h0:()=>o,lL:()=>d});var s=r(4235);function n(e){let t=new Uint8Array(e),r=[];for(let e=0;e<t.length;e+=8192)r.push(String.fromCharCode(...t.subarray(e,e+8192)));return btoa(r.join(""))}async function a(e,t){let r=[],a=0;for(let t of e){if(t.size>0xa00000){a++;continue}try{if(t.name.toLowerCase().endsWith(".pdf")){let e=await t.arrayBuffer();r.push({name:t.name,content:n(e),encoding:"base64"})}else{let e=await t.text();r.push({name:t.name,content:e})}}catch{}}if(0===r.length)return void(a>0?s.oR.error(t.inbox.tooLarge(a),4e3):e.length>0&&s.oR.error(t.inbox.saveFailed,4e3));try{var i;let e=await fetch("/api/inbox",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:r})});if(!e.ok){let r=await e.json().catch(()=>({}));console.error("[QuickDrop] Save failed:",r.error),s.oR.error(t.inbox.saveFailed,4e3);return}let n=await e.json(),o=n.saved?.length??0,l=n.skipped?.length??0;i=a,o>0&&i>0&&0===l?s.oR.success(t.inbox.savedWithOversized(o,i),4e3):o>0&&l+i>0?s.oR.success(t.inbox.savedWithSkipped(o,l+i),4e3):o>0?s.oR.success(t.inbox.savedToast(o),3e3):(i>0&&s.oR.error(t.inbox.tooLarge(i),4e3),l>0&&s.oR.error(t.inbox.savedWithSkipped(0,l),4e3),0===i&&0===l&&s.oR.error(t.inbox.saveFailed,4e3)),window.dispatchEvent(new Event("mindos:files-changed")),window.dispatchEvent(new Event("mindos:inbox-updated"))}catch(e){console.error("[QuickDrop] Network error:",e),s.oR.error(t.inbox.saveFailed,4e3)}}async function i(e,t){try{let r=await fetch("/api/inbox/clip",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:e})}),n=await r.json();if(!r.ok){let e=n.error||t.inbox.clipFailed;return s.oR.error(e,4e3),{ok:!1}}return s.oR.success(t.inbox.clipSuccess(n.title||e),3e3),window.dispatchEvent(new Event("mindos:files-changed")),window.dispatchEvent(new Event("mindos:inbox-updated")),{ok:!0,title:n.title}}catch(e){return console.error("[ClipURL] Network error:",e),s.oR.error(t.inbox.clipFailed,4e3),{ok:!1}}}function o(e){let t=e.trim();if(!t.startsWith("http://")&&!t.startsWith("https://"))return!1;try{return new URL(t),!0}catch{return!1}}function l(e){if(e.dataTransfer?.files&&e.dataTransfer.files.length>0)return null;let t=e.dataTransfer?.getData("text/uri-list");if(t){let e=t.split(/[\r\n]+/).find(e=>!e.startsWith("#")&&e.trim().length>0);if(e&&o(e))return e.trim()}let r=e.dataTransfer?.getData("text/plain");return r&&o(r)?r.trim():null}function d(e){let t=e.dataTransfer?.types??[];return!t.includes("Files")&&(t.includes("text/uri-list")||t.includes("text/plain"))}async function c(e,t,r){let a=[],i=0,o=new Set(["pdf","png","jpg","jpeg","gif","webp","bmp","ico","mp3","wav","m4a","ogg","flac","aac","mp4","webm","mov","mkv"]);for(let t of e){if(t.size>0xa00000){i++;continue}try{let e=(t.name.split(".").pop()??"").toLowerCase();if(o.has(e)){let e=await t.arrayBuffer();a.push({name:t.name,content:n(e),encoding:"base64"})}else{let e=await t.text();a.push({name:t.name,content:e})}}catch{}}if(0===a.length)return void(i>0?s.oR.error(r.inbox.tooLarge(i),4e3):e.length>0&&s.oR.error(r.inbox.saveFailed,4e3));let l=t.split("/").pop()||t;try{let e=await fetch("/api/file/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:a,targetSpace:t,organize:!1,conflict:"rename"})});if(!e.ok){let t=await e.json().catch(()=>({}));console.error("[TreeDrop] Save failed:",t.error),s.oR.error(r.inbox.saveFailed,4e3);return}let n=await e.json(),o=n.created?.length??0,d=n.skipped?.length??0;o>0&&d+i>0?s.oR.success(r.inbox.savedWithSkipped(o,d+i),4e3):o>0?s.oR.success(r.inbox.savedToDir(o,l),3e3):(i>0&&s.oR.error(r.inbox.tooLarge(i),4e3),d>0&&s.oR.error(r.inbox.savedWithSkipped(0,d),4e3)),window.dispatchEvent(new Event("mindos:files-changed"))}catch(e){console.error("[TreeDrop] Network error:",e),s.oR.error(r.inbox.saveFailed,4e3)}}},30266:(e,t,r)=>{Promise.resolve().then(r.t.bind(r,66872,23)),Promise.resolve().then(r.bind(r,92524)),Promise.resolve().then(r.bind(r,86343)),Promise.resolve().then(r.bind(r,18847)),Promise.resolve().then(r.bind(r,14446)),Promise.resolve().then(r.bind(r,88946)),Promise.resolve().then(r.bind(r,57025)),Promise.resolve().then(r.bind(r,35504)),Promise.resolve().then(r.bind(r,92306)),Promise.resolve().then(r.bind(r,92950)),Promise.resolve().then(r.bind(r,20814)),Promise.resolve().then(r.bind(r,20870)),Promise.resolve().then(r.bind(r,56406)),Promise.resolve().then(r.bind(r,39594)),Promise.resolve().then(r.bind(r,78660)),Promise.resolve().then(r.bind(r,87986)),Promise.resolve().then(r.bind(r,48133)),Promise.resolve().then(r.bind(r,61905)),Promise.resolve().then(r.bind(r,26490)),Promise.resolve().then(r.bind(r,91459)),Promise.resolve().then(r.bind(r,40430)),Promise.resolve().then(r.bind(r,98959)),Promise.resolve().then(r.bind(r,93042)),Promise.resolve().then(r.t.bind(r,16719,23)),Promise.resolve().then(r.t.bind(r,377,23)),Promise.resolve().then(r.t.bind(r,98663,23)),Promise.resolve().then(r.t.bind(r,75282,23))},32881:(e,t,r)=>{"use strict";r.d(t,{i:()=>n});var s=r(9339);let n=(0,s.createServerReference)("40d921e4bebcd091ade1ed6a599151978018576188",s.callServer,void 0,s.findSourceMapURL,"deleteFileAction")},35504:(e,t,r)=>{"use strict";r.r(t),r.d(t,{ConfigRenderer:()=>d});var s=r(95155),n=r(12115),a=r(6296),i=r(94514),o=r(33210),l=r(51914);function d({content:e,saveAction:t}){let r=(0,n.useMemo)(()=>{try{return JSON.parse(e)}catch{return null}},[e]),[d,c]=(0,n.useState)(r),[u,m]=(0,n.useState)(!1),[x,p]=(0,n.useState)(!1),[h,f]=(0,n.useState)(""),[g,b]=(0,n.useState)({});(0,n.useEffect)(()=>{c(r),f("")},[r]);let v=d??{},y=v.uiSchema?.sections??[],j=v.keySpecs??{},w=(0,n.useCallback)(async e=>{m(!0),p(!1),f("");try{await t(`${JSON.stringify(e,null,2)}
|
|
21
|
+
`),p(!0),setTimeout(()=>p(!1),1200)}catch(e){f(e instanceof Error?e.message:"Failed to save")}finally{m(!1)}},[t]),N=(0,n.useCallback)(async(e,t)=>{if(!d)return;let r=function(e,t,r){let s=t.split("."),n=structuredClone(e),a=n;for(let e=0;e<s.length-1;e++){let t=s[e],r=a[t];(!r||"object"!=typeof r||Array.isArray(r))&&(a[t]={}),a=a[t]}return a[s[s.length-1]]=r,n}(d,e,t);c(r),await w(r)},[d,w]);return r&&d?(0,s.jsxs)("div",{className:"max-w-3xl mx-auto flex flex-col gap-3",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between rounded-xl border border-border bg-card px-4 py-2.5",children:[(0,s.jsx)("div",{className:"text-xs text-muted-foreground",children:"CONFIG Control Panel"}),(0,s.jsxs)("div",{className:"text-xs flex items-center gap-2",children:[u&&(0,s.jsxs)("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:[(0,s.jsx)(a.A,{size:12,className:"animate-spin"}),"Saving"]}),!u&&x&&(0,s.jsxs)("span",{className:"inline-flex items-center gap-1",style:{color:"var(--success)"},children:[(0,s.jsx)(i.A,{size:12}),"Saved"]})]})]}),h&&(0,s.jsx)("div",{className:"rounded-lg border border-error/30 bg-error/10 px-3 py-2 text-xs text-error",children:h}),y.map(e=>(0,s.jsxs)("div",{className:"rounded-xl border border-border bg-card p-4",children:[(0,s.jsxs)("div",{className:"mb-3",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:e.title}),e.description&&(0,s.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:e.description})]}),(0,s.jsx)("div",{className:"space-y-3",children:e.fields.map(e=>{let t=j[e]??{},r=function(e,t){let r=t.split("."),s=e;for(let e of r){if(!s||"object"!=typeof s||!(e in s))return null;s=s[e]}return s}(d,e),n=t.label||e;return(0,s.jsxs)("div",{className:"rounded-lg border border-border/80 bg-background px-3 py-2.5",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3 mb-1.5",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-sm text-foreground",children:n}),t.description&&(0,s.jsx)("div",{className:"text-xs text-muted-foreground mt-0.5",children:t.description})]}),"switch"===t.control&&"boolean"==typeof r&&(0,s.jsx)("button",{type:"button",onClick:()=>N(e,!r),className:"px-2.5 py-1 rounded-md text-xs font-medium",style:{background:r?"var(--amber)":"var(--muted)",color:r?"var(--amber-foreground)":"var(--muted-foreground)"},children:r?"ON":"OFF"})]}),"text"===t.control&&"string"==typeof r&&(0,s.jsx)("input",{defaultValue:r,onBlur:t=>N(e,t.target.value),className:"w-full px-2 py-1.5 text-sm bg-card border border-border rounded text-foreground"}),"number"===t.control&&"number"==typeof r&&(0,s.jsx)("input",{type:"number",defaultValue:r,min:t.constraints?.min,max:t.constraints?.max,onBlur:s=>{let n=Number(s.target.value),a=t.constraints?.min,i=t.constraints?.max,o=Number.isFinite(n)?n:r;"number"==typeof a&&o<a&&(o=a),"number"==typeof i&&o>i&&(o=i),N(e,o)},className:"w-full px-2 py-1.5 text-sm bg-card border border-border rounded text-foreground"}),"tag-list"===t.control&&Array.isArray(r)&&(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,s.jsx)("div",{className:"flex flex-wrap gap-1.5",children:r.map((t,n)=>(0,s.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded border border-border text-xs bg-muted text-foreground",children:[String(t),(0,s.jsx)("button",{type:"button",onClick:()=>N(e,r.filter((e,t)=>t!==n)),className:"text-muted-foreground hover:text-foreground",children:(0,s.jsx)(o.A,{size:11})})]},`${String(t)}-${n}`))}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("input",{value:g[e]??"",onChange:t=>b(r=>({...r,[e]:t.target.value})),onKeyDown:t=>{if("Enter"!==t.key)return;t.preventDefault();let s=(g[e]??"").trim();s&&(N(e,[...r,s]),b(t=>({...t,[e]:""})))},className:"flex-1 px-2 py-1.5 text-sm bg-card border border-border rounded text-foreground",placeholder:"Add item"}),(0,s.jsxs)("button",{type:"button",onClick:()=>{let t=(g[e]??"").trim();t&&(N(e,[...r,t]),b(t=>({...t,[e]:""})))},className:"px-2.5 py-1.5 rounded-md text-xs bg-muted text-foreground inline-flex items-center gap-1",children:[(0,s.jsx)(l.A,{size:12})," Add"]})]})]})]},e)})})]},e.id))]}):(0,s.jsx)("div",{className:"rounded-xl border border-border p-4 text-sm text-error",children:"CONFIG.json parse failed. Please check JSON format."})}},39594:(e,t,r)=>{"use strict";r.r(t),r.d(t,{TimelineRenderer:()=>l});var s=r(95155),n=r(12115);let a=/(\d{4}[-/]\d{1,2}(?:[-/]\d{1,2})?|[A-Za-z]+ \d{4}|\d{4}年\d{1,2}月(?:\d{1,2}日)?)/;function i(e){return e.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/`(.+?)`/g,'<code class="font-display" style="font-size:0.85em;padding:1px 5px;border-radius:4px;background:var(--muted)">$1</code>').replace(/\[\[([^\]|]+)(?:\|([^\]]+))?\]\]/g,(e,t,r)=>`<span style="color:var(--amber);cursor:pointer" title="${t}">${r??t}</span>`).replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" style="color:var(--amber)">$1</a>')}let o=[{bg:"rgba(200,135,58,0.12)",text:"var(--amber)"},{bg:"rgba(122,173,128,0.12)",text:"var(--success)"},{bg:"rgba(138,180,216,0.12)",text:"var(--tool-read)"},{bg:"rgba(200,160,216,0.12)",text:"var(--tool-search)"}];function l({content:e}){let t=(0,n.useMemo)(()=>(function(e){let t=e.split("\n"),r=[],s=null,n=[],i=()=>{let e,t;if(!s)return;let a=n.join("\n").trim();s.body=a,s.tags=(e=[],(t=a.match(/#([\w\u4e00-\u9fff]+)/g))&&e.push(...t.map(e=>e.slice(1))),[...new Set(e)]),r.push(s),s=null,n=[]};for(let e of t)if(!/^# /.test(e)){if(/^## /.test(e)){i();let t=e.slice(3).trim();s={heading:t,date:function(e){let t=a.exec(e);if(!t)return null;let r=new Date(t[1].replace(/[/年月]/g,"-").replace("日",""));return isNaN(r.getTime())?null:r}(t),body:"",tags:[]};continue}s&&n.push(e)}return i(),r})(e),[e]);return 0===t.length?(0,s.jsxs)("div",{className:"font-display",style:{padding:"3rem 1rem",textAlign:"center",color:"var(--muted-foreground)",fontSize:13},children:["No timeline entries found. Add ",(0,s.jsx)("code",{style:{background:"var(--muted)",padding:"1px 6px",borderRadius:4},children:"## 2025-01-15"})," headings to create entries."]}):(0,s.jsxs)("div",{style:{maxWidth:720,margin:"0 auto",padding:"1.5rem 0"},children:[(0,s.jsx)("div",{style:{marginBottom:"1.5rem",display:"flex",alignItems:"center",gap:8},children:(0,s.jsxs)("span",{className:"font-display",style:{fontSize:11,color:"var(--muted-foreground)"},children:[t.length," ",1===t.length?"entry":"entries"]})}),(0,s.jsxs)("div",{style:{position:"relative",paddingLeft:28},children:[(0,s.jsx)("div",{style:{position:"absolute",left:6,top:8,bottom:8,width:1,background:"var(--border)"}}),t.map((e,t)=>(0,s.jsxs)("div",{style:{position:"relative",marginBottom:"1.5rem"},children:[(0,s.jsx)("div",{style:{position:"absolute",left:-22,top:10,width:9,height:9,borderRadius:"50%",background:e.date?"var(--amber)":"var(--border)",outline:e.date?"2px solid var(--amber-dim)":"none",zIndex:1}}),(0,s.jsxs)("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:10,padding:"14px 18px",transition:"border-color .15s"},children:[(0,s.jsxs)("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:12,flexWrap:"wrap",marginBottom:8},children:[(0,s.jsx)("span",{style:{fontWeight:600,fontSize:"0.9rem",color:"var(--foreground)"},children:e.heading}),e.date&&(0,s.jsx)("span",{className:"font-display",style:{fontSize:"0.7rem",color:"var(--muted-foreground)",opacity:.7,flexShrink:0},children:e.date.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})})]}),e.body&&(0,s.jsx)("div",{dangerouslySetInnerHTML:{__html:function(e){let t=e.split("\n"),r=[],s=!1,n=()=>{s&&(r.push("</ul>"),s=!1)};for(let e of t){let t=e.trimEnd();if(!t){n(),r.push("<br/>");continue}if(/^### /.test(t)){n(),r.push(`<h3 style="font-size:0.8rem;font-weight:600;color:var(--muted-foreground);text-transform:uppercase;letter-spacing:.06em;margin:.9em 0 .3em">${i(t.slice(4))}</h3>`);continue}if(/^- /.test(t)||/^\* /.test(t)){s||(r.push('<ul style="margin:.3em 0;padding-left:1.2em;list-style:disc">'),s=!0),r.push(`<li style="margin:.15em 0;font-size:.82rem;color:var(--foreground)">${i(t.slice(2))}</li>`);continue}if(/^\d+\. /.test(t)){s||(r.push('<ol style="margin:.3em 0;padding-left:1.2em">'),s=!0),r.push(`<li style="margin:.15em 0;font-size:.82rem;color:var(--foreground)">${i(t.replace(/^\d+\. /,""))}</li>`);continue}n(),r.push(`<p style="margin:.25em 0;font-size:.82rem;line-height:1.6;color:var(--foreground)">${i(t)}</p>`)}return n(),r.join("")}(e.body)}}),e.tags.length>0&&(0,s.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:5,marginTop:10},children:e.tags.map(e=>{let t=function(e){let t=0;for(let r=0;r<e.length;r++)t=31*t+e.charCodeAt(r)&65535;return o[t%o.length]}(e);return(0,s.jsxs)("span",{className:"font-display",style:{fontSize:"0.68rem",padding:"1px 8px",borderRadius:999,background:t.bg,color:t.text},children:["#",e]},e)})})]})]},t))]})]})}},40430:(e,t,r)=>{"use strict";r.d(t,{default:()=>d});var s=r(95155),n=r(12115),a=r(12651),i=r(6296),o=r(35581);let l="mindos_update_in_progress";function d(){let[e,t]=(0,n.useState)(!1),[r,d]=(0,n.useState)(!1),c=(0,n.useRef)(void 0),{locale:u}=(0,o.Y)(),m="zh"===u,x=(0,n.useCallback)(()=>{c.current=setInterval(async()=>{try{if((await fetch("/api/health",{signal:AbortSignal.timeout(3e3)})).ok){clearInterval(c.current),c.current=void 0;try{let e=localStorage.getItem(l);if(e){let{originalVer:t}=JSON.parse(e),r=await fetch("/api/update-check",{signal:AbortSignal.timeout(5e3)}).then(e=>e.json());if(r.current&&r.current!==t){d(!0),localStorage.removeItem(l),localStorage.removeItem("mindos_update_latest"),localStorage.removeItem("mindos_update_dismissed"),setTimeout(()=>window.location.reload(),1500);return}}}catch{}localStorage.removeItem(l),window.location.reload()}}catch{}},3e3)},[]);return((0,n.useEffect)(()=>{let e=()=>{localStorage.getItem(l)&&(t(!0),c.current||x())};e();let r=()=>e();return window.addEventListener("mindos:update-started",r),window.addEventListener("storage",r),()=>{clearInterval(c.current),c.current=void 0,window.removeEventListener("mindos:update-started",r),window.removeEventListener("storage",r)}},[x]),e)?(0,s.jsxs)("div",{style:{position:"fixed",inset:0,zIndex:99999,background:"rgba(0,0,0,0.7)",backdropFilter:"blur(8px)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",fontFamily:"'IBM Plex Sans', system-ui, sans-serif"},children:[r?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(a.A,{size:32,style:{color:"var(--success)",marginBottom:12}}),(0,s.jsx)("div",{style:{color:"var(--foreground)",fontSize:18,fontWeight:600},children:m?"更新成功!":"Update Complete!"}),(0,s.jsx)("div",{style:{color:"var(--muted-foreground)",fontSize:13,marginTop:6},children:m?"正在刷新页面...":"Reloading..."})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(i.A,{size:32,style:{color:"var(--amber)",marginBottom:12,animation:"spin 1s linear infinite"}}),(0,s.jsx)("div",{style:{color:"var(--foreground)",fontSize:18,fontWeight:600},children:m?"MindOS 正在更新...":"MindOS is Updating..."}),(0,s.jsx)("div",{style:{color:"var(--muted-foreground)",fontSize:13,marginTop:6,textAlign:"center",maxWidth:300,lineHeight:1.5},children:m?"服务正在重启,请勿关闭此页面。完成后将自动刷新。":"The server is restarting. Please do not close this page. It will auto-reload when ready."})]}),(0,s.jsx)("style",{children:"@keyframes spin { to { transform: rotate(360deg) } }"})]}):null}},46838:(e,t,r)=>{"use strict";r.d(t,{$7:()=>i,MZ:()=>c,TS:()=>l,UG:()=>a,YB:()=>d,pl:()=>o});let s=[],n=new Set;function a(){try{let e=localStorage.getItem("mindos-disabled-renderers");n=new Set(e?JSON.parse(e):[])}catch{n=new Set}}function i(e,t){let r=s.find(t=>t.id===e);r?.core||(t?n.delete(e):n.add(e),localStorage.setItem("mindos-disabled-renderers",JSON.stringify([...n])))}function o(e){let t=s.find(t=>t.id===e);return!!t?.core||!n.has(e)}function l(e){s.find(t=>t.id===e.id)||s.push(e)}function d(e,t,r){if(r){let e=s.find(e=>e.id===r);return e&&o(e.id)?e:void 0}return s.find(r=>o(r.id)&&r.match({filePath:e,extension:t}))}function c(){return s.filter(e=>!e.appBuiltinFeature)}},48133:(e,t,r)=>{"use strict";r.r(t),r.d(t,{WorkflowYamlRenderer:()=>Q});var s=r(95155),n=r(12115),a=r(49387),i=r(20232),o=r(53961),l=r(13545),d=r(73620),c=r(42129),u=r(51914),m=r(6296),x=r(55243),p=r(12651),h=r(66088),f=r(9921),g=r(68459),b=r(1164),v=r(61878),y=r(33210),j=r(48368),w=r(38798),N=r(21362);function k({trigger:e,children:t,open:r,onClose:a}){let i=(0,n.useRef)(null);return(0,n.useEffect)(()=>{if(!r)return;let e=e=>{i.current&&!i.current.contains(e.target)&&a()};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[r,a]),(0,s.jsxs)("div",{ref:i,className:"relative",children:[e,r&&(0,s.jsx)("div",{className:"absolute top-full left-0 mt-1 w-full min-w-[220px] max-h-[260px] overflow-y-auto bg-card border border-border rounded-lg shadow-lg z-50",children:t})]})}let S=null,C=!1,A=[];function z({value:e,onChange:t}){let[r,a]=(0,n.useState)(!1),[i,o]=(0,n.useState)(""),[l,d]=(0,n.useState)(S??[]),[c,u]=(0,n.useState)("");(0,n.useEffect)(()=>{S?d(S):(A.push(d),C||(C=!0,fetch("/api/acp/registry").then(e=>e.json()).then(e=>{let t=(e.registry?.agents??[]).map(e=>({id:e.id,name:e.name||e.id}));S=t,A.forEach(e=>e(t)),A.length=0}).catch(()=>{S=[],A.forEach(e=>e([])),A.length=0})))},[]);let m=c?l.filter(e=>e.id.toLowerCase().includes(c.toLowerCase())||e.name.toLowerCase().includes(c.toLowerCase())):l,x=e=>{t(e),a(!1),u("")},p=e?l.find(t=>t.id===e)?.name||e:void 0;return(0,s.jsxs)(k,{open:r,onClose:()=>{a(!1),u("")},trigger:(0,s.jsxs)("button",{type:"button",onClick:()=>a(e=>!e),className:"w-full flex items-center justify-between px-2.5 py-1.5 text-xs rounded-md border border-border bg-background text-foreground hover:bg-muted transition-colors",children:[(0,s.jsx)("span",{className:e?"text-foreground truncate":"text-muted-foreground",children:p||"MindOS"}),(0,s.jsx)(h.A,{size:12,className:"text-muted-foreground shrink-0"})]}),children:[(0,s.jsx)("div",{className:"sticky top-0 bg-card border-b border-border px-2.5 py-1.5",children:(0,s.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-1 rounded border border-border bg-background",children:[(0,s.jsx)(v.A,{size:11,className:"text-muted-foreground shrink-0"}),(0,s.jsx)("input",{type:"text",value:c,onChange:e=>u(e.target.value),autoFocus:!0,placeholder:"Search agents...",className:"flex-1 text-xs bg-transparent text-foreground placeholder:text-muted-foreground focus:outline-none"})]})}),(0,s.jsxs)("button",{onClick:()=>x(void 0),className:`w-full text-left px-3 py-1.5 text-xs hover:bg-muted transition-colors ${!e?"text-[var(--amber)] font-medium":"text-foreground"}`,children:["MindOS ",(0,s.jsx)("span",{className:"text-muted-foreground/50 ml-1",children:"(default)"})]}),m.slice(0,30).map(t=>(0,s.jsxs)("button",{onClick:()=>x(t.id),className:`w-full text-left px-3 py-1.5 text-xs hover:bg-muted transition-colors ${e===t.id?"text-[var(--amber)] font-medium":"text-foreground"}`,children:[t.name," ",t.name!==t.id&&(0,s.jsxs)("span",{className:"text-muted-foreground/50 ml-1",children:["(",t.id,")"]})]},t.id)),0===l.length&&(0,s.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:"Loading..."}),l.length>0&&0===m.length&&!c&&(0,s.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:"No ACP agents found"}),(0,s.jsx)("div",{className:"border-t border-border px-2.5 py-1.5",children:(0,s.jsx)("input",{type:"text",value:i,onChange:e=>o(e.target.value),onKeyDown:e=>{"Enter"===e.key&&i.trim()&&(x(i.trim()),o(""))},placeholder:"Custom agent ID...",className:"w-full px-2 py-1 text-xs rounded border border-border bg-background text-foreground placeholder:text-muted-foreground focus:outline-none focus-visible:ring-1 focus-visible:ring-ring"})})]})}let E=[{group:"Anthropic",models:["claude-sonnet-4-6","claude-opus-4","claude-3.5-sonnet","claude-3.5-haiku"]},{group:"OpenAI",models:["gpt-4o","gpt-4o-mini","o3","o4-mini"]},{group:"Google",models:["gemini-2.5-pro","gemini-2.5-flash"]}];function $({value:e,onChange:t}){let[r,a]=(0,n.useState)(!1),[i,o]=(0,n.useState)(""),l=e=>{t(e),a(!1)};return(0,s.jsxs)(k,{open:r,onClose:()=>a(!1),trigger:(0,s.jsxs)("button",{type:"button",onClick:()=>a(e=>!e),className:"w-full flex items-center justify-between px-2.5 py-1.5 text-xs rounded-md border border-border bg-background text-foreground hover:bg-muted transition-colors",children:[(0,s.jsx)("span",{className:e?"text-foreground truncate":"text-muted-foreground",children:e||"Default model"}),e?(0,s.jsx)(y.A,{size:12,className:"text-muted-foreground shrink-0 hover:text-foreground cursor-pointer",onClick:e=>{e.stopPropagation(),l(void 0)}}):(0,s.jsx)(h.A,{size:12,className:"text-muted-foreground shrink-0"})]}),children:[(0,s.jsx)("button",{onClick:()=>l(void 0),className:`w-full text-left px-3 py-1.5 text-xs hover:bg-muted transition-colors ${!e?"text-[var(--amber)] font-medium":"text-muted-foreground"}`,children:"(default)"}),E.map(t=>(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"px-3 py-1 text-2xs font-semibold text-muted-foreground/60 uppercase tracking-wide bg-muted/30",children:t.group}),t.models.map(t=>(0,s.jsx)("button",{onClick:()=>l(t),className:`w-full text-left px-3 py-1.5 text-xs hover:bg-muted transition-colors ${e===t?"text-[var(--amber)] font-medium":"text-foreground"}`,children:t},t))]},t.group)),(0,s.jsx)("div",{className:"border-t border-border px-2.5 py-1.5",children:(0,s.jsx)("input",{type:"text",value:i,onChange:e=>o(e.target.value),onKeyDown:e=>{"Enter"===e.key&&i.trim()&&(l(i.trim()),o(""))},placeholder:"Custom model ID...",className:"w-full px-2 py-1 text-xs rounded border border-border bg-background text-foreground placeholder:text-muted-foreground focus:outline-none focus-visible:ring-1 focus-visible:ring-ring"})})]})}let T=null,D=!1,R=[];function P({value:e,onChange:t}){let[r,a]=(0,n.useState)(!1),[i,o]=(0,n.useState)(T??[]),[l,d]=(0,n.useState)("");(0,n.useEffect)(()=>{T?o(T):(R.push(o),D||(D=!0,fetch("/api/skills").then(e=>e.json()).then(e=>{T=(e.skills??[]).map(e=>({name:e.name,description:e.description})),R.forEach(e=>e(T)),R.length=0}).catch(()=>{T=[],R.forEach(e=>e([])),R.length=0})))},[]);let c=l?i.filter(e=>e.name.toLowerCase().includes(l.toLowerCase())):i;return(0,s.jsxs)("div",{children:[e.length>0&&(0,s.jsx)("div",{className:"flex flex-wrap gap-1 mb-1.5",children:e.map(r=>(0,s.jsxs)("span",{className:"inline-flex items-center gap-1 pl-2 pr-1 py-0.5 rounded-md text-2xs bg-[var(--amber)]/10 text-[var(--amber)] border border-[var(--amber)]/20",children:[r,(0,s.jsx)("button",{onClick:()=>t(e.filter(e=>e!==r)),className:"p-0.5 rounded hover:bg-[var(--amber)]/20 transition-colors",children:(0,s.jsx)(y.A,{size:10})})]},r))}),(0,s.jsxs)(k,{open:r,onClose:()=>{a(!1),d("")},trigger:(0,s.jsxs)("button",{type:"button",onClick:()=>a(e=>!e),className:"w-full flex items-center justify-between px-2.5 py-1.5 text-xs rounded-md border border-border bg-background text-foreground hover:bg-muted transition-colors",children:[(0,s.jsx)("span",{className:"text-muted-foreground",children:0===e.length?"Add skills...":`${e.length} selected`}),(0,s.jsx)(h.A,{size:12,className:"text-muted-foreground"})]}),children:[(0,s.jsx)("div",{className:"sticky top-0 bg-card border-b border-border px-2.5 py-1.5",children:(0,s.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-1 rounded border border-border bg-background",children:[(0,s.jsx)(v.A,{size:11,className:"text-muted-foreground shrink-0"}),(0,s.jsx)("input",{type:"text",value:l,onChange:e=>d(e.target.value),autoFocus:!0,placeholder:"Search skills...",className:"flex-1 text-xs bg-transparent text-foreground placeholder:text-muted-foreground focus:outline-none"})]})}),c.slice(0,60).map(r=>{let n=e.includes(r.name);return(0,s.jsxs)("button",{onClick:()=>{var s;return s=r.name,void(e.includes(s)?t(e.filter(e=>e!==s)):t([...e,s]))},className:`w-full text-left px-3 py-1.5 text-xs hover:bg-muted transition-colors flex items-center gap-2 ${n?"bg-[var(--amber)]/5":""}`,children:[(0,s.jsx)("span",{className:`w-3.5 h-3.5 rounded border flex items-center justify-center shrink-0 transition-colors ${n?"bg-[var(--amber)] border-[var(--amber)] text-[var(--amber-foreground)]":"border-border"}`,children:n&&(0,s.jsx)("span",{className:"text-[9px]",children:"✓"})}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("span",{className:"block truncate",children:r.name}),r.description&&(0,s.jsx)("span",{className:"block text-2xs text-muted-foreground truncate mt-0.5",children:r.description})]})]},r.name)}),0===i.length&&(0,s.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:"Loading..."}),i.length>0&&0===c.length&&(0,s.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:"No skills found"})]})]})}function M({value:e,onChange:t}){let[r,a]=(0,n.useState)(!1),[i,o]=(0,n.useState)(""),l=(0,n.useCallback)(r=>{let s=r.trim();s&&!e.includes(s)&&t([...e,s])},[e,t]),d=(0,n.useCallback)(e=>{e.preventDefault(),a(!1);let t=e.dataTransfer.getData("text/mindos-path");if(t)return void l(t);let r=e.dataTransfer.getData("text/plain");r&&l(r)},[l]),u=(0,n.useCallback)(e=>{e.preventDefault(),e.dataTransfer.dropEffect="copy",a(!0)},[]),m=(0,n.useCallback)(()=>a(!1),[]);return(0,s.jsxs)("div",{children:[e.length>0&&(0,s.jsx)("div",{className:"flex flex-col gap-1 mb-1.5",children:e.map(r=>(0,s.jsxs)("div",{className:"flex items-center gap-1.5 pl-2 pr-1 py-1 rounded-md text-2xs bg-muted/60 border border-border group",children:[(0,s.jsx)(j.A,{size:11,className:"text-muted-foreground shrink-0"}),(0,s.jsx)("span",{className:"text-foreground truncate flex-1",title:r,children:r}),(0,s.jsx)("button",{onClick:()=>t(e.filter(e=>e!==r)),className:"p-0.5 rounded hover:bg-[var(--error)]/10 text-muted-foreground hover:text-[var(--error)] opacity-0 group-hover:opacity-100 transition-all",children:(0,s.jsx)(y.A,{size:10})})]},r))}),(0,s.jsxs)("div",{onDrop:d,onDragOver:u,onDragLeave:m,className:`flex items-center gap-2 px-3 py-2.5 rounded-lg border-2 border-dashed transition-colors ${r?"border-[var(--amber)] bg-[var(--amber)]/5":"border-border hover:border-muted-foreground/30"}`,children:[(0,s.jsx)(c.A,{size:14,className:`shrink-0 ${r?"text-[var(--amber)]":"text-muted-foreground/40"}`}),(0,s.jsx)("span",{className:"text-2xs text-muted-foreground",children:"Drag files here from the sidebar"})]}),(0,s.jsx)("div",{className:"mt-1.5",children:(0,s.jsx)("input",{type:"text",value:i,onChange:e=>o(e.target.value),onKeyDown:e=>{"Enter"===e.key&&i.trim()&&(l(i.trim()),o(""))},placeholder:"Or type a file path...",className:"w-full px-2.5 py-1 text-2xs rounded-md border border-border bg-background text-foreground placeholder:text-muted-foreground focus:outline-none focus-visible:ring-1 focus-visible:ring-ring"})})]})}async function F(e){try{let t=await fetch("/api/setup/ls",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e||"~"})});if(!t.ok)return[];return(await t.json()).dirs??[]}catch{return[]}}function I({value:e,onChange:t}){let[r,a]=(0,n.useState)([]),[i,o]=(0,n.useState)(!1),[l,d]=(0,n.useState)(-1),u=(0,n.useRef)(!1),m=(0,n.useRef)(null),[x,p]=(0,n.useState)(!1),[h,f]=(0,n.useState)(e||"~"),[g,b]=(0,n.useState)([]),[v,y]=(0,n.useState)(!1);(0,n.useEffect)(()=>{if(u.current){u.current=!1;return}if(!e.trim()){a([]),o(!1);return}let t=setTimeout(async()=>{let t=function(e){let t=e.trim();if(!t)return"";if(t.endsWith("/")||t.endsWith("\\"))return t;let r=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return r>=0?t.slice(0,r+1):""}(e)||"~",r=await F(t);if(!r.length){a([]),o(!1);return}let s=t.includes("\\")?"\\":"/",n=t.endsWith("/")||t.endsWith("\\")?t:t+s,i=r.map(e=>n+e),l=e.endsWith("/")||e.endsWith("\\")?i:i.filter(t=>t.startsWith(e.trim()));a(l.slice(0,15)),o(l.length>0),d(-1)},300);return()=>clearTimeout(t)},[e]);let j=()=>{a([]),o(!1),d(-1)},S=e=>{u.current=!0,t(e),j(),m.current?.focus()},C=(0,n.useCallback)(async e=>{y(!0),b(await F(e)),y(!1)},[]);return(0,n.useEffect)(()=>{x&&C(h)},[x,h,C]),(0,s.jsxs)("div",{className:"relative flex gap-1.5",children:[(0,s.jsxs)("div",{className:"relative flex-1",children:[(0,s.jsx)("input",{ref:m,type:"text",value:e,onChange:e=>{t(e.target.value),o(!0)},onKeyDown:e=>{i&&0!==r.length&&("ArrowDown"===e.key?(e.preventDefault(),d(e=>Math.min(e+1,r.length-1))):"ArrowUp"===e.key?(e.preventDefault(),d(e=>Math.max(e-1,-1))):"Enter"===e.key&&l>=0?(e.preventDefault(),S(r[l])):"Escape"===e.key?j():"Tab"===e.key&&l>=0&&(e.preventDefault(),S(r[l])))},onBlur:()=>setTimeout(j,150),onFocus:()=>r.length>0&&o(!0),placeholder:"~/projects/my-app",className:"w-full px-2.5 py-1.5 text-xs rounded-lg border border-border bg-background text-foreground font-mono placeholder:text-muted-foreground focus:outline-none focus-visible:ring-1 focus-visible:ring-ring"}),i&&r.length>0&&(0,s.jsx)("div",{role:"listbox",className:"absolute z-50 left-0 right-0 top-full mt-1 rounded-lg border border-border bg-card shadow-lg overflow-auto max-h-[200px]",children:r.map((e,t)=>(0,s.jsxs)("button",{type:"button",role:"option","aria-selected":t===l,onMouseDown:()=>S(e),className:`w-full text-left px-3 py-1.5 text-xs font-mono transition-colors flex items-center gap-1.5 ${t===l?"bg-muted text-foreground":"text-foreground hover:bg-muted/50"}`,children:[(0,s.jsx)(w.A,{size:11,className:"text-[var(--amber)] shrink-0"}),(0,s.jsx)("span",{className:"truncate",children:e})]},e))})]}),(0,s.jsxs)(k,{open:x,onClose:()=>p(!1),trigger:(0,s.jsx)("button",{type:"button",onClick:()=>{f(e||"~"),p(e=>!e)},className:"px-2 py-1.5 rounded-lg border border-border bg-background text-muted-foreground hover:bg-muted hover:text-foreground transition-colors",title:"Browse directories",children:(0,s.jsx)(c.A,{size:13})}),children:[(0,s.jsxs)("div",{className:"sticky top-0 bg-card border-b border-border px-2.5 py-2 flex items-center gap-1.5",children:[(0,s.jsx)("span",{className:"text-2xs font-mono text-muted-foreground truncate flex-1",title:h,children:h}),(0,s.jsx)("button",{onClick:()=>{t(h),p(!1)},className:"px-2 py-0.5 text-2xs rounded font-medium bg-[var(--amber)] text-[var(--amber-foreground)] shrink-0",children:"Select"})]}),"~"!==h&&(0,s.jsxs)("button",{onClick:()=>{let e=h.split("/");e.length<=1||(e.pop(),f(e.join("/")||"~"))},className:"w-full text-left px-3 py-1.5 text-xs hover:bg-muted transition-colors text-muted-foreground flex items-center gap-1.5",children:[(0,s.jsx)(w.A,{size:12,className:"shrink-0"})," .."]}),v&&(0,s.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:"Loading..."}),!v&&0===g.length&&(0,s.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:"No subdirectories"}),g.map(e=>(0,s.jsxs)("button",{onClick:()=>{f("~"===h?`~/${e}`:`${h.replace(/\/+$/,"")}/${e}`)},className:"w-full text-left px-3 py-1.5 text-xs hover:bg-muted transition-colors text-foreground flex items-center gap-1.5",children:[(0,s.jsx)(w.A,{size:12,className:"text-[var(--amber)] shrink-0"}),(0,s.jsx)("span",{className:"truncate flex-1",children:e}),(0,s.jsx)(N.A,{size:10,className:"text-muted-foreground/40 shrink-0"})]},e))]})]})}function L({step:e,index:t,onChange:r,onDelete:a,onMoveUp:i,onMoveDown:o}){let[l,d]=(0,n.useState)(!e.prompt),[c,u]=(0,n.useState)(!1),m=t=>r({...e,...t}),x=e.skills?.length?e.skills:e.skill?[e.skill]:[],p=!!(e.agent||e.model||x.length||e.context?.length||e.description||e.timeout);return l?(0,s.jsxs)("div",{className:"rounded-lg border border-[var(--amber)]/20 bg-card overflow-hidden shadow-sm",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-muted/20",children:[(0,s.jsx)("span",{className:`text-xs font-medium flex-1 truncate ${e.name?"text-foreground":"text-muted-foreground/50 italic"}`,children:e.name||"Untitled step"}),(0,s.jsxs)("div",{className:"flex items-center gap-0.5",children:[i&&(0,s.jsx)("button",{onClick:i,className:"p-1 rounded hover:bg-muted text-muted-foreground/50 hover:text-foreground transition-colors",title:"Move up",children:(0,s.jsx)(f.A,{size:12})}),o&&(0,s.jsx)("button",{onClick:o,className:"p-1 rounded hover:bg-muted text-muted-foreground/50 hover:text-foreground transition-colors",title:"Move down",children:(0,s.jsx)(h.A,{size:12})}),(0,s.jsx)("button",{onClick:a,className:"p-1 rounded hover:bg-[var(--error)]/10 text-muted-foreground/50 hover:text-[var(--error)] transition-colors",title:"Delete",children:(0,s.jsx)(g.A,{size:11})}),(0,s.jsx)("button",{onClick:()=>d(!1),className:"p-1 rounded hover:bg-muted text-muted-foreground/50 transition-colors",title:"Collapse",children:(0,s.jsx)(f.A,{size:12})})]})]}),(0,s.jsxs)("div",{className:"px-3 py-3 space-y-3",children:[(0,s.jsx)("input",{type:"text",value:e.name,onChange:e=>m({name:e.target.value}),placeholder:"Step name...",autoFocus:!e.name,className:"w-full text-sm font-medium bg-transparent text-foreground placeholder:text-muted-foreground/30 focus:outline-none border-none p-0"}),(0,s.jsx)("textarea",{value:e.prompt,onChange:e=>m({prompt:e.target.value}),placeholder:"What should the AI do?",rows:3,className:"w-full px-3 py-2.5 text-sm rounded-lg border border-border bg-background text-foreground placeholder:text-muted-foreground/40 focus:outline-none focus-visible:ring-1 focus-visible:ring-ring resize-y leading-relaxed"}),(0,s.jsxs)("div",{className:`grid ${e.agent?"grid-cols-2":"grid-cols-1"} gap-2`,children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-2xs text-muted-foreground/60 mb-1",children:"Agent"}),(0,s.jsx)(z,{value:e.agent,onChange:t=>m({agent:t,model:t?e.model:void 0})})]}),e.agent&&(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-2xs text-muted-foreground/60 mb-1",children:"Model"}),(0,s.jsx)($,{value:e.model,onChange:e=>m({model:e})})]})]}),(0,s.jsxs)("button",{onClick:()=>u(e=>!e),className:`flex items-center gap-1.5 text-2xs transition-colors ${c||p?"text-muted-foreground":"text-muted-foreground/40 hover:text-muted-foreground"}`,children:[(0,s.jsx)(b.A,{size:11}),c?"Less options":"More options",!c&&p&&(0,s.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-[var(--amber)]"})]}),c&&(0,s.jsxs)("div",{className:"space-y-3 pt-1",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-2xs text-muted-foreground/60 mb-1",children:"Skills"}),(0,s.jsx)(P,{value:x,onChange:e=>m({skills:e,skill:void 0})})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-2xs text-muted-foreground/60 mb-1",children:"Context files"}),(0,s.jsx)(M,{value:e.context??[],onChange:e=>m({context:e.length?e:void 0})})]}),(0,s.jsxs)("div",{className:"grid grid-cols-[1fr,auto] gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-2xs text-muted-foreground/60 mb-1",children:"Description"}),(0,s.jsx)("input",{type:"text",value:e.description||"",onChange:e=>m({description:e.target.value||void 0}),placeholder:"Optional note...",className:"w-full px-2.5 py-1.5 text-xs rounded-md border border-border bg-background text-foreground placeholder:text-muted-foreground/30 focus:outline-none focus-visible:ring-1 focus-visible:ring-ring"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-2xs text-muted-foreground/60 mb-1",children:"Timeout"}),(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[(0,s.jsx)("input",{type:"number",min:0,value:e.timeout||"",onChange:e=>m({timeout:e.target.value?Number(e.target.value):void 0}),placeholder:"120",className:"w-16 px-2 py-1.5 text-xs rounded-md border border-border bg-background text-foreground placeholder:text-muted-foreground/30 focus:outline-none focus-visible:ring-1 focus-visible:ring-ring"}),(0,s.jsx)("span",{className:"text-2xs text-muted-foreground/40",children:"s"})]})]})]})]})]})]}):(0,s.jsxs)("div",{className:"group flex items-start gap-2 px-3 py-2 rounded-lg hover:bg-muted/40 transition-colors cursor-pointer -ml-1",onClick:()=>d(!0),children:[(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("span",{className:`text-sm leading-tight block ${e.name?"text-foreground font-medium":"text-muted-foreground/50 italic"}`,children:e.name||"Untitled step"}),p&&(0,s.jsxs)("div",{className:"flex items-center gap-1 mt-1 flex-wrap",children:[e.agent&&(0,s.jsx)("span",{className:"text-2xs px-1.5 py-0.5 rounded-full bg-muted text-muted-foreground",children:e.agent}),x.slice(0,2).map(e=>(0,s.jsx)("span",{className:"text-2xs px-1.5 py-0.5 rounded-full bg-[var(--amber)]/8 text-[var(--amber)]",children:e},e)),x.length>2&&(0,s.jsxs)("span",{className:"text-2xs text-muted-foreground/50",children:["+",x.length-2]}),e.context?.length?(0,s.jsxs)("span",{className:"text-2xs text-muted-foreground/50",children:[e.context.length," files"]}):null]}),e.prompt&&(0,s.jsx)("p",{className:"text-2xs text-muted-foreground/50 mt-1 line-clamp-1 leading-relaxed",children:e.prompt})]}),(0,s.jsx)(h.A,{size:12,className:"text-muted-foreground/30 mt-1 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity"})]})}function O({workflow:e,filePath:t,onChange:r,onSaved:a}){let[i,l]=(0,n.useState)(!1),[h,f]=(0,n.useState)(""),[g,b]=(0,n.useState)(!1);(0,n.useEffect)(()=>{if(!g)return;let e=setTimeout(()=>b(!1),3e3);return()=>clearTimeout(e)},[g]);let v=t=>r({...e,...t}),y=(0,n.useCallback)((t,s)=>{let n=[...e.steps];n[t]=s,r({...e,steps:n})},[e,r]),j=(0,n.useCallback)(t=>{let s=e.steps[t];(!(s.name||s.prompt)||window.confirm(`Delete step "${s.name||"Untitled"}"?`))&&r({...e,steps:e.steps.filter((e,r)=>r!==t)})},[e,r]),w=(0,n.useCallback)(()=>{let t=e.steps.map(e=>e.id),s=e.steps.length+1,n={id:function(e,t){let r=e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"step",s=r,n=2;for(;t.includes(s);)s=`${r}-${n}`,n++;return s}(`step-${s}`,t),name:`Step ${s}`,prompt:""};r({...e,steps:[...e.steps,n]})},[e,r]),N=(0,n.useCallback)((t,s)=>{if(s<0||s>=e.steps.length)return;let n=[...e.steps],[a]=n.splice(t,1);n.splice(s,0,a),r({...e,steps:n})},[e,r]),k=async()=>{l(!0),f(""),b(!1);try{let r,s=(r={title:e.title},e.description&&(r.description=e.description),e.workDir&&(r.workDir=e.workDir),e.skills?.length&&(r.skills=e.skills),e.tools?.length&&(r.tools=e.tools),r.steps=e.steps.map(e=>{let t={id:e.id,name:e.name};return e.description&&(t.description=e.description),e.agent&&(t.agent=e.agent),e.model&&(t.model=e.model),e.skill&&(t.skill=e.skill),e.skills?.length&&(t.skills=e.skills),e.tools?.length&&(t.tools=e.tools),e.context?.length&&(t.context=e.context),t.prompt=e.prompt,e.timeout&&(t.timeout=e.timeout),t}),d.Ay.dump(r,{lineWidth:-1,noRefs:!0,quotingType:'"',forceQuotes:!1})),n=await fetch("/api/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t,op:"save_file",content:s})});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.error||`Save failed (HTTP ${n.status})`)}b(!0),a?.()}catch(e){f(e instanceof Error?e.message:"Save failed")}finally{l(!1)}};(0,n.useEffect)(()=>{let t=t=>{(t.metaKey||t.ctrlKey)&&"s"===t.key&&(t.preventDefault(),!i&&e.title.trim()&&e.steps.length>0&&k())};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)});let S=!i&&!!e.title.trim()&&e.steps.length>0;return(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"space-y-3 mb-8",children:[(0,s.jsx)("input",{type:"text",value:e.title,onChange:e=>v({title:e.target.value}),placeholder:"Flow title...",className:"w-full text-lg font-semibold bg-transparent text-foreground placeholder:text-muted-foreground/40 focus:outline-none border-none p-0 leading-tight"}),(0,s.jsx)("input",{type:"text",value:e.description||"",onChange:e=>v({description:e.target.value||void 0}),placeholder:"Add a description...",className:"w-full text-sm bg-transparent text-muted-foreground placeholder:text-muted-foreground/30 focus:outline-none border-none p-0"}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(c.A,{size:12,className:"text-muted-foreground/40 shrink-0"}),(0,s.jsx)(I,{value:e.workDir||"",onChange:e=>v({workDir:e||void 0})})]})]}),e.steps.length>0?(0,s.jsxs)("div",{className:"relative",children:[e.steps.length>1&&(0,s.jsx)("div",{className:"absolute left-[19px] top-6 bottom-16 w-px bg-border"}),(0,s.jsx)("div",{className:"flex flex-col gap-3 mb-5 relative",children:e.steps.map((t,r)=>(0,s.jsxs)("div",{className:"relative pl-11",children:[(0,s.jsx)("div",{className:"absolute left-[7px] top-3 w-[22px] h-[22px] rounded-full border-2 border-border bg-background z-10 flex items-center justify-center",children:(0,s.jsx)("span",{className:"text-[10px] font-bold text-muted-foreground/60",children:r+1})}),(0,s.jsx)(L,{step:t,index:r,onChange:e=>y(r,e),onDelete:()=>j(r),onMoveUp:r>0?()=>N(r,r-1):void 0,onMoveDown:r<e.steps.length-1?()=>N(r,r+1):void 0})]},t.id))}),(0,s.jsxs)("div",{className:"relative pl-11",children:[(0,s.jsx)("div",{className:"absolute left-[7px] top-2.5 w-[22px] h-[22px] rounded-full border-2 border-dashed border-border bg-background z-10 flex items-center justify-center",children:(0,s.jsx)(u.A,{size:9,className:"text-muted-foreground/40"})}),(0,s.jsx)("button",{onClick:w,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-muted-foreground/60 hover:text-muted-foreground hover:bg-muted/40 transition-colors",children:"Add step..."})]})]}):(0,s.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[(0,s.jsx)("div",{className:"w-12 h-12 rounded-2xl bg-[var(--amber)]/8 flex items-center justify-center mb-4",children:(0,s.jsx)(o.A,{size:22,className:"text-[var(--amber)]/60"})}),(0,s.jsx)("p",{className:"text-sm font-medium text-foreground mb-1",children:"Build your flow"}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground/60 mb-5 max-w-[240px]",children:"Each step is a task for an AI agent. Chain them together to automate complex workflows."}),(0,s.jsxs)("button",{onClick:w,className:"inline-flex items-center gap-1.5 px-4 py-2 rounded-lg text-xs font-medium bg-[var(--amber)] text-[var(--amber-foreground)] hover:opacity-90 transition-opacity",children:[(0,s.jsx)(u.A,{size:12}),"Add first step"]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-3 mt-8 pt-4 border-t border-border/50",children:[(0,s.jsxs)("button",{onClick:k,disabled:!S,title:e.title.trim()?0===e.steps.length?"Add at least one step":void 0:"Title is required",className:`flex items-center gap-1.5 px-4 py-2 rounded-lg text-xs font-medium transition-all disabled:opacity-40 disabled:cursor-not-allowed ${S?"bg-[var(--amber)] text-[var(--amber-foreground)] hover:opacity-90":"bg-muted text-muted-foreground"}`,children:[i?(0,s.jsx)(m.A,{size:12,className:"animate-spin"}):(0,s.jsx)(x.A,{size:12}),i?"Saving...":"Save"]}),h&&(0,s.jsx)("span",{className:"text-xs text-[var(--error)]",children:h}),g&&!h&&(0,s.jsxs)("span",{className:"flex items-center gap-1 text-2xs text-[var(--success)]",children:[(0,s.jsx)(p.A,{size:11}),"Saved"]}),(0,s.jsx)("kbd",{className:"text-2xs text-muted-foreground/30 ml-auto font-mono",children:"Ctrl+S"})]})]})}var W=r(30125),B=r(62791),U=r(86901),_=r(21628),H=r(9199);let X=new Map;async function K(e,t){if(X.has(e))return X.get(e);try{let r=await fetch("/api/skills",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"read",name:e}),signal:t});if(!r.ok)return X.set(e,null),null;let s=(await r.json()).content;return X.set(e,s??null),s??null}catch{return null}}async function Y(e,t){try{let r=await fetch(`/api/acp/registry?agent=${encodeURIComponent(e)}`,{signal:t});if(!r.ok)return null;let s=await r.json();if(s.agent?.id)return{id:s.agent.id,name:s.agent.name||e};return null}catch{return null}}async function J(e,t,r,s,n){let a=function(e,t){let r=[];if(e.skills?.length)for(let t of e.skills)r.includes(t)||r.push(t);else e.skill&&r.push(e.skill);for(let e of t.skills??[])r.includes(e)||r.push(e);return r}(e,t),i=new Map;if(a.length>0)for(let[e,t]of(await Promise.all(a.map(async e=>{let t=await K(e,n);return[e,t]}))))t&&i.set(e,t);let o=null;e.agent&&(o=await Y(e.agent,n));let l={messages:[{role:"user",content:function(e,t,r){let s=t.steps.map((e,t)=>`${t+1}. ${e.name}`).join("\n"),n=e.skills?.length?e.skills[0]:e.skill,a="";if(r.size>0){let e=[];for(let[t,s]of r){let r=t===n;e.push(`### ${r?"[Primary] ":""}Skill: ${t}
|
|
22
22
|
|
|
23
23
|
${s}`)}a=`
|
|
24
24
|
|
|
@@ -40,7 +40,7 @@ Execute concisely. Provide:
|
|
|
40
40
|
2. Any decisions made
|
|
41
41
|
3. What the next step should watch out for
|
|
42
42
|
|
|
43
|
-
Be specific and actionable. Format in Markdown.`}(e,t,i)}],currentFile:r};o&&(l.selectedAcpAgent=o);let d=await fetch("/api/ask",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l),signal:n});if(!d.ok)throw Error(`Request failed (HTTP ${d.status})`);if(!d.body)throw Error("No response body");let c=d.body.getReader(),u=new TextDecoder,m="";for(;;){let{done:e,value:t}=await c.read();if(e)break;for(let e of u.decode(t,{stream:!0}).split("\n")){let t=e.match(/^data:(.+)$/);if(t){try{let e=JSON.parse(t[1]);if("text_delta"===e.type&&"string"==typeof e.delta)m+=e.delta,s(m);else if("thinking_delta"===e.type&&"string"==typeof e.delta)m+=e.delta,s(m);else if("error"===e.type&&e.message)throw Error(e.message)}catch{let t=e.match(/^0:"((?:[^"\\]|\\.)*)"$/);t&&s(m+=t[1].replace(/\\n/g,"\n").replace(/\\"/g,'"').replace(/\\\\/g,"\\"))}continue}let r=e.match(/^0:"((?:[^"\\]|\\.)*)"$/);r&&s(m+=r[1].replace(/\\n/g,"\n").replace(/\\"/g,'"').replace(/\\\\/g,"\\"))}}}function V(e){return e.steps.map((e,t)=>({...e,index:t,status:"pending",output:"",error:void 0}))}function q({status:e,index:t}){let r="w-[26px] h-[26px] rounded-full flex items-center justify-center shrink-0 transition-all";return"running"===e?(0,s.jsx)("div",{className:`${r} bg-[var(--amber)]/15 ring-2 ring-[var(--amber)]/30`,children:(0,s.jsx)(m.A,{size:12,className:"text-[var(--amber)] animate-spin"})}):"done"===e?(0,s.jsx)("div",{className:`${r} bg-[var(--success)]/15`,children:(0,s.jsx)(p.A,{size:13,className:"text-[var(--success)]"})}):"error"===e?(0,s.jsx)("div",{className:`${r} bg-[var(--error)]/15`,children:(0,s.jsx)(l.A,{size:13,className:"text-[var(--error)]"})}):"skipped"===e?(0,s.jsx)("div",{className:`${r} bg-muted/50`,children:(0,s.jsx)(W.A,{size:11,className:"text-muted-foreground/40"})}):(0,s.jsx)("div",{className:`${r} border-2 border-border bg-background`,children:(0,s.jsx)("span",{className:"text-[11px] font-bold text-muted-foreground/50",children:t+1})})}function X({step:e,canRun:t,onRun:r,onSkip:a,onCancel:o}){let[d,c]=(0,n.useState)(!1),u=!!(e.output||e.error),m=e.skills?.length?e.skills:e.skill?[e.skill]:[];return"running"===e.status||e.status,(0,s.jsx)("div",{className:`transition-opacity ${"skipped"===e.status?"opacity-50":""}`,children:(0,s.jsxs)("div",{className:"flex items-start gap-3",children:[(0,s.jsx)(q,{status:e.status,index:e.index}),(0,s.jsxs)("div",{className:"flex-1 min-w-0 pt-0.5",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 justify-between",children:[(0,s.jsx)("span",{className:`text-sm font-medium truncate ${"done"===e.status?"text-foreground":"running"===e.status?"text-[var(--amber)]":"error"===e.status?"text-[var(--error)]":"text-foreground/70"}`,children:e.name}),(0,s.jsxs)("div",{className:"flex items-center gap-1.5 shrink-0",children:[null!=e.durationMs&&("done"===e.status||"error"===e.status)&&(0,s.jsx)("span",{className:"text-2xs text-muted-foreground/40 font-mono",children:function(e){if(e<1e3)return`${e}ms`;let t=Math.round(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}(e.durationMs)}),"pending"===e.status&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("button",{onClick:r,disabled:!t,className:"flex items-center gap-1 px-2 py-0.5 rounded-md text-2xs font-medium transition-all disabled:opacity-30 bg-[var(--amber)] text-[var(--amber-foreground)]",children:[(0,s.jsx)(i.A,{size:9})," Run"]}),(0,s.jsx)("button",{onClick:a,className:"px-1.5 py-0.5 rounded-md text-2xs text-muted-foreground/50 hover:text-muted-foreground hover:bg-muted transition-colors",children:"Skip"})]}),"running"===e.status&&(0,s.jsxs)("button",{onClick:o,className:"flex items-center gap-1 px-2 py-0.5 rounded-md text-2xs text-[var(--error)]/70 hover:text-[var(--error)] hover:bg-[var(--error)]/10 transition-colors",children:[(0,s.jsx)(B.A,{size:9})," Stop"]}),u&&"running"!==e.status&&(0,s.jsx)("button",{onClick:()=>c(e=>!e),className:"p-0.5 rounded text-muted-foreground/30 hover:text-muted-foreground transition-colors",children:(0,s.jsx)(f.A,{size:12,className:`transition-transform ${d?"rotate-180":""}`})})]})]}),(e.agent||m.length>0)&&(0,s.jsxs)("div",{className:"flex gap-1 mt-0.5 flex-wrap",children:[e.agent&&(0,s.jsx)("span",{className:"text-2xs text-muted-foreground/50",children:e.agent}),e.agent&&m.length>0&&(0,s.jsx)("span",{className:"text-2xs text-muted-foreground/20",children:"/"}),m.map(e=>(0,s.jsx)("span",{className:"text-2xs text-[var(--amber)]/60",children:e},e))]}),(d||"running"===e.status)&&u&&(0,s.jsxs)("div",{className:"mt-2 rounded-lg overflow-hidden border border-border/50",children:[e.error&&(0,s.jsxs)("div",{className:"px-3 py-2.5 bg-[var(--error)]/5",children:[(0,s.jsxs)("div",{className:"flex items-center gap-1.5 mb-1",children:[(0,s.jsx)(l.A,{size:10,className:"text-[var(--error)]"}),(0,s.jsx)("span",{className:"text-2xs font-medium text-[var(--error)]",children:"Error"})]}),(0,s.jsx)("div",{className:"text-xs text-[var(--error)]/80 whitespace-pre-wrap break-words leading-relaxed",children:e.error})]}),e.output&&(0,s.jsxs)("div",{className:"px-3 py-2.5 bg-muted/20",children:[(0,s.jsxs)("div",{className:"flex items-center gap-1.5 mb-1.5",children:[(0,s.jsx)(U.A,{size:10,className:"text-[var(--amber)]"}),(0,s.jsx)("span",{className:"text-2xs text-muted-foreground/50 uppercase tracking-wider font-medium",children:"Output"}),"running"===e.status&&(0,s.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-[var(--amber)] animate-pulse"})]}),(0,s.jsx)("div",{className:"text-xs leading-relaxed text-foreground/80 whitespace-pre-wrap break-words",children:e.output})]})]})]})]})})}function Z({workflow:e,filePath:t}){let[r,a]=(0,n.useState)(()=>V(e)),[i,o]=(0,n.useState)(!1),d=(0,n.useRef)(null);(0,n.useEffect)(()=>{a(V(e)),o(!1)},[e]);let u=(0,n.useCallback)(()=>{d.current?.abort(),d.current=null,o(!1),a(e=>e.map(e=>"running"===e.status?{...e,status:"error",error:"Cancelled"}:e))},[]),x=(0,n.useCallback)(async r=>{if(i)return;d.current?.abort();let s=new AbortController;d.current=s,o(!0);let n=Date.now();a(e=>e.map((e,t)=>t===r?{...e,status:"running",output:"",error:void 0,startedAt:new Date}:e));try{let i={...e.steps[r],index:r,status:"running",output:""};await G(i,e,t,e=>a(t=>t.map((t,s)=>s===r?{...t,output:e}:t)),s.signal);let o=Date.now()-n;a(e=>e.map((e,t)=>t===r?{...e,status:"done",completedAt:new Date,durationMs:o}:e))}catch(t){if(t instanceof Error&&"AbortError"===t.name)return;let e=Date.now()-n;a(s=>s.map((s,n)=>n===r?{...s,status:"error",error:t instanceof Error?t.message:String(t),durationMs:e}:s))}finally{o(!1)}},[i,e,t]),f=(0,n.useCallback)(e=>{a(t=>t.map((t,r)=>r===e?{...t,status:"skipped"}:t))},[]),h=(0,n.useCallback)(()=>{d.current?.abort(),d.current=null,o(!1),K.clear(),a(V(e))},[e]),g=r.filter(e=>"done"===e.status).length,b=r.length>0?Math.round(g/r.length*100):0,v=g===r.length&&r.length>0,y=r.findIndex(e=>"pending"===e.status),j=r.some(e=>"error"===e.status);return(0,s.jsxs)("div",{children:[(e.workDir||e.description)&&(0,s.jsxs)("div",{className:"flex items-center gap-3 mb-4 text-xs text-muted-foreground flex-wrap",children:[e.workDir&&(0,s.jsxs)("span",{className:"flex items-center gap-1.5 font-mono text-2xs bg-muted/50 px-2 py-0.5 rounded",children:[(0,s.jsx)(c.A,{size:10,className:"shrink-0"}),e.workDir]}),e.description&&(0,s.jsx)("span",{className:"leading-relaxed",children:e.description})]}),(0,s.jsxs)("div",{className:"mb-6",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,s.jsx)("div",{className:"flex items-center gap-2",children:v?(0,s.jsxs)("span",{className:"flex items-center gap-1.5 text-xs font-medium text-[var(--success)]",children:[(0,s.jsx)(p.A,{size:13}),"Complete"]}):j?(0,s.jsxs)("span",{className:"flex items-center gap-1.5 text-xs font-medium text-[var(--error)]",children:[(0,s.jsx)(l.A,{size:13}),g,"/",r.length," done"]}):(0,s.jsxs)("span",{className:"text-xs text-muted-foreground",children:[g,"/",r.length]})}),(0,s.jsxs)("div",{className:"flex items-center gap-1.5",children:[y>=0&&(0,s.jsxs)("button",{onClick:()=>x(y),disabled:i,className:"flex items-center gap-1.5 px-3 py-1 rounded-md text-xs font-medium transition-all disabled:opacity-40 bg-[var(--amber)] text-[var(--amber-foreground)]",children:[i?(0,s.jsx)(m.A,{size:11,className:"animate-spin"}):(0,s.jsx)(_.A,{size:11}),i?"Running...":"Run next"]}),(0,s.jsxs)("button",{onClick:h,className:"flex items-center gap-1 px-2 py-1 rounded-md text-2xs text-muted-foreground/50 hover:text-muted-foreground hover:bg-muted transition-colors",children:[(0,s.jsx)(H.A,{size:10}),"Reset"]})]})]}),(0,s.jsx)("div",{className:"h-1 rounded-full bg-border/50 overflow-hidden",children:(0,s.jsx)("div",{className:`h-full rounded-full transition-all duration-500 ease-out ${v?"bg-[var(--success)]":j?"bg-[var(--error)]":"bg-[var(--amber)]"}`,style:{width:`${b}%`}})})]}),(0,s.jsxs)("div",{className:"relative",children:[r.length>1&&(0,s.jsx)("div",{className:"absolute left-[12px] top-5 bottom-5 w-px bg-border/50"}),(0,s.jsx)("div",{className:"flex flex-col gap-4",children:r.map((e,t)=>(0,s.jsx)(X,{step:e,canRun:!i,onRun:()=>x(t),onSkip:()=>f(t),onCancel:u},e.id))})]})]})}function Q({filePath:e,content:t}){let r=(0,n.useMemo)(()=>(function(e){try{let t=d.Ay.load(e,{schema:d.Ay.JSON_SCHEMA});if(!t)return{workflow:null,errors:["File is empty"]};if("object"!=typeof t)return{workflow:null,errors:["Content is not valid YAML"]};let r=function(e){let t=[];if(!e||"object"!=typeof e)return{valid:!1,errors:["Must be a valid YAML object"]};if(e.title&&"string"==typeof e.title&&e.title.trim()||t.push("Missing required field 'title' (string)"),void 0!==e.description&&"string"!=typeof e.description&&t.push("'description' must be a string"),void 0!==e.skills&&(Array.isArray(e.skills)?e.skills.every(e=>"string"==typeof e)||t.push("'skills' must contain only strings"):t.push("'skills' must be an array of strings")),void 0!==e.tools&&(Array.isArray(e.tools)?e.tools.every(e=>"string"==typeof e)||t.push("'tools' must contain only strings"):t.push("'tools' must be an array of strings")),e.steps)if(Array.isArray(e.steps))if(0===e.steps.length)t.push("'steps' must have at least 1 step");else{let r=new Set;e.steps.forEach((e,s)=>{var n,a;let i,o,l=(n=e,a=s,i=[],o=`steps[${a}]`,n&&"object"==typeof n?(n.id&&"string"==typeof n.id&&n.id.trim()?/^[a-z0-9_-]+$/.test(n.id)||i.push(`${o}.id: '${n.id}' is invalid — use only lowercase letters, numbers, hyphens, underscores (e.g., 'run-tests')`):i.push(`${o}: missing required field 'id' (non-empty string)`),n.name&&"string"==typeof n.name&&n.name.trim()||i.push(`${o}: missing required field 'name' (non-empty string)`),void 0!==n.description&&"string"!=typeof n.description&&i.push(`${o}.description: must be a string`),void 0===n.agent||"string"==typeof n.agent&&n.agent.trim()||i.push(`${o}.agent: must be a non-empty string`),void 0===n.skill||"string"==typeof n.skill&&n.skill.trim()||i.push(`${o}.skill: must be a non-empty string`),void 0!==n.tools&&(Array.isArray(n.tools)?n.tools.every(e=>"string"==typeof e)||i.push(`${o}.tools: must contain only strings`):i.push(`${o}.tools: must be an array of strings`)),n.prompt&&"string"==typeof n.prompt&&n.prompt.trim()||i.push(`${o}: missing required field 'prompt' (non-empty string)`),void 0!==n.timeout&&("number"!=typeof n.timeout||n.timeout<=0)&&i.push(`${o}.timeout: must be a positive number (seconds)`)):i.push(`${o}: must be a valid object`),i);t.push(...l);let d=e?.id;"string"==typeof d&&d.trim()&&(r.has(d)&&t.push(`steps[${s}].id: duplicate id '${d}' (each step must have a unique id)`),r.add(d))})}else t.push("'steps' must be an array");else t.push("Missing required field 'steps' (array)");return{valid:0===t.length,errors:t}}(t);if(!r.valid)return{workflow:null,errors:r.errors};return{workflow:t,errors:[]}}catch(e){return{workflow:null,errors:[e instanceof Error?e.message:String(e)]}}})(t),[t]),[c,u]=(0,n.useState)("edit"),[m,x]=(0,n.useState)(!1),[p,f]=(0,n.useState)(()=>r.workflow?structuredClone(r.workflow):{title:"",description:"",steps:[]});(0,n.useRef)(t);let h=(0,n.useMemo)(()=>r.workflow??null,[r.workflow]),g=(0,n.useCallback)(e=>{f(e),x(!0)},[]),b=(0,n.useCallback)(()=>x(!1),[]),v=h??p,y=v.steps.length>0&&!!v.title,j=r.errors.length>0,w=v.title?0===v.steps.length?"Add at least one step":m?"Save changes first":void 0:"Add a title first",N=e=>{("run"!==e||y)&&u(e)};return(0,s.jsxs)("div",{className:"max-w-[720px] mx-auto py-8 px-2",children:[(0,s.jsxs)("div",{className:"mb-8",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,s.jsxs)("div",{className:"flex items-center gap-1 p-0.5 rounded-lg bg-muted/50",children:[(0,s.jsxs)("button",{onClick:()=>N("edit"),className:`flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium transition-all ${"edit"===c?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[(0,s.jsx)(a.A,{size:11}),"Edit"]}),(0,s.jsxs)("button",{onClick:()=>N("run"),disabled:!y,title:w,className:`flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium transition-all disabled:opacity-30 disabled:cursor-not-allowed ${"run"===c?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[(0,s.jsx)(i.A,{size:11}),"Run"]})]}),p.steps.length>0&&(0,s.jsxs)("span",{className:"text-2xs text-muted-foreground/60 font-mono",children:[p.steps.length," step",1!==p.steps.length?"s":""]})]}),(0,s.jsxs)("div",{className:"flex items-start gap-3",children:[(0,s.jsx)("div",{className:"mt-1 w-8 h-8 rounded-lg bg-[var(--amber)]/10 flex items-center justify-center shrink-0",children:(0,s.jsx)(o.A,{size:16,className:"text-[var(--amber)]"})}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsxs)("h1",{className:"text-lg font-semibold text-foreground truncate leading-tight",children:[p.title||"Untitled Flow",m&&(0,s.jsx)("span",{className:"text-[var(--amber)] ml-1.5 text-sm",title:"Unsaved changes",children:"*"})]}),p.description&&(0,s.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 line-clamp-1",children:p.description})]})]})]}),j&&"edit"===c&&(0,s.jsxs)("div",{className:"mb-5 px-3.5 py-3 rounded-lg bg-[var(--error)]/8 border border-[var(--error)]/20",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-1.5",children:[(0,s.jsx)(l.A,{size:13,className:"text-[var(--error)] shrink-0"}),(0,s.jsx)("span",{className:"text-xs font-medium text-[var(--error)]",children:"Parse issues found"})]}),(0,s.jsx)("ul",{className:"text-2xs text-[var(--error)]/70 pl-5 list-disc space-y-0.5",children:r.errors.slice(0,3).map((e,t)=>(0,s.jsx)("li",{children:e},t))})]}),"edit"===c?(0,s.jsx)(O,{workflow:p,filePath:e,onChange:g,onSaved:b}):(0,s.jsx)(Z,{workflow:v,filePath:e})]})}},54583:(e,t,r)=>{"use strict";r.d(t,{Y:()=>n});var s=r(9339);let n=(0,s.createServerReference)("40cee0fd64fcdffbb0e0d8a239ff59e26149c6c34d",s.callServer,void 0,s.findSourceMapURL,"undoDeleteAction")},56406:(e,t,r)=>{"use strict";r.r(t),r.d(t,{SummaryRenderer:()=>x});var s=r(95155),n=r(12115),a=r(91958),i=r(86901),o=r(48368),l=r(84980),d=r(91337),c=r(22356);function u(e){let t=Date.now()-e,r=Math.floor(t/6e4),s=Math.floor(t/36e5),n=Math.floor(t/864e5);return r<1?"just now":r<60?`${r}m ago`:s<24?`${s}h ago`:`${n}d ago`}function m(e){return e.split("/").pop()?.replace(/\.(md|csv)$/,"")??e}function x({filePath:e}){let[t,r]=(0,n.useState)([]),[x,p]=(0,n.useState)(""),[f,h]=(0,n.useState)(!1),[g,b]=(0,n.useState)(""),[v,y]=(0,n.useState)(!1),j=(0,n.useRef)(null),w=(0,n.useMemo)(()=>x.replace(/^### (.+)$/gm,'<h3 style="font-size:.8rem;font-weight:600;color:var(--muted-foreground);text-transform:uppercase;letter-spacing:.06em;margin:1em 0 .3em">$1</h3>').replace(/^## (.+)$/gm,'<h2 style="font-size:.9rem;font-weight:700;color:var(--foreground);margin:1.2em 0 .4em">$1</h2>').replace(/^# (.+)$/gm,'<h1 style="font-size:1rem;font-weight:700;color:var(--foreground);margin:1.2em 0 .4em">$1</h1>').replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/`(.+?)`/g,'<code class="font-display" style="font-size:.82em;padding:1px 5px;border-radius:4px;background:var(--muted)">$1</code>').replace(/^[-*] (.+)$/gm,'<li style="margin:.2em 0;padding-left:.3em">$1</li>').replace(/(<li[^>]*>.*<\/li>\n?)+/g,e=>`<ul style="margin:.4em 0;padding-left:1.4em;list-style:disc">${e}</ul>`).replace(/\n{2,}/g,'</p><p style="margin:.5em 0;font-size:.85rem;line-height:1.7;color:var(--foreground)">').replace(/^(?!<[hulo])(.+)$/gm,'<p style="margin:.5em 0;font-size:.85rem;line-height:1.7;color:var(--foreground)">$1</p>'),[x]);async function N(){if(0===t.length)return;j.current?.abort();let e=new AbortController;j.current=e,p(""),b(""),h(!0),y(!1);let r=t.map(e=>e.path),s=t.map(e=>`- **${m(e.path)}** (${e.path}, modified ${u(e.mtime)})`).join("\n"),n=`You are summarizing recent changes in a personal knowledge base (MindOS).
|
|
43
|
+
Be specific and actionable. Format in Markdown.`}(e,t,i)}],currentFile:r};o&&(l.selectedAcpAgent=o);let d=await fetch("/api/ask",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l),signal:n});if(!d.ok)throw Error(`Request failed (HTTP ${d.status})`);if(!d.body)throw Error("No response body");let c=d.body.getReader(),u=new TextDecoder,m="";for(;;){let{done:e,value:t}=await c.read();if(e)break;for(let e of u.decode(t,{stream:!0}).split("\n")){let t=e.match(/^data:(.+)$/);if(t){try{let e=JSON.parse(t[1]);if("text_delta"===e.type&&"string"==typeof e.delta)m+=e.delta,s(m);else if("thinking_delta"===e.type&&"string"==typeof e.delta)m+=e.delta,s(m);else if("error"===e.type&&e.message)throw Error(e.message)}catch{let t=e.match(/^0:"((?:[^"\\]|\\.)*)"$/);t&&s(m+=t[1].replace(/\\n/g,"\n").replace(/\\"/g,'"').replace(/\\\\/g,"\\"))}continue}let r=e.match(/^0:"((?:[^"\\]|\\.)*)"$/);r&&s(m+=r[1].replace(/\\n/g,"\n").replace(/\\"/g,'"').replace(/\\\\/g,"\\"))}}}function G(e){return e.steps.map((e,t)=>({...e,index:t,status:"pending",output:"",error:void 0}))}function V({status:e,index:t}){let r="w-[26px] h-[26px] rounded-full flex items-center justify-center shrink-0 transition-all";return"running"===e?(0,s.jsx)("div",{className:`${r} bg-[var(--amber)]/15 ring-2 ring-[var(--amber)]/30`,children:(0,s.jsx)(m.A,{size:12,className:"text-[var(--amber)] animate-spin"})}):"done"===e?(0,s.jsx)("div",{className:`${r} bg-[var(--success)]/15`,children:(0,s.jsx)(p.A,{size:13,className:"text-[var(--success)]"})}):"error"===e?(0,s.jsx)("div",{className:`${r} bg-[var(--error)]/15`,children:(0,s.jsx)(l.A,{size:13,className:"text-[var(--error)]"})}):"skipped"===e?(0,s.jsx)("div",{className:`${r} bg-muted/50`,children:(0,s.jsx)(W.A,{size:11,className:"text-muted-foreground/40"})}):(0,s.jsx)("div",{className:`${r} border-2 border-border bg-background`,children:(0,s.jsx)("span",{className:"text-[11px] font-bold text-muted-foreground/50",children:t+1})})}function q({step:e,canRun:t,onRun:r,onSkip:a,onCancel:o}){let[d,c]=(0,n.useState)(!1),u=!!(e.output||e.error),m=e.skills?.length?e.skills:e.skill?[e.skill]:[];return"running"===e.status||e.status,(0,s.jsx)("div",{className:`transition-opacity ${"skipped"===e.status?"opacity-50":""}`,children:(0,s.jsxs)("div",{className:"flex items-start gap-3",children:[(0,s.jsx)(V,{status:e.status,index:e.index}),(0,s.jsxs)("div",{className:"flex-1 min-w-0 pt-0.5",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 justify-between",children:[(0,s.jsx)("span",{className:`text-sm font-medium truncate ${"done"===e.status?"text-foreground":"running"===e.status?"text-[var(--amber)]":"error"===e.status?"text-[var(--error)]":"text-foreground/70"}`,children:e.name}),(0,s.jsxs)("div",{className:"flex items-center gap-1.5 shrink-0",children:[null!=e.durationMs&&("done"===e.status||"error"===e.status)&&(0,s.jsx)("span",{className:"text-2xs text-muted-foreground/40 font-mono",children:function(e){if(e<1e3)return`${e}ms`;let t=Math.round(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}(e.durationMs)}),"pending"===e.status&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("button",{onClick:r,disabled:!t,className:"flex items-center gap-1 px-2 py-0.5 rounded-md text-2xs font-medium transition-all disabled:opacity-30 bg-[var(--amber)] text-[var(--amber-foreground)]",children:[(0,s.jsx)(i.A,{size:9})," Run"]}),(0,s.jsx)("button",{onClick:a,className:"px-1.5 py-0.5 rounded-md text-2xs text-muted-foreground/50 hover:text-muted-foreground hover:bg-muted transition-colors",children:"Skip"})]}),"running"===e.status&&(0,s.jsxs)("button",{onClick:o,className:"flex items-center gap-1 px-2 py-0.5 rounded-md text-2xs text-[var(--error)]/70 hover:text-[var(--error)] hover:bg-[var(--error)]/10 transition-colors",children:[(0,s.jsx)(B.A,{size:9})," Stop"]}),u&&"running"!==e.status&&(0,s.jsx)("button",{onClick:()=>c(e=>!e),className:"p-0.5 rounded text-muted-foreground/30 hover:text-muted-foreground transition-colors",children:(0,s.jsx)(h.A,{size:12,className:`transition-transform ${d?"rotate-180":""}`})})]})]}),(e.agent||m.length>0)&&(0,s.jsxs)("div",{className:"flex gap-1 mt-0.5 flex-wrap",children:[e.agent&&(0,s.jsx)("span",{className:"text-2xs text-muted-foreground/50",children:e.agent}),e.agent&&m.length>0&&(0,s.jsx)("span",{className:"text-2xs text-muted-foreground/20",children:"/"}),m.map(e=>(0,s.jsx)("span",{className:"text-2xs text-[var(--amber)]/60",children:e},e))]}),(d||"running"===e.status)&&u&&(0,s.jsxs)("div",{className:"mt-2 rounded-lg overflow-hidden border border-border/50",children:[e.error&&(0,s.jsxs)("div",{className:"px-3 py-2.5 bg-[var(--error)]/5",children:[(0,s.jsxs)("div",{className:"flex items-center gap-1.5 mb-1",children:[(0,s.jsx)(l.A,{size:10,className:"text-[var(--error)]"}),(0,s.jsx)("span",{className:"text-2xs font-medium text-[var(--error)]",children:"Error"})]}),(0,s.jsx)("div",{className:"text-xs text-[var(--error)]/80 whitespace-pre-wrap break-words leading-relaxed",children:e.error})]}),e.output&&(0,s.jsxs)("div",{className:"px-3 py-2.5 bg-muted/20",children:[(0,s.jsxs)("div",{className:"flex items-center gap-1.5 mb-1.5",children:[(0,s.jsx)(U.A,{size:10,className:"text-[var(--amber)]"}),(0,s.jsx)("span",{className:"text-2xs text-muted-foreground/50 uppercase tracking-wider font-medium",children:"Output"}),"running"===e.status&&(0,s.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-[var(--amber)] animate-pulse"})]}),(0,s.jsx)("div",{className:"text-xs leading-relaxed text-foreground/80 whitespace-pre-wrap break-words",children:e.output})]})]})]})]})})}function Z({workflow:e,filePath:t}){let[r,a]=(0,n.useState)(()=>G(e)),[i,o]=(0,n.useState)(!1),d=(0,n.useRef)(null);(0,n.useEffect)(()=>{a(G(e)),o(!1)},[e]);let u=(0,n.useCallback)(()=>{d.current?.abort(),d.current=null,o(!1),a(e=>e.map(e=>"running"===e.status?{...e,status:"error",error:"Cancelled"}:e))},[]),x=(0,n.useCallback)(async r=>{if(i)return;d.current?.abort();let s=new AbortController;d.current=s,o(!0);let n=Date.now();a(e=>e.map((e,t)=>t===r?{...e,status:"running",output:"",error:void 0,startedAt:new Date}:e));try{let i={...e.steps[r],index:r,status:"running",output:""};await J(i,e,t,e=>a(t=>t.map((t,s)=>s===r?{...t,output:e}:t)),s.signal);let o=Date.now()-n;a(e=>e.map((e,t)=>t===r?{...e,status:"done",completedAt:new Date,durationMs:o}:e))}catch(t){if(t instanceof Error&&"AbortError"===t.name)return;let e=Date.now()-n;a(s=>s.map((s,n)=>n===r?{...s,status:"error",error:t instanceof Error?t.message:String(t),durationMs:e}:s))}finally{o(!1)}},[i,e,t]),h=(0,n.useCallback)(e=>{a(t=>t.map((t,r)=>r===e?{...t,status:"skipped"}:t))},[]),f=(0,n.useCallback)(()=>{d.current?.abort(),d.current=null,o(!1),X.clear(),a(G(e))},[e]),g=r.filter(e=>"done"===e.status).length,b=r.length>0?Math.round(g/r.length*100):0,v=g===r.length&&r.length>0,y=r.findIndex(e=>"pending"===e.status),j=r.some(e=>"error"===e.status);return(0,s.jsxs)("div",{children:[(e.workDir||e.description)&&(0,s.jsxs)("div",{className:"flex items-center gap-3 mb-4 text-xs text-muted-foreground flex-wrap",children:[e.workDir&&(0,s.jsxs)("span",{className:"flex items-center gap-1.5 font-mono text-2xs bg-muted/50 px-2 py-0.5 rounded",children:[(0,s.jsx)(c.A,{size:10,className:"shrink-0"}),e.workDir]}),e.description&&(0,s.jsx)("span",{className:"leading-relaxed",children:e.description})]}),(0,s.jsxs)("div",{className:"mb-6",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,s.jsx)("div",{className:"flex items-center gap-2",children:v?(0,s.jsxs)("span",{className:"flex items-center gap-1.5 text-xs font-medium text-[var(--success)]",children:[(0,s.jsx)(p.A,{size:13}),"Complete"]}):j?(0,s.jsxs)("span",{className:"flex items-center gap-1.5 text-xs font-medium text-[var(--error)]",children:[(0,s.jsx)(l.A,{size:13}),g,"/",r.length," done"]}):(0,s.jsxs)("span",{className:"text-xs text-muted-foreground",children:[g,"/",r.length]})}),(0,s.jsxs)("div",{className:"flex items-center gap-1.5",children:[y>=0&&(0,s.jsxs)("button",{onClick:()=>x(y),disabled:i,className:"flex items-center gap-1.5 px-3 py-1 rounded-md text-xs font-medium transition-all disabled:opacity-40 bg-[var(--amber)] text-[var(--amber-foreground)]",children:[i?(0,s.jsx)(m.A,{size:11,className:"animate-spin"}):(0,s.jsx)(_.A,{size:11}),i?"Running...":"Run next"]}),(0,s.jsxs)("button",{onClick:f,className:"flex items-center gap-1 px-2 py-1 rounded-md text-2xs text-muted-foreground/50 hover:text-muted-foreground hover:bg-muted transition-colors",children:[(0,s.jsx)(H.A,{size:10}),"Reset"]})]})]}),(0,s.jsx)("div",{className:"h-1 rounded-full bg-border/50 overflow-hidden",children:(0,s.jsx)("div",{className:`h-full rounded-full transition-all duration-500 ease-out ${v?"bg-[var(--success)]":j?"bg-[var(--error)]":"bg-[var(--amber)]"}`,style:{width:`${b}%`}})})]}),(0,s.jsxs)("div",{className:"relative",children:[r.length>1&&(0,s.jsx)("div",{className:"absolute left-[12px] top-5 bottom-5 w-px bg-border/50"}),(0,s.jsx)("div",{className:"flex flex-col gap-4",children:r.map((e,t)=>(0,s.jsx)(q,{step:e,canRun:!i,onRun:()=>x(t),onSkip:()=>h(t),onCancel:u},e.id))})]})]})}function Q({filePath:e,content:t}){let r=(0,n.useMemo)(()=>(function(e){try{let t=d.Ay.load(e,{schema:d.Ay.JSON_SCHEMA});if(!t)return{workflow:null,errors:["File is empty"]};if("object"!=typeof t)return{workflow:null,errors:["Content is not valid YAML"]};let r=function(e){let t=[];if(!e||"object"!=typeof e)return{valid:!1,errors:["Must be a valid YAML object"]};if(e.title&&"string"==typeof e.title&&e.title.trim()||t.push("Missing required field 'title' (string)"),void 0!==e.description&&"string"!=typeof e.description&&t.push("'description' must be a string"),void 0!==e.skills&&(Array.isArray(e.skills)?e.skills.every(e=>"string"==typeof e)||t.push("'skills' must contain only strings"):t.push("'skills' must be an array of strings")),void 0!==e.tools&&(Array.isArray(e.tools)?e.tools.every(e=>"string"==typeof e)||t.push("'tools' must contain only strings"):t.push("'tools' must be an array of strings")),e.steps)if(Array.isArray(e.steps))if(0===e.steps.length)t.push("'steps' must have at least 1 step");else{let r=new Set;e.steps.forEach((e,s)=>{var n,a;let i,o,l=(n=e,a=s,i=[],o=`steps[${a}]`,n&&"object"==typeof n?(n.id&&"string"==typeof n.id&&n.id.trim()?/^[a-z0-9_-]+$/.test(n.id)||i.push(`${o}.id: '${n.id}' is invalid — use only lowercase letters, numbers, hyphens, underscores (e.g., 'run-tests')`):i.push(`${o}: missing required field 'id' (non-empty string)`),n.name&&"string"==typeof n.name&&n.name.trim()||i.push(`${o}: missing required field 'name' (non-empty string)`),void 0!==n.description&&"string"!=typeof n.description&&i.push(`${o}.description: must be a string`),void 0===n.agent||"string"==typeof n.agent&&n.agent.trim()||i.push(`${o}.agent: must be a non-empty string`),void 0===n.skill||"string"==typeof n.skill&&n.skill.trim()||i.push(`${o}.skill: must be a non-empty string`),void 0!==n.tools&&(Array.isArray(n.tools)?n.tools.every(e=>"string"==typeof e)||i.push(`${o}.tools: must contain only strings`):i.push(`${o}.tools: must be an array of strings`)),n.prompt&&"string"==typeof n.prompt&&n.prompt.trim()||i.push(`${o}: missing required field 'prompt' (non-empty string)`),void 0!==n.timeout&&("number"!=typeof n.timeout||n.timeout<=0)&&i.push(`${o}.timeout: must be a positive number (seconds)`)):i.push(`${o}: must be a valid object`),i);t.push(...l);let d=e?.id;"string"==typeof d&&d.trim()&&(r.has(d)&&t.push(`steps[${s}].id: duplicate id '${d}' (each step must have a unique id)`),r.add(d))})}else t.push("'steps' must be an array");else t.push("Missing required field 'steps' (array)");return{valid:0===t.length,errors:t}}(t);if(!r.valid)return{workflow:null,errors:r.errors};return{workflow:t,errors:[]}}catch(e){return{workflow:null,errors:[e instanceof Error?e.message:String(e)]}}})(t),[t]),[c,u]=(0,n.useState)("edit"),[m,x]=(0,n.useState)(!1),[p,h]=(0,n.useState)(()=>r.workflow?structuredClone(r.workflow):{title:"",description:"",steps:[]});(0,n.useRef)(t);let f=(0,n.useMemo)(()=>r.workflow??null,[r.workflow]),g=(0,n.useCallback)(e=>{h(e),x(!0)},[]),b=(0,n.useCallback)(()=>x(!1),[]),v=f??p,y=v.steps.length>0&&!!v.title,j=r.errors.length>0,w=v.title?0===v.steps.length?"Add at least one step":m?"Save changes first":void 0:"Add a title first",N=e=>{("run"!==e||y)&&u(e)};return(0,s.jsxs)("div",{className:"max-w-[720px] mx-auto py-8 px-2",children:[(0,s.jsxs)("div",{className:"mb-8",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,s.jsxs)("div",{className:"flex items-center gap-1 p-0.5 rounded-lg bg-muted/50",children:[(0,s.jsxs)("button",{onClick:()=>N("edit"),className:`flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium transition-all ${"edit"===c?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[(0,s.jsx)(a.A,{size:11}),"Edit"]}),(0,s.jsxs)("button",{onClick:()=>N("run"),disabled:!y,title:w,className:`flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium transition-all disabled:opacity-30 disabled:cursor-not-allowed ${"run"===c?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[(0,s.jsx)(i.A,{size:11}),"Run"]})]}),p.steps.length>0&&(0,s.jsxs)("span",{className:"text-2xs text-muted-foreground/60 font-mono",children:[p.steps.length," step",1!==p.steps.length?"s":""]})]}),(0,s.jsxs)("div",{className:"flex items-start gap-3",children:[(0,s.jsx)("div",{className:"mt-1 w-8 h-8 rounded-lg bg-[var(--amber)]/10 flex items-center justify-center shrink-0",children:(0,s.jsx)(o.A,{size:16,className:"text-[var(--amber)]"})}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsxs)("h1",{className:"text-lg font-semibold text-foreground truncate leading-tight",children:[p.title||"Untitled Flow",m&&(0,s.jsx)("span",{className:"text-[var(--amber)] ml-1.5 text-sm",title:"Unsaved changes",children:"*"})]}),p.description&&(0,s.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 line-clamp-1",children:p.description})]})]})]}),j&&"edit"===c&&(0,s.jsxs)("div",{className:"mb-5 px-3.5 py-3 rounded-lg bg-[var(--error)]/8 border border-[var(--error)]/20",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-1.5",children:[(0,s.jsx)(l.A,{size:13,className:"text-[var(--error)] shrink-0"}),(0,s.jsx)("span",{className:"text-xs font-medium text-[var(--error)]",children:"Parse issues found"})]}),(0,s.jsx)("ul",{className:"text-2xs text-[var(--error)]/70 pl-5 list-disc space-y-0.5",children:r.errors.slice(0,3).map((e,t)=>(0,s.jsx)("li",{children:e},t))})]}),"edit"===c?(0,s.jsx)(O,{workflow:p,filePath:e,onChange:g,onSaved:b}):(0,s.jsx)(Z,{workflow:v,filePath:e})]})}},54235:(e,t,r)=>{"use strict";r.d(t,{f:()=>n});var s=r(9339);let n=(0,s.createServerReference)("60019d3f79247103c97f9697ab961736e254708cc1",s.callServer,void 0,s.findSourceMapURL,"renameFileAction")},56406:(e,t,r)=>{"use strict";r.r(t),r.d(t,{SummaryRenderer:()=>x});var s=r(95155),n=r(12115),a=r(91958),i=r(86901),o=r(48368),l=r(84980),d=r(91337),c=r(22356);function u(e){let t=Date.now()-e,r=Math.floor(t/6e4),s=Math.floor(t/36e5),n=Math.floor(t/864e5);return r<1?"just now":r<60?`${r}m ago`:s<24?`${s}h ago`:`${n}d ago`}function m(e){return e.split("/").pop()?.replace(/\.(md|csv)$/,"")??e}function x({filePath:e}){let[t,r]=(0,n.useState)([]),[x,p]=(0,n.useState)(""),[h,f]=(0,n.useState)(!1),[g,b]=(0,n.useState)(""),[v,y]=(0,n.useState)(!1),j=(0,n.useRef)(null),w=(0,n.useMemo)(()=>x.replace(/^### (.+)$/gm,'<h3 style="font-size:.8rem;font-weight:600;color:var(--muted-foreground);text-transform:uppercase;letter-spacing:.06em;margin:1em 0 .3em">$1</h3>').replace(/^## (.+)$/gm,'<h2 style="font-size:.9rem;font-weight:700;color:var(--foreground);margin:1.2em 0 .4em">$1</h2>').replace(/^# (.+)$/gm,'<h1 style="font-size:1rem;font-weight:700;color:var(--foreground);margin:1.2em 0 .4em">$1</h1>').replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/`(.+?)`/g,'<code class="font-display" style="font-size:.82em;padding:1px 5px;border-radius:4px;background:var(--muted)">$1</code>').replace(/^[-*] (.+)$/gm,'<li style="margin:.2em 0;padding-left:.3em">$1</li>').replace(/(<li[^>]*>.*<\/li>\n?)+/g,e=>`<ul style="margin:.4em 0;padding-left:1.4em;list-style:disc">${e}</ul>`).replace(/\n{2,}/g,'</p><p style="margin:.5em 0;font-size:.85rem;line-height:1.7;color:var(--foreground)">').replace(/^(?!<[hulo])(.+)$/gm,'<p style="margin:.5em 0;font-size:.85rem;line-height:1.7;color:var(--foreground)">$1</p>'),[x]);async function N(){if(0===t.length)return;j.current?.abort();let e=new AbortController;j.current=e,p(""),b(""),f(!0),y(!1);let r=t.map(e=>e.path),s=t.map(e=>`- **${m(e.path)}** (${e.path}, modified ${u(e.mtime)})`).join("\n"),n=`You are summarizing recent changes in a personal knowledge base (MindOS).
|
|
44
44
|
|
|
45
45
|
The following files were recently modified:
|
|
46
46
|
${s}
|
|
@@ -50,7 +50,7 @@ Please provide a concise daily briefing in this format:
|
|
|
50
50
|
2. **Themes**: Any patterns or recurring topics across the changes
|
|
51
51
|
3. **Suggested next actions**: 2–3 actionable follow-ups based on the content
|
|
52
52
|
|
|
53
|
-
Be specific. Reference actual content from the files. Keep the total response under 300 words.`;try{let t=await fetch("/api/ask",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({messages:[{role:"user",content:n}],attachedFiles:r}),signal:e.signal});if(!t.ok)throw Error(`HTTP ${t.status}`);if(!t.body)throw Error("No response body");let s=t.body.getReader(),a=new TextDecoder,i="";for(;;){let{done:e,value:t}=await s.read();if(e)break;for(let e of a.decode(t,{stream:!0}).split("\n")){let t=e.match(/^0:"((?:[^"\\]|\\.)*)"$/);t?i+=t[1].replace(/\\n/g,"\n").replace(/\\"/g,'"').replace(/\\\\/g,"\\"):!e||e.startsWith("d:")||e.startsWith("e:")||e.startsWith("0:")||(i+=e)}p(i)}y(!0)}catch(e){e instanceof Error&&"AbortError"!==e.name&&b(e.message||"Failed to generate summary")}finally{
|
|
53
|
+
Be specific. Reference actual content from the files. Keep the total response under 300 words.`;try{let t=await fetch("/api/ask",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({messages:[{role:"user",content:n}],attachedFiles:r}),signal:e.signal});if(!t.ok)throw Error(`HTTP ${t.status}`);if(!t.body)throw Error("No response body");let s=t.body.getReader(),a=new TextDecoder,i="";for(;;){let{done:e,value:t}=await s.read();if(e)break;for(let e of a.decode(t,{stream:!0}).split("\n")){let t=e.match(/^0:"((?:[^"\\]|\\.)*)"$/);t?i+=t[1].replace(/\\n/g,"\n").replace(/\\"/g,'"').replace(/\\\\/g,"\\"):!e||e.startsWith("d:")||e.startsWith("e:")||e.startsWith("0:")||(i+=e)}p(i)}y(!0)}catch(e){e instanceof Error&&"AbortError"!==e.name&&b(e.message||"Failed to generate summary")}finally{f(!1)}}return(0,n.useEffect)(()=>{(0,c.n)("/api/recent-files?limit=8").then(e=>r(e.filter(e=>e.path.endsWith(".md")))).catch(e=>{console.warn("[SummaryRenderer] fetch recent-files failed:",e)})},[e]),(0,n.useEffect)(()=>()=>{j.current?.abort()},[]),(0,s.jsxs)("div",{className:"max-w-[720px] mx-auto py-6",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2.5 mb-6 flex-wrap",children:[(0,s.jsx)("span",{className:"font-display text-[11px] text-muted-foreground",children:t.length>0?`${t.length} recently modified files`:"Loading recent files…"}),(0,s.jsxs)("button",{onClick:N,disabled:h||0===t.length,className:`font-display summary-gen-btn ${h?"summary-gen-btn--busy":""}`,children:[h?(0,s.jsx)(a.A,{size:12,className:"animate-spin"}):(0,s.jsx)(i.A,{size:12}),h?"Generating…":v?"Regenerate":"Generate briefing"]})]}),t.length>0&&(0,s.jsx)("div",{className:"flex flex-wrap gap-1.5 mb-6",children:t.map(e=>(0,s.jsxs)("a",{href:`/view/${(0,d.O0)(e.path)}`,className:"font-display summary-source-chip",title:e.path,children:[(0,s.jsx)(o.A,{size:10}),m(e.path),(0,s.jsxs)("span",{className:"opacity-50",children:[(0,s.jsx)(l.A,{size:9,className:"inline ml-0.5"})," ",u(e.mtime)]})]},e.path))}),g&&(0,s.jsx)("div",{className:"font-display px-3.5 py-2.5 rounded-lg bg-[var(--error)]/10 border border-[var(--error)]/30 text-[var(--error)] text-xs mb-4",children:g}),x?(0,s.jsxs)("div",{className:"bg-card border border-border rounded-[10px] px-5 py-[18px] relative",children:[h&&(0,s.jsx)("div",{className:"absolute top-3 right-3.5 w-1.5 h-1.5 rounded-full bg-[var(--amber)] animate-pulse"}),(0,s.jsx)("div",{dangerouslySetInnerHTML:{__html:w}})]}):h||v||!(t.length>0)?null:(0,s.jsxs)("div",{className:"border border-dashed border-border rounded-[10px] px-6 py-10 text-center text-muted-foreground",children:[(0,s.jsx)(i.A,{size:28,className:"mx-auto mb-2.5 opacity-30 text-[var(--amber)]"}),(0,s.jsxs)("p",{className:"font-display text-xs",children:["Click ",(0,s.jsx)("strong",{className:"text-foreground",children:"Generate briefing"})," to summarize recent changes with AI."]})]}),(0,s.jsx)("style",{children:`
|
|
54
54
|
.summary-gen-btn {
|
|
55
55
|
display: flex; align-items: center; gap: 6px;
|
|
56
56
|
padding: 5px 14px; border-radius: 7px; font-size: 12px;
|
|
@@ -68,36 +68,36 @@ Be specific. Reference actual content from the files. Keep the total response un
|
|
|
68
68
|
transition: color .15s;
|
|
69
69
|
}
|
|
70
70
|
.summary-source-chip:hover { color: var(--foreground); }
|
|
71
|
-
`})]})}},
|
|
71
|
+
`})]})}},61905:(e,t,r)=>{"use strict";r.d(t,{default:()=>tO});var s=r(95155),n=r(73321),a=r(12115),i=r(98500),o=r.n(i),l=r(29857),d=r(61878),c=r(89363),u=r(33210),m=r(59511),x=r(47857),p=r(46029),h=r(49619),f=r(53961),g=r(34530),b=r(91958),v=r(41641),y=r(21362),j=r(35581),w=r(12651),N=r(62791),k=r(22356),S=r(402);function C(e,t){return t?"syncing":e&&e.enabled?e.lastError?"error":e.conflicts&&e.conflicts.length>0?"conflicts":parseInt(e.unpushed||"0",10)>0?"unpushed":"synced":"off"}let A={synced:"bg-success",unpushed:"bg-yellow-500",conflicts:"bg-error",error:"bg-error",off:"bg-muted-foreground/40",syncing:"bg-blue-500"};function z(){let[e,t]=(0,a.useState)(null),[r,s]=(0,a.useState)(!1),n=(0,a.useRef)(void 0),i=(0,a.useCallback)(async()=>{try{let e=await (0,k.n)("/api/sync");t(e)}catch{t(null)}finally{s(!0)}},[]);return(0,a.useEffect)(()=>{i();let e=()=>{n.current&&clearInterval(n.current),n.current=setInterval(i,3e4)},t=()=>{n.current&&clearInterval(n.current),n.current=void 0};e();let r=()=>{"visible"===document.visibilityState?(i(),e()):t()};return document.addEventListener("visibilitychange",r),()=>{t(),document.removeEventListener("visibilitychange",r)}},[i]),{status:e,loaded:r,fetchStatus:i}}function E(e){let[t,r]=(0,a.useState)(!1),[s,n]=(0,a.useState)(null),i=(0,a.useCallback)(async()=>{if(!t){r(!0),n(null);try{await (0,k.n)("/api/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"now"})}),await e(),n("success")}catch{await e(),n("error")}finally{r(!1),setTimeout(()=>n(null),2500)}}},[t,e]);return{syncing:t,syncResult:s,syncNow:i}}function $(e,t,r){switch(e){case"syncing":{let e=r?.syncing??"Syncing...";return{label:e,tooltip:e}}case"synced":{let e=`${r?.synced??"Synced"} \xb7 ${(0,S.fF)(t?.lastSync)}`;return{label:e,tooltip:e}}case"unpushed":{let e=parseInt(t?.unpushed||"0",10);return{label:`${e} ${r?.unpushed??"awaiting push"}`,tooltip:r?.unpushedHint??`${e} commit(s) not yet pushed to remote`}}case"conflicts":{let e=t?.conflicts?.length||0;return{label:`${e} ${r?.conflicts??"conflicts"}`,tooltip:r?.conflictsHint??`${e} file(s) have merge conflicts — resolve in Settings > Sync`}}case"error":return{label:r?.syncError??"Sync error",tooltip:t?.lastError||(r?.syncError??"Sync error")};default:{let e=r?.syncOff??"Sync off";return{label:e,tooltip:e}}}}function T({collapsed:e,onOpenSyncSettings:t}){let{status:r,loaded:n,fetchStatus:i}=z(),{syncing:o,syncResult:l,syncNow:d}=E(i),[c,u]=(0,a.useState)(null),m=(0,a.useRef)("off"),[x,p]=(0,a.useState)(()=>{try{return!!localStorage.getItem("sync-hint-dismissed")}catch(e){console.warn("[SyncStatusBar] localStorage read failed:",e)}return!1}),{t:h}=(0,j.Y)();if(!function(e){let[,t]=(0,a.useState)(0);(0,a.useEffect)(()=>{let e=setInterval(()=>t(e=>e+1),6e4);return()=>clearInterval(e)},[6e4])}(0),(0,a.useEffect)(()=>{if(!n||o)return;let e=C(r,!1),t=m.current;if(t!==e){let r=h.sidebar?.sync;("error"===t||"conflicts"===t)&&"synced"===e&&(u(r?.syncRestored??"Sync restored"),setTimeout(()=>u(null),3e3)),m.current=e}},[r,n,o,h]),!n||e)return null;let f=C(r,o);if("off"===f){if(x)return null;let e=h.sidebar?.sync;return(0,s.jsxs)("div",{className:"hidden md:flex items-center justify-between px-4 py-1.5 border-t border-border text-xs text-muted-foreground shrink-0 animate-in fade-in duration-300",children:[(0,s.jsxs)("button",{onClick:t,className:"flex items-center gap-2 min-w-0 hover:text-foreground transition-colors truncate",title:e?.enableHint??"Set up cross-device sync",children:[(0,s.jsx)("span",{className:"w-2 h-2 rounded-full shrink-0 bg-muted-foreground/40"}),(0,s.jsxs)("span",{className:"truncate",children:[e?.enableSync??"Enable sync"," →"]})]}),(0,s.jsx)("button",{onClick:e=>{e.stopPropagation();try{localStorage.setItem("sync-hint-dismissed","1")}catch(e){console.warn("[SyncStatusBar] localStorage write dismissed:",e)}p(!0)},className:"p-1 rounded hover:bg-muted hover:text-foreground transition-colors shrink-0 ml-2 text-muted-foreground/50 hover:text-muted-foreground",title:"Dismiss",children:(0,s.jsx)("span",{className:"text-2xs",children:"✕"})})]})}let g=h.sidebar?.sync,{label:v,tooltip:y}=$(f,r,g);return(0,s.jsxs)("div",{className:"hidden md:flex items-center justify-between px-4 py-1.5 border-t border-border text-xs text-muted-foreground shrink-0 animate-in fade-in duration-300",children:[(0,s.jsxs)("button",{onClick:t,className:"flex items-center gap-2 min-w-0 hover:text-foreground transition-colors truncate",title:y,children:[(0,s.jsx)("span",{className:`w-2 h-2 rounded-full shrink-0 ${A[f]} ${"syncing"===f||"conflicts"===f?"animate-pulse":""}`}),(0,s.jsx)("span",{className:"truncate",children:c||v})]}),(0,s.jsxs)("div",{className:"flex items-center gap-1 shrink-0 ml-2",children:[("success"===l||c)&&(0,s.jsx)(w.A,{size:12,className:"text-success animate-in fade-in duration-200"}),"error"===l&&(0,s.jsx)(N.A,{size:12,className:"text-error animate-in fade-in duration-200"}),(0,s.jsx)("button",{onClick:e=>{e.stopPropagation(),d()},disabled:o,className:"p-1 rounded hover:bg-muted hover:text-foreground transition-colors disabled:opacity-40",title:g?.syncNow??"Sync now",children:(0,s.jsx)(b.A,{size:12,className:o?"animate-spin":""})})]})]})}function D({status:e,syncing:t}){let r=C(e,t??!1);return"off"===r||"synced"===r?null:(0,s.jsx)("span",{className:`w-1.5 h-1.5 rounded-full ${A[r]} ${"conflicts"===r||"error"===r?"animate-pulse":""}`})}var R=r(59960);function P({icon:e,label:t,shortcut:r,active:n=!1,expanded:a,onClick:i,buttonRef:o,badge:l,walkthroughId:d}){return(0,s.jsxs)("button",{ref:o,onClick:i,"aria-pressed":n,"aria-label":t,title:r?`${t} (${r})`:t,"data-walkthrough":d,className:`
|
|
72
72
|
relative flex items-center ${a?"justify-start px-3 w-full":"justify-center w-10"} h-10 rounded-md transition-colors
|
|
73
73
|
${n?"text-[var(--amber)] bg-[var(--amber-dim)]":"text-muted-foreground hover:text-foreground hover:bg-muted"}
|
|
74
74
|
focus-visible:ring-2 focus-visible:ring-ring
|
|
75
|
-
`,children:[n&&(0,s.jsx)("span",{className:"absolute left-0 top-1/2 -translate-y-1/2 w-[2px] h-[18px] rounded-r-full bg-[var(--amber)]"}),(0,s.jsx)("span",{className:"shrink-0 flex items-center justify-center w-[18px]",children:e}),l,a&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{className:"ml-2.5 text-sm whitespace-nowrap",children:t}),r&&(0,s.jsx)("span",{className:"ml-auto text-2xs text-muted-foreground/60 font-mono shrink-0",children:r})]})]})}function M({activePanel:e,onPanelChange:t,onEchoClick:r,onAgentsClick:i,onDiscoverClick:o,onWorkflowsClick:l,onSpacesClick:u,syncStatus:m,expanded:w,onExpandedChange:N,onSettingsClick:k,onSyncClick:S}){let z=(0,a.useRef)(0),E=(0,a.useRef)(null),{t:$}=(0,j.Y)(),T=(0,n.usePathname)(),D=(0,n.useRouter)(),M="/"===T,[F,I]=(0,a.useState)(!1);(0,a.useEffect)(()=>{let e=window.mindos;if(e?.checkUpdate){let t=e.checkUpdate.bind(e),r=setTimeout(async()=>{try{(await t()).available&&I(!0)}catch{}},1e4),s=e.onUpdateAvailable?.(()=>I(!0));return()=>{clearTimeout(r),s?.()}}let t=localStorage.getItem("mindos_update_dismissed"),r=localStorage.getItem("mindos_update_latest");r&&r!==t&&I(!0);let s=setTimeout(async()=>{try{let e=await fetch("/api/update-check",{signal:AbortSignal.timeout(5e3)});if(!e.ok)return;let t=await e.json();if(!t.hasUpdate){localStorage.removeItem("mindos_update_latest"),localStorage.removeItem("mindos_update_dismissed"),I(!1);return}let r=localStorage.getItem("mindos_update_dismissed");if(t.latest===r)return;localStorage.setItem("mindos_update_latest",t.latest),I(!0)}catch{}},5e3),n=()=>I(!0),a=()=>I(!1);return window.addEventListener("mindos:update-available",n),window.addEventListener("mindos:update-dismissed",a),()=>{clearTimeout(s),window.removeEventListener("mindos:update-available",n),window.removeEventListener("mindos:update-dismissed",a)}},[]);let[L,O]=(0,a.useState)(!1),[W,B]=(0,a.useState)(!1);(0,a.useEffect)(()=>{O("1"===localStorage.getItem("mindos:labs-echo")),B("1"===localStorage.getItem("mindos:labs-workflows"));let e=()=>{O("1"===localStorage.getItem("mindos:labs-echo")),B("1"===localStorage.getItem("mindos:labs-workflows"))};return window.addEventListener("mindos:labs-changed",e),()=>window.removeEventListener("mindos:labs-changed",e)},[]);let U=(0,a.useCallback)(e=>{let t=Date.now();t-z.current<300||(z.current=t,e())},[]),_=(0,a.useCallback)(r=>{U(()=>t(e===r?null:r))},[e,t,U]),H=C(m,!1),K=w?180:48,Y="off"!==H&&"synced"!==H?(0,s.jsx)("span",{className:`absolute ${w?"left-[26px] top-1.5":"top-1.5 right-1.5"} w-2 h-2 rounded-full ${A[H]} ${"error"===H||"conflicts"===H?"animate-pulse":""}`}):void 0;return(0,s.jsxs)("aside",{className:"group hidden md:flex fixed top-0 left-0 h-screen z-[31] flex-col bg-background border-r border-border transition-[width] duration-200 ease-out",style:{width:`${K}px`},role:"toolbar","aria-label":"Navigation","aria-orientation":"vertical",children:[(0,s.jsxs)("div",{className:"flex flex-col h-full w-full overflow-hidden",children:[(0,s.jsxs)("button",{type:"button",onClick:()=>{M?t("files"===e?null:"files"):(t("files"),D.push("/"))},className:`flex items-center ${w?"px-3 gap-2":"justify-center"} w-full h-[46px] shrink-0 transition-opacity cursor-pointer ${M?"opacity-100":"opacity-50 hover:opacity-80"}`,"aria-label":"MindOS Home",children:[(0,s.jsx)(R.A,{id:"rail",className:"w-7 h-3.5 shrink-0"}),w&&(0,s.jsx)("span",{className:"text-sm text-foreground font-brand whitespace-nowrap",children:"MindOS"})]}),(0,s.jsx)("div",{className:`${w?"mx-3":"mx-2"} border-t border-border`}),(0,s.jsxs)("div",{className:`flex flex-col ${w?"px-1.5":"items-center"} gap-1 py-2`,children:[(0,s.jsx)(P,{icon:(0,s.jsx)(x.A,{size:18}),label:$.sidebar.files,active:!M&&"files"===e,expanded:w,onClick:()=>u?U(u):_("files"),walkthroughId:"files-panel"}),L&&(0,s.jsx)(P,{icon:(0,s.jsx)(p.A,{size:18}),label:$.sidebar.echo,active:"echo"===e,expanded:w,onClick:()=>r?U(r):_("echo"),walkthroughId:"echo-panel"}),(0,s.jsx)(P,{icon:(0,s.jsx)(d.A,{size:18}),label:$.sidebar.searchTitle,shortcut:"⌘K",active:"search"===e,expanded:w,onClick:()=>_("search")}),(0,s.jsx)(P,{icon:(0,s.jsx)(f.A,{size:18}),label:$.sidebar.agents,active:"agents"===e,expanded:w,onClick:()=>i?U(i):_("agents"),walkthroughId:"agents-panel"}),W&&(0,s.jsx)(P,{icon:(0,s.jsx)(h.A,{size:18}),label:$.sidebar.workflows??"Flows",active:"workflows"===e,expanded:w,onClick:()=>l?U(l):_("workflows")})]}),(0,s.jsx)("div",{className:"flex-1"}),(0,s.jsx)("div",{className:`${w?"mx-3":"mx-2"} border-t border-border`}),(0,s.jsx)("div",{className:`flex flex-col ${w?"px-1.5":"items-center"} gap-1 py-2`,children:(0,s.jsx)(P,{icon:(0,s.jsx)(g.A,{size:18}),label:$.sidebar.discover,active:"discover"===e,expanded:w,onClick:()=>o?U(o):_("discover")})}),(0,s.jsx)("div",{className:`${w?"mx-3":"mx-2"} border-t border-border`}),(0,s.jsxs)("div",{className:`flex flex-col ${w?"px-1.5":"items-center"} gap-1 py-2`,children:[(0,s.jsx)(P,{icon:(0,s.jsx)(c.A,{size:18}),label:$.sidebar.settingsTitle,shortcut:"⌘,",expanded:w,onClick:()=>U(k),badge:F?(0,s.jsx)("span",{className:`absolute ${w?"left-[26px] top-1.5":"top-1.5 right-1.5"} w-2 h-2 rounded-full bg-error`}):void 0}),m?.enabled&&m?.remote&&"(not configured)"!==m.remote&&(0,s.jsx)(P,{icon:(0,s.jsx)(b.A,{size:18}),label:$.sidebar.syncLabel,expanded:w,buttonRef:E,badge:Y,onClick:()=>U(()=>{let e=E.current?.getBoundingClientRect();e&&S(e)})})]})]}),(0,s.jsx)("button",{onClick:()=>N(!w),className:" absolute right-0 top-1/2 -translate-y-1/2 translate-x-1/2 z-[32] w-5 h-5 rounded-full bg-card border border-border shadow-sm flex items-center justify-center opacity-0 group-hover:opacity-100 hover:!opacity-100 transition-opacity duration-200 text-muted-foreground hover:text-foreground hover:bg-muted focus-visible:opacity-100 focus-visible:ring-2 focus-visible:ring-ring ","aria-label":w?"Collapse sidebar":"Expand sidebar",title:w?"Collapse":"Expand",children:w?(0,s.jsx)(v.A,{size:10}):(0,s.jsx)(y.A,{size:10})})]})}var F=r(51914),I=r(48368),L=r(33024),O=r(10579),W=r(38569),B=r(56563),U=r(60285),_=r(15411),H=r(7915),K=r(15282),Y=r(68459),J=r(3799),G=r(60241),V=r(24371);function q({title:e,children:t,maximized:r,onMaximize:n}){return(0,s.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 h-[46px] border-b border-border shrink-0",children:[(0,s.jsx)("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:e}),(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[t,n&&(0,s.jsx)("button",{onClick:n,className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors","aria-label":r?"Restore panel":"Maximize panel",children:r?(0,s.jsx)(G.A,{size:13}):(0,s.jsx)(V.A,{size:13})})]})]})}function X({width:e,minWidth:t,maxWidth:r,maxWidthRatio:s,direction:n,disabled:i,onResize:o,onResizeEnd:l}){let d=(0,a.useRef)(!1),c=(0,a.useRef)(0),u=(0,a.useRef)(0),m=(0,a.useRef)(e);m.current=e;let x=(0,a.useRef)(o);x.current=o;let p=(0,a.useRef)(l);return p.current=l,(0,a.useCallback)(a=>{if(i)return;a.preventDefault(),d.current=!0,c.current=a.clientX,u.current=e,document.body.classList.add("select-none"),document.body.style.cursor="col-resize";let o=e=>{if(!d.current)return;let a="right"===n?e.clientX-c.current:c.current-e.clientX,i=Math.round(Math.max(t,Math.min(Math.min(r,window.innerWidth*s),u.current+a)));x.current(i)},l=()=>{d.current=!1,document.body.classList.remove("select-none"),document.body.style.cursor="",p.current(m.current),document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",l)};document.addEventListener("mousemove",o),document.addEventListener("mouseup",l)},[e,t,r,s,n,i])}var Z=r(9339);let Q=(0,Z.createServerReference)("00a914a530272368136460c2fb600ff22b0dfdd471",Z.callServer,void 0,Z.findSourceMapURL,"listTrashAction"),ee=()=>{},et={files:280,search:320,echo:340,agents:300,discover:300,workflows:320};function er({activePanel:e,fileTree:t,onNavigate:r,onOpenSyncSettings:i,railWidth:o=48,panelWidth:l,onWidthChange:d,onWidthCommit:c,maximized:u=!1,onMaximize:m,onImport:x,children:p}){let f=e?et[e]:280,h=u?void 0:l??f,{t:g}=(0,j.Y)(),b=(0,n.useRouter)(),v=(0,n.usePathname)(),y="/view/Inbox"===v||"/view/Inbox/"===v,[w,N]=(0,a.useState)(null),k=(0,a.useMemo)(()=>(function e(t,r=0){let s=r;for(let n of t)"directory"===n.type&&(s=Math.max(s,e(n.children??[],r+1)));return s})(t),[t]),[S,C]=(0,a.useState)(!1),A=(0,a.useRef)(null),z=(0,a.useRef)(null);(0,a.useEffect)(()=>{if(!S)return;let e=e=>{A.current&&!A.current.contains(e.target)&&z.current&&!z.current.contains(e.target)&&C(!1)},t=e=>{"Escape"===e.key&&C(!1)};return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)}},[S]);let[E,$]=(0,a.useState)(!1),D=(0,a.useRef)(null),R=(0,a.useRef)(null),P=(0,J.gL)(),[M,G]=(0,a.useState)(0);(0,a.useEffect)(()=>{if(!E)return;let e=e=>{D.current&&!D.current.contains(e.target)&&R.current&&!R.current.contains(e.target)&&$(!1)},t=e=>{"Escape"===e.key&&$(!1)};return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)}},[E]);let[V,Z]=(0,a.useState)(0);(0,a.useEffect)(()=>{let e=()=>{Q().then(e=>G(e.length)).catch(()=>{})},t=()=>{fetch("/api/inbox").then(e=>e.json()).then(e=>{Array.isArray(e.files)&&Z(e.files.length)}).catch(()=>{})};return e(),t(),window.addEventListener("mindos:files-changed",e),window.addEventListener("mindos:inbox-updated",t),()=>{window.removeEventListener("mindos:files-changed",e),window.removeEventListener("mindos:inbox-updated",t)}},[]);let[er,es]=(0,a.useState)(!1);(0,a.useEffect)(()=>{try{"1"===localStorage.getItem("mindos-tree-dblclick-hint")&&es(!0)}catch{}},[]);let en=(0,a.useCallback)(()=>{if(!er){es(!0);try{localStorage.setItem("mindos-tree-dblclick-hint","1")}catch{}}},[er]),ea=X({width:l??f,minWidth:240,maxWidth:600,maxWidthRatio:.45,direction:"right",disabled:u,onResize:d??ee,onResizeEnd:c??ee});return(0,s.jsxs)("aside",{className:`
|
|
75
|
+
`,children:[n&&(0,s.jsx)("span",{className:"absolute left-0 top-1/2 -translate-y-1/2 w-[2px] h-[18px] rounded-r-full bg-[var(--amber)]"}),(0,s.jsx)("span",{className:"shrink-0 flex items-center justify-center w-[18px]",children:e}),l,a&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{className:"ml-2.5 text-sm whitespace-nowrap",children:t}),r&&(0,s.jsx)("span",{className:"ml-auto text-2xs text-muted-foreground/60 font-mono shrink-0",children:r})]})]})}function M({activePanel:e,onPanelChange:t,onEchoClick:r,onAgentsClick:i,onDiscoverClick:o,onWorkflowsClick:l,onSpacesClick:u,syncStatus:m,expanded:w,onExpandedChange:N,onSettingsClick:k,onSyncClick:S}){let z=(0,a.useRef)(0),E=(0,a.useRef)(null),{t:$}=(0,j.Y)(),T=(0,n.usePathname)(),D=(0,n.useRouter)(),M="/"===T,[F,I]=(0,a.useState)(!1);(0,a.useEffect)(()=>{let e=window.mindos;if(e?.checkUpdate){let t=e.checkUpdate.bind(e),r=setTimeout(async()=>{try{(await t()).available&&I(!0)}catch{}},1e4),s=e.onUpdateAvailable?.(()=>I(!0));return()=>{clearTimeout(r),s?.()}}let t=localStorage.getItem("mindos_update_dismissed"),r=localStorage.getItem("mindos_update_latest");r&&r!==t&&I(!0);let s=setTimeout(async()=>{try{let e=await fetch("/api/update-check",{signal:AbortSignal.timeout(5e3)});if(!e.ok)return;let t=await e.json();if(!t.hasUpdate){localStorage.removeItem("mindos_update_latest"),localStorage.removeItem("mindos_update_dismissed"),I(!1);return}let r=localStorage.getItem("mindos_update_dismissed");if(t.latest===r)return;localStorage.setItem("mindos_update_latest",t.latest),I(!0)}catch{}},5e3),n=()=>I(!0),a=()=>I(!1);return window.addEventListener("mindos:update-available",n),window.addEventListener("mindos:update-dismissed",a),()=>{clearTimeout(s),window.removeEventListener("mindos:update-available",n),window.removeEventListener("mindos:update-dismissed",a)}},[]);let[L,O]=(0,a.useState)(!1),[W,B]=(0,a.useState)(!1);(0,a.useEffect)(()=>{O("1"===localStorage.getItem("mindos:labs-echo")),B("1"===localStorage.getItem("mindos:labs-workflows"));let e=()=>{O("1"===localStorage.getItem("mindos:labs-echo")),B("1"===localStorage.getItem("mindos:labs-workflows"))};return window.addEventListener("mindos:labs-changed",e),()=>window.removeEventListener("mindos:labs-changed",e)},[]);let U=(0,a.useCallback)(e=>{let t=Date.now();t-z.current<300||(z.current=t,e())},[]),_=(0,a.useCallback)(r=>{U(()=>t(e===r?null:r))},[e,t,U]),H=C(m,!1),X=w?180:48,K="off"!==H&&"synced"!==H?(0,s.jsx)("span",{className:`absolute ${w?"left-[26px] top-1.5":"top-1.5 right-1.5"} w-2 h-2 rounded-full ${A[H]} ${"error"===H||"conflicts"===H?"animate-pulse":""}`}):void 0;return(0,s.jsxs)("aside",{className:"group hidden md:flex fixed top-0 left-0 h-screen z-[31] flex-col bg-background border-r border-border transition-[width] duration-200 ease-out",style:{width:`${X}px`},role:"toolbar","aria-label":"Navigation","aria-orientation":"vertical",children:[(0,s.jsxs)("div",{className:"flex flex-col h-full w-full overflow-hidden",children:[(0,s.jsxs)("button",{type:"button",onClick:()=>{M?t("files"===e?null:"files"):(t("files"),D.push("/"))},className:`flex items-center ${w?"px-3 gap-2":"justify-center"} w-full h-[46px] shrink-0 transition-opacity cursor-pointer ${M?"opacity-100":"opacity-50 hover:opacity-80"}`,"aria-label":"MindOS Home",children:[(0,s.jsx)(R.A,{id:"rail",className:"w-7 h-3.5 shrink-0"}),w&&(0,s.jsx)("span",{className:"text-sm text-foreground font-brand whitespace-nowrap",children:"MindOS"})]}),(0,s.jsx)("div",{className:`${w?"mx-3":"mx-2"} border-t border-border`}),(0,s.jsxs)("div",{className:`flex flex-col ${w?"px-1.5":"items-center"} gap-1 py-2`,children:[(0,s.jsx)(P,{icon:(0,s.jsx)(x.A,{size:18}),label:$.sidebar.files,active:!M&&"files"===e,expanded:w,onClick:()=>u?U(u):_("files"),walkthroughId:"files-panel"}),L&&(0,s.jsx)(P,{icon:(0,s.jsx)(p.A,{size:18}),label:$.sidebar.echo,active:"echo"===e,expanded:w,onClick:()=>r?U(r):_("echo"),walkthroughId:"echo-panel"}),(0,s.jsx)(P,{icon:(0,s.jsx)(d.A,{size:18}),label:$.sidebar.searchTitle,shortcut:"⌘K",active:"search"===e,expanded:w,onClick:()=>_("search")}),(0,s.jsx)(P,{icon:(0,s.jsx)(h.A,{size:18}),label:$.sidebar.agents,active:"agents"===e,expanded:w,onClick:()=>i?U(i):_("agents"),walkthroughId:"agents-panel"}),W&&(0,s.jsx)(P,{icon:(0,s.jsx)(f.A,{size:18}),label:$.sidebar.workflows??"Flows",active:"workflows"===e,expanded:w,onClick:()=>l?U(l):_("workflows")})]}),(0,s.jsx)("div",{className:"flex-1"}),(0,s.jsx)("div",{className:`${w?"mx-3":"mx-2"} border-t border-border`}),(0,s.jsx)("div",{className:`flex flex-col ${w?"px-1.5":"items-center"} gap-1 py-2`,children:(0,s.jsx)(P,{icon:(0,s.jsx)(g.A,{size:18}),label:$.sidebar.discover,active:"discover"===e,expanded:w,onClick:()=>o?U(o):_("discover")})}),(0,s.jsx)("div",{className:`${w?"mx-3":"mx-2"} border-t border-border`}),(0,s.jsxs)("div",{className:`flex flex-col ${w?"px-1.5":"items-center"} gap-1 py-2`,children:[(0,s.jsx)(P,{icon:(0,s.jsx)(c.A,{size:18}),label:$.sidebar.settingsTitle,shortcut:"⌘,",expanded:w,onClick:()=>U(k),badge:F?(0,s.jsx)("span",{className:`absolute ${w?"left-[26px] top-1.5":"top-1.5 right-1.5"} w-2 h-2 rounded-full bg-error`}):void 0}),m?.enabled&&m?.remote&&"(not configured)"!==m.remote&&(0,s.jsx)(P,{icon:(0,s.jsx)(b.A,{size:18}),label:$.sidebar.syncLabel,expanded:w,buttonRef:E,badge:K,onClick:()=>U(()=>{let e=E.current?.getBoundingClientRect();e&&S(e)})})]})]}),(0,s.jsx)("button",{onClick:()=>N(!w),className:" absolute right-0 top-1/2 -translate-y-1/2 translate-x-1/2 z-[32] w-5 h-5 rounded-full bg-card border border-border shadow-sm flex items-center justify-center opacity-0 group-hover:opacity-100 hover:!opacity-100 transition-opacity duration-200 text-muted-foreground hover:text-foreground hover:bg-muted focus-visible:opacity-100 focus-visible:ring-2 focus-visible:ring-ring ","aria-label":w?"Collapse sidebar":"Expand sidebar",title:w?"Collapse":"Expand",children:w?(0,s.jsx)(v.A,{size:10}):(0,s.jsx)(y.A,{size:10})})]})}var F=r(51914),I=r(48368),L=r(33024),O=r(10579),W=r(38569),B=r(56563),U=r(60285),_=r(15282),H=r(50538),X=r(68459),K=r(15411),Y=r(7915),J=r(13123),G=r(60241),V=r(24371);function q({title:e,children:t,maximized:r,onMaximize:n}){return(0,s.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 h-[46px] border-b border-border shrink-0",children:[(0,s.jsx)("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:e}),(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[t,n&&(0,s.jsx)("button",{onClick:n,className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors","aria-label":r?"Restore panel":"Maximize panel",children:r?(0,s.jsx)(G.A,{size:13}):(0,s.jsx)(V.A,{size:13})})]})]})}function Z({width:e,minWidth:t,maxWidth:r,maxWidthRatio:s,direction:n,disabled:i,onResize:o,onResizeEnd:l}){let d=(0,a.useRef)(!1),c=(0,a.useRef)(0),u=(0,a.useRef)(0),m=(0,a.useRef)(e);m.current=e;let x=(0,a.useRef)(o);x.current=o;let p=(0,a.useRef)(l);return p.current=l,(0,a.useCallback)(a=>{if(i)return;a.preventDefault(),d.current=!0,c.current=a.clientX,u.current=e,document.body.classList.add("select-none"),document.body.style.cursor="col-resize";let o=e=>{if(!d.current)return;let a="right"===n?e.clientX-c.current:c.current-e.clientX,i=Math.round(Math.max(t,Math.min(Math.min(r,window.innerWidth*s),u.current+a)));x.current(i)},l=()=>{d.current=!1,document.body.classList.remove("select-none"),document.body.style.cursor="",p.current(m.current),document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",l)};document.addEventListener("mousemove",o),document.addEventListener("mouseup",l)},[e,t,r,s,n,i])}var Q=r(9339);let ee=(0,Q.createServerReference)("00475aca9e00c41dd1ecd98fcab4ac6d2035db4b65",Q.callServer,void 0,Q.findSourceMapURL,"listTrashAction"),et=()=>{},er={files:280,search:320,echo:340,agents:300,discover:300,workflows:320};function es({activePanel:e,fileTree:t,onNavigate:r,onOpenSyncSettings:i,railWidth:o=48,panelWidth:l,onWidthChange:d,onWidthCommit:c,maximized:u=!1,onMaximize:m,onImport:x,children:p}){let h=e?er[e]:280,f=u?void 0:l??h,{t:g}=(0,j.Y)(),b=(0,n.useRouter)(),v=(0,n.usePathname)(),y="/view/Inbox"===v||"/view/Inbox/"===v,[w,N]=(0,a.useState)(null),k=(0,a.useMemo)(()=>(function e(t,r=0){let s=r;for(let n of t)"directory"===n.type&&(s=Math.max(s,e(n.children??[],r+1)));return s})(t),[t]),[S,C]=(0,a.useState)(!1),A=(0,a.useRef)(null),z=(0,a.useRef)(null);(0,a.useEffect)(()=>{if(!S)return;let e=e=>{A.current&&!A.current.contains(e.target)&&z.current&&!z.current.contains(e.target)&&C(!1)},t=e=>{"Escape"===e.key&&C(!1)};return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)}},[S]);let[E,$]=(0,a.useState)(!1),D=(0,a.useRef)(null),R=(0,a.useRef)(null),P=(0,J.gL)(),[M,G]=(0,a.useState)(0);(0,a.useEffect)(()=>{if(!E)return;let e=e=>{D.current&&!D.current.contains(e.target)&&R.current&&!R.current.contains(e.target)&&$(!1)},t=e=>{"Escape"===e.key&&$(!1)};return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)}},[E]);let[V,Q]=(0,a.useState)(0);(0,a.useEffect)(()=>{let e=()=>{ee().then(e=>G(e.length)).catch(()=>{})},t=()=>{fetch("/api/inbox").then(e=>e.json()).then(e=>{Array.isArray(e.files)&&Q(e.files.length)}).catch(()=>{})};return e(),t(),window.addEventListener("mindos:files-changed",e),window.addEventListener("mindos:inbox-updated",t),()=>{window.removeEventListener("mindos:files-changed",e),window.removeEventListener("mindos:inbox-updated",t)}},[]);let[es,en]=(0,a.useState)(!1);(0,a.useEffect)(()=>{try{"1"===localStorage.getItem("mindos-tree-dblclick-hint")&&en(!0)}catch{}},[]);let ea=(0,a.useCallback)(()=>{if(!es){en(!0);try{localStorage.setItem("mindos-tree-dblclick-hint","1")}catch{}}},[es]),ei=Z({width:l??h,minWidth:240,maxWidth:600,maxWidthRatio:.45,direction:"right",disabled:u,onResize:d??et,onResizeEnd:c??et});return(0,s.jsxs)("aside",{className:`
|
|
76
76
|
hidden md:flex fixed top-0 h-screen z-30
|
|
77
77
|
flex-col bg-card border-r border-border
|
|
78
78
|
transition-[transform,left,width] duration-200 ease-out
|
|
79
79
|
${null!==e?"translate-x-0":"-translate-x-full pointer-events-none"}
|
|
80
|
-
`,style:{width:u?`calc(100vw - ${o}px)`:`${h}px`,left:`${o}px`},role:"region","aria-label":e?`${e} panel`:void 0,children:[(0,s.jsxs)("div",{className:`flex flex-col h-full ${"files"===e?"":"hidden"}`,children:[(0,s.jsx)(q,{title:g.sidebar.files,children:(0,s.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("button",{ref:A,type:"button",onClick:()=>{$(!1),C(e=>!e)},className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors focus-visible:ring-1 focus-visible:ring-ring","aria-label":g.sidebar.new,title:g.sidebar.new,children:(0,s.jsx)(F.A,{size:13})}),S&&(0,s.jsxs)("div",{ref:z,className:"absolute top-full right-0 mt-1 min-w-[152px] bg-card border border-border rounded-lg shadow-lg py-1 z-50",children:[(0,s.jsxs)("button",{className:"w-full flex items-center gap-2 px-3 py-1.5 text-sm text-foreground hover:bg-muted transition-colors text-left",onClick:()=>{C(!1),b.push("/view/Untitled.md")},children:[(0,s.jsx)(I.A,{size:14,className:"shrink-0"}),g.sidebar.newFile]}),(0,s.jsxs)("button",{className:"w-full flex items-center gap-2 px-3 py-1.5 text-sm text-foreground hover:bg-muted transition-colors text-left",onClick:()=>{C(!1),window.dispatchEvent(new Event("mindos:create-space"))},children:[(0,s.jsx)(L.A,{size:14,className:"shrink-0 text-[var(--amber)]"}),g.sidebar.newSpace]})]})]}),(0,s.jsx)("button",{type:"button",onClick:()=>x?.(),className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors focus-visible:ring-1 focus-visible:ring-ring","aria-label":g.sidebar.importFile,title:g.sidebar.importFile,children:(0,s.jsx)(O.A,{size:13})}),(0,s.jsx)("div",{className:"w-px h-3.5 bg-border mx-0.5"}),(0,s.jsx)("button",{onClick:()=>N(e=>Math.max(-1,(e??k)-1)),onDoubleClick:()=>{N(-1),en()},className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors focus-visible:ring-1 focus-visible:ring-ring","aria-label":g.sidebar.collapseLevel,title:er?g.sidebar.collapseLevel:g.sidebar.collapseLevelHint??g.sidebar.collapseLevel,children:(0,s.jsx)(W.A,{size:13})}),(0,s.jsx)("button",{onClick:()=>N(e=>{let t=(e??0)+1;return t>k?null:t}),onDoubleClick:()=>{N(null),en()},className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors focus-visible:ring-1 focus-visible:ring-ring","aria-label":g.sidebar.expandLevel,title:er?g.sidebar.expandLevel:g.sidebar.expandLevelHint??g.sidebar.expandLevel,children:(0,s.jsx)(B.A,{size:13})}),(0,s.jsx)("div",{className:"w-px h-3.5 bg-border mx-0.5"}),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("button",{ref:D,type:"button",onClick:()=>{C(!1),$(e=>!e)},className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors focus-visible:ring-1 focus-visible:ring-ring","aria-label":g.sidebar.more,title:g.sidebar.more,children:(0,s.jsx)(U.A,{size:13})}),E&&(0,s.jsxs)("div",{ref:R,className:"absolute top-full right-0 mt-1 min-w-[172px] bg-card border border-border rounded-lg shadow-lg py-1 z-50",children:[(0,s.jsxs)("button",{className:"w-full flex items-center gap-2 px-3 py-1.5 text-sm text-foreground hover:bg-muted transition-colors text-left",onClick:()=>{(0,J.Fo)(!P)},children:[P?(0,s.jsx)(_.A,{size:14,className:"shrink-0"}):(0,s.jsx)(H.A,{size:14,className:"shrink-0"}),(0,s.jsx)("span",{className:"flex-1",children:g.sidebar.showHiddenFiles}),P&&(0,s.jsx)("span",{className:"text-[var(--amber)] text-xs",children:"✓"})]}),(0,s.jsx)("div",{className:"my-1 border-t border-border/50"}),(0,s.jsxs)("button",{className:"w-full flex items-center gap-2 px-3 py-1.5 text-sm text-foreground hover:bg-muted transition-colors text-left",onClick:()=>{$(!1),b.push("/view/Inbox/")},children:[(0,s.jsx)(K.A,{size:14,className:"shrink-0 text-[var(--amber)]"}),(0,s.jsx)("span",{className:"flex-1",children:g.sidebar.capture}),V>0&&(0,s.jsx)("span",{className:"text-2xs font-medium tabular-nums px-1.5 py-px rounded-full bg-[var(--amber)]/10 text-[var(--amber)]/70",children:V})]}),(0,s.jsxs)("button",{className:"w-full flex items-center gap-2 px-3 py-1.5 text-sm text-foreground hover:bg-muted transition-colors text-left",onClick:()=>{$(!1),b.push("/trash")},children:[(0,s.jsx)(Y.A,{size:14,className:"shrink-0"}),(0,s.jsx)("span",{className:"flex-1",children:g.trash.title}),M>0&&(0,s.jsx)("span",{className:"text-xs text-muted-foreground tabular-nums",children:M})]})]})]})]})}),(0,s.jsx)("div",{className:"flex-1 overflow-y-auto min-h-0 px-2 py-2",onDragEnter:e=>{e.dataTransfer.types.includes("Files")&&e.stopPropagation()},onDragOver:e=>{e.dataTransfer.types.includes("Files")&&(e.preventDefault(),e.stopPropagation())},onDrop:e=>{e.dataTransfer.types.includes("Files")&&(e.preventDefault(),e.stopPropagation())},children:(0,s.jsx)(J.Ay,{nodes:t,onNavigate:r,maxOpenDepth:w,onImport:x})}),(0,s.jsxs)("button",{type:"button",onClick:()=>b.push("/view/Inbox/"),className:`flex items-center gap-2 mx-2 px-2 py-1.5 text-sm rounded-lg transition-all duration-150 group shrink-0 ${y?"bg-[var(--amber-dim)] text-[var(--amber)]":"hover:bg-muted text-muted-foreground hover:text-foreground"}`,children:[(0,s.jsx)("div",{className:`flex items-center justify-center w-5 h-5 rounded-md shrink-0 transition-colors ${y?"bg-[var(--amber)]/15":"bg-transparent"}`,children:(0,s.jsx)(K.A,{size:13,className:`shrink-0 transition-colors ${y?"text-[var(--amber)]":"text-[var(--amber)]/60 group-hover:text-[var(--amber)]"}`})}),(0,s.jsx)("span",{className:`flex-1 text-left text-xs transition-colors ${y?"font-medium text-[var(--amber)]":"text-muted-foreground group-hover:text-foreground"}`,children:g.sidebar.capture}),V>0&&(0,s.jsx)("span",{className:`text-2xs font-medium tabular-nums px-1.5 py-px rounded-full transition-colors ${y?"bg-[var(--amber)]/15 text-[var(--amber)]":"bg-[var(--amber)]/10 text-[var(--amber)]/70"}`,children:V})]}),(0,s.jsx)(T,{collapsed:!1,onOpenSyncSettings:i})]}),p,!u&&d&&(0,s.jsx)("div",{className:"absolute top-0 -right-[3px] w-[6px] h-full cursor-col-resize z-40 group hidden md:block",onMouseDown:ea,children:(0,s.jsx)("div",{className:"absolute right-[2px] top-0 w-[2px] h-full opacity-0 group-hover:opacity-100 bg-[var(--amber)]/60 transition-opacity"})})]})}var es=r(33078),en=r(91337),ea=r(14871);function ei({active:e,onNavigate:t,maximized:r,onMaximize:i}){let[o,l]=(0,a.useState)(""),[c,m]=(0,a.useState)([]),[x,p]=(0,a.useState)(!1),[f,h]=(0,a.useState)(0),[g,b]=(0,a.useState)(null),v=(0,a.useRef)(null),w=(0,n.useRouter)(),N=(0,a.useRef)(null),{t:S}=(0,j.Y)();(0,a.useEffect)(()=>{e&&setTimeout(()=>v.current?.focus(),50)},[e]);let C=(0,a.useCallback)(e=>{if(N.current&&clearTimeout(N.current),!e.trim()){m([]),p(!1);return}p(!0),N.current=setTimeout(async()=>{try{let t=await (0,k.n)(`/api/search?q=${encodeURIComponent(e)}`);m(Array.isArray(t)?t:[]),h(0)}catch{m([])}finally{p(!1)}},300)},[]),A=(0,a.useCallback)(e=>{let t=e.target.value;l(t),C(t)},[C]),z=(0,a.useCallback)(e=>{w.push(`/view/${(0,en.O0)(e.path)}`),t?.()},[w,t]),E=(0,a.useCallback)(e=>{"ArrowDown"===e.key?(e.preventDefault(),h(e=>Math.min(e+1,c.length-1))):"ArrowUp"===e.key?(e.preventDefault(),h(e=>Math.max(e-1,0))):"Enter"===e.key&&c[f]&&z(c[f])},[c,f,z]),$=(0,a.useCallback)((e,t)=>{e.dataTransfer.effectAllowed="copy",e.dataTransfer.setData("text/mindos-path",t.path),e.dataTransfer.setData("text/mindos-type","file");let r=new Image;e.dataTransfer.setDragImage(r,0,0)},[]),T=(0,a.useCallback)(()=>{b(null)},[]);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(q,{title:"Search",maximized:r,onMaximize:i}),(0,s.jsxs)("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-border shrink-0 overflow-hidden",children:[(0,s.jsx)(d.A,{size:16,className:"text-muted-foreground shrink-0 flex-none"}),(0,s.jsx)("input",{ref:v,type:"text",value:o,onChange:A,onKeyDown:E,placeholder:S.search.placeholder,"aria-label":S.search.placeholder,className:"flex-1 min-w-0 bg-transparent text-foreground text-base font-medium placeholder:text-muted-foreground/60 outline-none"}),x&&(0,s.jsx)("div",{className:"w-4 h-4 border-2 border-muted-foreground/30 border-t-foreground rounded-full animate-spin shrink-0 flex-none"}),!x&&o&&(0,s.jsx)("button",{onClick:()=>{l(""),m([]),v.current?.focus()},className:"shrink-0 flex-none p-1 text-muted-foreground hover:text-foreground transition-colors","aria-label":S.search.clear,children:(0,s.jsx)(u.A,{size:16})})]}),(0,s.jsxs)("div",{className:"flex-1 overflow-y-auto min-h-0",role:"listbox","aria-label":"Search results",children:[0===c.length&&!o&&!x&&(0,s.jsxs)("div",{className:"flex flex-col items-center justify-center px-4 py-12 text-center",children:[(0,s.jsx)("div",{className:"flex items-center justify-center w-12 h-12 rounded-lg bg-muted mb-4",children:(0,s.jsx)(d.A,{size:20,className:"text-muted-foreground/60"})}),(0,s.jsx)("h3",{className:"text-sm font-medium text-foreground mb-1",children:S.search.emptyTitle}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground/70",children:S.search.emptyHint})]}),0===c.length&&o&&!x&&(0,s.jsxs)("div",{className:"flex flex-col items-center justify-center px-4 py-12 text-center",children:[(0,s.jsx)("div",{className:"flex items-center justify-center w-12 h-12 rounded-lg bg-muted mb-4",children:(0,s.jsx)(d.A,{size:20,className:"text-muted-foreground/60"})}),(0,s.jsx)("h3",{className:"text-sm font-medium text-foreground mb-1",children:S.search.noResults}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground/70",children:S.search.noResultsHint})]}),x&&0===c.length&&(0,s.jsx)("div",{className:"space-y-2 p-3",children:[1,2,3].map(e=>(0,s.jsxs)("div",{className:"px-3 py-2.5 space-y-2 animate-pulse",children:[(0,s.jsx)("div",{className:"h-4 bg-muted rounded-md w-3/4"}),(0,s.jsx)("div",{className:"h-3 bg-muted rounded-md w-1/2"}),(0,s.jsx)("div",{className:"h-3 bg-muted rounded-md w-2/3"})]},e))}),c.length>0&&(0,s.jsx)(ea.aY,{totalCount:c.length,overscan:100,itemContent:e=>{let t,r=c[e],n=r.path.endsWith(".csv")?".csv":".md",{name:a,breadcrumb:i}={name:(t=r.path.split("/").filter(Boolean))[t.length-1],breadcrumb:t.slice(0,-1)},l=e===f,d=e===g;return(0,s.jsxs)("button",{role:"option","aria-selected":l,draggable:!0,onDragStart:e=>$(e,r),onDragEnd:T,onDragEnter:()=>b(e),onDragLeave:()=>b(null),onClick:()=>z(r),onMouseEnter:()=>h(e),className:`
|
|
80
|
+
`,style:{width:u?`calc(100vw - ${o}px)`:`${f}px`,left:`${o}px`},role:"region","aria-label":e?`${e} panel`:void 0,children:[(0,s.jsxs)("div",{className:`flex flex-col h-full ${"files"===e?"":"hidden"}`,children:[(0,s.jsx)(q,{title:g.sidebar.files,children:(0,s.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("button",{ref:A,type:"button",onClick:()=>{$(!1),C(e=>!e)},className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors focus-visible:ring-1 focus-visible:ring-ring","aria-label":g.sidebar.new,title:g.sidebar.new,children:(0,s.jsx)(F.A,{size:13})}),S&&(0,s.jsxs)("div",{ref:z,className:"absolute top-full right-0 mt-1 min-w-[152px] bg-card border border-border rounded-lg shadow-lg py-1 z-50",children:[(0,s.jsxs)("button",{className:"w-full flex items-center gap-2 px-3 py-1.5 text-sm text-foreground hover:bg-muted transition-colors text-left",onClick:()=>{C(!1),b.push("/view/Untitled.md")},children:[(0,s.jsx)(I.A,{size:14,className:"shrink-0"}),g.sidebar.newFile]}),(0,s.jsxs)("button",{className:"w-full flex items-center gap-2 px-3 py-1.5 text-sm text-foreground hover:bg-muted transition-colors text-left",onClick:()=>{C(!1),window.dispatchEvent(new Event("mindos:create-space"))},children:[(0,s.jsx)(L.A,{size:14,className:"shrink-0 text-[var(--amber)]"}),g.sidebar.newSpace]})]})]}),(0,s.jsx)("button",{type:"button",onClick:()=>x?.(),className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors focus-visible:ring-1 focus-visible:ring-ring","aria-label":g.sidebar.importFile,title:g.sidebar.importFile,children:(0,s.jsx)(O.A,{size:13})}),(0,s.jsx)("div",{className:"w-px h-3.5 bg-border mx-0.5"}),(0,s.jsx)("button",{onClick:()=>N(e=>Math.max(-1,(e??k)-1)),onDoubleClick:()=>{N(-1),ea()},className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors focus-visible:ring-1 focus-visible:ring-ring","aria-label":g.sidebar.collapseLevel,title:es?g.sidebar.collapseLevel:g.sidebar.collapseLevelHint??g.sidebar.collapseLevel,children:(0,s.jsx)(W.A,{size:13})}),(0,s.jsx)("button",{onClick:()=>N(e=>{let t=(e??0)+1;return t>k?null:t}),onDoubleClick:()=>{N(null),ea()},className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors focus-visible:ring-1 focus-visible:ring-ring","aria-label":g.sidebar.expandLevel,title:es?g.sidebar.expandLevel:g.sidebar.expandLevelHint??g.sidebar.expandLevel,children:(0,s.jsx)(B.A,{size:13})}),(0,s.jsx)("div",{className:"w-px h-3.5 bg-border mx-0.5"}),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("button",{ref:D,type:"button",onClick:()=>{C(!1),$(e=>!e)},className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors focus-visible:ring-1 focus-visible:ring-ring","aria-label":g.sidebar.more,title:g.sidebar.more,children:(0,s.jsx)(U.A,{size:13})}),E&&(0,s.jsxs)("div",{ref:R,className:"absolute top-full right-0 mt-1 min-w-[172px] bg-card border border-border rounded-lg shadow-lg py-1 z-50",children:[(0,s.jsxs)("button",{className:"w-full flex items-center gap-2 px-3 py-1.5 text-sm text-foreground hover:bg-muted transition-colors text-left",onClick:()=>{$(!1),b.push("/view/Inbox/")},children:[(0,s.jsx)(_.A,{size:14,className:"shrink-0 text-[var(--amber)]"}),(0,s.jsx)("span",{className:"flex-1",children:g.sidebar.capture}),V>0&&(0,s.jsx)("span",{className:"text-2xs font-medium tabular-nums px-1.5 py-px rounded-full bg-[var(--amber)]/10 text-[var(--amber)]/70",children:V})]}),(0,s.jsxs)("button",{className:"w-full flex items-center gap-2 px-3 py-1.5 text-sm text-foreground hover:bg-muted transition-colors text-left",onClick:()=>{$(!1),b.push("/view/.mindos/change-log.json")},children:[(0,s.jsx)(H.A,{size:14,className:"shrink-0 text-[var(--amber)]"}),(0,s.jsx)("span",{className:"flex-1",children:g.changes.title})]}),(0,s.jsxs)("button",{className:"w-full flex items-center gap-2 px-3 py-1.5 text-sm text-foreground hover:bg-muted transition-colors text-left",onClick:()=>{$(!1),b.push("/trash")},children:[(0,s.jsx)(X.A,{size:14,className:"shrink-0"}),(0,s.jsx)("span",{className:"flex-1",children:g.trash.title}),M>0&&(0,s.jsx)("span",{className:"text-xs text-muted-foreground tabular-nums",children:M})]}),(0,s.jsx)("div",{className:"my-1 border-t border-border/50"}),(0,s.jsxs)("button",{className:"w-full flex items-center gap-2 px-3 py-1.5 text-sm text-foreground hover:bg-muted transition-colors text-left",onClick:()=>{(0,J.Fo)(!P)},children:[P?(0,s.jsx)(K.A,{size:14,className:"shrink-0"}):(0,s.jsx)(Y.A,{size:14,className:"shrink-0"}),(0,s.jsx)("span",{className:"flex-1",children:g.sidebar.showHiddenFiles}),P&&(0,s.jsx)("span",{className:"text-[var(--amber)] text-xs",children:"✓"})]})]})]})]})}),(0,s.jsx)("div",{className:"flex-1 overflow-y-auto min-h-0 px-2 py-2",onDragEnter:e=>{e.dataTransfer.types.includes("Files")&&e.stopPropagation()},onDragOver:e=>{e.dataTransfer.types.includes("Files")&&(e.preventDefault(),e.stopPropagation())},onDrop:e=>{e.dataTransfer.types.includes("Files")&&(e.preventDefault(),e.stopPropagation())},children:(0,s.jsx)(J.Ay,{nodes:t,onNavigate:r,maxOpenDepth:w,onImport:x})}),(0,s.jsxs)("button",{type:"button",onClick:()=>b.push("/view/Inbox/"),className:`flex items-center gap-2 mx-2 px-2 py-1.5 text-sm rounded-lg transition-all duration-150 group shrink-0 ${y?"bg-[var(--amber-dim)] text-[var(--amber)]":"hover:bg-muted text-muted-foreground hover:text-foreground"}`,children:[(0,s.jsx)("div",{className:`flex items-center justify-center w-5 h-5 rounded-md shrink-0 transition-colors ${y?"bg-[var(--amber)]/15":"bg-transparent"}`,children:(0,s.jsx)(_.A,{size:13,className:`shrink-0 transition-colors ${y?"text-[var(--amber)]":"text-[var(--amber)]/60 group-hover:text-[var(--amber)]"}`})}),(0,s.jsx)("span",{className:`flex-1 text-left text-xs transition-colors ${y?"font-medium text-[var(--amber)]":"text-muted-foreground group-hover:text-foreground"}`,children:g.sidebar.capture}),V>0&&(0,s.jsx)("span",{className:`text-2xs font-medium tabular-nums px-1.5 py-px rounded-full transition-colors ${y?"bg-[var(--amber)]/15 text-[var(--amber)]":"bg-[var(--amber)]/10 text-[var(--amber)]/70"}`,children:V})]}),(0,s.jsx)(T,{collapsed:!1,onOpenSyncSettings:i})]}),p,!u&&d&&(0,s.jsx)("div",{className:"absolute top-0 -right-[3px] w-[6px] h-full cursor-col-resize z-40 group hidden md:block",onMouseDown:ei,children:(0,s.jsx)("div",{className:"absolute right-[2px] top-0 w-[2px] h-full opacity-0 group-hover:opacity-100 bg-[var(--amber)]/60 transition-opacity"})})]})}var en=r(33078),ea=r(91337),ei=r(14871);function eo({active:e,onNavigate:t,maximized:r,onMaximize:i}){let[o,l]=(0,a.useState)(""),[c,m]=(0,a.useState)([]),[x,p]=(0,a.useState)(!1),[h,f]=(0,a.useState)(0),[g,b]=(0,a.useState)(null),v=(0,a.useRef)(null),w=(0,n.useRouter)(),N=(0,a.useRef)(null),{t:S}=(0,j.Y)();(0,a.useEffect)(()=>{e&&setTimeout(()=>v.current?.focus(),50)},[e]);let C=(0,a.useCallback)(e=>{if(N.current&&clearTimeout(N.current),!e.trim()){m([]),p(!1);return}p(!0),N.current=setTimeout(async()=>{try{let t=await (0,k.n)(`/api/search?q=${encodeURIComponent(e)}`);m(Array.isArray(t)?t:[]),f(0)}catch{m([])}finally{p(!1)}},300)},[]),A=(0,a.useCallback)(e=>{let t=e.target.value;l(t),C(t)},[C]),z=(0,a.useCallback)(e=>{w.push(`/view/${(0,ea.O0)(e.path)}`),t?.()},[w,t]),E=(0,a.useCallback)(e=>{"ArrowDown"===e.key?(e.preventDefault(),f(e=>Math.min(e+1,c.length-1))):"ArrowUp"===e.key?(e.preventDefault(),f(e=>Math.max(e-1,0))):"Enter"===e.key&&c[h]&&z(c[h])},[c,h,z]),$=(0,a.useCallback)((e,t)=>{e.dataTransfer.effectAllowed="copy",e.dataTransfer.setData("text/mindos-path",t.path),e.dataTransfer.setData("text/mindos-type","file");let r=new Image;e.dataTransfer.setDragImage(r,0,0)},[]),T=(0,a.useCallback)(()=>{b(null)},[]);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(q,{title:"Search",maximized:r,onMaximize:i}),(0,s.jsxs)("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-border shrink-0 overflow-hidden",children:[(0,s.jsx)(d.A,{size:16,className:"text-muted-foreground shrink-0 flex-none"}),(0,s.jsx)("input",{ref:v,type:"text",value:o,onChange:A,onKeyDown:E,placeholder:S.search.placeholder,"aria-label":S.search.placeholder,className:"flex-1 min-w-0 bg-transparent text-foreground text-base font-medium placeholder:text-muted-foreground/60 outline-none"}),x&&(0,s.jsx)("div",{className:"w-4 h-4 border-2 border-muted-foreground/30 border-t-foreground rounded-full animate-spin shrink-0 flex-none"}),!x&&o&&(0,s.jsx)("button",{onClick:()=>{l(""),m([]),v.current?.focus()},className:"shrink-0 flex-none p-1 text-muted-foreground hover:text-foreground transition-colors","aria-label":S.search.clear,children:(0,s.jsx)(u.A,{size:16})})]}),(0,s.jsxs)("div",{className:"flex-1 overflow-y-auto min-h-0",role:"listbox","aria-label":"Search results",children:[0===c.length&&!o&&!x&&(0,s.jsxs)("div",{className:"flex flex-col items-center justify-center px-4 py-12 text-center",children:[(0,s.jsx)("div",{className:"flex items-center justify-center w-12 h-12 rounded-lg bg-muted mb-4",children:(0,s.jsx)(d.A,{size:20,className:"text-muted-foreground/60"})}),(0,s.jsx)("h3",{className:"text-sm font-medium text-foreground mb-1",children:S.search.emptyTitle}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground/70",children:S.search.emptyHint})]}),0===c.length&&o&&!x&&(0,s.jsxs)("div",{className:"flex flex-col items-center justify-center px-4 py-12 text-center",children:[(0,s.jsx)("div",{className:"flex items-center justify-center w-12 h-12 rounded-lg bg-muted mb-4",children:(0,s.jsx)(d.A,{size:20,className:"text-muted-foreground/60"})}),(0,s.jsx)("h3",{className:"text-sm font-medium text-foreground mb-1",children:S.search.noResults}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground/70",children:S.search.noResultsHint})]}),x&&0===c.length&&(0,s.jsx)("div",{className:"space-y-2 p-3",children:[1,2,3].map(e=>(0,s.jsxs)("div",{className:"px-3 py-2.5 space-y-2 animate-pulse",children:[(0,s.jsx)("div",{className:"h-4 bg-muted rounded-md w-3/4"}),(0,s.jsx)("div",{className:"h-3 bg-muted rounded-md w-1/2"}),(0,s.jsx)("div",{className:"h-3 bg-muted rounded-md w-2/3"})]},e))}),c.length>0&&(0,s.jsx)(ei.aY,{totalCount:c.length,overscan:100,itemContent:e=>{let t,r=c[e],n=r.path.endsWith(".csv")?".csv":".md",{name:a,breadcrumb:i}={name:(t=r.path.split("/").filter(Boolean))[t.length-1],breadcrumb:t.slice(0,-1)},l=e===h,d=e===g;return(0,s.jsxs)("button",{role:"option","aria-selected":l,draggable:!0,onDragStart:e=>$(e,r),onDragEnd:T,onDragEnter:()=>b(e),onDragLeave:()=>b(null),onClick:()=>z(r),onMouseEnter:()=>f(e),className:`
|
|
81
81
|
w-full px-3 py-2.5 flex items-start gap-3 text-left transition-colors duration-100
|
|
82
82
|
border-b border-border/50
|
|
83
83
|
${l?"bg-[var(--amber-dim)] border-l-2 border-[var(--amber)]":"border-l-2 border-transparent"}
|
|
84
84
|
${d?"bg-muted/70":l?"":"hover:bg-muted/60"}
|
|
85
|
-
`,children:[(0,s.jsx)("div",{className:"shrink-0 flex-none mt-0.5",children:".csv"===n?(0,s.jsx)(
|
|
85
|
+
`,children:[(0,s.jsx)("div",{className:"shrink-0 flex-none mt-0.5",children:".csv"===n?(0,s.jsx)(en.A,{size:14,className:"text-success"}):(0,s.jsx)(I.A,{size:14,className:"text-muted-foreground"})}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("div",{className:"text-sm font-semibold text-foreground truncate",title:a,children:a}),i.length>0&&(0,s.jsx)("div",{className:"flex items-center gap-1 mt-0.5 text-xs text-muted-foreground/70 truncate",children:i.map((e,t)=>(0,s.jsxs)("span",{className:"flex items-center gap-1",children:[t>0&&(0,s.jsx)(y.A,{size:10,className:"shrink-0 flex-none"}),(0,s.jsx)("span",{className:"truncate",children:e})]},t))}),r.snippet&&(0,s.jsx)("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-2 leading-relaxed",title:r.snippet,children:function(e,t){if(!t.trim())return e;let r=t.trim().split(/\s+/).filter(Boolean).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),n=RegExp(`(${r.join("|")})`,"gi");return e.split(n).map((e,t)=>n.test(e)?(0,s.jsx)("mark",{className:"bg-[var(--amber)]/25 text-foreground rounded-sm px-0.5",children:e},t):e)}(r.snippet,o)})]}),l&&!d&&(0,s.jsx)("div",{className:"shrink-0 flex-none text-[10px] text-muted-foreground/50 font-mono pt-0.5",children:"⬆ Drag"})]})}})]}),c.length>0&&(0,s.jsxs)("div",{className:"px-3 py-2 border-t border-border/50 flex items-center gap-2 text-xs text-muted-foreground/60 shrink-0",children:[(0,s.jsxs)("span",{children:[(0,s.jsx)("kbd",{className:"font-mono text-[10px] px-1 py-0.5 bg-muted/40 rounded",children:"↑↓"})," ",S.search.navigate]}),(0,s.jsxs)("span",{children:[(0,s.jsx)("kbd",{className:"font-mono text-[10px] px-1 py-0.5 bg-muted/40 rounded",children:"↵"})," ",S.search.open]}),(0,s.jsx)("span",{className:"text-muted-foreground/40 mx-0.5",children:"•"}),(0,s.jsxs)("span",{children:[(0,s.jsx)("kbd",{className:"font-mono text-[10px] px-1 py-0.5 bg-muted/40 rounded",children:"Drag"})," ",S.search.dragToChat]})]})]})}var el=r(6296),ed=r(92451),ec=r(70617),eu=r(2857),em=r(98401),ex=r(15573),ep=r(96035);function eh({icon:e,title:t,subtitle:r,badge:n,href:a,onClick:i,active:l}){let d=(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-muted text-muted-foreground",children:e}),(0,s.jsxs)("span",{className:"flex-1 min-w-0",children:[(0,s.jsx)("span",{className:"block text-left text-sm font-medium text-foreground truncate",title:t,children:t}),r?(0,s.jsx)("span",{className:"block text-left text-2xs text-muted-foreground truncate",title:r,children:r}):null]}),n,(0,s.jsx)(y.A,{size:14,className:"shrink-0 text-muted-foreground"})]}),c=!!l,u=(0,ea.cn)("relative flex items-center gap-3 py-2.5 transition-[background-color] duration-150 rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",c?"bg-[var(--amber-dim)]/40 pl-3.5 pr-4 text-foreground":"px-4",!c&&"cursor-pointer hover:bg-muted/50",c&&"cursor-default"),m=c?(0,s.jsx)("span",{className:"pointer-events-none absolute bottom-[22%] left-0 top-[22%] w-0.5 rounded-r-full bg-[var(--amber)]","aria-hidden":!0}):null;return a?(0,s.jsxs)(o(),{href:a,className:u,"aria-current":l?"page":void 0,children:[m,d]}):(0,s.jsxs)("button",{type:"button",onClick:i,className:(0,ea.cn)(u,"w-full"),children:[m,d]})}function ef({label:e}){return(0,s.jsx)("span",{className:"text-2xs px-2 py-0.5 rounded-full bg-muted text-muted-foreground shrink-0",children:e})}function eg({copy:e,connectedCount:t,mcpEnabled:r=!0,channelsActive:a=!1,onChannelsClick:i}){let o=(0,n.usePathname)(),l=(0,n.useSearchParams)().get("tab"),d="/agents"===o,c=!a;return(0,s.jsxs)("div",{className:"py-2",children:[(0,s.jsx)(eh,{icon:(0,s.jsx)(em.A,{size:14,className:c&&d&&(null===l||"overview"===l)?"text-[var(--amber)]":"text-muted-foreground"}),title:e.navOverview,badge:(0,s.jsx)("span",{className:"text-2xs tabular-nums text-muted-foreground/60 px-1.5 py-0.5 rounded bg-muted/40 font-medium",children:t}),href:"/agents",active:c&&d&&(null===l||"overview"===l)}),r&&(0,s.jsx)(eh,{icon:(0,s.jsx)(ex.A,{size:14,className:c&&d&&"mcp"===l?"text-[var(--amber)]":"text-muted-foreground"}),title:e.navMcp,href:"/agents?tab=mcp",active:c&&d&&"mcp"===l}),(0,s.jsx)(eh,{icon:(0,s.jsx)(f.A,{size:14,className:c&&d&&"skills"===l?"text-[var(--amber)]":"text-muted-foreground"}),title:e.navSkills,href:"/agents?tab=skills",active:c&&d&&"skills"===l}),(0,s.jsx)(eh,{icon:(0,s.jsx)(ep.A,{size:14,className:a?"text-[var(--amber)]":"text-muted-foreground"}),title:e.navChannels,onClick:i,active:a}),(0,s.jsx)(eh,{icon:(0,s.jsx)(ed.A,{size:14,className:c&&d&&"a2a"===l?"text-[var(--amber)]":"text-muted-foreground"}),title:e.navNetwork,href:"/agents?tab=a2a",active:c&&d&&"a2a"===l})]})}var eb=r(66088),ev=r(94514),ey=r(20986),ej=r(39498);function ew({agent:e,agentStatus:t,selected:r=!1,detailHref:n,onInstallAgent:a,copy:i,isA2aReady:l=!1,a2aTooltip:d}){return(0,s.jsxs)("div",{className:`
|
|
86
86
|
group flex items-center gap-0 rounded-xl border transition-all duration-150
|
|
87
87
|
${r?"border-border ring-2 ring-ring/50 bg-[var(--amber-dim)]/45":"border-border/70 bg-card/50 hover:border-border hover:bg-muted/25"}
|
|
88
|
-
`,children:[(0,s.jsxs)(o(),{href:n,className:"flex flex-1 min-w-0 items-center gap-2.5 text-left rounded-xl pl-2.5 pr-2 py-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[(0,s.jsx)(
|
|
88
|
+
`,children:[(0,s.jsxs)(o(),{href:n,className:"flex flex-1 min-w-0 items-center gap-2.5 text-left rounded-xl pl-2.5 pr-2 py-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[(0,s.jsx)(ej.lx,{name:e.name,status:t,size:"sm"}),(0,s.jsx)("span",{className:"text-sm font-medium text-foreground truncate leading-tight",children:e.name}),"connected"===t&&e.transport&&(0,s.jsx)("span",{className:"text-2xs font-mono tabular-nums px-1.5 py-0.5 rounded-md bg-muted/90 text-muted-foreground shrink-0 border border-border/50",children:e.transport}),l&&(0,s.jsx)("span",{title:d,className:"shrink-0 text-muted-foreground/70",children:(0,s.jsx)(ed.A,{size:12})}),(0,s.jsx)("span",{className:"flex-1 min-w-[4px]"}),(0,s.jsx)(y.A,{size:15,className:`shrink-0 transition-opacity duration-150 ${r?"text-[var(--amber)] opacity-90":"text-muted-foreground/45 group-hover:text-muted-foreground/80"}`,"aria-hidden":!0})]}),"detected"===t&&(0,s.jsx)("div",{className:"pr-2 py-2 shrink-0",children:(0,s.jsx)(eN,{agentKey:e.key,agentName:e.name,onInstallAgent:a,copy:i})})]})}function eN({agentKey:e,agentName:t,onInstallAgent:r,copy:n}){let[i,o]=(0,a.useState)(!1),[l,d]=(0,a.useState)("idle"),c=async t=>{if(t.stopPropagation(),i)return;o(!0),d("idle");let s=await r(e);o(!1),d(s?"success":"error")},u="error"===l,m="success"===l,x=i?n.installing:m?n.installSuccess:u?n.retryInstall:n.install;return(0,s.jsxs)("button",{type:"button",onClick:c,disabled:i,className:`flex items-center gap-1 px-2 py-1.5 text-2xs rounded-lg font-medium text-white disabled:opacity-50 transition-colors shrink-0 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring ${u?"bg-error hover:bg-error/90":m?"bg-success hover:bg-success/90":"bg-[var(--amber)] hover:bg-[var(--amber)]/90"}`,"aria-label":`${t} ${x}`,children:[i?(0,s.jsx)(el.A,{size:10,className:"animate-spin"}):null,!i&&m?(0,s.jsx)(ev.A,{size:10}):null,!i&&u?(0,s.jsx)(ey.A,{size:10}):null,x,(0,s.jsx)("span",{className:"sr-only","aria-live":"polite",children:u?n.installFailed:""})]})}function ek({connected:e,detected:t,notFound:r,selectedAgentKey:n,onInstallAgent:a,listCopy:i,showNotDetected:o,setShowNotDetected:l,p:d}){return(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"px-0 py-1.5 mb-1",children:(0,s.jsx)("span",{className:"text-2xs font-semibold text-muted-foreground/70 uppercase tracking-wider",children:d.rosterLabel})}),e.length>0&&(0,s.jsxs)("section",{className:"mb-3",children:[(0,s.jsxs)("h3",{className:"flex items-center gap-1.5 text-[11px] font-medium text-muted-foreground/80 uppercase tracking-wider mb-2 pl-0.5",children:[(0,s.jsx)("span",{className:"w-1 h-3 rounded-full bg-[var(--success)]/50","aria-hidden":"true"}),d.sectionConnected," ",(0,s.jsxs)("span",{className:"text-muted-foreground/50 tabular-nums",children:["(",e.length,")"]})]}),(0,s.jsx)("div",{className:"space-y-1.5",children:e.map(e=>(0,s.jsx)(ew,{agent:e,agentStatus:"connected",selected:n===e.key,detailHref:`/agents/${encodeURIComponent(e.key)}`,onInstallAgent:a,copy:i},e.key))})]}),t.length>0&&(0,s.jsxs)("section",{className:"mb-3",children:[(0,s.jsxs)("h3",{className:"flex items-center gap-1.5 text-[11px] font-medium text-muted-foreground/80 uppercase tracking-wider mb-2 pl-0.5",children:[(0,s.jsx)("span",{className:"w-1 h-3 rounded-full bg-[var(--amber)]/50","aria-hidden":"true"}),d.sectionDetected," ",(0,s.jsxs)("span",{className:"text-muted-foreground/50 tabular-nums",children:["(",t.length,")"]})]}),(0,s.jsx)("div",{className:"space-y-1.5",children:t.map(e=>(0,s.jsx)(ew,{agent:e,agentStatus:"detected",selected:n===e.key,detailHref:`/agents/${encodeURIComponent(e.key)}`,onInstallAgent:a,copy:i},e.key))})]}),r.length>0&&(0,s.jsxs)("section",{children:[(0,s.jsxs)("button",{type:"button",onClick:()=>l(!o),className:"flex items-center gap-1 text-[11px] font-medium text-muted-foreground uppercase tracking-wider mb-2 hover:text-foreground transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded-sm pl-0.5",children:[o?(0,s.jsx)(eb.A,{size:12}):(0,s.jsx)(y.A,{size:12}),d.sectionNotDetected," (",r.length,")"]}),o&&(0,s.jsx)("div",{className:"space-y-1.5",children:r.map(e=>(0,s.jsx)(ew,{agent:e,agentStatus:"notFound",selected:n===e.key,detailHref:`/agents/${encodeURIComponent(e.key)}`,onInstallAgent:a,copy:i},e.key))})]})]})}var eS=r(66709),eC=r(13545),eA=r(16950),ez=r(12413);function eE(){let{t:e}=(0,j.Y)(),t=e.panels.im,r=(0,n.useSearchParams)().get("platform"),[i,l]=(0,a.useState)([]),[d,c]=(0,a.useState)(!0),[u,m]=(0,a.useState)(!1),x=(0,a.useCallback)(async()=>{m(!1);try{let e=await fetch("/api/im/status");if(e.ok){let t=await e.json();l(t.platforms??[])}else m(!0)}catch{m(!0)}c(!1)},[]);if((0,a.useEffect)(()=>{x()},[x]),d)return(0,s.jsx)("div",{className:"flex justify-center py-8",children:(0,s.jsx)(el.A,{size:16,className:"animate-spin text-muted-foreground"})});if(u)return(0,s.jsxs)("div",{className:"flex flex-col items-center gap-2 py-8 px-3",children:[(0,s.jsx)(eC.A,{size:16,className:"text-muted-foreground"}),(0,s.jsx)("p",{className:"text-2xs text-muted-foreground",children:t.fetchError}),(0,s.jsxs)("button",{type:"button",onClick:()=>{c(!0),x()},className:"inline-flex items-center gap-1 text-2xs text-muted-foreground hover:text-foreground transition-colors",children:[(0,s.jsx)(b.A,{size:11})," ",t.retry]})]});let p=i.filter(e=>e.connected).length;return(0,s.jsxs)("div",{className:"flex flex-col py-1",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 mb-0.5",children:[(0,s.jsx)("span",{className:"text-2xs font-medium text-muted-foreground uppercase tracking-wider",children:t.title}),p>0&&(0,s.jsxs)("span",{className:"text-2xs text-muted-foreground/60",children:[p," ",t.connected]})]}),(0,s.jsx)("div",{className:"flex flex-col",children:ez.P.map(({id:e,name:t,icon:n})=>{let a=i.find(t=>t.platform===e),l=a?.connected??!1,d=r===e;return(0,s.jsxs)(o(),{href:`/agents?tab=channels&platform=${e}`,className:`
|
|
89
89
|
relative flex items-center gap-2.5 px-3 py-2 text-left rounded-sm transition-colors
|
|
90
90
|
${d?"bg-[var(--amber-dim)]/40 pl-3.5":"hover:bg-muted/50"}
|
|
91
|
-
`,children:[d&&(0,s.jsx)("span",{className:"pointer-events-none absolute bottom-[22%] left-0 top-[22%] w-0.5 rounded-r-full bg-[var(--amber)]","aria-hidden":!0}),(0,s.jsx)("span",{className:"text-sm",children:n}),(0,s.jsx)("span",{className:"text-sm flex-1 truncate text-foreground",children:t}),l?(0,s.jsx)(w.A,{size:14,className:"text-success shrink-0"}):(0,s.jsx)(eC.A,{size:14,className:"text-border shrink-0"})]},e)})})]})}function eE({active:e,maximized:t,onMaximize:r,selectedAgentKey:i=null}){let{t:o}=(0,j.Y)(),l=o.panels.agents,d=(0,ed.kr)(),u=(0,n.usePathname)(),m=(0,n.useSearchParams)(),x="/agents"===u&&"channels"===m.get("tab"),[p,f]=(0,a.useState)(!1),[h,g]=(0,a.useState)(!1),[v,y]=(0,a.useState)(!1),w=(0,ec.V)(),N=async()=>{f(!0),await d.refresh(),f(!1)},k=d.agents.filter(e=>e.present&&e.installed),S=d.agents.filter(e=>e.present&&!e.installed),C=d.agents.filter(e=>!e.present),A=async e=>{let t=await d.installAgent(e);return t&&await d.refresh(),t},z=u?.startsWith("/agents/")?decodeURIComponent(u.slice(8)):null,E={installing:l.installing,install:l.install,installSuccess:l.installSuccess,installFailed:l.installFailed,retryInstall:l.retryInstall},$={navOverview:l.navOverview,navMcp:l.navMcp,navSkills:l.navSkills,navChannels:l.channels,navNetwork:l.navNetwork,navSessions:l.navSessions,navActivity:l.navActivity},T=(0,s.jsx)(eh,{copy:$,connectedCount:k.length,mcpEnabled:d.status?.connectionMode?.mcp??!1});return(0,s.jsxs)("div",{className:`flex flex-col h-full ${e?"":"hidden"}`,children:[(0,s.jsx)(q,{title:l.title,maximized:t,onMaximize:r,children:(0,s.jsxs)("div",{className:"flex items-center gap-1.5",children:[!d.loading&&(0,s.jsxs)("span",{className:"text-2xs text-muted-foreground",children:[k.length," ",l.connected,w.agents.length>0&&(0,s.jsxs)(s.Fragment,{children:[" \xb7 ",l.a2aLabel," ",w.agents.length]})]}),(0,s.jsx)("button",{onClick:N,disabled:p,className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground disabled:opacity-50 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":l.refresh,title:l.refresh,type:"button",children:(0,s.jsx)(b.A,{size:12,className:p?"animate-spin":""})})]})}),(0,s.jsx)("div",{className:"flex-1 overflow-y-auto min-h-0",children:d.loading?(0,s.jsx)("div",{className:"flex justify-center py-8",children:(0,s.jsx)(eo.A,{size:16,className:"animate-spin text-muted-foreground"})}):0===d.agents.length&&0===d.skills.length?(0,s.jsxs)("div",{className:"flex flex-col gap-2 py-4 px-0",children:[T,(0,s.jsx)("div",{className:"mx-4 border-t border-border"}),(0,s.jsxs)("div",{className:"mx-3 rounded-lg border border-border/40 bg-card/30 px-3 py-5 text-center",children:[(0,s.jsx)("p",{className:"text-xs text-muted-foreground/70 mb-1.5",children:l.noAgents}),(0,s.jsx)("p",{className:"text-2xs text-muted-foreground/40 mb-3",children:l.skillsEmptyHint}),(0,s.jsxs)("button",{onClick:N,type:"button",className:"inline-flex items-center gap-1.5 px-2.5 py-1.5 text-xs rounded-lg border border-border text-muted-foreground hover:text-foreground hover:bg-muted transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[(0,s.jsx)(b.A,{size:11})," ",l.retry]})]})]}):(0,s.jsxs)("div",{className:"pb-3",children:[T,(0,s.jsx)("div",{className:"mx-4 border-t border-border"}),x?(0,s.jsx)(ez,{}):(0,s.jsx)("div",{className:"px-3 py-3 space-y-4",children:(0,s.jsx)(eN,{connected:k,detected:S,notFound:C,selectedAgentKey:z??i,listCopy:E,onInstallAgent:A,showNotDetected:h,setShowNotDetected:g,p:{rosterLabel:l.rosterLabel,sectionConnected:l.sectionConnected,sectionDetected:l.sectionDetected,sectionNotDetected:l.sectionNotDetected}})})]})}),(0,s.jsxs)("div",{className:"px-3 py-2 border-t border-border shrink-0 space-y-1",children:[(0,s.jsxs)("button",{type:"button",onClick:()=>y(!0),className:"flex items-center gap-1.5 text-2xs text-muted-foreground hover:text-foreground transition-colors w-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded-sm",children:[(0,s.jsx)(el.A,{size:11}),l.a2aDiscover]}),(0,s.jsxs)("button",{type:"button",onClick:()=>{window.dispatchEvent(new CustomEvent("mindos:open-settings",{detail:{tab:"mcp"}}))},className:"flex items-center gap-1.5 text-2xs text-muted-foreground hover:text-foreground transition-colors w-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded-sm",children:[(0,s.jsx)(c.A,{size:11}),l.advancedConfig]})]}),(0,s.jsx)(ek.A,{open:v,onClose:()=>y(!1),onDiscover:w.discover,discovering:w.discovering,error:w.error})]})}var e$=r(42869),eT=r(6962),eD=r(5121),eR=r(31885),eP=r(65266),eM=r(4903),eF=r(44478),eI=r(14780),eL=r(95057),eO=r(20555),eW=r(27318),eB=r(46838),eU=r(20171);function e_({icon:e,title:t,prompt:r,tryLabel:n}){return(0,s.jsxs)("div",{className:"group flex items-center gap-2.5 px-4 py-1.5 hover:bg-muted/50 transition-colors rounded-sm mx-1",children:[(0,s.jsx)("span",{className:"text-muted-foreground shrink-0",children:e}),(0,s.jsx)("span",{className:"text-xs text-foreground truncate flex-1",title:t,children:t}),(0,s.jsx)("button",{onClick:()=>(0,eW.NH)(r,"user"),className:"opacity-0 group-hover:opacity-100 text-2xs px-2 py-0.5 rounded text-[var(--amber-text)] bg-[var(--amber-dim)] hover:opacity-80 transition-all duration-150 shrink-0",children:n})]})}let eH={c1:(0,s.jsx)(e$.A,{size:12}),c2:(0,s.jsx)(eT.A,{size:12}),c3:(0,s.jsx)(b.A,{size:12}),c4:(0,s.jsx)(eD.A,{size:12}),c5:(0,s.jsx)(eR.A,{size:12}),c6:(0,s.jsx)(eP.A,{size:12}),c7:(0,s.jsx)(d.A,{size:12}),c8:(0,s.jsx)(eM.A,{size:12}),c9:(0,s.jsx)(eF.A,{size:12})};function eK({active:e,maximized:t,onMaximize:r}){let{t:i}=(0,j.Y)(),o=i.panels.discover,l=i.explore,d=i.panels.plugins,c=(0,n.useRouter)(),[u,m]=(0,a.useState)(!1),[x,p]=(0,a.useState)(!1),[,f]=(0,a.useState)(0),[g,b]=(0,a.useState)(new Set),v=(0,a.useRef)(!1);(0,a.useEffect)(()=>{(0,eB.UG)(),m(!0)},[]),(0,a.useEffect)(()=>{if(!u||v.current)return;v.current=!0;let e=(0,eB.MZ)().map(e=>e.entryPath).filter(e=>!!e);0!==e.length&&fetch("/api/files").then(e=>e.ok?e.json():[]).then(t=>{let r=new Set(t);b(new Set(e.filter(e=>r.has(e))))}).catch(e=>{console.warn("[DiscoverPanel] fetch /api/files failed:",e)})},[u]);let y=(0,a.useCallback)((e,t)=>{(0,eB.$7)(e,t),f(e=>e+1),window.dispatchEvent(new Event("renderer-state-changed"))},[]),w=(0,a.useCallback)(e=>{c.push(`/view/${e.split("/").map(encodeURIComponent).join("/")}`)},[c]),N=u?(0,eB.MZ)():[],k=u?N.filter(e=>(0,eB.pl)(e.id)).length:0;return(0,s.jsxs)("div",{className:`flex flex-col h-full ${e?"":"hidden"}`,children:[(0,s.jsx)(q,{title:o.title,maximized:t,onMaximize:r}),(0,s.jsxs)("div",{className:"flex-1 overflow-y-auto min-h-0",children:[(0,s.jsxs)("div",{className:"py-2",children:[(0,s.jsx)(ep,{icon:(0,s.jsx)(eR.A,{size:14,className:"text-[var(--amber)]"}),title:o.useCases,badge:(0,s.jsx)("span",{className:"text-2xs tabular-nums text-muted-foreground",children:eO.LD.length}),href:"/explore"}),(0,s.jsx)(ep,{icon:(0,s.jsx)(eI.A,{size:14,className:"text-muted-foreground"}),title:o.pluginMarket,badge:(0,s.jsx)(ef,{label:o.comingSoon})}),(0,s.jsx)(ep,{icon:(0,s.jsx)(h.A,{size:14,className:"text-muted-foreground"}),title:o.skillMarket,badge:(0,s.jsx)(ef,{label:o.comingSoon})}),(0,s.jsx)(ep,{icon:(0,s.jsx)(eL.A,{size:14,className:"text-muted-foreground"}),title:o.spaceTemplates,badge:(0,s.jsx)(ef,{label:o.comingSoon})})]}),(0,s.jsx)("div",{className:"mx-4 border-t border-border"}),(0,s.jsxs)("div",{className:"py-2",children:[(0,s.jsxs)("button",{type:"button",onClick:()=>p(e=>!e),className:"w-full flex items-center gap-1.5 px-4 py-1.5 text-left",children:[(0,s.jsx)(eg.A,{size:11,className:`text-muted-foreground transition-transform duration-150 ${x?"":"-rotate-90"}`}),(0,s.jsx)(eI.A,{size:13,className:"text-muted-foreground shrink-0"}),(0,s.jsx)("span",{className:"text-2xs font-medium text-muted-foreground uppercase tracking-wider flex-1",children:d.title}),(0,s.jsxs)("span",{className:"text-2xs text-muted-foreground tabular-nums",children:[k,"/",N.length]})]}),(0,s.jsx)("div",{className:`grid transition-[grid-template-rows] duration-200 ease-out ${x?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,children:(0,s.jsx)("div",{className:"overflow-hidden",...!x&&{inert:!0},children:N.map(e=>{let t=(0,eB.pl)(e.id),r=!!e.entryPath&&g.has(e.entryPath),n=t&&e.entryPath&&r;return(0,s.jsxs)("div",{className:`flex items-center gap-2 px-4 py-1.5 mx-1 rounded-sm transition-colors ${n?"cursor-pointer hover:bg-muted/50":""} ${!t?"opacity-50":""}`,onClick:n?()=>w(e.entryPath):void 0,role:n?"link":void 0,tabIndex:n?0:void 0,onKeyDown:n?t=>{("Enter"===t.key||" "===t.key)&&(t.preventDefault(),w(e.entryPath))}:void 0,children:[(0,s.jsx)("span",{className:"text-sm shrink-0",suppressHydrationWarning:!0,children:e.icon}),(0,s.jsx)("span",{className:"text-xs text-foreground truncate flex-1",title:e.name,children:e.name}),e.core?(0,s.jsx)("span",{className:"text-2xs px-1.5 py-0.5 rounded bg-muted text-muted-foreground shrink-0",children:d.core}):(0,s.jsx)("div",{onClick:e=>e.stopPropagation(),children:(0,s.jsx)(eU.lM,{checked:t,onChange:t=>y(e.id,t),size:"sm"})})]},e.id)})})})]}),(0,s.jsx)("div",{className:"mx-4 border-t border-border"}),(0,s.jsxs)("div",{className:"py-2",children:[(0,s.jsx)("div",{className:"px-4 py-1.5",children:(0,s.jsx)("span",{className:"text-2xs font-medium text-muted-foreground uppercase tracking-wider",children:o.useCases})}),eO.LD.map(e=>{var t;let r=(t=e.id,({c1:l.c1,c2:l.c2,c3:l.c3,c4:l.c4,c5:l.c5,c6:l.c6,c7:l.c7,c8:l.c8,c9:l.c9})[t]);return r?(0,s.jsx)(e_,{icon:eH[e.id]||(0,s.jsx)(eR.A,{size:12}),title:r.title,prompt:r.prompt,tryLabel:o.tryIt},e.id):null})]})]})]})}var eY=r(1770),eJ=r(90718),eG=r(44071);function eV(){let[e,t]=(0,a.useState)(null),[r,n]=(0,a.useState)([]),[i,o]=(0,a.useState)(!0),{t:l}=(0,j.Y)();return((0,a.useEffect)(()=>{let e=async()=>{try{o(!0);let[e,r,s]=await Promise.all([(0,k.n)("/api/monitoring"),(0,k.n)("/api/changes?op=list&limit=3"),(0,k.n)("/api/ask-sessions")]);t({fileCount:e?.knowledgeBase?.fileCount??0,unreadChanges:r?.events?.length??0,sessionCount:Array.isArray(s)?s.length:0}),n((r?.events??[]).slice(0,3))}catch(e){console.warn("[EchoSidebarStats] Failed to load stats:",e),t({fileCount:0,unreadChanges:0,sessionCount:0}),n([])}finally{o(!1)}};e();let r=setInterval(e,1e4);return()=>clearInterval(r)},[]),i||!e)?(0,s.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:(0,s.jsx)("div",{className:"h-2 w-20 bg-muted rounded animate-pulse"})}):(0,s.jsxs)("div",{className:"flex flex-col gap-2 px-3 py-3 border-t border-border",children:[(0,s.jsxs)("div",{className:"grid grid-cols-3 gap-2",children:[(0,s.jsxs)("div",{className:"flex flex-col items-center p-1.5 rounded bg-muted/40 hover:bg-muted/60 transition-colors cursor-default",children:[(0,s.jsx)("div",{className:"text-sm font-semibold text-foreground",children:e.fileCount}),(0,s.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:"Files"})]}),(0,s.jsxs)("div",{className:"flex flex-col items-center p-1.5 rounded bg-muted/40 hover:bg-muted/60 transition-colors cursor-default",children:[(0,s.jsx)("div",{className:"text-sm font-semibold text-foreground",children:e.unreadChanges}),(0,s.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:"Changes"})]}),(0,s.jsxs)("div",{className:"flex flex-col items-center p-1.5 rounded bg-muted/40 hover:bg-muted/60 transition-colors cursor-default",children:[(0,s.jsx)("div",{className:"text-sm font-semibold text-foreground",children:e.sessionCount}),(0,s.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:"Chats"})]})]}),r.length>0&&(0,s.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,s.jsx)("div",{className:"text-xs font-medium text-muted-foreground px-0.5",children:"Recent"}),r.map(e=>{let t=function(e){try{let t=new Date(e),r=new Date().getTime()-t.getTime(),s=Math.floor(r/6e4),n=Math.floor(r/36e5),a=Math.floor(r/864e5);if(s<1)return"now";if(s<60)return`${s}m ago`;if(n<24)return`${n}h ago`;if(a<7)return`${a}d ago`;return t.toLocaleDateString("en-US",{month:"short",day:"numeric"})}catch{return"recently"}}(e.ts),r=function(e){switch(e){case"create":return(0,s.jsx)(eG.A,{size:12,className:"text-success"});case"write":case"append":return(0,s.jsx)(eS.A,{size:12,className:"text-foreground"});case"delete":return(0,s.jsx)(eS.A,{size:12,className:"text-destructive"});case"rename":case"move":return(0,s.jsx)(ex.A,{size:12,className:"text-muted-foreground"});default:return(0,s.jsx)(eS.A,{size:12,className:"text-muted-foreground"})}}(e.op),n=e.path.split("/").pop()||e.path;return(0,s.jsxs)("div",{className:"flex items-start gap-2 p-1.5 rounded hover:bg-muted/40 transition-colors text-xs",children:[(0,s.jsx)("span",{className:"text-muted-foreground shrink-0 mt-0.5",children:r}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("p",{className:"text-foreground truncate font-medium",title:n,children:n}),(0,s.jsx)("p",{className:"text-muted-foreground text-2xs",children:t})]})]},e.id)})]})]})}var eq=r(16518);function eX({active:e,maximized:t,onMaximize:r}){let{t:a}=(0,j.Y)(),i=a.panels.echo,o=(0,n.usePathname)()??"",l={imprint:{icon:(0,s.jsx)(eY.A,{size:14}),title:i.imprintTitle},growth:{icon:(0,s.jsx)(eJ.A,{size:14}),title:i.growthTitle},self:{icon:(0,s.jsx)(H.A,{size:14}),title:i.selfTitle}};return(0,s.jsxs)("div",{className:`flex flex-col h-full ${e?"":"hidden"}`,children:[(0,s.jsx)(q,{title:i.title,maximized:t,onMaximize:r}),(0,s.jsxs)("div",{className:"flex-1 overflow-y-auto min-h-0 flex flex-col",children:[(0,s.jsx)("div",{className:"flex flex-col gap-0.5 py-1.5",children:eq.RS.map(e=>{let t=l[e],r=eq.AI[e],n=o===r||o.startsWith(`${r}/`);return(0,s.jsx)(ep,{href:r,icon:t.icon,title:t.title,active:n},e)})}),(0,s.jsx)("div",{className:"mt-auto",children:(0,s.jsx)(eV,{})})]})]})}var eZ=r(41585);function eQ({active:e,maximized:t,onMaximize:r}){let{t:n}=(0,j.Y)(),i=n.panels.workflows,[l,d]=(0,a.useState)([]),[c,u]=(0,a.useState)(!0),[m,x]=(0,a.useState)(!1),[p,f]=(0,a.useState)(""),[g,b]=(0,a.useState)(!1),[v,y]=(0,a.useState)(""),w=(0,a.useCallback)(async()=>{try{let e=await fetch("/api/workflows");if(!e.ok)return;let t=await e.json();d(t.workflows??[])}catch{}finally{u(!1)}},[]);(0,a.useEffect)(()=>{e&&w()},[e,w]);let N=async()=>{let e=p.trim();if(e&&!g){b(!0),y("");try{let t=await fetch("/api/workflows",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e})}),r=await t.json();if(!t.ok)return void y(409===t.status?i.exists:r.error||"Error");x(!1),f(""),await w(),window.location.href=`/view/${(0,en.O0)(r.path)}`}catch{y("Network error")}finally{b(!1)}}};return(0,s.jsxs)("div",{className:`flex flex-col h-full ${e?"":"hidden"}`,children:[(0,s.jsx)(q,{title:i.title,maximized:t,onMaximize:r,children:(0,s.jsx)("button",{onClick:()=>x(e=>!e),className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors focus-visible:ring-1 focus-visible:ring-ring","aria-label":i.newWorkflow,title:i.newWorkflow,children:(0,s.jsx)(F.A,{size:13})})}),(0,s.jsxs)("div",{className:"flex-1 overflow-y-auto min-h-0",children:[m&&(0,s.jsxs)("div",{className:"px-3 py-3 border-b border-border",children:[(0,s.jsx)("label",{className:"block text-xs font-medium text-muted-foreground mb-1.5",children:i.name}),(0,s.jsx)("input",{type:"text",value:p,onChange:e=>{f(e.target.value),y("")},onKeyDown:e=>"Enter"===e.key&&N(),placeholder:i.namePlaceholder,autoFocus:!0,className:"w-full px-2.5 py-1.5 text-sm rounded-md border border-border bg-background text-foreground placeholder:text-muted-foreground focus:outline-none focus-visible:ring-1 focus-visible:ring-ring"}),v&&(0,s.jsx)("p",{className:"text-xs text-[var(--error)] mt-1",children:v}),(0,s.jsxs)("div",{className:"flex gap-2 mt-2.5",children:[(0,s.jsx)("button",{onClick:()=>{x(!1),f(""),y("")},className:"flex-1 px-3 py-1.5 text-xs rounded-md border border-border text-muted-foreground hover:bg-muted transition-colors",children:i.cancel}),(0,s.jsx)("button",{onClick:N,disabled:!p.trim()||g,className:"flex-1 px-3 py-1.5 text-xs rounded-md font-medium transition-colors disabled:opacity-50 bg-[var(--amber)] text-[var(--amber-foreground)]",children:g?i.creating:i.create})]})]}),c&&(0,s.jsx)("div",{className:"flex items-center justify-center py-8 text-muted-foreground",children:(0,s.jsx)(eo.A,{size:16,className:"animate-spin"})}),!c&&0===l.length&&!m&&(0,s.jsxs)("div",{className:"flex flex-col items-center justify-center py-10 px-4 text-center",children:[(0,s.jsx)(h.A,{size:24,className:"text-muted-foreground/40 mb-3"}),(0,s.jsx)("p",{className:"text-sm font-medium text-muted-foreground mb-1",children:i.empty}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground/70 mb-4 max-w-[200px]",children:i.emptyDesc}),(0,s.jsxs)("button",{onClick:()=>x(!0),className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-xs rounded-md font-medium bg-[var(--amber)] text-[var(--amber-foreground)] transition-colors",children:[(0,s.jsx)(F.A,{size:12}),i.newWorkflow]})]}),!c&&l.length>0&&(0,s.jsx)("div",{className:"flex flex-col gap-0.5 py-1.5",children:l.map(e=>(0,s.jsxs)(o(),{href:`/view/${(0,en.O0)(e.path)}`,className:`flex items-start gap-2.5 px-3 py-2 mx-1 rounded-lg transition-colors hover:bg-muted ${e.error?"opacity-70":""}`,children:[(0,s.jsx)(h.A,{size:14,className:"shrink-0 mt-0.5 text-[var(--amber)]"}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("span",{className:"text-sm font-medium text-foreground block truncate",children:e.title}),(0,s.jsxs)("div",{className:"flex items-center gap-2 mt-0.5",children:[e.error?(0,s.jsxs)("span",{className:"inline-flex items-center gap-1 text-2xs text-[var(--error)]",children:[(0,s.jsx)(eZ.A,{size:10}),i.parseError]}):(0,s.jsx)("span",{className:"text-2xs text-muted-foreground",children:i.nSteps(e.stepCount)}),(0,s.jsx)("span",{className:"text-2xs text-muted-foreground/60",suppressHydrationWarning:!0,children:(0,en.KW)(e.mtime,n.home?.relativeTime)})]})]})]},e.path))})]})]})}var e0=r(72658),e1=r(86343);function e2({open:e,onClose:t,currentFile:r,initialMessage:n,initialAcpAgent:i,onFirstMessage:o,width:l,onWidthChange:d,onWidthCommit:c,askMode:u,onModeSwitch:m,maximized:x=!1,onMaximize:p,sidebarOffset:f=0}){let h=(0,a.useRef)(!1),g=(0,a.useRef)(!1),b=window.innerWidth-f,[v,y]=(0,a.useState)(!1),j=(0,a.useCallback)(e=>{if(h.current)return;let t=Math.min(e,b);if(x&&t<b-16&&p){g.current=!0,p(),d(Math.min(t,window.innerWidth-f-200));return}let r=window.innerWidth-f-t,s=t>=b-80||!g.current&&r<200;if(!x&&s&&p){h.current=!0,p();return}x||d(t)},[b,f,p,x,d]),w=X({width:x?b:l,minWidth:320,maxWidth:b,maxWidthRatio:1,direction:"left",onResize:j,onResizeEnd:(0,a.useCallback)(e=>{y(!1),h.current||c(e)},[c])}),N=(0,a.useCallback)(e=>{h.current=!1,y(!0),g.current&&window.innerWidth-f-l>=200&&(g.current=!1),w(e)},[w,f,l]),k=x?`calc(100vw - ${f}px)`:`${l}px`;return(0,s.jsxs)("aside",{className:`
|
|
91
|
+
`,children:[d&&(0,s.jsx)("span",{className:"pointer-events-none absolute bottom-[22%] left-0 top-[22%] w-0.5 rounded-r-full bg-[var(--amber)]","aria-hidden":!0}),(0,s.jsx)("span",{className:"text-sm",children:n}),(0,s.jsx)("span",{className:"text-sm flex-1 truncate text-foreground",children:t}),l?(0,s.jsx)(w.A,{size:14,className:"text-success shrink-0"}):(0,s.jsx)(eA.A,{size:14,className:"text-border shrink-0"})]},e)})})]})}function e$({active:e,maximized:t,onMaximize:r,selectedAgentKey:i=null}){let{t:o}=(0,j.Y)(),l=o.panels.agents,d=(0,n.useRouter)(),u=(0,ec.kr)(),m=(0,n.usePathname)(),x=(0,n.useSearchParams)(),p="/agents"===m&&"channels"===x.get("tab"),[h,f]=(0,a.useState)(!1),[g,v]=(0,a.useState)(!1),[y,w]=(0,a.useState)(!1),N=(0,eu.V)(),k=async()=>{f(!0),await u.refresh(),f(!1)},S=u.agents.filter(e=>e.present&&e.installed),C=u.agents.filter(e=>e.present&&!e.installed),A=u.agents.filter(e=>!e.present),z=async e=>{let t=await u.installAgent(e);return t&&await u.refresh(),t},E=m?.startsWith("/agents/")?decodeURIComponent(m.slice(8)):null,$={installing:l.installing,install:l.install,installSuccess:l.installSuccess,installFailed:l.installFailed,retryInstall:l.retryInstall},T={navOverview:l.navOverview,navMcp:l.navMcp,navSkills:l.navSkills,navChannels:l.channels,navNetwork:l.navNetwork,navSessions:l.navSessions,navActivity:l.navActivity},D=(0,s.jsx)(eg,{copy:T,connectedCount:S.length,mcpEnabled:u.status?.connectionMode?.mcp??!1,channelsActive:p,onChannelsClick:()=>{d.push("/agents?tab=channels")}});return(0,s.jsxs)("div",{className:`flex flex-col h-full ${e?"":"hidden"}`,children:[(0,s.jsx)(q,{title:l.title,maximized:t,onMaximize:r,children:(0,s.jsxs)("div",{className:"flex items-center gap-1.5",children:[!u.loading&&(0,s.jsxs)("span",{className:"text-2xs text-muted-foreground",children:[S.length," ",l.connected,N.agents.length>0&&(0,s.jsxs)(s.Fragment,{children:[" \xb7 ",l.a2aLabel," ",N.agents.length]})]}),(0,s.jsx)("button",{onClick:k,disabled:h,className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground disabled:opacity-50 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":l.refresh,title:l.refresh,type:"button",children:(0,s.jsx)(b.A,{size:12,className:h?"animate-spin":""})})]})}),(0,s.jsx)("div",{className:"flex-1 overflow-y-auto min-h-0",children:u.loading?(0,s.jsx)("div",{className:"flex justify-center py-8",children:(0,s.jsx)(el.A,{size:16,className:"animate-spin text-muted-foreground"})}):0===u.agents.length&&0===u.skills.length?(0,s.jsxs)("div",{className:"flex flex-col gap-2 py-4 px-0",children:[D,(0,s.jsx)("div",{className:"mx-4 border-t border-border"}),(0,s.jsxs)("div",{className:"mx-3 rounded-lg border border-border/40 bg-card/30 px-3 py-5 text-center",children:[(0,s.jsx)("p",{className:"text-xs text-muted-foreground/70 mb-1.5",children:l.noAgents}),(0,s.jsx)("p",{className:"text-2xs text-muted-foreground/40 mb-3",children:l.skillsEmptyHint}),(0,s.jsxs)("button",{onClick:k,type:"button",className:"inline-flex items-center gap-1.5 px-2.5 py-1.5 text-xs rounded-lg border border-border text-muted-foreground hover:text-foreground hover:bg-muted transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[(0,s.jsx)(b.A,{size:11})," ",l.retry]})]})]}):(0,s.jsxs)("div",{className:"pb-3",children:[D,(0,s.jsx)("div",{className:"mx-4 border-t border-border"}),p?(0,s.jsx)(eE,{}):(0,s.jsx)("div",{className:"px-3 py-3 space-y-4",children:(0,s.jsx)(ek,{connected:S,detected:C,notFound:A,selectedAgentKey:E??i,listCopy:$,onInstallAgent:z,showNotDetected:g,setShowNotDetected:v,p:{rosterLabel:l.rosterLabel,sectionConnected:l.sectionConnected,sectionDetected:l.sectionDetected,sectionNotDetected:l.sectionNotDetected}})})]})}),(0,s.jsxs)("div",{className:"px-3 py-2 border-t border-border shrink-0 space-y-1",children:[(0,s.jsxs)("button",{type:"button",onClick:()=>w(!0),className:"flex items-center gap-1.5 text-2xs text-muted-foreground hover:text-foreground transition-colors w-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded-sm",children:[(0,s.jsx)(ed.A,{size:11}),l.a2aDiscover]}),(0,s.jsxs)("button",{type:"button",onClick:()=>{window.dispatchEvent(new CustomEvent("mindos:open-settings",{detail:{tab:"mcp"}}))},className:"flex items-center gap-1.5 text-2xs text-muted-foreground hover:text-foreground transition-colors w-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded-sm",children:[(0,s.jsx)(c.A,{size:11}),l.advancedConfig]})]}),(0,s.jsx)(eS.A,{open:y,onClose:()=>w(!1),onDiscover:N.discover,discovering:N.discovering,error:N.error})]})}var eT=r(42869),eD=r(6962),eR=r(5121),eP=r(31885),eM=r(65266),eF=r(4903),eI=r(44478),eL=r(14780),eO=r(95057),eW=r(20555),eB=r(27318),eU=r(46838),e_=r(20171);function eH({icon:e,title:t,prompt:r,tryLabel:n}){return(0,s.jsxs)("div",{className:"group flex items-center gap-2.5 px-4 py-1.5 hover:bg-muted/50 transition-colors rounded-sm mx-1",children:[(0,s.jsx)("span",{className:"text-muted-foreground shrink-0",children:e}),(0,s.jsx)("span",{className:"text-xs text-foreground truncate flex-1",title:t,children:t}),(0,s.jsx)("button",{onClick:()=>(0,eB.NH)(r,"user"),className:"opacity-0 group-hover:opacity-100 text-2xs px-2 py-0.5 rounded text-[var(--amber-text)] bg-[var(--amber-dim)] hover:opacity-80 transition-all duration-150 shrink-0",children:n})]})}let eX={c1:(0,s.jsx)(eT.A,{size:12}),c2:(0,s.jsx)(eD.A,{size:12}),c3:(0,s.jsx)(b.A,{size:12}),c4:(0,s.jsx)(eR.A,{size:12}),c5:(0,s.jsx)(eP.A,{size:12}),c6:(0,s.jsx)(eM.A,{size:12}),c7:(0,s.jsx)(d.A,{size:12}),c8:(0,s.jsx)(eF.A,{size:12}),c9:(0,s.jsx)(eI.A,{size:12})};function eK({active:e,maximized:t,onMaximize:r}){let{t:i}=(0,j.Y)(),o=i.panels.discover,l=i.explore,d=i.panels.plugins,c=(0,n.useRouter)(),[u,m]=(0,a.useState)(!1),[x,p]=(0,a.useState)(!1),[,h]=(0,a.useState)(0),[g,b]=(0,a.useState)(new Set),v=(0,a.useRef)(!1);(0,a.useEffect)(()=>{(0,eU.UG)(),m(!0)},[]),(0,a.useEffect)(()=>{if(!u||v.current)return;v.current=!0;let e=(0,eU.MZ)().map(e=>e.entryPath).filter(e=>!!e);0!==e.length&&fetch("/api/files").then(e=>e.ok?e.json():[]).then(t=>{let r=new Set(t);b(new Set(e.filter(e=>r.has(e))))}).catch(e=>{console.warn("[DiscoverPanel] fetch /api/files failed:",e)})},[u]);let y=(0,a.useCallback)((e,t)=>{(0,eU.$7)(e,t),h(e=>e+1),window.dispatchEvent(new Event("renderer-state-changed"))},[]),w=(0,a.useCallback)(e=>{c.push(`/view/${e.split("/").map(encodeURIComponent).join("/")}`)},[c]),N=u?(0,eU.MZ)():[],k=u?N.filter(e=>(0,eU.pl)(e.id)).length:0;return(0,s.jsxs)("div",{className:`flex flex-col h-full ${e?"":"hidden"}`,children:[(0,s.jsx)(q,{title:o.title,maximized:t,onMaximize:r}),(0,s.jsxs)("div",{className:"flex-1 overflow-y-auto min-h-0",children:[(0,s.jsxs)("div",{className:"py-2",children:[(0,s.jsx)(eh,{icon:(0,s.jsx)(eP.A,{size:14,className:"text-[var(--amber)]"}),title:o.useCases,badge:(0,s.jsx)("span",{className:"text-2xs tabular-nums text-muted-foreground",children:eW.LD.length}),href:"/explore"}),(0,s.jsx)(eh,{icon:(0,s.jsx)(eL.A,{size:14,className:"text-muted-foreground"}),title:o.pluginMarket,badge:(0,s.jsx)(ef,{label:o.comingSoon})}),(0,s.jsx)(eh,{icon:(0,s.jsx)(f.A,{size:14,className:"text-muted-foreground"}),title:o.skillMarket,badge:(0,s.jsx)(ef,{label:o.comingSoon})}),(0,s.jsx)(eh,{icon:(0,s.jsx)(eO.A,{size:14,className:"text-muted-foreground"}),title:o.spaceTemplates,badge:(0,s.jsx)(ef,{label:o.comingSoon})})]}),(0,s.jsx)("div",{className:"mx-4 border-t border-border"}),(0,s.jsxs)("div",{className:"py-2",children:[(0,s.jsxs)("button",{type:"button",onClick:()=>p(e=>!e),className:"w-full flex items-center gap-1.5 px-4 py-1.5 text-left",children:[(0,s.jsx)(eb.A,{size:11,className:`text-muted-foreground transition-transform duration-150 ${x?"":"-rotate-90"}`}),(0,s.jsx)(eL.A,{size:13,className:"text-muted-foreground shrink-0"}),(0,s.jsx)("span",{className:"text-2xs font-medium text-muted-foreground uppercase tracking-wider flex-1",children:d.title}),(0,s.jsxs)("span",{className:"text-2xs text-muted-foreground tabular-nums",children:[k,"/",N.length]})]}),(0,s.jsx)("div",{className:`grid transition-[grid-template-rows] duration-200 ease-out ${x?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,children:(0,s.jsx)("div",{className:"overflow-hidden",...!x&&{inert:!0},children:N.map(e=>{let t=(0,eU.pl)(e.id),r=!!e.entryPath&&g.has(e.entryPath),n=t&&e.entryPath&&r;return(0,s.jsxs)("div",{className:`flex items-center gap-2 px-4 py-1.5 mx-1 rounded-sm transition-colors ${n?"cursor-pointer hover:bg-muted/50":""} ${!t?"opacity-50":""}`,onClick:n?()=>w(e.entryPath):void 0,role:n?"link":void 0,tabIndex:n?0:void 0,onKeyDown:n?t=>{("Enter"===t.key||" "===t.key)&&(t.preventDefault(),w(e.entryPath))}:void 0,children:[(0,s.jsx)("span",{className:"text-sm shrink-0",suppressHydrationWarning:!0,children:e.icon}),(0,s.jsx)("span",{className:"text-xs text-foreground truncate flex-1",title:e.name,children:e.name}),e.core?(0,s.jsx)("span",{className:"text-2xs px-1.5 py-0.5 rounded bg-muted text-muted-foreground shrink-0",children:d.core}):(0,s.jsx)("div",{onClick:e=>e.stopPropagation(),children:(0,s.jsx)(e_.lM,{checked:t,onChange:t=>y(e.id,t),size:"sm"})})]},e.id)})})})]}),(0,s.jsx)("div",{className:"mx-4 border-t border-border"}),(0,s.jsxs)("div",{className:"py-2",children:[(0,s.jsx)("div",{className:"px-4 py-1.5",children:(0,s.jsx)("span",{className:"text-2xs font-medium text-muted-foreground uppercase tracking-wider",children:o.useCases})}),eW.LD.map(e=>{var t;let r=(t=e.id,({c1:l.c1,c2:l.c2,c3:l.c3,c4:l.c4,c5:l.c5,c6:l.c6,c7:l.c7,c8:l.c8,c9:l.c9})[t]);return r?(0,s.jsx)(eH,{icon:eX[e.id]||(0,s.jsx)(eP.A,{size:12}),title:r.title,prompt:r.prompt,tryLabel:o.tryIt},e.id):null})]})]})]})}var eY=r(1770),eJ=r(90718),eG=r(44071);function eV(){let[e,t]=(0,a.useState)(null),[r,n]=(0,a.useState)([]),[i,o]=(0,a.useState)(!0),{t:l}=(0,j.Y)();return((0,a.useEffect)(()=>{let e=async()=>{try{o(!0);let[e,r,s]=await Promise.all([(0,k.n)("/api/monitoring"),(0,k.n)("/api/changes?op=list&limit=3"),(0,k.n)("/api/ask-sessions")]);t({fileCount:e?.knowledgeBase?.fileCount??0,unreadChanges:r?.events?.length??0,sessionCount:Array.isArray(s)?s.length:0}),n((r?.events??[]).slice(0,3))}catch(e){console.warn("[EchoSidebarStats] Failed to load stats:",e),t({fileCount:0,unreadChanges:0,sessionCount:0}),n([])}finally{o(!1)}};e();let r=setInterval(e,1e4);return()=>clearInterval(r)},[]),i||!e)?(0,s.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:(0,s.jsx)("div",{className:"h-2 w-20 bg-muted rounded animate-pulse"})}):(0,s.jsxs)("div",{className:"flex flex-col gap-2 px-3 py-3 border-t border-border",children:[(0,s.jsxs)("div",{className:"grid grid-cols-3 gap-2",children:[(0,s.jsxs)("div",{className:"flex flex-col items-center p-1.5 rounded bg-muted/40 hover:bg-muted/60 transition-colors cursor-default",children:[(0,s.jsx)("div",{className:"text-sm font-semibold text-foreground",children:e.fileCount}),(0,s.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:"Files"})]}),(0,s.jsxs)("div",{className:"flex flex-col items-center p-1.5 rounded bg-muted/40 hover:bg-muted/60 transition-colors cursor-default",children:[(0,s.jsx)("div",{className:"text-sm font-semibold text-foreground",children:e.unreadChanges}),(0,s.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:"Changes"})]}),(0,s.jsxs)("div",{className:"flex flex-col items-center p-1.5 rounded bg-muted/40 hover:bg-muted/60 transition-colors cursor-default",children:[(0,s.jsx)("div",{className:"text-sm font-semibold text-foreground",children:e.sessionCount}),(0,s.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:"Chats"})]})]}),r.length>0&&(0,s.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,s.jsx)("div",{className:"text-xs font-medium text-muted-foreground px-0.5",children:"Recent"}),r.map(e=>{let t=function(e){try{let t=new Date(e),r=new Date().getTime()-t.getTime(),s=Math.floor(r/6e4),n=Math.floor(r/36e5),a=Math.floor(r/864e5);if(s<1)return"now";if(s<60)return`${s}m ago`;if(n<24)return`${n}h ago`;if(a<7)return`${a}d ago`;return t.toLocaleDateString("en-US",{month:"short",day:"numeric"})}catch{return"recently"}}(e.ts),r=function(e){switch(e){case"create":return(0,s.jsx)(eG.A,{size:12,className:"text-success"});case"write":case"append":return(0,s.jsx)(eC.A,{size:12,className:"text-foreground"});case"delete":return(0,s.jsx)(eC.A,{size:12,className:"text-destructive"});case"rename":case"move":return(0,s.jsx)(ep.A,{size:12,className:"text-muted-foreground"});default:return(0,s.jsx)(eC.A,{size:12,className:"text-muted-foreground"})}}(e.op),n=e.path.split("/").pop()||e.path;return(0,s.jsxs)("div",{className:"flex items-start gap-2 p-1.5 rounded hover:bg-muted/40 transition-colors text-xs",children:[(0,s.jsx)("span",{className:"text-muted-foreground shrink-0 mt-0.5",children:r}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("p",{className:"text-foreground truncate font-medium",title:n,children:n}),(0,s.jsx)("p",{className:"text-muted-foreground text-2xs",children:t})]})]},e.id)})]})]})}var eq=r(16518);function eZ({active:e,maximized:t,onMaximize:r}){let{t:a}=(0,j.Y)(),i=a.panels.echo,o=(0,n.usePathname)()??"",l={imprint:{icon:(0,s.jsx)(eY.A,{size:14}),title:i.imprintTitle},growth:{icon:(0,s.jsx)(eJ.A,{size:14}),title:i.growthTitle},self:{icon:(0,s.jsx)(Y.A,{size:14}),title:i.selfTitle}};return(0,s.jsxs)("div",{className:`flex flex-col h-full ${e?"":"hidden"}`,children:[(0,s.jsx)(q,{title:i.title,maximized:t,onMaximize:r}),(0,s.jsxs)("div",{className:"flex-1 overflow-y-auto min-h-0 flex flex-col",children:[(0,s.jsx)("div",{className:"flex flex-col gap-0.5 py-1.5",children:eq.RS.map(e=>{let t=l[e],r=eq.AI[e],n=o===r||o.startsWith(`${r}/`);return(0,s.jsx)(eh,{href:r,icon:t.icon,title:t.title,active:n},e)})}),(0,s.jsx)("div",{className:"mt-auto",children:(0,s.jsx)(eV,{})})]})]})}var eQ=r(41585);function e0({active:e,maximized:t,onMaximize:r}){let{t:n}=(0,j.Y)(),i=n.panels.workflows,[l,d]=(0,a.useState)([]),[c,u]=(0,a.useState)(!0),[m,x]=(0,a.useState)(!1),[p,h]=(0,a.useState)(""),[g,b]=(0,a.useState)(!1),[v,y]=(0,a.useState)(""),w=(0,a.useCallback)(async()=>{try{let e=await fetch("/api/workflows");if(!e.ok)return;let t=await e.json();d(t.workflows??[])}catch{}finally{u(!1)}},[]);(0,a.useEffect)(()=>{e&&w()},[e,w]);let N=async()=>{let e=p.trim();if(e&&!g){b(!0),y("");try{let t=await fetch("/api/workflows",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e})}),r=await t.json();if(!t.ok)return void y(409===t.status?i.exists:r.error||"Error");x(!1),h(""),await w(),window.location.href=`/view/${(0,ea.O0)(r.path)}`}catch{y("Network error")}finally{b(!1)}}};return(0,s.jsxs)("div",{className:`flex flex-col h-full ${e?"":"hidden"}`,children:[(0,s.jsx)(q,{title:i.title,maximized:t,onMaximize:r,children:(0,s.jsx)("button",{onClick:()=>x(e=>!e),className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors focus-visible:ring-1 focus-visible:ring-ring","aria-label":i.newWorkflow,title:i.newWorkflow,children:(0,s.jsx)(F.A,{size:13})})}),(0,s.jsxs)("div",{className:"flex-1 overflow-y-auto min-h-0",children:[m&&(0,s.jsxs)("div",{className:"px-3 py-3 border-b border-border",children:[(0,s.jsx)("label",{className:"block text-xs font-medium text-muted-foreground mb-1.5",children:i.name}),(0,s.jsx)("input",{type:"text",value:p,onChange:e=>{h(e.target.value),y("")},onKeyDown:e=>"Enter"===e.key&&N(),placeholder:i.namePlaceholder,autoFocus:!0,className:"w-full px-2.5 py-1.5 text-sm rounded-md border border-border bg-background text-foreground placeholder:text-muted-foreground focus:outline-none focus-visible:ring-1 focus-visible:ring-ring"}),v&&(0,s.jsx)("p",{className:"text-xs text-[var(--error)] mt-1",children:v}),(0,s.jsxs)("div",{className:"flex gap-2 mt-2.5",children:[(0,s.jsx)("button",{onClick:()=>{x(!1),h(""),y("")},className:"flex-1 px-3 py-1.5 text-xs rounded-md border border-border text-muted-foreground hover:bg-muted transition-colors",children:i.cancel}),(0,s.jsx)("button",{onClick:N,disabled:!p.trim()||g,className:"flex-1 px-3 py-1.5 text-xs rounded-md font-medium transition-colors disabled:opacity-50 bg-[var(--amber)] text-[var(--amber-foreground)]",children:g?i.creating:i.create})]})]}),c&&(0,s.jsx)("div",{className:"flex items-center justify-center py-8 text-muted-foreground",children:(0,s.jsx)(el.A,{size:16,className:"animate-spin"})}),!c&&0===l.length&&!m&&(0,s.jsxs)("div",{className:"flex flex-col items-center justify-center py-10 px-4 text-center",children:[(0,s.jsx)(f.A,{size:24,className:"text-muted-foreground/40 mb-3"}),(0,s.jsx)("p",{className:"text-sm font-medium text-muted-foreground mb-1",children:i.empty}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground/70 mb-4 max-w-[200px]",children:i.emptyDesc}),(0,s.jsxs)("button",{onClick:()=>x(!0),className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-xs rounded-md font-medium bg-[var(--amber)] text-[var(--amber-foreground)] transition-colors",children:[(0,s.jsx)(F.A,{size:12}),i.newWorkflow]})]}),!c&&l.length>0&&(0,s.jsx)("div",{className:"flex flex-col gap-0.5 py-1.5",children:l.map(e=>(0,s.jsxs)(o(),{href:`/view/${(0,ea.O0)(e.path)}`,className:`flex items-start gap-2.5 px-3 py-2 mx-1 rounded-lg transition-colors hover:bg-muted ${e.error?"opacity-70":""}`,children:[(0,s.jsx)(f.A,{size:14,className:"shrink-0 mt-0.5 text-[var(--amber)]"}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("span",{className:"text-sm font-medium text-foreground block truncate",children:e.title}),(0,s.jsxs)("div",{className:"flex items-center gap-2 mt-0.5",children:[e.error?(0,s.jsxs)("span",{className:"inline-flex items-center gap-1 text-2xs text-[var(--error)]",children:[(0,s.jsx)(eQ.A,{size:10}),i.parseError]}):(0,s.jsx)("span",{className:"text-2xs text-muted-foreground",children:i.nSteps(e.stepCount)}),(0,s.jsx)("span",{className:"text-2xs text-muted-foreground/60",suppressHydrationWarning:!0,children:(0,ea.KW)(e.mtime,n.home?.relativeTime)})]})]})]},e.path))})]})]})}var e1=r(68223),e2=r(86343);function e5({open:e,onClose:t,currentFile:r,initialMessage:n,initialAcpAgent:i,onFirstMessage:o,width:l,onWidthChange:d,onWidthCommit:c,askMode:u,onModeSwitch:m,maximized:x=!1,onMaximize:p,sidebarOffset:h=0}){let f=(0,a.useRef)(!1),g=(0,a.useRef)(!1),b=window.innerWidth-h,[v,y]=(0,a.useState)(!1),j=(0,a.useCallback)(e=>{if(f.current)return;let t=Math.min(e,b);if(x&&t<b-16&&p){g.current=!0,p(),d(Math.min(t,window.innerWidth-h-200));return}let r=window.innerWidth-h-t,s=t>=b-80||!g.current&&r<200;if(!x&&s&&p){f.current=!0,p();return}x||d(t)},[b,h,p,x,d]),w=Z({width:x?b:l,minWidth:320,maxWidth:b,maxWidthRatio:1,direction:"left",onResize:j,onResizeEnd:(0,a.useCallback)(e=>{y(!1),f.current||c(e)},[c])}),N=(0,a.useCallback)(e=>{f.current=!1,y(!0),g.current&&window.innerWidth-h-l>=200&&(g.current=!1),w(e)},[w,h,l]),k=x?`calc(100vw - ${h}px)`:`${l}px`;return(0,s.jsxs)("aside",{className:`
|
|
92
92
|
hidden md:flex fixed top-0 right-0 h-screen z-40
|
|
93
93
|
flex-col bg-background border-l border-border/40 shadow-[-4px_0_16px_rgba(0,0,0,0.04)]
|
|
94
94
|
${v?"":"transition-[width,transform] duration-200 ease-out"}
|
|
95
95
|
${e?"translate-x-0":"translate-x-full pointer-events-none"}
|
|
96
|
-
`,style:{width:k,minWidth:"320px"},role:"complementary","aria-label":"MindOS Agent panel",children:[(0,s.jsx)(
|
|
96
|
+
`,style:{width:k,minWidth:"320px"},role:"complementary","aria-label":"MindOS Agent panel",children:[(0,s.jsx)(e2.default,{fallback:(0,s.jsxs)("div",{className:"flex flex-col items-center justify-center h-full gap-3 px-6 text-center",children:[(0,s.jsx)(eC.A,{size:20,className:"text-muted-foreground"}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:"AI panel encountered an error."}),(0,s.jsx)("button",{onClick:()=>window.location.reload(),className:"text-xs px-3 py-1.5 rounded-lg border border-border text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:"Reload page"})]}),children:(0,s.jsx)("div",{className:"flex min-h-0 w-full flex-1 flex-col overflow-hidden",children:(0,s.jsx)(e1.A,{visible:e,variant:"panel",currentFile:e?r:void 0,initialMessage:n,initialAcpAgent:i,onFirstMessage:o,onClose:t,askMode:u,onModeSwitch:m,maximized:x,onMaximize:p})})}),(0,s.jsx)("div",{className:"absolute top-0 -left-[3px] w-[6px] h-full cursor-col-resize z-40 group hidden md:block",onMouseDown:N,children:(0,s.jsx)("div",{className:"absolute left-[2px] top-0 w-[1px] h-full opacity-0 group-hover:opacity-100 bg-[var(--amber)]/50 transition-opacity duration-150"})})]})}var e3=r(92972),e4=r(67635),e6=r(4235),e8=r(13845),e9=r(7834);function e7({agent:e,agentStatus:t,mcpStatus:r,onBack:n,onInstallAgent:i,copy:o,headerVariant:l="inline"}){let[d,c]=(0,a.useState)(!1),[m,x]=(0,a.useState)(null),[p,h]=(0,a.useState)(()=>e.preferredTransport),f=(0,a.useMemo)(()=>"notFound"===t?null:(0,e8.$k)(e,r,p),[e,r,p,t]),g=async()=>{c(!0),x(null),x(await i(e.key)?{type:"success",text:`${e.name} ${o.connected}`}:{type:"error",text:o.installFailed}),c(!1)},b=async()=>{!f||await (0,e9.l)(f.snippet)&&e6.oR.copy()},y="connected"===t?"bg-[var(--success)]":"detected"===t?"bg-[var(--amber)]":"bg-muted-foreground";return(0,s.jsxs)("div",{className:"flex flex-col h-full min-h-0",children:["dock"===l?(0,s.jsxs)("header",{className:"shrink-0 flex items-center justify-between gap-3 border-b border-border px-4 py-3 bg-card",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2.5 min-w-0",children:[(0,s.jsx)("span",{className:`w-2 h-2 rounded-full shrink-0 ${y}`}),(0,s.jsx)("h2",{className:"text-sm font-semibold text-foreground truncate",title:e.name,children:e.name})]}),(0,s.jsx)("button",{type:"button",onClick:n,className:"p-1.5 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring shrink-0","aria-label":o.closeDetail??"Close",children:(0,s.jsx)(u.A,{size:16})})]}):(0,s.jsxs)("div",{className:"sticky top-0 z-10 flex items-center gap-2 border-b border-border bg-background/95 px-3 py-2.5 backdrop-blur-sm shrink-0",children:[(0,s.jsxs)("button",{type:"button",onClick:n,className:"flex items-center gap-1 text-2xs text-muted-foreground hover:text-foreground rounded-md px-1 py-1 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring shrink-0",children:[(0,s.jsx)(v.A,{size:16}),o.backToList]}),(0,s.jsx)("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${y}`}),(0,s.jsx)("span",{className:"text-sm font-medium text-foreground truncate",title:e.name,children:e.name})]}),(0,s.jsxs)("div",{className:"px-4 py-4 space-y-4 flex-1 min-h-0 overflow-y-auto",children:["detected"===t&&(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,s.jsxs)("button",{type:"button",onClick:g,disabled:d,className:"inline-flex items-center gap-1.5 px-3 py-2 text-xs rounded-lg font-medium text-[var(--amber-foreground)] disabled:opacity-50 bg-[var(--amber)] hover:bg-[var(--amber)]/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[d?(0,s.jsx)(el.A,{size:14,className:"animate-spin"}):null,d?o.installing:o.install]}),m&&(0,s.jsxs)("span",{className:`flex items-center gap-1 text-2xs ${"success"===m.type?"text-success":"text-destructive"}`,children:["success"===m.type?(0,s.jsx)(w.A,{size:12}):(0,s.jsx)(eC.A,{size:12}),m.text]})]}),"notFound"===t&&(0,s.jsx)("p",{className:"text-sm text-muted-foreground leading-relaxed",children:o.notFoundDetail}),"notFound"!==t&&f&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-2xs font-medium text-muted-foreground uppercase tracking-wider mb-1",children:o.configPath}),(0,s.jsx)("p",{className:"text-xs font-mono text-foreground break-all",children:f.path})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-2xs font-medium text-muted-foreground uppercase tracking-wider mb-2",children:o.agentDetailTransport}),(0,s.jsxs)("div",{className:"flex items-center gap-1 p-0.5 rounded-lg bg-muted/40 w-fit",children:[(0,s.jsxs)("button",{type:"button",onClick:()=>h("stdio"),className:`flex items-center gap-1.5 px-3 py-1.5 text-xs rounded-md transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring ${"stdio"===p?"bg-card shadow-sm text-foreground":"text-muted-foreground"}`,children:[(0,s.jsx)(e3.A,{size:13}),o.transportLocal]}),(0,s.jsxs)("button",{type:"button",onClick:()=>h("http"),className:`flex items-center gap-1.5 px-3 py-1.5 text-xs rounded-md transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring ${"http"===p?"bg-card shadow-sm text-foreground":"text-muted-foreground"}`,children:[(0,s.jsx)(ed.A,{size:13}),o.transportRemote]})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-2xs font-medium text-muted-foreground uppercase tracking-wider mb-2",children:o.agentDetailSnippet}),(0,s.jsx)("pre",{className:"text-[11px] font-mono bg-muted/50 border border-border rounded-lg p-3 overflow-x-auto whitespace-pre max-h-[min(320px,50vh)] overflow-y-auto select-all",children:f.displaySnippet})]}),(0,s.jsxs)("button",{type:"button",onClick:b,className:"inline-flex items-center gap-1.5 px-3 py-2 rounded-lg border border-border text-muted-foreground hover:text-foreground hover:bg-muted transition-colors text-xs focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[(0,s.jsx)(e4.A,{size:14}),o.copyConfig]})]})]})]})}function te({open:e,agentKey:t,onClose:r,rightOffset:n,width:i,onWidthChange:o,onWidthCommit:l}){let d=(0,ec.oc)(),c=(0,ec.av)(),u=(0,ec.u_)(),{t:m}=(0,j.Y)(),x=m.panels.agents,p=d.filter(e=>e.present&&e.installed),h=d.filter(e=>e.present&&!e.installed),f=d.filter(e=>!e.present),g=(0,a.useMemo)(()=>{if(!t)return null;let e=d.find(e=>e.key===t);if(!e)return null;let r=p.some(e=>e.key===t)?"connected":h.some(e=>e.key===t)?"detected":f.some(e=>e.key===t)?"notFound":null;return r?{agent:e,status:r}:null},[t,d,p,h,f]);(0,a.useEffect)(()=>{if(t&&!g){let e=requestAnimationFrame(()=>r());return()=>cancelAnimationFrame(e)}},[t,g,r]);let b=Z({width:i,minWidth:300,maxWidth:640,maxWidthRatio:.42,direction:"left",onResize:o,onResizeEnd:l}),v={connected:x.connected,installing:x.installing,install:x.install,installFailed:x.installFailed,copyConfig:x.copyConfig,copied:x.copied,transportLocal:x.transportLocal,transportRemote:x.transportRemote,configPath:x.configPath,notFoundDetail:x.notFoundDetail,backToList:x.backToList,closeDetail:x.closeAgentDetail,agentDetailTransport:x.agentDetailTransport,agentDetailSnippet:x.agentDetailSnippet};return(0,s.jsxs)("aside",{className:`
|
|
97
97
|
hidden md:flex fixed top-0 h-screen z-[31] flex-col bg-card border-l border-border shadow-sm
|
|
98
98
|
transition-transform duration-200 ease-out
|
|
99
99
|
${e?"translate-x-0":"translate-x-full pointer-events-none"}
|
|
100
|
-
`,style:{width:`${i}px`,right:`${n}px`},role:"complementary","aria-label":x.agentDetailPanelAria,"aria-hidden":!e||!g,children:[g&&(0,s.jsx)("div",{className:"flex flex-col flex-1 min-h-0 overflow-y-auto",children:(0,s.jsx)(
|
|
100
|
+
`,style:{width:`${i}px`,right:`${n}px`},role:"complementary","aria-label":x.agentDetailPanelAria,"aria-hidden":!e||!g,children:[g&&(0,s.jsx)("div",{className:"flex flex-col flex-1 min-h-0 overflow-y-auto",children:(0,s.jsx)(e7,{agent:g.agent,agentStatus:g.status,mcpStatus:c,onBack:r,onInstallAgent:u,copy:v,headerVariant:"dock"})}),(0,s.jsx)("div",{className:"absolute top-0 -left-[3px] w-[6px] h-full cursor-col-resize z-40 group hidden md:block",onMouseDown:b,children:(0,s.jsx)("div",{className:"absolute left-[2px] top-0 w-[2px] h-full opacity-0 group-hover:opacity-100 bg-[var(--amber)]/50 transition-opacity"})})]})}var tt=r(86901);function tr({onToggle:e,askPanelOpen:t}){let{t:r}=(0,j.Y)(),a=(0,n.usePathname)(),i=`${r.ask?.fabLabel??"Ask AI"} (⌘/)`;return(0,s.jsxs)("button",{onClick:e,className:`
|
|
101
101
|
group hidden md:flex
|
|
102
102
|
fixed z-40 bottom-5 right-5
|
|
103
103
|
items-center justify-center
|
|
@@ -109,12 +109,12 @@ Be specific. Reference actual content from the files. Keep the total response un
|
|
|
109
109
|
hover:shadow-lg hover:shadow-[var(--amber)]/20
|
|
110
110
|
active:scale-95 cursor-pointer overflow-hidden
|
|
111
111
|
${t||"/"===a||""===a?"opacity-0 pointer-events-none translate-y-2":"opacity-100 translate-y-0"}
|
|
112
|
-
`,style:{background:"var(--amber)"},title:i,"aria-label":i,children:[(0,s.jsx)(te.A,{size:16,className:"relative z-10 shrink-0"}),(0,s.jsx)("span",{className:" relative z-10 max-w-0 group-hover:max-w-[120px] opacity-0 group-hover:opacity-100 transition-all duration-200 ease-out whitespace-nowrap overflow-hidden ",children:r.ask?.fabLabel??"Ask AI"})]})}function tr({open:e,onClose:t,anchorRect:r,railWidth:n,onOpenSyncSettings:i,syncStatus:o,onSyncStatusRefresh:l}){let d=(0,a.useRef)(null),c=(0,a.useRef)(t);c.current=t;let{syncing:m,syncResult:x,syncNow:p}=E(l);if((0,a.useEffect)(()=>{if(!e)return;let t=e=>{"Escape"===e.key&&(e.preventDefault(),e.stopPropagation(),c.current())};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[e]),(0,a.useEffect)(()=>{if(!e)return;let t=e=>{d.current&&!d.current.contains(e.target)&&c.current()},r=setTimeout(()=>window.addEventListener("mousedown",t),0);return()=>{clearTimeout(r),window.removeEventListener("mousedown",t)}},[e]),!e||!r)return null;let f=C(o,m),{label:h}=$(f,o),g=Math.max(8,r.bottom-180);return(0,s.jsxs)("div",{ref:d,className:"fixed z-40 w-[240px] border rounded-lg bg-card shadow-lg border-border animate-in fade-in slide-in-from-left-2 duration-150",style:{top:g,left:n},children:[(0,s.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border",children:[(0,s.jsx)("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Sync"}),(0,s.jsx)("button",{onClick:t,className:"p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors focus-visible:ring-2 focus-visible:ring-ring","aria-label":"Close",children:(0,s.jsx)(u.A,{size:14})})]}),(0,s.jsxs)("div",{className:"p-3 space-y-3",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{className:`w-2.5 h-2.5 rounded-full shrink-0 ${A[f]} ${"syncing"===f||"conflicts"===f||"error"===f?"animate-pulse":""}`}),(0,s.jsx)("span",{className:"text-sm text-foreground",children:h}),"success"===x&&(0,s.jsx)(w.A,{size:14,className:"text-success shrink-0"}),"error"===x&&(0,s.jsx)(N.A,{size:14,className:"text-error shrink-0"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:["off"!==f&&(0,s.jsxs)(eU.jn,{onClick:p,disabled:m,className:"text-xs px-3 py-1.5 flex items-center gap-1.5",children:[(0,s.jsx)(b.A,{size:12,className:m?"animate-spin":""}),"Sync Now"]}),(0,s.jsx)("button",{onClick:()=>{i(),t()},className:"text-xs text-muted-foreground hover:text-foreground transition-colors rounded px-1 py-0.5 focus-visible:ring-2 focus-visible:ring-ring",children:"Settings →"})]})]})]})}function ts(){let[e,t]=(0,a.useState)(!1),{t:r}=(0,j.Y)(),n=r.shortcutPanel,i="u">typeof navigator&&/Mac|iPhone|iPad/.test(navigator.userAgent)?"⌘":"Ctrl",o=(0,a.useMemo)(()=>[{keys:`${i} K`,label:n.toggleSearch,section:n.navigation},{keys:`${i} /`,label:n.toggleAskAI,section:n.navigation},{keys:`${i} ,`,label:n.openSettings,section:n.navigation},{keys:`${i} ?`,label:n.keyboardShortcuts,section:n.navigation},{keys:"Esc",label:n.closePanel,section:n.panelsSection},{keys:`${i} S`,label:n.saveFile,section:n.editor},{keys:`${i} Z`,label:n.undo,section:n.editor},{keys:`${i} Shift Z`,label:n.redo,section:n.editor}],[i,n]);if((0,a.useEffect)(()=>{let r=r=>{(r.metaKey||r.ctrlKey)&&r.shiftKey&&"/"===r.key&&(r.preventDefault(),t(e=>!e)),"Escape"===r.key&&e&&t(!1)};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[e]),!e)return null;let l=[...new Set(o.map(e=>e.section))];return(0,s.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center modal-backdrop",onClick:e=>e.target===e.currentTarget&&t(!1),children:(0,s.jsxs)("div",{role:"dialog","aria-modal":"true","aria-label":n.title,className:"w-full max-w-md mx-4 bg-card border border-border rounded-xl shadow-2xl overflow-hidden",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between px-5 py-3.5 border-b border-border",children:[(0,s.jsx)("span",{className:"text-sm font-medium text-foreground",children:n.title}),(0,s.jsx)("button",{onClick:()=>t(!1),className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",children:(0,s.jsx)(u.A,{size:15})})]}),(0,s.jsx)("div",{className:"px-5 py-4 space-y-4 max-h-[60vh] overflow-y-auto",children:l.map(e=>(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wider mb-2",children:e}),(0,s.jsx)("div",{className:"space-y-1",children:o.filter(t=>t.section===e).map(e=>(0,s.jsxs)("div",{className:"flex items-center justify-between py-1.5",children:[(0,s.jsx)("span",{className:"text-xs text-foreground",children:e.label}),(0,s.jsx)("div",{className:"flex items-center gap-1",children:e.keys.split(" ").map((e,t)=>(0,s.jsx)("kbd",{className:"px-1.5 py-0.5 text-2xs rounded border border-border bg-muted text-muted-foreground font-mono min-w-[24px] text-center",children:e},t))})]},e.keys))})]},e))}),(0,s.jsx)("div",{className:"px-5 py-2.5 border-t border-border",children:(0,s.jsxs)("p",{className:"text-2xs text-muted-foreground/60",children:["Press ",(0,s.jsx)("kbd",{className:"px-1 py-0.5 text-2xs rounded border border-border bg-muted font-mono",children:i}),(0,s.jsx)("kbd",{className:"px-1 py-0.5 text-2xs rounded border border-border bg-muted font-mono ml-0.5",children:"?"})," ",n.toggleHint]})})]})})}var tn=r(50538);function ta(){let[e,t]=(0,a.useState)(0),[r,i]=(0,a.useState)(null),[l,d]=(0,a.useState)(!1),c=(0,a.useRef)(0),[m,x]=(0,a.useState)(!1),[p,f]=(0,a.useState)(!1),h=(0,n.usePathname)(),{t:g}=(0,j.Y)();(0,a.useEffect)(()=>{let e=!0,r=async()=>{try{let r=await (0,k.n)("/api/changes?op=summary");e&&t(r.unreadCount)}catch{e&&t(0)}};r();let s=setInterval(()=>void r(),15e3);return()=>{e=!1,clearInterval(s)}},[]),(0,a.useEffect)(()=>{e>c.current&&l&&d(!1),c.current=e},[e,l]);let b=(0,a.useMemo)(()=>!(e<=0||h?.startsWith("/changes")||h?.startsWith("/changelog"))&&(null===r||!(e<=r))&&!l,[r,h,e,l]);async function v(){try{await (0,k.n)("/api/changes",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({op:"mark_seen"})})}catch{}finally{t(0),i(0)}}return((0,a.useEffect)(()=>{if(!b)return;let e=setTimeout(()=>d(!0),1e4);return()=>clearTimeout(e)},[b]),(0,a.useEffect)(()=>{if(b){x(!0);let e=requestAnimationFrame(()=>f(!0));return()=>cancelAnimationFrame(e)}f(!1);let e=setTimeout(()=>x(!1),160);return()=>clearTimeout(e)},[b]),m)?(0,s.jsx)("div",{className:`fixed right-3 top-[60px] md:right-6 md:top-4 z-30 transition-all duration-150 ease-out ${p?"opacity-100 translate-y-0 scale-100":"opacity-0 -translate-y-2 scale-[0.98] pointer-events-none"}`,children:(0,s.jsx)("div",{className:"rounded-2xl border bg-card/95 backdrop-blur px-3 py-2.5 shadow-lg min-w-[260px] max-w-[350px]",style:{borderColor:"color-mix(in srgb, var(--amber) 45%, var(--border))",boxShadow:"0 12px 28px color-mix(in srgb, var(--amber) 14%, rgba(0,0,0,.24))"},children:(0,s.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,s.jsx)("span",{className:"inline-flex h-7 w-7 items-center justify-center rounded-full text-[var(--amber)] bg-[var(--amber-subtle)]",children:(0,s.jsx)(tn.A,{size:14})}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("p",{className:"text-xs text-foreground font-medium whitespace-nowrap",children:g.changes.unreadBanner(e)}),(0,s.jsxs)("div",{className:"mt-1 flex items-center gap-1.5",children:[(0,s.jsx)(o(),{href:"/changelog",className:"inline-flex items-center rounded-md px-2.5 py-1 text-xs font-medium bg-[var(--amber)] text-[var(--amber-foreground)] focus-visible:ring-2 focus-visible:ring-ring hover:opacity-90",children:g.changes.reviewNow}),(0,s.jsx)("button",{type:"button",onClick:()=>void v(),className:"inline-flex items-center rounded-md px-2 py-1 text-xs font-medium bg-muted text-muted-foreground hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:g.changes.markAllRead})]})]}),(0,s.jsx)("button",{type:"button",onClick:()=>i(e),"aria-label":g.changes.dismiss,className:"inline-flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground hover:text-foreground hover:bg-muted/60 focus-visible:ring-2 focus-visible:ring-ring",children:(0,s.jsx)(u.A,{size:14})})]})})}):null}var ti=r(55711);let to=(0,Z.createServerReference)("703e7c5cd4595015c2e4b4f833d159fd6e230379fd",Z.callServer,void 0,Z.findSourceMapURL,"revertSpaceInitAction");function tl(){let[e,t]=(0,a.useState)(null),[r,i]=(0,a.useState)(!1),[o,l]=(0,a.useTransition)(),d=(0,n.useRouter)(),{t:c}=(0,j.Y)(),m=(0,a.useCallback)(()=>{i(!1),setTimeout(()=>t(null),200)},[]),x=(0,a.useCallback)(e=>{let r=e.detail;"working"===r.state?(t(r),requestAnimationFrame(()=>i(!0))):"done"===r.state?(t(e=>e?{...e,state:"done"}:null),d.refresh()):m()},[d,m]);(0,a.useEffect)(()=>(window.addEventListener("mindos:ai-init",x),()=>window.removeEventListener("mindos:ai-init",x)),[x]);let p=(0,a.useCallback)(()=>{e&&(m(),d.push(`/view/${(0,en.O0)(e.spacePath+"/")}`))},[e,m,d]),f=(0,a.useCallback)(()=>{e&&l(async()=>{await to(e.spacePath,e.spaceName,e.description),t(e=>e?{...e,state:"reverted"}:null),d.refresh(),window.dispatchEvent(new Event("mindos:files-changed")),setTimeout(m,2e3)})},[e,d,m]),h=(0,a.useCallback)(()=>{m()},[m]);if(!e)return null;let g=c.home,{state:b}=e,v="done"===b,y="reverted"===b;return(0,s.jsx)("div",{className:`fixed bottom-6 left-1/2 z-50 -translate-x-1/2 transition-all duration-200 ease-out ${r?"opacity-100 translate-y-0 scale-100":"opacity-0 translate-y-3 scale-[0.96] pointer-events-none"}`,children:(0,s.jsxs)("div",{className:"flex items-center gap-2.5 rounded-full border bg-card/95 backdrop-blur py-2 shadow-lg",style:{borderColor:"color-mix(in srgb, var(--amber) 40%, var(--border))",boxShadow:"0 8px 24px color-mix(in srgb, var(--amber) 12%, rgba(0,0,0,.2))",paddingLeft:"0.75rem",paddingRight:v?"0.5rem":"1rem"},children:[(0,s.jsx)("span",{className:`inline-flex h-6 w-6 items-center justify-center rounded-full shrink-0 ${y?"text-muted-foreground bg-muted":"text-[var(--amber)] bg-[var(--amber-subtle)]"} ${"working"===b?"animate-pulse":""}`,children:y?(0,s.jsx)(ti.A,{size:12}):v?(0,s.jsx)(eb.A,{size:13,strokeWidth:2.5}):(0,s.jsx)(te.A,{size:13})}),(0,s.jsx)("span",{className:"text-xs text-foreground whitespace-nowrap select-none font-medium",children:y?g.aiInitReverted(e.spaceName):v?g.aiInitReady(e.spaceName):(0,s.jsxs)(s.Fragment,{children:[g.aiInitGenerating(e.spaceName),(0,s.jsx)(td,{})]})}),v&&(0,s.jsxs)("div",{className:"flex items-center gap-1 ml-1",children:[(0,s.jsx)("button",{type:"button",onClick:p,className:"px-2.5 py-1 rounded-full text-2xs font-medium bg-[var(--amber)] text-[var(--amber-foreground)] hover:opacity-90 transition-opacity focus-visible:ring-2 focus-visible:ring-ring",children:g.aiInitReview}),(0,s.jsx)("button",{type:"button",onClick:f,disabled:o,className:"px-2.5 py-1 rounded-full text-2xs font-medium bg-muted text-muted-foreground hover:text-foreground transition-colors focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50",children:g.aiInitDiscard}),(0,s.jsx)("button",{type:"button",onClick:h,"aria-label":"Accept",className:"ml-0.5 inline-flex h-5 w-5 items-center justify-center rounded-full text-muted-foreground hover:text-foreground hover:bg-muted/60 transition-colors focus-visible:ring-2 focus-visible:ring-ring",children:(0,s.jsx)(u.A,{size:12})})]})]})})}function td(){return(0,s.jsxs)("span",{className:"inline-flex gap-[2px] items-end h-[1em] ml-px",children:[(0,s.jsx)("span",{className:"w-[3px] h-[3px] rounded-full bg-muted-foreground animate-[dotBounce_1.2s_0ms_infinite]"}),(0,s.jsx)("span",{className:"w-[3px] h-[3px] rounded-full bg-muted-foreground animate-[dotBounce_1.2s_200ms_infinite]"}),(0,s.jsx)("span",{className:"w-[3px] h-[3px] rounded-full bg-muted-foreground animate-[dotBounce_1.2s_400ms_infinite]"}),(0,s.jsx)("style",{children:`
|
|
112
|
+
`,style:{background:"var(--amber)"},title:i,"aria-label":i,children:[(0,s.jsx)(tt.A,{size:16,className:"relative z-10 shrink-0"}),(0,s.jsx)("span",{className:" relative z-10 max-w-0 group-hover:max-w-[120px] opacity-0 group-hover:opacity-100 transition-all duration-200 ease-out whitespace-nowrap overflow-hidden ",children:r.ask?.fabLabel??"Ask AI"})]})}function ts({open:e,onClose:t,anchorRect:r,railWidth:n,onOpenSyncSettings:i,syncStatus:o,onSyncStatusRefresh:l}){let d=(0,a.useRef)(null),c=(0,a.useRef)(t);c.current=t;let{syncing:m,syncResult:x,syncNow:p}=E(l);if((0,a.useEffect)(()=>{if(!e)return;let t=e=>{"Escape"===e.key&&(e.preventDefault(),e.stopPropagation(),c.current())};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[e]),(0,a.useEffect)(()=>{if(!e)return;let t=e=>{d.current&&!d.current.contains(e.target)&&c.current()},r=setTimeout(()=>window.addEventListener("mousedown",t),0);return()=>{clearTimeout(r),window.removeEventListener("mousedown",t)}},[e]),!e||!r)return null;let h=C(o,m),{label:f}=$(h,o),g=Math.max(8,r.bottom-180);return(0,s.jsxs)("div",{ref:d,className:"fixed z-40 w-[240px] border rounded-lg bg-card shadow-lg border-border animate-in fade-in slide-in-from-left-2 duration-150",style:{top:g,left:n},children:[(0,s.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border",children:[(0,s.jsx)("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Sync"}),(0,s.jsx)("button",{onClick:t,className:"p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors focus-visible:ring-2 focus-visible:ring-ring","aria-label":"Close",children:(0,s.jsx)(u.A,{size:14})})]}),(0,s.jsxs)("div",{className:"p-3 space-y-3",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{className:`w-2.5 h-2.5 rounded-full shrink-0 ${A[h]} ${"syncing"===h||"conflicts"===h||"error"===h?"animate-pulse":""}`}),(0,s.jsx)("span",{className:"text-sm text-foreground",children:f}),"success"===x&&(0,s.jsx)(w.A,{size:14,className:"text-success shrink-0"}),"error"===x&&(0,s.jsx)(N.A,{size:14,className:"text-error shrink-0"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:["off"!==h&&(0,s.jsxs)(e_.jn,{onClick:p,disabled:m,className:"text-xs px-3 py-1.5 flex items-center gap-1.5",children:[(0,s.jsx)(b.A,{size:12,className:m?"animate-spin":""}),"Sync Now"]}),(0,s.jsx)("button",{onClick:()=>{i(),t()},className:"text-xs text-muted-foreground hover:text-foreground transition-colors rounded px-1 py-0.5 focus-visible:ring-2 focus-visible:ring-ring",children:"Settings →"})]})]})]})}function tn(){let[e,t]=(0,a.useState)(!1),{t:r}=(0,j.Y)(),n=r.shortcutPanel,i="u">typeof navigator&&/Mac|iPhone|iPad/.test(navigator.userAgent)?"⌘":"Ctrl",o=(0,a.useMemo)(()=>[{keys:`${i} K`,label:n.toggleSearch,section:n.navigation},{keys:`${i} /`,label:n.toggleAskAI,section:n.navigation},{keys:`${i} ,`,label:n.openSettings,section:n.navigation},{keys:`${i} ?`,label:n.keyboardShortcuts,section:n.navigation},{keys:"Esc",label:n.closePanel,section:n.panelsSection},{keys:`${i} S`,label:n.saveFile,section:n.editor},{keys:`${i} Z`,label:n.undo,section:n.editor},{keys:`${i} Shift Z`,label:n.redo,section:n.editor}],[i,n]);if((0,a.useEffect)(()=>{let r=r=>{(r.metaKey||r.ctrlKey)&&r.shiftKey&&"/"===r.key&&(r.preventDefault(),t(e=>!e)),"Escape"===r.key&&e&&t(!1)};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[e]),!e)return null;let l=[...new Set(o.map(e=>e.section))];return(0,s.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center modal-backdrop",onClick:e=>e.target===e.currentTarget&&t(!1),children:(0,s.jsxs)("div",{role:"dialog","aria-modal":"true","aria-label":n.title,className:"w-full max-w-md mx-4 bg-card border border-border rounded-xl shadow-2xl overflow-hidden",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between px-5 py-3.5 border-b border-border",children:[(0,s.jsx)("span",{className:"text-sm font-medium text-foreground",children:n.title}),(0,s.jsx)("button",{onClick:()=>t(!1),className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",children:(0,s.jsx)(u.A,{size:15})})]}),(0,s.jsx)("div",{className:"px-5 py-4 space-y-4 max-h-[60vh] overflow-y-auto",children:l.map(e=>(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wider mb-2",children:e}),(0,s.jsx)("div",{className:"space-y-1",children:o.filter(t=>t.section===e).map(e=>(0,s.jsxs)("div",{className:"flex items-center justify-between py-1.5",children:[(0,s.jsx)("span",{className:"text-xs text-foreground",children:e.label}),(0,s.jsx)("div",{className:"flex items-center gap-1",children:e.keys.split(" ").map((e,t)=>(0,s.jsx)("kbd",{className:"px-1.5 py-0.5 text-2xs rounded border border-border bg-muted text-muted-foreground font-mono min-w-[24px] text-center",children:e},t))})]},e.keys))})]},e))}),(0,s.jsx)("div",{className:"px-5 py-2.5 border-t border-border",children:(0,s.jsxs)("p",{className:"text-2xs text-muted-foreground/60",children:["Press ",(0,s.jsx)("kbd",{className:"px-1 py-0.5 text-2xs rounded border border-border bg-muted font-mono",children:i}),(0,s.jsx)("kbd",{className:"px-1 py-0.5 text-2xs rounded border border-border bg-muted font-mono ml-0.5",children:"?"})," ",n.toggleHint]})})]})})}function ta(){let[e,t]=(0,a.useState)(0),[r,i]=(0,a.useState)(null),[l,d]=(0,a.useState)(!1),c=(0,a.useRef)(0),[m,x]=(0,a.useState)(!1),[p,h]=(0,a.useState)(!1),f=(0,n.usePathname)(),{t:g}=(0,j.Y)();(0,a.useEffect)(()=>{let e=!0,r=async()=>{try{let r=await (0,k.n)("/api/changes?op=summary");e&&t(r.unreadCount)}catch{e&&t(0)}};r();let s=setInterval(()=>void r(),15e3);return()=>{e=!1,clearInterval(s)}},[]),(0,a.useEffect)(()=>{e>c.current&&l&&d(!1),c.current=e},[e,l]);let b=(0,a.useMemo)(()=>!(e<=0||f?.startsWith("/changes")||f?.startsWith("/changelog"))&&(null===r||!(e<=r))&&!l,[r,f,e,l]);async function v(){try{await (0,k.n)("/api/changes",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({op:"mark_seen"})})}catch{}finally{t(0),i(0)}}return((0,a.useEffect)(()=>{if(!b)return;let e=setTimeout(()=>d(!0),1e4);return()=>clearTimeout(e)},[b]),(0,a.useEffect)(()=>{if(b){x(!0);let e=requestAnimationFrame(()=>h(!0));return()=>cancelAnimationFrame(e)}h(!1);let e=setTimeout(()=>x(!1),160);return()=>clearTimeout(e)},[b]),m)?(0,s.jsx)("div",{className:`fixed right-3 top-[60px] md:right-6 md:top-4 z-30 transition-all duration-150 ease-out ${p?"opacity-100 translate-y-0 scale-100":"opacity-0 -translate-y-2 scale-[0.98] pointer-events-none"}`,children:(0,s.jsx)("div",{className:"rounded-2xl border bg-card/95 backdrop-blur px-3 py-2.5 shadow-lg min-w-[260px] max-w-[350px]",style:{borderColor:"color-mix(in srgb, var(--amber) 45%, var(--border))",boxShadow:"0 12px 28px color-mix(in srgb, var(--amber) 14%, rgba(0,0,0,.24))"},children:(0,s.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,s.jsx)("span",{className:"inline-flex h-7 w-7 items-center justify-center rounded-full text-[var(--amber)] bg-[var(--amber-subtle)]",children:(0,s.jsx)(H.A,{size:14})}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("p",{className:"text-xs text-foreground font-medium whitespace-nowrap",children:g.changes.unreadBanner(e)}),(0,s.jsxs)("div",{className:"mt-1 flex items-center gap-1.5",children:[(0,s.jsx)(o(),{href:"/changelog",className:"inline-flex items-center rounded-md px-2.5 py-1 text-xs font-medium bg-[var(--amber)] text-[var(--amber-foreground)] focus-visible:ring-2 focus-visible:ring-ring hover:opacity-90",children:g.changes.reviewNow}),(0,s.jsx)("button",{type:"button",onClick:()=>void v(),className:"inline-flex items-center rounded-md px-2 py-1 text-xs font-medium bg-muted text-muted-foreground hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:g.changes.markAllRead})]})]}),(0,s.jsx)("button",{type:"button",onClick:()=>i(e),"aria-label":g.changes.dismiss,className:"inline-flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground hover:text-foreground hover:bg-muted/60 focus-visible:ring-2 focus-visible:ring-ring",children:(0,s.jsx)(u.A,{size:14})})]})})}):null}var ti=r(55711);let to=(0,Q.createServerReference)("70d65ddcba3a4b1837957b1890eb265706d09c0a6c",Q.callServer,void 0,Q.findSourceMapURL,"revertSpaceInitAction");function tl(){let[e,t]=(0,a.useState)(null),[r,i]=(0,a.useState)(!1),[o,l]=(0,a.useTransition)(),d=(0,n.useRouter)(),{t:c}=(0,j.Y)(),m=(0,a.useCallback)(()=>{i(!1),setTimeout(()=>t(null),200)},[]),x=(0,a.useCallback)(e=>{let r=e.detail;"working"===r.state?(t(r),requestAnimationFrame(()=>i(!0))):"done"===r.state?(t(e=>e?{...e,state:"done"}:null),d.refresh()):m()},[d,m]);(0,a.useEffect)(()=>(window.addEventListener("mindos:ai-init",x),()=>window.removeEventListener("mindos:ai-init",x)),[x]);let p=(0,a.useCallback)(()=>{e&&(m(),d.push(`/view/${(0,ea.O0)(e.spacePath+"/")}`))},[e,m,d]),h=(0,a.useCallback)(()=>{e&&l(async()=>{await to(e.spacePath,e.spaceName,e.description),t(e=>e?{...e,state:"reverted"}:null),d.refresh(),window.dispatchEvent(new Event("mindos:files-changed")),setTimeout(m,2e3)})},[e,d,m]),f=(0,a.useCallback)(()=>{m()},[m]);if(!e)return null;let g=c.home,{state:b}=e,v="done"===b,y="reverted"===b;return(0,s.jsx)("div",{className:`fixed bottom-6 left-1/2 z-50 -translate-x-1/2 transition-all duration-200 ease-out ${r?"opacity-100 translate-y-0 scale-100":"opacity-0 translate-y-3 scale-[0.96] pointer-events-none"}`,children:(0,s.jsxs)("div",{className:"flex items-center gap-2.5 rounded-full border bg-card/95 backdrop-blur py-2 shadow-lg",style:{borderColor:"color-mix(in srgb, var(--amber) 40%, var(--border))",boxShadow:"0 8px 24px color-mix(in srgb, var(--amber) 12%, rgba(0,0,0,.2))",paddingLeft:"0.75rem",paddingRight:v?"0.5rem":"1rem"},children:[(0,s.jsx)("span",{className:`inline-flex h-6 w-6 items-center justify-center rounded-full shrink-0 ${y?"text-muted-foreground bg-muted":"text-[var(--amber)] bg-[var(--amber-subtle)]"} ${"working"===b?"animate-pulse":""}`,children:y?(0,s.jsx)(ti.A,{size:12}):v?(0,s.jsx)(ev.A,{size:13,strokeWidth:2.5}):(0,s.jsx)(tt.A,{size:13})}),(0,s.jsx)("span",{className:"text-xs text-foreground whitespace-nowrap select-none font-medium",children:y?g.aiInitReverted(e.spaceName):v?g.aiInitReady(e.spaceName):(0,s.jsxs)(s.Fragment,{children:[g.aiInitGenerating(e.spaceName),(0,s.jsx)(td,{})]})}),v&&(0,s.jsxs)("div",{className:"flex items-center gap-1 ml-1",children:[(0,s.jsx)("button",{type:"button",onClick:p,className:"px-2.5 py-1 rounded-full text-2xs font-medium bg-[var(--amber)] text-[var(--amber-foreground)] hover:opacity-90 transition-opacity focus-visible:ring-2 focus-visible:ring-ring",children:g.aiInitReview}),(0,s.jsx)("button",{type:"button",onClick:h,disabled:o,className:"px-2.5 py-1 rounded-full text-2xs font-medium bg-muted text-muted-foreground hover:text-foreground transition-colors focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50",children:g.aiInitDiscard}),(0,s.jsx)("button",{type:"button",onClick:f,"aria-label":"Accept",className:"ml-0.5 inline-flex h-5 w-5 items-center justify-center rounded-full text-muted-foreground hover:text-foreground hover:bg-muted/60 transition-colors focus-visible:ring-2 focus-visible:ring-ring",children:(0,s.jsx)(u.A,{size:12})})]})]})})}function td(){return(0,s.jsxs)("span",{className:"inline-flex gap-[2px] items-end h-[1em] ml-px",children:[(0,s.jsx)("span",{className:"w-[3px] h-[3px] rounded-full bg-muted-foreground animate-[dotBounce_1.2s_0ms_infinite]"}),(0,s.jsx)("span",{className:"w-[3px] h-[3px] rounded-full bg-muted-foreground animate-[dotBounce_1.2s_200ms_infinite]"}),(0,s.jsx)("span",{className:"w-[3px] h-[3px] rounded-full bg-muted-foreground animate-[dotBounce_1.2s_400ms_infinite]"}),(0,s.jsx)("style",{children:`
|
|
113
113
|
@keyframes dotBounce {
|
|
114
114
|
0%, 60%, 100% { opacity: 0.25; transform: translateY(0); }
|
|
115
115
|
30% { opacity: 1; transform: translateY(-2px); }
|
|
116
116
|
}
|
|
117
|
-
`})]})}var tc=r(93631),tu=r(3926),tm=r(22164),tx=r(78916),tp=r(78520);function tf(e,t){let r=e.fileImport;if(!t)return r.organizeProcessing;switch(t.stage){case"connecting":return r.organizeConnecting;case"analyzing":return r.organizeAnalyzing;case"reading":return r.organizeReading(t.detail);case"thinking":return r.organizeThinking;case"writing":return r.organizeWriting(t.detail);default:return r.organizeProcessing}}function th({aiOrganize:e,onDismiss:t,onCancel:r,onHistoryUpdate:i}){let{t:o}=(0,j.Y)(),l=(0,n.useRouter)(),d=o.fileImport,c="organizing"===e.phase,{elapsed:m,displayHint:x}=function(e,t){let[r,s]=(0,a.useState)(0),[n,i]=(0,a.useState)(!1),o=(0,a.useRef)(Date.now());return(0,a.useEffect)(()=>{o.current=Date.now(),i(!1)},[t]),(0,a.useEffect)(()=>{if(!e){s(0),i(!1);return}let t=setInterval(()=>{s(e=>e+1),Date.now()-o.current>=5e3&&i(!0)},1e3);return()=>clearInterval(t)},[e]),{elapsed:r,displayHint:n?{stage:"thinking"}:t}}(c,e.stageHint),[p,f]=(0,a.useState)(!1),[h,g]=(0,a.useState)(!1),[b,v]=(0,a.useState)(!1),y=(0,a.useRef)(null),w=(0,a.useRef)(null),N="done"===e.phase,k="error"===e.phase,S=c||N||k,C=e.changes.filter(e=>e.ok&&!e.undone).length;(0,a.useEffect)(()=>{c&&(w.current=null)},[c]),(0,a.useEffect)(()=>{if(N&&!w.current){let t=(0,tp.jQ)();w.current=t,(0,tp.D4)({id:t,timestamp:Date.now(),sourceFiles:e.sourceFileNames,files:e.changes.map(e=>({action:e.action,path:e.path,ok:e.ok,undone:e.undone})),status:"completed",source:e.source,durationMs:e.durationMs}),i?.()}},[N,e.changes,e.sourceFileNames,e.source,e.durationMs,i]);let A=(0,a.useCallback)(()=>{y.current&&clearTimeout(y.current),(N||k)&&(y.current=setTimeout(()=>{t()},18e4))},[N,k,t]);(0,a.useEffect)(()=>(A(),()=>{y.current&&clearTimeout(y.current)}),[A]);let z=(0,a.useCallback)(()=>{A()},[A]),E=(0,a.useCallback)(async t=>{z(),v(!0);let r=await e.undoOne(t);v(!1),r&&(window.dispatchEvent(new Event("mindos:files-changed")),setTimeout(()=>{if(w.current){let r=e.changes.map(e=>({action:e.action,path:e.path,ok:e.ok,undone:e.path===t||e.undone})),s=r.every(e=>!e.ok||e.undone);(0,tp.W8)(w.current,{files:r,status:s?"undone":"partial"}),i?.()}},0))},[e,z,i]),$=(0,a.useCallback)(async()=>{z(),v(!0);let t=await e.undoAll();v(!1),t>0&&(window.dispatchEvent(new Event("mindos:files-changed")),w.current&&((0,tp.W8)(w.current,{files:e.changes.map(e=>({action:e.action,path:e.path,ok:e.ok,undone:!!e.ok||e.undone})),status:"undone"}),i?.()))},[e,z,i]),T=(0,a.useCallback)(e=>{z(),l.push(`/view/${(0,en.O0)(e)}`)},[l,z]),D=(0,a.useCallback)(()=>{t()},[t]);if(!S)return null;function R(t,r){let n=t.undone,a=e.canUndo(t.path),i=t.path.split("/").pop()??t.path;return(0,s.jsxs)("div",{className:`flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors ${n?"bg-muted/30 opacity-50":"bg-muted/50"}`,children:[n?(0,s.jsx)(ti.A,{size:14,className:"text-muted-foreground shrink-0"}):"create"===t.action?(0,s.jsx)(tc.A,{size:14,className:"text-success shrink-0"}):(0,s.jsx)(tu.A,{size:14,className:"text-[var(--amber)] shrink-0"}),(0,s.jsx)("span",{className:`truncate flex-1 ${n?"line-through text-muted-foreground":"text-foreground"}`,children:i}),n?(0,s.jsx)("span",{className:"text-xs text-muted-foreground shrink-0",children:d.organizeUndone}):(0,s.jsx)("span",{className:`text-xs shrink-0 ${t.ok?"text-muted-foreground":"text-error"}`,children:t.ok?"create"===t.action?d.organizeCreated:d.organizeUpdated:d.organizeFailed}),a&&(0,s.jsx)("button",{type:"button",onClick:()=>E(t.path),disabled:b,className:"text-2xs text-muted-foreground/60 hover:text-foreground transition-colors shrink-0 px-1 disabled:opacity-40",title:d.organizeUndoOne,children:(0,s.jsx)(ti.A,{size:12})}),t.ok&&!t.undone&&(0,s.jsx)("button",{type:"button",onClick:()=>T(t.path),className:"text-2xs text-muted-foreground/60 hover:text-[var(--amber)] transition-colors shrink-0 px-1",title:d.organizeViewFile,children:(0,s.jsx)(tm.A,{size:12})})]},`${t.path}-${r}`)}function P(){return(0,s.jsxs)("div",{className:"flex items-center justify-end gap-3 px-4 py-3 border-t border-border",children:[N&&e.hasAnyUndoable&&(0,s.jsxs)("button",{onClick:$,disabled:b,className:"flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors px-2 py-1.5 disabled:opacity-50",children:[b?(0,s.jsx)(eo.A,{size:12,className:"animate-spin"}):(0,s.jsx)(ti.A,{size:12}),d.organizeUndoAll]}),(0,s.jsxs)("button",{onClick:D,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium bg-[var(--amber)] text-[var(--amber-foreground)] hover:opacity-90 transition-all",children:[(0,s.jsx)(eb.A,{size:12}),d.organizeDone]})]})}return h?(0,s.jsx)("div",{className:"fixed inset-0 z-50 overlay-backdrop flex items-center justify-center p-4",onClick:e=>{e.target===e.currentTarget&&g(!1)},children:(0,s.jsxs)("div",{className:"w-full max-w-xl max-h-[80vh] flex flex-col bg-card rounded-xl shadow-xl border border-border animate-in fade-in-0 zoom-in-95 duration-200",onClick:z,role:"dialog","aria-modal":"true","aria-label":d.organizeDetailTitle,children:[(0,s.jsxs)("div",{className:"flex items-center justify-between px-5 pt-5 pb-3 shrink-0",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[c?(0,s.jsxs)("div",{className:"relative shrink-0",children:[(0,s.jsx)(te.A,{size:16,className:"text-[var(--amber)]"}),(0,s.jsx)(eo.A,{size:10,className:"absolute -bottom-0.5 -right-0.5 text-[var(--amber)] animate-spin"})]}):N?(0,s.jsx)(eb.A,{size:16,className:"text-success"}):(0,s.jsx)(eS.A,{size:16,className:"text-error"}),(0,s.jsx)("h2",{className:"text-base font-semibold text-foreground",children:d.organizeDetailTitle}),c&&(0,s.jsx)("span",{className:"text-xs text-muted-foreground/60 tabular-nums",children:d.organizeElapsed(m)})]}),(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[(0,s.jsx)("button",{type:"button",onClick:()=>g(!1),className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",title:d.organizeMinimizeModal,children:(0,s.jsx)(G.A,{size:14})}),(0,s.jsx)("button",{type:"button",onClick:D,className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",children:(0,s.jsx)(u.A,{size:14})})]})]}),(0,s.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto px-5 pb-2 space-y-4",children:[c&&(0,s.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2.5 rounded-lg bg-[var(--amber-subtle)] border border-[var(--amber-dim)]",children:[(0,s.jsx)(eo.A,{size:14,className:"text-[var(--amber)] animate-spin shrink-0"}),(0,s.jsx)("span",{className:"text-xs text-foreground",children:tf(o,x)})]}),e.sourceFileNames.length>0&&(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"text-xs font-medium text-muted-foreground mb-1.5",children:d.organizeSourceFiles}),(0,s.jsx)("div",{className:"flex flex-wrap gap-1.5",children:e.sourceFileNames.map((e,t)=>(0,s.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-md bg-muted/60 text-xs text-foreground",children:[(0,s.jsx)(tx.A,{size:11,className:"text-muted-foreground shrink-0"}),e]},t))})]}),(e.summary||c)&&(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"text-xs font-medium text-muted-foreground mb-1.5",children:d.organizeSummaryLabel}),(0,s.jsx)("div",{className:"px-3 py-2.5 rounded-lg bg-muted/30 border border-border text-sm text-foreground leading-relaxed whitespace-pre-wrap",children:e.summary||d.organizeNoSummary})]}),e.changes.length>0&&(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"text-xs font-medium text-muted-foreground mb-1.5",children:d.organizeChangesLabel(e.changes.length)}),(0,s.jsx)("div",{className:"space-y-0.5",children:e.changes.map((e,t)=>R(e,t))})]}),k&&(0,s.jsx)("div",{className:"px-3 py-2.5 rounded-lg bg-error/5 border border-error/20 text-xs text-error",children:e.error})]}),(N||k)&&P()]})}):p&&(N||k)?(0,s.jsxs)("div",{className:"fixed bottom-4 left-1/2 -translate-x-1/2 z-50 w-[420px] max-w-[calc(100vw-2rem)] bg-card border border-border rounded-xl shadow-xl animate-in fade-in-0 slide-in-from-bottom-2 duration-200",onClick:z,children:[(0,s.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[N?(0,s.jsx)(eb.A,{size:14,className:"text-success"}):(0,s.jsx)(eS.A,{size:14,className:"text-error"}),(0,s.jsx)("span",{className:"text-xs font-medium text-foreground",children:N?d.organizeReviewTitle:d.organizeErrorTitle})]}),(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[(0,s.jsx)("button",{type:"button",onClick:()=>{f(!1),g(!0)},className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",title:d.organizeDetailTitle,children:(0,s.jsx)(V.A,{size:13})}),(0,s.jsx)("button",{type:"button",onClick:()=>f(!1),className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",children:(0,s.jsx)(eg.A,{size:14})})]})]}),N&&(0,s.jsx)("div",{className:"max-h-[240px] overflow-y-auto p-2 space-y-0.5",children:e.changes.map((e,t)=>R(e,t))}),k&&(0,s.jsx)("div",{className:"p-4 text-center",children:(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:e.error})}),P()]}):(0,s.jsx)("div",{className:"fixed bottom-4 left-1/2 -translate-x-1/2 z-50 flex items-center gap-3 bg-card border border-border rounded-xl shadow-lg px-4 py-3 max-w-md animate-in fade-in-0 slide-in-from-bottom-2 duration-200",onClick:z,children:N?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(eb.A,{size:16,className:"text-success shrink-0"}),(0,s.jsx)("span",{className:"text-xs text-foreground truncate",children:d.organizeReviewDesc(C)}),e.changes.length>0&&(0,s.jsxs)("button",{type:"button",onClick:()=>{f(!0),z()},className:"flex items-center gap-1 text-xs font-medium text-[var(--amber)] hover:opacity-80 transition-colors shrink-0",children:[(0,s.jsx)(eg.A,{size:12,className:"rotate-180"}),d.organizeExpand]}),(0,s.jsxs)("button",{type:"button",onClick:D,className:"flex items-center gap-1 text-xs font-medium text-[var(--amber)] hover:opacity-80 transition-colors shrink-0",children:[(0,s.jsx)(eb.A,{size:12}),d.organizeDone]})]}):k?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(eS.A,{size:16,className:"text-error shrink-0"}),(0,s.jsx)("span",{className:"text-xs text-foreground truncate",children:d.organizeError}),(0,s.jsx)("button",{type:"button",onClick:()=>{f(!0),z()},className:"text-xs font-medium text-[var(--amber)] hover:opacity-80 transition-colors shrink-0",children:d.organizeExpand}),(0,s.jsx)("button",{type:"button",onClick:D,className:"text-muted-foreground/50 hover:text-muted-foreground transition-colors shrink-0",children:(0,s.jsx)(u.A,{size:14})})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"relative shrink-0",children:[(0,s.jsx)(te.A,{size:16,className:"text-[var(--amber)]"}),(0,s.jsx)(eo.A,{size:10,className:"absolute -bottom-0.5 -right-0.5 text-[var(--amber)] animate-spin"})]}),(0,s.jsx)("span",{className:"text-xs text-foreground truncate",children:tf(o,x)}),(0,s.jsx)("span",{className:"text-xs text-muted-foreground/60 tabular-nums shrink-0",children:d.organizeElapsed(m)}),(0,s.jsx)("button",{type:"button",onClick:()=>{g(!0),z()},className:"text-muted-foreground/50 hover:text-muted-foreground transition-colors shrink-0",title:d.organizeDetailTitle,children:(0,s.jsx)(V.A,{size:13})}),(0,s.jsx)("button",{type:"button",onClick:D,className:"text-muted-foreground/50 hover:text-muted-foreground transition-colors shrink-0",children:(0,s.jsx)(u.A,{size:14})})]})})}var tg=r(37206);function tb(){return(0,a.useEffect)(()=>ed.zd.getState()._init(),[]),null}var tv=r(1934),ty=r(76449);let tj="mindos_walkthrough_done";function tw(e,t){if(e>=ty.g.length||t)try{localStorage.setItem(tj,"1")}catch{}fetch("/api/setup",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({guideState:{walkthroughStep:e,walkthroughDismissed:t}})}).catch(e=>{console.warn("[walkthrough-store] persist failed:",e)})}let tN=(0,tv.v)((e,t)=>{let r=ty.g.length;return{status:"idle",currentStep:0,totalSteps:r,start:()=>{e({currentStep:0,status:"active"}),tw(0,!1)},next:()=>{let s=t().currentStep+1;s>=r?(e({status:"completed"}),tw(r,!1)):(e({currentStep:s}),tw(s,!1))},back:()=>{let r=t().currentStep;r>0&&(e({currentStep:r-1}),tw(r-1,!1))},skip:()=>{e({status:"dismissed"}),tw(t().currentStep,!0)},_init:()=>{let t="1"===new URLSearchParams(window.location.search).get("welcome");if(t){let e=new URL(window.location.href);e.searchParams.delete("welcome"),window.history.replaceState({},"",e.pathname+(e.search||"")),window.dispatchEvent(new Event("mindos:first-visit"))}return window.innerWidth<768||function(){try{return"1"===localStorage.getItem(tj)}catch{return!1}}()?()=>{}:(fetch("/api/setup").then(e=>e.json()).then(s=>{let n=s.guideState;if(n){if(n.walkthroughDismissed||"number"==typeof n.walkthroughStep&&n.walkthroughStep>=r){try{localStorage.setItem(tj,"1")}catch{}return}n.active&&!n.dismissed&&void 0===n.walkthroughStep?t&&e({status:"active",currentStep:0}):"number"==typeof n.walkthroughStep&&n.walkthroughStep>=0&&n.walkthroughStep<r&&!n.walkthroughDismissed&&e({status:"active",currentStep:n.walkthroughStep})}}).catch(e=>{console.warn("[walkthrough-store] guideState read failed:",e)}),()=>{})}}});function tk({stepIndex:e,rect:t,position:r}){let n,i,o=tN(),{t:l}=(0,j.Y)(),[d,c]=(0,a.useState)({width:1024,height:768});if((0,a.useEffect)(()=>{let e=()=>c({width:window.innerWidth,height:window.innerHeight});return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),!o)return null;let u=l.walkthrough.steps[e];if(!u)return null;"right"===r?(n=t.top+t.height/2,i=t.right+12):(n=t.bottom+12,i=t.left+t.width/2);let m=d.width-320,x=d.height-200;return i=Math.min(i,m),n=Math.max(n=Math.min(n,x),8),(0,s.jsxs)("div",{className:`fixed z-[102] w-[280px] rounded-xl border shadow-lg animate-in fade-in duration-200 ${"right"===r?"slide-in-from-left-2":"slide-in-from-top-2"}`,style:{top:`${n}px`,left:`${i}px`,transform:"right"===r?"translateY(-50%)":"translateX(-50%)",background:"var(--card)",borderColor:"var(--amber)"},children:[(0,s.jsxs)("div",{className:"p-4",children:[(0,s.jsx)("div",{className:"flex items-center gap-2 mb-2",children:(0,s.jsx)("span",{className:"text-2xs font-mono px-1.5 py-0.5 rounded-full",style:{background:"var(--amber-dim)",color:"var(--amber)"},children:l.walkthrough.step(e+1,o.totalSteps)})}),(0,s.jsx)("h3",{className:"text-sm font-semibold mb-1",style:{color:"var(--foreground)"},children:u.title}),(0,s.jsx)("p",{className:"text-xs leading-relaxed",style:{color:"var(--muted-foreground)"},children:u.body}),(0,s.jsxs)("div",{className:"flex items-center justify-between mt-4 pt-3",style:{borderTop:"1px solid var(--border)"},children:[(0,s.jsx)("button",{onClick:o.skip,className:"text-xs transition-colors hover:opacity-80",style:{color:"var(--muted-foreground)"},children:l.walkthrough.skip}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[e>0&&(0,s.jsx)("button",{onClick:o.back,className:"text-xs px-2.5 py-1 rounded-lg transition-colors hover:bg-muted",style:{color:"var(--muted-foreground)"},children:l.walkthrough.back}),(0,s.jsx)("button",{onClick:o.next,className:"text-xs px-3 py-1.5 rounded-lg font-medium transition-all hover:opacity-90",style:{background:"var(--amber)",color:"var(--amber-foreground)"},children:e===o.totalSteps-1?l.walkthrough.done:l.walkthrough.next})]})]})]}),(0,s.jsx)("div",{className:"flex items-center justify-center gap-1.5 pb-3",children:Array.from({length:o.totalSteps},(t,r)=>(0,s.jsx)("div",{className:"w-1.5 h-1.5 rounded-full transition-all duration-200",style:{background:r===e?"var(--amber)":"var(--border)",transform:r===e?"scale(1.3)":void 0}},r))})]})}function tS(){let e=tN(),[t,r]=(0,a.useState)(null),[n,i]=(0,a.useState)(!1),o=(0,a.useId)(),l=e?ty.g[e.currentStep]:null,d=(0,a.useCallback)(()=>{if(!l)return;let e=document.querySelector(`[data-walkthrough="${l.anchor}"]`);e?r(e.getBoundingClientRect()):r(null)},[l]);(0,a.useEffect)(()=>{i(window.innerWidth<768),d();let e=()=>{i(window.innerWidth<768),d()};return window.addEventListener("resize",e),window.addEventListener("scroll",d,!0),()=>{window.removeEventListener("resize",e),window.removeEventListener("scroll",d,!0)}},[d]),(0,a.useEffect)(()=>{d();let e=setTimeout(d,100);return()=>clearTimeout(e)},[e?.currentStep,d]);let c=e?.skip;(0,a.useEffect)(()=>{if(!c)return;let e=e=>{"Escape"===e.key&&(e.stopPropagation(),c())};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[c]);let u=e?.currentStep??0;return((0,a.useEffect)(()=>{if(!l)return;let e=setTimeout(()=>{document.querySelector(`[data-walkthrough="${l.anchor}"]`)||tN.getState().next()},500);return()=>clearTimeout(e)},[u]),(0,a.useEffect)(()=>{let e=setTimeout(()=>{tN.getState().skip()},6e4);return()=>clearTimeout(e)},[u]),e&&l)?n?(0,s.jsx)(tC,{}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("svg",{className:"fixed inset-0 z-[100] pointer-events-auto",width:"100%",height:"100%",onClick:r=>{if(t){let s=r.clientX,n=r.clientY;s>=t.left-6&&s<=t.right+6&&n>=t.top-6&&n<=t.bottom+6||e.skip()}else e.skip()},children:[(0,s.jsx)("defs",{children:(0,s.jsxs)("mask",{id:o,children:[(0,s.jsx)("rect",{width:"100%",height:"100%",fill:"white"}),t&&(0,s.jsx)("rect",{x:t.left-6,y:t.top-6,width:t.width+12,height:t.height+12,rx:8,ry:8,fill:"black"})]})}),(0,s.jsx)("rect",{width:"100%",height:"100%",fill:"rgba(0, 0, 0, 0.5)",mask:`url(#${o})`})]}),t&&(0,s.jsx)(tk,{stepIndex:e.currentStep,rect:t,position:l.position}),!t&&(0,s.jsx)("div",{className:"fixed inset-0 z-[101] flex items-center justify-center pointer-events-none",children:(0,s.jsx)("button",{onClick:e.skip,className:"pointer-events-auto px-4 py-2 text-sm rounded-lg font-medium transition-all hover:opacity-90",style:{background:"var(--amber)",color:"var(--amber-foreground)"},children:e.currentStep===e.totalSteps-1?"✓":"→"})})]}):null}function tC(){let e=tN(),{t}=(0,j.Y)();if(!e)return null;let r=t.walkthrough.steps[e.currentStep];return r?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"fixed inset-0 z-[100] bg-black/40 backdrop-blur-sm",onClick:e.skip}),(0,s.jsxs)("div",{className:"fixed bottom-0 left-0 right-0 z-[101] rounded-t-2xl border-t shadow-lg p-5 pb-8 animate-in slide-in-from-bottom duration-300",style:{background:"var(--card)",borderColor:"var(--border)"},children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,s.jsx)("span",{className:"text-2xs font-mono px-1.5 py-0.5 rounded-full",style:{background:"var(--amber-dim)",color:"var(--amber)"},children:t.walkthrough.step(e.currentStep+1,e.totalSteps)}),(0,s.jsx)("div",{className:"flex items-center gap-1 ml-auto",children:Array.from({length:e.totalSteps},(t,r)=>(0,s.jsx)("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:r===e.currentStep?"var(--amber)":"var(--border)"}},r))})]}),(0,s.jsx)("h3",{className:"text-base font-semibold mb-1",style:{color:"var(--foreground)"},children:r.title}),(0,s.jsx)("p",{className:"text-sm leading-relaxed mb-5",style:{color:"var(--muted-foreground)"},children:r.body}),(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("button",{onClick:e.skip,className:"text-sm transition-colors hover:opacity-80",style:{color:"var(--muted-foreground)"},children:t.walkthrough.skip}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[e.currentStep>0&&(0,s.jsx)("button",{onClick:e.back,className:"text-sm px-3 py-2 rounded-lg transition-colors hover:bg-muted",style:{color:"var(--muted-foreground)"},children:t.walkthrough.back}),(0,s.jsx)("button",{onClick:e.next,className:"text-sm px-4 py-2 rounded-lg font-medium transition-all hover:opacity-90",style:{background:"var(--amber)",color:"var(--amber-foreground)"},children:e.currentStep===e.totalSteps-1?t.walkthrough.done:t.walkthrough.next})]})]})]})]}):null}function tA(){return(0,a.useEffect)(()=>tN.getState()._init(),[]),"active"===tN(e=>e.status)?(0,s.jsx)(tS,{}):null}let tz=new Set(["mp3","wav","m4a","ogg","flac","aac"]),tE=new Set(["png","jpg","jpeg","gif","webp","svg","bmp","ico"]),t$=new Set(["mp4","webm","mov","mkv"]);for(let e of[{id:"agent-inspector",name:"Agent Inspector",description:"Visualizes agent tool-call logs as a filterable timeline. Auto-activates on .mindos/agent-audit-log.json and supports legacy .agent-log.json.",author:"MindOS",icon:"\uD83D\uDD0D",tags:["agent","inspector","log","mcp","tools"],builtin:!0,core:!0,appBuiltinFeature:!0,entryPath:".mindos/agent-audit-log.json",match:({filePath:e})=>/(^|\/)\.mindos\/agent-audit-log\.json$/i.test(e)||/\.agent-log\.json$/i.test(e),load:()=>Promise.resolve().then(r.bind(r,18847)).then(e=>({default:e.AgentInspectorRenderer}))},{id:"audio",name:"Audio Player",description:"Plays audio files with native browser controls.",author:"MindOS",icon:"\uD83C\uDFB5",tags:["audio","music","voice","mp3","wav"],builtin:!0,core:!0,appBuiltinFeature:!0,match:({extension:e})=>tz.has(e),load:()=>Promise.resolve().then(r.bind(r,14446)).then(e=>({default:e.AudioRenderer}))},{id:"backlinks",name:"Backlinks Explorer",description:"Shows all files that link to the current page via wikilinks or markdown links, with highlighted snippet context.",author:"MindOS",icon:"\uD83D\uDD17",tags:["backlinks","wiki","links","references"],builtin:!0,entryPath:"BACKLINKS.md",match:({filePath:e})=>/\bBACKLINKS\b.*\.md$/i.test(e),load:()=>Promise.resolve().then(r.bind(r,88946)).then(e=>({default:e.BacklinksRenderer}))},{id:"change-log",name:"Content Changes",description:"Renders the .mindos/change-log.json file as a searchable timeline of content edits.",author:"MindOS",icon:"\uD83D\uDCCB",tags:["changelog","history","changes"],builtin:!0,core:!0,appBuiltinFeature:!0,match:({filePath:e})=>/\.mindos\/change-log\.json$/i.test(e),load:()=>Promise.resolve().then(r.bind(r,57025)).then(e=>({default:e.ChangeLogRenderer}))},{id:"config-panel",name:"Config Panel",description:"Renders CONFIG.json as an editable control panel based on uiSchema/keySpecs. Changes are written back to the JSON file directly.",author:"MindOS",icon:"\uD83E\uDDE9",tags:["config","json","settings","schema"],builtin:!0,core:!0,appBuiltinFeature:!0,entryPath:"CONFIG.json",match:({filePath:e,extension:t})=>"json"===t&&/(^|\/)CONFIG\.json$/i.test(e),load:()=>Promise.resolve().then(r.bind(r,35504)).then(e=>({default:e.ConfigRenderer}))},{id:"csv",name:"CSV Views",description:"Renders any CSV file as Table, Gallery, or Board. Each view is independently configurable — choose which columns map to title, description, tag, and group.",author:"MindOS",icon:"\uD83D\uDCCA",tags:["csv","table","gallery","board","data"],builtin:!0,core:!0,appBuiltinFeature:!0,entryPath:"Resources/Products.csv",match:({extension:e,filePath:t})=>"csv"===e&&!/\bTODO\b/i.test(t),load:()=>Promise.resolve().then(r.bind(r,92306)).then(e=>({default:e.CsvRenderer}))},{id:"image",name:"Image Viewer",description:"Renders image files with zoom, fit-to-view, and transparency support.",author:"MindOS",icon:"\uD83D\uDDBC",tags:["image","photo","viewer","png","jpg","svg"],builtin:!0,core:!0,appBuiltinFeature:!0,match:({extension:e})=>tE.has(e),load:()=>Promise.resolve().then(r.bind(r,20814)).then(e=>({default:e.ImageRenderer}))},{id:"pdf",name:"PDF Viewer",description:"Renders PDF files using the browser built-in PDF viewer.",author:"MindOS",icon:"\uD83D\uDCC4",tags:["pdf","document","viewer"],builtin:!0,core:!0,appBuiltinFeature:!0,match:({extension:e})=>"pdf"===e,load:()=>Promise.resolve().then(r.bind(r,20870)).then(e=>({default:e.PdfRenderer}))},{id:"summary",name:"AI Briefing",description:"Streams an AI-generated daily briefing summarizing your most recently modified files — key changes, recurring themes, and suggested next actions.",author:"MindOS",icon:"✨",tags:["ai","summary","briefing","daily"],builtin:!0,entryPath:"DAILY.md",match:({filePath:e})=>/\b(SUMMARY|summary|Summary|BRIEFING|briefing|Briefing|DAILY|daily|Daily)\b.*\.md$/i.test(e),load:()=>Promise.resolve().then(r.bind(r,56406)).then(e=>({default:e.SummaryRenderer}))},{id:"timeline",name:"Timeline",description:"Renders changelog and journal files as a vertical timeline. Any markdown with ## date headings (e.g. ## 2025-01-15) becomes a card in the feed.",author:"MindOS",icon:"\uD83D\uDCC5",tags:["timeline","changelog","journal","history"],builtin:!0,entryPath:"CHANGELOG.md",match:({filePath:e})=>/\b(CHANGELOG|changelog|TIMELINE|timeline|journal|Journal|diary|Diary)\b.*\.md$/i.test(e),load:()=>Promise.resolve().then(r.bind(r,39594)).then(e=>({default:e.TimelineRenderer}))},{id:"todo",name:"TODO Board",description:"Renders TODO.md/TODO.csv as an interactive kanban board grouped by section. Check items off directly — changes are written back to the source file.",author:"MindOS",icon:"✅",tags:["productivity","tasks","markdown"],builtin:!0,core:!0,appBuiltinFeature:!0,entryPath:"TODO.md",match:({filePath:e})=>/\bTODO\b.*\.(md|csv)$/i.test(e),load:()=>Promise.resolve().then(r.bind(r,78660)).then(e=>({default:e.TodoRenderer}))},{id:"video",name:"Video Player",description:"Plays video files with native browser controls.",author:"MindOS",icon:"\uD83C\uDFAC",tags:["video","movie","recording","mp4","webm"],builtin:!0,core:!0,appBuiltinFeature:!0,match:({extension:e})=>t$.has(e),load:()=>Promise.resolve().then(r.bind(r,87986)).then(e=>({default:e.VideoRenderer}))},{id:"workflow-yaml",name:"Workflow Runner",description:"Execute step-by-step YAML workflows with Skills & Agent support.",author:"MindOS",icon:"⚡",tags:["workflow","automation","steps","ai","yaml"],builtin:!0,core:!0,appBuiltinFeature:!0,entryPath:".mindos/workflows/",match:({extension:e,filePath:t})=>("yaml"===e||"yml"===e)&&/\.flow\.(yaml|yml)$/i.test(t),load:()=>Promise.resolve().then(r.bind(r,48133)).then(e=>({default:e.WorkflowYamlRenderer}))},{id:"graph",name:"Wiki Graph",description:"Force-directed graph of wikilink references across all markdown files. Supports Global and Local (2-hop) scope filters.",author:"MindOS",icon:"\uD83D\uDD78️",tags:["graph","wiki","links","visualization"],builtin:!0,match:()=>!1,load:()=>Promise.resolve().then(r.bind(r,92950)).then(e=>({default:e.GraphRenderer}))}])(0,eB.TS)(e);var tT=r(48391),tD=r(29494);let tR=(0,tg.default)(()=>r.e(5576).then(r.bind(r,95576)),{loadableGenerated:{webpack:()=>[95576]},ssr:!1}),tP=(0,tg.default)(()=>r.e(2935).then(r.bind(r,22935)),{loadableGenerated:{webpack:()=>[22935]},ssr:!1}),tM=(0,tg.default)(()=>Promise.all([r.e(9207),r.e(476)]).then(r.bind(r,10476)),{loadableGenerated:{webpack:()=>[10476]},ssr:!1}),tF=(0,tg.default)(()=>r.e(5998).then(r.bind(r,45998)),{loadableGenerated:{webpack:()=>[45998]},ssr:!1}),tI=(0,tg.default)(()=>r.e(1814).then(r.bind(r,51814)),{loadableGenerated:{webpack:()=>[51814]},ssr:!1});function tL({fileTree:e,children:t}){let r=function(){let[e,t]=(0,a.useState)("files"),[r,s]=(0,a.useState)(null),[n,i]=(0,a.useState)(!1),[o,l]=(0,a.useState)(!1);(0,a.useEffect)(()=>{try{"true"===localStorage.getItem("rail-expanded")&&l(!0)}catch{}},[]),(0,a.useEffect)(()=>{if(e){try{let e=localStorage.getItem("left-panel-width");if(e){let t=parseInt(e,10);if(t>=240&&t<=600)return void s(t)}}catch{}s(280)}},[e]),(0,a.useEffect)(()=>{i(!1)},[e]);let d=(0,a.useCallback)(e=>s(e),[]),c=(0,a.useCallback)(e=>{try{localStorage.setItem("left-panel-width",String(e))}catch{}},[]),u=(0,a.useCallback)(()=>i(e=>!e),[]),m=(0,a.useCallback)(e=>{l(e);try{localStorage.setItem("rail-expanded",String(e))}catch{}},[]),x=null!==e,p=r??(e?et[e]:280);return{activePanel:e,setActivePanel:t,panelWidth:r,panelMaximized:n,railExpanded:o,railWidth:o?180:48,panelOpen:x,effectivePanelWidth:p,handlePanelWidthChange:d,handlePanelWidthCommit:c,handlePanelMaximize:u,handleExpandedChange:m}}(),i=function(){let[e,t]=(0,a.useState)(!1),[r,s]=(0,a.useState)(380),[n,i]=(0,a.useState)("panel"),[o,l]=(0,a.useState)(!1),[d,c]=(0,a.useState)(""),[u,m]=(0,a.useState)(!1),x=(0,a.useRef)(!1);x.current=u;let[p,f]=(0,a.useState)("user"),[h,g]=(0,a.useState)(null),b=(0,a.useRef)(380),v=(0,eW.KT)();(0,a.useEffect)(()=>{try{let e=localStorage.getItem("right-ask-panel-width");if(e){let t=parseInt(e,10);t>=320&&t<=4e3?(s(t),b.current=t):t>4e3&&(s(380),b.current=380)}let t=localStorage.getItem("ask-mode");"popup"===t&&i("popup")}catch{}let e=e=>{"ask-mode"===e.key&&("panel"===e.newValue||"popup"===e.newValue)&&i(e.newValue)};window.addEventListener("storage",e);let r=()=>{t(!0),x.current&&(m(!1),s(b.current))};return window.addEventListener("mindos:open-ask-panel",r),()=>{window.removeEventListener("storage",e),window.removeEventListener("mindos:open-ask-panel",r)}},[]),(0,a.useEffect)(()=>{v.open&&(c(v.initialMessage),f(v.source),g(v.acpAgent),"popup"===n?l(!0):t(!0),v.close())},[v.open,v.initialMessage,v.source,v.acpAgent,v.close,n]);let y=(0,a.useCallback)(()=>{"popup"===n?l(e=>(e||(c(""),f("user"),g(null)),!e)):t(e=>(e||(c(""),f("user"),g(null)),!e))},[n]),j=(0,a.useCallback)(()=>{t(!1),u&&(s(b.current),m(!1))},[u]),w=(0,a.useCallback)(()=>{m(e=>(e?s(b.current):b.current=r,!e))},[r]),N=(0,a.useCallback)(()=>l(!1),[]),k=(0,a.useCallback)(e=>s(e),[]);return{askPanelOpen:e,askPanelWidth:r,askMaximized:u,askMode:n,desktopAskPopupOpen:o,askInitialMessage:d,askOpenSource:p,askAcpAgent:h,toggleAskPanel:y,closeAskPanel:j,closeDesktopAskPopup:N,handleAskWidthChange:k,handleAskWidthCommit:(0,a.useCallback)(e=>{try{localStorage.setItem("right-ask-panel-width",String(e))}catch{}},[]),handleAskModeSwitch:(0,a.useCallback)(()=>{i(e=>{let r="panel"===e?"popup":"panel";try{localStorage.setItem("ask-mode",r),window.dispatchEvent(new StorageEvent("storage",{key:"ask-mode",newValue:r}))}catch{}return"popup"===r?(t(!1),l(!0)):(l(!1),t(!0)),r})},[]),toggleAskMaximized:w}}(),[x,p]=(0,a.useState)(!1),[f,h]=(0,a.useState)(void 0),[g,b]=(0,a.useState)(!1),[v,y]=(0,a.useState)(null),[w,N]=(0,a.useState)(null),[k,S]=(0,a.useState)(()=>{try{let e=localStorage.getItem("right-agent-detail-panel-width");if(e){let t=parseInt(e,10);if(t>=300&&t<=640)return t}}catch{}return 400}),C=(0,tT.dB)(),[A,E]=(0,a.useState)(!1),[$,T]=(0,a.useState)(0);(0,a.useEffect)(()=>{("organizing"===C.phase||"done"===C.phase||"error"===C.phase)&&E(!0)},[C.phase]);let P=(0,a.useCallback)(()=>{E(!1),"organizing"!==C.phase||C.abort(),C.reset()},[C]),F=(0,a.useCallback)(()=>{T(e=>e+1),window.dispatchEvent(new Event("mindos:organize-history-update"))},[]),[I,L]=(0,a.useState)(!1),[O,W]=(0,a.useState)(void 0),[B,U]=(0,a.useState)(void 0),[_,H]=(0,a.useState)(!1),K=(0,a.useRef)(0),Y=(0,a.useCallback)(e=>{W(e),U(void 0),L(!0)},[]),G=(0,a.useCallback)(()=>{L(!1),W(void 0),U(void 0)},[]),[V,q]=(0,a.useState)(!1),[X,Z]=(0,a.useState)(!1),[Q,ee]=(0,a.useState)(!1),{t:es}=(0,j.Y)(),en=(0,n.useRouter)(),ea=(0,n.usePathname)(),eo=(0,a.useMemo)(()=>(function e(t,r=""){let s=[];for(let n of t)if("directory"===n.type&&!n.name.startsWith(".")){let t=r?`${r}/${n.name}`:n.name;s.push(t),n.children&&s.push(...e(n.children,t))}return s})(e),[e]),{status:el,fetchStatus:ed}=z(),ec=ea.startsWith("/view/")?ea.slice(6).split("/").map(decodeURIComponent).join("/"):void 0;(0,a.useEffect)(()=>{i.askMaximized&&i.toggleAskMaximized()},[ea,r.panelOpen]);let eu=(0,a.useCallback)(()=>{i.askMaximized&&i.toggleAskMaximized()},[i.askMaximized,i.toggleAskMaximized]);(0,a.useEffect)(()=>{"/"===ea&&i.askPanelOpen&&i.closeAskPanel()},[ea]);let em=ea?.startsWith("/agents"),ex=r.activePanel??(em?"agents":null);(0,a.useEffect)(()=>{let e=e=>{let t=e.detail?.tab;t&&h(t),p(!0)};return window.addEventListener("mindos:open-settings",e),()=>window.removeEventListener("mindos:open-settings",e)},[]),(0,a.useEffect)(()=>{let e=()=>Y();return window.addEventListener("mindos:open-import",e),()=>window.removeEventListener("mindos:open-import",e)},[Y]);let ep=(0,a.useRef)([]);(0,a.useEffect)(()=>{let e=e=>{let t=e.detail?.files;if(!t||0===t.length||"organizing"===C.phase)return;let r=es.inbox.organizePrompt(t.map(e=>e.name));ep.current=t.map(e=>e.name),(async()=>{let e=[];for(let r of t)try{let t=await fetch(`/api/file?path=${encodeURIComponent(r.path)}`);if(t.ok){let s=await t.json();e.push({name:r.name,content:s.content??""})}}catch{}e.length>0?C.start(e,r,"inbox-organize"):(e4.oR.error(es.inbox.organizeFailed,4e3),window.dispatchEvent(new Event("mindos:organize-done")))})()};return window.addEventListener("mindos:inbox-organize",e),()=>window.removeEventListener("mindos:inbox-organize",e)},[C,es]),(0,a.useEffect)(()=>{let e=e=>{let t=e.detail;if(!t?.content||"organizing"===C.phase)return;let r={name:t.name,content:t.content};C.start([r],"Organize this conversation into well-structured notes in my knowledge base. Extract key insights, decisions, action items, and important details. Create appropriate files with clear titles. Write in the same language as the content.","conversation")};return window.addEventListener("mindos:session-organize",e),()=>window.removeEventListener("mindos:session-organize",e)},[C]),(0,a.useEffect)(()=>{if("done"===C.phase){let e=C.changes.some(e=>e.ok),t=ep.current;e&&t.length>0&&(fetch("/api/inbox",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({names:t})}).then(()=>{window.dispatchEvent(new Event("mindos:inbox-updated"))}).catch(()=>{}),ep.current=[]),window.dispatchEvent(new Event("mindos:organize-done"))}else"error"===C.phase&&window.dispatchEvent(new Event("mindos:organize-done"))},[C.phase,C.changes]),(0,a.useEffect)(()=>{let e=e=>{let t=e.detail?.panel;t&&r.setActivePanel(t)};return window.addEventListener("mindos:open-panel",e),()=>window.removeEventListener("mindos:open-panel",e)},[r]);let ef=(0,a.useCallback)(()=>{let e=()=>window.dispatchEvent(new Event("guide-state-updated"));"guide"===i.askOpenSource?fetch("/api/setup",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({guideState:{askedAI:!0}})}).then(e).catch(e=>console.warn("Guide state update failed:",e)):"guide-next"===i.askOpenSource&&e()},[i.askOpenSource]);(0,a.useEffect)(()=>{let e=requestAnimationFrame(()=>q(!1));return()=>cancelAnimationFrame(e)},[ea]),(0,a.useEffect)(()=>{ea?.startsWith("/echo")&&r.setActivePanel("echo")},[ea,r.setActivePanel]);let eh=(0,a.useCallback)(e=>{S(e);try{localStorage.setItem("right-agent-detail-panel-width",String(e))}catch{}},[]),eg=(0,a.useCallback)(()=>N(null),[]),eb=null!==w&&"agents"===r.activePanel;(0,a.useEffect)(()=>{let e=-1,t=!1,r=async()=>{if(!t&&"hidden"!==document.visibilityState)try{let t=await fetch("/api/tree-version");if(!t.ok)return;let{v:r}=await t.json();if(-1===e){e=r;return}r!==e&&(e=r,en.refresh(),window.dispatchEvent(new Event("mindos:files-changed")))}catch(e){console.debug("[tree-version] poll failed",e)}},s=()=>{"visible"===document.visibilityState&&r()};r();let n=setInterval(()=>void r(),3e3);return document.addEventListener("visibilitychange",s),()=>{t=!0,clearInterval(n),document.removeEventListener("visibilitychange",s)}},[en]),(0,a.useEffect)(()=>{let e=e=>{if("Escape"===e.key){if(r.panelMaximized)return void r.handlePanelMaximize();if(eb)return void N(null);if(i.askPanelOpen)return void i.closeAskPanel();if(i.desktopAskPopupOpen)return void i.closeDesktopAskPopup()}(e.metaKey||e.ctrlKey)&&"k"===e.key&&(e.preventDefault(),window.innerWidth>=768?r.setActivePanel(e=>"search"===e?null:"search"):Z(e=>!e)),(e.metaKey||e.ctrlKey)&&"/"===e.key&&(e.preventDefault(),window.innerWidth>=768?i.toggleAskPanel():ee(e=>!e)),(e.metaKey||e.ctrlKey)&&","===e.key&&(e.preventDefault(),p(e=>!e)),(e.metaKey||e.ctrlKey)&&"i"===e.key&&(e.preventDefault(),L(e=>!e))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[eb,r,i]);let ev=(0,a.useCallback)(()=>{h("sync"),b(!1),p(!0)},[]),ey=(0,a.useCallback)(()=>{p(!0),h(void 0)},[]),ej=(0,a.useCallback)(()=>{p(!1),h(void 0)},[]),ew=(0,a.useCallback)(e=>{y(e),b(e=>!e)},[]),eN=(0,a.useCallback)(e=>{r.handleExpandedChange(e),b(!1)},[r]);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(tb,{}),(0,s.jsx)(tA,{}),(0,s.jsx)("a",{href:"#main-content",className:"sr-only focus-visible:not-sr-only focus-visible:fixed focus-visible:top-2 focus-visible:left-2 focus-visible:z-[60] focus-visible:px-4 focus-visible:py-2 focus-visible:rounded-lg focus-visible:text-sm focus-visible:font-medium bg-[var(--amber)] text-[var(--amber-foreground)]",children:"Skip to main content"}),(0,s.jsx)(M,{activePanel:ex,onPanelChange:r.setActivePanel,onEchoClick:()=>{eu();let e="echo"===r.activePanel,t=ea?.startsWith("/echo");e?t?r.setActivePanel(null):en.push("/echo/about-you"):(r.setActivePanel("echo"),en.push("/echo/about-you"))},onAgentsClick:()=>{eu();let e="agents"===r.activePanel,t=ea?.startsWith("/agents");e?t?r.setActivePanel(null):en.push("/agents"):(r.setActivePanel("agents"),en.push("/agents")),N(null)},onDiscoverClick:()=>{eu();let e="discover"===r.activePanel,t=ea?.startsWith("/explore");e?t?r.setActivePanel(null):en.push("/explore"):(r.setActivePanel("discover"),en.push("/explore"))},onSpacesClick:()=>{eu();let e="files"===r.activePanel,t="/"===ea||"/wiki"===ea||ea?.startsWith("/view/")||ea?.startsWith("/wiki/");e?t?r.setActivePanel(null):en.push("/wiki"):(r.setActivePanel("files"),en.push("/wiki"))},syncStatus:el,expanded:r.railExpanded,onExpandedChange:eN,onSettingsClick:ey,onSyncClick:ew}),(0,s.jsxs)(er,{activePanel:r.activePanel,fileTree:e,onNavigate:()=>{},onOpenSyncSettings:ev,railWidth:r.railWidth,panelWidth:r.panelWidth??void 0,onWidthChange:r.handlePanelWidthChange,onWidthCommit:r.handlePanelWidthCommit,maximized:r.panelMaximized,onMaximize:r.handlePanelMaximize,onImport:Y,children:[(0,s.jsx)("div",{className:`flex flex-col h-full ${"echo"===r.activePanel?"":"hidden"}`,children:(0,s.jsx)(eX,{active:"echo"===r.activePanel,maximized:r.panelMaximized,onMaximize:r.handlePanelMaximize})}),(0,s.jsx)("div",{className:`flex flex-col h-full ${"search"===r.activePanel?"":"hidden"}`,children:(0,s.jsx)(ei,{active:"search"===r.activePanel,maximized:r.panelMaximized,onMaximize:r.handlePanelMaximize})}),(0,s.jsx)("div",{className:`flex flex-col h-full ${"agents"===r.activePanel?"":"hidden"}`,children:(0,s.jsx)(eE,{active:"agents"===r.activePanel,maximized:r.panelMaximized,onMaximize:r.handlePanelMaximize,selectedAgentKey:eb?w:null})}),(0,s.jsx)("div",{className:`flex flex-col h-full ${"discover"===r.activePanel?"":"hidden"}`,children:(0,s.jsx)(eK,{active:"discover"===r.activePanel,maximized:r.panelMaximized,onMaximize:r.handlePanelMaximize})}),(0,s.jsx)("div",{className:`flex flex-col h-full ${"workflows"===r.activePanel?"":"hidden"}`,children:(0,s.jsx)(eQ,{active:"workflows"===r.activePanel,maximized:r.panelMaximized,onMaximize:r.handlePanelMaximize})})]}),(0,s.jsx)(e2,{open:i.askPanelOpen,onClose:i.closeAskPanel,currentFile:ec,initialMessage:i.askInitialMessage,initialAcpAgent:i.askAcpAgent,onFirstMessage:ef,width:i.askPanelWidth,onWidthChange:i.handleAskWidthChange,onWidthCommit:i.handleAskWidthCommit,askMode:i.askMode,onModeSwitch:i.handleAskModeSwitch,maximized:i.askMaximized,onMaximize:i.toggleAskMaximized,sidebarOffset:r.panelOpen?r.railWidth+r.effectivePanelWidth:r.railWidth}),(0,s.jsx)(e7,{open:eb,agentKey:w,onClose:eg,rightOffset:i.askPanelOpen?i.askPanelWidth:0,width:k,onWidthChange:S,onWidthCommit:eh}),(0,s.jsx)(tP,{open:i.desktopAskPopupOpen,onClose:i.closeDesktopAskPopup,currentFile:ec,initialMessage:i.askInitialMessage,initialAcpAgent:i.askAcpAgent,onFirstMessage:ef,askMode:i.askMode,onModeSwitch:i.handleAskModeSwitch}),(0,s.jsx)(tt,{onToggle:i.toggleAskPanel,askPanelOpen:i.askPanelOpen||i.desktopAskPopupOpen}),(0,s.jsx)(ts,{}),(0,s.jsx)(tM,{open:x,onClose:ej,initialTab:f}),(0,s.jsx)(tr,{open:g,onClose:()=>b(!1),anchorRect:v,railWidth:r.railWidth,onOpenSyncSettings:ev,syncStatus:el,onSyncStatusRefresh:ed}),(0,s.jsxs)("header",{className:"md:hidden fixed top-0 left-0 right-0 z-30 bg-card border-b border-border flex items-center justify-between px-3 py-2",style:{paddingTop:"env(safe-area-inset-top, 0px)"},children:[(0,s.jsx)("button",{onClick:()=>q(!0),className:"p-3 -ml-1 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors active:bg-accent","aria-label":"Open menu",children:(0,s.jsx)(l.A,{size:20})}),(0,s.jsxs)(o(),{href:"/",className:"flex items-center gap-2 hover:opacity-80 transition-opacity",children:[(0,s.jsx)(R.A,{id:"mobile"}),(0,s.jsx)("span",{className:"text-foreground text-sm font-brand",children:"MindOS"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,s.jsx)("button",{onClick:ev,className:"p-3 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors active:bg-accent flex items-center justify-center","aria-label":"Sync status",children:(0,s.jsx)(D,{status:el})}),(0,s.jsx)("button",{onClick:()=>Z(!0),className:"p-3 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors active:bg-accent","aria-label":es.sidebar.searchTitle,children:(0,s.jsx)(d.A,{size:20})}),(0,s.jsx)("button",{onClick:()=>{p(!0),h(void 0)},className:"p-3 -mr-1 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors active:bg-accent","aria-label":es.sidebar.settingsTitle,children:(0,s.jsx)(c.A,{size:20})})]})]}),V&&(0,s.jsx)("div",{className:"md:hidden fixed inset-0 z-40 overlay-backdrop",onClick:()=>q(!1)}),(0,s.jsxs)("aside",{className:`md:hidden fixed top-0 left-0 h-screen w-[85vw] max-w-[320px] z-50 bg-card border-r border-border flex flex-col transition-transform duration-300 ease-in-out ${V?"translate-x-0":"-translate-x-full"}`,children:[(0,s.jsxs)("div",{className:"flex items-center justify-between px-4 py-4 border-b border-border shrink-0",children:[(0,s.jsxs)(o(),{href:"/",className:"flex items-center gap-2 hover:opacity-80 transition-opacity",children:[(0,s.jsx)(R.A,{id:"drawer"}),(0,s.jsx)("span",{className:"text-foreground text-sm font-brand",children:"MindOS"})]}),(0,s.jsx)("button",{onClick:()=>q(!1),className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",children:(0,s.jsx)(u.A,{size:16})})]}),(0,s.jsx)("div",{className:"flex-1 overflow-y-auto min-h-0 px-2 py-2",children:(0,s.jsx)(J.Ay,{nodes:e,onNavigate:()=>q(!1),onImport:Y})})]}),(0,s.jsx)(tR,{open:X,onClose:()=>Z(!1)}),(0,s.jsx)(tP,{open:Q,onClose:()=>ee(!1),currentFile:ec}),(0,s.jsxs)("main",{id:"main-content",className:"min-h-screen transition-all duration-200 pt-[52px] md:pt-0",onDragEnter:e=>{e.dataTransfer.types.includes("Files")&&(e.preventDefault(),K.current++,1===K.current&&H(!0))},onDragOver:e=>{e.dataTransfer.types.includes("Files")&&e.preventDefault()},onDragLeave:()=>{K.current=Math.max(0,K.current-1),0===K.current&&H(!1)},onDrop:e=>{e.preventDefault(),K.current=0,H(!1),e.dataTransfer.files.length>0&&!I&&(0,tD.QL)(Array.from(e.dataTransfer.files),es)},children:[(0,s.jsxs)("div",{className:"min-h-screen bg-background",style:{overflowX:"clip"},children:[(0,s.jsx)(ta,{}),t]}),(0,s.jsx)(tl,{}),(0,s.jsx)(tF,{t:es,dirPaths:eo}),_&&!I&&(0,s.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm transition-opacity duration-200",children:(0,s.jsxs)("div",{className:"border-2 border-dashed border-[var(--amber)]/50 rounded-xl p-12 flex flex-col items-center gap-3",children:[(0,s.jsx)(m.A,{size:48,className:"text-[var(--amber)]/60"}),(0,s.jsx)("p",{className:"text-sm text-foreground font-medium",children:es.inbox.dropOverlay}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:es.inbox.dropOverlayFormats})]})})]}),(0,s.jsx)(tI,{open:I,onClose:G,defaultSpace:O,initialFiles:B,aiOrganize:C,dirPaths:eo}),A&&(0,s.jsx)(th,{aiOrganize:C,onDismiss:P,onCancel:()=>{C.abort(),C.reset(),E(!1)},onHistoryUpdate:F}),(0,s.jsx)("style",{children:`
|
|
117
|
+
`})]})}var tc=r(93631),tu=r(3926),tm=r(22164),tx=r(78916),tp=r(78520);function th(e,t){let r=e.fileImport;if(!t)return r.organizeProcessing;switch(t.stage){case"connecting":return r.organizeConnecting;case"analyzing":return r.organizeAnalyzing;case"reading":return r.organizeReading(t.detail);case"thinking":return r.organizeThinking;case"writing":return r.organizeWriting(t.detail);default:return r.organizeProcessing}}function tf({aiOrganize:e,onDismiss:t,onCancel:r,onHistoryUpdate:i}){let{t:o}=(0,j.Y)(),l=(0,n.useRouter)(),d=o.fileImport,c="organizing"===e.phase,{elapsed:m,displayHint:x}=function(e,t){let[r,s]=(0,a.useState)(0),[n,i]=(0,a.useState)(!1),o=(0,a.useRef)(Date.now());return(0,a.useEffect)(()=>{o.current=Date.now(),i(!1)},[t]),(0,a.useEffect)(()=>{if(!e){s(0),i(!1);return}let t=setInterval(()=>{s(e=>e+1),Date.now()-o.current>=5e3&&i(!0)},1e3);return()=>clearInterval(t)},[e]),{elapsed:r,displayHint:n?{stage:"thinking"}:t}}(c,e.stageHint),[p,h]=(0,a.useState)(!1),[f,g]=(0,a.useState)(!1),[b,v]=(0,a.useState)(!1),y=(0,a.useRef)(null),w=(0,a.useRef)(null),N="done"===e.phase,k="error"===e.phase,S=c||N||k,C=e.changes.filter(e=>e.ok&&!e.undone).length;(0,a.useEffect)(()=>{c&&(w.current=null)},[c]),(0,a.useEffect)(()=>{if(N&&!w.current){let t=(0,tp.jQ)();w.current=t,(0,tp.D4)({id:t,timestamp:Date.now(),sourceFiles:e.sourceFileNames,files:e.changes.map(e=>({action:e.action,path:e.path,ok:e.ok,undone:e.undone})),status:"completed",source:e.source,durationMs:e.durationMs}),i?.()}},[N,e.changes,e.sourceFileNames,e.source,e.durationMs,i]);let A=(0,a.useCallback)(()=>{y.current&&clearTimeout(y.current),(N||k)&&(y.current=setTimeout(()=>{t()},18e4))},[N,k,t]);(0,a.useEffect)(()=>(A(),()=>{y.current&&clearTimeout(y.current)}),[A]);let z=(0,a.useCallback)(()=>{A()},[A]),E=(0,a.useCallback)(async t=>{z(),v(!0);let r=await e.undoOne(t);v(!1),r&&(window.dispatchEvent(new Event("mindos:files-changed")),setTimeout(()=>{if(w.current){let r=e.changes.map(e=>({action:e.action,path:e.path,ok:e.ok,undone:e.path===t||e.undone})),s=r.every(e=>!e.ok||e.undone);(0,tp.W8)(w.current,{files:r,status:s?"undone":"partial"}),i?.()}},0))},[e,z,i]),$=(0,a.useCallback)(async()=>{z(),v(!0);let t=await e.undoAll();v(!1),t>0&&(window.dispatchEvent(new Event("mindos:files-changed")),w.current&&((0,tp.W8)(w.current,{files:e.changes.map(e=>({action:e.action,path:e.path,ok:e.ok,undone:!!e.ok||e.undone})),status:"undone"}),i?.()))},[e,z,i]),T=(0,a.useCallback)(e=>{z(),l.push(`/view/${(0,ea.O0)(e)}`)},[l,z]),D=(0,a.useCallback)(()=>{t()},[t]);if(!S)return null;function R(t,r){let n=t.undone,a=e.canUndo(t.path),i=t.path.split("/").pop()??t.path;return(0,s.jsxs)("div",{className:`flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors ${n?"bg-muted/30 opacity-50":"bg-muted/50"}`,children:[n?(0,s.jsx)(ti.A,{size:14,className:"text-muted-foreground shrink-0"}):"create"===t.action?(0,s.jsx)(tc.A,{size:14,className:"text-success shrink-0"}):(0,s.jsx)(tu.A,{size:14,className:"text-[var(--amber)] shrink-0"}),(0,s.jsx)("span",{className:`truncate flex-1 ${n?"line-through text-muted-foreground":"text-foreground"}`,children:i}),n?(0,s.jsx)("span",{className:"text-xs text-muted-foreground shrink-0",children:d.organizeUndone}):(0,s.jsx)("span",{className:`text-xs shrink-0 ${t.ok?"text-muted-foreground":"text-error"}`,children:t.ok?"create"===t.action?d.organizeCreated:d.organizeUpdated:d.organizeFailed}),a&&(0,s.jsx)("button",{type:"button",onClick:()=>E(t.path),disabled:b,className:"text-2xs text-muted-foreground/60 hover:text-foreground transition-colors shrink-0 px-1 disabled:opacity-40",title:d.organizeUndoOne,children:(0,s.jsx)(ti.A,{size:12})}),t.ok&&!t.undone&&(0,s.jsx)("button",{type:"button",onClick:()=>T(t.path),className:"text-2xs text-muted-foreground/60 hover:text-[var(--amber)] transition-colors shrink-0 px-1",title:d.organizeViewFile,children:(0,s.jsx)(tm.A,{size:12})})]},`${t.path}-${r}`)}function P(){return(0,s.jsxs)("div",{className:"flex items-center justify-end gap-3 px-4 py-3 border-t border-border",children:[N&&e.hasAnyUndoable&&(0,s.jsxs)("button",{onClick:$,disabled:b,className:"flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors px-2 py-1.5 disabled:opacity-50",children:[b?(0,s.jsx)(el.A,{size:12,className:"animate-spin"}):(0,s.jsx)(ti.A,{size:12}),d.organizeUndoAll]}),(0,s.jsxs)("button",{onClick:D,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium bg-[var(--amber)] text-[var(--amber-foreground)] hover:opacity-90 transition-all",children:[(0,s.jsx)(ev.A,{size:12}),d.organizeDone]})]})}return f?(0,s.jsx)("div",{className:"fixed inset-0 z-50 overlay-backdrop flex items-center justify-center p-4",onClick:e=>{e.target===e.currentTarget&&g(!1)},children:(0,s.jsxs)("div",{className:"w-full max-w-xl max-h-[80vh] flex flex-col bg-card rounded-xl shadow-xl border border-border animate-in fade-in-0 zoom-in-95 duration-200",onClick:z,role:"dialog","aria-modal":"true","aria-label":d.organizeDetailTitle,children:[(0,s.jsxs)("div",{className:"flex items-center justify-between px-5 pt-5 pb-3 shrink-0",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[c?(0,s.jsxs)("div",{className:"relative shrink-0",children:[(0,s.jsx)(tt.A,{size:16,className:"text-[var(--amber)]"}),(0,s.jsx)(el.A,{size:10,className:"absolute -bottom-0.5 -right-0.5 text-[var(--amber)] animate-spin"})]}):N?(0,s.jsx)(ev.A,{size:16,className:"text-success"}):(0,s.jsx)(eC.A,{size:16,className:"text-error"}),(0,s.jsx)("h2",{className:"text-base font-semibold text-foreground",children:d.organizeDetailTitle}),c&&(0,s.jsx)("span",{className:"text-xs text-muted-foreground/60 tabular-nums",children:d.organizeElapsed(m)})]}),(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[(0,s.jsx)("button",{type:"button",onClick:()=>g(!1),className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",title:d.organizeMinimizeModal,children:(0,s.jsx)(G.A,{size:14})}),(0,s.jsx)("button",{type:"button",onClick:D,className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",children:(0,s.jsx)(u.A,{size:14})})]})]}),(0,s.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto px-5 pb-2 space-y-4",children:[c&&(0,s.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2.5 rounded-lg bg-[var(--amber-subtle)] border border-[var(--amber-dim)]",children:[(0,s.jsx)(el.A,{size:14,className:"text-[var(--amber)] animate-spin shrink-0"}),(0,s.jsx)("span",{className:"text-xs text-foreground",children:th(o,x)})]}),e.sourceFileNames.length>0&&(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"text-xs font-medium text-muted-foreground mb-1.5",children:d.organizeSourceFiles}),(0,s.jsx)("div",{className:"flex flex-wrap gap-1.5",children:e.sourceFileNames.map((e,t)=>(0,s.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-md bg-muted/60 text-xs text-foreground",children:[(0,s.jsx)(tx.A,{size:11,className:"text-muted-foreground shrink-0"}),e]},t))})]}),(e.summary||c)&&(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"text-xs font-medium text-muted-foreground mb-1.5",children:d.organizeSummaryLabel}),(0,s.jsx)("div",{className:"px-3 py-2.5 rounded-lg bg-muted/30 border border-border text-sm text-foreground leading-relaxed whitespace-pre-wrap",children:e.summary||d.organizeNoSummary})]}),e.changes.length>0&&(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"text-xs font-medium text-muted-foreground mb-1.5",children:d.organizeChangesLabel(e.changes.length)}),(0,s.jsx)("div",{className:"space-y-0.5",children:e.changes.map((e,t)=>R(e,t))})]}),k&&(0,s.jsx)("div",{className:"px-3 py-2.5 rounded-lg bg-error/5 border border-error/20 text-xs text-error",children:e.error})]}),(N||k)&&P()]})}):p&&(N||k)?(0,s.jsxs)("div",{className:"fixed bottom-4 left-1/2 -translate-x-1/2 z-50 w-[420px] max-w-[calc(100vw-2rem)] bg-card border border-border rounded-xl shadow-xl animate-in fade-in-0 slide-in-from-bottom-2 duration-200",onClick:z,children:[(0,s.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[N?(0,s.jsx)(ev.A,{size:14,className:"text-success"}):(0,s.jsx)(eC.A,{size:14,className:"text-error"}),(0,s.jsx)("span",{className:"text-xs font-medium text-foreground",children:N?d.organizeReviewTitle:d.organizeErrorTitle})]}),(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[(0,s.jsx)("button",{type:"button",onClick:()=>{h(!1),g(!0)},className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",title:d.organizeDetailTitle,children:(0,s.jsx)(V.A,{size:13})}),(0,s.jsx)("button",{type:"button",onClick:()=>h(!1),className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",children:(0,s.jsx)(eb.A,{size:14})})]})]}),N&&(0,s.jsx)("div",{className:"max-h-[240px] overflow-y-auto p-2 space-y-0.5",children:e.changes.map((e,t)=>R(e,t))}),k&&(0,s.jsx)("div",{className:"p-4 text-center",children:(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:e.error})}),P()]}):(0,s.jsx)("div",{className:"fixed bottom-4 left-1/2 -translate-x-1/2 z-50 flex items-center gap-3 bg-card border border-border rounded-xl shadow-lg px-4 py-3 max-w-md animate-in fade-in-0 slide-in-from-bottom-2 duration-200",onClick:z,children:N?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(ev.A,{size:16,className:"text-success shrink-0"}),(0,s.jsx)("span",{className:"text-xs text-foreground truncate",children:d.organizeReviewDesc(C)}),e.changes.length>0&&(0,s.jsxs)("button",{type:"button",onClick:()=>{h(!0),z()},className:"flex items-center gap-1 text-xs font-medium text-[var(--amber)] hover:opacity-80 transition-colors shrink-0",children:[(0,s.jsx)(eb.A,{size:12,className:"rotate-180"}),d.organizeExpand]}),(0,s.jsxs)("button",{type:"button",onClick:D,className:"flex items-center gap-1 text-xs font-medium text-[var(--amber)] hover:opacity-80 transition-colors shrink-0",children:[(0,s.jsx)(ev.A,{size:12}),d.organizeDone]})]}):k?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(eC.A,{size:16,className:"text-error shrink-0"}),(0,s.jsx)("span",{className:"text-xs text-foreground truncate",children:d.organizeError}),(0,s.jsx)("button",{type:"button",onClick:()=>{h(!0),z()},className:"text-xs font-medium text-[var(--amber)] hover:opacity-80 transition-colors shrink-0",children:d.organizeExpand}),(0,s.jsx)("button",{type:"button",onClick:D,className:"text-muted-foreground/50 hover:text-muted-foreground transition-colors shrink-0",children:(0,s.jsx)(u.A,{size:14})})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"relative shrink-0",children:[(0,s.jsx)(tt.A,{size:16,className:"text-[var(--amber)]"}),(0,s.jsx)(el.A,{size:10,className:"absolute -bottom-0.5 -right-0.5 text-[var(--amber)] animate-spin"})]}),(0,s.jsx)("span",{className:"text-xs text-foreground truncate",children:th(o,x)}),(0,s.jsx)("span",{className:"text-xs text-muted-foreground/60 tabular-nums shrink-0",children:d.organizeElapsed(m)}),(0,s.jsx)("button",{type:"button",onClick:()=>{g(!0),z()},className:"text-muted-foreground/50 hover:text-muted-foreground transition-colors shrink-0",title:d.organizeDetailTitle,children:(0,s.jsx)(V.A,{size:13})}),(0,s.jsx)("button",{type:"button",onClick:D,className:"text-muted-foreground/50 hover:text-muted-foreground transition-colors shrink-0",children:(0,s.jsx)(u.A,{size:14})})]})})}var tg=r(37206);function tb(){return(0,a.useEffect)(()=>ec.zd.getState()._init(),[]),null}var tv=r(1934),ty=r(76449);let tj="mindos_walkthrough_done";function tw(e,t){if(e>=ty.g.length||t)try{localStorage.setItem(tj,"1")}catch{}fetch("/api/setup",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({guideState:{walkthroughStep:e,walkthroughDismissed:t}})}).catch(e=>{console.warn("[walkthrough-store] persist failed:",e)})}let tN=(0,tv.v)((e,t)=>{let r=ty.g.length;return{status:"idle",currentStep:0,totalSteps:r,start:()=>{e({currentStep:0,status:"active"}),tw(0,!1)},next:()=>{let s=t().currentStep+1;s>=r?(e({status:"completed"}),tw(r,!1)):(e({currentStep:s}),tw(s,!1))},back:()=>{let r=t().currentStep;r>0&&(e({currentStep:r-1}),tw(r-1,!1))},skip:()=>{e({status:"dismissed"}),tw(t().currentStep,!0)},_init:()=>{let t="1"===new URLSearchParams(window.location.search).get("welcome");if(t){let e=new URL(window.location.href);e.searchParams.delete("welcome"),window.history.replaceState({},"",e.pathname+(e.search||"")),window.dispatchEvent(new Event("mindos:first-visit"))}return window.innerWidth<768||function(){try{return"1"===localStorage.getItem(tj)}catch{return!1}}()?()=>{}:(fetch("/api/setup").then(e=>e.json()).then(s=>{let n=s.guideState;if(n){if(n.walkthroughDismissed||"number"==typeof n.walkthroughStep&&n.walkthroughStep>=r){try{localStorage.setItem(tj,"1")}catch{}return}n.active&&!n.dismissed&&void 0===n.walkthroughStep?t&&e({status:"active",currentStep:0}):"number"==typeof n.walkthroughStep&&n.walkthroughStep>=0&&n.walkthroughStep<r&&!n.walkthroughDismissed&&e({status:"active",currentStep:n.walkthroughStep})}}).catch(e=>{console.warn("[walkthrough-store] guideState read failed:",e)}),()=>{})}}});function tk({stepIndex:e,rect:t,position:r}){let n,i,o=tN(),{t:l}=(0,j.Y)(),[d,c]=(0,a.useState)({width:1024,height:768});if((0,a.useEffect)(()=>{let e=()=>c({width:window.innerWidth,height:window.innerHeight});return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),!o)return null;let u=l.walkthrough.steps[e];if(!u)return null;"right"===r?(n=t.top+t.height/2,i=t.right+12):(n=t.bottom+12,i=t.left+t.width/2);let m=d.width-320,x=d.height-200;return i=Math.min(i,m),n=Math.max(n=Math.min(n,x),8),(0,s.jsxs)("div",{className:`fixed z-[102] w-[280px] rounded-xl border shadow-lg animate-in fade-in duration-200 ${"right"===r?"slide-in-from-left-2":"slide-in-from-top-2"}`,style:{top:`${n}px`,left:`${i}px`,transform:"right"===r?"translateY(-50%)":"translateX(-50%)",background:"var(--card)",borderColor:"var(--amber)"},children:[(0,s.jsxs)("div",{className:"p-4",children:[(0,s.jsx)("div",{className:"flex items-center gap-2 mb-2",children:(0,s.jsx)("span",{className:"text-2xs font-mono px-1.5 py-0.5 rounded-full",style:{background:"var(--amber-dim)",color:"var(--amber)"},children:l.walkthrough.step(e+1,o.totalSteps)})}),(0,s.jsx)("h3",{className:"text-sm font-semibold mb-1",style:{color:"var(--foreground)"},children:u.title}),(0,s.jsx)("p",{className:"text-xs leading-relaxed",style:{color:"var(--muted-foreground)"},children:u.body}),(0,s.jsxs)("div",{className:"flex items-center justify-between mt-4 pt-3",style:{borderTop:"1px solid var(--border)"},children:[(0,s.jsx)("button",{onClick:o.skip,className:"text-xs transition-colors hover:opacity-80",style:{color:"var(--muted-foreground)"},children:l.walkthrough.skip}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[e>0&&(0,s.jsx)("button",{onClick:o.back,className:"text-xs px-2.5 py-1 rounded-lg transition-colors hover:bg-muted",style:{color:"var(--muted-foreground)"},children:l.walkthrough.back}),(0,s.jsx)("button",{onClick:o.next,className:"text-xs px-3 py-1.5 rounded-lg font-medium transition-all hover:opacity-90",style:{background:"var(--amber)",color:"var(--amber-foreground)"},children:e===o.totalSteps-1?l.walkthrough.done:l.walkthrough.next})]})]})]}),(0,s.jsx)("div",{className:"flex items-center justify-center gap-1.5 pb-3",children:Array.from({length:o.totalSteps},(t,r)=>(0,s.jsx)("div",{className:"w-1.5 h-1.5 rounded-full transition-all duration-200",style:{background:r===e?"var(--amber)":"var(--border)",transform:r===e?"scale(1.3)":void 0}},r))})]})}function tS(){let e=tN(),[t,r]=(0,a.useState)(null),[n,i]=(0,a.useState)(!1),o=(0,a.useId)(),l=e?ty.g[e.currentStep]:null,d=(0,a.useCallback)(()=>{if(!l)return;let e=document.querySelector(`[data-walkthrough="${l.anchor}"]`);e?r(e.getBoundingClientRect()):r(null)},[l]);(0,a.useEffect)(()=>{i(window.innerWidth<768),d();let e=()=>{i(window.innerWidth<768),d()};return window.addEventListener("resize",e),window.addEventListener("scroll",d,!0),()=>{window.removeEventListener("resize",e),window.removeEventListener("scroll",d,!0)}},[d]),(0,a.useEffect)(()=>{d();let e=setTimeout(d,100);return()=>clearTimeout(e)},[e?.currentStep,d]);let c=e?.skip;(0,a.useEffect)(()=>{if(!c)return;let e=e=>{"Escape"===e.key&&(e.stopPropagation(),c())};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[c]);let u=e?.currentStep??0;return((0,a.useEffect)(()=>{if(!l)return;let e=setTimeout(()=>{document.querySelector(`[data-walkthrough="${l.anchor}"]`)||tN.getState().next()},500);return()=>clearTimeout(e)},[u]),(0,a.useEffect)(()=>{let e=setTimeout(()=>{tN.getState().skip()},6e4);return()=>clearTimeout(e)},[u]),e&&l)?n?(0,s.jsx)(tC,{}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("svg",{className:"fixed inset-0 z-[100] pointer-events-auto",width:"100%",height:"100%",onClick:r=>{if(t){let s=r.clientX,n=r.clientY;s>=t.left-6&&s<=t.right+6&&n>=t.top-6&&n<=t.bottom+6||e.skip()}else e.skip()},children:[(0,s.jsx)("defs",{children:(0,s.jsxs)("mask",{id:o,children:[(0,s.jsx)("rect",{width:"100%",height:"100%",fill:"white"}),t&&(0,s.jsx)("rect",{x:t.left-6,y:t.top-6,width:t.width+12,height:t.height+12,rx:8,ry:8,fill:"black"})]})}),(0,s.jsx)("rect",{width:"100%",height:"100%",fill:"rgba(0, 0, 0, 0.5)",mask:`url(#${o})`})]}),t&&(0,s.jsx)(tk,{stepIndex:e.currentStep,rect:t,position:l.position}),!t&&(0,s.jsx)("div",{className:"fixed inset-0 z-[101] flex items-center justify-center pointer-events-none",children:(0,s.jsx)("button",{onClick:e.skip,className:"pointer-events-auto px-4 py-2 text-sm rounded-lg font-medium transition-all hover:opacity-90",style:{background:"var(--amber)",color:"var(--amber-foreground)"},children:e.currentStep===e.totalSteps-1?"✓":"→"})})]}):null}function tC(){let e=tN(),{t}=(0,j.Y)();if(!e)return null;let r=t.walkthrough.steps[e.currentStep];return r?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"fixed inset-0 z-[100] bg-black/40 backdrop-blur-sm",onClick:e.skip}),(0,s.jsxs)("div",{className:"fixed bottom-0 left-0 right-0 z-[101] rounded-t-2xl border-t shadow-lg p-5 pb-8 animate-in slide-in-from-bottom duration-300",style:{background:"var(--card)",borderColor:"var(--border)"},children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,s.jsx)("span",{className:"text-2xs font-mono px-1.5 py-0.5 rounded-full",style:{background:"var(--amber-dim)",color:"var(--amber)"},children:t.walkthrough.step(e.currentStep+1,e.totalSteps)}),(0,s.jsx)("div",{className:"flex items-center gap-1 ml-auto",children:Array.from({length:e.totalSteps},(t,r)=>(0,s.jsx)("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:r===e.currentStep?"var(--amber)":"var(--border)"}},r))})]}),(0,s.jsx)("h3",{className:"text-base font-semibold mb-1",style:{color:"var(--foreground)"},children:r.title}),(0,s.jsx)("p",{className:"text-sm leading-relaxed mb-5",style:{color:"var(--muted-foreground)"},children:r.body}),(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("button",{onClick:e.skip,className:"text-sm transition-colors hover:opacity-80",style:{color:"var(--muted-foreground)"},children:t.walkthrough.skip}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[e.currentStep>0&&(0,s.jsx)("button",{onClick:e.back,className:"text-sm px-3 py-2 rounded-lg transition-colors hover:bg-muted",style:{color:"var(--muted-foreground)"},children:t.walkthrough.back}),(0,s.jsx)("button",{onClick:e.next,className:"text-sm px-4 py-2 rounded-lg font-medium transition-all hover:opacity-90",style:{background:"var(--amber)",color:"var(--amber-foreground)"},children:e.currentStep===e.totalSteps-1?t.walkthrough.done:t.walkthrough.next})]})]})]})]}):null}function tA(){return(0,a.useEffect)(()=>tN.getState()._init(),[]),"active"===tN(e=>e.status)?(0,s.jsx)(tS,{}):null}let tz=new Set(["mp3","wav","m4a","ogg","flac","aac"]),tE=new Set(["png","jpg","jpeg","gif","webp","svg","bmp","ico"]),t$=new Set(["mp4","webm","mov","mkv"]);for(let e of[{id:"agent-inspector",name:"Agent Inspector",description:"Visualizes agent tool-call logs as a filterable timeline. Auto-activates on .mindos/agent-audit-log.json and supports legacy .agent-log.json.",author:"MindOS",icon:"\uD83D\uDD0D",tags:["agent","inspector","log","mcp","tools"],builtin:!0,core:!0,appBuiltinFeature:!0,entryPath:".mindos/agent-audit-log.json",match:({filePath:e})=>/(^|\/)\.mindos\/agent-audit-log\.json$/i.test(e)||/\.agent-log\.json$/i.test(e),load:()=>Promise.resolve().then(r.bind(r,18847)).then(e=>({default:e.AgentInspectorRenderer}))},{id:"audio",name:"Audio Player",description:"Plays audio files with native browser controls.",author:"MindOS",icon:"\uD83C\uDFB5",tags:["audio","music","voice","mp3","wav"],builtin:!0,core:!0,appBuiltinFeature:!0,match:({extension:e})=>tz.has(e),load:()=>Promise.resolve().then(r.bind(r,14446)).then(e=>({default:e.AudioRenderer}))},{id:"backlinks",name:"Backlinks Explorer",description:"Shows all files that link to the current page via wikilinks or markdown links, with highlighted snippet context.",author:"MindOS",icon:"\uD83D\uDD17",tags:["backlinks","wiki","links","references"],builtin:!0,entryPath:"BACKLINKS.md",match:({filePath:e})=>/\bBACKLINKS\b.*\.md$/i.test(e),load:()=>Promise.resolve().then(r.bind(r,88946)).then(e=>({default:e.BacklinksRenderer}))},{id:"change-log",name:"Content Changes",description:"Renders the .mindos/change-log.json file as a searchable timeline of content edits.",author:"MindOS",icon:"\uD83D\uDCCB",tags:["changelog","history","changes"],builtin:!0,core:!0,appBuiltinFeature:!0,match:({filePath:e})=>/\.mindos\/change-log\.json$/i.test(e),load:()=>Promise.resolve().then(r.bind(r,57025)).then(e=>({default:e.ChangeLogRenderer}))},{id:"config-panel",name:"Config Panel",description:"Renders CONFIG.json as an editable control panel based on uiSchema/keySpecs. Changes are written back to the JSON file directly.",author:"MindOS",icon:"\uD83E\uDDE9",tags:["config","json","settings","schema"],builtin:!0,core:!0,appBuiltinFeature:!0,entryPath:"CONFIG.json",match:({filePath:e,extension:t})=>"json"===t&&/(^|\/)CONFIG\.json$/i.test(e),load:()=>Promise.resolve().then(r.bind(r,35504)).then(e=>({default:e.ConfigRenderer}))},{id:"csv",name:"CSV Views",description:"Renders any CSV file as Table, Gallery, or Board. Each view is independently configurable — choose which columns map to title, description, tag, and group.",author:"MindOS",icon:"\uD83D\uDCCA",tags:["csv","table","gallery","board","data"],builtin:!0,core:!0,appBuiltinFeature:!0,entryPath:"Resources/Products.csv",match:({extension:e,filePath:t})=>"csv"===e&&!/\bTODO\b/i.test(t),load:()=>Promise.resolve().then(r.bind(r,92306)).then(e=>({default:e.CsvRenderer}))},{id:"image",name:"Image Viewer",description:"Renders image files with zoom, fit-to-view, and transparency support.",author:"MindOS",icon:"\uD83D\uDDBC",tags:["image","photo","viewer","png","jpg","svg"],builtin:!0,core:!0,appBuiltinFeature:!0,match:({extension:e})=>tE.has(e),load:()=>Promise.resolve().then(r.bind(r,20814)).then(e=>({default:e.ImageRenderer}))},{id:"pdf",name:"PDF Viewer",description:"Renders PDF files using the browser built-in PDF viewer.",author:"MindOS",icon:"\uD83D\uDCC4",tags:["pdf","document","viewer"],builtin:!0,core:!0,appBuiltinFeature:!0,match:({extension:e})=>"pdf"===e,load:()=>Promise.resolve().then(r.bind(r,20870)).then(e=>({default:e.PdfRenderer}))},{id:"summary",name:"AI Briefing",description:"Streams an AI-generated daily briefing summarizing your most recently modified files — key changes, recurring themes, and suggested next actions.",author:"MindOS",icon:"✨",tags:["ai","summary","briefing","daily"],builtin:!0,entryPath:"DAILY.md",match:({filePath:e})=>/\b(SUMMARY|summary|Summary|BRIEFING|briefing|Briefing|DAILY|daily|Daily)\b.*\.md$/i.test(e),load:()=>Promise.resolve().then(r.bind(r,56406)).then(e=>({default:e.SummaryRenderer}))},{id:"timeline",name:"Timeline",description:"Renders changelog and journal files as a vertical timeline. Any markdown with ## date headings (e.g. ## 2025-01-15) becomes a card in the feed.",author:"MindOS",icon:"\uD83D\uDCC5",tags:["timeline","changelog","journal","history"],builtin:!0,entryPath:"CHANGELOG.md",match:({filePath:e})=>/\b(CHANGELOG|changelog|TIMELINE|timeline|journal|Journal|diary|Diary)\b.*\.md$/i.test(e),load:()=>Promise.resolve().then(r.bind(r,39594)).then(e=>({default:e.TimelineRenderer}))},{id:"todo",name:"TODO Board",description:"Renders TODO.md/TODO.csv as an interactive kanban board grouped by section. Check items off directly — changes are written back to the source file.",author:"MindOS",icon:"✅",tags:["productivity","tasks","markdown"],builtin:!0,core:!0,appBuiltinFeature:!0,entryPath:"TODO.md",match:({filePath:e})=>/\bTODO\b.*\.(md|csv)$/i.test(e),load:()=>Promise.resolve().then(r.bind(r,78660)).then(e=>({default:e.TodoRenderer}))},{id:"video",name:"Video Player",description:"Plays video files with native browser controls.",author:"MindOS",icon:"\uD83C\uDFAC",tags:["video","movie","recording","mp4","webm"],builtin:!0,core:!0,appBuiltinFeature:!0,match:({extension:e})=>t$.has(e),load:()=>Promise.resolve().then(r.bind(r,87986)).then(e=>({default:e.VideoRenderer}))},{id:"workflow-yaml",name:"Workflow Runner",description:"Execute step-by-step YAML workflows with Skills & Agent support.",author:"MindOS",icon:"⚡",tags:["workflow","automation","steps","ai","yaml"],builtin:!0,core:!0,appBuiltinFeature:!0,entryPath:".mindos/workflows/",match:({extension:e,filePath:t})=>("yaml"===e||"yml"===e)&&/\.flow\.(yaml|yml)$/i.test(t),load:()=>Promise.resolve().then(r.bind(r,48133)).then(e=>({default:e.WorkflowYamlRenderer}))},{id:"graph",name:"Wiki Graph",description:"Force-directed graph of wikilink references across all markdown files. Supports Global and Local (2-hop) scope filters.",author:"MindOS",icon:"\uD83D\uDD78️",tags:["graph","wiki","links","visualization"],builtin:!0,match:()=>!1,load:()=>Promise.resolve().then(r.bind(r,92950)).then(e=>({default:e.GraphRenderer}))}])(0,eU.TS)(e);var tT=r(48391),tD=r(29494);let tR=(0,tg.default)(()=>r.e(5576).then(r.bind(r,95576)),{loadableGenerated:{webpack:()=>[95576]},ssr:!1}),tP=(0,tg.default)(()=>r.e(2935).then(r.bind(r,22935)),{loadableGenerated:{webpack:()=>[22935]},ssr:!1}),tM=(0,tg.default)(()=>Promise.all([r.e(9207),r.e(3269)]).then(r.bind(r,13269)),{loadableGenerated:{webpack:()=>[13269]},ssr:!1}),tF=(0,tg.default)(()=>r.e(808).then(r.bind(r,80808)),{loadableGenerated:{webpack:()=>[80808]},ssr:!1}),tI=(0,tg.default)(()=>r.e(1814).then(r.bind(r,51814)),{loadableGenerated:{webpack:()=>[51814]},ssr:!1});function tL({fileTree:e,children:t}){let r=function(){let[e,t]=(0,a.useState)("files"),[r,s]=(0,a.useState)(null),[n,i]=(0,a.useState)(!1),[o,l]=(0,a.useState)(!1);(0,a.useEffect)(()=>{try{"true"===localStorage.getItem("rail-expanded")&&l(!0)}catch{}},[]),(0,a.useEffect)(()=>{if(e){try{let e=localStorage.getItem("left-panel-width");if(e){let t=parseInt(e,10);if(t>=240&&t<=600)return void s(t)}}catch{}s(280)}},[e]),(0,a.useEffect)(()=>{i(!1)},[e]);let d=(0,a.useCallback)(e=>s(e),[]),c=(0,a.useCallback)(e=>{try{localStorage.setItem("left-panel-width",String(e))}catch{}},[]),u=(0,a.useCallback)(()=>i(e=>!e),[]),m=(0,a.useCallback)(e=>{l(e);try{localStorage.setItem("rail-expanded",String(e))}catch{}},[]),x=null!==e,p=r??(e?er[e]:280);return{activePanel:e,setActivePanel:t,panelWidth:r,panelMaximized:n,railExpanded:o,railWidth:o?180:48,panelOpen:x,effectivePanelWidth:p,handlePanelWidthChange:d,handlePanelWidthCommit:c,handlePanelMaximize:u,handleExpandedChange:m}}(),i=function(){let[e,t]=(0,a.useState)(!1),[r,s]=(0,a.useState)(380),[n,i]=(0,a.useState)("panel"),[o,l]=(0,a.useState)(!1),[d,c]=(0,a.useState)(""),[u,m]=(0,a.useState)(!1),x=(0,a.useRef)(!1);x.current=u;let[p,h]=(0,a.useState)("user"),[f,g]=(0,a.useState)(null),b=(0,a.useRef)(380),v=(0,eB.KT)();(0,a.useEffect)(()=>{try{let e=localStorage.getItem("right-ask-panel-width");if(e){let t=parseInt(e,10);t>=320&&t<=4e3?(s(t),b.current=t):t>4e3&&(s(380),b.current=380)}let t=localStorage.getItem("ask-mode");"popup"===t&&i("popup")}catch{}let e=e=>{"ask-mode"===e.key&&("panel"===e.newValue||"popup"===e.newValue)&&i(e.newValue)};window.addEventListener("storage",e);let r=()=>{t(!0),x.current&&(m(!1),s(b.current))};return window.addEventListener("mindos:open-ask-panel",r),()=>{window.removeEventListener("storage",e),window.removeEventListener("mindos:open-ask-panel",r)}},[]),(0,a.useEffect)(()=>{v.open&&(c(v.initialMessage),h(v.source),g(v.acpAgent),"popup"===n?l(!0):t(!0),v.close())},[v.open,v.initialMessage,v.source,v.acpAgent,v.close,n]);let y=(0,a.useCallback)(()=>{"popup"===n?l(e=>(e||(c(""),h("user"),g(null)),!e)):t(e=>(e||(c(""),h("user"),g(null)),!e))},[n]),j=(0,a.useCallback)(()=>{t(!1),u&&(s(b.current),m(!1))},[u]),w=(0,a.useCallback)(()=>{m(e=>(e?s(b.current):b.current=r,!e))},[r]),N=(0,a.useCallback)(()=>l(!1),[]),k=(0,a.useCallback)(e=>s(e),[]);return{askPanelOpen:e,askPanelWidth:r,askMaximized:u,askMode:n,desktopAskPopupOpen:o,askInitialMessage:d,askOpenSource:p,askAcpAgent:f,toggleAskPanel:y,closeAskPanel:j,closeDesktopAskPopup:N,handleAskWidthChange:k,handleAskWidthCommit:(0,a.useCallback)(e=>{try{localStorage.setItem("right-ask-panel-width",String(e))}catch{}},[]),handleAskModeSwitch:(0,a.useCallback)(()=>{i(e=>{let r="panel"===e?"popup":"panel";try{localStorage.setItem("ask-mode",r),window.dispatchEvent(new StorageEvent("storage",{key:"ask-mode",newValue:r}))}catch{}return"popup"===r?(t(!1),l(!0)):(l(!1),t(!0)),r})},[]),toggleAskMaximized:w}}(),[x,p]=(0,a.useState)(!1),[h,f]=(0,a.useState)(void 0),[g,b]=(0,a.useState)(!1),[v,y]=(0,a.useState)(null),[w,N]=(0,a.useState)(null),[k,S]=(0,a.useState)(()=>{try{let e=localStorage.getItem("right-agent-detail-panel-width");if(e){let t=parseInt(e,10);if(t>=300&&t<=640)return t}}catch{}return 400}),C=(0,tT.dB)(),[A,E]=(0,a.useState)(!1),[$,T]=(0,a.useState)(0);(0,a.useEffect)(()=>{("organizing"===C.phase||"done"===C.phase||"error"===C.phase)&&E(!0)},[C.phase]);let P=(0,a.useCallback)(()=>{E(!1),"organizing"!==C.phase||C.abort(),C.reset()},[C]),F=(0,a.useCallback)(()=>{T(e=>e+1),window.dispatchEvent(new Event("mindos:organize-history-update"))},[]),[I,L]=(0,a.useState)(!1),[O,W]=(0,a.useState)(void 0),[B,U]=(0,a.useState)(void 0),[_,H]=(0,a.useState)(!1),X=(0,a.useRef)(0),K=(0,a.useCallback)(e=>{W(e),U(void 0),L(!0)},[]),Y=(0,a.useCallback)(()=>{L(!1),W(void 0),U(void 0)},[]),[G,V]=(0,a.useState)(!1),[q,Z]=(0,a.useState)(!1),[Q,ee]=(0,a.useState)(!1),{t:et}=(0,j.Y)(),en=(0,n.useRouter)(),ea=(0,n.usePathname)(),ei=(0,a.useMemo)(()=>(function e(t,r=""){let s=[];for(let n of t)if("directory"===n.type&&!n.name.startsWith(".")){let t=r?`${r}/${n.name}`:n.name;s.push(t),n.children&&s.push(...e(n.children,t))}return s})(e),[e]),{status:el,fetchStatus:ed}=z(),ec=ea.startsWith("/view/")?ea.slice(6).split("/").map(decodeURIComponent).join("/"):void 0;(0,a.useEffect)(()=>{i.askMaximized&&i.toggleAskMaximized()},[ea,r.panelOpen]);let eu=(0,a.useCallback)(()=>{i.askMaximized&&i.toggleAskMaximized()},[i.askMaximized,i.toggleAskMaximized]);(0,a.useEffect)(()=>{"/"===ea&&i.askPanelOpen&&i.closeAskPanel()},[ea]);let em=ea?.startsWith("/agents"),ex=r.activePanel??(em?"agents":null);(0,a.useEffect)(()=>{let e=e=>{let t=e.detail?.tab;t&&f(t),p(!0)};return window.addEventListener("mindos:open-settings",e),()=>window.removeEventListener("mindos:open-settings",e)},[]),(0,a.useEffect)(()=>{let e=()=>K();return window.addEventListener("mindos:open-import",e),()=>window.removeEventListener("mindos:open-import",e)},[K]);let ep=(0,a.useRef)([]);(0,a.useEffect)(()=>{let e=e=>{let t=e.detail?.files;if(!t||0===t.length||"organizing"===C.phase)return;let r=et.inbox.organizePrompt(t.map(e=>e.name));ep.current=t.map(e=>e.name),(async()=>{let e=[];for(let r of t)try{let t=await fetch(`/api/file?path=${encodeURIComponent(r.path)}`);if(t.ok){let s=await t.json();e.push({name:r.name,content:s.content??""})}}catch{}e.length>0?C.start(e,r,"inbox-organize"):(e6.oR.error(et.inbox.organizeFailed,4e3),window.dispatchEvent(new Event("mindos:organize-done")))})()};return window.addEventListener("mindos:inbox-organize",e),()=>window.removeEventListener("mindos:inbox-organize",e)},[C,et]),(0,a.useEffect)(()=>{let e=e=>{let t=e.detail;if(!t?.content||"organizing"===C.phase)return;let r={name:t.name,content:t.content};C.start([r],"Organize this conversation into well-structured notes in my knowledge base. Extract key insights, decisions, action items, and important details. Create appropriate files with clear titles. Write in the same language as the content.","conversation")};return window.addEventListener("mindos:session-organize",e),()=>window.removeEventListener("mindos:session-organize",e)},[C]),(0,a.useEffect)(()=>{if("done"===C.phase){let e=C.changes.some(e=>e.ok),t=ep.current;e&&t.length>0&&(fetch("/api/inbox",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({names:t})}).then(()=>{window.dispatchEvent(new Event("mindos:inbox-updated"))}).catch(()=>{}),ep.current=[]),window.dispatchEvent(new Event("mindos:organize-done"))}else"error"===C.phase&&window.dispatchEvent(new Event("mindos:organize-done"))},[C.phase,C.changes]),(0,a.useEffect)(()=>{let e=e=>{let t=e.detail?.panel;t&&r.setActivePanel(t)};return window.addEventListener("mindos:open-panel",e),()=>window.removeEventListener("mindos:open-panel",e)},[r]);let eh=(0,a.useCallback)(()=>{let e=()=>window.dispatchEvent(new Event("guide-state-updated"));"guide"===i.askOpenSource?fetch("/api/setup",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({guideState:{askedAI:!0}})}).then(e).catch(e=>console.warn("Guide state update failed:",e)):"guide-next"===i.askOpenSource&&e()},[i.askOpenSource]);(0,a.useEffect)(()=>{let e=requestAnimationFrame(()=>V(!1));return()=>cancelAnimationFrame(e)},[ea]),(0,a.useEffect)(()=>{ea?.startsWith("/echo")&&r.setActivePanel("echo")},[ea,r.setActivePanel]);let ef=(0,a.useCallback)(e=>{S(e);try{localStorage.setItem("right-agent-detail-panel-width",String(e))}catch{}},[]),eg=(0,a.useCallback)(()=>N(null),[]),eb=null!==w&&"agents"===r.activePanel;(0,a.useEffect)(()=>{let e=-1,t=!1,r=async()=>{if(!t&&"hidden"!==document.visibilityState)try{let t=await fetch("/api/tree-version");if(!t.ok)return;let{v:r}=await t.json();if(-1===e){e=r;return}r!==e&&(e=r,en.refresh(),window.dispatchEvent(new Event("mindos:files-changed")))}catch(e){console.debug("[tree-version] poll failed",e)}},s=()=>{"visible"===document.visibilityState&&r()};r();let n=setInterval(()=>void r(),3e3);return document.addEventListener("visibilitychange",s),()=>{t=!0,clearInterval(n),document.removeEventListener("visibilitychange",s)}},[en]),(0,a.useEffect)(()=>{let e=e=>{if("Escape"===e.key){if(r.panelMaximized)return void r.handlePanelMaximize();if(eb)return void N(null);if(i.askPanelOpen)return void i.closeAskPanel();if(i.desktopAskPopupOpen)return void i.closeDesktopAskPopup()}(e.metaKey||e.ctrlKey)&&"k"===e.key&&(e.preventDefault(),window.innerWidth>=768?r.setActivePanel(e=>"search"===e?null:"search"):Z(e=>!e)),(e.metaKey||e.ctrlKey)&&"/"===e.key&&(e.preventDefault(),window.innerWidth>=768?i.toggleAskPanel():ee(e=>!e)),(e.metaKey||e.ctrlKey)&&","===e.key&&(e.preventDefault(),p(e=>!e)),(e.metaKey||e.ctrlKey)&&"i"===e.key&&(e.preventDefault(),L(e=>!e))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[eb,r,i]);let ev=(0,a.useCallback)(()=>{f("sync"),b(!1),p(!0)},[]),ey=(0,a.useCallback)(()=>{p(!0),f(void 0)},[]),ej=(0,a.useCallback)(()=>{p(!1),f(void 0)},[]),ew=(0,a.useCallback)(e=>{y(e),b(e=>!e)},[]),eN=(0,a.useCallback)(e=>{r.handleExpandedChange(e),b(!1)},[r]);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(tb,{}),(0,s.jsx)(tA,{}),(0,s.jsx)("a",{href:"#main-content",className:"sr-only focus-visible:not-sr-only focus-visible:fixed focus-visible:top-2 focus-visible:left-2 focus-visible:z-[60] focus-visible:px-4 focus-visible:py-2 focus-visible:rounded-lg focus-visible:text-sm focus-visible:font-medium bg-[var(--amber)] text-[var(--amber-foreground)]",children:"Skip to main content"}),(0,s.jsx)(M,{activePanel:ex,onPanelChange:r.setActivePanel,onEchoClick:()=>{eu();let e="echo"===r.activePanel,t=ea?.startsWith("/echo");e?t?r.setActivePanel(null):en.push("/echo/about-you"):(r.setActivePanel("echo"),en.push("/echo/about-you"))},onAgentsClick:()=>{eu();let e="agents"===r.activePanel,t=ea?.startsWith("/agents");e?t?r.setActivePanel(null):en.push("/agents"):(r.setActivePanel("agents"),en.push("/agents")),N(null)},onDiscoverClick:()=>{eu();let e="discover"===r.activePanel,t=ea?.startsWith("/explore");e?t?r.setActivePanel(null):en.push("/explore"):(r.setActivePanel("discover"),en.push("/explore"))},onSpacesClick:()=>{eu();let e="files"===r.activePanel,t="/"===ea||"/wiki"===ea||ea?.startsWith("/view/")||ea?.startsWith("/wiki/");e?t?r.setActivePanel(null):en.push("/wiki"):(r.setActivePanel("files"),en.push("/wiki"))},syncStatus:el,expanded:r.railExpanded,onExpandedChange:eN,onSettingsClick:ey,onSyncClick:ew}),(0,s.jsxs)(es,{activePanel:r.activePanel,fileTree:e,onNavigate:()=>{},onOpenSyncSettings:ev,railWidth:r.railWidth,panelWidth:r.panelWidth??void 0,onWidthChange:r.handlePanelWidthChange,onWidthCommit:r.handlePanelWidthCommit,maximized:r.panelMaximized,onMaximize:r.handlePanelMaximize,onImport:K,children:[(0,s.jsx)("div",{className:`flex flex-col h-full ${"echo"===r.activePanel?"":"hidden"}`,children:(0,s.jsx)(eZ,{active:"echo"===r.activePanel,maximized:r.panelMaximized,onMaximize:r.handlePanelMaximize})}),(0,s.jsx)("div",{className:`flex flex-col h-full ${"search"===r.activePanel?"":"hidden"}`,children:(0,s.jsx)(eo,{active:"search"===r.activePanel,maximized:r.panelMaximized,onMaximize:r.handlePanelMaximize})}),(0,s.jsx)("div",{className:`flex flex-col h-full ${"agents"===r.activePanel?"":"hidden"}`,children:(0,s.jsx)(e$,{active:"agents"===r.activePanel,maximized:r.panelMaximized,onMaximize:r.handlePanelMaximize,selectedAgentKey:eb?w:null})}),(0,s.jsx)("div",{className:`flex flex-col h-full ${"discover"===r.activePanel?"":"hidden"}`,children:(0,s.jsx)(eK,{active:"discover"===r.activePanel,maximized:r.panelMaximized,onMaximize:r.handlePanelMaximize})}),(0,s.jsx)("div",{className:`flex flex-col h-full ${"workflows"===r.activePanel?"":"hidden"}`,children:(0,s.jsx)(e0,{active:"workflows"===r.activePanel,maximized:r.panelMaximized,onMaximize:r.handlePanelMaximize})})]}),(0,s.jsx)(e5,{open:i.askPanelOpen,onClose:i.closeAskPanel,currentFile:ec,initialMessage:i.askInitialMessage,initialAcpAgent:i.askAcpAgent,onFirstMessage:eh,width:i.askPanelWidth,onWidthChange:i.handleAskWidthChange,onWidthCommit:i.handleAskWidthCommit,askMode:i.askMode,onModeSwitch:i.handleAskModeSwitch,maximized:i.askMaximized,onMaximize:i.toggleAskMaximized,sidebarOffset:r.panelOpen?r.railWidth+r.effectivePanelWidth:r.railWidth}),(0,s.jsx)(te,{open:eb,agentKey:w,onClose:eg,rightOffset:i.askPanelOpen?i.askPanelWidth:0,width:k,onWidthChange:S,onWidthCommit:ef}),(0,s.jsx)(tP,{open:i.desktopAskPopupOpen,onClose:i.closeDesktopAskPopup,currentFile:ec,initialMessage:i.askInitialMessage,initialAcpAgent:i.askAcpAgent,onFirstMessage:eh,askMode:i.askMode,onModeSwitch:i.handleAskModeSwitch}),(0,s.jsx)(tr,{onToggle:i.toggleAskPanel,askPanelOpen:i.askPanelOpen||i.desktopAskPopupOpen}),(0,s.jsx)(tn,{}),(0,s.jsx)(tM,{open:x,onClose:ej,initialTab:h}),(0,s.jsx)(ts,{open:g,onClose:()=>b(!1),anchorRect:v,railWidth:r.railWidth,onOpenSyncSettings:ev,syncStatus:el,onSyncStatusRefresh:ed}),(0,s.jsxs)("header",{className:"md:hidden fixed top-0 left-0 right-0 z-30 bg-card border-b border-border flex items-center justify-between px-3 py-2",style:{paddingTop:"env(safe-area-inset-top, 0px)"},children:[(0,s.jsx)("button",{onClick:()=>V(!0),className:"p-3 -ml-1 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors active:bg-accent","aria-label":"Open menu",children:(0,s.jsx)(l.A,{size:20})}),(0,s.jsxs)(o(),{href:"/",className:"flex items-center gap-2 hover:opacity-80 transition-opacity",children:[(0,s.jsx)(R.A,{id:"mobile"}),(0,s.jsx)("span",{className:"text-foreground text-sm font-brand",children:"MindOS"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,s.jsx)("button",{onClick:ev,className:"p-3 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors active:bg-accent flex items-center justify-center","aria-label":"Sync status",children:(0,s.jsx)(D,{status:el})}),(0,s.jsx)("button",{onClick:()=>Z(!0),className:"p-3 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors active:bg-accent","aria-label":et.sidebar.searchTitle,children:(0,s.jsx)(d.A,{size:20})}),(0,s.jsx)("button",{onClick:()=>{p(!0),f(void 0)},className:"p-3 -mr-1 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors active:bg-accent","aria-label":et.sidebar.settingsTitle,children:(0,s.jsx)(c.A,{size:20})})]})]}),G&&(0,s.jsx)("div",{className:"md:hidden fixed inset-0 z-40 overlay-backdrop",onClick:()=>V(!1)}),(0,s.jsxs)("aside",{className:`md:hidden fixed top-0 left-0 h-screen w-[85vw] max-w-[320px] z-50 bg-card border-r border-border flex flex-col transition-transform duration-300 ease-in-out ${G?"translate-x-0":"-translate-x-full"}`,children:[(0,s.jsxs)("div",{className:"flex items-center justify-between px-4 py-4 border-b border-border shrink-0",children:[(0,s.jsxs)(o(),{href:"/",className:"flex items-center gap-2 hover:opacity-80 transition-opacity",children:[(0,s.jsx)(R.A,{id:"drawer"}),(0,s.jsx)("span",{className:"text-foreground text-sm font-brand",children:"MindOS"})]}),(0,s.jsx)("button",{onClick:()=>V(!1),className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",children:(0,s.jsx)(u.A,{size:16})})]}),(0,s.jsx)("div",{className:"flex-1 overflow-y-auto min-h-0 px-2 py-2",children:(0,s.jsx)(J.Ay,{nodes:e,onNavigate:()=>V(!1),onImport:K})})]}),(0,s.jsx)(tR,{open:q,onClose:()=>Z(!1)}),(0,s.jsx)(tP,{open:Q,onClose:()=>ee(!1),currentFile:ec}),(0,s.jsxs)("main",{id:"main-content",className:"min-h-screen transition-all duration-200 pt-[52px] md:pt-0",onDragEnter:e=>{e.dataTransfer.types.includes("Files")&&(e.preventDefault(),X.current++,1===X.current&&H(!0))},onDragOver:e=>{e.dataTransfer.types.includes("Files")&&e.preventDefault()},onDragLeave:()=>{X.current=Math.max(0,X.current-1),0===X.current&&H(!1)},onDrop:e=>{e.preventDefault(),X.current=0,H(!1),e.dataTransfer.files.length>0&&!I&&(0,tD.QL)(Array.from(e.dataTransfer.files),et)},children:[(0,s.jsxs)("div",{className:"min-h-screen bg-background",style:{overflowX:"clip"},children:[(0,s.jsx)(ta,{}),t]}),(0,s.jsx)(tl,{}),(0,s.jsx)(tF,{t:et,dirPaths:ei}),_&&!I&&(0,s.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm transition-opacity duration-200",children:(0,s.jsxs)("div",{className:"border-2 border-dashed border-[var(--amber)]/50 rounded-xl p-12 flex flex-col items-center gap-3",children:[(0,s.jsx)(m.A,{size:48,className:"text-[var(--amber)]/60"}),(0,s.jsx)("p",{className:"text-sm text-foreground font-medium",children:et.inbox.dropOverlay}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:et.inbox.dropOverlayFormats})]})})]}),(0,s.jsx)(tI,{open:I,onClose:Y,defaultSpace:O,initialFiles:B,aiOrganize:C,dirPaths:ei}),A&&(0,s.jsx)(tf,{aiOrganize:C,onDismiss:P,onCancel:()=>{C.abort(),C.reset(),E(!1)},onHistoryUpdate:F}),(0,s.jsx)("style",{children:`
|
|
118
118
|
@media (min-width: 768px) {
|
|
119
119
|
:root {
|
|
120
120
|
--right-panel-width: ${i.askMaximized?`calc(100vw - ${r.panelOpen?r.railWidth+r.effectivePanelWidth:r.railWidth}px)`:`${i.askPanelOpen?i.askPanelWidth:0}px`};
|
|
@@ -126,8 +126,8 @@ Be specific. Reference actual content from the files. Keep the total response un
|
|
|
126
126
|
padding-top: 0;
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
|
-
`})]})}function tO({fileTree:e,children:t}){return"/login"===(0,n.usePathname)()?(0,s.jsx)(s.Fragment,{children:t}):(0,s.jsx)(tL,{fileTree:e,children:t})}},66709:(e,t,r)=>{"use strict";r.d(t,{A:()=>u});var s=r(95155),n=r(12115),a=r(92451),i=r(33210),o=r(6296),l=r(13545),d=r(12651),c=r(35581);function u({open:e,onClose:t,onDiscover:r,discovering:u,error:m}){let{t:x}=(0,c.Y)(),p=x.panels.agents,[f,h]=(0,n.useState)(""),[g,b]=(0,n.useState)(null);if(!e)return null;let v=async()=>{if(!f.trim()||u)return;b(null);let e=await r(f.trim());e&&b(e)},y=()=>{h(""),b(null),t()};return(0,s.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center overlay-backdrop",onClick:y,children:(0,s.jsxs)("div",{className:"bg-popover border border-border rounded-xl shadow-lg w-full max-w-md mx-4 p-5",onClick:e=>e.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":p.a2aDiscover,children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,s.jsxs)("h3",{className:"text-sm font-semibold text-foreground flex items-center gap-2",children:[(0,s.jsx)(a.A,{size:15,className:"text-muted-foreground"}),p.a2aDiscover]}),(0,s.jsx)("button",{type:"button",onClick:y,className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":"Close",children:(0,s.jsx)(i.A,{size:14})})]}),(0,s.jsx)("p",{className:"text-2xs text-muted-foreground mb-3",children:p.a2aDiscoverHint}),(0,s.jsxs)("div",{className:"flex gap-2 mb-4",children:[(0,s.jsx)("input",{type:"url",value:f,onChange:e=>h(e.target.value),onKeyDown:e=>{"Enter"===e.key&&v(),"Escape"===e.key&&t()},placeholder:p.a2aDiscoverPlaceholder,disabled:u,className:"flex-1 px-3 py-2 text-xs rounded-lg border border-border bg-background text-foreground placeholder:text-muted-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50",autoFocus:!0}),(0,s.jsxs)("button",{type:"button",onClick:v,disabled:u||!f.trim(),className:"px-3 py-2 text-xs font-medium rounded-lg bg-foreground text-background hover:bg-foreground/90 disabled:opacity-50 transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-ring flex items-center gap-1.5 shrink-0",children:[u&&(0,s.jsx)(o.A,{size:12,className:"animate-spin"}),u?p.a2aDiscovering:p.a2aDiscover]})]}),m&&!g&&(0,s.jsx)("div",{className:"rounded-lg border border-error/30 bg-error/5 px-3 py-2.5 mb-3",children:(0,s.jsxs)("div",{className:"flex items-start gap-2",children:[(0,s.jsx)(l.A,{size:14,className:"text-error mt-0.5 shrink-0"}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-xs font-medium text-error",children:p.a2aDiscoverFailed}),(0,s.jsx)("p",{className:"text-2xs text-muted-foreground mt-0.5",children:p.a2aDiscoverFailedHint})]})]})}),g&&(0,s.jsx)("div",{className:"rounded-lg border border-success/30 bg-success/5 px-3 py-2.5",children:(0,s.jsxs)("div",{className:"flex items-start gap-2",children:[(0,s.jsx)(d.A,{size:14,className:"text-success mt-0.5 shrink-0"}),(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:"text-xs font-medium text-success mb-1.5",children:p.a2aDiscoverSuccess}),(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsxs)("p",{className:"text-xs font-medium text-foreground truncate",title:g.card.name,children:[g.card.name,(0,s.jsxs)("span",{className:"text-2xs text-muted-foreground ml-1.5",children:["v",g.card.version]})]}),(0,s.jsx)("p",{className:"text-2xs text-muted-foreground truncate",title:g.card.description,children:g.card.description}),g.card.skills.length>0&&(0,s.jsxs)("div",{className:"mt-1.5",children:[(0,s.jsxs)("p",{className:"text-2xs text-muted-foreground mb-1",children:[p.a2aSkills,":"]}),(0,s.jsx)("div",{className:"flex flex-wrap gap-1",children:g.card.skills.map(e=>(0,s.jsx)("span",{className:"text-2xs px-1.5 py-0.5 rounded bg-muted/80 text-muted-foreground border border-border/50",title:e.description,children:e.name},e.id))})]}),(0,s.jsxs)("p",{className:"text-2xs text-muted-foreground mt-1 truncate",title:g.endpoint,children:[p.a2aEndpoint,": ",g.endpoint]})]})]})]})})]})})}},66872:()=>{},77148:(e,t,r)=>{"use strict";r.d(t,{Un:()=>a});var s=r(12115);let n="mindos-renderer-state-change";function a(e,t,r){let a=`mindos-renderer:${e}:${t}`,i=(0,s.useRef)({key:a,raw:null,parsed:r});return i.current.key!==a&&(i.current={key:a,raw:null,parsed:r}),[(0,s.useSyncExternalStore)(e=>{let t=()=>e();return window.addEventListener("storage",t),window.addEventListener(n,t),()=>{window.removeEventListener("storage",t),window.removeEventListener(n,t)}},()=>{try{let e=localStorage.getItem(a);if(e===i.current.raw)return i.current.parsed;if(null===e)return i.current={key:a,raw:null,parsed:r},r;let t=JSON.parse(e);return i.current={key:a,raw:e,parsed:t},t}catch{return r}},()=>r),(0,s.useCallback)(e=>{try{let t=(()=>{try{let e=localStorage.getItem(a);return null!==e?JSON.parse(e):r}catch{return r}})(),s="function"==typeof e?e(t):e,n=JSON.stringify(s);localStorage.setItem(a,n),i.current={key:a,raw:n,parsed:s}}catch{}window.dispatchEvent(new Event(n))},[a,r])]}},78520:(e,t,r)=>{"use strict";r.d(t,{D4:()=>i,FB:()=>n,W8:()=>o,g4:()=>l,jQ:()=>c});let s="mindos:organize-history";function n(){try{let e=localStorage.getItem(s);if(!e)return[];return JSON.parse(e)}catch{return[]}}function a(e){try{localStorage.setItem(s,JSON.stringify(e.slice(0,50)))}catch{}}function i(e){let t=n();t.unshift(e);let r=t.slice(0,50);return a(r),r}function o(e,t){let r=n(),s=r.findIndex(t=>t.id===e);return s>=0&&(r[s]={...r[s],...t},a(r)),r}function l(){try{localStorage.removeItem(s)}catch{}}let d=0;function c(){return`org-${Date.now()}-${++d}`}},78660:(e,t,r)=>{"use strict";r.r(t),r.d(t,{TodoRenderer:()=>W});var s=r(95155),n=r(12115),a=r(16950);let i=/^##\s+(.+)/,o=/^#\s+/,l=/^#{3,6}\s+(.+)/,d=/^(\s*)- \[([ xX~])\]\s+(.*)$/,c=/`(P[012])`/,u=/`(\d{4}-\d{2}-\d{2}|\d{2}-\d{2})`/,m=/#([a-zA-Z\u4e00-\u9fff][\w\u4e00-\u9fff-]*)/g;function x(e,t){let r=[...e];return t(r),r.join("\n")}function p(e){let t=function(e){if(!e)return null;let t=new Date;return new Date(/^\d{2}-\d{2}$/.test(e)?`${t.getFullYear()}-${e}`:e)}(e);if(!t||isNaN(t.getTime()))return null;let r=new Date,s=new Date(r.getFullYear(),r.getMonth(),r.getDate()),n=(new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime()-s.getTime())/864e5;return n<0?"overdue":0===n?"today":n<=3?"soon":"future"}function f(e,t){return e.reduce((e,r)=>e+ +(r.status===t)+f(r.children,t),0)}function h(e){return e.reduce((e,t)=>e+1+h(t.children),0)}function g(e,t){return("all"===t.status||e.status===t.status)&&("all"===t.priority||e.meta.priority===t.priority)&&("all"===t.tag||!!e.meta.tags.includes(t.tag))}let b={P0:{bg:"bg-red-500/10",text:"text-red-500",border:"border-red-500/20"},P1:{bg:"bg-amber-500/10",text:"text-amber-500",border:"border-amber-500/20"},P2:{bg:"bg-blue-500/10",text:"text-blue-500",border:"border-blue-500/20"}},v={overdue:{text:"text-red-500",bg:"bg-red-500/10"},today:{text:"text-amber-500",bg:"bg-amber-500/10"},soon:{text:"text-amber-400",bg:"bg-amber-400/5"},future:{text:"text-muted-foreground",bg:""}},y={TODAY:{dot:"bg-red-400",label:"text-red-400"},"This Week":{dot:"bg-orange-400",label:"text-orange-400"},Workflows:{dot:"bg-amber-400",label:"text-amber-400"},Backlog:{dot:"bg-blue-400",label:"text-blue-400"},Done:{dot:"bg-emerald-400",label:"text-emerald-400"},Maintenance:{dot:"bg-zinc-400",label:"text-zinc-400"}};var j=r(92622),w=r(33210);function N({filters:e,onFilterChange:t,allTags:r,allPriorities:n,counts:a}){let i="all"!==e.priority||"all"!==e.tag||"all"!==e.status;return 0===r.length&&0===n.length?null:(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2 mb-4",children:[(0,s.jsx)(j.A,{size:12,className:"text-muted-foreground shrink-0"}),(0,s.jsxs)("div",{className:"flex items-center rounded-lg border border-border overflow-hidden text-xs",children:[(0,s.jsxs)("button",{onClick:()=>t({...e,status:"all"}),className:`px-2.5 py-1 transition-colors ${"all"===e.status?"bg-muted text-foreground font-medium":"text-muted-foreground hover:bg-muted/50"}`,children:["All ",a.total]}),(0,s.jsxs)("button",{onClick:()=>t({...e,status:"todo"}),className:`px-2.5 py-1 transition-colors border-l border-border ${"todo"===e.status?"bg-muted text-foreground font-medium":"text-muted-foreground hover:bg-muted/50"}`,children:["Todo ",a.todo]}),(0,s.jsxs)("button",{onClick:()=>t({...e,status:"in-progress"}),className:`px-2.5 py-1 transition-colors border-l border-border ${"in-progress"===e.status?"bg-[var(--amber)]/10 text-[var(--amber)] font-medium":"text-muted-foreground hover:bg-muted/50"}`,children:["In Progress ",a.inProgress]}),(0,s.jsxs)("button",{onClick:()=>t({...e,status:"done"}),className:`px-2.5 py-1 transition-colors border-l border-border ${"done"===e.status?"bg-emerald-500/10 text-emerald-500 font-medium":"text-muted-foreground hover:bg-muted/50"}`,children:["Done ",a.done]})]}),n.length>0&&(0,s.jsx)("div",{className:"flex items-center gap-1",children:n.map(r=>{if(!r)return null;let n=b[r],a=e.priority===r;return(0,s.jsx)("button",{onClick:()=>t({...e,priority:a?"all":r}),className:`px-2 py-0.5 rounded text-xs font-mono font-medium border transition-colors ${a?`${n.bg} ${n.text} ${n.border}`:"border-transparent text-muted-foreground hover:bg-muted"}`,children:r},r)})}),r.length>0&&(0,s.jsx)("div",{className:"flex items-center gap-1",children:r.map(r=>{let n=e.tag===r;return(0,s.jsxs)("button",{onClick:()=>t({...e,tag:n?"all":r}),className:`px-2 py-0.5 rounded-full text-xs transition-colors ${n?"bg-[var(--amber)]/15 text-[var(--amber)]":"text-muted-foreground hover:bg-muted"}`,children:["#",r]},r)})}),i&&(0,s.jsxs)("button",{onClick:()=>t({priority:"all",tag:"all",status:"all"}),className:"flex items-center gap-1 px-2 py-0.5 rounded text-xs text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:[(0,s.jsx)(w.A,{size:10})," Clear"]})]})}var k=r(57420),S=r(58515),C=r(36201),A=r(51914),z=r(66088),E=r(21362),$=r(68459),T=r(84980);function D({priority:e}){if(!e)return null;let t=b[e];return(0,s.jsx)("span",{className:`inline-flex items-center px-1.5 py-0 rounded text-[10px] font-mono font-semibold leading-4 border shrink-0 ${t.bg} ${t.text} ${t.border}`,children:e})}function R({dateStr:e,status:t}){if(!e||"done"===t)return null;let r=p(e);if(!r)return null;let n=v[r];return(0,s.jsxs)("span",{className:`inline-flex items-center gap-0.5 px-1.5 py-0 rounded text-[10px] leading-4 shrink-0 ${n.text} ${n.bg}`,children:[(0,s.jsx)(k.A,{size:9}),e]})}function P({tag:e}){return(0,s.jsxs)("span",{className:"inline-flex items-center px-1.5 py-0 rounded-full text-[10px] leading-4 text-muted-foreground bg-muted/60 shrink-0",children:["#",e]})}function M({status:e,onClick:t}){return(0,s.jsxs)("button",{onClick:t,className:"shrink-0 transition-colors",title:"Click to cycle status",children:["done"===e&&(0,s.jsx)(S.A,{size:15,style:{color:"var(--amber)"}}),"in-progress"===e&&(0,s.jsx)(a.A,{size:15,className:"text-[var(--amber)] fill-[var(--amber)]/20"}),"todo"===e&&(0,s.jsx)(C.A,{size:15,style:{color:"var(--muted-foreground)"}})]})}function F({text:e,status:t,onRename:r}){let[a,i]=(0,n.useState)(!1),[o,l]=(0,n.useState)(e),d=(0,n.useRef)(null);function c(){let t=o.trim();t&&t!==e?r(t):l(e),i(!1)}return((0,n.useEffect)(()=>{l(e)},[e]),(0,n.useEffect)(()=>{a&&d.current?.select()},[a]),a)?(0,s.jsx)("input",{ref:d,value:o,onChange:e=>l(e.target.value),onBlur:c,onKeyDown:t=>{"Enter"===t.key&&c(),"Escape"===t.key&&(l(e),i(!1))},className:"flex-1 bg-transparent border-b text-sm leading-relaxed outline-none min-w-0",style:{borderColor:"var(--amber)",color:"var(--foreground)"},onClick:e=>e.stopPropagation()}):(0,s.jsx)("span",{className:`flex-1 text-sm leading-relaxed cursor-text min-w-0 ${"done"===t?"line-through text-muted-foreground":"text-foreground"}`,onDoubleClick:()=>i(!0),title:"Double-click to edit",children:e})}function I({onAdd:e}){let[t,r]=(0,n.useState)(!1),[a,i]=(0,n.useState)(""),o=(0,n.useRef)(null);function l(){let t=a.trim();t&&e(t),i(""),r(!1)}return((0,n.useEffect)(()=>{t&&o.current?.focus()},[t]),t)?(0,s.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 mt-1",children:[(0,s.jsx)("span",{className:"w-[13px] shrink-0"}),(0,s.jsx)("span",{className:"shrink-0",style:{color:"var(--muted-foreground)"},children:(0,s.jsx)(C.A,{size:15})}),(0,s.jsx)("input",{ref:o,value:a,onChange:e=>i(e.target.value),onBlur:l,onKeyDown:e=>{"Enter"===e.key&&l(),"Escape"===e.key&&(i(""),r(!1))},placeholder:"New item… (supports `P0` `03-28` #tag)",className:"flex-1 bg-transparent border-b text-sm outline-none",style:{borderColor:"var(--amber)",color:"var(--foreground)"}})]}):(0,s.jsxs)("button",{onClick:()=>r(!0),className:"flex items-center gap-1.5 w-full px-3 py-1.5 rounded-lg text-xs transition-colors hover:bg-muted/60 mt-1",style:{color:"var(--muted-foreground)"},children:[(0,s.jsx)(A.A,{size:12}),(0,s.jsx)("span",{children:"Add item"})]})}function L({item:e,depth:t,filters:r,onCycleStatus:a,onRename:i,onDelete:o}){let[l,d]=(0,n.useState)(!0),c=e.children.length>0,u=g(e,r),m=e.children.some(e=>(function e(t,r){return!!g(t,r)||t.children.some(t=>e(t,r))})(e,r));if(("all"!==r.status||"all"!==r.priority||"all"!==r.tag)&&!u&&!m)return null;let x=p(e.meta.dueDate);return(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:`group flex items-center gap-2 py-1.5 px-2 rounded-lg transition-colors hover:bg-muted/60 ${"done"===e.status?"opacity-45":""} ${"overdue"===x&&"done"!==e.status?"bg-error/[0.03]":""}`,style:{paddingLeft:`${8+20*t}px`},children:[c?(0,s.jsx)("button",{onClick:()=>d(e=>!e),className:"shrink-0 text-muted-foreground hover:text-foreground transition-colors",children:l?(0,s.jsx)(z.A,{size:13}):(0,s.jsx)(E.A,{size:13})}):(0,s.jsx)("span",{className:"w-[13px] shrink-0"}),(0,s.jsx)(M,{status:e.status,onClick:()=>{var t;return a(e.lineIndex,"todo"===(t=e.status)?"in-progress":"in-progress"===t?"done":"todo")}}),(0,s.jsx)(F,{text:e.text,status:e.status,onRename:t=>i(e.lineIndex,t)}),(0,s.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,s.jsx)(D,{priority:e.meta.priority}),(0,s.jsx)(R,{dateStr:e.meta.dueDate,status:e.status}),e.meta.tags.map(e=>(0,s.jsx)(P,{tag:e},e))]}),(0,s.jsx)("button",{onClick:()=>o(e.lineIndex),className:"shrink-0 opacity-0 group-hover:opacity-100 transition-opacity p-0.5 rounded hover:bg-destructive/10",style:{color:"var(--muted-foreground)"},title:"Delete item",children:(0,s.jsx)($.A,{size:12})})]}),c&&l&&(0,s.jsx)("div",{children:e.children.map(e=>(0,s.jsx)(L,{item:e,depth:t+1,filters:r,onCycleStatus:a,onRename:i,onDelete:o},e.id))})]})}function O({name:e,meta:t,filters:r,defaultCollapsed:a,onCycleStatus:i,onRename:o,onDelete:l,onAdd:d}){let c,[u,m]=(0,n.useState)(a??!1),x=(c=Object.keys(y).find(t=>e.includes(t)))?y[c]:{dot:"bg-zinc-500",label:"text-zinc-400"},{items:p,lastLineIndex:g}=t,b=f(p,"done"),v=f(p,"in-progress"),j=h(p),w=e.includes("Done");return(0,s.jsxs)("div",{className:"border border-border rounded-xl overflow-hidden bg-card",children:[(0,s.jsxs)("button",{onClick:()=>m(e=>!e),className:"w-full flex items-center justify-between px-4 py-3 hover:bg-muted/40 transition-colors",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{className:`w-2 h-2 rounded-full shrink-0 ${x.dot}`}),(0,s.jsx)("span",{className:`text-xs font-semibold uppercase tracking-wider ${x.label} font-display`,children:e}),(0,s.jsxs)("span",{className:"text-xs text-muted-foreground tabular-nums",children:[b,"/",j]}),v>0&&(0,s.jsxs)("span",{className:"flex items-center gap-0.5 text-[10px] text-[var(--amber)]",children:[(0,s.jsx)(T.A,{size:9})," ",v]})]}),u?(0,s.jsx)(E.A,{size:14,className:"text-muted-foreground"}):(0,s.jsx)(z.A,{size:14,className:"text-muted-foreground"})]}),(0,s.jsx)("div",{className:"h-0.5 bg-muted mx-4",children:(0,s.jsx)("div",{className:"h-full rounded-full transition-all duration-500",style:{width:j?`${b/j*100}%`:"0%",background:w?"var(--success, #22c55e)":"var(--amber)"}})}),!u&&(0,s.jsxs)("div",{className:"px-2 py-2",children:[p.map(e=>(0,s.jsx)(L,{item:e,depth:0,filters:r,onCycleStatus:i,onRename:o,onDelete:l},e.id)),0===p.length&&(0,s.jsx)("p",{className:"text-xs text-muted-foreground px-4 py-2",children:"No items"}),!w&&(0,s.jsx)(I,{onAdd:e=>d(g,e)})]})]})}function W({content:e,saveAction:t}){let[r,p]=(0,n.useState)(e),[g,b]=(0,n.useState)({priority:"all",tag:"all",status:"all"}),{sections:v,lines:y,sectionOrder:j}=(0,n.useMemo)(()=>{let e,t,s,n,a,x,p;return e=r.split("\n"),t="General",s={},n=[],a=[],x=!1,p=!1,e.forEach((e,r)=>{if(!p){if(0===r&&"---"===e.trim()){x=!0;return}if(x){"---"===e.trim()&&(x=!1,p=!0);return}p=!0}if(o.test(e))return;let f=e.match(i);if(f){s[t=f[1].replace(/^[^\w\s\u4e00-\u9fff]+\s*/,"").trim()]||(s[t]={items:[],lastLineIndex:-1,headingLineIndex:r},n.push(t));return}if(l.test(e))return;let h=e.match(d);if(!h)return;let[,g,b,v]=h,y=Math.floor(g.length/2),j="~"===b?"in-progress":"x"===b.toLowerCase()?"done":"todo",{cleanText:w,meta:N}=function(e){let t,r=e,s=null,n=null,a=[],i=r.match(c);i&&(s=i[1],r=r.replace(c,"").trim());let o=r.match(u);o&&(n=o[1],r=r.replace(u,"").trim());let l=RegExp(m.source,"g");for(;null!==(t=l.exec(r));)a.push(t[1]);return a.length>0&&(r=r.replace(/#[a-zA-Z\u4e00-\u9fff][\w\u4e00-\u9fff-]*/g,"").trim()),{cleanText:r=r.replace(/\*\*(.*?)\*\*/g,"$1").trim(),meta:{priority:s,dueDate:n,tags:a}}}(v),k={id:`${r}`,text:w,rawText:v,status:j,indent:y,lineIndex:r,section:t,children:[],meta:N};for(;a.length>0&&a[a.length-1].indent>=y;)a.pop();s[t]||(s[t]={items:[],lastLineIndex:-1,headingLineIndex:-1},n.push(t)),a.length>0?a[a.length-1].children.push(k):s[t].items.push(k),s[t].lastLineIndex=Math.max(s[t].lastLineIndex,r),a.push(k)}),{sections:s,lines:e,sectionOrder:n}},[r]),w=(0,n.useMemo)(()=>Object.values(v).reduce((e,t)=>e+f(t.items,"done"),0),[v]),k=(0,n.useMemo)(()=>Object.values(v).reduce((e,t)=>e+f(t.items,"in-progress"),0),[v]),S=(0,n.useMemo)(()=>Object.values(v).reduce((e,t)=>e+h(t.items),0),[v]),C=S-w-k,A=(0,n.useMemo)(()=>(function(e){let t=new Set;for(let r of Object.values(e))!function e(r){for(let s of r){for(let e of s.meta.tags)t.add(e);e(s.children)}}(r.items);return[...t].sort()})(v),[v]),z=(0,n.useMemo)(()=>(function(e){let t=new Set;for(let r of Object.values(e))!function e(r){for(let s of r)s.meta.priority&&t.add(s.meta.priority),e(s.children)}(r.items);return["P0","P1","P2"].filter(e=>t.has(e))})(v),[v]),E=(0,n.useCallback)(async e=>{p(e),await t(e)},[t]),$=(0,n.useCallback)(async(e,t)=>{await E(x(y,r=>{r[e]=r[e].replace(/- \[[ xX~]\]/,`- [${"done"===t?"x":"in-progress"===t?"~":" "}]`)}))},[y,E]),T=(0,n.useCallback)(async(e,t)=>{await E(x(y,r=>{r[e]=r[e].replace(/(- \[[ xX~]\]\s*)(.*)$/,`$1${t}`)}))},[y,E]),D=(0,n.useCallback)(async e=>{await E(x(y,t=>{t.splice(e,1)}))},[y,E]),R=(0,n.useCallback)(async(e,t)=>{await E(x(y,r=>{let s=e<0?r.length:e+1;r.splice(s,0,`- [ ] ${t}`)}))},[y,E]),P=j.filter(e=>v[e]).map(e=>[e,v[e]]),M=S?Math.round(w/S*100):0;return(0,s.jsxs)("div",{className:"max-w-[900px] mx-auto xl:mr-[220px] px-0 py-2",children:[(0,s.jsx)("div",{className:"mb-5 flex items-center gap-4",children:(0,s.jsxs)("div",{className:"flex-1",children:[(0,s.jsxs)("div",{className:"flex items-baseline gap-2",children:[(0,s.jsxs)("span",{className:"text-lg font-semibold font-display text-foreground tabular-nums",children:[M,"%"]}),(0,s.jsxs)("span",{className:"text-xs text-muted-foreground font-display",children:[w,"/",S," completed"]}),k>0&&(0,s.jsxs)("span",{className:"flex items-center gap-1 text-xs text-[var(--amber)]",children:[(0,s.jsx)(a.A,{size:8,className:"fill-[var(--amber)]/30"}),k," in progress"]})]}),(0,s.jsx)("div",{className:"mt-2 w-full max-w-xs h-1.5 bg-muted rounded-full overflow-hidden",children:(0,s.jsx)("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${M}%`,background:"var(--amber)"}})})]})}),(0,s.jsx)(N,{filters:g,onFilterChange:b,allTags:A,allPriorities:z,counts:{todo:C,inProgress:k,done:w,total:S}}),(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[P.map(([e,t])=>(0,s.jsx)(O,{name:e,meta:t,filters:g,defaultCollapsed:e.includes("Done"),onCycleStatus:$,onRename:T,onDelete:D,onAdd:R},e)),0===P.length&&(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:"No TODO items found in this file."})]})]})}},82125:(e,t,r)=>{"use strict";r.d(t,{A:()=>n,C:()=>s});let s=new Set(["INSTRUCTION.md","README.md","CONFIG.json","CHANGELOG.md"]),n=new Set(["TODO.md"])},86343:(e,t,r)=>{"use strict";r.d(t,{default:()=>a});var s=r(95155),n=r(12115);class a extends n.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){console.error("[ErrorBoundary]",e,t.componentStack)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:(0,s.jsx)("div",{className:"flex items-center justify-center min-h-[50vh] px-4",children:(0,s.jsxs)("div",{className:"text-center max-w-md",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold text-foreground mb-2",children:"Something went wrong"}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:this.state.error?.message||"An unexpected error occurred."}),(0,s.jsx)("button",{onClick:()=>this.setState({hasError:!1,error:void 0}),className:"px-4 py-2 text-sm rounded-lg border border-border hover:bg-muted transition-colors",children:"Try again"})]})}):this.props.children}}},87986:(e,t,r)=>{"use strict";r.r(t),r.d(t,{VideoRenderer:()=>a});var s=r(95155),n=r(12115);function a({filePath:e}){let t=`/api/file/raw?path=${encodeURIComponent(e)}`,r=e.split("/").pop()??"video",a=r.split(".").pop()?.toLowerCase()??"",[i,o]=(0,n.useState)(!1),[l,d]=(0,n.useState)(0),[c,u]=(0,n.useState)(null),[m,x]=(0,n.useState)(null),p=(0,n.useRef)(null);(0,n.useEffect)(()=>{fetch(t,{method:"HEAD"}).then(e=>{let t=e.headers.get("Content-Length");t&&u(parseInt(t,10))}).catch(()=>{})},[t]);let f=(0,n.useCallback)(()=>{let e=p.current;e&&x({w:e.videoWidth,h:e.videoHeight})},[]),h=(0,n.useCallback)(()=>{o(!1),d(e=>e+1)},[]);return(0,s.jsxs)("div",{className:"w-full flex flex-col gap-0",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3 px-3 py-2 border-b border-border text-xs text-[var(--text-secondary)]",children:[m&&(0,s.jsxs)("span",{children:[m.w," x ",m.h]}),null!==c&&(0,s.jsx)("span",{children:c<1024?`${c} B`:c<1048576?`${(c/1024).toFixed(1)} KB`:`${(c/1048576).toFixed(1)} MB`}),(0,s.jsx)("span",{className:"uppercase opacity-60",children:a})]}),(0,s.jsx)("div",{className:"flex-1 min-h-[50vh] flex items-center justify-center bg-black rounded-b-lg overflow-hidden",children:i?(0,s.jsxs)("div",{className:"flex flex-col items-center gap-2",children:[(0,s.jsx)("span",{className:"text-sm text-neutral-400",children:"Failed to load video"}),(0,s.jsx)("button",{onClick:h,className:"text-xs px-3 py-1.5 rounded-md bg-neutral-800 hover:bg-neutral-700 text-neutral-200 transition-colors",children:"Retry"})]}):(0,s.jsx)("video",{ref:p,controls:!0,preload:"metadata",className:"max-w-full max-h-[70vh]",onLoadedMetadata:f,onError:()=>o(!0),children:(0,s.jsx)("source",{src:t})},l)})]})}},88946:(e,t,r)=>{"use strict";r.r(t),r.d(t,{BacklinksRenderer:()=>m});var s=r(95155),n=r(12115),a=r(73321),i=r(48368),o=r(22164),l=r(91337),d=r(22356);function c(e){return e.split("/").pop()?.replace(/\.md$/,"")??e}function u({text:e}){let t=e.split(/(\[\[[^\]]+\]\]|\[[^\]]+\]\([^)]+\))/g);return(0,s.jsx)("span",{children:t.map((e,t)=>/^\[\[/.test(e)||/^\[/.test(e)?(0,s.jsx)("span",{style:{color:"var(--amber)",fontWeight:500},children:e},t):(0,s.jsx)("span",{children:e},t))})}function m({filePath:e}){let t=(0,a.useRouter)(),[r,m]=(0,n.useState)(null),[x,p]=(0,n.useState)(!0);if((0,n.useEffect)(()=>{p(!0),(0,d.n)(`/api/backlinks?path=${encodeURIComponent(e)}`).then(e=>{m(e),p(!1)}).catch(()=>p(!1))},[e]),x)return(0,s.jsx)("div",{className:"font-display",style:{padding:"3rem 1rem",textAlign:"center",fontSize:12,color:"var(--muted-foreground)"},children:"Scanning backlinks…"});let f=r??[];return(0,s.jsxs)("div",{style:{maxWidth:720,margin:"0 auto",padding:"1.5rem 0"},children:[(0,s.jsx)("div",{style:{marginBottom:"1.5rem",display:"flex",alignItems:"center",gap:8},children:(0,s.jsx)("span",{className:"font-display",style:{fontSize:11,color:"var(--muted-foreground)"},children:0===f.length?"No backlinks found":`${f.length} file${1===f.length?"":"s"} link here`})}),0===f.length?(0,s.jsxs)("div",{style:{border:"1px dashed var(--border)",borderRadius:10,padding:"2.5rem 1.5rem",textAlign:"center",color:"var(--muted-foreground)",fontSize:13},children:[(0,s.jsx)(i.A,{size:28,style:{margin:"0 auto 10px",opacity:.3}}),(0,s.jsxs)("p",{className:"font-display",style:{fontSize:12},children:["No other files link to ",(0,s.jsx)("strong",{style:{color:"var(--foreground)"},children:c(e)})," yet."]})]}):(0,s.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:10},children:f.map(({filePath:e,snippets:r})=>{let n,a=c(e),d=(n=e.split("/")).length>1?n.slice(0,-1).join("/"):"";return(0,s.jsxs)("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:10,overflow:"hidden",cursor:"pointer",transition:"border-color .15s"},onClick:()=>t.push("/view/"+(0,l.O0)(e)),onMouseEnter:e=>e.currentTarget.style.borderColor="rgba(200,135,58,0.4)",onMouseLeave:e=>e.currentTarget.style.borderColor="var(--border)",children:[(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"10px 14px",borderBottom:r.length>0?"1px solid var(--border)":"none",background:"var(--muted)"},children:[(0,s.jsx)(i.A,{size:13,style:{color:"var(--muted-foreground)",flexShrink:0}}),(0,s.jsx)("span",{style:{fontWeight:600,fontSize:"0.85rem",color:"var(--foreground)",flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a}),d&&(0,s.jsx)("span",{className:"font-display",style:{fontSize:"0.68rem",color:"var(--muted-foreground)",opacity:.6,flexShrink:0},children:d}),(0,s.jsx)(o.A,{size:11,style:{color:"var(--muted-foreground)",opacity:.5,flexShrink:0}})]}),r.map((e,t)=>(0,s.jsx)("div",{style:{padding:"8px 14px",borderBottom:t<r.length-1?"1px solid var(--border)":"none",background:"var(--background)"},children:e.split("\n").map((e,t)=>(0,s.jsx)("div",{className:"font-display",style:{fontSize:"0.72rem",color:"var(--muted-foreground)",lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:(0,s.jsx)(u,{text:e})},t))},t))]},e)})})]})}},91459:(e,t,r)=>{"use strict";r.d(t,{TooltipProvider:()=>a});var s=r(95155),n=r(32727);function a({delay:e=0,...t}){return(0,s.jsx)(n.B,{"data-slot":"tooltip-provider",delay:e,...t})}},92306:(e,t,r)=>{"use strict";r.r(t),r.d(t,{CsvRenderer:()=>z});var s=r(95155),n=r(12115),a=r(18837),i=r(37595),o=r(8434),l=r(1164),d=r(59386),c=r.n(d);function u(e,t){return c().unparse([e,...t])}let m=[{bg:"rgba(200,135,58,0.12)",text:"var(--amber)"},{bg:"rgba(122,173,128,0.12)",text:"var(--success)"},{bg:"rgba(138,180,216,0.12)",text:"#8ab4d8"},{bg:"rgba(200,160,216,0.12)",text:"#c8a0d8"},{bg:"rgba(200,96,96,0.12)",text:"#c86060"},{bg:"rgba(150,150,150,0.12)",text:"var(--muted-foreground)"}];function x(e){let t=0;for(let r=0;r<e.length;r++)t=31*t+e.charCodeAt(r)&65535;return m[t%m.length]}var p=r(77148),f=r(9921),h=r(66088),g=r(68459),b=r(51914);function v({value:e,onCommit:t}){let[r,a]=(0,n.useState)(!1),[i,o]=(0,n.useState)(e),l=(0,n.useRef)(null);function d(){a(!1),i!==e?t(i):o(e)}return((0,n.useEffect)(()=>{o(e)},[e]),(0,n.useEffect)(()=>{r&&l.current?.select()},[r]),r)?(0,s.jsx)("input",{ref:l,value:i,onChange:e=>o(e.target.value),onBlur:d,onKeyDown:t=>{"Enter"===t.key&&d(),"Escape"===t.key&&(o(e),a(!1))},className:"w-full bg-transparent outline-none text-sm",onClick:e=>e.stopPropagation(),style:{color:"var(--foreground)",borderBottom:"1px solid var(--amber)",minWidth:60}}):(0,s.jsx)("div",{className:"truncate text-sm cursor-text",style:{color:"var(--foreground)",minWidth:60},onClick:()=>a(!0),title:e,children:e||(0,s.jsx)("span",{style:{color:"var(--muted-foreground)",opacity:.3},children:"—"})})}function y({headers:e,visibleIndices:t,onAdd:r,onCancel:a}){let[i,o]=(0,n.useState)(()=>Array(e.length).fill(""));return(0,s.jsxs)("tr",{style:{background:"color-mix(in srgb, var(--amber) 6%, transparent)",borderTop:"1px solid var(--amber)"},children:[t.map((t,n)=>(0,s.jsx)("td",{className:"px-3 py-2",style:{borderBottom:"1px solid var(--border)"},children:(0,s.jsx)("input",{autoFocus:0===n,value:i[t],onChange:e=>{var r;return r=e.target.value,void o(e=>{let s=[...e];return s[t]=r,s})},onKeyDown:e=>{"Enter"===e.key&&r(i),"Escape"===e.key&&a()},placeholder:e[t],className:"w-full bg-transparent outline-none text-sm placeholder:opacity-30",style:{color:"var(--foreground)",borderBottom:"1px solid var(--border)"}})},t)),(0,s.jsx)("td",{className:"px-2 py-2",style:{borderBottom:"1px solid var(--border)"}})]})}function j({headers:e,rows:t,cfg:r,saveAction:a}){let[i,o]=(0,n.useState)(t),[l,d]=(0,n.useState)(!1);(0,n.useEffect)(()=>{o(t)},[t]);let c=(0,n.useMemo)(()=>e.map((e,t)=>t).filter(t=>!r.hiddenFields.includes(e[t])),[e,r.hiddenFields]),m=e.indexOf(r.sortField),x=(0,n.useMemo)(()=>{let e=[...i];return m>=0&&e.sort((e,t)=>{let s=e[m]??"",n=t[m]??"",a=parseFloat(s),i=parseFloat(n),o=isNaN(a)||isNaN(i)?s.localeCompare(n):a-i;return"asc"===r.sortDir?o:-o}),e},[i,m,r.sortDir]),p=e.indexOf(r.groupField),j=(0,n.useMemo)(()=>{if(p<0)return[{key:null,rows:x.map(e=>({row:e,orig:e}))}];let e=new Map;for(let t of x){let r=t[p]||"(empty)";e.has(r)||e.set(r,[]),e.get(r).push(t)}return[...e.entries()].map(([e,t])=>({key:e,rows:t.map(e=>({row:e,orig:e}))}))},[x,p]);async function w(t,r,s){let n=i.map(e=>e===t?e.map((e,t)=>t===r?s:e):e);o(n),await a(u(e,n))}async function N(t){let r=i.filter(e=>e!==t);o(r),await a(u(e,r))}async function k(t){let r=[...i,t];o(r),d(!1),await a(u(e,r))}let S={borderBottom:"1px solid var(--border)",fontSize:"0.72rem",letterSpacing:"0.05em",textTransform:"uppercase",color:"var(--muted-foreground)",fontWeight:600},C=0;return(0,s.jsxs)("div",{className:"rounded-xl overflow-hidden border",style:{borderColor:"var(--border)"},children:[(0,s.jsx)("div",{className:"overflow-x-auto",children:(0,s.jsxs)("table",{className:"min-w-full text-sm border-collapse",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{style:{background:"var(--muted)"},children:[c.map(t=>(0,s.jsx)("th",{className:"px-4 py-2.5 text-left whitespace-nowrap",style:S,children:(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[e[t],r.sortField===e[t]&&("asc"===r.sortDir?(0,s.jsx)(f.A,{size:10,style:{color:"var(--amber)"}}):(0,s.jsx)(h.A,{size:10,style:{color:"var(--amber)"}}))]})},t)),(0,s.jsx)("th",{className:"w-8",style:{...S,background:"var(--muted)"}})]})}),(0,s.jsxs)("tbody",{children:[j.map((e,t)=>(0,s.jsxs)(n.Fragment,{children:[null!==e.key&&(0,s.jsx)("tr",{children:(0,s.jsx)("td",{colSpan:c.length+1,className:"px-4 py-1.5",style:{background:"var(--accent)",borderBottom:"1px solid var(--border)",borderTop:"1px solid var(--border)"},children:(0,s.jsxs)("span",{className:"text-xs font-semibold font-display",style:{color:"var(--muted-foreground)"},children:[e.key," \xb7 ",e.rows.length]})})},`grp-${e.key}`),e.rows.map(({row:e,orig:t})=>{let r=C++;return(0,s.jsxs)("tr",{className:"group transition-colors",style:{background:r%2==0?"var(--background)":"var(--card)"},onMouseEnter:e=>e.currentTarget.style.background="var(--muted)",onMouseLeave:e=>e.currentTarget.style.background=r%2==0?"var(--background)":"var(--card)",children:[c.map(r=>(0,s.jsx)("td",{className:"px-4 py-2 max-w-xs",style:{borderBottom:"1px solid var(--border)"},children:(0,s.jsx)(v,{value:e[r]??"",onCommit:e=>w(t,r,e)})},r)),(0,s.jsx)("td",{className:"px-2 py-2",style:{borderBottom:"1px solid var(--border)"},children:(0,s.jsx)("button",{onClick:()=>N(t),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-destructive/10",style:{color:"var(--muted-foreground)"},children:(0,s.jsx)(g.A,{size:12})})})]},r)})]},e.key??`section-${t}`)),l&&(0,s.jsx)(y,{headers:e,visibleIndices:c,onAdd:k,onCancel:()=>d(!1)})]})]})}),(0,s.jsxs)("div",{className:"px-4 py-2 flex items-center justify-between",style:{background:"var(--muted)",borderTop:"1px solid var(--border)"},children:[(0,s.jsxs)("span",{className:"text-xs font-display",style:{color:"var(--muted-foreground)"},children:[i.length," rows \xb7 ",e.length," cols"]}),l?(0,s.jsx)("button",{onClick:()=>d(!1),className:"text-xs px-2.5 py-1 rounded-md",style:{color:"var(--muted-foreground)"},children:"Cancel"}):(0,s.jsxs)("button",{onClick:()=>d(!0),className:"flex items-center gap-1 text-xs px-2.5 py-1 rounded-md",style:{color:"var(--amber)",background:"var(--amber-dim)"},children:[(0,s.jsx)(b.A,{size:12})," Add row"]})]})]})}function w({headers:e,rows:t,cfg:r}){let n=e.indexOf(r.titleField),a=e.indexOf(r.descField),i=e.indexOf(r.tagField);return(0,s.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:t.map((t,r)=>{let o=n>=0?t[n]:t[0]??"",l=a>=0?t[a]:"",d=i>=0?t[i]:"",c=d?x(d):null;return(0,s.jsxs)("div",{className:"rounded-xl border p-4 flex flex-col gap-2 hover:bg-muted/50 transition-colors",style:{borderColor:"var(--border)",background:"var(--card)"},children:[d&&c&&(0,s.jsx)("span",{className:"self-start text-xs px-2 py-0.5 rounded-full font-medium",style:{background:c.bg,color:c.text},children:d}),(0,s.jsx)("p",{className:"text-sm font-semibold leading-snug",style:{color:"var(--foreground)"},children:o}),l&&(0,s.jsx)("p",{className:"text-xs leading-relaxed line-clamp-3",style:{color:"var(--muted-foreground)"},children:l}),(0,s.jsx)("div",{className:"mt-1 flex flex-col gap-0.5",children:e.map((e,r)=>{if(r===n||r===a||r===i)return null;let o=t[r];return o?(0,s.jsxs)("div",{className:"flex items-baseline gap-1.5 text-xs",children:[(0,s.jsx)("span",{className:"font-display",style:{color:"var(--muted-foreground)",opacity:.6,fontSize:"0.68rem"},children:e}),(0,s.jsx)("span",{className:"truncate",style:{color:"var(--muted-foreground)"},children:o})]},r):null})})]},r)})})}function N({headers:e,rows:t,cfg:r,saveAction:a}){let[i,o]=(0,n.useState)(t),[l,d]=(0,n.useState)(null),[c,m]=(0,n.useState)(""),[p,f]=(0,n.useState)(!1);(0,n.useEffect)(()=>{o(t)},[t]);let h=e.indexOf(r.groupField),g=e.indexOf(r.titleField),v=e.indexOf(r.descField),{groups:y,groupKeys:j}=(0,n.useMemo)(()=>{let e=new Map;return i.forEach((t,r)=>{let s=(h>=0?t[h]:"")||"(empty)";e.has(s)||e.set(s,[]),e.get(s).push({row:t,origIdx:r})}),{groups:e,groupKeys:[...e.keys()]}},[i,h]);async function w(t,r){let s=i.map((e,s)=>{if(s!==t)return e;let n=[...e];return h>=0&&(n[h]=r),n});o(s),await a(u(e,s))}function N({group:t}){let r=y.get(t)??[],n=x(t),a=l===t;return(0,s.jsxs)("div",{className:"flex-shrink-0 w-64 flex flex-col gap-2",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 px-1 py-1.5",children:[(0,s.jsx)("span",{className:"w-2.5 h-2.5 rounded-full shrink-0",style:{background:n.text}}),(0,s.jsx)("span",{className:"text-xs font-semibold uppercase tracking-wider truncate font-display",style:{color:n.text},children:t}),(0,s.jsx)("span",{className:"text-xs ml-auto shrink-0",style:{color:"var(--muted-foreground)",opacity:.5},children:r.length})]}),(0,s.jsxs)("div",{className:"flex flex-col gap-2 rounded-xl p-1.5 min-h-[80px] transition-colors",style:{background:a?"var(--amber-dim)":"var(--muted)",border:`1px solid ${a?"var(--amber)":"transparent"}`},onDragOver:e=>{e.preventDefault(),d(t)},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||d(null)},onDrop:e=>{d(null);let r=parseInt(e.dataTransfer.getData("origIdx"));isNaN(r)||w(r,t)},children:[r.map(({row:t,origIdx:r})=>{let n=g>=0?t[g]:t[0]??"",a=v>=0?t[v]:"";return(0,s.jsxs)("div",{draggable:!0,onDragStart:e=>{e.dataTransfer.setData("origIdx",String(r)),d(null)},onDragEnd:()=>d(null),className:"rounded-lg border p-3 flex flex-col gap-1.5 cursor-grab active:cursor-grabbing hover:bg-muted/50 transition-colors",style:{borderColor:"var(--border)",background:"var(--card)"},children:[(0,s.jsx)("p",{className:"text-sm font-medium leading-snug",style:{color:"var(--foreground)"},children:n}),a&&(0,s.jsx)("p",{className:"text-xs leading-relaxed line-clamp-2",style:{color:"var(--muted-foreground)"},children:a}),(0,s.jsx)("div",{className:"flex flex-wrap gap-1 mt-0.5",children:e.map((e,r)=>{if(r===h||r===g||r===v)return null;let n=t[r];return n?(0,s.jsxs)("span",{className:"text-2xs px-1.5 py-0.5 rounded font-display",style:{background:"var(--muted)",color:"var(--muted-foreground)"},children:[e,": ",n]},r):null})})]},r)}),0===r.length&&(0,s.jsx)("div",{className:"flex items-center justify-center h-12",children:(0,s.jsx)("span",{className:"text-xs",style:{color:"var(--muted-foreground)",opacity:.4},children:"Drop here"})})]})]})}return(0,s.jsxs)("div",{className:"flex gap-3 overflow-x-auto pb-3 items-start",children:[j.map(e=>(0,s.jsx)(N,{group:e},e)),(0,s.jsx)("div",{className:"flex-shrink-0 w-64",children:p?(0,s.jsxs)("div",{className:"rounded-xl border p-3 flex flex-col gap-2",style:{borderColor:"var(--border)",background:"var(--card)"},children:[(0,s.jsx)("input",{autoFocus:!0,value:c,onChange:e=>m(e.target.value),onKeyDown:e=>{"Enter"===e.key&&c.trim()&&(m(""),f(!1)),"Escape"===e.key&&(m(""),f(!1))},placeholder:"Column name…",className:"text-xs bg-transparent outline-none w-full font-display",style:{color:"var(--foreground)",borderBottom:"1px solid var(--amber)"}}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)("button",{onClick:()=>{m(""),f(!1)},className:"text-xs px-2 py-1 rounded font-display",style:{background:"var(--amber)",color:"var(--amber-foreground)"},children:"Create"}),(0,s.jsx)("button",{onClick:()=>{m(""),f(!1)},className:"text-xs px-2 py-1 rounded font-display",style:{color:"var(--muted-foreground)"},children:"Cancel"})]})]}):(0,s.jsxs)("button",{onClick:()=>f(!0),className:"flex items-center gap-1.5 text-xs px-3 py-2 rounded-xl border border-dashed w-full transition-colors hover:bg-muted font-display",style:{borderColor:"var(--border)",color:"var(--muted-foreground)"},children:[(0,s.jsx)(b.A,{size:12})," Add column"]})})]})}var k=r(33210),S=r(27996);function C({headers:e,cfg:t,view:r,onClose:n,onChange:a}){let i={color:"var(--muted-foreground)",fontSize:"0.72rem"};function o({label:t,value:r,onChange:n}){return(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,s.jsx)("span",{className:"font-display",style:i,children:t}),(0,s.jsx)(S.A,{value:r,onChange:n,size:"sm",options:[{value:"",label:"— none —"},...e.map(e=>({value:e,label:e}))]})]})}return(0,s.jsxs)("div",{className:"absolute right-0 top-10 z-20 w-72 rounded-xl border shadow-xl p-4 flex flex-col gap-3",style:{background:"var(--card)",borderColor:"var(--border)"},children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("span",{className:"text-xs font-semibold uppercase tracking-wider",style:i,children:[r," settings"]}),(0,s.jsx)("button",{onClick:n,style:{color:"var(--muted-foreground)"},children:(0,s.jsx)(k.A,{size:13})})]}),"table"===r&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"h-px",style:{background:"var(--border)"}}),(0,s.jsx)("p",{className:"text-xs font-semibold uppercase tracking-wider",style:i,children:"Sort"}),(0,s.jsx)(o,{label:"Sort by",value:t.table.sortField,onChange:e=>a({...t,table:{...t.table,sortField:e}})}),(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,s.jsx)("span",{style:i,children:"Direction"}),(0,s.jsx)("div",{className:"flex rounded overflow-hidden border",style:{borderColor:"var(--border)"},children:["asc","desc"].map(e=>(0,s.jsx)("button",{onClick:()=>a({...t,table:{...t.table,sortDir:e}}),className:"px-3 py-1 text-xs transition-colors font-display",style:{fontSize:"0.72rem",background:t.table.sortDir===e?"var(--amber)":"var(--background)",color:t.table.sortDir===e?"var(--amber-foreground)":"var(--muted-foreground)"},children:e},e))})]}),(0,s.jsx)("div",{className:"h-px",style:{background:"var(--border)"}}),(0,s.jsx)("p",{className:"text-xs font-semibold uppercase tracking-wider",style:i,children:"Group"}),(0,s.jsx)(o,{label:"Group by",value:t.table.groupField,onChange:e=>a({...t,table:{...t.table,groupField:e}})}),(0,s.jsx)("div",{className:"h-px",style:{background:"var(--border)"}}),(0,s.jsx)("p",{className:"text-xs font-semibold uppercase tracking-wider",style:i,children:"Columns"}),(0,s.jsx)("div",{className:"flex flex-col gap-1.5",children:e.map(e=>{let r=t.table.hiddenFields.includes(e);return(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("span",{style:i,children:e}),(0,s.jsx)("button",{onClick:()=>{let s=r?t.table.hiddenFields.filter(t=>t!==e):[...t.table.hiddenFields,e];a({...t,table:{...t.table,hiddenFields:s}})},className:"text-xs px-2 py-0.5 rounded transition-colors font-display",style:{background:r?"var(--muted)":"var(--amber-dim)",color:r?"var(--muted-foreground)":"var(--amber)"},children:r?"Hidden":"Visible"})]},e)})})]}),"gallery"===r&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(o,{label:"Title",value:t.gallery.titleField,onChange:e=>a({...t,gallery:{...t.gallery,titleField:e}})}),(0,s.jsx)(o,{label:"Description",value:t.gallery.descField,onChange:e=>a({...t,gallery:{...t.gallery,descField:e}})}),(0,s.jsx)(o,{label:"Tag / Badge",value:t.gallery.tagField,onChange:e=>a({...t,gallery:{...t.gallery,tagField:e}})})]}),"board"===r&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(o,{label:"Group by",value:t.board.groupField,onChange:e=>a({...t,board:{...t.board,groupField:e}})}),(0,s.jsx)(o,{label:"Card title",value:t.board.titleField,onChange:e=>a({...t,board:{...t.board,titleField:e}})}),(0,s.jsx)(o,{label:"Card desc",value:t.board.descField,onChange:e=>a({...t,board:{...t.board,descField:e}})})]})]})}let A=[{id:"table",icon:(0,s.jsx)(a.A,{size:13}),label:"Table"},{id:"gallery",icon:(0,s.jsx)(i.A,{size:13}),label:"Gallery"},{id:"board",icon:(0,s.jsx)(o.A,{size:13}),label:"Board"}];function z({filePath:e,content:t,saveAction:r}){let{headers:a,rows:i}=(0,n.useMemo)(()=>{let e;return{headers:(e=c().parse(t,{skipEmptyLines:!0}).data)[0]??[],rows:e.slice(1)}},[t]),o=(0,n.useMemo)(()=>({activeView:"table",table:{sortField:"",sortDir:"asc",groupField:"",hiddenFields:[]},gallery:{titleField:a[0]??"",descField:a[1]??"",tagField:a[2]??""},board:{groupField:a[a.length-1]??"",titleField:a[0]??"",descField:a[1]??""}}),[a]),[d,u]=(0,p.Un)("csv",e,o),[m,x]=(0,n.useState)(!1),f=(0,n.useCallback)(e=>{u(e)},[u]),h=d.activeView;return(0,s.jsxs)("div",{className:"w-full py-2",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-4 relative",children:[(0,s.jsx)("div",{className:"flex items-center gap-0.5 p-1 rounded-lg",style:{background:"var(--muted)"},children:A.map(e=>(0,s.jsxs)("button",{onClick:()=>f({...d,activeView:e.id}),className:"flex items-center gap-1.5 px-3 py-1.5 rounded text-xs font-medium transition-colors font-display",style:{background:h===e.id?"var(--card)":"transparent",color:h===e.id?"var(--foreground)":"var(--muted-foreground)",boxShadow:h===e.id?"0 1px 3px rgba(0,0,0,0.1)":"none"},children:[e.icon,e.label]},e.id))}),(0,s.jsx)("div",{className:"flex-1"}),(0,s.jsxs)("span",{className:"text-xs font-display",style:{color:"var(--muted-foreground)",opacity:.5},children:[i.length," rows"]}),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("button",{onClick:()=>x(e=>!e),className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-xs transition-colors",style:{background:m?"var(--accent)":"var(--muted)",color:m?"var(--foreground)":"var(--muted-foreground)"},title:"View settings",children:(0,s.jsx)(l.A,{size:13})}),m&&(0,s.jsx)(C,{headers:a,cfg:d,view:h,onClose:()=>x(!1),onChange:f})]})]}),"table"===h&&(0,s.jsx)(j,{headers:a,rows:i,cfg:d.table,saveAction:r}),"gallery"===h&&(0,s.jsx)(w,{headers:a,rows:i,cfg:d.gallery}),"board"===h&&(0,s.jsx)(N,{headers:a,rows:i,cfg:d.board,saveAction:r})]})}},92524:(e,t,r)=>{"use strict";r.d(t,{default:()=>n});var s=r(12115);function n(){return(0,s.useEffect)(()=>{!("u">typeof navigator&&/electron/i.test(navigator.userAgent))&&"serviceWorker"in navigator&&navigator.serviceWorker.register("/sw.js").catch(e=>{console.warn("[SW] Registration failed:",e)})},[]),null}},92950:(e,t,r)=>{"use strict";r.r(t),r.d(t,{GraphRenderer:()=>c});var s=r(95155),n=r(12115),a=r(73321),i=r(81750),o=r(61278);r(53255);var l=r(22356);let d=(0,n.memo)(function({data:e}){let t=(0,a.useRouter)(),{label:r,id:l,isCurrent:d,isOrphan:c,size:u=1}=e,m=(0,n.useCallback)(()=>{let e=l.split("/").map(encodeURIComponent).join("/");t.push("/view/"+e)},[l,t]),x=.8+Math.min(.1*u,1.2);return(0,s.jsxs)("div",{onClick:m,title:l,className:"group font-display",style:{fontSize:10*x,padding:`${4*x}px ${12*x}px`,borderRadius:999,cursor:"pointer",userSelect:"none",whiteSpace:"nowrap",maxWidth:240,overflow:"hidden",textOverflow:"ellipsis",opacity:c?.4:1,background:d?"var(--amber)":"var(--card)",color:d?"var(--amber-foreground)":"var(--foreground)",border:`1.5px solid ${d?"var(--amber)":"var(--border)"}`,boxShadow:d?"0 0 20px var(--amber-dim), 0 0 0 2px var(--amber-dim)":"0 2px 4px rgba(0,0,0,0.1)",transition:"all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",zIndex:d?10:1},onMouseEnter:e=>{d||(e.currentTarget.style.borderColor="var(--amber)",e.currentTarget.style.background="var(--accent)")},onMouseLeave:e=>{d||(e.currentTarget.style.borderColor="var(--border)",e.currentTarget.style.background="var(--card)")},children:[(0,s.jsx)(i.h7,{type:"target",position:o.yX.Top,style:{opacity:0}}),r,(0,s.jsx)(i.h7,{type:"source",position:o.yX.Bottom,style:{opacity:0}})]})});function c({filePath:e}){let[t,r]=(0,n.useState)(null),[a,o]=(0,n.useState)(!0),[c,u]=(0,n.useState)("local"),[m,x]=(0,n.useState)(!1);(0,n.useEffect)(()=>{x(!0)},[]),(0,n.useEffect)(()=>{(0,l.n)("/api/graph").then(e=>{r(e),o(!1)}).catch(()=>o(!1))},[]);let p=(0,n.useMemo)(()=>{if(!t)return new Map;let e=new Map;for(let r of t.edges)e.set(r.source,(e.get(r.source)||0)+1),e.set(r.target,(e.get(r.target)||0)+1);return e},[t]),f=(0,n.useMemo)(()=>{if(!t)return null;let e=new Map;for(let r of t.edges)e.has(r.source)||e.set(r.source,new Set),e.has(r.target)||e.set(r.target,new Set),e.get(r.source).add(r.target),e.get(r.target).add(r.source);return e},[t]),{filteredNodes:h,filteredEdges:g}=(0,n.useMemo)(()=>{let r,s;if(!t)return{filteredNodes:[],filteredEdges:[]};if("global"===c)r=t.nodes,s=t.edges;else{let n=new Set,a=[{id:e,depth:0}];for(n.add(e);a.length>0;){let{id:e,depth:t}=a.shift();if(!(t>=2))for(let r of f?.get(e)??new Set)n.has(r)||(n.add(r),a.push({id:r,depth:t+1}))}let i=new Set((r=t.nodes.filter(e=>n.has(e.id))).map(e=>e.id));s=t.edges.filter(e=>i.has(e.source)&&i.has(e.target))}return{filteredNodes:r,filteredEdges:s}},[t,c,e,f]),b=(0,n.useMemo)(()=>{let e=new Set;for(let t of g)e.add(t.source),e.add(t.target);return e},[g]),{rfNodes:v,rfEdges:y}=(0,n.useMemo)(()=>{if(0===h.length)return{rfNodes:[],rfEdges:[]};let t=function(e,t,r){let s=e.length;if(0===s)return{};let n=(void 0)??(s>100?80:150),a=.6*Math.sqrt(108e4/Math.max(s,1)),i={};e.forEach((e,t)=>{let r=2*Math.PI*t/s,n=360*Math.random();i[e]={x:600+Math.cos(r)*n,y:450+Math.sin(r)*n}});let o={};for(let r=0;r<n;r++){let l=120*(1-r/n);for(let t of e)o[t]={x:0,y:0};for(let t=0;t<s;t++)for(let r=t+1;r<s;r++){let s=e[t],n=e[r],l=i[s].x-i[n].x,d=i[s].y-i[n].y,c=Math.sqrt(l*l+d*d||.01),u=a*a/c;o[s].x+=l/c*u,o[s].y+=d/c*u,o[n].x-=l/c*u,o[n].y-=d/c*u}for(let e of t){let t=e.source,r=e.target;if(!i[t]||!i[r])continue;let s=i[t].x-i[r].x,n=i[t].y-i[r].y,l=Math.sqrt(s*s+n*n||.01),d=l*l/a;o[t].x-=s/l*d,o[t].y-=n/l*d,o[r].x+=s/l*d,o[r].y+=n/l*d}for(let t of e){let e=i[t].x-600,r=i[t].y-450,s=Math.sqrt(e*e+r*r)||.01,n=.05*s;o[t].x-=e/s*n,o[t].y-=r/s*n}for(let t of e){let e=o[t],r=Math.sqrt(e.x*e.x+e.y*e.y)||.01;i[t].x+=e.x/r*Math.min(r,l),i[t].y+=e.y/r*Math.min(r,l),i[t].x=Math.max(0,Math.min(1200,i[t].x)),i[t].y=Math.max(0,Math.min(900,i[t].y))}}return i}(h.map(e=>e.id),g);return{rfNodes:h.map(r=>({id:r.id,type:"wiki",position:t[r.id]??{x:0,y:0},data:{label:r.label,id:r.id,isCurrent:r.id===e,isOrphan:!b.has(r.id),size:p.get(r.id)||1}})),rfEdges:g.map((t,r)=>{let s=t.source===e||t.target===e;return{id:`e-${r}`,source:t.source,target:t.target,type:"default",markerEnd:{type:"arrowclosed",color:s?"var(--amber)":"var(--border)"},style:{stroke:s?"var(--amber)":"var(--border)",strokeWidth:s?1.5:1,opacity:s?.8:.4},animated:s}})}},[h,g,e,b,p]),j=(0,n.useMemo)(()=>({wiki:d}),[]);return!m||a?(0,s.jsx)("div",{style:{width:"100%",height:"calc(100vh - 160px)",minHeight:400,borderRadius:12,background:"var(--muted)",border:"1px solid var(--border)",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,s.jsx)("span",{className:"font-display",style:{color:"var(--muted-foreground)",fontSize:12},children:a?"Building graph…":"Loading…"})}):(0,s.jsxs)("div",{style:{width:"100%",position:"relative",zIndex:0},children:[(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:12,marginBottom:10,flexWrap:"wrap"},children:[(0,s.jsxs)("span",{className:"font-display",style:{fontSize:11,color:"var(--muted-foreground)"},children:[h.length," nodes \xb7 ",g.length," edges"]}),(0,s.jsx)("div",{style:{display:"flex",gap:2,padding:3,borderRadius:8,background:"var(--muted)"},children:[{id:"local",label:"Local"},{id:"global",label:"Global"}].map(e=>(0,s.jsx)("button",{onClick:()=>u(e.id),className:"font-display",style:{padding:"3px 12px",borderRadius:5,fontSize:11,cursor:"pointer",border:"none",outline:"none",background:c===e.id?"var(--card)":"transparent",color:c===e.id?"var(--foreground)":"var(--muted-foreground)",boxShadow:c===e.id?"0 1px 3px rgba(0,0,0,0.1)":"none",transition:"all 0.1s"},children:e.label},e.id))})]}),(0,s.jsx)("div",{style:{width:"100%",height:"calc(100vh - 160px)",minHeight:400},children:(0,s.jsxs)(i.Gc,{nodes:v,edges:y,nodeTypes:j,fitView:!0,fitViewOptions:{padding:.15},proOptions:{hideAttribution:!0},style:{background:"var(--background)",borderRadius:12,border:"1px solid var(--border)"},children:[(0,s.jsx)(i.VS,{color:"var(--border)",gap:24,size:1,variant:i._5.Dots}),(0,s.jsx)(i.H2,{showInteractive:!1}),(0,s.jsx)(i.of,{nodeColor:e=>e.data?.isCurrent?"var(--amber)":"var(--muted-foreground)"})]})})]})}},93042:(e,t,r)=>{"use strict";r.d(t,{default:()=>i});var s=r(12115),n=r(35581),a=r(28380);function i({ssrLocale:e}){let t=(0,s.useRef)(!1);return t.current||(t.current=!0,n.D.getState().locale!==e&&n.D.setState({locale:e,t:a.D[e]})),(0,s.useEffect)(()=>n.D.getState()._init(e),[e]),null}},98959:(e,t,r)=>{"use strict";r.d(t,{default:()=>d});var s=r(95155),n=r(12115),a=r(33210),i=r(35581);let o="mindos_update_skip_desktop",l="mindos_update_skip_core";function d(){let{t:e}=(0,i.Y)(),t=e.settings.update.updateToast,[r,d]=(0,n.useState)("hidden"),[c,u]=(0,n.useState)({}),m=(0,n.useRef)(null),[x,p]=(0,n.useState)(!1),f=(0,n.useRef)(new Set),h=(0,n.useRef)({}),g=(0,n.useCallback)(()=>{f.current.forEach(clearTimeout),f.current.clear()},[]),b=(0,n.useCallback)((e,t)=>{let r=setTimeout(()=>{f.current.delete(r),d(e)},t);f.current.add(r)},[]);(0,n.useEffect)(()=>{let e,t=(e=window,e.mindos?.checkUpdate?e.mindos:null);m.current=t,p(!!t)},[]),(0,n.useEffect)(()=>{let e=m.current;if(!e)return;g();let t=[],r=(e,t,r)=>{let s=localStorage.getItem(r);s&&!function(e,t){let r=e.split(".").map(Number),s=t.split(".").map(Number);for(let e=0;e<Math.max(r.length,s.length);e++){let t=r[e]??0,n=s[e]??0;if(t>n)return!0;if(t<n)break}return!1}(t,s)||h.current[e]!==t&&(h.current[e]=t,u(r=>({...r,[e]:{type:e,version:t}})),b("visible",1e4))};return e.onUpdateAvailable&&t.push(e.onUpdateAvailable(e=>{e?.version&&r("desktop",e.version,o)})),e.onCoreUpdateAvailable&&t.push(e.onCoreUpdateAvailable(e=>{e?.latest&&!e.ready&&r("core",e.latest,l)})),()=>{t.forEach(e=>e()),g()}},[x,g,b]),(0,n.useEffect)(()=>()=>g(),[g]);let v=(0,n.useCallback)(()=>{g(),window.dispatchEvent(new CustomEvent("mindos:open-settings",{detail:{tab:"update"}})),d("dismissing"),b("hidden",200)},[g,b]),y=(0,n.useCallback)(()=>{g(),c.desktop&&localStorage.setItem(o,c.desktop.version),c.core&&localStorage.setItem(l,c.core.version),d("dismissing"),b("hidden",200)},[c,g,b]);if(!x||"hidden"===r)return null;let j=!!(c.desktop&&c.core),w=j?t.titleMultiple:c.desktop?t.titleSingle(t.desktopLabel,c.desktop.version):c.core?t.titleSingle(t.coreLabel,c.core.version):"",N=j?`${t.desktopLabel} v${c.desktop.version} \u00B7 ${t.coreLabel} v${c.core.version}`:"";return(0,s.jsx)("div",{role:"status","aria-live":"polite",className:`
|
|
129
|
+
`})]})}function tO({fileTree:e,children:t}){return"/login"===(0,n.usePathname)()?(0,s.jsx)(s.Fragment,{children:t}):(0,s.jsx)(tL,{fileTree:e,children:t})}},66709:(e,t,r)=>{"use strict";r.d(t,{A:()=>u});var s=r(95155),n=r(12115),a=r(92451),i=r(33210),o=r(6296),l=r(13545),d=r(12651),c=r(35581);function u({open:e,onClose:t,onDiscover:r,discovering:u,error:m}){let{t:x}=(0,c.Y)(),p=x.panels.agents,[h,f]=(0,n.useState)(""),[g,b]=(0,n.useState)(null);if(!e)return null;let v=async()=>{if(!h.trim()||u)return;b(null);let e=await r(h.trim());e&&b(e)},y=()=>{f(""),b(null),t()};return(0,s.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center overlay-backdrop",onClick:y,children:(0,s.jsxs)("div",{className:"bg-popover border border-border rounded-xl shadow-lg w-full max-w-md mx-4 p-5",onClick:e=>e.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":p.a2aDiscover,children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,s.jsxs)("h3",{className:"text-sm font-semibold text-foreground flex items-center gap-2",children:[(0,s.jsx)(a.A,{size:15,className:"text-muted-foreground"}),p.a2aDiscover]}),(0,s.jsx)("button",{type:"button",onClick:y,className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":"Close",children:(0,s.jsx)(i.A,{size:14})})]}),(0,s.jsx)("p",{className:"text-2xs text-muted-foreground mb-3",children:p.a2aDiscoverHint}),(0,s.jsxs)("div",{className:"flex gap-2 mb-4",children:[(0,s.jsx)("input",{type:"url",value:h,onChange:e=>f(e.target.value),onKeyDown:e=>{"Enter"===e.key&&v(),"Escape"===e.key&&t()},placeholder:p.a2aDiscoverPlaceholder,disabled:u,className:"flex-1 px-3 py-2 text-xs rounded-lg border border-border bg-background text-foreground placeholder:text-muted-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50",autoFocus:!0}),(0,s.jsxs)("button",{type:"button",onClick:v,disabled:u||!h.trim(),className:"px-3 py-2 text-xs font-medium rounded-lg bg-foreground text-background hover:bg-foreground/90 disabled:opacity-50 transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-ring flex items-center gap-1.5 shrink-0",children:[u&&(0,s.jsx)(o.A,{size:12,className:"animate-spin"}),u?p.a2aDiscovering:p.a2aDiscover]})]}),m&&!g&&(0,s.jsx)("div",{className:"rounded-lg border border-error/30 bg-error/5 px-3 py-2.5 mb-3",children:(0,s.jsxs)("div",{className:"flex items-start gap-2",children:[(0,s.jsx)(l.A,{size:14,className:"text-error mt-0.5 shrink-0"}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-xs font-medium text-error",children:p.a2aDiscoverFailed}),(0,s.jsx)("p",{className:"text-2xs text-muted-foreground mt-0.5",children:p.a2aDiscoverFailedHint})]})]})}),g&&(0,s.jsx)("div",{className:"rounded-lg border border-success/30 bg-success/5 px-3 py-2.5",children:(0,s.jsxs)("div",{className:"flex items-start gap-2",children:[(0,s.jsx)(d.A,{size:14,className:"text-success mt-0.5 shrink-0"}),(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:"text-xs font-medium text-success mb-1.5",children:p.a2aDiscoverSuccess}),(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsxs)("p",{className:"text-xs font-medium text-foreground truncate",title:g.card.name,children:[g.card.name,(0,s.jsxs)("span",{className:"text-2xs text-muted-foreground ml-1.5",children:["v",g.card.version]})]}),(0,s.jsx)("p",{className:"text-2xs text-muted-foreground truncate",title:g.card.description,children:g.card.description}),g.card.skills.length>0&&(0,s.jsxs)("div",{className:"mt-1.5",children:[(0,s.jsxs)("p",{className:"text-2xs text-muted-foreground mb-1",children:[p.a2aSkills,":"]}),(0,s.jsx)("div",{className:"flex flex-wrap gap-1",children:g.card.skills.map(e=>(0,s.jsx)("span",{className:"text-2xs px-1.5 py-0.5 rounded bg-muted/80 text-muted-foreground border border-border/50",title:e.description,children:e.name},e.id))})]}),(0,s.jsxs)("p",{className:"text-2xs text-muted-foreground mt-1 truncate",title:g.endpoint,children:[p.a2aEndpoint,": ",g.endpoint]})]})]})]})})]})})}},66872:()=>{},77148:(e,t,r)=>{"use strict";r.d(t,{Un:()=>a});var s=r(12115);let n="mindos-renderer-state-change";function a(e,t,r){let a=`mindos-renderer:${e}:${t}`,i=(0,s.useRef)({key:a,raw:null,parsed:r});return i.current.key!==a&&(i.current={key:a,raw:null,parsed:r}),[(0,s.useSyncExternalStore)(e=>{let t=()=>e();return window.addEventListener("storage",t),window.addEventListener(n,t),()=>{window.removeEventListener("storage",t),window.removeEventListener(n,t)}},()=>{try{let e=localStorage.getItem(a);if(e===i.current.raw)return i.current.parsed;if(null===e)return i.current={key:a,raw:null,parsed:r},r;let t=JSON.parse(e);return i.current={key:a,raw:e,parsed:t},t}catch{return r}},()=>r),(0,s.useCallback)(e=>{try{let t=(()=>{try{let e=localStorage.getItem(a);return null!==e?JSON.parse(e):r}catch{return r}})(),s="function"==typeof e?e(t):e,n=JSON.stringify(s);localStorage.setItem(a,n),i.current={key:a,raw:n,parsed:s}}catch{}window.dispatchEvent(new Event(n))},[a,r])]}},78520:(e,t,r)=>{"use strict";r.d(t,{D4:()=>i,FB:()=>n,W8:()=>o,g4:()=>l,jQ:()=>c});let s="mindos:organize-history";function n(){try{let e=localStorage.getItem(s);if(!e)return[];return JSON.parse(e)}catch{return[]}}function a(e){try{localStorage.setItem(s,JSON.stringify(e.slice(0,50)))}catch{}}function i(e){let t=n();t.unshift(e);let r=t.slice(0,50);return a(r),r}function o(e,t){let r=n(),s=r.findIndex(t=>t.id===e);return s>=0&&(r[s]={...r[s],...t},a(r)),r}function l(){try{localStorage.removeItem(s)}catch{}}let d=0;function c(){return`org-${Date.now()}-${++d}`}},78660:(e,t,r)=>{"use strict";r.r(t),r.d(t,{TodoRenderer:()=>W});var s=r(95155),n=r(12115),a=r(16950);let i=/^##\s+(.+)/,o=/^#\s+/,l=/^#{3,6}\s+(.+)/,d=/^(\s*)- \[([ xX~])\]\s+(.*)$/,c=/`(P[012])`/,u=/`(\d{4}-\d{2}-\d{2}|\d{2}-\d{2})`/,m=/#([a-zA-Z\u4e00-\u9fff][\w\u4e00-\u9fff-]*)/g;function x(e,t){let r=[...e];return t(r),r.join("\n")}function p(e){let t=function(e){if(!e)return null;let t=new Date;return new Date(/^\d{2}-\d{2}$/.test(e)?`${t.getFullYear()}-${e}`:e)}(e);if(!t||isNaN(t.getTime()))return null;let r=new Date,s=new Date(r.getFullYear(),r.getMonth(),r.getDate()),n=(new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime()-s.getTime())/864e5;return n<0?"overdue":0===n?"today":n<=3?"soon":"future"}function h(e,t){return e.reduce((e,r)=>e+ +(r.status===t)+h(r.children,t),0)}function f(e){return e.reduce((e,t)=>e+1+f(t.children),0)}function g(e,t){return("all"===t.status||e.status===t.status)&&("all"===t.priority||e.meta.priority===t.priority)&&("all"===t.tag||!!e.meta.tags.includes(t.tag))}let b={P0:{bg:"bg-red-500/10",text:"text-red-500",border:"border-red-500/20"},P1:{bg:"bg-amber-500/10",text:"text-amber-500",border:"border-amber-500/20"},P2:{bg:"bg-blue-500/10",text:"text-blue-500",border:"border-blue-500/20"}},v={overdue:{text:"text-red-500",bg:"bg-red-500/10"},today:{text:"text-amber-500",bg:"bg-amber-500/10"},soon:{text:"text-amber-400",bg:"bg-amber-400/5"},future:{text:"text-muted-foreground",bg:""}},y={TODAY:{dot:"bg-red-400",label:"text-red-400"},"This Week":{dot:"bg-orange-400",label:"text-orange-400"},Workflows:{dot:"bg-amber-400",label:"text-amber-400"},Backlog:{dot:"bg-blue-400",label:"text-blue-400"},Done:{dot:"bg-emerald-400",label:"text-emerald-400"},Maintenance:{dot:"bg-zinc-400",label:"text-zinc-400"}};var j=r(92622),w=r(33210);function N({filters:e,onFilterChange:t,allTags:r,allPriorities:n,counts:a}){let i="all"!==e.priority||"all"!==e.tag||"all"!==e.status;return 0===r.length&&0===n.length?null:(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2 mb-4",children:[(0,s.jsx)(j.A,{size:12,className:"text-muted-foreground shrink-0"}),(0,s.jsxs)("div",{className:"flex items-center rounded-lg border border-border overflow-hidden text-xs",children:[(0,s.jsxs)("button",{onClick:()=>t({...e,status:"all"}),className:`px-2.5 py-1 transition-colors ${"all"===e.status?"bg-muted text-foreground font-medium":"text-muted-foreground hover:bg-muted/50"}`,children:["All ",a.total]}),(0,s.jsxs)("button",{onClick:()=>t({...e,status:"todo"}),className:`px-2.5 py-1 transition-colors border-l border-border ${"todo"===e.status?"bg-muted text-foreground font-medium":"text-muted-foreground hover:bg-muted/50"}`,children:["Todo ",a.todo]}),(0,s.jsxs)("button",{onClick:()=>t({...e,status:"in-progress"}),className:`px-2.5 py-1 transition-colors border-l border-border ${"in-progress"===e.status?"bg-[var(--amber)]/10 text-[var(--amber)] font-medium":"text-muted-foreground hover:bg-muted/50"}`,children:["In Progress ",a.inProgress]}),(0,s.jsxs)("button",{onClick:()=>t({...e,status:"done"}),className:`px-2.5 py-1 transition-colors border-l border-border ${"done"===e.status?"bg-emerald-500/10 text-emerald-500 font-medium":"text-muted-foreground hover:bg-muted/50"}`,children:["Done ",a.done]})]}),n.length>0&&(0,s.jsx)("div",{className:"flex items-center gap-1",children:n.map(r=>{if(!r)return null;let n=b[r],a=e.priority===r;return(0,s.jsx)("button",{onClick:()=>t({...e,priority:a?"all":r}),className:`px-2 py-0.5 rounded text-xs font-mono font-medium border transition-colors ${a?`${n.bg} ${n.text} ${n.border}`:"border-transparent text-muted-foreground hover:bg-muted"}`,children:r},r)})}),r.length>0&&(0,s.jsx)("div",{className:"flex items-center gap-1",children:r.map(r=>{let n=e.tag===r;return(0,s.jsxs)("button",{onClick:()=>t({...e,tag:n?"all":r}),className:`px-2 py-0.5 rounded-full text-xs transition-colors ${n?"bg-[var(--amber)]/15 text-[var(--amber)]":"text-muted-foreground hover:bg-muted"}`,children:["#",r]},r)})}),i&&(0,s.jsxs)("button",{onClick:()=>t({priority:"all",tag:"all",status:"all"}),className:"flex items-center gap-1 px-2 py-0.5 rounded text-xs text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:[(0,s.jsx)(w.A,{size:10})," Clear"]})]})}var k=r(57420),S=r(58515),C=r(36201),A=r(51914),z=r(66088),E=r(21362),$=r(68459),T=r(84980);function D({priority:e}){if(!e)return null;let t=b[e];return(0,s.jsx)("span",{className:`inline-flex items-center px-1.5 py-0 rounded text-[10px] font-mono font-semibold leading-4 border shrink-0 ${t.bg} ${t.text} ${t.border}`,children:e})}function R({dateStr:e,status:t}){if(!e||"done"===t)return null;let r=p(e);if(!r)return null;let n=v[r];return(0,s.jsxs)("span",{className:`inline-flex items-center gap-0.5 px-1.5 py-0 rounded text-[10px] leading-4 shrink-0 ${n.text} ${n.bg}`,children:[(0,s.jsx)(k.A,{size:9}),e]})}function P({tag:e}){return(0,s.jsxs)("span",{className:"inline-flex items-center px-1.5 py-0 rounded-full text-[10px] leading-4 text-muted-foreground bg-muted/60 shrink-0",children:["#",e]})}function M({status:e,onClick:t}){return(0,s.jsxs)("button",{onClick:t,className:"shrink-0 transition-colors",title:"Click to cycle status",children:["done"===e&&(0,s.jsx)(S.A,{size:15,style:{color:"var(--amber)"}}),"in-progress"===e&&(0,s.jsx)(a.A,{size:15,className:"text-[var(--amber)] fill-[var(--amber)]/20"}),"todo"===e&&(0,s.jsx)(C.A,{size:15,style:{color:"var(--muted-foreground)"}})]})}function F({text:e,status:t,onRename:r}){let[a,i]=(0,n.useState)(!1),[o,l]=(0,n.useState)(e),d=(0,n.useRef)(null);function c(){let t=o.trim();t&&t!==e?r(t):l(e),i(!1)}return((0,n.useEffect)(()=>{l(e)},[e]),(0,n.useEffect)(()=>{a&&d.current?.select()},[a]),a)?(0,s.jsx)("input",{ref:d,value:o,onChange:e=>l(e.target.value),onBlur:c,onKeyDown:t=>{"Enter"===t.key&&c(),"Escape"===t.key&&(l(e),i(!1))},className:"flex-1 bg-transparent border-b text-sm leading-relaxed outline-none min-w-0",style:{borderColor:"var(--amber)",color:"var(--foreground)"},onClick:e=>e.stopPropagation()}):(0,s.jsx)("span",{className:`flex-1 text-sm leading-relaxed cursor-text min-w-0 ${"done"===t?"line-through text-muted-foreground":"text-foreground"}`,onDoubleClick:()=>i(!0),title:"Double-click to edit",children:e})}function I({onAdd:e}){let[t,r]=(0,n.useState)(!1),[a,i]=(0,n.useState)(""),o=(0,n.useRef)(null);function l(){let t=a.trim();t&&e(t),i(""),r(!1)}return((0,n.useEffect)(()=>{t&&o.current?.focus()},[t]),t)?(0,s.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 mt-1",children:[(0,s.jsx)("span",{className:"w-[13px] shrink-0"}),(0,s.jsx)("span",{className:"shrink-0",style:{color:"var(--muted-foreground)"},children:(0,s.jsx)(C.A,{size:15})}),(0,s.jsx)("input",{ref:o,value:a,onChange:e=>i(e.target.value),onBlur:l,onKeyDown:e=>{"Enter"===e.key&&l(),"Escape"===e.key&&(i(""),r(!1))},placeholder:"New item… (supports `P0` `03-28` #tag)",className:"flex-1 bg-transparent border-b text-sm outline-none",style:{borderColor:"var(--amber)",color:"var(--foreground)"}})]}):(0,s.jsxs)("button",{onClick:()=>r(!0),className:"flex items-center gap-1.5 w-full px-3 py-1.5 rounded-lg text-xs transition-colors hover:bg-muted/60 mt-1",style:{color:"var(--muted-foreground)"},children:[(0,s.jsx)(A.A,{size:12}),(0,s.jsx)("span",{children:"Add item"})]})}function L({item:e,depth:t,filters:r,onCycleStatus:a,onRename:i,onDelete:o}){let[l,d]=(0,n.useState)(!0),c=e.children.length>0,u=g(e,r),m=e.children.some(e=>(function e(t,r){return!!g(t,r)||t.children.some(t=>e(t,r))})(e,r));if(("all"!==r.status||"all"!==r.priority||"all"!==r.tag)&&!u&&!m)return null;let x=p(e.meta.dueDate);return(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:`group flex items-center gap-2 py-1.5 px-2 rounded-lg transition-colors hover:bg-muted/60 ${"done"===e.status?"opacity-45":""} ${"overdue"===x&&"done"!==e.status?"bg-error/[0.03]":""}`,style:{paddingLeft:`${8+20*t}px`},children:[c?(0,s.jsx)("button",{onClick:()=>d(e=>!e),className:"shrink-0 text-muted-foreground hover:text-foreground transition-colors",children:l?(0,s.jsx)(z.A,{size:13}):(0,s.jsx)(E.A,{size:13})}):(0,s.jsx)("span",{className:"w-[13px] shrink-0"}),(0,s.jsx)(M,{status:e.status,onClick:()=>{var t;return a(e.lineIndex,"todo"===(t=e.status)?"in-progress":"in-progress"===t?"done":"todo")}}),(0,s.jsx)(F,{text:e.text,status:e.status,onRename:t=>i(e.lineIndex,t)}),(0,s.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,s.jsx)(D,{priority:e.meta.priority}),(0,s.jsx)(R,{dateStr:e.meta.dueDate,status:e.status}),e.meta.tags.map(e=>(0,s.jsx)(P,{tag:e},e))]}),(0,s.jsx)("button",{onClick:()=>o(e.lineIndex),className:"shrink-0 opacity-0 group-hover:opacity-100 transition-opacity p-0.5 rounded hover:bg-destructive/10",style:{color:"var(--muted-foreground)"},title:"Delete item",children:(0,s.jsx)($.A,{size:12})})]}),c&&l&&(0,s.jsx)("div",{children:e.children.map(e=>(0,s.jsx)(L,{item:e,depth:t+1,filters:r,onCycleStatus:a,onRename:i,onDelete:o},e.id))})]})}function O({name:e,meta:t,filters:r,defaultCollapsed:a,onCycleStatus:i,onRename:o,onDelete:l,onAdd:d}){let c,[u,m]=(0,n.useState)(a??!1),x=(c=Object.keys(y).find(t=>e.includes(t)))?y[c]:{dot:"bg-zinc-500",label:"text-zinc-400"},{items:p,lastLineIndex:g}=t,b=h(p,"done"),v=h(p,"in-progress"),j=f(p),w=e.includes("Done");return(0,s.jsxs)("div",{className:"border border-border rounded-xl overflow-hidden bg-card",children:[(0,s.jsxs)("button",{onClick:()=>m(e=>!e),className:"w-full flex items-center justify-between px-4 py-3 hover:bg-muted/40 transition-colors",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{className:`w-2 h-2 rounded-full shrink-0 ${x.dot}`}),(0,s.jsx)("span",{className:`text-xs font-semibold uppercase tracking-wider ${x.label} font-display`,children:e}),(0,s.jsxs)("span",{className:"text-xs text-muted-foreground tabular-nums",children:[b,"/",j]}),v>0&&(0,s.jsxs)("span",{className:"flex items-center gap-0.5 text-[10px] text-[var(--amber)]",children:[(0,s.jsx)(T.A,{size:9})," ",v]})]}),u?(0,s.jsx)(E.A,{size:14,className:"text-muted-foreground"}):(0,s.jsx)(z.A,{size:14,className:"text-muted-foreground"})]}),(0,s.jsx)("div",{className:"h-0.5 bg-muted mx-4",children:(0,s.jsx)("div",{className:"h-full rounded-full transition-all duration-500",style:{width:j?`${b/j*100}%`:"0%",background:w?"var(--success, #22c55e)":"var(--amber)"}})}),!u&&(0,s.jsxs)("div",{className:"px-2 py-2",children:[p.map(e=>(0,s.jsx)(L,{item:e,depth:0,filters:r,onCycleStatus:i,onRename:o,onDelete:l},e.id)),0===p.length&&(0,s.jsx)("p",{className:"text-xs text-muted-foreground px-4 py-2",children:"No items"}),!w&&(0,s.jsx)(I,{onAdd:e=>d(g,e)})]})]})}function W({content:e,saveAction:t}){let[r,p]=(0,n.useState)(e),[g,b]=(0,n.useState)({priority:"all",tag:"all",status:"all"}),{sections:v,lines:y,sectionOrder:j}=(0,n.useMemo)(()=>{let e,t,s,n,a,x,p;return e=r.split("\n"),t="General",s={},n=[],a=[],x=!1,p=!1,e.forEach((e,r)=>{if(!p){if(0===r&&"---"===e.trim()){x=!0;return}if(x){"---"===e.trim()&&(x=!1,p=!0);return}p=!0}if(o.test(e))return;let h=e.match(i);if(h){s[t=h[1].replace(/^[^\w\s\u4e00-\u9fff]+\s*/,"").trim()]||(s[t]={items:[],lastLineIndex:-1,headingLineIndex:r},n.push(t));return}if(l.test(e))return;let f=e.match(d);if(!f)return;let[,g,b,v]=f,y=Math.floor(g.length/2),j="~"===b?"in-progress":"x"===b.toLowerCase()?"done":"todo",{cleanText:w,meta:N}=function(e){let t,r=e,s=null,n=null,a=[],i=r.match(c);i&&(s=i[1],r=r.replace(c,"").trim());let o=r.match(u);o&&(n=o[1],r=r.replace(u,"").trim());let l=RegExp(m.source,"g");for(;null!==(t=l.exec(r));)a.push(t[1]);return a.length>0&&(r=r.replace(/#[a-zA-Z\u4e00-\u9fff][\w\u4e00-\u9fff-]*/g,"").trim()),{cleanText:r=r.replace(/\*\*(.*?)\*\*/g,"$1").trim(),meta:{priority:s,dueDate:n,tags:a}}}(v),k={id:`${r}`,text:w,rawText:v,status:j,indent:y,lineIndex:r,section:t,children:[],meta:N};for(;a.length>0&&a[a.length-1].indent>=y;)a.pop();s[t]||(s[t]={items:[],lastLineIndex:-1,headingLineIndex:-1},n.push(t)),a.length>0?a[a.length-1].children.push(k):s[t].items.push(k),s[t].lastLineIndex=Math.max(s[t].lastLineIndex,r),a.push(k)}),{sections:s,lines:e,sectionOrder:n}},[r]),w=(0,n.useMemo)(()=>Object.values(v).reduce((e,t)=>e+h(t.items,"done"),0),[v]),k=(0,n.useMemo)(()=>Object.values(v).reduce((e,t)=>e+h(t.items,"in-progress"),0),[v]),S=(0,n.useMemo)(()=>Object.values(v).reduce((e,t)=>e+f(t.items),0),[v]),C=S-w-k,A=(0,n.useMemo)(()=>(function(e){let t=new Set;for(let r of Object.values(e))!function e(r){for(let s of r){for(let e of s.meta.tags)t.add(e);e(s.children)}}(r.items);return[...t].sort()})(v),[v]),z=(0,n.useMemo)(()=>(function(e){let t=new Set;for(let r of Object.values(e))!function e(r){for(let s of r)s.meta.priority&&t.add(s.meta.priority),e(s.children)}(r.items);return["P0","P1","P2"].filter(e=>t.has(e))})(v),[v]),E=(0,n.useCallback)(async e=>{p(e),await t(e)},[t]),$=(0,n.useCallback)(async(e,t)=>{await E(x(y,r=>{r[e]=r[e].replace(/- \[[ xX~]\]/,`- [${"done"===t?"x":"in-progress"===t?"~":" "}]`)}))},[y,E]),T=(0,n.useCallback)(async(e,t)=>{await E(x(y,r=>{r[e]=r[e].replace(/(- \[[ xX~]\]\s*)(.*)$/,`$1${t}`)}))},[y,E]),D=(0,n.useCallback)(async e=>{await E(x(y,t=>{t.splice(e,1)}))},[y,E]),R=(0,n.useCallback)(async(e,t)=>{await E(x(y,r=>{let s=e<0?r.length:e+1;r.splice(s,0,`- [ ] ${t}`)}))},[y,E]),P=j.filter(e=>v[e]).map(e=>[e,v[e]]),M=S?Math.round(w/S*100):0;return(0,s.jsxs)("div",{className:"max-w-[900px] mx-auto xl:mr-[220px] px-0 py-2",children:[(0,s.jsx)("div",{className:"mb-5 flex items-center gap-4",children:(0,s.jsxs)("div",{className:"flex-1",children:[(0,s.jsxs)("div",{className:"flex items-baseline gap-2",children:[(0,s.jsxs)("span",{className:"text-lg font-semibold font-display text-foreground tabular-nums",children:[M,"%"]}),(0,s.jsxs)("span",{className:"text-xs text-muted-foreground font-display",children:[w,"/",S," completed"]}),k>0&&(0,s.jsxs)("span",{className:"flex items-center gap-1 text-xs text-[var(--amber)]",children:[(0,s.jsx)(a.A,{size:8,className:"fill-[var(--amber)]/30"}),k," in progress"]})]}),(0,s.jsx)("div",{className:"mt-2 w-full max-w-xs h-1.5 bg-muted rounded-full overflow-hidden",children:(0,s.jsx)("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${M}%`,background:"var(--amber)"}})})]})}),(0,s.jsx)(N,{filters:g,onFilterChange:b,allTags:A,allPriorities:z,counts:{todo:C,inProgress:k,done:w,total:S}}),(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[P.map(([e,t])=>(0,s.jsx)(O,{name:e,meta:t,filters:g,defaultCollapsed:e.includes("Done"),onCycleStatus:$,onRename:T,onDelete:D,onAdd:R},e)),0===P.length&&(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:"No TODO items found in this file."})]})]})}},82125:(e,t,r)=>{"use strict";r.d(t,{A:()=>n,C:()=>s});let s=new Set(["INSTRUCTION.md","README.md","CONFIG.json","CHANGELOG.md"]),n=new Set(["TODO.md"])},82681:(e,t,r)=>{"use strict";r.d(t,{Y:()=>n});var s=r(9339);let n=(0,s.createServerReference)("40364c7f188ce3c8c6ce58352d1f9473e7003c2ba3",s.callServer,void 0,s.findSourceMapURL,"undoDeleteAction")},86343:(e,t,r)=>{"use strict";r.d(t,{default:()=>a});var s=r(95155),n=r(12115);class a extends n.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){console.error("[ErrorBoundary]",e,t.componentStack)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:(0,s.jsx)("div",{className:"flex items-center justify-center min-h-[50vh] px-4",children:(0,s.jsxs)("div",{className:"text-center max-w-md",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold text-foreground mb-2",children:"Something went wrong"}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:this.state.error?.message||"An unexpected error occurred."}),(0,s.jsx)("button",{onClick:()=>this.setState({hasError:!1,error:void 0}),className:"px-4 py-2 text-sm rounded-lg border border-border hover:bg-muted transition-colors",children:"Try again"})]})}):this.props.children}}},87986:(e,t,r)=>{"use strict";r.r(t),r.d(t,{VideoRenderer:()=>a});var s=r(95155),n=r(12115);function a({filePath:e}){let t=`/api/file/raw?path=${encodeURIComponent(e)}`,r=e.split("/").pop()??"video",a=r.split(".").pop()?.toLowerCase()??"",[i,o]=(0,n.useState)(!1),[l,d]=(0,n.useState)(0),[c,u]=(0,n.useState)(null),[m,x]=(0,n.useState)(null),p=(0,n.useRef)(null);(0,n.useEffect)(()=>{fetch(t,{method:"HEAD"}).then(e=>{let t=e.headers.get("Content-Length");t&&u(parseInt(t,10))}).catch(()=>{})},[t]);let h=(0,n.useCallback)(()=>{let e=p.current;e&&x({w:e.videoWidth,h:e.videoHeight})},[]),f=(0,n.useCallback)(()=>{o(!1),d(e=>e+1)},[]);return(0,s.jsxs)("div",{className:"w-full flex flex-col gap-0",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3 px-3 py-2 border-b border-border text-xs text-[var(--text-secondary)]",children:[m&&(0,s.jsxs)("span",{children:[m.w," x ",m.h]}),null!==c&&(0,s.jsx)("span",{children:c<1024?`${c} B`:c<1048576?`${(c/1024).toFixed(1)} KB`:`${(c/1048576).toFixed(1)} MB`}),(0,s.jsx)("span",{className:"uppercase opacity-60",children:a})]}),(0,s.jsx)("div",{className:"flex-1 min-h-[50vh] flex items-center justify-center bg-black rounded-b-lg overflow-hidden",children:i?(0,s.jsxs)("div",{className:"flex flex-col items-center gap-2",children:[(0,s.jsx)("span",{className:"text-sm text-neutral-400",children:"Failed to load video"}),(0,s.jsx)("button",{onClick:f,className:"text-xs px-3 py-1.5 rounded-md bg-neutral-800 hover:bg-neutral-700 text-neutral-200 transition-colors",children:"Retry"})]}):(0,s.jsx)("video",{ref:p,controls:!0,preload:"metadata",className:"max-w-full max-h-[70vh]",onLoadedMetadata:h,onError:()=>o(!0),children:(0,s.jsx)("source",{src:t})},l)})]})}},88946:(e,t,r)=>{"use strict";r.r(t),r.d(t,{BacklinksRenderer:()=>m});var s=r(95155),n=r(12115),a=r(73321),i=r(48368),o=r(22164),l=r(91337),d=r(22356);function c(e){return e.split("/").pop()?.replace(/\.md$/,"")??e}function u({text:e}){let t=e.split(/(\[\[[^\]]+\]\]|\[[^\]]+\]\([^)]+\))/g);return(0,s.jsx)("span",{children:t.map((e,t)=>/^\[\[/.test(e)||/^\[/.test(e)?(0,s.jsx)("span",{style:{color:"var(--amber)",fontWeight:500},children:e},t):(0,s.jsx)("span",{children:e},t))})}function m({filePath:e}){let t=(0,a.useRouter)(),[r,m]=(0,n.useState)(null),[x,p]=(0,n.useState)(!0);if((0,n.useEffect)(()=>{p(!0),(0,d.n)(`/api/backlinks?path=${encodeURIComponent(e)}`).then(e=>{m(e),p(!1)}).catch(()=>p(!1))},[e]),x)return(0,s.jsx)("div",{className:"font-display",style:{padding:"3rem 1rem",textAlign:"center",fontSize:12,color:"var(--muted-foreground)"},children:"Scanning backlinks…"});let h=r??[];return(0,s.jsxs)("div",{style:{maxWidth:720,margin:"0 auto",padding:"1.5rem 0"},children:[(0,s.jsx)("div",{style:{marginBottom:"1.5rem",display:"flex",alignItems:"center",gap:8},children:(0,s.jsx)("span",{className:"font-display",style:{fontSize:11,color:"var(--muted-foreground)"},children:0===h.length?"No backlinks found":`${h.length} file${1===h.length?"":"s"} link here`})}),0===h.length?(0,s.jsxs)("div",{style:{border:"1px dashed var(--border)",borderRadius:10,padding:"2.5rem 1.5rem",textAlign:"center",color:"var(--muted-foreground)",fontSize:13},children:[(0,s.jsx)(i.A,{size:28,style:{margin:"0 auto 10px",opacity:.3}}),(0,s.jsxs)("p",{className:"font-display",style:{fontSize:12},children:["No other files link to ",(0,s.jsx)("strong",{style:{color:"var(--foreground)"},children:c(e)})," yet."]})]}):(0,s.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:10},children:h.map(({filePath:e,snippets:r})=>{let n,a=c(e),d=(n=e.split("/")).length>1?n.slice(0,-1).join("/"):"";return(0,s.jsxs)("div",{style:{background:"var(--card)",border:"1px solid var(--border)",borderRadius:10,overflow:"hidden",cursor:"pointer",transition:"border-color .15s"},onClick:()=>t.push("/view/"+(0,l.O0)(e)),onMouseEnter:e=>e.currentTarget.style.borderColor="rgba(200,135,58,0.4)",onMouseLeave:e=>e.currentTarget.style.borderColor="var(--border)",children:[(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"10px 14px",borderBottom:r.length>0?"1px solid var(--border)":"none",background:"var(--muted)"},children:[(0,s.jsx)(i.A,{size:13,style:{color:"var(--muted-foreground)",flexShrink:0}}),(0,s.jsx)("span",{style:{fontWeight:600,fontSize:"0.85rem",color:"var(--foreground)",flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a}),d&&(0,s.jsx)("span",{className:"font-display",style:{fontSize:"0.68rem",color:"var(--muted-foreground)",opacity:.6,flexShrink:0},children:d}),(0,s.jsx)(o.A,{size:11,style:{color:"var(--muted-foreground)",opacity:.5,flexShrink:0}})]}),r.map((e,t)=>(0,s.jsx)("div",{style:{padding:"8px 14px",borderBottom:t<r.length-1?"1px solid var(--border)":"none",background:"var(--background)"},children:e.split("\n").map((e,t)=>(0,s.jsx)("div",{className:"font-display",style:{fontSize:"0.72rem",color:"var(--muted-foreground)",lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:(0,s.jsx)(u,{text:e})},t))},t))]},e)})})]})}},91459:(e,t,r)=>{"use strict";r.d(t,{TooltipProvider:()=>a});var s=r(95155),n=r(32727);function a({delay:e=0,...t}){return(0,s.jsx)(n.B,{"data-slot":"tooltip-provider",delay:e,...t})}},92306:(e,t,r)=>{"use strict";r.r(t),r.d(t,{CsvRenderer:()=>z});var s=r(95155),n=r(12115),a=r(18837),i=r(37595),o=r(8434),l=r(1164),d=r(59386),c=r.n(d);function u(e,t){return c().unparse([e,...t])}let m=[{bg:"rgba(200,135,58,0.12)",text:"var(--amber)"},{bg:"rgba(122,173,128,0.12)",text:"var(--success)"},{bg:"rgba(138,180,216,0.12)",text:"#8ab4d8"},{bg:"rgba(200,160,216,0.12)",text:"#c8a0d8"},{bg:"rgba(200,96,96,0.12)",text:"#c86060"},{bg:"rgba(150,150,150,0.12)",text:"var(--muted-foreground)"}];function x(e){let t=0;for(let r=0;r<e.length;r++)t=31*t+e.charCodeAt(r)&65535;return m[t%m.length]}var p=r(77148),h=r(9921),f=r(66088),g=r(68459),b=r(51914);function v({value:e,onCommit:t}){let[r,a]=(0,n.useState)(!1),[i,o]=(0,n.useState)(e),l=(0,n.useRef)(null);function d(){a(!1),i!==e?t(i):o(e)}return((0,n.useEffect)(()=>{o(e)},[e]),(0,n.useEffect)(()=>{r&&l.current?.select()},[r]),r)?(0,s.jsx)("input",{ref:l,value:i,onChange:e=>o(e.target.value),onBlur:d,onKeyDown:t=>{"Enter"===t.key&&d(),"Escape"===t.key&&(o(e),a(!1))},className:"w-full bg-transparent outline-none text-sm",onClick:e=>e.stopPropagation(),style:{color:"var(--foreground)",borderBottom:"1px solid var(--amber)",minWidth:60}}):(0,s.jsx)("div",{className:"truncate text-sm cursor-text",style:{color:"var(--foreground)",minWidth:60},onClick:()=>a(!0),title:e,children:e||(0,s.jsx)("span",{style:{color:"var(--muted-foreground)",opacity:.3},children:"—"})})}function y({headers:e,visibleIndices:t,onAdd:r,onCancel:a}){let[i,o]=(0,n.useState)(()=>Array(e.length).fill(""));return(0,s.jsxs)("tr",{style:{background:"color-mix(in srgb, var(--amber) 6%, transparent)",borderTop:"1px solid var(--amber)"},children:[t.map((t,n)=>(0,s.jsx)("td",{className:"px-3 py-2",style:{borderBottom:"1px solid var(--border)"},children:(0,s.jsx)("input",{autoFocus:0===n,value:i[t],onChange:e=>{var r;return r=e.target.value,void o(e=>{let s=[...e];return s[t]=r,s})},onKeyDown:e=>{"Enter"===e.key&&r(i),"Escape"===e.key&&a()},placeholder:e[t],className:"w-full bg-transparent outline-none text-sm placeholder:opacity-30",style:{color:"var(--foreground)",borderBottom:"1px solid var(--border)"}})},t)),(0,s.jsx)("td",{className:"px-2 py-2",style:{borderBottom:"1px solid var(--border)"}})]})}function j({headers:e,rows:t,cfg:r,saveAction:a}){let[i,o]=(0,n.useState)(t),[l,d]=(0,n.useState)(!1);(0,n.useEffect)(()=>{o(t)},[t]);let c=(0,n.useMemo)(()=>e.map((e,t)=>t).filter(t=>!r.hiddenFields.includes(e[t])),[e,r.hiddenFields]),m=e.indexOf(r.sortField),x=(0,n.useMemo)(()=>{let e=[...i];return m>=0&&e.sort((e,t)=>{let s=e[m]??"",n=t[m]??"",a=parseFloat(s),i=parseFloat(n),o=isNaN(a)||isNaN(i)?s.localeCompare(n):a-i;return"asc"===r.sortDir?o:-o}),e},[i,m,r.sortDir]),p=e.indexOf(r.groupField),j=(0,n.useMemo)(()=>{if(p<0)return[{key:null,rows:x.map(e=>({row:e,orig:e}))}];let e=new Map;for(let t of x){let r=t[p]||"(empty)";e.has(r)||e.set(r,[]),e.get(r).push(t)}return[...e.entries()].map(([e,t])=>({key:e,rows:t.map(e=>({row:e,orig:e}))}))},[x,p]);async function w(t,r,s){let n=i.map(e=>e===t?e.map((e,t)=>t===r?s:e):e);o(n),await a(u(e,n))}async function N(t){let r=i.filter(e=>e!==t);o(r),await a(u(e,r))}async function k(t){let r=[...i,t];o(r),d(!1),await a(u(e,r))}let S={borderBottom:"1px solid var(--border)",fontSize:"0.72rem",letterSpacing:"0.05em",textTransform:"uppercase",color:"var(--muted-foreground)",fontWeight:600},C=0;return(0,s.jsxs)("div",{className:"rounded-xl overflow-hidden border",style:{borderColor:"var(--border)"},children:[(0,s.jsx)("div",{className:"overflow-x-auto",children:(0,s.jsxs)("table",{className:"min-w-full text-sm border-collapse",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{style:{background:"var(--muted)"},children:[c.map(t=>(0,s.jsx)("th",{className:"px-4 py-2.5 text-left whitespace-nowrap",style:S,children:(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[e[t],r.sortField===e[t]&&("asc"===r.sortDir?(0,s.jsx)(h.A,{size:10,style:{color:"var(--amber)"}}):(0,s.jsx)(f.A,{size:10,style:{color:"var(--amber)"}}))]})},t)),(0,s.jsx)("th",{className:"w-8",style:{...S,background:"var(--muted)"}})]})}),(0,s.jsxs)("tbody",{children:[j.map((e,t)=>(0,s.jsxs)(n.Fragment,{children:[null!==e.key&&(0,s.jsx)("tr",{children:(0,s.jsx)("td",{colSpan:c.length+1,className:"px-4 py-1.5",style:{background:"var(--accent)",borderBottom:"1px solid var(--border)",borderTop:"1px solid var(--border)"},children:(0,s.jsxs)("span",{className:"text-xs font-semibold font-display",style:{color:"var(--muted-foreground)"},children:[e.key," \xb7 ",e.rows.length]})})},`grp-${e.key}`),e.rows.map(({row:e,orig:t})=>{let r=C++;return(0,s.jsxs)("tr",{className:"group transition-colors",style:{background:r%2==0?"var(--background)":"var(--card)"},onMouseEnter:e=>e.currentTarget.style.background="var(--muted)",onMouseLeave:e=>e.currentTarget.style.background=r%2==0?"var(--background)":"var(--card)",children:[c.map(r=>(0,s.jsx)("td",{className:"px-4 py-2 max-w-xs",style:{borderBottom:"1px solid var(--border)"},children:(0,s.jsx)(v,{value:e[r]??"",onCommit:e=>w(t,r,e)})},r)),(0,s.jsx)("td",{className:"px-2 py-2",style:{borderBottom:"1px solid var(--border)"},children:(0,s.jsx)("button",{onClick:()=>N(t),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-destructive/10",style:{color:"var(--muted-foreground)"},children:(0,s.jsx)(g.A,{size:12})})})]},r)})]},e.key??`section-${t}`)),l&&(0,s.jsx)(y,{headers:e,visibleIndices:c,onAdd:k,onCancel:()=>d(!1)})]})]})}),(0,s.jsxs)("div",{className:"px-4 py-2 flex items-center justify-between",style:{background:"var(--muted)",borderTop:"1px solid var(--border)"},children:[(0,s.jsxs)("span",{className:"text-xs font-display",style:{color:"var(--muted-foreground)"},children:[i.length," rows \xb7 ",e.length," cols"]}),l?(0,s.jsx)("button",{onClick:()=>d(!1),className:"text-xs px-2.5 py-1 rounded-md",style:{color:"var(--muted-foreground)"},children:"Cancel"}):(0,s.jsxs)("button",{onClick:()=>d(!0),className:"flex items-center gap-1 text-xs px-2.5 py-1 rounded-md",style:{color:"var(--amber)",background:"var(--amber-dim)"},children:[(0,s.jsx)(b.A,{size:12})," Add row"]})]})]})}function w({headers:e,rows:t,cfg:r}){let n=e.indexOf(r.titleField),a=e.indexOf(r.descField),i=e.indexOf(r.tagField);return(0,s.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:t.map((t,r)=>{let o=n>=0?t[n]:t[0]??"",l=a>=0?t[a]:"",d=i>=0?t[i]:"",c=d?x(d):null;return(0,s.jsxs)("div",{className:"rounded-xl border p-4 flex flex-col gap-2 hover:bg-muted/50 transition-colors",style:{borderColor:"var(--border)",background:"var(--card)"},children:[d&&c&&(0,s.jsx)("span",{className:"self-start text-xs px-2 py-0.5 rounded-full font-medium",style:{background:c.bg,color:c.text},children:d}),(0,s.jsx)("p",{className:"text-sm font-semibold leading-snug",style:{color:"var(--foreground)"},children:o}),l&&(0,s.jsx)("p",{className:"text-xs leading-relaxed line-clamp-3",style:{color:"var(--muted-foreground)"},children:l}),(0,s.jsx)("div",{className:"mt-1 flex flex-col gap-0.5",children:e.map((e,r)=>{if(r===n||r===a||r===i)return null;let o=t[r];return o?(0,s.jsxs)("div",{className:"flex items-baseline gap-1.5 text-xs",children:[(0,s.jsx)("span",{className:"font-display",style:{color:"var(--muted-foreground)",opacity:.6,fontSize:"0.68rem"},children:e}),(0,s.jsx)("span",{className:"truncate",style:{color:"var(--muted-foreground)"},children:o})]},r):null})})]},r)})})}function N({headers:e,rows:t,cfg:r,saveAction:a}){let[i,o]=(0,n.useState)(t),[l,d]=(0,n.useState)(null),[c,m]=(0,n.useState)(""),[p,h]=(0,n.useState)(!1);(0,n.useEffect)(()=>{o(t)},[t]);let f=e.indexOf(r.groupField),g=e.indexOf(r.titleField),v=e.indexOf(r.descField),{groups:y,groupKeys:j}=(0,n.useMemo)(()=>{let e=new Map;return i.forEach((t,r)=>{let s=(f>=0?t[f]:"")||"(empty)";e.has(s)||e.set(s,[]),e.get(s).push({row:t,origIdx:r})}),{groups:e,groupKeys:[...e.keys()]}},[i,f]);async function w(t,r){let s=i.map((e,s)=>{if(s!==t)return e;let n=[...e];return f>=0&&(n[f]=r),n});o(s),await a(u(e,s))}function N({group:t}){let r=y.get(t)??[],n=x(t),a=l===t;return(0,s.jsxs)("div",{className:"flex-shrink-0 w-64 flex flex-col gap-2",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 px-1 py-1.5",children:[(0,s.jsx)("span",{className:"w-2.5 h-2.5 rounded-full shrink-0",style:{background:n.text}}),(0,s.jsx)("span",{className:"text-xs font-semibold uppercase tracking-wider truncate font-display",style:{color:n.text},children:t}),(0,s.jsx)("span",{className:"text-xs ml-auto shrink-0",style:{color:"var(--muted-foreground)",opacity:.5},children:r.length})]}),(0,s.jsxs)("div",{className:"flex flex-col gap-2 rounded-xl p-1.5 min-h-[80px] transition-colors",style:{background:a?"var(--amber-dim)":"var(--muted)",border:`1px solid ${a?"var(--amber)":"transparent"}`},onDragOver:e=>{e.preventDefault(),d(t)},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||d(null)},onDrop:e=>{d(null);let r=parseInt(e.dataTransfer.getData("origIdx"));isNaN(r)||w(r,t)},children:[r.map(({row:t,origIdx:r})=>{let n=g>=0?t[g]:t[0]??"",a=v>=0?t[v]:"";return(0,s.jsxs)("div",{draggable:!0,onDragStart:e=>{e.dataTransfer.setData("origIdx",String(r)),d(null)},onDragEnd:()=>d(null),className:"rounded-lg border p-3 flex flex-col gap-1.5 cursor-grab active:cursor-grabbing hover:bg-muted/50 transition-colors",style:{borderColor:"var(--border)",background:"var(--card)"},children:[(0,s.jsx)("p",{className:"text-sm font-medium leading-snug",style:{color:"var(--foreground)"},children:n}),a&&(0,s.jsx)("p",{className:"text-xs leading-relaxed line-clamp-2",style:{color:"var(--muted-foreground)"},children:a}),(0,s.jsx)("div",{className:"flex flex-wrap gap-1 mt-0.5",children:e.map((e,r)=>{if(r===f||r===g||r===v)return null;let n=t[r];return n?(0,s.jsxs)("span",{className:"text-2xs px-1.5 py-0.5 rounded font-display",style:{background:"var(--muted)",color:"var(--muted-foreground)"},children:[e,": ",n]},r):null})})]},r)}),0===r.length&&(0,s.jsx)("div",{className:"flex items-center justify-center h-12",children:(0,s.jsx)("span",{className:"text-xs",style:{color:"var(--muted-foreground)",opacity:.4},children:"Drop here"})})]})]})}return(0,s.jsxs)("div",{className:"flex gap-3 overflow-x-auto pb-3 items-start",children:[j.map(e=>(0,s.jsx)(N,{group:e},e)),(0,s.jsx)("div",{className:"flex-shrink-0 w-64",children:p?(0,s.jsxs)("div",{className:"rounded-xl border p-3 flex flex-col gap-2",style:{borderColor:"var(--border)",background:"var(--card)"},children:[(0,s.jsx)("input",{autoFocus:!0,value:c,onChange:e=>m(e.target.value),onKeyDown:e=>{"Enter"===e.key&&c.trim()&&(m(""),h(!1)),"Escape"===e.key&&(m(""),h(!1))},placeholder:"Column name…",className:"text-xs bg-transparent outline-none w-full font-display",style:{color:"var(--foreground)",borderBottom:"1px solid var(--amber)"}}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)("button",{onClick:()=>{m(""),h(!1)},className:"text-xs px-2 py-1 rounded font-display",style:{background:"var(--amber)",color:"var(--amber-foreground)"},children:"Create"}),(0,s.jsx)("button",{onClick:()=>{m(""),h(!1)},className:"text-xs px-2 py-1 rounded font-display",style:{color:"var(--muted-foreground)"},children:"Cancel"})]})]}):(0,s.jsxs)("button",{onClick:()=>h(!0),className:"flex items-center gap-1.5 text-xs px-3 py-2 rounded-xl border border-dashed w-full transition-colors hover:bg-muted font-display",style:{borderColor:"var(--border)",color:"var(--muted-foreground)"},children:[(0,s.jsx)(b.A,{size:12})," Add column"]})})]})}var k=r(33210),S=r(27996);function C({headers:e,cfg:t,view:r,onClose:n,onChange:a}){let i={color:"var(--muted-foreground)",fontSize:"0.72rem"};function o({label:t,value:r,onChange:n}){return(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,s.jsx)("span",{className:"font-display",style:i,children:t}),(0,s.jsx)(S.A,{value:r,onChange:n,size:"sm",options:[{value:"",label:"— none —"},...e.map(e=>({value:e,label:e}))]})]})}return(0,s.jsxs)("div",{className:"absolute right-0 top-10 z-20 w-72 rounded-xl border shadow-xl p-4 flex flex-col gap-3",style:{background:"var(--card)",borderColor:"var(--border)"},children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("span",{className:"text-xs font-semibold uppercase tracking-wider",style:i,children:[r," settings"]}),(0,s.jsx)("button",{onClick:n,style:{color:"var(--muted-foreground)"},children:(0,s.jsx)(k.A,{size:13})})]}),"table"===r&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"h-px",style:{background:"var(--border)"}}),(0,s.jsx)("p",{className:"text-xs font-semibold uppercase tracking-wider",style:i,children:"Sort"}),(0,s.jsx)(o,{label:"Sort by",value:t.table.sortField,onChange:e=>a({...t,table:{...t.table,sortField:e}})}),(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,s.jsx)("span",{style:i,children:"Direction"}),(0,s.jsx)("div",{className:"flex rounded overflow-hidden border",style:{borderColor:"var(--border)"},children:["asc","desc"].map(e=>(0,s.jsx)("button",{onClick:()=>a({...t,table:{...t.table,sortDir:e}}),className:"px-3 py-1 text-xs transition-colors font-display",style:{fontSize:"0.72rem",background:t.table.sortDir===e?"var(--amber)":"var(--background)",color:t.table.sortDir===e?"var(--amber-foreground)":"var(--muted-foreground)"},children:e},e))})]}),(0,s.jsx)("div",{className:"h-px",style:{background:"var(--border)"}}),(0,s.jsx)("p",{className:"text-xs font-semibold uppercase tracking-wider",style:i,children:"Group"}),(0,s.jsx)(o,{label:"Group by",value:t.table.groupField,onChange:e=>a({...t,table:{...t.table,groupField:e}})}),(0,s.jsx)("div",{className:"h-px",style:{background:"var(--border)"}}),(0,s.jsx)("p",{className:"text-xs font-semibold uppercase tracking-wider",style:i,children:"Columns"}),(0,s.jsx)("div",{className:"flex flex-col gap-1.5",children:e.map(e=>{let r=t.table.hiddenFields.includes(e);return(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("span",{style:i,children:e}),(0,s.jsx)("button",{onClick:()=>{let s=r?t.table.hiddenFields.filter(t=>t!==e):[...t.table.hiddenFields,e];a({...t,table:{...t.table,hiddenFields:s}})},className:"text-xs px-2 py-0.5 rounded transition-colors font-display",style:{background:r?"var(--muted)":"var(--amber-dim)",color:r?"var(--muted-foreground)":"var(--amber)"},children:r?"Hidden":"Visible"})]},e)})})]}),"gallery"===r&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(o,{label:"Title",value:t.gallery.titleField,onChange:e=>a({...t,gallery:{...t.gallery,titleField:e}})}),(0,s.jsx)(o,{label:"Description",value:t.gallery.descField,onChange:e=>a({...t,gallery:{...t.gallery,descField:e}})}),(0,s.jsx)(o,{label:"Tag / Badge",value:t.gallery.tagField,onChange:e=>a({...t,gallery:{...t.gallery,tagField:e}})})]}),"board"===r&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(o,{label:"Group by",value:t.board.groupField,onChange:e=>a({...t,board:{...t.board,groupField:e}})}),(0,s.jsx)(o,{label:"Card title",value:t.board.titleField,onChange:e=>a({...t,board:{...t.board,titleField:e}})}),(0,s.jsx)(o,{label:"Card desc",value:t.board.descField,onChange:e=>a({...t,board:{...t.board,descField:e}})})]})]})}let A=[{id:"table",icon:(0,s.jsx)(a.A,{size:13}),label:"Table"},{id:"gallery",icon:(0,s.jsx)(i.A,{size:13}),label:"Gallery"},{id:"board",icon:(0,s.jsx)(o.A,{size:13}),label:"Board"}];function z({filePath:e,content:t,saveAction:r}){let{headers:a,rows:i}=(0,n.useMemo)(()=>{let e;return{headers:(e=c().parse(t,{skipEmptyLines:!0}).data)[0]??[],rows:e.slice(1)}},[t]),o=(0,n.useMemo)(()=>({activeView:"table",table:{sortField:"",sortDir:"asc",groupField:"",hiddenFields:[]},gallery:{titleField:a[0]??"",descField:a[1]??"",tagField:a[2]??""},board:{groupField:a[a.length-1]??"",titleField:a[0]??"",descField:a[1]??""}}),[a]),[d,u]=(0,p.Un)("csv",e,o),[m,x]=(0,n.useState)(!1),h=(0,n.useCallback)(e=>{u(e)},[u]),f=d.activeView;return(0,s.jsxs)("div",{className:"w-full py-2",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-4 relative",children:[(0,s.jsx)("div",{className:"flex items-center gap-0.5 p-1 rounded-lg",style:{background:"var(--muted)"},children:A.map(e=>(0,s.jsxs)("button",{onClick:()=>h({...d,activeView:e.id}),className:"flex items-center gap-1.5 px-3 py-1.5 rounded text-xs font-medium transition-colors font-display",style:{background:f===e.id?"var(--card)":"transparent",color:f===e.id?"var(--foreground)":"var(--muted-foreground)",boxShadow:f===e.id?"0 1px 3px rgba(0,0,0,0.1)":"none"},children:[e.icon,e.label]},e.id))}),(0,s.jsx)("div",{className:"flex-1"}),(0,s.jsxs)("span",{className:"text-xs font-display",style:{color:"var(--muted-foreground)",opacity:.5},children:[i.length," rows"]}),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("button",{onClick:()=>x(e=>!e),className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-xs transition-colors",style:{background:m?"var(--accent)":"var(--muted)",color:m?"var(--foreground)":"var(--muted-foreground)"},title:"View settings",children:(0,s.jsx)(l.A,{size:13})}),m&&(0,s.jsx)(C,{headers:a,cfg:d,view:f,onClose:()=>x(!1),onChange:h})]})]}),"table"===f&&(0,s.jsx)(j,{headers:a,rows:i,cfg:d.table,saveAction:r}),"gallery"===f&&(0,s.jsx)(w,{headers:a,rows:i,cfg:d.gallery}),"board"===f&&(0,s.jsx)(N,{headers:a,rows:i,cfg:d.board,saveAction:r})]})}},92524:(e,t,r)=>{"use strict";r.d(t,{default:()=>n});var s=r(12115);function n(){return(0,s.useEffect)(()=>{!("u">typeof navigator&&/electron/i.test(navigator.userAgent))&&"serviceWorker"in navigator&&navigator.serviceWorker.register("/sw.js").catch(e=>{console.warn("[SW] Registration failed:",e)})},[]),null}},92950:(e,t,r)=>{"use strict";r.r(t),r.d(t,{GraphRenderer:()=>c});var s=r(95155),n=r(12115),a=r(73321),i=r(81750),o=r(61278);r(53255);var l=r(22356);let d=(0,n.memo)(function({data:e}){let t=(0,a.useRouter)(),{label:r,id:l,isCurrent:d,isOrphan:c,size:u=1}=e,m=(0,n.useCallback)(()=>{let e=l.split("/").map(encodeURIComponent).join("/");t.push("/view/"+e)},[l,t]),x=.8+Math.min(.1*u,1.2);return(0,s.jsxs)("div",{onClick:m,title:l,className:"group font-display",style:{fontSize:10*x,padding:`${4*x}px ${12*x}px`,borderRadius:999,cursor:"pointer",userSelect:"none",whiteSpace:"nowrap",maxWidth:240,overflow:"hidden",textOverflow:"ellipsis",opacity:c?.4:1,background:d?"var(--amber)":"var(--card)",color:d?"var(--amber-foreground)":"var(--foreground)",border:`1.5px solid ${d?"var(--amber)":"var(--border)"}`,boxShadow:d?"0 0 20px var(--amber-dim), 0 0 0 2px var(--amber-dim)":"0 2px 4px rgba(0,0,0,0.1)",transition:"all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",zIndex:d?10:1},onMouseEnter:e=>{d||(e.currentTarget.style.borderColor="var(--amber)",e.currentTarget.style.background="var(--accent)")},onMouseLeave:e=>{d||(e.currentTarget.style.borderColor="var(--border)",e.currentTarget.style.background="var(--card)")},children:[(0,s.jsx)(i.h7,{type:"target",position:o.yX.Top,style:{opacity:0}}),r,(0,s.jsx)(i.h7,{type:"source",position:o.yX.Bottom,style:{opacity:0}})]})});function c({filePath:e}){let[t,r]=(0,n.useState)(null),[a,o]=(0,n.useState)(!0),[c,u]=(0,n.useState)("local"),[m,x]=(0,n.useState)(!1);(0,n.useEffect)(()=>{x(!0)},[]),(0,n.useEffect)(()=>{(0,l.n)("/api/graph").then(e=>{r(e),o(!1)}).catch(()=>o(!1))},[]);let p=(0,n.useMemo)(()=>{if(!t)return new Map;let e=new Map;for(let r of t.edges)e.set(r.source,(e.get(r.source)||0)+1),e.set(r.target,(e.get(r.target)||0)+1);return e},[t]),h=(0,n.useMemo)(()=>{if(!t)return null;let e=new Map;for(let r of t.edges)e.has(r.source)||e.set(r.source,new Set),e.has(r.target)||e.set(r.target,new Set),e.get(r.source).add(r.target),e.get(r.target).add(r.source);return e},[t]),{filteredNodes:f,filteredEdges:g}=(0,n.useMemo)(()=>{let r,s;if(!t)return{filteredNodes:[],filteredEdges:[]};if("global"===c)r=t.nodes,s=t.edges;else{let n=new Set,a=[{id:e,depth:0}];for(n.add(e);a.length>0;){let{id:e,depth:t}=a.shift();if(!(t>=2))for(let r of h?.get(e)??new Set)n.has(r)||(n.add(r),a.push({id:r,depth:t+1}))}let i=new Set((r=t.nodes.filter(e=>n.has(e.id))).map(e=>e.id));s=t.edges.filter(e=>i.has(e.source)&&i.has(e.target))}return{filteredNodes:r,filteredEdges:s}},[t,c,e,h]),b=(0,n.useMemo)(()=>{let e=new Set;for(let t of g)e.add(t.source),e.add(t.target);return e},[g]),{rfNodes:v,rfEdges:y}=(0,n.useMemo)(()=>{if(0===f.length)return{rfNodes:[],rfEdges:[]};let t=function(e,t,r){let s=e.length;if(0===s)return{};let n=(void 0)??(s>100?80:150),a=.6*Math.sqrt(108e4/Math.max(s,1)),i={};e.forEach((e,t)=>{let r=2*Math.PI*t/s,n=360*Math.random();i[e]={x:600+Math.cos(r)*n,y:450+Math.sin(r)*n}});let o={};for(let r=0;r<n;r++){let l=120*(1-r/n);for(let t of e)o[t]={x:0,y:0};for(let t=0;t<s;t++)for(let r=t+1;r<s;r++){let s=e[t],n=e[r],l=i[s].x-i[n].x,d=i[s].y-i[n].y,c=Math.sqrt(l*l+d*d||.01),u=a*a/c;o[s].x+=l/c*u,o[s].y+=d/c*u,o[n].x-=l/c*u,o[n].y-=d/c*u}for(let e of t){let t=e.source,r=e.target;if(!i[t]||!i[r])continue;let s=i[t].x-i[r].x,n=i[t].y-i[r].y,l=Math.sqrt(s*s+n*n||.01),d=l*l/a;o[t].x-=s/l*d,o[t].y-=n/l*d,o[r].x+=s/l*d,o[r].y+=n/l*d}for(let t of e){let e=i[t].x-600,r=i[t].y-450,s=Math.sqrt(e*e+r*r)||.01,n=.05*s;o[t].x-=e/s*n,o[t].y-=r/s*n}for(let t of e){let e=o[t],r=Math.sqrt(e.x*e.x+e.y*e.y)||.01;i[t].x+=e.x/r*Math.min(r,l),i[t].y+=e.y/r*Math.min(r,l),i[t].x=Math.max(0,Math.min(1200,i[t].x)),i[t].y=Math.max(0,Math.min(900,i[t].y))}}return i}(f.map(e=>e.id),g);return{rfNodes:f.map(r=>({id:r.id,type:"wiki",position:t[r.id]??{x:0,y:0},data:{label:r.label,id:r.id,isCurrent:r.id===e,isOrphan:!b.has(r.id),size:p.get(r.id)||1}})),rfEdges:g.map((t,r)=>{let s=t.source===e||t.target===e;return{id:`e-${r}`,source:t.source,target:t.target,type:"default",markerEnd:{type:"arrowclosed",color:s?"var(--amber)":"var(--border)"},style:{stroke:s?"var(--amber)":"var(--border)",strokeWidth:s?1.5:1,opacity:s?.8:.4},animated:s}})}},[f,g,e,b,p]),j=(0,n.useMemo)(()=>({wiki:d}),[]);return!m||a?(0,s.jsx)("div",{style:{width:"100%",height:"calc(100vh - 160px)",minHeight:400,borderRadius:12,background:"var(--muted)",border:"1px solid var(--border)",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,s.jsx)("span",{className:"font-display",style:{color:"var(--muted-foreground)",fontSize:12},children:a?"Building graph…":"Loading…"})}):(0,s.jsxs)("div",{style:{width:"100%",position:"relative",zIndex:0},children:[(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:12,marginBottom:10,flexWrap:"wrap"},children:[(0,s.jsxs)("span",{className:"font-display",style:{fontSize:11,color:"var(--muted-foreground)"},children:[f.length," nodes \xb7 ",g.length," edges"]}),(0,s.jsx)("div",{style:{display:"flex",gap:2,padding:3,borderRadius:8,background:"var(--muted)"},children:[{id:"local",label:"Local"},{id:"global",label:"Global"}].map(e=>(0,s.jsx)("button",{onClick:()=>u(e.id),className:"font-display",style:{padding:"3px 12px",borderRadius:5,fontSize:11,cursor:"pointer",border:"none",outline:"none",background:c===e.id?"var(--card)":"transparent",color:c===e.id?"var(--foreground)":"var(--muted-foreground)",boxShadow:c===e.id?"0 1px 3px rgba(0,0,0,0.1)":"none",transition:"all 0.1s"},children:e.label},e.id))})]}),(0,s.jsx)("div",{style:{width:"100%",height:"calc(100vh - 160px)",minHeight:400},children:(0,s.jsxs)(i.Gc,{nodes:v,edges:y,nodeTypes:j,fitView:!0,fitViewOptions:{padding:.15},proOptions:{hideAttribution:!0},style:{background:"var(--background)",borderRadius:12,border:"1px solid var(--border)"},children:[(0,s.jsx)(i.VS,{color:"var(--border)",gap:24,size:1,variant:i._5.Dots}),(0,s.jsx)(i.H2,{showInteractive:!1}),(0,s.jsx)(i.of,{nodeColor:e=>e.data?.isCurrent?"var(--amber)":"var(--muted-foreground)"})]})})]})}},93042:(e,t,r)=>{"use strict";r.d(t,{default:()=>i});var s=r(12115),n=r(35581),a=r(28380);function i({ssrLocale:e}){let t=(0,s.useRef)(!1);return t.current||(t.current=!0,n.D.getState().locale!==e&&n.D.setState({locale:e,t:a.D[e]})),(0,s.useEffect)(()=>n.D.getState()._init(e),[e]),null}},98959:(e,t,r)=>{"use strict";r.d(t,{default:()=>d});var s=r(95155),n=r(12115),a=r(33210),i=r(35581);let o="mindos_update_skip_desktop",l="mindos_update_skip_core";function d(){let{t:e}=(0,i.Y)(),t=e.settings.update.updateToast,[r,d]=(0,n.useState)("hidden"),[c,u]=(0,n.useState)({}),m=(0,n.useRef)(null),[x,p]=(0,n.useState)(!1),h=(0,n.useRef)(new Set),f=(0,n.useRef)({}),g=(0,n.useCallback)(()=>{h.current.forEach(clearTimeout),h.current.clear()},[]),b=(0,n.useCallback)((e,t)=>{let r=setTimeout(()=>{h.current.delete(r),d(e)},t);h.current.add(r)},[]);(0,n.useEffect)(()=>{let e,t=(e=window,e.mindos?.checkUpdate?e.mindos:null);m.current=t,p(!!t)},[]),(0,n.useEffect)(()=>{let e=m.current;if(!e)return;g();let t=[],r=(e,t,r)=>{let s=localStorage.getItem(r);s&&!function(e,t){let r=e.split(".").map(Number),s=t.split(".").map(Number);for(let e=0;e<Math.max(r.length,s.length);e++){let t=r[e]??0,n=s[e]??0;if(t>n)return!0;if(t<n)break}return!1}(t,s)||f.current[e]!==t&&(f.current[e]=t,u(r=>({...r,[e]:{type:e,version:t}})),b("visible",1e4))};return e.onUpdateAvailable&&t.push(e.onUpdateAvailable(e=>{e?.version&&r("desktop",e.version,o)})),e.onCoreUpdateAvailable&&t.push(e.onCoreUpdateAvailable(e=>{e?.latest&&!e.ready&&r("core",e.latest,l)})),()=>{t.forEach(e=>e()),g()}},[x,g,b]),(0,n.useEffect)(()=>()=>g(),[g]);let v=(0,n.useCallback)(()=>{g(),window.dispatchEvent(new CustomEvent("mindos:open-settings",{detail:{tab:"update"}})),d("dismissing"),b("hidden",200)},[g,b]),y=(0,n.useCallback)(()=>{g(),c.desktop&&localStorage.setItem(o,c.desktop.version),c.core&&localStorage.setItem(l,c.core.version),d("dismissing"),b("hidden",200)},[c,g,b]);if(!x||"hidden"===r)return null;let j=!!(c.desktop&&c.core),w=j?t.titleMultiple:c.desktop?t.titleSingle(t.desktopLabel,c.desktop.version):c.core?t.titleSingle(t.coreLabel,c.core.version):"",N=j?`${t.desktopLabel} v${c.desktop.version} \u00B7 ${t.coreLabel} v${c.core.version}`:"";return(0,s.jsx)("div",{role:"status","aria-live":"polite",className:`
|
|
130
130
|
fixed bottom-14 right-4 z-40 pointer-events-none
|
|
131
131
|
transition-all duration-200
|
|
132
132
|
${"visible"===r?"opacity-100 translate-y-0":"opacity-0 translate-y-2"}
|
|
133
|
-
`,children:(0,s.jsxs)("div",{className:"pointer-events-auto flex flex-col gap-2.5 bg-card border border-border rounded-xl shadow-lg px-4 py-3 w-[290px]",children:[(0,s.jsxs)("div",{className:"flex items-start gap-2",children:[(0,s.jsx)("span",{className:"mt-[5px] w-2 h-2 rounded-full bg-[var(--amber)] shrink-0"}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("p",{className:"text-sm font-medium text-foreground leading-snug",children:w}),N&&(0,s.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:N})]}),(0,s.jsx)("button",{type:"button",onClick:y,className:"shrink-0 p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring","aria-label":"Dismiss",children:(0,s.jsx)(a.A,{size:13})})]}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)("button",{type:"button",onClick:v,className:"flex-1 px-3 py-1.5 text-xs font-medium rounded-lg text-[var(--amber-foreground)] bg-[var(--amber)] hover:opacity-90 transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:t.viewDetails}),(0,s.jsx)("button",{type:"button",onClick:y,className:"flex-1 px-3 py-1.5 text-xs rounded-lg text-muted-foreground border border-border hover:text-foreground hover:bg-muted transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:j?t.skipAll:t.skipVersion})]})]})})}}},e=>{e.O(0,[7513,3295,4913,3862,4237,8409,9748,7540,
|
|
133
|
+
`,children:(0,s.jsxs)("div",{className:"pointer-events-auto flex flex-col gap-2.5 bg-card border border-border rounded-xl shadow-lg px-4 py-3 w-[290px]",children:[(0,s.jsxs)("div",{className:"flex items-start gap-2",children:[(0,s.jsx)("span",{className:"mt-[5px] w-2 h-2 rounded-full bg-[var(--amber)] shrink-0"}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("p",{className:"text-sm font-medium text-foreground leading-snug",children:w}),N&&(0,s.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:N})]}),(0,s.jsx)("button",{type:"button",onClick:y,className:"shrink-0 p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring","aria-label":"Dismiss",children:(0,s.jsx)(a.A,{size:13})})]}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)("button",{type:"button",onClick:v,className:"flex-1 px-3 py-1.5 text-xs font-medium rounded-lg text-[var(--amber-foreground)] bg-[var(--amber)] hover:opacity-90 transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:t.viewDetails}),(0,s.jsx)("button",{type:"button",onClick:y,className:"flex-1 px-3 py-1.5 text-xs rounded-lg text-muted-foreground border border-border hover:text-foreground hover:bg-muted transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:j?t.skipAll:t.skipVersion})]})]})})}}},e=>{e.O(0,[7513,3295,4913,3862,4237,8409,9748,7540,4327,2654,5592,5581,8252,6636,6902,48,7025,8441,3794,7358],()=>e(e.s=30266)),_N_E=e.O()}]);
|