agentroam-runtime-darwin-arm64 0.2.0-preview.64 → 0.2.0-preview.65
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/manifest.json +2 -2
- package/package.json +1 -1
- package/runtime/.next/BUILD_ID +1 -1
- package/runtime/.next/app-build-manifest.json +10 -10
- package/runtime/.next/app-path-routes-manifest.json +1 -1
- package/runtime/.next/build-manifest.json +3 -3
- package/runtime/.next/prerender-manifest.json +1 -1
- package/runtime/.next/required-server-files.json +1 -1
- package/runtime/.next/server/app/_not-found/page.js +1 -1
- package/runtime/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/runtime/.next/server/app/_not-found.html +1 -1
- package/runtime/.next/server/app/_not-found.rsc +1 -1
- package/runtime/.next/server/app/api/agent/abort/route.js +1 -1
- package/runtime/.next/server/app/api/agent/answer/route.js +1 -1
- package/runtime/.next/server/app/api/agent/codex-sharing/route.js +1 -1
- package/runtime/.next/server/app/api/agent/harness/status/route.js +1 -1
- package/runtime/.next/server/app/api/agent/model/route.js +1 -1
- package/runtime/.next/server/app/api/agent/models/route.js +1 -1
- package/runtime/.next/server/app/api/agent/run/route.js +2 -2
- package/runtime/.next/server/app/api/agent/runtime-health/route.js +1 -1
- package/runtime/.next/server/app/api/agent/steer/route.js +1 -1
- package/runtime/.next/server/app/api/agent/stream/route.js +3 -3
- package/runtime/.next/server/app/api/agent-workspaces/[workspaceId]/sessions/route.js +1 -1
- package/runtime/.next/server/app/api/agent-workspaces/route.js +1 -1
- package/runtime/.next/server/app/api/auth/verify/route.js +1 -1
- package/runtime/.next/server/app/api/business/route.js +1 -1
- package/runtime/.next/server/app/api/client-logs/route.js +1 -1
- package/runtime/.next/server/app/api/collaboration/route.js +1 -1
- package/runtime/.next/server/app/api/flow/v1/catalog/route.js +1 -1
- package/runtime/.next/server/app/api/flow/v1/runs/[runId]/cancel/route.js +1 -1
- package/runtime/.next/server/app/api/flow/v1/runs/[runId]/events/route.js +4 -4
- package/runtime/.next/server/app/api/flow/v1/runs/route.js +1 -1
- package/runtime/.next/server/app/api/flow-studio/config/route.js +1 -1
- package/runtime/.next/server/app/api/mcp/connect/route.js +1 -1
- package/runtime/.next/server/app/api/mcp/disconnect/route.js +1 -1
- package/runtime/.next/server/app/api/mcp/servers/route.js +1 -1
- package/runtime/.next/server/app/api/memory/[key]/route.js +1 -1
- package/runtime/.next/server/app/api/memory/route.js +1 -1
- package/runtime/.next/server/app/api/plugins/load/route.js +1 -1
- package/runtime/.next/server/app/api/projects/[id]/route.js +1 -1
- package/runtime/.next/server/app/api/projects/check/route.js +1 -1
- package/runtime/.next/server/app/api/projects/directories/route.js +1 -1
- package/runtime/.next/server/app/api/projects/roots/route.js +1 -1
- package/runtime/.next/server/app/api/projects/route.js +1 -1
- package/runtime/.next/server/app/api/push/subscribe/route.js +2 -2
- package/runtime/.next/server/app/api/push/unsubscribe/route.js +2 -2
- package/runtime/.next/server/app/api/push/vapid/route.js +2 -2
- package/runtime/.next/server/app/api/push/vapid.body +1 -1
- package/runtime/.next/server/app/api/remote-tools/register/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/changes/route.js +2 -2
- package/runtime/.next/server/app/api/sessions/[id]/fork/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/fork-at/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/goals/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/handoff/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/native-goal/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/query-index/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/release/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/thread-goal/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/tool-result/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/route.js +1 -1
- package/runtime/.next/server/app/api/settings/route.js +1 -1
- package/runtime/.next/server/app/api/skills/route.js +1 -1
- package/runtime/.next/server/app/api/tool-policies/[policyId]/route.js +1 -1
- package/runtime/.next/server/app/api/tool-policies/route.js +1 -1
- package/runtime/.next/server/app/api/tools/route.js +1 -1
- package/runtime/.next/server/app/api/update/check/route.js +1 -1
- package/runtime/.next/server/app/api/update/install/route.js +1 -1
- package/runtime/.next/server/app/api/update/status/route.js +1 -1
- package/runtime/.next/server/app/api/web-auth/login/route.js +1 -1
- package/runtime/.next/server/app/api/web-auth/logout/route.js +1 -1
- package/runtime/.next/server/app/api/web-auth/revoke-all/route.js +1 -1
- package/runtime/.next/server/app/api/web-auth/setup/route.js +1 -1
- package/runtime/.next/server/app/api/web-auth/status/route.js +1 -1
- package/runtime/.next/server/app/api/web-console/bootstrap/route.js +1 -1
- package/runtime/.next/server/app/api/web-console/computer-settings/route.js +1 -1
- package/runtime/.next/server/app/api/web-console/computers/route.js +1 -1
- package/runtime/.next/server/app/api/web-console/device-state/route.js +1 -1
- package/runtime/.next/server/app/api/web-console/history/route.js +1 -1
- package/runtime/.next/server/app/api/web-console/preferences/route.js +1 -1
- package/runtime/.next/server/app/web/page.js +4 -4
- package/runtime/.next/server/app/web/page_client-reference-manifest.js +1 -1
- package/runtime/.next/server/app-paths-manifest.json +34 -34
- package/runtime/.next/server/chunks/5303.js +1 -1
- package/runtime/.next/server/middleware-build-manifest.js +1 -1
- package/runtime/.next/server/pages/404.html +1 -1
- package/runtime/.next/server/pages/500.html +1 -1
- package/runtime/.next/server/pages-manifest.json +1 -1
- package/runtime/.next/server/server-reference-manifest.json +1 -1
- package/runtime/.next/static/chunks/216-befe93998f760830.js +1 -0
- package/runtime/.next/static/chunks/app/web/{error-4d3646f97c1344d3.js → error-17e28c153738a003.js} +1 -1
- package/runtime/.next/static/chunks/app/web/layout-60e82f81fa232177.js +1 -0
- package/runtime/.next/static/chunks/app/web/page-9d2cdb1ef9ad40b2.js +1 -0
- package/runtime/.next/static/chunks/{main-app-00dfdb2d5c09719c.js → main-app-a953e6764afe1e60.js} +1 -1
- package/runtime/.next/static/css/1c4153a5b834f93f.css +1 -0
- package/runtime/native/Support.noindex/AgentRoam Remote Desktop.app/Contents/MacOS/agentroam-remote-desktop +0 -0
- package/runtime/native/Support.noindex/AgentRoam Remote Desktop.app/Contents/Resources/agentroam-component.json +1 -1
- package/runtime/native/Support.noindex/AgentRoam Remote Desktop.app/Contents/_CodeSignature/CodeResources +2 -2
- package/runtime/node_modules/.package-lock.json +126 -126
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/bridge.mjs +73 -73
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/browser-sdk.js +32 -32
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-xpxe8nzb.mjs → core-1qw7dszx.mjs} +1 -1
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-cz9sh4ze.mjs +40 -0
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-nmrdrt5c.mjs +52 -0
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-5682eevd.mjs → core-nxm5bcfb.mjs} +2 -2
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core.mjs +8 -8
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/extractFromBunfs.js +169 -40
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/manifest.json +21 -22
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/manifest.zst.json +25 -26
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/package.json +14 -14
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs +56 -56
- package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.cjs +25 -13
- package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.min.cjs +8 -8
- package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.min.mjs +8 -8
- package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.mjs +25 -13
- package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.node.cjs +25 -13
- package/runtime/node_modules/mediabunny/dist/modules/src/isobmff/isobmff-demuxer.js +22 -11
- package/runtime/node_modules/mediabunny/dist/modules/src/matroska/matroska-demuxer.js +27 -11
- package/runtime/node_modules/mediabunny/dist/modules/src/tsconfig.tsbuildinfo +1 -1
- package/runtime/node_modules/mediabunny/dist/modules/src/version.js +1 -1
- package/runtime/node_modules/mediabunny/package.json +1 -1
- package/runtime/node_modules/mediabunny/src/isobmff/isobmff-demuxer.ts +23 -11
- package/runtime/node_modules/mediabunny/src/matroska/matroska-demuxer.ts +30 -11
- package/runtime/node_modules/mediabunny/src/version.ts +1 -1
- package/runtime/package-lock.json +159 -159
- package/runtime/server.js +1 -1
- package/runtime/webapp/dist/assets/{AiHubPane-D1SGdI6y.js → AiHubPane-Cd-7gwJs.js} +1 -1
- package/runtime/webapp/dist/assets/{App-Y_UUrP8i.js → App-DQqv62sH.js} +3 -3
- package/runtime/webapp/dist/assets/{BrowserLivePanel-CapyOwFL.js → BrowserLivePanel-DDrnghqj.js} +1 -1
- package/runtime/webapp/dist/assets/{CollaborationDashboard-CEF41i5J.js → CollaborationDashboard-qQQqXrQI.js} +1 -1
- package/runtime/webapp/dist/assets/{CollaborationPage-C8PN5oNe.js → CollaborationPage-BS3Z5dAy.js} +1 -1
- package/runtime/webapp/dist/assets/{FilePreview-BdB8syBQ.js → FilePreview-C4gxZRtw.js} +3 -3
- package/runtime/webapp/dist/assets/{FileTree-Cf8wDAVy.js → FileTree-DrpruRST.js} +1 -1
- package/runtime/webapp/dist/assets/{FlowStudioPane-DuUmV_ki.js → FlowStudioPane-BjOuLwks.js} +1 -1
- package/runtime/webapp/dist/assets/{RemoteDesktopPage-DBoSlmlh.js → RemoteDesktopPage-B1AGyJrT.js} +1 -1
- package/runtime/webapp/dist/assets/{TerminalPane-B2s2ff23.js → TerminalPane-BxEtw8rn.js} +1 -1
- package/runtime/webapp/dist/assets/{abnfDiagram-VCTEODGH-CQ78RP8v.js → abnfDiagram-VCTEODGH-BHgKdAyZ.js} +1 -1
- package/runtime/webapp/dist/assets/{arc-B4CNFgtV.js → arc-B8zNXyCl.js} +1 -1
- package/runtime/webapp/dist/assets/{architectureDiagram-5GKGNRK7-B-pYUJdJ.js → architectureDiagram-5GKGNRK7-D596eLfj.js} +1 -1
- package/runtime/webapp/dist/assets/{artifact-links-DrWFmMXT.js → artifact-links-DwSH3xn_.js} +1 -1
- package/runtime/webapp/dist/assets/{blockDiagram-I7D4REHJ-CEEpSPhh.js → blockDiagram-I7D4REHJ-C4eZ-RzC.js} +1 -1
- package/runtime/webapp/dist/assets/{c4Diagram-7LVT6UL2-Bq7l-OxC.js → c4Diagram-7LVT6UL2-Cxe44X-3.js} +1 -1
- package/runtime/webapp/dist/assets/channel-8FdPmR58.js +1 -0
- package/runtime/webapp/dist/assets/{chunk-2Q5K7J3B-B2yw0jQL.js → chunk-2Q5K7J3B-D_syaagC.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-5VM5RSS4-D7AIGjlP.js → chunk-5VM5RSS4-q_wDWTVC.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-F27PBJKO-_wNxBMaG.js → chunk-F27PBJKO-C5U_ckFK.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-IMKFNOWR-bMSiSCLu.js → chunk-IMKFNOWR-5a_rZZVM.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-JWPE2WC7-Zu8gSQip.js → chunk-JWPE2WC7-DR8znCWR.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-POPQ4Y6H-8G7L6RqL.js → chunk-POPQ4Y6H-3vOXloa3.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-SVP7TREG-a6VVTk08.js → chunk-SVP7TREG-y9Uxi4pg.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-TICWLB2K-ddeHMudM.js → chunk-TICWLB2K-Bi7VvqOR.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-XXDRQBXY-DSuvta0Q.js → chunk-XXDRQBXY-CRpw-5Cj.js} +1 -1
- package/runtime/webapp/dist/assets/classDiagram-ZZMXUADV-CCHBpIvI.js +1 -0
- package/runtime/webapp/dist/assets/classDiagram-v2-VYDZK3BY-CCHBpIvI.js +1 -0
- package/runtime/webapp/dist/assets/{clipboard-DS4Pu9OB.js → clipboard-BKglnESD.js} +1 -1
- package/runtime/webapp/dist/assets/{codeSyntax-BWSPpoSH.js → codeSyntax-Dmbrlor0.js} +1 -1
- package/runtime/webapp/dist/assets/{collaboration-D7MlFa87.js → collaboration-BZSnjFZ-.js} +1 -1
- package/runtime/webapp/dist/assets/{cose-bilkent-JH36ORCC-D1TkGbTC.js → cose-bilkent-JH36ORCC-4JQKrvR5.js} +1 -1
- package/runtime/webapp/dist/assets/{cynefin-OW5HDTMX-CYPV2qwK.js → cynefin-OW5HDTMX-BO4eLWHY.js} +1 -1
- package/runtime/webapp/dist/assets/{cynefinDiagram-5FMLGOSQ-DH8spH6U.js → cynefinDiagram-5FMLGOSQ-Dg-Bt9fs.js} +1 -1
- package/runtime/webapp/dist/assets/{dagre-GXQ25YYZ-Dkv69aQ5.js → dagre-GXQ25YYZ-utMMpYq0.js} +1 -1
- package/runtime/webapp/dist/assets/{diagram-S7CK7UJ4-Gl094s_z.js → diagram-S7CK7UJ4-BUzOnotG.js} +1 -1
- package/runtime/webapp/dist/assets/{diagram-UQ7AKVKN-DKzCe2K6.js → diagram-UQ7AKVKN-Bkesml6e.js} +1 -1
- package/runtime/webapp/dist/assets/{diagram-VSXAHHWV-Dq1LtLSa.js → diagram-VSXAHHWV-P-Qqxnpn.js} +1 -1
- package/runtime/webapp/dist/assets/{diagram-VX7I27RA-CN9QKehv.js → diagram-VX7I27RA-xpyBMRkH.js} +1 -1
- package/runtime/webapp/dist/assets/{diagram-Z3DM3KII-1J67VxEA.js → diagram-Z3DM3KII-FMNqO2NJ.js} +1 -1
- package/runtime/webapp/dist/assets/{ebnfDiagram-PWID7BFC-CRyJYtkK.js → ebnfDiagram-PWID7BFC-D8-cmvEK.js} +1 -1
- package/runtime/webapp/dist/assets/{erDiagram-RLTQ6QDP-C0jVGZ7x.js → erDiagram-RLTQ6QDP-mEgSpGUN.js} +1 -1
- package/runtime/webapp/dist/assets/{file-types-Bi7YTERW.js → file-types-DgQXHGm7.js} +1 -1
- package/runtime/webapp/dist/assets/{flowDiagram-HODETNUW-wm5Kefw0.js → flowDiagram-HODETNUW-DJWXgpoo.js} +1 -1
- package/runtime/webapp/dist/assets/{ganttDiagram-EL5Y4UJY-DN5F7ix3.js → ganttDiagram-EL5Y4UJY-B5HA7Xox.js} +1 -1
- package/runtime/webapp/dist/assets/{gitGraphDiagram-WWUBYQGX-DcpXNY21.js → gitGraphDiagram-WWUBYQGX-CP4Zmize.js} +1 -1
- package/runtime/webapp/dist/assets/index-BReRPZnZ.js +485 -0
- package/runtime/webapp/dist/assets/index-DfpiL3X7.css +1 -0
- package/runtime/webapp/dist/assets/{infoDiagram-27XIBGKW-B1iXrK9c.js → infoDiagram-27XIBGKW-DApDSX70.js} +1 -1
- package/runtime/webapp/dist/assets/{ishikawaDiagram-5VMMS53U-C1jZv655.js → ishikawaDiagram-5VMMS53U-BCYtD2Fm.js} +1 -1
- package/runtime/webapp/dist/assets/{journeyDiagram-3NMN7TZE-BRSFQ0r1.js → journeyDiagram-3NMN7TZE-D3WEyKHq.js} +1 -1
- package/runtime/webapp/dist/assets/{kanban-definition-UXKFOSKX-Cl9je8cc.js → kanban-definition-UXKFOSKX-Q6vb0ZbD.js} +1 -1
- package/runtime/webapp/dist/assets/{layout-CKkSxSc4.js → layout-Bp7cvpx1.js} +1 -1
- package/runtime/webapp/dist/assets/{linear-CC85eD8_.js → linear-4ik7NzLN.js} +1 -1
- package/runtime/webapp/dist/assets/{loader-circle-C63zcjMg.js → loader-circle-BCsj2yyN.js} +1 -1
- package/runtime/webapp/dist/assets/{mermaid.core-DIjc2ZR6.js → mermaid.core-CmhaKXiP.js} +5 -5
- package/runtime/webapp/dist/assets/{mindmap-definition-YA3MSWOX-mJUtqDVt.js → mindmap-definition-YA3MSWOX-DabuuB2q.js} +1 -1
- package/runtime/webapp/dist/assets/{page-bnT1btVj.js → page-Cgp9NEw1.js} +5 -5
- package/runtime/webapp/dist/assets/{pegDiagram-XKGWAZYB-Dt3xAyl2.js → pegDiagram-XKGWAZYB-eIBdAhCQ.js} +1 -1
- package/runtime/webapp/dist/assets/{pieDiagram-E7YTZNPT-DleFmb0m.js → pieDiagram-E7YTZNPT-DUd7f60Q.js} +1 -1
- package/runtime/webapp/dist/assets/{quadrantDiagram-AXDQQJYC-BpeD8UfU.js → quadrantDiagram-AXDQQJYC-BPSqBWPV.js} +1 -1
- package/runtime/webapp/dist/assets/{railroadDiagram-O6MQD6OU-BBQ5ixic.js → railroadDiagram-O6MQD6OU-CHqMz56-.js} +1 -1
- package/runtime/webapp/dist/assets/{requirementDiagram-BXWQKSXE-xO5TSQS3.js → requirementDiagram-BXWQKSXE-BfOzGN7B.js} +1 -1
- package/runtime/webapp/dist/assets/{rotate-ccw-AmWkL3kV.js → rotate-ccw-p76OF6j6.js} +1 -1
- package/runtime/webapp/dist/assets/{rotate-cw-DrY9cGmB.js → rotate-cw-D5iQzT0K.js} +1 -1
- package/runtime/webapp/dist/assets/{sankeyDiagram-P5KCCOFB-Fyt0-RhU.js → sankeyDiagram-P5KCCOFB-BFOPAhWl.js} +1 -1
- package/runtime/webapp/dist/assets/{send-ATfKaKHb.js → send-DdY_K1RT.js} +1 -1
- package/runtime/webapp/dist/assets/{sequenceDiagram-WJ2MYXX4-xkFumv3g.js → sequenceDiagram-WJ2MYXX4-CdQhFjho.js} +1 -1
- package/runtime/webapp/dist/assets/{sizeCapture-INFHLROL-Ch5NIy5j.js → sizeCapture-INFHLROL-BP_2bwHb.js} +1 -1
- package/runtime/webapp/dist/assets/{smartphone-BL3ONtnq.js → smartphone-C2--txxG.js} +1 -1
- package/runtime/webapp/dist/assets/{stateDiagram-D77RDMKH-BYyhiW6f.js → stateDiagram-D77RDMKH-D2_O1o9C.js} +1 -1
- package/runtime/webapp/dist/assets/stateDiagram-v2-MP3YSRHH-b3DtWIlg.js +1 -0
- package/runtime/webapp/dist/assets/{swimlanes-42K2YHIH-Da71LrsA.js → swimlanes-42K2YHIH-BwEWz-Bu.js} +1 -1
- package/runtime/webapp/dist/assets/swimlanesDiagram-VR7AAH4N-CxL0Wh2Z.js +8 -0
- package/runtime/webapp/dist/assets/{timeline-definition-24CTP7MA-BaXSS2__.js → timeline-definition-24CTP7MA-DqDB5dmr.js} +1 -1
- package/runtime/webapp/dist/assets/{trash-2-DBC-hIuM.js → trash-2-CZx0p0L3.js} +1 -1
- package/runtime/webapp/dist/assets/{vennDiagram-4TSXK5OY-D_V4cbSG.js → vennDiagram-4TSXK5OY-Cf4VnZ2O.js} +1 -1
- package/runtime/webapp/dist/assets/{wardleyDiagram-VM6X3IG4-C-31z3KF.js → wardleyDiagram-VM6X3IG4-D9FBNJOU.js} +1 -1
- package/runtime/webapp/dist/assets/{web-Co-fisS2.js → web-BVybOQy8.js} +1 -1
- package/runtime/webapp/dist/assets/{web-C3itPQLn.js → web-CT9Joona.js} +1 -1
- package/runtime/webapp/dist/assets/{x-qYJy8CK-.js → x-COYLzqlQ.js} +1 -1
- package/runtime/webapp/dist/assets/{xychartDiagram-S5SC5T6Z-DKF--ymA.js → xychartDiagram-S5SC5T6Z-BRVtPtRz.js} +1 -1
- package/runtime/webapp/dist/index.html +2 -2
- package/runtime/.next/static/chunks/344-04fd45d8838bfada.js +0 -1
- package/runtime/.next/static/chunks/app/web/layout-c8709c08fb7ad857.js +0 -1
- package/runtime/.next/static/chunks/app/web/page-b876912c109021db.js +0 -1
- package/runtime/.next/static/css/71e679260520d186.css +0 -1
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-36zyfan5.mjs +0 -52
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-nne0e2ds.mjs +0 -40
- package/runtime/webapp/dist/assets/channel-B0Az_kl0.js +0 -1
- package/runtime/webapp/dist/assets/classDiagram-ZZMXUADV-HNxe_TWF.js +0 -1
- package/runtime/webapp/dist/assets/classDiagram-v2-VYDZK3BY-HNxe_TWF.js +0 -1
- package/runtime/webapp/dist/assets/index-Ddj6oQ7t.js +0 -480
- package/runtime/webapp/dist/assets/index-hju2LxNM.css +0 -1
- package/runtime/webapp/dist/assets/stateDiagram-v2-MP3YSRHH-BbZH2Sb9.js +0 -1
- package/runtime/webapp/dist/assets/swimlanesDiagram-VR7AAH4N-CxBioyEE.js +0 -8
- /package/runtime/.next/static/{4yVGaJwabJff1LDiyzYia → nDZmrx61FQSBYCG7rH1JD}/_buildManifest.js +0 -0
- /package/runtime/.next/static/{4yVGaJwabJff1LDiyzYia → nDZmrx61FQSBYCG7rH1JD}/_ssgManifest.js +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(()=>{var e={};e.id=3541,e.ids=[3541],e.modules={1636:e=>{"use strict";e.exports=require("@agent/core")},2934:e=>{"use strict";e.exports=require("next/dist/client/components/action-async-storage.external.js")},4580:e=>{"use strict";e.exports=require("next/dist/client/components/request-async-storage.external.js")},5869:e=>{"use strict";e.exports=require("next/dist/client/components/static-generation-async-storage.external.js")},399:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},9411:e=>{"use strict";e.exports=require("node:path")},
|
|
1
|
+
(()=>{var e={};e.id=3541,e.ids=[3541],e.modules={1636:e=>{"use strict";e.exports=require("@agent/core")},2934:e=>{"use strict";e.exports=require("next/dist/client/components/action-async-storage.external.js")},4580:e=>{"use strict";e.exports=require("next/dist/client/components/request-async-storage.external.js")},5869:e=>{"use strict";e.exports=require("next/dist/client/components/static-generation-async-storage.external.js")},399:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},9411:e=>{"use strict";e.exports=require("node:path")},8084:(e,t,r)=>{"use strict";r.r(t),r.d(t,{GlobalError:()=>o.a,__next_app__:()=>f,originalPathname:()=>u,pages:()=>d,routeModule:()=>p,tree:()=>c}),r(6742),r(9257),r(489),r(4972),r(3028);var a=r(1772),i=r(5042),n=r(5663),o=r.n(n),s=r(4812),l={};for(let e in s)0>["default","tree","pages","GlobalError","originalPathname","__next_app__","routeModule"].indexOf(e)&&(l[e]=()=>s[e]);r.d(t,l);let c=["",{children:["web",{children:["__PAGE__",{},{page:[()=>Promise.resolve().then(r.bind(r,6742)),"/Users/caoqu/team-agent/release-preview65/packages/server/app/web/page.tsx"]}]},{layout:[()=>Promise.resolve().then(r.bind(r,9257)),"/Users/caoqu/team-agent/release-preview65/packages/server/app/web/layout.tsx"],error:[()=>Promise.resolve().then(r.bind(r,489)),"/Users/caoqu/team-agent/release-preview65/packages/server/app/web/error.tsx"]}]},{layout:[()=>Promise.resolve().then(r.bind(r,4972)),"/Users/caoqu/team-agent/release-preview65/packages/server/app/layout.tsx"],"not-found":[()=>Promise.resolve().then(r.t.bind(r,3028,23)),"next/dist/client/components/not-found-error"]}],d=["/Users/caoqu/team-agent/release-preview65/packages/server/app/web/page.tsx"],u="/web/page",f={require:r,loadChunk:()=>Promise.resolve()},p=new a.AppPageRouteModule({definition:{kind:i.x.APP_PAGE,page:"/web/page",pathname:"/web",bundlePath:"",filename:"",appPaths:[]},userland:{loaderTree:c}})},1629:(e,t,r)=>{Promise.resolve().then(r.t.bind(r,1782,23)),Promise.resolve().then(r.t.bind(r,8949,23)),Promise.resolve().then(r.t.bind(r,6569,23)),Promise.resolve().then(r.t.bind(r,8718,23)),Promise.resolve().then(r.t.bind(r,7415,23)),Promise.resolve().then(r.t.bind(r,8781,23))},5222:(e,t,r)=>{Promise.resolve().then(r.bind(r,8383))},3102:()=>{},9572:(e,t,r)=>{Promise.resolve().then(r.bind(r,3882))},2027:()=>{},6476:()=>{},1166:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return n}});let a=r(7094);r(3517),r(5921);let i=a._(r(4079));function n(e,t){var r;let a={loading:e=>{let{error:t,isLoading:r,pastDelay:a}=e;return null}};"function"==typeof e&&(a.loader=e);let n={...a,...t};return(0,i.default)({...n,modules:null==(r=n.loadableGenerated)?void 0:r.modules})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},1803:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"BailoutToCSR",{enumerable:!0,get:function(){return i}});let a=r(93);function i(e){let{reason:t,children:r}=e;throw new a.BailoutToCSRError(t)}},4079:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return c}});let a=r(3517),i=r(5921),n=r(1803),o=r(5259);function s(e){return{default:e&&"default"in e?e.default:e}}let l={loader:()=>Promise.resolve(s(()=>null)),loading:null,ssr:!0},c=function(e){let t={...l,...e},r=(0,i.lazy)(()=>t.loader().then(s)),c=t.loading;function d(e){let s=c?(0,a.jsx)(c,{isLoading:!0,pastDelay:!0,error:null}):null,l=t.ssr?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.PreloadCss,{moduleIds:t.modules}),(0,a.jsx)(r,{...e})]}):(0,a.jsx)(n.BailoutToCSR,{reason:"next/dynamic",children:(0,a.jsx)(r,{...e})});return(0,a.jsx)(i.Suspense,{fallback:s,children:l})}return d.displayName="LoadableComponent",d}},5259:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"PreloadCss",{enumerable:!0,get:function(){return n}});let a=r(3517),i=r(4580);function n(e){let{moduleIds:t}=e,r=(0,i.getExpectedRequestStore)("next/dynamic css"),n=[];if(r.reactLoadableManifest&&t){let e=r.reactLoadableManifest;for(let r of t){if(!e[r])continue;let t=e[r].files.filter(e=>e.endsWith(".css"));n.push(...t)}}return 0===n.length?null:(0,a.jsx)(a.Fragment,{children:n.map(e=>(0,a.jsx)("link",{precedence:"dynamic",rel:"stylesheet",href:r.assetPrefix+"/_next/"+encodeURI(e),as:"style"},e))})}},4684:(e,t,r)=>{"use strict";r(6476);var a=r(5921),i=function(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}(a),n="undefined"!=typeof process&&process.env&&!0,o=function(e){return"[object String]"===Object.prototype.toString.call(e)},s=function(){function e(e){var t=void 0===e?{}:e,r=t.name,a=void 0===r?"stylesheet":r,i=t.optimizeForSpeed,s=void 0===i?n:i;l(o(a),"`name` must be a string"),this._name=a,this._deletedRulePlaceholder="#"+a+"-deleted-rule____{}",l("boolean"==typeof s,"`optimizeForSpeed` must be a boolean"),this._optimizeForSpeed=s,this._serverSheet=void 0,this._tags=[],this._injected=!1,this._rulesCount=0,this._nonce=null}var t=e.prototype;return t.setOptimizeForSpeed=function(e){l("boolean"==typeof e,"`setOptimizeForSpeed` accepts a boolean"),l(0===this._rulesCount,"optimizeForSpeed cannot be when rules have already been inserted"),this.flush(),this._optimizeForSpeed=e,this.inject()},t.isOptimizeForSpeed=function(){return this._optimizeForSpeed},t.inject=function(){var e=this;l(!this._injected,"sheet already injected"),this._injected=!0,this._serverSheet={cssRules:[],insertRule:function(t,r){return"number"==typeof r?e._serverSheet.cssRules[r]={cssText:t}:e._serverSheet.cssRules.push({cssText:t}),r},deleteRule:function(t){e._serverSheet.cssRules[t]=null}}},t.getSheetForTag=function(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]},t.getSheet=function(){return this.getSheetForTag(this._tags[this._tags.length-1])},t.insertRule=function(e,t){return l(o(e),"`insertRule` accepts only strings"),"number"!=typeof t&&(t=this._serverSheet.cssRules.length),this._serverSheet.insertRule(e,t),this._rulesCount++},t.replaceRule=function(e,t){this._optimizeForSpeed;var r=this._serverSheet;if(t.trim()||(t=this._deletedRulePlaceholder),!r.cssRules[e])return e;r.deleteRule(e);try{r.insertRule(t,e)}catch(a){n||console.warn("StyleSheet: illegal rule: \n\n"+t+"\n\nSee https://stackoverflow.com/q/20007992 for more info"),r.insertRule(this._deletedRulePlaceholder,e)}return e},t.deleteRule=function(e){this._serverSheet.deleteRule(e)},t.flush=function(){this._injected=!1,this._rulesCount=0,this._serverSheet.cssRules=[]},t.cssRules=function(){return this._serverSheet.cssRules},t.makeStyleTag=function(e,t,r){t&&l(o(t),"makeStyleTag accepts only strings as second parameter");var a=document.createElement("style");this._nonce&&a.setAttribute("nonce",this._nonce),a.type="text/css",a.setAttribute("data-"+e,""),t&&a.appendChild(document.createTextNode(t));var i=document.head||document.getElementsByTagName("head")[0];return r?i.insertBefore(a,r):i.appendChild(a),a},function(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}(e.prototype,[{key:"length",get:function(){return this._rulesCount}}]),e}();function l(e,t){if(!e)throw Error("StyleSheet: "+t+".")}var c=function(e){for(var t=5381,r=e.length;r;)t=33*t^e.charCodeAt(--r);return t>>>0},d={};function u(e,t){if(!t)return"jsx-"+e;var r=String(t),a=e+r;return d[a]||(d[a]="jsx-"+c(e+"-"+r)),d[a]}function f(e,t){var r=e+(t=t.replace(/\/style/gi,"\\/style"));return d[r]||(d[r]=t.replace(/__jsx-style-dynamic-selector/g,e)),d[r]}var p=a.createContext(null);p.displayName="StyleSheetContext",i.default.useInsertionEffect||i.default.useLayoutEffect;var b=void 0;function m(e){var t=b||a.useContext(p);return t&&t.add(e),null}m.dynamic=function(e){return e.map(function(e){return u(e[0],e[1])}).join(" ")},t.style=m},1321:(e,t,r)=>{"use strict";e.exports=r(4684).style},8383:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>i});var a=r(3517);function i({reset:e}){return(0,a.jsxs)("main",{role:"alert",style:{padding:32,fontFamily:"system-ui",lineHeight:1.8},children:[a.jsx("h1",{children:"页面加载失败"}),a.jsx("p",{children:"请重试;如果仍无法打开,请检查网络,并确认电脑上的 AgentRoam 正在运行。"}),a.jsx("button",{type:"button",onClick:e,children:"重试"})," ",a.jsx("button",{type:"button",onClick:()=>window.location.reload(),children:"刷新页面"})]})}},3882:(e,t,r)=>{"use strict";let a;r.r(t),r.d(t,{default:()=>eY});var i=r(3517),n=r(1166),o=r.n(n);let s=`
|
|
2
2
|
.web-root.is-remote-fullscreen > .terminal-tabs { display: none; }
|
|
3
3
|
.web-root.is-remote-fullscreen .tree-col,
|
|
4
4
|
.web-root.is-remote-fullscreen .preview-col { display: none; }
|
|
@@ -278,7 +278,7 @@
|
|
|
278
278
|
.drawer-mask { display: none; }
|
|
279
279
|
}
|
|
280
280
|
.web-root.is-remote-fullscreen .workspace { grid-template-columns: minmax(0, 1fr); }
|
|
281
|
-
`;function l(){return(void 0)??location.origin}function c(e){return(void 0)??e}var d=r(5921);let u=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),
|
|
281
|
+
`;function l(){return(void 0)??location.origin}function c(e){return(void 0)??e}var d=r(5921);let u=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),f=(...e)=>e.filter((e,t,r)=>!!e&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim();var p={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let b=(0,d.forwardRef)(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:a,className:i="",children:n,iconNode:o,...s},l)=>(0,d.createElement)("svg",{ref:l,...p,width:t,height:t,stroke:e,strokeWidth:a?24*Number(r)/Number(t):r,className:f("lucide",i),...s},[...o.map(([e,t])=>(0,d.createElement)(e,t)),...Array.isArray(n)?n:[n]])),m=(e,t)=>{let r=(0,d.forwardRef)(({className:r,...a},i)=>(0,d.createElement)(b,{ref:i,iconNode:t,className:f(`lucide-${u(e)}`,r),...a}));return r.displayName=`${e}`,r},h=m("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),x=m("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]),g=m("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]),y=m("UsersRound",[["path",{d:"M18 21a8 8 0 0 0-16 0",key:"3ypg7q"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M22 20c0-3.37-2-6.5-4-8a5 5 0 0 0-.45-8.3",key:"10s06x"}]]),w=m("MonitorUp",[["path",{d:"m9 10 3-3 3 3",key:"11gsxs"}],["path",{d:"M12 13V7",key:"h0r20n"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}]]),v=m("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]),k=m("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]),j=m("PanelRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]),S=m("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);var z=r(5878);let C=m("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]),N=m("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),R={background:"color-mix(in srgb, var(--ui-tab-accent) 88%, var(--ui-text))",borderColor:"color-mix(in srgb, var(--ui-tab-accent) 88%, var(--ui-text))",color:"var(--ui-primary-text)"};function T(){let[e,t]=(0,d.useState)(!1),[r,a]=(0,d.useState)(!1),[n,o]=(0,d.useState)(null),s=(0,d.useRef)(null);return(0,i.jsxs)(i.Fragment,{children:[i.jsx("button",{type:"button",className:"file-drawer-toggle pwa-install-button",title:e?"已添加到主屏幕":"添加到主屏幕","aria-label":e?"已添加到主屏幕":"添加到主屏幕",onClick:()=>e?a(!0):window.dispatchEvent(new Event("agentroam:pwa-install")),children:(0,i.jsxs)("span",{style:{position:"relative",display:"flex"},children:[i.jsx(C,{size:17,"aria-hidden":"true"}),i.jsx(N,{size:9,strokeWidth:3,"aria-hidden":"true",style:{position:"absolute",right:-4,bottom:-2}})]})}),r&&n&&(0,z.createPortal)((0,i.jsxs)("dialog",{ref:s,"data-toolbar-overlay":!0,onClose:()=>a(!1),"aria-labelledby":"pwa-install-title",style:{maxWidth:340,width:"calc(100% - 40px)",margin:"auto",padding:24,borderRadius:16,border:"1px solid var(--ui-tabbar-border)",background:"var(--ui-root-bg)",color:"var(--ui-text)",whiteSpace:"normal",font:"14px/1.8 system-ui"},children:[i.jsx("h2",{id:"pwa-install-title",style:{margin:"0 0 12px",fontSize:18},children:e?"已添加到主屏幕":"添加到主屏幕"}),e&&i.jsx("p",{children:"当前已在主屏幕应用中打开。"}),i.jsx("p",{children:"iPhone / iPad:在 Safari 点击分享按钮,选择“添加到主屏幕”,再点“添加”。"}),i.jsx("p",{children:"Android:打开浏览器菜单,选择“安装应用”或“添加到主屏幕”。"}),i.jsx("p",{style:{color:"var(--ui-muted-text)"},children:"浏览器需要你确认,网页无法自动添加。从主屏幕打开后,如提示未配对,请重新扫码。"}),i.jsx("button",{type:"button",style:{...R,width:"100%",padding:"10px 14px",borderStyle:"solid",borderWidth:1,borderRadius:8,cursor:"pointer"},onClick:()=>s.current?.close(),children:"知道了"})]}),n)]})}let E=m("Palette",[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]]),M=m("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]),P=m("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]),I=m("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),A=m("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),L=m("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]),_=m("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]),W=m("MessagesSquare",[["path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z",key:"p1xzt8"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1",key:"1cx29u"}]]),B=m("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]),O=m("SlidersHorizontal",[["line",{x1:"21",x2:"14",y1:"4",y2:"4",key:"obuewd"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4",key:"1q6298"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12",key:"1iu8h1"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12",key:"ntss68"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20",key:"14d8ph"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20",key:"m0wm8r"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6",key:"14e1ph"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22",key:"1lctlv"}]]),F=m("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),D=m("Camera",[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]),U={shared:"已共享",independent:"独立后台",failed:"连接失败",stopped:"桌面未启动","not-installed":"桌面未安装",unsupported:"暂不支持"};function $({csrfToken:e}){let[t,r]=(0,d.useState)(null),[a,n]=(0,d.useState)(!1),o=(0,d.useRef)(!1),s=(0,d.useRef)(0),l=(0,d.useCallback)(async(t=!1,a=!1,i=!1)=>{if(o.current)return;o.current=!0;let l=s.current;n(!0);try{let n=await fetch("/api/agent/codex-sharing",{method:t||a?"POST":"GET",credentials:"same-origin",cache:"no-store",headers:t||a?{"x-csrf-token":e,...a?{"content-type":"application/json"}:{}}:void 0,body:a?JSON.stringify({action:"share",restartConfirmed:i}):void 0,signal:AbortSignal.timeout(18e4)}),o=await n.json();if(!n.ok||!Object.hasOwn(U,o?.state))throw Error(o?.error?.message||"共享状态读取失败,请重试。");if(l!==s.current)return;r(o)}catch(e){if(l!==s.current)return;r({state:"failed",configured:!1,autoStart:!1,daemonReachable:!1,runtimeMode:null,message:e instanceof Error?e.message:"无法连接当前电脑。"})}finally{o.current=!1,l===s.current&&n(!1)}},[e]),c=t?U[t.state]:"检查中",u=t&&"unsupported"!==t.state&&("shared"!==t.state||!t.configured||!t.autoStart||!t.daemonReachable);return(0,i.jsxs)("div",{className:"codex-sharing",children:[i.jsx("style",{children:q}),(0,i.jsxs)("div",{className:"codex-sharing-title",role:"status",children:[i.jsx("span",{className:"codex-sharing-indicator","aria-hidden":"true",children:i.jsx("span",{className:"codex-sharing-dot","data-state":t?.state})}),(0,i.jsxs)("span",{children:["Codex \xb7 ",c]})]}),u&&(0,i.jsxs)(i.Fragment,{children:[i.jsx("p",{children:"shared"===t.state?"共享连接可用,启动配置需要修复。":t.message}),(0,i.jsxs)("div",{className:"codex-sharing-actions",children:[(0,i.jsxs)("button",{type:"button",disabled:a,onClick:()=>{l()},"aria-label":"刷新 Codex 共享状态",children:[i.jsx(g,{size:12}),"刷新"]}),i.jsx("button",{type:"button",disabled:a,onClick:()=>{l(!0)},children:a?"正在修复…":"检查并修复"}),!["shared","not-installed"].includes(t.state)&&i.jsx("button",{type:"button",disabled:a,onClick:()=>{let e=t?.state!=="stopped";(!e||window.confirm("切换将强制重启 Codex 桌面,中断桌面任务并可能丢失未发送内容,不再显示 Codex 退出确认框。共享后端和手机会话不会被结束。是否继续?"))&&l(!1,!0,e)},children:a?"正在处理…":"stopped"===t.state?"以共享模式启动 Codex":"切换到共享后端"})]})]})]})}let q=`
|
|
282
282
|
.codex-sharing{padding:10px 14px;margin-bottom:6px;border-bottom:1px solid var(--ui-tabbar-border,#303442);color:var(--ui-text,#e8e8ee);font-size:13px;line-height:20px}
|
|
283
283
|
.codex-sharing-title{display:flex;align-items:center;gap:10px}
|
|
284
284
|
.codex-sharing-indicator{display:grid;place-items:center;flex:0 0 17px;height:17px}
|
|
@@ -292,7 +292,7 @@
|
|
|
292
292
|
.codex-sharing-actions button:focus-visible{outline:2px solid var(--ui-tab-accent,#7aa2f7);outline-offset:3px}
|
|
293
293
|
.codex-sharing-actions button:disabled{opacity:.5;cursor:wait}
|
|
294
294
|
@media(pointer:coarse){.codex-sharing-actions button{min-height:44px}}
|
|
295
|
-
`,q="agentroam.computers.v1",V=/^[A-Za-z0-9_-]{43}$/;function G(e){try{if("string"!=typeof e||e.length>8192)throw Error();let t=new URL(e.trim().replace(/[,。]+$/,""));if(!["http:","https:"].includes(t.protocol)||t.username||t.password)throw Error();return t.href}catch{throw Error("请填写有效的 http(s) 页面地址。")}}function J(e){try{let t=new URL(e);if(!["http:","https:"].includes(t.protocol)||t.username||t.password||"/"!==t.pathname||t.search||t.hash)return null;return t.origin}catch{return null}}function X(e){if(!Array.isArray(e)||e.length>20)return[];let t=new Map;for(let r of e){let e=r&&"string"==typeof r.origin?J(r.origin):null;if(!e||"string"!=typeof r.name)continue;let a=r.name.trim().slice(0,60)||new URL(e).hostname,i=function(e){if(!Array.isArray(e)||e.length>20)return[];let t=new Map;for(let r of e)if(r&&"string"==typeof r.id&&/^[A-Za-z0-9_-]{1,80}$/.test(r.id)&&"string"==typeof r.name&&r.name.trim()&&["current","new-tab"].includes(r.openMode))try{t.set(r.id,{id:r.id,name:r.name.trim().slice(0,60),url:G(r.url),openMode:r.openMode})}catch{}return[...t.values()]}(r.pages);t.set(e,{origin:e,name:a,...!0===r.pagesMigrated?{pagesMigrated:!0}:Array.isArray(r.pages)?{pages:i}:{}})}return[...t.values()]}function K(e=localStorage){try{return X(JSON.parse(e.getItem(q)||"[]"))}catch{return[]}}function Q(...e){let t=new Map;for(let r of e)for(let e of X(r)){let r={...t.get(e.origin),...e};r.pagesMigrated&&delete r.pages,t.set(e.origin,r)}if(t.size>20)throw Error("最多可添加 20 台电脑。");return[...t.values()]}function Z(e,t=localStorage){let r=X(e);try{t.setItem(q,JSON.stringify(r))}catch{throw Error("浏览器无法保存电脑列表,请检查浏览器存储设置。")}return r}function Y(e){try{if("string"!=typeof e||e.length>2048)throw Error();if((e=e.trim()).startsWith("{")){let t=JSON.parse(e),r=J(t.server);if("agentroam-pair"!==t.type||1!==t.version||!r||!V.test(t.grant))throw Error();e=r+"/pair#pair="+t.grant}let t=new URL(e);if(!["http:","https:"].includes(t.protocol)||t.username||t.password||"/pair"!==t.pathname||t.search||!/^#pair=[A-Za-z0-9_-]{43}$/.test(t.hash))throw Error();return t}catch{throw Error("这不是 AgentRoam 授权二维码,请在电脑上重新生成。")}}function ee(e,t,r=""){let a=new URLSearchParams(e.hash.slice(1)),i=X(t).map(t=>({origin:t.origin,name:t.name,...t.pagesMigrated?{pagesMigrated:!0}:{},...t.origin===e.origin&&!t.pagesMigrated&&t.pages?.length?{pages:t.pages}:{}}));if(a.set("computers",JSON.stringify({version:1,computers:i,name:r.trim().slice(0,60)})),a.toString().length>16383)throw Error("电脑列表或待导入页面配置过长,请先导入旧页面后再切换电脑。");return e.hash=a.toString(),e.href}function et({computerName:e,page:t,onClose:r,onSave:a}){let[n,o]=(0,d.useState)(t?.name??""),[s,l]=(0,d.useState)(t?.url??""),[c,u]=(0,d.useState)(t?.openMode??"current"),[p,f]=(0,d.useState)(!!t),[b,m]=(0,d.useState)(""),[h,x]=(0,d.useState)(!1),g=(0,d.useRef)(!1),w=(0,d.useRef)(null);return i.jsx("div",{className:"computer-dialog-backdrop","data-toolbar-overlay":!0,onClick:e=>{e.target!==e.currentTarget||g.current||r()},children:(0,i.jsxs)("section",{ref:w,className:"computer-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"computer-page-title",children:[(0,i.jsxs)("div",{className:"computer-dialog-heading",children:[i.jsx("h2",{id:"computer-page-title",children:t?"编辑页面":"添加页面"}),i.jsx("button",{type:"button",className:"computer-close","aria-label":"关闭",disabled:h,onClick:r,children:i.jsx(S,{size:20})})]}),(0,i.jsxs)("p",{className:"computer-hint",children:["所属电脑:",e]}),(0,i.jsxs)("form",{onSubmit:async e=>{if(e.preventDefault(),!g.current){g.current=!0,x(!0),m("");try{let e=G(s),r=t?.id??Array.from(crypto.getRandomValues(new Uint8Array(16)),e=>e.toString(16).padStart(2,"0")).join("");await a({id:r,name:n.trim(),url:e,openMode:c})}catch(e){m(e.message)}finally{g.current=!1,x(!1)}}},children:[i.jsx("label",{htmlFor:"computer-page-name",children:"页面名称"}),i.jsx("input",{id:"computer-page-name",maxLength:60,required:!0,disabled:h,value:n,onChange:e=>o(e.target.value),placeholder:"例如:Zcode / Qoder",autoComplete:"off"}),i.jsx("label",{htmlFor:"computer-page-url",children:"页面地址"}),i.jsx("input",{id:"computer-page-url",required:!0,disabled:h,value:s,onChange:e=>{l(e.target.value),p||u(function(e){try{let t=new URL(G(e)).hostname;return"qoder.com"===t||t.endsWith(".qoder.com")?"new-tab":"current"}catch{return"current"}}(e.target.value))},placeholder:"https://…",autoComplete:"off",spellCheck:!1}),i.jsx("label",{htmlFor:"computer-page-mode",children:"打开方式"}),(0,i.jsxs)("select",{id:"computer-page-mode",disabled:h,value:c,onChange:e=>{u(e.target.value),f(!0)},children:[i.jsx("option",{value:"current",children:"当前页面打开,保留顶部图标栏"}),i.jsx("option",{value:"new-tab",children:"新页面打开,保留原会话页"})]}),i.jsx("p",{className:"computer-hint",children:"当前页面会显示网站自己的界面。若网站禁止内嵌(如 Qoder),可改为新页面打开。"}),b&&i.jsx("p",{className:"computer-error",role:"alert",children:b}),i.jsx("button",{type:"submit",className:"computer-action computer-primary",disabled:h||!n.trim()||!s.trim(),children:h?"正在保存…":"保存页面"})]})]})})}function er(e){if(!Array.isArray(e)||e.length>20)throw Error("最多可添加 20 台电脑。");let t=new Set;return e.map(e=>{let r;if(!e||"object"!=typeof e||Array.isArray(e)||Object.keys(e).some(e=>!["origin","name"].includes(e))||"string"!=typeof e.origin||e.origin.length>2048)throw Error("电脑地址无效。");try{r=new URL(e.origin)}catch{throw Error("电脑地址无效。")}if(!["http:","https:"].includes(r.protocol)||r.username||r.password||"/"!==r.pathname||r.search||r.hash||t.has(r.origin))throw Error("电脑地址无效或重复。");if("string"!=typeof e.name||!e.name.trim()||e.name.trim().length>60)throw Error("电脑名称需为 1–60 个字符。");return t.add(r.origin),{origin:r.origin,name:e.name.trim()}})}async function ea(e,t="GET",r){let a=await fetch("/api/web-console/computers",{method:t,credentials:"same-origin",cache:"no-store",headers:r?{"content-type":"application/json","x-csrf-token":e}:void 0,body:r?JSON.stringify(r):void 0,signal:AbortSignal.timeout(15e3)}).catch(()=>{throw Error("无法连接当前电脑,请检查连接后重试。")}),i=await a.json().catch(()=>null);if(!a.ok)throw Error(i?.error?.message??"电脑列表保存失败,请重试。");return er(i?.computers)}async function ei(e){if(!e||e.type&&!e.type.startsWith("image/"))throw Error("请选择二维码照片。");if(e.size>20971520)throw Error("照片过大,请重新拍摄二维码。");await (window.jsQR?Promise.resolve():a||=new Promise((e,t)=>{let r=document.createElement("script");r.src="/pwa/qr-decoder.js";let i=()=>{clearTimeout(n),a=null,r.remove(),t(Error("二维码识别器加载失败,请重试。"))},n=setTimeout(i,1e4);r.onload=()=>{clearTimeout(n),e()},r.onerror=i,document.head.append(r)}));let t=new Image,r=URL.createObjectURL(e);try{await new Promise((e,a)=>{let i=setTimeout(()=>a(Error("照片加载超时,请重新拍摄。")),1e4);t.onload=()=>{clearTimeout(i),e()},t.onerror=()=>{clearTimeout(i),a(Error("无法读取照片,请重新拍摄二维码。"))},t.src=r});let e=document.createElement("canvas"),a=e.getContext("2d",{willReadFrequently:!0});for(let r of[1600,1024,640]){let i=Math.min(1,r/Math.max(t.naturalWidth,t.naturalHeight));e.width=Math.max(1,Math.round(t.naturalWidth*i)),e.height=Math.max(1,Math.round(t.naturalHeight*i)),a.drawImage(t,0,0,e.width,e.height);let n=a.getImageData(0,0,e.width,e.height),o=window.jsQR(n.data,n.width,n.height);if(o)return o.data}throw Error("照片中没有识别到二维码,请靠近电脑屏幕重新拍摄。")}finally{t.onload=null,t.onerror=null,URL.revokeObjectURL(r)}}let en=[{id:"refresh",name:"刷新",Icon:g},{id:"collaboration",name:"群聊看板",Icon:w},{id:"remote",name:"远程桌面",Icon:y},{id:"theme",name:"皮肤",Icon:E},{id:"files",name:"文件树",Icon:j},{id:"ai-hub",name:"AI Hub",Icon:v},{id:"flow",name:"数字人",Icon:k},{id:"install",name:"添加到主屏幕",Icon:C}];function eo({username:e,connected:t,accent:r,accentText:a,selectedPageId:n,onSelectPage:o,onUpdatePage:s,configuration:c,csrfToken:u}){let p=(0,d.useRef)(null),f=(0,d.useRef)(null),b=function(e){let[t,r]=(0,d.useState)([]),[a,i]=(0,d.useState)(!1),[n,o]=(0,d.useState)(!1),[s,c]=(0,d.useState)(""),u=(0,d.useRef)(!0),p=(0,d.useRef)(!1),f=(0,d.useRef)(0),b=(0,d.useRef)(!1),m=(0,d.useCallback)(e=>{if(u.current){r(t=>t.length===e.length&&t.every((t,r)=>t.origin===e[r].origin&&t.name===e[r].name)?t:e),i(!0);try{let t=K();Z(e.map(e=>({...t.find(t=>t.origin===e.origin),...e})))}catch{}}},[]),h=(0,d.useCallback)(async()=>{if(p.current)return;let t=++f.current;try{let r=b.current?void 0:(function(e,t,r=K()){let a=J(e);if(!a)throw Error("电脑地址无效。");let i=r.find(e=>e.origin===a);return Q(r,[{origin:a,name:t?.trim()||i?.name||new URL(a).hostname,...i?.pages?.length?{pages:i.pages}:{}}])})(l(),void 0).map(({origin:e,name:t})=>({origin:e,name:t})),a=await ea(e,r?"POST":"GET",r?{computers:r}:void 0);if(!u.current||t!==f.current)return;b.current=!0,m(a),c("")}catch(e){u.current&&t===f.current&&c(e instanceof Error?e.message:"无法读取电脑列表。")}},[m,e]),x=(0,d.useCallback)(async(t,r)=>{if(!a||p.current)throw Error("电脑列表尚未就绪,请稍后重试。");p.current=!0,f.current++,o(!0),c("");try{m(await ea(e,t,r))}catch(t){let e=t instanceof Error?t.message:"电脑列表保存失败,请重试。";throw u.current&&c(e),Error(e)}finally{p.current=!1,u.current&&o(!1)}},[m,e,a]);return{computers:t,loaded:a,saving:n,error:s,reload:h,rename:(0,d.useCallback)((e,t)=>x("PATCH",er([{origin:e,name:t}])[0]),[x]),remove:(0,d.useCallback)(async e=>{if(new URL(e).origin===l())throw Error("不能删除当前连接的电脑。");await x("DELETE",{origin:e})},[x]),add:(0,d.useCallback)((e,t)=>x("POST",{computers:er([{origin:e,name:t}]),restore:!0}),[x])}}(u),m=b.computers,[h,w]=(0,d.useState)(""),[y,v]=(0,d.useState)(null),[k,j]=(0,d.useState)(!1),[C,R]=(0,d.useState)("home"),[T,E]=(0,d.useState)(!1),[D,$]=(0,d.useState)({top:48,right:12}),[H,q]=(0,d.useState)(null),[V,G]=(0,d.useState)(null),[X,ei]=(0,d.useState)(""),[eo,ec]=(0,d.useState)({}),ed=m.find(e=>e.origin===h),eu=c.settings.savedPages??[],ep=(0,d.useCallback)(()=>{q(null),p.current?.focus()},[]),ef=(0,d.useCallback)(()=>{G(null),p.current?.focus()},[]),eb=(0,d.useCallback)(async(e,t)=>{let r=Y(e),a={origin:r.origin,name:t.trim()||m.find(e=>e.origin===r.origin)?.name||r.hostname},i=function(e,t,r=""){return ee(Y(e),t,r)}(e,Q(K(),m,[a]),t);await b.add(a.origin,a.name),location.assign(i)},[m,b.add]),em=(0,d.useCallback)(async e=>{await b.rename(l(),e),ep()},[ep,b.rename]);return(0,i.jsxs)(i.Fragment,{children:[i.jsx("style",{children:el}),(0,i.jsxs)("div",{className:"theme-avatar-with-status",children:[i.jsx("button",{ref:p,type:"button",className:"theme-avatar","aria-label":`电脑与连接状态(${e})`,title:e,style:{border:`1px solid ${r}`,background:r,color:a},"aria-expanded":k,"aria-haspopup":"true",onClick:()=>{let e=p.current.getBoundingClientRect(),t=Math.min(292,innerWidth-24);$({top:e.bottom+8,right:Math.max(12,Math.min(innerWidth-t-12,innerWidth-e.right))}),k||(R("home"),ei(""),c.reload(),b.reload()),j(e=>!e)},children:(e.trim()[0]??"?").toUpperCase()}),i.jsx("span",{className:"theme-avatar-status","data-connected":t,"aria-label":t?"已连接":"未连接"})]}),k&&y&&(0,z.createPortal)(i.jsx("div",{className:"computer-menu-backdrop","data-toolbar-overlay":!0,children:(0,i.jsxs)("div",{ref:f,className:"computer-menu",style:T?void 0:D,role:"dialog","aria-modal":T,"aria-label":"tools"===C?"配置顶部工具":"computers"===C?"选择电脑":"电脑与保存页面",children:[i.jsx("div",{className:"computer-menu-grip","aria-hidden":"true"}),(0,i.jsxs)("div",{className:"computer-menu-heading",children:["home"!==C&&i.jsx("button",{type:"button",className:"computer-close","aria-label":"返回电脑菜单",onClick:()=>R("home"),children:i.jsx(M,{size:20})}),"home"===C?(0,i.jsxs)("button",{type:"button",className:"computer-menu-item computer-current","aria-label":"选择电脑",onClick:()=>R("computers"),children:[i.jsx(P,{size:17}),(0,i.jsxs)("span",{children:[i.jsx("strong",{children:ed?.name||"当前电脑"}),i.jsx("small",{children:t?"当前 \xb7 在线":"当前 \xb7 未连接"})]}),i.jsx(I,{size:16})]}):i.jsx("strong",{children:"tools"===C?`${ed?.name||"当前电脑"} \xb7 顶部工具`:"选择电脑"}),i.jsx("button",{type:"button",className:"computer-close","aria-label":"关闭电脑菜单",onClick:()=>{j(!1),p.current?.focus()},children:i.jsx(S,{size:20})})]}),"computers"===C&&(0,i.jsxs)(i.Fragment,{children:[!b.loaded&&i.jsx("p",{className:"computer-save-status",role:"status",children:b.error?"电脑列表尚未加载":"正在读取电脑列表…"}),m.map(e=>{let r=e.origin===h?t?"online":"offline":eo[e.origin]??"checking",a="online"===r?"在线":"offline"===r?"无法连接":"检测中";return(0,i.jsxs)("div",{className:"computer-menu-row",children:[(0,i.jsxs)("button",{type:"button",className:"computer-menu-item","data-computer-origin":e.origin,"aria-label":`${e.name},${a}${e.origin===h?",当前电脑":""}`,"aria-current":e.origin===h?"true":void 0,onClick:()=>{if(e.origin===h)R("home");else try{location.assign(function(e,t){let r=J(e);if(!r)throw Error("电脑地址无效。");return ee(new URL(r+"/pair"),t)}(e.origin,Q(K(),m)))}catch(e){ei(e.message)}},children:[i.jsx(P,{size:17,"aria-hidden":"true"}),(0,i.jsxs)("span",{children:[i.jsx("strong",{children:e.name}),i.jsx("small",{children:e.origin})]}),i.jsx("span",{className:"computer-status-dot","data-status":r,role:"img","aria-label":a,title:a}),e.origin===h&&i.jsx(A,{size:16,"aria-label":"当前电脑"})]}),e.origin!==h&&i.jsx("button",{type:"button",className:"computer-page-control computer-delete-control","aria-label":`删除电脑:${e.name}`,title:`删除电脑:${e.name}`,disabled:b.saving,onClick:()=>{b.remove(e.origin).catch(()=>{})},children:i.jsx(L,{size:15})})]},e.origin)}),i.jsx("div",{className:"computer-menu-divider"}),(0,i.jsxs)("button",{type:"button",className:"computer-menu-item",disabled:!b.loaded||b.saving,onClick:()=>{j(!1),q("add")},children:[i.jsx(N,{size:17,"aria-hidden":"true"}),i.jsx("span",{children:"扫码添加电脑"})]}),(0,i.jsxs)("button",{type:"button",className:"computer-menu-item",disabled:!b.loaded||b.saving||!ed,onClick:()=>{j(!1),q("rename")},children:[i.jsx(_,{size:16,"aria-hidden":"true"}),i.jsx("span",{children:"修改当前电脑名称"})]}),b.error&&(0,i.jsxs)(i.Fragment,{children:[i.jsx("p",{className:"computer-error",role:"alert",children:b.error}),(0,i.jsxs)("button",{type:"button",className:"computer-menu-item",onClick:()=>{b.reload()},children:[i.jsx(g,{size:16}),i.jsx("span",{children:"重新加载电脑列表"})]})]})]}),"home"===C&&(0,i.jsxs)(i.Fragment,{children:[i.jsx(U,{csrfToken:u}),(0,i.jsxs)("div",{className:"computer-menu-label computer-pages-heading",children:[i.jsx("span",{children:"保存的页面"}),i.jsx("button",{type:"button",className:"computer-page-control","aria-label":"添加页面",disabled:!c.loaded||c.saving,onClick:()=>{j(!1),G({computer:ed??{origin:h,name:"当前电脑"}})},children:i.jsx(N,{size:17})})]}),(0,i.jsxs)("button",{type:"button",className:"computer-menu-item","aria-current":n?void 0:"true",onClick:()=>{j(!1),o(null)},children:[i.jsx(W,{size:17}),i.jsx("span",{children:"电脑会话"}),!n&&i.jsx(A,{size:16})]}),eu.map(e=>(0,i.jsxs)("div",{className:"computer-menu-row",children:[(0,i.jsxs)("button",{type:"button",className:"computer-menu-item","aria-label":`打开 ${e.name}`,"aria-current":n===e.id?"true":void 0,onClick:()=>{j(!1),o(e)},children:[i.jsx(B,{size:15,"aria-hidden":"true"}),(0,i.jsxs)("span",{children:[i.jsx("strong",{children:e.name}),(0,i.jsxs)("small",{children:["current"===e.openMode?"当前页面":"新页面"," \xb7 ",new URL(e.url).hostname]})]}),"new-tab"===e.openMode&&i.jsx(x,{size:13,"aria-hidden":"true"})]}),i.jsx("button",{type:"button",className:"computer-page-control","aria-label":`编辑 ${e.name}`,disabled:c.saving,onClick:()=>{j(!1),G({computer:ed??{origin:h,name:"当前电脑"},page:e})},children:i.jsx(_,{size:14})}),i.jsx("button",{type:"button",className:"computer-page-control","aria-label":`删除 ${e.name}`,disabled:c.saving,onClick:()=>{c.setSavedPages(eu.filter(t=>t.id!==e.id)).catch(()=>{})},children:i.jsx(S,{size:15})})]},e.id)),i.jsx("div",{className:"computer-menu-divider"}),(0,i.jsxs)("button",{type:"button",className:"computer-menu-item",onClick:()=>R("tools"),children:[i.jsx(O,{size:17}),i.jsx("span",{children:"配置顶部工具"}),i.jsx(F,{size:16})]})]}),"tools"===C&&i.jsx("div",{className:"computer-tools-list",children:en.map(({id:e,name:t,Icon:r})=>(0,i.jsxs)("label",{className:"computer-tool-option",children:[i.jsx(r,{size:17,"aria-hidden":"true"}),i.jsx("span",{children:t}),i.jsx("input",{type:"checkbox","aria-label":`显示${t}`,checked:c.settings.visibleTools.includes(e),disabled:!c.loaded||c.saving,onChange:t=>{let r=c.settings.visibleTools;c.setVisibleTools(t.target.checked?[...r,e]:r.filter(t=>t!==e)).catch(()=>{})}})]},e))}),"computers"!==C&&i.jsx("p",{className:"computer-save-status",role:"status",children:c.loaded?c.saving?"正在保存…":c.notice:c.error?"配置尚未加载":"正在读取电脑配置…"}),c.error&&"computers"!==C&&(0,i.jsxs)(i.Fragment,{children:[i.jsx("p",{className:"computer-error",role:"alert",children:c.error}),(0,i.jsxs)("button",{type:"button",className:"computer-menu-item",onClick:()=>{c.reload()},children:[i.jsx(g,{size:16}),i.jsx("span",{children:"重新加载配置"})]})]}),X&&i.jsx("p",{className:"computer-error",role:"alert",children:X})]})}),y),H&&y&&(0,z.createPortal)(i.jsx(es,{mode:H,currentName:ed?.name||"",onClose:ep,onNavigate:eb,onRename:em}),y),V&&y&&(0,z.createPortal)(i.jsx(et,{computerName:V.computer.name,page:V.page,onClose:ef,onSave:async e=>{if(V.page&&!eu.some(t=>t.id===e.id))throw Error("这个页面已在其他设备删除,请重新添加。");await c.setSavedPages(V.page?eu.map(t=>t.id===e.id?e:t):[...eu,e]),ef()}}),y)]})}function es({mode:e,currentName:t,onClose:r,onNavigate:a,onRename:n}){let[o,s]=(0,d.useState)("rename"===e?t:""),l=(0,d.useRef)(o);l.current=o;let[c,u]=(0,d.useState)(""),[p,f]=(0,d.useState)(""),[b,m]=(0,d.useState)(!1),[h,x]=(0,d.useState)(!1),[g,w]=(0,d.useState)(!1),[y,v]=(0,d.useState)(!1),k=(0,d.useRef)(null),j=(0,d.useRef)(null),z=(0,d.useRef)(0),C=(0,d.useRef)(null),N=(0,d.useRef)(null),R=(0,d.useRef)(null),T=(0,d.useCallback)(async e=>{m(!0),R.current?.stop(),x(!1),f("");try{await a(e,l.current)}catch(e){f(e.message)}finally{m(!1)}},[a]);return i.jsx("div",{className:"computer-dialog-backdrop","data-toolbar-overlay":!0,onClick:e=>{e.target===e.currentTarget&&r()},children:(0,i.jsxs)("section",{ref:N,className:"computer-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"computer-dialog-title",children:[(0,i.jsxs)("div",{className:"computer-dialog-heading",children:[i.jsx("h2",{id:"computer-dialog-title",children:"add"===e?"添加电脑":"修改电脑名称"}),i.jsx("button",{type:"button",className:"computer-close","aria-label":"关闭",onClick:r,children:i.jsx(S,{size:20})})]}),(0,i.jsxs)("form",{onSubmit:async t=>{if(t.preventDefault(),!b){if("add"===e)await T(c);else{m(!0);try{await n(o.trim())}catch(e){f(e.message)}finally{m(!1)}}}},children:[(0,i.jsxs)("label",{htmlFor:"computer-name",children:["电脑名称","add"===e?"(选填)":""]}),i.jsx("input",{ref:C,id:"computer-name",maxLength:60,value:o,required:"rename"===e,disabled:b,onChange:e=>s(e.target.value),placeholder:"例如:A 电脑 / 家里的电脑",autoComplete:"off"}),"add"===e&&(0,i.jsxs)(i.Fragment,{children:[i.jsx("p",{className:"computer-hint",children:"扫描另一台电脑上的 AgentRoam 授权二维码,连接后会保留已有电脑。"}),i.jsx("input",{ref:j,type:"file",accept:"image/*",capture:"environment",hidden:!0,"aria-label":"拍摄授权二维码",onChange:async e=>{let t=e.currentTarget.files?.[0];if(e.currentTarget.value="",!t)return;let r=++z.current;R.current?.stop(),x(!1),v(!0),f("");try{let e=await ei(t);r===z.current&&T(e)}catch(e){r===z.current&&f(e.message)}finally{r===z.current&&v(!1)}}}),i.jsx("video",{ref:k,playsInline:!0,muted:!0,hidden:!h,"aria-label":"扫码相机画面"}),(0,i.jsxs)("button",{className:"computer-action",type:"button",disabled:y,onClick:()=>{f(""),h?(R.current?.stop(),x(!1)):window.isSecureContext&&navigator.mediaDevices?.getUserMedia?(x(!0),R.current?.start()):j.current?.click()},children:[i.jsx(D,{size:17,"aria-hidden":"true"}),y?"正在识别二维码…":h?"取消扫码":g?"打开相机扫码":"拍照扫码"]}),g&&i.jsx("button",{className:"computer-action",type:"button",disabled:y,onClick:()=>{R.current?.stop(),x(!1),j.current?.click()},children:"拍照识别二维码"}),i.jsx("label",{htmlFor:"computer-link",children:"或粘贴授权二维码链接"}),i.jsx("input",{id:"computer-link",value:c,onChange:e=>u(e.target.value),placeholder:"http(s)://…/pair#pair=…",autoComplete:"off",spellCheck:!1})]}),p&&i.jsx("p",{className:"computer-error",role:"alert",children:p}),i.jsx("button",{className:"computer-action computer-primary",type:"submit",disabled:b||("add"===e?!c.trim()||y:!o.trim()),children:"add"===e?"连接这台电脑":b?"正在保存…":"保存名称"})]})]})})}let el=`
|
|
295
|
+
`,H="agentroam.computers.v1",V=/^[A-Za-z0-9_-]{43}$/;function G(e){try{if("string"!=typeof e||e.length>8192)throw Error();let t=new URL(e.trim().replace(/[,。]+$/,""));if(!["http:","https:"].includes(t.protocol)||t.username||t.password)throw Error();return t.href}catch{throw Error("请填写有效的 http(s) 页面地址。")}}function J(e){try{let t=new URL(e);if(!["http:","https:"].includes(t.protocol)||t.username||t.password||"/"!==t.pathname||t.search||t.hash)return null;return t.origin}catch{return null}}function X(e){if(!Array.isArray(e)||e.length>20)return[];let t=new Map;for(let r of e){let e=r&&"string"==typeof r.origin?J(r.origin):null;if(!e||"string"!=typeof r.name)continue;let a=r.name.trim().slice(0,60)||new URL(e).hostname,i=function(e){if(!Array.isArray(e)||e.length>20)return[];let t=new Map;for(let r of e)if(r&&"string"==typeof r.id&&/^[A-Za-z0-9_-]{1,80}$/.test(r.id)&&"string"==typeof r.name&&r.name.trim()&&["current","new-tab"].includes(r.openMode))try{t.set(r.id,{id:r.id,name:r.name.trim().slice(0,60),url:G(r.url),openMode:r.openMode})}catch{}return[...t.values()]}(r.pages);t.set(e,{origin:e,name:a,...!0===r.pagesMigrated?{pagesMigrated:!0}:Array.isArray(r.pages)?{pages:i}:{}})}return[...t.values()]}function K(e=localStorage){try{return X(JSON.parse(e.getItem(H)||"[]"))}catch{return[]}}function Q(...e){let t=new Map;for(let r of e)for(let e of X(r)){let r={...t.get(e.origin),...e};r.pagesMigrated&&delete r.pages,t.set(e.origin,r)}if(t.size>20)throw Error("最多可添加 20 台电脑。");return[...t.values()]}function Z(e,t=localStorage){let r=X(e);try{t.setItem(H,JSON.stringify(r))}catch{throw Error("浏览器无法保存电脑列表,请检查浏览器存储设置。")}return r}function Y(e){try{if("string"!=typeof e||e.length>2048)throw Error();if((e=e.trim()).startsWith("{")){let t=JSON.parse(e),r=J(t.server);if("agentroam-pair"!==t.type||1!==t.version||!r||!V.test(t.grant))throw Error();e=r+"/pair#pair="+t.grant}let t=new URL(e);if(!["http:","https:"].includes(t.protocol)||t.username||t.password||"/pair"!==t.pathname||t.search||!/^#pair=[A-Za-z0-9_-]{43}$/.test(t.hash))throw Error();return t}catch{throw Error("这不是 AgentRoam 授权二维码,请在电脑上重新生成。")}}function ee(e,t,r=""){let a=new URLSearchParams(e.hash.slice(1)),i=X(t).map(t=>({origin:t.origin,name:t.name,...t.pagesMigrated?{pagesMigrated:!0}:{},...t.origin===e.origin&&!t.pagesMigrated&&t.pages?.length?{pages:t.pages}:{}}));if(a.set("computers",JSON.stringify({version:1,computers:i,name:r.trim().slice(0,60)})),a.toString().length>16383)throw Error("电脑列表或待导入页面配置过长,请先导入旧页面后再切换电脑。");return e.hash=a.toString(),e.href}function et({computerName:e,page:t,onClose:r,onSave:a}){let[n,o]=(0,d.useState)(t?.name??""),[s,l]=(0,d.useState)(t?.url??""),[c,u]=(0,d.useState)(t?.openMode??"current"),[f,p]=(0,d.useState)(!!t),[b,m]=(0,d.useState)(""),[h,x]=(0,d.useState)(!1),g=(0,d.useRef)(!1),y=(0,d.useRef)(null);return i.jsx("div",{className:"computer-dialog-backdrop","data-toolbar-overlay":!0,onClick:e=>{e.target!==e.currentTarget||g.current||r()},children:(0,i.jsxs)("section",{ref:y,className:"computer-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"computer-page-title",children:[(0,i.jsxs)("div",{className:"computer-dialog-heading",children:[i.jsx("h2",{id:"computer-page-title",children:t?"编辑页面":"添加页面"}),i.jsx("button",{type:"button",className:"computer-close","aria-label":"关闭",disabled:h,onClick:r,children:i.jsx(S,{size:20})})]}),(0,i.jsxs)("p",{className:"computer-hint",children:["所属电脑:",e]}),(0,i.jsxs)("form",{onSubmit:async e=>{if(e.preventDefault(),!g.current){g.current=!0,x(!0),m("");try{let e=G(s),r=t?.id??Array.from(crypto.getRandomValues(new Uint8Array(16)),e=>e.toString(16).padStart(2,"0")).join("");await a({id:r,name:n.trim(),url:e,openMode:c})}catch(e){m(e.message)}finally{g.current=!1,x(!1)}}},children:[i.jsx("label",{htmlFor:"computer-page-name",children:"页面名称"}),i.jsx("input",{id:"computer-page-name",maxLength:60,required:!0,disabled:h,value:n,onChange:e=>o(e.target.value),placeholder:"例如:Zcode / Qoder",autoComplete:"off"}),i.jsx("label",{htmlFor:"computer-page-url",children:"页面地址"}),i.jsx("input",{id:"computer-page-url",required:!0,disabled:h,value:s,onChange:e=>{l(e.target.value),f||u(function(e){try{let t=new URL(G(e)).hostname;return"qoder.com"===t||t.endsWith(".qoder.com")?"new-tab":"current"}catch{return"current"}}(e.target.value))},placeholder:"https://…",autoComplete:"off",spellCheck:!1}),i.jsx("label",{htmlFor:"computer-page-mode",children:"打开方式"}),(0,i.jsxs)("select",{id:"computer-page-mode",disabled:h,value:c,onChange:e=>{u(e.target.value),p(!0)},children:[i.jsx("option",{value:"current",children:"当前页面打开,保留顶部图标栏"}),i.jsx("option",{value:"new-tab",children:"新页面打开,保留原会话页"})]}),i.jsx("p",{className:"computer-hint",children:"当前页面会显示网站自己的界面。若网站禁止内嵌(如 Qoder),可改为新页面打开。"}),b&&i.jsx("p",{className:"computer-error",role:"alert",children:b}),i.jsx("button",{type:"submit",className:"computer-action computer-primary",disabled:h||!n.trim()||!s.trim(),children:h?"正在保存…":"保存页面"})]})]})})}function er(e){if(!Array.isArray(e)||e.length>20)throw Error("最多可添加 20 台电脑。");let t=new Set;return e.map(e=>{let r;if(!e||"object"!=typeof e||Array.isArray(e)||Object.keys(e).some(e=>!["origin","name"].includes(e))||"string"!=typeof e.origin||e.origin.length>2048)throw Error("电脑地址无效。");try{r=new URL(e.origin)}catch{throw Error("电脑地址无效。")}if(!["http:","https:"].includes(r.protocol)||r.username||r.password||"/"!==r.pathname||r.search||r.hash||t.has(r.origin))throw Error("电脑地址无效或重复。");if("string"!=typeof e.name||!e.name.trim()||e.name.trim().length>60)throw Error("电脑名称需为 1–60 个字符。");return t.add(r.origin),{origin:r.origin,name:e.name.trim()}})}async function ea(e,t="GET",r){let a=await fetch("/api/web-console/computers",{method:t,credentials:"same-origin",cache:"no-store",headers:r?{"content-type":"application/json","x-csrf-token":e}:void 0,body:r?JSON.stringify(r):void 0,signal:AbortSignal.timeout(15e3)}).catch(()=>{throw Error("无法连接当前电脑,请检查连接后重试。")}),i=await a.json().catch(()=>null);if(!a.ok)throw Error(i?.error?.message??"电脑列表保存失败,请重试。");return er(i?.computers)}async function ei(e){if(!e||e.type&&!e.type.startsWith("image/"))throw Error("请选择二维码照片。");if(e.size>20971520)throw Error("照片过大,请重新拍摄二维码。");await (window.jsQR?Promise.resolve():a||=new Promise((e,t)=>{let r=document.createElement("script");r.src="/pwa/qr-decoder.js";let i=()=>{clearTimeout(n),a=null,r.remove(),t(Error("二维码识别器加载失败,请重试。"))},n=setTimeout(i,1e4);r.onload=()=>{clearTimeout(n),e()},r.onerror=i,document.head.append(r)}));let t=new Image,r=URL.createObjectURL(e);try{await new Promise((e,a)=>{let i=setTimeout(()=>a(Error("照片加载超时,请重新拍摄。")),1e4);t.onload=()=>{clearTimeout(i),e()},t.onerror=()=>{clearTimeout(i),a(Error("无法读取照片,请重新拍摄二维码。"))},t.src=r});let e=document.createElement("canvas"),a=e.getContext("2d",{willReadFrequently:!0});for(let r of[1600,1024,640]){let i=Math.min(1,r/Math.max(t.naturalWidth,t.naturalHeight));e.width=Math.max(1,Math.round(t.naturalWidth*i)),e.height=Math.max(1,Math.round(t.naturalHeight*i)),a.drawImage(t,0,0,e.width,e.height);let n=a.getImageData(0,0,e.width,e.height),o=window.jsQR(n.data,n.width,n.height);if(o)return o.data}throw Error("照片中没有识别到二维码,请靠近电脑屏幕重新拍摄。")}finally{t.onload=null,t.onerror=null,URL.revokeObjectURL(r)}}let en=[{id:"refresh",name:"刷新",Icon:g},{id:"collaboration",name:"群聊看板",Icon:y},{id:"remote",name:"远程桌面",Icon:w},{id:"theme",name:"皮肤",Icon:E},{id:"files",name:"文件树",Icon:j},{id:"ai-hub",name:"AI Hub",Icon:v},{id:"flow",name:"数字人",Icon:k},{id:"install",name:"添加到主屏幕",Icon:C}];function eo({username:e,connected:t,accent:r,accentText:a,selectedPageId:n,onSelectPage:o,onUpdatePage:s,configuration:c,csrfToken:u}){let f=(0,d.useRef)(null),p=(0,d.useRef)(null),b=function(e){let[t,r]=(0,d.useState)([]),[a,i]=(0,d.useState)(!1),[n,o]=(0,d.useState)(!1),[s,c]=(0,d.useState)(""),u=(0,d.useRef)(!0),f=(0,d.useRef)(!1),p=(0,d.useRef)(0),b=(0,d.useRef)(!1),m=(0,d.useCallback)(e=>{if(u.current){r(t=>t.length===e.length&&t.every((t,r)=>t.origin===e[r].origin&&t.name===e[r].name)?t:e),i(!0);try{let t=K();Z(e.map(e=>({...t.find(t=>t.origin===e.origin),...e})))}catch{}}},[]),h=(0,d.useCallback)(async()=>{if(f.current)return;let t=++p.current;try{let r=b.current?void 0:(function(e,t,r=K()){let a=J(e);if(!a)throw Error("电脑地址无效。");let i=r.find(e=>e.origin===a);return Q(r,[{origin:a,name:t?.trim()||i?.name||new URL(a).hostname,...i?.pages?.length?{pages:i.pages}:{}}])})(l(),void 0).map(({origin:e,name:t})=>({origin:e,name:t})),a=await ea(e,r?"POST":"GET",r?{computers:r}:void 0);if(!u.current||t!==p.current)return;b.current=!0,m(a),c("")}catch(e){u.current&&t===p.current&&c(e instanceof Error?e.message:"无法读取电脑列表。")}},[m,e]),x=(0,d.useCallback)(async(t,r)=>{if(!a||f.current)throw Error("电脑列表尚未就绪,请稍后重试。");f.current=!0,p.current++,o(!0),c("");try{m(await ea(e,t,r))}catch(t){let e=t instanceof Error?t.message:"电脑列表保存失败,请重试。";throw u.current&&c(e),Error(e)}finally{f.current=!1,u.current&&o(!1)}},[m,e,a]);return{computers:t,loaded:a,saving:n,error:s,reload:h,rename:(0,d.useCallback)((e,t)=>x("PATCH",er([{origin:e,name:t}])[0]),[x]),remove:(0,d.useCallback)(async e=>{if(new URL(e).origin===l())throw Error("不能删除当前连接的电脑。");await x("DELETE",{origin:e})},[x]),add:(0,d.useCallback)((e,t)=>x("POST",{computers:er([{origin:e,name:t}]),restore:!0}),[x])}}(u),m=b.computers,[h,y]=(0,d.useState)(""),[w,v]=(0,d.useState)(null),[k,j]=(0,d.useState)(!1),[C,R]=(0,d.useState)("home"),[T,E]=(0,d.useState)(!1),[D,U]=(0,d.useState)({top:48,right:12}),[q,H]=(0,d.useState)(null),[V,G]=(0,d.useState)(null),[X,ei]=(0,d.useState)(""),[eo,ec]=(0,d.useState)({}),ed=m.find(e=>e.origin===h),eu=c.settings.savedPages??[],ef=(0,d.useCallback)(()=>{H(null),f.current?.focus()},[]),ep=(0,d.useCallback)(()=>{G(null),f.current?.focus()},[]),eb=(0,d.useCallback)(async(e,t)=>{let r=Y(e),a={origin:r.origin,name:t.trim()||m.find(e=>e.origin===r.origin)?.name||r.hostname},i=function(e,t,r=""){return ee(Y(e),t,r)}(e,Q(K(),m,[a]),t);await b.add(a.origin,a.name),location.assign(i)},[m,b.add]),em=(0,d.useCallback)(async e=>{await b.rename(l(),e),ef()},[ef,b.rename]);return(0,i.jsxs)(i.Fragment,{children:[i.jsx("style",{children:el}),(0,i.jsxs)("div",{className:"theme-avatar-with-status",children:[i.jsx("button",{ref:f,type:"button",className:"theme-avatar","aria-label":`电脑与连接状态(${e})`,title:e,style:{border:`1px solid ${r}`,background:r,color:a},"aria-expanded":k,"aria-haspopup":"true",onClick:()=>{let e=f.current.getBoundingClientRect(),t=Math.min(292,innerWidth-24);U({top:e.bottom+8,right:Math.max(12,Math.min(innerWidth-t-12,innerWidth-e.right))}),k||(R("home"),ei(""),c.reload(),b.reload()),j(e=>!e)},children:(e.trim()[0]??"?").toUpperCase()}),i.jsx("span",{className:"theme-avatar-status","data-connected":t,"aria-label":t?"已连接":"未连接"})]}),k&&w&&(0,z.createPortal)(i.jsx("div",{className:"computer-menu-backdrop","data-toolbar-overlay":!0,children:(0,i.jsxs)("div",{ref:p,className:"computer-menu",style:T?void 0:D,role:"dialog","aria-modal":T,"aria-label":"tools"===C?"配置顶部工具":"computers"===C?"选择电脑":"电脑与保存页面",children:[i.jsx("div",{className:"computer-menu-grip","aria-hidden":"true"}),(0,i.jsxs)("div",{className:"computer-menu-heading",children:["home"!==C&&i.jsx("button",{type:"button",className:"computer-close","aria-label":"返回电脑菜单",onClick:()=>R("home"),children:i.jsx(M,{size:20})}),"home"===C?(0,i.jsxs)("button",{type:"button",className:"computer-menu-item computer-current","aria-label":"选择电脑",onClick:()=>R("computers"),children:[i.jsx(P,{size:17}),(0,i.jsxs)("span",{children:[i.jsx("strong",{children:ed?.name||"当前电脑"}),i.jsx("small",{children:t?"当前 \xb7 在线":"当前 \xb7 未连接"})]}),i.jsx(I,{size:16})]}):i.jsx("strong",{children:"tools"===C?`${ed?.name||"当前电脑"} \xb7 顶部工具`:"选择电脑"}),i.jsx("button",{type:"button",className:"computer-close","aria-label":"关闭电脑菜单",onClick:()=>{j(!1),f.current?.focus()},children:i.jsx(S,{size:20})})]}),"computers"===C&&(0,i.jsxs)(i.Fragment,{children:[!b.loaded&&i.jsx("p",{className:"computer-save-status",role:"status",children:b.error?"电脑列表尚未加载":"正在读取电脑列表…"}),m.map(e=>{let r=e.origin===h?t?"online":"offline":eo[e.origin]??"checking",a="online"===r?"在线":"offline"===r?"无法连接":"检测中";return(0,i.jsxs)("div",{className:"computer-menu-row",children:[(0,i.jsxs)("button",{type:"button",className:"computer-menu-item","data-computer-origin":e.origin,"aria-label":`${e.name},${a}${e.origin===h?",当前电脑":""}`,"aria-current":e.origin===h?"true":void 0,onClick:()=>{if(e.origin===h)R("home");else try{location.assign(function(e,t){let r=J(e);if(!r)throw Error("电脑地址无效。");return ee(new URL(r+"/pair"),t)}(e.origin,Q(K(),m)))}catch(e){ei(e.message)}},children:[i.jsx(P,{size:17,"aria-hidden":"true"}),(0,i.jsxs)("span",{children:[i.jsx("strong",{children:e.name}),i.jsx("small",{children:e.origin})]}),i.jsx("span",{className:"computer-status-dot","data-status":r,role:"img","aria-label":a,title:a}),e.origin===h&&i.jsx(A,{size:16,"aria-label":"当前电脑"})]}),e.origin!==h&&i.jsx("button",{type:"button",className:"computer-page-control computer-delete-control","aria-label":`删除电脑:${e.name}`,title:`删除电脑:${e.name}`,disabled:b.saving,onClick:()=>{b.remove(e.origin).catch(()=>{})},children:i.jsx(L,{size:15})})]},e.origin)}),i.jsx("div",{className:"computer-menu-divider"}),(0,i.jsxs)("button",{type:"button",className:"computer-menu-item",disabled:!b.loaded||b.saving,onClick:()=>{j(!1),H("add")},children:[i.jsx(N,{size:17,"aria-hidden":"true"}),i.jsx("span",{children:"扫码添加电脑"})]}),(0,i.jsxs)("button",{type:"button",className:"computer-menu-item",disabled:!b.loaded||b.saving||!ed,onClick:()=>{j(!1),H("rename")},children:[i.jsx(_,{size:16,"aria-hidden":"true"}),i.jsx("span",{children:"修改当前电脑名称"})]}),b.error&&(0,i.jsxs)(i.Fragment,{children:[i.jsx("p",{className:"computer-error",role:"alert",children:b.error}),(0,i.jsxs)("button",{type:"button",className:"computer-menu-item",onClick:()=>{b.reload()},children:[i.jsx(g,{size:16}),i.jsx("span",{children:"重新加载电脑列表"})]})]})]}),"home"===C&&(0,i.jsxs)(i.Fragment,{children:[i.jsx($,{csrfToken:u}),(0,i.jsxs)("div",{className:"computer-menu-label computer-pages-heading",children:[i.jsx("span",{children:"保存的页面"}),i.jsx("button",{type:"button",className:"computer-page-control","aria-label":"添加页面",disabled:!c.loaded||c.saving,onClick:()=>{j(!1),G({computer:ed??{origin:h,name:"当前电脑"}})},children:i.jsx(N,{size:17})})]}),(0,i.jsxs)("button",{type:"button",className:"computer-menu-item","aria-current":n?void 0:"true",onClick:()=>{j(!1),o(null)},children:[i.jsx(W,{size:17}),i.jsx("span",{children:"电脑会话"}),!n&&i.jsx(A,{size:16})]}),eu.map(e=>(0,i.jsxs)("div",{className:"computer-menu-row",children:[(0,i.jsxs)("button",{type:"button",className:"computer-menu-item","aria-label":`打开 ${e.name}`,"aria-current":n===e.id?"true":void 0,onClick:()=>{j(!1),o(e)},children:[i.jsx(B,{size:15,"aria-hidden":"true"}),(0,i.jsxs)("span",{children:[i.jsx("strong",{children:e.name}),(0,i.jsxs)("small",{children:["current"===e.openMode?"当前页面":"新页面"," \xb7 ",new URL(e.url).hostname]})]}),"new-tab"===e.openMode&&i.jsx(x,{size:13,"aria-hidden":"true"})]}),i.jsx("button",{type:"button",className:"computer-page-control","aria-label":`编辑 ${e.name}`,disabled:c.saving,onClick:()=>{j(!1),G({computer:ed??{origin:h,name:"当前电脑"},page:e})},children:i.jsx(_,{size:14})}),i.jsx("button",{type:"button",className:"computer-page-control","aria-label":`删除 ${e.name}`,disabled:c.saving,onClick:()=>{c.setSavedPages(eu.filter(t=>t.id!==e.id)).catch(()=>{})},children:i.jsx(S,{size:15})})]},e.id)),i.jsx("div",{className:"computer-menu-divider"}),(0,i.jsxs)("button",{type:"button",className:"computer-menu-item",onClick:()=>R("tools"),children:[i.jsx(O,{size:17}),i.jsx("span",{children:"配置顶部工具"}),i.jsx(F,{size:16})]})]}),"tools"===C&&i.jsx("div",{className:"computer-tools-list",children:en.map(({id:e,name:t,Icon:r})=>(0,i.jsxs)("label",{className:"computer-tool-option",children:[i.jsx(r,{size:17,"aria-hidden":"true"}),i.jsx("span",{children:t}),i.jsx("input",{type:"checkbox","aria-label":`显示${t}`,checked:c.settings.visibleTools.includes(e),disabled:!c.loaded||c.saving,onChange:t=>{let r=c.settings.visibleTools;c.setVisibleTools(t.target.checked?[...r,e]:r.filter(t=>t!==e)).catch(()=>{})}})]},e))}),"computers"!==C&&i.jsx("p",{className:"computer-save-status",role:"status",children:c.loaded?c.saving?"正在保存…":c.notice:c.error?"配置尚未加载":"正在读取电脑配置…"}),c.error&&"computers"!==C&&(0,i.jsxs)(i.Fragment,{children:[i.jsx("p",{className:"computer-error",role:"alert",children:c.error}),(0,i.jsxs)("button",{type:"button",className:"computer-menu-item",onClick:()=>{c.reload()},children:[i.jsx(g,{size:16}),i.jsx("span",{children:"重新加载配置"})]})]}),X&&i.jsx("p",{className:"computer-error",role:"alert",children:X})]})}),w),q&&w&&(0,z.createPortal)(i.jsx(es,{mode:q,currentName:ed?.name||"",onClose:ef,onNavigate:eb,onRename:em}),w),V&&w&&(0,z.createPortal)(i.jsx(et,{computerName:V.computer.name,page:V.page,onClose:ep,onSave:async e=>{if(V.page&&!eu.some(t=>t.id===e.id))throw Error("这个页面已在其他设备删除,请重新添加。");await c.setSavedPages(V.page?eu.map(t=>t.id===e.id?e:t):[...eu,e]),ep()}}),w)]})}function es({mode:e,currentName:t,onClose:r,onNavigate:a,onRename:n}){let[o,s]=(0,d.useState)("rename"===e?t:""),l=(0,d.useRef)(o);l.current=o;let[c,u]=(0,d.useState)(""),[f,p]=(0,d.useState)(""),[b,m]=(0,d.useState)(!1),[h,x]=(0,d.useState)(!1),[g,y]=(0,d.useState)(!1),[w,v]=(0,d.useState)(!1),k=(0,d.useRef)(null),j=(0,d.useRef)(null),z=(0,d.useRef)(0),C=(0,d.useRef)(null),N=(0,d.useRef)(null),R=(0,d.useRef)(null),T=(0,d.useCallback)(async e=>{m(!0),R.current?.stop(),x(!1),p("");try{await a(e,l.current)}catch(e){p(e.message)}finally{m(!1)}},[a]);return i.jsx("div",{className:"computer-dialog-backdrop","data-toolbar-overlay":!0,onClick:e=>{e.target===e.currentTarget&&r()},children:(0,i.jsxs)("section",{ref:N,className:"computer-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"computer-dialog-title",children:[(0,i.jsxs)("div",{className:"computer-dialog-heading",children:[i.jsx("h2",{id:"computer-dialog-title",children:"add"===e?"添加电脑":"修改电脑名称"}),i.jsx("button",{type:"button",className:"computer-close","aria-label":"关闭",onClick:r,children:i.jsx(S,{size:20})})]}),(0,i.jsxs)("form",{onSubmit:async t=>{if(t.preventDefault(),!b){if("add"===e)await T(c);else{m(!0);try{await n(o.trim())}catch(e){p(e.message)}finally{m(!1)}}}},children:[(0,i.jsxs)("label",{htmlFor:"computer-name",children:["电脑名称","add"===e?"(选填)":""]}),i.jsx("input",{ref:C,id:"computer-name",maxLength:60,value:o,required:"rename"===e,disabled:b,onChange:e=>s(e.target.value),placeholder:"例如:A 电脑 / 家里的电脑",autoComplete:"off"}),"add"===e&&(0,i.jsxs)(i.Fragment,{children:[i.jsx("p",{className:"computer-hint",children:"扫描另一台电脑上的 AgentRoam 授权二维码,连接后会保留已有电脑。"}),i.jsx("input",{ref:j,type:"file",accept:"image/*",capture:"environment",hidden:!0,"aria-label":"拍摄授权二维码",onChange:async e=>{let t=e.currentTarget.files?.[0];if(e.currentTarget.value="",!t)return;let r=++z.current;R.current?.stop(),x(!1),v(!0),p("");try{let e=await ei(t);r===z.current&&T(e)}catch(e){r===z.current&&p(e.message)}finally{r===z.current&&v(!1)}}}),i.jsx("video",{ref:k,playsInline:!0,muted:!0,hidden:!h,"aria-label":"扫码相机画面"}),(0,i.jsxs)("button",{className:"computer-action",type:"button",disabled:w,onClick:()=>{p(""),h?(R.current?.stop(),x(!1)):window.isSecureContext&&navigator.mediaDevices?.getUserMedia?(x(!0),R.current?.start()):j.current?.click()},children:[i.jsx(D,{size:17,"aria-hidden":"true"}),w?"正在识别二维码…":h?"取消扫码":g?"打开相机扫码":"拍照扫码"]}),g&&i.jsx("button",{className:"computer-action",type:"button",disabled:w,onClick:()=>{R.current?.stop(),x(!1),j.current?.click()},children:"拍照识别二维码"}),i.jsx("label",{htmlFor:"computer-link",children:"或粘贴授权二维码链接"}),i.jsx("input",{id:"computer-link",value:c,onChange:e=>u(e.target.value),placeholder:"http(s)://…/pair#pair=…",autoComplete:"off",spellCheck:!1})]}),f&&i.jsx("p",{className:"computer-error",role:"alert",children:f}),i.jsx("button",{className:"computer-action computer-primary",type:"submit",disabled:b||("add"===e?!c.trim()||w:!o.trim()),children:"add"===e?"连接这台电脑":b?"正在保存…":"保存名称"})]})]})})}let el=`
|
|
296
296
|
.computer-menu-backdrop{position:fixed;inset:0;z-index:10000}
|
|
297
297
|
.computer-menu-heading{display:flex;align-items:center;gap:4px;padding:2px 4px}.computer-menu-heading>strong{flex:1;min-width:0;font-size:14px;font-weight:500;overflow-wrap:anywhere}.computer-menu-heading>.computer-current{flex:1;min-width:0}.computer-menu-heading>.computer-close{flex-shrink:0}
|
|
298
298
|
.computer-menu-grip{display:none}.computer-pages-heading{display:flex;align-items:center;justify-content:space-between}.computer-tool-option{display:flex;align-items:center;gap:12px;min-height:44px;padding:8px 12px;cursor:pointer}.computer-tool-option span{flex:1;font-size:14px}.computer-tool-option input{width:18px;height:18px;accent-color:var(--ui-tab-accent,#7aa2f7)}.computer-tool-option svg{flex-shrink:0}.computer-save-status{margin:6px 10px 2px;line-height:18px;color:var(--ui-muted-text,#999dab);font-size:12px}.computer-save-status:empty{display:none}.computer-menu button:disabled,.computer-tool-option:has(input:disabled){opacity:.55;cursor:default}
|
|
@@ -323,4 +323,4 @@
|
|
|
323
323
|
.computer-dialog select{width:100%;padding:11px 8px;border:1px solid var(--ui-panel-input-border,#30303a);border-radius:8px;background:var(--ui-panel-input-bg,#0f0f15);color:inherit;font:inherit;font-size:14px}
|
|
324
324
|
.computer-hint{color:var(--ui-muted-text,#999dab);font-size:13px;line-height:1.7}.computer-action{display:flex;align-items:center;justify-content:center;gap:8px;width:100%;padding:12px;margin-top:12px;border:1px solid var(--ui-panel-input-border,#30303a);border-radius:8px;background:var(--ui-tab-bg,#1b1e28);color:inherit;font:inherit;cursor:pointer}.computer-primary{background:var(--ui-tab-accent,#7aa2f7);color:var(--ui-root-bg,#0b0b10);border-color:transparent}.computer-action:disabled{opacity:.45;cursor:default}.computer-error{font-size:13px;line-height:1.6;color:var(--ui-danger,#ffb2a7);padding:0 8px}
|
|
325
325
|
@media(pointer:coarse){.computer-menu-item{min-height:44px}.computer-close{width:44px;height:44px}.computer-page-control{height:44px;flex-basis:36px;width:36px}}
|
|
326
|
-
`;var ec=r(1321),ed=r.n(ec);function eu({label:e="FLOW STUDIO",title:t="正在打开 Flow Studio",caption:r="即将进入你的创作空间",icon:a=i.jsx(k,{size:36,strokeWidth:1.5})}={}){return(0,i.jsxs)("div",{role:"status","aria-live":"polite",className:"jsx-f8b6a4420911d242 flow-loading",children:[(0,i.jsxs)("div",{"aria-hidden":"true",className:"jsx-f8b6a4420911d242 flow-loader-art",children:[i.jsx("div",{className:"jsx-f8b6a4420911d242 flow-loader-halo"}),i.jsx("div",{className:"jsx-f8b6a4420911d242 flow-loader-orbit orbit-outer",children:i.jsx("i",{className:"jsx-f8b6a4420911d242"})}),i.jsx("div",{className:"jsx-f8b6a4420911d242 flow-loader-orbit orbit-inner",children:i.jsx("i",{className:"jsx-f8b6a4420911d242"})}),i.jsx("div",{className:"jsx-f8b6a4420911d242 flow-loader-core",children:a}),i.jsx("span",{className:"jsx-f8b6a4420911d242 flow-loader-node node-one"}),i.jsx("span",{className:"jsx-f8b6a4420911d242 flow-loader-node node-two"}),i.jsx("span",{className:"jsx-f8b6a4420911d242 flow-loader-node node-three"})]}),(0,i.jsxs)("div",{className:"jsx-f8b6a4420911d242 flow-loader-copy",children:[i.jsx("span",{className:"jsx-f8b6a4420911d242 flow-loader-label",children:e}),i.jsx("strong",{className:"jsx-f8b6a4420911d242",children:t}),i.jsx("span",{className:"jsx-f8b6a4420911d242 flow-loader-caption",children:r})]}),i.jsx("div",{"aria-hidden":"true",className:"jsx-f8b6a4420911d242 flow-loader-track",children:i.jsx("span",{className:"jsx-f8b6a4420911d242"})}),i.jsx(ed(),{id:"f8b6a4420911d242",children:".flow-loading.jsx-f8b6a4420911d242{position:absolute;inset:0;display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;-moz-box-orient:vertical;-moz-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-align:center;-webkit-align-items:center;-moz-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-moz-box-pack:center;-ms-flex-pack:center;justify-content:center;overflow:hidden;gap:26px;color:var(--ui-text,#e5e7eb);background:var(--ui-term-col-bg,#101014);-webkit-animation:flow-appear 280ms ease-out both;-moz-animation:flow-appear 280ms ease-out both;-o-animation:flow-appear 280ms ease-out both;animation:flow-appear 280ms ease-out both}.flow-loader-art.jsx-f8b6a4420911d242{position:relative;width:200px;height:200px;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0}.flow-loader-halo.jsx-f8b6a4420911d242{position:absolute;inset:-40px;-webkit-border-radius:50%;-moz-border-radius:50%;border-radius:50%;background:-webkit-radial-gradient(circle,#54e5cf26,#54e5cf08 45%,transparent 70%);background:-moz-radial-gradient(circle,#54e5cf26,#54e5cf08 45%,transparent 70%);background:-o-radial-gradient(circle,#54e5cf26,#54e5cf08 45%,transparent 70%);background:radial-gradient(circle,#54e5cf26,#54e5cf08 45%,transparent 70%);-webkit-animation:flow-breathe 3s ease-in-out infinite;-moz-animation:flow-breathe 3s ease-in-out infinite;-o-animation:flow-breathe 3s ease-in-out infinite;animation:flow-breathe 3s ease-in-out infinite}.flow-loader-orbit.jsx-f8b6a4420911d242{position:absolute;-webkit-border-radius:50%;-moz-border-radius:50%;border-radius:50%;border:1px solid#54e5cf26}.orbit-outer.jsx-f8b6a4420911d242{inset:8px;border-top-color:#54e5cf;border-right-color:#54e5cf70;-webkit-animation:flow-orbit 3.2s linear infinite;-moz-animation:flow-orbit 3.2s linear infinite;-o-animation:flow-orbit 3.2s linear infinite;animation:flow-orbit 3.2s linear infinite}.orbit-inner.jsx-f8b6a4420911d242{inset:30px;border-bottom-color:#8bbcff;border-left-color:#8bbcff60;animation:flow-orbit 2.4s linear infinite reverse}.flow-loader-orbit.jsx-f8b6a4420911d242 i.jsx-f8b6a4420911d242{position:absolute;top:13%;left:13%;width:7px;height:7px;-webkit-border-radius:50%;-moz-border-radius:50%;border-radius:50%;background:#77f8df;-webkit-box-shadow:0 0 14px#54e5cf;-moz-box-shadow:0 0 14px#54e5cf;box-shadow:0 0 14px#54e5cf}.orbit-inner.jsx-f8b6a4420911d242 i.jsx-f8b6a4420911d242{background:#8bbcff;-webkit-box-shadow:0 0 14px#8bbcff;-moz-box-shadow:0 0 14px#8bbcff;box-shadow:0 0 14px#8bbcff}.flow-loader-core.jsx-f8b6a4420911d242{position:absolute;inset:62px;display:grid;-webkit-box-align:center;-webkit-align-items:center;-moz-box-align:center;-ms-flex-align:center;align-items:center;justify-items:center;place-items:center;-webkit-border-radius:24px;-moz-border-radius:24px;border-radius:24px;color:#64e9d3;border:1px solid#54e5cf66;background:-webkit-linear-gradient(305deg,#54e5cf20,#8bbcff0d);background:-moz-linear-gradient(305deg,#54e5cf20,#8bbcff0d);background:-o-linear-gradient(305deg,#54e5cf20,#8bbcff0d);background:linear-gradient(145deg,#54e5cf20,#8bbcff0d);-webkit-box-shadow:0 0 35px#54e5cf15,inset 0 0 18px#54e5cf0d;-moz-box-shadow:0 0 35px#54e5cf15,inset 0 0 18px#54e5cf0d;box-shadow:0 0 35px#54e5cf15,inset 0 0 18px#54e5cf0d;-webkit-animation:flow-breathe 3s ease-in-out infinite;-moz-animation:flow-breathe 3s ease-in-out infinite;-o-animation:flow-breathe 3s ease-in-out infinite;animation:flow-breathe 3s ease-in-out infinite}.flow-loader-node.jsx-f8b6a4420911d242{position:absolute;width:5px;height:5px;-webkit-border-radius:50%;-moz-border-radius:50%;border-radius:50%;background:#8bbcff;-webkit-animation:flow-node 2s ease-in-out infinite;-moz-animation:flow-node 2s ease-in-out infinite;-o-animation:flow-node 2s ease-in-out infinite;animation:flow-node 2s ease-in-out infinite}.node-one.jsx-f8b6a4420911d242{left:0;top:100px}.node-two.jsx-f8b6a4420911d242{right:17px;top:38px;-webkit-animation-delay:.5s;-moz-animation-delay:.5s;-o-animation-delay:.5s;animation-delay:.5s}.node-three.jsx-f8b6a4420911d242{bottom:9px;right:57px;-webkit-animation-delay:1s;-moz-animation-delay:1s;-o-animation-delay:1s;animation-delay:1s}.flow-loader-copy.jsx-f8b6a4420911d242{display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;-moz-box-orient:vertical;-moz-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-align:center;-webkit-align-items:center;-moz-box-align:center;-ms-flex-align:center;align-items:center;gap:10px;text-align:center;padding:0 20px}.flow-loader-label.jsx-f8b6a4420911d242{font:10px ui-monospace,monospace;letter-spacing:.3em;color:#64cbbb}.flow-loader-copy.jsx-f8b6a4420911d242 strong.jsx-f8b6a4420911d242{font-size:18px;font-weight:500;letter-spacing:.02em}.flow-loader-caption.jsx-f8b6a4420911d242{font-size:12px;color:var(--ui-text-muted,#9399aa)}.flow-loader-track.jsx-f8b6a4420911d242{width:128px;height:2px;overflow:hidden;background:#54e5cf20;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px}.flow-loader-track.jsx-f8b6a4420911d242 span.jsx-f8b6a4420911d242{display:block;width:45%;height:100%;background:-webkit-linear-gradient(left,transparent,#64e9d3,#8bbcff);background:-moz-linear-gradient(left,transparent,#64e9d3,#8bbcff);background:-o-linear-gradient(left,transparent,#64e9d3,#8bbcff);background:linear-gradient(90deg,transparent,#64e9d3,#8bbcff);-webkit-animation:flow-travel 1.8s ease-in-out infinite;-moz-animation:flow-travel 1.8s ease-in-out infinite;-o-animation:flow-travel 1.8s ease-in-out infinite;animation:flow-travel 1.8s ease-in-out infinite}@-webkit-keyframes flow-orbit{to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@-moz-keyframes flow-orbit{to{-moz-transform:rotate(360deg);transform:rotate(360deg)}}@-o-keyframes flow-orbit{to{-o-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes flow-orbit{to{-webkit-transform:rotate(360deg);-moz-transform:rotate(360deg);-o-transform:rotate(360deg);transform:rotate(360deg)}}@-webkit-keyframes flow-breathe{50%{-webkit-transform:scale(1.05);transform:scale(1.05);opacity:.7}}@-moz-keyframes flow-breathe{50%{-moz-transform:scale(1.05);transform:scale(1.05);opacity:.7}}@-o-keyframes flow-breathe{50%{-o-transform:scale(1.05);transform:scale(1.05);opacity:.7}}@keyframes flow-breathe{50%{-webkit-transform:scale(1.05);-moz-transform:scale(1.05);-o-transform:scale(1.05);transform:scale(1.05);opacity:.7}}@-webkit-keyframes flow-node{50%{opacity:.25;-webkit-transform:scale(.65);transform:scale(.65)}}@-moz-keyframes flow-node{50%{opacity:.25;-moz-transform:scale(.65);transform:scale(.65)}}@-o-keyframes flow-node{50%{opacity:.25;-o-transform:scale(.65);transform:scale(.65)}}@keyframes flow-node{50%{opacity:.25;-webkit-transform:scale(.65);-moz-transform:scale(.65);-o-transform:scale(.65);transform:scale(.65)}}@-webkit-keyframes flow-travel{from{-webkit-transform:translatex(-110%);transform:translatex(-110%)}to{-webkit-transform:translatex(330%);transform:translatex(330%)}}@-moz-keyframes flow-travel{from{-moz-transform:translatex(-110%);transform:translatex(-110%)}to{-moz-transform:translatex(330%);transform:translatex(330%)}}@-o-keyframes flow-travel{from{-o-transform:translatex(-110%);transform:translatex(-110%)}to{-o-transform:translatex(330%);transform:translatex(330%)}}@keyframes flow-travel{from{-webkit-transform:translatex(-110%);-moz-transform:translatex(-110%);-o-transform:translatex(-110%);transform:translatex(-110%)}to{-webkit-transform:translatex(330%);-moz-transform:translatex(330%);-o-transform:translatex(330%);transform:translatex(330%)}}@-webkit-keyframes flow-appear{from{opacity:0}to{opacity:1}}@-moz-keyframes flow-appear{from{opacity:0}to{opacity:1}}@-o-keyframes flow-appear{from{opacity:0}to{opacity:1}}@keyframes flow-appear{from{opacity:0}to{opacity:1}}@media(max-height:420px){.flow-loading.jsx-f8b6a4420911d242{gap:12px}.flow-loader-art.jsx-f8b6a4420911d242{width:200px;height:200px;zoom:.65}}@media(prefers-reduced-motion:reduce){.flow-loading.jsx-f8b6a4420911d242,.flow-loader-halo.jsx-f8b6a4420911d242,.flow-loader-orbit.jsx-f8b6a4420911d242,.flow-loader-core.jsx-f8b6a4420911d242,.flow-loader-node.jsx-f8b6a4420911d242,.flow-loader-track.jsx-f8b6a4420911d242 span.jsx-f8b6a4420911d242{-webkit-animation:none;-moz-animation:none;-o-animation:none;animation:none}}"})]})}function ep({page:e,reloadKey:t}){let[r,a]=(0,d.useState)(!0),[n,o]=(0,d.useState)(!1);return!function(e){let t=new URL(e).hostname;return"qoder.com"===t||t.endsWith(".qoder.com")}(e.url)?(0,i.jsxs)("main",{className:"computer-page-pane","aria-label":e.name,"aria-busy":r,children:[i.jsx("iframe",{title:e.name,src:e.url,referrerPolicy:"no-referrer",allow:"clipboard-read; clipboard-write; microphone; camera",sandbox:"allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox allow-downloads allow-modals",onLoad:()=>a(!1),onError:()=>{a(!1),o(!0)},style:{visibility:r?"hidden":"visible"}},`${e.id}:${t}`),r&&i.jsx(eu,{label:"REMOTE PAGE",title:`正在打开 ${e.name}`,caption:"正在连接页面",icon:i.jsx(B,{size:36,strokeWidth:1.5})}),n&&i.jsx("a",{className:"computer-page-fallback",href:e.url,target:"_blank",rel:"noopener noreferrer",children:"打开原页面"})]}):(0,i.jsxs)("main",{className:"computer-page-blocked",children:[i.jsx(B,{size:36,strokeWidth:1.5,"aria-hidden":"true"}),(0,i.jsxs)("h2",{children:[e.name," 不允许内嵌"]}),i.jsx("p",{children:"这个网站限制了当前页面打开。可以在新页面使用,也可以在电脑菜单中修改打开方式。"}),(0,i.jsxs)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",children:[i.jsx(x,{size:16,"aria-hidden":"true"}),"打开新页面"]})]})}let ef=m("ChevronsRight",[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]),eb=m("ChevronsLeft",[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]]);function em({items:e,avatar:t}){let r=(0,d.useRef)(null),a=(0,d.useRef)(null),n=(0,d.useRef)(null),o=(0,d.useRef)(null),s=(0,d.useRef)(null),l=(0,d.useRef)(new Map),[c,u]=(0,d.useState)(null),[p,f]=(0,d.useState)(!1),[b,m]=(0,d.useState)(!1),[h,x]=(0,d.useState)({top:-1e3,left:0}),[g,w]=(0,d.useState)({fullFits:!1,inlineIndices:[],overflowIndices:[]}),y=new Set(g.inlineIndices),v=g.fullFits||p,k=v&&g.overflowIndices.length>0;(0,d.useLayoutEffect)(()=>{let t=r.current?.closest(".terminal-tabs"),i=t?.querySelector(".terminal-tab-list"),s=r.current?.closest(".terminal-connection");if(!t||!i||!s||!c)return;let d=0,u=()=>{let r=getComputedStyle(t),o=getComputedStyle(s),c=getComputedStyle(i),d=Array.from(i.children),u=d.reduce((e,t)=>e+t.offsetWidth,0)+Math.max(0,d.length-1)*(parseFloat(c.columnGap)||0),f=(parseFloat(r.paddingLeft)||0)+(parseFloat(r.paddingRight)||0)+(parseFloat(o.paddingLeft)||0)+(parseFloat(o.paddingRight)||0)+2*(parseFloat(r.columnGap)||0)+(t.querySelector(".terminal-add")?.offsetWidth??30),b=t.clientWidth-f,h=function(e){let t=e.toolWidths.flatMap((e,t)=>e>0?[t]:[]),r=t=>t.reduce((t,r)=>t+e.toolWidths[r],0)+t.length*e.gap,a=r(t)+e.avatarWidth<=e.fullAvailableWidth;if(a)return{fullFits:a,inlineIndices:t,overflowIndices:[]};if(!e.expanded)return{fullFits:a,inlineIndices:[],overflowIndices:t};let i=e.availableWidth-e.avatarWidth-e.toggleWidth;if(r(t)<=i)return{fullFits:a,inlineIndices:t,overflowIndices:[]};let n=[];for(let a of t){if(r([...n,a])>i-e.toggleWidth)break;n.push(a)}return{fullFits:a,inlineIndices:n,overflowIndices:t.slice(n.length)}}({toolWidths:e.map(e=>l.current.get(e.id)?.offsetWidth??0),fullAvailableWidth:b-u,availableWidth:b-Math.min(u,Math.max(64,Math.min(130,t.clientWidth/4))),avatarWidth:a.current?.offsetWidth??44,toggleWidth:n.current?.offsetWidth??40,gap:0,expanded:p});w(e=>JSON.stringify(e)===JSON.stringify(h)?e:h),(h.fullFits||!p||0===h.overflowIndices.length)&&m(!1)},f=()=>{cancelAnimationFrame(d),d=requestAnimationFrame(u)},b=new ResizeObserver(f);for(let e of[t,i,r.current,o.current,...l.current.values()])e&&b.observe(e);let h=new MutationObserver(f);return h.observe(i,{childList:!0,subtree:!0,characterData:!0}),o.current&&h.observe(o.current,{childList:!0,subtree:!0}),u(),()=>{cancelAnimationFrame(d),b.disconnect(),h.disconnect()}},[p,c,e.map(e=>e.id).join(","),g.inlineIndices.join(",")]),(0,d.useLayoutEffect)(()=>{if(!b)return;let e=()=>{let e=s.current?.getBoundingClientRect();if(!e)return;let t=Math.min(292,innerWidth-16),a=r.current?.closest(".terminal-tabs")?.getBoundingClientRect().bottom??e.bottom;x({top:Math.max(e.bottom,a)+6,left:Math.max(8,Math.min(innerWidth-t-8,e.right-t))})};return e(),window.addEventListener("resize",e),window.addEventListener("scroll",e,!0),()=>{window.removeEventListener("resize",e),window.removeEventListener("scroll",e,!0)}},[b,g.inlineIndices.join(",")]);let j=e=>i.jsx("div",{className:"toolbar-slot","data-toolbar-item":e.id,ref:t=>{t?l.current.set(e.id,t):l.current.delete(e.id)},children:e.content},e.id);return(0,i.jsxs)("div",{ref:r,className:"responsive-toolbar","data-toolbar-expanded":v,children:[i.jsx("span",{ref:n,className:"file-drawer-toggle toolbar-size-measure","aria-hidden":"true"}),k&&i.jsx("button",{ref:s,type:"button",className:"file-drawer-toggle toolbar-overflow-toggle","aria-label":"更多工具",title:"更多工具","aria-haspopup":"dialog","aria-expanded":b,onClick:()=>m(e=>!e),children:i.jsx(I,{size:17,"aria-hidden":"true"})}),g.inlineIndices.length>0&&i.jsx("div",{className:"toolbar-tools toolbar-tools-inline",children:e.filter((e,t)=>y.has(t)).map(j)}),e.length>0&&!g.fullFits&&i.jsx("button",{type:"button",className:"file-drawer-toggle toolbar-more","aria-label":p?"收起顶部工具":"展开顶部工具",title:p?"收起工具":"展开工具","aria-expanded":p,onClick:()=>{f(e=>!e),m(!1)},children:p?i.jsx(ef,{size:17,"aria-hidden":"true"}):i.jsx(eb,{size:17,"aria-hidden":"true"})}),i.jsx("div",{ref:a,className:"toolbar-avatar",onPointerDown:()=>m(!1),children:t}),c&&(0,z.createPortal)(i.jsx("div",{ref:o,className:"toolbar-overflow theme-popover",role:"dialog","aria-label":"更多工具菜单","data-toolbar-overlay":!0,"aria-hidden":!b,style:{position:"fixed",top:b?h.top:-1e3,left:b?h.left:0,zIndex:200,width:Math.min(292,innerWidth-16),visibility:b?"visible":"hidden",boxSizing:"border-box",maxHeight:"calc(100dvh - 60px)",overflowY:"auto",padding:8,borderRadius:10,border:"1px solid var(--ui-tabbar-border, #282b36)",background:"var(--ui-tab-active-bg, #262b38)",boxShadow:"0 10px 28px rgba(0,0,0,.45)"},children:i.jsx("div",{className:"toolbar-tools toolbar-tools-expanded",children:e.filter((e,t)=>!y.has(t)).map(j)})}),c)]})}let eh=["refresh","collaboration","remote","theme","files","ai-hub","flow","install"],ex=["refresh","remote","theme","files"];function eg(e){if(!Array.isArray(e)||e.length>eh.length||e.some(e=>!eh.includes(e)))throw Error("顶部工具包含未知选项。");if(new Set(e).size!==e.length)throw Error("顶部工具不能重复。");return eh.filter(t=>e.includes(t))}function ew(e){if(!Array.isArray(e)||e.length>20)throw Error("每台电脑最多可添加 20 个页面。");let t=new Set;return e.map(e=>{let r;if(!e||"string"!=typeof e.id||!/^[A-Za-z0-9_-]{1,80}$/.test(e.id)||t.has(e.id))throw Error("页面标识无效或重复。");if("string"!=typeof e.name||!e.name.trim()||e.name.trim().length>60)throw Error("页面名称需为 1–60 个字符。");if(!["current","new-tab"].includes(e.openMode))throw Error("页面打开方式无效。");if("string"!=typeof e.url||e.url.length>8192)throw Error("请填写有效的 http(s) 页面地址。");try{r=new URL(e.url.trim())}catch{throw Error("请填写有效的 http(s) 页面地址。")}if(!["http:","https:"].includes(r.protocol)||r.username||r.password)throw Error("请填写无账号密码的 http(s) 页面地址。");return t.add(e.id),{id:e.id,name:e.name.trim(),url:r.href,openMode:e.openMode}})}class ey extends Error{constructor(e,t){super(e),this.status=t}}async function ev(e,t){let r=await fetch("/api/web-console/computer-settings",{method:t?"PATCH":"GET",credentials:"same-origin",cache:"no-store",headers:t?{"content-type":"application/json","x-csrf-token":e}:void 0,body:t?JSON.stringify(t):void 0,signal:AbortSignal.timeout(15e3)}).catch(e=>{throw Error(e?.name==="TimeoutError"?"电脑响应超时,请检查连接后重试。":"无法连接当前电脑,请检查连接后重试。")}),a=await r.json().catch(()=>null);if(!r.ok)throw new ey(a?.error?.message??"电脑配置保存失败,请检查连接后重试。",r.status);if(!a?.settings||!Number.isSafeInteger(a.settings.revision))throw Error("无法读取电脑配置,请重新加载。");return{...a.settings,visibleTools:eg(a.settings.visibleTools),savedPages:null===a.settings.savedPages?null:ew(a.settings.savedPages)}}let ek=["codex","claude agents","opencode","agent-tui"],ej={watcherFrame:4,producerFrame:5};function eS({ready:e=!1,error:t,onRetry:r}){let[a]=(0,d.useState)(Date.now),[n,o]=(0,d.useState)(Date.now),s=t||"数字人核心正在就绪";return(0,i.jsxs)("main",{className:`neural-boot${e?" is-ready":""}${t?" is-error":""}`,role:t?"alert":"status","aria-live":"polite","aria-busy":!e&&!t,"aria-hidden":e,children:[i.jsx("div",{className:"neural-grid","aria-hidden":"true"}),i.jsx("div",{className:"neural-rail neural-rail-left","aria-hidden":"true"}),i.jsx("div",{className:"neural-rail neural-rail-right","aria-hidden":"true"}),(0,i.jsxs)("section",{className:"neural-content",children:[(0,i.jsxs)("div",{className:"neural-brand","aria-hidden":"true",children:[i.jsx("span",{className:"neural-brand-signal"}),i.jsx("span",{children:"AgentRoam"}),i.jsx("small",{children:"NEURAL LINK"})]}),(0,i.jsxs)("div",{className:"neural-portrait","aria-hidden":"true",children:[i.jsx("span",{className:"neural-ring neural-ring-outer"}),i.jsx("span",{className:"neural-ring neural-ring-inner"}),i.jsx("span",{className:"neural-axis neural-axis-x"}),i.jsx("span",{className:"neural-axis neural-axis-y"}),i.jsx("span",{className:"neural-node neural-node-one"}),i.jsx("span",{className:"neural-node neural-node-two"}),i.jsx("span",{className:"neural-node neural-node-three"}),i.jsx("span",{className:"neural-node neural-node-four"}),i.jsx("div",{className:"neural-avatar-frame",children:(0,i.jsxs)("div",{className:"neural-avatar",children:[i.jsx(k,{className:"neural-avatar-icon",size:66,strokeWidth:1.3}),i.jsx("span",{className:"neural-visor"})]})})]}),(0,i.jsxs)("div",{className:"neural-copy",children:[i.jsx("strong",{children:"正在唤醒工作区"}),i.jsx("span",{children:s})]}),i.jsx("div",{className:"neural-progress","aria-hidden":"true",children:i.jsx("span",{})}),(0,i.jsxs)("div",{className:"neural-meta","aria-hidden":"true",children:[i.jsx("span",{children:"AGENT CORE"}),(0,i.jsxs)("span",{className:"neural-meta-time",children:["T+",Math.max(0,Math.floor((n-a)/1e3)).toString().padStart(2,"0"),"S"]})]}),t&&i.jsx("button",{type:"button",className:"neural-retry","aria-label":"重试连接",title:"重试连接",onClick:()=>r?.(),children:i.jsx(g,{size:18,"aria-hidden":"true"})})]})]})}function ez({children:e}){let t=function(){let[e,t]=(0,d.useState)("loading"),[r,a]=(0,d.useState)(null),[i]=(0,d.useState)("same-origin"),[n,o]=(0,d.useState)(null),s=(0,d.useCallback)(async()=>{t("loading"),o(null);try{let e=await fetch("/api/web-console/bootstrap",{credentials:"same-origin",cache:"no-store"});if(401===e.status||423===e.status){window.location.reload();return}if(!e.ok)throw Error(`HTTP ${e.status}`);let r=await e.json();a(r.user),t("authenticated")}catch{o("无法连接远程控制台"),t("needsLogin")}},[]),l=(0,d.useCallback)(async()=>{let e=await fetch("/api/web-console/bootstrap",{credentials:"same-origin",cache:"no-store"});if((401===e.status||423===e.status)&&window.location.reload(),!e.ok)throw Error("bootstrap failed");let r=await e.json();return a(r.user),t("authenticated"),r.wsNonce},[]),c=(0,d.useCallback)(async()=>(window.location.reload(),!1),[]);return{status:e,user:r,error:n,csrfToken:i,setup:c,login:c,logout:(0,d.useCallback)(async()=>{let e=await fetch("/api/pairing/logout",{method:"POST",credentials:"same-origin"});e.ok||401===e.status||423===e.status?window.location.reload():o("退出失败,请重试")},[]),refresh:s,getWsNonce:l}}(),[r,a]=(0,d.useState)(!1),n="authenticated"===t.status,o=(0,d.useCallback)(()=>a(!0),[]);return(0,i.jsxs)(i.Fragment,{children:[n?e(t,o):null,i.jsx(eS,{ready:n&&r,error:t.error,onRetry:()=>void t.refresh()})]})}let eC=m("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]),eN=m("TextCursorInput",[["path",{d:"M5 4h1a3 3 0 0 1 3 3 3 3 0 0 1 3-3h1",key:"18xjzo"}],["path",{d:"M13 20h-1a3 3 0 0 1-3-3 3 3 0 0 1-3 3H5",key:"fj48gi"}],["path",{d:"M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1",key:"1n9rhb"}],["path",{d:"M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7",key:"13ksps"}],["path",{d:"M9 7v10",key:"1vc8ob"}]]),eR=m("Pin",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]),eT=m("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);function eE(e,t,r){let a=e.findIndex(e=>e.id===t),i=e.findIndex(e=>e.id===r);if(a<0||i<0||a===i)return[...e];let n=[...e],[o]=n.splice(a,1);return n.splice(i,0,o),n}function eM(e,t="function"==typeof crypto.randomUUID?crypto.randomUUID():Array.from(crypto.getRandomValues(new Uint8Array(16)),e=>e.toString(16).padStart(2,"0")).join("")){return{id:t,command:e.trim()}}function eP({commands:e,onChange:t,onExecute:r}){let[a,n]=(0,d.useState)(null),[o,s]=(0,d.useState)(""),[l,c]=(0,d.useState)(null),u=(0,d.useRef)(null),p=()=>{if(!a)return;let r=a.value.trim();return r?r.length>1e3?s("命令最多 1000 个字符"):/[\r\n\0]/.test(r)?s("命令只能包含一行"):void(a.id?t(e.map(e=>e.id===a.id?{...e,command:r}:e)):t([...e,eM(r)]),n(null),s("")):s("命令不能为空")},f=(e,t)=>{e.preventDefault(),e.stopPropagation(),u.current=t,c(t),e.currentTarget.setPointerCapture(e.pointerId)},b=r=>{if(!u.current)return;let a=document.elementFromPoint(r.clientX,r.clientY)?.closest("[data-pinned-id]"),i=a?.dataset.pinnedId;i&&i!==u.current&&t(eE(e,u.current,i))},m=e=>{e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),u.current=null,c(null)},h=(r,a)=>{if("ArrowUp"!==r.key&&"ArrowDown"!==r.key)return;r.preventDefault();let i=e.findIndex(e=>e.id===a),n=e[i+("ArrowUp"===r.key?-1:1)];n&&t(eE(e,a,n.id))};return(0,i.jsxs)("section",{className:"pinned-commands","aria-labelledby":"pinned-command-title",children:[(0,i.jsxs)("div",{className:"pinned-command-head",children:[i.jsx("span",{id:"pinned-command-title",children:"置顶命令"}),i.jsx("button",{className:"history-icon-button",onClick:()=>{n({id:null,value:""}),s("")},"aria-label":"新增置顶命令",title:"新增置顶命令",children:i.jsx(N,{size:14,"aria-hidden":"true"})})]}),e.map(c=>a?.id===c.id?i.jsx(eI,{editor:a,error:o,onChange:e=>{n({...a,value:e}),s("")},onSave:p,onCancel:()=>{n(null),s("")}},c.id):(0,i.jsxs)("div",{className:`pinned-command-row${l===c.id?" pinned-command-dragging":""}`,"data-pinned-id":c.id,role:"button",tabIndex:0,onClick:()=>r(c.command),onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),r(c.command))},children:[i.jsx("button",{className:"pinned-command-grip",onPointerDown:e=>f(e,c.id),onPointerMove:b,onPointerUp:m,onPointerCancel:m,onKeyDown:e=>h(e,c.id),onClick:e=>e.stopPropagation(),"aria-label":`调整 ${c.command} 的顺序`,title:"拖动排序,或按上下方向键",children:i.jsx(eT,{size:14,"aria-hidden":"true"})}),i.jsx("code",{children:c.command}),(0,i.jsxs)("div",{className:"pinned-command-actions",onClick:e=>e.stopPropagation(),children:[i.jsx("button",{className:"history-icon-button",onClick:()=>{n({id:c.id,value:c.command}),s("")},"aria-label":`编辑 ${c.command}`,title:"编辑",children:i.jsx(_,{size:12,"aria-hidden":"true"})}),i.jsx("button",{className:"history-icon-button history-icon-danger",onClick:()=>t(e.filter(e=>e.id!==c.id)),"aria-label":`删除 ${c.command}`,title:"删除",children:i.jsx(L,{size:12,"aria-hidden":"true"})})]})]},c.id)),a?.id===null&&i.jsx(eI,{editor:a,error:o,onChange:e=>{n({...a,value:e}),s("")},onSave:p,onCancel:()=>{n(null),s("")}})]})}function eI({editor:e,error:t,onChange:r,onSave:a,onCancel:n}){return(0,i.jsxs)("div",{className:"pinned-command-editor",children:[i.jsx("input",{autoFocus:!0,value:e.value,maxLength:1e3,onChange:e=>r(e.target.value),onKeyDown:e=>{"Enter"===e.key&&a(),"Escape"===e.key&&n()},"aria-label":e.id?"编辑置顶命令":"新增置顶命令"}),i.jsx("button",{className:"history-icon-button",onClick:a,"aria-label":"保存命令",title:"保存",children:i.jsx(A,{size:13,"aria-hidden":"true"})}),i.jsx("button",{className:"history-icon-button",onClick:n,"aria-label":"取消编辑",title:"取消",children:i.jsx(S,{size:13,"aria-hidden":"true"})}),t&&i.jsx("small",{role:"alert",children:t})]})}async function eA(e){let t="undefined"==typeof navigator?void 0:navigator.clipboard;if("function"==typeof t?.writeText&&("undefined"==typeof isSecureContext||isSecureContext))try{return await t.writeText(e),!0}catch{}return function(e){if("undefined"==typeof document||!document.body||"function"!=typeof document.execCommand)return!1;let t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),Object.assign(t.style,{position:"fixed",top:"0",left:"-9999px",width:"1px",height:"1px",fontSize:"16px",opacity:"0",pointerEvents:"none"}),document.body.appendChild(t);try{return t.focus(),t.select(),t.setSelectionRange(0,t.value.length),document.execCommand("copy")}catch{return!1}finally{t.remove()}}(e)}function eL({csrfToken:e,terminalId:t,pinnedCommands:r,onPinnedCommandsChange:a,onFill:n,onExecute:o}){let[s,l]=(0,d.useState)([]),[c,u]=(0,d.useState)(""),[p,f]=(0,d.useState)(""),b=(0,d.useCallback)(async()=>{let e=new URLSearchParams({q:c,limit:"200"}),t=await fetch(`/api/web-console/history?${e}`,{credentials:"same-origin"});t.ok&&l((await t.json()).history)},[c]),m=async t=>{await fetch("/api/web-console/history",{method:"DELETE",credentials:"same-origin",headers:{"content-type":"application/json","x-csrf-token":e},body:JSON.stringify({id:t})}),b()},h=e=>{t&&n(e)},x=(0,d.useCallback)(e=>{"[REDACTED]"===e||r.some(t=>t.command===e)||a([...r,eM(e)])},[a,r]),w=async e=>{f(await eA(e)?"已复制命令":"复制失败,请长按命令手动复制")};return(0,i.jsxs)("div",{className:"history-panel",children:[i.jsx(eP,{commands:r,onChange:a,onExecute:o}),(0,i.jsxs)("div",{className:"history-search",children:[i.jsx("input",{value:c,onChange:e=>u(e.target.value),placeholder:"搜索命令"}),i.jsx("button",{className:"history-icon-button",onClick:b,"aria-label":"刷新历史",title:"刷新历史",children:i.jsx(g,{size:13,"aria-hidden":"true"})})]}),p&&i.jsx("div",{className:"terminal-clipboard-notice",role:"status",children:p}),s.map(e=>(0,i.jsxs)("div",{className:`history-item${t?"":" history-item-disabled"}`,role:"button",tabIndex:t?0:-1,onClick:()=>h(e.command),onKeyDown:r=>{r.target===r.currentTarget&&("Enter"===r.key||" "===r.key)&&t&&(r.preventDefault(),h(e.command))},children:[i.jsx("code",{children:e.command}),(0,i.jsxs)("small",{children:[e.cwd," \xb7 ",new Date(e.executedAt).toLocaleString()]}),(0,i.jsxs)("div",{className:"history-item-actions",onClick:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:[i.jsx("button",{className:"history-icon-button",onClick:()=>void w(e.command),"aria-label":"复制命令",title:"复制",children:i.jsx(eC,{size:12,"aria-hidden":"true"})}),i.jsx("button",{className:"history-icon-button",disabled:!t,onClick:()=>h(e.command),"aria-label":"填入命令",title:"填入",children:i.jsx(eN,{size:12,"aria-hidden":"true"})}),i.jsx("button",{className:"history-icon-button",disabled:"[REDACTED]"===e.command||r.some(t=>t.command===e.command),onClick:()=>x(e.command),"aria-label":"置顶命令",title:"置顶",children:i.jsx(eR,{size:12,"aria-hidden":"true"})}),i.jsx("button",{className:"history-icon-button history-icon-danger",onClick:()=>m(e.id),"aria-label":"删除历史",title:"删除",children:i.jsx(L,{size:12,"aria-hidden":"true"})})]})]},e.id)),!s.length&&i.jsx("div",{className:"history-empty",children:"暂无 Shell 命令历史"}),!t&&!!s.length&&i.jsx("div",{className:"history-empty",children:"请先打开一个终端页签"})]})}let e_=[{id:"pearl",label:"珍珠白",swatch:"#f5f6fa",preview:["#f5f6fa","#4f6ef7"],cssVars:{"--ui-color-scheme":"light","--ui-root-bg":"#f5f6fa","--ui-text":"#111827","--ui-tabbar-bg":"#eef0f6","--ui-tabbar-border":"#dfe3ee","--ui-tab-bg":"#e6e9f4","--ui-tab-text":"#5b6472","--ui-tab-active-bg":"#ffffff","--ui-tab-active-text":"#111827","--ui-tab-accent":"#4f6ef7","--ui-connection-bg":"#eef0f6","--ui-connection-text":"#9ca3af","--ui-tree-bg":"#fbfcfe","--ui-tree-border":"#e5e8f0","--ui-term-col-bg":"#f5f6fa","--ui-fab-bg":"#ffffff","--ui-fab-border":"#d8dcea","--ui-muted-surface":"#eef0f6","--ui-muted-border":"#d8dcea","--ui-muted-text":"#6b7280","--ui-panel-input-bg":"#ffffff","--ui-panel-input-text":"#111827","--ui-panel-input-border":"#d8dcea","--ui-drawer-tab-text":"#6b7280","--ui-drawer-tab-active":"#111827","--ui-history-item-text":"#1f2937","--ui-history-meta":"#9ca3af","--ui-success":"#059669","--ui-error":"#dc2626"},termHostBg:"#ffffff",keybar:{bg:"#eef0f6",border:"#dfe3ee",keyBg:"#ffffff",keyBorder:"#d8dcea",keyText:"#4b5563",accent:"#4f6ef7",accentText:"#ffffff",drag:"#a5b4fc"},xterm:{background:"#ffffff",foreground:"#1f2937",cursor:"#4f6ef7",selectionBackground:"#c7d2fe",black:"#24292e",red:"#d73a49",green:"#22863a",yellow:"#b08800",blue:"#005cc5",magenta:"#6f42c1",cyan:"#1b7c83",white:"#6a737d",brightBlack:"#959da5",brightWhite:"#fafbfc"}},{id:"scifi",label:"科幻霓虹",swatch:"#050a14",preview:["#050a14","#22d3ee"],cssVars:{"--ui-color-scheme":"dark","--ui-root-bg":"#050a14","--ui-text":"#e2f3ff","--ui-tabbar-bg":"#0a1220","--ui-tabbar-border":"#10263c","--ui-tab-bg":"#0d1626","--ui-tab-text":"#5c7893","--ui-tab-active-bg":"#122036","--ui-tab-active-text":"#e2f3ff","--ui-tab-accent":"#22d3ee","--ui-connection-bg":"#0a1220","--ui-connection-text":"#5c7893","--ui-tree-bg":"#0d1626","--ui-tree-border":"#10263c","--ui-term-col-bg":"#050a14","--ui-fab-bg":"#122036","--ui-fab-border":"#155e75","--ui-muted-surface":"#0d1626","--ui-muted-border":"#164e63","--ui-muted-text":"#9fb8d0","--ui-panel-input-bg":"#0a1220","--ui-panel-input-text":"#e2f3ff","--ui-panel-input-border":"#164e63","--ui-drawer-tab-text":"#5c7893","--ui-drawer-tab-active":"#e2f3ff","--ui-history-item-text":"#d5ecfb","--ui-history-meta":"#5c7893","--ui-success":"#34d399","--ui-error":"#fb7185"},termHostBg:"#0a1220",keybar:{bg:"#0a1220",border:"#10263c",keyBg:"#0d1626",keyBorder:"#164e63",keyText:"#9fb8d0",accent:"#22d3ee",accentText:"#04121a",drag:"#155e75"},xterm:{background:"#0a1220",foreground:"#e2f3ff",cursor:"#22d3ee",selectionBackground:"#164e63",black:"#0d1626",red:"#fb7185",green:"#34d399",yellow:"#fbbf24",blue:"#38bdf8",magenta:"#e879f9",cyan:"#22d3ee",white:"#e2f3ff",brightBlack:"#5c7893",brightWhite:"#ffffff"}},{id:"noir",label:"暗夜黑",swatch:"#0f1115",preview:["#0f1115","#a78bfa"],cssVars:{"--ui-color-scheme":"dark","--ui-root-bg":"#0f1115","--ui-text":"#eceff4","--ui-tabbar-bg":"#14171d","--ui-tabbar-border":"#232833","--ui-tab-bg":"#191d24","--ui-tab-text":"#6b7280","--ui-tab-active-bg":"#1f242d","--ui-tab-active-text":"#eceff4","--ui-tab-accent":"#a78bfa","--ui-connection-bg":"#14171d","--ui-connection-text":"#6b7280","--ui-tree-bg":"#191d24","--ui-tree-border":"#232833","--ui-term-col-bg":"#0f1115","--ui-fab-bg":"#1f242d","--ui-fab-border":"#2a3040","--ui-muted-surface":"#191d24","--ui-muted-border":"#2a3040","--ui-muted-text":"#aab2bf","--ui-panel-input-bg":"#14171d","--ui-panel-input-text":"#eceff4","--ui-panel-input-border":"#2a3040","--ui-drawer-tab-text":"#6b7280","--ui-drawer-tab-active":"#eceff4","--ui-history-item-text":"#d7dce4","--ui-history-meta":"#6b7280","--ui-success":"#4ade80","--ui-error":"#f87171"},termHostBg:"#14171d",keybar:{bg:"#14171d",border:"#232833",keyBg:"#191d24",keyBorder:"#2a3040",keyText:"#aab2bf",accent:"#a78bfa",accentText:"#0f1115",drag:"#4b4470"},xterm:{background:"#14171d",foreground:"#eceff4",cursor:"#a78bfa",selectionBackground:"#3b3654",black:"#191d24",red:"#f87171",green:"#4ade80",yellow:"#fbbf24",blue:"#60a5fa",magenta:"#c084fc",cyan:"#67e8f9",white:"#eceff4",brightBlack:"#6b7280",brightWhite:"#ffffff"}},{id:"mist",label:"雾白靛蓝",swatch:"#f7f8fb",preview:["#f7f8fb","#4258c4"],cssVars:{"--ui-color-scheme":"light","--ui-root-bg":"#f7f8fb","--ui-text":"#252d3d","--ui-tabbar-bg":"#e4e9f2","--ui-tabbar-border":"#dce3ef","--ui-tab-bg":"#e9edf5","--ui-tab-text":"#5b687f","--ui-tab-active-bg":"#f7f8fb","--ui-tab-active-text":"#252d3d","--ui-tab-accent":"#4258c4","--ui-connection-bg":"#e4e9f2","--ui-connection-text":"#5b687f","--ui-tree-bg":"#e9edf5","--ui-tree-border":"#dce3ef","--ui-term-col-bg":"#f7f8fb","--ui-fab-bg":"#ffffff","--ui-fab-border":"#dce3ef","--ui-muted-surface":"#e9edf5","--ui-muted-border":"#dce3ef","--ui-muted-text":"#5b687f","--ui-panel-input-bg":"#ffffff","--ui-panel-input-text":"#252d3d","--ui-panel-input-border":"#dce3ef","--ui-drawer-tab-text":"#5b687f","--ui-drawer-tab-active":"#252d3d","--ui-history-item-text":"#252d3d","--ui-history-meta":"#5b687f","--ui-success":"#247860","--ui-error":"#be3d50"},termHostBg:"#ffffff",keybar:{bg:"#e4e9f2",border:"#dce3ef",keyBg:"#ffffff",keyBorder:"#dce3ef",keyText:"#5b687f",accent:"#4258c4",accentText:"#ffffff",drag:"#8a9ac5"},xterm:{background:"#ffffff",foreground:"#252d3d",cursor:"#4258c4",selectionBackground:"#d6dcf4",black:"#252d3d",red:"#be3d50",green:"#247860",yellow:"#956018",blue:"#346faa",magenta:"#7456a6",cyan:"#277784",white:"#5b687f",brightBlack:"#5b687f",brightWhite:"#f7f8fb"}},{id:"pine",label:"暖灰松绿",swatch:"#f6f7f3",preview:["#f6f7f3","#356c55"],cssVars:{"--ui-color-scheme":"light","--ui-root-bg":"#f6f7f3","--ui-text":"#2d382f","--ui-tabbar-bg":"#e2e7df","--ui-tabbar-border":"#d9e1d6","--ui-tab-bg":"#e8ece5","--ui-tab-text":"#5b6e61","--ui-tab-active-bg":"#f6f7f3","--ui-tab-active-text":"#2d382f","--ui-tab-accent":"#356c55","--ui-connection-bg":"#e2e7df","--ui-connection-text":"#5b6e61","--ui-tree-bg":"#e8ece5","--ui-tree-border":"#d9e1d6","--ui-term-col-bg":"#f6f7f3","--ui-fab-bg":"#ffffff","--ui-fab-border":"#d9e1d6","--ui-muted-surface":"#e8ece5","--ui-muted-border":"#d9e1d6","--ui-muted-text":"#5b6e61","--ui-panel-input-bg":"#ffffff","--ui-panel-input-text":"#2d382f","--ui-panel-input-border":"#d9e1d6","--ui-drawer-tab-text":"#5b6e61","--ui-drawer-tab-active":"#2d382f","--ui-history-item-text":"#2d382f","--ui-history-meta":"#5b6e61","--ui-success":"#357450","--ui-error":"#b6454d"},termHostBg:"#ffffff",keybar:{bg:"#e2e7df",border:"#d9e1d6",keyBg:"#ffffff",keyBorder:"#d9e1d6",keyText:"#5b6e61",accent:"#356c55",accentText:"#ffffff",drag:"#86a38b"},xterm:{background:"#ffffff",foreground:"#2d382f",cursor:"#356c55",selectionBackground:"#d4e1d9",black:"#2d382f",red:"#b6454d",green:"#357450",yellow:"#8c641e",blue:"#3d7189",magenta:"#805e88",cyan:"#317c74",white:"#5b6e61",brightBlack:"#5b6e61",brightWhite:"#f6f7f3"}},{id:"graphite",label:"石墨夜色",swatch:"#202630",preview:["#202630","#a4bad2"],cssVars:{"--ui-color-scheme":"dark","--ui-root-bg":"#202630","--ui-text":"#e4ebf4","--ui-tabbar-bg":"#161c25","--ui-tabbar-border":"#384859","--ui-tab-bg":"#161c25","--ui-tab-text":"#b0bfd3","--ui-tab-active-bg":"#202630","--ui-tab-active-text":"#e4ebf4","--ui-tab-accent":"color-mix(in srgb, #386a9a 40%, #ecf0f8)","--ui-connection-bg":"#161c25","--ui-connection-text":"#b0bfd3","--ui-tree-bg":"#161c25","--ui-tree-border":"#384859","--ui-term-col-bg":"#202630","--ui-fab-bg":"#293440","--ui-fab-border":"#384859","--ui-muted-surface":"#161c25","--ui-muted-border":"#384859","--ui-muted-text":"#b0bfd3","--ui-panel-input-bg":"#293440","--ui-panel-input-text":"#e4ebf4","--ui-panel-input-border":"#384859","--ui-drawer-tab-text":"#b0bfd3","--ui-drawer-tab-active":"#e4ebf4","--ui-history-item-text":"#e4ebf4","--ui-history-meta":"#b0bfd3","--ui-success":"#89d3af","--ui-error":"#f097a2"},termHostBg:"#202630",keybar:{bg:"#161c25",border:"#384859",keyBg:"#293440",keyBorder:"#384859",keyText:"#b0bfd3",accent:"#a4bad2",accentText:"#14212b",drag:"#61778c"},xterm:{background:"#202630",foreground:"#e4ebf4",cursor:"#a4bad2",selectionBackground:"#2a3e53",black:"#161c25",red:"#f097a2",green:"#89d3af",yellow:"#e5c58a",blue:"#9accf0",magenta:"#c4b3e1",cyan:"#91cfd6",white:"#e4ebf4",brightBlack:"#b0bfd3",brightWhite:"#ffffff"}}],eW="pearl",eB=Object.fromEntries(e_.map(e=>[e.id,e])),eO={dark:"noir",black:"noir",gray:"noir",blue:"noir",red:"noir",yellow:"noir",green:"noir",white:"pearl"};function eF(e){if(e&&e in eB)return eB[e];let t=e?eO[e]:void 0;return t?eB[t]:eB[eW]}function eD({themeId:e,onThemeChange:t}){let[r,a]=(0,d.useState)(!1),n=(0,d.useRef)(null),o=(0,d.useRef)(null),s=(0,d.useRef)(null),[l,c]=(0,d.useState)(null),[u,p]=(0,d.useState)({top:-1e3,left:0});return(0,i.jsxs)("div",{ref:n,className:"theme-picker",children:[i.jsx("button",{ref:o,type:"button",className:"file-drawer-toggle","aria-label":"换肤",title:"换肤","aria-expanded":r,"aria-haspopup":"dialog",onClick:()=>a(e=>!e),children:i.jsx(E,{size:17,"aria-hidden":"true"})}),r&&l&&(0,z.createPortal)((0,i.jsxs)("div",{ref:s,className:"theme-popover",role:"dialog","aria-label":"选择皮肤","data-toolbar-overlay":!0,style:{position:"fixed",...u,zIndex:210,width:Math.min(176,innerWidth-16),boxSizing:"border-box",padding:8,borderRadius:10,border:"1px solid var(--ui-tabbar-border, #282b36)",background:"var(--ui-tab-active-bg, #262b38)",boxShadow:"0 10px 28px rgba(0,0,0,.45)"},children:[i.jsx("div",{style:{fontSize:10,color:"var(--ui-connection-text, #777b8c)",margin:"2px 4px 6px",letterSpacing:.5},children:"皮肤"}),i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:2},children:e_.map(r=>{let n=r.id===e;return(0,i.jsxs)("button",{type:"button",className:"theme-popover-item","aria-label":r.label,"aria-pressed":n,onPointerDown:e=>e.stopPropagation(),onClick:()=>{t(r.id),a(!1)},style:{background:n?"color-mix(in srgb, var(--ui-tab-accent, #7aa2f7) 14%, transparent)":"transparent"},children:[i.jsx("span",{style:{width:18,height:18,borderRadius:5,flexShrink:0,background:`linear-gradient(135deg, ${r.preview[0]} 55%, ${r.preview[1]} 55%)`,boxShadow:"inset 0 0 0 1px rgba(128,128,160,.25)"}}),i.jsx("span",{style:{flex:1,textAlign:"left",fontSize:12,fontWeight:n?600:400,color:n?"var(--ui-tab-active-text, #edf0f7)":"var(--ui-tab-text, #8f93a4)"},children:r.label}),n&&i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--ui-tab-accent, #7aa2f7)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i.jsx("path",{d:"m5 12 4 4L19 6"})})]},r.id)})})]}),l)]})}function e$({groupId:e,title:t,onFrame:r,onLoad:a}){let n=(0,d.useRef)(null),[o,s]=(0,d.useState)("loading"),[l,u]=(0,d.useState)(0),p=void 0===e;return(0,i.jsxs)("div",{"aria-busy":"loading"===o,className:"jsx-92e497a22f5803ef collaboration-pane",children:[i.jsx("iframe",{ref:e=>{n.current=e,r(e)},style:{visibility:"ready"===o?"visible":"hidden"},src:c(p?"/app/?view=collaboration-dashboard":`/app/?view=collaboration&groupId=${encodeURIComponent(e)}`),title:t,onLoad:a,onError:()=>s("error"),className:`jsx-92e497a22f5803ef webapp-frame collaboration-frame${"ready"===o?" is-ready":""}`},l),"loading"===o&&i.jsx(eu,{label:"AGENT COLLABORATION",title:p?"正在打开群聊看板":"正在进入群聊",caption:p?"正在加载已保存的群聊":"正在加载群成员与聊天记录",icon:i.jsx(w,{size:36,strokeWidth:1.5})}),"error"===o&&(0,i.jsxs)("div",{role:"alert",className:"jsx-92e497a22f5803ef collaboration-load-error",children:[i.jsx("strong",{className:"jsx-92e497a22f5803ef",children:p?"暂时无法打开群聊看板":"暂时无法打开群聊"}),i.jsx("span",{className:"jsx-92e497a22f5803ef",children:"请检查连接后重试。"}),(0,i.jsxs)("button",{onClick:()=>{s("loading"),u(e=>e+1)},className:"jsx-92e497a22f5803ef",children:[i.jsx(g,{size:15}),"重新加载"]})]}),i.jsx(ed(),{id:"92e497a22f5803ef",children:".collaboration-pane.jsx-92e497a22f5803ef{position:relative;height:100%;background:var(--ui-term-col-bg,#101014)}.collaboration-frame.is-ready.jsx-92e497a22f5803ef{-webkit-animation:collaboration-appear 220ms ease-out both;-moz-animation:collaboration-appear 220ms ease-out both;-o-animation:collaboration-appear 220ms ease-out both;animation:collaboration-appear 220ms ease-out both}.collaboration-load-error.jsx-92e497a22f5803ef{position:absolute;inset:0;display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;-moz-box-orient:vertical;-moz-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-align:center;-webkit-align-items:center;-moz-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-moz-box-pack:center;-ms-flex-pack:center;justify-content:center;gap:12px;color:var(--ui-text,#e5e7eb);background:var(--ui-term-col-bg,#101014);padding:20px;text-align:center}.collaboration-load-error.jsx-92e497a22f5803ef span.jsx-92e497a22f5803ef{font-size:13px;color:var(--ui-text-muted,#9399aa)}.collaboration-load-error.jsx-92e497a22f5803ef button.jsx-92e497a22f5803ef{display:-webkit-inline-box;display:-webkit-inline-flex;display:-moz-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-align:center;-webkit-align-items:center;-moz-box-align:center;-ms-flex-align:center;align-items:center;gap:8px;margin-top:6px;min-height:44px;padding:10px 16px;border:1px solid var(--ui-muted-border,#ffffff24);-webkit-border-radius:9px;-moz-border-radius:9px;border-radius:9px;background:transparent;color:inherit;font:inherit;cursor:pointer}.collaboration-load-error.jsx-92e497a22f5803ef button.jsx-92e497a22f5803ef:focus-visible{outline:2px solid currentColor;outline-offset:3px}@-webkit-keyframes collaboration-appear{from{opacity:0}to{opacity:1}}@-moz-keyframes collaboration-appear{from{opacity:0}to{opacity:1}}@-o-keyframes collaboration-appear{from{opacity:0}to{opacity:1}}@keyframes collaboration-appear{from{opacity:0}to{opacity:1}}@media(prefers-reduced-motion:reduce){.collaboration-frame.is-ready.jsx-92e497a22f5803ef{-webkit-animation:none;-moz-animation:none;-o-animation:none;animation:none}}"})]})}let eU={id:"remote-desktop",title:"远程桌面",kind:"remote-desktop"};function eH(e){let t=e.find(e=>"remote-desktop"===e.kind);return t?e.map(e=>e===t?{...eU}:e):[...e,{...eU}]}let eq={id:"collaboration-dashboard",title:"群聊看板",kind:"collaboration-dashboard"};function eV(e){return e.some(e=>e.id===eq.id)?e:[...e,{...eq}]}let eG=o()(async()=>{},{loadableGenerated:{modules:["app/web/page.tsx -> ./TerminalPane"]},ssr:!1}),eJ=o()(async()=>{},{loadableGenerated:{modules:["app/web/page.tsx -> ./FileTree"]},ssr:!1}),eX=o()(async()=>{},{loadableGenerated:{modules:["app/web/page.tsx -> ./FilePreview"]},ssr:!1}),eK=o()(async()=>{},{loadableGenerated:{modules:["app/web/page.tsx -> ./AiHubPane"]},ssr:!1}),eQ=o()(async()=>{},{loadableGenerated:{modules:["app/web/page.tsx -> ./FlowStudioPane"]},ssr:!1,loading:()=>i.jsx(eu,{})});function eZ(){return i.jsx(ez,{children:(e,t)=>i.jsx(e4,{auth:e,onWorkspaceReady:t})})}let eY={id:"webapp-agent",title:"智能助手",kind:"webapp"},e0={id:"ai-hub",title:"AI Hub",kind:"aihub"},e1={id:"flow-studio",title:"Flow Studio",kind:"flowstudio"};function e2(){return"undefined"==typeof document?eW:eF(document.getElementById("web-theme-root")?.dataset.webTheme).id}function e4({auth:e,onWorkspaceReady:t}){let[r,a]=(0,d.useState)(null),[n,o]=(0,d.useState)(0),u=(0,d.useCallback)(e=>{if(e?.openMode==="new-tab"){window.open(e.url,"_blank","noopener,noreferrer");return}a(e)},[]),p=(0,d.useCallback)(e=>a(e?.openMode==="current"?e:null),[]),f=(0,d.useRef)(null),b=(0,d.useRef)(null),m=(0,d.useRef)(null),[z,C]=(0,d.useState)({}),N=(0,d.useRef)(new Map),[R,E]=(0,d.useState)(0),[M,P]=(0,d.useState)(!1),[I,A]=(0,d.useState)(!1),L=(0,d.useRef)(()=>{}),{state:_,epoch:W,rpc:B,onEvent:O,onTerminalData:F,onTerminalReset:D,sendTerminalInput:$}=function(e,t,r){let[a,i]=(0,d.useState)({connected:!1,error:null}),[n,o]=(0,d.useState)(0),s=(0,d.useRef)(null),c=(0,d.useRef)(0),u=(0,d.useRef)(new Map),p=(0,d.useRef)([]),f=(0,d.useRef)(0),b=(0,d.useRef)(new Map),m=(0,d.useRef)(new Map),h=(0,d.useRef)(new Map),x=(0,d.useRef)(1e3),g=(0,d.useRef)(!1),w=(0,d.useRef)(null),y=(0,d.useRef)(e),v=(0,d.useRef)(t),k=(0,d.useRef)(r);y.current=e,v.current=t,k.current=r;let j=(0,d.useCallback)((e,t)=>{let r=b.current.get(e);return r||b.current.set(e,r=new Set),r.add(t),()=>r.delete(t)},[]),S=(0,d.useCallback)((e,t)=>{let r=m.current.get(e);return r||m.current.set(e,r=new Set),r.add(t),()=>r.delete(t)},[]),z=(0,d.useCallback)((e,t)=>{let r=h.current.get(e);return r||h.current.set(e,r=new Set),r.add(t),()=>r.delete(t)},[]),C=(0,d.useCallback)((e,t)=>{let r=s.current;if(!r||r.readyState!==WebSocket.OPEN)return!1;let a=new TextEncoder().encode(t),i=new Uint8Array(6+a.byteLength),n=new DataView(i.buffer);return i[0]=1,i[1]=1,n.setUint32(2,e),i.set(a,6),r.send(i),!0},[]),N=(0,d.useCallback)(e=>{let t=s.current;t?.readyState===WebSocket.OPEN?t.send(e):p.current.push(e)},[]),R=(0,d.useCallback)((e,t={},r=15e3)=>new Promise((a,i)=>{if(e.startsWith("browser:")&&s.current?.readyState!==WebSocket.OPEN){i(Object.assign(Error("远程连接已断开,请等待重新连接"),{code:"EOFFLINE"}));return}let n=++f.current,o=setTimeout(()=>{u.current.delete(n),i(Error(`${e} timeout`))},r);u.current.set(n,{resolve:a,reject:i,timer:o,type:e}),N(JSON.stringify({type:e,_req:n,...t}))}),[N]),T=(0,d.useCallback)(async()=>{let e,t;g.current=!1;let r=++c.current;w.current&&(clearInterval(w.current),w.current=null);let a=s.current;if(a){a.onopen=a.onmessage=a.onerror=a.onclose=null;try{a.close()}catch{}}try{e=await v.current()}catch{r===c.current&&k.current();return}if(r===c.current&&!g.current){try{t=new WebSocket(`${function(){let e=new URL("/ws",l());return e.protocol="https:"===e.protocol?"wss:":"ws:",e.href}()}?nonce=${encodeURIComponent(e)}`)}catch(e){i({connected:!1,error:String(e)});return}t.binaryType="arraybuffer",s.current=t,t.onopen=()=>{if(r!==c.current||s.current!==t)return;for(let e of(x.current=1e3,i({connected:!0,error:null}),o(e=>e+1),p.current.splice(0)))t.send(e);let e=Date.now();w.current=setInterval(()=>{if(s.current!==t||t.readyState!==WebSocket.OPEN){clearInterval(w.current),w.current=null;return}if(Date.now()-e>25e3){try{t.close()}catch{}return}try{t.send(JSON.stringify({type:"ping"}))}catch{}},1e4);let a=()=>{e=Date.now()};t.addEventListener("message",a),t.addEventListener("close",()=>t.removeEventListener("message",a),{once:!0})},t.onmessage=e=>{let a;if(r===c.current&&s.current===t){if("string"!=typeof e.data){let t=new Uint8Array(e.data);if(t.byteLength>=6&&1===t[0]&&(2===t[1]||6===t[1])){let e=new DataView(t.buffer,t.byteOffset,t.byteLength).getUint32(2);m.current.get(e)?.forEach(e=>e(t.subarray(6),6===t[1]))}else if(t.byteLength>=6&&1===t[0]&&3===t[1]){let e=new DataView(t.buffer,t.byteOffset,t.byteLength).getUint32(2);h.current.get(e)?.forEach(e=>e())}else y.current(t);return}try{a=JSON.parse(e.data)}catch{return}if("error"===a.type&&null!=a.id){let e=u.current.get(a.id);if(e){u.current.delete(a.id),clearTimeout(e.timer);let t=Object.assign(Error(a.error||"gateway error"),{code:a.code});e.reject(t)}return}if(null!=a.id&&"string"==typeof a.type&&a.type.endsWith(":result")){let e=u.current.get(a.id);if(e?.type==="fs:preview-open"&&"string"==typeof a.url){var i;a.url=i=a.url}e&&(u.current.delete(a.id),clearTimeout(e.timer),e.resolve(a));return}b.current.get(a.type)?.forEach(e=>e(a))}},t.onclose=e=>{if(r!==c.current||s.current!==t)return;for(let[e,t]of(w.current&&(clearInterval(w.current),w.current=null),s.current=null,u.current))t.type.startsWith("browser:")&&(clearTimeout(t.timer),u.current.delete(e),t.reject(Object.assign(Error("远程连接已断开,请重新接管"),{code:"EOFFLINE"})));if(i({connected:!1,error:null}),4001===e.code||4003===e.code){k.current();return}if(g.current)return;let a=x.current;x.current=Math.min(2*a,8e3),setTimeout(()=>{g.current||r!==c.current||T()},a)},t.onerror=()=>{}}},[]);return{state:a,epoch:n,rpc:R,onEvent:j,onTerminalData:S,onTerminalReset:z,sendTerminalInput:C,reconnect:T}}((0,d.useCallback)(e=>{let t=function(e){let t=e instanceof Uint8Array?e:new Uint8Array(e.buffer,e.byteOffset,e.byteLength);if(t.byteLength<10||1!==t[0]||t[1]!==ej.watcherFrame&&t[1]!==ej.producerFrame)return null;let r=new DataView(t.buffer,t.byteOffset,t.byteLength);return{type:t[1],channelId:r.getUint32(2,!1),sequence:r.getUint32(6,!1),payload:t.subarray(10)}}(e);if(t&&t.type===ej.watcherFrame)for(let e of(L.current(t.channelId,t.sequence),[f,b])){if(!e.current?.contentWindow)continue;let r=t.payload.slice().buffer;e.current.contentWindow.postMessage({type:"agent-web-shell:browser-frame:v1",channelId:t.channelId,sequence:t.sequence,data:r},window.location.origin,[r])}},[]),e.getWsNonce,e.refresh),U=(0,d.useMemo)(()=>({request:(e,t,r)=>B(e,t,r),subscribe:(e,t)=>O("fs:event",t)}),[O,B]);L.current=(e,t)=>{B("browser:frame-ack",{channelId:e,sequence:t}).catch(()=>void 0)};let[H,q]=(0,d.useState)([{...eY}]);(0,d.useRef)(H).current=H;let[V,G]=(0,d.useState)(eY.id),[J,X]=(0,d.useState)({});(0,d.useRef)(!1);let[Q,Y]=(0,d.useState)(!1),[ee,et]=(0,d.useState)(0);e.user?.id,(0,d.useRef)(null);let er=(0,d.useRef)(new Map),ea=(0,d.useRef)(new Map),ei=(0,d.useCallback)((e,t)=>{er.current.set(e,t);let r=window.setTimeout(()=>{if(er.current.get(e)!==t)return;let r=ea.current.get(e);r&&(ea.current.delete(e),t(r,!0))},180);return()=>{window.clearTimeout(r),er.current.get(e)===t&&er.current.delete(e)}},[]),en=(0,d.useCallback)(e=>{if(!V||H.find(e=>e.id===V)?.kind)return;let t=er.current.get(V);t?t(e):B("term:input",{id:V,data:`\x15${e}`}).catch(()=>{}),eS(!1)},[V,B,H]),[es,el]=(0,d.useState)(!1),[ec,ed]=(0,d.useState)({}),[ef,eb]=(0,d.useState)(null),[eh,eS]=(0,d.useState)(!1),[ez,eC]=(0,d.useState)("files"),[eN,eR]=(0,d.useState)(null),[eT,eE]=(0,d.useState)(!0),[eM,eP]=(0,d.useState)(null),[eI,eA]=(0,d.useState)(!1),[e_,eW]=(0,d.useState)([]),[eB,eO]=(0,d.useState)(ek.map((e,t)=>({id:`default-${t+1}`,command:e}))),[eZ,e4]=(0,d.useState)(e2),[e3,e5]=(0,d.useState)(!1),e8=function(e){let[t,r]=(0,d.useState)(()=>({userId:"",revision:0,visibleTools:[...ex],savedPages:null,updatedAt:""})),a=(0,d.useRef)(t),[i,n]=(0,d.useState)(!1),[o,s]=(0,d.useState)(!1),l=(0,d.useRef)(!1),c=(0,d.useRef)(!0),u=(0,d.useRef)(0),[p,f]=(0,d.useState)(""),[b,m]=(0,d.useState)(""),h=(0,d.useCallback)(e=>{a.current=e,c.current&&r(e)},[]),x=(0,d.useCallback)(async()=>{if(l.current)return;let t=++u.current;f(""),m("");try{let r=await ev(e);if(null===r.savedPages){let t=K().find(e=>e.origin===location.origin)?.pages??[];try{r=await ev(e,{expectedRevision:r.revision,initializePages:t})}catch(t){if(!(t instanceof ey)||409!==t.status)throw t;if(r=await ev(e),null===r.savedPages)throw Error("电脑配置已更新,请重试旧页面导入。")}}if(!c.current||t!==u.current)return;h(r),n(!0);try{Z(K().map(e=>{if(e.origin!==location.origin)return e;let{pages:t,...r}=e;return{...r,pagesMigrated:!0}}))}catch{}}catch(e){c.current&&t===u.current&&f(e instanceof Error?e.message:"无法读取电脑配置。")}},[h,e]),g=(0,d.useCallback)(async t=>{if(!i||l.current)throw Error("配置尚未就绪,请稍后重试。");l.current=!0,u.current++,s(!0),f(""),m("");let r=a.current;t.visibleTools&&h({...r,visibleTools:t.visibleTools});try{h(await ev(e,{...t,expectedRevision:r.revision})),c.current&&m("已保存到当前电脑")}catch(a){if(h(r),a instanceof ey&&409===a.status)try{h(await ev(e))}catch{}let t=a instanceof Error?a.message:"电脑配置保存失败,请重试。";throw c.current&&f(t),Error(t)}finally{l.current=!1,c.current&&s(!1)}},[h,e,i]);return{settings:t,loaded:i,saving:o,error:p,notice:b,reload:x,setVisibleTools:e=>g({visibleTools:eg(e)}),setSavedPages:e=>g({savedPages:ew(e)})}}(e.csrfToken),[e7,e9]=(0,d.useState)(!1),te=eF(eZ),tt=(0,d.useRef)(null),[tr,ta]=(0,d.useState)(0),[ti,tn]=(0,d.useState)(!1),to=(0,d.useRef)(null),ts=(0,d.useRef)(null),tl=(0,d.useCallback)(e=>{for(let t of[f.current,b.current,m.current,...N.current.values()])t?.contentWindow?.postMessage({type:"agent-web-shell:skin:v1",skin:e},window.location.origin)},[]);(0,d.useRef)(0);let tc=V?J[V]??null:null;(0,d.useCallback)(t=>{fetch("/api/web-console/preferences",{method:"PATCH",credentials:"same-origin",headers:{"content-type":"application/json","x-csrf-token":e.csrfToken},body:JSON.stringify(t)}).catch(()=>{})},[e.csrfToken]),(0,d.useCallback)(t=>{e.csrfToken&&fetch("/api/web-console/device-state",{method:"PUT",credentials:"same-origin",keepalive:!0,headers:{"content-type":"application/json","x-csrf-token":e.csrfToken},body:JSON.stringify(t)}).catch(()=>{})},[e.csrfToken]);let td=(0,d.useCallback)(e=>{eb(e),eS(!1)},[]),tu=(0,d.useCallback)(()=>{if(H.length>=8)return;let e=`t-web-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`;q(t=>t.length>=8?t:[...t,{id:e,title:`Terminal ${t.length+1}`}]),G(e)},[H.length]),tp=(0,d.useCallback)(e=>{let t=H.find(e=>e.id===V);if(t?.kind&&"webapp"!==t.kind)return;if(t&&!t.kind){let r=er.current.get(t.id);r?r(e,!0):ea.current.set(t.id,e),eS(!1);return}let r=H.length>=8?H.find(e=>!e.kind):null,a=r?.id??`t-web-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`;r?ea.current.set(a,e):q(t=>[...t,{id:a,title:`Terminal ${t.length+1}`,initialCommand:e}]),G(a),eS(!1)},[V,H]),tf=e=>{if(e===eY.id)return;let t=H.find(t=>t.id===e)?.kind;"remote-desktop"===t&&(E(0),A(!1),B("browser:unwatch").catch(()=>{})),(t||window.confirm("关闭页签会终止该终端进程,确认关闭?"))&&(q(t=>{let r=t.filter(t=>t.id!==e);return V===e&&G(r[0]?.id??null),r}),t||B("term:kill",{id:e}).catch(()=>{}))},tb=(0,d.useCallback)(()=>{q(e=>{let t=e.find(e=>"aihub"===e.kind);return t?(G(t.id),e):(G(e0.id),[...e,{...e0}])})},[]),tm=(0,d.useCallback)(()=>{q(e=>{let t=e.find(e=>"flowstudio"===e.kind);return t?(G(t.id),e):(G(e1.id),[...e,{...e1}])})},[]),th=(0,d.useCallback)(()=>{q(eH),G(eU.id)},[]),tx=(0,d.useCallback)(e=>{if(!V||H.length<2)return;let t=(H.findIndex(e=>e.id===V)+e+H.length)%H.length;G(H[t].id)},[V,H]),tg=Math.max(0,H.findIndex(e=>e.id===V)),tw=H[tg]?.kind==="webapp"?te.cssVars["--ui-term-col-bg"]:te.termHostBg,ty={...e6.root,...te.cssVars,"--ui-active-content-bg":tw,"--ui-terminal-bg":te.termHostBg,"--ui-primary-text":te.keybar.accentText,background:"var(--ui-root-bg)",color:"var(--ui-text)"},tv=(0,d.useCallback)(()=>{tt.current=null,ta(0),tn(!1)},[]),tk=(0,d.useCallback)(e=>{Math.abs(e)>=64&&H.length>1&&tx(e<0?1:-1),tv()},[H.length,tx,tv]),tj=e=>e instanceof Element&&!!e.closest(".terminal-screen");return(0,d.useCallback)((e="smooth")=>{let t=ts.current;if(!t||!V)return;let r=t.querySelector(`[data-terminal-id="${V}"]`);if(!r)return;if(r===t.querySelector("[data-terminal-id]")){t&&(t.scrollLeft=0);return}let a=t.querySelector(".terminal-connection"),i=a?.offsetWidth??0,n=r.offsetLeft,o=n+r.offsetWidth,s=t.scrollLeft,l=s+t.clientWidth-i;n<s+8?t.scrollTo({left:Math.max(0,n-8),behavior:e}):o>l-8&&t.scrollTo({left:o-t.clientWidth+i+8,behavior:e})},[V]),(0,i.jsxs)("div",{className:`web-root ${M&&V===eU.id&&!r?"is-remote-fullscreen":""}`,style:ty,children:[i.jsx("style",{dangerouslySetInnerHTML:{__html:s}}),(0,i.jsxs)("div",{className:"terminal-tabs",children:[r&&(0,i.jsxs)("div",{className:"computer-page-heading",children:[i.jsx("button",{type:"button",className:"file-drawer-toggle","aria-label":"返回电脑会话",title:"返回电脑会话",onClick:()=>a(null),children:i.jsx(h,{size:18})}),i.jsx("span",{children:r.name}),i.jsx("a",{className:"file-drawer-toggle",href:r.url,target:"_blank",rel:"noopener noreferrer","aria-label":"在新页面打开当前页面",title:"打开原页面",children:i.jsx(x,{size:16})})]}),i.jsx("div",{className:"terminal-tab-list",ref:ts,hidden:!!r,children:H.map(e=>(0,i.jsxs)("div",{"data-terminal-id":e.id,draggable:!0,className:`terminal-tab ${e.id===V?"active":""}`,onDragStart:()=>{to.current=e.id},onDragOver:e=>e.preventDefault(),onDrop:t=>{t.preventDefault();let r=to.current;to.current=null,r&&r!==e.id&&q(t=>{let a=t.findIndex(e=>e.id===r),i=t.findIndex(t=>t.id===e.id);if(a<0||i<0)return t;let n=[...t],[o]=n.splice(a,1);return n.splice(i,0,o),B("term:reorder",{ids:n.filter(e=>!e.kind).map(e=>e.id)}).catch(()=>{}),n})},onClick:()=>G(e.id),onDoubleClick:()=>{if(e.kind)return;let t=window.prompt("页签名称",e.title)?.trim();t&&B("term:rename",{id:e.id,title:t}).then(()=>q(r=>r.map(r=>r.id===e.id?{...r,title:t}:r))).catch(()=>{})},children:[i.jsx("span",{children:e.title}),"webapp"!==e.kind&&i.jsx("button",{tabIndex:-1,onClick:t=>{t.stopPropagation(),tf(e.id)},children:"\xd7"})]},e.id))}),i.jsx("button",{className:"terminal-add","aria-label":"新建终端页签",hidden:!!r,disabled:H.length>=8,onClick:tu,children:"+"}),i.jsx("div",{className:"terminal-connection",children:i.jsx(em,{avatar:i.jsx(eo,{username:e.user?.username??"?",connected:_.connected,accent:te.keybar.accent,accentText:te.keybar.accentText,selectedPageId:r?.id,onSelectPage:u,onUpdatePage:p,configuration:e8,csrfToken:e.csrfToken}),items:[{id:"refresh",content:i.jsx("button",{type:"button",className:"file-drawer-toggle","aria-label":"刷新页面",title:"刷新页面",onClick:()=>r?o(e=>e+1):window.location.reload(),children:i.jsx(g,{size:17,"aria-hidden":"true"})})},{id:"collaboration",content:i.jsx("button",{type:"button",className:"file-drawer-toggle","aria-label":"打开群聊看板",title:"群聊看板",onClick:()=>{a(null),q(eV),G(eq.id)},children:i.jsx(w,{size:17,"aria-hidden":"true"})})},{id:"install",content:i.jsx(T,{})},{id:"remote",content:i.jsx("button",{type:"button",className:"file-drawer-toggle","aria-label":"打开远程桌面",title:"远程桌面 \xb7 浏览器直播",onClick:()=>{a(null),th()},children:i.jsx(y,{size:17,"aria-hidden":"true"})})},{id:"ai-hub",content:i.jsx("button",{type:"button",className:"file-drawer-toggle","aria-label":"打开 AI Hub",title:"AI Hub \xb7 多模型对比",onClick:()=>{a(null),tb()},children:i.jsx(v,{size:17,"aria-hidden":"true"})})},{id:"flow",content:i.jsx("button",{type:"button",className:"file-drawer-toggle","aria-label":"打开数字人",title:"数字人 \xb7 Flow Studio",onClick:()=>{a(null),tm()},children:i.jsx(k,{size:17,"aria-hidden":"true"})})},{id:"theme",content:i.jsx(eD,{themeId:eZ,onThemeChange:e4})},{id:"files",content:i.jsx("button",{type:"button",className:"file-drawer-toggle","aria-label":eh?"关闭我的文件":"打开我的文件",title:"我的文件","aria-expanded":eh,onClick:()=>{a(null),eS(e=>!e)},children:i.jsx(j,{size:17,"aria-hidden":"true"})})}].filter(e=>e8.settings.visibleTools.some(t=>t===e.id)).sort((e,t)=>e8.settings.visibleTools.findIndex(t=>t===e.id)-e8.settings.visibleTools.findIndex(e=>e===t.id))})})]}),(0,i.jsxs)("main",{className:`workspace ${eh?"show-tree":""} ${ef?"has-preview":""}`,hidden:!!r,style:e6.workspace,children:[i.jsx("section",{className:"term-col",style:e6.termCol,onPointerDownCapture:e=>{"touch"===e.pointerType&&tj(e.target)&&(tv(),tt.current={x:e.clientX,y:e.clientY,axis:"pending",pointerId:e.pointerId})},onPointerMoveCapture:e=>{let t=tt.current;if(!t||e.pointerId!==t.pointerId||"touch"!==e.pointerType)return;let r=e.clientX-t.x,a=e.clientY-t.y;if("pending"===t.axis){if(8>=Math.max(Math.abs(r),Math.abs(a)))return;if(Math.abs(a)>=1.2*Math.abs(r)){tt.current=null;return}t.axis="horizontal",tn(!0);let e=r=>{window.removeEventListener("pointerup",e),window.removeEventListener("pointercancel",e),tt.current===t&&tv()};window.addEventListener("pointerup",e),window.addEventListener("pointercancel",e)}"horizontal"===t.axis&&(e.preventDefault(),ta(r))},onPointerUpCapture:e=>{let t=tt.current;if(!t||e.pointerId!==t.pointerId)return;let r=e.clientX-t.x;"horizontal"===t.axis&&Math.abs(r)>=64?tk(r):tv()},onPointerCancelCapture:tv,children:i.jsx("div",{className:"terminal-track",style:{transform:`translate3d(calc(${-(100*tg)}% + ${tr}px),0,0)`,transition:ti?"none":"transform 260ms cubic-bezier(.22,.8,.32,1)"},children:H.map(e=>i.jsx("div",{className:"terminal-slide",style:{position:"relative"},children:"webapp"===e.kind?i.jsx("iframe",{ref:f,className:"webapp-frame",src:c("/app/"),title:e.title,onLoad:()=>tl(eZ)}):"collaboration-dashboard"===e.kind?i.jsx(e$,{title:"群聊看板",onFrame:e=>{m.current=e},onLoad:()=>tl(eZ)}):"collaboration"===e.kind?i.jsx(e$,{groupId:e.groupId||"",title:e.title,onFrame:t=>{t?N.current.set(e.id,t):N.current.delete(e.id)},onLoad:()=>tl(eZ)},`${e.id}-${z[e.groupId||""]||0}`):"remote-desktop"===e.kind?(0,i.jsxs)("div",{style:{height:"100%",background:"var(--ui-term-col-bg, #101014)"},"aria-busy":!I,children:[i.jsx("iframe",{ref:b,className:"webapp-frame",style:{visibility:I?"visible":"hidden"},src:c("/app/?view=remote-desktop"),title:"远程桌面",onLoad:()=>tl(eZ)}),!I&&i.jsx(eu,{label:"REMOTE DESKTOP",title:"正在打开远程桌面",caption:"正在准备桌面与连接",icon:i.jsx(y,{size:36,strokeWidth:1.5})})]}):"aihub"===e.kind?i.jsx(eK,{visible:e.id===V,rpc:B}):"flowstudio"===e.kind?i.jsx(eQ,{visible:e.id===V}):i.jsx(eG,{terminalId:e.id,title:e.title,initialCommand:e.initialCommand,visible:e.id===V,state:_,rpc:B,onEvent:O,onTerminalData:F,onTerminalReset:D,sendTerminalInput:$,keyOrder:e_,keybarHidden:eI,onKeyOrderChange:eW,onKeybarHiddenChange:eA,terminalTheme:te,initialScrollLine:ec[e.id]??null,onScrollLineChange:t=>ed(r=>r[e.id]===t?r:{...r,[e.id]:t}),onRegisterFill:t=>ei(e.id,t),onCwdChange:t=>t&&X(r=>({...r,[e.id]:t}))})},e.id))})}),eh&&i.jsx("div",{className:"drawer-mask",onClick:()=>eS(!1)}),(0,i.jsxs)("aside",{className:`tree-col ${eh?"tree-col-open":""}`,style:e6.treeCol,children:[(0,i.jsxs)("div",{className:"tree-head",style:e6.treeHead,children:[i.jsx("button",{className:"files"===ez?"drawer-tab-active":"",onClick:()=>eC("files"),children:"文件"}),i.jsx("button",{className:"history"===ez?"drawer-tab-active":"",onClick:()=>eC("history"),children:"历史"}),i.jsx("span",{className:"tree-cwd",style:e6.treeCwd,children:tc??""}),i.jsx("button",{style:{...e6.iconBtn,marginLeft:"auto",flexShrink:0},onClick:()=>eS(!1),"aria-label":"close drawer",children:i.jsx(S,{size:15,"aria-hidden":"true"})})]}),"files"===ez?i.jsx(eJ,{ready:W>0,followCwd:!0,cwd:tc,gateway:U,onOpenFile:td,selectedPath:ef,initialRoot:eN,initialFollow:eT,revealRequest:eM,onTreeStateChange:(e,t)=>{eR(e),eE(t)}}):i.jsx(eL,{csrfToken:e.csrfToken,terminalId:H.find(e=>e.id===V)?.kind==="webapp"?null:V,pinnedCommands:eB,onPinnedCommandsChange:eO,onFill:en,onExecute:tp}),(0,i.jsxs)("div",{style:e6.treeFoot,children:[i.jsx("span",{style:e6.treeFootDot}),i.jsx("span",{children:"实时同步"})]})]}),ef&&i.jsx("section",{className:"preview-col",style:e6.previewCol,children:i.jsx(eX,{path:ef,gateway:U,onClose:()=>eb(null)})})]}),r&&i.jsx(ep,{page:r,reloadKey:n},r.id)]})}let e6={root:{height:"100dvh",display:"flex",flexDirection:"column",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", sans-serif',overflow:"hidden"},iconBtn:{minWidth:28,height:28,borderRadius:7,border:"1px solid var(--ui-tabbar-border, #303442)",background:"var(--ui-tab-bg, #202029)",color:"var(--ui-tab-text, #aaaab8)",fontSize:13},workspace:{flex:1,minHeight:0,display:"grid",position:"relative"},treeCol:{background:"var(--ui-tree-bg, #121218)",minHeight:0,flexDirection:"column"},treeHead:{display:"flex",alignItems:"center",gap:8,padding:"10px 12px 4px",fontSize:11,textTransform:"uppercase",letterSpacing:1,color:"#778",flexShrink:0},treeCwd:{fontSize:10,color:"#556",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:150,textTransform:"none",letterSpacing:0},treeFoot:{display:"flex",alignItems:"center",gap:7,minHeight:31,padding:"6px 11px calc(env(safe-area-inset-bottom) + 6px)",borderTop:"1px solid var(--ui-tabbar-border, #282832)",boxShadow:"0 -5px 16px rgba(0,0,0,.22)",background:"var(--ui-tab-bg, #15151c)",color:"var(--ui-connection-text, #777789)",fontSize:10.5,flexShrink:0},treeFootDot:{width:6,height:6,borderRadius:99,background:"var(--ui-success, #9ece6a)",boxShadow:"0 0 0 2px color-mix(in srgb, var(--ui-success, #9ece6a) 12%, transparent)",flexShrink:0},termCol:{minWidth:0,minHeight:0,display:"flex",flexDirection:"column",background:"var(--ui-term-col-bg, #101014)",gridColumn:1,overflow:"hidden"},previewCol:{minWidth:0,minHeight:0}}},4972:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>s,metadata:()=>i,viewport:()=>o});var a=r(3477);let i={title:"AgentRoam",manifest:"/manifest.webmanifest",appleWebApp:{capable:!0,title:"AgentRoam",statusBarStyle:"black-translucent"},icons:{icon:"/pwa/icon-192.png",apple:"/pwa/icon-192.png"},description:"General-purpose AI agent API server"},n="#070a0b",o={themeColor:n,colorScheme:"dark"};function s({children:e}){return a.jsx("html",{lang:"zh-CN",style:{background:n,colorScheme:"dark"},children:(0,a.jsxs)("body",{style:{margin:0,minHeight:"100dvh",background:n},children:[e,a.jsx("script",{src:"/pwa/install.js",defer:!0})]})})}},489:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>a});let a=(0,r(8979).createProxy)(String.raw`/private/tmp/agentroam-all64.baB7t1/source/packages/server/app/web/error.tsx#default`)},9257:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>u,dynamic:()=>l,generateViewport:()=>d});var a=r(3477),i=r(2110);let n=Object.fromEntries([{id:"pearl",label:"珍珠白",swatch:"#f5f6fa",preview:["#f5f6fa","#4f6ef7"],cssVars:{"--ui-color-scheme":"light","--ui-root-bg":"#f5f6fa","--ui-text":"#111827","--ui-tabbar-bg":"#eef0f6","--ui-tabbar-border":"#dfe3ee","--ui-tab-bg":"#e6e9f4","--ui-tab-text":"#5b6472","--ui-tab-active-bg":"#ffffff","--ui-tab-active-text":"#111827","--ui-tab-accent":"#4f6ef7","--ui-connection-bg":"#eef0f6","--ui-connection-text":"#9ca3af","--ui-tree-bg":"#fbfcfe","--ui-tree-border":"#e5e8f0","--ui-term-col-bg":"#f5f6fa","--ui-fab-bg":"#ffffff","--ui-fab-border":"#d8dcea","--ui-muted-surface":"#eef0f6","--ui-muted-border":"#d8dcea","--ui-muted-text":"#6b7280","--ui-panel-input-bg":"#ffffff","--ui-panel-input-text":"#111827","--ui-panel-input-border":"#d8dcea","--ui-drawer-tab-text":"#6b7280","--ui-drawer-tab-active":"#111827","--ui-history-item-text":"#1f2937","--ui-history-meta":"#9ca3af","--ui-success":"#059669","--ui-error":"#dc2626"},termHostBg:"#ffffff",keybar:{bg:"#eef0f6",border:"#dfe3ee",keyBg:"#ffffff",keyBorder:"#d8dcea",keyText:"#4b5563",accent:"#4f6ef7",accentText:"#ffffff",drag:"#a5b4fc"},xterm:{background:"#ffffff",foreground:"#1f2937",cursor:"#4f6ef7",selectionBackground:"#c7d2fe",black:"#24292e",red:"#d73a49",green:"#22863a",yellow:"#b08800",blue:"#005cc5",magenta:"#6f42c1",cyan:"#1b7c83",white:"#6a737d",brightBlack:"#959da5",brightWhite:"#fafbfc"}},{id:"scifi",label:"科幻霓虹",swatch:"#050a14",preview:["#050a14","#22d3ee"],cssVars:{"--ui-color-scheme":"dark","--ui-root-bg":"#050a14","--ui-text":"#e2f3ff","--ui-tabbar-bg":"#0a1220","--ui-tabbar-border":"#10263c","--ui-tab-bg":"#0d1626","--ui-tab-text":"#5c7893","--ui-tab-active-bg":"#122036","--ui-tab-active-text":"#e2f3ff","--ui-tab-accent":"#22d3ee","--ui-connection-bg":"#0a1220","--ui-connection-text":"#5c7893","--ui-tree-bg":"#0d1626","--ui-tree-border":"#10263c","--ui-term-col-bg":"#050a14","--ui-fab-bg":"#122036","--ui-fab-border":"#155e75","--ui-muted-surface":"#0d1626","--ui-muted-border":"#164e63","--ui-muted-text":"#9fb8d0","--ui-panel-input-bg":"#0a1220","--ui-panel-input-text":"#e2f3ff","--ui-panel-input-border":"#164e63","--ui-drawer-tab-text":"#5c7893","--ui-drawer-tab-active":"#e2f3ff","--ui-history-item-text":"#d5ecfb","--ui-history-meta":"#5c7893","--ui-success":"#34d399","--ui-error":"#fb7185"},termHostBg:"#0a1220",keybar:{bg:"#0a1220",border:"#10263c",keyBg:"#0d1626",keyBorder:"#164e63",keyText:"#9fb8d0",accent:"#22d3ee",accentText:"#04121a",drag:"#155e75"},xterm:{background:"#0a1220",foreground:"#e2f3ff",cursor:"#22d3ee",selectionBackground:"#164e63",black:"#0d1626",red:"#fb7185",green:"#34d399",yellow:"#fbbf24",blue:"#38bdf8",magenta:"#e879f9",cyan:"#22d3ee",white:"#e2f3ff",brightBlack:"#5c7893",brightWhite:"#ffffff"}},{id:"noir",label:"暗夜黑",swatch:"#0f1115",preview:["#0f1115","#a78bfa"],cssVars:{"--ui-color-scheme":"dark","--ui-root-bg":"#0f1115","--ui-text":"#eceff4","--ui-tabbar-bg":"#14171d","--ui-tabbar-border":"#232833","--ui-tab-bg":"#191d24","--ui-tab-text":"#6b7280","--ui-tab-active-bg":"#1f242d","--ui-tab-active-text":"#eceff4","--ui-tab-accent":"#a78bfa","--ui-connection-bg":"#14171d","--ui-connection-text":"#6b7280","--ui-tree-bg":"#191d24","--ui-tree-border":"#232833","--ui-term-col-bg":"#0f1115","--ui-fab-bg":"#1f242d","--ui-fab-border":"#2a3040","--ui-muted-surface":"#191d24","--ui-muted-border":"#2a3040","--ui-muted-text":"#aab2bf","--ui-panel-input-bg":"#14171d","--ui-panel-input-text":"#eceff4","--ui-panel-input-border":"#2a3040","--ui-drawer-tab-text":"#6b7280","--ui-drawer-tab-active":"#eceff4","--ui-history-item-text":"#d7dce4","--ui-history-meta":"#6b7280","--ui-success":"#4ade80","--ui-error":"#f87171"},termHostBg:"#14171d",keybar:{bg:"#14171d",border:"#232833",keyBg:"#191d24",keyBorder:"#2a3040",keyText:"#aab2bf",accent:"#a78bfa",accentText:"#0f1115",drag:"#4b4470"},xterm:{background:"#14171d",foreground:"#eceff4",cursor:"#a78bfa",selectionBackground:"#3b3654",black:"#191d24",red:"#f87171",green:"#4ade80",yellow:"#fbbf24",blue:"#60a5fa",magenta:"#c084fc",cyan:"#67e8f9",white:"#eceff4",brightBlack:"#6b7280",brightWhite:"#ffffff"}},{id:"mist",label:"雾白靛蓝",swatch:"#f7f8fb",preview:["#f7f8fb","#4258c4"],cssVars:{"--ui-color-scheme":"light","--ui-root-bg":"#f7f8fb","--ui-text":"#252d3d","--ui-tabbar-bg":"#e4e9f2","--ui-tabbar-border":"#dce3ef","--ui-tab-bg":"#e9edf5","--ui-tab-text":"#5b687f","--ui-tab-active-bg":"#f7f8fb","--ui-tab-active-text":"#252d3d","--ui-tab-accent":"#4258c4","--ui-connection-bg":"#e4e9f2","--ui-connection-text":"#5b687f","--ui-tree-bg":"#e9edf5","--ui-tree-border":"#dce3ef","--ui-term-col-bg":"#f7f8fb","--ui-fab-bg":"#ffffff","--ui-fab-border":"#dce3ef","--ui-muted-surface":"#e9edf5","--ui-muted-border":"#dce3ef","--ui-muted-text":"#5b687f","--ui-panel-input-bg":"#ffffff","--ui-panel-input-text":"#252d3d","--ui-panel-input-border":"#dce3ef","--ui-drawer-tab-text":"#5b687f","--ui-drawer-tab-active":"#252d3d","--ui-history-item-text":"#252d3d","--ui-history-meta":"#5b687f","--ui-success":"#247860","--ui-error":"#be3d50"},termHostBg:"#ffffff",keybar:{bg:"#e4e9f2",border:"#dce3ef",keyBg:"#ffffff",keyBorder:"#dce3ef",keyText:"#5b687f",accent:"#4258c4",accentText:"#ffffff",drag:"#8a9ac5"},xterm:{background:"#ffffff",foreground:"#252d3d",cursor:"#4258c4",selectionBackground:"#d6dcf4",black:"#252d3d",red:"#be3d50",green:"#247860",yellow:"#956018",blue:"#346faa",magenta:"#7456a6",cyan:"#277784",white:"#5b687f",brightBlack:"#5b687f",brightWhite:"#f7f8fb"}},{id:"pine",label:"暖灰松绿",swatch:"#f6f7f3",preview:["#f6f7f3","#356c55"],cssVars:{"--ui-color-scheme":"light","--ui-root-bg":"#f6f7f3","--ui-text":"#2d382f","--ui-tabbar-bg":"#e2e7df","--ui-tabbar-border":"#d9e1d6","--ui-tab-bg":"#e8ece5","--ui-tab-text":"#5b6e61","--ui-tab-active-bg":"#f6f7f3","--ui-tab-active-text":"#2d382f","--ui-tab-accent":"#356c55","--ui-connection-bg":"#e2e7df","--ui-connection-text":"#5b6e61","--ui-tree-bg":"#e8ece5","--ui-tree-border":"#d9e1d6","--ui-term-col-bg":"#f6f7f3","--ui-fab-bg":"#ffffff","--ui-fab-border":"#d9e1d6","--ui-muted-surface":"#e8ece5","--ui-muted-border":"#d9e1d6","--ui-muted-text":"#5b6e61","--ui-panel-input-bg":"#ffffff","--ui-panel-input-text":"#2d382f","--ui-panel-input-border":"#d9e1d6","--ui-drawer-tab-text":"#5b6e61","--ui-drawer-tab-active":"#2d382f","--ui-history-item-text":"#2d382f","--ui-history-meta":"#5b6e61","--ui-success":"#357450","--ui-error":"#b6454d"},termHostBg:"#ffffff",keybar:{bg:"#e2e7df",border:"#d9e1d6",keyBg:"#ffffff",keyBorder:"#d9e1d6",keyText:"#5b6e61",accent:"#356c55",accentText:"#ffffff",drag:"#86a38b"},xterm:{background:"#ffffff",foreground:"#2d382f",cursor:"#356c55",selectionBackground:"#d4e1d9",black:"#2d382f",red:"#b6454d",green:"#357450",yellow:"#8c641e",blue:"#3d7189",magenta:"#805e88",cyan:"#317c74",white:"#5b6e61",brightBlack:"#5b6e61",brightWhite:"#f6f7f3"}},{id:"graphite",label:"石墨夜色",swatch:"#202630",preview:["#202630","#a4bad2"],cssVars:{"--ui-color-scheme":"dark","--ui-root-bg":"#202630","--ui-text":"#e4ebf4","--ui-tabbar-bg":"#161c25","--ui-tabbar-border":"#384859","--ui-tab-bg":"#161c25","--ui-tab-text":"#b0bfd3","--ui-tab-active-bg":"#202630","--ui-tab-active-text":"#e4ebf4","--ui-tab-accent":"color-mix(in srgb, #386a9a 40%, #ecf0f8)","--ui-connection-bg":"#161c25","--ui-connection-text":"#b0bfd3","--ui-tree-bg":"#161c25","--ui-tree-border":"#384859","--ui-term-col-bg":"#202630","--ui-fab-bg":"#293440","--ui-fab-border":"#384859","--ui-muted-surface":"#161c25","--ui-muted-border":"#384859","--ui-muted-text":"#b0bfd3","--ui-panel-input-bg":"#293440","--ui-panel-input-text":"#e4ebf4","--ui-panel-input-border":"#384859","--ui-drawer-tab-text":"#b0bfd3","--ui-drawer-tab-active":"#e4ebf4","--ui-history-item-text":"#e4ebf4","--ui-history-meta":"#b0bfd3","--ui-success":"#89d3af","--ui-error":"#f097a2"},termHostBg:"#202630",keybar:{bg:"#161c25",border:"#384859",keyBg:"#293440",keyBorder:"#384859",keyText:"#b0bfd3",accent:"#a4bad2",accentText:"#14212b",drag:"#61778c"},xterm:{background:"#202630",foreground:"#e4ebf4",cursor:"#a4bad2",selectionBackground:"#2a3e53",black:"#161c25",red:"#f097a2",green:"#89d3af",yellow:"#e5c58a",blue:"#9accf0",magenta:"#c4b3e1",cyan:"#91cfd6",white:"#e4ebf4",brightBlack:"#b0bfd3",brightWhite:"#ffffff"}}].map(e=>[e.id,e])),o={dark:"noir",black:"noir",gray:"noir",blue:"noir",red:"noir",yellow:"noir",green:"noir",white:"pearl"};function s(e){if(e&&e in n)return n[e];let t=e?o[e]:void 0;return t?n[t]:n.pearl}r(2761);let l="force-dynamic";function c(){try{let{userId:e}=(0,i.nQ)();return s(i.hw.getPreferences(e)?.theme)}catch{return s(void 0)}}function d(){let e=c();return{colorScheme:e.cssVars["--ui-color-scheme"],themeColor:e.cssVars["--ui-tabbar-bg"]}}function u({children:e}){let t=c(),r={...t.cssVars,colorScheme:t.cssVars["--ui-color-scheme"],background:t.cssVars["--ui-root-bg"],color:t.cssVars["--ui-text"]};return a.jsx("div",{id:"web-theme-root","data-web-theme":t.id,style:r,children:e})}},6742:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>a});let a=(0,r(8979).createProxy)(String.raw`/private/tmp/agentroam-all64.baB7t1/source/packages/server/app/web/page.tsx#default`)},785:(e,t,r)=>{"use strict";r.d(t,{ME:()=>s,kO:()=>o,sr:()=>l});var a=r(9411);let i=function(){let e=process.argv[1];if(e){let t=(0,a.dirname)((0,a.resolve)(e)),r=`${a.sep}node_modules${a.sep}.bin`;return t.endsWith(r)?(0,a.resolve)(t,"..",".."):t}return(0,a.resolve)(process.cwd())}();function n(e=process.env,t=i){return(0,a.resolve)(e.AGENT_DATA_DIR?.trim()||t)}function o(){return n()}function s(e=process.env,t=n(e)){let r=e.AGENT_LOG_DIR?.trim();if(r)return(0,a.resolve)(r);let i=e.AGENTROAM_DATA_DIR?.trim();return i?(0,a.resolve)(i,"logs"):(0,a.join)(t,".agent-data","logs")}function l(){return function(e=process.env,t=i){return(0,a.resolve)(e.AGENT_WORKING_DIRECTORY?.trim()||t)}(process.env,o())}},2110:(e,t,r)=>{"use strict";r.d(t,{hw:()=>n.hw,nQ:()=>s});var a=r(1636),i=r(785),n=r(3710);let o=new a.SQLiteAnonymousWebStore((0,i.kO)());function s(){return{userId:o.getOrCreatePrincipal().userId,username:"local",deviceId:"browser"}}},3710:(e,t,r)=>{"use strict";r.d(t,{$U:()=>u,Ci:()=>f,VP:()=>n,Xd:()=>d,ZA:()=>s,ap:()=>p,hw:()=>l,ki:()=>o,yN:()=>b});var a=r(1636),i=r(785);let n="customer_agent_session",o="customer_agent_device",s=new a.WebAuthService(new a.SQLiteAuthStore((0,i.kO)())),l=new a.SQLiteWebConsoleStore((0,i.kO)());function c(e){let t={};for(let r of(e.headers.get("cookie")||"").split(";")){let e=r.indexOf("=");e>0&&(t[r.slice(0,e).trim()]=decodeURIComponent(r.slice(e+1).trim()))}return t}function d(e){return c(e)[n]||null}function u(e){let t=c(e);return{ip:e.headers.get("x-forwarded-for")?.split(",")[0].trim()||"unknown",userAgent:e.headers.get("user-agent")||"",deviceId:t[o],deviceName:e.headers.get("x-device-name")||""}}function p(e){let t=s.authenticateToken(d(e));return s.validateCsrf(t,e.headers.get("x-csrf-token")),t}function f(e,t,r){return{httpOnly:r,sameSite:"strict",secure:"https"===("1"===process.env.AGENT_TRUST_TUNNEL_PROXY?e.headers.get("x-forwarded-proto"):null)||"https:"===new URL(e.url).protocol,path:"/",maxAge:t}}function b(e){let t=e instanceof a.WebAuthError?e:new a.WebAuthError("UNAUTHENTICATED","认证失败",401);return Response.json({error:{code:t.code,message:t.message}},{status:t.status})}},2761:()=>{}};var t=require("../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),a=t.X(0,[8375,5303],()=>r(2068));module.exports=a})();
|
|
326
|
+
`;var ec=r(1321),ed=r.n(ec);function eu({label:e="FLOW STUDIO",title:t="正在打开 Flow Studio",caption:r="即将进入你的创作空间",icon:a=i.jsx(k,{size:36,strokeWidth:1.5})}={}){return(0,i.jsxs)("div",{role:"status","aria-live":"polite",className:"jsx-f8b6a4420911d242 flow-loading",children:[(0,i.jsxs)("div",{"aria-hidden":"true",className:"jsx-f8b6a4420911d242 flow-loader-art",children:[i.jsx("div",{className:"jsx-f8b6a4420911d242 flow-loader-halo"}),i.jsx("div",{className:"jsx-f8b6a4420911d242 flow-loader-orbit orbit-outer",children:i.jsx("i",{className:"jsx-f8b6a4420911d242"})}),i.jsx("div",{className:"jsx-f8b6a4420911d242 flow-loader-orbit orbit-inner",children:i.jsx("i",{className:"jsx-f8b6a4420911d242"})}),i.jsx("div",{className:"jsx-f8b6a4420911d242 flow-loader-core",children:a}),i.jsx("span",{className:"jsx-f8b6a4420911d242 flow-loader-node node-one"}),i.jsx("span",{className:"jsx-f8b6a4420911d242 flow-loader-node node-two"}),i.jsx("span",{className:"jsx-f8b6a4420911d242 flow-loader-node node-three"})]}),(0,i.jsxs)("div",{className:"jsx-f8b6a4420911d242 flow-loader-copy",children:[i.jsx("span",{className:"jsx-f8b6a4420911d242 flow-loader-label",children:e}),i.jsx("strong",{className:"jsx-f8b6a4420911d242",children:t}),i.jsx("span",{className:"jsx-f8b6a4420911d242 flow-loader-caption",children:r})]}),i.jsx("div",{"aria-hidden":"true",className:"jsx-f8b6a4420911d242 flow-loader-track",children:i.jsx("span",{className:"jsx-f8b6a4420911d242"})}),i.jsx(ed(),{id:"f8b6a4420911d242",children:".flow-loading.jsx-f8b6a4420911d242{position:absolute;inset:0;display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;-moz-box-orient:vertical;-moz-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-align:center;-webkit-align-items:center;-moz-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-moz-box-pack:center;-ms-flex-pack:center;justify-content:center;overflow:hidden;gap:26px;color:var(--ui-text,#e5e7eb);background:var(--ui-term-col-bg,#101014);-webkit-animation:flow-appear 280ms ease-out both;-moz-animation:flow-appear 280ms ease-out both;-o-animation:flow-appear 280ms ease-out both;animation:flow-appear 280ms ease-out both}.flow-loader-art.jsx-f8b6a4420911d242{position:relative;width:200px;height:200px;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0}.flow-loader-halo.jsx-f8b6a4420911d242{position:absolute;inset:-40px;-webkit-border-radius:50%;-moz-border-radius:50%;border-radius:50%;background:-webkit-radial-gradient(circle,#54e5cf26,#54e5cf08 45%,transparent 70%);background:-moz-radial-gradient(circle,#54e5cf26,#54e5cf08 45%,transparent 70%);background:-o-radial-gradient(circle,#54e5cf26,#54e5cf08 45%,transparent 70%);background:radial-gradient(circle,#54e5cf26,#54e5cf08 45%,transparent 70%);-webkit-animation:flow-breathe 3s ease-in-out infinite;-moz-animation:flow-breathe 3s ease-in-out infinite;-o-animation:flow-breathe 3s ease-in-out infinite;animation:flow-breathe 3s ease-in-out infinite}.flow-loader-orbit.jsx-f8b6a4420911d242{position:absolute;-webkit-border-radius:50%;-moz-border-radius:50%;border-radius:50%;border:1px solid#54e5cf26}.orbit-outer.jsx-f8b6a4420911d242{inset:8px;border-top-color:#54e5cf;border-right-color:#54e5cf70;-webkit-animation:flow-orbit 3.2s linear infinite;-moz-animation:flow-orbit 3.2s linear infinite;-o-animation:flow-orbit 3.2s linear infinite;animation:flow-orbit 3.2s linear infinite}.orbit-inner.jsx-f8b6a4420911d242{inset:30px;border-bottom-color:#8bbcff;border-left-color:#8bbcff60;animation:flow-orbit 2.4s linear infinite reverse}.flow-loader-orbit.jsx-f8b6a4420911d242 i.jsx-f8b6a4420911d242{position:absolute;top:13%;left:13%;width:7px;height:7px;-webkit-border-radius:50%;-moz-border-radius:50%;border-radius:50%;background:#77f8df;-webkit-box-shadow:0 0 14px#54e5cf;-moz-box-shadow:0 0 14px#54e5cf;box-shadow:0 0 14px#54e5cf}.orbit-inner.jsx-f8b6a4420911d242 i.jsx-f8b6a4420911d242{background:#8bbcff;-webkit-box-shadow:0 0 14px#8bbcff;-moz-box-shadow:0 0 14px#8bbcff;box-shadow:0 0 14px#8bbcff}.flow-loader-core.jsx-f8b6a4420911d242{position:absolute;inset:62px;display:grid;-webkit-box-align:center;-webkit-align-items:center;-moz-box-align:center;-ms-flex-align:center;align-items:center;justify-items:center;place-items:center;-webkit-border-radius:24px;-moz-border-radius:24px;border-radius:24px;color:#64e9d3;border:1px solid#54e5cf66;background:-webkit-linear-gradient(305deg,#54e5cf20,#8bbcff0d);background:-moz-linear-gradient(305deg,#54e5cf20,#8bbcff0d);background:-o-linear-gradient(305deg,#54e5cf20,#8bbcff0d);background:linear-gradient(145deg,#54e5cf20,#8bbcff0d);-webkit-box-shadow:0 0 35px#54e5cf15,inset 0 0 18px#54e5cf0d;-moz-box-shadow:0 0 35px#54e5cf15,inset 0 0 18px#54e5cf0d;box-shadow:0 0 35px#54e5cf15,inset 0 0 18px#54e5cf0d;-webkit-animation:flow-breathe 3s ease-in-out infinite;-moz-animation:flow-breathe 3s ease-in-out infinite;-o-animation:flow-breathe 3s ease-in-out infinite;animation:flow-breathe 3s ease-in-out infinite}.flow-loader-node.jsx-f8b6a4420911d242{position:absolute;width:5px;height:5px;-webkit-border-radius:50%;-moz-border-radius:50%;border-radius:50%;background:#8bbcff;-webkit-animation:flow-node 2s ease-in-out infinite;-moz-animation:flow-node 2s ease-in-out infinite;-o-animation:flow-node 2s ease-in-out infinite;animation:flow-node 2s ease-in-out infinite}.node-one.jsx-f8b6a4420911d242{left:0;top:100px}.node-two.jsx-f8b6a4420911d242{right:17px;top:38px;-webkit-animation-delay:.5s;-moz-animation-delay:.5s;-o-animation-delay:.5s;animation-delay:.5s}.node-three.jsx-f8b6a4420911d242{bottom:9px;right:57px;-webkit-animation-delay:1s;-moz-animation-delay:1s;-o-animation-delay:1s;animation-delay:1s}.flow-loader-copy.jsx-f8b6a4420911d242{display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;-moz-box-orient:vertical;-moz-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-align:center;-webkit-align-items:center;-moz-box-align:center;-ms-flex-align:center;align-items:center;gap:10px;text-align:center;padding:0 20px}.flow-loader-label.jsx-f8b6a4420911d242{font:10px ui-monospace,monospace;letter-spacing:.3em;color:#64cbbb}.flow-loader-copy.jsx-f8b6a4420911d242 strong.jsx-f8b6a4420911d242{font-size:18px;font-weight:500;letter-spacing:.02em}.flow-loader-caption.jsx-f8b6a4420911d242{font-size:12px;color:var(--ui-text-muted,#9399aa)}.flow-loader-track.jsx-f8b6a4420911d242{width:128px;height:2px;overflow:hidden;background:#54e5cf20;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px}.flow-loader-track.jsx-f8b6a4420911d242 span.jsx-f8b6a4420911d242{display:block;width:45%;height:100%;background:-webkit-linear-gradient(left,transparent,#64e9d3,#8bbcff);background:-moz-linear-gradient(left,transparent,#64e9d3,#8bbcff);background:-o-linear-gradient(left,transparent,#64e9d3,#8bbcff);background:linear-gradient(90deg,transparent,#64e9d3,#8bbcff);-webkit-animation:flow-travel 1.8s ease-in-out infinite;-moz-animation:flow-travel 1.8s ease-in-out infinite;-o-animation:flow-travel 1.8s ease-in-out infinite;animation:flow-travel 1.8s ease-in-out infinite}@-webkit-keyframes flow-orbit{to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@-moz-keyframes flow-orbit{to{-moz-transform:rotate(360deg);transform:rotate(360deg)}}@-o-keyframes flow-orbit{to{-o-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes flow-orbit{to{-webkit-transform:rotate(360deg);-moz-transform:rotate(360deg);-o-transform:rotate(360deg);transform:rotate(360deg)}}@-webkit-keyframes flow-breathe{50%{-webkit-transform:scale(1.05);transform:scale(1.05);opacity:.7}}@-moz-keyframes flow-breathe{50%{-moz-transform:scale(1.05);transform:scale(1.05);opacity:.7}}@-o-keyframes flow-breathe{50%{-o-transform:scale(1.05);transform:scale(1.05);opacity:.7}}@keyframes flow-breathe{50%{-webkit-transform:scale(1.05);-moz-transform:scale(1.05);-o-transform:scale(1.05);transform:scale(1.05);opacity:.7}}@-webkit-keyframes flow-node{50%{opacity:.25;-webkit-transform:scale(.65);transform:scale(.65)}}@-moz-keyframes flow-node{50%{opacity:.25;-moz-transform:scale(.65);transform:scale(.65)}}@-o-keyframes flow-node{50%{opacity:.25;-o-transform:scale(.65);transform:scale(.65)}}@keyframes flow-node{50%{opacity:.25;-webkit-transform:scale(.65);-moz-transform:scale(.65);-o-transform:scale(.65);transform:scale(.65)}}@-webkit-keyframes flow-travel{from{-webkit-transform:translatex(-110%);transform:translatex(-110%)}to{-webkit-transform:translatex(330%);transform:translatex(330%)}}@-moz-keyframes flow-travel{from{-moz-transform:translatex(-110%);transform:translatex(-110%)}to{-moz-transform:translatex(330%);transform:translatex(330%)}}@-o-keyframes flow-travel{from{-o-transform:translatex(-110%);transform:translatex(-110%)}to{-o-transform:translatex(330%);transform:translatex(330%)}}@keyframes flow-travel{from{-webkit-transform:translatex(-110%);-moz-transform:translatex(-110%);-o-transform:translatex(-110%);transform:translatex(-110%)}to{-webkit-transform:translatex(330%);-moz-transform:translatex(330%);-o-transform:translatex(330%);transform:translatex(330%)}}@-webkit-keyframes flow-appear{from{opacity:0}to{opacity:1}}@-moz-keyframes flow-appear{from{opacity:0}to{opacity:1}}@-o-keyframes flow-appear{from{opacity:0}to{opacity:1}}@keyframes flow-appear{from{opacity:0}to{opacity:1}}@media(max-height:420px){.flow-loading.jsx-f8b6a4420911d242{gap:12px}.flow-loader-art.jsx-f8b6a4420911d242{width:200px;height:200px;zoom:.65}}@media(prefers-reduced-motion:reduce){.flow-loading.jsx-f8b6a4420911d242,.flow-loader-halo.jsx-f8b6a4420911d242,.flow-loader-orbit.jsx-f8b6a4420911d242,.flow-loader-core.jsx-f8b6a4420911d242,.flow-loader-node.jsx-f8b6a4420911d242,.flow-loader-track.jsx-f8b6a4420911d242 span.jsx-f8b6a4420911d242{-webkit-animation:none;-moz-animation:none;-o-animation:none;animation:none}}"})]})}function ef({page:e,reloadKey:t}){let[r,a]=(0,d.useState)(!0),[n,o]=(0,d.useState)(!1);return!function(e){let t=new URL(e).hostname;return"qoder.com"===t||t.endsWith(".qoder.com")}(e.url)?(0,i.jsxs)("main",{className:"computer-page-pane","aria-label":e.name,"aria-busy":r,children:[i.jsx("iframe",{title:e.name,src:e.url,referrerPolicy:"no-referrer",allow:"clipboard-read; clipboard-write; microphone; camera",sandbox:"allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox allow-downloads allow-modals",onLoad:()=>a(!1),onError:()=>{a(!1),o(!0)},style:{visibility:r?"hidden":"visible"}},`${e.id}:${t}`),r&&i.jsx(eu,{label:"REMOTE PAGE",title:`正在打开 ${e.name}`,caption:"正在连接页面",icon:i.jsx(B,{size:36,strokeWidth:1.5})}),n&&i.jsx("a",{className:"computer-page-fallback",href:e.url,target:"_blank",rel:"noopener noreferrer",children:"打开原页面"})]}):(0,i.jsxs)("main",{className:"computer-page-blocked",children:[i.jsx(B,{size:36,strokeWidth:1.5,"aria-hidden":"true"}),(0,i.jsxs)("h2",{children:[e.name," 不允许内嵌"]}),i.jsx("p",{children:"这个网站限制了当前页面打开。可以在新页面使用,也可以在电脑菜单中修改打开方式。"}),(0,i.jsxs)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",children:[i.jsx(x,{size:16,"aria-hidden":"true"}),"打开新页面"]})]})}let ep=m("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]),eb=m("ChevronsRight",[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]),em=m("ChevronsLeft",[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]]);function eh({items:e,avatar:t,glass:r=!1}){let[a,n]=(0,d.useState)(!1),o=r&&a,s=r&&!a,l=(0,d.useRef)(null),c=(0,d.useRef)(null),u=(0,d.useRef)(null),f=(0,d.useRef)(null),p=(0,d.useRef)(null),b=(0,d.useRef)(new Map),[m,h]=(0,d.useState)(null),[x,g]=(0,d.useState)(!1),[y,w]=(0,d.useState)(!1),[v,k]=(0,d.useState)({top:-1e3,left:0}),[j,S]=(0,d.useState)({fullFits:!1,inlineIndices:[],overflowIndices:[]}),C=new Set(j.inlineIndices),N=j.fullFits||x,R=N&&j.overflowIndices.length>0;(0,d.useLayoutEffect)(()=>{let t=l.current?.closest(".terminal-tabs"),a=t?.querySelector(".terminal-tab-list"),i=l.current?.closest(".terminal-connection");if(!t||!a||!i||!m||r)return;let n=0,o=()=>{let r=getComputedStyle(t),n=getComputedStyle(i),o=getComputedStyle(a),s=Array.from(a.children),l=s.reduce((e,t)=>e+t.offsetWidth,0)+Math.max(0,s.length-1)*(parseFloat(o.columnGap)||0),d=(parseFloat(r.paddingLeft)||0)+(parseFloat(r.paddingRight)||0)+(parseFloat(n.paddingLeft)||0)+(parseFloat(n.paddingRight)||0)+2*(parseFloat(r.columnGap)||0)+(t.querySelector(".terminal-add")?.offsetWidth??30),f=t.clientWidth-d,p=function(e){let t=e.toolWidths.flatMap((e,t)=>e>0?[t]:[]),r=t=>t.reduce((t,r)=>t+e.toolWidths[r],0)+t.length*e.gap,a=r(t)+e.avatarWidth<=e.fullAvailableWidth;if(a)return{fullFits:a,inlineIndices:t,overflowIndices:[]};if(!e.expanded)return{fullFits:a,inlineIndices:[],overflowIndices:t};let i=e.availableWidth-e.avatarWidth-e.toggleWidth;if(r(t)<=i)return{fullFits:a,inlineIndices:t,overflowIndices:[]};let n=[];for(let a of t){if(r([...n,a])>i-e.toggleWidth)break;n.push(a)}return{fullFits:a,inlineIndices:n,overflowIndices:t.slice(n.length)}}({toolWidths:e.map(e=>b.current.get(e.id)?.offsetWidth??0),fullAvailableWidth:f-l,availableWidth:f-Math.min(l,Math.max(64,Math.min(130,t.clientWidth/4))),avatarWidth:c.current?.offsetWidth??44,toggleWidth:u.current?.offsetWidth??40,gap:0,expanded:x});S(e=>JSON.stringify(e)===JSON.stringify(p)?e:p),(p.fullFits||!x||0===p.overflowIndices.length)&&w(!1)},s=()=>{cancelAnimationFrame(n),n=requestAnimationFrame(o)},d=new ResizeObserver(s);for(let e of[t,a,l.current,f.current,...b.current.values()])e&&d.observe(e);let p=new MutationObserver(s);return p.observe(a,{childList:!0,subtree:!0,characterData:!0}),f.current&&p.observe(f.current,{childList:!0,subtree:!0}),o(),()=>{cancelAnimationFrame(n),d.disconnect(),p.disconnect()}},[x,m,e.map(e=>e.id).join(","),j.inlineIndices.join(","),r]),(0,d.useLayoutEffect)(()=>{if(!y)return;let e=()=>{let e=p.current?.getBoundingClientRect();if(!e)return;let t=s?f.current?.getBoundingClientRect().width??Math.min(292,innerWidth-16):Math.min(292,innerWidth-16),r=l.current?.closest(".terminal-tabs")?.getBoundingClientRect().bottom??e.bottom;k({top:Math.max(e.bottom,r)+6,left:Math.max(8,Math.min(innerWidth-t-8,e.right-t))})};e();let t=new ResizeObserver(e);return s&&f.current&&t.observe(f.current),window.addEventListener("resize",e),window.addEventListener("scroll",e,!0),()=>{t.disconnect(),window.removeEventListener("resize",e),window.removeEventListener("scroll",e,!0)}},[y,s,j.inlineIndices.join(",")]);let T=e=>i.jsx("div",{className:"toolbar-slot","data-toolbar-item":e.id,ref:t=>{t?b.current.set(e.id,t):b.current.delete(e.id)},children:e.content},e.id);if(s){let r=["files","remote"].flatMap(t=>e.filter(e=>e.id===t)),a=e.filter(e=>!["files","remote"].includes(e.id));return(0,i.jsxs)("div",{ref:l,className:"responsive-toolbar glass-desktop-toolbar",children:[(0,i.jsxs)("div",{className:"glass-desktop-actions",children:[r.map(T),a.length>0&&i.jsx("button",{ref:p,type:"button",className:"file-drawer-toggle","aria-label":"更多功能",title:"更多功能","aria-haspopup":"dialog","aria-expanded":y,onClick:()=>w(e=>!e),children:i.jsx(ep,{size:20})})]}),i.jsx("div",{className:"toolbar-avatar",onPointerDown:()=>w(!1),children:t}),y&&m&&(0,z.createPortal)(i.jsx("div",{ref:f,className:"glass-desktop-menu",role:"dialog","aria-label":"更多功能","data-toolbar-overlay":!0,style:{position:"fixed",top:v.top,left:v.left,zIndex:200},children:a.map(T)}),m)]})}if(o){let r={refresh:"刷新页面",collaboration:"群聊看板",install:"安装应用",remote:"远程桌面","ai-hub":"AI Hub",flow:"数字人",theme:"皮肤",files:"我的文件"},a=i.jsx("div",{className:"glass-mobile-actions",style:{display:"flex",alignItems:"center",gap:4},children:i.jsx("button",{type:"button",className:"file-drawer-toggle ui-icon-button","aria-label":"更多功能","aria-expanded":y,onClick:()=>w(e=>!e),children:i.jsx(ep,{size:20})})});return(0,i.jsxs)("div",{ref:l,className:"responsive-toolbar glass-mobile-toolbar",children:[e.filter(e=>"files"===e.id).map(T),a,i.jsx("div",{className:"toolbar-avatar",children:t}),y&&m&&(0,z.createPortal)(i.jsx("div",{className:"glass-tools-backdrop",onClick:()=>w(!1),children:(0,i.jsxs)("section",{className:"glass-tools-sheet",role:"dialog","aria-label":"更多功能","data-toolbar-overlay":!0,onClick:e=>e.stopPropagation(),children:[(0,i.jsxs)("header",{children:[i.jsx("strong",{children:"更多功能"}),i.jsx("button",{type:"button","aria-label":"关闭更多功能",onClick:()=>w(!1),children:"\xd7"})]}),i.jsx("div",{className:"glass-tools-grid",children:e.filter(e=>"files"!==e.id).map(e=>i.jsx("div",{className:"glass-tool-cell",title:r[e.id]??e.id,onClick:e=>{e.target instanceof Element&&e.target.closest("button")||e.currentTarget.querySelector("button")?.click()},children:e.content},e.id))})]})}),m)]})}return(0,i.jsxs)("div",{ref:l,className:"responsive-toolbar","data-toolbar-expanded":N,children:[i.jsx("span",{ref:u,className:"file-drawer-toggle toolbar-size-measure","aria-hidden":"true"}),R&&i.jsx("button",{ref:p,type:"button",className:"file-drawer-toggle toolbar-overflow-toggle","aria-label":"更多工具",title:"更多工具","aria-haspopup":"dialog","aria-expanded":y,onClick:()=>w(e=>!e),children:i.jsx(I,{size:17,"aria-hidden":"true"})}),j.inlineIndices.length>0&&i.jsx("div",{className:"toolbar-tools toolbar-tools-inline",children:e.filter((e,t)=>C.has(t)).map(T)}),e.length>0&&!j.fullFits&&i.jsx("button",{type:"button",className:"file-drawer-toggle toolbar-more","aria-label":x?"收起顶部工具":"展开顶部工具",title:x?"收起工具":"展开工具","aria-expanded":x,onClick:()=>{g(e=>!e),w(!1)},children:x?i.jsx(eb,{size:17,"aria-hidden":"true"}):i.jsx(em,{size:17,"aria-hidden":"true"})}),i.jsx("div",{ref:c,className:"toolbar-avatar",onPointerDown:()=>w(!1),children:t}),m&&(0,z.createPortal)(i.jsx("div",{ref:f,className:"toolbar-overflow theme-popover",role:"dialog","aria-label":"更多工具菜单","data-toolbar-overlay":!0,"aria-hidden":!y,style:{position:"fixed",top:y?v.top:-1e3,left:y?v.left:0,zIndex:200,width:Math.min(292,innerWidth-16),visibility:y?"visible":"hidden",boxSizing:"border-box",maxHeight:"calc(100dvh - 60px)",overflowY:"auto",padding:8,borderRadius:10,border:"1px solid var(--ui-tabbar-border, #282b36)",background:"var(--ui-tab-active-bg, #262b38)",boxShadow:"0 10px 28px rgba(0,0,0,.45)"},children:i.jsx("div",{className:"toolbar-tools toolbar-tools-expanded",children:e.filter((e,t)=>!C.has(t)).map(T)})}),m)]})}let ex=["refresh","collaboration","remote","theme","files","ai-hub","flow","install"],eg=["refresh","remote","theme","files"];function ey(e){if(!Array.isArray(e)||e.length>ex.length||e.some(e=>!ex.includes(e)))throw Error("顶部工具包含未知选项。");if(new Set(e).size!==e.length)throw Error("顶部工具不能重复。");return ex.filter(t=>e.includes(t))}function ew(e){if(!Array.isArray(e)||e.length>20)throw Error("每台电脑最多可添加 20 个页面。");let t=new Set;return e.map(e=>{let r;if(!e||"string"!=typeof e.id||!/^[A-Za-z0-9_-]{1,80}$/.test(e.id)||t.has(e.id))throw Error("页面标识无效或重复。");if("string"!=typeof e.name||!e.name.trim()||e.name.trim().length>60)throw Error("页面名称需为 1–60 个字符。");if(!["current","new-tab"].includes(e.openMode))throw Error("页面打开方式无效。");if("string"!=typeof e.url||e.url.length>8192)throw Error("请填写有效的 http(s) 页面地址。");try{r=new URL(e.url.trim())}catch{throw Error("请填写有效的 http(s) 页面地址。")}if(!["http:","https:"].includes(r.protocol)||r.username||r.password)throw Error("请填写无账号密码的 http(s) 页面地址。");return t.add(e.id),{id:e.id,name:e.name.trim(),url:r.href,openMode:e.openMode}})}class ev extends Error{constructor(e,t){super(e),this.status=t}}async function ek(e,t){let r=await fetch("/api/web-console/computer-settings",{method:t?"PATCH":"GET",credentials:"same-origin",cache:"no-store",headers:t?{"content-type":"application/json","x-csrf-token":e}:void 0,body:t?JSON.stringify(t):void 0,signal:AbortSignal.timeout(15e3)}).catch(e=>{throw Error(e?.name==="TimeoutError"?"电脑响应超时,请检查连接后重试。":"无法连接当前电脑,请检查连接后重试。")}),a=await r.json().catch(()=>null);if(!r.ok)throw new ev(a?.error?.message??"电脑配置保存失败,请检查连接后重试。",r.status);if(!a?.settings||!Number.isSafeInteger(a.settings.revision))throw Error("无法读取电脑配置,请重新加载。");return{...a.settings,visibleTools:ey(a.settings.visibleTools),savedPages:null===a.settings.savedPages?null:ew(a.settings.savedPages)}}let ej=["codex","claude agents","opencode","agent-tui"],eS={watcherFrame:4,producerFrame:5};function ez({ready:e=!1,error:t,onRetry:r}){let[a]=(0,d.useState)(Date.now),[n,o]=(0,d.useState)(Date.now),s=t||"数字人核心正在就绪";return(0,i.jsxs)("main",{className:`neural-boot${e?" is-ready":""}${t?" is-error":""}`,role:t?"alert":"status","aria-live":"polite","aria-busy":!e&&!t,"aria-hidden":e,children:[i.jsx("div",{className:"neural-grid","aria-hidden":"true"}),i.jsx("div",{className:"neural-rail neural-rail-left","aria-hidden":"true"}),i.jsx("div",{className:"neural-rail neural-rail-right","aria-hidden":"true"}),(0,i.jsxs)("section",{className:"neural-content",children:[(0,i.jsxs)("div",{className:"neural-brand","aria-hidden":"true",children:[i.jsx("span",{className:"neural-brand-signal"}),i.jsx("span",{children:"AgentRoam"}),i.jsx("small",{children:"NEURAL LINK"})]}),(0,i.jsxs)("div",{className:"neural-portrait","aria-hidden":"true",children:[i.jsx("span",{className:"neural-ring neural-ring-outer"}),i.jsx("span",{className:"neural-ring neural-ring-inner"}),i.jsx("span",{className:"neural-axis neural-axis-x"}),i.jsx("span",{className:"neural-axis neural-axis-y"}),i.jsx("span",{className:"neural-node neural-node-one"}),i.jsx("span",{className:"neural-node neural-node-two"}),i.jsx("span",{className:"neural-node neural-node-three"}),i.jsx("span",{className:"neural-node neural-node-four"}),i.jsx("div",{className:"neural-avatar-frame",children:(0,i.jsxs)("div",{className:"neural-avatar",children:[i.jsx(k,{className:"neural-avatar-icon",size:66,strokeWidth:1.3}),i.jsx("span",{className:"neural-visor"})]})})]}),(0,i.jsxs)("div",{className:"neural-copy",children:[i.jsx("strong",{children:"正在唤醒工作区"}),i.jsx("span",{children:s})]}),i.jsx("div",{className:"neural-progress","aria-hidden":"true",children:i.jsx("span",{})}),(0,i.jsxs)("div",{className:"neural-meta","aria-hidden":"true",children:[i.jsx("span",{children:"AGENT CORE"}),(0,i.jsxs)("span",{className:"neural-meta-time",children:["T+",Math.max(0,Math.floor((n-a)/1e3)).toString().padStart(2,"0"),"S"]})]}),t&&i.jsx("button",{type:"button",className:"neural-retry","aria-label":"重试连接",title:"重试连接",onClick:()=>r?.(),children:i.jsx(g,{size:18,"aria-hidden":"true"})})]})]})}function eC({children:e}){let t=function(){let[e,t]=(0,d.useState)("loading"),[r,a]=(0,d.useState)(null),[i]=(0,d.useState)("same-origin"),[n,o]=(0,d.useState)(null),s=(0,d.useCallback)(async()=>{t("loading"),o(null);try{let e=await fetch("/api/web-console/bootstrap",{credentials:"same-origin",cache:"no-store"});if(401===e.status||423===e.status){window.location.reload();return}if(!e.ok)throw Error(`HTTP ${e.status}`);let r=await e.json();a(r.user),t("authenticated")}catch{o("无法连接远程控制台"),t("needsLogin")}},[]),l=(0,d.useCallback)(async()=>{let e=await fetch("/api/web-console/bootstrap",{credentials:"same-origin",cache:"no-store"});if((401===e.status||423===e.status)&&window.location.reload(),!e.ok)throw Error("bootstrap failed");let r=await e.json();return a(r.user),t("authenticated"),r.wsNonce},[]),c=(0,d.useCallback)(async()=>(window.location.reload(),!1),[]);return{status:e,user:r,error:n,csrfToken:i,setup:c,login:c,logout:(0,d.useCallback)(async()=>{let e=await fetch("/api/pairing/logout",{method:"POST",credentials:"same-origin"});e.ok||401===e.status||423===e.status?window.location.reload():o("退出失败,请重试")},[]),refresh:s,getWsNonce:l}}(),[r,a]=(0,d.useState)(!1),n="authenticated"===t.status,o=(0,d.useCallback)(()=>a(!0),[]);return(0,i.jsxs)(i.Fragment,{children:[n?e(t,o):null,i.jsx(ez,{ready:n&&r,error:t.error,onRetry:()=>void t.refresh()})]})}let eN=m("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]),eR=m("TextCursorInput",[["path",{d:"M5 4h1a3 3 0 0 1 3 3 3 3 0 0 1 3-3h1",key:"18xjzo"}],["path",{d:"M13 20h-1a3 3 0 0 1-3-3 3 3 0 0 1-3 3H5",key:"fj48gi"}],["path",{d:"M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1",key:"1n9rhb"}],["path",{d:"M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7",key:"13ksps"}],["path",{d:"M9 7v10",key:"1vc8ob"}]]),eT=m("Pin",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]),eE=m("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);function eM(e,t,r){let a=e.findIndex(e=>e.id===t),i=e.findIndex(e=>e.id===r);if(a<0||i<0||a===i)return[...e];let n=[...e],[o]=n.splice(a,1);return n.splice(i,0,o),n}function eP(e,t="function"==typeof crypto.randomUUID?crypto.randomUUID():Array.from(crypto.getRandomValues(new Uint8Array(16)),e=>e.toString(16).padStart(2,"0")).join("")){return{id:t,command:e.trim()}}function eI({commands:e,onChange:t,onExecute:r}){let[a,n]=(0,d.useState)(null),[o,s]=(0,d.useState)(""),[l,c]=(0,d.useState)(null),u=(0,d.useRef)(null),f=()=>{if(!a)return;let r=a.value.trim();return r?r.length>1e3?s("命令最多 1000 个字符"):/[\r\n\0]/.test(r)?s("命令只能包含一行"):void(a.id?t(e.map(e=>e.id===a.id?{...e,command:r}:e)):t([...e,eP(r)]),n(null),s("")):s("命令不能为空")},p=(e,t)=>{e.preventDefault(),e.stopPropagation(),u.current=t,c(t),e.currentTarget.setPointerCapture(e.pointerId)},b=r=>{if(!u.current)return;let a=document.elementFromPoint(r.clientX,r.clientY)?.closest("[data-pinned-id]"),i=a?.dataset.pinnedId;i&&i!==u.current&&t(eM(e,u.current,i))},m=e=>{e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),u.current=null,c(null)},h=(r,a)=>{if("ArrowUp"!==r.key&&"ArrowDown"!==r.key)return;r.preventDefault();let i=e.findIndex(e=>e.id===a),n=e[i+("ArrowUp"===r.key?-1:1)];n&&t(eM(e,a,n.id))};return(0,i.jsxs)("section",{className:"pinned-commands","aria-labelledby":"pinned-command-title",children:[(0,i.jsxs)("div",{className:"pinned-command-head",children:[i.jsx("span",{id:"pinned-command-title",children:"置顶命令"}),i.jsx("button",{className:"history-icon-button",onClick:()=>{n({id:null,value:""}),s("")},"aria-label":"新增置顶命令",title:"新增置顶命令",children:i.jsx(N,{size:14,"aria-hidden":"true"})})]}),e.map(c=>a?.id===c.id?i.jsx(eA,{editor:a,error:o,onChange:e=>{n({...a,value:e}),s("")},onSave:f,onCancel:()=>{n(null),s("")}},c.id):(0,i.jsxs)("div",{className:`pinned-command-row${l===c.id?" pinned-command-dragging":""}`,"data-pinned-id":c.id,role:"button",tabIndex:0,onClick:()=>r(c.command),onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),r(c.command))},children:[i.jsx("button",{className:"pinned-command-grip",onPointerDown:e=>p(e,c.id),onPointerMove:b,onPointerUp:m,onPointerCancel:m,onKeyDown:e=>h(e,c.id),onClick:e=>e.stopPropagation(),"aria-label":`调整 ${c.command} 的顺序`,title:"拖动排序,或按上下方向键",children:i.jsx(eE,{size:14,"aria-hidden":"true"})}),i.jsx("code",{children:c.command}),(0,i.jsxs)("div",{className:"pinned-command-actions",onClick:e=>e.stopPropagation(),children:[i.jsx("button",{className:"history-icon-button",onClick:()=>{n({id:c.id,value:c.command}),s("")},"aria-label":`编辑 ${c.command}`,title:"编辑",children:i.jsx(_,{size:12,"aria-hidden":"true"})}),i.jsx("button",{className:"history-icon-button history-icon-danger",onClick:()=>t(e.filter(e=>e.id!==c.id)),"aria-label":`删除 ${c.command}`,title:"删除",children:i.jsx(L,{size:12,"aria-hidden":"true"})})]})]},c.id)),a?.id===null&&i.jsx(eA,{editor:a,error:o,onChange:e=>{n({...a,value:e}),s("")},onSave:f,onCancel:()=>{n(null),s("")}})]})}function eA({editor:e,error:t,onChange:r,onSave:a,onCancel:n}){return(0,i.jsxs)("div",{className:"pinned-command-editor",children:[i.jsx("input",{autoFocus:!0,value:e.value,maxLength:1e3,onChange:e=>r(e.target.value),onKeyDown:e=>{"Enter"===e.key&&a(),"Escape"===e.key&&n()},"aria-label":e.id?"编辑置顶命令":"新增置顶命令"}),i.jsx("button",{className:"history-icon-button",onClick:a,"aria-label":"保存命令",title:"保存",children:i.jsx(A,{size:13,"aria-hidden":"true"})}),i.jsx("button",{className:"history-icon-button",onClick:n,"aria-label":"取消编辑",title:"取消",children:i.jsx(S,{size:13,"aria-hidden":"true"})}),t&&i.jsx("small",{role:"alert",children:t})]})}async function eL(e){let t="undefined"==typeof navigator?void 0:navigator.clipboard;if("function"==typeof t?.writeText&&("undefined"==typeof isSecureContext||isSecureContext))try{return await t.writeText(e),!0}catch{}return function(e){if("undefined"==typeof document||!document.body||"function"!=typeof document.execCommand)return!1;let t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),Object.assign(t.style,{position:"fixed",top:"0",left:"-9999px",width:"1px",height:"1px",fontSize:"16px",opacity:"0",pointerEvents:"none"}),document.body.appendChild(t);try{return t.focus(),t.select(),t.setSelectionRange(0,t.value.length),document.execCommand("copy")}catch{return!1}finally{t.remove()}}(e)}function e_({csrfToken:e,terminalId:t,pinnedCommands:r,onPinnedCommandsChange:a,onFill:n,onExecute:o}){let[s,l]=(0,d.useState)([]),[c,u]=(0,d.useState)(""),[f,p]=(0,d.useState)(""),b=(0,d.useCallback)(async()=>{let e=new URLSearchParams({q:c,limit:"200"}),t=await fetch(`/api/web-console/history?${e}`,{credentials:"same-origin"});t.ok&&l((await t.json()).history)},[c]),m=async t=>{await fetch("/api/web-console/history",{method:"DELETE",credentials:"same-origin",headers:{"content-type":"application/json","x-csrf-token":e},body:JSON.stringify({id:t})}),b()},h=e=>{t&&n(e)},x=(0,d.useCallback)(e=>{"[REDACTED]"===e||r.some(t=>t.command===e)||a([...r,eP(e)])},[a,r]),y=async e=>{p(await eL(e)?"已复制命令":"复制失败,请长按命令手动复制")};return(0,i.jsxs)("div",{className:"history-panel",children:[i.jsx(eI,{commands:r,onChange:a,onExecute:o}),(0,i.jsxs)("div",{className:"history-search",children:[i.jsx("input",{value:c,onChange:e=>u(e.target.value),placeholder:"搜索命令"}),i.jsx("button",{className:"history-icon-button",onClick:b,"aria-label":"刷新历史",title:"刷新历史",children:i.jsx(g,{size:13,"aria-hidden":"true"})})]}),f&&i.jsx("div",{className:"terminal-clipboard-notice",role:"status",children:f}),s.map(e=>(0,i.jsxs)("div",{className:`history-item${t?"":" history-item-disabled"}`,role:"button",tabIndex:t?0:-1,onClick:()=>h(e.command),onKeyDown:r=>{r.target===r.currentTarget&&("Enter"===r.key||" "===r.key)&&t&&(r.preventDefault(),h(e.command))},children:[i.jsx("code",{children:e.command}),(0,i.jsxs)("small",{children:[e.cwd," \xb7 ",new Date(e.executedAt).toLocaleString()]}),(0,i.jsxs)("div",{className:"history-item-actions",onClick:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:[i.jsx("button",{className:"history-icon-button",onClick:()=>void y(e.command),"aria-label":"复制命令",title:"复制",children:i.jsx(eN,{size:12,"aria-hidden":"true"})}),i.jsx("button",{className:"history-icon-button",disabled:!t,onClick:()=>h(e.command),"aria-label":"填入命令",title:"填入",children:i.jsx(eR,{size:12,"aria-hidden":"true"})}),i.jsx("button",{className:"history-icon-button",disabled:"[REDACTED]"===e.command||r.some(t=>t.command===e.command),onClick:()=>x(e.command),"aria-label":"置顶命令",title:"置顶",children:i.jsx(eT,{size:12,"aria-hidden":"true"})}),i.jsx("button",{className:"history-icon-button history-icon-danger",onClick:()=>m(e.id),"aria-label":"删除历史",title:"删除",children:i.jsx(L,{size:12,"aria-hidden":"true"})})]})]},e.id)),!s.length&&i.jsx("div",{className:"history-empty",children:"暂无 Shell 命令历史"}),!t&&!!s.length&&i.jsx("div",{className:"history-empty",children:"请先打开一个终端页签"})]})}let eW=[{id:"pearl",label:"珍珠白",swatch:"#f5f6fa",preview:["#f5f6fa","#4f6ef7"],cssVars:{"--ui-color-scheme":"light","--ui-root-bg":"#f5f6fa","--ui-text":"#111827","--ui-tabbar-bg":"#eef0f6","--ui-tabbar-border":"#dfe3ee","--ui-tab-bg":"#e6e9f4","--ui-tab-text":"#5b6472","--ui-tab-active-bg":"#ffffff","--ui-tab-active-text":"#111827","--ui-tab-accent":"#4f6ef7","--ui-connection-bg":"#eef0f6","--ui-connection-text":"#9ca3af","--ui-tree-bg":"#fbfcfe","--ui-tree-border":"#e5e8f0","--ui-term-col-bg":"#f5f6fa","--ui-fab-bg":"#ffffff","--ui-fab-border":"#d8dcea","--ui-muted-surface":"#eef0f6","--ui-muted-border":"#d8dcea","--ui-muted-text":"#6b7280","--ui-panel-input-bg":"#ffffff","--ui-panel-input-text":"#111827","--ui-panel-input-border":"#d8dcea","--ui-drawer-tab-text":"#6b7280","--ui-drawer-tab-active":"#111827","--ui-history-item-text":"#1f2937","--ui-history-meta":"#9ca3af","--ui-success":"#059669","--ui-error":"#dc2626"},termHostBg:"#ffffff",keybar:{bg:"#eef0f6",border:"#dfe3ee",keyBg:"#ffffff",keyBorder:"#d8dcea",keyText:"#4b5563",accent:"#4f6ef7",accentText:"#ffffff",drag:"#a5b4fc"},xterm:{background:"#ffffff",foreground:"#1f2937",cursor:"#4f6ef7",selectionBackground:"#c7d2fe",black:"#24292e",red:"#d73a49",green:"#22863a",yellow:"#b08800",blue:"#005cc5",magenta:"#6f42c1",cyan:"#1b7c83",white:"#6a737d",brightBlack:"#959da5",brightWhite:"#fafbfc"}},{id:"scifi",label:"科幻霓虹",swatch:"#050a14",preview:["#050a14","#22d3ee"],cssVars:{"--ui-color-scheme":"dark","--ui-root-bg":"#050a14","--ui-text":"#e2f3ff","--ui-tabbar-bg":"#0a1220","--ui-tabbar-border":"#10263c","--ui-tab-bg":"#0d1626","--ui-tab-text":"#5c7893","--ui-tab-active-bg":"#122036","--ui-tab-active-text":"#e2f3ff","--ui-tab-accent":"#22d3ee","--ui-connection-bg":"#0a1220","--ui-connection-text":"#5c7893","--ui-tree-bg":"#0d1626","--ui-tree-border":"#10263c","--ui-term-col-bg":"#050a14","--ui-fab-bg":"#122036","--ui-fab-border":"#155e75","--ui-muted-surface":"#0d1626","--ui-muted-border":"#164e63","--ui-muted-text":"#9fb8d0","--ui-panel-input-bg":"#0a1220","--ui-panel-input-text":"#e2f3ff","--ui-panel-input-border":"#164e63","--ui-drawer-tab-text":"#5c7893","--ui-drawer-tab-active":"#e2f3ff","--ui-history-item-text":"#d5ecfb","--ui-history-meta":"#5c7893","--ui-success":"#34d399","--ui-error":"#fb7185"},termHostBg:"#0a1220",keybar:{bg:"#0a1220",border:"#10263c",keyBg:"#0d1626",keyBorder:"#164e63",keyText:"#9fb8d0",accent:"#22d3ee",accentText:"#04121a",drag:"#155e75"},xterm:{background:"#0a1220",foreground:"#e2f3ff",cursor:"#22d3ee",selectionBackground:"#164e63",black:"#0d1626",red:"#fb7185",green:"#34d399",yellow:"#fbbf24",blue:"#38bdf8",magenta:"#e879f9",cyan:"#22d3ee",white:"#e2f3ff",brightBlack:"#5c7893",brightWhite:"#ffffff"}},{id:"noir",label:"暗夜黑",swatch:"#0f1115",preview:["#0f1115","#a78bfa"],cssVars:{"--ui-color-scheme":"dark","--ui-root-bg":"#0f1115","--ui-text":"#eceff4","--ui-tabbar-bg":"#14171d","--ui-tabbar-border":"#232833","--ui-tab-bg":"#191d24","--ui-tab-text":"#6b7280","--ui-tab-active-bg":"#1f242d","--ui-tab-active-text":"#eceff4","--ui-tab-accent":"#a78bfa","--ui-connection-bg":"#14171d","--ui-connection-text":"#6b7280","--ui-tree-bg":"#191d24","--ui-tree-border":"#232833","--ui-term-col-bg":"#0f1115","--ui-fab-bg":"#1f242d","--ui-fab-border":"#2a3040","--ui-muted-surface":"#191d24","--ui-muted-border":"#2a3040","--ui-muted-text":"#aab2bf","--ui-panel-input-bg":"#14171d","--ui-panel-input-text":"#eceff4","--ui-panel-input-border":"#2a3040","--ui-drawer-tab-text":"#6b7280","--ui-drawer-tab-active":"#eceff4","--ui-history-item-text":"#d7dce4","--ui-history-meta":"#6b7280","--ui-success":"#4ade80","--ui-error":"#f87171"},termHostBg:"#14171d",keybar:{bg:"#14171d",border:"#232833",keyBg:"#191d24",keyBorder:"#2a3040",keyText:"#aab2bf",accent:"#a78bfa",accentText:"#0f1115",drag:"#4b4470"},xterm:{background:"#14171d",foreground:"#eceff4",cursor:"#a78bfa",selectionBackground:"#3b3654",black:"#191d24",red:"#f87171",green:"#4ade80",yellow:"#fbbf24",blue:"#60a5fa",magenta:"#c084fc",cyan:"#67e8f9",white:"#eceff4",brightBlack:"#6b7280",brightWhite:"#ffffff"}},{id:"mist",label:"雾白靛蓝",swatch:"#f7f8fb",preview:["#f7f8fb","#4258c4"],cssVars:{"--ui-color-scheme":"light","--ui-root-bg":"#f7f8fb","--ui-text":"#252d3d","--ui-tabbar-bg":"#e4e9f2","--ui-tabbar-border":"#dce3ef","--ui-tab-bg":"#e9edf5","--ui-tab-text":"#5b687f","--ui-tab-active-bg":"#f7f8fb","--ui-tab-active-text":"#252d3d","--ui-tab-accent":"#4258c4","--ui-connection-bg":"#e4e9f2","--ui-connection-text":"#5b687f","--ui-tree-bg":"#e9edf5","--ui-tree-border":"#dce3ef","--ui-term-col-bg":"#f7f8fb","--ui-fab-bg":"#ffffff","--ui-fab-border":"#dce3ef","--ui-muted-surface":"#e9edf5","--ui-muted-border":"#dce3ef","--ui-muted-text":"#5b687f","--ui-panel-input-bg":"#ffffff","--ui-panel-input-text":"#252d3d","--ui-panel-input-border":"#dce3ef","--ui-drawer-tab-text":"#5b687f","--ui-drawer-tab-active":"#252d3d","--ui-history-item-text":"#252d3d","--ui-history-meta":"#5b687f","--ui-success":"#247860","--ui-error":"#be3d50"},termHostBg:"#ffffff",keybar:{bg:"#e4e9f2",border:"#dce3ef",keyBg:"#ffffff",keyBorder:"#dce3ef",keyText:"#5b687f",accent:"#4258c4",accentText:"#ffffff",drag:"#8a9ac5"},xterm:{background:"#ffffff",foreground:"#252d3d",cursor:"#4258c4",selectionBackground:"#d6dcf4",black:"#252d3d",red:"#be3d50",green:"#247860",yellow:"#956018",blue:"#346faa",magenta:"#7456a6",cyan:"#277784",white:"#5b687f",brightBlack:"#5b687f",brightWhite:"#f7f8fb"}},{id:"glass",label:"毛玻璃",swatch:"#c3dbee",preview:["#c3dbee","#357b88"],cssVars:{"--ui-color-scheme":"light","--ui-root-bg":"#edf3f4","--ui-text":"#263e48","--ui-tabbar-bg":"#e0ebee","--ui-tabbar-border":"#d3e1e5","--ui-tab-bg":"#e5eef1","--ui-tab-text":"#58727c","--ui-tab-active-bg":"#edf3f4","--ui-tab-active-text":"#263e48","--ui-tab-accent":"#357b88","--ui-connection-bg":"#e0ebee","--ui-connection-text":"#58727c","--ui-tree-bg":"#e5eef1","--ui-tree-border":"#d3e1e5","--ui-term-col-bg":"#edf3f4","--ui-fab-bg":"#ffffff","--ui-fab-border":"#d3e1e5","--ui-muted-surface":"#e5eef1","--ui-muted-border":"#d3e1e5","--ui-muted-text":"#58727c","--ui-panel-input-bg":"#ffffff","--ui-panel-input-text":"#263e48","--ui-panel-input-border":"#d3e1e5","--ui-drawer-tab-text":"#58727c","--ui-drawer-tab-active":"#263e48","--ui-history-item-text":"#263e48","--ui-history-meta":"#58727c","--ui-success":"#247860","--ui-error":"#be3d50"},termHostBg:"#ffffff",keybar:{bg:"#e0ebee",border:"#d3e1e5",keyBg:"#ffffff",keyBorder:"#d3e1e5",keyText:"#58727c",accent:"#357b88",accentText:"#ffffff",drag:"#8a9ac5"},xterm:{background:"#ffffff",foreground:"#263e48",cursor:"#357b88",selectionBackground:"#d6dcf4",black:"#263e48",red:"#be3d50",green:"#247860",yellow:"#956018",blue:"#346faa",magenta:"#7456a6",cyan:"#277784",white:"#58727c",brightBlack:"#58727c",brightWhite:"#edf3f4"}},{id:"pine",label:"暖灰松绿",swatch:"#f6f7f3",preview:["#f6f7f3","#356c55"],cssVars:{"--ui-color-scheme":"light","--ui-root-bg":"#f6f7f3","--ui-text":"#2d382f","--ui-tabbar-bg":"#e2e7df","--ui-tabbar-border":"#d9e1d6","--ui-tab-bg":"#e8ece5","--ui-tab-text":"#5b6e61","--ui-tab-active-bg":"#f6f7f3","--ui-tab-active-text":"#2d382f","--ui-tab-accent":"#356c55","--ui-connection-bg":"#e2e7df","--ui-connection-text":"#5b6e61","--ui-tree-bg":"#e8ece5","--ui-tree-border":"#d9e1d6","--ui-term-col-bg":"#f6f7f3","--ui-fab-bg":"#ffffff","--ui-fab-border":"#d9e1d6","--ui-muted-surface":"#e8ece5","--ui-muted-border":"#d9e1d6","--ui-muted-text":"#5b6e61","--ui-panel-input-bg":"#ffffff","--ui-panel-input-text":"#2d382f","--ui-panel-input-border":"#d9e1d6","--ui-drawer-tab-text":"#5b6e61","--ui-drawer-tab-active":"#2d382f","--ui-history-item-text":"#2d382f","--ui-history-meta":"#5b6e61","--ui-success":"#357450","--ui-error":"#b6454d"},termHostBg:"#ffffff",keybar:{bg:"#e2e7df",border:"#d9e1d6",keyBg:"#ffffff",keyBorder:"#d9e1d6",keyText:"#5b6e61",accent:"#356c55",accentText:"#ffffff",drag:"#86a38b"},xterm:{background:"#ffffff",foreground:"#2d382f",cursor:"#356c55",selectionBackground:"#d4e1d9",black:"#2d382f",red:"#b6454d",green:"#357450",yellow:"#8c641e",blue:"#3d7189",magenta:"#805e88",cyan:"#317c74",white:"#5b6e61",brightBlack:"#5b6e61",brightWhite:"#f6f7f3"}},{id:"graphite",label:"石墨夜色",swatch:"#202630",preview:["#202630","#a4bad2"],cssVars:{"--ui-color-scheme":"dark","--ui-root-bg":"#202630","--ui-text":"#e4ebf4","--ui-tabbar-bg":"#161c25","--ui-tabbar-border":"#384859","--ui-tab-bg":"#161c25","--ui-tab-text":"#b0bfd3","--ui-tab-active-bg":"#202630","--ui-tab-active-text":"#e4ebf4","--ui-tab-accent":"color-mix(in srgb, #386a9a 40%, #ecf0f8)","--ui-connection-bg":"#161c25","--ui-connection-text":"#b0bfd3","--ui-tree-bg":"#161c25","--ui-tree-border":"#384859","--ui-term-col-bg":"#202630","--ui-fab-bg":"#293440","--ui-fab-border":"#384859","--ui-muted-surface":"#161c25","--ui-muted-border":"#384859","--ui-muted-text":"#b0bfd3","--ui-panel-input-bg":"#293440","--ui-panel-input-text":"#e4ebf4","--ui-panel-input-border":"#384859","--ui-drawer-tab-text":"#b0bfd3","--ui-drawer-tab-active":"#e4ebf4","--ui-history-item-text":"#e4ebf4","--ui-history-meta":"#b0bfd3","--ui-success":"#89d3af","--ui-error":"#f097a2"},termHostBg:"#202630",keybar:{bg:"#161c25",border:"#384859",keyBg:"#293440",keyBorder:"#384859",keyText:"#b0bfd3",accent:"#a4bad2",accentText:"#14212b",drag:"#61778c"},xterm:{background:"#202630",foreground:"#e4ebf4",cursor:"#a4bad2",selectionBackground:"#2a3e53",black:"#161c25",red:"#f097a2",green:"#89d3af",yellow:"#e5c58a",blue:"#9accf0",magenta:"#c4b3e1",cyan:"#91cfd6",white:"#e4ebf4",brightBlack:"#b0bfd3",brightWhite:"#ffffff"}}],eB="pearl",eO=Object.fromEntries(eW.map(e=>[e.id,e])),eF={dark:"noir",black:"noir",gray:"noir",blue:"noir",red:"noir",yellow:"noir",green:"noir",white:"pearl"};function eD(e){if(e&&e in eO)return eO[e];let t=e?eF[e]:void 0;return t?eO[t]:eO[eB]}function eU({themeId:e,onThemeChange:t}){let[r,a]=(0,d.useState)(!1),n=(0,d.useRef)(null),o=(0,d.useRef)(null),s=(0,d.useRef)(null),[l,c]=(0,d.useState)(null),[u,f]=(0,d.useState)({top:-1e3,left:0});return(0,i.jsxs)("div",{ref:n,className:"theme-picker",children:[i.jsx("button",{ref:o,type:"button",className:"file-drawer-toggle","aria-label":"换肤",title:"换肤","aria-expanded":r,"aria-haspopup":"dialog",onClick:()=>a(e=>!e),children:i.jsx(E,{size:17,"aria-hidden":"true"})}),r&&l&&(0,z.createPortal)((0,i.jsxs)("div",{ref:s,className:"theme-popover",role:"dialog","aria-label":"选择皮肤","data-toolbar-overlay":!0,style:{position:"fixed",...u,zIndex:210,width:Math.min(176,innerWidth-16),boxSizing:"border-box",padding:8,borderRadius:10,border:"1px solid var(--ui-tabbar-border, #282b36)",background:"var(--ui-tab-active-bg, #262b38)",boxShadow:"0 10px 28px rgba(0,0,0,.45)"},children:[i.jsx("div",{style:{fontSize:10,color:"var(--ui-connection-text, #777b8c)",margin:"2px 4px 6px",letterSpacing:.5},children:"皮肤"}),i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:2},children:eW.map(r=>{let n=r.id===e;return(0,i.jsxs)("button",{type:"button",className:"theme-popover-item","aria-label":r.label,"aria-pressed":n,onPointerDown:e=>e.stopPropagation(),onClick:()=>{t(r.id),a(!1)},style:{background:n?"color-mix(in srgb, var(--ui-tab-accent, #7aa2f7) 14%, transparent)":"transparent"},children:[i.jsx("span",{style:{width:18,height:18,borderRadius:5,flexShrink:0,background:`linear-gradient(135deg, ${r.preview[0]} 55%, ${r.preview[1]} 55%)`,boxShadow:"inset 0 0 0 1px rgba(128,128,160,.25)"}}),i.jsx("span",{style:{flex:1,textAlign:"left",fontSize:12,fontWeight:n?600:400,color:n?"var(--ui-tab-active-text, #edf0f7)":"var(--ui-tab-text, #8f93a4)"},children:r.label}),n&&i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--ui-tab-accent, #7aa2f7)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i.jsx("path",{d:"m5 12 4 4L19 6"})})]},r.id)})})]}),l)]})}function e$({groupId:e,title:t,onFrame:r,onLoad:a}){let n=(0,d.useRef)(null),[o,s]=(0,d.useState)("loading"),[l,u]=(0,d.useState)(0),f=void 0===e;return(0,i.jsxs)("div",{"aria-busy":"loading"===o,className:"jsx-92e497a22f5803ef collaboration-pane",children:[i.jsx("iframe",{ref:e=>{n.current=e,r(e)},style:{visibility:"ready"===o?"visible":"hidden"},src:c(f?"/app/?view=collaboration-dashboard":`/app/?view=collaboration&groupId=${encodeURIComponent(e)}`),title:t,onLoad:a,onError:()=>s("error"),className:`jsx-92e497a22f5803ef webapp-frame collaboration-frame${"ready"===o?" is-ready":""}`},l),"loading"===o&&i.jsx(eu,{label:"AGENT COLLABORATION",title:f?"正在打开群聊看板":"正在进入群聊",caption:f?"正在加载已保存的群聊":"正在加载群成员与聊天记录",icon:i.jsx(y,{size:36,strokeWidth:1.5})}),"error"===o&&(0,i.jsxs)("div",{role:"alert",className:"jsx-92e497a22f5803ef collaboration-load-error",children:[i.jsx("strong",{className:"jsx-92e497a22f5803ef",children:f?"暂时无法打开群聊看板":"暂时无法打开群聊"}),i.jsx("span",{className:"jsx-92e497a22f5803ef",children:"请检查连接后重试。"}),(0,i.jsxs)("button",{onClick:()=>{s("loading"),u(e=>e+1)},className:"jsx-92e497a22f5803ef",children:[i.jsx(g,{size:15}),"重新加载"]})]}),i.jsx(ed(),{id:"92e497a22f5803ef",children:".collaboration-pane.jsx-92e497a22f5803ef{position:relative;height:100%;background:var(--ui-term-col-bg,#101014)}.collaboration-frame.is-ready.jsx-92e497a22f5803ef{-webkit-animation:collaboration-appear 220ms ease-out both;-moz-animation:collaboration-appear 220ms ease-out both;-o-animation:collaboration-appear 220ms ease-out both;animation:collaboration-appear 220ms ease-out both}.collaboration-load-error.jsx-92e497a22f5803ef{position:absolute;inset:0;display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;-moz-box-orient:vertical;-moz-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-align:center;-webkit-align-items:center;-moz-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-moz-box-pack:center;-ms-flex-pack:center;justify-content:center;gap:12px;color:var(--ui-text,#e5e7eb);background:var(--ui-term-col-bg,#101014);padding:20px;text-align:center}.collaboration-load-error.jsx-92e497a22f5803ef span.jsx-92e497a22f5803ef{font-size:13px;color:var(--ui-text-muted,#9399aa)}.collaboration-load-error.jsx-92e497a22f5803ef button.jsx-92e497a22f5803ef{display:-webkit-inline-box;display:-webkit-inline-flex;display:-moz-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-align:center;-webkit-align-items:center;-moz-box-align:center;-ms-flex-align:center;align-items:center;gap:8px;margin-top:6px;min-height:44px;padding:10px 16px;border:1px solid var(--ui-muted-border,#ffffff24);-webkit-border-radius:9px;-moz-border-radius:9px;border-radius:9px;background:transparent;color:inherit;font:inherit;cursor:pointer}.collaboration-load-error.jsx-92e497a22f5803ef button.jsx-92e497a22f5803ef:focus-visible{outline:2px solid currentColor;outline-offset:3px}@-webkit-keyframes collaboration-appear{from{opacity:0}to{opacity:1}}@-moz-keyframes collaboration-appear{from{opacity:0}to{opacity:1}}@-o-keyframes collaboration-appear{from{opacity:0}to{opacity:1}}@keyframes collaboration-appear{from{opacity:0}to{opacity:1}}@media(prefers-reduced-motion:reduce){.collaboration-frame.is-ready.jsx-92e497a22f5803ef{-webkit-animation:none;-moz-animation:none;-o-animation:none;animation:none}}"})]})}let eq={id:"remote-desktop",title:"远程桌面",kind:"remote-desktop"};function eH(e){let t=e.find(e=>"remote-desktop"===e.kind);return t?e.map(e=>e===t?{...eq}:e):[...e,{...eq}]}let eV={id:"collaboration-dashboard",title:"群聊看板",kind:"collaboration-dashboard"};function eG(e){return e.some(e=>e.id===eV.id)?e:[...e,{...eV}]}let eJ=o()(async()=>{},{loadableGenerated:{modules:["app/web/page.tsx -> ./TerminalPane"]},ssr:!1}),eX=o()(async()=>{},{loadableGenerated:{modules:["app/web/page.tsx -> ./FileTree"]},ssr:!1}),eK=o()(async()=>{},{loadableGenerated:{modules:["app/web/page.tsx -> ./FilePreview"]},ssr:!1}),eQ=o()(async()=>{},{loadableGenerated:{modules:["app/web/page.tsx -> ./AiHubPane"]},ssr:!1}),eZ=o()(async()=>{},{loadableGenerated:{modules:["app/web/page.tsx -> ./FlowStudioPane"]},ssr:!1,loading:()=>i.jsx(eu,{})});function eY(){return i.jsx(eC,{children:(e,t)=>i.jsx(e5,{auth:e,onWorkspaceReady:t})})}let e0={id:"webapp-agent",title:"智能助手",kind:"webapp"},e1={id:"ai-hub",title:"AI Hub",kind:"aihub"},e2={id:"flow-studio",title:"Flow Studio",kind:"flowstudio"};function e4(){return"undefined"==typeof document?eB:eD(document.getElementById("web-theme-root")?.dataset.webTheme).id}function e5({auth:e,onWorkspaceReady:t}){let[r,a]=(0,d.useState)(null),[n,o]=(0,d.useState)(0),u=(0,d.useCallback)(e=>{if(e?.openMode==="new-tab"){window.open(e.url,"_blank","noopener,noreferrer");return}a(e)},[]),f=(0,d.useCallback)(e=>a(e?.openMode==="current"?e:null),[]),p=(0,d.useRef)(null),b=(0,d.useRef)(null),m=(0,d.useRef)(null),[z,C]=(0,d.useState)({}),N=(0,d.useRef)(new Map),[R,E]=(0,d.useState)(0),[M,P]=(0,d.useState)(!1),[I,A]=(0,d.useState)(!1),L=(0,d.useRef)(()=>{}),{state:_,epoch:W,rpc:B,onEvent:O,onTerminalData:F,onTerminalReset:D,sendTerminalInput:U}=function(e,t,r){let[a,i]=(0,d.useState)({connected:!1,error:null}),[n,o]=(0,d.useState)(0),s=(0,d.useRef)(null),c=(0,d.useRef)(0),u=(0,d.useRef)(new Map),f=(0,d.useRef)([]),p=(0,d.useRef)(0),b=(0,d.useRef)(new Map),m=(0,d.useRef)(new Map),h=(0,d.useRef)(new Map),x=(0,d.useRef)(1e3),g=(0,d.useRef)(!1),y=(0,d.useRef)(null),w=(0,d.useRef)(e),v=(0,d.useRef)(t),k=(0,d.useRef)(r);w.current=e,v.current=t,k.current=r;let j=(0,d.useCallback)((e,t)=>{let r=b.current.get(e);return r||b.current.set(e,r=new Set),r.add(t),()=>r.delete(t)},[]),S=(0,d.useCallback)((e,t)=>{let r=m.current.get(e);return r||m.current.set(e,r=new Set),r.add(t),()=>r.delete(t)},[]),z=(0,d.useCallback)((e,t)=>{let r=h.current.get(e);return r||h.current.set(e,r=new Set),r.add(t),()=>r.delete(t)},[]),C=(0,d.useCallback)((e,t)=>{let r=s.current;if(!r||r.readyState!==WebSocket.OPEN)return!1;let a=new TextEncoder().encode(t),i=new Uint8Array(6+a.byteLength),n=new DataView(i.buffer);return i[0]=1,i[1]=1,n.setUint32(2,e),i.set(a,6),r.send(i),!0},[]),N=(0,d.useCallback)(e=>{let t=s.current;t?.readyState===WebSocket.OPEN?t.send(e):f.current.push(e)},[]),R=(0,d.useCallback)((e,t={},r=15e3)=>new Promise((a,i)=>{if(e.startsWith("browser:")&&s.current?.readyState!==WebSocket.OPEN){i(Object.assign(Error("远程连接已断开,请等待重新连接"),{code:"EOFFLINE"}));return}let n=++p.current,o=setTimeout(()=>{u.current.delete(n),i(Error(`${e} timeout`))},r);u.current.set(n,{resolve:a,reject:i,timer:o,type:e}),N(JSON.stringify({type:e,_req:n,...t}))}),[N]),T=(0,d.useCallback)(async()=>{let e,t;g.current=!1;let r=++c.current;y.current&&(clearInterval(y.current),y.current=null);let a=s.current;if(a){a.onopen=a.onmessage=a.onerror=a.onclose=null;try{a.close()}catch{}}try{e=await v.current()}catch{r===c.current&&k.current();return}if(r===c.current&&!g.current){try{t=new WebSocket(`${function(){let e=new URL("/ws",l());return e.protocol="https:"===e.protocol?"wss:":"ws:",e.href}()}?nonce=${encodeURIComponent(e)}`)}catch(e){i({connected:!1,error:String(e)});return}t.binaryType="arraybuffer",s.current=t,t.onopen=()=>{if(r!==c.current||s.current!==t)return;for(let e of(x.current=1e3,i({connected:!0,error:null}),o(e=>e+1),f.current.splice(0)))t.send(e);let e=Date.now();y.current=setInterval(()=>{if(s.current!==t||t.readyState!==WebSocket.OPEN){clearInterval(y.current),y.current=null;return}if(Date.now()-e>25e3){try{t.close()}catch{}return}try{t.send(JSON.stringify({type:"ping"}))}catch{}},1e4);let a=()=>{e=Date.now()};t.addEventListener("message",a),t.addEventListener("close",()=>t.removeEventListener("message",a),{once:!0})},t.onmessage=e=>{let a;if(r===c.current&&s.current===t){if("string"!=typeof e.data){let t=new Uint8Array(e.data);if(t.byteLength>=6&&1===t[0]&&(2===t[1]||6===t[1])){let e=new DataView(t.buffer,t.byteOffset,t.byteLength).getUint32(2);m.current.get(e)?.forEach(e=>e(t.subarray(6),6===t[1]))}else if(t.byteLength>=6&&1===t[0]&&3===t[1]){let e=new DataView(t.buffer,t.byteOffset,t.byteLength).getUint32(2);h.current.get(e)?.forEach(e=>e())}else w.current(t);return}try{a=JSON.parse(e.data)}catch{return}if("error"===a.type&&null!=a.id){let e=u.current.get(a.id);if(e){u.current.delete(a.id),clearTimeout(e.timer);let t=Object.assign(Error(a.error||"gateway error"),{code:a.code});e.reject(t)}return}if(null!=a.id&&"string"==typeof a.type&&a.type.endsWith(":result")){let e=u.current.get(a.id);if(e?.type==="fs:preview-open"&&"string"==typeof a.url){var i;a.url=i=a.url}e&&(u.current.delete(a.id),clearTimeout(e.timer),e.resolve(a));return}b.current.get(a.type)?.forEach(e=>e(a))}},t.onclose=e=>{if(r!==c.current||s.current!==t)return;for(let[e,t]of(y.current&&(clearInterval(y.current),y.current=null),s.current=null,u.current))t.type.startsWith("browser:")&&(clearTimeout(t.timer),u.current.delete(e),t.reject(Object.assign(Error("远程连接已断开,请重新接管"),{code:"EOFFLINE"})));if(i({connected:!1,error:null}),4001===e.code||4003===e.code){k.current();return}if(g.current)return;let a=x.current;x.current=Math.min(2*a,8e3),setTimeout(()=>{g.current||r!==c.current||T()},a)},t.onerror=()=>{}}},[]);return{state:a,epoch:n,rpc:R,onEvent:j,onTerminalData:S,onTerminalReset:z,sendTerminalInput:C,reconnect:T}}((0,d.useCallback)(e=>{let t=function(e){let t=e instanceof Uint8Array?e:new Uint8Array(e.buffer,e.byteOffset,e.byteLength);if(t.byteLength<10||1!==t[0]||t[1]!==eS.watcherFrame&&t[1]!==eS.producerFrame)return null;let r=new DataView(t.buffer,t.byteOffset,t.byteLength);return{type:t[1],channelId:r.getUint32(2,!1),sequence:r.getUint32(6,!1),payload:t.subarray(10)}}(e);if(t&&t.type===eS.watcherFrame)for(let e of(L.current(t.channelId,t.sequence),[p,b])){if(!e.current?.contentWindow)continue;let r=t.payload.slice().buffer;e.current.contentWindow.postMessage({type:"agent-web-shell:browser-frame:v1",channelId:t.channelId,sequence:t.sequence,data:r},window.location.origin,[r])}},[]),e.getWsNonce,e.refresh),$=(0,d.useMemo)(()=>({request:(e,t,r)=>B(e,t,r),subscribe:(e,t)=>O("fs:event",t)}),[O,B]);L.current=(e,t)=>{B("browser:frame-ack",{channelId:e,sequence:t}).catch(()=>void 0)};let[q,H]=(0,d.useState)([{...e0}]);(0,d.useRef)(q).current=q;let[V,G]=(0,d.useState)(e0.id),[J,X]=(0,d.useState)({});(0,d.useRef)(!1);let[Q,Y]=(0,d.useState)(!1),[ee,et]=(0,d.useState)(0);e.user?.id,(0,d.useRef)(null);let er=(0,d.useRef)(new Map),ea=(0,d.useRef)(new Map),ei=(0,d.useCallback)((e,t)=>{er.current.set(e,t);let r=window.setTimeout(()=>{if(er.current.get(e)!==t)return;let r=ea.current.get(e);r&&(ea.current.delete(e),t(r,!0))},180);return()=>{window.clearTimeout(r),er.current.get(e)===t&&er.current.delete(e)}},[]),en=(0,d.useCallback)(e=>{if(!V||q.find(e=>e.id===V)?.kind)return;let t=er.current.get(V);t?t(e):B("term:input",{id:V,data:`\x15${e}`}).catch(()=>{}),ex(!1)},[V,B,q]),[es,el]=(0,d.useState)(!1),[ec,ed]=(0,d.useState)({}),[ep,eb]=(0,d.useState)(null),[em,ex]=(0,d.useState)(!1),[ez,eC]=(0,d.useState)("files"),[eN,eR]=(0,d.useState)(null),[eT,eE]=(0,d.useState)(!0),[eM,eP]=(0,d.useState)(null),[eI,eA]=(0,d.useState)(!1),[eL,eW]=(0,d.useState)([]),[eB,eO]=(0,d.useState)(ej.map((e,t)=>({id:`default-${t+1}`,command:e}))),[eF,eY]=(0,d.useState)(e4),[e5,e8]=(0,d.useState)(!1),e6=function(e){let[t,r]=(0,d.useState)(()=>({userId:"",revision:0,visibleTools:[...eg],savedPages:null,updatedAt:""})),a=(0,d.useRef)(t),[i,n]=(0,d.useState)(!1),[o,s]=(0,d.useState)(!1),l=(0,d.useRef)(!1),c=(0,d.useRef)(!0),u=(0,d.useRef)(0),[f,p]=(0,d.useState)(""),[b,m]=(0,d.useState)(""),h=(0,d.useCallback)(e=>{a.current=e,c.current&&r(e)},[]),x=(0,d.useCallback)(async()=>{if(l.current)return;let t=++u.current;p(""),m("");try{let r=await ek(e);if(null===r.savedPages){let t=K().find(e=>e.origin===location.origin)?.pages??[];try{r=await ek(e,{expectedRevision:r.revision,initializePages:t})}catch(t){if(!(t instanceof ev)||409!==t.status)throw t;if(r=await ek(e),null===r.savedPages)throw Error("电脑配置已更新,请重试旧页面导入。")}}if(!c.current||t!==u.current)return;h(r),n(!0);try{Z(K().map(e=>{if(e.origin!==location.origin)return e;let{pages:t,...r}=e;return{...r,pagesMigrated:!0}}))}catch{}}catch(e){c.current&&t===u.current&&p(e instanceof Error?e.message:"无法读取电脑配置。")}},[h,e]),g=(0,d.useCallback)(async t=>{if(!i||l.current)throw Error("配置尚未就绪,请稍后重试。");l.current=!0,u.current++,s(!0),p(""),m("");let r=a.current;t.visibleTools&&h({...r,visibleTools:t.visibleTools});try{h(await ek(e,{...t,expectedRevision:r.revision})),c.current&&m("已保存到当前电脑")}catch(a){if(h(r),a instanceof ev&&409===a.status)try{h(await ek(e))}catch{}let t=a instanceof Error?a.message:"电脑配置保存失败,请重试。";throw c.current&&p(t),Error(t)}finally{l.current=!1,c.current&&s(!1)}},[h,e,i]);return{settings:t,loaded:i,saving:o,error:f,notice:b,reload:x,setVisibleTools:e=>g({visibleTools:ey(e)}),setSavedPages:e=>g({savedPages:ew(e)})}}(e.csrfToken),[e7,e9]=(0,d.useState)(!1),te=eD(eF),tt=(0,d.useRef)(null),[tr,ta]=(0,d.useState)(0),[ti,tn]=(0,d.useState)(!1),to=(0,d.useRef)(null),ts=(0,d.useRef)(null),tl=(0,d.useCallback)(e=>{for(let t of[p.current,b.current,m.current,...N.current.values()])t?.contentWindow?.postMessage({type:"agent-web-shell:skin:v1",skin:e},window.location.origin)},[]);(0,d.useRef)(0);let tc=V?J[V]??null:null;(0,d.useCallback)(t=>{fetch("/api/web-console/preferences",{method:"PATCH",credentials:"same-origin",headers:{"content-type":"application/json","x-csrf-token":e.csrfToken},body:JSON.stringify(t)}).catch(()=>{})},[e.csrfToken]),(0,d.useCallback)(t=>{e.csrfToken&&fetch("/api/web-console/device-state",{method:"PUT",credentials:"same-origin",keepalive:!0,headers:{"content-type":"application/json","x-csrf-token":e.csrfToken},body:JSON.stringify(t)}).catch(()=>{})},[e.csrfToken]);let td=(0,d.useCallback)(e=>{eb(e),ex(!1)},[]),tu=(0,d.useCallback)(()=>{if(q.length>=8)return;let e=`t-web-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`;H(t=>t.length>=8?t:[...t,{id:e,title:`Terminal ${t.length+1}`}]),G(e)},[q.length]),tf=(0,d.useCallback)(e=>{let t=q.find(e=>e.id===V);if(t?.kind&&"webapp"!==t.kind)return;if(t&&!t.kind){let r=er.current.get(t.id);r?r(e,!0):ea.current.set(t.id,e),ex(!1);return}let r=q.length>=8?q.find(e=>!e.kind):null,a=r?.id??`t-web-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`;r?ea.current.set(a,e):H(t=>[...t,{id:a,title:`Terminal ${t.length+1}`,initialCommand:e}]),G(a),ex(!1)},[V,q]),tp=e=>{if(e===e0.id)return;let t=q.find(t=>t.id===e)?.kind;"remote-desktop"===t&&(E(0),A(!1),B("browser:unwatch").catch(()=>{})),(t||window.confirm("关闭页签会终止该终端进程,确认关闭?"))&&(H(t=>{let r=t.filter(t=>t.id!==e);return V===e&&G(r[0]?.id??null),r}),t||B("term:kill",{id:e}).catch(()=>{}))},tb=(0,d.useCallback)(()=>{H(e=>{let t=e.find(e=>"aihub"===e.kind);return t?(G(t.id),e):(G(e1.id),[...e,{...e1}])})},[]),tm=(0,d.useCallback)(()=>{H(e=>{let t=e.find(e=>"flowstudio"===e.kind);return t?(G(t.id),e):(G(e2.id),[...e,{...e2}])})},[]),th=(0,d.useCallback)(()=>{H(eH),G(eq.id)},[]),tx=(0,d.useCallback)(e=>{if(!V||q.length<2)return;let t=(q.findIndex(e=>e.id===V)+e+q.length)%q.length;G(q[t].id)},[V,q]),tg=Math.max(0,q.findIndex(e=>e.id===V)),ty=q[tg]?.kind==="webapp"?te.cssVars["--ui-term-col-bg"]:te.termHostBg,tw={...e3.root,...te.cssVars,"--ui-active-content-bg":ty,"--ui-terminal-bg":te.termHostBg,"--ui-primary-text":te.keybar.accentText,background:"var(--ui-root-bg)",color:"var(--ui-text)"},tv=(0,d.useCallback)(()=>{tt.current=null,ta(0),tn(!1)},[]),tk=(0,d.useCallback)(e=>{Math.abs(e)>=64&&q.length>1&&tx(e<0?1:-1),tv()},[q.length,tx,tv]),tj=e=>e instanceof Element&&!!e.closest(".terminal-screen");return(0,d.useCallback)((e="smooth")=>{let t=ts.current;if(!t||!V)return;let r=t.querySelector(`[data-terminal-id="${V}"]`);if(!r)return;if(r===t.querySelector("[data-terminal-id]")){t&&(t.scrollLeft=0);return}let a=t.querySelector(".terminal-connection"),i=a?.offsetWidth??0,n=r.offsetLeft,o=n+r.offsetWidth,s=t.scrollLeft,l=s+t.clientWidth-i;n<s+8?t.scrollTo({left:Math.max(0,n-8),behavior:e}):o>l-8&&t.scrollTo({left:o-t.clientWidth+i+8,behavior:e})},[V]),(0,i.jsxs)("div",{className:`web-root ${M&&V===eq.id&&!r?"is-remote-fullscreen":""}`,style:tw,children:[i.jsx("style",{dangerouslySetInnerHTML:{__html:s}}),(0,i.jsxs)("div",{className:"terminal-tabs",children:[r&&(0,i.jsxs)("div",{className:"computer-page-heading",children:[i.jsx("button",{type:"button",className:"file-drawer-toggle","aria-label":"返回电脑会话",title:"返回电脑会话",onClick:()=>a(null),children:i.jsx(h,{size:18})}),i.jsx("span",{children:r.name}),i.jsx("a",{className:"file-drawer-toggle",href:r.url,target:"_blank",rel:"noopener noreferrer","aria-label":"在新页面打开当前页面",title:"打开原页面",children:i.jsx(x,{size:16})})]}),i.jsx("div",{className:"terminal-tab-list",ref:ts,hidden:!!r,children:q.map(e=>(0,i.jsxs)("div",{"data-terminal-id":e.id,draggable:!0,className:`terminal-tab ${e.id===V?"active":""}`,onDragStart:()=>{to.current=e.id},onDragOver:e=>e.preventDefault(),onDrop:t=>{t.preventDefault();let r=to.current;to.current=null,r&&r!==e.id&&H(t=>{let a=t.findIndex(e=>e.id===r),i=t.findIndex(t=>t.id===e.id);if(a<0||i<0)return t;let n=[...t],[o]=n.splice(a,1);return n.splice(i,0,o),B("term:reorder",{ids:n.filter(e=>!e.kind).map(e=>e.id)}).catch(()=>{}),n})},onClick:()=>G(e.id),onDoubleClick:()=>{if(e.kind)return;let t=window.prompt("页签名称",e.title)?.trim();t&&B("term:rename",{id:e.id,title:t}).then(()=>H(r=>r.map(r=>r.id===e.id?{...r,title:t}:r))).catch(()=>{})},children:[i.jsx("span",{children:e.title}),"webapp"!==e.kind&&i.jsx("button",{tabIndex:-1,onClick:t=>{t.stopPropagation(),tp(e.id)},children:"\xd7"})]},e.id))}),i.jsx("button",{className:"terminal-add","aria-label":"新建终端页签",hidden:!!r,disabled:q.length>=8,onClick:tu,children:"+"}),i.jsx("div",{className:"terminal-connection",children:i.jsx(eh,{glass:"glass"===eF,avatar:i.jsx(eo,{username:e.user?.username??"?",connected:_.connected,accent:te.keybar.accent,accentText:te.keybar.accentText,selectedPageId:r?.id,onSelectPage:u,onUpdatePage:f,configuration:e6,csrfToken:e.csrfToken}),items:[{id:"refresh",content:i.jsx("button",{type:"button",className:"file-drawer-toggle","aria-label":"刷新页面",title:"刷新页面",onClick:()=>r?o(e=>e+1):window.location.reload(),children:i.jsx(g,{size:17,"aria-hidden":"true"})})},{id:"collaboration",content:i.jsx("button",{type:"button",className:"file-drawer-toggle","aria-label":"打开群聊看板",title:"群聊看板",onClick:()=>{a(null),H(eG),G(eV.id)},children:i.jsx(y,{size:17,"aria-hidden":"true"})})},{id:"install",content:i.jsx(T,{})},{id:"remote",content:i.jsx("button",{type:"button",className:"file-drawer-toggle","aria-label":"打开远程桌面",title:"远程桌面 \xb7 浏览器直播",onClick:()=>{a(null),th()},children:i.jsx(w,{size:17,"aria-hidden":"true"})})},{id:"ai-hub",content:i.jsx("button",{type:"button",className:"file-drawer-toggle","aria-label":"打开 AI Hub",title:"AI Hub \xb7 多模型对比",onClick:()=>{a(null),tb()},children:i.jsx(v,{size:17,"aria-hidden":"true"})})},{id:"flow",content:i.jsx("button",{type:"button",className:"file-drawer-toggle","aria-label":"打开数字人",title:"数字人 \xb7 Flow Studio",onClick:()=>{a(null),tm()},children:i.jsx(k,{size:17,"aria-hidden":"true"})})},{id:"theme",content:i.jsx(eU,{themeId:eF,onThemeChange:eY})},{id:"files",content:i.jsx("button",{type:"button",className:"file-drawer-toggle","aria-label":em?"关闭我的文件":"打开我的文件",title:"我的文件","aria-expanded":em,onClick:()=>{a(null),ex(e=>!e)},children:i.jsx(j,{size:17,"aria-hidden":"true"})})}].filter(e=>e6.settings.visibleTools.some(t=>t===e.id)).sort((e,t)=>e6.settings.visibleTools.findIndex(t=>t===e.id)-e6.settings.visibleTools.findIndex(e=>e===t.id))})})]}),(0,i.jsxs)("main",{className:`workspace ${em?"show-tree":""} ${ep?"has-preview":""}`,hidden:!!r,style:e3.workspace,children:[i.jsx("section",{className:"term-col",style:e3.termCol,onPointerDownCapture:e=>{"touch"===e.pointerType&&tj(e.target)&&(tv(),tt.current={x:e.clientX,y:e.clientY,axis:"pending",pointerId:e.pointerId})},onPointerMoveCapture:e=>{let t=tt.current;if(!t||e.pointerId!==t.pointerId||"touch"!==e.pointerType)return;let r=e.clientX-t.x,a=e.clientY-t.y;if("pending"===t.axis){if(8>=Math.max(Math.abs(r),Math.abs(a)))return;if(Math.abs(a)>=1.2*Math.abs(r)){tt.current=null;return}t.axis="horizontal",tn(!0);let e=r=>{window.removeEventListener("pointerup",e),window.removeEventListener("pointercancel",e),tt.current===t&&tv()};window.addEventListener("pointerup",e),window.addEventListener("pointercancel",e)}"horizontal"===t.axis&&(e.preventDefault(),ta(r))},onPointerUpCapture:e=>{let t=tt.current;if(!t||e.pointerId!==t.pointerId)return;let r=e.clientX-t.x;"horizontal"===t.axis&&Math.abs(r)>=64?tk(r):tv()},onPointerCancelCapture:tv,children:i.jsx("div",{className:"terminal-track",style:{transform:`translate3d(calc(${-(100*tg)}% + ${tr}px),0,0)`,transition:ti?"none":"transform 260ms cubic-bezier(.22,.8,.32,1)"},children:q.map(e=>i.jsx("div",{className:"terminal-slide",style:{position:"relative"},children:"webapp"===e.kind?i.jsx("iframe",{ref:p,className:"webapp-frame",src:c("/app/"),title:e.title,onLoad:()=>tl(eF)}):"collaboration-dashboard"===e.kind?i.jsx(e$,{title:"群聊看板",onFrame:e=>{m.current=e},onLoad:()=>tl(eF)}):"collaboration"===e.kind?i.jsx(e$,{groupId:e.groupId||"",title:e.title,onFrame:t=>{t?N.current.set(e.id,t):N.current.delete(e.id)},onLoad:()=>tl(eF)},`${e.id}-${z[e.groupId||""]||0}`):"remote-desktop"===e.kind?(0,i.jsxs)("div",{style:{height:"100%",background:"var(--ui-term-col-bg, #101014)"},"aria-busy":!I,children:[i.jsx("iframe",{ref:b,className:"webapp-frame",style:{visibility:I?"visible":"hidden"},src:c("/app/?view=remote-desktop"),title:"远程桌面",onLoad:()=>tl(eF)}),!I&&i.jsx(eu,{label:"REMOTE DESKTOP",title:"正在打开远程桌面",caption:"正在准备桌面与连接",icon:i.jsx(w,{size:36,strokeWidth:1.5})})]}):"aihub"===e.kind?i.jsx(eQ,{visible:e.id===V,rpc:B}):"flowstudio"===e.kind?i.jsx(eZ,{visible:e.id===V}):i.jsx(eJ,{terminalId:e.id,title:e.title,initialCommand:e.initialCommand,visible:e.id===V,state:_,rpc:B,onEvent:O,onTerminalData:F,onTerminalReset:D,sendTerminalInput:U,keyOrder:eL,keybarHidden:eI,onKeyOrderChange:eW,onKeybarHiddenChange:eA,terminalTheme:te,initialScrollLine:ec[e.id]??null,onScrollLineChange:t=>ed(r=>r[e.id]===t?r:{...r,[e.id]:t}),onRegisterFill:t=>ei(e.id,t),onCwdChange:t=>t&&X(r=>({...r,[e.id]:t}))})},e.id))})}),em&&i.jsx("div",{className:"drawer-mask",onClick:()=>ex(!1)}),(0,i.jsxs)("aside",{className:`tree-col ${em?"tree-col-open":""}`,style:e3.treeCol,children:[(0,i.jsxs)("div",{className:"tree-head",style:e3.treeHead,children:[i.jsx("button",{className:"files"===ez?"drawer-tab-active":"",onClick:()=>eC("files"),children:"文件"}),i.jsx("button",{className:"history"===ez?"drawer-tab-active":"",onClick:()=>eC("history"),children:"历史"}),i.jsx("span",{className:"tree-cwd",style:e3.treeCwd,children:tc??""}),i.jsx("button",{style:{...e3.iconBtn,marginLeft:"auto",flexShrink:0},onClick:()=>ex(!1),"aria-label":"close drawer",children:i.jsx(S,{size:15,"aria-hidden":"true"})})]}),"files"===ez?i.jsx(eX,{ready:W>0,followCwd:!0,cwd:tc,gateway:$,onOpenFile:td,selectedPath:ep,initialRoot:eN,initialFollow:eT,revealRequest:eM,onTreeStateChange:(e,t)=>{eR(e),eE(t)}}):i.jsx(e_,{csrfToken:e.csrfToken,terminalId:q.find(e=>e.id===V)?.kind==="webapp"?null:V,pinnedCommands:eB,onPinnedCommandsChange:eO,onFill:en,onExecute:tf}),(0,i.jsxs)("div",{style:e3.treeFoot,children:[i.jsx("span",{style:e3.treeFootDot}),i.jsx("span",{children:"实时同步"})]})]}),ep&&i.jsx("section",{className:"preview-col",style:e3.previewCol,children:i.jsx(eK,{path:ep,gateway:$,onClose:()=>eb(null)})})]}),r&&i.jsx(ef,{page:r,reloadKey:n},r.id)]})}let e3={root:{height:"100dvh",display:"flex",flexDirection:"column",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", sans-serif',overflow:"hidden"},iconBtn:{minWidth:28,height:28,borderRadius:7,border:"1px solid var(--ui-tabbar-border, #303442)",background:"var(--ui-tab-bg, #202029)",color:"var(--ui-tab-text, #aaaab8)",fontSize:13},workspace:{flex:1,minHeight:0,display:"grid",position:"relative"},treeCol:{background:"var(--ui-tree-bg, #121218)",minHeight:0,flexDirection:"column"},treeHead:{display:"flex",alignItems:"center",gap:8,padding:"10px 12px 4px",fontSize:11,textTransform:"uppercase",letterSpacing:1,color:"#778",flexShrink:0},treeCwd:{fontSize:10,color:"#556",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:150,textTransform:"none",letterSpacing:0},treeFoot:{display:"flex",alignItems:"center",gap:7,minHeight:31,padding:"6px 11px calc(env(safe-area-inset-bottom) + 6px)",borderTop:"1px solid var(--ui-tabbar-border, #282832)",boxShadow:"0 -5px 16px rgba(0,0,0,.22)",background:"var(--ui-tab-bg, #15151c)",color:"var(--ui-connection-text, #777789)",fontSize:10.5,flexShrink:0},treeFootDot:{width:6,height:6,borderRadius:99,background:"var(--ui-success, #9ece6a)",boxShadow:"0 0 0 2px color-mix(in srgb, var(--ui-success, #9ece6a) 12%, transparent)",flexShrink:0},termCol:{minWidth:0,minHeight:0,display:"flex",flexDirection:"column",background:"var(--ui-term-col-bg, #101014)",gridColumn:1,overflow:"hidden"},previewCol:{minWidth:0,minHeight:0}}},4972:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>s,metadata:()=>i,viewport:()=>o});var a=r(3477);let i={title:"AgentRoam",manifest:"/manifest.webmanifest",appleWebApp:{capable:!0,title:"AgentRoam",statusBarStyle:"black-translucent"},icons:{icon:"/pwa/icon-192.png",apple:"/pwa/icon-192.png"},description:"General-purpose AI agent API server"},n="#070a0b",o={themeColor:n,colorScheme:"dark"};function s({children:e}){return a.jsx("html",{lang:"zh-CN",style:{background:n,colorScheme:"dark"},children:(0,a.jsxs)("body",{style:{margin:0,minHeight:"100dvh",background:n},children:[e,a.jsx("script",{src:"/pwa/install.js",defer:!0})]})})}},489:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>a});let a=(0,r(8979).createProxy)(String.raw`/Users/caoqu/team-agent/release-preview65/packages/server/app/web/error.tsx#default`)},9257:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>u,dynamic:()=>l,generateViewport:()=>d});var a=r(3477),i=r(2110);let n=Object.fromEntries([{id:"pearl",label:"珍珠白",swatch:"#f5f6fa",preview:["#f5f6fa","#4f6ef7"],cssVars:{"--ui-color-scheme":"light","--ui-root-bg":"#f5f6fa","--ui-text":"#111827","--ui-tabbar-bg":"#eef0f6","--ui-tabbar-border":"#dfe3ee","--ui-tab-bg":"#e6e9f4","--ui-tab-text":"#5b6472","--ui-tab-active-bg":"#ffffff","--ui-tab-active-text":"#111827","--ui-tab-accent":"#4f6ef7","--ui-connection-bg":"#eef0f6","--ui-connection-text":"#9ca3af","--ui-tree-bg":"#fbfcfe","--ui-tree-border":"#e5e8f0","--ui-term-col-bg":"#f5f6fa","--ui-fab-bg":"#ffffff","--ui-fab-border":"#d8dcea","--ui-muted-surface":"#eef0f6","--ui-muted-border":"#d8dcea","--ui-muted-text":"#6b7280","--ui-panel-input-bg":"#ffffff","--ui-panel-input-text":"#111827","--ui-panel-input-border":"#d8dcea","--ui-drawer-tab-text":"#6b7280","--ui-drawer-tab-active":"#111827","--ui-history-item-text":"#1f2937","--ui-history-meta":"#9ca3af","--ui-success":"#059669","--ui-error":"#dc2626"},termHostBg:"#ffffff",keybar:{bg:"#eef0f6",border:"#dfe3ee",keyBg:"#ffffff",keyBorder:"#d8dcea",keyText:"#4b5563",accent:"#4f6ef7",accentText:"#ffffff",drag:"#a5b4fc"},xterm:{background:"#ffffff",foreground:"#1f2937",cursor:"#4f6ef7",selectionBackground:"#c7d2fe",black:"#24292e",red:"#d73a49",green:"#22863a",yellow:"#b08800",blue:"#005cc5",magenta:"#6f42c1",cyan:"#1b7c83",white:"#6a737d",brightBlack:"#959da5",brightWhite:"#fafbfc"}},{id:"scifi",label:"科幻霓虹",swatch:"#050a14",preview:["#050a14","#22d3ee"],cssVars:{"--ui-color-scheme":"dark","--ui-root-bg":"#050a14","--ui-text":"#e2f3ff","--ui-tabbar-bg":"#0a1220","--ui-tabbar-border":"#10263c","--ui-tab-bg":"#0d1626","--ui-tab-text":"#5c7893","--ui-tab-active-bg":"#122036","--ui-tab-active-text":"#e2f3ff","--ui-tab-accent":"#22d3ee","--ui-connection-bg":"#0a1220","--ui-connection-text":"#5c7893","--ui-tree-bg":"#0d1626","--ui-tree-border":"#10263c","--ui-term-col-bg":"#050a14","--ui-fab-bg":"#122036","--ui-fab-border":"#155e75","--ui-muted-surface":"#0d1626","--ui-muted-border":"#164e63","--ui-muted-text":"#9fb8d0","--ui-panel-input-bg":"#0a1220","--ui-panel-input-text":"#e2f3ff","--ui-panel-input-border":"#164e63","--ui-drawer-tab-text":"#5c7893","--ui-drawer-tab-active":"#e2f3ff","--ui-history-item-text":"#d5ecfb","--ui-history-meta":"#5c7893","--ui-success":"#34d399","--ui-error":"#fb7185"},termHostBg:"#0a1220",keybar:{bg:"#0a1220",border:"#10263c",keyBg:"#0d1626",keyBorder:"#164e63",keyText:"#9fb8d0",accent:"#22d3ee",accentText:"#04121a",drag:"#155e75"},xterm:{background:"#0a1220",foreground:"#e2f3ff",cursor:"#22d3ee",selectionBackground:"#164e63",black:"#0d1626",red:"#fb7185",green:"#34d399",yellow:"#fbbf24",blue:"#38bdf8",magenta:"#e879f9",cyan:"#22d3ee",white:"#e2f3ff",brightBlack:"#5c7893",brightWhite:"#ffffff"}},{id:"noir",label:"暗夜黑",swatch:"#0f1115",preview:["#0f1115","#a78bfa"],cssVars:{"--ui-color-scheme":"dark","--ui-root-bg":"#0f1115","--ui-text":"#eceff4","--ui-tabbar-bg":"#14171d","--ui-tabbar-border":"#232833","--ui-tab-bg":"#191d24","--ui-tab-text":"#6b7280","--ui-tab-active-bg":"#1f242d","--ui-tab-active-text":"#eceff4","--ui-tab-accent":"#a78bfa","--ui-connection-bg":"#14171d","--ui-connection-text":"#6b7280","--ui-tree-bg":"#191d24","--ui-tree-border":"#232833","--ui-term-col-bg":"#0f1115","--ui-fab-bg":"#1f242d","--ui-fab-border":"#2a3040","--ui-muted-surface":"#191d24","--ui-muted-border":"#2a3040","--ui-muted-text":"#aab2bf","--ui-panel-input-bg":"#14171d","--ui-panel-input-text":"#eceff4","--ui-panel-input-border":"#2a3040","--ui-drawer-tab-text":"#6b7280","--ui-drawer-tab-active":"#eceff4","--ui-history-item-text":"#d7dce4","--ui-history-meta":"#6b7280","--ui-success":"#4ade80","--ui-error":"#f87171"},termHostBg:"#14171d",keybar:{bg:"#14171d",border:"#232833",keyBg:"#191d24",keyBorder:"#2a3040",keyText:"#aab2bf",accent:"#a78bfa",accentText:"#0f1115",drag:"#4b4470"},xterm:{background:"#14171d",foreground:"#eceff4",cursor:"#a78bfa",selectionBackground:"#3b3654",black:"#191d24",red:"#f87171",green:"#4ade80",yellow:"#fbbf24",blue:"#60a5fa",magenta:"#c084fc",cyan:"#67e8f9",white:"#eceff4",brightBlack:"#6b7280",brightWhite:"#ffffff"}},{id:"mist",label:"雾白靛蓝",swatch:"#f7f8fb",preview:["#f7f8fb","#4258c4"],cssVars:{"--ui-color-scheme":"light","--ui-root-bg":"#f7f8fb","--ui-text":"#252d3d","--ui-tabbar-bg":"#e4e9f2","--ui-tabbar-border":"#dce3ef","--ui-tab-bg":"#e9edf5","--ui-tab-text":"#5b687f","--ui-tab-active-bg":"#f7f8fb","--ui-tab-active-text":"#252d3d","--ui-tab-accent":"#4258c4","--ui-connection-bg":"#e4e9f2","--ui-connection-text":"#5b687f","--ui-tree-bg":"#e9edf5","--ui-tree-border":"#dce3ef","--ui-term-col-bg":"#f7f8fb","--ui-fab-bg":"#ffffff","--ui-fab-border":"#dce3ef","--ui-muted-surface":"#e9edf5","--ui-muted-border":"#dce3ef","--ui-muted-text":"#5b687f","--ui-panel-input-bg":"#ffffff","--ui-panel-input-text":"#252d3d","--ui-panel-input-border":"#dce3ef","--ui-drawer-tab-text":"#5b687f","--ui-drawer-tab-active":"#252d3d","--ui-history-item-text":"#252d3d","--ui-history-meta":"#5b687f","--ui-success":"#247860","--ui-error":"#be3d50"},termHostBg:"#ffffff",keybar:{bg:"#e4e9f2",border:"#dce3ef",keyBg:"#ffffff",keyBorder:"#dce3ef",keyText:"#5b687f",accent:"#4258c4",accentText:"#ffffff",drag:"#8a9ac5"},xterm:{background:"#ffffff",foreground:"#252d3d",cursor:"#4258c4",selectionBackground:"#d6dcf4",black:"#252d3d",red:"#be3d50",green:"#247860",yellow:"#956018",blue:"#346faa",magenta:"#7456a6",cyan:"#277784",white:"#5b687f",brightBlack:"#5b687f",brightWhite:"#f7f8fb"}},{id:"glass",label:"毛玻璃",swatch:"#c3dbee",preview:["#c3dbee","#357b88"],cssVars:{"--ui-color-scheme":"light","--ui-root-bg":"#edf3f4","--ui-text":"#263e48","--ui-tabbar-bg":"#e0ebee","--ui-tabbar-border":"#d3e1e5","--ui-tab-bg":"#e5eef1","--ui-tab-text":"#58727c","--ui-tab-active-bg":"#edf3f4","--ui-tab-active-text":"#263e48","--ui-tab-accent":"#357b88","--ui-connection-bg":"#e0ebee","--ui-connection-text":"#58727c","--ui-tree-bg":"#e5eef1","--ui-tree-border":"#d3e1e5","--ui-term-col-bg":"#edf3f4","--ui-fab-bg":"#ffffff","--ui-fab-border":"#d3e1e5","--ui-muted-surface":"#e5eef1","--ui-muted-border":"#d3e1e5","--ui-muted-text":"#58727c","--ui-panel-input-bg":"#ffffff","--ui-panel-input-text":"#263e48","--ui-panel-input-border":"#d3e1e5","--ui-drawer-tab-text":"#58727c","--ui-drawer-tab-active":"#263e48","--ui-history-item-text":"#263e48","--ui-history-meta":"#58727c","--ui-success":"#247860","--ui-error":"#be3d50"},termHostBg:"#ffffff",keybar:{bg:"#e0ebee",border:"#d3e1e5",keyBg:"#ffffff",keyBorder:"#d3e1e5",keyText:"#58727c",accent:"#357b88",accentText:"#ffffff",drag:"#8a9ac5"},xterm:{background:"#ffffff",foreground:"#263e48",cursor:"#357b88",selectionBackground:"#d6dcf4",black:"#263e48",red:"#be3d50",green:"#247860",yellow:"#956018",blue:"#346faa",magenta:"#7456a6",cyan:"#277784",white:"#58727c",brightBlack:"#58727c",brightWhite:"#edf3f4"}},{id:"pine",label:"暖灰松绿",swatch:"#f6f7f3",preview:["#f6f7f3","#356c55"],cssVars:{"--ui-color-scheme":"light","--ui-root-bg":"#f6f7f3","--ui-text":"#2d382f","--ui-tabbar-bg":"#e2e7df","--ui-tabbar-border":"#d9e1d6","--ui-tab-bg":"#e8ece5","--ui-tab-text":"#5b6e61","--ui-tab-active-bg":"#f6f7f3","--ui-tab-active-text":"#2d382f","--ui-tab-accent":"#356c55","--ui-connection-bg":"#e2e7df","--ui-connection-text":"#5b6e61","--ui-tree-bg":"#e8ece5","--ui-tree-border":"#d9e1d6","--ui-term-col-bg":"#f6f7f3","--ui-fab-bg":"#ffffff","--ui-fab-border":"#d9e1d6","--ui-muted-surface":"#e8ece5","--ui-muted-border":"#d9e1d6","--ui-muted-text":"#5b6e61","--ui-panel-input-bg":"#ffffff","--ui-panel-input-text":"#2d382f","--ui-panel-input-border":"#d9e1d6","--ui-drawer-tab-text":"#5b6e61","--ui-drawer-tab-active":"#2d382f","--ui-history-item-text":"#2d382f","--ui-history-meta":"#5b6e61","--ui-success":"#357450","--ui-error":"#b6454d"},termHostBg:"#ffffff",keybar:{bg:"#e2e7df",border:"#d9e1d6",keyBg:"#ffffff",keyBorder:"#d9e1d6",keyText:"#5b6e61",accent:"#356c55",accentText:"#ffffff",drag:"#86a38b"},xterm:{background:"#ffffff",foreground:"#2d382f",cursor:"#356c55",selectionBackground:"#d4e1d9",black:"#2d382f",red:"#b6454d",green:"#357450",yellow:"#8c641e",blue:"#3d7189",magenta:"#805e88",cyan:"#317c74",white:"#5b6e61",brightBlack:"#5b6e61",brightWhite:"#f6f7f3"}},{id:"graphite",label:"石墨夜色",swatch:"#202630",preview:["#202630","#a4bad2"],cssVars:{"--ui-color-scheme":"dark","--ui-root-bg":"#202630","--ui-text":"#e4ebf4","--ui-tabbar-bg":"#161c25","--ui-tabbar-border":"#384859","--ui-tab-bg":"#161c25","--ui-tab-text":"#b0bfd3","--ui-tab-active-bg":"#202630","--ui-tab-active-text":"#e4ebf4","--ui-tab-accent":"color-mix(in srgb, #386a9a 40%, #ecf0f8)","--ui-connection-bg":"#161c25","--ui-connection-text":"#b0bfd3","--ui-tree-bg":"#161c25","--ui-tree-border":"#384859","--ui-term-col-bg":"#202630","--ui-fab-bg":"#293440","--ui-fab-border":"#384859","--ui-muted-surface":"#161c25","--ui-muted-border":"#384859","--ui-muted-text":"#b0bfd3","--ui-panel-input-bg":"#293440","--ui-panel-input-text":"#e4ebf4","--ui-panel-input-border":"#384859","--ui-drawer-tab-text":"#b0bfd3","--ui-drawer-tab-active":"#e4ebf4","--ui-history-item-text":"#e4ebf4","--ui-history-meta":"#b0bfd3","--ui-success":"#89d3af","--ui-error":"#f097a2"},termHostBg:"#202630",keybar:{bg:"#161c25",border:"#384859",keyBg:"#293440",keyBorder:"#384859",keyText:"#b0bfd3",accent:"#a4bad2",accentText:"#14212b",drag:"#61778c"},xterm:{background:"#202630",foreground:"#e4ebf4",cursor:"#a4bad2",selectionBackground:"#2a3e53",black:"#161c25",red:"#f097a2",green:"#89d3af",yellow:"#e5c58a",blue:"#9accf0",magenta:"#c4b3e1",cyan:"#91cfd6",white:"#e4ebf4",brightBlack:"#b0bfd3",brightWhite:"#ffffff"}}].map(e=>[e.id,e])),o={dark:"noir",black:"noir",gray:"noir",blue:"noir",red:"noir",yellow:"noir",green:"noir",white:"pearl"};function s(e){if(e&&e in n)return n[e];let t=e?o[e]:void 0;return t?n[t]:n.pearl}r(2761);let l="force-dynamic";function c(){try{let{userId:e}=(0,i.nQ)();return s(i.hw.getPreferences(e)?.theme)}catch{return s(void 0)}}function d(){let e=c();return{colorScheme:e.cssVars["--ui-color-scheme"],themeColor:e.cssVars["--ui-tabbar-bg"]}}function u({children:e}){let t=c(),r={...t.cssVars,colorScheme:t.cssVars["--ui-color-scheme"],background:t.cssVars["--ui-root-bg"],color:t.cssVars["--ui-text"]};return a.jsx("div",{id:"web-theme-root","data-web-theme":t.id,style:r,children:e})}},6742:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>a});let a=(0,r(8979).createProxy)(String.raw`/Users/caoqu/team-agent/release-preview65/packages/server/app/web/page.tsx#default`)},785:(e,t,r)=>{"use strict";r.d(t,{ME:()=>s,kO:()=>o,sr:()=>l});var a=r(9411);let i=function(){let e=process.argv[1];if(e){let t=(0,a.dirname)((0,a.resolve)(e)),r=`${a.sep}node_modules${a.sep}.bin`;return t.endsWith(r)?(0,a.resolve)(t,"..",".."):t}return(0,a.resolve)(process.cwd())}();function n(e=process.env,t=i){return(0,a.resolve)(e.AGENT_DATA_DIR?.trim()||t)}function o(){return n()}function s(e=process.env,t=n(e)){let r=e.AGENT_LOG_DIR?.trim();if(r)return(0,a.resolve)(r);let i=e.AGENTROAM_DATA_DIR?.trim();return i?(0,a.resolve)(i,"logs"):(0,a.join)(t,".agent-data","logs")}function l(){return function(e=process.env,t=i){return(0,a.resolve)(e.AGENT_WORKING_DIRECTORY?.trim()||t)}(process.env,o())}},2110:(e,t,r)=>{"use strict";r.d(t,{hw:()=>n.hw,nQ:()=>s});var a=r(1636),i=r(785),n=r(3710);let o=new a.SQLiteAnonymousWebStore((0,i.kO)());function s(){return{userId:o.getOrCreatePrincipal().userId,username:"local",deviceId:"browser"}}},3710:(e,t,r)=>{"use strict";r.d(t,{$U:()=>u,Ci:()=>p,VP:()=>n,Xd:()=>d,ZA:()=>s,ap:()=>f,hw:()=>l,ki:()=>o,yN:()=>b});var a=r(1636),i=r(785);let n="customer_agent_session",o="customer_agent_device",s=new a.WebAuthService(new a.SQLiteAuthStore((0,i.kO)())),l=new a.SQLiteWebConsoleStore((0,i.kO)());function c(e){let t={};for(let r of(e.headers.get("cookie")||"").split(";")){let e=r.indexOf("=");e>0&&(t[r.slice(0,e).trim()]=decodeURIComponent(r.slice(e+1).trim()))}return t}function d(e){return c(e)[n]||null}function u(e){let t=c(e);return{ip:e.headers.get("x-forwarded-for")?.split(",")[0].trim()||"unknown",userAgent:e.headers.get("user-agent")||"",deviceId:t[o],deviceName:e.headers.get("x-device-name")||""}}function f(e){let t=s.authenticateToken(d(e));return s.validateCsrf(t,e.headers.get("x-csrf-token")),t}function p(e,t,r){return{httpOnly:r,sameSite:"strict",secure:"https"===("1"===process.env.AGENT_TRUST_TUNNEL_PROXY?e.headers.get("x-forwarded-proto"):null)||"https:"===new URL(e.url).protocol,path:"/",maxAge:t}}function b(e){let t=e instanceof a.WebAuthError?e:new a.WebAuthError("UNAUTHENTICATED","认证失败",401);return Response.json({error:{code:t.code,message:t.message}},{status:t.status})}},2761:()=>{}};var t=require("../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),a=t.X(0,[8375,5303],()=>r(8084));module.exports=a})();
|