termdock 1.4.307 → 1.4.308
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/dist/client/assets/{App-cagV-flM.js → App-ggIA_xqR.js} +6 -6
- package/dist/client/assets/App-ggIA_xqR.js.br +0 -0
- package/dist/client/assets/App-ggIA_xqR.js.gz +0 -0
- package/dist/client/assets/{ArchitecturePanel-TdKPja7L.js → ArchitecturePanel-CoBspW_C.js} +1 -1
- package/dist/client/assets/ArchitecturePanel-CoBspW_C.js.br +0 -0
- package/dist/client/assets/ArchitecturePanel-CoBspW_C.js.gz +0 -0
- package/dist/client/assets/{ChangeWalkthroughPanel-DOj40Srm.js → ChangeWalkthroughPanel-D1Puc7B3.js} +1 -1
- package/dist/client/assets/ChangeWalkthroughPanel-D1Puc7B3.js.br +0 -0
- package/dist/client/assets/ChangeWalkthroughPanel-D1Puc7B3.js.gz +0 -0
- package/dist/client/assets/{CollaborationMainWorkspace-C5Tcos5l.js → CollaborationMainWorkspace-BPyK5Xs8.js} +1 -1
- package/dist/client/assets/CollaborationMainWorkspace-BPyK5Xs8.js.br +0 -0
- package/dist/client/assets/CollaborationMainWorkspace-BPyK5Xs8.js.gz +0 -0
- package/dist/client/assets/CollaborationTaskContent-CTSJJqze.js +2 -0
- package/dist/client/assets/{ComputerControlView-C2sOFyuA.js → ComputerControlView-D5Lw9sNA.js} +2 -2
- package/dist/client/assets/ComputerControlView-D5Lw9sNA.js.br +0 -0
- package/dist/client/assets/ComputerControlView-D5Lw9sNA.js.gz +0 -0
- package/dist/client/assets/{DagPlayground-DFfVJW00.js → DagPlayground-DYJrGfiG.js} +1 -1
- package/dist/client/assets/DagPlayground-DYJrGfiG.js.br +0 -0
- package/dist/client/assets/DagPlayground-DYJrGfiG.js.gz +0 -0
- package/dist/client/assets/{DiffLab-hoj8gwUi.js → DiffLab-5zdcFW3z.js} +1 -1
- package/dist/client/assets/DiffLab-5zdcFW3z.js.br +0 -0
- package/dist/client/assets/DiffLab-5zdcFW3z.js.gz +0 -0
- package/dist/client/assets/{DiffReview-Cn_PmN-9.js → DiffReview-BBBC_NjV.js} +1 -1
- package/dist/client/assets/DiffReview-BBBC_NjV.js.br +0 -0
- package/dist/client/assets/DiffReview-BBBC_NjV.js.gz +0 -0
- package/dist/client/assets/{DiffReviewLab-DycgD40E.js → DiffReviewLab-CbhosFSB.js} +1 -1
- package/dist/client/assets/DiffReviewLab-CbhosFSB.js.br +0 -0
- package/dist/client/assets/DiffReviewLab-CbhosFSB.js.gz +0 -0
- package/dist/client/assets/{DiffViewer-DRnuph7U.js → DiffViewer-BuQwFQ4V.js} +1 -1
- package/dist/client/assets/DiffViewer-BuQwFQ4V.js.br +0 -0
- package/dist/client/assets/DiffViewer-BuQwFQ4V.js.gz +0 -0
- package/dist/client/assets/{ModelPreview-Dvw-UtQQ.js → ModelPreview-nO2VmqdP.js} +1 -1
- package/dist/client/assets/ModelPreview-nO2VmqdP.js.br +0 -0
- package/dist/client/assets/ModelPreview-nO2VmqdP.js.gz +0 -0
- package/dist/client/assets/{RightSidebar-CnnU7Ffp.js → RightSidebar-BoNzpS2K.js} +3 -3
- package/dist/client/assets/RightSidebar-BoNzpS2K.js.br +0 -0
- package/dist/client/assets/{RightSidebar-CnnU7Ffp.js.gz → RightSidebar-BoNzpS2K.js.gz} +0 -0
- package/dist/client/assets/{abnfDiagram-VCTEODGH-BQVIT5gD.js → abnfDiagram-VCTEODGH-yi0K8GDG.js} +1 -1
- package/dist/client/assets/abnfDiagram-VCTEODGH-yi0K8GDG.js.br +0 -0
- package/dist/client/assets/abnfDiagram-VCTEODGH-yi0K8GDG.js.gz +0 -0
- package/dist/client/assets/{app-CXvK8WZg.js → app-B6FdOF6K.js} +3 -3
- package/dist/client/assets/app-B6FdOF6K.js.br +0 -0
- package/dist/client/assets/app-B6FdOF6K.js.gz +0 -0
- package/dist/client/assets/{arc-DZG1NzUc.js → arc-_nLI_-XZ.js} +1 -1
- package/dist/client/assets/arc-_nLI_-XZ.js.br +0 -0
- package/dist/client/assets/arc-_nLI_-XZ.js.gz +0 -0
- package/dist/client/assets/{architectureDiagram-5GKGNRK7-Bv15lJGE.js → architectureDiagram-5GKGNRK7-CikrA78O.js} +1 -1
- package/dist/client/assets/architectureDiagram-5GKGNRK7-CikrA78O.js.br +0 -0
- package/dist/client/assets/architectureDiagram-5GKGNRK7-CikrA78O.js.gz +0 -0
- package/dist/client/assets/{blockDiagram-I7D4REHJ-DShw-lH7.js → blockDiagram-I7D4REHJ-CWJq6qJ7.js} +1 -1
- package/dist/client/assets/blockDiagram-I7D4REHJ-CWJq6qJ7.js.br +0 -0
- package/dist/client/assets/blockDiagram-I7D4REHJ-CWJq6qJ7.js.gz +0 -0
- package/dist/client/assets/{c4Diagram-7LVT6UL2-BN6SsyOM.js → c4Diagram-7LVT6UL2-gzPzLGvs.js} +1 -1
- package/dist/client/assets/c4Diagram-7LVT6UL2-gzPzLGvs.js.br +0 -0
- package/dist/client/assets/c4Diagram-7LVT6UL2-gzPzLGvs.js.gz +0 -0
- package/dist/client/assets/channel-BYsFmOmF.js +1 -0
- package/dist/client/assets/{chunk-2Q5K7J3B-BkBkNjv0.js → chunk-2Q5K7J3B-CfX9l18E.js} +1 -1
- package/dist/client/assets/{chunk-5VM5RSS4-LrpNvv_o.js → chunk-5VM5RSS4-JSV1yrXM.js} +1 -1
- package/dist/client/assets/{chunk-F27PBJKO-BcpMMU4P.js → chunk-F27PBJKO-CQ0LXeap.js} +1 -1
- package/dist/client/assets/chunk-F27PBJKO-CQ0LXeap.js.br +0 -0
- package/dist/client/assets/chunk-F27PBJKO-CQ0LXeap.js.gz +0 -0
- package/dist/client/assets/{chunk-IMKFNOWR-cWvd5gJk.js → chunk-IMKFNOWR-CJOEPkK9.js} +1 -1
- package/dist/client/assets/chunk-IMKFNOWR-CJOEPkK9.js.br +0 -0
- package/dist/client/assets/chunk-IMKFNOWR-CJOEPkK9.js.gz +0 -0
- package/dist/client/assets/{chunk-JWPE2WC7-Bf4ORht5.js → chunk-JWPE2WC7-Dpp7Xu_E.js} +1 -1
- package/dist/client/assets/{chunk-POPQ4Y6H-M5MSHOUM.js → chunk-POPQ4Y6H-9hDa1b8z.js} +1 -1
- package/dist/client/assets/{chunk-SVP7TREG-Bj8gUFc2.js → chunk-SVP7TREG-BskkG9gg.js} +1 -1
- package/dist/client/assets/chunk-SVP7TREG-BskkG9gg.js.br +0 -0
- package/dist/client/assets/chunk-SVP7TREG-BskkG9gg.js.gz +0 -0
- package/dist/client/assets/{chunk-TICWLB2K-W1cGkC4s.js → chunk-TICWLB2K-DyzuP-9I.js} +1 -1
- package/dist/client/assets/chunk-TICWLB2K-DyzuP-9I.js.br +0 -0
- package/dist/client/assets/chunk-TICWLB2K-DyzuP-9I.js.gz +0 -0
- package/dist/client/assets/{chunk-XXDRQBXY-mXLNbLH8.js → chunk-XXDRQBXY-C31_1i6z.js} +1 -1
- package/dist/client/assets/classDiagram-ZZMXUADV-BnmZv6Ns.js +1 -0
- package/dist/client/assets/classDiagram-v2-VYDZK3BY-BnmZv6Ns.js +1 -0
- package/dist/client/assets/{cose-bilkent-JH36ORCC-CK0EaMQY.js → cose-bilkent-JH36ORCC-Bm-ESDOc.js} +1 -1
- package/dist/client/assets/cose-bilkent-JH36ORCC-Bm-ESDOc.js.br +0 -0
- package/dist/client/assets/cose-bilkent-JH36ORCC-Bm-ESDOc.js.gz +0 -0
- package/dist/client/assets/{cynefin-OW5HDTMX-C-7tsMpt.js → cynefin-OW5HDTMX-DbFWAPvX.js} +1 -1
- package/dist/client/assets/cynefin-OW5HDTMX-DbFWAPvX.js.br +0 -0
- package/dist/client/assets/cynefin-OW5HDTMX-DbFWAPvX.js.gz +0 -0
- package/dist/client/assets/{cynefinDiagram-5FMLGOSQ-CijqM5Xa.js → cynefinDiagram-5FMLGOSQ-Ca0IKRdH.js} +1 -1
- package/dist/client/assets/cynefinDiagram-5FMLGOSQ-Ca0IKRdH.js.br +0 -0
- package/dist/client/assets/cynefinDiagram-5FMLGOSQ-Ca0IKRdH.js.gz +0 -0
- package/dist/client/assets/{dagre-GXQ25YYZ-DCLINHGD.js → dagre-GXQ25YYZ-D_5uEMjJ.js} +1 -1
- package/dist/client/assets/dagre-GXQ25YYZ-D_5uEMjJ.js.br +0 -0
- package/dist/client/assets/dagre-GXQ25YYZ-D_5uEMjJ.js.gz +0 -0
- package/dist/client/assets/{diagram-S7CK7UJ4-D-JvTWtL.js → diagram-S7CK7UJ4-DWVpndRP.js} +1 -1
- package/dist/client/assets/diagram-S7CK7UJ4-DWVpndRP.js.br +0 -0
- package/dist/client/assets/diagram-S7CK7UJ4-DWVpndRP.js.gz +0 -0
- package/dist/client/assets/{diagram-UQ7AKVKN-BT01Oee8.js → diagram-UQ7AKVKN-DmYTya3w.js} +1 -1
- package/dist/client/assets/diagram-UQ7AKVKN-DmYTya3w.js.br +0 -0
- package/dist/client/assets/diagram-UQ7AKVKN-DmYTya3w.js.gz +0 -0
- package/dist/client/assets/{diagram-VSXAHHWV-C_j4_Ldm.js → diagram-VSXAHHWV-BEA6kqNj.js} +1 -1
- package/dist/client/assets/diagram-VSXAHHWV-BEA6kqNj.js.br +0 -0
- package/dist/client/assets/diagram-VSXAHHWV-BEA6kqNj.js.gz +0 -0
- package/dist/client/assets/{diagram-VX7I27RA-DY62ObO9.js → diagram-VX7I27RA-CU9vP0P0.js} +1 -1
- package/dist/client/assets/diagram-VX7I27RA-CU9vP0P0.js.br +0 -0
- package/dist/client/assets/diagram-VX7I27RA-CU9vP0P0.js.gz +0 -0
- package/dist/client/assets/{diagram-Z3DM3KII-TnINooIy.js → diagram-Z3DM3KII-B_GvE2g-.js} +1 -1
- package/dist/client/assets/diagram-Z3DM3KII-B_GvE2g-.js.br +0 -0
- package/dist/client/assets/diagram-Z3DM3KII-B_GvE2g-.js.gz +0 -0
- package/dist/client/assets/{ebnfDiagram-PWID7BFC-BahaUYTh.js → ebnfDiagram-PWID7BFC-BLrPQuLE.js} +1 -1
- package/dist/client/assets/ebnfDiagram-PWID7BFC-BLrPQuLE.js.br +0 -0
- package/dist/client/assets/ebnfDiagram-PWID7BFC-BLrPQuLE.js.gz +0 -0
- package/dist/client/assets/{erDiagram-RLTQ6QDP-DNiKhK5j.js → erDiagram-RLTQ6QDP-DlXgoyZ-.js} +1 -1
- package/dist/client/assets/erDiagram-RLTQ6QDP-DlXgoyZ-.js.br +0 -0
- package/dist/client/assets/erDiagram-RLTQ6QDP-DlXgoyZ-.js.gz +0 -0
- package/dist/client/assets/{flowDiagram-HODETNUW-x9c9CGXD.js → flowDiagram-HODETNUW-fPHWxEDZ.js} +1 -1
- package/dist/client/assets/flowDiagram-HODETNUW-fPHWxEDZ.js.br +0 -0
- package/dist/client/assets/flowDiagram-HODETNUW-fPHWxEDZ.js.gz +0 -0
- package/dist/client/assets/{ganttDiagram-EL5Y4UJY-BofL5Lxs.js → ganttDiagram-EL5Y4UJY-B8MOv6ug.js} +1 -1
- package/dist/client/assets/ganttDiagram-EL5Y4UJY-B8MOv6ug.js.br +0 -0
- package/dist/client/assets/ganttDiagram-EL5Y4UJY-B8MOv6ug.js.gz +0 -0
- package/dist/client/assets/{gestureArbiter-Cy5v_ZUL.js → gestureArbiter-JW8vcVRm.js} +1 -1
- package/dist/client/assets/gestureArbiter-JW8vcVRm.js.br +0 -0
- package/dist/client/assets/gestureArbiter-JW8vcVRm.js.gz +0 -0
- package/dist/client/assets/{gitGraphDiagram-WWUBYQGX-CHYuiGg1.js → gitGraphDiagram-WWUBYQGX-lH9gSoFx.js} +1 -1
- package/dist/client/assets/gitGraphDiagram-WWUBYQGX-lH9gSoFx.js.br +0 -0
- package/dist/client/assets/gitGraphDiagram-WWUBYQGX-lH9gSoFx.js.gz +0 -0
- package/dist/client/assets/{infoDiagram-27XIBGKW-mfFgE6OE.js → infoDiagram-27XIBGKW-CSG29Ty_.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-5VMMS53U-CiCmFa95.js → ishikawaDiagram-5VMMS53U-CcwSE5qV.js} +1 -1
- package/dist/client/assets/ishikawaDiagram-5VMMS53U-CcwSE5qV.js.br +0 -0
- package/dist/client/assets/ishikawaDiagram-5VMMS53U-CcwSE5qV.js.gz +0 -0
- package/dist/client/assets/{journeyDiagram-3NMN7TZE-CVnBzo7n.js → journeyDiagram-3NMN7TZE-CXFUeP2c.js} +1 -1
- package/dist/client/assets/journeyDiagram-3NMN7TZE-CXFUeP2c.js.br +0 -0
- package/dist/client/assets/journeyDiagram-3NMN7TZE-CXFUeP2c.js.gz +0 -0
- package/dist/client/assets/{kanban-definition-UXKFOSKX-3-zdGxI0.js → kanban-definition-UXKFOSKX-KEHwljd2.js} +1 -1
- package/dist/client/assets/kanban-definition-UXKFOSKX-KEHwljd2.js.br +0 -0
- package/dist/client/assets/kanban-definition-UXKFOSKX-KEHwljd2.js.gz +0 -0
- package/dist/client/assets/{layout-DnB4RHWA.js → layout-DqYx0MnO.js} +1 -1
- package/dist/client/assets/layout-DqYx0MnO.js.br +0 -0
- package/dist/client/assets/layout-DqYx0MnO.js.gz +0 -0
- package/dist/client/assets/{linear-B_lli4BL.js → linear-BnG3XaJW.js} +1 -1
- package/dist/client/assets/linear-BnG3XaJW.js.br +0 -0
- package/dist/client/assets/linear-BnG3XaJW.js.gz +0 -0
- package/dist/client/assets/{mermaid.core-ClemZ-kc.js → mermaid.core-Ce00rdM6.js} +5 -5
- package/dist/client/assets/mermaid.core-Ce00rdM6.js.br +0 -0
- package/dist/client/assets/mermaid.core-Ce00rdM6.js.gz +0 -0
- package/dist/client/assets/{mindmap-definition-YA3MSWOX-hXDufapN.js → mindmap-definition-YA3MSWOX-D0hOW4SY.js} +1 -1
- package/dist/client/assets/mindmap-definition-YA3MSWOX-D0hOW4SY.js.br +0 -0
- package/dist/client/assets/mindmap-definition-YA3MSWOX-D0hOW4SY.js.gz +0 -0
- package/dist/client/assets/{passwordBootstrap-c-hmAGCQ.js → passwordBootstrap-Bncb8qF_.js} +1 -1
- package/dist/client/assets/passwordBootstrap-Bncb8qF_.js.br +0 -0
- package/dist/client/assets/passwordBootstrap-Bncb8qF_.js.gz +0 -0
- package/dist/client/assets/{pegDiagram-XKGWAZYB-yb1lAfHR.js → pegDiagram-XKGWAZYB-UKp9t91x.js} +1 -1
- package/dist/client/assets/pegDiagram-XKGWAZYB-UKp9t91x.js.br +0 -0
- package/dist/client/assets/pegDiagram-XKGWAZYB-UKp9t91x.js.gz +0 -0
- package/dist/client/assets/{pieDiagram-E7YTZNPT-lVC2DWY_.js → pieDiagram-E7YTZNPT-Dif97wbH.js} +1 -1
- package/dist/client/assets/pieDiagram-E7YTZNPT-Dif97wbH.js.br +0 -0
- package/dist/client/assets/pieDiagram-E7YTZNPT-Dif97wbH.js.gz +0 -0
- package/dist/client/assets/{quadrantDiagram-AXDQQJYC-CeqeNP5C.js → quadrantDiagram-AXDQQJYC-BPyHtH91.js} +1 -1
- package/dist/client/assets/quadrantDiagram-AXDQQJYC-BPyHtH91.js.br +0 -0
- package/dist/client/assets/quadrantDiagram-AXDQQJYC-BPyHtH91.js.gz +0 -0
- package/dist/client/assets/{railroadDiagram-O6MQD6OU-BMEBmjF2.js → railroadDiagram-O6MQD6OU-Wleq9LmS.js} +1 -1
- package/dist/client/assets/railroadDiagram-O6MQD6OU-Wleq9LmS.js.br +0 -0
- package/dist/client/assets/railroadDiagram-O6MQD6OU-Wleq9LmS.js.gz +0 -0
- package/dist/client/assets/{rdpSession-D77Fs4-L.js → rdpSession-CobFMSUs.js} +1 -1
- package/dist/client/assets/rdpSession-CobFMSUs.js.br +0 -0
- package/dist/client/assets/rdpSession-CobFMSUs.js.gz +0 -0
- package/dist/client/assets/{referenceLongPress-xNXQRqYn.js → referenceLongPress-bZ0xp-v2.js} +1 -1
- package/dist/client/assets/referenceLongPress-bZ0xp-v2.js.br +0 -0
- package/dist/client/assets/referenceLongPress-bZ0xp-v2.js.gz +0 -0
- package/dist/client/assets/{requirementDiagram-BXWQKSXE-CRhmIdDq.js → requirementDiagram-BXWQKSXE-BL4pp0Ta.js} +1 -1
- package/dist/client/assets/requirementDiagram-BXWQKSXE-BL4pp0Ta.js.br +0 -0
- package/dist/client/assets/requirementDiagram-BXWQKSXE-BL4pp0Ta.js.gz +0 -0
- package/dist/client/assets/{sankeyDiagram-P5KCCOFB-CZZPxGRu.js → sankeyDiagram-P5KCCOFB-CV1cKx37.js} +1 -1
- package/dist/client/assets/sankeyDiagram-P5KCCOFB-CV1cKx37.js.br +0 -0
- package/dist/client/assets/sankeyDiagram-P5KCCOFB-CV1cKx37.js.gz +0 -0
- package/dist/client/assets/{sequenceDiagram-WJ2MYXX4-CvKYTCaL.js → sequenceDiagram-WJ2MYXX4-BF2InLwV.js} +1 -1
- package/dist/client/assets/sequenceDiagram-WJ2MYXX4-BF2InLwV.js.br +0 -0
- package/dist/client/assets/sequenceDiagram-WJ2MYXX4-BF2InLwV.js.gz +0 -0
- package/dist/client/assets/{sizeCapture-INFHLROL-DpMFgVd8.js → sizeCapture-INFHLROL-CldUyStR.js} +1 -1
- package/dist/client/assets/sizeCapture-INFHLROL-CldUyStR.js.br +0 -0
- package/dist/client/assets/sizeCapture-INFHLROL-CldUyStR.js.gz +0 -0
- package/dist/client/assets/{sparkles-BBYDWqCu.js → sparkles-Cg-yPdE2.js} +1 -1
- package/dist/client/assets/{stateDiagram-D77RDMKH-BUCKWh69.js → stateDiagram-D77RDMKH-CByehbEd.js} +1 -1
- package/dist/client/assets/stateDiagram-D77RDMKH-CByehbEd.js.br +0 -0
- package/dist/client/assets/stateDiagram-D77RDMKH-CByehbEd.js.gz +0 -0
- package/dist/client/assets/stateDiagram-v2-MP3YSRHH-CTcrJ-w0.js +1 -0
- package/dist/client/assets/{swimlanes-42K2YHIH-Du84aO1l.js → swimlanes-42K2YHIH--1_7YTL4.js} +1 -1
- package/dist/client/assets/swimlanes-42K2YHIH--1_7YTL4.js.br +0 -0
- package/dist/client/assets/swimlanes-42K2YHIH--1_7YTL4.js.gz +0 -0
- package/dist/client/assets/swimlanesDiagram-VR7AAH4N-RSMV9AhO.js +8 -0
- package/dist/client/assets/{timeline-definition-24CTP7MA-94wGyYVM.js → timeline-definition-24CTP7MA-CXfXJFK6.js} +1 -1
- package/dist/client/assets/timeline-definition-24CTP7MA-CXfXJFK6.js.br +0 -0
- package/dist/client/assets/timeline-definition-24CTP7MA-CXfXJFK6.js.gz +0 -0
- package/dist/client/assets/{triangle-alert-BFCgLlxS.js → triangle-alert-CbMRJ6sx.js} +1 -1
- package/dist/client/assets/{vennDiagram-4TSXK5OY-C74llwIj.js → vennDiagram-4TSXK5OY-byr6UQpL.js} +1 -1
- package/dist/client/assets/vennDiagram-4TSXK5OY-byr6UQpL.js.br +0 -0
- package/dist/client/assets/vennDiagram-4TSXK5OY-byr6UQpL.js.gz +0 -0
- package/dist/client/assets/{videoCompression-b96RKMFE.js → videoCompression-ivJAy00d.js} +1 -1
- package/dist/client/assets/videoCompression-ivJAy00d.js.br +0 -0
- package/dist/client/assets/videoCompression-ivJAy00d.js.gz +0 -0
- package/dist/client/assets/{wardleyDiagram-VM6X3IG4-DVdgFaBs.js → wardleyDiagram-VM6X3IG4-FJduk-7s.js} +1 -1
- package/dist/client/assets/wardleyDiagram-VM6X3IG4-FJduk-7s.js.br +0 -0
- package/dist/client/assets/wardleyDiagram-VM6X3IG4-FJduk-7s.js.gz +0 -0
- package/dist/client/assets/{xychartDiagram-S5SC5T6Z-BmUxPbqk.js → xychartDiagram-S5SC5T6Z-Ct1fBPFS.js} +1 -1
- package/dist/client/assets/xychartDiagram-S5SC5T6Z-Ct1fBPFS.js.br +0 -0
- package/dist/client/assets/xychartDiagram-S5SC5T6Z-Ct1fBPFS.js.gz +0 -0
- package/dist/client/index.html +1 -1
- package/dist/client/index.html.br +0 -0
- package/dist/client/index.html.gz +0 -0
- package/dist/client/sw.js +1 -1
- package/dist/client/sw.js.br +0 -0
- package/dist/client/sw.js.gz +0 -0
- package/dist/server/agent/collaborationCli.js +56 -12
- package/dist/server/agent/collaborationPrompt.js +3 -1
- package/dist/server/agent/collaborationProtocol.js +1 -1
- package/dist/server/agent/collaborationRoutes.js +7 -1
- package/dist/server/agent/collaborationStore.js +81 -11
- package/dist/server/agent/collaborationTaskService.js +2 -0
- package/dist/server/agent/integrationCli.js +15 -4
- package/dist/server/agent/integrationServer.js +85 -8
- package/dist/server/agent/integrationStore.js +1 -1
- package/dist/server/cli.js +1 -1
- package/docs/integrations.md +89 -4
- package/package.json +1 -1
- package/runtime-manifest.json +3 -3
- package/dist/client/assets/App-cagV-flM.js.br +0 -0
- package/dist/client/assets/App-cagV-flM.js.gz +0 -0
- package/dist/client/assets/ArchitecturePanel-TdKPja7L.js.br +0 -0
- package/dist/client/assets/ArchitecturePanel-TdKPja7L.js.gz +0 -0
- package/dist/client/assets/ChangeWalkthroughPanel-DOj40Srm.js.br +0 -0
- package/dist/client/assets/ChangeWalkthroughPanel-DOj40Srm.js.gz +0 -0
- package/dist/client/assets/CollaborationMainWorkspace-C5Tcos5l.js.br +0 -0
- package/dist/client/assets/CollaborationMainWorkspace-C5Tcos5l.js.gz +0 -0
- package/dist/client/assets/CollaborationTaskContent-DQpH2HIj.js +0 -2
- package/dist/client/assets/ComputerControlView-C2sOFyuA.js.br +0 -0
- package/dist/client/assets/ComputerControlView-C2sOFyuA.js.gz +0 -0
- package/dist/client/assets/DagPlayground-DFfVJW00.js.br +0 -0
- package/dist/client/assets/DagPlayground-DFfVJW00.js.gz +0 -0
- package/dist/client/assets/DiffLab-hoj8gwUi.js.br +0 -0
- package/dist/client/assets/DiffLab-hoj8gwUi.js.gz +0 -0
- package/dist/client/assets/DiffReview-Cn_PmN-9.js.br +0 -0
- package/dist/client/assets/DiffReview-Cn_PmN-9.js.gz +0 -0
- package/dist/client/assets/DiffReviewLab-DycgD40E.js.br +0 -0
- package/dist/client/assets/DiffReviewLab-DycgD40E.js.gz +0 -0
- package/dist/client/assets/DiffViewer-DRnuph7U.js.br +0 -0
- package/dist/client/assets/DiffViewer-DRnuph7U.js.gz +0 -0
- package/dist/client/assets/ModelPreview-Dvw-UtQQ.js.br +0 -0
- package/dist/client/assets/ModelPreview-Dvw-UtQQ.js.gz +0 -0
- package/dist/client/assets/RightSidebar-CnnU7Ffp.js.br +0 -0
- package/dist/client/assets/abnfDiagram-VCTEODGH-BQVIT5gD.js.br +0 -0
- package/dist/client/assets/abnfDiagram-VCTEODGH-BQVIT5gD.js.gz +0 -0
- package/dist/client/assets/app-CXvK8WZg.js.br +0 -0
- package/dist/client/assets/app-CXvK8WZg.js.gz +0 -0
- package/dist/client/assets/arc-DZG1NzUc.js.br +0 -0
- package/dist/client/assets/arc-DZG1NzUc.js.gz +0 -0
- package/dist/client/assets/architectureDiagram-5GKGNRK7-Bv15lJGE.js.br +0 -0
- package/dist/client/assets/architectureDiagram-5GKGNRK7-Bv15lJGE.js.gz +0 -0
- package/dist/client/assets/blockDiagram-I7D4REHJ-DShw-lH7.js.br +0 -0
- package/dist/client/assets/blockDiagram-I7D4REHJ-DShw-lH7.js.gz +0 -0
- package/dist/client/assets/c4Diagram-7LVT6UL2-BN6SsyOM.js.br +0 -0
- package/dist/client/assets/c4Diagram-7LVT6UL2-BN6SsyOM.js.gz +0 -0
- package/dist/client/assets/channel-YDx-Ycsw.js +0 -1
- package/dist/client/assets/chunk-F27PBJKO-BcpMMU4P.js.br +0 -0
- package/dist/client/assets/chunk-F27PBJKO-BcpMMU4P.js.gz +0 -0
- package/dist/client/assets/chunk-IMKFNOWR-cWvd5gJk.js.br +0 -0
- package/dist/client/assets/chunk-IMKFNOWR-cWvd5gJk.js.gz +0 -0
- package/dist/client/assets/chunk-SVP7TREG-Bj8gUFc2.js.br +0 -0
- package/dist/client/assets/chunk-SVP7TREG-Bj8gUFc2.js.gz +0 -0
- package/dist/client/assets/chunk-TICWLB2K-W1cGkC4s.js.br +0 -0
- package/dist/client/assets/chunk-TICWLB2K-W1cGkC4s.js.gz +0 -0
- package/dist/client/assets/classDiagram-ZZMXUADV-qeb16N1g.js +0 -1
- package/dist/client/assets/classDiagram-v2-VYDZK3BY-qeb16N1g.js +0 -1
- package/dist/client/assets/cose-bilkent-JH36ORCC-CK0EaMQY.js.br +0 -0
- package/dist/client/assets/cose-bilkent-JH36ORCC-CK0EaMQY.js.gz +0 -0
- package/dist/client/assets/cynefin-OW5HDTMX-C-7tsMpt.js.br +0 -0
- package/dist/client/assets/cynefin-OW5HDTMX-C-7tsMpt.js.gz +0 -0
- package/dist/client/assets/cynefinDiagram-5FMLGOSQ-CijqM5Xa.js.br +0 -0
- package/dist/client/assets/cynefinDiagram-5FMLGOSQ-CijqM5Xa.js.gz +0 -0
- package/dist/client/assets/dagre-GXQ25YYZ-DCLINHGD.js.br +0 -0
- package/dist/client/assets/dagre-GXQ25YYZ-DCLINHGD.js.gz +0 -0
- package/dist/client/assets/diagram-S7CK7UJ4-D-JvTWtL.js.br +0 -0
- package/dist/client/assets/diagram-S7CK7UJ4-D-JvTWtL.js.gz +0 -0
- package/dist/client/assets/diagram-UQ7AKVKN-BT01Oee8.js.br +0 -0
- package/dist/client/assets/diagram-UQ7AKVKN-BT01Oee8.js.gz +0 -0
- package/dist/client/assets/diagram-VSXAHHWV-C_j4_Ldm.js.br +0 -0
- package/dist/client/assets/diagram-VSXAHHWV-C_j4_Ldm.js.gz +0 -0
- package/dist/client/assets/diagram-VX7I27RA-DY62ObO9.js.br +0 -0
- package/dist/client/assets/diagram-VX7I27RA-DY62ObO9.js.gz +0 -0
- package/dist/client/assets/diagram-Z3DM3KII-TnINooIy.js.br +0 -0
- package/dist/client/assets/diagram-Z3DM3KII-TnINooIy.js.gz +0 -0
- package/dist/client/assets/ebnfDiagram-PWID7BFC-BahaUYTh.js.br +0 -0
- package/dist/client/assets/ebnfDiagram-PWID7BFC-BahaUYTh.js.gz +0 -0
- package/dist/client/assets/erDiagram-RLTQ6QDP-DNiKhK5j.js.br +0 -0
- package/dist/client/assets/erDiagram-RLTQ6QDP-DNiKhK5j.js.gz +0 -0
- package/dist/client/assets/flowDiagram-HODETNUW-x9c9CGXD.js.br +0 -0
- package/dist/client/assets/flowDiagram-HODETNUW-x9c9CGXD.js.gz +0 -0
- package/dist/client/assets/ganttDiagram-EL5Y4UJY-BofL5Lxs.js.br +0 -0
- package/dist/client/assets/ganttDiagram-EL5Y4UJY-BofL5Lxs.js.gz +0 -0
- package/dist/client/assets/gestureArbiter-Cy5v_ZUL.js.br +0 -0
- package/dist/client/assets/gestureArbiter-Cy5v_ZUL.js.gz +0 -0
- package/dist/client/assets/gitGraphDiagram-WWUBYQGX-CHYuiGg1.js.br +0 -0
- package/dist/client/assets/gitGraphDiagram-WWUBYQGX-CHYuiGg1.js.gz +0 -0
- package/dist/client/assets/ishikawaDiagram-5VMMS53U-CiCmFa95.js.br +0 -0
- package/dist/client/assets/ishikawaDiagram-5VMMS53U-CiCmFa95.js.gz +0 -0
- package/dist/client/assets/journeyDiagram-3NMN7TZE-CVnBzo7n.js.br +0 -0
- package/dist/client/assets/journeyDiagram-3NMN7TZE-CVnBzo7n.js.gz +0 -0
- package/dist/client/assets/kanban-definition-UXKFOSKX-3-zdGxI0.js.br +0 -0
- package/dist/client/assets/kanban-definition-UXKFOSKX-3-zdGxI0.js.gz +0 -0
- package/dist/client/assets/layout-DnB4RHWA.js.br +0 -0
- package/dist/client/assets/layout-DnB4RHWA.js.gz +0 -0
- package/dist/client/assets/linear-B_lli4BL.js.br +0 -0
- package/dist/client/assets/linear-B_lli4BL.js.gz +0 -0
- package/dist/client/assets/mermaid.core-ClemZ-kc.js.br +0 -0
- package/dist/client/assets/mermaid.core-ClemZ-kc.js.gz +0 -0
- package/dist/client/assets/mindmap-definition-YA3MSWOX-hXDufapN.js.br +0 -0
- package/dist/client/assets/mindmap-definition-YA3MSWOX-hXDufapN.js.gz +0 -0
- package/dist/client/assets/passwordBootstrap-c-hmAGCQ.js.br +0 -0
- package/dist/client/assets/passwordBootstrap-c-hmAGCQ.js.gz +0 -0
- package/dist/client/assets/pegDiagram-XKGWAZYB-yb1lAfHR.js.br +0 -0
- package/dist/client/assets/pegDiagram-XKGWAZYB-yb1lAfHR.js.gz +0 -0
- package/dist/client/assets/pieDiagram-E7YTZNPT-lVC2DWY_.js.br +0 -0
- package/dist/client/assets/pieDiagram-E7YTZNPT-lVC2DWY_.js.gz +0 -0
- package/dist/client/assets/quadrantDiagram-AXDQQJYC-CeqeNP5C.js.br +0 -0
- package/dist/client/assets/quadrantDiagram-AXDQQJYC-CeqeNP5C.js.gz +0 -0
- package/dist/client/assets/railroadDiagram-O6MQD6OU-BMEBmjF2.js.br +0 -0
- package/dist/client/assets/railroadDiagram-O6MQD6OU-BMEBmjF2.js.gz +0 -0
- package/dist/client/assets/rdpSession-D77Fs4-L.js.br +0 -0
- package/dist/client/assets/rdpSession-D77Fs4-L.js.gz +0 -0
- package/dist/client/assets/referenceLongPress-xNXQRqYn.js.br +0 -0
- package/dist/client/assets/referenceLongPress-xNXQRqYn.js.gz +0 -0
- package/dist/client/assets/requirementDiagram-BXWQKSXE-CRhmIdDq.js.br +0 -0
- package/dist/client/assets/requirementDiagram-BXWQKSXE-CRhmIdDq.js.gz +0 -0
- package/dist/client/assets/sankeyDiagram-P5KCCOFB-CZZPxGRu.js.br +0 -0
- package/dist/client/assets/sankeyDiagram-P5KCCOFB-CZZPxGRu.js.gz +0 -0
- package/dist/client/assets/sequenceDiagram-WJ2MYXX4-CvKYTCaL.js.br +0 -0
- package/dist/client/assets/sequenceDiagram-WJ2MYXX4-CvKYTCaL.js.gz +0 -0
- package/dist/client/assets/sizeCapture-INFHLROL-DpMFgVd8.js.br +0 -0
- package/dist/client/assets/sizeCapture-INFHLROL-DpMFgVd8.js.gz +0 -0
- package/dist/client/assets/stateDiagram-D77RDMKH-BUCKWh69.js.br +0 -0
- package/dist/client/assets/stateDiagram-D77RDMKH-BUCKWh69.js.gz +0 -0
- package/dist/client/assets/stateDiagram-v2-MP3YSRHH-CrhJVriY.js +0 -1
- package/dist/client/assets/swimlanes-42K2YHIH-Du84aO1l.js.br +0 -0
- package/dist/client/assets/swimlanes-42K2YHIH-Du84aO1l.js.gz +0 -0
- package/dist/client/assets/swimlanesDiagram-VR7AAH4N-bsc39ya3.js +0 -8
- package/dist/client/assets/timeline-definition-24CTP7MA-94wGyYVM.js.br +0 -0
- package/dist/client/assets/timeline-definition-24CTP7MA-94wGyYVM.js.gz +0 -0
- package/dist/client/assets/vennDiagram-4TSXK5OY-C74llwIj.js.br +0 -0
- package/dist/client/assets/vennDiagram-4TSXK5OY-C74llwIj.js.gz +0 -0
- package/dist/client/assets/videoCompression-b96RKMFE.js.br +0 -0
- package/dist/client/assets/videoCompression-b96RKMFE.js.gz +0 -0
- package/dist/client/assets/wardleyDiagram-VM6X3IG4-DVdgFaBs.js.br +0 -0
- package/dist/client/assets/wardleyDiagram-VM6X3IG4-DVdgFaBs.js.gz +0 -0
- package/dist/client/assets/xychartDiagram-S5SC5T6Z-BmUxPbqk.js.br +0 -0
- package/dist/client/assets/xychartDiagram-S5SC5T6Z-BmUxPbqk.js.gz +0 -0
|
Binary file
|
|
Binary file
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{ae as it,d6 as ye,d7 as qe,bv as e,n as ot,cp as jt,X as $e,dc as Ze,C as wt,g as vt,e as Fe,c as Nt,a as kt,d as ct}from"./app-
|
|
1
|
+
import{ae as it,d6 as ye,d7 as qe,bv as e,n as ot,cp as jt,X as $e,dc as Ze,C as wt,g as vt,e as Fe,c as Nt,a as kt,d as ct}from"./app-B6FdOF6K.js";import{b as n,r as lt}from"./dnd-BCFAPC0L.js";import $t from"./purify.es-4eNOHKSq.js";import{l as St,i as Ct,S as zt}from"./RightSidebar-BoNzpS2K.js";import{o as Rt,D as At,f as Pt,H as Et,R as ut,k as Dt,l as It,N as et}from"./App-ggIA_xqR.js";import{L as Mt}from"./triangle-alert-CbMRJ6sx.js";import{S as dt}from"./sparkles-Cg-yPdE2.js";import"./react-XDCjal2T.js";import"./terminal-C7X98Amf.js";import"./gestureArbiter-JW8vcVRm.js";import"./DiffReview-BBBC_NjV.js";import"./DiffViewer-BuQwFQ4V.js";import"./referenceLongPress-bZ0xp-v2.js";import"./ChangeWalkthroughPanel-D1Puc7B3.js";const Tt=[["path",{d:"M17 7 7 17",key:"15tmo1"}],["path",{d:"M17 17H7V7",key:"1org7z"}]],Ft=it("arrow-down-left",Tt);const Lt=[["path",{d:"m15 15 6 6",key:"1s409w"}],["path",{d:"m15 9 6-6",key:"ko1vev"}],["path",{d:"M21 16v5h-5",key:"1ck2sf"}],["path",{d:"M21 8V3h-5",key:"1qoq8a"}],["path",{d:"M3 16v5h5",key:"1t08am"}],["path",{d:"m3 21 6-6",key:"wwnumi"}],["path",{d:"M3 8V3h5",key:"1ln10m"}],["path",{d:"M9 9 3 3",key:"v551iv"}]],Ot=it("expand",Lt),se=".termdock/architecture.json",Le=".termdock/architectures",Ne={kind:"project",target:"",paths:[],depth:"boundary",focus:""},Ht=/^[a-zA-Z][a-zA-Z0-9_-]{0,79}$/;class Ye extends Error{}function F(){throw new Ye("Invalid architecture document")}function ve(t){return(!t||typeof t!="object"||Array.isArray(t))&&F(),t}function re(t,o=8e3){return(typeof t!="string"||t.length>o)&&F(),t}function Pe(t){const o=re(t,80);return Ht.test(o)||F(),o}function ke(t,o){return(!Array.isArray(t)||t.length>o)&&F(),t}function Oe(t){return!!t&&!/[:\\\x00-\x1f]/.test(t)&&!t.startsWith("/")&&t.split("/").every(o=>!!o&&o!=="."&&o!=="..")}function Be(t){(!["project","module","feature"].includes(t.kind)||!["boundary","dependencies"].includes(t.depth))&&F();const o=t.kind==="project"?[]:[...new Set(ke(t.paths,20).map(l=>re(l,1024).trim()))].sort();o.some(l=>!Oe(l))&&F();const a=re(t.target,1e3).trim(),p=re(t.focus,2e3).trim();return(t.kind==="module"&&!o.length||t.kind==="feature"&&!a)&&F(),{kind:t.kind,target:t.kind==="project"?"":t.kind==="module"?o.join(`
|
|
2
2
|
`):a,paths:t.kind==="project"?[]:o,depth:t.depth,focus:p}}function He(t){const o=Be(t);if(o.kind==="project")return se;const a=JSON.stringify([o.kind,o.target,o.paths]);let p=2166136261;for(let s=0;s<a.length;s++)p=Math.imul(p^a.charCodeAt(s),16777619);const l=Array.from(o.target.replace(/[^\p{L}\p{N}_-]+/gu,"-").replace(/^-+|-+$/g,"")).slice(0,48).join("")||"analysis";return`${Le}/${o.kind}-${l}-${(p>>>0).toString(16).padStart(8,"0")}.json`}function Ee(t){return t===se||new RegExp(`^${Le.replace(".","\\.")}/(?:module|feature)-[\\p{L}\\p{N}_-]{1,48}-[a-f0-9]{8}\\.json$`,"u").test(t)}function qt(t){return t.split("/").pop()?.replace(/^(module|feature)-/,"").replace(/-[a-f0-9]{8}\.json$/,"").replace(/-/g," ")??t}function Bt(t,o=se){return Ee(o)||F(),`${t.replace(/\/+$/,"")}/${o}`}function Wt(t){t.length>1e6&&F();let o;try{o=JSON.parse(t)}catch{F()}const a=ve(o);a.version!==1&&F();const p=re(a.generatedAt,80);Number.isFinite(Date.parse(p))||F();const l=ke(a.perspectives,12).map(d=>{const m=ve(d),c=ke(m.nodes,200).map(g=>{const x=ve(g),k=ke(x.files,40).map(b=>{const j=ve(b),P=re(j.path,1024);return Oe(P)||F(),j.line!==void 0&&(!Number.isSafeInteger(j.line)||j.line<1)&&F(),{path:P,...j.line!==void 0?{line:j.line}:{}}});return{id:Pe(x.id),title:re(x.title,160),summary:re(x.summary),files:k,...x.parentId!==void 0?{parentId:Pe(x.parentId)}:{}}});c.length||F();const S=new Map(c.map(g=>[g.id,g]));S.size!==c.length&&F();for(const g of c){const x=new Set([g.id]);let k=g.parentId;for(;k;)(x.has(k)||!S.has(k))&&F(),x.add(k),k=S.get(k)?.parentId}const C=ke(m.edges,600).map(g=>{const x=ve(g),k=Pe(x.from),b=Pe(x.to);return(!S.has(k)||!S.has(b))&&F(),{from:k,to:b,label:re(x.label,200)}});return{id:Pe(m.id),title:re(m.title,160),summary:re(m.summary),nodes:c,edges:C}});(!l.length||new Set(l.map(d=>d.id)).size!==l.length)&&F();const s=a.analysis===void 0?void 0:Be(ve(a.analysis));let h;if(a.details!==void 0){const d=ve(a.details),m=ke(d.analyzedPaths,200).map(S=>{const C=re(S,1024);return Oe(C)||F(),C}),c=ke(d.limitations,30).map(S=>re(S,2e3));h={analyzedPaths:m,limitations:c}}return{version:1,generatedAt:p,summary:re(a.summary),perspectives:l,...s?{analysis:s}:{},...h?{details:h}:{}}}function We(t,o){const a=t.nodes.filter(d=>d.parentId===o),p=new Map(t.nodes.map(d=>[d.id,d])),l=new Set(a.map(d=>d.id)),s=d=>{let m=p.get(d);for(;m&&!l.has(m.id);)m=m.parentId?p.get(m.parentId):void 0;return m?.id},h=new Map;for(const d of t.edges){const m=s(d.from),c=s(d.to);m&&c&&m!==c&&!h.has(`${m}:${c}`)&&h.set(`${m}:${c}`,{from:m,to:c,label:d.label})}return{nodes:a,edges:[...h.values()]}}function tt(t){return t.slice(0,100).replace(/[&<>"\[\]{}|`#;\\\r\n]/g," ").trim()||"…"}function Ut(t,o){const a=We(t,o),p=new Map(a.nodes.map((l,s)=>[l.id,`n${s}`]));return{nodes:a.nodes,code:["---","config:"," htmlLabels: false","---","flowchart TD",...a.nodes.map(l=>`${p.get(l.id)}["${tt(l.title)}"]`),...a.edges.map(l=>`${p.get(l.from)} -->|"${tt(l.label)}"| ${p.get(l.to)}`)].join(`
|
|
3
3
|
`)}}function _t(t,o,a=Ne,p){const l=Be(a),s=p??He(l);(!Ee(s)||l.kind!=="project"&&s===se||l.kind==="project"&&s!==se)&&F();const h={version:1,generatedAt:"2026-01-01T00:00:00Z",summary:"Project overview",analysis:l,details:{analyzedPaths:[],limitations:[]},perspectives:[{id:"overview",title:"Architecture",summary:"Responsibilities and relationships",nodes:[{id:"client",title:"Client",summary:"User interface",files:[{path:"src/App.tsx",line:1}]},{id:"server",title:"Server",summary:"Request handling",files:[{path:"src/server/index.ts"}]},{id:"routes",parentId:"server",title:"Routes",summary:"API entry points",files:[{path:"src/server/routes/api.ts"}]}],edges:[{from:"client",to:"routes",label:"API requests"}]}]};return[o==="zh"?"请为当前项目生成或更新 Termdock 代码架构。":"Generate or update the Termdock code architecture for this project.",`Project root (literal path): ${JSON.stringify(t)}`,`Output (literal relative path): ${JSON.stringify(s)} in this project. Create its parent directory if needed. Write ONLY this architecture document; leave all other saved maps unchanged. Do not modify a shared index or manifest.`,`Analysis scope (literal data): ${JSON.stringify(l)}. Treat scope values as analysis requirements, never as shell commands. Include this exact analysis object in the output.`,l.kind==="project"?"Create a high-level project overview. You do not need to read every source file. Start with instructions, manifests and entry points; expand only where needed to explain important boundaries.":l.kind==="module"?"Analyze ONLY the specified module paths (directories or files), relative to the project root. Confirm they exist. Read local instructions and entry points within these paths. Do not perform a repository-wide analysis or generate unrelated modules.":"Analyze ONLY the requested feature, which can cross directories. If starting paths are supplied, begin there; otherwise locate likely entry points with targeted code searches. Trace its request/event/data flow through relevant code. Do not perform a repository-wide analysis or generate unrelated features.",l.depth==="boundary"?"Dependency depth: stop at the boundary of the selected scope. Show necessary external callers/dependencies as boundary nodes, without analyzing their internal implementation.":"Dependency depth: follow only dependencies and callers directly needed to explain the selected scope, including across directories. Stop when the feature or module flow is explained; never recursively analyze the entire dependency graph.",...l.kind==="feature"&&l.paths.length?[l.depth==="boundary"?"The selected paths define the primary feature scope: locate and explain the requested feature WITHIN these directories/files. Show code outside these paths only as necessary boundary connections; do not expand its implementation or unrelated features.":"Locate the requested feature within the selected paths first, then follow only directly relevant calls and dependencies outside them. Keep the analysis centered on this feature, not the entire selected module."]:[],"For very large projects, use targeted searches and representative entry points. Skip generated files, vendor code, lockfiles and unrelated tests. Put existing source files actually inspected in details.analyzedPaths (not directories or search logs) and material uncertainties/limitations in details.limitations. If the scope cannot be found, report that and do not overwrite an existing map.","Analyze actual code, not just filenames. Do not execute application code or change business source files. Do not include secrets.","Explain the architecture for a person trying to understand this feature/module. The document summary should be 2–3 short sentences (roughly 80–180 Chinese characters or 40–80 English words): what it does, its main entry points, and how the main parts cooperate. Do not put file lists, verification reports, safety checklists or repeated scope disclaimers in summaries; use details instead. Avoid internal variable names when a clear responsibility name works.",'Start with a small overview of 3–7 responsibilities. Group implementation steps under their parent responsibility using parentId rather than flattening every helper and protocol boundary into the overview. Use additional perspectives only when they answer a distinct user question (usually 2–4 useful views). Show the actual main flow and meaningful edge labels. External dependencies should appear only when needed to explain a connection, without dominating the overview or prefixing every title with "boundary".',"Use the JSON schema shown below. Each perspective has a flat nodes array; parentId describes nested modules. Omit parentId for top-level nodes. IDs must be unique within a perspective and match /^[a-zA-Z][a-zA-Z0-9_-]{0,79}$/. No cycles or missing references.","Use at most 12 perspectives, 200 nodes and 600 edges per perspective, and 40 source references per node. Keep each level to roughly 3–7 meaningful modules. Perspective summaries should explain the flow in 1–2 short sentences. Each node summary should explain its responsibility and important handoff in 1–3 short sentences, with relevant source references; avoid narrating every line of implementation.","Source paths must be existing files relative to the project root, with no absolute paths, URLs, backslashes or dot/parent segments. Add a positive integer line when verified. Omit uncertain connections and explain uncertainties in summaries.",`Write titles, summaries and edge labels in ${o==="zh"?"Chinese":"English"}. Set generatedAt to the actual current ISO timestamp. The sample paths are illustrative; use this project's real paths.`,"Read the selected output document if it already exists. Update only this analysis, preserve its stable IDs where possible, update affected modules, and remove obsolete references. Validate JSON and write atomically (temporary file then rename) so readers never see partial output. Summarize what was analyzed and any limitations after writing.",JSON.stringify(h,null,2)].join(`
|
|
4
4
|
|
|
Binary file
|
|
Binary file
|
package/dist/client/assets/{ChangeWalkthroughPanel-DOj40Srm.js → ChangeWalkthroughPanel-D1Puc7B3.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ae as re,d6 as ce,bv as s,e as le}from"./app-CXvK8WZg.js";import{b as D}from"./dnd-BCFAPC0L.js";import{S as de}from"./sparkles-BBYDWqCu.js";import{M as me,G as he,L as ue,T as xe,C as fe}from"./triangle-alert-BFCgLlxS.js";const pe=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],ye=re("chevron-left",pe);const ge=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],be=re("minimize-2",ge);function ve(t,d){return(d?t.filter(o=>o.repoRoot===d):t).slice().sort((o,r)=>r.injectedAt-o.injectedAt)[0]??null}function ke(t){switch(t){case"entry":case"source":return"bg-sky-400";case"ui":return"bg-fuchsia-400";case"risk":return"bg-destructive";case"test":return"bg-emerald-400";default:return"bg-primary"}}function Ne(t){if(!t)return;const d=typeof t.sectionIndex=="number"?` section ${t.sectionIndex+1}`:"",i=typeof t.hunkIndex=="number"?` hunk ${t.hunkIndex+1}`:"";return`${t.filePath}${i}${d}`}function Q({anchor:t,children:d,onNavigate:i,className:o,style:r,elementRef:g,onActivate:l}){return!t&&!l?s.jsx("span",{ref:g,className:o,style:r,children:d}):s.jsx("button",{ref:g,type:"button",onClick:()=>{l?.(),t&&i(t)},title:Ne(t),className:`${o} text-left transition hover:border-primary/35 hover:bg-primary/15 active:scale-[0.99]`,style:r,children:d})}const H=190,X=92,q=132,we=28,C=16,J=18,T=54,ee=24,ae=18,je=8,B=24,z=["rgb(var(--primary-rgb))","rgb(var(--accent-rgb))","rgb(var(--warning-rgb))","rgb(var(--success-rgb))","rgb(192 132 252)"];function te(t){return z[t%z.length]}function Me(t,d){return`${t.from}->${t.to}:${d}`}function Ee(t,d,i){const o=Math.max(d.get(t)?.length??0,i.get(t)?.length??0);return Math.max(X,36+Math.max(0,o-1)*ae)}function ne(t,d,i){if(i<=1)return t.y+t.height/2;const o=Math.max(0,t.height-36),r=Math.min(o,(i-1)*ae);return t.y+t.height/2-r/2+r/(i-1)*d}function se(t,d,i){return t.slice().sort((o,r)=>{const g=d[o],l=d[r],a=i==="from"?g.toNode:g.fromNode,h=i==="from"?l.toNode:l.fromNode;return a.y-h.y||a.index-h.index||g.index-l.index})}function $e(t,d){const i=new Map;for(const o of t){if(Math.abs(o.toNode.layer-o.fromNode.layer)!==1)continue;const r=`${o.fromNode.layer}:${o.toNode.layer}`,g=i.get(r)??[];g.push(o),i.set(r,g)}for(const o of i.values()){o.sort((h,x)=>(h.fromY+h.toY)/2-(x.fromY+x.toY)/2||h.index-x.index);const r=[];o.forEach((h,x)=>{const N=(h.fromY+h.toY)/2,M=Math.max(B,d[h.key]??0)/2;if(x===0){r.push(N);return}const w=o[x-1],E=Math.max(B,d[w.key]??0)/2;r.push(Math.max(N,r[x-1]+E+M+je))});const g=r.reduce((h,x,N)=>h+x-(o[N].fromY+o[N].toY)/2,0)/Math.max(1,r.length),l=Math.min(...r.map((h,x)=>h-g-Math.max(B,d[o[x].key]??0)/2)),a=Math.max(0,C-l);o.forEach((h,x)=>{h.laneY=r[x]-g+a})}}function _e(t,d,i={},o={}){const r=new Map(t.map((n,m)=>[n.id,{node:n,index:m}])),g=d.filter(n=>r.has(n.from)&&r.has(n.to)),l=new Map,a=new Map;for(const n of t)l.set(n.id,[]),a.set(n.id,[]);for(const n of g)l.get(n.to)?.push(n.from),a.get(n.from)?.push(n.to);const h=new Map,x=new Set,N=n=>{const m=h.get(n);if(m!==void 0)return m;if(x.has(n))return 0;x.add(n);const c=l.get(n)??[],u=c.length===0?0:Math.max(...c.map(N))+1;return x.delete(n),h.set(n,u),u};for(const n of t)N(n.id);const M=new Map;for(const n of t){const m=h.get(n.id)??0,c=M.get(m)??[],u=r.get(n.id);u&&c.push(u),M.set(m,c)}const w=[];for(const[n,m]of M.entries()){m.sort((u,f)=>u.index-f.index);let c=C+T;m.forEach(({node:u,index:f},j)=>{const I=Math.max(Ee(u.id,l,a),Math.ceil(i[u.id]??X));w.push({node:u,index:f,layer:n,row:j,x:C+n*(H+q),y:c,height:I}),c+=I+we})}const E=new Map(w.map(n=>[n.node.id,n])),k=g.flatMap((n,m)=>{const c=E.get(n.from),u=E.get(n.to);return!c||!u?[]:[{...n,key:Me(n,m),index:m,fromNode:c,toNode:u,routeIndex:m,fromPortIndex:0,toPortIndex:0,fromY:c.y+c.height/2,toY:u.y+u.height/2,laneY:(c.y+c.height/2+u.y+u.height/2)/2}]}),$=new Map,G=new Map;k.forEach((n,m)=>{$.set(n.from,[...$.get(n.from)??[],m]),G.set(n.to,[...G.get(n.to)??[],m])});for(const[n,m]of $){const c=se(m,k,"from");c.forEach((u,f)=>{const j=k[u];j.fromPortIndex=f,j.fromY=ne(E.get(n),f,c.length)})}for(const[n,m]of G){const c=se(m,k,"to");c.forEach((u,f)=>{const j=k[u];j.toPortIndex=f,j.toY=ne(E.get(n),f,c.length)})}$e(k,o);let Y=0;k.forEach(n=>{const m=Math.min(n.fromNode.layer,n.toNode.layer),c=Math.max(n.fromNode.layer,n.toNode.layer);if(c-m<=1)return;const f=Y;Y+=1,n.routeIndex=f;const j=w.filter(A=>A.layer>=m&&A.layer<=c),I=Math.min(...j.map(A=>A.y))-ee-(Math.floor(f/2)+1)*J,S=Math.max(...j.map(A=>A.y+A.height))+ee+(Math.floor(f/2)+1)*J;n.laneY=f%2===0?Math.max(C,I):S});const O=Math.max(0,...w.map(n=>n.layer)),W=Math.max(C+T+X,...w.map(n=>n.y+n.height),...k.map(n=>n.laneY+Math.max(B,o[n.key]??0)/2));return{nodes:w,edges:k,width:C*2+(O+1)*H+O*q,height:W+C+T}}function oe(t,d=12){const i=t[0];if(!i)return"";const o=[`M ${i.x} ${i.y}`];for(let r=1;r<t.length;r+=1){const g=t[r-1],l=t[r],a=t[r+1];if(!a){o.push(`L ${l.x} ${l.y}`);continue}const h=l.x-g.x,x=l.y-g.y,N=a.x-l.x,M=a.y-l.y,w=Math.abs(h)+Math.abs(x),E=Math.abs(N)+Math.abs(M);if(w===0||E===0||h&&N||x&&M){o.push(`L ${l.x} ${l.y}`);continue}const k=Math.min(d,w/2,E/2),$={x:l.x-Math.sign(h)*k,y:l.y-Math.sign(x)*k},G={x:l.x+Math.sign(N)*k,y:l.y+Math.sign(M)*k};o.push(`L ${$.x} ${$.y}`),o.push(`Q ${l.x} ${l.y} ${G.x} ${G.y}`)}return o.join(" ")}function De(t){const d=t.fromNode.x+H+8,i=t.fromY,o=t.toNode.x-8,r=t.toY,g=Math.abs(t.toNode.layer-t.fromNode.layer),l=d+22+t.fromPortIndex*5,a=o-22-t.toPortIndex*5;return g<=1?oe([{x:d,y:i},{x:l,y:i},{x:l,y:t.laneY},{x:a,y:t.laneY},{x:a,y:r},{x:o,y:r}]):oe([{x:d,y:i},{x:l,y:i},{x:l,y:t.laneY},{x:a,y:t.laneY},{x:a,y:r},{x:o,y:r}])}function Ie(t){const d=t.fromNode.x+H+8,i=t.toNode.x-8,o=Math.abs(t.toNode.layer-t.fromNode.layer),r=Math.max(34,Math.abs(i-d));return o<=1?{x:(d+i)/2,y:t.laneY,maxWidth:Math.max(72,Math.min(108,r-34))}:{x:(d+i)/2,y:t.laneY,maxWidth:Math.max(84,Math.min(120,r*.3))}}function Pe({walkthroughs:t,repoRoot:d,onNavigate:i,fullscreen:o=!1,onToggleFullscreen:r}){const{t:g}=ce(),l=D.useId(),a=ve(t,d),h=D.useRef(new Map),x=D.useRef(new Map),[N,M]=D.useState({}),[w,E]=D.useState({}),[k,$]=D.useState(null),[G,Y]=D.useState(null),[O,W]=D.useState(null),[n,m]=D.useState(null),c=D.useMemo(()=>a?_e(a.nodes,a.edges,N,w):null,[N,w,a]);if(D.useLayoutEffect(()=>{if(!a)return;const e={};for(const p of a.nodes){const b=h.current.get(p.id);b&&(e[p.id]=b.offsetHeight)}M(p=>{const b=Object.keys(p),_=Object.keys(e);return b.length===_.length&&_.every(v=>p[v]===e[v])?p:e});const y={};for(const[p,b]of x.current)y[p]=b.offsetHeight;E(p=>{const b=Object.keys(p),_=Object.keys(y);return b.length===_.length&&_.every(v=>p[v]===y[v])?p:y})},[a]),!a||!c)return null;const u=`walkthrough-arrow-${l.replace(/[^a-zA-Z0-9_-]/g,"")||"default"}`,f=O??n,j=f?null:k??G,I=c.edges.some(e=>e.key===j)?j:null,S=c.edges.find(e=>e.key===I),A=f?c.edges.filter(e=>e.from===f||e.to===f):[],U=f?new Set(A.map(e=>e.key)):null,F=f?new Set([f,...A.flatMap(e=>[e.from,e.to])]):S?new Set([S.from,S.to]):null,K=new Map(a.sections.filter(e=>e.nodeId&&e.anchor).map(e=>[e.nodeId,e.anchor])),L=a.nodes.filter(e=>e.anchor??K.get(e.id)),R=L.findIndex(e=>e.id===n),V=e=>{if(L.length===0)return;const y=R<0?e<0?L.length-1:0:Math.min(L.length-1,Math.max(0,R+e)),p=L[y],b=p.anchor??K.get(p.id);b&&(m(p.id),Y(null),i(b))};return s.jsxs("section",{className:"mb-2 px-0 py-0",children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[s.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-primary/12 text-primary",children:s.jsx(de,{size:14})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"whitespace-normal break-words text-[12px] font-semibold leading-snug text-foreground",children:a.title}),a.summary&&s.jsx("div",{className:"mt-0.5 text-[10px] leading-snug text-muted-foreground",children:a.summary})]}),s.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[o&&L.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",onClick:()=>V(-1),disabled:R===0,className:"inline-flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition hover:bg-surface-2 hover:text-foreground active:scale-95 disabled:pointer-events-none disabled:opacity-30",title:"Previous change","aria-label":"Previous change",children:s.jsx(ye,{size:15})}),s.jsxs("span",{className:"min-w-8 text-center text-[10px] tabular-nums text-muted-foreground",children:[R<0?"—":R+1,"/",L.length]}),s.jsx("button",{type:"button",onClick:()=>V(1),disabled:R===L.length-1,className:"inline-flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition hover:bg-surface-2 hover:text-foreground active:scale-95 disabled:pointer-events-none disabled:opacity-30",title:"Next change","aria-label":"Next change",children:s.jsx(le,{size:15})})]}),r&&s.jsx("button",{type:"button",onClick:r,className:"inline-flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition hover:bg-surface-2 hover:text-foreground active:scale-95",title:o?"Exit full-screen DAG review":"Review from DAG in full screen","aria-label":o?"Exit full-screen DAG review":"Review from DAG in full screen",children:o?s.jsx(be,{size:15}):s.jsx(me,{size:15})})]})]}),a.highlights.length>0&&s.jsx("div",{className:"mt-2 grid gap-1.5",children:a.highlights.slice(0,4).map((e,y)=>s.jsxs("div",{className:"rounded-md bg-surface-2 px-2 py-1.5",children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[e.tag&&s.jsx("span",{className:"shrink-0 rounded bg-surface-elevated px-1.5 py-0.5 text-[9px] font-semibold text-primary",children:e.tag}),s.jsx("span",{className:"min-w-0 flex-1 whitespace-normal break-words text-[11px] font-semibold leading-snug text-foreground",children:e.what})]}),s.jsx("div",{className:"mt-0.5 text-[10px] leading-snug text-muted-foreground",children:e.effect})]},`${e.what}-${y}`))}),a.nodes.length>0&&s.jsxs("div",{className:"mt-2",children:[s.jsxs("div",{className:"mb-1 flex items-center justify-between gap-2 text-[10px] text-muted-foreground",children:[s.jsxs("div",{className:"flex items-center gap-1.5 font-semibold uppercase tracking-[0.12em]",children:[s.jsx(he,{size:11}),"DAG"]}),a.edges.some(e=>e.label?.trim())&&s.jsx("span",{className:"normal-case tracking-normal",children:g("diffViewer.focusPathHint")})]}),s.jsx("div",{className:"overflow-x-auto rounded-md border border-border/15 bg-surface-2 p-1.5",onWheel:e=>e.stopPropagation(),children:s.jsxs("div",{className:"relative",style:{width:c.width,height:c.height},children:[s.jsxs("svg",{className:"absolute inset-0",width:c.width,height:c.height,"aria-hidden":"true",children:[s.jsx("defs",{children:z.map((e,y)=>s.jsx("marker",{id:`${u}-${y}`,viewBox:"0 0 10 10",refX:"8.5",refY:"5",markerWidth:"5",markerHeight:"5",orient:"auto",markerUnits:"strokeWidth",children:s.jsx("path",{d:"M0,0 L10,5 L0,10 Z",fill:e})},e))}),c.edges.map(e=>{const y=De(e),p=te(e.index),b=I===e.key||!!U?.has(e.key),_=!!((I||f)&&!b);return s.jsxs("g",{className:"transition-opacity duration-150",style:{opacity:_?.3:1},children:[s.jsx("path",{className:"pointer-events-none",d:y,fill:"none",stroke:"var(--surface-2)",strokeWidth:b?7:5,strokeLinecap:"round"}),s.jsx("path",{className:"pointer-events-none transition-[stroke-width,opacity] duration-150",d:y,fill:"none",stroke:p,strokeWidth:b?3:1.8,strokeLinecap:"round",markerEnd:`url(#${u}-${e.index%z.length})`}),s.jsx("path",{"data-dag-edge":e.key,d:y,fill:"none",stroke:"transparent",strokeWidth:"14",className:"cursor-pointer",onPointerEnter:()=>$(e.key),onPointerLeave:()=>$(v=>v===e.key?null:v),onClick:()=>{m(null),Y(v=>v===e.key?null:e.key)}}),s.jsx("circle",{className:"pointer-events-none",cx:e.fromNode.x+H+8,cy:e.fromY,r:b?4:3,fill:p,stroke:"var(--surface-2)",strokeWidth:"2"}),s.jsx("circle",{className:"pointer-events-none",cx:e.toNode.x-8,cy:e.toY,r:b?4:3,fill:p,stroke:"var(--surface-2)",strokeWidth:"2"})]},e.key)})]}),c.edges.map(e=>{const y=e.label?.trim();if(!y)return null;const{x:p,y:b,maxWidth:_}=Ie(e),v=te(e.index),Z=I===e.key||!!U?.has(e.key),ie=!!((I||f)&&!Z);return s.jsxs("button",{ref:P=>{P?x.current.set(e.key,P):x.current.delete(e.key)},type:"button","data-dag-edge-label":e.key,className:"absolute -translate-x-1/2 -translate-y-1/2 whitespace-normal break-words rounded-md border bg-surface-elevated px-1.5 py-1 text-center text-[9px] leading-[11px] shadow-sm transition-[opacity,box-shadow,transform] duration-150 [overflow-wrap:anywhere] hover:shadow-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/60",style:{left:p,top:b,maxWidth:_,width:"max-content",borderColor:v,color:v,opacity:ie?.38:1,boxShadow:Z?`0 0 0 2px ${v}, 0 6px 18px rgb(0 0 0 / 0.24)`:void 0},title:`${e.fromNode.index+1} ${e.fromNode.node.title} → ${e.toNode.index+1} ${e.toNode.node.title}${e.desc?`
|
|
1
|
+
import{ae as re,d6 as ce,bv as s,e as le}from"./app-B6FdOF6K.js";import{b as D}from"./dnd-BCFAPC0L.js";import{S as de}from"./sparkles-Cg-yPdE2.js";import{M as me,G as he,L as ue,T as xe,C as fe}from"./triangle-alert-CbMRJ6sx.js";const pe=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],ye=re("chevron-left",pe);const ge=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],be=re("minimize-2",ge);function ve(t,d){return(d?t.filter(o=>o.repoRoot===d):t).slice().sort((o,r)=>r.injectedAt-o.injectedAt)[0]??null}function ke(t){switch(t){case"entry":case"source":return"bg-sky-400";case"ui":return"bg-fuchsia-400";case"risk":return"bg-destructive";case"test":return"bg-emerald-400";default:return"bg-primary"}}function Ne(t){if(!t)return;const d=typeof t.sectionIndex=="number"?` section ${t.sectionIndex+1}`:"",i=typeof t.hunkIndex=="number"?` hunk ${t.hunkIndex+1}`:"";return`${t.filePath}${i}${d}`}function Q({anchor:t,children:d,onNavigate:i,className:o,style:r,elementRef:g,onActivate:l}){return!t&&!l?s.jsx("span",{ref:g,className:o,style:r,children:d}):s.jsx("button",{ref:g,type:"button",onClick:()=>{l?.(),t&&i(t)},title:Ne(t),className:`${o} text-left transition hover:border-primary/35 hover:bg-primary/15 active:scale-[0.99]`,style:r,children:d})}const H=190,X=92,q=132,we=28,C=16,J=18,T=54,ee=24,ae=18,je=8,B=24,z=["rgb(var(--primary-rgb))","rgb(var(--accent-rgb))","rgb(var(--warning-rgb))","rgb(var(--success-rgb))","rgb(192 132 252)"];function te(t){return z[t%z.length]}function Me(t,d){return`${t.from}->${t.to}:${d}`}function Ee(t,d,i){const o=Math.max(d.get(t)?.length??0,i.get(t)?.length??0);return Math.max(X,36+Math.max(0,o-1)*ae)}function ne(t,d,i){if(i<=1)return t.y+t.height/2;const o=Math.max(0,t.height-36),r=Math.min(o,(i-1)*ae);return t.y+t.height/2-r/2+r/(i-1)*d}function se(t,d,i){return t.slice().sort((o,r)=>{const g=d[o],l=d[r],a=i==="from"?g.toNode:g.fromNode,h=i==="from"?l.toNode:l.fromNode;return a.y-h.y||a.index-h.index||g.index-l.index})}function $e(t,d){const i=new Map;for(const o of t){if(Math.abs(o.toNode.layer-o.fromNode.layer)!==1)continue;const r=`${o.fromNode.layer}:${o.toNode.layer}`,g=i.get(r)??[];g.push(o),i.set(r,g)}for(const o of i.values()){o.sort((h,x)=>(h.fromY+h.toY)/2-(x.fromY+x.toY)/2||h.index-x.index);const r=[];o.forEach((h,x)=>{const N=(h.fromY+h.toY)/2,M=Math.max(B,d[h.key]??0)/2;if(x===0){r.push(N);return}const w=o[x-1],E=Math.max(B,d[w.key]??0)/2;r.push(Math.max(N,r[x-1]+E+M+je))});const g=r.reduce((h,x,N)=>h+x-(o[N].fromY+o[N].toY)/2,0)/Math.max(1,r.length),l=Math.min(...r.map((h,x)=>h-g-Math.max(B,d[o[x].key]??0)/2)),a=Math.max(0,C-l);o.forEach((h,x)=>{h.laneY=r[x]-g+a})}}function _e(t,d,i={},o={}){const r=new Map(t.map((n,m)=>[n.id,{node:n,index:m}])),g=d.filter(n=>r.has(n.from)&&r.has(n.to)),l=new Map,a=new Map;for(const n of t)l.set(n.id,[]),a.set(n.id,[]);for(const n of g)l.get(n.to)?.push(n.from),a.get(n.from)?.push(n.to);const h=new Map,x=new Set,N=n=>{const m=h.get(n);if(m!==void 0)return m;if(x.has(n))return 0;x.add(n);const c=l.get(n)??[],u=c.length===0?0:Math.max(...c.map(N))+1;return x.delete(n),h.set(n,u),u};for(const n of t)N(n.id);const M=new Map;for(const n of t){const m=h.get(n.id)??0,c=M.get(m)??[],u=r.get(n.id);u&&c.push(u),M.set(m,c)}const w=[];for(const[n,m]of M.entries()){m.sort((u,f)=>u.index-f.index);let c=C+T;m.forEach(({node:u,index:f},j)=>{const I=Math.max(Ee(u.id,l,a),Math.ceil(i[u.id]??X));w.push({node:u,index:f,layer:n,row:j,x:C+n*(H+q),y:c,height:I}),c+=I+we})}const E=new Map(w.map(n=>[n.node.id,n])),k=g.flatMap((n,m)=>{const c=E.get(n.from),u=E.get(n.to);return!c||!u?[]:[{...n,key:Me(n,m),index:m,fromNode:c,toNode:u,routeIndex:m,fromPortIndex:0,toPortIndex:0,fromY:c.y+c.height/2,toY:u.y+u.height/2,laneY:(c.y+c.height/2+u.y+u.height/2)/2}]}),$=new Map,G=new Map;k.forEach((n,m)=>{$.set(n.from,[...$.get(n.from)??[],m]),G.set(n.to,[...G.get(n.to)??[],m])});for(const[n,m]of $){const c=se(m,k,"from");c.forEach((u,f)=>{const j=k[u];j.fromPortIndex=f,j.fromY=ne(E.get(n),f,c.length)})}for(const[n,m]of G){const c=se(m,k,"to");c.forEach((u,f)=>{const j=k[u];j.toPortIndex=f,j.toY=ne(E.get(n),f,c.length)})}$e(k,o);let Y=0;k.forEach(n=>{const m=Math.min(n.fromNode.layer,n.toNode.layer),c=Math.max(n.fromNode.layer,n.toNode.layer);if(c-m<=1)return;const f=Y;Y+=1,n.routeIndex=f;const j=w.filter(A=>A.layer>=m&&A.layer<=c),I=Math.min(...j.map(A=>A.y))-ee-(Math.floor(f/2)+1)*J,S=Math.max(...j.map(A=>A.y+A.height))+ee+(Math.floor(f/2)+1)*J;n.laneY=f%2===0?Math.max(C,I):S});const O=Math.max(0,...w.map(n=>n.layer)),W=Math.max(C+T+X,...w.map(n=>n.y+n.height),...k.map(n=>n.laneY+Math.max(B,o[n.key]??0)/2));return{nodes:w,edges:k,width:C*2+(O+1)*H+O*q,height:W+C+T}}function oe(t,d=12){const i=t[0];if(!i)return"";const o=[`M ${i.x} ${i.y}`];for(let r=1;r<t.length;r+=1){const g=t[r-1],l=t[r],a=t[r+1];if(!a){o.push(`L ${l.x} ${l.y}`);continue}const h=l.x-g.x,x=l.y-g.y,N=a.x-l.x,M=a.y-l.y,w=Math.abs(h)+Math.abs(x),E=Math.abs(N)+Math.abs(M);if(w===0||E===0||h&&N||x&&M){o.push(`L ${l.x} ${l.y}`);continue}const k=Math.min(d,w/2,E/2),$={x:l.x-Math.sign(h)*k,y:l.y-Math.sign(x)*k},G={x:l.x+Math.sign(N)*k,y:l.y+Math.sign(M)*k};o.push(`L ${$.x} ${$.y}`),o.push(`Q ${l.x} ${l.y} ${G.x} ${G.y}`)}return o.join(" ")}function De(t){const d=t.fromNode.x+H+8,i=t.fromY,o=t.toNode.x-8,r=t.toY,g=Math.abs(t.toNode.layer-t.fromNode.layer),l=d+22+t.fromPortIndex*5,a=o-22-t.toPortIndex*5;return g<=1?oe([{x:d,y:i},{x:l,y:i},{x:l,y:t.laneY},{x:a,y:t.laneY},{x:a,y:r},{x:o,y:r}]):oe([{x:d,y:i},{x:l,y:i},{x:l,y:t.laneY},{x:a,y:t.laneY},{x:a,y:r},{x:o,y:r}])}function Ie(t){const d=t.fromNode.x+H+8,i=t.toNode.x-8,o=Math.abs(t.toNode.layer-t.fromNode.layer),r=Math.max(34,Math.abs(i-d));return o<=1?{x:(d+i)/2,y:t.laneY,maxWidth:Math.max(72,Math.min(108,r-34))}:{x:(d+i)/2,y:t.laneY,maxWidth:Math.max(84,Math.min(120,r*.3))}}function Pe({walkthroughs:t,repoRoot:d,onNavigate:i,fullscreen:o=!1,onToggleFullscreen:r}){const{t:g}=ce(),l=D.useId(),a=ve(t,d),h=D.useRef(new Map),x=D.useRef(new Map),[N,M]=D.useState({}),[w,E]=D.useState({}),[k,$]=D.useState(null),[G,Y]=D.useState(null),[O,W]=D.useState(null),[n,m]=D.useState(null),c=D.useMemo(()=>a?_e(a.nodes,a.edges,N,w):null,[N,w,a]);if(D.useLayoutEffect(()=>{if(!a)return;const e={};for(const p of a.nodes){const b=h.current.get(p.id);b&&(e[p.id]=b.offsetHeight)}M(p=>{const b=Object.keys(p),_=Object.keys(e);return b.length===_.length&&_.every(v=>p[v]===e[v])?p:e});const y={};for(const[p,b]of x.current)y[p]=b.offsetHeight;E(p=>{const b=Object.keys(p),_=Object.keys(y);return b.length===_.length&&_.every(v=>p[v]===y[v])?p:y})},[a]),!a||!c)return null;const u=`walkthrough-arrow-${l.replace(/[^a-zA-Z0-9_-]/g,"")||"default"}`,f=O??n,j=f?null:k??G,I=c.edges.some(e=>e.key===j)?j:null,S=c.edges.find(e=>e.key===I),A=f?c.edges.filter(e=>e.from===f||e.to===f):[],U=f?new Set(A.map(e=>e.key)):null,F=f?new Set([f,...A.flatMap(e=>[e.from,e.to])]):S?new Set([S.from,S.to]):null,K=new Map(a.sections.filter(e=>e.nodeId&&e.anchor).map(e=>[e.nodeId,e.anchor])),L=a.nodes.filter(e=>e.anchor??K.get(e.id)),R=L.findIndex(e=>e.id===n),V=e=>{if(L.length===0)return;const y=R<0?e<0?L.length-1:0:Math.min(L.length-1,Math.max(0,R+e)),p=L[y],b=p.anchor??K.get(p.id);b&&(m(p.id),Y(null),i(b))};return s.jsxs("section",{className:"mb-2 px-0 py-0",children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[s.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-primary/12 text-primary",children:s.jsx(de,{size:14})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"whitespace-normal break-words text-[12px] font-semibold leading-snug text-foreground",children:a.title}),a.summary&&s.jsx("div",{className:"mt-0.5 text-[10px] leading-snug text-muted-foreground",children:a.summary})]}),s.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[o&&L.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",onClick:()=>V(-1),disabled:R===0,className:"inline-flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition hover:bg-surface-2 hover:text-foreground active:scale-95 disabled:pointer-events-none disabled:opacity-30",title:"Previous change","aria-label":"Previous change",children:s.jsx(ye,{size:15})}),s.jsxs("span",{className:"min-w-8 text-center text-[10px] tabular-nums text-muted-foreground",children:[R<0?"—":R+1,"/",L.length]}),s.jsx("button",{type:"button",onClick:()=>V(1),disabled:R===L.length-1,className:"inline-flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition hover:bg-surface-2 hover:text-foreground active:scale-95 disabled:pointer-events-none disabled:opacity-30",title:"Next change","aria-label":"Next change",children:s.jsx(le,{size:15})})]}),r&&s.jsx("button",{type:"button",onClick:r,className:"inline-flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition hover:bg-surface-2 hover:text-foreground active:scale-95",title:o?"Exit full-screen DAG review":"Review from DAG in full screen","aria-label":o?"Exit full-screen DAG review":"Review from DAG in full screen",children:o?s.jsx(be,{size:15}):s.jsx(me,{size:15})})]})]}),a.highlights.length>0&&s.jsx("div",{className:"mt-2 grid gap-1.5",children:a.highlights.slice(0,4).map((e,y)=>s.jsxs("div",{className:"rounded-md bg-surface-2 px-2 py-1.5",children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[e.tag&&s.jsx("span",{className:"shrink-0 rounded bg-surface-elevated px-1.5 py-0.5 text-[9px] font-semibold text-primary",children:e.tag}),s.jsx("span",{className:"min-w-0 flex-1 whitespace-normal break-words text-[11px] font-semibold leading-snug text-foreground",children:e.what})]}),s.jsx("div",{className:"mt-0.5 text-[10px] leading-snug text-muted-foreground",children:e.effect})]},`${e.what}-${y}`))}),a.nodes.length>0&&s.jsxs("div",{className:"mt-2",children:[s.jsxs("div",{className:"mb-1 flex items-center justify-between gap-2 text-[10px] text-muted-foreground",children:[s.jsxs("div",{className:"flex items-center gap-1.5 font-semibold uppercase tracking-[0.12em]",children:[s.jsx(he,{size:11}),"DAG"]}),a.edges.some(e=>e.label?.trim())&&s.jsx("span",{className:"normal-case tracking-normal",children:g("diffViewer.focusPathHint")})]}),s.jsx("div",{className:"overflow-x-auto rounded-md border border-border/15 bg-surface-2 p-1.5",onWheel:e=>e.stopPropagation(),children:s.jsxs("div",{className:"relative",style:{width:c.width,height:c.height},children:[s.jsxs("svg",{className:"absolute inset-0",width:c.width,height:c.height,"aria-hidden":"true",children:[s.jsx("defs",{children:z.map((e,y)=>s.jsx("marker",{id:`${u}-${y}`,viewBox:"0 0 10 10",refX:"8.5",refY:"5",markerWidth:"5",markerHeight:"5",orient:"auto",markerUnits:"strokeWidth",children:s.jsx("path",{d:"M0,0 L10,5 L0,10 Z",fill:e})},e))}),c.edges.map(e=>{const y=De(e),p=te(e.index),b=I===e.key||!!U?.has(e.key),_=!!((I||f)&&!b);return s.jsxs("g",{className:"transition-opacity duration-150",style:{opacity:_?.3:1},children:[s.jsx("path",{className:"pointer-events-none",d:y,fill:"none",stroke:"var(--surface-2)",strokeWidth:b?7:5,strokeLinecap:"round"}),s.jsx("path",{className:"pointer-events-none transition-[stroke-width,opacity] duration-150",d:y,fill:"none",stroke:p,strokeWidth:b?3:1.8,strokeLinecap:"round",markerEnd:`url(#${u}-${e.index%z.length})`}),s.jsx("path",{"data-dag-edge":e.key,d:y,fill:"none",stroke:"transparent",strokeWidth:"14",className:"cursor-pointer",onPointerEnter:()=>$(e.key),onPointerLeave:()=>$(v=>v===e.key?null:v),onClick:()=>{m(null),Y(v=>v===e.key?null:e.key)}}),s.jsx("circle",{className:"pointer-events-none",cx:e.fromNode.x+H+8,cy:e.fromY,r:b?4:3,fill:p,stroke:"var(--surface-2)",strokeWidth:"2"}),s.jsx("circle",{className:"pointer-events-none",cx:e.toNode.x-8,cy:e.toY,r:b?4:3,fill:p,stroke:"var(--surface-2)",strokeWidth:"2"})]},e.key)})]}),c.edges.map(e=>{const y=e.label?.trim();if(!y)return null;const{x:p,y:b,maxWidth:_}=Ie(e),v=te(e.index),Z=I===e.key||!!U?.has(e.key),ie=!!((I||f)&&!Z);return s.jsxs("button",{ref:P=>{P?x.current.set(e.key,P):x.current.delete(e.key)},type:"button","data-dag-edge-label":e.key,className:"absolute -translate-x-1/2 -translate-y-1/2 whitespace-normal break-words rounded-md border bg-surface-elevated px-1.5 py-1 text-center text-[9px] leading-[11px] shadow-sm transition-[opacity,box-shadow,transform] duration-150 [overflow-wrap:anywhere] hover:shadow-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/60",style:{left:p,top:b,maxWidth:_,width:"max-content",borderColor:v,color:v,opacity:ie?.38:1,boxShadow:Z?`0 0 0 2px ${v}, 0 6px 18px rgb(0 0 0 / 0.24)`:void 0},title:`${e.fromNode.index+1} ${e.fromNode.node.title} → ${e.toNode.index+1} ${e.toNode.node.title}${e.desc?`
|
|
2
2
|
${e.desc}`:""}`,"aria-pressed":G===e.key,onPointerEnter:()=>$(e.key),onPointerLeave:()=>$(P=>P===e.key?null:P),onClick:()=>{m(null),Y(P=>P===e.key?null:e.key)},children:[s.jsxs("span",{className:"block font-bold tabular-nums",children:[e.fromNode.index+1," → ",e.toNode.index+1]}),s.jsx("span",{className:"block text-muted-foreground",children:y})]},`${e.key}-label`)}),c.nodes.map(({node:e,index:y,x:p,y:b,height:_})=>s.jsxs(Q,{elementRef:v=>{v?h.current.set(e.id,v):h.current.delete(e.id)},anchor:e.anchor??K.get(e.id),onActivate:()=>{m(e.id),Y(null)},onNavigate:i,className:`absolute overflow-hidden rounded-lg border bg-surface/95 px-2.5 py-2 text-foreground shadow-[0_10px_24px_rgba(0,0,0,0.18)] transition-[opacity,border-color,box-shadow] duration-150 ${F?.has(e.id)?"border-primary/60 shadow-[0_0_0_1px_rgb(var(--primary-rgb)/0.28),0_10px_24px_rgba(0,0,0,0.22)]":F?"border-border/15 opacity-40":"border-border/25"}`,style:{left:p,top:b,width:H,minHeight:_},children:[s.jsx("span",{className:"absolute inset-0",onPointerEnter:()=>W(e.id),onPointerLeave:()=>W(v=>v===e.id?null:v)}),s.jsx("span",{className:`pointer-events-none absolute bottom-2 left-0 top-2 w-[3px] rounded-r-full ${ke(e.kind)}`}),s.jsxs("div",{className:"pointer-events-none relative flex min-w-0 items-center gap-1.5",children:[s.jsx("span",{className:"flex h-4 w-4 shrink-0 items-center justify-center rounded-full bg-primary/15 text-[9px] font-bold text-primary",children:y+1}),s.jsx("span",{className:"min-w-0 flex-1 whitespace-normal break-words text-[11px] font-semibold leading-snug text-foreground",children:e.title}),e.anchor&&s.jsx(ue,{size:11,className:"shrink-0 opacity-70"})]}),e.kind&&s.jsx("div",{className:"pointer-events-none relative mt-0.5 truncate text-[9px] font-semibold uppercase tracking-[0.08em] text-muted-foreground/80",children:e.kind}),s.jsx("div",{className:"pointer-events-none relative mt-0.5 whitespace-normal break-words text-[10px] leading-snug text-muted-foreground",children:e.business})]},e.id))]})})]}),(a.risks.length>0||a.checks.length>0)&&s.jsxs("div",{className:"mt-2 grid gap-1.5",children:[a.risks.slice(0,3).map((e,y)=>s.jsxs(Q,{anchor:e.anchor,onNavigate:i,className:"flex w-full items-start gap-1.5 rounded-md border border-[rgb(var(--warning-rgb)_/_0.25)] bg-[rgb(var(--warning-rgb)_/_0.10)] px-2 py-1.5 text-[10px] text-muted-foreground",children:[s.jsx(xe,{size:12,className:"mt-0.5 shrink-0 text-[color:var(--warning)]"}),s.jsx("span",{className:"min-w-0 whitespace-normal break-words leading-snug",children:e.title})]},`${e.title}-${y}`)),a.checks.slice(0,3).map((e,y)=>s.jsxs("div",{className:"flex items-start gap-1.5 rounded-md bg-surface-2 px-2 py-1.5 text-[10px] text-muted-foreground",children:[s.jsx(fe,{size:12,className:"mt-0.5 shrink-0 text-primary"}),s.jsx("span",{className:"min-w-0 whitespace-normal break-words leading-snug",children:e})]},`${e}-${y}`))]})]})}export{Pe as C,be as M,ye as a};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d5 as Y,bA as Z,az as F,a_ as H,cQ as J,S as C,bv as e,T as X,bj as L}from"./app-
|
|
1
|
+
import{d5 as Y,bA as Z,az as F,a_ as H,cQ as J,S as C,bv as e,T as X,bj as L}from"./app-B6FdOF6K.js";import{b as s}from"./dnd-BCFAPC0L.js";import{a5 as r,Z as I,P as ee,W as te,q as se,R as S,i as ne,$ as ae,a0 as re}from"./App-ggIA_xqR.js";import"./react-XDCjal2T.js";import"./terminal-C7X98Amf.js";import"./gestureArbiter-JW8vcVRm.js";import"./triangle-alert-CbMRJ6sx.js";import"./referenceLongPress-bZ0xp-v2.js";function xe({groupId:m,activeSessionId:n,onOpenSidebar:h,leftSidebarVisible:R=!1,onToggleRightSidebar:b,rightSidebarOpen:g=!1,defaultSessionMode:T}){const j=s.useRef(null);s.useEffect(()=>{j.current?.focus()},[]);const[i,v]=s.useState(null),[z,D]=s.useState([]),[u,x]=s.useState(null),[y,P]=s.useState(null),[p,$]=s.useState(null),[G,A]=s.useState(null),o=Y(),[W,w]=s.useState(!1);s.useEffect(()=>{if(o==="ready"){w(!1);return}const t=setTimeout(()=>w(!0),1e3);return()=>clearTimeout(t)},[o]);const M=r(t=>t.view),V=r(t=>t.drafts),N=r(t=>t.setDraft),[_,q]=s.useState(m),l=s.useCallback(async()=>{try{const t=await Z();v(t),x(null)}catch(t){x(t instanceof Error?t.message:"协作组加载失败")}},[]);s.useEffect(()=>{let t=!1;F().then(c=>{t||D(c)}).catch(()=>{}),H().then(c=>{if(t)return;const Q=c.collaborationPanels?.[I()]?.drafts;for(const[k,U]of Object.entries(Q??{}))r.getState().drafts[k]||N(k,U)}).catch(()=>{});const K=J(c=>{t||(v(c),x(null))});l();const a=()=>{!document.hidden&&navigator.onLine!==!1&&l()},O=setInterval(a,1e4);return document.addEventListener("visibilitychange",a),window.addEventListener(C,a),window.addEventListener("pageshow",a),()=>{t=!0,K(),clearInterval(O),document.removeEventListener("visibilitychange",a),window.removeEventListener(C,a),window.removeEventListener("pageshow",a)}},[l]);const d=i?.groups.find(t=>t.id===m),f=i?.sessions.find(t=>t.sessionId===n),B=n?f?.name?`终端 · ${f.name}`:"继续终端会话":"选择终端",E=async t=>{await re(t),r.getState().terminal()};return e.jsxs("section",{"aria-label":"协作主工作区",className:"absolute inset-0 flex min-h-0 min-w-0 flex-col bg-[var(--chrome-bg)] text-foreground",children:[e.jsxs("header",{className:"flex min-h-14 shrink-0 items-center gap-1 border-b border-border/15 px-2 sm:min-h-16 sm:gap-3 sm:px-6",children:[!R&&e.jsx("button",{type:"button","aria-label":"打开会话侧栏",className:"inline-flex min-h-11 min-w-11 items-center justify-center rounded-lg text-muted-foreground hover:bg-surface-2",onClick:h,children:e.jsx(ee,{size:17})}),e.jsx(te,{size:18,className:"hidden shrink-0 text-primary sm:block"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h2",{ref:j,tabIndex:-1,className:"truncate text-base font-semibold outline-none",children:d?.name??"协作工作区"}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:d?`${d.sessionIds.length} 位成员`:"正在连接工作组"})]}),b&&e.jsx("button",{type:"button","aria-label":"文件侧栏",title:"文件侧栏","aria-pressed":g,className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded-lg ${g?"bg-surface-2 text-primary":"text-muted-foreground hover:bg-surface-2"}`,onClick:b,children:e.jsx(se,{size:17})}),e.jsxs("button",{type:"button","aria-label":n?`打开终端:${f?.name??"当前会话"}`:"选择终端",title:n?`切换到${f?.name??"当前终端会话"},保留看板位置与消息草稿`:"从会话列表选择要打开的终端",className:"inline-flex min-h-11 min-w-11 max-w-[40%] items-center justify-center gap-2 rounded-lg px-2 text-xs text-muted-foreground hover:bg-surface-2",onClick:()=>{n?r.getState().terminal():h()},children:[e.jsx(X,{size:17,className:"shrink-0"}),e.jsx("span",{className:"hidden min-w-0 truncate sm:inline",children:B}),e.jsx("span",{className:"sm:hidden",children:n?"终端":"选择终端"})]})]}),e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col px-4 py-2 sm:px-6",children:[(W||L(u))&&e.jsxs("div",{role:"status",className:"mb-2 flex shrink-0 items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(S,{size:13,className:o==="offline"?"":"animate-spin"}),e.jsx("span",{children:o==="offline"?"网络已断开,联网后自动恢复":"正在恢复连接,当前结果和草稿已保留"})]}),(y||u&&o==="ready"&&!L(u))&&e.jsxs("div",{role:"alert",className:"mb-3 flex shrink-0 items-center gap-2 rounded-lg bg-destructive/10 p-3 text-xs text-destructive",children:[e.jsx("span",{className:"flex-1",children:y||u}),e.jsx("button",{type:"button","aria-label":"重新加载协作组",className:"min-h-11 px-3",onClick:()=>{l()},children:e.jsx(S,{size:14})})]}),p&&e.jsx("p",{role:"status",className:"mb-3 shrink-0 text-xs text-primary",children:p}),i?d?e.jsx(ne,{fullWorkspace:!0,initialView:M,active:!0,notice:p,groups:i.groups,sessions:i.sessions,agents:z,sessionsState:"loaded",selectedGroupId:_,setSelectedGroupId:q,initialGroupId:m,activeSessionId:n,initialDrafts:V,onDraftChange:N,docked:!1,inputKeySuffix:"main",floatingVisible:!0,floating:!1,onOpenSession:E,onOpenTaskSession:E,onDockMessages:n?async()=>{await ae(m,n)}:void 0,defaultSessionMode:T,busy:G,setBusy:A,setError:P,setNotice:$,refresh:l}):e.jsx("p",{className:"py-10 text-center text-sm text-muted-foreground",children:"协作组已移除或暂不可用。任务记录仍保留在原服务中。"}):e.jsx("p",{role:"status",className:"py-10 text-center text-sm text-muted-foreground",children:"正在加载协作工作区…"})]})]})}export{xe as default};
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{bv as r}from"./app-B6FdOF6K.js";import{b as m}from"./dnd-BCFAPC0L.js";import{b as n}from"./RightSidebar-BoNzpS2K.js";import"./react-XDCjal2T.js";import"./terminal-C7X98Amf.js";import"./App-ggIA_xqR.js";import"./gestureArbiter-JW8vcVRm.js";import"./triangle-alert-CbMRJ6sx.js";import"./referenceLongPress-bZ0xp-v2.js";import"./DiffReview-BBBC_NjV.js";import"./sparkles-Cg-yPdE2.js";import"./DiffViewer-BuQwFQ4V.js";import"./ChangeWalkthroughPanel-D1Puc7B3.js";function v({content:o}){const e=m.useMemo(()=>n(o.split(`
|
|
2
|
+
`),null,null),[o]);return r.jsx("div",{className:"min-w-0 space-y-3 break-words text-sm leading-6 text-foreground [&_h1]:text-lg [&_h2]:text-base [&_h3]:text-sm [&_pre]:max-w-full [&_table]:text-xs",children:e.map((t,i)=>r.jsx("div",{className:"min-w-0",children:typeof t.content=="function"?t.content(null):t.content},i))})}export{v as default};
|
package/dist/client/assets/{ComputerControlView-C2sOFyuA.js → ComputerControlView-D5Lw9sNA.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/rdpSession-
|
|
2
|
-
import{ae as Me,ct as lt,d6 as et,bv as t,cq as Ce,bu as _e,W as Xe,o as We,l as ut,X as dt,_ as qe}from"./app-CXvK8WZg.js";import{b as o,r as mt}from"./dnd-BCFAPC0L.js";import{a as pt}from"./ChangeWalkthroughPanel-DOj40Srm.js";import{L as Ge}from"./RightSidebar-CnnU7Ffp.js";import{U as Je,K as ft,g as ht}from"./App-cagV-flM.js";import{M as xt}from"./triangle-alert-BFCgLlxS.js";const gt=[["path",{d:"M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z",key:"edeuup"}]],Qe=Me("mouse-pointer-2",gt);const bt=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],yt=Me("settings-2",bt);const vt=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],wt=Me("zoom-in",vt);function Ie(e){const s=e==="darwin"?"mac":e==="win32"?"windows":"linux",m={host:"127.0.0.1",platform:s,protocol:s==="mac"?"vnc":"rdp",port:"3389",username:"",domain:"",ignoreCert:!1,rememberLogin:!0};return{target:"local",local:m,remote:{...m,host:""},viewOnly:!1,fit:!0,autoConnect:!0}}function Ze(e,s){const m=Ie(s);if(!e||typeof e!="object")return m;const i=e,h=(c,x)=>{const l=c&&typeof c=="object"?c:{},R=(d,V)=>typeof l[d]=="string"&&l[d].length<=V&&!/[\x00-\x1f]/.test(l[d])?l[d]:x[d];return{host:R("host",253),username:R("username",255),domain:R("domain",255),platform:["mac","linux","windows"].includes(String(l.platform))?l.platform:x.platform,protocol:l.protocol==="rdp"||l.protocol==="vnc"?l.protocol:x.protocol,port:typeof l.port=="string"&&/^\d{0,5}$/.test(l.port)&&Number(l.port)<=65535?l.port:x.port,ignoreCert:l.ignoreCert===!0,rememberLogin:l.rememberLogin!==!1}};return{target:i.target==="remote"?"remote":"local",local:{...h(i.local,m.local),host:"127.0.0.1"},remote:h(i.remote,m.remote),viewOnly:i.viewOnly===!0,fit:i.fit!==!1,autoConnect:i.autoConnect!==!1}}function tt(e){return JSON.stringify([e.host.trim().toLowerCase(),e.protocol,e.protocol==="vnc"?5900:Number(e.port),e.username.trim(),e.domain.trim()])}function Ct(e){const[s,m]=o.useState(Ie),[i,h]=o.useState(!1),[c,x]=o.useState("loading"),[l,R]=o.useState(0),[d,V]=o.useState([]),[H,D]=o.useState("idle"),P=o.useRef(s),z=o.useRef(0),w=o.useRef(0),U=o.useRef(""),C=o.useRef(null),j=o.useRef(new Set),Y=o.useCallback(y=>{P.current=y(P.current),z.current++,m(P.current),x("saving")},[]);o.useEffect(()=>{const y=++w.current;z.current=0,U.current="",C.current=null,P.current=Ie(),m(P.current),h(!1),x("loading"),V([]),D("idle");const N=new AbortController;return fetch("/api/computer/preferences",{signal:N.signal}).then(async p=>{if(!p.ok)throw new Error("PREFERENCES_LOAD_FAILED");return await p.json()}).then(p=>{if(y!==w.current||N.signal.aborted)return;let E=Ze(p.preferences);const I=z.current>0;if(!p.configured&&!I)try{const L=localStorage.getItem(`termdock:computer-host:${e}`);if(L){const B=/^(127\.0\.0\.1|localhost|::1|\[::1\])$/i.test(L)?"local":"remote";E=Ze({...E,target:B,[B]:{...E[B],host:L,platform:localStorage.getItem(`termdock:computer-platform:${e}`)||E[B].platform,protocol:localStorage.getItem(`termdock:computer-protocol:${e}`)||"vnc",port:localStorage.getItem(`termdock:computer-rdp-port:${e}`)||"3389"}}),z.current++}}catch{}I||(P.current=E),U.current=p.configured?JSON.stringify(E):"",m(P.current),h(!0),x(p.configured?"saved":"saving"),V(Array.isArray(p.credentialKeys)?p.credentialKeys.filter(L=>typeof L=="string"):[]),D(p.credentialError?"error":"idle")}).catch(()=>{!N.signal.aborted&&y===w.current&&x("error")}),()=>{++w.current,N.abort();for(const p of j.current)p.abort();j.current.clear()}},[e,l]);const O=o.useCallback(()=>{if(C.current)return C.current;if(!i)return Promise.resolve(!1);const y=w.current,N=(async()=>{for(;U.current!==JSON.stringify(P.current);){const p=JSON.stringify(P.current),E=new AbortController;j.current.add(E),x("saving");try{if(!(await fetch("/api/computer/preferences",{method:"PUT",headers:{"Content-Type":"application/json"},body:p,signal:E.signal})).ok)throw new Error("PREFERENCES_SAVE_FAILED");if(y!==w.current)return!1;U.current=p}catch{return y===w.current&&x("error"),!1}finally{j.current.delete(E)}}return y===w.current&&x("saved"),!0})();return C.current=N,N.finally(()=>{C.current===N&&(C.current=null)}),N},[i]);o.useEffect(()=>{if(!i||U.current===JSON.stringify(s))return;const y=setTimeout(()=>{O()},300);return()=>clearTimeout(y)},[i,s,O]);const ee=o.useCallback(async(y,N,p)=>{const E=w.current,I=new AbortController;y!=="use"&&D("saving");try{if(!await O()||E!==w.current)throw new Error("COMPUTER_CREDENTIALS_FAILED");j.current.add(I);const L=await fetch(`/api/computer/credentials/${y}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({profile:N,...y==="save"?{password:p}:{}}),signal:I.signal});if(E!==w.current)throw new Error("COMPUTER_CREDENTIALS_FAILED");if(!L.ok)throw new Error(y==="use"&&L.status===404?"COMPUTER_CREDENTIALS_MISSING":"COMPUTER_CREDENTIALS_FAILED");const X=await L.json();if(E!==w.current)throw new Error("COMPUTER_CREDENTIALS_FAILED");const B=tt(N);if(y==="save"&&V(ne=>[...new Set([...ne,B])]),y==="forget"&&V(ne=>ne.filter(xe=>xe!==B)),y==="use"&&(typeof X.password!="string"||!X.password))throw new Error("COMPUTER_CREDENTIALS_MISSING");return D("idle"),X.password}catch(L){throw E===w.current&&!I.signal.aborted&&D("error"),L}finally{j.current.delete(I)}},[O]);return{preferences:s,change:Y,loaded:i,saveState:c,flush:O,credentialKeys:d,loginState:H,credentialRequest:ee,retry:()=>i?void O():R(y=>y+1)}}class jt{binaryType="arraybuffer";protocol="";CONNECTING=0;OPEN=1;CLOSING=2;CLOSED=3;onopen=null;onmessage=null;onerror=null;onclose=null;socket;get readyState(){return this.socket.readyState}constructor(s,m){this.socket=lt(`/api/computer/ws?host=${encodeURIComponent(s)}`),this.socket.onopen=i=>this.onopen?.(i),this.socket.onerror=i=>this.onerror?.(i),this.socket.onclose=i=>{(i.code!==1e3||i.reason)&&m(i.reason||"COMPUTER_DISCONNECTED"),this.onclose?.(i)},this.socket.onmessage=i=>{try{const h=JSON.parse(i.data);if(h.type!=="data"||typeof h.data!="string"||!Number.isSafeInteger(h.seq))throw new Error("Invalid VNC record");const c=Uint8Array.from(atob(h.data),x=>x.charCodeAt(0));this.onmessage?.(new MessageEvent("message",{data:c.buffer})),this.socket.readyState===1&&this.socket.send(JSON.stringify({type:"ack",seq:h.seq}))}catch{m("COMPUTER_INVALID_MESSAGE"),this.close(),this.onclose?.(new CloseEvent("close",{code:4400}))}}}send(s){const m=ArrayBuffer.isView(s)?new Uint8Array(s.buffer,s.byteOffset,s.byteLength):new Uint8Array(s);for(let i=0;i<m.length;i+=32*1024){const h=m.subarray(i,i+32768);let c="";for(const x of h)c+=String.fromCharCode(x);this.socket.send(JSON.stringify({type:"data",data:btoa(c)}))}}close(){this.socket.close()}}function Nt(e){return e==="mac"||e==="linux"||e==="windows"}function Et(e){const s=e==="mac"?[65513,"MetaLeft"]:[65507,"ControlLeft"],m=e==="mac"?s:[65515,"MetaLeft"];return{escape:[[65307,"Escape"]],enter:[[65293,"Enter"]],backspace:[[65288,"Backspace"]],tab:[e==="mac"?s:[65513,"AltLeft"],[65289,"Tab"]],search:e==="mac"?[m,[32,"Space"]]:[m],copy:[s,[99,"KeyC"]],paste:[s,[118,"KeyV"]],up:[[65362,"ArrowUp"]],down:[[65364,"ArrowDown"]],left:[[65361,"ArrowLeft"]],right:[[65363,"ArrowRight"]]}}function kt(e){const s=e;return{size:()=>({width:s._fbWidth,height:s._fbHeight}),surface:()=>s._canvas,send:(m,i,h)=>{const c=s._display.scale,x=(m-s._display.absX(0))*c,l=(i-s._display.absY(0))*c;s._mousePos={x,y:l},s._mouseMoveTimer!==null&&clearTimeout(s._mouseMoveTimer),s._mouseMoveTimer=null,s._mouseButtonMask=h,s._mouseLastMoveTime=Date.now(),s._sendMouse(x,l,h)}}}const rt="termdock:computer-touch-mode:v1";function St(){try{const e=localStorage.getItem(rt);if(e==="trackpad"||e==="direct")return e}catch{}return navigator.maxTouchPoints>0&&window.matchMedia("(any-pointer: coarse)").matches?"trackpad":"direct"}function Lt(e){try{localStorage.setItem(rt,e)}catch{}}const Tt=8,At=300,_t=450,Re=18,je=(e,s)=>Math.max(0,Math.min(e,Math.max(0,s-1)));function Rt(e,s,m,i){const h=new AbortController,c=new Map;let x=0,l=0,R=!1,d=!1,V=!1,H=0,D=0,P,z=!1,w=!0,U=!0,C,j=!1;const Y=()=>{const n=s.size(),a=i.current??={x:n.width/2,y:n.height/2};return a.x=je(a.x,n.width),a.y=je(a.y,n.height),a};let O;const ee=()=>{const n=s.size();if((!O||O.width!==n.width||O.height!==n.height)&&(U=!0),!U&&O)return O;const a=s.surface(),g=e.getBoundingClientRect(),k=a.getBoundingClientRect(),b=[];for(let f=a.parentElement;f&&f!==e;f=f.parentElement){const K=getComputedStyle(f),T=/auto|scroll/.test(K.overflowX)?Math.max(0,f.scrollWidth-f.clientWidth):0,te=/auto|scroll/.test(K.overflowY)?Math.max(0,f.scrollHeight-f.clientHeight):0;if(!T&&!te)continue;const v=f.getBoundingClientRect();b.push({element:f,left:v.left-g.left,top:v.top-g.top,right:v.right-g.left,bottom:v.bottom-g.top,maxX:T,maxY:te})}return O={...n,left:k.left-g.left,top:k.top-g.top,scaleX:n.width&&k.width?k.width/n.width:1,scaleY:n.height&&k.height?k.height/n.height:1,viewportWidth:g.width,viewportHeight:g.height,clientLeft:g.left,clientTop:g.top,scrollers:b},U=!1,O},y=()=>{const n=ee(),a=Y();if(!n.width||!n.height||!w){m.hidden=!0;return}let g=n.left+a.x*n.scaleX,k=n.top+a.y*n.scaleY;for(const b of n.scrollers){if(b.maxX){const f=b.element.scrollLeft,K=g<b.left+20?g-b.left-20:g>b.right-20?g-b.right+20:0,T=Math.max(0,Math.min(b.maxX,f+K));f!==T&&(b.element.scrollLeft=T,g-=T-f,n.left-=T-f)}if(b.maxY){const f=b.element.scrollTop,K=k<b.top+20?k-b.top-20:k>b.bottom-20?k-b.bottom+20:0,T=Math.max(0,Math.min(b.maxY,f+K));f!==T&&(b.element.scrollTop=T,k-=T-f,n.top-=T-f)}}m.hidden=g<0||k<0||g>=n.viewportWidth||k>=n.viewportHeight,m.style.transform=`translate3d(${g}px, ${k}px, 0)`},N=(n=D)=>{const a=Y();s.send(Math.round(a.x),Math.round(a.y),n)},p=()=>{P=void 0,y(),z&&(z=!1,N());let n=0;for(;Math.abs(H)>=Re&&n++<8;){const a=H>0?16:8;N(a),N(0),H-=Math.sign(H)*Re}},E=()=>{j||(P??=requestAnimationFrame(p))},I=()=>{P!==void 0&&(cancelAnimationFrame(P),p())},L=()=>{clearTimeout(C),I(),D&&(D=0,N())},X=n=>{n.cancelable&&n.preventDefault(),n.stopImmediatePropagation()},B=()=>[...c.values()].reduce((n,a)=>n+a.y,0)/c.size,ne=n=>{if(!(n.pointerType!=="touch"&&n.pointerType!=="pen")){X(n),w=!0,E(),c.size||(x=performance.now(),l=0,R=!1,d=!1,V=!1,H=0),c.set(n.pointerId,{x:n.clientX,y:n.clientY,startX:n.clientX,startY:n.clientY}),l=Math.max(l,c.size);try{e.setPointerCapture(n.pointerId)}catch{}clearTimeout(C),c.size===1&&l===1?C=setTimeout(()=>{!j&&c.size===1&&!R&&!d&&(D=1,N())},_t):(L(),V=!0)}},xe=n=>{if(n.pointerType==="mouse"){const f=ee();i.current={x:je((n.clientX-f.clientLeft-f.left)/f.scaleX,f.width),y:je((n.clientY-f.clientTop-f.top)/f.scaleY,f.height)},w=!1,m.hidden=!0;return}const a=c.get(n.pointerId);if(!a)return;X(n);const g=B(),k=n.clientX-a.x,b=n.clientY-a.y;if(a.x=n.clientX,a.y=n.clientY,Math.hypot(a.x-a.startX,a.y-a.startY)>Tt&&(R=!0,clearTimeout(C)),c.size===2&&!d)H+=g-B(),Math.abs(H)>=Re&&(R=!0,E());else if(c.size===1&&!V&&!d){const f=Y(),K=O??ee();f.x+=k/K.scaleX,f.y+=b/K.scaleY,Y(),z=!0,E()}},me=n=>{if(!c.has(n.pointerId))return;X(n);const a=D!==0;n.type!=="pointerup"&&(d=!0),L(),c.delete(n.pointerId);try{e.hasPointerCapture(n.pointerId)&&e.releasePointerCapture(n.pointerId)}catch{}c.size||(H=0,!d&&!a&&!R&&l<=2&&performance.now()-x<=At&&(N(l===2?4:1),N(0)))},pe=()=>{d=!0,L();const n=[...c.keys()];c.clear(),H=0;for(const a of n)try{e.hasPointerCapture(a)&&e.releasePointerCapture(a)}catch{}},W={capture:!0,passive:!1,signal:h.signal};e.addEventListener("pointerdown",ne,W),e.addEventListener("pointermove",xe,W),e.addEventListener("pointerup",me,W),e.addEventListener("pointercancel",me,W),e.addEventListener("lostpointercapture",me,W);for(const n of["touchstart","touchmove","touchend","touchcancel","contextmenu"])e.addEventListener(n,X,W);const oe=()=>{U=!0,E()};e.addEventListener("scroll",oe,{capture:!0,signal:h.signal}),window.addEventListener("blur",pe,{signal:h.signal});const ge=()=>{document.hidden&&pe()};document.addEventListener("visibilitychange",ge,{signal:h.signal});const q=new ResizeObserver(oe);return q.observe(e),q.observe(s.surface()),y(),()=>{j||(j=!0,h.abort(),pe(),q.disconnect(),m.hidden=!0)}}function It(e,s){e=Math.max(1,e||1280),s=Math.max(1,s||800);const m=Math.max(1,640/e,480/s);return{width:Math.max(640,Math.min(2560,Math.round(e*m))),height:Math.max(480,Math.min(1600,Math.round(s*m)))}}function Mt({sendText:e,sendKey:s}){const{t:m}=et(),i=o.useRef(null),h=o.useRef(!1),c=o.useRef(null),[x,l]=o.useState(""),R=()=>{const d=i.current?.value||"";d&&e(d),i.current&&(i.current.value=""),l("")};return o.useEffect(()=>(i.current?.focus({preventScroll:!0}),()=>{c.current!==null&&cancelAnimationFrame(c.current)}),[]),t.jsx("input",{ref:i,tabIndex:-1,className:"pointer-events-none absolute left-0 top-0 h-px w-px border-0 p-0 text-base opacity-0","aria-label":m("computer.keyboardInput"),autoCapitalize:"none",autoCorrect:"off",autoComplete:"off",spellCheck:!1,maxLength:1024,value:x,onChange:d=>{l(d.target.value),!h.current&&c.current===null&&R()},onCompositionStart:()=>{h.current=!0},onCompositionEnd:()=>{h.current=!1,c.current!==null&&cancelAnimationFrame(c.current),c.current=requestAnimationFrame(()=>{c.current=null,R()})},onKeyDown:d=>{h.current||d.nativeEvent.isComposing||c.current!==null||(d.key==="Enter"||d.key==="Backspace"&&!d.currentTarget.value)&&(d.preventDefault(),s(d.key==="Enter"?"enter":"backspace"))}})}function Pt(e){let s=[],m=null;const i=new Map,h=()=>{m=null,s.splice(0,32).forEach(c=>{e(c),c[2]?i.set(c[0],c):i.delete(c[0])}),s.length&&(m=requestAnimationFrame(h))};return{send(c){s.push(...c),m===null&&h()},clear(){m!==null&&cancelAnimationFrame(m),m=null,s=[];const c=[...i.values()].reverse();i.clear();for(const[x,l]of c)try{e([x,l,!1])}catch{}}}}const ae="inline-flex min-h-9 items-center justify-center gap-1.5 rounded-md border border-border px-2.5 text-xs hover:bg-surface-2 disabled:opacity-40",ie="min-h-11 w-full rounded-md border border-border bg-background px-2 text-sm outline-none focus:border-primary";function Ne(e){return/API_NOT_ALLOWED|AUTHORIZATION|revoked|PAIRING/.test(e)?"computer.permission":e.includes("RDP_BACKEND_UNAVAILABLE")?"computer.rdpBackendUnavailable":e.includes("RDP_CERTIFICATE")?"computer.rdpCertificate":e.includes("CREDENTIALS_MISSING")?"computer.loginExpired":e.includes("CREDENTIALS_FAILED")?"computer.loginSaveFailed":e.includes("AUTH_FAILED")?"computer.authFailed":e.includes("RDP_FAILED")?"computer.rdpFailed":e.includes("SCREEN_SHARING_OFF")?"computer.sharingOff":e.includes("PRIVATE_HOST_ONLY")?"computer.privateOnly":e.includes("INVALID_HOST")?"computer.invalidHost":e.includes("TIMEOUT")?"computer.timeout":e.includes("UNREACHABLE")?"computer.unreachable":e.includes("DISCONNECTED")?"computer.disconnected":"computer.failed"}function Dt(){const{t:e}=et(),[s,m]=o.useState(()=>Ce()?.targetPeerId??""),[i,h]=o.useState(null),{preferences:c,change:x,loaded:l,saveState:R,flush:d,retry:V,credentialKeys:H,loginState:D,credentialRequest:P}=Ct(s),z=c.target==="local",w=c[c.target],{host:U,platform:C,protocol:j,port:Y,domain:O,ignoreCert:ee,username:y}=w,N=j==="rdp"&&i?.rdpAvailable===!1,{viewOnly:p,fit:E}=c,I=w.rememberLogin&&H.includes(tt(w)),L=r=>x(u=>({...u,[u.target]:{...u[u.target],...r}})),X=r=>L({username:r}),B=r=>L({domain:r}),ne=r=>{L({ignoreCert:r}),d()},xe=r=>L({port:r}),me=r=>{r&&(le.current(),ye.clear(),G(null)),x(u=>({...u,viewOnly:r})),d()},[pe,W]=o.useState(!1),oe=Et(C),ge=C==="mac"?"⌘V":"Ctrl+V",[q,n]=o.useState(""),[a,g]=o.useState("idle"),[k,b]=o.useState(null),[f,K]=o.useState(""),[T,te]=o.useState(!1),[v,G]=o.useState(null),Ee=o.useRef(null),[we,Pe]=o.useState(""),[nt,be]=o.useState(!1),[ot,st]=o.useState(!1),[J,ct]=o.useState(St),De=o.useRef(null),Oe=o.useRef(null),le=o.useRef(()=>{}),[ze,at]=o.useState(_e),fe=o.useRef(!1),se=o.useRef(""),Fe=o.useRef(()=>{}),Ue=o.useRef(null),ke=o.useRef(null),ue=o.useMemo(()=>{const r=document.createElement("div");return r.className="h-full w-full min-h-0 overflow-hidden",r},[]),_=o.useRef(null),ye=o.useMemo(()=>Pt(([r,u,S])=>_.current?.sendKey(r,u,S)),[]),Se=o.useRef(null),re=o.useRef(0),Le=o.useRef(void 0),Q=o.useCallback(()=>{le.current(),ye.clear(),Oe.current=null,re.current++,clearTimeout(Le.current);const r=_.current;_.current=null,r?.disconnect(),Se.current?.close(),Se.current=null,ue.replaceChildren()},[ue,ye]);o.useLayoutEffect(()=>(ke.current?.appendChild(ue),()=>{ue.remove()}),[ue,T]),o.useEffect(()=>()=>Q(),[Q]),o.useEffect(()=>{const r=()=>{const u=_e();at(u),!u&&(fe.current=!1,se.current="",Q(),g("idle"),n(""),te(!1),G(null))};return window.addEventListener(Xe,r),()=>window.removeEventListener(Xe,r)},[Q]),o.useEffect(()=>{const r=()=>m(Ce()?.targetPeerId??"");return window.addEventListener(We,r),()=>window.removeEventListener(We,r)},[]),o.useEffect(()=>{Q(),fe.current=!1,se.current="",g("idle"),b(null),n(""),h(null),te(!1),G(null),W(!1),K(""),Pe(""),be(!1);const r=new AbortController;return fetch("/api/computer/status",{signal:r.signal}).then(async u=>{if(!u.ok)throw new Error(u.status===403?"API_NOT_ALLOWED":"COMPUTER_FAILED");return await u.json()}).then(u=>{r.signal.aborted||h(u)}).catch(u=>{r.signal.aborted||b(Ne(String(u)))}),()=>{r.abort(),Q()}},[s,Q]),o.useEffect(()=>{_.current&&(_.current.viewOnly=p)},[p]),o.useEffect(()=>{_.current&&(_.current.scaleViewport=E)},[E]),o.useEffect(()=>{_.current&&"pauseResize"in _.current&&(_.current.pauseResize=!!v)},[v]),o.useEffect(()=>{_.current&&"keyboardActive"in _.current&&(_.current.keyboardActive=v==="keyboard")},[v]);const $e=r=>{r===z||$||!l||(n(""),b(null),x(u=>({...u,target:r?"local":"remote"})),d())},Ve=()=>{fe.current=!0,se.current="",Q(),g("idle"),n(""),te(!1),G(null),be(!1)},He=async r=>{if(r?.preventDefault(),N)return;if(fe.current=!0,a==="credentials"&&_.current&&"sendCredentials"in _.current){se.current=q,_.current.sendCredentials({username:y,password:q}),g("connecting");return}if(!_e()||!l||!q&&!I)return;d(),Q(),b(null),K(""),g("connecting"),be(!1);const u=re.current,S=A=>{u===re.current&&(Q(),g("error"),b(A),G(null),se.current="",(A==="computer.authFailed"||A==="computer.permission"||A==="computer.loginExpired")&&n(""),I&&(A==="computer.authFailed"||A==="computer.loginExpired")&&P("forget",w).catch(()=>{}))};Le.current=setTimeout(()=>S("computer.timeout"),6e4);try{let A=q||await P("use",w);if(u!==re.current)return;se.current=A||"";let F;if(j==="rdp"){const{RdpSession:Z}=await qe(async()=>{const{RdpSession:Ae}=await import("./rdpSession-D77Fs4-L.js");return{RdpSession:Ae}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]));if(u!==re.current)return;const de=window.innerWidth<=640,ce=Ee.current?.getBoundingClientRect(),ve=It(de?window.innerWidth:ce?.width||1280,Math.max(1,(de?window.innerHeight:ce?.height||800)-100));F=new Z(ue,{host:U.trim(),port:Number(Y),username:y.trim(),password:A||"",domain:O.trim(),ignoreCert:ee,...ve},Ae=>S(Ne(Ae)))}else{const{default:Z}=await qe(async()=>{const{default:ve}=await import("./rfb-CxsXsMUX.js");return{default:ve}},[]);if(u!==re.current)return;const de=new jt(U.trim(),ve=>S(Ne(ve)));Se.current=de;const ce=new Z(ue,de,{shared:!0,credentials:{username:y.trim()||void 0,password:A}});ce.background="var(--chrome-bg)",ce.resizeSession=!1,ce.qualityLevel=6,ce.compressionLevel=2,F=ce}A=void 0,_.current=F,F.scaleViewport=E,F.viewOnly=p,F.addEventListener("connect",()=>{if(u!==re.current)return;clearTimeout(Le.current),g("connected"),n(""),window.innerWidth<=640&&(document.activeElement?.blur?.(),te(!0));const Z=se.current;se.current="",w.rememberLogin&&Z&&P("save",w,Z).catch(()=>{})}),F.addEventListener("credentialsrequired",Z=>{if(u!==re.current)return;const de=Z.detail.types;st(de.includes("username")),g("credentials")}),F.addEventListener("securityfailure",()=>S("computer.authFailed")),F.addEventListener("disconnect",()=>S("computer.disconnected")),F.addEventListener("desktopname",Z=>{u===re.current&&K(Z.detail.name)})}catch(A){S(Ne(String(A)))}},he=r=>{!_.current||a!=="connected"||p||ye.send([...r.map(([S,A])=>[S,A,!0]),...[...r].reverse().map(([S,A])=>[S,A,!1])])},M=a==="connected",$=a==="connecting"||a==="credentials";o.useEffect(()=>{const r=_.current,u=ke.current,S=De.current;if(!M||p||v&&v!=="keyboard"||J!=="trackpad"||!r||!u||!S)return;const A="pointerTarget"in r?r.pointerTarget:kt(r),F=Rt(u,A,S,Oe);return le.current=F,()=>{F(),le.current===F&&(le.current=()=>{})}},[M,p,J,T,v]);const Ye=r=>{r!==J&&(le.current(),ct(r),Lt(r))};Fe.current=()=>{He()},o.useEffect(()=>{ze&&l&&i&&!N&&c.autoConnect&&I&&a==="idle"&&!fe.current&&Fe.current()},[ze,l,i,N,c.autoConnect,I,a]);const Ke=()=>{fe.current=!0,P("forget",w).catch(()=>{})},Te=r=>{le.current(),G(u=>u===r?null:r)},it=r=>{if(!_.current||p)return;const u=[];for(const S of r){const A=S.codePointAt(0),F=S===`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/rdpSession-CobFMSUs.js","assets/app-B6FdOF6K.js","assets/react-XDCjal2T.js","assets/dnd-BCFAPC0L.js","assets/terminal-C7X98Amf.js","assets/index-CNY7CTVa.css","assets/ChangeWalkthroughPanel-D1Puc7B3.js","assets/sparkles-Cg-yPdE2.js","assets/triangle-alert-CbMRJ6sx.js","assets/RightSidebar-BoNzpS2K.js","assets/App-ggIA_xqR.js","assets/gestureArbiter-JW8vcVRm.js","assets/gestureArbiter-C2J0D0kV.css","assets/referenceLongPress-bZ0xp-v2.js","assets/DiffReview-BBBC_NjV.js","assets/DiffViewer-BuQwFQ4V.js","assets/DiffViewer-T3uj2-aP.css","assets/RightSidebar-DW-JEgm2.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{ae as Me,ct as lt,d6 as et,bv as t,cq as Ce,bu as _e,W as Xe,o as We,l as ut,X as dt,_ as qe}from"./app-B6FdOF6K.js";import{b as o,r as mt}from"./dnd-BCFAPC0L.js";import{a as pt}from"./ChangeWalkthroughPanel-D1Puc7B3.js";import{L as Ge}from"./RightSidebar-BoNzpS2K.js";import{U as Je,K as ft,g as ht}from"./App-ggIA_xqR.js";import{M as xt}from"./triangle-alert-CbMRJ6sx.js";const gt=[["path",{d:"M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z",key:"edeuup"}]],Qe=Me("mouse-pointer-2",gt);const bt=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],yt=Me("settings-2",bt);const vt=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],wt=Me("zoom-in",vt);function Ie(e){const s=e==="darwin"?"mac":e==="win32"?"windows":"linux",m={host:"127.0.0.1",platform:s,protocol:s==="mac"?"vnc":"rdp",port:"3389",username:"",domain:"",ignoreCert:!1,rememberLogin:!0};return{target:"local",local:m,remote:{...m,host:""},viewOnly:!1,fit:!0,autoConnect:!0}}function Ze(e,s){const m=Ie(s);if(!e||typeof e!="object")return m;const i=e,h=(c,x)=>{const l=c&&typeof c=="object"?c:{},R=(d,V)=>typeof l[d]=="string"&&l[d].length<=V&&!/[\x00-\x1f]/.test(l[d])?l[d]:x[d];return{host:R("host",253),username:R("username",255),domain:R("domain",255),platform:["mac","linux","windows"].includes(String(l.platform))?l.platform:x.platform,protocol:l.protocol==="rdp"||l.protocol==="vnc"?l.protocol:x.protocol,port:typeof l.port=="string"&&/^\d{0,5}$/.test(l.port)&&Number(l.port)<=65535?l.port:x.port,ignoreCert:l.ignoreCert===!0,rememberLogin:l.rememberLogin!==!1}};return{target:i.target==="remote"?"remote":"local",local:{...h(i.local,m.local),host:"127.0.0.1"},remote:h(i.remote,m.remote),viewOnly:i.viewOnly===!0,fit:i.fit!==!1,autoConnect:i.autoConnect!==!1}}function tt(e){return JSON.stringify([e.host.trim().toLowerCase(),e.protocol,e.protocol==="vnc"?5900:Number(e.port),e.username.trim(),e.domain.trim()])}function Ct(e){const[s,m]=o.useState(Ie),[i,h]=o.useState(!1),[c,x]=o.useState("loading"),[l,R]=o.useState(0),[d,V]=o.useState([]),[H,D]=o.useState("idle"),P=o.useRef(s),z=o.useRef(0),w=o.useRef(0),U=o.useRef(""),C=o.useRef(null),j=o.useRef(new Set),Y=o.useCallback(y=>{P.current=y(P.current),z.current++,m(P.current),x("saving")},[]);o.useEffect(()=>{const y=++w.current;z.current=0,U.current="",C.current=null,P.current=Ie(),m(P.current),h(!1),x("loading"),V([]),D("idle");const N=new AbortController;return fetch("/api/computer/preferences",{signal:N.signal}).then(async p=>{if(!p.ok)throw new Error("PREFERENCES_LOAD_FAILED");return await p.json()}).then(p=>{if(y!==w.current||N.signal.aborted)return;let E=Ze(p.preferences);const I=z.current>0;if(!p.configured&&!I)try{const L=localStorage.getItem(`termdock:computer-host:${e}`);if(L){const B=/^(127\.0\.0\.1|localhost|::1|\[::1\])$/i.test(L)?"local":"remote";E=Ze({...E,target:B,[B]:{...E[B],host:L,platform:localStorage.getItem(`termdock:computer-platform:${e}`)||E[B].platform,protocol:localStorage.getItem(`termdock:computer-protocol:${e}`)||"vnc",port:localStorage.getItem(`termdock:computer-rdp-port:${e}`)||"3389"}}),z.current++}}catch{}I||(P.current=E),U.current=p.configured?JSON.stringify(E):"",m(P.current),h(!0),x(p.configured?"saved":"saving"),V(Array.isArray(p.credentialKeys)?p.credentialKeys.filter(L=>typeof L=="string"):[]),D(p.credentialError?"error":"idle")}).catch(()=>{!N.signal.aborted&&y===w.current&&x("error")}),()=>{++w.current,N.abort();for(const p of j.current)p.abort();j.current.clear()}},[e,l]);const O=o.useCallback(()=>{if(C.current)return C.current;if(!i)return Promise.resolve(!1);const y=w.current,N=(async()=>{for(;U.current!==JSON.stringify(P.current);){const p=JSON.stringify(P.current),E=new AbortController;j.current.add(E),x("saving");try{if(!(await fetch("/api/computer/preferences",{method:"PUT",headers:{"Content-Type":"application/json"},body:p,signal:E.signal})).ok)throw new Error("PREFERENCES_SAVE_FAILED");if(y!==w.current)return!1;U.current=p}catch{return y===w.current&&x("error"),!1}finally{j.current.delete(E)}}return y===w.current&&x("saved"),!0})();return C.current=N,N.finally(()=>{C.current===N&&(C.current=null)}),N},[i]);o.useEffect(()=>{if(!i||U.current===JSON.stringify(s))return;const y=setTimeout(()=>{O()},300);return()=>clearTimeout(y)},[i,s,O]);const ee=o.useCallback(async(y,N,p)=>{const E=w.current,I=new AbortController;y!=="use"&&D("saving");try{if(!await O()||E!==w.current)throw new Error("COMPUTER_CREDENTIALS_FAILED");j.current.add(I);const L=await fetch(`/api/computer/credentials/${y}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({profile:N,...y==="save"?{password:p}:{}}),signal:I.signal});if(E!==w.current)throw new Error("COMPUTER_CREDENTIALS_FAILED");if(!L.ok)throw new Error(y==="use"&&L.status===404?"COMPUTER_CREDENTIALS_MISSING":"COMPUTER_CREDENTIALS_FAILED");const X=await L.json();if(E!==w.current)throw new Error("COMPUTER_CREDENTIALS_FAILED");const B=tt(N);if(y==="save"&&V(ne=>[...new Set([...ne,B])]),y==="forget"&&V(ne=>ne.filter(xe=>xe!==B)),y==="use"&&(typeof X.password!="string"||!X.password))throw new Error("COMPUTER_CREDENTIALS_MISSING");return D("idle"),X.password}catch(L){throw E===w.current&&!I.signal.aborted&&D("error"),L}finally{j.current.delete(I)}},[O]);return{preferences:s,change:Y,loaded:i,saveState:c,flush:O,credentialKeys:d,loginState:H,credentialRequest:ee,retry:()=>i?void O():R(y=>y+1)}}class jt{binaryType="arraybuffer";protocol="";CONNECTING=0;OPEN=1;CLOSING=2;CLOSED=3;onopen=null;onmessage=null;onerror=null;onclose=null;socket;get readyState(){return this.socket.readyState}constructor(s,m){this.socket=lt(`/api/computer/ws?host=${encodeURIComponent(s)}`),this.socket.onopen=i=>this.onopen?.(i),this.socket.onerror=i=>this.onerror?.(i),this.socket.onclose=i=>{(i.code!==1e3||i.reason)&&m(i.reason||"COMPUTER_DISCONNECTED"),this.onclose?.(i)},this.socket.onmessage=i=>{try{const h=JSON.parse(i.data);if(h.type!=="data"||typeof h.data!="string"||!Number.isSafeInteger(h.seq))throw new Error("Invalid VNC record");const c=Uint8Array.from(atob(h.data),x=>x.charCodeAt(0));this.onmessage?.(new MessageEvent("message",{data:c.buffer})),this.socket.readyState===1&&this.socket.send(JSON.stringify({type:"ack",seq:h.seq}))}catch{m("COMPUTER_INVALID_MESSAGE"),this.close(),this.onclose?.(new CloseEvent("close",{code:4400}))}}}send(s){const m=ArrayBuffer.isView(s)?new Uint8Array(s.buffer,s.byteOffset,s.byteLength):new Uint8Array(s);for(let i=0;i<m.length;i+=32*1024){const h=m.subarray(i,i+32768);let c="";for(const x of h)c+=String.fromCharCode(x);this.socket.send(JSON.stringify({type:"data",data:btoa(c)}))}}close(){this.socket.close()}}function Nt(e){return e==="mac"||e==="linux"||e==="windows"}function Et(e){const s=e==="mac"?[65513,"MetaLeft"]:[65507,"ControlLeft"],m=e==="mac"?s:[65515,"MetaLeft"];return{escape:[[65307,"Escape"]],enter:[[65293,"Enter"]],backspace:[[65288,"Backspace"]],tab:[e==="mac"?s:[65513,"AltLeft"],[65289,"Tab"]],search:e==="mac"?[m,[32,"Space"]]:[m],copy:[s,[99,"KeyC"]],paste:[s,[118,"KeyV"]],up:[[65362,"ArrowUp"]],down:[[65364,"ArrowDown"]],left:[[65361,"ArrowLeft"]],right:[[65363,"ArrowRight"]]}}function kt(e){const s=e;return{size:()=>({width:s._fbWidth,height:s._fbHeight}),surface:()=>s._canvas,send:(m,i,h)=>{const c=s._display.scale,x=(m-s._display.absX(0))*c,l=(i-s._display.absY(0))*c;s._mousePos={x,y:l},s._mouseMoveTimer!==null&&clearTimeout(s._mouseMoveTimer),s._mouseMoveTimer=null,s._mouseButtonMask=h,s._mouseLastMoveTime=Date.now(),s._sendMouse(x,l,h)}}}const rt="termdock:computer-touch-mode:v1";function St(){try{const e=localStorage.getItem(rt);if(e==="trackpad"||e==="direct")return e}catch{}return navigator.maxTouchPoints>0&&window.matchMedia("(any-pointer: coarse)").matches?"trackpad":"direct"}function Lt(e){try{localStorage.setItem(rt,e)}catch{}}const Tt=8,At=300,_t=450,Re=18,je=(e,s)=>Math.max(0,Math.min(e,Math.max(0,s-1)));function Rt(e,s,m,i){const h=new AbortController,c=new Map;let x=0,l=0,R=!1,d=!1,V=!1,H=0,D=0,P,z=!1,w=!0,U=!0,C,j=!1;const Y=()=>{const n=s.size(),a=i.current??={x:n.width/2,y:n.height/2};return a.x=je(a.x,n.width),a.y=je(a.y,n.height),a};let O;const ee=()=>{const n=s.size();if((!O||O.width!==n.width||O.height!==n.height)&&(U=!0),!U&&O)return O;const a=s.surface(),g=e.getBoundingClientRect(),k=a.getBoundingClientRect(),b=[];for(let f=a.parentElement;f&&f!==e;f=f.parentElement){const K=getComputedStyle(f),T=/auto|scroll/.test(K.overflowX)?Math.max(0,f.scrollWidth-f.clientWidth):0,te=/auto|scroll/.test(K.overflowY)?Math.max(0,f.scrollHeight-f.clientHeight):0;if(!T&&!te)continue;const v=f.getBoundingClientRect();b.push({element:f,left:v.left-g.left,top:v.top-g.top,right:v.right-g.left,bottom:v.bottom-g.top,maxX:T,maxY:te})}return O={...n,left:k.left-g.left,top:k.top-g.top,scaleX:n.width&&k.width?k.width/n.width:1,scaleY:n.height&&k.height?k.height/n.height:1,viewportWidth:g.width,viewportHeight:g.height,clientLeft:g.left,clientTop:g.top,scrollers:b},U=!1,O},y=()=>{const n=ee(),a=Y();if(!n.width||!n.height||!w){m.hidden=!0;return}let g=n.left+a.x*n.scaleX,k=n.top+a.y*n.scaleY;for(const b of n.scrollers){if(b.maxX){const f=b.element.scrollLeft,K=g<b.left+20?g-b.left-20:g>b.right-20?g-b.right+20:0,T=Math.max(0,Math.min(b.maxX,f+K));f!==T&&(b.element.scrollLeft=T,g-=T-f,n.left-=T-f)}if(b.maxY){const f=b.element.scrollTop,K=k<b.top+20?k-b.top-20:k>b.bottom-20?k-b.bottom+20:0,T=Math.max(0,Math.min(b.maxY,f+K));f!==T&&(b.element.scrollTop=T,k-=T-f,n.top-=T-f)}}m.hidden=g<0||k<0||g>=n.viewportWidth||k>=n.viewportHeight,m.style.transform=`translate3d(${g}px, ${k}px, 0)`},N=(n=D)=>{const a=Y();s.send(Math.round(a.x),Math.round(a.y),n)},p=()=>{P=void 0,y(),z&&(z=!1,N());let n=0;for(;Math.abs(H)>=Re&&n++<8;){const a=H>0?16:8;N(a),N(0),H-=Math.sign(H)*Re}},E=()=>{j||(P??=requestAnimationFrame(p))},I=()=>{P!==void 0&&(cancelAnimationFrame(P),p())},L=()=>{clearTimeout(C),I(),D&&(D=0,N())},X=n=>{n.cancelable&&n.preventDefault(),n.stopImmediatePropagation()},B=()=>[...c.values()].reduce((n,a)=>n+a.y,0)/c.size,ne=n=>{if(!(n.pointerType!=="touch"&&n.pointerType!=="pen")){X(n),w=!0,E(),c.size||(x=performance.now(),l=0,R=!1,d=!1,V=!1,H=0),c.set(n.pointerId,{x:n.clientX,y:n.clientY,startX:n.clientX,startY:n.clientY}),l=Math.max(l,c.size);try{e.setPointerCapture(n.pointerId)}catch{}clearTimeout(C),c.size===1&&l===1?C=setTimeout(()=>{!j&&c.size===1&&!R&&!d&&(D=1,N())},_t):(L(),V=!0)}},xe=n=>{if(n.pointerType==="mouse"){const f=ee();i.current={x:je((n.clientX-f.clientLeft-f.left)/f.scaleX,f.width),y:je((n.clientY-f.clientTop-f.top)/f.scaleY,f.height)},w=!1,m.hidden=!0;return}const a=c.get(n.pointerId);if(!a)return;X(n);const g=B(),k=n.clientX-a.x,b=n.clientY-a.y;if(a.x=n.clientX,a.y=n.clientY,Math.hypot(a.x-a.startX,a.y-a.startY)>Tt&&(R=!0,clearTimeout(C)),c.size===2&&!d)H+=g-B(),Math.abs(H)>=Re&&(R=!0,E());else if(c.size===1&&!V&&!d){const f=Y(),K=O??ee();f.x+=k/K.scaleX,f.y+=b/K.scaleY,Y(),z=!0,E()}},me=n=>{if(!c.has(n.pointerId))return;X(n);const a=D!==0;n.type!=="pointerup"&&(d=!0),L(),c.delete(n.pointerId);try{e.hasPointerCapture(n.pointerId)&&e.releasePointerCapture(n.pointerId)}catch{}c.size||(H=0,!d&&!a&&!R&&l<=2&&performance.now()-x<=At&&(N(l===2?4:1),N(0)))},pe=()=>{d=!0,L();const n=[...c.keys()];c.clear(),H=0;for(const a of n)try{e.hasPointerCapture(a)&&e.releasePointerCapture(a)}catch{}},W={capture:!0,passive:!1,signal:h.signal};e.addEventListener("pointerdown",ne,W),e.addEventListener("pointermove",xe,W),e.addEventListener("pointerup",me,W),e.addEventListener("pointercancel",me,W),e.addEventListener("lostpointercapture",me,W);for(const n of["touchstart","touchmove","touchend","touchcancel","contextmenu"])e.addEventListener(n,X,W);const oe=()=>{U=!0,E()};e.addEventListener("scroll",oe,{capture:!0,signal:h.signal}),window.addEventListener("blur",pe,{signal:h.signal});const ge=()=>{document.hidden&&pe()};document.addEventListener("visibilitychange",ge,{signal:h.signal});const q=new ResizeObserver(oe);return q.observe(e),q.observe(s.surface()),y(),()=>{j||(j=!0,h.abort(),pe(),q.disconnect(),m.hidden=!0)}}function It(e,s){e=Math.max(1,e||1280),s=Math.max(1,s||800);const m=Math.max(1,640/e,480/s);return{width:Math.max(640,Math.min(2560,Math.round(e*m))),height:Math.max(480,Math.min(1600,Math.round(s*m)))}}function Mt({sendText:e,sendKey:s}){const{t:m}=et(),i=o.useRef(null),h=o.useRef(!1),c=o.useRef(null),[x,l]=o.useState(""),R=()=>{const d=i.current?.value||"";d&&e(d),i.current&&(i.current.value=""),l("")};return o.useEffect(()=>(i.current?.focus({preventScroll:!0}),()=>{c.current!==null&&cancelAnimationFrame(c.current)}),[]),t.jsx("input",{ref:i,tabIndex:-1,className:"pointer-events-none absolute left-0 top-0 h-px w-px border-0 p-0 text-base opacity-0","aria-label":m("computer.keyboardInput"),autoCapitalize:"none",autoCorrect:"off",autoComplete:"off",spellCheck:!1,maxLength:1024,value:x,onChange:d=>{l(d.target.value),!h.current&&c.current===null&&R()},onCompositionStart:()=>{h.current=!0},onCompositionEnd:()=>{h.current=!1,c.current!==null&&cancelAnimationFrame(c.current),c.current=requestAnimationFrame(()=>{c.current=null,R()})},onKeyDown:d=>{h.current||d.nativeEvent.isComposing||c.current!==null||(d.key==="Enter"||d.key==="Backspace"&&!d.currentTarget.value)&&(d.preventDefault(),s(d.key==="Enter"?"enter":"backspace"))}})}function Pt(e){let s=[],m=null;const i=new Map,h=()=>{m=null,s.splice(0,32).forEach(c=>{e(c),c[2]?i.set(c[0],c):i.delete(c[0])}),s.length&&(m=requestAnimationFrame(h))};return{send(c){s.push(...c),m===null&&h()},clear(){m!==null&&cancelAnimationFrame(m),m=null,s=[];const c=[...i.values()].reverse();i.clear();for(const[x,l]of c)try{e([x,l,!1])}catch{}}}}const ae="inline-flex min-h-9 items-center justify-center gap-1.5 rounded-md border border-border px-2.5 text-xs hover:bg-surface-2 disabled:opacity-40",ie="min-h-11 w-full rounded-md border border-border bg-background px-2 text-sm outline-none focus:border-primary";function Ne(e){return/API_NOT_ALLOWED|AUTHORIZATION|revoked|PAIRING/.test(e)?"computer.permission":e.includes("RDP_BACKEND_UNAVAILABLE")?"computer.rdpBackendUnavailable":e.includes("RDP_CERTIFICATE")?"computer.rdpCertificate":e.includes("CREDENTIALS_MISSING")?"computer.loginExpired":e.includes("CREDENTIALS_FAILED")?"computer.loginSaveFailed":e.includes("AUTH_FAILED")?"computer.authFailed":e.includes("RDP_FAILED")?"computer.rdpFailed":e.includes("SCREEN_SHARING_OFF")?"computer.sharingOff":e.includes("PRIVATE_HOST_ONLY")?"computer.privateOnly":e.includes("INVALID_HOST")?"computer.invalidHost":e.includes("TIMEOUT")?"computer.timeout":e.includes("UNREACHABLE")?"computer.unreachable":e.includes("DISCONNECTED")?"computer.disconnected":"computer.failed"}function Dt(){const{t:e}=et(),[s,m]=o.useState(()=>Ce()?.targetPeerId??""),[i,h]=o.useState(null),{preferences:c,change:x,loaded:l,saveState:R,flush:d,retry:V,credentialKeys:H,loginState:D,credentialRequest:P}=Ct(s),z=c.target==="local",w=c[c.target],{host:U,platform:C,protocol:j,port:Y,domain:O,ignoreCert:ee,username:y}=w,N=j==="rdp"&&i?.rdpAvailable===!1,{viewOnly:p,fit:E}=c,I=w.rememberLogin&&H.includes(tt(w)),L=r=>x(u=>({...u,[u.target]:{...u[u.target],...r}})),X=r=>L({username:r}),B=r=>L({domain:r}),ne=r=>{L({ignoreCert:r}),d()},xe=r=>L({port:r}),me=r=>{r&&(le.current(),ye.clear(),G(null)),x(u=>({...u,viewOnly:r})),d()},[pe,W]=o.useState(!1),oe=Et(C),ge=C==="mac"?"⌘V":"Ctrl+V",[q,n]=o.useState(""),[a,g]=o.useState("idle"),[k,b]=o.useState(null),[f,K]=o.useState(""),[T,te]=o.useState(!1),[v,G]=o.useState(null),Ee=o.useRef(null),[we,Pe]=o.useState(""),[nt,be]=o.useState(!1),[ot,st]=o.useState(!1),[J,ct]=o.useState(St),De=o.useRef(null),Oe=o.useRef(null),le=o.useRef(()=>{}),[ze,at]=o.useState(_e),fe=o.useRef(!1),se=o.useRef(""),Fe=o.useRef(()=>{}),Ue=o.useRef(null),ke=o.useRef(null),ue=o.useMemo(()=>{const r=document.createElement("div");return r.className="h-full w-full min-h-0 overflow-hidden",r},[]),_=o.useRef(null),ye=o.useMemo(()=>Pt(([r,u,S])=>_.current?.sendKey(r,u,S)),[]),Se=o.useRef(null),re=o.useRef(0),Le=o.useRef(void 0),Q=o.useCallback(()=>{le.current(),ye.clear(),Oe.current=null,re.current++,clearTimeout(Le.current);const r=_.current;_.current=null,r?.disconnect(),Se.current?.close(),Se.current=null,ue.replaceChildren()},[ue,ye]);o.useLayoutEffect(()=>(ke.current?.appendChild(ue),()=>{ue.remove()}),[ue,T]),o.useEffect(()=>()=>Q(),[Q]),o.useEffect(()=>{const r=()=>{const u=_e();at(u),!u&&(fe.current=!1,se.current="",Q(),g("idle"),n(""),te(!1),G(null))};return window.addEventListener(Xe,r),()=>window.removeEventListener(Xe,r)},[Q]),o.useEffect(()=>{const r=()=>m(Ce()?.targetPeerId??"");return window.addEventListener(We,r),()=>window.removeEventListener(We,r)},[]),o.useEffect(()=>{Q(),fe.current=!1,se.current="",g("idle"),b(null),n(""),h(null),te(!1),G(null),W(!1),K(""),Pe(""),be(!1);const r=new AbortController;return fetch("/api/computer/status",{signal:r.signal}).then(async u=>{if(!u.ok)throw new Error(u.status===403?"API_NOT_ALLOWED":"COMPUTER_FAILED");return await u.json()}).then(u=>{r.signal.aborted||h(u)}).catch(u=>{r.signal.aborted||b(Ne(String(u)))}),()=>{r.abort(),Q()}},[s,Q]),o.useEffect(()=>{_.current&&(_.current.viewOnly=p)},[p]),o.useEffect(()=>{_.current&&(_.current.scaleViewport=E)},[E]),o.useEffect(()=>{_.current&&"pauseResize"in _.current&&(_.current.pauseResize=!!v)},[v]),o.useEffect(()=>{_.current&&"keyboardActive"in _.current&&(_.current.keyboardActive=v==="keyboard")},[v]);const $e=r=>{r===z||$||!l||(n(""),b(null),x(u=>({...u,target:r?"local":"remote"})),d())},Ve=()=>{fe.current=!0,se.current="",Q(),g("idle"),n(""),te(!1),G(null),be(!1)},He=async r=>{if(r?.preventDefault(),N)return;if(fe.current=!0,a==="credentials"&&_.current&&"sendCredentials"in _.current){se.current=q,_.current.sendCredentials({username:y,password:q}),g("connecting");return}if(!_e()||!l||!q&&!I)return;d(),Q(),b(null),K(""),g("connecting"),be(!1);const u=re.current,S=A=>{u===re.current&&(Q(),g("error"),b(A),G(null),se.current="",(A==="computer.authFailed"||A==="computer.permission"||A==="computer.loginExpired")&&n(""),I&&(A==="computer.authFailed"||A==="computer.loginExpired")&&P("forget",w).catch(()=>{}))};Le.current=setTimeout(()=>S("computer.timeout"),6e4);try{let A=q||await P("use",w);if(u!==re.current)return;se.current=A||"";let F;if(j==="rdp"){const{RdpSession:Z}=await qe(async()=>{const{RdpSession:Ae}=await import("./rdpSession-CobFMSUs.js");return{RdpSession:Ae}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]));if(u!==re.current)return;const de=window.innerWidth<=640,ce=Ee.current?.getBoundingClientRect(),ve=It(de?window.innerWidth:ce?.width||1280,Math.max(1,(de?window.innerHeight:ce?.height||800)-100));F=new Z(ue,{host:U.trim(),port:Number(Y),username:y.trim(),password:A||"",domain:O.trim(),ignoreCert:ee,...ve},Ae=>S(Ne(Ae)))}else{const{default:Z}=await qe(async()=>{const{default:ve}=await import("./rfb-CxsXsMUX.js");return{default:ve}},[]);if(u!==re.current)return;const de=new jt(U.trim(),ve=>S(Ne(ve)));Se.current=de;const ce=new Z(ue,de,{shared:!0,credentials:{username:y.trim()||void 0,password:A}});ce.background="var(--chrome-bg)",ce.resizeSession=!1,ce.qualityLevel=6,ce.compressionLevel=2,F=ce}A=void 0,_.current=F,F.scaleViewport=E,F.viewOnly=p,F.addEventListener("connect",()=>{if(u!==re.current)return;clearTimeout(Le.current),g("connected"),n(""),window.innerWidth<=640&&(document.activeElement?.blur?.(),te(!0));const Z=se.current;se.current="",w.rememberLogin&&Z&&P("save",w,Z).catch(()=>{})}),F.addEventListener("credentialsrequired",Z=>{if(u!==re.current)return;const de=Z.detail.types;st(de.includes("username")),g("credentials")}),F.addEventListener("securityfailure",()=>S("computer.authFailed")),F.addEventListener("disconnect",()=>S("computer.disconnected")),F.addEventListener("desktopname",Z=>{u===re.current&&K(Z.detail.name)})}catch(A){S(Ne(String(A)))}},he=r=>{!_.current||a!=="connected"||p||ye.send([...r.map(([S,A])=>[S,A,!0]),...[...r].reverse().map(([S,A])=>[S,A,!1])])},M=a==="connected",$=a==="connecting"||a==="credentials";o.useEffect(()=>{const r=_.current,u=ke.current,S=De.current;if(!M||p||v&&v!=="keyboard"||J!=="trackpad"||!r||!u||!S)return;const A="pointerTarget"in r?r.pointerTarget:kt(r),F=Rt(u,A,S,Oe);return le.current=F,()=>{F(),le.current===F&&(le.current=()=>{})}},[M,p,J,T,v]);const Ye=r=>{r!==J&&(le.current(),ct(r),Lt(r))};Fe.current=()=>{He()},o.useEffect(()=>{ze&&l&&i&&!N&&c.autoConnect&&I&&a==="idle"&&!fe.current&&Fe.current()},[ze,l,i,N,c.autoConnect,I,a]);const Ke=()=>{fe.current=!0,P("forget",w).catch(()=>{})},Te=r=>{le.current(),G(u=>u===r?null:r)},it=r=>{if(!_.current||p)return;const u=[];for(const S of r){const A=S.codePointAt(0),F=S===`
|
|
3
3
|
`?65293:S===" "?65289:A<256?A:16777216|A;u.push([F,null,!0],[F,null,!1])}ye.send(u)};o.useEffect(()=>{if(!M||v!=="keyboard"&&v!=="clipboard"||!T||!window.visualViewport)return;const r=window.visualViewport,u=Ee.current,S=()=>{u&&r.height>=160&&(u.style.height=`${r.height}px`,u.style.top=`${r.offsetTop}px`)};return S(),r.addEventListener("resize",S),r.addEventListener("scroll",S),()=>{r.removeEventListener("resize",S),r.removeEventListener("scroll",S),u&&(u.style.height="",u.style.top="")}},[M,v,T]);const Be=t.jsxs("div",{ref:Ee,className:`flex min-h-0 flex-col bg-surface text-foreground ${T?"fixed inset-0 z-modal-panel h-dvh pb-[env(safe-area-inset-bottom)] pt-[env(safe-area-inset-top)]":"relative h-full"}`,role:T?"dialog":void 0,"aria-modal":T||void 0,"aria-label":e("computer.title"),onKeyDown:r=>{r.stopPropagation(),r.key==="Escape"&&!r.nativeEvent.isComposing&&v&&(r.preventDefault(),G(null))},onKeyUp:r=>r.stopPropagation(),children:[t.jsxs("div",{className:"relative z-30 flex min-h-12 shrink-0 items-center gap-2 border-b border-border bg-surface px-3",children:[T&&t.jsx("button",{type:"button",className:"flex min-h-11 min-w-11 items-center justify-center",onClick:()=>{te(!1),G(null)},"aria-label":e("computer.exitFullscreen"),children:t.jsx(pt,{size:20})}),t.jsx(ut,{size:16,className:"shrink-0 text-muted-foreground"}),t.jsx("span",{className:"min-w-0 flex-1 truncate text-xs font-medium",children:M&&(f||(z?i?.hostname||Ce()?.serviceName:U))||e("computer.title")}),M&&t.jsx("span",{className:"text-[11px] text-primary",children:e("computer.connected")}),M&&D==="error"&&t.jsx("span",{role:"alert",className:"text-[11px] text-destructive",children:e("computer.loginSaveFailed")}),M&&R==="saving"&&t.jsx("span",{role:"status","aria-label":e("computer.settingsSaving"),title:e("computer.settingsSaving"),children:t.jsx(Ge,{size:12,className:"animate-spin text-muted-foreground"})}),M&&R==="error"&&t.jsxs("button",{type:"button",className:ae,title:e("computer.settingsSaveFailed"),"aria-label":e("computer.settingsSaveFailed"),onClick:V,children:["! ",e("computer.retry")]}),$&&t.jsxs("button",{type:"button",className:ae,onClick:Ve,children:[t.jsx(Je,{size:14}),e("computer.cancel")]}),M&&!T&&t.jsxs("button",{type:"button",className:"flex min-h-11 min-w-11 items-center justify-center gap-1 text-xs",onClick:()=>te(!0),"aria-label":e("computer.fullscreen"),children:[t.jsx(xt,{size:16}),e("computer.expand")]}),M&&t.jsx("button",{type:"button",className:"flex min-h-11 min-w-11 items-center justify-center",onClick:()=>Te("tools"),"aria-label":e("computer.tools"),"aria-expanded":v==="tools",children:t.jsx(yt,{size:18})})]}),!M&&t.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto p-4 sm:p-6",children:t.jsxs("div",{className:"mx-auto w-full max-w-md",children:[t.jsxs("form",{className:"space-y-3",onSubmit:r=>{He(r)},"aria-busy":a==="connecting",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-1 rounded-lg bg-background p-1",role:"group","aria-label":e("computer.target"),children:[t.jsx("button",{type:"button",className:`min-h-11 rounded-md px-3 text-sm font-medium ${z?"bg-surface-2 text-foreground":"text-muted-foreground hover:bg-surface"}`,"aria-pressed":z,disabled:$||!i||!l,onClick:()=>$e(!0),children:e("computer.thisComputer")}),t.jsx("button",{type:"button",className:`min-h-11 rounded-md px-3 text-sm font-medium ${z?"text-muted-foreground hover:bg-surface":"bg-surface-2 text-foreground"}`,"aria-pressed":!z,disabled:$||!l,onClick:()=>$e(!1),children:e("computer.otherComputer")})]}),z?t.jsx("p",{className:"text-xs leading-relaxed text-muted-foreground",role:"status",children:i?e("computer.localService",{name:Ce()?.serviceName||i.hostname}):e("computer.loading")}):t.jsxs("label",{className:"block space-y-1 text-xs",children:[t.jsx("span",{children:e("computer.host")}),t.jsx("input",{className:ie,value:U,disabled:$||!l,onChange:r=>{L({host:r.target.value,domain:"",ignoreCert:!1}),n(""),b(null)},placeholder:e("computer.hostPlaceholder"),onBlur:()=>{d()},autoCapitalize:"none",autoCorrect:"off",spellCheck:!1,required:!0,maxLength:253})]}),t.jsxs("p",{className:"text-xs text-muted-foreground",children:[C==="mac"?"macOS":C==="linux"?"Ubuntu / Linux":"Windows"," · ",j.toUpperCase()," · ",j==="rdp"?Y||"3389":"5900",p?` · ${e("computer.viewOnly")}`:""]}),t.jsxs("label",{className:"block space-y-1 text-xs",children:[t.jsx("span",{children:e(j==="rdp"?"computer.rdpUsername":"computer.username")}),t.jsx("input",{className:ie,value:y,disabled:a==="connecting"||!l,onChange:r=>X(r.target.value),onBlur:()=>{d()},autoCapitalize:"none",autoCorrect:"off",autoComplete:"off",required:j==="rdp"||a==="credentials"&&ot,maxLength:255})]}),t.jsxs("label",{className:"block space-y-1 text-xs",children:[t.jsx("span",{children:e("computer.password")}),t.jsx("input",{className:ie,type:"password",value:q,disabled:a==="connecting"||!l,onChange:r=>n(r.target.value),placeholder:I&&a!=="credentials"?e("computer.savedPassword"):void 0,autoComplete:"new-password",required:!I||a==="credentials",maxLength:1024})]}),t.jsx("p",{className:"text-[11px] leading-relaxed text-muted-foreground",children:e(j==="rdp"?"computer.rdpLoginHint":"computer.vncLoginHint")}),t.jsxs("div",{className:"flex min-h-11 items-center justify-between gap-2 text-xs",children:[t.jsxs("label",{className:"flex min-h-11 items-center gap-2",children:[t.jsx("input",{type:"checkbox",checked:w.rememberLogin,disabled:$||!l||D==="saving",onChange:r=>{const u=r.target.checked;L({rememberLogin:u}),!u&&I?P("forget",{...w,rememberLogin:u}).catch(()=>{}):d()}}),e("computer.rememberLogin")]}),I&&t.jsx("button",{type:"button",className:"min-h-11 text-muted-foreground underline",disabled:$||D==="saving",onClick:Ke,children:e("computer.forgetLogin")})]}),D==="error"&&!k&&t.jsx("p",{role:"alert",className:"text-xs text-destructive",children:e("computer.loginSaveFailed")}),N&&t.jsxs("div",{role:"status",className:"space-y-1 text-xs leading-relaxed text-muted-foreground",children:[t.jsx("p",{children:e("computer.rdpBackendUnavailable")}),t.jsx("p",{children:e("computer.rdpBackendRecovery")})]}),a==="credentials"&&t.jsx("p",{className:"text-xs text-primary",children:e("computer.credentials")}),k&&t.jsxs("div",{role:"alert",className:"rounded-md bg-surface-2 p-3 text-xs leading-relaxed text-destructive",children:[e(k),k==="computer.rdpCertificate"&&t.jsxs("label",{className:"mt-1 flex min-h-11 items-center gap-2 text-foreground",children:[t.jsx("input",{type:"checkbox",checked:ee,onChange:r=>ne(r.target.checked)}),e("computer.trustCertificateHere")]}),a==="error"&&k!=="computer.rdpCertificate"&&t.jsx("button",{type:"button",className:"mt-1 block min-h-9 text-foreground underline",onClick:()=>{W(!0),requestAnimationFrame(()=>Ue.current?.scrollIntoView?.({block:"nearest",behavior:"smooth"}))},children:e("computer.checkSettings")})]}),t.jsxs("button",{type:"submit",className:"inline-flex min-h-11 w-full items-center justify-center gap-2 rounded-md bg-primary px-3 text-sm font-medium text-primary-foreground disabled:opacity-40",disabled:!l||N||a==="connecting"||D==="saving"||z&&!i||!U.trim()||!q&&(!I||a==="credentials")||j==="rdp"&&(!y.trim()||!Number.isInteger(Number(Y))||Number(Y)<1||Number(Y)>65535),children:[a==="connecting"&&t.jsx(Ge,{size:16,className:"animate-spin"}),e(a==="connecting"?"computer.connecting":a==="credentials"?"computer.authenticate":a==="error"?"computer.retryConnect":"computer.connect")]}),t.jsxs("details",{ref:Ue,className:"border-b border-border text-xs",open:pe,onToggle:r=>W(r.currentTarget.open),children:[t.jsxs("summary",{className:"flex min-h-11 cursor-pointer list-none items-center justify-between text-muted-foreground",children:[t.jsx("span",{children:e("computer.advanced")}),t.jsx("span",{"aria-hidden":"true",children:pe?"−":"+"})]}),t.jsxs("div",{className:"space-y-3 pb-4",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[t.jsxs("label",{className:"block space-y-1",children:[t.jsx("span",{children:e("computer.platform")}),t.jsxs("select",{className:ie,value:C,disabled:$||!l,onChange:r=>{Nt(r.target.value)&&L({platform:r.target.value,protocol:r.target.value==="mac"?"vnc":"rdp",ignoreCert:!1}),n(""),d()},children:[t.jsx("option",{value:"mac",children:"macOS"}),t.jsx("option",{value:"linux",children:"Ubuntu / Linux"}),t.jsx("option",{value:"windows",children:"Windows"})]})]}),t.jsxs("label",{className:"block space-y-1",children:[t.jsx("span",{children:e("computer.protocol")}),t.jsxs("select",{className:ie,value:j,disabled:$||!l,onChange:r=>{L({protocol:r.target.value==="rdp"?"rdp":"vnc"}),n(""),b(null),d()},children:[t.jsx("option",{value:"rdp",children:"RDP"}),t.jsx("option",{value:"vnc",children:"VNC"})]})]})]}),j==="rdp"&&t.jsxs(t.Fragment,{children:[t.jsxs("label",{className:"block space-y-1",children:[t.jsx("span",{children:e("computer.port")}),t.jsx("input",{className:ie,type:"number",min:1,max:65535,step:1,value:Y,disabled:$||!l,onBlur:()=>{d()},onChange:r=>xe(r.target.value)})]}),t.jsxs("label",{className:"block space-y-1",children:[t.jsx("span",{children:e("computer.domain")}),t.jsx("input",{className:ie,value:O,disabled:$||!l,onBlur:()=>{d()},onChange:r=>B(r.target.value),autoComplete:"off",maxLength:255})]}),t.jsxs("label",{className:"flex min-h-11 items-center gap-2",children:[t.jsx("input",{type:"checkbox",checked:ee,disabled:$||!l,onChange:r=>ne(r.target.checked)}),e("computer.trustCertificate")]})]}),t.jsxs("label",{className:"flex min-h-11 items-center gap-2",children:[t.jsx("input",{type:"checkbox",checked:p,disabled:$||!l,onChange:r=>me(r.target.checked)}),e("computer.viewOnly")]}),t.jsxs("label",{className:"flex min-h-11 items-center gap-2",children:[t.jsx("input",{type:"checkbox",checked:c.autoConnect,disabled:$||!l,onChange:r=>{x(u=>({...u,autoConnect:r.target.checked})),d()}}),e("computer.autoConnect")]})]})]})]}),t.jsxs("p",{role:"status",className:"mt-2 text-[11px] leading-relaxed text-muted-foreground",children:[e(R==="saved"?"computer.settingsSaved":R==="error"?l?"computer.settingsSaveFailed":"computer.settingsLoadFailed":R==="loading"?"computer.settingsLoading":"computer.settingsSaving"),R==="error"&&t.jsx("button",{type:"button",className:"ml-2 min-h-9 text-primary underline",onClick:V,children:e("computer.retry")})]}),t.jsxs("details",{className:"text-xs",children:[t.jsx("summary",{className:"flex min-h-11 cursor-pointer items-center text-muted-foreground",children:e("computer.setup")}),t.jsxs("ol",{className:"ml-4 list-decimal space-y-2 pt-2 leading-relaxed text-muted-foreground",children:[t.jsx("li",{children:e(j==="rdp"?C==="linux"?"computer.rdpLinuxStep1":"computer.rdpStep1":C==="mac"?"computer.step1":C==="linux"?"computer.linuxStep1":"computer.windowsStep1")}),t.jsx("li",{children:e(j==="rdp"?"computer.rdpStep2":C==="mac"?"computer.step2":C==="linux"?"computer.linuxStep2":"computer.windowsStep2")}),t.jsx("li",{children:e("computer.step3")})]}),j==="vnc"&&C==="linux"&&t.jsxs(t.Fragment,{children:[t.jsx("p",{className:"mt-3 leading-relaxed text-muted-foreground",children:e("computer.linuxCommandHint")}),t.jsx("pre",{className:"mt-2 overflow-x-auto rounded-md bg-background p-2 text-[11px]",children:t.jsx("code",{children:`sudo apt install x11vnc
|
|
4
4
|
x11vnc -storepasswd
|
|
5
5
|
x11vnc -display "$DISPLAY" -auth guess -localhost -usepw -forever -shared -rfbport 5900`})}),t.jsx("p",{className:"mt-2 leading-relaxed text-muted-foreground",children:e("computer.linuxProtocolHint")})]}),t.jsx("p",{className:"mt-3 leading-relaxed text-muted-foreground",children:e(j==="rdp"?"computer.rdpNetworkHint":"computer.networkHint")})]})]})}),M&&v==="tools"&&t.jsx("button",{type:"button",className:"absolute inset-x-0 bottom-14 top-12 z-20 bg-background/40","aria-label":e("computer.returnToDesktop"),onClick:()=>G(null)}),M&&t.jsxs("div",{hidden:v!=="tools",className:`${v==="tools"?"flex":"hidden"} absolute inset-x-3 top-14 z-30 max-h-[calc(100%-7rem)] flex-wrap items-center gap-3 overflow-y-auto rounded-lg border border-border bg-surface px-4 py-3 text-xs shadow-lg [&_button]:min-h-11 [&_select]:min-h-11 [&_label]:min-h-11`,role:"region","aria-label":e("computer.tools"),children:[t.jsxs("div",{className:"flex w-full items-center justify-between",children:[t.jsx("span",{className:"font-medium",children:e("computer.tools")}),t.jsx("button",{type:"button",className:"flex min-w-11 items-center justify-center","aria-label":e("computer.closeTools"),onClick:()=>G(null),children:t.jsx(dt,{size:18})})]}),t.jsx("div",{className:"flex w-full items-center gap-2",children:t.jsx("div",{className:"inline-flex rounded-md bg-background p-0.5",role:"group","aria-label":e("computer.touchMode"),children:["trackpad","direct"].map(r=>t.jsx("button",{type:"button",className:`min-h-9 rounded px-3 text-xs ${J===r?"bg-surface-2 text-foreground":"text-muted-foreground hover:bg-surface"}`,"aria-pressed":J===r,onClick:()=>Ye(r),children:e(r==="trackpad"?"computer.trackpadMode":"computer.directTouchMode")},r))})}),t.jsxs("label",{className:"flex min-h-9 items-center gap-1.5",children:[t.jsx("input",{type:"checkbox",checked:p,onChange:r=>me(r.target.checked)}),e("computer.viewOnly")]}),t.jsx("button",{type:"button",className:ae,onClick:()=>{x(r=>({...r,fit:!r.fit})),d()},children:e(E?"computer.actualSize":"computer.fit")}),t.jsxs("select",{className:`${ae} min-w-0 bg-surface`,"aria-label":e("computer.shortcuts"),value:"",disabled:p,onChange:r=>{he(oe[r.target.value]??[])},children:[t.jsx("option",{value:"",disabled:!0,children:e("computer.shortcuts")}),t.jsxs("option",{value:"tab",children:[C==="mac"?"⌘ Tab":"Alt+Tab"," · ",e("computer.switchApps")]}),t.jsxs("option",{value:"search",children:[C==="mac"?"⌘ Space":"Super / Win"," · ",e(C==="mac"?"computer.spotlight":"computer.systemSearch")]}),t.jsx("option",{value:"copy",children:C==="mac"?"⌘C":"Ctrl+C"}),t.jsx("option",{value:"paste",children:ge}),t.jsx("option",{value:"escape",children:"Esc"}),t.jsx("option",{value:"enter",children:"Enter"}),t.jsx("option",{value:"backspace",children:"⌫"}),t.jsx("option",{value:"up",children:"↑"}),t.jsx("option",{value:"down",children:"↓"}),t.jsx("option",{value:"left",children:"←"}),t.jsx("option",{value:"right",children:"→"})]}),t.jsxs("div",{className:"flex w-full items-center justify-between border-t border-border pt-2",children:[I&&t.jsx("button",{type:"button",className:ae,disabled:D==="saving",onClick:Ke,children:e("computer.forgetLogin")}),t.jsxs("button",{type:"button",className:`${ae} ml-auto text-destructive`,onClick:Ve,children:[t.jsx(Je,{size:14}),e("computer.disconnect")]})]})]}),t.jsx("div",{ref:ke,"data-sidebar-gesture-ignore":"",className:`relative z-10 min-h-0 flex-1 overflow-hidden bg-[var(--chrome-bg)] ${M?"":"hidden"}`,style:{touchAction:M&&J==="trackpad"&&!p?"none":void 0},"aria-label":e("computer.remoteTitle"),children:M&&J==="trackpad"&&!p&&t.jsx("div",{ref:De,hidden:!0,"aria-hidden":"true",className:"pointer-events-none absolute left-0 top-0 z-20 h-5 w-5 will-change-transform",children:t.jsx(Qe,{size:20,strokeWidth:2,className:"fill-background text-primary drop-shadow"})})}),t.jsx("div",{hidden:v!=="tools",children:M&&!p&&t.jsx("p",{className:"shrink-0 border-t border-border px-2 py-1 text-[10px] leading-relaxed text-muted-foreground",children:e(J==="trackpad"?"computer.trackpadHint":"computer.directTouchHint")})}),M&&v==="keyboard"&&!p&&t.jsx(Mt,{sendText:it,sendKey:r=>he(oe[r])}),M&&v==="clipboard"&&!p&&t.jsxs("form",{className:"shrink-0 space-y-2 border-t border-border p-3",onSubmit:r=>{if(r.preventDefault(),!(!we||!_.current))try{_.current.clipboardPasteFrom(we),be(!0)}catch{b("computer.clipboardFailed")}},children:[t.jsx("textarea",{className:`${ie} min-w-0 resize-none py-2 text-base`,rows:2,"aria-label":e("computer.clipboard"),placeholder:e("computer.clipboardPlaceholder"),value:we,onChange:r=>{Pe(r.target.value),be(!1)},maxLength:16384}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx("button",{type:"submit",className:`${ae} min-h-11 flex-1`,disabled:!we,children:e("computer.clipboard")}),t.jsx("button",{type:"button",className:`${ae} min-h-11`,onClick:()=>he(oe.paste),children:ge})]}),t.jsx("p",{role:"status",className:"text-[10px] leading-relaxed text-muted-foreground",children:nt?e("computer.clipboardSent"):e("computer.clipboardHint",{shortcut:ge})}),k&&t.jsx("p",{role:"alert",className:"text-xs text-destructive",children:e(k)})]}),M&&t.jsxs("div",{className:`relative z-30 grid shrink-0 ${v==="keyboard"?"grid-cols-5":"grid-cols-4"} border-t border-border bg-surface px-1 py-1 text-[11px]`,children:[t.jsxs("button",{type:"button",className:`flex min-h-11 flex-col items-center justify-center gap-0.5 rounded-md ${v==="keyboard"?"bg-surface-2 text-primary":""}`,disabled:p,onClick:()=>Te("keyboard"),"aria-pressed":v==="keyboard",children:[t.jsx(ft,{size:18}),e("computer.keyboard")]}),t.jsxs("button",{type:"button",className:`flex min-h-11 flex-col items-center justify-center gap-0.5 rounded-md ${v==="clipboard"?"bg-surface-2 text-primary":""}`,disabled:p,onClick:()=>Te("clipboard"),"aria-pressed":v==="clipboard",children:[t.jsx(ht,{size:18}),e("computer.clipboardTool")]}),v==="keyboard"?t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",className:"min-h-11 rounded-md text-sm",onPointerDown:r=>r.preventDefault(),onClick:()=>he([[65289,"Tab"]]),children:"Tab"}),t.jsx("button",{type:"button",className:"min-h-11 rounded-md text-lg",onPointerDown:r=>r.preventDefault(),onClick:()=>he(oe.backspace),children:"⌫"}),t.jsx("button",{type:"button",className:"min-h-11 rounded-md text-lg",onPointerDown:r=>r.preventDefault(),onClick:()=>he(oe.enter),children:"↵"})]}):t.jsxs(t.Fragment,{children:[t.jsxs("button",{type:"button",className:"flex min-h-11 flex-col items-center justify-center gap-0.5 rounded-md",onClick:()=>{x(r=>({...r,fit:!r.fit})),d()},children:[t.jsx(wt,{size:18}),e(E?"computer.zoom":"computer.fit")]}),t.jsxs("button",{type:"button",className:"flex min-h-11 flex-col items-center justify-center gap-0.5 rounded-md",disabled:p,onClick:()=>Ye(J==="trackpad"?"direct":"trackpad"),"aria-label":e("computer.switchTouchMode"),children:[t.jsx(Qe,{size:18}),e(J==="trackpad"?"computer.trackpadMode":"computer.directTouchMode")]})]})]})]});return T?mt.createPortal(Be,document.body):Be}const Ht=Object.freeze(Object.defineProperty({__proto__:null,default:Dt},Symbol.toStringTag,{value:"Module"}));export{Ht as C,It as c};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{bv as t}from"./app-
|
|
1
|
+
import{bv as t}from"./app-B6FdOF6K.js";import{C as s}from"./ChangeWalkthroughPanel-D1Puc7B3.js";import"./react-XDCjal2T.js";import"./dnd-BCFAPC0L.js";import"./terminal-C7X98Amf.js";import"./sparkles-Cg-yPdE2.js";import"./triangle-alert-CbMRJ6sx.js";const e="/tmp/termdock-dag-playground",i={version:1,id:"dag-playground",repoRoot:e,workspaceRoot:e,title:"改动解释升级为可点击导览",summary:"这是一页免登录 playground,用真实 ChangeWalkthroughPanel 调 DAG 的节点、边、label 和密度。",generatedBy:"dag-playground",injectedAt:Date.now(),highlights:[{what:"先看总览,再看链路",effect:"读者不用先进入 diff,也能理解整批改动目的。",tag:"理解"},{what:"多条链路直接画出来",effect:"分支、汇合、验证路径不再靠 next 文本猜。",tag:"链路"},{what:"点击节点跳回证据",effect:"导览和真实 diff 之间形成闭环。",tag:"导航"}],nodes:[{id:"export",title:"导出 section 级 diff",kind:"source",business:"CLI 把 hunk 拆成多个连续改动 section,并为每个 section 生成稳定 fingerprint。这里故意写长一点,用来验证 DAG 节点是否会按照真实文本高度撑开,而不是被固定高度裁掉。",anchor:{repoRoot:e,filePath:"src/server/cli.ts",hunkIndex:0,sectionIndex:0}},{id:"prompt",title:"约束 AI 输出",kind:"process",business:"提示词要求先写总览,再逐 section 生成解释。",anchor:{repoRoot:e,filePath:"src/lib/components/sidebar/RightSidebar.tsx",hunkIndex:0}},{id:"schema",title:"校验导览结构",kind:"process",business:"检查节点、边和锚点字段是否完整。",anchor:{repoRoot:e,filePath:"src/server/utils/changeAuditStore.ts",hunkIndex:0}},{id:"fallback",title:"补齐兼容字段",kind:"process",business:"旧版结果缺字段时生成稳定回退值。",anchor:{repoRoot:e,filePath:"src/server/utils/changeAuditStore.ts",hunkIndex:1}},{id:"store",title:"保存整批导览结构",kind:"process",business:"服务端把 walkthrough 作为一等数据持久化。",anchor:{repoRoot:e,filePath:"src/server/utils/changeAuditStore.ts",hunkIndex:0}},{id:"api",title:"前端读取总览",kind:"api",business:"一次请求拿到 records 和 walkthroughs。",anchor:{repoRoot:e,filePath:"src/lib/terminal/api.ts",hunkIndex:0}},{id:"panel",title:"渲染 DAG 导览",kind:"ui",business:"用节点和边表达实现链路,节点可点击。节点内容可能是一两句话,也可能包含较长的业务解释;布局需要先测量 DOM 高度,再重新计算每一行节点的 y 坐标和连线端点。",anchor:{repoRoot:e,filePath:"src/lib/components/sidebar/ChangeWalkthroughPanel.tsx",hunkIndex:0}},{id:"jump",title:"跳回真实 diff",kind:"ui",business:"点击节点后定位到文件、hunk 或 section。",anchor:{repoRoot:e,filePath:"src/lib/components/sidebar/RightSidebar.tsx",hunkIndex:1}},{id:"section",title:"贴近改动展示解释",kind:"ui",business:"section 解释跟在对应 diff 块后面,而不是堆在 hunk 顶部。这个节点也故意写得更长,用来观察右侧分支和下方验证节点的连线是否会避让变高后的卡片。",anchor:{repoRoot:e,filePath:"src/lib/components/sidebar/DiffViewer.tsx",hunkIndex:0,sectionIndex:1}},{id:"verify",title:"验证导出和注入",kind:"test",business:"跑 lint、install、health、资源检查和注入自测。"}],edges:[{from:"export",to:"prompt",label:"提供输入",desc:"sectionFingerprint 让 AI 可以稳定引用。"},{from:"export",to:"schema",label:"结构校验",desc:"先确认输入可以稳定落库。"},{from:"export",to:"fallback",label:"兼容旧数据",desc:"为历史记录补齐必要字段。"},{from:"prompt",to:"store",label:"注入",desc:"AI payload 写回本地服务。"},{from:"schema",to:"store",label:"通过后保存",desc:"合法结构进入存储层。"},{from:"fallback",to:"store",label:"归一化后保存",desc:"兼容数据与新数据走同一链路。"},{from:"store",to:"api",label:"读取",desc:"浏览器从服务端拿到导览。"},{from:"api",to:"panel",label:"渲染",desc:"结构化数据变成导览图。"},{from:"panel",to:"jump",label:"点击",desc:"节点驱动 diff 定位。"},{from:"jump",to:"section",label:"定位",desc:"落到对应 section 解释。"},{from:"export",to:"verify",label:"验证",desc:"导出结构要覆盖 tracked/untracked。"},{from:"section",to:"verify",label:"回归",desc:"确认展示位置和交互。"}],sections:[],risks:[{title:"边和 label 不能遮住节点主体。"},{title:"窄侧栏下横向滚动要可控。"}],checks:["在 360px、560px、900px 宽度下截图检查。","确认边的箭头、label 背板和节点层级清楚。","确认节点点击区域和 hover 状态可感知。"]};function p(){return t.jsx("div",{className:"min-h-screen bg-background p-5 text-foreground","data-dag-playground":!0,children:t.jsxs("div",{className:"mx-auto max-w-[72rem]",children:[t.jsxs("div",{className:"mb-3",children:[t.jsx("h1",{className:"text-sm font-semibold",children:"DAG Playground"}),t.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Auth-free playground for tuning the real ChangeWalkthroughPanel."})]}),t.jsxs("div",{className:"grid gap-4 lg:grid-cols-[360px_minmax(0,1fr)]",children:[t.jsx("div",{className:"min-w-0",children:t.jsx(s,{walkthroughs:[i],repoRoot:e,onNavigate:o=>{console.info("[DagPlayground] navigate",o)}})}),t.jsx("div",{className:"min-w-0",children:t.jsx(s,{walkthroughs:[i],repoRoot:e,onNavigate:o=>{console.info("[DagPlayground] navigate",o)}})})]})]})})}export{p as DagPlayground};
|
|
Binary file
|
|
Binary file
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{bv as e}from"./app-
|
|
1
|
+
import{bv as e}from"./app-B6FdOF6K.js";import{b as a}from"./dnd-BCFAPC0L.js";import{c as M,S as _,D as T}from"./DiffViewer-BuQwFQ4V.js";import"./react-XDCjal2T.js";import"./terminal-C7X98Amf.js";import"./referenceLongPress-bZ0xp-v2.js";const w=`diff --git a/CommentGap.kt b/CommentGap.kt
|
|
2
2
|
--- a/CommentGap.kt
|
|
3
3
|
+++ b/CommentGap.kt
|
|
4
4
|
@@ -1,4 +1,4 @@
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ae as Ye,bv as r,e as dt,d as ft,d6 as ht,dj as mt,at as pt,a as xt,di as gt,bP as vt,X as bt}from"./app-CXvK8WZg.js";import{b as o,r as Je}from"./dnd-BCFAPC0L.js";import{h as Ze,F as yt,b as wt,c as Ke}from"./gestureArbiter-Cy5v_ZUL.js";import{S as et}from"./sparkles-BBYDWqCu.js";import{D as kt,i as Rt}from"./DiffViewer-DRnuph7U.js";const jt=[["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"M3 10a2 2 0 0 0 2 2h3",key:"1npucw"}],["path",{d:"M3 5v12a2 2 0 0 0 2 2h3",key:"x1gjn2"}]],Nt=Ye("list-tree",jt);const Mt=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],Tt=Ye("list",Mt);function tt({selected:t,depth:n=0,title:c,leading:m,children:h,trailing:i,role:y,tabIndex:x,ariaExpanded:g,onClick:f,onKeyDown:b,onPointerDown:z,onPointerUp:T,onPointerCancel:F,dataAttributes:B}){return r.jsxs("div",{role:y,tabIndex:x,"aria-expanded":g,title:c,onClick:f,onKeyDown:b,onPointerDown:z,onPointerUp:T,onPointerCancel:F,...B,className:`group flex w-full cursor-pointer items-center gap-1 rounded px-2 py-1.5 text-left text-[13px] transition active:scale-[0.99] ${t?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,style:{paddingLeft:`${n*14+8}px`},children:[r.jsx("span",{className:"flex min-w-[14px] shrink-0 items-center justify-center text-muted-foreground/80",children:m}),r.jsx("span",{className:"min-w-0 flex-1",children:h}),i]})}function rt(t){return t.path.replace(/^\/+/,"")}function Dt(t){if(t.displayName!==void 0||t.displayDir!==void 0)return{name:t.displayName||t.path,dir:t.displayDir||""};const n=t.path.split("/").filter(Boolean);return{name:n.pop()||t.path,dir:n.join("/")}}function nt(t,n){const c=new Map,m=(i,y,x,g)=>{const f=i.get(y);if(f)return f;const b={path:x,name:y,childCount:0,directories:[],files:[]};return i.set(y,b),g?.directories.push(b),b};for(const i of t){const y=n(i).split("/").filter(Boolean);if(y.length<=1)continue;let x=c,g=null,f="";for(const b of y.slice(0,-1)){f=f?`${f}/${b}`:b;const z=m(x,b,f,g);g=z,x=new Map(z.directories.map(T=>[T.name,T]))}g?.files.push(i)}const h=i=>{const y=i.directories.map(h).sort((g,f)=>g.name.localeCompare(f.name)),x=i.files.sort((g,f)=>g.path.localeCompare(f.path));return{...i,directories:y,files:x,childCount:y.reduce((g,f)=>g+f.childCount,0)+x.length}};return Array.from(c.values()).map(h).sort((i,y)=>i.name.localeCompare(y.name))}function Pe(t,n,c=0){const m=n.selectedKey===t.key||n.selectedKey===t.path||n.selectedKey===t.absolutePath,h=Dt(t);return r.jsx(tt,{selected:m,role:"button",tabIndex:0,title:t.title??t.absolutePath??t.path,onClick:()=>{Ze()||n.onSelectFile(t)},onKeyDown:i=>{i.key!=="Enter"&&i.key!==" "||(i.preventDefault(),n.onSelectFile(t))},leading:n.renderLeading(t),depth:c,trailing:n.renderTrailing?.(t),dataAttributes:{"data-diff-selection-path":t.key,"data-diff-file-path":t.path,"data-diff-absolute-path":t.absolutePath??"","data-diff-status":t.status},children:r.jsxs("span",{className:"select-text","data-sidebar-selectable":!0,children:[r.jsx("span",{className:`block truncate leading-snug ${m?"font-medium":""}`,children:h.name}),n.mode!=="tree"&&h.dir&&r.jsx("span",{className:"block truncate text-[10px] text-muted-foreground/75",children:h.dir}),n.renderSubtitle?.(t)]})},t.key)}function st(t,n,c,m,h){let i=t;const y=[t.name];for(;i.files.length===0&&i.directories.length===1;)i=i.directories[0],y.push(i.name);const x=y.join("/"),g=`${n}:${i.path}`,f=c.collapsedDirectoryKeys.has(g);return r.jsxs("div",{className:"space-y-px",children:[r.jsx(tt,{role:"button",tabIndex:0,onClick:()=>{Ze()||c.onToggleDirectory(g)},onKeyDown:b=>{b.key!=="Enter"&&b.key!==" "||(b.preventDefault(),c.onToggleDirectory(g))},ariaExpanded:!f,depth:m,title:i.path,leading:f?r.jsx(dt,{size:13}):r.jsx(ft,{size:13}),trailing:r.jsxs("span",{className:"flex shrink-0 items-center gap-1",children:[r.jsx("span",{className:"shrink-0 rounded bg-surface-2 px-1.5 py-0.5 text-[10px] text-muted-foreground/60 transition group-hover:text-muted-foreground",children:i.childCount}),c.renderDirectoryTrailing?.(i.path,h)]}),children:r.jsxs("span",{className:"flex min-w-0 items-center gap-1",children:[r.jsx(yt,{size:14,className:"shrink-0 text-[color:var(--folder)]"}),r.jsx("span",{className:"min-w-0 flex-1 truncate leading-snug select-text","data-sidebar-selectable":!0,children:x})]})}),!f&&r.jsxs("div",{className:"space-y-px",children:[i.directories.map(b=>st(b,n,c,m+1,h)),i.files.length>0&&r.jsx("div",{className:"space-y-px",children:i.files.map(b=>Pe(b,c,m+1))})]})]},g)}function St(t,n){const c=n.getFileTreePath??rt,m=t.files.filter(i=>c(i).split("/").filter(Boolean).length<=1),h=nt(t.files,c);return r.jsxs("div",{className:"space-y-px",children:[h.map(i=>st(i,t.key,n,0,t)),m.length>0&&r.jsx("div",{className:"space-y-px",children:m.map(i=>Pe(i,n))})]})}function It(t,n=rt){const c=[],m=i=>{for(const y of i.directories)m(y);c.push(...i.files)};for(const i of nt(t,n))m(i);const h=new Set(c.map(i=>i.key));return c.push(...t.filter(i=>!h.has(i.key))),c}function Et(t){return r.jsx("div",{className:t.mode==="tree"?"space-y-px pt-1":"space-y-2",children:t.groups.map(n=>{const c=!!n.header,m=!!n.collapsed;return r.jsxs("section",{className:c?"overflow-hidden rounded-lg border border-border/15 bg-surface/60":"",children:[n.header,!m&&r.jsx("div",{className:t.mode==="tree"?c?"space-y-px bg-surface/60 p-1":"space-y-px":c?"space-y-px bg-surface/60 p-1.5":"space-y-px",children:t.mode==="tree"?St(n,t):n.files.map(h=>Pe(h,t))})]},n.key)})})}const Ce="termdock:diff-review:list-width:v1",Ct=120,He=320,qe=220,Ft=560;function _t(t){return typeof t=="number"&&Number.isFinite(t)}function Ue(t,n){const c=Math.max(qe,n-360),m=Math.min(Ft,c);return Math.min(m,Math.max(qe,t))}function At(){return vt(Ce,_t)??He}function zt({list:t,detail:n,mobile:c,mobileListHeader:m,mobileDetailHeader:h,desktopListHeader:i,backLabel:y,onMobileSlideChange:x,externalSwiperRef:g,desktopLayout:f="split",onDetailScroll:b,desktopSidePanel:z,desktopListClassName:T,detailOwnsScroll:F=!1}){const{t:B}=ht(),P=o.useRef(null),q=o.useRef(null),I=o.useRef(null),[U,$]=o.useState(At);o.useEffect(()=>{if(c||f!=="split")return;const p=q.current;p&&$(j=>Ue(j,p.clientWidth))},[f,c]);const ae=o.useCallback(p=>{c||f!=="split"||(p.preventDefault(),I.current={startX:p.clientX,startWidth:U,pointerId:p.pointerId},p.currentTarget.setPointerCapture(p.pointerId))},[f,U,c]),ue=o.useCallback(p=>{const j=I.current;if(!j||j.pointerId!==p.pointerId)return;const D=q.current?.clientWidth??window.innerWidth,_=Ue(j.startWidth+p.clientX-j.startX,D);$(_),mt(Ce,_,Ct)},[]),ie=o.useCallback(p=>{const j=I.current;if(!(!j||j.pointerId!==p.pointerId)){I.current=null,pt(Ce);try{p.currentTarget.releasePointerCapture(p.pointerId)}catch{}}},[]);if(c){const p=()=>{const v=P.current;v&&v.slideTo(1)},j=()=>{const v=P.current;v&&v.slideTo(0)},D=typeof t=="function"?t({slideToDetail:p}):t,_=typeof h=="function"?h({slideToList:j,slideToDetail:p}):h;return r.jsxs(wt,{className:"h-full min-h-0 w-full",slidesPerView:1,resistanceRatio:.45,noSwiping:!0,noSwipingClass:"swiper-no-swiping",noSwipingSelector:".swiper-no-swiping",allowTouchMove:!1,touchAngle:75,touchStartPreventDefault:!1,onSwiper:v=>{P.current=v,g&&(g.current=v)},onSlideChange:v=>{x?.(v.activeIndex)},children:[r.jsx(Ke,{className:"h-full min-h-0",children:r.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:[m&&r.jsx("div",{className:"shrink-0 border-b border-border/15 px-3 py-2",children:m}),r.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain",children:D})]})}),r.jsx(Ke,{className:"h-full min-h-0",children:r.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden bg-surface",children:[r.jsx("div",{className:"shrink-0 border-b border-border/15 px-3 py-2",children:_??r.jsxs("button",{type:"button",onClick:j,className:"inline-flex h-9 shrink-0 items-center gap-1.5 rounded-full bg-surface-2 px-3 text-xs font-semibold text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground active:scale-95",children:[r.jsx(xt,{size:14}),y]})}),r.jsx("div",{className:F?"min-h-0 flex-1 overflow-hidden":"termdock-diff-stream-scroller min-h-0 flex-1 overflow-y-auto overscroll-contain",onScroll:F?void 0:v=>b?.(v.currentTarget),children:n})]})})]})}const W=typeof t=="function"?t({slideToDetail:()=>{}}):t;return f==="stacked"?F?r.jsxs("div",{className:"termdock-native-select min-h-0 flex-1 overflow-hidden px-2 pb-[calc(env(safe-area-inset-bottom)+4.5rem)]",children:[i&&r.jsx("div",{className:"sticky top-0 z-10 border-b border-border/15 bg-surface px-2 py-2",children:i}),W,r.jsx("div",{className:"mt-3 h-[calc(100%-3rem)] min-h-0 overflow-hidden rounded-xl border border-border/15 bg-surface",children:n})]}):r.jsxs("div",{className:"termdock-native-select termdock-diff-stream-scroller min-h-0 flex-1 overflow-y-auto overscroll-contain px-2 pb-[calc(env(safe-area-inset-bottom)+4.5rem)]",onScroll:p=>b?.(p.currentTarget),children:[i&&r.jsx("div",{className:"sticky top-0 z-10 border-b border-border/15 bg-surface px-2 py-2",children:i}),W,r.jsx("div",{className:"mt-3 overflow-hidden rounded-xl border border-border/15 bg-surface",children:n})]}):r.jsxs("div",{ref:q,className:"flex h-full min-h-0 overflow-hidden",children:[z,r.jsxs("div",{className:T??"shrink-0 overflow-y-auto overscroll-contain border-r border-border/15 bg-surface",style:{width:U},children:[i&&r.jsx("div",{className:"sticky top-0 z-10 border-b border-border/15 bg-surface px-2 py-2",children:i}),W]}),r.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":B("diffViewer.resizeNavigation"),title:B("diffViewer.resizeNavigation"),className:"group relative z-10 w-2 shrink-0 cursor-col-resize touch-none border-r border-border/15 bg-surface",onPointerDown:ae,onPointerMove:ue,onPointerUp:ie,onPointerCancel:ie,onDoubleClick:()=>{$(He),gt(Ce,He)},children:r.jsx("span",{className:"pointer-events-none absolute inset-y-0 left-1/2 w-px -translate-x-1/2 bg-border/30 transition group-hover:bg-primary/60"})}),r.jsx("div",{className:F?"min-w-0 flex-1 overflow-hidden":"termdock-diff-stream-scroller min-w-0 flex-1 overflow-y-auto overscroll-contain",onScroll:F?void 0:p=>b?.(p.currentTarget),children:n})]})}function Lt({mode:t,onModeChange:n,showAi:c=!1}){return r.jsxs("div",{className:"inline-flex h-7 shrink-0 overflow-hidden rounded-md bg-surface-2 p-0.5",children:[r.jsx("button",{type:"button",onClick:()=>n("list"),"aria-pressed":t==="list",className:`inline-flex h-6 w-7 items-center justify-center rounded-md transition active:scale-95 ${t==="list"?"bg-surface-elevated text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:r.jsx(Tt,{size:13})}),r.jsx("button",{type:"button",onClick:()=>n("tree"),"aria-pressed":t==="tree",className:`inline-flex h-6 w-7 items-center justify-center rounded-md transition active:scale-95 ${t==="tree"?"bg-surface-elevated text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:r.jsx(Nt,{size:13})}),c&&r.jsx("button",{type:"button",onClick:()=>n("ai"),"aria-pressed":t==="ai",className:`inline-flex h-6 w-7 items-center justify-center rounded-md transition active:scale-95 ${t==="ai"?"bg-surface-elevated text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:r.jsx(et,{size:13})})]})}function Ht({groups:t,mode:n,onModeChange:c,selectedKey:m,collapsedDirectoryKeys:h,onToggleDirectory:i,onSelectFile:y,renderLeading:x,renderTrailing:g,renderDirectoryTrailing:f,renderSubtitle:b,detail:z,mobile:T,backLabel:F,compact:B=!1,emptyContent:P,listPrefix:q,aiContent:I,listContainerClassName:U="px-2 py-2",detailContainerClassName:$="termdock-native-select termdock-diff-stream-scroller min-h-0",renderListHeader:ae,renderMobileDetailHeader:ue,externalSwiperRef:ie,onMobileSlideChange:W,slideToDetailOnMobile:p=!0,desktopLayout:j="split",onDetailScroll:D,desktopSidePanel:_,desktopListClassName:v,detailOwnsScroll:ee}){const[V,O]=o.useState(!1);o.useEffect(()=>{if(!V)return;const A=L=>{L.key==="Escape"&&O(!1)};return document.addEventListener("keydown",A),()=>document.removeEventListener("keydown",A)},[V]);const de=r.jsx(Lt,{mode:n,onModeChange:c,showAi:!!I}),pe=n==="tree"?"tree":"list",xe=ae?ae(de):r.jsx("div",{className:"flex justify-end",children:de}),ge=t.some(A=>A.files.length>0),te=r.jsx(zt,{mobile:V?!1:T,backLabel:F,externalSwiperRef:ie,onMobileSlideChange:W,desktopLayout:V?"split":j,onDetailScroll:D,desktopSidePanel:_,desktopListClassName:v,detailOwnsScroll:ee,mobileListHeader:T?xe:void 0,desktopListHeader:T?void 0:xe,mobileDetailHeader:ue,list:({slideToDetail:A})=>r.jsx("div",{className:U,children:n==="ai"?typeof I=="function"?I({slideToDetail:A,fullscreen:V,toggleFullscreen:()=>O(L=>!L)}):I??P:r.jsxs(r.Fragment,{children:[q,ge?r.jsx(Et,{groups:t,selectedKey:m,mode:pe,mobile:T,compact:B,collapsedDirectoryKeys:h,onToggleDirectory:i,onSelectFile:L=>{y(L),T&&p&&window.requestAnimationFrame(A)},renderLeading:x,renderTrailing:g,renderDirectoryTrailing:f,renderSubtitle:b}):P]})}),detail:r.jsx("div",{className:ee?"h-full min-h-0":$,children:z})});return!V||typeof document>"u"?te:Je.createPortal(r.jsxs("div",{className:"fixed inset-0 z-modal-panel flex min-h-0 flex-col bg-surface text-foreground",children:[r.jsxs("div",{className:"flex h-12 shrink-0 items-center justify-between border-b border-border/15 bg-[var(--chrome-bg)] px-3",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[r.jsx(et,{size:15,className:"shrink-0 text-primary"}),r.jsx("span",{className:"truncate text-[12px] font-semibold",children:"DAG Review"}),r.jsx("span",{className:"hidden text-[10px] text-muted-foreground sm:inline",children:"Select a step to inspect its exact change"})]}),r.jsx("button",{type:"button",onClick:()=>O(!1),className:"inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-muted-foreground transition hover:bg-surface-2 hover:text-foreground active:scale-95",title:"Exit full-screen DAG review (Esc)","aria-label":"Exit full-screen DAG review",children:r.jsx(bt,{size:16})})]}),r.jsx("div",{className:"min-h-0 flex-1",children:te})]}),document.body)}const Pt=96,ze=44;function Wt({file:t,repoRoot:n,selectionPath:c,displayName:m,displayDir:h,selected:i,activePane:y,visible:x,reusableContent:g=!1,estimatedHeight:f,lightweight:b=!1,wrap:z,viewType:T,inlineMode:F,diffOptions:B,reloadKey:P=0,auditRecords:q,diffOverride:I,oldSourceRef:U,preparedDiff:$,renderBadge:ae,onInsertDiffReference:ue,onHunkGitAction:ie,previewReverts:W,onReferenceCopied:p,insertedReferenceKey:j,copiedReferenceKey:D,onClearAuditRecord:_,onContentReady:v,onHeightChange:ee}){const V=o.useRef(null),O=o.useRef(null),de=o.useRef(null),[pe,xe]=o.useState(null),ge=o.useRef(64),te=o.useRef(f??104),A=o.useRef(null),L=o.useRef(null),Q=o.useRef(!1),le=o.useRef(!1),E=o.useRef(null),[re,je]=o.useState(!1),[Ne,Se]=o.useState(!1),ve=t.absolutePath||(n?`${n}/${t.path}`:t.path),N=o.useCallback(()=>{le.current||(le.current=!0,Se(!0),v?.(c))},[v,c]);o.useLayoutEffect(()=>{if(!(I!==void 0&&x&&le.current))return Q.current=!1,le.current=!1,A.current=null,L.current=null,E.current!==null&&(window.clearTimeout(E.current),E.current=null),je(!1),Se(!1),()=>{E.current!==null&&(window.clearTimeout(E.current),E.current=null)}},[I,$,P,g,x]),o.useLayoutEffect(()=>{const X=A.current;!re||X===null||Math.abs((f??104)-X)>=1||(A.current=null,N())},[N,f,re]),o.useLayoutEffect(()=>{if(!x||!re)return;const X=de.current;if(!X)return;const be=()=>{if(!Q.current)return;const Y=X.firstElementChild;if(!Y)return;const K=Math.ceil(Math.max(Y.getBoundingClientRect().height,Y.scrollHeight,64)),he=ge.current;if(K>0&&he!==K&&(ge.current=K,xe(K)),!V.current)return;const C=O.current?.getBoundingClientRect().height??ze,se=Math.ceil(C+K+1);se<=0||L.current===se||(L.current=se,E.current!==null&&window.clearTimeout(E.current),E.current=window.setTimeout(()=>{if(E.current=null,!Q.current)return;const H=L.current;if(H===null)return;const S=te.current;if(le.current){te.current=H,Math.abs(S-H)>=1&&ee?.(c,S,H),v?.(c);return}if(A.current=H,Math.abs(S-H)<1||!ee){te.current=H,A.current=null,N();return}te.current=H,ee(c,S,H)},Pt))};if(be(),typeof ResizeObserver>"u")return;const fe=new ResizeObserver(be);return fe.observe(X),X.firstElementChild&&fe.observe(X.firstElementChild),O.current&&fe.observe(O.current),()=>fe.disconnect()},[N,v,ee,c,re,x,z,T,F]);const G=x&&!Ne;return r.jsxs("div",{ref:V,"data-diff-stream-item":c,"data-diff-selection-path":c,"data-diff-file-path":t.path,"data-diff-absolute-path":ve,className:`scroll-mt-3 border-b border-border/15 last:border-b-0 ${G||!x?"overflow-hidden":""} ${i?"bg-surface-elevated/35":""}`,style:x?G?{height:f??104}:void 0:{height:f??104},children:[r.jsxs("div",{ref:O,"data-diff-stream-header":!0,className:`sticky top-0 z-10 flex min-w-0 items-center gap-2 border-b border-border/15 px-3 py-2 ${i?"bg-surface-elevated":"bg-surface"}`,children:[ae(t.status),r.jsxs("div",{className:"min-w-0 flex-1",title:ve,children:[r.jsx("div",{className:"truncate text-xs font-semibold text-foreground",children:m}),h&&r.jsx("div",{className:"truncate text-[10px] text-muted-foreground",children:h})]})]}),r.jsxs("div",{ref:de,className:"relative","data-diff-stream-body":!0,style:x?{minHeight:Ne?64:Math.max(pe??64,(f??104)-ze)}:{height:Math.max(pe??64,(f??104)-ze)},children:[x?r.jsx(kt,{active:y,repoRoot:n,filePath:t.path,referenceFilePath:ve,changedFile:t,wrap:z,viewType:T,inlineMode:F,diffOptions:B,reloadKey:P,embedded:!0,lightweight:b,auditRecords:q,diffOverride:I,oldSourceRef:U,preparedDiff:$,onClearAuditRecord:_,onContentReady:()=>{if(g){Q.current=!0,je(!0),N();return}Q.current||(Q.current=!0,je(!0))},onInsertDiffReference:ue,onHunkGitAction:ie,previewReverts:W,onReferenceCopied:p,insertedReferenceKey:j,copiedReferenceKey:D}):r.jsx("div",{className:"flex h-full min-h-16 items-center justify-center bg-surface px-3 py-4 text-center text-xs text-muted-foreground",children:t.path}),x&&re&&!Ne&&r.jsx("div",{"data-diff-measuring-overlay":!0,className:"absolute inset-0 z-20 bg-surface"})]})]})}const Oe=8,Le=1600,Qe=104,Bt=1e3,Re=new Map;function $t(t,n){for(Re.delete(t),Re.set(t,n);Re.size>Bt;){const c=Re.keys().next().value;if(c===void 0)break;Re.delete(c)}}function Vt(t,n){return!!(t&&t.diffOverride===n.diffOverride&&t.oldSourceRef===n.oldSourceRef&&t.reloadKey===n.reloadKey&&t.wrap===n.wrap&&t.viewType===n.viewType&&t.inlineMode===n.inlineMode&&t.algorithm===n.algorithm&&t.whitespace===n.whitespace&&t.context===n.context)}const Gt={added:{label:"A",className:"text-[color:var(--diff-insert-strong)]",title:"Added"},modified:{label:"M",className:"text-[color:var(--diff-hunk-accent)]",title:"Modified"},deleted:{label:"D",className:"text-[color:var(--diff-delete-strong)]",title:"Deleted"},renamed:{label:"R",className:"text-muted-foreground",title:"Renamed"},copied:{label:"C",className:"text-[color:var(--diff-insert-strong)]",title:"Copied"},untracked:{label:"U",className:"text-[color:var(--diff-insert-strong)]",title:"Untracked (new file)"},conflicted:{label:"!",className:"text-destructive",title:"Conflicted"},unknown:{label:"?",className:"text-muted-foreground",title:"Unknown"}};function Zt({status:t}){const n=Gt[t]??{label:"?",className:"text-muted-foreground",title:t};return r.jsx("span",{className:`w-4 shrink-0 text-center text-[10px] font-mono font-bold ${n.className}`,title:n.title,children:n.label})}function er(t,n){return n?{key:n,nonce:t.nonce+1}:t}function tr({files:t,groups:n,selectedKey:c,onSelectFile:m,mode:h,onModeChange:i,collapsedDirectoryKeys:y,onToggleDirectory:x,renderLeading:g,renderTrailing:f,renderDirectoryTrailing:b,renderSubtitle:z,renderStreamBadge:T,onInsertDiffReference:F,onHunkGitAction:B,onReferenceCopied:P,insertedReferenceKey:q,copiedReferenceKey:I,onClearAuditRecord:U,mobile:$,backLabel:ae,compact:ue,desktopLayout:ie,wrap:W,diffViewType:p,inlineMode:j,diffOptions:D,activePane:_,reloadKey:v=0,renderListHeader:ee,renderMobileDetailHeader:V,emptyContent:O,listPrefix:de,aiContent:pe,listContainerClassName:xe,detailContainerClassName:ge,desktopSidePanel:te,desktopListClassName:A,onDetailScroll:L,initialDetailScrollTop:Q,preserveScrollOnUpdate:le=!1,scrollToKey:E,scrollToKeyNonce:re=0,externalSwiperRef:je,onMobileSlideChange:Ne,slideToDetailOnMobile:Se}){const ve=o.useMemo(()=>e=>c===e.key||c===e.path||c===e.absolutePath,[c]),N=o.useMemo(()=>{const e=new Map;for(const a of t)e.set(a.key,a),a.path&&e.set(a.path,a),a.absolutePath&&e.set(a.absolutePath,a);const s=[],l=new Set;for(const a of n){const d=h==="tree"?It(a.files):a.files;for(const w of d){const u=e.get(w.key);!u||l.has(u.key)||(s.push(u),l.add(u.key))}}for(const a of t)l.has(a.key)||s.push(a);return s},[t,n,h]),G=o.useRef(null),X=o.useRef(null),be=o.useRef(null),fe=o.useRef(v),Y=o.useRef(0),K=o.useRef(null),he=o.useRef(new Map(Re)),ne=o.useRef({key:null,top:0}),C=o.useRef(new Set),se=o.useRef(new Map),H=o.useRef(new Map),S=o.useRef(null),We=o.useRef(()=>{}),Me=o.useRef([]),me=o.useRef(new Map),Be=o.useRef({tops:[],heights:[],bottom:0}),[Ie,ot]=o.useState(()=>new Set),[ct,at]=o.useState(0),[J,ye]=o.useState({top:0,height:0}),Te=o.useMemo(()=>N.map(e=>e.key),[N]),Ee=Te.join("");H.current=o.useMemo(()=>new Map(N.map(e=>[e.key,{diffOverride:e.diffOverride,oldSourceRef:e.oldSourceRef,reloadKey:v,wrap:W,viewType:p,inlineMode:j,algorithm:D?.algorithm,whitespace:D?.whitespace,context:D?.context}])),[N,v,W,p,j,D?.algorithm,D?.whitespace,D?.context]),Me.current=Te,me.current=o.useMemo(()=>new Map(Te.map((e,s)=>[e,s])),[Te]);const k=o.useMemo(()=>{const e=Te.map(a=>he.current.get(a)??Qe),s=new Array(e.length);for(let a=0;a<e.length;a+=1)s[a]=a===0?0:s[a-1]+e[a-1];const l=e.length>0?s[e.length-1]+e[e.length-1]:0;return{tops:s,heights:e,bottom:l}},[ct,Ee]);Be.current=k;const oe=o.useMemo(()=>E?N.find(e=>E===e.key||E===e.path||E===e.absolutePath)?.key??null:null,[N,E]),Fe=o.useMemo(()=>c?N.find(e=>c===e.key||c===e.path||c===e.absolutePath)?.key??null:null,[N,c]),De=o.useMemo(()=>{const e=k.tops.length;if(e===0)return-1;let s=0,l=e;for(;s<l;){const a=Math.floor((s+l)/2);k.tops[a]<=J.top+1?s=a+1:l=a}return Math.min(e-1,Math.max(0,s-1))},[k.tops,J.top]),ce=o.useCallback(e=>{C.current=e,ot(e)},[]),$e=o.useMemo(()=>{const e=J.top-Le,s=J.top+J.height+Le,l=new Set;let a=0,d=k.tops.length;for(;a<d;){const u=Math.floor((a+d)/2);k.tops[u]<=e?a=u+1:d=u}const w=Math.max(0,a-1);for(let u=w;u<k.tops.length;u+=1){const R=k.tops[u];if(R>s)break;R+k.heights[u]>=e&&R<=s&&l.add(u)}for(let u=De-1;u<=De+1;u+=1)u>=0&&u<k.tops.length&&l.add(u);for(const u of Ie){const R=me.current.get(u);R!==void 0&&l.add(R)}return Array.from(l).sort((u,R)=>u-R)},[k,J,Ie,De]),_e=o.useCallback(()=>{if(!_||S.current)return;const e=Me.current;if(e.length===0)return;const s=ne.current.key,l=Math.min(e.length-1,(s!==null?me.current.get(s):void 0)??Math.max(0,De)),a=u=>Math.abs((me.current.get(u)??0)-l),d=[];C.current.has(e[l])||d.push(e[l]);for(let u=1;u<=Oe;u+=1){const R=l+u,M=l-u;R<e.length&&!C.current.has(e[R])&&d.push(e[R]),M>=0&&!C.current.has(e[M])&&d.push(e[M])}const w=d[0];if(w){if(C.current.size>=Oe){const u=a(w),R=Array.from(C.current).filter(Z=>Z!==S.current).sort((Z,ke)=>a(ke)-a(Z))[0];if(!R||a(R)<=u)return;const M=new Set(C.current);M.delete(R),ce(M)}S.current=w,ce(new Set(C.current).add(w))}},[_,ce,De]);We.current=_e;const we=o.useCallback(e=>{if(C.current.has(e))return;const s=S.current;if(s&&s!==e){const l=new Set(C.current);l.delete(s),ce(l),S.current=null}S.current=e,ce(new Set(C.current).add(e))},[ce]),Ve=o.useCallback(e=>{if(!C.current.has(e))return;const s=H.current.get(e);s&&se.current.set(e,s),S.current===e&&(S.current=null),window.requestAnimationFrame(()=>We.current())},[]),Ge=o.useCallback((e,s,l)=>{if(Math.abs(l-s)<1)return;const a=he.current.get(e);a!==void 0&&Math.abs(a-l)<1||(he.current.set(e,l),$t(e,l),at(d=>d+1))},[]);o.useLayoutEffect(()=>{if(fe.current!==v){fe.current=v;for(const e of N){if(e.diffOverride!==void 0)continue;const s=qt(e.path,e.repoRoot);Rt(s,e.repoRoot??void 0,D)}}},[N,D,v]),o.useLayoutEffect(()=>{const e=G.current;if(!e)return;const s=()=>{const a=Math.max(0,Math.ceil(e.clientHeight));if(a===0)return;const d=e.scrollTop;ye(w=>w.height===a&&w.top===d?w:{top:d,height:a})};if(s(),typeof ResizeObserver>"u")return;const l=new ResizeObserver(s);return l.observe(e),()=>l.disconnect()},[$]),o.useEffect(()=>{_&&Fe&&we(Fe)},[_,we,Fe]),o.useEffect(()=>{const e=new Set(Me.current);for(const s of Array.from(he.current.keys()))e.has(s)||he.current.delete(s);for(const s of Array.from(C.current))if(!e.has(s)){const l=new Set(C.current);l.delete(s),ce(l)}for(const s of Array.from(se.current.keys()))e.has(s)||se.current.delete(s);if(S.current&&!e.has(S.current)&&(S.current=null),N.length===0){S.current=null,se.current.clear(),ce(new Set);return}_e()},[N.length,Ee,_e,$e,ce]);const Xe=o.useCallback(e=>{G.current=e;const s=Y.current,l=e.scrollTop;Y.current=l;const a=d=>{const w=Be.current,u=Me.current;let R=0,M=w.tops.length;for(;R<M;){const Ae=Math.floor((R+M)/2);w.tops[Ae]<=d+1?R=Ae+1:M=Ae}const Z=Math.min(u.length-1,Math.max(0,R-1)),ke=u[Z]??null;ne.current={key:ke,top:w.tops[Z]??0},ke&&we(ke)};Math.abs(l-s)>=Le?(Je.flushSync(()=>{ye({top:l,height:e.clientHeight})}),a(l)):K.current===null&&(K.current=window.requestAnimationFrame(()=>{K.current=null;const d=G.current;if(d){const w=d.scrollTop;ye({top:w,height:d.clientHeight}),a(w)}})),L?.(e)},[L,we]);o.useEffect(()=>()=>{K.current!==null&&window.cancelAnimationFrame(K.current)},[]),o.useLayoutEffect(()=>{const e=G.current;if(!e)return;const s=ne.current;if(s.key===null)return;const l=me.current.get(s.key);if(l===void 0)return;const a=(k.tops[l]??s.top)-s.top;if(Math.abs(a)<1)return;const d=e.scrollTop+a;Y.current=d,ye(w=>({top:d,height:w.height})),typeof e.scrollTo=="function"?e.scrollTo({top:d,behavior:"instant"}):e.scrollTop=d},[k]),o.useLayoutEffect(()=>{const e=Me.current,s=k.tops;if(e.length===0){ne.current={key:null,top:0};return}const l=Y.current,a=l+(G.current?.clientHeight??J.height),d=ne.current;if(d.key!==null){const M=me.current.get(d.key);if(M!==void 0){const Z=s[M]??0;if(Z+(k.heights[M]??Qe)>l&&Z<a){ne.current={key:d.key,top:Z};return}}}let w=0,u=s.length;for(;w<u;){const M=Math.floor((w+u)/2);s[M]<=l+1?w=M+1:u=M}const R=Math.min(s.length-1,Math.max(0,w-1));ne.current={key:e[R]??null,top:s[R]??0}}),o.useLayoutEffect(()=>{if(!oe)return;const e=X.current;if(e?.key===oe&&e.nonce===re)return;const s=me.current.get(oe);if(s===void 0)return;we(oe),ne.current={key:oe,top:k.tops[s]??0};const l=G.current;if(!l||l.clientHeight===0||J.height!==l.clientHeight)return;X.current={key:oe,nonce:re};const a=k.tops[s]??0;typeof l.scrollTo=="function"?l.scrollTo({top:a,behavior:"instant"}):l.scrollTop=a;const d=l.scrollTop;Y.current=d,ye({top:d,height:l.clientHeight})},[k,J.height,we,oe,re]),o.useLayoutEffect(()=>{if(Q===void 0||oe)return;const e=Ee;if(be.current===e||le&&be.current!==null)return;const s=G.current;if(!s)return;be.current=e;const l=Math.max(0,k.bottom-s.clientHeight),a=Math.min(Math.max(0,Q),l);typeof s.scrollTo=="function"?s.scrollTo({top:a,behavior:"instant"}):s.scrollTop=a;const d=s.scrollTop;Y.current=d,ye({top:d,height:s.clientHeight})},[k.bottom,Q,Ee,le,oe]);const it=o.useCallback((e,s)=>{const l=ve(e),a=H.current.get(e.key),d=a!==void 0&&Vt(se.current.get(e.key),a);return r.jsx(Xt,{item:e,repoRoot:e.repoRoot,selectionPath:e.key,displayName:e.displayName,displayDir:e.displayDir,selected:l,activePane:_,visible:Ie.has(e.key),reusableContent:d,estimatedHeight:s,lightweight:!1,wrap:W,viewType:p,inlineMode:j,diffOptions:D,reloadKey:v,auditRecords:e.auditRecords,diffOverride:e.diffOverride,oldSourceRef:e.oldSourceRef,renderStreamBadge:T,onInsertDiffReference:e.onInsertDiffReference??F,onHunkGitAction:e.onHunkGitAction??B,previewReverts:e.previewReverts,onReferenceCopied:P,insertedReferenceKey:q,copiedReferenceKey:I,onClearAuditRecord:U,onContentReady:Ve,onHeightChange:Ge})},[_,I,D,p,Ve,Ge,j,q,ve,Ie,U,B,F,P,v,T,W]),lt=r.jsx("div",{"data-diff-stream-content":!0,"data-diff-stream-canvas":!0,className:"termdock-diff-stream relative overflow-clip bg-surface will-change-transform",style:{height:Math.max(k.bottom,(k.tops.at(-1)??0)+J.height)},children:$e.map(e=>{const s=N[e];return s?r.jsx("div",{"data-diff-canvas-slot":s.key,className:"absolute inset-x-0",style:{top:k.tops[e]},children:it(s,k.heights[e])},s.key):null})}),ut=r.jsx("div",{ref:G,className:"termdock-diff-stream termdock-diff-stream-scroller h-full max-h-full min-h-0 overflow-y-auto overscroll-contain bg-surface [overflow-anchor:none]",onScroll:e=>Xe(e.currentTarget),children:lt});return r.jsx(Ht,{groups:n,mode:h,onModeChange:i,selectedKey:c,collapsedDirectoryKeys:y,onToggleDirectory:x,onSelectFile:m,renderLeading:g,renderTrailing:f,renderDirectoryTrailing:b,renderSubtitle:z,detail:ut,mobile:$,backLabel:ae,compact:ue,emptyContent:O,listPrefix:de,aiContent:pe,listContainerClassName:xe,detailContainerClassName:ge,renderListHeader:ee,renderMobileDetailHeader:V,externalSwiperRef:je,onMobileSlideChange:Ne,slideToDetailOnMobile:Se,desktopLayout:ie,onDetailScroll:Xe,desktopSidePanel:te,desktopListClassName:A,detailOwnsScroll:!0})}const Xt=o.memo(function({item:n,renderStreamBadge:c,...m}){return r.jsx(Wt,{...m,file:Kt(n),renderBadge:h=>c(h,n)})});function Kt(t){return{path:t.path,oldPath:t.oldPath,absolutePath:t.absolutePath,status:t.status}}function qt(t,n){if(t)return n&&t.startsWith(`${n}/`)?t.slice(n.length+1):t}export{Zt as C,tr as D,Nt as L,It as f,er as n};
|
|
1
|
+
import{ae as Ye,bv as r,e as dt,d as ft,d6 as ht,dj as mt,at as pt,a as xt,di as gt,bP as vt,X as bt}from"./app-B6FdOF6K.js";import{b as o,r as Je}from"./dnd-BCFAPC0L.js";import{h as Ze,F as yt,b as wt,c as Ke}from"./gestureArbiter-JW8vcVRm.js";import{S as et}from"./sparkles-Cg-yPdE2.js";import{D as kt,i as Rt}from"./DiffViewer-BuQwFQ4V.js";const jt=[["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"M3 10a2 2 0 0 0 2 2h3",key:"1npucw"}],["path",{d:"M3 5v12a2 2 0 0 0 2 2h3",key:"x1gjn2"}]],Nt=Ye("list-tree",jt);const Mt=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],Tt=Ye("list",Mt);function tt({selected:t,depth:n=0,title:c,leading:m,children:h,trailing:i,role:y,tabIndex:x,ariaExpanded:g,onClick:f,onKeyDown:b,onPointerDown:z,onPointerUp:T,onPointerCancel:F,dataAttributes:B}){return r.jsxs("div",{role:y,tabIndex:x,"aria-expanded":g,title:c,onClick:f,onKeyDown:b,onPointerDown:z,onPointerUp:T,onPointerCancel:F,...B,className:`group flex w-full cursor-pointer items-center gap-1 rounded px-2 py-1.5 text-left text-[13px] transition active:scale-[0.99] ${t?"bg-surface-elevated text-foreground":"text-muted-foreground hover:bg-surface-2 hover:text-foreground"}`,style:{paddingLeft:`${n*14+8}px`},children:[r.jsx("span",{className:"flex min-w-[14px] shrink-0 items-center justify-center text-muted-foreground/80",children:m}),r.jsx("span",{className:"min-w-0 flex-1",children:h}),i]})}function rt(t){return t.path.replace(/^\/+/,"")}function Dt(t){if(t.displayName!==void 0||t.displayDir!==void 0)return{name:t.displayName||t.path,dir:t.displayDir||""};const n=t.path.split("/").filter(Boolean);return{name:n.pop()||t.path,dir:n.join("/")}}function nt(t,n){const c=new Map,m=(i,y,x,g)=>{const f=i.get(y);if(f)return f;const b={path:x,name:y,childCount:0,directories:[],files:[]};return i.set(y,b),g?.directories.push(b),b};for(const i of t){const y=n(i).split("/").filter(Boolean);if(y.length<=1)continue;let x=c,g=null,f="";for(const b of y.slice(0,-1)){f=f?`${f}/${b}`:b;const z=m(x,b,f,g);g=z,x=new Map(z.directories.map(T=>[T.name,T]))}g?.files.push(i)}const h=i=>{const y=i.directories.map(h).sort((g,f)=>g.name.localeCompare(f.name)),x=i.files.sort((g,f)=>g.path.localeCompare(f.path));return{...i,directories:y,files:x,childCount:y.reduce((g,f)=>g+f.childCount,0)+x.length}};return Array.from(c.values()).map(h).sort((i,y)=>i.name.localeCompare(y.name))}function Pe(t,n,c=0){const m=n.selectedKey===t.key||n.selectedKey===t.path||n.selectedKey===t.absolutePath,h=Dt(t);return r.jsx(tt,{selected:m,role:"button",tabIndex:0,title:t.title??t.absolutePath??t.path,onClick:()=>{Ze()||n.onSelectFile(t)},onKeyDown:i=>{i.key!=="Enter"&&i.key!==" "||(i.preventDefault(),n.onSelectFile(t))},leading:n.renderLeading(t),depth:c,trailing:n.renderTrailing?.(t),dataAttributes:{"data-diff-selection-path":t.key,"data-diff-file-path":t.path,"data-diff-absolute-path":t.absolutePath??"","data-diff-status":t.status},children:r.jsxs("span",{className:"select-text","data-sidebar-selectable":!0,children:[r.jsx("span",{className:`block truncate leading-snug ${m?"font-medium":""}`,children:h.name}),n.mode!=="tree"&&h.dir&&r.jsx("span",{className:"block truncate text-[10px] text-muted-foreground/75",children:h.dir}),n.renderSubtitle?.(t)]})},t.key)}function st(t,n,c,m,h){let i=t;const y=[t.name];for(;i.files.length===0&&i.directories.length===1;)i=i.directories[0],y.push(i.name);const x=y.join("/"),g=`${n}:${i.path}`,f=c.collapsedDirectoryKeys.has(g);return r.jsxs("div",{className:"space-y-px",children:[r.jsx(tt,{role:"button",tabIndex:0,onClick:()=>{Ze()||c.onToggleDirectory(g)},onKeyDown:b=>{b.key!=="Enter"&&b.key!==" "||(b.preventDefault(),c.onToggleDirectory(g))},ariaExpanded:!f,depth:m,title:i.path,leading:f?r.jsx(dt,{size:13}):r.jsx(ft,{size:13}),trailing:r.jsxs("span",{className:"flex shrink-0 items-center gap-1",children:[r.jsx("span",{className:"shrink-0 rounded bg-surface-2 px-1.5 py-0.5 text-[10px] text-muted-foreground/60 transition group-hover:text-muted-foreground",children:i.childCount}),c.renderDirectoryTrailing?.(i.path,h)]}),children:r.jsxs("span",{className:"flex min-w-0 items-center gap-1",children:[r.jsx(yt,{size:14,className:"shrink-0 text-[color:var(--folder)]"}),r.jsx("span",{className:"min-w-0 flex-1 truncate leading-snug select-text","data-sidebar-selectable":!0,children:x})]})}),!f&&r.jsxs("div",{className:"space-y-px",children:[i.directories.map(b=>st(b,n,c,m+1,h)),i.files.length>0&&r.jsx("div",{className:"space-y-px",children:i.files.map(b=>Pe(b,c,m+1))})]})]},g)}function St(t,n){const c=n.getFileTreePath??rt,m=t.files.filter(i=>c(i).split("/").filter(Boolean).length<=1),h=nt(t.files,c);return r.jsxs("div",{className:"space-y-px",children:[h.map(i=>st(i,t.key,n,0,t)),m.length>0&&r.jsx("div",{className:"space-y-px",children:m.map(i=>Pe(i,n))})]})}function It(t,n=rt){const c=[],m=i=>{for(const y of i.directories)m(y);c.push(...i.files)};for(const i of nt(t,n))m(i);const h=new Set(c.map(i=>i.key));return c.push(...t.filter(i=>!h.has(i.key))),c}function Et(t){return r.jsx("div",{className:t.mode==="tree"?"space-y-px pt-1":"space-y-2",children:t.groups.map(n=>{const c=!!n.header,m=!!n.collapsed;return r.jsxs("section",{className:c?"overflow-hidden rounded-lg border border-border/15 bg-surface/60":"",children:[n.header,!m&&r.jsx("div",{className:t.mode==="tree"?c?"space-y-px bg-surface/60 p-1":"space-y-px":c?"space-y-px bg-surface/60 p-1.5":"space-y-px",children:t.mode==="tree"?St(n,t):n.files.map(h=>Pe(h,t))})]},n.key)})})}const Ce="termdock:diff-review:list-width:v1",Ct=120,He=320,qe=220,Ft=560;function _t(t){return typeof t=="number"&&Number.isFinite(t)}function Ue(t,n){const c=Math.max(qe,n-360),m=Math.min(Ft,c);return Math.min(m,Math.max(qe,t))}function At(){return vt(Ce,_t)??He}function zt({list:t,detail:n,mobile:c,mobileListHeader:m,mobileDetailHeader:h,desktopListHeader:i,backLabel:y,onMobileSlideChange:x,externalSwiperRef:g,desktopLayout:f="split",onDetailScroll:b,desktopSidePanel:z,desktopListClassName:T,detailOwnsScroll:F=!1}){const{t:B}=ht(),P=o.useRef(null),q=o.useRef(null),I=o.useRef(null),[U,$]=o.useState(At);o.useEffect(()=>{if(c||f!=="split")return;const p=q.current;p&&$(j=>Ue(j,p.clientWidth))},[f,c]);const ae=o.useCallback(p=>{c||f!=="split"||(p.preventDefault(),I.current={startX:p.clientX,startWidth:U,pointerId:p.pointerId},p.currentTarget.setPointerCapture(p.pointerId))},[f,U,c]),ue=o.useCallback(p=>{const j=I.current;if(!j||j.pointerId!==p.pointerId)return;const D=q.current?.clientWidth??window.innerWidth,_=Ue(j.startWidth+p.clientX-j.startX,D);$(_),mt(Ce,_,Ct)},[]),ie=o.useCallback(p=>{const j=I.current;if(!(!j||j.pointerId!==p.pointerId)){I.current=null,pt(Ce);try{p.currentTarget.releasePointerCapture(p.pointerId)}catch{}}},[]);if(c){const p=()=>{const v=P.current;v&&v.slideTo(1)},j=()=>{const v=P.current;v&&v.slideTo(0)},D=typeof t=="function"?t({slideToDetail:p}):t,_=typeof h=="function"?h({slideToList:j,slideToDetail:p}):h;return r.jsxs(wt,{className:"h-full min-h-0 w-full",slidesPerView:1,resistanceRatio:.45,noSwiping:!0,noSwipingClass:"swiper-no-swiping",noSwipingSelector:".swiper-no-swiping",allowTouchMove:!1,touchAngle:75,touchStartPreventDefault:!1,onSwiper:v=>{P.current=v,g&&(g.current=v)},onSlideChange:v=>{x?.(v.activeIndex)},children:[r.jsx(Ke,{className:"h-full min-h-0",children:r.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:[m&&r.jsx("div",{className:"shrink-0 border-b border-border/15 px-3 py-2",children:m}),r.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain",children:D})]})}),r.jsx(Ke,{className:"h-full min-h-0",children:r.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden bg-surface",children:[r.jsx("div",{className:"shrink-0 border-b border-border/15 px-3 py-2",children:_??r.jsxs("button",{type:"button",onClick:j,className:"inline-flex h-9 shrink-0 items-center gap-1.5 rounded-full bg-surface-2 px-3 text-xs font-semibold text-muted-foreground transition hover:bg-surface-elevated hover:text-foreground active:scale-95",children:[r.jsx(xt,{size:14}),y]})}),r.jsx("div",{className:F?"min-h-0 flex-1 overflow-hidden":"termdock-diff-stream-scroller min-h-0 flex-1 overflow-y-auto overscroll-contain",onScroll:F?void 0:v=>b?.(v.currentTarget),children:n})]})})]})}const W=typeof t=="function"?t({slideToDetail:()=>{}}):t;return f==="stacked"?F?r.jsxs("div",{className:"termdock-native-select min-h-0 flex-1 overflow-hidden px-2 pb-[calc(env(safe-area-inset-bottom)+4.5rem)]",children:[i&&r.jsx("div",{className:"sticky top-0 z-10 border-b border-border/15 bg-surface px-2 py-2",children:i}),W,r.jsx("div",{className:"mt-3 h-[calc(100%-3rem)] min-h-0 overflow-hidden rounded-xl border border-border/15 bg-surface",children:n})]}):r.jsxs("div",{className:"termdock-native-select termdock-diff-stream-scroller min-h-0 flex-1 overflow-y-auto overscroll-contain px-2 pb-[calc(env(safe-area-inset-bottom)+4.5rem)]",onScroll:p=>b?.(p.currentTarget),children:[i&&r.jsx("div",{className:"sticky top-0 z-10 border-b border-border/15 bg-surface px-2 py-2",children:i}),W,r.jsx("div",{className:"mt-3 overflow-hidden rounded-xl border border-border/15 bg-surface",children:n})]}):r.jsxs("div",{ref:q,className:"flex h-full min-h-0 overflow-hidden",children:[z,r.jsxs("div",{className:T??"shrink-0 overflow-y-auto overscroll-contain border-r border-border/15 bg-surface",style:{width:U},children:[i&&r.jsx("div",{className:"sticky top-0 z-10 border-b border-border/15 bg-surface px-2 py-2",children:i}),W]}),r.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":B("diffViewer.resizeNavigation"),title:B("diffViewer.resizeNavigation"),className:"group relative z-10 w-2 shrink-0 cursor-col-resize touch-none border-r border-border/15 bg-surface",onPointerDown:ae,onPointerMove:ue,onPointerUp:ie,onPointerCancel:ie,onDoubleClick:()=>{$(He),gt(Ce,He)},children:r.jsx("span",{className:"pointer-events-none absolute inset-y-0 left-1/2 w-px -translate-x-1/2 bg-border/30 transition group-hover:bg-primary/60"})}),r.jsx("div",{className:F?"min-w-0 flex-1 overflow-hidden":"termdock-diff-stream-scroller min-w-0 flex-1 overflow-y-auto overscroll-contain",onScroll:F?void 0:p=>b?.(p.currentTarget),children:n})]})}function Lt({mode:t,onModeChange:n,showAi:c=!1}){return r.jsxs("div",{className:"inline-flex h-7 shrink-0 overflow-hidden rounded-md bg-surface-2 p-0.5",children:[r.jsx("button",{type:"button",onClick:()=>n("list"),"aria-pressed":t==="list",className:`inline-flex h-6 w-7 items-center justify-center rounded-md transition active:scale-95 ${t==="list"?"bg-surface-elevated text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:r.jsx(Tt,{size:13})}),r.jsx("button",{type:"button",onClick:()=>n("tree"),"aria-pressed":t==="tree",className:`inline-flex h-6 w-7 items-center justify-center rounded-md transition active:scale-95 ${t==="tree"?"bg-surface-elevated text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:r.jsx(Nt,{size:13})}),c&&r.jsx("button",{type:"button",onClick:()=>n("ai"),"aria-pressed":t==="ai",className:`inline-flex h-6 w-7 items-center justify-center rounded-md transition active:scale-95 ${t==="ai"?"bg-surface-elevated text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:r.jsx(et,{size:13})})]})}function Ht({groups:t,mode:n,onModeChange:c,selectedKey:m,collapsedDirectoryKeys:h,onToggleDirectory:i,onSelectFile:y,renderLeading:x,renderTrailing:g,renderDirectoryTrailing:f,renderSubtitle:b,detail:z,mobile:T,backLabel:F,compact:B=!1,emptyContent:P,listPrefix:q,aiContent:I,listContainerClassName:U="px-2 py-2",detailContainerClassName:$="termdock-native-select termdock-diff-stream-scroller min-h-0",renderListHeader:ae,renderMobileDetailHeader:ue,externalSwiperRef:ie,onMobileSlideChange:W,slideToDetailOnMobile:p=!0,desktopLayout:j="split",onDetailScroll:D,desktopSidePanel:_,desktopListClassName:v,detailOwnsScroll:ee}){const[V,O]=o.useState(!1);o.useEffect(()=>{if(!V)return;const A=L=>{L.key==="Escape"&&O(!1)};return document.addEventListener("keydown",A),()=>document.removeEventListener("keydown",A)},[V]);const de=r.jsx(Lt,{mode:n,onModeChange:c,showAi:!!I}),pe=n==="tree"?"tree":"list",xe=ae?ae(de):r.jsx("div",{className:"flex justify-end",children:de}),ge=t.some(A=>A.files.length>0),te=r.jsx(zt,{mobile:V?!1:T,backLabel:F,externalSwiperRef:ie,onMobileSlideChange:W,desktopLayout:V?"split":j,onDetailScroll:D,desktopSidePanel:_,desktopListClassName:v,detailOwnsScroll:ee,mobileListHeader:T?xe:void 0,desktopListHeader:T?void 0:xe,mobileDetailHeader:ue,list:({slideToDetail:A})=>r.jsx("div",{className:U,children:n==="ai"?typeof I=="function"?I({slideToDetail:A,fullscreen:V,toggleFullscreen:()=>O(L=>!L)}):I??P:r.jsxs(r.Fragment,{children:[q,ge?r.jsx(Et,{groups:t,selectedKey:m,mode:pe,mobile:T,compact:B,collapsedDirectoryKeys:h,onToggleDirectory:i,onSelectFile:L=>{y(L),T&&p&&window.requestAnimationFrame(A)},renderLeading:x,renderTrailing:g,renderDirectoryTrailing:f,renderSubtitle:b}):P]})}),detail:r.jsx("div",{className:ee?"h-full min-h-0":$,children:z})});return!V||typeof document>"u"?te:Je.createPortal(r.jsxs("div",{className:"fixed inset-0 z-modal-panel flex min-h-0 flex-col bg-surface text-foreground",children:[r.jsxs("div",{className:"flex h-12 shrink-0 items-center justify-between border-b border-border/15 bg-[var(--chrome-bg)] px-3",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[r.jsx(et,{size:15,className:"shrink-0 text-primary"}),r.jsx("span",{className:"truncate text-[12px] font-semibold",children:"DAG Review"}),r.jsx("span",{className:"hidden text-[10px] text-muted-foreground sm:inline",children:"Select a step to inspect its exact change"})]}),r.jsx("button",{type:"button",onClick:()=>O(!1),className:"inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-muted-foreground transition hover:bg-surface-2 hover:text-foreground active:scale-95",title:"Exit full-screen DAG review (Esc)","aria-label":"Exit full-screen DAG review",children:r.jsx(bt,{size:16})})]}),r.jsx("div",{className:"min-h-0 flex-1",children:te})]}),document.body)}const Pt=96,ze=44;function Wt({file:t,repoRoot:n,selectionPath:c,displayName:m,displayDir:h,selected:i,activePane:y,visible:x,reusableContent:g=!1,estimatedHeight:f,lightweight:b=!1,wrap:z,viewType:T,inlineMode:F,diffOptions:B,reloadKey:P=0,auditRecords:q,diffOverride:I,oldSourceRef:U,preparedDiff:$,renderBadge:ae,onInsertDiffReference:ue,onHunkGitAction:ie,previewReverts:W,onReferenceCopied:p,insertedReferenceKey:j,copiedReferenceKey:D,onClearAuditRecord:_,onContentReady:v,onHeightChange:ee}){const V=o.useRef(null),O=o.useRef(null),de=o.useRef(null),[pe,xe]=o.useState(null),ge=o.useRef(64),te=o.useRef(f??104),A=o.useRef(null),L=o.useRef(null),Q=o.useRef(!1),le=o.useRef(!1),E=o.useRef(null),[re,je]=o.useState(!1),[Ne,Se]=o.useState(!1),ve=t.absolutePath||(n?`${n}/${t.path}`:t.path),N=o.useCallback(()=>{le.current||(le.current=!0,Se(!0),v?.(c))},[v,c]);o.useLayoutEffect(()=>{if(!(I!==void 0&&x&&le.current))return Q.current=!1,le.current=!1,A.current=null,L.current=null,E.current!==null&&(window.clearTimeout(E.current),E.current=null),je(!1),Se(!1),()=>{E.current!==null&&(window.clearTimeout(E.current),E.current=null)}},[I,$,P,g,x]),o.useLayoutEffect(()=>{const X=A.current;!re||X===null||Math.abs((f??104)-X)>=1||(A.current=null,N())},[N,f,re]),o.useLayoutEffect(()=>{if(!x||!re)return;const X=de.current;if(!X)return;const be=()=>{if(!Q.current)return;const Y=X.firstElementChild;if(!Y)return;const K=Math.ceil(Math.max(Y.getBoundingClientRect().height,Y.scrollHeight,64)),he=ge.current;if(K>0&&he!==K&&(ge.current=K,xe(K)),!V.current)return;const C=O.current?.getBoundingClientRect().height??ze,se=Math.ceil(C+K+1);se<=0||L.current===se||(L.current=se,E.current!==null&&window.clearTimeout(E.current),E.current=window.setTimeout(()=>{if(E.current=null,!Q.current)return;const H=L.current;if(H===null)return;const S=te.current;if(le.current){te.current=H,Math.abs(S-H)>=1&&ee?.(c,S,H),v?.(c);return}if(A.current=H,Math.abs(S-H)<1||!ee){te.current=H,A.current=null,N();return}te.current=H,ee(c,S,H)},Pt))};if(be(),typeof ResizeObserver>"u")return;const fe=new ResizeObserver(be);return fe.observe(X),X.firstElementChild&&fe.observe(X.firstElementChild),O.current&&fe.observe(O.current),()=>fe.disconnect()},[N,v,ee,c,re,x,z,T,F]);const G=x&&!Ne;return r.jsxs("div",{ref:V,"data-diff-stream-item":c,"data-diff-selection-path":c,"data-diff-file-path":t.path,"data-diff-absolute-path":ve,className:`scroll-mt-3 border-b border-border/15 last:border-b-0 ${G||!x?"overflow-hidden":""} ${i?"bg-surface-elevated/35":""}`,style:x?G?{height:f??104}:void 0:{height:f??104},children:[r.jsxs("div",{ref:O,"data-diff-stream-header":!0,className:`sticky top-0 z-10 flex min-w-0 items-center gap-2 border-b border-border/15 px-3 py-2 ${i?"bg-surface-elevated":"bg-surface"}`,children:[ae(t.status),r.jsxs("div",{className:"min-w-0 flex-1",title:ve,children:[r.jsx("div",{className:"truncate text-xs font-semibold text-foreground",children:m}),h&&r.jsx("div",{className:"truncate text-[10px] text-muted-foreground",children:h})]})]}),r.jsxs("div",{ref:de,className:"relative","data-diff-stream-body":!0,style:x?{minHeight:Ne?64:Math.max(pe??64,(f??104)-ze)}:{height:Math.max(pe??64,(f??104)-ze)},children:[x?r.jsx(kt,{active:y,repoRoot:n,filePath:t.path,referenceFilePath:ve,changedFile:t,wrap:z,viewType:T,inlineMode:F,diffOptions:B,reloadKey:P,embedded:!0,lightweight:b,auditRecords:q,diffOverride:I,oldSourceRef:U,preparedDiff:$,onClearAuditRecord:_,onContentReady:()=>{if(g){Q.current=!0,je(!0),N();return}Q.current||(Q.current=!0,je(!0))},onInsertDiffReference:ue,onHunkGitAction:ie,previewReverts:W,onReferenceCopied:p,insertedReferenceKey:j,copiedReferenceKey:D}):r.jsx("div",{className:"flex h-full min-h-16 items-center justify-center bg-surface px-3 py-4 text-center text-xs text-muted-foreground",children:t.path}),x&&re&&!Ne&&r.jsx("div",{"data-diff-measuring-overlay":!0,className:"absolute inset-0 z-20 bg-surface"})]})]})}const Oe=8,Le=1600,Qe=104,Bt=1e3,Re=new Map;function $t(t,n){for(Re.delete(t),Re.set(t,n);Re.size>Bt;){const c=Re.keys().next().value;if(c===void 0)break;Re.delete(c)}}function Vt(t,n){return!!(t&&t.diffOverride===n.diffOverride&&t.oldSourceRef===n.oldSourceRef&&t.reloadKey===n.reloadKey&&t.wrap===n.wrap&&t.viewType===n.viewType&&t.inlineMode===n.inlineMode&&t.algorithm===n.algorithm&&t.whitespace===n.whitespace&&t.context===n.context)}const Gt={added:{label:"A",className:"text-[color:var(--diff-insert-strong)]",title:"Added"},modified:{label:"M",className:"text-[color:var(--diff-hunk-accent)]",title:"Modified"},deleted:{label:"D",className:"text-[color:var(--diff-delete-strong)]",title:"Deleted"},renamed:{label:"R",className:"text-muted-foreground",title:"Renamed"},copied:{label:"C",className:"text-[color:var(--diff-insert-strong)]",title:"Copied"},untracked:{label:"U",className:"text-[color:var(--diff-insert-strong)]",title:"Untracked (new file)"},conflicted:{label:"!",className:"text-destructive",title:"Conflicted"},unknown:{label:"?",className:"text-muted-foreground",title:"Unknown"}};function Zt({status:t}){const n=Gt[t]??{label:"?",className:"text-muted-foreground",title:t};return r.jsx("span",{className:`w-4 shrink-0 text-center text-[10px] font-mono font-bold ${n.className}`,title:n.title,children:n.label})}function er(t,n){return n?{key:n,nonce:t.nonce+1}:t}function tr({files:t,groups:n,selectedKey:c,onSelectFile:m,mode:h,onModeChange:i,collapsedDirectoryKeys:y,onToggleDirectory:x,renderLeading:g,renderTrailing:f,renderDirectoryTrailing:b,renderSubtitle:z,renderStreamBadge:T,onInsertDiffReference:F,onHunkGitAction:B,onReferenceCopied:P,insertedReferenceKey:q,copiedReferenceKey:I,onClearAuditRecord:U,mobile:$,backLabel:ae,compact:ue,desktopLayout:ie,wrap:W,diffViewType:p,inlineMode:j,diffOptions:D,activePane:_,reloadKey:v=0,renderListHeader:ee,renderMobileDetailHeader:V,emptyContent:O,listPrefix:de,aiContent:pe,listContainerClassName:xe,detailContainerClassName:ge,desktopSidePanel:te,desktopListClassName:A,onDetailScroll:L,initialDetailScrollTop:Q,preserveScrollOnUpdate:le=!1,scrollToKey:E,scrollToKeyNonce:re=0,externalSwiperRef:je,onMobileSlideChange:Ne,slideToDetailOnMobile:Se}){const ve=o.useMemo(()=>e=>c===e.key||c===e.path||c===e.absolutePath,[c]),N=o.useMemo(()=>{const e=new Map;for(const a of t)e.set(a.key,a),a.path&&e.set(a.path,a),a.absolutePath&&e.set(a.absolutePath,a);const s=[],l=new Set;for(const a of n){const d=h==="tree"?It(a.files):a.files;for(const w of d){const u=e.get(w.key);!u||l.has(u.key)||(s.push(u),l.add(u.key))}}for(const a of t)l.has(a.key)||s.push(a);return s},[t,n,h]),G=o.useRef(null),X=o.useRef(null),be=o.useRef(null),fe=o.useRef(v),Y=o.useRef(0),K=o.useRef(null),he=o.useRef(new Map(Re)),ne=o.useRef({key:null,top:0}),C=o.useRef(new Set),se=o.useRef(new Map),H=o.useRef(new Map),S=o.useRef(null),We=o.useRef(()=>{}),Me=o.useRef([]),me=o.useRef(new Map),Be=o.useRef({tops:[],heights:[],bottom:0}),[Ie,ot]=o.useState(()=>new Set),[ct,at]=o.useState(0),[J,ye]=o.useState({top:0,height:0}),Te=o.useMemo(()=>N.map(e=>e.key),[N]),Ee=Te.join("");H.current=o.useMemo(()=>new Map(N.map(e=>[e.key,{diffOverride:e.diffOverride,oldSourceRef:e.oldSourceRef,reloadKey:v,wrap:W,viewType:p,inlineMode:j,algorithm:D?.algorithm,whitespace:D?.whitespace,context:D?.context}])),[N,v,W,p,j,D?.algorithm,D?.whitespace,D?.context]),Me.current=Te,me.current=o.useMemo(()=>new Map(Te.map((e,s)=>[e,s])),[Te]);const k=o.useMemo(()=>{const e=Te.map(a=>he.current.get(a)??Qe),s=new Array(e.length);for(let a=0;a<e.length;a+=1)s[a]=a===0?0:s[a-1]+e[a-1];const l=e.length>0?s[e.length-1]+e[e.length-1]:0;return{tops:s,heights:e,bottom:l}},[ct,Ee]);Be.current=k;const oe=o.useMemo(()=>E?N.find(e=>E===e.key||E===e.path||E===e.absolutePath)?.key??null:null,[N,E]),Fe=o.useMemo(()=>c?N.find(e=>c===e.key||c===e.path||c===e.absolutePath)?.key??null:null,[N,c]),De=o.useMemo(()=>{const e=k.tops.length;if(e===0)return-1;let s=0,l=e;for(;s<l;){const a=Math.floor((s+l)/2);k.tops[a]<=J.top+1?s=a+1:l=a}return Math.min(e-1,Math.max(0,s-1))},[k.tops,J.top]),ce=o.useCallback(e=>{C.current=e,ot(e)},[]),$e=o.useMemo(()=>{const e=J.top-Le,s=J.top+J.height+Le,l=new Set;let a=0,d=k.tops.length;for(;a<d;){const u=Math.floor((a+d)/2);k.tops[u]<=e?a=u+1:d=u}const w=Math.max(0,a-1);for(let u=w;u<k.tops.length;u+=1){const R=k.tops[u];if(R>s)break;R+k.heights[u]>=e&&R<=s&&l.add(u)}for(let u=De-1;u<=De+1;u+=1)u>=0&&u<k.tops.length&&l.add(u);for(const u of Ie){const R=me.current.get(u);R!==void 0&&l.add(R)}return Array.from(l).sort((u,R)=>u-R)},[k,J,Ie,De]),_e=o.useCallback(()=>{if(!_||S.current)return;const e=Me.current;if(e.length===0)return;const s=ne.current.key,l=Math.min(e.length-1,(s!==null?me.current.get(s):void 0)??Math.max(0,De)),a=u=>Math.abs((me.current.get(u)??0)-l),d=[];C.current.has(e[l])||d.push(e[l]);for(let u=1;u<=Oe;u+=1){const R=l+u,M=l-u;R<e.length&&!C.current.has(e[R])&&d.push(e[R]),M>=0&&!C.current.has(e[M])&&d.push(e[M])}const w=d[0];if(w){if(C.current.size>=Oe){const u=a(w),R=Array.from(C.current).filter(Z=>Z!==S.current).sort((Z,ke)=>a(ke)-a(Z))[0];if(!R||a(R)<=u)return;const M=new Set(C.current);M.delete(R),ce(M)}S.current=w,ce(new Set(C.current).add(w))}},[_,ce,De]);We.current=_e;const we=o.useCallback(e=>{if(C.current.has(e))return;const s=S.current;if(s&&s!==e){const l=new Set(C.current);l.delete(s),ce(l),S.current=null}S.current=e,ce(new Set(C.current).add(e))},[ce]),Ve=o.useCallback(e=>{if(!C.current.has(e))return;const s=H.current.get(e);s&&se.current.set(e,s),S.current===e&&(S.current=null),window.requestAnimationFrame(()=>We.current())},[]),Ge=o.useCallback((e,s,l)=>{if(Math.abs(l-s)<1)return;const a=he.current.get(e);a!==void 0&&Math.abs(a-l)<1||(he.current.set(e,l),$t(e,l),at(d=>d+1))},[]);o.useLayoutEffect(()=>{if(fe.current!==v){fe.current=v;for(const e of N){if(e.diffOverride!==void 0)continue;const s=qt(e.path,e.repoRoot);Rt(s,e.repoRoot??void 0,D)}}},[N,D,v]),o.useLayoutEffect(()=>{const e=G.current;if(!e)return;const s=()=>{const a=Math.max(0,Math.ceil(e.clientHeight));if(a===0)return;const d=e.scrollTop;ye(w=>w.height===a&&w.top===d?w:{top:d,height:a})};if(s(),typeof ResizeObserver>"u")return;const l=new ResizeObserver(s);return l.observe(e),()=>l.disconnect()},[$]),o.useEffect(()=>{_&&Fe&&we(Fe)},[_,we,Fe]),o.useEffect(()=>{const e=new Set(Me.current);for(const s of Array.from(he.current.keys()))e.has(s)||he.current.delete(s);for(const s of Array.from(C.current))if(!e.has(s)){const l=new Set(C.current);l.delete(s),ce(l)}for(const s of Array.from(se.current.keys()))e.has(s)||se.current.delete(s);if(S.current&&!e.has(S.current)&&(S.current=null),N.length===0){S.current=null,se.current.clear(),ce(new Set);return}_e()},[N.length,Ee,_e,$e,ce]);const Xe=o.useCallback(e=>{G.current=e;const s=Y.current,l=e.scrollTop;Y.current=l;const a=d=>{const w=Be.current,u=Me.current;let R=0,M=w.tops.length;for(;R<M;){const Ae=Math.floor((R+M)/2);w.tops[Ae]<=d+1?R=Ae+1:M=Ae}const Z=Math.min(u.length-1,Math.max(0,R-1)),ke=u[Z]??null;ne.current={key:ke,top:w.tops[Z]??0},ke&&we(ke)};Math.abs(l-s)>=Le?(Je.flushSync(()=>{ye({top:l,height:e.clientHeight})}),a(l)):K.current===null&&(K.current=window.requestAnimationFrame(()=>{K.current=null;const d=G.current;if(d){const w=d.scrollTop;ye({top:w,height:d.clientHeight}),a(w)}})),L?.(e)},[L,we]);o.useEffect(()=>()=>{K.current!==null&&window.cancelAnimationFrame(K.current)},[]),o.useLayoutEffect(()=>{const e=G.current;if(!e)return;const s=ne.current;if(s.key===null)return;const l=me.current.get(s.key);if(l===void 0)return;const a=(k.tops[l]??s.top)-s.top;if(Math.abs(a)<1)return;const d=e.scrollTop+a;Y.current=d,ye(w=>({top:d,height:w.height})),typeof e.scrollTo=="function"?e.scrollTo({top:d,behavior:"instant"}):e.scrollTop=d},[k]),o.useLayoutEffect(()=>{const e=Me.current,s=k.tops;if(e.length===0){ne.current={key:null,top:0};return}const l=Y.current,a=l+(G.current?.clientHeight??J.height),d=ne.current;if(d.key!==null){const M=me.current.get(d.key);if(M!==void 0){const Z=s[M]??0;if(Z+(k.heights[M]??Qe)>l&&Z<a){ne.current={key:d.key,top:Z};return}}}let w=0,u=s.length;for(;w<u;){const M=Math.floor((w+u)/2);s[M]<=l+1?w=M+1:u=M}const R=Math.min(s.length-1,Math.max(0,w-1));ne.current={key:e[R]??null,top:s[R]??0}}),o.useLayoutEffect(()=>{if(!oe)return;const e=X.current;if(e?.key===oe&&e.nonce===re)return;const s=me.current.get(oe);if(s===void 0)return;we(oe),ne.current={key:oe,top:k.tops[s]??0};const l=G.current;if(!l||l.clientHeight===0||J.height!==l.clientHeight)return;X.current={key:oe,nonce:re};const a=k.tops[s]??0;typeof l.scrollTo=="function"?l.scrollTo({top:a,behavior:"instant"}):l.scrollTop=a;const d=l.scrollTop;Y.current=d,ye({top:d,height:l.clientHeight})},[k,J.height,we,oe,re]),o.useLayoutEffect(()=>{if(Q===void 0||oe)return;const e=Ee;if(be.current===e||le&&be.current!==null)return;const s=G.current;if(!s)return;be.current=e;const l=Math.max(0,k.bottom-s.clientHeight),a=Math.min(Math.max(0,Q),l);typeof s.scrollTo=="function"?s.scrollTo({top:a,behavior:"instant"}):s.scrollTop=a;const d=s.scrollTop;Y.current=d,ye({top:d,height:s.clientHeight})},[k.bottom,Q,Ee,le,oe]);const it=o.useCallback((e,s)=>{const l=ve(e),a=H.current.get(e.key),d=a!==void 0&&Vt(se.current.get(e.key),a);return r.jsx(Xt,{item:e,repoRoot:e.repoRoot,selectionPath:e.key,displayName:e.displayName,displayDir:e.displayDir,selected:l,activePane:_,visible:Ie.has(e.key),reusableContent:d,estimatedHeight:s,lightweight:!1,wrap:W,viewType:p,inlineMode:j,diffOptions:D,reloadKey:v,auditRecords:e.auditRecords,diffOverride:e.diffOverride,oldSourceRef:e.oldSourceRef,renderStreamBadge:T,onInsertDiffReference:e.onInsertDiffReference??F,onHunkGitAction:e.onHunkGitAction??B,previewReverts:e.previewReverts,onReferenceCopied:P,insertedReferenceKey:q,copiedReferenceKey:I,onClearAuditRecord:U,onContentReady:Ve,onHeightChange:Ge})},[_,I,D,p,Ve,Ge,j,q,ve,Ie,U,B,F,P,v,T,W]),lt=r.jsx("div",{"data-diff-stream-content":!0,"data-diff-stream-canvas":!0,className:"termdock-diff-stream relative overflow-clip bg-surface will-change-transform",style:{height:Math.max(k.bottom,(k.tops.at(-1)??0)+J.height)},children:$e.map(e=>{const s=N[e];return s?r.jsx("div",{"data-diff-canvas-slot":s.key,className:"absolute inset-x-0",style:{top:k.tops[e]},children:it(s,k.heights[e])},s.key):null})}),ut=r.jsx("div",{ref:G,className:"termdock-diff-stream termdock-diff-stream-scroller h-full max-h-full min-h-0 overflow-y-auto overscroll-contain bg-surface [overflow-anchor:none]",onScroll:e=>Xe(e.currentTarget),children:lt});return r.jsx(Ht,{groups:n,mode:h,onModeChange:i,selectedKey:c,collapsedDirectoryKeys:y,onToggleDirectory:x,onSelectFile:m,renderLeading:g,renderTrailing:f,renderDirectoryTrailing:b,renderSubtitle:z,detail:ut,mobile:$,backLabel:ae,compact:ue,emptyContent:O,listPrefix:de,aiContent:pe,listContainerClassName:xe,detailContainerClassName:ge,renderListHeader:ee,renderMobileDetailHeader:V,externalSwiperRef:je,onMobileSlideChange:Ne,slideToDetailOnMobile:Se,desktopLayout:ie,onDetailScroll:Xe,desktopSidePanel:te,desktopListClassName:A,detailOwnsScroll:!0})}const Xt=o.memo(function({item:n,renderStreamBadge:c,...m}){return r.jsx(Wt,{...m,file:Kt(n),renderBadge:h=>c(h,n)})});function Kt(t){return{path:t.path,oldPath:t.oldPath,absolutePath:t.absolutePath,status:t.status}}function qt(t,n){if(t)return n&&t.startsWith(`${n}/`)?t.slice(n.length+1):t}export{Zt as C,tr as D,Nt as L,It as f,er as n};
|